Feature - Implemented Add Monsters to the Encyclopedia

Bale

Minion
I don't know how many other people use KoLmafia's internal encyclopedia of stuff, but I do. Unfortunately it is missing a significant category. There is no section for monsters!!! (Shockingly.)

Could someone please add a Monsters tab to that frame? Maybe not as simple as I would hope, but Thanks in Advance!
 

Veracity

Developer
Staff member
We might want to add the "monster number" field to monsters if we are thinking of doing this.
 

Veracity

Developer
Staff member
Well, with monster #, we could have 2 columns - number and name - and you could click on the header to sort by that column, as with the other Encyclopedia categories, but it's not obvious how to make it more useful. KoL has no "desc_monster.php". I suppose we could generate our own from what we store about the monster in monsters.txt: image, attack/def/HP, item drops, and so on. But this becomes a much bigger project than if there was KoL support for this.

I'd like it if KoL itself provided desc_monster.php?whichmonster=X which could, if nothing else, pop up a window with the info that Manuel shows you. Aside from the fact that it is Work, they might not want to do that, since if you HAVE Manuel, you can see the same info in the Quest Log - and the combat data in the Fight page - so, who (aside from third-party programs like KoLmafia) would benefit from this?
 

Bale

Minion
I'd like it if KoL itself provided desc_monster.php?whichmonster=X which could, if nothing else, pop up a window with the info that Manuel shows you. Aside from the fact that it is Work, they might not want to do that, since if you HAVE Manuel, you can see the same info in the Quest Log - and the combat data in the Fight page - so, who (aside from third-party programs like KoLmafia) would benefit from this?

Everyone who has Manuel would like that. There has been clamoring to see factoids for the current monster without having to go to the Manuel ever since Manuel was introduced. It has been proposed in various formats, but Jick just won't make Manuel more fun.
 

Bale

Minion
I believe that all the monsters have numbers in KoLmafia's internal database now.

Can we get them a tab in the Encyclopedia?
 

lostcalpolydude

Developer
Staff member
Which columns would be included? I guess all of the monsters where mafia has 0 would be grouped together at the top, assuming it's even that simple codewise.
 

Veracity

Developer
Staff member
We are learning bunches of new monsters.

In the absence of desc_monster, we could code up our own HTML page with the monster image and everything we know about it. We could even list the factoids from your personal Manuel.

One thing that might help this would be a method that takes a monster ID and looks up the monster in Manuel, returning the HTML table entry corresponding to that monster. We could cache that when we visit a Manuel page, tag it with the number of known factoids, and invalidate the cache for the monster when we learn a new factoid (we detect that, right? can't we use factoids as conditions?) for a monster whose monster id we know. (What to do when you log in with a new character? Flush the cache of all monsters with less than 3 factoids? Do that only is the new character also has a Manuel?)

Given that, we could also have a "factoid" command which would take a monster name or monster ID and would print out the factoids for that monster. Sort of like the "taleofdread" command: only for "fun".

This would probably require more work to make sure that we know what Manuel's name is for monsters that we have other names for; if you want to see "Ancient Protector Spirit", you probably want all of them.

Could be a fun project - for somebody. ;)
 

Theraze

Active member
As I understand mafia's knowledge of factoids currently, it doesn't keep track of individual factoids - merely tracks the text in the fight page when a new factoid is learned. It doesn't know if we have 4 more factoids needed in the zone, or 11 - it simply knows I asked for 4 more total factoids and, if that amount is actually available, will stop after 4 new factoids are learned. Otherwise, it will burn all turns given waiting for it.

Before we could do that anything with the saved factoid data, we'd need to actually save learned factoids to the character file at some point. :)
 

Veracity

Developer
Staff member
I disagree. I am not talking about saving per-character factoid info. I am talking about being able to retrieve factoids from Manuel based on monster ID. If you learn a new factoid - as Manuel tells us - when fighting a particular monster, we say "oops! better re-read factoids for this monster next time somebody asks for them."

I think I will write the "fetch the Manuel entry for monster ID X" function. We'll see what use we end up making of it.
 

Veracity

Developer
Staff member
OK, I did a large amount of work to enable this. Revision 16163 does this:

- For all "problematic" monsters - ones which have an ID of 0 which we previously did not disambiguate - there are now monsters with distinct names and the expected monster ID.

ancient protector spirit( The Hidden Apartment Building)
ancient protector spirit( The Hidden Bowling Alley)
ancient protector spirit( The Hidden Hospital)
ancient protector spirit( The Hidden Office Building)
batwinged gremlin (tool)
clingy pirate (female)
clingy pirate (male)
erudite gremlin (tool)
spider gremlin (tool)
vegetable gremlin (tool)
Ninja Snowman (Hilt)
Ninja Snowman (Mask )
bizarre construct (translated)
hulking construct (translated)
industrious construct (translated)
lonely construct (translated)
menacing construct (translated)
towering construct (translated)
animated nightstand (White 1)
animated nightstand (Mahogany 1)
animated nightstand (White 2)
animated nightstand (Mahogany 2)

Note that those names all have a name which differs from Manuel's name. So do many other monsters, so:

- Monsters whose KoLmafia name does not agree with Manuel's name - because they require disambiguation; otherwise, we change our names to agree - now have a Manuel: "NAME" annotation in monsters.txt.
- There is a corresponding $monster proxy field in ASH: string .manuel_name will be the name you look up the monster in Manuel with. That will be either the monster's name, or the name specified as above.

We want to observe and cache info when you look at Manuel pages

- MonsterManuelRequest is an internal class to look up a specific page, or look up the page that a particular monster ID will be on, based on the manuel_name, as specified above. When you use this request class internally - or look at Manuel in the Relay Browser - be parse the response and pass each Manuel entry to:
- MonsterManuelManager keeps a cache of what we have observed in Manuel. It keeps two maps:
ID -> STRING - maps monster ID to the cached Manuel entry HTML text
IS - INT - is the number of factoids in the currently cached text for this monster ID

So, how do we manage this?

- When you log out and log in as a new user, we flush those maps for all IDs which have fewer than 3 factoids saved; if you have 3 factoids, there will be no difference, no matter the character. If you have less than 3, the new character might have better factoids.
- When you learn a factoid in battle, we flush the entries for the current monster; you will have to revisit Manuel to get it again, with the new factoid.

There are two ASH functions to access the above caches

int monster_factoids_available ( monster )

how many factoids are in the currently cached HTML text for the monster

string monster_manuel_text( monster )

the saved HTML for the monster

Both of the above will query the cache, first. If present, it returns the value, with no server hits. If not present, it attempts to look up the Manuel data for the monster - which will load that (and all he other monsters on the same page ) into the cache.

That last function could be helpful for scripts like missingManuel: you can choose to get the text every monster whose id is non-zero, rather than looking up every page of manuel and parsing out the monsters and doing all sorts of heuristics to disambiguate the monster into KoLmafia's name for the monster.

I don't know; it might still want to lookup every page, first, because Manuel might have new monsters in it - and when we look at the page, MonsterManuelManager will add dummy monsters to the internal ID -> MonsterData map for each monster it sees with an unrecognized ID. I'm not sure how an ASH program would find out which monsters those were, although we will log them to the gCLI - which will be a signal to KoLmafia devs to update monsters.txt

- I added checkManuel, which will look at every Manuel page and let MonsterManuelManager cache all the data - including registering unknown monsters, as above. Here is what I get when I run it:

> checkmanuel

Checking Monster Manuel...
Page A
Page B
Page C
Page D
Page E
Page F
Page G
Page H
Page I
Page J
Page K
Page L
Page M
Monster #1667 has name 'Your winged yeti' but Manuel calls it 'Mraderick'
Page N
Page O
Page P
Page Q
Page R
Page S
Page T
Page U
Page V
Monster #1669 has name 'You the Adventurer' but Manuel calls it 'Veracity the Adventurer'
Page W
Page X
Page Y
Page Z
Page -
Monster Manuel checked.
That was how I figured out which monsters needed Manuel: attributes in monsters.txt.

That reminds me - we need to flush Manuel data for those two monster IDs when you log in as a new player.

Just for fun, type this into the gCLI:

ash monster_manuel_text( $monster[ writing desk ] )

(or the monster of your choice).

I think you can see how we could use something like that in our own popup from the Encyclopedia, were we to add Monsters.
 

Veracity

