public ScreenSettingsMenu(GameStructure i_Game, GameScreen i_GameScreen) : base(i_Game, i_GameScreen) { m_FullScreen = new MultiItem(i_Game, "Off", "On") { FunctionToExecute = i_Game.GraphicsDeviceManager.ToggleFullScreen, MainText = "Full Screen Mode:" }; m_MouseVisability = new MultiItem(i_Game, "Invisible", "Visible") { FunctionToExecute = () => { Game.IsMouseVisible = !Game.IsMouseVisible; }, MainText = "Mouse Visability:" }; m_WindowResizing = new MultiItem(i_Game, "Off", "On") { FunctionToExecute = () => { i_Game.Window.AllowUserResizing = !i_Game.Window.AllowUserResizing; }, MainText = "Allow Window Resizing:" }; m_Done = new MenuItem(i_Game) { FunctionToExecute = GoToMainMenu, Text = "Done" }; Add(m_FullScreen); Add(m_MouseVisability); Add(m_WindowResizing); Add(m_Done); }
private string constructEquipmentDescription(EquipmentItem input) { string output = ""; if (input is Weapon) { output = EquipmentFormatter.formatWeaponDescription(input as Weapon); } else if (input is Armor) { output = EquipmentFormatter.formatArmorDescription(input as Armor); } else if (input is Pack) { Pack item = input as Pack; output = item.Content; } else if (input is MultiItem) { MultiItem multiItem = input as MultiItem; foreach (EquipmentItem item in multiItem.Items) { if (!string.IsNullOrEmpty(output)) { output += Environment.NewLine; output += Environment.NewLine; } output += constructEquipmentDescription(item); } } return(output); }
private static bool InsertToQueue(IReadOnlyCollection <Item> items, VillagerRequest?vr, string display, string username, ulong id, bool sub, bool cat, out string msg) { if (!InternalItemTool.CurrentInstance.IsSane(items)) { msg = $"@{username} - You are attempting to order items that will damage your save. Order not accepted."; return(false); } var multiOrder = new MultiItem(items.ToArray(), cat, true, true); var tq = new TwitchQueue(multiOrder.ItemArray.Items, vr, display, id, sub); TwitchCrossBot.QueuePool.Add(tq); msg = $"@{username} - I've noted your order, now whisper me any random 3-digit number. Simply type /w @{TwitchCrossBot.BotName.ToLower()} [3-digit number] in this channel! Your order will not be placed in the queue until I get your whisper!"; return(true); }
private List <Armor> getOwnedArmor() { List <Armor> ownedArmor = new List <Armor>(); //find armor in chosen equipment foreach (EquipmentItem item in Choices.ChosenEquipment) { Armor currentArmor = item as Armor; if (currentArmor != null) { ownedArmor.Add(currentArmor); } MultiItem currentMultiItem = item as MultiItem; if (currentMultiItem != null) { foreach (EquipmentItem itemPart in currentMultiItem.Items) { Armor multiArmor = itemPart as Armor; if (multiArmor != null) { if (multiArmor.AC > 0) { ownedArmor.Add(multiArmor); } } } } } //check extra equipment foreach (string entry in Choices.ExtraEquipment.Split(',').ToList()) { Armor currentArmor = DBManager.EquipmentData.getArmor(entry); if (!string.IsNullOrEmpty(currentArmor.Name)) { if (currentArmor.AC > 0) { ownedArmor.Add(currentArmor); } } } return(ownedArmor); }
private List <Weapon> getOwnedWeapons() { List <Weapon> ownedWeapons = new List <Weapon>(); //find weapons in chosen equipment foreach (EquipmentItem item in Choices.ChosenEquipment) { Weapon currentWeapon = item as Weapon; if (currentWeapon != null) { ownedWeapons.Add(currentWeapon); } MultiItem currentMultiItem = item as MultiItem; if (currentMultiItem != null) { foreach (EquipmentItem itemPart in currentMultiItem.Items) { Weapon multiWeapon = itemPart as Weapon; if (multiWeapon != null) { ownedWeapons.Add(multiWeapon); } } } } //get weapons from extra equipment foreach (string entry in Choices.ExtraEquipment.Split(',').ToList()) { string sanitizedWeaponName = Regex.Replace(entry, @"\s\([\d]+\)", "").Trim(); Weapon currentWeapon = DBManager.EquipmentData.getWeapon(sanitizedWeaponName); if (!string.IsNullOrEmpty(currentWeapon.Name)) { currentWeapon.Name = entry; ownedWeapons.Add(currentWeapon); } } return(ownedWeapons); }
public MainMenu(GameStructure i_Game, GameScreen i_GameScreen) : base(i_Game, i_GameScreen) { m_NumOfPlayers = new MultiItem(i_Game, "One", "Two") { FunctionToExecute = notifyNumberOfPlayerChanges, MainText = "Players:" }; m_SoundSettings = new MenuItem(i_Game) { FunctionToExecute = GotoSoundsSettingsMenu, Text = "Sound Settings" }; m_ScreenSettings = new MenuItem(i_Game) { FunctionToExecute = GotoScreenSettingsMenu, Text = "Screen Settings" }; m_Play = new MenuItem(i_Game) { FunctionToExecute = GoToGameScreen, Text = "Play" }; m_Quit = new MenuItem(i_Game) { FunctionToExecute = Game.Exit, Text = "Quit" }; Add(m_NumOfPlayers); Add(m_SoundSettings); Add(m_ScreenSettings); Add(m_Play); Add(m_Quit); }
public MultiComponentList(BinaryFileReader reader, int count) { int metrics_dataread_start = (int)reader.Position; m_Min = m_Max = Point.Empty; Items = new MultiItem[count]; for (int i = 0; i < count; ++i) { Items[i].ItemID = reader.ReadUShort(); Items[i].OffsetX = reader.ReadShort(); Items[i].OffsetY = reader.ReadShort(); Items[i].OffsetZ = reader.ReadShort(); Items[i].Flags = reader.ReadInt(); reader.ReadInt(); if (Items[i].OffsetX < m_Min.X) m_Min.X = Items[i].OffsetX; if (Items[i].OffsetY < m_Min.Y) m_Min.Y = Items[i].OffsetY; if (Items[i].OffsetX > m_Max.X) m_Max.X = Items[i].OffsetX; if (Items[i].OffsetY > m_Max.Y) m_Max.Y = Items[i].OffsetY; } m_Center = new Point(-m_Min.X, -m_Min.Y); m_Width = (m_Max.X - m_Min.X) + 1; m_Height = (m_Max.Y - m_Min.Y) + 1; // SortMultiComponentList(); Metrics.ReportDataRead((int)reader.Position - metrics_dataread_start); }
public static string Drop(string message, ulong id, string username, TwitchConfig tcfg) { if (!tcfg.AllowDropViaTwitchChat) { LogUtil.LogInfo($"{username} is attempting to drop items, however the twitch configuration does not currently allow drop commands", nameof(TwitchCrossBot)); return(string.Empty); } if (!GetDropAvailability(id, username, tcfg, out var error)) { return(error); } var cfg = Globals.Bot.Config; var items = ItemParser.GetItemsFromUserInput(message, cfg.DropConfig, cfg.DropConfig.UseLegacyDrop ? ItemDestination.PlayerDropped : ItemDestination.HeldItem); MultiItem.StackToMax(items); if (!InternalItemTool.CurrentInstance.IsSane(items)) { return($"You are attempting to drop items that will damage your save. Drop request not accepted."); } var MaxRequestCount = cfg.DropConfig.MaxDropCount; var ret = string.Empty; if (items.Count > MaxRequestCount) { ret += $"Users are limited to {MaxRequestCount} items per command. Please use this bot responsibly. "; items = items.Take(MaxRequestCount).ToArray(); } var requestInfo = new ItemRequest(username, items); Globals.Bot.Injections.Enqueue(requestInfo); ret += $"Item drop request{(requestInfo.Item.Count > 1 ? "s" : string.Empty)} will be executed momentarily."; return(ret); }
public SoundsSettingsMenu(GameStructure i_Game, GameScreen i_GameScreen) : base(i_Game, i_GameScreen) { string[] OptionsForVolumeControls = { "0", "10", "20", "30", "40", "50", "60", "70", "80", "90", "100" }; m_BackgroundMusicVol = new MultiItem(i_Game, SetBackgroundMusicVol, OptionsForVolumeControls) { FunctionToExecute = SetBackgroundMusicVol, MainText = "Background Music Volume:", IsLooped = false, CurrenOptionIdx = 5 }; m_SoundsEffectsVol = new MultiItem(i_Game, OptionsForVolumeControls) { FunctionToExecute = SetSoundsEffectsVol, MainText = "Sounds Effects Volume:", IsLooped = false, CurrenOptionIdx = 5 }; m_ToggleSound = new MultiItem(i_Game, "On", "Off") { FunctionToExecute = ToggleSound, MainText = "Toggle Sound:" }; m_Done = new MenuItem(i_Game) { FunctionToExecute = GoToMainMenu, Text = "Done" }; Add(m_BackgroundMusicVol); Add(m_SoundsEffectsVol); Add(m_ToggleSound); Add(m_Done); }
public static MultiItem Load(List <string> values) { MultiItem multiItem = new MultiItem(); multiItem.graphic = new Graphics(ref values, 23); ItemInfo.LoadGeneralSettings1((ItemInfo)multiItem, values); multiItem.Cash = CSVReader.GetInt(values[31]); multiItem.Energy = CSVReader.GetInt(values[32]); multiItem.Health = CSVReader.GetInt(values[33]); multiItem.Repair = CSVReader.GetInt(values[34]); multiItem.Experience = CSVReader.GetInt(values[35]); for (int i = 0; i <= 16; i++) { int value = CSVReader.GetInt(values[36 + i]); multiItem.slots.Add(new Slot(i, value)); } if (multiItem.version >= 53) // Version == field count?? { multiItem.ExpandRadius = CSVReader.GetInt(values[52]); } return(multiItem); }
public static void TestDuplicateVariation(string name, ulong itemValueParse) { var items = ItemParser.GetItemsFromUserInput(itemValueParse.ToString("X"), new DropBotConfig(), ItemDestination.PlayerDropped); items.Count.Should().Be(1); var currentItem = items.ElementAt(0); var multiItem = new MultiItem(new Item[1] { currentItem }); var itemName = GameInfo.Strings.GetItemName(currentItem); itemName.Should().StartWith(name); // variations var remake = ItemRemakeUtil.GetRemakeIndex(currentItem.ItemId); if (remake > 0) { var info = ItemRemakeInfoData.List[remake]; var body = info.GetBodySummary(GameInfo.Strings); var bodyVariations = body.Split(new string[2] { "\n", "\r\n" }, StringSplitOptions.RemoveEmptyEntries); int varCount = bodyVariations.Length; if (!bodyVariations[0].StartsWith("0")) { varCount++; } multiItem.ItemArray.Items[varCount].ItemId.Should().Be(Item.NONE); multiItem.ItemArray.Items[varCount + 1].ItemId.Should().Be(currentItem.ItemId); foreach (var itm in multiItem.ItemArray.Items) { // No leaking associated items if (itm.IsNone) { continue; } var itmName = GameInfo.Strings.GetItemName(itm); itemName.Should().Be(itmName); } } // association var associated = GameInfo.Strings.GetAssociatedItems(currentItem.ItemId, out var itemPrefix); if (associated.Count > 1 && currentItem.ItemId != Item.DIYRecipe) { foreach (var asoc in multiItem.ItemArray.Items) { var asocName = GameInfo.Strings.GetItemName(asoc); asocName.Should().EndWith(")"); } } // everything else if (currentItem.ItemId == Item.DIYRecipe) { foreach (var itm in multiItem.ItemArray.Items) { itm.ItemId.Should().Be(Item.DIYRecipe); } } }
public static List <ItemInfo> Load(string filename) { List <ItemInfo> itemInfo = new List <ItemInfo>(); TextReader reader = new StreamReader(filename); string line = ""; while ((line = reader.ReadLine()) != null) { List <string> values = CSVReader.Parse(line); switch (values[0]) { case "4": Ammo ammo = Ammo.Load(values); BlobsToLoad.Add(ammo.graphic.blobName); itemInfo.Add(ammo); break; case "1": MultiItem multiItem = MultiItem.Load(values); BlobsToLoad.Add(multiItem.graphic.blobName); itemInfo.Add(multiItem); break; case "6": Projectile projectile = Projectile.Load(values); BlobsToLoad.Add(projectile.iconGraphic.blobName); BlobsToLoad.Add(projectile.fireGraphic.blobName); BlobsToLoad.Add(projectile.projectileGraphic.blobName); BlobsToLoad.Add(projectile.shadowGraphic.blobName); BlobsToLoad.Add(projectile.trailGraphic.blobName); BlobsToLoad.Add(projectile.explosionGraphic.blobName); BlobsToLoad.Add(projectile.prefireGraphic.blobName); BlobsToLoad.Add(projectile.firingSound.blobName); BlobsToLoad.Add(projectile.explosionSound.blobName); BlobsToLoad.Add(projectile.bounceSound.blobName); BlobsToLoad.Add(projectile.prefireSound.blobName); itemInfo.Add(projectile); break; case "7": VehicleMaker vehicleMaker = VehicleMaker.Load(values); BlobsToLoad.Add(vehicleMaker.prefireSound.blobName); BlobsToLoad.Add(vehicleMaker.prefireGraphic.blobName); BlobsToLoad.Add(vehicleMaker.iconGraphic.blobName); itemInfo.Add(vehicleMaker); break; case "8": MultiUse multiUse = MultiUse.Load(values); BlobsToLoad.Add(multiUse.prefireGraphic.blobName); BlobsToLoad.Add(multiUse.firingSound.blobName); BlobsToLoad.Add(multiUse.prefireSound.blobName); BlobsToLoad.Add(multiUse.iconGraphic.blobName); itemInfo.Add(multiUse); break; case "11": RepairItem repair = RepairItem.Load(values); BlobsToLoad.Add(repair.iconGraphic.blobName); BlobsToLoad.Add(repair.prefireGraphic.blobName); BlobsToLoad.Add(repair.repairGraphic.blobName); BlobsToLoad.Add(repair.prefireSound.blobName); BlobsToLoad.Add(repair.repairSound.blobName); itemInfo.Add(repair); break; case "15": UpgradeItem upgrade = UpgradeItem.Load(values); BlobsToLoad.Add(upgrade.iconGraphic.blobName); itemInfo.Add(upgrade); break; case "12": ControlItem control = ControlItem.Load(values); BlobsToLoad.Add(control.iconGraphic.blobName); BlobsToLoad.Add(control.prefireGraphic.blobName); BlobsToLoad.Add(control.effectGraphic.blobName); BlobsToLoad.Add(control.prefireSound.blobName); BlobsToLoad.Add(control.firingSound.blobName); itemInfo.Add(control); break; case "13": UtilityItem utility = UtilityItem.Load(values); BlobsToLoad.Add(utility.iconGraphic.blobName); BlobsToLoad.Add(utility.activateSound.blobName); itemInfo.Add(utility); break; case "17": WarpItem warp = WarpItem.Load(values); BlobsToLoad.Add(warp.iconGraphic.blobName); BlobsToLoad.Add(warp.prefireGraphic.blobName); BlobsToLoad.Add(warp.warpGraphic.blobName); BlobsToLoad.Add(warp.prefireSound.blobName); BlobsToLoad.Add(warp.warpSound.blobName); itemInfo.Add(warp); break; case "16": SkillItem skill = SkillItem.Load(values); BlobsToLoad.Add(skill.iconGraphic.blobName); itemInfo.Add(skill); break; case "14": ItemMaker item = ItemMaker.Load(values); BlobsToLoad.Add(item.prefireGraphic.blobName); BlobsToLoad.Add(item.prefireSound.blobName); BlobsToLoad.Add(item.iconGraphic.blobName); itemInfo.Add(item); break; case "18": NestedItem nested = NestedItem.Load(values); FilesToLoad.Add(nested.location); itemInfo.Add(nested); break; case "default": //F**k you, you idiot. use Log.write //Console.WriteLine("If you see this Toriad f****d up"); break; } } return(itemInfo); }
private MultiComponentList() { Items = new MultiItem[0]; }
/// <summary> /// gets a list of available choices for the specified parameters /// </summary> /// <param name="subrace">chosen subrace</param> /// <param name="className">chosen class</param> /// <param name="subclass">chosen subclass</param> /// <param name="choice">which set of options should be returned</param> /// <param name="strength">character's strength</param> public List <EquipmentItem> getEquipmentChoices(string subrace, string className, string subclass, int choice, int strength) { List <EquipmentItem> outputList = new List <EquipmentItem>(); if (choice <= getEquipmentChoiceAmount(className)) { //Barbarian if (className == "Barbarian") { if (choice == 1) { outputList.AddRange(getWeaponList("martial", "melee").ToArray()); } if (choice == 2) { outputList.AddRange(getWeaponList("simple", "*").ToArray()); outputList[outputList.FindIndex(item => item.Name.Equals("handaxe"))].Name = "handaxe (2)"; } } //Bard if (className == "Bard") { if (choice == 1) { outputList.Add(getWeapon("rapier")); outputList.Add(getWeapon("longsword")); outputList.AddRange(getWeaponList("simple", "*").ToArray()); } if (choice == 2) { outputList.AddRange(getPackChoices(className)); } if (choice == 3) { outputList.AddRange(getToolList("musical instrument").ToArray()); } } //Cleric if (className == "Cleric") { if (choice == 1) { outputList.AddRange(getWeaponList("mace").ToArray()); if ((subrace == "Hill Dwarf") || (subrace == "Mountain Dwarf") || (subclass == "Tempest Domain") || (subclass == "War Domain")) { outputList.AddRange(getWeaponList("warhammer").ToArray()); } } if (choice == 2) { outputList.Add(getArmor("scale mail armor")); outputList.Add(getArmor("leather armor")); Armor armorForStrengthCheck = getArmor("chain mail armor"); if (strength > armorForStrengthCheck.StrengthRequirement) { if ((subclass == "Life Domain") || (subclass == "Nature Domain") || (subclass == "Tempest Domain") || (subclass == "War Domain")) { outputList.Add(armorForStrengthCheck); } } } if (choice == 3) { outputList.Add(getWeapon("light crossbow")); outputList.AddRange(getWeaponList("simple", "*").ToArray()); } if (choice == 4) { outputList.AddRange(getPackChoices(className).ToArray()); } } //Druid if (className == "Druid") { if (choice == 1) { outputList.AddRange(getWeaponList("simple", "*").ToArray()); outputList.Add(getArmor("shield")); } if (choice == 2) { outputList.Add(getWeapon("scimitar")); outputList.AddRange(getWeaponList("simple", "melee").ToArray()); } } //Fighter if (className == "Fighter") { if (choice == 1) { Armor armorForStrengthCheck = getArmor("chain mail armor"); if (strength > armorForStrengthCheck.StrengthRequirement) { outputList.Add(armorForStrengthCheck); } MultiItem multiItem = new MultiItem(); multiItem.addItem(getArmor("leather armor")); multiItem.addItem(getWeapon("longbow")); outputList.Add(multiItem); } if (choice == 2) { outputList.AddRange(getWeaponList("martial", "*").ToArray()); outputList.Add(getArmor("shield")); } if (choice == 3) { outputList.Add(getWeapon("light crossbow")); outputList.Add(getWeapon("handaxe")); outputList[outputList.FindIndex(item => item.Name.Equals("handaxe"))].Name = "handaxe (2)"; } if (choice == 4) { outputList.AddRange(getPackChoices(className).ToArray()); } } //Monk if (className == "Monk") { if (choice == 1) { outputList.Add(getWeapon("shortsword")); outputList.AddRange(getWeaponList("simple", "*").ToArray()); } if (choice == 2) { outputList.AddRange(getPackChoices(className).ToArray()); } } //Paladin if (className == "Paladin") { if (choice == 1) { outputList.AddRange(getWeaponList("simple", "melee").ToArray()); outputList[outputList.FindIndex(item => item.Name.Equals("javelin"))].Name = "javelin (5)"; } if (choice == 2) { outputList.AddRange(getWeaponList("martial", "*").ToArray()); outputList.Add(getArmor("shield")); } if (choice == 3) { outputList.AddRange(getPackChoices(className).ToArray()); } } //Ranger if (className == "Ranger") { if (choice == 1) { outputList.Add(getArmor("scale mail armor")); outputList.Add(getArmor("leather armor")); } if (choice == 2) { outputList.Add(getWeapon("shortsword")); outputList.AddRange(getWeaponList("simple", "melee").ToArray()); } if (choice == 3) { outputList.AddRange(getPackChoices(className).ToArray()); } } //Rogue if (className == "Rogue") { if (choice == 1) { outputList.Add(getWeapon("rapier")); outputList.Add(getWeapon("shortsword")); } if (choice == 2) { outputList.Add(getWeapon("shortbow")); outputList.Add(getWeapon("shortsword")); } if (choice == 3) { outputList.AddRange(getPackChoices(className).ToArray()); } } //Sorcerer if (className == "Sorcerer") { if (choice == 1) { outputList.Add(getWeapon("light crossbow")); outputList.AddRange(getWeaponList("simple", "*").ToArray()); } if (choice == 2) { outputList.AddRange(getToolList("arcane tool").ToArray()); } if (choice == 3) { outputList.AddRange(getPackChoices(className).ToArray()); } } //Warlock if (className == "Warlock") { if (choice == 1) { outputList.Add(getWeapon("light crossbow")); outputList.AddRange(getWeaponList("simple", "*").ToArray()); } if (choice == 2) { outputList.AddRange(getToolList("arcane tool").ToArray()); } if (choice == 3) { outputList.AddRange(getPackChoices(className).ToArray()); } } //Wizard if (className == "Wizard") { if (choice == 1) { outputList.Add(getWeapon("quarterstaff")); outputList.Add(getWeapon("dagger")); } if (choice == 2) { outputList.AddRange(getToolList("arcane tool").ToArray()); } if (choice == 3) { outputList.AddRange(getPackChoices(className).ToArray()); } } } return(outputList); }