示例#1
0
        public static void ResizeHeight()
        {
            EditorRoomScene scene         = ((EditorScene)Systems.scene).CurrentRoom;
            int             currentHeight = scene.yCount;

            ConsoleTrack.possibleTabs = "Example: `resize height 180`";
            ConsoleTrack.helpText     = "Resize the level's height between " + (byte)TilemapEnum.MinHeight + " and " + (short)TilemapEnum.MaxTilesHigh + ". Currently at " + currentHeight + ".";

            // Prepare Height
            int getHeight = ConsoleTrack.GetArgAsInt();

            // Activate the Instruction
            if (ConsoleTrack.activate)
            {
                if (getHeight < (byte)TilemapEnum.MinHeight)
                {
                    getHeight = (byte)TilemapEnum.MinHeight;
                }
                if (getHeight > (short)TilemapEnum.MaxTilesHigh)
                {
                    getHeight = (short)TilemapEnum.MaxTilesHigh;
                }
                scene.ResizeHeight((short)getHeight);
            }
        }
示例#2
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);
            }
        }
示例#3
0
        public static void ResizeWidth()
        {
            EditorRoomScene scene        = ((EditorScene)Systems.scene).CurrentRoom;
            int             currentWidth = scene.xCount;

            ConsoleTrack.possibleTabs = "Example: `resize width 250`";
            ConsoleTrack.helpText     = "Resize the level's width between " + (byte)TilemapEnum.MinWidth + " and " + (short)TilemapEnum.MaxTilesWide + ". Currently at " + currentWidth + ".";

            // Prepare Width
            int getWidth = ConsoleTrack.GetArgAsInt();

            // Activate the Instruction
            if (ConsoleTrack.activate)
            {
                if (getWidth < (byte)TilemapEnum.MinWidth)
                {
                    getWidth = (byte)TilemapEnum.MinWidth;
                }
                if (getWidth > (short)TilemapEnum.MaxTilesWide)
                {
                    getWidth = (short)TilemapEnum.MaxTilesWide;
                }
                scene.ResizeWidth((short)getWidth);
            }
        }
示例#4
0
        public static void SetLevel()
        {
            byte gridX = (byte)ConsoleTrack.GetArgAsInt();

            ConsoleTrack.possibleTabs = "Example: setLevel 10 10 MyLevelID";

            // If gridX is assigned:
            if (ConsoleTrack.instructionList.Count >= 2)
            {
                byte gridY = (byte)ConsoleTrack.GetArgAsInt();

                // If gridY is assigned:
                if (ConsoleTrack.instructionList.Count >= 3)
                {
                    // Check if this X, Y grid is valid (has a node at it).
                    WEScene         scene  = (WEScene)Systems.scene;
                    WorldZoneFormat zone   = scene.currentZone;
                    byte[]          wtData = scene.worldContent.GetWorldTileData(zone, gridX, gridY);

                    // If the location is a valid node, we can attempt to add a level ID.
                    if (NodeData.IsObjectANode(wtData[5], false, false, true))
                    {
                        string coordStr = Coords.MapToInt(gridX, gridY).ToString();
                        string levelId  = ConsoleTrack.GetArg();
                        ConsoleTrack.helpText = "Assign a level ID to the specified node.";

                        if (zone.nodes.ContainsKey(coordStr))
                        {
                            ConsoleTrack.helpText += " Current level ID is: " + zone.nodes[coordStr];
                        }

                        // If the console was activated:
                        if (ConsoleTrack.activate)
                        {
                            zone.nodes[coordStr] = levelId;
                            return;
                        }
                    }

                    // If the location is invalid:
                    else
                    {
                        ConsoleTrack.helpText = "WARNING! There is not a level node at " + gridX.ToString() + ", " + gridY.ToString();
                    }
                }

                // If gridY has not been assigned:
                else
                {
                    ConsoleTrack.helpText = "Assign a level ID to a node at the specified X, Y coordinate. Enter the Y position.";
                }
            }

            // If gridX has not been assigned:
            else
            {
                ConsoleTrack.helpText = "Assign a level ID to a node at the specified X, Y coordinate. Enter the X position.";
            }
        }
示例#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.
            }
        }
示例#6
0
        public static void CheatCodeHealth()
        {
            ConsoleTrack.PrepareTabLookup("Assign a given number of health (e.g. 'health 2'). Default is max health.");

            // Activate the Instruction
            if (ConsoleTrack.activate)
            {
                byte health = ConsoleTrack.instructionList.Count >= 2 ? (byte)ConsoleTrack.GetArgAsInt() : (byte)100;
                UIHandler.AddNotification(UIAlertType.Success, "Health Granted", "Granted " + health + " Health to Character.", 180);
                ConsoleTrack.character.wounds.SetHealth(health);
            }
        }
示例#7
0
        public static void CheatCodeInvincible()
        {
            ConsoleTrack.PrepareTabLookup("Grant invincibility for X seconds (e.g. 'invincible 30'). Default is 60 seconds.");

            // Activate the Instruction
            if (ConsoleTrack.activate)
            {
                int duration = ConsoleTrack.instructionList.Count >= 2 ? (byte)ConsoleTrack.GetArgAsInt() : 60;
                UIHandler.AddNotification(UIAlertType.Success, "Invincibility Granted", "Granted Invincibility for " + duration + " Seconds.", 180);
                ConsoleTrack.character.wounds.SetInvincible(duration * 60);
            }
        }
示例#8
0
        public static void CheatCodeArmor()
        {
            ConsoleTrack.PrepareTabLookup("Assign a given number of armor (e.g. 'armor 2'). Default is max armor.");

            // Activate the Instruction
            if (ConsoleTrack.activate)
            {
                byte armor = ConsoleTrack.instructionList.Count >= 2 ? (byte)ConsoleTrack.GetArgAsInt() : (byte)100;
                UIHandler.AddNotification(UIAlertType.Success, "Armor Granted", "Granted " + armor + " Armor to Character.", 180);
                ConsoleTrack.character.wounds.SetArmor(armor);
            }
        }
示例#9
0
        public static void ConsoleTeleportCoords()
        {
            ConsoleTrack.possibleTabs = "Example: `move coords 5000 450`";
            ConsoleTrack.helpText     = "The exact coordinates (e.g. \"5000, 450\") to teleport to.";

            int x = ConsoleTrack.GetArgAsInt();
            int y = ConsoleTrack.GetArgAsInt();

            if (ConsoleTrack.activate && x > 0 && y > 0)
            {
                Character.Teleport(ConsoleTrack.character, x, y);
            }
        }
示例#10
0
        public static void ConsoleTeleportRoom()
        {
            ConsoleTrack.possibleTabs = "Example: `move room 2 500 300`";
            ConsoleTrack.helpText     = "The Room ID, X Coordinate, Y Coordinate to teleport to.";

            byte roomID = (byte)ConsoleTrack.GetArgAsInt();
            int  x      = ConsoleTrack.GetArgAsInt();
            int  y      = ConsoleTrack.GetArgAsInt();

            if (ConsoleTrack.activate && x > 0 && y > 0)
            {
                ActionMap.Transport.StartAction(ConsoleTrack.character, roomID, x, y);
            }
        }
示例#11
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);
                }
            }
        }
示例#12
0
        public static void SetLives()
        {
            short   lives = (short)ConsoleTrack.GetArgAsInt();
            WEScene scene = (WEScene)Systems.scene;

            ConsoleTrack.possibleTabs = "Example: `lives 50`";
            ConsoleTrack.helpText     = "Set the number of lives you start with: 1 to 500. Currently: " + scene.worldData.lives;

            if (ConsoleTrack.activate)
            {
                if (lives < 1 || lives > 500)
                {
                    UIHandler.AddNotification(UIAlertType.Error, "Invalid Lives", "Lives must be set between 1 and 500.", 240);
                    return;
                }

                scene.worldContent.data.lives = lives;
                UIHandler.AddNotification(UIAlertType.Success, "Lives Set", "World campaign assigned to have \"" + lives + "\" lives.", 240);
            }
        }
示例#13
0
        public static void SetTimeLimit()
        {
            ConsoleTrack.possibleTabs = "Example: `time 400`";
            ConsoleTrack.helpText     = "Set the Time Limit (in seconds) for the level. Minimum 10, Maximum 500.";

            // Prepare Height
            short seconds = (short)ConsoleTrack.GetArgAsInt();

            // Activate the Instruction
            if (ConsoleTrack.activate)
            {
                // Prevent Rename if it exceeds name length.
                if (seconds < 10 || seconds > 500)
                {
                    UIHandler.AddNotification(UIAlertType.Error, "Invalid Time Limit", "Time Limit must be between 10 and 500 seconds.", 240);
                    return;
                }

                ((EditorScene)Systems.scene).levelContent.SetTimeLimit(seconds);
                UIHandler.AddNotification(UIAlertType.Success, "New Time Limit", "Time Limit set to " + seconds + ".", 240);
            }
        }
