mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-23 18:36:31 +01:00
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)
This commit is contained in:
@@ -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";
|
||||
@@ -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; }
|
||||
};
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user