Clean up TTD and Change Loading.

main
ck 11 months ago
parent 904d20f09c
commit 3f0bc7cb4c
  1. 8
      src/APL/APL.lua
  2. 8
      src/APLActor/APLActor.lua
  3. 8
      src/APLTrait/APLTrait.lua
  4. 9
      src/Aura/Aura.lua
  5. 8
      src/AuraTable/AuraTable.lua
  6. 7
      src/Cache/Cache.lua
  7. 8
      src/Cacheable/Cacheable.lua
  8. 8
      src/Class/Class.lua
  9. 7
      src/ClassMagic/ClassMagic.lua
  10. 7
      src/Command/Command.lua
  11. 8
      src/Config/Config.lua
  12. 10
      src/EventManager/EventManager.lua
  13. 15
      src/Item/Item.lua
  14. 9
      src/ItemBook/ItemBook.lua
  15. 8
      src/Library/Library.lua
  16. 7
      src/List/List.lua
  17. 14
      src/Module/Module.lua
  18. 8
      src/MythicPlusUtils/MythicPlusUtils.lua
  19. 8
      src/Notification/Notification.lua
  20. 9
      src/NotificationList/NotificationList.lua
  21. 28
      src/ObjectManager/ObjectManager.lua
  22. 8
      src/Refreshable/Refreshable.lua
  23. 7
      src/Sequencer/Sequencer.lua
  24. 8
      src/Spell/Spell.lua
  25. 9
      src/SpellBook/SpellBook.lua
  26. 18
      src/TimeToDie/TimeToDie.lua
  27. 8
      src/Timer/Timer.lua
  28. 18
      src/Unit/Unit.lua
  29. 8
      src/UnitManager/UnitManager.lua
  30. 28
      src/Util/Util.lua
  31. 8
      src/Vector3/Vector3.lua
  32. 143
      src/_bastion.lua

@ -1,5 +1,7 @@
---@type Tinkr, Bastion
local Tinkr, Bastion = ...
---@type Tinkr
local Tinkr,
---@class Bastion
Bastion = ...
-- APL (Attack priority list) class
---@class Bastion.APL
@ -220,4 +222,4 @@ function APL:__tostring()
return "Bastion.__APL(" .. self.name .. ")"
end
return APL
Bastion.APL = APL

@ -1,5 +1,7 @@
---@type Tinkr, Bastion
local Tinkr, Bastion = ...
---@type Tinkr
local Tinkr,
---@class Bastion
Bastion = ...
---@class Bastion.APLActor.Table.Base
---@field type "spell" | "item" | "apl" | "sequencer" | "variable" | "action"
@ -131,4 +133,4 @@ function APLActor:__tostring()
return string.format("Bastion.__APLActor(%s)", self.name)
end
return APLActor
Bastion.APLActor = APLActor

@ -1,5 +1,7 @@
---@type Tinkr, Bastion
local Tinkr, Bastion = ...
---@type Tinkr
local Tinkr,
---@class Bastion
Bastion = ...
-- Create an APL trait for the APL class
---@class Bastion.APLTrait
@ -39,4 +41,4 @@ function APLTrait:__tostring()
return "Bastion.__APLTrait"
end
return APLTrait
Bastion.APLTrait = APLTrait

@ -1,6 +1,7 @@
-- Document with emmy lua: https://emmylua.github.io/
---@type Tinkr, Bastion
local Tinkr, Bastion = ...
---@type Tinkr
local Tinkr,
---@class Bastion
Bastion = ...
---@class Bastion.Aura.Aura.Data
---@field auraInstanceID? number
@ -399,4 +400,4 @@ function Aura:IsDispelableBySpell(spell)
return false
end
return Aura
Bastion.Aura = Aura

@ -1,5 +1,7 @@
---@type Tinkr, Bastion
local Tinkr, Bastion = ...
---@type Tinkr
local Tinkr,
---@class Bastion
Bastion = ...
---@alias auraInstanceId integer
@ -815,4 +817,4 @@ function AuraTable:HasAnyFoodOrDrinkAura()
return false
end
return AuraTable
Bastion.AuraTable = AuraTable

@ -1,3 +1,8 @@
---@type Tinkr
local Tinkr,
---@class Bastion
Bastion = ...
---@class Bastion.Cache
local Cache = {}
Cache.__index = Cache
@ -52,4 +57,4 @@ function Cache:IsCached(key)
return false
end
return Cache
Bastion.Cache = Cache

@ -1,5 +1,7 @@
---@type Tinkr, Bastion
local Tinkr, Bastion = ...
---@type Tinkr
local Tinkr,
---@class Bastion
Bastion = ...
---@class Bastion.Cacheable
@ -84,4 +86,4 @@ function Cacheable:SetCallback(cb, ...)
self.args = SafePack(...)
end
return Cacheable
Bastion.Cacheable = Cacheable

@ -1,5 +1,7 @@
---@type Tinkr, Bastion
local Tinkr, Bastion = ...
---@type Tinkr
local Tinkr,
---@class Bastion
Bastion = ...
-- Create a new Class class
---@class Bastion.Class
@ -64,4 +66,4 @@ function Class:GetColor()
return C_ClassColor.GetClassColor(self.class.name)
end
return Class
Bastion.Class = Class

@ -1,3 +1,8 @@
---@type Tinkr
local Tinkr,
---@class Bastion
Bastion = ...
---@class Bastion.ClassMagic
local ClassMagic = {}
ClassMagic.__index = ClassMagic
@ -49,4 +54,4 @@ function ClassMagic:Resolve(Class, key)
return Class[key]
end
return ClassMagic
Bastion.ClassMagic = ClassMagic

@ -1,3 +1,8 @@
---@type Tinkr
local Tinkr,
---@class Bastion
Bastion = ...
-- Create a wow command handler class
---@class Bastion.Command
---@field command string
@ -76,4 +81,4 @@ function Command:PrintHelp()
end
end
return Command
Bastion.Command = Command

@ -1,5 +1,7 @@
---@type Tinkr, Bastion
local Tinkr, Bastion = ...
---@type Tinkr
local Tinkr,
---@class Bastion
Bastion = ...
---@class Bastion.Config
---@field instantiated boolean
@ -79,4 +81,4 @@ function Config:Sync(key)
self.config:Sync(key)
end
return Config
Bastion.Config = Config

@ -1,5 +1,7 @@
---@type Tinkr, Bastion
local Tinkr, Bastion = ...
---@type Tinkr
local Tinkr,
---@class Bastion
Bastion = ...
-- Create an EventManager class
---@class Bastion.EventManager
@ -136,4 +138,6 @@ function EventManager:CLEUHandler(timestamp, subevent, ...)
end
end
return EventManager
Bastion.Globals.EventManager = EventManager:New()
Bastion.EventManager = EventManager

@ -1,5 +1,7 @@
---@type Tinkr, Bastion
local Tinkr, Bastion = ...
---@type Tinkr
local Tinkr,
---@class Bastion
Bastion = ...
---@class Bastion.Item.Traits.Use
---@field moving? boolean
@ -242,6 +244,9 @@ end
---@param condition? string | fun(self:Bastion.Item):boolean
---@return boolean
function Item:Use(unit, condition)
if not self:Usable() then
return false
end
if condition then
if type(condition) == "string" and not self:EvaluateCondition(condition) then
return false
@ -250,10 +255,6 @@ function Item:Use(unit, condition)
end
end
if not self:Usable() then
return false
end
-- Call pre Use function
if self:GetPreUseFunction() then
self:GetPreUseFunction()(self)
@ -582,4 +583,4 @@ function Item:GetSpell()
return nil
end
return Item
Bastion.Item = Item

@ -1,5 +1,7 @@
---@type Tinkr, Bastion
local Tinkr, Bastion = ...
---@type Tinkr
local Tinkr,
---@class Bastion
Bastion = ...
---@alias itemId integer
@ -35,4 +37,5 @@ function ItemBook:GetItem(id)
return self.items[id]
end
return ItemBook
Bastion.Globals.ItemBook = ItemBook:New()
Bastion.ItemBook = ItemBook

@ -1,5 +1,7 @@
---@type Tinkr, Bastion
local Tinkr, Bastion = ...
---@type Tinkr
local Tinkr,
---@class Bastion
Bastion = ...
---@class Bastion.Library
---@field name string | nil
@ -117,4 +119,4 @@ function Library:Import(library)
return lib:Resolve()
end
return Library
Bastion.Library = Library

@ -1,3 +1,8 @@
---@type Tinkr
local Tinkr,
---@class Bastion
Bastion = ...
---@class Bastion.List<I>: { _list: I[] }
---@operator add(any): Bastion.List
---@operator sub(any): Bastion.List
@ -216,4 +221,4 @@ function List:__tostring()
return self:toString()
end
return List
Bastion.List = List

@ -1,5 +1,7 @@
---@type Tinkr, Bastion
local Tinkr, Bastion = ...
---@type Tinkr
local Tinkr,
---@class Bastion
Bastion = ...
-- Create a module class for a bastion module
@ -37,11 +39,13 @@ end
-- Enable the module
function Module:Enable()
self.enabled = true
return self
end
-- Disable the module
function Module:Disable()
self.enabled = false
return self
end
-- Toggle the module
@ -52,12 +56,14 @@ function Module:Toggle()
else
self:Enable()
end
return self
end
-- Add a function to the sync list
---@param func function
function Module:Sync(func)
table.insert(self.synced, func)
return self
end
-- Remove a function from the sync list
@ -69,6 +75,7 @@ function Module:Unsync(func)
break
end
end
return self
end
-- Sync
@ -81,6 +88,7 @@ function Module:Tick()
end
end
end
return self
end
return Module
Bastion.Module = Module

@ -1,5 +1,7 @@
---@type Tinkr, Bastion
local Tinkr, Bastion = ...
---@type Tinkr
local Tinkr,
---@class Bastion
Bastion = ...
---@class Bastion.MythicPlusUtils.KickEntry
---@field isKick boolean
@ -1334,4 +1336,4 @@ function MythicPlusUtils:IsAOEBoss(unit)
return self.aoeBosses[unit:GetID()]
end
return MythicPlusUtils
Bastion.MythicPlusUtils = MythicPlusUtils:New()

@ -1,5 +1,7 @@
---@type Tinkr, Bastion
local Tinkr, Bastion = ...
---@type Tinkr
local Tinkr,
---@class Bastion
Bastion = ...
-- Create a notification class for the notifications list (takes icon and text)
---@class Bastion.Notification
@ -66,4 +68,4 @@ function Notification:Remove()
end)
end
return Notification
Bastion.Notification = Notification

@ -1,5 +1,7 @@
---@type Tinkr, Bastion
local Tinkr, Bastion = ...
---@type Tinkr
local Tinkr,
---@class Bastion
Bastion = ...
-- Create a NotificationList class
@ -88,5 +90,4 @@ function NotificationList:RemoveAllNotifications()
end
end
-- Remove all notifications
return NotificationList
Bastion.NotificationList = NotificationList

@ -1,5 +1,7 @@
---@type Tinkr, Bastion
local Tinkr, Bastion = ...
---@type Tinkr
local Tinkr,
---@class Bastion
Bastion = ...
---@class Bastion.ObjectManager
---@field _lists table<string, { list: Bastion.List, cb: fun(object: TinkrObjectReference): false | Bastion.Unit }>
@ -126,24 +128,4 @@ function ObjectManager:Refresh()
end
end
return ObjectManager
-- -- Register a list of objects that are training dummies
-- local dummies = Bastion.ObjectManager:RegisterList('dummies', function(object)
-- if ObjectType(object) == 5 or ObjectType(object) == 6 then
-- local unit = Bastion.UnitManager:GetObject(ObjectGUID(object))
-- if not unit then
-- unit = Bastion.Unit:New(object)
-- Bastion.UnitManager:SetObject(unit)
-- end
-- if unit:GetID() == 198594 then
-- return unit
-- end
-- end
-- end)
-- dummies:each(function(dummy)
-- print(dummy:GetName())
-- end)
Bastion.ObjectManager = ObjectManager:New()

@ -1,5 +1,7 @@
---@type Tinkr, Bastion
local Tinkr, Bastion = ...
---@type Tinkr
local Tinkr,
---@class Bastion
Bastion = ...
-- Define a Refreshable class
---@class Bastion.Refreshable
@ -73,4 +75,4 @@ function Refreshable:SetCallback(cb)
self.callback = cb
end
return Refreshable
Bastion.Refreshable = Refreshable

