Results 1 to 6 of 6

Thread: put_shop() gives bad response in CLI when price protection activates

  1. #1
    Minion Bale's Avatar
    Join Date
    Jun 2008
    Posts
    13,287

    Default put_shop() gives bad response in CLI when price protection activates

    The response from KoLmafia says it works, but nothing actually goes to the store.

    Code:
    > inv journal of mime
    
    The Journal of Mime Science Vol. 4 (4)
    
    > ash put_shop(3000, 0, 4, $item[The Journal of Mime Science Vol. 4]);
    
    Adding The Journal of Mime Science Vol. 4 to store...
    4 The Journal of Mime Science Vol. 4 added to your store.
    Returned: true
    
    > inv journal of mime
    
    The Journal of Mime Science Vol. 4 (4)
    Checked my store in the relay browser and it is not there. Check inventory in browser and there it is!
    If people like my scripts, please send me stuffed Hodgmen.
    Universal Recovery, OCD Inventory Control, CounterChecker, newLife, ChIT.


  2. #2
    Developer Veracity's Avatar
    Join Date
    Mar 2006
    Location
    The Unseelie Court
    Posts
    11,515

    Default

    DEBUG log?
    Ph'nglui mglw'nafh Cthulhu
    R'lyeh wgah-nagl fhtagn.

  3. #3
    Developer Veracity's Avatar
    Join Date
    Mar 2006
    Location
    The Unseelie Court
    Posts
    11,515

    Default

    I had no problem doing it through the item manager, which does a AutoMallRequest

    managestore.php?action=additem&ajax=1&item1=9641&q ty1=2&price1=&limit1=
    <b>The Journal of Mime Science Vol. 4</b> (2) put up for sale for 999,999,999 Meat

    For some reason, it looks like put_shop() does a ManageStoreRequest

    backoffice.php?action=additem&ajax=1&itemid=9641&p rice=&quantity=2&limit=

    The reason it uses that request is that it can specify that the item comes from storage.

    Looking at put_shop, it looks like you are specifying a price of 3000 Meat. That is way low.
    Doesn't KoL protect you from yourself if you try to do that?

    In which case, the bug is not recognizing KoL's error message.

    A DEBUG log would help - since I don't want to accidentally offer my books for 3,000 and have it actually work.
    Ph'nglui mglw'nafh Cthulhu
    R'lyeh wgah-nagl fhtagn.

  4. #4
    Minion Bale's Avatar
    Join Date
    Jun 2008
    Posts
    13,287

    Default

    A DEBUG log would help - since I don't want to accidentally offer my books for 3,000 and have it actually work.
    Originally Posted by Veracity View Post
    3 thousand? Oh, heck! I meant 3 million. I tried it again with the proper price and it worked perfectly.

    Apparently mafia's protection against extremely low prices stopped me. Yay! Important things worked perfectly!

    The bug is actually bad feedback from price protection. I'm changing the thread title to correctly describe the bug. Mafia shouldn't have told me that it put the items in the store. In case you'd like to fix that relatively minor bug, here's a debug log:

    Code:
    > inv journal of mime
    
    The Journal of Mime Science Vol. 5 (4)
    
    > ash put_shop(3000, 0, 4, $item[The Journal of Mime Science Vol. 5]);
    
    Adding The Journal of Mime Science Vol. 5 to store...
    class net.sourceforge.kolmafia.request.ManageStoreRequest
    Connecting to backoffice.php...
    
    Requesting: https://www.kingdomofloathing.com/backoffice.php?action=additem&ajax=1&itemid=9643&price=3000&quantity=4&limit=0
    4 request properties
    Field: Cookie = [PHPSESSID=kn7eii7n9nvu6pr6b8qm7igvr1; AWSALB=rB9q1pd5OgX1qRdN0kcHoY7hR3UPCn76QFquIiw7EViwoS+IvV2XKQXsoH9kAuUTzbBoCHPtjQzuWa98AjFQ8P3jgIxCNuMQgxWI3XaD0GptZkMMGtCm8i0JcaZS]
    Field: User-Agent = [KoLmafia v17.12]
    Field: Accept-Encoding = [gzip]
    Field: Content-Type = [application/x-www-form-urlencoded]
    
    Retrieving server reply...
    
    Retrieved: https://www.kingdomofloathing.com/backoffice.php?action=additem&ajax=1&itemid=9643&price=3000&quantity=4&limit=0
    13 header fields
    Field: Transfer-Encoding = [chunked]
    Field: null = [HTTP/1.1 200 OK]
    Field: Server = [nginx/1.8.1]
    Field: Connection = [keep-alive]
    Field: Pragma = [no-cache]
    Field: Date = [Sat, 30 Dec 2017 23:32:53 GMT]
    Field: Cache-Control = [no-store, no-cache, must-revalidate, post-check=0, pre-check=0]
    Field: Content-Encoding = [gzip]
    Field: Vary = [Accept-Encoding]
    Field: Set-Cookie = [AWSALB=F8YMqmw7AIGd1fN3y+tUXqQd0P1aTuLs59Izxw3vTeao++mbkDr9/ER2MNkhljiNqF+oBiDmzCi334OUXqIfED4rfNvGvI3sH4c3syNHpAFdZ+LHTnqGUUrEf/pf; Expires=Sat, 06 Jan 2018 23:32:53 GMT; Path=/]
    Field: Expires = [Thu, 19 Nov 1981 08:52:00 GMT]
    Field: X-Powered-By = [PHP/5.3.29]
    Field: Content-Type = [text/html; charset=UTF-8]
    
    Retrieving server reply
    ResponseText has 1000 characters.
    <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>Are you sure you want to sell this item for that little Meat? (The cheapest in the mall is currently 1,200,000 meat.)<center><br /><input class="button" type="button" onclick="$('#priceok').val(1);$('#stock').submit();" value="Yes, I'm sure" /><input class="button" type="button" onclick="$('#stock')[0].reset();$('#effdiv').empty()" value="No! Thank you for saving me from myself!" /><br /><input type="checkbox" onclick="$('#neveragain').val($(this).attr('checked')?1:0)" /> never ask me this again.</center></td></tr></table></center></td></tr><tr><td height=4></td></tr></table></center>
    4 The Journal of Mime Science Vol. 5 added to your store.
    Returned: true
    
    > inv journal of mime
    
    The Journal of Mime Science Vol. 5 (4)
    
    > debug off
    If people like my scripts, please send me stuffed Hodgmen.
    Universal Recovery, OCD Inventory Control, CounterChecker, newLife, ChIT.


  5. #5

    Default

    Apparently mafia's protection against extremely low prices stopped me.
    Originally Posted by Bale View Post
    No, mafia's protection only applies to using the GUI. KoL's protection stopped you, and insisted on a confirmation that was never provided.

  6. #6
    Developer
    Join Date
    Apr 2010
    Posts
    4,932

    Default

    r18419 recognises KOL's protection and logs it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •