Quantcast

- TitanClassicRepair: Removed a lot of unneeded code. Added a bunch of needed code. Just coding, forever and ever and ever.

HonorGoG [03-24-20 - 22:41]
- TitanClassicRepair: Removed a lot of unneeded code.  Added a bunch of needed code.  Just coding, forever and ever and ever.
Filename
TitanClassicRepair/TitanClassicRepair.lua
diff --git a/TitanClassicRepair/TitanClassicRepair.lua b/TitanClassicRepair/TitanClassicRepair.lua
index 201fe91..e256f74 100644
--- a/TitanClassicRepair/TitanClassicRepair.lua
+++ b/TitanClassicRepair/TitanClassicRepair.lua
@@ -106,8 +106,8 @@ function TitanPanelRepairButton_OnLoad(self)
 			AutoRepair = false,
 			DiscountFriendly = false,
 			DiscountHonored = false,
-			DiscountRevered = false,
-			DiscountExalted = false,
+			DiscountPVP = false,
+			DiscountCombined = false,
 			ShowPercentage = false,
 			ShowColoredText = false,
 			ShowInventory = false,
@@ -733,38 +733,27 @@ function TitanRepair_GetStatusStr(index, short)
 	-- local item_cost = TitanRepair_GetCostStr(item_status.cost);
 	local item_cost = TitanPanelRepair_GetTextGSC(item_status.values.cost);
 	if (not TPR.MerchantisOpen) and (not TPR.WholeScanInProgress) then
---[[
-		if TitanGetVar(TITAN_REPAIR_ID, "DiscountFriendly") then
-			item_cost = TitanPanelRepair_GetTextGSC(item_status.values.cost * 0.95);
-		elseif TitanGetVar(TITAN_REPAIR_ID, "DiscountHonored") then
-			item_cost = TitanPanelRepair_GetTextGSC(item_status.values.cost * 0.90);
-		elseif TitanGetVar(TITAN_REPAIR_ID, "DiscountRevered") then
-			item_cost = TitanPanelRepair_GetTextGSC(item_status.values.cost * 0.85);
-		elseif TitanGetVar(TITAN_REPAIR_ID, "DiscountExalted") then
-			item_cost = TitanPanelRepair_GetTextGSC(item_status.values.cost * 0.80);
-		end
-]]
 		if TitanGetVar(TITAN_REPAIR_ID, "DiscountHonored") then
 			item_cost = TitanPanelRepair_GetTextGSC(item_status.values.cost * 0.90);
+		elseif TitanGetVar(TITAN_REPAIR_ID, "DiscountPVP") then
+			item_cost = TitanPanelRepair_GetTextGSC(item_status.values.cost * 0.90);
+		elseif TitanGetVar(TITAN_REPAIR_ID, "DiscountCombined") then
+			item_cost = TitanPanelRepair_GetTextGSC(item_status.values.cost * 0.80);
 		end
 	end

 	if ((not short) and item_cost and TitanGetVar(TITAN_REPAIR_ID,"ShowRepairCost")) then
 		if (not TPR.MerchantisOpen) and (not TPR.WholeScanInProgress) then
---[[			if TitanGetVar(TITAN_REPAIR_ID, "DiscountFriendly") then
-				valueText = valueText .. "\t" .. item_cost..TitanUtils_GetGreenText(" ("..FACTION_STANDING_LABEL5..")");
-			elseif TitanGetVar(TITAN_REPAIR_ID, "DiscountHonored") then
-				valueText = valueText .. "\t" .. item_cost..TitanUtils_GetGreenText(" ("..FACTION_STANDING_LABEL6..")");
-			elseif TitanGetVar(TITAN_REPAIR_ID, "DiscountRevered") then
-				valueText = valueText .. "\t" .. item_cost..TitanUtils_GetGreenText(" ("..FACTION_STANDING_LABEL7..")");
-			elseif TitanGetVar(TITAN_REPAIR_ID, "DiscountExalted") then
-				valueText = valueText .. "\t" .. item_cost..TitanUtils_GetGreenText(" ("..FACTION_STANDING_LABEL8..")");
-			else
-				valueText = valueText .. "\t" .. item_cost;
-			end
-]]
 			if TitanGetVar(TITAN_REPAIR_ID, "DiscountHonored") then
 				valueText = valueText .. "\t" .. item_cost..TitanUtils_GetGreenText(" ("..FACTION_STANDING_LABEL6..")");
