feat: fire PLAYER_TARGET_CHANGED and PLAYER_LEVEL_UP addon events

Add a generic AddonEventCallback to GameHandler for firing named events
with string arguments directly from game logic. Wire it to the addon
system in Application.

New events fired:
- PLAYER_TARGET_CHANGED — when target is set or cleared
- PLAYER_LEVEL_UP(newLevel) — on level up

The generic callback pattern makes it easy to add more events from
game_handler.cpp without touching Application/AddonManager code.
Total addon events: 16 (2 world + 12 chat + 2 gameplay).
This commit is contained in:
Kelsi 2026-03-20 11:51:46 -07:00
parent c284a971c2
commit 269d9e2d40
3 changed files with 14 additions and 0 deletions

View file

@ -360,6 +360,12 @@ bool Application::initialize() {
addonManager_->fireEvent(eventName, {msg.message, msg.senderName});
}
});
// Wire generic game events to addon dispatch
gameHandler->setAddonEventCallback([this](const std::string& event, const std::vector<std::string>& args) {
if (addonManager_ && addonsLoaded_) {
addonManager_->fireEvent(event, args);
}
});
LOG_INFO("Addon system initialized, found ", addonManager_->getAddons().size(), " addon(s)");
} else {
LOG_WARNING("Failed to initialize addon system");