From fe42c2433fea4cfd894b38fec62f24fa4a5d047a Mon Sep 17 00:00:00 2001
From: xdh <xiefantasy@qq.com>
Date: 星期二, 12 三月 2019 13:50:18 +0800
Subject: [PATCH] 6291 【后端】【2.0】限时仙盟boss(鼓舞修改)

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/ItemControler.py |  288 ++++++++++++++++++++-------------------------------------
 1 files changed, 101 insertions(+), 187 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 75cc076..08d7b47 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/ItemControler.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/ItemControler.py
@@ -37,15 +37,6 @@
 
 import math
 #---------------------------------------------------------------------
-## 放不下主角背包放入万能背包的逻辑, curGiveItem 要先 SetCount
-#  @param curPlayer 当前玩家
-#  @param curGiveItem 要先 SetCount 
-#  @return None or True
-#  @remarks 函数详细说明.
-def DoLogic_PutItemInPack(curPlayer, curGiveItem, showEff=False, showSysInfo=False, event=["", False, {}]):
-    return __DoLogic_PutItemInPack(curPlayer, curGiveItem, [IPY_GameWorld.rptItem, IPY_GameWorld.rptAnyWhere],
-                                   showEff=showEff, showSysInfo=showSysInfo, event=event)
-
 
 ## 获得背包的一个空格子
 def GetItemPackSpaceIndex(curPlayer, packindex):
@@ -328,7 +319,8 @@
 #  @return True or False
 #  @remarks 函数详细说明.
 def CanPackItemByItemType(srcItemID, srcItemIsBind, destItemID, destItemIsBind):
-    if srcItemID == destItemID and srcItemIsBind == destItemIsBind:
+    ## 拍品项目,只有非拍品可堆叠,即绑定物品
+    if srcItemID == destItemID and srcItemIsBind == destItemIsBind and srcItemIsBind:
         return True
     return False
 
@@ -1120,16 +1112,17 @@
             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):
+        tagItemCount = GetItemCount(tagItem)
+        isBind = tagItem.GetIsBind()
+        isAuctionItem = not isBind
+        if not self.CanPutInItem(packIndex, tagItem.GetItemTypeID(), tagItemCount, isAuctionItem, defaultPile):
             GameWorld.DebugLog("背包满,不能放入物品 count = %d"%GetItemCount(tagItem))
             tagItem.Clear()
             return False
         
+        isNeedRecord = False
         itemID = tagItem.GetItemTypeID()
         #激活成就的道具
         if tagItem.GetType() == ChConfig.Def_ItemType_SuccessItem:
@@ -1143,6 +1136,11 @@
                 return True
             defaultPile = True
             maxPackCount = ChConfig.Def_UpperLimit_DWord # 转化物品叠加上限不取物品表的, 暂定堆叠上限20亿
+        elif isAuctionItem:
+            maxPackCount = tagItemCount
+            defaultPile = False # 新放入的拍品只能放空位置,所以不判断堆叠
+            #isBind = False
+            isNeedRecord = True # 拍品要记录
         else:
             maxPackCount = curItemData.GetPackCount()
             
@@ -1159,10 +1157,9 @@
         
         curPack = self.__PlayerItemManager.GetPack(packIndex)
         #itemFactory = GameWorld.GetItemFactory()
-        isBind = tagItem.GetIsBind()
-        isNeedRecord = False
+        #isBind = tagItem.GetIsBind()
         # 目前暂只记录放入背包的
-        if packIndex in [IPY_GameWorld.rptItem, ShareDefine.rptTreasure, ShareDefine.rptRune, ShareDefine.rptGatherSoul]:
+        if not isNeedRecord and packIndex in [IPY_GameWorld.rptItem, ShareDefine.rptTreasure, ShareDefine.rptRune, ShareDefine.rptGatherSoul]:
             isNeedRecord = ItemNeedRecord(tagItem) or isForceEvent
         putResult = False
         
@@ -1227,7 +1224,7 @@
             #可以摆放
             if curItemCount > canPutinCount:
                 #需要创建新物品放入
