mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 04:37:00 +00:00
[8871] Avoid use StopMoving when creature is already stopped.
Some additional code cleanup in related code.
This commit is contained in:
parent
663038c7c7
commit
10ebadcadf
5 changed files with 48 additions and 41 deletions
|
|
@ -36,19 +36,22 @@ void WorldSession::HandleBattlemasterHelloOpcode( WorldPacket & recv_data )
|
|||
{
|
||||
uint64 guid;
|
||||
recv_data >> guid;
|
||||
|
||||
sLog.outDebug("WORLD: Recvd CMSG_BATTLEMASTER_HELLO Message from (GUID: %u TypeId:%u)", GUID_LOPART(guid),GuidHigh2TypeId(GUID_HIPART(guid)));
|
||||
|
||||
Creature *unit = GetPlayer()->GetMap()->GetCreature(guid);
|
||||
if (!unit)
|
||||
Creature *pCreature = GetPlayer()->GetMap()->GetCreature(guid);
|
||||
|
||||
if (!pCreature)
|
||||
return;
|
||||
|
||||
if(!unit->isBattleMaster()) // it's not battlemaster
|
||||
if (!pCreature->isBattleMaster()) // it's not battlemaster
|
||||
return;
|
||||
|
||||
// Stop the npc if moving
|
||||
unit->StopMoving();
|
||||
if (!pCreature->IsStopped())
|
||||
pCreature->StopMoving();
|
||||
|
||||
BattleGroundTypeId bgTypeId = sBattleGroundMgr.GetBattleMasterBG(unit->GetEntry());
|
||||
BattleGroundTypeId bgTypeId = sBattleGroundMgr.GetBattleMasterBG(pCreature->GetEntry());
|
||||
|
||||
if (bgTypeId == BATTLEGROUND_TYPE_NONE)
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -705,6 +705,7 @@ void WorldSession::SendListInventory( uint64 vendorguid )
|
|||
sLog.outDebug("WORLD: Sent SMSG_LIST_INVENTORY");
|
||||
|
||||
Creature *pCreature = GetPlayer()->GetNPCIfCanInteractWith(vendorguid, UNIT_NPC_FLAG_VENDOR);
|
||||
|
||||
if (!pCreature)
|
||||
{
|
||||
sLog.outDebug("WORLD: SendListInventory - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(vendorguid)));
|
||||
|
|
@ -717,9 +718,11 @@ void WorldSession::SendListInventory( uint64 vendorguid )
|
|||
GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH);
|
||||
|
||||
// Stop the npc if moving
|
||||
if (!pCreature->IsStopped())
|
||||
pCreature->StopMoving();
|
||||
|
||||
VendorItemData const* vItems = pCreature->GetVendorItems();
|
||||
|
||||
if (!vItems)
|
||||
{
|
||||
_player->SendSellError(SELL_ERR_CANT_FIND_VENDOR, NULL, 0, 0);
|
||||
|
|
|
|||
|
|
@ -256,8 +256,9 @@ void WorldSession::HandleGossipHelloOpcode( WorldPacket & recv_data )
|
|||
uint64 guid;
|
||||
recv_data >> guid;
|
||||
|
||||
Creature *unit = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_NONE);
|
||||
if (!unit)
|
||||
Creature *pCreature = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_NONE);
|
||||
|
||||
if (!pCreature)
|
||||
{
|
||||
sLog.outDebug("WORLD: HandleGossipHelloOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)));
|
||||
return;
|
||||
|
|
@ -267,19 +268,17 @@ void WorldSession::HandleGossipHelloOpcode( WorldPacket & recv_data )
|
|||
if (GetPlayer()->hasUnitState(UNIT_STAT_DIED))
|
||||
GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH);
|
||||
|
||||
if( unit->isArmorer() || unit->isCivilian() || unit->isQuestGiver() || unit->isServiceProvider())
|
||||
{
|
||||
unit->StopMoving();
|
||||
}
|
||||
if (!pCreature->IsStopped())
|
||||
pCreature->StopMoving();
|
||||
|
||||
if (unit->isSpiritGuide())
|
||||
unit->SendAreaSpiritHealerQueryOpcode(_player);
|
||||
if (pCreature->isSpiritGuide())
|
||||
pCreature->SendAreaSpiritHealerQueryOpcode(_player);
|
||||
|
||||
if(!Script->GossipHello( _player, unit ))
|
||||
if (!Script->GossipHello(_player, pCreature))
|
||||
{
|
||||
_player->TalkedToCreature(unit->GetEntry(),unit->GetGUID());
|
||||
unit->prepareGossipMenu(_player);
|
||||
unit->sendPreparedGossip(_player);
|
||||
_player->TalkedToCreature(pCreature->GetEntry(), pCreature->GetGUID());
|
||||
pCreature->prepareGossipMenu(_player);
|
||||
pCreature->sendPreparedGossip(_player);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -84,17 +84,19 @@ void WorldSession::HandleQuestgiverHelloOpcode( WorldPacket & recv_data )
|
|||
sLog.outDebug ("WORLD: Received CMSG_QUESTGIVER_HELLO npc = %u", GUID_LOPART(guid));
|
||||
|
||||
Creature *pCreature = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_NONE);
|
||||
|
||||
if (!pCreature)
|
||||
{
|
||||
sLog.outDebug ("WORLD: HandleQuestgiverHelloOpcode - Unit (GUID: %u) not found or you can't interact with him.",
|
||||
GUID_LOPART(guid));
|
||||
sLog.outDebug ("WORLD: HandleQuestgiverHelloOpcode - Unit (GUID: %u) not found or you can't interact with him.", GUID_LOPART(guid));
|
||||
return;
|
||||
}
|
||||
|
||||
// remove fake death
|
||||
if (GetPlayer()->hasUnitState(UNIT_STAT_DIED))
|
||||
GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH);
|
||||
|
||||
// Stop the npc if moving
|
||||
if (!pCreature->IsStopped())
|
||||
pCreature->StopMoving();
|
||||
|
||||
if (Script->GossipHello(_player, pCreature))
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "8870"
|
||||
#define REVISION_NR "8871"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue