aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMachiavelli <machiavelli.trinity@gmail.com>2011-03-06 11:12:19 +0100
committerMachiavelli <machiavelli.trinity@gmail.com>2011-03-06 11:12:19 +0100
commit6c4a0354a27e3149244a892cbcc1a2ed5922a06d (patch)
tree4b0009cb318bac9f8e9e82d15439d10389bc207f /src
parentdf97ce76258959a02e52fde2819d603234115b33 (diff)
Core/ObjectMgr: Move some npc_spellclick_spells and vehicle_accessory related errors to startup instead of post-startup runtime
Diffstat (limited to 'src')
-rwxr-xr-xsrc/server/game/Entities/Unit/Unit.h2
-rwxr-xr-xsrc/server/game/Entities/Vehicle/Vehicle.cpp2
-rwxr-xr-xsrc/server/game/Globals/ObjectMgr.cpp21
-rwxr-xr-xsrc/server/game/Server/Protocol/Handlers/SpellHandler.cpp4
-rwxr-xr-xsrc/server/game/World/World.cpp8
5 files changed, 27 insertions, 10 deletions
diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h
index 1aa55488fc8..a82f46a154a 100755
--- a/src/server/game/Entities/Unit/Unit.h
+++ b/src/server/game/Entities/Unit/Unit.h
@@ -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
};
diff --git a/src/server/game/Entities/Vehicle/Vehicle.cpp b/src/server/game/Entities/Vehicle/Vehicle.cpp
index 69dd3cc18a0..daad66cb0e0 100755
--- a/src/server/game/Entities/Vehicle/Vehicle.cpp
+++ b/src/server/game/Entities/Vehicle/Vehicle.cpp
@@ -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;
}
diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp
index 280dc734182..48cca2df14b 100755
--- a/src/server/game/Globals/ObjectMgr.cpp
+++ b/src/server/game/Globals/ObjectMgr.cpp
@@ -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();
}
diff --git a/src/server/game/Server/Protocol/Handlers/SpellHandler.cpp b/src/server/game/Server/Protocol/Handlers/SpellHandler.cpp
index 82ab80172b7..062d7fae437 100755
--- a/src/server/game/Server/Protocol/Handlers/SpellHandler.cpp
+++ b/src/server/game/Server/Protocol/Handlers/SpellHandler.cpp
@@ -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)
diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp
index 586a9316576..aded5e9e22e 100755
--- a/src/server/game/World/World.cpp
+++ b/src/server/game/World/World.cpp
@@ -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();