Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function StartMoving(self,button)
- if ( button ~= "LeftButton" ) then return end
- if ( ( not self.isLocked ) or ( self.isLocked == 0 ) ) then
- if ( self:IsMovable() ) then
- self:StartMoving();
- self.isMoving = true;
- self.hasMoved = false;
- end
- end
- end
- local function StopMoving(self,button)
- if ( button ~= "LeftButton" ) then return end
- if ( self.isMoving ) then
- self:StopMovingOrSizing();
- self.isMoving = false;
- self.hasMoved = true;
- end
- end
- local function On_Update()
- a,b,c,d,WaitTime,e = GetWorldPVPAreaInfo(2)
- WaitStringFormat()
- Time:SetText(WaitTimeMes)
- end
- function WaitStringFormat()
- if WaitTime >= 3600 then
- WaitTimeMes = string.format("%d:%02d:%02d", math.floor(WaitTime/3600),math.floor((WaitTime%3600)/60), math.floor(((WaitTime%3600)%60)))
- end
- if WaitTime < 3600 then
- if WaitTime >= 60 then
- WaitTimeMes = string.format("%02d:%02d", math.floor(WaitTime/60), math.floor(WaitTime%60))
- end
- end
- if WaitTime < 60 then
- WaitTimeMes = WaitTime
- end
- end
- local TBFrame = CreateFrame ("FRAME", "TBFrame", UIParent, nil)
- TBFrame:RegisterEvent("ADDON_LOADED")
- TBFrame:RegisterEvent("VARIABLES_LOADED")
- TBFrame:RegisterEvent("PLAYER_ENTERING_WORLD")
- TBFrame:RegisterEvent("PLAYER_LOGIN")
- TBFrame:SetWidth(130)
- TBFrame:SetHeight(30)
- TBFrame:SetPoint("CENTER", UIParent, "CENTER")
- TBFrame:SetBackdrop({bgFile = [[Interface\DialogFrame\UI-DialogBox-Background]],})
- TBFrame:Show(true)
- TBFrame:SetMovable(true)
- TBFrame:EnableMouse(true)
- TBFrame:SetScale(1.0, 1.0)
- TBFrame:SetAlpha(1)
- local Time = TBFrame:CreateFontString("Time", "OVERLAY", FontInstance)
- Time:SetPoint("RIGHT", TBFrame, "RIGHT", -5, 0)
- Time:SetFont("Fonts\\FRIZQT__.TTF", 20, nil)
- local TBTexture = TBFrame:CreateTexture("Faction Icon", "OVERLAY", nil)
- TBTexture:SetPoint("TOPLEFT", TBFrame, "TOPLEFT")
- local Ally = "Interface\\PVPFrame\\PVP-Currency-Alliance"
- local Horde = "Interface\\PVPFrame\\PVP-Currency-Horde"
- TBFrame:SetScript("OnMouseDown", StartMoving)
- TBFrame:SetScript("OnMouseUp", StopMoving)
- TBFrame:SetScript("OnEvent", function()
- SetMapByID(708)
- name, description, textureIndex, x, y = GetMapLandmarkInfo(1)
- if textureIndex == 46 then
- red = 0
- blue = 1
- green = 0
- Time:SetTextColor(red, green, blue)
- TBTexture:SetTexture(Ally)
- end
- if textureIndex == 48 then
- red = 1.0
- blue = 0
- green = 0
- Time:SetTextColor(red, green, blue)
- TBTexture:SetTexture(Horde)
- end
- _,_,_,_,WaitTime,_ = GetWorldPVPAreaInfo(2)
- TBTexture:SetTexture(Faction)
- end)
- TBFrame:SetScript("OnUpdate", On_Update)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement