a4blank@8: a4blank@8: a4blank@8: RTT = LibStub("AceAddon-3.0"):NewAddon("RaidTargetTactics", "AceConsole-3.0") a4blank@8: local L = LibStub("AceLocale-3.0"):GetLocale("RaidTargetTactics") a4blank@8: a4blank@8: a4blank@8: local LDB = LibStub("LibDataBroker-1.1", true) a4blank@8: local LDBIcon = LibStub("LibDBIcon-1.0", true) a4blank@10: local AceGUI = LibStub("AceGUI-3.0") a4blank@8: a4blank@8: local RTTIcon = LibStub("LibDataBroker-1.1"):NewDataObject("RTTIcon", { a4blank@8: type = "data source", a4blank@8: text = "Raid Target Tactics", a4blank@8: icon = "Interface\\TARGETINGFRAME\\UI-RaidTargetingIcon_8", a4blank@8: OnClick = function() RTT:OnIconClick() end, a4blank@8: OnTooltipShow = function(tooltip) a4blank@8: tooltip:AddLine("Raid Target Tactics") a4blank@8: tooltip:AddLine(L.Minimap_Icon_Tooltip) a4blank@8: end, a4blank@8: }) a4blank@8: a4blank@8: local defaults = { a4blank@8: profile = { a4blank@8: visible = true, a4blank@8: minimap = { a4blank@8: hide = false, a4blank@8: }, a4blank@8: }, a4blank@8: } a4blank@8: a4blank@8: function RTT:OnInitialize() a4blank@8: self.db = LibStub("AceDB-3.0"):New("TacticsSettings", defaults, true) a4blank@8: a4blank@8: LDBIcon:Register("RTTIcon", RTTIcon, self.db.profile.minimap) a4blank@8: self:InitFrame() a4blank@10: if self.f:IsShown() ~= self.db.profile.visible then a4blank@8: if self.db.profile.visible then a4blank@8: self:ShowFrame() a4blank@8: else a4blank@8: self:HideFrame() a4blank@8: end a4blank@8: end a4blank@8: end a4blank@8: a4blank@8: function RTT:InitFrame() a4blank@8: self.f = CreateFrame("Frame", nil, UIParent) a4blank@10: self.f:SetWidth(300) a4blank@8: self.f:SetHeight(200) a4blank@10: self.f:SetAlpha(0.8) a4blank@8: self.f:SetPoint("LEFT", UIParent, "LEFT", 10, 0) a4blank@10: --[[self.f:SetBackdrop({bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", a4blank@10: edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border", a4blank@10: tile = true, tileSize = 16, edgeSize = 16, a4blank@10: insets = { left = 4, right = 4, top = 4, bottom = 4 }}) a4blank@10: ]] a4blank@10: local backdrop = { a4blank@10: -- path to the background texture a4blank@10: bgFile = "Interface\\FrameGeneral\\UI-Background-Marble", a4blank@10: -- path to the border texture a4blank@10: edgeFile = "Interface\\DialogFrame\\UI-DialogBox-Gold-Border", a4blank@10: -- true to repeat the background texture to fill the frame, false to scale it a4blank@10: tile = true, a4blank@10: -- size (width or height) of the square repeating background tiles (in pixels) a4blank@10: tileSize = 256, a4blank@10: -- thickness of edge segments and square size of edge corners (in pixels) a4blank@10: edgeSize = 32, a4blank@10: -- distance from the edges of the frame to those of the background texture (in pixels) a4blank@10: insets = { a4blank@10: left = 11, a4blank@10: right = 12, a4blank@10: top = 12, a4blank@10: bottom = 11 a4blank@10: } a4blank@10: } a4blank@10: self.f:SetBackdrop(backdrop) a4blank@10: self.f:SetFrameStrata("HIGH") a4blank@10: --self.f:SetBackdropColor(0, 0, 0, 0.5) a4blank@10: a4blank@10: self.fields = {} a4blank@10: self.selects = {} a4blank@10: for num, icon in ipairs(RaidIcons) do a4blank@10: icon:draw(self.f, 20, num * -20) a4blank@10: a4blank@10: local field = CreateFrame("EditBox", "__RTT_EditBox_" .. tostring(num), self.f, "InputBoxTemplate") a4blank@10: field:SetAutoFocus(false) a4blank@10: field:SetFontObject(ChatFontNormal) a4blank@10: field:SetWidth(100) a4blank@10: field:SetHeight(16) a4blank@10: field:SetTextInsets(0, 0, 3, 3) a4blank@10: field:SetPoint("TOPLEFT", 40, num * -20) a4blank@10: table.insert(self.fields, field) a4blank@10: field:Show() a4blank@10: a4blank@10: local userSelect = AceGUI:Create("Dropdown") a4blank@10: userSelect.frame:SetParent(self.f) a4blank@10: local raid = {} a4blank@10: for i=1, GetNumRaidMembers() do a4blank@10: raid[i] = UnitName("raid" .. i) a4blank@10: end a4blank@10: userSelect:SetList(raid) a4blank@10: userSelect:SetWidth(100) a4blank@10: userSelect:SetHeight(16) a4blank@10: userSelect:SetPoint("TOPLEFT", 160, num * -20) a4blank@10: table.insert(self.selects, userSelect) a4blank@10: userSelect.frame:Show() a4blank@10: end a4blank@8: end a4blank@8: a4blank@8: function RTT:OnIconClick() a4blank@8: if self.db.profile.visible then a4blank@8: self:HideFrame() a4blank@8: else a4blank@8: self:ShowFrame() a4blank@8: end a4blank@10: self.db.profile.visible = not self.db.profile.visible a4blank@8: end a4blank@8: a4blank@8: function RTT:HideFrame() a4blank@8: self.f:Hide() a4blank@8: end a4blank@8: a4blank@8: function RTT:ShowFrame() a4blank@8: self.f:Show() a4blank@8: end a4blank@8: a4blank@8: a4blank@8: a4blank@8: