pull/13/head
4n0n 1 year ago
parent 677229738d
commit 1cc8b541f8
  1. 4
      scripts/ExampleModule.lua
  2. 4
      src/_bastion.lua

@ -7,6 +7,10 @@ local SpellBook = Bastion.SpellBook:New()
local FlashHeal = SpellBook:GetSpell(2061) local FlashHeal = SpellBook:GetSpell(2061)
-- Get a global spell (this can collide with other modules, so be careful)
-- This is useful for caching common spells that you might not actually cast, and to avoid needless spell creation inline
local FlashHeal = Bastion.Globals.SpellBook:GetSpell(2061)
local AdvancedMath = Bastion:Import('AdvancedMath') local AdvancedMath = Bastion:Import('AdvancedMath')
print(AdvancedMath:Add(1, 2)) print(AdvancedMath:Add(1, 2))

@ -86,7 +86,7 @@ end)
Bastion.Globals.EventManager:RegisterWoWEvent("UNIT_SPELLCAST_SUCCEEDED", function(...) Bastion.Globals.EventManager:RegisterWoWEvent("UNIT_SPELLCAST_SUCCEEDED", function(...)
local unit, castGUID, spellID = ... local unit, castGUID, spellID = ...
local spell = Bastion.SpellBook:GetIfRegistered(spellID) local spell = Bastion.Globals.SpellBook:GetIfRegistered(spellID)
if unit == "player" and spell then if unit == "player" and spell then
spell.lastCastAt = GetTime() spell.lastCastAt = GetTime()
@ -233,7 +233,7 @@ Command:Register('dumpspells', 'Dump spells to a file', function()
if spellID then if spellID then
spellName = spellName:gsub("[%W%s]", "") spellName = spellName:gsub("[%W%s]", "")
WriteFile('bastion-' .. UnitClass('player') .. '-' .. rand .. '.lua', WriteFile('bastion-' .. UnitClass('player') .. '-' .. rand .. '.lua',
"local " .. spellName .. " = Bastion.SpellBook:GetSpell(" .. spellID .. ")", true) "local " .. spellName .. " = Bastion.Globals.SpellBook:GetSpell(" .. spellID .. ")", true)
end end
i = i + 1 i = i + 1
end end

Loading…
Cancel
Save