Download
(179Kb)
Download
Updated: 04-28-09 02:11 PM
Pictures
File Info
Updated:04-28-09 02:11 PM
Created:12-19-08 06:06 PM
Downloads:21,165
Favorites:119
MD5:

Wintergrasp Timer  Popular! (More than 5000 hits)

Version: beta18 (defunct)
by: Mike-N-Go [More]

This AddOn is not updated for 4.x.

It will remain
for posterity.


If you are still unabated, please show your support if you want this AddOn updated for 4.x. You can either donate, or show your support on the comments page.


As of May 20, 2009: This addon is unsupported for the time being. AddOn authoring was only a hobby of mine. Mike-N-Go is not currently playing WoW, thus not creating or maintaining mods for WoW. If someone wishes to submit a patch for one of my mods to WoWInterface, you may within the bounds of the license bundled with the mod.


Now with slashcommand-options!
/wgt or /wintergrasptimer [option]
screen - shows announcements on screen
chat - shows announcements in chat
sound - plays warningsound with announcements (Sound file is from Nintendo's (c) Smash Brothers, provided by HelpTheWretched (http://noproblo.dayjo.org/ZeldaSounds/).)
stopwatch - shows stopwatch when less than 5 minutes left
time - prints time left in chat


Note: Ownership of this file has changed to Mike-N-Go from Mikma. He has several new features that should be out soon(tm). The pictures do not necessarily reflect the latest version of the AddOn.

04-28-09 beta18:
+ Fixed GetWintergraspWaitTime() math nil error

04-26-09 beta17:
+ Updated for WoW 3.1
+ First version using GetWintergraspWaitTime(); this allows the user to see the WG start time from anywhere

02-25-09 beat16:
+ Fixed a problem with AceConsole loading
+ Forces the mod to ask and send the latest WG start time when logging in

02-25-09 beta15:
+ Fixed a problem with CTL not properly being enabled by the mod

2-23-09 beta14:
+ Fixed lib embedding
+ Fixed printing to chat frame to use ChatFrame1:AddMessage

2-23-09 beta13:
+ Begun conversion to Ace; note that the addon is not yet fully converted
+ Added ruRU localization; let me know if it works because I cannot test it, also, if it is translated correctly. Thanks ZillahGiovanni and StingerSoft for the initial translation
+ Added Shake() and Flash() to the warnings
+ Added 'In progress' to the LDB feed text if a battle is in progress
+ Added 'Begins after' to the LDB feed text if the last known time of the start of WG is within 3 hours of the current time; this is an estimation of when the next battle will start
+ Added 'Begins in' to the LDB feed text this will tell the user when the next known start time of WG will start
+ Added 'In progress' to the LDB feed text
+ Changed formant of the LDB feed text IE: Begins in: 1h 28m (4:27)
+ Embedded SSBM_YoungLink_KO.wav sound file. File from http://noproblo.dayjo.org/ZeldaSounds/ (c) Nintendo from HelpTheWretched

02-05-09 beta12:
+ Reverted SVPC from beta 11; you should now see WG start time on all characters
+ Added more info to the .toc
+ First update by Mike-N-Go, the new author

beta11:
+ Fixed the 24h clock format
+ Added the bugfix for "general bugginess" Mike-N-Go submitted

01-28-09 beta10:
+ Added the estimated startingtime in LDB and tooltip, thanks to Mike-N-Go
+ Loads Blizzard_TimeManager to eliminate the Stopwatch errors

01-27-09 beta9:
+ Added slashcommands to control some options. try /wgt or /wintergrasptimer.
+ Added announcement support for MSBT
+ Added /stopwatch-support that is being used when there is less than 5min to next battle

beta8:
+ German localization added. thank you dingsbums!

beta7:
+ Now gets the time in Wintergrasp-zone if you happen to fly over!
- Removed debugpring I might have forgotten in broadcast-function

beta6:
+ *Ninjaupdate*
+ Added a "Timerfix" that will try to make the startingtime much more accurate than the default one Blizzards shows us.
+ Now broadcasts the time left in seconds, not the estimated startingtime.

beta5:
- Removed global channel. buh bye!
+ Added Raid, Party and Guild broadcasting back in.
+ Fixed the timer, should be accurate now.

beta4:
- Removed the text "Wintergrasp:" from the broker.
+ Added pretty tooltip when mouseovering the broker.

beta3:
+ Added slashcommand '/wgtreset' and '/wintergrasptimerreset' in case you need to reset the timer.
+ Added shift+leftclick that announces the time in chat editbox.
+ Added shift+rightclick that resets and requests the current time.
+ Changed Raid, Party and Guild broadcast into Global broadcast (Hidden channel).
+ Added NPC yell-capture that adds the remaining time into WGT Broker.

beta2:
+ Added the Horde NPC.
+ When showing the long time, show it in form H:MM instead of H:MM:SS.

beta1:
+ Release.
Optional Files (0)


Post A Reply Comment Options
Unread 01-19-09, 11:06 PM  
Stylpe
A Kobold Labourer
 
Stylpe's Avatar
AddOn Author - Click to view AddOns

Forum posts: 0
File comments: 8
Uploads: 1
But you didn't add support for grabbing the time from the on-screen timer when you're in the zone, though? I often swoop in and out of the zone when I'm flying for example from Dalaran to Sholazar.
__________________
Keep violence virtual!
Report comment to moderator  
Reply With Quote
Unread 01-20-09, 04:07 AM  
mikma
A Cyclonian
 
mikma's Avatar
AddOn Author - Click to view AddOns

Forum posts: 45
File comments: 267
Uploads: 23
Originally posted by Stylpe
But you didn't add support for grabbing the time from the on-screen timer when you're in the zone, though? I often swoop in and out of the zone when I'm flying for example from Dalaran to Sholazar.
Not yet. The code I got provided doesn't do a very good job if there's a fight going on, so I need to find a better way.
Report comment to moderator  
Reply With Quote
Unread 01-20-09, 05:12 AM  
totalpackage
A Fallenroot Satyr
 
totalpackage's Avatar
AddOn Author - Click to view AddOns

Forum posts: 27
File comments: 940
Uploads: 10
Here's an example for retrieving time from within the zone:
Code:
if event == "UPDATE_WORLD_STATES" and GetMapInfo() == "LakeWintergrasp" then
   local _, isactive, waitingtext = GetWorldStateUIInfo(8)
   if isactive == 1 and waitingtext then
      local h, m, s = strmatch(waitingtext, "(%d+):(%d+):(%d+)")
      ...
   end
end
Report comment to moderator  
Reply With Quote
Unread 01-20-09, 05:14 AM  
mikma
A Cyclonian
 
mikma's Avatar
AddOn Author - Click to view AddOns

Forum posts: 45
File comments: 267
Uploads: 23
Originally posted by totalpackage
Here's an example for retrieving time from within the zone:
Code:
if event == "UPDATE_WORLD_STATES" and GetMapInfo() == "LakeWintergrasp" then
   local _, isactive, waitingtext = GetWorldStateUIInfo(8)
   if isactive == 1 and waitingtext then
      local h, m, s = strmatch(waitingtext, "(%d+):(%d+):(%d+)")
      ...
   end
end
You really can't rely on GetMapInfo() if you do a quick visits in Wintergrasp. I found a area that was showing Icecrown as zone and still did show the timer on screen. So I just check if the timer is being shown in AlwaysUpFrame2 instead. Seems to work no matter what the GetMapInfo() returns.
Report comment to moderator  
Reply With Quote
Unread 01-20-09, 07:03 AM  
Stylpe
A Kobold Labourer
 
Stylpe's Avatar
AddOn Author - Click to view AddOns

Forum posts: 0
File comments: 8
Uploads: 1
Great, looking forward to the next update
__________________
Keep violence virtual!
Report comment to moderator  
Reply With Quote
Unread 01-23-09, 12:55 PM  
Internet
A Kobold Labourer
 
Internet's Avatar

Forum posts: 0
File comments: 7
Uploads: 0
Please add in a command to give us the option of enabling or disabling the onscreen time till wintergrasp starts warnings that seem to have been added recently.
Report comment to moderator  
Reply With Quote
Unread 01-24-09, 06:30 AM  
mikma
A Cyclonian
 
mikma's Avatar
AddOn Author - Click to view AddOns

Forum posts: 45
File comments: 267
Uploads: 23
Originally posted by Internet
Please add in a command to give us the option of enabling or disabling the onscreen time till wintergrasp starts warnings that seem to have been added recently.
There already is. in AddOns menu (before logging in) uncheck the box infront of WintergraspTimer to disable it. I don't see the point why I should disable the warnings, basicly that's the reason why I coded this in the first place.
Report comment to moderator  
Reply With Quote
Unread 01-25-09, 12:07 PM  
Mike-N-Go
A Theradrim Guardian
 
Mike-N-Go's Avatar
AddOn Author - Click to view AddOns

Forum posts: 68
File comments: 147
Uploads: 18
Hello Mikma,

Great mod! A few suggestions:
1) PlaySound() of something in addition to the 15 and 5 minute warnings
2) Support for scrolling text addons, like MikScrollingBattleText, to display scrolling text in the middle of the screen
3) A 'countdown' that would display from 60 seconds/5 minutes to 0 in big text, like the mod Arena Countdown
4) The hour and minute of when the next battle will start, not just a counter down to the event

