feat(core): Ensure that all actions are compared to fixed point in time (#1236) (#1458)

i.e. world update start
This commit is contained in:
Viste(Кирилл)
2019-02-14 21:22:17 +03:00
committed by Francesco Borzì
parent 1b7522ff0e
commit 51b8773528
108 changed files with 933 additions and 509 deletions

View File

@@ -168,6 +168,7 @@ include_directories(
${CMAKE_SOURCE_DIR}/src/server/game/Spells/Auras
${CMAKE_SOURCE_DIR}/src/server/game/Texts
${CMAKE_SOURCE_DIR}/src/server/game/Tickets
${CMAKE_SOURCE_DIR}/src/server/game/Time
${CMAKE_SOURCE_DIR}/src/server/game/Tools
${CMAKE_SOURCE_DIR}/src/server/game/Warden
${CMAKE_SOURCE_DIR}/src/server/game/Warden/Modules

View File

@@ -17,6 +17,7 @@ EndScriptData */
#include "ObjectAccessor.h"
#include "ObjectMgr.h"
#include "Player.h"
#include "GameTime.h"
#include "ScriptMgr.h"
class ban_commandscript : public CommandScript
@@ -245,7 +246,7 @@ public:
time_t unbanDate = time_t(fields[3].GetUInt32());
bool active = false;
if (fields[2].GetBool() && (fields[1].GetUInt64() == uint64(0) || unbanDate >= time(nullptr)))
if (fields[2].GetBool() && (fields[1].GetUInt64() == uint64(0) || unbanDate >= GameTime::GetGameTime()))
active = true;
bool permanent = (fields[1].GetUInt64() == uint64(0));
std::string banTime = permanent ? handler->GetTrinityString(LANG_BANINFO_INFINITE) : secsToTimeString(fields[1].GetUInt64(), true);
@@ -293,7 +294,7 @@ public:
Field* fields = result->Fetch();
time_t unbanDate = time_t(fields[3].GetUInt32());
bool active = false;
if (fields[2].GetUInt8() && (!fields[1].GetUInt32() || unbanDate >= time(nullptr)))
if (fields[2].GetUInt8() && (!fields[1].GetUInt32() || unbanDate >= GameTime::GetGameTime()))
active = true;
bool permanent = (fields[1].GetUInt32() == uint32(0));
std::string banTime = permanent ? handler->GetTrinityString(LANG_BANINFO_INFINITE) : secsToTimeString(fields[1].GetUInt64(), true);

View File

@@ -15,6 +15,7 @@ EndScriptData */
#include "GameEventMgr.h"
#include "Language.h"
#include "Player.h"
#include "GameTime.h"
#include "ScriptMgr.h"
class event_commandscript : public CommandScript
@@ -104,8 +105,8 @@ public:
std::string endTimeStr = TimeToTimestampStr(eventData.end);
uint32 delay = sGameEventMgr->NextCheck(eventId);
time_t nextTime = time(nullptr) + delay;
std::string nextStr = nextTime >= eventData.start && nextTime < eventData.end ? TimeToTimestampStr(time(nullptr) + delay) : "-";
time_t nextTime = GameTime::GetGameTime() + delay;
std::string nextStr = nextTime >= eventData.start && nextTime < eventData.end ? TimeToTimestampStr(GameTime::GetGameTime() + delay) : "-";
std::string occurenceStr = secsToTimeString(eventData.occurence * MINUTE, true);
std::string lengthStr = secsToTimeString(eventData.length * MINUTE, true);

View File

@@ -19,6 +19,7 @@ EndScriptData */
#include "Chat.h"
#include "Language.h"
#include "Player.h"
#include "GameTime.h"
#include "Opcodes.h"
#include "Transport.h"
#include "GameObject.h"
@@ -310,7 +311,7 @@ public:
if (target)
{
int32 curRespawnDelay = int32(target->GetRespawnTimeEx() - time(nullptr));
int32 curRespawnDelay = int32(target->GetRespawnTimeEx() - GameTime::GetGameTime());
if (curRespawnDelay < 0)
curRespawnDelay = 0;

View File

@@ -18,6 +18,7 @@ EndScriptData */
#include "InstanceScript.h"
#include "MapManager.h"
#include "Player.h"
#include "GameTime.h"
#include "Language.h"
class instance_commandscript : public CommandScript
@@ -71,7 +72,7 @@ public:
{
InstanceSave* save = itr->second.save;
uint32 resetTime = itr->second.extended ? save->GetExtendedResetTime() : save->GetResetTime();
uint32 ttr = (resetTime >= time(nullptr) ? resetTime - time(nullptr) : 0);
uint32 ttr = (resetTime >= GameTime::GetGameTime() ? resetTime - GameTime::GetGameTime() : 0);
std::string timeleft = GetTimeString(ttr);
handler->PSendSysMessage("map: %d, inst: %d, perm: %s, diff: %d, canReset: %s, TTR: %s%s", itr->first, save->GetInstanceId(), itr->second.perm ? "yes" : "no", save->GetDifficulty(), save->CanReset() ? "yes" : "no", timeleft.c_str(), (itr->second.extended ? " (extended)" : ""));
counter++;
@@ -115,7 +116,7 @@ public:
if (itr->first != player->GetMapId() && (!MapId || MapId == itr->first) && (diff == -1 || diff == save->GetDifficulty()))
{
uint32 resetTime = itr->second.extended ? save->GetExtendedResetTime() : save->GetResetTime();
uint32 ttr = (resetTime >= time(nullptr) ? resetTime - time(nullptr) : 0);
uint32 ttr = (resetTime >= GameTime::GetGameTime() ? resetTime - GameTime::GetGameTime() : 0);
std::string timeleft = GetTimeString(ttr);
handler->PSendSysMessage("unbinding map: %d, inst: %d, perm: %s, diff: %d, canReset: %s, TTR: %s%s", itr->first, save->GetInstanceId(), itr->second.perm ? "yes" : "no", save->GetDifficulty(), save->CanReset() ? "yes" : "no", timeleft.c_str(), (itr->second.extended ? " (extended)" : ""));
sInstanceSaveMgr->PlayerUnbindInstance(player->GetGUIDLow(), itr->first, Difficulty(i), true, player);

View File

@@ -22,6 +22,7 @@
#include "WeatherMgr.h"
#include "ace/INET_Addr.h"
#include "Player.h"
#include "GameTime.h"
#include "Pet.h"
#include "LFG.h"
#include "GroupMgr.h"
@@ -1997,11 +1998,11 @@ public:
// Output III. LANG_PINFO_BANNED if ban exists and is applied
if (banTime >= 0)
handler->PSendSysMessage(LANG_PINFO_BANNED, banType.c_str(), banReason.c_str(), banTime > 0 ? secsToTimeString(banTime - time(nullptr), true).c_str() : handler->GetTrinityString(LANG_PERMANENTLY), bannedBy.c_str());
handler->PSendSysMessage(LANG_PINFO_BANNED, banType.c_str(), banReason.c_str(), banTime > 0 ? secsToTimeString(banTime - GameTime::GetGameTime(), true).c_str() : handler->GetTrinityString(LANG_PERMANENTLY), bannedBy.c_str());
// Output IV. LANG_PINFO_MUTED if mute is applied
if (muteTime > 0)
handler->PSendSysMessage(LANG_PINFO_MUTED, muteReason.c_str(), secsToTimeString(muteTime - time(nullptr), true).c_str(), muteBy.c_str());
handler->PSendSysMessage(LANG_PINFO_MUTED, muteReason.c_str(), secsToTimeString(muteTime - GameTime::GetGameTime(), true).c_str(), muteBy.c_str());
// Output V. LANG_PINFO_ACC_ACCOUNT
handler->PSendSysMessage(LANG_PINFO_ACC_ACCOUNT, userName.c_str(), accId, security);
@@ -2240,7 +2241,7 @@ public:
if (target)
{
// Target is online, mute will be in effect right away.
int64 muteTime = time(nullptr) + notSpeakTime * MINUTE;
int64 muteTime = GameTime::GetGameTime() + notSpeakTime * MINUTE;
target->GetSession()->m_muteTime = muteTime;
stmt->setInt64(0, muteTime);
ChatHandler(target->GetSession()).PSendSysMessage(LANG_YOUR_CHAT_DISABLED, notSpeakTime, muteBy.c_str(), muteReasonStr.c_str());

View File

@@ -20,6 +20,7 @@ EndScriptData */
#include "TargetedMovementGenerator.h" // for HandleNpcUnFollowCommand
#include "CreatureAI.h"
#include "Player.h"
#include "GameTime.h"
#include "Pet.h"
struct NpcFlagText
@@ -719,7 +720,7 @@ public:
uint32 nativeid = target->GetNativeDisplayId();
uint32 Entry = target->GetEntry();
int64 curRespawnDelay = target->GetRespawnTimeEx()-time(nullptr);
int64 curRespawnDelay = target->GetRespawnTimeEx()-GameTime::GetGameTime();
if (curRespawnDelay < 0)
curRespawnDelay = 0;
std::string curRespawnDelayStr = secsToTimeString(uint64(curRespawnDelay), true);

View File

@@ -15,6 +15,8 @@ EndScriptData */
#include "Config.h"
#include "Language.h"
#include "ObjectAccessor.h"
#include "GameTime.h"
#include "UpdateTime.h"
#include "Player.h"
#include "ScriptMgr.h"
#include "GitRevision.h"
@@ -96,8 +98,8 @@ public:
uint32 activeSessionCount = sWorld->GetActiveSessionCount();
uint32 queuedSessionCount = sWorld->GetQueuedSessionCount();
uint32 connPeak = sWorld->GetMaxActiveSessionCount();
std::string uptime = secsToTimeString(sWorld->GetUptime()).append(".");
uint32 updateTime = sWorld->GetUpdateTime();
std::string uptime = secsToTimeString(GameTime::GetUptime());
uint32 updateTime = sWorldUpdateTime.GetLastUpdateTime();
uint32 avgUpdateTime = avgDiffTracker.getAverage();
handler->PSendSysMessage("%s", GitRevision::GetFullVersion());
@@ -355,7 +357,7 @@ public:
if (newTime < 0)
return false;
sWorld->SetRecordDiffInterval(newTime);
sWorldUpdateTime.SetRecordUpdateTimeInterval(newTime);
printf("Record diff every %u ms\n", newTime);
return true;

View File

@@ -9,6 +9,7 @@
#include "SpellScript.h"
#include "GameEventMgr.h"
#include "Group.h"
#include "GameTime.h"
#include "LFGMgr.h"
#include "PassiveAI.h"
#include "CellImpl.h"
@@ -435,7 +436,7 @@ class npc_brewfest_keg_reciver : public CreatureScript
{
if (Aura* aur = player->GetAura(SPELL_RAM_AURA))
{
int32 diff = aur->GetApplyTime() - (time(NULL)-(HOUR*18)+spellCooldown);
int32 diff = aur->GetApplyTime() - (GameTime::GetGameTime()-(HOUR*18)+spellCooldown);
if (diff > 10) // aura applied later
return;
@@ -843,7 +844,7 @@ class npc_dark_iron_attack_generator : public CreatureScript
bool AllowStart()
{
time_t curtime = time(NULL);
time_t curtime = GameTime::GetGameTime();
tm strDate;
ACE_OS::localtime_r(&curtime, &strDate);

View File

@@ -1,6 +1,7 @@
// Scripted by Xinef
#include "ScriptMgr.h"
#include "GameTime.h"
#include "ScriptedCreature.h"
#include "ScriptedGossip.h"
#include "Spell.h"
@@ -184,7 +185,7 @@ class npc_midsummer_torch_target : public CreatureScript
Position pos;
pos.Relocate(posVec.at(num));
me->m_last_notify_position.Relocate(0.0f, 0.0f, 0.0f);
me->m_last_notify_mstime = World::GetGameTimeMS() + 10000;
me->m_last_notify_mstime = GameTime::GetGameTimeMS() + 10000;
me->NearTeleportTo(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation());
}
@@ -300,7 +301,7 @@ public:
}
// Achievement
if ((time(NULL) - GetApplyTime()) > 60 && target->GetTypeId() == TYPEID_PLAYER)
if ((GameTime::GetGameTime() - GetApplyTime()) > 60 && target->GetTypeId() == TYPEID_PLAYER)
target->ToPlayer()->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, 58934, 0, target);
}
}

View File

@@ -6,6 +6,7 @@
#include "ScriptedCreature.h"
#include "trial_of_the_crusader.h"
#include "Group.h"
#include "GameTime.h"
#include "Player.h"
#define CLEANUP_CHECK_INTERVAL 5000
@@ -322,7 +323,7 @@ public:
c->DespawnOrUnsummon(10000);
if( Creature* c = instance->GetCreature(NPC_DreadscaleGUID) )
c->DespawnOrUnsummon(10000);
if( AchievementTimer+10 >= time(NULL) )
if( AchievementTimer+10 >= GameTime::GetGameTime() )
DoUpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, SPELL_JORMUNGAR_ACHIEV);
AchievementTimer = 0;
@@ -339,7 +340,7 @@ public:
}
else // first one died, start timer for achievement
{
AchievementTimer = time(NULL);
AchievementTimer = GameTime::GetGameTime();
}
}
else
@@ -428,14 +429,14 @@ public:
HandleGameObject(GO_EnterGateGUID, true);
if( AchievementTimer+60 >= time(NULL) )
if( AchievementTimer+60 >= GameTime::GetGameTime() )
DoUpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, SPELL_RESILIENCE_WILL_FIX_IT_CREDIT);
AchievementTimer = 0;
SaveToDB();
}
else if( Counter == 1 )
AchievementTimer = time(NULL);
AchievementTimer = GameTime::GetGameTime();
}
break;
case TYPE_FACTION_CHAMPIONS_START:

View File

@@ -7,6 +7,7 @@
#include "ScriptedGossip.h"
#include "trial_of_the_crusader.h"
#include "Player.h"
#include "GameTime.h"
enum MenuTexts
{

View File

@@ -11,6 +11,7 @@
#include "TransportMgr.h"
#include "Vehicle.h"
#include "icecrown_citadel.h"
#include "GameTime.h"
enum Texts
{
@@ -406,7 +407,7 @@ public:
return false;
bool summoned = false;
time_t now = time(NULL);
time_t now = GameTime::GetGameTime();
for (int32 i = first; i <= last; ++i)
{
if (_respawnCooldowns[i] > now)
@@ -442,7 +443,7 @@ public:
void ClearSlot(PassengerSlots slot)
{
_controlledSlots[slot] = 0;
_respawnCooldowns[slot] = time(NULL) + _slotInfo[slot].Cooldown;
_respawnCooldowns[slot] = GameTime::GetGameTime() + _slotInfo[slot].Cooldown;
}
private:
@@ -731,7 +732,7 @@ class npc_high_overlord_saurfang_igb : public CreatureScript
_controller.ResetSlots(TEAM_HORDE, creature->GetTransport()->ToMotionTransport());
me->SetRegeneratingHealth(false);
me->m_CombatDistance = 70.0f;
_firstMageCooldown = time(NULL) + 45;
_firstMageCooldown = GameTime::GetGameTime() + 45;
_axethrowersYellCooldown = time_t(0);
_rocketeersYellCooldown = time_t(0);
checkTimer = 1000;
@@ -796,7 +797,7 @@ class npc_high_overlord_saurfang_igb : public CreatureScript
}
else if (action == ACTION_SPAWN_MAGE)
{
time_t now = time(NULL);
time_t now = GameTime::GetGameTime();
if (_firstMageCooldown > now)
_events.ScheduleEvent(EVENT_SUMMON_MAGE, (_firstMageCooldown - now) * IN_MILLISECONDS);
else
@@ -971,10 +972,10 @@ class npc_high_overlord_saurfang_igb : public CreatureScript
case EVENT_CHECK_RIFLEMAN:
if (_controller.SummonCreatures(me, SLOT_RIFLEMAN_1, Is25ManRaid() ? SLOT_RIFLEMAN_8 : SLOT_RIFLEMAN_4))
{
if (_axethrowersYellCooldown < time(NULL))
if (_axethrowersYellCooldown < GameTime::GetGameTime())
{
Talk(SAY_SAURFANG_AXETHROWERS);
_axethrowersYellCooldown = time(NULL) + 5;
_axethrowersYellCooldown = GameTime::GetGameTime() + 5;
}
}
_events.ScheduleEvent(EVENT_CHECK_RIFLEMAN, 1500);
@@ -982,10 +983,10 @@ class npc_high_overlord_saurfang_igb : public CreatureScript
case EVENT_CHECK_MORTAR:
if (_controller.SummonCreatures(me, SLOT_MORTAR_1, Is25ManRaid() ? SLOT_MORTAR_4 : SLOT_MORTAR_2))
{
if (_rocketeersYellCooldown < time(NULL))
if (_rocketeersYellCooldown < GameTime::GetGameTime())
{
Talk(SAY_SAURFANG_ROCKETEERS);
_rocketeersYellCooldown = time(NULL) + 5;
_rocketeersYellCooldown = GameTime::GetGameTime() + 5;
}
}
_events.ScheduleEvent(EVENT_CHECK_MORTAR, 1500);
@@ -1066,7 +1067,7 @@ class npc_muradin_bronzebeard_igb : public CreatureScript
_controller.ResetSlots(TEAM_ALLIANCE, creature->GetTransport()->ToMotionTransport());
me->SetRegeneratingHealth(false);
me->m_CombatDistance = 70.0f;
_firstMageCooldown = time(NULL) + 45;
_firstMageCooldown = GameTime::GetGameTime() + 45;
_riflemanYellCooldown = time_t(0);
_mortarYellCooldown = time_t(0);
checkTimer = 1000;
@@ -1132,7 +1133,7 @@ class npc_muradin_bronzebeard_igb : public CreatureScript
}
else if (action == ACTION_SPAWN_MAGE)
{
time_t now = time(NULL);
time_t now = GameTime::GetGameTime();
if (_firstMageCooldown > now)
_events.ScheduleEvent(EVENT_SUMMON_MAGE, (_firstMageCooldown - now) * IN_MILLISECONDS);
else
@@ -1310,10 +1311,10 @@ class npc_muradin_bronzebeard_igb : public CreatureScript
case EVENT_CHECK_RIFLEMAN:
if (_controller.SummonCreatures(me, SLOT_RIFLEMAN_1, Is25ManRaid() ? SLOT_RIFLEMAN_8 : SLOT_RIFLEMAN_4))
{
if (_riflemanYellCooldown < time(NULL))
if (_riflemanYellCooldown < GameTime::GetGameTime())
{
Talk(SAY_MURADIN_RIFLEMAN);
_riflemanYellCooldown = time(NULL) + 5;
_riflemanYellCooldown = GameTime::GetGameTime() + 5;
}
}
_events.ScheduleEvent(EVENT_CHECK_RIFLEMAN, 1500);
@@ -1321,10 +1322,10 @@ class npc_muradin_bronzebeard_igb : public CreatureScript
case EVENT_CHECK_MORTAR:
if (_controller.SummonCreatures(me, SLOT_MORTAR_1, Is25ManRaid() ? SLOT_MORTAR_4 : SLOT_MORTAR_2))
{
if (_mortarYellCooldown < time(NULL))
if (_mortarYellCooldown < GameTime::GetGameTime())
{
Talk(SAY_MURADIN_MORTAR);
_mortarYellCooldown = time(NULL) + 5;
_mortarYellCooldown = GameTime::GetGameTime() + 5;
}
}
_events.ScheduleEvent(EVENT_CHECK_MORTAR, 1500);

View File

@@ -5,6 +5,7 @@
#include "ObjectMgr.h"
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "GameTime.h"
#include "GridNotifiers.h"
#include "icecrown_citadel.h"
#include "Player.h"
@@ -948,7 +949,7 @@ class spell_sindragosa_unchained_magic : public SpellScriptLoader
if (!spellInfo)
return false;
uint32 currMSTime = World::GetGameTimeMS();
uint32 currMSTime = GameTime::GetGameTimeMS();
std::map<uint32, uint32>::iterator itr = _lastMSTimeForSpell.find(spellInfo->Id);
if (itr != _lastMSTimeForSpell.end())
{

View File

@@ -8,6 +8,7 @@
#include "SpellScript.h"
#include "SpellAuraEffects.h"
#include "Spell.h"
#include "GameTime.h"
#include "Vehicle.h"
#include "Unit.h"
#include "Cell.h"
@@ -686,9 +687,9 @@ class boss_the_lich_king : public CreatureScript
void KilledUnit(Unit* victim)
{
if (victim->GetTypeId() == TYPEID_PLAYER && !me->IsInEvadeMode() && _phase != PHASE_OUTRO && _lastTalkTimeKill+5 < time(NULL))
if (victim->GetTypeId() == TYPEID_PLAYER && !me->IsInEvadeMode() && _phase != PHASE_OUTRO && _lastTalkTimeKill+5 < GameTime::GetGameTime())
{
_lastTalkTimeKill = time(NULL);
_lastTalkTimeKill = GameTime::GetGameTime();
Talk(SAY_LK_KILL);
}
}
@@ -717,7 +718,7 @@ class boss_the_lich_king : public CreatureScript
events.RescheduleEvent(EVENT_START_ATTACK, 1000);
EntryCheckPredicate pred(NPC_STRANGULATE_VEHICLE);
summons.DoAction(ACTION_TELEPORT_BACK, pred);
if (!IsHeroic() && _phase != PHASE_OUTRO && me->IsInCombat() && _lastTalkTimeBuff+5 <= time(NULL))
if (!IsHeroic() && _phase != PHASE_OUTRO && me->IsInCombat() && _lastTalkTimeBuff+5 <= GameTime::GetGameTime())
Talk(SAY_LK_FROSTMOURNE_ESCAPE);
}
break;
@@ -874,9 +875,9 @@ class boss_the_lich_king : public CreatureScript
void SpellHit(Unit* /*caster*/, SpellInfo const* spell)
{
if (spell->Id == HARVESTED_SOUL_BUFF && me->IsInCombat() && !IsHeroic() && _phase != PHASE_OUTRO && _lastTalkTimeBuff+5 <= time(NULL))
if (spell->Id == HARVESTED_SOUL_BUFF && me->IsInCombat() && !IsHeroic() && _phase != PHASE_OUTRO && _lastTalkTimeBuff+5 <= GameTime::GetGameTime())
{
_lastTalkTimeBuff = time(NULL);
_lastTalkTimeBuff = GameTime::GetGameTime();
Talk(SAY_LK_FROSTMOURNE_KILL);
}
}

View File

@@ -5,6 +5,7 @@
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "SpellScript.h"
#include "GameTime.h"
#include "ulduar.h"
#include "Vehicle.h"
#include "SpellAuras.h"
@@ -261,10 +262,10 @@ public:
if (id == 1337)
{
if (lastShatterMSTime)
if (getMSTimeDiff(lastShatterMSTime, World::GetGameTimeMS()) <= 5000)
if (getMSTimeDiff(lastShatterMSTime, GameTime::GetGameTimeMS()) <= 5000)
bShattered = true;
lastShatterMSTime = World::GetGameTimeMS();
lastShatterMSTime = GameTime::GetGameTimeMS();
}
}

View File

@@ -5,6 +5,7 @@
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "SpellScript.h"
#include "GameTime.h"
#include "ulduar.h"
#include "Vehicle.h"
#include "Spell.h"
@@ -452,7 +453,7 @@ public:
case EVENT_SPAWN_FLAMES_INITIAL:
{
if (changeAllowedFlameSpreadTime)
allowedFlameSpreadTime = time(NULL);
allowedFlameSpreadTime = GameTime::GetGameTime();
std::vector<Player*> pg;
Map::PlayerList const &pl = me->GetMap()->GetPlayers();
@@ -2236,7 +2237,7 @@ public:
bool Load()
{
lastMSTime = World::GetGameTimeMS();
lastMSTime = GameTime::GetGameTimeMS();
lastOrientation = -1.0f;
return true;
}
@@ -2247,14 +2248,14 @@ public:
{
if (c->GetTypeId() != TYPEID_UNIT)
return;
uint32 diff = getMSTimeDiff(lastMSTime, World::GetGameTimeMS());
uint32 diff = getMSTimeDiff(lastMSTime, GameTime::GetGameTimeMS());
if (lastOrientation == -1.0f)
{
lastOrientation = (c->ToCreature()->AI()->GetData(0)*2*M_PI)/100.0f;
diff = 0;
}
float new_o = Position::NormalizeOrientation(lastOrientation-(M_PI/60)*(diff/250.0f));
lastMSTime = World::GetGameTimeMS();
lastMSTime = GameTime::GetGameTimeMS();
lastOrientation = new_o;
c->SetOrientation(new_o);
c->SetFacingTo(new_o);
@@ -2316,7 +2317,7 @@ public:
{
npc_ulduar_flames_initialAI(Creature *pCreature) : NullCreatureAI(pCreature)
{
CreateTime = time(NULL);
CreateTime = GameTime::GetGameTime();
events.Reset();
events.ScheduleEvent(EVENT_FLAMES_SPREAD, 5750);
if( Creature* flame = me->SummonCreature(NPC_FLAMES_SPREAD, me->GetPositionX(), me->GetPositionY(), 364.32f, 0.0f) )

View File

@@ -7,6 +7,7 @@
#include "ulduar.h"
#include "Vehicle.h"
#include "Player.h"
#include "GameTime.h"
#include "WorldPacket.h"
#include "WorldSession.h"
#include "Transport.h"
@@ -887,10 +888,10 @@ public:
}
else if (unit->GetTypeId() == TYPEID_UNIT && unit->GetAreaId() == 4656 /*Conservatory of Life*/)
{
if (time(NULL) > (m_conspeedatoryAttempt + DAY))
if (GameTime::GetGameTime() > (m_conspeedatoryAttempt + DAY))
{
DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, 21597 /*CON-SPEED-ATORY_TIMED_CRITERIA*/);
m_conspeedatoryAttempt = time(NULL);
m_conspeedatoryAttempt = GameTime::GetGameTime();
SaveToDB();
}
}

View File

@@ -11,6 +11,7 @@
#include "BattlefieldMgr.h"
#include "SpellAuras.h"
#include "Player.h"
#include "GameTime.h"
/* Vault of Archavon encounters:
1 - Archavon the Stone Watcher event
@@ -179,13 +180,13 @@ class instance_vault_of_archavon : public InstanceMapScript
switch (type)
{
case EVENT_ARCHAVON:
ArchavonDeath = time(NULL);
ArchavonDeath = GameTime::GetGameTime();
break;
case EVENT_EMALON:
EmalonDeath = time(NULL);
EmalonDeath = GameTime::GetGameTime();
break;
case EVENT_KORALON:
KoralonDeath = time(NULL);
KoralonDeath = GameTime::GetGameTime();
break;
default:
return;

View File

@@ -29,6 +29,7 @@
#include "Player.h"
#include "PoolMgr.h"
#include "GameGraveyard.h"
#include "GameTime.h"
#include "World.h"
#define GOSSIP_HELLO_DEMO1 "Build catapult."
@@ -294,7 +295,7 @@ class npc_wg_queue : public CreatureScript
else
{
uint32 timer = wintergrasp->GetTimer() / 1000;
player->SendUpdateWorldState(4354, time(NULL) + timer);
player->SendUpdateWorldState(4354, GameTime::GetGameTime() + timer);
if (timer < 15 * MINUTE)
{
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Queue for Wintergrasp.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF);

View File

@@ -3,6 +3,7 @@
*/
#include "ScriptMgr.h"
#include "GameTime.h"
#include "InstanceScript.h"
#include "the_botanica.h"
@@ -150,7 +151,7 @@ class spell_botanica_shift_form : public SpellScriptLoader
{
if (SpellInfo const* spellInfo = eventInfo.GetDamageInfo()->GetSpellInfo())
{
if ((spellInfo->GetSchoolMask() & _lastSchool) && _swapTime > time(NULL))
if ((spellInfo->GetSchoolMask() & _lastSchool) && _swapTime > GameTime::GetGameTime())
return false;
uint32 form = 0;
@@ -166,7 +167,7 @@ class spell_botanica_shift_form : public SpellScriptLoader
if (form)
{
_swapTime = time(NULL) + 6;
_swapTime = GameTime::GetGameTime() + 6;
_lastSchool = spellInfo->GetSchoolMask();
GetUnitOwner()->RemoveAurasDueToSpell(_lastForm);
_lastForm = form;

View File

@@ -22,6 +22,7 @@
#include "GridNotifiers.h"
#include "GridNotifiersImpl.h"
#include "Group.h"
#include "GameTime.h"
#include "InstanceScript.h"
#include "LFGMgr.h"
#include "Pet.h"
@@ -2650,12 +2651,12 @@ class spell_gen_turkey_marker : public SpellScriptLoader
{
if (GetStackAmount() > stackAmount)
{
_applyTimes.push_back(World::GetGameTimeMS());
_applyTimes.push_back(GameTime::GetGameTimeMS());
stackAmount++;
}
// pop stack if it expired for us
if (_applyTimes.front() + GetMaxDuration() < World::GetGameTimeMS())
if (_applyTimes.front() + GetMaxDuration() < GameTime::GetGameTimeMS())
{
stackAmount--;
ModStackAmount(-1, AURA_REMOVE_BY_EXPIRE);

View File

@@ -17,6 +17,7 @@
#include "SpellAuraEffects.h"
#include "SkillDiscovery.h"
#include "Battleground.h"
#include "GameTime.h"
class spell_item_massive_seaforium_charge : public SpellScriptLoader
{
@@ -3092,7 +3093,7 @@ class spell_item_crystal_prison_dummy_dnd : public SpellScriptLoader
if (Creature* target = GetHitCreature())
if (target->isDead() && !target->IsPet())
{
GetCaster()->SummonGameObject(OBJECT_IMPRISONED_DOOMGUARD, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), target->GetOrientation(), 0, 0, 0, 0, uint32(target->GetRespawnTime()-time(NULL)));
GetCaster()->SummonGameObject(OBJECT_IMPRISONED_DOOMGUARD, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), target->GetOrientation(), 0, 0, 0, 0, uint32(target->GetRespawnTime()-GameTime::GetGameTime()));
target->DespawnOrUnsummon();
}
}

View File

@@ -26,6 +26,7 @@ EndContentData */
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "Player.h"
#include "GameTime.h"
#include "SpellMgr.h"
// Ours
@@ -382,7 +383,7 @@ class AreaTrigger_at_brewfest : public AreaTriggerScript
{
uint32 triggerId = trigger->entry;
// Second trigger happened too early after first, skip for now
if (sWorld->GetGameTime() - _triggerTimes[triggerId] < AREATRIGGER_TALK_COOLDOWN)
if (GameTime::GetGameTime() - _triggerTimes[triggerId] < AREATRIGGER_TALK_COOLDOWN)
return false;
switch (triggerId)
@@ -399,7 +400,7 @@ class AreaTrigger_at_brewfest : public AreaTriggerScript
break;
}
_triggerTimes[triggerId] = sWorld->GetGameTime();
_triggerTimes[triggerId] = GameTime::GetGameTime();
return false;
}
@@ -439,7 +440,7 @@ class AreaTrigger_at_area_52_entrance : public AreaTriggerScript
return false;
uint32 triggerId = trigger->entry;
if (sWorld->GetGameTime() - _triggerTimes[trigger->entry] < SUMMON_COOLDOWN)
if (GameTime::GetGameTime() - _triggerTimes[trigger->entry] < SUMMON_COOLDOWN)
return false;
switch (triggerId)
@@ -468,7 +469,7 @@ class AreaTrigger_at_area_52_entrance : public AreaTriggerScript
player->SummonCreature(NPC_SPOTLIGHT, x, y, z, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 5000);
player->AddAura(SPELL_A52_NEURALYZER, player);
_triggerTimes[trigger->entry] = sWorld->GetGameTime();
_triggerTimes[trigger->entry] = GameTime::GetGameTime();
return false;
}

View File

@@ -36,6 +36,7 @@ EndContentData */
#include "GameObjectAI.h"
#include "Spell.h"
#include "Player.h"
#include "GameTime.h"
#include "WorldSession.h"
// Ours
@@ -836,7 +837,7 @@ class go_inconspicuous_landmark : public GameObjectScript
public:
go_inconspicuous_landmark() : GameObjectScript("go_inconspicuous_landmark")
{
_lastUsedTime = time(NULL);
_lastUsedTime = GameTime::GetGameTime();
}
bool OnGossipHello(Player* player, GameObject* /*go*/)
@@ -844,10 +845,10 @@ class go_inconspicuous_landmark : public GameObjectScript
if (player->HasItemCount(ITEM_CUERGOS_KEY))
return true;
if (_lastUsedTime > time(NULL))
if (_lastUsedTime > GameTime::GetGameTime())
return true;
_lastUsedTime = time(NULL) + MINUTE;
_lastUsedTime = GameTime::GetGameTime() + MINUTE;
player->CastSpell(player, SPELL_SUMMON_PIRATES_TREASURE_AND_TRIGGER_MOB, true);
return true;
}

View File

@@ -33,6 +33,7 @@ EndContentData */
#include "ObjectMgr.h"
#include "ScriptMgr.h"
#include "World.h"
#include "GameTime.h"
#include "CreatureTextMgr.h"
#include "PassiveAI.h"
#include "GameEventMgr.h"
@@ -108,7 +109,7 @@ public:
{
case EVENT_CLEARWATER_ANNOUNCE:
{
time_t curtime = time(NULL);
time_t curtime = GameTime::GetGameTime();
tm strdate;
ACE_OS::localtime_r(&curtime, &strdate);
@@ -253,7 +254,7 @@ public:
{
case EVENT_RIGGLE_ANNOUNCE:
{
time_t curtime = time(NULL);
time_t curtime = GameTime::GetGameTime();
tm strdate;
ACE_OS::localtime_r(&curtime, &strdate);
if (!startWarning && strdate.tm_hour == 14 && strdate.tm_min == 0)