本文整理汇总了C++中IsActiveEvent函数的典型用法代码示例。如果您正苦于以下问题:C++ IsActiveEvent函数的具体用法?C++ IsActiveEvent怎么用?C++ IsActiveEvent使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IsActiveEvent函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: StartEvent
uint32 GameEvent::Update() // return the next event delay in ms
{
uint32 nextEventDelay = max_ge_check_delay; // 1 day
uint32 calcDelay;
for (uint16 itr = 1; itr < mGameEvent.size(); ++itr)
{
//sLog.outErrorDb("Checking event %u",itr);
if (CheckOneGameEvent(itr))
{
//sLog.outDebug("GameEvent %u is active",itr->first);
if (!IsActiveEvent(itr))
StartEvent(itr);
}
else
{
//sLog.outDebug("GameEvent %u is not active",itr->first);
if (IsActiveEvent(itr))
StopEvent(itr);
else
{
if (!isSystemInit)
{
int16 event_nid = (-1) * (itr);
// spawn all negative ones for this event
GameEventSpawn(event_nid);
}
}
}
calcDelay = NextCheck(itr);
if (calcDelay < nextEventDelay)
nextEventDelay = calcDelay;
}
sLog.outBasic("Next game event check in %u seconds.", nextEventDelay + 1);
return (nextEventDelay + 1) * 1000; // Add 1 second to be sure event has started/stopped at next call
}
示例2: time
// return the next event delay in ms
uint32 GameEventMgr::Update(ActiveEvents const* activeAtShutdown /*= nullptr*/)
{
time_t currenttime = time(nullptr);
uint32 nextEventDelay = max_ge_check_delay; // 1 day
uint32 calcDelay;
for (uint16 itr = 1; itr < mGameEvent.size(); ++itr)
{
if (mGameEvent[itr].occurence == 0)
continue;
// sLog.outErrorDb("Checking event %u",itr);
if (CheckOneGameEvent(itr, currenttime))
{
// DEBUG_LOG("GameEvent %u is active",itr->first);
if (!IsActiveEvent(itr))
{
if (mGameEvent[itr].linkedTo == 0 || IsActiveEvent(mGameEvent[itr].linkedTo))
{
bool resume = activeAtShutdown && (activeAtShutdown->find(itr) != activeAtShutdown->end());
StartEvent(itr, false, resume);
}
}
}
else
{
// DEBUG_LOG("GameEvent %u is not active",itr->first);
if (IsActiveEvent(itr))
{
StopEvent(itr);
if (mGameEvent[itr].linkedTo != 0)
StopEvent(mGameEvent[itr].linkedTo);
}
else
{
if (!m_IsGameEventsInit)
{
int16 event_nid = (-1) * (itr);
// spawn all negative ones for this event
GameEventSpawn(event_nid);
UpdateWorldStates(itr, false);
}
}
}
calcDelay = NextCheck(itr);
if (calcDelay < nextEventDelay)
nextEventDelay = calcDelay;
}
BASIC_LOG("Next game event check in %u seconds.", nextEventDelay + 1);
return (nextEventDelay + 1) * IN_MILLISECONDS; // Add 1 second to be sure event has started/stopped at next call
}
示例3: GetCreatureUpdateDataForActiveEvent
GameEventCreatureData const* GameEventMgr::GetCreatureUpdateDataForActiveEvent(uint32 lowguid) const
{
// only for active event, creature can be listed for many so search all
uint32 event_id = 0;
GameEventCreatureDataPerGuidBounds bounds = mGameEventCreatureDataPerGuid.equal_range(lowguid);
for (GameEventCreatureDataPerGuidMap::const_iterator itr = bounds.first; itr != bounds.second; ++itr)
{
if (IsActiveEvent(itr->second))
{
event_id = itr->second;
break;
}
}
if (!event_id)
{
return NULL;
}
for (GameEventCreatureDataList::const_iterator itr = mGameEventCreatureData[event_id].begin(); itr != mGameEventCreatureData[event_id].end(); ++itr)
if (itr->first == lowguid)
{
return &itr->second;
}
return NULL;
}
示例4: RewardReputationToTeam
void BattleGroundAV::EndBattleGround(uint32 winner)
{
// calculate bonuskills for both teams:
uint32 tower_survived[BG_TEAMS_COUNT] = {0, 0};
uint32 graves_owned[BG_TEAMS_COUNT] = {0, 0};
uint32 mines_owned[BG_TEAMS_COUNT] = {0, 0};
// towers all not destroyed:
for(BG_AV_Nodes i = BG_AV_NODES_DUNBALDAR_SOUTH; i <= BG_AV_NODES_STONEHEART_BUNKER; ++i)
if (m_Nodes[i].State == POINT_CONTROLLED)
if (m_Nodes[i].TotalOwner == BG_TEAM_ALLIANCE)
++tower_survived[BG_TEAM_ALLIANCE];
for(BG_AV_Nodes i = BG_AV_NODES_ICEBLOOD_TOWER; i <= BG_AV_NODES_FROSTWOLF_WTOWER; ++i)
if (m_Nodes[i].State == POINT_CONTROLLED)
if (m_Nodes[i].TotalOwner == BG_TEAM_HORDE)
++tower_survived[BG_TEAM_HORDE];
// graves all controlled
for(BG_AV_Nodes i = BG_AV_NODES_FIRSTAID_STATION; i < BG_AV_NODES_MAX; ++i)
if (m_Nodes[i].State == POINT_CONTROLLED)
++graves_owned[m_Nodes[i].Owner];
for (uint32 i = 0; i < BG_AV_MAX_MINES; ++i)
if (m_Mine_Owner[i] != BG_AV_NEUTRAL_TEAM)
++mines_owned[m_Mine_Owner[i]];
// now we have the values give the honor/reputation to the teams:
uint32 team[BG_TEAMS_COUNT] = { ALLIANCE, HORDE };
uint32 faction[BG_TEAMS_COUNT] = { BG_AV_FACTION_A, BG_AV_FACTION_H };
for (uint32 i = 0; i < BG_TEAMS_COUNT; i++)
{
if (tower_survived[i])
{
RewardReputationToTeam(BATTLEGROUND_AV, tower_survived[i] * m_RepSurviveTower, team[i]);
RewardHonorToTeam(GetBonusHonorFromKill(tower_survived[i] * BG_AV_KILL_SURVIVING_TOWER), team[i]);
RewardXpToTeam(0, 0.6, team[i]);
}
DEBUG_LOG("BattleGroundAV: EndbattleGround: bgteam: %u towers:%u honor:%u rep:%u", i, tower_survived[i], GetBonusHonorFromKill(tower_survived[i] * BG_AV_KILL_SURVIVING_TOWER), tower_survived[i] * BG_AV_REP_SURVIVING_TOWER);
if (graves_owned[i])
RewardReputationToTeam(BATTLEGROUND_AV, graves_owned[i] * m_RepOwnedGrave, team[i]);
if (mines_owned[i])
RewardReputationToTeam(BATTLEGROUND_AV, mines_owned[i] * m_RepOwnedMine, team[i]);
// captain survived?:
if (!IsActiveEvent(BG_AV_NodeEventCaptainDead_A + GetTeamIndexByTeamId(team[i]), 0))
{
RewardReputationToTeam(BATTLEGROUND_AV, m_RepSurviveCaptain, team[i]);
RewardHonorToTeam(GetBonusHonorFromKill(BG_AV_KILL_SURVIVING_CAPTAIN), team[i]);
}
}
// both teams:
if (m_HonorMapComplete)
{
RewardHonorToTeam(m_HonorMapComplete, ALLIANCE);
RewardHonorToTeam(m_HonorMapComplete, HORDE);
}
BattleGround::EndBattleGround(winner);
}
示例5: OnObjectDBLoad
void BattleGround::OnObjectDBLoad(Creature* creature)
{
const BattleGroundEventIdx eventId = sBattleGroundMgr.GetCreatureEventIndex(creature->GetGUIDLow());
if (eventId.event1 == BG_EVENT_NONE)
return;
m_EventObjects[MAKE_PAIR32(eventId.event1, eventId.event2)].creatures.push_back(creature->GetObjectGuid());
if (!IsActiveEvent(eventId.event1, eventId.event2))
SpawnBGCreature(creature->GetObjectGuid(), RESPAWN_ONE_DAY);
}
示例6: hasAllTowers
bool BattleGroundAV::hasAllTowers(int8 team)
{
// if the winner team captain is dead, no need to check further
if ((IsActiveEvent((team == BG_TEAM_ALLIANCE) ? BG_AV_NodeEventCaptainDead_A : BG_AV_NodeEventCaptainDead_H, 0)))
return false;
// all winner towers/bunkers have to be owned by the winners, enemy ones must be destroyed (none in conflict)
for (int i = BG_AV_NODES_DUNBALDAR_SOUTH; i <= BG_AV_NODES_FROSTWOLF_WTOWER; ++i)
if (m_Nodes[i].Owner != team || m_Nodes[i].State != POINT_CONTROLLED)
return false;
return true;
}
示例7: StartEvent
uint32 GameEventMgr::Update() // return the next event delay in ms
{
uint32 nextEventDelay = max_ge_check_delay; // 1 day
uint32 calcDelay;
for (uint16 itr = 1; itr < mGameEvent.size(); ++itr)
{
//sLog.outErrorDb("Checking event %u",itr);
if (CheckOneGameEvent(itr))
{
//DEBUG_LOG("GameEvent %u is active",itr->first);
if (!IsActiveEvent(itr))
StartEvent(itr);
}
else
{
//DEBUG_LOG("GameEvent %u is not active",itr->first);
if (IsActiveEvent(itr))
StopEvent(itr);
else
{
if (!m_IsGameEventsInit)
{
int16 event_nid = (-1) * (itr);
// spawn all negative ones for this event
GameEventSpawn(event_nid);
// disable any event specific quest (for cases where creature is spawned, but event not active).
UpdateEventQuests(itr, false);
UpdateWorldStates(itr, false);
}
}
}
calcDelay = NextCheck(itr);
if (calcDelay < nextEventDelay)
nextEventDelay = calcDelay;
}
BASIC_LOG("Next game event check in %u seconds.", nextEventDelay + 1);
return (nextEventDelay + 1) * IN_MILLISECONDS; // Add 1 second to be sure event has started/stopped at next call
}
示例8: UnApplyEvent
void GameEventMgr::StopEvent(uint16 event_id, bool overwrite)
{
UnApplyEvent(event_id);
if (overwrite)
{
mGameEvent[event_id].start = time(NULL) - mGameEvent[event_id].length * MINUTE;
if (mGameEvent[event_id].end <= mGameEvent[event_id].start)
{ mGameEvent[event_id].end = mGameEvent[event_id].start + mGameEvent[event_id].length; }
}
#ifdef ENABLE_ELUNA
if (!IsActiveEvent(event_id))
sEluna->OnGameEventStop(event_id);
#endif
}
示例9: ApplyNewEvent
void GameEventMgr::StartEvent(uint16 event_id, bool overwrite /*=false*/, bool resume /*=false*/)
{
ApplyNewEvent(event_id, resume);
if (overwrite)
{
mGameEvent[event_id].start = time(NULL);
if (mGameEvent[event_id].end <= mGameEvent[event_id].start)
{ mGameEvent[event_id].end = mGameEvent[event_id].start + mGameEvent[event_id].length; }
}
#ifdef ENABLE_ELUNA
if (IsActiveEvent(event_id))
sEluna->OnGameEventStart(event_id);
#endif
}
示例10: OpenDoorEvent
void BattleGround::OpenDoorEvent(uint8 event1, uint8 event2 /*=0*/)
{
if (!IsDoor(event1, event2))
{
sLog.outError("BattleGround:OpenDoorEvent this is no door event1:%u event2:%u", event1, event2);
return;
}
if (!IsActiveEvent(event1, event2)) // maybe already despawned (eye)
{
sLog.outError("BattleGround:OpenDoorEvent this event isn't active event1:%u event2:%u", event1, event2);
return;
}
GuidVector::const_iterator itr = m_EventObjects[MAKE_PAIR32(event1, event2)].gameobjects.begin();
for (; itr != m_EventObjects[MAKE_PAIR32(event1, event2)].gameobjects.end(); ++itr)
DoorOpen(*itr);
}