Esempio n. 1
0
        /// <summary>
        /// Reload Config File <type>
        /// </summary>
        /// <param name="args"></param>
        private void CommandIReload(CommandArgs args)
        {
            if (NPCManager.CustomNPCInvasion.invasionStarted)
            {
                NPCManager.CustomNPCInvasion.StopInvasion();
            }

            try
            {
                if (File.Exists(filepath))
                {
                    ConfigObj = new CustomNPCConfig();
                    ConfigObj = CustomNPCConfig.Read(filepath);
                    return;
                }
                else
                {
                    TShock.Log.ConsoleError("Config not found. Creating new one");
                    ConfigObj.Write(filepath);
                    return;
                }
            }
            catch (Exception ex)
            {
                TShock.Log.ConsoleError(ex.Message);
                return;
            }
        }
Esempio n. 2
0
 private void OnInitialize(EventArgs args)
 {
     Commands.ChatCommands.Add(new Command("customnpc.spawn", CommandSpawnNPC, "csm"));
     Commands.ChatCommands.Add(new Command("customnpc.list", CommandListNPCS, "monsterlist", "mlist"));
     Commands.ChatCommands.Add(new Command("customnpc.invadereload", CommandIReload, "invadereload", "ireload"));
     Commands.ChatCommands.Add(new Command("customnpc.invade", CommandInvade, "monsterinvade", "minvade"));
     Commands.ChatCommands.Add(new Command("customnpc.info", CommandNPCInfo, "monsterinfo", "minfo"));
     ConfigObj = new CustomNPCConfig();
     SetupConfig();
     NPCManager.CustomNPCInvasion.WaveSets = ConfigObj.WaveSets;
     mainLoop.Elapsed += mainLoop_Elapsed;
     mainLoop.Enabled  = true;
 }
Esempio n. 3
0
 /// <summary>
 /// Config for Custom Mob Invasions
 /// </summary>
 private void SetupConfig()
 {
     try
     {
         if (File.Exists(filepath))
         {
             ConfigObj = new CustomNPCConfig();
             ConfigObj = CustomNPCConfig.Read(filepath);
             return;
         }
         else
         {
             TShock.Log.ConsoleError("Config not found. Creating new one");
             ConfigObj.Write(filepath);
             return;
         }
     }
     catch (Exception ex)
     {
         TShock.Log.ConsoleError(ex.Message);
         return;
     }
 }