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.
This commit is contained in:
Andrew
2023-02-05 17:43:09 -07:00
committed by GitHub
parent ff118b5dc0
commit 221dffffe6
10 changed files with 25 additions and 168 deletions
+3 -3
View File
@@ -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
+3 -12
View File
@@ -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,
-76
View File
@@ -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")
+9 -4
View File
@@ -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)
-1
View File
@@ -434,7 +434,6 @@ G.profileCopy = {
bags = {
general = true,
split = true,
vendorGrays = true,
bagBar = true,
cooldown = true
},
-7
View File
@@ -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,
@@ -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)
-41
View File
@@ -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",
+2 -13
View File
@@ -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."],
-7
View File
@@ -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