示例#14
0
        public static void ResizeCustom()
        {
            int currentWidth  = ((EditorRoomScene)Systems.scene).xCount;
            int currentHeight = ((EditorRoomScene)Systems.scene).yCount;

            ConsoleTrack.possibleTabs = "Example: `resize custom 100 35`";
            ConsoleTrack.helpText     = "Resize a room to be a custom width and height (in that order). Currently at " + currentWidth + ", " + currentHeight + ".";

            // Prepare Height
            int getWidth  = ConsoleTrack.GetArgAsInt();
            int getHeight = ConsoleTrack.GetArgAsInt();

            // Activate the Instruction
            if (ConsoleTrack.activate)
            {
                if (getWidth < (byte)TilemapEnum.MinWidth)
                {
                    getWidth = (byte)TilemapEnum.MinWidth;
                }
                if (getWidth > (short)TilemapEnum.MaxTilesWide)
                {
                    getWidth = (short)TilemapEnum.MaxTilesWide;
                }
                if (getHeight < (byte)TilemapEnum.MinHeight)
                {
                    getHeight = (byte)TilemapEnum.MinHeight;
                }
                if (getHeight > (short)TilemapEnum.MaxTilesHigh)
                {
                    getHeight = (short)TilemapEnum.MaxTilesHigh;
                }
                EditorRoomScene scene = ((EditorScene)Systems.scene).CurrentRoom;
                scene.ResizeHeight((short)getWidth);
                scene.ResizeWidth((short)getHeight);
            }
        }
示例#15
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();
                }
            }
        }
示例#16
0
        public static void SetWarp()
        {
            byte gridX = (byte)ConsoleTrack.GetArgAsInt();

            ConsoleTrack.possibleTabs = "Example: setWarp 10 10 1";

            // If gridX is assigned:
            if (ConsoleTrack.instructionList.Count >= 2)
            {
                byte gridY = (byte)ConsoleTrack.GetArgAsInt();

                // If gridY is assigned:
                if (ConsoleTrack.instructionList.Count >= 3)
                {
                    // Check if this X, Y grid is a valid warp.
                    WEScene         scene  = (WEScene)Systems.scene;
                    WorldZoneFormat zone   = scene.currentZone;
                    byte[]          wtData = scene.worldContent.GetWorldTileData(zone, gridX, gridY);

                    // If the location is a valid node, we can attempt to add a level ID.
                    if (NodeData.IsObjectAWarp(wtData[5]))
                    {
                        string coordStr = Coords.MapToInt(gridX, gridY).ToString();
                        byte   linkID   = (byte)ConsoleTrack.GetArgAsInt();
                        ConsoleTrack.helpText = "Assign a warp link ID (1-20). Teleports to a warp with the same warp link ID.";

                        if (zone.nodes.ContainsKey(coordStr))
                        {
                            byte getLinkId;
                            byte.TryParse(zone.nodes[coordStr].Replace("_warp", ""), out getLinkId);
                            ConsoleTrack.helpText += " Currently: " + getLinkId;
                        }

                        // If the console was activated:
                        if (ConsoleTrack.activate)
                        {
                            // Error if the values aren't allowed:
                            if (linkID < 1 || linkID > 20)
                            {
                                UIHandler.AddNotification(UIAlertType.Error, "Invalid Warp Link", "Warp Link ID must be set between 1 and 20.", 240);
                                return;
                            }

                            UIHandler.AddNotification(UIAlertType.Success, "Warp Set", "Warp Link ID assigned as " + linkID.ToString() + ".", 240);
                            zone.nodes[coordStr] = "_warp" + linkID.ToString();
                            return;
                        }
                    }

                    // If the location is invalid:
                    else
                    {
                        ConsoleTrack.helpText = "WARNING! There is not a warp at " + gridX.ToString() + ", " + gridY.ToString();
                    }
                }

                // If gridY has not been assigned:
                else
                {
                    ConsoleTrack.helpText = "Assign a link ID to a warp at the specified X, Y coordinate. Enter the Y position.";
                }
            }

            // If gridX has not been assigned:
            else
            {
                ConsoleTrack.helpText = "Assign a link ID to a warp at the specified X, Y coordinate. Enter the X position.";
            }
        }