feat: fire PLAYER_ENTERING_WORLD and critical login events for addons

PLAYER_ENTERING_WORLD is the single most important WoW addon event —
virtually every addon registers for it to initialize UI, state, and
data structures. It was never fired, causing widespread addon init
failures on login and after teleports.

Now fired from:
- handleLoginVerifyWorld (initial login + same-map teleports)
- handleNewWorld (cross-map teleports, instance transitions)

Also fires:
- PLAYER_LOGIN on initial world entry only
- ZONE_CHANGED_NEW_AREA on all world entries
- UPDATE_WORLD_STATES on initial entry
- SPELLS_CHANGED + LEARNED_SPELL_IN_TAB after SMSG_INITIAL_SPELLS
  (so spell book addons can initialize on login)
This commit is contained in:
Kelsi 2026-03-22 15:50:05 -07:00
parent 5086520354
commit 73ce601bb5

View file

@ -9744,6 +9744,19 @@ void GameHandler::handleLoginVerifyWorld(network::Packet& packet) {
LOG_INFO("Auto-requested played time on login"); LOG_INFO("Auto-requested played time on login");
} }
} }
// Fire PLAYER_ENTERING_WORLD — THE most important event for addon initialization.
// Fires on initial login, teleports, instance transitions, and zone changes.
if (addonEventCallback_) {
addonEventCallback_("PLAYER_ENTERING_WORLD", {initialWorldEntry ? "1" : "0"});
// Also fire ZONE_CHANGED_NEW_AREA and UPDATE_WORLD_STATES so map/BG addons refresh
addonEventCallback_("ZONE_CHANGED_NEW_AREA", {});
addonEventCallback_("UPDATE_WORLD_STATES", {});
// PLAYER_LOGIN fires only on initial login (not teleports)
if (initialWorldEntry) {
addonEventCallback_("PLAYER_LOGIN", {});
}
}
} }
void GameHandler::handleClientCacheVersion(network::Packet& packet) { void GameHandler::handleClientCacheVersion(network::Packet& packet) {
@ -19318,6 +19331,12 @@ void GameHandler::handleInitialSpells(network::Packet& packet) {
loadSkillLineAbilityDbc(); loadSkillLineAbilityDbc();
LOG_INFO("Learned ", knownSpells.size(), " spells"); LOG_INFO("Learned ", knownSpells.size(), " spells");
// Notify addons that the full spell list is now available
if (addonEventCallback_) {
addonEventCallback_("SPELLS_CHANGED", {});
addonEventCallback_("LEARNED_SPELL_IN_TAB", {});
}
} }
void GameHandler::handleCastFailed(network::Packet& packet) { void GameHandler::handleCastFailed(network::Packet& packet) {
@ -23635,6 +23654,12 @@ void GameHandler::handleNewWorld(network::Packet& packet) {
if (worldEntryCallback_) { if (worldEntryCallback_) {
worldEntryCallback_(mapId, serverX, serverY, serverZ, isSameMap); worldEntryCallback_(mapId, serverX, serverY, serverZ, isSameMap);
} }
// Fire PLAYER_ENTERING_WORLD for teleports / zone transitions
if (addonEventCallback_) {
addonEventCallback_("PLAYER_ENTERING_WORLD", {"0"});
addonEventCallback_("ZONE_CHANGED_NEW_AREA", {});
}
} }
// ============================================================ // ============================================================