```
feat(cache): 添加复合键缓存操作支持 添加了基于 uint32+string 组合键的缓存操作方法,包括 GetByCompoundKey、SetByCompoundKey、DelByCompoundKey 和 ContainsByCompoundKey 方法,用于处理用户ID和会话ID的组合缓存场景 fix(vscode): 添加 cSpell 配置支持 struc 词汇 refactor(session): 移除过时的会话管理方法 移除了基于单一字符串键的会话管理方法,因为已迁移到使用 复合键的缓存操作方式 ```
This commit is contained in:
@@ -3,36 +3,62 @@ package player
|
||||
import (
|
||||
"blazing/logic/service/fight/info"
|
||||
"blazing/logic/service/task"
|
||||
"blazing/modules/blazing/model"
|
||||
"blazing/modules/player/model"
|
||||
|
||||
"github.com/pointernil/bitset32"
|
||||
)
|
||||
|
||||
func (p *Player) CompletedTask(taskID int, ot uint32) {
|
||||
|
||||
// 这个是通过总任务去完成,还可以去实现完成分支
|
||||
// boss的完成时限,所以先完成默认的分支,然后完成指定分支
|
||||
func (p *Player) BossCompletedTask(taskID int, ot int) {
|
||||
//完成每日
|
||||
if p.Info.GetTask(taskID) == model.Unaccepted {
|
||||
p.Info.SetTask(taskID, model.Completed) //设置完成任务
|
||||
p.bossgive(taskID, -1)
|
||||
}
|
||||
|
||||
gift := task.GetTaskInfo(uint32(taskID), ot)
|
||||
if gift != nil {
|
||||
p.Service.Task.Exec(uint32(taskID), func(te *model.TaskEX) bool {
|
||||
if te != nil {
|
||||
|
||||
res := &info.S2C_GET_BOSS_MONSTER{
|
||||
BonusID: uint32(taskID),
|
||||
}
|
||||
if gift.Pet != nil {
|
||||
p.Service.Pet.PetAdd(gift.Pet)
|
||||
res.PetID = gift.Pet.ID
|
||||
res.CaptureTm = gift.Pet.CatchTime
|
||||
r := bitset32.From(te.Data)
|
||||
|
||||
}
|
||||
for _, item := range gift.ItemList {
|
||||
success := p.ItemAdd(item.ItemId, item.ItemCnt)
|
||||
if success {
|
||||
res.ItemList = append(res.ItemList, item)
|
||||
}
|
||||
if !r.Test(uint(ot)) {
|
||||
r.Set(uint(ot))
|
||||
p.bossgive(taskID, ot)
|
||||
|
||||
}
|
||||
|
||||
p.SendPackCmd(8004, res)
|
||||
}
|
||||
return true
|
||||
})
|
||||
|
||||
}
|
||||
func (p *Player) bossgive(taskID int, ot int) {
|
||||
gift := task.GetTaskInfo((taskID), ot)
|
||||
if gift != nil {
|
||||
|
||||
res := &info.S2C_GET_BOSS_MONSTER{
|
||||
BonusID: uint32(taskID),
|
||||
}
|
||||
if gift.Pet != nil {
|
||||
p.Service.Pet.PetAdd(gift.Pet)
|
||||
res.PetID = gift.Pet.ID
|
||||
res.CaptureTm = gift.Pet.CatchTime
|
||||
|
||||
}
|
||||
for _, item := range gift.ItemList {
|
||||
success := p.ItemAdd(item.ItemId, item.ItemCnt)
|
||||
if success {
|
||||
res.ItemList = append(res.ItemList, item)
|
||||
}
|
||||
|
||||
}
|
||||
if gift.Title != 0 {
|
||||
p.GiveTitle(gift.Title)
|
||||
|
||||
}
|
||||
|
||||
p.SendPackCmd(8004, res)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user