From 2553f010270f9dff6f1ee1403caab4ff826e00c2 Mon Sep 17 00:00:00 2001 From: xdh <xiefantasy@qq.com> Date: 星期三, 20 三月 2019 17:12:06 +0800 Subject: [PATCH] 6374 【后端】【2.0】删除无用功能代码、封包、配置(法宝之魂) --- ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerMagicWeapon.py | 308 +++++++++----------------------------------------- 1 files changed, 58 insertions(+), 250 deletions(-) diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerMagicWeapon.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerMagicWeapon.py index 375d629..b725a41 100644 --- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerMagicWeapon.py +++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerMagicWeapon.py @@ -40,6 +40,8 @@ g_succInfoDict = {} g_potentialsSkillDict = {} + + ##登录处理 # @param curPlayer 玩家 # @return None @@ -47,15 +49,13 @@ NotifyMagicWeapon(curPlayer, True) 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): ## 法宝功能开启 激活第一个法宝 @@ -66,6 +66,7 @@ # NotifyMagicWeapon(curPlayer) return True + def GetIsActiveMagicWeapon(curPlayer, mwID, lv=0): #获取法宝是否激活 #通过玩家字典值可直接判断是否已经激活,这里可不验证法宝ID是否存在,即使传入不存在的也是返回未激活 @@ -74,12 +75,14 @@ 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]) + return GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_PDict_MagicWeaponIsActive, mwID, True) + def SetMagicWeaponActiveState(curPlayer, mwID, isActive=True): #设置法宝激活状态 - GameWorld.SetDictValueByBit(curPlayer, ChConfig.Def_PDict_MagicWeaponIsActive, mwID % 100, isActive, True, [mwID / 100]) + GameWorld.SetDictValueByBit(curPlayer, ChConfig.Def_PDict_MagicWeaponIsActive, mwID, isActive, True) return + def ActiveMagicWeapon(curPlayer, succID): ##激活法宝 @@ -109,6 +112,7 @@ return + def DoActiveMW(curPlayer, mwID, mwLV=0): if not GetWMIpyData(mwID): return @@ -117,7 +121,6 @@ SetMagicWeaponActiveState(curPlayer, mwID) #通知 NotifyMagicWeapon(curPlayer) - if mwID in IpyGameDataPY.GetFuncEvalCfg('UnblockTreasure'): PlayerControl.NotifyCode(curPlayer, 'UnblockTreasure', [curPlayer.GetName(), mwID]) @@ -153,21 +156,21 @@ ItemControler.GivePlayerItem(curPlayer, itemID, itemCnt, 0, [IPY_GameWorld.rptItem], event=["MWAward", False, {"mwID":mwID}]) activeMWID = upIpyData.GetActiveMWID() if activeMWID == mwID: - GameWorld.ErrLog(' TreasureUp.txt 配置异常 不可激活自身法宝 mwID=%s'%mwID) + GameWorld.ErrLog(' TreasureUp.txt 配置异常 不可激活自身法宝 mwID=%s' % mwID) elif activeMWID: DoActiveMW(curPlayer, activeMWID) #激活魂 - activeSoulID = upIpyData.GetActiveSoulID() - if activeSoulID: - __DoActiveMWSoul(curPlayer, activeSoulID, False) +# 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杀怪加属性所需激活法宝 + vipAddAtkMWID = IpyGameDataPY.GetFuncCfg("VIPAddAtkEXP", 2) # VIP杀怪加属性所需激活法宝 if mwID == vipAddAtkMWID: PlayerVip.RefreshVIPAttr(curPlayer) @@ -176,7 +179,9 @@ DataRecordPack.DR_MagicWeaponActive(curPlayer, mwID, mwLV) return True + def GetWMIpyData(mwID):return IpyGameDataPY.GetIpyGameData('Treasure', mwID) + def GetNeedSuccIDByMWID(mwID, ipyData=None): ##获取法宝ID开启需要完成的成就ID @@ -186,6 +191,7 @@ return [] succIDList = list(ipyData.GetSuccID()) return succIDList + def GetMWIDBySuccID(succID): global g_succInfoDict @@ -202,6 +208,7 @@ g_succInfoDict[succid] = mwID return g_succInfoDict.get(succID) + def GetMWActiveCntTotal(curPlayer): ## 获取激活的法宝总个数 activeCnt = 0 @@ -212,6 +219,7 @@ if GetIsActiveMagicWeapon(curPlayer, magicWeaponID): activeCnt += 1 return activeCnt + def GetMWActiveCntByType(curPlayer, mwType): ## 根据法宝类型获取已激活数量 @@ -224,6 +232,7 @@ if isActive: activeCnt += 1 return activeCnt + ## 给技能 # @param curPlayer @@ -282,23 +291,20 @@ 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)] #仙族法宝 - allAttrList4 = [{} for _ in range(4)] #王者法宝 + 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 = {} #额外战力 + addPowerDict = {} #额外战力 signDayMWID = IpyGameDataPY.GetFuncCfg('MWSignDayAttr', 2) ipyDataMgr = IpyGameDataPY.IPY_Data() for i in xrange(ipyDataMgr.GetTreasureCount()): @@ -308,20 +314,13 @@ # 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: mfpType = mwTypeMfpTypeDict.get(treasureType, ShareDefine.Def_MFPType_Role) #等级属性 curMWLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_MagicWeaponLV % magicWeaponID) - for lv in xrange(curMWLV+1): + for lv in xrange(curMWLV + 1): upIpyData = IpyGameDataPY.GetIpyGameDataNotLog('TreasureUp', magicWeaponID, lv) if upIpyData: attrDict = upIpyData.GetAddAttr() @@ -330,7 +329,7 @@ if magicWeaponID == signDayMWID: #签到属性 - totalSignNum = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TotalSignNum) # 总签到天数 + totalSignNum = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TotalSignNum) # 总签到天数 addAttr = {} for attid, attnum in IpyGameDataPY.GetFuncEvalCfg('MWSignDayAttr', 1, {}).items(): addAttr[int(attid)] = attnum * totalSignNum @@ -344,22 +343,13 @@ GameWorld.AddDictValue(allAttrDict, attrDict) 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: #副本关卡属性 + 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: @@ -423,12 +413,12 @@ for ipyData in ipyDataList: if not GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_PDict_XBXZAwardRecord, ipyData.GetID()): return - DoActiveMW(curPlayer, mwID) return #------------------------------------------------------------------------------- + def OnGetXBXZAward(curPlayer, index): ##仙宝寻主领奖 @@ -511,7 +501,7 @@ #给钱 for moneyType, value in ipyData.GetMoney(): PlayerControl.GiveMoney(curPlayer, moneyType, value) - SyncXBXZAwardRecord(curPlayer,[index]) + SyncXBXZAwardRecord(curPlayer, [index]) #成就 PlayerSuccess.DoAddSuccessProgress(curPlayer, ShareDefine.SuccType_XBXZ, 1, [ipyData.GetMWID()]) GameWorld.DebugLog(' 仙宝寻主领奖OK, ID=%s, cnt=%s' % (index, cnt)) @@ -531,14 +521,14 @@ succCnt = ipyDataMgr.GetXBXZCount() if not succCnt: return - maxSuccid = ipyDataMgr.GetXBXZByIndex(succCnt-1).GetID() - recordIndexList = range(maxSuccid / 31+1) + 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) + awardRecord = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_XBXZAwardRecord % i) if not awardRecord: continue recordInfo = ChPyNetSendPack.tagMCXBXZAwardRecord() @@ -549,6 +539,7 @@ succFARPack.RecordCnt = len(succFARPack.RecordList) NetPackCommon.SendFakePack(curPlayer, succFARPack) return + #------------------------------------------------------------------------------- #// A5 15 提升法宝等级 #tagCMMagicWeaponUp @@ -564,26 +555,27 @@ curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index) mwID = clientData.MWID curMWLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_MagicWeaponLV % mwID) - nextMWLV = curMWLV+1 + 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) + GameWorld.DebugLog('法宝升级经验不足%s' % needExp) return - PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_MagicWeaponUpExp % mwID, curUpExp-needExp) + 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)) + 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) + PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_MagicWeaponUpExp % mwID, curUpExp + addExp) Sycn_MagicWeaponLV(curPlayer, mwID) # 每日活动 ipyData = GetWMIpyData(mwID) @@ -592,7 +584,8 @@ PlayerActivity.AddDailyActionFinishCnt(curPlayer, ShareDefine.DailyActionID_MagicWeapon) return -def Sycn_MagicWeaponLV(curPlayer, mwID= -1): + +def Sycn_MagicWeaponLV(curPlayer, mwID=-1): #通知法宝等级信息 if mwID == -1: isAll = True @@ -627,134 +620,6 @@ 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: - #强化加成 - #境界改版,废弃 - pass - 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), 0, [IPY_GameWorld.rptItem], 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 # @@ -773,14 +638,17 @@ Sycn_MagicWeaponLV(curPlayer, mwID) return + def GetIsClickMagicWeapon(curPlayer, mwID): #获取法宝是否点击认主 - return GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_PDict_MagicWeaponIsClick, mwID % 100, True, [mwID / 100]) + return GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_PDict_MagicWeaponIsClick, mwID, True) + def SetMagicWeaponClickState(curPlayer, mwID, state=1): #设置法宝是否点击认主状态 - GameWorld.SetDictValueByBit(curPlayer, ChConfig.Def_PDict_MagicWeaponIsClick, mwID % 100, state, True, [mwID / 100]) + GameWorld.SetDictValueByBit(curPlayer, ChConfig.Def_PDict_MagicWeaponIsClick, mwID, state, True) return + #// A5 1D 法宝佩戴 #tagCMWearMagicWeapon # @@ -804,7 +672,7 @@ if hasWearCnt >= maxCnt: return if GetIsWearMagicWeapon(curPlayer, mid): - hasWearCnt +=1 + hasWearCnt += 1 SetMagicWeaponWearState(curPlayer, mwID, isWear) CalcMagicWeaponAttr(curPlayer) @@ -812,84 +680,24 @@ Sycn_MagicWeaponLV(curPlayer, mwID) return + def GetIsWearMagicWeapon(curPlayer, mwID): #获取法宝是否佩戴 - return GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_PDict_MagicWeaponIsWear, mwID % 100, True, [mwID / 100]) + return GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_PDict_MagicWeaponIsWear, mwID, True) + def SetMagicWeaponWearState(curPlayer, mwID, state): #设置法宝是否佩戴 - GameWorld.SetDictValueByBit(curPlayer, ChConfig.Def_PDict_MagicWeaponIsWear, mwID % 100, state, True, [mwID / 100]) + GameWorld.SetDictValueByBit(curPlayer, ChConfig.Def_PDict_MagicWeaponIsWear, mwID, state, True) 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()) + 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 \ No newline at end of file + return -- Gitblit v1.8.0