| #!/usr/bin/python  | 
| # -*- coding: GBK -*-  | 
| #-------------------------------------------------------------------------------  | 
| #  | 
| ##@package Player.PlayerMagicWeapon  | 
| #  | 
| # @todo:·¨±¦ÏµÍ³  | 
| # @author xdh  | 
| # @date 2017-05-18  | 
| # @version 1.0  | 
| #  | 
| # ÏêϸÃèÊö: ·¨±¦ÏµÍ³  | 
| #  | 
| #-------------------------------------------------------------------------------  | 
| #"""Version = 2017-05-18 12:00"""  | 
| #-------------------------------------------------------------------------------  | 
|   | 
| import ItemCommon  | 
| import ShareDefine  | 
| import NetPackCommon  | 
| import DataRecordPack  | 
| import ChPyNetSendPack  | 
| import PlayerControl  | 
| import IPY_GameWorld  | 
| import SkillCommon  | 
| import GameWorld  | 
| import ChConfig  | 
| import IpyGameDataPY  | 
| import SkillShell  | 
| import GameFuncComm  | 
| import PlayerSuccess  | 
| import EventShell  | 
| import PassiveBuffEffMng  | 
| import ItemControler  | 
| import PlayerActivity  | 
| import ChEquip  | 
| import PlayerVip  | 
|   | 
| import random  | 
|   | 
| g_succInfoDict = {}  | 
| g_potentialsSkillDict = {}  | 
| ##µÇ¼´¦Àí  | 
| # @param curPlayer Íæ¼Ò  | 
| # @return None  | 
| def PlayerMagicWeaponLogin(curPlayer):  | 
|     NotifyMagicWeapon(curPlayer, True)  | 
|     Sycn_MagicWeaponRefineLV(curPlayer)  | 
|     SyncXBXZAwardRecord(curPlayer)  | 
|     Sycn_MagicWeaponLV(curPlayer)  | 
|     Sycn_MWPrivilegeData(curPlayer)  | 
|     return  | 
|   | 
| def OnDay(curPlayer):  | 
|     #ÖØÖ÷¨±¦Ö®»êÿÈÕÁìÈ¡¼Ç¼  | 
|     for privilege in ChConfig.MWPrivilegeList:  | 
|         PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_MWSoulGotItemState % privilege, 0)  | 
|     Sycn_MWPrivilegeData(curPlayer, isForce=True)  | 
|     return  | 
|   | 
| def DoMagicWeaponOpen(curPlayer):  | 
|     ## ·¨±¦¹¦ÄÜ¿ªÆô ¼¤»îµÚÒ»¸ö·¨±¦  | 
| #    ipyData = IpyGameDataPY.IPY_Data().GetTreasureByIndex(0)  | 
| #    mwID = ipyData.GetID()  | 
| #    GameWorld.DebugLog("·¨±¦¹¦ÄÜ¿ªÆô ¼¤»îµÚÒ»¸ö·¨±¦ mwID=%s"%mwID)  | 
| #    DoActiveMW(curPlayer, mwID)  | 
| #    NotifyMagicWeapon(curPlayer)  | 
|     return True  | 
|   | 
| def GetIsActiveMagicWeapon(curPlayer, mwID, lv=0):  | 
|     #»ñÈ¡·¨±¦ÊÇ·ñ¼¤»î  | 
|     #ͨ¹ýÍæ¼Ò×ÖµäÖµ¿ÉÖ±½ÓÅжÏÊÇ·ñÒѾ¼¤»î£¬ÕâÀï¿É²»ÑéÖ¤·¨±¦IDÊÇ·ñ´æÔÚ£¬¼´Ê¹´«Èë²»´æÔÚµÄÒ²ÊÇ·µ»ØÎ´¼¤»î  | 
|     #if not GetWMIpyData(mwID):  | 
|     #    return False  | 
|     if lv:  | 
|         curMWLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_MagicWeaponLV % mwID)  | 
|         return curMWLV >= lv  | 
|     return GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_PDict_MagicWeaponIsActive, mwID % 100, True, [mwID / 100])  | 
|   | 
| def SetMagicWeaponActiveState(curPlayer, mwID, isActive=True):  | 
|     #ÉèÖ÷¨±¦¼¤»î״̬  | 
|     GameWorld.SetDictValueByBit(curPlayer, ChConfig.Def_PDict_MagicWeaponIsActive, mwID % 100, isActive, True, [mwID / 100])  | 
|     return  | 
|   | 
| def ActiveMagicWeapon(curPlayer, succID):  | 
|     ##¼¤»î·¨±¦  | 
|     mwID = GetMWIDBySuccID(succID)  | 
|     if mwID == None:  | 
|         return  | 
|       | 
|     isActive = GetIsActiveMagicWeapon(curPlayer, mwID)  | 
|     if isActive:  | 
|         return  | 
|     succIDList = GetNeedSuccIDByMWID(mwID)  | 
|     needExp = len(succIDList)  | 
|     curExp = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_MagicWeaponExp % mwID)  | 
|       | 
|     if curExp >= needExp:  | 
|         return  | 
|       | 
|     newExp = min(needExp, curExp + 1)  | 
|     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_MagicWeaponExp % mwID, newExp)  | 
|     DataRecordPack.DR_MagicWeaponExp(curPlayer, mwID, succID, newExp, needExp)  | 
|     ipyData = GetWMIpyData(mwID)  | 
|     needItemDict = ipyData.GetNeedItem()  | 
|     #GameWorld.DebugLog('    ¼¤»î·¨±¦ mwID=%s,curExp=%s,succIDList=%s' % (mwID, newExp,succIDList))  | 
|     if newExp >= needExp and not needItemDict:  | 
|         #³É¾ÍÌõ¼þ´ï³É ¼¤»î·¨±¦  | 
|         DoActiveMW(curPlayer, mwID)  | 
|           | 
|     return  | 
|   | 
| def DoActiveMW(curPlayer, mwID, mwLV=0):  | 
|     if not GetWMIpyData(mwID):  | 
|         return  | 
|     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_MagicWeaponLV % mwID, mwLV)  | 
|     if mwLV == 0:  | 
|         SetMagicWeaponActiveState(curPlayer, mwID)  | 
|         #֪ͨ  | 
|         NotifyMagicWeapon(curPlayer)  | 
|           | 
|           | 
|         if mwID in IpyGameDataPY.GetFuncEvalCfg('UnblockTreasure'):  | 
|             PlayerControl.NotifyCode(curPlayer, 'UnblockTreasure', [curPlayer.GetName(), mwID])  | 
|         else:  | 
|             sysMark = IpyGameDataPY.GetFuncEvalCfg('UnblockTreasure', 2, {}).get(mwID, 'UnblockTreasure')  | 
|             PlayerControl.WorldNotify(0, sysMark, [curPlayer.GetName(), mwID])  | 
|           | 
|         #ÈÎÎñ  | 
|         EventShell.EventRespons_OnActiveMagicWeapon(curPlayer, mwID)  | 
|     else:  | 
|           | 
|         #֪ͨ¿Í»§¶ËµÈ¼¶  | 
|         Sycn_MagicWeaponLV(curPlayer, mwID)  | 
|         EventShell.EventRespons_MagicWeaponLV(curPlayer, mwID, mwLV)  | 
|     #³É¾Í  | 
|     PlayerSuccess.DoAddSuccessProgress(curPlayer, ShareDefine.SuccType_GetMagicWeapon, 1, [mwID, mwLV])  | 
|   | 
|     #½âËø¼¼ÄÜ  | 
|     upIpyData = IpyGameDataPY.GetIpyGameData('TreasureUp', mwID, mwLV)  | 
|     if not upIpyData:  | 
|         return  | 
|     skillIDList = upIpyData.GetUnLockSkill()  | 
|     for skillID in skillIDList:  | 
|         GiveSkill(curPlayer, skillID, GameWorld.GetGameWorld().GetTick())  | 
|     #ÎïÆ·½±Àø  | 
|     itemAward = upIpyData.GetItemAward()  | 
|     if itemAward:  | 
|         itemID, itemCnt, isBind = itemAward  | 
|         packSpace = ItemCommon.GetItemPackSpace(curPlayer, IPY_GameWorld.rptItem, 1)  | 
|         if 1 > packSpace:  | 
|             PlayerControl.SendMailByKey('TreasureWakeUp', [curPlayer.GetID()], [itemAward])  | 
|         else:  | 
|             ItemControler.GivePlayerItem(curPlayer, itemID, itemCnt, isBind,  | 
|                                              [IPY_GameWorld.rptItem], True, showSysInfo=True, event=["MWAward", False, {"mwID":mwID}])  | 
|     activeMWID = upIpyData.GetActiveMWID()  | 
|     if activeMWID == mwID:  | 
|         GameWorld.ErrLog('    TreasureUp.txt ÅäÖÃÒì³£ ²»¿É¼¤»î×ÔÉí·¨±¦ mwID=%s'%mwID)  | 
|     elif activeMWID:  | 
|         DoActiveMW(curPlayer, activeMWID)  | 
|       | 
|     #¼¤»î»ê  | 
|     activeSoulID = upIpyData.GetActiveSoulID()  | 
|     if activeSoulID:  | 
|         __DoActiveMWSoul(curPlayer, activeSoulID, False)  | 
|       | 
|     CalcMagicWeaponAttr(curPlayer)  | 
|     PlayerControl.PlayerControl(curPlayer).RefreshPlayerAttrState()  | 
|       | 
|     GameWorld.DebugLog('    ¼¤»î·¨±¦ mwID=%s,mwLV=%s' % (mwID, mwLV))  | 
|       | 
|     vipAddAtkMWID = IpyGameDataPY.GetFuncCfg("VIPAddAtkEXP", 2) # VIPɱ¹Ö¼ÓÊôÐÔËùÐ輤»î·¨±¦  | 
|     if mwID == vipAddAtkMWID:  | 
|         PlayerVip.RefreshVIPAttr(curPlayer)  | 
|           | 
|     #½âËø¹¦ÄÜ  | 
|     GameFuncComm.DoFuncOpenLogic(curPlayer)  | 
|     DataRecordPack.DR_MagicWeaponActive(curPlayer, mwID, mwLV)  | 
|     return True  | 
|   | 
| def GetWMIpyData(mwID):return IpyGameDataPY.GetIpyGameData('Treasure', mwID)  | 
|   | 
| def GetNeedSuccIDByMWID(mwID, ipyData=None):  | 
|     ##»ñÈ¡·¨±¦ID¿ªÆôÐèÒªÍê³ÉµÄ³É¾ÍID  | 
|     if not ipyData:  | 
|         ipyData = GetWMIpyData(mwID)  | 
|         if not ipyData:  | 
|             return []  | 
|     succIDList = list(ipyData.GetSuccID())  | 
|     return succIDList  | 
|   | 
| def GetMWIDBySuccID(succID):  | 
|     global g_succInfoDict  | 
|       | 
|     if not g_succInfoDict:  | 
|         ipyDataMgr = IpyGameDataPY.IPY_Data()  | 
|         for i in xrange(ipyDataMgr.GetTreasureCount()):  | 
|             ipyData = ipyDataMgr.GetTreasureByIndex(i)  | 
|             mwID = ipyData.GetID()  | 
|             succIDList = GetNeedSuccIDByMWID(mwID, ipyData)  | 
|             for succid in succIDList:  | 
|                 if succid in g_succInfoDict:  | 
|                     GameWorld.ErrLog('    ´æÔÚÏàͬ³É¾Í¼¤»îÌõ¼þµÄ·¨±¦ %s ºÍ %s' % (mwID, g_succInfoDict[succid]))  | 
|                 g_succInfoDict[succid] = mwID  | 
|     return g_succInfoDict.get(succID)  | 
|   | 
| def GetMWActiveCntTotal(curPlayer):  | 
|     ## »ñÈ¡¼¤»îµÄ·¨±¦×ܸöÊý  | 
|     activeCnt = 0  | 
|     ipyDataMgr = IpyGameDataPY.IPY_Data()  | 
|     for i in xrange(ipyDataMgr.GetTreasureCount()):  | 
|         ipyData = ipyDataMgr.GetTreasureByIndex(i)  | 
|         magicWeaponID = ipyData.GetID()  | 
|         if GetIsActiveMagicWeapon(curPlayer, magicWeaponID):  | 
|             activeCnt += 1  | 
|     return activeCnt  | 
|   | 
| def GetMWActiveCntByType(curPlayer, mwType):  | 
|     ## ¸ù¾Ý·¨±¦ÀàÐÍ»ñÈ¡ÒѼ¤»îÊýÁ¿  | 
|     dataList = IpyGameDataPY.GetIpyGameDataByCondition('Treasure', {'TreasureType':mwType}, True, False)  | 
|     if not dataList:  | 
|         return 0  | 
|     activeCnt = 0  | 
|     for ipydata in dataList:  | 
|         isActive = GetIsActiveMagicWeapon(curPlayer, ipydata.GetID())  | 
|         if isActive:  | 
|             activeCnt += 1  | 
|     return activeCnt  | 
|   | 
| def GetPotentialsSkillInfo(curPlayer):  | 
|     #ͨ¹ýDZÁ¦¼¼ÄÜID»ñÈ¡¶ÔÓ¦µÄÏÂÒ»¸ö¼¼ÄÜID {skillUseType:{skillid:[skilllv,nextSkillid,addPower,]}}  | 
|     global g_potentialsSkillDict  | 
|   | 
|     if not g_potentialsSkillDict:  | 
|         g_potentialsSkillDict = {}  | 
|         ipyDataMgr = IpyGameDataPY.IPY_Data()  | 
|         for i in xrange(ipyDataMgr.GetTreasureCount()):  | 
|             ipyData = ipyDataMgr.GetTreasureByIndex(i)  | 
|             mwID = ipyData.GetID()  | 
|             skillIDList = ipyData.GetPotentials()  | 
|             addPowerList = ipyData.GetSkillPower()  | 
|             lastSkillUseType = 0  | 
|             for curSkillID in skillIDList:  | 
|                 skillData = GameWorld.GetGameData().FindSkillByType(curSkillID, 1)  | 
|                 if skillData == None:  | 
|                     GameWorld.DebugLog("GetPotentialsSkillInfo() hasn't find skill(%s)" % curSkillID)  | 
|                     continue  | 
|                 if lastSkillUseType != skillData.GetUseType():  | 
|                     index = 0  | 
|                 else:  | 
|                     index +=1  | 
|                 lastSkillUseType = skillData.GetUseType()  | 
|                 addPower = addPowerList[index]  | 
|   | 
|                 preSkillID = skillData.GetLearnSkillReq()  | 
|                 if not preSkillID:  | 
|                     continue  | 
|                 skillUseType = skillData.GetUseType()  | 
|                 preSkilllv = skillData.GetLearnSkillLV()  | 
|                 if skillUseType not in g_potentialsSkillDict:  | 
|                     g_potentialsSkillDict[skillUseType] = {}  | 
|                 g_potentialsSkillDict[skillUseType][preSkillID] = [preSkilllv, curSkillID, addPower]  | 
|     curskillUseType = pow(2, curPlayer.GetJob())  | 
|       | 
|     return g_potentialsSkillDict.get(curskillUseType, {})  | 
|   | 
| ## ¸ø¼¼ÄÜ  | 
| #  @param curPlayer  | 
| #  @param skillResID ¼¼ÄÜÔ´ID  | 
| #  @param tick Ê±¼ä´Á  | 
| #  @return None  | 
| def GiveSkill(curPlayer, skillResID, tick, isShowSys=True):  | 
|       | 
|     skillData = GameWorld.GetGameData().FindSkillByType(skillResID, 1)  | 
|     if skillData == None:  | 
|         GameWorld.DebugLog("__GiveSkill() hasn't find skill(%s)" % skillResID)  | 
|         return  | 
|     if not SkillCommon.CheckSkillJob(curPlayer, skillData):  | 
|         return  | 
|     if not SkillShell.CheckLearnSkillCondition(curPlayer, skillData):  | 
|         GameWorld.DebugLog("__GiveSkill() learn skill(%s) condition isn't enough" % skillResID)  | 
|         return  | 
|     skillManager = curPlayer.GetSkillManager()  | 
|     if skillManager.FindSkillBySkillTypeID(skillResID):  | 
|         GameWorld.DebugLog("__GiveSkill() have learned skill(%s)" % skillResID)  | 
|         return  | 
|     GameWorld.DebugLog('    ¼¤»î·¨±¦ ¼¤»î¼¼ÄÜ skillResID=%s' % (skillResID))  | 
|     skillManager.LVUpSkillBySkillTypeID(skillResID)  | 
|     if isShowSys:  | 
|         PlayerControl.NotifyCode(curPlayer, "GetSkillInfo", [skillResID])  | 
|       | 
|     DataRecordPack.DR_LearnORUPSkill(curPlayer, skillResID, 0)  | 
|     #·¨±¦±»¶¯¼¼ÄÜÐè×°±¸²ÅÉúЧ  | 
|     if skillData.GetFuncType() != ChConfig.Def_SkillFuncType_FbPassiveSkill:  | 
|         PassiveBuffEffMng.GetPassiveEffManager().RegistPassiveEff(curPlayer, skillResID)      | 
|         if SkillCommon.isPassiveAttr(skillData):  | 
|             curControl = PlayerControl.PlayerControl(curPlayer)  | 
|             curControl.RefreshPlayerAttrState()  | 
|       | 
|     PlayerControl.PlayerControl(curPlayer).RefreshSkillFightPowerEx(skillResID, 0)  | 
|     return  | 
|   | 
|   | 
|   | 
| #// A5 0D Éý¼¶·¨±¦¼¼ÄÜ #tagCMMagicWeaponSkillUp  | 
| #  | 
| #struct    tagCMMagicWeaponSkillUp  | 
| #{  | 
| #    tagHead        Head;  | 
| #    WORD        SkillTypeID;  | 
| #    BYTE        CostIndex;  | 
| #};  | 
| def OnMagicWeaponSkillUp(index, clientData, tick):  | 
|     curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)  | 
|     skillTypeID = clientData.SkillTypeID  | 
|     costIndex = clientData.CostIndex #0´ú±íδѡÖР1´ú±íµÚÒ»¸ö  | 
|       | 
|     curSkillType = None  | 
|     SPSkillTypeDict = IpyGameDataPY.GetFuncEvalCfg('SPSkillType')  | 
|     for skillType, skillIDList in SPSkillTypeDict.items():  | 
|         if skillTypeID in skillIDList:  | 
|             curSkillType = int(skillType)  | 
|             break  | 
|     if curSkillType == None:  | 
|         #²»ÊÇ·¨±¦¼¼ÄÜ  | 
|         return  | 
|       | 
|     #»ñµÃÍæ¼Ò¼¼ÄܹÜÀíÆ÷  | 
|     skillManager = curPlayer.GetSkillManager()  | 
|     #»ñµÃ¼¼ÄÜ  | 
|     curSkill = skillManager.FindSkillBySkillTypeID(skillTypeID)  | 
|     if curSkill == None:  | 
|         curSkillLV = 0  | 
|         beforeFightPower = 0  | 
|     else:  | 
|         curSkillLV = curSkill.GetSkillLV()  | 
|         beforeFightPower = curSkill.GetFightPower()  | 
|         if curSkillLV == curSkill.GetSkillMaxLV():  | 
|             #ÒѾÊÇ×î¸ßµÈ¼¶  | 
|             PlayerControl.NotifyCode(curPlayer, "UseMagicLost16")  | 
|             return  | 
|       | 
|     upSkillLv = curSkillLV + 1  | 
|     curSkillID = skillTypeID if not curSkill else curSkill.GetSkillID()  | 
|     upSkill = GameWorld.GetGameData().FindSkillByType(skillTypeID, upSkillLv)  | 
|     if not upSkill:  | 
|         GameWorld.DebugLog("¼¼ÄÜÉý¼¶Åä±í´íÎó ID=%s lv=%s"%(skillTypeID, upSkillLv))  | 
|         return  | 
|       | 
|     if not SkillShell.CheckLearnSkillCondition(curPlayer, upSkill):  | 
|         return  | 
|       | 
|     #Éý¼¶¼¼ÄÜÏûºÄ  | 
|     ipyData = IpyGameDataPY.GetIpyGameData('TreasureSkill', curSkillType, upSkillLv)  | 
|     if not ipyData:  | 
|         return  | 
|       | 
|     needSP = ipyData.GetNeedPoint()  | 
|     if PlayerControl.GetZhenQi(curPlayer) < needSP:  | 
|         GameWorld.DebugLog("·¨±¦sp²»×㣬ÎÞ·¨Éý¼¶¼¼ÄÜ£¡needSP=%s,skillTypeID=%s" % (needSP, skillTypeID), curPlayer.GetPlayerID())  | 
|         return  | 
|       | 
|     initRate = ipyData.GetInitRate() #³õʼ¸ÅÂÊ  | 
|     itemIndexList = []  | 
|       | 
|     if initRate != ShareDefine.Def_MaxRateValue and costIndex > 0:  | 
|         #Âú¸ÅÂʲ»ÏûºÄµÀ¾ß  | 
|         needItemIDList = ipyData.GetNeedItemID()  | 
|         needItemCntList = ipyData.GetNeedItemCnt()  | 
|         maxRateList = ipyData.GetMaxRate()  | 
|         if costIndex - 1 >= len(needItemIDList):  | 
|             GameWorld.Log("·¨±¦¼¼ÄÜÉý¼¶£¬costIndex=%s ´íÎó" % costIndex)  | 
|             return  | 
|         needItemID, needItemCnt, initRate = needItemIDList[costIndex - 1], needItemCntList[costIndex - 1], maxRateList[costIndex - 1]  | 
|         itemPack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptItem)  | 
|         isEnough, itemIndexList = ItemCommon.GetItem_FromPack_ByID(needItemID, itemPack, needItemCnt)  | 
|         if not isEnough:  | 
|             GameWorld.DebugLog("Éý¼¶·¨±¦¼¼ÄÜ() up skill(%s) item(%s) no enough" \  | 
|                                % (upSkill.GetSkillID(), needItemID))  | 
|             return  | 
|           | 
|       | 
|     #¿ÛÎïÆ·  | 
|     if itemIndexList:  | 
|         ItemCommon.ReduceItem(curPlayer, itemPack, itemIndexList, needItemCnt, False, ChConfig.ItemDel_MagicWeapon,   | 
|                               {"SkillTypeID":skillTypeID, "SkillLV":curSkillLV})  | 
|       | 
|     #¸¶Ç®  | 
|     #infoDict = {"SkillID":skillTypeID, "SkillLV":upSkillLv, ChConfig.Def_Cost_Reason_SonKey:upSkill.GetSkillName()}  | 
|     if not PlayerControl.PlayerLostZhenQi(curPlayer, needSP):  | 
|         return  | 
|     playerID = curPlayer.GetPlayerID()  | 
|     maxRateValue = ShareDefine.Def_MaxRateValue  | 
|     randValue = random.randint(0, maxRateValue-1)  | 
|     canHappen = randValue < initRate  | 
|     GameWorld.DebugLog("canHappen=%s,randValue=%s,initRate=%s,maxRateValue=%s"   | 
|                        % (canHappen, randValue, initRate, maxRateValue), playerID)  | 
|     # ²»Êǰٷְٳɹ¦µÄ¼Ç¼ºÏ³ÉÁ÷Ïò  | 
|     if initRate != maxRateValue:  | 
|         drDict = {"PlayerID":playerID, "AccID":curPlayer.GetAccID(), "skillTypeID":skillTypeID, "IsSuccess":canHappen,  | 
|                   "initRate":initRate, "randValue":randValue, "maxRateValue":maxRateValue}  | 
|   | 
|         DataRecordPack.SendEventPack("MagicWeaponSkillUp", drDict, curPlayer)  | 
|   | 
|     if not canHappen:  | 
|         GameWorld.DebugLog("·¨±¦¼¼ÄÜÉý¼¶£¬curSkillID=%s, maxRate=%s Éý¼¶Ê§°Ü" % (curSkillID, initRate))  | 
|         curPlayer.Sync_MakeItemAnswer(ShareDefine.Def_mitMagicWeaponSkillUp, 0)  | 
|         return  | 
|     curControl = PlayerControl.PlayerControl(curPlayer)  | 
|     skillManager.LVUPSkillByID(curSkillID)  | 
|     #´¥·¢Ñ§Ï°Ð¼¼ÄÜ  | 
|     newSkillIsPassive = False  | 
|     potentialSkillLearnDict = IpyGameDataPY.GetFuncEvalCfg('PotentialSkillLearn')  | 
|     if str(skillTypeID) in potentialSkillLearnDict:  | 
|         needSkllLV, newSkillID = potentialSkillLearnDict[str(skillTypeID)]  | 
|         if upSkillLv == needSkllLV:  | 
|             if not skillManager.FindSkillBySkillTypeID(newSkillID):  | 
|                 newSkill = GameWorld.GetGameData().FindSkillByType(newSkillID, 1)  | 
|                 if newSkill:  | 
|                     skillManager.LVUPSkillByID(newSkillID)  | 
|                     GameWorld.DebugLog('    ·¨±¦¼¼ÄÜÉý¼¶ skillTypeID=%s, upSkillLv=%s, ´¥·¢Ñ§Ï°¼¼ÄÜ%s' % (skillTypeID, upSkillLv, newSkillID))  | 
|                     curControl.RefreshSkillFightPowerEx(newSkillID, 0)  | 
|                     PassiveBuffEffMng.GetPassiveEffManager().RegistPassiveEff(curPlayer, newSkillID)  | 
|                     if SkillCommon.isPassiveAttr(newSkill):  | 
|                         newSkillIsPassive = True  | 
|                     PlayerControl.WorldNotify(0, 'SkillPotential2', [curPlayer.GetName(), skillTypeID, upSkillLv, newSkillID])  | 
|               | 
|       | 
|     #֪ͨ¼¼ÄÜÒÑÉý¼¶³É¹¦  | 
|     hasUnlockSkill = False  | 
|     nextSkillDict = GetPotentialsSkillInfo(curPlayer)  | 
|     if skillTypeID in nextSkillDict:  | 
|         needSkilllv,nextSkillID = nextSkillDict[skillTypeID][:2]  | 
|         if upSkillLv == needSkilllv:  | 
|             PlayerControl.WorldNotify(0, 'SkillPotential1', [curPlayer.GetName(), skillTypeID, upSkillLv, nextSkillID])  | 
|             CalcMagicWeaponAttr(curPlayer)  | 
|             hasUnlockSkill = True  | 
|               | 
|     maxLV = upSkill.GetSkillMaxLV()  | 
|     if upSkillLv == maxLV:  | 
|         PlayerControl.WorldNotify(0, 'SkillPotential3', [curPlayer.GetName(), skillTypeID, maxLV])  | 
|       | 
|     if SkillCommon.isPassiveAttr(upSkill) or newSkillIsPassive or hasUnlockSkill:  | 
|         curControl.RefreshPlayerAttrState()  | 
|           | 
|     curControl.RefreshSkillFightPowerEx(upSkill.GetSkillID(), beforeFightPower)  | 
|     PassiveBuffEffMng.GetPassiveEffManager().RegistPassiveEff(curPlayer, upSkill.GetSkillID())  | 
|       | 
|     #»ñµÃ¼¼Äܵȼ¶  | 
|     #curSkillLV = curSkill.GetSkillLV()  | 
|     GameWorld.DebugLog('    ·¨±¦¼¼ÄÜÉý¼¶ skillTypeID=%s, upSkillLv=%s' % (skillTypeID, upSkillLv))  | 
|     DataRecordPack.DR_LearnORUPSkill(curPlayer, skillTypeID, upSkillLv)  | 
|       | 
|     curPlayer.Sync_MakeItemAnswer(ShareDefine.Def_mitMagicWeaponSkillUp, 1)  | 
|       | 
|     SetMWPrivilegeData(curPlayer, ChConfig.MWPrivilege_MWSkillUp, GetSPSkillTotalLV(curPlayer))  | 
|     PlayerSuccess.DoAddSuccessProgress(curPlayer, ShareDefine.SuccType_MWSkillUp, 1, [skillTypeID])  | 
|     EventShell.EventRespons_MWSkillUp(curPlayer)  | 
|     return  | 
|   | 
| def GetSPSkillTotalLV(curPlayer):  | 
|     #DZÁ¦¼¼ÄÜ×ܵȼ¶  | 
|     totalLV = 0  | 
|     skillManager = curPlayer.GetSkillManager()  | 
|     for i in xrange(skillManager.GetSkillCount()):  | 
|         curSkill = skillManager.GetSkillByIndex(i)  | 
|         if curSkill.GetFuncType() != ChConfig.Def_SkillFuncType_FbSPSkill:  | 
|             continue  | 
|         totalLV += curSkill.GetSkillLV()  | 
|     return totalLV  | 
|   | 
| def NotifyMagicWeapon(curPlayer, isLogin=False):  | 
|     #֪ͨ·¨±¦ÐÅÏ¢  | 
|     packData = ChPyNetSendPack.tagMCMagicWeaponData()  | 
|     packData.Clear()  | 
|     packData.MagicWeaponID = []  | 
|   | 
|     ipyDataMgr = IpyGameDataPY.IPY_Data()  | 
|     for i in xrange(ipyDataMgr.GetTreasureCount()):  | 
|         ipyData = ipyDataMgr.GetTreasureByIndex(i)  | 
|         magicWeaponID = ipyData.GetID()  | 
|         isActive = GetIsActiveMagicWeapon(curPlayer, magicWeaponID)  | 
|         if not isActive:  | 
|             continue  | 
|         packData.MagicWeaponID.append(magicWeaponID)  | 
|           | 
|     packData.Num = len(packData.MagicWeaponID)  | 
|     if packData.Num or isLogin:  | 
|         NetPackCommon.SendFakePack(curPlayer, packData)  | 
|     return  | 
|   | 
|   | 
| ##--------------------------------------------------------------------------------------------------  | 
| def GetMWRefineIpyData(treasureID, treasureLV):  | 
|     #»ñÈ¡·¨±¦µÈ¼¶ÐÅÏ¢  | 
|     return IpyGameDataPY.GetIpyGameDataNotLog("TreasureRefine", treasureID, treasureLV)  | 
|   | 
| def CalcMagicWeaponAttr(curPlayer):  | 
|     ## ¼ÆËã·¨±¦ÊôÐÔ  | 
|     allAttrList1 = [{} for _ in range(4)] #ÈË×å·¨±¦  | 
|     allAttrList2 = [{} for _ in range(4)] #ħ×å·¨±¦  | 
|     allAttrList3 = [{} for _ in range(4)] #ÏÉ×å·¨±¦  | 
|   | 
|     signDayMWID = IpyGameDataPY.GetFuncCfg('MWSignDayAttr', 2)  | 
|     ipyDataMgr = IpyGameDataPY.IPY_Data()  | 
|     for i in xrange(ipyDataMgr.GetTreasureCount()):  | 
|         treasureIpyData = ipyDataMgr.GetTreasureByIndex(i)  | 
|         magicWeaponID = treasureIpyData.GetID()  | 
|         isActive = GetIsActiveMagicWeapon(curPlayer, magicWeaponID)  | 
| #        if not isActive:  | 
| #            continue  | 
|         allAttrDict = {}  | 
|         #=======================================================================  | 
|         # #ÖýÁ¶ÊôÐÔ  | 
|         # mwRefineLv = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_MagicWeaponRefineLV % magicWeaponID)  | 
|         # refineipyData = GetMWRefineIpyData(magicWeaponID, mwRefineLv)  | 
|         # if refineipyData:    | 
|         #    attrDict = refineipyData.GetTreasureAttr()  | 
|         #    GameWorld.AddDictValue(allAttrDict, attrDict)  | 
|         #=======================================================================  | 
|         treasureType = treasureIpyData.GetTreasureType()  | 
|         if isActive:  | 
|             #µÈ¼¶ÊôÐÔ  | 
|             curMWLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_MagicWeaponLV % magicWeaponID)  | 
|             for lv in xrange(curMWLV+1):  | 
|                 upIpyData = IpyGameDataPY.GetIpyGameDataNotLog('TreasureUp', magicWeaponID, lv)  | 
|                 if upIpyData:  | 
|                     attrDict = upIpyData.GetAddAttr()  | 
|                     GameWorld.AddDictValue(allAttrDict, attrDict)  | 
|                       | 
|             if magicWeaponID == signDayMWID:  | 
|                 #Ç©µ½ÊôÐÔ  | 
|                 totalSignNum = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TotalSignNum) # ×ÜÇ©µ½ÌìÊý  | 
|                 addAttr = {}  | 
|                 for attid, attnum in IpyGameDataPY.GetFuncEvalCfg('MWSignDayAttr', 1, {}).items():  | 
|                     addAttr[int(attid)] = attnum * totalSignNum  | 
|                 GameWorld.AddDictValue(allAttrDict, addAttr)  | 
|           | 
|         fbpasslv = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_MWFBPassLevel % magicWeaponID)  | 
|         #ÀϺÅÒѼ¤»îµÄħ×å·¨±¦Ã»Óйؿ¨ÊôÐÔ£¬Ö±½ÓÉèÖÃÂú¹Ø¿¨  | 
|         if isActive and not fbpasslv:  | 
|             ipyDataList = IpyGameDataPY.GetIpyGameDataByCondition('MagicWeaponFB', {'MWID':magicWeaponID}, True, False)  | 
|             if ipyDataList:  | 
|                 maxLevel = ipyDataList[-1].GetLevel()  | 
|                 fbpasslv = maxLevel  | 
|                 PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_MWFBPassLevel % magicWeaponID, maxLevel)  | 
|                 GameWorld.Log('ÀϺÅÒѼ¤»îµÄħ×å·¨±¦Ã»Óйؿ¨ÊôÐÔ£¬Ö±½ÓÉèÖÃÂú¹Ø¿¨ magicWeaponID=%s,maxLevel=%s'%(magicWeaponID, maxLevel), curPlayer.GetID())  | 
|         if fbpasslv: #¸±±¾¹Ø¿¨ÊôÐÔ  | 
|             fbipyData = IpyGameDataPY.GetIpyGameData('MagicWeaponFB', magicWeaponID, fbpasslv)  | 
|             if fbipyData:  | 
|                 attrDict = fbipyData.GetAttrDict()  | 
|                 for effID, value in attrDict.items():  | 
|                     effID = int(effID)  | 
|                     allAttrDict[effID] = allAttrDict.get(effID, 0) + value  | 
|                   | 
|                   | 
|         for effID, value in allAttrDict.items():  | 
|             if treasureType == 1:  | 
|                 PlayerControl.CalcAttrDict_Type(effID, value, allAttrList1)  | 
|             elif treasureType == 2:  | 
|                 PlayerControl.CalcAttrDict_Type(effID, value, allAttrList2)  | 
|             elif treasureType == 3:  | 
|                 PlayerControl.CalcAttrDict_Type(effID, value, allAttrList3)  | 
|             else:  | 
|                 GameWorld.ErrLog("δ֪·¨±¦ÊôÐÔ, magicWeaponID=%s,treasureType=%s,effID=%s,value=%s"   | 
|                                  % (magicWeaponID, treasureType, effID, value), curPlayer.GetPlayerID())  | 
|       | 
|     PlayerControl.SetCalcAttrListValue(curPlayer, ChConfig.Def_CalcAttrFunc_MagicWeapon1, allAttrList1)  | 
|     PlayerControl.SetCalcAttrListValue(curPlayer, ChConfig.Def_CalcAttrFunc_MagicWeapon2, allAttrList2)  | 
|     PlayerControl.SetCalcAttrListValue(curPlayer, ChConfig.Def_CalcAttrFunc_MagicWeapon3, allAttrList3)  | 
|     #¼¼ÄܽâËøÕ½Á¦  | 
|     nextSkillDict = GetPotentialsSkillInfo(curPlayer)  | 
|     addPowerDict = {}  | 
|     for skillID, info in nextSkillDict.items():  | 
|         needSkilllv, nextSkillID, addPower = info  | 
|         skillManager = curPlayer.GetSkillManager()  | 
|         curSkill = skillManager.FindSkillBySkillTypeID(skillID)  | 
|         if not curSkill:  | 
|             continue  | 
|         curSkillLV = curSkill.GetSkillLV()  | 
|         if curSkillLV < needSkilllv:  | 
|             continue  | 
|         mfpType = ChConfig.Def_SkillFuncType_MFPType.get(curSkill.GetFuncType(), ShareDefine.Def_MFPType_Role)  | 
|         addPowerDict[mfpType] = addPowerDict.get(mfpType, 0) + addPower  | 
|       | 
|     for mfpType, addPower in addPowerDict.items():  | 
|         curPlayer.SetDict(ChConfig.Def_PlayerKey_MFPEx % mfpType, addPower)  | 
|     return  | 
|   | 
| #// A5 77 Íæ¼Ò¾«Á¶·¨±¦ #tagCMMWRefine  | 
| #  | 
| #struct tagCMMWRefine  | 
| #{  | 
| #    tagHead    Head;  | 
| #    DWORD    MWID;    // ·¨±¦ID  | 
| #    DWORD   MaterialID; //²ÄÁÏID  | 
| #};  | 
| def PlayerMWRefine(index, clientPack, tick):  | 
|     mwID = clientPack.MWID # ·¨±¦ID  | 
|     materialID = clientPack.MaterialID # ÌáÉý¸ÅÂÊÎïÆ·ID  | 
|     curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)  | 
|     playerID = curPlayer.GetPlayerID()  | 
|     allTreasureItemIDList = IpyGameDataPY.GetFuncEvalCfg("TreasureUpRateItem")  | 
|     if mwID not in allTreasureItemIDList:  | 
|         GameWorld.DebugLog("¸Ã·¨±¦²»ÄÜÖýÁ¶-·¨±¦ID:%s" % mwID, playerID)  | 
|         return  | 
|       | 
|     isActive = GetIsActiveMagicWeapon(curPlayer, mwID)  | 
|     if not isActive:  | 
|         GameWorld.DebugLog("·¨±¦Î´¼¤»î£¬²»ÄÜÖýÁ¶-·¨±¦ID:%s" % mwID, playerID)  | 
|         return  | 
|       | 
|     nextRefineLv = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_MagicWeaponRefineLV % mwID) + 1  | 
|     mwRefineIpyData = GetMWRefineIpyData(mwID, nextRefineLv)  | 
|     if not mwRefineIpyData:  | 
|         GameWorld.DebugLog("·¨±¦ÒÑÂú¼¶£¬²»ÄÜÖýÁ¶-·¨±¦ID:%s, nextRefineLv=%s" % (mwID, nextRefineLv), playerID)  | 
|         return  | 
|       | 
|     # ËùÐèÁ¶µ¤Â¯µÈ¼¶  | 
|     alchemyLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_AlchemyLV)  | 
|     if alchemyLV < mwRefineIpyData.GetNeedAlchemyLV():  | 
|         GameWorld.DebugLog("Á¶µ¤Â¯µÈ¼¶²»×㣬ÎÞ·¨ÖýÁ¶·¨±¦-·¨±¦ID:%s, nextRefineLv=%s,alchemyLV=%s,NeedAlchemyLV=%s"   | 
|                            % (mwID, nextRefineLv, alchemyLV, mwRefineIpyData.GetNeedAlchemyLV()), playerID)  | 
|         return  | 
|       | 
|     # ËùÐèËùÓз¨±¦µÈ¼¶  | 
|     needAllTreasureLV = mwRefineIpyData.GetNeedAllTreasureLV()  | 
|     for tID in allTreasureItemIDList:  | 
|         if curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_MagicWeaponRefineLV % tID) < needAllTreasureLV:  | 
|             GameWorld.DebugLog("ËùÓз¨±¦Ðè´ïµ½¶ÔÓ¦µÈ¼¶ºó²Å¿É¼ÌÐøÖýÁ¶! needAllTreasureLV=%s" % needAllTreasureLV, playerID)  | 
|             return  | 
|           | 
|     needItemDict = mwRefineIpyData.GetMaterial()  | 
|       | 
|     fujiaRate = 0  | 
|     if materialID:  | 
|         treasureUpRateItem = IpyGameDataPY.GetFuncEvalCfg("TreasureUpRateItem", 2)  | 
|         if materialID not in treasureUpRateItem:  | 
|             GameWorld.ErrLog("¸ÃÎïÆ·IDÎÞ·¨ÓÃÓÚÌáÉý·¨±¦ÖýÁ¶¸ÅÂÊ£¡itemID=%s" % (materialID), playerID)  | 
|             return  | 
|         rateItemData = GameWorld.GetGameData().GetItemByTypeID(materialID)  | 
|         if not rateItemData:  | 
|             return  | 
|         fujiaRate = rateItemData.GetEffectByIndex(0).GetEffectValue(0)  | 
|         needItemDict[materialID] = 1  | 
|           | 
|     itemPack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptItem)  | 
|     lackItemDict, delInfoDict = ItemCommon.GetCostItemIndexList(needItemDict, itemPack)  | 
|     if lackItemDict:  | 
|         GameWorld.DebugLog("·¨±¦ÖýÁ¶²ÄÁϲ»×㣡·¨±¦ID:%s, nextRefineLv=%s,needItemDict=%s,lackItemDict=%s,hasItemDict=%s"   | 
|                            % (mwID, nextRefineLv, needItemDict, lackItemDict, delInfoDict), playerID)  | 
|         return  | 
|     ItemCommon.DelCostItem(curPlayer, itemPack, delInfoDict, ChConfig.ItemDel_MagicWeapon)  | 
|       | 
|     successRate = mwRefineIpyData.GetSuccessRate() + fujiaRate  | 
|     if GameWorld.CanHappen(successRate):  | 
|         PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_MagicWeaponRefineLV % mwID, nextRefineLv)  | 
|         skillID = mwRefineIpyData.GetOpenSkill()  | 
|         if skillID:  | 
|             GiveSkill(curPlayer, skillID, tick)  | 
|         CalcMagicWeaponAttr(curPlayer)  | 
|         PlayerControl.PlayerControl(curPlayer).RefreshPlayerAttrState()  | 
|         #֪ͨ¿Í»§¶Ë      | 
|         Sycn_MagicWeaponRefineLV(curPlayer, mwID)  | 
|         curPlayer.Sync_MakeItemAnswer(ShareDefine.Def_mitMWUpLevel, ChConfig.Def_ComposeState_Sucess)  | 
|         GameWorld.DebugLog("·¨±¦ÖýÁ¶³É¹¦! ·¨±¦ID:%s, upRefineLv=%s,successRate=%s" % (mwID, nextRefineLv, successRate), playerID)  | 
|     else:  | 
|         curPlayer.Sync_MakeItemAnswer(ShareDefine.Def_mitMWUpLevel, ChConfig.Def_ComposeState_Fail)  | 
|         GameWorld.DebugLog("·¨±¦ÖýÁ¶Ê§°Ü! ·¨±¦ID:%s, nextRefineLv=%s,successRate=%s" % (mwID, nextRefineLv, successRate), playerID)  | 
|           | 
|     return  | 
|   | 
| def Sycn_MagicWeaponRefineLV(curPlayer, mwID= -1):  | 
|     if mwID == -1:  | 
|         needCalList = IpyGameDataPY.GetFuncEvalCfg("TreasureUpRateItem")  | 
|     else:  | 
|         needCalList = [mwID]  | 
|     sendPack = ChPyNetSendPack.tagMCMagicWeaponMsg()  | 
|     sendPack.MWInfo = []  | 
|     for mwID in needCalList:  | 
|         mwRefineLv = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_MagicWeaponRefineLV % mwID)  | 
|         if not mwRefineLv:  | 
|             continue  | 
|         pack = ChPyNetSendPack.tagMCMagicWeaponLV()  | 
|         pack.MWID = mwID  | 
|         pack.MWLV = mwRefineLv  | 
|         sendPack.MWInfo.append(pack)  | 
|     sendPack.Count = len(sendPack.MWInfo)  | 
|     if sendPack.Count:  | 
|         NetPackCommon.SendFakePack(curPlayer, sendPack)  | 
|     return  | 
|   | 
| #// A5 0E ¿ªÆô·¨±¦ #tagCMOpenMagicWeapon  | 
| #  | 
| #struct    tagCMOpenMagicWeapon  | 
| #  | 
| #{  | 
| #    tagHead        Head;  | 
| #    DWORD        MWID;  | 
| #};  | 
| def OnOpenMagicWeapon(index, clientData, tick):  | 
|     curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)  | 
|     mwID = clientData.MWID  | 
|     isActive = GetIsActiveMagicWeapon(curPlayer, mwID)  | 
|     if isActive:  | 
|         GameWorld.DebugLog('    ¸Ã·¨±¦ÒÑ¿ªÆô£¡ mwID=%s' % mwID)  | 
|         return  | 
|     succIDList = GetNeedSuccIDByMWID(mwID)  | 
|     curExp = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_MagicWeaponExp % mwID)  | 
|     if curExp < len(succIDList):  | 
|         GameWorld.DebugLog('    ¸Ã·¨±¦ËùÐè³É¾ÍδÍê³É£¡ mwID=%s£¬ curExp=%s, succIDList=%s' % (mwID, curExp, succIDList))  | 
|         return  | 
|     #ÏûºÄÎïÆ·ÅÐ¶Ï  | 
|     ipyData = GetWMIpyData(mwID)  | 
|     needItemDict = ipyData.GetNeedItem()  | 
|     if needItemDict:  | 
|         #ͨ¹ý´Ë;¾¶½âËø·¨±¦ ±ØÐëÒªÅäÏûºÄÎïÆ·  | 
|           | 
|         itemPack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptItem)  | 
|         lackItemDict, delInfoDict = ItemCommon.GetCostItemIndexList(needItemDict, itemPack, False)  | 
|         if lackItemDict:  | 
|             GameWorld.DebugLog("    ¿ªÆô·¨±¦ ²ÄÁϲ»×㣡mwID=%s,needItemDict=%s,lackItemDict=%s,delInfoDict=%s"   | 
|                                % (mwID, needItemDict, lackItemDict, delInfoDict))  | 
|             return  | 
|           | 
|         #¿ÛÏûºÄ  | 
|         ItemCommon.DelCostItem(curPlayer, itemPack, delInfoDict, ChConfig.ItemDel_MagicWeapon)  | 
|     else:  | 
|         ipyDataList = IpyGameDataPY.GetIpyGameDataByCondition('XBXZ', {'MWID':mwID}, True, False)  | 
|         if not ipyDataList:  | 
|             return  | 
|         for ipyData in ipyDataList:  | 
|             if not GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_PDict_XBXZAwardRecord, ipyData.GetID()):  | 
|                 return  | 
|               | 
|       | 
|     DoActiveMW(curPlayer, mwID)  | 
|     return  | 
|   | 
| #-------------------------------------------------------------------------------  | 
|   | 
| def OnGetXBXZAward(curPlayer, index):  | 
|     ##Ïɱ¦Ñ°Ö÷Áì½±  | 
|     ipyData = IpyGameDataPY.GetIpyGameData('XBXZ', index)  | 
|     if not ipyData:  | 
|         return  | 
|     if GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_PDict_XBXZAwardRecord, index):  | 
|         GameWorld.DebugLog('    Ïɱ¦Ñ°Ö÷Áì½± ÒÑÁìÈ¡£¡ index=%s' % index)  | 
|         return  | 
|       | 
|     curType = ipyData.GetType()  | 
|     conditionList = ipyData.GetCondition()  | 
|     cnt = 0  | 
|     if curType == 1:  | 
|         #½ÇÉ«·ÀÓùµ½XX  | 
|         cnt = PlayerControl.GetFuncDef(curPlayer)  | 
|           | 
|     elif curType == 2:  | 
|         #´©´÷Èý½×³ÈÉ«1ÐÇ»òËĽ××ÏÉ«1ÐÇÒÔÉÏÍ·¿ø  | 
|         playerEquip = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptEquip)  | 
|         SamboSpecialUnlock = IpyGameDataPY.GetFuncEvalCfg('SamboSpecialUnlock')  | 
|         for equipIndex in xrange(playerEquip.GetCount()):  | 
|             curEquip = playerEquip.GetAt(equipIndex)  | 
|             if curEquip.IsEmpty():  | 
|                 continue  | 
|             curClassLV = ItemCommon.GetItemClassLV(curEquip)  | 
|             itemColor = curEquip.GetItemColor()  | 
|             itemQuality = curEquip.GetItemQuality()  | 
|             itemID = curEquip.GetItemTypeID()  | 
|             for classlv, color, star, place in conditionList:  | 
|                 if equipIndex is place and itemID in SamboSpecialUnlock:  | 
|                     cnt = 1  | 
|                     break  | 
|                 if equipIndex is place and curClassLV >= classlv and itemColor >= color and itemQuality >= star:  | 
|                     cnt = 1  | 
|                     break  | 
|             if cnt:  | 
|                 break  | 
|     elif curType == 3:  | 
|         #È«Éí×°±¸XÐÇ  | 
|         cnt = ChEquip.GetTotalEquipStars(curPlayer)  | 
|           | 
|     elif curType == 4:  | 
|         #X½×ÆÕͨ¡¢Ç¿»¯Ì××°  | 
|         suiteCntDict = {}  | 
|         playerEquip = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptEquip)  | 
|         for equipIndex in xrange(playerEquip.GetCount()):  | 
|             curEquip = playerEquip.GetAt(equipIndex)  | 
|             if curEquip.IsEmpty():  | 
|                 continue  | 
|             suiteInfo = ChEquip.GetSuiteInfoByPlace(curPlayer, equipIndex, curEquip)  | 
|             for suitelv, suiteType in conditionList:  | 
|                 if suiteInfo.get(suiteType, 0) >= suitelv:  | 
|                     suiteCntDict[suiteType] = suiteCntDict.get(suiteType, 0)+1  | 
|         cnt = max(suiteCntDict.values()) if suiteCntDict else 0  | 
|           | 
|     else:  | 
|         return  | 
|     if cnt < ipyData.GetNeedCnt():  | 
|         GameWorld.DebugLog('    Ïɱ¦Ñ°Ö÷Áì½± , Ìõ¼þ²»Âú×ã ID=%s, cnt=%s,NeedCnt=%s' % (index, cnt, ipyData.GetNeedCnt()))  | 
|         return  | 
|       | 
|     # ¼ì²é±³°ü  | 
|     awardItemList = ipyData.GetAwardItem()  | 
|     if awardItemList:  | 
|         packSpace = ItemCommon.GetItemPackSpace(curPlayer, IPY_GameWorld.rptItem)  | 
|         needSpace = len(awardItemList)  | 
|         if needSpace > packSpace:  | 
|             PlayerControl.NotifyCode(curPlayer, "GeRen_chenxin_998371")  | 
|             return  | 
|       | 
|     # ¸üÐÂÁì½±¼Ç¼  | 
|     GameWorld.SetDictValueByBit(curPlayer, ChConfig.Def_PDict_XBXZAwardRecord, index, 1)  | 
|       | 
|     # ¸øÎïÆ·  | 
|     if awardItemList:  | 
|         for itemID, itemCnt in awardItemList:  | 
|             ItemControler.GivePlayerItem(curPlayer, itemID, itemCnt, 1, [IPY_GameWorld.rptItem], True)  | 
|          | 
|     #¸øÇ®  | 
|     for moneyType, value in ipyData.GetMoney():  | 
|         PlayerControl.GiveMoney(curPlayer, moneyType, value)  | 
|     SyncXBXZAwardRecord(curPlayer,[index])  | 
|     #³É¾Í  | 
|     PlayerSuccess.DoAddSuccessProgress(curPlayer, ShareDefine.SuccType_XBXZ, 1, [ipyData.GetMWID()])  | 
|     GameWorld.DebugLog('    Ïɱ¦Ñ°Ö÷Áì½±OK, ID=%s, cnt=%s' % (index, cnt))  | 
|     return  | 
|   | 
|   | 
| ## Í¨ÖªÏɱ¦Ñ°Ö÷¶ÔÓ¦½±ÀøÁì½±¼Ç¼  | 
| #  @param None  | 
| #  @return  | 
| def SyncXBXZAwardRecord(curPlayer, syncIDList=[]):  | 
|     if syncIDList:  | 
|         recordIndexList = []  | 
|         for succID in syncIDList:  | 
|             recordIndexList.append(succID / 31)  | 
|     else:  | 
|         ipyDataMgr = IpyGameDataPY.IPY_Data()  | 
|         succCnt = ipyDataMgr.GetXBXZCount()  | 
|         if not succCnt:  | 
|             return  | 
|         maxSuccid = ipyDataMgr.GetXBXZByIndex(succCnt-1).GetID()  | 
|         recordIndexList = range(maxSuccid / 31+1)  | 
|               | 
|     succFARPack = ChPyNetSendPack.tagMCXBXZAwardRecordList()  | 
|     succFARPack.Clear()  | 
|     succFARPack.RecordList = []  | 
|     for i in recordIndexList:  | 
|         awardRecord=curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_XBXZAwardRecord%i)  | 
|         if not awardRecord:  | 
|             continue  | 
|         recordInfo = ChPyNetSendPack.tagMCXBXZAwardRecord()  | 
|         recordInfo.RecordIndex = i  | 
|         recordInfo.Record = awardRecord  | 
|         succFARPack.RecordList.append(recordInfo)  | 
|      | 
|     succFARPack.RecordCnt = len(succFARPack.RecordList)  | 
|     NetPackCommon.SendFakePack(curPlayer, succFARPack)  | 
|     return  | 
|   | 
| #-------------------------------------------------------------------------------  | 
| #// A5 15 ÌáÉý·¨±¦µÈ¼¶ #tagCMMagicWeaponUp  | 
| #  | 
| #struct    tagCMMagicWeaponUp  | 
| #  | 
| #{  | 
| #    tagHead        Head;  | 
| #    DWORD        WMID;    //·¨±¦ID  | 
| #};  | 
| def OnMagicWeaponUp(index, clientData, tick):  | 
|     #·¨±¦Éý¼¶  | 
|     curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)  | 
|     mwID = clientData.MWID  | 
|     curMWLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_MagicWeaponLV % mwID)  | 
|     nextMWLV = curMWLV+1  | 
|     nextIpyData = IpyGameDataPY.GetIpyGameData('TreasureUp', mwID, nextMWLV)  | 
|     if not nextIpyData:  | 
|         return  | 
|     needExp = nextIpyData.GetNeedExp()  | 
|     curUpExp = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_MagicWeaponUpExp % mwID)  | 
|     if curUpExp < needExp:  | 
|         GameWorld.DebugLog('·¨±¦Éý¼¶¾Ñé²»×ã%s'%needExp)  | 
|         return  | 
|     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_MagicWeaponUpExp % mwID, curUpExp-needExp)  | 
|       | 
|     DoActiveMW(curPlayer, mwID, nextMWLV)  | 
|       | 
|     return  | 
|   | 
| def AddMagicWeaponUpExp(curPlayer, mwID, addExp):  | 
|     #Ôö¼Ó·¨±¦Éý¼¶¾Ñé  | 
|     GameWorld.DebugLog('Ôö¼Ó·¨±¦Éý¼¶¾Ñé mwID=%s,addExp=%s'%(mwID, addExp))  | 
|     curUpExp = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_MagicWeaponUpExp % mwID)  | 
|     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_MagicWeaponUpExp % mwID, curUpExp+addExp)  | 
|     Sycn_MagicWeaponLV(curPlayer, mwID)  | 
|     # Ã¿Èջ  | 
|     ipyData = GetWMIpyData(mwID)  | 
|     mwType = ipyData.GetTreasureType() if ipyData else 0  | 
|     if mwType == 1:  | 
|         PlayerActivity.AddDailyActionFinishCnt(curPlayer, ShareDefine.DailyActionID_MagicWeapon)  | 
|     return  | 
|   | 
| def Sycn_MagicWeaponLV(curPlayer, mwID= -1):  | 
|     #֪ͨ·¨±¦µÈ¼¶ÐÅÏ¢  | 
|     if mwID == -1:  | 
|         needCalList = []  | 
|         ipyDataMgr = IpyGameDataPY.IPY_Data()  | 
|         for i in xrange(ipyDataMgr.GetTreasureCount()):  | 
|             ipyData = ipyDataMgr.GetTreasureByIndex(i)  | 
|             needCalList.append(ipyData.GetID())  | 
|     else:  | 
|         needCalList = [mwID]  | 
|     sendPack = ChPyNetSendPack.tagMCMagicWeaponLVInfo()  | 
|     sendPack.InfoList = []  | 
|     for mwID in needCalList:  | 
|         mwLv = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_MagicWeaponLV % mwID)  | 
|         curUpExp = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_MagicWeaponUpExp % mwID)  | 
|         state = GetIsClickMagicWeapon(curPlayer, mwID)  | 
|         FBPassLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_MWFBPassLevel % mwID)  | 
|         if not mwLv and not curUpExp and not state and not FBPassLV:  | 
|             continue  | 
|         pack = ChPyNetSendPack.tagMCMagicWeaponInfo()  | 
|         pack.MWID = mwID  | 
|         pack.LV = mwLv  | 
|         pack.Exp = curUpExp  | 
|         pack.State = state  | 
|         pack.FBPassLV = FBPassLV  | 
|         sendPack.InfoList.append(pack)  | 
|     sendPack.Count = len(sendPack.InfoList)  | 
|     if sendPack.Count:  | 
|         NetPackCommon.SendFakePack(curPlayer, sendPack)  | 
|     return  | 
|   | 
| def GetMagicWeaponPrivilege(curPlayer, privilege):  | 
|     #·¨±¦µÈ¼¶È¨ÏÞ  | 
|     if not GetIsActiveMWSoul(curPlayer, privilege):  | 
|         return 0  | 
|     privilegeIpyData = IpyGameDataPY.GetIpyGameDataNotLog('TreasurePrivilege', privilege)  | 
|     if not privilegeIpyData:  | 
|         return 0  | 
|     return privilegeIpyData  | 
|   | 
| def GetMagicWeaponPrivilegeAttr(curPlayer, privilege):  | 
|     #»ñÈ¡·¨±¦ÌØÈ¨Ôö¼ÓµÄÊôÐÔ  | 
|     addAttr = {}  | 
|     privilegeIpyData = IpyGameDataPY.GetIpyGameDataNotLog('TreasurePrivilege', privilege)  | 
|     if not privilegeIpyData:  | 
|         return addAttr  | 
|     attrInfo = privilegeIpyData.GetAddAttr()  | 
|     if not attrInfo:  | 
|         attrInfo = {}  | 
|     singleValue = privilegeIpyData.GetSingleValue()  | 
|       | 
|     if privilege == ChConfig.MWPrivilege_EquipPlus:  | 
|         #Ç¿»¯¼Ó³É  | 
|         addAttr = ChEquip.CalcAllEquipAllPlusLVAttr(curPlayer)  | 
|     else:   | 
|         multiple = 1 #±¶Êý  | 
|         if singleValue:  | 
|             gotValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_MWSoulGotValue % privilege)  | 
|             maxValue = privilegeIpyData.GetMaxValue()  | 
|             if maxValue:  | 
|                 gotValue = min(maxValue, gotValue)  | 
|             multiple = gotValue/singleValue  | 
|         for attid, attnum in attrInfo.items():  | 
|             addAttr[int(attid)] = attnum * multiple  | 
|       | 
|     GameWorld.DebugLog('    »ñÈ¡·¨±¦ÌØÈ¨Ôö¼ÓµÄÊôÐÔ privilege=%s,addAttr=%s' % (privilege,addAttr), curPlayer.GetID())  | 
|     return addAttr  | 
|   | 
| def SetMWPrivilegeData(curPlayer, privilege, data, isAdd=False):  | 
|     ##ÉèÖ÷¨±¦ÌØÈ¨Ïà¹ØÊý¾Ý  | 
|     privilegeIpyData = IpyGameDataPY.GetIpyGameDataNotLog('TreasurePrivilege', privilege)  | 
|     if not privilegeIpyData:  | 
|         return  | 
|     curGotValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_MWSoulGotValue % privilege)  | 
|     singleValue = privilegeIpyData.GetSingleValue()  | 
|     if singleValue and curGotValue % singleValue:  | 
|         fixGotValue = curGotValue/singleValue*singleValue  | 
|         PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_MWSoulGotValue % privilege, fixGotValue)  | 
|         GameWorld.Log('Íæ¼Ò·¨±¦Ö®»êÒÑÁìµÄÊý¾Ý²»Êǵ¥´Î½ø¶ÈµÄ±¶Êý£¬ÐÞ¸´! privilege=%s,curGotValue=%s, fixGotValue=%s'%(privilege, curGotValue, fixGotValue))  | 
|       | 
|     curValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_MWSoulCurValue % privilege)  | 
|     newData = curValue + data if isAdd else data  | 
|     maxValue = privilegeIpyData.GetMaxValue()  | 
|     if maxValue:  | 
|         newData = min(maxValue, newData)  | 
|     if curValue != newData:  | 
|         PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_MWSoulCurValue % privilege, newData)  | 
|   | 
|         Sycn_MWPrivilegeData(curPlayer, privilege)  | 
|     GameWorld.Log('    privilege=%s,data=%s,curValue=%s,newData=%s'%(privilege, data,curValue,newData))  | 
|     return  | 
|   | 
| def GetMWSoulAward(curPlayer, privilege):  | 
|     #ÁìÈ¡·¨±¦Ö®»ê½±Àø  | 
|     ipyData = GetMagicWeaponPrivilege(curPlayer, privilege)  | 
|     if not ipyData:  | 
|         GameWorld.DebugLog('ÁìÈ¡·¨±¦Ö®»ê½±Àø£¬¶ÔÓ¦·¨±¦Ö®»êδ¼¤»î£¬»òδÅäÖàprivilege=%s'%privilege)  | 
|         return  | 
|     singleValue = ipyData.GetSingleValue()  | 
|     maxValue = ipyData.GetMaxValue()  | 
|     if singleValue:  | 
|         #´ïµ½½ø¶ÈÔò¿ÉÁìÈ¡ÊôÐÔ  | 
|         curValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_MWSoulCurValue % privilege)  | 
|         gotValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_MWSoulGotValue % privilege)  | 
|         if gotValue >= curValue:  | 
|             return  | 
|         canGetCnt = (curValue - gotValue) / singleValue  | 
|         if canGetCnt <= 0 and maxValue and curValue >= maxValue:  | 
|             canGetCnt = 1 #ÒÑ´ïµ½´ÎÊýÉÏÏÞ£¬×îºóÒ»´Î²»¹ÜÊÇ·ñÂú×ã¶¼ÈÃÁì(Ò»°ãÊÇÒòΪÅäÖôíÎó»òÕß±ä¸üµ¼ÖÂ)  | 
|         if canGetCnt <= 0:  | 
|             return  | 
|         updGotCnt = min(maxValue, gotValue+canGetCnt*singleValue) if maxValue else gotValue+canGetCnt*singleValue  | 
|         PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_MWSoulGotValue % privilege, updGotCnt)  | 
|         CalcMagicWeaponSoulAttr(curPlayer)  | 
|         PlayerControl.PlayerControl(curPlayer).RefreshPlayerAttrState()  | 
|           | 
|           | 
|     itemList = ipyData.GetItemAward()  | 
|     if itemList:  | 
|         #ÿÈÕÎïÆ·½±Àø  | 
|         if curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_MWSoulGotItemState % privilege):  | 
|             GameWorld.Log('    ÁìÈ¡·¨±¦Ö®»ê½±Àø ½ñÈÕÒÑÁìÈ¡ privilege=%s'%privilege)  | 
|             return  | 
|         needSpace = len(itemList)  | 
|         packSpace = ItemCommon.GetItemPackSpace(curPlayer, IPY_GameWorld.rptItem, needSpace)  | 
|         if needSpace > packSpace:  | 
|             PlayerControl.NotifyCode(curPlayer, "GeRen_chenxin_676165", [IPY_GameWorld.rptItem])  | 
|             return  | 
|         PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_MWSoulGotItemState % privilege, 1)  | 
|         for itemid, cnt, isBind in itemList:  | 
|             ItemControler.GivePlayerItem(curPlayer, int(itemid), int(cnt), isBind,  | 
|                                          [IPY_GameWorld.rptItem], True, showSysInfo=True, event=["MWSoulAward", False, {"privilege":privilege}])  | 
|       | 
|     #֪ͨ  | 
|     Sycn_MWPrivilegeData(curPlayer, privilege)  | 
|     return  | 
|   | 
| def Sycn_MWPrivilegeData(curPlayer, privilegeID= -1, isForce=False):  | 
|     #֪ͨ·¨±¦ÌØÈ¨ÐÅÏ¢  | 
|     if privilegeID == -1:  | 
|         needCalList = ChConfig.MWPrivilegeList  | 
|     else:  | 
|         needCalList = [privilegeID]  | 
|     sendPack = ChPyNetSendPack.tagMCMWPrivilegeDataInfo()  | 
|     sendPack.InfoList = []  | 
|     for priID in needCalList:  | 
|         pack = ChPyNetSendPack.tagMCMWPrivilegeData()  | 
|         pack.CurValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_MWSoulCurValue % priID)  | 
|         pack.GotValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_MWSoulGotValue % priID)  | 
|         pack.ItemAwardState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_MWSoulGotItemState % priID)  | 
|         pack.State = GetIsActiveMWSoul(curPlayer, priID)  | 
|         if not isForce and max([pack.CurValue, pack.GotValue, pack.ItemAwardState, pack.State]) == 0:  | 
|             continue  | 
|         pack.PriID = priID  | 
|         sendPack.InfoList.append(pack)  | 
|     sendPack.Count = len(sendPack.InfoList)  | 
|     if sendPack.Count:  | 
|         NetPackCommon.SendFakePack(curPlayer, sendPack)  | 
|     return  | 
|   | 
| #// A5 16 ·¨±¦×´Ì¬¼Ç¼ #tagCMMagicWeaponState  | 
| #  | 
| #struct    tagCMMagicWeaponState  | 
| #  | 
| #{  | 
| #    tagHead        Head;  | 
| #    DWORD        MWID;    //·¨±¦ID  | 
| #};  | 
| def SaveMagicWeaponState(index, clientData, tick):  | 
|     curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)  | 
|     mwID = clientData.MWID  | 
|     if GetIsClickMagicWeapon(curPlayer, mwID):  | 
|         return  | 
|     SetMagicWeaponClickState(curPlayer, mwID)  | 
|     Sycn_MagicWeaponLV(curPlayer, mwID)  | 
|     return  | 
|   | 
| def GetIsClickMagicWeapon(curPlayer, mwID):  | 
|     #»ñÈ¡·¨±¦ÊÇ·ñµã»÷ÈÏÖ÷  | 
|     return GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_PDict_MagicWeaponIsClick, mwID % 100, True, [mwID / 100])  | 
|   | 
| def SetMagicWeaponClickState(curPlayer, mwID, state=1):  | 
|     #ÉèÖ÷¨±¦ÊÇ·ñµã»÷ÈÏÖ÷״̬  | 
|     GameWorld.SetDictValueByBit(curPlayer, ChConfig.Def_PDict_MagicWeaponIsClick, mwID % 100, state, True, [mwID / 100])  | 
|     return  | 
|   | 
|   | 
| #// A5 12 ¼¤»î·¨±¦Ö®»ê #tagCMActiveMWSoul  | 
| #  | 
| #struct    tagCMActiveMWSoul  | 
| #  | 
| #{  | 
| #    tagHead        Head;  | 
| #    BYTE        ID;    //±àºÅ  | 
| #};  | 
| def OnActiveMWSoul(index, clientData, tick):  | 
|     curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)  | 
|     soulID = clientData.ID  | 
|     ipyData = IpyGameDataPY.GetIpyGameData('TreasurePrivilege', soulID)  | 
|     if not ipyData:  | 
|         return  | 
|     if GetIsActiveMWSoul(curPlayer, soulID):  | 
|         GameWorld.Log('    ¸Ã·¨±¦Ö®»êÒѾ¼¤»î£¡£¡ soulID=%s'%soulID)  | 
|         return  | 
|     #¼ì²é³É¾Í  | 
|     succList = ipyData.GetSuccessList()  | 
|     for succID in succList:  | 
|         if not PlayerSuccess.GetSuccHasGot(curPlayer, succID):  | 
|             GameWorld.DebugLog('    ¼¤»î·¨±¦Ö®»ê ³É¾ÍδÍê³É  soulID=%s,succID=%s'%(soulID, succID))  | 
|             return  | 
|       | 
|     __DoActiveMWSoul(curPlayer, soulID)  | 
|     return  | 
|   | 
| def __DoActiveMWSoul(curPlayer, soulID, isRefreshAttr=True):  | 
|     GameWorld.SetDictValueByBit(curPlayer, ChConfig.Def_PDict_MWSoulActiveState, soulID, 1, True)  | 
|     #ÈÎÎñ  | 
|     EventShell.EventRespons_MWSoulActive(curPlayer, soulID)  | 
|       | 
|     CalcMagicWeaponSoulAttr(curPlayer)  | 
|     if isRefreshAttr:  | 
|         PlayerControl.PlayerControl(curPlayer).RefreshPlayerAttrState()  | 
|       | 
|     #֪ͨ  | 
|     Sycn_MWPrivilegeData(curPlayer, soulID)  | 
|     return  | 
|   | 
|   | 
| def GetIsActiveMWSoul(curPlayer, soulID):  | 
|     #»ñÈ¡·¨±¦Ö®»êÊÇ·ñÒѼ¤»î  | 
|     return GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_PDict_MWSoulActiveState, soulID)  | 
|   | 
| def CalcMagicWeaponSoulAttr(curPlayer):  | 
|     #·¨±¦Ö®»êÊôÐÔˢР | 
|     allAttrList = [{} for _ in range(4)]  | 
|     allAttrDict = {}  | 
|     ipyMgr = IpyGameDataPY.IPY_Data()  | 
|     for i in xrange(ipyMgr.GetTreasurePrivilegeCount()):  | 
|         ipyData = ipyMgr.GetTreasurePrivilegeByIndex(i)  | 
|         soulID = ipyData.GetPrivilegeID()  | 
|         if not GetIsActiveMWSoul(curPlayer, soulID):  | 
|             continue  | 
|         attrDict = GetMagicWeaponPrivilegeAttr(curPlayer, soulID)  | 
|         GameWorld.AddDictValue(allAttrDict, attrDict)  | 
|           | 
|     for attrID, attrValue in allAttrDict.items():  | 
|         PlayerControl.CalcAttrDict_Type(attrID, attrValue, allAttrList)  | 
|     PlayerControl.SetCalcAttrListValue(curPlayer, ChConfig.Def_CalcAttrFunc_MagicWeaponSoul, allAttrList)  | 
|     return  | 
|   | 
| def UptateMWFBPasslv(curPlayer, mwID, passLV):  | 
|     GameWorld.Log('¸üйؿ¨ mwID=%s,level=%s'%(mwID, passLV), curPlayer.GetID())  | 
|     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_MWFBPassLevel % mwID, passLV)  | 
|     CalcMagicWeaponAttr(curPlayer)  | 
|     PlayerControl.PlayerControl(curPlayer).RefreshPlayerAttrState()  | 
|     Sycn_MagicWeaponLV(curPlayer, mwID)  | 
|       | 
|     EventShell.EventRespons_MagicWeaponFBPassLV(curPlayer, mwID, passLV)  | 
|     return |