| | |
| | | import PlayerSuccess
|
| | | import EventShell
|
| | | import PassiveBuffEffMng
|
| | | import OpenServerCampaign
|
| | | 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):
|
| | | ## 法宝功能开启 激活第一个法宝
|
| | |
| | | # 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
|
| | |
| | | #֪ͨ
|
| | | NotifyMagicWeapon(curPlayer)
|
| | |
|
| | | |
| | | if mwID in IpyGameDataPY.GetFuncEvalCfg('UnblockTreasure'):
|
| | | PlayerControl.NotifyCode(curPlayer, 'UnblockTreasure', [curPlayer.GetName(), mwID])
|
| | | else:
|
| | | PlayerControl.WorldNotify(0, 'UnblockTreasure', [curPlayer.GetName(), mwID])
|
| | | sysMark = IpyGameDataPY.GetFuncEvalCfg('UnblockTreasure', 2, {}).get(mwID, 'UnblockTreasure')
|
| | | PlayerControl.WorldNotify(0, sysMark, [curPlayer.GetName(), mwID])
|
| | |
|
| | | #任务
|
| | | EventShell.EventRespons_OnActiveMagicWeapon(curPlayer, mwID)
|
| | |
| | |
|
| | | #解锁技能
|
| | | upIpyData = IpyGameDataPY.GetIpyGameData('TreasureUp', mwID, mwLV)
|
| | | if upIpyData:
|
| | | skillIDList = upIpyData.GetUnLockSkill()
|
| | | for skillID in skillIDList:
|
| | | GiveSkill(curPlayer, skillID, GameWorld.GetGameWorld().GetTick())
|
| | | if upIpyData.GetPrivilegeID():
|
| | | PlayerControl.WorldNotify(0, 'TreasureSoulWakeUp', [curPlayer.GetName(), upIpyData.GetPrivilegeID()])
|
| | | 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, 0, [IPY_GameWorld.rptItem], 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杀怪加属性所需激活法宝
|
| | | vipAddAtkMWID = IpyGameDataPY.GetFuncCfg("VIPAddAtkEXP", 2) # VIP杀怪加属性所需激活法宝
|
| | | if mwID == vipAddAtkMWID:
|
| | | PlayerVip.RefreshVIPAttr(curPlayer)
|
| | |
|
| | |
| | | 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):
|
| | | ## 根据法宝类型获取已激活数量
|
| | |
| | | activeCnt += 1
|
| | | return activeCnt
|
| | |
|
| | | def GetMWIDByPotentialsSkillID(skillID):
|
| | | #通过潜力技能ID获取对应的法宝ID
|
| | | 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()
|
| | | for curSkillID in skillIDList:
|
| | | g_potentialsSkillDict[curSkillID] = mwID |
| | | return g_potentialsSkillDict.get(skillID, 0)
|
| | |
|
| | | ## 给技能
|
| | | # @param curPlayer
|
| | |
| | | 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
|
| | | |
| | | if not GameWorld.CanHappen(initRate):
|
| | | 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, beforeFightPower)
|
| | | PassiveBuffEffMng.GetPassiveEffManager().RegistPassiveEff(curPlayer, newSkillID)
|
| | | if SkillCommon.isPassiveAttr(newSkill):
|
| | | newSkillIsPassive = True
|
| | | |
| | | |
| | | if SkillCommon.isPassiveAttr(upSkill) or newSkillIsPassive:
|
| | | curControl.RefreshPlayerAttrState()
|
| | | |
| | | curControl.RefreshSkillFightPowerEx(upSkill.GetSkillID(), beforeFightPower)
|
| | | PassiveBuffEffMng.GetPassiveEffManager().RegistPassiveEff(curPlayer, upSkill.GetSkillID())
|
| | | |
| | | #通知技能已升级成功 GeRen_admin_31379
|
| | | #<n color="255,255,0" BKCOLOR="0,0,0">恭喜您将</n><n color="0,190,255" BKCOLOR="0,0,0"><Info Type="Skill" Name="Name" ID="{%S1%}"/></n><n color="255,255,0" BKCOLOR="0,0,0">升至</n><n color="0,190,255" BKCOLOR="0,0,0">{%S2%}</n><n color="255,255,0" BKCOLOR="0,0,0">级!</n>
|
| | | #PlayerControl.NotifyCode(curPlayer, "GeRen_admin_31379", [skillTypeID, upSkillLv])
|
| | | |
| | | #获得技能等级
|
| | | #curSkillLV = curSkill.GetSkillLV()
|
| | | GameWorld.DebugLog(' 法宝技能升级 skillTypeID=%s, upSkillLv=%s' % (skillTypeID, upSkillLv))
|
| | | DataRecordPack.DR_LearnORUPSkill(curPlayer, skillTypeID, upSkillLv)
|
| | | |
| | | curPlayer.Sync_MakeItemAnswer(ShareDefine.Def_mitMagicWeaponSkillUp, 1)
|
| | | |
| | |
|
| | | PlayerSuccess.DoAddSuccessProgress(curPlayer, ShareDefine.SuccType_MWSkillUp, 1, [skillTypeID])
|
| | | EventShell.EventRespons_MWSkillUp(curPlayer)
|
| | | return
|
| | |
|
| | |
|
| | |
|
| | | def NotifyMagicWeapon(curPlayer, isLogin=False):
|
| | | #通知法宝信息
|
| | | packData = ChPyNetSendPack.tagMCMagicWeaponData()
|
| | |
| | | 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)] #仙族法宝
|
| | | 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()):
|
| | | treasureIpyData = ipyDataMgr.GetTreasureByIndex(i)
|
| | | magicWeaponID = treasureIpyData.GetID()
|
| | | isActive = GetIsActiveMagicWeapon(curPlayer, magicWeaponID)
|
| | | if not isActive:
|
| | | continue
|
| | | # 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)
|
| | | #=======================================================================
|
| | | |
| | | #等级属性
|
| | | 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)
|
| | |
|
| | | privilegeID = upIpyData.GetPrivilegeID()
|
| | | if privilegeID:
|
| | | # 法宝之魂
|
| | | attrDict = GetMagicWeaponPrivilegeAttr(curPlayer, privilegeID)
|
| | | 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):
|
| | | upIpyData = IpyGameDataPY.GetIpyGameDataNotLog('TreasureUp', magicWeaponID, lv)
|
| | | if upIpyData:
|
| | | attrDict = upIpyData.GetAddAttr()
|
| | | GameWorld.AddDictValue(allAttrDict, attrDict)
|
| | | addPowerDict[mfpType] = addPowerDict.get(mfpType, 0) + upIpyData.GetPowerEx()
|
| | | |
| | | 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)
|
| | | #王者法宝属性
|
| | | 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)
|
| | | 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)
|
| | |
| | | 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())
|
| | | |
| | | 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)
|
| | | 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
|
| | | #
|
| | |
| | | for ipyData in ipyDataList:
|
| | | if not GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_PDict_XBXZAwardRecord, ipyData.GetID()):
|
| | | return
|
| | | |
| | |
|
| | | DoActiveMW(curPlayer, mwID)
|
| | | return
|
| | |
|
| | | #-------------------------------------------------------------------------------
|
| | |
|
| | |
|
| | | def OnGetXBXZAward(curPlayer, index):
|
| | | ##仙宝寻主领奖
|
| | |
| | | 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():
|
| | |
| | | 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 == 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
|
| | | # 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 awardItemList:
|
| | | for itemID, itemCnt in awardItemList:
|
| | | ItemControler.GivePlayerItem(curPlayer, itemID, itemCnt, 1, [IPY_GameWorld.rptItem], True)
|
| | | ItemControler.GivePlayerItem(curPlayer, itemID, itemCnt, 0, [IPY_GameWorld.rptItem])
|
| | |
|
| | | #给钱
|
| | | 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))
|
| | |
| | | succCnt = ipyDataMgr.GetXBXZCount()
|
| | | if not succCnt:
|
| | | return
|
| | | maxSuccid = ipyDataMgr.GetSuccessByIndex(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()
|
| | |
| | | succFARPack.RecordCnt = len(succFARPack.RecordList)
|
| | | NetPackCommon.SendFakePack(curPlayer, succFARPack)
|
| | | return
|
| | |
|
| | |
|
| | | #-------------------------------------------------------------------------------
|
| | | #// A5 15 提升法宝等级 #tagCMMagicWeaponUp
|
| | |
| | | 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)
|
| | |
|
| | | # 每日活动
|
| | | PlayerActivity.AddDailyActionFinishCnt(curPlayer, ShareDefine.DailyActionID_MagicWeapon)
|
| | | 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)
|
| | | mwType = ipyData.GetTreasureType() if ipyData else 0
|
| | | if mwType == 1:
|
| | | PlayerActivity.AddDailyActionFinishCnt(curPlayer, ShareDefine.DailyActionID_MagicWeapon)
|
| | | return
|
| | |
|
| | | def Sycn_MagicWeaponLV(curPlayer, mwID= -1):
|
| | |
|
| | | 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 = []
|
| | |
| | | mwLv = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_MagicWeaponLV % mwID)
|
| | | curUpExp = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_MagicWeaponUpExp % mwID)
|
| | | state = GetIsClickMagicWeapon(curPlayer, mwID)
|
| | | if not mwLv and not curUpExp and not state:
|
| | | FBPassLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_MWFBPassLevel % mwID)
|
| | | 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
|
| | | pack.LV = mwLv
|
| | | pack.Exp = curUpExp
|
| | | pack.State = state
|
| | | pack.FBPassLV = FBPassLV
|
| | | pack.IsWear = isWear
|
| | | sendPack.InfoList.append(pack)
|
| | | sendPack.Count = len(sendPack.InfoList)
|
| | | if sendPack.Count:
|
| | | NetPackCommon.SendFakePack(curPlayer, sendPack)
|
| | | return
|
| | |
|
| | | def GetMagicWeaponPrivilege(curPlayer, privilege):
|
| | | #法宝等级权限
|
| | | ipyData = IpyGameDataPY.GetIpyGameDataByCondition('TreasureUp', {'PrivilegeID':privilege}, False, False)
|
| | | if not ipyData:
|
| | | return 0
|
| | |
|
| | | mwID = ipyData.GetMWID()
|
| | | mwLV = ipyData.GetLV()
|
| | | curMWLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_MagicWeaponLV % mwID)
|
| | | if curMWLV < mwLV:
|
| | | 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_SignDayAddAttr:
|
| | | totalSignNum = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TotalSignNum) # 总签到天数
|
| | | for attid, attnum in attrInfo.items():
|
| | | addAttr[int(attid)] = attnum * totalSignNum
|
| | | elif privilege == ChConfig.MWPrivilege_EquipPlus:
|
| | | #强化加成
|
| | | addAttr = ChEquip.CalcAllEquipAllPlusLVAttr(curPlayer)
|
| | | else: |
| | | multiple = 1 #倍数
|
| | | if singleValue:
|
| | | gotValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_MWSoulGotValue % privilege)
|
| | | 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
|
| | | 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()
|
| | | if singleValue:
|
| | | #达到进度则可领取属性
|
| | | curValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_MWSoulCurValue % privilege)
|
| | | gotValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_MWSoulGotValue % privilege)
|
| | | canGetCnt = (curValue - gotValue) / singleValue
|
| | | if canGetCnt <= 0:
|
| | | return
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_MWSoulGotValue % privilege, gotValue+canGetCnt*singleValue)
|
| | | CalcMagicWeaponAttr(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)
|
| | | if not isForce and max([pack.CurValue, pack.GotValue, pack.ItemAwardState]) == 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])
|
| | | return |
| | | GameWorld.SetDictValueByBit(curPlayer, ChConfig.Def_PDict_MagicWeaponIsClick, mwID, state, True)
|
| | | 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, True)
|
| | |
|
| | |
|
| | | def SetMagicWeaponWearState(curPlayer, mwID, state):
|
| | | #设置法宝是否佩戴
|
| | | GameWorld.SetDictValueByBit(curPlayer, ChConfig.Def_PDict_MagicWeaponIsWear, mwID, state, True)
|
| | | 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
|