本文整理汇总了C++中GameEventSpawn函数的典型用法代码示例。如果您正苦于以下问题:C++ GameEventSpawn函数的具体用法?C++ GameEventSpawn怎么用?C++ GameEventSpawn使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GameEventSpawn函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: game_event_status
void GameEventMgr::ApplyNewEvent(uint16 event_id, bool resume)
{
m_ActiveEvents.insert(event_id);
CharacterDatabase.PExecute("INSERT INTO game_event_status (event) VALUES (%u)", event_id);
if (sWorld.getConfig(CONFIG_BOOL_EVENT_ANNOUNCE))
{
sWorld.SendWorldText(LANG_EVENTMESSAGE, mGameEvent[event_id].description.c_str());
if(sIRC.BOTMASK & 256)
{
std::string ircchan = std::string("#")+sIRC._irc_chan[sIRC.anchn];
sIRC.Send_IRC_Channel(ircchan, sIRC.MakeMsg("\00304,08\037/!\\\037\017\00304 Game Event \00304,08\037/!\\\037\017 %s", "%s", mGameEvent[event_id].description.c_str()), true);
}
}
sLog.outString("GameEvent %u \"%s\" started.", event_id, mGameEvent[event_id].description.c_str());
// spawn positive event tagget objects
GameEventSpawn(event_id);
// un-spawn negative event tagged objects
int16 event_nid = (-1) * event_id;
GameEventUnspawn(event_nid);
// Change equipement or model
UpdateCreatureData(event_id, true);
// Add quests that are events only to non event npc
UpdateEventQuests(event_id, true);
UpdateWorldStates(event_id, true);
// Not send mails at game event startup, if game event just resume after server shutdown (has been active at server before shutdown)
if (!resume)
SendEventMails(event_id);
}
示例2: game_event_status
void GameEventMgr::ApplyNewEvent(uint16 event_id, bool resume)
{
m_ActiveEvents.insert(event_id);
sLog.outString("GameEvent %u \"%s\" started.", event_id, mGameEvent[event_id].description.c_str());
if (event_id == 987) // daily restart event
{
sWorld.ShutdownServ(mGameEvent[event_id].length*60, SHUTDOWN_MASK_RESTART, 0);
return;
}
CharacterDatabase.PExecute("INSERT INTO game_event_status (event) VALUES (%u)", event_id);
if (sWorld.getConfig(CONFIG_BOOL_EVENT_ANNOUNCE))
sWorld.SendWorldText(LANG_EVENTMESSAGE, mGameEvent[event_id].description.c_str());
// spawn positive event tagget objects
GameEventSpawn(event_id);
// un-spawn negative event tagged objects
int16 event_nid = (-1) * event_id;
GameEventUnspawn(event_nid);
// Change equipement or model
UpdateCreatureData(event_id, true);
// Add quests that are events only to non event npc
UpdateEventQuests(event_id, true);
// Not send mails at game event startup, if game event just resume after server shutdown (has been active at server before shutdown)
if (!resume)
SendEventMails(event_id);
}
示例3: 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
}
示例4: game_event_status
void GameEventMgr::ApplyNewEvent(uint16 event_id, bool resume)
{
m_ActiveEvents.insert(event_id);
static SqlStatementID saveStat;
CharacterDatabase.CreateStatement(saveStat, "REPLACE INTO game_event_status (event) VALUES (?)")
.PExecute(event_id);
if (sWorld.getConfig(CONFIG_BOOL_EVENT_ANNOUNCE) && (!mGameEvent[event_id].silent))
sWorld.SendWorldText(LANG_EVENTMESSAGE, mGameEvent[event_id].description.c_str());
sLog.outString("GameEvent %u \"%s\" started. %s", event_id, mGameEvent[event_id].description.c_str(), mGameEvent[event_id].silent ? "(hidden)" : "");
// spawn positive event tagget objects
GameEventSpawn(event_id);
// un-spawn negative event tagged objects
int16 event_nid = (-1) * event_id;
GameEventUnspawn(event_nid);
// Change equipement or model
UpdateCreatureData(event_id, true);
// Add quests that are events only to non event npc
UpdateEventQuests(event_id, true);
UpdateWorldStates(event_id, true);
// Not send mails at game event startup, if game event just resume after server shutdown (has been active at server before shutdown)
if (!resume)
SendEventMails(event_id);
}
示例5: GameEventUnspawn
void GameEventMgr::UnApplyEvent(uint16 event_id)
{
sLog.outString("GameEvent %u \"%s\" removed.", event_id, mGameEvent[event_id].description.c_str());
// un-spawn positive event tagged objects
GameEventUnspawn(event_id);
// spawn negative event tagget objects
int16 event_nid = (-1) * event_id;
GameEventSpawn(event_nid);
// restore equipment or model
ChangeEquipOrModel(event_id, false);
// Remove quests that are events only to non event npc
UpdateEventQuests(event_id, false);
}
示例6: GameEventSpawn
void GameEvent::ApplyNewEvent(uint16 event_id)
{
sLog.outString("GameEvent %u \"%s\" started.", event_id, mGameEvent[event_id].description.c_str());
// spawn positive event tagget objects
GameEventSpawn(event_id);
// un-spawn negative event tagged objects
int16 event_nid = (-1) * event_id;
GameEventUnspawn(event_nid);
// Change equipement or model
ChangeEquipOrModel(event_id, true);
// Add quests that are events only to non event npc
UpdateEventQuests(event_id, true);
}
示例7: 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
}
示例8: GameEventSpawn
void GameEventMgr::ApplyNewEvent(uint16 event_id)
{
if (sWorld.getConfig(CONFIG_BOOL_EVENT_ANNOUNCE))
sWorld.SendWorldText(LANG_EVENTMESSAGE, mGameEvent[event_id].description.c_str());
sLog.outString("GameEvent %u \"%s\" started.", event_id, mGameEvent[event_id].description.c_str());
// spawn positive event tagget objects
GameEventSpawn(event_id);
// un-spawn negative event tagged objects
int16 event_nid = (-1) * event_id;
GameEventUnspawn(event_nid);
// Change equipement or model
ChangeEquipOrModel(event_id, true);
// Add quests that are events only to non event npc
UpdateEventQuests(event_id, true);
}
示例9: GameEventUnspawn
void GameEventMgr::UnApplyEvent(uint16 event_id)
{
m_ActiveEvents.erase(event_id);
CharacterDatabase.PExecute("DELETE FROM game_event_status WHERE event = %u", event_id);
sLog.outString("GameEvent %u \"%s\" removed.", event_id, mGameEvent[event_id].description.c_str());
// un-spawn positive event tagged objects
GameEventUnspawn(event_id);
// spawn negative event tagget objects
int16 event_nid = (-1) * event_id;
GameEventSpawn(event_nid);
// restore equipment or model
UpdateCreatureData(event_id, false);
// Remove quests that are events only to non event npc
UpdateEventQuests(event_id, false);
SendEventMails(event_nid);
}
示例10: 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
}
示例11: switch
void GameEvent::ApplyNewEvent(uint16 event_id)
{
switch(sWorld.getConfig(CONFIG_EVENT_ANNOUNCE))
{
case 0: // disable
break;
case 1: // announce events
char str[1024];
sprintf(str, objmgr.GetMangosString(LANG_EVENTMESSAGE), mGameEvent[event_id].description.c_str());
sWorld.SendWorldText(str, NULL);
break;
}
sLog.outString("GameEvent %u \"%s\" started.", event_id, mGameEvent[event_id].description.c_str());
// spawn positive event tagget objects
GameEventSpawn(event_id);
// un-spawn negative event tagged objects
int16 event_nid = (-1) * event_id;
GameEventUnspawn(event_nid);
// Change equipement or model
ChangeEquipOrModel(event_id, true);
// Add quests that are events only to non event npc
UpdateEventQuests(event_id, true);
}