本文整理汇总了C++中PlayerPointer::GetUInt32Value方法的典型用法代码示例。如果您正苦于以下问题:C++ PlayerPointer::GetUInt32Value方法的具体用法?C++ PlayerPointer::GetUInt32Value怎么用?C++ PlayerPointer::GetUInt32Value使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlayerPointer
的用法示例。
在下文中一共展示了PlayerPointer::GetUInt32Value方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ToLegionHold
bool ToLegionHold(uint32 i, AuraPointer pAura, bool apply)
{
if ( pAura == NULL || pAura->GetUnitCaster() == NULL || !pAura->GetUnitCaster()->IsPlayer() )
return true;
PlayerPointer pPlayer = TO_PLAYER( pAura->GetUnitCaster() );
CreaturePointer pJovaanCheck = pPlayer->GetMapMgr()->GetInterface()->GetCreatureNearestCoords(-3310.743896f, 2951.929199f, 171.132538f, 21633);
if ( pJovaanCheck != NULL )
return true;
QuestLogEntry *pQuest = pPlayer->GetQuestLogForEntry( 10563 );
if ( pQuest == NULL )
{
pQuest = pPlayer->GetQuestLogForEntry( 10596 );
if ( pQuest == NULL )
return true;
}
if ( apply )
{
pPlayer->SetUInt32Value( UNIT_FIELD_DISPLAYID, 20366 );
pPlayer->Root();
CreaturePointer pJovaan = sEAS.SpawnCreature( pPlayer, 21633, -3310.743896f, 2951.929199f, 171.132538f, 5.054039f, 0 ); // Spawn Jovaan
if ( pJovaan != NULL )
{
pJovaan->SetUInt64Value( UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_ATTACKABLE_2 );
if ( pJovaan->GetAIInterface() != NULL )
{
pJovaan->GetAIInterface()->SetAllowedToEnterCombat( false );
}
}
GameObjectPointer pGameObject = pPlayer->GetMapMgr()->GetInterface()->GetGameObjectNearestCoords(pPlayer->GetPositionX(), pPlayer->GetPositionY(), pPlayer->GetPositionZ(), 184834);
if ( pGameObject != NULL )
{
pGameObject->Despawn(60000);
pPlayer->UpdateNearbyGameObjects();
}
}
else
{
if ( pQuest->GetMobCount( 2 ) < pQuest->GetQuest()->required_mobcount[2] )
{
pQuest->SetMobCount( 2, pQuest->GetMobCount( 2 ) + 1 );
pQuest->SendUpdateAddKill( 2 );
pQuest->UpdatePlayerFields();
}
pPlayer->SetUInt32Value( UNIT_FIELD_DISPLAYID, pPlayer->GetUInt32Value( UNIT_FIELD_NATIVEDISPLAYID ) );
pPlayer->UnRoot();
}
return true;
}
示例2: HandleKillCommand
bool ChatHandler::HandleKillCommand(const char *args, WorldSession *m_session)
{
UnitPointer target = m_session->GetPlayer()->GetMapMgr()->GetUnit(m_session->GetPlayer()->GetSelection());
if(target == 0)
{
RedSystemMessage(m_session, "A valid selection is required.");
return true;
}
switch(target->GetTypeId())
{
case TYPEID_PLAYER:
sGMLog.writefromsession(m_session, "used kill command on PLAYER %s", TO_PLAYER( target )->GetName() );
break;
case TYPEID_UNIT:
sGMLog.writefromsession(m_session, "used kill command on CREATURE %s", TO_CREATURE( target )->GetCreatureName() ? TO_CREATURE( target )->GetCreatureName()->Name : "unknown");
break;
}
// If we're killing a player, send a message indicating a gm killed them.
if(target->IsPlayer())
{
PlayerPointer plr = TO_PLAYER(target);
m_session->GetPlayer()->DealDamage(plr, plr->GetUInt32Value(UNIT_FIELD_HEALTH),0,0,0);
//plr->SetUInt32Value(UNIT_FIELD_HEALTH, 0);
plr->KillPlayer();
BlueSystemMessageToPlr(plr, "%s killed you with a GM command.", m_session->GetPlayer()->GetName());
}
else
{
// Cast insta-kill.
SpellEntry * se = dbcSpell.LookupEntry(5);
if(se == 0) return false;
SpellCastTargets targets(target->GetGUID());
SpellPointer sp(new Spell(m_session->GetPlayer(), se, true, NULLAURA));
sp->prepare(&targets);
/* SpellEntry * se = dbcSpell.LookupEntry(20479);
if(se == 0) return false;
SpellCastTargets targets(target->GetGUID());
SpellPointer sp(new Spell(target, se, true, NULLAURA));
sp->prepare(&targets);*/
}
return true;
}
示例3: CalculateHonorPointsForKill
int32 HonorHandler::CalculateHonorPointsForKill( PlayerPointer pPlayer, UnitPointer pVictim )
{
// this sucks.. ;p
if( pVictim == NULL )
return 0;
// Suicide lol
if( pVictim == pPlayer )
return 0;
if( pVictim->GetTypeId() != TYPEID_PLAYER )
return 0;
// How dishonorable, you fiend!
if( pVictim->HasActiveAura( PLAYER_HONORLESS_TARGET_SPELL ) )
return 0;
uint32 k_level = pPlayer->GetUInt32Value( UNIT_FIELD_LEVEL );
uint32 v_level = pVictim->GetUInt32Value( UNIT_FIELD_LEVEL );
// formula guessed
int32 honor_points = 6;
if(k_level != v_level)
{
int32 diff = v_level - k_level;
honor_points += diff;
if(honor_points <= 0)
return 0;
if(honor_points >= 8)
honor_points = 8;
}
honor_points = float2int32(float(honor_points) * World::getSingleton().getRate( RATE_HONOR ));
//honor_points *= World::getSingleton().getRate( RATE_HONOR );
return honor_points;
}
示例4: GossipSelectOption
void GossipSelectOption(ObjectPointer pObject, PlayerPointer plr, uint32 Id, uint32 IntId, const char * Code)
{
GossipMenu * Menu;
switch (IntId) // switch and case 0 can be deleted, but I added it, because in future maybe we will have to expand script with more options.
{
case 0:
GossipHello(pObject, plr, true);
break;
case 1:
{
if (!plr->_HasSkillLine(164) || plr->_GetSkillLineCurrent(164, false) < 300)
{
//pCreature->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "Only skilled blacksmiths can obtain this knowledge." );
SendQuickMenu(20001);
}
else if (!plr->HasSpell(9787))
{
//pCreature->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "You need to know Weaponsmith first to learn anything more from me." );
SendQuickMenu(20002);
}
else if (plr->HasSpell(17040))
{
//pCreature->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "You already know that." );
SendQuickMenu(20003);
}
else if (plr->HasSpell(17041) || plr->HasSpell(17039) || plr->HasSpell(9788))
{
//pCreature->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "You already know one specialization." );
SendQuickMenu(20004);
}
else
{
if ( plr->GetUInt32Value(PLAYER_FIELD_COINAGE) < 600 )
{
//pCreature->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "You need 6 silver coins to learn this skill.");
SendQuickMenu(20005);
}
else
{
//pCreature->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "Make good use of this knowledge." );
SendQuickMenu(20006);
CreaturePointer Trainer = TO_CREATURE(pObject);
Trainer->CastSpell(plr, 39099, true);
int32 gold = plr->GetUInt32Value(PLAYER_FIELD_COINAGE);
plr->SetUInt32Value(PLAYER_FIELD_COINAGE, gold - 600);
}
}
}break;
case 2:
{
if (!plr->HasSpell(17040))
{
SendQuickMenu(20007);
}
else if ((plr->GetUInt32Value(PLAYER_FIELD_COINAGE) < 250000 && plr->getLevel() <= 50) ||
(plr->GetUInt32Value(PLAYER_FIELD_COINAGE) < 500000 && plr->getLevel() > 50 && plr->getLevel() <= 65) ||
(plr->GetUInt32Value(PLAYER_FIELD_COINAGE) < 1000000 && plr->getLevel() > 65))
{
SendQuickMenu(20008);
}
else
{
int32 unlearnGold;
if (plr->getLevel() <= 50)
unlearnGold = 250000;
if (plr->getLevel() > 50 && plr->getLevel() <= 65)
unlearnGold = 500000;
if (plr->getLevel() > 65)
unlearnGold = 1000000;
plr->SetUInt32Value(PLAYER_FIELD_COINAGE, plr->GetUInt32Value(PLAYER_FIELD_COINAGE) - unlearnGold);
plr->removeSpell(17040, false, false, 0);
SendQuickMenu(20009);
}
}break;
}
}
示例5: 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);
}