JavidPack / RecipeBrowser

RecipeBrowser mod for tModLoader
https://forums.terraria.org/index.php?threads/recipe-browser.62462/
79 stars 50 forks source link

Data source #15

Closed njt1982 closed 6 years ago

njt1982 commented 6 years ago

Hi,

Where does this app get it's data source from? ie where are the items, materials and recipes? I'm hunting the internet for some kind of CSV or JSON file... or a tool to extract the data from Terraria.

Best I have found so far is on gamepedia... https://terraria.gamepedia.com/Item_IDs

Thanks :)

JavidPack commented 6 years ago

It just gets the data from the items in game. Nothing is done manually, just conditions in code.

Since you mentioned wanting a tool to extract data, I've attached something I worked on earlier which was used to populate the tModLoader GitHub wiki pages and spreadsheets. You can use it as a guide to whatever you are trying to do. I don't know if it still works but I'm sure you can figure it out. If you want to ask more questions, come to the tmodloader discord server and chat with me. WikiAutomation.zip

njt1982 commented 6 years ago

Thanks for that @JavidPack - much appreciated.

I've done very little C# dev, but from what I can see/understand... it looks like it's opening a DLL and parsing the data inside that?

Part of my issue here is that I'm working on an OSX machine (I dont have a windows dev box). Your code mentions Terraria.Libraries.ReLogic.ReLogic.dll which seems more like a namespace than filename to me, but in the OSX Steam Apps folder, all I seem to have is:

$ find . -name "*.dll"
./System.Xml.Linq.dll
./Mono.Posix.dll
./System.Configuration.dll
./System.Runtime.Serialization.dll
./WindowsBase.dll
./mscorlib.dll
./System.Windows.Forms.dll
./Mono.Security.dll
./System.Data.dll
./System.dll
./FNA.dll
./System.Numerics.dll
./System.Xml.dll
./System.Drawing.dll
./System.Security.dll
./System.Core.dll

Also, your code has using Terraria which, to me (a c# amateur) looks like your importing a package or class which is not included in your zip file? It refers to classes like Recipe too (which seems to handle parsing the DLL?)

Recipe r = Terraria.Main.recipe[a];

Is this code available anywhere?

If I were approaching this, I might look at using NodeJS or something... Looks like I need to parse the binary DLL?

JavidPack commented 6 years ago

ReLogic.dll is a dll embedded in Terraria.exe, an extracted version is here https://github.com/blushiemagic/tModLoader/tree/master/references .

using Terraria refers to Terraria.exe, which is a reference included in the csproj, Recipe is a class in Terraria.

None of this is parsing anything, it is literally running the code in Terraria.exe to construct the Recipe objects and then iterate through them.

The same happens for Items, Projectiles, and NPC in the currently commented out code.