Page 1 of 1

introducing wow API event "UNIT_SPELLCAST_SENT"

PostPosted: Mon Jun 08, 2015 8:32 pm
by LYQ
Hello there,

I don't know which effort it would take to introduce the API event "UNIT_SPELLCAST_SENT" on nostalrius which was on retail introduced with patch 2.0 but if it's not that big of a deal it would help a lot in my opinion.

From my Computer I usually get a latency between 15-25ms in general (value taken from GetNetStats() which only updates every 30s, not speaking of an average value in this interval) but when playing at peak times the latency feels like 5x higher (even though GetNetStats isn't peaking higher than 30-40ms).

with "UNIT_SPELLCAST_SENT" addon developer like myself could calculate the "real" latency while playing, which eg. could be implemented in CastingBars to enhance game experience during peak hours.


Thanks for your time
- LYQ

references:
http://wowprogramming.com/docs/events/U ... LCAST_SENT / http://wow.gamepedia.com/Events/U
http://wowwiki.wikia.com/API_GetNetStats

Re: introducing wow API event "UNIT_SPELLCAST_SENT"

PostPosted: Mon Jun 08, 2015 10:00 pm
by Aunstic
The WoW API is in the client and I'd assume _SENT would require server acknowledgment. Assuming the MPQ files amend functions to client, I'm not too sure if a 1.12.1's source code is out there so you can add later patch's API changes to the client.

I know it's not what you're looking for, but I went through oCB awhile ago. The author made a neat lag assumption to the cast bar.
Code: Select all
   if oCBCastSent then
      local mylatency = math.floor((GetTime()-oCBCastSent)*1000)
      local w = math.floor(oCB.frames.CastingBar.Bar:GetWidth())
      mylatency = mylatency
      self.frames.CastingBar.Latency:SetText(mylatency.."ms")
      self.frames.CastingBar.LagBar:SetStatusBarColor(1, 0, 0, 0.5)
      self.frames.CastingBar.LagBar:SetMinMaxValues(0, 100)
      self.frames.CastingBar.LagBar:SetValue(100)
      local lagw = w - (w*(self.maxValue-self.startTime-(mylatency/1000))/(self.maxValue-self.startTime))
      if lagw >= w then lagw = w end
      self.frames.CastingBar.LagBar:SetWidth(lagw)
   else
      self.frames.CastingBar.Latency:SetText("")
      self.frames.CastingBar.LagBar:SetValue(0)
   end

Re: introducing wow API event "UNIT_SPELLCAST_SENT"

PostPosted: Mon Jun 08, 2015 10:04 pm
by Athene
available here

changelog http://genesis-guilde.fr/forum/Thread-B ... B3-Vanilla


A really good API change/addition from devs would be to change CheckInteractDistance to return 40yard for duels (because who cares about starting a duel 40 yards away) and then we can use this to show unit in range for our healers in grid and stuff if it can't be change maybe a new command that return a boolean using the CHAT_MSG_ADDON :p

Re: introducing wow API event "UNIT_SPELLCAST_SENT"

PostPosted: Mon Jun 08, 2015 10:09 pm
by Aunstic
Athene wrote:available here

changelog http://genesis-guilde.fr/forum/Thread-B ... B3-Vanilla


A really good API change from devs (if it's possible) would be to change CheckInteractDistance to return 40yard for duels (because who cares about starting a duel 40 yards away) and then we can use this to show unit in range for our healers in grid and stuff.

Oh shit. You're the author... I love you.

Re: introducing wow API event "UNIT_SPELLCAST_SENT"

PostPosted: Mon Jun 08, 2015 10:11 pm
by scol
Athene wrote:available here

changelog http://genesis-guilde.fr/forum/Thread-B ... B3-Vanilla


A really good API change/addition from devs would be to change CheckInteractDistance to return 40yard for duels (because who cares about starting a duel 40 yards away) and then we can use this to show unit in range for our healers in grid and stuff if it can't be change maybe a new command that return a boolean using the CHAT_MSG_ADDON :p


Thanks !

Re: introducing wow API event "UNIT_SPELLCAST_SENT"

PostPosted: Mon Jun 08, 2015 10:14 pm
by Athene
Aunstic wrote:Oh shit. You're the author... I love you.


No problem :)

Re: introducing wow API event "UNIT_SPELLCAST_SENT"

PostPosted: Tue Jun 09, 2015 12:20 pm
by LYQ
wow, I had the CastSpell Functions hooked anyways ( to trigger a castbar for Aimed shot eg. ) but I didn't thought about using this hook for the latency calculation - amazing simple Thanks!

Last night while I couldn't get any sleep so I thought about the mentioned event and realizied it must've been implemented clientsided, when I made the thread I was mislead because on my research I was going back and forth from combatlog events and clientsided so I mixed it up..^^

well I guess this thread reached its goal, thanks for the great feedback.
and In case a Mod reads this, one Subforum for AddOn/UI/Macro related issues would be cool - I saw most ppl posting their AddOn related threads in the General discussion forum.