From e0f8672ce49e360e4a318ac81c20f84b05d6bbe8 Mon Sep 17 00:00:00 2001 From: hch <305670599@qq.com> Date: 星期一, 11 三月 2019 21:13:06 +0800 Subject: [PATCH] 6118 【后端】【1.5.200】新增技能效果 --- ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerMagicWeapon.py | 481 ++++++++++++---------------------------------------- 1 files changed, 116 insertions(+), 365 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 0e8bca1..010463d 100644 --- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerMagicWeapon.py +++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerMagicWeapon.py @@ -45,7 +45,6 @@ # @return None def PlayerMagicWeaponLogin(curPlayer): NotifyMagicWeapon(curPlayer, True) - Sycn_MagicWeaponRefineLV(curPlayer) SyncXBXZAwardRecord(curPlayer) Sycn_MagicWeaponLV(curPlayer) Sycn_MWPrivilegeData(curPlayer) @@ -151,8 +150,7 @@ if 1 > packSpace: PlayerControl.SendMailByKey('TreasureWakeUp', [curPlayer.GetID()], [itemAward]) else: - ItemControler.GivePlayerItem(curPlayer, itemID, itemCnt, isBind, - [IPY_GameWorld.rptItem], True, showSysInfo=True, event=["MWAward", False, {"mwID":mwID}]) + 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) @@ -227,43 +225,6 @@ activeCnt += 1 return activeCnt -def GetPotentialsSkillInfo(curPlayer): - #通过潜力技能ID获取对应的下一个技能ID {skillUseType:{skillid:[skilllv,nextSkillid,addPower,]}} - 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() - addPowerList = ipyData.GetSkillPower() - lastSkillUseType = 0 - for curSkillID in skillIDList: - skillData = GameWorld.GetGameData().FindSkillByType(curSkillID, 1) - if skillData == None: - GameWorld.DebugLog("GetPotentialsSkillInfo() hasn't find skill(%s)" % curSkillID) - continue - if lastSkillUseType != skillData.GetUseType(): - index = 0 - else: - index +=1 - lastSkillUseType = skillData.GetUseType() - addPower = addPowerList[index] - - preSkillID = skillData.GetLearnSkillReq() - if not preSkillID: - continue - skillUseType = skillData.GetUseType() - preSkilllv = skillData.GetLearnSkillLV() - if skillUseType not in g_potentialsSkillDict: - g_potentialsSkillDict[skillUseType] = {} - g_potentialsSkillDict[skillUseType][preSkillID] = [preSkilllv, curSkillID, addPower] - curskillUseType = pow(2, curPlayer.GetJob()) - - return g_potentialsSkillDict.get(curskillUseType, {}) - ## 给技能 # @param curPlayer # @param skillResID 技能源ID @@ -301,174 +262,6 @@ 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 - playerID = curPlayer.GetPlayerID() - maxRateValue = ShareDefine.Def_MaxRateValue - randValue = random.randint(0, maxRateValue-1) - canHappen = randValue < initRate - GameWorld.DebugLog("canHappen=%s,randValue=%s,initRate=%s,maxRateValue=%s" - % (canHappen, randValue, initRate, maxRateValue), playerID) - # 不是百分百成功的记录合成流向 - if initRate != maxRateValue: - drDict = {"PlayerID":playerID, "AccID":curPlayer.GetAccID(), "skillTypeID":skillTypeID, "IsSuccess":canHappen, - "initRate":initRate, "randValue":randValue, "maxRateValue":maxRateValue} - - DataRecordPack.SendEventPack("MagicWeaponSkillUp", drDict, curPlayer) - - if not canHappen: - 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, 0) - PassiveBuffEffMng.GetPassiveEffManager().RegistPassiveEff(curPlayer, newSkillID) - if SkillCommon.isPassiveAttr(newSkill): - newSkillIsPassive = True - PlayerControl.WorldNotify(0, 'SkillPotential2', [curPlayer.GetName(), skillTypeID, upSkillLv, newSkillID]) - - - #通知技能已升级成功 - hasUnlockSkill = False - nextSkillDict = GetPotentialsSkillInfo(curPlayer) - if skillTypeID in nextSkillDict: - needSkilllv,nextSkillID = nextSkillDict[skillTypeID][:2] - if upSkillLv == needSkilllv: - PlayerControl.WorldNotify(0, 'SkillPotential1', [curPlayer.GetName(), skillTypeID, upSkillLv, nextSkillID]) - CalcMagicWeaponAttr(curPlayer) - hasUnlockSkill = True - - maxLV = upSkill.GetSkillMaxLV() - if upSkillLv == maxLV: - PlayerControl.WorldNotify(0, 'SkillPotential3', [curPlayer.GetName(), skillTypeID, maxLV]) - - if SkillCommon.isPassiveAttr(upSkill) or newSkillIsPassive or hasUnlockSkill: - curControl.RefreshPlayerAttrState() - - curControl.RefreshSkillFightPowerEx(upSkill.GetSkillID(), beforeFightPower) - PassiveBuffEffMng.GetPassiveEffManager().RegistPassiveEff(curPlayer, upSkill.GetSkillID()) - - #获得技能等级 - #curSkillLV = curSkill.GetSkillLV() - GameWorld.DebugLog(' 法宝技能升级 skillTypeID=%s, upSkillLv=%s' % (skillTypeID, upSkillLv)) - DataRecordPack.DR_LearnORUPSkill(curPlayer, skillTypeID, upSkillLv) - - curPlayer.Sync_MakeItemAnswer(ShareDefine.Def_mitMagicWeaponSkillUp, 1) - - SetMWPrivilegeData(curPlayer, ChConfig.MWPrivilege_MWSkillUp, GetSPSkillTotalLV(curPlayer)) - PlayerSuccess.DoAddSuccessProgress(curPlayer, ShareDefine.SuccType_MWSkillUp, 1, [skillTypeID]) - EventShell.EventRespons_MWSkillUp(curPlayer) - return - -def GetSPSkillTotalLV(curPlayer): - #潜力技能总等级 - totalLV = 0 - skillManager = curPlayer.GetSkillManager() - for i in xrange(skillManager.GetSkillCount()): - curSkill = skillManager.GetSkillByIndex(i) - if curSkill.GetFuncType() != ChConfig.Def_SkillFuncType_FbSPSkill: - continue - totalLV += curSkill.GetSkillLV() - return totalLV - def NotifyMagicWeapon(curPlayer, isLogin=False): #通知法宝信息 packData = ChPyNetSendPack.tagMCMagicWeaponData() @@ -500,15 +293,20 @@ 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 = {} #======================================================================= # #铸炼属性 @@ -519,22 +317,41 @@ # GameWorld.AddDictValue(allAttrDict, attrDict) #======================================================================= treasureType = treasureIpyData.GetTreasureType() - #等级属性 - 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() + 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) - - 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) + 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: @@ -551,6 +368,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()) @@ -558,127 +377,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) - #技能解锁战力 - nextSkillDict = GetPotentialsSkillInfo(curPlayer) - addPowerDict = {} - for skillID, info in nextSkillDict.items(): - needSkilllv, nextSkillID, addPower = info - skillManager = curPlayer.GetSkillManager() - curSkill = skillManager.FindSkillBySkillTypeID(skillID) - if not curSkill: - continue - curSkillLV = curSkill.GetSkillLV() - if curSkillLV < needSkilllv: - continue - mfpType = ChConfig.Def_SkillFuncType_MFPType.get(curSkill.GetFuncType(), ShareDefine.Def_MFPType_Role) - addPowerDict[mfpType] = addPowerDict.get(mfpType, 0) + addPower - - for mfpType, addPower in addPowerDict.items(): - curPlayer.SetDict(ChConfig.Def_PlayerKey_MFPEx % mfpType, addPower) + 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 # @@ -766,23 +467,23 @@ 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 @@ -805,7 +506,7 @@ # 给物品 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(): @@ -894,12 +595,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 = [] @@ -908,7 +611,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 @@ -916,6 +620,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: @@ -964,6 +669,13 @@ 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() @@ -1014,8 +726,7 @@ 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}]) + ItemControler.GivePlayerItem(curPlayer, int(itemid), int(cnt), 0, [IPY_GameWorld.rptItem], event=["MWSoulAward", False, {"privilege":privilege}]) #通知 Sycn_MWPrivilegeData(curPlayer, privilege) @@ -1070,6 +781,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 # @@ -1135,9 +884,11 @@ return def UptateMWFBPasslv(curPlayer, mwID, passLV): - GameWorld.Log('更新关卡 mwID=%s,level=%s'%(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 \ No newline at end of file -- Gitblit v1.8.0