I'm trying to figure out how new items are handled in the haven code. Unfortunately, I don't see much documentation on this topic. Basically what I want to do is create a list of items after they appear in my inventory so when I go foraging I have a running list of everything I've picked up this session without having to go back and count.
Can anyone direct me to the part of the code that handles newly aquired items in the inventory (i.e. foraged, dug up, found curios (think webs) etc)?
TYIA
Where are new items handled in the code?
Moderator: Phades
-
AnusBreath88
- Posts: 16
- Joined: Tue Sep 23, 2014 1:31 am
-
Arcanist
- Posts: 2664
- Joined: Mon Mar 19, 2012 2:01 pm
Re: Where are new items handled in the code?
Do you mean a script, or code in the client?
-
Xcom
- Posts: 1105
- Joined: Wed Dec 14, 2011 1:43 pm
Re: Where are new items handled in the code?
Look under Session.java. Thats the location of all the updated data inbound from the server. There is a specific section that receives item data and sends it to OCatch.java. Some of the code is a bit jumbled up and hard to follow but the long story goes like this.
First time you see the item the server relays what item ID belongs to what resource file. That happens in Resource.java. After the item is updated by the server telling your client what ID each item corresponds to what item or object you only get IDs from the server. The items are then linked to the resource previously attached to the specific ID and then if its a non-map object sent to the UI.java to get added into the widget list. The widget list updates and sends the object to the corresponding location to attach itself as a child. The objects are all a large chain of widgets starting from root widget and chains off into different children of each parent.
First time you see the item the server relays what item ID belongs to what resource file. That happens in Resource.java. After the item is updated by the server telling your client what ID each item corresponds to what item or object you only get IDs from the server. The items are then linked to the resource previously attached to the specific ID and then if its a non-map object sent to the UI.java to get added into the widget list. The widget list updates and sends the object to the corresponding location to attach itself as a child. The objects are all a large chain of widgets starting from root widget and chains off into different children of each parent.
-
AnusBreath88
- Posts: 16
- Joined: Tue Sep 23, 2014 1:31 am
Re: Where are new items handled in the code?
This code is so confusing. I probably won't have any other way of dealing with it besides spitting everything out to console. 
-
borka
- Posts: 9965
- Joined: Thu Feb 03, 2011 7:47 pm
- Location: World of Sprucecap
Re: Where are new items handled in the code?
If you found out how to make it public please
Avatar by SacreDoom
Java 8 - manually downloads - good to check for actual versions url here:
viewtopic.php?f=42&t=40331
Remember what the dormouse said: Feed your head Feed your head
Java 8 - manually downloads - good to check for actual versions url here:
viewtopic.php?f=42&t=40331
Remember what the dormouse said: Feed your head Feed your head
-
loftar
- Posts: 9096
- Joined: Fri Apr 03, 2009 7:05 am
- Location: Your character database
Re: Where are new items handled in the code?
Inventory items are created as new widgets in the corresponding inventory widget. UI.newwidget() is the basic entry point, so you can start there.
"Object-oriented design is the roman numerals of computing." -- Rob Pike