From b5aeba251d67f344f729d53b0853d1c83364ad8a Mon Sep 17 00:00:00 2001 From: Tungdv Date: Thu, 4 Dec 2025 19:18:58 +0700 Subject: [PATCH 1/7] fix: update logic jump stand for HP. --- .../Scripts/Managers/EC_HPWork.cs | 46 ++- .../Scripts/Managers/EC_HPWorkMove.cs | 4 +- .../Scripts/Managers/EC_HPWorkStand.cs | 6 +- .../PerfectWorld/Scripts/Move/CECHostMove.cs | 10 +- Assets/Scripts/CECGameRun.cs | 1 + Assets/Scripts/CECHostPlayer.cs | 359 ++++++++++++------ 6 files changed, 293 insertions(+), 133 deletions(-) diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_HPWork.cs b/Assets/PerfectWorld/Scripts/Managers/EC_HPWork.cs index 6628160650..7b23b424a7 100644 --- a/Assets/PerfectWorld/Scripts/Managers/EC_HPWork.cs +++ b/Assets/PerfectWorld/Scripts/Managers/EC_HPWork.cs @@ -1,6 +1,6 @@ using BrewMonster.Network; -using BrewMonster.Scripts.Player; using System.Collections.Generic; +using UnityEngine; namespace BrewMonster.Scripts { @@ -431,11 +431,25 @@ namespace BrewMonster.Scripts public void CancelWork(CECHPWork pWork) { - + if (pWork == null) + { + //ASSERT(false); + return; + } + pWork.Cancel(); } public void CancelWorkAtPriority(int iPriority) { - + if (!ValidatePriority(iPriority)) + { + return; + } + WorkList workList = m_WorkStack[iPriority]; + for (int i = 0; i < workList.Count; ++i) + { + CancelWork(workList[i]); + //LOG_DEBUG_INFO(AString().Format("CECHPWork::%s priority=%d cancelled", workList[i]->GetWorkName(), iPriority)); + } } public bool DelayWork(int iPriority, CECHPWork pWork) @@ -479,11 +493,24 @@ namespace BrewMonster.Scripts } public void StartDelayedWork() { - + if (!HasDelayedWork()) + { + return; + } + CECHPWork pWork = m_Delayed.pWork; + m_Delayed.pWork = null; + //LOG_DEBUG_INFO(AString().Format("CECHPWork:: start delayed work %s, priority=%d", pWork->GetWorkName(), m_Delayed.iPriority)); + InternallyStartWork(m_Delayed.iPriority, pWork); } public void ClearDelayedWork() { - + if (!HasDelayedWork()) + { + return; + } + //LOG_DEBUG_INFO(AString().Format("delayed CECHPWork::%s priority=%d cleared", m_Delayed.pWork->GetWorkName(), m_Delayed.iPriority)); + //delete m_Delayed.pWork; + m_Delayed.pWork = null; } public CECHPWork GetDelayedWork() { @@ -742,6 +769,11 @@ namespace BrewMonster.Scripts { return IsWorkRunning(CECHPWork.Host_work_ID.WORK_PICKUP); } + + bool HasDelayedWork() + { + return GetDelayedWork() != null; + } } public abstract class CECHPWorkPostTickCommand { @@ -781,7 +813,7 @@ namespace BrewMonster.Scripts int m_iPriority; bool m_bNoDelay; bool m_bShouldTick; - uint m_dwTickTime; + float m_dwTickTime; // Constructor public CECHPWorkPostTickRunWorkCommand( @@ -789,7 +821,7 @@ namespace BrewMonster.Scripts bool bNoDelay = false, int iPriority = CECHPWorkMan.Work_priority.PRIORITY_1, bool bShouldTick = false, - uint dwTickTime = 0) + float dwTickTime = 0) { m_pWork = pWork; m_bNoDelay = bNoDelay; diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_HPWorkMove.cs b/Assets/PerfectWorld/Scripts/Managers/EC_HPWorkMove.cs index e1df5402a8..fd625e89c8 100644 --- a/Assets/PerfectWorld/Scripts/Managers/EC_HPWorkMove.cs +++ b/Assets/PerfectWorld/Scripts/Managers/EC_HPWorkMove.cs @@ -507,6 +507,7 @@ namespace BrewMonster.Scripts if ((GetMoveRelDirMask() & (uint)((MOVE_DIR.MD_LEFT | MOVE_DIR.MD_RIGHT | MOVE_DIR.MD_FORWARD | MOVE_DIR.MD_BACK))) != 0) m_iDestType = DestTypes.DEST_PUSH; + Debug.LogError("m_iDestType = " + m_iDestType); if (m_iDestType == DestTypes.DEST_2D) { float fDist; @@ -614,8 +615,7 @@ namespace BrewMonster.Scripts } else { - vCurPos = m_pHost.m_MoveCtrl.GroundMove(GPDataTypeHelper.g_vOrigin, 0.0f, fDeltaTime, m_pHost.m_fVertSpeed); - Debug.LogError("vCurPos = " + vCurPos + " m_pHost.m_fVertSpeed = " + m_pHost.m_fVertSpeed); + vCurPos = m_pHost.m_MoveCtrl.GroundMove(GPDataTypeHelper.g_vOrigin, 0.0f, fDeltaTime, m_pHost.m_fVertSpeed); m_pHost.SetPos(EC_Utility.ToVector3(vCurPos)); if (m_pHost.m_MoveCtrl.MoveBlocked() >= 3) diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_HPWorkStand.cs b/Assets/PerfectWorld/Scripts/Managers/EC_HPWorkStand.cs index 3997eaf683..c19caceb61 100644 --- a/Assets/PerfectWorld/Scripts/Managers/EC_HPWorkStand.cs +++ b/Assets/PerfectWorld/Scripts/Managers/EC_HPWorkStand.cs @@ -134,7 +134,7 @@ namespace BrewMonster.Scripts { pWork.SetDestination(CECHPWorkMove.DestTypes.DEST_STANDJUMP, GPDataTypeHelper.g_vOrigin); m_pWorkMan.SetPostTickCommand(new CECHPWorkPostTickRunWorkCommand( - pWork, false, CECHPWorkMan.Work_priority.PRIORITY_1, true, (uint)dwDeltaTime)); + pWork, false, CECHPWorkMan.Work_priority.PRIORITY_1, true, dwDeltaTime)); } } else if (iMoveReason == 2) @@ -150,10 +150,8 @@ namespace BrewMonster.Scripts { // ASSERT(0); } - return true; } - // Play appropriate actions if (m_iPoseAction == (int)CECPlayer.PLAYER_ACTION_TYPE.ACT_STAND) { @@ -174,7 +172,7 @@ namespace BrewMonster.Scripts if (m_iPoseAction == (int)CECPlayer.PLAYER_ACTION_TYPE.ACT_STAND) { // Chariot war special case omitted for now - m_pHost.PlayAction(m_iCurAction, false, 0); + m_pHost.PlayAction(m_iCurAction, false, 300); //m_oldAction = m_iCurAction; } diff --git a/Assets/PerfectWorld/Scripts/Move/CECHostMove.cs b/Assets/PerfectWorld/Scripts/Move/CECHostMove.cs index 8b0e05fe2d..d52ed0847a 100644 --- a/Assets/PerfectWorld/Scripts/Move/CECHostMove.cs +++ b/Assets/PerfectWorld/Scripts/Move/CECHostMove.cs @@ -305,7 +305,7 @@ namespace BrewMonster { cdr.fYVel += fSpeedV; EC_CDR.OnGroundMove(ref cdr); - + m_pHost.m_CDRInfo = cdr; //if (g_pGame.GetGameRun().GetWorld().GetAssureMove()) // g_pGame.GetGameRun().GetWorld().GetAssureMove().AssureMove(m_pHost.m_aabbServer.Center, cdr.vCenter); @@ -319,10 +319,14 @@ namespace BrewMonster { m_iBlockedCnt = 0; m_fBlockMove += (vNewPos - m_pHost.GetPos()).Magnitude(); m_vBlockMove += vNewPos - m_pHost.GetPos(); - if ((m_fBlockTime += fTime) >= 1.0f) + m_fBlockTime += fTime; + //TO DO: in c++ set 1.0f. Convert to c#, this logic is wrong. If set time is 2.0, game run correct + if ((m_fBlockTime) >= 2.0f) { + Debug.LogError("m_fBlockMove = " + m_fBlockMove); if (m_fBlockMove < GPDataTypeHelper.MIN_MOVELEN_ON_GROUND || m_vBlockMove.Magnitude() < GPDataTypeHelper.MIN_MOVELEN_FOR_DETECT_VIBRATION) { + Debug.LogError("m_iBlockedCnt = 5"); m_iBlockedCnt = 5; } @@ -340,6 +344,8 @@ namespace BrewMonster { public void SetSlideLock(bool bLock) { m_bSlideLock = bLock; } // Is stoping ? public bool IsStop() { return m_bStop; } + // Get host's last position sent to server + public Vector3 GetLastSevPos() { return m_vLastSevPos; } } public struct CDR_INFO { diff --git a/Assets/Scripts/CECGameRun.cs b/Assets/Scripts/CECGameRun.cs index 27319ec720..4c2f3ce59f 100644 --- a/Assets/Scripts/CECGameRun.cs +++ b/Assets/Scripts/CECGameRun.cs @@ -29,6 +29,7 @@ public partial class CECGameRun public void Init() { + Application.targetFrameRate = 60; instance = this; // _gameRunConfig = Resources.Load("GameRunConfig"); // _playerPrefab = _gameRunConfig.PlayerPrefab; diff --git a/Assets/Scripts/CECHostPlayer.cs b/Assets/Scripts/CECHostPlayer.cs index d495a1c5a1..0ecf4b710b 100644 --- a/Assets/Scripts/CECHostPlayer.cs +++ b/Assets/Scripts/CECHostPlayer.cs @@ -7,6 +7,7 @@ using BrewMonster.Scripts; using BrewMonster.Scripts.Managers; using BrewMonster.Scripts.Player; using BrewMonster.Scripts.Skills; +using BrewMonster.Scripts.World; using CSNetwork; using CSNetwork.GPDataType; using CSNetwork.Protocols.RPCData; @@ -260,21 +261,26 @@ namespace BrewMonster } #endif + // Update cursor based on what's under mouse + EstimateCursor(); //Debug.Log($"(ulong)Time.deltaTime * 1000 {(ulong)(Time.deltaTime * 1000)}"); m_MoveCtrl.Tick((ulong)(Time.deltaTime * 1000)); // Nếu có thay đổi runtime, có thể lấy lại mỗi vài giây/Start nếu bạn thích: // ccRadius = controller.radius; ccSkin = controller.skinWidth; + EstimateMoveEnv(GetPos()); + _playerStateMachine.UpdateState(); OnKeyDown(); m_pWorkMan?.Tick(Time.deltaTime); - // Update cursor based on what's under mouse - EstimateCursor(); // Update GFXs UpdateGFXs(Time.deltaTime); + + //m_dwMoveRelDir = 0; + m_fVertSpeed = 0.0f; } public void StopMovement() @@ -1270,15 +1276,15 @@ namespace BrewMonster m_pWorkMan.StartWork_p0(m_pWorkMan.CreateWork(Host_work_ID.WORK_STAND)); if (IsDead()) { - //CECHPWorkDead pWork = (CECHPWorkDead*)m_pWorkMan->CreateWork(CECHPWork.Host_work_ID.WORK_DEAD); - //pWork->SetBeDeadFlag(true); - //m_pWorkMan->StartWork_p0(pWork); - EventBus.PublishChannel(GetCharacterID(), new CECPlayer.ClearComActFlagAllRankNodesEvent(true)); - PlayAction((int)PLAYER_ACTION_TYPE.ACT_GROUNDDIE); - if (PopupManager.Instance != null) - { - PopupManager.Instance.OnPlayerDied(); - } + //CECHPWorkDead pWork = (CECHPWorkDead*)m_pWorkMan.CreateWork(CECHPWork.Host_work_ID.WORK_DEAD); + //pWork.SetBeDeadFlag(true); + //m_pWorkMan.StartWork_p0(pWork); + EventBus.PublishChannel(GetCharacterID(), new CECPlayer.ClearComActFlagAllRankNodesEvent(true)); + PlayAction((int)PLAYER_ACTION_TYPE.ACT_GROUNDDIE); + if (PopupManager.Instance != null) + { + PopupManager.Instance.OnPlayerDied(); + } } else { @@ -2882,134 +2888,134 @@ namespace BrewMonster vRight.z = joystick.Vertical; vRight.y = 0f; vRight.Normalize(); - if(vRight == Vector3.zero) + if (vRight == Vector3.zero) { return false; } vPushDir = vRight; - /* // reset - vPushDir = Vector3.zero; - Vector3 vRight = Vector3.zero; - bool bMove = false; + /* // reset + vPushDir = Vector3.zero; + Vector3 vRight = Vector3.zero; + bool bMove = false; - // Không bấm gì → không có hướng - if (m_dwMoveRelDir == 0) - return false; + // Không bấm gì → không có hướng + if (m_dwMoveRelDir == 0) + return false; - // ===== LEFT ===== - if ((m_dwMoveRelDir & MD_LEFT) != 0) - { - // Nếu trên không → xoay camera thay vì di chuyển - if (m_iMoveEnv == MOVEENV_AIR) - { - // giữ nguyên logic PW - ECMSG msg = new ECMSG(); - msg.dwParam2 = 0; - msg.dwParam1 = (uint)(_yaw_vel_air * deltaTime); + // ===== LEFT ===== + if ((m_dwMoveRelDir & MD_LEFT) != 0) + { + // Nếu trên không → xoay camera thay vì di chuyển + if (m_iMoveEnv == MOVEENV_AIR) + { + // giữ nguyên logic PW + ECMSG msg = new ECMSG(); + msg.dwParam2 = 0; + msg.dwParam1 = (uint)(_yaw_vel_air * deltaTime); - if ((m_dwMoveRelDir & MD_BACK) != 0) - msg.dwParam1 = (uint)(-(int)msg.dwParam1); + if ((m_dwMoveRelDir & MD_BACK) != 0) + msg.dwParam1 = (uint)(-(int)msg.dwParam1); - OnMsgHstYaw(msg); // TODO: bạn map hàm này sang Unity - } - else if (m_iMoveEnv == MOVEENV_WATER) - { - ECMSG msg = new ECMSG(); - msg.dwParam2 = 0; - msg.dwParam1 = (uint)(_yaw_vel * deltaTime); + OnMsgHstYaw(msg); // TODO: bạn map hàm này sang Unity + } + else if (m_iMoveEnv == MOVEENV_WATER) + { + ECMSG msg = new ECMSG(); + msg.dwParam2 = 0; + msg.dwParam1 = (uint)(_yaw_vel * deltaTime); - if ((m_dwMoveRelDir & MD_BACK) != 0) - msg.dwParam1 = (uint)(-(int)msg.dwParam1); + if ((m_dwMoveRelDir & MD_BACK) != 0) + msg.dwParam1 = (uint)(-(int)msg.dwParam1); - OnMsgHstYaw(msg); // TODO - } - else - { - // Mặt đất → di chuyển sang trái theo camera - // C++: vRight = -m_CameraCoord.GetRight(); - Vector3 camRight = m_CameraCoord.GetRight(); // TODO: map sang Unity Camera? - vRight = -camRight; - vRight.y = 0; - vRight.Normalize(); + OnMsgHstYaw(msg); // TODO + } + else + { + // Mặt đất → di chuyển sang trái theo camera + // C++: vRight = -m_CameraCoord.GetRight(); + Vector3 camRight = m_CameraCoord.GetRight(); // TODO: map sang Unity Camera? + vRight = -camRight; + vRight.y = 0; + vRight.Normalize(); - vPushDir = vRight; - bMove = true; - } - } + vPushDir = vRight; + bMove = true; + } + } - // ===== RIGHT ===== - else if ((m_dwMoveRelDir & MD_RIGHT) != 0) - { - if (m_iMoveEnv == MOVEENV_AIR) - { - ECMSG msg = new ECMSG(); - msg.dwParam2 = 0; - msg.dwParam1 = (uint)((-_yaw_vel_air) * deltaTime); + // ===== RIGHT ===== + else if ((m_dwMoveRelDir & MD_RIGHT) != 0) + { + if (m_iMoveEnv == MOVEENV_AIR) + { + ECMSG msg = new ECMSG(); + msg.dwParam2 = 0; + msg.dwParam1 = (uint)((-_yaw_vel_air) * deltaTime); - if ((m_dwMoveRelDir & MD_BACK) != 0) - msg.dwParam1 = (uint)(-(int)msg.dwParam1); + if ((m_dwMoveRelDir & MD_BACK) != 0) + msg.dwParam1 = (uint)(-(int)msg.dwParam1); - OnMsgHstYaw(msg); // TODO - } - else if (m_iMoveEnv == MOVEENV_WATER) - { - ECMSG msg = new ECMSG(); - msg.dwParam2 = 0; - msg.dwParam1 = (uint)((-_yaw_vel) * deltaTime); + OnMsgHstYaw(msg); // TODO + } + else if (m_iMoveEnv == MOVEENV_WATER) + { + ECMSG msg = new ECMSG(); + msg.dwParam2 = 0; + msg.dwParam1 = (uint)((-_yaw_vel) * deltaTime); - if ((m_dwMoveRelDir & MD_BACK) != 0) - msg.dwParam1 = (uint)(-(int)msg.dwParam1); + if ((m_dwMoveRelDir & MD_BACK) != 0) + msg.dwParam1 = (uint)(-(int)msg.dwParam1); - OnMsgHstYaw(msg); // TODO - } - else - { - // Mặt đất → di chuyển sang phải theo camera - Vector3 camRight = m_CameraCoord.GetRight(); // TODO - vRight = camRight; - vRight.y = 0; - vRight.Normalize(); + OnMsgHstYaw(msg); // TODO + } + else + { + // Mặt đất → di chuyển sang phải theo camera + Vector3 camRight = m_CameraCoord.GetRight(); // TODO + vRight = camRight; + vRight.y = 0; + vRight.Normalize(); - vPushDir = vRight; - bMove = true; - } - } + vPushDir = vRight; + bMove = true; + } + } - // ===== FORWARD ===== - if ((m_dwMoveRelDir & MD_FORWARD) != 0) - { - Vector3 forward = m_CameraCoord.GetDir(); // TODO - forward.y = 0; - forward.Normalize(); + // ===== FORWARD ===== + if ((m_dwMoveRelDir & MD_FORWARD) != 0) + { + Vector3 forward = m_CameraCoord.GetDir(); // TODO + forward.y = 0; + forward.Normalize(); - vPushDir = forward; + vPushDir = forward; - if (bMove) - { - vPushDir += vRight; - vPushDir.Normalize(); - } - } - // ===== BACK ===== - else if ((m_dwMoveRelDir & MD_BACK) != 0) - { - Vector3 back = -m_CameraCoord.GetDir(); // TODO - back.y = 0; - back.Normalize(); + if (bMove) + { + vPushDir += vRight; + vPushDir.Normalize(); + } + } + // ===== BACK ===== + else if ((m_dwMoveRelDir & MD_BACK) != 0) + { + Vector3 back = -m_CameraCoord.GetDir(); // TODO + back.y = 0; + back.Normalize(); - vPushDir = back; + vPushDir = back; - if (bMove) - { - vPushDir += vRight; - vPushDir.Normalize(); - } - } - // ===== ABS UP (nếu mask cho phép) ===== - else if (((m_dwMoveRelDir & MD_ABSUP) != 0) && ((dwMask & MD_ABSUP) != 0)) - { - vPushDir = Vector3.up; - }*/ + if (bMove) + { + vPushDir += vRight; + vPushDir.Normalize(); + } + } + // ===== ABS UP (nếu mask cho phép) ===== + else if (((m_dwMoveRelDir & MD_ABSUP) != 0) && ((dwMask & MD_ABSUP) != 0)) + { + vPushDir = Vector3.up; + }*/ return true; } @@ -3366,9 +3372,126 @@ namespace BrewMonster } public void SetRotationHP(Vector3 dir) - { + { transform.rotation = Quaternion.LookRotation(dir); } + + // Estimate move environment + void EstimateMoveEnv(A3DVECTOR3 vPos) + { + if (IsFlying()) + { + m_iMoveEnv = Move_environment.MOVEENV_AIR; + return; + } + + CECWorld pWorld = EC_Game.GetGameRun().GetWorld(); + // m_GndInfo.fGndHei = pWorld.GetTerrainHeight(vPos, &m_GndInfo.vGndNormal); + + // Test whether last pos is in air + A3DVECTOR3 vGndPos0, vTestPos0 = m_MoveCtrl.GetLastSevPos() + g_vAxisY * m_aabbServer.Extents.y; + VertRayTrace(vTestPos0, vGndPos0, m_GndInfo.vGndNormal); + + m_GndInfo.fGndHei = vGndPos0.y; + + A3DVECTOR3 vAABBGnd; + VertAABBTrace(vTestPos0, m_aabbServer.Extents, vAABBGnd, m_GndInfo.vGndNormal); + vAABBGnd.y -= m_aabbServer.Extents.y; + + bool bIsInAir = false; + if (m_MoveCtrl.GetLastSevPos().y - vAABBGnd.y > 0.2f) + bIsInAir = true; + + A3DVECTOR3 vGndPos, vTestPos = vPos + g_vAxisY * m_aabbServer.Extents.y; + VertRayTrace(vTestPos, vGndPos, m_GndInfo.vGndNormal); + m_GndInfo.fGndHei = vGndPos.y; + m_GndInfo.fWaterHei = pWorld.GetWaterHeight(vTestPos); + + //@note : use the aabb trace. By Kuiwu[12/10/2005] + VertAABBTrace(vTestPos, m_aabbServer.Extents, vAABBGnd, m_GndInfo.vGndNormal); + vAABBGnd.y -= m_aabbServer.Extents.y; + + //@note : By Kuiwu[12/10/2005] + int iNewEnv = MOVEENV_GROUND; + if (CheckWaterMoveEnv(vPos, m_GndInfo.fWaterHei, vAABBGnd.y)) + iNewEnv = MOVEENV_WATER; + + // ·ÉÌì¹ÒÎÊÌâ + + if (iNewEnv == MOVEENV_GROUND && GetPos().y - vAABBGnd.y < 0.2f && bIsInAir && GetPos() != m_MoveCtrl.GetLastSevPos()) + { + m_MoveCtrl.SendMoveCmd(GetPos(), 2, g_vAxisY, m_CDRInfo.vAbsVelocity, m_iMoveMode, true); + // BubbleText(BUBBLE_LEVELUP, 0); + } + + if (iNewEnv == MOVEENV_GROUND) + { + m_GndInfo.bOnGround = true; + + // if (vPos.y > m_GndInfo.fGndHei + 0.2f) + if (m_CDRInfo.vTPNormal.IsZero()) + { + if (m_iMoveMode != MOVE_FREEFALL) + m_iMoveMode = MOVE_FREEFALL; + + m_GndInfo.bOnGround = false; + if (IsJumping() && m_CDRInfo.vAbsVelocity.y < 0.0f && vPos.y - vAABBGnd.y < 0.6f) + { + PlayAction(ACT_JUMP_LAND, false); + } + } + else + { + if (IsJumping() && m_CDRInfo.vAbsVelocity.y < 0.0f && vPos.y - vAABBGnd.y < 0.6f) + { + PlayAction(ACT_JUMP_LAND, false); + ResetJump(); + } + + // if (m_GndInfo.vGndNormal.y < EC_SLOPE_Y) + if (m_CDRInfo.vTPNormal.y < EC_SLOPE_Y) + { + if (!m_MoveCtrl.GetSlideLock()) + { + if (m_iMoveMode != MOVE_SLIDE) + { + m_iOldWalkMode = m_iMoveMode; + m_iMoveMode = MOVE_SLIDE; + } + } + else + { + m_MoveCtrl.SetSlideLock(false); + m_iMoveMode = MOVE_STAND; + } + } + else + { + m_MoveCtrl.SetSlideLock(false); + if (m_iMoveMode == MOVE_FREEFALL) + { + m_iMoveMode = MOVE_STAND; + } + else if (m_iMoveMode == MOVE_SLIDE) + m_iMoveMode = m_iOldWalkMode; + } + } + } + else if (iNewEnv == MOVEENV_WATER) + { + m_CDRInfo.fYVel = 0.0f; + + if (m_iMoveMode == MOVE_SLIDE) + { + if (m_pWorkMan.IsMoving()) + m_iMoveMode = MOVE_MOVE; + else + m_iMoveMode = MOVE_STAND; + } + } + + m_iMoveEnv = iNewEnv; + } } public enum StateAnim From 1d7181c1fc8ff1f39c6e823edd112d5c66bf964d Mon Sep 17 00:00:00 2001 From: Tungdv Date: Thu, 4 Dec 2025 20:06:02 +0700 Subject: [PATCH 2/7] fix: update logic jump move. --- .../PerfectWorld/Scripts/Move/CECHostMove.cs | 1 + Assets/Scripts/CECHostPlayer.cs | 67 ++++++++++--------- 2 files changed, 35 insertions(+), 33 deletions(-) diff --git a/Assets/PerfectWorld/Scripts/Move/CECHostMove.cs b/Assets/PerfectWorld/Scripts/Move/CECHostMove.cs index d52ed0847a..86315851e7 100644 --- a/Assets/PerfectWorld/Scripts/Move/CECHostMove.cs +++ b/Assets/PerfectWorld/Scripts/Move/CECHostMove.cs @@ -346,6 +346,7 @@ namespace BrewMonster { public bool IsStop() { return m_bStop; } // Get host's last position sent to server public Vector3 GetLastSevPos() { return m_vLastSevPos; } + public bool GetSlideLock() { return m_bSlideLock; } } public struct CDR_INFO { diff --git a/Assets/Scripts/CECHostPlayer.cs b/Assets/Scripts/CECHostPlayer.cs index 0ecf4b710b..4d2f2aea67 100644 --- a/Assets/Scripts/CECHostPlayer.cs +++ b/Assets/Scripts/CECHostPlayer.cs @@ -92,6 +92,7 @@ namespace BrewMonster private A3DVECTOR3 g_vOrigin = new A3DVECTOR3(0f); private Transform playerTransform; private float EC_SLOPE_Y = 0.5f; + int m_iOldWalkMode = Move_Mode.MOVE_STAND; // Copy of work mode // ====== Ground cast config ====== [Header("Ground Cast")] @@ -3389,7 +3390,7 @@ namespace BrewMonster // m_GndInfo.fGndHei = pWorld.GetTerrainHeight(vPos, &m_GndInfo.vGndNormal); // Test whether last pos is in air - A3DVECTOR3 vGndPos0, vTestPos0 = m_MoveCtrl.GetLastSevPos() + g_vAxisY * m_aabbServer.Extents.y; + Vector3 vGndPos0 = Vector3.zero, vTestPos0 = m_MoveCtrl.GetLastSevPos() + g_vAxisY * m_aabbServer.Extents.y; VertRayTrace(vTestPos0, vGndPos0, m_GndInfo.vGndNormal); m_GndInfo.fGndHei = vGndPos0.y; @@ -3405,46 +3406,46 @@ namespace BrewMonster A3DVECTOR3 vGndPos, vTestPos = vPos + g_vAxisY * m_aabbServer.Extents.y; VertRayTrace(vTestPos, vGndPos, m_GndInfo.vGndNormal); m_GndInfo.fGndHei = vGndPos.y; - m_GndInfo.fWaterHei = pWorld.GetWaterHeight(vTestPos); + //m_GndInfo.fWaterHei = pWorld.GetWaterHeight(vTestPos); //@note : use the aabb trace. By Kuiwu[12/10/2005] VertAABBTrace(vTestPos, m_aabbServer.Extents, vAABBGnd, m_GndInfo.vGndNormal); vAABBGnd.y -= m_aabbServer.Extents.y; //@note : By Kuiwu[12/10/2005] - int iNewEnv = MOVEENV_GROUND; - if (CheckWaterMoveEnv(vPos, m_GndInfo.fWaterHei, vAABBGnd.y)) - iNewEnv = MOVEENV_WATER; + int iNewEnv = Move_environment.MOVEENV_GROUND; + //if (CheckWaterMoveEnv(vPos, m_GndInfo.fWaterHei, vAABBGnd.y)) + // iNewEnv = Move_environment.MOVEENV_WATER; // ·ÉÌì¹ÒÎÊÌâ - if (iNewEnv == MOVEENV_GROUND && GetPos().y - vAABBGnd.y < 0.2f && bIsInAir && GetPos() != m_MoveCtrl.GetLastSevPos()) - { - m_MoveCtrl.SendMoveCmd(GetPos(), 2, g_vAxisY, m_CDRInfo.vAbsVelocity, m_iMoveMode, true); - // BubbleText(BUBBLE_LEVELUP, 0); - } + //if (iNewEnv == Move_environment.MOVEENV_GROUND && GetPos().y - vAABBGnd.y < 0.2f && bIsInAir && GetPos() != m_MoveCtrl.GetLastSevPos()) + //{ + // m_MoveCtrl.SendMoveCmd(GetPos(), 2, g_vAxisY, m_CDRInfo.vAbsVelocity, m_iMoveMode, true); + // // BubbleText(BUBBLE_LEVELUP, 0); + //} - if (iNewEnv == MOVEENV_GROUND) + if (iNewEnv == Move_environment.MOVEENV_GROUND) { m_GndInfo.bOnGround = true; // if (vPos.y > m_GndInfo.fGndHei + 0.2f) - if (m_CDRInfo.vTPNormal.IsZero()) + if (m_CDRInfo.vTPNormal == Vector3.zero) { - if (m_iMoveMode != MOVE_FREEFALL) - m_iMoveMode = MOVE_FREEFALL; + if (m_iMoveMode != (int)MoveMode.MOVE_FREEFALL) + m_iMoveMode = (int)MoveMode.MOVE_FREEFALL; m_GndInfo.bOnGround = false; if (IsJumping() && m_CDRInfo.vAbsVelocity.y < 0.0f && vPos.y - vAABBGnd.y < 0.6f) { - PlayAction(ACT_JUMP_LAND, false); + PlayAction((int)PLAYER_ACTION_TYPE.ACT_JUMP_LAND, false); } } else { if (IsJumping() && m_CDRInfo.vAbsVelocity.y < 0.0f && vPos.y - vAABBGnd.y < 0.6f) { - PlayAction(ACT_JUMP_LAND, false); + PlayAction((int)PLAYER_ACTION_TYPE.ACT_JUMP_LAND, false); ResetJump(); } @@ -3453,42 +3454,42 @@ namespace BrewMonster { if (!m_MoveCtrl.GetSlideLock()) { - if (m_iMoveMode != MOVE_SLIDE) + if (m_iMoveMode != (int)MoveMode.MOVE_SLIDE) { m_iOldWalkMode = m_iMoveMode; - m_iMoveMode = MOVE_SLIDE; + m_iMoveMode = (int)MoveMode.MOVE_SLIDE; } } else { m_MoveCtrl.SetSlideLock(false); - m_iMoveMode = MOVE_STAND; + m_iMoveMode = (int)MoveMode.MOVE_STAND; } } else { m_MoveCtrl.SetSlideLock(false); - if (m_iMoveMode == MOVE_FREEFALL) + if (m_iMoveMode == (int)MoveMode.MOVE_FREEFALL) { - m_iMoveMode = MOVE_STAND; + m_iMoveMode = (int)MoveMode.MOVE_STAND; } - else if (m_iMoveMode == MOVE_SLIDE) + else if (m_iMoveMode == (int)MoveMode.MOVE_SLIDE) m_iMoveMode = m_iOldWalkMode; } } } - else if (iNewEnv == MOVEENV_WATER) - { - m_CDRInfo.fYVel = 0.0f; + //else if (iNewEnv == MOVEENV_WATER) + //{ + // m_CDRInfo.fYVel = 0.0f; - if (m_iMoveMode == MOVE_SLIDE) - { - if (m_pWorkMan.IsMoving()) - m_iMoveMode = MOVE_MOVE; - else - m_iMoveMode = MOVE_STAND; - } - } + // if (m_iMoveMode == MOVE_SLIDE) + // { + // if (m_pWorkMan.IsMoving()) + // m_iMoveMode = MOVE_MOVE; + // else + // m_iMoveMode = MOVE_STAND; + // } + //} m_iMoveEnv = iNewEnv; } From 593d6374dad02264db0e7214ff61c0019474ceec Mon Sep 17 00:00:00 2001 From: NguyenVanDat Date: Fri, 5 Dec 2025 14:21:47 +0700 Subject: [PATCH 3/7] fix object attack facing to target --- .../2014/剑背狼/tcks_剑背狼/快速移动.anim | 904 +++++++++++++++++- .../Scripts/Managers/EC_Object.cs | 26 +- Assets/PerfectWorld/Scripts/NPC/CECNPC.cs | 2 +- 3 files changed, 910 insertions(+), 22 deletions(-) diff --git a/Assets/ModelRenderer/Art/Animations/models/npcs/怪物/2014/剑背狼/tcks_剑背狼/快速移动.anim b/Assets/ModelRenderer/Art/Animations/models/npcs/怪物/2014/剑背狼/tcks_剑背狼/快速移动.anim index 3b19ee7488..a904e74995 100644 --- a/Assets/ModelRenderer/Art/Animations/models/npcs/怪物/2014/剑背狼/tcks_剑背狼/快速移动.anim +++ b/Assets/ModelRenderer/Art/Animations/models/npcs/怪物/2014/剑背狼/tcks_剑背狼/快速移动.anim @@ -10310,7 +10310,907 @@ AnimationClip: m_Center: {x: 0, y: 0, z: 0} m_Extent: {x: 0, y: 0, z: 0} m_ClipBindingConstant: - genericBindings: [] + genericBindings: + - serializedVersion: 2 + path: 2904062089 + attribute: 1 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 2697794434 + attribute: 1 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 473984651 + attribute: 1 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 623370192 + attribute: 1 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 2562056908 + attribute: 1 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 2941519199 + attribute: 1 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 2904062089 + attribute: 2 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 2671905850 + attribute: 2 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 2320144522 + attribute: 2 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 2697794434 + attribute: 2 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 3205428742 + attribute: 2 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 181291755 + attribute: 2 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 154580831 + attribute: 2 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 1777750735 + attribute: 2 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 429640245 + attribute: 2 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 2817243914 + attribute: 2 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 1777417914 + attribute: 2 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 519441964 + attribute: 2 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 4002323032 + attribute: 2 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 2613341690 + attribute: 2 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 473984651 + attribute: 2 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 4218330170 + attribute: 2 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 973752780 + attribute: 2 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 2596236104 + attribute: 2 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 2425874665 + attribute: 2 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 3885029503 + attribute: 2 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 2123991493 + attribute: 2 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 623370192 + attribute: 2 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 3802533241 + attribute: 2 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 681675820 + attribute: 2 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 888812595 + attribute: 2 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 2278634959 + attribute: 2 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 2562056908 + attribute: 2 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 4181503832 + attribute: 2 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 2561672102 + attribute: 2 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 2317553494 + attribute: 2 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 2270638035 + attribute: 2 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 4031782725 + attribute: 2 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 1767460607 + attribute: 2 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 2941519199 + attribute: 2 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 970861809 + attribute: 2 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 3764974733 + attribute: 2 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 2271171554 + attribute: 2 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 3784749727 + attribute: 2 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 2526118409 + attribute: 2 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 261673907 + attribute: 2 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 2391830708 + attribute: 2 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 2089267986 + attribute: 2 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 1177066612 + attribute: 2 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 2872170345 + attribute: 2 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 4131753032 + attribute: 2 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 582302429 + attribute: 1 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 2127582788 + attribute: 1 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 2671905850 + attribute: 1 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 2320144522 + attribute: 1 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 3205428742 + attribute: 1 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 181291755 + attribute: 1 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 154580831 + attribute: 1 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 1777750735 + attribute: 1 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 429640245 + attribute: 1 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 3505163164 + attribute: 1 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 2817243914 + attribute: 1 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 1777417914 + attribute: 1 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 519441964 + attribute: 1 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 4002323032 + attribute: 1 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 2613341690 + attribute: 1 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 4218330170 + attribute: 1 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 973752780 + attribute: 1 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 2596236104 + attribute: 1 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 2425874665 + attribute: 1 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 3885029503 + attribute: 1 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 2123991493 + attribute: 1 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 3802533241 + attribute: 1 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 681675820 + attribute: 1 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 888812595 + attribute: 1 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 2278634959 + attribute: 1 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 4040557913 + attribute: 1 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 1776243939 + attribute: 1 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 4181503832 + attribute: 1 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 2561672102 + attribute: 1 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 2317553494 + attribute: 1 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 2270638035 + attribute: 1 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 4031782725 + attribute: 1 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 1767460607 + attribute: 1 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 970861809 + attribute: 1 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 3764974733 + attribute: 1 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 2271171554 + attribute: 1 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 3784749727 + attribute: 1 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 2526118409 + attribute: 1 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 261673907 + attribute: 1 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 2391830708 + attribute: 1 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 2089267986 + attribute: 1 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 1177066612 + attribute: 1 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 2872170345 + attribute: 1 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 4131753032 + attribute: 1 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 582302429 + attribute: 2 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 2127582788 + attribute: 2 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 3505163164 + attribute: 2 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 4040557913 + attribute: 2 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 1776243939 + attribute: 2 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 pptrCurveMapping: [] m_AnimationClipSettings: serializedVersion: 2 @@ -10322,7 +11222,7 @@ AnimationClip: m_Level: 0 m_CycleOffset: 0 m_HasAdditiveReferencePose: 0 - m_LoopTime: 0 + m_LoopTime: 1 m_LoopBlend: 0 m_LoopBlendOrientation: 0 m_LoopBlendPositionY: 0 diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_Object.cs b/Assets/PerfectWorld/Scripts/Managers/EC_Object.cs index 3f973d9cdd..9b0eb81ac2 100644 --- a/Assets/PerfectWorld/Scripts/Managers/EC_Object.cs +++ b/Assets/PerfectWorld/Scripts/Managers/EC_Object.cs @@ -17,6 +17,7 @@ public class CECObject : MonoBehaviour protected static int ALPHA_HASH = Shader.PropertyToID("_Alpha"); protected Quaternion targetRotation; + protected Quaternion startRotation; // Store starting rotation for Slerp protected Vector3 g_vAxisY = Vector3.up; // Class ID public static class Class_ID @@ -115,6 +116,7 @@ public class CECObject : MonoBehaviour m_bAdjustOrient = true; m_dwOrientTime = dwTime; m_dwOrientTimeCnt = 0; + startRotation = transform.rotation; // Store current rotation as start targetRotation = Quaternion.LookRotation(vDir, Vector3.up); } @@ -182,13 +184,6 @@ public class CECObject : MonoBehaviour { vDir.Normalize(); } - - // Xoay mượt từ rotation hiện tại sang rotation mục tiêu - /* transform.rotation = Quaternion.Slerp( - transform.rotation, - targetRotation, - Time.deltaTime * 5.0f - );*/ SetDestDirAndUp(vDir, g_vAxisY, timeturn); } protected virtual void Update() @@ -287,25 +282,18 @@ public class CECObject : MonoBehaviour protected void AdjustOrientation(float dwDeltaTime) { m_dwOrientTimeCnt += dwDeltaTime; - - A3DMATRIX4 mat; - // Adjust model's orientation if (m_dwOrientTimeCnt >= m_dwOrientTime) { - SetDirAndUp(Vector3.forward,Vector3.up ); + // Set final rotation to target (not Vector3.forward) + transform.rotation = targetRotation; m_bAdjustOrient = false; } else { - float f = (float)m_dwOrientTimeCnt / m_dwOrientTime; - transform.rotation = Quaternion.Slerp( - transform.rotation, - targetRotation, - f - ); - SetDirAndUp(Vector3.forward, Vector3.up); - // Note: SetDirAndUp will change m_bAdjustOrient flag + // Interpolate from START to TARGET rotation based on time progress + float f = m_dwOrientTimeCnt / m_dwOrientTime; + transform.rotation = Quaternion.Slerp(startRotation, targetRotation, f); m_bAdjustOrient = true; } } diff --git a/Assets/PerfectWorld/Scripts/NPC/CECNPC.cs b/Assets/PerfectWorld/Scripts/NPC/CECNPC.cs index 14ef9b13c6..1e80a5382c 100644 --- a/Assets/PerfectWorld/Scripts/NPC/CECNPC.cs +++ b/Assets/PerfectWorld/Scripts/NPC/CECNPC.cs @@ -392,7 +392,7 @@ public class CECNPC : CECObject { return m_pNPCModelPolicy.PlayAttackAction(nAttackSpeed, attackevent); } - void NPCTurnFaceTo(int idTarget, float dwTime = 0) + void NPCTurnFaceTo(int idTarget, float dwTime = 0.3f) { if (IsDirFixed()) { From f330d9606ccb4490261acb30d1b44aaebb7c2308 Mon Sep 17 00:00:00 2001 From: Tungdv Date: Fri, 5 Dec 2025 21:09:16 +0700 Subject: [PATCH 4/7] fix: update logic jump move for HP. --- .../Scripts/Managers/EC_HPWorkMove.cs | 24 ++++ .../Scripts/Managers/EC_ManPlayer.cs | 87 ++++++++++-- .../PerfectWorld/Scripts/Move/CECHostMove.cs | 3 + Assets/PerfectWorld/Scripts/Move/CECPlayer.cs | 36 ++++- .../Scripts/Network/CSNetwork/EC_MsgDef.cs | 2 +- .../Scripts/Network/CSNetwork/GPDataType.cs | 30 ++++ .../Scripts/Network/CSNetwork/GameSession.cs | 6 + Assets/Scripts/CECHostPlayer.cs | 131 +++++++++++++++--- 8 files changed, 285 insertions(+), 34 deletions(-) diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_HPWorkMove.cs b/Assets/PerfectWorld/Scripts/Managers/EC_HPWorkMove.cs index fd625e89c8..5f7595ec88 100644 --- a/Assets/PerfectWorld/Scripts/Managers/EC_HPWorkMove.cs +++ b/Assets/PerfectWorld/Scripts/Managers/EC_HPWorkMove.cs @@ -753,6 +753,30 @@ namespace BrewMonster.Scripts // Tick routine of flying or swimming protected bool Tick_FlySwim(float fDeltaTime) { + A3DVECTOR3 vCurPos = m_pHost.GetPos(); + int iMoveMode = (m_pHost.m_iMoveEnv == (int)MoveEnvironment.MOVEENV_AIR) ? (int)GPMoveMode.GP_MOVE_AIR : (int)GPMoveMode.GP_MOVE_WATER; + + float na, fMaxSpeed; + bool bInAir; + if (m_pHost.m_iMoveEnv == (int)MoveEnvironment.MOVEENV_AIR) + { + bInAir = true; + na = CECHostMove.EC_NACCE_AIR; + fMaxSpeed = m_pHost.GetFlySpeed(); + } + else + { + bInAir = false; + na = CECHostMove.EC_NACCE_WATER; + fMaxSpeed = m_pHost.GetSwimSpeedSev(); + } + + if (m_bReadyCancel || m_bMeetSlide) + { + m_pHost.m_MoveCtrl.SendStopMoveCmd(EC_Utility.ToVector3(vCurPos), fMaxSpeed, iMoveMode | (int)GPMoveMode.GP_MOVE_RUN); + Finish(); + return true; + } return true; } // Start gliding diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_ManPlayer.cs b/Assets/PerfectWorld/Scripts/Managers/EC_ManPlayer.cs index 3adea52fca..366d8c571f 100644 --- a/Assets/PerfectWorld/Scripts/Managers/EC_ManPlayer.cs +++ b/Assets/PerfectWorld/Scripts/Managers/EC_ManPlayer.cs @@ -1,6 +1,7 @@ using BrewMonster; using BrewMonster.Managers; using BrewMonster.Network; +using BrewMonster.Scripts; using CSNetwork; using CSNetwork.GPDataType; using CSNetwork.Protocols; @@ -9,6 +10,7 @@ using PerfectWorld.Scripts.Player; using System; using System.Collections; using System.Collections.Generic; +using System.Reflection; using System.Runtime.InteropServices; using TMPro; using UnityEngine; @@ -74,6 +76,9 @@ namespace PerfectWorld.Scripts.Managers case EC_MsgDef.MSG_PM_PICKUPMATTER: OnMsgPlayerPickupMatter(Msg); break; + case EC_MsgDef.MSG_PM_PLAYEREXTPROP: + OnMsgPlayerExtProp(Msg); + break; } } else @@ -188,15 +193,15 @@ namespace PerfectWorld.Scripts.Managers // TODO: Implement get faction /*/ // Get faction info - if (pPlayer->GetFactionID() && !g_pGame->GetFactionMan()->GetFaction(pPlayer->GetFactionID())) + if (pPlayer.GetFactionID() && !g_pGame.GetFactionMan().GetFaction(pPlayer.GetFactionID())) { int i(0); for (i = 0; i < a4.GetSize(); i++) - if (a4[i] == pPlayer->GetFactionID()) + if (a4[i] == pPlayer.GetFactionID()) break; if (i == a4.GetSize()) - a4.Add(pPlayer->GetFactionID()); + a4.Add(pPlayer.GetFactionID()); } //*/ } @@ -609,11 +614,11 @@ namespace PerfectWorld.Scripts.Managers switch (Convert.ToInt32(Msg.dwParam2)) { case int value2 when value2 == CommandID.OBJECT_CAST_SKILL: cid = (GPDataTypeHelper.FromBytes((byte[]) Msg.dwParam1)).caster; break; - /* case CommandID.OBJECT_CAST_INSTANT_SKILL: cid = ((cmd_object_cast_instant_skill*)Msg.dwParam1)->caster; break; - case CommandID.OBJECT_CAST_POS_SKILL: cid = ((cmd_object_cast_pos_skill*)Msg.dwParam1)->caster; break; - case CommandID.SKILL_INTERRUPTED: cid = ((cmd_skill_interrupted*)Msg.dwParam1)->caster; break; - case CommandID.PLAYER_CAST_RUNE_SKILL: cid = ((cmd_player_cast_rune_skill*)Msg.dwParam1)->caster; break; - case CommandID.PLAYER_CAST_RUNE_INSTANT_SKILL: cid = ((cmd_player_cast_rune_instant_skill*)Msg.dwParam1)->caster; break;*/ + /* case CommandID.OBJECT_CAST_INSTANT_SKILL: cid = ((cmd_object_cast_instant_skill*)Msg.dwParam1).caster; break; + case CommandID.OBJECT_CAST_POS_SKILL: cid = ((cmd_object_cast_pos_skill*)Msg.dwParam1).caster; break; + case CommandID.SKILL_INTERRUPTED: cid = ((cmd_skill_interrupted*)Msg.dwParam1).caster; break; + case CommandID.PLAYER_CAST_RUNE_SKILL: cid = ((cmd_player_cast_rune_skill*)Msg.dwParam1).caster; break; + case CommandID.PLAYER_CAST_RUNE_INSTANT_SKILL: cid = ((cmd_player_cast_rune_instant_skill*)Msg.dwParam1).caster; break;*/ } break; @@ -659,6 +664,72 @@ namespace PerfectWorld.Scripts.Managers { return CECGameRun.Instance.GetHostPlayer(); } + + public bool OnMsgPlayerExtProp(ECMSG Msg) + { + object pData; + int idPlayer, iIndex; + + switch (Msg.dwParam2) + { + case CommandID.PLAYER_EXT_PROP_BASE: + { + cmd_pep_base pCmd = GPDataTypeHelper.FromBytes((byte[])Msg.dwParam1); + idPlayer = pCmd.idPlayer; + pData = pCmd.ep_base; + iIndex = (int)ExtendPropertyClass.EXTPROPIDX_BASE; + break; + } + case CommandID.PLAYER_EXT_PROP_MOVE: + { + cmd_pep_move pCmd = GPDataTypeHelper.FromBytes((byte[])Msg.dwParam1); + idPlayer = pCmd.idPlayer; + pData = pCmd.ep_move; + iIndex = (int)ExtendPropertyClass.EXTPROPIDX_MOVE; + break; + } + case CommandID.PLAYER_EXT_PROP_ATK: + { + cmd_pep_attack pCmd = GPDataTypeHelper.FromBytes((byte[])Msg.dwParam1); + idPlayer = pCmd.idPlayer; + pData = pCmd.ep_attack; + iIndex = (int)ExtendPropertyClass.EXTPROPIDX_ATTACK; + break; + } + + case CommandID.PLAYER_EXT_PROP_DEF: + { + cmd_pep_def pCmd = GPDataTypeHelper.FromBytes((byte[])Msg.dwParam1); + idPlayer = pCmd.idPlayer; + pData = pCmd.ep_def; + iIndex = (int)ExtendPropertyClass.EXTPROPIDX_DEF; + break; + } + default: + return false; + } + + if (!GPDataTypeHelper.ISPLAYERID(idPlayer)) + { + //ASSERT(ISPLAYERID(idPlayer)); + return false; + } + + //CECGameSession* pSession = g_pGame.GetGameSession(); + + if (idPlayer == m_pHostPlayer.GetCharacterID()) + { + GetHostPlayer().SetPartExtendProps(iIndex, pData); + } + else + { + EC_ElsePlayer pPlayer = SeekOutElsePlayer(idPlayer); + if (pPlayer) + pPlayer.SetPartExtendProps(iIndex, pData); + } + + return true; + } } } public struct EC_PLAYERLOADRESULT diff --git a/Assets/PerfectWorld/Scripts/Move/CECHostMove.cs b/Assets/PerfectWorld/Scripts/Move/CECHostMove.cs index 86315851e7..eb0efb3c0b 100644 --- a/Assets/PerfectWorld/Scripts/Move/CECHostMove.cs +++ b/Assets/PerfectWorld/Scripts/Move/CECHostMove.cs @@ -33,6 +33,9 @@ namespace BrewMonster { float m_fBlockMove; // Block move counter A3DVECTOR3 m_vBlockMove; bool m_bLocalMove; // true, Moving info isn't sent to server + // Negative accelerate in water and air + public const float EC_NACCE_AIR = -5.0f; + public const float EC_NACCE_WATER = -5.0f; public CECHostMove(CECHostPlayer pHost) { diff --git a/Assets/PerfectWorld/Scripts/Move/CECPlayer.cs b/Assets/PerfectWorld/Scripts/Move/CECPlayer.cs index 164b0481b4..bc76c80d2b 100644 --- a/Assets/PerfectWorld/Scripts/Move/CECPlayer.cs +++ b/Assets/PerfectWorld/Scripts/Move/CECPlayer.cs @@ -19,8 +19,6 @@ using Unity.VisualScripting; using UnityEngine; using UnityEngine.SceneManagement; using BrewMonster.Network; -using UnityEngine.UIElements; -using static CECPlayer; public abstract partial class CECPlayer : CECObject { @@ -1444,7 +1442,7 @@ public abstract partial class CECPlayer : CECObject public float GetGroundSpeed() { // return m_bWalkRun ? g_pGame.GetConfigs().GetHostRunSpeed() : m_ExtProps.mv.walk_speed; - return 5f; + //return 5f; return m_bWalkRun ? m_ExtProps.mv.run_speed : m_ExtProps.mv.walk_speed; } @@ -1563,6 +1561,38 @@ public abstract partial class CECPlayer : CECObject } public enumWingType GetWingType() { return m_wingType; } + + + // Set part extend properties + public void SetPartExtendProps(int iPropIdx, object pData) + { + switch (iPropIdx) + { + case (int)ExtendPropertyClass.EXTPROPIDX_BASE: + + m_ExtProps.bs = (ROLEEXTPROP_BASE)pData; + break; + + case (int)ExtendPropertyClass.EXTPROPIDX_MOVE: + + m_ExtProps.mv = (ROLEEXTPROP_MOVE)pData; + break; + + case (int)ExtendPropertyClass.EXTPROPIDX_ATTACK: + + m_ExtProps.ak = (ROLEEXTPROP_ATK)pData; + break; + + case (int)ExtendPropertyClass.EXTPROPIDX_DEF: + + m_ExtProps.df = (ROLEEXTPROP_DEF)pData; + break; + + default: + //ASSERT(0); + return; + } + } } public struct PlayActionEvent diff --git a/Assets/PerfectWorld/Scripts/Network/CSNetwork/EC_MsgDef.cs b/Assets/PerfectWorld/Scripts/Network/CSNetwork/EC_MsgDef.cs index 50d7714863..d41f0d3bf0 100644 --- a/Assets/PerfectWorld/Scripts/Network/CSNetwork/EC_MsgDef.cs +++ b/Assets/PerfectWorld/Scripts/Network/CSNetwork/EC_MsgDef.cs @@ -174,7 +174,7 @@ namespace CSNetwork public static int MSG_PM_PLAYERDISAPPEAR = 359; // Player disappear, p1 - data address public static int MSG_PM_PLAYERSTOPMOVE = 360; // Player stop move, p1 - data address public static int MSG_PM_PLAYERLEVELUP = 361; // Player level up - public static int MSG_PM_PLAYEREXTPROP = 362; // Player extend properties + public const int MSG_PM_PLAYEREXTPROP = 362; // Player extend properties // #define MSG_PM_TEAMMEMBERDATA 363 // Team member data public static int MSG_PM_LEAVETEAM = 364; // Player leave team public static int MSG_PM_PLAYEREQUIPDATA = 365; // Player equipment data diff --git a/Assets/PerfectWorld/Scripts/Network/CSNetwork/GPDataType.cs b/Assets/PerfectWorld/Scripts/Network/CSNetwork/GPDataType.cs index 1029be7765..2bbba013aa 100644 --- a/Assets/PerfectWorld/Scripts/Network/CSNetwork/GPDataType.cs +++ b/Assets/PerfectWorld/Scripts/Network/CSNetwork/GPDataType.cs @@ -1752,6 +1752,36 @@ namespace CSNetwork.GPDataType public byte[] placeholder; // Task data ... } + // PLAYER_EXT_PROP_BASE + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct cmd_pep_base + { + public int idPlayer; + public ROLEEXTPROP_BASE ep_base; + }; + // PLAYER_EXT_PROP_MOVE + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct cmd_pep_move + { + public int idPlayer; + public ROLEEXTPROP_MOVE ep_move; + }; + + // PLAYER_EXT_PROP_ATK + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct cmd_pep_attack + { + public int idPlayer; + public ROLEEXTPROP_ATK ep_attack; + }; + + // PLAYER_EXT_PROP_DEF + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct cmd_pep_def + { + public int idPlayer; + public ROLEEXTPROP_DEF ep_def; + }; } diff --git a/Assets/PerfectWorld/Scripts/Network/CSNetwork/GameSession.cs b/Assets/PerfectWorld/Scripts/Network/CSNetwork/GameSession.cs index 240b440830..14d080ba26 100644 --- a/Assets/PerfectWorld/Scripts/Network/CSNetwork/GameSession.cs +++ b/Assets/PerfectWorld/Scripts/Network/CSNetwork/GameSession.cs @@ -716,6 +716,12 @@ namespace CSNetwork case CommandID.CHANGE_FACE_END: EC_ManMessage.PostMessage(EC_MsgDef.MSG_HST_CHANGEFACE, MANAGER_INDEX.MAN_PLAYER, 0, pDataBuf, pCmdHeader, dwDataSize); break; + case CommandID.PLAYER_EXT_PROP_BASE: + case CommandID.PLAYER_EXT_PROP_MOVE: + case CommandID.PLAYER_EXT_PROP_ATK: + case CommandID.PLAYER_EXT_PROP_DEF: + EC_ManMessage.PostMessage(EC_MsgDef.MSG_PM_PLAYEREXTPROP, MANAGER_INDEX.MAN_PLAYER, -1, pDataBuf, pCmdHeader); + break; } } diff --git a/Assets/Scripts/CECHostPlayer.cs b/Assets/Scripts/CECHostPlayer.cs index 4d2f2aea67..a7781f99fb 100644 --- a/Assets/Scripts/CECHostPlayer.cs +++ b/Assets/Scripts/CECHostPlayer.cs @@ -1815,6 +1815,44 @@ namespace BrewMonster { return m_ExtProps.mv.swim_speed; } + + public float GetSwimSpeedSev() + { + float fSpeedSev = GetSwimSpeed(); + LayerMask layerGround = 1 << 6; + LayerMask layerWater = 1 << 8; + while (true) + { + if (!IsUnderWater()) break; + CECWorld pWorld = EC_Game.GetGameRun().GetWorld(); + if (pWorld == null) break; + + A3DVECTOR3 vPos = GetPos(); + Vector3 startPoint = EC_Utility.ToVector3(vPos); + Vector3 dir = EC_Utility.ToVector3(vPos) + Vector3.down; + float fTerrainHeight = 0f; + if (Physics.Raycast(startPoint, dir, out hit, layerGround)) + { + fTerrainHeight = Vector3.Distance(hit.point, startPoint); + } + float fWaterHeight = 0f; + if (Physics.Raycast(startPoint, dir, out hit, layerWater)) + { + fWaterHeight = Vector3.Distance(hit.point, startPoint); + } + if (fWaterHeight <= fTerrainHeight) break; + float fBorderLine = fWaterHeight - 2.0f; + if (vPos.y <= fBorderLine) break; + + // ·þÎñÆ÷¶Ë½«Ë®ÃæÒÔÏÂ2Ã×ÒÔÉÏ´¦ÀíΪ run_speed£¨ÓÐÎÊÌ⣩ + // µ«Î´Ê¹ÓüÓËÙ¼¼ÄÜʱ swim_speed СÓÚ run_speed£¬ + // ¿ÉÒÔÔÚË®ÃæÒÔÏÂ2Ã×ÒÔÉÏ»ñÈ¡³¬¹ý swim_speed µÄËÙ¶È£¬Òò´Ë£¬´Ë´¦È¡Á½Õß½ÏСֵΪºÏÀí×ö·¨ + fSpeedSev = Math.Min(m_ExtProps.mv.run_speed, fSpeedSev); + break; + } + return fSpeedSev; + } + public bool ApplySkillShortcut(int idSkill, bool bCombo = false /* false */, int idSelTarget = 0/* 0 */, int iForceAtk = -1/* -1 */) { @@ -3387,43 +3425,38 @@ namespace BrewMonster } CECWorld pWorld = EC_Game.GetGameRun().GetWorld(); - // m_GndInfo.fGndHei = pWorld.GetTerrainHeight(vPos, &m_GndInfo.vGndNormal); - - // Test whether last pos is in air - Vector3 vGndPos0 = Vector3.zero, vTestPos0 = m_MoveCtrl.GetLastSevPos() + g_vAxisY * m_aabbServer.Extents.y; - VertRayTrace(vTestPos0, vGndPos0, m_GndInfo.vGndNormal); - + LayerMask layerMaskTerrain = 1 << 6; + LayerMask layerMaskBush = 1 << 7; + Vector3 vStart = EC_Utility.ToVector3(vPos); + Vector3 vGndPos0 = Vector3.zero; + Vector3 vTestPos0 = m_MoveCtrl.GetLastSevPos() + g_vAxisY * m_aabbServer.Extents.y; + VertRayTrace(vTestPos0, ref vGndPos0, ref m_GndInfo.vGndNormal, 1000f); m_GndInfo.fGndHei = vGndPos0.y; - A3DVECTOR3 vAABBGnd; - VertAABBTrace(vTestPos0, m_aabbServer.Extents, vAABBGnd, m_GndInfo.vGndNormal); + Vector3 vAABBGnd = Vector3.zero; + VertAABBTrace(vTestPos0, EC_Utility.ToVector3(m_aabbServer.Extents), ref vAABBGnd, ref m_GndInfo.vGndNormal, 1000f); vAABBGnd.y -= m_aabbServer.Extents.y; bool bIsInAir = false; if (m_MoveCtrl.GetLastSevPos().y - vAABBGnd.y > 0.2f) bIsInAir = true; - A3DVECTOR3 vGndPos, vTestPos = vPos + g_vAxisY * m_aabbServer.Extents.y; - VertRayTrace(vTestPos, vGndPos, m_GndInfo.vGndNormal); + Vector3 vGndPos = Vector3.zero; + A3DVECTOR3 vTestPos = vPos + EC_Utility.ToA3DVECTOR3(g_vAxisY) * m_aabbServer.Extents.y; + VertRayTrace(EC_Utility.ToVector3(vTestPos), ref vGndPos, ref m_GndInfo.vGndNormal, 1000f); m_GndInfo.fGndHei = vGndPos.y; //m_GndInfo.fWaterHei = pWorld.GetWaterHeight(vTestPos); - //@note : use the aabb trace. By Kuiwu[12/10/2005] - VertAABBTrace(vTestPos, m_aabbServer.Extents, vAABBGnd, m_GndInfo.vGndNormal); + VertAABBTrace(EC_Utility.ToVector3(vTestPos), EC_Utility.ToVector3(m_aabbServer.Extents), ref vAABBGnd, ref m_GndInfo.vGndNormal, 1000f); vAABBGnd.y -= m_aabbServer.Extents.y; - //@note : By Kuiwu[12/10/2005] int iNewEnv = Move_environment.MOVEENV_GROUND; - //if (CheckWaterMoveEnv(vPos, m_GndInfo.fWaterHei, vAABBGnd.y)) - // iNewEnv = Move_environment.MOVEENV_WATER; - // ·ÉÌì¹ÒÎÊÌâ - - //if (iNewEnv == Move_environment.MOVEENV_GROUND && GetPos().y - vAABBGnd.y < 0.2f && bIsInAir && GetPos() != m_MoveCtrl.GetLastSevPos()) - //{ - // m_MoveCtrl.SendMoveCmd(GetPos(), 2, g_vAxisY, m_CDRInfo.vAbsVelocity, m_iMoveMode, true); - // // BubbleText(BUBBLE_LEVELUP, 0); - //} + if (iNewEnv == Move_environment.MOVEENV_GROUND && GetPos().y - vAABBGnd.y < 0.2f && bIsInAir && EC_Utility.ToVector3(GetPos()) != m_MoveCtrl.GetLastSevPos()) + { + m_MoveCtrl.SendMoveCmd(GetPos(), 2, EC_Utility.ToA3DVECTOR3(g_vAxisY), EC_Utility.ToA3DVECTOR3(m_CDRInfo.vAbsVelocity), m_iMoveMode, true); + // BubbleText(BUBBLE_LEVELUP, 0); + } if (iNewEnv == Move_environment.MOVEENV_GROUND) { @@ -3493,6 +3526,60 @@ namespace BrewMonster m_iMoveEnv = iNewEnv; } + + // ÏòÏ Trace µØÐκͽ¨Öþ£¬²¢·µ»ØµÚÒ»¸öÅöײµãµÄÇé¿ö + bool VertRayTrace(Vector3 vPos, ref Vector3 vHitPos, ref A3DVECTOR3 vHitNormal, float DeltaY) + { + + Vector3 vTerrainPos = Vector3.zero; + Vector3 vTerrainNormal = Vector3.zero; + Vector3 vBuildingPos = Vector3.zero; + Vector3 vBuildingNormal = Vector3.zero; + + LayerMask layerMaskTerrain = 1 << 6; + LayerMask layerMaskBush = 1 << 7; + if (Physics.Raycast(vPos, (vPos + Vector3.down), out hit, layerMaskTerrain)) + { + vTerrainPos = hit.point; + vTerrainNormal = hit.normal; + } + if (Physics.Raycast(vPos, (vPos + Vector3.down), out hit, DeltaY, layerMaskTerrain)) + { + if (vBuildingPos.y > vTerrainPos.y) + { + // Ó뽨Öþ·¢ÉúÁËÅöײ + vHitPos = vBuildingPos; + vHitNormal = EC_Utility.ToA3DVECTOR3(vBuildingNormal); + return true; + } + } + if (vTerrainPos.y > vPos.y || (vTerrainPos.y <= vPos.y && vTerrainPos.y >= vPos.y - DeltaY)) + { + vHitPos = vTerrainPos; + vHitNormal = EC_Utility.ToA3DVECTOR3(vTerrainNormal); + return true; + } + return false; + } + + void VertAABBTrace(Vector3 vCenter, Vector3 vExt, ref Vector3 vHitPos, ref A3DVECTOR3 vHitNormal, float DeltaY/* =100.0f */) + { + vHitPos = vCenter; + vHitPos.y -= DeltaY; + + LayerMask layerMask = 1 << 6 | 1 << 7; + if(!Physics.BoxCast(vCenter, vExt, (vCenter + Vector3.down).normalized, + out hit, transform.rotation, DeltaY, layerMask)) + { + vHitPos = vCenter; + vHitNormal = EC_Utility.ToA3DVECTOR3(Vector3.up); + } + else + { + vHitPos = hit.point; + vHitNormal = EC_Utility.ToA3DVECTOR3(hit.normal); + } + } } public enum StateAnim From 956fde82b47a5775314f45f5a4182ece45ceb907 Mon Sep 17 00:00:00 2001 From: Tungdv Date: Fri, 5 Dec 2025 21:59:35 +0700 Subject: [PATCH 5/7] feat: set ext prop for HP. --- Assets/PerfectWorld/Scripts/Network/CSNetwork/GameSession.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Assets/PerfectWorld/Scripts/Network/CSNetwork/GameSession.cs b/Assets/PerfectWorld/Scripts/Network/CSNetwork/GameSession.cs index 14d080ba26..149a5584e3 100644 --- a/Assets/PerfectWorld/Scripts/Network/CSNetwork/GameSession.cs +++ b/Assets/PerfectWorld/Scripts/Network/CSNetwork/GameSession.cs @@ -722,6 +722,9 @@ namespace CSNetwork case CommandID.PLAYER_EXT_PROP_DEF: EC_ManMessage.PostMessage(EC_MsgDef.MSG_PM_PLAYEREXTPROP, MANAGER_INDEX.MAN_PLAYER, -1, pDataBuf, pCmdHeader); break; + case CommandID.OWN_EXT_PROP: + EC_ManMessage.PostMessage(EC_MsgDef.MSG_HST_OWNEXTPROP, MANAGER_INDEX.MAN_PLAYER, 0, pDataBuf, pCmdHeader); + break; } } From c7c34b373c78deec774d7b48a1b9b488b5c4323b Mon Sep 17 00:00:00 2001 From: Tungdv Date: Sat, 6 Dec 2025 14:14:55 +0700 Subject: [PATCH 6/7] fix: update data info for HP. fix: update move fly and swim. --- .../Scripts/GameData/EC_RoleType.cs | 14 ++- .../Scripts/Managers/EC_HPWorkMove.cs | 93 +++++++++++++++++- .../PerfectWorld/Scripts/Move/CECHostMove.cs | 97 ++++++++++++++++--- Assets/PerfectWorld/Scripts/Move/EC_CDR.cs | 58 +++++++++++ .../Scripts/Network/CSNetwork/EC_MsgDef.cs | 2 +- .../Scripts/Network/CSNetwork/GPDataType.cs | 16 +++ Assets/Scripts/CECHostPlayer.cs | 33 ++++++- 7 files changed, 293 insertions(+), 20 deletions(-) diff --git a/Assets/PerfectWorld/Scripts/GameData/EC_RoleType.cs b/Assets/PerfectWorld/Scripts/GameData/EC_RoleType.cs index d8e7ee6313..6c68d43354 100644 --- a/Assets/PerfectWorld/Scripts/GameData/EC_RoleType.cs +++ b/Assets/PerfectWorld/Scripts/GameData/EC_RoleType.cs @@ -1,4 +1,5 @@ -using UnityEngine; +using System.Runtime.InteropServices; +using UnityEngine; public static class GameConstants { @@ -46,6 +47,8 @@ public struct ROLEBASICPROP iVigour = 0; } }; + +[StructLayout(LayoutKind.Sequential, Pack = 1)] public struct ROLEEXTPROP { public ROLEEXTPROP_BASE bs; @@ -63,6 +66,8 @@ public struct ROLEEXTPROP max_ap = 0; } }; + +[StructLayout(LayoutKind.Sequential, Pack = 1)] public struct ROLEEXTPROP_BASE { /* »ù´¡ÊôÐÔ */ @@ -100,6 +105,8 @@ public struct ROLEEXTPROP_BASE this.mp_gen = mp_gen; } }; + +[StructLayout(LayoutKind.Sequential, Pack = 1)] public struct ROLEEXTPROP_MOVE { /* Ô˶¯ËÙ¶È*/ @@ -125,6 +132,8 @@ public struct ROLEEXTPROP_MOVE this.flight_speed = flight_speed; } }; + +[StructLayout(LayoutKind.Sequential, Pack = 1)] public struct ROLEEXTPROP_ATK { // 物理攻击属性 / Attack properties @@ -135,6 +144,7 @@ public struct ROLEEXTPROP_ATK public float AttackRange; // 攻击范围 // 附加魔法伤害倍数(或附加魔法伤害范围)数组 + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)] public AddonDamageEntry[] AddonDamage; // 魔法攻击伤害 @@ -172,10 +182,12 @@ public struct ROLEEXTPROP_ATK } } +[StructLayout(LayoutKind.Sequential, Pack = 1)] // Role (Player and NPC) extended properties, defense part public struct ROLEEXTPROP_DEF { /* ·ÀÓùÊôÐÔ */ + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)] public int[] resistance; // ħ·¨¿¹ÐÔ public int defense; // ·ÀÓùÁ¦ public int armor; // ÉÁ¶ãÂÊ£¨×°¼×µÈ¼¶£© diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_HPWorkMove.cs b/Assets/PerfectWorld/Scripts/Managers/EC_HPWorkMove.cs index 5f7595ec88..11fdba3951 100644 --- a/Assets/PerfectWorld/Scripts/Managers/EC_HPWorkMove.cs +++ b/Assets/PerfectWorld/Scripts/Managers/EC_HPWorkMove.cs @@ -1,7 +1,6 @@ -using BrewMonster.Network; using CSNetwork.GPDataType; +using System; using UnityEngine; -using static CECPlayer; using Types = BrewMonster.Scripts.CECHPWorkMove.DestTypes; namespace BrewMonster.Scripts @@ -777,6 +776,96 @@ namespace BrewMonster.Scripts Finish(); return true; } + + // for auto move + if (m_bUseAutoMoveDialog && m_fAutoHeight > 0.0f && m_iDestType != DestTypes.DEST_PUSH) + { + if (m_pHost.m_dwMoveRelDir == 0) + { + if ((int)(vCurPos.y / 10.0f) == (int)m_fAutoHeight) + { + if (!m_bReachedHeight) + { + m_pHost.m_vVelocity.y = 0.0f; + m_pHost.m_dwMoveRelDir &= ~((uint)(MOVE_DIR.MD_ABSUP | MOVE_DIR.MD_ABSDOWN)); + m_bReachedHeight = true; + } + } + else + { + if (!m_bReachedHeight) + { + if (vCurPos.y < m_fAutoHeight * 10.0f) + { + m_pHost.m_dwMoveRelDir &= ~((uint)(MOVE_DIR.MD_ABSDOWN)); + m_pHost.m_dwMoveRelDir |= ((uint)MOVE_DIR.MD_ABSUP); + } + else if (vCurPos.y > m_fAutoHeight * 10.0f) + { + m_pHost.m_dwMoveRelDir &= ~((uint)(MOVE_DIR.MD_ABSUP)); + m_pHost.m_dwMoveRelDir |= (uint)MOVE_DIR.MD_ABSDOWN; + } + } + else // Auto adjust height, so we should refresh move height + { + m_fAutoHeight = vCurPos.y / 10.0f; + } + } + } + else // Player manually set auto move height + { + m_bReachedHeight = true; + + m_fAutoHeight = vCurPos.y / 10.0f; + } + } + + if ((m_pHost.m_dwMoveRelDir & (uint)(MOVE_DIR.MD_LEFT | MOVE_DIR.MD_RIGHT | MOVE_DIR.MD_FORWARD | MOVE_DIR.MD_BACK)) != 0) + m_iDestType = DestTypes.DEST_PUSH; + + ON_AIR_CDR_INFO cdr = m_pHost.m_AirCDRInfo; + + if (m_iDestType == DestTypes.DEST_DIR) + { + Vector3 vPushDir = Vector3.zero; + m_pHost.GetPushDir(ref vPushDir, (uint)MOVE_DIR.MD_ALL, 0); + vPushDir.x = vPushDir.z = 0.0f; + + float fSpeed1H = m_pHost.m_vVelocity.MagnitudeH(); + float fSpeed1V = m_pHost.m_vVelocity.y; + + A3DVECTOR3 vMoveDirH = m_vMoveDest; + float pa = CECHostMove.EC_PUSH_ACCE; + + float fSpeed2H = fSpeed1H + (pa + na) * fDeltaTime; + if (Math.Abs(pa - 0) < float.Epsilon && fSpeed2H < 0.0f) + fSpeed2H = 0.0f; // Only resistance couldn't generate negative speed + else if (fSpeed2H > fMaxSpeed) + fSpeed2H = fMaxSpeed; + + Glide(5.0f, vMoveDirH, fDeltaTime, bInAir); + + vMoveDirH = m_pHost.GetModelMoveDir(); + vMoveDirH.y = 0; + vMoveDirH.Normalize(); + + // Vertical speed + float fSpeed2V = CalcFlySwimVertSpeed(fSpeed1V, vPushDir.y, CECHostMove.EC_PUSH_ACCE, fDeltaTime); + A3DVECTOR3 vVel2 = vMoveDirH * fSpeed2H + GPDataTypeHelper.g_vAxisY * fSpeed2V; + + // Air/water move + vCurPos = m_pHost.m_MoveCtrl.AirWaterMove(vVel2, fDeltaTime, bInAir); + m_pHost.SetPos(EC_Utility.ToVector3(vCurPos)); + m_pHost.m_vVelocity = vVel2; + + if (m_pHost.m_MoveCtrl.MoveBlocked() >= 3) + { + Finish(); + m_pHost.m_MoveCtrl.SendStopMoveCmd(EC_Utility.ToVector3(vCurPos), fMaxSpeed, iMoveMode | (int)GPMoveMode.GP_MOVE_RUN); + } + else + m_pHost.m_MoveCtrl.SendMoveCmd(vCurPos, 0, m_vMoveDest, vVel2, iMoveMode | (int)GPMoveMode.GP_MOVE_RUN); + } return true; } // Start gliding diff --git a/Assets/PerfectWorld/Scripts/Move/CECHostMove.cs b/Assets/PerfectWorld/Scripts/Move/CECHostMove.cs index eb0efb3c0b..c9b85c246e 100644 --- a/Assets/PerfectWorld/Scripts/Move/CECHostMove.cs +++ b/Assets/PerfectWorld/Scripts/Move/CECHostMove.cs @@ -1,15 +1,7 @@ using BrewMonster.Network; using BrewMonster.Scripts; -using CSNetwork; -using CSNetwork.C2SCommand; using CSNetwork.GPDataType; -using CSNetwork.Protocols; using System; -using System.Collections.Generic; -using System.Runtime.ConstrainedExecution; -using System.Security.Cryptography; -using System.Text; -using BrewMonster; using UnityEngine; namespace BrewMonster { @@ -36,6 +28,18 @@ namespace BrewMonster { // Negative accelerate in water and air public const float EC_NACCE_AIR = -5.0f; public const float EC_NACCE_WATER = -5.0f; + // Push accelerate + public const float EC_PUSH_ACCE = 8.0f; // Normal push accelerate in air and water + public const float EC_FLYOFF_ACCE = 10.0f; // Fly off accelerate + + public const float EC_SLOPE_Y = 0.5f; + public const float EC_GRAVITY = 9.8f; + + // Move length minimum threshold + public const float MIN_MOVELEN_IN_AIR_WATER = 0.5f; + public const float MIN_MOVELEN_ON_GROUND = 0.5f; + public const float MIN_MOVELEN_FOR_DETECT_VIBRATION = 0.05f; + public CECHostMove(CECHostPlayer pHost) { @@ -115,7 +119,7 @@ namespace BrewMonster { public void SendStopMoveCmd(in Vector3 vPos, float fSpeed, int iMoveMode) { - Debug.LogWarning("HoangDev : SendStopMoveCmd"); + UnityEngine.Debug.LogWarning("HoangDev : SendStopMoveCmd"); iMoveMode |= (int)GPMoveMode.GP_MOVE_DEAD; if (cmdstopdelayCounter >= 500) @@ -220,7 +224,7 @@ namespace BrewMonster { if (fTime < 0.05f || fSpeed > 50.0f) { // tương đương ASSERT(0) trong C++, ở đây có thể Debug.LogWarning - Debug.LogWarning("CalcAverageSpeed: invalid input, fallback to default speed."); + UnityEngine.Debug.LogWarning("CalcAverageSpeed: invalid input, fallback to default speed."); return fDefSpeed; } @@ -326,10 +330,8 @@ namespace BrewMonster { //TO DO: in c++ set 1.0f. Convert to c#, this logic is wrong. If set time is 2.0, game run correct if ((m_fBlockTime) >= 2.0f) { - Debug.LogError("m_fBlockMove = " + m_fBlockMove); if (m_fBlockMove < GPDataTypeHelper.MIN_MOVELEN_ON_GROUND || m_vBlockMove.Magnitude() < GPDataTypeHelper.MIN_MOVELEN_FOR_DETECT_VIBRATION) { - Debug.LogError("m_iBlockedCnt = 5"); m_iBlockedCnt = 5; } @@ -350,7 +352,76 @@ namespace BrewMonster { // Get host's last position sent to server public Vector3 GetLastSevPos() { return m_vLastSevPos; } public bool GetSlideLock() { return m_bSlideLock; } - } + + // Air/Water move + public A3DVECTOR3 AirWaterMove(A3DVECTOR3 vSpeed, float fTime, bool bInAir, bool bTrace = false) + { + + A3DVECTOR3 vDir = vSpeed; + float fSpeed = vDir.Normalize(); + return AirWaterMove(vDir, fSpeed, fTime, bInAir, bTrace); + } + + // Air/Water move + A3DVECTOR3 AirWaterMove(A3DVECTOR3 vDir, float fSpeed, float fTime, bool bInAir, bool bTrace/* false */) + { + + A3DVECTOR3 vRealDir = vDir; + + // OnAirMove only accept positive speed value + if (fSpeed< 0.0f) + { + vRealDir = -vDir; + fSpeed = -fSpeed; + } + + float fMaxSpeed = bInAir ? m_pHost.GetFlySpeed() : m_pHost.GetSwimSpeedSev(); + if (fSpeed > fMaxSpeed) + fSpeed = fMaxSpeed; + + ON_AIR_CDR_INFO cdr = m_pHost.m_AirCDRInfo; + + cdr.vCenter = m_pHost.m_aabbServer.Center; + cdr.vVelDir = vRealDir; + cdr.fSpeed = fSpeed; + cdr.fHeightThresh = bInAir? m_pHost.m_MoveConst.fMinAirHei : m_pHost.m_MoveConst.fMinWaterHei; + cdr.t = fTime; + cdr.bOnAir = bInAir; + + // If player is tracing something, let he fly/swim low enough + // if (bTrace) + // cdr.fHeightThresh = 0.2f; + + EC_CDR.OnAirMove(ref cdr); + + // TO DO: fix later + //if(EC_Game.GetGameRun().GetWorld().GetAssureMove() ) + // EC_Game.GetGameRun().GetWorld().GetAssureMove().NoAssureMove(); + + m_pHost.SetGroundNormal(GPDataTypeHelper.g_vAxisY); + + A3DVECTOR3 vNewPos = cdr.vCenter - GPDataTypeHelper.g_vAxisY * m_pHost.m_aabbServer.Extents.y; + + m_iBlockedCnt = 0; + m_fBlockMove += (vNewPos - m_pHost.GetPos()).Magnitude(); + m_vBlockMove += vNewPos - m_pHost.GetPos(); + if ((m_fBlockTime += fTime) >= 1.0f) + { + if (m_fBlockMove((byte[])Msg.dwParam1); + m_ExtProps = pCmd.prop; + m_BasicProps.iStatusPt = (int) pCmd.status_point; + m_BasicProps.iAtkDegree = pCmd.attack_degree; + m_BasicProps.iDefDegree = pCmd.defend_degree; + m_BasicProps.iCritRate = pCmd.crit_rate; + m_BasicProps.iCritDamageBonus = pCmd.crit_damage_bonus; + m_BasicProps.iInvisibleDegree = pCmd.invisible_degree; + m_BasicProps.iAntiInvisibleDegree = pCmd.anti_invisible_degree; + m_BasicProps.iPenetration = pCmd.penetration; + m_BasicProps.iResilience = pCmd.resilience; + m_BasicProps.iVigour = pCmd.vigour; + } +} public enum StateAnim { @@ -3627,7 +3655,6 @@ namespace BrewMonster } } enum MOVE_DIR - { MD_FORWARD = 0x01, MD_RIGHT = 0x02, From 09322bcf41bc0249bf6771c1245a9429ee6df7a5 Mon Sep 17 00:00:00 2001 From: Tungdv Date: Sat, 6 Dec 2025 14:44:34 +0700 Subject: [PATCH 7/7] fix: delete log. --- Assets/PerfectWorld/Scripts/Managers/EC_HPWorkMove.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_HPWorkMove.cs b/Assets/PerfectWorld/Scripts/Managers/EC_HPWorkMove.cs index 11fdba3951..a788cce30f 100644 --- a/Assets/PerfectWorld/Scripts/Managers/EC_HPWorkMove.cs +++ b/Assets/PerfectWorld/Scripts/Managers/EC_HPWorkMove.cs @@ -506,7 +506,6 @@ namespace BrewMonster.Scripts if ((GetMoveRelDirMask() & (uint)((MOVE_DIR.MD_LEFT | MOVE_DIR.MD_RIGHT | MOVE_DIR.MD_FORWARD | MOVE_DIR.MD_BACK))) != 0) m_iDestType = DestTypes.DEST_PUSH; - Debug.LogError("m_iDestType = " + m_iDestType); if (m_iDestType == DestTypes.DEST_2D) { float fDist;