Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- RiftAddon.toc:
- Identifier = "TestAddon"
- Name = "Test Addon"
- Description = "testing addon system"
- Author = "Kreiri"
- Email = "kreiri@ukr.net"
- Version = "0.1"
- Environment = "1.3"
- RunOnStartup = {
- "Libs/LibUnitChange/main.lua",
- "helpers.lua",
- "main.lua",
- }
- -- helpers.lua:
- if not tdump then tdump = function (t, s)
- local s = s or 0
- for i, v in pairs(t) do
- local kstring = string.rep(" ", s)
- if (type(i) == "number") then
- --kstring = kstring.."["..tostring(i).."] = "
- else
- kstring = kstring..tostring(i).." = "
- end
- if (type(v) == "table") then
- print(kstring.."{")
- tdump(v, s+1)
- print (string.rep(" ", s).."}")
- elseif (type(v) == "string") then
- print(kstring..'"'..v..'"')
- else
- print(kstring..tostring(v))
- end
- end
- end -- function tdump
- end
- -- main.lua:
- local watchedunits = {["player"] = true,
- ["player.target"] = true,
- ["player.pet"] = true,
- ["focus"] = true}
- local function OnUnitChange(units)
- print("---OnUnitChange---")
- print("Inspect.System.Time() = "..Inspect.System.Time())
- for unit, v in pairs(units) do
- if (watchedunits[unit] and v) then
- print("-----------------------")
- print(unit)
- local bufflist = Inspect.Buff.List(unit)
- if (bufflist) then
- local bufftable = Inspect.Buff.Detail(unit, bufflist)
- tdump(bufftable)
- end
- end
- end
- end
- for unit, _ in pairs(watchedunits) do
- Library.UnitChange("TestAddon", {unit}, OnUnitChange)
- end
- local function OnBuffAdd(unit, buffs)
- if watchedunits[Inspect.Unit.Lookup(unit)] then
- print("---OnBuffAdd---")
- print("Inspect.System.Time() = "..Inspect.System.Time())
- local bufftable = Inspect.Buff.Detail(unit, buffs)
- print("-----------------------")
- print(Inspect.Unit.Lookup(unit))
- tdump(bufftable)
- end
- end
- table.insert(Event.Buff.Add, {OnBuffAdd, "TestAddon", "OnBuffAdd"})
- -- results:
- 13:15:22: ---OnBuffAdd---
- 13:15:22: Inspect.System.Time() = 11613.955402158
- 13:15:22: -----------------------
- 13:15:22: player
- 13:15:22: b8000000022044713 = {
- 13:15:22: expired = 11630.55078125
- 13:15:22: remaining = 0
- 13:15:22: duration = 29.9453125
- 13:15:22: caster = "u0258800010FA3050"
- 13:15:22: icon = "Data/\UI\ability_icons\motif_of_tenacity.dds"
- 13:15:22: name = "Motif of Tenacity"
- 13:15:22: ability = "a000000004DB42B95"
- 13:15:22: }
- 13:15:25: ---OnUnitChange---
- 13:15:25: Inspect.System.Time() = 11617.164070553
- 13:15:25: -----------------------
- 13:15:25: player.target
- 13:15:25: b8000000022044713 = {
- 13:15:25: remaining = 26.7333984375
- 13:15:25: duration = 29.9453125
- 13:15:25: caster = "u0258800010FA3050"
- 13:15:25: icon = "Data/\UI\ability_icons\motif_of_tenacity.dds"
- 13:15:25: name = "Motif of Tenacity"
- 13:15:25: ability = "a000000004DB42B95"
- 13:15:25: }
- 13:15:25: b80000000220446D8 = {
- 13:15:25: expired = 112.908203125
- 13:15:25: remaining = 0
- 13:15:25: duration = 0
- 13:15:25: caster = "u0258800010FA3050"
- 13:15:25: icon = "Data/\UI\ability_icons\rudeawake1.dds"
- 13:15:25: name = "Rested"
- 13:15:25: noncancelable = true
- 13:15:25: }
- 13:15:25: b800000002204470E = {
- 13:15:25: caster = "u0258800010FA3050"
- 13:15:25: icon = "Data/\UI\ability_icons\surge_b.dds"
- 13:15:25: name = "Track Air Creatures"
- 13:15:25: ability = "a00000000289E1032"
- 13:15:25: }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement