[Bug] Slouken: Handling of unit IDs/suffixes

by Ckknight | 09/06/2007 03:16:46

Ckknight

There are two functions, SecureButton_GetUnit and SecureButton_GetModifiedUnit, both in SecureTemplates.lua that have an (imho) improper handling of player suffixes.

Basically, if f:GetAttribute("unit") == "player" and f:GetAttribute("unitsuffix") == "target", then SecureButton_GetUnit(f) == "playertarget" instead of "target", which due to the internals of WoW, is not as responsive as just "target". Same applies to "playerpet" => "pet"

function SecureButton_GetUnit(self)
local unit = SecureButton_GetAttribute(self, "unit");
if ( unit ) then
local unitsuffix = SecureButton_GetAttribute(self, "unitsuffix");
if ( unitsuffix ) then
unit = unit .. unitsuffix;
-- map raid1pet to raidpet1
unit = gsub(unit, "^([^%d]+)([%d]+)[pP][eE][tT]", "%1pet%2");
unit = gsub(unit, "^player(.+)", "%1"); -- this is the line I added
end
return unit;
end
end


If you add the line I specify, this situation is averted with, as far as I can tell, no ill effects.

[ Post edited by Ckknight ]


FuBar author, Cartographer author, Ace2 developer (Find em at wowace.com or wowinterface.com)

Show your appreciation by donating to my paypal: ckknight at gmail dot com

by Slouken | 09/06/2007 07:43:00

Slouken


Q u o t e:

Basically, if f:GetAttribute("unit") == "player" and f:GetAttribute("unitsuffix") == "target", then SecureButton_GetUnit(f) == "playertarget" instead of "target", which due to the internals of WoW, is not as responsive as just "target". Same applies to "playerpet" => "pet"



playertarget being equivalent to target is fixed for 2.2.0 (no lua change necessary), and playerpet is already equivalent to pet.

Thanks!

Blizzard Announcement Recent Blizzard Announcements

 



Loaded in 0.02656 seconds