mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-25 00:20:16 +00:00
Add quest opcodes, fix gossip select packet, and NPC combat animations
Fix CMSG_GOSSIP_SELECT_OPTION missing menuId field (was causing ByteBufferException). Add 12 quest opcodes and clickable quest items in gossip dialog. NPC attack/death animation callbacks now work for both single-player and server-spawned creatures, and SMSG_ATTACKERSTATEUPDATE triggers NPC swing animations.
This commit is contained in:
parent
b5336d784a
commit
60be428250
7 changed files with 84 additions and 8 deletions
|
|
@ -1125,18 +1125,27 @@ void Application::spawnNpcs() {
|
|||
gameHandler->setPosition(canonical.x, canonical.y, canonical.z);
|
||||
}
|
||||
|
||||
// Set NPC death callback for single-player combat
|
||||
if (singlePlayerMode && gameHandler && npcManager) {
|
||||
// Set NPC animation callbacks (works for both single-player and online creatures)
|
||||
if (gameHandler && npcManager) {
|
||||
auto* npcMgr = npcManager.get();
|
||||
auto* cr = renderer->getCharacterRenderer();
|
||||
gameHandler->setNpcDeathCallback([npcMgr, cr](uint64_t guid) {
|
||||
auto* app = this;
|
||||
gameHandler->setNpcDeathCallback([npcMgr, cr, app](uint64_t guid) {
|
||||
uint32_t instanceId = npcMgr->findRenderInstanceId(guid);
|
||||
if (instanceId == 0) {
|
||||
auto it = app->creatureInstances_.find(guid);
|
||||
if (it != app->creatureInstances_.end()) instanceId = it->second;
|
||||
}
|
||||
if (instanceId != 0 && cr) {
|
||||
cr->playAnimation(instanceId, 1, false); // animation ID 1 = Death
|
||||
}
|
||||
});
|
||||
gameHandler->setNpcSwingCallback([npcMgr, cr](uint64_t guid) {
|
||||
gameHandler->setNpcSwingCallback([npcMgr, cr, app](uint64_t guid) {
|
||||
uint32_t instanceId = npcMgr->findRenderInstanceId(guid);
|
||||
if (instanceId == 0) {
|
||||
auto it = app->creatureInstances_.find(guid);
|
||||
if (it != app->creatureInstances_.end()) instanceId = it->second;
|
||||
}
|
||||
if (instanceId != 0 && cr) {
|
||||
cr->playAnimation(instanceId, 16, false); // animation ID 16 = Attack1
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue