本文整理汇总了C++中GuidSet::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ GuidSet::begin方法的具体用法?C++ GuidSet::begin怎么用?C++ GuidSet::begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GuidSet
的用法示例。
在下文中一共展示了GuidSet::begin方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Update
void Update(uint32 diff) override
{
if (CageTimer)
{
if (CageTimer <= diff)
{
Creature* Magtheridon = instance->GetCreature(MagtheridonGUID);
if (Magtheridon && Magtheridon->IsAlive())
{
Magtheridon->ClearUnitState(UNIT_STATE_STUNNED);
Magtheridon->AI()->AttackStart(Magtheridon->SelectNearestTarget(999));
}
CageTimer = 0;
} else CageTimer -= diff;
}
if (RespawnTimer)
{
if (RespawnTimer <= diff)
{
for (GuidSet::const_iterator i = ChannelerGUID.begin(); i != ChannelerGUID.end(); ++i)
{
if (Creature* Channeler = instance->GetCreature(*i))
{
if (Channeler->IsAlive())
Channeler->AI()->EnterEvadeMode();
else
Channeler->Respawn();
}
}
RespawnTimer = 0;
} else RespawnTimer -= diff;
}
}
示例2: ActivatePrisoners
void ActivatePrisoners(GuidSet const& prisoners)
{
for (GuidSet::const_iterator i = prisoners.begin(); i != prisoners.end(); ++i)
if (Creature* prisoner = instance->GetCreature(*i))
{
prisoner->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_NON_ATTACKABLE);
prisoner->SetInCombatWithZone();
}
}
示例3: DespawnIntroCreatures
void DespawnIntroCreatures()
{
if (m_pInstance)
{
for (GuidSet::const_iterator itr = m_lIntroMobsSet.begin(); itr != m_lIntroMobsSet.end(); ++itr)
{
if (Creature* pCreature = m_pInstance->instance->GetCreature(*itr))
pCreature->ForcedDespawn();
}
}
m_lIntroMobsSet.clear();
}
示例4: RemovePassenger
bool Transport::RemovePassenger(WorldObject* passenger)
{
GetTransportKit()->RemovePassenger(passenger);
if (passenger->isType(TYPEMASK_UNIT))
{
GuidSet groupPetsCopy = ((Unit*)passenger)->GetPets();
if (!groupPetsCopy.empty())
{
for (GuidSet::const_iterator itr = groupPetsCopy.begin(); itr != groupPetsCopy.end(); ++itr)
if (Pet* pPet = GetMap()->GetPet(*itr))
if (pPet && pPet->IsInWorld())
GetTransportKit()->RemovePassenger(pPet);
}
}
return true;
}
示例5: HandleObjectiveComplete
void WorldPvPNA::HandleObjectiveComplete(GuidSet m_sPlayersSet, uint32 uiEventId)
{
if (uiEventId == EVENT_HALAA_BANNER_WIN_ALLIANCE || uiEventId == EVENT_HALAA_BANNER_WIN_HORDE)
{
for (GuidSet::iterator itr = m_sPlayersSet.begin(); itr != m_sPlayersSet.end(); ++itr)
{
if (!(*itr))
continue;
Player* pPlayer = sObjectMgr.GetPlayer(*itr);
if (!pPlayer)
continue;
pPlayer->KilledMonsterCredit(NPC_HALAA_COMBATANT);
}
}
}
示例6: DespawnAdds
void DespawnAdds()
{
if (m_pInstance)
{
for (GuidSet::const_iterator itr = m_lAddsSet.begin(); itr != m_lAddsSet.end(); ++itr)
{
if (Creature* pCreature = m_pInstance->instance->GetCreature(*itr))
{
if (pCreature->isAlive())
{
pCreature->AI()->EnterEvadeMode();
pCreature->ForcedDespawn(15000);
}
}
}
}
m_lAddsSet.clear();
}
示例7: AddOutOfRangeGUID
void UpdateData::AddOutOfRangeGUID(GuidSet& guids)
{
m_outOfRangeGUIDs.insert(guids.begin(), guids.end());
}
示例8: ResetPrisoners
void ResetPrisoners(GuidSet const& prisoners)
{
for (GuidSet::const_iterator i = prisoners.begin(); i != prisoners.end(); ++i)
if (Creature* prisoner = instance->GetCreature(*i))
ResetPrisoner(prisoner);
}
示例9: SetData
void SetData(uint32 type, uint32 data) override
{
switch (type)
{
case DATA_MAGTHERIDON_EVENT:
m_auiEncounter[0] = data;
if (data == NOT_STARTED)
RespawnTimer = 10000;
if (data != IN_PROGRESS)
HandleGameObject(DoorGUID, true);
break;
case DATA_CHANNELER_EVENT:
switch (data)
{
case NOT_STARTED: // Reset all channelers once one is reset.
if (m_auiEncounter[1] != NOT_STARTED)
{
m_auiEncounter[1] = NOT_STARTED;
for (GuidSet::const_iterator i = ChannelerGUID.begin(); i != ChannelerGUID.end(); ++i)
{
if (Creature* Channeler = instance->GetCreature(*i))
{
if (Channeler->IsAlive())
Channeler->AI()->EnterEvadeMode();
else
Channeler->Respawn();
}
}
CageTimer = 0;
HandleGameObject(DoorGUID, true);
}
break;
case IN_PROGRESS: // Event start.
if (m_auiEncounter[1] != IN_PROGRESS)
{
m_auiEncounter[1] = IN_PROGRESS;
// Let all five channelers aggro.
for (GuidSet::const_iterator i = ChannelerGUID.begin(); i != ChannelerGUID.end(); ++i)
{
Creature* Channeler = instance->GetCreature(*i);
if (Channeler && Channeler->IsAlive())
Channeler->AI()->AttackStart(Channeler->SelectNearestTarget(999));
}
// Release Magtheridon after two minutes.
Creature* Magtheridon = instance->GetCreature(MagtheridonGUID);
if (Magtheridon && Magtheridon->IsAlive())
{
Magtheridon->TextEmote(EMOTE_BONDS_WEAKEN);
CageTimer = 120000;
}
HandleGameObject(DoorGUID, false);
}
break;
case DONE: // Add buff and check if all channelers are dead.
for (GuidSet::const_iterator i = ChannelerGUID.begin(); i != ChannelerGUID.end(); ++i)
{
Creature* Channeler = instance->GetCreature(*i);
if (Channeler && Channeler->IsAlive())
{
//Channeler->CastSpell(Channeler, SPELL_SOUL_TRANSFER, true);
data = IN_PROGRESS;
break;
}
}
break;
}
m_auiEncounter[1] = data;
break;
case DATA_COLLAPSE:
// true - collapse / false - reset
for (GuidSet::const_iterator i = ColumnGUID.begin(); i != ColumnGUID.end(); ++i)
DoUseDoorOrButton(*i);
break;
default:
break;
}
}
示例10: SendLfgUpdateList
void WorldSession::SendLfgUpdateList(uint32 dungeonID)
{
if (!sWorld.getConfig(CONFIG_BOOL_LFR_ENABLE))
{
DEBUG_LOG("SendLfgUpdateList %u failed - Raid finder disabled", GetPlayer()->GetObjectGuid().GetCounter());
return;
}
DEBUG_LOG("SMSG_LFG_SEARCH_RESULTS %u dungeonentry: %u ", GetPlayer()->GetObjectGuid().GetCounter(), dungeonID);
LFGDungeonEntry const* dungeon = sLFGMgr.GetDungeon(dungeonID);
if (!dungeon)
return;
Team team = sWorld.getConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_INTERACTION_GROUP) ? TEAM_NONE : GetPlayer()->GetTeam();
GuidSet groups = sLFGMgr.GetDungeonGroupQueue(dungeon, team);
GuidSet players = sLFGMgr.GetDungeonPlayerQueue(dungeon, team);
uint32 groupCount = groups.size();
uint32 groupSize = 4+4;
for (GuidSet::const_iterator itr = groups.begin(); itr != groups.end(); ++itr)
{
Group* pGroup = sObjectMgr.GetGroup(*itr);
if (!pGroup)
continue;
Player* pLeader = sObjectMgr.GetPlayer(pGroup->GetLeaderGuid());
if (!pLeader)
continue;
sLFGMgr.GetLFGPlayerState(pLeader->GetObjectGuid())->AddFlags(LFG_MEMBER_FLAG_CHARINFO |
LFG_MEMBER_FLAG_COMMENT |
LFG_MEMBER_FLAG_GROUPLEADER |
LFG_MEMBER_FLAG_GROUPGUID |
LFG_MEMBER_FLAG_ROLES |
LFG_MEMBER_FLAG_AREA |
LFG_MEMBER_FLAG_STATUS |
LFG_MEMBER_FLAG_BIND);
uint32 flags = sLFGMgr.GetLFGPlayerState(pLeader->GetObjectGuid())->GetFlags();
if (flags & LFG_MEMBER_FLAG_COMMENT)
groupSize += sLFGMgr.GetLFGPlayerState(pLeader->GetObjectGuid())->GetComment().size()+1;
if (flags & LFG_MEMBER_FLAG_ROLES)
groupSize +=3;
if (flags & LFG_MEMBER_FLAG_BIND)
groupSize += (8+4);
players.insert(*itr);
for (GroupReference *itr2 = pGroup->GetFirstMember(); itr2 != NULL; itr2 = itr2->next())
{
Player* player = itr2->getSource();
if (!player || player == pLeader)
continue;
sLFGMgr.GetLFGPlayerState(player->GetObjectGuid())->AddFlags(LFG_MEMBER_FLAG_GROUPLEADER |
LFG_MEMBER_FLAG_GROUPGUID |
LFG_MEMBER_FLAG_STATUS);
sLFGMgr.GetLFGPlayerState(player->GetObjectGuid())->RemoveFlags(LFG_MEMBER_FLAG_CHARINFO |
LFG_MEMBER_FLAG_COMMENT |
LFG_MEMBER_FLAG_ROLES |
LFG_MEMBER_FLAG_AREA |
LFG_MEMBER_FLAG_BIND);
players.insert(player->GetObjectGuid());
}
}
uint32 playerCount = players.size();
uint32 playerSize = 4+4;
uint32 guidsSize = 0;
GuidSet playersUpdated;
playersUpdated.clear();
for(GuidSet::const_iterator itr = players.begin(); itr != players.end(); ++itr)
{
Player* player = sObjectMgr.GetPlayer(*itr);
if (!player || !player->IsInWorld())
continue;
uint32 flags = sLFGMgr.GetLFGPlayerState(player->GetObjectGuid())->GetFlags();
playerSize += (8+4);
if (flags & LFG_MEMBER_FLAG_CHARINFO)
playerSize += (1+1+1+3+4+4+4+4+4+4+4+4+4+4+4+4+4+4+4+4+4+4+4+4);
if (flags & LFG_MEMBER_FLAG_COMMENT)
playerSize += sLFGMgr.GetLFGPlayerState(player->GetObjectGuid())->GetComment().size()+1; // comment
if (flags & LFG_MEMBER_FLAG_GROUPLEADER)
playerSize += 1;
//.........这里部分代码省略.........
示例11: SendLfgUpdateProposal
void WorldSession::SendLfgUpdateProposal(LFGProposal* pProposal)
{
if (!sWorld.getConfig(CONFIG_BOOL_LFG_ENABLE))
{
DEBUG_LOG("SendLfgUpdateProposal %u failed - Dungeon finder disabled", GetPlayer()->GetObjectGuid().GetCounter());
return;
}
if (!pProposal)
return;
LFGDungeonEntry const* dungeon = pProposal->GetDungeon();
if (!dungeon)
{
DEBUG_LOG("SMSG_LFG_PROPOSAL_UPDATE: no dungeon in proposal %u, returning.", pProposal->m_uiID);
return;
}
ObjectGuid guid = GetPlayer()->GetObjectGuid();
bool isSameDungeon = false;
bool isSameGroup = false;
uint32 completedEncounters = 0;
LFGRolesMap rolesMap;
if (Group* group = pProposal->GetGroup())
{
for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next())
{
Player* pGroupMember = itr->getSource();
if (pGroupMember && pGroupMember->IsInWorld())
{
rolesMap.insert(std::make_pair(pGroupMember->GetObjectGuid(), sLFGMgr.GetLFGPlayerState(pGroupMember->GetObjectGuid())->GetRoles()));
if (InstancePlayerBind* bind = pGroupMember->GetBoundInstance(dungeon->map, Difficulty(dungeon->difficulty)))
{
if (DungeonPersistentState* state = bind->state)
completedEncounters |= state->GetCompletedEncountersMask();
}
}
}
// isContinue = group->isLFGGroup() && sLFGMgr->GetState(gguid) != LFG_STATE_FINISHED_DUNGEON;
isSameDungeon = dungeon->map == GetPlayer()->GetMapId();
isSameGroup = GetPlayer()->GetGroup() == group;
}
GuidSet const proposalGuids = pProposal->GetMembers();
if (!proposalGuids.empty())
{
for (GuidSet::const_iterator itr = proposalGuids.begin(); itr != proposalGuids.end(); ++itr)
{
Player* player = sObjectMgr.GetPlayer(*itr);
if (player && player->IsInWorld())
rolesMap.insert(std::make_pair(player->GetObjectGuid(), sLFGMgr.GetLFGPlayerState(player->GetObjectGuid())->GetRoles()));
}
}
uint32 size = rolesMap.size();
DEBUG_LOG("SMSG_LFG_PROPOSAL_UPDATE proposal %u, player %u, state: %u", pProposal->m_uiID, GetPlayer()->GetObjectGuid().GetCounter(), pProposal->GetState());
WorldPacket data(SMSG_LFG_PROPOSAL_UPDATE, 4 + 1 + 4 + 4 + 1 + 1 + size * (4 + 1 + 1 + 1 + 1 +1));
data << uint32(dungeon->Entry()); // Dungeon
data << uint8(pProposal->GetState()); // Result state
data << uint32(pProposal->m_uiID); // Internal Proposal ID
data << uint32(completedEncounters); // Bosses killed
data << uint8(isSameDungeon); // Silent (show client window)
data << uint8(size); // Group size
for (LFGRolesMap::const_iterator itr = rolesMap.begin(); itr != rolesMap.end(); ++itr)
{
Player* pPlayer = sObjectMgr.GetPlayer(itr->first);
if (!pPlayer)
continue;
isSameDungeon = dungeon->map == pPlayer->GetMapId();
isSameGroup = pPlayer->GetGroup() == pProposal->GetGroup();
data << uint32(itr->second); // Role
data << uint8(pPlayer->GetObjectGuid() == guid); // Self player
data << uint8(isSameDungeon); // Not in dungeon
data << uint8(isSameGroup); // Not same group
data << uint8(sLFGMgr.GetLFGPlayerState(pPlayer->GetObjectGuid())->GetAnswer() != LFG_ANSWER_PENDING); // Answered
data << uint8(sLFGMgr.GetLFGPlayerState(pPlayer->GetObjectGuid())->GetAnswer() == LFG_ANSWER_AGREE); // Accepted
}
SendPacket(&data);
}
示例12: UpdateEscortAI
void UpdateEscortAI(const uint32 uiDiff) override
{
if (!m_pInstance)
return;
if (m_pInstance->GetData(TYPE_RING_OF_LAW) == FAIL)
{
// Reset Doors
if (m_uiEventPhase >= 10) // North Gate is opened
{
m_pInstance->DoUseDoorOrButton(GO_ARENA_2);
m_pInstance->DoUseDoorOrButton(GO_ARENA_4);
}
else if (m_uiEventPhase >= 4) // East Gate is opened
{
m_pInstance->DoUseDoorOrButton(GO_ARENA_1);
m_pInstance->DoUseDoorOrButton(GO_ARENA_4);
}
// Despawn Summoned Mobs
for (GuidList::const_iterator itr = m_lSummonedGUIDList.begin(); itr != m_lSummonedGUIDList.end(); ++itr)
{
if (Creature* pSummoned = m_creature->GetMap()->GetCreature(*itr))
pSummoned->ForcedDespawn();
}
m_lSummonedGUIDList.clear();
// Despawn NPC
m_creature->ForcedDespawn();
return;
}
if (m_uiEventTimer)
{
if (m_uiEventTimer <= uiDiff)
{
switch (m_uiEventPhase)
{
case 0:
// Shortly after spawn, start walking
m_creature->CastSpell(m_creature, SPELL_ASHCROMBES_TELEPORT_A, true);
DoScriptText(SAY_START_2, m_creature);
m_pInstance->DoUseDoorOrButton(GO_ARENA_4);
// Some of the NPCs in the crowd do cheer emote at event start
// we randomly select 25% of the NPCs to do this
m_pInstance->GetArenaCrowdGuid(m_lArenaCrowd);
for (GuidSet::const_iterator itr = m_lArenaCrowd.begin(); itr != m_lArenaCrowd.end(); ++itr)
{
if (Creature* pSpectator = m_creature->GetMap()->GetCreature(*itr))
{
if (urand(0, 1) < 0.25)
pSpectator->HandleEmote(EMOTE_ONESHOT_CHEER);
}
}
Start(false);
SetEscortPaused(false);
m_uiEventTimer = 0;
break;
case 1:
// Start walking towards wall
SetEscortPaused(false);
m_uiEventTimer = 0;
break;
case 2:
m_uiEventTimer = 2000;
break;
case 3:
// Open East Gate
m_creature->CastSpell(m_creature, SPELL_ARENA_FLASH_A, true);
m_creature->CastSpell(m_creature, SPELL_ARENA_FLASH_B, true);
m_pInstance->DoUseDoorOrButton(GO_ARENA_1);
m_uiEventTimer = 3000;
break;
case 4:
// timer for teleport out spell which has 2000 ms cast time
m_creature->CastSpell(m_creature, SPELL_ASHCROMBES_TELEPORT_B, true);
m_uiEventTimer = 2500;
break;
case 5:
m_creature->SetVisibility(VISIBILITY_OFF);
SetEscortPaused(false);
// Summon Ring Mob(s)
SummonRingMob(aRingMob[m_uiMobSpawnId], POS_EAST);
m_uiEventTimer = 8000;
break;
case 6:
// Summon Ring Mob(s)
SummonRingMob(aRingMob[m_uiMobSpawnId], POS_EAST);
SummonRingMob(aRingMob[m_uiMobSpawnId], POS_EAST);
m_uiEventTimer = 8000;
break;
case 7:
// Summon Ring Mob(s)
SummonRingMob(aRingMob[m_uiMobSpawnId], POS_EAST);
m_uiEventTimer = 0;
break;
case 8:
// Summoned Mobs are dead, continue event
DoScriptText(SAY_SUMMON_BOSS_2, m_creature);
m_creature->SetVisibility(VISIBILITY_ON);
//.........这里部分代码省略.........
示例13: LogoutPlayer
/// %Log the player out
void WorldSession::LogoutPlayer(bool Save)
{
// finish pending transfers before starting the logout
while(_player && _player->IsBeingTeleportedFar())
HandleMoveWorldportAckOpcode();
m_playerLogout = true;
m_playerSave = Save;
if (_player)
{
// Playerbot mod: log out all player bots owned by this toon
if (GetPlayer()->GetPlayerbotMgr())
GetPlayer()->GetPlayerbotMgr()->LogoutAllBots();
sLog.outChar("Account: %d (IP: %s) Logout Character:[%s] (guid: %u)", GetAccountId(), GetRemoteAddress().c_str(), _player->GetName() ,_player->GetGUIDLow());
if (ObjectGuid lootGuid = GetPlayer()->GetLootGuid())
DoLootRelease(lootGuid);
///- If the player just died before logging out, make him appear as a ghost
//FIXME: logout must be delayed in case lost connection with client in time of combat
if (GetPlayer()->GetDeathTimer())
{
GetPlayer()->getHostileRefManager().deleteReferences();
GetPlayer()->BuildPlayerRepop();
GetPlayer()->RepopAtGraveyard();
}
else if (GetPlayer()->IsInCombat() && GetPlayer()->GetMap())
{
GetPlayer()->CombatStop();
GetPlayer()->getHostileRefManager().setOnlineOfflineState(false);
GetPlayer()->RemoveAllAurasOnDeath();
// build set of player who attack _player or who have pet attacking of _player
std::set<Player*> aset;
GuidSet attackers = GetPlayer()->GetMap()->GetAttackersFor(GetPlayer()->GetObjectGuid());
for (GuidSet::const_iterator itr = attackers.begin(); itr != attackers.end();)
{
Unit* attacker = GetPlayer()->GetMap()->GetUnit(*itr++);
if (!attacker)
continue;
Unit* owner = attacker->GetOwner(); // including player controlled case
if(owner)
{
if(owner->GetTypeId() == TYPEID_PLAYER)
aset.insert((Player*)owner);
}
else
if(attacker->GetTypeId() == TYPEID_PLAYER)
aset.insert((Player*)(attacker));
}
GetPlayer()->SetPvPDeath(!aset.empty());
GetPlayer()->KillPlayer();
GetPlayer()->BuildPlayerRepop();
GetPlayer()->RepopAtGraveyard();
// give honor to all attackers from set like group case
for(std::set<Player*>::const_iterator itr = aset.begin(); itr != aset.end(); ++itr)
(*itr)->RewardHonor(GetPlayer(),aset.size());
// give bg rewards and update counters like kill by first from attackers
// this can't be called for all attackers.
if(!aset.empty())
if(BattleGround *bg = GetPlayer()->GetBattleGround())
bg->HandleKillPlayer(GetPlayer(),*aset.begin());
}
else if(GetPlayer()->HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION))
{
// this will kill character by SPELL_AURA_SPIRIT_OF_REDEMPTION
GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_MOD_SHAPESHIFT);
//GetPlayer()->SetDeathPvP(*); set at SPELL_AURA_SPIRIT_OF_REDEMPTION apply time
GetPlayer()->KillPlayer();
GetPlayer()->BuildPlayerRepop();
GetPlayer()->RepopAtGraveyard();
}
else if (GetPlayer()->HasPendingBind())
{
GetPlayer()->RepopAtGraveyard();
GetPlayer()->SetPendingBind(NULL, 0);
}
//drop a flag if player is carrying it
if(BattleGround *bg = GetPlayer()->GetBattleGround())
bg->EventPlayerLoggedOut(GetPlayer());
///- Teleport to home if the player is in an invalid instance
if(!GetPlayer()->m_InstanceValid && !GetPlayer()->isGameMaster())
{
GetPlayer()->TeleportToHomebind();
//this is a bad place to call for far teleport because we need player to be in world for successful logout
//maybe we should implement delayed far teleport logout?
}
// FG: finish pending transfers after starting the logout
// this should fix players beeing able to logout and login back with full hp at death position
//.........这里部分代码省略.........
示例14: SetupBattlefield
//.........这里部分代码省略.........
WorkShopList.insert(workshop);
}
for (uint8 i = 0; i < TB_MAX_DESTROY_MACHINE_NPC; i++)
{
if (Creature* creature = SpawnCreature(TBDestroyMachineNPC[i].entrya, TBDestroyMachineNPC[i].x, TBDestroyMachineNPC[i].y, TBDestroyMachineNPC[i].z, TBDestroyMachineNPC[i].o, GetAttackerTeam()))
{
HideNpc(creature);
Vehicles.insert(creature->GetGUID());
}
}
for (uint8 i = 0; i < TB_MAX_OBJ; i++)
{
GameObject* go = SpawnGameObject(TBGameObjectBuillding[i].entry, BATTLEFIELD_TB_MAPID, TBGameObjectBuillding[i].x, TBGameObjectBuillding[i].y, TBGameObjectBuillding[i].z, TBGameObjectBuillding[i].o);
BfTBGameObjectBuilding* b = new BfTBGameObjectBuilding(this);
b->Init(go,TBGameObjectBuillding[i].type,TBGameObjectBuillding[i].WorldState,TBGameObjectBuillding[i].nameid);
b->m_State = BATTLEFIELD_TB_OBJECTSTATE_ALLIANCE_INTACT - (GetDefenderTeam() * 3);
BuildingsInZone.insert(b);
}
for (uint8 i = 0; i < 4; i++)
{
if (Creature* creature = SpawnCreature(QuestGivers[i].entrya, QuestGivers[i].x, QuestGivers[i].y, QuestGivers[i].z, QuestGivers[i].o, TEAM_ALLIANCE))
{
HideNpc(creature);
creature->setFaction(TolBaradFaction[TEAM_ALLIANCE]);
questgiversA.insert(creature->GetGUID());
}
}
for (uint8 i = 0; i < 4; i++)
{
if (Creature* creature = SpawnCreature(QuestGivers[i].entryh, QuestGivers[i].x, QuestGivers[i].y, QuestGivers[i].z, QuestGivers[i].o, TEAM_HORDE))
{
HideNpc(creature);
creature->setFaction(TolBaradFaction[TEAM_HORDE]);
questgiversH.insert(creature->GetGUID());
}
}
{
int i = 0;
GuidSet questgivers = (GetDefenderTeam() == TEAM_ALLIANCE ? questgiversA : questgiversH);
for (GuidSet::const_iterator itr = questgivers.begin(); itr != questgivers.end(); ++itr)
{
if (Unit* unit = sObjectAccessor->FindUnit((*itr)))
{
if (Creature* creature = unit->ToCreature())
{
if (!i || i == sWorld->getWorldState(WS_TB_UNK))
if (!m_isActive)
ShowNpc(creature, true);
i++;
}
}
}
}
for (uint8 i = 0; i < 23; i++)
{
if (Creature* creature = SpawnCreature(AllianceSpawnNPC[i].entrya, AllianceSpawnNPC[i].x, AllianceSpawnNPC[i].y, AllianceSpawnNPC[i].z, AllianceSpawnNPC[i].o, TEAM_ALLIANCE))
{
creature->setFaction(TolBaradFaction[TEAM_ALLIANCE]);
npcAlliance.insert(creature->GetGUID());
}
}
for (uint8 i = 0; i < 23; i++)
{
if (Creature* creature = SpawnCreature(HordeSpawnNPC[i].entrya, HordeSpawnNPC[i].x, HordeSpawnNPC[i].y, HordeSpawnNPC[i].z, HordeSpawnNPC[i].o, TEAM_HORDE))
{
creature->setFaction(TolBaradFaction[TEAM_HORDE]);
npcHorde.insert(creature->GetGUID());
}
}
for (uint8 i = 0; i < 130; i++)
{
if (Creature* creature = SpawnCreature(TbOldNpcStructure[i].entrya, TbOldNpcStructure[i].x, TbOldNpcStructure[i].y, TbOldNpcStructure[i].z, TbOldNpcStructure[i].o, TEAM_NEUTRAL))
{
creature->SetRespawnRadius(15.0f);
creature->SetDefaultMovementType(RANDOM_MOTION_TYPE);
creature->GetMotionMaster()->Initialize();
npcOld.insert(creature->GetGUID());
}
}
for (uint8 i = 0; i < 4; i++)
{
if (GameObject* go = SpawnGameObject(TBGameobjectsDoor[i].entrya, BATTLEFIELD_TB_MAPID, TBGameobjectsDoor[i].x, TBGameobjectsDoor[i].y, TBGameobjectsDoor[i].z, TBGameobjectsDoor[i].o))
{
go->ToGameObject()->SetLootState(GO_READY);
go->ToGameObject()->UseDoorOrButton();
goDoors.insert(go);
}
}
return true;
}
示例15: OnBattleEnd
void BattlefieldTB::OnBattleEnd(bool endbytimer)
{
if (sWorld->getWorldState(WS_TB_UNK_2) > (uint64)time(NULL))
{
if (sWorld->getWorldState(WS_TB_UNK) > 2)
sWorld->setWorldState(WS_TB_UNK, 1);
else
sWorld->setWorldState(WS_TB_UNK, (sWorld->getWorldState(WS_TB_UNK) + 1));
sWorld->setWorldState(WS_TB_UNK_2, time(NULL) + 86400);
}
for (uint8 team = 0; team < 2; ++team)
{
for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr)
{
if (Player* plr = sObjectMgr->GetPlayerByLowGUID((*itr)))
{
if (endbytimer)
{
if (plr->GetTeamId() == GetDefenderTeam())
{
switch (plr->GetTeamId())
{
case TEAM_ALLIANCE:
plr->CastSpell(plr, SPELL_TB_VICTORY_REWARD_ALLIANCE, true);
plr->CastSpell(plr, SPELL_TB_TOL_BARAD_VETERAN, true);
plr->CastSpell(plr, SPELL_TB_TOL_BARAD_TOWER_BONUS, true);
IncrementQuest(plr, QUEST_TB_TOL_BARAD_VICTORY_IN_TOL_BARAD_A, true);
break;
case TEAM_HORDE:
plr->CastSpell(plr, SPELL_TB_VICTORY_REWARD_HORDE, true);
plr->CastSpell(plr, SPELL_TB_TOL_BARAD_VETERAN, true);
plr->CastSpell(plr, SPELL_TB_TOL_BARAD_TOWER_BONUS, true);
IncrementQuest(plr, QUEST_TB_TOL_BARAD_VICTORY_IN_TOL_BARAD_H, true);
break;
}
DoCompleteOrIncrementAchievement(ACHIEVEMENT_TOL_BARAD_VICTORY, plr, 1);
if (m_Data32[BATTLEFIELD_TB_DATA_DESTROYED] == 0)
plr->CastSpell(plr, SPELL_TB_TOL_BARAD_TOWER_DEFENDED, true);
}
else
{
switch (plr->GetTeamId())
{
case TEAM_ALLIANCE:
IncrementQuest(plr, QUEST_TB_TOL_BARAD_VICTORY_IN_TOL_BARAD_A, true);
break;
case TEAM_HORDE:
IncrementQuest(plr, QUEST_TB_TOL_BARAD_VICTORY_IN_TOL_BARAD_H, true);
break;
}
plr->CastSpell(plr, SPELL_TB_LOOSER_REWARD, true);
plr->RepopAtGraveyard();
}
}
else
{
if (plr->GetTeamId() == GetAttackerTeam())
{
switch (team)
{
case TEAM_ALLIANCE:
plr->CastSpell(plr, SPELL_TB_VICTORY_REWARD_ALLIANCE, true);
break;
case TEAM_HORDE:
plr->CastSpell(plr, SPELL_TB_VICTORY_REWARD_HORDE, true);
break;
}
}
else
{
plr->CastSpell(plr, SPELL_TB_LOOSER_REWARD, true);
plr->RepopAtGraveyard();
}
}
}
}
m_PlayersInWar[team].clear();
}
for (TbGameObjectBuilding::const_iterator itr = BuildingsInZone.begin(); itr != BuildingsInZone.end(); ++itr)
if ((*itr))
(*itr)->Rebuild();
for (TbWorkShop::const_iterator itr = WorkShopList.begin(); itr != WorkShopList.end(); ++itr)
if ((*itr))
(*itr)->UpdateWorkshop();
for (BfCapturePointSet::const_iterator itr = CapturePoints.begin(); itr != CapturePoints.end(); ++itr)
if ((*itr))
(*itr)->UpdateCapturePointValue();
for (uint8 i = 0; i < BATTLEFIELD_TB_GY_MAX; i++)
m_GraveyardList[i]->GiveControlTo(GetDefenderTeam());
if (GetDefenderTeam() == TEAM_ALLIANCE)
{
for (GuidSet::const_iterator itr = npcAlliance.begin(); itr != npcAlliance.end(); ++itr)
//.........这里部分代码省略.........