feat(fight_boss): 优化BOSS战斗奖励逻辑并修复宠物等级突破100级限制 重构了handleMapBossFightRewards函数,将奖励逻辑分离到独立的处理函数中, 增加了shouldGrantBossWinBonus条件判断,确保只有满足条件时才发放胜利奖励。 同时修复了宠物等级系统,允许宠物等级突破100级限制但面板属性仍保持100级上限, 改进了经验获取和面板更新逻辑。 fix(item
41 lines
1.2 KiB
Go
41 lines
1.2 KiB
Go
package fight
|
|
|
|
import "blazing/modules/player/model"
|
|
|
|
// buildFightOverPayload builds the legacy 2506 payload expected by the flash client.
|
|
// Regular fight-over packets use a different reason mapping than group fight 7560:
|
|
// 0=normal end 1=player lost/offline 2=overtime 3=draw 4=system error 5=npc escape.
|
|
func buildFightOverPayload(over model.FightOverInfo) *model.FightOverInfo {
|
|
payload := over
|
|
payload.Reason = model.EnumBattleOverReason(mapUnifiedFightOverReason(over.Reason))
|
|
return &payload
|
|
}
|
|
|
|
func normalizeFightOverReason(reason model.EnumBattleOverReason) model.EnumBattleOverReason {
|
|
if reason == model.BattleOverReason.DefaultEnd {
|
|
return 0
|
|
}
|
|
return reason
|
|
}
|
|
|
|
func mapUnifiedFightOverReason(reason model.EnumBattleOverReason) uint32 {
|
|
switch normalizeFightOverReason(reason) {
|
|
case 0, model.BattleOverReason.Cacthok:
|
|
return 0
|
|
case model.BattleOverReason.PlayerOffline:
|
|
return 1
|
|
case model.BattleOverReason.PlayerOVerTime:
|
|
return 2
|
|
case model.BattleOverReason.NOTwind:
|
|
return 3
|
|
case model.BattleOverReason.PlayerEscape:
|
|
return 5
|
|
default:
|
|
return 4
|
|
}
|
|
}
|
|
|
|
func mapFightOverReasonFor2506(reason model.EnumBattleOverReason) model.EnumBattleOverReason {
|
|
return model.EnumBattleOverReason(mapUnifiedFightOverReason(reason))
|
|
}
|