feat(Core/Creature): Allow 3 ids per spawn point. TESTING (#10169)

* feat(Core/Creature): Allow 3 ids per spawn point.

* Move GetRandomId to a function

* Update id to id1

* Fixed some errors crashing core and text

* Set ids to lowercase for GetRandomId function

* Update src/server/database/Database/Implementation/WorldDatabase.cpp

Co-authored-by: Kitzunu <24550914+Kitzunu@users.noreply.github.com>

Co-authored-by: acidmanifesto <joshua.lee.betts@gmail.com>
Co-authored-by: Kitzunu <24550914+Kitzunu@users.noreply.github.com>
This commit is contained in:
Malcrom
2022-01-14 19:21:50 -04:00
committed by GitHub
parent cdca93aa7f
commit dfac47a562
17 changed files with 123 additions and 80 deletions

View File

@@ -94,7 +94,7 @@ public:
CreatureData const* spawnpoint = nullptr;
for (auto const& pair : sObjectMgr->GetAllCreatureData())
{
if (pair.second.id != *cId)
if (pair.second.id1 != *cId)
continue;
if (!spawnpoint)

View File

@@ -223,7 +223,7 @@ public:
{
ObjectGuid::LowType guid = sObjectMgr->GenerateCreatureSpawnId();
CreatureData& data = sObjectMgr->NewOrExistCreatureData(guid);
data.id = id;
data.id1 = id;
data.phaseMask = chr->GetPhaseMaskForSpawn();
data.posX = chr->GetTransOffsetX();
data.posY = chr->GetTransOffsetY();
@@ -595,14 +595,14 @@ public:
uint32 displayid = target->GetDisplayId();
uint32 nativeid = target->GetNativeDisplayId();
uint32 entry = target->GetEntry();
uint32 creature_id1 = 0;
uint32 creature_id2 = 0;
float chance_id1 = 0.0f;
uint32 id1 = 0;
uint32 id2 = 0;
uint32 id3 = 0;
if (CreatureData const* cData = target->GetCreatureData())
{
creature_id1 = cData->id;
creature_id2 = cData->id2;
chance_id1 = cData->chance_id1;
id1 = cData->id1;
id2 = cData->id2;
id3 = cData->id3;
}
int64 curRespawnDelay = target->GetRespawnTimeEx() - time(nullptr);
@@ -611,7 +611,7 @@ public:
std::string curRespawnDelayStr = secsToTimeString(uint64(curRespawnDelay), true);
std::string defRespawnDelayStr = secsToTimeString(target->GetRespawnDelay(), true);
handler->PSendSysMessage(LANG_NPCINFO_CHAR, target->GetSpawnId(), target->GetGUID().GetCounter(), entry, creature_id1, creature_id2, chance_id1, displayid, nativeid, faction, npcflags);
handler->PSendSysMessage(LANG_NPCINFO_CHAR, target->GetSpawnId(), target->GetGUID().GetCounter(), entry, id1, id2, id3, displayid, nativeid, faction, npcflags);
handler->PSendSysMessage(LANG_NPCINFO_LEVEL, target->getLevel());
handler->PSendSysMessage(LANG_NPCINFO_EQUIPMENT, target->GetCurrentEquipmentId(), target->GetOriginalEquipmentId());
handler->PSendSysMessage(LANG_NPCINFO_HEALTH, target->GetCreateHealth(), target->GetMaxHealth(), target->GetHealth());

View File

@@ -328,7 +328,7 @@ public:
CreatureData const* spawnpoint = nullptr;
for (auto const& pair : sObjectMgr->GetAllCreatureData())
{
if (pair.second.id != *creatureId)
if (pair.second.id1 != *creatureId)
continue;
if (!spawnpoint)
@@ -362,7 +362,7 @@ public:
return false;
}
CreatureTemplate const* creatureTemplate = ASSERT_NOTNULL(sObjectMgr->GetCreatureTemplate(spawnpoint->id));
CreatureTemplate const* creatureTemplate = ASSERT_NOTNULL(sObjectMgr->GetCreatureTemplate(spawnpoint->id1));
return DoNameTeleport(handler, player, spawnpoint->mapid, { spawnpoint->posX, spawnpoint->posY, spawnpoint->posZ }, creatureTemplate->Name);
}
@@ -372,7 +372,8 @@ public:
std::string normalizedName(name);
WorldDatabase.EscapeString(normalizedName);
QueryResult result = WorldDatabase.PQuery("SELECT c.position_x, c.position_y, c.position_z, c.orientation, c.map, ct.name FROM creature c INNER JOIN creature_template ct ON c.creature_id1 = ct.entry WHERE ct.name LIKE '%s'", normalizedName.c_str());
// May need work //PussyWizardEliteMalcrom
QueryResult result = WorldDatabase.PQuery("SELECT c.position_x, c.position_y, c.position_z, c.orientation, c.map, ct.name FROM creature c INNER JOIN creature_template ct ON c.id1 = ct.entry WHERE ct.name LIKE '%s'", normalizedName.c_str());
if (!result)
{
handler->SendSysMessage(LANG_COMMAND_GOCREATNOTFOUND);

View File

@@ -88,7 +88,7 @@ public:
teamIdInInstance = player->GetTeamId();
}
uint32 entry = data->id;
uint32 entry = data->id1;
switch (entry)
{
case NPC_RESCUED_ALLIANCE_SLAVE:

View File

@@ -1025,7 +1025,7 @@ public:
if (Creature* crusader = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_CAPTAIN_ARNATH + i)))
if (crusader->IsAlive())
{
if (crusader->GetEntry() == crusader->GetCreatureData()->id)
if (crusader->GetEntry() == crusader->GetCreatureData()->id1)
{
crusader->m_Events.AddEvent(new CaptainSurviveTalk(*crusader), crusader->m_Events.CalculateTime(delay));
delay += 6000;
@@ -1207,7 +1207,7 @@ public:
void Reset() override
{
me->SetCorpseDelay(DAY); // leave corpse for a long time so svalna can resurrect
IsUndead = (me->GetCreatureData() && me->GetCreatureData()->id != me->GetEntry());
IsUndead = (me->GetCreatureData() && me->GetCreatureData()->id1 != me->GetEntry());
}
void JustDied(Unit* /*killer*/) override

View File

@@ -490,7 +490,7 @@ public:
TeamIdInInstance = player->GetTeamId();
}
uint32 entry = data->id;
uint32 entry = data->id1;
switch (entry)
{
case NPC_HORDE_GUNSHIP_CANNON: