Tercio@0: local floor = floor Tercio@0: local min = min Tercio@0: local UnitExists = UnitExists Tercio@0: local GetPlayerMapPosition = GetPlayerMapPosition Tercio@0: local UnitHealth = UnitHealth Tercio@4: local GetNumGroupMembers = GetNumGroupMembers Tercio@4: local abs = abs Tercio@0: Tercio@0: local f = CreateFrame ("frame", "Hansgar_And_Franzok_Assist", UIParent) Tercio@0: f:SetFrameStrata ("DIALOG") Tercio@5: f.version = "v0.6" Tercio@0: Tercio@4: local tframe = CreateFrame ("frame", "Hansgar_And_Franzok_Assist_PTrack", UIParent) Tercio@4: Tercio@0: f:SetSize (155, 156) Tercio@0: f:SetBackdrop ({bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", tile = true, tileSize = 16, insets = {left = -1, right = -1, top = -1, bottom = -1}, Tercio@0: edgeFile = "Interface\\AddOns\\Hansgar_And_Franzok_Assist\\border_2", edgeSize = 8}) Tercio@0: f:SetPoint ("center", UIParent, "center") Tercio@0: f:SetBackdropColor (0, 0, 0, 0) Tercio@0: f:SetBackdropBorderColor (0, 0, 0, 1) Tercio@0: f:SetMovable (true) Tercio@0: f:EnableMouse (true) Tercio@5: f.all_blocks = {} Tercio@0: f:Hide() Tercio@0: Tercio@0: local title = f:CreateFontString (nil, "overlay", "GameFontNormal") Tercio@0: title:SetText ("Hansgar & Franzok Assist") Tercio@0: title:SetPoint ("center", f, "center") Tercio@0: title:SetPoint ("bottom", f, "top", 0, 2) Tercio@0: Tercio@0: -- Tercio@0: local frame_event = CreateFrame ("frame", "Hansgar_And_Franzok_AssistEvents", f) Tercio@0: frame_event:RegisterEvent ("ENCOUNTER_START") Tercio@0: frame_event:RegisterEvent ("ENCOUNTER_END") Tercio@0: frame_event:RegisterEvent ("ADDON_LOADED") Tercio@0: Tercio@0: -- Tercio@0: local player_bar = CreateFrame ("statusbar", "Hansgar_And_Franzok_AssistPlayerBar", f) Tercio@0: player_bar:SetPoint ("topleft", f, "bottomleft", 0, -3) Tercio@0: player_bar:SetPoint ("topright", f, "bottomright", 0, -3) Tercio@0: player_bar:SetHeight (14) Tercio@0: player_bar:SetStatusBarColor (0, 0, 0, 0) Tercio@0: player_bar:SetMinMaxValues (0, 100) Tercio@0: player_bar:SetValue (0) Tercio@0: f.player_bar = player_bar Tercio@0: Tercio@0: player_bar.texture = player_bar:CreateTexture (nil, "overlay") Tercio@0: player_bar.texture:SetTexture ("Interface\\AddOns\\Hansgar_And_Franzok_Assist\\bar_skyline") Tercio@0: player_bar:SetStatusBarTexture (player_bar.texture) Tercio@0: Tercio@0: -- Tercio@0: Tercio@4: local player_pos_frame = CreateFrame ("frame", "Hansgar_And_Franzok_Assist_DanceBar", UIParent) Tercio@4: player_pos_frame:SetPoint ("topleft", player_bar, "bottomleft", 0, -3) Tercio@4: player_pos_frame:SetPoint ("topright", player_bar, "bottomright", 0, -3) Tercio@4: player_pos_frame:SetHeight (14) Tercio@4: player_pos_frame:SetBackdrop ({bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", tile = true, tileSize = 16, insets = {left = -1, right = -1, top = -1, bottom = -1}, Tercio@4: edgeFile = "Interface\\AddOns\\Hansgar_And_Franzok_Assist\\border_2", edgeSize = 8}) Tercio@4: player_pos_frame:SetBackdropColor (0, 0, 0, 1) Tercio@4: player_pos_frame:Hide() Tercio@4: Tercio@4: --red Tercio@4: local t1 = player_pos_frame:CreateTexture (nil, "artwork") Tercio@4: t1:SetPoint ("left", player_pos_frame, "left") Tercio@4: t1:SetSize (player_pos_frame:GetWidth()*0.30, 14) Tercio@4: t1:SetTexture (1, 1, 1) Tercio@4: --t1:SetTexCoord (260/512, 430/512, 29/256, 82/256) Tercio@4: t1:SetVertexColor (1, 0.2, 0.2, 0.4) Tercio@4: Tercio@4: --green Tercio@4: local t2 = player_pos_frame:CreateTexture (nil, "artwork") Tercio@4: t2:SetPoint ("left", t1, "right") Tercio@4: t2:SetSize (player_pos_frame:GetWidth()*0.15, 14) Tercio@4: t2:SetTexture (0.2, 1, 0.2, 0.4) Tercio@4: Tercio@4: --red Tercio@4: local middle = player_pos_frame:CreateTexture (nil, "artwork") Tercio@4: middle:SetPoint ("left", t2, "right") Tercio@4: middle:SetSize (player_pos_frame:GetWidth()*0.10, 14) Tercio@4: middle:SetTexture (1, 1, 1) Tercio@4: --middle:SetTexCoord (260/512, 430/512, 29/256, 82/256) Tercio@4: middle:SetVertexColor (1, 0.2, 0.2, 0.4) Tercio@4: Tercio@4: --green Tercio@4: local t3 = player_pos_frame:CreateTexture (nil, "artwork") Tercio@4: t3:SetPoint ("left", middle, "right") Tercio@4: t3:SetSize (player_pos_frame:GetWidth()*0.15, 14) Tercio@4: t3:SetTexture (0.2, 1, 0.2, 0.4) Tercio@4: Tercio@4: --red Tercio@4: local t4 = player_pos_frame:CreateTexture (nil, "artwork") Tercio@4: t4:SetPoint ("left", t3, "right") Tercio@4: t4:SetSize (player_pos_frame:GetWidth()*0.30, 14) Tercio@4: t4:SetTexture (1, 1, 1) Tercio@4: --t4:SetTexCoord (260/512, 430/512, 29/256, 82/256) Tercio@4: t4:SetVertexColor (1, 0.2, 0.2, 0.4) Tercio@4: Tercio@4: local div = player_pos_frame:CreateTexture (nil, "overlay") Tercio@4: div:SetPoint ("left", player_pos_frame, "left", 0, 0) Tercio@4: div:SetTexture (1, 1, 1, 1) Tercio@4: div:SetSize (1, 16) Tercio@4: div:Hide() Tercio@4: -- Tercio@4: Tercio@4: local AceTimer = LibStub:GetLibrary ("AceTimer-3.0") Tercio@4: AceTimer:Embed (f) Tercio@4: local AceComm = LibStub:GetLibrary ("AceComm-3.0") Tercio@4: AceComm:Embed (f) Tercio@4: Tercio@5: function f:CommReceived (_, data, _, source) Tercio@5: if (data == "US") then Tercio@5: f:SendCommMessage ("HAFR", UnitName ("player") .. " " .. f.version, "RAID") Tercio@5: else Tercio@5: f.users [data] = true Tercio@5: end Tercio@5: end Tercio@5: function f:ShowUsers() Tercio@5: f.users_schedule = nil Tercio@5: Tercio@5: local users_frame = Hansgar_And_Franzok_Assist_UsersPanel Tercio@5: if (not users_frame) then Tercio@5: users_frame = CreateFrame ("frame", "Hansgar_And_Franzok_Assist_UsersPanel", UIParent) Tercio@5: users_frame:SetBackdrop ({bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", tile = true, tileSize = 16, insets = {left = -1, right = -1, top = -1, bottom = -1}, Tercio@5: edgeFile = "Interface\\AddOns\\Hansgar_And_Franzok_Assist\\border_2", edgeSize = 8}) Tercio@5: users_frame:SetBackdropColor (0, 0, 0, 1) Tercio@5: tinsert (UISpecialFrames, "Hansgar_And_Franzok_Assist_UsersPanel") Tercio@5: users_frame:SetSize (200, 500) Tercio@5: users_frame:SetPoint ("right", f, "left", -15, 0) Tercio@5: users_frame.text = users_frame:CreateFontString (nil, "overlay", "GameFontHighlight") Tercio@5: users_frame.text:SetPoint ("topleft", users_frame, "topleft", 10, -10) Tercio@5: users_frame.text:SetJustifyH ("left") Tercio@5: Tercio@5: users_frame.title = users_frame:CreateFontString (nil, "overlay", "GameFontNormal") Tercio@5: users_frame.title:SetText ("Hansgar & Franzok Assist: Users") Tercio@5: users_frame.title:SetPoint ("center", users_frame, "center") Tercio@5: users_frame.title:SetPoint ("bottom", users_frame, "top", 0, 2) Tercio@5: Tercio@5: end Tercio@5: Tercio@5: local s = "" Tercio@5: Tercio@5: for key, value in pairs (f.users) do Tercio@5: s = s .. "|cFF33FF33" .. key .. "\n" Tercio@5: end Tercio@5: Tercio@5: s = s .. "|r\n\n\n|cFFFFFFFFOut of Date or Not installed:|r\n\n" Tercio@5: Tercio@5: for i = 1, GetNumGroupMembers() do Tercio@5: local name = UnitName ("raid" .. i) Tercio@5: if (not s:find (name)) then Tercio@5: s = s .. "|cFFFF3333" .. name .. "|r\n" Tercio@5: end Tercio@5: end Tercio@5: Tercio@5: users_frame.text:SetText (s) Tercio@5: Tercio@5: users_frame:Show() Tercio@5: Tercio@5: end Tercio@5: f:RegisterComm ("HAFR", "CommReceived") Tercio@5: Tercio@0: local db Tercio@0: Tercio@4: f.block_tracker = {} Tercio@4: Tercio@0: frame_event:SetFrameStrata ("FULLSCREEN") Tercio@0: Tercio@0: frame_event:SetScript ("OnEvent", function (self, event, ...) Tercio@0: Tercio@0: if (event == "ADDON_LOADED" and select (1, ...) == "Hansgar_And_Franzok_Assist") then Tercio@0: Tercio@0: db = Hansgar_And_Franzok_DB Tercio@0: if (not db) then Tercio@0: db = {} Tercio@0: Hansgar_And_Franzok_DB = db Tercio@0: end Tercio@4: -- Tercio@0: db.STAMPERS_DELAY = db.STAMPERS_DELAY or 5 Tercio@4: if (db.CD_NUMBER == nil) then Tercio@4: db.CD_NUMBER = false Tercio@4: end Tercio@4: if (db.SHOW_DANCE == nil) then Tercio@4: db.SHOW_DANCE = true Tercio@4: end Tercio@5: if (db.FRAME_LOCK == nil) then Tercio@5: db.FRAME_LOCK = false Tercio@5: end Tercio@4: -- Tercio@0: SLASH_Hansgar_And_Franzok_Assist1, SLASH_Hansgar_And_Franzok_Assist2 = "/hansgar", "/franzok" Tercio@0: function SlashCmdList.Hansgar_And_Franzok_Assist (msg, editbox) Tercio@0: Tercio@0: local command, rest = msg:match ("^(%S*)%s*(.-)$") Tercio@0: Tercio@5: if (command == "users") then Tercio@5: if (f.users_schedule) then Tercio@5: print ("|cFFFFAA00Hansgar and Franzok Assist|r please wait 5 seconds...") Tercio@5: elseif (IsInRaid()) then Tercio@5: f.users = {} Tercio@5: f:SendCommMessage ("HAFR", "US", "RAID") Tercio@5: f.users_schedule = f:ScheduleTimer ("ShowUsers", 5) Tercio@5: print ("|cFFFFAA00Hansgar and Franzok Assist|r please wait 5 seconds...") Tercio@5: else Tercio@5: print ("|cFFFFAA00Hansgar and Franzok Assist|r you aren't in a raid group.") Tercio@5: end Tercio@5: Tercio@5: elseif (command == "delay") then Tercio@0: local t = tonumber (rest) Tercio@0: if (t) then Tercio@0: db.STAMPERS_DELAY = t Tercio@0: print ("|cFFFFAA00Hansgar and Franzok Assist|r delay set to: ", t) Tercio@0: else Tercio@0: print ("|cFFFFAA00Hansgar and Franzok Assist|r invalid time.", t) Tercio@0: end Tercio@0: Tercio@0: elseif (command == "test" or command == "show") then Tercio@0: if (f.StampersPhase) then Tercio@4: f:EndTrackPlayerPosition() Tercio@0: return f:StopTracking() Tercio@0: end Tercio@4: Tercio@0: f:StartTracking() Tercio@4: f:StartTrackPlayerPosition() Tercio@0: Tercio@0: elseif (command == "hide") then Tercio@0: if (f.StampersPhase) then Tercio@0: return f:StopTracking() Tercio@0: end Tercio@4: f:EndTrackPlayerPosition() Tercio@0: Tercio@5: elseif (command == "lock") then Tercio@5: f:SetLockState() Tercio@5: Tercio@5: if (db.FRAME_LOCK) then Tercio@5: print ("|cFFFFAA00Hansgar and Franzok Assist|r frame locked.") Tercio@5: else Tercio@5: print ("|cFFFFAA00Hansgar and Franzok Assist|r frame unlocked.") Tercio@5: end Tercio@5: Tercio@4: elseif (command == "dance") then Tercio@4: db.SHOW_DANCE = not db.SHOW_DANCE Tercio@4: if (db.SHOW_DANCE) then Tercio@4: if (f.on_encounter) then Tercio@4: f:StartTrackPlayerPosition() Tercio@4: end Tercio@4: print ("|cFFFFAA00Hansgar and Franzok Assist|r dance bars enabled.") Tercio@4: else Tercio@4: f:EndTrackPlayerPosition() Tercio@4: print ("|cFFFFAA00Hansgar and Franzok Assist|r dance bars disabled.") Tercio@4: end Tercio@4: Tercio@4: elseif (command == "cooldown") then Tercio@4: db.CD_NUMBER = not db.CD_NUMBER Tercio@4: f:RefreshCooldownSettings() Tercio@4: Tercio@0: else Tercio@5: print ("|cFFFFAA00Hansgar and Franzok Assist|r |cFF00FF00" .. f.version .. "|r Commands:") Tercio@5: print ("|cFFFFFF00/hansgar lock|r: toggle lock and unlock on the frame.") Tercio@5: print ("|cFFFFFF00/hansgar test show hide|r: active the addon on test mode or hide it.") Tercio@0: print ("|cFFFFFF00/hansgar delay