Merge pull request 'update logic fly for HP' (#118) from feature/hp_swim into develop

Reviewed-on: https://git.brew.monster/Unity/perfect-world-unity/pulls/118
This commit is contained in:
tungdv
2026-01-13 09:28:47 +00:00
17 changed files with 440 additions and 162 deletions
@@ -866,6 +866,11 @@ namespace BrewMonster.Scripts
}
return result;
}
public bool IsFreeFalling()
{
return IsWorkRunning(Host_work_ID.WORK_FREEFALL);
}
}
public abstract class CECHPWorkPostTickCommand
{
@@ -123,7 +123,7 @@ namespace BrewMonster.Scripts
if (!m_pHost.IsRooting())
{
float fDeltaTime = dwDeltaTime * 0.001f;
float fDeltaTime = dwDeltaTime;
if (m_pHost.m_iMoveEnv == (int)MoveEnvironment.MOVEENV_GROUND ||
m_pHost.m_iMoveEnv == (int)MoveEnvironment.MOVEENV_AIR)
@@ -143,7 +143,7 @@ namespace BrewMonster.Scripts
return true;
else
{
/* m_bFinished = true;
m_bFinished = true;
A3DVECTOR3 vCurPos = m_pHost.GetPos();
m_pHost.m_MoveCtrl.SendStopMoveCmd(EC_Utility.ToVector3(vCurPos), 0, (int)GPMoveMode.GP_MOVE_AIR | (int)GPMoveMode.GP_MOVE_RUN);
@@ -151,7 +151,7 @@ namespace BrewMonster.Scripts
m_pHost.PlayAction(
m_pHost.GetWingType() == enumWingType.WINGTYPE_WING ? (int)PLAYER_ACTION_TYPE.ACT_HANGINAIR : (int)PLAYER_ACTION_TYPE.ACT_HANGINAIR_SWORD,
true,
300);*/
300);
}
return true;
@@ -481,8 +481,8 @@ namespace BrewMonster.Scripts
m_pHost.m_iMoveMode = Move_Mode.MOVE_MOVE;
//PlayMoveTargetGFX();
//if (m_pHost.m_iMoveEnv != CECPlayer::MOVEENV_AIR)
// m_pHost.ShowWing(false);
if (m_pHost.m_iMoveEnv != CECPlayer.Move_environment.MOVEENV_AIR)
m_pHost.ShowWing(false);
if (!m_pHost.IsJumping())
{
@@ -80,6 +80,14 @@ namespace BrewMonster.Scripts
m_pHost.m_iMoveMode = (int)Move_Mode.MOVE_STAND;
// Velocity/acceleration reset are skipped here due to partial host API availability in C#
// If needed, add host velocity reset when fields are available
m_pHost.m_vAccel.Clear();
if (m_pHost.m_iMoveEnv == CECPlayer.Move_environment.MOVEENV_AIR)
m_pHost.m_vVelocity.x = m_pHost.m_vVelocity.z = 0.0f;
else if (m_pHost.m_iMoveEnv == CECPlayer.Move_environment.MOVEENV_WATER)
m_pHost.m_vVelocity.x = m_pHost.m_vVelocity.z = 0.0f;
else
m_pHost.m_vVelocity.Clear();
// if (m_pHost.m_pMoveTargetGFX) m_pHost.m_pMoveTargetGFX.Stop();
}
@@ -31,12 +31,29 @@ namespace BrewMonster
if (Input.GetKeyUp(KeyCode.Space))
{
isPressMoveUp = false;
OnMsgHstPushMove();
}
if (Input.GetKeyDown(KeyCode.Z))
{
isPressMoveDown = true;
OnMsgHstPushMove();
OnClickBtnJump();
}
if (Input.GetKeyUp(KeyCode.Z))
{
isPressMoveDown = false;
OnMsgHstPushMove();
}
if (Input.GetKeyDown(KeyCode.F4))
{
CmdFly(true);
}
#endif
if (Input.GetKeyDown(KeyCode.Escape))
{
OnClickBtnEscape();
}
#endif
}
/// <summary>
@@ -64,6 +64,7 @@ namespace PerfectWorld.Scripts.Managers
case int value5 when value5 == EC_MsgDef.MSG_PM_ENCHANTRESULT:
case int value6 when value6 == EC_MsgDef.MSG_PM_PLAYERDOEMOTE:
case int value7 when value7 == EC_MsgDef.MSG_PM_PLAYERGATHER:
case int value8 when value8 == EC_MsgDef.MSG_PM_PLAYERFLY:
TransmitMessage(Msg);
break;
case int value when value == EC_MsgDef.MSG_PM_PLAYERDIED:
@@ -658,6 +659,14 @@ namespace PerfectWorld.Scripts.Managers
cid = cmdMineGathered.player_id;
}
break;
case long value when value == EC_MsgDef.MSG_PM_PLAYERFLY:
if (Convert.ToInt32(Msg.dwParam2) == CommandID.OBJECT_TAKEOFF)
cid = (GPDataTypeHelper.FromBytes<cmd_object_takeoff>((byte[])Msg.dwParam1)).object_id;
else // OBJECT_LANDING
cid = (GPDataTypeHelper.FromBytes<cmd_object_landing>((byte[])Msg.dwParam1)).object_id;
break;
// ⚠️ Các case khác cũng tương tự, chỉ việc lấy ra đúng trường id / caster / user ...
// Do quá dài nên bạn có thể copy dần từng case từ C++ sang.
+17 -1
View File
@@ -89,6 +89,7 @@ namespace BrewMonster
protected bool m_bHangerOn = false;
protected int m_iCurAction;
bool m_bAboutToDie = false;
public bool m_bCandHangerOn = false;
public MOVECONST m_MoveConst; // Const used when moving control
public Move_Mode m_MoveMode;
@@ -1310,7 +1311,7 @@ namespace BrewMonster
public bool IsFlying()
{
// 临时实现 / Temporary implementation
return m_iMoveEnv == (int)MoveEnvironment.MOVEENV_AIR;
return (m_dwStates & PlayerNPCState.GP_STATE_FLY) != 0 ? true : false;
}
public bool IsInvader()
{
@@ -1607,6 +1608,21 @@ namespace BrewMonster
public bool IsAboutToDie() { return m_bAboutToDie; }
public void SetAboutToDie(bool bFlag) { m_bAboutToDie = bFlag; }
public bool IsHangerOn() { return m_bHangerOn; }
// Show / hide wing
public void ShowWing(bool bShow)
{
//if (m_pPlayerModel)
//{
// CECModel* pWing = m_pPlayerModel->GetChildModel(_wing);
// if (pWing) pWing->Show(bShow);
// CECModel* pWing2 = m_pPlayerModel->GetChildModel(_wing2);
// if (pWing2) pWing2->Show(bShow);
//}
}
}
public struct PlayActionEvent
+127 -73
View File
@@ -5,7 +5,9 @@ using BrewMonster.Scripts.World;
using CSNetwork.GPDataType;
using System;
using UnityEngine;
using UnityEngine.UI;
using static BrewMonster.CECHostMove;
using static System.Net.Mime.MediaTypeNames;
using WORD = System.UInt16;
namespace BrewMonster
@@ -122,12 +124,24 @@ namespace BrewMonster
if ((pEnvTrc.dwCheckFlag & CDR_EVN.CDR_BRUSH) == CDR_EVN.CDR_BRUSH)
{
dir = vDelta;
countHits = Physics.BoxCastNonAlloc(vStart, vExt, dir.normalized, hits, Quaternion.identity, vDelta.magnitude, 1 << 7);
if (countHits > 0 && Vector3.Distance(hits[0].point, vStart) > 0.0009f)
float num = 10f;
Vector3[] arrVExt = new Vector3[5] {
vExt
,new Vector3(vExt.x / num, vExt.y, vExt.z),
new Vector3(vExt.x, vExt.y / num, vExt.z),
new Vector3(vExt.x, vExt.y, vExt.z / num),
vExt / num
};
for(int i = 0; i < arrVExt.Length; i++)
{
pEnvTrc.fFraction = (hits[0].distance - vExt.x) / vDelta.magnitude;
pEnvTrc.vHitNormal = EC_Utility.ToA3DVECTOR3(hits[0].normal);
pEnvTrc.dwClsFlag = CDR_EVN.CDR_BRUSH;
countHits = Physics.BoxCastNonAlloc(vStart, vExt, dir.normalized, hits, Quaternion.identity, vDelta.magnitude, BrushMask);
if (countHits > 0 && hits[0].distance > 0.0009f)
{
pEnvTrc.fFraction = (hits[0].distance - vExt.x) / vDelta.magnitude;
pEnvTrc.vHitNormal = EC_Utility.ToA3DVECTOR3(hits[0].normal);
pEnvTrc.dwClsFlag = CDR_EVN.CDR_BRUSH;
break;
}
}
}
if ((pEnvTrc.dwCheckFlag & CDR_EVN.CDR_TERRAIN) == CDR_EVN.CDR_TERRAIN)
@@ -136,7 +150,12 @@ namespace BrewMonster
dir = vTerStart + vDelta;
countHits = 0;
countHits = Physics.RaycastNonAlloc(vTerStart, dir.normalized, fHitsTerrain, vDelta.magnitude, 1 << 6);
countHits = Physics.RaycastNonAlloc(vStart, Vector3.down, fHitsTerrain, vExt.y, TerrainMask);
if(countHits > 0 && fHitsTerrain[0].point.y >= vTerStart.y)
{
vTerStart.y = fHitsTerrain[0].point.y;
}
countHits = Physics.RaycastNonAlloc(vTerStart, dir.normalized, fHitsTerrain, vDelta.magnitude, TerrainMask);
if (countHits > 0 && Vector3.Distance(fHitsTerrain[0].point, vTerStart) > 0.0009f)
{
fFractionTerrain = (hits[0].distance) / vDelta.magnitude;
@@ -170,13 +189,13 @@ namespace BrewMonster
else
{
float h0 = 0f;
int countHits0 = Physics.RaycastNonAlloc(vWatStart + Vector3.up * 500f, Vector3.down, fHitsWater, 1000f, 1 << 8);
int countHits0 = Physics.RaycastNonAlloc(vWatStart + Vector3.up * 500f, Vector3.down, fHitsWater, 1000f, WaterMask);
if (countHits0 > 0)
{
h0 = fHitsWater[0].point.y;
}
float h1 = 0f;
countHits0 = Physics.RaycastNonAlloc((vWatStart + vDelta) + Vector3.up * 500f, Vector3.down, fHitsWater, 1000f, 1 << 8);
countHits0 = Physics.RaycastNonAlloc((vWatStart + vDelta) + Vector3.up * 500f, Vector3.down, fHitsWater, 1000f, WaterMask);
if(countHits0 > 0)
{
h1 = fHitsWater[0].point.y;
@@ -632,32 +651,35 @@ namespace BrewMonster
}
public static bool AABBCollideWithBrush(ref BrushTraceInfo pInfo)
public static bool AABBCollideWithBrush(ref BrushTraceInfo brushTraceInfo)
{
//TO DO: fix later
Vector3 vExt = EC_Utility.ToVector3(brushTraceInfo.vExtents);
Vector3 vStart = EC_Utility.ToVector3(brushTraceInfo.vStart);
Vector3 vDelta = EC_Utility.ToVector3(brushTraceInfo.vDelta);
Vector3 dir = vDelta;
int countHits = 0;
float num = 10f;
Vector3[] arrVExt = new Vector3[5] {
vExt
,new Vector3(vExt.x / num, vExt.y, vExt.z),
new Vector3(vExt.x, vExt.y / num, vExt.z),
new Vector3(vExt.x, vExt.y, vExt.z / num),
vExt / num
};
for (int i = 0; i < arrVExt.Length; i++)
{
countHits = Physics.BoxCastNonAlloc(vStart, vExt, dir.normalized, hits, Quaternion.identity, vDelta.magnitude, BrushMask);
if (countHits > 0)
{
if(hits[0].distance > 0.0009f)
{
brushTraceInfo.fFraction = (hits[0].distance - vExt.x) / vDelta.magnitude;
return true;
}
}
}
brushTraceInfo.fFraction = 100f;
return false;
//CECWorld pWorld = CECWorld.Instance; //g_pGame.GetGameRun().GetWorld();
//CECOrnamentMan pOrnMan = pWorld.GetOrnamentMan();
//bool bBrush = pOrnMan.TraceWithBrush(ref pInfo);
//BrushTraceInfo info = pInfo;
//CECMatterMan pMatterMan = pWorld.GetMatterMan();
//if (pMatterMan.TraceWithBrush(ref info) && info.fFraction < pInfo.fFraction)
//{
// pInfo = info;
// bBrush = true;
//}
//info = pInfo;
//CECNPCMan pNPCMan = pWorld.GetNPCMan();
//if (pNPCMan.TraceWithBrush(ref info) && info.fFraction < pInfo.fFraction)
//{
// pInfo = info;
// bBrush = true;
//}
//return bBrush;
}
public static void OnAirMove(ref ON_AIR_CDR_INFO awmInfo)
@@ -677,7 +699,7 @@ namespace BrewMonster
static void AirMove(ref ON_AIR_CDR_INFO awmInfo)
{
float DIST_EPSILON = 1e-4f;
int MAX_TRY = 1;
int MAX_TRY = 4;
float VEL_REFLECT = 0.0f;
float fTime = awmInfo.t;
//@todo : is it necessary to clamp the speed? By Kuiwu[20/9/2005]
@@ -710,7 +732,7 @@ namespace BrewMonster
trcInfo.bWaterSolid = true;
trcInfo.dwCheckFlag = CDR_EVN.CDR_TERRAIN | CDR_EVN.CDR_BRUSH | CDR_EVN.CDR_WATER;
trcInfo.vExt = vExt;
RaycastHit hit;
while (nTry < MAX_TRY)
{
if (vDelta.SquaredMagnitude() < DIST_EPSILON)
@@ -723,33 +745,22 @@ namespace BrewMonster
trcInfo.vTerStart.y -= vExt.y;
trcInfo.vWatStart = vStart;
trcInfo.vWatStart.y -= vExt.y;
//bClear = !CollideWithEnv(&trcInfo);
bClear = !Physics.BoxCast(EC_Utility.ToVector3(vStart),
EC_Utility.ToVector3(vExt),
EC_Utility.ToVector3(vStart + vVelDir).normalized,
out hit,
Quaternion.identity,
EC_Utility.ToVector3(vDelta).magnitude,
UsedMask_Ground());
bClear = !CollideWithEnv(ref trcInfo);
++nTry;
if (bClear)
{
vFinalPos = vStart + vDelta;
break;
}
else
{
vFinalPos = EC_Utility.ToA3DVECTOR3(hit.point);
vNormal = EC_Utility.ToA3DVECTOR3(hit.normal);
}
//vStart += vDelta * trcInfo.fFraction;
//vFinalPos = vStart;
//fTime -= fTime * trcInfo.fFraction;
//vNormal = trcInfo.vHitNormal;
//fSpeed = A3DVECTOR3.Normalize(vVelocity,out vVelDir);
//fSpeed *= (1 - nTry * 0.1f);
//dtp = A3DVECTOR3.DotProduct(vNormal, vVelDir);
//vVelocity = (vVelDir - vNormal * dtp - vNormal * dtp * VEL_REFLECT) * fSpeed;
//vDelta = vVelocity * fTime;
vStart += vDelta * trcInfo.fFraction;
vFinalPos = vStart;
fTime -= fTime * trcInfo.fFraction;
vNormal = trcInfo.vHitNormal;
fSpeed = Normalize(vVelocity,ref vVelDir);
fSpeed *= (1 - nTry * 0.1f);
dtp = DotProduct(vNormal, vVelDir);
vVelocity = (vVelDir - vNormal * dtp - vNormal * dtp * VEL_REFLECT) * fSpeed;
vDelta = vVelocity * fTime;
}
@@ -766,26 +777,68 @@ namespace BrewMonster
}
//see if meet height thresh
Vector3 posVStart = EC_Utility.ToVector3(vFinalPos);
float fDeltaY = awmInfo.fHeightThresh + 0.1f;
if (!Physics.Raycast(posVStart,
(posVStart + Vector3.down * fDeltaY).normalized,
out hit,
fDeltaY,
UsedMask_Ground()))
LayerMask mask = TerrainMask | BrushMask;
if (!DoGroundProbe(EC_Utility.ToVector3(vFinalPos), EC_Utility.ToVector3(vExt), fDeltaY, mask, out Vector3 vEnd, out Vector3 groundNormal, out bool bSupport))
{
awmInfo.vCenter = vFinalPos;
awmInfo.vTPNormal = vNormal;
return;
}
else
A3DVECTOR3 vTpNormal = new A3DVECTOR3(0.0f);
A3DVECTOR3 vOverTp = vFinalPos;
bool bAdjust = false;
awmInfo.bMeetHeightThresh = true;
float fHWater = 0f;
int countHits0 = Physics.RaycastNonAlloc(EC_Utility.ToVector3(vFinalPos) + Vector3.up * 500f, Vector3.down, fHitsWater, 1000f, 1 << 8);
if (countHits0 > 0)
{
vFinalPos = EC_Utility.ToA3DVECTOR3(hit.point);
vNormal = EC_Utility.ToA3DVECTOR3(hit.normal);
awmInfo.vCenter = vFinalPos;
awmInfo.vTPNormal = vNormal;
fHWater = fHitsWater[0].point.y;
}
if (bSupport)
{
bAdjust = true;
vOverTp = EC_Utility.ToA3DVECTOR3(vEnd);
vTpNormal = EC_Utility.ToA3DVECTOR3(groundNormal);
if (fHWater > vEnd.y)
{
vOverTp.y = fHWater;
vTpNormal = GPDataTypeHelper.g_vAxisY;
}
}
else if (vFinalPos.y < fHWater + awmInfo.fHeightThresh)
{
bAdjust = true;
vOverTp = vFinalPos;
vOverTp.y = fHWater;
vTpNormal = GPDataTypeHelper.g_vAxisY;
}
if (bAdjust && (vOverTp.y + awmInfo.fHeightThresh > vFinalPos.y))
{
BrushTraceInfo brushTrc = new BrushTraceInfo();
vDelta.Clear();
vDelta.y = vOverTp.y + awmInfo.fHeightThresh - vFinalPos.y;
float fAllow = (float)Math.Abs(awmInfo.vCenter.y - vFinalPos.y) + 0.001f;
fAllow = EC_Utility.a_Max(fAllow, 0.15f);
AAssist.a_ClampRoof(ref vDelta.y, fAllow);
brushTrc.Init(vFinalPos, vDelta, vExt);
if (AABBCollideWithBrush(ref brushTrc))
{
vFinalPos += (vDelta * brushTrc.fFraction);
}
else
{
vFinalPos += vDelta;
}
awmInfo.bMeetHeightThresh = (vFinalPos.y - vOverTp.y > awmInfo.fHeightThresh);
}
awmInfo.vCenter = vFinalPos;
awmInfo.vTPNormal = vTpNormal;
}
static void WaterMove(ref ON_AIR_CDR_INFO awmInfo)
@@ -916,11 +969,12 @@ namespace BrewMonster
vDelta.y = vOverTp.y + awmInfo.fHeightThresh - vFinalPos.y;
fAllow = EC_Utility.a_Min(fAllow, 0.15f);
AAssist.a_ClampRoof(ref vDelta.y, fAllow);
Vector3 dir = EC_Utility.ToVector3(vDelta);
countHits = Physics.BoxCastNonAlloc(v3Start, v3Ext, dir.normalized, hits, Quaternion.identity, dir.magnitude, 1 << 7);
if (countHits > 0)
BrushTraceInfo brushTrc = new BrushTraceInfo();
brushTrc.Init(vFinalPos, vDelta, vExt);
if (AABBCollideWithBrush(ref brushTrc))
{
vFinalPos += EC_Utility.ToA3DVECTOR3(hits[0].point);
vFinalPos += (vDelta * brushTrc.fFraction);
}
else
{
@@ -1472,6 +1472,15 @@ namespace CSNetwork.S2CCommand
this.z = z;
}
};
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct cmd_use_item
{
public byte where;
public byte byCount;
public ushort index;
public int item_id;
};
}
// Player and NPC state
@@ -719,7 +719,7 @@ namespace CSNetwork.C2SCommand
// BYTE* pBuf = (BYTE*)a_malloctemp(iSize);
// if(!pBuf) return;
//
// ((cmd_header*)pBuf)->cmd = C2S::AUTO_TEAM_SET_GOAL;
// ((cmd_header*)pBuf).cmd = C2S::AUTO_TEAM_SET_GOAL;
//
// cmd_auto_team_set_goal pCmd = (cmd_auto_team_set_goal*)(pBuf + sizeof(cmd_header));
cmd_auto_team_set_goal pCmd = new cmd_auto_team_set_goal()
@@ -730,7 +730,7 @@ namespace CSNetwork.C2SCommand
};
//
// g_pGame->GetGameSession()->SendGameData(pBuf, iSize);
// g_pGame.GetGameSession().SendGameData(pBuf, iSize);
//
// a_freetemp(pBuf);
// var cmd = new CMD_GetAllData
@@ -764,12 +764,12 @@ namespace CSNetwork.C2SCommand
// if (!pBuf)
// return;
// ((cmd_header*)pBuf)->cmd = C2S::GOTO;
// ((cmd_header*)pBuf).cmd = C2S::GOTO;
//
// cmd_goto* pCmd = (cmd_goto*)(pBuf + sizeof (cmd_header));
// pCmd->vDest.Set(x, y, z);
// pCmd.vDest.Set(x, y, z);
//
// g_pGame->GetGameSession()->SendGameData(pBuf, iSize);
// g_pGame.GetGameSession().SendGameData(pBuf, iSize);
//
// a_freetemp(pBuf);
@@ -778,5 +778,15 @@ namespace CSNetwork.C2SCommand
return SerializeCommand(CommandID.GOTO, cmd);
}
public static Octets CreateUseItemCmd(byte byPackage, byte bySlot, int tid, byte byCount)
{
cmd_use_item pCmd = new cmd_use_item();
pCmd.where = byPackage;
pCmd.index = bySlot;
pCmd.item_id = tid;
pCmd.byCount = byCount;
return SerializeCommand(CommandID.USE_ITEM, pCmd);
}
}
}
@@ -2119,5 +2119,23 @@ namespace CSNetwork.GPDataType
public int player_id;
public int item_type;
};
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct cmd_object_takeoff
{
public int object_id;
};
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct cmd_object_landing
{
public int object_id;
};
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct cmd_host_rush_fly
{
public byte is_active;
};
}
@@ -592,7 +592,7 @@ namespace CSNetwork
// if (string.IsNullOrEmpty(szMsg))
// BMLogger.LogError("SERVER - unknown error !");
//else if (pCmd.iMessage != 2)
//g_pGame->GetGameRun()->AddChatMessage(szMsg, GP_CHAT_MISC);
//g_pGame.GetGameRun().AddChatMessage(szMsg, GP_CHAT_MISC);
}
if (pCmd.iMessage == 2)
@@ -603,31 +603,31 @@ namespace CSNetwork
else if (pCmd.iMessage == 20)
{
// Failed to cast skill
//pGameRun->PostMessage(MSG_PM_CASTSKILL, MAN_PLAYER, 0, (DWORD)pDataBuf, pCmdHeader->cmd);
//pGameRun.PostMessage(MSG_PM_CASTSKILL, MAN_PLAYER, 0, (DWORD)pDataBuf, pCmdHeader.cmd);
}
else if (pCmd.iMessage == 133 || pCmd.iMessage == 134)
{
// deal failed
//pGameRun->PostMessage(MSG_HST_BUY_SELL_FAIL, MAN_PLAYER, 0, (DWORD)pDataBuf, pCmdHeader->cmd);
//pGameRun.PostMessage(MSG_HST_BUY_SELL_FAIL, MAN_PLAYER, 0, (DWORD)pDataBuf, pCmdHeader.cmd);
}
else if (pCmd.iMessage == 158)
{
// µ±Ç°»ãÂʲ»¶Ô£¬ÖØÐÂÈ¡»ãÂÊ
//c2s_CmdGetCashMoneyRate();
}
else if (pCmd.iMessage == 108 /*&& pGameRun->GetHostPlayer()->IsInKingService()*/)
else if (pCmd.iMessage == 108 /*&& pGameRun.GetHostPlayer().IsInKingService()*/)
{
/* CECGameUIMan* pGameUI = pGameRun->GetUIManager()->GetInGameUIMan();
/* CECGameUIMan* pGameUI = pGameRun.GetUIManager().GetInGameUIMan();
if (pGameUI)
pGameUI->EndNPCService();*/
pGameUI.EndNPCService();*/
}
else if
(pCmd.iMessage == 108 /*&& pGameRun->GetHostPlayer()->GetOfflineShopCtrl()->GetNPCSevFlag() != COfflineShopCtrl::NPCSEV_NULL*/
(pCmd.iMessage == 108 /*&& pGameRun.GetHostPlayer().GetOfflineShopCtrl().GetNPCSevFlag() != COfflineShopCtrl::NPCSEV_NULL*/
)
{
/* CECGameUIMan* pGameUI = pGameRun->GetUIManager()->GetInGameUIMan();
/* CECGameUIMan* pGameUI = pGameRun.GetUIManager().GetInGameUIMan();
if (pGameUI)
pGameUI->EndNPCService();*/
pGameUI.EndNPCService();*/
}
else if (pCmd.iMessage == 175)
{
@@ -787,6 +787,27 @@ namespace CSNetwork
case CommandID.COOLTIME_DATA:
EC_ManMessage.PostMessage(EC_MsgDef.MSG_HST_COOLTIMEDATA, MANAGER_INDEX.MAN_PLAYER, 0, pDataBuf, pCmdHeader);
break;
case CommandID.OBJECT_TAKEOFF:
{
cmd_object_takeoff pCmdTakeOff = GPDataTypeHelper.FromBytes<cmd_object_takeoff>((byte[])pDataBuf);
if (ISPLAYERID(pCmdTakeOff.object_id))
EC_ManMessage.PostMessage(EC_MsgDef.MSG_PM_PLAYERFLY, MANAGER_INDEX.MAN_PLAYER, -1, pDataBuf, pCmdHeader);
break;
}
case CommandID.OBJECT_LANDING:
{
cmd_object_landing pCmdLanding = GPDataTypeHelper.FromBytes<cmd_object_landing>((byte[])pDataBuf);
if (ISPLAYERID(pCmdLanding.object_id))
EC_ManMessage.PostMessage(EC_MsgDef.MSG_PM_PLAYERFLY, MANAGER_INDEX.MAN_PLAYER, -1, pDataBuf, pCmdHeader);
break;
}
case CommandID.HOST_RUSH_FLY:
EC_ManMessage.PostMessage(EC_MsgDef.MSG_PM_PLAYERFLY, MANAGER_INDEX.MAN_PLAYER, 0, pDataBuf, pCmdHeader);
break;
case CommandID.FLYSWORD_TIME:
EC_ManMessage.PostMessage(EC_MsgDef.MSG_HST_FLYSWORDTIME, MANAGER_INDEX.MAN_PLAYER, 0, pDataBuf, pCmdHeader);
break;
}
}
@@ -1390,5 +1411,11 @@ namespace CSNetwork
SendProtocol(gamedatasend);
}
public void c2s_SendCmdUseItem(byte byPackage, byte bySlot, int tid, byte byCount)
{
gamedatasend gamedatasend = new gamedatasend();
gamedatasend.Data = C2SCommandFactory.CreateUseItemCmd(byPackage, bySlot, tid, byCount);
SendProtocol(gamedatasend);
}
}
}
@@ -409,5 +409,10 @@ namespace BrewMonster.Network
{
Instance._gameSession.c2s_CmdGoto(x, y, z);
}
public static void c2s_CmdUseItem(byte byPackage, byte bySlot, int tid, byte byCount)
{
Instance._gameSession.c2s_SendCmdUseItem(byPackage, bySlot, tid, byCount);
}
}
}
@@ -40,6 +40,7 @@ namespace BrewMonster.UI
if (pHost != null)
{
pHost.isPressMoveUp = false;
pHost.OnMsgHstPushMove();
}
}
}
+162 -68
View File
@@ -21,10 +21,7 @@ using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
using UnityEngine;
using UnityEngine.PlayerLoop;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
using static System.Net.Mime.MediaTypeNames;
using Host_work_ID = BrewMonster.Scripts.CECHPWork.Host_work_ID;
using Trace_reason = BrewMonster.CECHPWorkTrace.Trace_reason;
@@ -90,6 +87,7 @@ namespace BrewMonster
private CECSkill m_pTargetItemSkill; // Target item skill
public CECComboSkill m_pComboSkill; // Combo skill
public A3DVECTOR3 m_vAccel; // Accelerate\
public bool m_bRushFly = false; // true, in rush fly mode
private CECCounter m_IncantCnt;
private bool m_bMelee;
@@ -119,7 +117,7 @@ namespace BrewMonster
// ID of summon player skill
const int ID_SUMMONPLAYER_SKILL = 1824;
private CECAutoTeam m_pAutoTeam;
private CECAutoTeam m_pAutoTeam;
// ====== Ground cast config ======
[Header("Ground Cast")]
@@ -145,6 +143,7 @@ namespace BrewMonster
Camera mainCam;
Ray ray;
RaycastHit[] hits = new RaycastHit[5];
bool isDataAwaitToReady = false;
private BaseVfxObject m_pSelectedGFX;
private BaseVfxObject m_pHoverGFX;
@@ -357,6 +356,11 @@ namespace BrewMonster
protected override void Update()
{
base.Update();
if (!isDataAwaitToReady)
{
return;
}
#if UNITY_EDITOR
if (Input.GetKeyDown(KeyCode.C))
{
@@ -548,6 +552,7 @@ namespace BrewMonster
case int value when value == EC_MsgDef.MSG_HST_COOLTIMEDATA: OnMsgHstCoolTimeData(Msg); break;
case int value when value == EC_MsgDef.MSG_HST_SETCOOLTIME: OnMsgHstSetCoolTime(Msg); break;
case int value when value == EC_MsgDef.MSG_HST_PRESSCANCEL: OnMsgHstPressCancel(Msg); break;
case int value when value == EC_MsgDef.MSG_PM_PLAYERFLY: OnMsgPlayerFly(Msg); break;
}
@@ -594,36 +599,36 @@ namespace BrewMonster
{
int i;
// other goblin skills should be set public cool down, 1 second
/* for (i = 0; i < m_aGoblinSkills.GetSize(); i++)
{
if (m_aGoblinSkills[i] && m_aGoblinSkills[i]->GetCoolingCnt() == 0)
m_aGoblinSkills[i]->StartCooling(GetCoolTime(GP_CT_CAST_ELF_SKILL), GetCoolTime(GP_CT_CAST_ELF_SKILL));
}*/
/* for (i = 0; i < m_aGoblinSkills.GetSize(); i++)
{
if (m_aGoblinSkills[i] && m_aGoblinSkills[i].GetCoolingCnt() == 0)
m_aGoblinSkills[i].StartCooling(GetCoolTime(GP_CT_CAST_ELF_SKILL), GetCoolTime(GP_CT_CAST_ELF_SKILL));
}*/
/* for (i = 0; i < m_aPsSkills.Count; i++)
{
CECSkill pSkill = GetPassiveSkillByIndex(i);
if (pSkill && (pSkill->GetCommonCoolDown() & (1 << (pCmd->cooldown_index - GP_CT_SKILLCOMMONCOOLDOWN0))))
pSkill->StartCooling(GetCoolTime(pCmd->cooldown_index), GetCoolTime(pCmd->cooldown_index));
}*/
/* for (i = 0; i < m_aPsSkills.Count; i++)
{
CECSkill pSkill = GetPassiveSkillByIndex(i);
if (pSkill && (pSkill.GetCommonCoolDown() & (1 << (pCmd.cooldown_index - GP_CT_SKILLCOMMONCOOLDOWN0))))
pSkill.StartCooling(GetCoolTime(pCmd.cooldown_index), GetCoolTime(pCmd.cooldown_index));
}*/
}
if (pCmd.cooldown_index >= (int)CoolTimeIndex.GP_CT_SKILLCOMMONCOOLDOWN0 && pCmd.cooldown_index <= (int)CoolTimeIndex.GP_CT_SKILLCOMMONCOOLDOWN4)
{
// other player skills should be set public cool down too.
uint mask = (uint)( 1 << (pCmd.cooldown_index - (int)CoolTimeIndex.GP_CT_SKILLCOMMONCOOLDOWN0));
uint mask = (uint)(1 << (pCmd.cooldown_index - (int)CoolTimeIndex.GP_CT_SKILLCOMMONCOOLDOWN0));
for (int i = 0; i < GetPositiveSkillNum(); i++)
{
CECSkill pSkill = GetPositiveSkillByIndex(i);
int fakeRef = 0;
if (pSkill != null && (pSkill.GetCommonCoolDown() & mask) != 0)
pSkill.StartCooling(GetCoolTime(pCmd.cooldown_index,ref fakeRef), GetCoolTime(pCmd.cooldown_index, ref fakeRef));
pSkill.StartCooling(GetCoolTime(pCmd.cooldown_index, ref fakeRef), GetCoolTime(pCmd.cooldown_index, ref fakeRef));
}
/*const std::map<unsigned int, CECSkill*>&inherentSkillMap = CECComboSkillState::Instance().GetInherentSkillMap();
std::map < unsigned int, CECSkill*>::const_iterator it;
for (it = inherentSkillMap.begin(); it != inherentSkillMap.end(); ++it)
{
it->second->StartCooling(GetCoolTime(pCmd->cooldown_index), GetCoolTime(pCmd->cooldown_index));
it.second.StartCooling(GetCoolTime(pCmd.cooldown_index), GetCoolTime(pCmd.cooldown_index));
}*/
}
}
@@ -647,13 +652,13 @@ namespace BrewMonster
{
pSkill.StartCooling(pCmd.cooldown_time, pCmd.cooldown_time);
}
/* else if (pSkill = CECComboSkillState::Instance().GetInherentSkillByID(idSkill))
{
pSkill->StartCooling(pCmd->cooldown_time, pCmd->cooldown_time);
}*/
/* else if (pSkill = CECComboSkillState::Instance().GetInherentSkillByID(idSkill))
{
pSkill.StartCooling(pCmd.cooldown_time, pCmd.cooldown_time);
}*/
else if (GetEquipSkillByID(idSkill) == null)
{
BMLogger.LogError ("HoangDev: pSkill " + pSkill);
BMLogger.LogError("HoangDev: pSkill " + pSkill);
}
}
else
@@ -944,7 +949,7 @@ namespace BrewMonster
// Print a notify message
// 打印提示消息
// g_pGame->GetGameRun()->AddFixedMessage(FIXMSG_SKILLINTERRUPT);
// g_pGame.GetGameRun().AddFixedMessage(FIXMSG_SKILLINTERRUPT);
Debug.Log("Skill interrupted!");
//AP_ActionEvent(AP_EVENT_STOPSKILL);
@@ -1211,7 +1216,7 @@ namespace BrewMonster
// Continue combo skill
// 继续连击技能
// if (CECAutoPolicy::GetInstance().IsAutoPolicyEnabled())
// g_pGame->GetGameRun()->PostMessage(MSG_HST_CONTINUECOMBOSKILL, MAN_PLAYER, 0, 0, m_pComboSkill->GetGroupIndex());
// g_pGame.GetGameRun().PostMessage(MSG_HST_CONTINUECOMBOSKILL, MAN_PLAYER, 0, 0, m_pComboSkill.GetGroupIndex());
// else
m_pComboSkill.Continue(false);
}
@@ -2464,7 +2469,7 @@ namespace BrewMonster
SetPlayerInfor(new INFO(role.cid, role.crc_e, role.crc_c));
await SetPlayerModel(UnityGameSession.Instance.GetRoleInfo().occupation,
UnityGameSession.Instance.GetRoleInfo().gender);
isDataAwaitToReady = true;
Vector3 pos = new Vector3(role.pos.x, role.pos.y, role.pos.z);
string roleName = Encoding.Unicode.GetString(UnityGameSession.Instance.GetRoleInfo().name.ByteArray);
if (txtName != null) txtName.text = roleName;
@@ -2473,7 +2478,7 @@ namespace BrewMonster
m_dwResFlags = (uint)PlayerResourcesReadyFlag.RESFG_ALL;
joystick = FindAnyObjectByType<Joystick>();
EventBus.Subscribe<JoystickRealeaseEvent>(JoystickRelease);
EventBus.Subscribe<JoystickPressEvent>(OnMsgHstPushMove);
EventBus.Subscribe<JoystickPressEvent>(OnClickJoystick);
if (TryGetComponent<PlayerVisual>(out var visual))
{
visual.InitPlayerEventDoneHandler();
@@ -2495,9 +2500,9 @@ namespace BrewMonster
m_CDRInfo.vExtent = m_aabbServer.Extents;
Vector3 pStart = pos;
pos.y += m_CDRInfo.vExtent.y;
if (Physics.Raycast(pos, Vector3.down, out RaycastHit hit, m_CDRInfo.vExtent.y, 1 << 6))
if (Physics.RaycastNonAlloc(pos, Vector3.down, hits, m_CDRInfo.vExtent.y, 1 << 6) > 0)
{
m_CDRInfo.vTPNormal = EC_Utility.ToA3DVECTOR3(hit.normal);
m_CDRInfo.vTPNormal = EC_Utility.ToA3DVECTOR3(hits[0].normal);
}
else
{
@@ -2636,7 +2641,7 @@ namespace BrewMonster
private void OnDestroy()
{
EventBus.Unsubscribe<JoystickRealeaseEvent>(JoystickRelease);
EventBus.Unsubscribe<JoystickPressEvent>(OnMsgHstPushMove);
EventBus.Unsubscribe<JoystickPressEvent>(OnClickJoystick);
}
//TODO: Remove this function. Since it has been deprecated.
@@ -3380,21 +3385,21 @@ namespace BrewMonster
}
/* else if (pSkill.GetType() == CECSkill::TYPE_BLESSPET)
{
CECPet* pPet = g_pGame->GetGameRun()->GetWorld()->GetNPCMan()->GetPetByID(idSelTarget);
if (!pPet || pPet->GetMasterID() == GetCharacterID())
CECPet* pPet = g_pGame.GetGameRun().GetWorld().GetNPCMan().GetPetByID(idSelTarget);
if (!pPet || pPet.GetMasterID() == GetCharacterID())
{
// Spell skill on host's pet
CECPetData* pPetData = m_pPetCorral->GetActivePet();
CECPetData* pPetData = m_pPetCorral.GetActivePet();
if (!pPetData ||
pPetData->GetClass() != GP_PET_CLASS_COMBAT &&
pPetData->GetClass() != GP_PET_CLASS_SUMMON &&
pPetData->GetClass() != GP_PET_CLASS_EVOLUTION)
pPetData.GetClass() != GP_PET_CLASS_COMBAT &&
pPetData.GetClass() != GP_PET_CLASS_SUMMON &&
pPetData.GetClass() != GP_PET_CLASS_EVOLUTION)
return false;
idCastTarget = m_pPetCorral->GetActivePetNPCID();
idCastTarget = m_pPetCorral.GetActivePetNPCID();
}
// Only fighting pet can be blessed.
if (pPet && !pPet->CanBeAttacked())
if (pPet && !pPet.CanBeAttacked())
return false;
}*/
else
@@ -3404,7 +3409,7 @@ namespace BrewMonster
}
// iTargetType == 4 means target must be pet. The problem is that pet will
// disappear from world after it died, so GetWorld()->GetObject() will return
// disappear from world after it died, so GetWorld().GetObject() will return
// NULL when host spells revive-pet skill on his dead pet. So, the target
// type of revive-pet skill should be 0
if (iTargetType != 0)
@@ -3466,7 +3471,7 @@ namespace BrewMonster
bool bTraceOK = false;
bool bUseAutoPF = false;
/* CECPlayerWrapper pWrapper = CECAutoPolicy::GetInstance().GetPlayerWrapper();
if (CECAutoPolicy::GetInstance().IsAutoPolicyEnabled() && pWrapper->GetAttackError() >= 2)
if (CECAutoPolicy::GetInstance().IsAutoPolicyEnabled() && pWrapper.GetAttackError() >= 2)
bUseAutoPF = true;*/
if (idCastTarget == 0)
@@ -4346,12 +4351,12 @@ namespace BrewMonster
case ActionCanDo.CANDO_FLY:
if (IsDead() || IsRooting() /*|| IsSitting() || IsTrading() || IsReviving() ||
if (IsDead() || IsRooting() || IsSitting() || IsTrading() || IsReviving() ||
IsUsingTrashBox() || IsTalkingWithNPC() || IsChangingFace() || GetBoothState() != 0 ||
IsFlashMoving() */ ||
m_pWorkMan.HasWorkRunningOnPriority(CECHPWorkMan.Work_priority.PRIORITY_2) /*||
m_bHangerOn || IsOperatingPet() || IsRebuildingPet() ||
IsUsingItem() || IsRidingOnPet() || GetShapeType() == PLAYERMODEL_DUMMYTYPE2 || IsPassiveMove() ||
//IsFlashMoving() ||
m_pWorkMan.HasWorkRunningOnPriority(CECHPWorkMan.Work_priority.PRIORITY_2) ||
m_bHangerOn || /*IsOperatingPet() || IsRebuildingPet() ||*/
IsUsingItem() || /*IsRidingOnPet() || GetShapeType() == PLAYERMODEL_DUMMYTYPE2 ||*/ IsPassiveMove() /*||
m_playerLimits.test(PLAYER_LIMIT_NOFLY) || m_BattleInfo.IsChariotWar()*/)
bRet = false;
@@ -4536,10 +4541,7 @@ namespace BrewMonster
return false;
}
if (m_iMoveEnv == Move_environment.MOVEENV_AIR)
{
}
else if (m_iMoveEnv == Move_environment.MOVEENV_WATER)
if (m_iMoveEnv == Move_environment.MOVEENV_WATER || m_iMoveEnv == Move_environment.MOVEENV_AIR)
{
float angle = Vector2.Angle(new Vector2(joystick.Horizontal, joystick.Vertical), Vector2.up);
angle *= joystick.Horizontal < 0 ? 1 : -1;
@@ -4590,7 +4592,7 @@ namespace BrewMonster
{
h0 = hits[0].point.y;
}
if(vPos.y < h0 - m_MoveConst.fShoreDepth)
if (vPos.y < h0 - m_MoveConst.fShoreDepth)
{
return false;
}
@@ -4656,8 +4658,8 @@ namespace BrewMonster
{
if (IsDead())
{
/* CECGameUIMan pGameUI = g_pGame->GetGameRun()->GetUIManager()->GetInGameUIMan();
pGameUI->PopupReviveDialog(true);*/
/* CECGameUIMan pGameUI = g_pGame.GetGameRun().GetUIManager().GetInGameUIMan();
pGameUI.PopupReviveDialog(true);*/
PopupManager.Instance.OnPlayerDied();
}
m_bEnterGame = true;
@@ -5622,12 +5624,13 @@ namespace BrewMonster
vHitNormal = EC_Utility.ToA3DVECTOR3(Vector3.up);
}
else
{
{
if (Math.Abs(hits[0].distance - 0f) <= float.Epsilon)
{
// halfBox with y = 0.05f? I need Y box check too small.
count = Physics.BoxCastNonAlloc(vCenter, new Vector3(vExt.x, 0.05f, vExt.z), (Vector3.down).normalized,
hits, transform.rotation, DeltaY, layerMask);
if(count == 0)
if (count == 0)
{
vHitPos = vCenter;
vHitNormal = EC_Utility.ToA3DVECTOR3(Vector3.up);
@@ -5679,9 +5682,9 @@ namespace BrewMonster
// if( m_iBuddyId )
// {
// CECPlayer pBuddy = m_pPlayerMan->GetPlayer(m_iBuddyId);
// CECPlayer pBuddy = m_pPlayerMan.GetPlayer(m_iBuddyId);
// if (pBuddy)
// pBuddy->DoEmote(pCmd->emotion);
// pBuddy.DoEmote(pCmd.emotion);
// }
GetTaskInterface().SetEmotion(pCmd.emotion);
@@ -6008,15 +6011,15 @@ namespace BrewMonster
{
cmd_player_gather_start pCmd = GPDataTypeHelper.FromBytes<cmd_player_gather_start>((byte[])Msg.dwParam1);
EC_ManMatter pMatterMan = EC_ManMessageMono.Instance.GetECManMatter;//g_pGame->GetGameRun()->GetWorld()->GetMatterMan();
EC_ManMatter pMatterMan = EC_ManMessageMono.Instance.GetECManMatter;//g_pGame.GetGameRun().GetWorld().GetMatterMan();
CECMatter pMatter = pMatterMan.GetMatter(pCmd.mid);
// if (pMatter && pMatter->IsMonsterSpiritMine()) {
// CECHPWorkUse* pWork = (CECHPWorkUse*)m_pWorkMan->CreateWork(CECHPWork::WORK_USEITEM);
// if (pMatter && pMatter.IsMonsterSpiritMine()) {
// CECHPWorkUse* pWork = (CECHPWorkUse*)m_pWorkMan.CreateWork(CECHPWork::WORK_USEITEM);
// if (pWork) {
// pWork->SetParams(pCmd->mid, pCmd->use_time * 1000, pCmd->mid, true);
// m_pWorkMan->StartWork_p1(pWork);
// pWork.SetParams(pCmd.mid, pCmd.use_time * 1000, pCmd.mid, true);
// m_pWorkMan.StartWork_p1(pWork);
// }
// StartMonsterSpiritConnectGfx(pCmd->mid, pMatter->GetPos());
// StartMonsterSpiritConnectGfx(pCmd.mid, pMatter.GetPos());
// } else {
EC_HPWorkPick pWork = (EC_HPWorkPick)m_pWorkMan.CreateWork(Host_work_ID.WORK_PICKUP);
if (pWork != null)
@@ -6053,7 +6056,7 @@ namespace BrewMonster
else if (cmd == CommandID.MINE_GATHERED)
{
cmd_mine_gathered pCmd = GPDataTypeHelper.FromBytes<cmd_mine_gathered>((byte[])Msg.dwParam1);
// ASSERT(pCmd && pCmd->player_id == m_PlayerInfo.cid);
// ASSERT(pCmd && pCmd.player_id == m_PlayerInfo.cid);
elementdataman pDataMan = EC_Game.GetElementDataMan();
DATA_TYPE DataType = pDataMan.get_data_type((uint)pCmd.item_type, ID_SPACE.ID_SPACE_ESSENCE);
if (DataType == DATA_TYPE.DT_MONSTER_SPIRIT_ESSENCE)
@@ -6069,7 +6072,7 @@ namespace BrewMonster
{
// Get real time tick of this frame
var iRealTime = EC_Game.GetRealTickTime();
// Update flysword time
/*if (IsFlying() && GetRushFlyFlag())
{
@@ -6304,7 +6307,7 @@ namespace BrewMonster
}
// Cancel current selection
if (m_idSelTarget >0)
if (m_idSelTarget > 0)
{
SelectTarget(0);
return;
@@ -6318,17 +6321,108 @@ namespace BrewMonster
return;
}
}
// Is doing session pose ?
private bool DoingSessionPose()
{
var pCurWork = m_pWorkMan.GetRunningWork(Host_work_ID.WORK_STAND);
if (pCurWork !=null){
if (((CECHPWorkStand)pCurWork).DoingSessionPose()){
if (pCurWork != null)
{
if (((CECHPWorkStand)pCurWork).DoingSessionPose())
{
return true;
}
}
return false;
}
// Start / Stop flying
public bool CmdFly(bool bForceFly)
{
//if (m_pActionSwitcher)
// m_pActionSwitcher.PostMessge(CECActionSwitcherBase::MSG_FLY);
// first of all see if we need to cancel sitdown work.
if (!CanDo(ActionCanDo.CANDO_FLY))
return false;
EC_IvtrItem pItem = EquipInventory.GetItem(InventoryConst.EQUIPIVTR_FLYSWORD);
if (pItem == null)
return false;
if(pItem is EC_IvtrEquip)
{
if ((pItem as EC_IvtrEquip).IsDestroying())
return false;
}
if (!IsFlying())
{
// TODO: Maybe we should let server tell us whether we can fly or not
bool bCanFly = true;
if (m_iMoveEnv == (int)MoveEnvironment.MOVEENV_AIR)
bCanFly = false;
else if (m_iMoveEnv == (int)MoveEnvironment.MOVEENV_WATER && !CanTakeOffWater())
bCanFly = false;
if (!bCanFly)
return false;
}
UnityGameSession.c2s_CmdUseItem(InventoryConst.IVTRTYPE_EQUIPPACK, InventoryConst.EQUIPIVTR_FLYSWORD, pItem.GetTemplateID(), 1);
return true;
}
void OnMsgPlayerFly(ECMSG Msg)
{
if (Convert.ToInt32(Msg.dwParam2) == CommandID.OBJECT_TAKEOFF)
{
if ((m_dwStates & PlayerNPCState.GP_STATE_FLY) == 0)
{
m_dwStates |= PlayerNPCState.GP_STATE_FLY;
m_bRushFly = false;
CECHPWorkFly pWork = (CECHPWorkFly)m_pWorkMan.CreateWork(CECHPWork.Host_work_ID.WORK_FLYOFF);
if (m_pWorkMan.IsFreeFalling())
{
pWork.m_bContinueFly = true;
m_pWorkMan.StartWork_p1(pWork);
}
else
{
pWork.m_bContinueFly = false;
m_pWorkMan.StartWork_p2(pWork);
}
}
}
else if (Convert.ToInt32(Msg.dwParam2) == CommandID.OBJECT_LANDING)
{
if ((m_dwStates & PlayerNPCState.GP_STATE_FLY) != 0)
{
m_dwStates &= ~(uint)PlayerNPCState.GP_STATE_FLY;
if (IsDead() || m_bCandHangerOn || IsHangerOn())
ShowWing(false);
else
{
CECHPWorkFall pWork = (CECHPWorkFall)m_pWorkMan.CreateWork(CECHPWork.Host_work_ID.WORK_FREEFALL);
pWork.SetFallType(CECHPWorkFall.Fall_type.TYPE_FLYFALL);
m_pWorkMan.StartWork_p1(pWork);
}
// Below two lines will fix the "host stand in air" bug.
m_iMoveEnv = Move_environment.MOVEENV_GROUND;
m_CDRInfo.vTPNormal.Clear();
}
}
else // HOST_RUSH_FLY
{
cmd_host_rush_fly pCmd = GPDataTypeHelper.FromBytes<cmd_host_rush_fly>((byte[])Msg.dwParam1);
m_bRushFly = pCmd.is_active != 0 ? true : false;
}
}
}
}
+5
View File
@@ -205,6 +205,11 @@ public static class EC_Utility
return (y.CompareTo(x) < 0) ? y : x;
}
public static T a_Max<T>(T x, T y) where T : IComparable<T>
{
return (y.CompareTo(x) < 0) ? x : y;
}
public static bool STRING_TO_A3DCOLOR(string str, out Color clr)
{
// A3DCOLOR_TO_STRING ת