mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-14 01:29:07 +00:00
i.e. world update start
This commit is contained in:
committed by
Francesco Borzì
parent
1b7522ff0e
commit
51b8773528
@@ -6,6 +6,7 @@
|
||||
|
||||
#include <G3D/Quat.h>
|
||||
#include "GameObjectAI.h"
|
||||
#include "GameTime.h"
|
||||
#include "BattlegroundAV.h"
|
||||
#include "CellImpl.h"
|
||||
#include "CreatureAISelector.h"
|
||||
@@ -376,9 +377,9 @@ void GameObject::Update(uint32 diff)
|
||||
GameObjectTemplate const* goInfo = GetGOInfo();
|
||||
// Bombs
|
||||
if (goInfo->trap.type == 2)
|
||||
m_cooldownTime = World::GetGameTimeMS()+10*IN_MILLISECONDS; // Hardcoded tooltip value
|
||||
m_cooldownTime = GameTime::GetGameTimeMS()+10*IN_MILLISECONDS; // Hardcoded tooltip value
|
||||
else if (GetOwner())
|
||||
m_cooldownTime = World::GetGameTimeMS()+goInfo->trap.startDelay*IN_MILLISECONDS;
|
||||
m_cooldownTime = GameTime::GetGameTimeMS()+goInfo->trap.startDelay*IN_MILLISECONDS;
|
||||
|
||||
m_lootState = GO_READY;
|
||||
break;
|
||||
@@ -386,7 +387,7 @@ void GameObject::Update(uint32 diff)
|
||||
case GAMEOBJECT_TYPE_FISHINGNODE:
|
||||
{
|
||||
// fishing code (bobber ready)
|
||||
if (time(NULL) > m_respawnTime - FISHING_BOBBER_READY_TIME)
|
||||
if (GameTime::GetGameTime() > m_respawnTime - FISHING_BOBBER_READY_TIME)
|
||||
{
|
||||
// splash bobber (bobber ready now)
|
||||
Unit* caster = GetOwner();
|
||||
@@ -410,7 +411,7 @@ void GameObject::Update(uint32 diff)
|
||||
}
|
||||
case GAMEOBJECT_TYPE_SUMMONING_RITUAL:
|
||||
{
|
||||
if (World::GetGameTimeMS() < m_cooldownTime)
|
||||
if (GameTime::GetGameTimeMS() < m_cooldownTime)
|
||||
return;
|
||||
GameObjectTemplate const* info = GetGOInfo();
|
||||
if (info->summoningRitual.animSpell)
|
||||
@@ -484,7 +485,7 @@ void GameObject::Update(uint32 diff)
|
||||
{
|
||||
if (m_respawnTime > 0) // timer on
|
||||
{
|
||||
time_t now = time(NULL);
|
||||
time_t now = GameTime::GetGameTime();
|
||||
if (m_respawnTime <= now) // timer expired
|
||||
{
|
||||
uint64 dbtableHighGuid = MAKE_NEW_GUID(m_DBTableGuid, GetEntry(), HIGHGUID_GAMEOBJECT);
|
||||
@@ -560,7 +561,7 @@ void GameObject::Update(uint32 diff)
|
||||
GameObjectTemplate const* goInfo = GetGOInfo();
|
||||
if (goInfo->type == GAMEOBJECT_TYPE_TRAP)
|
||||
{
|
||||
if (World::GetGameTimeMS() < m_cooldownTime)
|
||||
if (GameTime::GetGameTimeMS() < m_cooldownTime)
|
||||
break;
|
||||
|
||||
// Type 2 - Bomb (will go away after casting it's spell)
|
||||
@@ -620,7 +621,7 @@ void GameObject::Update(uint32 diff)
|
||||
if (goInfo->trap.spellId)
|
||||
CastSpell(target, goInfo->trap.spellId);
|
||||
|
||||
m_cooldownTime = World::GetGameTimeMS()+(goInfo->trap.cooldown ? goInfo->trap.cooldown : uint32(4))*IN_MILLISECONDS; // template or 4 seconds
|
||||
m_cooldownTime = GameTime::GetGameTimeMS()+(goInfo->trap.cooldown ? goInfo->trap.cooldown : uint32(4))*IN_MILLISECONDS; // template or 4 seconds
|
||||
|
||||
if (goInfo->trap.type == 1)
|
||||
SetLootState(GO_JUST_DEACTIVATED);
|
||||
@@ -652,11 +653,11 @@ void GameObject::Update(uint32 diff)
|
||||
{
|
||||
case GAMEOBJECT_TYPE_DOOR:
|
||||
case GAMEOBJECT_TYPE_BUTTON:
|
||||
if (GetGOInfo()->GetAutoCloseTime() && World::GetGameTimeMS() >= m_cooldownTime)
|
||||
if (GetGOInfo()->GetAutoCloseTime() && GameTime::GetGameTimeMS() >= m_cooldownTime)
|
||||
ResetDoorOrButton();
|
||||
break;
|
||||
case GAMEOBJECT_TYPE_GOOBER:
|
||||
if (World::GetGameTimeMS() >= m_cooldownTime)
|
||||
if (GameTime::GetGameTimeMS() >= m_cooldownTime)
|
||||
{
|
||||
RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE);
|
||||
|
||||
@@ -728,7 +729,7 @@ void GameObject::Update(uint32 diff)
|
||||
return;
|
||||
}
|
||||
|
||||
m_respawnTime = time(NULL) + m_respawnDelayTime;
|
||||
m_respawnTime = GameTime::GetGameTime() + m_respawnDelayTime;
|
||||
|
||||
// if option not set then object will be saved at grid unload
|
||||
if (GetMap()->IsDungeon())
|
||||
@@ -941,7 +942,7 @@ bool GameObject::LoadGameObjectFromDB(uint32 guid, Map* map, bool addToMap)
|
||||
m_respawnTime = GetMap()->GetGORespawnTime(m_DBTableGuid);
|
||||
|
||||
// ready to respawn
|
||||
if (m_respawnTime && m_respawnTime <= time(NULL))
|
||||
if (m_respawnTime && m_respawnTime <= GameTime::GetGameTime())
|
||||
{
|
||||
m_respawnTime = 0;
|
||||
GetMap()->RemoveGORespawnTime(m_DBTableGuid);
|
||||
@@ -1025,7 +1026,7 @@ Unit* GameObject::GetOwner() const
|
||||
|
||||
void GameObject::SaveRespawnTime()
|
||||
{
|
||||
if (m_goData && m_goData->dbData && m_respawnTime > time(NULL) && m_spawnedByDefault)
|
||||
if (m_goData && m_goData->dbData && m_respawnTime > GameTime::GetGameTime() && m_spawnedByDefault)
|
||||
GetMap()->SaveGORespawnTime(m_DBTableGuid, m_respawnTime);
|
||||
}
|
||||
|
||||
@@ -1080,11 +1081,26 @@ bool GameObject::IsInvisibleDueToDespawn() const
|
||||
return false;
|
||||
}
|
||||
|
||||
time_t GameObject::GetRespawnTimeEx() const
|
||||
{
|
||||
time_t now = GameTime::GetGameTime();
|
||||
if (m_respawnTime > now)
|
||||
return m_respawnTime;
|
||||
else
|
||||
return now;
|
||||
}
|
||||
|
||||
void GameObject::SetRespawnTime(int32 respawn)
|
||||
{
|
||||
m_respawnTime = respawn > 0 ? GameTime::GetGameTime() + respawn : 0;
|
||||
m_respawnDelayTime = respawn > 0 ? respawn : 0;
|
||||
}
|
||||
|
||||
void GameObject::Respawn()
|
||||
{
|
||||
if (m_spawnedByDefault && m_respawnTime > 0)
|
||||
{
|
||||
m_respawnTime = time(NULL);
|
||||
m_respawnTime = GameTime::GetGameTime();
|
||||
GetMap()->RemoveGORespawnTime(m_DBTableGuid);
|
||||
}
|
||||
}
|
||||
@@ -1212,7 +1228,7 @@ void GameObject::UseDoorOrButton(uint32 time_to_restore, bool alternative /* = f
|
||||
SwitchDoorOrButton(true, alternative);
|
||||
SetLootState(GO_ACTIVATED, user);
|
||||
|
||||
m_cooldownTime = World::GetGameTimeMS()+time_to_restore;
|
||||
m_cooldownTime = GameTime::GetGameTimeMS()+time_to_restore;
|
||||
}
|
||||
|
||||
void GameObject::SetGoArtKit(uint8 kit)
|
||||
@@ -1279,10 +1295,10 @@ void GameObject::Use(Unit* user)
|
||||
// If cooldown data present in template
|
||||
if (uint32 cooldown = GetGOInfo()->GetCooldown())
|
||||
{
|
||||
if (World::GetGameTimeMS() < m_cooldownTime)
|
||||
if (GameTime::GetGameTimeMS() < m_cooldownTime)
|
||||
return;
|
||||
|
||||
m_cooldownTime = World::GetGameTimeMS()+cooldown*IN_MILLISECONDS;
|
||||
m_cooldownTime = GameTime::GetGameTimeMS()+cooldown*IN_MILLISECONDS;
|
||||
}
|
||||
|
||||
switch (GetGoType())
|
||||
@@ -1316,7 +1332,7 @@ void GameObject::Use(Unit* user)
|
||||
if (goInfo->trap.spellId)
|
||||
CastSpell(user, goInfo->trap.spellId);
|
||||
|
||||
m_cooldownTime = World::GetGameTimeMS()+(goInfo->trap.cooldown ? goInfo->trap.cooldown : uint32(4))*IN_MILLISECONDS; // template or 4 seconds
|
||||
m_cooldownTime = GameTime::GetGameTimeMS()+(goInfo->trap.cooldown ? goInfo->trap.cooldown : uint32(4))*IN_MILLISECONDS; // template or 4 seconds
|
||||
|
||||
if (goInfo->trap.type == 1) // Deactivate after trigger
|
||||
SetLootState(GO_JUST_DEACTIVATED);
|
||||
@@ -1469,7 +1485,7 @@ void GameObject::Use(Unit* user)
|
||||
if (info->goober.customAnim)
|
||||
SendCustomAnim(GetGoAnimProgress());
|
||||
|
||||
m_cooldownTime = World::GetGameTimeMS()+info->GetAutoCloseTime();
|
||||
m_cooldownTime = GameTime::GetGameTimeMS()+info->GetAutoCloseTime();
|
||||
|
||||
// cast this spell later if provided
|
||||
spellId = info->goober.spellId;
|
||||
@@ -1643,7 +1659,7 @@ void GameObject::Use(Unit* user)
|
||||
if (!info->summoningRitual.animSpell)
|
||||
m_cooldownTime = 0;
|
||||
else // channel ready, maintain this
|
||||
m_cooldownTime = World::GetGameTimeMS()+5*IN_MILLISECONDS;
|
||||
m_cooldownTime = GameTime::GetGameTimeMS()+5*IN_MILLISECONDS;
|
||||
}
|
||||
|
||||
return;
|
||||
@@ -2196,6 +2212,11 @@ void GameObject::SetLootState(LootState state, Unit* unit)
|
||||
}*/
|
||||
}
|
||||
|
||||
void GameObject::SetLootGenerationTime()
|
||||
{
|
||||
m_lootGenerationTime = GameTime::GetGameTime();
|
||||
}
|
||||
|
||||
void GameObject::SetGoState(GOState state)
|
||||
{
|
||||
SetByteValue(GAMEOBJECT_BYTES_1, 0, state);
|
||||
|
||||
Reference in New Issue
Block a user