本文整理汇总了C++中PlayerPointer::GetLowGUID方法的典型用法代码示例。如果您正苦于以下问题:C++ PlayerPointer::GetLowGUID方法的具体用法?C++ PlayerPointer::GetLowGUID怎么用?C++ PlayerPointer::GetLowGUID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlayerPointer
的用法示例。
在下文中一共展示了PlayerPointer::GetLowGUID方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HookOnPlayerDeath
void Arena::HookOnPlayerDeath(PlayerPointer plr)
{
ASSERT(plr != NULL);
if (hashmap_get(m_playersAlive, plr->GetLowGUID(), NULL) == MAP_OK) {
m_playersCount[plr->GetTeam()]--;
UpdatePlayerCounts();
hashmap_remove(m_playersAlive, plr->GetLowGUID());
}
}
示例2: CreateGuildCommand
bool ChatHandler::CreateGuildCommand(const char* args, WorldSession *m_session)
{
if(!*args)
return false;
PlayerPointer ptarget = getSelectedChar(m_session);
if(!ptarget) return false;
if(strlen((char*)args)>75)
{
// send message to user
char buf[256];
snprintf((char*)buf,256,"The name was too long by %i", (unsigned int)strlen((char*)args)-75);
SystemMessage(m_session, buf);
return true;
}
for (uint32 i = 0; i < strlen(args); i++) {
if(!isalpha(args[i]) && args[i]!=' ') {
SystemMessage(m_session, "Error, name can only contain chars A-Z and a-z.");
return true;
}
}
Charter tempCharter(0, ptarget->GetLowGUID(), CHARTER_TYPE_GUILD);
tempCharter.SignatureCount=0;
tempCharter.GuildName = string(args);
Guild * pGuild = Guild::Create();
pGuild->CreateFromCharter(&tempCharter, ptarget->GetSession());
SystemMessage(m_session, "Guild created");
return true;
}
示例3: OnAddPlayer
void Arena::OnAddPlayer(PlayerPointer plr)
{
plr->m_deathVision = true;
if( plr->m_isGmInvisible )
return;
// remove all buffs (exclude talents, include flasks)
for(uint32 x=0;x<MAX_AURAS;x++)
{
if(plr->m_auras[x])
{
if(plr->m_auras[x] && !plr->m_auras[x]->GetSpellProto()->DurationIndex && plr->m_auras[x]->GetSpellProto()->Flags4 & CAN_PERSIST_AND_CASTED_WHILE_DEAD)
continue;
else
{
plr->m_auras[x]->Remove();
}
}
}
plr->GetItemInterface()->RemoveAllConjured();
plr->ResetAllCooldowns();
if( !m_started )
plr->CastSpell(plr, ARENA_PREPARATION, true);
m_playersCount[plr->GetTeam()]++;
UpdatePlayerCounts();
/* Add the green/gold team flag */
AuraPointer aura(new Aura(dbcSpell.LookupEntry(32724+plr->m_bgTeam), -1, plr, plr));
plr->AddAura(aura);
/* Set FFA PvP Flag */
plr->SetFFAPvPFlag();
hashmap_put(m_playersAlive, plr->GetLowGUID(), (any_t)1);
if(Rated())
{
// Store the players who join so that we can change their rating even if they leave before arena finishes
hashmap_put(m_players2[plr->GetTeam()], plr->GetLowGUID(), (any_t)1);
if(m_teams[plr->GetTeam()] == -1 && plr->m_playerInfo && plr->m_playerInfo->arenaTeam[m_arenateamtype] != NULL)
{
m_teams[plr->GetTeam()] = plr->m_playerInfo->arenaTeam[m_arenateamtype]->m_id;
}
}
}
示例4: 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);
}
}
示例5: ResetSavedInstances
void InstanceMgr::ResetSavedInstances(PlayerPointer plr)
{
WorldPacket data(SMSG_INSTANCE_RESET, 4);
Instance * in;
InstanceMap::iterator itr;
InstanceMap * instancemap;
uint32 i;
if(!plr->IsInWorld() || plr->GetMapMgr()->GetMapInfo()->type != INSTANCE_NULL)
return;
m_mapLock.Acquire();
for(i = 0; i < NUM_MAPS; ++i)
{
if(m_instances[i] != NULL)
{
instancemap = m_instances[i];
for(itr = instancemap->begin(); itr != instancemap->end();)
{
in = itr->second;
++itr;
if ( in->m_mapInfo->type == INSTANCE_NONRAID &&
( plr->GetLowGUID() == in->m_creatorGuid ||
( plr->GetGroup() && plr->GetGroup()->GetID() == in->m_creatorGroup )))
{
if(in->m_mapMgr && in->m_mapMgr->HasPlayers())
{
plr->GetSession()->SystemMessage("Can't reset instance %u (%s) when there are still players inside!", in->m_instanceId, in->m_mapMgr->GetMapInfo()->name);
continue;
}
// <mapid> has been reset.
data << uint32(in->m_mapId);
plr->GetSession()->SendPacket(&data);
// reset groupinstanceid
if(plr->GetGroup())
plr->GetGroup()->SetGroupInstanceID(0);
// destroy the instance
_DeleteInstance(in, true);
}
}
}
}
m_mapLock.Release();
}
示例6: PreTeleport
uint32 InstanceMgr::PreTeleport(uint32 mapid, PlayerPointer plr, uint32 instanceid)
{
// preteleport is where all the magic happens :P instance creation, etc.
MapInfo * inf = WorldMapInfoStorage.LookupEntry(mapid);
Group * pGroup = plr->GetGroup() ;
InstanceMap * instancemap;
Instance * in;
if(inf == NULL || mapid>=NUM_MAPS)
return INSTANCE_ABORT_NOT_FOUND;
// main continent check.
if(inf->type == INSTANCE_NULL)
{
// this will be useful when clustering comes into play.
// we can check if the destination world server is online or not and then cancel them before they load.
return (m_singleMaps[mapid] != NULL) ? INSTANCE_OK : INSTANCE_ABORT_NOT_FOUND;
}
// shouldn't happen
if(inf->type==INSTANCE_PVP)
return INSTANCE_ABORT_NOT_FOUND;
if( !plr->triggerpass_cheat )
{
// players without groups cannot enter raid instances (no soloing them:P)
if( pGroup == NULL && (inf->type == INSTANCE_RAID || inf->type == INSTANCE_MULTIMODE))
return INSTANCE_ABORT_NOT_IN_RAID_GROUP;
// check that heroic mode is available if the player has requested it.
if(plr->iInstanceType && inf->type != INSTANCE_MULTIMODE)
return INSTANCE_ABORT_HEROIC_MODE_NOT_AVAILABLE;
}
// if we are here, it means:
// 1) we're a non-raid instance
// 2) we're a raid instance, and the person is in a group.
// so, first we have to check if they have an instance on this map already, if so, allow them to teleport to that.
// otherwise, we can create them a new one.
m_mapLock.Acquire();
instancemap = m_instances[mapid];
if(instancemap)
{
InstanceMap::iterator itr;
if(instanceid != 0)
{
//try to find our instance in ones active now.
itr = instancemap->find(instanceid);
if(itr != instancemap->end())
{
Instance *inn = itr->second;
if( PlayerOwnsInstance( inn, plr ) >= OWNER_CHECK_OK )
{
m_mapLock.Release();
return INSTANCE_OK;
}
}
//There are no active maps, re-check if this concerns a saved instance.
Instance * saved_in = sInstanceMgr.GetSavedInstance( mapid, plr->GetLowGUID() );
if( saved_in && saved_in->m_instanceId == instanceid )
{
if ( PlayerOwnsInstance( saved_in, plr ) >= OWNER_CHECK_OK )
{
m_mapLock.Release();
return INSTANCE_OK;
}
}
m_mapLock.Release();
return INSTANCE_ABORT_NOT_FOUND;
}
else
{
// search all active instances and see if we have one here.
for(itr = instancemap->begin(); itr != instancemap->end();)
{
in = itr->second;
++itr;
if(PlayerOwnsInstance(in, plr) >= OWNER_CHECK_OK )
{
m_mapLock.Release();
// check the player count and in combat status.
if(in->m_mapMgr && in->m_mapMgr->HasPlayers() && !plr->triggerpass_cheat)
{
if( in->m_mapMgr->IsCombatInProgress())
return INSTANCE_ABORT_ENCOUNTER;
// check if we are full
if( in->m_mapMgr->GetPlayerCount() >= inf->playerlimit )
return INSTANCE_ABORT_FULL;
}
// found our instance, allow him in.
return INSTANCE_OK;
}
else
DEBUG_LOG("InstanceMgr","Check failed %s",plr->GetName());
}
//.........这里部分代码省略.........