Mercurial > wow > turok
changeset 3:9de4a810fda7
ENCOUNTER_START syntax
author | Nenue |
---|---|
date | Tue, 15 Dec 2015 10:09:11 -0500 |
parents | 62f9b057c91b |
children | 8ace773d6bfc |
files | Lost.lua |
diffstat | 1 files changed, 66 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/Lost.lua Tue Dec 15 08:24:51 2015 -0500 +++ b/Lost.lua Tue Dec 15 10:09:11 2015 -0500 @@ -11,27 +11,50 @@ local d = T.direction_coord local a = T.anchor_direction +mod.encounter_start = { + ['Aspect'] = { + type = 'buff', + + Test = function() + local res = UnitBuff('player', 'Aspect of the Pack', nil, 'PLAYER') + return (res ~= nil) + end, + sound = LSM:Fetch('sound', 'Wilhelm Scream'), + }, + ['Rune'] = { + Test = function() + local res = UnitBuff('player', 'Hyper Augmentation', nil, 'PLAYER') + return (res ~= nil) + end + } +} + function mod:OnEnable() self.raidbuffs_active = {} -- active raid buffs self.raidbuffs_text = {} -- raid buff text self.raidbuffs_avail = {} -- availability info self.raidbuffs_display = {} -- buff list ordering info self.unit_cache = {} -- remember GUIDs we've seen before + self.raidbuffs_shown = NUM_LE_RAID_BUFF_TYPES + local db = _G.TurokData db.raidbuff = { parent = 'UIParent', anchor = 'BOTTOMRIGHT', anchorTo = 'BOTTOMRIGHT', posX = -300, posY = 300, - height = 50, width = 150, - icon_size = 25, + height = 24*9, width = 72, + raidbuff_width = 72, + raidbuff_height = 24, label_size = 11, label_font = 'ArchivoNarrow-Bold', } + + local rw = CreateFrame('Frame', 'TkRaidWatch', UIParent) local c = db.raidbuff - self.raid_watcher = rw + self.raidbuffs_frame = rw rw:SetPoint(c.anchor, c.parent, c.anchorTo, c.posX, c.posY) rw:SetSize(c.width, c.height) rw:SetMovable(true) @@ -42,9 +65,11 @@ bd:SetPoint('TOPLEFT',rw,'TOPLEFT', -2, 2) bd:SetPoint('BOTTOMRIGHT',rw,'BOTTOMRIGHT', 2, -2) + -- seed raid buff analyzer assets + self.num_raidbuff_columns = math.floor(c.width / c.raidbuff_width) for i = 1, 9 do local icon = rw:CreateTexture('TkRaidWatchButton'..i, 'ARTWORK') - icon:SetSize(c.icon_size,c.icon_size) + icon:SetSize(c.raidbuff_width,c.raidbuff_height) icon:SetTexCoord(0.15, 0.85, 0.15, 0.85) @@ -60,7 +85,6 @@ self.raidbuffs_text[i] = text end - db.raidevent = {} @@ -93,18 +117,35 @@ end function mod:PARTY_MEMBERS_CHANGED(e, ...) + if IsInRaid() or IsInGroup() then + self.raidbuffs_frame:Show() + self:RaidBuffScan() + end end + function mod:ENCOUNTER_START(e,...) + for k, v in pairs(self.encounter_start) do + local test, info = v.Test() + if test == true then + print(v.type, k, 'doing a thing') + else + print(v.type, k, info) + end + end end -- Updates available raid/party buffs function mod:RaidBuffScan(unit) + if self.hiding then + return + end + local c = T.db.raidbuff -- search for unit data + -- update raidbuffs - local changed = false - local c = T.db.raidbuff - -- update raidbuffs + -- set our number of things to track + local k = 1 for i = 1, NUM_LE_RAID_BUFF_TYPES do local rb = self.raidbuffs_active[i] @@ -128,11 +169,11 @@ if not self.raidbuffs_display[i] or self.raidbuffs_display[i] ~= k then self.raidbuffs_display[i] = k - local axis_a, axis_b = c.icon_size, c.width - local w = axis_a * (k-1) % axis_b - local h = math.floor((k-1) / (axis_b / axis_a)) * axis_a - print(axis_a, axis_b, w, h) - rb:SetPoint('BOTTOMLEFT', TkRaidWatch, 'BOTTOMLEFT', w, h) + local pn = k-1 -- need (n-1) for lua grid math + local py = math.floor(pn / self.num_raidbuff_columns) * c.raidbuff_height + local px = (pn * c.raidbuff_width) % c.width -- x-offset + print('buff slot '..i..' (draw slot '..k..')', pn, py, px) + rb:SetPoint('BOTTOMLEFT', TkRaidWatch, 'BOTTOMLEFT', px, py) end k = k + 1 @@ -150,6 +191,7 @@ for i = 1, lim do local name, rank, subgroup, level, class, fileName, zone, online, isDead, role, isML = GetRaidRosterInfo(i) + local realm if name then if string.find(name,'-') then name, realm = string.match(name, "(.+)-(.+)") @@ -157,6 +199,17 @@ realm = GetRealmName() end + local GUID = UnitGUID('raid' .. i) + if not self.unit_cache[GUID] then + self.unit_cache[GUID] = { + name = name, + realm = realm, + } + end + + pl = self.unit_cache[GUID] + + print(i, name, class, role) end