aboutsummaryrefslogtreecommitdiff
path: root/src/game
diff options
context:
space:
mode:
Diffstat (limited to 'src/game')
-rw-r--r--src/game/Creature.cpp2
-rw-r--r--src/game/MapInstanced.cpp8
-rw-r--r--src/game/Spell.cpp19
-rw-r--r--src/game/Traveller.h2
-rw-r--r--src/game/Unit.cpp64
-rw-r--r--src/game/Unit.h21
-rw-r--r--src/game/WaypointMovementGenerator.cpp2
7 files changed, 81 insertions, 37 deletions
diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp
index ae3ddc54165..9244978868e 100644
--- a/src/game/Creature.cpp
+++ b/src/game/Creature.cpp
@@ -1151,7 +1151,7 @@ void Creature::AI_SendMoveToPacket(float x, float y, float z, uint32 time, uint3
m_startMove = getMSTime();
m_moveTime = time;*/
- SendMonsterMove(x, y, z, type, MovementFlags, time);
+ SendMonsterMove(x, y, z, time);
}
Player *Creature::GetLootRecipient() const
diff --git a/src/game/MapInstanced.cpp b/src/game/MapInstanced.cpp
index 5a26a28159f..116d26f4975 100644
--- a/src/game/MapInstanced.cpp
+++ b/src/game/MapInstanced.cpp
@@ -148,7 +148,13 @@ Map* MapInstanced::GetInstance(const WorldObject* obj)
// instantiate or find existing bg map for player
// the instance id is set in battlegroundid
NewInstanceId = player->GetBattleGroundId();
- assert(NewInstanceId);
+ if(!NewInstanceId)
+ {
+ if(player->GetSession()->PlayerLoading())
+ return NULL;
+ else
+ assert(NewInstanceId);
+ }
map = _FindMap(NewInstanceId);
if(!map)
map = CreateBattleGround(NewInstanceId);
diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp
index b5046a18491..aa04784fb97 100644
--- a/src/game/Spell.cpp
+++ b/src/game/Spell.cpp
@@ -2111,25 +2111,6 @@ void Spell::cancel()
finish(false);
- // Unsummon summon as possessed creatures on spell cancel
- if(m_caster->GetTypeId() == TYPEID_PLAYER)
- {
- for(int i = 0; i < 3; ++i)
- {
- if(m_spellInfo->Effect[i] == SPELL_EFFECT_SUMMON &&
- (m_spellInfo->EffectMiscValueB[i] == SUMMON_TYPE_POSESSED ||
- m_spellInfo->EffectMiscValueB[i] == SUMMON_TYPE_POSESSED2 ||
- m_spellInfo->EffectMiscValueB[i] == SUMMON_TYPE_POSESSED3))
- {
- ((Player*)m_caster)->StopCastingCharm();
- break;
- // Possession is removed in the UnSummon function
- //if (m_caster->GetCharm())
- // ((TemporarySummon*)m_caster->GetCharm())->UnSummon();
- }
- }
- }
-
m_caster->RemoveDynObject(m_spellInfo->Id);
m_caster->RemoveGameObject(m_spellInfo->Id,true);
}
diff --git a/src/game/Traveller.h b/src/game/Traveller.h
index d5e5036447f..ff9c426e967 100644
--- a/src/game/Traveller.h
+++ b/src/game/Traveller.h
@@ -107,7 +107,7 @@ template<>
inline void Traveller<Player>::MoveTo(float x, float y, float z, uint32 t)
{
//Only send MOVEMENTFLAG_WALK_MODE, client has strange issues with other move flags
- i_traveller.SendMonsterMove(x, y, z, 0, MOVEMENTFLAG_WALK_MODE, t);
+ i_traveller.SendMonsterMove(x, y, z, t);
}
typedef Traveller<Creature> CreatureTraveller;
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index 8bc70d365cd..92bf97e9e02 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -300,10 +300,41 @@ void Unit::SendMonsterMoveWithSpeed(float x, float y, float z, uint32 MovementFl
transitTime = static_cast<uint32>(dist / speed + 0.5);
}
//float orientation = (float)atan2((double)dy, (double)dx);
- SendMonsterMove(x, y, z, 0, MovementFlags, transitTime, player);
+ SendMonsterMove(x, y, z, transitTime, player);
}
-void Unit::SendMonsterMove(float NewPosX, float NewPosY, float NewPosZ, uint8 type, uint32 MovementFlags, uint32 Time, Player* player)
+void Unit::SendMonsterStop()
+{
+ WorldPacket data( SMSG_MONSTER_MOVE, (17 + GetPackGUID().size()) );
+ data.append(GetPackGUID());
+ data << GetPositionX() << GetPositionY() << GetPositionZ();
+ data << getMSTime();
+ data << uint8(1);
+ SendMessageToSet(&data, true);
+}
+
+void Unit::SendMonsterMove(float NewPosX, float NewPosY, float NewPosZ, uint32 Time, Player* player)
+{
+ WorldPacket data( SMSG_MONSTER_MOVE, (41 + GetPackGUID().size()) );
+ data.append(GetPackGUID());
+
+ data << GetPositionX() << GetPositionY() << GetPositionZ();
+ data << getMSTime();
+
+ data << uint8(0);
+ data << uint32((GetUnitMovementFlags() & MOVEMENTFLAG_LEVITATING) ? MOVEFLAG_FLY : MOVEFLAG_WALK);
+
+ data << Time; // Time in between points
+ data << uint32(1); // 1 single waypoint
+ data << NewPosX << NewPosY << NewPosZ; // the single waypoint Point B
+
+ if(player)
+ player->GetSession()->SendPacket(&data);
+ else
+ SendMessageToSet( &data, true );
+}
+
+/*void Unit::SendMonsterMove(float NewPosX, float NewPosY, float NewPosZ, uint8 type, uint32 MovementFlags, uint32 Time, Player* player)
{
WorldPacket data( SMSG_MONSTER_MOVE, (41 + GetPackGUID().size()) );
data.append(GetPackGUID());
@@ -337,7 +368,7 @@ void Unit::SendMonsterMove(float NewPosX, float NewPosY, float NewPosZ, uint8 ty
}
//Movement Flags (0x0 = walk, 0x100 = run, 0x200 = fly/swim)
- data << uint32(GetTypeId() == TYPEID_PLAYER ? MOVEMENTFLAG_WALK_MODE : MovementFlags);
+ data << uint32((MovementFlags & MOVEMENTFLAG_LEVITATING) ? MOVEFLAG_FLY : MOVEFLAG_WALK);
data << Time; // Time in between points
data << uint32(1); // 1 single waypoint
@@ -347,9 +378,9 @@ void Unit::SendMonsterMove(float NewPosX, float NewPosY, float NewPosZ, uint8 ty
player->GetSession()->SendPacket(&data);
else
SendMessageToSet( &data, true );
-}
+}*/
-void Unit::SendMonsterMoveByPath(Path const& path, uint32 start, uint32 end, uint32 MovementFlags)
+void Unit::SendMonsterMoveByPath(Path const& path, uint32 start, uint32 end)
{
uint32 traveltime = uint32(path.GetTotalLength(start, end) * 32);
@@ -361,13 +392,10 @@ void Unit::SendMonsterMoveByPath(Path const& path, uint32 start, uint32 end, uin
data << GetPositionY();
data << GetPositionZ();
- // unknown field - unrelated to orientation
- // seems to increment about 1000 for every 1.7 seconds
- // for now, we'll just use mstime
data << getMSTime();
data << uint8( 0 );
- data << uint32( MovementFlags );
+ data << uint32(((GetUnitMovementFlags() & MOVEMENTFLAG_LEVITATING) || isInFlight())? MOVEFLAG_FLY : MOVEFLAG_WALK);
data << uint32( traveltime );
data << uint32( pathSize );
data.append( (char*)path.GetNodes(start), pathSize * 4 * 3 );
@@ -4150,6 +4178,22 @@ void Unit::RemoveAura(AuraMap::iterator &i, AuraRemoveMode mode)
}
}
}
+
+ // Unsummon summon as possessed creatures on spell cancel
+ if(caster->GetTypeId() == TYPEID_PLAYER)
+ {
+ for(int i = 0; i < 3; ++i)
+ {
+ if(AurSpellInfo->Effect[i] == SPELL_EFFECT_SUMMON &&
+ (AurSpellInfo->EffectMiscValueB[i] == SUMMON_TYPE_POSESSED ||
+ AurSpellInfo->EffectMiscValueB[i] == SUMMON_TYPE_POSESSED2 ||
+ AurSpellInfo->EffectMiscValueB[i] == SUMMON_TYPE_POSESSED3))
+ {
+ ((Player*)caster)->StopCastingCharm();
+ break;
+ }
+ }
+ }
}
}
@@ -11425,7 +11469,7 @@ void Unit::StopMoving()
// Relocate(GetPositionX(), GetPositionY(), z);
Relocate(GetPositionX(), GetPositionY(),GetPositionZ());
- SendMonsterMove(GetPositionX(), GetPositionY(), GetPositionZ(), 0, true, 0);
+ SendMonsterStop();
// update position and orientation;
WorldPacket data;
diff --git a/src/game/Unit.h b/src/game/Unit.h
index f199e19070b..5b54cc013a4 100644
--- a/src/game/Unit.h
+++ b/src/game/Unit.h
@@ -582,6 +582,17 @@ enum NPCFlags
UNIT_NPC_FLAG_OUTDOORPVP = 0x20000000, // custom flag for outdoor pvp creatures
};
+enum MoveFlags
+{
+ MOVEFLAG_NONE = 0x00000000,
+ MOVEFLAG_SLIDE = 0x00000002,
+ MOVEFLAG_MARCH_ON_SPOT = 0x00000004,
+ MOVEFLAG_JUMP = 0x00000008,
+ MOVEFLAG_WALK = 0x00000100,
+ MOVEFLAG_FLY = 0x00000200, //For dragon (+walk = glide)
+ MOVEFLAG_ORIENTATION = 0x00000400, //Fix orientation
+};
+
enum MovementFlags
{
MOVEMENTFLAG_NONE = 0x00000000,
@@ -593,8 +604,8 @@ enum MovementFlags
MOVEMENTFLAG_RIGHT = 0x00000020,
MOVEMENTFLAG_PITCH_UP = 0x00000040,
MOVEMENTFLAG_PITCH_DOWN = 0x00000080,
- MOVEMENTFLAG_WALK_MODE = 0x00000100, // Walking
- MOVEMENTFLAG_ONTRANSPORT = 0x00000200, // Used for flying on some creatures
+ MOVEMENTFLAG_WALK_MODE = 0x00000100,
+ MOVEMENTFLAG_ONTRANSPORT = 0x00000200,
MOVEMENTFLAG_LEVITATING = 0x00000400,
MOVEMENTFLAG_FLY_UNK1 = 0x00000800,
MOVEMENTFLAG_JUMPING = 0x00001000,
@@ -1124,8 +1135,10 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
void SendSpellNonMeleeDamageLog(Unit *target,uint32 SpellID,uint32 Damage, SpellSchoolMask damageSchoolMask,uint32 AbsorbedDamage, uint32 Resist,bool PhysicalDamage, uint32 Blocked, bool CriticalHit = false);
void SendSpellMiss(Unit *target, uint32 spellID, SpellMissInfo missInfo);
- 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, uint32 MovementFlags);
+ void SendMonsterStop();
+ void SendMonsterMove(float NewPosX, float NewPosY, float NewPosZ, 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 SendMonsterMoveWithSpeed(float x, float y, float z, uint32 MovementFlags, uint32 transitTime = 0, Player* player = NULL);
void SendMonsterMoveWithSpeedToCurrentDestination(Player* player = NULL);
diff --git a/src/game/WaypointMovementGenerator.cpp b/src/game/WaypointMovementGenerator.cpp
index 9810d83dcd1..5aa7666db10 100644
--- a/src/game/WaypointMovementGenerator.cpp
+++ b/src/game/WaypointMovementGenerator.cpp
@@ -249,7 +249,7 @@ FlightPathMovementGenerator::Initialize(Player &player)
// do not send movement, it was sent already
i_destinationHolder.SetDestination(traveller, i_path[i_currentNode].x, i_path[i_currentNode].y, i_path[i_currentNode].z, false);
- player.SendMonsterMoveByPath(GetPath(),GetCurrentNode(),GetPathAtMapEnd(),MOVEMENTFLAG_WALK_MODE|MOVEMENTFLAG_ONTRANSPORT);
+ player.SendMonsterMoveByPath(GetPath(),GetCurrentNode(),GetPathAtMapEnd());
}
void FlightPathMovementGenerator::Finalize(Player & player)