ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerMagicWeapon.py
@@ -500,7 +500,12 @@
    allAttrList1 = [{} for _ in range(4)] #人族法宝
    allAttrList2 = [{} for _ in range(4)] #魔族法宝
    allAttrList3 = [{} for _ in range(4)] #仙族法宝
    allAttrList4 = [{} for _ in range(4)] #王者法宝
    mwTypeMfpTypeDict = {1:ShareDefine.Def_MFPType_MagicWeapon1,
                         2:ShareDefine.Def_MFPType_MagicWeapon2,
                         3:ShareDefine.Def_MFPType_MagicWeapon3,
                         4:ShareDefine.Def_MFPType_MagicWeapon4}
    addPowerDict = {} #额外战力
    signDayMWID = IpyGameDataPY.GetFuncCfg('MWSignDayAttr', 2)
    ipyDataMgr = IpyGameDataPY.IPY_Data()
    for i in xrange(ipyDataMgr.GetTreasureCount()):
@@ -520,6 +525,7 @@
        #=======================================================================
        treasureType = treasureIpyData.GetTreasureType()
        if isActive:
            mfpType = mwTypeMfpTypeDict.get(treasureType, ShareDefine.Def_MFPType_Role)
            #等级属性
            curMWLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_MagicWeaponLV % magicWeaponID)
            for lv in xrange(curMWLV+1):
@@ -527,6 +533,7 @@
                if upIpyData:
                    attrDict = upIpyData.GetAddAttr()
                    GameWorld.AddDictValue(allAttrDict, attrDict)
                    addPowerDict[mfpType] = addPowerDict.get(mfpType, 0) + upIpyData.GetPowerEx()
                    
            if magicWeaponID == signDayMWID:
                #签到属性
@@ -535,6 +542,13 @@
                for attid, attnum in IpyGameDataPY.GetFuncEvalCfg('MWSignDayAttr', 1, {}).items():
                    addAttr[int(attid)] = attnum * totalSignNum
                GameWorld.AddDictValue(allAttrDict, addAttr)
            #王者法宝属性
            seasonID = IpyGameDataPY.GetFuncEvalCfg('MagicWeaponOfKing', 1, {}).get(magicWeaponID, 0)
            kingAwardLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_SeasonAwardLV % seasonID)
            kingMWIpyData = IpyGameDataPY.GetIpyGameDataNotLog('MagicWeaponOfKing', magicWeaponID, kingAwardLV)
            if kingMWIpyData and GetIsWearMagicWeapon(curPlayer, magicWeaponID):
                attrDict = kingMWIpyData.GetAddAttr()
                GameWorld.AddDictValue(allAttrDict, attrDict)
        
        fbpasslv = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_MWFBPassLevel % magicWeaponID)
        #老号已激活的魔族法宝没有关卡属性,直接设置满关卡
@@ -561,6 +575,8 @@
                PlayerControl.CalcAttrDict_Type(effID, value, allAttrList2)
            elif treasureType == 3:
                PlayerControl.CalcAttrDict_Type(effID, value, allAttrList3)
            elif treasureType == 4:
                PlayerControl.CalcAttrDict_Type(effID, value, allAttrList4)
            else:
                GameWorld.ErrLog("未知法宝属性, magicWeaponID=%s,treasureType=%s,effID=%s,value=%s" 
                                 % (magicWeaponID, treasureType, effID, value), curPlayer.GetPlayerID())
@@ -568,9 +584,9 @@
    PlayerControl.SetCalcAttrListValue(curPlayer, ChConfig.Def_CalcAttrFunc_MagicWeapon1, allAttrList1)
    PlayerControl.SetCalcAttrListValue(curPlayer, ChConfig.Def_CalcAttrFunc_MagicWeapon2, allAttrList2)
    PlayerControl.SetCalcAttrListValue(curPlayer, ChConfig.Def_CalcAttrFunc_MagicWeapon3, allAttrList3)
    PlayerControl.SetCalcAttrListValue(curPlayer, ChConfig.Def_CalcAttrFunc_MagicWeapon4, allAttrList4)
    #技能解锁战力
    nextSkillDict = GetPotentialsSkillInfo(curPlayer)
    addPowerDict = {}
    for skillID, info in nextSkillDict.items():
        needSkilllv, nextSkillID, addPower = info
        skillManager = curPlayer.GetSkillManager()
