| | |
| | |
|
| | | g_succInfoDict = {}
|
| | | g_potentialsSkillDict = {}
|
| | |
|
| | |
|
| | | ##登录处理
|
| | | # @param curPlayer 玩家
|
| | | # @return None
|
| | |
| | | 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):
|
| | | ## 法宝功能开启 激活第一个法宝
|
| | |
| | | # NotifyMagicWeapon(curPlayer)
|
| | | return True
|
| | |
|
| | |
|
| | | def GetIsActiveMagicWeapon(curPlayer, mwID, lv=0):
|
| | | #获取法宝是否激活
|
| | | #通过玩家字典值可直接判断是否已经激活,这里可不验证法宝ID是否存在,即使传入不存在的也是返回未激活
|
| | |
| | | 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):
|
| | | ##激活法宝
|
| | |
| | |
|
| | | return
|
| | |
|
| | |
|
| | | def DoActiveMW(curPlayer, mwID, mwLV=0):
|
| | | if not GetWMIpyData(mwID):
|
| | | return
|
| | |
| | | SetMagicWeaponActiveState(curPlayer, mwID)
|
| | | #֪ͨ
|
| | | NotifyMagicWeapon(curPlayer)
|
| | | |
| | |
|
| | | if mwID in IpyGameDataPY.GetFuncEvalCfg('UnblockTreasure'):
|
| | | PlayerControl.NotifyCode(curPlayer, 'UnblockTreasure', [curPlayer.GetName(), mwID])
|
| | |
| | | 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()
|
| | |
| | | DataRecordPack.DR_MagicWeaponActive(curPlayer, mwID, mwLV)
|
| | | return True
|
| | |
|
| | |
|
| | | def GetWMIpyData(mwID):return IpyGameDataPY.GetIpyGameData('Treasure', mwID)
|
| | |
|
| | |
|
| | | def GetNeedSuccIDByMWID(mwID, ipyData=None):
|
| | | ##获取法宝ID开启需要完成的成就ID
|
| | |
| | | return []
|
| | | succIDList = list(ipyData.GetSuccID())
|
| | | return succIDList
|
| | |
|
| | |
|
| | | def GetMWIDBySuccID(succID):
|
| | | global g_succInfoDict
|
| | |
| | | g_succInfoDict[succid] = mwID
|
| | | return g_succInfoDict.get(succID)
|
| | |
|
| | |
|
| | | def GetMWActiveCntTotal(curPlayer):
|
| | | ## 获取激活的法宝总个数
|
| | | activeCnt = 0
|
| | |
| | | if GetIsActiveMagicWeapon(curPlayer, magicWeaponID):
|
| | | activeCnt += 1
|
| | | return activeCnt
|
| | |
|
| | |
|
| | | def GetMWActiveCntByType(curPlayer, mwType):
|
| | | ## 根据法宝类型获取已激活数量
|
| | |
| | | if isActive:
|
| | | activeCnt += 1
|
| | | return activeCnt
|
| | |
|
| | |
|
| | | ## 给技能
|
| | | # @param curPlayer
|
| | |
| | | NetPackCommon.SendFakePack(curPlayer, packData)
|
| | | return
|
| | |
|
| | |
|
| | | ##--------------------------------------------------------------------------------------------------
|
| | | def GetMWRefineIpyData(treasureID, treasureLV):
|
| | | #获取法宝等级信息
|
| | | return IpyGameDataPY.GetIpyGameDataNotLog("TreasureRefine", treasureID, treasureLV)
|
| | |
|
| | |
|
| | | def CalcMagicWeaponAttr(curPlayer):
|
| | | ## 计算法宝属性
|
| | |
| | | # 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)
|
| | |
| | | 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: #副本关卡属性
|
| | | fbipyData = IpyGameDataPY.GetIpyGameData('MagicWeaponFB', magicWeaponID, fbpasslv)
|
| | | if fbipyData:
|
| | |
| | | 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:
|
| | |
| | | if not GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_PDict_XBXZAwardRecord, ipyData.GetID()):
|
| | | return
|
| | |
|
| | | |
| | | DoActiveMW(curPlayer, mwID)
|
| | | return
|
| | |
|
| | | #-------------------------------------------------------------------------------
|
| | |
|
| | |
|
| | | def OnGetXBXZAward(curPlayer, index):
|
| | | ##仙宝寻主领奖
|
| | |
| | | NetPackCommon.SendFakePack(curPlayer, succFARPack)
|
| | | return
|
| | |
|
| | |
|
| | | #-------------------------------------------------------------------------------
|
| | | #// A5 15 提升法宝等级 #tagCMMagicWeaponUp
|
| | | #
|
| | |
| | |
|
| | | return
|
| | |
|
| | |
|
| | | def AddMagicWeaponUpExp(curPlayer, mwID, addExp):
|
| | | #增加法宝升级经验
|
| | | GameWorld.DebugLog('增加法宝升级经验 mwID=%s,addExp=%s'%(mwID, addExp))
|
| | |
| | | if mwType == 1:
|
| | | PlayerActivity.AddDailyActionFinishCnt(curPlayer, ShareDefine.DailyActionID_MagicWeapon)
|
| | | return
|
| | |
|
| | |
|
| | | def Sycn_MagicWeaponLV(curPlayer, mwID= -1):
|
| | | #通知法宝等级信息
|
| | |
| | | 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
|
| | | #
|
| | |
| | | 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
|
| | | #
|
| | |
| | | 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())
|