Core/ObjectMgr: Move some npc_spellclick_spells and vehicle_accessory related errors to startup instead of post-startup runtime
This commit is contained in:
@@ -622,7 +622,7 @@ enum NPCFlags
|
||||
UNIT_NPC_FLAG_AUCTIONEER = 0x00200000, // 100%
|
||||
UNIT_NPC_FLAG_STABLEMASTER = 0x00400000, // 100%
|
||||
UNIT_NPC_FLAG_GUILD_BANKER = 0x00800000, // cause client to send 997 opcode
|
||||
UNIT_NPC_FLAG_SPELLCLICK = 0x01000000, // cause client to send 1015 opcode (spell click), dynamic, set at loading and don't must be set in DB
|
||||
UNIT_NPC_FLAG_SPELLCLICK = 0x01000000, // cause client to send 1015 opcode (spell click)
|
||||
UNIT_NPC_FLAG_PLAYER_VEHICLE = 0x02000000, // players with mounts that have vehicle data should have it set
|
||||
};
|
||||
|
||||
|
||||
@@ -248,8 +248,6 @@ void Vehicle::InstallAccessory(uint32 entry, int8 seatId, bool minion, uint8 typ
|
||||
|
||||
if (!me->HandleSpellClick(accessory, seatId))
|
||||
{
|
||||
sLog->outErrorDb("Vehicle entry %u in vehicle_accessory does not have a valid record in npc_spellclick_spells! Cannot join vehicle.",
|
||||
m_creatureEntry);
|
||||
accessory->AddObjectToRemoveList();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2758,7 +2758,6 @@ void ObjectMgr::LoadVehicleAccessories()
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
do
|
||||
{
|
||||
Field *fields = result->Fetch();
|
||||
@@ -2782,6 +2781,12 @@ void ObjectMgr::LoadVehicleAccessories()
|
||||
continue;
|
||||
}
|
||||
|
||||
if (mSpellClickInfoMap.find(uiEntry) == mSpellClickInfoMap.end())
|
||||
{
|
||||
sLog->outErrorDb("Table `vehicle_accessory`: creature template entry %u has no data in npc_spellclick_spells", uiEntry);
|
||||
continue;
|
||||
}
|
||||
|
||||
m_VehicleAccessoryMap[uiEntry].push_back(VehicleAccessory(uiAccessory, uiSeat, bMinion, uiSummonType, uiSummonTimer));
|
||||
|
||||
++count;
|
||||
@@ -7692,6 +7697,20 @@ void ObjectMgr::LoadNPCSpellClickSpells()
|
||||
}
|
||||
while (result->NextRow());
|
||||
|
||||
// all spellclick data loaded, now we check if there are creatures with NPC_FLAG_SPELLCLICK but with no data
|
||||
// NOTE: It *CAN* be the other way around: no spellclick flag but with spellclick data, in case of creature-only vehicle accessories
|
||||
for (uint32 i = 0; i < sCreatureStorage.MaxEntry; ++i)
|
||||
{
|
||||
if (CreatureInfo const* cInfo = GetCreatureTemplate(i))
|
||||
{
|
||||
if ((cInfo->npcflag & UNIT_NPC_FLAG_SPELLCLICK) && mSpellClickInfoMap.find(i) == mSpellClickInfoMap.end())
|
||||
{
|
||||
sLog->outErrorDb("npc_spellclick_spells: Creature template %u has UNIT_NPC_FLAG_SPELLCLICK but no data in spellclick table! Removing flag", i);
|
||||
const_cast<CreatureInfo*>(cInfo)->npcflag &= ~UNIT_NPC_FLAG_SPELLCLICK;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sLog->outString(">> Loaded %u spellclick definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
|
||||
sLog->outString();
|
||||
}
|
||||
|
||||
@@ -559,8 +559,8 @@ void WorldSession::HandleSpellClick(WorldPacket & recv_data)
|
||||
if (!unit->IsInWorld())
|
||||
return;
|
||||
|
||||
if (!unit->HandleSpellClick(_player))
|
||||
sLog->outErrorDb("Missing npc_spellclick_spells data for creature %u", unit->GetEntry());
|
||||
bool unusedReturnValue = unit->HandleSpellClick(_player);
|
||||
// ^ ignore compiler warning
|
||||
}
|
||||
|
||||
void WorldSession::HandleMirrrorImageDataRequest(WorldPacket & recv_data)
|
||||
|
||||
@@ -1363,8 +1363,11 @@ void World::SetInitialWorldSettings()
|
||||
sLog->outString("Loading Creature Template Addon Data...");
|
||||
sObjectMgr->LoadCreatureAddons(); // must be after LoadCreatureTemplates() and LoadCreatures()
|
||||
|
||||
sLog->outString("Loading UNIT_NPC_FLAG_SPELLCLICK Data...");
|
||||
sObjectMgr->LoadNPCSpellClickSpells();
|
||||
|
||||
sLog->outString("Loading Vehicle Accessories...");
|
||||
sObjectMgr->LoadVehicleAccessories(); // must be after LoadCreatureTemplates()
|
||||
sObjectMgr->LoadVehicleAccessories(); // must be after LoadCreatureTemplates() and LoadNPCSpellClickSpells()
|
||||
|
||||
sLog->outString("Loading Creature Respawn Data..."); // must be after PackInstances()
|
||||
sObjectMgr->LoadCreatureRespawnTimes();
|
||||
@@ -1408,9 +1411,6 @@ void World::SetInitialWorldSettings()
|
||||
sLog->outString("Loading LFG rewards...");
|
||||
sLFGMgr->LoadRewards();
|
||||
|
||||
sLog->outString("Loading UNIT_NPC_FLAG_SPELLCLICK Data...");
|
||||
sObjectMgr->LoadNPCSpellClickSpells();
|
||||
|
||||
sLog->outString("Loading SpellArea Data..."); // must be after quest load
|
||||
sSpellMgr->LoadSpellAreas();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user