Bug - Fixed Mafia hates White Citadel

GValko

Member
Code:
> restore mp

Autorecovery     failed.

> restore mp

Autorecovery     failed.

> buy cloaca

cherry     cloaca cola
cloaca-cola
diet cloaca cola
new cloaca-cola
regular     cloaca cola

[cloaca] has too many matches.

>     buy cherry cloaca

You are not yet out of     ronin, and are unable to buy this item from a NPC store.

>     buy cherry cloaca

You are not yet out of     ronin, and are unable to buy this item from a NPC store.

>     buy cherry cloaca

You are not yet out of     ronin, and are unable to buy this item from a NPC store.
You     acquire an item: Cherry Cloaca Cola
You spent 80 Meat

>     buy cherry cloaca

You are not yet out of     ronin, and are unable to buy this item from a NPC store.

This is really annoying since this is the best MP restorer in BHY, and it kept wasting meat to buy soda water before I told it to knock it off.

release 9536 for the record
 
Last edited:

Bale

Minion
I just went and cleared the White Citadel quest to test this. It seems that a problem does indeed exist. Witness:

Code:
[COLOR="olive"]> ash white_citadel_available( )[/COLOR]

Returned: false
[COLOR="green"]You acquire an item: White Citadel Satisfaction Satchel[/COLOR]

[COLOR="olive"]> ash white_citadel_available( )[/COLOR]

Returned: false
[COLOR="green"]You acquire an item: lucky rabbit's foot[/COLOR]

[COLOR="olive"]> ash white_citadel_available( )[/COLOR]

Returned: false

I alternately checked for the quest, and did things in the relay browser to confirm the situation. The results of actions in the relay browser are highlighted in green to distinguish them.

KoLmafia doesn't seem to be recognizing that the quest was completed. That would account for this bug.


This is really annoying since this is the best MP restorer in BHY, and it kept wasting meat to buy soda water before I told it to knock it off.

Soda water? EW! Did you disable Doc Galaktik's Fizzy Invigorating Tonic? That is always better than soda water, even if you haven't completed Doc's quest. Really! Never, ever use soda water for mp, it's just AWFUL!
 
Last edited:

Veracity

Developer
Staff member
Does it work if you log out and log in again?

I see code at login to go look at all the pages of your Quest Log and record whether the White Citadel quest is finished.
I do NOT see code to actually detect it happening in-run and recording it as completed.
 

Bale

Minion
That appears to be the issue.

I just did a "refresh session" and it now recognizes that I completed the quest. This appears to be working as intended. I would have found that out a while ago, but I just spent some time digging into the code to find out how mafia detects the quest for myself. :D That slowed me down a lot, but it was worthwhile.

Would it be a worthwhile to add recognition of the quest completion in run?
 
Last edited:

Veracity

Developer
Staff member
Yes, it would.

I was just looking at QuestLogRequest to decide if I wanted to add the Tr4pzor quest completion there - and I disliked it enough that I just made it a preference, like the Guild Store.

I think that the "correct" way is to detect quest completion (for things that appear there - which would have included the Tr4pz0r) on log in from the Quest Log, when we read all the pages, and update them when you do them in-run.
 

GValko

Member
The problem with the quest log method is that you can end up in a state like I was in.

I actually completed the quest the previous day, but Mafia decided that it was time to go and restore my MP with soda water and proceeded to drain my meat below the 300 meat threshold.

This means I had access to the store and could buy things, but the quest itself wasn't complete until I came back with 300 meat and returned the satchel.

Of course, I never came back, because I didn't realize at the time that Mafia hadn't flagged that it was available...and thought it would be handled in the worst case by auto-restore.
 

Bale

Minion
Double-ick. It's actually questionable if you'd want to get the rabbit's foot for 300 meat in Beecore. Better to save the meat and just be glad you can restore mp.

That means the quest may never get completed so mafia would never know it has citadel access.

It's unfortunate that visiting the citadel will automatically steal your meat if you have it, but that could be avoided by simply letting mafia purchase items directly without going into the store. Right?
 
Last edited:

GValko

Member
I honestly don't know how the scripts on the backend are set up for when to take the 300 meat or not.

Honestly, I just write it off as a loss for the quest, because getting it for Muscle classes and DBs is pretty much essential. It's the difference between 17 meat/MP (soda water) or 10 meat/MP (Citadel sodas).
 

Bale

Minion
Stop using soda water! It's actually 17.5 meat/MP. Fizzy Invigorating Tonic is 17. That extra half meat per MP will add up to a good bit in a Beecore run!
 

GValko