Developer
Staff member
it might still want to lookup every page, first, because Manuel might have new monsters in it - and when we look at the page, MonsterManuelManager will add dummy monsters to the internal ID -> MonsterData map for each monster it sees with an unrecognized ID. I'm not sure how an ASH program would find out which monsters those were, although we will log them to the gCLI - which will be a signal to KoLmafia devs to update monsters.txt
Revision 16166 adds the function you need for this:

boolean [monster] all_monsters_with_id()

... will build a map in monster-id order of all currently known monsters with non-zero monster id. This includes new monsters that we discovered by looking at Manuel, not just those that we had in monsters.txt when you started your script.

That's why you need this, rather than just using $monsters[] and filtering out those who have ID = 0, since that will be constructed at compile time, and we never update the monster ID of existing monsters when looking at Manuel.
 

Bale

Minion
So, it's been a bit over a year since the last post in this thread. I still would like an encyclopedia tab for monsters. The feature has never actually been refused and we've got every possible monster ID. Monsters for which we don't have a number can just show 0.

Thoughts?
 

heeheehee

Developer
Staff member
So, MonsterDatabase.MONSTER_IDS isn't quite in the form we want (Integer -> MonsterData instead of Integer -> String), and it also doesn't contain monsters with unknown IDs. I think I can circumvent the former by changing TableCellFactory to invoke toString() instead of casting to String, but I'm not sure if that would have unexpected consequences that might break other things.

The other part that might take a bit more time is generating our own desc_monster.php that simply outputs the Manuel data we already store.
 

Veracity

Developer
Staff member
I don't think there's an easy solution for monsters with no IDs. Perhaps somebody with a good relationship with the KoL devs could ask nicely for the monster IDs. Here are the ones we don't know:

Code:
ancient protector spirit	0	protspirit.gif

Baiowulf	0	baiowulf.gif
Count Bakula	0	bakula.gif
Crazy Bastard	0	bastard.gif
Hypnotist of Hey Deze	0	hypnotist.gif
infinite meat bug	0	meatbug.gif
Knott Slanding	0	slanding.gif
pooltergeist (ultra-rare)	0	poolter2.gif
QuickBASIC Elemental	0	qbasicele.gif
The Master of Thieves	0	masterat.gif
The Nuge	0	thenuge.gif
The Temporal Bandit	0	timebandit.gif

Ed the Undying (1)	0	ed.gif
Ed the Undying (2)	0	ed2.gif
Ed the Undying (3)	0	ed3.gif
Ed the Undying (4)	0	ed4.gif
Ed the Undying (5)	0	ed5.gif
Ed the Undying (6)	0	ed6.gif
Ed the Undying (7)	0	ed7.gif

Ninja Snowman (Hilt/Mask)	0	snowman.gif
the darkness (blind)	0	darkness.gif

slime1	0	slime1_1.gif
slime2	0	slime2_1.gif
slime3	0	slime3_1.gif
slime4	0	slime4_1.gif
slime5	0	slime5_1.gif

Count Drunkula (Hard Mode)	0	drunkula_hm.gif
Falls-From-Sky (Hard Mode)	0	fallsfromsky_hm.gif
Great Wolf of the Air (Hard Mode)	0	wolfoftheair_hm.gif
Mayor Ghost (Hard Mode)	0	mayorghost_hm.gif
The Unkillable Skeleton (Hard Mode)	0	ukskeleton_hm.gif
Zombie Homeowners' Association (Hard Mode)	0	zombiehoa_hm.gif

Underworld Tree	0	shiv_underworld.gif

The Hermit	0	hermit.gif
X-32-F Combat Training Snowman	0	xxx.gif
Caveman Dan	0	cavedan.gif

Mob Penguin Smasher	0	pengsmasher.gif
Mob Penguin Smith	0	hazmatpeng.gif
Mob Penguin Supervisor	0	pengphone.gif
<s>Killer</s> Festive Arc-Welding Elfbot	0	borgelf1.gif
<s>Killer</s> Festive Decal-Applying Elfbot	0	borgelf4.gif
<s>Killer</s> Festive Laser-Calibrating Elfbot	0	borgelf2.gif
<s>Killer</s> Festive Weapons-Assembly Elfbot	0	borgelf3.gif