Scrolling text implementation:
Code:
frame:SetScript("OnUpdate", function(self, elap)
    timer = WGTime-time()
    elapsed = elapsed + elap
    if elapsed <= updateperiod then return end
        timer = timer - elapsed
        if timer > 0 then
            local hours,minutes,seconds = ConvertSeconds(timer)
            if hours > 0 then output = hours.."h "..minutes.."m"
            elseif minutes > 0 then output = minutes.."m "..seconds.."s"
            else output = seconds.."s"
            end
        else
            output = "N/A"
            WGTime = 0
        end
        if output == "15m 0s" or output == "5m 0s" then 
            print(text4..output) 
			if ( MikSBT and ( not ( MikSBT.IsModDisabled() ) ) ) then
				MikSBT.DisplayMessage(text4..output)
			else
				UIErrorsFrame:AddMessage(text4..output)
			end
			PlaySound'ReadyCheck'
		
        elseif output == "0s" then 
            print(text5)
			if ( MikSBT and ( not ( MikSBT.IsModDisabled() ) ) ) then
				MikSBT.DisplayMessage(text5)
			else
				UIErrorsFrame:AddMessage(text5)
			end
			PlaySound'ReadyCheck'

        end
        WGTbroker.text = output
    elapsed = 0
end)
With how I have coded the output to scrolling text, it will select MikSBT if it is loaded, or the default UIErrorsFrame if not. Fell free to change the sound or use more of the MikSBT API to color the text or whatever.

I recommend these changes because I would sometime miss the quiet announce of the mod.
__________________
Currently contemplating coming back to Authorship.. been away for years. Please let me know you care, by commenting on what addon(s) of mine you want to see updated.

Author of Daily Bean Counter, MyNameTogglesWhenIAFKorDND, Extended Shutdown Warning, Auto Mail Director, Duel Nullify, Spec Transmiter, Say Again, Window Teller, Who Crafts, Ad Repeater, Privy Cork, Mac Backup, and more.
Last edited by Mike-N-Go : 01-25-09 at 12:54 PM.
Report comment to moderator  
Reply With Quote
Unread 01-26-09, 04:37 AM  
Internet
A Kobold Labourer
 
Internet's Avatar

Forum posts: 0
File comments: 7
Uploads: 0
Originally posted by Mikma
There already is. in AddOns menu (before logging in) uncheck the box infront of WintergraspTimer to disable it. I don't see the point why I should disable the warnings, basicly that's the reason why I coded this in the first place.
I was referring to the warning messages you added that pop up in the center of the screen, which are annoying and i'd like to disable. The small timer is great, and thats all I really want.
Last edited by Internet : 01-26-09 at 04:39 AM.
Report comment to moderator  
Reply With Quote
Unread 01-26-09, 11:32 AM  
mikma
A Cyclonian
 
mikma's Avatar
AddOn Author - Click to view AddOns

Forum posts: 45
File comments: 267
Uploads: 23
Originally posted by Mike-N-Go
1) PlaySound() of something in addition to the 15 and 5 minute warnings
2) Support for scrolling text addons, like MikScrollingBattleText, to display scrolling text in the middle of the screen
3) A 'countdown' that would display from 60 seconds/5 minutes to 0 in big text, like the mod Arena Countdown
4) The hour and minute of when the next battle will start, not just a counter down to the event announce of the mod.
1) Added
2) Added
3) Added
4) Not sure is this one needed :I

Waiting for some texts to be translated before I release next version
Report comment to moderator  
Reply With Quote
Unread 01-27-09, 04:16 AM  
Kartun
A Kobold Labourer
AddOn Author - Click to view AddOns

Forum posts: 0
File comments: 7
Uploads: 2
mods

I've made quick dirty mod to make this addon more suitable for me and my guildies.

Code:
local last_msg = ""
local antispam = 0
local announced = false
local detection_control = 0
local antispam_delay = 30
local side = "";

local function myChatFilter(msg)
  if (antispam - time() <= 0) then last_msg = ""; antispam = time() + antispam_delay; announced = false; end

  if (msg == last_msg) or ((antispam - time() >= 0)and(announced == true)) then 
   return false else last_msg = msg; end
	
  if (detection_control - time() <= 0)  then
	-- Run detection once in 5 mins ... to save resources
	detection_control = time() + 300;
	-- Contol detection --
	local buffs, i = { }, 1;
	local buff = UnitBuff("player", i);
	side = "Enemy";
	while buff do          
	  buffs[#buffs + 1] = buff;
	  if (buffs[i] == "Essence of Wintergrasp") then side = UnitFactionGroup("player"); break; end
	  i = i + 1;
	  buff = UnitBuff("player", i);
	end;
	side = " ("..side .. " controlled)";
	----------------------
   end

  if msg == "?wg" then	
	 announced = true;
	 SendChatMessage("Battle for wintergrasp starting in : "..output..side , "CHANNEL", nil, arg8); 
	  return false
  end
  return false  
end

ChatFrame_AddMessageEventFilter("CHAT_MSG_CHANNEL", myChatFilter)
first of all it react on "?wg" request and reply, but since I'm not really good in lua idk how to make syncronisation to avoid spam from several clients. And second mod is for control side detection for annonce to those who aren't in Northrend.

p.s. I made this mod to beta6, because beta8 for some reason dropped timer after reloadUI()
Last edited by Kartun : 01-27-09 at 04:17 AM.
Report comment to moderator  
Reply With Quote
Unread 01-27-09, 03:17 PM  
Psychophan7
A Chromatic Dragonspawn

Forum posts: 153
File comments: 47
Uploads: 0
Originally posted by Mikma
4) Not sure is this one needed :I
I would have use for that. My guild keeps the time for the next battle in the motd. Having a time printout as well as a countdown would make updating the motd much easier.

This addon doesn't communicate with guild/party/raid periodically, right? Just on login and on command?
Report comment to moderator  
Reply With Quote
Unread 01-27-09, 10:37 PM  
SaberHawke
A Fallenroot Satyr
 
SaberHawke's Avatar

Forum posts: 23
File comments: 93
Uploads: 0
Error in Beta9

Received the following error 22 times in quick succession in the latest beta.

[2009/01/27 22:22:43-526-x22]: WintergraspTimer-beta\WintergraspTimer.lua:152: attempt to call global 'Stopwatch_StartCountdown' (a nil value)

---
Report comment to moderator  
Reply With Quote
Unread 01-28-09, 05:02 AM  
Mike-N-Go
A Theradrim Guardian
 
Mike-N-Go's Avatar
AddOn Author - Click to view AddOns

Forum posts: 68
File comments: 147
Uploads: 18
Originally posted by Psychophan7
I would have use for that. My guild keeps the time for the next battle in the motd. Having a time printout as well as a countdown would make updating the motd much easier.

This addon doesn't communicate with guild/party/raid periodically, right? Just on login and on command?
You just gave me an idea. The mod could also have a command to update the guild MOTD automatically, periodically, or when called. Now, it would not have to be the only thing allowed in the MOTD, if the MOTD is something like "...Wintergrasp starts in X:XX at X:XX. ..." Where the mod would look for "Wintergrasp starts in" and only change the counter down and the actual time.

About your question, of when the addon 'communicates', if you really want to find out yourself, you can get an addon that allows you to view SendAddonMessage()s, like LilAddonMessage, and watch it. Or, by looking at the code, one might think that some of the communication is done when time is requested by someone in guild/party/raid, the user is in Wintergrasp or talks to/hears from the NPC with the time in Darlan, or someone sends the data under these conditions.
__________________
Currently contemplating coming back to Authorship.. been away for years. Please let me know you care, by commenting on what addon(s) of mine you want to see updated.

Author of Daily Bean Counter, MyNameTogglesWhenIAFKorDND, Extended Shutdown Warning, Auto Mail Director, Duel Nullify, Spec Transmiter, Say Again, Window Teller, Who Crafts, Ad Repeater, Privy Cork, Mac Backup, and more.
Report comment to moderator  
Reply With Quote
Unread 01-28-09, 06:35 AM  
Mike-N-Go
A Theradrim Guardian
 
Mike-N-Go's Avatar
AddOn Author - Click to view AddOns

Forum posts: 68
File comments: 147
Uploads: 18
Here is the time to event code I put in for my request 'The hour and minute of when the next battle will start, not just a counter down to the event announce of the mod.'. Note it is more of a prof of concept, and may need some tuning.


Code:

--[[
Notes of the changes by MikeNGo:
I think my changes were done to beta8, but I do not know for sure as the version in the .toc just says 'beta', I do know it is not beta9 I altered; note it would be nice to update the version in the .toc 
The objective of my  changes were to add in hour:minute format the hour and minute that the next WG battle would land on.
The altered code (noted by '--Added by MikeNGo') is what I changed
Note that there is a problem with a rounding error, so the minute time might bounce between a moment and the moment before or after it
Also, the sound and MSBT addition are in this reversion
Due to a few stupid wrong assumptions I made, so it took me a long time to make this change, lol, so here is what I got so far
Note what I have done is more or less a proff of concept; the idea needs a bit of ironing out
BTW, Mikma, I took you saying, "4) Not sure is this one needed :I," to my sudjustion that you repplied to as, "Not sure if I want to bother implementing that," so I just did it for you =]
Enjoy, and you may use my changes in improving your addon
]]

if not WGTime then WGTime = 0 end

local NPC1,NPC2,text1,text2,text3,text4,text5,text6,text7,text8,tooltip1,tooltip2,tooltip3,tooltip4,tooltip5,tooltip6,tooltip7

if GetLocale() == "deDE" then
    -- Thank you dingsbums @ wowinterface.com
    NPC1 = "Arkanist Braedin"
    NPC2 = "Magister Surdiel"
    text1 = "Tausendwinter beginnt in 15 Minuten"
    text2 = "Tausendwinter beginnt in 5 Minuten"
    text3 = "Die Schlacht um Tausendwinter startet in: "
    text4 = "Tausendwinter Timer: Die Schlacht startet in "
    text5 = "Tausendwinter Timer: Die Schlacht hat begonnen!"
    text6 = "Tausendwinter Timer: Am Zur¸cksetzen und Abfragen der Zeit."
    text7 = "N‰chste Schlacht:"
    text8 = "Tausendwinter Timer:"
    tooltip1 = "Echtzeit:"
    tooltip2 = "Blizzardzeit:"
    tooltip3 = "Shift+Linke Maustaste"
    tooltip4 = "Die Zeit im Chat bekanntgeben."
    tooltip5 = "Shift+Rechte Maustaste"
    tooltip6 = "Zur¸cksetzen und bekannte Zeit abfragen."
    tooltip7 = "Time when battle will start at: "--Added by MikeNGo
else
    NPC1 = "Arcanist Braedin"
    NPC2 = "Magister Surdiel"
    text1 = "Wintergrasp will begin in 15 minutes"
    text2 = "Wintergrasp will begin in 5 minutes"
    text3 = "Battle of Wintergrasp starts in: "
    text4 = "Wintergrasp Timer: Battle will begin in "
    text5 = "Wintergrasp Timer: Battle has begun!"
    text6 = "Wintergrasp Timer: Resetting and requesting time"
    text7 = "Next Battle:"
    text8 = "Wintergrasp Timer:"
    tooltip1 = "Fixed Time:"
    tooltip2 = "Blizzard Time:"
    tooltip3 = "Shift+LeftButton"
    tooltip4 = "Announce the time in chat input."
    tooltip5 = "Shift+RightButton"
    tooltip6 = "Reset and request known time."
    tooltip7 = "Time when battle will start at: "--Added by MikeNGo
end
                         
local TIMEFIX,updateperiod,elapsed,output,h,m,s,timer = 1.025,1,0
local brokertext = text8

WGTbroker = LibStub("LibDataBroker-1.1"):NewDataObject(brokertext, {
    type = "data source",
    text = "N/A",
    icon = "Interface\\Icons\\INV_Jewelry_Ring_66",
    OnClick = function(self, button)
        if IsShiftKeyDown() then
            if button == "LeftButton" and WGTime > 0 then
                ChatFrameEditBox:Show()
                ChatFrameEditBox:SetText(text3..output)
            elseif button == "RightButton" then
                print(text6)
                WGTime = 0
                if IsInGuild() then SendAddonMessage("WGTime", "timerequest", "GUILD") end
                if UnitExists("party1") then SendAddonMessage("WGTime", "timerequest", "PARTY") end
                if UnitExists("raid1") then SendAddonMessage("WGTime", "timerequest", "RAID") end
            end
        end
    end,
    OnEnter = function(self)
        local originaltime = timer/TIMEFIX
        local h1,m1,s1 = ConvertSeconds(timer)
        local h2,m2,s2 = ConvertSeconds(originaltime)
        local h3,m3,s3 = ConvertSecondsToHourMinute(timer)--Added by MikeNGo
        GameTooltip:SetOwner(self, "ANCHOR_NONE")
        GameTooltip:SetPoint("TOPLEFT", self, "BOTTOMLEFT")
        GameTooltip:ClearLines()
        GameTooltip:AddLine(text8,0,1,0)
        if WGTime-time() > 0 then
            GameTooltip:AddLine("------------------------------------",1,1,0)
            GameTooltip:AddDoubleLine(tooltip1,h1.."h "..m1.."m "..s1.."s",1,1,0)
            GameTooltip:AddDoubleLine(tooltip2,h2.."h "..m2.."m "..s2.."s",1,1,0)
            GameTooltip:AddDoubleLine(tooltip7,h3..":"..m3,1,1,0)--Added by MikeNGo
            GameTooltip:AddLine("------------------------------------",1,1,0)
        end
        GameTooltip:AddDoubleLine(tooltip3,tooltip4)
        GameTooltip:AddDoubleLine(tooltip5,tooltip6)
        GameTooltip:Show()
    end,
    OnLeave = function()
        GameTooltip:Hide()
    end,
})

function ConvertSeconds(value)
    local hours = floor(value / 3600)
    local minutes = value - (hours * 3600)
    minutes = floor(minutes / 60)
    local seconds = floor(value - ((hours * 3600) + (minutes * 60)))
    if hours > 0 then return hours,minutes,seconds
    elseif minutes > 0 then return 0,minutes,seconds
    else return 0,0,seconds
    end
end

--Added by MikeNGo
function ConvertSecondsToHourMinute(value)
	value = tonumber(value)
	local _, currentHour, currentMinute =	GameTime_GetTime()
	local currentSecond = 0
	
	if GetCVar("timeMgrUseLocalTime") == 1 then
		currentHour = date"%H"
		currentMinute = date"%M"
		currentSecond = date"%S"
	else
		currentHour, currentMinute = GetGameTime()
		currentSecond = date"%S"
	end
	
	value = value + (currentSecond+(currentHour*3600)+(currentMinute*60))

    local hours = floor(value / 3600)
    local minutes = (hours * 3600) - value
    minutes = floor(minutes / 60)
    local seconds = floor( ((hours * 3600) + (minutes * 60)) - value )

	
  	minutes = math.abs(minutes)--Because it sometimes is negative, and the abs value is what we want

    if GetCVarBool("timeMgrUseMilitaryTime") then
    	for i=1, hours/24 do
			if hours > 24 then
				hours = hours - 24
			end
    	end
	else
		for i=1, hours/12 do
			if hours > 12 then
				hours = hours - 12
			end
		end
    end

    if hours > 0 then return hours,minutes,seconds
    elseif minutes > 0 then return 0,minutes,seconds
    else return 0,0,seconds
    end
end



local function broadcast(arg1)
    if IsInGuild() then SendAddonMessage("WGTime", arg1, "GUILD") end
    if UnitExists("party1") then SendAddonMessage("WGTime", arg1, "PARTY") end
    if UnitExists("raid1") then SendAddonMessage("WGTime", arg1, "RAID") end
end

local frame = CreateFrame("Frame")
frame:SetScript("OnUpdate", function(self, elap)
    timer = WGTime-time()
    elapsed = elapsed + elap
    if elapsed <= updateperiod then return end
        timer = timer - elapsed
        if timer > 0 then
            local hours,minutes,seconds = ConvertSeconds(timer)
            if hours > 0 then output = hours.."h "..minutes.."m"
            elseif minutes > 0 then output = minutes.."m "..seconds.."s"
            else output = seconds.."s"
            end
        else
            output = "N/A"
            WGTime = 0
        end
        
        --Added by MikeNGo
        if output == "15m 0s" or output == "5m 0s" then 
            print(text4..output) 
			if ( MikSBT and ( not ( MikSBT.IsModDisabled() ) ) ) then
				MikSBT.DisplayMessage(text4..output)
			else
				UIErrorsFrame:AddMessage(text4..output)
			end
			PlaySound'ReadyCheck'
		
        elseif output == "0s" then 
            print(text5)
			if ( MikSBT and ( not ( MikSBT.IsModDisabled() ) ) ) then
				MikSBT.DisplayMessage(text5)
			else
				UIErrorsFrame:AddMessage(text5)
			end
			PlaySound'ReadyCheck'

        end
        
        --Added by MikeNGo
        if output ~= "N/A" then
            local hours,minutes,seconds = ConvertSecondsToHourMinute(timer)--SecondsToTime(WGTime-time()))
            
        	output = hours..":"..minutes.." - "..output
        end
        
        WGTbroker.text = output
    elapsed = 0
end)

frame:RegisterEvent("GOSSIP_SHOW")
frame:RegisterEvent("CHAT_MSG_MONSTER_YELL")
frame:RegisterEvent("CHAT_MSG_ADDON")
frame:RegisterEvent("PLAYER_ENTERING_WORLD")
frame:RegisterEvent("UPDATE_WORLD_STATES")
frame:SetScript("OnEvent", function(self,event,...)
    if event == "GOSSIP_SHOW" then
        if (UnitName("target") == NPC1 or UnitName("target") == NPC2) and GetGossipText():match("%d:%d%d:%d%d") then 
            h,m,s = string.split(":",GetGossipText():match("%d:%d%d:%d%d"))
            timer = h*3600+m*60+s
            local fixedtime = floor(timer*TIMEFIX)
            WGTime = time() + fixedtime
            broadcast(fixedtime)
        elseif (UnitName("target") == NPC1 or UnitName("target") == NPC2) and not GetGossipText():match("%d:%d%d:%d%d") then
            WGTime = 0
        end
    elseif event == "CHAT_MSG_MONSTER_YELL" then
        local message,name = ...
        if name == NPC1 or name == NPC2 then
            if string.match(message,text1) then
                local fixedtime = floor(900*TIMEFIX)
                WGTime = time() + fixedtime
                broadcast(fixedtime)
            elseif string.match(message,text2) then
                local fixedtime = floor(300*TIMEFIX)
                WGTime = time() + fixedtime
                broadcast(fixedtime)
            end
        end
    elseif event == "CHAT_MSG_ADDON" then
        local prefix,message = ...
        if prefix == "WGTime" then
            if message == "timerequest" then
                if WGTime > 0 then broadcast(WGTime-time()) end
            else
                if WGTime == 0 then WGTime = (time() + message) end
            end
        end
    elseif event == "UPDATE_WORLD_STATES" then
        if AlwaysUpFrame2 and AlwaysUpFrame2:IsShown() and AlwaysUpFrame2Text:GetText():match(text7) and WGTime == 0 then
            local timeString = AlwaysUpFrame2Text:GetText():match("%d:%d%d:%d%d")
            if timeString then
                local h,m,s = string.split(":",timeString)
                local fixedtime = floor((h*3600+m*60+s)*TIMEFIX)
                WGTime = time() + fixedtime
                broadcast(fixedtime)
            end
        end
    else
        if WGTime == 0 then
            if IsInGuild() then SendAddonMessage("WGTime", "timerequest", "GUILD") end
            if UnitExists("party1") then SendAddonMessage("WGTime", "timerequest", "PARTY") end
            if UnitExists("raid1") then SendAddonMessage("WGTime", "timerequest", "RAID") end
        end
    end
end)
__________________
Currently contemplating coming back to Authorship.. been away for years. Please let me know you care, by commenting on what addon(s) of mine you want to see updated.

Author of Daily Bean Counter, MyNameTogglesWhenIAFKorDND, Extended Shutdown Warning, Auto Mail Director, Duel Nullify, Spec Transmiter, Say Again, Window Teller, Who Crafts, Ad Repeater, Privy Cork, Mac Backup, and more.
Report comment to moderator  
Reply With Quote
Post A Reply



Category Jump:

Support AddOn Development!

You have just downloaded by the author . If you like this AddOn why not consider supporting the author? This author has set up a donation account. Donations ensure that authors can continue to develop useful tools for everyone.