From ece7760d17592dfcadef52e47848836b13cf3f47 Mon Sep 17 00:00:00 2001 From: hxp <ale99527@vip.qq.com> Date: 星期六, 11 一月 2020 16:13:38 +0800 Subject: [PATCH] 1111 MissionDir命令找不到任务名报错防范 --- ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/SummonNPC.py | 44 ++++++++++++++++++++++---------------------- 1 files changed, 22 insertions(+), 22 deletions(-) diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/SummonNPC.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/SummonNPC.py index c93835a..635c596 100644 --- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/SummonNPC.py +++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/SummonNPC.py @@ -16,45 +16,44 @@ import ChConfig import GameWorld import NPCCommon +import ShareDefine # #逻辑实现 ## 在身边刷召唤NPC <NPCID> [数量] 默认数量:1 # @param curPlayer 当前玩家 -# @param list 参数列表 [tagID, NPCCount] +# @param paramList 参数列表 [tagID, NPCCount] # @return None # @remarks 函数详细说明. -def OnExec(curPlayer, list): -#=============================================================================== -# #检测当前玩家是否有权限 -# #if -# #第一阶段不处理 -#=============================================================================== - +def OnExec(curPlayer, paramList): #输入命令格式错误 - if len(list)<1 or len(list)>2: + if not paramList: + GameWorld.DebugAnswer(curPlayer, "SummonNPC npcID 个数") + GameWorld.DebugAnswer(curPlayer, "SummonNPC npcID 个数 血量") return + #NPC对象ID - tagID=list[0] + npcID = paramList[0] + npcCount = max(paramList[1] if len(paramList) > 1 else 1, 1) + npcData = GameWorld.GetGameData().FindNPCDataByID(npcID) - if not GameWorld.GetGameData().FindNPCDataByID(tagID): + if not npcData: return - - #NPC刷新数量 - if len(list)==1: - #默认数量1 - NPCCount=1 - else: - #GM输入的数量 - NPCCount=list[1] + npcType = npcData.GetType() + if npcType in [ChConfig.ntPriWoodPilePVE, ChConfig.ntPriWoodPilePVP]: + setHP = paramList[2] if len(paramList) > 2 else 0 + hp = setHP % ShareDefine.Def_PerPointValue + hpEx = setHP / ShareDefine.Def_PerPointValue + NPCCommon.SummonPriWoodPile(curPlayer, npcID, npcCount, hp, hpEx) + return - for i in range(0,NPCCount): + for _ in range(npcCount): #在玩家周围选择一个无玩家的点 - resultPos=GameMap.GetEmptyPlaceInArea(curPlayer.GetPosX(),curPlayer.GetPosY(),6) + resultPos = GameMap.GetEmptyPlaceInArea(curPlayer.GetPosX(), curPlayer.GetPosY(), 6) #生成NPC summonNPC = curPlayer.SummonNewNPC() - summonNPC.SetNPCTypeID(tagID) + summonNPC.SetNPCTypeID(npcID) summonNPC.SetAIType(200) summonNPC.GetNPCAngry().Init(ChConfig.Def_SummonNPC_Angry_Count) #初始化 @@ -63,6 +62,7 @@ #玩家召唤兽列表添加召唤兽,召唤兽添加主人 summonNPC.Reborn(resultPos.GetPosX(), resultPos.GetPosY()) + return -- Gitblit v1.8.0