Quote:
Quote:
|
so... thanks for the help on this. The string constant is ERR_CHAT_PLAYER_NOT_FOUND_S and my filter is designed so I don't have to remove it as it will only filter exact matches to pandaren I am looking for. I think I will try out the tooltip method now as that is an instant answer and seems to be a smaller solution in both coding and in table usage.
|
Quote:
Quote:
If you have 1000 ms ping, there is either something wrong with your connection or you're bringing it on yourself by playing on a server far outside of your region, but in any case it's hardly the end of the world if you delay showing chat messages from/about opposite faction panadren anyway. It's not like it's actually relevant information. |
Quote:
Quote:
Quote:
There is an entire history of various data Blizzard granted access to over the years. In vanilla WoW, HP values for any unit other than the player were strictly provided as an integer percent. This changed in BC because of addons that calculated mob HP from how much damage they took before dying, then applied that to exact copies of the same mob. At one time, GUIDs weren't available to addons. The same time Blizzard overhauled the Combat Log system, they added this as a way to track info about a specific entity. Up until LK, Blizzard didn't provide information about mob threat levels. Addons like Omen had to calculate this themselves by taking in damage and healing info from the combat log. There are more examples, but this is all I can think of at the moment. All of which fall into different categories of necessity and luxury, things people suggested and things people worked on to obtain themselves. |
Quote:
If you think eliminating a one-second-at-most delay to determine someone's faction in the one-in-a-million event of them being an enemy pandaren /saying or /yelling something in Pandaren instead of their faction default language is really so critical Blizzard needs to spend time adding to the API, I guess we just have radically different ideas about what is important. I'd much rather they spend time fixing actual bugs instead, and there are certainly plenty of those for them to work on. |
Quote:
If you don't believe me, check the links. Quote:
If I'm not mistaking, this is the entire purpose of this subforum. Description of Developer Discussions » Wish List taken from the main forum page. Quote:
|
so this is currently what I have the tooltip down to and it works fine (well it did as I made some changes here and have yet to test them)... you call it and it returns true if they are the same faction and false if not. I still think an added return to for GetPlayerInfoByGUID would be a better solution... and since this is a WISH LIST... I can wish all I want lol
Lua Code:
|
I'll have to do some further tests with the tooltips for the unit hyperlink. Previously, I've noticed it only returns useful data if the player in question is within the game client's visible range. If it does still work past that range, I might take a look into it and already have some optimizations in mind for the code.
Lua Code:
Assuming the tooltip works beyond the game client's visual range and no addons hook into the global metatable for tooltips, this modification should function in the same way UnitFactionGroup() does, but operate on GUIDs instead. |
Okay, I didn't take into account that the faction might change, so you probably should avoid caching it if it's neutral. However, I warn you against skipping OnTooltipSetUnit, I've had issues before making the assumption that a tooltip's text is going to be available immediately after I set it.
Also, don't assume that it's neutral because it doesn't match the alliance or horde string because sometimes the faction isn't mentioned in the tooltip, which I believe always means it's not your faction, but could be either neutral or the opposing faction. |
I'm not sure if Tooltip:SetHyperlink() fires OnTooltipSetUnit on unit hyperlinks. Again, all this is pending results of a series of tests I need to do and unfortunately, I can't perform them at work right now. The "Neutral" handling is just a fall through in case it's unable to identify a specific faction. With lack of other options, I don't see any harm in letting it do that as long as it doesn't throw them into either of the Alliance or Horde category blindly. If you insist, you can have it pass nil,nil instead as that's the default response of UnitFactionGroup() for neutral NPCs.
|
That is why I used IsPlayerNeutral() in my function first as if you are neutral, so every other char near you will be too. Also if it doesn't come back with a faction for a player then it is safe to assume that the player is of the opposing faction (as I did). I suppose that since a clear is issued before the set you could test to make sure that numlines is greater than 0 to make sure that the tooltip has been set... and possibly loop until it is but who knows how long that could hang you up for...
|
OnTooltipSetUnit fires when it's populated with unit information whether it's from SetUnit or SetHyperlink.
I don't know for sure that you need to wait for it, but I would be careful. |
sure beats the following... this is what I was doing before, modified for the SendAddonMessage and to catch the thrown error if it happens
if it is passed just a GUID it will return true if the person is part of your faction or if you are a panda if you pass a GUID, and a function to run if true / false and char name and unlimited args for the passed functions ... if a non panda it will automatically call the proper function (if it exists) and return true/false depending... if a panda it queues up the required info in a table, sends the addon message and waits up to 1 second for the error. if the error is thrown, it will call the ifFalse function and remove the panda from the queue... after the 1 second, the addon calls the ifTrue function if supplied and then removes the panda from the queue it will call ifTrue/ifFalse with GUID, unpack(...) Lua Code:
|
Quote:
The only way around this is to recode the entire thing into a request-and-callback code style, which would add another layer of complexity to it. |
I was scraping the tooltip for spell information and can say with absolute certainty that attempting to do it soon after loading/zoning and possibly other situations would result in the tooltip being empty.
|
Quote:
Well technically it is but you get my point. (Routes and Weakauras - that I know off - use coroutines to simulate multi-threaded execution) |
A coroutine represents a thread, but isn't a real one. If you have a coroutine run an infinite loop in the game client, it'll freeze it the same way as if you had code in the main stack do so. This is because the coroutine needs to yield in order for the main stack to continue running. If it never yields, the thread it's running on (the only thread the Lua engine is given) gets stuck. Since MoP though, the game client has a WatchDog thread that activates while in combat and monitors how long the Lua engine thread runs. If the Lua thread exceeds a specific amount of time, the WatchDog thread interrupts it by forcing a Lua error.
Note WatchDog is an old term for a program or circuit specifically designed to detect when another critical program/component freezes and restarts it as necessary. |
OK... So here is what I have now. It will return Neutral when the player is neutral, as you can only run into neutral players then, it tests the race of all chars and figures out by that, faction, except for pandas which it uses the tooltip. I combined how I was originally testing and incorporated the tooltip for scanning pandas only.
Lua Code:
|
From some of my testing, the same conclusion happens that I had observed earlier pre-MoP. Tooltips from the unit hyperlink only displays useful information past race/class only if said unit is within the game client's visual range. As soon as a unit leaves this range, existing information is discarded and is no longer available.
|
All times are GMT -6. The time now is 05:50 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI