Move vehicle accesories to DB.
Credit to Malcrom and Manuel for the idea and original patch --HG-- branch : trunk
This commit is contained in:
@@ -0,0 +1,39 @@
|
|||||||
|
CREATE TABLE `vehicle_accessory` (
|
||||||
|
`entry` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT 0,
|
||||||
|
`accessory_entry` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT 0,
|
||||||
|
`seat_id` TINYINT(1) SIGNED NOT NULL DEFAULT 0,
|
||||||
|
`minion` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
|
||||||
|
`description` TEXT NOT NULL,
|
||||||
|
PRIMARY KEY (`entry`, `seat_id`)
|
||||||
|
)
|
||||||
|
COLLATE=utf8_general_ci
|
||||||
|
ENGINE=MyISAM
|
||||||
|
ROW_FORMAT=FIXED
|
||||||
|
AVG_ROW_LENGTH=0
|
||||||
|
|
||||||
|
INSERT INTO `vehicle_accessory` (`entry`,`accessory_entry`,`seat_id`,`minion`,`description`) VALUES
|
||||||
|
(28782,28768,0,0, 'Acherus Deathcharger'),
|
||||||
|
(28312,28319,7,1, 'Wintergrasp Siege Engine'),
|
||||||
|
(32627,32629,7,1, 'Wintergrasp Siege Engine'),
|
||||||
|
(32930,32933,0,1, 'Kologarn'),
|
||||||
|
(32930,32934,1,1, 'Kologarn'),
|
||||||
|
(33109,33167,1,1, 'Salvaged Demolisher'),
|
||||||
|
(33060,33067,7,1, 'Salvaged Siege Engine'),
|
||||||
|
(33113,33114,0,1, 'Flame Leviathan'),
|
||||||
|
(33113,33114,1,1, 'Flame Leviathan'),
|
||||||
|
(33113,33114,2,1, 'Flame Leviathan'),
|
||||||
|
(33113,33114,3,1, 'Flame Leviathan'),
|
||||||
|
(33113,33139,7,1, 'Flame Leviathan'),
|
||||||
|
(33114,33142,1,1, 'Overload Control Device'),
|
||||||
|
(33114,33143,2,1, 'Leviathan Defense Turret'),
|
||||||
|
(33214,33218,1,1, 'Mechanolift 304-A'),
|
||||||
|
(35637,34705,0,0, 'Marshal Jacob Alerius'' Mount'),
|
||||||
|
(35633,34702,0,0, 'Ambrose Boltspark''s Mount'),
|
||||||
|
(35768,34701,0,0, 'Colosos'' Mount'),
|
||||||
|
(34658,34657,0,0, 'Jaelyne Evensong''s Mount'),
|
||||||
|
(35636,34703,0,0, 'Lana Stouthammer''s Mount'),
|
||||||
|
(35638,35572,0,0, 'Mokra the Skullcrusher''s Mount'),
|
||||||
|
(35635,35569,0,0, 'Eressea Dawnsinger''s Mount'),
|
||||||
|
(35640,35571,0,0, 'Runok Wildmane''s Mount'),
|
||||||
|
(35641,35570,0,0, 'Zul''tore''s Mount'),
|
||||||
|
(35634,35617,0,0, 'Deathstalker Visceri''s Mount');
|
||||||
@@ -14886,6 +14886,52 @@ INSERT INTO `trinity_string` (`entry`,`content_default`,`content_loc1`,`content_
|
|||||||
/*!40000 ALTER TABLE `trinity_string` ENABLE KEYS */;
|
/*!40000 ALTER TABLE `trinity_string` ENABLE KEYS */;
|
||||||
UNLOCK TABLES;
|
UNLOCK TABLES;
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Table structure for table `vehicle_accessory`
|
||||||
|
--
|
||||||
|
DROP TABLE IF EXISTS `vehicle_accessory`;
|
||||||
|
CREATE TABLE `vehicle_accessory` (
|
||||||
|
`entry` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT 0,
|
||||||
|
`accessory_entry` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT 0,
|
||||||
|
`seat_id` TINYINT(1) SIGNED NOT NULL DEFAULT 0,
|
||||||
|
`minion` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
|
||||||
|
`description` TEXT NOT NULL,
|
||||||
|
PRIMARY KEY (`entry`, `seat_id`)
|
||||||
|
)
|
||||||
|
COLLATE=utf8_general_ci
|
||||||
|
ENGINE=MyISAM
|
||||||
|
ROW_FORMAT=FIXED
|
||||||
|
AVG_ROW_LENGTH=0
|
||||||
|
|
||||||
|
|
||||||
|
LOCK TABLES `vehicle_accessory` WRITE;
|
||||||
|
INSERT INTO `vehicle_accessory` (`entry`,`accessory_entry`,`seat_id`,`minion`,`description`) VALUES
|
||||||
|
(28782,28768,0,0, 'Acherus Deathcharger'),
|
||||||
|
(28312,28319,7,1, 'Wintergrasp Siege Engine'),
|
||||||
|
(32627,32629,7,1, 'Wintergrasp Siege Engine'),
|
||||||
|
(32930,32933,0,1, 'Kologarn'),
|
||||||
|
(32930,32934,1,1, 'Kologarn'),
|
||||||
|
(33109,33167,1,1, 'Salvaged Demolisher'),
|
||||||
|
(33060,33067,7,1, 'Salvaged Siege Engine'),
|
||||||
|
(33113,33114,0,1, 'Flame Leviathan'),
|
||||||
|
(33113,33114,1,1, 'Flame Leviathan'),
|
||||||
|
(33113,33114,2,1, 'Flame Leviathan'),
|
||||||
|
(33113,33114,3,1, 'Flame Leviathan'),
|
||||||
|
(33113,33139,7,1, 'Flame Leviathan'),
|
||||||
|
(33114,33142,1,1, 'Overload Control Device'),
|
||||||
|
(33114,33143,2,1, 'Leviathan Defense Turret'),
|
||||||
|
(33214,33218,1,1, 'Mechanolift 304-A'),
|
||||||
|
(35637,34705,0,0, 'Marshal Jacob Alerius'' Mount'),
|
||||||
|
(35633,34702,0,0, 'Ambrose Boltspark''s Mount'),
|
||||||
|
(35768,34701,0,0, 'Colosos'' Mount'),
|
||||||
|
(34658,34657,0,0, 'Jaelyne Evensong''s Mount'),
|
||||||
|
(35636,34703,0,0, 'Lana Stouthammer''s Mount'),
|
||||||
|
(35638,35572,0,0, 'Mokra the Skullcrusher''s Mount'),
|
||||||
|
(35635,35569,0,0, 'Eressea Dawnsinger''s Mount'),
|
||||||
|
(35640,35571,0,0, 'Runok Wildmane''s Mount'),
|
||||||
|
(35641,35570,0,0, 'Zul''tore''s Mount'),
|
||||||
|
(35634,35617,0,0, 'Deathstalker Visceri''s Mount');
|
||||||
|
UNLOCK TABLES;
|
||||||
--
|
--
|
||||||
-- Table structure for table `version`
|
-- Table structure for table `version`
|
||||||
--
|
--
|
||||||
|
|||||||
@@ -46,6 +46,7 @@
|
|||||||
#include "WaypointManager.h"
|
#include "WaypointManager.h"
|
||||||
#include "InstanceData.h" //for condition_instance_data
|
#include "InstanceData.h" //for condition_instance_data
|
||||||
#include "GossipDef.h"
|
#include "GossipDef.h"
|
||||||
|
#include "Vehicle.h"
|
||||||
|
|
||||||
INSTANTIATE_SINGLETON_1(ObjectMgr);
|
INSTANTIATE_SINGLETON_1(ObjectMgr);
|
||||||
|
|
||||||
@@ -2362,6 +2363,61 @@ void ObjectMgr::LoadItemPrototypes()
|
|||||||
sLog.outErrorDb("Item (Entry: %u) not exist in `item_template` but referenced in `CharStartOutfit.dnc`", *itr);
|
sLog.outErrorDb("Item (Entry: %u) not exist in `item_template` but referenced in `CharStartOutfit.dnc`", *itr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ObjectMgr::LoadVehicleAccessories()
|
||||||
|
{
|
||||||
|
m_VehicleAccessoryMap.clear(); // needed for reload case
|
||||||
|
VehicleAccessoryList mVehicleList;
|
||||||
|
|
||||||
|
uint32 count = 0;
|
||||||
|
|
||||||
|
QueryResult_AutoPtr result = WorldDatabase.Query("SELECT `entry`,`accessory_entry`,`seat_id`,`minion` FROM `vehicle_accessory`");
|
||||||
|
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
barGoLink bar(1);
|
||||||
|
|
||||||
|
bar.step();
|
||||||
|
|
||||||
|
sLog.outString();
|
||||||
|
sLog.outErrorDb(">> Loaded 0 LoadVehicleAccessor. DB table `vehicle_accessory` is empty.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
barGoLink bar(result->GetRowCount());
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
Field *fields = result->Fetch();
|
||||||
|
bar.step();
|
||||||
|
|
||||||
|
uint32 uiEntry = fields[0].GetUInt32();
|
||||||
|
uint32 uiAccessory = fields[1].GetUInt32();
|
||||||
|
int8 uiSeat = int8(fields[2].GetInt16());
|
||||||
|
bool bMinion = fields[3].GetBool();
|
||||||
|
|
||||||
|
if (!sCreatureStorage.LookupEntry<CreatureInfo>(uiEntry))
|
||||||
|
{
|
||||||
|
sLog.outErrorDb("Table `vehicle_accessory`: creature template entry %u does not exist.", uiEntry);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!sCreatureStorage.LookupEntry<CreatureInfo>(uiAccessory))
|
||||||
|
{
|
||||||
|
sLog.outErrorDb("Table `vehicle_accessory`: Accessory %u does not exist.", uiAccessory);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
mVehicleList = GetVehicleAccessoryList(uiEntry);
|
||||||
|
mVehicleList.push_back(VehicleAccessory(uiAccessory, uiSeat, bMinion));
|
||||||
|
m_VehicleAccessoryMap[uiEntry] = mVehicleList;
|
||||||
|
|
||||||
|
++count;
|
||||||
|
} while (result->NextRow());
|
||||||
|
|
||||||
|
sLog.outString();
|
||||||
|
sLog.outString(">> Loaded %u Vehicle Accessories", count);
|
||||||
|
}
|
||||||
|
|
||||||
void ObjectMgr::LoadItemRequiredTarget()
|
void ObjectMgr::LoadItemRequiredTarget()
|
||||||
{
|
{
|
||||||
m_ItemRequiredTarget.clear(); // needed for reload case
|
m_ItemRequiredTarget.clear(); // needed for reload case
|
||||||
|
|||||||
@@ -40,6 +40,7 @@
|
|||||||
#include "ObjectDefines.h"
|
#include "ObjectDefines.h"
|
||||||
#include "Policies/Singleton.h"
|
#include "Policies/Singleton.h"
|
||||||
#include "Database/SQLStorage.h"
|
#include "Database/SQLStorage.h"
|
||||||
|
#include "Vehicle.h"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <map>
|
#include <map>
|
||||||
@@ -577,6 +578,15 @@ class ObjectMgr
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VehicleAccessoryList GetVehicleAccessoryList(uint32 uiEntry)
|
||||||
|
{
|
||||||
|
VehicleAccessoryList mVehList;
|
||||||
|
VehicleAccessoryMap::const_iterator itr = m_VehicleAccessoryMap.find(uiEntry);
|
||||||
|
if (itr != m_VehicleAccessoryMap.end())
|
||||||
|
mVehList = itr->second;
|
||||||
|
return mVehList;
|
||||||
|
}
|
||||||
|
|
||||||
void LoadGuilds();
|
void LoadGuilds();
|
||||||
void LoadArenaTeams();
|
void LoadArenaTeams();
|
||||||
void LoadGroups();
|
void LoadGroups();
|
||||||
@@ -639,6 +649,7 @@ class ObjectMgr
|
|||||||
void LoadPointOfInterestLocales();
|
void LoadPointOfInterestLocales();
|
||||||
void LoadInstanceTemplate();
|
void LoadInstanceTemplate();
|
||||||
void LoadMailLevelRewards();
|
void LoadMailLevelRewards();
|
||||||
|
void LoadVehicleAccessories();
|
||||||
|
|
||||||
void LoadGossipText();
|
void LoadGossipText();
|
||||||
|
|
||||||
@@ -1047,6 +1058,8 @@ class ObjectMgr
|
|||||||
|
|
||||||
ItemRequiredTargetMap m_ItemRequiredTarget;
|
ItemRequiredTargetMap m_ItemRequiredTarget;
|
||||||
|
|
||||||
|
VehicleAccessoryMap m_VehicleAccessoryMap;
|
||||||
|
|
||||||
typedef std::vector<LocaleConstant> LocalForIndex;
|
typedef std::vector<LocaleConstant> LocalForIndex;
|
||||||
LocalForIndex m_LocalForIndex;
|
LocalForIndex m_LocalForIndex;
|
||||||
|
|
||||||
|
|||||||
@@ -91,7 +91,11 @@ void Vehicle::Install()
|
|||||||
|
|
||||||
void Vehicle::InstallAllAccessories()
|
void Vehicle::InstallAllAccessories()
|
||||||
{
|
{
|
||||||
switch(me->GetEntry())
|
VehicleAccessoryList mVehicleList = objmgr.GetVehicleAccessoryList(me->GetEntry());
|
||||||
|
if (mVehicleList.size())
|
||||||
|
for (VehicleAccessoryList::iterator itr2 = mVehicleList.begin(); itr2 < mVehicleList.end(); ++itr2)
|
||||||
|
InstallAccessory(itr2->uiAccessory, itr2->uiSeat, itr2->bMinion);
|
||||||
|
/*switch(me->GetEntry())
|
||||||
{
|
{
|
||||||
//case 27850:InstallAccessory(27905,1);break;
|
//case 27850:InstallAccessory(27905,1);break;
|
||||||
case 28782:InstallAccessory(28768,0,false);break; // Acherus Deathcharger
|
case 28782:InstallAccessory(28768,0,false);break; // Acherus Deathcharger
|
||||||
@@ -136,7 +140,7 @@ void Vehicle::InstallAllAccessories()
|
|||||||
case 33418:InstallAccessory(35326,0);break; //Silvermoon Hawkstrider
|
case 33418:InstallAccessory(35326,0);break; //Silvermoon Hawkstrider
|
||||||
case 33299:InstallAccessory(35323,0);break; //Darkspear Raptor
|
case 33299:InstallAccessory(35323,0);break; //Darkspear Raptor
|
||||||
case 35491:InstallAccessory(35451,0,false);break; //Black Knight
|
case 35491:InstallAccessory(35451,0,false);break; //Black Knight
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
void Vehicle::Uninstall()
|
void Vehicle::Uninstall()
|
||||||
@@ -162,19 +166,18 @@ void Vehicle::Die()
|
|||||||
void Vehicle::Reset()
|
void Vehicle::Reset()
|
||||||
{
|
{
|
||||||
sLog.outDebug("Vehicle::Reset");
|
sLog.outDebug("Vehicle::Reset");
|
||||||
if(m_usableSeatNum)
|
|
||||||
{
|
|
||||||
if (me->GetTypeId() == TYPEID_PLAYER)
|
if (me->GetTypeId() == TYPEID_PLAYER)
|
||||||
{
|
{
|
||||||
|
if (m_usableSeatNum)
|
||||||
me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_PLAYER_VEHICLE);
|
me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_PLAYER_VEHICLE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
InstallAllAccessories();
|
InstallAllAccessories();
|
||||||
|
if (m_usableSeatNum)
|
||||||
me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK);
|
me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void Vehicle::RemoveAllPassengers()
|
void Vehicle::RemoveAllPassengers()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -38,6 +38,17 @@ struct VehicleSeat
|
|||||||
Unit* passenger;
|
Unit* passenger;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct VehicleAccessory
|
||||||
|
{
|
||||||
|
explicit VehicleAccessory(uint32 _uiAccessory, int8 _uiSeat, bool _bMinion) : uiAccessory(_uiAccessory), uiSeat(_uiSeat), bMinion(_bMinion) {}
|
||||||
|
uint32 uiAccessory;
|
||||||
|
int8 uiSeat;
|
||||||
|
uint32 bMinion;
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef std::vector<VehicleAccessory> VehicleAccessoryList;
|
||||||
|
typedef std::map<uint32, VehicleAccessoryList> VehicleAccessoryMap;
|
||||||
|
|
||||||
typedef std::map<int8, VehicleSeat> SeatMap;
|
typedef std::map<int8, VehicleSeat> SeatMap;
|
||||||
|
|
||||||
class Vehicle
|
class Vehicle
|
||||||
|
|||||||
@@ -1393,6 +1393,9 @@ void World::SetInitialWorldSettings()
|
|||||||
sLog.outString("Loading Creature Template Addon Data...");
|
sLog.outString("Loading Creature Template Addon Data...");
|
||||||
objmgr.LoadCreatureAddons(); // must be after LoadCreatureTemplates() and LoadCreatures()
|
objmgr.LoadCreatureAddons(); // must be after LoadCreatureTemplates() and LoadCreatures()
|
||||||
|
|
||||||
|
sLog.outString("Loading Vehicle Accessories...");
|
||||||
|
objmgr.LoadVehicleAccessories(); // must be after LoadCreatureTemplates()
|
||||||
|
|
||||||
sLog.outString("Loading Creature Respawn Data..."); // must be after PackInstances()
|
sLog.outString("Loading Creature Respawn Data..."); // must be after PackInstances()
|
||||||
objmgr.LoadCreatureRespawnTimes();
|
objmgr.LoadCreatureRespawnTimes();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user