v0.6 release, initial 1.4 release

This commit is contained in:
JavidPack
2022-09-22 00:37:29 -06:00
parent 8ed93d4589
commit 509e083190
10 changed files with 75 additions and 43 deletions

View File

@@ -22,18 +22,9 @@ namespace ItemChecklist
internal ItemChecklistUI ItemChecklistUI;
internal event Action<int> OnNewItem;
public ItemChecklist()
{
}
public override void Load()
{
// Latest uses ItemID.Sets.IsAMaterial, added 0.10.1.5
if (BuildInfo.tMLVersion < new Version(0, 10, 1, 5))
{
throw new Exception("\nThis mod uses functionality only present in the latest tModLoader. Please update tModLoader to use this mod\n\n");
}
instance = this;
ToggleChecklistHotKey = KeybindLoader.RegisterKeybind(this, "Toggle Item Checklist", "I");
MagicStorageIntegration.Load();
@@ -61,7 +52,7 @@ namespace ItemChecklist
UIElements.UIHorizontalGrid.moreRightTexture = null;
}
public override void AddRecipes()
public void SetupUI()
{
if (!Main.dedServ)
{
@@ -69,6 +60,7 @@ namespace ItemChecklist
//ItemChecklistUI.Activate();
ItemChecklistInterface = new UserInterface();
ItemChecklistInterface.SetState(ItemChecklistUI);
ItemChecklistUI.Visible = false;
}
}
@@ -113,6 +105,10 @@ namespace ItemChecklist
public class ItemChecklistSystem : ModSystem
{
public override void AddRecipes() {
ItemChecklist.instance.SetupUI();
}
public override void UpdateUI(GameTime gameTime)
{
ItemChecklist.ItemChecklistInterface?.Update(gameTime);

View File

@@ -1,22 +0,0 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30114.105
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ItemChecklist", "ItemChecklist.csproj", "{08602B6C-8E82-4BB4-A76A-606DF190C754}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{08602B6C-8E82-4BB4-A76A-606DF190C754}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{08602B6C-8E82-4BB4-A76A-606DF190C754}.Debug|Any CPU.Build.0 = Debug|Any CPU
{08602B6C-8E82-4BB4-A76A-606DF190C754}.Release|Any CPU.ActiveCfg = Release|Any CPU
{08602B6C-8E82-4BB4-A76A-606DF190C754}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal

View File

@@ -74,7 +74,7 @@ namespace ItemChecklist
findableItems = new bool[ItemLoader.ItemCount];
for (int i = 0; i < ItemLoader.ItemCount; i++)
{
if (i > 0 && !ItemID.Sets.Deprecated[i] && i != ItemID.Count && ItemChecklistUI.vanillaIDsInSortOrder != null && ItemChecklistUI.vanillaIDsInSortOrder[i] != -1) // TODO, is this guaranteed?
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?
{
totalItemsToFind++;
findableItems[i] = true;

View File

@@ -16,6 +16,8 @@ using Terraria.ModLoader;
using Terraria.UI;
using UIItemSlot = ItemChecklist.UIElements.UIItemSlot;
using Steamworks;
using System.Runtime.CompilerServices;
namespace ItemChecklist
{
@@ -206,9 +208,8 @@ namespace ItemChecklist
Item[] itemSlotItems = new Item[ItemLoader.ItemCount];
for (int i = 0; i < ItemLoader.ItemCount; i++)
{
Item item = new Item();
item.SetDefaults(i, false); // 300 ms vs 30 ms
if (item.type == 0)
Item item = ContentSamples.ItemsByType[i];
if (item.type == ItemID.None)
continue;
itemSlots[i] = new UIItemSlot(item, i);
itemSlotItems[i] = item;
@@ -233,6 +234,23 @@ namespace ItemChecklist
vanillaIDsInSortOrder[i] = Array.FindIndex(vanillaIDsInSortOrderTemp, x => x == i);
}
List<Item> list = ContentSamples.ItemsByType.Values.ToList();
IOrderedEnumerable<IGrouping<ContentSamples.CreativeHelper.ItemGroup, ContentSamples.CreativeHelper.ItemGroupAndOrderInGroup>> orderedEnumerable = from x in list
select new ContentSamples.CreativeHelper.ItemGroupAndOrderInGroup(x) into x
group x by x.Group into @group
orderby (int)@group.Key
select @group;
int order = 0;
foreach (IGrouping<ContentSamples.CreativeHelper.ItemGroup, ContentSamples.CreativeHelper.ItemGroupAndOrderInGroup> item2 in orderedEnumerable) {
foreach (ContentSamples.CreativeHelper.ItemGroupAndOrderInGroup item3 in item2) {
//vanillaIDsInSortOrder[order] = item3.ItemType;
// TODO...rename?
vanillaIDsInSortOrder[item3.ItemType] = order;
order++;
}
}
modnames = new List<string>() { "All", "Vanilla" };
modnames.AddRange(ModLoader.Mods.Where(mod => mod.GetContent<ModItem>().Any()).Select(x => x.Name)/*.Where(x => x != "ModLoader")*/);
@@ -323,10 +341,13 @@ namespace ItemChecklist
if (buttonsHaveDummyTextures)
{
Texture2D foundFilterTexture = Utilities.ResizeImage(ItemChecklist.instance.Assets.Request<Texture2D>("Images/filterFound"), 32, 32);
Main.instance.LoadItem(ItemID.Megaphone);
Main.instance.LoadItem(ItemID.Book);
Texture2D foundFilterTexture = Utilities.ResizeImage(ItemChecklist.instance.Assets.Request<Texture2D>("Images/filterFound", AssetRequestMode.ImmediateLoad), 32, 32);
Texture2D muteButtonTexture = Utilities.ResizeImage(TextureAssets.Item[ItemID.Megaphone], 32, 32);
//Texture2D sortButtonTexture = Utilities.ResizeImage(Main.itemTexture[ItemID.ToxicFlask], 32, 32);
Texture2D modFilterButtonTexture = Utilities.ResizeImage(ItemChecklist.instance.Assets.Request<Texture2D>("Images/filterMod"), 32, 32);
Texture2D modFilterButtonTexture = Utilities.ResizeImage(ItemChecklist.instance.Assets.Request<Texture2D>("Images/filterMod", AssetRequestMode.ImmediateLoad), 32, 32);
Texture2D collectChestItemsButtonTexture = Utilities.ResizeImage(TextureAssets.Cursors[8], 32, 32);
Texture2D showBadgeButtonTexture = Utilities.ResizeImage(TextureAssets.Item[ItemID.Book], 32, 32); // Main.extraTexture[58]
@@ -451,6 +472,12 @@ namespace ItemChecklist
updateNeeded = true;
}
public override void Draw(SpriteBatch spriteBatch) {
if (buttonsHaveDummyTextures)
return;
base.Draw(spriteBatch);
}
protected override void DrawSelf(SpriteBatch spriteBatch)
{
ItemChecklistUI.hoverText = "";

View File

@@ -0,0 +1,16 @@
{
"profiles": {
"Terraria": {
"commandName": "Executable",
"executablePath": "dotnet",
"commandLineArgs": "$(tMLPath)",
"workingDirectory": "$(tMLSteamPath)"
},
"TerrariaServer": {
"commandName": "Executable",
"executablePath": "dotnet",
"commandLineArgs": "$(tMLServerPath)",
"workingDirectory": "$(tMLSteamPath)"
}
}
}

View File

@@ -286,7 +286,7 @@ namespace ItemChecklist
foreach (int type in itemTexturePreload)
Main.instance.LoadItem(type);
//Texture2D terrariaSort = ResizeImage(Main.inventorySortTexture[1], 24, 24);
Texture2D terrariaSort = ResizeImage(TextureAssets.InventorySort[0], 24, 24);
Texture2D rarity = ResizeImage(TextureAssets.Item[ItemID.MetalDetector], 24, 24);
// TODO: Implement Badge text as used in Item Checklist.
@@ -296,7 +296,7 @@ namespace ItemChecklist
new Sort("Value", "Images/sortValue", (x,y)=>x.value.CompareTo(y.value), x=>x.value.ToString()),
new Sort("Alphabetical", "Images/sortAZ", (x,y)=>x.Name.CompareTo(y.Name), x=>x.Name.ToString()),
new Sort("Rarity", rarity, (x,y)=> x.rare==y.rare ? x.value.CompareTo(y.value) : Math.Abs(x.rare).CompareTo(Math.Abs(y.rare)), x=>x.rare.ToString()),
//new Sort("Terraria Sort", terrariaSort, (x,y)=> -ItemChecklistUI.vanillaIDsInSortOrder[x.type].CompareTo(ItemChecklistUI.vanillaIDsInSortOrder[y.type]), x=>ItemChecklistUI.vanillaIDsInSortOrder[x.type].ToString()),
new Sort("Terraria Sort", terrariaSort, ByCreativeSortingId, ByCreativeSortingIdBadgeText),
};
Texture2D materialsIcon = Utilities.StackResizeImage(new[] { TextureAssets.Item[ItemID.SpellTome] }, 24, 24);
@@ -590,6 +590,22 @@ namespace ItemChecklist
SelectedCategory = categories[0];
}
private string ByCreativeSortingIdBadgeText(Item x) {
return ItemChecklistUI.vanillaIDsInSortOrder[x.type].ToString();
}
private int ByCreativeSortingId(Item x, Item y) {
return ItemChecklistUI.vanillaIDsInSortOrder[x.type].CompareTo(ItemChecklistUI.vanillaIDsInSortOrder[y.type]);
ContentSamples.CreativeHelper.ItemGroupAndOrderInGroup itemGroupAndOrderInGroup = ContentSamples.ItemCreativeSortingId[x.type];
ContentSamples.CreativeHelper.ItemGroupAndOrderInGroup itemGroupAndOrderInGroup2 = ContentSamples.ItemCreativeSortingId[y.type];
int num = itemGroupAndOrderInGroup.Group.CompareTo(itemGroupAndOrderInGroup2.Group);
if (num == 0)
num = itemGroupAndOrderInGroup.OrderInGroup.CompareTo(itemGroupAndOrderInGroup2.OrderInGroup);
return num;
}
// TODO: Update with new 1.4 values.
Dictionary<int, float> vanillaGrappleRanges = new Dictionary<int, float>() {
[13] = 300f,

View File

@@ -1,12 +1,11 @@
author = jopojelly
version = 0.5.2
version = 0.6
displayName = Item Checklist
homepage = https://forums.terraria.org/index.php?threads/item-checklist-in-game-100-item-collection-checklist.52786/
hideCode = false
hideResources = false
includeSource = true
languageVersion = 6
includePDB = true
notworkingside = Client
buildIgnore = .vs\*, Properties\*, *.csproj, *.user, obj\*, bin\*, *.config, lib\*, .gitignore, .git\*
weakReferences = MagicStorage@0.4.3.1
weakReferences = MagicStorage@0.5.7.4

BIN
icon_workshop.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Binary file not shown.