fix(Core/Creature): Remove automated z spawn correction (#18200)
* fix(Core/Creature): Remove automated z spawn correction * comment out unused parameter * remove gridLoad parameter from Creature::LoadCreatureFromDB()
This commit is contained in:
@@ -1627,7 +1627,7 @@ bool Creature::isVendorWithIconSpeak() const
|
|||||||
return m_creatureInfo->IconName == "Speak" && m_creatureData->npcflag & UNIT_NPC_FLAG_VENDOR;
|
return m_creatureInfo->IconName == "Speak" && m_creatureData->npcflag & UNIT_NPC_FLAG_VENDOR;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Creature::LoadCreatureFromDB(ObjectGuid::LowType spawnId, Map* map, bool addToMap, bool gridLoad, bool allowDuplicate /*= false*/)
|
bool Creature::LoadCreatureFromDB(ObjectGuid::LowType spawnId, Map* map, bool addToMap, bool allowDuplicate /*= false*/)
|
||||||
{
|
{
|
||||||
if (!allowDuplicate)
|
if (!allowDuplicate)
|
||||||
{
|
{
|
||||||
@@ -1666,16 +1666,6 @@ bool Creature::LoadCreatureFromDB(ObjectGuid::LowType spawnId, Map* map, bool ad
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// xinef: fix from db
|
|
||||||
if ((addToMap || gridLoad) && !data->overwrittenZ)
|
|
||||||
{
|
|
||||||
float tz = map->GetHeight(data->posX, data->posY, data->posZ + 0.42f, true);
|
|
||||||
if (tz >= data->posZ && tz - data->posZ <= 0.42f)
|
|
||||||
const_cast<CreatureData*>(data)->posZ = tz + 0.1f;
|
|
||||||
|
|
||||||
const_cast<CreatureData*>(data)->overwrittenZ = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// xinef: this has to be assigned before Create function, properly loads equipment id from DB
|
// xinef: this has to be assigned before Create function, properly loads equipment id from DB
|
||||||
m_creatureData = data;
|
m_creatureData = data;
|
||||||
m_spawnId = spawnId;
|
m_spawnId = spawnId;
|
||||||
|
|||||||
@@ -210,8 +210,8 @@ public:
|
|||||||
|
|
||||||
void setDeathState(DeathState s, bool despawn = false) override; // override virtual Unit::setDeathState
|
void setDeathState(DeathState s, bool despawn = false) override; // override virtual Unit::setDeathState
|
||||||
|
|
||||||
bool LoadFromDB(ObjectGuid::LowType guid, Map* map, bool allowDuplicate = false) { return LoadCreatureFromDB(guid, map, false, true, allowDuplicate); }
|
bool LoadFromDB(ObjectGuid::LowType guid, Map* map, bool allowDuplicate = false) { return LoadCreatureFromDB(guid, map, false, allowDuplicate); }
|
||||||
bool LoadCreatureFromDB(ObjectGuid::LowType guid, Map* map, bool addToMap = true, bool gridLoad = false, bool allowDuplicate = false);
|
bool LoadCreatureFromDB(ObjectGuid::LowType guid, Map* map, bool addToMap = true, bool allowDuplicate = false);
|
||||||
void SaveToDB();
|
void SaveToDB();
|
||||||
// overriden in Pet
|
// overriden in Pet
|
||||||
virtual void SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask);
|
virtual void SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask);
|
||||||
|
|||||||
@@ -381,7 +381,6 @@ struct CreatureData
|
|||||||
uint32 dynamicflags{0};
|
uint32 dynamicflags{0};
|
||||||
uint32 ScriptId;
|
uint32 ScriptId;
|
||||||
bool dbData{true};
|
bool dbData{true};
|
||||||
bool overwrittenZ{false};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct CreatureModelInfo
|
struct CreatureModelInfo
|
||||||
|
|||||||
@@ -2466,7 +2466,7 @@ uint32 ObjectMgr::AddCreData(uint32 entry, uint32 mapId, float x, float y, float
|
|||||||
if (!map->Instanceable() && !map->IsRemovalGrid(x, y))
|
if (!map->Instanceable() && !map->IsRemovalGrid(x, y))
|
||||||
{
|
{
|
||||||
Creature* creature = new Creature();
|
Creature* creature = new Creature();
|
||||||
if (!creature->LoadCreatureFromDB(spawnId, map, true, false, true))
|
if (!creature->LoadCreatureFromDB(spawnId, map, true, true))
|
||||||
{
|
{
|
||||||
LOG_ERROR("sql.sql", "AddCreature: Cannot add creature entry {} to map", entry);
|
LOG_ERROR("sql.sql", "AddCreature: Cannot add creature entry {} to map", entry);
|
||||||
delete creature;
|
delete creature;
|
||||||
|
|||||||
@@ -249,7 +249,7 @@ public:
|
|||||||
creature->CleanupsBeforeDelete();
|
creature->CleanupsBeforeDelete();
|
||||||
delete creature;
|
delete creature;
|
||||||
creature = new Creature();
|
creature = new Creature();
|
||||||
if (!creature->LoadCreatureFromDB(spawnId, map, true, false, true))
|
if (!creature->LoadCreatureFromDB(spawnId, map, true, true))
|
||||||
{
|
{
|
||||||
delete creature;
|
delete creature;
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -700,7 +700,7 @@ public:
|
|||||||
wpCreature2->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), chr->GetPhaseMaskForSpawn());
|
wpCreature2->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), chr->GetPhaseMaskForSpawn());
|
||||||
// To call _LoadGoods(); _LoadQuests(); CreateTrainerSpells();
|
// To call _LoadGoods(); _LoadQuests(); CreateTrainerSpells();
|
||||||
//TODO: Should we first use "Create" then use "LoadFromDB"?
|
//TODO: Should we first use "Create" then use "LoadFromDB"?
|
||||||
if (!wpCreature2->LoadCreatureFromDB(wpCreature2->GetSpawnId(), map, true, false, true))
|
if (!wpCreature2->LoadCreatureFromDB(wpCreature2->GetSpawnId(), map, true, true))
|
||||||
{
|
{
|
||||||
handler->PSendSysMessage(LANG_WAYPOINT_VP_NOTCREATED, VISUAL_WAYPOINT);
|
handler->PSendSysMessage(LANG_WAYPOINT_VP_NOTCREATED, VISUAL_WAYPOINT);
|
||||||
delete wpCreature2;
|
delete wpCreature2;
|
||||||
@@ -923,7 +923,7 @@ public:
|
|||||||
|
|
||||||
wpCreature->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), chr->GetPhaseMaskForSpawn());
|
wpCreature->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), chr->GetPhaseMaskForSpawn());
|
||||||
// To call _LoadGoods(); _LoadQuests(); CreateTrainerSpells();
|
// To call _LoadGoods(); _LoadQuests(); CreateTrainerSpells();
|
||||||
if (!wpCreature->LoadCreatureFromDB(wpCreature->GetSpawnId(), map, true, false, true))
|
if (!wpCreature->LoadCreatureFromDB(wpCreature->GetSpawnId(), map, true, true))
|
||||||
{
|
{
|
||||||
handler->PSendSysMessage(LANG_WAYPOINT_VP_NOTCREATED, id);
|
handler->PSendSysMessage(LANG_WAYPOINT_VP_NOTCREATED, id);
|
||||||
delete wpCreature;
|
delete wpCreature;
|
||||||
@@ -975,7 +975,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
creature->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), chr->GetPhaseMaskForSpawn());
|
creature->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), chr->GetPhaseMaskForSpawn());
|
||||||
if (!creature->LoadCreatureFromDB(creature->GetSpawnId(), map, true, false, true))
|
if (!creature->LoadCreatureFromDB(creature->GetSpawnId(), map, true, true))
|
||||||
{
|
{
|
||||||
handler->PSendSysMessage(LANG_WAYPOINT_VP_NOTCREATED, id);
|
handler->PSendSysMessage(LANG_WAYPOINT_VP_NOTCREATED, id);
|
||||||
delete creature;
|
delete creature;
|
||||||
@@ -1024,7 +1024,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
creature->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), chr->GetPhaseMaskForSpawn());
|
creature->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), chr->GetPhaseMaskForSpawn());
|
||||||
if (!creature->LoadCreatureFromDB(creature->GetSpawnId(), map, true, false, true))
|
if (!creature->LoadCreatureFromDB(creature->GetSpawnId(), map, true, true))
|
||||||
{
|
{
|
||||||
handler->PSendSysMessage(LANG_WAYPOINT_NOTCREATED, id);
|
handler->PSendSysMessage(LANG_WAYPOINT_NOTCREATED, id);
|
||||||
delete creature;
|
delete creature;
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ void UpdateCreatureHalaa(ObjectGuid::LowType spawnId, Map* map, float x, float y
|
|||||||
if (!map->Instanceable() && !map->IsRemovalGrid(x, y))
|
if (!map->Instanceable() && !map->IsRemovalGrid(x, y))
|
||||||
{
|
{
|
||||||
Creature* creature = new Creature();
|
Creature* creature = new Creature();
|
||||||
if (!creature->LoadCreatureFromDB(spawnId, map, true, false, true))
|
if (!creature->LoadCreatureFromDB(spawnId, map, true, true))
|
||||||
{
|
{
|
||||||
LOG_ERROR("sql.sql", "AddCreature: Cannot add creature spawnId {} to map", spawnId);
|
LOG_ERROR("sql.sql", "AddCreature: Cannot add creature spawnId {} to map", spawnId);
|
||||||
delete creature;
|
delete creature;
|
||||||
|
|||||||
Reference in New Issue
Block a user