public void ReloadNpc(TPlayObject PlayObject, string[] @Params) { string sParam = string.Empty; if (@Params != null) { sParam = @Params.Length > 0 ? @Params[0] : ""; } List <TMerchant> TmpMerList = null; List <TNormNpc> TmpNorList = null; TMerchant Merchant; TNormNpc NPC; if ((PlayObject.m_btPermission < 6)) { return; } if (("all").ToLower().CompareTo((sParam).ToLower()) == 0) { LocalDB.GetInstance().ReLoadMerchants(); UserEngine.ReloadMerchantList(); PlayObject.SysMsg("交易NPC重新加载完成!!!", TMsgColor.c_Red, TMsgType.t_Hint); UserEngine.ReloadNpcList(); PlayObject.SysMsg("管理NPC重新加载完成!!!", TMsgColor.c_Red, TMsgType.t_Hint); return; } TmpMerList = new List <TMerchant>(); try { if (UserEngine.GetMerchantList(PlayObject.m_PEnvir, PlayObject.m_nCurrX, PlayObject.m_nCurrY, 9, TmpMerList) > 0) { for (int I = 0; I < TmpMerList.Count; I++) { Merchant = TmpMerList[I]; Merchant.ClearScript(); Merchant.LoadNpcScript(); PlayObject.SysMsg(Merchant.m_sCharName + "重新加载成功...", TMsgColor.c_Green, TMsgType.t_Hint); } } else { PlayObject.SysMsg("附近未发现任何交易NPC!!!", TMsgColor.c_Red, TMsgType.t_Hint); } TmpNorList = new List <TNormNpc>(); if (UserEngine.GetNpcList(PlayObject.m_PEnvir, PlayObject.m_nCurrX, PlayObject.m_nCurrY, 9, TmpNorList) > 0) { for (int I = 0; I < TmpNorList.Count; I++) { NPC = TmpNorList[I]; NPC.ClearScript(); NPC.LoadNpcScript(); PlayObject.SysMsg(NPC.m_sCharName + "重新加载成功...", TMsgColor.c_Green, TMsgType.t_Hint); } } else { PlayObject.SysMsg("附近未发现任何管理NPC!!!", TMsgColor.c_Red, TMsgType.t_Hint); } } finally { HUtil32.Dispose(TmpMerList); HUtil32.Dispose(TmpNorList); } }
public void ClearMapMonster(TPlayObject PlayObject, string[] @Params) { if (@Params == null) { return; } string sMapName = @Params.Length > 0 ? @Params[0] : ""; string sMonName = @Params.Length > 1 ? @Params[1] : ""; string sItems = @Params.Length > 2 ? @Params[2] : ""; List <TBaseObject> MonList; TEnvirnoment Envir; int nMonCount; bool boKillAll; bool boKillAllMap; bool boNotItem; TBaseObject BaseObject; if ((sMapName == "") || (sMonName == "") || (sItems == "")) { if (M2Share.g_Config.boGMShowFailMsg) { PlayObject.SysMsg("命令格式: @" + this.Attributes.Name + " 地图号(* 为所有) 怪物名称(* 为所有) 掉物品(0,1)", TMsgColor.c_Red, TMsgType.t_Hint); } return; } boKillAll = false; boKillAllMap = false; boNotItem = true; nMonCount = 0; Envir = null; if (sMonName == "*") { boKillAll = true; } if (sMapName == "*") { boKillAllMap = true; } if (sItems == "1") { boNotItem = false; } MonList = new List <TBaseObject>(); try { for (int I = 0; I < M2Share.g_MapManager.m_MapList.Count; I++) { Envir = ((TEnvirnoment)(M2Share.g_MapManager.m_MapList[I])); if ((Envir != null)) { if (boKillAllMap || ((Envir.sMapName).ToLower().CompareTo((sMapName).ToLower()) == 0)) { UserEngine.GetMapMonster(Envir, MonList); if (MonList.Count > 0) { for (int II = 0; II < MonList.Count; II++) { BaseObject = MonList[II]; if ((BaseObject != null)) { if ((BaseObject.m_Master != null) && (BaseObject.m_btRaceServer != 135))// 除135怪外,其它宝宝不清除 { if ((BaseObject.m_Master.m_btRaceServer == Grobal2.RC_PLAYOBJECT) || (BaseObject.m_Master.m_btRaceServer == Grobal2.RC_HEROOBJECT)) { continue; } } if (boKillAll || ((sMonName).ToLower().CompareTo((BaseObject.m_sCharName).ToLower()) == 0)) { BaseObject.m_boNoItem = boNotItem; BaseObject.m_WAbil.HP = 0; nMonCount++; } } } } } } } } finally { HUtil32.Dispose(MonList); } if (Envir == null) { PlayObject.SysMsg("输入的地图不存在!!!", TMsgColor.c_Red, TMsgType.t_Hint); return; } PlayObject.SysMsg("已清除怪物数: " + nMonCount, TMsgColor.c_Red, TMsgType.t_Hint); }
public void NpcScript(TPlayObject PlayObject, string[] @Params) { int nPermission = @Params.Length > 0 ? int.Parse(@Params[0]) : 0; string sParam1 = @Params.Length > 1 ? @Params[1] : ""; string sParam2 = @Params.Length > 2 ? @Params[2] : ""; string sParam3 = @Params.Length > 3 ? @Params[3] : ""; TBaseObject BaseObject; int nNPCType; string sScriptFileName = string.Empty; TMerchant Merchant; TNormNpc NormNpc; TStringList LoadList; string sScriptLine; if ((sParam1 == "") || ((sParam1 != "") && (sParam1[0] == '?'))) { if (M2Share.g_Config.boGMShowFailMsg) { PlayObject.SysMsg(string.Format(GameMsgDef.g_sGameCommandParamUnKnow, this.Attributes.Name, GameMsgDef.g_sGameCommandNpcScriptHelpMsg), TMsgColor.c_Red, TMsgType.t_Hint); } return; } nNPCType = -1; BaseObject = PlayObject.GetPoseCreate(); if (BaseObject != null) { for (int I = 0; I < UserEngine.m_MerchantList.Count; I++) { if (((UserEngine.m_MerchantList[I]) as TBaseObject) == BaseObject) { nNPCType = 0; break; } } for (int I = 0; I < UserEngine.QuestNPCList.Count; I++) { if (((UserEngine.QuestNPCList[I]) as TBaseObject) == BaseObject) { nNPCType = 1; break; } } } if (nNPCType < 0) { PlayObject.SysMsg("命令使用方法不正确,必须与NPC面对面,才能使用此命令!!!", TMsgColor.c_Red, TMsgType.t_Hint); return; } if (sParam1 == "") { if (nNPCType == 0) { Merchant = ((TMerchant)(BaseObject)); sScriptFileName = M2Share.g_Config.sEnvirDir + M2Share.sMarket_Def + Merchant.m_sScript + "-" + Merchant.m_sMapName + ".txt"; } if (nNPCType == 1) { NormNpc = ((TNormNpc)(BaseObject)); sScriptFileName = M2Share.g_Config.sEnvirDir + M2Share.sNpc_def + NormNpc.m_sCharName + "-" + NormNpc.m_sMapName + ".txt"; } if (File.Exists(sScriptFileName)) { LoadList = new TStringList(); try { LoadList.LoadFromFile(sScriptFileName); } catch { PlayObject.SysMsg("读取脚本文件错误: " + sScriptFileName, TMsgColor.c_Red, TMsgType.t_Hint); } for (int I = 0; I < LoadList.Count; I++) { sScriptLine = LoadList[I].Trim(); sScriptLine = HUtil32.ReplaceChar(sScriptLine, ' ', ','); PlayObject.SysMsg(I + "," + sScriptLine, TMsgColor.c_Blue, TMsgType.t_Hint); } HUtil32.Dispose(LoadList); } } }
public void StartContest(TPlayObject PlayObject, string[] @Params) { string sParam1 = @Params.Length > 0 ? @Params[0] : ""; List <TPlayObject> List10; ArrayList List14; TPlayObject m_PlayObject; TPlayObject PlayObjectA; bool bo19; string s20; TGUild Guild; if (((sParam1 != "") && (sParam1[0] == '?'))) { PlayObject.SysMsg("开始行会争霸赛。", TMsgColor.c_Red, TMsgType.t_Hint); PlayObject.SysMsg(String.Format("命令格式: @{0}", this.Attributes.Name), TMsgColor.c_Red, TMsgType.t_Hint); return; } if (!PlayObject.m_PEnvir.m_boFight3Zone) { PlayObject.SysMsg("此命令不能在当前地图中使用!!!", TMsgColor.c_Red, TMsgType.t_Hint); return; } List10 = new List <TPlayObject>(); List14 = new ArrayList(); UserEngine.GetMapRageHuman(PlayObject.m_PEnvir, PlayObject.m_nCurrX, PlayObject.m_nCurrY, 1000, List10); for (int I = 0; I < List10.Count; I++) { m_PlayObject = List10[I]; if (!m_PlayObject.m_boObMode || !m_PlayObject.m_boAdminMode) { m_PlayObject.m_nFightZoneDieCount = 0; if (m_PlayObject.m_MyGuild == null) { continue; } bo19 = false; for (int II = 0; II < List14.Count; II++) { PlayObjectA = ((List14[II]) as TPlayObject); if (m_PlayObject.m_MyGuild == PlayObjectA.m_MyGuild) { bo19 = true; } } if (!bo19) { List14.Add(m_PlayObject.m_MyGuild); } } } PlayObject.SysMsg("行会争霸赛已经开始。", TMsgColor.c_Green, TMsgType.t_Hint); UserEngine.CryCry(Grobal2.RM_CRY, PlayObject.m_PEnvir, PlayObject.m_nCurrX, PlayObject.m_nCurrY, 1000, M2Share.g_Config.btCryMsgFColor, M2Share.g_Config.btCryMsgBColor, "- 行会战争已爆发。"); s20 = ""; for (int I = 0; I < List14.Count; I++) { Guild = ((TGUild)(List14[I])); Guild.StartTeamFight(); for (int II = 0; II < List10.Count; II++) { m_PlayObject = ((List10[I]) as TPlayObject); if (m_PlayObject.m_MyGuild == Guild) { Guild.AddTeamFightMember(m_PlayObject.m_sCharName); } } s20 = s20 + Guild.sGuildName + ' '; } UserEngine.CryCry(Grobal2.RM_CRY, PlayObject.m_PEnvir, PlayObject.m_nCurrX, PlayObject.m_nCurrY, 1000, M2Share.g_Config.btCryMsgFColor, M2Share.g_Config.btCryMsgBColor, " -参加的门派:" + s20); HUtil32.Dispose(List10); HUtil32.Dispose(List14); }