diff options
Diffstat (limited to 'src/net/eathena/beingrecv.cpp')
-rw-r--r-- | src/net/eathena/beingrecv.cpp | 70 |
1 files changed, 34 insertions, 36 deletions
diff --git a/src/net/eathena/beingrecv.cpp b/src/net/eathena/beingrecv.cpp index da175c2e8..2dbefbee5 100644 --- a/src/net/eathena/beingrecv.cpp +++ b/src/net/eathena/beingrecv.cpp @@ -1,11 +1,11 @@ /* - * The ManaPlus Client + * The ManaVerse Client * Copyright (C) 2004-2009 The Mana World Development Team * Copyright (C) 2009-2010 The Mana Developers * Copyright (C) 2011-2020 The ManaPlus Developers - * Copyright (C) 2020-2023 The ManaVerse Developers + * Copyright (C) 2020-2025 The ManaVerse Developers * - * This file is part of The ManaPlus Client. + * This file is part of The ManaVerse Client. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -28,6 +28,7 @@ #include "game.h" #include "notifymanager.h" #include "party.h" +#include "soundmanager.h" #include "being/mercenaryinfo.h" @@ -68,6 +69,7 @@ #include "utils/checkutils.h" #include "utils/foreach.h" +#include "utils/performance.h" #include "utils/timer.h" #include "debug.h" @@ -222,16 +224,17 @@ void BeingRecv::processBeingChangeLookCards(Net::MessageIn &msg) Being *dstBeing = nullptr; int cards[maxCards]; + const BeingId beingId = msg.readBeingId("being id"); + if (actorManager == nullptr) { // here can be look from char server Net::Characters &chars = Net::CharServerHandler::mCharacters; - const BeingId id = msg.readBeingId("being id"); FOR_EACH (Net::Characters::iterator, it, chars) { const Net::Character *const character = *it; if (character->dummy != nullptr && - character->dummy->getId() == id) + character->dummy->getId() == beingId) { dstBeing = character->dummy; break; @@ -240,8 +243,7 @@ void BeingRecv::processBeingChangeLookCards(Net::MessageIn &msg) } else { - dstBeing = actorManager->findBeing( - msg.readBeingId("being id")); + dstBeing = actorManager->findBeing(beingId); } const uint8_t type = msg.readUInt8("type"); @@ -597,10 +599,7 @@ void BeingRecv::processBeingVisible(Net::MessageIn &msg) msg.readString(24, "name"); } - dstBeing->setStatusEffectOpitons(option, - opt1, - opt2, - opt3); + dstBeing->setStatusEffectOptions(option, opt1, opt2, opt3); } void BeingRecv::processBeingMove(Net::MessageIn &msg) @@ -794,10 +793,7 @@ void BeingRecv::processBeingMove(Net::MessageIn &msg) msg.readString(24, "name"); } - dstBeing->setStatusEffectOpitons(option, - opt1, - opt2, - opt3); + dstBeing->setStatusEffectOptions(option, opt1, opt2, opt3); } void BeingRecv::processBeingSpawn(Net::MessageIn &msg) @@ -967,10 +963,7 @@ void BeingRecv::processBeingSpawn(Net::MessageIn &msg) msg.readString(24, "name"); } - dstBeing->setStatusEffectOpitons(option, - opt1, - opt2, - opt3); + dstBeing->setStatusEffectOptions(option, opt1, opt2, opt3); } void BeingRecv::processMapTypeProperty(Net::MessageIn &msg) @@ -1496,14 +1489,12 @@ void BeingRecv::processBeingSpecialEffect(Net::MessageIn &msg) const BeingId id = msg.readBeingId("being id"); Being *const being = actorManager->findBeing(id); - if (being == nullptr) - { - msg.readInt32("effect type"); - return; - } const int effectType = msg.readInt32("effect type"); + if (being == nullptr) + return; + if (ParticleEngine::enabled) effectManager->trigger(effectType, being, 0); @@ -1548,12 +1539,21 @@ void BeingRecv::processBeingSpecialEffectNum(Net::MessageIn &msg) void BeingRecv::processBeingSoundEffect(Net::MessageIn &msg) { - UNIMPLEMENTEDPACKET; - // +++ need play this effect. - msg.readString(24, "sound effect name"); + const std::string effectPath = msg.readString(24, "sound effect name"); msg.readUInt8("type"); msg.readInt32("unused"); - msg.readInt32("source being id"); + const BeingId bId = msg.readBeingId("source being id"); + + Being *const srcBeing = actorManager->findBeing(bId); + int tileX = 0; + int tileY = 0; + if (srcBeing != nullptr) + { + tileX = srcBeing->getTileX(); + tileY = srcBeing->getTileY(); + } + + soundManager.playSfx(effectPath, tileX, tileY); } void BeingRecv::processSkillGroundNoDamage(Net::MessageIn &msg) @@ -1598,10 +1598,10 @@ void BeingRecv::processSkillEntry(Net::MessageIn &msg) void BeingRecv::processPlayerStatusChange(Net::MessageIn &msg) { - BLOCK_START("BeingRecv::processPlayerStop") + BLOCK_START("BeingRecv::processPlayerStatusChange") if (actorManager == nullptr) { - BLOCK_END("BeingRecv::processPlayerStop") + BLOCK_END("BeingRecv::processPlayerStatusChange") return; } @@ -1629,10 +1629,8 @@ void BeingRecv::processPlayerStatusChange(Net::MessageIn &msg) option = msg.readInt16("option"); dstBeing->setKarma(msg.readUInt8("karma")); - dstBeing->setStatusEffectOpitons(option, - opt1, - opt2); - BLOCK_END("BeingRecv::processPlayerStop") + dstBeing->setStatusEffectOptions(option, opt1, opt2); + BLOCK_END("BeingRecv::processPlayerStatusChange") } void BeingRecv::processPlayerStatusChange2(Net::MessageIn &msg) @@ -1895,15 +1893,15 @@ void BeingRecv::processBeingSelfEffect(Net::MessageIn &msg) const BeingId id = msg.readBeingId("being id"); Being *const being = actorManager->findBeing(id); + const int effectType = msg.readInt32("effect type"); + if (being == nullptr) { DEBUGLOGSTR("insible player?"); - msg.readInt32("effect type"); BLOCK_END("BeingRecv::processBeingSelfEffect") return; } - const int effectType = msg.readInt32("effect type"); if (ParticleEngine::enabled) effectManager->trigger(effectType, being, 0); |