using CSNetwork; using CSNetwork.GPDataType; using CommandID = CSNetwork.GPDataType.CommandID; namespace BrewMonster { public partial class CECHostPlayer { void OnMsgHstExtProp(ECMSG Msg) { cmd_own_ext_prop pCmd = GPDataTypeHelper.FromBytes((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; } /// /// Handle MSG_PM_PLAYEREXTPROP - Player extended properties update (for movement speed buffs, etc.) /// Mirrors C++ CECPlayerMan::OnMsgPlayerExtProp (EC_ManPlayer.cpp:797-863) /// 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((byte[])Msg.dwParam1); idPlayer = pCmd.idPlayer; pData = pCmd.ep_base; break; } case CommandID.PLAYER_EXT_PROP_MOVE: { cmd_pep_move pCmd = GPDataTypeHelper.FromBytes((byte[])Msg.dwParam1); idPlayer = pCmd.idPlayer; pData = pCmd.ep_move; break; } case CommandID.PLAYER_EXT_PROP_ATK: { cmd_pep_attack pCmd = GPDataTypeHelper.FromBytes((byte[])Msg.dwParam1); idPlayer = pCmd.idPlayer; pData = pCmd.ep_attack; break; } case CommandID.PLAYER_EXT_PROP_DEF: { cmd_pep_def pCmd = GPDataTypeHelper.FromBytes((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 } /// /// Set part of extended properties based on property index. /// Mirrors C++ CECPlayer::SetPartExtendProps (EC_Player.cpp:4051-4079) /// 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((byte[])Msg.dwParam1); bool bFirstTime = m_BasicProps.iLevel == 0 ? true : false; if (!bFirstTime) { int iLimit = (int)(pCmd.iMaxHP * 0.3f); if (pCmd.iHP < m_BasicProps.iCurHP && m_BasicProps.iCurHP >= iLimit && pCmd.iHP < iLimit) { /*if (CECUIHelper::GetGameUIMan().IsShowLowHP()) { // ѪÁ¿µÍÓÚÁÙ½çÖµÔò²¥·ÅÌØÐ§ const int GfxLastTime = 10000; // ³ÖÐøÊ±¼ä10Ãë CECUIHelper::GetGameUIMan().GetScreenEffectMan().StartEffect(CECScreenEffect::EFFECT_REDSPARK, GfxLastTime); }*/ } /*if (pCmd.iHP >= iLimit || pCmd.iHP <= 0) { // ѪÁ¿¸ßÓÚÁÙ½çÖµ»òËÀÍö£¬ÔòÍ£Ö¹²¥·ÅÌØÐ§ CECUIHelper::GetGameUIMan().GetScreenEffectMan().FinishEffect(CECScreenEffect::EFFECT_REDSPARK); }*/ /*iLimit = (int)(pCmd.iMaxMP * 0.2f); if (pCmd.iMP < m_BasicProps.iCurMP && m_BasicProps.iCurMP >= iLimit && pCmd.iMP < iLimit) BubbleText(BUBBLE_MPWARN, 0);*/ /*if (m_ExtProps.max_ap != pCmd.iMaxAP) g_pGame.GetGameRun().AddFixedMessage(FIXMSG_ADDMAXAP, pCmd.iMaxAP - m_ExtProps.max_ap);*/ } m_BasicProps.iLevel = pCmd.sLevel; SetLevel2(pCmd.Level2, bFirstTime); m_BasicProps.iExp = pCmd.iExp; m_BasicProps.iSP = pCmd.iSP; m_BasicProps.iCurHP = pCmd.iHP; m_BasicProps.iCurMP = pCmd.iMP; m_BasicProps.iCurAP = pCmd.iAP; m_ExtProps.bs.max_hp = pCmd.iMaxHP; m_ExtProps.bs.max_mp = pCmd.iMaxMP; m_ExtProps.max_ap = pCmd.iMaxAP; EventBus.Publish(new EXPToUpLevel(GetLevelUpExp(pCmd.sLevel))); EventBus.Publish(pCmd); EventBus.PublishChannel(GetCharacterID(), pCmd); // if (pCmd.State != 0 && m_bFight == false) PlayEnterBattleGfx(); m_bFight = pCmd.State != 0 ? true : false; // UpdateGodEvilSprite(); /*CECGameUIMan* pGameUI = g_pGame.GetGameRun().GetUIManager().GetInGameUIMan(); CDlgAutoHelp *pDlgHelp = dynamic_cast(pGameUI.GetDialog("Win_WikiPop"));*/ /*if(pDlgHelp && m_bFight) pDlgHelp.SetAutoHelpState(false);*/ } } }