mirror of
https://github.com/Bluewhale1337/ElvUIModernized.git
synced 2026-07-27 08:24:44 +00:00
LibItemPrice
Needs some more work
This commit is contained in:
@@ -400,3 +400,24 @@ function GetItemInfoByName(itemName)
|
|||||||
|
|
||||||
return GetItemInfo(itemInfoDB[itemName])
|
return GetItemInfo(itemInfoDB[itemName])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function GetItemCount(itemName)
|
||||||
|
local count = 0
|
||||||
|
for bag = 4, 0, -1 do
|
||||||
|
for slot = 1, GetContainerNumSlots(bag) do
|
||||||
|
local _, itemCount = GetContainerItemInfo(bag, slot);
|
||||||
|
if itemCount then
|
||||||
|
local itemLink = GetContainerItemLink(bag,slot)
|
||||||
|
local _, _, itemParse = strfind(itemLink, "(%d+):")
|
||||||
|
local queryName, _, _, _, _, _ = GetItemInfo(itemParse)
|
||||||
|
if queryName and queryName ~= "" then
|
||||||
|
if queryName == itemName then
|
||||||
|
count = count + itemCount;
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return count
|
||||||
|
end
|
||||||
File diff suppressed because one or more lines are too long
@@ -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="LibItemPrice-1.1.lua"/>
|
||||||
|
</Ui>
|
||||||
@@ -10,6 +10,7 @@
|
|||||||
<Include file="AceComm-3.0\AceComm-3.0.xml"/>
|
<Include file="AceComm-3.0\AceComm-3.0.xml"/>
|
||||||
<Include file="AceSerializer-3.0\AceSerializer-3.0.xml"/>
|
<Include file="AceSerializer-3.0\AceSerializer-3.0.xml"/>
|
||||||
<Include file="AceTimer-3.0\AceTimer-3.0.xml"/>
|
<Include file="AceTimer-3.0\AceTimer-3.0.xml"/>
|
||||||
|
<Include file="LibItemPrice-1.1\LibItemPrice-1.1.xml"/>
|
||||||
<Include file="AceHook-3.0\AceHook-3.0.xml"/>
|
<Include file="AceHook-3.0\AceHook-3.0.xml"/>
|
||||||
<Include file="LibSharedMedia-3.0\LibSharedMedia-3.0.xml"/>
|
<Include file="LibSharedMedia-3.0\LibSharedMedia-3.0.xml"/>
|
||||||
<Include file="LibSimpleSticky\LibSimpleSticky.xml"/>
|
<Include file="LibSimpleSticky\LibSimpleSticky.xml"/>
|
||||||
|
|||||||
+12
-13
@@ -1,7 +1,7 @@
|
|||||||
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
|
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
|
||||||
local B = E:NewModule("Bags", "AceHook-3.0", "AceEvent-3.0", "AceTimer-3.0");
|
local B = E:NewModule("Bags", "AceHook-3.0", "AceEvent-3.0", "AceTimer-3.0");
|
||||||
local Search = LibStub("LibItemSearch-1.2");
|
local Search = LibStub("LibItemSearch-1.2");
|
||||||
-- local LIP = LibStub("ItemPrice-1.1", true);
|
local LIP = LibStub("ItemPrice-1.1", true);
|
||||||
|
|
||||||
--Cache global variables
|
--Cache global variables
|
||||||
--Lua functions
|
--Lua functions
|
||||||
@@ -700,10 +700,10 @@ function B:GetGraysValue()
|
|||||||
for s = 1, GetContainerNumSlots(b) do
|
for s = 1, GetContainerNumSlots(b) do
|
||||||
local l = GetContainerItemLink(b, s)
|
local l = GetContainerItemLink(b, s)
|
||||||
if l and find(l,"ff9d9d9d") then
|
if l and find(l,"ff9d9d9d") then
|
||||||
-- local p = LIP:GetSellValue(l) * select(2, GetContainerItemInfo(b, s))
|
local p = LIP:GetSellValue(l) * select(2, GetContainerItemInfo(b, s))
|
||||||
-- if(select(3, GetItemInfo(l)) == 0 and p > 0) then
|
if select(3, GetItemInfo(l)) == 0 and p > 0 then
|
||||||
-- c = c + p
|
c = c + p
|
||||||
-- end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -723,20 +723,20 @@ function B:VendorGrays(delete, _, getValue)
|
|||||||
for s = 1, GetContainerNumSlots(b) do
|
for s = 1, GetContainerNumSlots(b) do
|
||||||
local l = GetContainerItemLink(b, s)
|
local l = GetContainerItemLink(b, s)
|
||||||
if l and find(l,"ff9d9d9d") then
|
if l and find(l,"ff9d9d9d") then
|
||||||
-- local p = LIP:GetSellValue(l) * select(2, GetContainerItemInfo(b, s))
|
local p = LIP:GetSellValue(l) * select(2, GetContainerItemInfo(b, s))
|
||||||
if delete then
|
if delete then
|
||||||
if not getValue then
|
if not getValue then
|
||||||
PickupContainerItem(b, s)
|
PickupContainerItem(b, s)
|
||||||
DeleteCursorItem()
|
DeleteCursorItem()
|
||||||
end
|
end
|
||||||
-- c = c + p
|
c = c + p
|
||||||
count = count + 1
|
count = count + 1
|
||||||
else
|
else
|
||||||
if not getValue then
|
if not getValue then
|
||||||
UseContainerItem(b, s)
|
UseContainerItem(b, s)
|
||||||
PickupMerchantItem()
|
PickupMerchantItem()
|
||||||
end
|
end
|
||||||
-- c = c + p
|
c = c + p
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -753,12 +753,11 @@ function B:VendorGrays(delete, _, getValue)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function B:VendorGrayCheck()
|
function B:VendorGrayCheck()
|
||||||
-- local value = B:GetGraysValue()
|
local value = B:GetGraysValue()
|
||||||
|
|
||||||
-- if value == 0 then
|
if value == 0 then
|
||||||
-- E:Print(L["No gray items to delete."])
|
E:Print(L["No gray items to delete."])
|
||||||
-- else
|
elseif not MerchantFrame or not MerchantFrame:IsShown() then
|
||||||
if not MerchantFrame or not MerchantFrame:IsShown() then
|
|
||||||
E.PopupDialogs["DELETE_GRAYS"].Money = value
|
E.PopupDialogs["DELETE_GRAYS"].Money = value
|
||||||
E:StaticPopup_Show("DELETE_GRAYS")
|
E:StaticPopup_Show("DELETE_GRAYS")
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -0,0 +1,217 @@
|
|||||||
|
local E, L, V, P, G = unpack(ElvUI)
|
||||||
|
local IP = E:NewModule("Tooltip_ItemPrice", "AceHook-3.0")
|
||||||
|
|
||||||
|
local LIP = LibStub:GetLibrary("ItemPrice-1.1")
|
||||||
|
|
||||||
|
local match = string.match
|
||||||
|
|
||||||
|
local GetActionCount = GetActionCount
|
||||||
|
local GetAuctionItemInfo = GetAuctionItemInfo
|
||||||
|
local GetAuctionSellItemInfo = GetAuctionSellItemInfo
|
||||||
|
local GetContainerItemInfo = GetContainerItemInfo
|
||||||
|
local GetCraftReagentInfo = GetCraftReagentInfo
|
||||||
|
local GetInboxItem = GetInboxItem
|
||||||
|
local GetItemCount = GetItemCount
|
||||||
|
local GetLootRollItemInfo = GetLootRollItemInfo
|
||||||
|
local GetLootSlotInfo = GetLootSlotInfo
|
||||||
|
local GetMerchantItemInfo = GetMerchantItemInfo
|
||||||
|
local GetQuestItemInfo = GetQuestItemInfo
|
||||||
|
local GetQuestLogRewardInfo = GetQuestLogRewardInfo
|
||||||
|
local GetSendMailItem = GetSendMailItem
|
||||||
|
local GetTradePlayerItemInfo = GetTradePlayerItemInfo
|
||||||
|
local GetTradeSkillReagentInfo = GetTradeSkillReagentInfo
|
||||||
|
local GetTradeTargetItemInfo = GetTradeTargetItemInfo
|
||||||
|
local IsConsumableAction = IsConsumableAction
|
||||||
|
|
||||||
|
local tooltips = {
|
||||||
|
"GameTooltip",
|
||||||
|
"ItemRefTooltip"
|
||||||
|
}
|
||||||
|
|
||||||
|
function IP:SetAction(tt, id)
|
||||||
|
local item
|
||||||
|
for i = 1, tt:NumLines() do
|
||||||
|
if i == 1 then
|
||||||
|
local tiptext = _G["GameTooltipTextLeft"..i]
|
||||||
|
local linetext = tiptext:GetText()
|
||||||
|
|
||||||
|
item = linetext
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if not item then return end
|
||||||
|
|
||||||
|
local count = 1
|
||||||
|
if IsConsumableAction(id) then
|
||||||
|
local actionCount = GetActionCount(id)
|
||||||
|
if actionCount and actionCount == GetItemCount(item) then
|
||||||
|
count = actionCount
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
self:SetPrice(tt, count, item)
|
||||||
|
end
|
||||||
|
|
||||||
|
function IP:SetAuctionItem(tt, type, index)
|
||||||
|
local _, _, count = GetAuctionItemInfo(type, index)
|
||||||
|
self:SetPrice(tt, count)
|
||||||
|
end
|
||||||
|
|
||||||
|
function IP:SetAuctionSellItem(tt)
|
||||||
|
local _, _, count = GetAuctionSellItemInfo()
|
||||||
|
self:SetPrice(tt, count)
|
||||||
|
end
|
||||||
|
|
||||||
|
function IP:SetBagItem(tt, bag, slot)
|
||||||
|
local _, count = GetContainerItemInfo(bag, slot)
|
||||||
|
self:SetPrice(tt, count)
|
||||||
|
end
|
||||||
|
|
||||||
|
function IP:SetCraftItem(tt, skill, slot)
|
||||||
|
local count = 1
|
||||||
|
if slot then
|
||||||
|
count = select(3, GetCraftReagentInfo(skill, slot))
|
||||||
|
end
|
||||||
|
|
||||||
|
self:SetPrice(tt, count)
|
||||||
|
end
|
||||||
|
|
||||||
|
function IP:SetHyperlink(tt, link, count)
|
||||||
|
count = tonumber(count)
|
||||||
|
if not count or count < 1 then
|
||||||
|
local owner = tt:GetParent()
|
||||||
|
count = owner and tonumber(owner.count)
|
||||||
|
if not count or count < 1 then
|
||||||
|
count = 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
self:SetPrice(tt, count)
|
||||||
|
end
|
||||||
|
|
||||||
|
function IP:SetInboxItem(tt, index, attachmentIndex)
|
||||||
|
local _, _, count = GetInboxItem(index, attachmentIndex)
|
||||||
|
self:SetPrice(tt, count)
|
||||||
|
end
|
||||||
|
|
||||||
|
function IP:SetInventoryItem(tt, unit, slot)
|
||||||
|
if type(slot) ~= "number" or slot < 0 then return end
|
||||||
|
|
||||||
|
local count = 1
|
||||||
|
if slot < 20 or slot > 39 and slot < 68 then
|
||||||
|
count = GetInventoryItemCount(unit, slot)
|
||||||
|
end
|
||||||
|
|
||||||
|
self:SetPrice(tt, count)
|
||||||
|
end
|
||||||
|
|
||||||
|
function IP:SetLootItem(tt, slot)
|
||||||
|
local _, _, count = GetLootSlotInfo(slot)
|
||||||
|
self:SetPrice(tt, count)
|
||||||
|
end
|
||||||
|
|
||||||
|
function IP:SetLootRollItem(tt, rollID)
|
||||||
|
local _, _, count = GetLootRollItemInfo(rollID)
|
||||||
|
self:SetPrice(tt, count)
|
||||||
|
end
|
||||||
|
|
||||||
|
function IP:SetMerchantItem(tt, slot)
|
||||||
|
local _, _, _, count = GetMerchantItemInfo(slot)
|
||||||
|
self:SetPrice(tt, count)
|
||||||
|
end
|
||||||
|
|
||||||
|
function IP:SetQuestItem(tt, type, slot)
|
||||||
|
local _, _, count = GetQuestItemInfo(type, slot)
|
||||||
|
self:SetPrice(tt, count)
|
||||||
|
end
|
||||||
|
|
||||||
|
function IP:SetQuestLogItem(tt, type, index)
|
||||||
|
local _, _, count = GetQuestLogRewardInfo(index)
|
||||||
|
self:SetPrice(tt, count)
|
||||||
|
end
|
||||||
|
|
||||||
|
function IP:SetSendMailItem(tt, index)
|
||||||
|
local _, _, count = GetSendMailItem(index)
|
||||||
|
self:SetPrice(tt, count)
|
||||||
|
end
|
||||||
|
|
||||||
|
function IP:SetTradePlayerItem(tt, index)
|
||||||
|
local _, _, count = GetTradePlayerItemInfo(index)
|
||||||
|
self:SetPrice(tt, count)
|
||||||
|
end
|
||||||
|
|
||||||
|
function IP:SetTradeSkillItem(tt, skill, slot)
|
||||||
|
local count = 1
|
||||||
|
if slot then
|
||||||
|
count = select(3, GetTradeSkillReagentInfo(skill, slot))
|
||||||
|
end
|
||||||
|
|
||||||
|
self:SetPrice(tt, count)
|
||||||
|
end
|
||||||
|
|
||||||
|
function IP:SetTradeTargetItem(tt, index)
|
||||||
|
local _, _, count = GetTradeTargetItemInfo(index)
|
||||||
|
self:SetPrice(tt, count)
|
||||||
|
end
|
||||||
|
|
||||||
|
function IP:SetPrice(tt, count)
|
||||||
|
if MerchantFrame:IsShown() then return end
|
||||||
|
|
||||||
|
local bag, slot = this:GetParent():GetID(), this:GetID()
|
||||||
|
local itemLink = GetContainerItemLink(bag, slot)
|
||||||
|
local item, itemID
|
||||||
|
if itemLink then
|
||||||
|
itemID = match(itemLink, "item:(%d+)")
|
||||||
|
item = GetItemInfo(itemID)
|
||||||
|
end
|
||||||
|
|
||||||
|
if not item then return end
|
||||||
|
|
||||||
|
local price = LIP:GetSellValue(itemID)
|
||||||
|
|
||||||
|
if price and price > 0 then
|
||||||
|
tt:AddDoubleLine(SALE_PRICE_COLON, E:FormatMoney(count and price * count or price, "BLIZZARD", false), nil, nil, nil, 1, 1, 1)
|
||||||
|
end
|
||||||
|
|
||||||
|
if tt:IsShown() then tt:Show() end
|
||||||
|
end
|
||||||
|
|
||||||
|
function IP:ApplyHooks(tooltip)
|
||||||
|
self:SecureHook(tooltip, "SetAction", "SetAction")
|
||||||
|
self:SecureHook(tooltip, "SetAuctionItem", "SetAuctionItem")
|
||||||
|
self:SecureHook(tooltip, "SetAuctionSellItem", "SetAuctionSellItem")
|
||||||
|
self:SecureHook(tooltip, "SetBagItem", "SetBagItem")
|
||||||
|
self:SecureHook(tooltip, "SetCraftItem", "SetCraftItem")
|
||||||
|
self:SecureHook(tooltip, "SetHyperlink", "SetHyperlink")
|
||||||
|
self:SecureHook(tooltip, "SetInboxItem", "SetInboxItem")
|
||||||
|
self:SecureHook(tooltip, "SetInventoryItem", "SetInventoryItem")
|
||||||
|
self:SecureHook(tooltip, "SetLootItem", "SetLootItem")
|
||||||
|
self:SecureHook(tooltip, "SetLootRollItem", "SetLootRollItem")
|
||||||
|
self:SecureHook(tooltip, "SetMerchantItem", "SetMerchantItem")
|
||||||
|
self:SecureHook(tooltip, "SetQuestItem", "SetQuestItem")
|
||||||
|
self:SecureHook(tooltip, "SetQuestLogItem", "SetQuestLogItem")
|
||||||
|
self:SecureHook(tooltip, "SetSendMailItem", "SetSendMailItem")
|
||||||
|
self:SecureHook(tooltip, "SetTradePlayerItem", "SetTradePlayerItem")
|
||||||
|
self:SecureHook(tooltip, "SetTradeSkillItem", "SetTradeSkillItem")
|
||||||
|
self:SecureHook(tooltip, "SetTradeTargetItem", "SetTradeTargetItem")
|
||||||
|
end
|
||||||
|
|
||||||
|
function IP:UpdateSettings()
|
||||||
|
if E.db.tooltip.itemPrice then
|
||||||
|
for _, tooltip in pairs(tooltips) do
|
||||||
|
self:ApplyHooks(_G[tooltip])
|
||||||
|
end
|
||||||
|
else
|
||||||
|
self:UnhookAll()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function IP:Initialize()
|
||||||
|
self:UpdateSettings()
|
||||||
|
end
|
||||||
|
|
||||||
|
local function InitializeCallback()
|
||||||
|
IP:Initialize()
|
||||||
|
end
|
||||||
|
|
||||||
|
E:RegisterModule(IP:GetName(), InitializeCallback)
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
<Ui xmlns="http://www.blizzard.com/wow/ui/">
|
<Ui xmlns="http://www.blizzard.com/wow/ui/">
|
||||||
<Script file="Tooltip.lua"/>
|
<Script file="Tooltip.lua"/>
|
||||||
|
<Script file="ItemPrice.lua"/>
|
||||||
</Ui>
|
</Ui>
|
||||||
@@ -490,6 +490,7 @@ P["tooltip"] = {
|
|||||||
["playerTitles"] = true,
|
["playerTitles"] = true,
|
||||||
["guildRanks"] = true,
|
["guildRanks"] = true,
|
||||||
["inspectInfo"] = true,
|
["inspectInfo"] = true,
|
||||||
|
["itemPrice"] = true,
|
||||||
["itemCount"] = "BAGS_ONLY",
|
["itemCount"] = "BAGS_ONLY",
|
||||||
["spellID"] = true,
|
["spellID"] = true,
|
||||||
["font"] = "PT Sans Narrow",
|
["font"] = "PT Sans Narrow",
|
||||||
|
|||||||
@@ -63,14 +63,24 @@ E.Options.args.tooltip = {
|
|||||||
name = L["Inspect Info"],
|
name = L["Inspect Info"],
|
||||||
desc = L["Display the players talent spec and item level in the tooltip, this may not immediately update when mousing over a unit."],
|
desc = L["Display the players talent spec and item level in the tooltip, this may not immediately update when mousing over a unit."],
|
||||||
},
|
},
|
||||||
spellID = {
|
itemPrice = {
|
||||||
order = 6,
|
order = 6,
|
||||||
type = "toggle",
|
type = "toggle",
|
||||||
|
name = L["Item Price"],
|
||||||
|
desc = L["Display vendor sell value on item tooltips."],
|
||||||
|
set = function(info, value)
|
||||||
|
E.db.tooltip[info[getn(info)]] = value
|
||||||
|
E:GetModule("Tooltip_ItemPrice"):UpdateSettings()
|
||||||
|
end
|
||||||
|
},
|
||||||
|
spellID = {
|
||||||
|
order = 7,
|
||||||
|
type = "toggle",
|
||||||
name = L["Spell/Item IDs"],
|
name = L["Spell/Item IDs"],
|
||||||
desc = L["Display the spell or item ID when mousing over a spell or item tooltip."]
|
desc = L["Display the spell or item ID when mousing over a spell or item tooltip."]
|
||||||
},
|
},
|
||||||
itemCount = {
|
itemCount = {
|
||||||
order = 7,
|
order = 8,
|
||||||
type = "select",
|
type = "select",
|
||||||
name = L["Item Count"],
|
name = L["Item Count"],
|
||||||
desc = L["Display how many of a certain item you have in your possession."],
|
desc = L["Display how many of a certain item you have in your possession."],
|
||||||
@@ -82,14 +92,14 @@ E.Options.args.tooltip = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
colorAlpha = {
|
colorAlpha = {
|
||||||
order = 8,
|
order = 9,
|
||||||
type = "range",
|
type = "range",
|
||||||
name = OPACITY,
|
name = OPACITY,
|
||||||
isPercent = true,
|
isPercent = true,
|
||||||
min = 0, max = 1, step = 0.01
|
min = 0, max = 1, step = 0.01
|
||||||
},
|
},
|
||||||
fontGroup = {
|
fontGroup = {
|
||||||
order = 8,
|
order = 10,
|
||||||
type = "group",
|
type = "group",
|
||||||
guiInline = true,
|
guiInline = true,
|
||||||
name = L["Tooltip Font Settings"],
|
name = L["Tooltip Font Settings"],
|
||||||
@@ -148,7 +158,7 @@ E.Options.args.tooltip = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
factionColors = {
|
factionColors = {
|
||||||
order = 9,
|
order = 11,
|
||||||
type = "group",
|
type = "group",
|
||||||
name = L["Custom Faction Colors"],
|
name = L["Custom Faction Colors"],
|
||||||
guiInline = true,
|
guiInline = true,
|
||||||
|
|||||||
Reference in New Issue
Block a user