Feature - Implemented Decorate top level spooky forest choice adventures..

matt.chugg

Moderator
Would if be possible to decorate the top level (and possibly mid level) choice adventures for the spooky forest in the relay browser based on item quantities:

eg:

(meet the vampire hunter, trade bar skins or gain a spooky sapling)
would become:
(meet the vampire hunter, trade bar skins(3) or gain a spooky sapling(1))

and:

(gain a starter item, gain Spooky-Gro fertilizer or gain spooky temple map)
would become
(gain a starter item, gain Spooky-Gro fertilizer(0) or gain spooky temple map(NO COIN/HAVE COIN)

or something along those lines!

because at the point where I choose one of them, I don't know if I have any without specifically going and looking.
 

matt.chugg

Moderator
In editing my post, I overwrote what I wrote before thus meaning none of this makes sense!

Veracity: I had a go at trying to do this myself (adding to dynamicChoiceOptions), with mostly success but I ran into a problem with trying to determine if one has completed the larva quest? is there anything internal to check this?

Code:
			boolean donelarva = true; //????? how to determine this?!

PHP:
case 502:
			result = new String[ 3 ];
			// Option 1 Follow the old road
			int stakes = InventoryManager.getCount( ItemPool.WOODEN_STAKES );
			int hearts = InventoryManager.getCount( ItemPool.VAMPIRE_HEART );
			int barskins = InventoryManager.getCount( ItemPool.BAR_SKIN );
			int saplings = InventoryManager.getCount( ItemPool.SPOOKY_SAPLING );

			String stakesorhearts = "and get wooden stakes ";
			if (stakes >= 1) {
				stakesorhearts = "and trade <b>" + hearts + "</b> hearts ";
			}
			
			result [ 0 ] = "Gain some meat <span style=\"color:blue\">||</span> Meet the vampire hunter " + stakesorhearts + " <span style=\"color:magenta\">||</span> Sell bar skins (" + barskins  + ") or buy a spooky sapling (" + saplings + ")";
			
			// option 2 Explore the stream
			boolean spookymap = InventoryManager.getCount( ItemPool.SPOOKY_MAP ) >= 1;
			boolean treeholedcoin = InventoryManager.getCount( ItemPool.SPOOKY_MAP ) >= 1;
			boolean donelarva = true; //????? how to determine this?!
			
			String larvaormushrooms = "Get mosquito larva ";
			if( donelarva ) {
				larvaormushrooms = "Get 3 spooky mushrooms ";
			}
			
			String coinornothing = "<span style=\"color:blue\">||</span> Get tree-holed coin <span style=\"color:blue\">||</span> ";
			if(treeholedcoin || spookymap) {
				coinornothing = "<span style=\"color:blue\">||</span> ";
			}
			
			result [ 1 ] = larvaormushrooms + coinornothing + "Stats or Fight Vampire ";
			
			// options 3 Brave the dark thicket
			int fertalizer = InventoryManager.getCount( ItemPool.SPOOKY_FERTILIZER );
			
			String mapornothing = "";
			if (treeholedcoin) {
				mapornothing = "<span style=\"color:blue\">||</span> Get Sppoky Map ";
			}
			
			result [ 2 ] = "Starter items <span style=\"color:blue\">||</span> Get Spooky-Gro fertilizer (" + fertalizer + ") " + mapornothing;
			return result;
 
Last edited:

roippi

Developer
That sort of thing would be tracked in a user preference. However AFAIK there's no preference that tracks it. So your options are:

a) add a preference
b) see if you can kludge it together from some logic combination of KoLCharacter.getLevel(), Preferences.getInteger(), InventoryManager.hasItem(), and maybe stuff like KoLCharacter.getTempleUnlocked(). Not even sure if this is possible.
 

matt.chugg

Moderator
That sort of thing would be tracked in a user preference. However AFAIK there's no preference that tracks it. So your options are:

a) add a preference
b) see if you can kludge it together from some logic combination of KoLCharacter.getLevel(), Preferences.getInteger(), InventoryManager.hasItem(), and maybe stuff like KoLCharacter.getTempleUnlocked(). Not even sure if this is possible.

hmm ok, i'll look into this, I was thinking about updating one of the request classes to look at council response messages, and set a variable when each level quest is complete, which could then use an overload of QuestLogRequest.startedQuest and finishedQuest with an integer parameter of level returning whether the quest of that level is started, or finished!

Thoughts?

Whilst i'm learning and playing around in this area, how about the relay browser highlights the choice that is selected in the choice manager of mafia, or more cleverly highlights the reccomended option to complete any pending quests (for example, if you have a tree-holed coin recommend getting the map etc).

I'm still no good at java so this may take a while! :)
 

roippi

Developer
hmm ok, i'll look into this, I was thinking about updating one of the request classes to look at council response messages, and set a variable when each level quest is complete, which could then use an overload of QuestLogRequest.startedQuest and finishedQuest with an integer parameter of level returning whether the quest of that level is started, or finished!

Thoughts?

It seems like the function is redundant if you have an appropriate preference to look at. Preferences also benefit from being accessible to users.

My advice in general for people looking to dive into making patches would be to start out small - it's easier for the devs to parse and vet your code if you take little bites at first. Then once you've shown that you "get it," you can start taking on bigger projects. Even then, a dev will need to spend some time going over your code; the more complex it is, the more likely it is that it will be back-burnered for a significant period of time.

Whilst i'm learning and playing around in this area, how about the relay browser highlights the choice that is selected in the choice manager of mafia, or more cleverly highlights the reccomended option to complete any pending quests (for example, if you have a tree-holed coin recommend getting the map etc).

I'm still no good at java so this may take a while! :)

Well.. a few things here. First, like above, I'd say "keep it simple." If you wanted to add such a thing, make it be in its own patch.

But second, relay functionality is always something you have to be careful with. Mafia gives us the option to create our own relay overrides, so there needs to be a pretty good reason to incorporate something into the native interface.
 
Quest hints for Arboreal Respite do not show hasItem()

I just noticed that the quest hints for Arboreal Respite do not show whether you already have a spooky sapling, spooky grow, or the map. Being old, I've already forgot what I got yesterday and got a repeat.

EDIT: heh, shows how much I know about the variables in KoLmafia... item_amount()
 

roippi

Developer
Threads merged.

FWIW this feature is somewhat reliant on better quest tracking, which I just posted a thread about.
 
Top