Merge branch 'main' of https://cnb.cool/blzing/blazing
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful

This commit is contained in:
昔念
2026-02-19 23:59:33 +08:00
3 changed files with 28 additions and 15 deletions

View File

@@ -3,6 +3,13 @@ package bitset32
import "math/bits"
func popcntSlice(s []uint32) uint64 {
// int r = 0;
// while(n)
// {
// n &= (n - 1);
// ++r;
// }
var cnt int
for _, x := range s {
cnt += bits.OnesCount32(x)

View File

@@ -203,23 +203,26 @@ func (Controller) OnPlayerFightNpcMonster(data1 *fight.FightNpcMonsterInboundInf
exp := uint32(xmlres.PetMAP[int(monster.ID)].YieldingExp) * monster.Level / 7
addlevel, poolevel := p.CanGetExp()
addexp := gconv.Float32(addlevel * gconv.Float32(exp))
poolexp := gconv.Float32(poolevel) * gconv.Float32((exp))
items := &info.S2C_GET_BOSS_MONSTER{}
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))
if refPet.Item != 0 {
count := int64(grand.Intn(2) + 1)
p.ItemAdd(refPet.Item, count)
p.ItemAdd(3, int64(poolexp+addexp))
items.ItemList = append(items.ItemList, data.ItemInfo{
ItemId: refPet.Item,
ItemCnt: count,
ItemId: 3,
ItemCnt: int64(poolexp),
})
p.AddPetExp(foi.Winpet, int64(addexp))
if refPet.Item != 0 {
count := int64(grand.Intn(2) + 1)
p.ItemAdd(refPet.Item, count)
items.ItemList = append(items.ItemList, data.ItemInfo{
ItemId: refPet.Item,
ItemCnt: count,
})
}
p.SendPackCmd(8004, items)
}
evs := gconv.Int64s(strings.Split(xmlres.PetMAP[int(monster.ID)].YieldingEV, " "))
@@ -231,8 +234,6 @@ func (Controller) OnPlayerFightNpcMonster(data1 *fight.FightNpcMonsterInboundInf
// p.Info.EVPool += lo.Sum(evs) //给予累计学习力
// }
p.SendPackCmd(8004, items)
}
})

View File

@@ -148,6 +148,11 @@ func (h Controller) UseSpeedupItem(data *item.C2S_USE_SPEEDUP_ITEM, c *player.Pl
return nil, errorcode.ErrorCodes.ErrItemInUse
}
c.Info.TwoTimes += 50 // 玩家对象新增 TwoTimesExp 字段存储双倍剩余次数
case 300067:
if c.Info.TwoTimes != 0 {
return nil, errorcode.ErrorCodes.ErrItemInUse
}
c.Info.TwoTimes += 25 // 玩家对象新增 TwoTimesExp 字段存储双倍剩余次数
case 300051: // 假设1002是三倍经验加速器道具ID
if c.Info.ThreeTimes != 0 {
return nil, errorcode.ErrorCodes.ErrItemInUse