+			elseif TitanGetVar(TITAN_REPAIR_ID, "DiscountPVP") then
+                local start=string.find("(",L["REPAIR_LOCALE"]["pvp"]);
+                local stop=string.find(")",L["REPAIR_LOCALE"]["pvp"],start+1);
+				valueText = valueText .. "\t" .. item_cost..TitanUtils_GetGreenText(" ("..string.sub(L["REPAIR_LOCALE"]["pvp"], start+1, stop-1)..")");
+			elseif TitanGetVar(TITAN_REPAIR_ID, "DiscountCombined") then
+                local start=string.find("(",L["REPAIR_LOCALE"]["combined"]);
+                local stop=string.find(")",L["REPAIR_LOCALE"]["combined"],start+1);
+				valueText = valueText .. "\t" .. item_cost..TitanUtils_GetGreenText(" ("..string.sub(L["REPAIR_LOCALE"]["combined"], start+1, stop-1)..")");
 			else
 				valueText = valueText .. "\t" .. item_cost;
 			end
@@ -954,23 +943,19 @@ function TitanPanelRepairButton_GetButtonText(id)
 		end

 		if (not TPR.MerchantisOpen or (TPR.MerchantisOpen and not canRepair)) then
---[[			if TitanGetVar(TITAN_REPAIR_ID, "DiscountFriendly") then
-				sum = sum * 0.95;
-				discountlabel = FACTION_STANDING_LABEL5;
-			elseif TitanGetVar(TITAN_REPAIR_ID, "DiscountHonored") then
-				sum = sum * 0.90;
-				discountlabel = FACTION_STANDING_LABEL6;
-			elseif TitanGetVar(TITAN_REPAIR_ID, "DiscountRevered") then
-				sum = sum * 0.85;
-				discountlabel = FACTION_STANDING_LABEL7;
-			elseif TitanGetVar(TITAN_REPAIR_ID, "DiscountExalted") then
-				sum = sum * 0.80;
-				discountlabel = FACTION_STANDING_LABEL8;
-			end  -- if merchant
-]]
 			if TitanGetVar(TITAN_REPAIR_ID, "DiscountHonored") then
 				sum = sum * 0.90;
 				discountlabel = FACTION_STANDING_LABEL6;
+			elseif TitanGetVar(TITAN_REPAIR_ID, "DiscountPVP") then
+				sum = sum * 0.80;
+                local start=string.find("(",L["REPAIR_LOCALE"]["pvp"]);
+                local stop=string.find(")",L["REPAIR_LOCALE"]["pvp"],start+1);
+				discountlabel = string.sub(L["REPAIR_LOCALE"]["pvp"], start+1, stop-1);
+			elseif TitanGetVar(TITAN_REPAIR_ID, "DiscountCombined") then
+				sum = sum * 0.80;
+                local start=string.find("(",L["REPAIR_LOCALE"]["combined"]);
+                local stop=string.find(")",L["REPAIR_LOCALE"]["combined"],start+1);
+				discountlabel = string.sub(L["REPAIR_LOCALE"]["combined"], start+1, stop-1);
 			end  -- if merchant
 		end  -- if discounts

@@ -1140,71 +1125,52 @@ local info;

 			info = {};
 			info.text = L["REPAIR_LOCALE"]["buttonNormal"];
-			--info.checked = not TitanGetVar(TITAN_REPAIR_ID,"DiscountFriendly") and not TitanGetVar(TITAN_REPAIR_ID,"DiscountHonored") and not TitanGetVar(TITAN_REPAIR_ID,"DiscountRevered") and not TitanGetVar(TITAN_REPAIR_ID,"DiscountExalted");
-			info.checked = not TitanGetVar(TITAN_REPAIR_ID,"DiscountHonored");
+			info.checked = not TitanGetVar(TITAN_REPAIR_ID,"DiscountHonored") and not TitanGetVar(TITAN_REPAIR_ID,"DiscountPVP") and not TitanGetVar(TITAN_REPAIR_ID,"DiscountCombined");
 			info.disabled = TPR.MerchantisOpen;
 			info.func = function()
-				--TitanSetVar(TITAN_REPAIR_ID,"DiscountFriendly", nil)
 				TitanSetVar(TITAN_REPAIR_ID,"DiscountHonored", nil)
-				--TitanSetVar(TITAN_REPAIR_ID,"DiscountRevered", nil)
-				--TitanSetVar(TITAN_REPAIR_ID,"DiscountExalted", nil)
+				TitanSetVar(TITAN_REPAIR_ID,"DiscountPVP", nil)
+				TitanSetVar(TITAN_REPAIR_ID,"DiscountCombined", nil)
 				TitanPanelButton_UpdateButton(TITAN_REPAIR_ID)
 			end
 			L_UIDropDownMenu_AddButton(info, _G["L_UIDROPDOWNMENU_MENU_LEVEL"]);

---[[
-			info = {};
-			info.text = L["REPAIR_LOCALE"]["buttonFriendly"];
-			info.checked = TitanGetVar(TITAN_REPAIR_ID,"DiscountFriendly");
-			info.disabled = TPR.MerchantisOpen;
-			info.func = function()
-				TitanSetVar(TITAN_REPAIR_ID,"DiscountFriendly", 1)
-				TitanSetVar(TITAN_REPAIR_ID,"DiscountHonored", nil)
-				TitanSetVar(TITAN_REPAIR_ID,"DiscountRevered", nil)
-				TitanSetVar(TITAN_REPAIR_ID,"DiscountExalted", nil)
-				TitanPanelButton_UpdateButton(TITAN_REPAIR_ID)
-			end
-			L_UIDropDownMenu_AddButton(info, _G["L_UIDROPDOWNMENU_MENU_LEVEL"]);
-]]
 			info = {};
 			info.text = L["REPAIR_LOCALE"]["buttonHonored"];
 			info.checked = TitanGetVar(TITAN_REPAIR_ID,"DiscountHonored");
 			info.disabled = TPR.MerchantisOpen;
 			info.func = function()
-				--TitanSetVar(TITAN_REPAIR_ID,"DiscountFriendly", nil)
 				TitanSetVar(TITAN_REPAIR_ID,"DiscountHonored", 1)
-				--TitanSetVar(TITAN_REPAIR_ID,"DiscountRevered", nil)
-				--TitanSetVar(TITAN_REPAIR_ID,"DiscountExalted", nil)
+				TitanSetVar(TITAN_REPAIR_ID,"DiscountPVP", nil)
+				TitanSetVar(TITAN_REPAIR_ID,"DiscountCombined", nil)
 				TitanPanelButton_UpdateButton(TITAN_REPAIR_ID)
 			end
 			L_UIDropDownMenu_AddButton(info, _G["L_UIDROPDOWNMENU_MENU_LEVEL"]);