-                curCreateItem = GetOutPutItemObj(tagItem.GetItemTypeID(), canPutinCount, isBind)
+                curCreateItem = GetOutPutItemObj(tagItem.GetItemTypeID(), canPutinCount, isAuctionItem)
                 #注意: 不能在这里AssignItem, 否则会有2个物品指针指向同一个物品实例 . 巨大的错误在这一句 : curCreateItem.Assign(tagItem)
                 #如果是装备,那么 maxPackCount 为1 这里会循环自动创建新物品,所以直接 GetOutPutItemObj 即可, 暂不支持定制装备拆解
                 
@@ -1341,25 +1338,25 @@
     #  @param packIndex 背包索引
     #  @param curItemID 当前物品ID
     #  @param curItemCount 当前物品数量
-    #  @param isBind 是否绑定
+    #  @param isAuctionItem 是否拍品
     #  @param defaultPile 默认先判断是否能进行物品堆叠
     #  @return True or False
     #  @remarks 函数详细说明.
-    def CanPutInItem(self, packIndex, curItemID, curItemCount, isBind, defaultPile=True):
+    def CanPutInItem(self, packIndex, curItemID, curItemCount, isAuctionItem, defaultPile=True):
         if GameWorld.IsCrossServer():
             return True
-        checkRet, putIndex = self.CanPutInItemEx(packIndex, curItemID, curItemCount, isBind, defaultPile)
+        checkRet, putIndex = self.CanPutInItemEx(packIndex, curItemID, curItemCount, isAuctionItem, defaultPile)
         return checkRet
     
     ## 是否能放入物品 
     #  @param packIndex 背包索引
     #  @param curItemID 当前物品ID
     #  @param curItemCount 当前物品数量
-    #  @param isBind 是否绑定
+    #  @param isAuctionItem 是否拍品
     #  @param defaultPile 默认先判断是否能进行物品堆叠
     #  @return True or False, 第一个可放入的位置
     #  @remarks 函数详细说明.
-    def CanPutInItemEx(self, packIndex, curItemID, curItemCount, isBind, defaultPile=True):
+    def CanPutInItemEx(self, packIndex, curItemID, curItemCount, isAuctionItem, defaultPile=True):
         gameData = GameWorld.GetGameData()
         curItemData = gameData.GetItemByTypeID(curItemID)
         
@@ -1367,11 +1364,16 @@
             GameWorld.Log("找不到ItemID = %d" % curItemID)
             return False, 0 
         
+        isBind = True
         if curItemID in ChConfig.Def_TransformItemIDList:
             # 货币直接转换的物品如果是放入背包的则直接转化,无需暂用格子
             if packIndex == IPY_GameWorld.rptItem:
                 return True, 0
             maxPackCount = ChConfig.Def_UpperLimit_DWord # 转化物品叠加上限不取物品表的, 暂定堆叠上限20亿
+        elif isAuctionItem:
+            maxPackCount = curItemCount
+            defaultPile = False # 新放入的拍品只能放空位置,所以不判断堆叠
+            isBind = False
         else:
             maxPackCount = curItemData.GetPackCount()
             
@@ -1543,7 +1545,8 @@
     curItemTypeID = curItem.GetItemTypeID()
     #curItemGUID = curItem.GetGUID()
     curItemCount = curItem.GetCount()
-    curItemIsBind = curItem.GetIsBind()
+    #curItemIsBind = curItem.GetIsBind()
+    isAuctionItem = 0 if curItem.GetIsBind() else 1
     #toPackIndex = ChConfig.GetItemPackType(curItem.GetType(), toPackIndex)
     
     # 常规物品转移到虚拟符印背包
@@ -1552,7 +1555,7 @@
             return False
         return itemControl.PutItemInVPack(toPackIndex, curItem)
     
-    checkRet, putIndex = itemControl.CanPutInItemEx(toPackIndex, curItemTypeID, curItemCount, curItemIsBind)
+    checkRet, putIndex = itemControl.CanPutInItemEx(toPackIndex, curItemTypeID, curItemCount, isAuctionItem)
     if not checkRet:
         return False
     return DragItem(curPlayer, fromPackIndex, itemIndex, toPackIndex, putIndex, curItemCount)
@@ -1845,6 +1848,10 @@
     if itemType1 == itemType2:
         if item1.GetItemColor() == item2.GetItemColor():
             if item1.GetItemQuality() == item2.GetItemQuality():
+                if item1.GetItemTypeID() == item2.GetItemTypeID():
+                    if item1.GetIsBind() == item2.GetIsBind():
+                        return -cmp(item1.GetCount(), item2.GetCount())
+                    return -cmp(item1.GetIsBind(), item2.GetIsBind())
                 return cmp(item1.GetItemTypeID(), item2.GetItemTypeID())
             else:
                 return cmp(0-item1.GetItemQuality(), 0-item2.GetItemQuality())
@@ -1874,7 +1881,7 @@
     for curItem in curList:
         curCount = curItem.GetCount()
         
-        if not CanPackItem(curItem, addItem) :
+        if not CanPackItem(curItem, addItem):
             continue
         
         if curCount >= packCount:
@@ -2048,21 +2055,10 @@
         
     return
 
-#---------------------------------------------------------------------
-## 给玩家物品
-#  @param curPlayer 当前玩家
-#  @param itemID 物品ID
-#  @param itemCount 物品数量
-#  @param itemIsBind 物品是否绑定
-#  @param packIndexList 背包索引列表
-#  @param showEff 显示放入背包的特效
-#  @param defaultPile 默认先判断是否能进行物品堆叠
-#  @param returnItemObj 是否返回物品对象
-#  @param showSysInfo 是否显示系统提示
-#  @return 布尔值
-#  @remarks 
-def GivePlayerItem(curPlayer, itemID, itemCount, itemIsBind, packIndexList, showEff=False, defaultPile=True,
-                   returnItemObj=False, showSysInfo=False, event=["", False, {}]):
+def GivePlayerItem(curPlayer, itemID, itemCount, isAuctionItem, packIndexList, event=["", False, {}]):
+    '''给玩家物品
+    @param isAuctionItem: 是否拍品
+    '''
     if itemCount <= 0:
         return False
     
@@ -2070,12 +2066,27 @@
     if not curItemData:
         return False
     
+    if isAuctionItem:
+        ipyData = IpyGameDataPY.GetIpyGameData("AuctionItem", itemID)
+        if not ipyData:
+            GameWorld.ErrLog("非拍卖物品,默认转为非拍品! itemID=%s,itemCount=%s,isAuctionItem=%s" 
+                             % (itemID, itemCount, isAuctionItem), curPlayer.GetPlayerID())
+            isAuctionItem = 0
+    
     defaultPack = IPY_GameWorld.rptItem if not packIndexList else packIndexList[0]
     packIndex = ChConfig.GetItemPackType(curItemData.GetType(), defaultPack)
     if packIndex != defaultPack or not packIndexList:
         packIndexList = [packIndex]
     
-    if not __Check_CanPutItemInPack(curPlayer, itemID, itemCount, itemIsBind, packIndexList, defaultPile):
+    #物品管理器
+    canPutIn = False
+    itemControl = PlayerItemControler(curPlayer)
+    for packIndex in packIndexList:
+        #可以放入背包
+        if itemControl.CanPutInItem(packIndex, itemID, itemCount, isAuctionItem):
+            canPutIn = True
+            break
+    if not canPutIn:
         #不可放入
         return False
     
@@ -2083,7 +2094,7 @@
     if GetAppointItemRealID(itemID):
         isOK = False
         for _ in xrange(itemCount):
-            if GivePlayerAppointItem(curPlayer, itemID, False, event):
+            if GivePlayerAppointItem(curPlayer, itemID, isAuctionItem, event):
                 isOK = True # 只要有成功的就返回成功,防止异常情况失败可能导致被刷
         return isOK
     
@@ -2091,21 +2102,17 @@
     if ItemCommon.GetIsEquip(curItemData):
         isOK = False
         for _ in xrange(itemCount):
