Esempio n. 1
0
        public static void ConsoleAssignHead()
        {
            string currentIns = ConsoleTrack.GetArgAsString();

            // Update the tab lookup.
            ConsoleTrack.PrepareTabLookup(headCodes, currentIns, "Assign the character's head.");

            // Activate the Instruction
            if (ConsoleTrack.activate)
            {
                // If "head" is the only instruction, give a random head to the character.
                if (currentIns == string.Empty)
                {
                    Head.AssignToCharacter(ConsoleTrack.character, (byte)HeadSubType.RandomStandard, true);
                    Systems.settings.login.HeadVal = 0;
                    Systems.settings.login.SaveSettings();
                    return;
                }

                // Get the Head Type by instruction:
                if (headCodes.ContainsKey(currentIns))
                {
                    byte subType = byte.Parse(headCodes[currentIns].ToString());
                    Head.AssignToCharacter(ConsoleTrack.character, (byte)subType, true);
                    Systems.settings.login.HeadVal = subType;
                    Systems.settings.login.SaveSettings();
                }
            }
        }
Esempio n. 2
0
        public static void CheatStatSlide()
        {
            string currentIns = ConsoleTrack.GetArgAsString();

            ConsoleTrack.PrepareTabLookup(slideStatCodes, currentIns, "Assign sliding-related stats for the character.");

            // If the stat instruction is a full word, then we can indicate that it's time to provide additional help text:
            if (slideStatCodes.ContainsKey(currentIns))
            {
                ConsoleTrack.possibleTabs = "";
                ConsoleTrack.helpText     = slideStatCodes[currentIns].ToString();
            }

            if (ConsoleTrack.activate)
            {
                Character character = ConsoleTrack.character;

                // Slide
                if (currentIns == "cooldown")
                {
                    character.stats.SlideWaitDuration = (byte)Math.Round(ConsoleTrack.GetArgAsFloat());
                }
                else if (currentIns == "duration")
                {
                    character.stats.SlideDuration = (byte)Math.Round(ConsoleTrack.GetArgAsFloat());
                }
                else if (currentIns == "strength")
                {
                    character.stats.SlideStrength = FInt.Create(ConsoleTrack.GetArgAsFloat());
                }
            }
        }
Esempio n. 3
0
        public static void CheatCodeMobility()
        {
            string currentIns = ConsoleTrack.GetArgAsString();

            ConsoleTrack.PrepareTabLookup(mobilityCodes, currentIns, "Assign mobility power to the character; e.g. `power mobility levitate`");

            if (ConsoleTrack.activate)
            {
                UIHandler.AddNotification(UIAlertType.Success, "Mobility Granted", "Granted Mobility Power to Character.", 180);

                if (mobilityCodes.ContainsKey(currentIns))
                {
                    if (currentIns == "none")
                    {
                        ConsoleTrack.character.mobilityPower = null;
                        return;
                    }

                    byte subType = byte.Parse(mobilityCodes[currentIns].ToString());
                    Power.AssignPower(ConsoleTrack.character, (byte)subType);
                    return;
                }

                // "wand" was the final valid instruction. Give a random wand to the character.
                Power.AssignPower(ConsoleTrack.character, (byte)PowerSubType.RandomBolt);
            }
        }
Esempio n. 4
0
        public static void ConsoleTeleport()
        {
            string arg = ConsoleTrack.GetArgAsString(false);

            if (arg == "coords")
            {
                ConsoleTrack.instructionArgIndex++;
                ConsoleLevel.ConsoleTeleportCoords();
                return;
            }

            // Secret "room" option.
            if (arg == "room")
            {
                ConsoleTrack.instructionArgIndex++;
                ConsoleLevel.ConsoleTeleportRoom();
                return;
            }

            ConsoleTrack.possibleTabs = "Options: coords, room, # #";
            ConsoleTrack.helpText     = "The grid square (e.g. \"10, 10\") to teleport to. Or `move coords` for exact precision.";

            int x = ConsoleTrack.GetArgAsInt() * (byte)TilemapEnum.TileWidth;
            int y = ConsoleTrack.GetArgAsInt() * (byte)TilemapEnum.TileHeight;

            if (ConsoleTrack.activate && x > 0 && y > 0)
            {
                Character.Teleport(ConsoleTrack.character, x, y);
            }
        }
Esempio n. 5
0
        public static void CheatStatRun()
        {
            string currentIns = ConsoleTrack.GetArgAsString();

            ConsoleTrack.PrepareTabLookup(runStatCodes, currentIns, "Assign ground and running-related stats for the character.");

            Character character = ConsoleTrack.character;

            // If the stat instruction is a full word, then we can indicate that it's time to provide additional help text:
            if (runStatCodes.ContainsKey(currentIns))
            {
                ConsoleTrack.possibleTabs = "";
                ConsoleTrack.helpText     = runStatCodes[currentIns].ToString() + " Current: ";

                if (currentIns == "accel")
                {
                    ConsoleTrack.helpText += String.Format("{0:G2}", character.stats.RunAcceleration.ToDouble()).ToString();
                }
                else if (currentIns == "decel")
                {
                    ConsoleTrack.helpText += String.Format("{0:G2}", character.stats.RunDeceleration.ToDouble()).ToString();
                }
                else if (currentIns == "max-speed")
                {
                    ConsoleTrack.helpText += character.stats.RunMaxSpeed.ToString();
                }
                else if (currentIns == "walk-mult")
                {
                    ConsoleTrack.helpText += String.Format("{0:G2}", character.stats.SlowSpeedMult.ToDouble()).ToString();
                }
            }

            if (ConsoleTrack.activate)
            {
                if (currentIns == "accel")
                {
                    character.stats.RunAcceleration = FInt.Create(ConsoleTrack.GetArgAsFloat());
                }
                else if (currentIns == "decel")
                {
                    character.stats.RunDeceleration = FInt.Create(ConsoleTrack.GetArgAsFloat());
                }
                else if (currentIns == "max-speed")
                {
                    character.stats.RunMaxSpeed = (byte)ConsoleTrack.GetArgAsInt();
                }
                else if (currentIns == "walk-mult")
                {
                    character.stats.SlowSpeedMult = FInt.Create(ConsoleTrack.GetArgAsFloat());
                }

                // Regarldess of what changes, we need to re-run any effects that hats or other effects have.
            }
        }
Esempio n. 6
0
        public static void ResetOptions()
        {
            string currentIns = ConsoleTrack.GetArgAsString();

            ConsoleTrack.PrepareTabLookup(resetCodes, currentIns, "Reset options for this world.");

            if (resetCodes.ContainsKey(currentIns))
            {
                resetCodes[currentIns].Invoke();
                return;
            }
        }
Esempio n. 7
0
        public static void LoadLevelEditor()
        {
            string currentIns = ConsoleTrack.GetArgAsString();

            ConsoleTrack.possibleTabs = "Example: `load-level QCALQOD16`";
            ConsoleTrack.helpText     = "The level ID of the level to load.";

            if (ConsoleTrack.activate)
            {
                SceneTransition.ToLevelEditor("", currentIns);
            }
        }
Esempio n. 8
0
        public static void DebugBase()
        {
            string statIns = ConsoleTrack.GetArgAsString();

            ConsoleTrack.PrepareTabLookup(debugBaseList, statIns, "View or change debug settings.");

            if (debugBaseList.ContainsKey(statIns))
            {
                debugBaseList[statIns].Invoke();
                return;
            }
        }
Esempio n. 9
0
        public static void WorldChange()
        {
            string currentIns = ConsoleTrack.GetArgAsString();

            ConsoleTrack.possibleTabs = "Example: `load-world worldIdHere`";
            ConsoleTrack.helpText     = "This will load a world (if it exists). Enter the world ID of the world to load.";

            if (ConsoleTrack.activate && currentIns.Length > 0)
            {
                SceneTransition.ToWorld(currentIns);
            }
        }
Esempio n. 10
0
        public static void NoPower()
        {
            string currentIns = ConsoleTrack.GetArgAsString();

            ConsoleTrack.PrepareTabLookup(weaponCodes, currentIns, "Removes attack power from character.");

            if (ConsoleTrack.activate)
            {
                ConsoleTrack.character.attackPower = null;
                return;
            }
        }
Esempio n. 11
0
        public static void LoadWorldEditor()
        {
            string currentIns = ConsoleTrack.GetArgAsString();

            ConsoleTrack.possibleTabs = "Example: `load-world worldIdHere`";
            ConsoleTrack.helpText     = "The world ID of the world to load. Will load a world (if it exists).";

            if (ConsoleTrack.activate)
            {
                SceneTransition.ToWorldEditor(currentIns);
            }
        }
Esempio n. 12
0
        public static void Resize()
        {
            string currentIns = ConsoleTrack.GetArgAsString();

            ConsoleTrack.PrepareTabLookup(resizeCodes, currentIns, "Resize a room. WARNING: BE CAREFUL! Reducing a room size can remove tiles you've placed.");

            if (resizeCodes.ContainsKey(currentIns))
            {
                resizeCodes[currentIns].Invoke();
                return;
            }
        }
Esempio n. 13
0
        public static void CheatCodePowers()
        {
            string statIns = ConsoleTrack.GetArgAsString();

            ConsoleTrack.PrepareTabLookup(basePowerCodes, statIns, "Assign a power to the character.");

            if (basePowerCodes.ContainsKey(statIns))
            {
                basePowerCodes[statIns].Invoke();
                return;
            }
        }
Esempio n. 14
0
        public static void ResizeMap()
        {
            string currentIns = ConsoleTrack.GetArgAsString();
            int    curVal     = ConsoleTrack.GetArgAsInt();

            ConsoleTrack.PrepareTabLookup(resizeOpts, currentIns, "Resize World Map");

            // Width Option
            if (currentIns == "width")
            {
                int currentWidth = ((WEScene)Systems.scene).xCount;
                ConsoleTrack.possibleTabs = "Example: resize width 60";
                ConsoleTrack.helpText     = "Choose a width between " + (byte)WorldmapEnum.MinWidth + " and " + (byte)WorldmapEnum.MaxWidth + ". Currently at " + currentWidth + ".";
            }

            // Height Option
            else if (currentIns == "height")
            {
                int currentHeight = ((WEScene)Systems.scene).yCount;
                ConsoleTrack.possibleTabs = "Example: resize height 60";
                ConsoleTrack.helpText     = "Choose a height between " + (byte)WorldmapEnum.MinHeight + " and " + (byte)WorldmapEnum.MaxHeight + ". Currently at " + currentHeight + ".";
            }

            else
            {
                return;
            }

            // Activate Resize
            if (ConsoleTrack.activate && curVal > 0)
            {
                WEScene scene = (WEScene)Systems.scene;

                if (currentIns == "width" && curVal >= (byte)WorldmapEnum.MinWidth && curVal <= (byte)WorldmapEnum.MaxWidth)
                {
                    scene.ResizeWidth((byte)curVal);
                }

                else if (currentIns == "height" && curVal >= (byte)WorldmapEnum.MinHeight && curVal <= (byte)WorldmapEnum.MaxHeight)
                {
                    scene.ResizeHeight((byte)curVal);
                }

                else
                {
                    UIHandler.AddNotification(UIAlertType.Error, "Invalid Resize", "Resize must be within the allowed range.", 240);
                }
            }
        }
Esempio n. 15
0
        private static void DebugSpeed()
        {
            string currentIns = ConsoleTrack.GetArgAsString();

            ConsoleTrack.PrepareTabLookup(debugSpeedCodes, currentIns, "Assign a debug speed / tick rate that the game runs at.");

            if (ConsoleTrack.activate)
            {
                if (debugSpeedCodes.ContainsKey(currentIns))
                {
                    DebugConfig.SetTickSpeed((DebugTickSpeed)debugSpeedCodes[currentIns]);
                    return;
                }
            }
        }
Esempio n. 16
0
        public static void SetMusicTrack()
        {
            string currentIns = ConsoleTrack.GetArgAsString();

            // Update the tab lookup.
            ConsoleTrack.PrepareTabLookup(ConsoleEditData.TrackCategory, currentIns, "Choose a music category for the track to play.");

            if (!ConsoleEditData.TrackCategory.ContainsKey(currentIns))
            {
                return;
            }

            EditorScene scene = (EditorScene)Systems.scene;

            // Remove Music From Level
            if (currentIns == "none")
            {
                scene.levelContent.SetMusicTrack(0);
                UIHandler.AddNotification(UIAlertType.Warning, "Removed Music Track", "Level currently has no music assigned.", 240);
                return;
            }

            Dictionary <string, object> trackCat = ConsoleEditData.TrackLookup[currentIns];

            string trackName = ConsoleTrack.GetArgAsString();

            ConsoleTrack.PrepareTabLookup(trackCat, trackName, "Set a music track for the level.");

            if (MusicAssets.TrackNames.ContainsKey(scene.levelContent.data.music))
            {
                ConsoleTrack.helpText += "Currently: \"" + MusicAssets.TrackNames[scene.levelContent.data.music].Replace("Music/", "") + "\".";
            }

            // Activate the Instruction
            if (ConsoleTrack.activate)
            {
                if (trackCat.ContainsKey(trackName))
                {
                    byte track = (byte)trackCat[trackName];
                    scene.levelContent.SetMusicTrack((byte)track);
                    UIHandler.AddNotification(UIAlertType.Success, "Set Music Track", "Music Track set to " + MusicAssets.TrackNames[track].Replace("Music/", "") + ".", 240);
                    return;
                }

                // Prevent Rename if it exceeds name length.
                UIHandler.AddNotification(UIAlertType.Error, "Invalid Music Track", "Designated music track doesn't exist.", 240);
            }
        }
Esempio n. 17
0
        public static void ToEditor()
        {
            string currentIns = ConsoleTrack.GetArgAsString();

            ConsoleTrack.possibleTabs = "Example: `editor 10`";
            ConsoleTrack.helpText     = "Load the level editor for one of your levels.";

            if (ConsoleTrack.activate)
            {
                // Prepare the current level as the default option.
                string levelId = currentIns == "" ? Systems.handler.levelContent.levelId : currentIns;

                // Transition to an Editor Scene
                SceneTransition.ToLevelEditor("", levelId);
            }
        }
Esempio n. 18
0
        //public static readonly Dictionary<string, object> statCodes = new Dictionary<string, object>() {

        //	// Gravity
        //	{ "gravity", "How strong does gravity apply to the character? Default value is 0.5" },

        //	// Abilities
        //	{ "fast-cast", "Is the character able to use weapons and powers faster than usual? Set to TRUE or FALSE." },
        //	{ "shell-mastery", "Is the character given special protection against shell damage? Set to TRUE or FALSE." },
        //	{ "safe-above", "Is the character protected from damage from above? Set to TRUE or FALSE." },
        //	{ "damage-above", "Does the character cause extra damage to objects above? Set to TRUE or FALSE." },

        //	// Wound Stats
        //	{ "maxhealth", "What is the maximum amount of health the character can possess? Default value is 3." },
        //	{ "maxarmor", "What is the maximum amount of armor the character can possess? Default value is 3." },
        //};

        public static void CheatStatWall()
        {
            string currentIns = ConsoleTrack.GetArgAsString();

            ConsoleTrack.PrepareTabLookup(wallStatCodes, currentIns, "Assign wall-related stats for the character.");

            // If the stat instruction is a full word, then we can indicate that it's time to provide additional help text:
            if (wallStatCodes.ContainsKey(currentIns))
            {
                ConsoleTrack.possibleTabs = "";
                ConsoleTrack.helpText     = wallStatCodes[currentIns].ToString();
            }

            if (ConsoleTrack.activate)
            {
                Character character = ConsoleTrack.character;

                // Abilities
                if (currentIns == "can-wall-jump")
                {
                    bool boolVal = ConsoleTrack.GetArgAsBool(); character.stats.CanWallJump = boolVal; character.stats.CanWallSlide = boolVal;
                }
                else if (currentIns == "can-grab")
                {
                    character.stats.CanWallGrab = ConsoleTrack.GetArgAsBool();
                }
                else if (currentIns == "can-slide")
                {
                    character.stats.CanWallSlide = ConsoleTrack.GetArgAsBool();
                }

                // Wall Jumping
                else if (currentIns == "jump-duration")
                {
                    character.stats.WallJumpDuration = (byte)Math.Round(ConsoleTrack.GetArgAsFloat());
                }
                else if (currentIns == "jump-strength")
                {
                    character.stats.WallJumpXStrength = (byte)Math.Round(ConsoleTrack.GetArgAsFloat());
                }
                else if (currentIns == "jump-height")
                {
                    character.stats.WallJumpYStrength = (byte)Math.Round(ConsoleTrack.GetArgAsFloat());
                }
            }
        }
Esempio n. 19
0
        public static void CheatStatJump()
        {
            string currentIns = ConsoleTrack.GetArgAsString();

            ConsoleTrack.PrepareTabLookup(jumpStatCodes, currentIns, "Assign jumping-related stats for the character.");

            // If the stat instruction is a full word, then we can indicate that it's time to provide additional help text:
            if (jumpStatCodes.ContainsKey(currentIns))
            {
                ConsoleTrack.possibleTabs = "";
                ConsoleTrack.helpText     = jumpStatCodes[currentIns].ToString();
            }

            if (ConsoleTrack.activate)
            {
                Character character = ConsoleTrack.character;

                // Air Speed
                if (currentIns == "accel")
                {
                    character.stats.AirAcceleration = FInt.Create(ConsoleTrack.GetArgAsFloat());
                }
                else if (currentIns == "decel")
                {
                    character.stats.AirDeceleration = FInt.Create(ConsoleTrack.GetArgAsFloat());
                }

                // Jumping
                else if (currentIns == "max-jumps")
                {
                    character.stats.JumpMaxTimes = (byte)Math.Round(ConsoleTrack.GetArgAsFloat());
                }
                else if (currentIns == "duration")
                {
                    character.stats.JumpDuration = (byte)Math.Round(ConsoleTrack.GetArgAsFloat());
                }
                else if (currentIns == "height")
                {
                    character.stats.JumpStrength = (byte)Math.Round(ConsoleTrack.GetArgAsFloat());
                }
            }
        }
Esempio n. 20
0
        public static void SetMode()
        {
            string currentIns = ConsoleTrack.GetArgAsString();

            ConsoleTrack.PrepareTabLookup(modeOpts, currentIns, "Set the campaign mode for this world.");

            // If an option is selected:
            if (modeOpts.ContainsKey(currentIns))
            {
                ConsoleTrack.helpText     = modeOpts[currentIns].ToString();
                ConsoleTrack.possibleTabs = "";
            }

            if (ConsoleTrack.activate)
            {
                WEScene scene = (WEScene)Systems.scene;
                UIHandler.AddNotification(UIAlertType.Warning, "Unavailable - Alpha", "These game modes cannot be set during the alpha release.", 300);
                return;
            }
        }
Esempio n. 21
0
        public static void CheatCodeRanged()
        {
            string currentIns = ConsoleTrack.GetArgAsString();

            ConsoleTrack.PrepareTabLookup(rangedWeaponCodes, currentIns, "Assign a ranged weapon to the character; e.g. `power ranged axe`");

            if (ConsoleTrack.activate)
            {
                UIHandler.AddNotification(UIAlertType.Success, "Weapon Granted", "Granted Ranged Weapon to Character.", 180);

                if (rangedWeaponCodes.ContainsKey(currentIns))
                {
                    byte subType = byte.Parse(rangedWeaponCodes[currentIns].ToString());
                    Power.AssignPower(ConsoleTrack.character, (byte)subType);
                    return;
                }

                // "ranged" was the final valid instruction. Give a random ranged weapon to the character.
                Power.AssignPower(ConsoleTrack.character, (byte)PowerSubType.RandomThrown);
            }
        }
Esempio n. 22
0
        public static void CheatCodeSuit()
        {
            string currentIns = ConsoleTrack.GetArgAsString();

            // Update the tab lookup.
            ConsoleTrack.PrepareTabLookup(suitCodes, currentIns, "Add a suit to the character. Can designate which suit, if desired.");

            // Invoke the Relevant Next Function
            if (suitCodes.ContainsKey(currentIns))
            {
                suitCodes[currentIns].Invoke();
                return;
            }

            // Activate the Instruction
            if (ConsoleTrack.activate)
            {
                // "suit" was the final valid instruction. Give a random suit to the character.
                Suit.AssignToCharacter(ConsoleTrack.character, (byte)SuitSubType.RandomSuit, true);
            }
        }
Esempio n. 23
0
        public static void CheatCodeMagic()
        {
            string currentIns = ConsoleTrack.GetArgAsString();

            ConsoleTrack.PrepareTabLookup(magicCodes, currentIns, "Assign magic power to the character; e.g. `power magic fire`");

            if (ConsoleTrack.activate)
            {
                UIHandler.AddNotification(UIAlertType.Success, "Magic Granted", "Granted Magic Spell to Character.", 180);

                if (magicCodes.ContainsKey(currentIns))
                {
                    byte subType = byte.Parse(magicCodes[currentIns].ToString());
                    Power.AssignPower(ConsoleTrack.character, (byte)subType);
                    return;
                }

                // "wand" was the final valid instruction. Give a random wand to the character.
                Power.AssignPower(ConsoleTrack.character, (byte)PowerSubType.RandomPotion);
            }
        }
Esempio n. 24
0
        public static void CheatCodeSuitBasic()
        {
            string currentIns = ConsoleTrack.GetArgAsString();

            // Update the tab lookup.
            ConsoleTrack.PrepareTabLookup(suitBasicCodes, currentIns, "Add a basic, unpowered suit to the character.");

            // Activate the Instruction
            if (ConsoleTrack.activate)
            {
                // Apply the Suit
                if (suitBasicCodes.ContainsKey(currentIns))
                {
                    byte subType = byte.Parse(suitBasicCodes[currentIns].ToString());
                    Suit.AssignToCharacter(ConsoleTrack.character, (byte)subType, true);
                    return;
                }

                // "suit basic" was the final valid instruction. Give a random suit to the character.
                Suit.AssignToCharacter(ConsoleTrack.character, (byte)SuitSubType.RandomBasic, true);
            }
        }
Esempio n. 25
0
        private static void DebugData()
        {
            string currentIns = ConsoleTrack.GetArgAsString();

            ConsoleTrack.PrepareTabLookup(debugDataCodes, currentIns, "Retrieve helpful debug data.");

            if (debugDataCodes.ContainsKey(currentIns))
            {
                ConsoleTrack.possibleTabs = "";
                ConsoleTrack.helpText     = debugDataCodes[currentIns].ToString();
            }

            Character character = ConsoleTrack.character;

            if (currentIns == "grid")
            {
                ConsoleTrack.helpText = "Character's Grid Coordinates are: " + character.GridX.ToString() + ", " + character.GridY.ToString();
            }
            else if (currentIns == "coords")
            {
                ConsoleTrack.helpText = "Character's Coordinates are: " + character.posX.ToString() + ", " + character.posY.ToString();
            }
        }
