| #!/usr/bin/python  | 
| # -*- coding: GBK -*-  | 
| #---------------------------------------------------------------------  | 
| #  | 
| #---------------------------------------------------------------------  | 
| ##@package ItemControler  | 
| # @todo: ÎïÆ·¹ÜÀíÆ÷  | 
| #  | 
| # @author: eggxp  | 
| # @date 2017-07-28 14:00  | 
| # @version 1.0  | 
| #  | 
| # @note:   | 
| #---------------------------------------------------------------------  | 
|   | 
| #---------------------------------------------------------------------  | 
| #"""Version = 2017-07-28 14:00"""  | 
| #---------------------------------------------------------------------  | 
| import IPY_GameWorld  | 
| import GameWorld  | 
| import ChConfig  | 
| import PlayerControl  | 
| import ItemCommon  | 
| import ShareDefine  | 
| import traceback  | 
| import random  | 
| import ReadChConfig  | 
| import ChItem  | 
| import PlayerSuccess  | 
| import PlayerFamily  | 
| import ChPyNetSendPack  | 
| import NetPackCommon  | 
| import Operate_EquipStone  | 
| import Operate_EquipSuitCompose  | 
| import IpyGameDataPY  | 
| import EventShell  | 
|   | 
| 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):  | 
|     curPack = curPlayer.GetItemManager().GetPack(packindex)  | 
|     for i in range(0, curPack.GetCount()):  | 
|         item = curPack.GetAt(i)  | 
|           | 
|         if item.IsEmpty():  | 
|             return i  | 
|       | 
|     return -1  | 
|   | 
|   | 
|   | 
| ## »ñµÃ±³°üÊ£Óà¿Õ¼ä  | 
| #  @param curPlayer µ±Ç°Íæ¼Ò  | 
| #  @param packindex ±³°üË÷Òý  | 
| #  @return None  | 
| #  @remarks º¯ÊýÏêϸ˵Ã÷.  | 
| def GetItemPackSpace(curPlayer, packindex):  | 
|     #ÎïÆ·±³°üÊÇ·ñÓÐÊ£Óà¿Õ¼ä  | 
|     itemSpace = 0  | 
|     curPack = curPlayer.GetItemManager().GetPack(packindex)  | 
|     for i in range(0, curPack.GetCount()):  | 
|         item = curPack.GetAt(i)  | 
|           | 
|         if item.IsEmpty():  | 
|             itemSpace += 1  | 
|       | 
|     return itemSpace  | 
|   | 
| ## ¼ì²é±³°üÊÇ·ñÓÐÊ£Óà¿Õ¼ä   | 
| #  @param curPlayer µ±Ç°Íæ¼Ò  | 
| #  @param packindex ±³°üË÷Òý  | 
| #  @return None  | 
| #  @remarks º¯ÊýÏêϸ˵Ã÷.  | 
| def CheckPackHasSpace(curPlayer, packindex):  | 
|     #ÎïÆ·±³°üÊÇ·ñÓÐÊ£Óà¿Õ¼ä  | 
|     curPack = curPlayer.GetItemManager().GetPack(packindex)  | 
|     for i in range(0, curPack.GetCount()):  | 
|         item = curPack.GetAt(i)  | 
|           | 
|         if item.IsEmpty():  | 
|             return True  | 
|           | 
|     return False  | 
|   | 
|   | 
| ## ¼ì²éÊÇ·ñΪ¿ÕµÄ±³°ü  | 
| #  @param itemPack ±³°ü  | 
| #  @return True£¨Ã»ÓÐÈκζ«Î÷£© or None  | 
| #  @remarks º¯ÊýÏêϸ˵Ã÷.  | 
| def GetPackIsEmpty(itemPack):  | 
|     for i in range(itemPack.GetCount()):  | 
|         item = itemPack.GetAt(i)  | 
|         #ÓÐÎïÆ·  | 
|         if not item.IsEmpty() :  | 
|             return  | 
|       | 
|     return True  | 
|   | 
|   | 
| ## ÕÒµ½ÎïÆ·ÊýÁ¿  | 
| #  @param curPlayer µ±Ç°Íæ¼Ò  | 
| #  @param packindex ±³°üË÷Òý  | 
| #  @param id ²éÕÒµÄID   | 
| #  @return value  | 
| #  @remarks º¯ÊýÏêϸ˵Ã÷.  | 
| def FindPlayerItemCountByItemID(curPlayer, packindex, id):  | 
|     value = 0  | 
|     curPack = curPlayer.GetItemManager().GetPack(packindex)  | 
|     for i in range(0, curPack.GetCount()):  | 
|         item = curPack.GetAt(i)  | 
|           | 
|         if not ItemCommon.CheckItemCanUse(item):  | 
|             continue  | 
|           | 
|         if item.GetItemTypeID() == id:  | 
|             value += item.GetCount()  | 
|               | 
|     return value  | 
|   | 
|   | 
| ## ÕÒµ½ÎïÆ·(ͨ¹ýID)  | 
| #  @param curPlayer µ±Ç°Íæ¼Ò  | 
| #  @param packindex ±³°üË÷Òý  | 
| #  @param id ²éÕÒµÄID  | 
| #  @return None or Item  | 
| #  @remarks º¯ÊýÏêϸ˵Ã÷.  | 
| def FindPlayerItemByItemID(curPlayer, packindex, id):  | 
|     curPack = curPlayer.GetItemManager().GetPack(packindex)  | 
|     for i in range(0, curPack.GetCount()):  | 
|         item = curPack.GetAt(i)  | 
|           | 
|         if not ItemCommon.CheckItemCanUse(item):  | 
|             continue  | 
|           | 
|         if item.GetItemTypeID() == id:  | 
|             return item  | 
|           | 
|     return None  | 
|   | 
| ## ÕÒµ½ÎïÆ·(ͨ¹ýЧ¹ûID)   | 
| #  @param curPlayer µ±Ç°Íæ¼Ò  | 
| #  @param packindex ±³°üË÷Òý  | 
| #  @param id ²éÕÒµÄЧ¹ûID  | 
| #  @return None or Item  | 
| #  @remarks º¯ÊýÏêϸ˵Ã÷.  | 
| def FindPlayerItemByEffID(curPlayer, packindex, id):  | 
|     curPack = curPlayer.GetItemManager().GetPack(packindex)  | 
|     for i in range(0, curPack.GetCount()):  | 
|         item = curPack.GetAt(i)  | 
|           | 
|         if not ItemCommon.CheckItemCanUse(item):  | 
|             continue  | 
|           | 
|         effect = item.GetEffectByIndex(0)  | 
|           | 
|         if effect == None:  | 
|             continue  | 
|           | 
|         if effect.GetEffectID() == id:  | 
|             return item  | 
|           | 
|     return None  | 
|   | 
|   | 
| ## ¼ì²éÊÇ·ñ¿ÉÒÔ»»ÂíÆ¥  | 
| #  @param curPlayer µ±Ç°Íæ¼Ò  | 
| #  @return None or True  | 
| #  @remarks º¯ÊýÏêϸ˵Ã÷.  | 
| def CheckCanEquipHorse(curPlayer):  | 
|     if curPlayer.GetPlayerVehicle() == IPY_GameWorld.pvHorse :  | 
|         #DJ_Res_Horses_AlreadyEquip  ¶Ô²»Æð£¬Äú´¦ÓÚÆïÂí״̬ÖÐ,²Ù×÷ÎÞЧ  | 
|         PlayerControl.NotifyCode(curPlayer, "DJ_Res_Horses_AlreadyEquip")  | 
|         return  | 
|       | 
|     horsePack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptHorse)  | 
|     if not GetPackIsEmpty(horsePack):  | 
|         #Horses_Bag_NoRoom ¶Ô²»Æð£¬ÄúµÄÂíÆ¥±³°üÖÐÓÐÎïÆ·,²Ù×÷ÎÞЧ!  | 
|         PlayerControl.NotifyCode(curPlayer, "Horses_Bag_NoRoom")  | 
|         return  | 
|       | 
|     return True  | 
|   | 
| #===============================================================================  | 
| # #½«ÎïÆ··ÅÈëÔöÖµÀ¸µÄÒ»¸ö¿ÕλÖÃÖÐ,Èç¹ûʧ°Ü,Ìæ»»µÚÒ»¸öλÖà  | 
| # #ÈÎÎñÎïÆ·:  | 
| # #1.ÈÎÎñÎïÆ·ÎÞ·¨Òƶ¯µ½°ü¹üÀ¸ÍâµÄÆäËûÎïÆ·´æ·ÅλÖ㨰üÀ¨²Ö¿â¡¢À¬»øÏ䣩  | 
| # #2.ÈÎÎñÎïÆ·ÎÞ·¨³öÊÛ£¬É¾³ý£¬½»Òס¢Ê¹Óã¬×°±¸¡££¨Ò²¾ÍÊÇÎÞ·¨ÓÉÍæ¼ÒÊÖ¶¯ÒƳö°ü¹üÀ¸£©  | 
| # #if ItemControler.IsEventItem(item) == True:  | 
| # #    return  | 
| #===============================================================================  | 
| ## ÊÇ·ñÈÎÎñÎïÆ·   | 
| #  @param item µ±Ç°ÎïÆ·  | 
| #  @return None  | 
| #  @remarks º¯ÊýÏêϸ˵Ã÷.  | 
| def IsEventItem(item):  | 
|     return (item.GetType() == ChConfig.Def_ItemType_MissionItem)  | 
|   | 
| ## É¾³ýÎïÆ·   | 
| #  @param curPlayer µ±Ç°Íæ¼Ò  | 
| #  @param packindex ±³°üË÷Òý  | 
| #  @param id ID  | 
| #  @param count É¾³ýÊýÁ¿  | 
| #  @param delEventItem ÊÇ·ñɾ³ýÈÎÎñÎïÆ·  | 
| #  @param guidList  | 
| #  @return True or False  | 
| #  @remarks º¯ÊýÏêϸ˵Ã÷.  | 
| def DelPlayerItem(curPlayer, packindex, id, count, delEventItem=False, guidList=None):  | 
|     curPack = curPlayer.GetItemManager().GetPack(packindex)  | 
|     curDelCount = count     #µ±Ç°Ê£ÓàµÄÊýÁ¿  | 
|       | 
|     for i in range(0, curPack.GetCount()):  | 
|           | 
|         item = curPack.GetAt(i)  | 
|         if item.IsEmpty():  | 
|             continue  | 
|           | 
|         if item.GetItemTypeID() != id:  | 
|             continue  | 
|           | 
|         #¸ÃÎïÆ·Ëø¶¨²»ÄÜɾ³ý=========================================  | 
|         if item.GetIsLocked():  | 
|             continue  | 
|           | 
|         if not delEventItem  and IsEventItem(item):  | 
|             #GameWorld.Log("ÈÎÎñÎïÆ·²»ÄÜɾ³ý")  | 
|             continue  | 
|           | 
|         #¸ÃÎïÆ·¿ÉÒÔɾ³ý  | 
|         if item.GetCount() > curDelCount:  | 
|             #ÉíÉÏÎïÆ·±ÈҪɾ³ýµÄÎïÆ·¶à  | 
|             SetItemCount(item, item.GetCount() - curDelCount)  | 
|             return True  | 
|           | 
|         elif item.GetCount() == curDelCount:  | 
|             #Ö±½ÓÇå¿ÕÕâ¸öÎïÆ·  | 
|             if guidList != None:   | 
|                 guidList.append(item.GetGUID())  | 
|             item.Clear()  | 
|             return True  | 
|           | 
|         else:  | 
|             #µ±Ç°ÎïÆ·²»¹»  | 
|             if guidList != None:   | 
|                 guidList.append(item.GetGUID())  | 
|                   | 
|             curDelCount = curDelCount - item.GetCount()  | 
|             item.Clear()  | 
|               | 
|             if curDelCount == 0:  | 
|                 return True  | 
|               | 
|     return False  | 
|   | 
|   | 
| ## É¾³ýÎïÆ·Åж¨°ó¶¨(²ÎÊý -> µ±Ç°Íæ¼Ò,±³°üË÷Òý,ID,ÊýÁ¿,ÊÇ·ñɾ³ýÈÎÎñÎïÆ·)  | 
| #  @param curPlayer µ±Ç°Íæ¼Ò  | 
| #  @param packindex ±³°üË÷Òý  | 
| #  @param id ID  | 
| #  @param count É¾³ýÊýÁ¿  | 
| #  @param isbind ÊÇ·ñÊǰó¶¨ÎïÆ·  | 
| #  @param delEventItem ÊÇ·ñɾ³ýÈÎÎñÎïÆ·  | 
| #  @param guidList  | 
| #  @return True or False  | 
| #  @remarks º¯ÊýÏêϸ˵Ã÷.  | 
| def DelPlayerItem_Bind(curPlayer, packindex, id, count, isbind, delEventItem=False, guidList=None):  | 
|     curPack = curPlayer.GetItemManager().GetPack(packindex)  | 
|     curDelCount = count     #µ±Ç°Ê£ÓàµÄÊýÁ¿  | 
|       | 
|     for i in range(0, curPack.GetCount()):  | 
|           | 
|         item = curPack.GetAt(i)  | 
|         if not ItemCommon.CheckItemCanUse(item):  | 
|             continue  | 
|           | 
|         if item.GetItemTypeID() != id:  | 
|             continue  | 
|           | 
|         if not delEventItem  and IsEventItem(item):  | 
|             #GameWorld.Log("ÈÎÎñÎïÆ·²»ÄÜɾ³ý")  | 
|             continue  | 
|           | 
|         #ɾ³ý²»°ó¶¨µÄ²¢ÇÒÎïÆ·Êǰ󶨵쬲»´¦Àí  | 
|         if not isbind and item.GetIsBind():  | 
|             continue  | 
|           | 
|         #¸ÃÎïÆ·¿ÉÒÔɾ³ý  | 
|         if item.GetCount() > curDelCount:  | 
|             #ÉíÉÏÎïÆ·±ÈҪɾ³ýµÄÎïÆ·¶à  | 
|             SetItemCount(item, item.GetCount() - curDelCount)  | 
|             return True  | 
|           | 
|         elif item.GetCount() == curDelCount:  | 
|             #Ö±½ÓÇå¿ÕÕâ¸öÎïÆ·  | 
|             if guidList != None:   | 
|                 guidList.append(item.GetGUID())  | 
|             item.Clear()  | 
|             return True  | 
|           | 
|         else:  | 
|             #µ±Ç°ÎïÆ·²»¹»  | 
|             if guidList != None:   | 
|                 guidList.append(item.GetGUID())  | 
|                   | 
|             curDelCount = curDelCount - item.GetCount()  | 
|             item.Clear()  | 
|               | 
|             if curDelCount == 0:  | 
|                 return True  | 
|               | 
|     return False  | 
|   | 
| ## ÊÇ·ñÄܵþ¼Ó(ÎïÆ·ÀàÐÍ) ÏàͬÎïÆ·£¬Ïàͬ°ó¶¨  | 
| #  @param srcItemID ÆðµãÎïÆ·ID,  | 
| #  @param srcItemIsBind ÆðµãÎïÆ·ÊÇ·ñ°ó¶¨  | 
| #  @param destItemID Ä¿±êÎïÆ·ID  | 
| #  @param destItemIsBind Ä¿±êÎïÆ·ÊÇ·ñ°ó¶¨  | 
| #  @return True or False  | 
| #  @remarks º¯ÊýÏêϸ˵Ã÷.  | 
| def CanPackItemByItemType(srcItemID, srcItemIsBind, destItemID, destItemIsBind):  | 
|     if srcItemID == destItemID and srcItemIsBind == destItemIsBind:  | 
|         return True  | 
|     return False  | 
|   | 
| ## ÊÇ·ñÄܵþ¼Ó(ÎïÆ·ÊÇ·ñ°ó¶¨) ÏàͬÎïÆ·£¬²»Í¬°ó¶¨  | 
| #  @param srcItemID ÆðµãÎïÆ·ID,  | 
| #  @param srcItemIsBind ÆðµãÎïÆ·ÊÇ·ñ°ó¶¨  | 
| #  @param destItemID Ä¿±êÎïÆ·ID  | 
| #  @param destItemIsBind Ä¿±êÎïÆ·ÊÇ·ñ°ó¶¨  | 
| #  @return True or False  | 
| #  @remarks º¯ÊýÏêϸ˵Ã÷.  | 
| def CanPackItemByItemBind(srcItemID, srcItemIsBind, destItemID, destItemIsBind):  | 
|     if srcItemID == destItemID and srcItemIsBind != destItemIsBind:  | 
|         return True  | 
|     return False  | 
|   | 
| ## ÅжÏ2¸öÎïÆ·ÊÇ·ñ¿ÉÒԶѵþ  | 
| #  @param srcItem ÆðµãÎïÆ·  | 
| #  @param destItem Ä¿±êÎïÆ·  | 
| #  @return None  | 
| #  @remarks º¯ÊýÏêϸ˵Ã÷.  | 
| def CanPackItem(srcItem, destItem):  | 
|     return CanPackItemByItemType(srcItem.GetItemTypeID(), srcItem.GetIsBind(), destItem.GetItemTypeID(), destItem.GetIsBind())  | 
|   | 
| ## °ó¶¨ÎïÆ·µÄ¶Ñµþ  | 
| #  @param srcItem ÆðµãÎïÆ·  | 
| #  @param destItem Ä¿±êÎïÆ·  | 
| #  @return None  | 
| #  @remarks º¯ÊýÏêϸ˵Ã÷.  | 
| def CheckDragItemBind(srcItem, destItem):  | 
|     return CanPackItemByItemBind(srcItem.GetItemTypeID(), srcItem.GetIsBind(), destItem.GetItemTypeID(), destItem.GetIsBind())  | 
|   | 
| ## Í϶¯Åж¨   | 
| #  @param curPlayer µ±Ç°Íæ¼Ò  | 
| #  @param fromPackPlace Æðµã±³°üÀàÐÍ  | 
| #  @param fromIndex ÆðµãË÷Òý  | 
| #  @param toPackPlace Ä¿±ê±³°üÀàÐÍ  | 
| #  @param toIndex Ä¿±êË÷Òý  | 
| #  @param count  ÊýÁ¿  | 
| #  @return False or srcItem,destItem,putCount  | 
| #  @remarks º¯ÊýÏêϸ˵Ã÷.  | 
| def __CanDragItem(curPlayer, fromPackPlace, fromIndex, toPackPlace, toIndex, count):  | 
|     itemManager = curPlayer.GetItemManager()  | 
|     if fromPackPlace == IPY_GameWorld.rptDeleted or toPackPlace == IPY_GameWorld.rptDeleted:  | 
|         GameWorld.Log("CanDragItem -> ²»ÔÊÐí²Ù×÷ÒÑɾ³ýµÄÎïÆ· = %s" % (fromPackPlace) , curPlayer.GetPlayerID())  | 
|         return False  | 
|       | 
|     curPack = itemManager.GetPack(fromPackPlace)  | 
|     if curPack == None:  | 
|         GameWorld.Log("CanDragItem ->±³°üÒì³£ = %s" % (fromPackPlace) , curPlayer.GetPlayerID())  | 
|         return False  | 
|       | 
|     toPack = itemManager.GetPack(toPackPlace)  | 
|     if toPack == None:  | 
|         GameWorld.Log("CanDragItem ->Ä¿µÄ±³°üÒì³£ = %s" % (toPackPlace) , curPlayer.GetPlayerID())  | 
|         return False  | 
|       | 
|     if fromIndex >= curPack.GetCount() or fromIndex < 0:  | 
|         GameWorld.Log("CanDragItem ->³õʼ±³°üË÷ÒýÒì³£ = %s,%s" % (fromIndex, curPack.GetCount()) , curPlayer.GetPlayerID())  | 
|         return False  | 
|       | 
|     if toIndex >= toPack.GetCount() or toIndex < 0:  | 
|         GameWorld.Log("CanDragItem ->Ä¿µÄ±³°üË÷ÒýÒì³£ = %s,%s" % (toIndex, toPack.GetCount()) , curPlayer.GetPlayerID())  | 
|         return False  | 
|       | 
|     srcItem = curPack.GetAt(fromIndex)  | 
|     destItem = toPack.GetAt(toIndex)  | 
|     putCount = count  | 
|     #GameWorld.Log("fromPackPlace:%d,fromIndex:%d,toPackPlace:%d,toIndex:%d,count:%d"%(fromPackPlace, fromIndex, toPackPlace, toIndex, count))  | 
|     #¸ÃÎïÆ·Ëø¶¨²»Ö´ÐÐ==============================================  | 
|     if srcItem == None:  | 
|         #GameWorld.Log("ÆðʼÎïÆ·Îª²»´æÔÚ")  | 
|         return False  | 
|       | 
|     if destItem == None:  | 
|         #GameWorld.Log("Ä¿±êÎïÆ·Îª²»´æÔÚ")  | 
|         return False  | 
|       | 
|     if srcItem.IsEmpty():  | 
|         #GameWorld.Log("ÆðʼλÖÃΪ¿Õ")  | 
|         return False  | 
|       | 
|     #¸ÃÎïÆ·Ëø¶¨²»Ö´ÐÐ==============================================  | 
|       | 
|     if srcItem.GetIsLocked():  | 
|         PlayerControl.NotifyCode(curPlayer, "GeRen_chenxin_644055")  | 
|         #GameWorld.Log("¸ÃÎïÆ·ÒÑËø¶¨")  | 
|         return False  | 
|       | 
|     if putCount > srcItem.GetCount():  | 
|         #Í϶¯µÄÎïÆ·ÊýÁ¿´óÓÚÆðʼλÖõÄÎïÆ·ÊýÁ¿  | 
|         #GameWorld.Log("Í϶¯µÄÎïÆ·ÊýÁ¿´óÓÚÆðʼλÖõÄÎïÆ·ÊýÁ¿")  | 
|         return False  | 
|       | 
|     if putCount < 0:  | 
|         #GameWorld.Log("Í϶¯ÎïÆ·ÊýÁ¿Îª0")  | 
|         return False  | 
|       | 
|     elif putCount == 0:  | 
|         putCount = srcItem.GetCount()  | 
|       | 
|     if fromPackPlace != toPackPlace and IsEventItem(srcItem):  | 
|         PlayerControl.NotifyCode(curPlayer, "itemuse_chenxin_31379")  | 
|         return False  | 
|       | 
|     if fromPackPlace != toPackPlace and IsEventItem(destItem):  | 
|         PlayerControl.NotifyCode(curPlayer, "itemuse_chenxin_31379")  | 
|         return False  | 
|       | 
|     return srcItem, destItem, putCount  | 
|   | 
| def ItemNeedRecord(curItem):  | 
|     '''ÅжÏÊÇ·ñÐèÒª¼Ç¼  | 
|         ¼Ç¼ÓÅÏȼ¶£º ¿ª¹Ø > ÐèÒª¼Ç¼µÄ > ²»ÐèÒª¼Ç¼µÄ > Î´ÖªÉ趨  | 
|     '''  | 
|     recordOpen = IpyGameDataPY.GetFuncCfg("ItemRecord", 1)  | 
|     if not recordOpen:  | 
|         #GameWorld.DebugLog("ÎïÆ·¼Ç¼Ϊ¿ªÆô!")  | 
|         return False  | 
|       | 
|     itemType = curItem.GetType()  | 
|     itemID = curItem.GetItemTypeID()  | 
|     itemTypeMinColorDict = IpyGameDataPY.GetFuncEvalCfg("ItemRecordRule", 1)  | 
|     if itemType in itemTypeMinColorDict:  | 
|         minColor = itemTypeMinColorDict[itemType]  | 
|     else:  | 
|         minColor = itemTypeMinColorDict[0]  | 
|     if curItem.GetItemColor() >= minColor:  | 
|         #GameWorld.DebugLog("ÐèÒª¼Ç¼µÄÎïÆ·ÑÕÉ«! itemType=%s,color=%s" % (itemType, curItem.GetItemColor()))  | 
|         return True  | 
|       | 
|     if itemType in IpyGameDataPY.GetFuncEvalCfg("ItemRecordRule", 2) \  | 
|         or itemID in IpyGameDataPY.GetFuncEvalCfg("ItemRecordRule", 3):  | 
|         #GameWorld.DebugLog("ÐèÒª¼Ç¼µÄÎïÆ·ÀàÐÍ»òID! itemType=%s,itemID=%s" % (itemType, itemID))  | 
|         return True  | 
|       | 
|     if itemType in IpyGameDataPY.GetFuncEvalCfg("ItemRecordRule", 4) \  | 
|         or itemID in IpyGameDataPY.GetFuncEvalCfg("ItemRecordRule", 5):  | 
|         #GameWorld.DebugLog("²»ÐèÒª¼Ç¼µÄÎïÆ·ÀàÐÍ»òID! itemType=%s,itemID=%s" % (itemType, itemID))  | 
|         return False  | 
|       | 
|     #if itemType == ChConfig.Def_ItemType_Rune:  | 
|     #    return IsRuneItemNeedRecord(curItem, curItem.GetUserAttr(ShareDefine.Def_IudetRuneLV))  | 
|     defaultNeed = IpyGameDataPY.GetFuncCfg("ItemRecord", 2)  | 
|     #GameWorld.DebugLog("ÆäËû¹æÔò£¬Ê¹ÓÃĬÈϼǼÉ趨! defaultNeed=%s" % defaultNeed)  | 
|     return defaultNeed  | 
|   | 
| def ItemNotNeedRecord(curItem):  | 
|     ## ÊÇ·ñΪ²»ÐèÒª¼Ç¼µÄÎïÆ·  | 
|     itemType = curItem.GetType()  | 
|     itemID = curItem.GetItemTypeID()  | 
|     if itemType in IpyGameDataPY.GetFuncEvalCfg("ItemRecordRule", 4) \  | 
|         or itemID in IpyGameDataPY.GetFuncEvalCfg("ItemRecordRule", 5):  | 
|         #GameWorld.DebugLog("²»ÐèÒª¼Ç¼µÄÎïÆ·ÀàÐÍ»òID! itemType=%s,itemID=%s" % (itemType, itemID))  | 
|         return True  | 
|     return False  | 
|   | 
| #ÎïÆ·ÊôÐÔÅжÏ------------------------------------------------------------------  | 
| ## Ê¹ÓÃÎïÆ·¼ì²éÊÇ·ñÂú×ãÊôÐÔ  | 
| #  @param curPlayer µ±Ç°Íæ¼Ò  | 
| #  @param curItem µ±Ç°ÎïÆ·  | 
| #  @return False or True  | 
| def CheckItemAttrLimit(curPlayer, curItem):  | 
|     # È¡ÏûÏÞÖÆµÄÎïÆ·  | 
|     if curItem.GetUserAttr(ShareDefine.Def_IudetCancelUseLimit) == 1:  | 
|         return True  | 
|     #ÖÇÁ¦Îª»ù´¡ÏÞÖÆ  | 
|     if curItem.GetLimitPNE() > curPlayer.GetPNE():  | 
|         return False  | 
|       | 
|     #ÓÉÓڿɱäÊôÐÔÇ¿»¯±í¼ÓÔØÎÊÌâ, ÔÝʱ²»´¦ÀíÇ¿»¯±íµÄÊôÐÔµãÏÞÖÆ£¬ÒÔÎïÆ·±íΪÖ÷£¬ÈçÓÐÐèÒªÔÙ¿ªÆô´ËÅжϠ20151210 by hxp  | 
|     # ´ÓÇ¿»¯±íÖлñµÃÊý¾Ý£¬×°±¸Ç¿»¯ÏÞÖÆÁ¦Á¿ Ãô½Ý  | 
| #    if curItem.GetType() in ReadChConfig.GetEvalChConfig("EquipPlus_EquipType"):  | 
| #        plusInfo = ...  | 
| #          | 
| #        if plusInfo is None:  | 
| #            GameWorld.ErrLog("tagItemPlus.txt can't find equip:%s" % curItem.GetItemTypeID())  | 
| #            return False  | 
| #               | 
| #        limitSTR, limitPHY = plusInfo.GetLimitSTR(), plusInfo.GetLimitPHY()  | 
| #      | 
| #    # ÎïÆ·±íÖлñµÃÐÅÏ¢  | 
| #    else:  | 
|     limitSTR, limitPHY = curItem.GetLimitSTR(), curItem.GetLimitPHY()  | 
|       | 
|     if limitSTR > curPlayer.GetSTR() or limitPHY > curPlayer.GetPHY():  | 
|         return False  | 
|       | 
|     return True  | 
|   | 
|   | 
| #ÎïÆ·Ê¹Óõȼ¶ÅжÏ----------------------------------------------------------------  | 
| ## ÎïÆ·Ê¹Óõȼ¶ÅÐ¶Ï  | 
| #  @param curPlayer Íæ¼Ò  | 
| #  @param item ÎïÆ·  | 
| #  @param needNotify ÊÇ·ñÐèÒªÌáʾ  | 
| #  @return True or False  | 
| def CheckItemUseLV(curPlayer, item, needNotify=True):   | 
|     # È¡ÏûµÈ¼¶ÏÞÖÆµÄÎïÆ·  | 
|     if item.GetUserAttr(ShareDefine.Def_IudetCancelUseLimit) == 1:  | 
|         return True  | 
|       | 
|     if curPlayer.GetLV() < GetItemUseLV(item):  | 
|         if needNotify:  | 
|             PlayerControl.NotifyCode(curPlayer, "LvErr")  | 
|         return False  | 
|       | 
|     if curPlayer.GetReincarnationLv() < item.GetReincarnationLv():  | 
|         if needNotify:  | 
|             PlayerControl.NotifyCode(curPlayer, "07F159E1-0974-4946-BE4942EAB8B5DBBE")  | 
|         return False  | 
|       | 
|     itemUseRealmLimit = item.GetEventCanUse() # ´Ë×Ö¶ÎÔÝÓÃÓÚÏÞÖÆ¾³½çÌõ¼þ  | 
|     if curPlayer.GetOfficialRank() < itemUseRealmLimit:  | 
|         if needNotify:  | 
|             PlayerControl.NotifyCode(curPlayer, "RealmLimitUnuse")  | 
|         return False  | 
|       | 
|     return True  | 
|   | 
|   | 
| ## »ñµÃÎïÆ·µÄʹÓõȼ¶  | 
| #  @param curItem µ±Ç°ÎïÆ·  | 
| #  @return Ê¹Óõȼ¶  | 
| def GetItemUseLV(curItem):  | 
|       | 
|     initLV = curItem.GetUseLV()  | 
|     return initLV  | 
| #===============================================================================  | 
| #    itemType = curItem.GetType()  | 
| #      | 
| #    # [[Ö¸¶¨µÄÎïÆ·ÀàÐÍ,], µÈ¼¶¹«Ê½]  | 
| #    useLVByPlusItemType, useLVExp = ReadChConfig.GetEvalChConfig("UseItemLVLimitInfo")  | 
| #          | 
| #    # Ö¸¶¨ÎïÆ·ÀàÐ͵ÄʹÓõȼ¶£¬Ðè¸ü¾ßÇ¿»¯µÈ¼¶  | 
| #    if itemType not in useLVByPlusItemType:  | 
| #        return initLV  | 
| #   | 
| #    # ¼ÆËã³á°òʹÓõȼ¶²ÎÊý(plusLV, initLV)  | 
| #    plusLV = 0#curItem.GetItemStarLV()      | 
| #    return eval(useLVExp)  | 
| #===============================================================================  | 
|   | 
| #------------------------------------------------------------------  | 
| ## ÅжÏÊÇ·ñÊǹóÖØÆ·  | 
| #  @param itemMark µ±Ç°ÎïÆ·  | 
| #  @return ÊÇ·ñÊǹóÖØÆ·  | 
| def IsValuableItem(curItem):  | 
|       | 
|     #×°±¸ÊÇ·ñ׿ԽÎïÆ·  | 
|     #===========================================================================  | 
|     # ValuableItemQualityList = ReadChConfig.GetEvalChConfig("ValuableItemQuality")  | 
|     # if curItem.GetItemQuality() in ValuableItemQualityList:  | 
|     #    return True  | 
|     #   | 
|     # # ¹óÖØÎïÆ·ÅäÖÃ[[¹óÖØÎïÆ·id], [¹óÖØÎïÆ·ÀàÐÍ], ¹óÖØÎïÆ·¼ÓÇ¿µÈ¼¶, ¹óÖØÎïÆ·×·¼ÓµÈ¼¶]  | 
|     # valuablesInfo = ReadChConfig.GetEvalChConfig("ValuablesConfigInfo")  | 
|     # valuablesIDList, valuablesTypeList, valuableMinStar, valuableAddAttrLV = valuablesInfo  | 
|     #   | 
|     # #ÎïÆ·IDÂú×ã  | 
|     # if curItem.GetItemTypeID() in valuablesIDList:  | 
|     #    return True  | 
|     #   | 
|     # #ÎïÆ·ÀàÐÍÂú×ã   | 
|     # if curItem.GetType() in valuablesTypeList:  | 
|     #    return True  | 
|     #      | 
|     # #ÆÕͨװ±¸Åж¨  | 
|     # if ItemCommon.CheckItemIsEquip(curItem):  | 
|     #      | 
|     #    #Ì××°ÎïÆ·  | 
|     #    if curItem.GetIsSuite():  | 
|     #        return True  | 
|     #      | 
|     #    #×°±¸Ç¿»¯ÐǼ¶  | 
|     #    if curItem.GetItemStarLV() >= valuableMinStar:  | 
|     #        return True  | 
|     #===========================================================================  | 
|   | 
|     return False  | 
|   | 
|   | 
| ## Ö´ÐÐÍ϶¯ÎïÆ·Âß¼   | 
| #  @param curPlayer µ±Ç°Íæ¼Ò  | 
| #  @param fromPackPlace Æðµã±³°üλÖà  | 
| #  @param fromIndex ÆðµãË÷Òý  | 
| #  @param toPackPlace Ä¿±ê±³°üλÖà  | 
| #  @param toIndex Ä¿±êË÷Òý  | 
| #  @param count ÊýÁ¿  | 
| #  @return None or True  | 
| #  @remarks º¯ÊýÏêϸ˵Ã÷.  | 
| def __DoDragItem(curPlayer, fromPackPlace, fromIndex, toPackPlace, toIndex, count):  | 
|     result = __CanDragItem(curPlayer, fromPackPlace, fromIndex, toPackPlace, toIndex, count)  | 
|       | 
|     if not result :  | 
|         return  | 
|       | 
|     srcItem, destItem, putCount = result  | 
|       | 
|     #1. Ä¿±êλÖÃΪ¿Õ  | 
|     if destItem.IsEmpty() == 1:  | 
|         #°ÑÆðʼµãµÄÎïÆ··Åµ½Ò»¸öÐÂλÖà  | 
|         if putCount == srcItem.GetCount():  | 
|             #ÎïÆ··ÅÈë¿ÕλÖÃ, ½»»»Î»Öà  | 
|             srcItem.Switch(destItem)  | 
|             return True  | 
|         else:  | 
|             needPutItem = ItemCommon.CreateSingleItem(srcItem.GetItemTypeID())  | 
|             if needPutItem == None:  | 
|                 GameWorld.Log("ÎïÆ· = %sÍ϶¯´´½¨Òì³£" % (srcItem.GetItemTypeID()) , curPlayer.GetPlayerID())  | 
|                 return  | 
|               | 
|             #"ÒòÍÏ×§²ð·Ö¶ø´´½¨ÎïÆ·",         //157  | 
|             if ItemNeedRecord(srcItem):  | 
|                 pass  | 
|               | 
|             #´´½¨Ä¿±êÎïÆ·  | 
|             destItem.AssignItem(needPutItem)  | 
|             #GameWorld.Log("´´½¨Ä¿±êÎïÆ·")  | 
|             SetItemCount(destItem, putCount)  | 
|             destItem.SetIsBind(srcItem.GetIsBind())  | 
|             SetItemCount(srcItem, srcItem.GetCount() - putCount)  | 
|               | 
|         return True  | 
|       | 
|     if destItem.GetIsLocked():  | 
|         PlayerControl.NotifyCode(curPlayer, "GeRen_chenxin_644055")  | 
|         return  | 
|       | 
|     maxPackCount = destItem.GetPackCount()  | 
|     #ÎïÆ·À¸±³°ü£¬  Á½±ßIDÏàͬ £¬ °ó¶¨×´Ì¬²»Ò»Ñù  | 
|     if (fromPackPlace == IPY_GameWorld.rptItem and toPackPlace == IPY_GameWorld.rptItem and CheckDragItemBind(srcItem, destItem) and maxPackCount > destItem.GetCount()):  | 
|         destRemainCount = destItem.GetPackCount() - destItem.GetCount()   | 
|         realPutCount = min(putCount, destRemainCount)  | 
|         if realPutCount <= 0:  | 
|             return  | 
|           | 
|         SetItemCount(srcItem, srcItem.GetCount() - realPutCount)  | 
|         SetItemCount(destItem, destItem.GetCount() + realPutCount)  | 
|           | 
|         SetItemIsBind(destItem, True)  | 
|         return True  | 
|     #2. Ä¿±êλÖÃÓж«Î÷, ²¢ÇÒ¿ÉÒԶѵþ  | 
|     if (CanPackItem(srcItem, destItem) and maxPackCount > destItem.GetCount()):  | 
|         #¶Ñµþ  | 
|         destRemainCount = maxPackCount - destItem.GetCount()   | 
|         realPutCount = min(putCount, destRemainCount)  | 
|         if realPutCount <= 0:  | 
|             GameWorld.Log("ÎïÆ·¶ÑµþÒì³£ = %s,%s" % (putCount, destRemainCount) , curPlayer.GetPlayerID())  | 
|             return  | 
|           | 
| #        GameWorld.Log("realPutCount = %d putCount = %d fromPackPlace = %d toPackPlace = %d"%  | 
| #                                          (realPutCount, putCount, fromPackPlace, toPackPlace))  | 
|         if realPutCount != putCount and fromPackPlace != toPackPlace:  | 
|             #Èç¹û±³°ü²»Í¬£¬ ²¢ÇÒ²»ÄÜÈ«²¿·ÅÈ룬 ÄÇôʣÓàÎïÆ··ÅÈë¶ÔÏó±³°ü  | 
|             playerItemControl = PlayerItemControler(curPlayer)  | 
|             playerItemControl.PutInItem(toPackPlace, srcItem)  | 
|             return True  | 
|           | 
|   | 
|         if srcItem.GetCount() - realPutCount == 0:  | 
|             #"ÒòÍÏ×§²ð·Ö¶øÉ¾³ýÎïÆ·"         //157  | 
|             if ItemNeedRecord(srcItem):  | 
|                 pass  | 
|               | 
|         SetItemCount(srcItem, srcItem.GetCount() - realPutCount)  | 
|         SetItemCount(destItem, destItem.GetCount() + realPutCount)  | 
|           | 
|     #3. Ä¿±êλÖÃÓж«Î÷, ²»Äܶѵþ  | 
|     else:  | 
|         if fromPackPlace != toPackPlace:  | 
|             #Èç¹û±³°ü²»Í¬£¬ ²¢ÇÒ²»ÄÜÈ«²¿·ÅÈ룬 ÄÇôʣÓàÎïÆ··ÅÈë¶ÔÏó±³°ü  | 
|             playerItemControl = PlayerItemControler(curPlayer)  | 
|             playerItemControl.PutInItem(toPackPlace, srcItem)  | 
|             return True  | 
|         #½»»»Î»Öà  | 
|         srcItem.Switch(destItem)  | 
|     return True  | 
|   | 
| ## Í϶¯ÎïÆ·   | 
| #  @param curPlayer µ±Ç°Íæ¼Ò  | 
| #  @param fromPackPlace Æðµã±³°üλÖà  | 
| #  @param fromIndex ÆðµãË÷Òý  | 
| #  @param toPackPlace Ä¿±ê±³°üλÖà  | 
| #  @param toIndex Ä¿±êË÷Òý  | 
| #  @param count ÊýÁ¿  | 
| #  @return None or True  | 
| #  @remarks º¯ÊýÏêϸ˵Ã÷.  | 
| def DragItem(curPlayer, fromPackPlace, fromIndex, toPackPlace, toIndex, count):  | 
|     if fromPackPlace == toPackPlace and fromIndex == toIndex:  | 
|         #ÆðʼλÖúÍÖÕֹλÖÃÏàͬ, ²»´¦Àí  | 
|         GameWorld.Log('###ÆðʼλÖúÍÖÕֹλÖÃÏàͬ, ²»´¦Àí')  | 
|         return  | 
|       | 
|     result = __DoDragItem(curPlayer, fromPackPlace, fromIndex, toPackPlace, toIndex, count)  | 
|       | 
|     if result != True:  | 
|         curPlayer.Notify_ItemPutFail(fromPackPlace, fromIndex, toPackPlace, toIndex)  | 
|         return  | 
|       | 
|     return result  | 
| #---------------------------------------------------------------------  | 
| #################################################################  | 
| #Íæ¼ÒµÄÎïÆ·¹ÜÀíÆ÷¿ØÖÆÀà  | 
| ## Íæ¼ÒµÄÎïÆ·¹ÜÀíÆ÷¿ØÖÆÀà  | 
| #  | 
| #  PyClassÀàµÄÏêϸ˵Ã÷.  | 
| class PlayerItemControler:  | 
|     __Player = None  | 
|     __PlayerItemManager = None  | 
|     __PlayerEquip = None  | 
|     __PlayerItem = None  | 
|       | 
|     ## ³õʼ»¯  | 
|     #  @param iPlayer Íæ¼Ò  | 
|     #  @return None  | 
|     #  @remarks º¯ÊýÏêϸ˵Ã÷.  | 
|     def __init__(self, iPlayer):  | 
|         self.__Player = iPlayer  | 
|         self.__PlayerItemManager = self.__Player.GetItemManager()  | 
|         self.__PlayerEquip = self.__PlayerItemManager.GetPack(IPY_GameWorld.rptEquip)  | 
|         self.__PlayerItem = self.__PlayerItemManager.GetPack(IPY_GameWorld.rptItem)  | 
|         return  | 
|       | 
|     ## Íæ¼ÒÊÇ·ñÄÜ×°±¸ÎïÆ·   | 
|     #  @param curItem µ±Ç°ÎïÆ·  | 
|     #  @param needNotify ÊÇ·ñÐèҪ֪ͨ¿Í»§¶Ë  | 
|     #  @return ²¼¶ûÖµ  | 
|     #  @remarks º¯ÊýÏêϸ˵Ã÷.  | 
|     def PlayerCanEquipItem(self, curItem, needNotify):  | 
|         curPlayer = self.__Player  | 
|         #·Ç·¨×°±¸¼ì²é  | 
|         if curItem.GetIsLocked():  | 
|             if needNotify:  | 
|                 PlayerControl.NotifyCode(curPlayer, "RescannotEquip")  | 
|               | 
|             return False  | 
|           | 
|         #ÈÎÎñÎïÆ·¼ì²é  | 
|         if IsEventItem(curItem):  | 
|             if needNotify:  | 
|                 PlayerControl.NotifyCode(curPlayer, "TaskRes")  | 
|               | 
|             return False  | 
|           | 
|         #Êý¾Ý¿âÖÐÊÇ1¿ªÊ¼  | 
| #        if curItem.GetEquipPlace() == 0:  | 
| #            if needNotify:  | 
| #                #ÎïÆ·²»ÄÜ×°±¸  | 
| #                PlayerControl.NotifyCode(curPlayer, "GeRen_hgg_595819")  | 
| #  | 
| #            return False  | 
|           | 
|         #Ö°Òµ¼ì²é  | 
|         if not ItemCommon.JobUseable(curPlayer, curItem):  | 
|             if needNotify:  | 
|                 PlayerControl.NotifyCode(curPlayer, "GeRen_lhs_31379")  | 
|   | 
|             return False  | 
|   | 
|         #ÐÔ±ð¼ì²é  | 
|         curItemNeedSexReq = curItem.GetSexReq()  | 
|           | 
|         if curItemNeedSexReq != ChConfig.Def_PlayerSex_All and curItemNeedSexReq != curPlayer.GetSex() :  | 
|             if needNotify:  | 
|                 PlayerControl.NotifyCode(curPlayer, "SexErr")  | 
|   | 
|             return False  | 
|   | 
|         #µÈ¼¶¼ì²é  | 
|         if not CheckItemUseLV(curPlayer, curItem, needNotify):  | 
|             return False  | 
|   | 
|         #ʹÓÃÎïÆ·¼ì²éÊÇ·ñÂú×ãÊôÐÔ  | 
|         if not CheckItemAttrLimit(curPlayer, curItem):  | 
|             if needNotify:  | 
|                 PlayerControl.NotifyCode(curPlayer, "itemuse_andyshao_671654")  | 
|             return False  | 
|       | 
|         #=======================================================================  | 
|         # #ÂíÆ¥¼ì²é  | 
|         # if curItem.GetType() == ChConfig.Def_Item_Type_Horse and not CheckCanEquipHorse(curPlayer):  | 
|         #    return False  | 
|         #=======================================================================  | 
|   | 
|       | 
|         return True  | 
|       | 
|       | 
|     ## ½»»»×°±¸  | 
|     #  @param curItem µ±Ç°ÎïÆ·  | 
|     #  @param equipPlace ×°±¸Î»Öà  | 
|     #  @return True or False  | 
|     #  @remarks º¯ÊýÏêϸ˵Ã÷.     | 
|     def SwitchEquip(self, curItem, equipPlace):  | 
|         curPlayer = self.__Player  | 
|         equipPack = self.__PlayerEquip  | 
|           | 
|         curEquip = equipPack.GetAt(equipPlace)  | 
|           | 
|         #GameWorld.Log("×°±¸Î»ÖÃ%d"%equipPlace)  | 
|         if curEquip.IsEmpty():  | 
|             return ItemCommon.PutIn(curPlayer, curEquip, curItem, IPY_GameWorld.rptEquip)  | 
|           | 
|         #°Ñ±³°üÖÐҪװ±¸ÎïÆ·È¡³ö£¬·ÅÈë×°±¸À¸µÄ¸ÃλÖà  | 
|         #°ÑжÏÂ×°±¸·ÅÈë±³°üҪװ±¸ÎïÆ·µÄλÖà  | 
|         if self.SwitchCanSpliceEquip(curEquip, curItem) != True:  | 
|             #curEquip.SetItemStarLV(0) # ½»»»ÏµÄ×°±¸ÐǼ¶ÉèÖÃΪ0  | 
|             return ItemCommon.SwitchItem(curPlayer, curEquip, curItem, IPY_GameWorld.rptEquip)  | 
|           | 
|         return False      | 
|       | 
|     # ¼ÆËã×°±¸µÄÕ䯷ÊýÁ¿  | 
|     def RefreshStartEquipCount(self):  | 
|         curPlayer = self.__Player  | 
|         count = 0  | 
|         equipPack = self.__PlayerEquip  | 
|         for i in xrange(equipPack.GetCount()):  | 
|             curEquip = equipPack.GetAt(i)  | 
|               | 
|             if curEquip.IsEmpty():  | 
|                 continue  | 
|               | 
|             if not curEquip.GetItemQuality():  | 
|                 continue  | 
|               | 
|             count += 1  | 
|               | 
|         curPlayer.SetDict(ChConfig.Def_PlayerKey_StartEquipCnt, count)  | 
|         return  | 
|       | 
|     def GetStartEquipCount(self):  | 
|         curPlayer = self.__Player  | 
|         return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_StartEquipCnt)  | 
|   | 
|     ## ×°±¸µ±Ç°ÎïÆ·  | 
|     #  @param curItem µ±Ç°ÎïÆ·  | 
|     #  @param packEquipIndex ¿Í»§¶Ë·¢À´×°±¸Î»ÖÃ(IPY_GameWorld.retMax ´ú±í·þÎñÆ÷×Ô¶¯×°±¸)  | 
|     #  @return Ìæ»»µÄλÖà-1±íÊ¾Ìæ»»Ê§°Ü  | 
|     def EquipItem(self, curItem, packEquipIndex):  | 
|         if not self.PlayerCanEquipItem(curItem, True):  | 
|             return -1  | 
|           | 
|         equipPlace = curItem.GetEquipPlace()  | 
|         if packEquipIndex != equipPlace:  | 
|             #ÏÉÆ÷ÓÐÁ½¸öλÖã¬ÆäËû×°±¸¼ì²é×°±¸Î»ÖúÍÌî±íÊÇ·ñÒ»Ö  | 
|             if equipPlace not in ChConfig.Def_FairyCanList and packEquipIndex not in ChConfig.Def_FairyCanList:  | 
|                 return -1  | 
|   | 
|         curPlayer = self.__Player  | 
|         #equipPack = self.__PlayerEquip  | 
|         #equipItem = equipPack.GetAt(packEquipIndex)  | 
|           | 
|         # ×°±¸°ó¶¨´¦Àí ÔÚ DoLogic_ItemBindTypeº¯ÊýÓд¦Àí,´Ë´¦×¢Ê͵ô  | 
| #        if not curItem.GetIsBind():  | 
| #            SetItemIsBind(curItem, True)  | 
|           | 
|         #--ÆäËû×°±¸ÎïÆ·---  | 
|         #itemColor = curItem.GetItemColor()  | 
|         result = self.SwitchEquip(curItem, packEquipIndex)  | 
|         if result:  | 
|             #´©´÷ij½×ijƷÖʵÄ×°±¸³É¾Í  | 
|             PlayerSuccess.DoEquipSuccessLogic(curPlayer)  | 
|             #»»×°±¦Ê¯´¦Àí  | 
|             Operate_EquipStone.DoMoveEquipStone(curPlayer, packEquipIndex)  | 
|             #Ì××°½µ¼¶´¦Àí  | 
|             Operate_EquipSuitCompose.CheckEquipSuitReduce(curPlayer, packEquipIndex)  | 
|             EventShell.EventRespons_EquipStar(curPlayer)  | 
|         self.RefreshStartEquipCount()  | 
|         return packEquipIndex if result else -1  | 
|       | 
|   | 
|     ## Ìæ»»¿ÉÒÔµþ¼ÓÎïÆ·Âß¼   | 
|     #  @param curEquip µ±Ç°×°±¸  | 
|     #  @param curItem µ±Ç°ÎïÆ·  | 
|     #  @return True or False  | 
|     #  @remarks º¯ÊýÏêϸ˵Ã÷.  | 
|     def SwitchCanSpliceEquip(self, curEquip, curItem):  | 
|         #°ó¶¨ÊôÐÔ²»Í¬, ²»¿Éµþ¼Ó  | 
|         if curEquip.GetIsBind() != curItem.GetIsBind():  | 
|             return False  | 
|           | 
|         #Ч¹ûID²»Ò»Ñù, ²»¿Éµþ¼Ó  | 
|         if curItem.GetEffectByIndex(0).GetEffectID() != curEquip.GetEffectByIndex(0).GetEffectID():  | 
|             return False  | 
|           | 
|         #×°±¸µ±Ç°ÊýÁ¿  | 
|         euqipCount = curEquip.GetCount()  | 
|         #×°±¸¿Éµþ¼ÓÊýÁ¿  | 
|         equipPackCount = curEquip.GetPackCount()  | 
|           | 
|         #¶ÑµþÉÏÏÞΪ1, ²»¿Éµþ¼Ó  | 
|         if equipPackCount == 1 or curItem.GetPackCount() == 1:  | 
|             return False  | 
|           | 
|         #ÒѾÊÇ×î´ó¶Ñµþ, ²»¿Éµþ¼Ó  | 
|         if euqipCount >= equipPackCount:  | 
|             return False  | 
|           | 
|         #---Ö´Ðеþ¼ÓÎïÆ·Âß¼---  | 
|         itemCount = curItem.GetCount()  | 
|           | 
|         sumValue = euqipCount + itemCount  | 
|           | 
|         if sumValue <= equipPackCount:  | 
|             SetItemCount(curEquip, sumValue)  | 
|             curItem.Clear()  | 
|         else:  | 
|             SetItemCount(curEquip, equipPackCount)  | 
|             SetItemCount(curItem, sumValue - equipPackCount)  | 
|           | 
|         return True  | 
|       | 
|     ## Ð¶ÔØÎïÆ·   | 
|     #  @param equipIndex ×°±¸Ë÷Òý  | 
|     #  @param packIndex ±³°üË÷Òý  | 
|     #  @return equipID , equipPlace  | 
|     #  @remarks º¯ÊýÏêϸ˵Ã÷.  | 
|     def UnEquipItem(self, equipIndex, packIndex):  | 
|         curPlayer = self.__Player  | 
|         equipItem = self.__PlayerEquip  | 
|         curEquip = equipItem.GetAt(equipIndex)  | 
|         #Ä¿±ê×°±¸¼ì²é  | 
|         if curEquip == None or curEquip.IsEmpty():  | 
|             return  | 
|           | 
|         equipID = curEquip.GetItemTypeID()  | 
|   | 
|         #¸ÃÎïÆ·Ëø¶¨²»Ö´ÐÐ==============================================  | 
|         if curEquip.GetIsLocked():  | 
|             PlayerControl.NotifyCode(curPlayer, "RescannotEquip")  | 
|             return  | 
|           | 
|         if IsEventItem(curEquip):  | 
|             PlayerControl.NotifyCode(curPlayer, "TaskRes")  | 
|             return  | 
|           | 
|         #ÎïÆ·À¸±³°ü  | 
|         curPack = self.__PlayerItemManager.GetPack(IPY_GameWorld.rptItem)  | 
|           | 
|         if packIndex < 0 or packIndex >= curPack.GetCount():  | 
|             PlayerControl.NotifyCode(curPlayer, "GeRen_chenxin_676165", [IPY_GameWorld.rptItem])  | 
|             return  | 
|           | 
|         curEquipCount = curEquip.GetCount()  | 
|           | 
|         #×°±¸Îªµ¥ÊýÁ¿ÎïÆ·ÎÞÐè±éÀú±³°üÅж¨£¬ÒÔÍÏÈëµÄij¸ö¸ñ×ÓÊÇ·ñ¿ÉÒÔÌî³äΪÅж¨ __CanDragItem  | 
|         #=======================================================================  | 
|         # if not self.CanPutInItem(IPY_GameWorld.rptItem, equipID, curEquipCount, curEquip.GetIsBind()):  | 
|         #    #GameWorld.Log("Íæ¼Ò±³°üÎÞ·¨·ÅÈëÕâ¸öÎïÆ·")  | 
|         #    return  | 
|         #=======================================================================  | 
|           | 
|         #ÉèÖÃÎïÆ·¼¤»î״̬ΪFalse  | 
|         #curEquip.SetIsSoulActive(False)  | 
| #        if curEquip.GetItemStarLV() != 0:  | 
| #            curEquip.SetItemStarLV(0) # ÍÑϵÄÎïÆ·ÐǼ¶ÉèÖÃΪ0  | 
|               | 
|         #±³°üÎïÆ··ÅÈë²Ö¿â  | 
|         if not DragItem(curPlayer, IPY_GameWorld.rptEquip, equipIndex, IPY_GameWorld.rptItem, packIndex, curEquipCount):  | 
|             return  | 
|         self.RefreshStartEquipCount()  | 
|         #Ì××°½µ¼¶´¦Àí  | 
|         Operate_EquipSuitCompose.CheckEquipSuitReduce(curPlayer, equipIndex)  | 
|         EventShell.EventRespons_EquipStar(curPlayer)  | 
| #===============================================================================  | 
| #        #destItemPlace = Ð¶ÏÂÎïÆ·µÄλÖà         | 
| #        destItemPlace = curPack.GetAt(packIndex)  | 
| #          | 
| #        if destItemPlace == None or destItemPlace.IsEmpty() == 0:  | 
| #            #жÏÂÄ¿±ê²»ÊÇ¿ÕµÄ  | 
| #            GameWorld.Log("жÏÂÄ¿±ê²»ÊǿյÄ")  | 
| #            return  | 
| #          | 
| #        destItemPlace.PutIn(curEquip)  | 
| #===============================================================================  | 
|         return equipID, equipIndex  | 
|       | 
|     #ÊÇ·ñÄÜ·ÅÈëÎïÆ·(µÚ¼¸¸öÎïÆ·À¸, ÎïÆ·ÐòºÅ, ·ÅÈëµÄÎïÆ·, ·ÅÈëÎïÆ·ID,  ÎïÆ·ÊÇ·ñ°ó¶¨)  | 
| #===============================================================================  | 
| #    ´Ë´¦´úÂë¸Ä¶¯ÇëÉ÷ÖØ  | 
| #    Ð¡ÐÄ, Ð¡ÐÄ, Ð¡ÐÄ, Ð¡ÐÄ, Ð¡ÐÄ  | 
| #    eggxp  | 
| #===============================================================================  | 
|     def PutItemInVPack(self, packIndex, tagItem, event=["", False, {}]):  | 
|         # ÐéÄâ±³°ü, Ä¬Èϲ»×öµþ¼Ó  | 
|         curPlayer = self.__Player  | 
|         canPutInCnt = 1  | 
|         setItemKeyData = 0  | 
|         eventName, isForceEvent, addDict = event  | 
|         isNeedRecord = isForceEvent or ItemNeedRecord(tagItem)  | 
|         if packIndex == ShareDefine.rptRune:  | 
|             runeSource = tagItem.GetUserAttr(ShareDefine.Def_IudetRuneSource) or 1  | 
|             setItemKeyData = GetRuneItemKeyData(tagItem.GetItemTypeID(), tagItem.GetUserAttr(ShareDefine.Def_IudetRuneLV), source=runeSource)  | 
|   | 
|         refreshPlaceList = []  | 
|         for place in xrange(ItemCommon.GetVPackCnt(packIndex)):  | 
|             itemKeyData = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_VPackItem % (packIndex, place))  | 
|             if itemKeyData:  | 
|                 continue  | 
|               | 
|             if isNeedRecord:  | 
|                 itemNoteDict = ItemCommon.GetItemNoteDict(tagItem, canPutInCnt)  | 
|                 noteDict = {"packIndex":packIndex, "packPlace":place, "ItemKeyData":setItemKeyData, "eventName":eventName}  | 
|                 noteDict.update(addDict)  | 
|                 ItemCommon.DR_GetItem(curPlayer, packIndex, "VPack_%s" % packIndex if not eventName else eventName, itemNoteDict, noteDict)  | 
|               | 
|             refreshPlaceList.append(place)  | 
|             PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_VPackItem % (packIndex, place), setItemKeyData)  | 
|             if tagItem.GetCount() > canPutInCnt:  | 
|                 SetItemCount(tagItem, tagItem.GetCount() - canPutInCnt)  | 
|             else:  | 
|                 tagItem.Clear()  | 
|                 break  | 
|               | 
|         #֪ͨ¿Í»§¶Ë  | 
|         if refreshPlaceList:  | 
|             Sync_VPackItem_Refresh(curPlayer, packIndex, refreshPlaceList)  | 
|   | 
|         if tagItem and not tagItem.IsEmpty():  | 
|             #tagItem.Clear()  | 
|             return False  | 
|         return True  | 
|       | 
|     def DoTransformItem(self, curPlayer, tagItem):  | 
|         ## ½«ÌØÊâÎïÆ·×ª»¯Îª¶ÔÓ¦ÊýÖµ  | 
|         itemID = tagItem.GetItemTypeID()  | 
|         if itemID not in ChConfig.Def_TransformItemIDList:  | 
|             return False  | 
|         itemCount = max(tagItem.GetUserAttr(ShareDefine.Def_IudetItemCount), tagItem.GetCount())  | 
|           | 
|         if itemID == ChConfig.Def_ItemID_FamilyContribution:  | 
|             PlayerFamily.AddPlayerFamilyActiveValue(curPlayer, itemCount, True, ShareDefine.Def_AddFAVReason_UseItem, True)  | 
|         elif itemID == ChConfig.Def_ItemID_SilverMoney:  | 
|             PlayerControl.GiveMoney(curPlayer, IPY_GameWorld.TYPE_Price_Silver_Money, itemCount)  | 
|         elif itemID == ChConfig.Def_ItemID_FamilyActive:  | 
|             PlayerControl.GiveMoney(curPlayer, ShareDefine.TYPE_Price_FamilyActivity, itemCount)  | 
|         elif itemID == ChConfig.Def_ItemID_SP:  | 
|             PlayerControl.PlayerAddZhenQi(curPlayer, itemCount)  | 
|         elif itemID == ChConfig.Def_ItemID_GoldPaper:  | 
|             PlayerControl.GiveMoney(curPlayer, IPY_GameWorld.TYPE_Price_Gold_Paper, itemCount)  | 
|         elif itemID == ChConfig.Def_ItemID_RealmPoint:  | 
|             PlayerControl.GiveMoney(curPlayer, ShareDefine.TYPE_Price_RealmPoint, itemCount)  | 
|         elif itemID == ChConfig.Def_ItemID_BossReborn:  | 
|             msgStr = str(itemCount)  | 
|             GameWorld.GetPlayerManager().GameServer_QueryPlayerResult(0, 0, 0, 'AddBossRebornPoint', msgStr, len(msgStr))  | 
|         elif itemID == ChConfig.Def_ItemID_Ysog:  | 
|             PlayerControl.GiveMoney(curPlayer, ShareDefine.TYPE_Price_Ysog, itemCount)  | 
|           | 
|         return True  | 
|       | 
|     ## ·ÅÈëÎïÆ·   | 
|     #  @param packIndex ±³°üË÷Òý  | 
|     #  @param tagItem ÎïÆ·  | 
|     #  @param defaultPile Ä¬ÈÏÊÇ·ñÏÈÅжÏÄÜ·ñ¶Ñµþ  | 
|     #  @return True or False  | 
|     #  @remarks º¯ÊýÏêϸ˵Ã÷.  | 
|     def PutInItem(self, packIndex, tagItem, defaultPile=True, event=["", False, {}]):  | 
|         curPlayer = self.__Player  | 
|           | 
|         isEquip = ItemCommon.CheckItemIsEquip(tagItem)  | 
|         if isEquip:  | 
|             defaultPile = False # ×°±¸Ä¬Èϲ»Åж϶ѵþ  | 
|               | 
|         curItemData = GameWorld.GetGameData().GetItemByTypeID(tagItem.GetItemTypeID())  | 
|         if not curItemData:  | 
|             return False  | 
|           | 
|         packIndex = ChConfig.GetItemPackType(curItemData.GetType(), packIndex)  | 
|           | 
|         if not self.CanPutInItem(packIndex, tagItem.GetItemTypeID(), GetItemCount(tagItem), tagItem.GetIsBind(), defaultPile):  | 
|             GameWorld.DebugLog("±³°üÂú£¬²»ÄÜ·ÅÈëÎïÆ· count = %d"%GetItemCount(tagItem))  | 
|             tagItem.Clear()  | 
|             return False  | 
|           | 
|         itemID = tagItem.GetItemTypeID()  | 
|         if itemID in ChConfig.Def_TransformItemIDList:  | 
|             # Ö±½Óת»¯Îª¶ÔÓ¦»õ±ÒµÄÎïÆ·½öÔÚ·ÅÈë±³°üʱֱ½Óת»¯£¬·ñÔò»¹ÊÇÒÔÕæÊµÎïÆ·µÄÐÎʽ´æÔÚ£¬µ«¶ÑµþÉÏÏÞÐèÒª×öÌØÊâ´¦Àí  | 
|             if packIndex == IPY_GameWorld.rptItem:  | 
|                 self.DoTransformItem(curPlayer, tagItem)  | 
|                 tagItem.Clear() # ÐèÇå³ý£¬²»È»»áµ¼ÖÂÄÚ´æÐ¹Â¶  | 
|                 return True  | 
|             defaultPile = True  | 
|             maxPackCount = ChConfig.Def_UpperLimit_DWord # ×ª»¯ÎïÆ·µþ¼ÓÉÏÏÞ²»È¡ÎïÆ·±íµÄ, Ôݶ¨¶ÑµþÉÏÏÞ20ÒÚ  | 
|         else:  | 
|             maxPackCount = curItemData.GetPackCount()  | 
|               | 
|         # ÐéÄâ±³°ü, Ä¬Èϲ»×öµþ¼Ó  | 
|         if packIndex in ShareDefine.Def_VPack_TypeList:  | 
|             return self.PutItemInVPack(packIndex, tagItem, event)  | 
|           | 
|         eventName, isForceEvent, addDict = event  | 
|   | 
|         #¼Ç¼´´½¨ÎïÆ·Ê±µÄµÇ¼Ìì  | 
|         if tagItem.GetItemTypeID() in ReadChConfig.GetEvalChConfig('OpenBoxByLoginDayCfg'):  | 
|             if tagItem.GetUserAttr(ShareDefine.Def_IudetCreateItemLoginDay) == 0:#ûÓÐÉèÖùý²ÅÉèÖà  | 
|                 tagItem.SetUserAttr(ShareDefine.Def_IudetCreateItemLoginDay, curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_LoginDayCnt))  | 
|           | 
|         curPack = self.__PlayerItemManager.GetPack(packIndex)  | 
|         #itemFactory = GameWorld.GetItemFactory()  | 
|         isBind = tagItem.GetIsBind()  | 
|         isNeedRecord = False  | 
|         # Ä¿Ç°ÔÝÖ»¼Ç¼·ÅÈë±³°üµÄ  | 
|         if packIndex in [IPY_GameWorld.rptItem, ShareDefine.rptTreasure, ShareDefine.rptRune]:  | 
|             isNeedRecord = ItemNeedRecord(tagItem) or isForceEvent  | 
|         putResult = False  | 
|           | 
|         #ĬÈÏÏȽøÐÐÎïÆ·¶Ñµþ  | 
|         if defaultPile:  | 
|             #Ïȶѵþ, ÔÙ·ÅÔÚ¿ÕλÖà  | 
|             #########################Åж϶ѵþ  | 
|             for i in xrange(0, curPack.GetCount()):  | 
|                 item = curPack.GetAt(i)  | 
|                 if item.IsEmpty() == True:  | 
|                     continue  | 
|       | 
|                 if (item.IsEmpty() == 0 and not CanPackItem(item, tagItem)):  | 
|                     continue  | 
|                 #¸ÃÎïÆ·Ëø¶¨²»Ö´ÐÐ==============================================  | 
|                 if item.GetIsLocked() == True:  | 
|                     continue  | 
|                   | 
|                 packItemCount = GetItemCount(item)  | 
|                 curItemCount = GetItemCount(tagItem)  | 
|                 canPutinCount = maxPackCount - packItemCount  | 
|                 if canPutinCount <= 0:  | 
|                     continue      | 
|                 #¿ÉÒÔ°Ú·Å  | 
|                 #¿É¶Ñµþ  | 
|                 if curItemCount > canPutinCount:                          | 
|                     updCount = packItemCount + canPutinCount  | 
|                     SetItemCount(item, updCount)  | 
|                     SetItemCount(tagItem, curItemCount - canPutinCount)  | 
|                       | 
|                     if isNeedRecord:  | 
|                         itemNoteDict = ItemCommon.GetItemNoteDict(item, canPutinCount, packItemCount, updCount)  | 
|                         ItemCommon.DR_GetItem(curPlayer, packIndex, eventName, itemNoteDict, addDict)  | 
|                 else:  | 
|                     updCount = packItemCount + curItemCount  | 
|                     #¿ÉÒÔÍêÈ«¶Ñµþ  | 
|                     SetItemCount(item, updCount)  | 
|                     tagItem.Clear()  | 
|                     putResult = True  | 
|                       | 
|                     if isNeedRecord:  | 
|                         itemNoteDict = ItemCommon.GetItemNoteDict(item, curItemCount, packItemCount, updCount)  | 
|                         ItemCommon.DR_GetItem(curPlayer, packIndex, eventName, itemNoteDict, addDict)  | 
|                           | 
|                     break  | 
|           | 
|         if putResult == True:  | 
|             #GameWorld.Log("ÒѾ³É¹¦·ÅÈë")  | 
|             #ÒѾ³É¹¦·ÅÈë  | 
|             return True  | 
|         ##########################ÅжϷÅÔÚ¿ÕλÖà  | 
|         for i in xrange(0, curPack.GetCount()):  | 
|             item = curPack.GetAt(i)  | 
|             if item.IsEmpty() != True:  | 
|                 continue  | 
|               | 
|             packItemCount = GetItemCount(item) # Îª0  | 
|             curItemCount = GetItemCount(tagItem)  | 
|             canPutinCount = maxPackCount - packItemCount  | 
|             if canPutinCount <= 0:  | 
|                 continue  | 
|             #¿ÉÒÔ°Ú·Å  | 
|             if curItemCount > canPutinCount:  | 
|                 #ÐèÒª´´½¨ÐÂÎïÆ··ÅÈë  | 
|                 curCreateItem = ItemCommon.CreateSingleItem(tagItem.GetItemTypeID())  | 
|                 #×¢Òâ: ²»ÄÜÔÚÕâÀïAssignItem, ·ñÔò»áÓÐ2¸öÎïÆ·Ö¸ÕëÖ¸Ïòͬһ¸öÎïÆ·ÊµÀý . ¾Þ´óµÄ´íÎóÔÚÕâÒ»¾ä : curCreateItem.Assign(tagItem)  | 
|                 SetItemCount(curCreateItem, canPutinCount)  | 
|                 SetItemIsBind(curCreateItem, isBind)  | 
|                 #´Ë´¦²»×ö×°±¸²ð½â£¬ÈçÓÐÐèÇóÍâ´«for´¦Àí  | 
|                   | 
|                 item.AssignItem(curCreateItem)  | 
|                 SetItemCount(tagItem, curItemCount - canPutinCount)  | 
|                   | 
|                 if isNeedRecord:  | 
|                     itemNoteDict = ItemCommon.GetItemNoteDict(item, canPutinCount, packItemCount, canPutinCount)  | 
|                     ItemCommon.DR_GetItem(curPlayer, packIndex, eventName, itemNoteDict, addDict)  | 
|             else:  | 
|                 #¿ÉÒÔ·ÅÏÂ  | 
|                 if isEquip:  | 
|                     self.CheckEquipAttr(packIndex, tagItem)  | 
|                       | 
|                 if tagItem.GetGameWorldItemType() == IPY_GameWorld.gwitRoleItem:  | 
|                     item.PutIn(tagItem)  | 
|                 elif tagItem.GetGameWorldItemType() == IPY_GameWorld.gwitSingleItem:  | 
|                     item.AssignItem(tagItem)  | 
|                 else:  | 
|                     GameWorld.Log("ÎïÆ· = %s·ÅÈë´íÎó" % (tagItem.GetItemTypeID()) , curPlayer.GetPlayerID())  | 
|                 putResult = True  | 
|                   | 
|                 if isNeedRecord:  | 
|                     itemNoteDict = ItemCommon.GetItemNoteDict(item, curItemCount, packItemCount, GetItemCount(item))  | 
|                     ItemCommon.DR_GetItem(curPlayer, packIndex, eventName, itemNoteDict, addDict)  | 
|                 break  | 
|                                                   | 
|         #·ÅÈë¶«Î÷  | 
|         return putResult  | 
|       | 
|     def CheckEquipAttr(self, packType, curItem):  | 
|         legendAttrIDCount = curItem.GetUserAttrCount(ShareDefine.Def_IudetLegendAttrID)  | 
|         legendAttrValueCount = curItem.GetUserAttrCount(ShareDefine.Def_IudetLegendAttrValue)  | 
|           | 
|         if legendAttrIDCount and legendAttrValueCount and legendAttrIDCount == legendAttrValueCount:  | 
|             return  | 
|           | 
|         legendAttrInfo = GetAddEquipLegendAttr(curItem)  | 
|         if not legendAttrInfo:  | 
|             return  | 
|           | 
|         curPlayer = self.__Player  | 
|         srcScore = ItemCommon.GetEquipGearScore(curItem)  | 
|         legendAttrIDList, legendAttrValueList = legendAttrInfo  | 
|         curItem.ClearUserAttr(ShareDefine.Def_IudetLegendAttrID)  | 
|         curItem.ClearUserAttr(ShareDefine.Def_IudetLegendAttrValue)  | 
|         for i in xrange(len(legendAttrIDList)):  | 
|             curItem.AddUserAttr(ShareDefine.Def_IudetLegendAttrID, legendAttrIDList[i])  | 
|             curItem.AddUserAttr(ShareDefine.Def_IudetLegendAttrValue, legendAttrValueList[i])  | 
|         ItemCommon.MakeEquipGS(curItem)  | 
|         updScore = ItemCommon.GetEquipGearScore(curItem)  | 
|         GameWorld.ErrLog("´«ÆæÊôÐÔÒì³££¬ÖØÐÂË¢ÐÂÒ»´ÎÊôÐÔ: packType=%s,itemID=%s,legendAttrIDList=%s,legendAttrValueList=%s,srcScore=%s,updScore=%s"   | 
|                          % (packType, curItem.GetItemTypeID(), legendAttrIDList, legendAttrValueList, srcScore, updScore), curPlayer.GetPlayerID())  | 
|         return  | 
|       | 
|     def CheckRolePackEquipAttr(self):  | 
|         curPlayer = self.__Player  | 
|         key = "LoginCheckEquipAttr"  | 
|         if curPlayer.NomalDictGetProperty(key):  | 
|             return  | 
|         checkPackList = [IPY_GameWorld.rptEquip, IPY_GameWorld.rptItem, IPY_GameWorld.rptWarehouse]  | 
|         for packType in checkPackList:  | 
|             curPack = curPlayer.GetItemManager().GetPack(packType)  | 
|             for i in xrange(curPack.GetCount()):  | 
|                 curItem = curPack.GetAt(i)  | 
|                 #GameWorld.DebugLog("packType=%s,i=%s" % (packType, i))  | 
|                 if curItem.IsEmpty():  | 
|                     continue  | 
|                 isEquip = ItemCommon.CheckItemIsEquip(curItem)  | 
|                 if not isEquip:  | 
|                     continue  | 
|                 self.CheckEquipAttr(packType, curItem)  | 
|         PlayerControl.NomalDictSetProperty(curPlayer, key, 1)  | 
|         return  | 
|   | 
|     ## ÊÇ·ñÄÜ·ÅÈëÎïÆ·   | 
|     #  @param packIndex ±³°üË÷Òý  | 
|     #  @param curItemID µ±Ç°ÎïÆ·ID  | 
|     #  @param curItemCount µ±Ç°ÎïÆ·ÊýÁ¿  | 
|     #  @param isBind ÊÇ·ñ°ó¶¨  | 
|     #  @param defaultPile Ä¬ÈÏÏÈÅжÏÊÇ·ñÄܽøÐÐÎïÆ·¶Ñµþ  | 
|     #  @return True or False  | 
|     #  @remarks º¯ÊýÏêϸ˵Ã÷.  | 
|     def CanPutInItem(self, packIndex, curItemID, curItemCount, isBind, defaultPile=True):  | 
|         checkRet, putIndex = self.CanPutInItemEx(packIndex, curItemID, curItemCount, isBind, defaultPile)  | 
|         return checkRet  | 
|       | 
|     ## ÊÇ·ñÄÜ·ÅÈëÎïÆ·   | 
|     #  @param packIndex ±³°üË÷Òý  | 
|     #  @param curItemID µ±Ç°ÎïÆ·ID  | 
|     #  @param curItemCount µ±Ç°ÎïÆ·ÊýÁ¿  | 
|     #  @param isBind ÊÇ·ñ°ó¶¨  | 
|     #  @param defaultPile Ä¬ÈÏÏÈÅжÏÊÇ·ñÄܽøÐÐÎïÆ·¶Ñµþ  | 
|     #  @return True or False, µÚÒ»¸ö¿É·ÅÈëµÄλÖà  | 
|     #  @remarks º¯ÊýÏêϸ˵Ã÷.  | 
|     def CanPutInItemEx(self, packIndex, curItemID, curItemCount, isBind, defaultPile=True):  | 
|         gameData = GameWorld.GetGameData()  | 
|         curItemData = gameData.GetItemByTypeID(curItemID)  | 
|           | 
|         if curItemData == None :  | 
|             GameWorld.Log("ÕÒ²»µ½ItemID = %d" % curItemID)  | 
|             return False, 0   | 
|           | 
|         if curItemID in ChConfig.Def_TransformItemIDList:  | 
|             # »õ±ÒÖ±½Óת»»µÄÎïÆ·Èç¹ûÊÇ·ÅÈë±³°üµÄÔòÖ±½Óת»¯£¬ÎÞÐèÔÝÓøñ×Ó  | 
|             if packIndex == IPY_GameWorld.rptItem:  | 
|                 return True, 0  | 
|             maxPackCount = ChConfig.Def_UpperLimit_DWord # ×ª»¯ÎïÆ·µþ¼ÓÉÏÏÞ²»È¡ÎïÆ·±íµÄ, Ôݶ¨¶ÑµþÉÏÏÞ20ÒÚ  | 
|         else:  | 
|             maxPackCount = curItemData.GetPackCount()  | 
|               | 
|         if maxPackCount == 0:  | 
|             GameWorld.Log("²ß»®Ìî±í´íÎó %s -> maxPackCount = %s" % (curItemID , maxPackCount))  | 
|             return False, 0  | 
|           | 
|         # ÌØÊâ´¦Àí²»Í¬µÄÎïÆ··ÅÈ벻ͬµÄ±³°ü£¬ÈçÉñÊÞ±³°ü  | 
|         packIndex = ChConfig.GetItemPackType(curItemData.GetType(), packIndex)  | 
|           | 
|         maxCanPutItem = 0  | 
|         curPlayer = self.__Player  | 
|         # ÐéÄâ±³°ü  | 
|         if packIndex in ShareDefine.Def_VPack_TypeList:  | 
|             # ÐéÄâ±³°ü²»×ö¶ÑµþÖ§³Ö  | 
|             for place in xrange(ItemCommon.GetVPackCnt(packIndex)):  | 
|                 itemKeyData = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_VPackItem % (packIndex, place))  | 
|                 if itemKeyData:  | 
|                     continue  | 
|                 maxCanPutItem += 1  | 
|                 if maxCanPutItem >= curItemCount:  | 
|                     return True, place  | 
|             return False, 0  | 
|           | 
|         itemIndex = -1  | 
|         curPack = self.__PlayerItemManager.GetPack(packIndex)  | 
|         for i in xrange(curPack.GetCount()):  | 
|             item = curPack.GetAt(i)  | 
|   | 
|             if item.IsEmpty():  | 
|                 maxCanPutItem += maxPackCount  | 
|                 if itemIndex == -1:  | 
|                     itemIndex = i  | 
|             else:  | 
|                 #Èç¹ûÐèÒªÅжϿɶѵþ  | 
|                 if defaultPile:  | 
|                     if item.GetIsLocked():  | 
|                         continue  | 
|       | 
|                     if (CanPackItemByItemType(item.GetItemTypeID(), item.GetIsBind(), curItemID, isBind) and  | 
|                         maxPackCount > GetItemCount(item)):  | 
|                         #¸ÃÎïÆ·Ëø¶¨²»Ö´ÐÐ==============================================  | 
|                         #¿É¶Ñµþ  | 
|                         maxCanPutItem += maxPackCount - GetItemCount(item)  | 
|                         if itemIndex == -1:  | 
|                             itemIndex = i  | 
|               | 
|             if maxCanPutItem >= curItemCount:  | 
|                 return True, itemIndex  | 
|               | 
|         if maxCanPutItem < curItemCount:  | 
|             return False, 0  | 
|         return True, itemIndex  | 
|       | 
| #==============================================================================  | 
| # ·ûÓ¡ÎïÆ·´æ´¢×ÖµäÊýÖµÊý¾Ý½á¹¹: Ç°5λΪÎïÆ·ID, 6~8λΪǿ»¯µÈ¼¶, µÚ9λΪÀ´Ô´£¨ÀϺÅ0,ĬÈÏ1£¬ºÏ³É2£©,µÚ10λΪÊÇ·ñËø¶¨  | 
| def GetRuneItemKeyData(itemID, RuneLV, lockState=0, source=1):  | 
|     lockState = 1 if lockState > 0 else 0  | 
|     return lockState * 1000000000 + source * 100000000 + min(RuneLV, 999) * 100000 + itemID  | 
| def GetRuneItemID(keyData): return keyData % 100000  | 
| def GetRuneItemPlusLV(keyData): return keyData % 100000000 / 100000  | 
| def GetRuneItemIsLock(keyData): return keyData / 1000000000  | 
| def GetRuneItemSource(keyData): return keyData % 1000000000 / 100000000  | 
| def IsRuneItemNeedRecord(curItem, plusLV):  | 
|     return plusLV > 0 or curItem.GetItemColor() >= ChConfig.Def_Quality_Orange  | 
|   | 
| def SetVPackItemKeyData(curPlayer, packIndex, place, keyData, isSync=True):  | 
|     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_VPackItem % (packIndex, place), keyData)  | 
|     if isSync:  | 
|         if keyData > 0:  | 
|             Sync_VPackItem_Refresh(curPlayer, packIndex, [place])  | 
|         else:  | 
|             Sync_VPackItem_Clear(curPlayer, packIndex, [place])  | 
|     return  | 
|   | 
| def Sync_VPackItem_Refresh(curPlayer, packIndex, placeList=[]):  | 
|     if not placeList:  | 
|         placeList = xrange(ItemCommon.GetVPackCnt(packIndex))  | 
|     vpackRefresh = ChPyNetSendPack.tagMCVPackRefresh()  | 
|     vpackRefresh.Clear()  | 
|     vpackRefresh.PackType = packIndex  | 
|     for place in placeList:  | 
|         itemKeyData = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_VPackItem % (packIndex, place))  | 
|         if not itemKeyData:  | 
|             # ¿ÕÎïÆ·²»Í¨Öª  | 
|             continue  | 
|         vpackItem = ChPyNetSendPack.tagMCVPackItem()  | 
|         vpackItem.Clear()  | 
|         vpackItem.ItemPlace = place  | 
|         vpackItem.ItemData = itemKeyData  | 
|         vpackRefresh.VPacklItemList.append(vpackItem)  | 
|     vpackRefresh.Count = len(vpackRefresh.VPacklItemList)  | 
|     NetPackCommon.SendFakePack(curPlayer, vpackRefresh)  | 
|     return  | 
|   | 
| def Sync_VPackItem_Clear(curPlayer, packIndex, placeList):  | 
|     if not placeList:  | 
|         return  | 
|     vpackClear = ChPyNetSendPack.tagMCVPackClear()  | 
|     vpackClear.Clear()  | 
|     vpackClear.PackType = packIndex  | 
|     vpackClear.ItemPlaceList = placeList  | 
|     vpackClear.Count = len(vpackClear.ItemPlaceList)  | 
|     NetPackCommon.SendFakePack(curPlayer, vpackClear)  | 
|     return  | 
|   | 
| #// A3 09 ×ªÒÆÎïÆ·µ½ÆäËû±³°ü #tagCMDropItemToOtherPack  | 
| #  | 
| #struct tagCMDropItemToOtherPack  | 
| #{  | 
| #    tagHead         Head;  | 
| #    BYTE        SrcBackpack;    //Ô´±³°üÀàÐÍ  | 
| #    BYTE        DesBackPack;    //Ä¿±ê±³°üÀàÐÍ  | 
| #    WORD        SrcIndex;        //×ªÒÆÎïÆ·Ë÷ÒýλÖ㻵±È«²¿×ªÒÆÊ±´ËÖµÎÞЧ  | 
| #    BYTE        IsAll;        //ÊÇ·ñÈ«²¿×ªÒÆ          | 
| #};  | 
| def OnDropItemToOtherPack(index, clientData, tick):      | 
|     curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)  | 
|     DropItemToOtherPack(curPlayer, clientData.SrcBackpack, clientData.DesBackPack, clientData.SrcIndex, clientData.IsAll)  | 
|     return  | 
|   | 
| def DropItemToOtherPack(curPlayer, fromPackIndex, desPackIndex, index, isAll=False):  | 
|     '''Í϶¯Ä³¸ö±³°üÎïÆ·µ½Íæ¼ÒÎïÆ·±³°ü  | 
|     '''  | 
|     movePack = curPlayer.GetItemManager().GetPack(fromPackIndex)  | 
|     if not movePack:  | 
|         return  | 
|       | 
|     itemControl = PlayerItemControler(curPlayer)  | 
|       | 
|     #Õû¸ö±³°ü×ªÒÆ  | 
|     if isAll:  | 
|         fullPackList = []  | 
|         for itemIndex in xrange(movePack.GetCount()):  | 
|             curItem = movePack.GetAt(itemIndex)  | 
|             if not curItem or curItem.IsEmpty():  | 
|                 continue  | 
|             toPackIndex = ChConfig.GetItemPackType(curItem.GetType(), desPackIndex)  | 
|             if toPackIndex in fullPackList:  | 
|                 continue  | 
|             if not __DoDropItemToOtherPack(curPlayer, itemControl, fromPackIndex, toPackIndex, itemIndex, curItem):  | 
|                 if toPackIndex not in fullPackList:  | 
|                     fullPackList.append(toPackIndex)  | 
|                       | 
|         for fullPackIndex in fullPackList:  | 
|             PlayerControl.NotifyCode(curPlayer, "GeRen_chenxin_676165", [fullPackIndex])  | 
|               | 
|     #µ¥¸öÎïÆ·×ªÒÆ  | 
|     else:  | 
|         curItem = movePack.GetAt(index)  | 
|         if not curItem or curItem.IsEmpty():  | 
|             return  | 
|         toPackIndex = ChConfig.GetItemPackType(curItem.GetType(), desPackIndex)  | 
|         __DoDropItemToOtherPack(curPlayer, itemControl, fromPackIndex, toPackIndex, index, curItem)  | 
|     return  | 
|   | 
| def __DoDropItemToOtherPack(curPlayer, itemControl, fromPackIndex, toPackIndex, itemIndex, curItem):  | 
|     if itemControl.DoTransformItem(curPlayer, curItem):  | 
|         curItem.Clear()  | 
|         return True  | 
|     curItemTypeID = curItem.GetItemTypeID()  | 
|     #curItemGUID = curItem.GetGUID()  | 
|     curItemCount = curItem.GetCount()  | 
|     curItemIsBind = curItem.GetIsBind()  | 
|     #toPackIndex = ChConfig.GetItemPackType(curItem.GetType(), toPackIndex)  | 
|       | 
|     # ³£¹æÎïÆ·×ªÒÆµ½ÐéÄâ·ûÓ¡±³°ü  | 
|     if toPackIndex == ShareDefine.rptRune:  | 
|         if not ItemCommon.CheckPackHasSpace(curPlayer, toPackIndex, True):  | 
|             return False  | 
|         return itemControl.PutItemInVPack(toPackIndex, curItem)  | 
|       | 
|     checkRet, putIndex = itemControl.CanPutInItemEx(toPackIndex, curItemTypeID, curItemCount, curItemIsBind)  | 
|     if not checkRet:  | 
|         return False  | 
|     return DragItem(curPlayer, fromPackIndex, itemIndex, toPackIndex, putIndex, curItemCount)  | 
|   | 
| ## ±³°üÖØÕû  | 
| #  @param curPlayer µ±Ç°Íæ¼Ò  | 
| #  @param packIndex ±³°üË÷Òý  | 
| #  @param beingIndex ¿ªÊ¼Î»ÖÃË÷Òý  | 
| #  @param endIndex ½áÊøÎ»ÖÃË÷Òý  | 
| #  @param tick µ±Ç°Ê±¼ä  | 
| #  @return None  | 
| #  @remarks º¯ÊýÏêϸ˵Ã÷.  | 
| def __DoResetItem(curPlayer, packIndex, beingIndex, endIndex, tick):  | 
|     #ÅжϿÉÒÔÕûÀíÎïÆ·µÄ״̬  | 
|     if curPlayer.GetPlayerAction() not in ChConfig.Def_Player_ResetItem_State:  | 
|         PlayerControl.NotifyCode(curPlayer, "GeRen_liubo_254483")  | 
|         #GameWorld.Log("µ±Ç°×´Ì¬ÎÞ·¨ÕûÀí±³°ü")  | 
|         return  | 
|           | 
|     # ÎÞÖ±½Ó½»Ò×  | 
|     #===========================================================================  | 
|     # if curPlayer.GetPlayerAction() == IPY_GameWorld.paEvent:  | 
|     #    #Èç¹ûÍæ¼ÒÔÚʼþÖÐ, ÌØÊâÔÙ´ÎÅж¨  | 
|     #    if curPlayer.GetForbiddenResetItem() != 0:  | 
|     #        PlayerControl.NotifyCode(curPlayer, "GeRen_liubo_254483")  | 
|     #        return  | 
|     #===========================================================================  | 
|       | 
|     curPack = curPlayer.GetItemManager().GetPack(packIndex)  | 
|     if curPack == None:  | 
|         #GameWorld.Log("ÖØÕû±³°üÀàÐͲ»¶Ô")  | 
|         return  | 
|       | 
|     #¼ì²éÊÇ·ñÄÜÕûÀí  | 
|     for i in range(0, curPack.GetCount()):  | 
|         curItem = curPack.GetAt(i)  | 
|         if curItem.GetIsLocked():  | 
|             #GameWorld.Log("ÎïÆ·ÓÐËø, ²»ÔÊÐíÖØÕû")  | 
|             return  | 
|       | 
|     # ÕûÀí·½Ê½²»Í¬Çø·Ö  | 
|     if packIndex == IPY_GameWorld.rptWarehouse:  | 
|         #ÑéÖ¤¼ä¸ô  | 
|         if tick - curPlayer.GetTickByType(ChConfig.TYPE_Player_Tick_WareHouseSort) < \  | 
|                 ChConfig.TYPE_Player_Tick_Time[ChConfig.TYPE_Player_Tick_WareHouseSort]:  | 
|             #ûµ½¼ä¸ô  | 
|             #GameWorld.DebugLog("ÖØÕû²Ö¿âʱ¼ä¼ä¸ôÌ«¶Ì")  | 
|             return  | 
|         curPlayer.SetTickByType(ChConfig.TYPE_Player_Tick_WareHouseSort, tick)  | 
|         ResetWareHouse(curPlayer, curPack, beingIndex, endIndex)  | 
|     else:  | 
|         if tick - curPlayer.GetResetItemTick() <= ChConfig.Def_ItemPackResetInterval:  | 
|             #GameWorld.DebugLog("ÖØÕû±³°üʱ¼ä¼ä¸ôÌ«¶Ì")  | 
|             return  | 
|           | 
|         curPlayer.SetResetItemTick(tick)  | 
|           | 
|         ResetRolePack(curPlayer, curPack, beingIndex, endIndex)  | 
|     #curPack.ResetPack(beingIndex, endIndex)    #C++°æ±³°üÕûÀí  | 
|     curPack.Sync_Refresh()  | 
|     return  | 
|      | 
| ## ±³°üÕûÀí  | 
| def ResetItem(curPlayer, packIndex, beingIndex, endIndex, tick):  | 
|   | 
|     #¿ªÊ¼ÕûÀí  | 
|     __DoResetItem(curPlayer, packIndex, beingIndex, endIndex, tick)  | 
|     curPlayer.Notify_PackResetOK()  | 
|     return  | 
|   | 
|   | 
| def ResetWareHouse(curPlayer, curPack, beingIndex, endIndex):  | 
|     itemDict = {}   # ID£º[[Ë÷Òý1£¬ÊýÁ¿1]£¬ [Ë÷Òý2£¬ÊýÁ¿2]]  | 
|       | 
|     # 1.ÏȱéÀúÒ»´Îµþ¼ÓÊýÁ¿£¬2.ÔÙ±éÀúн¨×ֵ䴿·ÅÎïÆ·ÁÐ±í£¬3.ÔÙ¸ù¾Ýsort¹æÔòÅÅÐò  | 
|     #µþ¼Ó´¦Àí  | 
|     for i in range(beingIndex, endIndex + 1):  | 
|         curRoleItem = curPack.GetAt(i)  | 
|         if curRoleItem.IsEmpty():  | 
|             continue  | 
|         curItem = curRoleItem.GetItem()   | 
|         itemID = curRoleItem.GetItemTypeID()  | 
|         if itemID not in itemDict:  | 
|             itemDict[itemID] = []  | 
|           | 
|         __ResetItem_AddItemInList(itemDict[itemID], curItem)  | 
|   | 
|     itemList = []     | 
|     equipGSList = []  | 
|     #×éºÏÁÐ±í  | 
|     for tmpList in itemDict.values():  | 
|         for tmpItem in tmpList:  | 
|             if ItemCommon.CheckNoteEquipGS(tmpItem):  | 
|                 equipGSList.append(tmpItem)  | 
|             else:  | 
|                 itemList.append(tmpItem)  | 
|   | 
|     equipGSList.sort(__CmpWareHouseEquip)  | 
|     itemList.sort(__CmpRolePack)  | 
|   | 
| #===============================================================================  | 
| #    GameWorld.DebugLog("equipGSList")  | 
| #    for item in equipGSList:  | 
| #        GameWorld.DebugLog("%s-%s"%(item.GetName(), [item.GetCount(), item.GetLV(), ItemCommon.GetEquipGearScore(item),   | 
| #                                                               item.GetItemColor(), item.GetItemQuality(),  | 
| #                                                               item.GetType(), item.GetItemTypeID() ]))  | 
| #   | 
| #    GameWorld.DebugLog("itemList")  | 
| #    for item in itemList:  | 
| #        GameWorld.DebugLog("%s-%s"%(item.GetName(), [item.GetCount(), item.GetLV(), ItemCommon.GetEquipGearScore(item),   | 
| #                                                               item.GetItemColor(), item.GetItemQuality(),  | 
| #                                                               item.GetType(), item.GetItemTypeID() ]))  | 
| #===============================================================================  | 
|   | 
|     curPack.WipePack(beingIndex, endIndex)  | 
|     putPlace = beingIndex  | 
|   | 
|     for item in equipGSList:  | 
|         curPack.GetAt(putPlace).AssignItem(item, False)  | 
|         putPlace += 1  | 
|           | 
|     for item in itemList:  | 
|         curPack.GetAt(putPlace).AssignItem(item, False)  | 
|         putPlace += 1  | 
|           | 
|     return  | 
|   | 
| def __CmpWareHouseEquip(item1, item2):  | 
|     # ²Ö¿â ½×Êý¸ß-ÑÕÉ«¸ß-ÐÇÊý¸ß - ×°±¸ÀàÐÍ - ID£¬ÄÚ²ã±È½Ï ÔÝʱ²»×öʱ¼äÅÐ¶Ï  | 
|     # ½×Êý GetLV»ñµÃ  | 
|       | 
|     if item1.GetLV() == item2.GetLV():  | 
|       | 
|         if item1.GetItemColor() == item2.GetItemColor():  | 
|             if item1.GetItemQuality() == item2.GetItemQuality():  | 
|                 itemType1 = item1.GetType()  | 
|                 itemType2 = item2.GetType()  | 
|                 if itemType1 == itemType2:  | 
|                     return cmp(item1.GetItemTypeID(), item2.GetItemTypeID())  | 
|                 else:  | 
|                     #ÀàÐÍÓж¨ÒåÅäÖÃ˳Ðò  | 
|                     typeList = IpyGameDataPY.GetFuncEvalCfg("DepotSortPriority", 1)  | 
|                     if itemType1 in typeList and itemType2 in typeList:  | 
|                         return cmp(typeList.index(item1.GetType()), typeList.index(item2.GetType()))  | 
|                     elif itemType1 in typeList:  | 
|                         #ÅÅÔÚÇ°Ãæ  | 
|                         return -1  | 
|                     elif itemType2 in typeList:  | 
|                         return 1  | 
|                     else:  | 
|                         return cmp(itemType1, itemType2)  | 
|             else:  | 
|                 return cmp(0-item1.GetItemQuality(), 0-item2.GetItemQuality())  | 
|         else:  | 
|             return cmp(0-item1.GetItemColor(), 0-item2.GetItemColor())  | 
|     else:  | 
|         return cmp(0-item1.GetLV(), 0-item2.GetLV())  | 
|     return  | 
|   | 
|   | 
| def ResetRolePack(curPlayer, curPack, beingIndex, endIndex):  | 
|     itemDict = {}   # ID£º[[Ë÷Òý1£¬ÊýÁ¿1]£¬ [Ë÷Òý2£¬ÊýÁ¿2]]  | 
|       | 
|     # 1.ÏȱéÀúÒ»´Îµþ¼ÓÊýÁ¿£¬2.ÔÙ±éÀúн¨×ֵ䴿·ÅÎïÆ·ÁÐ±í£¬3.ÔÙ¸ù¾Ýsort¹æÔòÅÅÐò  | 
|     #µþ¼Ó´¦Àí  | 
|     for i in range(beingIndex, endIndex + 1):  | 
|         curRoleItem = curPack.GetAt(i)  | 
|         if curRoleItem.IsEmpty():  | 
|             continue  | 
|         curItem = curRoleItem.GetItem()   | 
|         itemID = curRoleItem.GetItemTypeID()  | 
|         if itemID not in itemDict:  | 
|             itemDict[itemID] = []  | 
|           | 
|         __ResetItem_AddItemInList(itemDict[itemID], curItem)  | 
|   | 
|     itemList = []   # ·Ç×°±¸ÆÕͨÎïÆ·  | 
|     equipGSGreaterList = [] # ÊôÓÚ±¾Ö°ÒµµÄ¸ßÆÀ·Ö×°±¸  | 
|     equipGSLesserList = []  # µÍÆÀ·Ö×°±¸ºÍ·Ç±¾Ö°Òµ  | 
|     runeItemList = []   # ·ûÓ¡  | 
|       | 
|     #EquipGSTypeForSort  | 
|     equipPack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptEquip)  | 
|     #×éºÏÁÐ±í  | 
|     for tmpList in itemDict.values():  | 
|         for tmpItem in tmpList:  | 
|             equipGS = 0  | 
|             cmpEquipGS = 0  | 
|   | 
|             if ItemCommon.CheckJob(curPlayer, tmpItem) and ItemCommon.CheckNoteEquipGS(tmpItem):  | 
|                 #ÐèÒª±È½ÏÆÀ·ÖµÄ×°±¸  | 
|                 equipGS = ItemCommon.GetEquipGearScore(tmpItem)  | 
|                 #²éÕÒµ±Ç°×°±¸±È½ÏGS  | 
|                 cmpItem = equipPack.GetAt(tmpItem.GetEquipPlace())  | 
|                 if ItemCommon.CheckNoteEquipGS(cmpItem):  | 
|                     cmpEquipGS = ItemCommon.GetEquipGearScore(cmpItem)  | 
|             elif ItemCommon.CheckNoteEquipGS(tmpItem):  | 
|                 #·Ç±¾Ö°Òµ»òÕß²»¿ÉÓõÄ×°±¸  | 
|                 equipGS = 1  | 
|                 cmpEquipGS = 2  | 
|                   | 
|             if tmpItem.GetType() in [ChConfig.Def_ItemType_Rune, ChConfig.Def_ItemType_RuneExp]:  | 
|                 runeItemList.append(tmpItem)  | 
|             elif equipGS == 0:  | 
|                 itemList.append(tmpItem)  | 
|             elif equipGS > cmpEquipGS:  | 
|                 equipGSGreaterList.append(tmpItem)  | 
|             else:  | 
|                 equipGSLesserList.append(tmpItem)  | 
|   | 
|     equipGSGreaterList.sort(__CmpRolePack)  | 
|     itemList.sort(__CmpRolePack)  | 
|     equipGSLesserList.sort(__CmpRolePack)  | 
|     runeItemList.sort(__CmpRolePack)  | 
|       | 
|     #===========================================================================  | 
|     # GameWorld.DebugLog("equipGSGreaterList")  | 
|     # for item in equipGSGreaterList:  | 
|     #    GameWorld.DebugLog("%s-%s"%(item.GetName(), [item.GetCount(), ItemCommon.GetEquipGearScore(item),   | 
|     #                                                           item.GetItemColor(), item.GetItemQuality(),  | 
|     #                                                           item.GetType(), item.GetItemTypeID() ]))  | 
|     #   | 
|     # GameWorld.DebugLog("itemList")  | 
|     # for item in itemList:  | 
|     #    GameWorld.DebugLog("%s-%s"%(item.GetName(), [item.GetCount(), ItemCommon.GetEquipGearScore(item),   | 
|     #                                                           item.GetItemColor(), item.GetItemQuality(),  | 
|     #                                                           item.GetType(), item.GetItemTypeID() ]))  | 
|     #   | 
|     # GameWorld.DebugLog("equipGSLesserList")  | 
|     # for item in equipGSLesserList:  | 
|     #    GameWorld.DebugLog("%s-%s"%(item.GetName(), [item.GetCount(), ItemCommon.GetEquipGearScore(item),   | 
|     #                                                           item.GetItemColor(), item.GetItemQuality(),  | 
|     #                                                           item.GetType(), item.GetItemTypeID() ]))  | 
|     #===========================================================================  | 
|       | 
|     curPack.WipePack(beingIndex, endIndex)  | 
|     putPlace = beingIndex  | 
|       | 
|     for item in equipGSGreaterList:  | 
|         curPack.GetAt(putPlace).AssignItem(item, False)  | 
|         putPlace += 1  | 
|           | 
|     for item in itemList:  | 
|         curPack.GetAt(putPlace).AssignItem(item, False)  | 
|         putPlace += 1  | 
|           | 
|     for item in equipGSLesserList:  | 
|         curPack.GetAt(putPlace).AssignItem(item, False)  | 
|         putPlace += 1  | 
|           | 
|     for item in runeItemList:  | 
|         curPack.GetAt(putPlace).AssignItem(item, False)  | 
|         putPlace += 1  | 
|           | 
|     return  | 
|   | 
|   | 
| def __CmpRolePack(item1, item2):  | 
|     # ×°±¸ÆÀ·Ö¸ß  ÆÀ·Ö0  ÆÀ·ÖµÍ£¬Íâ²ã·ÖÁÐ±í  | 
|     # ÑÕÉ«-ÐÇÊý - ×°±¸ÀàÐÍ - ID£¬ÄÚ²ã±È½Ï ÔÝʱ²»×öʱ¼äÅÐ¶Ï  | 
|       | 
|     if item1.GetItemColor() == item2.GetItemColor():  | 
|         if item1.GetItemQuality() == item2.GetItemQuality():  | 
|             itemType1 = item1.GetType()  | 
|             itemType2 = item2.GetType()  | 
|             if itemType1 == itemType2:  | 
|                 return cmp(item1.GetItemTypeID(), item2.GetItemTypeID())  | 
|             else:  | 
|                 #ÀàÐÍÓж¨ÒåÅäÖÃ˳Ðò  | 
|                 typeList = IpyGameDataPY.GetFuncEvalCfg("PackageSortPriority", 1)  | 
|                 if itemType1 in typeList and itemType2 in typeList:  | 
|                     return cmp(typeList.index(item1.GetType()), typeList.index(item2.GetType()))  | 
|                 elif itemType1 in typeList:  | 
|                     #ÅÅÔÚÇ°Ãæ  | 
|                     return -1  | 
|                 elif itemType2 in typeList:  | 
|                     return 1  | 
|                 else:  | 
|                     return cmp(itemType1, itemType2)  | 
|         else:  | 
|             return cmp(0-item1.GetItemQuality(), 0-item2.GetItemQuality())  | 
|     else:  | 
|         return cmp(0-item1.GetItemColor(), 0-item2.GetItemColor())  | 
|   | 
|   | 
| def __ResetItem_AddItemInList(curList, addItem):  | 
|     #°ÑÎïÆ··Åµ½ÁбíÖÐ, ÒªÅжϵþ¼Ó  | 
|     itemCount = addItem.GetCount()  | 
|     packCount = addItem.GetPackCount()  | 
|       | 
|   | 
|     for curItem in curList:  | 
|         curCount = curItem.GetCount()  | 
|           | 
|         if not CanPackItem(curItem, addItem) :  | 
|             continue  | 
|           | 
|         if curCount >= packCount:  | 
|             continue  | 
|         canPlaceCount = packCount - curCount  | 
|         if itemCount <= canPlaceCount:  | 
|             #¿ÉÒÔÈ«²¿·ÅÈë  | 
|             curItem.SetCount(itemCount + curCount)  | 
|             return  | 
|         curItem.SetCount(packCount)  | 
|         itemCount = itemCount - canPlaceCount  | 
|       | 
|     #      | 
|     if itemCount != 0:  | 
|         #·ÅÈ뵱ǰÎïÆ·  | 
|         addItem.SetCount(itemCount)  | 
|         curList.append(addItem)  | 
|    | 
|     return  | 
|   | 
|   | 
| #===============================================================================  | 
| #Python °æÖØÕûÎïÆ·  | 
| # def ResetItem(curPlayer, curPackIndex, tick):  | 
| #    if tick - curPlayer.GetResetItemTick() <= ChConfig.Def_ItemPackResetInterval:  | 
| #        GameWorld.Log("ÖØÕû±³°üʱ¼ä¼ä¸ôÌ«¶Ì")  | 
| #        return  | 
| #      | 
| #    curPlayer.SetResetItemTick(tick)  | 
| #      | 
| #    curPack = curPlayer.GetItemManager().GetPack(curPackIndex)  | 
| #    if curPack == None:  | 
| #        GameWorld.Log("ÖØÕû±³°üÀàÐͲ»¶Ô")  | 
| #        return  | 
| #      | 
| #    ##############################################################  | 
| #    #itemList ÄÚÈÝ:   | 
| #    #ÈÝÆ÷×¼±¸  | 
| #    #ÈÝÆ÷½á¹¹:  | 
| #    #-----------------dict key = Prior----|     -----------------dict key = Prior----|      -----------------dict key = Prior----|     -----------------dict key = Prior----|  | 
| #    #|    -----------          -----------|     |    -----------          -----------|      |    -----------        -------------|     |    -----------          -----------|  | 
| #    #|    -UnBind Item-        -Bind Item-|     |    -UnBind Item-        -Bind Item-|      |    -Bind Item-        -Unbind Item-|     |    -UnBind Item-        -Bind Item-|  | 
| #    #|    -----------          -----------|     |    -----------          -----------|      |    -----------        -------------|     |    -----------          -----------|  | 
| #    #-------------------------------------|     -------------------------------------|      -------------------------------------|     -------------------------------------|  | 
| #      | 
| #         | 
| #    #1. ×¼±¸Ò»¸ökeyΪÎïÆ·ÀàÐ͵Ä×Öµä  | 
| #    itemList = dict()  | 
| #    for i in range(curPack.GetCount()):  | 
| #        curRoleItem = curPack.GetAt(i)  | 
| #        if curRoleItem.IsEmpty():  | 
| #            continue  | 
| #        curItem = curRoleItem.GetItem()   | 
| #        itemType = curItem.GetType()  | 
| #          | 
| #        if not itemList.has_key(itemType) :  | 
| #            itemList[itemType] = list()  | 
| #            itemList[itemType].append(list())   #δ°ó¶¨ÎïÆ·  | 
| #            itemList[itemType].append(list())   #°ó¶¨ÎïÆ·  | 
| # #            GameWorld.Log("´´½¨dict ItemType = %d"%itemType)  | 
| #          | 
| #        isBind = curItem.GetIsBind()  | 
| #        #GameWorld.Log("===============================List Start : itemType = %d isBind = %d"%  | 
| #        #                      (itemType,isBind))  | 
| #        __ResetItem_AddItemInList(itemList[itemType][isBind], curItem)  | 
| #      | 
| #    #°ÑÎïÆ·È«²¿·Å»Ø  | 
| #    curPack.WipePack()  | 
| #    putPlace = 0  | 
| #   | 
| #    #GameWorld.Log("×î´óÀàÐÍÊýÄ¿: %d"%len(ChConfig.Def_ItemResetPrior))  | 
| #    for itemType in ChConfig.Def_ItemResetPrior:  | 
| #        if not itemList.has_key(itemType) :  | 
| #            continue  | 
| #          | 
| #        #GameWorld.Log("µÚ¶þ²ã: Î´°ó¶¨/°ó¶¨")  | 
| #        #µÚ¶þ²ã: Î´°ó¶¨/°ó¶¨  | 
| #        for isBind in range(0, len(itemList[itemType])):  | 
| #            #µÚÈý²ã: ÎïÆ·ÊýÁ¿  | 
| #            #GameWorld.Log("µÚÈý²ã: ÎïÆ·ÊýÁ¿ %d"%len(itemList[itemType][isBind]))  | 
| #            itemList[itemType][isBind].sort(__cmpFunc)  | 
| #            for curItem in itemList[itemType][isBind]:  | 
| #                curPack.GetAt(putPlace).AssignItem(curItem)  | 
| #                putPlace = putPlace + 1  | 
| #                #GameWorld.Log("·ÅÈëÎïÆ· : %s"%curItem.GetName())  | 
| #                  | 
| #        del itemList[itemType]  | 
| #          | 
| #    #δÃüÃûÓÅÏȼ¶µÄÎïÆ··Åµ½×îºó  | 
| #    for itemType in itemList.keys():  | 
| #        #µÚ¶þ²ã: Î´°ó¶¨/°ó¶¨  | 
| #        for isBind in range(0, len(itemList[itemType])):  | 
| #            #µÚÈý²ã: ÎïÆ·ÊýÁ¿  | 
| #            #GameWorld.Log("µÚÈý²ã: ÎïÆ·ÊýÁ¿ %d"%len(itemList[itemType][isBind]))  | 
| #            itemList[itemType][isBind].sort(__cmpFunc)  | 
| #            for curItem in itemList[itemType][isBind]:  | 
| #                curPack.GetAt(putPlace).AssignItem(curItem)  | 
| #                putPlace = putPlace + 1  | 
| #                #GameWorld.Log("·ÅÈëÎïÆ· : %s"%curItem.GetName())  | 
| #      | 
| #          | 
| #    #GameWorld.Log("ÖØÕû½áÊø")  | 
| #      | 
| #      | 
| # def __ResetItem_AddItemInList(curList, addItem):  | 
| #    #°ÑÎïÆ··Åµ½ÁбíÖÐ, ÒªÅжϵþ¼Ó  | 
| #    itemCount = addItem.GetCount()  | 
| #    packCount = addItem.GetPackCount()  | 
| #      | 
| #    for curItem in curList:  | 
| #        curCount = curItem.GetCount()  | 
| #          | 
| #        #GameWorld.Log("List: itemID = %d, count = %d, packCount = %d"%(  | 
| #                        #curItem.GetItemTypeID(), curItem.GetCount(), curItem.GetPackCount()))  | 
| #          | 
| #        if not ItemControler.CanPackItem(curItem, addItem) :  | 
| #            continue  | 
| #          | 
| #          | 
| #        if curCount >= packCount:  | 
| #            continue  | 
| #        canPlaceCount = packCount - curCount  | 
| #        if itemCount <= canPlaceCount:  | 
| #            #¿ÉÒÔÈ«²¿·ÅÈë  | 
| #            curItem.SetCount(itemCount + curCount)  | 
| #            return  | 
| #        curItem.SetCount(packCount)  | 
| #        itemCount = itemCount - canPlaceCount  | 
| #          | 
| #    if itemCount != 0:  | 
| #        #·ÅÈ뵱ǰÎïÆ·  | 
| #        addItem.SetCount(itemCount)  | 
| #        curList.append(addItem)  | 
| #   | 
| #    return  | 
| #   | 
| # def __cmpFunc(start, end):  | 
| #    if start.GetItemTypeID() > end.GetItemTypeID():  | 
| #        return 1  | 
| #    if start.GetItemTypeID() < end.GetItemTypeID():  | 
| #        return -1  | 
| #    return 0  | 
| #===============================================================================  | 
| #==============================================================================  | 
| ## Çå³ý±³°üÖеÄÈÎÎñÎïÆ·  | 
| #  @param curPlayer µ±Ç°Íæ¼Ò  | 
| #  @param packIndex ±³°üÀàÐÍ  | 
| #  @return None  | 
| #  @remarks º¯ÊýÏêϸ˵Ã÷.  | 
| def ClearPackEventItem(curPlayer , packIndex):  | 
|     curPack = curPlayer.GetItemManager().GetPack(packIndex)  | 
|     itemList = []  | 
|       | 
|     for i in range(0, curPack.GetCount()):  | 
|         item = curPack.GetAt(i)  | 
|         #¿ÕÎïÆ·  | 
|         if not item or item.IsEmpty():  | 
|             continue  | 
|           | 
|         #²»ÊÇÈÎÎñÎïÆ·  | 
|         if not IsEventItem(item):  | 
|             continue  | 
|           | 
|         itemList.append(item)  | 
|       | 
|     curPlayerID = curPlayer.GetID()  | 
|       | 
|     for item in itemList:  | 
|         GameWorld.Log('###Çå¿Õ±³°ü = %s ÖеÄÈÎÎñÎïÆ· = %s' % (packIndex , item.GetItemTypeID()) , curPlayerID)  | 
|         item.Clear()  | 
|           | 
|     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, {}]):  | 
|     if itemCount <= 0:  | 
|         return False  | 
|       | 
|     curItemData = GameWorld.GetGameData().GetItemByTypeID(itemID)  | 
|     if not curItemData:  | 
|         return False  | 
|       | 
|     #¼¤»î³É¾ÍµÄµÀ¾ß  | 
|     if curItemData.GetType() == ChConfig.Def_ItemType_SuccessItem:  | 
|         PlayerSuccess.DoAddSuccessProgress(curPlayer, ShareDefine.SuccType_GetSpecialItem, 1, [itemID])  | 
|         return True  | 
|       | 
|     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):  | 
|         #²»¿É·ÅÈë  | 
|         return False  | 
|       | 
|     #¶¨ÖÆÎïÆ·  | 
|     if GetAppointItemRealID(itemID):  | 
|         isOK = False  | 
|         for _ in xrange(itemCount):  | 
|             if GivePlayerAppointItem(curPlayer, itemID, itemIsBind, showEff, showSysInfo, event):  | 
|                 isOK = True # Ö»ÒªÓгɹ¦µÄ¾Í·µ»Ø³É¹¦£¬·ÀÖ¹Òì³£Çé¿öʧ°Ü¿ÉÄܵ¼Ö±»Ë¢  | 
|         return isOK  | 
|       | 
|     #×°±¸  | 
|     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):  | 
|                 isOK = True # Ö»ÒªÓгɹ¦µÄ¾Í·µ»Ø³É¹¦£¬·ÀÖ¹Òì³£Çé¿öʧ°Ü¿ÉÄܵ¼Ö±»Ë¢  | 
|         return isOK  | 
|       | 
|     giveItem = GetOutPutItemObj(itemID, itemCount, itemIsBind)  | 
|     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)  | 
|   | 
|   | 
| ## ¸øÍæ¼Ò¶¨ÖÆÎïÆ·±íÎïÆ·\PyMapTable\AppointItemList.txt  | 
| #  @param curPlayer µ±Ç°Íæ¼Ò  | 
| #  @param index ±íindex  | 
| #  @param isBind ÊÇ·ñ°ó¶¨  | 
| #  @param showEff ÏÔʾ·ÅÈë±³°üµÄÌØÐ§  | 
| #  @return ²¼¶ûÖµ  | 
| def GivePlayerAppointItem(curPlayer, index, isBind, showEff=False, showSysInfo=False, event=["", False, {}]):  | 
|     itemDictData = GetAppointItemDictData(index, isBind)  | 
|     if not itemDictData:  | 
|         return False  | 
|   | 
|     return GivePlayerEquip(curPlayer, itemDictData, showEff, showSysInfo=showSysInfo, event=event)  | 
|   | 
| ## »ñÈ¡¶¨ÖƱíÎïÆ·Êý¾Ý  | 
| #  @param index ±íindex  | 
| #  @param isBind ÊÇ·ñ°ó¶¨  | 
| #  @return ItemDictData  | 
| def GetAppointItemDictData(index, isBind):  | 
|     itemID = GetAppointItemRealID(index)  | 
|     if not itemID:  | 
|         return {}  | 
|     ipyData = IpyGameDataPY.GetIpyGameData("AppointItem", index)  | 
|     if not ipyData:  | 
|         GameWorld.ErrLog("GivePlayerAppointItem() Index=%s not data" % (index))  | 
|         return {}  | 
|     itemDictData = {}  | 
|      | 
|     itemDictData['legendAttrID'] = ipyData.GetLegendAttrID()  | 
|     itemDictData['legendAttrValue'] = ipyData.GetLegendAttrValue()  | 
|     itemDictData['SuiteLV'] = ipyData.GetSuiteLV()  | 
|     itemDictData['ItemID'] = itemID  | 
|     itemDictData['CancelUseLimit'] = ipyData.GetCancelUseLimit()  | 
|       | 
|     # ÉèÖÃÊÇ·ñ°ó¶¨  | 
|     itemDictData['IsBind'] = isBind  | 
|       | 
|     #×°±¸¾ø°æÊôÐÔ£¬ËæµÈ¼¶±ä»¯  | 
|     itemDictData['OutOfPrintAttrID'] = ipyData.GetOutOfPrintAttr()  | 
|     itemDictData['OutOfPrintAttrValue'] = ipyData.GetOutOfPrintAttrValue()  | 
|     return itemDictData  | 
|   | 
| def GetAppointItemRealID(itemID):  | 
|     '''»ñÈ¡¶¨ÖÆÎïÆ·¶ÔÓ¦µÄÕæÊµÎïÆ·ID'''  | 
|     curItem = GameWorld.GetGameData().GetItemByTypeID(itemID)  | 
|     if not curItem:  | 
|         return 0  | 
|     curEff = curItem.GetEffectByIndex(0)  | 
|     curEffID = curEff.GetEffectID()  | 
|     if curEffID != ChConfig.Def_Effect_AppointItem:  | 
|         return 0  | 
|     return curEff.GetEffectValue(0)  | 
|   | 
| ## ¸ù¾ÝÎïÆ·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, {}]):  | 
|     equipItem = GetItemByData(itemData)  | 
|     #½«ÎïÆ··ÅÈë±³°ü  | 
|     return __DoLogic_PutItemInPack(curPlayer, equipItem, packType, showEff, defaultPile, returnItemObj, showSysInfo, event)  | 
|   | 
|   | 
| ## ¸ù¾ÝÎïÆ·data×ֵ䴴½¨ÎïÆ·  | 
| #  @param itemData£ºÎïÆ·Êý¾Ý  | 
| #  @return ItemObj  | 
| def GetItemByData(itemData):  | 
|     if not itemData:  | 
|         return  | 
|       | 
|     itemID = int(itemData.get('ItemID', 0))  | 
|     equipItem = ItemCommon.CreateSingleItem(itemID)  | 
|     if not equipItem:  | 
|         return  | 
|       | 
|     tmpEquipData = SingleEquipTmpData()  | 
|       | 
|     #tmpEquipData.starLV = int(itemData.get('StarLV', '0'))  | 
|     #tmpEquipData.holeCnt = int(itemData.get('HoleCount', '0'))  | 
|     #tmpEquipData.stoneData = eval(itemData.get('StoneData', '[]'))  | 
|     tmpEquipData.isBind = int(itemData.get('IsBind', '0'))  | 
|     tmpEquipData.isSuite = int(itemData.get('IsSuit', '0'))  | 
|     tmpEquipData.suiteLV = int(itemData.get('SuiteLV', '0'))  | 
|     if tmpEquipData.suiteLV:  | 
|         tmpEquipData.isSuite = 1  | 
|     tmpEquipData.source = int(itemData.get('Source', str(ShareDefine.Item_Source_Unkown)))  | 
|       | 
|     tmpEquipData.legendAttrIDList = itemData.get('legendAttrID', [])  | 
|     tmpEquipData.legendAttrValueList = itemData.get('legendAttrValue', [])  | 
|       | 
|     tmpEquipData.OutOfPrintAttrIDList = itemData.get('OutOfPrintAttrID', []) # ¾ø°æÊôÐÔID  | 
|     tmpEquipData.OutOfPrintAttrValueList = itemData.get('OutOfPrintAttrValue', []) # ¾ø°æÊôÐÔ×î´óÖµ  | 
|       | 
|     # ×°±¸¸½¼ÓÊôÐÔ  | 
|     ChItem.EquipAddAdditionEx(equipItem, tmpEquipData)  | 
|       | 
|     if "UserData" in itemData:  | 
|         userData = itemData["UserData"]  | 
|         equipItem.SetUserData(userData, len(userData))  | 
|           | 
|     if "EquipGS" in itemData:  | 
|         equipGS = int(itemData["EquipGS"])  | 
|         ItemCommon.SetEquipGearScore(equipItem, equipGS)  | 
|       | 
|           | 
|     # È¡ÏûµÈ¼¶ÏÞÖÆ  | 
|     if itemData.get('CancelUseLimit', 0):  | 
|         equipItem.SetUserAttr(ShareDefine.Def_IudetCancelUseLimit, 1)  | 
|           | 
|     return equipItem  | 
|   | 
|   | 
| #---------------------------------------------------------------------  | 
| ##¼ì²éÊÇ·ñ¿ÉÒÔ·ÅÈë´ËÎïÆ·.  | 
| # @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, {}]):  | 
|     #itemID = curGiveItem.GetItemTypeID()  | 
|     #count = curGiveItem.GetCount()  | 
|     itemControl = PlayerItemControler(curPlayer)  | 
|     #±éÀú±³°üË÷Òý·ÅÈëÎïÆ·  | 
|     for packIndex in packIndexList:  | 
|         #·ÅÈë³É¹¦  | 
|         if itemControl.PutInItem(packIndex, curGiveItem, defaultPile, event):  | 
|             #===================================================================  | 
|             # if packIndex == IPY_GameWorld.rptItem and showEff:  | 
|             #    curPlayer.Sync_GetItemView(itemID, count)  | 
|             #      | 
|             # if showSysInfo:  | 
|             #    PlayerControl.NotifyCode(curPlayer, "ObtainRes01", [itemID, count])  | 
|             #===================================================================  | 
|               | 
|             if returnItemObj:  | 
|                 return curGiveItem  | 
|             return True  | 
|   | 
|     #Íæ¼Ò±³°üÒÑÂú, Çå¿ÕÎïÆ·,·ñÔò´´½¨ÎïÆ·²»É¾³ý,½«µ¼ÖÂÄÚ´æÒç³ö  | 
|     curGiveItem.Clear()  | 
|     #Ç°ÃæÑéÖ¤¹ýÁË, ×ßµ½ÕâÀï¾ÍÊÇÂß¼BugÁË  | 
|     GameWorld.ErrLog('ItemControler.GivePlayerItem Error ÎïÆ·ÎÞ·¨·ÅÈë±³°ü')  | 
|     return False  | 
|   | 
| ## ÉèÖÃÎïÆ·ÊÇ·ñ°ó¶¨  | 
| #  @param curGiveItem ÎïÆ·ÊµÀý  | 
| #  @param isBind ÊÇ·ñ°ó¶¨  | 
| #  @return None  | 
| #  @remarks   | 
| def SetItemIsBind(curGiveItem, isBind):  | 
|     #isBind = False  | 
|     curGiveItem.SetIsBind(isBind)  | 
|     return  | 
|   | 
|   | 
| ## ÉèÖÃÎïÆ·ÊýÁ¿  | 
| #  @param item ÎïÆ·ÊµÀý  | 
| #  @param cnt ÊýÁ¿  | 
| #  @param playerID Íæ¼ÒID  | 
| #  @param accID Õ˺Š | 
| #  @param playerName Ãû×Ö  | 
| #  @return None  | 
| def SetItemCount(item, cnt, playerID=0, accID=0, playerName=""):  | 
|     if not item.IsEmpty():  | 
|         itemID = item.GetItemTypeID()  | 
|         if cnt > 0 and itemID in ChConfig.Def_TransformItemIDList:  | 
|             item.SetUserAttr(ShareDefine.Def_IudetItemCount, min(cnt, ChConfig.Def_UpperLimit_DWord))  | 
|         else:  | 
|             item.SetCount(min(cnt, 65535))  | 
|     else:  | 
|         try:  | 
|             1 / 0  | 
|         except:  | 
|             errorInfo = "%s %s %s -- ItemControler->SetItemCount::" % (playerID, accID, playerName)  | 
|             GameWorld.ErrLog(errorInfo + str(traceback.extract_stack()) + "\n" + traceback.format_exc())  | 
|             raise  | 
|           | 
| def GetItemCount(item):  | 
|     if item.GetItemTypeID() in ChConfig.Def_TransformItemIDList:  | 
|         return item.GetUserAttr(ShareDefine.Def_IudetItemCount)  | 
|     return item.GetCount()  | 
|   | 
| def GetItemNeedPackCount(packType, itemData, itemCount):  | 
|     if itemData.GetItemTypeID() in ChConfig.Def_TransformItemIDList:  | 
|         # »õ±ÒÖ±½Óת»»µÄÎïÆ·Èç¹ûÊÇ·ÅÈë±³°üµÄÔò²»ÐèÒªÔÝÓøñ×Ó£¬·ÅÈëÆäËûµÄ±³°üµÄÔò°´ÎïÆ·µþ¼ÓÉÏÏÞËã  | 
|         if packType == IPY_GameWorld.rptItem:  | 
|             return 0  | 
|         packCount = ChConfig.Def_UpperLimit_DWord # ×ª»¯ÎïÆ·µþ¼ÓÉÏÏÞ²»È¡ÎïÆ·±íµÄ  | 
|     else:  | 
|         packCount = itemData.GetPackCount()  | 
|     return int(math.ceil(itemCount / float(packCount)))  | 
|   | 
| ## Ë«ÊÖÎäÆ÷£¬ÐèÒªÁ½Ö»ÊÖ²ÅÄõö¯  | 
| #  @param curEquip  | 
| #  @return bool  | 
| def IsTwoHandedWeapon(curEquip):  | 
|     return curEquip.IsBothHands() == ShareDefine.Def_Weapon_Two_Handed  | 
|   | 
|   | 
| ## Ë«³ÖÎäÆ÷£¬×óÓÒÊÖ¶¼¿ÉÒÔÄ̵̮ðÀ´µÄÎäÆ÷  | 
| #  @param curEquip  | 
| #  @return bool  | 
| def IsDualWeapons(curEquip):  | 
|     return curEquip.IsBothHands() == ShareDefine.Def_Weapon_Dual_Hands  | 
|   | 
|   | 
| ## ×°±¸¶àλÖÃ×°±¸´¦Àí  | 
| #  @param equipPack µ±Ç°×°±¸±³°ü  | 
| #  @param packEquipIndex ¿Í»§¶Ë·¢À´×°±¸Î»ÖÃ(IPY_GameWorld.retMax ´ú±í·þÎñÆ÷×Ô¶¯×°±¸)  | 
| #  @param placeList ¿É×°±¸µÄλÖÃÁÐ±í  | 
| #  @return ×°±¸Î»Öà  | 
| def GetMultiPlaceEquipPlace(equipPack, packEquipIndex, placeList):  | 
|               | 
|     #---¿Í»§¶ËÖ¸¶¨Î»ÖÃ---  | 
|     if packEquipIndex in placeList:  | 
|         return packEquipIndex  | 
|       | 
|     #---·þÎñ¶ËÅжϿÕλÖÃ---  | 
|     for placeIndex in placeList:  | 
|         curEquip = equipPack.GetAt(placeIndex)  | 
|           | 
|         if curEquip.IsEmpty():  | 
|             return placeIndex  | 
|           | 
|         elif IsTwoHandedWeapon(curEquip):  | 
|             #ÎäÆ÷ÌØÊâ´¦Àí£¬Ë«ÊÖÖ±½Ó½»»»  | 
|             return placeIndex  | 
|           | 
|     #---ÎÞ¿ÕλÖã¬Ìæ»»---  | 
|     return placeList[0]  | 
|   | 
| def GetOutPutItemObj(itemID, itemCount=1, isBind=0):  | 
|     ''' »ñÈ¡¹¦Äܲú³öµÄÎïÆ·ÊµÀý  | 
|     '''  | 
|     curItem = ItemCommon.CreateSingleItem(itemID, itemCount, isBind)  | 
|     if not curItem:  | 
|         GameWorld.ErrLog("²ú³öÎïÆ·Òì³£,ÎÞ·¨´´½¨ÎïÆ· = %s" % (itemID))  | 
|         return  | 
|       | 
|     # ·Ç×°±¸£¬ÎÞÐèÉèÖÃÊôÐÔ  | 
|     if not ItemCommon.CheckItemIsEquip(curItem):  | 
|         return curItem  | 
|       | 
|     # ¶¨ÖÆÎïÆ·  | 
|     if GetAppointItemRealID(itemID):  | 
|         curItem.Clear()  | 
|         #GameWorld.DebugLog("Çå³ý¸ø¶¨ÖÆÎïÆ·Ö®Ç°ÒѾ´´½¨µÄÎïÆ·ID=%s" % itemID)  | 
|         return GetItemByData(GetAppointItemDictData(itemID, isBind))  | 
|       | 
|     tmpEquipData = SingleEquipTmpData()  | 
|       | 
|     # ´«ÆæÊôÐÔ  | 
|     legendAttrInfo = GetAddEquipLegendAttr(curItem)  | 
|     if legendAttrInfo:  | 
|         tmpEquipData.legendAttrIDList = legendAttrInfo[0]  | 
|         tmpEquipData.legendAttrValueList = legendAttrInfo[1]  | 
|           | 
|     # ÆäËû×°±¸ÊôÐÔ  | 
|     ChItem.EquipAddAdditionEx(curItem, tmpEquipData)  | 
|     return curItem  | 
|   | 
| def GetAddEquipLegendAttr(curItem):  | 
|     '''»ñÈ¡Éú³Éµ½×°±¸ÉϵĴ«ÆæÊôÐÔ  | 
|     @return: None-ûÓд«ÆæÊôÐÔ£» ´«ÆæÊôÐÔ×Öµä-[[´«ÆæÊôÐÔЧ¹ûIDÁбí], [ÊôÐÔÖµÁбí]]  | 
|     '''  | 
|     itemType = curItem.GetType()  | 
|     if itemType == ChConfig.Def_ItemType_retWing:  | 
|         return __GetAddWingLegendAttr(curItem)  | 
|       | 
|     itemColor = curItem.GetItemColor()  | 
|     itemClassLV = ItemCommon.GetItemClassLV(curItem)  | 
|     itemQuality = curItem.GetItemQuality()  | 
|     key = (itemColor, itemQuality)  | 
|     isDogzEquip = ItemCommon.GetIsDogzEquip(curItem)  | 
|     # {(ÑÕÉ«,ÐǼ¶):[Ò»°ãÊôÐÔÌõÊý, ×·ÇóÊôÐÔÌõÊý, ¹Ì¶¨ÊôÐÔÌõÊý], ...}  | 
|     if isDogzEquip:  | 
|         #ÉñÊÞ×°±¸ÌõÊý²»Ò»Ñù  | 
|         legAttrCntDict = IpyGameDataPY.GetFuncEvalCfg("LegendAttrCount", 2)  | 
|     else:  | 
|         legAttrCntDict = IpyGameDataPY.GetFuncEvalCfg("LegendAttrCount")  | 
|     if key not in legAttrCntDict:  | 
|         #GameWorld.DebugLog("¸Ã×°±¸Æ·ÖÊûÓд«ÆæÊôÐÔ: itemColor=%s,itemQuality=%s" % (itemColor, itemQuality))  | 
|         return  | 
|     commAttrCnt, goodAttrCnt, specAttrCnt = legAttrCntDict[key]  | 
|       | 
|     # {×°±¸Î»:[[Ò»°ãÊôÐÔIDÁбí], [×·ÇóÊôÐÔIDÁбí], [¹Ì¶¨ÊôÐÔIDÁбí]], ...}  | 
|     equipPlace = curItem.GetEquipPlace()  | 
|     legAttrRuleDict = IpyGameDataPY.GetFuncEvalCfg("LegendAttrRule")  | 
|     if equipPlace not in legAttrRuleDict:  | 
|         #GameWorld.DebugLog("¸Ã×°±¸Î»Ã»Óд«ÆæÊôÐÔ, equipPlace=%s" % equipPlace)  | 
|         return  | 
|     commAttrList, goodAttrList, specAttrList = legAttrRuleDict[equipPlace]  | 
|       | 
|     randAttrIDList = [] # ÏÈËæ»ú´«ÆæÊôÐÔÀàÐÍ  | 
|     if commAttrCnt:  | 
|         randAttrIDList.extend(random.sample(commAttrList, min(len(commAttrList), commAttrCnt)))  | 
|     if goodAttrCnt:  | 
|         randAttrIDList.extend(random.sample(goodAttrList, min(len(goodAttrList), goodAttrCnt)))  | 
|     if specAttrCnt:  | 
|         if type(specAttrList) == int:  | 
|             if specAttrList:  | 
|                 randAttrIDList.append(specAttrList)  | 
|         else:  | 
|             randAttrIDList.extend(random.sample(specAttrList, min(len(specAttrList), specAttrCnt)))  | 
|               | 
|     curLegAttrIDList = []  | 
|     curLegAttrValueList = []  | 
|     # {ÊôÐÔID:{ÑÕÉ«:ÊýÖµ, ...}, ...}  | 
|     if isDogzEquip:  | 
|         # ÉñÊÞ×°±¸ÊýÖµ²»Ò»Ñù   | 
|         legAttrValueColorDict = IpyGameDataPY.GetFuncEvalCfg("LegendAttrValueByColor2", 1, {})  | 
|         legAttrValueClassLVColorDict = IpyGameDataPY.GetFuncEvalCfg("LegendAttrValueByColor2", 2, {})  | 
|     else:  | 
|         legAttrValueColorDict = IpyGameDataPY.GetFuncEvalCfg("LegendAttrValueByColor", 1, {})  | 
|         legAttrValueClassLVColorDict = IpyGameDataPY.GetFuncEvalCfg("LegendAttrValueByColor", 2, {})  | 
|     legAttrValueClassLVDict = IpyGameDataPY.GetFuncEvalCfg("LegendAttrValueByClassLV")  | 
|     for attrID in randAttrIDList:  | 
|         if attrID in legAttrValueColorDict:  | 
|             colorValueDict = legAttrValueColorDict[attrID]  | 
|             if itemColor not in colorValueDict:  | 
|                 GameWorld.ErrLog("ûÓÐÅäÖô«ÆæÊôÐÔID×°±¸ÑÕÉ«¶ÔÓ¦µÄÊýÖµ, attrID=%s,itemColor=%s" % (attrID, itemColor))  | 
|                 continue  | 
|             attrValue = colorValueDict[itemColor]  | 
|         # {ÊôÐÔID:{½×:{ÑÕÉ«:ÊýÖµ, ...}, ...}, ...}  | 
|         elif attrID in legAttrValueClassLVColorDict:  | 
|             classLVColorValueDict = legAttrValueClassLVColorDict[attrID]  | 
|             if itemClassLV in classLVColorValueDict:  | 
|                 colorValueDict = classLVColorValueDict[itemClassLV]  | 
|             else:  | 
|                 minClassLV, maxClassLV = min(classLVColorValueDict), max(classLVColorValueDict)  | 
|                 if itemClassLV <= minClassLV:  | 
|                     colorValueDict = classLVColorValueDict[minClassLV]  | 
|                 elif itemClassLV >= maxClassLV:  | 
|                     colorValueDict = classLVColorValueDict[maxClassLV]  | 
|                 else:  | 
|                     GameWorld.ErrLog("ûÓÐÅäÖô«ÆæÊôÐÔID×°±¸½×¼¶ÑÕÉ«¶ÔÓ¦µÄÊýÖµ, attrID=%s,itemClassLV=%s" % (attrID, itemClassLV))  | 
|                     continue  | 
|             if itemColor not in colorValueDict:  | 
|                 GameWorld.ErrLog("ûÓÐÅäÖô«ÆæÊôÐÔID×°±¸½×¼¶ÑÕÉ«¶ÔÓ¦µÄÊýÖµ, attrID=%s,itemClassLV=%s,itemColor=%s" % (attrID, itemClassLV, itemColor))  | 
|                 continue  | 
|             attrValue = colorValueDict[itemColor]  | 
|         elif attrID in legAttrValueClassLVDict:  | 
|             classLVValueDict = legAttrValueClassLVDict[attrID]  | 
|             if itemClassLV in classLVValueDict:  | 
|                 attrValue = classLVValueDict[itemClassLV]  | 
|             else:  | 
|                 minClassLV, maxClassLV = min(classLVValueDict), max(classLVValueDict)  | 
|                 if itemClassLV <= minClassLV:  | 
|                     attrValue = classLVValueDict[minClassLV]  | 
|                 elif itemClassLV >= maxClassLV:  | 
|                     attrValue = classLVValueDict[maxClassLV]  | 
|                 else:  | 
|                     GameWorld.ErrLog("ûÓÐÅäÖô«ÆæÊôÐÔID×°±¸½×¼¶¶ÔÓ¦µÄÊýÖµ, attrID=%s,itemClassLV=%s" % (attrID, itemClassLV))  | 
|                     continue  | 
|         else:  | 
|             GameWorld.ErrLog("ûÓÐÅäÖô«ÆæÊôÐÔID¶ÔÓ¦µÄÊýÖµ, attrID=%s" % attrID)  | 
|             continue  | 
|           | 
|         curLegAttrIDList.append(attrID)  | 
|         curLegAttrValueList.append(attrValue)  | 
| #    GameWorld.DebugLog("itemClassLV=%s,itemColor=%s,itemQuality=%s,commAttrCnt=%s,goodAttrCnt=%s,specAttrCnt=%s"   | 
| #                       % (itemClassLV, itemColor, itemQuality, commAttrCnt, goodAttrCnt, specAttrCnt))  | 
| #    GameWorld.DebugLog("commAttrList=%s, goodAttrList=%s, specAttrList=%s" % (commAttrList, goodAttrList, specAttrList))  | 
| #    GameWorld.DebugLog("randAttrIDList=%s,curLegAttrIDList=%s, curLegAttrValueList=%s"   | 
| #                       % (randAttrIDList, curLegAttrIDList, curLegAttrValueList))  | 
|     return [curLegAttrIDList, curLegAttrValueList]  | 
|   | 
| def __GetAddWingLegendAttr(curItem):  | 
|     # {½×Êý:ÌõÊý, ...}  | 
|     wingLegAttrCntDict = IpyGameDataPY.GetFuncEvalCfg("WingLegendAttrCount")  | 
|     itemClassLV = ItemCommon.GetItemClassLV(curItem)  | 
|     if itemClassLV not in wingLegAttrCntDict:  | 
|         GameWorld.DebugLog("¸Ã³á°ò½×¼¶Ã»Óд«ÆæÊôÐÔ, ½×Êý=%s" % itemClassLV)  | 
|         return  | 
|     legAttrCnt = wingLegAttrCntDict[itemClassLV]  | 
|     # {½×Êý:{ÊôÐÔID1:[ÊýÖµËæ»úÁбí], ÊôÐÔID2:[ÊýÖµËæ»úÁбí]},½×Êý:{ÊôÐÔID1:[ÊýÖµËæ»úÁбí], ÊôÐÔID2:[ÊýÖµËæ»úÁбí]},...}  | 
|     wingLegAttrValueDict = IpyGameDataPY.GetFuncEvalCfg("WingLegendAttrValue")  | 
|     if itemClassLV not in wingLegAttrValueDict:  | 
|         GameWorld.ErrLog("¸Ã³á°ò½×¼¶Ã»ÓÐÅäÖöÔÓ¦µÄ´«ÆæÊôÐÔÊýÖµ, ½×Êý=%s" % itemClassLV)          | 
|         return  | 
|     curClassLVLegAttrDict = wingLegAttrValueDict[itemClassLV]  | 
|     attrIDList = curClassLVLegAttrDict.keys()  | 
|     legAttrCnt = min(len(attrIDList), legAttrCnt)  | 
|     GameWorld.DebugLog("Éú³É³á°ò´«ÆæÊôÐÔ: itemClassLV=%s,legAttrCnt=%s,attrIDList=%s" % (itemClassLV, legAttrCnt, attrIDList))  | 
|     if not legAttrCnt:  | 
|         return  | 
|     curLegAttrIDList = random.sample(attrIDList, legAttrCnt)  | 
|     #curLegAttrIDList.sort()  | 
|     curLegAttrValueList = [random.choice(curClassLVLegAttrDict[attrID]) for attrID in curLegAttrIDList]  | 
|     GameWorld.DebugLog("    curLegAttrIDList=%s, curLegAttrValueList=%s" % (curLegAttrIDList, curLegAttrValueList))  | 
|     return [curLegAttrIDList, curLegAttrValueList]  | 
|   | 
| ##´´½¨ÎïÆ·ËùÐèµÄ¶¯Ì¬Êý¾Ý  | 
| #  | 
| # ±ãÓÚͳһÐÞ¸Ä  | 
| class SingleEquipTmpData():  | 
|       | 
|     ## ³õʼ»¯  | 
|     #  @param   | 
|     #  @return None  | 
|     def __init__(self):  | 
|         self.starLV = 0 # Ç¿»¯µÈ¼¶(ÐÇÊý)  | 
|         self.holeCnt = 0  | 
|         self.stoneData = [] # ±¦Ê¯ÁÐ±í  | 
|         self.isSuite = False  | 
|         self.suiteLV = 0 #Ì××°µÈ¼¶  | 
|         self.isBind = False  | 
|           | 
|         self.source = ShareDefine.Item_Source_Unkown    #ÎïÆ·À´Ô´  | 
|         self.legendAttrIDList = [] # ´«ÆæÊôÐÔID  | 
|         self.legendAttrValueList = [] # ´«ÆæÊôÐÔÖµ  | 
|           | 
|         self.OutOfPrintAttrIDList = [] # ¾ø°æÊôÐÔID  | 
|         self.OutOfPrintAttrValueList = [] # ¾ø°æÊôÐÔ×î´óÖµ  | 
|         return  | 
|       | 
| def ClearPack(curPlayer, packType):  | 
|     ## Çå¿ÕÖ¸¶¨±³°ü  | 
|     pack = curPlayer.GetItemManager().GetPack(packType)  | 
|     for i in xrange(pack.GetCount()):  | 
|         curItem = pack.GetAt(i)  | 
|         if not curItem or curItem.IsEmpty():  | 
|             continue  | 
|         curItem.Clear()  | 
|     return  | 
|   | 
| def PutItemInTempSwap(curPlayer, itemID, isBind=1):  | 
|     ## ÁÙʱ±³°ü·ÅÈëÎïÆ·  | 
|     # ÁÙʱ½»»»±³°üĿǰֻ¿ª·Å1¸ö¸ñ×Ó£¬Ã¿´Î·ÅÈëǰÏÈÇå¿ÕÔÙ·ÅÈë  | 
|     ClearPack(curPlayer, ShareDefine.rptTempSwap)  | 
|     return GivePlayerItem(curPlayer, itemID, 1, isBind, [ShareDefine.rptTempSwap])  | 
|   | 
| def OpenPickupItemPutInTemp(curPlayer, isClearItem):  | 
|     ''' ¿ªÆôʰȡµÄÎïÆ··ÅÈëÁÙʱ´æ·Å±³°ü  | 
|     @param isClearItem: ÊÇ·ñÇå³ýÁÙʱ´æ·Å±³°üÎïÆ·; Ò»°ã¼¤»î¸Ã¹¦ÄÜʱÉèÖÃΪ True£»  | 
|                         ÓÉÓÚ±ê¼Ç¸Ã״̬µÄkey¼Ç¼²»´æÓÚÊý¾Ý¿â£¬¹ÊÔÚ¸ÃÉ趨ÓÐЧÆÚÄÚÍæ¼ÒÀëÏßÖØÉϻᵼÖÂÉ趨±»ÖØÖà  | 
|                         ËùÒÔµÃÔÚÌØ¶¨µÄ¹¦ÄÜÂß¼ÀÈ縱±¾µÄ DoEnterFB ÖØÐÂÉ趨£©£¬µ«´Ëʱ²»ÄÜÇå¿Õ´Ë±³°üÎïÆ·£¬ÐèÉèÖÃΪ False  | 
|                         ·ñÔò»áµ¼ÖÂÖØÐÂÉÏÏߺó֮ǰÒѾʰȡµÄÁÙʱÎïÆ·±»Çå¿Õ  | 
|     '''  | 
|     if isClearItem:  | 
|         ClearPack(curPlayer, ShareDefine.rptTempItem)  | 
|     curPlayer.SetDict(ChConfig.Def_PlayerKey_PickupItemPutInTemp, 1)  | 
|     return  | 
|   | 
| def ClosePickupItemPutInTemp(curPlayer):  | 
|     # ¹Ø±ÕʰȡµÄÎïÆ··ÅÈëÁÙʱ´æ·Å±³°ü  | 
|     curPlayer.SetDict(ChConfig.Def_PlayerKey_PickupItemPutInTemp, 0)  | 
|     return  | 
|   | 
| def DoGivePlayerTempPackItem(curPlayer, event=["", False, {}], mailTypeKey=None, extraItemList=[]):  | 
|     ''' ½«ÁÙʱ±³°üÖеÄÎïÆ··ÅÈëÍæ¼ÒÎïÆ·±³°ü  | 
|     @param mailType: ÎïÆ·±³°ü¿Õ¼ä²»¹»Ê±Ê¹ÓÃÓʼþ·¢ÎïÆ·¸øÍæ¼ÒµÄÓʼþÄ£°å  | 
|     '''  | 
|     tempItemList = []  | 
|     pack = curPlayer.GetItemManager().GetPack(ShareDefine.rptTempItem)  | 
|     for i in xrange(pack.GetCount()):  | 
|         curItem = pack.GetAt(i)  | 
|         if not curItem or curItem.IsEmpty():  | 
|             continue  | 
|         tempItemList.append(curItem)  | 
|           | 
|     if not tempItemList and not extraItemList:  | 
|         return []  | 
|   | 
|     needSpace = len(tempItemList) + len(extraItemList)  | 
|     isSendMail = needSpace > ItemCommon.GetItemPackSpace(curPlayer, IPY_GameWorld.rptItem, needSpace)  | 
|     if isSendMail:  | 
|         mailItemList = []  | 
|         for tempItem in tempItemList:  | 
|             mailItemList.append(ItemCommon.GetMailItemDict(tempItem))  | 
|         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)  | 
|               | 
|     ClearPack(curPlayer, ShareDefine.rptTempItem)  | 
|     return  | 
|   | 
|   |