|  |  | 
 |  |  | import GameFuncComm
 | 
 |  |  | import SkillCommon
 | 
 |  |  | import BuffSkill
 | 
 |  |  | import ItemControler
 | 
 |  |  | import PlayerWeekParty
 | 
 |  |  | #import EventReport
 | 
 |  |  | import IpyGameDataPY
 | 
 |  |  | import PassiveBuffEffMng
 | 
 |  |  | import OpenServerCampaign
 | 
 |  |  | 
 | 
 |  |  | import random
 | 
 |  |  | 
 | 
 |  |  | Def_GodWeaponType_HP = 1  # 生命神兵类型
 | 
 |  |  | Def_GodWeaponType_Atk = 2  # 攻击神兵类型
 | 
 |  |  | Def_GodWeaponType_SuperHit = 3  # 暴击神兵类型
 | 
 |  |  | Def_GodWeaponType_Def = 4  # 护盾神兵类型
 | 
 |  |  | 
 | 
 |  |  | ## 神器功能登录处理
 | 
 |  |  | #  @param curPlayer 玩家
 | 
 |  |  | 
 |  |  |         return
 | 
 |  |  |     Sync_GodWeaponLVInfo(curPlayer)
 | 
 |  |  |     
 | 
 |  |  |     #老号相关神兵场景特效等级同步支持
 | 
 |  |  |     if curPlayer.GetExAttr15() == 0:
 | 
 |  |  |         ipyDataMgr = IpyGameDataPY.IPY_Data()
 | 
 |  |  |         maxType = ipyDataMgr.GetGodWeaponByIndex(ipyDataMgr.GetGodWeaponCount()-1).GetType()
 | 
 |  |  |         for setWeaponType in xrange(1, maxType + 1):
 | 
 |  |  |             setLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GodWeaponLV % setWeaponType)
 | 
 |  |  |             if not setLV:
 | 
 |  |  |                 continue
 | 
 |  |  |             SetGodWeaponLV(curPlayer, setWeaponType, setLV)
 | 
 |  |  |             GameWorld.Log("老号设置神兵场景等级: setWeaponType=%s,setLV=%s" % (setWeaponType, setLV), curPlayer.GetPlayerID())
 | 
 |  |  |     return
 | 
 |  |  | 
 | 
 |  |  | def SetGodWeaponLV(curPlayer, weaponType, lv):
 | 
 |  |  |     ## 设置神兵等级,同步设置场景神兵等级
 | 
 |  |  |     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GodWeaponLV % weaponType, lv)
 | 
 |  |  |     sceneEffectsDict = {1:[lambda curObj, value:curObj.SetExAttr15(value), ShareDefine.CDBPlayerRefresh_GodWeaponLV_1],
 | 
 |  |  |                         2:[lambda curObj, value:curObj.SetExAttr16(value), ShareDefine.CDBPlayerRefresh_GodWeaponLV_2],
 | 
 |  |  |                         3:[lambda curObj, value:curObj.SetExAttr17(value), ShareDefine.CDBPlayerRefresh_GodWeaponLV_3],
 | 
 |  |  |                         4:[lambda curObj, value:curObj.SetExAttr18(value), ShareDefine.CDBPlayerRefresh_GodWeaponLV_4],
 | 
 |  |  |                         }
 | 
 |  |  |     if weaponType in sceneEffectsDict:
 | 
 |  |  |         setFunc, notifyType = sceneEffectsDict[weaponType]
 | 
 |  |  |         setFunc(curPlayer, lv)
 | 
 |  |  |         curPlayer.SendPropertyRefresh(notifyType, lv, False)
 | 
 |  |  |              | 
 |  |  |     totalLV = GetGodWeaponTotalLV(curPlayer)
 | 
 |  |  |     # 开服活动数据
 | 
 |  |  |     OpenServerCampaign.UpdOpenServerCampaignRecordData(curPlayer, ShareDefine.Def_Campaign_Type_GodWeaponLV, totalLV)
 | 
 |  |  |     PlayerWeekParty.AddWeekPartyActionCnt(curPlayer, ChConfig.Def_WPAct_GodWeapon, totalLV, False, True)
 | 
 |  |  |     return
 | 
 |  |  | 
 | 
 |  |  | def GetGodWeaponTotalLV(curPlayer):
 | 
 |  |  |     ##获取神兵总等级
 | 
 |  |  |     totalLV = 0
 | 
 |  |  |     ipyDataMgr = IpyGameDataPY.IPY_Data()
 | 
 |  |  |     maxType = ipyDataMgr.GetGodWeaponByIndex(ipyDataMgr.GetGodWeaponCount()-1).GetType()
 | 
 |  |  |     for gwType in xrange(1, maxType + 1):
 | 
 |  |  |         totalLV += curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GodWeaponLV % gwType)
 | 
 |  |  |     return totalLV
 | 
 |  |  | 
 | 
 |  |  | ## 神器开启
 | 
 |  |  | #  @return: 是否激活成功
 | 
 |  |  | 
 |  |  |     ipyDataMgr = IpyGameDataPY.IPY_Data()
 | 
 |  |  |     maxType = ipyDataMgr.GetGodWeaponByIndex(ipyDataMgr.GetGodWeaponCount()-1).GetType()
 | 
 |  |  | 
 | 
 |  |  |     fightPowerEx = 0  # 额外增加的战力
 | 
 |  |  |     allAttrList = [{} for i in range(4)]
 | 
 |  |  |     for gwType in xrange(1, maxType + 1):
 | 
 |  |  |         # 因为神兵解锁条件做了调整,由之前的0~1阶解锁改为由前置神兵类型等级解锁,默认解锁后为1阶
 | 
 |  |  | 
 |  |  |         for i, attrID in enumerate(attrTypeList):
 | 
 |  |  |             PlayerControl.CalcAttrDict_Type(attrID, attrValueList[i], allAttrList)
 | 
 |  |  |         
 | 
 |  |  |         fightPowerEx += IpyGameDataPY.GetFuncEvalCfg('MagicExterior').get(str(gwType), 0)
 | 
 |  |  |          | 
 |  |  |          | 
 |  |  |     # 附加战力
 | 
 |  |  |     curPlayer.SetDict(ChConfig.Def_PlayerKey_MFPEx % ShareDefine.Def_MFPType_GodWeapon, fightPowerEx)
 | 
 |  |  |     GameWorld.DebugLog("神兵属性:%s" % allAttrList)
 | 
 |  |  |     # 保存计算值
 | 
 |  |  |     PlayerControl.SetCalcAttrListValue(curPlayer, ChConfig.Def_CalcAttrFunc_GodWeapon, allAttrList)   
 | 
 |  |  | 
 |  |  |         GameWorld.DebugLog("已经解锁的神兵!weaponType=%s" % weaponType)
 | 
 |  |  |         return
 | 
 |  |  |     
 | 
 |  |  |     # 满足玩家等级或者前置神兵等级可解锁
 | 
 |  |  |     if __GWCheckPlayerLV(curPlayer, weaponType) or __GWCheckOtherGWLV(curPlayer, weaponType):
 | 
 |  |  |              | 
 |  |  |         SetGodWeaponLV(curPlayer, weaponType, 1)
 | 
 |  |  |         RefreshGodWeaponAttr(curPlayer)
 | 
 |  |  |         GameWorld.DebugLog("解锁神兵: weaponType=%s" % weaponType)
 | 
 |  |  |         Sync_GodWeaponLVInfo(curPlayer, weaponType)
 | 
 |  |  |     return
 | 
 |  |  | 
 | 
 |  |  | # 神兵激活需2次判断等级 {2:100, 4:100}
 | 
 |  |  | def __GWCheckPlayerLV(curPlayer, weaponType):
 | 
 |  |  |     godWeaponUnlockDict = IpyGameDataPY.GetFuncEvalCfg("GodWeaponActive", 3, {})
 | 
 |  |  |     if str(weaponType) not in godWeaponUnlockDict:
 | 
 |  |  |         GameWorld.DebugLog("该神兵不能解锁!weaponType=%s" % weaponType)
 | 
 |  |  |         return False
 | 
 |  |  |     return curPlayer.GetLV() >= godWeaponUnlockDict[str(weaponType)]
 | 
 |  |  | 
 | 
 |  |  | # 神兵激活需判断前置神兵等级
 | 
 |  |  | def __GWCheckOtherGWLV(curPlayer, weaponType):
 | 
 |  |  |     godWeaponUnlockDict = IpyGameDataPY.GetFuncEvalCfg("GodWeaponActive", 2, {})
 | 
 |  |  |     if str(weaponType) not in godWeaponUnlockDict:
 | 
 |  |  |         GameWorld.DebugLog("该神兵不能解锁!weaponType=%s" % weaponType)
 | 
 |  |  |         return
 | 
 |  |  |         return False
 | 
 |  |  |     conditionList = godWeaponUnlockDict[str(weaponType)]
 | 
 |  |  |     
 | 
 |  |  |     for needType, needLV in conditionList:
 | 
 |  |  | 
 |  |  |         if needTypeLV < needLV:
 | 
 |  |  |             GameWorld.DebugLog("所需前置神兵等级不足,无法解锁!weaponType=%s,needType=%s,needLV=%s > needTypeLV(%s)" 
 | 
 |  |  |                                % (weaponType, needType, needLV, needTypeLV))
 | 
 |  |  |             return
 | 
 |  |  |             return False
 | 
 |  |  |         
 | 
 |  |  |     SetGodWeaponLV(curPlayer, weaponType, 1)
 | 
 |  |  |     GameWorld.DebugLog("解锁神兵: weaponType=%s" % weaponType)
 | 
 |  |  |     Sync_GodWeaponLVInfo(curPlayer, weaponType)
 | 
 |  |  |     return
 | 
 |  |  |     return True
 | 
 |  |  | 
 | 
 |  |  | #===============================================================================
 | 
 |  |  | #// A5 55 神兵升级 #tagCMGodWeaponPlus
 | 
 |  |  | 
 |  |  |     
 | 
 |  |  |     #1.判断表中有没此类型,2.是否满级,3.判断是否有物品
 | 
 |  |  |     attrLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GodWeaponLV % weaponType)
 | 
 |  |  |     if not attrLV:
 | 
 |  |  |     if not attrLV and Def_GodWeaponType_SuperHit != weaponType:
 | 
 |  |  |         GameWorld.DebugLog("神兵未解锁,无法升级!weaponType=%s,attrLV=%s" % (weaponType, attrLV))
 | 
 |  |  |         return
 | 
 |  |  |       
 | 
 |  |  | 
 |  |  |             PlayerControl.WorldNotify(0, sysMark, [curPlayer.GetName(), weaponType])
 | 
 |  |  |             
 | 
 |  |  |         #{1:[100,200,300,400],2:[100,200,300,400],3:[100,200,300,400]}
 | 
 |  |  |         notifyDict = IpyGameDataPY.GetFuncEvalCfg('GodLv', 1, {})
 | 
 |  |  |         if weaponType in notifyDict:
 | 
 |  |  |             for notifyLV in notifyDict[weaponType]:
 | 
 |  |  |                 if beforeAttrLV < notifyLV and attrLV >= notifyLV:
 | 
 |  |  |                     PlayerControl.WorldNotify(0, 'GodWeaponLv', [curPlayer.GetName(), weaponType, notifyLV])
 | 
 |  |  |         #=======================================================================
 | 
 |  |  |         # notifyDict = IpyGameDataPY.GetFuncEvalCfg('GodLv', 1, {})
 | 
 |  |  |         # if weaponType in notifyDict:
 | 
 |  |  |         #    for notifyLV in notifyDict[weaponType]:
 | 
 |  |  |         #        if beforeAttrLV < notifyLV and attrLV >= notifyLV:
 | 
 |  |  |         #            PlayerControl.WorldNotify(0, 'GodWeaponLv', [curPlayer.GetName(), weaponType, notifyLV])
 | 
 |  |  |         #=======================================================================
 | 
 |  |  |                 
 | 
 |  |  | 
 | 
 |  |  |         totalExp = godWeaponData.GetExp()
 | 
 |  |  |          | 
 |  |  |          | 
 |  |  |     Sync_GodWeaponLVInfo(curPlayer, weaponType)
 | 
 |  |  |     #任务
 | 
 |  |  |     EventShell.EventRespons_PlusGodWeapon(curPlayer)
 | 
 |  |  | 
 |  |  |             sysMark = godWeaponData.GetSysMark()
 | 
 |  |  |             if sysMark:
 | 
 |  |  |                 PlayerControl.WorldNotify(0, sysMark, [curPlayer.GetName(), attrLV, skillID])
 | 
 |  |  |             return skillID
 | 
 |  |  |     return
 | 
 |  |  |      | 
 |  |  | 
 | 
 |  |  | 
 | 
 |  |  | 
 |