Commit f15e7a2f authored by Simpy's avatar Simpy 🐹
Browse files

option to enable profile sharing

parent 2753f3f5
......@@ -27,11 +27,10 @@ local Uploads = {}
function D:Initialize()
self.Initialized = true
self:RegisterComm(REQUEST_PREFIX)
self:RegisterEvent('CHAT_MSG_ADDON')
D:UpdateSettings()
self.statusBar = CreateFrame('StatusBar', 'ElvUI_Download', E.UIParent)
E:RegisterStatusBar(self.statusBar)
self.statusBar:CreateBackdrop()
self.statusBar:SetStatusBarTexture(E.media.normTex)
self.statusBar:SetStatusBarColor(0.95, 0.15, 0.15)
......@@ -40,6 +39,17 @@ function D:Initialize()
self.statusBar.text:FontTemplate()
self.statusBar.text:SetPoint('CENTER')
self.statusBar:Hide()
E:RegisterStatusBar(self.statusBar)
end
function D:UpdateSettings()
if E.global.general.allowDistributor then
self:RegisterComm(REQUEST_PREFIX)
self:RegisterEvent('CHAT_MSG_ADDON')
else
self:UnregisterComm(REQUEST_PREFIX)
self:UnregisterEvent('CHAT_MSG_ADDON')
end
end
-- Used to start uploads
......@@ -123,7 +133,7 @@ function D:OnCommReceived(prefix, msg, dist, sender)
end,
button1 = ACCEPT,
button2 = CANCEL,
timeout = 32,
timeout = 30,
whileDead = 1,
hideOnEscape = 1,
}
......@@ -250,7 +260,8 @@ local blacklistedKeys = {
version = true,
eyefinity = true,
disableTutorialButtons = true,
showMissingTalentAlert = true
showMissingTalentAlert = true,
allowDistributor = true
},
chat = {
classColorMentionExcludedNames = true
......@@ -556,7 +567,7 @@ E.PopupDialogs.DISTRIBUTOR_WAITING = {
text = L["Profile request sent. Waiting for response from player."],
whileDead = 1,
hideOnEscape = 1,
timeout = 35,
timeout = 20,
}
E.PopupDialogs.DISTRIBUTOR_REQUEST_DENIED = {
......
......@@ -7,6 +7,7 @@ G.general = {
locale = E:GetLocale(),
eyefinity = false,
smallerWorldMap = true,
allowDistributor = false,
smallerWorldMapScale = 0.9,
fadeMapWhenMoving = true,
mapAlphaWhenMoving = 0.2,
......
......@@ -405,10 +405,11 @@ end
--Create Profiles Table
E.Options.args.profiles = ACH:Group(L["Profiles"], nil, 5, 'tab')
E.Options.args.profiles.args.desc = ACH:Description(L["This feature will allow you to transfer settings to other characters."], 0)
E.Options.args.profiles.args.distributeProfile = ACH:Execute(L["Share Current Profile"], L["Sends your current profile to your target."], 1, function() if not UnitExists('target') or not UnitIsPlayer('target') or not UnitIsFriend('player', 'target') or UnitIsUnit('player', 'target') then E:Print(L["You must be targeting a player."]) return end local name, server = UnitName('target') if name and (not server or server == '') then D:Distribute(name) elseif server then D:Distribute(name, true) end end)
E.Options.args.profiles.args.distributeGlobal = ACH:Execute(L["Share Filters"], L["Sends your filter settings to your target."], 1, function() if not UnitExists('target') or not UnitIsPlayer('target') or not UnitIsFriend('player', 'target') or UnitIsUnit('player', 'target') then E:Print(L["You must be targeting a player."]) return end local name, server = UnitName('target') if name and (not server or server == '') then D:Distribute(name, false, true) elseif server then D:Distribute(name, true, true) end end)
E.Options.args.profiles.args.distributeProfile = ACH:Execute(L["Share Current Profile"], L["Sends your current profile to your target."], 1, function() if not UnitExists('target') or not UnitIsPlayer('target') or not UnitIsFriend('player', 'target') or UnitIsUnit('player', 'target') then E:Print(L["You must be targeting a player."]) return end local name, server = UnitName('target') if name and (not server or server == '') then D:Distribute(name) elseif server then D:Distribute(name, true) end end, nil, nil, nil, nil, nil, function() return not E.global.general.allowDistributor end)
E.Options.args.profiles.args.distributeGlobal = ACH:Execute(L["Share Filters"], L["Sends your filter settings to your target."], 1, function() if not UnitExists('target') or not UnitIsPlayer('target') or not UnitIsFriend('player', 'target') or UnitIsUnit('player', 'target') then E:Print(L["You must be targeting a player."]) return end local name, server = UnitName('target') if name and (not server or server == '') then D:Distribute(name, false, true) elseif server then D:Distribute(name, true, true) end end, nil, nil, nil, nil, nil, function() return not E.global.general.allowDistributor end)
E.Options.args.profiles.args.exportProfile = ACH:Execute(L["Export Profile"], nil, 4, function() ExportImport_Open('export') end)
E.Options.args.profiles.args.importProfile = ACH:Execute(L["Import Profile"], nil, 5, function() ExportImport_Open('import') end)
E.Options.args.profiles.args.allowDistributor = ACH:Toggle(L["Allow Sharing"], L["Both users will need this option enabled."], 6, nil, nil, nil, function() return E.global.general.allowDistributor end, function(_, value) E.global.general.allowDistributor = value; D:UpdateSettings() end)
E.Options.args.profiles.args.spacer = ACH:Spacer(6)
E.Options.args.profiles.args.profile = E.Libs.AceDBOptions:GetOptionsTable(E.data)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment