This site makes extensive use of JavaScript.
Please enable JavaScript in your browser.
Classic Theme
Thottbot Theme
Determining if player is within quest poi?
Post Reply
Return to board index
Post by
Wanderingfox
Anyone happen to have any ideas on if this is possible? Looking to determine if the player is within range of a given quest ID's POI range (ie the blue area). It wouldn't surprise me if this isn't exposed, but I figured I'd at least ask and see if anyone has any bright ideas.
Post by
Myrroddin
Get the POI's coordinates, and the player's coordinates, then compare. I think you might be correct that what you want is not directly exposed, but it doesn't need to be.
If a quest POI covers an area rather than one spot, use a table of XY coords and pass in the player's; otherwise do a direct X==X, Y==Y.
local xCoords = { 4, 7, 10 }
local yCoords = { 21.3, 47.2, 62.2, 88.8 }
local xPos * 10, yPos * 10 = GetPlayerMapPosition("player") -- need to convert by multiplication
if xCoords and yCoords then
-- in the quest POI
end
Post by
Wanderingfox
Oh, I know how to do it without having an API exposed... I was just curious as to whether it was there somewhere and I missed it when I was scanning over the UI code.
The issue with your solution is that the quest POI areas are non-uniform shapes. I'll likely end up building a system that allows me to specify regular shapes for the areas and just OR those together to cover the quest POI area. In other words, define a list of shapes (circle, rectangle, etc) and then check if the player's coordinate falls within the area of any of those shapes. The only issue there is that I'd need to manually define those areas, hence the question to see if such an API was already exposed.
I'll have to do some testing on existing API commands as it looks like one may give me distance to the POI, which may allow me to finagle what I want.
Post by
Neffi
I'm not familiar with the API, but I assume it returns a set of coordinate points that defines the irregular polygon area for the quest. It's definitely not as easy as checking whether a point lies within a rectangle or circle, but Google did return a couple links that should prove useful.
http://en.wikipedia.org/wiki/Point_in_polygon
http://www.ics.uci.edu/~eppstein/161/960307.html#intest
I would also keep
Rosetta Code
bookmarked. It indexes a moderately large list of common programming problems, along with their solutions in a plethora of different languages (often including Lua). You can usually find great solutions for algorithms there. You may even find a few solutions for this particular problem.
Post by
Wanderingfox
Thanks Neffi.
What I meant was that should the API not function the way I think it does (wowprogramming isn't being forthcoming in that regard, so testing is in order) then I was just going to approximate the area the POI covers with easy to check geometric shapes (circles, rectangles, etc).
That said, the links you've provided should be quite helpful regardless.
Post by
Neffi
I don't think the API necessarily needs to tell you if you
are
within the POI. It tells you where you are, and where the quest regions are. The rest is just a geometry problem.
Post by
Wanderingfox
Right. I just don't recall it giving me the list of vertices. As far as I'm aware, I only have API access to the center point (where the POI Icon is).
Post by
oscarucb
This is not just a simple computer science problem, because the necessary information is missing.
To my knowledge there is no handily packaged API function to expose the size and shape of a Quest POI region at all. This information is undoubtedly buried in a database file in the MPQs, but I've been unable to extract it (either in game or offline).
Does anyone know how to extract this information?
Post by
Wanderingfox
My plan is to just manually recreate it as needed. I'm the new maintainer for IHML and looking into a more robust method of defining the macro swap boundaries. It's easy enough to have the player define a list of vertices, do the simple computation to discern the height of the bounding box of the polygon, and then on player update just ray cast through the polygon from px,py to px,py+bound_height+1.
It would certainly have been nice if the vertex list was exposed via API, but from what I can tell it isn't, so manual recreation is about as good as it gets.
Post by
Neffi
My mistake. I spent a while tracing through FrameXML before I realized the layered region defining the area was being magically drawn from C. I hate these scenarios. The work is obviously done on C side, why not make our lives easier and do it from Lua instead?
Semlar's been doing work with the MPQs. I'll ask him later on if he's come across anything that looks like POI info. If so, I'll drop you a tip.
Post by
oscarucb
Incidentally, my interest is in the Archaeology POIs, which are similarly handled on the C side, but probably using a similar database in the MPQs.
Post by
Wanderingfox
My mistake. I spent a while tracing through FrameXML before I realized the layered region defining the area was being magically drawn from C. I hate these scenarios. The work is obviously done on C side, why not make our lives easier and do it from Lua instead?
Semlar's been doing work with the MPQs. I'll ask him later on if he's come across anything that looks like POI info. If so, I'll drop you a tip.
That would be excellent. Thanks!
Post by
Neffi
Well, you're out of luck WF:
<Neffi> Anyone know where quest POI blobs are located in the DBCs? Any tips to parsing them out?
<Adys> Neffi: they're not in the dbcs
<Neffi> Adys: Where are they?
<Adys> Neffi: they're transferred on the wire
<Neffi> you &*!@ting me?
<Adys> Nope
<Adys> blizzard is pretty anal about this, they didnt want dbs to have this info
<Neffi> So there's no way whatsoever for an addon to be aware of whether or not the player is standing within the blob?
<nevcairiel> thats right
<Adys> No way
Post by
Wanderingfox
Well damn... Guess its onward with user-defined areas then.
Thanks for looking into it anyway Neffi.
Post by
Nulgar
If it's always loaded from the server, that could explain why I sometimes can't see the zones, even after seeing them a while before, guess some update failed in that case.
Post by
Neffi
Indeed. The blob thing is quite glitchy. It really explains a lot of issues I've had.
Wanderingfox: Another bet might be constructing your own quest blob database off Wowhead. For everything but newer quests, it should prove to be more accurate than the default blobs (which are sometimes spotty, and never exhaustive).
Post by
Wanderingfox
Does wowhead have that info exposed? All I can find is a bunch of specific points based on item use/kill.
For example,
Given a Second Chance
just lists where all the wounded shado-pan are instead of giving me any information about the actual area in general. As far as I am aware, the quest information isn't available in xml either (or at least it wasn't back around patch 2.4ish when i last asked) so I'm unsure as to how to go about querying that information to begin with.
I suppose I could get all the points, approximate a polygon from them and then use the vertices of that for ihml... but that seems like a whole hell of a lot of work compared to having the user just click a half dozen times on the map :3
Post Reply
You are not logged in. Please
log in
to post a reply or
register
if you don't already have an account.