-            outPutEquip = GetOutPutItemObj(itemID, 1, itemIsBind)
-            if __DoLogic_PutItemInPack(curPlayer, outPutEquip, packIndexList, showEff, defaultPile, returnItemObj,
-                                       showSysInfo, event):
+            outPutEquip = GetOutPutItemObj(itemID, 1, isAuctionItem, curPlayer=curPlayer)
+            if not outPutEquip:
+                return isOK
+            if DoLogic_PutItemInPack(curPlayer, outPutEquip, event, packIndexList):
                 isOK = True # 只要有成功的就返回成功,防止异常情况失败可能导致被刷
         return isOK
     
-    giveItem = GetOutPutItemObj(itemID, itemCount, itemIsBind)
+    giveItem = GetOutPutItemObj(itemID, itemCount, isAuctionItem, curPlayer=curPlayer)
     if not giveItem:
-        GameWorld.ErrLog('GivePlayerItem itemID = %s, Error, giveCnt = %s, isBind = %s' % \
-                                                     (itemID, itemCount, itemIsBind), curPlayer.GetID())
         return False
-    
-    #将物品放入背包
-    return __DoLogic_PutItemInPack(curPlayer, giveItem, packIndexList, showEff, defaultPile, returnItemObj,
-                                   showSysInfo, event)
+    return DoLogic_PutItemInPack(curPlayer, giveItem, event, packIndexList)
 
 
 def GivePlayerAppointItem(curPlayer, appointID, isAuctionItem, event=["", False, {}]):
@@ -2159,16 +2166,14 @@
 ## 根据物品data字典给玩家装备/翅膀
 #  @param curPlayer:玩家实例
 #  @param itemData:物品数据
-#  @param showEff:是否显示放入背包特效
 #  @param packType:背包类型
 #  @param defaultPile 默认先判断是否能进行物品堆叠
-#  @param showSysInfo 是否显示系统提示
 #  @return None
-def GivePlayerEquip(curPlayer, itemData, showEff=False, packType=[IPY_GameWorld.rptItem, IPY_GameWorld.rptAnyWhere],
-                    defaultPile=True, returnItemObj=False, showSysInfo=False, event=["", False, {}]):
+def GivePlayerEquip(curPlayer, itemData, event=["", False, {}], packType=[IPY_GameWorld.rptItem, IPY_GameWorld.rptAnyWhere],
+                    defaultPile=True):
     equipItem = GetItemByData(itemData)
     #将物品放入背包
-    return __DoLogic_PutItemInPack(curPlayer, equipItem, packType, showEff, defaultPile, returnItemObj, showSysInfo, event)
+    return DoLogic_PutItemInPack(curPlayer, equipItem, event, packType, defaultPile)
 
 
 ## 根据物品data字典创建物品
@@ -2222,38 +2227,15 @@
 
 
 #---------------------------------------------------------------------
-##检查是否可以放入此物品.
-# @param curPlayer 玩家实例
-# @param giveItemID 物品ID
-# @param giveItemCnt 物品数量
-# @param giveItemBind 物品是否绑定
-# @param packIndexList 背包列表
-#  @param defaultPile 默认先判断是否能进行物品堆叠
-# @return 返回值无意义
-# @remarks 客户端封包响应
-def __Check_CanPutItemInPack(curPlayer, giveItemID, giveItemCnt, giveItemBind, packIndexList, defaultPile=True):
-    #物品管理器
-    itemControl = PlayerItemControler(curPlayer)
-    
-    for packIndex in packIndexList:
-        #可以放入背包
-        if itemControl.CanPutInItem(packIndex, giveItemID, giveItemCnt, giveItemBind, defaultPile):
-            return True
-
-    #不可放入
-    return False
-
 ## 执行物品放入背包逻辑
 #  @param curPlayer 背包拥有者
 #  @param curGiveItem 放入的物品
 #  @param packIndexList 背包索引列表
 #  @param showEff 放入背包特效
 #  @param defaultPile 默认先判断是否能进行物品堆叠
-#  @param returnItemObj 是否返回物品对象
 #  @param showSysInfo 是否显示系统提示
 #  @return 布尔值
-def __DoLogic_PutItemInPack(curPlayer, curGiveItem, packIndexList, showEff=False, defaultPile=True,
-                            returnItemObj=False, showSysInfo=False, event=["", False, {}]):
+def DoLogic_PutItemInPack(curPlayer, curGiveItem, event=["", False, {}], packIndexList=[IPY_GameWorld.rptItem, IPY_GameWorld.rptAnyWhere], defaultPile=True):
     #itemID = curGiveItem.GetItemTypeID()
     #count = curGiveItem.GetCount()
     itemControl = PlayerItemControler(curPlayer)
@@ -2269,14 +2251,12 @@
             #    PlayerControl.NotifyCode(curPlayer, "ObtainRes01", [itemID, count])
             #===================================================================
             
-            if returnItemObj:
-                return curGiveItem
             return True
 
     #玩家背包已满, 清空物品,否则创建物品不删除,将导致内存溢出
     curGiveItem.Clear()
     #前面验证过了, 走到这里就是逻辑Bug了
-    GameWorld.ErrLog('ItemControler.GivePlayerItem Error 物品无法放入背包')
+    GameWorld.ErrLog('DoLogic_PutItemInPack Error 物品无法放入背包')
     return False
 
 ## 设置物品是否绑定
@@ -2317,7 +2297,9 @@
         return item.GetUserAttr(ShareDefine.Def_IudetItemCount)
     return item.GetCount()
 
-def GetItemNeedPackCount(packType, itemData, itemCount):
+def GetItemNeedPackCount(packType, itemData, itemCount, isAuctionItem=0):
+    if isAuctionItem:
+        return 1
     if itemData.GetItemTypeID() in ChConfig.Def_TransformItemIDList:
         # 货币直接转换的物品如果是放入背包的则不需要暂用格子,放入其他的背包的则按物品叠加上限算
         if packType == IPY_GameWorld.rptItem:
@@ -2421,10 +2403,8 @@
         if itemColor >= ChConfig.Def_Quality_Purple:
             GameWorld.DebugLog("该装备没有传奇属性: itemID=%s" % (itemID))
         return
-    fixedLegendAttrCount = attrCountIpyData.GetFixedLegendAttrCount()
-    goodLegendAttrCount = attrCountIpyData.GetGoodLegendAttrCount()
-    otherLegendAttrCount = attrCountIpyData.GetOtherLegendAttrCount()
-    if fixedLegendAttrCount <= 0 and goodLegendAttrCount <= 0 and otherLegendAttrCount <= 0:
+    legendAttrCountInfoList = attrCountIpyData.GetLegendAttrCountInfo() # 传奇属性条数信息 [[条数, [属性类型库编号, ...]], ...]
+    if not legendAttrCountInfoList:
         return
     
     if not curPlayer:
@@ -2436,53 +2416,42 @@
     attrTypeIpyData = IpyGameDataPY.GetIpyGameData("EquipLegendAttrType", itemType)
     if not attrTypeIpyData:
         return
-    fixedLegendAttrList = attrTypeIpyData.GetFixedLegendAttrList()
-    goodLegendAttrList = attrTypeIpyData.GetGoodLegendAttrList()
-    commLegendAttrList = attrTypeIpyData.GetCommLegendAttrList()
+    legendAttrTypeLibDict = attrTypeIpyData.GetLegendAttrTypeLib() # 传奇属性类型库 {属性类型库编号:[属性ID,...], ...}
+    
     curLegAttrIDList = []
     curLegAttrValueList = []
+    itemClassLV = ItemCommon.GetItemClassLV(curItem)
     if isAllAttr:
         if curPlayer.GetGMLevel() != 90:
             return
-        curLegAttrIDList = fixedLegendAttrList + goodLegendAttrList + commLegendAttrList
+        for attrIDList in legendAttrTypeLibDict.values():
+            curLegAttrIDList += attrIDList
+        #GameWorld.DebugLog("所有传奇属性: %s" % (curLegAttrIDList), playerID)
     else:
-        if fixedLegendAttrCount:
-            if len(fixedLegendAttrList) < fixedLegendAttrCount:
-                GameWorld.ErrLog("装备固定传奇属性配置不足!itemID=%s,itemType=%s,fixedLegendAttrCount=%s,fixedLegendAttrList=%s" 
-                                 % (itemID, itemType, fixedLegendAttrCount, fixedLegendAttrList), playerID)
-                return
-            curLegAttrIDList += fixedLegendAttrList[:fixedLegendAttrCount]
-            
-        if goodLegendAttrCount:
-            if len(goodLegendAttrList) < goodLegendAttrCount:
-                GameWorld.ErrLog("装备追求传奇属性配置不足!itemID=%s,itemType=%s,goodLegendAttrCount=%s,goodLegendAttrList=%s" 
-                                 % (itemID, itemType, goodLegendAttrCount, goodLegendAttrList), playerID)
-                return
-            curLegAttrIDList += random.sample(goodLegendAttrList, goodLegendAttrCount)
-            
-        if otherLegendAttrCount:
-            otherLegendAttrList = list(goodLegendAttrList) + list(commLegendAttrList)
+        #GameWorld.DebugLog("随机传奇属性: itemID=%s,itemType=%s,itemClassLV=%s,itemColor=%s,isSuit=%s" 
+        #                   % (itemID, itemType, itemClassLV, itemColor, isSuit), playerID)
+        for attrCount, libNumList in legendAttrCountInfoList:
+            attrIDList = []
+            for libNum in libNumList:
+                attrIDList.extend(legendAttrTypeLibDict.get(libNum, []))
             for curAttrID in curLegAttrIDList:
-                if curAttrID in otherLegendAttrList:
-                    otherLegendAttrList.remove(curAttrID)
-            if len(otherLegendAttrList) < otherLegendAttrCount:
-                GameWorld.ErrLog("装备一般传奇属性配置不足!itemID=%s,itemType=%s,otherLegendAttrCount=%s,otherLegendAttrList=%s" 
-                                 % (itemID, itemType, otherLegendAttrCount, otherLegendAttrList), playerID)
+                if curAttrID in attrIDList:
+                    attrIDList.remove(curAttrID)
+            if len(attrIDList) < attrCount:
+                GameWorld.ErrLog("装备传奇属性ID库配置不够条数随机!itemID=%s,itemType=%s,legendAttrCountInfoList=%s,legendAttrTypeLibDict=%s" 
+                                 % (itemID, itemType, legendAttrCountInfoList, legendAttrTypeLibDict), playerID)
                 return
-            curLegAttrIDList += random.sample(otherLegendAttrList, otherLegendAttrCount)
+            curLegAttrIDList += random.sample(attrIDList, attrCount)
+            #GameWorld.DebugLog("    随机传奇属性: attrCount=%s,libNumList=%s,attrIDList=%s,curLegAttrIDList=%s" 
+            #                   % (attrCount, libNumList, attrIDList, curLegAttrIDList), playerID)
             
     # 3. 定数值
-    itemClassLV = ItemCommon.GetItemClassLV(curItem)
     attrValueIpyData = IpyGameDataPY.GetIpyGameData("EquipLegendAttrValue", itemType, itemClassLV, itemColor, isSuit)
     if not attrValueIpyData:
         GameWorld.ErrLog("传奇属性等级数值表找不到配置!itemID=%s,itemType=%s,itemClassLV=%s,itemColor=%s,isSuit=%s" 
                          % (itemID, itemType, itemClassLV, itemColor, isSuit), playerID)
         return
-    #GameWorld.DebugLog("随机传奇属性: itemID=%s,itemType=%s,itemClassLV=%s,itemColor=%s,isSuit=%s" 
-    #                   % (itemID, itemType, itemClassLV, itemColor, isSuit, ), playerID)
-    #GameWorld.DebugLog("    固定条数=%s-%s,追求条数=%s-%s,其他条数=%s-%s" 
-    #                   % (fixedLegendAttrCount, fixedLegendAttrList, goodLegendAttrCount, goodLegendAttrList, 
-    #                      otherLegendAttrCount, commLegendAttrList), playerID) 
+    
     attrLVLibNumDict = attrValueIpyData.GetLVLegendAttrLibNumInfo() # {属性ID:{等级:库编号, ...}}
     for attrID in curLegAttrIDList:
         if attrID not in attrLVLibNumDict:
@@ -2549,11 +2518,11 @@
         curItem.Clear()
     return
 
