Rummys Blog An world of endless Monday

Wednesday, 20 August, 2008

Notes on converting GotWood to “talk”

Filed under: World of Warcraft — Andrew.Rowbottom @ 12:16 pm

I’ve been looking to make a “talking” totem manager so that I can have audible indications when my totems are expiring so that I can refresh them promptly.

The idea is that when a totem “expires” I get to hear some sort of sound.

Initially I though of writing an entirely new addon, bulimics and that may yet happen. Until then I’m looking to modify an existing addon. The problem was finding one that was simple enough to understand.

TotemTimers looked good, site but has an awful lot of extra capability meaning it was difficult to “see the wood for the trees” <smirk>.

I’ve since found “GotWood” which displays the totems you have dropped and how long they have left to go. Which in a way is what I want to do. So I’m going to hack GotWood to produce sounds and then perhaps re-hack it to remove the display bit so I’m only left with the sounds. At that point, obviously, I’ll be renaming it.

Source code lifted from http://svn.wowace.com/wowace/trunk/GotWood/GotWood.lua

So, onto the analysis…..

GotWood uses a lot of ace libraries – I don’t really care which libraries it uses.

It has a number of translations, these seem mostly to do with the UI. One oddity is that they have translations for foreign languages, and true for en_US. I guess at some point I’ll be adding in some options for notification (disable/enable etc). At the moment I’ll just hard code.

GotWood:UNIT_SPELLCAST_SUCCEEDED(player, sName, sRank)

  • usually calls self.view:SetTotem(sName, rank) and self.view:RemoveTotem(v) for totemic recall.

function GotWood:PLAYER_DEAD()

  • calls self.view:RemoveTotem(v) for all totems

function GotWood:PLAYER_TOTEM_UPDATE(slot)

  • calls self.view:SetTotemFromEvent(name, startTime, timeleft, icon, self.slotmap[slot])
  • or self.view:RemoveTotem(self.slotmap[slot]) (totem death)

function GotWood:TotemDamage(msg)

  • not interested and commented as useless after 2.4

Alternatively I could implement a new View that “subclasses” CandyBarView and responds to the abstract methods…..

SetTotem,- when a totem is created (UNIT_SPELLCAST_SUCCEEDED)

SetTotemFromEvent,- when (PLAYER_TOTEM_UPDATE)

RemoveTotem, when – (UNIT_SPELLCAST_SUCCEEDED-TotemicCall, PLAYER_DEAD, PLAYER_TOTEM_UPDATE)

overloading remove totem would result in a bundle of sounds for totemic recall 🙁

So modifying GotWood:PLAYER_TOTEM_UPDATE looks like the way to go to get “expiries” and overloading the view might help in getting timings.  The View code probably has good tricks for discovering if a totem is going to expire in x seconds.

Totem names etc…

GotWood:PLAYER_TOTEM_UPDATE has a “slot” for earth, air, fire, water and would be a good place to start, just four sounds, in addition there’s a totem name which I think is the name of the current totem (if any)

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URL

Leave a comment

Powered by WordPress