| | |
| | | self.__CrossServerPutInItem(packIndex, tagItem, event)
|
| | | tagItem.Clear()
|
| | | return True
|
| | | |
| | | if CheckChangeOldItem(curPlayer, tagItem):
|
| | | tagItem.Clear()
|
| | | return True
|
| | | packIndex = ChConfig.GetItemPackType(curItemData.GetType(), packIndex)
|
| | |
|
| | | if not self.CanPutInItem(packIndex, tagItem.GetItemTypeID(), GetItemCount(tagItem), tagItem.GetIsBind(), defaultPile):
|
| | |
| | | return
|
| | |
|
| | |
|
| | | def CheckChangeOldItem(curPlayer, tagItem):
|
| | | ##替换旧物品
|
| | | itemID = tagItem.GetItemTypeID()
|
| | | changeOldItemDict = IpyGameDataPY.GetFuncEvalCfg('ChangeOldItem', 1, {})
|
| | | if itemID not in changeOldItemDict:
|
| | | return
|
| | | itemCnt = GetItemCount(tagItem)
|
| | | isBind = tagItem.GetIsBind()
|
| | | toItemID, toCnt, mailKey = changeOldItemDict[itemID]
|
| | | giveCnt = itemCnt * toCnt
|
| | | PlayerControl.SendMailByKey(mailKey, [curPlayer.GetPlayerID()], [[toItemID, giveCnt, isBind]])
|
| | | return True
|
| | |
|
| | | def LoginCheckChangeOldItem(curPlayer):
|
| | | ##登录检查替换旧物品
|
| | | giveItemDict = {}
|
| | | mailDict = {}
|
| | | for packIndex in [IPY_GameWorld.rptItem, IPY_GameWorld.rptWarehouse]:
|
| | | curPack = curPlayer.GetItemManager().GetPack(packIndex)
|
| | | for i in xrange(curPack.GetCount()):
|
| | | curItem = curPack.GetAt(i)
|
| | | if not curItem:
|
| | | continue
|
| | | itemID = curItem.GetItemTypeID()
|
| | | changeOldItemDict = IpyGameDataPY.GetFuncEvalCfg('ChangeOldItem', 1, {})
|
| | | if itemID not in changeOldItemDict:
|
| | | continue
|
| | | isBind = curItem.GetIsBind()
|
| | | itemCount = curItem.GetCount()
|
| | | toItemID, toCnt, mailKey = changeOldItemDict[itemID]
|
| | | giveCnt = itemCount * toCnt
|
| | | keyStr = '%s_%s'%(toItemID, isBind)
|
| | | giveItemDict[keyStr] = giveItemDict.get(keyStr, 0) + giveCnt
|
| | | ItemCommon.DelItem(curPlayer, curItem, itemCount, False, "ChangeOldItem")
|
| | | if mailKey not in mailDict:
|
| | | mailDict[mailKey] = [keyStr]
|
| | | if keyStr not in mailDict[mailKey]:
|
| | | mailDict[mailKey].append(keyStr)
|
| | | for mailKey, keyStrList in mailDict.items():
|
| | | itemList = []
|
| | | for keyStr in keyStrList:
|
| | | if keyStr not in giveItemDict:
|
| | | continue
|
| | | giveCnt = giveItemDict[keyStr]
|
| | | itemID, isBind = keyStr.split('_')
|
| | | itemList.append([int(itemID), giveCnt, int(isBind)])
|
| | | PlayerControl.SendMailByKey(mailKey, [curPlayer.GetID()], itemList)
|
| | | return |