(feature/Prototypes) add Faction Reputation trigger (#42)
This commit is contained in:
+299
-1
@@ -1607,7 +1607,7 @@ function Private.ExecEnv.GetTotalCountCurrencies(currencyID)
|
||||
end
|
||||
|
||||
local function InitializeCurrencies()
|
||||
if Private.discovered_currencies then
|
||||
if Private.discovered_currencies and next(Private.discovered_currencies) then
|
||||
return
|
||||
end
|
||||
Private.discovered_currencies = {}
|
||||
@@ -1664,6 +1664,124 @@ Private.GetDiscoveredCurrenciesHeaders = function()
|
||||
return Private.discovered_currencies_headers
|
||||
end
|
||||
|
||||
Private.ExecEnv.GetFactionDataByIndex = function(index)
|
||||
local name, description, standingID, barMin, barMax, barValue, atWarWith, canToggleAtWar, isHeader, isCollapsed, hasRep, isWatched, isChild = GetFactionInfo(index)
|
||||
return {
|
||||
factionID = name and Private.faction_to_id[name] or 0,
|
||||
name = name,
|
||||
description = description,
|
||||
reaction = standingID,
|
||||
currentReactionThreshold = barMin,
|
||||
nextReactionThreshold = barMax,
|
||||
currentStanding = barValue,
|
||||
atWarWith = atWarWith or false,
|
||||
canToggleAtWar = canToggleAtWar,
|
||||
isChild = isChild,
|
||||
isHeader = isHeader,
|
||||
isHeaderWithRep = hasRep,
|
||||
isCollapsed = isCollapsed,
|
||||
isWatched = isWatched,
|
||||
}
|
||||
end
|
||||
|
||||
Private.ExecEnv.GetFactionDataByID = function(ID)
|
||||
local factionName = ID and Private.id_to_faction[ID]
|
||||
if factionName then
|
||||
for index = 1, GetNumFactions() do
|
||||
local name, description, standingID, barMin, barMax, barValue, atWarWith, canToggleAtWar, isHeader, isCollapsed, hasRep, isWatched, isChild = GetFactionInfo(index)
|
||||
if name == factionName then
|
||||
return {
|
||||
factionID = ID,
|
||||
name = name,
|
||||
description = description,
|
||||
reaction = standingID,
|
||||
currentReactionThreshold = barMin,
|
||||
nextReactionThreshold = barMax,
|
||||
currentStanding = barValue,
|
||||
atWarWith = atWarWith or false,
|
||||
canToggleAtWar = canToggleAtWar,
|
||||
isChild = isChild,
|
||||
isHeader = isHeader,
|
||||
isHeaderWithRep = hasRep,
|
||||
isCollapsed = isCollapsed,
|
||||
isWatched = isWatched,
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Private.ExecEnv.GetWatchedFactionId = function()
|
||||
local factionName = GetWatchedFactionInfo()
|
||||
return factionName and Private.faction_to_id[factionName]
|
||||
end
|
||||
|
||||
local function InitializeReputations()
|
||||
if Private.reputations and next(Private.reputations) then
|
||||
return
|
||||
end
|
||||
|
||||
Private.reputations = {}
|
||||
Private.reputations_sorted = {}
|
||||
Private.reputations_headers = {}
|
||||
|
||||
-- Dynamic expansion of all collapsed headers
|
||||
local collapsed = {}
|
||||
local index = 1
|
||||
while index <= GetNumFactions() do
|
||||
local factionData = Private.ExecEnv.GetFactionDataByIndex(index)
|
||||
if factionData and factionData.isHeader and factionData.isCollapsed then
|
||||
ExpandFactionHeader(index)
|
||||
collapsed[factionData.name] = true
|
||||
end
|
||||
index = index + 1
|
||||
end
|
||||
|
||||
-- Process all faction data
|
||||
for i = 1, GetNumFactions() do
|
||||
local factionData = Private.ExecEnv.GetFactionDataByIndex(i)
|
||||
if factionData then
|
||||
if factionData.currentStanding > 0 or not factionData.isHeader then
|
||||
local factionID = factionData.factionID
|
||||
if factionID then
|
||||
Private.reputations[factionID] = factionData.name
|
||||
Private.reputations_sorted[factionID] = i
|
||||
end
|
||||
else
|
||||
local name = factionData.name
|
||||
if name then
|
||||
Private.reputations[name] = name
|
||||
Private.reputations_sorted[name] = i
|
||||
Private.reputations_headers[name] = true
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Collapse headers back to their original state
|
||||
for i = GetNumFactions(), 1, -1 do
|
||||
local factionData = Private.ExecEnv.GetFactionDataByIndex(i)
|
||||
if factionData and collapsed[factionData.name] then
|
||||
CollapseFactionHeader(i)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Private.GetReputations = function()
|
||||
InitializeReputations()
|
||||
return Private.reputations
|
||||
end
|
||||
|
||||
Private.GetReputationsSorted = function()
|
||||
InitializeReputations()
|
||||
return Private.reputations_sorted
|
||||
end
|
||||
|
||||
Private.GetReputationsHeaders = function()
|
||||
InitializeReputations()
|
||||
return Private.reputations_headers
|
||||
end
|
||||
|
||||
Private.combatlog_raid_mark_check_type = {
|
||||
[0] = RAID_TARGET_NONE,
|
||||
"|TInterface\\TARGETINGFRAME\\UI-RaidTargetingIcon_1:14|t " .. RAID_TARGET_1, -- Star
|
||||
@@ -3464,6 +3582,186 @@ WeakAuras.StopMotion.animation_types = {
|
||||
progress = L["Progress"]
|
||||
}
|
||||
|
||||
Private.id_to_faction = {
|
||||
["21"] = L["Booty Bay"],
|
||||
["47"] = L["Ironforge"],
|
||||
["54"] = L["Gnomeregan"],
|
||||
["59"] = L["Thorium Brotherhood"],
|
||||
["67"] = L["Horde"],
|
||||
["68"] = L["Undercity"],
|
||||
["69"] = L["Darnassus"],
|
||||
["70"] = L["Syndicate"],
|
||||
["72"] = L["Stormwind"],
|
||||
["76"] = L["Orgrimmar"],
|
||||
["81"] = L["Thunder Bluff"],
|
||||
["87"] = L["Bloodsail Buccaneers"],
|
||||
["92"] = L["Gelkis Clan Centaur"],
|
||||
["93"] = L["Magram Clan Centaur"],
|
||||
["270"] = L["Zandalar Tribe"],
|
||||
["349"] = L["Ravenholdt"],
|
||||
["369"] = L["Gadgetzan"],
|
||||
["469"] = L["Alliance"],
|
||||
["470"] = L["Ratchet"],
|
||||
["509"] = L["The League of Arathor"],
|
||||
["510"] = L["The Defilers"],
|
||||
["529"] = L["Argent Dawn"],
|
||||
["530"] = L["Darkspear Trolls"],
|
||||
["576"] = L["Timbermaw Hold"],
|
||||
["577"] = L["Everlook"],
|
||||
["589"] = L["Wintersaber Trainers"],
|
||||
["609"] = L["Cenarion Circle"],
|
||||
["729"] = L["Frostwolf Clan"],
|
||||
["730"] = L["Stormpike Guard"],
|
||||
["749"] = L["Hydraxian Waterlords"],
|
||||
["809"] = L["Shen'dralar"],
|
||||
["889"] = L["Warsong Outriders"],
|
||||
["890"] = L["Silverwing Sentinels"],
|
||||
["909"] = L["Darkmoon Faire"],
|
||||
["910"] = L["Brood of Nozdormu"],
|
||||
["911"] = L["Silvermoon City"],
|
||||
["922"] = L["Tranquillien"],
|
||||
["930"] = L["Exodar"],
|
||||
["932"] = L["The Aldor"],
|
||||
["933"] = L["The Consortium"],
|
||||
["934"] = L["The Scryers"],
|
||||
["935"] = L["The Sha'tar"],
|
||||
["941"] = L["The Mag'har"],
|
||||
["942"] = L["Cenarion Expedition"],
|
||||
["946"] = L["Honor Hold"],
|
||||
["947"] = L["Thrallmar"],
|
||||
["967"] = L["The Violet Eye"],
|
||||
["970"] = L["Sporeggar"],
|
||||
["978"] = L["Kurenai"],
|
||||
["989"] = L["Keepers of Time"],
|
||||
["990"] = L["The Scale of the Sands"],
|
||||
["1011"] = L["Lower City"],
|
||||
["1012"] = L["Ashtongue Deathsworn"],
|
||||
["1015"] = L["Netherwing"],
|
||||
["1031"] = L["Sha'tari Skyguard"],
|
||||
["1037"] = L["Alliance Vanguard"],
|
||||
["1038"] = L["Ogri'la"],
|
||||
["1050"] = L["Valiance Expedition"],
|
||||
["1052"] = L["Horde Expedition"],
|
||||
["1064"] = L["The Taunka"],
|
||||
["1067"] = L["The Hand of Vengeance"],
|
||||
["1068"] = L["Explorers' League"],
|
||||
["1073"] = L["The Kalu'ak"],
|
||||
["1077"] = L["Shattered Sun Offensive"],
|
||||
["1085"] = L["Warsong Offensive"],
|
||||
["1090"] = L["Kirin Tor"],
|
||||
["1091"] = L["The Wyrmrest Accord"],
|
||||
["1094"] = L["The Silver Covenant"],
|
||||
["1098"] = L["Knights of the Ebon Blade"],
|
||||
["1104"] = L["Frenzyheart Tribe"],
|
||||
["1105"] = L["The Oracles"],
|
||||
["1106"] = L["Argent Crusade"],
|
||||
["1119"] = L["The Sons of Hodir"],
|
||||
["1124"] = L["The Sunreavers"],
|
||||
["1126"] = L["The Frostborn"],
|
||||
["1133"] = L["Bilgewater Cartel"],
|
||||
["1134"] = L["Gilneas"],
|
||||
["1135"] = L["The Earthen Ring"],
|
||||
["1156"] = L["The Ashen Verdict"],
|
||||
["1158"] = L["Guardians of Hyjal"],
|
||||
["1171"] = L["Therazane"],
|
||||
["1172"] = L["Dragonmaw Clan"],
|
||||
["1173"] = L["Ramkahen"],
|
||||
["1174"] = L["Wildhammer Clan"],
|
||||
["1177"] = L["Baradin's Wardens"],
|
||||
["1178"] = L["Hellscream's Reach"],
|
||||
["10000"] = L["Winterfin Retreat"],
|
||||
}
|
||||
|
||||
Private.faction_to_id = {
|
||||
[L["Booty Bay"]] = 21,
|
||||
[L["Ironforge"]] = 47,
|
||||
[L["Gnomeregan"]] = 54,
|
||||
[L["Thorium Brotherhood"]] = 59,
|
||||
[L["Horde"]] = 67,
|
||||
[L["Undercity"]] = 68,
|
||||
[L["Darnassus"]] = 69,
|
||||
[L["Syndicate"]] = 70,
|
||||
[L["Stormwind"]] = 72,
|
||||
[L["Orgrimmar"]] = 76,
|
||||
[L["Thunder Bluff"]] = 81,
|
||||
[L["Bloodsail Buccaneers"]] = 87,
|
||||
[L["Gelkis Clan Centaur"]] = 92,
|
||||
[L["Magram Clan Centaur"]] = 93,
|
||||
[L["Zandalar Tribe"]] = 270,
|
||||
[L["Ravenholdt"]] = 349,
|
||||
[L["Gadgetzan"]] = 369,
|
||||
[L["Alliance"]] = 469,
|
||||
[L["Ratchet"]] = 470,
|
||||
[L["The League of Arathor"]] = 509,
|
||||
[L["The Defilers"]] = 510,
|
||||
[L["Argent Dawn"]] = 529,
|
||||
[L["Darkspear Trolls"]] = 530,
|
||||
[L["Timbermaw Hold"]] = 576,
|
||||
[L["Everlook"]] = 577,
|
||||
[L["Wintersaber Trainers"]] = 589,
|
||||
[L["Cenarion Circle"]] = 609,
|
||||
[L["Frostwolf Clan"]] = 729,
|
||||
[L["Stormpike Guard"]] = 730,
|
||||
[L["Hydraxian Waterlords"]] = 749,
|
||||
[L["Shen'dralar"]] = 809,
|
||||
[L["Warsong Outriders"]] = 889,
|
||||
[L["Silverwing Sentinels"]] = 890,
|
||||
[L["Darkmoon Faire"]] = 909,
|
||||
[L["Brood of Nozdormu"]] = 910,
|
||||
[L["Silvermoon City"]] = 911,
|
||||
[L["Tranquillien"]] = 922,
|
||||
[L["Exodar"]] = 930,
|
||||
[L["The Aldor"]] = 932,
|
||||
[L["The Consortium"]] = 933,
|
||||
[L["The Scryers"]] = 934,
|
||||
[L["The Sha'tar"]] = 935,
|
||||
[L["The Mag'har"]] = 941,
|
||||
[L["Cenarion Expedition"]] = 942,
|
||||
[L["Honor Hold"]] = 946,
|
||||
[L["Thrallmar"]] = 947,
|
||||
[L["The Violet Eye"]] = 967,
|
||||
[L["Sporeggar"]] = 970,
|
||||
[L["Kurenai"]] = 978,
|
||||
[L["Keepers of Time"]] = 989,
|
||||
[L["The Scale of the Sands"]] = 990,
|
||||
[L["Lower City"]] = 1011,
|
||||
[L["Ashtongue Deathsworn"]] = 1012,
|
||||
[L["Netherwing"]] = 1015,
|
||||
[L["Sha'tari Skyguard"]] = 1031,
|
||||
[L["Alliance Vanguard"]] = 1037,
|
||||
[L["Ogri'la"]] = 1038,
|
||||
[L["Valiance Expedition"]] = 1050,
|
||||
[L["Horde Expedition"]] = 1052,
|
||||
[L["The Taunka"]] = 1064,
|
||||
[L["The Hand of Vengeance"]] = 1067,
|
||||
[L["Explorers' League"]] = 1068,
|
||||
[L["The Kalu'ak"]] = 1073,
|
||||
[L["Shattered Sun Offensive"]] = 1077,
|
||||
[L["Warsong Offensive"]] = 1085,
|
||||
[L["Kirin Tor"]] = 1090,
|
||||
[L["The Wyrmrest Accord"]] = 1091,
|
||||
[L["The Silver Covenant"]] = 1094,
|
||||
[L["Knights of the Ebon Blade"]] = 1098,
|
||||
[L["Frenzyheart Tribe"]] = 1104,
|
||||
[L["The Oracles"]] = 1105,
|
||||
[L["Argent Crusade"]] = 1106,
|
||||
[L["The Sons of Hodir"]] = 1119,
|
||||
[L["The Sunreavers"]] = 1124,
|
||||
[L["The Frostborn"]] = 1126,
|
||||
[L["Bilgewater Cartel"]] = 1133,
|
||||
[L["Gilneas"]] = 1134,
|
||||
[L["The Earthen Ring"]] = 1135,
|
||||
[L["The Ashen Verdict"]] = 1156,
|
||||
[L["Guardians of Hyjal"]] = 1158,
|
||||
[L["Therazane"]] = 1171,
|
||||
[L["Dragonmaw Clan"]] = 1172,
|
||||
[L["Ramkahen"]] = 1173,
|
||||
[L["Wildhammer Clan"]] = 1174,
|
||||
[L["Baradin's Wardens"]] = 1177,
|
||||
[L["Hellscream's Reach"]] = 1178,
|
||||
[L["Winterfin Retreat"]] = 10000,
|
||||
}
|
||||
|
||||
do
|
||||
local classData = {
|
||||
DEATHKNIGHT = {
|
||||
|
||||
Reference in New Issue
Block a user