Quantcast

More currency sorting. This closes #293 again

Darthpred [08-23-16 - 05:57]
More currency sorting. This closes #293 again
Filename
ElvUI_SLE/core/core.lua
ElvUI_SLE/defaults/private.lua
ElvUI_SLE/locales/english.lua
ElvUI_SLE/locales/russian.lua
ElvUI_SLE/modules/sledatatexts/currency.lua
ElvUI_SLE/options/datatexts/currency_c.lua
diff --git a/ElvUI_SLE/core/core.lua b/ElvUI_SLE/core/core.lua
index bddb1ee..0c535a4 100644
--- a/ElvUI_SLE/core/core.lua
+++ b/ElvUI_SLE/core/core.lua
@@ -136,6 +136,7 @@ function SLE:Initialize()
 	if E.private.sle.install_complete == nil or tonumber(E.private.sle.install_complete) < 3 then
 		E:GetModule("PluginInstaller"):Queue(SLE.installTable)
 	end
+	if not E.private.sle.characterGoldsSorting[E.myrealm] then E.private.sle.characterGoldsSorting[E.myrealm] = {} end

 	LibStub("LibElvUIPlugin-1.0"):RegisterPlugin(AddOnName, GetOptions) --Registering as plugin
 end
\ No newline at end of file
diff --git a/ElvUI_SLE/defaults/private.lua b/ElvUI_SLE/defaults/private.lua
index 8114760..8aba63d 100644
--- a/ElvUI_SLE/defaults/private.lua
+++ b/ElvUI_SLE/defaults/private.lua
@@ -187,7 +187,9 @@ V["sle"] = {
 		["level"] = 5,
 		["transparent"] = "Default",
 	},
-}
+
+	["characterGoldsSorting"] = {},
+	}

 G["sle"] = {
 	["DE"] = {
diff --git a/ElvUI_SLE/locales/english.lua b/ElvUI_SLE/locales/english.lua
index 1cd83e9..ddc3283 100644
--- a/ElvUI_SLE/locales/english.lua
+++ b/ElvUI_SLE/locales/english.lua
@@ -407,6 +407,7 @@ L["Gold Sorting"] = true
 L["Normal"] = true
 L["Reverced"] = true
 L["Amount"] = true
+L["Order of each toon. Smaller numbers will go first"] = true

 --Enhnced Shadows
 L["Enhanced Shadows"] = true
diff --git a/ElvUI_SLE/locales/russian.lua b/ElvUI_SLE/locales/russian.lua
index bf642e5..9c240fd 100644
--- a/ElvUI_SLE/locales/russian.lua
+++ b/ElvUI_SLE/locales/russian.lua
@@ -404,6 +404,7 @@ L["Gold Sorting"] = "Сортировка золота"
 L["Normal"] = "Нормальная"
 L["Reverced"] = "Обратная"
 L["Amount"] = "Количество"
+L["Order of each toon. Smaller numbers will go first"] = "Порядок персонажей. Показ в порядке возрастания номера."

 --Enhnced Shadows
 L["Enhanced Shadows"] = "Улучшенные тени"
diff --git a/ElvUI_SLE/modules/sledatatexts/currency.lua b/ElvUI_SLE/modules/sledatatexts/currency.lua
index 46c0c97..7f574eb 100644
--- a/ElvUI_SLE/modules/sledatatexts/currency.lua
+++ b/ElvUI_SLE/modules/sledatatexts/currency.lua
@@ -296,12 +296,14 @@ local function OnEnter(self)
 		if ElvDB["gold"][E.myrealm][k] then
 			local class = ElvDB["class"][E.myrealm][k]
 			local color = RAID_CLASS_COLORS[class or "PRIEST"]
+			local order = E.private.sle.characterGoldsSorting[E.myrealm][k] or 1
 			T.tinsert(ShownGold,
 				{
 					name = k,
 					amount = ElvDB["gold"][E.myrealm][k],
 					amountText = E:FormatMoney(ElvDB["gold"][E.myrealm][k], E.db.datatexts.goldFormat or "BLIZZARD", not E.db.datatexts.goldCoins),
 					r = color.r, g = color.g, b =color.b,
+					order = order,
 				}
 			)
 			if ElvDB["faction"][E.myrealm]["Alliance"][k] then
diff --git a/ElvUI_SLE/options/datatexts/currency_c.lua b/ElvUI_SLE/options/datatexts/currency_c.lua
index e0d3ae8..dae898b 100644
--- a/ElvUI_SLE/options/datatexts/currency_c.lua
+++ b/ElvUI_SLE/options/datatexts/currency_c.lua
@@ -28,6 +28,48 @@ local function configTable()
 		}
 		return config
 	end
+
+	local function CreateCustomToonList()
+		local config = {
+			name = CUSTOM,
+			order = 3,
+			type = "group",
+			guiInline = true,
+			hidden = function() return E.db.sle.dt.currency.gold.method ~= "order" end,
+			args = {
+				info = {
+					order = 1,
+					type = "description",
+					name = L["Order of each toon. Smaller numbers will go first"],
+				},
+			},
+		}
+		for k,_ in T.pairs(ElvDB["gold"][E.myrealm]) do
+			config.args[k] = {
+				type = "select",
+				name = k,
+				order = 10,
+				width = "half",
+				get = function(info) return (E.private.sle.characterGoldsSorting[E.myrealm][k] or 1) end,
+				set = function(info, value) E.private.sle.characterGoldsSorting[E.myrealm][k] = value end,
+				values = {
+					[1] = "1",
+					[2] = "2",
+					[3] = "3",
+					[4] = "4",
+					[5] = "5",
+					[6] = "6",
+					[7] = "7",
+					[8] = "8",
+					[9] = "9",
+					[10] = "10",
+					[11] = "11",
+					[12] = "12",
+				},
+			}
+		end
+		return config
+	end

 	E.Options.args.sle.args.modules.args.datatext.args.sldatatext.args.slcurrency = {
 		type = "group",
@@ -82,6 +124,7 @@ local function configTable()
 						order = 1,
 						type = "select",
 						name = L["Sort Direction"],
+						width = "half",
 						values = {
 							["normal"] = L["Normal"],
 							["reverced"] = L["Reverced"],
@@ -91,11 +134,14 @@ local function configTable()
 						order = 2,
 						type = "select",
 						name = L["Sort Method"],
+						width = "half",
 						values = {
 							["name"] = NAME,
 							["amount"] = L["Amount"],
+							["order"] = CUSTOM,
 						},
 					},
+					customSort = CreateCustomToonList(),
 				},
 			},
 			sortCurrency = {
@@ -110,6 +156,7 @@ local function configTable()
 						order = 1,
 						type = "select",
 						name = L["Direction"],
+						width = "half",
 						values = {
 							["normal"] = L["Normal"],
 							["reverced"] = L["Reverced"],
@@ -119,6 +166,7 @@ local function configTable()
 						order = 2,
 						type = "select",
 						name = L["Sort Method"],
+						width = "half",
 						values = {
 							["name"] = NAME,
 							["amount"] = L["Amount"],