New Content - Implemented medicinal herbs use inv_spleen.php

From the item manager, and also via the cli "use medicinal herbs"
both of them resulted in mafia thinking that the herbs had been used, and removing 1 from the inventory.

I also tried "chew medicinal herbs" in the cli, which resulted in
Code:
Medicinal Herb's medicinal herbs is not a spleen toxin.

(this is an alt in who's currently Bad Moon Turtle Tamer, if you were wondering why I was being so suboptimal :) )
 
Here's a debug log of a cli "use medicinal herbs" request:
Code:
Using 1 Medicinal Herb's medicinal herbs...
class net.sourceforge.kolmafia.request.UseItemRequest
Connecting to inv_use.php...

Requesting: http://www.kingdomofloathing.com/inv_use.php?whichitem=1274&ajax=1
3 request properties
Field: Cookie = [appserver=www11; PHPSESSID=0jkbr2hakm3vc1bd6ldn8vmto0]
Field: User-Agent = [KoLmafia v16.8]
Field: Content-Type = [application/x-www-form-urlencoded]

Retrieving server reply...

Retrieved: http://www.kingdomofloathing.com/inv_use.php?whichitem=1274&ajax=1
10 header fields
Field: null = [HTTP/1.1 200 OK]
Field: Cache-Control = [no-store, no-cache, must-revalidate, post-check=0, pre-check=0]
Field: Server = [nginx/1.0.15]
Field: Connection = [keep-alive]
Field: Pragma = [no-cache]
Field: Expires = [Thu, 19 Nov 1981 08:52:00 GMT]
Field: Content-Length = [760]
Field: Date = [Thu, 26 Feb 2015 17:44:05 GMT]
Field: X-Powered-By = [PHP/5.3.3]
Field: Content-Type = [text/html; charset=UTF-8]

Retrieving server reply
ResponseText has 760 characters.
<script type="text/javascript">top.charpane.location.href="charpane.php";</script><script type="text/javascript">if (window.updateInv) updateInv([])</script><script type="text/javascript">if (!window.updateInv && parent.mainpane.updateInv) parent.mainpane.updateInv([])</script><center><table  width=95%  cellspacing=0 cellpadding=0><tr><td style="color: white;" align=center bgcolor=blue><b>Results:</b></td></tr><tr><td style="padding: 5px; border: 1px solid blue;"><center><table><tr><td><center><img src="http://images.kingdomofloathing.com/itemimages/goofballs.gif" width=30 height=30><br></center><blockquote>This item is not implemented yet.  Try again later.</blockquote></td></tr></table></center></td></tr><tr><td height=4></td></tr></table></center>
Processing results...
Processing result: Medicinal Herb's medicinal herbs (-1)
class net.sourceforge.kolmafia.request.ApiRequest
Connecting to api.php...

Requesting: http://www.kingdomofloathing.com/api.php?what=status&for=KoLmafia
3 request properties
Field: Cookie = [appserver=www11; PHPSESSID=0jkbr2hakm3vc1bd6ldn8vmto0]
Field: User-Agent = [KoLmafia v16.8]
Field: Content-Type = [application/x-www-form-urlencoded]

Retrieving server reply...

Retrieved: http://www.kingdomofloathing.com/api.php?what=status&for=KoLmafia
10 header fields
Field: null = [HTTP/1.1 200 OK]
Field: Cache-Control = [no-store, no-cache, must-revalidate, post-check=0, pre-check=0]
Field: Server = [nginx/1.0.15]
Field: Connection = [keep-alive]
Field: Pragma = [no-cache]
Field: Expires = [Thu, 19 Nov 1981 08:52:00 GMT]
Field: Content-Length = [2699]
Field: Date = [Thu, 26 Feb 2015 17:44:05 GMT]
Field: X-Powered-By = [PHP/5.3.3]
Field: Content-Type = [text/html; charset=UTF-8]

Retrieving server reply
ResponseText has 2699 characters.
{"playerid":"2051129","name":"this guy looks legit","hardcore":"1","ascensions":"4","path":"0","sign":"Bad Moon","roninleft":"832","casual":"0","drunk":"7","full":"13","turnsplayed":"8629","familiar":"1","hp":"5","mp":"9","meat":"3598","adventures":"8","level":"6","rawmuscle":"1187","rawmysticality":"241","rawmoxie":"312","basemuscle":"34","basemysticality":"15","basemoxie":"17","familiarexp":"42","class":"2","lastadv":{"id":"1018","name":"The Typical Tavern Cellar","link":"cellar.php","container":"tavern.php"},"title":"6","pvpfights":"100","maxhp":117,"maxmp":23,"spleen":"1","muscle":65,"mysticality":23,"moxie":25,"famlevel":11,"locked":false,"limitmode":0,"daysthisrun":"2","equipment":{"hat":"566","pants":"8163","weapon":"8164","offhand":"3915","acc1":"8179","acc2":"199","acc3":"191","fakehands":0,"cardsleeve":0},"stickers":[0,0,0],"soulsauce":0,"fury":0,"pastathrall":0,"pastathralllevel":1,"folder_holder":["00","00","00","00","00"],"eleronkey":"ab9e48d3adbd831116f8e2cd477f85d8","flag_config":{"devskills":0,"shortcharpane":0,"lazyinventory":0,"compactfights":0,"poppvpsearch":0,"questtracker":0,"charpanepvp":"1","australia":0,"fffights":"1","compactchar":0,"noframesize":0,"fullnesscounter":"1","nodevdebug":0,"noquestnudge":0,"nocalendar":0,"alwaystag":0,"clanlogins":0,"quickskills":"1","hprestorers":"1","hidejacko":"1","anchorshelf":"1","showoutfit":"1","wowbar":"1","swapfam":0,"hidefamfilter":0,"invimages":0,"showhandedness":0,"acclinks":0,"invadvancedsort":0,"powersort":0,"autodiscard":0,"unfamequip":0,"invclose":0,"sellstuffugly":0,"oneclickcraft":0,"dontscroll":0,"multisume":0,"threecolinv":0,"profanity":0,"tc_updatetitle":0,"tc_alwayswho":0,"tc_times":0,"tc_combineallpublic":0,"tc_eventsactive":0,"tc_hidebadges":0,"tc_colortabs":0,"tc_modifierkey":0,"tc_tabsonbottom":0,"chatversion":"1","aabosses":0,"compacteffects":0,"slimhpmpdisplay":0,"ignorezonewarnings":"1","whichpenpal":0,"compactmanuel":0,"hideefarrows":0,"questtrackertiny":0,"questtrackerscroll":0,"autoattack":0,"topmenu":0},"recalledskills":0,"freedralph":0,"mcd":0,"pwd":"d9dd5622f6466c633cc29054fa971019","rollover":1425007800,"turnsthisrun":168,"familiar_wellfed":0,"intrinsics":{"a3271a164706776e733cd78e060cb5e1":["Missing Kidney","kidney","a3271a164706776e733cd78e060cb5e1","386"],"29ff63fe512f5b2a2cfebb5e818525ee":["Grand Blessing of the War Snapper","warsnapper","29ff63fe512f5b2a2cfebb5e818525ee","1417"]},"familiarpic":"familiar1","pathname":"","effects":{"c512deaca46c7d7edf9b55b23403273f":["Gummi-Grin",12,"gummiturt","item:7559","1653"],"ab7ab0ba8a213f24649b9d0152c57cc3":["Burning Heart",8,"heart",null,"407"],"1a46f0679200550d66cf30810ab7c47e":["Hella Tough",9,"strboost",null,446]}}
Finished using 1 Medicinal Herb's medicinal herbs.
-----From Browser-----
GET /KoLmafia/messageUpdate?pwd=d9dd5622f6466c633cc29054fa971019 HTTP/1.1
Host: 127.0.0.1:60080
Connection: keep-alive
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.115 Safari/537.36
Accept: */*
Referer: http://127.0.0.1:60080/cli.html
Accept-Encoding: gzip, deflate, sdch
Accept-Language: en-GB,en-US;q=0.8,en;q=0.6
Cookie: frcm_style=3; chatpwd=300; charpwd=200
----------
-----To Browser-----
HTTP/1.1 200 OK
Date: Thu Feb 26 17:44:08 GMT 2015
Server: KoLmafia v16.8
Content-Type: text/plain
Connection: close
 <font color=olive>> use medicinal herbs</font><br><br>Purchasing Medicinal Herb's medicinal herbs (1 @ 100)...<br>You acquire an item: Medicinal Herb's medicinal herbs<br>You spent 100 Meat<br>Purchases complete.<br>Using 1 Medicinal Herb's medicinal herbs...<br>Finished using 1 Medicinal Herb's medicinal herbs.<br><!-- REFRESH -->

Kol's response to mafia's use request is
Code:
This item is not implemented yet.  Try again later.
 
Last edited:
Just thought I'd give this a little bump, since it's been inconvenient to have to manually use herbs throughout my TT BM run, and I'm just about to start a seal clubber one afterwards :)
 

Darzil

Developer
I think I know what's going on. items.txt has one primary type, which is hp for healing items and spleen for spleen items. In this case it is hp. Is this the only spleen item that heals?

Working on it.
 

Darzil

Developer
This is a bit tricky. Am going to have to think about it (and thoughts welcome).

Basically Mafia has a primary usage for each item, and some secondary ones. It also has a Consumption Type, which is checked in many places.

Unfortunately HP Restore, MP Restore and Spleen are all primary usages. I don't particularly want to add exceptions for these six everywhere.

My current gut feel is to make HP Restore and MP Restores into secondary usages, and leave spleen as primary, and recode everything to handle that.
 

Darzil

Developer
Actually, (maybe) better idea.

As they don't affect what URL's etc we use, don't have HP or MP restore as usages, primary or secondary. If we want to know if something is a restore, just use RestoresDatabase.

Seems like a simpler approach.
 
Thanks! This has made my seal clubber BM ascension a lot less painful. :)

There is still a minor issue:
Herbs work from the Item Manager, using the ASH chew() function, and using the CLI command "chew".
However if I attempt to use the ASH use() function or the CLI command "use", it still goes to inv_use.php as in my initial report.
 

Darzil

Developer
Does the wrong thing also happen when you use use() / use instead of drink() / drink and eat() / eat ?

No, there are checks for those, that tell you to use drink and eat. Will add one to tell you to use chew for spleen.
 
Last edited:

Darzil

Developer
Has statuseffects.txt had every spleen item action replaced with chew?
Yes, in r15563, there were only 4.

Also, we got a little better at handling 7 other spleen items from r15545, as there were 7 hp or mp restorers that weren't listed as spleen items in items.txt, but were.
 
Last edited:

Theraze

Active member
Nifty. And at least officially, this script says there's no more 'use' spleen affects. So that's nice. :)
Code:
ashq foreach it in $effects[] if     (it.default.split_string("use 1 ").count() > 1 &&     it.default.split_string("use 1 ")[1].to_item().spleen > 0)     print(it.to_string());
 
Top