本文整理汇总了C++中PlayerPointer::get方法的典型用法代码示例。如果您正苦于以下问题:C++ PlayerPointer::get方法的具体用法?C++ PlayerPointer::get怎么用?C++ PlayerPointer::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlayerPointer
的用法示例。
在下文中一共展示了PlayerPointer::get方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
}
示例2: 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());
}
示例3: Leave
void Channel::Leave(ObjectGuid p, bool send)
{
if (!IsOn(p))
{
if (send)
{
WorldPacket data;
MakeNotMember(&data);
SendToOne(&data, p);
}
}
else
{
PlayerPointer plr = GetPlayer(p);
if (send)
{
WorldPacket data;
MakeYouLeft(&data);
SendToOne(&data, p);
plr->LeftChannel(this);
data.clear();
}
bool changeowner = m_players[p].IsOwner();
m_players.erase(p);
if (m_announce && (!plr.get() || plr->GetSession()->GetSecurity() < SEC_GAMEMASTER || !sWorld.getConfig(CONFIG_BOOL_SILENTLY_GM_JOIN_TO_CHANNEL)))
{
WorldPacket data;
MakeLeft(&data, p);
SendToAll(&data);
}
LeaveNotify(p);
if (changeowner)
{
ObjectGuid newowner = !m_players.empty() ? m_players.begin()->second.player : ObjectGuid();
SetOwner(newowner);
}
}
}
示例4: Join
void Channel::Join(ObjectGuid p, const char *pass)
{
WorldPacket data;
if (IsOn(p))
{
if (!IsConstant()) // non send error message for built-in channels
{
MakePlayerAlreadyMember(&data, p);
SendToOne(&data, p);
}
return;
}
if (IsBanned(p))
{
MakeBanned(&data);
SendToOne(&data, p);
return;
}
if (m_password.length() > 0 && strcmp(pass, m_password.c_str()))
{
MakeWrongPassword(&data);
SendToOne(&data, p);
return;
}
PlayerPointer plr = GetPlayer(p);
if (m_securityLevel && (!plr.get() || plr->GetSession()->GetSecurity() < m_securityLevel))
{
MakeWrongPassword(&data);
SendToOne(&data, p);
return;
}
if (plr && plr->ToPlayer())
{
if (plr->GetGuildId() && (GetFlags() == 0x38))
return;
plr->ToPlayer()->JoinedChannel(this);
}
if (m_announce && (!plr.get() || plr->GetSession()->GetSecurity() < SEC_GAMEMASTER || !sWorld.getConfig(CONFIG_BOOL_SILENTLY_GM_JOIN_TO_CHANNEL)))
{
MakeJoined(&data, p);
SendToAll(&data);
}
data.clear();
PlayerInfo& pinfo = m_players[p];
pinfo.player = p;
pinfo.flags = 0;
MakeYouJoined(&data);
SendToOne(&data, p);
JoinNotify(p);
// if no owner first logged will become
if (HasFlag(CHANNEL_FLAG_CUSTOM) && !IsConstant() && !m_ownerGuid)
{
SetOwner(p, (m_players.size() > 1 ? true : false));
m_players[p].SetModerator(true);
}
}
示例5: 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);
}
}