aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKudlaty <none@none>2009-06-15 04:09:41 +0200
committerKudlaty <none@none>2009-06-15 04:09:41 +0200
commitd1d8e2d171b1b7fc3c1fc0b83238ac5b0f8af64d (patch)
tree752c90f5f7c192cd277c1107df3f40d9005af7d1
parentb1a8df0cde6311a6116417785c658786267636ba (diff)
parentd86194147741840cbf4642d7a23003dc0f5bbb2b (diff)
*merge
--HG-- branch : trunk
-rw-r--r--src/game/GridNotifiers.cpp27
-rw-r--r--src/game/GridNotifiers.h2
-rw-r--r--src/game/MiscHandler.cpp2
-rw-r--r--src/game/MovementHandler.cpp9
-rw-r--r--src/game/Player.cpp1
-rw-r--r--src/game/Spell.cpp34
-rw-r--r--src/game/SpellAuras.cpp33
-rw-r--r--src/game/SpellEffects.cpp4
-rw-r--r--src/game/TemporarySummon.cpp3
-rw-r--r--src/game/Unit.cpp44
-rw-r--r--src/game/Unit.h2
-rw-r--r--src/game/Vehicle.cpp46
12 files changed, 147 insertions, 60 deletions
diff --git a/src/game/GridNotifiers.cpp b/src/game/GridNotifiers.cpp
index b87d57563af..858c807e386 100644
--- a/src/game/GridNotifiers.cpp
+++ b/src/game/GridNotifiers.cpp
@@ -38,10 +38,37 @@ VisibleChangesNotifier::Visit(PlayerMapType &m)
continue;
iter->getSource()->UpdateVisibilityOf(&i_object);
+
+ if(!iter->getSource()->GetSharedVisionList().empty())
+ for(SharedVisionList::const_iterator i = iter->getSource()->GetSharedVisionList().begin();
+ i != iter->getSource()->GetSharedVisionList().end(); ++i)
+ if((*i)->m_seer == iter->getSource())
+ (*i)->UpdateVisibilityOf(&i_object);
}
}
void
+VisibleChangesNotifier::Visit(CreatureMapType &m)
+{
+ for(CreatureMapType::iterator iter = m.begin(); iter != m.end(); ++iter)
+ if(!iter->getSource()->GetSharedVisionList().empty())
+ for(SharedVisionList::const_iterator i = iter->getSource()->GetSharedVisionList().begin();
+ i != iter->getSource()->GetSharedVisionList().end(); ++i)
+ if((*i)->m_seer == iter->getSource())
+ (*i)->UpdateVisibilityOf(&i_object);
+}
+
+void
+VisibleChangesNotifier::Visit(DynamicObjectMapType &m)
+{
+ for(DynamicObjectMapType::iterator iter = m.begin(); iter != m.end(); ++iter)
+ if(IS_PLAYER_GUID(iter->getSource()->GetCasterGUID()))
+ if(Player* caster = (Player*)iter->getSource()->GetCaster())
+ if(caster->m_seer == iter->getSource())
+ caster->UpdateVisibilityOf(&i_object);
+}
+
+void
PlayerVisibilityNotifier::Notify()
{
// at this moment i_clientGUIDs have guids that not iterate at grid level checks
diff --git a/src/game/GridNotifiers.h b/src/game/GridNotifiers.h
index 5418bd09b16..64deb0d3123 100644
--- a/src/game/GridNotifiers.h
+++ b/src/game/GridNotifiers.h
@@ -81,6 +81,8 @@ namespace Trinity
explicit VisibleChangesNotifier(WorldObject &object) : i_object(object) {}
template<class T> void Visit(GridRefManager<T> &) {}
void Visit(PlayerMapType &);
+ void Visit(CreatureMapType &);
+ void Visit(DynamicObjectMapType &);
};
struct TRINITY_DLL_DECL GridUpdater
diff --git a/src/game/MiscHandler.cpp b/src/game/MiscHandler.cpp
index 043397f9c48..f5a1013f085 100644
--- a/src/game/MiscHandler.cpp
+++ b/src/game/MiscHandler.cpp
@@ -1609,7 +1609,7 @@ void WorldSession::HandleMoveSetCanFlyAckOpcode( WorldPacket & recv_data )
recv_data >> guid >> unk >> flags;
- _player->m_movementInfo.flags = flags;
+ _player->m_mover->m_movementInfo.flags = flags;
}
void WorldSession::HandleRequestPetInfoOpcode( WorldPacket & /*recv_data */)
diff --git a/src/game/MovementHandler.cpp b/src/game/MovementHandler.cpp
index 775cef0edca..c3c82d552ac 100644
--- a/src/game/MovementHandler.cpp
+++ b/src/game/MovementHandler.cpp
@@ -293,7 +293,6 @@ void WorldSession::HandleMovementOpcodes( WorldPacket & recv_data )
GetPlayer()->SendMessageToSet(&data, false);
mover->m_movementInfo = movementInfo;
- mover->SetUnitMovementFlags(movementInfo.flags);
if(plMover) // nothing is charmed, or player charmed
{
@@ -462,9 +461,7 @@ void WorldSession::HandleMoveNotActiveMover(WorldPacket &recv_data)
return;
}*/
- MovementInfo mi;
- ReadMovementInfo(recv_data, &mi);
- _player->m_movementInfo = mi;
+ ReadMovementInfo(recv_data, &_player->m_mover->m_movementInfo);
}
void WorldSession::HandleDismissControlledVehicle(WorldPacket &recv_data)
@@ -477,9 +474,7 @@ void WorldSession::HandleDismissControlledVehicle(WorldPacket &recv_data)
if(!vehicleGUID) // something wrong here...
return;
- MovementInfo mi;
- ReadMovementInfo(recv_data, &mi);
- _player->m_movementInfo = mi;
+ ReadMovementInfo(recv_data, &_player->m_mover->m_movementInfo);
_player->ExitVehicle();
}
diff --git a/src/game/Player.cpp b/src/game/Player.cpp
index 54c86fa874a..7abe7f67d55 100644
--- a/src/game/Player.cpp
+++ b/src/game/Player.cpp
@@ -1654,7 +1654,6 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
// reset movement flags at teleport, because player will continue move with these flags after teleport
SetUnitMovementFlags(0);
- m_movementInfo.flags = 0;
if (m_transport)
{
diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp
index 87be2d381c2..0f2def62271 100644
--- a/src/game/Spell.cpp
+++ b/src/game/Spell.cpp
@@ -1410,12 +1410,20 @@ bool Spell::UpdateChanneledTargetList()
uint8 needAliveTargetMask = m_needAliveTargetMask;
uint8 needAuraMask = 0;
- for (uint8 i=0;i<MAX_SPELL_EFFECTS;++i)
+ for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
if (m_spellInfo->Effect[i] == SPELL_EFFECT_APPLY_AURA)
needAuraMask |= 1<<i;
needAuraMask &= needAliveTargetMask;
+ float range;
+ if(needAuraMask)
+ {
+ range = GetSpellMaxRange(m_spellInfo, IsPositiveSpell(m_spellInfo->Id));
+ if(Player * modOwner = m_caster->GetSpellModOwner())
+ modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_RANGE, range, this);
+ }
+
for(std::list<TargetInfo>::iterator ihit= m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
{
if( ihit->missCondition == SPELL_MISS_NONE && (needAliveTargetMask & ihit->effectMask) )
@@ -1428,9 +1436,6 @@ bool Spell::UpdateChanneledTargetList()
{
if(Aura * aur = unit->GetAura(m_spellInfo->Id, m_originalCasterGUID))
{
- float range = m_caster->GetSpellMaxRangeForTarget(unit,GetSpellRangeStore()->LookupEntry(m_spellInfo->rangeIndex));
- if(Player * modOwner = m_caster->GetSpellModOwner())
- modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_RANGE, range, this);
if (m_caster != unit && !m_caster->IsWithinDistInMap(unit,range))
{
ihit->effectMask &= ~aur->GetEffectMask();
@@ -1438,7 +1443,7 @@ bool Spell::UpdateChanneledTargetList()
continue;
}
}
- else
+ else // aura is dispelled
continue;
}
@@ -2520,16 +2525,12 @@ void Spell::cancel()
case SPELL_STATE_CASTING:
{
- for(std::list<TargetInfo>::iterator ihit= m_UniqueTargetInfo.begin();ihit != m_UniqueTargetInfo.end();++ihit)
- {
- if( ihit->missCondition == SPELL_MISS_NONE )
- {
- Unit* unit = m_caster->GetGUID()==(*ihit).targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster, ihit->targetGUID);
- if( unit && unit->isAlive() )
- unit->RemoveAurasDueToSpell(m_spellInfo->Id, m_originalCasterGUID, AURA_REMOVE_BY_CANCEL);
- }
- }
- m_caster->RemoveAurasDueToSpell(m_spellInfo->Id, m_originalCasterGUID, AURA_REMOVE_BY_CANCEL);
+ for(std::list<TargetInfo>::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
+ if(ihit->missCondition == SPELL_MISS_NONE)
+ if(Unit* unit = m_caster->GetGUID() == ihit->targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster, ihit->targetGUID))
+ if(unit->isAlive())
+ unit->RemoveAurasDueToSpell(m_spellInfo->Id, m_originalCasterGUID, AURA_REMOVE_BY_CANCEL);
+
SendChannelUpdate(0);
SendInterrupted(0);
SendCastResult(SPELL_FAILED_INTERRUPTED);
@@ -2912,6 +2913,7 @@ void Spell::update(uint32 difftime)
if(m_targets.getUnitTargetGUID() && !m_targets.getUnitTarget())
{
+ sLog.outDebug("Spell %u is cancelled due to removal of target.", m_spellInfo->Id);
cancel();
return;
}
@@ -5934,6 +5936,7 @@ bool SpellEvent::Execute(uint64 e_time, uint32 p_time)
{
// no, we aren't, do the typical update
// check, if we have channeled spell on our hands
+ /*
if (IsChanneledSpell(m_Spell->m_spellInfo))
{
// evented channeled spell is processed separately, casted once after delay, and not destroyed till finish
@@ -5956,6 +5959,7 @@ bool SpellEvent::Execute(uint64 e_time, uint32 p_time)
// event will be re-added automatically at the end of routine)
}
else
+ */
{
// run the spell handler and think about what we can do next
uint64 t_offset = e_time - m_Spell->GetDelayStart();
diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp
index f7eb73c7b72..2cba7a7344c 100644
--- a/src/game/SpellAuras.cpp
+++ b/src/game/SpellAuras.cpp
@@ -6006,7 +6006,6 @@ void AuraEffect::PeriodicTick()
break;
}
case SPELL_AURA_PERIODIC_LEECH:
- case SPELL_AURA_PERIODIC_HEALTH_FUNNEL:
{
Unit *pCaster = GetCaster();
if(!pCaster)
@@ -6087,6 +6086,30 @@ void AuraEffect::PeriodicTick()
pCaster->getHostilRefManager().threatAssist(pCaster, gain * 0.5f, spellProto);
break;
}
+ case SPELL_AURA_PERIODIC_HEALTH_FUNNEL: // only three spells
+ {
+ Unit *donator = GetCaster();
+ if(!donator || !donator->GetHealth())
+ return;
+
+ uint32 pdamage = GetAmount() * GetParentAura()->GetStackAmount();
+ if(donator->GetHealth() < pdamage)
+ pdamage = donator->GetHealth() - 1;
+ if(!pdamage)
+ return;
+
+ Unit* target = m_target; // aura can be deleted in DealDamage
+ SpellEntry const* spellProto = GetSpellProto();
+ //donator->SendSpellNonMeleeDamageLog(donator, GetId(), pdamage, GetSpellSchoolMask(spellProto), 0, 0, false, 0);
+ donator->ModifyHealth(-(int32)pdamage);
+ sLog.outDetail("PeriodicTick: donator %u target %u damage %u.", donator->GetEntry(), target->GetEntry(), pdamage);
+
+ if(spellProto->EffectMultipleValue[GetEffIndex()] > 0)
+ pdamage *= spellProto->EffectMultipleValue[GetEffIndex()];
+
+ donator->DealHeal(target, pdamage, spellProto);
+ break;
+ }
case SPELL_AURA_PERIODIC_HEAL:
case SPELL_AURA_OBS_MOD_HEALTH:
{
@@ -7003,9 +7026,15 @@ void AuraEffect::HandleAuraControlVehicle(bool apply, bool Real, bool /*changeAm
}
else
{
+ if(GetId() == 53111) // Devour Humanoid
+ {
+ vehicle->Kill(caster);
+ if(caster->GetTypeId() == TYPEID_UNIT)
+ ((Creature*)caster)->RemoveCorpse();
+ }
+
// some SPELL_AURA_CONTROL_VEHICLE auras have a dummy effect on the player - remove them
caster->RemoveAurasDueToSpell(GetId());
-
caster->ExitVehicle();
}
}
diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp
index 24274cf19dd..5506ec0dab1 100644
--- a/src/game/SpellEffects.cpp
+++ b/src/game/SpellEffects.cpp
@@ -4938,6 +4938,10 @@ void Spell::EffectScriptEffect(uint32 effIndex)
unitTarget->CastSpell(unitTarget, damage, false);
break;
}
+ case 53110: // Devour Humanoid
+ if(unitTarget)
+ unitTarget->CastSpell(m_caster, damage, true);
+ return;
// Winged Steed of the Ebon Blade
case 54729:
{
diff --git a/src/game/TemporarySummon.cpp b/src/game/TemporarySummon.cpp
index b481afb4bce..724d68c568b 100644
--- a/src/game/TemporarySummon.cpp
+++ b/src/game/TemporarySummon.cpp
@@ -345,7 +345,10 @@ void Puppet::Update(uint32 time)
if(IsInWorld())
{
if(!isAlive())
+ {
UnSummon();
+ // TODO: why long distance .die does not remove it
+ }
}
}
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index 3b1889d03f2..e1120e90d12 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -417,7 +417,7 @@ void Unit::SendMonsterMoveByPath(Path const& path, uint32 start, uint32 end)
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());
data.append(GetPackGUID());
@@ -432,9 +432,9 @@ void Unit::SendMonsterMoveTransport(Vehicle *vehicle, bool apply)
data << GetTransOffsetO();
data << uint32(MOVEFLAG_ENTER_TRANSPORT);
data << uint32(0); // move time
- data << GetTransOffsetX();
- data << GetTransOffsetY();
- data << GetTransOffsetZ();
+ data << uint32(0);//GetTransOffsetX();
+ data << uint32(0);//GetTransOffsetY();
+ data << uint32(0);//GetTransOffsetZ();
SendMessageToSet(&data, true);
}
@@ -3508,6 +3508,7 @@ void Unit::InterruptSpell(uint32 spellType, bool withDelayed, bool withInstant)
{
assert(spellType < CURRENT_MAX_SPELL);
+ //sLog.outDebug("Interrupt spell for unit %u.", GetEntry());
Spell *spell = m_currentSpells[spellType];
if(spell
&& (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)
if (!pVictim->GetHealth())
return;
+
+ //sLog.outError("%u kill %u", GetEntry(), pVictim->GetEntry());
+
pVictim->SetHealth(0);
// 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;
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;
case UNIT_STAT_CONFUSED:if(HasAuraType(SPELL_AURA_MOD_CONFUSE)) return;
else SetConfused(false); break;
@@ -13943,6 +13947,8 @@ void Unit::SetCharmedBy(Unit* charmer, CharmType type)
switch(type)
{
case CHARM_TYPE_VEHICLE:
+ SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_24);
+ ((Player*)charmer)->SetClientControl(this, 1);
((Player*)charmer)->SetViewpoint(this, true);
((Player*)charmer)->VehicleSpellInitialize();
break;
@@ -14043,6 +14049,7 @@ void Unit::RemoveCharmedBy(Unit *charmer)
switch(type)
{
case CHARM_TYPE_VEHICLE:
+ ((Player*)charmer)->SetClientControl(charmer, 1);
((Player*)charmer)->SetViewpoint(this, false);
break;
case CHARM_TYPE_POSSESS:
@@ -14506,16 +14513,14 @@ void Unit::EnterVehicle(Vehicle *vehicle, int8 seatId)
return;
}
- m_Vehicle->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_24);
- //m_Vehicle->setFaction(getFaction());
-
addUnitState(UNIT_STAT_ONVEHICLE);
+ SetControlled(true, UNIT_STAT_ROOT);
//movementInfo is set in AddPassenger
//packets are sent in AddPassenger
if(GetTypeId() == TYPEID_PLAYER)
{
- ((Player*)this)->SetClientControl(vehicle, 1);
+ //((Player*)this)->SetClientControl(vehicle, 1);
WorldPacket data(SMSG_ON_CANCEL_EXPECTED_RIDE_VEHICLE_AURA, 0);
((Player*)this)->GetSession()->SendPacket(&data);
}
@@ -14545,16 +14550,17 @@ void Unit::ExitVehicle()
if(!m_Vehicle)
return;
- m_Vehicle->RemovePassenger(this);
+ //sLog.outError("exit vehicle");
- m_Vehicle->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_24);
- //setFaction((GetTeam() == ALLIANCE) ? GetCreatureInfo()->faction_A : GetCreatureInfo()->faction_H);
+ m_Vehicle->RemovePassenger(this);
// This should be done before dismiss, because there may be some aura removal
Vehicle *vehicle = m_Vehicle;
m_Vehicle = NULL;
clearUnitState(UNIT_STAT_ONVEHICLE);
+ SetControlled(false, UNIT_STAT_ROOT);
+
RemoveUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT + MOVEMENTFLAG_FLY_UNK1);
m_movementInfo.t_x = 0;
m_movementInfo.t_y = 0;
@@ -14563,18 +14569,16 @@ void Unit::ExitVehicle()
m_movementInfo.t_time = 0;
m_movementInfo.t_seat = 0;
- //Send leave vehicle
+ //Send leave vehicle, not correct
if(GetTypeId() == TYPEID_PLAYER)
{
- ((Player*)this)->SetClientControl(this, 1);
+ //((Player*)this)->SetClientControl(this, 1);
((Player*)this)->SendTeleportAckMsg();
}
WorldPacket data;
BuildHeartBeatMsg(&data);
SendMessageToSet(&data, false);
- //SendMonsterMoveTransport(m_Vehicle, false);
-
if(vehicle->GetOwnerGUID() == GetGUID())
vehicle->Dismiss();
}
@@ -14645,11 +14649,17 @@ void Unit::BuildMovementPacket(ByteBuffer *data) const
// 0x04000000
if(GetUnitMovementFlags() & MOVEMENTFLAG_SPLINE)
*data << (float)m_movementInfo.u_unk1;
+
+ /*if(GetTypeId() == TYPEID_PLAYER)
+ {
+ sLog.outString("Send MovementInfo:");
+ OutMovementInfo();
+ }*/
}
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)
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))
diff --git a/src/game/Unit.h b/src/game/Unit.h
index 6ecdc8ccc63..976e5aceadf 100644
--- a/src/game/Unit.h
+++ b/src/game/Unit.h
@@ -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, uint8 type, uint32 MovementFlags, uint32 Time, Player* player = NULL);
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 SendMonsterMoveWithSpeedToCurrentDestination(Player* player = NULL);
void SendMovementFlagUpdate();
diff --git a/src/game/Vehicle.cpp b/src/game/Vehicle.cpp
index 2271bcc3c4a..3fbbd9f922c 100644
--- a/src/game/Vehicle.cpp
+++ b/src/game/Vehicle.cpp
@@ -44,8 +44,7 @@ void Vehicle::AddToWorld()
if(m_zoneScript)
m_zoneScript->OnCreatureCreate(this, true);
ObjectAccessor::Instance().AddObject(this);
- Unit::AddToWorld();
- AIM_Initialize();
+
switch(GetEntry())
{
//case 27850:InstallAccessory(27905,1);break;
@@ -66,11 +65,28 @@ void Vehicle::AddToWorld()
InstallAccessory(33142,2);
break;
}
- if(!GetMaxPower(POWER_MANA)) // m_vehicleInfo->36
+ for(uint32 i = 0; i < MAX_SPELL_VEHICLE; ++i)
{
- setPowerType(POWER_ENERGY);
- SetMaxPower(POWER_ENERGY, 100);
+ 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);
+ SetMaxPower(POWER_ENERGY, 100);
+ break;
+ }
}
+
+ Unit::AddToWorld();
+ AIM_Initialize();
}
}
@@ -114,7 +130,7 @@ void Vehicle::Update(uint32 diff)
{
Creature::Update(diff);
//310
- if(getPowerType() == POWER_ENERGY)
+ if(getPowerType() == POWER_ENERGY) // m_vehicleInfo->36
ModifyPower(POWER_ENERGY, 100);
}
@@ -224,6 +240,8 @@ void Vehicle::InstallAccessory(uint32 entry, int8 seatId)
accessory->m_Vehicle = this;
AddPassenger(accessory, seatId);
+ // This is not good, we have to send update twice
+ accessory->SendMovementFlagUpdate();
}
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
SetCharmedBy(unit, CHARM_TYPE_VEHICLE);
- if(false)
- {
- unit->SendMonsterMoveTransport(this, true);
- }
- else
- {
- if(unit->GetTypeId() == TYPEID_PLAYER)
- ((Player*)unit)->SendTeleportAckMsg();
- unit->SendMovementFlagUpdate();
- }
+ if(IsInWorld())
+ unit->SendMonsterMoveTransport(this);
+
+ //if(unit->GetTypeId() == TYPEID_PLAYER)
+ // ((Player*)unit)->SendTeleportAckMsg();
+ //unit->SendMovementFlagUpdate();
return true;
}