| #!/usr/bin/python  | 
| # -*- coding: GBK -*-  | 
| #-------------------------------------------------------------------------------  | 
| #  | 
| #-------------------------------------------------------------------------------  | 
| ##@package ChEquip  | 
| # ×°±¸Âß¼´¦Àí  | 
| #  | 
| # @author alee  | 
| # @date 2017-07-29 00:30  | 
| # @version 1.0  | 
| #  | 
| # ÐÞ¸Äʱ¼ä ÐÞ¸ÄÈË ÐÞ¸ÄÄÚÈÝ  | 
| #------------------------------------------------------------------------------   | 
| #"""Version = 2017-07-29 00:30"""  | 
| #------------------------------------------------------------------------------   | 
| import IPY_GameWorld  | 
| import GameWorld  | 
| import ItemControler  | 
| import SkillShell  | 
| import PlayerControl  | 
| import ChConfig  | 
| import ChItem  | 
| import ItemCommon  | 
| import FBLogic  | 
| import ReadChConfig  | 
| import OperControlManager  | 
| import Operate_EquipWash  | 
| import ShareDefine  | 
| import PyMapTable  | 
| import ChPyNetSendPack  | 
| import NetPackCommon  | 
| import EventShell  | 
| import IpyGameDataPY  | 
| import PlayerWing  | 
| import Operate_EquipStone  | 
| import PassiveBuffEffMng  | 
| import SkillCommon  | 
| import PlayerMagicWeapon  | 
| import time  | 
| import json  | 
| import FormulaControl  | 
| import PyGameData  | 
| #---------------------------------------------------------------------  | 
|   | 
|   | 
| ##¼ì²éÍæ¼ÒÊÇ·ñ¿ÉÒÔ»»×°  | 
| # @param curPlayer Íæ¼ÒʵÀý  | 
| # @return ·µ»ØÖµ, ÊÇ·ñͨ¹ý¼ì²é  | 
| # @remarks ¼ì²éÍæ¼ÒÊÇ·ñ¿ÉÒÔ»»×°  | 
| def CheckPlayerCanEquipItem(curPlayer):  | 
|     if curPlayer.GetPlayerAction() not in ChConfig.Def_Player_DoEquip_State:  | 
|         #InsteadEquip ¶Ô²»Æð,µ±Ç°×´Ì¬ÎÞ·¨¸ü»»×°±¸  | 
|         #InsteadEquipÌæ»»ÎªGeRen_chenxin_436832  | 
|         PlayerControl.NotifyCode(curPlayer, "GeRen_chenxin_436832")  | 
|         return False  | 
|       | 
|     return True  | 
|   | 
|   | 
| ## Ö´ÐÐÍæ¼Ò»»×°Âß¼  | 
| #  @param curPlayer µ±Ç°Íæ¼Ò  | 
| #  @param curItem ÎïÆ·ÊµÀý  | 
| #  @param equipPackIndex ×°±¸±³°üË÷Òý  | 
| #  @param tick µ±Ç°Ê±¼ä  | 
| #  @return ²¼¶ûÖµ  | 
| #  @remarks Ö´ÐÐÍæ¼Ò»»×°Âß¼  | 
| def DoPlayerEquipItem(curPlayer, curItem, equipPackIndex, tick):   | 
|     if equipPackIndex < 0:  | 
|         return False  | 
|     playerItemControl = ItemControler.PlayerItemControler(curPlayer)  | 
|       | 
|     if ItemControler.GetIsAuctionItem(curItem):  | 
|         GameWorld.DebugLog("ÅÄÆ·ÎÞ·¨´©´÷!")  | 
|         return False  | 
|       | 
|     #---ÑéÖ¤ÊÇ·ñ¿ÉÒÔ»»Õâ¼þ×°±¸---  | 
|     if not ItemCommon.CheckItemCanUse(curItem):  | 
|         return False  | 
|       | 
|     if not ItemCommon.CheckItemCanUseByExpireTime(curItem):  | 
|         # ¹ýÆÚ  | 
|         GameWorld.DebugLog("×°±¸ÒѹýÆÚ!")  | 
|         return False  | 
|       | 
|     changeItemEquipPlace = curItem.GetEquipPlace()  | 
|     if changeItemEquipPlace not in ShareDefine.RoleEquipType:  | 
|         return False  | 
|       | 
|     if ItemCommon.GetEquipPackIndex(curItem) != equipPackIndex:  | 
|         #¼ì²é×°±¸Î»ÖúÍÌî±íÊÇ·ñÒ»Ö  | 
|         return False  | 
|       | 
|     #--ÉèÖô©ÉÏÎïÆ·ÐǼ¶--  | 
|     #===========================================================================  | 
|     # if changeItemEquipPlace in ShareDefine.RoleEquipType:  | 
|     #    equipPartStar = GetEquipPartPlusLV(curPlayer, IPY_GameWorld.rptEquip, changeItemEquipPlace)  | 
|     #    if equipPartStar != curItem.GetItemStarLV():  | 
|     #        curItem.SetItemStarLV(equipPartStar)  | 
|     #===========================================================================  | 
|             #GameWorld.DebugLog("´©ÉϵÄ×°±¸ÉèÖÃÐǼ¶: index=%s,star=%s" % (changeItemEquipPlace, equipPartStar))  | 
|       | 
|     #---¿ªÊ¼»»×°Âß¼---  | 
|       | 
|     #¼Ç¼»»×°ÎïÆ·ÐÅÏ¢  | 
|     itemClassLV = ItemCommon.GetItemClassLV(curItem)  | 
|     changeItemID = curItem.GetItemTypeID()  | 
|     changeItemStarLV = 0  #curItem.GetItemStarLV()  | 
|     changeItemStoneCnt = 0  #curItem.GetUseStoneCount()  | 
|     changeItemHoleCnt = 0  #curItem.GetCanPlaceStoneCount()  | 
|     changeItemUseData = curItem.GetUserData()  | 
|     suiteID = curItem.GetSuiteID()  | 
|     endureReduceType = curItem.GetEndureReduceType()  | 
|     #changeItemIsHorse = (curItem.GetType() == ChConfig.Def_Item_Type_Horse)  | 
|       | 
|     #Ö´Ðл»×°¶¯×÷  | 
|     equipPlace = playerItemControl.EquipItem(curItem, equipPackIndex)  | 
|       | 
|     if equipPlace == -1:  | 
|         return False  | 
|       | 
|     equipPack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptEquip)  | 
|     curEquip = equipPack.GetAt(equipPackIndex)  | 
|   | 
|     if curEquip.GetUserAttr(ShareDefine.Def_IudetCreateTime) == 0:  | 
|         curEquip.SetUserAttr(ShareDefine.Def_IudetCreateTime, int(time.time()))  | 
|     #---»»×°³É¹¦---  | 
|     if equipPackIndex in PlayerControl.GetFaceEquipIndexList(curPlayer) or equipPlace in ChConfig.Def_SyncEquipStateByIndex:  | 
|         #֪ͨ¿Í»§¶Ë½»»»ÎïÆ·  | 
|         curPlayer.ChangeEquip(changeItemID, equipPackIndex, changeItemStarLV, changeItemHoleCnt, changeItemStoneCnt, changeItemUseData)  | 
|     if suiteID and itemClassLV == GetEquipFacadeClassLV(curPlayer):  | 
|         #´©µ±Ç°Íâ¹Û½×µÄÌ××°  | 
|         ChangeEquipfacadeByClassLV(curPlayer, itemClassLV)  | 
|       | 
|     if not endureReduceType:  | 
|         EventShell.EventRespons_EquipByPlace(curPlayer, itemClassLV, equipPlace)  | 
|     #¼Ç¼³È×°¡¢ºì×°  | 
|     #===========================================================================  | 
|     # if itemQuality in [ChConfig.Def_Quality_Orange, ChConfig.Def_Quality_Red]:  | 
|     #    classLV = ItemCommon.GetItemClassLV(curItem)  | 
|     #    EventReport.WriteEvent_orange_equip(curPlayer, changeItemEquipPlace, classLV, itemQuality)  | 
|     #===========================================================================  | 
|           | 
|     #ÌØÊâ×°±¸, ²»ÐèҪˢÊôÐÔ  | 
|     if changeItemEquipPlace in ChConfig.EquipItemNoRefreshState:  | 
|         return True  | 
|       | 
|     curPlayer.SetDict(ChConfig.Def_PlayerKey_AttrActivatyNotify, ChConfig.Def_AttrActivatyNotify_Equip)  | 
|       | 
|     #ÏÈË¢×°±¸BUFF ÔÙ¼ÆËãÊôÐÔ  | 
|     if changeItemEquipPlace == ShareDefine.retWing:  | 
|         PlayerWing.CalcWingAttr(curPlayer)  | 
|     else:  | 
|         RefreshPlayerEquipAttribute(curPlayer, itemClassLV)  | 
|       | 
|     #Ë¢ÐÂËùÓÐÊôÐÔ  | 
|     playControl = PlayerControl.PlayerControl(curPlayer)  | 
|     playControl.RefreshPlayerAttrState()  | 
|     return True  | 
|   | 
|   | 
|       | 
| ## Ë¢ÐÂ×°±¸¶ÔÈËÎïÊôÐÔµÄ¸Ä±ä  | 
| #  @param self ÀàʵÀý  | 
| #  @return ·µ»ØÖµÎÞÒâÒå  | 
| #  @remarks Ë¢ÐÂ×°±¸¶ÔÈËÎïÊôÐÔµÄ¸Ä±ä  | 
| def RefreshPlayerEquipAttribute(curPlayer, classLV=0):  | 
|     GameWorld.DebugLog("Start RefreshPlayerEquipAttribute classLV=%s!!!" % classLV)  | 
|     classlvList = xrange(1, IpyGameDataPY.GetFuncCfg('EquipMaxClasslv') + 1) if classLV == 0 else [classLV]  | 
|     for rclasslv in classlvList:  | 
|         __CalcEquips_Effect(curPlayer, rclasslv)  | 
|   | 
|     #if isRefreshEquipBuff:  | 
|     #    __RefreshPlayerAllEquipBuff(curPlayer)  | 
|     return  | 
|   | 
| ## Ë¢ÐÂËùÓÐ×°±¸¶ÔÈËÎïÊôÐÔµÄ¸Ä±ä  | 
| #  @param self ÀàʵÀý  | 
| #  @return ·µ»ØÖµÎÞÒâÒå  | 
| #  @remarks Ë¢ÐÂ×°±¸¶ÔÈËÎïÊôÐÔµÄ¸Ä±ä  | 
| #===============================================================================  | 
| # def __RefreshPlayerAllEquipBuff(curPlayer):  | 
| #    #³õʼ»¯ÈËÎï×°±¸buff  | 
| #    curPlayer.GetEquipBuff().Clear()  | 
| #   | 
| #    packType = IPY_GameWorld.rptEquip  | 
| #          | 
| #    equipPackList = [IPY_GameWorld.rptEquip, IPY_GameWorld.rptHorseEquip]  | 
| #      | 
| #    #stoneLVCntList = []  | 
| #    #===========================================================================  | 
| #    orangeQualityCnt = 0 #³Èɫװ±¸ÊýÁ¿(°üº¬³ÈɫƷÖÊÒÔÉϵÄ×°±¸ÊýÁ¿)  | 
| #    for packIndex in equipPackList:  | 
| #        equipPack = curPlayer.GetItemManager().GetPack(packIndex)  | 
| #      | 
| #        for equipIndex in range(0, equipPack.GetCount()):  | 
| #              | 
| #            #±¸ÓÃ×°±¸À¸²»´¦Àí  | 
| #            if packIndex == IPY_GameWorld.rptEquip and equipIndex not in ShareDefine.RoleEquipType:  | 
| #                continue  | 
| #              | 
| #            curEquip = equipPack.GetAt(equipIndex)  | 
| #              | 
| #            if curEquip.IsEmpty():  | 
| #                continue  | 
| #   | 
| #            if not ItemCommon.CheckItemCanUseByExpireTime(curEquip):  | 
| #                # ¹ýÆÚ  | 
| #                continue  | 
| #              | 
| #            #×°±¸´¥·¢µÄ¼¼ÄÜ £¨È«Éí£©  | 
| #            CalcCurEquip_SkillBuff(curPlayer, curEquip)  | 
| #              | 
| #              | 
| #              | 
| #            # ºóÃæµÄΪ½Çɫװ±¸×¨Óô¦Àí  | 
| #            #===================================================================  | 
| #            # if packIndex != IPY_GameWorld.rptEquip:  | 
| #            #    continue  | 
| #            #   | 
| #            # if isSuite or curEquip.GetItemTypeID() in ReadChConfig.GetEvalChConfig("AddSuiteNumEquitList"):  | 
| #            #    suiteEquipCnt += 1  | 
| #            #===================================================================  | 
| #              | 
| #    #Ì××°¼Óbuff ¸ù¾Ý×°±¸ÏÖÓеÄÌ××°µÄ¸öÊý×Öµä   | 
| # #===============================================================================  | 
| # #    #È«Éí³Èɫװ±¸ÊýÁ¿´¥·¢Ïà¹Ø  | 
| # #    OnOrangeQualityCntChange(curPlayer, orangeQualityCnt)  | 
| # #      | 
| # #    # ÖØÖü¤»îÌáʾÀàÐÍΪNone  | 
| # #    curPlayer.SetDict(ChConfig.Def_PlayerKey_AttrActivatyNotify, ChConfig.Def_AttrActivatyNotify_None)  | 
| # #===============================================================================  | 
| #      | 
| #    # ×°±¸ÄÚ²ãbuff  | 
| #    allAttrListEquip = [{} for i in range(4)] # ²»°üº¬³á°ò¼°×°±¸ÉÏÏâǶµÄ±¦Ê¯  | 
| #    SkillShell.CalcCurBuffer_Effect(curPlayer.GetEquipBuff(), curPlayer, allAttrListEquip)  | 
| #    PlayerControl.SetCalcAttrListValue(curPlayer, ChConfig.Def_CalcAttrFunc_EquipBuff, allAttrListEquip)  | 
| #      | 
| #    # ×°±¸Íâ²ãbuffÊôÐÔ£¬´ËbuffËãÕ½Á¦  | 
| #    allAttrListEquptBuffs = [{} for i in range(4)]  | 
| #    SkillShell.CalcCurBuffer_Effect(curPlayer.GetEquipBuff(), curPlayer,   | 
| #                                    allAttrListEquptBuffs, [], ChConfig.CalcBuffLevel_1)  | 
| #    PlayerControl.SetCalcAttrListValue(curPlayer, ChConfig.Def_CalcAttrFunc_EquipBuff1, allAttrListEquptBuffs)  | 
| #      | 
| #    return  | 
| #===============================================================================  | 
|   | 
|   | 
| #===============================================================================  | 
| # #//07 03 ÈËÎï×°±¸ÎïÆ·#tagCEquipItem  | 
| # //½Çɫװ±¸ÀàÐÍ  | 
| # int GetRoleEquipType();  | 
| # //ÎïÆ·ÔÚÎïÆ·±³°üµÄË÷Òý  | 
| # int GetItemIndex();  | 
| #===============================================================================  | 
| ## ÈËÎï×°±¸ÎïÆ·  | 
| #  @param index ±³°üË÷Òý  | 
| #  @param tick µ±Ç°Ê±¼ä  | 
| #  @return None  | 
| #  @remarks ¿Í»§¶Ë·â°üÏìÓ¦ //07 03 ÈËÎï×°±¸ÎïÆ·#tagCEquipItem  | 
| def PlayerEquipItem(index, tick):  | 
|     GameWorld.GetPsycoFunc(__Func_PlayerEquipItem)(index, tick)  | 
|     return  | 
|   | 
|   | 
| ## ÈËÎï×°±¸ÎïÆ·  | 
| #  @param index ±³°üË÷Òý  | 
| #  @param tick µ±Ç°Ê±¼ä  | 
| #  @return None  | 
| #  @remarks ¿Í»§¶Ë·â°üÏìÓ¦ //07 03 ÈËÎï×°±¸ÎïÆ·#tagCEquipItem  | 
| def __Func_PlayerEquipItem(index, tick):  | 
|     curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)  | 
|     sendPack = IPY_GameWorld.IPY_CEquipItem()  | 
|     #ÎïÆ·ÔÚÎïÆ·±³°üµÄË÷Òý  | 
|     packItemIndex = sendPack.GetItemIndex()  | 
|     #½Çɫװ±¸²¿Î»  | 
|     equipPackIndex = sendPack.GetRoleEquipType()  | 
|       | 
|     #¼ì²éÍæ¼Ò״̬ÊÇ·ñ¿ÉÒÔ»»×°  | 
|     if not CheckPlayerCanEquipItem(curPlayer):  | 
|         return  | 
|       | 
|     #¼ì²é»»×°¼ä¸ô  | 
|     #===========================================================================  | 
|     # if tick - curPlayer.GetLastChangeEquipTick() <= ChConfig.Def_MinChangeEquipTime:  | 
|     #    #GameWorld.Log("¸ü»»×°±¸Ê±¼ä¹ý¶Ì! %d"%(tick - curPlayer.GetLastChangeEquipTick()))         | 
|     #    return  | 
|     #   | 
|     # curPlayer.SetLastChangeEquipTick(tick)  | 
|     #===========================================================================  | 
|       | 
|     #---»ñÈ¡·â°üÐèҪװ±¸µÄÎïÆ·---  | 
|     rolePack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptItem)  | 
|     curItem = rolePack.GetAt(packItemIndex)  | 
|     #---Ö´ÐÐÍæ¼Ò»»×°Âß¼---  | 
|     if DoPlayerEquipItem(curPlayer, curItem, equipPackIndex, tick):  | 
|         return  | 
|       | 
|     #»»×°Ê§°Ü֪ͨ¿Í»§¶ËÐÅÏ¢  | 
|     curPlayer.Notify_ItemPutFail(IPY_GameWorld.rptItem, packItemIndex, IPY_GameWorld.rptEquip, 0)  | 
|     return  | 
|   | 
|   | 
| #---------------------------------------------------------------------  | 
| ## Ò»¼ü»»×°£¨·â°ü£©  | 
| #  @param index Íæ¼ÒË÷Òý  | 
| #  @param tick µ±Ç°Ê±¼ä  | 
| #  @return None  | 
| #  @remarks º¯ÊýÏêϸ˵Ã÷.  | 
| def OneKeyChangeEquip(index, tick):  | 
|     return  | 
|   | 
|   | 
| ## Íæ¼ÒжÏÂ×°±¸(·â°ü²ÎÊý)  | 
| #  @param index Íæ¼ÒË÷Òý  | 
| #  @param tick µ±Ç°Ê±¼ä  | 
| #  @return None  | 
| #  @remarks º¯ÊýÏêϸ˵Ã÷.  | 
| def PlayerUnEquip(index, tick):  | 
|     GameWorld.GetPsycoFunc(__Func_PlayerUnEquip)(index, tick)  | 
|     return  | 
|   | 
|   | 
| #---------------------------------------------------------------------      | 
| ## Íæ¼ÒжÏÂ×°±¸(·â°ü²ÎÊý)  | 
| #  @param index Íæ¼ÒË÷Òý  | 
| #  @param tick µ±Ç°Ê±¼ä  | 
| #  @return None  | 
| #  @remarks º¯ÊýÏêϸ˵Ã÷.  | 
| def __Func_PlayerUnEquip(index, tick):  | 
|     sendPack = IPY_GameWorld.IPY_CUnEquipItem()  | 
|     curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)  | 
|       | 
|     if not CheckPlayerCanEquipItem(curPlayer):  | 
|         return  | 
|       | 
|     equipPackIndex = sendPack.GetEquipIndex()  | 
|   | 
|     #Èç¹ûжϵÄÊÇÂíÆ¥£¬ÐèÒªÅж¨Èç¹ûÂíÆ¥×°±¸±³°üÓÐÎïÆ·£¬²»È÷ÅÏ  | 
|     #===========================================================================  | 
|     # if equipIndex == IPY_GameWorld.rptHorse :  | 
|     #    itemEquipPack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptHorseEquip)  | 
|     #      | 
|     #    if not ItemControler.GetPackIsEmpty(itemEquipPack):  | 
|     #        PlayerControl.NotifyCode(curPlayer, "7E355D97-520A-4A8C-8BC993AAEAF6071F")  | 
|     #        return  | 
|     #===========================================================================  | 
|       | 
|     playerItemControl = ItemControler.PlayerItemControler(curPlayer)  | 
|     result = playerItemControl.UnEquipItem(equipPackIndex, sendPack.GetPackIndex())  | 
|       | 
|     if not result:  | 
|         #жÏÂ×°±¸Ê§°Ü  | 
|         return  | 
|       | 
|     equipID = result[0]  | 
|     equipPlace = result[1]  | 
|     itemClassLV = result[2]  | 
|       | 
|     ##ÌØÊâ×°±¸ , ²»ÐèÒª³åË¢ÊôÐÔ  | 
|     if equipPlace in ChConfig.EquipItemNoRefreshState:  | 
|         return  | 
|       | 
|     #ÏÈË¢×°±¸BUFF ÔÙ¼ÆËãÊôÐÔ  | 
|     if equipPlace == ShareDefine.retWing:  | 
|         PlayerWing.CalcWingAttr(curPlayer)  | 
|     else:  | 
|         RefreshPlayerEquipAttribute(curPlayer, itemClassLV)  | 
|       | 
|     #Ë¢ÐÂËùÓÐÊôÐÔ  | 
|     playControl = PlayerControl.PlayerControl(curPlayer)  | 
|     playControl.RefreshPlayerAttrState()  | 
|     return  | 
|   | 
|   | 
| #---------------------------------------------------------------------  | 
| ## Íæ¼ÒʹÓÃ×°±¸(ÔÚ×°±¸À¸ÉϵÄÌØÊâÎïÆ·:Èçµ°°×)(·â°ü²ÎÊý)  | 
| #  @param index Íæ¼ÒË÷Òý  | 
| #  @param tick µ±Ç°Ê±¼ä  | 
| #  @return None  | 
| #  @remarks º¯ÊýÏêϸ˵Ã÷.  | 
| def __Func_PlayerUseEquipSelf(index, tick):  | 
|     sendPack = IPY_GameWorld.IPY_CUseEquip()  | 
|     curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)  | 
|       | 
|     #ʹÓÃÎïÆ·ÐÐΪ״̬, ÅжϿͻ§¶ËÏÞÖÆ  | 
|     if not OperControlManager.IsObjCanDoAction(  | 
|                                         curPlayer,  | 
|                                         ChConfig.Def_Obj_ActState_ClientAct,  | 
|                                         IPY_GameWorld.oalUseItem  | 
|                                         ):  | 
|         return  | 
|       | 
|     #¼ì²éʹÓÃÎïÆ·µÄÍæ¼ÒÊôÐÔ  | 
|     if not ChItem.CheckUseItemSelf_Player(curPlayer):  | 
|         return  | 
|       | 
|     roleEquipPack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptEquip)  | 
|     #»ñµÃËùҪʹÓõÄ×°±¸  | 
|     equipIndex = sendPack.GetEquipIndex()  | 
|     curEquip = roleEquipPack.GetAt(equipIndex)  | 
|       | 
|     if not ItemCommon.CheckItemCanUse(curEquip) or ItemControler.GetIsAuctionItem(curEquip):  | 
|         return  | 
|       | 
|     #FB½ûֹʹÓÃÎïÆ·  | 
|     if FBLogic.DoFBForbidUseItem(curPlayer, curEquip):  | 
|         return  | 
|       | 
|     if ItemControler.IsEventItem(curEquip):  | 
|         PlayerControl.NotifyCode(curPlayer, "TaskRes")  | 
|         return  | 
|       | 
|     else:  | 
|         PlayerControl.NotifyCode(curPlayer, "GeRen_chenxin_774045")  | 
|         return  | 
|       | 
|     return  | 
|   | 
| def __CalcEquips_Effect(curPlayer, classLV):  | 
|     ''' ¾³½ç×°±¸ÏµÍ³ÊôÐÔ  | 
|     1. ×°±¸Ä£¿é£¨×°±¸±¾ÉíÊôÐÔ+×°±¸Î»ÉýÐÇÊôÐÔ+×°±¸Î»Ì××°ÊôÐÔ£©£¬Ã¿¸ö¾³½ç½×¶ÀÁ¢£¬Ã¿¸ö¾³½çÕ½Á¦¶ÀÁ¢Ä£¿é¼ÆËã  | 
|                     ×°±¸»ù´¡ÊôÐÔ = ×°±¸ÎïÆ·±íÅäÖÃÊôÐÔ + ÐǼ¶»ù´¡ÊôÐÔ¼Ó³É  | 
|         1.1 ×°±¸±¾ÉíÊôÐÔ: ²»ÄÜÓÐÓ°ÏìÆäËû¾³½ç×°±¸µÄÊôÐÔ  | 
|                                 »ù´¡ÊôÐÔ: ÎïÆ·±íÖеÄÅäÖà  | 
|                                 ´«ÆæÊôÐÔ:   | 
|                                 ¾ø°æÊôÐÔ:   | 
|                       | 
|         1.2 ×°±¸Î»ÉýÐÇÊôÐÔ£º²»ÄÜÓÐÓ°ÏìÆäËû¾³½ç×°±¸µÄÊôÐÔ  | 
|                                 ÉýÐÇ»ù´¡ÊôÐÔ£¬ÊôÐÔÊôÓÚ×°±¸»ù´¡  | 
|                                 ÉýÐǵȼ¶ÊôÐÔ£¬»áÓ°Ïì±¾½××°±¸»ù´¡  | 
|                                 ÐǼ¶Ì××°ÊôÐÔ£¬Ïê¼ûÌ××°ÊôÐÔ  | 
|                       | 
|         1.3 ×°±¸Î»Ì××°ÊôÐÔ£º²»ÄÜÓÐÓ°ÏìÆäËû¾³½ç×°±¸µÄÊôÐÔ  | 
|                                 ÓÉ×°±¸Î»ÊÇ·ñÌ××°¼°ÐǼ¶Êý¾ö¶¨Ì××°ÊôÐÔ  | 
|               | 
|     2.×°±¸Î»Ç¿»¯Ä£¿é£ºÕ½Á¦ÎªËùÓо³½ç×°±¸Î»Ç¿»¯ÊôÐÔ×ܺÍÕ½Á¦  | 
|                     Ç¿»¯µÈ¼¶ÊôÐÔ      | 
|                     ½ø»¯µÈ¼¶ÊôÐÔ£¬Ó°Ïì±¾²¿Î»±¾¾³½ç×°±¸»ù´¡  | 
|                       | 
|     3.×°±¸Î»±¦Ê¯ÊôÐÔ£ºÕ½Á¦ÎªËùÓо³½ç×°±¸Î»±¦Ê¯ÊôÐÔ×ܺÍÕ½Á¦  | 
|                     ±¦Ê¯µÈ¼¶ÊôÐÔ  | 
|                     ±¦Ê¯¾õÐÑÊôÐÔ£¬»áÓ°Ïì±¾½××°±¸»ù´¡  | 
|                       | 
|     4.×°±¸Î»Ï´Á·ÊôÐÔ£ºÕ½Á¦ÎªËùÓо³½ç×°±¸Î»Ï´Á·ÊôÐÔ×ܺÍÕ½Á¦  | 
|                     Ï´Á·µÈ¼¶ÊôÐÔ  | 
|                     Ï´Á·Ì××°ÊôÐÔ£¬»áÓ°Ïì±¾½××°±¸»ù´¡  | 
|     '''  | 
|       | 
|     equipMFPTypeList = range(ShareDefine.Def_MFPType_Equip1, ShareDefine.Def_MFPType_Equip15 + 1)  | 
|     if classLV < 1 or classLV > len(equipMFPTypeList):  | 
|         GameWorld.ErrLog("Ë¢¾³½ç×°±¸ÊôÐÔ½×´íÎó!µ±Ç°²»Ö§³Ö¸Ã½×Ä£¿é: classLV=%s" % classLV)  | 
|         return  | 
|     Def_MFPType_EquipClassLV = equipMFPTypeList[classLV - 1]  | 
|     if Def_MFPType_EquipClassLV not in ChConfig.MFPTypeAttrFuncIndexDict:  | 
|         GameWorld.ErrLog("Ë¢¾³½ç×°±¸ÊôÐÔ½×´íÎó!µ±Ç°²»Ö§³Ö¸Ã½×ÊôÐÔ: classLV=%s" % classLV)  | 
|         return  | 
|     Def_CalcAttrFunc_EquipClassLV = ChConfig.MFPTypeAttrFuncIndexDict[Def_MFPType_EquipClassLV][0]  | 
|     #GameWorld.DebugLog("----- Ë¢¾³½ç×°±¸Õ½Á¦: classLV=%s" % (classLV))  | 
|       | 
|     allEquipBaseAttrDict = {} # ËùÓÐ×°±¸»ù´¡ÊôÐÔ {attrID:value, ...}  | 
|     baseEquipBaseAttrDict = {} # »ù´¡×°±¸»ù´¡ÊôÐÔ{attrID:value, ...}  | 
|     equipBaseAttrDict = {} # ×°±¸»ù´¡ÊôÐÔ {×°±¸Î»:{attrID:value, ...}, ...}  | 
|       | 
|     allAttrListEquip = [{} for _ in range(4)]  # ×°±¸ÊôÐÔ  | 
|     equip_addEquipBaseAttrPerList = [{}, {}, {}] # ×°±¸¹¦Äܵã¶Ô×°±¸»ù´¡µÄ¼Ó³ÉÐÅÏ¢  | 
|     allAttrListPlus = [{} for _ in range(4)]  # Ç¿»¯ÊôÐÔ  | 
|     plus_addEquipBaseAttrPerList = [{}, {}, {}] # Ç¿»¯¹¦Äܵã¶Ô×°±¸»ù´¡µÄ¼Ó³ÉÐÅÏ¢  | 
|     allAttrListStone = [{} for _ in range(4)]  # ±¦Ê¯ÊôÐÔ  | 
|     #stone_addEquipBaseAttrPerList = [{}, {}, {}] # ±¦Ê¯¹¦Äܵã¶Ô×°±¸»ù´¡µÄ¼Ó³ÉÐÅÏ¢  | 
|     allAttrListWash = [{} for _ in range(4)]  # Ï´Á·ÊôÐÔ  | 
|     #wash_addEquipBaseAttrPerList = [{}, {}, {}] # Ï´Á·¹¦Äܵã¶Ô×°±¸»ù´¡µÄ¼Ó³ÉÐÅÏ¢  | 
|     #allAttrListOutOfPrintEquip = [{} for _ in range(4)]  # ¾ø°æ×°±¸ÊôÐÔ ÐèÔڵȼ¶±ä»¯¶ÀÁ¢¼ÆËã  | 
|       | 
|     packType = IPY_GameWorld.rptEquip  | 
|     playerEquip = curPlayer.GetItemManager().GetPack(packType)  | 
|     equipPartStarIndexList = ChConfig.Pack_EquipPart_CanPlusStar.get(packType, [])  | 
|     #maxSuiteType = IpyGameDataPY.GetFuncCfg('EquipSuitColorStar', 2)  #×î´óÌ××°ÀàÐÍ  | 
|     #equipPlaceList = []  # Óд©´÷×°±¸µÄ×°±¸Î»ÁÐ±í  | 
|     suitCntDict = {}  #Ì××°ÊýÁ¿×Öµä  | 
|     #legendAttrDict = {}  #ËùÓд«ÆæÊôÐÔ  | 
|     equipScoreTotal = 0  #Ϊ½â¾ö×°±¸ÆÀ·Ö¡¢Õ½Á¦²»Ò»ÖµÄÇé¿ö£¬×°±¸Õ½Á¦¸ÄΪÓÉÆÀ·Ö×÷Ϊ²ÎÊý¼ÆËãÕ½Á¦  | 
|       | 
|     # 1. Ñ»·±éÀú±¾½××°±¸  | 
|     for equipPlace in equipPartStarIndexList:  | 
|         ipyData = IpyGameDataPY.GetIpyGameData('EquipPlaceIndexMap', classLV, equipPlace)  | 
|         if not ipyData:  | 
|             continue  | 
|         equipIndex = ipyData.GetGridIndex()  | 
|         curEquip = playerEquip.GetAt(equipIndex)  | 
|         if not curEquip or curEquip.IsEmpty():  | 
|             continue  | 
|           | 
|         #if not ItemCommon.CheckItemCanUseByExpireTime(curEquip):  | 
|         #    # ¹ýÆÚ£¬Ôݲ»Åжϣ¬ÒÔºó¾³½ç×°±¸ÓÐʱЧװ±¸ÔÙ¿ªÆô  | 
|         #    continue  | 
|           | 
|         #equipPlaceList.append(equipIndex)  | 
|         equipScoreTotal += ItemCommon.GetEquipGearScore(curEquip)  | 
|           | 
|         baseAttrDict = {} # ×°±¸Î»»ù´¡ÊôÐÔ: ÎïÆ·±í + ÐǼ¶»ù´¡  | 
|         isBaseEquip = equipPlace in ChConfig.EquipPlace_Base  | 
|           | 
|         #GameWorld.DebugLog("×°±¸Î» %s: itemID=%s,isBaseEquip=%s,equipScoreTotal=%s" % (equipPlace, curEquip.GetItemTypeID(), isBaseEquip, equipScoreTotal))  | 
|           | 
|         #»ù´¡ÊôÐÔЧ¹û  | 
|         for i in xrange(curEquip.GetEffectCount()):  | 
|             curEffect = curEquip.GetEffectByIndex(i)  | 
|             if not curEffect:  | 
|                 break  | 
|             effectID = curEffect.GetEffectID()  | 
|             if effectID == 0:  | 
|                 #×îºóÒ»¸ö  | 
|                 break  | 
|             effectValue = curEffect.GetEffectValue(0)  | 
|             if not effectValue:  | 
|                 continue  | 
|             PlayerControl.CalcAttrDict_Type(effectID, effectValue, allAttrListEquip)  | 
|             baseAttrDict[effectID] = baseAttrDict.get(effectID, 0) + effectValue  | 
|             allEquipBaseAttrDict[effectID] = allEquipBaseAttrDict.get(effectID, 0) + effectValue  | 
|             if isBaseEquip:  | 
|                 baseEquipBaseAttrDict[effectID] = baseEquipBaseAttrDict.get(effectID, 0) + effectValue  | 
|             #GameWorld.DebugLog("    ÎïÆ·±íÊôÐÔ: ID=%s +%s" % (effectID, effectValue))  | 
|                   | 
|         #ÐÇÊýÊôÐÔ  | 
|         equipPartStar = GetEquipPartStarByRank(curPlayer, equipIndex, curEquip) # ÉúЧµÄÐÇÊý  | 
|         if equipPartStar:  | 
|             #GameWorld.DebugLog("    ÐǼ¶ÊôÐÔ: classLV=%s, equipPlace=%s, equipPartStar=%s" % (classLV, equipPlace, equipPartStar))  | 
|             ipyData = IpyGameDataPY.GetIpyGameData('EquipStarUp', classLV, equipPlace, equipPartStar)  | 
|             starBaseAttrDict = {} if not ipyData else ipyData.GetBaseAttrInfo() # ÐǼ¶»ù´¡  | 
|             for starBaseAttrID, starBaseAttrValue in starBaseAttrDict.items():  | 
|                 PlayerControl.CalcAttrDict_Type(starBaseAttrID, starBaseAttrValue, allAttrListEquip)  | 
|                 baseAttrDict[starBaseAttrID] = baseAttrDict.get(starBaseAttrID, 0) + starBaseAttrValue  | 
|                 allEquipBaseAttrDict[starBaseAttrID] = allEquipBaseAttrDict.get(starBaseAttrID, 0) + starBaseAttrValue  | 
|                 if isBaseEquip:  | 
|                     baseEquipBaseAttrDict[starBaseAttrID] = baseEquipBaseAttrDict.get(starBaseAttrID, 0) + starBaseAttrValue  | 
|                 #GameWorld.DebugLog("    ÐǼ¶»ù´¡ÊôÐÔ: ID=%s +%s" % (starBaseAttrID, starBaseAttrValue))  | 
|                       | 
|             starAttrDict = {} if not ipyData else ipyData.GetStarAttrInfo() # ÐǼ¶¸½¼Ó  | 
|             for starAttrID, starAttrValue in starAttrDict.items():  | 
|                 PlayerControl.CalcAttrDict_Type(starAttrID, starAttrValue, allAttrListEquip)  | 
|                 #GameWorld.DebugLog("    ÐǼ¶¸½¼ÓÊôÐÔ: ID=%s +%s" % (starAttrID, starAttrValue))  | 
|                 __CalcFuncAddEquipAttrPer(equipPlace, starAttrID, starAttrValue, equip_addEquipBaseAttrPerList)  | 
|                   | 
|         equipBaseAttrDict[equipPlace] = baseAttrDict  | 
|           | 
|         #Ì××°¼ÆÊý  | 
|         suiteID = curEquip.GetSuiteID()  | 
|         if suiteID:  | 
|             if suiteID not in suitCntDict:  | 
|                 suitCntDict[suiteID] = []  | 
|             suitCntDict[suiteID].append(equipPartStar)  | 
|               | 
|         #´«ÆæÊôÐÔ  | 
|         legendAttrCount = curEquip.GetUserAttrCount(ShareDefine.Def_IudetLegendAttrID)  | 
|         legendAttrValueCount = curEquip.GetUserAttrCount(ShareDefine.Def_IudetLegendAttrValue)  | 
|         if legendAttrCount and legendAttrCount == legendAttrValueCount:  | 
|             for legendIndex in xrange(legendAttrCount):  | 
|                 legendAttrID = curEquip.GetUserAttrByIndex(ShareDefine.Def_IudetLegendAttrID, legendIndex)  | 
|                 legendAttrValue = curEquip.GetUserAttrByIndex(ShareDefine.Def_IudetLegendAttrValue, legendIndex)  | 
|                 PlayerControl.CalcAttrDict_Type(legendAttrID, legendAttrValue, allAttrListEquip)  | 
|                 #GameWorld.DebugLog("    ´«ÆæÊôÐÔ: ID=%s +%s" % (legendAttrID, legendAttrValue))  | 
|                 __CalcFuncAddEquipAttrPer(equipPlace, legendAttrID, legendAttrValue, equip_addEquipBaseAttrPerList)  | 
|                   | 
|         #¾øÊÀÊôÐÔ - Ôݲ»¿¼ÂÇ  | 
|         #CalcAttr_OutOfPrintAttr(curPlayer, curEquip, allAttrListOutOfPrintEquip)  | 
|           | 
|         #ÎïÆ·Ç¿»¯ÊôÐÔ  | 
|         __CalcAttr_ItemPlus(curPlayer, curEquip, packType, equipIndex, allAttrListPlus, plus_addEquipBaseAttrPerList)  | 
|           | 
|         #¼ÆËã×°±¸±¦Ê¯¼Ó³É  | 
|         CalcEquipStone_Effect(curPlayer, equipIndex, allAttrListStone)  | 
|           | 
|         #Ï´Á·ÊôÐÔ  | 
|         Operate_EquipWash.CalcAttr_EquipWash(curPlayer, equipIndex, equipPlace, allAttrListWash)  | 
|       | 
| #    GameWorld.DebugLog("    ×°±¸Ñ»·ÊôÐÔ: %s" % (allAttrListEquip))  | 
| #    GameWorld.DebugLog("    Ç¿»¯Ñ»·ÊôÐÔ: %s" % (allAttrListPlus))  | 
| #    GameWorld.DebugLog("    ±¦Ê¯Ñ»·ÊôÐÔ: %s" % (allAttrListStone))  | 
| #    GameWorld.DebugLog("    Ï´Á·Ñ»·ÊôÐÔ: %s" % (allAttrListWash))  | 
| #    GameWorld.DebugLog("    -----" )  | 
|     # 2. ¼ÆËã±éÀúºóµÄ¸½¼ÓÊôÐÔ  | 
|     #Ì××°ÊôÐÔ  | 
|     CalcEquipSuiteAttr(curPlayer, suitCntDict, allAttrListEquip)  | 
|       | 
|     #GameWorld.DebugLog("    ×°±¸ÊôÐÔÌ××°: %s" % (allAttrListEquip))  | 
|       | 
|     # 3. ¼ÆËã¶Ô×°±¸»ù´¡µÄ¸½¼Ó¼Ó³É  | 
| #    GameWorld.DebugLog("    -----" )  | 
| #    GameWorld.DebugLog("    ËùÓÐ×°±¸»ù´¡ÊôÐÔ: %s" % (allEquipBaseAttrDict))  | 
| #    GameWorld.DebugLog("    »ù´¡×°±¸»ù´¡ÊôÐÔ: %s" % (baseEquipBaseAttrDict))  | 
| #    GameWorld.DebugLog("    µ¥¼þ×°±¸»ù´¡ÊôÐÔ: %s" % (equipBaseAttrDict))  | 
|     #¼ÆË㹦Äܵã¶Ô×°±¸»ù´¡µÄ¼Ó³É  | 
|     __CalcFuncAddEquipAttrValue(allEquipBaseAttrDict, baseEquipBaseAttrDict, equipBaseAttrDict, equip_addEquipBaseAttrPerList, allAttrListEquip, "Equip")  | 
|     __CalcFuncAddEquipAttrValue(allEquipBaseAttrDict, baseEquipBaseAttrDict, equipBaseAttrDict, plus_addEquipBaseAttrPerList, allAttrListPlus, "Plus")  | 
|     #__CalcFuncAddEquipAttrValue(allEquipBaseAttrDict, baseEquipBaseAttrDict, equipBaseAttrDict, stone_addEquipBaseAttrPerList, allAttrListStone, "Stone")  | 
|     #__CalcFuncAddEquipAttrValue(allEquipBaseAttrDict, baseEquipBaseAttrDict, equipBaseAttrDict, wash_addEquipBaseAttrPerList, allAttrListWash, "Wash")  | 
|       | 
|     #GameWorld.DebugLog("    ±¾½××°±¸ÊôÐÔ: %s" % (allAttrListEquip))  | 
|       | 
|     #±£´æ¼ÆËãÖµ  | 
|     PlayerControl.SetCalcAttrListValue(curPlayer, Def_CalcAttrFunc_EquipClassLV, allAttrListEquip)  | 
|     #PlayerControl.SetCalcAttrListValue(curPlayer, ChConfig.Def_CalcAttrFunc_EquipOutOfPrint, allAttrListOutOfPrintEquip)  | 
|     #¼ÆËã×°±¸»ù´¡ÊôÐÔ¸½¼ÓÕ½Á¦ (Ŀǰ×é³É: ÆÀ·ÖÕ½Á¦ + ...)  | 
|     equipFightPowerEx = eval(IpyGameDataPY.GetFuncCompileCfg("FightpowerFormula", 2))  | 
|     #GameWorld.DebugLog("    ×°±¸ÆÀ·ÖÕ½Á¦: equipScoreTotal=%s,equipFightPowerEx=%s" % (equipScoreTotal, equipFightPowerEx))  | 
|     curPlayer.SetDict(ChConfig.Def_PlayerKey_MFPEx % Def_MFPType_EquipClassLV, equipFightPowerEx)  | 
|       | 
|     # 4. ÀÛ¼ÓËùÓн××°±¸Î»ÊôÐÔ  | 
|     playerID = curPlayer.GetPlayerID()  | 
|     if playerID not in PyGameData.g_playerEquipPartAttrDict:  | 
|         PyGameData.g_playerEquipPartAttrDict[playerID] = {}  | 
|     equipPartAttrDict = PyGameData.g_playerEquipPartAttrDict[playerID]  | 
|     equipPartAttrDict[classLV] = [allAttrListPlus, allAttrListStone, allAttrListWash]  | 
|       | 
|     allPartAttrListPlus = [{} for _ in range(4)]  | 
|     allPartAttrListStone = [{} for _ in range(4)]  | 
|     allPartAttrListWash = [{} for _ in range(4)]  | 
|       | 
| #    GameWorld.DebugLog("    ----- ÀÛ¼ÓËùÓн××°±¸Î»Ñø³ÉÊôÐÔ")  | 
| #    GameWorld.DebugLog("    ±¾½×Ç¿»¯ÊôÐÔ: %s" % (allAttrListPlus))  | 
| #    GameWorld.DebugLog("    ±¾½×±¦Ê¯ÊôÐÔ: %s" % (allAttrListStone))  | 
| #    GameWorld.DebugLog("    ±¾½×Ï´Á·ÊôÐÔ: %s" % (allAttrListWash))  | 
|       | 
|     for classLV, attrList in equipPartAttrDict.items():  | 
|         allAttrListPlus, allAttrListStone, allAttrListWash = attrList  | 
|         #GameWorld.DebugLog("    classLV=%s, %s" % (classLV, attrList))  | 
|         for i in xrange(4):  | 
|             PlayerControl.AddAttrDictValue(allPartAttrListPlus[i], allAttrListPlus[i])  | 
|             PlayerControl.AddAttrDictValue(allPartAttrListStone[i], allAttrListStone[i])  | 
|             PlayerControl.AddAttrDictValue(allPartAttrListWash[i], allAttrListWash[i])  | 
|               | 
| #    GameWorld.DebugLog("    ËùÓн×Ç¿»¯ÊôÐÔ: %s" % (allPartAttrListPlus))  | 
| #    GameWorld.DebugLog("    ËùÓнױ¦Ê¯ÊôÐÔ: %s" % (allPartAttrListStone))  | 
| #    GameWorld.DebugLog("    ËùÓн×Ï´Á·ÊôÐÔ: %s" % (allPartAttrListWash))  | 
|     PlayerControl.SetCalcAttrListValue(curPlayer, ChConfig.Def_CalcAttrFunc_Plus, allPartAttrListPlus)  | 
|     PlayerControl.SetCalcAttrListValue(curPlayer, ChConfig.Def_CalcAttrFunc_Stone, allPartAttrListStone)  | 
|     PlayerControl.SetCalcAttrListValue(curPlayer, ChConfig.Def_CalcAttrFunc_Wash, allPartAttrListWash)  | 
|     return  | 
|   | 
| def __CalcFuncAddEquipAttrPer(equipPlace, attrID, attrValue, addPerInfoList):  | 
|     ## ¼ÆËãÆäËû¹¦ÄÜÊôÐÔ¶Ô×°±¸»ù´¡ÊôÐÔµÄ¼Ó³É  | 
|           | 
|     if attrID not in ChConfig.EquipBassAttrAddInfoSet:  | 
|         return  | 
|     effPlace, calcAttrList = ChConfig.EquipBassAttrAddInfoSet[attrID]  | 
|     #GameWorld.DebugLog("        ×°±¸»ù´¡¼Ó³ÉÐÅÏ¢: ID=%s,effPlace=%s,calcAttrList=%s" % (attrID, effPlace, calcAttrList))  | 
|     # ËùÓв¿Î»  | 
|     if effPlace == -1:  | 
|         allPlaceAddPerDict = addPerInfoList[0]  | 
|         for calcAttrIndex in calcAttrList:  | 
|             allPlaceAddPerDict[calcAttrIndex] = allPlaceAddPerDict.get(calcAttrIndex, 0) + attrValue  | 
|         #GameWorld.DebugLog("            µ±Ç°¼Ó³ÉÐÅÏ¢=%s" % (addPerInfoList))  | 
|         return  | 
|           | 
|     # »ù´¡²¿Î»  | 
|     if effPlace == -2 and equipPlace in ChConfig.EquipPlace_Base:  | 
|         basePlaceAddPerDict = addPerInfoList[1]  | 
|         for calcAttrIndex in calcAttrList:  | 
|             basePlaceAddPerDict[calcAttrIndex] = basePlaceAddPerDict.get(calcAttrIndex, 0) + attrValue  | 
|         #GameWorld.DebugLog("            µ±Ç°¼Ó³ÉÐÅÏ¢=%s" % (addPerInfoList))  | 
|         return  | 
|       | 
|     # Ö¸¶¨²¿Î»  | 
|     elif effPlace > 0 and equipPlace == effPlace:  | 
|         assignPlaceAddPerDict = addPerInfoList[2]  | 
|         if equipPlace not in assignPlaceAddPerDict:  | 
|             assignPlaceAddPerDict[equipPlace] = {}  | 
|         curPlaceAddPerDict = assignPlaceAddPerDict[equipPlace]  | 
|         for calcAttrIndex in calcAttrList:  | 
|             curPlaceAddPerDict[calcAttrIndex] = curPlaceAddPerDict.get(calcAttrIndex, 0) + attrValue  | 
|         #GameWorld.DebugLog("            µ±Ç°¼Ó³ÉÐÅÏ¢=%s" % (addPerInfoList))  | 
|         return  | 
|       | 
|     return  | 
|   | 
| def __CalcFuncAddEquipAttrValue(allEquipBaseAttrDict, baseEquipBaseAttrDict, equipBaseAttrDict, addEquipBaseAttrPerList, allAttrList, sign=""):  | 
|     ## ¼ÆËãÆäËû¹¦ÄÜÊôÐÔ¶Ô×°±¸»ù´¡ÊôÐԼӳɵÄÊôÐÔ¾ßÌåÖµ  | 
|     allPlaceAddPerDict, basePlaceAddPerDict, assignPlaceAddPerDict = addEquipBaseAttrPerList  | 
|     #GameWorld.DebugLog("    ¼ÆË㹦Äܵã¶Ô×°±¸»ù´¡ÊôÐÔ¼Ó³É: %s" % sign)  | 
|     #GameWorld.DebugLog("        È«²¿×°±¸ÊôÐÔ: %s, ¼Ó³É%s" % (allEquipBaseAttrDict, allPlaceAddPerDict))  | 
|     for attrID, addPer in allPlaceAddPerDict.items():  | 
|         if attrID not in allEquipBaseAttrDict:  | 
|             continue  | 
|         baseValue = allEquipBaseAttrDict[attrID]  | 
|         addValue = int(baseValue * addPer / 10000.0)  | 
|         PlayerControl.CalcAttrDict_Type(attrID, addValue, allAttrList)  | 
|         #GameWorld.DebugLog("            ¼Ó³É: ID=%s +%s %s" % (attrID, addValue, addPer))  | 
|       | 
|     #GameWorld.DebugLog("        »ù´¡×°±¸ÊôÐÔ: %s, ¼Ó³É%s" % (baseEquipBaseAttrDict, basePlaceAddPerDict))  | 
|     for attrID, addPer in basePlaceAddPerDict.items():  | 
|         if attrID not in baseEquipBaseAttrDict:  | 
|             continue  | 
|         baseValue = baseEquipBaseAttrDict[attrID]  | 
|         addValue = int(baseValue * addPer / 10000.0)  | 
|         PlayerControl.CalcAttrDict_Type(attrID, addValue, allAttrList)  | 
|         #GameWorld.DebugLog("            ¼Ó³É: ID=%s +%s %s" % (attrID, addValue, addPer))  | 
|           | 
|     #GameWorld.DebugLog("        Ö¸¶¨×°±¸ÊôÐÔ: %s, ¼Ó³É%s" % (equipBaseAttrDict, assignPlaceAddPerDict))  | 
|     for equipPlace, addPerDict in assignPlaceAddPerDict.items():  | 
|         if equipPlace not in equipBaseAttrDict:  | 
|             continue  | 
|         baseAttrDict = equipBaseAttrDict[equipPlace]  | 
|         for attrID, addPer in addPerDict.items():  | 
|             if attrID not in baseAttrDict:  | 
|                 continue  | 
|             baseValue = baseAttrDict[attrID]  | 
|             addValue = int(baseValue * addPer / 10000.0)  | 
|             PlayerControl.CalcAttrDict_Type(attrID, addValue, allAttrList)  | 
|             #GameWorld.DebugLog("            ¼Ó³É: ID=%s +%s %s" % (attrID, addValue, addPer))  | 
|     return  | 
|   | 
| def CalcAttr_LegendAttr(curPlayer, curEquip, allAttrListEquip, legendAttrDict={}):  | 
|     ## ¼ÆËã´«ÆæÊôÐÔ  | 
|       | 
|     # ´«ÆæÊôÐÔIDÁÐ±í  | 
|     legendAttrIDList = [curEquip.GetUserAttrByIndex(ShareDefine.Def_IudetLegendAttrID, i) \  | 
|                         for i in range(curEquip.GetUserAttrCount(ShareDefine.Def_IudetLegendAttrID))]  | 
|     # ´«ÆæÊôÐÔÖµÁÐ±í  | 
|     legendAttrValueList = [curEquip.GetUserAttrByIndex(ShareDefine.Def_IudetLegendAttrValue, i) \  | 
|                            for i in range(curEquip.GetUserAttrCount(ShareDefine.Def_IudetLegendAttrValue))]  | 
|     if not legendAttrIDList or len(legendAttrIDList) != len(legendAttrValueList):  | 
|         #GameWorld.DebugLog("ûÓд«ÆæÊôÐÔ£¡")  | 
|         return  | 
|     #GameWorld.DebugLog("´«ÆæÊôÐÔ: place=%s,IDList=%s, v=%s" % (curEquip.GetEquipPlace(), legendAttrIDList, legendAttrValueList))  | 
|       | 
|     for i, attrID in enumerate(legendAttrIDList):  | 
|         value = legendAttrValueList[i]  | 
|         #GameWorld.DebugLog("¼Ó´«ÆæÊôÐÔ: %s +%s" % (attrID, value))  | 
|         PlayerControl.CalcAttrDict_Type(attrID, value, allAttrListEquip)  | 
|         #legendAttrDict[attrID] = legendAttrDict.get(attrID, 0) + value  | 
|           | 
|     return  | 
|   | 
|   | 
| # ×°±¸¾ø°æÊôÐÔ£¬ËæµÈ¼¶±ä»¯ÐèÔÚÉý¼¶ÔÙ´¦Àí  | 
| def CalcAttr_OutOfPrintAttr(curPlayer, curEquip, allAttrListOutOfPrintEquip):  | 
|     ## ¼ÆËã¾ø°æÊôÐÔ  | 
|       | 
|     # ¾ø°æÊôÐÔIDÁÐ±í  | 
|     OutOfPrintAttrIDList = [curEquip.GetUserAttrByIndex(ShareDefine.Def_IudetOutOfPrintAttrID, i) \  | 
|                         for i in range(curEquip.GetUserAttrCount(ShareDefine.Def_IudetOutOfPrintAttrID))]  | 
|     # ¾ø°æÊôÐÔÖµÁÐ±í  | 
|     OutOfPrintAttrValueList = [curEquip.GetUserAttrByIndex(ShareDefine.Def_IudetOutOfPrintAttrValue, i) \  | 
|                            for i in range(curEquip.GetUserAttrCount(ShareDefine.Def_IudetOutOfPrintAttrValue))]  | 
|     if not OutOfPrintAttrIDList or len(OutOfPrintAttrIDList) != len(OutOfPrintAttrValueList):  | 
|         return  | 
|       | 
|     lv = curPlayer.GetLV()  | 
|     OutOfPrintAttrFormatDict = IpyGameDataPY.GetFuncEvalCfg("OutOfPrintValue", 2, {})  | 
|     for i, attrID in enumerate(OutOfPrintAttrIDList):  | 
|         if str(attrID) not in OutOfPrintAttrFormatDict:  | 
|             continue  | 
|         attrFormat = OutOfPrintAttrFormatDict[str(attrID)]  | 
|         maxOOPValue = OutOfPrintAttrValueList[i]  | 
|         value = eval(FormulaControl.GetCompileFormula("OutOfPrintAttrFormat_%s" % attrID, attrFormat))  | 
|         GameWorld.DebugLog("¼Ó¾ø°æÊôÐÔ: %s +%s" % (attrID, value))  | 
|         PlayerControl.CalcAttrDict_Type(attrID, value, allAttrListOutOfPrintEquip)  | 
|           | 
|     return  | 
|   | 
|   | 
| ## ¼ÆËã×°±¸¶Ô»ù±¾ÊôÐÔµÄ¸Ä±ä   | 
| #  @return None  | 
| def CalcEquips_OutOfPrint(curPlayer):  | 
|     # ¾³½ç×°±¸¸Ä°æ£¬ÏÈÆÁ±Î£¬Ö®ºóÔÙ´¦Àí  | 
|     return  | 
|     allAttrListOutOfPrintEquip = [{} for _ in range(4)]  # ¾ø°æ×°±¸ÊôÐÔ ÐèÔڵȼ¶±ä»¯¶ÀÁ¢¼ÆËã  | 
|       | 
|     packType = IPY_GameWorld.rptEquip  | 
|     playerEquip = curPlayer.GetItemManager().GetPack(packType)  | 
|   | 
|     #Íæ¼Òµ±Ç°¿É×°±¸µÄ×°±¸ÀàÐÍ  | 
|     for equipIndex in xrange(playerEquip.GetCount()):  | 
|         if equipIndex not in ShareDefine.RoleEquipType :  | 
|             continue  | 
|           | 
|         # ³á°òÊôÐÔÔÚ³á°ò¹¦Äܵ¥¶ÀˢР | 
|         if equipIndex == ShareDefine.retWing:  | 
|             continue  | 
|           | 
|         curEquip = playerEquip.GetAt(equipIndex)  | 
|         if curEquip.IsEmpty():  | 
|             continue  | 
|               | 
|         if not ItemCommon.CheckItemCanUseByExpireTime(curEquip):  | 
|             # ¹ýÆÚ  | 
|             continue  | 
|             | 
|         #¾øÊÀÊôÐÔ  | 
|         CalcAttr_OutOfPrintAttr(curPlayer, curEquip, allAttrListOutOfPrintEquip)  | 
|   | 
|     #±£´æ¼ÆËãÖµ  | 
|     PlayerControl.SetCalcAttrListValue(curPlayer, ChConfig.Def_CalcAttrFunc_EquipOutOfPrint, allAttrListOutOfPrintEquip)  | 
|     return  | 
|   | 
| def __CalcAttr_ItemPlus(curPlayer, curEquip, packType, equipIndex, allAttrList, plus_addEquipBaseAttrPerList):  | 
|     ## ¼ÆËã×°±¸Ç¿»¯ºóµÄÊôÐÔ  | 
|     equipPartPlusLV = GetEquipPartPlusLVByRank(curPlayer, packType, equipIndex, curEquip)  | 
|     equipPartPlusEvolveLV = GetEquipPartPlusEvolveLVByEquip(curPlayer, packType, equipIndex, curEquip)  | 
|       | 
|     if not equipPartPlusLV:  | 
|         return  | 
|     plusType = GetEquipPlusType(curEquip)  | 
|     if plusType is None:  | 
|         return  | 
|       | 
|     #GameWorld.DebugLog("    Ç¿»¯ÊôÐÔ: plusType=%s,equipPartPlusLV=%s,equipPartPlusEvolveLV=%s" % (plusType, equipPartPlusLV, equipPartPlusEvolveLV))  | 
|     ipyData = IpyGameDataPY.GetIpyGameData("ItemPlus", plusType, equipPartPlusLV)  | 
|     if not ipyData:  | 
|         return  | 
|     attrTypeList, attrValueList = ipyData.GetAttrType(), ipyData.GetAttrValue()  | 
|     for i, attrID in enumerate(attrTypeList):  | 
|         #GameWorld.DebugLog("    Ç¿»¯»ù´¡ÊôÐÔ: ID=%s +%s" % (attrID, attrValueList[i]))  | 
|         PlayerControl.CalcAttrDict_Type(attrID, attrValueList[i], allAttrList)  | 
|       | 
|     if not equipPartPlusEvolveLV:  | 
|         return  | 
|     #½ø»¯ÊôÐÔ  | 
|     equipPlace = curEquip.GetEquipPlace()  | 
|     ipyData = IpyGameDataPY.GetIpyGameData('EquipPlusEvolve', equipPlace, equipPartPlusEvolveLV)  | 
|     if not ipyData:  | 
|         return  | 
|     for attrID, attrValue in ipyData.GetAttr().items():  | 
|         #GameWorld.DebugLog("    Ç¿»¯½ø½×ÊôÐÔ: ID=%s +%s" % (attrID, attrValue))  | 
|         PlayerControl.CalcAttrDict_Type(attrID, attrValue, allAttrList)  | 
|         __CalcFuncAddEquipAttrPer(equipPlace, attrID, attrValue, plus_addEquipBaseAttrPerList)  | 
|           | 
|     return  | 
|   | 
| ## ×°±¸Ì××°ÊôÐÔ¼ÆËã  | 
| #  @param curPlayer µ±Ç°Íæ¼Ò  | 
| #  @return None  | 
| def CalcEquipSuiteAttr(curPlayer, suitCntDict, allAttrListSuit):  | 
|     if not suitCntDict:  | 
|         return  | 
|     #GameWorld.DebugLog('    suitCntDict=%s'%suitCntDict)  | 
|     learnSkillList = []  | 
|     delSkillID = []  | 
|     skillManager = curPlayer.GetSkillManager()  | 
|     playerName = curPlayer.GetName()  | 
|     for suiteID, starList in suitCntDict.items():  | 
|         ipyDataList = IpyGameDataPY.GetIpyGameDataList('EquipSuitAttr', suiteID)  | 
|         if not ipyDataList:  | 
|             continue  | 
|         for ipyData in ipyDataList:  | 
|             suiteCnt = ipyData.GetSuiteCnt()  | 
|             needStar = ipyData.GetStar()  | 
|             skillID = ipyData.GetSkillID()  | 
|             if [1 if star >= needStar else 0 for star in starList].count(1) >= suiteCnt:  | 
|                 #GameWorld.DebugLog("    Ì××°: suiteID=%s,suiteCnt=%s,needStar=%s" % (suiteID, suiteCnt, needStar))  | 
|                 for attrID, attrValue in ipyData.GetAttrInfo().items():  | 
|                     PlayerControl.CalcAttrDict_Type(attrID, attrValue, allAttrListSuit)  | 
|                     #GameWorld.DebugLog("        ÊôÐÔ: ID=%s +%s" % (attrID, attrValue))  | 
|                 #¼¼ÄÜ  | 
|                 if skillID and not skillManager.FindSkillBySkillTypeID(skillID):  | 
|                     learnSkillList.append(skillID)  | 
|                 #¹ã²¥  | 
|                 notifyMark = ipyData.GetIsNotify()  | 
|                 if notifyMark and not GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_PDict_EquipPartSuiteNotify, notifyMark):  | 
|                     PlayerControl.WorldNotify(0, 'AllStarLevelUp' if needStar else 'AllStarLevelUp2', [playerName, suiteID, suiteCnt, needStar])  | 
|                     GameWorld.SetDictValueByBit(curPlayer, ChConfig.Def_PDict_EquipPartSuiteNotify, notifyMark, 1)  | 
|   | 
|             else:  | 
|                 if skillID and skillManager.FindSkillBySkillTypeID(skillID):  | 
|                     delSkillID.append(skillID)  | 
|                     skillManager.DeleteSkillBySkillTypeID(skillID)  | 
|                               | 
|               | 
|     for skillID in learnSkillList:  | 
|         GameWorld.DebugLog('    ¼¤»îÌ××°¼¼ÄÜ skillResID=%s' % (skillID))  | 
|         skillData = GameWorld.GetGameData().FindSkillByType(skillID, 1)  | 
|         if not skillData:  | 
|             continue  | 
|         skillManager.LVUpSkillBySkillTypeID(skillID)     | 
|         PlayerControl.PlayerControl(curPlayer).RefreshSkillFightPowerEx(skillID, 0)  | 
|     if learnSkillList or delSkillID:  | 
|         # ÖØË¢±»¶¯¼¼ÄÜ  | 
|         PassiveBuffEffMng.GetPassiveEffManager().RegistPassiveEff(curPlayer)      | 
|     return  | 
|   | 
|   | 
| ##È«Éí³Èɫװ±¸ÊýÁ¿´¥·¢Ïà¹Ø(°üº¬³ÈɫƷÖÊÒÔÉϵÄ×°±¸ÊýÁ¿)  | 
| def OnOrangeQualityCntChange(curPlayer, orangeQualityCnt):  | 
|     notifyType = curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_AttrActivatyNotify)  | 
|     if notifyType == ChConfig.Def_AttrActivatyNotify_Equip:  | 
|         EventShell.EventRespons_OrangeQualityCnt(curPlayer, orangeQualityCnt)  | 
|     return  | 
|   | 
|   | 
| ## 1Ëã×°±¸´¥·¢µÄ¼¼ÄÜ £¨È«Éí£©   | 
| #  @param curPlayer µ±Ç°Íæ¼Ò  | 
| #  @param curEquip µ±Ç°×°±¸  | 
| #  @return None  | 
| #  @remarks º¯ÊýÏêϸ˵Ã÷.  | 
| def CalcCurEquip_SkillBuff(curPlayer, curEquip):  | 
|     SkillShell.RefreshSkillBuffByEquip(curPlayer, curEquip)  | 
|     return  | 
|   | 
|   | 
| ## ¼ÆËã×°±¸ÏâǶ±¦Ê¯¸½¼ÓЧ¹û->»ù±¾ÊôÐÔ (±¦Ê¯)   | 
| #  @param curPlayer µ±Ç°Íæ¼Ò  | 
| #  @param curEquip µ±Ç°×°±¸  | 
| #  @param allAttrList ÊôÐÔÐÅÏ¢   | 
| #  @return ÎÞ·µ»ØÖµ  | 
| def CalcEquipStone_Effect(curPlayer, equipIndex, allAttrList):  | 
|     gameData = GameWorld.GetGameData()  | 
|   | 
|     effIndexList = [1, 2, 3, 4]  # µÚÒ»¸öЧ¹ûÖµÊÇÀàÐ͵ȼ¶Ð§¹ûÖµ£¬·ÇÊôÐÔЧ¹ûÖµ  | 
|     gemLVList = []  | 
|     for holeIndex in Operate_EquipStone.GetAllEquipPlaceHoleIndex():  | 
|           | 
|         curGemID = Operate_EquipStone.GetEquipIndexStoneIDAndIsBand(curPlayer, equipIndex, holeIndex)[0]  | 
|         if curGemID == 0:  | 
|             continue  | 
|         curGem = gameData.GetItemByTypeID(curGemID)  | 
|         if not curGem:  | 
|             GameWorld.ErrLog('equip stone id:%s not in item table' % (curGemID))  | 
|             continue      | 
|         for effIndex in effIndexList:           | 
|             curGemEffect = curGem.GetEffectByIndex(effIndex)  | 
|             effectID, effectValue = curGemEffect.GetEffectID(), curGemEffect.GetEffectValue(0)  | 
|             if effectID and effectValue:  | 
|                 PlayerControl.CalcAttrDict_Type(effectID, effectValue, allAttrList)  | 
|         gemEffect = curGem.GetEffectByIndex(0)  | 
|         gemLV = gemEffect.GetEffectValue(1)  | 
|         gemLVList.append(gemLV)  | 
|     return gemLVList  | 
|   | 
| #---------------------------------------------------------------------  | 
| ## ×°±¸Ìí¼ÓBuff   | 
| #  @param curPlayer µ±Ç°Íæ¼Ò  | 
| #  @param addSkillID ¼¼ÄÜID  | 
| #  @return None  | 
| #  @remarks º¯ÊýÏêϸ˵Ã÷.  | 
| def EquipAddBuff(curPlayer, addSkillID, value=0):  | 
|   | 
|     curBuff = curPlayer.GetEquipBuff().AddBuff(addSkillID, 0, False)  | 
|     curBuff.SetOwnerID(curPlayer.GetID())  | 
|     curBuff.SetOwnerType(curPlayer.GetGameObjType())  | 
|     if value > 0:  | 
|         curBuff.SetValue(value)  | 
|     return  | 
|   | 
|   | 
| #---------------------------------------------------------------------  | 
| #===============================================================================  | 
| # #//03 2F ÇëÇó×°±¸ÏÔÒþ#tagRequestEquipShowHide  | 
| # //×°±¸ÏÔʾ¿ª¹Ø  | 
| # int GetEquipShowSwitch(); µÚ¼¸Ì×*10+ÊÇ·ñÓÐÌ××°  | 
| #===============================================================================  | 
| ##ÇëÇó×°±¸ÏÔÒþ. £¨ÉèÖÃÏÔʾÄÄÌ××°±¸Íâ¹Û£©  | 
| # @param index Íæ¼ÒË÷Òý  | 
| # @param tick Ê±¼ä´Á  | 
| # @return ·µ»ØÖµÎÞÒâÒå  | 
| # @remarks ¿Í»§¶Ë·â°üÏìÓ¦ //03 2F ÇëÇó×°±¸ÏÔÒþ#tagRequestEquipShowHide  | 
| def RequestEquipShowHide(index, tick):  | 
|     curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)  | 
|       | 
|     #---¼ì²éˢмä¸ô--  | 
|     interval = ChConfig.TYPE_Player_Tick_Time[ChConfig.TYPE_Player_Tick_RequestEquipShowHide]  | 
|       | 
|     if tick - curPlayer.GetTickByType(ChConfig.TYPE_Player_Tick_RequestEquipShowHide) < interval:  | 
|         #ûÓе½Ë¢Ð¼ä¸ô£¬54Íâ¹Ò£¬²»¸øÌáʾ  | 
| #        GameWorld.ErrLog('ÇëÇó×°±¸ÏÔÒþ, Ã»Óе½Ë¢Ð¼ä¸ô')  | 
|         return  | 
|     curPlayer.SetTickByType(ChConfig.TYPE_Player_Tick_RequestEquipShowHide, tick)  | 
|     sendPack = IPY_GameWorld.IPY_CRequestEquipShowHide()  | 
|     classLV = sendPack.GetEquipShowSwitch()  | 
|     oldClassLV = GetEquipFacadeClassLV(curPlayer)  | 
|     if oldClassLV == classLV:  | 
|         return  | 
|     if not ChangeEquipfacadeByClassLV(curPlayer, classLV):  | 
|         return  | 
|       | 
|     #֪ͨÍâ¹Û×°±¸  | 
|     updFaceEquipIndex = 0  | 
|     equipIndexList = []  | 
|       | 
|     for equipPlace in [ShareDefine.retWeapon, ShareDefine.retWeapon2, ShareDefine.retClothes]:  | 
|         ipyData = IpyGameDataPY.GetIpyGameData('EquipPlaceIndexMap', classLV, equipPlace)  | 
|         if not ipyData:  | 
|             continue  | 
|         gridIndex = ipyData.GetGridIndex()  | 
|         updFaceEquipIndex = updFaceEquipIndex * 1000 + gridIndex  | 
|         equipIndexList.append(gridIndex)  | 
|   | 
|     PlayerControl.SetFaceEquipIndex(curPlayer, updFaceEquipIndex)  | 
|     equipPack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptEquip)  | 
|     for equipPackIndex in equipIndexList:  | 
|         curEquip = equipPack.GetAt(equipPackIndex)  | 
|         if not ItemCommon.CheckItemCanUse(curEquip):  | 
|             continue  | 
|         changeItemID = curEquip.GetItemTypeID()  | 
|         changeItemStarLV = 0  #curItem.GetItemStarLV()  | 
|         changeItemStoneCnt = 0  #curItem.GetUseStoneCount()  | 
|         changeItemHoleCnt = 0  #curItem.GetCanPlaceStoneCount()  | 
|         changeItemUseData = curEquip.GetUserData()  | 
|         curPlayer.ChangeEquip(changeItemID, equipPackIndex, changeItemStarLV, changeItemHoleCnt, changeItemStoneCnt, changeItemUseData)  | 
|       | 
|     return  | 
|   | 
| def ChangeEquipfacadeByClassLV(curPlayer, classLV):  | 
|     ##±ä¸üµÚXÌ××°±¸Íâ¹Û  | 
|     oldEquipShowSwitch = curPlayer.GetEquipShowSwitch()  | 
|     realSuit=1  | 
|     equipPack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptEquip)  | 
|     for place in ChConfig.EquipPlace_Base:  | 
|         ipyData = IpyGameDataPY.GetIpyGameData('EquipPlaceIndexMap', classLV, place)  | 
|         if not ipyData:  | 
|             realSuit = 0  | 
|             break  | 
|         gridIndex = ipyData.GetGridIndex()  | 
|         curEquip = equipPack.GetAt(gridIndex)  | 
|         if not ItemCommon.CheckItemCanUse(curEquip):  | 
|             realSuit = 0  | 
|             break  | 
|         if not curEquip.GetSuiteID():  | 
|             realSuit = 0  | 
|             break  | 
|     updEquipShowSwitch = classLV*10+realSuit  | 
|     if oldEquipShowSwitch == updEquipShowSwitch:  | 
|         return  | 
|     curPlayer.SetEquipShowSwitch(updEquipShowSwitch)  | 
|     return True  | 
| #»ñÈ¡µ±Ç°Êǵڼ¸Ì××°±¸Íâ¹Û  | 
| def GetEquipFacadeClassLV(curPlayer):return curPlayer.GetEquipShowSwitch()/10  | 
|   | 
| ## »ñÈ¡¹«¹²²¿Î»Ç¿»¯ÊìÁ·¶È  | 
| def GetEquipPartProficiency(curPlayer, packType, index):  | 
|     return curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_EquipPartProficiency % (packType, index))  | 
|   | 
|   | 
| ## ÉèÖù«¹²²¿Î»Ç¿»¯ÊìÁ·¶È  | 
| def SetEquipPartProficiency(curPlayer, packType, index, value):  | 
|     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_EquipPartProficiency % (packType, index), value)  | 
|   | 
|   | 
| ## »ñÈ¡¹«¹²²¿Î»Ç¿»¯ÐǼ¶, Òò×°±¸µÄ×î¸ß¿ÉÇ¿»¯ÐǼ¶Ó°Ï죬ÓÃÓÚË㵱ǰװ±¸ÊôÐÔʹÓ㬠²»Ó°ÏìÈ«ÉíÐǼ¶  | 
| def GetEquipPartPlusLVByRank(curPlayer, packType, index, curEquip):  | 
|     maxStarLV = ItemCommon.GetItemMaxPlusLV(curPlayer, index, curEquip)  | 
|     return min(curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_EquipPartPlusLV % (packType, index)), maxStarLV)  | 
|   | 
|   | 
| ## »ñÈ¡¹«¹²²¿Î»Ç¿»¯ÐǼ¶  | 
| def GetEquipPartPlusLV(curPlayer, packType, index):  | 
|     return curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_EquipPartPlusLV % (packType, index))  | 
|   | 
|   | 
| ## ÉèÖù«¹²²¿Î»Ç¿»¯ÐǼ¶  | 
| def SetEquipPartPlusLV(curPlayer, packType, index, curEquip, starLV):  | 
|     if GetEquipPartPlusLV(curPlayer, packType, index) == starLV:  | 
|         return  | 
|       | 
|     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_EquipPartPlusLV % (packType, index), starLV)  | 
|     #===========================================================================  | 
|     # if curEquip and not curEquip.IsEmpty():  | 
|     #    curEquip.SetItemStarLV(starLV)  | 
|     #===========================================================================  | 
|   | 
|     return  | 
|   | 
|   | 
| ## »ñÈ¡¹«¹²²¿Î»Ç¿»¯½ø»¯µÈ¼¶, ÓÃÓÚË㵱ǰװ±¸ÊôÐÔʹÓ㬠²»Ó°ÏìÈ«ÉíÐǼ¶  | 
| def GetEquipPartPlusEvolveLVByEquip(curPlayer, packType, index, curEquip):  | 
|     maxEvolveLV = ItemCommon.GetItemMaxPlusEvolveLV(curPlayer, index, curEquip)  | 
|     return min(curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_EquipPartPlusEvolveLV % (packType, index)), maxEvolveLV)  | 
|   | 
|   | 
| ## »ñÈ¡¹«¹²²¿Î»Ç¿»¯½ø»¯µÈ¼¶  | 
| def GetEquipPartPlusEvolveLV(curPlayer, packType, index):  | 
|     return curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_EquipPartPlusEvolveLV % (packType, index))  | 
|   | 
|   | 
| ## ÉèÖù«¹²²¿Î»Ç¿»¯½ø»¯µÈ¼¶  | 
| def SetEquipPartPlusEvolveLV(curPlayer, packType, index, evolveLV):  | 
|     if GetEquipPartPlusEvolveLV(curPlayer, packType, index) == evolveLV:  | 
|         return  | 
|     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_EquipPartPlusEvolveLV % (packType, index), evolveLV)  | 
|     return  | 
|   | 
| ## Í¨Öª¹«¹²²¿Î»Ç¿»¯µÈ¼¶  | 
| def NotifyEquipPartPlusLV(curPlayer, packType=IPY_GameWorld.rptEquip, index=None):  | 
|     ePartStarLVPack = ChPyNetSendPack.tagMCEquipPartPlusInfo()  | 
|     ePartStarLVPack.Clear()  | 
|     ePartStarLVPack.InfoList = []  | 
|       | 
|     syncIndexList = []  | 
|     if index == None:  | 
|         equipMaxClasslv = IpyGameDataPY.GetFuncCfg('EquipMaxClasslv')  | 
|         for equipPlace in ChConfig.Pack_EquipPart_CanPlusStar.get(packType, []):  | 
|             for classlv in xrange(1, equipMaxClasslv+1):  | 
|                 ipyData = IpyGameDataPY.GetIpyGameData('EquipPlaceIndexMap', classlv, equipPlace)  | 
|                 if not ipyData:  | 
|                     continue   | 
|                 syncIndexList.append(ipyData.GetGridIndex())  | 
|     else:  | 
|         syncIndexList = [index]  | 
|           | 
|     for i in syncIndexList:  | 
|         ePartStarLV = ChPyNetSendPack.tagMCEquipPartPlusLV()  | 
|         ePartStarLV.Clear()  | 
|         ePartStarLV.PackType = packType  | 
|         ePartStarLV.EquipIndex = i  | 
|         ePartStarLV.EquipPartStarLV = GetEquipPartPlusLV(curPlayer, packType, i)  | 
|         ePartStarLV.Proficiency = GetEquipPartProficiency(curPlayer, packType, i)  | 
|         ePartStarLV.EvolveLV = GetEquipPartPlusEvolveLV(curPlayer, packType, i)  | 
|         ePartStarLVPack.InfoList.append(ePartStarLV)  | 
|               | 
|     ePartStarLVPack.Count = len(ePartStarLVPack.InfoList)  | 
|     NetPackCommon.SendFakePack(curPlayer, ePartStarLVPack)  | 
|     return  | 
|   | 
|   | 
| ## È«ÉíÇ¿»¯µÈ¼¶  | 
| def GetTotalPlusLV(curPlayer, isActive=True):  | 
|     totalPlusLV = 0  | 
|     equipPack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptEquip)  | 
|     equipPartIndexList = ChConfig.Pack_EquipPart_CanPlusStar[IPY_GameWorld.rptEquip]  | 
|     for i in equipPartIndexList:  | 
|         if isActive:  | 
|             curEquip = equipPack.GetAt(i)  | 
|             if not curEquip  or curEquip.IsEmpty():  | 
|                 continue  | 
|               | 
|         partStarLV = GetEquipPartPlusLV(curPlayer, IPY_GameWorld.rptEquip, i)  | 
|         totalPlusLV += partStarLV  | 
|     return totalPlusLV  | 
|   | 
|   | 
| # »ñȡװ±¸µÄÇ¿»¯ÀàÐÍ  | 
| def GetEquipPlusType(curEquip):  | 
|     equipPlace = curEquip.GetEquipPlace()  | 
|     plusTypeDict = IpyGameDataPY.GetFuncEvalCfg("StrengthenLevelLimit", 1)  | 
|     if not plusTypeDict:  | 
|         GameWorld.ErrLog("ûÓÐÇ¿»¯ÀàÐÍÓ³Éä±í")  | 
|         return  | 
|       | 
|     return plusTypeDict.get(equipPlace)  | 
|   | 
|   | 
| #  »ñÈ¡ÂúÌ××°»¯µÄ×îµÍ½×Êý£¬Èç5¼þÌ×£¬4¼þ5¼¶£¬1¼þ3¼¶£¬Ôò·µ»Ø3  | 
| def GetEquipSuitsLVByType(curPlayer, suitType, groupType):  | 
|     return 0  | 
| #    suiteLV = 999  | 
| #    equipSuitTypeDict = IpyGameDataPY.GetFuncEvalCfg('EquipSuitType')  | 
| #    if groupType not in equipSuitTypeDict:  | 
| #        return 0  | 
| #    maxCnt = len(equipSuitTypeDict[groupType])  | 
| #    cnt = 0  | 
| #    for equipPlace in equipSuitTypeDict[groupType]:  | 
| #        curSuiteLV = GetEquipPartSuiteLV(curPlayer, equipPlace, suitType)  | 
| #        if curSuiteLV > 0:  | 
| #            cnt += 1  | 
| #        suiteLV = min(curSuiteLV, suiteLV)  | 
| #          | 
| #    if cnt != maxCnt:  | 
| #        return 0  | 
| #    return 0 if suiteLV == 999 else suiteLV  | 
|   | 
|   | 
|   | 
| def SetEquipPartStar(curPlayer, equipPackindex, star):  | 
|     #ÉèÖù«¹²²¿Î»ÐÇÊý  | 
|     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_EquipPartStar % equipPackindex, star)  | 
|     return  | 
|   | 
|   | 
| def GetEquipPartStar(curPlayer, equipPackindex):  | 
|     #»ñÈ¡¹«¹²²¿Î»ÐÇÊý  | 
|     return curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_EquipPartStar % equipPackindex)  | 
|   | 
|   | 
| ## »ñÈ¡¹«¹²²¿Î»ÉúЧµÄÐÇÊý, Òò×°±¸µÄ×î¸ß¿Éµ½ÐÇÊýÓ°Ï죬ÓÃÓÚË㵱ǰװ±¸ÊôÐÔʹÓ㬠²»Ó°ÏìÈ«ÉíÐǼ¶  | 
| def GetEquipPartStarByRank(curPlayer, equipPackindex, curEquip):  | 
|     maxStarLV = ItemCommon.GetItemMaxStar(curEquip)  | 
|     return min(GetEquipPartStar(curPlayer, equipPackindex), maxStarLV)  | 
|   | 
|   | 
| ## Í¨Öª¹«¹²²¿Î»ÐÇÊý  | 
| def NotifyEquipPartStar(curPlayer, index=None):  | 
|     ePartStarLVPack = ChPyNetSendPack.tagMCEquipPartStarInfo()  | 
|     ePartStarLVPack.Clear()  | 
|     ePartStarLVPack.InfoList = []  | 
|     syncIndexList = []  | 
|     if index == None:  | 
|         equipMaxClasslv = IpyGameDataPY.GetFuncCfg('EquipMaxClasslv')  | 
|         for equipPlace in ChConfig.Pack_EquipPart_CanPlusStar.get(IPY_GameWorld.rptEquip, []):  | 
|             for classlv in xrange(1, equipMaxClasslv+1):  | 
|                 ipyData = IpyGameDataPY.GetIpyGameData('EquipPlaceIndexMap', classlv, equipPlace)  | 
|                 if not ipyData:  | 
|                     continue   | 
|                 syncIndexList.append(ipyData.GetGridIndex())  | 
|     else:  | 
|         syncIndexList = [index]  | 
|       | 
|     for index in syncIndexList:  | 
|         ePartStarLV = ChPyNetSendPack.tagMCEquipPartStar()  | 
|         ePartStarLV.Clear()  | 
|         ePartStarLV.EquipPackIndex = index  | 
|         ePartStarLV.Star = GetEquipPartStar(curPlayer, index)  | 
|         ePartStarLVPack.InfoList.append(ePartStarLV)  | 
|               | 
|     ePartStarLVPack.Count = len(ePartStarLVPack.InfoList)  | 
|     NetPackCommon.SendFakePack(curPlayer, ePartStarLVPack)  | 
|     return  | 
|   | 
|   | 
| #// A5 03 È«ÉíÊôÐÔ¼¤»î #tagCMActiveAllEquipAttr  | 
| #  | 
| #struct    tagCMActiveAllEquipAttr  | 
| #  | 
| #{  | 
| #    tagHead        Head;  | 
| #    BYTE        Type;        //0Ç¿»¯ 1ÐÇÊý  | 
| #    DWORD        Cnt;        //¼¤»îÊýÁ¿  | 
| #};  | 
| def OnActiveAllEquipAttr(index, clientData, tick):  | 
|     curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)  | 
|     activeType = clientData.Type  | 
|     activeCnt = clientData.Cnt  | 
|     if activeType == 0:  | 
|         key = ChConfig.Def_PDict_EquipActiveStarLV  | 
| #    elif activeType == 1:  | 
| #        key = ChConfig.Def_PDict_EquipActiveStars  | 
|     else:  | 
|         return  | 
|     curCnt = curPlayer.NomalDictGetProperty(key)  | 
|     if activeCnt <= curCnt:  | 
|         GameWorld.Log('    È«ÉíÊôÐÔ¼¤»î ¸ÃÊýÁ¿ÒѼ¤»î¹ý£¡ activeType=%s,activeCnt=%s,curCnt=%s' % (activeType, activeCnt, curCnt))  | 
|         return  | 
|       | 
|     PlayerControl.NomalDictSetProperty(curPlayer, key, activeCnt)  | 
|       | 
|     SyncAllEquipAttrActiveInfo(curPlayer, activeType)  | 
|       | 
|     #×¢Òâ: ÐèÒª´«×°±¸½×´¥·¢Ë¢ÊôÐÔ£¬ÔÝÆÁ±Î£¬¹¦ÄÜÐÞ¸ÄʱÔÙ´¦Àí  | 
|     #else:  | 
|     #    RefreshPlayerEquipAttribute(curPlayer)  | 
|       | 
|     #Ë¢ÐÂËùÓÐÊôÐÔ  | 
|     playControl = PlayerControl.PlayerControl(curPlayer)  | 
|     playControl.RefreshPlayerAttrState()  | 
|     return  | 
|   | 
|   | 
| def SyncAllEquipAttrActiveInfo(curPlayer, activeType=-1):  | 
|     ## Í¨ÖªÈ«ÉíÊôÐÔ¼¤»îÊýÁ¿  | 
|     packData = ChPyNetSendPack.tagMCAllEquipAttrActiveInfo()  | 
|     packData.ActiveInfo = []  | 
|     for aType in [0, 1]:  | 
|         if activeType != -1 and activeType != aType:  | 
|             continue  | 
|         if aType == 0:  | 
|             key = ChConfig.Def_PDict_EquipActiveStarLV  | 
| #        elif aType == 1:  | 
| #            key = ChConfig.Def_PDict_EquipActiveStars  | 
|         else:  | 
|             return  | 
|         curCnt = curPlayer.NomalDictGetProperty(key)  | 
|         activeInfo = ChPyNetSendPack.tagMCEquipActiveInfo()  | 
|         activeInfo.Type = aType  | 
|         activeInfo.Cnt = curCnt  | 
|         packData.ActiveInfo.append(activeInfo)  | 
|       | 
|     packData.Count = len(packData.ActiveInfo)  | 
|     NetPackCommon.SendFakePack(curPlayer, packData)  | 
|     return  |