Ejemplo n.º 1
0
        public override void Initialize()
        {
            ServerApi.Hooks.GamePostInitialize.Register(this, PostInitialize);
            Commands.ChatCommands.Add(new Command("map.create", MapCommand, "map"));

            string pluginFolder = Environment.CurrentDirectory + Path.DirectorySeparatorChar + "map";

            CreateDirectory(pluginFolder);

            properties = new PropertiesFile(pluginFolder + Path.DirectorySeparatorChar + "map.properties");
            properties.Load();
            var dummy  = OutputPath;
            var dummy2 = Colorscheme;
            var dummy3 = AutosavePath;
            var dummy4 = AutosaveInterval;
            var dummy5 = AutosaveTimestamp;
            var dummy6 = AutosaveHighlight;
            var dummy7 = AutosaveHighlightID;
            var dummy8 = AutosaveEnabled;
            var dummy9 = AutosaveName;

            properties.Save();

            if (Colorscheme == "MoreTerra" || Colorscheme == "Terrafirma")
            {
                isEnabled = true;
            }
            else
            {
                TShock.Log.Error("<map> ERROR: colorscheme must be either 'MoreTerra' or 'Terrafirma'");
                TShock.Log.Error("<map> ERROR: map command will not work until you change it");
                isEnabled = false;
            }
        }
Ejemplo n.º 2
0
        protected override void Initialized(object state)
        {
            string pluginFolder = Globals.DataPath + Path.DirectorySeparatorChar + "map";

            CreateDirectory(pluginFolder);

            properties = new PropertiesFile(pluginFolder + Path.DirectorySeparatorChar + "map.properties");
            properties.Load();
            var dummy  = mapoutputpath;
            var dummy2 = colorscheme;
            var dummy3 = autosavepath;
            var dummy4 = autosaveinterval;
            var dummy5 = autosavetimestamp;
            var dummy6 = autosavehighlight;
            var dummy7 = autosavehightlightID;
            var dummy8 = autosaveenabled;
            var dummy9 = autosavename;

            properties.Save();

            if (colorscheme == "MoreTerra" || colorscheme == "Terrafirma")
            {
                isEnabled = true;
            }
            else
            {
                ProgramLog.Error.Log("<map> ERROR: colorscheme must be either 'MoreTerra' or 'Terrafirma'");
                ProgramLog.Error.Log("<map> ERROR: map command will not work until you change it");
                isEnabled = false;
            }

            this.AddCommand("map")
            .WithDescription("map options")
            .WithAccessLevel(AccessLevel.OP)
            .SetDefaultUsage()
            .WithHelpText("map help")
            .WithHelpText("map -t")
            .WithHelpText("map -n outputname.png")
            .WithHelpText("map -L")
            .WithHelpText("map [-s] -p /path/to/output")
            .WithHelpText("map [-s] -p \"C:\\path\\to\\output\"")
            .WithHelpText("map [-s] -c MoreTerra")
            .WithHelpText("map [-s] -c Terrafirma")
            .WithHelpText("map -h \"name or ID of item to highlight\"")
            .WithHelpText("map -web")
            .Calls(this.MapCommand);
        }