Core/Misc: corrected a few gametime replacements

This commit is contained in:
Ovahlord
2019-07-08 15:30:12 +02:00
parent 14a2770f2b
commit 4dc27b53eb
3 changed files with 26 additions and 3 deletions

View File

@@ -6815,8 +6815,8 @@ void Player::RewardReputation(Quest const* quest)
void Player::UpdateHonorFields()
{
/// called when rewarding honor and at each save
time_t now = time_t(GameTime::GetGameTime());
time_t today = time_t(GameTime::GetGameTime() / DAY) * DAY;
time_t now = GameTime::GetGameTime();
time_t today = GameTime::GetGameTime() / DAY * DAY;
if (m_lastHonorUpdateTime < today)
{

View File

@@ -243,7 +243,7 @@ void WorldSession::SendPacket(WorldPacket const* packet, bool forced /*= false*/
static uint64 sendPacketCount = 0;
static uint64 sendPacketBytes = 0;
static time_t firstTime = GameTime::GetGameTime();
static time_t firstTime = time(nullptr);
static time_t lastTime = firstTime; // next 60 secs start time
static uint64 sendLastPacketCount = 0;

View File

@@ -4975,6 +4975,28 @@ class spell_gen_launch_quest : public SpellScript
}
};
// Used for some spells cast by vehicles or charmed creatures that do not send a cooldown event on their own
class spell_gen_charmed_unit_spell_cooldown : public SpellScript
{
PrepareSpellScript(spell_gen_charmed_unit_spell_cooldown);
void HandleCast()
{
Unit* caster = GetCaster();
if (Player* owner = caster->GetCharmerOrOwnerPlayerOrPlayerItself())
{
WorldPacket data;
caster->GetSpellHistory()->BuildCooldownPacket(data, SPELL_COOLDOWN_FLAG_NONE, GetSpellInfo()->Id, GetSpellInfo()->RecoveryTime);
owner->SendDirectMessage(&data);
}
}
void Register() override
{
OnCast += SpellCastFn(spell_gen_charmed_unit_spell_cooldown::HandleCast);
}
};
void AddSC_generic_spell_scripts()
{
new spell_gen_absorb0_hitlimit1();
@@ -5089,4 +5111,5 @@ void AddSC_generic_spell_scripts()
RegisterSpellScript(spell_gen_mirror_image_aura);
RegisterSpellScript(spell_gen_reverse_cast_ride_vehicle);
RegisterSpellScript(spell_gen_launch_quest);
RegisterSpellScript(spell_gen_charmed_unit_spell_cooldown);
}