本文整理汇总了C++中PlayerPointer::getRace方法的典型用法代码示例。如果您正苦于以下问题:C++ PlayerPointer::getRace方法的具体用法?C++ PlayerPointer::getRace怎么用?C++ PlayerPointer::getRace使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlayerPointer
的用法示例。
在下文中一共展示了PlayerPointer::getRace方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnActivate
void OnActivate(PlayerPointer pPlayer)
{
if(pPlayer->getRace() == RACE_TAUREN || pPlayer->getRace() == RACE_TROLL || pPlayer->getRace() == RACE_ORC || pPlayer->getRace() == RACE_UNDEAD || pPlayer->getRace() == RACE_BLOODELF )
{
pPlayer->SafeTeleport(530, 0, 10021.254883f, -7014.893066f, 49.717690f, 4.00532f); // teleports to Silvermoon
}
else
{
pPlayer->BroadcastMessage("You are not alowed to use this orb");
}
}
示例2: DumpStats
void StatDumper::DumpStats()
{
if( Filename[0] == NULL )
return;
FILE* f = fopen( Filename, "w" );
if( !f )
return;
Log.Debug( "StatDumper", "Writing %s", Filename );
// Dump Header
fprintf(f, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
fprintf(f, "<?xml-stylesheet type=\"text/xsl\" href=\"server_stats.xsl\"?>\n");
fprintf(f, "<serverpage>\n");
fprintf(f, " <status>\n");
uint32 races[RACE_DRAENEI+1];
uint32 classes[DRUID+1];
memset(&races[0], 0, sizeof(uint32)*(RACE_DRAENEI+1));
memset(&classes[0], 0, sizeof(uint32)*(RACE_DRAENEI+1));
std::deque<PlayerPointer> gms;
{
// Dump server information.
#ifdef WIN32
// fprintf(f, " <platform>%s r%u/%s-Win-%s </platform>\n", sWorld.GetCoreName(), BUILD_REVISION, CONFIG, ARCH); GetCoreName function is not implemented yet on core
fprintf(f, " <platform>%s r%u/%s-Win-%s </platform>\n", "WowEmu", BUILD_REVISION, CONFIG, ARCH);
#else
// fprintf(f, " <platform>%s r%u/%s-%s </platform>\n", sWorld.GetCoreName(), BUILD_REVISION, PLATFORM_TEXT, ARCH); GetCoreName function is not implemented yet on core
fprintf(f, " <platform>%s r%u/%s-%s </platform>\n", "WowEmu", BUILD_REVISION, PLATFORM_TEXT, ARCH);
#endif
char uptime[80];
GenerateUptimeString(uptime);
float AvgLat;
uint32 GMCount;
int gm = 0;
int count = 0;
int avg = 0;
// lock players reader
objmgr._playerslock.AcquireReadLock();
HM_NAMESPACE::hash_map<uint32, PlayerPointer>::const_iterator itr;
for (itr = objmgr._players.begin(); itr != objmgr._players.end(); itr++)
{
if(itr->second->GetSession() && itr->second->IsInWorld())
{
count++;
avg += itr->second->GetSession()->GetLatency();
if(itr->second->GetSession()->GetPermissionCount())
{
gm++;
gms.push_back(itr->second);
}
classes[itr->second->getClass()]++;
races[itr->second->getRace()]++;
}
}
objmgr._playerslock.ReleaseReadLock();
AvgLat = count ? (float)((float)avg / (float)count) : 0;
GMCount = gm;
fprintf(f, " <uptime>%s</uptime>\n", uptime);
fprintf(f, " <oplayers>%u</oplayers>\n", (unsigned int)(sWorld.AlliancePlayers + sWorld.HordePlayers));
fprintf(f, " <cpu>%2.2f</cpu>\n", GetCPUUsage());
fprintf(f, " <qplayers>%u</qplayers>\n", (unsigned int)sWorld.GetQueueCount());
fprintf(f, " <ram>%.3f</ram>\n", GetRAMUsage());
fprintf(f, " <avglat>%.3f</avglat>\n", AvgLat);
fprintf(f, " <threads>%u</threads>\n", (unsigned int)ThreadPool.GetActiveThreadCount());
fprintf(f, " <fthreads>%u</fthreads>\n", (unsigned int)ThreadPool.GetFreeThreadCount());
time_t t = (time_t)UNIXTIME;
fprintf(f, " <gmcount>%u</gmcount>\n", (unsigned int)GMCount);
fprintf(f, " <lastupdate>%s</lastupdate>\n", asctime(localtime(&t)));
fprintf(f, " <alliance>%u</alliance>\n", (unsigned int)sWorld.AlliancePlayers);
fprintf(f, " <horde>%u</horde>\n", (unsigned int)sWorld.HordePlayers);
fprintf(f, " <acceptedconns>%u</acceptedconns>\n", (unsigned int)sWorld.mAcceptedConnections);
fprintf(f, " <peakcount>%u</peakcount>\n", (unsigned int)sWorld.PeakSessionCount);
fprintf(f, " <wdbquerysize>%u</wdbquerysize>\n", WorldDatabase.GetQueueSize());
fprintf(f, " <cdbquerysize>%u</cdbquerysize>\n", CharacterDatabase.GetQueueSize());
}
fprintf(f, " </status>\n");
static const char * race_names[RACE_DRAENEI+1] = {
NULL,
"human",
"orc",
"dwarf",
"nightelf",
"undead",
"tauren",
"gnome",
"troll",
NULL,
"bloodelf",
"draenei",
};
static const char * class_names[DRUID+1] = {
NULL,
"warrior",
"paladin",
//.........这里部分代码省略.........