Add revive handle on host and else player

This commit is contained in:
HungDK
2025-11-04 14:36:59 +07:00
parent 53da747d56
commit 05d952860b
2 changed files with 35 additions and 1 deletions
@@ -400,6 +400,14 @@ namespace PerfectWorld.Scripts.Player
return true;
}
public void HandleRevive(short sReviveType, A3DVECTOR3 pos)
{
SetServerPos(pos);
SetPos(pos);
m_pEPWorkMan?.FinishWork(CECEPWork.EP_work_ID.WORK_DEAD);
m_pEPWorkMan?.StartNormalWork(new CECEPWorkIdle(m_pEPWorkMan, CECEPWork.Idle_work_type.IDLE_REVIVE, 0, 0));
}
void OnMsgPlayerAtkResult(ECMSG Msg)
{
+27 -1
View File
@@ -363,9 +363,20 @@ public class CECHostPlayer : CECPlayer
case int value when value == EC_MsgDef.MSG_HST_ATTACKED: OnMsgHstAttacked(Msg); break;
case int value when value == EC_MsgDef.MSG_HST_HURTRESULT: OnMsgHstHurtResult(Msg); break;
case int value when value == EC_MsgDef.MSG_HST_INFO00: OnMsgHstInfo00(Msg); break;
case int value when value == EC_MsgDef.MSG_HST_DIED: OnMsgHstDied(Msg); break;
case int value when value == EC_MsgDef.MSG_HST_GOTO: OnMsgHstGoto(Msg); break;
}
}
private void OnMsgHstDied(in ECMSG msg)
{
EventBus.PublishChannel(GetCharacterID(), new CECPlayer.CleearComActFlagAllRankNodesEvent(true));
PlayAction((int)PLAYER_ACTION_TYPE.ACT_GROUNDDIE);
if (PopupManager.Instance != null)
{
PopupManager.Instance.OnPlayerDied();
}
}
private void OnMsgHstInfo00(in ECMSG Msg)
{
cmd_self_info_00 pCmd = GPDataTypeHelper.FromBytes<cmd_self_info_00>((byte[]) Msg.dwParam1);
@@ -855,10 +866,25 @@ public class CECHostPlayer : CECPlayer
SetPos(pCmd.pos);
}
public void HandleRevive(short sReviveType, A3DVECTOR3 pos)
{
// Move to revive position and play revive animation
PlayAction((int)PLAYER_ACTION_TYPE.ACT_REVIVE);
// Clear any running dead work if exists
m_pWorkMan?.FinishRunningWork(CECHPWork.Host_work_ID.WORK_DEAD);
// Clear corpse state so player is alive again
m_dwStates &= ~(uint)PlayerNPCState.GP_STATE_CORPSE;
}
public void OnMsgHstGoto(in ECMSG Msg)
{
Debug.Log("HoangDev :OnMsgHstGoto");
cmd_notify_hostpos pCmd = (cmd_notify_hostpos)Msg.dwParam1;
PopupManager.Instance.OnPlayerRevived();
// p1 is a byte[] buffer; parse into cmd_notify_hostpos then set position
byte[] buf = (byte[])Msg.dwParam1;
cmd_notify_hostpos pCmd = GPDataTypeHelper.FromBytes<cmd_notify_hostpos>(buf);
SetPos(new Vector3(pCmd.vPos.x, pCmd.vPos.y, pCmd.vPos.z));
}
// Message MSG_HST_SELTARGET handler