Skip to content

Commit

Permalink
0.2.1 release.
Browse files Browse the repository at this point in the history
  • Loading branch information
JavidPack committed Jun 2, 2017
1 parent 5b77e8e commit bc23141
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 3 deletions.
38 changes: 38 additions & 0 deletions ItemChecklist.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using Terraria.DataStructures;
using ItemChecklist.UI;
using Microsoft.Xna.Framework;
using System;

namespace ItemChecklist
{
Expand All @@ -14,6 +15,7 @@ public class ItemChecklist : Mod
internal static ModHotKey ToggleChecklistHotKey;
internal static UserInterface ItemChecklistInterface;
internal ItemChecklistUI ItemChecklistUI;
internal event Action<int> OnNewItem;

public ItemChecklist()
{
Expand All @@ -40,6 +42,42 @@ public override void AddRecipes()
}
}

public override object Call(params object[] args)
{
try
{
string message = args[0] as string;
if (message == "RequestFoundItems")
{
if (Main.gameMenu)
{
return "NotInGame";
}
return Main.LocalPlayer.GetModPlayer<ItemChecklistPlayer>(this).foundItem;
}
else if (message == "RegisterForNewItem")
{
Action<int> callback = args[1] as Action<int>;
OnNewItem += callback;
return "RegisterSuccess";
}
else
{
ErrorLogger.Log("ItemChecklist Call Error: Unknown Message: " + message);
}
}
catch (Exception e)
{
ErrorLogger.Log("ItemChecklist Call Error: " + e.StackTrace + e.Message);
}
return "Failure";
}

internal void NewItem(int type)
{
OnNewItem?.Invoke(type);
}

int lastSeenScreenWidth;
int lastSeenScreenHeight;
public override void ModifyInterfaceLayers(List<MethodSequenceListItem> layers)
Expand Down
3 changes: 2 additions & 1 deletion ItemChecklistGlobalItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@ internal void ItemReceived(Item item)
ItemChecklist.instance.ItemChecklistUI.UpdateNeeded(item.type);
if (ItemChecklistUI.announce)
{
Main.NewText($"You obtained your first {item.name}. {itemChecklistPlayer.totalItemsFound}/{itemChecklistPlayer.totalItemsToFind} {(100f*itemChecklistPlayer.totalItemsFound/itemChecklistPlayer.totalItemsToFind).ToString("0.00")}%");
Main.NewText($"You found your first {item.name}. {itemChecklistPlayer.totalItemsFound}/{itemChecklistPlayer.totalItemsToFind} {(100f*itemChecklistPlayer.totalItemsFound/itemChecklistPlayer.totalItemsToFind).ToString("0.00")}%");
}
ItemChecklist.instance.NewItem(item.type);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion ItemChecklistUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public override void OnInitialize()
{
// Is initialize called? (Yes it is called on reload) I want to reset nicely with new character or new loaded mods: visible = false;

announce = true; // overwritten by modplayer
announce = false; // overwritten by modplayer

checklistPanel = new UIPanel();
checklistPanel.SetPadding(10);
Expand Down
2 changes: 1 addition & 1 deletion build.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
author = jopojelly
version = 0.2.0.2
version = 0.2.1
displayName = Item Checklist
homepage = https://forums.terraria.org/index.php?threads/item-checklist-in-game-100-item-collection-checklist.52786/
hideCode = false
Expand Down

0 comments on commit bc23141

Please sign in to comment.