New Content - Implemented potted tea tree

Bale

Minion
But... that is part of the item name. At least make cuppa optional in case, like me, someone else finds it hard to imagine leaving out part of the name. Otherwise I cannot use... cli_execute("teatree " + $item[cuppa Royal tea]);
 
yeah I thought it was a little odd, but not really worth complaining about. I just used:
Code:
cli_execute("teatree" + ( $item[cuppa that I want to summon].to_string().substring(6) ) );

Just for the hell of it, here's the function that I knocked up to pick or shake the tree depending on cuppa prices:
Code:
void mallcuppa(boolean silent) {
	int[item]prices;
	item[int]cuppas;
	float pricetotal;
	for i from 8601 to 8637 {
		item tea = to_item(i);
		cuppas[count(cuppas)]=tea;
		prices[tea] = mall_price(tea);
		pricetotal += prices[tea];
	}
	sort cuppas by 0-mall_price(value);
	pricetotal /= 37;
	int avgprice = pricetotal;
	print("Avg value " + avgprice + " meat, total = " + (avgprice * 3),"blue");
	print("Best tea is " + cuppas[0] + " at " + prices[cuppas[0]] + " meat","blue");
	string cuppacmd;
	string cuppaconfirm;
	if (avgprice*3 > prices[cuppas[0]]) {
		cuppacmd = "shake";
		cuppaconfirm = "Shake teatree?";
	}
	else {
		cuppacmd = cuppas[0].to_string().substring(6);
		cuppaconfirm = "Pick " + cuppacmd + " from teatree?";
	}
	if (silent || user_confirm(cuppaconfirm)) cli_execute("teatree " + cuppacmd);
}

Big surprise - cuppa royal tea is currently the best choice.
 
Last edited:

Bale

Minion
Avg value 53545 meat, total = 160635
Best tea is cuppa Royal tea at 950000 meat

That is awesome!!! I was just going with cuppa Royal tea because the price differential is ridiculous, but its better to use math because that might change some day. I suspect that for a long time to come, cuppa Royal tea is going to be better than 3 random teas or any one tea of choice.
 

Bale

Minion
For what it is worth, I simplified it to this before adding it to my logoutScript. (Executes silently if I am overdrunk.)

Code:
int price(item it) {
	return historical_age(it) > .8? mall_price(it): historical_price(it);
}

// mallcuppa by darkcodelagsniper 
void mallcuppa(boolean silent) {
	item [int] cuppas;
	float pricetotal;
	for i from 8601 to 8637 {
		item tea = to_item(i);
		cuppas[ count(cuppas) ]=tea;
		pricetotal += price(tea);
	}
	sort cuppas by -price(value);
	int shaketree = pricetotal * 3 / 37;
	if(!silent) {
		print("Avg value from shaking the tree is " + shaketree + " meat","blue");
		print("Best tea is " + cuppas[0] + " at " + historical_price(cuppas[0]) + " meat","blue");
	}
	string cuppacmd;
	string cuppaconfirm;
	if(shaketree > historical_price(cuppas[0])) {
		cuppacmd = "shake";
		cuppaconfirm = "Shake teatree?";
	} else {
		cuppacmd = cuppas[0].to_string().substring(6);
		cuppaconfirm = "Pick " + cuppacmd + " from teatree?";
	}
	if(silent || user_confirm(cuppaconfirm))
		cli_execute("teatree " + cuppacmd);
}

price() is just my standard replacement for mall_price(). It makes many things better including throwing away your prices map.
 
Last edited:

lostcalpolydude

Developer
Staff member
You can use the whole tea name, including "cuppa", in 16357. Existing code will work without any changes.

I had also added item numbers to ItemPool, but then used magic numbers in the code anyway, so that code needed some touchup regardless.
 

Erich

Member
Is there a daily deed function for the tea tree? It can work like the Every Deck dropdown, where you either pick random or have the list of specific ones.
 
If you mean a built-in daily deed that can be selected in preferences, I don't see it (r16472). Does it need something else to activate?
 
Bale means that all necessary support for the tea tree has been implemented. A built-in teatree deed would be a new feature request.

Here's a custom deed for it that should work (untested):
Code:
$CUSTOM|Combo|Teatree|_pottedTeaTreeUsed|$ITEM|Activi tea|false|teatree Activi tea|$ITEM|shake the tree|false|teatree shake|$ITEM|Activi tea|false|teatree Activi tea|$ITEM|Alacri tea|false|teatree Alacri tea|$ITEM|Boo tea|false|teatree Boo tea|$ITEM|Chari tea|false|teatree Chari tea|$ITEM|Craft tea|false|teatree Craft tea|$ITEM|Cruel tea|false|teatree Cruel tea|$ITEM|Dexteri tea|false|teatree Dexteri tea|$ITEM|Feroci tea|false|teatree Feroci tea|$ITEM|Flamibili tea|false|teatree Flamibili tea|$ITEM|Flexibili tea|false|teatree Flexibili tea|$ITEM|Frost tea|false|teatree Frost tea|$ITEM|Gill tea|false|teatree Gill tea|$ITEM|Impregnabili tea|false|teatree Impregnabili tea|$ITEM|Improprie tea|false|teatree Improprie tea|$ITEM|Insani tea|false|teatree Insani tea|$ITEM|Irritabili tea|false|teatree Irritabili tea|$ITEM|Loyal tea|false|teatree Loyal tea|$ITEM|Mana tea|false|teatree Mana tea|$ITEM|Mediocri tea|false|teatree Mediocri tea|$ITEM|Monstrosi tea|false|teatree Monstrosi tea|$ITEM|Morbidi tea|false|teatree Morbidi tea|$ITEM|Nas tea|false|teatree Nas tea|$ITEM|Net tea|false|teatree Net tea|$ITEM|Neuroplastici tea|false|teatree Neuroplastici tea|$ITEM|Obscuri tea|false|teatree Obscuri tea|$ITEM|Physicali tea|false|teatree Physicali tea|$ITEM|Proprie tea|false|teatree Proprie tea|$ITEM|Royal tea|false|teatree Royal tea|$ITEM|Serendipi tea|false|teatree Serendipi tea|$ITEM|Sobrie tea|false|teatree Sobrie tea|$ITEM|Toast tea|false|teatree Toast tea|$ITEM|Twen tea|false|teatree Twen tea|$ITEM|Uncertain tea|false|teatree Uncertain tea|$ITEM|Vitali tea|false|teatree Vitali tea|$ITEM|Voraci tea|false|teatree Voraci tea|$ITEM|Wit tea|false|teatree Wit tea|$ITEM|Yet tea|false|teatree Yet tea
 

Erich

Member
Bale means that all necessary support for the tea tree has been implemented. A built-in teatree deed would be a new feature request.

Here's a custom deed for it that should work (untested):
Code:
$CUSTOM|Combo|Teatree|_pottedTeaTreeUsed|$ITEM|Activi tea|false|teatree Activi tea|$ITEM|shake the tree|false|teatree shake|$ITEM|Activi tea|false|teatree Activi tea|$ITEM|Alacri tea|false|teatree Alacri tea|$ITEM|Boo tea|false|teatree Boo tea|$ITEM|Chari tea|false|teatree Chari tea|$ITEM|Craft tea|false|teatree Craft tea|$ITEM|Cruel tea|false|teatree Cruel tea|$ITEM|Dexteri tea|false|teatree Dexteri tea|$ITEM|Feroci tea|false|teatree Feroci tea|$ITEM|Flamibili tea|false|teatree Flamibili tea|$ITEM|Flexibili tea|false|teatree Flexibili tea|$ITEM|Frost tea|false|teatree Frost tea|$ITEM|Gill tea|false|teatree Gill tea|$ITEM|Impregnabili tea|false|teatree Impregnabili tea|$ITEM|Improprie tea|false|teatree Improprie tea|$ITEM|Insani tea|false|teatree Insani tea|$ITEM|Irritabili tea|false|teatree Irritabili tea|$ITEM|Loyal tea|false|teatree Loyal tea|$ITEM|Mana tea|false|teatree Mana tea|$ITEM|Mediocri tea|false|teatree Mediocri tea|$ITEM|Monstrosi tea|false|teatree Monstrosi tea|$ITEM|Morbidi tea|false|teatree Morbidi tea|$ITEM|Nas tea|false|teatree Nas tea|$ITEM|Net tea|false|teatree Net tea|$ITEM|Neuroplastici tea|false|teatree Neuroplastici tea|$ITEM|Obscuri tea|false|teatree Obscuri tea|$ITEM|Physicali tea|false|teatree Physicali tea|$ITEM|Proprie tea|false|teatree Proprie tea|$ITEM|Royal tea|false|teatree Royal tea|$ITEM|Serendipi tea|false|teatree Serendipi tea|$ITEM|Sobrie tea|false|teatree Sobrie tea|$ITEM|Toast tea|false|teatree Toast tea|$ITEM|Twen tea|false|teatree Twen tea|$ITEM|Uncertain tea|false|teatree Uncertain tea|$ITEM|Vitali tea|false|teatree Vitali tea|$ITEM|Voraci tea|false|teatree Voraci tea|$ITEM|Wit tea|false|teatree Wit tea|$ITEM|Yet tea|false|teatree Yet tea

This is what I was originally looking for. Thank you kindly.
 

D3tox

New member
I apologize in advance if I'm wrong but I'm 70% sure I might've found a bug when using the "teatree" CLI command.

Here's my issue: I'm executing a CLI script by invoking java in a command prompt. I have a list of daily commands I execute, but when ran twice in a day, my script will get hung-up after "You have already harvested your potted tea tree today.".
I've temporarily fixed it by just moving my teatree harvest to the end of the script, but is there something I can do to avoid not moving onto my next task if this error is thrown?
DISCLAIMER: I just wrote the script this evening so to be fair, I'm not sure if it is hung up after a successful harvest or not (I pulled my tea the old-fashioned way today) but the exact command I execute is "teatree cuppa royal tea". Has anyone else encountered something like this?
 

Darzil

Developer
I suggest if you don't want it to abort, to check _pottedTeaTreeUsed = false before running the command.

Failed commands tend to cause an abort.
 

D3tox

New member
Thanks for the speedy reply :)

I just found it odd that most other daily use items/skills/Witchess fights would continue onto the next item even when invoked with no uses left. (i.e. trying to eat with no fullness left, using Chroner Cross with no daily uses, casting Summon Geeky Gifts with no uses left, etc.). Shouldn't it try to move onto the next command even after failure like these things? I understand it's a campground item so the mechanics are probably different. I'd also believe you if you told me that's just how it works and to drop it :)

I'm not necessarily interested in avoiding the hang-up now that its the last thing anyway, but thanks for the tip ;)

I can get this to replicate in the CLI inside mafia as well and not just in the command prompt (which I'm sure is unsurprising).

An easy way to demonstrate would be the following .TXT script:

teatree cuppa royal tea
breakfast (or use <daily item>)

If you attempt to run this script twice (once initially to pick your tea, and again for... fun?), you'll never see breakfast ran twice, where as the inverse:

breakfast (or use <daily item>)
teatree cuppa royal tea

spits out all sorts of failed summon/use cases without being hung-up.

I know this is a super tedious and mundane detail, this is literally the only "problem" I've ever had with Mafia so I can't thank or appreciate the work everyone that contributes to this project enough; please don't think I'm trying to shit on anyone's work by asking about this :D.
 

xKiv

Active member
alternatively, guard the aborting command with a "try":
try ; teatree whatevertea

that will still "abort", but then proceed to ignore the abort
there are many guards in the castle^W^Wmy daily scripts
 
Top