mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 22:37:03 +00:00
[7362] Use IN_MILISECONDS where appropriate, other cleanups.
This commit is contained in:
parent
cea44af521
commit
2b9eeb782e
22 changed files with 120 additions and 111 deletions
|
|
@ -62,7 +62,7 @@
|
|||
|
||||
#include <cmath>
|
||||
|
||||
#define ZONE_UPDATE_INTERVAL 1000
|
||||
#define ZONE_UPDATE_INTERVAL (1*IN_MILISECONDS)
|
||||
|
||||
#define PLAYER_SKILL_INDEX(x) (PLAYER_SKILL_INFO_1_1 + ((x)*3))
|
||||
#define PLAYER_SKILL_VALUE_INDEX(x) (PLAYER_SKILL_INDEX(x)+1)
|
||||
|
|
@ -363,7 +363,7 @@ Player::Player (WorldSession *session): Unit(), m_achievementMgr(this)
|
|||
|
||||
m_swingErrorMsg = 0;
|
||||
|
||||
m_DetectInvTimer = 1000;
|
||||
m_DetectInvTimer = 1*IN_MILISECONDS;
|
||||
|
||||
m_bgBattleGroundID = 0;
|
||||
m_bgTypeID = BATTLEGROUND_TYPE_NONE;
|
||||
|
|
@ -813,7 +813,7 @@ void Player::StartMirrorTimer(MirrorTimerType Type, uint32 MaxValue)
|
|||
void Player::ModifyMirrorTimer(MirrorTimerType Type, uint32 MaxValue, uint32 CurrentValue, uint32 Regen)
|
||||
{
|
||||
if(Type==BREATH_TIMER)
|
||||
m_breathTimer = ((MaxValue + 1000) - CurrentValue) / Regen;
|
||||
m_breathTimer = ((MaxValue + 1*IN_MILISECONDS) - CurrentValue) / Regen;
|
||||
|
||||
WorldPacket data(SMSG_START_MIRROR_TIMER, (21));
|
||||
data << (uint32)Type;
|
||||
|
|
@ -871,7 +871,7 @@ void Player::HandleDrowning()
|
|||
return;
|
||||
}
|
||||
|
||||
uint32 UnderWaterTime = 3*MINUTE*1000; // default duration
|
||||
uint32 UnderWaterTime = 3*MINUTE*IN_MILISECONDS; // default duration
|
||||
|
||||
AuraList const& mModWaterBreathing = GetAurasByType(SPELL_AURA_MOD_WATER_BREATHING);
|
||||
for(AuraList::const_iterator i = mModWaterBreathing.begin(); i != mModWaterBreathing.end(); ++i)
|
||||
|
|
@ -883,7 +883,7 @@ void Player::HandleDrowning()
|
|||
if (!(m_isunderwater & UNDERWATER_WATER_TRIGGER))
|
||||
{
|
||||
m_isunderwater|= UNDERWATER_WATER_TRIGGER;
|
||||
m_breathTimer = UnderWaterTime + 1000;
|
||||
m_breathTimer = UnderWaterTime + 1*IN_MILISECONDS;
|
||||
}
|
||||
//single trigger "show Breathbar"
|
||||
if ( m_breathTimer <= UnderWaterTime && !(m_isunderwater & UNDERWATER_WATER_BREATHB))
|
||||
|
|
@ -928,7 +928,7 @@ void Player::HandleLava()
|
|||
if (!(m_isunderwater & UNDERWATER_INLAVA))
|
||||
{
|
||||
m_isunderwater|= UNDERWATER_WATER_BREATHB;
|
||||
m_breathTimer = 1000;
|
||||
m_breathTimer = 1*IN_MILISECONDS;
|
||||
}
|
||||
*/
|
||||
// Reset BreathTimer and still in the lava
|
||||
|
|
@ -941,7 +941,7 @@ void Player::HandleLava()
|
|||
if ( !isGameMaster() )
|
||||
EnvironmentalDamage(guid, DAMAGE_LAVA, damage);
|
||||
|
||||
m_breathTimer = 1000;
|
||||
m_breathTimer = 1*IN_MILISECONDS;
|
||||
}
|
||||
}
|
||||
else if (!isAlive()) // Disable breath timer and reset underwater flags
|
||||
|
|
@ -1261,7 +1261,7 @@ void Player::Update( uint32 p_time )
|
|||
{
|
||||
m_drunkTimer += p_time;
|
||||
|
||||
if (m_drunkTimer > 10000)
|
||||
if (m_drunkTimer > 10*IN_MILISECONDS)
|
||||
HandleSobering();
|
||||
}
|
||||
|
||||
|
|
@ -2439,7 +2439,7 @@ void Player::SendInitialSpells()
|
|||
time_t cooldown = 0;
|
||||
time_t curTime = time(NULL);
|
||||
if(itr->second.end > curTime)
|
||||
cooldown = (itr->second.end-curTime)*1000;
|
||||
cooldown = (itr->second.end-curTime)*IN_MILISECONDS;
|
||||
|
||||
data << uint16(itr->second.itemid); // cast item id
|
||||
data << uint16(sEntry->Category); // spell category
|
||||
|
|
@ -3126,8 +3126,8 @@ void Player::RemoveArenaSpellCooldowns()
|
|||
SpellEntry const * entry = sSpellStore.LookupEntry(itr->first);
|
||||
// check if spellentry is present and if the cooldown is less than 15 mins
|
||||
if( entry &&
|
||||
entry->RecoveryTime <= 15 * MINUTE * 1000 &&
|
||||
entry->CategoryRecoveryTime <= 15 * MINUTE * 1000 )
|
||||
entry->RecoveryTime <= 15 * MINUTE * IN_MILISECONDS &&
|
||||
entry->CategoryRecoveryTime <= 15 * MINUTE * IN_MILISECONDS )
|
||||
{
|
||||
// notify player
|
||||
WorldPacket data(SMSG_CLEAR_COOLDOWN, (4+8));
|
||||
|
|
@ -3898,7 +3898,7 @@ void Player::ResurrectPlayer(float restore_percent, bool applySickness)
|
|||
{
|
||||
if(Aura* Aur = GetAura(SPELL_ID_PASSIVE_RESURRECTION_SICKNESS,i))
|
||||
{
|
||||
Aur->SetAuraDuration(delta*1000);
|
||||
Aur->SetAuraDuration(delta*IN_MILISECONDS);
|
||||
Aur->SendAuraUpdate(false);
|
||||
}
|
||||
}
|
||||
|
|
@ -3919,7 +3919,7 @@ void Player::KillPlayer()
|
|||
ApplyModFlag(PLAYER_FIELD_BYTES, PLAYER_FIELD_BYTE_RELEASE_TIMER, !sMapStore.LookupEntry(GetMapId())->Instanceable());
|
||||
|
||||
// 6 minutes until repop at graveyard
|
||||
m_deathTimer = 6*MINUTE*1000;
|
||||
m_deathTimer = 6*MINUTE*IN_MILISECONDS;
|
||||
|
||||
UpdateCorpseReclaimDelay(); // dependent at use SetDeathPvP() call before kill
|
||||
|
||||
|
|
@ -12635,10 +12635,10 @@ void Player::AddQuest( Quest const *pQuest, Object *questGiver )
|
|||
|
||||
// shared timed quest
|
||||
if(questGiver && questGiver->GetTypeId()==TYPEID_PLAYER)
|
||||
limittime = ((Player*)questGiver)->getQuestStatusMap()[quest_id].m_timer / 1000;
|
||||
limittime = ((Player*)questGiver)->getQuestStatusMap()[quest_id].m_timer / IN_MILISECONDS;
|
||||
|
||||
AddTimedQuest( quest_id );
|
||||
questStatusData.m_timer = limittime * 1000;
|
||||
questStatusData.m_timer = limittime * IN_MILISECONDS;
|
||||
qtime = static_cast<uint32>(time(NULL)) + limittime;
|
||||
}
|
||||
else
|
||||
|
|
@ -15133,7 +15133,7 @@ void Player::_LoadQuestStatus(QueryResult *result)
|
|||
if (quest_time <= sWorld.GetGameTime())
|
||||
questStatusData.m_timer = 1;
|
||||
else
|
||||
questStatusData.m_timer = (quest_time - sWorld.GetGameTime()) * 1000;
|
||||
questStatusData.m_timer = (quest_time - sWorld.GetGameTime()) * IN_MILISECONDS;
|
||||
}
|
||||
else
|
||||
quest_time = 0;
|
||||
|
|
@ -15840,6 +15840,7 @@ void Player::_SaveAuras()
|
|||
AuraMap::const_iterator itr2 = itr;
|
||||
// save previous spellEffectPair to db
|
||||
itr2--;
|
||||
|
||||
SpellEntry const *spellInfo = itr2->second->GetSpellProto();
|
||||
|
||||
//skip all auras from spells that are passive or need a shapeshift
|
||||
|
|
@ -16014,11 +16015,11 @@ void Player::_SaveQuestStatus()
|
|||
case QUEST_NEW :
|
||||
CharacterDatabase.PExecute("INSERT INTO character_queststatus (guid,quest,status,rewarded,explored,timer,mobcount1,mobcount2,mobcount3,mobcount4,itemcount1,itemcount2,itemcount3,itemcount4) "
|
||||
"VALUES ('%u', '%u', '%u', '%u', '%u', '" I64FMTD "', '%u', '%u', '%u', '%u', '%u', '%u', '%u', '%u')",
|
||||
GetGUIDLow(), i->first, i->second.m_status, i->second.m_rewarded, i->second.m_explored, uint64(i->second.m_timer / 1000 + sWorld.GetGameTime()), i->second.m_creatureOrGOcount[0], i->second.m_creatureOrGOcount[1], i->second.m_creatureOrGOcount[2], i->second.m_creatureOrGOcount[3], i->second.m_itemcount[0], i->second.m_itemcount[1], i->second.m_itemcount[2], i->second.m_itemcount[3]);
|
||||
GetGUIDLow(), i->first, i->second.m_status, i->second.m_rewarded, i->second.m_explored, uint64(i->second.m_timer / IN_MILISECONDS+ sWorld.GetGameTime()), i->second.m_creatureOrGOcount[0], i->second.m_creatureOrGOcount[1], i->second.m_creatureOrGOcount[2], i->second.m_creatureOrGOcount[3], i->second.m_itemcount[0], i->second.m_itemcount[1], i->second.m_itemcount[2], i->second.m_itemcount[3]);
|
||||
break;
|
||||
case QUEST_CHANGED :
|
||||
CharacterDatabase.PExecute("UPDATE character_queststatus SET status = '%u',rewarded = '%u',explored = '%u',timer = '" I64FMTD "',mobcount1 = '%u',mobcount2 = '%u',mobcount3 = '%u',mobcount4 = '%u',itemcount1 = '%u',itemcount2 = '%u',itemcount3 = '%u',itemcount4 = '%u' WHERE guid = '%u' AND quest = '%u' ",
|
||||
i->second.m_status, i->second.m_rewarded, i->second.m_explored, uint64(i->second.m_timer / 1000 + sWorld.GetGameTime()), i->second.m_creatureOrGOcount[0], i->second.m_creatureOrGOcount[1], i->second.m_creatureOrGOcount[2], i->second.m_creatureOrGOcount[3], i->second.m_itemcount[0], i->second.m_itemcount[1], i->second.m_itemcount[2], i->second.m_itemcount[3], GetGUIDLow(), i->first );
|
||||
i->second.m_status, i->second.m_rewarded, i->second.m_explored, uint64(i->second.m_timer / IN_MILISECONDS + sWorld.GetGameTime()), i->second.m_creatureOrGOcount[0], i->second.m_creatureOrGOcount[1], i->second.m_creatureOrGOcount[2], i->second.m_creatureOrGOcount[3], i->second.m_itemcount[0], i->second.m_itemcount[1], i->second.m_itemcount[2], i->second.m_itemcount[3], GetGUIDLow(), i->first );
|
||||
break;
|
||||
case QUEST_UNCHANGED:
|
||||
break;
|
||||
|
|
@ -16728,7 +16729,7 @@ void Player::PetSpellInitialize()
|
|||
time_t cooldown = 0;
|
||||
|
||||
if(itr->second > curTime)
|
||||
cooldown = (itr->second - curTime) * 1000;
|
||||
cooldown = (itr->second - curTime) * IN_MILISECONDS;
|
||||
|
||||
data << uint16(itr->first); // spellid
|
||||
data << uint16(0); // spell category?
|
||||
|
|
@ -16741,7 +16742,7 @@ void Player::PetSpellInitialize()
|
|||
time_t cooldown = 0;
|
||||
|
||||
if(itr->second > curTime)
|
||||
cooldown = (itr->second - curTime) * 1000;
|
||||
cooldown = (itr->second - curTime) * IN_MILISECONDS;
|
||||
|
||||
data << uint16(itr->first); // spellid
|
||||
data << uint16(0); // spell category?
|
||||
|
|
@ -17258,7 +17259,7 @@ void Player::ProhibitSpellScholl(SpellSchoolMask idSchoolMask, uint32 unTimeMs )
|
|||
{
|
||||
data << unSpellId;
|
||||
data << unTimeMs; // in m.secs
|
||||
AddSpellCooldown(unSpellId, 0, curTime + unTimeMs/1000);
|
||||
AddSpellCooldown(unSpellId, 0, curTime + unTimeMs/IN_MILISECONDS);
|
||||
}
|
||||
}
|
||||
GetSession()->SendPacket(&data);
|
||||
|
|
@ -17645,7 +17646,7 @@ void Player::SendCooldownEvent(SpellEntry const *spellInfo)
|
|||
if (cooldown < 0)
|
||||
cooldown = 0;
|
||||
// Add cooldown
|
||||
AddSpellCooldown(spellInfo->Id, 0, time(NULL) + cooldown / 1000);
|
||||
AddSpellCooldown(spellInfo->Id, 0, time(NULL) + cooldown / IN_MILISECONDS);
|
||||
// Send activate
|
||||
WorldPacket data(SMSG_COOLDOWN_EVENT, (4+8));
|
||||
data << spellInfo->Id;
|
||||
|
|
@ -19126,7 +19127,7 @@ void Player::SendCorpseReclaimDelay(bool load)
|
|||
|
||||
//! corpse reclaim delay 30 * 1000ms or longer at often deaths
|
||||
WorldPacket data(SMSG_CORPSE_RECLAIM_DELAY, 4);
|
||||
data << uint32(delay*1000);
|
||||
data << uint32(delay*IN_MILISECONDS);
|
||||
GetSession()->SendPacket( &data );
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue