from retail

This commit is contained in:
NoM0Re
2025-01-19 14:27:20 +01:00
parent f72e96ae6e
commit dccd22b610
13 changed files with 530 additions and 91 deletions
+13 -1
View File
@@ -2686,10 +2686,22 @@ function BuffTrigger.GetTriggerConditions(data, triggernum)
}
result["unitCaster"] = {
display = L["Caster"],
display = L["Caster Unit"],
type = "string"
}
result["nameCaster"] = {
display = L["Casters Name/Realm"],
type = "string",
preamble = function(input)
return Private.ExecEnv.ParseNameCheck(input)
end,
test = function(state, needle, op, preamble)
return state.unitCaster and preamble:Check(WeakAuras.UnitNameWithRealm(state.unitCaster))
end,
operator_types = "none",
}
result["expirationTime"] = {
display = L["Remaining Duration"],
type = "timer"
-4
View File
@@ -21,10 +21,6 @@ function WeakAuras.isAwesomeEnabled()
return isAwesomeEnabled
end
function WeakAuras.IsClassic()
return false
end
function WeakAuras.IsCorrectVersion()
return true
end
+143 -4
View File
@@ -1050,6 +1050,7 @@ Private.load_prototype = {
operator = "and",
limit = 2
},
optional = true,
},
{
name = "group_leader",
@@ -2191,7 +2192,7 @@ Private.event_prototypes = {
display = L["Power Type"],
type = "select",
values = "power_types",
init = "unitPowerType",
init = "powerTypeToCheck",
test = "true",
store = true,
conditionType = "select",
@@ -4892,7 +4893,11 @@ Private.event_prototypes = {
},
["Chat Message"] = {
type = "event",
events = {
events = function(trigger)
if trigger.use_messageType and trigger.messageType and Private.chat_message_types[trigger.messageType] then
return { ["events"] = {trigger.messageType} }
end
return {
["events"] = {
"CHAT_MSG_BATTLEGROUND",
"CHAT_MSG_BATTLEGROUND_LEADER",
@@ -4920,9 +4925,11 @@ Private.event_prototypes = {
"CHAT_MSG_WHISPER",
"CHAT_MSG_YELL",
"CHAT_MSG_SYSTEM",
"CHAT_MSG_TEXT_EMOTE"
"CHAT_MSG_TEXT_EMOTE",
"CHAT_MSG_LOOT",
}
},
}
end,
name = L["Chat Message"],
init = function(trigger)
local ret = [[
@@ -7025,6 +7032,138 @@ Private.event_prototypes = {
},
automaticrequired = true
},
--[[ Some day i will finish this, soonTM
["Currency"] = {
type = "unit",
canHaveDuration = false,
events = {
["events"] = {
"CURRENCY_DISPLAY_UPDATE",
}
},
force_events = "CURRENCY_DISPLAY_UPDATE",
name = WeakAuras.newFeatureString..L["Currency"],
init = function(trigger)
local ret = [=[
local currencyInfo = {
name = GetItemInfo(%d),
quantity = GetItemCount(%d),
iconFileID = select(6, GetItemInfo(%d)),
totalEarned = Private.GetTotalCountCurrencies(%d),
discovered = Private.GetDiscoveredCurencies(%d),
}
if not currencyInfo.name then
currencyInfo = {
name = "Unknown Currency",
quantity = 0,
iconFileID = "Interface\\Icons\\INV_Misc_QuestionMark",
totalEarned = 0,
discovered = false
}
end
]=]
return ret:format(trigger.currencyId or 1, trigger.currencyId or 1, trigger.currencyId or 1, trigger.currencyId or 1, trigger.currencyId or 1)
end,
statesParameter = "one",
args = {
{
name = "currencyId",
type = "currency",
itemControl = "Dropdown-Currency",
values = Private.GetDiscoveredCurencies,
headers = Private.GetDiscoveredCurenciesHeaders,
sorted = true,
sortOrder = function()
local discovered_currencies_sorted = Private.GetDiscoveredCurenciesSorted()
local sortOrder = {}
for key, value in pairs(Private.GetDiscoveredCurencies()) do
tinsert(sortOrder, key)
end
table.sort(sortOrder, function(aKey, bKey)
local aValue = discovered_currencies_sorted[aKey]
local bValue = discovered_currencies_sorted[bKey]
return aValue < bValue
end)
return sortOrder
end,
required = true,
display = L["Currency"],
store = true,
test = "true",
},
{
name = "name",
init = "currencyInfo.name",
hidden = true,
store = true,
test = "true",
},
{
name = "value",
init = "currencyInfo.quantity",
type = "number",
display = L["Quantity"],
store = true,
conditionType = "number",
},
{
name = "total",
init = "currencyInfo.maxQuantity",
type = "number",
hidden = true,
store = true,
test = "true",
},
{
name = "progressType",
init = "'static'",
hidden = true,
store = true,
test = "true",
},
{
name = "icon",
init = "currencyInfo.iconFileID",
store = true,
hidden = true,
test = "true",
},
{
name = "totalEarned",
init = "currencyInfo.totalEarned",
type = "number",
display = L["Total Earned in this Season"],
store = true,
conditionType = "number",
enable = function(trigger)
-- soonTM
end
},
{
name = "description",
init = "currencyInfo.description",
type = "string",
display = L["Description"],
store = true,
hidden = true,
test = "true",
},
{
name = "discovered",
init = "currencyInfo.discovered",
type = "tristate",
display = L["Discovered"],
store = true,
conditionType = "bool",
},
},
GetNameAndIcon = function(trigger)
local currencyInfo = Private.GetCurrencyInfoForTrigger(trigger)
return currencyInfo and currencyInfo.name, currencyInfo and currencyInfo.iconFileID
end,
automaticrequired = true
},
]]
["Location"] = {
type = "unit",
events = {
+7 -7
View File
@@ -439,14 +439,14 @@ end
local delayedImport = CreateFrame("FRAME")
local function ImportNow(data, children, target, sender, callbackFunc)
local function ImportNow(data, children, target, linkedAuras, sender, callbackFunc)
if InCombatLockdown() then
WeakAuras.prettyPrint(L["Importing will start after combat ends."])
delayedImport:RegisterEvent("PLAYER_REGEN_ENABLED")
delayedImport:SetScript("OnEvent", function()
delayedImport:UnregisterEvent("PLAYER_REGEN_ENABLED")
ImportNow(data, children, target, sender, callbackFunc)
ImportNow(data, children, target, linkedAuras, sender, callbackFunc)
end)
return
end
@@ -455,11 +455,11 @@ local function ImportNow(data, children, target, sender, callbackFunc)
if not WeakAuras.IsOptionsOpen() then
WeakAuras.OpenOptions()
end
Private.OpenUpdate(data, children, target, sender, callbackFunc)
Private.OpenUpdate(data, children, target, linkedAuras, sender, callbackFunc)
end
end
function WeakAuras.Import(inData, target, callbackFunc)
function WeakAuras.Import(inData, target, callbackFunc, linkedAuras)
local data, children, version
if type(inData) == 'string' then
-- encoded data
@@ -495,7 +495,7 @@ function WeakAuras.Import(inData, target, callbackFunc)
if highestVersion > WeakAuras.InternalVersion() then
-- Do not run PreAdd but still show Import Window
tooltipLoading = nil;
return ImportNow(data, children, target, nil, callbackFunc)
return ImportNow(data, children, target, linkedAuras, nil, callbackFunc)
end
]]
@@ -529,7 +529,7 @@ function WeakAuras.Import(inData, target, callbackFunc)
end
tooltipLoading = nil;
return ImportNow(data, children, target, nil, callbackFunc)
return ImportNow(data, children, target, linkedAuras, nil, callbackFunc)
end
local function crossRealmSendCommMessage(prefix, text, target, queueName, callbackFn, callbackArg)
@@ -659,7 +659,7 @@ Comm:RegisterComm("WeakAuras", function(prefix, message, distribution, sender)
end
ItemRefTooltip:Hide()
ImportNow(data, children, nil, sender)
ImportNow(data, children, nil, nil, sender)
elseif(received.m == "dR") then
if(Private.linked and Private.linked[received.d] and Private.linked[received.d] > GetTime() - linkValidityDuration) then
TransmitDisplay(received.d, sender);
+95 -5
View File
@@ -565,7 +565,7 @@ Private.format_types = {
if abbreviateFunc then
return function(guid)
local ok, _, class, _, _, _, name, realm = pcall(GetPlayerInfoByGUID, guid)
if ok then
if ok and name then
local name = abbreviateFunc(nameFunc(name, realm))
return colorFunc(class, name)
end
@@ -573,7 +573,7 @@ Private.format_types = {
else
return function(guid)
local ok, _, class, _, _, _, name, realm = pcall(GetPlayerInfoByGUID, guid)
if ok then
if ok and name then
return colorFunc(class, nameFunc(name, realm))
end
end
@@ -582,14 +582,14 @@ Private.format_types = {
if abbreviateFunc then
return function(guid)
local ok, _, class, _, _, _, name, realm = pcall(GetPlayerInfoByGUID, guid)
if ok then
if ok and name then
return abbreviateFunc(nameFunc(name, realm))
end
end
else
return function(guid)
local ok, _, class, _, _, _, name, realm = pcall(GetPlayerInfoByGUID, guid)
if ok then
if ok and name then
return nameFunc(name, realm)
end
end
@@ -1158,6 +1158,94 @@ for id, str in pairs(Private.combatlog_spell_school_types) do
Private.combatlog_spell_school_types_for_ui[id] = ("%.3d - %s"):format(id, str)
end
Private.item_quality_types = {
[0] = ITEM_QUALITY0_DESC,
[1] = ITEM_QUALITY1_DESC,
[2] = ITEM_QUALITY2_DESC,
[3] = ITEM_QUALITY3_DESC,
[4] = ITEM_QUALITY4_DESC,
[5] = ITEM_QUALITY5_DESC,
[6] = ITEM_QUALITY6_DESC,
[7] = ITEM_QUALITY7_DESC,
[8] = ITEM_QUALITY8_DESC,
}
Private.totalcount_currencies = {
[45624] = 3018, -- Emblems of Conquest
[40753] = 1465, -- Emblems of Valor
[29434] = 1462, -- Badges of Justice
[40752] = 1464, -- Emblems of Heroism
[47241] = 4729, -- Emblems of Triumph
[49426] = 4730, -- Emblems of Frost
}
function Private.GetTotalCountCurrencies(currencyID)
local achievementID = Private.totalcount_currencies[currencyID]
if achievementID then
local totalEarned = GetStatistic(achievementID)
return tonumber(totalEarned) or 0
end
return nil
end
local function InitializeCurrencies()
if Private.discovered_currencies then
return
end
Private.discovered_currencies = {}
Private.discovered_currencies_sorted = {}
Private.discovered_currencies_headers = {}
local expanded = {}
for index = GetCurrencyListSize(), 1, -1 do
local name, isHeader, isExpanded, _, _, _, _, _, _ = GetCurrencyListInfo(index)
if isHeader and not isExpanded then
ExpandCurrencyList(index, true)
expanded[name] = true
end
end
for index = 1, GetCurrencyListSize() do
local name, isHeader, _, _, _, _, _, iconFileID, itemID = GetCurrencyListInfo(index)
local currencyLink = tonumber(itemID) and GetItemInfo(itemID)
if currencyLink then
local icon = iconFileID or "Interface\\Icons\\INV_Misc_QuestionMark" --iconFileID not available on first login
Private.discovered_currencies[itemID] = "|T" .. icon .. ":0|t" .. name
Private.discovered_currencies_sorted[itemID] = index
elseif isHeader then
Private.discovered_currencies[name] = name
Private.discovered_currencies_sorted[name] = index
Private.discovered_currencies_headers[name] = true
end
end
for index = GetCurrencyListSize(), 1, -1 do
local name, isHeader = GetCurrencyListInfo(index)
if isHeader and expanded[name] then
ExpandCurrencyList(index, false)
end
end
Private.discovered_currencies["member"] = "|Tinterface\\common\\ui-searchbox-icon:0:0:0:-2|t"..L["Specific Currency"];
Private.discovered_currencies_sorted["member"] = -1;
end
Private.GetDiscoveredCurencies = function()
InitializeCurrencies()
return Private.discovered_currencies
end
Private.GetDiscoveredCurenciesSorted = function()
InitializeCurrencies()
return Private.discovered_currencies_sorted
end
Private.GetDiscoveredCurenciesHeaders = function()
InitializeCurrencies()
return Private.discovered_currencies_headers
end
Private.combatlog_raid_mark_check_type = {
[0] = RAID_TARGET_NONE,
"|TInterface\\TARGETINGFRAME\\UI-RaidTargetingIcon_1:14|t " .. RAID_TARGET_1, -- Star
@@ -2071,7 +2159,8 @@ Private.chat_message_types = {
CHAT_MSG_SAY = L["Say"],
CHAT_MSG_WHISPER = L["Whisper"],
CHAT_MSG_YELL = L["Yell"],
CHAT_MSG_SYSTEM = L["System"]
CHAT_MSG_SYSTEM = L["System"],
CHAT_MSG_LOOT = L["Loot"],
}
Private.send_chat_message_types = {
@@ -2474,6 +2563,7 @@ Private.update_categories = {
"url",
"desc",
"version",
"semver"
},
default = true,
label = L["Meta Data"],
+26 -39
View File
@@ -329,13 +329,6 @@ Private.ExecEnv.conditionHelpers = {}
local load_prototype = Private.load_prototype;
local levelColors = {
[0] = "|cFFFFFFFF",
[1] = "|cFF40FF40",
[2] = "|cFF6060FF",
[3] = "|cFFFF4040"
};
function Private.validate(input, default)
for field, defaultValue in pairs(default) do
if(type(defaultValue) == "table" and type(input[field]) ~= "table") then
@@ -2209,11 +2202,16 @@ function Private.AddMany(tbl, takeSnapshots)
coroutine.yield()
local groups = {}
for _, data in ipairs(order) do
WeakAuras.Add(data, takeSnapshots);
coroutine.yield()
WeakAuras.PreAdd(data)
if data.regionType == "dynamicgroup" or data.regionType == "group" then
groups[data] = true
end
coroutine.yield()
end
for _, data in ipairs(order) do
WeakAuras.Add(data, takeSnapshots);
coroutine.yield()
end
for id in pairs(anchorTargets) do
@@ -2388,29 +2386,6 @@ local function validateUserConfig(data, options, config)
end
end
local function removeSpellNames(data)
local trigger
for i = 1, #data.triggers do
trigger = data.triggers[i].trigger
if trigger and trigger.type == "aura" then
if type(trigger.spellName) == "number" then
trigger.realSpellName = GetSpellInfo(trigger.spellName) or trigger.realSpellName
end
if (trigger.spellId) then
trigger.name = GetSpellInfo(trigger.spellId) or trigger.name;
end
if (trigger.spellIds) then
for i = 1, 10 do
if (trigger.spellIds[i]) then
trigger.names = trigger.names or {};
trigger.names[i] = GetSpellInfo(trigger.spellIds[i]) or trigger.names[i];
end
end
end
end
end
end
local function removeNameplateUnits(data)
for _, triggerData in ipairs(data.triggers) do
local trigger = triggerData.trigger
@@ -2618,7 +2593,6 @@ function WeakAuras.PreAdd(data)
end
end
validateUserConfig(data, data.authorOptions, data.config)
removeSpellNames(data)
if not(WeakAuras.isAwesomeEnabled()) then
removeNameplateUnits(data)
end
@@ -2811,11 +2785,11 @@ end
function Private.SetRegion(data, cloneId)
local regionType = data.regionType;
if not(regionType) then
error("Improper arguments to Private.SetRegion - regionType not defined");
error("Improper arguments to Private.SetRegion - regionType not defined in ".. data.id)
else
if(not regionTypes[regionType]) then
regionType = "fallback";
print("Improper arguments to WeakAuras.CreateRegion - regionType \""..data.regionType.."\" is not supported");
print("Improper arguments to WeakAuras.CreateRegion - regionType \""..data.regionType.."\" is not supported in ".. data.id)
end
local id = data.id;
@@ -3661,15 +3635,19 @@ local function SetFrameLevel(id, frameLevel)
end
function Private.FixGroupChildrenOrderForGroup(data)
SetFrameLevel(data.id, 0)
local frameLevel, offset
if data.regionType == "dynamicgroup" then
frameLevel, offset = 5, 0
else
frameLevel, offset = 1, 4
frameLevel, offset = 2, 4
end
for child in Private.TraverseLeafs(data) do
SetFrameLevel(child.id, frameLevel);
frameLevel = frameLevel + offset;
for _, childId in ipairs(data.controlledChildren) do
local data = WeakAuras.GetData(childId)
if data.regionType ~= "group" and data.regionType ~= "dynamicgroup" then
SetFrameLevel(childId, frameLevel);
frameLevel = frameLevel + offset;
end
end
end
@@ -3679,18 +3657,27 @@ end
function Private.ApplyFrameLevel(region, frameLevel)
frameLevel = frameLevel or GetFrameLevelFor(region.id)
local setBackgroundFrameLevel = false
if region.subRegions then
for index, subRegion in pairs(region.subRegions) do
if subRegion.type == "subbackground" then
subRegion:SetFrameLevel(frameLevel + index)
setBackgroundFrameLevel = true
end
end
if not setBackgroundFrameLevel then
region:SetFrameLevel(frameLevel)
end
for index, subRegion in pairs(region.subRegions) do
if subRegion.type ~= "subbackground" then
subRegion:SetFrameLevel(frameLevel + index)
end
end
else
region:SetFrameLevel(frameLevel)
end
end