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

@@ -230,7 +230,7 @@ void GameEventMgr::LoadFromDB()
{
{
uint32 oldMSTime = getMSTime();
// 1 2 3 4 5 6 7 8 9 10
// 1 2 3 4 5 6 7 8 9 10
QueryResult result = WorldDatabase.Query("SELECT eventEntry, UNIX_TIMESTAMP(start_time), UNIX_TIMESTAMP(end_time), occurence, length, holiday, holidayStage, description, world_event, announce FROM game_event");
if (!result)
{
@@ -490,8 +490,8 @@ void GameEventMgr::LoadFromDB()
{
uint32 oldMSTime = getMSTime();
// 0 1 2 3 4 5
QueryResult result = WorldDatabase.Query("SELECT creature.guid, creature.creature_id1, creature.creature_id2, game_event_model_equip.eventEntry, game_event_model_equip.modelid, game_event_model_equip.equipment_id "
// 0 1 2 3 4 5 6
QueryResult result = WorldDatabase.Query("SELECT creature.guid, creature.id1, creature.id2, creature.id3, game_event_model_equip.eventEntry, game_event_model_equip.modelid, game_event_model_equip.equipment_id "
"FROM creature JOIN game_event_model_equip ON creature.guid=game_event_model_equip.guid");
if (!result)
@@ -508,8 +508,9 @@ void GameEventMgr::LoadFromDB()
ObjectGuid::LowType guid = fields[0].GetUInt32();
uint32 entry = fields[1].GetUInt32();
//uint32 entry2 = fields[2].GetUInt32();
uint16 event_id = fields[3].GetUInt8();
uint32 entry2 = fields[2].GetUInt32();
uint32 entry3 = fields[3].GetUInt32();
uint16 event_id = fields[4].GetUInt8();
if (event_id >= mGameEventModelEquip.size())
{
@@ -519,15 +520,15 @@ void GameEventMgr::LoadFromDB()
ModelEquipList& equiplist = mGameEventModelEquip[event_id];
ModelEquip newModelEquipSet;
newModelEquipSet.modelid = fields[4].GetUInt32();
newModelEquipSet.equipment_id = fields[5].GetUInt8();
newModelEquipSet.modelid = fields[5].GetUInt32();
newModelEquipSet.equipment_id = fields[6].GetUInt8();
newModelEquipSet.equipement_id_prev = 0;
newModelEquipSet.modelid_prev = 0;
if (newModelEquipSet.equipment_id > 0)
{
int8 equipId = static_cast<int8>(newModelEquipSet.equipment_id);
if (!sObjectMgr->GetEquipmentInfo(entry, equipId))
if ((!sObjectMgr->GetEquipmentInfo(entry, equipId)) || (entry2 && !sObjectMgr->GetEquipmentInfo(entry2, equipId)) || (entry3 && !sObjectMgr->GetEquipmentInfo(entry3, equipId)))
{
LOG_ERROR("sql.sql", "Table `game_event_model_equip` have creature (Guid: %u) with equipment_id %u not found in table `creature_equip_template`, set to no equipment.",
guid, newModelEquipSet.equipment_id);
@@ -888,7 +889,7 @@ void GameEventMgr::LoadFromDB()
newEntry.entry = 0;
if (CreatureData const* data = sObjectMgr->GetCreatureData(guid))
newEntry.entry = data->id;
newEntry.entry = data->id1;
// check validity with event's npcflag
if (!sObjectMgr->IsVendorItemValid(newEntry.entry, newEntry.item, newEntry.maxcount, newEntry.incrtime, newEntry.ExtendedCost, nullptr, nullptr, event_npc_flag))