Mercurial > wow > hansgar_and_franzok_assist
diff Hansgar_And_Franzok_Assist.lua @ 5:789bf9e40966
Version v0.6 change log:
- new command /hansgar users: show who is using the addon in the raid.
- new command /hansgar lock: lock or unlock the frame.
- new command /hansgar dance: toggle the dance bar.
- fixed the cooldown animation.
| author | Tercio |
|---|---|
| date | Thu, 05 Mar 2015 16:30:25 -0300 |
| parents | 1c3534391efb |
| children | 3121ac72fcda |
line wrap: on
line diff
--- a/Hansgar_And_Franzok_Assist.lua Mon Mar 02 21:28:33 2015 -0300 +++ b/Hansgar_And_Franzok_Assist.lua Thu Mar 05 16:30:25 2015 -0300 @@ -8,6 +8,7 @@ local f = CreateFrame ("frame", "Hansgar_And_Franzok_Assist", UIParent) f:SetFrameStrata ("DIALOG") +f.version = "v0.6" local tframe = CreateFrame ("frame", "Hansgar_And_Franzok_Assist_PTrack", UIParent) @@ -19,6 +20,7 @@ f:SetBackdropBorderColor (0, 0, 0, 1) f:SetMovable (true) f:EnableMouse (true) +f.all_blocks = {} f:Hide() local title = f:CreateFontString (nil, "overlay", "GameFontNormal") @@ -105,6 +107,58 @@ local AceComm = LibStub:GetLibrary ("AceComm-3.0") AceComm:Embed (f) +function f:CommReceived (_, data, _, source) + if (data == "US") then + f:SendCommMessage ("HAFR", UnitName ("player") .. " " .. f.version, "RAID") + else + f.users [data] = true + end +end +function f:ShowUsers() + f.users_schedule = nil + + local users_frame = Hansgar_And_Franzok_Assist_UsersPanel + if (not users_frame) then + users_frame = CreateFrame ("frame", "Hansgar_And_Franzok_Assist_UsersPanel", UIParent) + users_frame:SetBackdrop ({bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", tile = true, tileSize = 16, insets = {left = -1, right = -1, top = -1, bottom = -1}, + edgeFile = "Interface\\AddOns\\Hansgar_And_Franzok_Assist\\border_2", edgeSize = 8}) + users_frame:SetBackdropColor (0, 0, 0, 1) + tinsert (UISpecialFrames, "Hansgar_And_Franzok_Assist_UsersPanel") + users_frame:SetSize (200, 500) + users_frame:SetPoint ("right", f, "left", -15, 0) + users_frame.text = users_frame:CreateFontString (nil, "overlay", "GameFontHighlight") + users_frame.text:SetPoint ("topleft", users_frame, "topleft", 10, -10) + users_frame.text:SetJustifyH ("left") + + users_frame.title = users_frame:CreateFontString (nil, "overlay", "GameFontNormal") + users_frame.title:SetText ("Hansgar & Franzok Assist: Users") + users_frame.title:SetPoint ("center", users_frame, "center") + users_frame.title:SetPoint ("bottom", users_frame, "top", 0, 2) + + end + + local s = "" + + for key, value in pairs (f.users) do + s = s .. "|cFF33FF33" .. key .. "\n" + end + + s = s .. "|r\n\n\n|cFFFFFFFFOut of Date or Not installed:|r\n\n" + + for i = 1, GetNumGroupMembers() do + local name = UnitName ("raid" .. i) + if (not s:find (name)) then + s = s .. "|cFFFF3333" .. name .. "|r\n" + end + end + + users_frame.text:SetText (s) + + users_frame:Show() + +end +f:RegisterComm ("HAFR", "CommReceived") + local db f.block_tracker = {} @@ -128,13 +182,28 @@ if (db.SHOW_DANCE == nil) then db.SHOW_DANCE = true end + if (db.FRAME_LOCK == nil) then + db.FRAME_LOCK = false + end -- SLASH_Hansgar_And_Franzok_Assist1, SLASH_Hansgar_And_Franzok_Assist2 = "/hansgar", "/franzok" function SlashCmdList.Hansgar_And_Franzok_Assist (msg, editbox) local command, rest = msg:match ("^(%S*)%s*(.-)$") - if (command == "delay") then + if (command == "users") then + if (f.users_schedule) then + print ("|cFFFFAA00Hansgar and Franzok Assist|r please wait 5 seconds...") + elseif (IsInRaid()) then + f.users = {} + f:SendCommMessage ("HAFR", "US", "RAID") + f.users_schedule = f:ScheduleTimer ("ShowUsers", 5) + print ("|cFFFFAA00Hansgar and Franzok Assist|r please wait 5 seconds...") + else + print ("|cFFFFAA00Hansgar and Franzok Assist|r you aren't in a raid group.") + end + + elseif (command == "delay") then local t = tonumber (rest) if (t) then db.STAMPERS_DELAY = t @@ -158,6 +227,15 @@ end f:EndTrackPlayerPosition() + elseif (command == "lock") then + f:SetLockState() + + if (db.FRAME_LOCK) then + print ("|cFFFFAA00Hansgar and Franzok Assist|r frame locked.") + else + print ("|cFFFFAA00Hansgar and Franzok Assist|r frame unlocked.") + end + elseif (command == "dance") then db.SHOW_DANCE = not db.SHOW_DANCE if (db.SHOW_DANCE) then @@ -175,13 +253,13 @@ f:RefreshCooldownSettings() else - print ("|cFFFFAA00Hansgar and Franzok Assist|r |cFF00FF00v0.5|r Commands:") + print ("|cFFFFAA00Hansgar and Franzok Assist|r |cFF00FF00" .. f.version .. "|r Commands:") + print ("|cFFFFFF00/hansgar lock|r: toggle lock and unlock on the frame.") + print ("|cFFFFFF00/hansgar test show hide|r: active the addon on test mode or hide it.") print ("|cFFFFFF00/hansgar delay <time>|r: time in seconds until the percentage goes from 0 to 100.") - print ("|cFFFFFF00/hansgar cooldown|r: show the countdown for each stamper go back up to the ceiling.") - --print ("|cFFFFFF00/hansgar dance|r: toggle dance bar (used to dodge regular stampers and searing plates).") - print ("|cFFFFFF00/hansgar test|r: active the addon on test mode.") - print ("|cFFFFFF00/hansgar show|r: show the window and start test mode.") - print ("|cFFFFFF00/hansgar hide|r: hide the window.") + print ("|cFFFFFF00/hansgar dance|r: toggle dance bar (used to dodge regular stampers and searing plates).") + print ("|cFFFFFF00/hansgar users|r: show who is using the addon in the raid.") + print ("|cFFFFFF00/hansgar cooldown|r: show the countdown text for each stamper go back up to the ceiling.") end end @@ -238,9 +316,13 @@ if (token == "SPELL_AURA_APPLIED" and spellid == 162124 and not f.StampersPhase) then f:StartTracking() + f:EndTrackPlayerPosition() elseif (token == "SPELL_AURA_REMOVED" and spellid == 162124 and f.StampersPhase) then f:StopTracking() + if (db.SHOW_DANCE) then + f:StartTrackPlayerPosition() + end end @@ -307,7 +389,6 @@ end function f:StopTracking() - print ("|cFFFFAA00Hansgar and Franzok Assist|r: Smart Stampers phase ended.") f.StampersPhase = false @@ -318,7 +399,7 @@ end local on_mouse_down = function (self) - if (not self.isMoving) then + if (not self.isMoving and not db.FRAME_LOCK) then self.isMoving = true f:StartMoving() end @@ -350,6 +431,7 @@ self:SetScript ("OnUpdate", nil) self.stamper_icon:Show() self.number:Hide() + self.cooldown:Show() self.cooldown:SetCooldown (GetTime(), 37 - db.STAMPERS_DELAY, 0, 0) end end @@ -374,6 +456,7 @@ block.number:Show() block.stamper_icon:Hide() block.cooldown:SetCooldown (0, 0, 0, 0) + block.cooldown:Hide() f.block_tracker [block.id] = nil if (block.unpaint_process) then @@ -400,6 +483,23 @@ end end +function f:SetLockState() + db.FRAME_LOCK = not db.FRAME_LOCK + if (db.FRAME_LOCK) then + --locked + f:EnableMouse (false) + for _, block in ipairs (f.all_blocks) do + block:EnableMouse (false) + end + else + --unlocked + f:EnableMouse (true) + for _, block in ipairs (f.all_blocks) do + block:EnableMouse (true) + end + end +end + function f:CreateWindow() local x = 0 local y = 0 @@ -461,6 +561,8 @@ end + f:SetLockState() + f.frames_built = true end @@ -562,9 +664,9 @@ function f:StartTrackPlayerPosition() --> under development - if (true) then - return - end + --if (true) then + -- return + --end player_pos_frame:Show() tframe.width = player_pos_frame:GetWidth()
