New Content - Implemented New Hangk's and Closet Interface

Theraze

Active member
I've seen no evidence that the DC related functionality has changed. To be precise, everything I do with the DC has worked consistently since before the KoL storage revamp.

Who are you asking about an API call? Might I suggest you savor that coffee, browse the wiki and tell us if there is anything you think is missing?
Searching the wiki for API gives no results... am I searching for the wrong thing?
 

Bale

Minion
As far as I know it isn't on the wiki, but it might be nice to put it there that so that all information is all in one place. It isn't exactly a mafia thing, but it would be a useful scripting resource as zarqon recently proved with his kmail parser.

I know that you can get basic information at api.php when you are logged in.
 

fronobulax

Developer
Staff member
Searching the wiki for API gives no results... am I searching for the wrong thing?

Probably a vocabulary problem since API means Application Program Interface to me and hence could apply to Java/Mafia, ASH/Mafia, JavaScript/KoL, PHP/KoL and perhaps more. I read your question as question concerning display case manipulation in an ASH/Mafia context and so referred you to the wiki to see what was already there and what you might think was missing. Perhaps, however, you were referring specifically to api.php in KoL in which case there isn't much on the wiki but your audience is also not the people who maintain api.php - at least I am not aware of any KoL devs who are active here ;-)
 

Theraze

Active member
I know that mafia devs don't update the KoL API system, fronobulax. :) My question was regarding whether or not there currently is a display case retrieval through the KoL API, and should there be (to reduce server hits) if not?

And all the API.php returns is this:
KoL API
You must log-in and pass a PHPSESSID cookie as a normal player. All resposes are JSON objects, unless you specify another format.
You must provide at least two arguments (the bold ones), and some optional arguments:
what
What you are requesting, options include: (you can pass multiple at once, too. status,inventory)
status
Most of what you see on the charpane.
inventory
A list of all item IDs and how many you have
events
Green event messages. Poll this to see if you have kmail, then request with the 'id' in the kmail payload
item
Info about an item the character owns.
kmail
Pass an 'id' to fetch a single kmail, or a count to fetch the latest X

for
A description of your application. Try and put something useful so we can find you if there's an issue. (ex. TabbedChat+by+CDMoyer)
format
What format to return. Supported: json, php. Default: json
count
How many to return, for things that return a list. Defaults to 10, max of 100
id
Which item to return, such as when fetching a single kmail or an item id
since
For events, retrieve all events after this date/time (parseable by strtotime()). If 100 results are returned, you may need to query again, changing since to the date of the last item. (Date/time is parsed as aztime)
It does explicitly give 5 possible 'what' bits... but makes no hints as to other possibilities. Since they're useful for our script writers, if people have more exhaustive lists of what can be passed to it, examples for scripts, etc... that would probably be a good wiki-addition. :)
 
Last edited:

Veracity

Developer
Staff member
You quoted the documentation that api.php gives you. It is up-to-date and complete, regarding the fields you can specify. Just what, precisely, each request returns to you - what is included in "status", for example - is undocumented. It also changes, at the whim of CDM, when a user of api.php (like me) suggests an addition and he takes the time to implement it.
 

Theraze

Active member
Okay. I thought you said he'd added a storage and closet 'what' to those. If the list is complete though, then anyone wanting to make scripts should be able to work off that. :)
 

Winterbay

Active member
I think what she said was that she had asked him to do so so that the entire inventory can be gathered in 3 server hits (to each version of the api), not that this was already implemented.
 

Theraze

Active member
Ah yes, I see that... I think my impression was that it had happened, because of the two messages next to each other... The first said she'd requested that functionality be added to the KoL API; the second said that there was a new patch with fixed functionality. I see though that the second message never actually says that it was added.
 

slyz

Developer
There seems to be a small bug somewhere: item transfers are happening correctly but Mafia seems to loose track of item amounts when you only transfer one item.
Code:
> closet list skeleton key

> inv skeleton key

skeleton key (8)

> closet put 1 skeleton key

Placing items into closet...
Requests complete.

> closet list skeleton key

skeleton key (8)

> inv skeleton key

> refresh all

Refreshing session data...
Loading character status...
Synchronizing moon data...
Retrieving character data...
Refreshing closet...
Examining consumables in closet...
Examining equipment in closet...
Examining miscellaneous items in closet...
Updating inventory...
Retrieving familiar data...
Familiar data retrieved.
Retrieving campground data...
Session data refreshed.

