This commit is contained in:
Bunny67
2020-06-04 23:20:52 +03:00
parent 99c1114efb
commit 26a968f932
9 changed files with 8 additions and 354 deletions
+4 -17
View File
@@ -672,12 +672,8 @@ function WeakAuras.ScanAuras(unit)
end
end
local satisfies_role = true
if data.group_role then
satisfies_role = data.group_role == "ANY" or UnitGroupRolesAssigned(unit) == data.group_role
end
local satisfies_ignoreSelf = not data.ignoreSelf or not UnitIsUnit(unit, "player")
if not satisfies_role or not satisfies_ignoreSelf then
if not satisfies_ignoreSelf then
active = false
end
@@ -715,17 +711,9 @@ function WeakAuras.ScanAuras(unit)
if(data.group_count) then
-- Query count from aura cache
local aura_count = aura_object:GetNumber(id, triggernum, data)
local max
if (data.group_role) then
max = aura_cache[data.group_role]
if (data.ignoreSelf and aura_cache.playerRole == data.group_role) then
max = max - 1;
end
else
max = aura_object:GetMaxNumber();
if (data.ignoreSelf) then
max = max - 1;
end
local max = aura_object:GetMaxNumber();
if (data.ignoreSelf) then
max = max - 1;
end
local satisfies_count = data.group_count(aura_count, max);
@@ -1597,7 +1585,6 @@ function BuffTrigger.Add(data)
hideAlone = trigger.hideAlone,
stack_info = trigger.stack_info,
name_info = trigger.name_info,
group_role = trigger.useGroupRole and trigger.group_role,
ignoreSelf = trigger.ignoreSelf
};
end
-6
View File
@@ -881,10 +881,6 @@ local function TriggerInfoApplies(triggerInfo, unit)
return false
end
if triggerInfo.groupRole and triggerInfo.groupRole ~= UnitGroupRolesAssigned(unit) then
return false
end
if triggerInfo.unit == "group" and triggerInfo.groupSubType == "party" then
if IsInRaid() then
-- Filter our player/party# while in raid and keep only raid units that are correct
@@ -2121,7 +2117,6 @@ function BuffTrigger.Add(data)
local groupTrigger = trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party"
local effectiveIgnoreSelf = groupTrigger and trigger.ignoreSelf
local effectiveGroupRole = groupTrigger and trigger.useGroupRole and trigger.group_role
local effectiveClass = groupTrigger and trigger.useClass and trigger.class
if trigger.unit == "multi" then
@@ -2173,7 +2168,6 @@ function BuffTrigger.Add(data)
fetchTooltip = not IsSingleMissing(trigger) and trigger.unit ~= "multi" and trigger.fetchTooltip,
groupTrigger = IsGroupTrigger(trigger),
ignoreSelf = effectiveIgnoreSelf,
groupRole = effectiveGroupRole,
groupSubType = groupSubType,
groupCountFunc = groupCountFunc,
class = effectiveClass,
+1 -9
View File
@@ -2518,8 +2518,6 @@ function WeakAuras.WatchUnitChange(unit)
watchUnitChange:SetScript("OnEvent", function(self, event, unit)
WeakAuras.StartProfileSystem("generictrigger unit change");
local inRaid = IsInRaid()
local inRaidChanged = inRaid ~= watchUnitChange.inRaid
local UnitGroupRolesAssigned = not WeakAuras.IsClassic() and UnitGroupRolesAssigned or function() return "DAMAGER" end
for unit, guid in pairs(watchUnitChange.unitChangeGUIDS) do
local newGuid = WeakAuras.UnitExistsFixed(unit) and UnitGUID(unit) or ""
@@ -2528,14 +2526,8 @@ function WeakAuras.WatchUnitChange(unit)
watchUnitChange.unitChangeGUIDS[unit] = newGuid
elseif WeakAuras.multiUnitUnits.group[unit] then
-- If in raid changed we send a UNIT_CHANGED for the group units
if inRaidChanged then
if inRaid ~= watchUnitChange.inRaid then
WeakAuras.ScanEvents("UNIT_CHANGED_" .. unit, unit)
else
local newRole = UnitGroupRolesAssigned(unit)
if watchUnitChange.unitRoles[unit] ~= newRole then
watchUnitChange.unitRoles[unit] = newRole
WeakAuras.ScanEvents("UNIT_ROLE_CHANGED_" .. unit, unit)
end
end
end
end
-251
View File
@@ -9,7 +9,6 @@ local ceil, min = ceil, min
-- WoW APIs
local GetTalentInfo = GetTalentInfo
local UnitClass, UnitHealth, UnitHealthMax, UnitName, UnitStagger, UnitPower, UnitPowerMax = UnitClass, UnitHealth, UnitHealthMax, UnitName, UnitStagger, UnitPower, UnitPowerMax
local UnitAlternatePowerInfo, UnitAlternatePowerTextureInfo = UnitAlternatePowerInfo, UnitAlternatePowerTextureInfo
local GetSpellInfo, GetItemInfo, GetItemCount, GetItemIcon = GetSpellInfo, GetItemInfo, GetItemCount, GetItemIcon
local GetShapeshiftFormInfo, GetShapeshiftForm = GetShapeshiftFormInfo, GetShapeshiftForm
local GetRuneCooldown, UnitCastingInfo, UnitChannelInfo = GetRuneCooldown, UnitCastingInfo, UnitChannelInfo
@@ -76,206 +75,6 @@ end
LibRangeCheck:RegisterCallback(LibRangeCheck.CHECKERS_CHANGED, RangeCacheUpdate)
local encounter_list = ""
local zoneId_list = ""
local zoneGroupId_list = ""
function WeakAuras.InitializeEncounterAndZoneLists()
if encounter_list ~= "" then
return
end
if WeakAuras.IsClassic() then
local classic_raids = {
[L["Black Wing Lair"]] = {
{ L["Razorgore the Untamed"], 610 },
{ L["Vaelastrasz the Corrupt"], 611 },
{ L["Broodlord Lashlayer"], 612 },
{ L["Firemaw"], 613 },
{ L["Ebonroc"], 614 },
{ L["Flamegor"], 615 },
{ L["Chromaggus"], 616 },
{ L["Nefarian"], 617 }
},
[L["Molten Core"]] = {
{ L["Lucifron"], 663 },
{ L["Magmadar"], 664 },
{ L["Gehennas"], 665 },
{ L["Garr"], 666 },
{ L["Shazzrah"], 667 },
{ L["Baron Geddon"], 668 },
{ L["Sulfuron Harbinger"], 669 },
{ L["Golemagg the Incinerator"], 670 },
{ L["Majordomo Executus"], 671 },
{ L["Ragnaros"], 672 }
},
[L["Ahn'Qiraj"]] = {
{ L["The Prophet Skeram"], 709 },
{ L["Silithid Royalty"], 710 },
{ L["Battleguard Sartura"], 711 },
{ L["Fankriss the Unyielding"], 712 },
{ L["Viscidus"], 713 },
{ L["Princess Huhuran"], 714 },
{ L["Twin Emperors"], 715 },
{ L["Ouro"], 716 },
{ L["C'thun"], 717 }
},
[L["Ruins of Ahn'Qiraj"]] = {
{ L["Kurinnaxx"], 718 },
{ L["General Rajaxx"], 719 },
{ L["Moam"], 720 },
{ L["Buru the Gorger"], 721 },
{ L["Ayamiss the Hunter"], 722 },
{ L["Ossirian the Unscarred"], 723 }
},
[L["Zul'Gurub"]] = {
{ L["High Priest Venoxis"], 784 },
{ L["High Priestess Jeklik"], 785 },
{ L["High Priestess Mar'li"], 786 },
{ L["Bloodlord Mandokir"], 787 },
{ L["Edge of Madness"], 788 },
{ L["High Priest Thekal"], 789 },
{ L["Gahz'ranka"], 790 },
{ L["High Priestess Arlokk"], 791 },
{ L["Jin'do the Hexxer"], 792 },
{ L["Hakkar"], 793 }
},
[L["Onyxia's Lair"]] = {
{ L["Onyxia"], 1084 }
},
[L["Naxxramas"]] = {
-- The Arachnid Quarter
{ L["Anub'Rekhan"], 1107 },
{ L["Grand Widow Faerlina"], 1110 },
{ L["Maexxna"], 1116 },
-- The Plague Quarter
{ L["Noth the Plaguebringer"], 1117 },
{ L["Heigan the Unclean"], 1112 },
{ L["Loatheb"], 1115 },
-- The Military Quarter
{ L["Instructor Razuvious"], 1113 },
{ L["Gothik the Harvester"], 1109 },
{ L["The Four Horsemen"], 1121 },
-- The Construct Quarter
{ L["Patchwerk"], 1118 },
{ L["Grobbulus"], 1111 },
{ L["Gluth"], 1108 },
{ L["Thaddius"], 1120 },
-- Frostwyrm Lair
{ L["Sapphiron"], 1119 },
{ L["Kel'Thuzad"], 1114 }
}
}
for instance_name, instance_boss in pairs(classic_raids) do
encounter_list = ("%s|cffffd200%s|r\n"):format(encounter_list, instance_name)
for _, data in ipairs(instance_boss) do
encounter_list = ("%s%s: %d\n"):format(encounter_list, data[1], data[2])
end
encounter_list = encounter_list .. "\n"
end
else
EJ_SelectTier(EJ_GetNumTiers())
for _, inRaid in ipairs({false, true}) do
local instance_index = 1
local instance_id = EJ_GetInstanceByIndex(instance_index, inRaid)
local title = inRaid and L["Raids"] or L["Dungeons"]
zoneId_list = ("%s|cffffd200%s|r\n"):format(zoneId_list, title)
zoneGroupId_list = ("%s|cffffd200%s|r\n"):format(zoneGroupId_list, title)
while instance_id do
EJ_SelectInstance(instance_id)
local instance_name, _, _, _, _, _, dungeonAreaMapID = EJ_GetInstanceInfo(instance_id)
local ej_index = 1
local boss, _, _, _, _, _, encounter_id = EJ_GetEncounterInfoByIndex(ej_index, instance_id)
-- zone ids and zone group ids
if dungeonAreaMapID and dungeonAreaMapID ~= 0 then
local mapGroupId = C_Map.GetMapGroupID(dungeonAreaMapID)
if mapGroupId then
zoneGroupId_list = ("%s%s: %d\n"):format(zoneGroupId_list, instance_name, mapGroupId)
local maps = ""
for k, map in ipairs(C_Map.GetMapGroupMembersInfo(mapGroupId)) do
if map.mapID then
maps = maps .. map.mapID .. ", "
end
end
maps = maps:match "^(.*), \n?$" or "" -- trim last ", "
zoneId_list = ("%s%s: %s\n"):format(zoneId_list, instance_name, maps)
else
zoneId_list = ("%s%s: %d\n"):format(zoneId_list, instance_name, dungeonAreaMapID)
end
end
-- Encounter ids
if inRaid then
while boss do
if encounter_id then
if instance_name then
encounter_list = ("%s|cffffd200%s|r\n"):format(encounter_list, instance_name)
instance_name = nil -- Only add it once per section
end
encounter_list = ("%s%s: %d\n"):format(encounter_list, boss, encounter_id)
end
ej_index = ej_index + 1
boss, _, _, _, _, _, encounter_id = EJ_GetEncounterInfoByIndex(ej_index, instance_id)
end
encounter_list = encounter_list .. "\n"
end
instance_index = instance_index + 1
instance_id = EJ_GetInstanceByIndex(instance_index, inRaid)
end
zoneId_list = zoneId_list .. "\n"
zoneGroupId_list = zoneGroupId_list .. "\n"
end
end
encounter_list = encounter_list:sub(1, -3) .. "\n\n" .. L["Supports multiple entries, separated by commas\n"]
end
local function get_encounters_list()
return encounter_list
end
local function get_zoneId_list()
if WeakAuras.IsClassic() then return "" end
local currentmap_id = C_Map.GetBestMapForUnit("player")
local currentmap_info = C_Map.GetMapInfo(currentmap_id)
local currentmap_name = currentmap_info and currentmap_info.name or ""
local mapGroupId = C_Map.GetMapGroupID(currentmap_id)
if mapGroupId then
-- if map is in a group, its real name is (or should be?) found in GetMapGroupMembersInfo
for k, map in ipairs(C_Map.GetMapGroupMembersInfo(mapGroupId)) do
if map.mapID and map.mapID == currentmap_id and map.name then
currentmap_name = map.name
break
end
end
end
return ("%s|cffffd200%s|r%s: %d\n\n%s"):format(
zoneId_list,
L["Current Zone\n"],
currentmap_name,
currentmap_id,
L["Supports multiple entries, separated by commas"]
)
end
local function get_zoneGroupId_list()
if WeakAuras.IsClassic() then return "" end
local currentmap_id = C_Map.GetBestMapForUnit("player")
local currentmap_info = C_Map.GetMapInfo(currentmap_id)
local currentmap_name = currentmap_info and currentmap_info.name
local currentmapgroup_id = C_Map.GetMapGroupID(currentmap_id)
return ("%s|cffffd200%s|r\n%s%s\n\n%s"):format(
zoneGroupId_list,
L["Current Zone Group"],
currentmapgroup_id and currentmap_name and currentmap_name..": " or "",
currentmapgroup_id or L["None"],
L["Supports multiple entries, separated by commas"]
)
end
WeakAuras.function_strings = {
count = [[
return function(count)
@@ -712,26 +511,6 @@ function WeakAuras.CheckTalentByIndex(index)
return rank and rank > 0;
end
function WeakAuras.CheckNumericIds(loadids, currentId)
if (not loadids or not currentId) then
return false;
end
local searchFrom = 0;
local startI, endI = string.find(loadids, currentId, searchFrom);
while (startI) do
searchFrom = endI + 1; -- start next search from end
if (startI == 1 or tonumber(string.sub(loadids, startI - 1, startI - 1)) == nil) then
-- Either right at start, or character before is not a number
if (endI == string.len(loadids) or tonumber(string.sub(loadids, endI + 1, endI + 1)) == nil) then
return true;
end
end
startI, endI = string.find(loadids, currentId, searchFrom);
end
return false;
end
function WeakAuras.CheckString(ids, currentId)
if (not ids or not currentId) then
return false;
@@ -764,18 +543,6 @@ function WeakAuras.ValidateNumericOrPercent(info, val)
return true
end
function WeakAuras.CheckMPlusAffixIds(loadids, currentId)
if (not loadids or not currentId) or type(currentId) ~= "table" then
return false
end
for i=1, #currentId do
if loadids == currentId[i] then
return true
end
end
return false
end
function WeakAuras.CheckChargesDirection(direction, triggerDirection)
return triggerDirection == "CHANGED"
or (triggerDirection == "GAINED" and direction > 0)
@@ -1108,20 +875,6 @@ local function AddUnitChangeInternalEvents(triggerUnit, t)
end
end
local function AddUnitRoleChangeInternalEvents(triggerUnit, t)
if (triggerUnit == nil) then
return
end
if WeakAuras.multiUnitUnits[triggerUnit] then
for unit in pairs(WeakAuras.multiUnitUnits[triggerUnit]) do
tinsert(t, "UNIT_ROLE_CHANGED_" .. string.lower(unit))
end
else
tinsert(t, "UNIT_ROLE_CHANGED_" .. string.lower(triggerUnit))
end
end
local function AddUnitEventForEvents(result, unit, event)
if unit then
if not result.unit_events then
@@ -1186,7 +939,6 @@ WeakAuras.event_prototypes = {
if trigger.unitisunit then
AddUnitChangeInternalEvents(trigger.unitisunit, result)
end
AddUnitRoleChangeInternalEvents(unit, result)
return result
end,
force_events = unitHelperFunctions.UnitChangedForceEvents,
@@ -1315,7 +1067,6 @@ WeakAuras.event_prototypes = {
local unit = trigger.unit
local result = {}
AddUnitChangeInternalEvents(unit, result)
AddUnitRoleChangeInternalEvents(unit, result)
return result
end,
force_events = unitHelperFunctions.UnitChangedForceEvents,
@@ -1443,7 +1194,6 @@ WeakAuras.event_prototypes = {
local unit = trigger.unit
local result = {}
AddUnitChangeInternalEvents(unit, result)
AddUnitRoleChangeInternalEvents(unit, result)
return result
end,
@@ -4807,7 +4557,6 @@ WeakAuras.event_prototypes = {
local unit = trigger.unit
local result = {"CAST_REMAINING_CHECK"}
AddUnitChangeInternalEvents(unit, result)
AddUnitRoleChangeInternalEvents(unit, result)
return result
end,
force_events = unitHelperFunctions.UnitChangedForceEvents,
-9
View File
@@ -1424,7 +1424,6 @@ function WeakAuras.ShowDisplayTooltip(data, children, matchInfo, icon, icons, im
local hasDescription = data.desc and data.desc ~= "";
local hasUrl = data.url and data.url ~= "";
local hasVersion = (data.semver and data.semver ~= "") or (data.version and data.version ~= "");
local tocbuild = data.tocbuild;
if hasDescription or hasUrl or hasVersion then
tinsert(tooltip, {1, " "});
@@ -1591,14 +1590,6 @@ function WeakAuras.ShowDisplayTooltip(data, children, matchInfo, icon, icons, im
tinsert(tooltip, {1, L["It might not work correctly with your version!"], 1, 0, 0})
end
if WeakAuras.IsClassic() and (not tocbuild or tocbuild > 20000) then
tinsert(tooltip, {1, L["This aura was created with the retail version of World of Warcraft."], 1, 0, 0})
tinsert(tooltip, {1, L["It might not work correctly on Classic!"], 1, 0, 0})
elseif tocbuild and not WeakAuras.IsClassic() and tocbuild < 20000 then
tinsert(tooltip, {1, L["This aura was created with the Classic version of World of Warcraft."], 1, 0, 0})
tinsert(tooltip, {1, L["It might not work correctly on Retail!"], 1, 0, 0})
end
tinsert(tooltip, {2, " ", " ", 0, 1, 0})
tinsert(tooltip, {2, " ", " ", 0, 1, 0})
+1 -12
View File
@@ -1284,18 +1284,7 @@ WeakAuras.group_types = {
WeakAuras.difficulty_types = {
none = L["None"],
normal = PLAYER_DIFFICULTY1,
heroic = PLAYER_DIFFICULTY2,
mythic = PLAYER_DIFFICULTY6,
timewalking = PLAYER_DIFFICULTY_TIMEWALKER,
lfr = PLAYER_DIFFICULTY3,
challenge = PLAYER_DIFFICULTY5
}
-- TODO
WeakAuras.role_types = {
TANK = "INLINE_TANK_ICON".." "..TANK,
DAMAGER = "INLINE_DAMAGER_ICON".." "..DAMAGER,
HEALER = "INLINE_HEALER_ICON".." "..HEALER
heroic = PLAYER_DIFFICULTY2
}
WeakAuras.classification_types = {
+2 -8
View File
@@ -1658,12 +1658,7 @@ WeakAuras.frames["Addon Initialization Handler"] = loadedFrame;
loadedFrame:RegisterEvent("ADDON_LOADED");
loadedFrame:RegisterEvent("PLAYER_LOGIN");
loadedFrame:RegisterEvent("PLAYER_ENTERING_WORLD");
if not WeakAuras.IsClassic() then
loadedFrame:RegisterEvent("ACTIVE_TALENT_GROUP_CHANGED");
else
loadedFrame:RegisterEvent("CHARACTER_POINTS_CHANGED");
loadedFrame:RegisterEvent("SPELLS_CHANGED");
end
loadedFrame:RegisterEvent("ACTIVE_TALENT_GROUP_CHANGED");
loadedFrame:SetScript("OnEvent", function(self, event, addon)
if(event == "ADDON_LOADED") then
if(addon == ADDON_NAME) then
@@ -1731,9 +1726,8 @@ loadedFrame:SetScript("OnEvent", function(self, event, addon)
end
WeakAuras.CreateTalentCache() -- It seems that GetTalentInfo might give info about whatever class was previously being played, until PLAYER_ENTERING_WORLD
WeakAuras.UpdateCurrentInstanceType();
--WeakAuras.InitializeEncounterAndZoneLists()
end
elseif(event == "ACTIVE_TALENT_GROUP_CHANGED" or event == "CHARACTER_POINTS_CHANGED" or event == "SPELLS_CHANGED") then
elseif(event == "ACTIVE_TALENT_GROUP_CHANGED") then
callback = WeakAuras.CreateTalentCache;
elseif(event == "PLAYER_REGEN_ENABLED") then
callback = function()
-17
View File
@@ -845,23 +845,6 @@ local function GetBuffTriggerOptions(data, optionTriggerChoices)
WeakAuras.UpdateDisplayButton(data);
end
},
useGroupRole = {
type = "toggle",
width = WeakAuras.normalWidth,
name = L["Filter by Group Role"],
order = 47.1,
hidden = function() return not (trigger.type == "aura" and trigger.unit == "group"); end,
},
group_role = {
type = "select",
width = WeakAuras.normalWidth,
name = L["Group Role"],
values = WeakAuras.role_types,
hidden = function() return not (trigger.type == "aura" and trigger.unit == "group"); end,
disabled = function() return not trigger.useGroupRole; end,
get = function() return trigger.group_role; end,
order = 47.2
},
ignoreSelf = {
type = "toggle",
name = L["Ignore self"],
-25
View File
@@ -647,31 +647,6 @@ local function GetBuffTriggerOptions(data, optionTriggerChoices)
order = 66,
hidden = function() return not trigger.type == "aura2" end
},
useGroupRole = {
type = "toggle",
width = WeakAuras.normalWidth,
name = L["Filter by Group Role"],
order = 67.1,
hidden = function() return
not (trigger.type == "aura2" and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party"))
or WeakAuras.IsClassic()
end
},
group_role = {
type = "select",
width = WeakAuras.normalWidth,
name = L["Group Role"],
values = WeakAuras.role_types,
hidden = function() return not (trigger.type == "aura2" and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party") and trigger.useGroupRole) end,
order = 67.2
},
group_roleSpace = {
type = "description",
name = "",
order = 67.2,
width = WeakAuras.normalWidth,
hidden = function() return not (trigger.type == "aura2" and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party") and not trigger.useGroupRole) end
},
ignoreSelf = {
type = "toggle",
name = L["Ignore Self"],