hxp
2025-10-30 47eb171907516123892ea3f5d1888c6394c72382
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/UseItem/Item_Chests.py
@@ -40,19 +40,17 @@
    if not chestsIpyData:
        return
    
    showType = chestsIpyData.GetShowType() # 规定有开箱表现的默认只能开启1个
    #if showType:
    #    useCnt = 1
    useCnt = min(curRoleItem.GetCount(), useCnt)
    
    isBind = int(chestsIpyData.GetIsBind()) # 奖励物品是否绑定
    isBind = 0 # 奖励物品是否绑定
    costItemID = chestsIpyData.GetCostItemID()
    costItemCountTotal = chestsIpyData.GetCostItemCount() * useCnt
    costGoldTotal = chestsIpyData.GetCostGold() * useCnt
    auctionItemCanSell = chestsIpyData.GetAucionItemCanSell()
    aucionItemDiffSellIDList = chestsIpyData.GetAucionItemDiffSellIDList()
    costMoneyType = chestsIpyData.GetCostMoneyType()
    costGoldTotal = chestsIpyData.GetCostMoneyValue() * useCnt
    
    if costGoldTotal and not PlayerControl.HaveMoney(curPlayer, IPY_GameWorld.TYPE_Price_Gold_Money, costGoldTotal):
    if costGoldTotal and costMoneyType and not PlayerControl.HaveMoney(curPlayer, costMoneyType, costGoldTotal):
        return
    
    if costItemID:
@@ -69,8 +67,8 @@
    if not awardInfo:
        return
    needSpaceDict, jobAwardItemList, moneyType, moneyCount, notifyItemList, updOpenCount = awardInfo
    GameWorld.DebugLog("    needSpaceDict=%s,jobAwardItemList=%s,moneyType=%s,moneyCount=%s,notifyItemList=%s,updOpenCount=%s,auctionItemCanSell=%s,aucionItemDiffSellIDList=%s"
                       % (needSpaceDict, jobAwardItemList, moneyType, moneyCount, notifyItemList, updOpenCount, auctionItemCanSell, aucionItemDiffSellIDList))
    GameWorld.DebugLog("    needSpaceDict=%s,jobAwardItemList=%s,moneyType=%s,moneyCount=%s,notifyItemList=%s,updOpenCount=%s"
                       % (needSpaceDict, jobAwardItemList, moneyType, moneyCount, notifyItemList, updOpenCount))
    
    for packType, needSpace in needSpaceDict.items():
        packSpace = ItemCommon.GetItemPackSpace(curPlayer, packType, needSpace)
@@ -82,9 +80,9 @@
    # 扣除消耗
    if costItemID:
        ItemCommon.DelCostItemByBind(curPlayer, costItemIndexList, bindCnt, unBindCnt, costItemCountTotal, "Chests")
    if costGoldTotal:
    if costMoneyType and costGoldTotal:
        infoDict = {ChConfig.Def_Cost_Reason_SonKey:chestsItemID}
        PlayerControl.PayMoney(curPlayer, IPY_GameWorld.TYPE_Price_Gold_Money, costGoldTotal, ChConfig.Def_Cost_UseItem, infoDict)
        PlayerControl.PayMoney(curPlayer, costMoneyType, costGoldTotal, ChConfig.Def_Cost_UseItem, infoDict)
        
    # 更新开启次数
    if updOpenCount:
@@ -97,11 +95,8 @@
    # 给奖励
    syncItemList = []
    for itemID, itemCount in jobAwardItemList:
        canSell = (not auctionItemCanSell) if itemID in aucionItemDiffSellIDList else auctionItemCanSell
        isAuctionItem = 1 if canSell and IpyGameDataPY.GetIpyGameDataNotLog("AuctionItem", itemID) else 0
        userDataList = []
        giveOKCount = ItemControler.DoGiveItemLoop(curPlayer, itemID, itemCount, isAuctionItem,
        giveOKCount = ItemControler.DoGiveItemLoop(curPlayer, itemID, itemCount, isBind,
                                                   event=[ChConfig.ItemGive_Chests, False, {"UseItemID":chestsItemID}], 
                                                   jsonItemList=syncItemList, userDataList=userDataList)
        if giveOKCount < itemCount:
@@ -119,9 +114,7 @@
        if not PlayerControl.GiveMoney(curPlayer, moneyType, moneyCount, ChConfig.Def_GiveMoney_UseItem, addDataDict, False):
            moneyType, moneyCount = 0, 0
            
    # ֪ͨ
    if showType and syncItemList:
        ChItem.SendUseItemGetItemResult(curPlayer, chestsItemID, useCnt, syncItemList, moneyType, moneyCount)
    ItemControler.NotifyGiveAwardInfo(curPlayer, jobAwardItemList, "Chests", moneyInfo={moneyType, moneyCount})
    return True, useCnt