refactor: 重构怪物掉落和闪光处理逻辑
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
移除OgrePetInfo中与物品和闪光相关的冗余代码,将闪光处理逻辑整合到HandleNPCFightSpecial方法中 新增CanGetXUAN和CanGetItem方法用于判断是否获得特殊物品 添加S2C_GET_BOSS_MONSTER的ADD
This commit is contained in:
@@ -161,35 +161,44 @@ func (Controller) OnPlayerFightNpcMonster(data1 *fight.FightNpcMonsterInboundInf
|
||||
|
||||
fight.NewFight(p, ai, func(foi info.FightOverInfo) {
|
||||
//p.Done.Exec(model.MilestoneMode.Moster, []uint32{p.Info.MapID, monsterInfo.PetList[0].ID, uint32(foi.Reason)}, nil)
|
||||
if foi.Reason == 0 && foi.WinnerId == p.Info.UserID {
|
||||
if foi.Reason == 0 && foi.WinnerId == p.Info.UserID && p.CanGet() {
|
||||
|
||||
exp := uint32(xmlres.PetMAP[int(monster.ID)].YieldingExp) * monster.Level / 7
|
||||
addlevel, poolevel := p.CanGetExp()
|
||||
addexp := gconv.Float32(addlevel * gconv.Float32(exp))
|
||||
if addexp != 0 {
|
||||
poolexp := gconv.Float32(poolevel) * gconv.Float32((exp))
|
||||
items := &info.S2C_GET_BOSS_MONSTER{}
|
||||
|
||||
p.ItemAdd(3, int64(poolexp+addexp))
|
||||
items.ItemList = append(items.ItemList, data.ItemInfo{
|
||||
ItemId: 3,
|
||||
ItemCnt: int64(poolexp),
|
||||
})
|
||||
p.AddPetExp(foi.Winpet, int64(addexp))
|
||||
for _, v := range refPet.Item {
|
||||
count := int64(grand.Intn(2) + 1)
|
||||
ok := p.ItemAdd(v, count)
|
||||
if ok {
|
||||
items.ItemList = append(items.ItemList, data.ItemInfo{
|
||||
ItemId: v,
|
||||
ItemCnt: count,
|
||||
})
|
||||
}
|
||||
poolexp := gconv.Float32(poolevel) * gconv.Float32((exp))
|
||||
items := &info.S2C_GET_BOSS_MONSTER{}
|
||||
|
||||
p.ItemAdd(3, int64(poolexp+addexp))
|
||||
items.ADDitem(3, uint32(poolexp))
|
||||
|
||||
p.AddPetExp(foi.Winpet, int64(addexp))
|
||||
|
||||
if p.CanGetXUAN() {
|
||||
xuan := 400686 + int64(xmlres.PetMAP[int(refPet.GetID())].Type)
|
||||
ok := p.ItemAdd(xuan, 1)
|
||||
if ok {
|
||||
items.ADDitem(uint32(xuan), 1)
|
||||
}
|
||||
|
||||
p.SendPackCmd(8004, items)
|
||||
}
|
||||
if p.CanGetItem() {
|
||||
mapinfo := service.NewMapService().GetData(p.Info.MapID)
|
||||
|
||||
if len(mapinfo.DropItemIds) > 0 {
|
||||
|
||||
item := int64(mapinfo.DropItemIds[grand.Intn(len(mapinfo.DropItemIds))])
|
||||
count := int64(grand.Intn(2) + 1)
|
||||
ok := p.ItemAdd(item, count)
|
||||
if ok {
|
||||
items.ADDitem(uint32(item),uint32 (count))
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
p.SendPackCmd(8004, items)
|
||||
|
||||
evs := gconv.Int64s(strings.Split(xmlres.PetMAP[int(monster.ID)].YieldingEV, " "))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user