mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-17 19:05:42 +00:00
feat(Core/Misc): implement ObjectGuid class (port from TC) (#4885)
This commit is contained in:
@@ -50,7 +50,7 @@ Vehicle::~Vehicle()
|
||||
for (SeatMap::const_iterator itr = Seats.begin(); itr != Seats.end(); ++itr)
|
||||
if (itr->second.Passenger.Guid)
|
||||
{
|
||||
if (Unit* unit = ObjectAccessor::FindUnit(itr->second.Passenger.Guid))
|
||||
if (Unit* unit = ObjectAccessor::GetUnit(*_me, itr->second.Passenger.Guid))
|
||||
{
|
||||
LOG_INFO("server", "ZOMG! ~Vehicle(), unit: %s, entry: %u, typeid: %u, this_entry: %u, this_typeid: %u!", unit->GetName().c_str(), unit->GetEntry(), unit->GetTypeId(), _me ? _me->GetEntry() : 0, _me ? _me->GetTypeId() : 0);
|
||||
unit->_ExitVehicle();
|
||||
@@ -95,13 +95,13 @@ void Vehicle::Uninstall()
|
||||
/// @Prevent recursive uninstall call. (Bad script in OnUninstall/OnRemovePassenger/PassengerBoarded hook.)
|
||||
if (_status == STATUS_UNINSTALLING && !GetBase()->HasUnitTypeMask(UNIT_MASK_MINION))
|
||||
{
|
||||
LOG_ERROR("server", "Vehicle GuidLow: %u, Entry: %u attempts to uninstall, but already has STATUS_UNINSTALLING! "
|
||||
"Check Uninstall/PassengerBoarded script hooks for errors.", _me->GetGUIDLow(), _me->GetEntry());
|
||||
LOG_ERROR("server", "Vehicle %s attempts to uninstall, but already has STATUS_UNINSTALLING! "
|
||||
"Check Uninstall/PassengerBoarded script hooks for errors.", _me->GetGUID().ToString().c_str());
|
||||
return;
|
||||
}
|
||||
_status = STATUS_UNINSTALLING;
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("vehicles", "Vehicle::Uninstall Entry: %u, GuidLow: %u", _creatureEntry, _me->GetGUIDLow());
|
||||
LOG_DEBUG("vehicles", "Vehicle::Uninstall %s", _me->GetGUID().ToString().c_str());
|
||||
#endif
|
||||
RemoveAllPassengers();
|
||||
|
||||
@@ -112,7 +112,7 @@ void Vehicle::Uninstall()
|
||||
void Vehicle::Reset(bool evading /*= false*/)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("vehicles", "Vehicle::Reset Entry: %u, GuidLow: %u", _creatureEntry, _me->GetGUIDLow());
|
||||
LOG_DEBUG("vehicles", "Vehicle::Reset: %s", _me->GetGUID().ToString().c_str());
|
||||
#endif
|
||||
if (_me->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
@@ -154,7 +154,7 @@ void Vehicle::ApplyAllImmunities()
|
||||
//_me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_UNATTACKABLE, true);
|
||||
_me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_SHIELD, true);
|
||||
_me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_IMMUNE_SHIELD, true);
|
||||
if (_me->GetZoneId() == BATTLEFIELD_WG_ZONEID || _me->ToCreature()->GetDBTableGUIDLow() || (_me->FindMap() && _me->FindMap()->Instanceable()))
|
||||
if (_me->GetZoneId() == BATTLEFIELD_WG_ZONEID || _me->ToCreature()->GetSpawnId() || (_me->FindMap() && _me->FindMap()->Instanceable()))
|
||||
_me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_SCHOOL_ABSORB, true);
|
||||
|
||||
// ... Resistance, Split damage, Change stats ...
|
||||
@@ -198,7 +198,7 @@ void Vehicle::ApplyAllImmunities()
|
||||
void Vehicle::RemoveAllPassengers()
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("vehicles", "Vehicle::RemoveAllPassengers. Entry: %u, GuidLow: %u", _creatureEntry, _me->GetGUIDLow());
|
||||
LOG_DEBUG("vehicles", "Vehicle::RemoveAllPassengers. %s", _me->GetGUID().ToString().c_str());
|
||||
#endif
|
||||
|
||||
// Passengers always cast an aura with SPELL_AURA_CONTROL_VEHICLE on the vehicle
|
||||
@@ -263,8 +263,8 @@ void Vehicle::InstallAccessory(uint32 entry, int8 seatId, bool minion, uint8 typ
|
||||
/// @Prevent adding accessories when vehicle is uninstalling. (Bad script in OnUninstall/OnRemovePassenger/PassengerBoarded hook.)
|
||||
if (_status == STATUS_UNINSTALLING)
|
||||
{
|
||||
LOG_ERROR("server", "Vehicle GuidLow: %u, Entry: %u attempts to install accessory Entry: %u on seat %d with STATUS_UNINSTALLING! "
|
||||
"Check Uninstall/PassengerBoarded script hooks for errors.", _me->GetGUIDLow(), _me->GetEntry(), entry, (int32)seatId);
|
||||
LOG_ERROR("server", "Vehicle %s attempts to install accessory Entry: %u on seat %d with STATUS_UNINSTALLING! "
|
||||
"Check Uninstall/PassengerBoarded script hooks for errors.", _me->GetGUID().ToString().c_str(), entry, (int32)seatId);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -310,7 +310,8 @@ bool Vehicle::AddPassenger(Unit* unit, int8 seatId)
|
||||
if (_status == STATUS_UNINSTALLING)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("vehicles", "Passenger GuidLow: %u, Entry: %u, attempting to board vehicle GuidLow: %u, Entry: %u during uninstall! SeatId: %i", unit->GetGUIDLow(), unit->GetEntry(), _me->GetGUIDLow(), _me->GetEntry(), (int32)seatId);
|
||||
LOG_DEBUG("vehicles", "Passenger %s, attempting to board vehicle %s during uninstall! SeatId: %i",
|
||||
unit->GetGUID().ToString().c_str(), _me->GetGUID().ToString().c_str(), (int32)seatId);
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
@@ -339,14 +340,15 @@ bool Vehicle::AddPassenger(Unit* unit, int8 seatId)
|
||||
if (Unit* passenger = ObjectAccessor::GetUnit(*GetBase(), seat->second.Passenger.Guid))
|
||||
passenger->ExitVehicle();
|
||||
|
||||
seat->second.Passenger.Guid = 0;
|
||||
seat->second.Passenger.Guid.Clear();
|
||||
}
|
||||
|
||||
ASSERT(seat->second.IsEmpty());
|
||||
}
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("vehicles", "Unit %s enter vehicle entry %u id %u dbguid %u seat %d", unit->GetName().c_str(), _me->GetEntry(), _vehicleInfo->m_ID, _me->GetGUIDLow(), (int32)seat->first);
|
||||
LOG_DEBUG("vehicles", "Unit %s enter vehicle entry %u id %u (%s) seat %d",
|
||||
unit->GetName().c_str(), _me->GetEntry(), _vehicleInfo->m_ID, _me->GetGUID().ToString().c_str(), (int32)seat->first);
|
||||
#endif
|
||||
|
||||
seat->second.Passenger.Guid = unit->GetGUID();
|
||||
@@ -457,7 +459,8 @@ void Vehicle::RemovePassenger(Unit* unit)
|
||||
return;
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("vehicles", "Unit %s exit vehicle entry %u id %u dbguid %u seat %d", unit->GetName().c_str(), _me->GetEntry(), _vehicleInfo->m_ID, _me->GetGUIDLow(), (int32)seat->first);
|
||||
LOG_DEBUG("vehicles", "Unit %s exit vehicle entry %u id %u (%s) seat %d",
|
||||
unit->GetName().c_str(), _me->GetEntry(), _vehicleInfo->m_ID, _me->GetGUID().ToString().c_str(), (int32)seat->first);
|
||||
#endif
|
||||
|
||||
if (seat->second.SeatInfo->CanEnterOrExit() && ++_usableSeatNum)
|
||||
@@ -525,7 +528,7 @@ void Vehicle::Dismiss()
|
||||
return;
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("vehicles", "Vehicle::Dismiss Entry: %u, GuidLow %u", _creatureEntry, _me->GetGUIDLow());
|
||||
LOG_DEBUG("vehicles", "Vehicle::Dismiss %s", _me->GetGUID().ToString().c_str());
|
||||
#endif
|
||||
Uninstall();
|
||||
GetBase()->ToCreature()->DespawnOrUnsummon();
|
||||
|
||||
Reference in New Issue
Block a user