本文整理汇总了C++中CreaturePointer类的典型用法代码示例。如果您正苦于以下问题:C++ CreaturePointer类的具体用法?C++ CreaturePointer怎么用?C++ CreaturePointer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CreaturePointer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnQuestComplete
void OnQuestComplete(PlayerPointer pPlayer, QuestLogEntry *qLogEntry)
{
if (!pPlayer)
return;
GameObjectPointer obj = NULLGOB;
for(uint8 i = 0; i < 9; i++)
{
obj = sEAS.SpawnGameobject(pPlayer, GO_MEAT, MeatSpawnPoints[i].x, MeatSpawnPoints[i].y, MeatSpawnPoints[i].z, MeatSpawnPoints[i].o, 1, 0, 0, 0, 0);
sEAS.GameobjectDelete(obj, 2*60*1000);
}
for(uint8 i = 0; i < 5; i++)
{
obj = sEAS.SpawnGameobject(pPlayer, GO_BOTTLE, BottleSpawnPoints[i].x, BottleSpawnPoints[i].y, BottleSpawnPoints[i].z, BottleSpawnPoints[i].o, 1, 0, 0, 0, 0);
sEAS.GameobjectDelete(obj, 2*60*1000);
}
for(uint8 i = 0; i < 3; i++)
{
obj = sEAS.SpawnGameobject(pPlayer, GO_BREAD, BreadSpawnPoints[i].x, BreadSpawnPoints[i].y, BreadSpawnPoints[i].z, BreadSpawnPoints[i].o, 1, 0, 0, 0, 0);
sEAS.GameobjectDelete(obj, 2*60*1000);
}
CreaturePointer Negolash = sEAS.SpawnCreature(pPlayer, 1494, -14657.400391, 155.115997, 4.081050, 0.353429);
Negolash->GetAIInterface()->MoveTo(-14647.526367, 143.710052, 1.164550, 1.909);
}
示例2: GossipSelectOption
void GossipSelectOption(ObjectPointer pObject, PlayerPointer plr, uint32 Id, uint32 IntId, const char * EnteredCode)
{
if(!plr)
return;
CreaturePointer doctor = TO_CREATURE(pObject);
if (doctor == NULL)
return;
switch (IntId)
{
case 0:
GossipHello(pObject, plr, true);
break;
case 1:
{
plr->GetItemInterface()->RemoveItemAmt(2799, 1);
doctor->CastSpell(doctor, dbcSpell.LookupEntry(12380), true);
if( !plr || !plr->GetMapMgr() || !plr->GetMapMgr()->GetInterface() )
return;
CreaturePointer firstenemy = sEAS.SpawnCreature(plr, 1511, -13770.5, -6.79, 42.8, 5.7 , 0);
firstenemy->GetAIInterface()->MoveTo(-13727.8, -26.2, 46.15, 4.07);
firstenemy->Despawn(10*60*1000, 0);
}break;
}
}
示例3: atoi
bool ChatHandler::HandleNPCFlagCommand(const char* args, WorldSession *m_session)
{
if (!*args)
return false;
uint32 npcFlags = (uint32) atoi((char*)args);
uint64 guid = m_session->GetPlayer()->GetSelection();
if (guid == 0)
{
SystemMessage(m_session, "No selection.");
return true;
}
CreaturePointer pCreature = m_session->GetPlayer()->GetMapMgr()->GetCreature(GET_LOWGUID_PART(guid));
if(!pCreature)
{
SystemMessage(m_session, "You should select a creature.");
return true;
}
pCreature->SetUInt32Value(UNIT_NPC_FLAGS , npcFlags);
pCreature->SaveToDB();
SystemMessage(m_session, "Value saved, you may need to rejoin or clean your client cache.");
return true;
}
示例4: ShatteringStomp
bool ShatteringStomp(uint32 i, SpellPointer pSpell)
{
if( !pSpell->u_caster )
return false;
UnitPointer _unit = pSpell->u_caster;
CreaturePointer golem = NULLCREATURE;
for(unordered_set<ObjectPointer>::iterator itr = _unit->GetInRangeSetBegin(); itr != _unit->GetInRangeSetEnd(); ++itr)
{
if( (*itr) && (*itr)->IsCreature() )
{
golem = TO_CREATURE((*itr));
if( golem->isAlive() && golem->creature_info && golem->creature_info->Id == MOLTEN_GOLEM_ENTRY )
{
uint32 spellid = pSpell->m_spellInfo->Id == 59529 ? 59527 : 52429;
CreaturePointer Golem = TO_CREATURE( (*itr) );
Golem->CastSpell( Golem, spellid, true );
for( uint8 i=0; i<7; i++ )
Golem->SchoolImmunityList[i] = 0;
_unit->DealDamage( Golem, Golem->GetHealth(),0,0,0);
}
}
}
return true;
}
示例5: GossipHello
void InnkeeperGossip::GossipHello(ObjectPointer pObject, PlayerPointer Plr, bool AutoSend)
{
CreaturePointer pCreature = (pObject->GetTypeId()==TYPEID_UNIT)?(TO_CREATURE(pObject)):NULLCREATURE;
if(pCreature==NULLCREATURE)
return;
GossipMenu *Menu;
uint32 TextID = 820;
uint32 Text = objmgr.GetGossipTextForNpc(pCreature->GetEntry());
if(Text != 0)
{
GossipText * text = NpcTextStorage.LookupEntry(Text);
if(text != 0)
TextID = Text;
}
objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), TextID, Plr);
#ifdef EVENT_HALLOWEEN
if(!Plr->HasAura(SPELL_TRICK_OR_TREATED))
Menu->AddItem( 0, TRICK_OR_TREAT, 4 );
#endif
if( pObject->GetUInt32Value(UNIT_NPC_FLAGS) & UNIT_NPC_FLAG_VENDOR )
Menu->AddItem( 1, "I would like to browse your goods.", 1 );
Menu->AddItem( 5, "Make this inn your home.", 2 );
Menu->AddItem( 0, "What can I do at an inn?", 3 );
if(AutoSend)
Menu->SendTo(Plr);
}
示例6: GossipSelectOption
void GossipSelectOption(ObjectPointer pObject, PlayerPointer plr, uint32 Id, uint32 IntId, const char * EnteredCode)
{
if(!plr)
return;
CreaturePointer spirit = TO_CREATURE(pObject);
if (spirit == NULL)
return;
switch (IntId)
{
case 0:
GossipHello(pObject, plr, true);
break;
case 1:
{
QuestLogEntry *en = plr->GetQuestLogForEntry(3520);
if(en && en->GetMobCount(0) < en->GetQuest()->required_mobcount[0])
{
en->SetMobCount(0, en->GetMobCount(0) + 1);
en->SendUpdateAddKill(0);
en->UpdatePlayerFields();
}
if(!spirit)
return;
spirit->Despawn(1, 0);
return;
}
}
}
示例7: BlueSystemMessage
bool ChatHandler::HandleGOExport(const char * args, WorldSession * m_session)
{
/*if(!m_session->GetPlayer()->m_GM_SelectedGO)
return false;
std::stringstream name;
if (*args)
{
name << "GO_" << args << ".sql";
}
else
{
name << "GO_" << m_session->GetPlayer()->m_GM_SelectedGO->GetEntry() << ".sql";
}
m_session->GetPlayer()->m_GM_SelectedGO->SaveToFile(name);
BlueSystemMessage(m_session, "Go saved to: %s", name.str().c_str());*/
CreaturePointer pCreature = getSelectedCreature(m_session, true);
if(!pCreature) return true;
WorldDatabase.WaitExecute("INSERT INTO creature_names_export SELECT * FROM creature_names WHERE entry = %u", pCreature->GetEntry());
WorldDatabase.WaitExecute("INSERT INTO creature_proto_export SELECT * FROM creature_proto WHERE entry = %u", pCreature->GetEntry());
WorldDatabase.WaitExecute("INSERT INTO vendors_export SELECT * FROM vendors WHERE entry = %u", pCreature->GetEntry());
QueryResult * qr = WorldDatabase.Query("SELECT * FROM vendors WHERE entry = %u", pCreature->GetEntry());
if(qr != NULL)
{
do
{
WorldDatabase.WaitExecute("INSERT INTO items_export SELECT * FROM items WHERE entry = %u", qr->Fetch()[1].GetUInt32());
} while (qr->NextRow());
delete qr;
}
return true;
}
示例8: 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);
}
示例9: 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);
}
示例10: Temper
bool Temper(uint32 i, SpellPointer pSpell)
{
if( !pSpell->u_caster )
return false;
UnitPointer _unit = pSpell->u_caster;
//summon several Molten Golem's
for( uint8 i=0; i<GOLEMS_COUNT; i++ )
{
CreatureProto *cp = CreatureProtoStorage.LookupEntry(MOLTEN_GOLEM_ENTRY);
CreatureInfo *ci = CreatureNameStorage.LookupEntry(MOLTEN_GOLEM_ENTRY);
CreaturePointer c = NULLCREATURE;
if (cp && ci)
{
c = _unit->GetMapMgr()->CreateCreature( MOLTEN_GOLEM_ENTRY );
if (c)
{
c->Load(cp, _unit->GetPositionX(), _unit->GetPositionY(), _unit->GetPositionZ(), 0.0f);
c->PushToWorld(_unit->GetMapMgr());
c->SetUInt64Value( UNIT_FIELD_SUMMONEDBY, _unit->GetGUID() );
}
}
}
return true;
}
示例11: Carcass
bool Carcass(uint32 i, SpellPointer pSpell) // Becoming a Shadoweave Tailor
{
if(!pSpell->u_caster->IsPlayer())
return true;
PlayerPointer pPlayer = TO_PLAYER(pSpell->u_caster);
QuestLogEntry *pQuest = pPlayer->GetQuestLogForEntry( 10804 );
CreaturePointer NetherDrake = pPlayer->GetMapMgr()->GetInterface()->GetCreatureNearestCoords(pPlayer->GetPositionX(), pPlayer->GetPositionY(), pPlayer->GetPositionZ(), 21648);
GameObjectPointer FlayerCarcass = pPlayer->GetMapMgr()->GetInterface()->GetGameObjectNearestCoords(pPlayer->GetPositionX(), pPlayer->GetPositionY(), pPlayer->GetPositionZ(), 185155);
if ( FlayerCarcass == NULLGOB )
{
FlayerCarcass = sEAS.SpawnGameobject(pPlayer, 185155, pPlayer->GetPositionX(), pPlayer->GetPositionY(), pPlayer->GetPositionZ(), 0, 1, 0, 0, 0, 0);
FlayerCarcass->Despawn(60000);
}
if ( NetherDrake == NULL )
return true;
if ( NetherDrake->HasActiveAura(38502) )
return true;
if( pQuest!=NULL && pQuest->GetMobCount( 0 ) < pQuest->GetQuest()->required_mobcount[0] )
{
NetherDrake->CastSpell(NetherDrake, dbcSpell.LookupEntry( 38502 ), true);
NetherDrake->GetAIInterface()->m_moveFly = true;
NetherDrake->GetAIInterface()->MoveTo(pPlayer->GetPositionX(), pPlayer->GetPositionY()+2, pPlayer->GetPositionZ(), 0);
pQuest->SetMobCount( 0, pQuest->GetMobCount( 0 )+1);
pQuest->SendUpdateAddKill( 0 );
pQuest->UpdatePlayerFields();
}
return true;
}
示例12: getSelectedCreature
bool ChatHandler::HandleNpcComeCommand(const char* args, WorldSession* m_session)
{
// moves npc to players location
PlayerPointer plr = m_session->GetPlayer();
CreaturePointer crt = getSelectedCreature(m_session, true);
if(!crt) return true;
crt->GetAIInterface()->MoveTo(plr->GetPositionX(), plr->GetPositionY(), plr->GetPositionZ(), plr->GetOrientation());
return true;
}
示例13: 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;
}
示例14: OnLootTaken
void OnLootTaken(PlayerPointer pLooter, ItemPrototype *pItemInfo)
{
float SSX = pLooter->GetPositionX();
float SSY = pLooter->GetPositionY();
float SSZ = pLooter->GetPositionZ();
float SSO = pLooter->GetOrientation();
CreaturePointer NewCreature = pLooter->GetMapMgr()->GetInterface()->SpawnCreature(11120, SSX, SSY, SSZ, SSO, true, false, 0, 0);
if ( NewCreature != NULL )
NewCreature->Despawn(600000, 0);
}
示例15: OnActivate
void OnActivate(PlayerPointer pPlayer)
{
float SSX = pPlayer->GetPositionX();
float SSY = pPlayer->GetPositionY();
float SSZ = pPlayer->GetPositionZ();
float SSO = pPlayer->GetOrientation();
CreaturePointer NewCreature = pPlayer->GetMapMgr()->GetInterface()->SpawnCreature(10882, SSX, SSY, SSZ, SSO, true, false, 0, 0);
if ( NewCreature != NULL )
NewCreature->Despawn(600000, 0);
}