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(); } } }
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()); } } }
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); } }
public void ProcessInstruction(string insText) { // Clean the instruction text. string cleanText = insText.Trim().ToLower(); // If there is no instruction text, no need to continue. if (cleanText.Length == 0) { ConsoleTrack.tabLookup = string.Empty; return; } // If there was a pipe, split into multiple instructions UNLESS the instruction starts with "macro" if (insText.Contains('|') && !cleanText.StartsWith("macro")) { string[] multiInstructions = insText.Split('|'); // If we're activating the instructions, run all of them. if (ConsoleTrack.activate) { foreach (string ins in multiInstructions) { this.ProcessInstruction(ins); } } // If we're not activating the instructions, only run the last pipe (since we only need to identify that one). else { this.ProcessInstruction(multiInstructions.Last()); } return; } // Load Console Track Information ConsoleTrack.LoadInstructionText(cleanText); // Must have at least one part for a valid instruction. if (ConsoleTrack.instructionList.Count < 1) { return; } string currentIns = ConsoleTrack.GetArg(); // Assign Default Character and Player ConsoleTrack.player = Systems.localServer.MyPlayer; ConsoleTrack.character = Systems.localServer.MyCharacter; // Update the tab lookup. ConsoleTrack.PrepareTabLookup(this.consoleDict, currentIns, this.baseHelperText); // Invoke the Relevant Next Function if (this.consoleDict.ContainsKey(currentIns)) { this.consoleDict[currentIns].Invoke(); } }
public void Open() { UIHandler.SetMenu(this, true); ConsoleTrack.ResetValues(); ConsoleTrack.PrepareTabLookup(this.consoleDict, "", this.baseHelperText); if (!this.beenOpened) { this.OnFirstOpen(); } this.OnOpen(); }
public static void CheatCodeWound() { ConsoleTrack.PrepareTabLookup("Causes a standard wound. Deals 1 health damage."); // Activate the Instruction if (ConsoleTrack.activate) { UIHandler.AddNotification(UIAlertType.Warning, "Damage Inflicted", "Recieved 1 Wound Damage.", 180); ConsoleTrack.character.wounds.ReceiveWoundDamage(DamageStrength.Standard); } }
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. } }
public static void CheatCodeKill() { ConsoleTrack.PrepareTabLookup("Kills the character."); // Activate the Instruction if (ConsoleTrack.activate) { UIHandler.AddNotification(UIAlertType.Warning, "Killed Self", "Character chose to respawn.", 180); ConsoleTrack.character.wounds.ReceiveWoundDamage(DamageStrength.InstantKill); } }
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); } }
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); } }
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; } }
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; } }
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; } }
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; } }
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; } }
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); } }
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); } } }
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; } } }
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); } }
//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()); } } }
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()); } } }
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; } }
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); } }
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); } }
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); } }
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); } }
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(); } }
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); } }
public void ScrollConsoleText(sbyte scrollAmount) { this.lineNum += scrollAmount; // If the scroll is less than 0, we're in the Console UP set: if (this.lineNum < 0) { byte num = (byte)Math.Abs(this.lineNum); if (num > this.consoleLines.Count) { num = (byte)this.consoleLines.Count; } ConsoleTrack.instructionText = num > 0 ? this.consoleLines.ElementAt(num - 1) : ""; this.lineNum = (sbyte)-num; } // If the scroll value is greater than 0, we're in the Console DOWN set: else if (this.lineNum > 0) { this.lineNum = (sbyte)Math.Min((byte)5, this.lineNum); ConsoleTrack.instructionText = Systems.settings.input.consoleDown[this.lineNum - 1]; if (ConsoleTrack.instructionText == null) { ConsoleTrack.instructionText = ""; } ConsoleTrack.PrepareTabLookup(this.consoleDict, ConsoleTrack.instructionText, "Console Save Slot #" + this.lineNum); } // If the scroll value is 0, we've returned to the default / entry point for the Console line: else { ConsoleTrack.instructionText = ""; ConsoleTrack.PrepareTabLookup(this.consoleDict, "", this.baseHelperText); } }
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); } }