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

@@ -27,6 +27,7 @@
#include "DisableMgr.h"
#include "Formulas.h"
#include "GameEventMgr.h"
#include "GameTime.h"
#include "GossipDef.h"
#include "GridNotifiers.h"
#include "GridNotifiersImpl.h"
@@ -774,7 +775,7 @@ Player::Player(WorldSession* session): Unit(true), m_mover(this)
for (uint8 j = 0; j < PLAYER_MAX_BATTLEGROUND_QUEUES; ++j)
m_bgBattlegroundQueueID[j] = BATTLEGROUND_QUEUE_NONE;
m_logintime = time(NULL);
m_logintime = GameTime::GetGameTime();
m_Last_tick = m_logintime;
m_Played_time[PLAYED_TIME_TOTAL] = 0;
m_Played_time[PLAYED_TIME_LEVEL] = 0;
@@ -847,7 +848,7 @@ Player::Player(WorldSession* session): Unit(true), m_mover(this)
m_spellPenetrationItemMod = 0;
// Honor System
m_lastHonorUpdateTime = time(NULL);
m_lastHonorUpdateTime = GameTime::GetGameTime();
m_IsBGRandomWinner = false;
@@ -1101,7 +1102,7 @@ bool Player::Create(uint32 guidlow, CharacterCreateInfo* createInfo)
}
// Played time
m_Last_tick = time(NULL);
m_Last_tick = GameTime::GetGameTime();
m_Played_time[PLAYED_TIME_TOTAL] = 0;
m_Played_time[PLAYED_TIME_LEVEL] = 0;
@@ -1544,7 +1545,7 @@ void Player::Update(uint32 p_time)
sScriptMgr->OnBeforePlayerUpdate(this, p_time);
// undelivered mail
if (m_nextMailDelivereTime && m_nextMailDelivereTime <= time(NULL))
if (m_nextMailDelivereTime && m_nextMailDelivereTime <= GameTime::GetGameTime())
{
SendNewMail();
++unReadMails;
@@ -1558,7 +1559,7 @@ void Player::Update(uint32 p_time)
Unit::Update(p_time);
SetMustDelayTeleport(false);
time_t now = time(NULL);
time_t now = GameTime::GetGameTime();
UpdatePvPFlag(now);
@@ -1709,7 +1710,7 @@ void Player::Update(uint32 p_time)
{
if (now > m_Last_tick && _restTime > 0) // freeze update
{
time_t currTime = time(NULL);
time_t currTime = GameTime::GetGameTime();
time_t timeDiff = currTime - _restTime;
if (timeDiff >= 10) // freeze update
{
@@ -1958,7 +1959,7 @@ void Player::setDeathState(DeathState s, bool /*despawn = false*/)
void Player::SetRestState(uint32 triggerId)
{
_innTriggerId = triggerId;
_restTime = time(NULL);
_restTime = GameTime::GetGameTime();
SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING);
}
@@ -2274,7 +2275,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
if (MustDelayTeleport())
{
SetHasDelayedTeleport(true);
SetSemaphoreTeleportNear(time(NULL));
SetSemaphoreTeleportNear(GameTime::GetGameTime());
//lets save teleport destination for player
teleportStore_dest = WorldLocation(mapid, x, y, z, orientation);
teleportStore_options = options;
@@ -2296,11 +2297,11 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
// this will be used instead of the current location in SaveToDB
teleportStore_dest = WorldLocation(mapid, x, y, z, orientation);
SetFallInformation(time(NULL), z);
SetFallInformation(GameTime::GetGameTime(), z);
// code for finish transfer called in WorldSession::HandleMovementOpcodes()
// at client packet MSG_MOVE_TELEPORT_ACK
SetSemaphoreTeleportNear(time(NULL));
SetSemaphoreTeleportNear(GameTime::GetGameTime());
// near teleport, triggering send MSG_MOVE_TELEPORT_ACK from client at landing
if (!GetSession()->PlayerLogout())
{
@@ -2336,7 +2337,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
if (MustDelayTeleport())
{
SetHasDelayedTeleport(true);
SetSemaphoreTeleportFar(time(NULL));
SetSemaphoreTeleportFar(GameTime::GetGameTime());
//lets save teleport destination for player
teleportStore_dest = WorldLocation(mapid, x, y, z, orientation);
teleportStore_options = options;
@@ -2403,7 +2404,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
}
teleportStore_dest = WorldLocation(mapid, x, y, z, orientation);
SetFallInformation(time(NULL), z);
SetFallInformation(GameTime::GetGameTime(), z);
// if the player is saved before worldportack (at logout for example)
// this will be used instead of the current location in SaveToDB
@@ -2422,7 +2423,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
// move packet sent by client always after far teleport
// code for finish transfer to new map called in WorldSession::HandleMoveWorldportAckOpcode at client packet
SetSemaphoreTeleportFar(time(NULL));
SetSemaphoreTeleportFar(GameTime::GetGameTime());
}
}
return true;
@@ -3468,8 +3469,8 @@ void Player::InitStatsForLevel(bool reapplyMods)
void Player::SendInitialSpells()
{
uint32 curTime = World::GetGameTimeMS();
uint32 infTime = World::GetGameTimeMS()+infinityCooldownDelayCheck;
uint32 curTime = GameTime::GetGameTimeMS();
uint32 infTime = GameTime::GetGameTimeMS()+infinityCooldownDelayCheck;
uint16 spellCount = 0;
@@ -3597,7 +3598,7 @@ void Player::UpdateNextMailTimeAndUnreads()
{
// calculate next delivery time (min. from non-delivered mails
// and recalculate unReadMail
time_t cTime = time(NULL);
time_t cTime = GameTime::GetGameTime();
m_nextMailDelivereTime = 0;
unReadMails = 0;
for (PlayerMails::iterator itr = m_mail.begin(); itr != m_mail.end(); ++itr)
@@ -3614,7 +3615,7 @@ void Player::UpdateNextMailTimeAndUnreads()
void Player::AddNewMailDeliverTime(time_t deliver_time)
{
if (deliver_time <= time(NULL)) // ready now
if (deliver_time <= GameTime::GetGameTime()) // ready now
{
++unReadMails;
SendNewMail();
@@ -4257,7 +4258,7 @@ void Player::RemoveCategoryCooldown(uint32 cat)
void Player::RemoveArenaSpellCooldowns(bool removeActivePetCooldowns)
{
// remove cooldowns on spells that have < 10 min CD
uint32 infTime = World::GetGameTimeMS()+infinityCooldownDelayCheck;
uint32 infTime = GameTime::GetGameTimeMS()+infinityCooldownDelayCheck;
SpellCooldowns::iterator itr, next;
for (itr = m_spellCooldowns.begin(); itr != m_spellCooldowns.end(); itr = next)
{
@@ -4289,7 +4290,7 @@ void Player::RemoveArenaSpellCooldowns(bool removeActivePetCooldowns)
void Player::RemoveAllSpellCooldown()
{
uint32 infTime = World::GetGameTimeMS()+infinityCooldownDelayCheck;
uint32 infTime = GameTime::GetGameTimeMS()+infinityCooldownDelayCheck;
if (!m_spellCooldowns.empty())
{
for (SpellCooldowns::const_iterator itr = m_spellCooldowns.begin(); itr != m_spellCooldowns.end(); ++itr)
@@ -4308,7 +4309,7 @@ void Player::_LoadSpellCooldowns(PreparedQueryResult result)
if (result)
{
time_t curTime = time(NULL);
time_t curTime = GameTime::GetGameTime();
do
{
@@ -4344,8 +4345,8 @@ void Player::_SaveSpellCooldowns(SQLTransaction& trans, bool logout)
stmt->setUInt32(0, GetGUIDLow());
trans->Append(stmt);
time_t curTime = time(NULL);
uint32 curMSTime = World::GetGameTimeMS();
time_t curTime = GameTime::GetGameTime();
uint32 curMSTime = GameTime::GetGameTimeMS();
uint32 infTime = curMSTime + infinityCooldownDelayCheck;
bool first_round = true;
@@ -4399,7 +4400,7 @@ uint32 Player::resetTalentsCost() const
return 10*GOLD;
else
{
uint64 months = (sWorld->GetGameTime() - m_resetTalentsTime)/MONTH;
uint64 months = (GameTime::GetGameTime() - m_resetTalentsTime)/MONTH;
if (months > 0)
{
// This cost will be reduced by a rate of 5 gold per month
@@ -4508,7 +4509,7 @@ bool Player::resetTalents(bool noResetCost)
UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_NUMBER_OF_TALENT_RESETS, 1);
m_resetTalentsCost = resetCost;
m_resetTalentsTime = time(NULL);
m_resetTalentsTime = GameTime::GetGameTime();
}
return true;
@@ -5049,7 +5050,7 @@ void Player::DeleteOldCharacters(uint32 keepDays)
sLog->outString("Player::DeleteOldChars: Deleting all characters which have been deleted %u days before...", keepDays);
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_OLD_CHARS);
stmt->setUInt32(0, uint32(time(NULL) - time_t(keepDays * DAY)));
stmt->setUInt32(0, uint32(GameTime::GetGameTime() - time_t(keepDays * DAY)));
PreparedQueryResult result = CharacterDatabase.Query(stmt);
if (result)
@@ -7166,8 +7167,8 @@ void Player::RewardReputation(Quest const* quest)
void Player::UpdateHonorFields()
{
/// called when rewarding honor and at each save
time_t now = time_t(time(NULL));
time_t today = time_t(time(NULL) / DAY) * DAY;
time_t now = time_t(GameTime::GetGameTime());
time_t today = time_t(GameTime::GetGameTime() / DAY * DAY);
if (m_lastHonorUpdateTime < today)
{
@@ -8977,7 +8978,7 @@ void Player::SendLoot(uint64 guid, LootType loot_type)
// Xinef: loot was generated and respawntime has passed since then, allow to recreate loot
// Xinef: to avoid bugs, this rule covers spawned gameobjects only
if (go->isSpawnedByDefault() && go->getLootState() == GO_ACTIVATED && !go->loot.isLooted() && go->GetLootGenerationTime()+go->GetRespawnDelay() < time(NULL))
if (go->isSpawnedByDefault() && go->getLootState() == GO_ACTIVATED && !go->loot.isLooted() && go->GetLootGenerationTime()+go->GetRespawnDelay() < GameTime::GetGameTime())
go->SetLootState(GO_READY);
if (go->getLootState() == GO_READY)
@@ -10015,7 +10016,7 @@ void Player::SendBattlefieldWorldStates()
SendUpdateWorldState(BATTLEFIELD_WG_WORLD_STATE_SHOW_WORLDSTATE, wg->IsWarTime() ? 1 : 0);
for (uint32 i = 0; i < 2; ++i)
SendUpdateWorldState(ClockWorldState[i], uint32(time(NULL) + (wg->GetTimer() / 1000)));
SendUpdateWorldState(ClockWorldState[i], uint32(GameTime::GetGameTime() + (wg->GetTimer() / 1000)));
}
}
}
@@ -13916,7 +13917,7 @@ void Player::AddItemToBuyBackSlot(Item* pItem)
#endif
m_items[slot] = pItem;
time_t base = time(NULL);
time_t base = GameTime::GetGameTime();
uint32 etime = uint32(base - m_logintime + (30 * 3600));
uint32 eslot = slot - BUYBACK_SLOT_START;
@@ -15670,7 +15671,7 @@ void Player::AddQuest(Quest const* quest, Object* questGiver)
AddTimedQuest(quest_id);
questStatusData.Timer = timeAllowed * IN_MILLISECONDS;
qtime = static_cast<uint32>(time(NULL)) + timeAllowed;
qtime = static_cast<uint32>(GameTime::GetGameTime()) + timeAllowed;
}
else
questStatusData.Timer = 0;
@@ -18059,7 +18060,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
SaveRecallPosition();
time_t now = time(NULL);
time_t now = GameTime::GetGameTime();
time_t logoutTime = time_t(fields[27].GetUInt32());
// since last logout (in seconds)
@@ -18227,7 +18228,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
SetUInt32Value(PLAYER_CHOSEN_TITLE, curTitle);
// has to be called after last Relocate() in Player::LoadFromDB
SetFallInformation(time(NULL), GetPositionZ());
SetFallInformation(GameTime::GetGameTime(), GetPositionZ());
_LoadSpellCooldowns(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_SPELL_COOLDOWNS));
@@ -19095,10 +19096,10 @@ void Player::_LoadQuestStatus(PreparedQueryResult result)
{
AddTimedQuest(quest_id);
if (quest_time <= sWorld->GetGameTime())
if (quest_time <= GameTime::GetGameTime())
questStatusData.Timer = 1;
else
questStatusData.Timer = uint32((quest_time - sWorld->GetGameTime()) * IN_MILLISECONDS);
questStatusData.Timer = uint32((quest_time - GameTime::GetGameTime()) * IN_MILLISECONDS);
}
else
quest_time = 0;
@@ -19363,7 +19364,7 @@ void Player::SendRaidInfo()
size_t p_counter = data.wpos();
data << uint32(counter); // placeholder
time_t now = time(NULL);
time_t now = GameTime::GetGameTime();
for (uint8 i = 0; i < MAX_DIFFICULTY; ++i)
{
@@ -20033,7 +20034,7 @@ void Player::_SaveQuestStatus(SQLTransaction& trans)
stmt->setUInt32(index++, statusItr->first);
stmt->setUInt8(index++, uint8(statusItr->second.Status));
stmt->setBool(index++, statusItr->second.Explored);
stmt->setUInt32(index++, uint32(statusItr->second.Timer / IN_MILLISECONDS+ sWorld->GetGameTime()));
stmt->setUInt32(index++, uint32(statusItr->second.Timer / IN_MILLISECONDS+ GameTime::GetGameTime()));
for (uint8 i = 0; i < QUEST_OBJECTIVES_COUNT; i++)
stmt->setUInt16(index++, statusItr->second.CreatureOrGOCount[i]);
@@ -20956,7 +20957,7 @@ void Player::PetSpellInitialize()
uint8 cooldownsCount = pet->m_CreatureSpellCooldowns.size();
data << uint8(cooldownsCount);
uint32 curTime = World::GetGameTimeMS();
uint32 curTime = GameTime::GetGameTimeMS();
for (CreatureSpellCooldowns::const_iterator itr = pet->m_CreatureSpellCooldowns.begin(); itr != pet->m_CreatureSpellCooldowns.end(); ++itr)
{
@@ -21050,7 +21051,7 @@ void Player::VehicleSpellInitialize()
// Cooldowns
data << uint8(cooldownCount);
uint32 curTime = World::GetGameTimeMS();
uint32 curTime = GameTime::GetGameTimeMS();
for (CreatureSpellCooldowns::const_iterator itr = vehicle->m_CreatureSpellCooldowns.begin(); itr != vehicle->m_CreatureSpellCooldowns.end(); ++itr)
{
@@ -22231,7 +22232,7 @@ void Player::UpdatePvPState(bool onlyFFA)
else // in friendly area
{
if (IsPvP() && !HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_IN_PVP) && pvpInfo.EndTimer == 0)
pvpInfo.EndTimer = time(NULL); // start toggle-off
pvpInfo.EndTimer = GameTime::GetGameTime(); // start toggle-off
}
}
@@ -22244,7 +22245,7 @@ void Player::UpdatePvP(bool state, bool _override)
}
else
{
pvpInfo.EndTimer = time(NULL);
pvpInfo.EndTimer = GameTime::GetGameTime();
SetPvP(state);
}
RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_PVP_TIMER);
@@ -22368,7 +22369,7 @@ void Player::AddSpellAndCategoryCooldowns(SpellInfo const* spellInfo, uint32 ite
void Player::AddSpellCooldown(uint32 spellid, uint32 itemid, uint32 end_time, bool needSendToClient, bool forceSendToSpectator)
{
SpellCooldown sc;
sc.end = World::GetGameTimeMS()+end_time;
sc.end = GameTime::GetGameTimeMS()+end_time;
sc.itemid = itemid;
sc.maxduration = end_time;
sc.sendToSpectator = false;
@@ -22651,7 +22652,7 @@ void Player::LeaveBattleground(Battleground* bg)
}
// xinef: reset corpse reclaim time
m_deathExpireTime = time(NULL);
m_deathExpireTime = GameTime::GetGameTime();
// pussywizard: clear movement, because after porting player will move to arena cords
GetMotionMaster()->MovementExpired();
@@ -23120,7 +23121,7 @@ void Player::SendInitialPacketsBeforeAddToMap()
SendEquipmentSetList();
data.Initialize(SMSG_LOGIN_SETTIMESPEED, 4 + 4 + 4);
data.AppendPackedTime(sWorld->GetGameTime());
data.AppendPackedTime(GameTime::GetGameTime());
data << float(0.01666667f); // game speed
data << uint32(0); // added in 3.1.2
GetSession()->SendPacket(&data);
@@ -23302,7 +23303,7 @@ void Player::ApplyEquipCooldown(Item* pItem)
// Don't replace longer cooldowns by equip cooldown if we have any.
SpellCooldowns::iterator itr = m_spellCooldowns.find(spellData.SpellId);
if (itr != m_spellCooldowns.end() && itr->second.itemid == pItem->GetEntry() && itr->second.end > time(NULL) + 30)
if (itr != m_spellCooldowns.end() && itr->second.itemid == pItem->GetEntry() && itr->second.end > GameTime::GetGameTime() + 30)
continue;
// xinef: dont apply eqiup cooldown for spells with this attribute
@@ -23474,7 +23475,7 @@ void Player::SetDailyQuestStatus(uint32 quest_id)
if (!GetUInt32Value(PLAYER_FIELD_DAILY_QUESTS_1+quest_daily_idx))
{
SetUInt32Value(PLAYER_FIELD_DAILY_QUESTS_1+quest_daily_idx, quest_id);
m_lastDailyQuestTime = time(NULL); // last daily quest time
m_lastDailyQuestTime = GameTime::GetGameTime(); // last daily quest time
m_DailyQuestChanged = true;
break;
}
@@ -23482,7 +23483,7 @@ void Player::SetDailyQuestStatus(uint32 quest_id)
} else
{
m_DFQuests.insert(quest_id);
m_lastDailyQuestTime = time(NULL);
m_lastDailyQuestTime = GameTime::GetGameTime();
m_DailyQuestChanged = true;
}
}
@@ -23740,7 +23741,7 @@ void Player::SummonIfPossible(bool agree, uint32 summoner_guid)
}
// expire and auto declined
if (m_summon_expire < time(NULL))
if (m_summon_expire < GameTime::GetGameTime())
return;
// drop flag at summon
@@ -24262,7 +24263,7 @@ uint32 Player::GetCorpseReclaimDelay(bool pvp) const
else if (!sWorld->getBoolConfig(CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVE))
return 0;
time_t now = time(NULL);
time_t now = GameTime::GetGameTime();
// 0..2 full period
// should be ceil(x)-1 but not floor(x)
uint64 count = (now < m_deathExpireTime - 1) ? (m_deathExpireTime - 1 - now) / DEATH_EXPIRE_STEP : 0;
@@ -24277,7 +24278,7 @@ void Player::UpdateCorpseReclaimDelay()
(!pvp && !sWorld->getBoolConfig(CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVE)))
return;
time_t now = time(NULL);
time_t now = GameTime::GetGameTime();
if (now < m_deathExpireTime)
{
@@ -24321,7 +24322,7 @@ int32 Player::CalculateCorpseReclaimDelay(bool load)
}
time_t expected_time = corpse->GetGhostTime() + copseReclaimDelay[count];
time_t now = time(NULL);
time_t now = GameTime::GetGameTime();
if (now >= expected_time)
return -1;
@@ -26287,7 +26288,7 @@ void Player::_SaveCharacter(bool create, SQLTransaction& trans)
stmt->setUInt32(index++, m_Played_time[PLAYED_TIME_TOTAL]);
stmt->setUInt32(index++, m_Played_time[PLAYED_TIME_LEVEL]);
stmt->setFloat(index++, finiteAlways(_restBonus));
stmt->setUInt32(index++, uint32(time(NULL)));
stmt->setUInt32(index++, uint32(GameTime::GetGameTime()));
stmt->setUInt8(index++, (HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING) ? 1 : 0));
//save, far from tavern/city
//save, but in tavern/city
@@ -26419,7 +26420,7 @@ void Player::_SaveCharacter(bool create, SQLTransaction& trans)
stmt->setUInt32(index++, m_Played_time[PLAYED_TIME_TOTAL]);
stmt->setUInt32(index++, m_Played_time[PLAYED_TIME_LEVEL]);
stmt->setFloat(index++, finiteAlways(_restBonus));
stmt->setUInt32(index++, uint32(time(NULL)));
stmt->setUInt32(index++, uint32(GameTime::GetGameTime()));
stmt->setUInt8(index++, (HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING) ? 1 : 0));
//save, far from tavern/city
//save, but in tavern/city
@@ -26867,7 +26868,7 @@ void Player::ResetTimeSync()
m_timeSyncCounter = 0;
m_timeSyncTimer = 0;
m_timeSyncClient = 0;
m_timeSyncServer = World::GetGameTimeMS();
m_timeSyncServer = GameTime::GetGameTimeMS();
}
void Player::SendTimeSync()
@@ -26878,7 +26879,7 @@ void Player::SendTimeSync()
// Schedule next sync in 10 sec
m_timeSyncTimer = 10000;
m_timeSyncServer = World::GetGameTimeMS();
m_timeSyncServer = GameTime::GetGameTimeMS();
}
void Player::SetReputation(uint32 factionentry, uint32 value)
@@ -27330,7 +27331,7 @@ void Player::_LoadBrewOfTheMonth(PreparedQueryResult result)
lastEventId = fields[0].GetUInt32();
}
time_t curtime = time(NULL);
time_t curtime = GameTime::GetGameTime();
tm localTime;
ACE_OS::localtime_r(&curtime, &localTime);
@@ -27413,7 +27414,7 @@ bool Player::SetCanFly(bool apply, bool packetOnly /*= false*/)
return false;
if (!apply)
SetFallInformation(time(NULL), GetPositionZ());
SetFallInformation(GameTime::GetGameTime(), GetPositionZ());
WorldPacket data(apply ? SMSG_MOVE_SET_CAN_FLY : SMSG_MOVE_UNSET_CAN_FLY, 12);
data.append(GetPackGUID());
@@ -27497,3 +27498,36 @@ void Player::SummonPet(uint32 entry, float x, float y, float z, float ang, PetTy
AsynchPetSummon* asynchPetInfo = new AsynchPetSummon(entry, pos, petType, duration, createdBySpell, casterGUID);
Pet::LoadPetFromDB(this, asynchLoadType, entry, 0, false, asynchPetInfo);
}
void Player::SetSummonPoint(uint32 mapid, float x, float y, float z, uint32 delay, bool asSpectator)
{
m_summon_expire = GameTime::GetGameTime() + (delay ? delay : MAX_PLAYER_SUMMON_DELAY);
m_summon_mapid = mapid;
m_summon_x = x;
m_summon_y = y;
m_summon_z = z;
m_summon_asSpectator = asSpectator;
}
bool Player::IsSummonAsSpectator() const
{
return m_summon_asSpectator && m_summon_expire >= GameTime::GetGameTime();
}
bool Player::HasSpellCooldown(uint32 spell_id) const
{
SpellCooldowns::const_iterator itr = m_spellCooldowns.find(spell_id);
return itr != m_spellCooldowns.end() && itr->second.end > GameTime::GetGameTimeMS();
}
bool Player::HasSpellItemCooldown(uint32 spell_id, uint32 itemid) const
{
SpellCooldowns::const_iterator itr = m_spellCooldowns.find(spell_id);
return itr != m_spellCooldowns.end() && itr->second.end > GameTime::GetGameTimeMS() && itr->second.itemid == itemid;
}
uint32 Player::GetSpellCooldownDelay(uint32 spell_id) const
{
SpellCooldowns::const_iterator itr = m_spellCooldowns.find(spell_id);
return uint32(itr != m_spellCooldowns.end() && itr->second.end > GameTime::GetGameTimeMS() ? itr->second.end - GameTime::GetGameTimeMS() : 0);
}