WoWInterface SVN Broker_Wintergrasp

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /trunk
    from Rev 3 to Rev 4
    Reverse comparison

Rev 3 → Rev 4

Broker_Wintergrasp/Broker_Wintergrasp.lua
1,6 → 1,4
-- lowbies doesnt get the info (i think)
--if(UnitLevel('player') < MAX_PLAYER_LEVEL) then return end
 
local locale = GetLocale()
local dummy = CreateFrame('Frame')
local math_floor = math.floor
local string_format = string.format
13,6 → 11,62
iconCoords = {0.065, 0.935, 0.065, 0.935}
})
 
local MINUTES, SECONDS, HOUR, UNKNOWN, TIMEUNTIL, BEGINS, ERROR
if(locale == 'frFR') then
-- todo
MINUTES, SECONDS, HOUR, UNKNOWN = 'minutes', 'seconds', 'hour', 'Unknown'
TIMEUNTIL = 'Time until next battle:'
BEGINS = 'Wintergrasp begins in '
ERROR = 'You must be in Northrend to see the time'
elseif(locale == 'deDE') then
MINUTES, SECONDS, HOUR, UNKNOWN = 'minuten', 'sekunden', 'stunde', 'Unbekannt'
TIMEUNTIL = 'Zeit bis zum n\195\164chsten kampf:'
BEGINS = 'Tausendwinter startet in '
ERROR = 'Du musst dich in Nordend befinden, um die zeit sehen zu k\195\182nnen'
elseif(locale == 'koKR') then
-- todo
MINUTES, SECONDS, HOUR, UNKNOWN = 'minutes', 'seconds', 'hour', 'Unknown'
TIMEUNTIL = 'Time until next battle:'
BEGINS = 'Wintergrasp begins in '
ERROR = 'You must be in Northrend to see the time'
elseif(locale == 'zhCN') then
-- todo
MINUTES, SECONDS, HOUR, UNKNOWN = 'minutes', 'seconds', 'hour', 'Unknown'
TIMEUNTIL = 'Time until next battle:'
BEGINS = 'Wintergrasp begins in '
ERROR = 'You must be in Northrend to see the time'
elseif(locale == 'zhTW') then
-- todo
MINUTES, SECONDS, HOUR, UNKNOWN = 'minutes', 'seconds', 'hour', 'Unknown'
TIMEUNTIL = 'Time until next battle:'
BEGINS = 'Wintergrasp begins in '
ERROR = 'You must be in Northrend to see the time'
elseif(locale == 'ruRU') then
-- todo
MINUTES, SECONDS, HOUR, UNKNOWN = 'minutes', 'seconds', 'hour', 'Unknown'
TIMEUNTIL = 'Time until next battle:'
BEGINS = 'Wintergrasp begins in '
ERROR = 'You must be in Northrend to see the time'
elseif(locale == 'esES') then
-- todo
MINUTES, SECONDS, HOUR, UNKNOWN = 'minutes', 'seconds', 'hour', 'Unknown'
TIMEUNTIL = 'Time until next battle:'
BEGINS = 'Wintergrasp begins in '
ERROR = 'You must be in Northrend to see the time'
elseif(locale == 'esMX') then
-- todo
MINUTES, SECONDS, HOUR, UNKNOWN = 'minutes', 'seconds', 'hour', 'Unknown'
TIMEUNTIL = 'Time until next battle:'
BEGINS = 'Wintergrasp begins in '
ERROR = 'You must be in Northrend to see the time'
else
MINUTES, SECONDS, HOUR, UNKNOWN = 'minutes', 'seconds', 'hour', 'Unknown'
LEFTMOUSE, RIGHTMOUSE = 'Left-click to print time left to chat', 'Right-click to exit Wintergrasp'
TIMEUNTIL = 'Time until next battle:'
BEGINS = 'Wintergrasp begins in '
ERROR = 'You must be in Northrend to see the time'
end
 
local function TimeAbbrev(time, short)
if(not time) then
return ''
20,37 → 74,53
if(short) then
return string_format('%d', time)
else
return string_format('%d seconds', time)
return string_format('%d %s', time, SECONDS)
end
elseif(time < 3600) then
if(short) then
return string_format('%d:%02d', math_floor(time / 60), time % 60)
else
return string_format('%d minutes %d seconds', math_floor(time / 60), time % 60)
return string_format('%d %s %d %s', math_floor(time / 60), MINUTES, time % 60, SECONDS)
end
else
local min = math_floor(time / 60)
if(short) then
return string_format('%d:%02d:%02d', math_floor(min / 60), min % 60, time % 60)
else
return string_format('%d hour %d minutes %d seconds', math_floor(min / 60), min % 60, time % 60)
return string_format('%d %s %d %s %d %s', math_floor(min / 60), HOUR, min % 60, MINUTES, time % 60, SECONDS)
end
end
end
 
function broker.OnClick(self, button)
-- print in current channel / add to editbox is its open
if(not GetWintergraspWaitTime()) then return end
 
if(button == 'RightButton' and CanHearthAndResurrectFromArea()) then
HearthAndResurrectFromArea()
else
if(ChatFrameEditBox:IsShown()) then
local text = ChatFrameEditBox:GetText()
ChatFrameEditBox:SetText(text..TimeAbbrev(GetWintergraspWaitTime(), true))
else
ChatFrame_OpenChat(BEGINS..TimeAbbrev(GetWintergraspWaitTime()))
end
end
end
 
function broker.OnTooltipShow(self)
local timeLeft = GetWintergraspWaitTime()
self:AddLine('|cff0090ffBroker Wintergrasp|r')
if(timeLeft) then
self:AddLine(string_format('Time until next battle: %s', TimeAbbrev(timeLeft)))
self:AddLine(string_format('%s %s', TIMEUNTIL, TimeAbbrev(timeLeft)))
else
self:AddLine('Time until next battle: Unknown')
self:AddLine('You must be in Northrend to see the time')
self:AddLine(string_format('%s %s', TIMEUNTIL, UNKNOWN))
self:AddLine(ERROR)
end
self:AddLine('')
self:AddLine(LEFTMOUSE)
if(CanHearthAndResurrectFromArea()) then
self:AddLine(RIGHTMOUSE)
end
end
 
dummy:SetScript('OnUpdate', function(self, elapsed)