@@ -904,12 +920,14 @@
def Sycn_MagicWeaponLV(curPlayer, mwID= -1):
    #通知法宝等级信息
    if mwID == -1:
        isAll = True
        needCalList = []
        ipyDataMgr = IpyGameDataPY.IPY_Data()
        for i in xrange(ipyDataMgr.GetTreasureCount()):
            ipyData = ipyDataMgr.GetTreasureByIndex(i)
            needCalList.append(ipyData.GetID())
    else:
        isAll = False
        needCalList = [mwID]
    sendPack = ChPyNetSendPack.tagMCMagicWeaponLVInfo()
    sendPack.InfoList = []
@@ -918,7 +936,8 @@
        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:
        isWear = GetIsWearMagicWeapon(curPlayer, mwID)
        if isAll and not mwLv and not curUpExp and not state and not FBPassLV and not isWear:
            continue
        pack = ChPyNetSendPack.tagMCMagicWeaponInfo()
        pack.MWID = mwID
@@ -926,6 +945,7 @@
        pack.Exp = curUpExp
        pack.State = state
        pack.FBPassLV = FBPassLV
        pack.IsWear = isWear
        sendPack.InfoList.append(pack)
    sendPack.Count = len(sendPack.InfoList)
    if sendPack.Count:
@@ -1087,6 +1107,44 @@
    GameWorld.SetDictValueByBit(curPlayer, ChConfig.Def_PDict_MagicWeaponIsClick, mwID % 100, state, True, [mwID / 100])
    return
#// A5 1D 法宝佩戴 #tagCMWearMagicWeapon
#
#struct    tagCMWearMagicWeapon
#
#{
#    tagHead        Head;
#    DWORD        MWID;    //法宝ID
#    BYTE        State;        //0-卸下 1-佩戴
#};
def OnWearMagicWeapon(index, clientData, tick):
    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
    mwID = clientData.MWID
    if not GetIsActiveMagicWeapon(curPlayer, mwID):
        return
    isWear = clientData.State
    if isWear:
        maxCnt = IpyGameDataPY.GetFuncCfg('MagicWeaponOfKing', 2)
        hasWearCnt = 0
        for mid in IpyGameDataPY.GetFuncEvalCfg('MagicWeaponOfKing', 1, {}):
            if hasWearCnt >= maxCnt:
                return
            if GetIsWearMagicWeapon(curPlayer, mid):
                hasWearCnt +=1
    SetMagicWeaponWearState(curPlayer, mwID, isWear)
    CalcMagicWeaponAttr(curPlayer)
    PlayerControl.PlayerControl(curPlayer).RefreshPlayerAttrState()
    Sycn_MagicWeaponLV(curPlayer, mwID)
    return
def GetIsWearMagicWeapon(curPlayer, mwID):
    #获取法宝是否佩戴
    return GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_PDict_MagicWeaponIsWear, mwID % 100, True, [mwID / 100])
def SetMagicWeaponWearState(curPlayer, mwID, state):
    #设置法宝是否佩戴
    GameWorld.SetDictValueByBit(curPlayer, ChConfig.Def_PDict_MagicWeaponIsWear, mwID % 100, state, True, [mwID / 100])
    return
#// A5 12 激活法宝之魂 #tagCMActiveMWSoul
#
@@ -1157,4 +1215,6 @@
    CalcMagicWeaponAttr(curPlayer)
    PlayerControl.PlayerControl(curPlayer).RefreshPlayerAttrState()
    Sycn_MagicWeaponLV(curPlayer, mwID)
    EventShell.EventRespons_MagicWeaponFBPassLV(curPlayer, mwID, passLV)
    return