Mercurial > wow > degaine
changeset 14:c627cef1c6d6 v1.0beta2
Lots of hacks for merchants and gossips
author | contrebasse |
---|---|
date | Fri, 10 Dec 2010 18:22:56 +0100 |
parents | 7b1f3a9cba48 |
children | 60e371f11e5e |
files | Degaine.lua |
diffstat | 1 files changed, 28 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/Degaine.lua Fri Dec 10 17:26:46 2010 +0100 +++ b/Degaine.lua Fri Dec 10 18:22:56 2010 +0100 @@ -9,7 +9,7 @@ -- (it's not possible to know if you were sitting or standing before) --@debug@ -local debug = true +local debug = false --@end-debug@ @@ -20,13 +20,14 @@ -- GLOBALS: Degaine_ToggleAuto, Degaine_isAuto, BINDING_HEADER_DEGAINE -- It doesn't matter if they are globals --- GLOBALS: DEFAULT_CHAT_FRAME, GossipFrame +-- GLOBALS: DEFAULT_CHAT_FRAME -- Lua functions local pairs = pairs; local type = type; -- Wow functions +local GetTime = GetTime local InCombatLockdown = InCombatLockdown local ToggleSheath = ToggleSheath @@ -41,6 +42,9 @@ -- vars local t_left = -1 local delay = 2 -- seconds +local isGossipClosed = true +local wasGossipOpened = false +local t_lastGossipClosed = 0 --------------------------------------------------------------- @@ -60,8 +64,19 @@ --------------------------------------------------------------- -- Events to watch local events = { -- no args to watch - GOSSIP_SHOW = true, - MERCHANT_SHOW = function() return GossipFrame:IsShown() end, + GOSSIP_SHOW = function() + local returnvalue = isGossipClosed + isGossipClosed = false + return returnvalue + end, + MERCHANT_SHOW = function() + -- hack for the cases where the merchant's frame is opened from a gossip frame + if (GetTime() - t_lastGossipClosed) < 0.5 then + return not wasGossipOpened + else + return isGossipClosed + end + end, BANKFRAME_OPENED = true, --function() return GossipFrame:IsShown() end, AUCTION_HOUSE_SHOW = true, } @@ -157,11 +172,11 @@ --------------------------------------------------------------- local Degaine_OnEvent = function(self,event, arg1, arg2, _, _, arg5, ...) --@debug@ - if debug then + --if debug then DEFAULT_CHAT_FRAME:AddMessage(event) - if arg1 then DEFAULT_CHAT_FRAME:AddMessage("arg1 = "..arg1) end - if arg2 then DEFAULT_CHAT_FRAME:AddMessage("arg2 = "..arg2) end - end + --if arg1 then DEFAULT_CHAT_FRAME:AddMessage("arg1 = "..arg1) end + --if arg2 then DEFAULT_CHAT_FRAME:AddMessage("arg2 = "..arg2) end + --end --@end-debug@ if events[event] then @@ -178,6 +193,10 @@ if arg2==playername then start() end + elseif event == "GOSSIP_CLOSED" then + wasGossipOpened = not isGossipClosed + isGossipClosed = true + t_lastGossipClosed = GetTime() elseif event == "PLAYER_REGEN_ENABLED" then desactivate() @@ -218,6 +237,7 @@ DegaineFrame:SetScript("OnEvent",Degaine_OnEvent) -- Global events +DegaineFrame:RegisterEvent("GOSSIP_CLOSED") DegaineFrame:RegisterEvent("PLAYER_REGEN_ENABLED") DegaineFrame:RegisterEvent("PLAYER_REGEN_DISABLED") DegaineFrame:RegisterEvent("ADDON_LOADED")