4n0n update

bastion.lua added command "casts" for cast logging in M+
M+ Utils updated
Unit.lua - added GetOMToken() to replace unit.unit
main
Ofrex 2 years ago
parent fef75da2a6
commit efc4108aff
  1. 210
      src/MythicPlusUtils/MythicPlusUtils.lua
  2. 30
      src/Unit/Unit.lua
  3. 7
      src/_bastion.lua

@ -1,8 +1,13 @@
local Tinkr, Bastion = ...
---@class MythicPlusUtils
local MythicPlusUtils = {
debuffLogging = false,
random = ''
castLogging = false,
random = '',
loggedCasts = {},
loggedDebuffs = {},
kickList = {},
}
MythicPlusUtils.__index = MythicPlusUtils
@ -12,117 +17,71 @@ function MythicPlusUtils:New()
self.random = math.random(1000000, 9999999)
self.kickList = {
-- Algeth'ar Academy
[388392] = true, -- Monotonous Lecture
[396812] = true, -- Mystic Blast
[377389] = true, -- Call of the Flock
[396640] = true, -- Healing Touch
[387843] = true, -- Astral Bomb
[387955] = true, -- Celestial Shield
[387910] = true, -- Astral Whirlwind
-- Azure Vault
-- [375602] = true, -- Erratic Growth
[387564] = true, -- Mystic Vapors
-- [386546] = true, -- Waking Bane
[389804] = true, -- Heavy Tome
[377488] = true, -- Icy Bindings
-- Brackenhide
[382249] = true, -- Earth Bolt
[367500] = true, -- Hideous Cackle
[377950] = true, -- Greater Healing Rapids
[385029] = true, -- Screech
[373804] = true, -- Touch of Decay
[381770] = true, -- Gushing Ooze
[374544] = true, -- Burst of Decay
-- Halls of Infusion
[374066] = true, -- Earth Shield
[374339] = true, -- Demoralizing Shout
[374045] = true, -- Expulse
[374080] = true, -- Blasting Gust
[389443] = true, -- Purifying Blast
[395694] = true, -- Elemental Focus
[374563] = true, -- Dazzle
[385141] = true, -- Thunderstorm
[374706] = true, -- Pyretic Burst
[375384] = true, -- Rumbling Earth
[375950] = true, -- Ice Shards
[377348] = true, -- Tidal Divergence
[377402] = true, -- Aqueous Barrier
[387618] = true, -- Infuse
-- Neltharus
[378282] = true, -- Molten Core
[372615] = true, -- Ember Reach
[395427] = true, -- Burning Roar
[372538] = true, -- Melt
[384161] = true, -- Mote of Combustion
[382795] = true, -- Molten Barrier
-- Nokhud
[384365] = true, -- Disruptive Shout
[386024] = true, -- Tempest
[387411] = true, -- Death Bolt Volley
[387606] = true, -- Dominate
[376725] = true, -- Storm Bolt
[384808] = true, -- Guardian Wind
[383823] = true, -- Rally the Clan (CC to interrupt)
[387135] = true, -- Arcing Strike (CC to interrupt)
[373395] = true, -- Bloodcurdling Shout
-- Ruby Life Pools
[373017] = true, -- Roaring Blaze
[392398] = true, -- Crackling Detonation
[392451] = true, -- Flashfire
[385310] = true, -- Lightning Bolt
[375602] = true, -- Erratic Growth
-- [386546] = true, -- Waking Bane
-- [387564] = true, -- Mystic Vapors
[373932] = true, -- Illusionary Bolt
[386546] = true, -- Waking Bane
-- Uldaman
[369675] = true, -- Chain Lightning
[369674] = true, -- Stone Spike
[369823] = true, -- Spiked Carapace
[369603] = true, -- Defensive Bulwark
[369399] = true, -- Stone Bolt
[369400] = true, -- Earthen Ward
[396812] = true, -- https://www.wowhead.com/spell=396812/mystic-blast
[388392] = true, -- https://www.wowhead.com/spell=388392/monotonous-lecture
[388863] = true, -- https://www.wowhead.com/spell=388863/mana-void
[388862] = true, -- https://www.wowhead.com/spell=388862/surge
[377389] = true, -- https://www.wowhead.com/spell=377389/call-of-the-flock
[388623] = true, -- https://www.wowhead.com/spell=388623/branch-out
[396640] = true, -- https://www.wowhead.com/spell=396640/healing-touch
[387975] = true, -- https://www.wowhead.com/spell=387975/arcane-missiles
[387843] = true, -- https://www.wowhead.com/spell=387843/astral-bomb
-- Court of Stars
[211401] = true, -- Drifting Embers
[211464] = true, -- Fel Detonation
[207980] = true, -- Disintegration Beam
[208165] = true, -- Withering Soul
[207881] = true, -- Infernal Eruption
[211401] = true, -- https://wowhead.com/spell=211401
[207980] = true, -- https://wowhead.com/spell=207980
[208165] = true, -- https://wowhead.com/spell=208165
[207881] = true, -- https://wowhead.com/spell=207881
[209413] = true, -- https://wowhead.com/spell=209413
-- Halls of Valor
[198595] = true, -- Thunderous Bolt
[198959] = true, -- Etch
[192288] = true, -- Searing Light
[199726] = true, -- Unruly Yell
[198750] = true, -- Surge
[198595] = true, -- https://wowhead.com/spell=198595
[198959] = true, -- https://wowhead.com/spell=198959
[215433] = true, -- https://wowhead.com/spell=215433
[192288] = true, -- https://wowhead.com/spell=192288
[199726] = true, -- https://wowhead.com/spell=199726
[198750] = true, -- https://wowhead.com/spell=198750
-- Ruby Life Pools
[372749] = true, -- https://wowhead.com/spell=372749
[373803] = true, -- https://wowhead.com/spell=373803
[373017] = true, -- https://wowhead.com/spell=373017
[392398] = true, -- https://wowhead.com/spell=392398
[392451] = true, -- https://wowhead.com/spell=392451
[385310] = true, -- https://wowhead.com/spell=385310
-- Shadowmoon Burial Grounds
[152818] = true, -- Shadow Mend
[153153] = true, -- Dark Communion (CC to interrupt)
[156776] = true, -- Rending Voidlash
[156722] = true, -- Void Bolt
[398206] = true, -- Death Blast
[156718] = true, -- Necrotic Burst
[153524] = true, -- Plague Spit
[152818] = true, -- https://wowhead.com/spell=152818
[156776] = true, -- https://wowhead.com/spell=156776
[156722] = true, -- https://wowhead.com/spell=156722
[398206] = true, -- https://wowhead.com/spell=398206
[153524] = true, -- https://wowhead.com/spell=153524
[156718] = true, -- https://wowhead.com/spell=156718
-- Temple of the Jade Serpent
[397888] = true, -- Hydrolance
[114646] = true, -- Haunting Gaze
[395859] = true, -- Haunting Scream
[396073] = true, -- Cat Nap
[397914] = true, -- Defiling Mist
[315584] = true
[397888] = true, -- https://wowhead.com/spell=397888
[395859] = true, -- https://wowhead.com/spell=395859
[396073] = true, -- https://wowhead.com/spell=396073
[397914] = true, -- https://wowhead.com/spell=397914
-- The Azure Vault
[375602] = true, -- https://wowhead.com/spell=375602
[387564] = true, -- https://wowhead.com/spell=387564
[373932] = true, -- https://wowhead.com/spell=373932
[386546] = true, -- https://wowhead.com/spell=386546
[389804] = true, -- https://wowhead.com/spell=389804
[377488] = true, -- https://wowhead.com/spell=377488
[377503] = true, -- https://wowhead.com/spell=377503
-- NO
[384365] = true, -- https://wowhead.com/spell=384365
[386012] = true, -- https://wowhead.com/spell=386012
[386024] = true, -- https://wowhead.com/spell=386024
[387411] = true, -- https://wowhead.com/spell=387411
[387606] = true, -- https://wowhead.com/spell=387606
[373395] = true, -- https://wowhead.com/spell=373395
[376725] = true, -- https://wowhead.com/spell=376725
}
Bastion.EventManager:RegisterWoWEvent('UNIT_AURA', function(unit, auras)
@ -136,7 +95,8 @@ function MythicPlusUtils:New()
if #addedAuras > 0 then
for i = 1, #addedAuras do
local aura = Bastion.Aura:CreateFromUnitAuraInfo(addedAuras[i])
if not aura:IsBuff() then
if not self.loggedDebuffs[aura:GetSpell():GetID()] and not aura:IsBuff() then
WriteFile('bastion-MPlusDebuffs-' .. self.random .. '.lua', [[
AuraName: ]] .. aura:GetName() .. [[
AuraID: ]] .. aura:GetSpell():GetID() .. "\n" .. [[
@ -147,6 +107,44 @@ function MythicPlusUtils:New()
end
end)
Bastion.EventManager:RegisterWoWEvent('UNIT_SPELLCAST_START', function(unitTarget, castGUID, spellID)
if not self.castLogging then
return
end
if self.loggedCasts[spellID] then
return
end
local name = GetSpellInfo(spellID)
self.loggedCasts[spellID] = true
WriteFile('bastion-MPlusCasts-' .. self.random .. '.lua', [[
CastName: ]] .. name .. [[
CastID: ]] .. spellID .. "\n" .. [[
]], true)
end)
Bastion.EventManager:RegisterWoWEvent('UNIT_SPELLCAST_CHANNEL_START', function(unitTarget, castGUID, spellID)
if not self.castLogging then
return
end
if self.loggedCasts[spellID] then
return
end
local name = GetSpellInfo(spellID)
self.loggedCasts[spellID] = true
WriteFile('bastion-MPlusCasts-' .. self.random .. '.lua', [[
CastName: ]] .. name .. [[
CastID: ]] .. spellID .. "\n" .. [[
]], true)
end)
return self
end
@ -154,6 +152,10 @@ function MythicPlusUtils:ToggleDebuffLogging()
self.debuffLogging = not self.debuffLogging
end
function MythicPlusUtils:ToggleCastLogging()
self.castLogging = not self.castLogging
end
function MythicPlusUtils:CastingCriticalKick(unit, percent)
local castingSpell = unit:GetCastingOrChannelingSpell()

@ -260,7 +260,7 @@ local isClassicWow = select(4, GetBuildInfo()) < 40000
-- Check if two units are in melee
-- function Unit:InMelee(unit)
-- return UnitInMelee(self:GetOMToken(), unit.unit)
-- return UnitInMelee(self:GetOMToken(), unit:GetOMToken())
-- end
local losFlag = bit.bor(0x1, 0x10, 0x100000)
@ -284,14 +284,22 @@ function Unit:CanSee(unit)
-- end
local ax, ay, az = ObjectPosition(self:GetOMToken())
local ah = ObjectHeight(self:GetOMToken())
local attx, atty, attz = GetUnitAttachmentPosition(unit.unit, 34)
local attx, atty, attz = GetUnitAttachmentPosition(unit:GetOMToken(), 34)
if not attx or not ax then
return false
end
if not ah then
return false
end
if (ax == 0 and ay == 0 and az == 0) or (attx == 0 and atty == 0 and attz == 0) then
return true
end
if not attx or not ax then
return true
return false
end
local x, y, z = TraceLine(ax, ay, az + ah, attx, atty, attz, losFlag)
@ -336,7 +344,7 @@ end
-- Check if the unit can attack the target
function Unit:CanAttack(unit)
return UnitCanAttack(self:GetOMToken(), unit.unit)
return UnitCanAttack(self:GetOMToken(), unit:GetOMToken())
end
function Unit:GetChannelOrCastPercentComplete()
@ -473,7 +481,7 @@ end
-- IsTanking
function Unit:IsTanking(unit)
local isTanking, status, threatpct, rawthreatpct, threatvalue = UnitDetailedThreatSituation(self:GetOMToken(),
unit.unit)
unit:GetOMToken())
return isTanking
end
@ -481,9 +489,9 @@ end
function Unit:IsFacing(unit)
local rot = ObjectRotation(self:GetOMToken())
local x, y, z = ObjectPosition(self:GetOMToken())
local x2, y2, z2 = ObjectPosition(unit.unit)
local x2, y2, z2 = ObjectPosition(unit:GetOMToken())
if not x or not x2 then
if not x or not x2 or not rot then
return false
end
@ -499,8 +507,8 @@ end
-- IsBehind
function Unit:IsBehind(unit)
local rot = ObjectRotation(unit.unit)
local x, y, z = ObjectPosition(unit.unit)
local rot = ObjectRotation(unit:GetOMToken())
local x, y, z = ObjectPosition(unit:GetOMToken())
local x2, y2, z2 = ObjectPosition(self:GetOMToken())
if not x or not x2 then
@ -534,14 +542,14 @@ end
-- InMelee
function Unit:InMelee(unit)
local x, y, z = ObjectPosition(self:GetOMToken())
local x2, y2, z2 = ObjectPosition(unit.unit)
local x2, y2, z2 = ObjectPosition(unit:GetOMToken())
if not x or not x2 then
return false
end
local dist = math.sqrt((x - x2) ^ 2 + (y - y2) ^ 2 + (z - z2) ^ 2)
local maxDist = math.max((ObjectCombatReach(self:GetOMToken()) + 1.3333) + ObjectCombatReach(unit.unit), 5.0)
local maxDist = math.max((ObjectCombatReach(self:GetOMToken()) + 1.3333) + ObjectCombatReach(unit:GetOMToken()), 5.0)
maxDist = maxDist + 1.0 + self:GetMeleeBoost()
return dist <= maxDist

@ -192,9 +192,16 @@ Command:Register('mplus', 'Toggle m+ module on/off', function(args)
return
end
if cmd == 'casts' then
Bastion.MythicPlusUtils:ToggleCastLogging()
Bastion:Print("Cast logging", Bastion.MythicPlusUtils.castLogging and "enabled" or "disabled")
return
end
Bastion:Print("[MythicPlusUtils] Unknown command")
Bastion:Print("Available commands:")
Bastion:Print("debuffs")
Bastion:Print("casts")
end)
--Toggle Main Menu

Loading…
Cancel
Save