diff --git a/common/constant.go b/common/constant.go index b228c6f..ba42396 100644 --- a/common/constant.go +++ b/common/constant.go @@ -597,6 +597,7 @@ const ( ItemIDSlippers = 100010 // 拖鞋 ItemIDPermit = 100011 // 赛季通行证积分 ItemIDLong = 50013 // 龙币 + ItemIDPetSkill = 11001 //宠物技能升级道具 ) func ToItemId(id int32) int32 { diff --git a/worldsrv/bagmgr.go b/worldsrv/bagmgr.go index 10620a1..9624bf8 100644 --- a/worldsrv/bagmgr.go +++ b/worldsrv/bagmgr.go @@ -290,6 +290,10 @@ func (this *BagMgr) AddItems(p *Player, addItems []*Item, add int64, gainWay int Num: v.ItemNum, }) } + + if v.ItemId == common.ItemIDPetSkill && v.ItemNum > 0 { + PetMgrSington.CheckShowRed(p) + } } if len(changeItems) > 0 { diff --git a/worldsrv/petmgr.go b/worldsrv/petmgr.go index 0c11c82..720838c 100644 --- a/worldsrv/petmgr.go +++ b/worldsrv/petmgr.go @@ -344,7 +344,12 @@ func (this *PetMgr) CheckShowRed(p *Player) { status := true for itemId, itemNum := range SkillInfo.ItemConsum { item := BagMgrSingleton.GetItem(p.SnId, int32(itemId)) - if item.ItemNum < itemNum { + if item != nil { + if item.ItemNum < itemNum { + status = false + break + } + } else { status = false break } @@ -363,7 +368,12 @@ func (this *PetMgr) CheckShowRed(p *Player) { status := true for itemId, itemNum := range SkillInfo.ItemConsum { item := BagMgrSingleton.GetItem(p.SnId, int32(itemId)) - if item.ItemNum < itemNum { + if item != nil { + if item.ItemNum < itemNum { + status = false + break + } + } else { status = false break }