Files
wow-weakauras/Complete Projects/Legion/DavyStone2.lua
2024-08-24 22:43:07 +02:00

412 lines
14 KiB
Lua

--ON SOME EVENTS
--Maybe make trigger on ~~party kill?~~ threat update? ++ namepalteadd/remove
--[[
1) On threat update calculate new %
2) On namepalte added look for threat and calculate new %
3) Organize into table with GUIDs
4) On nameplate remove remove from table // PARTY_KILL
5) Make more table for current pull, projected pull and projected total
6) Organize mobs into groups before bosses or before other groups big ???
]]
--[[
1) UNIT_THREAT_LIST_UPDATE (e, u)
Get GUID
Put into table
ggez
2) NAME_PLATE_UNIT_ADDED NAME_PLATE_UNIT_REMOVED (e, u)
UnitDetailedThreatSituation("player", "target") empty result for no threat
[02:49 PM] Dump: value=UnitDetailedThreatSituation("player", "target")
[02:49 PM] [1]=true, --Boolean - returns true if the unit is primary threat target of the mob (is tanking), or false otherwise
[02:49 PM] [2]=3, --Integer - returns the threat status for the unit on the mob, or nil if unit is not on mob's threat table. (3 = securely tanking, 2 = insecurely tanking, 1 = not tanking but higher threat than tank, 0 = not tanking and lower threat than tank)
[02:49 PM] [3]=100, --Number - returns the unit's threat on the mob as a percentage of the amount required to pull aggro, scaled according to the unit's range from the mob. At 100 the unit will pull aggro. Returns 100 if the unit is tanking and nil if the unit is not on the mob's threat list.
[02:49 PM] [4]=255, --Number - returns the unit's threat as a percentage of the tank's current threat. Returns nil if the unit is not on the mob's threat list.
[02:49 PM] [5]=0 --Number - returns the unit's total threat on the mob
for threat
3) can say table 1: GUID in current pull - use 1) and 2)
table 2: GUID to be pull on mouseover - use previous work
table 3: global GUID to be pull - reset with GUID of boss or pre boss maybe?
look for PARTY_KILL se in CLEU maybe? (for progress table ?)
]]
--[[
Random garbage info
[10:59 AM] Dump: value=C_Scenario.GetInfo()
[10:59 AM] [1]="Black Rook Hold",
[10:59 AM] [2]=1,
[10:59 AM] [3]=1,
[10:59 AM] [4]=3,
[10:59 AM] [5]=false,
[10:59 AM] [6]=false,
[10:59 AM] [7]=false,
[10:59 AM] [8]=0,
[10:59 AM] [9]=0,
[10:59 AM] [10]=1,
[10:59 AM] [11]="UNKNOWN"
[11:01 AM] Dump: value=C_Scenario.GetStepInfo()
[11:01 AM] [1]="Black Rook Hold",
[11:01 AM] [2]="Deal with the restless spirits of Black Rook Hold.",
[11:01 AM] [3]=5, --Num criteria
[11:01 AM] [4]=false,
[11:01 AM] [5]=false,
[11:01 AM] [6]=false,
[11:01 AM] [7]=0,
[11:01 AM] [8]={
[11:01 AM] },
[11:01 AM] [10]=0
/run local numCriteria = select(3, C_Scenario.GetStepInfo()); for i = 1, numCriteria do print(C_Scenario.GetCriteriaInfo(i)) end
[11:02 AM] Amalgam of Souls 165 false 0 1 0 1832 0 29464 0 0 false false
[11:02 AM] Illysanna Ravencrest 165 false 0 1 0 1833 0 29465 0 0 false false
[11:02 AM] Smashspite the Hateful 165 false 0 1 0 1834 0 29466 0 0 false false
[11:02 AM] Lord Kurtalos Ravencrest 165 false 0 1 0 1835 0 29467 0 0 false false
[11:02 AM] Enemy Forces 0 false 0 360 0 0 0% 0 0 0 false true
[11:06 AM] Dump: value=C_Scenario.GetCriteriaInfo(5)
[11:06 AM] [1]="Enemy Forces",
[11:06 AM] [2]=0,
[11:06 AM] [3]=false,
[11:06 AM] [4]=0,
[11:06 AM] [5]=360,
[11:06 AM] [6]=0,
[11:06 AM] [7]=0,
[11:06 AM] [8]="0%",
[11:06 AM] [9]=0,
[11:06 AM] [10]=0,
[11:06 AM] [11]=0,
[11:06 AM] [12]=false,
[11:06 AM] [13]=true --Weighted progress?
]]
--[[
So far got the mouseover counting working
Get total mob # from C_Scenario.GetCriteriaInfo(5
Add mouseover to #
Add pulls & nameplate fuckery from above into same #
Maybe use global table for all
Should be easy
Maybe add textures and attach to namepaltes of planned units??? Pog POG
]]
function()
--Very inefficient maybe fix later who cares
local scenarioType = select(10, C_Scenario.GetInfo())
if scenarioType == 1 then
local numCriteria = select(3, C_Scenario.GetStepInfo())
for i = 1, numCriteria do
local name = C_Scenario.GetCriteriaInfo(i)
if name == "Enemy Forces" then
aura_env.davystone.totalProgress = select(5, C_Scenario.GetCriteriaInfo(i))
aura_env.davystone.currentProgress = select(8, C_Scenario.GetCriteriaInfo(i))
aura_env.davystone.currentProgress = aura_env.davystone.currentProgress:gsub("%%", "")
aura_env.davystone.currentProgress = tonumber(aura_env.davystone.currentProgress)
aura_env.davystone.newProgress = select(8, C_Scenario.GetCriteriaInfo(i))
aura_env.davystone.newProgress = aura_env.davystone.newProgress:gsub("%%", "")
aura_env.davystone.newProgress = tonumber(aura_env.davystone.newProgress)
end
end
for i = 1, 40 do
local unit = "nameplate" .. i
if UnitAffectingCombat(unit) then
local GUID = UnitGUID(unit)
local ID = GUID:match("%w+%-%d*%-%d*%-%d*%-%d*-(%d*)")
ID = tonumber(ID)
if aura_env.IDthing[ID] then
local progress = aura_env.IDthing[ID]
aura_env.davystone.newProgress = aura_env.davystone.newProgress + progress
end
end
end
end
end
--DISPLAY
function()
if aura_env.davystone.currentProgress and aura_env.davystone.totalProgress and aura_env.davystone.newProgress then
return aura_env.round((aura_env.davystone.currentProgress / aura_env.davystone.totalProgress) * 100, 2) .. " " .. aura_env.round((aura_env.davystone.newProgress / aura_env.davystone.totalProgress) * 100, 2)
end
end
--INIT
local OnTooltipSetUnit = function()
print("yeet")
local name, unit = tooltip:GetUnit()
local guid = unit and UnitGUID(unit)
if guid then
local type, zero, server_id, instance_id, zone_uid, npc_id, spawn_uid = strsplit("-", guid)
npc_id = tonumber(npc_id)
print(npcID)
end
end
GameTooltip:HookScript("OnTooltipSetUnit", OnTooltipSetUnit)
aura_env.davystone = {}
aura_env.IDthing = {
[104277] = 4, [102253] = 4, [98954] = 4, [97185] = 10, [113537] = 10, [101839] = 4, [104246] = 4, [104278] = 10, [97170] = 4, [113506] = 4, [105617] = 4, [105633] = 4, [102095] = 4, [105952] = 6, [97043] = 4, [102430] = 1, [98366] = 4, [95832] = 2, [91784] = 1, [104295] = 1, [102781] = 4, [102287] = 10, [98733] = 4, [102351] = 1, [96247] = 1, [111563] = 4, [95769] = 4, [113699] = 8, [91785] = 2, [100216] = 4, [97172] = 1, [100248] = 4, [114289] = 4, [105651] = 4, [105699] = 3, [105715] = 4, [98368] = 4, [95834] = 2, [99675] = 4, [91786] = 4, [98177] = 12, [97173] = 4, [100249] = 1, [105636] = 4, [95771] = 4, [96584] = 4, [97365] = 4, [91006] = 4, [91787] = 2, [109908] = 10, [96664] = 2, [105876] = 1, [95947] = 4, [99804] = 2, [95772] = 4, [99358] = 4, [101414] = 2, [106785] = 1, [104251] = 4, [100713] = 4, [105845] = 1, [98243] = 4, [98275] = 4, [96028] = 4, [99359] = 3, [105766] = 1, [91008] = 4, [91789] = 4, [98435] = 7, [98706] = 6, [100539] = 4, [98770] = 4, [105703] = 1, [102404] = 4, [99360] = 9, [97097] = 4, [91790] = 4, [98691] = 4, [102277] = 4, [98293] = 1, [98813] = 4, [105720] = 4, [91001] = 4, [101074] = 1, [100532] = 1, [99678] = 4, [104270] = 8, [101991] = 4, [98732] = 1, [98963] = 1, [91792] = 10, [100526] = 4, [98246] = 4, [106546] = 4, [98533] = 10, [105705] = 4, [96015] = 4, [104300] = 4, [113536] = 10, [92610] = 4, [99649] = 12, [98900] = 4, [98406] = 4, [98677] = 1, [91808] = 1, [92350] = 4, [102295] = 10, [102566] = 12, [113998] = 4, [97163] = 3, [102104] = 4, [102375] = 3, [105706] = 8, [95861] = 4, [97068] = 5, [96574] = 5, [97171] = 10, [102094] = 4, [102232] = 4, [99188] = 4, [99307] = 12, [105682] = 8, [92538] = 1, [100527] = 3, [102583] = 4, [96587] = 4, [98280] = 4, [98370] = 4, [98538] = 10, [106786] = 1, [113111] = 1, [91783] = 4, [99956] = 4, [114712] = 3, [91332] = 4, [91794] = 1, [96657] = 12, [98426] = 4, [97197] = 2, [91796] = 10, [98759] = 4, [105915] = 4, [98919] = 4, [99908] = 1, [98362] = 10, [95779] = 10, [99365] = 4, [99891] = 5, [101437] = 1, [90998] = 4, [106059] = 4, [98425] = 4, [96640] = 2, [97182] = 6, [98728] = 7, [95939] = 10, [100529] = 1, [98776] = 4, [105422] = 1, [98792] = 4, [90997] = 4, [105629] = 1, [99366] = 4, [97087] = 2, [101438] = 4, [97119] = 1, [96608] = 2, [98681] = 6, [97677] = 1, [96480] = 1, [102584] = 4, [95842] = 2, [100364] = 4, [101072] = 1, [94968] = 5, [98973] = 1, [102788] = 4, [96934] = 2, [98756] = 4, [107288] = 1, [91793] = 1, [91000] = 8, [91781] = 4, [91782] = 10, [97678] = 8, [98926] = 4, [97200] = 4, [100531] = 8, [92387] = 4, [99033] = 4, [95920] = 2, [98810] = 6, [95766] = 4, [105921] = 4, [96677] = 2, [101679] = 4, [114288] = 4, [96611] = 2, [106787] = 1
}
aura_env.round = function(var, n)
if (n) then
var = math.floor((var * 10 ^ n) + 0.5) / (10 ^ n)
else
var = math.floor(var + 0.5)
end
return var
end
--PART OF DIFFERENT AURA
--UPDATE_MOUSEOVER_UNIT
function(e)
if not aura_env.time then
aura_env.time = debugprofilestop()
end
if not aura_env.mobs then
aura_env.mobs = {}
end
if not aura_env.mobC then
aura_env.mobC = 0
end
local u = "mouseover"
local guid = UnitGUID(u)
local npc_id = guid:match("%w+%-%d*%-%d*%-%d*%-%d*-(%d*)")
npc_id = tonumber(npc_id)
aura_env.time = debugprofilestop()
--print("aura", guid, aura_env.mobs[guid])
if npc_id and aura_env.IDthing[npc_id] then
if guid and not aura_env.mouseoverPull[guid] then
aura_env.mouseoverPull[guid] = aura_env.IDthing[npc_id]
aura_env.mobC = aura_env.mobC + 1
end
end
--This works for now
end
--EVERY FRAME
function()
if aura_env.time and aura_env.time > 0 then
--print(aura_env.mobC)
--DevTools_Dump(aura_env.mobs)
local totalMouseoverPull = 0
for k, v in pairs(aura_env.mouseoverPull) do
totalMouseoverPull = totalMouseoverPull + v
print(totalMouseoverPull)
end
if debugprofilestop() - aura_env.time > 1500 then
aura_env.time = 0
aura_env.mouseoverPull = {}
aura_env.mobC = 0
print("RESET", aura_env.mobC)
DevTools_Dump(aura_env.mobs)
end
end
end
--INIT
aura_env.davystone = {}
aura_env.currentPull = {}
aura_env.mouseoverPull = {}
aura_env.IDthing = {
[104277] = 4,
[102253] = 4,
[98954] = 4,
[97185] = 10,
[113537] = 10,
[101839] = 4,
[104246] = 4,
[104278] = 10,
[97170] = 4,
[113506] = 4,
[105617] = 4,
[105633] = 4,
[102095] = 4,
[105952] = 6,
[97043] = 4,
[102430] = 1,
[98366] = 4,
[95832] = 2,
[91784] = 1,
[104295] = 1,
[102781] = 4,
[102287] = 10,
[98733] = 4,
[102351] = 1,
[96247] = 1,
[111563] = 4,
[95769] = 4,
[113699] = 8,
[91785] = 2,
[100216] = 4,
[97172] = 1,
[100248] = 4,
[114289] = 4,
[105651] = 4,
[105699] = 3,
[105715] = 4,
[98368] = 4,
[95834] = 2,
[99675] = 4,
[91786] = 4,
[98177] = 12,
[97173] = 4,
[100249] = 1,
[105636] = 4,
[95771] = 4,
[96584] = 4,
[97365] = 4,
[91006] = 4,
[91787] = 2,
[109908] = 10,
[96664] = 2,
[105876] = 1,
[95947] = 4,
[99804] = 2,
[95772] = 4,
[99358] = 4,
[101414] = 2,
[106785] = 1,
[104251] = 4,
[100713] = 4,
[105845] = 1,
[98243] = 4,
[98275] = 4,
[96028] = 4,
[99359] = 3,
[105766] = 1,
[91008] = 4,
[91789] = 4,
[98435] = 7,
[98706] = 6,
[100539] = 4,
[98770] = 4,
[105703] = 1,
[102404] = 4,
[99360] = 9,
[97097] = 4,
[91790] = 4,
[98691] = 4,
[102277] = 4,
[98293] = 1,
[98813] = 4,
[105720] = 4,
[91001] = 4,
[101074] = 1,
[100532] = 1,
[99678] = 4,
[104270] = 8,
[101991] = 4,
[98732] = 1,
[98963] = 1,
[91792] = 10,
[100526] = 4,
[98246] = 4,
[106546] = 4,
[98533] = 10,
[105705] = 4,
[96015] = 4,
[104300] = 4,
[113536] = 10,
[92610] = 4,
[99649] = 12,
[98900] = 4,
[98406] = 4,
[98677] = 1,
[91808] = 1,
[92350] = 4,
[102295] = 10,
[102566] = 12,
[113998] = 4,
[97163] = 3,
[102104] = 4,
[102375] = 3,
[105706] = 8,
[95861] = 4,
[97068] = 5,
[96574] = 5,
[97171] = 10,
[102094] = 4,
[102232] = 4,
[99188] = 4,
[99307] = 12,
[105682] = 8,
[92538] = 1,
[100527] = 3,
[102583] = 4,
[96587] = 4,
[98280] = 4,
[98370] = 4,
[98538] = 10,
[106786] = 1,
[113111] = 1,
[91783] = 4,
[99956] = 4,
[114712] = 3,
[91332] = 4,
[91794] = 1,
[96657] = 12,
[98426] = 4,
[97197] = 2,
[91796] = 10,
[98759] = 4,
[105915] = 4,
[98919] = 4,
[99908] = 1,
[98362] = 10,
[95779] = 10,
[99365] = 4,
[99891] = 5,
[101437] = 1,
[90998] = 4,
[106059] = 4,
[98425] = 4,
[96640] = 2,
[97182] = 6,
[98728] = 7,
[95939] = 10,
[100529] = 1,
[98776] = 4,
[105422] = 1,
[98792] = 4,
[90997] = 4,
[105629] = 1,
[99366] = 4,
[97087] = 2,
[101438] = 4,
[97119] = 1,
[96608] = 2,
[98681] = 6,
[97677] = 1,
[96480] = 1,
[102584] = 4,
[95842] = 2,
[100364] = 4,
[101072] = 1,
[94968] = 5,
[98973] = 1,
[102788] = 4,
[96934] = 2,
[98756] = 4,
[107288] = 1,
[91793] = 1,
[91000] = 8,
[91781] = 4,
[91782] = 10,
[97678] = 8,
[98926] = 4,
[97200] = 4,
[100531] = 8,
[92387] = 4,
[99033] = 4,
[95920] = 2,
[98810] = 6,
[95766] = 4,
[105921] = 4,
[96677] = 2,
[101679] = 4,
[114288] = 4,
[96611] = 2,
[106787] = 1
}