static Buff() { Buff buff; string uri = "/TerrariViewer;component/TerrariaObjects/Data/Buffs.txt"; using (StreamReader reader = new StreamReader(Application.GetResourceStream(new Uri(uri, UriKind.RelativeOrAbsolute)).Stream)) { while (!reader.EndOfStream) { try { buff = new Buff(); string line = reader.ReadLine(); string[] parts = line.Split('\t'); buff.Id = int.Parse(parts[0]); buff.Name = parts[1]; buff.maxDuration = int.Parse(parts[3]); buff.BuffImage(); BuffDictionary[int.Parse(parts[0])] = buff; } catch { continue; } } } }
private bool HandleFilter(Buff info) { string targetName = info.Name.ToLowerInvariant(); foreach (string filterPart in filterParts) { if (targetName.IndexOf(filterPart, StringComparison.OrdinalIgnoreCase) >= 0) { return true; } } return false; }
private void HandleItemsSourceChange() { object currentSelected = Buff_List.SelectedValue; if (currentSelected == null) { currentSelected = lastValidBuff; } else { lastValidBuff = currentSelected as Buff; } Buff_List.ItemsSource = buffsSource; Buff_List.SelectedValue = currentSelected; }
public Player() { Armor = new Item[3]; for (int i = 0; i < Armor.Length; i++) { Armor[i] = new Item(); } Accessories = new Item[5]; for (int i = 0; i < Accessories.Length; i++) { Accessories[i] = new Item(); } Vanity = new Item[3]; for (int i = 0; i < Vanity.Length; i++) { Vanity[i] = new Item(); } Inventory = new Item[40]; for (int i = 0; i < Inventory.Length; i++) { Inventory[i] = new Item(); } Coins = new Item[4]; for (int i = 0; i < Coins.Length; i++) { Coins[i] = new Item(); } Ammo = new Item[4]; for (int i = 0; i < Ammo.Length; i++) { Ammo[i] = new Item(); } Bank = new Item[20]; for (int i = 0; i < Bank.Length; i++) { Bank[i] = new Item(); } Safe = new Item[20]; for (int i = 0; i < Safe.Length; i++) { Safe[i] = new Item(); } Buffs = new Buff[10]; for (int i = 0; i < Buffs.Length; i++) { Buffs[i] = new Buff(); } spX = new int[200]; spY = new int[200]; spI = new int[200]; spN = new string[200]; for (int i = 0; i < 200; i++) { spN[i] = ""; } }
private void BuffList_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (Buff_List.SelectedValue == null) return; Buff selected = Buff_List.SelectedValue as Buff; if (selected == null) return; if (selected.Id == 0) { buff.GameDuration = 0; buff.Name = "No Buff"; } else { buff.GameDuration = Buff.BuffDictionary[selected.Id].MaxDuration; buff.Name = Buff.BuffDictionary[selected.Id].Name; } lastValidBuff = selected; }
private void UserControl_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e) { buff = this.DataContext as Buff; }
public Player() { Armor = new Item[3]; for (int i = 0; i < Armor.Length; i++) { Armor[i] = new Item(); } Accessories = new Item[5]; for (int i = 0; i < Accessories.Length; i++) { Accessories[i] = new Item(); } Vanity = new Item[3]; for (int i = 0; i < Vanity.Length; i++) { Vanity[i] = new Item(); } Dye = new Item[3]; for (int i = 0; i < Dye.Length; i++) { Dye[i] = new Item(); } Inventory = new Item[50]; for (int i = 0; i < Inventory.Length; i++) { Inventory[i] = new Item(); } Coins = new Item[4]; for (int i = 0; i < Coins.Length; i++) { Coins[i] = new Item(); } Ammo = new Item[4]; for (int i = 0; i < Ammo.Length; i++) { Ammo[i] = new Item(); } Bank = new Item[40]; for (int i = 0; i < Bank.Length; i++) { Bank[i] = new Item(); } Safe = new Item[40]; for (int i = 0; i < Safe.Length; i++) { Safe[i] = new Item(); } Buffs = new Buff[10]; for (int i = 0; i < Buffs.Length; i++) { Buffs[i] = new Buff(); } spX = new int[200]; spY = new int[200]; spI = new int[200]; spN = new string[200]; for (int i = 0; i < 200; i++) { spN[i] = ""; } }