mirror of
https://github.com/Bluewhale1337/ElvUIModernized.git
synced 2026-07-27 08:24:44 +00:00
Merge branch 'dev' into actionbars
This commit is contained in:
+13
-15
@@ -1,7 +1,7 @@
|
||||
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 Search = LibStub("LibItemSearch-1.2");
|
||||
-- local LIP = LibStub("ItemPrice-1.1", true);
|
||||
local LIP = LibStub("ItemPrice-1.1", true);
|
||||
|
||||
--Cache global variables
|
||||
--Lua functions
|
||||
@@ -700,10 +700,10 @@ function B:GetGraysValue()
|
||||
for s = 1, GetContainerNumSlots(b) do
|
||||
local l = GetContainerItemLink(b, s)
|
||||
if l and find(l,"ff9d9d9d") then
|
||||
-- local p = LIP:GetSellValue(l) * select(2, GetContainerItemInfo(b, s))
|
||||
-- if(select(3, GetItemInfo(l)) == 0 and p > 0) then
|
||||
-- c = c + p
|
||||
-- end
|
||||
local p = LIP:GetSellValue(l) * select(2, GetContainerItemInfo(b, s))
|
||||
if select(3, GetItemInfo(l)) == 0 and p > 0 then
|
||||
c = c + p
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -718,25 +718,24 @@ function B:VendorGrays(delete, _, getValue)
|
||||
end
|
||||
|
||||
local c = 0
|
||||
local count = 0
|
||||
|
||||
for b = 0, NUM_BAG_FRAMES do
|
||||
for s = 1, GetContainerNumSlots(b) do
|
||||
local l = GetContainerItemLink(b, s)
|
||||
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 not getValue then
|
||||
PickupContainerItem(b, s)
|
||||
DeleteCursorItem()
|
||||
end
|
||||
-- c = c + p
|
||||
count = count + 1
|
||||
c = c + p
|
||||
else
|
||||
if not getValue then
|
||||
UseContainerItem(b, s)
|
||||
PickupMerchantItem()
|
||||
end
|
||||
-- c = c + p
|
||||
c = c + p
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -753,12 +752,11 @@ function B:VendorGrays(delete, _, getValue)
|
||||
end
|
||||
|
||||
function B:VendorGrayCheck()
|
||||
-- local value = B:GetGraysValue()
|
||||
local value = B:GetGraysValue()
|
||||
|
||||
-- if value == 0 then
|
||||
-- E:Print(L["No gray items to delete."])
|
||||
-- else
|
||||
if not MerchantFrame or not MerchantFrame:IsShown() then
|
||||
if value == 0 then
|
||||
E:Print(L["No gray items to delete."])
|
||||
elseif not MerchantFrame or not MerchantFrame:IsShown() then
|
||||
E.PopupDialogs["DELETE_GRAYS"].Money = value
|
||||
E:StaticPopup_Show("DELETE_GRAYS")
|
||||
else
|
||||
|
||||
@@ -83,8 +83,10 @@ function M:MERCHANT_SHOW()
|
||||
if IsShiftKeyDown() or autoRepair == "NONE" or not CanMerchantRepair() then return end
|
||||
|
||||
local cost, possible = GetRepairAllCost()
|
||||
if cost > 0 then
|
||||
if possible then
|
||||
local money = GetMoney()
|
||||
|
||||
if possible then
|
||||
if cost > 0 and money >= cost then
|
||||
RepairAllItems(autoRepair == "PLAYER")
|
||||
E:Print(L["Your items have been repaired for: "]..E:FormatMoney(cost, "BLIZZARD"))
|
||||
else
|
||||
|
||||
@@ -0,0 +1,210 @@
|
||||
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 itemName = GameTooltipTextLeft1:GetText()
|
||||
if not itemName then return end
|
||||
|
||||
local item = GetItemInfoByName(itemName)
|
||||
if item then
|
||||
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
|
||||
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 itemName = GameTooltipTextLeft1:GetText()
|
||||
if not itemName then return end
|
||||
|
||||
local _, itemString = GetItemInfoByName(itemName)
|
||||
if not itemString then return end
|
||||
|
||||
local itemID = match(itemString, "item:(%d+)")
|
||||
if not itemID 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/">
|
||||
<Script file="Tooltip.lua"/>
|
||||
<Script file="ItemPrice.lua"/>
|
||||
</Ui>
|
||||
@@ -1,30 +1,32 @@
|
||||
local E, L, V, P, G = unpack(ElvUI)
|
||||
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
|
||||
|
||||
local _G = _G;
|
||||
local floor = math.floor;
|
||||
local format = string.format;
|
||||
|
||||
local GetPVPTimer = GetPVPTimer;
|
||||
local GetTime = GetTime;
|
||||
local UnitClass = UnitClass;
|
||||
local UnitClassification = UnitClassification;
|
||||
local UnitGUID = UnitGUID;
|
||||
local UnitIsAFK = UnitIsAFK;
|
||||
local UnitIsConnected = UnitIsConnected;
|
||||
local UnitIsDND = UnitIsDND;
|
||||
local UnitIsDead = UnitIsDead;
|
||||
local UnitIsDeadOrGhost = UnitIsDeadOrGhost;
|
||||
local UnitIsGhost = UnitIsGhost;
|
||||
local UnitIsPVP = UnitIsPVP;
|
||||
local UnitIsPVPFreeForAll = UnitIsPVPFreeForAll;
|
||||
local UnitIsPlayer = UnitIsPlayer;
|
||||
local UnitLevel = UnitLevel;
|
||||
local UnitMana = UnitMana;
|
||||
local UnitManaMax = UnitManaMax;
|
||||
local UnitPowerType = UnitPowerType;
|
||||
local UnitReaction = UnitReaction;
|
||||
local DEFAULT_AFK_MESSAGE = DEFAULT_AFK_MESSAGE;
|
||||
local PVP = PVP;
|
||||
--Cache global variables
|
||||
--Lua functions
|
||||
local _G = _G
|
||||
local floor = math.floor
|
||||
local format = string.format
|
||||
--WoW API / Variables
|
||||
local GetPVPTimer = GetPVPTimer
|
||||
local GetTime = GetTime
|
||||
local UnitClass = UnitClass
|
||||
local UnitClassification = UnitClassification
|
||||
local UnitGUID = UnitGUID
|
||||
local UnitIsAFK = UnitIsAFK
|
||||
local UnitIsConnected = UnitIsConnected
|
||||
local UnitIsDND = UnitIsDND
|
||||
local UnitIsDead = UnitIsDead
|
||||
local UnitIsDeadOrGhost = UnitIsDeadOrGhost
|
||||
local UnitIsGhost = UnitIsGhost
|
||||
local UnitIsPVP = UnitIsPVP
|
||||
local UnitIsPVPFreeForAll = UnitIsPVPFreeForAll
|
||||
local UnitIsPlayer = UnitIsPlayer
|
||||
local UnitLevel = UnitLevel
|
||||
local UnitMana = UnitMana
|
||||
local UnitManaMax = UnitManaMax
|
||||
local UnitPowerType = UnitPowerType
|
||||
local UnitReaction = UnitReaction
|
||||
local DEFAULT_AFK_MESSAGE = DEFAULT_AFK_MESSAGE
|
||||
local PVP = PVP
|
||||
|
||||
------------------------------------------------------------------------
|
||||
-- Tags
|
||||
@@ -34,7 +36,7 @@ ElvUF.Tags.Events["afk"] = "PLAYER_FLAGS_CHANGED"
|
||||
ElvUF.Tags.Methods["afk"] = function(unit)
|
||||
local isAFK = UnitIsAFK(unit)
|
||||
if isAFK then
|
||||
return ("|cffFFFFFF[|r|cffFF0000%s|r|cFFFFFFFF]|r"):format(DEFAULT_AFK_MESSAGE)
|
||||
return format("|cffFFFFFF[|r|cffFF0000%s|r|cFFFFFFFF]|r", DEFAULT_AFK_MESSAGE)
|
||||
else
|
||||
return ""
|
||||
end
|
||||
@@ -474,7 +476,7 @@ ElvUF.Tags.Methods["statustimer"] = function(unit)
|
||||
local timer = GetTime() - unitStatus[guid][2]
|
||||
local mins = floor(timer / 60)
|
||||
local secs = floor(timer - (mins * 60))
|
||||
return ("%s (%01.f:%02.f)"):format(status, mins, secs)
|
||||
return format("%s (%01.f:%02.f)", status, mins, secs)
|
||||
else
|
||||
return ""
|
||||
end
|
||||
@@ -488,7 +490,7 @@ ElvUF.Tags.Methods["pvptimer"] = function(unit)
|
||||
if timer ~= 301000 and timer ~= -1 then
|
||||
local mins = floor((timer / 1000) / 60)
|
||||
local secs = floor((timer / 1000) - (mins * 60))
|
||||
return ("%s (%01.f:%02.f)"):format(PVP, mins, secs)
|
||||
return format("%s (%01.f:%02.f)", PVP, mins, secs)
|
||||
else
|
||||
return PVP
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user