Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Function to Get Mob Respawn Timers From the Wiki #167

Open
machineghost opened this issue Jun 23, 2022 · 5 comments
Open

Function to Get Mob Respawn Timers From the Wiki #167

machineghost opened this issue Jun 23, 2022 · 5 comments
Labels

Comments

@machineghost
Copy link

machineghost commented Jun 23, 2022

I need to dust off my Python skills and create a function (in util/action.py) that ...

  1. Converts a mob's name into URL format (ie. underscored instead of spaced and punctuation-escaped)
  2. Make a request to the appropriate wiki page for that mob
  3. (If no such page is found, handle it gracefully)
  4. (If found) parse the HTML of the page (side note: find Python's equivalent of NPM's Cheerio library)
  5. Extract the mob's respawn time (if it's in the wiki)
  6. Return that time, or null if none was found.
@mgeitz
Copy link
Owner

mgeitz commented Jun 23, 2022

Individual mob timer data would be really helpful, the automatic timers based on zone defaults is way too general.

Would it be possible to write a script in util/ that pulls mob names and respawn timers from the wiki and produces a json file to staticly include with the parser?

The produced json file could be added to eqa/lib/config.py to be generated with the configs on startup.

This part of action.py could be updated to trigger on a mob slain line type, check if the mob that died exists in the mob timer file, and if not fall back to the default zone timer.

@mgeitz mgeitz added the request label Jun 23, 2022
@mgeitz
Copy link
Owner

mgeitz commented Jun 23, 2022

Realizing now, a pre-requisite to that would be knowing every mob name in the game, which is a lot. I was mostly concerned for the time it would take action.py to get a response to move on to the next item in the queue. It's probably a lot simpler to dedicate a thread to wiki requests so all action.py need to do is push the mob slain line type and line to a queue for a wiki request thread to process and then set any timers.

@machineghost
Copy link
Author

Yeah, there's pros/cons to either approach.

"Cached Approach"

  • instant access to data
  • requires spidering the entire wiki
  • won't get updates people add to the wiki

"On the Fly"

  • not instant
  • no spidering required
  • will get updates

Your call which is better, but for now I'll just make the function work, and if we want to spider the wiki we can add code to do that (which will call the function I write, so it will be useful either way).

@machineghost
Copy link
Author

So ... I realized a flaw in my wiki plan 😦 It turns out that the zone pages have the respawn timers in a fixed place, but the mobs (if their timer is different) just has that timer in the description.

I could try to parse that timer out of a string like "Placeholder is a sandbar serpent, paths a small U shape in the north east corner of zone on the shore. PH or Jetsam are on a 2 minute respawn timer at the referenced location." ... but I'm worried that will pick up some garbage also, so maybe it's better to just go with the zone timers, and then maybe hand-code the exceptions?

But ... since I already wrote enough code to go fetch any page from the wiki and parse it ... is there any other info that you'd like to be able to get out of the wiki?

@mgeitz
Copy link
Owner

mgeitz commented Jun 26, 2022

I think a generalized wiki request thread could be really useful, I'll add the stubs for one in PR #168.

For specific mob timers, there may need to be a json file sorted by {zone: {mob, time}}.

A function that checks a local file for a mob timer, thread request to check the wiki (and adds to the file if its missing), defaults to the zone time.

Leaving this issue up in the general interest of persuing more accurate automatic mob timers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants