- Added import and export profiles.

- Improved import and export custom skins.
- Fixed shaman's sundering spell not showing in crowd control.
- Fixed sharing guild statistics.
This commit is contained in:
Tercio
2018-10-28 15:58:05 -03:00
parent c6c3cdca1a
commit 24eebefb6f
13 changed files with 3987 additions and 148 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
local dversion = 116
local dversion = 117
local major, minor = "DetailsFramework-1.0", dversion
local DF, oldminor = LibStub:NewLibrary (major, minor)
+1
View File
@@ -661,6 +661,7 @@ DF.CrowdControlSpells = {
[118905] = "SHAMAN", --Static Charge (Capacitor Totem)
[51514] = "SHAMAN", --Hex
[64695] = "SHAMAN", --Earthgrab (talent)
[197214] = "SHAMAN", --Sundering (talent)
[179057] = "DEMONHUNTER", --Chaos Nova
[217832] = "DEMONHUNTER", --Imprison
File diff suppressed because it is too large Load Diff
+4
View File
@@ -0,0 +1,4 @@
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
..\FrameXML\UI.xsd">
<Script file="LibDeflate.lua" />
</Ui>
+1
View File
@@ -14,6 +14,7 @@
<Script file="LibGraph-2.0\LibGraph-2.0.lua"/>
<Script file="LibWindow-1.1\LibWindow-1.1.lua"/>
<Include file="LibCompress\lib.xml"/>
<Include file="LibDeflate\lib.xml"/>
<Include file="LibItemUpgradeInfo-1.0\LibItemUpgradeInfo-1.0.xml"/>
<Include file="LibGroupInSpecT-1.1\lib.xml"/>
<Include file="DF\load.xml"/>
+8 -6
View File
File diff suppressed because one or more lines are too long
+22 -20
View File
@@ -865,27 +865,29 @@ function _detalhes:BaseFrameSnap()
for lado, snap_to in _pairs (self.snap) do
local instancia_alvo = _detalhes.tabela_instancias [snap_to]
if (instancia_alvo.ativa and instancia_alvo.baseframe) then
if (lado == 1) then --> a esquerda
instancia_alvo.baseframe:SetPoint ("TOPRIGHT", my_baseframe, "TOPLEFT")
elseif (lado == 2) then --> em baixo
local statusbar_y_mod = 0
if (not self.show_statusbar) then
statusbar_y_mod = 14
end
instancia_alvo.baseframe:SetPoint ("TOPLEFT", my_baseframe, "BOTTOMLEFT", 0, -34 + statusbar_y_mod)
elseif (lado == 3) then --> a direita
instancia_alvo.baseframe:SetPoint ("BOTTOMLEFT", my_baseframe, "BOTTOMRIGHT")
elseif (lado == 4) then --> em cima
local statusbar_y_mod = 0
if (not instancia_alvo.show_statusbar) then
statusbar_y_mod = -14
end
instancia_alvo.baseframe:SetPoint ("BOTTOMLEFT", my_baseframe, "TOPLEFT", 0, 34 + statusbar_y_mod)
if (instancia_alvo) then
if (instancia_alvo.ativa and instancia_alvo.baseframe) then
if (lado == 1) then --> a esquerda
instancia_alvo.baseframe:SetPoint ("TOPRIGHT", my_baseframe, "TOPLEFT")
elseif (lado == 2) then --> em baixo
local statusbar_y_mod = 0
if (not self.show_statusbar) then
statusbar_y_mod = 14
end
instancia_alvo.baseframe:SetPoint ("TOPLEFT", my_baseframe, "BOTTOMLEFT", 0, -34 + statusbar_y_mod)
elseif (lado == 3) then --> a direita
instancia_alvo.baseframe:SetPoint ("BOTTOMLEFT", my_baseframe, "BOTTOMRIGHT")
elseif (lado == 4) then --> em cima
local statusbar_y_mod = 0
if (not instancia_alvo.show_statusbar) then
statusbar_y_mod = -14
end
instancia_alvo.baseframe:SetPoint ("BOTTOMLEFT", my_baseframe, "TOPLEFT", 0, 34 + statusbar_y_mod)
end
end
end
end
+75 -7
View File
@@ -967,6 +967,8 @@ local encounter_is_current_tier = function (encounterID)
if (not _detalhes.InstancesToStoreData [mapID]) then
return false
end
else
return false
end
end
return true
@@ -1011,7 +1013,7 @@ end
function _detalhes.storage:GetIDsToGuildSync()
local db = _detalhes.storage:OpenRaidStorage()
if (db) then
if (not db) then
return
end
@@ -1044,7 +1046,7 @@ end
function _detalhes.storage:CheckMissingIDsToGuildSync (IDsList)
local db = _detalhes.storage:OpenRaidStorage()
if (db) then
if (not db) then
return
end
@@ -1082,7 +1084,7 @@ end
function _detalhes.storage:BuildEncounterDataToGuildSync (IDsList)
local db = _detalhes.storage:OpenRaidStorage()
if (db) then
if (not db) then
return
end
@@ -1146,7 +1148,7 @@ end
function _detalhes.storage:AddGuildSyncData (data, source)
local db = _detalhes.storage:OpenRaidStorage()
if (db) then
if (not db) then
return
end
@@ -1208,7 +1210,7 @@ end
function _detalhes.storage:ListDiffs()
local db = _detalhes.storage:OpenRaidStorage()
if (db) then
if (not db) then
return
end
@@ -1222,7 +1224,7 @@ end
function _detalhes.storage:ListEncounters (diff)
local db = _detalhes.storage:OpenRaidStorage()
if (db) then
if (not db) then
return
end
@@ -1248,7 +1250,7 @@ end
function _detalhes.storage:GetPlayerData (diff, encounter_id, playername)
local db = _detalhes.storage:OpenRaidStorage()
if (db) then
if (not db) then
return
end
@@ -2150,3 +2152,69 @@ if (LibGroupInSpecT) then
LibGroupInSpecT.RegisterCallback (_detalhes, "GroupInSpecT_Update", "LibGroupInSpecT_UpdateReceived")
end
--------------------------------------------------------------------------------------------------------------------------------------------
--compress data
-- ~compress ~zip ~export ~import ~deflate ~serialize
function Details:CompressData (data, dataType)
local LibDeflate = LibStub:GetLibrary ("LibDeflate")
local LibAceSerializer = LibStub:GetLibrary ("AceSerializer-3.0")
if (LibDeflate and LibAceSerializer) then
local dataSerialized = LibAceSerializer:Serialize (data)
if (dataSerialized) then
local dataCompressed = LibDeflate:CompressDeflate (dataSerialized, {level = 9})
if (dataCompressed) then
if (dataType == "print") then
local dataEncoded = LibDeflate:EncodeForPrint (dataCompressed)
return dataEncoded
elseif (dataType == "comm") then
local dataEncoded = LibDeflate:EncodeForWoWAddonChannel (dataCompressed)
return dataEncoded
end
end
end
end
end
function Details:DecompressData (data, dataType)
local LibDeflate = LibStub:GetLibrary ("LibDeflate")
local LibAceSerializer = LibStub:GetLibrary ("AceSerializer-3.0")
if (LibDeflate and LibAceSerializer) then
local dataCompressed
if (dataType == "print") then
dataCompressed = LibDeflate:DecodeForPrint (data)
if (not dataCompressed) then
Details:Msg ("couldn't decode the data.")
return false
end
elseif (dataType == "comm") then
dataCompressed = LibDeflate:DecodeForWoWAddonChannel (data)
if (not dataCompressed) then
Details:Msg ("couldn't decode the data.")
return false
end
end
local dataSerialized = LibDeflate:DecompressDeflate (dataCompressed)
if (not dataSerialized) then
Details:Msg ("couldn't uncompress the data.")
return false
end
local okay, data = LibAceSerializer:Deserialize (dataSerialized)
if (not okay) then
Details:Msg ("couldn't unserialize the data.")
return false
end
return data
end
end
-1
View File
@@ -370,7 +370,6 @@
end
local IDs = _detalhes.storage:GetIDsToGuildSync()
if (IDs and IDs [1]) then
local from = UnitName ("player")
local realm = GetRealmName()
+80 -2
View File
@@ -1929,8 +1929,9 @@
classColor = RAID_CLASS_COLORS [className] and RAID_CLASS_COLORS [className].colorStr
end
local playerNameFormated = _detalhes:GetOnlyName (playerName)
tinsert (sortTable, {
"|c" .. classColor .. playerName .. "|r",
"|c" .. classColor .. playerNameFormated .. "|r",
_detalhes:comma_value (t.ps),
_detalhes:ToK2 (t.total),
_detalhes.gump:IntegerToTimer (t.length),
@@ -2018,8 +2019,9 @@
local className = select (2, GetClassInfo (player_class [playerTable [1]] or 0))
if (className) then
local playerNameFormated = _detalhes:GetOnlyName (playerTable[1])
local classColor = RAID_CLASS_COLORS [className] and RAID_CLASS_COLORS [className].colorStr
playerTable [1] = "|c" .. classColor .. playerTable [1] .. "|r"
playerTable [1] = "|c" .. classColor .. playerNameFormated .. "|r"
end
end
@@ -6968,3 +6970,79 @@ function Details:ScrollDamage()
DetailsScrollDamage:Show()
end
---------------------------------------------------------------------------------------------------------------------------------------
--> import export window
--show a window with a big text editor and 2 buttons: okay and cancel.
--cancel button always closes the window and okay calls the comfirm function passed in the argument
--default text is the text shown show the window is show()
function _detalhes:DumpString (text)
_detalhes:ShowImportWindow (text)
end
function _detalhes:ShowImportWindow (defaultText, confirmFunc, titleText)
if (not DetailsExportWindow) then
local importWindow = DetailsFramework:CreateSimplePanel (UIParent, 800, 610, "Details! Dump String", "DetailsExportWindow")
importWindow:SetFrameStrata ("FULLSCREEN")
importWindow:SetPoint ("center")
DetailsFramework:ApplyStandardBackdrop (importWindow, false, 1.2)
local importTextEditor = DetailsFramework:NewSpecialLuaEditorEntry (importWindow, 780, 540, "ImportEditor", "$parentEditor", true)
importTextEditor:SetBackdrop ({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true})
importTextEditor:SetBackdropColor (.2, .2, .2, .5)
importTextEditor:SetBackdropBorderColor (0, 0, 0, 1)
importTextEditor:SetPoint ("topleft", importWindow, "topleft", 10, -30)
importTextEditor.scroll:SetBackdrop (nil)
importTextEditor.editbox:SetBackdrop (nil)
importTextEditor:SetBackdrop (nil)
DetailsFramework:ReskinSlider (importTextEditor.scroll)
if (not importTextEditor.__background) then
importTextEditor.__background = importTextEditor:CreateTexture (nil, "background")
end
importTextEditor:SetBackdrop ({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1})
importTextEditor:SetBackdropBorderColor (0, 0, 0, 1)
importTextEditor.__background:SetColorTexture (0.2317647, 0.2317647, 0.2317647)
importTextEditor.__background:SetVertexColor (0.27, 0.27, 0.27)
importTextEditor.__background:SetAlpha (0.8)
importTextEditor.__background:SetVertTile (true)
importTextEditor.__background:SetHorizTile (true)
importTextEditor.__background:SetAllPoints()
--import button
local onClickImportButton = function()
if (DetailsExportWindow.ConfirmFunction) then
DetailsFramework:Dispatch (DetailsExportWindow.ConfirmFunction, importTextEditor:GetText())
end
importWindow:Hide()
end
local okayButton = DetailsFramework:CreateButton (importTextEditor, onClickImportButton, 120, 20, "Okay", -1, nil, nil, nil, nil, nil, _detalhes.gump:GetTemplate ("button", "OPTIONS_BUTTON_TEMPLATE"), _detalhes.gump:GetTemplate ("font", "OPTIONS_FONT_TEMPLATE")) --> localize-me
okayButton:SetIcon ([[Interface\BUTTONS\UI-Panel-BiggerButton-Up]], 20, 20, "overlay", {0.1, .9, 0.1, .9})
importTextEditor.OkayButton = okayButton
--cancel button
local cancelButton = DetailsFramework:CreateButton (importTextEditor, function() importWindow:Hide() end, 120, 20, "Cancel", -1, nil, nil, nil, nil, nil, _detalhes.gump:GetTemplate ("button", "OPTIONS_BUTTON_TEMPLATE"), _detalhes.gump:GetTemplate ("font", "OPTIONS_FONT_TEMPLATE")) --> localize-me
cancelButton:SetIcon ([[Interface\BUTTONS\UI-Panel-MinimizeButton-Up]], 20, 20, "overlay", {0.1, .9, 0.1, .9})
okayButton:SetPoint ("topright", importTextEditor, "bottomright", 0, -10)
cancelButton:SetPoint ("right", okayButton, "left", -20, 0)
end
DetailsExportWindow.ConfirmFunction = confirmFunc
DetailsExportWindow.ImportEditor:SetText (defaultText or "")
DetailsExportWindow:Show()
titleText = titleText or "Details! Dump String"
DetailsExportWindow.Title:SetText (titleText)
C_Timer.After (.2, function()
DetailsExportWindow.ImportEditor:SetFocus (true)
DetailsExportWindow.ImportEditor.editbox:HighlightText (0)
end)
end
+189 -3
View File
@@ -561,10 +561,8 @@ function _detalhes:ApplyProfile (profile_name, nosave, is_copy)
if (_detalhes.initializing) then
_detalhes.profile_loaded = true
end
--> end
return true
return true
end
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
@@ -1156,6 +1154,8 @@ local default_profile = {
_detalhes.default_profile = default_profile
-- aqui fica as propriedades do jogador que no sero armazenadas no profile
local default_player_data = {
@@ -1514,3 +1514,189 @@ function _detalhes:RestoreState_CurrentMythicDungeonRun()
savedTable.started = false
end
end
--------------------------------------------------------------------------------------------------------------------------------------------
--~export ~ import ~profile
local exportProfileBlacklist = {
custom = true,
cached_specs = true,
cached_talents = true,
combat_id = true,
combat_counter = true,
mythic_dungeon_currentsaved = true,
nick_tag_cache = true,
plugin_database = true,
character_data = true,
active_profile = true,
SoloTablesSaved = true,
RaidTablesSaved = true,
savedStyles = true,
benchmark_db = true,
rank_window = true,
last_realversion = true,
last_version = true,
__profiles = true,
latest_news_saw = true,
always_use_profile = true,
always_use_profile_name = true,
always_use_profile_exception = true,
savedStyles = true,
savedTimeCaptures = true,
lastUpdateWarning = true,
spell_school_cache = true,
global_plugin_database = true,
details_auras = true,
item_level_pool = true,
latest_report_table = true,
boss_mods_timers = true,
spell_pool = true,
encounter_spell_pool = true,
npcid_pool = true,
createauraframe = true,
mythic_plus = true,
plugin_window_pos = true,
switchSaved = true,
}
--transform the current profile into a string which can be shared in the internet
function Details:ExportCurrentProfile()
--save the current profile
Details:SaveProfile()
--data saved inside the profile
local profileObject = Details:GetProfile (Details:GetCurrentProfileName())
if (not profileObject) then
Details:Msg ("fail to get the current profile.")
return false
end
--data saved individual for each character
local defaultPlayerData = Details.default_player_data
local playerData = {}
--data saved for the account
local defaultGlobalData = Details.default_global_data
local globaData = {}
--fill player and global data tables
for key, _ in pairs (defaultPlayerData) do
if (not exportProfileBlacklist[key]) then
if (type (Details[key]) == "table") then
playerData [key] = DetailsFramework.table.copy ({}, Details[key])
else
playerData [key] = Details[key]
end
end
end
for key, _ in pairs (defaultGlobalData) do
if (not exportProfileBlacklist[key]) then
if (type (Details[key]) == "table") then
globaData [key] = DetailsFramework.table.copy ({}, Details[key])
else
globaData [key] = Details[key]
end
end
end
local exportedData = {
profile = profileObject,
playerData = playerData,
globaData = globaData,
version = 1,
}
local compressedData = Details:CompressData (exportedData, "print")
return compressedData
end
function Details:ImportProfile (profileString, newProfileName)
if (not newProfileName or type (newProfileName) ~= "string" or string.len (newProfileName) < 2) then
Details:Msg ("invalid profile name or profile name is too short.") --localize-me
return
end
profileString = DetailsFramework:Trim (profileString)
local currentDataVersion = 1
local dataTable = Details:DecompressData (profileString, "print")
if (dataTable) then
local profileObject = Details:GetProfile (newProfileName, false)
if (not profileObject) then
--profile doesn't exists, create new
profileObject = Details:CreateProfile (newProfileName)
if (not profileObject) then
Details:Msg ("failed to create a new profile.")--localize-me
return
end
end
local profileData, playerData, globalData, version = dataTable.profile, dataTable.playerData, dataTable.globaData, dataTable.version
if (version < currentDataVersion) then
--perform update in the sereived settings
end
--character data defaults
local defaultPlayerData = Details.default_player_data
--global data defaults
local defaultGlobalData = Details.default_global_data
--profile defaults
local defaultProfileData = Details.default_profile
--transfer player and global data tables from the profile to details object
for key, _ in pairs (defaultPlayerData) do
local importedValue = playerData[key]
if (importedValue ~= nil) then
if (type (importedValue) == "table") then
Details [key] = DetailsFramework.table.copy ({}, importedValue)
else
Details [key] = importedValue
end
end
end
for key, _ in pairs (defaultGlobalData) do
local importedValue = globalData[key]
if (importedValue ~= nil) then
if (type (importedValue) == "table") then
Details [key] = DetailsFramework.table.copy ({}, importedValue)
else
Details [key] = importedValue
end
end
end
--transfer data from the imported profile to the new profile object
for key, _ in pairs (defaultProfileData) do
local importedValue = profileData[key]
if (importedValue ~= nil) then
if (type (importedValue) == "table") then
profileObject [key] = DetailsFramework.table.copy ({}, importedValue)
else
profileObject [key] = importedValue
end
end
end
--transfer instance data to the new created profile
profileObject.instances = DetailsFramework.table.copy ({}, profileData.instances)
Details:ApplyProfile (newProfileName)
Details:Msg ("profile successfully imported.")--localize-me
return true
else
Details:Msg ("failed to decompress profile data.")--localize-me
end
end
+85 -105
View File
@@ -5188,11 +5188,11 @@ function window:CreateFrame13()
window:CreateLineBackground2 (frame13, select_profileErase_dropdown, select_profileErase_label, Loc ["STRING_OPTIONS_PROFILES_ERASE_DESC"])
--> reset profile
function _detalhes:RefreshOptionsAfterProfileReset()
_detalhes:OpenOptionsWindow (_detalhes:GetInstance(1))
end
local reset_profile = function()
local current_instance = _G.DetailsOptionsWindow.instance
_detalhes:ResetProfile (_detalhes:GetCurrentProfileName())
@@ -5200,7 +5200,6 @@ function window:CreateFrame13()
end
local profile_reset_button = g:NewButton (frame13, _, "$parentProfileResetButton", "profileResetButton", window.buttons_width, 18, reset_profile, nil, nil, nil, Loc ["STRING_OPTIONS_PROFILES_RESET"], nil, options_button_template)
--profile_reset_button:InstallCustomTexture (nil, nil, nil, nil, nil, true)
frame13.profileResetButton:SetIcon ([[Interface\Buttons\UI-RefreshButton]], 14, 14, nil, {0, 1, 0, 0.9375}, nil, 4, 2)
frame13.profileResetButton:SetTextColor (button_color_rgb)
@@ -5209,6 +5208,57 @@ function window:CreateFrame13()
window:CreateLineBackground2 (frame13, "profileResetButton", "profileResetButton", Loc ["STRING_OPTIONS_PROFILES_RESET_DESC"], nil, {1, 0.8, 0}, button_color_rgb)
--> import export functions
local export_profile = function()
local str = Details:ExportCurrentProfile()
if (str) then
_detalhes:ShowImportWindow (str, nil, "Details! Export Profile")
--[=[ debug
local uncompress = Details:DecompressData (str, "print")
if (uncompress) then
Details:Dump (uncompress)
else
print ("failed...")
end
--]=]
end
end
local import_profile = function()
--when clicking in the okay button in the import window, it send the text in the first argument
_detalhes:ShowImportWindow ("", function (profileString)
if (type (profileString) ~= "string" or string.len (profileString) < 2) then
return
end
--prompt text panel returns what the user inserted in the text field in the first argument
DetailsFramework:ShowTextPromptPanel ("Insert a Name for the New Profile:", function (newProfileName)
Details:ImportProfile (profileString, newProfileName)
end)
end, "Details! Import Profile (paste string)")
end
--> import profile
local profileImportButton = g:NewButton (frame13, _, "$parentProfileImportButton", "profileImportButton", window.buttons_width, 18, import_profile, nil, nil, nil, "Import Profile", nil, options_button_template) --> localize-me
frame13.profileImportButton:SetIcon ([[Interface\BUTTONS\UI-GuildButton-OfficerNote-Up]], 14, 14, nil, {0, 1, 0, 1}, nil, 4, 2)
frame13.profileImportButton:SetTextColor (button_color_rgb)
local hiddenlabel = g:NewLabel (frame13, _, "$parentProfileImportButtonLabel", "profileImportButtonLabel", "", "GameFontHighlightLeft")
hiddenlabel:SetPoint ("left", profileImportButton, "left")
window:CreateLineBackground2 (frame13, "profileImportButton", "profileImportButton", "Import current profile", nil, {1, 0.8, 0}, button_color_rgb)
--> export profile
local profileExportButton = g:NewButton (frame13, _, "$parentProfileExportButton", "profileExportButton", window.buttons_width, 18, export_profile, nil, nil, nil, "Export Current Profile", nil, options_button_template) --> localize-me
frame13.profileExportButton:SetIcon ([[Interface\Buttons\UI-GuildButton-MOTD-Up]], 14, 14, nil, {1, 0, 0, 1}, nil, 4, 2)
frame13.profileExportButton:SetTextColor (button_color_rgb)
local hiddenlabel = g:NewLabel (frame13, _, "$parentProfileExportButtonLabel", "profileExportButtonLabel", "", "GameFontHighlightLeft")
hiddenlabel:SetPoint ("left", profileExportButton, "left")
window:CreateLineBackground2 (frame13, "profileExportButton", "profileExportButton", "Export current profile", nil, {1, 0.8, 0}, button_color_rgb)
--> save window position within profile
g:NewLabel (frame13, _, "$parentSavePosAndSizeLabel", "PosAndSizeLabel", Loc ["STRING_OPTIONS_PROFILE_POSSIZE"], "GameFontHighlightLeft")
@@ -5245,6 +5295,8 @@ function window:CreateFrame13()
{select_profileCopy_label, 7},
{select_profileErase_label, 8},
{profile_reset_button, 9, true},
{profileExportButton},
{profileImportButton},
}
@@ -5312,69 +5364,6 @@ function window:CreateFrame3()
self:GetNormalTexture():SetBlendMode("BLEND")
end)
--> import box
function frame3:CreateImportBox()
local textbox = g:NewSpecialLuaEditorEntry (frame3, 443, 80, "TextBox", "$parentTextBox", true)
textbox:SetPoint ("bottomleft", frame3, "bottomleft", 30, 30)
textbox:SetFrameLevel (frame3:GetFrameLevel()+6)
textbox:SetBackdrop ({bgFile = [[Interface\AddOns\Details\images\background]], edgeFile = [[Interface\Tooltips\UI-Tooltip-Border]],
tile = 1, tileSize = 16, edgeSize = 16, insets = {left = 5, right = 5, top = 5, bottom = 5}})
textbox:SetBackdropColor (0, 0, 0, 1)
textbox:Hide()
frame3.TextBox.editbox:SetScript ("OnEditFocusGained", function (self) self:HighlightText() end)
local close_export_box = function()
textbox:ClearFocus()
textbox:Hide()
end
--export
local close_export = g:NewButton (textbox, nil, "$parentClose", "export_close_button", 24, 24, close_export_box, nil, nil, [[Interface\Buttons\UI-CheckBox-Check]])
close_export:SetPoint (10, 18)
local close_export_label = g:NewLabel (textbox, nil, nil, "export_close", Loc ["STRING_OPTIONS_CHART_CLOSE"])
close_export_label:SetPoint ("left", close_export, "right", 2, 0)
local copy_export_label = g:NewLabel (textbox, nil, nil, "export_copy", Loc ["STRING_OPTIONS_SAVELOAD_EXPORT_COPY"])
copy_export_label:SetPoint ("bottomright", textbox, "topright", -6, 1)
--import
local doimport = function()
local text = textbox:GetText()
local decode = _detalhes._encode:Decode (text)
if (type (decode) ~= "string") then
_detalhes:Msg (Loc ["STRING_CUSTOM_IMPORT_ERROR"])
return
end
local unserialize = select (2, _detalhes:Deserialize (decode))
if (type (unserialize) == "table") then
_detalhes.savedStyles [#_detalhes.savedStyles+1] = unserialize
_detalhes:Msg (Loc ["STRING_OPTIONS_SAVELOAD_IMPORT_OKEY"])
textbox:Hide()
else
_detalhes:Msg (Loc ["STRING_CUSTOM_IMPORT_ERROR"])
return
end
end
local accept_import = g:NewButton (textbox, nil, "$parentAccept", "import_accept_button", 24, 24, doimport, nil, nil, [[Interface\Buttons\UI-CheckBox-Check]])
accept_import:SetPoint (10, 18)
local accept_import_label = g:NewLabel (textbox, nil, nil, "import_accept_label", Loc ["STRING_OPTIONS_CHART_IMPORT"])
accept_import_label:SetPoint ("left", accept_import, "right", 2, 0)
local cancel_changes = g:NewButton (textbox, nil, "$parentCancel", "import_cancel_button", 20, 20, close_export_box, nil, nil, [[Interface\PetBattles\DeadPetIcon]])
cancel_changes:SetPoint (100, 17)
local cancel_changes_label = g:NewLabel (textbox, nil, nil, "import_cancel_label", Loc ["STRING_OPTIONS_CHART_CANCEL"])
cancel_changes_label:SetPoint ("left", cancel_changes, "right", 2, 0)
end
--> Skin
local titulo_skin = g:NewLabel (frame3, _, "$parentTituloSkin", "tituloSkinLabel", Loc ["STRING_OPTIONS_SKIN_A"], "GameFontNormal", 16)
local titulo_skin_desc = g:NewLabel (frame3, _, "$parentTituloSkin2", "tituloSkin2Label", Loc ["STRING_OPTIONS_SKIN_A_DESC"], "GameFontNormal", 10, "white")
@@ -5568,11 +5557,9 @@ function window:CreateFrame3()
g:NewLabel (frame3, _, "$parentmakeDefaultLabel", "makeDefaultLabel", "", "GameFontHighlightLeft")
g:NewButton (frame3, _, "$parentToAllStyleButton", "applyToAll", 160, 18, applyToAll, nil, nil, nil, Loc ["STRING_OPTIONS_SAVELOAD_APPLYTOALL"], 1, options_button_template)
--frame3.applyToAll:InstallCustomTexture (nil, nil, nil, nil, nil, true)
window:CreateLineBackground2 (frame3, "applyToAll", "applyToAll", Loc ["STRING_OPTIONS_SAVELOAD_APPLYALL_DESC"], nil, {1, 0.8, 0}, button_color_rgb)
g:NewButton (frame3, _, "$parentMakeDefaultButton", "makeDefault", 160, 18, makeDefault, nil, nil, nil, Loc ["STRING_OPTIONS_SAVELOAD_MAKEDEFAULT"], nil, options_button_template)
--frame3.makeDefault:InstallCustomTexture (nil, nil, nil, nil, nil, true)
window:CreateLineBackground2 (frame3, "makeDefault", "makeDefault", Loc ["STRING_OPTIONS_SAVELOAD_STD_DESC"], nil, {1, 0.8, 0}, button_color_rgb)
frame3.toAllStyleLabel:SetPoint ("left", frame3.applyToAll, "left")
@@ -5699,28 +5686,12 @@ function window:CreateFrame3()
g:NewLabel (frame3, _, "$parentExportCustomSkinLabel", "ExportCustomSkinLabel", Loc ["STRING_OPTIONS_SAVELOAD_EXPORT"], "GameFontHighlightLeft")
--
local onSelectCustomSkinToExport = function (_, _, index)
if (not frame3.TextBox) then
frame3:CreateImportBox()
local compressedData = Details:CompressData (_detalhes.savedStyles [index], "print")
if (compressedData) then
_detalhes:ShowImportWindow (compressedData, nil, "Details! Export Skin")
else
Details:Msg ("failed to export skin.") --localize-me
end
frame3.TextBox.import_accept_button:Hide()
frame3.TextBox.import_accept_label:Hide()
frame3.TextBox.import_cancel_button:Hide()
frame3.TextBox.import_cancel_label:Hide()
frame3.TextBox.export_close_button:Show()
frame3.TextBox.export_close:Show()
frame3.TextBox.export_copy:Show()
frame3.TextBox:Show()
local serialized = _detalhes:Serialize (_detalhes.savedStyles [index])
local encoded = _detalhes._encode:Encode (serialized)
frame3.TextBox:SetText (encoded)
frame3.TextBox.editbox:HighlightText()
frame3.TextBox.editbox:SetFocus (true)
_G.DetailsOptionsWindow3CustomSkinExportDropdown.MyObject:Select (false)
end
@@ -5743,22 +5714,29 @@ function window:CreateFrame3()
--> Import Button
local import_saved = function()
if (not frame3.TextBox) then
frame3:CreateImportBox()
end
--when clicking in the okay button in the import window, it send the text in the first argument
_detalhes:ShowImportWindow ("", function (skinString)
if (type (skinString) ~= "string" or string.len (skinString) < 2) then
return
end
skinString = DetailsFramework:Trim (skinString)
local dataTable = Details:DecompressData (skinString, "print")
if (dataTable) then
--add the new skin
_detalhes.savedStyles [#_detalhes.savedStyles+1] = dataTable
_detalhes:Msg (Loc ["STRING_OPTIONS_SAVELOAD_IMPORT_OKEY"])
--refresh skin dropdowns
_G.DetailsOptionsWindow3CustomSkinLoadDropdown.MyObject:Refresh()
_G.DetailsOptionsWindow3CustomSkinRemoveDropdown.MyObject:Refresh()
_G.DetailsOptionsWindow3CustomSkinExportDropdown.MyObject:Refresh()
else
Details:Msg (Loc ["STRING_CUSTOM_IMPORT_ERROR"])
end
frame3.TextBox.import_accept_button:Show()
frame3.TextBox.import_accept_label:Show()
frame3.TextBox.import_cancel_button:Show()
frame3.TextBox.import_cancel_label:Show()
frame3.TextBox.export_close_button:Hide()
frame3.TextBox.export_close:Hide()
frame3.TextBox.export_copy:Hide()
frame3.TextBox:SetText ("")
frame3.TextBox:Show()
frame3.TextBox:SetFocus (true)
end, "Details! Import Skin (paste string)") --localize-me
end
@@ -5882,6 +5860,7 @@ function window:CreateFrame3()
--general anchor
g:NewLabel (frame3, _, "$parentSkinSelectionAnchor", "SkinSelectionAnchorLabel", Loc ["STRING_OPTIONS_SKIN_SELECT_ANCHOR"], "GameFontNormal")
g:NewLabel (frame3, _, "$parentSkinPresetAnchor", "SkinPresetAnchorLabel", Loc ["STRING_OPTIONS_SKIN_PRESETS_ANCHOR"], "GameFontNormal")
g:NewLabel (frame3, _, "$parentSkinPresetConfigAnchor", "SkinPresetConfigAnchorLabel", Loc ["STRING_OPTIONS_SKIN_PRESETSCONFIG_ANCHOR"], "GameFontNormal")
frame3.saveStyle:SetPoint ("left", frame3.saveStyleName, "right", 2)
@@ -5897,7 +5876,8 @@ function window:CreateFrame3()
{"SkinPresetAnchorLabel", 4, true},
{"saveSkinLabel", 5},
{"loadCustomSkinLabel", 6, true},
{"SkinPresetConfigAnchorLabel", 6, true},
{"loadCustomSkinLabel"},
{"removeCustomSkinLabel", 7},
{"ExportCustomSkinLabel", 8},
+12 -3
View File
@@ -2210,16 +2210,24 @@ local icon_frame_on_enter = function (self)
local got_info
if (ilvl) then
GameCooltip:AddLine (STAT_AVERAGE_ITEM_LEVEL .. ":" , ilvl and "|T:" .. 24 .. ":" .. 24 ..":0:0:64:64:4:60:4:60|t" .. floor (ilvl.ilvl) or "|T:" .. 24 .. ":" .. 24 ..":0:0:64:64:4:60:4:60|t ??") --> Loc from GlobalStrings.lua
GameCooltip:AddIcon ([[]], 1, 1, 1, 20)
_detalhes:AddTooltipBackgroundStatusbar()
got_info = true
else
GameCooltip:AddLine (STAT_AVERAGE_ITEM_LEVEL .. ":" , 0)
GameCooltip:AddIcon ([[]], 1, 1, 1, 20)
_detalhes:AddTooltipBackgroundStatusbar()
got_info = true
end
if (talent_string ~= "") then
GameCooltip:AddLine (TALENTS .. ":", talent_string) --> Loc from GlobalStrings.lua
GameCooltip:AddIcon ([[]], 1, 1, 1, 24)
_detalhes:AddTooltipBackgroundStatusbar()
got_info = true
elseif (got_info) then
GameCooltip:AddLine (TALENTS .. ":", Loc ["STRING_QUERY_INSPECT_REFRESH"]) --> Loc from GlobalStrings.lua
GameCooltip:AddIcon ([[]], 1, 1, 1, 24)
_detalhes:AddTooltipBackgroundStatusbar()
end
@@ -2227,7 +2235,7 @@ local icon_frame_on_enter = function (self)
GameCooltip:SetOption ("MinButtonHeight", 15)
GameCooltip:SetOption ("IgnoreButtonAutoHeight", false)
local height = 64
local height = 66
if (not got_info) then
GameCooltip:AddLine (Loc ["STRING_QUERY_INSPECT"], nil, 1, "orange")
GameCooltip:AddIcon ([[Interface\TUTORIALFRAME\UI-TUTORIAL-FRAME]], 1, 1, 12, icon_size, 8/512, 70/512, 224/512, 306/512)
@@ -2273,10 +2281,11 @@ local icon_frame_on_enter = function (self)
local dpsValue = _detalhes:comma_value_raw (realDps)
if (dpsValue) then
local total, decimal = strsplit (".", dpsValue)
total = total .. "." .. (decimal and decimal:match("^%d"))
total = total-- .. "." .. (decimal and decimal:match("^%d"))
GameCooltip:AddLine ("Dps:", total)
_detalhes:AddTooltipBackgroundStatusbar()
GameCooltip:AddIcon ("", 1, 1, 1, 18)
GameCooltip:AddIcon ("", 1, 1, 1, 20)
height = height + 21
end
end