playroom每日任务

This commit is contained in:
hahwu 2025-04-23 15:45:39 +08:00
parent 7e59299731
commit 69c8fabc68
2 changed files with 767 additions and 659 deletions

View File

@ -9,6 +9,7 @@ import (
"server/game/mod/item"
"server/game/mod/quest"
"server/msg"
"sort"
)
type PlayroomMod struct {
@ -59,6 +60,7 @@ type DailyTask struct {
Status int
Quest quest.QuestProgress
UnLock bool
Index int
}
const (
@ -190,6 +192,7 @@ func (p *PlayroomMod) InitDailyTask() {
Status: 0,
Quest: Quest,
UnLock: true,
Index: Index,
}
Index++
}
@ -202,6 +205,7 @@ func (p *PlayroomMod) InitDailyTask() {
Status: 0,
Quest: Quest,
UnLock: false,
Index: Index,
}
Index++
}
@ -828,15 +832,19 @@ func (p *PlayroomMod) AddRoomPointAdd() {
}
}
func (p *PlayroomMod) BackDataTask() map[int32]*msg.DailyTask {
DailyTask := make(map[int32]*msg.DailyTask)
for k, v := range p.DailyTask {
DailyTask[int32(k)] = &msg.DailyTask{
func (p *PlayroomMod) BackDataTask() []*msg.DailyTask {
DailyTask := make([]*msg.DailyTask, 0)
for _, v := range p.DailyTask {
DailyTask = append(DailyTask, &msg.DailyTask{
Status: int32(v.Status),
UnLock: v.UnLock,
Progress: quest.QuestProgressToMsg(&v.Quest),
Items: item.ItemToMsg(v.Items),
}
Index: int32(v.Index),
})
}
sort.Slice(DailyTask, func(i, j int) bool {
return DailyTask[i].Index < DailyTask[j].Index
})
return DailyTask
}

File diff suppressed because it is too large Load Diff