```
feat(item): 出售物品后减少背包中对应物品数量 在处理物品出售逻辑时,增加调用 SubItem 方法以正确扣减玩家背包中的物品数量。 feat(map): 玩家离开地图时重置 Canmon 标志位 通过 atomic.StoreUint32 将玩家的 Canmon 状态设置为 0,确保线程安全。 fix(pet): 调整宠物经验增加逻辑并修复技能学习问题 重构 AddPetExp 方法逻辑,优化升级流程、技能学习机制,并修正经验显示
This commit is contained in:
30
logic/controller/fight_tawor.go
Normal file
30
logic/controller/fight_tawor.go
Normal file
@@ -0,0 +1,30 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"blazing/common/socket/errorcode"
|
||||
"blazing/common/utils"
|
||||
"blazing/logic/service/fight"
|
||||
"blazing/logic/service/player"
|
||||
"sync/atomic"
|
||||
)
|
||||
|
||||
func (h Controller) FRESH_CHOICE_FIGHT_LEVEL(data *fight.C2S_FRESH_CHOICE_FIGHT_LEVEL, c *player.Player) (result *fight.S2C_FreshChoiceLevelRequestInfo, err errorcode.ErrorCode) {
|
||||
|
||||
result = &fight.S2C_FreshChoiceLevelRequestInfo{}
|
||||
|
||||
switch data.Head.CMD {
|
||||
case 2428: //试炼之塔
|
||||
c.Info.CurrentFreshStage = utils.Max(c.Info.CurrentFreshStage, 1)
|
||||
result.CurFightLevel = uint(c.Info.CurrentFreshStage)
|
||||
case 2414: //勇者之塔
|
||||
c.Info.CurrentStage = utils.Max(c.Info.CurrentStage, 1)
|
||||
result.CurFightLevel = uint(c.Info.CurrentStage)
|
||||
}
|
||||
result.BossId = []uint32{10}
|
||||
atomic.StoreUint32(&c.Canmon, 0)
|
||||
return result, 0
|
||||
}
|
||||
func (h Controller) FRESH_LEAVE_FIGHT_LEVEL(data *fight.FRESH_LEAVE_FIGHT_LEVEL, c *player.Player) (result *fight.NullOutboundInfo, err errorcode.ErrorCode) {
|
||||
|
||||
return result, 0
|
||||
}
|
||||
@@ -17,5 +17,6 @@ func (h Controller) ITEM_SALE(data *item.C2S_ITEM_SALE, c *player.Player) (resul
|
||||
c.Info.Coins += uint32(int64(data.Amount) * int64(xmlres.ItemsMAP[int(data.ItemId)].SellPrice))
|
||||
|
||||
}
|
||||
c.Service.Item.SubItem(data.ItemId, data.Amount)
|
||||
return result, 0
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ func (h Controller) MapHot(data *maphot.InInfo, c *player.Player) (result *mapho
|
||||
return
|
||||
}
|
||||
func (h *Controller) MapLeave(data *space.LeaveMapInboundInfo, c *player.Player) (result *info.LeaveMapOutboundInfo, err errorcode.ErrorCode) { //这个时候player应该是空的
|
||||
|
||||
atomic.StoreUint32(&c.Canmon, 0)
|
||||
//data.Broadcast(c.Info.MapID, info.LeaveMapOutboundInfo{UserID: c.Info.UserID}) //同步广播
|
||||
result = &info.LeaveMapOutboundInfo{
|
||||
UserID: c.Info.UserID,
|
||||
|
||||
@@ -229,7 +229,7 @@ func (h Controller) SetPetExp(data *pet.PetSetExpInboundInfo, c *player.Player)
|
||||
_, onpet, ok := c.FindPet(data.CatchTime)
|
||||
if ok && onpet.Level < 100 {
|
||||
|
||||
defer c.AddPetExp(onpet, data.Exp)
|
||||
c.AddPetExp(onpet, data.Exp)
|
||||
return &pet.PetSetExpOutboundInfo{
|
||||
Exp: c.Info.ExpPool,
|
||||
}, 0
|
||||
|
||||
Reference in New Issue
Block a user