---[[
+
 			info = {};
-			info.text = L["REPAIR_LOCALE"]["buttonRevered"];
-			info.checked = TitanGetVar(TITAN_REPAIR_ID,"DiscountRevered");
+			info.text = L["REPAIR_LOCALE"]["buttonPVP"];
+			info.checked = TitanGetVar(TITAN_REPAIR_ID,"DiscountPVP");
 			info.disabled = TPR.MerchantisOpen;
 			info.func = function()
-				TitanSetVar(TITAN_REPAIR_ID,"DiscountFriendly", nil)
 				TitanSetVar(TITAN_REPAIR_ID,"DiscountHonored", nil)
-				TitanSetVar(TITAN_REPAIR_ID,"DiscountRevered", 1)
-				TitanSetVar(TITAN_REPAIR_ID,"DiscountExalted", nil)
+				TitanSetVar(TITAN_REPAIR_ID,"DiscountPVP", 1)
+				TitanSetVar(TITAN_REPAIR_ID,"DiscountCombined", nil)
 				TitanPanelButton_UpdateButton(TITAN_REPAIR_ID)
 			end
 			L_UIDropDownMenu_AddButton(info, _G["L_UIDROPDOWNMENU_MENU_LEVEL"]);

 			info = {};
-			info.text = L["REPAIR_LOCALE"]["buttonExalted"];
-			info.checked = TitanGetVar(TITAN_REPAIR_ID,"DiscountExalted");
+			info.text = L["REPAIR_LOCALE"]["buttonCombined"];
+			info.checked = TitanGetVar(TITAN_REPAIR_ID,"DiscountCombined");
 			info.disabled = TPR.MerchantisOpen;
 			info.func = function()
-				TitanSetVar(TITAN_REPAIR_ID,"DiscountFriendly", nil)
 				TitanSetVar(TITAN_REPAIR_ID,"DiscountHonored", nil)
-				TitanSetVar(TITAN_REPAIR_ID,"DiscountRevered", nil)
-				TitanSetVar(TITAN_REPAIR_ID,"DiscountExalted", 1)
+				TitanSetVar(TITAN_REPAIR_ID,"DiscountPVP", nil)
+				TitanSetVar(TITAN_REPAIR_ID,"DiscountCombined", 1)
 				TitanPanelButton_UpdateButton(TITAN_REPAIR_ID)
 			end
 			L_UIDropDownMenu_AddButton(info, _G["L_UIDROPDOWNMENU_MENU_LEVEL"]);
-]]
+
 		end

 		if _G["L_UIDROPDOWNMENU_MENU_VALUE"] == "Options" then
@@ -1282,27 +1248,6 @@ local info;
 			L_UIDropDownMenu_AddButton(info, _G["L_UIDROPDOWNMENU_MENU_LEVEL"]);
 		end

---[[
-		if _G["L_UIDROPDOWNMENU_MENU_VALUE"] == "GuildBank" then
-			totalGBCP = GetGuildBankMoney();
-			withdrawGBCP = GetGuildBankWithdrawMoney();
-			if IsGuildLeader() ~= true then
-				withdrawGB = TitanPanelRepair_GetTextGSC(withdrawGBCP);
-			end
-			totalGB = TitanPanelRepair_GetTextGSC(GetGuildBankMoney());
-			if (totalGBCP < withdrawGBCP) or IsGuildLeader() == true then
-				withdrawGB = totalGB;
-			end
-			TitanPanelRightClickMenu_AddTitle(L["TITAN_REPAIR_GBANK_TOTAL"].." "..totalGB, _G["L_UIDROPDOWNMENU_MENU_LEVEL"]);
-			TitanPanelRightClickMenu_AddTitle(L["TITAN_REPAIR_GBANK_WITHDRAW"].." "..withdrawGB, _G["L_UIDROPDOWNMENU_MENU_LEVEL"]);
-			info = {}
-			info.text = L["TITAN_REPAIR_GBANK_USEFUNDS"]
-			info.func = function() TitanToggleVar(TITAN_REPAIR_ID, "UseGuildBank"); end
-			info.checked = TitanGetVar(TITAN_REPAIR_ID,"UseGuildBank");
-			L_UIDropDownMenu_AddButton(info, _G["L_UIDROPDOWNMENU_MENU_LEVEL"]);
-		end
-]]
-
 		if _G["L_UIDROPDOWNMENU_MENU_VALUE"] == "TooltipOptions" then
 			TitanPanelRightClickMenu_AddTitle(L["REPAIR_LOCALE"]["TooltipOptions"], _G["L_UIDROPDOWNMENU_MENU_LEVEL"]);

@@ -1348,20 +1293,6 @@ local info;
 	info.hasArrow = 1;
 	L_UIDropDownMenu_AddButton(info);

---[[
-	local guildName, _, _ = GetGuildInfo("player")
-	info = {};
-	info.notCheckable = true
-	info.text = _G["GUILD_BANK"];
-	info.value = "GuildBank"
-	if guildName then
-		info.hasArrow = 1
-	else
-		info.disabled = true
-	end
-	L_UIDropDownMenu_AddButton(info);
-]]
-
 	info = {};
 	info.notCheckable = true
 	info.text = L["REPAIR_LOCALE"]["discount"];