mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-22 23:30:14 +00:00
feat: add zone change and login sequence events for Lua addons
Fire ZONE_CHANGED_NEW_AREA and ZONE_CHANGED when worldStateZoneId changes in SMSG_INIT_WORLD_STATES. Add VARIABLES_LOADED and PLAYER_LOGIN events in the addon loading sequence (before PLAYER_ENTERING_WORLD), and fire PLAYER_ENTERING_WORLD on subsequent world entries (teleport, instance). Enables zone-aware addons like DBM and quest trackers.
This commit is contained in:
parent
5eaf738b66
commit
66f779c186
2 changed files with 17 additions and 1 deletions
|
|
@ -5134,6 +5134,11 @@ void Application::loadOnlineWorldTerrain(uint32_t mapId, float x, float y, float
|
|||
if (addonManager_ && !addonsLoaded_) {
|
||||
addonManager_->loadAllAddons();
|
||||
addonsLoaded_ = true;
|
||||
addonManager_->fireEvent("VARIABLES_LOADED");
|
||||
addonManager_->fireEvent("PLAYER_LOGIN");
|
||||
addonManager_->fireEvent("PLAYER_ENTERING_WORLD");
|
||||
} else if (addonManager_ && addonsLoaded_) {
|
||||
// Subsequent world entries (e.g. teleport, instance entry)
|
||||
addonManager_->fireEvent("PLAYER_ENTERING_WORLD");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4050,7 +4050,18 @@ void GameHandler::handlePacket(network::Packet& packet) {
|
|||
break;
|
||||
}
|
||||
worldStateMapId_ = packet.readUInt32();
|
||||
worldStateZoneId_ = packet.readUInt32();
|
||||
{
|
||||
uint32_t newZoneId = packet.readUInt32();
|
||||
if (newZoneId != worldStateZoneId_ && newZoneId != 0) {
|
||||
worldStateZoneId_ = newZoneId;
|
||||
if (addonEventCallback_) {
|
||||
addonEventCallback_("ZONE_CHANGED_NEW_AREA", {});
|
||||
addonEventCallback_("ZONE_CHANGED", {});
|
||||
}
|
||||
} else {
|
||||
worldStateZoneId_ = newZoneId;
|
||||
}
|
||||
}
|
||||
// WotLK adds areaId (uint32) before count; Classic/TBC/Turtle use the shorter format
|
||||
size_t remaining = packet.getSize() - packet.getReadPos();
|
||||
bool isWotLKFormat = isActiveExpansion("wotlk");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue