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

@@ -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);