mirror of
https://github.com/mangosfour/server.git
synced 2025-12-16 04:37:00 +00:00
[10635] Convert many opcode handlers to ObjectGuid use.
Also re-enabled anticheating check for bank window open base at .bank command access rights.
This commit is contained in:
parent
0901a4c2ac
commit
851e15c70a
26 changed files with 322 additions and 326 deletions
|
|
@ -82,16 +82,16 @@ void WorldSession::HandleQuestgiverStatusQueryOpcode( WorldPacket & recv_data )
|
|||
|
||||
void WorldSession::HandleQuestgiverHelloOpcode(WorldPacket & recv_data)
|
||||
{
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
recv_data >> guid;
|
||||
|
||||
DEBUG_LOG ("WORLD: Received CMSG_QUESTGIVER_HELLO npc = %u", GUID_LOPART(guid));
|
||||
DEBUG_LOG("WORLD: Received CMSG_QUESTGIVER_HELLO npc: %s", guid.GetString().c_str());
|
||||
|
||||
Creature *pCreature = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_NONE);
|
||||
|
||||
if (!pCreature)
|
||||
{
|
||||
DEBUG_LOG ("WORLD: HandleQuestgiverHelloOpcode - Unit (GUID: %u) not found or you can't interact with him.", GUID_LOPART(guid));
|
||||
DEBUG_LOG ("WORLD: HandleQuestgiverHelloOpcode - %s not found or you can't interact with him.", guid.GetString().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -112,15 +112,15 @@ void WorldSession::HandleQuestgiverHelloOpcode(WorldPacket & recv_data)
|
|||
|
||||
void WorldSession::HandleQuestgiverAcceptQuestOpcode( WorldPacket & recv_data )
|
||||
{
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
uint32 quest;
|
||||
uint32 unk1;
|
||||
recv_data >> guid >> quest >> unk1;
|
||||
|
||||
if(!GetPlayer()->isAlive())
|
||||
if (!GetPlayer()->isAlive())
|
||||
return;
|
||||
|
||||
DEBUG_LOG( "WORLD: Received CMSG_QUESTGIVER_ACCEPT_QUEST npc = %u, quest = %u, unk1 = %u", uint32(GUID_LOPART(guid)), quest, unk1 );
|
||||
DEBUG_LOG("WORLD: Received CMSG_QUESTGIVER_ACCEPT_QUEST npc = %s, quest = %u, unk1 = %u", guid.GetString().c_str(), quest, unk1 );
|
||||
|
||||
Object* pObject = _player->GetObjectByTypeMask(guid, TYPEMASK_CREATURE_GAMEOBJECT_PLAYER_OR_ITEM);
|
||||
|
||||
|
|
@ -233,11 +233,12 @@ void WorldSession::HandleQuestgiverAcceptQuestOpcode( WorldPacket & recv_data )
|
|||
|
||||
void WorldSession::HandleQuestgiverQueryQuestOpcode( WorldPacket & recv_data )
|
||||
{
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
uint32 quest;
|
||||
uint8 unk1;
|
||||
recv_data >> guid >> quest >> unk1;
|
||||
DEBUG_LOG( "WORLD: Received CMSG_QUESTGIVER_QUERY_QUEST npc = %u, quest = %u, unk1 = %u", uint32(GUID_LOPART(guid)), quest, unk1 );
|
||||
|
||||
DEBUG_LOG("WORLD: Received CMSG_QUESTGIVER_QUERY_QUEST npc = %s, quest = %u, unk1 = %u", guid.GetString().c_str(), quest, unk1 );
|
||||
|
||||
// Verify that the guid is valid and is a questgiver or involved in the requested quest
|
||||
Object* pObject = _player->GetObjectByTypeMask(guid, TYPEMASK_CREATURE_GAMEOBJECT_OR_ITEM);
|
||||
|
|
@ -247,11 +248,8 @@ void WorldSession::HandleQuestgiverQueryQuestOpcode( WorldPacket & recv_data )
|
|||
return;
|
||||
}
|
||||
|
||||
Quest const* pQuest = sObjectMgr.GetQuestTemplate(quest);
|
||||
if ( pQuest )
|
||||
{
|
||||
_player->PlayerTalkClass->SendQuestGiverQuestDetails(pQuest, pObject->GetGUID(), true);
|
||||
}
|
||||
if (Quest const* pQuest = sObjectMgr.GetQuestTemplate(quest))
|
||||
_player->PlayerTalkClass->SendQuestGiverQuestDetails(pQuest, pObject->GetObjectGuid(), true);
|
||||
}
|
||||
|
||||
void WorldSession::HandleQuestQueryOpcode( WorldPacket & recv_data )
|
||||
|
|
@ -270,7 +268,7 @@ void WorldSession::HandleQuestQueryOpcode( WorldPacket & recv_data )
|
|||
void WorldSession::HandleQuestgiverChooseRewardOpcode( WorldPacket & recv_data )
|
||||
{
|
||||
uint32 quest, reward;
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
recv_data >> guid >> quest >> reward;
|
||||
|
||||
if(reward >= QUEST_REWARD_CHOICES_COUNT)
|
||||
|
|
@ -282,7 +280,7 @@ void WorldSession::HandleQuestgiverChooseRewardOpcode( WorldPacket & recv_data )
|
|||
if(!GetPlayer()->isAlive())
|
||||
return;
|
||||
|
||||
DEBUG_LOG( "WORLD: Received CMSG_QUESTGIVER_CHOOSE_REWARD npc = %u, quest = %u, reward = %u",uint32(GUID_LOPART(guid)),quest,reward );
|
||||
DEBUG_LOG("WORLD: Received CMSG_QUESTGIVER_CHOOSE_REWARD npc = %s, quest = %u, reward = %u", guid.GetString().c_str(), quest, reward);
|
||||
|
||||
Object* pObject = _player->GetObjectByTypeMask(guid, TYPEMASK_CREATURE_OR_GAMEOBJECT);
|
||||
if(!pObject)
|
||||
|
|
@ -301,51 +299,51 @@ void WorldSession::HandleQuestgiverChooseRewardOpcode( WorldPacket & recv_data )
|
|||
switch(pObject->GetTypeId())
|
||||
{
|
||||
case TYPEID_UNIT:
|
||||
if( !(Script->ChooseReward( _player, ((Creature*)pObject), pQuest, reward )) )
|
||||
if (!(Script->ChooseReward(_player, ((Creature*)pObject), pQuest, reward)))
|
||||
{
|
||||
// Send next quest
|
||||
if(Quest const* nextquest = _player->GetNextQuest( guid ,pQuest ) )
|
||||
_player->PlayerTalkClass->SendQuestGiverQuestDetails(nextquest,guid,true);
|
||||
if (Quest const* nextquest = _player->GetNextQuest(guid, pQuest))
|
||||
_player->PlayerTalkClass->SendQuestGiverQuestDetails(nextquest, guid, true);
|
||||
}
|
||||
break;
|
||||
case TYPEID_GAMEOBJECT:
|
||||
if( !Script->GOChooseReward( _player, ((GameObject*)pObject), pQuest, reward ) )
|
||||
if (!Script->GOChooseReward(_player, ((GameObject*)pObject), pQuest, reward))
|
||||
{
|
||||
// Send next quest
|
||||
if(Quest const* nextquest = _player->GetNextQuest( guid ,pQuest ) )
|
||||
_player->PlayerTalkClass->SendQuestGiverQuestDetails(nextquest,guid,true);
|
||||
if (Quest const* nextquest = _player->GetNextQuest(guid ,pQuest))
|
||||
_player->PlayerTalkClass->SendQuestGiverQuestDetails(nextquest, guid, true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
_player->PlayerTalkClass->SendQuestGiverOfferReward( pQuest, guid, true );
|
||||
_player->PlayerTalkClass->SendQuestGiverOfferReward(pQuest, guid, true);
|
||||
}
|
||||
}
|
||||
|
||||
void WorldSession::HandleQuestgiverRequestRewardOpcode( WorldPacket & recv_data )
|
||||
{
|
||||
uint32 quest;
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
recv_data >> guid >> quest;
|
||||
|
||||
if(!GetPlayer()->isAlive())
|
||||
if (!GetPlayer()->isAlive())
|
||||
return;
|
||||
|
||||
DEBUG_LOG( "WORLD: Received CMSG_QUESTGIVER_REQUEST_REWARD npc = %u, quest = %u",uint32(GUID_LOPART(guid)),quest );
|
||||
DEBUG_LOG("WORLD: Received CMSG_QUESTGIVER_REQUEST_REWARD npc = %s, quest = %u", guid.GetString().c_str(), quest);
|
||||
|
||||
Object* pObject = _player->GetObjectByTypeMask(guid, TYPEMASK_CREATURE_OR_GAMEOBJECT);
|
||||
if(!pObject||!pObject->HasInvolvedQuest(quest))
|
||||
if (!pObject||!pObject->HasInvolvedQuest(quest))
|
||||
return;
|
||||
|
||||
if ( _player->CanCompleteQuest( quest ) )
|
||||
_player->CompleteQuest( quest );
|
||||
if (_player->CanCompleteQuest(quest))
|
||||
_player->CompleteQuest(quest);
|
||||
|
||||
if( _player->GetQuestStatus( quest ) != QUEST_STATUS_COMPLETE )
|
||||
if (_player->GetQuestStatus(quest) != QUEST_STATUS_COMPLETE)
|
||||
return;
|
||||
|
||||
if(Quest const *pQuest = sObjectMgr.GetQuestTemplate(quest))
|
||||
_player->PlayerTalkClass->SendQuestGiverOfferReward( pQuest, guid, true );
|
||||
if (Quest const *pQuest = sObjectMgr.GetQuestTemplate(quest))
|
||||
_player->PlayerTalkClass->SendQuestGiverOfferReward(pQuest, guid, true);
|
||||
}
|
||||
|
||||
void WorldSession::HandleQuestgiverCancel(WorldPacket& /*recv_data*/ )
|
||||
|
|
@ -435,27 +433,26 @@ void WorldSession::HandleQuestConfirmAccept(WorldPacket& recv_data)
|
|||
void WorldSession::HandleQuestgiverCompleteQuest(WorldPacket& recv_data)
|
||||
{
|
||||
uint32 quest;
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
recv_data >> guid >> quest;
|
||||
|
||||
if(!GetPlayer()->isAlive())
|
||||
if (!GetPlayer()->isAlive())
|
||||
return;
|
||||
|
||||
DEBUG_LOG( "WORLD: Received CMSG_QUESTGIVER_COMPLETE_QUEST npc = %u, quest = %u",uint32(GUID_LOPART(guid)),quest );
|
||||
DEBUG_LOG("WORLD: Received CMSG_QUESTGIVER_COMPLETE_QUEST npc = %s, quest = %u", guid.GetString().c_str(), quest);
|
||||
|
||||
Quest const *pQuest = sObjectMgr.GetQuestTemplate(quest);
|
||||
if( pQuest )
|
||||
if (Quest const *pQuest = sObjectMgr.GetQuestTemplate(quest))
|
||||
{
|
||||
if( _player->GetQuestStatus( quest ) != QUEST_STATUS_COMPLETE )
|
||||
if (_player->GetQuestStatus( quest ) != QUEST_STATUS_COMPLETE)
|
||||
{
|
||||
if( pQuest->IsRepeatable() )
|
||||
if (pQuest->IsRepeatable())
|
||||
_player->PlayerTalkClass->SendQuestGiverRequestItems(pQuest, guid, _player->CanCompleteRepeatableQuest(pQuest), false);
|
||||
else
|
||||
_player->PlayerTalkClass->SendQuestGiverRequestItems(pQuest, guid, _player->CanRewardQuest(pQuest,false), false);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(pQuest->GetReqItemsCount()) // some items required
|
||||
if (pQuest->GetReqItemsCount()) // some items required
|
||||
_player->PlayerTalkClass->SendQuestGiverRequestItems(pQuest, guid, _player->CanRewardQuest(pQuest,false), false);
|
||||
else // no items required
|
||||
_player->PlayerTalkClass->SendQuestGiverOfferReward(pQuest, guid, true);
|
||||
|
|
@ -518,7 +515,7 @@ void WorldSession::HandlePushQuestToParty(WorldPacket& recvPacket)
|
|||
continue;
|
||||
}
|
||||
|
||||
pPlayer->PlayerTalkClass->SendQuestGiverQuestDetails(pQuest, _player->GetGUID(), true);
|
||||
pPlayer->PlayerTalkClass->SendQuestGiverQuestDetails(pQuest, _player->GetObjectGuid(), true);
|
||||
pPlayer->SetDivider(_player->GetGUID());
|
||||
}
|
||||
}
|
||||
|
|
@ -527,19 +524,18 @@ void WorldSession::HandlePushQuestToParty(WorldPacket& recvPacket)
|
|||
|
||||
void WorldSession::HandleQuestPushResult(WorldPacket& recvPacket)
|
||||
{
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
uint8 msg;
|
||||
recvPacket >> guid >> msg;
|
||||
|
||||
DEBUG_LOG( "WORLD: Received MSG_QUEST_PUSH_RESULT" );
|
||||
DEBUG_LOG("WORLD: Received MSG_QUEST_PUSH_RESULT");
|
||||
|
||||
if( _player->GetDivider() != 0 )
|
||||
if (_player->GetDivider() != 0)
|
||||
{
|
||||
Player *pPlayer = ObjectAccessor::FindPlayer( _player->GetDivider() );
|
||||
if( pPlayer )
|
||||
if (Player *pPlayer = ObjectAccessor::FindPlayer(_player->GetDivider()))
|
||||
{
|
||||
WorldPacket data( MSG_QUEST_PUSH_RESULT, (8+1) );
|
||||
data << uint64(guid);
|
||||
data << ObjectGuid(guid);
|
||||
data << uint8(msg); // valid values: 0-8
|
||||
pPlayer->GetSession()->SendPacket(&data);
|
||||
_player->SetDivider( 0 );
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue