本文整理汇总了C++中World::GetPlayerManager方法的典型用法代码示例。如果您正苦于以下问题:C++ World::GetPlayerManager方法的具体用法?C++ World::GetPlayerManager怎么用?C++ World::GetPlayerManager使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类World
的用法示例。
在下文中一共展示了World::GetPlayerManager方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Execute
BOOL CMDWhois::Execute(const std::string &verb, Player* mobile,std::vector<std::string> &args,int subcmd)
{
World* world = World::GetPtr();
Player* targ=nullptr;
BOOL load=false;
TimeInfo tm;
if ((!args.size())||(args.size()!=1))
{
mobile->Message(MSG_ERROR,"Syntax: whois <player>.");
return false;
}
//check to see if the player is online:
targ=world->GetPlayerManager()->FindPlayer(args[0]);
if (!targ)
{
//check to see if the player can be loaded
targ=world->GetPlayerManager()->LoadPlayer(args[0]);
load=true;
}
//check to see if the load succeeded.
if (!targ)
{
mobile->Message(MSG_ERROR,"Couldn't find the specified player.");
return false;
}
//check to see if a player is trying to retrieve info on a god
if ((targ->HasAccess(RANK_GOD))&&(!mobile->HasAccess(RANK_GOD)))
{
mobile->Message(MSG_ERROR,"You can't whois the gods.");
//delete the pointer if it was allocated by load
if (load)
{
delete targ;
}
return false;
}
tm.Calculate(targ->GetOnlineTime());
mobile->Message(MSG_LIST,Capitalize(targ->GetName()+" "+targ->GetTitle()));
mobile->Message(MSG_LIST,Repeat("-",80));
mobile->Message(MSG_LIST,Capitalize(targ->GetName())+" has spent "+tm.ToString()+" online.");
mobile->Message(MSG_LIST,Repeat("-",80));
if (load)
{
delete targ;
}
return true;
}
示例2: Execute
BOOL CMDWho::Execute(const std::string &verb, Player* mobile,std::vector<std::string> &args,int subcmd)
{
World* world = World::GetPtr();
std::list<Player*>* players = nullptr;
std::list <Player*>::iterator it, itEnd;
std::stringstream st;
mobile->Write(Center(Capitalize(MUD_NAME),80)+"\n");
mobile->Write(Repeat("-",80));
players = world->GetPlayerManager()->GetPlayers();
itEnd=players->end();
for (it = players->begin(); it != itEnd; ++it)
{
if ((*it)->HasAccess(RANK_GOD))
{
st << C_BLUE << "[ADMIN] " << C_RESET;
}
st << Capitalize((*it)->GetName()) << " " << (*it)->GetTitle();
mobile->Message(MSG_LIST, st.str());
st.str("");
}
mobile->Write(Repeat("-",80));
st << MUD_NAME << " currently has " << players->size() << (players->size()==1?" user ":" users ") << "online.\n";
mobile->Write(st.str());
return true;
}
示例3: Execute
BOOL CMDMkwiz::Execute(const std::string &verb, Player* mobile,std::vector<std::string> &args,int subcmd)
{
World* world = World::GetPtr();
PlayerManager* manager = world->GetPlayerManager();
Player* target = nullptr;
if (!args.size())
{
mobile->Message(MSG_ERROR,"You must specify the person that you would like to make a wizard.\n");
return false;
}
target=manager->FindPlayer(args[0]);
if (target==mobile)
{
mobile->Message(MSG_ERROR,"You may not make yourself a wizard.");
return false;
}
if (target==nullptr)
{
mobile->Message(MSG_ERROR,"That person couldn't be found.");
return false;
}
if (BitIsSet(target->GetRank(),RANK_GOD))
{
mobile->Message(MSG_ERROR,"That person is already a wizard.");
return false;
}
target->SetRank(BitSet(mobile->GetRank(), RANK_PLAYTESTER|RANK_NEWBIEHELPER|RANK_BUILDER|RANK_ADMIN|RANK_GOD));
target->Message(MSG_INFO,"You suddenly feel more wizardly.");
mobile->Message(MSG_INFO, Capitalize(target->GetName())+" has been made a wizard.");
return true;
}