aboutsummaryrefslogtreecommitdiff
path: root/src/game/Unit.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/Unit.cpp')
-rw-r--r--src/game/Unit.cpp27
1 files changed, 14 insertions, 13 deletions
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index 230478dd9ec..30fee0eeb45 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -54,6 +54,7 @@
#include "Vehicle.h"
#include "Transports.h"
#include "ScriptCalls.h"
+#include "TimeMgr.h"
#include <math.h>
@@ -2007,7 +2008,7 @@ void Unit::CalcAbsorbResist(Unit *pVictim, SpellSchoolMask schoolMask, DamageEff
int32 healAmount = pVictim->GetMaxHealth() * (*i)->GetAmount() / 100.0f * pctFromDefense;
pVictim->CastCustomSpell(pVictim, 66235, &healAmount, NULL, NULL, true);
- ((Player*)pVictim)->AddSpellCooldown(66235,0,time(NULL) + 120);
+ ((Player*)pVictim)->AddSpellCooldown(66235,0,sGameTime.GetGameTime() + 120);
}
else if (remainingHealth < allowedHealth)
{
@@ -2254,7 +2255,7 @@ void Unit::CalcAbsorbResist(Unit *pVictim, SpellSchoolMask schoolMask, DamageEff
if (preventDeathSpell->SpellIconID == 2109)
{
pVictim->CastSpell(pVictim,31231,true);
- ((Player*)pVictim)->AddSpellCooldown(31231,0,time(NULL)+60);
+ ((Player*)pVictim)->AddSpellCooldown(31231,0,sGameTime.GetGameTime()+60);
// with health > 10% lost health until health==10%, in other case no losses
uint32 health10 = pVictim->GetMaxHealth()/10;
RemainingDamage = pVictim->GetHealth() > health10 ? pVictim->GetHealth() - health10 : 0;
@@ -4898,7 +4899,7 @@ bool Unit::HandleHasteAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
CastSpell(target,triggered_spell_id,true,castItem,triggeredByAura);
if (cooldown && GetTypeId() == TYPEID_PLAYER)
- ((Player*)this)->AddSpellCooldown(triggered_spell_id,0,time(NULL) + cooldown);
+ ((Player*)this)->AddSpellCooldown(triggered_spell_id,0,sGameTime.GetGameTime() + cooldown);
return true;
}
@@ -4960,7 +4961,7 @@ bool Unit::HandleSpellCritChanceAuraProc(Unit *pVictim, uint32 /*damage*/, AuraE
CastSpell(target,triggered_spell_id,true,castItem,triggeredByAura);
if( cooldown && GetTypeId() == TYPEID_PLAYER )
- ((Player*)this)->AddSpellCooldown(triggered_spell_id,0,time(NULL) + cooldown);
+ ((Player*)this)->AddSpellCooldown(triggered_spell_id,0,sGameTime.GetGameTime() + cooldown);
return true;
}
@@ -6717,7 +6718,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
// apply cooldown before cast to prevent processing itself
if( cooldown )
- ((Player*)this)->AddSpellCooldown(dummySpell->Id,0,time(NULL) + cooldown);
+ ((Player*)this)->AddSpellCooldown(dummySpell->Id,0,sGameTime.GetGameTime() + cooldown);
// Attack Twice
for (uint32 i = 0; i<2; ++i )
@@ -6957,7 +6958,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
((Player*)this)->AddSpellMod(mod, false);
if( cooldown && GetTypeId() == TYPEID_PLAYER )
- ((Player*)this)->AddSpellCooldown(dummySpell->Id,0,time(NULL) + cooldown);
+ ((Player*)this)->AddSpellCooldown(dummySpell->Id,0,sGameTime.GetGameTime() + cooldown);
return true;
}
@@ -7240,7 +7241,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
CastSpell(target,triggered_spell_id,true,castItem,triggeredByAura, originalCaster);
if( cooldown && GetTypeId() == TYPEID_PLAYER )
- ((Player*)this)->AddSpellCooldown(triggered_spell_id,0,time(NULL) + cooldown);
+ ((Player*)this)->AddSpellCooldown(triggered_spell_id,0,sGameTime.GetGameTime() + cooldown);
return true;
}
@@ -7298,7 +7299,7 @@ bool Unit::HandleObsModEnergyAuraProc(Unit *pVictim, uint32 damage, AuraEffect*
CastSpell(target,triggered_spell_id,true,castItem,triggeredByAura);
if( cooldown && GetTypeId() == TYPEID_PLAYER )
- ((Player*)this)->AddSpellCooldown(triggered_spell_id,0,time(NULL) + cooldown);
+ ((Player*)this)->AddSpellCooldown(triggered_spell_id,0,sGameTime.GetGameTime() + cooldown);
return true;
}
bool Unit::HandleModDamagePctTakenAuraProc(Unit *pVictim, uint32 damage, AuraEffect* triggeredByAura, SpellEntry const * procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown)
@@ -7356,7 +7357,7 @@ bool Unit::HandleModDamagePctTakenAuraProc(Unit *pVictim, uint32 damage, AuraEff
CastSpell(target,triggered_spell_id,true,castItem,triggeredByAura);
if( cooldown && GetTypeId() == TYPEID_PLAYER )
- ((Player*)this)->AddSpellCooldown(triggered_spell_id,0,time(NULL) + cooldown);
+ ((Player*)this)->AddSpellCooldown(triggered_spell_id,0,sGameTime.GetGameTime() + cooldown);
return true;
}
@@ -7994,7 +7995,7 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, AuraEffect* trig
target->CastSpell(target,trigger_spell_id,true,castItem,triggeredByAura);
if( cooldown && GetTypeId() == TYPEID_PLAYER )
- ((Player*)this)->AddSpellCooldown(trigger_spell_id,0,time(NULL) + cooldown);
+ ((Player*)this)->AddSpellCooldown(trigger_spell_id,0,sGameTime.GetGameTime() + cooldown);
return true;
}
// Cast positive spell on enemy target
@@ -8166,7 +8167,7 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, AuraEffect* trig
CastSpell(target,trigger_spell_id,true,castItem,triggeredByAura);
if( cooldown && GetTypeId() == TYPEID_PLAYER )
- ((Player*)this)->AddSpellCooldown(trigger_spell_id,0,time(NULL) + cooldown);
+ ((Player*)this)->AddSpellCooldown(trigger_spell_id,0,sGameTime.GetGameTime() + cooldown);
return true;
}
@@ -8264,7 +8265,7 @@ bool Unit::HandleOverrideClassScriptAuraProc(Unit *pVictim, uint32 damage, AuraE
CastSpell(pVictim, triggered_spell_id, true, castItem, triggeredByAura);
if( cooldown && GetTypeId() == TYPEID_PLAYER )
- ((Player*)this)->AddSpellCooldown(triggered_spell_id,0,time(NULL) + cooldown);
+ ((Player*)this)->AddSpellCooldown(triggered_spell_id,0,sGameTime.GetGameTime() + cooldown);
return true;
}
@@ -14595,7 +14596,7 @@ bool Unit::SetCharmedBy(Unit* charmer, CharmType type)
GetCharmInfo()->SetPetNumber(objmgr.GeneratePetNumber(), true);
//if charmed two demons the same session, the 2nd gets the 1st one's name
- SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, time(NULL));
+ SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, sGameTime.GetGameTime());
}
}
((Player*)charmer)->CharmSpellInitialize();