@ -1,3 +1,8 @@
---@type Tinkr
local Tinkr,
---@class Bastion
Bastion = ...
-- Create a sequencer class that takes a table of actions and executes them in order
---@class Bastion.Sequencer
---@field resetCondition? fun(): boolean
@ -87,4 +92,4 @@ function Sequencer:__tostring()
return "Bastion.__Sequencer"
end
return Sequencer
Bastion.Sequencer = Sequencer

@ -1,5 +1,7 @@
---@type Tinkr, Bastion
local Tinkr, Bastion = ...
---@type Tinkr
local Tinkr,
---@class Bastion
Bastion = ...
---@class Bastion.Spell.Traits.Cast
---@field moving boolean
@ -800,4 +802,4 @@ function Spell:UpdateAura(spell, source, target)
self.auras[spell:GetID()].lastApplied = GetTime()
end
return Spell
Bastion.Spell = Spell

@ -1,5 +1,7 @@
---@type Tinkr, Bastion
local Tinkr, Bastion = ...
---@type Tinkr
local Tinkr,
---@class Bastion
Bastion = ...
-- Create a new SpellBook class
---@class Bastion.SpellBook
@ -99,4 +101,5 @@ function SpellBook:GetIfRegistered(id)
return false
end
return SpellBook
Bastion.Globals.SpellBook = SpellBook:New()
Bastion.SpellBook = SpellBook

@ -1,7 +1,8 @@
---@type Tinkr, Bastion
local Tinkr, Bastion = ...
---@type Tinkr
local Tinkr,
---@class Bastion
Bastion = ...
local Player = Bastion.UnitManager:Get("player")
local Target = Bastion.UnitManager:Get("target")
if not Bastion.Globals.UnitInfo then
@ -22,8 +23,6 @@ local TimeToDie = {
},
---@type table<number, { time: number, percentage: number }>
Cache = {}, -- A cache of unused { time, value } tables to reduce garbage due to table creation
--@type table<string, {[1]: {[1]: {[1]: number, [2]: number}, [2]: number}, [2]: number }>
--Units = {}, -- Used to track units,
---@type table<string, { history: table<number, { time: number, percentage: number }>, time: number }>
Units = {},
---@type table<string, boolean>
@ -56,7 +55,7 @@ function TimeToDie:Refresh()
local historyCount = TimeToDie.Settings.HistoryCount
local historyTime = TimeToDie.Settings.HistoryTime
local ttdCache = TimeToDie.Cache
local iterableUnits = Bastion.ObjectManager.enemies
local iterableUnits = TimeToDie:IterableUnits()
local units = TimeToDie.Units
local existingUnits = TimeToDie.ExistingUnits
@ -75,7 +74,8 @@ function TimeToDie:Refresh()
--local unitTable = units[unitGUID]
local unitTable = units[unitGUID]
-- Check if we have seen one time this unit, if we don't then initialize it.
if not unitTable or healthPercentage > unitTable.history[1].percentage then
-- Also check to see if the unit's health percentage is higher than the last one we saw. If so, we recreate the table.
if not unitTable or #unitTable.history > 0 and healthPercentage > unitTable.history[1].percentage then
unitTable = {
history = {
{ time = currentTime, percentage = healthPercentage }
@ -298,7 +298,7 @@ function TimeToDie.FilteredFightRemains(enemies, operator, value, checkIfValid,
return false
end
return Bastion.Utils.CompareThis(operator, fightRemains, value) or false
return Bastion.Util:CompareThis(operator, fightRemains, value) or false
end
-- Returns if the current boss fight length meets the requirements, 11111 if not a boss fight.
@ -309,4 +309,4 @@ function TimeToDie.BossFilteredFightRemains(operator, value, checkIfValid)
return TimeToDie.FilteredFightRemains(nil, operator, value, checkIfValid, true)
end
return TimeToDie
Bastion.TimeToDie = TimeToDie

@ -1,5 +1,7 @@
---@type Tinkr, Bastion
local Tinkr, Bastion = ...
---@type Tinkr
local Tinkr,
---@class Bastion
Bastion = ...
-- Create a new Timer class
---@class Bastion.Timer
@ -47,4 +49,4 @@ function Timer:Reset()
self.startTime = nil
end
return Timer
Bastion.Timer = Timer

@ -1,5 +1,7 @@
---@type Tinkr, Bastion
local Tinkr, Bastion = ...
---@type Tinkr
local Tinkr,
---@class Bastion
Bastion = ...
-- Create a new Unit class
---@class Bastion.Unit
@ -25,7 +27,7 @@ function Unit:UpdateHealth()
table.remove(self.health, 1)
end
table.insert(self.health, {
time = Bastion.Now,
time = GetTime(),
percent = self:GetHP(),
health = self:GetHealth(),
maxHealth =
@ -907,7 +909,7 @@ function Unit:PredictHealth(time)
table.remove(self.regression_history, 1)
end
table.insert(self.regression_history, { time = Bastion.Now, percent = self:GetHP() })
table.insert(self.regression_history, { time = GetTime(), percent = self:GetHP() })
for i = 1, #self.regression_history do
local entry = self.regression_history[i]
@ -916,7 +918,7 @@ function Unit:PredictHealth(time)
end
local slope, intercept = self:LinearRegression(x, y)
return slope * (Bastion.Now + time) + intercept
return slope * (GetTime() + time) + intercept
end
-- Use linear regression to guess the time until a given health percent
@ -930,7 +932,7 @@ function Unit:PredictTime(percent)
table.remove(self.regression_history, 1)
end
table.insert(self.regression_history, { time = Bastion.Now, percent = self:GetHP() })
table.insert(self.regression_history, { time = GetTime(), percent = self:GetHP() })
for i = 1, #self.regression_history do
local entry = self.regression_history[i]
@ -1580,7 +1582,7 @@ end
function Unit:FilteredTimeToDie(operator, value, offset, valueThreshold, minSamples)
local TTD = self:TimeToDie2(minSamples)
return TTD > -1 and TTD < valueThreshold and Bastion.Utils.CompareThis(operator, TTD + (offset or 0), value) or false
return TTD > -1 and TTD < valueThreshold and Bastion.Util:CompareThis(operator, TTD + (offset or 0), value) or false
end
-- Get if the boss unit meets the TimeToDie requirements.
@ -1616,4 +1618,4 @@ function Unit:BossTimeToDieIsNotValid(minSamples)
return true
end
return Unit
Bastion.Unit = Unit

@ -1,5 +1,7 @@
---@type Tinkr, Bastion
local Tinkr, Bastion = ...
---@type Tinkr
local Tinkr,
---@class Bastion
Bastion = ...
local Unit = Bastion.Unit
@ -362,4 +364,4 @@ function UnitManager:FindEnemiesCentroid(radius, range)
return centroid
end
return UnitManager
Bastion.UnitManager = UnitManager:New()

@ -0,0 +1,28 @@
---@type Tinkr
local Tinkr,
---@class Bastion
Bastion = ...
---@class Bastion.Util
local Util = {}
---@enum (key) CompareThisTable
local compareThisTable = {
[">"] = function(A, B) return A > B end,
["<"] = function(A, B) return A < B end,
[">="] = function(A, B) return A >= B end,
["<="] = function(A, B) return A <= B end,
["=="] = function(A, B) return A == B end,
["min"] = function(A, B) return A < B end,
["max"] = function(A, B) return A > B end,
}
---@generic A
---@param operator CompareThisTable
---@param a A
---@param b A
function Util:CompareThis(operator, a, b)
end
Bastion.Util = Util

@ -1,5 +1,9 @@
-- Create a Vector3 class
---@type Tinkr
local Tinkr,
---@class Bastion
Bastion = ...
-- Create a Vector3 class
---@class Bastion.Vector3
---@field length number
---@field normalized Bastion.Vector3
@ -363,4 +367,4 @@ function Vector3:NormalizeOrientation(o)
return math.fmod(o, 2.0 * math.pi)
end
return Vector3
Bastion.Vector3 = Vector3

@ -4,6 +4,7 @@ local Tinkr = ...
---@class Bastion
local Bastion = {
DebugMode = false,
Globals = {},
}
local TinkrScriptsBase = "scripts"
@ -59,7 +60,7 @@ end
--- 0 = Failed, 1 = Success, 2 = Already Loaded
---@param filePath string | { filePath: string, reloadable: boolean }
---@param ... any
---@return 0|1|2, ...
---@return 0|1|2, table
function Bastion:Require(filePath, ...)
local loadedFile = {
originalPath = type(filePath) == "table" and filePath.filePath or tostring(filePath),
@ -70,19 +71,12 @@ function Bastion:Require(filePath, ...)
}
local filePathModifier = loadedFile.originalPath:sub(1, 1)
if filePathModifier == "@" then
-- If require starts with an @ then we require from the scripts/bastion/scripts folder
loadedFile.newPath = string.format("%s%s", BastionScriptsBase, loadedFile.originalPath:sub(2))
loadedFile.loadedPath = loadedFile.newPath
elseif filePathModifier == "~" then
-- If file path starts with a ~ then we require from the scripts/bastion folder
loadedFile.newPath = string.format("%s%s", BastionBase, loadedFile.originalPath:sub(2))
local base = filePathModifier == "@" and BastionScriptsBase or filePathModifier == "~" and BastionBase
if base then
loadedFile.newPath = string.format("%s%s", base, loadedFile.originalPath:sub(2))
loadedFile.loadedPath = loadedFile.newPath
end
loadedFile.loadedPath = loadedFile.newPath
local found = false
-- Check if file path has a .lua or .luac extension. If not, try to add one and check if the file exists
loadedFile.loadedPath, found = CheckFileExtensions(loadedFile.newPath, { "lua", "luac" })
@ -152,57 +146,46 @@ local function LoadThird()
end
end
---@generic V : string
---@param class `V`
---@return V ...
function Bastion.require(class)
---@cast class string
local newClass = class:gsub("Bastion%.", "")
-- return require("scripts/bastion/src/" .. class .. "/" .. class, Bastion)
local success, result = Bastion:Require("~/src/" .. newClass .. "/" .. newClass)
if success == 0 then
Log("Bastion.require - Failed to load " .. class .. ": " .. result)
end
return SafeUnpack(result)
local bastionFiles = {
"~/src/ClassMagic/ClassMagic",
"~/src/List/List",
"~/src/Util/Util",
"~/src/Library/Library",
"~/src/Notification/Notification",
"~/src/NotificationList/NotificationList",
"~/src/Vector3/Vector3",
"~/src/Sequencer/Sequencer",
"~/src/Command/Command",
"~/src/Cache/Cache",
"~/src/Cacheable/Cacheable",
"~/src/Refreshable/Refreshable",
"~/src/Unit/Unit",
"~/src/Aura/Aura",
"~/src/APLTrait/APLTrait",
"~/src/APLActor/APLActor",
"~/src/APL/APL",
"~/src/Module/Module",
"~/src/UnitManager/UnitManager",
"~/src/ObjectManager/ObjectManager",
"~/src/EventManager/EventManager",
"~/src/Spell/Spell",
"~/src/SpellBook/SpellBook",
"~/src/Item/Item",
"~/src/ItemBook/ItemBook",
"~/src/AuraTable/AuraTable",
"~/src/Class/Class",
"~/src/Timer/Timer",
"~/src/MythicPlusUtils/MythicPlusUtils",
"~/src/Config/Config",
"~/src/TimeToDie/TimeToDie",
}
for i = 1, #bastionFiles do
Bastion:Require(bastionFiles[i])
end
Bastion.Globals = {}
Bastion.ClassMagic = Bastion.require("Bastion.ClassMagic")
Bastion.List = Bastion.require("Bastion.List")
Bastion.Library = Bastion.require("Bastion.Library")
Bastion.Notification = Bastion.require("Bastion.Notification")
Bastion.NotificationList = Bastion.require("Bastion.NotificationList")
Bastion.Vector3 = Bastion.require("Bastion.Vector3")
Bastion.Sequencer = Bastion.require("Bastion.Sequencer")
Bastion.Command = Bastion.require("Bastion.Command")
Bastion.Cache = Bastion.require("Bastion.Cache")
Bastion.Cacheable = Bastion.require("Bastion.Cacheable")
Bastion.Refreshable = Bastion.require("Bastion.Refreshable")
Bastion.Unit = Bastion.require("Bastion.Unit")
Bastion.Aura = Bastion.require("Bastion.Aura")
Bastion.APLTrait = Bastion.require("Bastion.APLTrait")
Bastion.APLActor = Bastion.require("Bastion.APLActor")
Bastion.APL = Bastion.require("Bastion.APL")
Bastion.Module = Bastion.require("Bastion.Module")
Bastion.UnitManager = Bastion.require("Bastion.UnitManager"):New()
Bastion.ObjectManager = Bastion.require("Bastion.ObjectManager"):New()
Bastion.EventManager = Bastion.require("Bastion.EventManager")
Bastion.Globals.EventManager = Bastion.EventManager:New()
Bastion.Spell = Bastion.require("Bastion.Spell")
Bastion.SpellBook = Bastion.require("Bastion.SpellBook")
Bastion.Globals.SpellBook = Bastion.SpellBook:New()
Bastion.Item = Bastion.require("Bastion.Item")
Bastion.ItemBook = Bastion.require("Bastion.ItemBook")
Bastion.Globals.ItemBook = Bastion.ItemBook:New()
Bastion.AuraTable = Bastion.require("Bastion.AuraTable")
Bastion.Class = Bastion.require("Bastion.Class")
Bastion.Timer = Bastion.require("Bastion.Timer")
Bastion.CombatTimer = Bastion.Timer:New("combat")
Bastion.MythicPlusUtils = Bastion.require("Bastion.MythicPlusUtils"):New()
Bastion.Notifications = Bastion.NotificationList:New()
Bastion.Config = Bastion.require("Bastion.Config")
Bastion.TimeToDie = Bastion.require("Bastion.TimeToDie")
Bastion.Globals.CombatTimer = Bastion.Timer:New("combat")
Bastion.Globals.Notifications = Bastion.NotificationList:New()
---@param unitTarget UnitId
Bastion.Globals.EventManager:RegisterWoWEvent("UNIT_HEALTH", function(unitTarget)
@ -210,27 +193,6 @@ Bastion.Globals.EventManager:RegisterWoWEvent("UNIT_HEALTH", function(unitTarget
end)
---@enum (key) CompareThisTable
local compareThisTable = {
[">"] = function(A, B) return A > B end,
["<"] = function(A, B) return A < B end,
[">="] = function(A, B) return A >= B end,
["<="] = function(A, B) return A <= B end,
["=="] = function(A, B) return A == B end,
["min"] = function(A, B) return A < B end,
["max"] = function(A, B) return A > B end,
}
Bastion.Utils = {
---@generic A
---@param operator CompareThisTable
---@param a A
---@param b A
CompareThis = function(operator, a, b)
return compareThisTable[operator](a, b)
end
}
---@type table<string, Bastion.Library>
local LIBRARIES = {}
@ -290,17 +252,6 @@ Bastion.Globals.EventManager:RegisterWoWEvent("COMBAT_LOG_EVENT_UNFILTERED", fun
end
end
-- if sourceGUID == pguid then
-- local args = { CombatLogGetCurrentEventInfo() }
-- for i = 1, #args do
-- Log(tostring(args[i]))
-- end
-- end
--Bastion.UnitManager:SetCombatTime(sourceGUID)
--Bastion.UnitManager:SetCombatTime(destGUID)
local u = Bastion.UnitManager[sourceGUID]
local u2 = Bastion.UnitManager[destGUID]
@ -339,10 +290,10 @@ Bastion.Ticker = C_Timer.NewTicker(0.1, function()
Bastion.Now = GetTime()
Bastion.Tick = GetGameTick()
if not Bastion.CombatTimer:IsRunning() and UnitAffectingCombat("player") then
Bastion.CombatTimer:Start()
elseif Bastion.CombatTimer:IsRunning() and not UnitAffectingCombat("player") then
Bastion.CombatTimer:Reset()
if not Bastion.Globals.CombatTimer:IsRunning() and UnitAffectingCombat("player") then
Bastion.Globals.CombatTimer:Start()
elseif Bastion.Globals.CombatTimer:IsRunning() and not UnitAffectingCombat("player") then
Bastion.Globals.CombatTimer:Reset()
end
if Bastion.Enabled then

Loading…
Cancel
Save