From 7db53f547e9093ad323343d28282e40413c13a6d Mon Sep 17 00:00:00 2001 From: xdh <xiefantasy@qq.com> Date: 星期二, 25 九月 2018 20:22:35 +0800 Subject: [PATCH] 3818 日常任务次数重置问题 --- ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerDogz.py | 67 ++++++++++++++++++++++++++++----- 1 files changed, 56 insertions(+), 11 deletions(-) diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerDogz.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerDogz.py index ccb1d2d..d919299 100644 --- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerDogz.py +++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerDogz.py @@ -25,6 +25,9 @@ import IpyGameDataPY import ChConfig import ChEquip +import PassiveBuffEffMng +import SkillCommon +import SkillShell ''' 神兽编号: 1~20,上线后不可修改 @@ -53,6 +56,9 @@ ## 设置神兽是否助战状态 GameWorld.SetDictValueByBit(curPlayer, ChConfig.Def_PDict_DogzFightState, dogzID - 1, 1 if isFight else 0) Sync_DogzHelpbattleState(curPlayer, dogzID, isFight) + + # 设置成功后才能刷技能 + PassiveBuffEffMng.PlayerDogzSkill(curPlayer) return @@ -314,6 +320,7 @@ # BYTE EquipIndex; //神兽装备背包中索引 # BYTE IndexCount; //材料所在神兽物品背包索引的数量 # BYTE IndexList[IndexCount]; //材料所在神兽物品背包索引列表 +# BYTE IndexUseCountList[IndexCount]; //材料所在神兽物品背包索引对应使用个数列表 # BYTE IsDouble; //是否双倍强化 #}; def OnDogzEquipPlus(index, clientData, tick): @@ -321,8 +328,14 @@ playerID = curPlayer.GetPlayerID() equipIndex = clientData.EquipIndex indexList = clientData.IndexList + indexUseCountList = clientData.IndexUseCountList isDouble = clientData.IsDouble - GameWorld.DebugLog("神兽装备强化: equipIndex=%s,indexList=%s,isDouble=%s" % (equipIndex, indexList, isDouble), playerID) + GameWorld.DebugLog("神兽装备强化: equipIndex=%s,indexList=%s,indexUseCountList=%s,isDouble=%s" + % (equipIndex, indexList, indexUseCountList, isDouble), playerID) + + if len(indexList) != len(indexUseCountList): + GameWorld.DebugLog(" 指定消耗的个数数据长度错误!") + return dogzEquipPack = curPlayer.GetItemManager().GetPack(ShareDefine.rptDogzEquip) curEquip = dogzEquipPack.GetAt(equipIndex) @@ -357,7 +370,7 @@ delItemList = [] dogzItemPack = curPlayer.GetItemManager().GetPack(ShareDefine.rptDogzItem) dogzItemPackCount = dogzItemPack.GetCount() - for i in indexList: + for listIndex, i in enumerate(indexList): if i < 0 or i >= dogzItemPackCount: GameWorld.ErrLog("神兽背包索引不存在,无法强化!i=%s" % (i), playerID) return @@ -370,24 +383,25 @@ GameWorld.ErrLog("神兽背包物品无经验效果,无法强化!i=%s,itemID=%s" % (i, curItem.GetItemTypeID()), playerID) return + delCount = max(1, min(curItem.GetCount(), indexUseCountList[listIndex])) baseExp = effect.GetEffectValue(0) doubleCostGold = effect.GetEffectValue(1) - addExp = baseExp + addExp = baseExp * delCount plusInfoCount = curItem.GetUserAttrCount(ShareDefine.Def_IudetDogzEquipPlus) if not plusInfoCount: if isDouble and doubleCostGold: - addExp = (baseExp * 2) - costGoldTotal += doubleCostGold - GameWorld.DebugLog(" 强化: addExp=%s,baseExp=%s,isDouble=%s,doubleCostGold=%s,costGoldTotal=%s" - % (addExp, baseExp, isDouble, doubleCostGold, costGoldTotal), playerID) + addExp = (baseExp * 2 * delCount) + costGoldTotal += doubleCostGold * delCount + GameWorld.DebugLog(" 强化: addExp=%s,delCount=%s,baseExp=%s,isDouble=%s,doubleCostGold=%s,costGoldTotal=%s" + % (addExp, delCount, baseExp, isDouble, doubleCostGold, costGoldTotal), playerID) else: #plusLV = curItem.GetUserAttrByIndex(ShareDefine.Def_IudetDogzEquipPlus, 0) plusExpTotal = curItem.GetUserAttrByIndex(ShareDefine.Def_IudetDogzEquipPlus, 1) addExp += plusExpTotal - GameWorld.DebugLog(" 强化: addExp=%s,baseExp=%s,plusExpTotal=%s" % (addExp, baseExp, plusExpTotal), playerID) + GameWorld.DebugLog(" 强化: addExp=%s,delCount=%s,baseExp=%s,plusExpTotal=%s" % (addExp, delCount, baseExp, plusExpTotal), playerID) addExpTotal += addExp - delItemList.append(curItem) + delItemList.append([curItem, delCount]) if not delItemList: GameWorld.DebugLog(" 没有材料可强化!", playerID) @@ -401,8 +415,8 @@ ChConfig.Def_Cost_DogzEquipPlus, infoDict): return - for delItem in delItemList: - ItemCommon.DelItem(curPlayer, delItem, curItem.GetCount(), False, ChConfig.ItemDel_DogzEquipPlus, infoDict) + for delItem, delCount in delItemList: + ItemCommon.DelItem(curPlayer, delItem, delCount, False, ChConfig.ItemDel_DogzEquipPlus, infoDict) updPlusLV = curPlusLV doCount, maxDoCount = 0, maxPlusLV * 2 @@ -437,6 +451,7 @@ RefreshDogzAttr(curPlayer) PlayerControl.PlayerControl(curPlayer).RefreshPlayerAttrState() + curPlayer.Sync_MakeItemAnswer(ShareDefine.Def_mitDogzEquipPlus, 1) return def GetDogzEquipPlusLVExpInfo(equipColor, equipPlace, totalExp): @@ -531,8 +546,38 @@ # 保存计算值 PlayerControl.SetCalcAttrListValue(curPlayer, ChConfig.Def_CalcAttrFunc_Dogz, allAttrList) curPlayer.SetDict(ChConfig.Def_PlayerKey_MFPEx % ShareDefine.Def_MFPType_Dogz, fightPowerEx) + + # 技能属性,从Def_CalcAttrFunc_Dogz获取 + skillAttrList = CalcDogzBattleSkillAttr(curPlayer) + PlayerControl.SetCalcAttrListValue(curPlayer, ChConfig.Def_CalcAttrFunc_HorseSkill, skillAttrList) return +# 助战神兽技能属性,必须在 SetDogzIsHelpFight后调用 +def CalcDogzBattleSkillAttr(curPlayer): + skillAttrList = [{} for _ in range(4)] + skillManager = curPlayer.GetSkillManager() + + for i in range(0 , skillManager.GetSkillCount()): + curSkill = skillManager.GetSkillByIndex(i) + if not curSkill: + continue + + if curSkill.GetFuncType() != ChConfig.Def_SkillFuncType_Dogz: + continue + + if not SkillCommon.isPassiveAttr(curSkill): + continue + + + for effectIndex in xrange(curSkill.GetEffectCount()): + curEffect = curSkill.GetEffect(effectIndex) + SkillShell.CalcBuffEffAttr(curPlayer, curEffect, skillAttrList) + + + #GameWorld.DebugLog("神兽技能属性: skillFPEx=%s, %s" % ( skillFPEx, skillAttrList)) + return skillAttrList + + def Sync_DogzInfo(curPlayer): ## 同步神兽信息 dogzInfoPack = ChPyNetSendPack.tagMCDogzInfo() -- Gitblit v1.8.0