From 415c7723223a95ab35f3f135bdf12a982ec879e6 Mon Sep 17 00:00:00 2001 From: hxp <ale99527@vip.qq.com> Date: 星期五, 11 四月 2025 16:30:22 +0800 Subject: [PATCH] 10367 【越南】【英语】【BT】【砍树】仙盟攻城战-服务端(跨服仙盟支持;后台查询区服仙盟支持;活动时间流程支持;攻城战主活动功能完整流程:公示、分组、战备、战斗、榜单、竞猜、领奖等;) --- ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/ItemControler.py | 45 +++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 43 insertions(+), 2 deletions(-) diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/ItemControler.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/ItemControler.py index cdc47a3..09a7580 100644 --- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/ItemControler.py +++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/ItemControler.py @@ -222,6 +222,47 @@ def IsEventItem(item): return (item.GetType() == ChConfig.Def_ItemType_MissionItem) +def DelPlayerItemByPacks(curPlayer, itemID, delCount, eventName="", saveDataDict={}, + packTypeList=[IPY_GameWorld.rptItem, IPY_GameWorld.rptWarehouse]): + '''扣除玩家物品,从多个背包检查,一般是用于不是立马扣除的逻辑,防止玩家快速把背包物品放入仓库导致扣除失败 + 如跨服功能,有些逻辑需要跨服验证或处理后才进行扣除 + ''' + remainDelCnt = delCount # 剩余需要扣除数量 + for packType in packTypeList: + curPack = curPlayer.GetItemManager().GetPack(packType) + for i in range(0, curPack.GetCount()): + curItem = curPack.GetAt(i) + if curItem.IsEmpty(): + continue + if curItem.GetItemTypeID() != itemID: + continue + if curItem.GetIsLocked(): + continue + + itemCount = GetItemCount(curItem) + + #身上物品比要删除的物品多 + if itemCount > remainDelCnt: + updItemCount = itemCount - remainDelCnt + SetItemCount(curItem, updItemCount) + if ItemNeedRecord(curItem): + itemNoteDict = ItemCommon.GetItemNoteDict(curItem, remainDelCnt, itemCount, updItemCount) + ItemCommon.DR_DelItem(curPlayer, packType, eventName, itemNoteDict, saveDataDict) + remainDelCnt = 0 + else: + if ItemNeedRecord(curItem): + itemNoteDict = ItemCommon.GetItemNoteDict(curItem, itemCount, itemCount, 0) + ItemCommon.DR_DelItem(curPlayer, packType, eventName, itemNoteDict, saveDataDict) + curItem.Clear() + remainDelCnt -= itemCount + + if remainDelCnt <= 0: + return True + + GameWorld.ErrLog("扣除物品失败,物品不足! itemID=%s,delCount=%s,remainDelCnt=%s,eventName=%s" + % (itemID, delCount, remainDelCnt, eventName), curPlayer.GetPlayerID()) + return False + ## 删除物品 # @param curPlayer 当前玩家 # @param packindex 背包索引 @@ -2891,7 +2932,7 @@ return True -def GivePlayerItemOrMail(curPlayer, itemList, mailKey=None, event=["", False, {}], isNotifyAward=True): +def GivePlayerItemOrMail(curPlayer, itemList, mailKey=None, event=["", False, {}], isNotifyAward=True, notifyDataEx=None): ##给物品,背包满则发邮件 if not itemList: return @@ -2927,7 +2968,7 @@ if isNotifyAward: eventName = event[0] if event else "" - NotifyGiveAwardInfo(curPlayer, giveItemList, eventName) + NotifyGiveAwardInfo(curPlayer, giveItemList, eventName, dataEx=notifyDataEx) return def NotifyGiveAwardInfo(curPlayer, giveItemInfo, eventName="", exp=0, moneyInfo=None, dataEx=None): -- Gitblit v1.8.0