Browse Source

Created HaltMovement to send a client update of no further forward movement, used for fear and mez currently

Fixes #106
Image 4 years ago
parent
commit
c4ad6568d5
2 changed files with 20 additions and 8 deletions
  1. 18 8
      EQ2/source/WorldServer/Entity.cpp
  2. 2 0
      EQ2/source/WorldServer/Entity.h

+ 18 - 8
EQ2/source/WorldServer/Entity.cpp

@@ -1012,6 +1012,11 @@ void Entity::AddMezSpell(LuaSpell* spell) {
 			GetZone()->LockAllSpells((Player*)this);
 	}
 
+	if (IsNPC() && !IsMezImmune())
+	{
+		HaltMovement();
+	}
+
 	mez_spells->Add(spell);
 }
 
@@ -1759,11 +1764,9 @@ void Entity::AddFearSpell(LuaSpell* spell){
 			GetZone()->LockAllSpells((Player*)this);
 	}
 
-	if (IsNPC())
+	if (!IsFearImmune() && IsNPC())
 	{
-		this->ClearRunningLocations();
-		if (GetZone())
-			GetZone()->movementMgr->StopNavigation(this);
+		HaltMovement();
 	}
 
 	control_effects[CONTROL_EFFECT_TYPE_FEAR]->Add(spell);
@@ -1784,10 +1787,7 @@ void Entity::RemoveFearSpell(LuaSpell* spell){
 
 	if (IsNPC())
 	{
-		this->ClearRunningLocations();
-
-		if (GetZone())
-			GetZone()->movementMgr->StopNavigation(this);
+		HaltMovement();
 	}
 }
 
@@ -2462,4 +2462,14 @@ void Entity::CustomizeAppearance(PacketStruct* packet) {
 void Entity::AddSkillBonus(int32 spell_id, int32 skill_id, float value) {
 	// handled in npc or player
 	return;
+}
+
+void Entity::HaltMovement()
+{
+	this->ClearRunningLocations();
+
+	if (GetZone())
+		GetZone()->movementMgr->StopNavigation(this);
+
+	RunToLocation(GetX(), GetY(), GetZ());
 }

+ 2 - 0
EQ2/source/WorldServer/Entity.h

@@ -678,6 +678,8 @@ public:
 	bool IsSnared();
 	float GetHighestSnare();
 
+	void HaltMovement();
+
 
 	void SetCombatPet(Entity* pet) { this->pet = pet; }
 	void SetCharmedPet(Entity* pet) { charmedPet = pet; }