-def PutItemInTempSwap(curPlayer, itemID, isBind=1):
+def PutItemInTempSwap(curPlayer, itemID, isAuctionItem=0):
     ## 临时背包放入物品
     # 临时交换背包目前只开放1个格子,每次放入前先清空再放入
     ClearPack(curPlayer, ShareDefine.rptTempSwap)
-    return GivePlayerItem(curPlayer, itemID, 1, isBind, [ShareDefine.rptTempSwap])
+    return GivePlayerItem(curPlayer, itemID, 1, isAuctionItem, [ShareDefine.rptTempSwap])
 
 def OpenPickupItemPutInTemp(curPlayer, isClearItem):
     ''' 开启拾取的物品放入临时存放背包
@@ -2593,83 +2562,29 @@
         mailItemList = []
         for tempItem in tempItemList:
             mailItemList.append(ItemCommon.GetMailItemDict(tempItem))
-        mailItemList +=extraItemList
+        mailItemList += extraItemList
         mailTypeKey = ShareDefine.DefaultLackSpaceMailType if not mailTypeKey else mailTypeKey
         PlayerControl.SendMailByKey(mailTypeKey, [curPlayer.GetPlayerID()], mailItemList)
     else:
         itemControl = PlayerItemControler(curPlayer)
         for tempItem in tempItemList:
             itemControl.PutInItem(IPY_GameWorld.rptItem, tempItem, event=event)
-        for itemID, itemCnt, isBind in extraItemList:
-            GivePlayerItem(curPlayer, itemID, itemCnt, isBind, 
-                                         [IPY_GameWorld.rptItem], event=event)
+        for itemID, itemCnt, isAuctionItem in extraItemList:
+            GivePlayerItem(curPlayer, itemID, itemCnt, isAuctionItem, [IPY_GameWorld.rptItem], event=event)
             
     ClearPack(curPlayer, ShareDefine.rptTempItem)
-    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):
-    ##登录检查替换旧物品
-    if GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_Player_Dict_VersionFix, ChConfig.Def_VerFix_GodWeaponItem):
-        return
-    GameWorld.SetDictValueByBit(curPlayer, ChConfig.Def_Player_Dict_VersionFix, ChConfig.Def_VerFix_GodWeaponItem, 1)
-    giveItemDict = {}
-    mailDict = {}
-    for packIndex in [IPY_GameWorld.rptItem, IPY_GameWorld.rptWarehouse, ShareDefine.rptTreasure]:
-        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
 
 def GivePlayerItemOrMail(curPlayer, itemList, mailKey=None, event=["", False, {}]):
     ##给物品,背包满则发邮件
     needPackSpaceDict = {}
-    for itemID, itemCnt, isBind in itemList:
+    for itemID, itemCnt, isAuctionItem in itemList:
         curItem = GameWorld.GetGameData().GetItemByTypeID(itemID)
         if not curItem:
             GameWorld.ErrLog('GivePlayerItemOrMail 物品ID不存在 itemID=%s'%itemID, curPlayer.GetID())
             return
         packType = ChConfig.GetItemPackType(curItem.GetType())
-        needSpace = GetItemNeedPackCount(packType, curItem, itemCnt)
+        needSpace = GetItemNeedPackCount(packType, curItem, itemCnt, isAuctionItem)
         needPackSpaceDict[packType] = needPackSpaceDict.get(packType, 0) + needSpace
     isSendMail = False
     for packType, needSpace in needPackSpaceDict.items():
@@ -2681,7 +2596,6 @@
         PlayerControl.SendMailByKey(mailKey, [curPlayer.GetPlayerID()], itemList)
         GameWorld.DebugLog("GivePlayerItemOrMail背包空间不够,发送邮件: mailItemList=%s" % str(itemList), curPlayer.GetPlayerID())
     else:
-        for itemID, itemCnt, isBind in itemList:
-            GivePlayerItem(curPlayer, itemID, itemCnt, isBind, [IPY_GameWorld.rptItem],
-                                            event=event)
-    return
\ No newline at end of file
+        for itemID, itemCnt, isAuctionItem in itemList:
+            GivePlayerItem(curPlayer, itemID, itemCnt, isAuctionItem, [IPY_GameWorld.rptItem], event=event)
+    return

--
Gitblit v1.8.0