本文整理汇总了C++中PlayerPointer::GetTeam方法的典型用法代码示例。如果您正苦于以下问题:C++ PlayerPointer::GetTeam方法的具体用法?C++ PlayerPointer::GetTeam怎么用?C++ PlayerPointer::GetTeam使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlayerPointer
的用法示例。
在下文中一共展示了PlayerPointer::GetTeam方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ZoneHook
void ZoneHook(PlayerPointer plr, uint32 Zone, uint32 OldZone)
{
static uint32 spellids[2] = { HELLFIRE_SUPERORITY_ALLIANCE, HELLFIRE_SUPERORITY_HORDE };
if(Zone == ZONE_HELLFIRE_PENINSULA)
{
if(g_superiorTeam == plr->GetTeam())
plr->CastSpell(plr, dbcSpell.LookupEntry(spellids[plr->GetTeam()]), true);
}
else if(OldZone == ZONE_HELLFIRE_PENINSULA)
{
if(g_superiorTeam == plr->GetTeam())
plr->RemovePositiveAura(spellids[plr->GetTeam()]);
}
}
示例2: Invite
void Channel::Invite(ObjectGuid p, const char *newname)
{
if (!IsOn(p))
{
WorldPacket data;
MakeNotMember(&data);
SendToOne(&data, p);
return;
}
PlayerPointer newp = GetPlayer(newname);
if (!newp)
{
WorldPacket data;
MakePlayerNotFound(&data, newname);
SendToOne(&data, p);
return;
}
PlayerPointer plr = GetPlayer(p);
if (!plr.get())
return;
if (newp->GetTeam() != plr->GetTeam() && !sWorld.getConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_INTERACTION_CHANNEL))
{
WorldPacket data;
MakeInviteWrongFaction(&data);
SendToOne(&data, p);
return;
}
if (IsOn(newp->GetObjectGuid()))
{
WorldPacket data;
MakePlayerAlreadyMember(&data, newp->GetObjectGuid());
SendToOne(&data, p);
return;
}
WorldPacket data;
if (!newp->GetSocial()->HasIgnore(p))
{
MakeInvite(&data, p);
SendToOne(&data, newp->GetObjectGuid());
data.clear();
}
MakePlayerInvited(&data, newp->GetName());
SendToOne(&data, p);
}
示例3: TFZoneHook
void TFZoneHook(PlayerPointer plr, uint32 Zone, uint32 OldZone)
{
if(!plr)
return;
if(Zone == ZONE_TEROKKAR_FOREST)
{
if(TFg_superiorTeam == plr->GetTeam())
plr->CastSpell(plr, dbcSpell.LookupEntry(BLESSING_OF_AUCHINDOUND), true);
}
else if(OldZone == ZONE_TEROKKAR_FOREST)
{
if(TFg_superiorTeam == plr->GetTeam())
plr->RemovePositiveAura(BLESSING_OF_AUCHINDOUND);
}
}
示例4: SilithusZoneHook
void SilithusZoneHook(PlayerPointer plr, uint32 Zone, uint32 OldZone)
{
if(!plr)
return;
if(Zone == ZONE_SILITHUS)
{
if(winners == plr->GetTeam())
plr->CastSpell(plr, dbcSpell.LookupEntry(CENARION_FAVOR), true);
}
else if(OldZone == ZONE_SILITHUS)
{
if(winners == plr->GetTeam())
plr->RemovePositiveAura(CENARION_FAVOR);
}
}
示例5: HandleCharterOffer
void WorldSession::HandleCharterOffer( WorldPacket & recv_data )
{
uint32 shit;
uint64 item_guid, target_guid;
Charter * pCharter;
recv_data >> shit >> item_guid >> target_guid;
if(!_player->IsInWorld()) return;
PlayerPointer pTarget = _player->GetMapMgr()->GetPlayer((uint32)target_guid);
pCharter = objmgr.GetCharterByItemGuid(item_guid);
if( pCharter == NULL )
{
SendNotification("Charter cannot be found.");
return;
}
if(pTarget == 0 || pTarget->GetTeam() != _player->GetTeam() || pTarget == _player)
{
SendNotification("Target is of the wrong faction.");
return;
}
if(!pTarget->CanSignCharter(pCharter, _player))
{
SendNotification("Target player cannot sign your charter for one or more reasons.");
return;
}
SendShowSignatures(pCharter, item_guid, pTarget);
}
示例6: 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;
}
}
}
示例7: HandleInviteToGuild
void WorldSession::HandleInviteToGuild(WorldPacket & recv_data)
{
CHECK_PACKET_SIZE(recv_data, 1);
std::string inviteeName;
recv_data >> inviteeName;
PlayerPointer plyr = objmgr.GetPlayer( inviteeName.c_str() , false);
Guild *pGuild = _player->m_playerInfo->guild;
if(!plyr)
{
Guild::SendGuildCommandResult(this, GUILD_INVITE_S,inviteeName.c_str(),GUILD_PLAYER_NOT_FOUND);
return;
}
else if(!pGuild)
{
Guild::SendGuildCommandResult(this, GUILD_CREATE_S,"",GUILD_PLAYER_NOT_IN_GUILD);
return;
}
if( plyr->GetGuildId() )
{
Guild::SendGuildCommandResult(this, GUILD_INVITE_S,plyr->GetName(),ALREADY_IN_GUILD);
return;
}
else if( plyr->GetGuildInvitersGuid())
{
Guild::SendGuildCommandResult(this, GUILD_INVITE_S,plyr->GetName(),ALREADY_INVITED_TO_GUILD);
return;
}
else if(!_player->m_playerInfo->guildRank->CanPerformCommand(GR_RIGHT_INVITE))
{
Guild::SendGuildCommandResult(this, GUILD_INVITE_S,"",GUILD_PERMISSIONS);
return;
}
else if(plyr->GetTeam()!=_player->GetTeam() && _player->GetSession()->GetPermissionCount() == 0 && !sWorld.cross_faction_world)
{
Guild::SendGuildCommandResult(this, GUILD_INVITE_S,"",GUILD_NOT_ALLIED);
return;
}
else if(pGuild->GetNumMembers() >= MAX_GUILD_MEMBERS)
{
// We can't handle >= 500 members, or WoW will #132. I don't have the proper error code, so just throw the internal one.
Guild::SendGuildCommandResult(this, GUILD_INVITE_S,"",GUILD_INTERNAL);
return;
}
Guild::SendGuildCommandResult(this, GUILD_INVITE_S,inviteeName.c_str(),GUILD_U_HAVE_INVITED);
//41
WorldPacket data(SMSG_GUILD_INVITE, 100);
data << _player->GetName();
data << pGuild->GetGuildName();
plyr->GetSession()->SendPacket(&data);
plyr->SetGuildInvitersGuid( _player->GetLowGUID() );
}
示例8: 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());
}
}
示例9: 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);
}
}
示例10: AreatriggerHook
void AreatriggerHook(PlayerPointer pPlayer, uint32 triggerID)
{
if(!pPlayer)
return;
if(triggerID == ALLIANCE_RETURN ||
triggerID == HORDE_RETURN)
{
if(pPlayer->HasAura(SILITHYST_SPELL)) // if we doesn't have it, do nothing
{
pPlayer->RemoveAura(SILITHYST_SPELL);
/* Rewards */
pPlayer->CastSpell(pPlayer, TRACES_OF_SILITHYST, true);
pPlayer->m_honorPoints += REWARD_HONOR;
pPlayer->ModStanding(REWARD_REPUTATION_FACTION, REWARD_REPUTATION_VALUE);
uint32 quest = pPlayer->GetTeam() == ALLIANCE ? ALLIANCE_SILITHYST_QUEST : HORDE_SILITHYST_QUEST;
QuestLogEntry* qle = pPlayer->GetQuestLogForEntry(quest);
if(qle)
qle->SendQuestComplete();
/***********/
if(locked)
return;
silithyst_gathered[ pPlayer->GetTeam() ]++;
uint32 worldstate = pPlayer->GetTeam() == ALLIANCE ? WORLDSTATE_SILITHUS_GATHERED_ALLIANCE : WORLDSTATE_SILITHUS_GATHERED_HORDE;
pPlayer->GetMapMgr()->GetStateManager().UpdateWorldState(worldstate , silithyst_gathered[ pPlayer->GetTeam() ]);
if(silithyst_gathered[ pPlayer->GetTeam() ] >= SILITHYST_MAX)
{
locked = true; // we win, so opposite team must wait for server restart
winners = pPlayer->GetTeam();
pPlayer->GetMapMgr()->CastSpellOnPlayers(winners, CENARION_FAVOR);
pPlayer->GetMapMgr()->RemovePositiveAuraFromPlayers(winners == ALLIANCE ? HORDE : ALLIANCE, CENARION_FAVOR);
}
}
}
}
示例11: GossipHello
void GossipHello(ObjectPointer pObject, PlayerPointer plr, bool AutoSend)
{
uint32 Team = plr->GetTeam();
if(Team > 1) Team = 1;
GossipMenu *Menu;
objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), Team == 0 ? 9433 : 9750, plr);
if( pObject->GetUInt32Value(UNIT_NPC_FLAGS) & UNIT_NPC_FLAG_VENDOR )
Menu->AddItem( 0, "I would like to browse your goods.", 3 );
if( ZMg_superiorTeam == Team && ZMCityOwners != Team && !plr->HasAura( Team == 0 ? 32430 : 32431 ) )
Menu->AddItem( 0, Team == 0 ? "Give me the flag, I'll take it to the Central Tower for the glory of the Alliance!" : "Give me the flag, I'll take it to the Central Tower for the glory of the Horde!" , Team+1);
if(AutoSend)
Menu->SendTo(plr);
}
示例12: SetOwner
void Channel::SetOwner(ObjectGuid p, const char *newname)
{
PlayerPointer plr = GetPlayer(p);
if (!plr.get())
return;
uint32 sec = plr->GetSession()->GetSecurity();
if (!IsOn(p))
{
WorldPacket data;
MakeNotMember(&data);
SendToOne(&data, p);
return;
}
if (sec < SEC_GAMEMASTER && p != m_ownerGuid)
{
WorldPacket data;
MakeNotOwner(&data);
SendToOne(&data, p);
return;
}
Player *newp = sObjectMgr.GetPlayer(newname);
if (!newp || !IsOn(newp->GetObjectGuid()))
{
WorldPacket data;
MakePlayerNotFound(&data, newname);
SendToOne(&data, p);
return;
}
if (newp->GetTeam() != plr->GetTeam() && !sWorld.getConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_INTERACTION_CHANNEL))
{
WorldPacket data;
MakePlayerNotFound(&data, newname);
SendToOne(&data, p);
return;
}
if (HasFlag(CHANNEL_FLAG_GENERAL) && newp->GetSession()->GetSecurity() < SEC_GAMEMASTER)
return;
m_players[newp->GetObjectGuid()].SetModerator(true);
SetOwner(newp->GetObjectGuid());
}
示例13: DropFlag
void DropFlag(PlayerPointer pPlayer, uint32 spellID)
{
if(!pPlayer || spellID != SILITHYST_SPELL)
return;
uint32 triggerID = pPlayer->GetTeam() == ALLIANCE ? ALLIANCE_RETURN : HORDE_RETURN;
// we have to use AreaTrigger.dbc here
AreaTrigger* pAreaTrigger = AreaTriggerStorage.LookupEntry(triggerID);
if(pAreaTrigger)
if(pPlayer->CalcDistance(pAreaTrigger->x, pAreaTrigger->y, pAreaTrigger->z) > 10.0f)
{
GameObjectPointer pGo = pPlayer->GetMapMgr()->GetInterface()->SpawnGameObject(SILITHYST_MOUND, pPlayer->GetPositionX(), pPlayer->GetPositionY(), pPlayer->GetPositionZ(), 0, true, 0, 0);
if(pGo == NULL)
{
pGo->Destructor();
pGo = NULLGOB;
}
};
}
示例14: OnPlayerKilledUnit
void HonorHandler::OnPlayerKilledUnit( PlayerPointer pPlayer, UnitPointer pVictim )
{
if( pVictim == NULL || pPlayer == NULL || !pVictim->IsPlayer() || !pPlayer->IsPlayer() )
return;
if( TO_PLAYER( pVictim )->m_honorless )
return;
if( pVictim->IsPlayer() )
{
if( pPlayer->m_bg )
{
if( TO_PLAYER( pVictim )->m_bgTeam == pPlayer->m_bgTeam )
return;
// patch 2.4, players killed >50 times in battlegrounds won't be worth honor for the rest of that bg
if( TO_PLAYER(pVictim)->m_bgScore.Deaths >= 50 )
return;
}
else
{
if( pPlayer->GetTeam() == TO_PLAYER( pVictim )->GetTeam() )
return;
}
}
// Calculate points
int32 Points = CalculateHonorPointsForKill(pPlayer, pVictim);
if( Points > 0 )
{
if( pPlayer->m_bg )
{
// hackfix for battlegrounds (since the gorups there are disabled, we need to do this manually)
vector<PlayerPointer > toadd;
uint32 t = pPlayer->m_bgTeam;
toadd.reserve(15); // shouldnt have more than this
pPlayer->m_bg->Lock();
set<PlayerPointer > * s = &pPlayer->m_bg->m_players[t];
for(set<PlayerPointer >::iterator itr = s->begin(); itr != s->end(); ++itr)
{
if((*itr) == pPlayer || (*itr)->isInRange(pPlayer,40.0f))
toadd.push_back(*itr);
}
if( toadd.size() > 0 )
{
uint32 pts = Points / (uint32)toadd.size();
for(vector<PlayerPointer >::iterator vtr = toadd.begin(); vtr != toadd.end(); ++vtr)
{
AddHonorPointsToPlayer(*vtr, pts);
(*vtr)->GetAchievementInterface()->HandleAchievementCriteriaHonorableKill();
(*vtr)->GetAchievementInterface()->HandleAchievementCriteriaHonorableKillClass( pVictim->getClass() );
(*vtr)->GetAchievementInterface()->HandleAchievementCriteriaHonorableKillRace( pVictim->getRace() );
(*vtr)->m_killsToday++;
(*vtr)->m_killsLifetime++;
pPlayer->m_bg->HookOnHK(*vtr);
if(pVictim)
{
// Send PVP credit
WorldPacket data(SMSG_PVP_CREDIT, 12);
uint32 pvppoints = pts * 10;
data << pvppoints << pVictim->GetGUID() << uint32(TO_PLAYER(pVictim)->GetPVPRank());
(*vtr)->GetSession()->SendPacket(&data);
}
}
}
pPlayer->m_bg->Unlock();
}
else if(pPlayer->GetGroup())
{
Group *pGroup = pPlayer->GetGroup();
PlayerPointer gPlayer = NULLPLR;
int32 GroupPoints;
pGroup->Lock();
GroupPoints = (Points / (pGroup->MemberCount() ? pGroup->MemberCount() : 1));
GroupMembersSet::iterator gitr;
for(uint32 k = 0; k < pGroup->GetSubGroupCount(); k++)
{
for(gitr = pGroup->GetSubGroup(k)->GetGroupMembersBegin(); gitr != pGroup->GetSubGroup(k)->GetGroupMembersEnd(); ++gitr)
{
gPlayer = (*gitr)->m_loggedInPlayer;
if(gPlayer && (gPlayer == pPlayer || gPlayer->isInRange(pPlayer,100.0f))) // visible range
{
gPlayer->GetAchievementInterface()->HandleAchievementCriteriaHonorableKill();
gPlayer->GetAchievementInterface()->HandleAchievementCriteriaHonorableKillClass( pVictim->getClass() );
gPlayer->GetAchievementInterface()->HandleAchievementCriteriaHonorableKillRace( pVictim->getRace() );
gPlayer->m_killsToday++;
gPlayer->m_killsLifetime++;
if(gPlayer->m_bg)
gPlayer->m_bg->HookOnHK(gPlayer);
sHookInterface.OnHonorableKill(gPlayer, TO_PLAYER(pVictim));
AddHonorPointsToPlayer(gPlayer, GroupPoints);
if(pVictim)
//.........这里部分代码省略.........
示例15: SetMode
void Channel::SetMode(ObjectGuid p, const char *p2n, bool mod, bool set)
{
PlayerPointer plr = GetPlayer(p);
if (!plr.get())
return;
uint32 sec = plr->GetSession()->GetSecurity();
if (!IsOn(p))
{
WorldPacket data;
MakeNotMember(&data);
SendToOne(&data, p);
}
else if (!m_players[p].IsModerator() && sec < SEC_GAMEMASTER)
{
WorldPacket data;
MakeNotModerator(&data);
SendToOne(&data, p);
}
else
{
PlayerPointer newp = GetPlayer(p2n);
if (!newp.get())
{
WorldPacket data;
MakePlayerNotFound(&data, p2n);
SendToOne(&data, p);
return;
}
PlayerInfo inf = m_players[newp->GetObjectGuid()];
if (p == m_ownerGuid && newp->GetObjectGuid() == m_ownerGuid && mod)
return;
if (!IsOn(newp->GetObjectGuid()))
{
WorldPacket data;
MakePlayerNotFound(&data, p2n);
SendToOne(&data, p);
return;
}
// allow make moderator from another team only if both is GMs
// at this moment this only way to show channel post for GM from another team
if ((plr->GetSession()->GetSecurity() < SEC_GAMEMASTER || newp->GetSession()->GetSecurity() < SEC_GAMEMASTER) &&
plr->GetTeam() != newp->GetTeam() && !sWorld.getConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_INTERACTION_CHANNEL))
{
WorldPacket data;
MakePlayerNotFound(&data, p2n);
SendToOne(&data, p);
return;
}
if (m_ownerGuid == newp->GetObjectGuid() && m_ownerGuid != p)
{
WorldPacket data;
MakeNotOwner(&data);
SendToOne(&data, p);
return;
}
if (mod)
{
if (HasFlag(CHANNEL_FLAG_GENERAL) && newp->GetSession()->GetSecurity() < SEC_GAMEMASTER)
return;
SetModerator(newp->GetObjectGuid(), set);
}
else
SetMute(newp->GetObjectGuid(), set);
}
}