*Some update of vehicle.
--HG-- branch : trunk
This commit is contained in:
+27
-17
@@ -417,7 +417,7 @@ void Unit::SendMonsterMoveByPath(Path const& path, uint32 start, uint32 end)
|
|||||||
addUnitState(UNIT_STAT_MOVE);
|
addUnitState(UNIT_STAT_MOVE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Unit::SendMonsterMoveTransport(Vehicle *vehicle, bool apply)
|
void Unit::SendMonsterMoveTransport(Vehicle *vehicle)
|
||||||
{
|
{
|
||||||
WorldPacket data(SMSG_MONSTER_MOVE_TRANSPORT, GetPackGUID().size()+vehicle->GetPackGUID().size());
|
WorldPacket data(SMSG_MONSTER_MOVE_TRANSPORT, GetPackGUID().size()+vehicle->GetPackGUID().size());
|
||||||
data.append(GetPackGUID());
|
data.append(GetPackGUID());
|
||||||
@@ -432,9 +432,9 @@ void Unit::SendMonsterMoveTransport(Vehicle *vehicle, bool apply)
|
|||||||
data << GetTransOffsetO();
|
data << GetTransOffsetO();
|
||||||
data << uint32(MOVEFLAG_ENTER_TRANSPORT);
|
data << uint32(MOVEFLAG_ENTER_TRANSPORT);
|
||||||
data << uint32(0); // move time
|
data << uint32(0); // move time
|
||||||
data << GetTransOffsetX();
|
data << uint32(0);//GetTransOffsetX();
|
||||||
data << GetTransOffsetY();
|
data << uint32(0);//GetTransOffsetY();
|
||||||
data << GetTransOffsetZ();
|
data << uint32(0);//GetTransOffsetZ();
|
||||||
SendMessageToSet(&data, true);
|
SendMessageToSet(&data, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3508,6 +3508,7 @@ void Unit::InterruptSpell(uint32 spellType, bool withDelayed, bool withInstant)
|
|||||||
{
|
{
|
||||||
assert(spellType < CURRENT_MAX_SPELL);
|
assert(spellType < CURRENT_MAX_SPELL);
|
||||||
|
|
||||||
|
//sLog.outDebug("Interrupt spell for unit %u.", GetEntry());
|
||||||
Spell *spell = m_currentSpells[spellType];
|
Spell *spell = m_currentSpells[spellType];
|
||||||
if(spell
|
if(spell
|
||||||
&& (withDelayed || spell->getState() != SPELL_STATE_DELAYED)
|
&& (withDelayed || spell->getState() != SPELL_STATE_DELAYED)
|
||||||
@@ -13534,6 +13535,9 @@ void Unit::Kill(Unit *pVictim, bool durabilityLoss)
|
|||||||
// Prevent killing unit twice (and giving reward from kill twice)
|
// Prevent killing unit twice (and giving reward from kill twice)
|
||||||
if (!pVictim->GetHealth())
|
if (!pVictim->GetHealth())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
//sLog.outError("%u kill %u", GetEntry(), pVictim->GetEntry());
|
||||||
|
|
||||||
pVictim->SetHealth(0);
|
pVictim->SetHealth(0);
|
||||||
|
|
||||||
// find player: owner of controlled `this` or `this` itself maybe
|
// find player: owner of controlled `this` or `this` itself maybe
|
||||||
@@ -13733,7 +13737,7 @@ void Unit::SetControlled(bool apply, UnitState state)
|
|||||||
{
|
{
|
||||||
case UNIT_STAT_STUNNED: if(HasAuraType(SPELL_AURA_MOD_STUN)) return;
|
case UNIT_STAT_STUNNED: if(HasAuraType(SPELL_AURA_MOD_STUN)) return;
|
||||||
else SetStunned(false); break;
|
else SetStunned(false); break;
|
||||||
case UNIT_STAT_ROOT: if(HasAuraType(SPELL_AURA_MOD_ROOT)) return;
|
case UNIT_STAT_ROOT: if(HasAuraType(SPELL_AURA_MOD_ROOT) || m_Vehicle) return;
|
||||||
else SetRooted(false); break;
|
else SetRooted(false); break;
|
||||||
case UNIT_STAT_CONFUSED:if(HasAuraType(SPELL_AURA_MOD_CONFUSE)) return;
|
case UNIT_STAT_CONFUSED:if(HasAuraType(SPELL_AURA_MOD_CONFUSE)) return;
|
||||||
else SetConfused(false); break;
|
else SetConfused(false); break;
|
||||||
@@ -13943,6 +13947,8 @@ void Unit::SetCharmedBy(Unit* charmer, CharmType type)
|
|||||||
switch(type)
|
switch(type)
|
||||||
{
|
{
|
||||||
case CHARM_TYPE_VEHICLE:
|
case CHARM_TYPE_VEHICLE:
|
||||||
|
SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_24);
|
||||||
|
((Player*)charmer)->SetClientControl(this, 1);
|
||||||
((Player*)charmer)->SetViewpoint(this, true);
|
((Player*)charmer)->SetViewpoint(this, true);
|
||||||
((Player*)charmer)->VehicleSpellInitialize();
|
((Player*)charmer)->VehicleSpellInitialize();
|
||||||
break;
|
break;
|
||||||
@@ -14043,6 +14049,7 @@ void Unit::RemoveCharmedBy(Unit *charmer)
|
|||||||
switch(type)
|
switch(type)
|
||||||
{
|
{
|
||||||
case CHARM_TYPE_VEHICLE:
|
case CHARM_TYPE_VEHICLE:
|
||||||
|
((Player*)charmer)->SetClientControl(charmer, 1);
|
||||||
((Player*)charmer)->SetViewpoint(this, false);
|
((Player*)charmer)->SetViewpoint(this, false);
|
||||||
break;
|
break;
|
||||||
case CHARM_TYPE_POSSESS:
|
case CHARM_TYPE_POSSESS:
|
||||||
@@ -14506,16 +14513,14 @@ void Unit::EnterVehicle(Vehicle *vehicle, int8 seatId)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_Vehicle->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_24);
|
|
||||||
//m_Vehicle->setFaction(getFaction());
|
|
||||||
|
|
||||||
addUnitState(UNIT_STAT_ONVEHICLE);
|
addUnitState(UNIT_STAT_ONVEHICLE);
|
||||||
|
SetControlled(true, UNIT_STAT_ROOT);
|
||||||
//movementInfo is set in AddPassenger
|
//movementInfo is set in AddPassenger
|
||||||
//packets are sent in AddPassenger
|
//packets are sent in AddPassenger
|
||||||
|
|
||||||
if(GetTypeId() == TYPEID_PLAYER)
|
if(GetTypeId() == TYPEID_PLAYER)
|
||||||
{
|
{
|
||||||
((Player*)this)->SetClientControl(vehicle, 1);
|
//((Player*)this)->SetClientControl(vehicle, 1);
|
||||||
WorldPacket data(SMSG_ON_CANCEL_EXPECTED_RIDE_VEHICLE_AURA, 0);
|
WorldPacket data(SMSG_ON_CANCEL_EXPECTED_RIDE_VEHICLE_AURA, 0);
|
||||||
((Player*)this)->GetSession()->SendPacket(&data);
|
((Player*)this)->GetSession()->SendPacket(&data);
|
||||||
}
|
}
|
||||||
@@ -14545,16 +14550,17 @@ void Unit::ExitVehicle()
|
|||||||
if(!m_Vehicle)
|
if(!m_Vehicle)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_Vehicle->RemovePassenger(this);
|
//sLog.outError("exit vehicle");
|
||||||
|
|
||||||
m_Vehicle->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_24);
|
m_Vehicle->RemovePassenger(this);
|
||||||
//setFaction((GetTeam() == ALLIANCE) ? GetCreatureInfo()->faction_A : GetCreatureInfo()->faction_H);
|
|
||||||
|
|
||||||
// This should be done before dismiss, because there may be some aura removal
|
// This should be done before dismiss, because there may be some aura removal
|
||||||
Vehicle *vehicle = m_Vehicle;
|
Vehicle *vehicle = m_Vehicle;
|
||||||
m_Vehicle = NULL;
|
m_Vehicle = NULL;
|
||||||
|
|
||||||
clearUnitState(UNIT_STAT_ONVEHICLE);
|
clearUnitState(UNIT_STAT_ONVEHICLE);
|
||||||
|
SetControlled(false, UNIT_STAT_ROOT);
|
||||||
|
|
||||||
RemoveUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT + MOVEMENTFLAG_FLY_UNK1);
|
RemoveUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT + MOVEMENTFLAG_FLY_UNK1);
|
||||||
m_movementInfo.t_x = 0;
|
m_movementInfo.t_x = 0;
|
||||||
m_movementInfo.t_y = 0;
|
m_movementInfo.t_y = 0;
|
||||||
@@ -14563,18 +14569,16 @@ void Unit::ExitVehicle()
|
|||||||
m_movementInfo.t_time = 0;
|
m_movementInfo.t_time = 0;
|
||||||
m_movementInfo.t_seat = 0;
|
m_movementInfo.t_seat = 0;
|
||||||
|
|
||||||
//Send leave vehicle
|
//Send leave vehicle, not correct
|
||||||
if(GetTypeId() == TYPEID_PLAYER)
|
if(GetTypeId() == TYPEID_PLAYER)
|
||||||
{
|
{
|
||||||
((Player*)this)->SetClientControl(this, 1);
|
//((Player*)this)->SetClientControl(this, 1);
|
||||||
((Player*)this)->SendTeleportAckMsg();
|
((Player*)this)->SendTeleportAckMsg();
|
||||||
}
|
}
|
||||||
WorldPacket data;
|
WorldPacket data;
|
||||||
BuildHeartBeatMsg(&data);
|
BuildHeartBeatMsg(&data);
|
||||||
SendMessageToSet(&data, false);
|
SendMessageToSet(&data, false);
|
||||||
|
|
||||||
//SendMonsterMoveTransport(m_Vehicle, false);
|
|
||||||
|
|
||||||
if(vehicle->GetOwnerGUID() == GetGUID())
|
if(vehicle->GetOwnerGUID() == GetGUID())
|
||||||
vehicle->Dismiss();
|
vehicle->Dismiss();
|
||||||
}
|
}
|
||||||
@@ -14645,11 +14649,17 @@ void Unit::BuildMovementPacket(ByteBuffer *data) const
|
|||||||
// 0x04000000
|
// 0x04000000
|
||||||
if(GetUnitMovementFlags() & MOVEMENTFLAG_SPLINE)
|
if(GetUnitMovementFlags() & MOVEMENTFLAG_SPLINE)
|
||||||
*data << (float)m_movementInfo.u_unk1;
|
*data << (float)m_movementInfo.u_unk1;
|
||||||
|
|
||||||
|
/*if(GetTypeId() == TYPEID_PLAYER)
|
||||||
|
{
|
||||||
|
sLog.outString("Send MovementInfo:");
|
||||||
|
OutMovementInfo();
|
||||||
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
void Unit::OutMovementInfo() const
|
void Unit::OutMovementInfo() const
|
||||||
{
|
{
|
||||||
sLog.outString("MovementInfo: Flag %u, Unk1 %u, Time %u, Pos %f %f %f %f, Fall %u", m_movementInfo.flags, (uint32)m_movementInfo.unk1, m_movementInfo.time, GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation(), m_movementInfo.fallTime);
|
sLog.outString("MovementInfo for %u: Flag %u, Unk1 %u, Time %u, Pos %f %f %f %f, Fall %u", GetEntry(), m_movementInfo.flags, (uint32)m_movementInfo.unk1, m_movementInfo.time, GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation(), m_movementInfo.fallTime);
|
||||||
if(m_movementInfo.flags & MOVEMENTFLAG_ONTRANSPORT)
|
if(m_movementInfo.flags & MOVEMENTFLAG_ONTRANSPORT)
|
||||||
sLog.outString("Transport: GUID " UI64FMTD ", Pos %f %f %f %f, Time %u, Seat %d", m_movementInfo.t_guid, m_movementInfo.t_x, m_movementInfo.t_y, m_movementInfo.t_z, m_movementInfo.t_o, m_movementInfo.t_time, (int32)m_movementInfo.t_seat);
|
sLog.outString("Transport: GUID " UI64FMTD ", Pos %f %f %f %f, Time %u, Seat %d", m_movementInfo.t_guid, m_movementInfo.t_x, m_movementInfo.t_y, m_movementInfo.t_z, m_movementInfo.t_o, m_movementInfo.t_time, (int32)m_movementInfo.t_seat);
|
||||||
if((m_movementInfo.flags & (MOVEMENTFLAG_SWIMMING | MOVEMENTFLAG_FLYING2)) || (m_movementInfo.unk1 & 0x20))
|
if((m_movementInfo.flags & (MOVEMENTFLAG_SWIMMING | MOVEMENTFLAG_FLYING2)) || (m_movementInfo.unk1 & 0x20))
|
||||||
|
|||||||
+1
-1
@@ -1311,7 +1311,7 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
|
|||||||
void SendMonsterMove(float NewPosX, float NewPosY, float NewPosZ, uint32 MoveFlags, uint32 time, float speedZ, Player *player = NULL);
|
void SendMonsterMove(float NewPosX, float NewPosY, float NewPosZ, uint32 MoveFlags, uint32 time, float speedZ, Player *player = NULL);
|
||||||
//void SendMonsterMove(float NewPosX, float NewPosY, float NewPosZ, uint8 type, uint32 MovementFlags, uint32 Time, Player* player = NULL);
|
//void SendMonsterMove(float NewPosX, float NewPosY, float NewPosZ, uint8 type, uint32 MovementFlags, uint32 Time, Player* player = NULL);
|
||||||
void SendMonsterMoveByPath(Path const& path, uint32 start, uint32 end);
|
void SendMonsterMoveByPath(Path const& path, uint32 start, uint32 end);
|
||||||
void SendMonsterMoveTransport(Vehicle *vehicle, bool apply);
|
void SendMonsterMoveTransport(Vehicle *vehicle);
|
||||||
void SendMonsterMoveWithSpeed(float x, float y, float z, uint32 transitTime = 0, Player* player = NULL);
|
void SendMonsterMoveWithSpeed(float x, float y, float z, uint32 transitTime = 0, Player* player = NULL);
|
||||||
void SendMonsterMoveWithSpeedToCurrentDestination(Player* player = NULL);
|
void SendMonsterMoveWithSpeedToCurrentDestination(Player* player = NULL);
|
||||||
void SendMovementFlagUpdate();
|
void SendMovementFlagUpdate();
|
||||||
|
|||||||
+28
-14
@@ -44,8 +44,7 @@ void Vehicle::AddToWorld()
|
|||||||
if(m_zoneScript)
|
if(m_zoneScript)
|
||||||
m_zoneScript->OnCreatureCreate(this, true);
|
m_zoneScript->OnCreatureCreate(this, true);
|
||||||
ObjectAccessor::Instance().AddObject(this);
|
ObjectAccessor::Instance().AddObject(this);
|
||||||
Unit::AddToWorld();
|
|
||||||
AIM_Initialize();
|
|
||||||
switch(GetEntry())
|
switch(GetEntry())
|
||||||
{
|
{
|
||||||
//case 27850:InstallAccessory(27905,1);break;
|
//case 27850:InstallAccessory(27905,1);break;
|
||||||
@@ -66,12 +65,29 @@ void Vehicle::AddToWorld()
|
|||||||
InstallAccessory(33142,2);
|
InstallAccessory(33142,2);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if(!GetMaxPower(POWER_MANA)) // m_vehicleInfo->36
|
for(uint32 i = 0; i < MAX_SPELL_VEHICLE; ++i)
|
||||||
|
{
|
||||||
|
if(!m_spells[i])
|
||||||
|
continue;
|
||||||
|
|
||||||
|
SpellEntry const *spellInfo = sSpellStore.LookupEntry(m_spells[i]);
|
||||||
|
if(!spellInfo)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if(spellInfo->powerType == POWER_MANA)
|
||||||
|
break;
|
||||||
|
|
||||||
|
if(spellInfo->powerType == POWER_ENERGY)
|
||||||
{
|
{
|
||||||
setPowerType(POWER_ENERGY);
|
setPowerType(POWER_ENERGY);
|
||||||
SetMaxPower(POWER_ENERGY, 100);
|
SetMaxPower(POWER_ENERGY, 100);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Unit::AddToWorld();
|
||||||
|
AIM_Initialize();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Vehicle::RemoveFromWorld()
|
void Vehicle::RemoveFromWorld()
|
||||||
@@ -114,7 +130,7 @@ void Vehicle::Update(uint32 diff)
|
|||||||
{
|
{
|
||||||
Creature::Update(diff);
|
Creature::Update(diff);
|
||||||
//310
|
//310
|
||||||
if(getPowerType() == POWER_ENERGY)
|
if(getPowerType() == POWER_ENERGY) // m_vehicleInfo->36
|
||||||
ModifyPower(POWER_ENERGY, 100);
|
ModifyPower(POWER_ENERGY, 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -224,6 +240,8 @@ void Vehicle::InstallAccessory(uint32 entry, int8 seatId)
|
|||||||
|
|
||||||
accessory->m_Vehicle = this;
|
accessory->m_Vehicle = this;
|
||||||
AddPassenger(accessory, seatId);
|
AddPassenger(accessory, seatId);
|
||||||
|
// This is not good, we have to send update twice
|
||||||
|
accessory->SendMovementFlagUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Vehicle::AddPassenger(Unit *unit, int8 seatId)
|
bool Vehicle::AddPassenger(Unit *unit, int8 seatId)
|
||||||
@@ -278,16 +296,12 @@ bool Vehicle::AddPassenger(Unit *unit, int8 seatId)
|
|||||||
if(unit->GetTypeId() == TYPEID_PLAYER && seat->first == 0 && seat->second.seatInfo->IsUsable()) // not right
|
if(unit->GetTypeId() == TYPEID_PLAYER && seat->first == 0 && seat->second.seatInfo->IsUsable()) // not right
|
||||||
SetCharmedBy(unit, CHARM_TYPE_VEHICLE);
|
SetCharmedBy(unit, CHARM_TYPE_VEHICLE);
|
||||||
|
|
||||||
if(false)
|
if(IsInWorld())
|
||||||
{
|
unit->SendMonsterMoveTransport(this);
|
||||||
unit->SendMonsterMoveTransport(this, true);
|
|
||||||
}
|
//if(unit->GetTypeId() == TYPEID_PLAYER)
|
||||||
else
|
// ((Player*)unit)->SendTeleportAckMsg();
|
||||||
{
|
//unit->SendMovementFlagUpdate();
|
||||||
if(unit->GetTypeId() == TYPEID_PLAYER)
|
|
||||||
((Player*)unit)->SendTeleportAckMsg();
|
|
||||||
unit->SendMovementFlagUpdate();
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user