Esempio n. 26
0
        public static void CheatCodeSuitWizard()
        {
            string currentIns = ConsoleTrack.GetArgAsString();

            // Update the tab lookup.
            ConsoleTrack.PrepareTabLookup(suitWizardCodes, currentIns, "Add a wizard suit to the character.");

            // Activate the Instruction
            if (ConsoleTrack.activate)
            {
                UIHandler.AddNotification(UIAlertType.Success, "Wizard Suit", "Added Wizard Suit to Character.", 180);

                // Apply the Suit
                if (suitWizardCodes.ContainsKey(currentIns))
                {
                    byte subType = byte.Parse(suitWizardCodes[currentIns].ToString());
                    Suit.AssignToCharacter(ConsoleTrack.character, (byte)subType, true);
                    return;
                }

                // "suit wizard" was the final valid instruction. Give a random suit to the character.
                Suit.AssignToCharacter(ConsoleTrack.character, (byte)SuitSubType.RandomWizard, true);
            }
        }
Esempio n. 27
0
        public static void CheatCodeHat()
        {
            string currentIns = ConsoleTrack.GetArgAsString();

            // Update the tab lookup.
            ConsoleTrack.PrepareTabLookup(hatCodes, currentIns, "Add a hat to the character. Can designate which hat, if desired.");

            // Activate the Instruction
            if (ConsoleTrack.activate)
            {
                UIHandler.AddNotification(UIAlertType.Success, "Hat", "Added Hat to Character.", 180);

                // Apply the Hat
                if (hatCodes.ContainsKey(currentIns))
                {
                    byte subType = byte.Parse(hatCodes[currentIns].ToString());
                    Hat.AssignToCharacter(ConsoleTrack.character, (byte)subType, true);
                    return;
                }

                // "hat" was the final valid instruction. Give a random hat to the character.
                Hat.AssignToCharacter(ConsoleTrack.character, (byte)HatSubType.RandomPowerHat, true);
            }
        }
Esempio n. 28
0
        public static void CheatCodeStats()
        {
            string statIns = ConsoleTrack.GetArgAsString();

            ConsoleTrack.PrepareTabLookup(statCodes, statIns, "Assign stats for the character.");

            // If the stat instruction is a full word, then we can indicate that it's time to provide additional help text:
            if (statCodes.ContainsKey(statIns))
            {
                if (statCodes[statIns] is Action[])
                {
                    (statCodes[statIns] as Action[])[0].Invoke();
                    return;
                }

                ConsoleTrack.possibleTabs = "";
                ConsoleTrack.helpText     = statCodes[statIns].ToString();
            }

            if (ConsoleTrack.activate)
            {
                Character character = ConsoleTrack.character;

                // Reset All Stats
                if (statIns == "reset-all")
                {
                    character.stats.ResetCharacterStats();
                }

                // Gravity
                if (statIns == "gravity")
                {
                    character.stats.BaseGravity = FInt.Create(ConsoleTrack.GetArgAsFloat());
                }

                // Abilities
                else if (statIns == "fast-cast")
                {
                    character.stats.CanFastCast = ConsoleTrack.GetArgAsBool();
                }
                else if (statIns == "shell-mastery")
                {
                    character.stats.ShellMastery = ConsoleTrack.GetArgAsBool();
                }
                else if (statIns == "safe-above")
                {
                    character.stats.SafeVsDamageAbove = ConsoleTrack.GetArgAsBool();
                }
                else if (statIns == "damage-above")
                {
                    character.stats.InflictDamageAbove = ConsoleTrack.GetArgAsBool();
                }

                // Wound Stats
                else if (statIns == "maxhealth")
                {
                    character.wounds.WoundMaximum = (byte)ConsoleTrack.GetArgAsInt();
                }
                else if (statIns == "maxarmor")
                {
                    character.wounds.WoundMaximum = (byte)ConsoleTrack.GetArgAsInt();
                }
            }
        }
