aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjoschiwald <joschiwald.trinity@gmail.com>2014-06-15 17:49:17 +0200
committerjoschiwald <joschiwald.trinity@gmail.com>2014-06-15 17:49:17 +0200
commite55835a6a9ae09dd4b65de494cba712c322a2419 (patch)
tree4c0989445e1387f04fc8972d4ba7c4d2684d4aab
parent7b3141bfde021f09d9d28eda2467262026a30ba1 (diff)
Core/Creature: load correct vehicleid of difficulty mode npcs if set otherwise inherit from normal mode entry
Closes #8783
-rw-r--r--sql/updates/world/2014_06_15_01_world_creature_template.sql7
-rw-r--r--src/server/game/Entities/Creature/Creature.cpp16
-rw-r--r--src/server/game/Globals/ObjectMgr.cpp26
3 files changed, 32 insertions, 17 deletions
diff --git a/sql/updates/world/2014_06_15_01_world_creature_template.sql b/sql/updates/world/2014_06_15_01_world_creature_template.sql
new file mode 100644
index 00000000000..48358811c94
--- /dev/null
+++ b/sql/updates/world/2014_06_15_01_world_creature_template.sql
@@ -0,0 +1,7 @@
+-- inherit vehicleid and accessory from normal mode npc
+UPDATE `creature_template` SET `VehicleId`=0 WHERE `entry` IN (
+30935, -- Drakkari Rhino (1)
+31749, -- Hover Disk (1)
+31748, -- Hover Disk (1)
+37626 -- Iceborn Proto-Drake (1)
+);
diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp
index 264cae7fa7b..c81ba409495 100644
--- a/src/server/game/Entities/Creature/Creature.cpp
+++ b/src/server/game/Entities/Creature/Creature.cpp
@@ -1173,14 +1173,22 @@ bool Creature::CreateFromProto(uint32 guidlow, uint32 entry, CreatureData const*
SetOriginalEntry(entry);
- if (!vehId)
- vehId = cinfo->VehicleId;
-
- Object::_Create(guidlow, entry, vehId ? HIGHGUID_VEHICLE : HIGHGUID_UNIT);
+ Object::_Create(guidlow, entry, (vehId || cinfo->VehicleId) ? HIGHGUID_VEHICLE : HIGHGUID_UNIT);
if (!UpdateEntry(entry, data))
return false;
+ if (!vehId)
+ {
+ if (GetCreatureTemplate()->VehicleId)
+ {
+ vehId = GetCreatureTemplate()->VehicleId;
+ entry = GetCreatureTemplate()->Entry;
+ }
+ else
+ vehId = cinfo->VehicleId;
+ }
+
if (vehId)
CreateVehicleKit(vehId, entry);
diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp
index 207f80eabe7..72ea1b16864 100644
--- a/src/server/game/Globals/ObjectMgr.cpp
+++ b/src/server/game/Globals/ObjectMgr.cpp
@@ -2951,32 +2951,32 @@ void ObjectMgr::LoadVehicleTemplateAccessories()
{
Field* fields = result->Fetch();
- uint32 uiEntry = fields[0].GetUInt32();
- uint32 uiAccessory = fields[1].GetUInt32();
- int8 uiSeat = int8(fields[2].GetInt8());
- bool bMinion = fields[3].GetBool();
- uint8 uiSummonType = fields[4].GetUInt8();
- uint32 uiSummonTimer= fields[5].GetUInt32();
+ uint32 entry = fields[0].GetUInt32();
+ uint32 accessory = fields[1].GetUInt32();
+ int8 seatId = fields[2].GetInt8();
+ bool isMinion = fields[3].GetBool();
+ uint8 summonType = fields[4].GetUInt8();
+ uint32 summonTimer = fields[5].GetUInt32();
- if (!sObjectMgr->GetCreatureTemplate(uiEntry))
+ if (!sObjectMgr->GetCreatureTemplate(entry))
{
- TC_LOG_ERROR("sql.sql", "Table `vehicle_template_accessory`: creature template entry %u does not exist.", uiEntry);
+ TC_LOG_ERROR("sql.sql", "Table `vehicle_template_accessory`: creature template entry %u does not exist.", entry);
continue;
}
- if (!sObjectMgr->GetCreatureTemplate(uiAccessory))
+ if (!sObjectMgr->GetCreatureTemplate(accessory))
{
- TC_LOG_ERROR("sql.sql", "Table `vehicle_template_accessory`: Accessory %u does not exist.", uiAccessory);
+ TC_LOG_ERROR("sql.sql", "Table `vehicle_template_accessory`: Accessory %u does not exist.", accessory);
continue;
}
- if (_spellClickInfoStore.find(uiEntry) == _spellClickInfoStore.end())
+ if (_spellClickInfoStore.find(entry) == _spellClickInfoStore.end())
{
- TC_LOG_ERROR("sql.sql", "Table `vehicle_template_accessory`: creature template entry %u has no data in npc_spellclick_spells", uiEntry);
+ TC_LOG_ERROR("sql.sql", "Table `vehicle_template_accessory`: creature template entry %u has no data in npc_spellclick_spells", entry);
continue;
}
- _vehicleTemplateAccessoryStore[uiEntry].push_back(VehicleAccessory(uiAccessory, uiSeat, bMinion, uiSummonType, uiSummonTimer));
+ _vehicleTemplateAccessoryStore[entry].push_back(VehicleAccessory(accessory, seatId, isMinion, summonType, summonTimer));
++count;
}