refactor: 将OgreInfo重命名为OgrePet并更新相关引用
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful

This commit is contained in:
xinian
2026-02-23 04:12:12 +08:00
committed by cnb
parent 36cbb5bf81
commit fc0842e388
3 changed files with 17 additions and 17 deletions

View File

@@ -161,7 +161,7 @@ func (Controller) OnPlayerFightNpcMonster(data1 *fight.FightNpcMonsterInboundInf
if data1.Number > 9 {
return nil, errorcode.ErrorCodes.ErrSystemError
}
refPet := p.OgreInfo.Data[data1.Number]
refPet := p.Data[data1.Number]
if refPet.ID == 0 {
return nil, errorcode.ErrorCodes.ErrPokemonNotExists

View File

@@ -37,12 +37,12 @@ func (p *Player) GenMonster() {
replce = []int{newNum} //产生替换新的精灵
if atomic.CompareAndSwapUint32(&p.Canmon, 2, 1) {
p.OgreInfo.Data = [9]OgrePetInfo{} //切地图清空
replce = p.monsters[:] //产生替换新的精灵
p.Data = [9]OgrePetInfo{} //切地图清空
replce = p.monsters[:] //产生替换新的精灵
}
p.MapNPC.Reset(10 * time.Second)
p.OgreInfo.Data[oldnum] = OgrePetInfo{} //切地图清空
p.Data[oldnum] = OgrePetInfo{} //切地图清空
mapss, ok := xmlres.MonsterMap[gconv.Int(p.Info.MapID)]
if ok && mapss.Monsters != nil {
@@ -60,39 +60,39 @@ func (p *Player) GenMonster() {
id := strings.Split(m.ID, " ")
lv := strings.Split(m.Lv, " ")
p.OgreInfo.Data[i] = OgrePetInfo{}
p.OgreInfo.Data[i].ID = gconv.Uint32(RandomStringFromSlice(id))
p.Data[i] = OgrePetInfo{}
p.Data[i].ID = gconv.Uint32(RandomStringFromSlice(id))
if p.OgreInfo.Data[i].ID != 0 {
if p.Data[i].ID != 0 {
p.OgreInfo.Data[i].Lv = gconv.Uint32(RandomStringFromSlice(lv))
p.Data[i].Lv = gconv.Uint32(RandomStringFromSlice(lv))
if len(id) == 1 { //说明这里只固定刷一个,概率变尼尔尼奥,不是稀有精灵
nieo, _, _ := p.Roll(20, 1000)
if nieo {
p.OgreInfo.Data[i].Ext = 77
p.Data[i].Ext = 77
if grand.Meet(1, 2) {
p.OgreInfo.Data[i].Ext = 416
p.Data[i].Ext = 416
}
p.OgreInfo.Data[i].Lv = 16
p.Data[i].Lv = 16
}
}
if cool.Config.ServerInfo.IsVip != 0 { //测试服,百分百异色
p.OgreInfo.Data[i].FixSHiny()
p.Data[i].FixSHiny()
} else {
if xmlres.PetMAP[int(p.OgreInfo.Data[i].ID)].CatchRate != 0 && grand.Meet(1, 500) {
if xmlres.PetMAP[int(p.Data[i].ID)].CatchRate != 0 && grand.Meet(1, 500) {
p.OgreInfo.Data[i].RandomByWeightShiny()
p.Data[i].RandomByWeightShiny()
}
}
if grand.Meet(3, 10) && len(mapinfo.DropItemIds) > 0 {
p.OgreInfo.Data[i].Item = append(p.OgreInfo.Data[i].Item, int64(mapinfo.DropItemIds[grand.Intn(len(mapinfo.DropItemIds))]))
p.Data[i].Item = append(p.Data[i].Item, int64(mapinfo.DropItemIds[grand.Intn(len(mapinfo.DropItemIds))]))
}
}
@@ -101,7 +101,7 @@ func (p *Player) GenMonster() {
}
if p != nil {
p.SendPackCmd(2004, &p.OgreInfo)
p.SendPackCmd(2004, &p.OgrePet)
}
}

View File

@@ -82,7 +82,7 @@ type Player struct {
Fightinfo info.Fightinfo // 当前邀请的玩家ID
Logintime uint32 // 当前登录时间
OgreInfo OgrePet
OgrePet
Service *blservice.UserService
User *service.BaseSysUserService