refactor: 重构奖励发放逻辑并支持签到默认奖励
Some checks failed
ci/woodpecker/push/my-first-workflow Pipeline failed

This commit is contained in:
xinian
2026-04-06 03:42:48 +08:00
committed by cnb
parent 40ec827342
commit 99748ba41e
7 changed files with 250 additions and 137 deletions

View File

@@ -43,12 +43,20 @@ func (h Controller) UsePetItemOutOfFight(data *C2S_USE_PET_ITEM_OUT_OF_FIGHT, c
return nil, errorcode.ErrorCodes.ErrInsufficientItems
}
oldHP := currentPet.Hp
itemCfg, ok := xmlres.ItemsMAP[int(itemID)]
if !ok {
return nil, errorcode.ErrorCodes.ErrSystemError
errcode := h.handleRegularPetItem(itemID, currentPet)
if errcode != 0 {
return nil, errcode
}
refreshPetPaneKeepHP(currentPet, oldHP)
c.Service.Item.UPDATE(itemID, -1)
result = &item.S2C_USE_PET_ITEM_OUT_OF_FIGHT{}
copier.Copy(&result, currentPet)
return result, 0
}
oldHP := currentPet.Hp
var errcode errorcode.ErrorCode
switch {
case itemID == 300036: