本文整理汇总了C++中PlayerPointer::isDead方法的典型用法代码示例。如果您正苦于以下问题:C++ PlayerPointer::isDead方法的具体用法?C++ PlayerPointer::isDead怎么用?C++ PlayerPointer::isDead使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlayerPointer
的用法示例。
在下文中一共展示了PlayerPointer::isDead方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HandleInitiateTrade
void WorldSession::HandleInitiateTrade(WorldPacket & recv_data)
{
CHECK_INWORLD_RETURN;
CHECK_PACKET_SIZE(recv_data, 8);
uint64 guid;
recv_data >> guid;
uint32 TradeStatus = TRADE_STATUS_PROPOSED;
PlayerPointer pTarget = _player->GetMapMgr()->GetPlayer((uint32)guid);
if(pTarget == NULL || !pTarget->IsInWorld())
TradeStatus = TRADE_STATUS_PLAYER_NOT_FOUND;
else
{
// Handle possible error outcomes
if(_player->isDead())
TradeStatus = TRADE_STATUS_DEAD;
if(pTarget->isDead())
TradeStatus = TRADE_STATUS_TARGET_DEAD;
else if(pTarget->mTradeTarget != 0)
TradeStatus = TRADE_STATUS_ALREADY_TRADING;
else if(pTarget->GetTeam() != _player->GetTeam() && GetPermissionCount() == 0)
TradeStatus = TRADE_STATUS_WRONG_FACTION;
else if(_player->CalcDistance(pTarget) > 10.0f) // This needs to be checked
TradeStatus = TRADE_STATUS_TOO_FAR_AWAY;
}
if(TradeStatus != TRADE_STATUS_PROPOSED)
{
_player->ResetTradeVariables();
SendTradeStatus(TradeStatus);
}
else
{
_player->ResetTradeVariables();
pTarget->ResetTradeVariables();
pTarget->mTradeTarget = _player->GetLowGUID();
_player->mTradeTarget = pTarget->GetLowGUID();
pTarget->mTradeStatus = TradeStatus;
_player->mTradeStatus = TradeStatus;
WorldPacket data(SMSG_TRADE_STATUS, 12);
data << TradeStatus;
data << _player->GetGUID();
if(pTarget->m_session && pTarget->m_session->GetSocket())
pTarget->m_session->SendPacket(&data);
}
}
示例2: HandleReviveStringcommand
bool ChatHandler::HandleReviveStringcommand(const char* args, WorldSession* m_session)
{
PlayerPointer plr = objmgr.GetPlayer(args, false);
if(!plr)
{
RedSystemMessage(m_session, "Could not find player %s.", args);
return true;
}
if(plr->isDead())
{
if(plr->GetInstanceID() == m_session->GetPlayer()->GetInstanceID())
plr->RemoteRevive();
else
sEventMgr.AddEvent(plr, &Player::RemoteRevive, EVENT_PLAYER_REST, 1, 1,0);
GreenSystemMessage(m_session, "Revived player %s.", args);
} else {
GreenSystemMessage(m_session, "Player %s is not dead.", args);
}
return true;
}
示例3: HandleKillByPlrCommand
bool ChatHandler::HandleKillByPlrCommand( const char *args , WorldSession *m_session )
{
PlayerPointer plr = objmgr.GetPlayer(args, false);
if(!plr)
{
RedSystemMessage(m_session, "Player %s is not online or does not exist.", args);
return true;
}
if(plr->isDead())
{
RedSystemMessage(m_session, "Player %s is already dead.", args);
} else {
plr->SetUInt32Value(UNIT_FIELD_HEALTH, 0); // Die, insect
plr->KillPlayer();
BlueSystemMessageToPlr(plr, "You were killed by %s with a GM command.", m_session->GetPlayer()->GetName());
GreenSystemMessage(m_session, "Killed player %s.", args);
sGMLog.writefromsession(m_session, "remote killed "I64FMT" (Name: %s)", plr->GetGUID(), plr->GetNameString() );
}
return true;
}
示例4: HookOnAreaTrigger
void ArathiBasin::HookOnAreaTrigger(PlayerPointer plr, uint32 id)
{
uint32 spellid=0;
int32 buffslot = -1;
switch(id)
{
case 3866: // stables
buffslot=AB_BUFF_STABLES;
break;
case 3867: // farm
buffslot=AB_BUFF_FARM;
break;
case 3870: // blacksmith
buffslot=AB_BUFF_BLACKSMITH;
break;
case 3869: // mine
buffslot=AB_BUFF_MINE;
break;
case 3868: // lumbermill
buffslot=AB_BUFF_LUMBERMILL;
break;
case 3948: // alliance/horde exits
case 3949:
{
RemovePlayer(plr,false);
return;
}break;
default:
Log.Error("ArathiBasin", "Encountered unhandled areatrigger id %u", id);
return;
break;
}
if(plr->isDead()) // dont apply to dead players... :P
return;
uint32 x = (uint32)buffslot;
if(m_buffs[x] && m_buffs[x]->IsInWorld())
{
// apply the spell
spellid = m_buffs[x]->GetInfo()->sound3;
m_buffs[x]->RemoveFromWorld(false);
// respawn it in buffrespawntime
sEventMgr.AddEvent(TO_ARATHIBASIN(shared_from_this()),&ArathiBasin::SpawnBuff,x,EVENT_AB_RESPAWN_BUFF,AB_BUFF_RESPAWN_TIME,1,EVENT_FLAG_DO_NOT_EXECUTE_IN_WORLD_CONTEXT);
// cast the spell on the player
SpellEntry * sp = dbcSpell.LookupEntryForced(spellid);
if(sp)
{
SpellPointer pSpell(new Spell(plr, sp, true, NULLAURA));
SpellCastTargets targets(plr->GetGUID());
pSpell->prepare(&targets);
}
}
}