本文整理汇总了C++中PlayerPointer类的典型用法代码示例。如果您正苦于以下问题:C++ PlayerPointer类的具体用法?C++ PlayerPointer怎么用?C++ PlayerPointer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PlayerPointer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ResetSavedInstances
void InstanceMgr::ResetSavedInstances(PlayerPointer plr)
{
WorldPacket data(SMSG_INSTANCE_RESET, 4);
Instance * in;
InstanceMap::iterator itr;
InstanceMap * instancemap;
uint32 i;
if(!plr->IsInWorld() || plr->GetMapMgr()->GetMapInfo()->type != INSTANCE_NULL)
return;
m_mapLock.Acquire();
for(i = 0; i < NUM_MAPS; ++i)
{
if(m_instances[i] != NULL)
{
instancemap = m_instances[i];
for(itr = instancemap->begin(); itr != instancemap->end();)
{
in = itr->second;
++itr;
if ( in->m_mapInfo->type == INSTANCE_NONRAID &&
( plr->GetLowGUID() == in->m_creatorGuid ||
( plr->GetGroup() && plr->GetGroup()->GetID() == in->m_creatorGroup )))
{
if(in->m_mapMgr && in->m_mapMgr->HasPlayers())
{
plr->GetSession()->SystemMessage("Can't reset instance %u (%s) when there are still players inside!", in->m_instanceId, in->m_mapMgr->GetMapInfo()->name);
continue;
}
// <mapid> has been reset.
data << uint32(in->m_mapId);
plr->GetSession()->SendPacket(&data);
// reset groupinstanceid
if(plr->GetGroup())
plr->GetGroup()->SetGroupInstanceID(0);
// destroy the instance
_DeleteInstance(in, true);
}
}
}
}
m_mapLock.Release();
}
示例2: OnActivate
void OnActivate(PlayerPointer pPlayer)
{
if(!pPlayer)
return;
QuestLogEntry *qle = pPlayer->GetQuestLogForEntry(9582);
if(qle == NULL)
return;
// What is this ? :O To remove ?
CreaturePointer reaver = pPlayer->GetMapMgr()->GetInterface()->GetCreatureNearestCoords(pPlayer->GetPositionX(), pPlayer->GetPositionY(), pPlayer->GetPositionZ(), 17556);
if(reaver)
{
CreaturePointer reaver2 = pPlayer->GetMapMgr()->GetInterface()->SpawnCreature(17556, reaver->GetPositionX(), reaver->GetPositionY(), reaver->GetPositionZ(), reaver->GetOrientation(), true, false, 0, 0);
reaver2->Despawn(5*60*1000, 0);
reaver->Despawn(1, 5*60*1000);
}
}
示例3: CastScriptSpell
void CastScriptSpell( ScriptSpell* spell )
{
_unit->Root();
uint32 spellid = heroic ? spell->heroic_spellid : spell->normal_spellid;
UnitPointer spelltarget = NULLUNIT;
switch( spell->target )
{
case SPELL_TARGET_SELF:
{
spelltarget = _unit;
}break;
case SPELL_TARGET_GENERATE:
{
spelltarget = NULLUNIT;
}break;
case SPELL_TARGET_CURRENT_ENEMY:
{
spelltarget = _unit->GetAIInterface()->GetNextTarget();
}break;
case SPELL_TARGET_RANDOM_PLAYER:
{
spelltarget = GetRandomPlayerTarget();
}break;
case SPELL_TARGET_RANDOM_PLAYER_POSITION:
{
PlayerPointer target = GetRandomPlayerTarget();
if( target )
{
SpellPointer sp(new Spell(_unit,dbcSpell.LookupEntry( spellid ),true,NULLAURA));
SpellCastTargets targets;
targets.m_destX = target->GetPositionX();
targets.m_destY = target->GetPositionY();
targets.m_destZ = target->GetPositionZ();
targets.m_targetMask = TARGET_FLAG_DEST_LOCATION;
sp->prepare(&targets);
_unit->UnRoot();
return;
}
}break;
}
_unit->CastSpell( spelltarget , spellid, false );
_unit->UnRoot();
}
示例4: MakeNotMember
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);
}
}
}
示例5: GossipHello
void GossipHello(ObjectPointer pObject, PlayerPointer plr, bool AutoSend)
{
GossipMenu *Menu;
if(!plr->GetItemInterface()->GetItemCount(24573, true))
{
objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 9226, plr);
Menu->AddItem( 0, "Offer treat", 1);
Menu->SendTo(plr);
}
}
示例6: GossipHello
void GossipHello(ObjectPointer pObject, PlayerPointer plr, bool AutoSend)
{
GossipMenu *Menu;
objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 11224, plr);
if(plr->GetQuestLogForEntry(11142) != NULL){
Menu->AddItem( 0, GOSSIP_CASSA_CRIMSONWING, 1);
};
if(AutoSend)
Menu->SendTo(plr);
}
示例7: OnActivate
void OnActivate(PlayerPointer pPlayer)
{
QuestLogEntry *pQuest = pPlayer->GetQuestLogForEntry(10872);
if(pQuest == NULL)
return;
pQuest->SetMobCount(0, pQuest->GetMobCount(0)+1);
pQuest->SendUpdateAddKill(0);
pQuest->UpdatePlayerFields();
}
示例8: GossipSelectOption
void GossipSelectOption(ObjectPointer pObject, PlayerPointer plr, uint32 Id, uint32 IntId, const char * Code)
{
CreaturePointer pCreature = (pObject->GetTypeId()==TYPEID_UNIT)?(TO_CREATURE(pObject)):NULLCREATURE;
if(pObject==NULL)
return;
switch(IntId)
{
case 0: // Return to start
GossipHello(pCreature, plr, true);
break;
case 1: // Give Item
{
plr->CastSpell(plr, dbcSpell.LookupEntry(23122),true);
plr->Gossip_Complete();
break;
}
break;
}
}
示例9: GossipHello
void GossipHello(ObjectPointer pObject, PlayerPointer plr, bool AutoSend)
{
GossipMenu *Menu;
objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 11469, plr);
if(plr->GetQuestLogForEntry(11223))
Menu->AddItem( 0, GOSSIP_ARCHMAGE_MALIN, 1);
if(AutoSend)
Menu->SendTo(plr);
}
示例10: GetBuyPriceForItem
uint32 GetBuyPriceForItem( ItemPrototype* proto, uint32 count, PlayerPointer plr, CreaturePointer vendor )
{
int32 cost = proto->BuyPrice;
if( plr != NULL && vendor != NULL )
{
Standing plrstanding = plr->GetStandingRank( vendor->m_faction->Faction );
cost = float2int32( ceilf( float( proto->BuyPrice ) * pricemod[plrstanding] ) );
}
return cost * count;
}
示例11: OnQuestStart
void OnQuestStart( PlayerPointer mTarget, QuestLogEntry * qLogEntry)
{
if( mTarget == NULL || mTarget->GetMapMgr() == NULL || mTarget->GetMapMgr()->GetInterface() == NULL )
return;
float SSX = mTarget->GetPositionX();
float SSY = mTarget->GetPositionY();
float SSZ = mTarget->GetPositionZ();
CreaturePointer Dashel = mTarget->GetMapMgr()->GetInterface()->GetCreatureNearestCoords(SSX, SSY, SSZ, 4961);
if(Dashel == NULL)
return;
Dashel->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, 72);
Dashel->GetAIInterface()->disable_melee = false;
Dashel->GetAIInterface()->SetAllowedToEnterCombat(true);
uint32 chance = RandomUInt(100);
if(chance < 15)
{
string say = "Now you're gonna get it good, ";
say+=(TO_PLAYER(mTarget))->GetName();
say+="!";
Dashel->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, say.c_str());
}
CreaturePointer Thug1 = sEAS.SpawnCreature(mTarget, 4969, -8686.803711, 445.267792, 99.789223, 5.461184, 300000);
CreaturePointer Thug2 = sEAS.SpawnCreature(mTarget, 4969, -8675.571289, 444.162262, 99.644737, 3.834103, 300000);
}
示例12: OnQuestComplete
void OnQuestComplete( PlayerPointer mTarget, QuestLogEntry * qLogEntry)
{
if( mTarget == NULL || mTarget->GetMapMgr() == NULL || mTarget->GetMapMgr()->GetInterface() == NULL )
return;
float SSX = mTarget->GetPositionX();
float SSY = mTarget->GetPositionY();
float SSZ = mTarget->GetPositionZ();
CreaturePointer Zealot = mTarget->GetMapMgr()->GetInterface()->GetCreatureNearestCoords(SSX, SSY, SSZ, 1931);
if(Zealot == NULL)
return;
Zealot->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "I. . . I. . .don't. . .feel. . .right. . .");
sEAS.EventCastSpell(Zealot, Zealot, 3287, 3000);
Zealot->GetAIInterface()->setMoveType(11);
Zealot->GetAIInterface()->StopMovement(3000);
sEAS.CreateCustomWaypointMap(Zealot);
sEAS.WaypointCreate(Zealot, 2289.649658f, 237.001389f, 27.089531f, 1.323f, 0, 256, 0);
sEAS.WaypointCreate(Zealot, 2291.700928f, 235.561844f, 27.089531f, 1.323f, 0, 256, 0);
sEAS.WaypointCreate(Zealot, 2292.835693f, 240.636948f, 27.089531f, 1.323f, 0, 256, 0);
sEAS.WaypointCreate(Zealot, 2288.737305f, 240.503952f, 27.088022f, 1.323f, 0, 256, 0);
sEAS.WaypointCreate(Zealot, 2287.812744f, 236.320938f, 27.088022f, 1.323f, 0, 256, 0);
sEAS.WaypointCreate(Zealot, 2292.643033f, 240.513489f, 27.088022f, 1.323f, 0, 256, 0);
sEAS.WaypointCreate(Zealot, 2289.628418f, 239.908279f, 27.088022f, 1.323f, 0, 256, 0);
}
示例13: PlayerLeftGroup
void InstanceMgr::PlayerLeftGroup(Group * pGroup, PlayerPointer pPlayer)
{
// does this group own any instances? we have to kick the player out of those instances.
Instance * in;
InstanceMap::iterator itr;
InstanceMap * instancemap;
WorldPacket data(SMSG_RAID_GROUP_ONLY, 8);
uint32 i;
m_mapLock.Acquire();
for(i = 0; i < NUM_MAPS; ++i)
{
instancemap = m_instances[i];
if(instancemap)
{
for(itr = instancemap->begin(); itr != instancemap->end();)
{
in = itr->second;
++itr;
if(PlayerOwnsInstance(in,pPlayer))
{
// better make sure we're actually in that instance.. :P
if(!pPlayer->raidgrouponlysent && pPlayer->GetInstanceID() == (int32)in->m_instanceId)
{
data << uint32(60000) << uint32(1);
pPlayer->GetSession()->SendPacket(&data);
pPlayer->raidgrouponlysent=true;
sEventMgr.AddEvent(pPlayer, &Player::EjectFromInstance, EVENT_PLAYER_EJECT_FROM_INSTANCE, 60000, 1, EVENT_FLAG_DO_NOT_EXECUTE_IN_WORLD_CONTEXT);
m_mapLock.Release();
return;
}
}
}
}
}
m_mapLock.Release();
}
示例14: OnEmote
void OnEmote(PlayerPointer pPlayer, uint32 Emote, UnitPointer pUnit)
{
pUnit = pPlayer->GetMapMgr()->GetUnit(pPlayer->GetSelection());
if (!pUnit || !pUnit->isAlive() || pUnit->GetAIInterface()->GetNextTarget())
return;
// Switch For Emote Name (You do EmoteName to Script Name link).
switch(Emote)
{
case EMOTE_ONESHOT_SALUTE: // <- Its EMOTE name.
GuardsOnSalute(pPlayer, pUnit); // <- Its Link.
break;
case EMOTE_ONESHOT_KISS:
GaurdsOnKiss(pPlayer, pUnit);
break;
case EMOTE_ONESHOT_WAVE:
GuardsOnWave(pPlayer, pUnit);
break;
}
}
示例15: HandleReviveStringcommand
bool ChatHandler::HandleReviveStringcommand(const char* args, WorldSession* m_session)
{
PlayerPointer plr = objmgr.GetPlayer(args, false);
if(!plr)
{
RedSystemMessage(m_session, "Could not find player %s.", args);
return true;
}
if(plr->isDead())
{
if(plr->GetInstanceID() == m_session->GetPlayer()->GetInstanceID())
plr->RemoteRevive();
else
sEventMgr.AddEvent(plr, &Player::RemoteRevive, EVENT_PLAYER_REST, 1, 1,0);
GreenSystemMessage(m_session, "Revived player %s.", args);
} else {
GreenSystemMessage(m_session, "Player %s is not dead.", args);
}
return true;
}