mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-02-13 23:43:44 +00:00
feat(Core/Time): Implement saparated manager for game time (#8630)
This commit is contained in:
@@ -43,6 +43,7 @@
|
||||
#include "GameEventMgr.h"
|
||||
#include "GameGraveyard.h"
|
||||
#include "GameObjectAI.h"
|
||||
#include "GameTime.h"
|
||||
#include "GossipDef.h"
|
||||
#include "GridNotifiers.h"
|
||||
#include "Group.h"
|
||||
@@ -247,7 +248,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(nullptr);
|
||||
m_logintime = GameTime::GetGameTime().count();
|
||||
m_Last_tick = m_logintime;
|
||||
m_Played_time[PLAYED_TIME_TOTAL] = 0;
|
||||
m_Played_time[PLAYED_TIME_LEVEL] = 0;
|
||||
@@ -318,7 +319,7 @@ Player::Player(WorldSession* session): Unit(true), m_mover(this)
|
||||
m_spellPenetrationItemMod = 0;
|
||||
|
||||
// Honor System
|
||||
m_lastHonorUpdateTime = time(nullptr);
|
||||
m_lastHonorUpdateTime = GameTime::GetGameTime().count();
|
||||
|
||||
m_IsBGRandomWinner = false;
|
||||
|
||||
@@ -577,7 +578,7 @@ bool Player::Create(ObjectGuid::LowType guidlow, CharacterCreateInfo* createInfo
|
||||
SetArenaPoints(sWorld->getIntConfig(CONFIG_START_ARENA_POINTS));
|
||||
|
||||
// Played time
|
||||
m_Last_tick = time(nullptr);
|
||||
m_Last_tick = GameTime::GetGameTime().count();
|
||||
m_Played_time[PLAYED_TIME_TOTAL] = 0;
|
||||
m_Played_time[PLAYED_TIME_LEVEL] = 0;
|
||||
|
||||
@@ -1074,7 +1075,7 @@ void Player::setDeathState(DeathState s, bool /*despawn = false*/)
|
||||
void Player::SetRestState(uint32 triggerId)
|
||||
{
|
||||
_innTriggerId = triggerId;
|
||||
_restTime = time(nullptr);
|
||||
_restTime = GameTime::GetGameTime().count();
|
||||
SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING);
|
||||
}
|
||||
|
||||
@@ -1432,7 +1433,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
|
||||
if (MustDelayTeleport())
|
||||
{
|
||||
SetHasDelayedTeleport(true);
|
||||
SetSemaphoreTeleportNear(time(nullptr));
|
||||
SetSemaphoreTeleportNear(GameTime::GetGameTime().count());
|
||||
//lets save teleport destination for player
|
||||
teleportStore_dest = WorldLocation(mapid, x, y, z, orientation);
|
||||
teleportStore_options = options;
|
||||
@@ -1454,11 +1455,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(nullptr), z);
|
||||
SetFallInformation(GameTime::GetGameTime().count(), z);
|
||||
|
||||
// code for finish transfer called in WorldSession::HandleMovementOpcodes()
|
||||
// at client packet MSG_MOVE_TELEPORT_ACK
|
||||
SetSemaphoreTeleportNear(time(nullptr));
|
||||
SetSemaphoreTeleportNear(GameTime::GetGameTime().count());
|
||||
// near teleport, triggering send MSG_MOVE_TELEPORT_ACK from client at landing
|
||||
if (!GetSession()->PlayerLogout())
|
||||
{
|
||||
@@ -1493,7 +1494,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
|
||||
if (MustDelayTeleport())
|
||||
{
|
||||
SetHasDelayedTeleport(true);
|
||||
SetSemaphoreTeleportFar(time(nullptr));
|
||||
SetSemaphoreTeleportFar(GameTime::GetGameTime().count());
|
||||
//lets save teleport destination for player
|
||||
teleportStore_dest = WorldLocation(mapid, x, y, z, orientation);
|
||||
teleportStore_options = options;
|
||||
@@ -1558,7 +1559,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
|
||||
}
|
||||
|
||||
teleportStore_dest = WorldLocation(mapid, x, y, z, orientation);
|
||||
SetFallInformation(time(nullptr), z);
|
||||
SetFallInformation(GameTime::GetGameTime().count(), z);
|
||||
// if the player is saved before worldportack (at logout for example)
|
||||
// this will be used instead of the current location in SaveToDB
|
||||
|
||||
@@ -1577,7 +1578,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(nullptr));
|
||||
SetSemaphoreTeleportFar(GameTime::GetGameTime().count());
|
||||
}
|
||||
}
|
||||
return true;
|
||||
@@ -2683,8 +2684,8 @@ void Player::InitStatsForLevel(bool reapplyMods)
|
||||
|
||||
void Player::SendInitialSpells()
|
||||
{
|
||||
uint32 curTime = World::GetGameTimeMS();
|
||||
uint32 infTime = World::GetGameTimeMS() + infinityCooldownDelayCheck;
|
||||
uint32 curTime = GameTime::GetGameTimeMS().count();
|
||||
uint32 infTime = GameTime::GetGameTimeMS().count() + infinityCooldownDelayCheck;
|
||||
|
||||
uint16 spellCount = 0;
|
||||
|
||||
@@ -2816,7 +2817,7 @@ void Player::SendNewMail()
|
||||
|
||||
void Player::AddNewMailDeliverTime(time_t deliver_time)
|
||||
{
|
||||
if (deliver_time <= time(nullptr)) // ready now
|
||||
if (deliver_time <= GameTime::GetGameTime().count()) // ready now
|
||||
{
|
||||
++unReadMails;
|
||||
SendNewMail();
|
||||
@@ -3459,7 +3460,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().count() + infinityCooldownDelayCheck;
|
||||
SpellCooldowns::iterator itr, next;
|
||||
for (itr = m_spellCooldowns.begin(); itr != m_spellCooldowns.end(); itr = next)
|
||||
{
|
||||
@@ -3493,7 +3494,7 @@ void Player::RemoveArenaSpellCooldowns(bool removeActivePetCooldowns)
|
||||
|
||||
void Player::RemoveAllSpellCooldown()
|
||||
{
|
||||
uint32 infTime = World::GetGameTimeMS() + infinityCooldownDelayCheck;
|
||||
uint32 infTime = GameTime::GetGameTimeMS().count() + infinityCooldownDelayCheck;
|
||||
if (!m_spellCooldowns.empty())
|
||||
{
|
||||
for (SpellCooldowns::const_iterator itr = m_spellCooldowns.begin(); itr != m_spellCooldowns.end(); ++itr)
|
||||
@@ -3512,7 +3513,7 @@ void Player::_LoadSpellCooldowns(PreparedQueryResult result)
|
||||
|
||||
if (result)
|
||||
{
|
||||
time_t curTime = time(nullptr);
|
||||
time_t curTime = GameTime::GetGameTime().count();
|
||||
|
||||
do
|
||||
{
|
||||
@@ -3546,8 +3547,8 @@ void Player::_SaveSpellCooldowns(CharacterDatabaseTransaction trans, bool logout
|
||||
stmt->setUInt32(0, GetGUID().GetCounter());
|
||||
trans->Append(stmt);
|
||||
|
||||
time_t curTime = time(nullptr);
|
||||
uint32 curMSTime = World::GetGameTimeMS();
|
||||
time_t curTime = GameTime::GetGameTime().count();
|
||||
uint32 curMSTime = GameTime::GetGameTimeMS().count();
|
||||
uint32 infTime = curMSTime + infinityCooldownDelayCheck;
|
||||
|
||||
bool first_round = true;
|
||||
@@ -3601,7 +3602,7 @@ uint32 Player::resetTalentsCost() const
|
||||
return 10 * GOLD;
|
||||
else
|
||||
{
|
||||
uint64 months = (sWorld->GetGameTime() - m_resetTalentsTime) / MONTH;
|
||||
uint64 months = (GameTime::GetGameTime().count() - m_resetTalentsTime) / MONTH;
|
||||
if (months > 0)
|
||||
{
|
||||
// This cost will be reduced by a rate of 5 gold per month
|
||||
@@ -3710,7 +3711,7 @@ bool Player::resetTalents(bool noResetCost)
|
||||
UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_NUMBER_OF_TALENT_RESETS, 1);
|
||||
|
||||
m_resetTalentsCost = resetCost;
|
||||
m_resetTalentsTime = time(nullptr);
|
||||
m_resetTalentsTime = GameTime::GetGameTime().count();
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -4252,7 +4253,7 @@ void Player::DeleteOldCharacters(uint32 keepDays)
|
||||
LOG_INFO("server.loading", " ");
|
||||
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_OLD_CHARS);
|
||||
stmt->setUInt32(0, uint32(time(nullptr) - time_t(keepDays * DAY)));
|
||||
stmt->setUInt32(0, uint32(GameTime::GetGameTime().count() - time_t(keepDays * DAY)));
|
||||
PreparedQueryResult result = CharacterDatabase.Query(stmt);
|
||||
|
||||
if (result)
|
||||
@@ -7627,7 +7628,7 @@ void Player::SendLoot(ObjectGuid 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(nullptr))
|
||||
if (go->isSpawnedByDefault() && go->getLootState() == GO_ACTIVATED && !go->loot.isLooted() && go->GetLootGenerationTime() + go->GetRespawnDelay() < GameTime::GetGameTime().count())
|
||||
go->SetLootState(GO_READY);
|
||||
|
||||
if (go->getLootState() == GO_READY)
|
||||
@@ -8661,7 +8662,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(nullptr) + (wg->GetTimer() / 1000)));
|
||||
SendUpdateWorldState(ClockWorldState[i], uint32(GameTime::GetGameTime().count() + (wg->GetTimer() / 1000)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8808,29 +8809,23 @@ Pet* Player::SummonPet(uint32 entry, float x, float y, float z, float ang, PetTy
|
||||
|
||||
SetMinion(pet, true);
|
||||
|
||||
switch (petType)
|
||||
if (petType == SUMMON_PET)
|
||||
{
|
||||
case SUMMON_PET:
|
||||
if (pet->GetCreatureTemplate()->type == CREATURE_TYPE_DEMON || pet->GetCreatureTemplate()->type == CREATURE_TYPE_UNDEAD)
|
||||
{
|
||||
if (pet->GetCreatureTemplate()->type == CREATURE_TYPE_DEMON || pet->GetCreatureTemplate()->type == CREATURE_TYPE_UNDEAD)
|
||||
{
|
||||
pet->GetCharmInfo()->SetPetNumber(pet_number, true); // Show pet details tab (Shift+P) only for demons & undead
|
||||
}
|
||||
else
|
||||
{
|
||||
pet->GetCharmInfo()->SetPetNumber(pet_number, false);
|
||||
}
|
||||
|
||||
pet->SetUInt32Value(UNIT_FIELD_BYTES_0, 2048);
|
||||
pet->SetUInt32Value(UNIT_FIELD_PETEXPERIENCE, 0);
|
||||
pet->SetUInt32Value(UNIT_FIELD_PETNEXTLEVELEXP, 1000);
|
||||
pet->SetFullHealth();
|
||||
pet->SetPower(POWER_MANA, pet->GetMaxPower(POWER_MANA));
|
||||
pet->SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, uint32(time(nullptr))); // cast can't be helped in this case
|
||||
break;
|
||||
pet->GetCharmInfo()->SetPetNumber(pet_number, true); // Show pet details tab (Shift+P) only for demons & undead
|
||||
}
|
||||
default:
|
||||
break;
|
||||
else
|
||||
{
|
||||
pet->GetCharmInfo()->SetPetNumber(pet_number, false);
|
||||
}
|
||||
|
||||
pet->SetUInt32Value(UNIT_FIELD_BYTES_0, 2048);
|
||||
pet->SetUInt32Value(UNIT_FIELD_PETEXPERIENCE, 0);
|
||||
pet->SetUInt32Value(UNIT_FIELD_PETNEXTLEVELEXP, 1000);
|
||||
pet->SetFullHealth();
|
||||
pet->SetPower(POWER_MANA, pet->GetMaxPower(POWER_MANA));
|
||||
pet->SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, uint32(GameTime::GetGameTime().count())); // cast can't be helped in this case
|
||||
}
|
||||
|
||||
map->AddToMap(pet->ToCreature(), true);
|
||||
@@ -9321,8 +9316,8 @@ void Player::PetSpellInitialize()
|
||||
uint8 cooldownsCount = pet->m_CreatureSpellCooldowns.size();
|
||||
data << uint8(cooldownsCount);
|
||||
|
||||
uint32 curTime = World::GetGameTimeMS();
|
||||
uint32 infTime = World::GetGameTimeMS() + infinityCooldownDelayCheck;
|
||||
uint32 curTime = GameTime::GetGameTimeMS().count();
|
||||
uint32 infTime = GameTime::GetGameTimeMS().count() + infinityCooldownDelayCheck;
|
||||
|
||||
for (CreatureSpellCooldowns::const_iterator itr = pet->m_CreatureSpellCooldowns.begin(); itr != pet->m_CreatureSpellCooldowns.end(); ++itr)
|
||||
{
|
||||
@@ -9424,8 +9419,8 @@ void Player::VehicleSpellInitialize()
|
||||
// Cooldowns
|
||||
data << uint8(cooldownCount);
|
||||
|
||||
uint32 curTime = World::GetGameTimeMS();
|
||||
uint32 infTime = World::GetGameTimeMS() + infinityCooldownDelayCheck;
|
||||
uint32 curTime = GameTime::GetGameTimeMS().count();
|
||||
uint32 infTime = GameTime::GetGameTimeMS().count() + infinityCooldownDelayCheck;
|
||||
|
||||
for (CreatureSpellCooldowns::const_iterator itr = vehicle->m_CreatureSpellCooldowns.begin(); itr != vehicle->m_CreatureSpellCooldowns.end(); ++itr)
|
||||
{
|
||||
@@ -10726,7 +10721,7 @@ void Player::AddSpellAndCategoryCooldowns(SpellInfo const* spellInfo, uint32 ite
|
||||
void Player::_AddSpellCooldown(uint32 spellid, uint16 categoryId, uint32 itemid, uint32 end_time, bool needSendToClient, bool forceSendToSpectator)
|
||||
{
|
||||
SpellCooldown sc;
|
||||
sc.end = World::GetGameTimeMS() + end_time;
|
||||
sc.end = GameTime::GetGameTimeMS().count() + end_time;
|
||||
sc.category = categoryId;
|
||||
sc.itemid = itemid;
|
||||
sc.maxduration = end_time;
|
||||
@@ -11003,7 +10998,7 @@ void Player::LeaveBattleground(Battleground* bg)
|
||||
}
|
||||
|
||||
// xinef: reset corpse reclaim time
|
||||
m_deathExpireTime = time(nullptr);
|
||||
m_deathExpireTime = GameTime::GetGameTime().count();
|
||||
|
||||
// pussywizard: clear movement, because after porting player will move to arena cords
|
||||
GetMotionMaster()->MovementExpired();
|
||||
@@ -11241,7 +11236,7 @@ void Player::SendInitialPacketsBeforeAddToMap()
|
||||
SendEquipmentSetList();
|
||||
|
||||
data.Initialize(SMSG_LOGIN_SETTIMESPEED, 4 + 4 + 4);
|
||||
data.AppendPackedTime(sWorld->GetGameTime());
|
||||
data.AppendPackedTime(GameTime::GetGameTime().count());
|
||||
data << float(0.01666667f); // game speed
|
||||
data << uint32(0); // added in 3.1.2
|
||||
GetSession()->SendPacket(&data);
|
||||
@@ -11426,7 +11421,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 > World::GetGameTimeMS() + 30 * IN_MILLISECONDS)
|
||||
if (itr != m_spellCooldowns.end() && itr->second.itemid == pItem->GetEntry() && itr->second.end > GameTime::GetGameTimeMS().count() + 30 * IN_MILLISECONDS)
|
||||
continue;
|
||||
|
||||
// xinef: dont apply eqiup cooldown for spells with this attribute
|
||||
@@ -11730,7 +11725,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(nullptr); // last daily quest time
|
||||
m_lastDailyQuestTime = GameTime::GetGameTime().count(); // last daily quest time
|
||||
m_DailyQuestChanged = true;
|
||||
break;
|
||||
}
|
||||
@@ -11739,7 +11734,7 @@ void Player::SetDailyQuestStatus(uint32 quest_id)
|
||||
else
|
||||
{
|
||||
m_DFQuests.insert(quest_id);
|
||||
m_lastDailyQuestTime = time(nullptr);
|
||||
m_lastDailyQuestTime = GameTime::GetGameTime().count();
|
||||
m_DailyQuestChanged = true;
|
||||
}
|
||||
}
|
||||
@@ -11966,7 +11961,7 @@ void Player::SummonIfPossible(bool agree, ObjectGuid summoner_guid)
|
||||
}
|
||||
|
||||
// expire and auto declined
|
||||
if (m_summon_expire < time(nullptr))
|
||||
if (m_summon_expire < GameTime::GetGameTime().count())
|
||||
return;
|
||||
|
||||
// drop flag at summon
|
||||
@@ -12455,7 +12450,7 @@ uint32 Player::GetCorpseReclaimDelay(bool pvp) const
|
||||
else if (!sWorld->getBoolConfig(CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVE))
|
||||
return 0;
|
||||
|
||||
time_t now = time(nullptr);
|
||||
time_t now = GameTime::GetGameTime().count();
|
||||
// 0..2 full period
|
||||
// should be std::ceil(x)-1 but not floor(x)
|
||||
uint64 count = (now < m_deathExpireTime - 1) ? (m_deathExpireTime - 1 - now) / DEATH_EXPIRE_STEP : 0;
|
||||
@@ -12490,7 +12485,7 @@ int32 Player::CalculateCorpseReclaimDelay(bool load)
|
||||
}
|
||||
|
||||
time_t expected_time = corpse->GetGhostTime() + copseReclaimDelay[count];
|
||||
time_t now = time(nullptr);
|
||||
time_t now = GameTime::GetGameTime().count();
|
||||
|
||||
if (now >= expected_time)
|
||||
return -1;
|
||||
@@ -14207,7 +14202,7 @@ void Player::_SaveCharacter(bool create, CharacterDatabaseTransaction 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(nullptr)));
|
||||
stmt->setUInt32(index++, uint32(GameTime::GetGameTime().count()));
|
||||
stmt->setUInt8(index++, (HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING) ? 1 : 0));
|
||||
//save, far from tavern/city
|
||||
//save, but in tavern/city
|
||||
@@ -14346,7 +14341,7 @@ void Player::_SaveCharacter(bool create, CharacterDatabaseTransaction 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(nullptr)));
|
||||
stmt->setUInt32(index++, uint32(GameTime::GetGameTime().count()));
|
||||
stmt->setUInt8(index++, (HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING) ? 1 : 0));
|
||||
//save, far from tavern/city
|
||||
//save, but in tavern/city
|
||||
@@ -15379,7 +15374,7 @@ bool Player::SetCanFly(bool apply, bool packetOnly /*= false*/)
|
||||
return false;
|
||||
|
||||
if (!apply)
|
||||
SetFallInformation(time(nullptr), GetPositionZ());
|
||||
SetFallInformation(GameTime::GetGameTime().count(), GetPositionZ());
|
||||
|
||||
WorldPacket data(apply ? SMSG_MOVE_SET_CAN_FLY : SMSG_MOVE_UNSET_CAN_FLY, 12);
|
||||
data << GetPackGUID();
|
||||
@@ -15658,7 +15653,7 @@ void Player::SetRestFlag(RestFlag restFlag, uint32 triggerId /*= 0*/)
|
||||
|
||||
if (!oldRestMask && _restFlagMask) // only set flag/time on the first rest state
|
||||
{
|
||||
_restTime = time(nullptr);
|
||||
_restTime = GameTime::GetGameTime().count();
|
||||
SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING);
|
||||
}
|
||||
|
||||
@@ -15799,3 +15794,36 @@ std::string Player::GetPlayerName()
|
||||
|
||||
return "|Hplayer:" + name + "|h" + color + name + "|h|r";
|
||||
}
|
||||
|
||||
void Player::SetSummonPoint(uint32 mapid, float x, float y, float z, uint32 delay /*= 0*/, bool asSpectator /*= false*/)
|
||||
{
|
||||
m_summon_expire = GameTime::GetGameTime().count() + (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().count();
|
||||
}
|
||||
|
||||
bool Player::HasSpellCooldown(uint32 spell_id) const
|
||||
{
|
||||
SpellCooldowns::const_iterator itr = m_spellCooldowns.find(spell_id);
|
||||
return itr != m_spellCooldowns.end() && itr->second.end > getMSTime();
|
||||
}
|
||||
|
||||
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 > getMSTime() && 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 > getMSTime() ? itr->second.end - getMSTime() : 0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user