diff --git a/src/server/database/Database/Implementation/WorldDatabase.cpp b/src/server/database/Database/Implementation/WorldDatabase.cpp index 992c01c7e6..49892378ee 100644 --- a/src/server/database/Database/Implementation/WorldDatabase.cpp +++ b/src/server/database/Database/Implementation/WorldDatabase.cpp @@ -82,10 +82,10 @@ void WorldDatabaseConnection::DoPrepareStatements() PrepareStatement(WORLD_SEL_CREATURE_BY_ID, "SELECT guid FROM creature WHERE id = ?", CONNECTION_SYNCH); PrepareStatement(WORLD_SEL_GAMEOBJECT_NEAREST, "SELECT guid, id, position_x, position_y, position_z, map, (POW(position_x - ?, 2) + POW(position_y - ?, 2) + POW(position_z - ?, 2)) AS order_ FROM gameobject WHERE map = ? AND (POW(position_x - ?, 2) + POW(position_y - ?, 2) + POW(position_z - ?, 2)) <= ? ORDER BY order_", CONNECTION_SYNCH); PrepareStatement(WORLD_SEL_CREATURE_NEAREST, "SELECT guid, id, position_x, position_y, position_z, map, (POW(position_x - ?, 2) + POW(position_y - ?, 2) + POW(position_z - ?, 2)) AS order_ FROM creature WHERE map = ? AND (POW(position_x - ?, 2) + POW(position_y - ?, 2) + POW(position_z - ?, 2)) <= ? ORDER BY order_", CONNECTION_SYNCH); - PrepareStatement(WORLD_INS_CREATURE, "INSERT INTO creature (guid, id , map, spawnMask, phaseMask, PhaseId, PhaseGroup, modelid, equipment_id, position_x, position_y, position_z, orientation, spawntimesecs, spawndist, currentwaypoint, curhealth, curmana, MovementType, npcflag, unit_flags, dynamicflags) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC); + PrepareStatement(WORLD_INS_CREATURE, "INSERT INTO creature (guid, id , map, spawnMask, PhaseId, PhaseGroup, modelid, equipment_id, position_x, position_y, position_z, orientation, spawntimesecs, spawndist, currentwaypoint, curhealth, curmana, MovementType, npcflag, unit_flags, dynamicflags) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC); PrepareStatement(WORLD_DEL_GAME_EVENT_CREATURE, "DELETE FROM game_event_creature WHERE guid = ?", CONNECTION_ASYNC); PrepareStatement(WORLD_DEL_GAME_EVENT_MODEL_EQUIP, "DELETE FROM game_event_model_equip WHERE guid = ?", CONNECTION_ASYNC); - PrepareStatement(WORLD_INS_GAMEOBJECT, "INSERT INTO gameobject (guid, id, map, spawnMask, phaseMask, position_x, position_y, position_z, orientation, rotation0, rotation1, rotation2, rotation3, spawntimesecs, animprogress, state) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC); + PrepareStatement(WORLD_INS_GAMEOBJECT, "INSERT INTO gameobject (guid, id, map, spawnMask, position_x, position_y, position_z, orientation, rotation0, rotation1, rotation2, rotation3, spawntimesecs, animprogress, state) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC); PrepareStatement(WORLD_INS_DISABLES, "INSERT INTO disables (entry, sourceType, flags, comment) VALUES (?, ?, ?, ?)", CONNECTION_ASYNC); PrepareStatement(WORLD_SEL_DISABLES, "SELECT entry FROM disables WHERE entry = ? AND sourceType = ?", CONNECTION_SYNCH); PrepareStatement(WORLD_DEL_DISABLES, "DELETE FROM disables WHERE entry = ? AND sourceType = ?", CONNECTION_ASYNC); diff --git a/src/server/game/Battlefield/Battlefield.cpp b/src/server/game/Battlefield/Battlefield.cpp index f3894e1467..cf95c20e3c 100644 --- a/src/server/game/Battlefield/Battlefield.cpp +++ b/src/server/game/Battlefield/Battlefield.cpp @@ -779,7 +779,7 @@ Creature* Battlefield::SpawnCreature(uint32 entry, Position const& pos) } Creature* creature = new Creature(); - if (!creature->Create(map->GenerateLowGuid(), map, PHASEMASK_NORMAL, entry, pos)) + if (!creature->Create(map->GenerateLowGuid(), map, entry, pos)) { TC_LOG_ERROR("bg.battlefield", "Battlefield::SpawnCreature: Can't create creature entry: %u", entry); delete creature; @@ -808,7 +808,7 @@ GameObject* Battlefield::SpawnGameObject(uint32 entry, Position const& pos, Quat if (sObjectMgr->GetGameObjectTypeByEntry(entry) == GAMEOBJECT_TYPE_TRANSPORT) { go = new Transport(); - if (!go->Create(map->GenerateLowGuid(), entry, map, PHASEMASK_NORMAL, pos, rot, 255, GO_STATE_READY)) + if (!go->Create(map->GenerateLowGuid(), entry, map, pos, rot, 255, GO_STATE_READY)) { TC_LOG_ERROR("bg.battlefield", "Battlefield::SpawnGameObject: Gameobject template %u could not be found in the database! Battlefield has not been created!", entry); TC_LOG_ERROR("bg.battlefield", "Battlefield::SpawnGameObject: Could not create gameobject template %u! Battlefield has not been created!", entry); @@ -819,7 +819,7 @@ GameObject* Battlefield::SpawnGameObject(uint32 entry, Position const& pos, Quat else { go = new GameObject(); - if (!go->Create(map->GenerateLowGuid(), entry, map, PHASEMASK_NORMAL, pos, rot, 255, GO_STATE_READY)) + if (!go->Create(map->GenerateLowGuid(), entry, map, pos, rot, 255, GO_STATE_READY)) { TC_LOG_ERROR("bg.battlefield", "Battlefield::SpawnGameObject: Gameobject template %u could not be found in the database! Battlefield has not been created!", entry); TC_LOG_ERROR("bg.battlefield", "Battlefield::SpawnGameObject: Could not create gameobject template %u! Battlefield has not been created!", entry); diff --git a/src/server/game/Battlegrounds/Battleground.cpp b/src/server/game/Battlegrounds/Battleground.cpp index a623c9a1ed..01ddd13fb2 100644 --- a/src/server/game/Battlegrounds/Battleground.cpp +++ b/src/server/game/Battlegrounds/Battleground.cpp @@ -1473,7 +1473,7 @@ bool Battleground::AddObject(uint32 type, uint32 entry, float x, float y, float if (sObjectMgr->GetGameObjectTypeByEntry(entry) == GAMEOBJECT_TYPE_TRANSPORT) { go = new Transport(); - if (!go->Create(GetBgMap()->GenerateLowGuid(), entry, GetBgMap(), PHASEMASK_NORMAL, Position(x, y, z, o), rot, 255, goState)) + if (!go->Create(GetBgMap()->GenerateLowGuid(), entry, GetBgMap(), Position(x, y, z, o), rot, 255, goState)) { TC_LOG_ERROR("bg.battleground", "Battleground::AddObject: cannot create transport (entry: %u) for BG (map: %u, instance id: %u)!", entry, m_MapId, m_InstanceID); @@ -1484,7 +1484,7 @@ bool Battleground::AddObject(uint32 type, uint32 entry, float x, float y, float else { go = new GameObject(); - if (!go->Create(GetBgMap()->GenerateLowGuid(), entry, GetBgMap(), PHASEMASK_NORMAL, Position(x, y, z, o), rot, 255, goState)) + if (!go->Create(GetBgMap()->GenerateLowGuid(), entry, GetBgMap(), Position(x, y, z, o), rot, 255, goState)) { TC_LOG_ERROR("bg.battleground", "Battleground::AddObject: cannot create gameobject (entry: %u) for BG (map: %u, instance id: %u)!", entry, m_MapId, m_InstanceID); @@ -1627,7 +1627,7 @@ Creature* Battleground::AddCreature(uint32 entry, uint32 type, float x, float y, } Creature* creature = new Creature(); - if (!creature->Create(map->GenerateLowGuid(), map, PHASEMASK_NORMAL, entry, { x, y, z, o })) + if (!creature->Create(map->GenerateLowGuid(), map, entry, { x, y, z, o })) { TC_LOG_ERROR("bg.battleground", "Battleground::AddCreature: cannot create creature (entry: %u) for BG (map: %u, instance id: %u)!", entry, m_MapId, m_InstanceID); diff --git a/src/server/game/Entities/AreaTrigger/AreaTrigger.cpp b/src/server/game/Entities/AreaTrigger/AreaTrigger.cpp index ec65e137e6..0b962fbc7f 100644 --- a/src/server/game/Entities/AreaTrigger/AreaTrigger.cpp +++ b/src/server/game/Entities/AreaTrigger/AreaTrigger.cpp @@ -68,7 +68,7 @@ bool AreaTrigger::CreateAreaTrigger(uint32 guidlow, uint32 triggerEntry, Unit* c return false; } - WorldObject::_Create(guidlow, HighGuid::AreaTrigger, caster->GetPhaseMask()); + WorldObject::_Create(guidlow, HighGuid::AreaTrigger); SetEntry(triggerEntry); SetDuration(spell->GetDuration()); diff --git a/src/server/game/Entities/Corpse/Corpse.cpp b/src/server/game/Entities/Corpse/Corpse.cpp index e7bcb1533d..778f6a5570 100644 --- a/src/server/game/Entities/Corpse/Corpse.cpp +++ b/src/server/game/Entities/Corpse/Corpse.cpp @@ -83,7 +83,7 @@ bool Corpse::Create(ObjectGuid::LowType guidlow, Player* owner) return false; } - WorldObject::_Create(guidlow, HighGuid::Corpse, owner->GetPhaseMask()); + WorldObject::_Create(guidlow, HighGuid::Corpse); SetObjectScale(1.0f); SetGuidValue(CORPSE_FIELD_OWNER, owner->GetGUID()); diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index 6d46f0d11c..6f46730261 100644 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -976,7 +976,7 @@ void Creature::Motion_Initialize() GetMotionMaster()->Initialize(); } -bool Creature::Create(ObjectGuid::LowType guidlow, Map* map, uint32 /*phaseMask*/, uint32 entry, Position const& pos, CreatureData const* data /*= nullptr*/, uint32 vehId /*= 0*/, bool dynamic) +bool Creature::Create(ObjectGuid::LowType guidlow, Map* map, uint32 entry, Position const& pos, CreatureData const* data /*= nullptr*/, uint32 vehId /*= 0*/, bool dynamic) { ASSERT(map); SetMap(map); @@ -1189,10 +1189,10 @@ void Creature::SaveToDB() } uint32 mapId = GetTransport() ? GetTransport()->GetGOInfo()->moTransport.mapID : GetMapId(); - SaveToDB(mapId, data->spawnMask, GetPhaseMask()); + SaveToDB(mapId, data->spawnMask); } -void Creature::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask) +void Creature::SaveToDB(uint32 mapid, uint8 spawnMask) { // update in loaded data if (!m_spawnId) @@ -1227,7 +1227,6 @@ void Creature::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask) data.spawnId = m_spawnId; ASSERT(data.spawnId == m_spawnId); data.id = GetEntry(); - data.phaseMask = phaseMask; data.displayid = displayId; data.equipmentId = GetCurrentEquipmentId(); if (!GetTransport()) @@ -1251,8 +1250,8 @@ void Creature::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask) if (!data.spawnGroupData) data.spawnGroupData = sObjectMgr->GetDefaultSpawnGroup(); - data.phaseId = GetDBPhase() > 0 ? GetDBPhase() : 0; - data.phaseGroup = GetDBPhase() < 0 ? abs(GetDBPhase()) : 0; + data.phaseId = GetDBPhase() > 0 ? GetDBPhase() : data.phaseId; + data.phaseGroup = GetDBPhase() < 0 ? -GetDBPhase() : data.phaseGroup; // update in DB SQLTransaction trans = WorldDatabase.BeginTransaction(); @@ -1269,7 +1268,6 @@ void Creature::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask) stmt->setUInt32(index++, GetEntry()); stmt->setUInt16(index++, uint16(mapid)); stmt->setUInt8(index++, spawnMask); - stmt->setUInt32(index++, GetPhaseMask()); stmt->setUInt32(index++, data.phaseId); stmt->setUInt32(index++, data.phaseGroup); stmt->setUInt32(index++, displayId); @@ -1515,7 +1513,7 @@ bool Creature::LoadFromDB(ObjectGuid::LowType spawnId, Map* map, bool addToMap, m_respawnradius = data->spawndist; m_respawnDelay = data->spawntimesecs; - if (!Create(map->GenerateLowGuid(), map, data->phaseMask, data->id, data->spawnPoint, data, 0U, !m_respawnCompatibilityMode)) + if (!Create(map->GenerateLowGuid(), map, data->id, data->spawnPoint, data, 0U, !m_respawnCompatibilityMode)) return false; //We should set first home position, because then AI calls home movement @@ -1904,9 +1902,6 @@ void Creature::setDeathState(DeathState s) RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT); SetMeleeDamageSchool(SpellSchools(cinfo->dmgschool)); - - if (creatureData && GetPhaseMask() != creatureData->phaseMask) - SetPhaseMask(creatureData->phaseMask, false); } Motion_Initialize(); diff --git a/src/server/game/Entities/Creature/Creature.h b/src/server/game/Entities/Creature/Creature.h index caf3d2e24b..d2a9dbc66f 100644 --- a/src/server/game/Entities/Creature/Creature.h +++ b/src/server/game/Entities/Creature/Creature.h @@ -71,7 +71,7 @@ class TC_GAME_API Creature : public Unit, public GridObject, public Ma void DisappearAndDie(); - bool Create(ObjectGuid::LowType guidlow, Map* map, uint32 phaseMask, uint32 entry, Position const& pos, CreatureData const* data = nullptr, uint32 vehId = 0, bool dynamic = false); + bool Create(ObjectGuid::LowType guidlow, Map* map, uint32 entry, Position const& pos, CreatureData const* data = nullptr, uint32 vehId = 0, bool dynamic = false); bool LoadCreaturesAddon(); void SelectLevel(); void UpdateLevelDependantStats(); @@ -175,7 +175,7 @@ class TC_GAME_API Creature : public Unit, public GridObject, public Ma bool LoadFromDB(ObjectGuid::LowType spawnId, Map* map, bool addToMap, bool allowDuplicate); void SaveToDB(); // overriden in Pet - virtual void SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask); + virtual void SaveToDB(uint32 mapid, uint8 spawnMask); static bool DeleteFromDB(ObjectGuid::LowType spawnId); Loot loot; diff --git a/src/server/game/Entities/Creature/TemporarySummon.h b/src/server/game/Entities/Creature/TemporarySummon.h index a459770171..b617d246e9 100644 --- a/src/server/game/Entities/Creature/TemporarySummon.h +++ b/src/server/game/Entities/Creature/TemporarySummon.h @@ -79,7 +79,7 @@ class TC_GAME_API TempSummon : public Creature virtual void UnSummon(uint32 msTime = 0); void RemoveFromWorld() override; void SetTempSummonType(TempSummonType type); - void SaveToDB(uint32 /*mapid*/, uint8 /*spawnMask*/, uint32 /*phaseMask*/) override { } + void SaveToDB(uint32 /*mapid*/, uint8 /*spawnMask*/) override { } Unit* GetSummoner() const; Creature* GetSummonerCreatureBase() const; ObjectGuid GetSummonerGUID() const { return m_summonerGUID; } diff --git a/src/server/game/Entities/DynamicObject/DynamicObject.cpp b/src/server/game/Entities/DynamicObject/DynamicObject.cpp index d7989285d4..ddb872b514 100644 --- a/src/server/game/Entities/DynamicObject/DynamicObject.cpp +++ b/src/server/game/Entities/DynamicObject/DynamicObject.cpp @@ -93,7 +93,7 @@ bool DynamicObject::CreateDynamicObject(ObjectGuid::LowType guidlow, Unit* caste return false; } - WorldObject::_Create(guidlow, HighGuid::DynamicObject, caster->GetPhaseMask()); + WorldObject::_Create(guidlow, HighGuid::DynamicObject); PhasingHandler::InheritPhaseShift(this, caster); SetEntry(spell->Id); diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp index 92774fd267..234a53dbb0 100644 --- a/src/server/game/Entities/GameObject/GameObject.cpp +++ b/src/server/game/Entities/GameObject/GameObject.cpp @@ -200,7 +200,7 @@ void GameObject::RemoveFromWorld() } } -bool GameObject::Create(ObjectGuid::LowType guidlow, uint32 name_id, Map* map, uint32 /*phaseMask*/, Position const& pos, QuaternionData const& rotation, uint32 animprogress, GOState go_state, uint32 artKit /*= 0*/, bool dynamic, ObjectGuid::LowType spawnid) +bool GameObject::Create(ObjectGuid::LowType guidlow, uint32 name_id, Map* map, Position const& pos, QuaternionData const& rotation, uint32 animprogress, GOState go_state, uint32 artKit /*= 0*/, bool dynamic, ObjectGuid::LowType spawnid) { ASSERT(map); SetMap(map); @@ -335,7 +335,7 @@ bool GameObject::Create(ObjectGuid::LowType guidlow, uint32 name_id, Map* map, u if (uint32 linkedEntry = GetGOInfo()->GetLinkedGameObjectEntry()) { GameObject* linkedGO = new GameObject(); - if (linkedGO->Create(map->GenerateLowGuid(), linkedEntry, map, 0, pos, rotation, 255, GO_STATE_READY)) + if (linkedGO->Create(map->GenerateLowGuid(), linkedEntry, map, pos, rotation, 255, GO_STATE_READY)) { SetLinkedTrap(linkedGO); map->AddToMap(linkedGO); @@ -866,10 +866,10 @@ void GameObject::SaveToDB() return; } - SaveToDB(GetMapId(), data->spawnMask, data->phaseMask); + SaveToDB(GetMapId(), data->spawnMask); } -void GameObject::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask) +void GameObject::SaveToDB(uint32 mapid, uint8 spawnMask) { GameObjectTemplate const* goI = GetGOInfo(); if (!goI) @@ -886,7 +886,6 @@ void GameObject::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask) ASSERT(data.spawnId == m_spawnId); data.id = GetEntry(); data.spawnPoint.WorldRelocate(this); - data.phaseMask = phaseMask; data.rotation = m_localRotation; data.spawntimesecs = m_spawnedByDefault ? m_respawnDelayTime : -(int32)m_respawnDelayTime; data.animprogress = GetGoAnimProgress(); @@ -896,6 +895,9 @@ void GameObject::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask) if (!data.spawnGroupData) data.spawnGroupData = sObjectMgr->GetDefaultSpawnGroup(); + data.phaseId = GetDBPhase() > 0 ? GetDBPhase() : data.phaseId; + data.phaseGroup = GetDBPhase() < 0 ? -GetDBPhase() : data.phaseGroup; + // Update in DB SQLTransaction trans = WorldDatabase.BeginTransaction(); @@ -910,7 +912,6 @@ void GameObject::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask) stmt->setUInt32(index++, GetEntry()); stmt->setUInt16(index++, uint16(mapid)); stmt->setUInt8(index++, spawnMask); - stmt->setUInt32(index++, GetPhaseMask()); stmt->setFloat(index++, GetPositionX()); stmt->setFloat(index++, GetPositionY()); stmt->setFloat(index++, GetPositionZ()); @@ -938,7 +939,6 @@ bool GameObject::LoadFromDB(ObjectGuid::LowType spawnId, Map* map, bool addToMap uint32 entry = data->id; //uint32 map_id = data->mapid; // already used before call - uint32 phaseMask = data->phaseMask; uint32 animprogress = data->animprogress; GOState go_state = data->goState; @@ -950,7 +950,7 @@ bool GameObject::LoadFromDB(ObjectGuid::LowType spawnId, Map* map, bool addToMap uint32 gameObjectType = sObjectMgr->GetGameObjectTypeByEntry(entry); ObjectGuid::LowType lowGuid = gameObjectType == GAMEOBJECT_TYPE_TRANSPORT ? map->GenerateLowGuid() : map->GenerateLowGuid(); - if (!Create(lowGuid, entry, map, phaseMask, data->spawnPoint, data->rotation, animprogress, go_state, artKit, !m_respawnCompatibilityMode)) + if (!Create(lowGuid, entry, map, data->spawnPoint, data->rotation, animprogress, go_state, artKit, !m_respawnCompatibilityMode)) return false; PhasingHandler::InitDbPhaseShift(GetPhaseShift(), data->phaseUseFlags, data->phaseId, data->phaseGroup); diff --git a/src/server/game/Entities/GameObject/GameObject.h b/src/server/game/Entities/GameObject/GameObject.h index 9ad6292c86..20bea8e9fc 100644 --- a/src/server/game/Entities/GameObject/GameObject.h +++ b/src/server/game/Entities/GameObject/GameObject.h @@ -89,7 +89,7 @@ class TC_GAME_API GameObject : public WorldObject, public GridObject void RemoveFromWorld() override; void CleanupsBeforeDelete(bool finalCleanup = true) override; - virtual bool Create(ObjectGuid::LowType guidlow, uint32 name_id, Map* map, uint32 phaseMask, Position const& pos, QuaternionData const& rotation, uint32 animprogress, GOState go_state, uint32 artKit = 0, bool dynamic = false, ObjectGuid::LowType spawnid = 0); + virtual bool Create(ObjectGuid::LowType guidlow, uint32 name_id, Map* map, Position const& pos, QuaternionData const& rotation, uint32 animprogress, GOState go_state, uint32 artKit = 0, bool dynamic = false, ObjectGuid::LowType spawnid = 0); void Update(uint32 p_time) override; GameObjectTemplate const* GetGOInfo() const { return m_goInfo; } GameObjectTemplateAddon const* GetTemplateAddon() const { return m_goTemplateAddon; } @@ -115,7 +115,7 @@ class TC_GAME_API GameObject : public WorldObject, public GridObject std::string const& GetNameForLocaleIdx(LocaleConstant locale_idx) const override; void SaveToDB(); - void SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask); + void SaveToDB(uint32 mapid, uint8 spawnMask); bool LoadFromDB(ObjectGuid::LowType spawnId, Map* map, bool addToMap, bool = true); // arg4 is unused, only present to match the signature on Creature static bool DeleteFromDB(ObjectGuid::LowType spawnId); diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp index 7cb4d55aef..9ad15104e5 100644 --- a/src/server/game/Entities/Object/Object.cpp +++ b/src/server/game/Entities/Object/Object.cpp @@ -1185,7 +1185,7 @@ void MovementInfo::OutDebug() WorldObject::WorldObject(bool isWorldObject) : WorldLocation(), LastUsedScriptID(0), m_name(""), m_isActive(false), m_isFarVisible(false), m_isWorldObject(isWorldObject), m_zoneScript(nullptr), m_transport(nullptr), m_zoneId(0), m_areaId(0), m_staticFloorZ(VMAP_INVALID_HEIGHT), m_outdoors(true), m_currMap(nullptr), -m_InstanceId(0), m_phaseMask(PHASEMASK_NORMAL), _dbPhase(0), m_notifyflags(0), m_executed_notifies(0), +m_InstanceId(0), _dbPhase(0), m_notifyflags(0), m_executed_notifies(0), m_aiAnimKitId(0), m_movementAnimKitId(0), m_meleeAnimKitId(0) { m_serverSideVisibility.SetValue(SERVERSIDE_VISIBILITY_GHOST, GHOST_VISIBILITY_ALIVE | GHOST_VISIBILITY_GHOST); @@ -1270,10 +1270,9 @@ void WorldObject::CleanupsBeforeDelete(bool /*finalCleanup*/) transport->RemovePassenger(this); } -void WorldObject::_Create(ObjectGuid::LowType guidlow, HighGuid guidhigh, uint32 phaseMask) +void WorldObject::_Create(ObjectGuid::LowType guidlow, HighGuid guidhigh) { Object::_Create(guidlow, 0, guidhigh); - m_phaseMask = phaseMask; } void WorldObject::UpdatePositionData() @@ -2105,7 +2104,7 @@ TempSummon* Map::SummonCreature(uint32 entry, Position const& pos, SummonPropert break; } - if (!summon->Create(GenerateLowGuid(), this, 0, entry, pos, nullptr, vehId, true)) + if (!summon->Create(GenerateLowGuid(), this, entry, pos, nullptr, vehId, true)) { delete summon; return nullptr; @@ -2223,7 +2222,7 @@ GameObject* WorldObject::SummonGameObject(uint32 entry, Position const& pos, Qua if (goinfo->type == GAMEOBJECT_TYPE_TRANSPORT) { go = new Transport(); - if (!go->Create(map->GenerateLowGuid(), entry, map, GetPhaseMask(), pos, rot, 255, GO_STATE_READY)) + if (!go->Create(map->GenerateLowGuid(), entry, map, pos, rot, 255, GO_STATE_READY)) { delete go; return nullptr; @@ -2232,7 +2231,7 @@ GameObject* WorldObject::SummonGameObject(uint32 entry, Position const& pos, Qua else { go = new GameObject(); - if (!go->Create(map->GenerateLowGuid(), entry, map, GetPhaseMask(), pos, rot, 255, GO_STATE_READY)) + if (!go->Create(map->GenerateLowGuid(), entry, map, pos, rot, 255, GO_STATE_READY)) { delete go; return nullptr; @@ -2601,14 +2600,6 @@ void WorldObject::MovePositionToFirstCollision(Position &pos, float dist, float } } -void WorldObject::SetPhaseMask(uint32 newPhaseMask, bool update) -{ - m_phaseMask = newPhaseMask; - - if (update && IsInWorld()) - UpdateObjectVisibility(); -} - void WorldObject::PlayDistanceSound(uint32 sound_id, Player* target /*= nullptr*/) { WorldPacket data(SMSG_PLAY_OBJECT_SOUND, 4 + 8); diff --git a/src/server/game/Entities/Object/Object.h b/src/server/game/Entities/Object/Object.h index 61c3055960..7e6be75f68 100644 --- a/src/server/game/Entities/Object/Object.h +++ b/src/server/game/Entities/Object/Object.h @@ -284,7 +284,7 @@ class TC_GAME_API WorldObject : public Object, public WorldLocation virtual void Update (uint32 /*time_diff*/) { } - void _Create(ObjectGuid::LowType guidlow, HighGuid guidhigh, uint32 phaseMask); + void _Create(ObjectGuid::LowType guidlow, HighGuid guidhigh); void AddToWorld() override; void RemoveFromWorld() override; @@ -307,7 +307,6 @@ class TC_GAME_API WorldObject : public Object, public WorldLocation uint32 GetInstanceId() const { return m_InstanceId; } - virtual void SetPhaseMask(uint32 newPhaseMask, bool update); bool IsInPhase(WorldObject const* obj) const { return GetPhaseShift().CanSee(obj->GetPhaseShift()); @@ -317,7 +316,6 @@ class TC_GAME_API WorldObject : public Object, public WorldLocation PhaseShift const& GetPhaseShift() const { return _phaseShift; } PhaseShift& GetSuppressedPhaseShift() { return _suppressedPhaseShift; } PhaseShift const& GetSuppressedPhaseShift() const { return _suppressedPhaseShift; } - uint32 GetPhaseMask() const { return m_phaseMask; } int32 GetDBPhase() { return _dbPhase; } // if negative it is used as PhaseGroupId @@ -523,7 +521,6 @@ class TC_GAME_API WorldObject : public Object, public WorldLocation //uint32 m_mapId; // object at map with map_id uint32 m_InstanceId; // in map copy with instance id - uint32 m_phaseMask; // in area phase state PhaseShift _phaseShift; PhaseShift _suppressedPhaseShift; // contains phases for current area but not applied due to conditions int32 _dbPhase; diff --git a/src/server/game/Entities/Pet/Pet.h b/src/server/game/Entities/Pet/Pet.h index a9c00b0232..86cdc09467 100644 --- a/src/server/game/Entities/Pet/Pet.h +++ b/src/server/game/Entities/Pet/Pet.h @@ -180,7 +180,7 @@ class TC_GAME_API Pet : public Guardian uint32 m_petSlot; private: - void SaveToDB(uint32, uint8, uint32) override // override of Creature::SaveToDB - must not be called + void SaveToDB(uint32, uint8) override // override of Creature::SaveToDB - must not be called { ABORT(); } diff --git a/src/server/game/Entities/Transport/Transport.cpp b/src/server/game/Entities/Transport/Transport.cpp index 887a522497..1d1389c934 100644 --- a/src/server/game/Entities/Transport/Transport.cpp +++ b/src/server/game/Entities/Transport/Transport.cpp @@ -155,7 +155,7 @@ void Transport::RemovePassenger(WorldObject* passenger) } } -bool Transport::Create(ObjectGuid::LowType guidlow, uint32 entry, Map* map, uint32 /*phaseMask*/, Position const& pos, QuaternionData const& rotation, uint32 animprogress, GOState /*go_state*/, uint32 artKit /*= 0*/, bool dynamic, ObjectGuid::LowType spawnid) +bool Transport::Create(ObjectGuid::LowType guidlow, uint32 entry, Map* map, Position const& pos, QuaternionData const& rotation, uint32 animprogress, GOState /*go_state*/, uint32 artKit /*= 0*/, bool dynamic, ObjectGuid::LowType spawnid) { ASSERT(map); SetMap(map); @@ -922,7 +922,7 @@ TempSummon* MapTransport::SummonPassenger(uint32 entry, Position const& pos, Tem pos.GetPosition(x, y, z, o); CalculatePassengerPosition(x, y, z, &o); - if (!summon->Create(map->GenerateLowGuid(), map, 0, entry, { x, y, z, o }, nullptr, vehId)) + if (!summon->Create(map->GenerateLowGuid(), map, entry, { x, y, z, o }, nullptr, vehId)) { delete summon; return nullptr; diff --git a/src/server/game/Entities/Transport/Transport.h b/src/server/game/Entities/Transport/Transport.h index 0ffae0b5cc..06738b70e4 100644 --- a/src/server/game/Entities/Transport/Transport.h +++ b/src/server/game/Entities/Transport/Transport.h @@ -32,7 +32,7 @@ class TC_GAME_API Transport : public GameObject, public TransportBase Transport(); ~Transport(); - bool Create(ObjectGuid::LowType guidlow, uint32 entry, Map* map, uint32 /*phaseMask*/, Position const& pos, QuaternionData const& rotation, uint32 animprogress, GOState go_state, uint32 artKit = 0, bool dynamic = false, ObjectGuid::LowType spawnid = 0) override; + bool Create(ObjectGuid::LowType guidlow, uint32 entry, Map* map, Position const& pos, QuaternionData const& rotation, uint32 animprogress, GOState go_state, uint32 artKit = 0, bool dynamic = false, ObjectGuid::LowType spawnid = 0) override; bool CreateTransport(ObjectGuid::LowType guidlow, uint32 entry, uint32 mapid, Position const& pos, uint32 animprogress); void CleanupsBeforeDelete(bool finalCleanup = true) override; diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index c6955841d1..49bbafcb24 100644 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -1935,10 +1935,10 @@ void ObjectMgr::LoadCreatures() // 0 1 2 3 4 5 6 7 8 9 10 QueryResult result = WorldDatabase.Query("SELECT creature.guid, id, map, position_x, position_y, position_z, orientation, modelid, equipment_id, spawntimesecs, spawndist, " - // 11 12 13 14 15 16 17 18 19 20 21 22 - "currentwaypoint, curhealth, curmana, MovementType, spawnMask, phaseMask, eventEntry, pool_entry, creature.npcflag, creature.unit_flags, creature.dynamicflags, creature.phaseUseFlags, " - // 23 24 25 26 - "creature.phaseid, creature.phasegroup, creature.terrainSwapMap, creature.ScriptName " + // 11 12 13 14 15 16 17 18 19 20 21 + "currentwaypoint, curhealth, curmana, MovementType, spawnMask, eventEntry, pool_entry, creature.npcflag, creature.unit_flags, creature.dynamicflags, creature.phaseUseFlags, " + // 22 23 24 25 + "creature.PhaseId, creature.PhaseGroup, creature.terrainSwapMap, creature.ScriptName " "FROM creature " "LEFT OUTER JOIN game_event_creature ON creature.guid = game_event_creature.guid " "LEFT OUTER JOIN pool_creature ON creature.guid = pool_creature.guid"); @@ -1988,17 +1988,16 @@ void ObjectMgr::LoadCreatures() data.curmana = fields[13].GetUInt32(); data.movementType = fields[14].GetUInt8(); data.spawnMask = fields[15].GetUInt8(); - data.phaseMask = fields[16].GetUInt32(); - int16 gameEvent = fields[17].GetInt8(); - uint32 PoolId = fields[18].GetUInt32(); - data.npcflag = fields[19].GetUInt32(); - data.unit_flags = fields[20].GetUInt32(); - data.dynamicflags = fields[21].GetUInt32(); - data.phaseUseFlags = fields[22].GetUInt8(); - data.phaseId = fields[23].GetUInt32(); - data.phaseGroup = fields[24].GetUInt32(); - data.terrainSwapMap = fields[25].GetInt32(); - data.scriptId = GetScriptId(fields[26].GetString()); + int16 gameEvent = fields[16].GetInt8(); + uint32 PoolId = fields[17].GetUInt32(); + data.npcflag = fields[18].GetUInt32(); + data.unit_flags = fields[19].GetUInt32(); + data.dynamicflags = fields[20].GetUInt32(); + data.phaseUseFlags = fields[21].GetUInt8(); + data.phaseId = fields[22].GetUInt32(); + data.phaseGroup = fields[23].GetUInt32(); + data.terrainSwapMap = fields[24].GetInt32(); + data.scriptId = GetScriptId(fields[25].GetString()); data.spawnGroupData = &_spawnGroupDataStore[0]; MapEntry const* mapEntry = sMapStore.LookupEntry(data.spawnPoint.GetMapId()); @@ -2074,12 +2073,6 @@ void ObjectMgr::LoadCreatures() } } - if (data.phaseMask == 0) - { - TC_LOG_ERROR("sql.sql", "Table `creature` has creature (GUID: %u Entry: %u) with `phaseMask`=0 (not visible for anyone), set to 1.", guid, data.id); - data.phaseMask = 1; - } - if (data.phaseUseFlags & ~PHASE_USE_FLAGS_ALL) { TC_LOG_ERROR("sql.sql", "Table `creature` have creature (GUID: %u Entry: %u) has unknown `phaseUseFlags` set, removed unknown value.", guid, data.id); @@ -2195,7 +2188,6 @@ ObjectGuid::LowType ObjectMgr::AddGameObjectData(uint32 entry, uint32 mapId, Pos data.animprogress = 100; data.spawnMask = 1; data.goState = GO_STATE_READY; - data.phaseMask = PHASEMASK_NORMAL; data.artKit = goinfo->type == GAMEOBJECT_TYPE_CAPTURE_POINT ? 21 : 0; data.dbData = false; data.spawnGroupData = GetLegacySpawnGroup(); @@ -2252,7 +2244,6 @@ ObjectGuid::LowType ObjectMgr::AddCreatureData(uint32 entry, uint32 mapId, Posit data.curmana = stats->GenerateMana(cInfo); data.movementType = cInfo->MovementType; data.spawnMask = 1; - data.phaseMask = PHASEMASK_NORMAL; data.dbData = false; data.npcflag = cInfo->npcflag; data.unit_flags = cInfo->unit_flags; @@ -2282,10 +2273,10 @@ void ObjectMgr::LoadGameObjects() // 0 1 2 3 4 5 6 QueryResult result = WorldDatabase.Query("SELECT gameobject.guid, id, map, position_x, position_y, position_z, orientation, " - // 7 8 9 10 11 12 13 14 15 16 17 - "rotation0, rotation1, rotation2, rotation3, spawntimesecs, animprogress, state, spawnMask, phaseMask, eventEntry, pool_entry, " - // 18 19 20 21 22 - "phaseUseFlags, phaseid, phasegroup, terrainSwapMap, ScriptName " + // 7 8 9 10 11 12 13 14 15 16 + "rotation0, rotation1, rotation2, rotation3, spawntimesecs, animprogress, state, spawnMask, eventEntry, pool_entry, " + // 17 18 19 20 21 + "phaseUseFlags, PhaseId, PhaseGroup, terrainSwapMap, ScriptName " "FROM gameobject LEFT OUTER JOIN game_event_gameobject ON gameobject.guid = game_event_gameobject.guid " "LEFT OUTER JOIN pool_gameobject ON gameobject.guid = pool_gameobject.guid"); @@ -2389,12 +2380,11 @@ void ObjectMgr::LoadGameObjects() else data.spawnGroupData = &_spawnGroupDataStore[1]; // force compatibility group for transport spawns - data.phaseMask = fields[15].GetUInt32(); - int16 gameEvent = fields[16].GetInt8(); - uint32 PoolId = fields[17].GetUInt32(); - data.phaseUseFlags = fields[18].GetUInt8(); - data.phaseId = fields[19].GetUInt32(); - data.phaseGroup = fields[20].GetUInt32(); + int16 gameEvent = fields[15].GetInt8(); + uint32 PoolId = fields[16].GetUInt32(); + data.phaseUseFlags = fields[17].GetUInt8(); + data.phaseId = fields[18].GetUInt32(); + data.phaseGroup = fields[19].GetUInt32(); if (data.phaseUseFlags & ~PHASE_USE_FLAGS_ALL) { @@ -2421,7 +2411,7 @@ void ObjectMgr::LoadGameObjects() data.phaseGroup = 0; } - data.terrainSwapMap = fields[21].GetInt32(); + data.terrainSwapMap = fields[20].GetInt32(); if (data.terrainSwapMap != -1) { MapEntry const* terrainSwapEntry = sMapStore.LookupEntry(data.terrainSwapMap); @@ -2469,12 +2459,6 @@ void ObjectMgr::LoadGameObjects() continue; } - if (data.phaseMask == 0) - { - TC_LOG_ERROR("sql.sql", "Table `gameobject` has gameobject (GUID: %u Entry: %u) with `phaseMask`=0 (not visible for anyone), set to 1.", guid, data.id); - data.phaseMask = 1; - } - if (sWorld->getBoolConfig(CONFIG_CALCULATE_GAMEOBJECT_ZONE_AREA_DATA)) { uint32 zoneId = 0; diff --git a/src/server/game/Grids/Notifiers/GridNotifiers.h b/src/server/game/Grids/Notifiers/GridNotifiers.h index edfbf0efd1..56c577ce2f 100644 --- a/src/server/game/Grids/Notifiers/GridNotifiers.h +++ b/src/server/game/Grids/Notifiers/GridNotifiers.h @@ -154,11 +154,10 @@ namespace Trinity { Unit* i_source; WorldPacket* i_message; - uint32 i_phaseMask; float i_distSq; MessageDistDelivererToHostile(Unit* src, WorldPacket* msg, float dist) - : i_source(src), i_message(msg), i_phaseMask(src->GetPhaseMask()), i_distSq(dist * dist) + : i_source(src), i_message(msg), i_distSq(dist * dist) { } diff --git a/src/server/game/Maps/SpawnData.h b/src/server/game/Maps/SpawnData.h index 64a28d0270..a96ff64343 100644 --- a/src/server/game/Maps/SpawnData.h +++ b/src/server/game/Maps/SpawnData.h @@ -63,7 +63,6 @@ struct SpawnData uint32 spawnId = 0; uint32 id = 0; // entry in respective _template table WorldLocation spawnPoint; - uint32 phaseMask = 0; int32 spawntimesecs = 0; uint8 spawnMask = 0; SpawnGroupTemplateData const* spawnGroupData = nullptr; diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index 682491f319..cdecd9e355 100644 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -2987,7 +2987,7 @@ void Spell::EffectSummonObjectWild(SpellEffIndex effIndex) Map* map = target->GetMap(); if (!pGameObj->Create(map->GenerateLowGuid(), gameobject_id, map, - m_caster->GetPhaseMask(), Position(x, y, z, target->GetOrientation()), rot, 255, GO_STATE_READY)) + Position(x, y, z, target->GetOrientation()), rot, 255, GO_STATE_READY)) { delete pGameObj; return; @@ -3584,7 +3584,7 @@ void Spell::EffectDuel(SpellEffIndex effIndex) } //CREATE DUEL FLAG OBJECT - GameObject* pGameObj = new GameObject; + GameObject* pGameObj = new GameObject(); uint32 gameobject_id = m_spellInfo->Effects[effIndex].MiscValue; @@ -3597,7 +3597,7 @@ void Spell::EffectDuel(SpellEffIndex effIndex) }; Map* map = m_caster->GetMap(); - if (!pGameObj->Create(map->GenerateLowGuid(), gameobject_id, map, 0, pos, QuaternionData(), 0, GO_STATE_READY)) + if (!pGameObj->Create(map->GenerateLowGuid(), gameobject_id, map, pos, QuaternionData(), 0, GO_STATE_READY)) { delete pGameObj; return; @@ -4055,7 +4055,7 @@ void Spell::EffectSummonObject(SpellEffIndex effIndex) m_caster->GetClosePoint(x, y, z, DEFAULT_WORLD_OBJECT_SIZE); Map* map = m_caster->GetMap(); - if (!go->Create(map->GenerateLowGuid(), go_id, map, 0, Position(x, y, z, m_caster->GetOrientation()), QuaternionData(), 255, GO_STATE_READY)) + if (!go->Create(map->GenerateLowGuid(), go_id, map, Position(x, y, z, m_caster->GetOrientation()), QuaternionData(), 255, GO_STATE_READY)) { delete go; return; @@ -4802,7 +4802,7 @@ void Spell::EffectTransmitted(SpellEffIndex effIndex) if (goinfo->type == GAMEOBJECT_TYPE_TRANSPORT) { pGameObj = new Transport(); - if (!pGameObj->Create(cMap->GenerateLowGuid(), name_id, cMap, 0, Position(fx, fy, fz, m_caster->GetOrientation()), rot, 255, GO_STATE_READY)) + if (!pGameObj->Create(cMap->GenerateLowGuid(), name_id, cMap, Position(fx, fy, fz, m_caster->GetOrientation()), rot, 255, GO_STATE_READY)) { delete pGameObj; return; @@ -4811,7 +4811,7 @@ void Spell::EffectTransmitted(SpellEffIndex effIndex) else { pGameObj = new GameObject(); - if (!pGameObj->Create(cMap->GenerateLowGuid(), name_id, cMap, 0, Position(fx, fy, fz, m_caster->GetOrientation()), rot, 255, GO_STATE_READY)) + if (!pGameObj->Create(cMap->GenerateLowGuid(), name_id, cMap, Position(fx, fy, fz, m_caster->GetOrientation()), rot, 255, GO_STATE_READY)) { delete pGameObj; return; diff --git a/src/server/scripts/Commands/cs_debug.cpp b/src/server/scripts/Commands/cs_debug.cpp index 6536121f04..d40295c601 100644 --- a/src/server/scripts/Commands/cs_debug.cpp +++ b/src/server/scripts/Commands/cs_debug.cpp @@ -975,7 +975,7 @@ public: Creature* v = new Creature(); Map* map = handler->GetSession()->GetPlayer()->GetMap(); - if (!v->Create(map->GenerateLowGuid(), map, handler->GetSession()->GetPlayer()->GetPhaseMask(), entry, { x, y, z, o }, nullptr, id)) + if (!v->Create(map->GenerateLowGuid(), map, entry, { x, y, z, o }, nullptr, id)) { delete v; return false; diff --git a/src/server/scripts/Commands/cs_gobject.cpp b/src/server/scripts/Commands/cs_gobject.cpp index 7565281564..a778969553 100644 --- a/src/server/scripts/Commands/cs_gobject.cpp +++ b/src/server/scripts/Commands/cs_gobject.cpp @@ -167,7 +167,7 @@ public: guidLow = map->GenerateLowGuid(); } - if (!object->Create(guidLow, objectInfo->entry, map, 0, *player, QuaternionData(), 255, GO_STATE_READY)) + if (!object->Create(guidLow, objectInfo->entry, map, *player, QuaternionData(), 255, GO_STATE_READY)) { delete object; return false; @@ -182,7 +182,7 @@ public: } // fill the gameobject data and save to the db - object->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), player->GetPhaseMask()); + object->SaveToDB(map->GetId(), (1 << map->GetSpawnMode())); guidLow = object->GetSpawnId(); // delete the old object and do a clean load from DB with a fresh new GameObject instance. diff --git a/src/server/scripts/Commands/cs_npc.cpp b/src/server/scripts/Commands/cs_npc.cpp index 63c637760a..21fc53b3db 100644 --- a/src/server/scripts/Commands/cs_npc.cpp +++ b/src/server/scripts/Commands/cs_npc.cpp @@ -354,26 +354,25 @@ public: CreatureData& data = sObjectMgr->NewOrExistCreatureData(guid); data.spawnId = guid; data.id = id; - data.phaseMask = chr->GetPhaseMask(); data.spawnPoint.Relocate(chr->GetTransOffsetX(), chr->GetTransOffsetY(), chr->GetTransOffsetZ(), chr->GetTransOffsetO()); if (Creature* creature = trans->CreateNPCPassenger(guid, &data)) { - creature->SaveToDB(trans->GetGOInfo()->moTransport.mapID, 1 << map->GetSpawnMode(), chr->GetPhaseMask()); + creature->SaveToDB(trans->GetGOInfo()->moTransport.mapID, 1 << map->GetSpawnMode()); sObjectMgr->AddCreatureToGrid(guid, &data); } return true; } Creature* creature = new Creature(); - if (!creature->Create(map->GenerateLowGuid(), map, chr->GetPhaseMask(), id, *chr)) + if (!creature->Create(map->GenerateLowGuid(), map, id, *chr)) { delete creature; return false; } PhasingHandler::InheritPhaseShift(creature, chr); - creature->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), chr->GetPhaseMask()); + creature->SaveToDB(map->GetId(), (1 << map->GetSpawnMode())); ObjectGuid::LowType db_guid = creature->GetSpawnId(); diff --git a/src/server/scripts/Commands/cs_wp.cpp b/src/server/scripts/Commands/cs_wp.cpp index 4a73fb40c8..286991105c 100644 --- a/src/server/scripts/Commands/cs_wp.cpp +++ b/src/server/scripts/Commands/cs_wp.cpp @@ -678,7 +678,7 @@ public: // re-create Creature* wpCreature = new Creature(); - if (!wpCreature->Create(map->GenerateLowGuid(), map, chr->GetPhaseMask(), VISUAL_WAYPOINT, *chr)) + if (!wpCreature->Create(map->GenerateLowGuid(), map, VISUAL_WAYPOINT, *chr)) { handler->PSendSysMessage(LANG_WAYPOINT_VP_NOTCREATED, VISUAL_WAYPOINT); delete wpCreature; @@ -687,7 +687,7 @@ public: PhasingHandler::InheritPhaseShift(wpCreature, chr); - wpCreature->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), chr->GetPhaseMask()); + wpCreature->SaveToDB(map->GetId(), (1 << map->GetSpawnMode())); // To call _LoadGoods(); _LoadQuests(); CreateTrainerSpells(); if (!wpCreature->LoadFromDB(wpCreature->GetSpawnId(), map, true, true)) { @@ -878,7 +878,7 @@ public: float o = chr->GetOrientation(); Creature* wpCreature = new Creature(); - if (!wpCreature->Create(map->GenerateLowGuid(), map, chr->GetPhaseMask(), id, { x, y, z, o })) + if (!wpCreature->Create(map->GenerateLowGuid(), map, id, { x, y, z, o })) { handler->PSendSysMessage(LANG_WAYPOINT_VP_NOTCREATED, id); delete wpCreature; @@ -894,7 +894,7 @@ public: stmt->setUInt32(2, point); WorldDatabase.Execute(stmt); - wpCreature->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), chr->GetPhaseMask()); + wpCreature->SaveToDB(map->GetId(), (1 << map->GetSpawnMode())); // To call _LoadGoods(); _LoadQuests(); CreateTrainerSpells(); if (!wpCreature->LoadFromDB(wpCreature->GetSpawnId(), map, true, true)) { @@ -942,7 +942,7 @@ public: Map* map = chr->GetMap(); Creature* creature = new Creature(); - if (!creature->Create(map->GenerateLowGuid(), map, chr->GetPhaseMask(), id, { x, y, z, o })) + if (!creature->Create(map->GenerateLowGuid(), map, id, { x, y, z, o })) { handler->PSendSysMessage(LANG_WAYPOINT_VP_NOTCREATED, id); delete creature; @@ -951,7 +951,7 @@ public: PhasingHandler::InheritPhaseShift(creature, chr); - creature->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), chr->GetPhaseMask()); + creature->SaveToDB(map->GetId(), (1 << map->GetSpawnMode())); if (!creature->LoadFromDB(creature->GetSpawnId(), map, true, true)) { handler->PSendSysMessage(LANG_WAYPOINT_VP_NOTCREATED, id); @@ -993,7 +993,7 @@ public: Map* map = chr->GetMap(); Creature* creature = new Creature(); - if (!creature->Create(map->GenerateLowGuid(), map, chr->GetPhaseMask(), id, { x, y, z, o })) + if (!creature->Create(map->GenerateLowGuid(), map, id, { x, y, z, o })) { handler->PSendSysMessage(LANG_WAYPOINT_NOTCREATED, id); delete creature; @@ -1002,7 +1002,7 @@ public: PhasingHandler::InheritPhaseShift(creature, chr); - creature->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), chr->GetPhaseMask()); + creature->SaveToDB(map->GetId(), (1 << map->GetSpawnMode())); if (!creature->LoadFromDB(creature->GetSpawnId(), map, true, true)) { handler->PSendSysMessage(LANG_WAYPOINT_NOTCREATED, id); diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingDescent/boss_nefarians_end.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingDescent/boss_nefarians_end.cpp index 3926b0b723..0dc43e9983 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingDescent/boss_nefarians_end.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingDescent/boss_nefarians_end.cpp @@ -849,7 +849,7 @@ private: { TempSummon* summon = new TempSummon(nullptr, me, false); - if (!summon->Create(map->GenerateLowGuid(), map, 0, itr->entry, itr->pos, nullptr, 0, true)) + if (!summon->Create(map->GenerateLowGuid(), map, itr->entry, itr->pos, nullptr, 0, true)) { delete summon; continue; diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/instance_blackwing_lair.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/instance_blackwing_lair.cpp index 303fd2dda1..126b354542 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/instance_blackwing_lair.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/instance_blackwing_lair.cpp @@ -102,17 +102,19 @@ public: } } + uint32 GetGameObjectEntry(ObjectGuid::LowType /*spawnId*/, uint32 entry) override + { + if (entry == GO_BLACK_DRAGON_EGG && GetBossState(DATA_FIREMAW) == DONE) + return 0; + return entry; + } + void OnGameObjectCreate(GameObject* go) override { InstanceScript::OnGameObjectCreate(go); if (go->GetEntry() == GO_BLACK_DRAGON_EGG) - { - if (GetBossState(DATA_FIREMAW) == DONE) - go->SetPhaseMask(2, true); - else - EggList.push_back(go->GetGUID()); - } + EggList.push_back(go->GetGUID()); } void OnGameObjectRemove(GameObject* go) override @@ -255,7 +257,6 @@ public: case EVENT_RESPAWN_NEFARIUS: if (Creature* nefarius = GetCreature(DATA_LORD_VICTOR_NEFARIUS)) { - nefarius->SetPhaseMask(1, true); nefarius->setActive(true); nefarius->SetFarVisible(true); nefarius->Respawn(); diff --git a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp index cf887580e1..de3f2d52d4 100644 --- a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp +++ b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp @@ -22,6 +22,7 @@ #include "InstanceScript.h" #include "Map.h" #include "ObjectAccessor.h" +#include "PhasingHandler.h" #include "Player.h" #include "ruby_sanctum.h" #include "ScriptedCreature.h" @@ -411,7 +412,7 @@ class boss_twilight_halion : public CreatureScript DoCastSelf(SPELL_DUSK_SHROUD, true); me->SetHealth(halion->GetHealth()); - me->SetPhaseMask(0x20, true); + PhasingHandler::AddPhase(me, 174, true); me->SetReactState(REACT_DEFENSIVE); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT); events.ScheduleEvent(EVENT_TAIL_LASH, Seconds(12)); @@ -1208,12 +1209,16 @@ class npc_combustion_consumption : public CreatureScript case NPC_COMBUSTION: _explosionSpell = SPELL_FIERY_COMBUSTION_EXPLOSION; _damageSpell = SPELL_COMBUSTION_DAMAGE_AURA; - creature->SetPhaseMask(IsHeroic() ? 0x21 : 0x01, true); + PhasingHandler::AddPhase(me, DEFAULT_PHASE, true); + if (IsHeroic()) + PhasingHandler::AddPhase(me, 174, true); break; case NPC_CONSUMPTION: _explosionSpell = SPELL_SOUL_CONSUMPTION_EXPLOSION; _damageSpell = SPELL_CONSUMPTION_DAMAGE_AURA; - creature->SetPhaseMask(IsHeroic() ? 0x21 : 0x20, true); + PhasingHandler::AddPhase(creature, 174, true); + if (IsHeroic()) + PhasingHandler::AddPhase(creature, DEFAULT_PHASE, true); break; default: // Should never happen _explosionSpell = 0; @@ -1351,12 +1356,12 @@ class go_twilight_portal : public GameObjectScript switch (gameobject->GetEntry()) { case GO_HALION_PORTAL_EXIT: - gameobject->SetPhaseMask(0x20, true); + PhasingHandler::AddPhase(gameobject, 174, true); _spellId = gameobject->GetGOInfo()->goober.spellId; break; case GO_HALION_PORTAL_1: case GO_HALION_PORTAL_2: - gameobject->SetPhaseMask(0x1, true); + PhasingHandler::AddPhase(gameobject, DEFAULT_PHASE, true); /// Because WDB template has non-existent spell ID, not seen in sniffs either, meh _spellId = SPELL_TWILIGHT_REALM; break; diff --git a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/instance_halls_of_reflection.cpp b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/instance_halls_of_reflection.cpp index 620d7c331e..5efd1e0212 100644 --- a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/instance_halls_of_reflection.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/instance_halls_of_reflection.cpp @@ -22,6 +22,7 @@ #include "halls_of_reflection.h" #include "InstanceScript.h" #include "Map.h" +#include "PhasingHandler.h" #include "Player.h" #include "TemporarySummon.h" #include "Transport.h" @@ -143,7 +144,7 @@ class instance_halls_of_reflection : public InstanceMapScript case NPC_FROSTSWORN_GENERAL: FrostswornGeneralGUID = creature->GetGUID(); if (GetBossState(DATA_MARWYN) == DONE) - creature->SetPhaseMask(1, true); + PhasingHandler::AddPhase(creature, 170, true); break; case NPC_JAINA_ESCAPE: case NPC_SYLVANAS_ESCAPE: @@ -325,7 +326,7 @@ class instance_halls_of_reflection : public InstanceMapScript HandleGameObject(ImpenetrableDoorGUID, true); DoUpdateWorldState(WORLD_STATE_HOR_WAVES_ENABLED, 0); if (Creature* general = instance->GetCreature(FrostswornGeneralGUID)) - general->SetPhaseMask(1, true); + PhasingHandler::AddPhase(general, 170, true); SpawnGunship(); SpawnEscapeEvent(); diff --git a/src/server/scripts/Northrend/Nexus/EyeOfEternity/instance_eye_of_eternity.cpp b/src/server/scripts/Northrend/Nexus/EyeOfEternity/instance_eye_of_eternity.cpp index 7e42daec89..78dede5cfd 100644 --- a/src/server/scripts/Northrend/Nexus/EyeOfEternity/instance_eye_of_eternity.cpp +++ b/src/server/scripts/Northrend/Nexus/EyeOfEternity/instance_eye_of_eternity.cpp @@ -90,7 +90,7 @@ public: void SpawnGameObject(uint32 entry, Position const& pos) { GameObject* go = new GameObject(); - if (!go->Create(instance->GenerateLowGuid(), entry, instance, PHASEMASK_NORMAL, pos, QuaternionData(), 255, GO_STATE_READY)) + if (!go->Create(instance->GenerateLowGuid(), entry, instance, pos, QuaternionData(), 255, GO_STATE_READY)) { delete go; return; diff --git a/src/server/scripts/Northrend/Nexus/Oculus/instance_oculus.cpp b/src/server/scripts/Northrend/Nexus/Oculus/instance_oculus.cpp index d9ed526ea6..ce9643260f 100644 --- a/src/server/scripts/Northrend/Nexus/Oculus/instance_oculus.cpp +++ b/src/server/scripts/Northrend/Nexus/Oculus/instance_oculus.cpp @@ -23,6 +23,7 @@ #include "Map.h" #include "MotionMaster.h" #include "oculus.h" +#include "PhasingHandler.h" #include "TemporarySummon.h" #include "WorldPacket.h" @@ -62,17 +63,17 @@ class instance_oculus : public InstanceMapScript case NPC_VAROS: VarosGUID = creature->GetGUID(); if (GetBossState(DATA_DRAKOS) == DONE) - creature->SetPhaseMask(1, true); + PhasingHandler::AddPhase(creature, 170, true); break; case NPC_UROM: UromGUID = creature->GetGUID(); if (GetBossState(DATA_VAROS) == DONE) - creature->SetPhaseMask(1, true); + PhasingHandler::AddPhase(creature, 170, true); break; case NPC_EREGOS: EregosGUID = creature->GetGUID(); if (GetBossState(DATA_UROM) == DONE) - creature->SetPhaseMask(1, true); + PhasingHandler::AddPhase(creature, 170, true); break; case NPC_CENTRIFUGE_CONSTRUCT: if (creature->IsAlive()) @@ -105,7 +106,7 @@ class instance_oculus : public InstanceMapScript case NPC_GREATER_WHELP: if (GetBossState(DATA_UROM) == DONE) { - creature->SetPhaseMask(1, true); + PhasingHandler::AddPhase(creature, 170, true); GreaterWhelpList.push_back(creature->GetGUID()); } break; @@ -183,7 +184,7 @@ class instance_oculus : public InstanceMapScript DoUpdateWorldState(WORLD_STATE_CENTRIFUGE_CONSTRUCT_AMOUNT, CentrifugueConstructCounter); FreeDragons(); if (Creature* varos = instance->GetCreature(VarosGUID)) - varos->SetPhaseMask(1, true); + PhasingHandler::AddPhase(varos, 170, true); events.ScheduleEvent(EVENT_VAROS_INTRO, 15000); } break; @@ -192,7 +193,7 @@ class instance_oculus : public InstanceMapScript { DoUpdateWorldState(WORLD_STATE_CENTRIFUGE_CONSTRUCT_SHOW, 0); if (Creature* urom = instance->GetCreature(UromGUID)) - urom->SetPhaseMask(1, true); + PhasingHandler::AddPhase(urom, 170, true); } break; case DATA_UROM: @@ -200,7 +201,7 @@ class instance_oculus : public InstanceMapScript { if (Creature* eregos = instance->GetCreature(EregosGUID)) { - eregos->SetPhaseMask(1, true); + PhasingHandler::AddPhase(eregos, 170, true); GreaterWhelps(); events.ScheduleEvent(EVENT_EREGOS_INTRO, 5000); } @@ -302,7 +303,7 @@ class instance_oculus : public InstanceMapScript { for (ObjectGuid guid : GreaterWhelpList) if (Creature* gwhelp = instance->GetCreature(guid)) - gwhelp->SetPhaseMask(1, true); + PhasingHandler::AddPhase(gwhelp, 170, true); } protected: diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp index da7c628ef7..82ff186862 100644 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp @@ -175,10 +175,10 @@ bool OutdoorPvPSI::HandleDropFlag(Player* player, uint32 spellId) if (player->GetDistance(atEntry->Pos.X, atEntry->Pos.Y, atEntry->Pos.Z) > 5.0f + atEntry->Radius) { // he dropped it further, summon mound - GameObject* go = new GameObject; + GameObject* go = new GameObject(); Map* map = player->GetMap(); - if (!go->Create(map->GenerateLowGuid(), SI_SILITHYST_MOUND, map, player->GetPhaseMask(), *player, QuaternionData(), 255, GO_STATE_READY)) + if (!go->Create(map->GenerateLowGuid(), SI_SILITHYST_MOUND, map, *player, QuaternionData(), 255, GO_STATE_READY)) { delete go; return true; @@ -208,7 +208,7 @@ bool OutdoorPvPSI::HandleDropFlag(Player* player, uint32 spellId) GameObject* go = new GameObject; Map* map = player->GetMap(); - if (!go->Create(map->GenerateLowGuid(), SI_SILITHYST_MOUND, map, player->GetPhaseMask(), *player, QuaternionData(), 255, GO_STATE_READY)) + if (!go->Create(map->GenerateLowGuid(), SI_SILITHYST_MOUND, map, *player, QuaternionData(), 255, GO_STATE_READY)) { delete go; return true; diff --git a/src/server/scripts/World/world_map_scripts.cpp b/src/server/scripts/World/world_map_scripts.cpp index 3c172fafe5..35c1acecb4 100644 --- a/src/server/scripts/World/world_map_scripts.cpp +++ b/src/server/scripts/World/world_map_scripts.cpp @@ -70,7 +70,7 @@ class world_map_deeprun_tram: public WorldMapScript { GameObject* transport = new Transport(); - if (!transport->Create(map->GenerateLowGuid(), GO_SUBWAY + i, map, 0, SubwaysPos[i], worldRotation, 255, GO_STATE_READY)) + if (!transport->Create(map->GenerateLowGuid(), GO_SUBWAY + i, map, SubwaysPos[i], worldRotation, 255, GO_STATE_READY)) { delete transport; continue;