feat(cache): 添加复合键缓存操作支持 添加了基于 uint32+string 组合键的缓存操作方法,包括 GetByCompoundKey、SetByCompoundKey、DelByCompoundKey 和 ContainsByCompoundKey 方法,用于处理用户ID和会话ID的组合缓存场景 fix(vscode): 添加 cSpell 配置支持 struc 词汇 refactor(session): 移除过时的会话管理方法 移除了基于单一字符串键的会话管理方法,因为已迁移到使用 复合键的缓存操作方式 ```
65 lines
1.3 KiB
Go
65 lines
1.3 KiB
Go
package player
|
|
|
|
import (
|
|
"blazing/logic/service/fight/info"
|
|
"blazing/logic/service/task"
|
|
"blazing/modules/player/model"
|
|
|
|
"github.com/pointernil/bitset32"
|
|
)
|
|
|
|
// 这个是通过总任务去完成,还可以去实现完成分支
|
|
// 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)
|
|
}
|
|
|
|
p.Service.Task.Exec(uint32(taskID), func(te *model.TaskEX) bool {
|
|
if te != nil {
|
|
|
|
r := bitset32.From(te.Data)
|
|
|
|
if !r.Test(uint(ot)) {
|
|
r.Set(uint(ot))
|
|
p.bossgive(taskID, ot)
|
|
|
|
}
|
|
|
|
}
|
|
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)
|
|
}
|
|
|
|
}
|