mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-23 07:40:14 +00:00
Fix NPC spawning at initial player position
NPCs were not spawning when the player first entered the world because spawnNpcs() was defined but never called. Added call to spawnNpcs() in Application::update() when in IN_GAME state. The function has a guard (npcsSpawned flag) so it only runs once. NPCs now appear immediately at spawn instead of requiring the player to walk away first. Added logging to help debug spawn preconditions.
This commit is contained in:
parent
96c1def041
commit
5e0d62c2a4
3 changed files with 51 additions and 4 deletions
|
|
@ -4627,6 +4627,17 @@ void GameHandler::handleTrainerList(network::Packet& packet) {
|
|||
trainerWindowOpen_ = true;
|
||||
gossipWindowOpen = false;
|
||||
|
||||
// Debug: log known spells
|
||||
LOG_INFO("Known spells count: ", knownSpells.size());
|
||||
if (knownSpells.size() <= 20) {
|
||||
std::string spellList;
|
||||
for (uint32_t id : knownSpells) {
|
||||
if (!spellList.empty()) spellList += ", ";
|
||||
spellList += std::to_string(id);
|
||||
}
|
||||
LOG_INFO("Known spells: ", spellList);
|
||||
}
|
||||
|
||||
// Ensure caches are populated
|
||||
loadSpellNameCache();
|
||||
loadSkillLineDbc();
|
||||
|
|
@ -4635,12 +4646,19 @@ void GameHandler::handleTrainerList(network::Packet& packet) {
|
|||
}
|
||||
|
||||
void GameHandler::trainSpell(uint32_t spellId) {
|
||||
if (state != WorldState::IN_WORLD || !socket) return;
|
||||
LOG_INFO("trainSpell called: spellId=", spellId, " state=", (int)state, " socket=", (socket ? "yes" : "no"));
|
||||
if (state != WorldState::IN_WORLD || !socket) {
|
||||
LOG_WARNING("trainSpell: Not in world or no socket connection");
|
||||
return;
|
||||
}
|
||||
LOG_INFO("Sending CMSG_TRAINER_BUY_SPELL: guid=", currentTrainerList_.trainerGuid,
|
||||
" trainerId=", currentTrainerList_.trainerType, " spellId=", spellId);
|
||||
auto packet = TrainerBuySpellPacket::build(
|
||||
currentTrainerList_.trainerGuid,
|
||||
currentTrainerList_.trainerType,
|
||||
spellId);
|
||||
socket->send(packet);
|
||||
LOG_INFO("CMSG_TRAINER_BUY_SPELL sent");
|
||||
}
|
||||
|
||||
void GameHandler::closeTrainer() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue