Bug - Fixed Crimbotree not checking Crimbo Tree at log on

Bale

Minion
From this thread:

Yesterday, the crimbotree command told me that I had 6 days until I got a present. So I visited the actual Crimbo Tree in the relay browser and it said 2 days. crimbotree updated.

Code:
[COLOR="#808000"]> crimbotree[/COLOR]

Check back in 6 days.
Visiting Crimbo Tree in clan VIP lounge
Visiting Crimbo Tree in clan VIP lounge

[COLOR="#808000"]> crimbotree[/COLOR]

Check back in 2 days.


Similar thing today. The countdown was fixed when I entered the VIP room in the relay browser.

Code:
[COLOR="#808000"]> crimbotree[/COLOR]

Check back in 2 days.
Visiting Crimbo Tree in clan VIP lounge

[COLOR="#808000"]> crimbotree[/COLOR]

Check back in 1 days.
 

Spiny

Member
Thanks for posting this. I am not religious about checking my tree and lo and behold, my daily deeds said 6 days to go, I clicked on the tree and there was a gift waiting for me!
 

DoctorRotelle

Developer
When I added the crimbotree code, it became obvious that there would be issues for folks who switch clans to clans without a crimbotree.

I'm not sure why it isn't updating when it checks the VIP lounge for "drink me" potions during breakfast. A tree with a present should be recognized and the "days left" should get checked if, and only if, there isn't a present waiting. Any visit to the VIP lounge should always update the tree info. Since mafia and kol don't work on proper calendar days, it is hard to set a "date when you last got a present" in the preferences and display a counter to the next possible gift date. A message sent to veracity asking about internal dating structures I should look at has got no response yet. I had thought perhaps the planting scheduler for mushroom fields might be the answer, but this is going beyond my coding and detective abilities.

I am wide open to suggestions, so feel free to leave a comment here or send me a message via the forums.
-=DoctorRotelle
 

morgad

Member
a couple of data points -

I have not switched clans in over a year

The code worked two weeks ago


best regards
Dave
 

heeheehee

Developer
Staff member
Perhaps a preference, set to the future date (format YYYYMMDD) when the next present should be available? (Initially assumed to be the current day, until a visit to the tree determines otherwise. Not reset by ascension. Also, if it is a date previous to today, set to today.)
 

Fluxxdog

Active member
Gotta back up Morgad. Only been in one clan my entire KoL career. Noticed this using 8463. Daily Deeds said I had 2 days left. Check the lounge, my present was already ready.
 

DoctorRotelle

Developer
This one doesn't work as I am a practical example. I play ronin characters "before midnight" and ronin clear characters after. This breaks the logic as a character may be on before rollover one day, and after, on the next/same date, while on a different KoL day. This makes the date vague when rollover happens when you're awake in your timezone. Planting mushrooms also requires similar logic, and I really don't want to reinvent the wheel... As for the rest of the suggestions, they were already in the code.

morgad's issue is very intriguing as nothing's changed in the code since its introduction, and he didn't seem to recognize or comment on the possible scenarios where his issue can be noticed. So, I'd like to specifically state the code from clanLoungeRequest.java:
Code:
		if ( action == null )
		{
			if ( responseText.indexOf( "tree5.gif" ) != -1 )
			{
				Preferences.setInteger( "crimboTreeDays", 0 );
				RequestLogger.printLine( "You have a present under the Crimbo tree in your clan's VIP lounge!" );
			}
			else if( responseText.indexOf( "crimbotree" ) != -1 )
			{
				Preferences.setBoolean( "_crimboTree", true );
				ClanLoungeRequest request = new ClanLoungeRequest( ClanLoungeRequest.CRIMBO_TREE );
				request.run();
			}
			else if( responseText.indexOf( "crimbotree" ) == -1 )
			{
				Preferences.setBoolean( "_crimboTree", false );
			}
			return;
		}

Basically, WHENEVER there is a visit the VIP lounge by you or mafia's breakfast routine, this information has a chance to get updated for all lounge equipment. If you breakfast in a clan without a crimbo tree, it can't do this until you "visit" the VIP lounge in a clan that has one. Otherwise, it can only display the "days" it learned on your previous visit. Additionally, if you set mafia to not do anything in the VIP lounge with a crimbo tree during breakfast, this information will not get updated. There is no code to countdown your days left as it is possible to be logged off for more than your remaining days and it would also be inaccurate. The only way to really solve it was to make the crimbotree command update the data whenever it found a crimbo tree. Switching clans doesn't cause mafia to recheck clan or lounge equipment, the crimbotree command without the "get" option is only an alias to display the crimboTreeDays variable, not to check the tree.

Bale's script is easily fixed with a premptive visit_url("clan_viplounge.php");

My working assumption was thus: if you have access to the VIP lounge, you'd do something in there during breakfast, which should cause the equipment to get scanned initially. The crimboTreeDays number would update at that time.

This was a far from graceful solution for folks who do breakfast in 100% scripted ways, but what can you do with on-demand based programming vs desire to limit the login routine to bare minimum, global timezones, daylight savings and general timezone configuration illiteracy and my desire to play characters in and out of ronin while balancing the desire to keep server hits to a minimum? Honestly, this is only my second real unique addition to mafia's java code.

The logical desire is to use the KoL date. Which doesn't have a readily available year and causes problems when you're something like 95-102 days away from that's mafia's last usage by that character (like on my non-main PC where I only play KoL on rare occasion). So, until there's a better solution, you can use the visit_url("clan_viplounge.php"); in your ASH scripts before your crimbotree command to guarantee results.
 

Spiny

Member
For reference, I spent rollover in a clan with a crimbo tree. Breakfast is run by mafia at login including grabbing a DRINK ME potion and using Deluxe Mr. Claw. I saw no reference to the crimbo tree during this breakfast (normally I don't even look). I checked daily deeds and it said 7 days. In the relay browser I entered the VIP Lounge and watched as the daily deeds crimbo tree counter shifted to 6 days.

Code:
Validating login server (www7.kingdomofloathing.com)...
Redirected to www3.kingdomofloathing.com...
Redirected to www4.kingdomofloathing.com...
588 players online.
Sending login request...
Initializing session for Spiny Twizzler...
Refreshing session data...
Synchronizing moon data...
Retrieving character data...
Retrieving familiar data...
Familiar data retrieved.
Refreshing closet...
Unknown item found: pawn cookie (4624, 137520522)
--------------------
4624 pawn cookie food all 100
4624 137520522 pawn cookie
# pawn cookie
--------------------
Updating consumable items...
Writing data override: /home/me/.kolmafia/data/tradeitems.txt
Writing data override: /home//me.kolmafia/data/itemdescs.txt
Writing data override: /home/me/.kolmafia/data/modifiers.txt
Updating miscellaneous items...
Refreshing stickers...
Retrieving campground data...
Session data refreshed.
6 days until Feast of Boris, Moxie bonus today and yesterday.
Visiting Mr. Klaw "Skill" Crane Game in clan rumpus room
Visiting Mr. Klaw "Skill" Crane Game in clan rumpus room
Visiting Mr. Klaw "Skill" Crane Game in clan rumpus room
You acquire an item: stuffed sleazy gravy fairy
Visiting Potted Meat Tree in clan rumpus room
You gain 925 Meat
[B]Visiting Deluxe Mr. Klaw "Skill" Crane Game in clan VIP lounge
Visiting Deluxe Mr. Klaw "Skill" Crane Game in clan VIP lounge
Visiting Deluxe Mr. Klaw "Skill" Crane Game in clan VIP lounge
You acquire an item: stuffed key
Visiting Looking Glass in clan VIP lounge
You acquire an item: "DRINK ME" potion[/B]
Using 1 Manual of Dexterity...
Finished using 1 Manual of Dexterity.
Using 1 handmade hobby horse...
You gain 20 Beefiness
Finished using 1 handmade hobby horse.
Using 1 ball-in-a-cup...
You gain 22 Mysteriousness
Finished using 1 ball-in-a-cup.
Using 1 set of jacks...
You gain 26 Cheek
Finished using 1 set of jacks.
Using 1 Chester's bag of candy...
You acquire an item: marzipan skull
You acquire Angry Farmer candy (2)
You acquire Tasty Fun Good rice candy (2)
You acquire an item: Yummy Tummy bean
Finished using 1 Chester's bag of candy.
Using 1 burrowgrub hive...
Finished using 1 burrowgrub hive.
Using 1 glass gnoll eye...
You acquire an item: breath mint
Finished using 1 glass gnoll eye.
Collecting cut of hippy profits...
You gain 4,383 Meat
You acquire an item: fisherman's sack
Casting Summon Crimbo Candy 1 times...
You acquire an item: Crimbo peppermint bark
You acquire an item: Crimbo fudge
You acquire an item: Crimbo fudge
Summon Crimbo Candy was successfully cast.
1050 prices updated from http://kolmafia.us/scripts/updateprices.php?action=getmap
05/26/10 02:40:43 PM - A new announcement has been posted in your Clan Hall.
Visiting Crimbo Tree in clan VIP lounge [color=red]Manual relay browser visit to lounge[/color]

Edit:
Further analysis...
In my clan with the crimbo tree:

Code:
> prefref crimbo

useCrimboToysHardcore (global, now 'true', default false)
useCrimboToysSoftcore (global, now 'true', default true)
[B]_crimboTree (user, now 'true', default false)[/B]
crimboTreeDays (user, now '6', default 7)
Returned: void

If I clanhop to a clan without a crimbo tree:

Code:
> prefref crimbo

useCrimboToysHardcore (global, now 'true', default false)
useCrimboToysSoftcore (global, now 'true', default true)
[B]_crimboTree (user, now 'false', default false)[/B]
crimboTreeDays (user, now '6', default 7)
Returned: void

If I return to the clan with the crimbo tree:

Code:
> prefref crimbo

useCrimboToysHardcore (global, now 'true', default false)
useCrimboToysSoftcore (global, now 'true', default true)
[B]_crimboTree (user, now 'false', default false)[/B]
crimboTreeDays (user, now '6', default 7)
Returned: void

Logging out and back in to the same clan:

Code:
> prefref crimbo

useCrimboToysHardcore (global, now 'true', default false)
useCrimboToysSoftcore (global, now 'true', default true)
[B]_crimboTree (user, now 'false', default false)[/B]
crimboTreeDays (user, now '6', default 7)
Returned: void

If I manually call breakfast (even though I previously ran it the prior session):

Code:
> prefref crimbo

useCrimboToysHardcore (global, now 'true', default false)
useCrimboToysSoftcore (global, now 'true', default true)
[B]_crimboTree (user, now 'true', default false)[/B]
crimboTreeDays (user, now '6', default 7)
Returned: void

Hrmm, I thought I was on to something, but now I'm just more puzzled.
 
Last edited:

morgad

Member
worked for me on 20 may, failed on 21 may

top of my session logs -

Code:
==> morgad_20100520.txt <==

use 1 cheap toaster
You acquire an item: toast

use 1 cheap toaster
You acquire an item: toast

use 1 cheap toaster
You acquire an item: toast
Visiting Mr. Klaw "Skill" Crane Game in clan rumpus room
Visiting Mr. Klaw "Skill" Crane Game in clan rumpus room
Visiting Mr. Klaw "Skill" Crane Game in clan rumpus room
Visiting Potted Meat Bush in clan rumpus room
You gain 495 Meat

Visiting Crimbo Tree in clan VIP lounge   <==== *** this line ***

Visiting Deluxe Mr. Klaw "Skill" Crane Game in clan VIP lounge
You acquire an item: stuffed key

Visiting Deluxe Mr. Klaw "Skill" Crane Game in clan VIP lounge
You acquire an item: stuffed teddy butler

Visiting Deluxe Mr. Klaw "Skill" Crane Game in clan VIP lounge
You acquire an item: designer handbag

==> morgad_20100521.txt <==

use 1 cheap toaster
You acquire an item: toast

use 1 cheap toaster
You acquire an item: toast

use 1 cheap toaster
You acquire an item: toast
Visiting Mr. Klaw "Skill" Crane Game in clan rumpus room
You acquire an item: stuffed MagiMechTech MicroMechaMech
Visiting Mr. Klaw "Skill" Crane Game in clan rumpus room
You acquire an item: stuffed astral badger
Visiting Mr. Klaw "Skill" Crane Game in clan rumpus room
You acquire an item: stuffed cocoabo
Visiting Potted Meat Bush in clan rumpus room
You gain 485 Meat

Visiting Deluxe Mr. Klaw "Skill" Crane Game in clan VIP lounge

Visiting Deluxe Mr. Klaw "Skill" Crane Game in clan VIP lounge

Visiting Deluxe Mr. Klaw "Skill" Crane Game in clan VIP lounge

my list of mafia downloads around that time -
Code:
-rw-r--r-- 1 fit fit   3229159 2010-05-08 21:15 KoLmafia-8430.jar
-rw-r--r-- 1 fit fit   3231542 2010-05-14 22:21 KoLmafia-8440.jar
-rw-r--r-- 1 fit fit   3232353 2010-05-17 18:07 KoLmafia-8442.jar
-rw-r--r-- 1 fit fit   3238016 2010-05-21 19:15 KoLmafia-8454.jar
-rw-r--r-- 1 fit fit   3239135 2010-05-23 10:10 KoLmafia-8459.jar

hope that helps
Dave
 

Spiny

Member
Hrmm, my 20100521 log shows the crimbo tree visit during breakfast. It is indeed absent in the 20100522 log during breakfast. I always spend rollover in the same clan with the crimbo tree. I do occasionally switch clans to one that has no tree to make use of some of their clawn owned goodies. I did not do a clan switch on that day at all. The crimbo tree visit is indeed absent from all subsequent logs during breakfast.

For me, kolmafia files in that time period are:
May 20 22:03 KoLmafia-8451.jar
May 21 03:43 KoLmafia-8452.jar
May 21 12:10 KoLmafia-8454.jar
May 21 16:39 KoLmafia-8455.jar
May 22 02:07 KoLmafia-8456.jar
May 22 17:41 KoLmafia-8459.jar

The session logs start being affected:
May 21 02:16 Spiny_Twizzler_20100521.txt Crimbo tree check during breakfast was good
May 22 03:29 Spiny_Twizzler_20100522.txt Crimbo tree check started not appearing with this session log
 
Last edited:
Top