refactor(blazing): 重构任务系统并优化相关功能
- 重构了任务系统的数据结构和执行逻辑 - 优化了地图加载和怪物刷新机制 - 改进了宠物系统的基础架构 - 调整了玩家信息和背包的处理方式 - 统一了数据访问层的接口和实现
This commit is contained in:
@@ -2,9 +2,9 @@ package model
|
||||
|
||||
import (
|
||||
"blazing/cool"
|
||||
"time"
|
||||
)
|
||||
|
||||
// todo 还需要做一个记录任务奖励的表
|
||||
const TableNameTask = "task"
|
||||
|
||||
// Task mapped from table <task>
|
||||
@@ -18,17 +18,17 @@ type Task struct {
|
||||
type TaskInfo struct {
|
||||
// TaskInfo 任务步骤信息,对应Java的@ArraySerialize(FIXED_LENGTH=20)注解
|
||||
// struc:"[20]byte" 确保二进制序列化时固定20字节长度,json标签指定JSON字段名
|
||||
TaskType uint32 `json:"task_type"` //区分是每日任务还是常规任务,常规为0,每日为1
|
||||
TaskInfo []uint32 `struc:"[20]byte" json:"task_info"`
|
||||
LastResetTime time.Time `gorm:"not null;comment:'上次重置时间(UTC)'" json:"last_reset_time"` //这里是每天重置
|
||||
TaskID uint32 `json:"task_id"` //区分是每日任务还是常规任务,常规为0,每日为1
|
||||
TaskInfo []uint32 `struc:"[20]byte" json:"task_info"`
|
||||
//LastResetTime time.Time `gorm:"not null;comment:'上次重置时间(UTC)'" json:"last_reset_time"` //这里是每天重置
|
||||
// Status 任务整体状态:0-未接受,1-已接受,2-已完成未领取,3-已完成已领取
|
||||
// json标签指定JSON字段名,与业务状态说明保持一致
|
||||
Status byte `json:"status"`
|
||||
//Status byte `json:"status"`
|
||||
}
|
||||
|
||||
// TableName PlayerInfo's table name
|
||||
func (*Task) TableName() string {
|
||||
return TableNamePlayerInfo
|
||||
return TableNameTask
|
||||
}
|
||||
|
||||
// GroupName PlayerInfo's table group
|
||||
@@ -36,6 +36,13 @@ func (*Task) GroupName() string {
|
||||
return "default"
|
||||
}
|
||||
|
||||
func (t *Task) GetData() string {
|
||||
return t.Data
|
||||
}
|
||||
func (t *Task) SetData(t1 string) {
|
||||
t.Data = t1
|
||||
}
|
||||
|
||||
// NewPlayerInfo create a new PlayerInfo
|
||||
func NewTask() *Task {
|
||||
return &Task{
|
||||
|
||||
Reference in New Issue
Block a user