Where are new items handled in the code?

Forum for alternative clients, mods & discussions on the same.

Moderator: Phades

Where are new items handled in the code?

Postby AnusBreath88 » Thu Oct 23, 2014 8:57 pm

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
AnusBreath88
 
Posts: 16
Joined: Tue Sep 23, 2014 1:31 am

Re: Where are new items handled in the code?

Postby Arcanist » Fri Oct 24, 2014 4:06 am

Do you mean a script, or code in the client?
User avatar
Arcanist
 
Posts: 2664
Joined: Mon Mar 19, 2012 2:01 pm

Re: Where are new items handled in the code?

Postby Xcom » Fri Oct 24, 2014 8:49 am

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.
User avatar
Xcom
 
Posts: 1105
Joined: Wed Dec 14, 2011 1:43 pm

Re: Where are new items handled in the code?

Postby AnusBreath88 » Fri Oct 24, 2014 10:40 pm

This code is so confusing. I probably won't have any other way of dealing with it besides spitting everything out to console. :x
AnusBreath88
 
Posts: 16
Joined: Tue Sep 23, 2014 1:31 am

Re: Where are new items handled in the code?

Postby borka » Mon Oct 27, 2014 5:06 am

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
User avatar
borka
 
Posts: 9965
Joined: Thu Feb 03, 2011 7:47 pm
Location: World of Sprucecap

Re: Where are new items handled in the code?

Postby loftar » Mon Oct 27, 2014 5:13 am

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
User avatar
loftar
 
Posts: 8926
Joined: Fri Apr 03, 2009 7:05 am


Return to The Wizards' Tower

Who is online

Users browsing this forum: Ahrefs [Bot] and 4 guests