mirror of
https://github.com/Bluewhale1337/ElvUIModernized.git
synced 2026-07-27 08:24:44 +00:00
cleanup
This commit is contained in:
@@ -5,7 +5,7 @@ if not lib then return end
|
|||||||
--Cache global variables
|
--Cache global variables
|
||||||
--Lua functions
|
--Lua functions
|
||||||
local pairs, tonumber = pairs, tonumber
|
local pairs, tonumber = pairs, tonumber
|
||||||
local format, gsub, strmatch, strsplit = format, gsub, strmatch, strsplit
|
local format, gsub, strmatch, strsplit = string.format, string.gsub, string.match, string.split
|
||||||
--WoW API / Variables
|
--WoW API / Variables
|
||||||
local CreateFrame = CreateFrame
|
local CreateFrame = CreateFrame
|
||||||
local GetAddOnMetadata = GetAddOnMetadata
|
local GetAddOnMetadata = GetAddOnMetadata
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ if not Lib then
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local lower = string.lower
|
local find, gmatch, lower, match = string.find, string.gmatch, string.lower, string.match
|
||||||
|
|
||||||
--[[ Parsing ]]--
|
--[[ Parsing ]]--
|
||||||
|
|
||||||
|
|||||||
@@ -12,25 +12,25 @@ else
|
|||||||
return;
|
return;
|
||||||
end
|
end
|
||||||
|
|
||||||
local strmatch, lower = string.match, string.lower
|
local match, lower = string.match, string.lower
|
||||||
|
|
||||||
--[[ User API ]]--
|
--[[ User API ]]--
|
||||||
|
|
||||||
function Lib:Matches(link, search)
|
function Lib:Matches(link, search)
|
||||||
return Search(link, search, self.Filters);
|
return Search(link, search, this.Filters);
|
||||||
end
|
end
|
||||||
|
|
||||||
function Lib:Tooltip(link, search)
|
function Lib:Tooltip(link, search)
|
||||||
return link and strmatch(self.Filters.tip, link, nil, search);
|
return link and match(self.Filters.tip, link, nil, search);
|
||||||
end
|
end
|
||||||
|
|
||||||
function Lib:TooltipPhrase(link, search)
|
function Lib:TooltipPhrase(link, search)
|
||||||
return link and strmatch(self.Filters.tipPhrases, link, nil, search);
|
return link and match(self.Filters.tipPhrases, link, nil, search);
|
||||||
end
|
end
|
||||||
|
|
||||||
function Lib:InSet(link, search)
|
function Lib:InSet(link, search)
|
||||||
if(IsEquippableItem(link)) then
|
if(IsEquippableItem(link)) then
|
||||||
local id = tonumber(strmatch(link, "item:(%-?%d+)"));
|
local id = tonumber(match(link, "item:(%-?%d+)"));
|
||||||
return self:BelongsToSet(id, lower(search or ""));
|
return self:BelongsToSet(id, lower(search or ""));
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -45,7 +45,7 @@ Lib.Filters.name = {
|
|||||||
end,
|
end,
|
||||||
|
|
||||||
match = function(self, item, _, search)
|
match = function(self, item, _, search)
|
||||||
local name = strmatch(item, "%[(.-)%]");
|
local name = match(item, "%[(.-)%]");
|
||||||
return Search:Find(search, name);
|
return Search:Find(search, name);
|
||||||
end
|
end
|
||||||
};
|
};
|
||||||
@@ -179,7 +179,7 @@ Lib.Filters.tipPhrases = {
|
|||||||
end,
|
end,
|
||||||
|
|
||||||
match = function(self, link, _, search)
|
match = function(self, link, _, search)
|
||||||
local id = strmatch(link, "item:(%d+)");
|
local id = match(link, "item:(%d+)");
|
||||||
if(not id) then
|
if(not id) then
|
||||||
return;
|
return;
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
local E, L, V, P, G = unpack(ElvUI)
|
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
|
||||||
@@ -9,7 +9,7 @@ local _G = _G
|
|||||||
local type, ipairs, pairs, unpack, select, assert = type, ipairs, pairs, unpack, select, assert
|
local type, ipairs, pairs, unpack, select, assert = type, ipairs, pairs, unpack, select, assert
|
||||||
local tinsert = table.insert
|
local tinsert = table.insert
|
||||||
local floor, ceil = math.floor, math.ceil
|
local floor, ceil = math.floor, math.ceil
|
||||||
local len, sub, find = string.len, string.sub, string.find
|
local len, gsub, sub, find = string.len, string.gsub, string.sub, string.find
|
||||||
--WoW API / Variables
|
--WoW API / Variables
|
||||||
local BankFrameItemButton_Update = BankFrameItemButton_Update
|
local BankFrameItemButton_Update = BankFrameItemButton_Update
|
||||||
local BankFrameItemButton_UpdateLocked = BankFrameItemButton_UpdateLocked
|
local BankFrameItemButton_UpdateLocked = BankFrameItemButton_UpdateLocked
|
||||||
|
|||||||
@@ -676,7 +676,7 @@ function B:DoMove(move)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local stackSize = select(8, GetItemInfo(sourceItemID))
|
local stackSize = select(7, GetItemInfo(sourceItemID))
|
||||||
if (sourceItemID == targetItemID) and (targetCount ~= stackSize) and ((targetCount + sourceCount) > stackSize) then
|
if (sourceItemID == targetItemID) and (targetCount ~= stackSize) and ((targetCount + sourceCount) > stackSize) then
|
||||||
B:SplitItem(sourceBag, sourceSlot, stackSize - targetCount)
|
B:SplitItem(sourceBag, sourceSlot, stackSize - targetCount)
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -1,67 +1,66 @@
|
|||||||
local E, L, V, P, G = unpack(ElvUI);
|
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
|
||||||
local DT = E:GetModule("DataTexts");
|
local DT = E:GetModule("DataTexts");
|
||||||
|
|
||||||
local max = math.max;
|
--Cache global variables
|
||||||
|
--Lua functions
|
||||||
|
local max = math.max
|
||||||
local format, join, sub = string.format, string.join, string.sub
|
local format, join, sub = string.format, string.join, string.sub
|
||||||
|
--WoW API / Variables
|
||||||
local ComputePetBonus = ComputePetBonus;
|
local UnitAttackPower = UnitAttackPower
|
||||||
local UnitAttackPower = UnitAttackPower;
|
local UnitRangedAttackPower = UnitRangedAttackPower
|
||||||
local UnitRangedAttackPower = UnitRangedAttackPower;
|
local ATTACK_POWER_COLON = ATTACK_POWER_COLON
|
||||||
local ATTACK_POWER_COLON = ATTACK_POWER_COLON;
|
local ATTACK_POWER_MAGIC_NUMBER = ATTACK_POWER_MAGIC_NUMBER
|
||||||
local ATTACK_POWER_MAGIC_NUMBER = ATTACK_POWER_MAGIC_NUMBER;
|
local MELEE_ATTACK_POWER = MELEE_ATTACK_POWER
|
||||||
local MELEE_ATTACK_POWER = MELEE_ATTACK_POWER;
|
local MELEE_ATTACK_POWER_TOOLTIP = MELEE_ATTACK_POWER_TOOLTIP
|
||||||
local MELEE_ATTACK_POWER_TOOLTIP = MELEE_ATTACK_POWER_TOOLTIP;
|
local RANGED_ATTACK_POWER = RANGED_ATTACK_POWER
|
||||||
local PET_BONUS_TOOLTIP_RANGED_ATTACK_POWER = PET_BONUS_TOOLTIP_RANGED_ATTACK_POWER;
|
local RANGED_ATTACK_POWER_TOOLTIP = RANGED_ATTACK_POWER_TOOLTIP
|
||||||
local PET_BONUS_TOOLTIP_SPELLDAMAGE = PET_BONUS_TOOLTIP_SPELLDAMAGE;
|
|
||||||
local RANGED_ATTACK_POWER = RANGED_ATTACK_POWER;
|
|
||||||
local RANGED_ATTACK_POWER_TOOLTIP = RANGED_ATTACK_POWER_TOOLTIP;
|
|
||||||
local ATTACK_POWER_TOOLTIP = ATTACK_POWER_TOOLTIP
|
local ATTACK_POWER_TOOLTIP = ATTACK_POWER_TOOLTIP
|
||||||
|
|
||||||
local ATTACK_POWER = sub(ATTACK_POWER_COLON, 1, -2)
|
local ATTACK_POWER = sub(ATTACK_POWER_COLON, 1, -2)
|
||||||
|
|
||||||
local base, posBuff, negBuff, effective, Rbase, RposBuff, RnegBuff, Reffective, pwr;
|
local base, posBuff, negBuff, effective, Rbase, RposBuff, RnegBuff, Reffective, pwr
|
||||||
local displayNumberString = "";
|
local displayNumberString = ""
|
||||||
local lastPanel;
|
local lastPanel
|
||||||
|
|
||||||
local function OnEvent(self)
|
local function OnEvent(self)
|
||||||
if(E.myclass == "HUNTER") then
|
if(E.myclass == "HUNTER") then
|
||||||
Rbase, RposBuff, RnegBuff = UnitRangedAttackPower("player");
|
Rbase, RposBuff, RnegBuff = UnitRangedAttackPower("player")
|
||||||
Reffective = Rbase + RposBuff + RnegBuff;
|
Reffective = Rbase + RposBuff + RnegBuff
|
||||||
pwr = Reffective;
|
pwr = Reffective
|
||||||
else
|
else
|
||||||
base, posBuff, negBuff = UnitAttackPower("player");
|
base, posBuff, negBuff = UnitAttackPower("player")
|
||||||
effective = base + posBuff + negBuff;
|
effective = base + posBuff + negBuff
|
||||||
pwr = effective;
|
pwr = effective
|
||||||
end
|
end
|
||||||
|
|
||||||
self.text:SetText(format(displayNumberString, ATTACK_POWER, pwr));
|
self.text:SetText(format(displayNumberString, ATTACK_POWER, pwr))
|
||||||
lastPanel = self;
|
lastPanel = self
|
||||||
end
|
end
|
||||||
|
|
||||||
local function OnEnter(self)
|
local function OnEnter(self)
|
||||||
DT:SetupTooltip(self);
|
DT:SetupTooltip(self)
|
||||||
|
|
||||||
if(E.myclass == "HUNTER") then
|
if(E.myclass == "HUNTER") then
|
||||||
DT.tooltip:AddDoubleLine(RANGED_ATTACK_POWER, pwr, 1, 1, 1);
|
DT.tooltip:AddDoubleLine(RANGED_ATTACK_POWER, pwr, 1, 1, 1)
|
||||||
|
|
||||||
local line = format(RANGED_ATTACK_POWER_TOOLTIP, max((pwr), 0) / ATTACK_POWER_MAGIC_NUMBER);
|
local line = format(RANGED_ATTACK_POWER_TOOLTIP, max((pwr), 0) / ATTACK_POWER_MAGIC_NUMBER)
|
||||||
|
|
||||||
DT.tooltip:AddLine(line, nil, nil, nil, true);
|
DT.tooltip:AddLine(line, nil, nil, nil, true)
|
||||||
else
|
else
|
||||||
DT.tooltip:AddDoubleLine(MELEE_ATTACK_POWER, pwr, 1, 1, 1);
|
DT.tooltip:AddDoubleLine(MELEE_ATTACK_POWER, pwr, 1, 1, 1)
|
||||||
DT.tooltip:AddLine(format(MELEE_ATTACK_POWER_TOOLTIP, max((base + posBuff + negBuff), 0) / ATTACK_POWER_MAGIC_NUMBER), nil, nil, nil, true);
|
DT.tooltip:AddLine(format(MELEE_ATTACK_POWER_TOOLTIP, max((base + posBuff + negBuff), 0) / ATTACK_POWER_MAGIC_NUMBER), nil, nil, nil, true)
|
||||||
end
|
end
|
||||||
|
|
||||||
DT.tooltip:Show();
|
DT.tooltip:Show()
|
||||||
end
|
end
|
||||||
|
|
||||||
local function ValueColorUpdate(hex)
|
local function ValueColorUpdate(hex)
|
||||||
displayNumberString = join("", "%s: ", hex, "%d|r");
|
displayNumberString = join("", "%s: ", hex, "%d|r")
|
||||||
|
|
||||||
if(lastPanel ~= nil) then
|
if(lastPanel ~= nil) then
|
||||||
OnEvent(lastPanel);
|
OnEvent(lastPanel)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
E["valueColorUpdateFuncs"][ValueColorUpdate] = true;
|
E["valueColorUpdateFuncs"][ValueColorUpdate] = true
|
||||||
|
|
||||||
DT:RegisterDatatext("Attack Power", {"UNIT_ATTACK_POWER", "UNIT_RANGED_ATTACK_POWER"}, OnEvent, nil, nil, OnEnter, nil, ATTACK_POWER_TOOLTIP)
|
DT:RegisterDatatext("Attack Power", {"UNIT_ATTACK_POWER", "UNIT_RANGED_ATTACK_POWER"}, OnEvent, nil, nil, OnEnter, nil, ATTACK_POWER_TOOLTIP)
|
||||||
@@ -455,13 +455,14 @@ P["datatexts"] = {
|
|||||||
["TopLeftMiniPanel"] = "",
|
["TopLeftMiniPanel"] = "",
|
||||||
},
|
},
|
||||||
["battleground"] = true,
|
["battleground"] = true,
|
||||||
["panelTransparency"] = false,
|
|
||||||
["panelBackdrop"] = true,
|
["panelBackdrop"] = true,
|
||||||
|
["panelTransparency"] = false,
|
||||||
|
|
||||||
--Datatext Options
|
--Datatext Options
|
||||||
--General
|
--General
|
||||||
["goldFormat"] = "BLIZZARD",
|
["goldFormat"] = "BLIZZARD",
|
||||||
["goldCoins"] = false,
|
["goldCoins"] = false,
|
||||||
|
|
||||||
--Time Datatext
|
--Time Datatext
|
||||||
["timeFormat"] = "%I:%M",
|
["timeFormat"] = "%I:%M",
|
||||||
["dateFormat"] = "",
|
["dateFormat"] = "",
|
||||||
|
|||||||
Reference in New Issue
Block a user