| | |
| | | import IpyGameDataPY
|
| | | import DataRecordPack
|
| | | import PlayerGubao
|
| | | import PyGameData
|
| | | import PlayerArena
|
| | | import EventShell
|
| | | import PlayerTask
|
| | |
| | | tagItem.Clear()
|
| | | return True
|
| | | itemEff = tagItem.GetEffectByIndex(0)
|
| | | #物品碎片
|
| | | if itemEff.GetEffectID() == ChConfig.Def_Effect_ItemCount:
|
| | | SetItemCountByID(curPlayer, itemID, GetItemCountByID(curPlayer, itemID) + tagItemCount)
|
| | | tagItem.Clear()
|
| | | return True
|
| | | #古宝碎片
|
| | | if itemEff.GetEffectID() == ChConfig.Def_Effect_GubaoPiece:
|
| | | gubaoID = itemEff.GetEffectValue(0)
|
| | |
| | | vpackClear.ItemPlaceList = placeList
|
| | | vpackClear.Count = len(vpackClear.ItemPlaceList)
|
| | | NetPackCommon.SendFakePack(curPlayer, vpackClear)
|
| | | return
|
| | |
|
| | | def Sync_AutoItemCount(curPlayer, itemIDList=None):
|
| | | ## 通知自动转化为物品个数的物品个数信息
|
| | | if not itemIDList:
|
| | | force = False
|
| | | itemIDList = PyGameData.AutoTransformCountItemIDList
|
| | | else:
|
| | | force = True # 指定ID的强制通知
|
| | | |
| | | itemCountList = []
|
| | | for itemID in itemIDList:
|
| | | itemCount = GetItemCountByID(curPlayer, itemID)
|
| | | if not itemCount and not force:
|
| | | continue
|
| | | countInfo = ChPyNetSendPack.tagMCAutoItemCount()
|
| | | countInfo.Clear()
|
| | | countInfo.ItemID = itemID
|
| | | countInfo.ItemCount = itemCount
|
| | | itemCountList.append(countInfo)
|
| | | |
| | | if not itemCountList:
|
| | | return
|
| | | |
| | | clientPack = ChPyNetSendPack.tagMCAutoItemCountRefresh()
|
| | | clientPack.Clear()
|
| | | clientPack.ItemCountList = itemCountList
|
| | | clientPack.Count = len(clientPack.ItemCountList)
|
| | | NetPackCommon.SendFakePack(curPlayer, clientPack)
|
| | | return
|
| | |
|
| | | #// A3 09 转移物品到其他背包 #tagCMDropItemToOtherPack
|
| | |
| | | #==============================================================================
|
| | | def OnPlayerLogin(curPlayer):
|
| | | __CheckTransferItemPack(curPlayer)
|
| | | Sync_AutoItemCount(curPlayer)
|
| | | return
|
| | |
|
| | | def __CheckTransferItemPack(curPlayer):
|
| | |
| | |
|
| | | return
|
| | |
|
| | | def GetItemCountByID(curPlayer, itemID):
|
| | | return curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ItemCount % itemID)
|
| | | def SetItemCountByID(curPlayer, itemID, itemCount, isSync=True):
|
| | | itemCount = max(0, min(itemCount, ChConfig.Def_UpperLimit_DWord))
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ItemCount % itemID, itemCount)
|
| | | if isSync:
|
| | | Sync_AutoItemCount(curPlayer, [itemID])
|
| | | return itemCount
|
| | |
|
| | | ## 设置物品数量
|
| | | # @param item 物品实例
|
| | | # @param cnt 数量
|
| | |
| | | if itemData.GetItemTypeID() in ChConfig.Def_TransformItemIDList or itemData.GetType() == ChConfig.Def_ItemType_AutoUseMoney:
|
| | | return True
|
| | | itemEff = itemData.GetEffectByIndex(0)
|
| | | if itemEff.GetEffectID() == ChConfig.Def_Effect_ItemCount:
|
| | | return True
|
| | | if itemEff.GetEffectID() == ChConfig.Def_Effect_GubaoPiece:
|
| | | gubaoID = itemEff.GetEffectValue(0)
|
| | | if gubaoID:
|