aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMachiavelli <machiavelli.trinity@gmail.com>2011-02-22 23:47:28 +0100
committerMachiavelli <machiavelli.trinity@gmail.com>2011-02-22 23:47:28 +0100
commit918f1ce8ecae8d7d200cbd25d52bacba843c8f39 (patch)
tree2f602c7369ac670dc20feb87eaa2bc9b53d2258e
parenta8f9936bea6d114de585ab393020c0324c075c8b (diff)
Core/Vehicles:
- Allow configurable TempSummonType and timer for vehicle_accessory table instead of hard coded values - Reimplement some earlier charted VehicleSeatFlagsB, that were temporarily removed because of VEHICLE_SEAT_FLAG_UNCONTROLLED (they now work in conjunction with eachother)
-rw-r--r--sql/updates/world/2011_02_22_4_world_vehicle_accessory.sql3
-rwxr-xr-xsrc/server/game/DataStores/DBCStructure.h3
-rwxr-xr-xsrc/server/game/Entities/Vehicle/Vehicle.cpp6
-rwxr-xr-xsrc/server/game/Entities/Vehicle/Vehicle.h13
-rwxr-xr-xsrc/server/game/Globals/ObjectMgr.cpp9
5 files changed, 22 insertions, 12 deletions
diff --git a/sql/updates/world/2011_02_22_4_world_vehicle_accessory.sql b/sql/updates/world/2011_02_22_4_world_vehicle_accessory.sql
new file mode 100644
index 00000000000..3d23f85c76a
--- /dev/null
+++ b/sql/updates/world/2011_02_22_4_world_vehicle_accessory.sql
@@ -0,0 +1,3 @@
+ALTER TABLE `vehicle_accessory`
+ADD `summontype` TINYINT(3) UNSIGNED NOT NULL DEFAULT 6 COMMENT "see enum TempSummonType",
+ADD `summontimer` INT(10) UNSIGNED NOT NULL DEFAULT 30000 COMMENT "timer, only relevant for certain summontypes";
diff --git a/src/server/game/DataStores/DBCStructure.h b/src/server/game/DataStores/DBCStructure.h
index e004c1492d6..1bedd1f41eb 100755
--- a/src/server/game/DataStores/DBCStructure.h
+++ b/src/server/game/DataStores/DBCStructure.h
@@ -1867,7 +1867,8 @@ struct VehicleSeatEntry
bool CanEnterOrExit() const { return m_flags & VEHICLE_SEAT_FLAG_CAN_ENTER_OR_EXIT; }
bool CanSwitchFromSeat() const { return m_flags & VEHICLE_SEAT_FLAG_B_CANSWITCH; }
- bool IsUsableByOverride() const { return m_flags & VEHICLE_SEAT_FLAG_UNCONTROLLED; }
+ bool IsUsableByOverride() const { return (m_flags & VEHICLE_SEAT_FLAG_UNCONTROLLED)
+ || (m_flagsB & VEHICLE_SEAT_FLAG_B_USABLE_FORCED | VEHICLE_SEAT_FLAG_B_USABLE_FORCED_2 | VEHICLE_SEAT_FLAG_B_USABLE_FORCED_3); }
bool IsEjectable() const { return m_flagsB & VEHICLE_SEAT_FLAG_B_EJECTABLE; }
};
diff --git a/src/server/game/Entities/Vehicle/Vehicle.cpp b/src/server/game/Entities/Vehicle/Vehicle.cpp
index 4709df49cc9..f4b93dc801c 100755
--- a/src/server/game/Entities/Vehicle/Vehicle.cpp
+++ b/src/server/game/Entities/Vehicle/Vehicle.cpp
@@ -124,7 +124,7 @@ void Vehicle::InstallAllAccessories(uint32 entry)
return;
for (VehicleAccessoryList::const_iterator itr = mVehicleList->begin(); itr != mVehicleList->end(); ++itr)
- InstallAccessory(itr->uiAccessory, itr->uiSeat, itr->bMinion);
+ InstallAccessory(itr->uiAccessory, itr->uiSeat, itr->bMinion, itr->uiSummonType, itr->uiSummonTime);
}
void Vehicle::Uninstall()
@@ -248,7 +248,7 @@ int8 Vehicle::GetNextEmptySeat(int8 seatId, bool next) const
return seat->first;
}
-void Vehicle::InstallAccessory(uint32 entry, int8 seatId, bool minion)
+void Vehicle::InstallAccessory(uint32 entry, int8 seatId, bool minion, uint8 type, uint32 summonTime)
{
if (Unit *passenger = GetPassenger(seatId))
{
@@ -263,7 +263,7 @@ void Vehicle::InstallAccessory(uint32 entry, int8 seatId, bool minion)
passenger->ExitVehicle(); // this should not happen
}
- if (Creature *accessory = me->SummonCreature(entry, *me, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30000))
+ if (Creature *accessory = me->SummonCreature(entry, *me, type, summonTime))
{
if (minion)
accessory->AddUnitTypeMask(UNIT_MASK_ACCESSORY);
diff --git a/src/server/game/Entities/Vehicle/Vehicle.h b/src/server/game/Entities/Vehicle/Vehicle.h
index 7dbbd32e1ff..03e283548d4 100755
--- a/src/server/game/Entities/Vehicle/Vehicle.h
+++ b/src/server/game/Entities/Vehicle/Vehicle.h
@@ -62,11 +62,11 @@ enum VehicleSeatFlags
enum VehicleSeatFlagsB
{
VEHICLE_SEAT_FLAG_B_NONE = 0x00000000,
- //VEHICLE_SEAT_FLAG_B_USABLE_FORCED = 0x00000002,
+ VEHICLE_SEAT_FLAG_B_USABLE_FORCED = 0x00000002,
VEHICLE_SEAT_FLAG_B_TARGETS_IN_RAIDUI = 0x00000008, // Lua_UnitTargetsVehicleInRaidUI
VEHICLE_SEAT_FLAG_B_EJECTABLE = 0x00000020, // ejectable
- //VEHICLE_SEAT_FLAG_B_USABLE_FORCED_2 = 0x00000040,
- //VEHICLE_SEAT_FLAG_B_USABLE_FORCED_3 = 0x00000100,
+ VEHICLE_SEAT_FLAG_B_USABLE_FORCED_2 = 0x00000040,
+ VEHICLE_SEAT_FLAG_B_USABLE_FORCED_3 = 0x00000100,
VEHICLE_SEAT_FLAG_B_CANSWITCH = 0x04000000, // can switch seats
VEHICLE_SEAT_FLAG_B_VEHICLE_PLAYERFRAME_UI = 0x80000000, // Lua_UnitHasVehiclePlayerFrameUI - actually checked for flagsb &~ 0x80000000
};
@@ -86,10 +86,13 @@ struct VehicleSeat
struct VehicleAccessory
{
- explicit VehicleAccessory(uint32 _uiAccessory, int8 _uiSeat, bool _bMinion) : uiAccessory(_uiAccessory), uiSeat(_uiSeat), bMinion(_bMinion) {}
+ explicit VehicleAccessory(uint32 _uiAccessory, int8 _uiSeat, bool _bMinion, uint8 _uiSummonType, uint32 _uiSummonTime) :
+ uiAccessory(_uiAccessory), uiSeat(_uiSeat), bMinion(_bMinion), uiSummonType(_uiSummonType), uiSummonTime(_uiSummonTime) {}
uint32 uiAccessory;
int8 uiSeat;
uint32 bMinion;
+ uint8 uiSummonType;
+ uint32 uiSummonTime;
};
struct VehicleScalingInfo
@@ -149,6 +152,6 @@ class Vehicle
uint32 m_usableSeatNum; // Number of seats that match VehicleSeatEntry::UsableByPlayer, used for proper display flags
uint32 m_bonusHP;
- void InstallAccessory(uint32 entry, int8 seatId, bool minion = true);
+ void InstallAccessory(uint32 entry, int8 seatId, bool minion, uint8 type, uint32 summonTime);
};
#endif
diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp
index ea648172a2a..b7d7ba660a9 100755
--- a/src/server/game/Globals/ObjectMgr.cpp
+++ b/src/server/game/Globals/ObjectMgr.cpp
@@ -2736,7 +2736,7 @@ void ObjectMgr::LoadVehicleAccessories()
uint32 count = 0;
- QueryResult result = WorldDatabase.Query("SELECT `entry`,`accessory_entry`,`seat_id`,`minion` FROM `vehicle_accessory`");
+ QueryResult result = WorldDatabase.Query("SELECT `entry`,`accessory_entry`,`seat_id`,`minion`,`summontype`,`summontimer` FROM `vehicle_accessory`");
if (!result)
{
@@ -2754,6 +2754,8 @@ void ObjectMgr::LoadVehicleAccessories()
uint32 uiAccessory = fields[1].GetUInt32();
int8 uiSeat = int8(fields[2].GetInt16());
bool bMinion = fields[3].GetBool();
+ uint8 uiSummonType = fields[4].GetUInt8();
+ uint32 uiSummonTimer = fields[5].GetUInt32();
if (!sCreatureStorage.LookupEntry<CreatureInfo>(uiEntry))
{
@@ -2767,10 +2769,11 @@ void ObjectMgr::LoadVehicleAccessories()
continue;
}
- m_VehicleAccessoryMap[uiEntry].push_back(VehicleAccessory(uiAccessory, uiSeat, bMinion));
+ m_VehicleAccessoryMap[uiEntry].push_back(VehicleAccessory(uiAccessory, uiSeat, bMinion, uiSummonType, uiSummonTimer));
++count;
- } while (result->NextRow());
+ }
+ while (result->NextRow());
sLog->outString(">> Loaded %u Vehicle Accessories in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog->outString();