├── .gitattributes ├── .gitignore ├── Images ├── filterFound.png ├── filterMod.png ├── sortAZ.png ├── sortAmmo.png ├── sortAxe.png ├── sortBait.png ├── sortDamage.png ├── sortDefense.png ├── sortFish.png ├── sortHammer.png ├── sortItemID.png ├── sortPick.png ├── sortValue.png └── spacer.png ├── ItemChecklist.cs ├── ItemChecklist.csproj ├── ItemChecklistClientConfig.cs ├── ItemChecklistGlobalItem.cs ├── ItemChecklistPlayer.cs ├── ItemChecklistUI.cs ├── Localization ├── de-DE_Mods.ItemChecklist.hjson ├── en-US_Mods.ItemChecklist.hjson ├── es-ES_Mods.ItemChecklist.hjson ├── fr-FR_Mods.ItemChecklist.hjson ├── it-IT_Mods.ItemChecklist.hjson ├── pl-PL_Mods.ItemChecklist.hjson ├── pt-BR_Mods.ItemChecklist.hjson ├── ru-RU_Mods.ItemChecklist.hjson └── zh-Hans_Mods.ItemChecklist.hjson ├── MagicStorageIntegration.cs ├── Properties └── launchSettings.json ├── SharedUI.cs ├── UIElements ├── MoreLeft.png ├── MoreRight.png ├── NewUITextBox.cs ├── ScrollbarHorizontal.png ├── ScrollbarInnerHorizontal.png ├── UIBottomlessPanel.cs ├── UICheckbox.cs ├── UICollectionBar.cs ├── UIDragableElement.cs ├── UIGrid.cs ├── UIHorizontalGrid.cs ├── UIHorizontalScrollbar.cs ├── UIHoverImageButton.cs ├── UIItemSlot.cs ├── UISilentImageButton.cs ├── UIToggleHoverImageButton.cs ├── checkBox.png ├── checkMark.png ├── closeButton.png └── closeButtonSmallWhite.png ├── Utilities.cs ├── build.txt ├── description.txt ├── description_workshop.txt ├── icon.png ├── icon_workshop.png └── lib └── MagicStorage_v0.5.7.4.dll /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | 7 | # Standard to msysgit 8 | *.doc diff=astextplain 9 | *.DOC diff=astextplain 10 | *.docx diff=astextplain 11 | *.DOCX diff=astextplain 12 | *.dot diff=astextplain 13 | *.DOT diff=astextplain 14 | *.pdf diff=astextplain 15 | *.PDF diff=astextplain 16 | *.rtf diff=astextplain 17 | *.RTF diff=astextplain 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | bin 2 | obj 3 | *.user 4 | App.config -------------------------------------------------------------------------------- /Images/filterFound.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavidPack/ItemChecklist/ccfcfc1e881aa099ad587dcd3bae7e43a5f48254/Images/filterFound.png -------------------------------------------------------------------------------- /Images/filterMod.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavidPack/ItemChecklist/ccfcfc1e881aa099ad587dcd3bae7e43a5f48254/Images/filterMod.png -------------------------------------------------------------------------------- /Images/sortAZ.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavidPack/ItemChecklist/ccfcfc1e881aa099ad587dcd3bae7e43a5f48254/Images/sortAZ.png -------------------------------------------------------------------------------- /Images/sortAmmo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavidPack/ItemChecklist/ccfcfc1e881aa099ad587dcd3bae7e43a5f48254/Images/sortAmmo.png -------------------------------------------------------------------------------- /Images/sortAxe.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavidPack/ItemChecklist/ccfcfc1e881aa099ad587dcd3bae7e43a5f48254/Images/sortAxe.png -------------------------------------------------------------------------------- /Images/sortBait.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavidPack/ItemChecklist/ccfcfc1e881aa099ad587dcd3bae7e43a5f48254/Images/sortBait.png -------------------------------------------------------------------------------- /Images/sortDamage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavidPack/ItemChecklist/ccfcfc1e881aa099ad587dcd3bae7e43a5f48254/Images/sortDamage.png -------------------------------------------------------------------------------- /Images/sortDefense.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavidPack/ItemChecklist/ccfcfc1e881aa099ad587dcd3bae7e43a5f48254/Images/sortDefense.png -------------------------------------------------------------------------------- /Images/sortFish.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavidPack/ItemChecklist/ccfcfc1e881aa099ad587dcd3bae7e43a5f48254/Images/sortFish.png -------------------------------------------------------------------------------- /Images/sortHammer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavidPack/ItemChecklist/ccfcfc1e881aa099ad587dcd3bae7e43a5f48254/Images/sortHammer.png -------------------------------------------------------------------------------- /Images/sortItemID.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavidPack/ItemChecklist/ccfcfc1e881aa099ad587dcd3bae7e43a5f48254/Images/sortItemID.png -------------------------------------------------------------------------------- /Images/sortPick.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavidPack/ItemChecklist/ccfcfc1e881aa099ad587dcd3bae7e43a5f48254/Images/sortPick.png -------------------------------------------------------------------------------- /Images/sortValue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavidPack/ItemChecklist/ccfcfc1e881aa099ad587dcd3bae7e43a5f48254/Images/sortValue.png -------------------------------------------------------------------------------- /Images/spacer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavidPack/ItemChecklist/ccfcfc1e881aa099ad587dcd3bae7e43a5f48254/Images/spacer.png -------------------------------------------------------------------------------- /ItemChecklist.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using Microsoft.Xna.Framework.Graphics; 3 | using System; 4 | using System.Collections.Generic; 5 | using Terraria; 6 | using Terraria.GameContent; 7 | using Terraria.ModLoader; 8 | using Terraria.UI; 9 | 10 | namespace ItemChecklist 11 | { 12 | // TODO: is ItemChecklistPlayer.foundItems a waste of memory? investigate and trim it down if needed. 13 | // TODO: World Checklist? MP shared checklist? 14 | // Has this item ever been seen on this world? - easy. Maintain separate bool array, on change, notify server, relay to clients. 15 | // send bool array as byte array? 16 | // WHY? I want to know everything we can craft yet 17 | public class ItemChecklist : Mod 18 | { 19 | static internal ItemChecklist instance; 20 | internal static ModKeybind ToggleChecklistHotKey; 21 | internal static UserInterface ItemChecklistInterface; 22 | internal ItemChecklistUI ItemChecklistUI; 23 | internal event Action OnNewItem; 24 | 25 | public override void Load() 26 | { 27 | // Latest uses ItemID.Sets.IsAMaterial, added 0.10.1.5 28 | instance = this; 29 | ToggleChecklistHotKey = KeybindLoader.RegisterKeybind(this, "ToggleItemChecklist", "I"); 30 | MagicStorageIntegration.Load(); 31 | 32 | if (!Main.dedServ) 33 | { 34 | UIElements.UICheckbox.checkboxTexture = ItemChecklist.instance.Assets.Request("UIElements/checkBox"); 35 | UIElements.UICheckbox.checkmarkTexture = ItemChecklist.instance.Assets.Request("UIElements/checkMark"); 36 | UIElements.UIHorizontalGrid.moreLeftTexture = ItemChecklist.instance.Assets.Request("UIElements/MoreLeft"); 37 | UIElements.UIHorizontalGrid.moreRightTexture = ItemChecklist.instance.Assets.Request("UIElements/MoreRight"); 38 | } 39 | } 40 | 41 | public override void Unload() 42 | { 43 | ItemChecklistUI.vanillaIDsInSortOrder = null; 44 | instance = null; 45 | ToggleChecklistHotKey = null; 46 | ItemChecklistInterface = null; 47 | MagicStorageIntegration.Unload(); 48 | 49 | UIElements.UICheckbox.checkboxTexture = null; 50 | UIElements.UICheckbox.checkmarkTexture = null; 51 | UIElements.UIHorizontalGrid.moreLeftTexture = null; 52 | UIElements.UIHorizontalGrid.moreRightTexture = null; 53 | } 54 | 55 | public void SetupUI() 56 | { 57 | if (!Main.dedServ) 58 | { 59 | ItemChecklistUI = new ItemChecklistUI(); 60 | //ItemChecklistUI.Activate(); 61 | ItemChecklistInterface = new UserInterface(); 62 | ItemChecklistInterface.SetState(ItemChecklistUI); 63 | ItemChecklistUI.Visible = false; 64 | } 65 | } 66 | 67 | // As of 0.2.1: All this 68 | // RequestFoundItems must be done in game since foundItem is a reference to an array that is initialized in LoadPlayer. 69 | public override object Call(params object[] args) 70 | { 71 | try 72 | { 73 | string message = args[0] as string; 74 | if (message == "RequestFoundItems") 75 | { 76 | if (Main.gameMenu) 77 | { 78 | return "NotInGame"; 79 | } 80 | return Main.LocalPlayer.GetModPlayer().foundItem; 81 | } 82 | else if (message == "RegisterForNewItem") 83 | { 84 | Action callback = args[1] as Action; 85 | OnNewItem += callback; 86 | return "RegisterSuccess"; 87 | } 88 | else 89 | { 90 | Logger.Error("ItemChecklist Call Error: Unknown Message: " + message); 91 | } 92 | } 93 | catch (Exception e) 94 | { 95 | Logger.Error("ItemChecklist Call Error: " + e.StackTrace + e.Message); 96 | } 97 | return "Failure"; 98 | } 99 | 100 | internal void NewItem(int type) 101 | { 102 | OnNewItem?.Invoke(type); 103 | } 104 | } 105 | 106 | public class ItemChecklistSystem : ModSystem 107 | { 108 | public override void AddRecipes() { 109 | ItemChecklist.instance.SetupUI(); 110 | } 111 | 112 | public override void UpdateUI(GameTime gameTime) 113 | { 114 | ItemChecklist.ItemChecklistInterface?.Update(gameTime); 115 | } 116 | 117 | public override void ModifyInterfaceLayers(List layers) 118 | { 119 | int MouseTextIndex = layers.FindIndex(layer => layer.Name.Equals("Vanilla: Mouse Text")); 120 | if (MouseTextIndex != -1) 121 | { 122 | layers.Insert(MouseTextIndex, new LegacyGameInterfaceLayer( 123 | "ItemChecklist: Item Checklist", 124 | delegate 125 | { 126 | if (ItemChecklistUI.Visible) 127 | { 128 | ItemChecklist.ItemChecklistInterface?.Draw(Main.spriteBatch, new GameTime()); 129 | 130 | if (ItemChecklistUI.hoverText != "") 131 | { 132 | float x = FontAssets.MouseText.Value.MeasureString(ItemChecklistUI.hoverText).X; 133 | Vector2 vector = new Vector2((float)Main.mouseX, (float)Main.mouseY) + new Vector2(16f, 16f); 134 | if (vector.Y > (float)(Main.screenHeight - 30)) 135 | { 136 | vector.Y = (float)(Main.screenHeight - 30); 137 | } 138 | if (vector.X > (float)(Main.screenWidth - x - 30)) 139 | { 140 | vector.X = (float)(Main.screenWidth - x - 30); 141 | } 142 | Utils.DrawBorderStringFourWay(Main.spriteBatch, FontAssets.MouseText.Value, ItemChecklistUI.hoverText, vector.X, vector.Y, new Color((int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor), Color.Black, Vector2.Zero, 1f); 143 | } 144 | 145 | } 146 | return true; 147 | }, 148 | InterfaceScaleType.UI) 149 | ); 150 | } 151 | } 152 | } 153 | } 154 | 155 | -------------------------------------------------------------------------------- /ItemChecklist.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | ItemChecklist 6 | latest 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /ItemChecklistClientConfig.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using System.ComponentModel; 3 | using System.Reflection; 4 | using Terraria.ModLoader; 5 | using Terraria.ModLoader.Config; 6 | 7 | namespace ItemChecklist 8 | { 9 | class ItemChecklistClientConfig : ModConfig 10 | { 11 | public override ConfigScope Mode => ConfigScope.ClientSide; 12 | 13 | [DefaultValue(true)] 14 | public bool ShowItemModSource { get; set; } 15 | 16 | [Header("AutomaticSettings")] 17 | // non-player specific stuff: 18 | 19 | [DefaultValue(typeof(Vector2), "475, 370")] 20 | [Range(0f, 1920f)] 21 | public Vector2 ItemChecklistSize { get; set; } 22 | 23 | [DefaultValue(typeof(Vector2), "400, 400")] 24 | [Range(0f, 1920f)] 25 | public Vector2 ItemChecklistPosition { get; set; } 26 | 27 | internal static void SaveConfig() { 28 | // in-game ModConfig saving from mod code is not supported yet in tmodloader, and subject to change, so we need to be extra careful. 29 | // This code only supports client configs, and doesn't call onchanged. It also doesn't support ReloadRequired or anything else. 30 | MethodInfo saveMethodInfo = typeof(ConfigManager).GetMethod("Save", BindingFlags.Static | BindingFlags.NonPublic); 31 | if (saveMethodInfo != null) 32 | saveMethodInfo.Invoke(null, new object[] { ModContent.GetInstance() }); 33 | else 34 | ItemChecklist.instance.Logger.Warn("In-game SaveConfig failed, code update required"); 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /ItemChecklistGlobalItem.cs: -------------------------------------------------------------------------------- 1 | using Terraria; 2 | using Terraria.DataStructures; 3 | using Terraria.Localization; 4 | using Terraria.ModLoader; 5 | 6 | namespace ItemChecklist 7 | { 8 | class ItemChecklistGlobalItem : GlobalItem 9 | { 10 | const string LOCALIZATION_KEY = "Mods.ItemChecklist.GlobalItem."; 11 | private static LocalizedText ItemChecklistAnnounceText; 12 | 13 | public override void SetStaticDefaults() 14 | { 15 | ItemChecklistAnnounceText = Language.GetOrRegister( LOCALIZATION_KEY + nameof(ItemChecklistAnnounceText) ); 16 | } 17 | 18 | // OnPIckup only called on LocalPlayer: I think 19 | public override void OnCreated(Item item, ItemCreationContext context) 20 | { 21 | if (context is RecipeItemCreationContext rContext) { 22 | ItemReceived(item); 23 | } 24 | } 25 | 26 | // OnPIckup only called on LocalPlayer: i == Main.myPlayer 27 | public override bool OnPickup(Item item, Player player) 28 | { 29 | ItemReceived(item); 30 | return true; 31 | } 32 | 33 | // TODO, unloaded items, check against?? 34 | internal void ItemReceived(Item item) 35 | { 36 | var itemChecklistPlayer = Main.LocalPlayer.GetModPlayer(); 37 | if (!itemChecklistPlayer.foundItem[item.type] && itemChecklistPlayer.findableItems[item.type]) 38 | { 39 | Item newItem = new Item(); 40 | newItem.SetDefaults(item.type); 41 | itemChecklistPlayer.foundItems.Add(newItem); 42 | itemChecklistPlayer.totalItemsFound++; 43 | itemChecklistPlayer.foundItem[item.type] = true; 44 | ItemChecklist.instance.ItemChecklistUI.UpdateNeeded(item.type); 45 | if (ItemChecklistUI.announce) 46 | { 47 | Main.NewText(ItemChecklistAnnounceText.Format(item.Name, 48 | itemChecklistPlayer.totalItemsFound, 49 | itemChecklistPlayer.totalItemsToFind, 50 | (100f*itemChecklistPlayer.totalItemsFound/itemChecklistPlayer.totalItemsToFind).ToString("0.00"))); 51 | } 52 | ItemChecklist.instance.NewItem(item.type); 53 | } 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /ItemChecklistPlayer.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | using System.Reflection; 4 | using Terraria; 5 | using Terraria.GameInput; 6 | using Terraria.ID; 7 | using Terraria.ModLoader; 8 | using Terraria.ModLoader.IO; 9 | 10 | namespace ItemChecklist 11 | { 12 | class ItemChecklistPlayer : ModPlayer 13 | { 14 | // internal static ItemChecklistPlayer localInstance; 15 | 16 | // This is a list of items...Holds clean versions of unloaded mystery and loaded real items. 17 | internal List foundItems; 18 | // TODO: Need to switch to saving ItemDefinition while preserving existing. Can you get ItemDefinition from UnloadedItem? 19 | // 20 | internal bool[] foundItem; 21 | internal bool[] findableItems; 22 | //Skipping: 23 | // Main.itemName 0 is empty 24 | // Mysteryitem is to skip --> ItemID.Count 25 | // Deprecated if (this.type > 0 && ItemID.Sets.Deprecated[this.type]) 26 | 27 | internal int totalItemsToFind; 28 | internal int totalItemsFound; // eh, property? dunno. 29 | 30 | // Because of save, these values inherit the last used setting while loading 31 | //internal SortModes sortModePreference = SortModes.TerrariaSort; 32 | internal bool announcePreference; 33 | internal bool findChestItemsPreference = true; 34 | internal int showCompletedPreference; 35 | 36 | public override void ProcessTriggers(TriggersSet triggersSet) 37 | { 38 | if (ItemChecklist.ToggleChecklistHotKey.JustPressed) 39 | { 40 | if (!ItemChecklistUI.Visible) 41 | { 42 | ItemChecklist.instance.ItemChecklistUI.UpdateNeeded(); 43 | } 44 | ItemChecklistUI.Visible = !ItemChecklistUI.Visible; 45 | // Debug assistance, allows for reinitializing RecipeBrowserUI 46 | //if (!ItemChecklistUI.visible) 47 | //{ 48 | // ItemChecklistUI.instance.RemoveAllChildren(); 49 | // var isInitializedFieldInfo = typeof(Terraria.UI.UIElement).GetField("_isInitialized", BindingFlags.Instance | BindingFlags.NonPublic); 50 | // isInitializedFieldInfo.SetValue(ItemChecklistUI.instance, false); 51 | // ItemChecklistUI.instance.Activate(); 52 | //} 53 | } 54 | } 55 | 56 | public override void OnEnterWorld() 57 | { 58 | ItemChecklistUI.Visible = false; 59 | ItemChecklistUI.announce = announcePreference; 60 | ItemChecklistUI.collectChestItems = findChestItemsPreference; 61 | //ItemChecklistUI.sortMode = sortModePreference; 62 | ItemChecklistUI.showCompleted = showCompletedPreference; 63 | ItemChecklist.instance.ItemChecklistUI.RefreshPreferences(); 64 | ItemChecklist.instance.ItemChecklistUI.UpdateNeeded(); 65 | } 66 | 67 | // Do I need to use Initialize? I think so because of cloning. 68 | public override void Initialize() 69 | { 70 | if (!Main.dedServ) 71 | { 72 | foundItems = new List(); 73 | foundItem = new bool[ItemLoader.ItemCount]; 74 | findableItems = new bool[ItemLoader.ItemCount]; 75 | for (int i = 0; i < ItemLoader.ItemCount; i++) 76 | { 77 | if (i > 0 && !ItemID.Sets.Deprecated[i] && ItemLoader.GetItem(i) is not Terraria.ModLoader.Default.UnloadedItem && ItemChecklistUI.vanillaIDsInSortOrder != null && ItemChecklistUI.vanillaIDsInSortOrder[i] != -1) // TODO, is this guaranteed? 78 | { 79 | totalItemsToFind++; 80 | findableItems[i] = true; 81 | } 82 | } 83 | 84 | announcePreference = false; 85 | findChestItemsPreference = true; 86 | //sortModePreference = SortModes.TerrariaSort; 87 | showCompletedPreference = 0; 88 | } 89 | } 90 | 91 | public override void UpdateAutopause() 92 | { 93 | ChestCheck(); 94 | } 95 | 96 | public override void PreUpdate() 97 | { 98 | ChestCheck(); 99 | } 100 | 101 | private void ChestCheck() 102 | { 103 | if (!Main.dedServ && Player.whoAmI == Main.myPlayer) 104 | { 105 | for (int i = 0; i < 59; i++) 106 | { 107 | if (!Player.inventory[i].IsAir && !foundItem[Player.inventory[i].type] && findableItems[Player.inventory[i].type]) 108 | { 109 | // Looping because.. nervous that there might be more than one somehow? 110 | foreach (ItemChecklistGlobalItem item in Mod.GetContent()) 111 | { 112 | item.ItemReceived(Player.inventory[i]); // TODO: Analyze performance impact? do every 60 frames only? 113 | } 114 | } 115 | } 116 | if (Player.chest != -1 && (Player.chest != Player.lastChest || Main.autoPause && Main.gamePaused) && ItemChecklistUI.collectChestItems) 117 | { 118 | //Main.NewText(player.chest + " " + player.lastChest); 119 | Item[] items; 120 | if (Player.chest == -2) 121 | items = Player.bank.item; 122 | else if (Player.chest == -3) 123 | items = Player.bank2.item; 124 | else if (Player.chest == -4) 125 | items = Player.bank3.item; 126 | else if (Player.chest == -5) 127 | items = Player.bank4.item; 128 | else 129 | items = Main.chest[Player.chest].item; 130 | for (int i = 0; i < 40; i++) 131 | { 132 | if (!items[i].IsAir && !foundItem[items[i].type] && findableItems[items[i].type]) 133 | { 134 | foreach (ItemChecklistGlobalItem item in Mod.GetContent()) 135 | { 136 | item.ItemReceived(items[i]); 137 | } 138 | } 139 | } 140 | } 141 | if (ItemChecklistUI.collectChestItems && MagicStorageIntegration.Enabled) 142 | MagicStorageIntegration.FindItemsInStorage(); 143 | } 144 | } 145 | 146 | public override void SaveData(TagCompound tag) 147 | { 148 | // sanitize? should be possible to add item already seen. 149 | tag["FoundItems"] = foundItems.Where(item => item.Name != "Unloaded Item").Select(ItemIO.Save).ToList(); 150 | //tag["SortMode"] = (int)ItemChecklistUI.sortMode; 151 | tag["Announce"] = ItemChecklistUI.announce; // Not saving default, saving last used....good thing? 152 | tag["CollectChestItems"] = ItemChecklistUI.collectChestItems; 153 | tag["ShowCompleted"] = ItemChecklistUI.showCompleted; 154 | } 155 | 156 | public override void LoadData(TagCompound tag) 157 | { 158 | foundItems = tag.GetList("FoundItems").Select(ItemIO.Load).ToList(); 159 | //sortModePreference = (SortModes)tag.GetInt("SortMode"); 160 | announcePreference = tag.GetBool("Announce"); 161 | if (tag.ContainsKey("CollectChestItems")) // Missing tags get defaultvalue, which would be false, which isn't what we want. 162 | findChestItemsPreference = tag.GetBool("CollectChestItems"); 163 | showCompletedPreference = tag.GetInt("ShowCompleted"); 164 | 165 | foreach (var item in foundItems) 166 | { 167 | if (item.Name != "Unloaded Item") 168 | { 169 | foundItem[item.type] = true; 170 | totalItemsFound++; 171 | } 172 | } 173 | } 174 | } 175 | } 176 | -------------------------------------------------------------------------------- /ItemChecklistUI.cs: -------------------------------------------------------------------------------- 1 | using ItemChecklist.UIElements; 2 | using Microsoft.Xna.Framework; 3 | using Microsoft.Xna.Framework.Graphics; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Linq; 7 | using System.Reflection; 8 | using System.Text; 9 | using ReLogic.Content; 10 | using Terraria; 11 | using Terraria.Audio; 12 | using Terraria.GameContent; 13 | using Terraria.GameContent.UI.Elements; 14 | using Terraria.ID; 15 | using Terraria.ModLoader; 16 | using Terraria.UI; 17 | 18 | using UIItemSlot = ItemChecklist.UIElements.UIItemSlot; 19 | using Steamworks; 20 | using System.Runtime.CompilerServices; 21 | using System.ComponentModel; 22 | 23 | using Terraria.Localization; 24 | 25 | 26 | namespace ItemChecklist 27 | { 28 | class ItemChecklistUI : UIState 29 | { 30 | internal static ItemChecklistUI instance; 31 | public UIHoverImageButton foundFilterButton; 32 | public UIToggleHoverImageButton muteButton; 33 | //public UIHoverImageButton sortButton; 34 | public UIHoverImageButton modFilterButton; 35 | public UIToggleHoverImageButton collectChestItemsButton; 36 | public UIToggleHoverImageButton showBadgeButton; 37 | private bool buttonsHaveDummyTextures; 38 | public UIDragableElement mainPanel; 39 | public UIPanel checklistPanel; 40 | internal NewUITextBox itemNameFilter; 41 | internal NewUITextBox itemDescriptionFilter; 42 | internal SharedUI sharedUI; 43 | public UIGrid checklistGrid; 44 | public UICollectionBar collectionBar; 45 | //public static SortModes sortMode = SortModes.TerrariaSort; 46 | 47 | float spacing = 8f; 48 | public static bool Visible 49 | { 50 | get { return ItemChecklist.ItemChecklistInterface.CurrentState == ItemChecklist.instance.ItemChecklistUI; } 51 | set { ItemChecklist.ItemChecklistInterface.SetState(value ? ItemChecklist.instance.ItemChecklistUI : null); } 52 | } 53 | public static int showCompleted = 0; // 0: both, 1: unfound, 2: found 54 | public static bool announce = true; 55 | public static bool collectChestItems = true; 56 | public static bool showBadge = true; 57 | public static string hoverText = ""; 58 | 59 | UIItemSlot[] itemSlots; 60 | internal static int[] vanillaIDsInSortOrder; 61 | 62 | internal List modnames; 63 | internal int currentMod = 0; 64 | 65 | public string[] foundFilterStrings; 66 | 67 | const string LOCALIZATION_KEY = "Mods.ItemChecklist.Ui."; 68 | public static LocalizedText ToggleCollectChestItemsText; 69 | public static LocalizedText ToggleMessagesText; 70 | public static LocalizedText ShowSortValueTextText; 71 | public static LocalizedText FilterByNameText; 72 | public static LocalizedText FilterByTooltipText; 73 | public static LocalizedText CycleModFilterText; 74 | public static LocalizedText CycleFoundFilterText; 75 | public static LocalizedText ModnamesAllText; 76 | public static LocalizedText FoundFilterAllText; 77 | public static LocalizedText FoundFilterUnfoundText; 78 | public static LocalizedText FoundFilterFoundText; 79 | public static LocalizedText ModnamesVanillaText; 80 | 81 | public ItemChecklistUI() 82 | { 83 | instance = this; 84 | 85 | 86 | FilterByTooltipText = Language.GetOrRegister( LOCALIZATION_KEY + nameof(FilterByTooltipText) ); 87 | FilterByNameText = Language.GetOrRegister( LOCALIZATION_KEY + nameof(FilterByNameText) ); 88 | ToggleCollectChestItemsText = Language.GetOrRegister( LOCALIZATION_KEY + nameof(ToggleCollectChestItemsText) ); 89 | ToggleMessagesText = Language.GetOrRegister( LOCALIZATION_KEY + nameof(ToggleMessagesText) ); 90 | ShowSortValueTextText = Language.GetOrRegister( LOCALIZATION_KEY + nameof(ShowSortValueTextText) ); 91 | CycleModFilterText = Language.GetOrRegister( LOCALIZATION_KEY + nameof(CycleModFilterText) ); 92 | CycleFoundFilterText = Language.GetOrRegister( LOCALIZATION_KEY + nameof(CycleFoundFilterText) ); 93 | ModnamesAllText = Language.GetOrRegister( LOCALIZATION_KEY + nameof(ModnamesAllText) ); 94 | FoundFilterAllText = Language.GetOrRegister( LOCALIZATION_KEY + nameof(FoundFilterAllText) ); 95 | FoundFilterUnfoundText = Language.GetOrRegister( LOCALIZATION_KEY + nameof(FoundFilterUnfoundText) ); 96 | FoundFilterFoundText = Language.GetOrRegister( LOCALIZATION_KEY + nameof(FoundFilterFoundText) ); 97 | ModnamesVanillaText = Language.GetOrRegister( LOCALIZATION_KEY + nameof(ModnamesVanillaText) ); 98 | 99 | 100 | foundFilterStrings = new [] { FoundFilterAllText.Value , FoundFilterUnfoundText.Value , FoundFilterFoundText.Value }; 101 | } 102 | 103 | public override void OnInitialize() 104 | { 105 | // Is initialize called? (Yes it is called on reload) I want to reset nicely with new character or new loaded mods: visible = false; 106 | 107 | announce = false; // overwritten by modplayer 108 | collectChestItems = false; 109 | showBadge = false; 110 | 111 | mainPanel = new UIDragableElement(); 112 | //mainPanel.SetPadding(0); 113 | //mainPanel.PaddingTop = 4; 114 | mainPanel.Left.Set(400f, 0f); 115 | mainPanel.Top.Set(400f, 0f); 116 | mainPanel.Width.Set(475f, 0f); // + 30 117 | mainPanel.MinWidth.Set(415f, 0f); 118 | mainPanel.MaxWidth.Set(884f, 0f); 119 | mainPanel.Height.Set(370, 0f); 120 | mainPanel.MinHeight.Set(263, 0f); 121 | mainPanel.MaxHeight.Set(1000, 0f); 122 | //mainPanel.BackgroundColor = Color.LightBlue; 123 | 124 | var config = ModContent.GetInstance(); 125 | mainPanel.Left.Set(config.ItemChecklistPosition.X, 0f); 126 | mainPanel.Top.Set(config.ItemChecklistPosition.Y, 0f); 127 | mainPanel.Width.Set(config.ItemChecklistSize.X, 0f); 128 | mainPanel.Height.Set(config.ItemChecklistSize.Y, 0f); 129 | 130 | int top = 0; 131 | int left = 0; 132 | 133 | checklistPanel = new UIPanel(); 134 | checklistPanel.SetPadding(10); 135 | checklistPanel.BackgroundColor = new Color(73, 94, 171);; 136 | checklistPanel.Top.Set(0, 0f); 137 | checklistPanel.Height.Set(0, 1f); 138 | checklistPanel.Width.Set(0, 1f); 139 | mainPanel.Append(checklistPanel); 140 | mainPanel.AddDragTarget(checklistPanel); 141 | 142 | // Because OnInitialize Happens during load and because we need it to happen for OnEnterWorld, use dummy sprite. 143 | buttonsHaveDummyTextures = true; 144 | 145 | foundFilterButton = new UIHoverImageButton(TextureAssets.MagicPixel.Value, CycleFoundFilterText.Format("??")); 146 | foundFilterButton.OnLeftClick += (a, b) => ToggleFoundFilterButtonClicked(a, b, true); 147 | foundFilterButton.OnRightClick += (a, b) => ToggleFoundFilterButtonClicked(a, b, false); 148 | foundFilterButton.Top.Pixels = top; 149 | checklistPanel.Append(foundFilterButton); 150 | left += (int)spacing * 2 + 28; 151 | 152 | //sortButton = new UIHoverImageButton(sortButtonTexture, "Cycle Sort Method: ??"); 153 | //sortButton.OnClick += (a, b) => ToggleSortButtonClicked(a, b, true); 154 | //sortButton.OnRightClick += (a, b) => ToggleSortButtonClicked(a, b, false); 155 | //sortButton.Left.Pixels = spacing * 4 + 28 * 2; 156 | //sortButton.Top.Pixels = top; 157 | //checklistPanel.Append(sortButton); 158 | 159 | modFilterButton = new UIHoverImageButton(TextureAssets.MagicPixel.Value, CycleModFilterText.Format( "??" )); 160 | modFilterButton.OnLeftClick += (a, b) => ToggleModFilterButtonClicked(a, b, true); 161 | modFilterButton.OnRightClick += (a, b) => ToggleModFilterButtonClicked(a, b, false); 162 | modFilterButton.Left.Pixels = left; 163 | modFilterButton.Top.Pixels = top; 164 | checklistPanel.Append(modFilterButton); 165 | left += (int)spacing * 2 + 28; 166 | 167 | muteButton = new UIToggleHoverImageButton(TextureAssets.MagicPixel.Value, ItemChecklist.instance.Assets.Request("UIElements/closeButton", AssetRequestMode.ImmediateLoad).Value, ToggleMessagesText.Value, announce); 168 | muteButton.OnLeftClick += ToggleMuteButtonClicked; 169 | muteButton.Left.Pixels = left; 170 | muteButton.Top.Pixels = top; 171 | checklistPanel.Append(muteButton); 172 | left += (int)spacing * 2 + 28; 173 | 174 | collectChestItemsButton = new UIToggleHoverImageButton(TextureAssets.MagicPixel.Value, ItemChecklist.instance.Assets.Request("UIElements/closeButton", AssetRequestMode.ImmediateLoad).Value, ToggleCollectChestItemsText.Value, collectChestItems); 175 | collectChestItemsButton.OnLeftClick += ToggleFindChestItemsButtonClicked; 176 | collectChestItemsButton.Left.Pixels = left; 177 | collectChestItemsButton.Top.Pixels = top; 178 | checklistPanel.Append(collectChestItemsButton); 179 | left += (int)spacing * 2 + 28; 180 | 181 | showBadgeButton = new UIToggleHoverImageButton(TextureAssets.MagicPixel.Value, ItemChecklist.instance.Assets.Request("UIElements/closeButton", AssetRequestMode.ImmediateLoad).Value, ShowSortValueTextText.Value, showBadge); 182 | showBadgeButton.OnLeftClick += ToggleShowBadgeButtonClicked; 183 | showBadgeButton.Left.Pixels = left; 184 | showBadgeButton.Top.Pixels = top; 185 | checklistPanel.Append(showBadgeButton); 186 | left += (int)spacing * 2 + 28; 187 | 188 | top += 34; 189 | 190 | itemNameFilter = new NewUITextBox(FilterByNameText.Value); 191 | itemNameFilter.OnTextChanged += () => { ValidateItemFilter(); updateNeeded = true; }; 192 | itemNameFilter.OnTabPressed += () => { itemDescriptionFilter.Focus(); }; 193 | itemNameFilter.Top.Pixels = top; 194 | //itemNameFilter.Left.Set(-152, 1f); 195 | itemNameFilter.Width.Set(0, 1f); 196 | itemNameFilter.Height.Set(25, 0f); 197 | checklistPanel.Append(itemNameFilter); 198 | 199 | top += 30; 200 | 201 | itemDescriptionFilter = new NewUITextBox(FilterByTooltipText.Value); 202 | itemDescriptionFilter.OnTextChanged += () => { ValidateItemDescription(); updateNeeded = true; }; 203 | itemDescriptionFilter.OnTabPressed += () => { itemNameFilter.Focus(); }; 204 | itemDescriptionFilter.Top.Pixels = top; 205 | //itemDescriptionFilter.Left.Set(-152, 1f); 206 | itemDescriptionFilter.Width.Set(0, 1f); 207 | itemDescriptionFilter.Height.Set(25, 0f); 208 | checklistPanel.Append(itemDescriptionFilter); 209 | 210 | top += 30; 211 | 212 | sharedUI = new SharedUI(); 213 | sharedUI.Initialize(); 214 | 215 | sharedUI.sortsAndFiltersPanel.Top.Set(top, 0f); 216 | sharedUI.sortsAndFiltersPanel.Width.Set(0f, 1); 217 | sharedUI.sortsAndFiltersPanel.Height.Set(60, 0f); 218 | checklistPanel.Append(sharedUI.sortsAndFiltersPanel); 219 | 220 | top += 68; 221 | 222 | checklistGrid = new UIGrid(); 223 | checklistGrid.alternateSort = ItemGridSort; 224 | checklistGrid.Top.Pixels = top; 225 | checklistGrid.Width.Set(-25f, 1f); 226 | checklistGrid.Height.Set(-top - 24, 1f); 227 | checklistGrid.ListPadding = 2f; 228 | checklistPanel.Append(checklistGrid); 229 | 230 | FixedUIScrollbar checklistListScrollbar = new FixedUIScrollbar(); 231 | checklistListScrollbar.SetView(100f, 1000f); 232 | checklistListScrollbar.Top.Pixels = top; 233 | checklistListScrollbar.Height.Set(-top - 24, 1f); 234 | checklistListScrollbar.HAlign = 1f; 235 | checklistPanel.Append(checklistListScrollbar); 236 | checklistGrid.SetScrollbar(checklistListScrollbar); 237 | 238 | // Checklistlist populated when the panel is shown: UpdateCheckboxes() 239 | collectionBar = new UICollectionBar() { 240 | Width = new StyleDimension(0f, 1f), 241 | Height = new StyleDimension(15f, 0f), 242 | VAlign = 1f, 243 | }; 244 | 245 | checklistPanel.Append(collectionBar); 246 | 247 | Append(mainPanel); 248 | 249 | // load time impact, do this on first show? 250 | itemSlots = new UIItemSlot[ItemLoader.ItemCount]; 251 | Item[] itemSlotItems = new Item[ItemLoader.ItemCount]; 252 | for (int i = 0; i < ItemLoader.ItemCount; i++) 253 | { 254 | Item item = ContentSamples.ItemsByType[i]; 255 | if (item.type == ItemID.None) 256 | continue; 257 | itemSlots[i] = new UIItemSlot(item, i); 258 | itemSlotItems[i] = item; 259 | } 260 | 261 | FieldInfo inventoryGlowHue = typeof(Terraria.UI.ItemSlot).GetField("inventoryGlowHue", BindingFlags.Static | BindingFlags.NonPublic); 262 | FieldInfo inventoryGlowTime = typeof(Terraria.UI.ItemSlot).GetField("inventoryGlowTime", BindingFlags.Static | BindingFlags.NonPublic); 263 | 264 | MethodInfo SortMethod = typeof(ItemSorting).GetMethod("Sort", BindingFlags.Static | BindingFlags.NonPublic); 265 | object[] parametersArray = new object[] { itemSlotItems, new int[0] }; 266 | 267 | inventoryGlowHue.SetValue(null, new float[ItemLoader.ItemCount]); 268 | inventoryGlowTime.SetValue(null, new int[ItemLoader.ItemCount]); 269 | //SortMethod.Invoke(null, parametersArray); 270 | inventoryGlowHue.SetValue(null, new float[58]); 271 | inventoryGlowTime.SetValue(null, new int[58]); 272 | 273 | int[] vanillaIDsInSortOrderTemp = itemSlotItems.Where(x => x != null).Select((x) => x.type).ToArray(); 274 | vanillaIDsInSortOrder = new int[ItemLoader.ItemCount]; 275 | for (int i = 0; i < ItemLoader.ItemCount; i++) 276 | { 277 | vanillaIDsInSortOrder[i] = Array.FindIndex(vanillaIDsInSortOrderTemp, x => x == i); 278 | } 279 | 280 | List list = ContentSamples.ItemsByType.Values.ToList(); 281 | IOrderedEnumerable> orderedEnumerable = from x in list 282 | select new ContentSamples.CreativeHelper.ItemGroupAndOrderInGroup(x) into x 283 | group x by x.Group into @group 284 | orderby (int)@group.Key 285 | select @group; 286 | int order = 0; 287 | foreach (IGrouping item2 in orderedEnumerable) { 288 | foreach (ContentSamples.CreativeHelper.ItemGroupAndOrderInGroup item3 in item2) { 289 | //vanillaIDsInSortOrder[order] = item3.ItemType; 290 | // TODO...rename? 291 | vanillaIDsInSortOrder[item3.ItemType] = order; 292 | order++; 293 | } 294 | } 295 | 296 | 297 | modnames = new List() { ModnamesAllText.Value, ModnamesVanillaText.Value }; 298 | modnames.AddRange(ModLoader.Mods.Where(mod => mod.GetContent().Any()).Select(x => x.Name)/*.Where(x => x != "ModLoader")*/); 299 | 300 | updateNeeded = true; 301 | } 302 | 303 | private int ItemGridSort(UIElement x, UIElement y) 304 | { 305 | UIItemSlot a = x as UIItemSlot; 306 | UIItemSlot b = y as UIItemSlot; 307 | if (SharedUI.instance.SelectedSort != null) 308 | return SharedUI.instance.SelectedSort.sort(a.item, b.item); 309 | return a.item.type.CompareTo(b.item.type); 310 | } 311 | 312 | private void ToggleFoundFilterButtonClicked(UIMouseEvent evt, UIElement listeningElement, bool left) 313 | { 314 | SoundEngine.PlaySound(SoundID.MenuTick); 315 | showCompleted = (3 + showCompleted + (left ? 1 : -1)) % 3; 316 | foundFilterButton.hoverText = CycleFoundFilterText.Format( foundFilterStrings[showCompleted]); 317 | UpdateNeeded(); 318 | } 319 | 320 | private void ToggleMuteButtonClicked(UIMouseEvent evt, UIElement listeningElement) 321 | { 322 | announce = !announce; 323 | SoundEngine.PlaySound(announce ? SoundID.MenuOpen : SoundID.MenuClose); 324 | muteButton.SetEnabled(announce); 325 | } 326 | 327 | //private void ToggleSortButtonClicked(UIMouseEvent evt, UIElement listeningElement, bool left) 328 | //{ 329 | // Main.PlaySound(SoundID.MenuTick); 330 | // sortMode = left ? sortMode.NextEnum() : sortMode.PreviousEnum(); 331 | // sortButton.hoverText = "Cycle Sort Method: " + sortMode.ToFriendlyString(); 332 | // UpdateNeeded(); 333 | //} 334 | 335 | private void ToggleModFilterButtonClicked(UIMouseEvent evt, UIElement listeningElement, bool left) 336 | { 337 | SoundEngine.PlaySound(SoundID.MenuTick); 338 | currentMod = (modnames.Count + currentMod + (left ? 1 : -1)) % modnames.Count; 339 | modFilterButton.hoverText = CycleModFilterText.Format( modnames[currentMod]); 340 | UpdateNeeded(); 341 | } 342 | 343 | private void ToggleShowBadgeButtonClicked(UIMouseEvent evt, UIElement listeningElement) 344 | { 345 | showBadge = !showBadge; 346 | SoundEngine.PlaySound(showBadge ? SoundID.MenuOpen : SoundID.MenuClose); 347 | showBadgeButton.SetEnabled(showBadge); 348 | } 349 | 350 | private void ToggleFindChestItemsButtonClicked(UIMouseEvent evt, UIElement listeningElement) 351 | { 352 | collectChestItems = !collectChestItems; 353 | SoundEngine.PlaySound(collectChestItems ? SoundID.MenuOpen : SoundID.MenuClose); 354 | collectChestItemsButton.SetEnabled(collectChestItems); 355 | } 356 | 357 | internal void RefreshPreferences() 358 | { 359 | foundFilterButton.hoverText = CycleFoundFilterText.Format( foundFilterStrings[showCompleted]); 360 | //sortButton.hoverText = "Cycle Sort Method: " + sortMode.ToFriendlyString(); 361 | modFilterButton.hoverText = CycleModFilterText.Format( modnames[currentMod]); 362 | muteButton.SetEnabled(announce); 363 | collectChestItemsButton.SetEnabled(collectChestItems); 364 | UpdateNeeded(); 365 | } 366 | 367 | private bool updateNeeded; 368 | private int lastfoundID = -1; 369 | internal void UpdateNeeded(int lastfoundID = -1) 370 | { 371 | updateNeeded = true; 372 | if (lastfoundID > 0) 373 | { 374 | this.lastfoundID = lastfoundID; 375 | } 376 | } 377 | 378 | // todo, items on load. 379 | internal void UpdateCheckboxes() 380 | { 381 | if (!updateNeeded) { return; } 382 | updateNeeded = false; 383 | checklistGrid.Clear(); 384 | collectionBar.RecalculateBars(); 385 | 386 | if (buttonsHaveDummyTextures) 387 | { 388 | Main.instance.LoadItem(ItemID.Megaphone); 389 | Main.instance.LoadItem(ItemID.Book); 390 | 391 | Texture2D foundFilterTexture = Utilities.ResizeImage(ItemChecklist.instance.Assets.Request("Images/filterFound", AssetRequestMode.ImmediateLoad), 32, 32); 392 | Texture2D muteButtonTexture = Utilities.ResizeImage(TextureAssets.Item[ItemID.Megaphone], 32, 32); 393 | //Texture2D sortButtonTexture = Utilities.ResizeImage(Main.itemTexture[ItemID.ToxicFlask], 32, 32); 394 | Texture2D modFilterButtonTexture = Utilities.ResizeImage(ItemChecklist.instance.Assets.Request("Images/filterMod", AssetRequestMode.ImmediateLoad), 32, 32); 395 | Texture2D collectChestItemsButtonTexture = Utilities.ResizeImage(TextureAssets.Cursors[8], 32, 32); 396 | Texture2D showBadgeButtonTexture = Utilities.ResizeImage(TextureAssets.Item[ItemID.Book], 32, 32); // Main.extraTexture[58] 397 | 398 | foundFilterButton.SetImage(foundFilterTexture); 399 | muteButton.SetImage(muteButtonTexture); 400 | modFilterButton.SetImage(modFilterButtonTexture); 401 | collectChestItemsButton.SetImage(collectChestItemsButtonTexture); 402 | showBadgeButton.SetImage(showBadgeButtonTexture); 403 | 404 | buttonsHaveDummyTextures = false; 405 | } 406 | 407 | var itemChecklistPlayer = Main.LocalPlayer.GetModPlayer(); 408 | var temp = new List(); 409 | for (int i = 0; i < itemChecklistPlayer.findableItems.Length; i++) 410 | { 411 | if (itemChecklistPlayer.findableItems[i]) 412 | { 413 | if (itemSlots[i] == null) continue; 414 | 415 | // filters here 416 | if ((showCompleted != 1 && itemChecklistPlayer.foundItem[i]) || (showCompleted != 2 && !itemChecklistPlayer.foundItem[i])) 417 | { 418 | if (!PassModFilter(itemSlots[i])) 419 | continue; 420 | 421 | if (SharedUI.instance.SelectedCategory != null) 422 | { 423 | if (!SharedUI.instance.SelectedCategory.belongs(itemSlots[i].item) && !SharedUI.instance.SelectedCategory.subCategories.Any(x => x.belongs(itemSlots[i].item))) 424 | continue; 425 | } 426 | 427 | bool filtered = false; 428 | foreach (var filter in SharedUI.instance.availableFilters) 429 | { 430 | if (filter.button.selected) 431 | if (!filter.belongs(itemSlots[i].item)) 432 | filtered = true; 433 | } 434 | if (filtered) 435 | continue; 436 | 437 | if (itemSlots[i].item.Name.IndexOf(itemNameFilter.currentString, StringComparison.OrdinalIgnoreCase) == -1) 438 | continue; 439 | 440 | if (itemDescriptionFilter.currentString.Length > 0) 441 | { 442 | if ((itemSlots[i].item.ToolTip != null && GetTooltipsAsString(itemSlots[i].item.ToolTip).IndexOf(itemDescriptionFilter.currentString, StringComparison.OrdinalIgnoreCase) != -1) /*|| (recipe.createItem.toolTip2 != null && recipe.createItem.toolTip2.ToLower().IndexOf(itemDescriptionFilter.Text, StringComparison.OrdinalIgnoreCase) != -1)*/) 443 | { 444 | } 445 | else 446 | { 447 | continue; 448 | } 449 | } 450 | 451 | UIItemSlot box = itemSlots[i]; 452 | box.badge = SharedUI.instance.SelectedSort?.badge(box.item) ?? ""; 453 | temp.Add(box); 454 | } 455 | } 456 | } 457 | checklistGrid.AddRange(temp); 458 | 459 | if (lastfoundID > 0) 460 | { 461 | checklistGrid.Recalculate(); 462 | if (showCompleted != 1) // Don't Goto when unfound is the display mode. 463 | { 464 | checklistGrid.Goto(delegate (UIElement element) 465 | { 466 | UIItemSlot itemSlot = element as UIItemSlot; 467 | return itemSlot != null && itemSlot.itemType == lastfoundID; 468 | }, true); 469 | } 470 | lastfoundID = -1; 471 | } 472 | } 473 | 474 | private bool PassModFilter(UIItemSlot itemSlot) 475 | { 476 | if (currentMod == 0) 477 | { 478 | return true; 479 | } 480 | else if (currentMod == 1 && itemSlot.item.ModItem == null) 481 | { 482 | return true; 483 | } 484 | else if (itemSlot.item.ModItem != null && itemSlot.item.ModItem.Mod.Name == modnames[currentMod]) 485 | { 486 | return true; 487 | } 488 | return false; 489 | } 490 | 491 | private void ValidateItemFilter() 492 | { 493 | if (itemNameFilter.currentString.Length > 0) 494 | { 495 | bool found = false; 496 | foreach (var itemSlot in itemSlots) 497 | { 498 | if (itemSlot == null) continue; 499 | 500 | if (itemSlot.item.Name.IndexOf(itemNameFilter.currentString, StringComparison.OrdinalIgnoreCase) != -1) 501 | { 502 | found = true; 503 | break; 504 | } 505 | } 506 | if (!found) 507 | { 508 | itemNameFilter.SetText(itemNameFilter.currentString.Substring(0, itemNameFilter.currentString.Length - 1)); 509 | } 510 | } 511 | updateNeeded = true; 512 | } 513 | 514 | private void ValidateItemDescription() 515 | { 516 | updateNeeded = true; 517 | } 518 | 519 | public override void Draw(SpriteBatch spriteBatch) { 520 | if (buttonsHaveDummyTextures) 521 | return; 522 | base.Draw(spriteBatch); 523 | } 524 | 525 | protected override void DrawSelf(SpriteBatch spriteBatch) 526 | { 527 | ItemChecklistUI.hoverText = ""; 528 | Vector2 MousePosition = new Vector2((float)Main.mouseX, (float)Main.mouseY); 529 | if (mainPanel.ContainsPoint(MousePosition)) 530 | { 531 | Main.player[Main.myPlayer].mouseInterface = true; 532 | } 533 | } 534 | 535 | public override void Update(GameTime gameTime) 536 | { 537 | base.Update(gameTime); 538 | 539 | sharedUI.Update(); 540 | UpdateCheckboxes(); 541 | } 542 | 543 | private string GetTooltipsAsString(ItemTooltip toolTip) 544 | { 545 | StringBuilder sb = new StringBuilder(); 546 | for (int j = 0; j < toolTip.Lines; j++) 547 | { 548 | sb.Append(toolTip.GetLine(j) + "\n"); 549 | } 550 | return sb.ToString().ToLower(); 551 | } 552 | 553 | internal static void OnScrollWheel_FixHotbarScroll(UIScrollWheelEvent evt, UIElement listeningElement) 554 | { 555 | Main.LocalPlayer.ScrollHotbar(Terraria.GameInput.PlayerInput.ScrollWheelDelta / 120); 556 | } 557 | } 558 | 559 | //public enum SortModes 560 | //{ 561 | // ID, 562 | // Value, 563 | // AZ, 564 | // Rare, 565 | // TerrariaSort, 566 | //} 567 | 568 | public class FixedUIScrollbar : UIScrollbar 569 | { 570 | protected override void DrawSelf(SpriteBatch spriteBatch) 571 | { 572 | UserInterface temp = UserInterface.ActiveInstance; 573 | UserInterface.ActiveInstance = ItemChecklist.ItemChecklistInterface; 574 | base.DrawSelf(spriteBatch); 575 | UserInterface.ActiveInstance = temp; 576 | } 577 | 578 | public override void LeftMouseDown(UIMouseEvent evt) 579 | { 580 | UserInterface temp = UserInterface.ActiveInstance; 581 | UserInterface.ActiveInstance = ItemChecklist.ItemChecklistInterface; 582 | base.LeftMouseDown(evt); 583 | UserInterface.ActiveInstance = temp; 584 | } 585 | } 586 | 587 | //public static class Extensions 588 | //{ 589 | // public static string ToFriendlyString(this SortModes sortmode) 590 | // { 591 | // switch (sortmode) 592 | // { 593 | // case SortModes.AZ: 594 | // return "Alphabetically"; 595 | // case SortModes.ID: 596 | // return "ID"; 597 | // case SortModes.Value: 598 | // return "Value"; 599 | // case SortModes.Rare: 600 | // return "Rarity"; 601 | // case SortModes.TerrariaSort: 602 | // return "Terraria Sort"; 603 | // } 604 | // return "Unknown Sort"; 605 | // } 606 | //} 607 | } 608 | -------------------------------------------------------------------------------- /Localization/de-DE_Mods.ItemChecklist.hjson: -------------------------------------------------------------------------------- 1 | Configs: { 2 | ItemChecklistClientConfig: { 3 | ShowItemModSource: { 4 | // Label: Show Item Mod Source 5 | // Tooltip: Show which mod adds which item in the recipe catalog. Disable for immersion. 6 | } 7 | 8 | // DisplayName: Item Checklist Client Config 9 | // Headers.AutomaticSettings: Automatic Settings 10 | 11 | ItemChecklistSize: { 12 | // Label: Item Checklist Size 13 | // Tooltip: Size of the Item Checklist UI. This will automatically save, no need to adjust 14 | } 15 | 16 | ItemChecklistPosition: { 17 | // Label: Item Checklist Position 18 | // Tooltip: Position of the Item Checklist UI. This will automatically save, no need to adjust 19 | } 20 | } 21 | } 22 | 23 | // Keybinds.ToggleItemChecklist.DisplayName: Toggle Item Checklist 24 | // GlobalItem.ItemChecklistAnnounceText: You found your first {0}. {1}/{2} {3}% 25 | 26 | UICollectionBar: { 27 | // collectionTotalText: Total: {0}/{1} ({2}% Collected) 28 | // collectionTerrariaText: Terraria: {0}/{1} ({2}% Collected) 29 | // collectionModText: "{0}: {1}/{2} ({3}% Collected)" 30 | } 31 | 32 | Ui: { 33 | // FilterByTooltipText: Filter by tooltip 34 | // FilterByNameText: Filter by Name 35 | // ToggleCollectChestItemsText: Toggle Collect Chest Items 36 | // ToggleMessagesText: Toggle Messages 37 | // ShowSortValueTextText: Show Sort Value Text 38 | // CycleModFilterText: Cycle Mod Filter: {0} 39 | // CycleFoundFilterText: Cycle Found Filter: {0} 40 | // ModnamesAllText: All 41 | // FoundFilterAllText: All 42 | // FoundFilterUnfoundText: Unfound 43 | // FoundFilterFoundText: Found 44 | // ModnamesVanillaText: Vanilla 45 | } 46 | 47 | SharedUI: { 48 | // mutuallyExclusiveFilterVanityText: Vanity 49 | // mutuallyExclusiveFilterArmorText: Armor 50 | // cycleAmmoTypesText: Cycle Ammo Types 51 | // cycleUsedAmmoTypesText: Cycle Used Ammo Types 52 | // categoryAllText: All 53 | // categoryMeleeText: Melee 54 | // categoryYoyoText: Yoyo 55 | // categoryMagicText: Magic 56 | // categoryRangedText: Ranged 57 | // sortUseAmmoTypeText: Use Ammo Type 58 | // categoryThrowingText: Throwing 59 | // categorySummonText: Summon 60 | // categorySentryText: Sentry 61 | // sortDamageText: Damage 62 | // categoryToolsText: Tools 63 | // categoryPickaxesText: Pickaxes 64 | // categoryAxesText: Axes 65 | // categoryHammersText: Hammers 66 | // categoryArmorText: Armor 67 | // categoryWeaponsText: Weapons 68 | // sortValueText: Value 69 | // sortAlphabeticalText: Alphabetical 70 | // sortRarityText: Rarity 71 | // sortTerrariaSortText: Terraria Sort 72 | // filterMaterialsText: Materials 73 | // sortPickPower: Pick Power 74 | // sortAxePower: Axe Power 75 | // sortHammerPower: Hammer Power 76 | // categoryHead: Head 77 | // categoryBody: Body 78 | // categoryLegs: Legs 79 | // sortDefense: Defense 80 | // categoryTiles: Tiles 81 | // categoryContainersText: Containers 82 | // categoryWiringText: Wiring 83 | // categoryStatuesText: Statues 84 | // categoryDoorsText: Doors 85 | // categoryChairsText: Chairs 86 | // categoryTablesText: Tables 87 | // categoryLightSourcesText: Light Sources 88 | // categoryTorchesText: Torches 89 | // categoryWallsText: Walls 90 | // categoryAccessoriesText: Accessories 91 | // categoryWingsText: Wings 92 | // categoryAmmoText: Ammo 93 | // categoryPotionsText: Potions 94 | // categoryHealthPotionsText: Health Potions 95 | // categoryManaPotionsText: Mana Potions 96 | // categoryBuffPotionsText: Buff Potions 97 | // categoryExpertText: Expert 98 | // categoryPetsText: Pets 99 | // categoryLightPetsText: Light Pets 100 | // categoryMountsText: Mounts 101 | // categoryCartsText: Carts 102 | // categoryHooksText: Hooks 103 | // categoryDyesText: Dyes 104 | // categoryHairDyesText: Hair Dyes 105 | // categoryBossSummonsText: Boss Summons 106 | // categoryConsumablesText: Consumables 107 | // categoryCapturedNPCText: Captured NPC 108 | // categoryFishingText: Fishing 109 | // categoryPolesText: Poles 110 | // categoryBaitText: Bait 111 | // categoryQuestFishText: Quest Fish 112 | // categoryExtractinatorText: Extractinator 113 | // categoryOtherText: Other 114 | // sortItemIdText: ItemID 115 | // sortPlaceTileText: Place Tile 116 | // sortAmmoTypeText: Ammo Type 117 | // sortHealLifeText: Heal Life 118 | // sortHealManaText: Heal Mana 119 | // sortGrappleRangeText: Grapple Range 120 | // sortProgressionOrderText: Progression Order 121 | // sortPolePowerText: Pole Power 122 | // sortBaitPowerText: Bait Power 123 | } 124 | -------------------------------------------------------------------------------- /Localization/en-US_Mods.ItemChecklist.hjson: -------------------------------------------------------------------------------- 1 | Configs: { 2 | ItemChecklistClientConfig: { 3 | ShowItemModSource: { 4 | Label: Show Item Mod Source 5 | Tooltip: Show which mod adds which item in the recipe catalog. Disable for immersion. 6 | } 7 | 8 | DisplayName: Item Checklist Client Config 9 | Headers.AutomaticSettings: Automatic Settings 10 | 11 | ItemChecklistSize: { 12 | Label: Item Checklist Size 13 | Tooltip: Size of the Item Checklist UI. This will automatically save, no need to adjust 14 | } 15 | 16 | ItemChecklistPosition: { 17 | Label: Item Checklist Position 18 | Tooltip: Position of the Item Checklist UI. This will automatically save, no need to adjust 19 | } 20 | } 21 | } 22 | 23 | Keybinds.ToggleItemChecklist.DisplayName: Toggle Item Checklist 24 | GlobalItem.ItemChecklistAnnounceText: You found your first {0}. {1}/{2} {3}% 25 | 26 | UICollectionBar: { 27 | collectionTotalText: Total: {0}/{1} ({2}% Collected) 28 | collectionTerrariaText: Terraria: {0}/{1} ({2}% Collected) 29 | collectionModText: "{0}: {1}/{2} ({3}% Collected)" 30 | } 31 | 32 | Ui: { 33 | FilterByTooltipText: Filter by tooltip 34 | FilterByNameText: Filter by Name 35 | ToggleCollectChestItemsText: Toggle Collect Chest Items 36 | ToggleMessagesText: Toggle Messages 37 | ShowSortValueTextText: Show Sort Value Text 38 | CycleModFilterText: Cycle Mod Filter: {0} 39 | CycleFoundFilterText: Cycle Found Filter: {0} 40 | ModnamesAllText: All 41 | FoundFilterAllText: All 42 | FoundFilterUnfoundText: Unfound 43 | FoundFilterFoundText: Found 44 | ModnamesVanillaText: Vanilla 45 | } 46 | 47 | SharedUI: { 48 | mutuallyExclusiveFilterVanityText: Vanity 49 | mutuallyExclusiveFilterArmorText: Armor 50 | cycleAmmoTypesText: Cycle Ammo Types 51 | cycleUsedAmmoTypesText: Cycle Used Ammo Types 52 | categoryAllText: All 53 | categoryMeleeText: Melee 54 | categoryYoyoText: Yoyo 55 | categoryMagicText: Magic 56 | categoryRangedText: Ranged 57 | sortUseAmmoTypeText: Use Ammo Type 58 | categoryThrowingText: Throwing 59 | categorySummonText: Summon 60 | categorySentryText: Sentry 61 | sortDamageText: Damage 62 | categoryToolsText: Tools 63 | categoryPickaxesText: Pickaxes 64 | categoryAxesText: Axes 65 | categoryHammersText: Hammers 66 | categoryArmorText: Armor 67 | categoryWeaponsText: Weapons 68 | sortValueText: Value 69 | sortAlphabeticalText: Alphabetical 70 | sortRarityText: Rarity 71 | sortTerrariaSortText: Terraria Sort 72 | filterMaterialsText: Materials 73 | sortPickPower: Pick Power 74 | sortAxePower: Axe Power 75 | sortHammerPower: Hammer Power 76 | categoryHead: Head 77 | categoryBody: Body 78 | categoryLegs: Legs 79 | sortDefense: Defense 80 | categoryTiles: Tiles 81 | categoryContainersText: Containers 82 | categoryWiringText: Wiring 83 | categoryStatuesText: Statues 84 | categoryDoorsText: Doors 85 | categoryChairsText: Chairs 86 | categoryTablesText: Tables 87 | categoryLightSourcesText: Light Sources 88 | categoryTorchesText: Torches 89 | categoryWallsText: Walls 90 | categoryAccessoriesText: Accessories 91 | categoryWingsText: Wings 92 | categoryAmmoText: Ammo 93 | categoryPotionsText: Potions 94 | categoryHealthPotionsText: Health Potions 95 | categoryManaPotionsText: Mana Potions 96 | categoryBuffPotionsText: Buff Potions 97 | categoryExpertText: Expert 98 | categoryPetsText: Pets 99 | categoryLightPetsText: Light Pets 100 | categoryMountsText: Mounts 101 | categoryCartsText: Carts 102 | categoryHooksText: Hooks 103 | categoryDyesText: Dyes 104 | categoryHairDyesText: Hair Dyes 105 | categoryBossSummonsText: Boss Summons 106 | categoryConsumablesText: Consumables 107 | categoryCapturedNPCText: Captured NPC 108 | categoryFishingText: Fishing 109 | categoryPolesText: Poles 110 | categoryBaitText: Bait 111 | categoryQuestFishText: Quest Fish 112 | categoryExtractinatorText: Extractinator 113 | categoryOtherText: Other 114 | sortItemIdText: ItemID 115 | sortPlaceTileText: Place Tile 116 | sortAmmoTypeText: Ammo Type 117 | sortHealLifeText: Heal Life 118 | sortHealManaText: Heal Mana 119 | sortGrappleRangeText: Grapple Range 120 | sortProgressionOrderText: Progression Order 121 | sortPolePowerText: Pole Power 122 | sortBaitPowerText: Bait Power 123 | } 124 | -------------------------------------------------------------------------------- /Localization/es-ES_Mods.ItemChecklist.hjson: -------------------------------------------------------------------------------- 1 | Configs: { 2 | ItemChecklistClientConfig: { 3 | ShowItemModSource: { 4 | // Label: Show Item Mod Source 5 | // Tooltip: Show which mod adds which item in the recipe catalog. Disable for immersion. 6 | } 7 | 8 | // DisplayName: Item Checklist Client Config 9 | // Headers.AutomaticSettings: Automatic Settings 10 | 11 | ItemChecklistSize: { 12 | // Label: Item Checklist Size 13 | // Tooltip: Size of the Item Checklist UI. This will automatically save, no need to adjust 14 | } 15 | 16 | ItemChecklistPosition: { 17 | // Label: Item Checklist Position 18 | // Tooltip: Position of the Item Checklist UI. This will automatically save, no need to adjust 19 | } 20 | } 21 | } 22 | 23 | // Keybinds.ToggleItemChecklist.DisplayName: Toggle Item Checklist 24 | // GlobalItem.ItemChecklistAnnounceText: You found your first {0}. {1}/{2} {3}% 25 | 26 | UICollectionBar: { 27 | // collectionTotalText: Total: {0}/{1} ({2}% Collected) 28 | // collectionTerrariaText: Terraria: {0}/{1} ({2}% Collected) 29 | // collectionModText: "{0}: {1}/{2} ({3}% Collected)" 30 | } 31 | 32 | Ui: { 33 | // FilterByTooltipText: Filter by tooltip 34 | // FilterByNameText: Filter by Name 35 | // ToggleCollectChestItemsText: Toggle Collect Chest Items 36 | // ToggleMessagesText: Toggle Messages 37 | // ShowSortValueTextText: Show Sort Value Text 38 | // CycleModFilterText: Cycle Mod Filter: {0} 39 | // CycleFoundFilterText: Cycle Found Filter: {0} 40 | // ModnamesAllText: All 41 | // FoundFilterAllText: All 42 | // FoundFilterUnfoundText: Unfound 43 | // FoundFilterFoundText: Found 44 | // ModnamesVanillaText: Vanilla 45 | } 46 | 47 | SharedUI: { 48 | // mutuallyExclusiveFilterVanityText: Vanity 49 | // mutuallyExclusiveFilterArmorText: Armor 50 | // cycleAmmoTypesText: Cycle Ammo Types 51 | // cycleUsedAmmoTypesText: Cycle Used Ammo Types 52 | // categoryAllText: All 53 | // categoryMeleeText: Melee 54 | // categoryYoyoText: Yoyo 55 | // categoryMagicText: Magic 56 | // categoryRangedText: Ranged 57 | // sortUseAmmoTypeText: Use Ammo Type 58 | // categoryThrowingText: Throwing 59 | // categorySummonText: Summon 60 | // categorySentryText: Sentry 61 | // sortDamageText: Damage 62 | // categoryToolsText: Tools 63 | // categoryPickaxesText: Pickaxes 64 | // categoryAxesText: Axes 65 | // categoryHammersText: Hammers 66 | // categoryArmorText: Armor 67 | // categoryWeaponsText: Weapons 68 | // sortValueText: Value 69 | // sortAlphabeticalText: Alphabetical 70 | // sortRarityText: Rarity 71 | // sortTerrariaSortText: Terraria Sort 72 | // filterMaterialsText: Materials 73 | // sortPickPower: Pick Power 74 | // sortAxePower: Axe Power 75 | // sortHammerPower: Hammer Power 76 | // categoryHead: Head 77 | // categoryBody: Body 78 | // categoryLegs: Legs 79 | // sortDefense: Defense 80 | // categoryTiles: Tiles 81 | // categoryContainersText: Containers 82 | // categoryWiringText: Wiring 83 | // categoryStatuesText: Statues 84 | // categoryDoorsText: Doors 85 | // categoryChairsText: Chairs 86 | // categoryTablesText: Tables 87 | // categoryLightSourcesText: Light Sources 88 | // categoryTorchesText: Torches 89 | // categoryWallsText: Walls 90 | // categoryAccessoriesText: Accessories 91 | // categoryWingsText: Wings 92 | // categoryAmmoText: Ammo 93 | // categoryPotionsText: Potions 94 | // categoryHealthPotionsText: Health Potions 95 | // categoryManaPotionsText: Mana Potions 96 | // categoryBuffPotionsText: Buff Potions 97 | // categoryExpertText: Expert 98 | // categoryPetsText: Pets 99 | // categoryLightPetsText: Light Pets 100 | // categoryMountsText: Mounts 101 | // categoryCartsText: Carts 102 | // categoryHooksText: Hooks 103 | // categoryDyesText: Dyes 104 | // categoryHairDyesText: Hair Dyes 105 | // categoryBossSummonsText: Boss Summons 106 | // categoryConsumablesText: Consumables 107 | // categoryCapturedNPCText: Captured NPC 108 | // categoryFishingText: Fishing 109 | // categoryPolesText: Poles 110 | // categoryBaitText: Bait 111 | // categoryQuestFishText: Quest Fish 112 | // categoryExtractinatorText: Extractinator 113 | // categoryOtherText: Other 114 | // sortItemIdText: ItemID 115 | // sortPlaceTileText: Place Tile 116 | // sortAmmoTypeText: Ammo Type 117 | // sortHealLifeText: Heal Life 118 | // sortHealManaText: Heal Mana 119 | // sortGrappleRangeText: Grapple Range 120 | // sortProgressionOrderText: Progression Order 121 | // sortPolePowerText: Pole Power 122 | // sortBaitPowerText: Bait Power 123 | } 124 | -------------------------------------------------------------------------------- /Localization/fr-FR_Mods.ItemChecklist.hjson: -------------------------------------------------------------------------------- 1 | Configs: { 2 | ItemChecklistClientConfig: { 3 | ShowItemModSource: { 4 | // Label: Show Item Mod Source 5 | // Tooltip: Show which mod adds which item in the recipe catalog. Disable for immersion. 6 | } 7 | 8 | // DisplayName: Item Checklist Client Config 9 | // Headers.AutomaticSettings: Automatic Settings 10 | 11 | ItemChecklistSize: { 12 | // Label: Item Checklist Size 13 | // Tooltip: Size of the Item Checklist UI. This will automatically save, no need to adjust 14 | } 15 | 16 | ItemChecklistPosition: { 17 | // Label: Item Checklist Position 18 | // Tooltip: Position of the Item Checklist UI. This will automatically save, no need to adjust 19 | } 20 | } 21 | } 22 | 23 | // Keybinds.ToggleItemChecklist.DisplayName: Toggle Item Checklist 24 | // GlobalItem.ItemChecklistAnnounceText: You found your first {0}. {1}/{2} {3}% 25 | 26 | UICollectionBar: { 27 | // collectionTotalText: Total: {0}/{1} ({2}% Collected) 28 | // collectionTerrariaText: Terraria: {0}/{1} ({2}% Collected) 29 | // collectionModText: "{0}: {1}/{2} ({3}% Collected)" 30 | } 31 | 32 | Ui: { 33 | // FilterByTooltipText: Filter by tooltip 34 | // FilterByNameText: Filter by Name 35 | // ToggleCollectChestItemsText: Toggle Collect Chest Items 36 | // ToggleMessagesText: Toggle Messages 37 | // ShowSortValueTextText: Show Sort Value Text 38 | // CycleModFilterText: Cycle Mod Filter: {0} 39 | // CycleFoundFilterText: Cycle Found Filter: {0} 40 | // ModnamesAllText: All 41 | // FoundFilterAllText: All 42 | // FoundFilterUnfoundText: Unfound 43 | // FoundFilterFoundText: Found 44 | // ModnamesVanillaText: Vanilla 45 | } 46 | 47 | SharedUI: { 48 | // mutuallyExclusiveFilterVanityText: Vanity 49 | // mutuallyExclusiveFilterArmorText: Armor 50 | // cycleAmmoTypesText: Cycle Ammo Types 51 | // cycleUsedAmmoTypesText: Cycle Used Ammo Types 52 | // categoryAllText: All 53 | // categoryMeleeText: Melee 54 | // categoryYoyoText: Yoyo 55 | // categoryMagicText: Magic 56 | // categoryRangedText: Ranged 57 | // sortUseAmmoTypeText: Use Ammo Type 58 | // categoryThrowingText: Throwing 59 | // categorySummonText: Summon 60 | // categorySentryText: Sentry 61 | // sortDamageText: Damage 62 | // categoryToolsText: Tools 63 | // categoryPickaxesText: Pickaxes 64 | // categoryAxesText: Axes 65 | // categoryHammersText: Hammers 66 | // categoryArmorText: Armor 67 | // categoryWeaponsText: Weapons 68 | // sortValueText: Value 69 | // sortAlphabeticalText: Alphabetical 70 | // sortRarityText: Rarity 71 | // sortTerrariaSortText: Terraria Sort 72 | // filterMaterialsText: Materials 73 | // sortPickPower: Pick Power 74 | // sortAxePower: Axe Power 75 | // sortHammerPower: Hammer Power 76 | // categoryHead: Head 77 | // categoryBody: Body 78 | // categoryLegs: Legs 79 | // sortDefense: Defense 80 | // categoryTiles: Tiles 81 | // categoryContainersText: Containers 82 | // categoryWiringText: Wiring 83 | // categoryStatuesText: Statues 84 | // categoryDoorsText: Doors 85 | // categoryChairsText: Chairs 86 | // categoryTablesText: Tables 87 | // categoryLightSourcesText: Light Sources 88 | // categoryTorchesText: Torches 89 | // categoryWallsText: Walls 90 | // categoryAccessoriesText: Accessories 91 | // categoryWingsText: Wings 92 | // categoryAmmoText: Ammo 93 | // categoryPotionsText: Potions 94 | // categoryHealthPotionsText: Health Potions 95 | // categoryManaPotionsText: Mana Potions 96 | // categoryBuffPotionsText: Buff Potions 97 | // categoryExpertText: Expert 98 | // categoryPetsText: Pets 99 | // categoryLightPetsText: Light Pets 100 | // categoryMountsText: Mounts 101 | // categoryCartsText: Carts 102 | // categoryHooksText: Hooks 103 | // categoryDyesText: Dyes 104 | // categoryHairDyesText: Hair Dyes 105 | // categoryBossSummonsText: Boss Summons 106 | // categoryConsumablesText: Consumables 107 | // categoryCapturedNPCText: Captured NPC 108 | // categoryFishingText: Fishing 109 | // categoryPolesText: Poles 110 | // categoryBaitText: Bait 111 | // categoryQuestFishText: Quest Fish 112 | // categoryExtractinatorText: Extractinator 113 | // categoryOtherText: Other 114 | // sortItemIdText: ItemID 115 | // sortPlaceTileText: Place Tile 116 | // sortAmmoTypeText: Ammo Type 117 | // sortHealLifeText: Heal Life 118 | // sortHealManaText: Heal Mana 119 | // sortGrappleRangeText: Grapple Range 120 | // sortProgressionOrderText: Progression Order 121 | // sortPolePowerText: Pole Power 122 | // sortBaitPowerText: Bait Power 123 | } 124 | -------------------------------------------------------------------------------- /Localization/it-IT_Mods.ItemChecklist.hjson: -------------------------------------------------------------------------------- 1 | Configs: { 2 | ItemChecklistClientConfig: { 3 | ShowItemModSource: { 4 | // Label: Show Item Mod Source 5 | // Tooltip: Show which mod adds which item in the recipe catalog. Disable for immersion. 6 | } 7 | 8 | // DisplayName: Item Checklist Client Config 9 | // Headers.AutomaticSettings: Automatic Settings 10 | 11 | ItemChecklistSize: { 12 | // Label: Item Checklist Size 13 | // Tooltip: Size of the Item Checklist UI. This will automatically save, no need to adjust 14 | } 15 | 16 | ItemChecklistPosition: { 17 | // Label: Item Checklist Position 18 | // Tooltip: Position of the Item Checklist UI. This will automatically save, no need to adjust 19 | } 20 | } 21 | } 22 | 23 | // Keybinds.ToggleItemChecklist.DisplayName: Toggle Item Checklist 24 | // GlobalItem.ItemChecklistAnnounceText: You found your first {0}. {1}/{2} {3}% 25 | 26 | UICollectionBar: { 27 | // collectionTotalText: Total: {0}/{1} ({2}% Collected) 28 | // collectionTerrariaText: Terraria: {0}/{1} ({2}% Collected) 29 | // collectionModText: "{0}: {1}/{2} ({3}% Collected)" 30 | } 31 | 32 | Ui: { 33 | // FilterByTooltipText: Filter by tooltip 34 | // FilterByNameText: Filter by Name 35 | // ToggleCollectChestItemsText: Toggle Collect Chest Items 36 | // ToggleMessagesText: Toggle Messages 37 | // ShowSortValueTextText: Show Sort Value Text 38 | // CycleModFilterText: Cycle Mod Filter: {0} 39 | // CycleFoundFilterText: Cycle Found Filter: {0} 40 | // ModnamesAllText: All 41 | // FoundFilterAllText: All 42 | // FoundFilterUnfoundText: Unfound 43 | // FoundFilterFoundText: Found 44 | // ModnamesVanillaText: Vanilla 45 | } 46 | 47 | SharedUI: { 48 | // mutuallyExclusiveFilterVanityText: Vanity 49 | // mutuallyExclusiveFilterArmorText: Armor 50 | // cycleAmmoTypesText: Cycle Ammo Types 51 | // cycleUsedAmmoTypesText: Cycle Used Ammo Types 52 | // categoryAllText: All 53 | // categoryMeleeText: Melee 54 | // categoryYoyoText: Yoyo 55 | // categoryMagicText: Magic 56 | // categoryRangedText: Ranged 57 | // sortUseAmmoTypeText: Use Ammo Type 58 | // categoryThrowingText: Throwing 59 | // categorySummonText: Summon 60 | // categorySentryText: Sentry 61 | // sortDamageText: Damage 62 | // categoryToolsText: Tools 63 | // categoryPickaxesText: Pickaxes 64 | // categoryAxesText: Axes 65 | // categoryHammersText: Hammers 66 | // categoryArmorText: Armor 67 | // categoryWeaponsText: Weapons 68 | // sortValueText: Value 69 | // sortAlphabeticalText: Alphabetical 70 | // sortRarityText: Rarity 71 | // sortTerrariaSortText: Terraria Sort 72 | // filterMaterialsText: Materials 73 | // sortPickPower: Pick Power 74 | // sortAxePower: Axe Power 75 | // sortHammerPower: Hammer Power 76 | // categoryHead: Head 77 | // categoryBody: Body 78 | // categoryLegs: Legs 79 | // sortDefense: Defense 80 | // categoryTiles: Tiles 81 | // categoryContainersText: Containers 82 | // categoryWiringText: Wiring 83 | // categoryStatuesText: Statues 84 | // categoryDoorsText: Doors 85 | // categoryChairsText: Chairs 86 | // categoryTablesText: Tables 87 | // categoryLightSourcesText: Light Sources 88 | // categoryTorchesText: Torches 89 | // categoryWallsText: Walls 90 | // categoryAccessoriesText: Accessories 91 | // categoryWingsText: Wings 92 | // categoryAmmoText: Ammo 93 | // categoryPotionsText: Potions 94 | // categoryHealthPotionsText: Health Potions 95 | // categoryManaPotionsText: Mana Potions 96 | // categoryBuffPotionsText: Buff Potions 97 | // categoryExpertText: Expert 98 | // categoryPetsText: Pets 99 | // categoryLightPetsText: Light Pets 100 | // categoryMountsText: Mounts 101 | // categoryCartsText: Carts 102 | // categoryHooksText: Hooks 103 | // categoryDyesText: Dyes 104 | // categoryHairDyesText: Hair Dyes 105 | // categoryBossSummonsText: Boss Summons 106 | // categoryConsumablesText: Consumables 107 | // categoryCapturedNPCText: Captured NPC 108 | // categoryFishingText: Fishing 109 | // categoryPolesText: Poles 110 | // categoryBaitText: Bait 111 | // categoryQuestFishText: Quest Fish 112 | // categoryExtractinatorText: Extractinator 113 | // categoryOtherText: Other 114 | // sortItemIdText: ItemID 115 | // sortPlaceTileText: Place Tile 116 | // sortAmmoTypeText: Ammo Type 117 | // sortHealLifeText: Heal Life 118 | // sortHealManaText: Heal Mana 119 | // sortGrappleRangeText: Grapple Range 120 | // sortProgressionOrderText: Progression Order 121 | // sortPolePowerText: Pole Power 122 | // sortBaitPowerText: Bait Power 123 | } 124 | -------------------------------------------------------------------------------- /Localization/pl-PL_Mods.ItemChecklist.hjson: -------------------------------------------------------------------------------- 1 | Configs: { 2 | ItemChecklistClientConfig: { 3 | ShowItemModSource: { 4 | // Label: Show Item Mod Source 5 | // Tooltip: Show which mod adds which item in the recipe catalog. Disable for immersion. 6 | } 7 | 8 | // DisplayName: Item Checklist Client Config 9 | // Headers.AutomaticSettings: Automatic Settings 10 | 11 | ItemChecklistSize: { 12 | // Label: Item Checklist Size 13 | // Tooltip: Size of the Item Checklist UI. This will automatically save, no need to adjust 14 | } 15 | 16 | ItemChecklistPosition: { 17 | // Label: Item Checklist Position 18 | // Tooltip: Position of the Item Checklist UI. This will automatically save, no need to adjust 19 | } 20 | } 21 | } 22 | 23 | // Keybinds.ToggleItemChecklist.DisplayName: Toggle Item Checklist 24 | // GlobalItem.ItemChecklistAnnounceText: You found your first {0}. {1}/{2} {3}% 25 | 26 | UICollectionBar: { 27 | // collectionTotalText: Total: {0}/{1} ({2}% Collected) 28 | // collectionTerrariaText: Terraria: {0}/{1} ({2}% Collected) 29 | // collectionModText: "{0}: {1}/{2} ({3}% Collected)" 30 | } 31 | 32 | Ui: { 33 | // FilterByTooltipText: Filter by tooltip 34 | // FilterByNameText: Filter by Name 35 | // ToggleCollectChestItemsText: Toggle Collect Chest Items 36 | // ToggleMessagesText: Toggle Messages 37 | // ShowSortValueTextText: Show Sort Value Text 38 | // CycleModFilterText: Cycle Mod Filter: {0} 39 | // CycleFoundFilterText: Cycle Found Filter: {0} 40 | // ModnamesAllText: All 41 | // FoundFilterAllText: All 42 | // FoundFilterUnfoundText: Unfound 43 | // FoundFilterFoundText: Found 44 | // ModnamesVanillaText: Vanilla 45 | } 46 | 47 | SharedUI: { 48 | // mutuallyExclusiveFilterVanityText: Vanity 49 | // mutuallyExclusiveFilterArmorText: Armor 50 | // cycleAmmoTypesText: Cycle Ammo Types 51 | // cycleUsedAmmoTypesText: Cycle Used Ammo Types 52 | // categoryAllText: All 53 | // categoryMeleeText: Melee 54 | // categoryYoyoText: Yoyo 55 | // categoryMagicText: Magic 56 | // categoryRangedText: Ranged 57 | // sortUseAmmoTypeText: Use Ammo Type 58 | // categoryThrowingText: Throwing 59 | // categorySummonText: Summon 60 | // categorySentryText: Sentry 61 | // sortDamageText: Damage 62 | // categoryToolsText: Tools 63 | // categoryPickaxesText: Pickaxes 64 | // categoryAxesText: Axes 65 | // categoryHammersText: Hammers 66 | // categoryArmorText: Armor 67 | // categoryWeaponsText: Weapons 68 | // sortValueText: Value 69 | // sortAlphabeticalText: Alphabetical 70 | // sortRarityText: Rarity 71 | // sortTerrariaSortText: Terraria Sort 72 | // filterMaterialsText: Materials 73 | // sortPickPower: Pick Power 74 | // sortAxePower: Axe Power 75 | // sortHammerPower: Hammer Power 76 | // categoryHead: Head 77 | // categoryBody: Body 78 | // categoryLegs: Legs 79 | // sortDefense: Defense 80 | // categoryTiles: Tiles 81 | // categoryContainersText: Containers 82 | // categoryWiringText: Wiring 83 | // categoryStatuesText: Statues 84 | // categoryDoorsText: Doors 85 | // categoryChairsText: Chairs 86 | // categoryTablesText: Tables 87 | // categoryLightSourcesText: Light Sources 88 | // categoryTorchesText: Torches 89 | // categoryWallsText: Walls 90 | // categoryAccessoriesText: Accessories 91 | // categoryWingsText: Wings 92 | // categoryAmmoText: Ammo 93 | // categoryPotionsText: Potions 94 | // categoryHealthPotionsText: Health Potions 95 | // categoryManaPotionsText: Mana Potions 96 | // categoryBuffPotionsText: Buff Potions 97 | // categoryExpertText: Expert 98 | // categoryPetsText: Pets 99 | // categoryLightPetsText: Light Pets 100 | // categoryMountsText: Mounts 101 | // categoryCartsText: Carts 102 | // categoryHooksText: Hooks 103 | // categoryDyesText: Dyes 104 | // categoryHairDyesText: Hair Dyes 105 | // categoryBossSummonsText: Boss Summons 106 | // categoryConsumablesText: Consumables 107 | // categoryCapturedNPCText: Captured NPC 108 | // categoryFishingText: Fishing 109 | // categoryPolesText: Poles 110 | // categoryBaitText: Bait 111 | // categoryQuestFishText: Quest Fish 112 | // categoryExtractinatorText: Extractinator 113 | // categoryOtherText: Other 114 | // sortItemIdText: ItemID 115 | // sortPlaceTileText: Place Tile 116 | // sortAmmoTypeText: Ammo Type 117 | // sortHealLifeText: Heal Life 118 | // sortHealManaText: Heal Mana 119 | // sortGrappleRangeText: Grapple Range 120 | // sortProgressionOrderText: Progression Order 121 | // sortPolePowerText: Pole Power 122 | // sortBaitPowerText: Bait Power 123 | } 124 | -------------------------------------------------------------------------------- /Localization/pt-BR_Mods.ItemChecklist.hjson: -------------------------------------------------------------------------------- 1 | Configs: { 2 | ItemChecklistClientConfig: { 3 | ShowItemModSource: { 4 | // Label: Show Item Mod Source 5 | // Tooltip: Show which mod adds which item in the recipe catalog. Disable for immersion. 6 | } 7 | 8 | // DisplayName: Item Checklist Client Config 9 | // Headers.AutomaticSettings: Automatic Settings 10 | 11 | ItemChecklistSize: { 12 | // Label: Item Checklist Size 13 | // Tooltip: Size of the Item Checklist UI. This will automatically save, no need to adjust 14 | } 15 | 16 | ItemChecklistPosition: { 17 | // Label: Item Checklist Position 18 | // Tooltip: Position of the Item Checklist UI. This will automatically save, no need to adjust 19 | } 20 | } 21 | } 22 | 23 | // Keybinds.ToggleItemChecklist.DisplayName: Toggle Item Checklist 24 | // GlobalItem.ItemChecklistAnnounceText: You found your first {0}. {1}/{2} {3}% 25 | 26 | UICollectionBar: { 27 | // collectionTotalText: Total: {0}/{1} ({2}% Collected) 28 | // collectionTerrariaText: Terraria: {0}/{1} ({2}% Collected) 29 | // collectionModText: "{0}: {1}/{2} ({3}% Collected)" 30 | } 31 | 32 | Ui: { 33 | // FilterByTooltipText: Filter by tooltip 34 | // FilterByNameText: Filter by Name 35 | // ToggleCollectChestItemsText: Toggle Collect Chest Items 36 | // ToggleMessagesText: Toggle Messages 37 | // ShowSortValueTextText: Show Sort Value Text 38 | // CycleModFilterText: Cycle Mod Filter: {0} 39 | // CycleFoundFilterText: Cycle Found Filter: {0} 40 | // ModnamesAllText: All 41 | // FoundFilterAllText: All 42 | // FoundFilterUnfoundText: Unfound 43 | // FoundFilterFoundText: Found 44 | // ModnamesVanillaText: Vanilla 45 | } 46 | 47 | SharedUI: { 48 | // mutuallyExclusiveFilterVanityText: Vanity 49 | // mutuallyExclusiveFilterArmorText: Armor 50 | // cycleAmmoTypesText: Cycle Ammo Types 51 | // cycleUsedAmmoTypesText: Cycle Used Ammo Types 52 | // categoryAllText: All 53 | // categoryMeleeText: Melee 54 | // categoryYoyoText: Yoyo 55 | // categoryMagicText: Magic 56 | // categoryRangedText: Ranged 57 | // sortUseAmmoTypeText: Use Ammo Type 58 | // categoryThrowingText: Throwing 59 | // categorySummonText: Summon 60 | // categorySentryText: Sentry 61 | // sortDamageText: Damage 62 | // categoryToolsText: Tools 63 | // categoryPickaxesText: Pickaxes 64 | // categoryAxesText: Axes 65 | // categoryHammersText: Hammers 66 | // categoryArmorText: Armor 67 | // categoryWeaponsText: Weapons 68 | // sortValueText: Value 69 | // sortAlphabeticalText: Alphabetical 70 | // sortRarityText: Rarity 71 | // sortTerrariaSortText: Terraria Sort 72 | // filterMaterialsText: Materials 73 | // sortPickPower: Pick Power 74 | // sortAxePower: Axe Power 75 | // sortHammerPower: Hammer Power 76 | // categoryHead: Head 77 | // categoryBody: Body 78 | // categoryLegs: Legs 79 | // sortDefense: Defense 80 | // categoryTiles: Tiles 81 | // categoryContainersText: Containers 82 | // categoryWiringText: Wiring 83 | // categoryStatuesText: Statues 84 | // categoryDoorsText: Doors 85 | // categoryChairsText: Chairs 86 | // categoryTablesText: Tables 87 | // categoryLightSourcesText: Light Sources 88 | // categoryTorchesText: Torches 89 | // categoryWallsText: Walls 90 | // categoryAccessoriesText: Accessories 91 | // categoryWingsText: Wings 92 | // categoryAmmoText: Ammo 93 | // categoryPotionsText: Potions 94 | // categoryHealthPotionsText: Health Potions 95 | // categoryManaPotionsText: Mana Potions 96 | // categoryBuffPotionsText: Buff Potions 97 | // categoryExpertText: Expert 98 | // categoryPetsText: Pets 99 | // categoryLightPetsText: Light Pets 100 | // categoryMountsText: Mounts 101 | // categoryCartsText: Carts 102 | // categoryHooksText: Hooks 103 | // categoryDyesText: Dyes 104 | // categoryHairDyesText: Hair Dyes 105 | // categoryBossSummonsText: Boss Summons 106 | // categoryConsumablesText: Consumables 107 | // categoryCapturedNPCText: Captured NPC 108 | // categoryFishingText: Fishing 109 | // categoryPolesText: Poles 110 | // categoryBaitText: Bait 111 | // categoryQuestFishText: Quest Fish 112 | // categoryExtractinatorText: Extractinator 113 | // categoryOtherText: Other 114 | // sortItemIdText: ItemID 115 | // sortPlaceTileText: Place Tile 116 | // sortAmmoTypeText: Ammo Type 117 | // sortHealLifeText: Heal Life 118 | // sortHealManaText: Heal Mana 119 | // sortGrappleRangeText: Grapple Range 120 | // sortProgressionOrderText: Progression Order 121 | // sortPolePowerText: Pole Power 122 | // sortBaitPowerText: Bait Power 123 | } 124 | -------------------------------------------------------------------------------- /Localization/ru-RU_Mods.ItemChecklist.hjson: -------------------------------------------------------------------------------- 1 | Configs: { 2 | ItemChecklistClientConfig: { 3 | ShowItemModSource: { 4 | // Label: Show Item Mod Source 5 | // Tooltip: Show which mod adds which item in the recipe catalog. Disable for immersion. 6 | } 7 | 8 | // DisplayName: Item Checklist Client Config 9 | // Headers.AutomaticSettings: Automatic Settings 10 | 11 | ItemChecklistSize: { 12 | // Label: Item Checklist Size 13 | // Tooltip: Size of the Item Checklist UI. This will automatically save, no need to adjust 14 | } 15 | 16 | ItemChecklistPosition: { 17 | // Label: Item Checklist Position 18 | // Tooltip: Position of the Item Checklist UI. This will automatically save, no need to adjust 19 | } 20 | } 21 | } 22 | 23 | // Keybinds.ToggleItemChecklist.DisplayName: Toggle Item Checklist 24 | // GlobalItem.ItemChecklistAnnounceText: You found your first {0}. {1}/{2} {3}% 25 | 26 | UICollectionBar: { 27 | // collectionTotalText: Total: {0}/{1} ({2}% Collected) 28 | // collectionTerrariaText: Terraria: {0}/{1} ({2}% Collected) 29 | // collectionModText: "{0}: {1}/{2} ({3}% Collected)" 30 | } 31 | 32 | Ui: { 33 | // FilterByTooltipText: Filter by tooltip 34 | // FilterByNameText: Filter by Name 35 | // ToggleCollectChestItemsText: Toggle Collect Chest Items 36 | // ToggleMessagesText: Toggle Messages 37 | // ShowSortValueTextText: Show Sort Value Text 38 | // CycleModFilterText: Cycle Mod Filter: {0} 39 | // CycleFoundFilterText: Cycle Found Filter: {0} 40 | // ModnamesAllText: All 41 | // FoundFilterAllText: All 42 | // FoundFilterUnfoundText: Unfound 43 | // FoundFilterFoundText: Found 44 | // ModnamesVanillaText: Vanilla 45 | } 46 | 47 | SharedUI: { 48 | // mutuallyExclusiveFilterVanityText: Vanity 49 | // mutuallyExclusiveFilterArmorText: Armor 50 | // cycleAmmoTypesText: Cycle Ammo Types 51 | // cycleUsedAmmoTypesText: Cycle Used Ammo Types 52 | // categoryAllText: All 53 | // categoryMeleeText: Melee 54 | // categoryYoyoText: Yoyo 55 | // categoryMagicText: Magic 56 | // categoryRangedText: Ranged 57 | // sortUseAmmoTypeText: Use Ammo Type 58 | // categoryThrowingText: Throwing 59 | // categorySummonText: Summon 60 | // categorySentryText: Sentry 61 | // sortDamageText: Damage 62 | // categoryToolsText: Tools 63 | // categoryPickaxesText: Pickaxes 64 | // categoryAxesText: Axes 65 | // categoryHammersText: Hammers 66 | // categoryArmorText: Armor 67 | // categoryWeaponsText: Weapons 68 | // sortValueText: Value 69 | // sortAlphabeticalText: Alphabetical 70 | // sortRarityText: Rarity 71 | // sortTerrariaSortText: Terraria Sort 72 | // filterMaterialsText: Materials 73 | // sortPickPower: Pick Power 74 | // sortAxePower: Axe Power 75 | // sortHammerPower: Hammer Power 76 | // categoryHead: Head 77 | // categoryBody: Body 78 | // categoryLegs: Legs 79 | // sortDefense: Defense 80 | // categoryTiles: Tiles 81 | // categoryContainersText: Containers 82 | // categoryWiringText: Wiring 83 | // categoryStatuesText: Statues 84 | // categoryDoorsText: Doors 85 | // categoryChairsText: Chairs 86 | // categoryTablesText: Tables 87 | // categoryLightSourcesText: Light Sources 88 | // categoryTorchesText: Torches 89 | // categoryWallsText: Walls 90 | // categoryAccessoriesText: Accessories 91 | // categoryWingsText: Wings 92 | // categoryAmmoText: Ammo 93 | // categoryPotionsText: Potions 94 | // categoryHealthPotionsText: Health Potions 95 | // categoryManaPotionsText: Mana Potions 96 | // categoryBuffPotionsText: Buff Potions 97 | // categoryExpertText: Expert 98 | // categoryPetsText: Pets 99 | // categoryLightPetsText: Light Pets 100 | // categoryMountsText: Mounts 101 | // categoryCartsText: Carts 102 | // categoryHooksText: Hooks 103 | // categoryDyesText: Dyes 104 | // categoryHairDyesText: Hair Dyes 105 | // categoryBossSummonsText: Boss Summons 106 | // categoryConsumablesText: Consumables 107 | // categoryCapturedNPCText: Captured NPC 108 | // categoryFishingText: Fishing 109 | // categoryPolesText: Poles 110 | // categoryBaitText: Bait 111 | // categoryQuestFishText: Quest Fish 112 | // categoryExtractinatorText: Extractinator 113 | // categoryOtherText: Other 114 | // sortItemIdText: ItemID 115 | // sortPlaceTileText: Place Tile 116 | // sortAmmoTypeText: Ammo Type 117 | // sortHealLifeText: Heal Life 118 | // sortHealManaText: Heal Mana 119 | // sortGrappleRangeText: Grapple Range 120 | // sortProgressionOrderText: Progression Order 121 | // sortPolePowerText: Pole Power 122 | // sortBaitPowerText: Bait Power 123 | } 124 | -------------------------------------------------------------------------------- /Localization/zh-Hans_Mods.ItemChecklist.hjson: -------------------------------------------------------------------------------- 1 | Configs: { 2 | ItemChecklistClientConfig: { 3 | ShowItemModSource: { 4 | // Label: Show Item Mod Source 5 | // Tooltip: Show which mod adds which item in the recipe catalog. Disable for immersion. 6 | } 7 | 8 | // DisplayName: Item Checklist Client Config 9 | // Headers.AutomaticSettings: Automatic Settings 10 | 11 | ItemChecklistSize: { 12 | // Label: Item Checklist Size 13 | // Tooltip: Size of the Item Checklist UI. This will automatically save, no need to adjust 14 | } 15 | 16 | ItemChecklistPosition: { 17 | // Label: Item Checklist Position 18 | // Tooltip: Position of the Item Checklist UI. This will automatically save, no need to adjust 19 | } 20 | } 21 | } 22 | 23 | // Keybinds.ToggleItemChecklist.DisplayName: Toggle Item Checklist 24 | // GlobalItem.ItemChecklistAnnounceText: You found your first {0}. {1}/{2} {3}% 25 | 26 | UICollectionBar: { 27 | // collectionTotalText: Total: {0}/{1} ({2}% Collected) 28 | // collectionTerrariaText: Terraria: {0}/{1} ({2}% Collected) 29 | // collectionModText: "{0}: {1}/{2} ({3}% Collected)" 30 | } 31 | 32 | Ui: { 33 | // FilterByTooltipText: Filter by tooltip 34 | // FilterByNameText: Filter by Name 35 | // ToggleCollectChestItemsText: Toggle Collect Chest Items 36 | // ToggleMessagesText: Toggle Messages 37 | // ShowSortValueTextText: Show Sort Value Text 38 | // CycleModFilterText: Cycle Mod Filter: {0} 39 | // CycleFoundFilterText: Cycle Found Filter: {0} 40 | // ModnamesAllText: All 41 | // FoundFilterAllText: All 42 | // FoundFilterUnfoundText: Unfound 43 | // FoundFilterFoundText: Found 44 | // ModnamesVanillaText: Vanilla 45 | } 46 | 47 | SharedUI: { 48 | // mutuallyExclusiveFilterVanityText: Vanity 49 | // mutuallyExclusiveFilterArmorText: Armor 50 | // cycleAmmoTypesText: Cycle Ammo Types 51 | // cycleUsedAmmoTypesText: Cycle Used Ammo Types 52 | // categoryAllText: All 53 | // categoryMeleeText: Melee 54 | // categoryYoyoText: Yoyo 55 | // categoryMagicText: Magic 56 | // categoryRangedText: Ranged 57 | // sortUseAmmoTypeText: Use Ammo Type 58 | // categoryThrowingText: Throwing 59 | // categorySummonText: Summon 60 | // categorySentryText: Sentry 61 | // sortDamageText: Damage 62 | // categoryToolsText: Tools 63 | // categoryPickaxesText: Pickaxes 64 | // categoryAxesText: Axes 65 | // categoryHammersText: Hammers 66 | // categoryArmorText: Armor 67 | // categoryWeaponsText: Weapons 68 | // sortValueText: Value 69 | // sortAlphabeticalText: Alphabetical 70 | // sortRarityText: Rarity 71 | // sortTerrariaSortText: Terraria Sort 72 | // filterMaterialsText: Materials 73 | // sortPickPower: Pick Power 74 | // sortAxePower: Axe Power 75 | // sortHammerPower: Hammer Power 76 | // categoryHead: Head 77 | // categoryBody: Body 78 | // categoryLegs: Legs 79 | // sortDefense: Defense 80 | // categoryTiles: Tiles 81 | // categoryContainersText: Containers 82 | // categoryWiringText: Wiring 83 | // categoryStatuesText: Statues 84 | // categoryDoorsText: Doors 85 | // categoryChairsText: Chairs 86 | // categoryTablesText: Tables 87 | // categoryLightSourcesText: Light Sources 88 | // categoryTorchesText: Torches 89 | // categoryWallsText: Walls 90 | // categoryAccessoriesText: Accessories 91 | // categoryWingsText: Wings 92 | // categoryAmmoText: Ammo 93 | // categoryPotionsText: Potions 94 | // categoryHealthPotionsText: Health Potions 95 | // categoryManaPotionsText: Mana Potions 96 | // categoryBuffPotionsText: Buff Potions 97 | // categoryExpertText: Expert 98 | // categoryPetsText: Pets 99 | // categoryLightPetsText: Light Pets 100 | // categoryMountsText: Mounts 101 | // categoryCartsText: Carts 102 | // categoryHooksText: Hooks 103 | // categoryDyesText: Dyes 104 | // categoryHairDyesText: Hair Dyes 105 | // categoryBossSummonsText: Boss Summons 106 | // categoryConsumablesText: Consumables 107 | // categoryCapturedNPCText: Captured NPC 108 | // categoryFishingText: Fishing 109 | // categoryPolesText: Poles 110 | // categoryBaitText: Bait 111 | // categoryQuestFishText: Quest Fish 112 | // categoryExtractinatorText: Extractinator 113 | // categoryOtherText: Other 114 | // sortItemIdText: ItemID 115 | // sortPlaceTileText: Place Tile 116 | // sortAmmoTypeText: Ammo Type 117 | // sortHealLifeText: Heal Life 118 | // sortHealManaText: Heal Mana 119 | // sortGrappleRangeText: Grapple Range 120 | // sortProgressionOrderText: Progression Order 121 | // sortPolePowerText: Pole Power 122 | // sortBaitPowerText: Bait Power 123 | } 124 | -------------------------------------------------------------------------------- /MagicStorageIntegration.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.CompilerServices; 2 | using MagicStorage; 3 | using MagicStorage.Components; 4 | using Terraria; 5 | using Terraria.DataStructures; 6 | using Terraria.ModLoader; 7 | 8 | namespace ItemChecklist 9 | { 10 | // This code can be used as an example of weak references. 11 | // The most important part of weak references is remembering to test your mod with the referenced .tmod file deleted and a fresh start of tModLoader. (To clear the loaded assemblies.) 12 | // If you do not, the mod might crash. Testing on non-windows machines is also important. 13 | // Here we show a few pitfalls that might cause a TypeInitializationException to be thrown. 14 | // Remember, you have to gate all access to Types and Methods defined in the weakly referenced mod or it will crash. 15 | // All calls to methods in this class by this mod besides Load and Unload are gated with a check to Enabled. 16 | [JITWhenModsEnabled("MagicStorage")] 17 | static class MagicStorageIntegration 18 | { 19 | // Here we store a reference to the MagicStorage Mod instance. We can use it for many things. 20 | // You can call all the Mod methods on it just like we do with our own Mod instance: MagicStorage.ItemType("ShadowDiamond") 21 | static Mod MagicStorage; 22 | 23 | // Here we define a bool property to quickly check if MagicStorage is loaded. 24 | public static bool Enabled => MagicStorage != null; 25 | // Below is an alternate approach to the Enabled property seen above. 26 | // To make sure an up-to-date version of the referenced mod is being used, usually we write "MagicStorage@0.4.3.1" in build.txt. 27 | // This, however, would throw an error if the 0.4.1 were loaded. 28 | // This approach, with the @0.4.3.1 removed from the weakReferences in build.txt and the Version check added to Enabled below, 29 | // allows older versions of MagicStorage to load alongside this mod even though the integration won't work. 30 | // Usually letting tModLoader handle the version requirement and forcing your users to update their mods is easier and better. 31 | //public static bool Enabled => MagicStorage != null && MagicStorage.Version >= new Version(0, 4, 3, 1); 32 | 33 | static Point16 previousStorageAccess = new Point16(-1, -1); 34 | 35 | // Here is an example of using Types in MagicStorage. Note the special approaches that must be made with weak referenced Mods. 36 | //static StorageAccess tile = null; // Assigning a class/static field, even to null, will throw TypeInitializationException 37 | //static StorageAccess tile; // Not assigning a field seems to work, but actually crashes on Mono (Mac/Linux). 38 | // The solution that works is an inner class (Or non-inner, doesn't matter). Here we use a static class, but a non-static class could also be used if more convenient (using a constructor, unloading everything at once). 39 | static class MagicStorageIntegrationMembers 40 | { 41 | internal static StorageAccess tile; 42 | } 43 | //static MagicStorageIntegrationMembers members; 44 | //class MagicStorageIntegrationMembers 45 | //{ 46 | // internal StorageAccess tile; 47 | //} 48 | 49 | public static void Load() 50 | { 51 | ModLoader.TryGetMod("MagicStorage", out MagicStorage); 52 | if (Enabled) 53 | //MagicStorageIntegrationMembers.tile = null; // Will also crash. Here even though Enabled will be false, the Type of tile will still need to be resolved when this method runs. 54 | //members = new MagicStorageIntegrationMembers(); // Even thought the Type StorageAccess is hidden behind MagicStorageIntegrationMembers, this line will also cause MagicStorageIntegrationMembers and consequently StorageAccess to need to be resolved. 55 | Initialize(); // Move that logic into another method to prevent this. 56 | } 57 | 58 | // Be aware of inlining. Inlining can happen at the whim of the runtime. Without this Attribute, this mod happens to crash the 2nd time it is loaded on Linux/Mac. (The first call isn't inlined just by chance.) This can cause headaches. 59 | // To avoid TypeInitializationException (or ReflectionTypeLoadException) problems, we need to specify NoInlining on methods like this to prevent inlining (methods containing or accessing Types in the Weakly referenced assembly). 60 | [MethodImpl(MethodImplOptions.NoInlining)] 61 | private static void Initialize() 62 | { 63 | // This method will only be called when Enable is true, preventing TypeInitializationException 64 | MagicStorageIntegrationMembers.tile = new StorageAccess(); 65 | //members = new MagicStorageIntegrationMembers(); 66 | //members.tile = new StorageAccess(); 67 | } 68 | 69 | public static void Unload() 70 | { 71 | if (Enabled) // Here we properly unload, making sure to check Enabled before setting MagicStorage to null. 72 | Unload_Inner(); // Once again we must separate out this logic. 73 | MagicStorage = null; // Make sure to null out any references to allow Garbage Collection to work. 74 | } 75 | 76 | [MethodImpl(MethodImplOptions.NoInlining)] 77 | private static void Unload_Inner() 78 | { 79 | MagicStorageIntegrationMembers.tile = null; 80 | //members = null; 81 | } 82 | 83 | // In this example we used Initialize and Unload_Inner in conjunction with Load and Unload to avoid TypeInitializationException, but we could also just check Enabled before calling MagicStorageIntegration.Unload(); and assign MagicStorage and check Enabled before calling MagicStorageIntegration.Load(); 84 | // I opted to keep the MagicStorage integration logic in the MagicStorageIntegration class to keep MagicStorage related code as sparse and unobtrusive as possible within the remaining codebase for this mod. 85 | // That said, in ItemChecklistPlayer, we see this: 86 | // if (ItemChecklistUI.collectChestItems && MagicStorageIntegration.Enabled) 87 | // MagicStorageIntegration.FindItemsInStorage(); 88 | // I could have changed this to always call FindItemsInStorage and have FindItemsInStorage check Enabled, but that would require a FindItemsInStorage_Inner type class once again to prevent errors. 89 | // Whatever approach you do, be aware of what you are doing and be careful. 90 | 91 | // StoragePlayer and TEStorageHeart are classes in MagicStorage. 92 | // Make sure to extract the .dll from the .tmod and then add them to your .csproj as references. 93 | // As a convention, I rename the .dll file ModName_v1.2.3.4.dll and place them in Mod Sources/Mods/lib. 94 | // I do this for organization and so the .csproj loads properly for others using the GitHub repository. 95 | // Remind contributors to download the referenced mod itself if they wish to build the mod. 96 | internal static void FindItemsInStorage() 97 | { 98 | var storagePlayer = Main.LocalPlayer.GetModPlayer(); 99 | Point16 storageAccess = storagePlayer.ViewingStorage(); 100 | if (storageAccess == previousStorageAccess) 101 | return; 102 | previousStorageAccess = storageAccess; 103 | if (!Main.playerInventory || storageAccess.X < 0 || storageAccess.Y < 0) 104 | return; 105 | ModTile modTile = TileLoader.GetTile(Main.tile[storageAccess.X, storageAccess.Y].TileType); 106 | if (modTile == null || !(modTile is StorageAccess)) 107 | { 108 | return; 109 | } 110 | TEStorageHeart heart = ((StorageAccess)modTile).GetHeart(storageAccess.X, storageAccess.Y); 111 | if (heart == null) 112 | { 113 | return; 114 | } 115 | var items = heart.GetStoredItems(); 116 | // Will 1000 items crash the chat? 117 | foreach (var item in items) 118 | { 119 | foreach (ItemChecklistGlobalItem globalItem in ItemChecklist.instance.GetContent()) 120 | { 121 | globalItem.ItemReceived(item); 122 | } 123 | } 124 | } 125 | } 126 | } 127 | -------------------------------------------------------------------------------- /Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | "Terraria": { 4 | "commandName": "Executable", 5 | "executablePath": "dotnet", 6 | "commandLineArgs": "$(tMLPath)", 7 | "workingDirectory": "$(tMLSteamPath)" 8 | }, 9 | "TerrariaServer": { 10 | "commandName": "Executable", 11 | "executablePath": "dotnet", 12 | "commandLineArgs": "$(tMLServerPath)", 13 | "workingDirectory": "$(tMLSteamPath)" 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /UIElements/MoreLeft.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavidPack/ItemChecklist/ccfcfc1e881aa099ad587dcd3bae7e43a5f48254/UIElements/MoreLeft.png -------------------------------------------------------------------------------- /UIElements/MoreRight.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavidPack/ItemChecklist/ccfcfc1e881aa099ad587dcd3bae7e43a5f48254/UIElements/MoreRight.png -------------------------------------------------------------------------------- /UIElements/NewUITextBox.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using Microsoft.Xna.Framework.Graphics; 3 | using Microsoft.Xna.Framework.Input; 4 | using ReLogic.Graphics; 5 | using ReLogic.Content; 6 | using System; 7 | using Terraria; 8 | using Terraria.GameContent; 9 | using Terraria.GameContent.UI.Elements; 10 | using Terraria.UI; 11 | 12 | namespace ItemChecklist.UIElements 13 | { 14 | internal class NewUITextBox : UIPanel//UITextPanel 15 | { 16 | internal bool focused = false; 17 | 18 | //private int _cursor; 19 | //private int _frameCount; 20 | private int _maxLength = 60; 21 | 22 | private string hintText; 23 | internal string currentString = ""; 24 | private int textBlinkerCount; 25 | private int textBlinkerState; 26 | 27 | public event Action OnFocus; 28 | 29 | public event Action OnUnfocus; 30 | 31 | public event Action OnTextChanged; 32 | 33 | public event Action OnTabPressed; 34 | 35 | public event Action OnEnterPressed; 36 | 37 | //public event Action OnUpPressed; 38 | internal bool unfocusOnEnter = true; 39 | 40 | internal bool unfocusOnTab = true; 41 | 42 | //public NewUITextBox(string text, float textScale = 1, bool large = false) : base("", textScale, large) 43 | public NewUITextBox(string hintText, string text = "") 44 | { 45 | this.hintText = hintText; 46 | currentString = text; 47 | SetPadding(0); 48 | BackgroundColor = Color.White; 49 | BorderColor = Color.White; 50 | // keyBoardInput.newKeyEvent += KeyboardInput_newKeyEvent; 51 | 52 | Texture2D texture = ItemChecklist.instance.Assets.Request("UIElements/closeButtonSmallWhite", AssetRequestMode.ImmediateLoad).Value; 53 | var closeButton = new UIHoverImageButton(texture, ""); 54 | closeButton.OnLeftClick += (a, b) => SetText(""); 55 | closeButton.Left.Set(-20f, 1f); 56 | //closeButton.Top.Set(0f, .5f); 57 | closeButton.VAlign = 0.5f; 58 | //closeButton.HAlign = 0.5f; 59 | Append(closeButton); 60 | } 61 | 62 | public override void LeftClick(UIMouseEvent evt) 63 | { 64 | Focus(); 65 | base.LeftClick(evt); 66 | } 67 | 68 | public override void RightClick(UIMouseEvent evt) 69 | { 70 | base.RightClick(evt); 71 | SetText(""); 72 | } 73 | 74 | public void SetUnfocusKeys(bool unfocusOnEnter, bool unfocusOnTab) 75 | { 76 | this.unfocusOnEnter = unfocusOnEnter; 77 | this.unfocusOnTab = unfocusOnTab; 78 | } 79 | 80 | //void KeyboardInput_newKeyEvent(char obj) 81 | //{ 82 | // // Problem: keyBoardInput.newKeyEvent only fires on regular keyboard buttons. 83 | 84 | // if (!focused) return; 85 | // if (obj.Equals((char)Keys.Back)) // '\b' 86 | // { 87 | // Backspace(); 88 | // } 89 | // else if (obj.Equals((char)Keys.Enter)) 90 | // { 91 | // Unfocus(); 92 | // Main.chatRelease = false; 93 | // } 94 | // else if (Char.IsLetterOrDigit(obj)) 95 | // { 96 | // Write(obj.ToString()); 97 | // } 98 | //} 99 | 100 | public void Unfocus() 101 | { 102 | if (focused) 103 | { 104 | focused = false; 105 | Main.blockInput = false; 106 | 107 | OnUnfocus?.Invoke(); 108 | } 109 | } 110 | 111 | public void Focus() 112 | { 113 | if (!focused) 114 | { 115 | Main.clrInput(); 116 | focused = true; 117 | Main.blockInput = true; 118 | 119 | OnFocus?.Invoke(); 120 | } 121 | } 122 | 123 | public override void Update(GameTime gameTime) 124 | { 125 | Vector2 MousePosition = new Vector2((float)Main.mouseX, (float)Main.mouseY); 126 | if (!ContainsPoint(MousePosition) && Main.mouseLeft) 127 | { 128 | // TODO, figure out how to refocus without triggering unfocus while clicking enable button. 129 | Unfocus(); 130 | } 131 | base.Update(gameTime); 132 | } 133 | 134 | //public void Write(string text) 135 | //{ 136 | // base.SetText(base.Text.Insert(this._cursor, text)); 137 | // this._cursor += text.Length; 138 | // _cursor = Math.Min(Text.Length, _cursor); 139 | // Recalculate(); 140 | 141 | // OnTextChanged?.Invoke(); 142 | //} 143 | 144 | //public void WriteAll(string text) 145 | //{ 146 | // bool changed = text != Text; 147 | // if (!changed) return; 148 | // base.SetText(text); 149 | // this._cursor = text.Length; 150 | // //_cursor = Math.Min(Text.Length, _cursor); 151 | // Recalculate(); 152 | 153 | // if (changed) 154 | // { 155 | // OnTextChanged?.Invoke(); 156 | // } 157 | //} 158 | 159 | public void SetText(string text) 160 | { 161 | if (text.ToString().Length > this._maxLength) 162 | { 163 | text = text.ToString().Substring(0, this._maxLength); 164 | } 165 | if (currentString != text) 166 | { 167 | currentString = text; 168 | OnTextChanged?.Invoke(); 169 | } 170 | } 171 | 172 | public void SetTextMaxLength(int maxLength) 173 | { 174 | this._maxLength = maxLength; 175 | } 176 | 177 | //public void Backspace() 178 | //{ 179 | // if (this._cursor == 0) 180 | // { 181 | // return; 182 | // } 183 | // base.SetText(base.Text.Substring(0, base.Text.Length - 1)); 184 | // Recalculate(); 185 | //} 186 | 187 | /*public void CursorLeft() 188 | { 189 | if (this._cursor == 0) 190 | { 191 | return; 192 | } 193 | this._cursor--; 194 | } 195 | 196 | public void CursorRight() 197 | { 198 | if (this._cursor < base.Text.Length) 199 | { 200 | this._cursor++; 201 | } 202 | }*/ 203 | 204 | private static bool JustPressed(Keys key) 205 | { 206 | return Main.inputText.IsKeyDown(key) && !Main.oldInputText.IsKeyDown(key); 207 | } 208 | 209 | protected override void DrawSelf(SpriteBatch spriteBatch) 210 | { 211 | Rectangle hitbox = GetInnerDimensions().ToRectangle(); 212 | 213 | // Draw panel 214 | base.DrawSelf(spriteBatch); 215 | // Main.spriteBatch.Draw(Main.magicPixel, hitbox, Color.Yellow); 216 | 217 | if (focused) 218 | { 219 | Terraria.GameInput.PlayerInput.WritingText = true; 220 | Main.instance.HandleIME(); 221 | string newString = Main.GetInputText(currentString); 222 | if (!newString.Equals(currentString)) 223 | { 224 | currentString = newString; 225 | OnTextChanged?.Invoke(); 226 | } 227 | else 228 | { 229 | currentString = newString; 230 | } 231 | 232 | if (JustPressed(Keys.Tab)) 233 | { 234 | if (unfocusOnTab) Unfocus(); 235 | OnTabPressed?.Invoke(); 236 | } 237 | if (JustPressed(Keys.Enter)) 238 | { 239 | Main.drawingPlayerChat = false; 240 | if (unfocusOnEnter) Unfocus(); 241 | OnEnterPressed?.Invoke(); 242 | } 243 | if (++textBlinkerCount >= 20) 244 | { 245 | textBlinkerState = (textBlinkerState + 1) % 2; 246 | textBlinkerCount = 0; 247 | } 248 | Main.instance.DrawWindowsIMEPanel(new Vector2(98f, (float)(Main.screenHeight - 36)), 0f); 249 | } 250 | string displayString = currentString; 251 | if (this.textBlinkerState == 1 && focused) 252 | { 253 | displayString = displayString + "|"; 254 | } 255 | CalculatedStyle space = base.GetDimensions(); 256 | Color color = Color.Black; 257 | if (currentString.Length == 0) 258 | { 259 | } 260 | Vector2 drawPos = space.Position() + new Vector2(4, 2); 261 | if (currentString.Length == 0 && !focused) 262 | { 263 | color *= 0.5f; 264 | //Utils.DrawBorderString(spriteBatch, hintText, new Vector2(space.X, space.Y), Color.Gray, 1f); 265 | spriteBatch.DrawString(FontAssets.MouseText.Value, hintText, drawPos, color); 266 | } 267 | else 268 | { 269 | //Utils.DrawBorderString(spriteBatch, displayString, drawPos, Color.White, 1f); 270 | spriteBatch.DrawString(FontAssets.MouseText.Value, displayString, drawPos, color); 271 | } 272 | 273 | // CalculatedStyle innerDimensions2 = base.GetInnerDimensions(); 274 | // Vector2 pos2 = innerDimensions2.Position(); 275 | // if (IsLarge) 276 | // { 277 | // pos2.Y -= 10f * TextScale * TextScale; 278 | // } 279 | // else 280 | // { 281 | // pos2.Y -= 2f * TextScale; 282 | // } 283 | // //pos2.X += (innerDimensions2.Width - TextSize.X) * 0.5f; 284 | // if (IsLarge) 285 | // { 286 | // Utils.DrawBorderStringBig(spriteBatch, Text, pos2, TextColor, TextScale, 0f, 0f, -1); 287 | // return; 288 | // } 289 | // Utils.DrawBorderString(spriteBatch, Text, pos2, TextColor, TextScale, 0f, 0f, -1); 290 | // 291 | // this._frameCount++; 292 | // 293 | // CalculatedStyle innerDimensions = base.GetInnerDimensions(); 294 | // Vector2 pos = innerDimensions.Position(); 295 | // DynamicSpriteFont spriteFont = base.IsLarge ? Main.fontDeathText : Main.fontMouseText; 296 | // Vector2 vector = new Vector2(spriteFont.MeasureString(base.Text.Substring(0, this._cursor)).X, base.IsLarge ? 32f : 16f) * base.TextScale; 297 | // if (base.IsLarge) 298 | // { 299 | // pos.Y -= 8f * base.TextScale; 300 | // } 301 | // else 302 | // { 303 | // pos.Y -= 1f * base.TextScale; 304 | // } 305 | // if (Text.Length == 0) 306 | // { 307 | // Vector2 hintTextSize = new Vector2(spriteFont.MeasureString(hintText.ToString()).X, IsLarge ? 32f : 16f) * TextScale; 308 | // pos.X += 5;//(hintTextSize.X); 309 | // if (base.IsLarge) 310 | // { 311 | // Utils.DrawBorderStringBig(spriteBatch, hintText, pos, Color.Gray, base.TextScale, 0f, 0f, -1); 312 | // return; 313 | // } 314 | // Utils.DrawBorderString(spriteBatch, hintText, pos, Color.Gray, base.TextScale, 0f, 0f, -1); 315 | // pos.X -= 5; 316 | // //pos.X -= (innerDimensions.Width - hintTextSize.X) * 0.5f; 317 | // } 318 | // 319 | // if (!focused) return; 320 | // 321 | // pos.X += /*(innerDimensions.Width - base.TextSize.X) * 0.5f*/ +vector.X - (base.IsLarge ? 8f : 4f) * base.TextScale + 6f; 322 | // if ((this._frameCount %= 40) > 20) 323 | // { 324 | // return; 325 | // } 326 | // if (base.IsLarge) 327 | // { 328 | // Utils.DrawBorderStringBig(spriteBatch, "|", pos, base.TextColor, base.TextScale, 0f, 0f, -1); 329 | // return; 330 | // } 331 | // Utils.DrawBorderString(spriteBatch, "|", pos, base.TextColor, base.TextScale, 0f, 0f, -1); 332 | } 333 | } 334 | } -------------------------------------------------------------------------------- /UIElements/ScrollbarHorizontal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavidPack/ItemChecklist/ccfcfc1e881aa099ad587dcd3bae7e43a5f48254/UIElements/ScrollbarHorizontal.png -------------------------------------------------------------------------------- /UIElements/ScrollbarInnerHorizontal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavidPack/ItemChecklist/ccfcfc1e881aa099ad587dcd3bae7e43a5f48254/UIElements/ScrollbarInnerHorizontal.png -------------------------------------------------------------------------------- /UIElements/UIBottomlessPanel.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using Microsoft.Xna.Framework.Graphics; 3 | using System; 4 | using ReLogic.Content; 5 | using Terraria.Graphics; 6 | using Terraria.UI; 7 | using Terraria; 8 | using Terraria.GameContent.UI.Elements; 9 | using Terraria.ModLoader; 10 | 11 | namespace ItemChecklist.UIElements 12 | { 13 | public class UIBottomlessPanel : UIPanel 14 | { 15 | private static int CORNER_SIZE = 12; 16 | private static int BAR_SIZE = 4; 17 | private static Asset _borderTexture; 18 | private static Asset _backgroundTexture; 19 | 20 | public UIBottomlessPanel() 21 | { 22 | if (UIBottomlessPanel._borderTexture == null) 23 | { 24 | UIBottomlessPanel._borderTexture = ModContent.Request("Terraria/Images/UI/PanelBorder"); 25 | } 26 | if (UIBottomlessPanel._backgroundTexture == null) 27 | { 28 | UIBottomlessPanel._backgroundTexture = ModContent.Request("Terraria/Images/UI/PanelBackground"); 29 | } 30 | base.SetPadding((float)UIBottomlessPanel.CORNER_SIZE); 31 | } 32 | 33 | private void DrawPanel(SpriteBatch spriteBatch, Texture2D texture, Color color) 34 | { 35 | CalculatedStyle dimensions = base.GetDimensions(); 36 | Point point = new Point((int)dimensions.X, (int)dimensions.Y); 37 | Point point2 = new Point(point.X + (int)dimensions.Width - UIBottomlessPanel.CORNER_SIZE, point.Y + (int)dimensions.Height); 38 | int width = point2.X - point.X - UIBottomlessPanel.CORNER_SIZE; 39 | int height = point2.Y - point.Y - UIBottomlessPanel.CORNER_SIZE; 40 | spriteBatch.Draw(texture, new Rectangle(point.X, point.Y, UIBottomlessPanel.CORNER_SIZE, UIBottomlessPanel.CORNER_SIZE), new Rectangle?(new Rectangle(0, 0, UIBottomlessPanel.CORNER_SIZE, UIBottomlessPanel.CORNER_SIZE)), color); 41 | spriteBatch.Draw(texture, new Rectangle(point2.X, point.Y, UIBottomlessPanel.CORNER_SIZE, UIBottomlessPanel.CORNER_SIZE), new Rectangle?(new Rectangle(UIBottomlessPanel.CORNER_SIZE + UIBottomlessPanel.BAR_SIZE, 0, UIBottomlessPanel.CORNER_SIZE, UIBottomlessPanel.CORNER_SIZE)), color); 42 | // spriteBatch.Draw(texture, new Rectangle(point.X, point2.Y, UIBottomlessPanel.CORNER_SIZE, UIBottomlessPanel.CORNER_SIZE), new Rectangle?(new Rectangle(0, UIBottomlessPanel.CORNER_SIZE + UIBottomlessPanel.BAR_SIZE, UIBottomlessPanel.CORNER_SIZE, UIBottomlessPanel.CORNER_SIZE)), color); 43 | // spriteBatch.Draw(texture, new Rectangle(point2.X, point2.Y, UIBottomlessPanel.CORNER_SIZE, UIBottomlessPanel.CORNER_SIZE), new Rectangle?(new Rectangle(UIBottomlessPanel.CORNER_SIZE + UIBottomlessPanel.BAR_SIZE, UIBottomlessPanel.CORNER_SIZE + UIBottomlessPanel.BAR_SIZE, UIBottomlessPanel.CORNER_SIZE, UIBottomlessPanel.CORNER_SIZE)), color); 44 | spriteBatch.Draw(texture, new Rectangle(point.X + UIBottomlessPanel.CORNER_SIZE, point.Y, width, UIBottomlessPanel.CORNER_SIZE), new Rectangle?(new Rectangle(UIBottomlessPanel.CORNER_SIZE, 0, UIBottomlessPanel.BAR_SIZE, UIBottomlessPanel.CORNER_SIZE)), color); 45 | // spriteBatch.Draw(texture, new Rectangle(point.X + UIBottomlessPanel.CORNER_SIZE, point2.Y, width, UIBottomlessPanel.CORNER_SIZE), new Rectangle?(new Rectangle(UIBottomlessPanel.CORNER_SIZE, UIBottomlessPanel.CORNER_SIZE + UIBottomlessPanel.BAR_SIZE, UIBottomlessPanel.BAR_SIZE, UIBottomlessPanel.CORNER_SIZE)), color); 46 | spriteBatch.Draw(texture, new Rectangle(point.X, point.Y + UIBottomlessPanel.CORNER_SIZE, UIBottomlessPanel.CORNER_SIZE, height), new Rectangle?(new Rectangle(0, UIBottomlessPanel.CORNER_SIZE, UIBottomlessPanel.CORNER_SIZE, UIBottomlessPanel.BAR_SIZE)), color); 47 | spriteBatch.Draw(texture, new Rectangle(point2.X, point.Y + UIBottomlessPanel.CORNER_SIZE, UIBottomlessPanel.CORNER_SIZE, height), new Rectangle?(new Rectangle(UIBottomlessPanel.CORNER_SIZE + UIBottomlessPanel.BAR_SIZE, UIBottomlessPanel.CORNER_SIZE, UIBottomlessPanel.CORNER_SIZE, UIBottomlessPanel.BAR_SIZE)), color); 48 | spriteBatch.Draw(texture, new Rectangle(point.X + UIBottomlessPanel.CORNER_SIZE, point.Y + UIBottomlessPanel.CORNER_SIZE, width, height), new Rectangle?(new Rectangle(UIBottomlessPanel.CORNER_SIZE, UIBottomlessPanel.CORNER_SIZE, UIBottomlessPanel.BAR_SIZE, UIBottomlessPanel.BAR_SIZE)), color); 49 | } 50 | 51 | protected override void DrawSelf(SpriteBatch spriteBatch) 52 | { 53 | this.DrawPanel(spriteBatch, UIBottomlessPanel._backgroundTexture.Value, this.BackgroundColor); 54 | this.DrawPanel(spriteBatch, UIBottomlessPanel._borderTexture.Value, this.BorderColor); 55 | 56 | //Rectangle hitbox = GetInnerDimensions().ToRectangle(); 57 | //Main.spriteBatch.Draw(Main.magicPixel, hitbox, Color.Red * 0.6f); 58 | } 59 | } 60 | } -------------------------------------------------------------------------------- /UIElements/UICheckbox.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using Microsoft.Xna.Framework.Graphics; 3 | using System; 4 | using ReLogic.Content; 5 | using Terraria; 6 | using Terraria.GameContent.UI.Elements; 7 | using Terraria.UI; 8 | 9 | namespace ItemChecklist.UIElements 10 | { 11 | internal class UICheckbox : UIText 12 | { 13 | public static Asset checkboxTexture; 14 | public static Asset checkmarkTexture; 15 | 16 | public event EventHandler OnSelectedChanged; 17 | 18 | private bool selected = false; 19 | private bool disabled = false; 20 | internal string hoverText; 21 | 22 | public bool Selected 23 | { 24 | get { return selected; } 25 | set 26 | { 27 | if (value != selected) 28 | { 29 | selected = value; 30 | OnSelectedChanged?.Invoke(this, EventArgs.Empty); 31 | } 32 | } 33 | } 34 | 35 | public UICheckbox(string text, string hoverText, float textScale = 1, bool large = false) : base(text, textScale, large) 36 | { 37 | this.Left.Pixels += 20; 38 | //TextColor = Color.Blue; 39 | text = " " + text; 40 | this.hoverText = hoverText; 41 | SetText(text); 42 | OnLeftClick += UICheckbox_onLeftClick; 43 | Recalculate(); 44 | } 45 | 46 | private void UICheckbox_onLeftClick(UIMouseEvent evt, UIElement listeningElement) 47 | { 48 | if (disabled) return; 49 | this.Selected = !Selected; 50 | } 51 | 52 | public void SetDisabled(bool disabled = true) 53 | { 54 | this.disabled = disabled; 55 | if (disabled) 56 | { 57 | Selected = false; 58 | } 59 | TextColor = disabled ? Color.Gray : Color.White; 60 | } 61 | public void SetHoverText(string hoverText) 62 | { 63 | this.hoverText = hoverText; 64 | } 65 | 66 | protected override void DrawSelf(SpriteBatch spriteBatch) 67 | { 68 | base.DrawSelf(spriteBatch); 69 | 70 | CalculatedStyle innerDimensions = base.GetInnerDimensions(); 71 | Vector2 pos = new Vector2(innerDimensions.X, innerDimensions.Y - 5); 72 | 73 | //Rectangle hitbox = GetInnerDimensions().ToRectangle(); 74 | //Main.spriteBatch.Draw(Main.magicPixel, hitbox, Color.Red * 0.6f); 75 | 76 | spriteBatch.Draw(checkboxTexture.Value, pos, null, disabled ? Color.Gray : Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); 77 | if (Selected) 78 | spriteBatch.Draw(checkmarkTexture.Value, pos, null, disabled ? Color.Gray : Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); 79 | 80 | if (IsMouseHovering) 81 | { 82 | Main.hoverItemName = hoverText; 83 | } 84 | } 85 | } 86 | } -------------------------------------------------------------------------------- /UIElements/UICollectionBar.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | using Terraria.UI; 4 | using Terraria.GameContent.Bestiary; 5 | using Microsoft.Xna.Framework; 6 | using Microsoft.Xna.Framework.Graphics; 7 | using Terraria.GameContent; 8 | using Terraria; 9 | using Terraria.ModLoader; 10 | using Terraria.ID; 11 | using Terraria.Localization; 12 | 13 | 14 | namespace ItemChecklist.UIElements 15 | { 16 | // Adapted from Terraria.ModLoader.UI.UIBestiaryBar 17 | class UICollectionBar : UIElement 18 | { 19 | private class UICollectionBarItem 20 | { 21 | internal readonly string Tooltop; 22 | internal readonly int EntryCount; 23 | internal readonly int CompletedCount; 24 | internal readonly Color DrawColor; 25 | 26 | public UICollectionBarItem(string tooltop, int entryCount, int completedCount, Color drawColor) { 27 | Tooltop = tooltop; 28 | EntryCount = entryCount; 29 | CompletedCount = completedCount; 30 | DrawColor = drawColor; 31 | } 32 | } 33 | 34 | private List collectionBarItems; 35 | 36 | private const string LocalizationKey = "Mods.ItemChecklist.UICollectionBar."; 37 | private LocalizedText collectionTotalText; 38 | private LocalizedText collectionTerrariaText; 39 | private LocalizedText collectionModText; 40 | 41 | public UICollectionBar() { 42 | collectionBarItems = new List(); 43 | 44 | collectionTotalText = Language.GetOrRegister(LocalizationKey + nameof(collectionTotalText)); 45 | collectionTerrariaText = Language.GetOrRegister(LocalizationKey + nameof(collectionTerrariaText)); 46 | collectionModText = Language.GetOrRegister(LocalizationKey + nameof(collectionModText)); 47 | 48 | RecalculateBars(); 49 | } 50 | 51 | private readonly Color[] _colors = { 52 | new Color(232, 76, 61),//red 53 | new Color(155, 88, 181),//purple 54 | new Color(27, 188, 155),//aqua 55 | new Color(243, 156, 17),//orange 56 | new Color(45, 204, 112),//green 57 | new Color(241, 196, 15),//yellow 58 | }; 59 | 60 | public void RecalculateBars() { 61 | collectionBarItems.Clear(); 62 | if (Main.gameMenu) 63 | return; 64 | 65 | var ItemChecklistPlayer = Main.LocalPlayer.GetModPlayer(); 66 | 67 | //Add the bestiary total to the bar 68 | int total = ItemChecklistPlayer.totalItemsToFind; 69 | int totalCollected = ItemChecklistPlayer.totalItemsFound; 70 | collectionBarItems.Add(new UICollectionBarItem(collectionTotalText.Format(totalCollected,total,$"{(float)totalCollected / total * 100f:N2}"), total, totalCollected, Main.OurFavoriteColor)); 71 | 72 | var data = ItemChecklistPlayer.foundItem.Zip(ContentSamples.ItemsByType.Values); 73 | //.GroupBy(x=>x.Second.ModItem?.Mod.Name ?? "Terraria").ToDictionary(y=>y., x=>x); 74 | var items = data.Where(x => x.Second.ModItem == null).ToList(); 75 | 76 | //Add Terraria's item entries 77 | int collected = items.Count(x => x.First); 78 | collectionBarItems.Add(new UICollectionBarItem(collectionTerrariaText.Format( collected,items.Count,$"{(float)collected / items.Count * 100f:N2})"), items.Count, collected, _colors[0])); 79 | 80 | //Add the mod's item entries 81 | for (int i = 0; i < ModLoader.Mods.Length; i++) { 82 | items = data.Where(x => x.Second.ModItem?.Mod == ModLoader.Mods[i]).ToList(); 83 | if (!items.Any()) // No Items added by mod. 84 | continue; 85 | collected = items.Count(x => x.First); 86 | collectionBarItems.Add(new UICollectionBarItem(collectionModText.Format( ModLoader.Mods[i].DisplayName,collected,items.Count,$"{(float)collected / items.Count * 100f:N2}"), items.Count, collected, _colors[i % _colors.Length])); 87 | } 88 | } 89 | 90 | protected override void DrawSelf(SpriteBatch sb) { 91 | int xOffset = 0; 92 | var rectangle = GetDimensions().ToRectangle(); 93 | const int bottomHeight = 3; //The height of the total completion bar 94 | rectangle.Height -= bottomHeight; 95 | 96 | bool drawHover = false; 97 | UICollectionBarItem hoverData = null; 98 | var ItemChecklistPlayer = Main.LocalPlayer.GetModPlayer(); 99 | 100 | //Draw the mod progress bars 101 | for (int i = 1; i < collectionBarItems.Count; i++) { 102 | var barData = collectionBarItems[i]; 103 | 104 | int offset = (int)(rectangle.Width * (barData.EntryCount / (float)ItemChecklistPlayer.totalItemsToFind)); 105 | if (i == collectionBarItems.Count - 1) { 106 | offset = rectangle.Width - xOffset; 107 | } 108 | int width = (int)(offset * (barData.CompletedCount / (float)barData.EntryCount)); 109 | 110 | var drawArea = new Rectangle(rectangle.X + xOffset, rectangle.Y, width, rectangle.Height); 111 | var outlineArea = new Rectangle(rectangle.X + xOffset, rectangle.Y, offset, rectangle.Height); 112 | xOffset += offset; 113 | 114 | sb.Draw(TextureAssets.MagicPixel.Value, outlineArea, barData.DrawColor * 0.3f); 115 | sb.Draw(TextureAssets.MagicPixel.Value, drawArea, barData.DrawColor); 116 | 117 | if (!drawHover && outlineArea.Contains(new Point(Main.mouseX, Main.mouseY))) { 118 | drawHover = true; 119 | hoverData = barData; 120 | } 121 | } 122 | //Draw the bottom progress bar 123 | var bottomData = collectionBarItems[0]; 124 | int bottomWidth = (int)(rectangle.Width * (bottomData.CompletedCount / (float)bottomData.EntryCount)); 125 | var bottomDrawArea = new Rectangle(rectangle.X, rectangle.Bottom, bottomWidth, bottomHeight); 126 | var bottomOutlineArea = new Rectangle(rectangle.X, rectangle.Bottom, rectangle.Width, bottomHeight); 127 | 128 | sb.Draw(TextureAssets.MagicPixel.Value, bottomOutlineArea, bottomData.DrawColor * 0.3f); 129 | sb.Draw(TextureAssets.MagicPixel.Value, bottomDrawArea, bottomData.DrawColor); 130 | 131 | if (!drawHover && bottomOutlineArea.Contains(new Point(Main.mouseX, Main.mouseY))) { 132 | drawHover = true; 133 | hoverData = bottomData; 134 | } 135 | 136 | if (drawHover && hoverData != null) { 137 | Main.instance.MouseText(hoverData.Tooltop, 0, 0); 138 | } 139 | } 140 | } 141 | } 142 | -------------------------------------------------------------------------------- /UIElements/UIDragableElement.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using Microsoft.Xna.Framework.Graphics; 3 | using System.Collections.Generic; 4 | using ReLogic.Content; 5 | using Terraria; 6 | using Terraria.Graphics; 7 | using Terraria.ModLoader; 8 | using Terraria.UI; 9 | 10 | namespace ItemChecklist 11 | { 12 | internal class UIDragableElement : UIElement 13 | { 14 | private static Asset dragTexture; 15 | private Vector2 offset; 16 | private bool dragable; 17 | private bool dragging; 18 | private bool resizeableX; 19 | private bool resizeableY; 20 | private bool resizeable => resizeableX || resizeableY; 21 | private bool resizeing; 22 | 23 | //private int minX, minY, maxX, maxY; 24 | private List additionalDragTargets; 25 | 26 | // TODO, move panel back in if offscreen? prevent drag off screen? 27 | public UIDragableElement(bool dragable = true, bool resizeableX = false, bool resizeableY = false) 28 | { 29 | this.dragable = dragable; 30 | this.resizeableX = resizeableX; 31 | this.resizeableY = resizeableY; 32 | if (dragTexture == null) 33 | { 34 | dragTexture = ModContent.Request("Terraria/Images/UI/PanelBorder"); 35 | } 36 | additionalDragTargets = new List(); 37 | } 38 | 39 | public void AddDragTarget(UIElement element) 40 | { 41 | additionalDragTargets.Add(element); 42 | } 43 | 44 | //public void SetMinMaxWidth(int min, int max) 45 | //{ 46 | // this.minX = min; 47 | // this.maxX = max; 48 | //} 49 | 50 | //public void SetMinMaxHeight(int min, int max) 51 | //{ 52 | // this.minY = min; 53 | // this.maxY = max; 54 | //} 55 | 56 | public override void LeftMouseDown(UIMouseEvent evt) 57 | { 58 | DragStart(evt); 59 | base.LeftMouseDown(evt); 60 | } 61 | 62 | public override void LeftMouseUp(UIMouseEvent evt) 63 | { 64 | DragEnd(evt); 65 | base.LeftMouseUp(evt); 66 | } 67 | 68 | private void DragStart(UIMouseEvent evt) 69 | { 70 | CalculatedStyle innerDimensions = GetInnerDimensions(); 71 | if (evt.Target == this || additionalDragTargets.Contains(evt.Target)) 72 | { 73 | if (resizeable && new Rectangle((int)(innerDimensions.X + innerDimensions.Width - 18), (int)(innerDimensions.Y + innerDimensions.Height - 18), 18, 18).Contains(evt.MousePosition.ToPoint())) 74 | //if (resizeable && new Rectangle((int)(innerDimensions.X + innerDimensions.Width - 12), (int)(innerDimensions.Y + innerDimensions.Height - 12), 12 + 6, 12 + 6).Contains(evt.MousePosition.ToPoint())) 75 | { 76 | offset = new Vector2(evt.MousePosition.X - innerDimensions.X - innerDimensions.Width, evt.MousePosition.Y - innerDimensions.Y - innerDimensions.Height); 77 | //offset = new Vector2(evt.MousePosition.X - innerDimensions.X - innerDimensions.Width - 6, evt.MousePosition.Y - innerDimensions.Y - innerDimensions.Height - 6); 78 | resizeing = true; 79 | } 80 | else if (dragable) 81 | { 82 | offset = new Vector2(evt.MousePosition.X - Left.Pixels, evt.MousePosition.Y - Top.Pixels); 83 | dragging = true; 84 | } 85 | } 86 | } 87 | 88 | private void DragEnd(UIMouseEvent evt) 89 | { 90 | if (evt.Target == this || additionalDragTargets.Contains(evt.Target)) 91 | { 92 | dragging = false; 93 | resizeing = false; 94 | } 95 | if(this == ItemChecklistUI.instance.mainPanel) { 96 | ItemChecklistClientConfig config = ModContent.GetInstance(); 97 | CalculatedStyle dimensions = GetOuterDimensions(); // Drag can go negative, need clamped by Min and Max values 98 | config.ItemChecklistSize = new Vector2(dimensions.Width, dimensions.Height); 99 | config.ItemChecklistPosition = new Vector2(Left.Pixels, Top.Pixels); 100 | ItemChecklistClientConfig.SaveConfig(); 101 | } 102 | } 103 | 104 | protected override void DrawSelf(SpriteBatch spriteBatch) 105 | { 106 | //Rectangle hitbox = GetInnerDimensions().ToRectangle(); 107 | //Main.spriteBatch.Draw(Main.magicPixel, hitbox, Color.Red * 0.6f); 108 | 109 | CalculatedStyle dimensions = base.GetOuterDimensions(); 110 | if (ContainsPoint(Main.MouseScreen)) 111 | { 112 | Main.LocalPlayer.mouseInterface = true; 113 | Main.LocalPlayer.cursorItemIconEnabled = false; 114 | Main.ItemIconCacheUpdate(0); 115 | } 116 | if (dragging) 117 | { 118 | Left.Set(Main.MouseScreen.X - offset.X, 0f); 119 | Top.Set(Main.MouseScreen.Y - offset.Y, 0f); 120 | Recalculate(); 121 | } 122 | if (resizeing) 123 | { 124 | if (resizeableX) 125 | { 126 | //Width.Pixels = Utils.Clamp(Main.MouseScreen.X - dimensions.X - offset.X, minX, maxX); 127 | Width.Pixels = Main.MouseScreen.X - dimensions.X - offset.X; 128 | } 129 | if (resizeableY) 130 | { 131 | //Height.Pixels = Utils.Clamp(Main.MouseScreen.Y - dimensions.Y - offset.Y, minY, maxY); 132 | Height.Pixels = Main.MouseScreen.Y - dimensions.Y - offset.Y; 133 | } 134 | Recalculate(); 135 | } 136 | base.DrawSelf(spriteBatch); 137 | } 138 | 139 | protected override void DrawChildren(SpriteBatch spriteBatch) 140 | { 141 | base.DrawChildren(spriteBatch); 142 | if (resizeable) 143 | { 144 | DrawDragAnchor(spriteBatch, dragTexture.Value, Color.Black/*this.BorderColor*/); 145 | } 146 | } 147 | 148 | private void DrawDragAnchor(SpriteBatch spriteBatch, Texture2D texture, Color color) 149 | { 150 | CalculatedStyle dimensions = GetOuterDimensions(); 151 | 152 | //Rectangle hitbox = GetInnerDimensions().ToRectangle(); 153 | //hitbox = new Rectangle((int)(innerDimensions.X + innerDimensions.Width - 18), (int)(innerDimensions.Y + innerDimensions.Height - 18), 18, 18); 154 | //Main.spriteBatch.Draw(Main.magicPixel, hitbox, Color.LightBlue * 0.6f); 155 | 156 | Point point = new Point((int)(dimensions.X + dimensions.Width - 12), (int)(dimensions.Y + dimensions.Height - 12)); 157 | spriteBatch.Draw(texture, new Rectangle(point.X - 2, point.Y - 2, 12 - 2, 12 - 2), new Rectangle(12 + 4, 12 + 4, 12, 12), color); 158 | spriteBatch.Draw(texture, new Rectangle(point.X - 4, point.Y - 4, 12 - 4, 12 - 4), new Rectangle(12 + 4, 12 + 4, 12, 12), color); 159 | spriteBatch.Draw(texture, new Rectangle(point.X - 6, point.Y - 6, 12 - 6, 12 - 6), new Rectangle(12 + 4, 12 + 4, 12, 12), color); 160 | } 161 | } 162 | } -------------------------------------------------------------------------------- /UIElements/UIGrid.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using Microsoft.Xna.Framework.Graphics; 3 | using ReLogic.Content; 4 | using System; 5 | using System.Collections.Generic; 6 | using Terraria; 7 | using Terraria.GameContent.UI.Elements; 8 | using Terraria.UI; 9 | 10 | namespace ItemChecklist 11 | { 12 | public class UIGrid : UIElement 13 | { 14 | public delegate bool ElementSearchMethod(UIElement element); 15 | 16 | private class UIInnerList : UIElement 17 | { 18 | public override bool ContainsPoint(Vector2 point) 19 | { 20 | return true; 21 | } 22 | 23 | protected override void DrawChildren(SpriteBatch spriteBatch) 24 | { 25 | Vector2 position = this.Parent.GetDimensions().Position(); 26 | Vector2 dimensions = new Vector2(this.Parent.GetDimensions().Width, this.Parent.GetDimensions().Height); 27 | foreach (UIElement current in this.Elements) 28 | { 29 | Vector2 position2 = current.GetDimensions().Position(); 30 | Vector2 dimensions2 = new Vector2(current.GetDimensions().Width, current.GetDimensions().Height); 31 | if (Collision.CheckAABBvAABBCollision(position, dimensions, position2, dimensions2)) 32 | { 33 | current.Draw(spriteBatch); 34 | } 35 | } 36 | } 37 | } 38 | 39 | public List _items = new List(); 40 | protected UIScrollbar _scrollbar; 41 | internal UIElement _innerList = new UIGrid.UIInnerList(); 42 | private float _innerListHeight; 43 | public float ListPadding = 5f; 44 | 45 | public static Asset moreUpTexture; 46 | public static Asset moreDownTexture; 47 | 48 | public int Count 49 | { 50 | get 51 | { 52 | return this._items.Count; 53 | } 54 | } 55 | 56 | // todo, vertical/horizontal orientation, left to right, etc? 57 | public UIGrid() 58 | { 59 | this._innerList.OverflowHidden = false; 60 | this._innerList.Width.Set(0f, 1f); 61 | this._innerList.Height.Set(0f, 1f); 62 | this.OverflowHidden = true; 63 | base.Append(this._innerList); 64 | } 65 | 66 | public float GetTotalHeight() 67 | { 68 | return this._innerListHeight; 69 | } 70 | 71 | public void Goto(UIGrid.ElementSearchMethod searchMethod, bool center = false, bool fuzzy = false) 72 | { 73 | var innerDimensionHeight = GetInnerDimensions().Height; 74 | for (int i = 0; i < this._items.Count; i++) 75 | { 76 | var item = this._items[i]; 77 | if (searchMethod(item)) 78 | { 79 | if (fuzzy) 80 | { 81 | if (item.Top.Pixels > _scrollbar.ViewPosition && item.Top.Pixels + item.GetOuterDimensions().Height < _scrollbar.ViewPosition + innerDimensionHeight) 82 | return; 83 | } 84 | this._scrollbar.ViewPosition = item.Top.Pixels; 85 | if (center) 86 | { 87 | this._scrollbar.ViewPosition = item.Top.Pixels - innerDimensionHeight / 2 + item.GetOuterDimensions().Height / 2; 88 | } 89 | return; 90 | } 91 | } 92 | } 93 | 94 | public virtual void Add(UIElement item) 95 | { 96 | this._items.Add(item); 97 | this._innerList.Append(item); 98 | this.UpdateOrder(); 99 | this._innerList.Recalculate(); 100 | } 101 | 102 | public virtual void AddRange(IEnumerable items) 103 | { 104 | this._items.AddRange(items); 105 | foreach (var item in items) 106 | this._innerList.Append(item); 107 | this.UpdateOrder(); 108 | this._innerList.Recalculate(); 109 | } 110 | 111 | public virtual bool Remove(UIElement item) 112 | { 113 | this._innerList.RemoveChild(item); 114 | this.UpdateOrder(); 115 | return this._items.Remove(item); 116 | } 117 | 118 | public virtual void Clear() 119 | { 120 | this._innerList.RemoveAllChildren(); 121 | this._items.Clear(); 122 | } 123 | 124 | public override void Recalculate() 125 | { 126 | base.Recalculate(); 127 | this.UpdateScrollbar(); 128 | } 129 | 130 | public override void ScrollWheel(UIScrollWheelEvent evt) 131 | { 132 | base.ScrollWheel(evt); 133 | if (this._scrollbar != null) 134 | { 135 | this._scrollbar.ViewPosition -= (float)evt.ScrollWheelValue; 136 | } 137 | } 138 | 139 | public override void RecalculateChildren() 140 | { 141 | float availableWidth = GetInnerDimensions().Width; 142 | base.RecalculateChildren(); 143 | float top = 0f; 144 | float left = 0f; 145 | float maxRowHeight = 0f; 146 | for (int i = 0; i < this._items.Count; i++) 147 | { 148 | var item = this._items[i]; 149 | var outerDimensions = item.GetOuterDimensions(); 150 | if (left + outerDimensions.Width > availableWidth && left > 0) 151 | { 152 | top += maxRowHeight + this.ListPadding; 153 | left = 0; 154 | maxRowHeight = 0; 155 | } 156 | maxRowHeight = Math.Max(maxRowHeight, outerDimensions.Height); 157 | item.Left.Set(left, 0f); 158 | left += outerDimensions.Width + this.ListPadding; 159 | item.Top.Set(top, 0f); 160 | item.Recalculate(); 161 | } 162 | this._innerListHeight = top + maxRowHeight; 163 | } 164 | 165 | private void UpdateScrollbar() 166 | { 167 | if (this._scrollbar == null) 168 | { 169 | return; 170 | } 171 | this._scrollbar.SetView(base.GetInnerDimensions().Height, this._innerListHeight); 172 | } 173 | 174 | public void SetScrollbar(UIScrollbar scrollbar) 175 | { 176 | this._scrollbar = scrollbar; 177 | this.UpdateScrollbar(); 178 | } 179 | 180 | //internal delegate int ElementSort(UIElement item1, UIElement item2); 181 | internal Comparison alternateSort; 182 | public void UpdateOrder() 183 | { 184 | if (alternateSort != null) 185 | this._items.Sort(alternateSort); 186 | else 187 | this._items.Sort(new Comparison(this.SortMethod)); 188 | this.UpdateScrollbar(); 189 | } 190 | 191 | public int SortMethod(UIElement item1, UIElement item2) 192 | { 193 | return item1.CompareTo(item2); 194 | } 195 | 196 | public override List GetSnapPoints() 197 | { 198 | List list = new List(); 199 | SnapPoint item; 200 | if (base.GetSnapPoint(out item)) 201 | { 202 | list.Add(item); 203 | } 204 | foreach (UIElement current in this._items) 205 | { 206 | list.AddRange(current.GetSnapPoints()); 207 | } 208 | return list; 209 | } 210 | 211 | protected override void DrawSelf(SpriteBatch spriteBatch) 212 | { 213 | if (this._scrollbar != null) 214 | { 215 | this._innerList.Top.Set(-this._scrollbar.GetValue(), 0f); 216 | } 217 | if (IsMouseHovering) 218 | Terraria.GameInput.PlayerInput.LockVanillaMouseScroll("RecipeBrowser/UIHorizontalGrid"); 219 | this.Recalculate(); 220 | } 221 | 222 | public bool drawArrows; 223 | protected override void DrawChildren(SpriteBatch spriteBatch) { 224 | base.DrawChildren(spriteBatch); 225 | if (drawArrows) { 226 | var inner = GetInnerDimensions().ToRectangle(); 227 | if (this._scrollbar.ViewPosition != 0) { 228 | int centeredX = inner.X + inner.Width / 2 - moreUpTexture.Width() / 2; 229 | spriteBatch.Draw(moreUpTexture.Value, new Vector2(centeredX, inner.Y), Color.White * .5f); 230 | } 231 | if (this._scrollbar.ViewPosition < _innerListHeight - inner.Height) { 232 | int centeredX = inner.X + inner.Width / 2 - moreUpTexture.Width() / 2; 233 | spriteBatch.Draw(moreDownTexture.Value, new Vector2(centeredX, inner.Bottom - moreDownTexture.Height()), Color.White * .5f); 234 | } 235 | } 236 | } 237 | } 238 | } -------------------------------------------------------------------------------- /UIElements/UIHorizontalGrid.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using Microsoft.Xna.Framework.Graphics; 3 | using ItemChecklist.UIElements; 4 | using System; 5 | using System.Collections.Generic; 6 | using ReLogic.Content; 7 | using Terraria; 8 | using Terraria.UI; 9 | using Terraria.GameInput; 10 | 11 | namespace ItemChecklist.UIElements 12 | { 13 | public class UIHorizontalGrid : UIElement 14 | { 15 | public delegate bool ElementSearchMethod(UIElement element); 16 | 17 | private class UIInnerList : UIElement 18 | { 19 | public override bool ContainsPoint(Vector2 point) 20 | { 21 | return true; 22 | } 23 | 24 | protected override void DrawChildren(SpriteBatch spriteBatch) 25 | { 26 | Vector2 position = this.Parent.GetDimensions().Position(); 27 | Vector2 dimensions = new Vector2(this.Parent.GetDimensions().Width, this.Parent.GetDimensions().Height); 28 | foreach (UIElement current in this.Elements) 29 | { 30 | Vector2 position2 = current.GetDimensions().Position(); 31 | Vector2 dimensions2 = new Vector2(current.GetDimensions().Width, current.GetDimensions().Height); 32 | if (Collision.CheckAABBvAABBCollision(position, dimensions, position2, dimensions2)) 33 | { 34 | current.Draw(spriteBatch); 35 | } 36 | } 37 | } 38 | } 39 | 40 | public List _items = new List(); 41 | protected UIHorizontalScrollbar _scrollbar; 42 | internal UIElement _innerList = new UIHorizontalGrid.UIInnerList(); 43 | private float _innerListWidth; 44 | public float ListPadding = 5f; 45 | 46 | public static Asset moreLeftTexture; 47 | public static Asset moreRightTexture; 48 | 49 | public int Count 50 | { 51 | get 52 | { 53 | return this._items.Count; 54 | } 55 | } 56 | 57 | // todo, vertical/horizontal orientation, left to right, etc? 58 | public UIHorizontalGrid() 59 | { 60 | this._innerList.OverflowHidden = false; 61 | this._innerList.Width.Set(0f, 1f); 62 | this._innerList.Height.Set(0f, 1f); 63 | this.OverflowHidden = true; 64 | base.Append(this._innerList); 65 | } 66 | 67 | public float GetTotalWidth() 68 | { 69 | return this._innerListWidth; 70 | } 71 | 72 | public void Goto(UIHorizontalGrid.ElementSearchMethod searchMethod, bool center = false) 73 | { 74 | for (int i = 0; i < this._items.Count; i++) 75 | { 76 | if (searchMethod(this._items[i])) 77 | { 78 | this._scrollbar.ViewPosition = this._items[i].Left.Pixels; 79 | if (center) 80 | { 81 | this._scrollbar.ViewPosition = this._items[i].Left.Pixels - GetInnerDimensions().Width / 2 + _items[i].GetOuterDimensions().Width / 2; 82 | } 83 | return; 84 | } 85 | } 86 | } 87 | 88 | public virtual void Add(UIElement item) 89 | { 90 | this._items.Add(item); 91 | this._innerList.Append(item); 92 | this.UpdateOrder(); 93 | this._innerList.Recalculate(); 94 | } 95 | 96 | public virtual void AddRange(IEnumerable items) 97 | { 98 | this._items.AddRange(items); 99 | foreach (var item in items) 100 | this._innerList.Append(item); 101 | this.UpdateOrder(); 102 | this._innerList.Recalculate(); 103 | } 104 | 105 | public virtual bool Remove(UIElement item) 106 | { 107 | this._innerList.RemoveChild(item); 108 | this.UpdateOrder(); 109 | return this._items.Remove(item); 110 | } 111 | 112 | public virtual void Clear() 113 | { 114 | this._innerList.RemoveAllChildren(); 115 | this._items.Clear(); 116 | } 117 | 118 | public override void Recalculate() 119 | { 120 | base.Recalculate(); 121 | this.UpdateScrollbar(); 122 | } 123 | 124 | public override void ScrollWheel(UIScrollWheelEvent evt) 125 | { 126 | base.ScrollWheel(evt); 127 | if (this._scrollbar != null) 128 | { 129 | this._scrollbar.ViewPosition -= (float)evt.ScrollWheelValue; 130 | } 131 | } 132 | 133 | public override void RecalculateChildren() 134 | { 135 | float availableHeight = GetInnerDimensions().Height; 136 | base.RecalculateChildren(); 137 | float left = 0f; 138 | float top = 0f; 139 | float maxRowWidth = 0f; 140 | for (int i = 0; i < this._items.Count; i++) 141 | { 142 | var item = this._items[i]; 143 | var outerDimensions = item.GetOuterDimensions(); 144 | if (top + outerDimensions.Height > availableHeight && top > 0) 145 | { 146 | left += maxRowWidth + this.ListPadding; 147 | top = 0; 148 | maxRowWidth = 0; 149 | } 150 | maxRowWidth = Math.Max(maxRowWidth, outerDimensions.Width); 151 | item.Top.Set(top, 0f); 152 | top += outerDimensions.Height + this.ListPadding; 153 | item.Left.Set(left, 0f); 154 | item.Recalculate(); 155 | } 156 | this._innerListWidth = left + maxRowWidth; 157 | } 158 | 159 | private void UpdateScrollbar() 160 | { 161 | if (this._scrollbar == null) 162 | { 163 | return; 164 | } 165 | this._scrollbar.SetView(base.GetInnerDimensions().Width, this._innerListWidth); 166 | } 167 | 168 | public void SetScrollbar(UIHorizontalScrollbar scrollbar) 169 | { 170 | this._scrollbar = scrollbar; 171 | this.UpdateScrollbar(); 172 | } 173 | 174 | public void UpdateOrder() 175 | { 176 | this._items.Sort(new Comparison(this.SortMethod)); 177 | this.UpdateScrollbar(); 178 | } 179 | 180 | public int SortMethod(UIElement item1, UIElement item2) 181 | { 182 | return item1.CompareTo(item2); 183 | } 184 | 185 | public override List GetSnapPoints() 186 | { 187 | List list = new List(); 188 | SnapPoint item; 189 | if (base.GetSnapPoint(out item)) 190 | { 191 | list.Add(item); 192 | } 193 | foreach (UIElement current in this._items) 194 | { 195 | list.AddRange(current.GetSnapPoints()); 196 | } 197 | return list; 198 | } 199 | 200 | protected override void DrawSelf(SpriteBatch spriteBatch) 201 | { 202 | //var r = GetDimensions().ToRectangle(); 203 | //r.Inflate(-10,-10); 204 | //spriteBatch.Draw(Main.magicPixel, r, Color.Yellow); 205 | if (this._scrollbar != null) 206 | { 207 | this._innerList.Left.Set(-this._scrollbar.GetValue(), 0f); 208 | } 209 | if(IsMouseHovering) 210 | PlayerInput.LockVanillaMouseScroll("RecipeBrowser/UIHorizontalGrid"); 211 | this.Recalculate(); 212 | } 213 | 214 | public bool drawArrows; 215 | protected override void DrawChildren(SpriteBatch spriteBatch) 216 | { 217 | base.DrawChildren(spriteBatch); 218 | if (drawArrows) 219 | { 220 | var inner = GetInnerDimensions().ToRectangle(); 221 | if (this._scrollbar.ViewPosition != 0) 222 | { 223 | int centeredY = inner.Y + inner.Height / 2 - moreLeftTexture.Height() / 2; 224 | spriteBatch.Draw(moreLeftTexture.Value, new Vector2(inner.X, centeredY), Color.White * .5f); 225 | } 226 | if (this._scrollbar.ViewPosition < _innerListWidth - inner.Width - 1) // -1 due to odd width leading to 0.5 view position offset. 227 | { 228 | int centeredY = inner.Y + inner.Height / 2 - moreRightTexture.Height() / 2; 229 | spriteBatch.Draw(moreRightTexture.Value, new Vector2(inner.Right - moreRightTexture.Width(), centeredY), Color.White * .5f); 230 | } 231 | } 232 | } 233 | } 234 | } -------------------------------------------------------------------------------- /UIElements/UIHorizontalScrollbar.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using Microsoft.Xna.Framework.Graphics; 3 | using ReLogic.Content; 4 | using Terraria; 5 | using Terraria.Audio; 6 | using Terraria.ID; 7 | using Terraria.UI; 8 | 9 | namespace ItemChecklist.UIElements 10 | { 11 | public class UIHorizontalScrollbar : UIElement 12 | { 13 | private float _viewPosition; 14 | private float _viewSize = 1f; 15 | private float _maxViewSize = 20f; 16 | private bool _isDragging; 17 | private bool _isHoveringOverHandle; 18 | private float _dragXOffset; 19 | private Texture2D _texture; 20 | private Texture2D _innerTexture; 21 | 22 | public float ViewPosition 23 | { 24 | get 25 | { 26 | return this._viewPosition; 27 | } 28 | set 29 | { 30 | this._viewPosition = MathHelper.Clamp(value, 0f, this._maxViewSize - this._viewSize); 31 | } 32 | } 33 | 34 | public UIHorizontalScrollbar() 35 | { 36 | this.Height.Set(20f, 0f); 37 | this.MaxHeight.Set(20f, 0f); 38 | this._texture = ItemChecklist.instance.Assets.Request("UIElements/ScrollbarHorizontal", AssetRequestMode.ImmediateLoad).Value; //TextureManager.Load("Images/UI/Scrollbar"); 39 | this._innerTexture = ItemChecklist.instance.Assets.Request("UIElements/ScrollbarInnerHorizontal", AssetRequestMode.ImmediateLoad).Value; //TextureManager.Load("Images/UI/ScrollbarInner"); 40 | this.PaddingLeft = 5f; 41 | this.PaddingRight = 5f; 42 | } 43 | 44 | public void SetView(float viewSize, float maxViewSize) 45 | { 46 | viewSize = MathHelper.Clamp(viewSize, 0f, maxViewSize); 47 | this._viewPosition = MathHelper.Clamp(this._viewPosition, 0f, maxViewSize - viewSize); 48 | this._viewSize = viewSize; 49 | this._maxViewSize = maxViewSize; 50 | } 51 | 52 | public float GetValue() 53 | { 54 | return this._viewPosition; 55 | } 56 | 57 | private Rectangle GetHandleRectangle() 58 | { 59 | CalculatedStyle innerDimensions = base.GetInnerDimensions(); 60 | if (this._maxViewSize == 0f && this._viewSize == 0f) 61 | { 62 | this._viewSize = 1f; 63 | this._maxViewSize = 1f; 64 | } 65 | //return new Rectangle((int)innerDimensions.X, (int)(innerDimensions.Y + innerDimensions.Height * (this._viewPosition / this._maxViewSize)) - 3, 20, (int)(innerDimensions.Height * (this._viewSize / this._maxViewSize)) + 7); 66 | return new Rectangle((int)(innerDimensions.X + innerDimensions.Width * (this._viewPosition / this._maxViewSize)) - 3, (int)innerDimensions.Y, (int)(innerDimensions.Width * (this._viewSize / this._maxViewSize)) + 7, 20); 67 | } 68 | 69 | private void DrawBar(SpriteBatch spriteBatch, Texture2D texture, Rectangle dimensions, Color color) 70 | { 71 | //spriteBatch.Draw(texture, new Rectangle(dimensions.X, dimensions.Y - 6, dimensions.Width, 6), new Rectangle?(new Rectangle(0, 0, texture.Width, 6)), color); 72 | //spriteBatch.Draw(texture, new Rectangle(dimensions.X, dimensions.Y, dimensions.Width, dimensions.Height), new Rectangle?(new Rectangle(0, 6, texture.Width, 4)), color); 73 | //spriteBatch.Draw(texture, new Rectangle(dimensions.X, dimensions.Y + dimensions.Height, dimensions.Width, 6), new Rectangle?(new Rectangle(0, texture.Height - 6, texture.Width, 6)), color); 74 | spriteBatch.Draw(texture, new Rectangle(dimensions.X - 6, dimensions.Y, 6, dimensions.Height), new Rectangle(0, 0, 6, texture.Height), color); 75 | spriteBatch.Draw(texture, new Rectangle(dimensions.X, dimensions.Y, dimensions.Width, dimensions.Height), new Rectangle(6, 0, 4, texture.Height), color); 76 | spriteBatch.Draw(texture, new Rectangle(dimensions.X + dimensions.Width, dimensions.Y, 6, dimensions.Height), new Rectangle(texture.Width - 6, 0, 6, texture.Height), color); 77 | } 78 | 79 | protected override void DrawSelf(SpriteBatch spriteBatch) 80 | { 81 | CalculatedStyle dimensions = base.GetDimensions(); 82 | CalculatedStyle innerDimensions = base.GetInnerDimensions(); 83 | if (this._isDragging) 84 | { 85 | float num = UserInterface.ActiveInstance.MousePosition.X - innerDimensions.X - this._dragXOffset; 86 | this._viewPosition = MathHelper.Clamp(num / innerDimensions.Width * this._maxViewSize, 0f, this._maxViewSize - this._viewSize); 87 | } 88 | Rectangle handleRectangle = this.GetHandleRectangle(); 89 | Vector2 mousePosition = UserInterface.ActiveInstance.MousePosition; 90 | bool isHoveringOverHandle = this._isHoveringOverHandle; 91 | this._isHoveringOverHandle = handleRectangle.Contains(new Point((int)mousePosition.X, (int)mousePosition.Y)); 92 | if (!isHoveringOverHandle && this._isHoveringOverHandle && Main.hasFocus) 93 | { 94 | SoundEngine.PlaySound(SoundID.MenuTick); 95 | } 96 | this.DrawBar(spriteBatch, this._texture, dimensions.ToRectangle(), Color.White); 97 | this.DrawBar(spriteBatch, this._innerTexture, handleRectangle, Color.White * ((this._isDragging || this._isHoveringOverHandle) ? 1f : 0.85f)); 98 | } 99 | 100 | public override void LeftMouseDown(UIMouseEvent evt) 101 | { 102 | base.LeftMouseDown(evt); 103 | if (evt.Target == this) 104 | { 105 | Rectangle handleRectangle = this.GetHandleRectangle(); 106 | if (handleRectangle.Contains(new Point((int)evt.MousePosition.X, (int)evt.MousePosition.Y))) 107 | { 108 | this._isDragging = true; 109 | this._dragXOffset = evt.MousePosition.X - (float)handleRectangle.X; 110 | return; 111 | } 112 | CalculatedStyle innerDimensions = base.GetInnerDimensions(); 113 | float num = UserInterface.ActiveInstance.MousePosition.X - innerDimensions.X - (float)(handleRectangle.Width >> 1); 114 | this._viewPosition = MathHelper.Clamp(num / innerDimensions.Width * this._maxViewSize, 0f, this._maxViewSize - this._viewSize); 115 | } 116 | } 117 | 118 | public override void LeftMouseUp(UIMouseEvent evt) 119 | { 120 | base.LeftMouseUp(evt); 121 | this._isDragging = false; 122 | } 123 | } 124 | 125 | public class FixedUIHorizontalScrollbar : UIHorizontalScrollbar 126 | { 127 | internal UserInterface userInterface; 128 | 129 | public FixedUIHorizontalScrollbar(UserInterface userInterface) 130 | { 131 | this.userInterface = userInterface; 132 | } 133 | 134 | protected override void DrawSelf(SpriteBatch spriteBatch) 135 | { 136 | UserInterface temp = UserInterface.ActiveInstance; 137 | UserInterface.ActiveInstance = userInterface; 138 | base.DrawSelf(spriteBatch); 139 | UserInterface.ActiveInstance = temp; 140 | } 141 | 142 | public override void LeftMouseDown(UIMouseEvent evt) 143 | { 144 | UserInterface temp = UserInterface.ActiveInstance; 145 | UserInterface.ActiveInstance = userInterface; 146 | base.LeftMouseDown(evt); 147 | UserInterface.ActiveInstance = temp; 148 | } 149 | } 150 | 151 | public class InvisibleFixedUIHorizontalScrollbar : FixedUIHorizontalScrollbar 152 | { 153 | public InvisibleFixedUIHorizontalScrollbar(UserInterface userInterface) : base(userInterface) 154 | { 155 | } 156 | 157 | protected override void DrawSelf(SpriteBatch spriteBatch) 158 | { 159 | UserInterface temp = UserInterface.ActiveInstance; 160 | UserInterface.ActiveInstance = userInterface; 161 | //base.DrawSelf(spriteBatch); 162 | UserInterface.ActiveInstance = temp; 163 | } 164 | 165 | public override void LeftMouseDown(UIMouseEvent evt) 166 | { 167 | UserInterface temp = UserInterface.ActiveInstance; 168 | UserInterface.ActiveInstance = userInterface; 169 | base.LeftMouseDown(evt); 170 | UserInterface.ActiveInstance = temp; 171 | } 172 | } 173 | } 174 | -------------------------------------------------------------------------------- /UIElements/UIHoverImageButton.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework.Graphics; 2 | 3 | namespace ItemChecklist.UIElements 4 | { 5 | internal class UIHoverImageButton : UIImageButton 6 | { 7 | internal string hoverText; 8 | 9 | public UIHoverImageButton(Texture2D texture, string hoverText) : base(texture) 10 | { 11 | this.hoverText = hoverText; 12 | } 13 | 14 | protected override void DrawSelf(SpriteBatch spriteBatch) 15 | { 16 | base.DrawSelf(spriteBatch); 17 | if (IsMouseHovering) 18 | { 19 | ItemChecklistUI.hoverText = hoverText; 20 | } 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /UIElements/UIItemSlot.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using Microsoft.Xna.Framework.Graphics; 3 | using ReLogic.Graphics; 4 | using ReLogic.Content; 5 | using Terraria; 6 | using Terraria.GameContent; 7 | using Terraria.GameContent.UI.Elements; 8 | using Terraria.ID; 9 | using Terraria.ModLoader; 10 | using Terraria.UI; 11 | using Terraria.UI.Chat; 12 | 13 | namespace ItemChecklist.UIElements 14 | { 15 | internal class UIItemSlot : UIElement 16 | { 17 | public static Asset defaultBackgroundTexture = TextureAssets.InventoryBack9; 18 | public Asset backgroundTexture = defaultBackgroundTexture; 19 | internal float scale = .75f; 20 | public int itemType; 21 | public Item item; 22 | public int id; 23 | public bool hideSlot = false; 24 | internal static Item hoveredItem; 25 | public string badge; 26 | 27 | public UIItemSlot(Item item, int id, float scale = .75f) 28 | { 29 | this.scale = scale; 30 | this.item = item; 31 | this.id = id; 32 | this.itemType = item.type; 33 | this.Width.Set(defaultBackgroundTexture.Width() * scale, 0f); 34 | this.Height.Set(defaultBackgroundTexture.Height() * scale, 0f); 35 | } 36 | 37 | internal int frameCounter = 0; 38 | internal int frameTimer = 0; 39 | private const int frameDelay = 7; 40 | 41 | protected override void DrawSelf(SpriteBatch spriteBatch) 42 | { 43 | if (item != null) 44 | { 45 | CalculatedStyle dimensions = base.GetInnerDimensions(); 46 | Rectangle rectangle = dimensions.ToRectangle(); 47 | if (!hideSlot) 48 | { 49 | spriteBatch.Draw(backgroundTexture.Value, dimensions.Position(), null, Color.White, 0f, Vector2.Zero, scale, SpriteEffects.None, 0f); 50 | DrawAdditionalOverlays(spriteBatch, dimensions.Position(), scale); 51 | } 52 | if (!item.IsAir) 53 | { 54 | Utilities.LoadItem(this.item.type); 55 | Texture2D itemTexture = TextureAssets.Item[this.item.type].Value; 56 | Rectangle rectangle2 = Main.itemAnimations[item.type]?.GetFrame(itemTexture) ?? itemTexture.Frame(); 57 | Color newColor = Color.White; 58 | float pulseScale = 1f; 59 | ItemSlot.GetItemLight(ref newColor, ref pulseScale, item, false); 60 | int height = rectangle2.Height; 61 | int width = rectangle2.Width; 62 | float drawScale = 1f; 63 | float availableWidth = (float)defaultBackgroundTexture.Width() * scale; 64 | if (width > availableWidth || height > availableWidth) 65 | { 66 | if (width > height) 67 | { 68 | drawScale = availableWidth / width; 69 | } 70 | else 71 | { 72 | drawScale = availableWidth / height; 73 | } 74 | } 75 | drawScale *= scale; 76 | Vector2 vector = backgroundTexture.Size() * scale; 77 | Vector2 position2 = dimensions.Position() + vector / 2f - rectangle2.Size() * drawScale / 2f; 78 | Vector2 origin = rectangle2.Size() * (pulseScale / 2f - 0.5f); 79 | //Vector2 drawPosition = dimensions.Position(); 80 | //drawPosition.X += defaultBackgroundTexture.Width * scale / 2f - (float)width * drawScale / 2f; 81 | //drawPosition.Y += defaultBackgroundTexture.Height * scale / 2f - (float)height * drawScale / 2f; 82 | 83 | Color alphaColor = Main.LocalPlayer.GetModPlayer().foundItem[id] ? item.GetAlpha(newColor) : Color.Black; 84 | Color colorColor = Main.LocalPlayer.GetModPlayer().foundItem[id] ? item.GetColor(Color.White) : Color.Black; 85 | 86 | if (ItemLoader.PreDrawInInventory(item, spriteBatch, position2, rectangle2, alphaColor, 87 | colorColor, origin, drawScale * pulseScale)) 88 | { 89 | spriteBatch.Draw(itemTexture, position2, new Rectangle?(rectangle2), alphaColor, 0f, origin, drawScale * pulseScale, SpriteEffects.None, 0f); 90 | if (item.color != Color.Transparent) 91 | { 92 | spriteBatch.Draw(itemTexture, position2, new Rectangle?(rectangle2), colorColor, 0f, origin, drawScale * pulseScale, SpriteEffects.None, 0f); 93 | } 94 | } 95 | ItemLoader.PostDrawInInventory(item, spriteBatch, position2, rectangle2, alphaColor, 96 | colorColor, origin, drawScale * pulseScale); 97 | if (ItemID.Sets.TrapSigned[item.type]) 98 | { 99 | spriteBatch.Draw(TextureAssets.Wire.Value, dimensions.Position() + new Vector2(40f, 40f) * scale, new Rectangle?(new Rectangle(4, 58, 8, 8)), Color.White, 0f, new Vector2(4f), 1f, SpriteEffects.None, 0f); 100 | } 101 | DrawAdditionalBadges(spriteBatch, dimensions.Position(), scale); 102 | if (item.stack > 1) 103 | { 104 | ChatManager.DrawColorCodedStringWithShadow(spriteBatch, FontAssets.ItemStack.Value, item.stack.ToString(), dimensions.Position() + new Vector2(10f, 26f) * scale, Color.White, 0f, Vector2.Zero, new Vector2(scale), -1f, scale); 105 | } 106 | 107 | //this.item.GetColor(Color.White); 108 | //spriteBatch.Draw(itemTexture, drawPosition, rectangle2, this.item.GetAlpha(Color.White), 0f, Vector2.Zero, drawScale, SpriteEffects.None, 0f); 109 | //if (this.item.color != default(Color)) 110 | //{ 111 | // spriteBatch.Draw(itemTexture, drawPosition, new Rectangle?(rectangle2), this.item.GetColor(Color.White), 0f, Vector2.Zero, drawScale, SpriteEffects.None, 0f); 112 | //} 113 | //if (this.item.stack > 1) 114 | //{ 115 | // spriteBatch.DrawString(Main.fontItemStack, this.item.stack.ToString(), new Vector2(drawPosition.X + 10f * scale, drawPosition.Y + 26f * scale), Color.White, 0f, Vector2.Zero, scale, SpriteEffects.None, 0f); 116 | //} 117 | 118 | if (ItemChecklistUI.showBadge && !string.IsNullOrEmpty(badge)) 119 | { 120 | spriteBatch.DrawString(FontAssets.ItemStack.Value, badge, new Vector2(dimensions.Position().X + 10f * scale, dimensions.Position().Y + 26f * scale), Color.White, 0f, Vector2.Zero, scale, SpriteEffects.None, 0f); 121 | } 122 | 123 | if (IsMouseHovering) 124 | { 125 | // TODO, should only need 2 of these 3 I think 126 | Main.HoverItem = item.Clone(); 127 | Main.hoverItemName = Main.HoverItem.Name + (Main.HoverItem.ModItem != null && ModContent.GetInstance().ShowItemModSource ? " [" + Main.HoverItem.ModItem.Mod.DisplayName + "]" : ""); 128 | 129 | // Main.hoverItemName = this.item.name; 130 | // Main.toolTip = item.Clone(); 131 | Main.HoverItem.SetNameOverride(Main.HoverItem.Name + (Main.HoverItem.ModItem != null && ModContent.GetInstance().ShowItemModSource ? " [" + Main.HoverItem.ModItem.Mod.DisplayName + "]" : "")); 132 | 133 | hoveredItem = Main.HoverItem; 134 | } 135 | } 136 | } 137 | } 138 | 139 | internal virtual void DrawAdditionalOverlays(SpriteBatch spriteBatch, Vector2 vector2, float scale) 140 | { 141 | } 142 | 143 | internal virtual void DrawAdditionalBadges(SpriteBatch spriteBatch, Vector2 vector2, float scale) 144 | { 145 | } 146 | } 147 | 148 | internal class UIItemNoSlot : UIElement 149 | { 150 | internal float scale = .75f; 151 | public int itemType; 152 | public Item item; 153 | public UIItemNoSlot(Item item, float scale = .75f) 154 | { 155 | this.scale = scale; 156 | this.item = item; 157 | this.itemType = item.type; 158 | this.Width.Set(32f * scale * 0.65f, 0f); 159 | this.Height.Set(32f * scale * 0.65f, 0f); 160 | } 161 | 162 | public override void Draw(SpriteBatch spriteBatch) 163 | { 164 | base.Draw(spriteBatch); 165 | 166 | Vector2 position = GetInnerDimensions().Position(); 167 | float num = 1f; 168 | float num2 = 1f; 169 | if (Main.netMode != NetmodeID.Server && !Main.dedServ) 170 | { 171 | Texture2D texture2D = TextureAssets.Item[item.type].Value; 172 | Rectangle rectangle; 173 | if (Main.itemAnimations[item.type] != null) 174 | { 175 | rectangle = Main.itemAnimations[item.type].GetFrame(texture2D); 176 | } 177 | else 178 | { 179 | rectangle = texture2D.Frame(1, 1, 0, 0); 180 | } 181 | if (rectangle.Height > 32) 182 | { 183 | num2 = 32f / (float)rectangle.Height; 184 | } 185 | } 186 | num2 *= scale; 187 | num *= num2; 188 | if (num > 0.75f) 189 | { 190 | num = 0.75f; 191 | } 192 | { 193 | float inventoryScale = Main.inventoryScale; 194 | Main.inventoryScale = scale * num; 195 | ItemSlot.Draw(spriteBatch, ref item, 14, position - new Vector2(10f) * scale * num, Color.White); 196 | Main.inventoryScale = inventoryScale; 197 | } 198 | 199 | if (IsMouseHovering) 200 | { 201 | //Main.HoverItem = item.Clone(); 202 | //Main.instance.MouseText(item.Name, item.rare, 0, -1, -1, -1, -1); 203 | 204 | Main.hoverItemName = item.Name; 205 | } 206 | } 207 | } 208 | 209 | //internal class UIHoverText : UIText 210 | //{ 211 | // string hover; 212 | // public UIHoverText(string hover, string text, float textScale = 1f, bool large = false) : base(text, textScale, large) 213 | // { 214 | // this.hover = hover; 215 | // } 216 | 217 | // protected override void DrawSelf(SpriteBatch spriteBatch) 218 | // { 219 | // base.DrawSelf(spriteBatch); 220 | 221 | // if (IsMouseHovering) 222 | // { 223 | // Main.hoverItemName = hover; 224 | // } 225 | // } 226 | //} 227 | } -------------------------------------------------------------------------------- /UIElements/UISilentImageButton.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using Microsoft.Xna.Framework.Graphics; 3 | using ReLogic.Graphics; 4 | using Terraria; 5 | using Terraria.GameContent; 6 | using Terraria.UI; 7 | using Terraria.UI.Chat; 8 | 9 | namespace ItemChecklist.UIElements 10 | { 11 | // A bit confusing, don't use. 12 | class UIBadgedSilentImageButton : UISilentImageButton 13 | { 14 | internal bool drawX = false; 15 | public UIBadgedSilentImageButton(Texture2D texture, string hoverText) : base(texture, hoverText) { 16 | } 17 | 18 | protected override void DrawSelf(SpriteBatch spriteBatch) { 19 | base.DrawSelf(spriteBatch); 20 | if (drawX) { 21 | CalculatedStyle dimensions = base.GetDimensions(); 22 | //ChatManager.DrawColorCodedStringWithShadow(spriteBatch, Main.fontItemStack, "X", dimensions.Position() + new Vector2(14f, 10f), Color.LightSalmon, 0f, Vector2.Zero, new Vector2(0.7f)); 23 | var r = dimensions.ToRectangle(); 24 | r.Inflate(-2, -2); 25 | spriteBatch.Draw(TextureAssets.Cd.Value, r, null, Color.White, 0, Vector2.Zero, SpriteEffects.None, 0); 26 | } 27 | } 28 | } 29 | 30 | class UISilentImageButton : UIElement 31 | { 32 | private Texture2D _texture; 33 | private float _visibilityActive = 1f; 34 | private float _visibilityHovered = .9f; 35 | private float _visibilityInactive = 0.8f; // or color? same thing? 36 | 37 | public bool selected; 38 | internal string hoverText; 39 | 40 | public UISilentImageButton(Texture2D texture, string hoverText) { 41 | this._texture = texture; 42 | this.Width.Set((float)this._texture.Width, 0f); 43 | this.Height.Set((float)this._texture.Height, 0f); 44 | this.hoverText = hoverText; 45 | 46 | base.Recalculate(); 47 | } 48 | 49 | public void SetImage(Texture2D texture) { 50 | this._texture = texture; 51 | this.Width.Set((float)this._texture.Width, 0f); 52 | this.Height.Set((float)this._texture.Height, 0f); 53 | 54 | base.Recalculate(); 55 | } 56 | 57 | protected override void DrawSelf(SpriteBatch spriteBatch) { 58 | if (selected) { 59 | var r = GetDimensions().ToRectangle(); 60 | r.Inflate(0, 0); 61 | //spriteBatch.Draw(UIElements.UIRecipeSlot.selectedBackgroundTexture, r, Color.White); 62 | spriteBatch.Draw(TextureAssets.InventoryBack14.Value, r, Color.White); 63 | } 64 | 65 | CalculatedStyle dimensions = base.GetDimensions(); 66 | spriteBatch.Draw(this._texture, dimensions.Position(), Color.White * (selected ? _visibilityActive : (IsMouseHovering ? _visibilityHovered : this._visibilityInactive))); 67 | if (IsMouseHovering) { 68 | Main.hoverItemName = hoverText; 69 | } 70 | } 71 | 72 | public override void MouseOver(UIMouseEvent evt) { 73 | base.MouseOver(evt); 74 | //Main.PlaySound(12, -1, -1, 1, 1f, 0f); 75 | } 76 | 77 | //public void SetVisibility(float whenActive, float whenInactive) 78 | //{ 79 | // this._visibilityActive = MathHelper.Clamp(whenActive, 0f, 1f); 80 | // this._visibilityInactive = MathHelper.Clamp(whenInactive, 0f, 1f); 81 | //} 82 | } 83 | } -------------------------------------------------------------------------------- /UIElements/UIToggleHoverImageButton.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using Microsoft.Xna.Framework.Graphics; 3 | using Terraria; 4 | using Terraria.Audio; 5 | using Terraria.ID; 6 | using Terraria.UI; 7 | 8 | namespace ItemChecklist.UIElements 9 | { 10 | public class UIToggleHoverImageButton : UIImageButton 11 | { 12 | //private Texture2D _texture; 13 | private Texture2D overlay; 14 | private float _visibilityActive = 1f; 15 | private float _visibilityInactive = 0.4f; 16 | bool enabled; 17 | internal string hoverText; 18 | 19 | public UIToggleHoverImageButton(Texture2D texture, Texture2D overlay, string hoverText, bool enabled = false) : base(texture) 20 | { 21 | this._texture = texture; 22 | this.overlay = overlay; 23 | this.Width.Set((float)this._texture.Width, 0f); 24 | this.Height.Set((float)this._texture.Height, 0f); 25 | this.hoverText = hoverText; 26 | this.enabled = enabled; 27 | } 28 | 29 | public void SetEnabled(bool enabled) 30 | { 31 | this.enabled = enabled; 32 | } 33 | 34 | protected override void DrawSelf(SpriteBatch spriteBatch) 35 | { 36 | CalculatedStyle dimensions = base.GetDimensions(); 37 | spriteBatch.Draw(this._texture, dimensions.Position(), Color.White * (base.IsMouseHovering ? this._visibilityActive : this._visibilityInactive)); 38 | if (!enabled) 39 | { 40 | // 32x32, overlay is 24x24. 41 | spriteBatch.Draw(this.overlay, dimensions.Position() + new Vector2(4), Color.White * (base.IsMouseHovering ? this._visibilityActive : this._visibilityInactive)); 42 | } 43 | if (IsMouseHovering) 44 | { 45 | ItemChecklistUI.hoverText = hoverText; 46 | } 47 | } 48 | 49 | public override void MouseOver(UIMouseEvent evt) 50 | { 51 | base.MouseOver(evt); 52 | SoundEngine.PlaySound(SoundID.MenuTick); 53 | } 54 | } 55 | 56 | public class UIImageButton : UIElement 57 | { 58 | protected Texture2D _texture; 59 | private float _visibilityActive = 1f; 60 | private float _visibilityInactive = 0.4f; 61 | 62 | public UIImageButton(Texture2D texture) 63 | { 64 | this._texture = texture; 65 | this.Width.Set((float)this._texture.Width, 0f); 66 | this.Height.Set((float)this._texture.Height, 0f); 67 | } 68 | 69 | public void SetImage(Texture2D texture) 70 | { 71 | this._texture = texture; 72 | this.Width.Set((float)this._texture.Width, 0f); 73 | this.Height.Set((float)this._texture.Height, 0f); 74 | } 75 | 76 | protected override void DrawSelf(SpriteBatch spriteBatch) 77 | { 78 | CalculatedStyle dimensions = base.GetDimensions(); 79 | spriteBatch.Draw(this._texture, dimensions.Position(), Color.White * (base.IsMouseHovering ? this._visibilityActive : this._visibilityInactive)); 80 | } 81 | 82 | public override void MouseOver(UIMouseEvent evt) 83 | { 84 | base.MouseOver(evt); 85 | SoundEngine.PlaySound(SoundID.MenuTick); 86 | } 87 | 88 | public void SetVisibility(float whenActive, float whenInactive) 89 | { 90 | this._visibilityActive = MathHelper.Clamp(whenActive, 0f, 1f); 91 | this._visibilityInactive = MathHelper.Clamp(whenInactive, 0f, 1f); 92 | } 93 | } 94 | } -------------------------------------------------------------------------------- /UIElements/checkBox.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavidPack/ItemChecklist/ccfcfc1e881aa099ad587dcd3bae7e43a5f48254/UIElements/checkBox.png -------------------------------------------------------------------------------- /UIElements/checkMark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavidPack/ItemChecklist/ccfcfc1e881aa099ad587dcd3bae7e43a5f48254/UIElements/checkMark.png -------------------------------------------------------------------------------- /UIElements/closeButton.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavidPack/ItemChecklist/ccfcfc1e881aa099ad587dcd3bae7e43a5f48254/UIElements/closeButton.png -------------------------------------------------------------------------------- /UIElements/closeButtonSmallWhite.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavidPack/ItemChecklist/ccfcfc1e881aa099ad587dcd3bae7e43a5f48254/UIElements/closeButtonSmallWhite.png -------------------------------------------------------------------------------- /Utilities.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using Microsoft.Xna.Framework.Graphics; 3 | using System.Collections.Generic; 4 | using System.IO; 5 | using System.Linq; 6 | using ReLogic.Content; 7 | using Terraria; 8 | using Terraria.GameContent; 9 | using Terraria.ID; 10 | using Terraria.Map; 11 | using Terraria.ObjectData; 12 | using Terraria.ModLoader; 13 | 14 | namespace ItemChecklist 15 | { 16 | static class Utilities 17 | { 18 | //public static Asset ToAsset(this Texture2D texture) 19 | //{ 20 | // using MemoryStream stream = new(); 21 | // texture.SaveAsPng(stream, texture.Width, texture.Height); 22 | // stream.Position = 0; 23 | // return RecipeBrowser.instance.Assets.CreateUntracked(stream, "any.png"); 24 | //} 25 | 26 | internal static Texture2D StackResizeImage(Asset[] texture2D, int desiredWidth, int desiredHeight) 27 | { 28 | foreach (Asset asset in texture2D) 29 | asset.Wait?.Invoke(); 30 | 31 | return StackResizeImage(texture2D.Select(asset => asset.Value).ToArray(), desiredWidth, desiredHeight); 32 | } 33 | 34 | internal static Texture2D StackResizeImage(Texture2D[] texture2D, int desiredWidth, int desiredHeight) 35 | { 36 | float overlap = .5f; 37 | float totalScale = 1 / (1f + ((1 - overlap) * (texture2D.Length - 1))); 38 | int newWidth = (int)(desiredWidth * totalScale); 39 | int newHeight = (int)(desiredHeight * totalScale); 40 | //var texture2Ds = texture2D.Select(x => ResizeImage(x, newWidth, newHeight)); 41 | 42 | RenderTarget2D renderTarget = new RenderTarget2D(Main.graphics.GraphicsDevice, desiredWidth, desiredHeight); 43 | Main.instance.GraphicsDevice.SetRenderTarget(renderTarget); 44 | Main.instance.GraphicsDevice.Clear(Color.Transparent); 45 | Main.spriteBatch.Begin(); 46 | 47 | int index = 0; 48 | foreach (var texture in texture2D) 49 | { 50 | float scale = 1; 51 | if (texture.Width > newWidth || texture.Height > newHeight) 52 | { 53 | if (texture.Height > texture.Width) 54 | scale = (float)newHeight / texture.Height; 55 | else 56 | scale = (float)newWidth / texture.Width; 57 | } 58 | 59 | Vector2 position = new Vector2(newWidth / 2, newHeight / 2); 60 | position += new Vector2(index * (1 - overlap) * newWidth, index * (1 - overlap) * newHeight); 61 | Main.spriteBatch.Draw(texture, position, null, Color.White, 0f, new Vector2(texture.Width / 2, texture.Height / 2), scale, SpriteEffects.None, 0f); 62 | index++; 63 | } 64 | Main.spriteBatch.End(); 65 | Main.instance.GraphicsDevice.SetRenderTarget(null); 66 | 67 | Texture2D mergedTexture = new Texture2D(Main.instance.GraphicsDevice, desiredWidth, desiredHeight); 68 | Color[] content = new Color[desiredWidth * desiredHeight]; 69 | renderTarget.GetData(content); 70 | mergedTexture.SetData(content); 71 | 72 | return mergedTexture; 73 | } 74 | 75 | internal static Texture2D ResizeImage(Asset asset, int desiredWidth, int desiredHeight) 76 | { 77 | asset.Wait?.Invoke(); 78 | return ResizeImage(asset.Value, desiredWidth, desiredHeight); 79 | } 80 | 81 | internal static Texture2D ResizeImage(Texture2D texture2D, int desiredWidth, int desiredHeight) 82 | { 83 | RenderTarget2D renderTarget = new RenderTarget2D(Main.graphics.GraphicsDevice, desiredWidth, desiredHeight); 84 | Main.instance.GraphicsDevice.SetRenderTarget(renderTarget); 85 | Main.instance.GraphicsDevice.Clear(Color.Transparent); 86 | Main.spriteBatch.Begin(); 87 | 88 | float scale = 1; 89 | if (texture2D.Width > desiredWidth || texture2D.Height > desiredHeight) 90 | { 91 | if (texture2D.Height > texture2D.Width) 92 | scale = (float)desiredWidth / texture2D.Height; 93 | else 94 | scale = (float)desiredWidth / texture2D.Width; 95 | } 96 | 97 | //new Vector2(texture2D.Width / 2 * scale, texture2D.Height / 2 * scale) desiredWidth/2, desiredHeight/2 98 | Main.spriteBatch.Draw(texture2D, new Vector2(desiredWidth / 2, desiredHeight / 2), null, Color.White, 0f, new Vector2(texture2D.Width / 2, texture2D.Height / 2), scale, SpriteEffects.None, 0f); 99 | 100 | Main.spriteBatch.End(); 101 | Main.instance.GraphicsDevice.SetRenderTarget(null); 102 | 103 | Texture2D mergedTexture = new Texture2D(Main.instance.GraphicsDevice, desiredWidth, desiredHeight); 104 | Color[] content = new Color[desiredWidth * desiredHeight]; 105 | renderTarget.GetData(content); 106 | mergedTexture.SetData(content); 107 | 108 | return mergedTexture; 109 | } 110 | 111 | internal static Dictionary tileTextures; 112 | 113 | internal static void GenerateTileTexture(int tile) 114 | { 115 | Texture2D texture; 116 | Main.instance.LoadTiles(tile); 117 | 118 | var tileObjectData = TileObjectData.GetTileData(tile, 0, 0); 119 | if (tileObjectData == null) 120 | { 121 | tileTextures[tile] = TextureAssets.MagicPixel.Value; 122 | return; 123 | } 124 | 125 | int width = tileObjectData.Width; 126 | int height = tileObjectData.Height; 127 | int padding = tileObjectData.CoordinatePadding; 128 | 129 | //Main.spriteBatch.End(); 130 | RenderTarget2D renderTarget = new RenderTarget2D(Main.graphics.GraphicsDevice, width * 16, height * 16); 131 | Main.instance.GraphicsDevice.SetRenderTarget(renderTarget); 132 | Main.instance.GraphicsDevice.Clear(Color.Transparent); 133 | Main.spriteBatch.Begin(); 134 | 135 | for (int i = 0; i < width; i++) 136 | { 137 | for (int j = 0; j < height; j++) 138 | { 139 | Main.spriteBatch.Draw(TextureAssets.Tile[tile].Value, new Vector2(i * 16, j * 16), new Rectangle(i * 16 + i * padding, j * 16 + j * padding, 16, 16), Color.White, 0f, Vector2.Zero, 1, SpriteEffects.None, 0f); 140 | } 141 | } 142 | 143 | Main.spriteBatch.End(); 144 | Main.instance.GraphicsDevice.SetRenderTarget(null); 145 | 146 | texture = new Texture2D(Main.instance.GraphicsDevice, width * 16, height * 16); 147 | Color[] content = new Color[width * 16 * height * 16]; 148 | renderTarget.GetData(content); 149 | texture.SetData(content); 150 | tileTextures[tile] = texture; 151 | } 152 | 153 | internal static string GetTileName(int tile) 154 | { 155 | int requiredTileStyle = Recipe.GetRequiredTileStyle(tile); 156 | string tileName = Lang.GetMapObjectName(MapHelper.TileToLookup(tile, requiredTileStyle)); 157 | if (tileName == "") 158 | { 159 | if (tile < TileID.Count) 160 | tileName = TileID.Search.GetName(tile);// $"Tile {tile}"; 161 | else 162 | tileName = Terraria.ModLoader.TileLoader.GetTile(tile).Name + " (err no entry)"; 163 | } 164 | return tileName; 165 | } 166 | 167 | internal static List PopulateAdjTilesForTile(int Tile) { 168 | List adjTiles = new List(); 169 | adjTiles.Add(Tile); 170 | 171 | ModTile modTile = TileLoader.GetTile(Tile); 172 | if (modTile != null) { 173 | adjTiles.AddRange(modTile.AdjTiles); 174 | } 175 | if (Tile == 302) 176 | adjTiles.Add(17); 177 | if (Tile == 77) 178 | adjTiles.Add(17); 179 | if (Tile == 133) { 180 | adjTiles.Add(17); 181 | adjTiles.Add(77); 182 | } 183 | if (Tile == 134) 184 | adjTiles.Add(16); 185 | if (Tile == 354) 186 | adjTiles.Add(14); 187 | if (Tile == 469) 188 | adjTiles.Add(14); 189 | if (Tile == 487) 190 | adjTiles.Add(14); 191 | if (Tile == 355) { 192 | adjTiles.Add(13); 193 | adjTiles.Add(14); 194 | } 195 | // TODO: GlobalTile.AdjTiles support (no player object, reflection needed since private) 196 | return adjTiles; 197 | } 198 | 199 | internal static Color textColor = Color.White; // new Color(Main.mouseTextColor, Main.mouseTextColor, Main.mouseTextColor); 200 | internal static Color noColor = Color.LightSalmon; // OrangeRed Red 201 | internal static Color yesColor = Color.LightGreen; // Green 202 | internal static Color maybeColor = Color.Yellow; // LightYellow LightGoldenrodYellow Yellow Goldenrod 203 | 204 | internal static void LoadItem(int type) { 205 | // Use this instead of Main.instance.LoadItem because we don't need ImmediateLoad 206 | if (TextureAssets.Item[type].State == AssetState.NotLoaded) 207 | Main.Assets.Request(TextureAssets.Item[type].Name, AssetRequestMode.AsyncLoad); 208 | } 209 | 210 | internal static void LoadNPC(int type) { 211 | // Use this instead of Main.instance.LoadNPC because we don't need ImmediateLoad 212 | if (TextureAssets.Npc[type].State == AssetState.NotLoaded) 213 | Main.Assets.Request(TextureAssets.Npc[type].Name, AssetRequestMode.AsyncLoad); 214 | } 215 | } 216 | } -------------------------------------------------------------------------------- /build.txt: -------------------------------------------------------------------------------- 1 | author = jopojelly 2 | version = 0.7 3 | displayName = Item Checklist 4 | homepage = https://forums.terraria.org/index.php?threads/item-checklist-in-game-100-item-collection-checklist.52786/ 5 | hideCode = false 6 | hideResources = false 7 | includeSource = true 8 | includePDB = true 9 | notworkingside = Client 10 | buildIgnore = .vs\*, Properties\*, *.csproj, *.user, obj\*, bin\*, *.config, lib\*, .gitignore, .git\* 11 | weakReferences = MagicStorage@0.6.0.3 12 | -------------------------------------------------------------------------------- /description.txt: -------------------------------------------------------------------------------- 1 | Item Checklist lets you view a checklist for picking up or crafting 100% of the items in the game 2 | 3 | Toggle the checklist with the hotkey assigned to it in the settings. 4 | 5 | The checklist has several buttons at the top followed by some search filters and then the category chooser panel. 6 | 7 | Cycle Found Filter: Filters the list to show All, only Found, or only missing items. 8 | Cycle Mod Filter: Lets you filter by all items, only vanilla items, or individual mods. 9 | Toggle Messages: Toggles the announcement chat text that happens when you pick up a new item. 10 | Toggle Collect Chest Items: You can toggle the behavior of counting items seen in chests as "collected". 11 | Show Sort Value Text: Toggles showing additional text on the items in the checklist related to the currently selected sort. 12 | 13 | Filter by Name: Filters the checklist by item name. 14 | Filter by tooltip: Filters the list by item tooltip. Try searching for "minions". 15 | 16 | Categories, Sub-Categories, Sorts, and Filters: The 1st line contains various categories. Sub-Categories will show up on the 2nd line if available. Sorts are also on the 2nd line, click on one to sort the checklist. Finally, Filters end the 2nd line. Use the scrollwheel to scroll these panels. 17 | 18 | Cycle Sort Method: Sorts the list by ID, Value, Alphabetical, Rarity, or the chest auto-sorting algorithm. 19 | 20 | If you use Magic Storage and have the Toggle Collect Chest Items enabled, you will also collect all items in storage if you access it. 21 | 22 | If you have Recipe Browser, try out its Query Hovered Item on the Checklist items to quickly bring the item into Recipe Browser. -------------------------------------------------------------------------------- /description_workshop.txt: -------------------------------------------------------------------------------- 1 | Item Checklist lets you view a checklist for picking up or crafting 100% of the items in the game 2 | 3 | Toggle the checklist with the hotkey assigned to it in the settings. 4 | 5 | The checklist has several buttons at the top followed by some search filters and then the category chooser panel. 6 | 7 | Cycle Found Filter: Filters the list to show All, only Found, or only missing items. 8 | Cycle Mod Filter: Lets you filter by all items, only vanilla items, or individual mods. 9 | Toggle Messages: Toggles the announcement chat text that happens when you pick up a new item. 10 | Toggle Collect Chest Items: You can toggle the behavior of counting items seen in chests as "collected". 11 | Show Sort Value Text: Toggles showing additional text on the items in the checklist related to the currently selected sort. 12 | 13 | Filter by Name: Filters the checklist by item name. 14 | Filter by tooltip: Filters the list by item tooltip. Try searching for "minions". 15 | 16 | Categories, Sub-Categories, Sorts, and Filters: The 1st line contains various categories. Sub-Categories will show up on the 2nd line if available. Sorts are also on the 2nd line, click on one to sort the checklist. Finally, Filters end the 2nd line. Use the scrollwheel to scroll these panels. 17 | 18 | Cycle Sort Method: Sorts the list by ID, Value, Alphabetical, Rarity, or the chest auto-sorting algorithm. 19 | 20 | If you use Magic Storage and have the Toggle Collect Chest Items enabled, you will also collect all items in storage if you access it. 21 | 22 | If you have Recipe Browser, try out its Query Hovered Item on the Checklist items to quickly bring the item into Recipe Browser. 23 | 24 | [h1]Links[/h1] 25 | Source code hosted on [url=github.com/JavidPack/ItemChecklist]GitHub[/url], collaboration welcome 26 | For questions or suggestions, come to my Discord: [url=discord.gg/w8Hcwby][img]https://discordapp.com/api/guilds/276235094622994433/widget.png?style=shield[/img][/url] 27 | Bug reports in the comments here will not be seen, come to Discord or Github to report issues. 28 | If you'd like to support my mods, I have a Patreon [url=www.patreon.com/jopojelly][img]https://i.imgur.com/xII2DwJ.png[/img][/url] 29 | [url=https://steamcommunity.com/profiles/76561198025715866/myworkshopfiles/?appid=1281930]Check out all my mods[/url] -------------------------------------------------------------------------------- /icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavidPack/ItemChecklist/ccfcfc1e881aa099ad587dcd3bae7e43a5f48254/icon.png -------------------------------------------------------------------------------- /icon_workshop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavidPack/ItemChecklist/ccfcfc1e881aa099ad587dcd3bae7e43a5f48254/icon_workshop.png -------------------------------------------------------------------------------- /lib/MagicStorage_v0.5.7.4.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavidPack/ItemChecklist/ccfcfc1e881aa099ad587dcd3bae7e43a5f48254/lib/MagicStorage_v0.5.7.4.dll --------------------------------------------------------------------------------