本文整理汇总了C++中Map::GetCreature方法的典型用法代码示例。如果您正苦于以下问题:C++ Map::GetCreature方法的具体用法?C++ Map::GetCreature怎么用?C++ Map::GetCreature使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Map
的用法示例。
在下文中一共展示了Map::GetCreature方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Reset
void Reset()
{
uiVenganceTimer = 10000;
uiRadianceTimer = 16000;
uiHammerJusticeTimer = 25000;
uiResetTimer = 5000;
bDone = false;
Map* pMap = me->GetMap();
if (hasBeenInCombat && pMap && pMap->IsDungeon())
{
Map::PlayerList const &players = pMap->GetPlayers();
for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
{
if(itr->GetSource() && itr->GetSource()->IsAlive() && !itr->GetSource()->IsGameMaster())
return; //se almeno un player ¡§¡§ vivo, esce
}
if(instance)
{
GameObject* GO = GameObject::GetGameObject(*me, instance->GetData64(DATA_MAIN_GATE1));
if(GO)
instance->HandleGameObject(GO->GetGUID(),true);
Creature* announcer=pMap->GetCreature(instance->GetData64(DATA_ANNOUNCER));
instance->SetData(DATA_ARGENT_SOLDIER_DEFEATED,0);
announcer->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
}
me->RemoveFromWorld();
//ResetEncounter();
}
}
示例2: HandleGossipOption
bool OutdoorPvPObjectiveZM_GraveYard::HandleGossipOption(Player *plr, uint64 guid, uint32 gossipid)
{
std::map<uint64,uint32>::iterator itr = m_CreatureTypes.find(guid);
if(itr != m_CreatureTypes.end())
{
Map* map = m_PvP->GetMap();
Creature * cr = map->GetCreature(guid);
if(!cr)
return true;
// if the flag is already taken, then return
if(m_FlagCarrierGUID)
return true;
if(itr->second == ZM_ALLIANCE_FIELD_SCOUT)
{
cr->CastSpell(plr,ZM_BATTLE_STANDARD_A,true);
m_FlagCarrierGUID = plr->GetGUID();
}
else if(itr->second == ZM_HORDE_FIELD_SCOUT)
{
cr->CastSpell(plr,ZM_BATTLE_STANDARD_H,true);
m_FlagCarrierGUID = plr->GetGUID();
}
UpdateTowerState();
plr->PlayerTalkClass->CloseGossip();
return true;
}
return false;
}
示例3: GossipSelect_npc_taretha
bool GossipSelect_npc_taretha(Player *player, Creature *creature, uint32 sender, uint32 action)
{
ScriptedInstance* pInstance = (creature->GetInstanceData());
uint8 Parts = 4;
if (action == GOSSIP_ACTION_INFO_DEF+1)
{
player->ADD_GOSSIP_ITEM(0, GOSSIP_ITEM_EPOCH2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2);
player->SEND_GOSSIP_MENU(GOSSIP_ID_EPOCH2, creature->GetGUID());
}
if (action == GOSSIP_ACTION_INFO_DEF+2)
{
player->CLOSE_GOSSIP_MENU();
if (pInstance)
{
pInstance->SetData(TYPE_THRALL_EVENT, IN_PROGRESS);
pInstance->SetData(TYPE_THRALL_PART4,IN_PROGRESS);
}
Map* tmpMap = creature->GetMap();
if (!tmpMap)
return true;
if (Creature* Thrall = tmpMap->GetCreature(tmpMap->GetCreatureGUID(NPC_THRALL)))
{
if(Thrall)
CAST_AI(npc_thrall_old_hillsbradAI, Thrall->AI())->StartEscort(player, Parts);
}
}
return true;
}
示例4: DelCapturePoint
bool OutdoorPvPObjective::DelCapturePoint()
{
Map* map = m_PvP->GetMap();
if (m_CapturePoint)
{
GameObject *obj = map->GetGameObject(m_CapturePoint);
if (obj)
{
obj->SetRespawnTime(0); // not save respawn time
obj->Delete();
}
m_CapturePoint = 0;
}
if (m_CapturePointCreature)
{
Creature *cr = map->GetCreature(m_CapturePointCreature);
if (cr)
cr->AddObjectToRemoveList();
m_CapturePointCreature = 0;
}
return true;
}
示例5: HandlePlayerActivityChanged
void OutdoorPvPObjective::HandlePlayerActivityChanged(Player * plr)
{
Map* map = m_PvP->GetMap();
if(m_CapturePointCreature)
if(Creature * c = map->GetCreature(m_CapturePointCreature))
if(c->AI())
c->AI()->MoveInLineOfSight(plr);
}
示例6: NextStep
int32 NextStep(uint32 Steps)
{
Map* tmpMap = me->GetMap();
if (!tmpMap)
return true;
if (Creature* Thrall = tmpMap->GetCreature(tmpMap->GetCreatureGUID(NPC_THRALL)))
{
switch (Steps)
{
case 1:
me->SetFacingToObject(Thrall);
return 2000;
case 2:
DoScriptText(SAY_IMAGE_1, me);
return 15000;
case 3:
if (pInstance)
{
if (pInstance->GetData(TYPE_THRALL_PART1) == NOT_STARTED)
me->SummonCreature(NPC_THRALL, 2231.51f, 119.84f, 82.297f, 4.15f,TEMPSUMMON_DEAD_DESPAWN,15000);
if (pInstance->GetData(TYPE_THRALL_PART1) == DONE && pInstance->GetData(TYPE_THRALL_PART2) == NOT_STARTED)
{
me->SummonCreature(NPC_THRALL, 2063.40f, 229.512f, 64.488f, 2.18f,TEMPSUMMON_DEAD_DESPAWN,15000);
me->SummonCreature(NPC_SKARLOC_MOUNT,2047.90f, 254.85f, 62.822f, 5.94f, TEMPSUMMON_DEAD_DESPAWN, 15000);
}
if (pInstance->GetData(TYPE_THRALL_PART2) == DONE && pInstance->GetData(TYPE_THRALL_PART3) == NOT_STARTED)
me->SummonCreature(NPC_THRALL, 2486.91f, 626.357f, 58.076f, 4.66f,TEMPSUMMON_DEAD_DESPAWN,15000);
if (pInstance->GetData(TYPE_THRALL_PART3) == DONE && pInstance->GetData(TYPE_THRALL_PART4) == NOT_STARTED)
{
me->SummonCreature(NPC_THRALL, 2660.48f, 659.409f, 61.937f, 5.83f,TEMPSUMMON_DEAD_DESPAWN,15000);
if (uint64 TarethaGUID = pInstance->GetData64(DATA_TARETHA))
{
if (Unit *Taretha = me->GetUnit(TarethaGUID))
Taretha->SetStandState(UNIT_STAND_STATE_STAND);
}
}
}
return 5000;
case 4:
DoScriptText(SAY_IMAGE_2, me);
return 15000;
case 5:
me->CastSpell(me, SPELL_TELEPORT, false);
me->ForcedDespawn(1500);
default:
return 0;
}
}
return true;
}
示例7: UpdateEntry
void UpdateEntry()
{
Map* tmpMap = me->GetMap();
if (!tmpMap)
return;
if (!attackers.empty())
{
for (std::list<uint64>::iterator itr = attackers.begin(); itr != attackers.end(); ++itr)
{
if (Creature* attacker = tmpMap->GetCreature((*itr)))
{
attacker->CastSpell(attacker, SPELL_TRANSFORM, true);
switch (attacker->GetEntry())
{
case NPC_TARREN_MILL_GUARDSMAN:
attacker->UpdateEntry(NPC_INFINITE_SLAYER);
break;
case NPC_TARREN_MILL_PROTECTOR:
attacker->UpdateEntry(NPC_INFINITE_DEFILER);
switch (Wave)
{
case 2:
DoScriptText(SAY_INFINITE_AGGRO_3, attacker);
break;
case 4:
DoScriptText(SAY_INFINITE_AGGRO_1, attacker);
break;
case 6:
DoScriptText(SAY_INFINITE_AGGRO_2, attacker);
break;
}
break;
case NPC_TARREN_MILL_LOOKOUT:
attacker->UpdateEntry(NPC_INFINITE_SABOTEUR);
break;
}
attacker->SetReactState(REACT_AGGRESSIVE);
attacker->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
if (Creature* Thrall = me->GetMap()->GetCreature(ThrallGUID))
attacker->AI()->AttackStart(Thrall);
else if (Creature* Thrall = me->FindNearestCreature(17876, 150.0f, true))
attacker->AI()->AttackStart(Thrall);
}
}
}
}
示例8: SummonFlightMaster
void OutdoorPvPObjectiveEP_PWT::SummonFlightMaster(uint32 team)
{
DelCreature(EP_PWT_FLIGHTMASTER);
AddCreature(EP_PWT_FLIGHTMASTER,EP_PWT_FlightMaster.entry,team,EP_PWT_FlightMaster.map,EP_PWT_FlightMaster.x,EP_PWT_FlightMaster.y,EP_PWT_FlightMaster.z,EP_PWT_FlightMaster.o);
Map* map = m_PvP->GetMap();
Creature * c = map->GetCreature(m_Creatures[EP_PWT_FLIGHTMASTER]);
if(c)
{
GossipOption * gso = new GossipOption;
gso->Action = GOSSIP_OPTION_OUTDOORPVP;
gso->GossipId = 0;
gso->OptionText.assign("As the breeze whips straight as an arrow, let her go over Kill Devil Hill!");
gso->Id = 50;
gso->Icon = 1;
gso->NpcFlag = 0;
c->addGossipOption(*gso);
}
}
示例9: GetAliveGuardsCount
uint32 OutdoorPvPObjectiveNA::GetAliveGuardsCount()
{
uint32 cnt = 0;
for(std::map<uint32, uint64>::iterator itr = m_Creatures.begin(); itr != m_Creatures.end(); ++itr)
{
switch(itr->first)
{
case NA_NPC_GUARD_01:
case NA_NPC_GUARD_02:
case NA_NPC_GUARD_03:
case NA_NPC_GUARD_04:
case NA_NPC_GUARD_05:
case NA_NPC_GUARD_06:
case NA_NPC_GUARD_07:
case NA_NPC_GUARD_08:
case NA_NPC_GUARD_09:
case NA_NPC_GUARD_10:
case NA_NPC_GUARD_11:
case NA_NPC_GUARD_12:
case NA_NPC_GUARD_13:
case NA_NPC_GUARD_14:
case NA_NPC_GUARD_15:
{
Map* map = m_PvP->GetMap();
if(Creature * cr = map->GetCreature(itr->second))
{
if(cr->isAlive())
++cnt;
}
else if (CreatureData const * cd = objmgr.GetCreatureData(GUID_LOPART(itr->second)))
{
if(!cd->is_dead)
++cnt;
}
}
break;
default:
break;
}
}
return cnt;
}
示例10: SpawnBGCreature
void BattleGround::SpawnBGCreature(ObjectGuid guid, uint32 respawntime)
{
Map* map = GetBgMap();
Creature* obj = map->GetCreature(guid);
if (!obj)
return;
if (respawntime == 0)
{
obj->Respawn();
map->Add(obj);
}
else
{
map->Add(obj);
obj->SetRespawnDelay(respawntime);
obj->SetDeathState(JUST_DIED);
obj->RemoveCorpse();
}
}
示例11: DelCreature
bool OutdoorPvPObjective::DelCreature(uint32 type)
{
if (!m_Creatures[type])
{
sLog.outDebug("OutdoorPvP creature type %u was already deleted",type);
return false;
}
Map* map = m_PvP->GetMap();
Creature *cr = map->GetCreature(m_Creatures[type]);
if (!cr)
{
sLog.outError("OutdoorPvPObjective: Can't find creature guid: %u", GUID_LOPART(m_Creatures[type]));
return false;
}
cr->AddObjectToRemoveList();
m_CreatureTypes[m_Creatures[type]] = 0;
m_Creatures[type] = 0;
return true;
}
示例12: ResetEncounter
void ResetEncounter()
{
if(bReset)
{
if(me)
{
Map* instance = me->GetMap();
if(instance && pInstance)
{
Creature* npc = instance->GetCreature(pInstance->GetData64(DATA_ANNOUNCER));
GameObject* door = GameObject::GetGameObject(*me, pInstance->GetData64(DATA_MAIN_GATE1));
if (door)
pInstance->HandleGameObject(door->GetGUID(),true);
if(npc)
npc->RemoveFromWorld();
me->SummonCreature(35004, 742.835f, 639.134f, 411.571f, 0, TEMPSUMMON_CORPSE_DESPAWN);
me->RemoveFromWorld();
}
}
}
}
示例13: Reset
void Reset()
{
Intro = true;
Next = true;
Wave = 0;
IntroTimer = 45000;
NextTimer = 51000;
SandBreath_Timer = 25000;
ImpendingDeath_Timer = 30000;
WingBuffet_Timer = 35000;
Mda_Timer = 40000;
attackers.clear();
me->SetReactState(REACT_PASSIVE);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
Map* tmpMap = me->GetMap();
if (!tmpMap)
return;
if (Creature* Thrall = tmpMap->GetCreature(tmpMap->GetCreatureGUID(NPC_THRALL)))
ThrallGUID = Thrall->GetGUID();
}
示例14: UpdateAI
void UpdateAI(const uint32 diff)
{
if (Intro)
{
if (IntroTimer < diff)
{
if (attackers.empty())
NextWave();
Map* tmpMap = me->GetMap();
if (!tmpMap)
return;
if (!attackers.empty())
{
bool alive = false;
for (std::list<uint64>::iterator itr = attackers.begin(); itr != attackers.end(); ++itr)
{
if (Creature* attacker = tmpMap->GetCreature((*itr)))
{
if (attacker->isAlive())
{
alive = true;
break;
}
}
}
if (!alive)
{
NextWave();
NextTimer = 5000;
}
}
if (Creature* Thrall = tmpMap->GetCreature(ThrallGUID))
{
if (!Thrall->isAlive())
me->ForcedDespawn();
}
IntroTimer = 5000;
}
else
IntroTimer -= diff;
if (Next)
{
if (NextTimer <= diff)
{
NextWave();
}
else NextTimer -= diff;
}
}
//Return since we have no target
if (!UpdateVictim() )
return;
//Sand Breath
if (SandBreath_Timer < diff)
{
if (me->IsNonMeleeSpellCast(false))
me->InterruptNonMeleeSpells(false);
DoCast(me->getVictim(),SPELL_SAND_BREATH);
DoScriptText(RAND(SAY_BREATH1, SAY_BREATH2), me);
SandBreath_Timer = 25000+rand()%5000;
}
else
SandBreath_Timer -= diff;
if(ImpendingDeath_Timer < diff)
{
if(Unit *target = SelectUnit(SELECT_TARGET_RANDOM, 0 , GetSpellMaxRange(SPELL_IMPENDING_DEATH), true))
DoCast(target,SPELL_IMPENDING_DEATH);
ImpendingDeath_Timer = 30000+rand()%5000;
}
else
ImpendingDeath_Timer -= diff;
if(WingBuffet_Timer < diff)
{
DoCast(me,SPELL_WING_BUFFET);
WingBuffet_Timer = 25000+rand()%10000;
}
else
WingBuffet_Timer -= diff;
if(Mda_Timer < diff)
{
DoCast(me,SPELL_MAGIC_DISRUPTION_AURA);
Mda_Timer = 15000;
}
else
Mda_Timer -= diff;
//.........这里部分代码省略.........
示例15: ExecuteEvent
void ExclusivePoolMgr::ExecuteEvent(ExclusivePool& pool)
{
sLog.outBasic("ExclusivePool: Shuffling pool %u...", pool.poolID);
// Get the spawn points and shuffle them.
std::vector<ExclusivePoolSpot> poolSpotList;
poolSpotList.insert(poolSpotList.begin(), m_poolSpots[pool.poolID].begin(), m_poolSpots[pool.poolID].end());
std::random_shuffle(poolSpotList.begin(), poolSpotList.end());
for (std::pair<const uint32, std::list<ObjectGuid> >& poolPair : pool.m_objects)
{
// If we have run out of spawn positions we stop spawning creatures.
if (poolSpotList.empty())
break;
std::list<ObjectGuid> poolObjectList = poolPair.second;
// Check if any creatures in the current group are alive.
// If they are the group should be skipped.
bool foundAlive = false;
for (ObjectGuid currentCreature : poolObjectList)
{
const CreatureData* pData = sObjectMgr.GetCreatureData(currentCreature.GetCounter());
if (pData)
{
Map* pMap = sMapMgr.FindMap(pData->mapid);
if (pMap)
{
if (!pMap->IsLoaded(pData->posX, pData->posY))
{
MaNGOS::ObjectUpdater updater(0);
// for creature
TypeContainerVisitor<MaNGOS::ObjectUpdater, GridTypeMapContainer > grid_object_update(updater);
// for pets
TypeContainerVisitor<MaNGOS::ObjectUpdater, WorldTypeMapContainer > world_object_update(updater);
// Make sure that the creature is loaded before checking its status.
CellPair cellPair = MaNGOS::ComputeCellPair(pData->posX, pData->posY);
Cell cell(cellPair);
pMap->Visit(cell, grid_object_update);
pMap->Visit(cell, world_object_update);
}
Creature* pCreature = pMap->GetCreature(currentCreature);
if (pCreature)
{
// If the creature is alive or being looted we don't include it in the randomisation.
if (pCreature->isAlive() || pCreature->HasFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE))
{
sLog.outBasic("ExclusivePool: Skipping creature with guid %u.", currentCreature.GetCounter());
auto itr = std::find_if(poolSpotList.begin(), poolSpotList.end(),
[&](const ExclusivePoolSpot& spot)
{
if (spot.x == pData->posX && spot.y == pData->posY &&
spot.z == pData->posZ && spot.mapID == pData->mapid)
{
return true;
}
else
return false;
});
// If we found the spot on which the living creature is standing
// we remove that spot since it's occupied.
if (itr != poolSpotList.end())
{
poolSpotList.erase(itr);
foundAlive = true;
}
else
{
sLog.outBasic("ExclusivePool: Could not find the pool position for creature %u. Moving it to avoid double spawns!", currentCreature.GetCounter());
}
DespawnAllExcept(poolObjectList, currentCreature);
break;
}
}
}
}
}
// If a creature in the current group was alive we skip it.
if (foundAlive)
continue;
// Pick a random creature from the current group.
auto itr = poolObjectList.begin();
std::advance(itr, urand(0, poolObjectList.size() - 1));
// Get a spawn point for the creature.
ExclusivePoolSpot spot = poolSpotList.back();
poolSpotList.pop_back();
CreatureData& rData = sObjectMgr.mCreatureDataMap[itr->GetCounter()];
// If the creature is already in the correct spot we skip it.
if (rData.posX == spot.x && rData.posY == spot.y &&
//.........这里部分代码省略.........