Member
I, uh, don't usually. Usually it's a starfish type for MP, but every once in a while that little spring runs dry if I get a few non-combats to pile up in a row. And then Mafia goes and does it's thing. (Though I guess I have frizzy tonic unchecked. I'll see if it helps next run)
 

Veracity

Developer
Staff member
The problem with the quest log method is that you can end up in a state like I was in.
There are two methods:

- Keep a preference "lastXXXDone" set to the ascension # when you last did XXX. Read it whenever you want to see if XXX is done and set it when you do XXX
- For things that are "Quests", don't bother with a Preference - a database lookup backed with a disk file - but read the Quest Log at startup and set a local variable, and set that same variable when you finish the Quest in run.

They are equivalent. The first one requires a proliferation of Preferences. The second one works only for things that appear in the Quest Log. In order to operate correctly, both require that you notice the Quest completion in-run and either set the local variable or the Preference. The bug - or "problem" - you mention is when you do NOT include the "detect XXX in run" part of the process.

Frankly, I'd just as soon skip the (3!) page loads of the Quest Log at login and make everything a Preference; we have to read the Preference file anyway. But, a fair number of the things we read from the Quest Log we do NOT bother "noticing" in-run and keeping up-to-date. So, it's basically a lazy way to avoid keeping Preferences correct and creating bugs - like this bug report.

That would be a good Project for a new Developer: Find everything we read from the Quest Log and make them all into Preferences, complete with detecting in-run when such-and-such an event happens and you complete a Quest. And, for things that ARE in the Quest Log but are also Preferences, if we detect Quest completion on the Quest Log, set the Preference...

I would turn all the local variable Quest variables into Preferences. I would make parsing the Quest Log - if you happen to visit it in-run - set those Preferences (and this is how we would detect and correct for finishing quests outside of KoLmafia - or before we started detecting the completion as it happens). I would stop reading the Quest Log at login.

I really don't have time to do this - but this would make logging in faster at the expense of an unnoticable Preference lookup instead of a local variable access to check for quest completion.
 

Winterbay

Active member
If someone gives a list of which quests are tracked solely via the questlog I could make sure to save any text for turning them in and completing them when I go through them next time in order to help out with this project.
 

roippi

Developer
I would turn all the local variable Quest variables into Preferences.

This would be a nice boon to scripters, as well. I'm sure bumcheekcity would appreciate having easy access to each questCompleted pref.

I can't say that my schedule permits me to take this project on right now, but maybe in a month or two if nobody has picked it up.
 

Veracity

Developer
Staff member
Revision 10427 marks the White Citadel as being available when you turn in the satchel to Paco. Hmm. I didn't check the quest log, but it's possible that I should mark it available when you visit the citadel and get the satchel for the first time - or even when you get the noncombat that lets you go there.

What happens if you visit it with less than 300 Meat in inventory and cannot afford the satchel? Does it let you buy colas and burgers and such?
 

Bale

Minion
What happens if you visit it with less than 300 Meat in inventory and cannot afford the satchel? Does it let you buy colas and burgers and such?

You can purchase sodas and stuff even if you cannot afford (or otherwise don't acquire) the satchel. At that point the quest is NOT complete, but you can still make use of the Citadel as you please.

The Citadel should be marked as available as soon as you hit the relevant non-combat.
 

Veracity

Developer
Staff member
That is unfortunate, because if you log out and log in again, we will look at the Quest Log to decide if the Citadel is available. If you leave the Quest incomplete, we will conclude that the Citadel is unavailable even though you CAN go there. That means that this requires Yet Another per-ascension property to track this correctly. For reference: the non-combat is named "Summer Holiday". We already have code to deal with it by removing the hang glider from inventory in KoLmafia.handleSpecialEncounter().

I'll mark this unfixed (even though it IS fixed, assuming you actually complete the quest; KoLmafia will buy things from the Citadel as needed, once you do that) and leave it as an exercise for ... somebody else who is interested. :)
 

Bale

Minion
Actually, the quest log will inform us of White Castle being available. It is available if the log says one of these:

  • You have discovered the legendary White Citadel. You should probably go in there and get the carryout order you were trying to get in the first place. Funny how things spiral out of control, isn't it?
  • You've got the Satisfaction Satchel. Take it to your contact in your Guild for a reward.


However, parsing that that is clearly a feature of roippi's quest tracking project.
 

roippi

Developer
My ears are burning.

What's funny is that I literally started work on the quest tracking project earlier today. I think I may end up overdoing it a bit with fancy text parsing, but oh well. Brute force String.indexOf() checks are so plebeian.
 
Top