> closet list skeleton key

skeleton key

> inv skeleton key

skeleton key (7)

I'll try to track this down.

EDIT: it looks like TransferItemRequest.transferItems() is called using HOWMANY_PATTERN by default, it should be called using QTY_PATTERN when "qty" is present in the urlString, or maybe HOWMANY_PATTERN could be changed to:
Code:
(?:howmany|qty)\\d*=(\\d+)

EDIT2: changing HOWMANY_PATTERN works, I'll post a new Bug Report with a patch to makes things clear.
 
Last edited:

slyz

Developer
Some types of transfers still need HOWMANY_PATTERN: gift and kmail transfers, apparently, as well as (for now) storage item transfers.

Maybe a more appropriate fix would be to specify QTY_PATTERN in all calls to transferItems() in ClosetRequest then. It seems to be the case since I was ninja'd by your commit while writing this!

Thanks.
 

stannius

Member
I am not sure this is related, but it happened at the same time so I'll add it to this thread. If I'm wrong someone can split it or I don't mind copying to a new thread manually.

Since the closet revamp, using the daily builds, when logging in I see a ton of messages about unknown items. With the previous daily build I was using (9250 maybe?) it only seemed to happen for the items in the closet. Since I ascended yesterday and/or started using 9259, it does it for every item in Hangks. That takes like 15 minutes. Furthermore many of the info requests seem to fail, filling up a huge debug log. I have attached a pared down debug log with only one failure in it.

I thought maybe I had some setting or data file that was causing problems, so I copied KoLmafia-9259.jar to an empty directory and launched it from there. I ended up with the same problem.
 

Attachments

  • DEBUG_20110429.txt
    4.4 KB · Views: 26
Last edited:

Isvarka

Member
I am not sure this is related, but it happened at the same time so I'll add it to this thread. If I'm wrong someone can split it or I don't mind copying to a new thread manually.

Since the closet revamp, using the daily builds, when logging in I see a ton of messages about unknown items. With the previous daily build I was using (9250 maybe?) it only seemed to happen for the items in the closet. Since I ascended yesterday and/or started using 9259, it does it for every item in Hangks. That takes like 15 minutes. Furthermore many of the info requests seem to fail, filling up a huge debug log. I have attached a pared down debug log with only one failure in it.

I thought maybe I had some setting or data file that was causing problems, so I copied KoLmafia-9259.jar to an empty directory and launched it from there. I ended up with the same problem.

I was having the same problem after breaking the prism and trying to pull stuff out of Hagnk's, and then again when I ascended.
 

Veracity

Developer
Staff member
Could I see a debug log that shows what looking at a Storage page looks like for you?

Edit: never mind. You have inventory images off. I can reproduce this and am working on a fix right now.
 
Last edited:

Isvarka

Member
Could I see a debug log that shows what looking at a Storage page looks like for you?

I'm not at home so I don't have the ones from this morning, but just downloading the latest jar and running it clean (and merely logging in, not even having a chance to even get to looking at a storage page) provided a log.

I then moved that debug log out of the directory and went to Hagnk's in the relay browser, selected consumables, and it started again. Each time I clicked on a different tab in Hagnk's it did it, until I had clicked on all of them, at which point I guess it had discovered every item.

Here's the two debug logs. I would also have included the session log, but it ended up being blank.

Hope that helps.


Edit: Additionally, after closing Mafia and reopening it, it started doing the full check over again. Looking over the CLI as it is doing it, it's definitely not limiting itself to checking stuff I actually have on me since its checking a lot more than I have day 1 of softcore. Here's a snippet of the CLI including the end of it.
 

Attachments

  • DEBUG_20110429_login.txt
    141.5 KB · Views: 20
  • DEBUG_20110429_hagnk.txt
    100.3 KB · Views: 16
  • CLI_output_login.txt
    20.6 KB · Views: 135
Last edited:

Veracity

Developer
Staff member
I'm declaring this implemented. I freed the king and my stash seems to be working just fine.
The only thing I have not tested - and will be unable to test - is "pulls remaining" for softcore.
 
I'm declaring this implemented. I freed the king and my stash seems to be working just fine.
The only thing I have not tested - and will be unable to test - is "pulls remaining" for softcore.
Yay, thanks Veracity. I'll be ascending fairly soon and can report any problems with that one remaining thing you can't easily test.
 
Top