Показать сообщение отдельно
Старый 11.06.2010, 15:24   #1
alien
Ученый
 
Регистрация: 17.05.2010
Сообщений: 148
Сказал(а) спасибо: 18
Поблагодарили 25 раз(а) в 22 сообщениях
alien На верном пути
По умолчанию [mod/dev] EffectJump

Код:
diff --git a/src/game/MotionMaster.cpp b/src/game/MotionMaster.cpp
index c43ce0f..96baee6 100644
--- a/src/game/MotionMaster.cpp
+++ b/src/game/MotionMaster.cpp
@@ -305,6 +305,27 @@ MotionMaster::MovePoint(uint32 id, float x, float y, float z)
     else
         Mutate(new PointMovementGenerator<Creature>(id,x,y,z));
 }
+void 
+MotionMaster::MoveJump(float x, float y, float z, float speedZ)
+{
+    uint32 moveFlag = SPLINEFLAG_TRAJECTORY | SPLINEFLAG_WALKMODE;
+    uint32 time = 521;
+
+    i_owner->addUnitState(UNIT_STAT_FLEEING_MOVE | UNIT_STAT_JUMPING);
+    if (i_owner->GetTypeId() == TYPEID_PLAYER)
+    {
+        DEBUG_LOG("Player (GUID: %u) jump to point (X: %f Y: %f Z: %f)", i_owner->GetGUIDLow(), x, y, z);
+        Mutate(new PointMovementGenerator<Player>(0,x,y,z));
+    }
+    else
+    {
+        DEBUG_LOG("Creature (Entry: %u GUID: %u) jump to point (X: %f Y: %f Z: %f)",
+            i_owner->GetEntry(), i_owner->GetGUIDLow(), x, y, z);
+        Mutate(new PointMovementGenerator<Creature>(0,x,y,z));
+    }
+
+    i_owner->SendMonsterMove(x, y, z,SPLINETYPE_NORMAL, (SplineFlags)moveFlag, time,NULL, speedZ);
+}
 
 void
 MotionMaster::MoveSeekAssistance(float x, float y, float z)
diff --git a/src/game/MotionMaster.h b/src/game/MotionMaster.h
index 139387a..097e4f8 100644
--- a/src/game/MotionMaster.h
+++ b/src/game/MotionMaster.h
@@ -115,6 +115,8 @@ class MANGOS_DLL_SPEC MotionMaster : private std::stack<MovementGenerator *>
         void UpdateFinalDistanceToTarget(float fDistance);
 
         bool GetDestination(float &x, float &y, float &z);
+
+		void MoveJump(float x, float y, float z, float speedZ);
     private:
         void Mutate(MovementGenerator *m);                  // use Move* functions instead
 
diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp
index 109e9b3..b491d15 100644
--- a/src/game/SpellEffects.cpp
+++ b/src/game/SpellEffects.cpp
@@ -2772,7 +2789,15 @@ void Spell::EffectJump(SpellEffectIndex eff_idx)
         return;
     }
 
-    m_caster->NearTeleportTo(x, y, z, o, true);
+   // m_caster->NearTeleportTo(x, y, z, o, true);
+	    float speedZ;
+    if (m_spellInfo->EffectMiscValue[eff_idx])
+        speedZ = float(m_spellInfo->EffectMiscValue[eff_idx])/7.8f;
+    else if (m_spellInfo->EffectMiscValueB[eff_idx])
+        speedZ = float(m_spellInfo->EffectMiscValueB[eff_idx])/7.8f;
+    else
+        speedZ = 10.0f;
+    m_caster->GetMotionMaster()->MoveJump(x, y, z, speedZ);
 }
 
 void Spell::EffectTeleportUnits(SpellEffectIndex eff_idx)
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index e35ab4f..1c1e59a 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -387,8 +387,16 @@ void Unit::SendMonsterMove(float NewPosX, float NewPosY, float NewPosZ, SplineTy
     // enable me if things goes wrong or looks ugly, it is however an old hack
     // if(flags & SPLINEFLAG_WALKMODE)
         // moveTime *= 1.05f;
-
-    data << uint32(moveTime);                               // Time in between points
+		
+	    if (flags & SPLINEFLAG_TRAJECTORY)
+    {
+        data << uint32(moveTime);  
+        data << float(va_arg(vargs,double));
+        data << uint32(0); // walk time after jump
+    }
+    else
+        data << uint32(moveTime);                              // Time in between points
+		
     data << uint32(1);                                      // 1 single waypoint
     data << NewPosX << NewPosY << NewPosZ;                  // the single waypoint Point B
 
diff --git a/src/game/Unit.h b/src/game/Unit.h
index 9f5440f..fb5e033 100644
--- a/src/game/Unit.h
+++ b/src/game/Unit.h
@@ -435,7 +435,7 @@ enum UnitState
     UNIT_STAT_FOLLOW_MOVE     = 0x00008000,
     UNIT_STAT_FLEEING         = 0x00010000,                     // FleeMovementGenerator/TimedFleeingMovementGenerator active/onstack
     UNIT_STAT_FLEEING_MOVE    = 0x00020000,
-
+	UNIT_STAT_JUMPING		  = 0x00040000,
     // masks (only for check)
 
     // can't move currently
Собственно выдрано из Тринити и переработано.
Но остались некоторые вопросы.
1) как высчитать uint32 time = 521;
В тринити делают так uint32 time = speedZ * 100;
Но это неправильно.(так как при их расчетах получается число 1500 а должно 521, это напримере Десгрипа http://ru.wowhead.com/spell=49575).
2)И значение speedZ у них неверное. Должно быть в раене 19.2
При поможи speedZ = float(m_spellInfo->EffectMiscValueB[eff_idx])/7.8f;
получилось что-то близкое к 19.2, но тоже не уверен в правильности)

Не откажусь от советов и помощи в доработки.

Последний раз редактировалось alien; 11.06.2010 в 15:26.
alien вне форума   Ответить с цитированием
3 пользователя(ей) сказали cпасибо:
Limpnau (12.06.2010), Medivh (25.06.2010), PSZ (11.06.2010)