Edwing Abbidriel	0	edwing.gif
Don Crimbo	0	doncrimbo.gif
Disorganized Files	0	c10files.gif
Endless Conference Call	0	c10confcall.gif
Hideous Slide Show	0	c10slideshow.gif
Tedious Spreadsheet	0	c10spreadsheet.gif
Unoptimized Database	0	c10database.gif
The Book Of Faces	0	c10faces.gif
The Tome Of Tropes	0	c10tropes.gif
Totally Malicious 'Zine	0	c10tmz.gif
The Water Cooler	0	c10cooler.gif
The Best Game Ever	0	c10bge.gif
Uncle Hobo	0	unclehobo.gif

Hammered Yam Golem	0	drunkyam.gif
Inebriated Tofurkey	0	drunktofurkey.gif
Plastered Can of Cranberry Sauce	0
Soused Stuffing Golem	0	drunkstuffing.gif

CDMoyer's Butt	0	butt.gif
Hotstuff's Butt	0	butt.gif
Jick's Butt	0	butt.gif
Mr. Skullhead's Butt	0	butt.gif
Multi Czar's Butt	0	butt.gif
Riff's Butt	0	butt.gif

Trollipop	0	trollipop.gif
The Colollilossus	0	colollilossus.gif
The Fudge Wizard	0	fudgewizard.gif
The Abominable Fudgeman	0	fudgeman.gif

The Sagittarian	0	sagittarian.gif
Frank "Skipper" Dan, the Accordion Lord	0	accboss.gif
spirit alarm clock	0	spiritalclock.gif

giant pumpkin-head	0	headpumpkin.gif
large-headed werewolf	0	headwolf.gif
oddly-proportioned ghost	0	headghost.gif

7-Foot Dwarf	0	miner.gif

Crimbomega	0	crimbomega.gif
 

Bale

Minion
Dang. I had really hoped it was possible to just add them with an ID of 0 and the understanding of what that means. If you cannot do that then I don't think this can move forward. There are always going to be monsters without factoids and without factoids we won't be able to get their IDs.

If it requires an act of dev, then we either need to be sure that they will continue to provide reliable support, or else it would be a bad idea to add a feature that is so easily broken.
 

lostcalpolydude

Developer
Staff member
Half the monsters on that list aren't actual KoL monsters (Ed and slime tube are the easy examples). Excluding monsters with id == 0 seems like a workable, if not necessarily satisfactory, solution.
 

Bale

Minion
I could be 95% happy with that solution. It would mean that any "no factoid" monsters won't be listed, but I can almost always be okay with that.

What we really need is for CDMoyer to add monster ID to fights... (like he did item IDs to item descriptions)
 

Veracity

Developer
Staff member
Putting monster ID in the HTML of a fight would certainly make gremlins easier to deal with - which I suspect would make it a non-starter with CDM; having item and effect IDs in the descriptions doesn't give KoLmafia users a benefit over native interface users, but doing that to fights would.

Making a frame in the Encyclopedia with a list of monsters with two columns - ID and name - is easy. Generating a useful HTML frame from the monster data when you double click on a monster is harder. A KoLmafia "desc_monster" HTML might look like this:

- Manuel-like basic data on top: image, phylum, element, initiative, attack, defense, HP. We could use the same images Manuel uses.

- (Perhaps other "stuff" in the middle. Meat and Item drops?)

- Known factoids at bottom - only the ones you have collected, scraped from your quest log; we are not going to build-them in. MonsterManuelManager caches Manuel entries.
 

Veracity

Developer
Staff member
Half the monsters on that list aren't actual KoL monsters (Ed and slime tube are the easy examples).
It would still be nice to get the monster IDs for those that are real monsters. None of them have Manuel pages - but we still have monster stats for them, and we could make a nice-looking pseudo-Manuel monster description for them.
 

heeheehee

Developer
Staff member
Putting monster ID in the HTML of a fight would certainly make gremlins easier to deal with - which I suspect would make it a non-starter with CDM; having item and effect IDs in the descriptions doesn't give KoLmafia users a benefit over native interface users, but doing that to fights would.

What if it were an end-of-fight link to manuel sort of thing?

Also, I seem to have lost the patch I had for this. :(
 
Top