本文整理汇总了C++中PlayerPointer::getGender方法的典型用法代码示例。如果您正苦于以下问题:C++ PlayerPointer::getGender方法的具体用法?C++ PlayerPointer::getGender怎么用?C++ PlayerPointer::getGender使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlayerPointer
的用法示例。
在下文中一共展示了PlayerPointer::getGender方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GossipSelectOption
void InnkeeperGossip::GossipSelectOption(ObjectPointer pObject, PlayerPointer Plr, uint32 Id, uint32 IntId, const char * Code)
{
CreaturePointer pCreature = (pObject->GetTypeId()==TYPEID_UNIT)?(TO_CREATURE(pObject)):NULLCREATURE;
if(pCreature==NULLCREATURE)
return;
switch(IntId)
{
case 1: // VENDOR
Plr->GetSession()->SendInventoryList(pCreature);
break;
case 2: // BINDER
Plr->GetSession()->SendInnkeeperBind(pCreature);
break;
case 3: // WHAT CAN I DO ?
// Prepare second menu
GossipMenu *Menu;
objmgr.CreateGossipMenuForPlayer(&Menu, pCreature->GetGUID(), 1853, Plr);
Menu->AddItem(5, "Make this inn your home.", 2);
Menu->SendTo(Plr);
break;
case 4: // EVENT OF HALLOWEEN
if(!Plr->HasAura(SPELL_TRICK_OR_TREATED))
{
pCreature->CastSpell(Plr, SPELL_TRICK_OR_TREATED, true);
// either trick or treat, 50% chance
if(rand()%2)
{
Plr->CastSpell(Plr, SPELL_TREAT, true);
}
else
{
int32 trickspell=0;
switch (rand()%9)
{
case 0:
trickspell=24753; // cannot cast, random 30sec
break;
case 1:
trickspell=24713; // lepper gnome costume
break;
case 2:
if(Plr->getGender() == 0){
trickspell=24735; // male ghost costume
}else{
trickspell=24736; // female ghostcostume
}
break;
case 3:
if(Plr->getGender() == 0){
trickspell=24711; // male ninja costume
}else{
trickspell=24710; // female ninja costume
}
break;
case 4:
if(Plr->getGender() == 0){
trickspell=24708; // male pirate costume
}else{
trickspell=24709; // female pirate costume
}
break;
case 5:
trickspell=24723; // skeleton costume
break;
}
pCreature->CastSpell(Plr, trickspell, true);
}
}
Plr->Gossip_Complete();
break;
}
}
示例2: DumpStats
//.........这里部分代码省略.........
fprintf(f, " <statsummary>\n");
uint32 i;
for(i = 0; i <= RACE_DRAENEI; ++i)
{
if( race_names[i] != NULL )
fprintf(f, " <%s>%u</%s>\n", race_names[i], races[i], race_names[i]);
}
for(i = 0; i <= DRUID; ++i)
{
if( class_names[i] != NULL )
fprintf(f, " <%s>%u</%s>\n", class_names[i], classes[i], class_names[i]);
}
fprintf(f, " </statsummary>\n");
PlayerPointer plr;
uint32 t = (uint32)time(NULL);
char otime[100];
{
fprintf(f, " <instances>\n");
// need a big buffer..
static char buf[500000];
memset(buf, 0, 500000);
// Dump Instance Information
//sWorldCreator.BuildXMLStats(buf);
sInstanceMgr.BuildXMLStats(buf);
fprintf(f, buf);
fprintf(f, " </instances>\n");
}
{
// GM Information
fprintf(f, " <gms>\n");
while(!gms.empty())
{
plr = gms.front();
gms.pop_front();
if(!plr->bGMTagOn)
continue;
FillOnlineTime(t - plr->OnlineTime, otime);
fprintf(f, " <gmplr>\n");
fprintf(f, " <name>%s</name>\n", plr->GetName());
fprintf(f, " <race>%u</race>\n", plr->getRace());
fprintf(f, " <class>%u</class>\n", (unsigned int)plr->getClass());
fprintf(f, " <gender>%u</gender>\n", (unsigned int)plr->getGender());
fprintf(f, " <pvprank>%u</pvprank>\n", (unsigned int)plr->GetPVPRank());
fprintf(f, " <level>%u</level>\n", (unsigned int)plr->GetUInt32Value(UNIT_FIELD_LEVEL));
fprintf(f, " <map>%u</map>\n", (unsigned int)plr->GetMapId());
fprintf(f, " <areaid>%u</areaid>\n", (unsigned int)plr->GetAreaID());
fprintf(f, " <ontime>%s</ontime>\n", otime);
fprintf(f, " <latency>%u</latency>\n", (unsigned int)plr->GetSession()->GetLatency());
fprintf(f, " <permissions>%s</permissions>\n", plr->GetSession()->GetPermissions());
fprintf(f, " </gmplr>\n");
}
fprintf(f, " </gms>\n");
}
{
fprintf(f, " <sessions>\n");
// Dump Player Information
objmgr._playerslock.AcquireReadLock();
HM_NAMESPACE::hash_map<uint32, PlayerPointer>::const_iterator itr;
for (itr = objmgr._players.begin(); itr != objmgr._players.end(); itr++)
{
plr = itr->second;
if(itr->second->GetSession() && itr->second->IsInWorld())
{
FillOnlineTime(t - plr->OnlineTime, otime);
fprintf(f, " <plr>\n");
fprintf(f, " <name>%s</name>\n", plr->GetName());
fprintf(f, " <race>%u</race>\n", (unsigned int)plr->getRace());
fprintf(f, " <class>%u</class>\n", (unsigned int)plr->getClass());
fprintf(f, " <gender>%u</gender>\n", (unsigned int)plr->getGender());
fprintf(f, " <pvprank>%u</pvprank>\n", (unsigned int)plr->GetPVPRank());
fprintf(f, " <level>%u</level>\n", (unsigned int)plr->GetUInt32Value(UNIT_FIELD_LEVEL));
fprintf(f, " <map>%u</map>\n", (unsigned int)plr->GetMapId());
fprintf(f, " <areaid>%u</areaid>\n", (unsigned int)plr->GetAreaID());
//requested by Zdarkside for he's online map. I hope it does not scre up any parser. If so, then make a better one :P
fprintf(f, " <xpos>%f</xpos>\n", plr->GetPositionX ());
fprintf(f, " <ypos>%f</ypos>\n", plr->GetPositionY());
fprintf(f, " <ontime>%s</ontime>\n", otime);
fprintf(f, " <latency>%u</latency>\n", (unsigned int)plr->GetSession()->GetLatency());
fprintf(f, " </plr>\n");
if(plr->GetSession()->GetPermissionCount() > 0)
gms.push_back(plr);
}
}
objmgr._playerslock.ReleaseReadLock();
fprintf(f, " </sessions>\n");
}
fprintf(f, "</serverpage>\n");
fclose(f);
}