local DF = _G ["DetailsFramework"] if (not DF) then print ("|cFFFFAA00Please restart your client to finish update some AddOns.|c") return end local floor = floor local min = min local UnitExists = UnitExists local GetPlayerMapPosition = GetPlayerMapPosition local UnitHealth = UnitHealth local GetNumGroupMembers = GetNumGroupMembers local abs = abs local GetPlayerFacing = GetPlayerFacing local db local _ local f = DF:Create1PxPanel (_, 155, 166, "Hans & Franz Assist", "Hansgar_And_Franzok_Assist", nil, "top", true) f:SetFrameStrata ("LOW") f.version = "v0.18a" f.Close:SetScript ("OnClick", function (self) if (f.StampersPhase) then return f:StopTracking() end f:EndTrackPlayerPosition() end) f.Lock:SetScript ("OnClick", function (self) if (db.FRAME_LOCK) then f:SetLockState() print ("|cFFFFAA00Hansgar and Franzok Assist|r frame unlocked.") f.unlocked_frame = true f.player_pos_frame:Show() f.player_bar:Show() f.stop_casting_frame:Show() else f:SetLockState() print ("|cFFFFAA00Hansgar and Franzok Assist|r frame locked.") f.unlocked_frame = false f.stop_casting_frame:Hide() end end) local tframe = CreateFrame ("frame", "Hansgar_And_Franzok_Assist_PTrack", UIParent) f:SetSize (155, 159) f: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}) f:SetPoint ("center", UIParent, "center", 300, 200) f:SetBackdropColor (0, 0, 0, 0) f:SetBackdropBorderColor (0, 0, 0, 1) f:SetMovable (true) f:EnableMouse (true) f.all_blocks = {} f:Hide() -- local frame_event = CreateFrame ("frame", "Hansgar_And_Franzok_AssistEvents", f) frame_event:RegisterEvent ("ENCOUNTER_START") frame_event:RegisterEvent ("ENCOUNTER_END") frame_event:RegisterEvent ("ADDON_LOADED") -- local player_bar = CreateFrame ("statusbar", "Hansgar_And_Franzok_PlayerAssistBar", UIParent) player_bar:SetPoint ("center", UIParent, "center", 0, 300) player_bar:SetSize (280, 16) player_bar:SetMovable (true) player_bar:EnableMouse (true) player_bar:SetResizable (true) player_bar:SetStatusBarColor (0, 0, 0, 0) player_bar:SetMinMaxValues (0, 100) player_bar:SetValue (0) player_bar:SetMinResize (50, 15) player_bar:SetMaxResize (500, 40) player_bar:Hide() local player_bar_backgroud = player_bar:CreateTexture (nil, "background") player_bar_backgroud:SetTexture (0, 0, 0, 0.2) player_bar_backgroud:SetAllPoints() local icon = player_bar:CreateTexture (nil, "overlay") icon:SetTexture ([[Interface\HELPFRAME\ReportLagIcon-Movement]]) icon:SetPoint ("left", player_bar, "left") icon:SetDesaturated (true) player_bar.icon = icon local text = player_bar:CreateFontString (nil, "overlay", "GameFontNormal") text:SetPoint ("right", player_bar, "right", -2, 0) player_bar.text = text player_bar:SetScript ("OnMouseDown", function (self) if (not self.isMoving) then self:StartMoving() self.isMoving = true end end) player_bar:SetScript ("OnMouseUp", function (self) if (self.isMoving) then self:StopMovingOrSizing() self.isMoving = false end end) player_bar:SetScript ("OnSizeChanged", function (self) self.icon:SetSize (self:GetHeight(), self:GetHeight()) end) local grip = CreateFrame ("button", "Hansgar_And_Franzok_AssistPlayerBarButton", player_bar) grip:SetPoint ("bottomright", player_bar, "bottomright") grip:SetSize (16, 16) grip:SetScript ("OnMouseDown", function (self, button) if (not player_bar.isMoving and button == "LeftButton") then player_bar:StartSizing ("bottomright") player_bar.isMoving = true end end) grip:SetScript ("OnMouseUp", function (self, button) if (player_bar.isMoving and button == "LeftButton") then player_bar:StopMovingOrSizing() player_bar.isMoving = false end end) grip:SetNormalTexture ([[Interface\CHATFRAME\UI-ChatIM-SizeGrabber-Up]]) grip:SetHighlightTexture ([[Interface\CHATFRAME\UI-ChatIM-SizeGrabber-Highlight]]) grip:SetPushedTexture ([[Interface\CHATFRAME\UI-ChatIM-SizeGrabber-Down]]) player_bar.grip = grip f.player_bar = player_bar player_bar.texture = player_bar:CreateTexture (nil, "overlay") player_bar.texture:SetTexture ("Interface\\AddOns\\Hansgar_And_Franzok_Assist\\bar_skyline") player_bar:SetStatusBarTexture (player_bar.texture) -- local player_pos_frame = CreateFrame ("frame", "Hansgar_And_Franzok_Assist_BarDance", UIParent) local player_pos_frame2 = CreateFrame ("frame", "Hansgar_And_Franzok_Assist_BarDance2", UIParent) player_pos_frame:SetPoint ("center", UIParent, "center", 0, -75) player_pos_frame2:SetPoint ("bottomleft", player_pos_frame, "bottomleft") player_pos_frame2:SetSize (6, 155) player_pos_frame:SetSize (155, 6) local player_pos_frame_backdrop = {bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", tile = true, tileSize = 16, insets = {left = -1, right = -1, top = -1, bottom = -1}} player_pos_frame:SetBackdrop (player_pos_frame_backdrop) player_pos_frame2:SetBackdrop (player_pos_frame_backdrop) player_pos_frame:SetBackdropColor (0, 0, 0, 1) player_pos_frame2:SetBackdropColor (0, 0, 0, 1) player_pos_frame2:Hide() player_pos_frame:SetMovable (true) player_pos_frame:EnableMouse (true) player_pos_frame:SetScript ("OnMouseDown", function (self) if (not self.isMoving) then self:StartMoving() self.isMoving = true end end) player_pos_frame:SetScript ("OnMouseUp", function (self) if (self.isMoving) then self:StopMovingOrSizing() self.isMoving = false end end) player_pos_frame:Hide() f.player_pos_frame = player_pos_frame --red local t1 = player_pos_frame:CreateTexture (nil, "artwork") t1:SetPoint ("left", player_pos_frame, "left") t1:SetSize (player_pos_frame:GetWidth()*0.30, 6) t1:SetTexture (1, 1, 1) t1:SetVertexColor (1, 0.2, 0.2, 0.4) --green local t2 = player_pos_frame:CreateTexture (nil, "artwork") t2:SetPoint ("left", t1, "right") t2:SetSize (player_pos_frame:GetWidth()*0.15, 6) t2:SetTexture (0.2, 1, 0.2, 0.4) --red local middle = player_pos_frame:CreateTexture (nil, "artwork") middle:SetPoint ("left", t2, "right") middle:SetSize (player_pos_frame:GetWidth()*0.10, 6) middle:SetTexture (1, 1, 1) middle:SetVertexColor (1, 0.2, 0.2, 0.4) --green local t3 = player_pos_frame:CreateTexture (nil, "artwork") t3:SetPoint ("left", middle, "right") t3:SetSize (player_pos_frame:GetWidth()*0.15, 6) t3:SetTexture (0.2, 1, 0.2, 0.4) --red local t4 = player_pos_frame:CreateTexture (nil, "artwork") t4:SetPoint ("left", t3, "right") t4:SetSize (player_pos_frame:GetWidth()*0.30, 6) t4:SetTexture (1, 1, 1) t4:SetVertexColor (1, 0.2, 0.2, 0.4) --red local t1_2 = player_pos_frame:CreateTexture (nil, "artwork") t1_2:SetPoint ("bottomleft", player_pos_frame, "bottomleft") t1_2:SetSize (6, player_pos_frame:GetWidth()*0.30) t1_2:SetTexture (1, 1, 1) t1_2:SetVertexColor (1, 0.2, 0.2, 0.4) --green local t2_2 = player_pos_frame:CreateTexture (nil, "artwork") t2_2:SetPoint ("bottom", t1_2, "top") t2_2:SetSize (6, player_pos_frame:GetWidth()*0.15) t2_2:SetTexture (0.2, 1, 0.2, 0.4) --red local middle_2 = player_pos_frame:CreateTexture (nil, "artwork") middle_2:SetPoint ("bottom", t2_2, "top") middle_2:SetSize (6, player_pos_frame:GetWidth()*0.10) middle_2:SetTexture (1, 1, 1) middle_2:SetVertexColor (1, 0.2, 0.2, 0.4) --green local t3_2 = player_pos_frame:CreateTexture (nil, "artwork") t3_2:SetPoint ("bottom", middle_2, "top") t3_2:SetSize (6, player_pos_frame:GetWidth()*0.15) t3_2:SetTexture (0.2, 1, 0.2, 0.4) --red local t4_2 = player_pos_frame:CreateTexture (nil, "artwork") t4_2:SetPoint ("bottom", t3_2, "top") t4_2:SetSize (6, player_pos_frame:GetWidth()*0.30) t4_2:SetTexture (1, 1, 1) t4_2:SetVertexColor (1, 0.2, 0.2, 0.4) t1_2:Hide() t2_2:Hide() t3_2:Hide() t4_2:Hide() middle_2:Hide() local div = player_pos_frame:CreateTexture (nil, "overlay") div:SetPoint ("left", player_pos_frame, "left", 0, 0) div:SetTexture (1, 1, 1, 1) div:SetSize (1, 16) div:Hide() -- local AceTimer = LibStub:GetLibrary ("AceTimer-3.0") AceTimer:Embed (f) local AceComm = LibStub:GetLibrary ("AceComm-3.0") AceComm:Embed (f) function f:CommReceived (_, data, _, source) if (data == "US") then f:SendCommMessage ("HAFR", (UnitName ("player") or "") .. " " .. f.version, "RAID") elseif (f.users) then f.users [data] = true end end function f:ShowUsers() 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) local close = CreateFrame ("button", "Hansgar_And_Franzok_Assist_UsersPanel_CloseButton", users_frame, "UIPanelCloseButton") close:SetPoint ("topright", users_frame, "topright") users_frame.close_button = close 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() f.users = nil f.users_schedule = nil end f:RegisterComm ("HAFR", "CommReceived") f.block_tracker = {} frame_event:SetFrameStrata ("FULLSCREEN") frame_event:SetScript ("OnEvent", function (self, event, ...) if (event == "ADDON_LOADED" and select (1, ...) == "Hansgar_And_Franzok_Assist") then db = Hansgar_And_Franzok_DB if (not db) then db = {} Hansgar_And_Franzok_DB = db end -- db.STAMPERS_DELAY = db.STAMPERS_DELAY or 5 if (db.CD_NUMBER == nil) then db.CD_NUMBER = false end if (db.SHOW_DANCE == nil) then db.SHOW_DANCE = true end if (db.FRAME_LOCK == nil) then db.FRAME_LOCK = false end if (db.AUTO_FACING == nil) then db.AUTO_FACING = true end if (db.FACING_SIDE == nil) then db.FACING_SIDE = 1 end if (db.SHOW_MAIN_FRAME == nil) then db.SHOW_MAIN_FRAME = true end if (db.PLAY_SOUND == nil) then db.PLAY_SOUND = false end if (db.STOP_CAST == nil) then db.STOP_CAST = true end if (db.NO_VERTICAL == nil) then db.NO_VERTICAL = false end if (db.DANCE_SIZE == nil) then db.DANCE_SIZE = 8 end -- f:SetLockState (true) elseif (event == "ENCOUNTER_START" or event == "ENCOUNTER_END") then local encounterID, encounterName, difficultyID, raidSize = select (1, ...) if (encounterID == 1693) then if (f.unlocked_frame) then f.unlocked_frame = false end if (event == "ENCOUNTER_START") then f.on_encounter = true f:RegisterEvent ("COMBAT_LOG_EVENT_UNFILTERED") elseif (event == "ENCOUNTER_END") then f.on_encounter = false f:UnregisterEvent ("COMBAT_LOG_EVENT_UNFILTERED") end end if (encounterID == 1693 and db.SHOW_DANCE) then if (event == "ENCOUNTER_START") then SetMapToCurrentZone() f:StartTrackPlayerPosition() elseif (event == "ENCOUNTER_END") then f:EndTrackPlayerPosition() end end if (encounterID == 1693 and difficultyID == 16) then if (event == "ENCOUNTER_START") then --print ("|cFFFFAA00Hansgar and Franzok Assist|r: addon enabled, good look!") if (f.StampersPhase) then f:StopTracking() end elseif (event == "ENCOUNTER_END") then if (f.StampersPhase) then f:StopTracking() end f:EndTrackPlayerPosition() end end end 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 == "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 == "st") then f.stop_casting_frame:Show() f.stop_casting_frame.alert.animOut:Stop() f.stop_casting_frame.alert.animIn:Play() f:ScheduleTimer ("HideStopSpellAlert", 1.2) elseif (command == "stopcast") then db.STOP_CAST = not db.STOP_CAST if (db.STOP_CAST) then print ("|cFFFFAA00Hansgar and Franzok Assist|r stop cast alert enabled.") else print ("|cFFFFAA00Hansgar and Franzok Assist|r stop cast alert disabled.") end elseif (command == "resetpos") then f:ClearAllPoints() f:SetPoint ("center", UIParent, "center") player_bar:ClearAllPoints() player_bar:SetPoint ("center", UIParent, "center") player_pos_frame:ClearAllPoints() player_pos_frame:SetPoint ("center", UIParent, "center") if (f.StampersPhase) then f:EndTrackPlayerPosition() f:StopTracking() end db.FRAME_LOCK = true f:SetLockState() f.unlocked_frame = true f:StartTracking() f:StartTrackPlayerPosition() print ("|cFFFFAA00Hansgar and Franzok Assist|r: position reseted.") print ("|cFFFFAA00Hansgar and Franzok Assist|r: move between the tracks to show the other frames.") print ("|cFFFFAA00Hansgar and Franzok Assist|r: type '/hansgar lock' to lock the frames.") elseif (command == "delay") then local t = tonumber (rest) if (t) then db.STAMPERS_DELAY = t print ("|cFFFFAA00Hansgar and Franzok Assist|r delay set to: ", t) else print ("|cFFFFAA00Hansgar and Franzok Assist|r invalid time.", t) end elseif (command == "test" or command == "show") then if (f.StampersPhase) then f:EndTrackPlayerPosition() return f:StopTracking() end f:StartTracking() f:StartTrackPlayerPosition() elseif (command == "hide") then if (f.StampersPhase) then return f:StopTracking() end f:EndTrackPlayerPosition() elseif (command == "unlock") then db.FRAME_LOCK = true f:SetLockState() print ("|cFFFFAA00Hansgar and Franzok Assist|r frame unlocked.") f.unlocked_frame = true player_pos_frame:Show() player_bar:Show() f.stop_casting_frame:Show() elseif (command == "lock") then f:SetLockState() if (db.FRAME_LOCK) then print ("|cFFFFAA00Hansgar and Franzok Assist|r frame locked.") f.unlocked_frame = false f.stop_casting_frame:Hide() else print ("|cFFFFAA00Hansgar and Franzok Assist|r frame unlocked.") f.unlocked_frame = true player_pos_frame:Show() player_bar:Show() f.stop_casting_frame:Show() end elseif (command == "facing") then if (rest == "1") then db.FACING_SIDE = 1 tframe.facing = true print ("|cFFFFAA00Hansgar and Franzok Assist|r facing set to south.") elseif (rest == "2") then db.FACING_SIDE = 2 tframe.facing = false print ("|cFFFFAA00Hansgar and Franzok Assist|r facing set to north.") elseif (rest == "auto") then db.AUTO_FACING = true print ("|cFFFFAA00Hansgar and Franzok Assist|r auto facing enabled.") else print ("|cFFFFFF00/hansgar facing|r: |cFF00FF001|r = south |cFF00FF002|r = north, use to set the dance bar when auto facing is disabled.") end elseif (command == "autofacing") then db.AUTO_FACING = not db.AUTO_FACING if (db.AUTO_FACING) then print ("|cFFFFAA00Hansgar and Franzok Assist|r auto facing enabled.") else print ("|cFFFFAA00Hansgar and Franzok Assist|r auto facing disabled.") tframe.facing = db.FACING_SIDE == 1 end elseif (command == "dancesize") then local t = tonumber (rest) if (t) then db.DANCE_SIZE = t f:SetDanceBarSize() print ("|cFFFFAA00Hansgar and Franzok Assist|r dance bar size set to: ", t) else print ("|cFFFFAA00Hansgar and Franzok Assist|r invalid size, usage: /hansgar dancesize .", t) end f:SetDanceBarSize() elseif (command == "dance") then db.SHOW_DANCE = not db.SHOW_DANCE if (db.SHOW_DANCE) then if (f.on_encounter) then f:StartTrackPlayerPosition() end print ("|cFFFFAA00Hansgar and Franzok Assist|r dance bars enabled.") else f:EndTrackPlayerPosition() print ("|cFFFFAA00Hansgar and Franzok Assist|r dance bars disabled.") end elseif (command == "cooldown") then db.CD_NUMBER = not db.CD_NUMBER f:RefreshCooldownSettings() else if (f.StampersPhase) then f:EndTrackPlayerPosition() return f:StopTracking() end f:StartTracking() f:StartTrackPlayerPosition() print ("|cFFFFAA00Hansgar and Franzok Assist|r |cFF00FF00" .. f.version .. "|r Commands:") print ("|cFFFFFF00/hansgar resetpos|r: reset the position of all frames.") 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