📄 uncommhandler.cpp.svn-base
字号:
#include "StdAfx.h"
void WorldSession::HandlePVPfieldPortOpcode(WorldPacket &recv_data)
{
uint16 mapinfo, unk;
uint8 action;
uint32 bgtype;
if(!_player->IsInWorld()) return;
recv_data >> unk >> bgtype >> mapinfo >> action;
if(action == 0)
{
PVPFLOORManager.RemovePlayerFromQueues(_player);
}
else
{
if(_player->m_pendingPVPFLOOR)
_player->m_pendingPVPFLOOR->PortPlayer(_player);
}
}
void WorldSession::HandlePVPfieldStatusOpcode(WorldPacket &recv_data)
{
/* This is done based on whether we are queued, inside, or not in a PVPFLOOR.
*/
if(_player->m_pendingPVPFLOOR) // Ready to port
PVPFLOORManager.SendPVPfieldStatus(_player, 2, _player->m_pendingPVPFLOOR->GetType(), _player->m_pendingPVPFLOOR->GetId(), 120000, 0, _player->m_pendingPVPFLOOR->Rated());
else if(_player->m_bg) // Inside a bg
PVPFLOORManager.SendPVPfieldStatus(_player, 3, _player->m_bg->GetType(), _player->m_bg->GetId(), (uint32)UNIXTIME - _player->m_bg->GetStartTime(), _player->GetMapId(), _player->m_bg->Rated());
else // None
PVPFLOORManager.SendPVPfieldStatus(_player, 0, 0, 0, 0, 0, 0);
}
void WorldSession::HandlePVPfieldListOpcode(WorldPacket &recv_data)
{
uint64 guid;
recv_data >> guid;
CHECK_INWORLD_RETURN;
Creature * pCreature = _player->GetMapMgr()->GetCreature( GET_LOWGUID_PART(guid) );
if( pCreature == NULL )
return;
SendPVPFLOORList( pCreature, 0 );
}
void WorldSession::SendPVPFLOORList(Creature* pCreature, uint32 mapid)
{
if(!pCreature)
return;
/* we should have a bg id selection here. */
uint32 t = PVPFLOOR_WARSUNG_GULCH;
if (mapid == 0)
{
if(pCreature->GetCreatureName())
{
if(strstr(pCreature->GetCreatureName()->SubName, "FORTRESS") != NULL)
t = PVPFLOOR_FORTRESS_2V2;
else if(strstr(pCreature->GetCreatureName()->SubName, "Arathi") != NULL)
t = PVPFLOOR_ARATHI_BASIN;
else if(strstr(pCreature->GetCreatureName()->SubName, "Warsong") != NULL)
t = PVPFLOOR_WARSUNG_GULCH;
}
}
else
t = mapid;
PVPFLOORManager.HandlePVPFLOORListPacket(this, t);
}
void WorldSession::HandlePVPMasterHelloOpcode(WorldPacket &recv_data)
{
sLog.outString("Received CMSG_PVPMASTER_HELLO");
}
void WorldSession::HandleLeavePVPfieldOpcode(WorldPacket &recv_data)
{
if(_player->m_bg && _player->IsInWorld())
_player->m_bg->RemovePlayer(_player, false);
}
void WorldSession::HandleAreaSpiritHealerQueryOpcode(WorldPacket &recv_data)
{
if(!_player->IsInWorld() || !_player->m_bg) return;
uint64 guid;
recv_data >> guid;
Creature * psg = _player->GetMapMgr()->GetCreature(GET_LOWGUID_PART(guid));
if(psg == NULL)
return;
uint32 restime = _player->m_bg->GetLastResurrect() + 30;
if((uint32)UNIXTIME > restime)
restime = 1000;
else
restime = (restime - (uint32)UNIXTIME) * 1000;
WorldPacket data(SMSG_AREA_SPIRIT_HEALER_TIME, 12);
data << guid << restime;
SendPacket(&data);
}
void WorldSession::HandleAreaSpiritHealerQueueOpcode(WorldPacket &recv_data)
{
if(!_player->IsInWorld() || !_player->m_bg) return;
uint64 guid;
recv_data >> guid;
Creature * psg = _player->GetMapMgr()->GetCreature(GET_LOWGUID_PART(guid));
if(psg == NULL)
return;
_player->m_bg->QueuePlayerForResurrect(_player, psg);
_player->CastSpell(_player,2584,true);
}
void WorldSession::HandlePVPFLOORPlayerPositionsOpcode(WorldPacket &recv_data)
{
/* This packet doesn't appear to be used anymore...
* - Burlex
*/
}
void WorldSession::HandlePVPMasterJoinOpcode(WorldPacket &recv_data)
{
CHECK_INWORLD_RETURN
if(_player->GetGroup() && _player->GetGroup()->m_isqueued)
{
SystemMessage("You are in a group that is already queued for a PVPFLOOR or inside a PVPFLOOR. Leave this first.");
return;
}
/* are we already in a queue? */
if(_player->m_bgIsQueued)
PVPFLOORManager.RemovePlayerFromQueues(_player);
if(_player->IsInWorld())
PVPFLOORManager.HandlePVPFLOORJoin(this, recv_data);
}
void WorldSession::HandleFORTRESSJoinOpcode(WorldPacket &recv_data)
{
CHECK_INWORLD_RETURN
if(_player->GetGroup() && _player->GetGroup()->m_isqueued)
{
SystemMessage("You are in a group that is already queued for a PVPFLOOR or inside a PVPFLOOR. Leave this first.");
return;
}
/* are we already in a queue? */
if(_player->m_bgIsQueued)
PVPFLOORManager.RemovePlayerFromQueues(_player);
uint32 bgtype=0;
uint64 guid;
uint8 FORTRESScategory;
uint8 as_group;
uint8 rated_match;
recv_data >> guid >> FORTRESScategory >> as_group >> rated_match;
switch(FORTRESScategory)
{
case 0:
bgtype = PVPFLOOR_FORTRESS_V;
break;
case 1:
bgtype = PVPFLOOR_FORTRESS_V;
break;
case 2:
bgtype = PVPFLOOR_FORTRESS_V;
break;
}
if(bgtype != 0)
PVPFLOORManager.HandleFORTRESSJoin(this, bgtype, as_group, rated_match);
}
void WorldSession::HandleInspectHonorStatsOpcode( WorldPacket &recv_data )
{
CHECK_PACKET_SIZE( recv_data, 8 );
CHECK_INWORLD_RETURN
uint64 guid;
recv_data >> guid;
if( _player == NULL )
{
sLog.outError( "HandleInspectHonorStatsOpcode : _player was null" );
return;
}
if( _player->GetMapMgr() == NULL )
{
sLog.outError( "HandleInspectHonorStatsOpcode : _player map mgr was null" );
return;
}
if( _player->GetMapMgr()->GetPlayer( (uint32)guid ) == NULL )
{
sLog.outError( "HandleInspectHonorStatsOpcode : guid was null" );
return;
}
Player* player = _player->GetMapMgr()->GetPlayer( (uint32)guid );
WorldPacket data( MSG_INSPECT_HONOR_STATS, 13 );
data << player->GetGUID() << (uint8)player->GetUInt32Value( PLAYER_FIELD_HONOR_CURRENCY );
data << player->GetUInt32Value( PLAYER_FIELD_KILLS );
data << player->GetUInt32Value( PLAYER_FIELD_TODAY_CONTRIBUTION );
data << player->GetUInt32Value( PLAYER_FIELD_YESTERDAY_CONTRIBUTION );
data << player->GetUInt32Value( PLAYER_FIELD_LIFETIME_HONORBALE_KILLS );
SendPacket( &data );
}
void WorldSession::HandleInspectFORTRESSStatsOpcode( WorldPacket & recv_data )
{
CHECK_PACKET_SIZE( recv_data, 8 );
CHECK_INWORLD_RETURN
uint64 guid;
recv_data >> guid;
Player* player = _player->GetMapMgr()->GetPlayer( (uint32)guid );
if( player == NULL )
{
sLog.outError( "HandleInspectHonorStatsOpcode : guid was null" );
return;
}
uint32 id;
for( uint8 i = 0; i < 3; i++ )
{
id = player->GetUInt32Value( PLAYER_FIELD_FORTRESS__INFO_1_1 + ( i * 6 ) );
if( id > 0 )
{
FORTRESS* = objmgr.GetFORTRESSById( id );
if( != NULL )
{
WorldPacket data( MSG_INSPECT_FORTRESS_STATS, 8 + 1 + 4 * 5 );
data << player->GetGUID();
data << ->m_type;
data << ->m_id;
data << ->m_stat_rating;
data << ->m_stat_gamesplayedweek;
data << ->m_stat_gameswonweek;
data << ->m_stat_gamesplayedseason;
SendPacket( &data );
}
}
}
}
void WorldSession::HandlePVPLogDataOpcode(WorldPacket &recv_data)
{
CHECK_INWORLD_RETURN
if(_player->m_bg)
_player->m_bg->SendPVPData(_player);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -