diff --git a/ElvUI_SLE/core/core.lua b/ElvUI_SLE/core/core.lua index 113cc58..e6ad0db 100644 --- a/ElvUI_SLE/core/core.lua +++ b/ElvUI_SLE/core/core.lua @@ -2,7 +2,6 @@ local SLE = E:GetModule('SLE') local EP = LibStub("LibElvUIPlugin-1.0") local UF = E:GetModule('UnitFrames') -local LSM = LibStub("LibSharedMedia-3.0") local addon = ... --localizing functions-- @@ -63,34 +62,6 @@ local function CheckIncompatible() end end -local subOff - -local function ZoneTextPos() - if ( PVPInfoTextString:GetText() == "" ) then - SubZoneTextString:SetPoint("TOP", "ZoneTextString", "BOTTOM", 0, -subOff); - else - SubZoneTextString:SetPoint("TOP", "PVPInfoTextString", "BOTTOM", 0, -subOff); - end -end - -local function SetFonts() - local db = E.global.sle.fonts - - ZoneTextString:SetFont(LSM:Fetch('font', db.zone.font), db.zone.size, db.zone.outline) - PVPInfoTextString:SetFont(LSM:Fetch('font', db.pvp.font), db.pvp.size, db.pvp.outline) - PVPArenaTextString:SetFont(LSM:Fetch('font', db.pvp.font), db.pvp.size, db.pvp.outline) - SubZoneTextString:SetFont(LSM:Fetch('font', db.subzone.font), db.subzone.size, db.subzone.outline) - - ZoneTextString:SetWidth(db.zone.width) - PVPInfoTextString:SetWidth(db.pvp.width) - PVPArenaTextString:SetWidth(db.pvp.width) - SubZoneTextString:SetWidth(db.subzone.width) - - --Dat is like experiment, don't touch-- - subOff = db.subzone.offset - hooksecurefunc("SetZoneText", ZoneTextPos) -end - function SLE:Initialize() --ElvUI's version check if elvV < elvR then @@ -108,7 +79,4 @@ function SLE:Initialize() ConfigCats() SLE:RegisterCommands() CheckIncompatible() - if E.global.sle.fonts.enable then - hooksecurefunc(E, "UpdateBlizzardFonts", SetFonts) - end end \ No newline at end of file diff --git a/ElvUI_SLE/core/load_core.xml b/ElvUI_SLE/core/load_core.xml index e263927..015cd78 100644 --- a/ElvUI_SLE/core/load_core.xml +++ b/ElvUI_SLE/core/load_core.xml @@ -1 +1 @@ -<Ui xmlns="http://www.blizzard.com/wow/ui/"> <Script file='modules.lua'/> <Script file='core.lua'/> <Script file='toolkit.lua'/> <Script file='commands.lua'/> <Script file='staticpopups.lua'/> <Script file='install.lua'/> <Include file='installer\load_install.xml'/> <Script file='elvprot.lua'/> <Script file='test.lua'/> </Ui> \ No newline at end of file +<Ui xmlns="http://www.blizzard.com/wow/ui/"> <Script file='modules.lua'/> <Script file='core.lua'/> <Script file='media.lua'/> <Script file='toolkit.lua'/> <Script file='commands.lua'/> <Script file='staticpopups.lua'/> <Script file='install.lua'/> <Include file='installer\load_install.xml'/> <Script file='elvprot.lua'/> <Script file='test.lua'/> </Ui> \ No newline at end of file diff --git a/ElvUI_SLE/core/media.lua b/ElvUI_SLE/core/media.lua new file mode 100644 index 0000000..64f3877 --- /dev/null +++ b/ElvUI_SLE/core/media.lua @@ -0,0 +1,118 @@ +local E, L, V, P, G, _ = unpack(ElvUI); +local SLE = E:GetModule('SLE') +local M = E:GetModule('SLE_Media') +local LSM = LibStub("LibSharedMedia-3.0") + +local Zones = { + "Washington", + "Moscow", + "Moon Base", + "Goblin Spa Resort", + "Illuminaty Headquaters", + "Elv's Closet", + "Pat's Cage", +} + +local PvPInfo = { + "(Russian territory)", + "(Horde territory)", + "(Alliance territory)", + "(Aliens territory)", + "(Cats terrtory)", + "(Japanise territory)", + "(EA territory)", +} + +local Subzones = { + "Administration", + "Hellhole", + "Alley of Bullshit", + "Dr. Pepper Storage", + "Vodka Storage", + "First National Bank", +} + +local PVPArena = { + "(PvP)", + "No Smoking!", + "Only 5% taxes", + "Free For All", + "Self destruction is in process", +} + +local Colors = { + [1] = {0.41, 0.8, 0.94}, -- sanctuary + [2] = {1.0, 0.1, 0.1}, -- hostile + [3] = {0.1, 1.0, 0.1}, --friendly + [4] = {1.0, 0.7, 0}, --contested + [5] = {1.0, 0.9294, 0.7607}, --white +} + + + +local function ZoneTextPos() + if ( PVPInfoTextString:GetText() == "" ) then + SubZoneTextString:SetPoint("TOP", "ZoneTextString", "BOTTOM", 0, -E.db.sle.media.fonts.subzone.offset); + else + SubZoneTextString:SetPoint("TOP", "PVPInfoTextString", "BOTTOM", 0, -E.db.sle.media.fonts.subzone.offset); + end +end + +local function SetFonts() + local db = E.db.sle.media.fonts + + ZoneTextString:SetFont(LSM:Fetch('font', db.zone.font), db.zone.size, db.zone.outline) -- Main zone name + PVPInfoTextString:SetFont(LSM:Fetch('font', db.pvp.font), db.pvp.size, db.pvp.outline) -- PvP status for main zone + PVPArenaTextString:SetFont(LSM:Fetch('font', db.pvp.font), db.pvp.size, db.pvp.outline) -- PvP status for subzone + SubZoneTextString:SetFont(LSM:Fetch('font', db.subzone.font), db.subzone.size, db.subzone.outline) -- Subzone name + + SendMailBodyEditBox:SetFont(LSM:Fetch('font', db.mail.font), db.mail.size, db.mail.outline) --Writing letter text + OpenMailBodyText:SetFont(LSM:Fetch('font', db.mail.font), db.mail.size, db.mail.outline) --Received letter text + --QuestFont:SetFont(LSM:Fetch('font', "ElvUI Pixel"), 12, "") -- Font in Quest Log/Petitions and shit. It's fucking hedious with any outline so fuck it. + --QuestFont_Large:SetFont(LSM:Fetch('font', "ElvUI Pixel"), 12, "") -- No idea what that is for + --SystemFont_Large:SetFont(LSM:Fetch('font', "ElvUI Pixel"), 12, "") -- Core abilities names and shit + NumberFont_Shadow_Med:SetFont(LSM:Fetch('font', db.editbox.font), db.editbox.size, db.editbox.outline) --Chat editbox +end + +function M:TextWidth() + local db = E.db.sle.media.fonts + ZoneTextString:SetWidth(db.zone.width) + PVPInfoTextString:SetWidth(db.pvp.width) + PVPArenaTextString:SetWidth(db.pvp.width) + SubZoneTextString:SetWidth(db.subzone.width) +end + +function M:TextShow() + local z, i, a, s, c = random(1, #Zones), random(1, #PvPInfo), random(1, #PVPArena), random(1, #Subzones), random(1, #Colors) + local red, green, blue = unpack(Colors[c]) + + + + --Setting texts-- + ZoneTextString:SetText(Zones[z]) + PVPInfoTextString:SetText(PvPInfo[i]) + PVPArenaTextString:SetText(PVPArena[a]) + SubZoneTextString:SetText(Subzones[s]) + + ZoneTextPos()--nil, true) + + --Applying colors-- + ZoneTextString:SetTextColor(red, green, blue) + PVPInfoTextString:SetTextColor(red, green, blue) + PVPArenaTextString:SetTextColor(red, green, blue) + SubZoneTextString:SetTextColor(red, green, blue) + + FadingFrame_Show(ZoneTextFrame) + FadingFrame_Show(SubZoneTextFrame) +end + +function M:Update() + M:TextWidth() +end + +function M:Initialize() + M:TextWidth() + hooksecurefunc(E, "UpdateBlizzardFonts", SetFonts) + hooksecurefunc("SetZoneText", ZoneTextPos) + --E:CreateMover(ZoneTextFrame, "ZoneTextMover", "ZoneTextMover", nil, nil, nil, "S&L,S&L MISC") +end \ No newline at end of file diff --git a/ElvUI_SLE/core/modules.lua b/ElvUI_SLE/core/modules.lua index cbbded5..8dc28e2 100644 --- a/ElvUI_SLE/core/modules.lua +++ b/ElvUI_SLE/core/modules.lua @@ -19,6 +19,7 @@ local modules = { ['SLE_UIButtons'] = { 'AceHook-3.0', 'AceEvent-3.0'}, ['SLE_EnhancedVehicleBar'] = {}, ['SLE_Test'] = { 'AceHook-3.0', 'AceEvent-3.0'}, --Testing module in dev folder + ['SLE_Media'] = { 'AceHook-3.0' }, ['SLE'] = { 'AceHook-3.0', 'AceEvent-3.0' }, } diff --git a/ElvUI_SLE/core/toolkit.lua b/ElvUI_SLE/core/toolkit.lua index 494243d..2a0b2a0 100644 --- a/ElvUI_SLE/core/toolkit.lua +++ b/ElvUI_SLE/core/toolkit.lua @@ -9,6 +9,7 @@ local RF = E:GetModule('SLE_RaidFlares') local F = E:GetModule('SLE_Farm') local LT = E:GetModule('SLE_Loot') local UF = E:GetModule('UnitFrames') +local M = E:GetModule('SLE_Media') --test local GetContainerNumSlots, GetContainerItemID = GetContainerNumSlots, GetContainerItemID @@ -59,4 +60,5 @@ function E:UpdateAll() RF:Update() F:UpdateLayout() CH:GMIconUpdate() + M:TextWidth() end \ No newline at end of file diff --git a/ElvUI_SLE/defaults/private.lua b/ElvUI_SLE/defaults/private.lua index 89c1507..fbb5d90 100644 --- a/ElvUI_SLE/defaults/private.lua +++ b/ElvUI_SLE/defaults/private.lua @@ -69,29 +69,4 @@ V['sle'] = { ['guildmaster'] = false, ['backgrounds'] = false, -} - -G['sle'] = { - ['fonts'] = { - ['enable'] = false, - ['zone'] = { - ['font'] = "ElvUI Font", - ['size'] = 32, - ['outline'] = "OUTLINE", - ['width'] = 512, - }, - ['subzone'] = { - ['font'] = "ElvUI Font", - ['size'] = 25, - ['outline'] = "OUTLINE", - ['offset'] = 0, - ['width'] = 512, - }, - ['pvp'] = { - ['font'] = "ElvUI Font", - ['size'] = 22, - ['outline'] = "OUTLINE", - ['width'] = 512, - }, - }, } \ No newline at end of file diff --git a/ElvUI_SLE/defaults/profile.lua b/ElvUI_SLE/defaults/profile.lua index 3d096b6..e56471e 100644 --- a/ElvUI_SLE/defaults/profile.lua +++ b/ElvUI_SLE/defaults/profile.lua @@ -7,6 +7,41 @@ P['sle'] = { --Auto release ['pvpautorelease'] = true, + + --Media + ['media'] = { + ['fonts'] = { + ['zone'] = { + ['font'] = "ElvUI Font", + ['size'] = 32, + ['outline'] = "OUTLINE", + ['width'] = 512, + }, + ['subzone'] = { + ['font'] = "ElvUI Font", + ['size'] = 25, + ['outline'] = "OUTLINE", + ['offset'] = 0, + ['width'] = 512, + }, + ['pvp'] = { + ['font'] = "ElvUI Font", + ['size'] = 22, + ['outline'] = "OUTLINE", + ['width'] = 512, + }, + ['mail'] = { + ['font'] = "ElvUI Font", + ['size'] = 12, + ['outline'] = "NONE", + }, + ['editbox'] = { + ['font'] = "ElvUI Font", + ['size'] = 12, + ['outline'] = "NONE", + }, + }, + }, --Background frames ['backgrounds'] = { diff --git a/ElvUI_SLE/options/media_c.lua b/ElvUI_SLE/options/media_c.lua index f6e6677..cf4c95a 100644 --- a/ElvUI_SLE/options/media_c.lua +++ b/ElvUI_SLE/options/media_c.lua @@ -1,10 +1,12 @@ local E, L, V, P, G, _ = unpack(ElvUI); +local M = E:GetModule('SLE_Media') local function configTable() E.Options.args.sle.args.media = { type = "group", name = L["Media"], order = 3, + childGroups = 'tab', args = { header = { order = 1, @@ -16,54 +18,47 @@ local function configTable() type = "description", name = "Imma text!", }, - fonts = { + zonefonts = { type = "group", - name = L["Fonts"], + name = L["Zone Texts"], order = 3, - guiInline = true, args = { intro = { order = 1, type = "description", - name = "Enables replacement of some fonts. Please note that these options will take effect only after reload of your UI.", + name = "Placeholder text.", }, - enable = { + test = { order = 2, - type = "toggle", - name = L["Enable"], - get = function(info) return E.global.sle.fonts.enable end, - set = function(info, value) E.global.sle.fonts.enable = value; E:StaticPopup_Show("GLOBAL_RL") end + type = 'execute', + name = "Test", + func = function() M:TextShow() end, }, zone = { type = "group", name = "Zone Text", order = 3, guiInline = true, - disabled = function() return not E.global.sle.fonts.enable end, + get = function(info) return E.db.sle.media.fonts.zone[ info[#info] ] end, + set = function(info, value) E.db.sle.media.fonts.zone[ info[#info] ] = value; E:UpdateMedia() end, args = { font = { type = "select", dialogControl = 'LSM30_Font', order = 1, - name = L["Default Font"], + name = L["Font"], values = AceGUIWidgetLSMlists.font, - get = function(info) return E.global.sle.fonts.zone.font end, - set = function(info, value) E.global.sle.fonts.zone.font = value; E:StaticPopup_Show("GLOBAL_RL") end, }, size = { order = 2, name = L["Font Size"], type = "range", min = 6, max = 48, step = 1, - get = function(info) return E.global.sle.fonts.zone.size end, - set = function(info, value) E.global.sle.fonts.zone.size = value; E:StaticPopup_Show("GLOBAL_RL") end, }, outline = { order = 3, name = L["Font Outline"], desc = L["Set the font outline."], type = "select", - get = function(info) return E.global.sle.fonts.zone.outline end, - set = function(info, value) E.global.sle.fonts.zone.outline = value; E:StaticPopup_Show("GLOBAL_RL") end, values = { ['NONE'] = L['None'], ['OUTLINE'] = 'OUTLINE', @@ -77,8 +72,7 @@ local function configTable() name = L["Width"], type = "range", min = 512, max = E.screenwidth, step = 1, - get = function(info) return E.global.sle.fonts.zone.width end, - set = function(info, value) E.global.sle.fonts.zone.width = value; E:StaticPopup_Show("GLOBAL_RL") end, + set = function(info, value) E.db.sle.media.fonts.zone.width = value; M:TextWidth() end, }, }, }, @@ -87,31 +81,26 @@ local function configTable() name = "Subzone Text", order = 4, guiInline = true, - disabled = function() return not E.global.sle.fonts.enable end, + get = function(info) return E.db.sle.media.fonts.subzone[ info[#info] ] end, + set = function(info, value) E.db.sle.media.fonts.subzone[ info[#info] ] = value; E:UpdateMedia() end, args = { font = { type = "select", dialogControl = 'LSM30_Font', order = 1, - name = L["Default Font"], + name = L["Font"], values = AceGUIWidgetLSMlists.font, - get = function(info) return E.global.sle.fonts.subzone.font end, - set = function(info, value) E.global.sle.fonts.subzone.font = value; E:StaticPopup_Show("GLOBAL_RL") end, }, size = { order = 2, name = L["Font Size"], type = "range", min = 6, max = 48, step = 1, - get = function(info) return E.global.sle.fonts.subzone.size end, - set = function(info, value) E.global.sle.fonts.subzone.size = value; E:StaticPopup_Show("GLOBAL_RL") end, }, outline = { order = 3, name = L["Font Outline"], desc = L["Set the font outline."], type = "select", - get = function(info) return E.global.sle.fonts.subzone.outline end, - set = function(info, value) E.global.sle.fonts.subzone.outline = value; E:StaticPopup_Show("GLOBAL_RL") end, values = { ['NONE'] = L['None'], ['OUTLINE'] = 'OUTLINE', @@ -120,21 +109,18 @@ local function configTable() ['THICKOUTLINE'] = 'THICKOUTLINE', }, }, - offset = { + width = { order = 4, - name = L["Offset"], + name = L["Width"], type = "range", - min = 0, max = 30, step = 1, - get = function(info) return E.global.sle.fonts.subzone.offset end, - set = function(info, value) E.global.sle.fonts.subzone.offset = value; E:StaticPopup_Show("GLOBAL_RL") end, + min = 512, max = E.screenwidth, step = 1, + set = function(info, value) E.db.sle.media.fonts.subzone.width = value; M:TextWidth() end, }, - width = { + offset = { order = 5, - name = L["Width"], + name = L["Offset"], type = "range", - min = 512, max = E.screenwidth, step = 1, - get = function(info) return E.global.sle.fonts.subzone.width end, - set = function(info, value) E.global.sle.fonts.subzone.width = value; E:StaticPopup_Show("GLOBAL_RL") end, + min = 0, max = 30, step = 1, }, }, }, @@ -143,31 +129,26 @@ local function configTable() name = "PvP Status Text", order = 5, guiInline = true, - disabled = function() return not E.global.sle.fonts.enable end, + get = function(info) return E.db.sle.media.fonts.pvp[ info[#info] ] end, + set = function(info, value) E.db.sle.media.fonts.pvp[ info[#info] ] = value; E:UpdateMedia() end, args = { font = { type = "select", dialogControl = 'LSM30_Font', order = 1, - name = L["Default Font"], + name = L["Font"], values = AceGUIWidgetLSMlists.font, - get = function(info) return E.global.sle.fonts.pvp.font end, - set = function(info, value) E.global.sle.fonts.pvp.font = value; E:StaticPopup_Show("GLOBAL_RL") end, }, size = { order = 2, name = L["Font Size"], type = "range", min = 6, max = 48, step = 1, - get = function(info) return E.global.sle.fonts.pvp.size end, - set = function(info, value) E.global.sle.fonts.pvp.size = value; E:StaticPopup_Show("GLOBAL_RL") end, }, outline = { order = 3, name = L["Font Outline"], desc = L["Set the font outline."], type = "select", - get = function(info) return E.global.sle.fonts.pvp.outline end, - set = function(info, value) E.global.sle.fonts.pvp.outline = value; E:StaticPopup_Show("GLOBAL_RL") end, values = { ['NONE'] = L['None'], ['OUTLINE'] = 'OUTLINE', @@ -181,8 +162,86 @@ local function configTable() name = L["Width"], type = "range", min = 512, max = E.screenwidth, step = 1, - get = function(info) return E.global.sle.fonts.pvp.width end, - set = function(info, value) E.global.sle.fonts.pvp.width = value; E:StaticPopup_Show("GLOBAL_RL") end, + set = function(info, value) E.db.sle.media.fonts.pvp.width = value; M:TextWidth() end, + }, + }, + }, + }, + }, + miscfonts = { + type = "group", + name = L["Misc Texts"], + order = 4, + args = { + mail = { + type = "group", + name = "Mail Text", + order = 1, + guiInline = true, + get = function(info) return E.db.sle.media.fonts.mail[ info[#info] ] end, + set = function(info, value) E.db.sle.media.fonts.mail[ info[#info] ] = value; E:UpdateMedia() end, + args = { + font = { + type = "select", dialogControl = 'LSM30_Font', + order = 1, + name = L["Font"], + desc = "The font used for letters' body", + values = AceGUIWidgetLSMlists.font, + }, + size = { + order = 2, + name = L["Font Size"], + type = "range", + min = 6, max = 22, step = 1, + }, + outline = { + order = 3, + name = L["Font Outline"], + desc = L["Set the font outline."], + type = "select", + values = { + ['NONE'] = L['None'], + ['OUTLINE'] = 'OUTLINE', + + ['MONOCHROMEOUTLINE'] = 'MONOCROMEOUTLINE', + ['THICKOUTLINE'] = 'THICKOUTLINE', + }, + }, + }, + }, + editbox = { + type = "group", + name = "Chat Editbox Text", + order = 2, + guiInline = true, + get = function(info) return E.db.sle.media.fonts.editbox[ info[#info] ] end, + set = function(info, value) E.db.sle.media.fonts.editbox[ info[#info] ] = value; E:UpdateMedia() end, + args = { + font = { + type = "select", dialogControl = 'LSM30_Font', + order = 1, + name = L["Font"], + desc = "The font used for chat editbox", + values = AceGUIWidgetLSMlists.font, + }, + size = { + order = 2, + name = L["Font Size"], + type = "range", + min = 6, max = 20, step = 1, + }, + outline = { + order = 3, + name = L["Font Outline"], + desc = L["Set the font outline."], + type = "select", + values = { + ['NONE'] = L['None'], + ['OUTLINE'] = 'OUTLINE', + + ['MONOCHROMEOUTLINE'] = 'MONOCROMEOUTLINE', + ['THICKOUTLINE'] = 'THICKOUTLINE', + }, }, }, },