From 7aea6ad0d560ee2533024c910b956fdfcdb59583 Mon Sep 17 00:00:00 2001 From: hxp <ale99527@vip.qq.com> Date: 星期五, 24 五月 2019 15:40:36 +0800 Subject: [PATCH] 6805 【后端】【2.0】副本前端化(优化前端本状态逻辑,召唤木桩增加可指定血量,增加可设置玩家血量) --- ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py | 72 ++++++++++++++++++++--------------- 1 files changed, 41 insertions(+), 31 deletions(-) diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py index 1a68119..c01ed88 100644 --- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py +++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py @@ -621,8 +621,8 @@ def DoGiveItemByVirtualDrop(curPlayer, giveItemList, npcID, dropPosX=0, dropPosY=0, isDropDisperse=True, mailTypeKey="ItemNoPickUp"): ## 给物品并且做假掉落表现,直接先堆叠给物品,再拆开做虚假掉落表现 - mapID = curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_ClientCustomSceneMapID) - lineID = curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_ClientCustomSceneLineID) + mapID = PlayerControl.GetCustomMapID(curPlayer) + lineID = PlayerControl.GetCustomLineID(curPlayer) if not mapID: mapID = GameWorld.GetGameWorld().GetMapID() @@ -2024,15 +2024,19 @@ # tagHead Head; # DWORD NPCID; # BYTE Count; //默认1个,最多5个 +# DWORD HP; //默认0取最大值,其中一个血量数值大于0则用指定血量 +# DWORD HPEx; //默认0取最大值,其中一个血量数值大于0则用指定血量 #}; def OnSummonPriWoodPile(index, clientData, tick): curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index) npcID = clientData.NPCID count = clientData.Count - SummonPriWoodPile(curPlayer, npcID, count) + hp = clientData.HP + hpEx = clientData.HPEx + SummonPriWoodPile(curPlayer, npcID, count, hp, hpEx) return -def SummonPriWoodPile(curPlayer, npcID, count): +def SummonPriWoodPile(curPlayer, npcID, count, hp=0, hpEx=0): ''' 召唤私有专属木桩怪 ''' @@ -2040,12 +2044,15 @@ GameWorld.DebugLog("玩家当前不是在自定义场景中,不允许招木桩!") return - mapID = curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_ClientCustomSceneMapID) - lineID = curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_ClientCustomSceneLineID) + mapID = PlayerControl.GetCustomMapID(curPlayer) + lineID = PlayerControl.GetCustomLineID(curPlayer) if mapID: if not FBLogic.OnCanSummonPriWoodPile(curPlayer, mapID, lineID, npcID, count): GameWorld.ErrLog("无法召唤木桩怪!mapID=%s,lineID=%s,npcID=%s,count=%s" % (mapID, lineID, npcID, count)) return + + if count != 1: + hp, hpEx = 0, 0 # 指定血量的暂仅适用于单只的 maxCount = 10 nowCount = 0 @@ -2064,8 +2071,8 @@ nowCount += 1 summonCount = min(count, maxCount - nowCount) - #GameWorld.DebugLog("召唤: count=%s,maxCount=%s,nowCount=%s,summonCount=%s" - # % (count, maxCount, nowCount, summonCount)) + #GameWorld.DebugLog("召唤: count=%s,maxCount=%s,nowCount=%s,summonCount=%s,hp=%s,hpEx=%s" + # % (count, maxCount, nowCount, summonCount, hp, hpEx)) if summonCount <= 0: return @@ -2085,26 +2092,29 @@ #玩家周围随机出生点 #技能召唤坐标 ChConfig.Def_SummonAppearDist summonPos = GameMap.GetEmptyPlaceInArea(curPlayer.GetPosX(), curPlayer.GetPosY(), 3) - summonNPC.Reborn(summonPos.GetPosX(), summonPos.GetPosY()) - - if not curPlayer.GetSight(): - summonNPCAppear = ChNetSendPack.tagPlayerSummonNPCAppear() - summonNPCAppear.Clear() - summonNPCAppear.PlayerID = curPlayer.GetPlayerID() - summonNPCAppear.ObjID = summonNPC.GetID() - summonNPCAppear.NPCID = summonNPC.GetNPCID() - summonNPCAppear.PosX = summonNPC.GetPosX() - summonNPCAppear.PosY = summonNPC.GetPosY() - summonNPCAppear.HP = summonNPC.GetHP() - summonNPCAppear.HPEx = summonNPC.GetHPEx() - summonNPCAppear.MaxHP = summonNPC.GetMaxHP() - summonNPCAppear.MaxHPEx = summonNPC.GetMaxHPEx() - summonNPCAppear.Speed = summonNPC.GetSpeed() - summonNPCAppear.LV = GetNPCLV(summonNPC) - summonNPCAppear.OwnerName = curPlayer.GetPlayerName() - summonNPCAppear.OwnerNameLen = len(summonNPCAppear.OwnerName) - NetPackCommon.SendFakePack(curPlayer, summonNPCAppear) + summonNPC.Reborn(summonPos.GetPosX(), summonPos.GetPosY(), False) + if hp or hpEx: + summonNPC.SetHP(hp) + summonNPC.SetHPEx(hpEx) + #if not curPlayer.GetSight(): + summonNPCAppear = ChNetSendPack.tagPlayerSummonNPCAppear() + summonNPCAppear.Clear() + summonNPCAppear.PlayerID = curPlayer.GetPlayerID() + summonNPCAppear.ObjID = summonNPC.GetID() + summonNPCAppear.NPCID = summonNPC.GetNPCID() + summonNPCAppear.PosX = summonNPC.GetPosX() + summonNPCAppear.PosY = summonNPC.GetPosY() + summonNPCAppear.HP = summonNPC.GetHP() + summonNPCAppear.HPEx = summonNPC.GetHPEx() + summonNPCAppear.MaxHP = summonNPC.GetMaxHP() + summonNPCAppear.MaxHPEx = summonNPC.GetMaxHPEx() + summonNPCAppear.Speed = summonNPC.GetSpeed() + summonNPCAppear.LV = GetNPCLV(summonNPC) + summonNPCAppear.OwnerName = curPlayer.GetPlayerName() + summonNPCAppear.OwnerNameLen = len(summonNPCAppear.OwnerName) + NetPackCommon.SendFakePack(curPlayer, summonNPCAppear) + return def ClearPriWoodPile(curPlayer): @@ -5862,12 +5872,12 @@ if not curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_ClientCustomScene): GameWorld.DebugLog("非自定义场景中,无法获取定义采集奖励!") return - mapID = curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_ClientCustomSceneMapID) - lineID = curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_ClientCustomSceneLineID) + mapID = PlayerControl.GetCustomMapID(curPlayer) + lineID = PlayerControl.GetCustomLineID(curPlayer) GameWorld.DebugLog("前端场景采集: mapID=%s,lineID=%s,npcID=%s" % (mapID, lineID, npcID)) if mapID: - #if FBCommon.GetCustomSceneState(curPlayer, mapID, lineID) != ChConfig.CustomSceneState_Fight: + #if FBCommon.GetCustomMapStep(curPlayer, mapID, lineID) != ChConfig.CustomMapStep_Fight: # return FBLogic.OnCustomSceneCollectOK(curPlayer, mapID, lineID, npcID) @@ -6419,7 +6429,7 @@ if not dropItemList: return - mapID = attackPlayer.GetDictByKey(ChConfig.Def_PlayerKey_ClientCustomSceneMapID) + mapID = PlayerControl.GetCustomMapID(attackPlayer) if mapID: DoGiveItemByVirtualDrop(attackPlayer, dropItemList, npcID) GameLogic_CrossGrassland.RecordGrasslandAward(attackPlayer, dropItemList) -- Gitblit v1.8.0