From 221dffffe64b541f04c8c307edc9a682a31f53a1 Mon Sep 17 00:00:00 2001 From: Andrew <16847730+andrew6180@users.noreply.github.com> Date: Sun, 5 Feb 2023 17:43:09 -0700 Subject: [PATCH] Add support for new stats stuff, cvar changes, and auto vendoring. (#30) * Enhanced/CharacterFrame: Add new stat tooltips * Enhanced/CharacterFrame: crit is a percent of base crit * Enhanced/CharacterSheet: Update to use new cvar * ElvUI/Merchant: Remove auto sell gray / auto repair. Client handles these now. --- ElvUI/Core/Core.lua | 6 +- ElvUI/Modules/Bags/Bags.lua | 15 +--- ElvUI/Modules/Misc/Misc.lua | 76 ------------------- ElvUI/Modules/Skins/Blizzard/Merchant.lua | 13 +++- ElvUI/Settings/Global.lua | 1 - ElvUI/Settings/Profile.lua | 7 -- .../Modules/Blizzard/CharacterFrame.lua | 12 ++- ElvUI_OptionsUI/Bags.lua | 41 ---------- ElvUI_OptionsUI/General.lua | 15 +--- ElvUI_OptionsUI/ModuleControl.lua | 7 -- 10 files changed, 25 insertions(+), 168 deletions(-) diff --git a/ElvUI/Core/Core.lua b/ElvUI/Core/Core.lua index 5f6ec0e..a30bf24 100644 --- a/ElvUI/Core/Core.lua +++ b/ElvUI/Core/Core.lua @@ -1100,9 +1100,9 @@ function E:DBConversions() E.db.general.cropIcon = (cropIcon and 2) or 0 end - --Vendor Greys option is now in bags table - if E.db.general.vendorGrays then - E.db.bags.vendorGrays.enable = E.db.general.vendorGrays + --Vendor Greys option removed + if E.db.bags.vendorGrays.enable then + E.db.bags.vendorGrays.enable = nil E.db.general.vendorGrays = nil E.db.general.vendorGraysDetails = nil end diff --git a/ElvUI/Modules/Bags/Bags.lua b/ElvUI/Modules/Bags/Bags.lua index 3f7477e..5cd465c 100644 --- a/ElvUI/Modules/Bags/Bags.lua +++ b/ElvUI/Modules/Bags/Bags.lua @@ -1717,7 +1717,7 @@ function B:CreateSellFrame() B.SellFrame:Size(200, 40) B.SellFrame:Point("CENTER", E.UIParent) B.SellFrame:CreateBackdrop("Transparent") - B.SellFrame:SetAlpha(E.db.bags.vendorGrays.progressBar and 1 or 0) + B.SellFrame:SetAlpha(1) B.SellFrame:Hide() B.SellFrame.title = B.SellFrame:CreateFontString(nil, "OVERLAY") @@ -1738,23 +1738,14 @@ function B:CreateSellFrame() B.SellFrame.statusbar.ValueText:SetText("0 / 0 ( 0s )") B.SellFrame.Info = { - SellInterval = E.db.bags.vendorGrays.interval, - details = E.db.bags.vendorGrays.details, + SellInterval = 0.2, + details = false, itemList = {} } B.SellFrame:SetScript("OnUpdate", B.VendorGreys_OnUpdate) end -function B:UpdateSellFrameSettings() - if not B.SellFrame then return end - - B.SellFrame.Info.SellInterval = E.db.bags.vendorGrays.interval - B.SellFrame.Info.details = E.db.bags.vendorGrays.details - - B.SellFrame:SetAlpha(E.db.bags.vendorGrays.progressBar and 1 or 0) -end - B.BagIndice = { quiver = 0x0001, ammoPouch = 0x0002, diff --git a/ElvUI/Modules/Misc/Misc.lua b/ElvUI/Modules/Misc/Misc.lua index 9a6a6ff..691742e 100644 --- a/ElvUI/Modules/Misc/Misc.lua +++ b/ElvUI/Modules/Misc/Misc.lua @@ -142,63 +142,6 @@ do E:Print(format("%s%s", L["Your items have been repaired for: "], E:FormatMoney(repairAllCost, "SMART", true))) end - function M:AutoRepair(repairMode, greyValue) - if not CanMerchantRepair() or IsShiftKeyDown() then return end - - local repairAllCost, canRepair = GetRepairAllCost() - if not canRepair or repairAllCost <= 0 then return end - - if repairMode == "GUILD" then - if not CanGuildBankRepair() then - repairMode = "PLAYER" - else - local guildWithdrawMoney = GetGuildBankWithdrawMoney() - local guildMoney = GetGuildBankMoney() - local availableGuildMoney - - if guildWithdrawMoney == -1 or guildMoney < guildWithdrawMoney then - availableGuildMoney = guildMoney - else - availableGuildMoney = guildWithdrawMoney - end - - if repairAllCost > availableGuildMoney then - repairMode = "PLAYER" - end - end - end - - if repairMode == "GUILD" then - RepairAllItems(true) - - E:Print(format("%s%s", L["Your items have been repaired using guild bank funds for: "], E:FormatMoney(repairAllCost, "SMART", true))) - else - local playerMoney = GetMoney() - - if playerMoney >= repairAllCost then - RepairAllItems() - FullRepairMessage(repairAllCost) - elseif greyValue and playerMoney + greyValue >= repairAllCost then - self.playerMoney = playerMoney - self.repairAllCost = repairAllCost - - self:RegisterEvent("MERCHANT_CLOSED") - E.RegisterCallback(M, "VendorGreys_ItemSold") - elseif playerMoney > 0 then - local spent = RepairInventoryByPriority(playerMoney) - - if spent > 0 then - E:Print(format("%s%s", L["Your items have been repaired for: "], E:FormatMoney(spent, "SMART", true))) - E:Print(L["You don't have enough money to repair all items."]) - else - E:Print(L["You don't have enough money to repair."]) - end - else - E:Print(L["You don't have enough money to repair."]) - end - end - end - function M:VendorGreys_ItemSold(_, moneyGained) self.playerMoney = self.playerMoney + moneyGained @@ -232,24 +175,6 @@ do end end -function M:MERCHANT_SHOW() - local greyValue - - if E.db.bags.vendorGrays.enable then - local itemCount - itemCount, greyValue = Bags:GetGraysInfo() - - if itemCount > 0 then - Bags:VendorGrays() - end - end - - local repairMode = E.db.general.autoRepair - if repairMode ~= "NONE" then - E:Delay(0.03, self.AutoRepair, self, repairMode, greyValue) - end -end - function M:DisbandRaidGroup() if InCombatLockdown() then return end -- Prevent user error in combat @@ -338,7 +263,6 @@ function M:Initialize() self:RegisterEvent("CHAT_MSG_BG_SYSTEM_ALLIANCE", "PVPMessageEnhancement") self:RegisterEvent("CHAT_MSG_BG_SYSTEM_NEUTRAL", "PVPMessageEnhancement") self:RegisterEvent("PARTY_INVITE_REQUEST", "AutoInvite") - self:RegisterEvent("MERCHANT_SHOW") if E.private.actionbar.enable then self:RegisterEvent("CVAR_UPDATE", "ForceCVars") diff --git a/ElvUI/Modules/Skins/Blizzard/Merchant.lua b/ElvUI/Modules/Skins/Blizzard/Merchant.lua index 78cb8e8..5b91823 100644 --- a/ElvUI/Modules/Skins/Blizzard/Merchant.lua +++ b/ElvUI/Modules/Skins/Blizzard/Merchant.lua @@ -100,6 +100,8 @@ S:AddCallback("Skin_Merchant", function() S:HandleNextPrevButton(MerchantNextPageButton, nil, nil, true) S:HandleNextPrevButton(MerchantPrevPageButton, nil, nil, true) + S:HandleCheckBox(MerchantFrameSellJunkFrameAutoSellCheck) + S:HandleButton(MerchantRepairItemButton) MerchantRepairItemButton:StyleButton(false) -- texWidth, texHeight, cropWidth, cropHeight, offsetX, offsetY = 128, 64, 26, 26, 5, 6 @@ -128,6 +130,9 @@ S:AddCallback("Skin_Merchant", function() MerchantPrevPageButton:Point("CENTER", MerchantFrame, "BOTTOMLEFT", 37, 172) MerchantNextPageButton:Point("CENTER", MerchantFrame, "BOTTOMLEFT", 324, 172) + MerchantFrameSellJunkFrameAutoSellCheck:Point("BOTTOMLEFT", MerchantFrame, "BOTTOMLEFT", 18, 80) + MerchantRepairSettingsButton:Point("BOTTOM", MerchantFrame, "BOTTOM", -38, 112) + MerchantPageText:Point("BOTTOM", -14, 166) MerchantBuyBackItem:Point("TOPLEFT", MerchantItem10, "BOTTOMLEFT", 0, -39) @@ -144,11 +149,11 @@ S:AddCallback("Skin_Merchant", function() hooksecurefunc(MerchantRepairAllButton, "Show", function(self) -- CanMerchantRepair && CanGuildBankRepair if self:GetWidth() == 32 then - MerchantRepairText:SetPoint("CENTER", MerchantFrame, "BOTTOMLEFT", 94, 151) - MerchantRepairAllButton:Point("BOTTOMRIGHT", MerchantFrame, "BOTTOMLEFT", 111, 105) + MerchantRepairText:SetPoint("CENTER", MerchantFrame, "BOTTOMLEFT", 82, 151) + MerchantRepairAllButton:Point("BOTTOMRIGHT", MerchantFrame, "BOTTOMLEFT", 100, 105) else - MerchantRepairText:SetPoint("BOTTOMLEFT", MerchantFrame, "BOTTOMLEFT", 26, 125) - MerchantRepairAllButton:Point("BOTTOMRIGHT", MerchantFrame, "BOTTOMLEFT", 172, 113) + MerchantRepairText:SetPoint("BOTTOMLEFT", MerchantFrame, "BOTTOMLEFT", 11, 125) + MerchantRepairAllButton:Point("BOTTOMRIGHT", MerchantFrame, "BOTTOMLEFT", 157, 113) end end) diff --git a/ElvUI/Settings/Global.lua b/ElvUI/Settings/Global.lua index be2b95d..a623954 100644 --- a/ElvUI/Settings/Global.lua +++ b/ElvUI/Settings/Global.lua @@ -434,7 +434,6 @@ G.profileCopy = { bags = { general = true, split = true, - vendorGrays = true, bagBar = true, cooldown = true }, diff --git a/ElvUI/Settings/Profile.lua b/ElvUI/Settings/Profile.lua index 7c16fdc..c52e6c7 100644 --- a/ElvUI/Settings/Profile.lua +++ b/ElvUI/Settings/Profile.lua @@ -12,7 +12,6 @@ P.general = { stickyFrames = true, loginmessage = true, interruptAnnounce = "NONE", - autoRepair = "NONE", autoRoll = false, autoAcceptInvite = false, bottomPanel = true, @@ -206,12 +205,6 @@ P.bags = { questItem = {r = 1, g = 0.30, b = 0.30} } }, - vendorGrays = { - enable = false, - interval = 0.2, - details = false, - progressBar = true - }, split = { bagSpacing = 5, player = false, diff --git a/ElvUI_Enhanced/Modules/Blizzard/CharacterFrame.lua b/ElvUI_Enhanced/Modules/Blizzard/CharacterFrame.lua index 32bac14..b474730 100644 --- a/ElvUI_Enhanced/Modules/Blizzard/CharacterFrame.lua +++ b/ElvUI_Enhanced/Modules/Blizzard/CharacterFrame.lua @@ -1016,18 +1016,22 @@ function module:SetStat(statFrame, unit, statIndex) end elseif statIndex == 2 then local attackPower = GetAttackPowerForStat(statIndex, effectiveStat) + local meleeCrit = GetCritChanceFromAgility("player") if attackPower > 0 then - statFrame.tooltip2 = format(STAT_ATTACK_POWER, attackPower)..format(statFrame.tooltip2, GetCritChanceFromAgility("player"), effectiveStat * ARMOR_PER_AGILITY) + statFrame.tooltip2 = format(STAT_ATTACK_POWER, attackPower)..format(statFrame.tooltip2, meleeCrit, effectiveStat * ARMOR_PER_AGILITY) else - statFrame.tooltip2 = format(statFrame.tooltip2, GetCritChanceFromAgility("player"), effectiveStat * ARMOR_PER_AGILITY) + statFrame.tooltip2 = format(statFrame.tooltip2, meleeCrit, effectiveStat * ARMOR_PER_AGILITY) end + statFrame.tooltip2 = statFrame.tooltip2 .. "\n" .. format(_G["DEFAULT_STAT"..statIndex.."_EXTRA"], meleeCrit*AGI_TO_SPELL_CRIT_PCT) elseif statIndex == 4 then local baseInt = min(20, effectiveStat) local moreInt = effectiveStat - baseInt + local spellCrit = GetSpellCritChanceFromIntellect("player") if UnitHasMana("player") then - statFrame.tooltip2 = format(statFrame.tooltip2, baseInt + moreInt * MANA_PER_INTELLECT, GetSpellCritChanceFromIntellect("player")) + statFrame.tooltip2 = format(statFrame.tooltip2, baseInt + moreInt * MANA_PER_INTELLECT, spellCrit, (baseInt + moreInt) * INT_TO_MELEE_CRIT_PCT) + statFrame.tooltip2 = statFrame.tooltip2 .. "\n" .. format(_G["DEFAULT_STAT"..statIndex.."_EXTRA"], spellCrit * INT_TO_MELEE_CRIT_PCT) else statFrame.tooltip2 = nil end @@ -2686,7 +2690,7 @@ do -- CharacterFrame equipmentManagerPane.SendToBank.Icon:SetSize(14, 14) equipmentManagerPane.SendToBank.Icon:SetTexture("Interface\\GossipFrame\\BankerGossipIcon") - local cvar = C_CVar:GetBool("C_CVAR_EQUIPMENT_MANAGER_STORE_ITEMS_IN_BANK") + local cvar = C_CVar.GetBool("bankEquipmentManager") equipmentManagerPane.SendToBank:SetChecked(cvar) C_EquipmentSet.SetDstBank(cvar) diff --git a/ElvUI_OptionsUI/Bags.lua b/ElvUI_OptionsUI/Bags.lua index 10296d6..48b0276 100644 --- a/ElvUI_OptionsUI/Bags.lua +++ b/ElvUI_OptionsUI/Bags.lua @@ -676,47 +676,6 @@ E.Options.args.bags = { } } }, - vendorGrays = { - order = 8, - type = "group", - name = L["Vendor Grays"], - get = function(info) return E.db.bags.vendorGrays[info[#info]] end, - set = function(info, value) E.db.bags.vendorGrays[info[#info]] = value B:UpdateSellFrameSettings() end, - args = { - header = { - order = 1, - type = "header", - name = L["Vendor Grays"] - }, - enable = { - order = 2, - type = "toggle", - name = L["Enable"], - desc = L["Automatically vendor gray items when visiting a vendor."] - }, - interval = { - order = 3, - type = "range", - name = L["Sell Interval"], - desc = L["Will attempt to sell another item in set interval after previous one was sold."], - min = 0.1, max = 1, step = 0.1, - disabled = function() return not E.db.bags.vendorGrays.enable end - }, - details = { - order = 4, - type = "toggle", - name = L["Vendor Gray Detailed Report"], - desc = L["Displays a detailed report of every item sold when enabled."], - disabled = function() return not E.db.bags.vendorGrays.enable end - }, - progressBar = { - order = 5, - type = "toggle", - name = L["Progress Bar"], - disabled = function() return not E.db.bags.vendorGrays.enable end - } - } - }, bagSortingGroup = { order = 9, type = "group", diff --git a/ElvUI_OptionsUI/General.lua b/ElvUI_OptionsUI/General.lua index 6cb235d..7fe7a64 100644 --- a/ElvUI_OptionsUI/General.lua +++ b/ElvUI_OptionsUI/General.lua @@ -688,25 +688,14 @@ E.Options.args.general = { Misc:ToggleInterruptAnnounce() end }, - autoRepair = { - order = 3, - type = "select", - name = L["Auto Repair"], - desc = L["Automatically repair using the following method when visiting a merchant."], - values = { - ["NONE"] = L["NONE"], - ["GUILD"] = L["GUILD"], - ["PLAYER"] = L["PLAYER"] - } - }, autoAcceptInvite = { - order = 4, + order = 3, type = "toggle", name = L["Accept Invites"], desc = L["Automatically accept invites from guild/friends."] }, autoRoll = { - order = 5, + order = 4, type = "toggle", name = L["Auto Greed/DE"], desc = L["Automatically select greed or disenchant (when available) on green quality items. This will only work if you are the max level."], diff --git a/ElvUI_OptionsUI/ModuleControl.lua b/ElvUI_OptionsUI/ModuleControl.lua index ee5dc4a..84aee47 100644 --- a/ElvUI_OptionsUI/ModuleControl.lua +++ b/ElvUI_OptionsUI/ModuleControl.lua @@ -99,13 +99,6 @@ local function CreateBagsConfig() get = function(info) return E.global.profileCopy.bags[info[#info]] end, set = function(info, value) E.global.profileCopy.bags[info[#info]] = value end } - config.args.vendorGrays = { - order = 5, - type = "toggle", - name = L["Vendor Grays"], - get = function(info) return E.global.profileCopy.bags[info[#info]] end, - set = function(info, value) E.global.profileCopy.bags[info[#info]] = value end - } return config end