fix use skill buff

This commit is contained in:
VDH
2026-03-07 09:54:02 +07:00
parent ec8807ed72
commit a184aa0ed5
5 changed files with 170 additions and 517 deletions
@@ -1,5 +1,6 @@
using CSNetwork;
using CSNetwork.GPDataType;
using CommandID = CSNetwork.GPDataType.CommandID;
namespace BrewMonster
{
@@ -21,6 +22,87 @@ namespace BrewMonster
m_BasicProps.iVigour = pCmd.vigour;
}
/// <summary>
/// Handle MSG_PM_PLAYEREXTPROP - Player extended properties update (for movement speed buffs, etc.)
/// Mirrors C++ CECPlayerMan::OnMsgPlayerExtProp (EC_ManPlayer.cpp:797-863)
/// </summary>
void OnMsgPlayerExtProp(ECMSG Msg)
{
int cmdID = (int)Msg.dwParam2; // Command ID: PLAYER_EXT_PROP_MOVE (54), PLAYER_EXT_PROP_BASE (53), etc.
int idPlayer;
object pData;
BMLogger.LogError("OnMsgPlayerExtProp cmdID=" + cmdID);
switch (cmdID)
{
case CommandID.PLAYER_EXT_PROP_BASE:
{
cmd_pep_base pCmd = GPDataTypeHelper.FromBytes<cmd_pep_base>((byte[])Msg.dwParam1);
idPlayer = pCmd.idPlayer;
pData = pCmd.ep_base;
break;
}
case CommandID.PLAYER_EXT_PROP_MOVE:
{
cmd_pep_move pCmd = GPDataTypeHelper.FromBytes<cmd_pep_move>((byte[])Msg.dwParam1);
idPlayer = pCmd.idPlayer;
pData = pCmd.ep_move;
break;
}
case CommandID.PLAYER_EXT_PROP_ATK:
{
cmd_pep_attack pCmd = GPDataTypeHelper.FromBytes<cmd_pep_attack>((byte[])Msg.dwParam1);
idPlayer = pCmd.idPlayer;
pData = pCmd.ep_attack;
break;
}
case CommandID.PLAYER_EXT_PROP_DEF:
{
cmd_pep_def pCmd = GPDataTypeHelper.FromBytes<cmd_pep_def>((byte[])Msg.dwParam1);
idPlayer = pCmd.idPlayer;
pData = pCmd.ep_def;
break;
}
default:
UnityEngine.Debug.LogError($"OnMsgPlayerExtProp: Unknown command ID {cmdID}");
return;
}
// Check if this is the host player (mirrors C++: idPlayer == pSession->GetCharacterID())
if (idPlayer == GetCharacterID())
{
SetPartExtendProps(cmdID, pData);
}
// TODO: Handle other players (CECElsePlayer) if needed
}
/// <summary>
/// Set part of extended properties based on property index.
/// Mirrors C++ CECPlayer::SetPartExtendProps (EC_Player.cpp:4051-4079)
/// </summary>
void SetPartExtendProps(int cmdID, object pData)
{
switch (cmdID)
{
case CommandID.PLAYER_EXT_PROP_BASE:
m_ExtProps.bs = (ROLEEXTPROP_BASE)pData;
break;
case CommandID.PLAYER_EXT_PROP_MOVE:
m_ExtProps.mv = (ROLEEXTPROP_MOVE)pData;
// Speed buff applied - movement speed should now be updated
break;
case CommandID.PLAYER_EXT_PROP_ATK:
m_ExtProps.ak = (ROLEEXTPROP_ATK)pData;
break;
case CommandID.PLAYER_EXT_PROP_DEF:
m_ExtProps.df = (ROLEEXTPROP_DEF)pData;
break;
default:
UnityEngine.Debug.LogError($"SetPartExtendProps: Unknown command ID {cmdID}");
return;
}
}
private void OnMsgHstInfo00(in ECMSG Msg)
{
cmd_self_info_00 pCmd = GPDataTypeHelper.FromBytes<cmd_self_info_00>((byte[])Msg.dwParam1);