Esempio n. 29
0
        public static void DebugMacro()
        {
            string currentIns = ConsoleTrack.GetArgAsString();

            ConsoleTrack.PrepareTabLookup(macroCodes, currentIns, "Save a macro to one of the function keys: F1 - F8.");

            if (macroCodes.ContainsKey(currentIns))
            {
                ConsoleTrack.possibleTabs = "Example: macro f1 \"suit ninja red | hat cowboy\"";
                ConsoleTrack.helpText     = macroCodes[currentIns].ToString();
            }

            // If an invalid macro code was applied, end here. Don't allow any activations to process.
            else
            {
                return;
            }

            if (ConsoleTrack.activate)
            {
                string insText = ConsoleTrack.instructionText.ToLower().Trim();

                int index1 = insText.IndexOf('"') + 1;
                int index2 = insText.IndexOf('"', index1);

                // Only continue if there are quotes present (must encapsulate the macro in quotes)
                if (index1 < 0 || index2 <= index1)
                {
                    return;
                }

                // Get the macro substring:
                string macroStr = insText.Substring(index1, index2 - index1);

                // Apply the macro to the appropriate function:
                if (currentIns == "f1")
                {
                    Systems.settings.input.macroF1 = macroStr;
                }
                else if (currentIns == "f2")
                {
                    Systems.settings.input.macroF2 = macroStr;
                }
                else if (currentIns == "f3")
                {
                    Systems.settings.input.macroF3 = macroStr;
                }
                else if (currentIns == "f4")
                {
                    Systems.settings.input.macroF4 = macroStr;
                }
                else if (currentIns == "f5")
                {
                    Systems.settings.input.macroF5 = macroStr;
                }
                else if (currentIns == "f6")
                {
                    Systems.settings.input.macroF6 = macroStr;
                }
                else if (currentIns == "f7")
                {
                    Systems.settings.input.macroF7 = macroStr;
                }
                else if (currentIns == "f8")
                {
                    Systems.settings.input.macroF8 = macroStr;
                }
                else
                {
                    return;
                }

                // Save the macro into the new settings.
                Systems.settings.input.SaveSettings();
            }
        }
Esempio n. 30
0
        public static void SaveState()
        {
            string currentIns = ConsoleTrack.GetArgAsString();

            ConsoleTrack.PrepareTabLookup(autoSave, currentIns, "Save the level state to a macro key.");

            if (ConsoleTrack.activate)
            {
                // Get My Character
                Character character = (Character)Systems.localServer.MyCharacter;
                if (character == null)
                {
                    return;
                }

                // Get Macro Strings
                string headStr = character.head is Head ? "head " + character.head.subStr + " " + character.head.subStr + " | " : "";
                string suitStr = character.suit is Suit ? "suit " + character.suit.baseStr + " " + character.suit.subStr + " | " : "";
                string hatStr  = "hat " + (character.hat is Hat ? character.hat.subStr : "none") + " | ";
                string mobStr  = "power mobility " + (character.mobilityPower is PowerMobility ? character.mobilityPower.subStr : "none") + " | ";
                string attStr  = "power " + (character.attackPower is PowerAttack ? character.attackPower.baseStr + " " + character.attackPower.subStr : "none") + " | ";

                string healthStr = "health " + character.wounds.Health + " | ";
                string armorStr  = "armor " + character.wounds.Armor + " | ";

                // Get the macro substring:
                string macroStr = headStr + suitStr + hatStr + mobStr + attStr + healthStr + armorStr + " move room " + character.room.roomID + " " + character.posX + " " + character.posY;

                DebugConfig.AddDebugNote(macroStr);

                // Apply the macro to the appropriate function:
                if (currentIns == "f1")
                {
                    Systems.settings.input.macroF1 = macroStr;
                }
                else if (currentIns == "f2")
                {
                    Systems.settings.input.macroF2 = macroStr;
                }
                else if (currentIns == "f3")
                {
                    Systems.settings.input.macroF3 = macroStr;
                }
                else if (currentIns == "f4")
                {
                    Systems.settings.input.macroF4 = macroStr;
                }
                else if (currentIns == "f5")
                {
                    Systems.settings.input.macroF5 = macroStr;
                }
                else if (currentIns == "f6")
                {
                    Systems.settings.input.macroF6 = macroStr;
                }
                else if (currentIns == "f7")
                {
                    Systems.settings.input.macroF7 = macroStr;
                }
                else if (currentIns == "f8")
                {
                    Systems.settings.input.macroF8 = macroStr;
                }
                else
                {
                    return;
                }

                // Save the macro into the new settings.
                Systems.settings.input.SaveSettings();
            }
        }