Skip to content

Commit 70937af

Browse files
committed
Bron Level Up
1 parent 0a2ef03 commit 70937af

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

BronCena.lua

+12-6
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ local defaults = {
138138

139139
-- Default companions
140140
companions = {
141+
["1"] = CompanionDefaults(false, "1", "Level Up", "", soundOptions.broncena, "DING! Bron Cena says grats on level %s!", nil, "PLAYER_LEVEL_UP"),
141142
["333961"] = CompanionDefaults(false, "333961", "Bron Cena", "", soundOptions.broncena, "And his name is BRON CENA!"),
142143
["324739"] = CompanionDefaults(true, "324739", "Kyrian Steward", "", soundOptions.metalgear, "A wild %s appears!", 0.8),
143144
["368241"] = CompanionPlayerDefaults(true, "368241", "Wo Speed Buff", "", soundOptions.yaketysax, nil, nil, "SPELL_AURA_APPLIED"),
@@ -603,17 +604,20 @@ end
603604

604605
function BronCena:OnEnable()
605606
BronCena:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
607+
BronCena:RegisterEvent("PLAYER_LEVEL_UP")
606608
if self.parsingTooltip == nil then
607609
self.parsingTooltip = CreateFrame("GameTooltip", APPNAME.."Tooltip", WorldFrame, "GameTooltipTemplate")
608610
end
609611
end
610612

611613
function BronCena:OnDisable()
612614
self:Debug("OnDisable")
615+
BronCena:UnregisterEvent("PLAYER_LEVEL_UP")
613616
BronCena:UnregisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
614617
end
615618

616619
local getOwner = function(sourceFlags)
620+
if sourceFlags == nill then return nill end
617621
if bit.band(sourceFlags, COMBATLOG_OBJECT_REACTION_HOSTILE) == COMBATLOG_OBJECT_REACTION_HOSTILE then return "hostile" end
618622
if bit.band(sourceFlags, COMBATLOG_OBJECT_AFFILIATION_PARTY) == COMBATLOG_OBJECT_AFFILIATION_PARTY then return "party" end
619623
if bit.band(sourceFlags, COMBATLOG_OBJECT_AFFILIATION_RAID) == COMBATLOG_OBJECT_AFFILIATION_RAID then return "raid" end
@@ -622,20 +626,22 @@ local getOwner = function(sourceFlags)
622626
return nil
623627
end
624628

625-
function BronCena:COMBAT_LOG_EVENT_UNFILTERED(...)
629+
function BronCena:PLAYER_LEVEL_UP(subevent, newLevel)
630+
self:TriggerBron(1, subevent, tostring(newLevel), nil)
631+
end
626632

633+
function BronCena:COMBAT_LOG_EVENT_UNFILTERED(...)
627634
local timestamp, subevent, _, sourceGUID, sourceName, sourceFlags, sourceRaidFlags, destGUID, destName, destFlags, destRaidFlags, spellId, spellName = CombatLogGetCurrentEventInfo()
635+
self:TriggerBron(spellId, subevent, destName, sourceFlags)
636+
end
637+
638+
function BronCena:TriggerBron(spellId, subevent, destName, sourceFlags)
628639

629640
if self.db.profile.disabled == true then
630641
--self:Debug("Add-on is disabled")
631642
return
632643
end
633644

634-
-- Debug: We can log out summoned units to help figure out spell ids to support new summons.
635-
if subevent == "SPELL_SUMMON" then
636-
--self:Printf("%s summoned %s using %s (%d)", tostring(sourceName), tostring(destName), tostring(spellName), tostring(spellId))
637-
end
638-
639645
-- See if this spellId is supported
640646
local companion = self.db.profile.companions[tostring(spellId)]
641647

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## 1.6.7
4+
5+
* Bron Cena congratulates you when you level up. Thanks for the suggestion Rach.
6+
37
## 1.6.6
48

59
* Dragonflight launch

0 commit comments

Comments
 (0)