fix: update normal atk.
This commit is contained in:
@@ -4,7 +4,7 @@ using UnityEngine;
|
||||
public class A3DFuncs
|
||||
{
|
||||
// Returns vector with same direction and unit length
|
||||
static A3DVECTOR3 a3d_Normalize(A3DVECTOR3 v)
|
||||
public static A3DVECTOR3 a3d_Normalize(A3DVECTOR3 v)
|
||||
{
|
||||
float mag = v.Magnitude();
|
||||
if (mag< 1e-12 && mag> -1e-12)
|
||||
|
||||
@@ -54,7 +54,7 @@ class CECHPWorkMelee : CECHPWork
|
||||
// If target turn to be un-attackable, cancel action
|
||||
if (m_pHost.AttackableJudge(m_idTarget, true) == 0)
|
||||
{
|
||||
//g_pGame.GetGameSession().c2s_CmdCancelAction();
|
||||
g_pGame.GetGameSession().c2s_CmdCancelAction();
|
||||
m_bFinished = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
using BrewMonster;
|
||||
using BrewMonster.Network;
|
||||
using CSNetwork.GPDataType;
|
||||
using PerfectWorld.Scripts.Player;
|
||||
using System;
|
||||
using System.Runtime.ConstrainedExecution;
|
||||
using UnityEngine;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
@@ -6,16 +12,16 @@ using CSNetwork.GPDataType;
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
enum TraceObjectType
|
||||
public static class TraceObjectType
|
||||
{
|
||||
TRACE_NONE = 0,
|
||||
TRACE_PLAYER,
|
||||
TRACE_MATTER,
|
||||
TRACE_NPC,
|
||||
TRACE_TASKNPC
|
||||
};
|
||||
public const int TRACE_NONE = 0,
|
||||
TRACE_PLAYER = 1,
|
||||
TRACE_MATTER = 2,
|
||||
TRACE_NPC = 3,
|
||||
TRACE_TASKNPC = 4;
|
||||
}
|
||||
|
||||
abstract class CECTracedObject
|
||||
public abstract class CECTracedObject
|
||||
{
|
||||
//friend CECHPWorkTrace;
|
||||
protected int m_iTraceType;
|
||||
@@ -46,22 +52,48 @@ abstract class CECTracedObject
|
||||
public abstract bool OnTouched();
|
||||
public abstract CECTracedObject Clone();
|
||||
|
||||
// TO DO: fix later
|
||||
public virtual bool IsTargetMissing()
|
||||
{
|
||||
//if (m_iObjectId != 0)
|
||||
//{
|
||||
// CECObject pObj = g_pGame->GetGameRun()->GetWorld()->GetObject(m_iObjectId, 0);
|
||||
// if (pObj)
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
//}
|
||||
//return true;
|
||||
return false;
|
||||
if (m_iObjectId != 0)
|
||||
{
|
||||
CECObject pObj = EC_ManMessageMono.Instance.GetObject(m_iObjectId, 0);
|
||||
if (pObj)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public A3DVECTOR3? GetMovePos()
|
||||
{
|
||||
A3DVECTOR3 vMovePos;
|
||||
CECObject pObject = EC_ManMessageMono.Instance.GetObject(m_iObjectId, 0);
|
||||
if (pObject)
|
||||
{
|
||||
if (GPDataTypeHelper.ISPLAYERID(m_iObjectId))
|
||||
{
|
||||
if (m_iObjectId == m_pHost.GetCharacterID())
|
||||
{
|
||||
vMovePos = m_pHost.GetPos();
|
||||
}
|
||||
else
|
||||
{
|
||||
vMovePos = (pObject as EC_ElsePlayer).GetServerPos();
|
||||
}
|
||||
}
|
||||
else if (GPDataTypeHelper.ISNPCID(m_iObjectId))
|
||||
{
|
||||
vMovePos = (pObject as CECNPC).GetServerPos();
|
||||
}
|
||||
else
|
||||
{
|
||||
vMovePos = pObject.GetPos();
|
||||
}
|
||||
return vMovePos;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
// TO DO: fix later
|
||||
//public virtual A3DVECTOR3 GetMovePos();
|
||||
|
||||
public int GetObjectID()
|
||||
{
|
||||
@@ -96,7 +128,7 @@ abstract class CECTracedObject
|
||||
|
||||
float fMaxCut = m_bMoreClose ? -1.0f : 1.0f;
|
||||
|
||||
CECObject pObject = g_pGame->GetGameRun()->GetWorld()->GetObject(m_iObjectId, 0);
|
||||
CECObject pObject = EC_ManMessageMono.Instance.GetObject(m_iObjectId, 0);
|
||||
|
||||
float fTouchRadius = 0.0f;
|
||||
if (GPDataTypeHelper.ISPLAYERID(m_iObjectId))
|
||||
@@ -107,7 +139,7 @@ abstract class CECTracedObject
|
||||
}
|
||||
else
|
||||
{
|
||||
CECPlayer pPlayer = pObject as CECPlayer;
|
||||
EC_Player pPlayer = pObject.GetComponent<CECHostPlayer>();
|
||||
fTouchRadius = pPlayer.GetTouchRadius();
|
||||
}
|
||||
return m_pHost.CanTouchTarget(vHostPos, vTargetPos, fTouchRadius, iTouchReason, fMaxCut);
|
||||
@@ -118,21 +150,358 @@ abstract class CECTracedObject
|
||||
fTouchRadius = pNPC.GetTouchRadius();
|
||||
return m_pHost.CanTouchTarget(vHostPos, vTargetPos, fTouchRadius, iTouchReason, fMaxCut);
|
||||
}
|
||||
else if (GPDataTypeHelper.ISMATTERID(m_iObjectId))
|
||||
{
|
||||
CECMatter pMatter = (pObject) as CECMatter;
|
||||
return pMatter.CalcDist(vHostPos, true) < pMatter.GetGatherDist();
|
||||
}
|
||||
//else if (GPDataTypeHelper.ISMATTERID(m_iObjectId))
|
||||
//{
|
||||
// CECMatter pMatter = (pObject) as CECMatter;
|
||||
// return pMatter.CalcDist(vHostPos, true) < pMatter.GetGatherDist();
|
||||
//}
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public int GetTraceType();
|
||||
public CECObject GetTargetObject();
|
||||
public int GetTraceType()
|
||||
{
|
||||
return m_iTraceType;
|
||||
}
|
||||
public CECObject GetTargetObject()
|
||||
{
|
||||
return EC_ManMessageMono.Instance.GetObject(m_iObjectId, 0);
|
||||
}
|
||||
};
|
||||
|
||||
public class CECTracedNPC : CECTracedObject
|
||||
{
|
||||
protected bool m_bForceAttack;
|
||||
|
||||
class CECHPWorkTrace : CECHPWork
|
||||
public CECTracedNPC(int type, int id, CECHostPlayer pHost, int ireason, bool bForceAttack = false) : base (type, id, pHost, ireason)
|
||||
{
|
||||
m_bForceAttack = bForceAttack;
|
||||
}
|
||||
public CECTracedNPC(CECTracedNPC rhs) : base(rhs)
|
||||
{
|
||||
m_bForceAttack = rhs.m_bForceAttack;
|
||||
}
|
||||
|
||||
public override bool OnTargetMissing()
|
||||
{
|
||||
bool bRet = false;
|
||||
|
||||
if (m_iReason == CECHPWorkTrace.Trace_reason.TRACE_ATTACK)
|
||||
{
|
||||
bRet = true;
|
||||
}
|
||||
//else if (m_iReason == CECHPWorkTrace.Trace_reason.TRACE_SPELL)
|
||||
//{
|
||||
// CECSkill pSkill = m_pHost.m_pPrepSkill;
|
||||
// if (pSkill == null || pSkill.GetTargetType() != 2)
|
||||
// {
|
||||
// bRet = true;
|
||||
// m_pHost.m_pPrepSkill = null;
|
||||
// }
|
||||
//}
|
||||
return bRet;
|
||||
}
|
||||
|
||||
public override A3DVECTOR3 GetTargetPos()
|
||||
{
|
||||
return (GetTargetObject() as CECNPC).GetServerPos();
|
||||
}
|
||||
|
||||
public override bool OnTouched()
|
||||
{
|
||||
bool bActionDone = false;
|
||||
|
||||
if (GPDataTypeHelper.ISNPCID(m_iObjectId))
|
||||
{
|
||||
CECNPC pNPC = (CECNPC)GetTargetObject();
|
||||
|
||||
if (m_iReason == CECHPWorkTrace.Trace_reason.TRACE_TALK)
|
||||
{
|
||||
if ((!m_pHost.IsInBattle() || m_pHost.InSameBattleCamp(pNPC)) /*&&
|
||||
!g_pGame.GetGameRun().GetUIManager().GetInGameUIMan().GetDialog("Win_SkillAction").IsShow()*/)
|
||||
{
|
||||
UnityGameSession.c2s_CmdNPCSevHello(m_iObjectId);
|
||||
bActionDone = true;
|
||||
//a_LogOutput(1, "[NormalATK]- CECTracedNPC- OnTouched- TRACE_TALK");
|
||||
}
|
||||
}
|
||||
else if (m_iReason == CECHPWorkTrace.Trace_reason.TRACE_ATTACK)
|
||||
{
|
||||
if (m_iObjectId == m_pHost.m_idSelTarget &&
|
||||
m_pHost.AttackableJudge(m_iObjectId, m_bForceAttack) == 1)
|
||||
{
|
||||
byte byPVPMask = EC_Utility.glb_BuildPVPMask(m_bForceAttack);
|
||||
UnityGameSession.c2s_CmdNormalAttack(byPVPMask);
|
||||
m_pHost.m_bPrepareFight = true;
|
||||
bActionDone = true;
|
||||
//a_LogOutput(1, "[NormalATK]- CECTracedNPC- OnTouched- TRACE_ATTACK");
|
||||
}
|
||||
}
|
||||
//else if (m_iReason == CECHPWorkTrace.Trace_reason.TRACE_SPELL)
|
||||
//{
|
||||
// //a_LogOutput(1, "[NormalATK]- CECTracedNPC- OnTouched- TRACE_SPELL");
|
||||
// if (!m_pHost.CannotAttack())
|
||||
// {
|
||||
// if (m_pHost.CastSkill(m_iObjectId, m_bForceAttack))
|
||||
// bActionDone = true;
|
||||
// }
|
||||
// else
|
||||
// m_pHost.m_pPrepSkill = null;
|
||||
//}
|
||||
}
|
||||
return bActionDone;
|
||||
}
|
||||
|
||||
public override CECTracedObject Clone()
|
||||
{
|
||||
return new CECTracedNPC(this);
|
||||
}
|
||||
|
||||
public override bool IsTargetMissing()
|
||||
{
|
||||
if (base.IsTargetMissing())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
CECNPC pNPC = GetTargetObject() as CECNPC;
|
||||
if (pNPC.IsDead())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public class CECTracedPlayer : CECTracedObject
|
||||
{
|
||||
protected bool m_bForceAttack;
|
||||
public CECTracedPlayer(int type, int id, CECHostPlayer pHost, int ireason, bool bForceAttack = false) : base(type, id, pHost, ireason)
|
||||
{
|
||||
m_bForceAttack = bForceAttack;
|
||||
}
|
||||
public CECTracedPlayer(CECTracedPlayer rhs) : base(rhs)
|
||||
{
|
||||
m_bForceAttack = rhs.m_bForceAttack;
|
||||
}
|
||||
|
||||
public override bool OnTargetMissing()
|
||||
{
|
||||
bool bRet = false;
|
||||
|
||||
if (m_iReason == CECHPWorkTrace.Trace_reason.TRACE_ATTACK)
|
||||
{
|
||||
bRet = true;
|
||||
}
|
||||
//else if (m_iReason == CECHPWorkTrace.Trace_reason.TRACE_SPELL)
|
||||
//{
|
||||
// CECSkill pSkill = m_pHost.m_pPrepSkill;
|
||||
// if (pSkill == null || pSkill.GetTargetType() != 2)
|
||||
// {
|
||||
// bRet = true;
|
||||
// m_pHost.m_pPrepSkill = null;
|
||||
// }
|
||||
//}
|
||||
return bRet;
|
||||
}
|
||||
|
||||
public override A3DVECTOR3 GetTargetPos()
|
||||
{
|
||||
CECObject pObject = EC_ManMessageMono.Instance.GetObject(m_iObjectId, 0);
|
||||
if (m_iObjectId == m_pHost.GetCharacterID())
|
||||
{
|
||||
return m_pHost.GetPos();
|
||||
}
|
||||
else
|
||||
{
|
||||
return (pObject as EC_ElsePlayer).GetServerPos();
|
||||
}
|
||||
}
|
||||
|
||||
public override bool OnTouched()
|
||||
{
|
||||
bool bActionDone =false;
|
||||
if (GPDataTypeHelper.ISPLAYERID(m_iObjectId))
|
||||
{
|
||||
if (m_iObjectId == 0 || m_iObjectId == m_pHost.GetCharacterID())
|
||||
{
|
||||
// Handle special case
|
||||
//ASSERT(m_iReason == CECHPWorkTrace::TRACE_SPELL);
|
||||
//if (!m_pHost.CannotAttack())
|
||||
//{
|
||||
// if (m_pHost.CastSkill(m_iObjectId, m_bForceAttack, null))
|
||||
// bActionDone = true;
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// m_pHost.m_pPrepSkill = null;
|
||||
//}
|
||||
//a_LogOutput(1, "[NormalATK]- CECTracedPlayer- OnTouched- special case- TRACE_SPELL");
|
||||
return bActionDone;
|
||||
}
|
||||
if (m_iReason == CECHPWorkTrace.Trace_reason.TRACE_ATTACK)
|
||||
{
|
||||
if (m_iObjectId == m_pHost.m_idSelTarget &&
|
||||
m_pHost.AttackableJudge(m_iObjectId, m_bForceAttack) == 1)
|
||||
{
|
||||
byte byPVPMask = EC_Utility.glb_BuildPVPMask(m_bForceAttack);
|
||||
UnityGameSession.c2s_CmdNormalAttack(byPVPMask);
|
||||
m_pHost.m_bPrepareFight = true;
|
||||
bActionDone = true;
|
||||
//a_LogOutput(1, "[NormalATK]- CECTracedPlayer- OnTouched- TRACE_ATTACK");
|
||||
}
|
||||
}
|
||||
//else if (m_iReason == CECHPWorkTrace.Trace_reason.TRACE_SPELL)
|
||||
//{
|
||||
// //a_LogOutput(1, "[NormalATK]- CECTracedPlayer- OnTouched- TRACE_SPELL");
|
||||
// if (!m_pHost.CastSkill(m_iObjectId, m_bForceAttack, GetTargetObject()))
|
||||
// {
|
||||
// m_pHost.m_pPrepSkill = null;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// bActionDone = true;
|
||||
// }
|
||||
//}
|
||||
else if (m_iReason == CECHPWorkTrace.Trace_reason.TRACE_TALK)
|
||||
{
|
||||
// Visite other's booth, send hello message to him
|
||||
//a_LogOutput(1, "[NormalATK]- CECTracedPlayer- OnTouched- TRACE_TALK");
|
||||
UnityGameSession.c2s_CmdNPCSevHello(m_iObjectId);
|
||||
bActionDone = true;
|
||||
}
|
||||
}
|
||||
return bActionDone;
|
||||
}
|
||||
|
||||
public override CECTracedObject Clone()
|
||||
{
|
||||
return new CECTracedPlayer(this);
|
||||
}
|
||||
|
||||
public override bool IsTargetMissing()
|
||||
{
|
||||
if (base.IsTargetMissing())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
EC_Player pPlayer = GetTargetObject() as EC_Player;
|
||||
if (pPlayer.IsElsePlayer())
|
||||
{
|
||||
if (pPlayer.IsDead())
|
||||
{
|
||||
//if (m_iReason == CECHPWorkTrace.Trace_reason.TRACE_SPELL)
|
||||
//{
|
||||
// CECSkill pSkill = m_pHost.m_pPrepSkill;
|
||||
// if (pSkill && pSkill.GetTargetType() == 2)
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
//}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
public class CECTracedMatter : CECTracedObject
|
||||
{
|
||||
|
||||
public CECTracedMatter(int type, int id, CECHostPlayer pHost, int ireason) : base(type, id, pHost, ireason)
|
||||
{
|
||||
|
||||
}
|
||||
public CECTracedMatter(CECTracedMatter rhs) : base(rhs)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override bool OnTargetMissing()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public override A3DVECTOR3 GetTargetPos()
|
||||
{
|
||||
return GetTargetObject().GetPos();
|
||||
}
|
||||
|
||||
public override bool OnTouched()
|
||||
{
|
||||
bool bActionDone = false;
|
||||
//if (GPDataTypeHelper.ISMATTERID(m_iObjectId))
|
||||
//{
|
||||
// if (m_pHost.GetProfession() == PROF_GHOST && m_pHost.IsInvisible())
|
||||
// {
|
||||
// g_pGame.GetGameRun().AddFixedMessage(FIXMSG_CANNOT_USE_WHEN_INVISIBLE);
|
||||
// return bActionDone;
|
||||
// }
|
||||
// CECMatter* pMatter = (CECMatter*)GetTargetObject();
|
||||
|
||||
// if (m_iReason == CECHPWorkTrace::TRACE_PICKUP)
|
||||
// {
|
||||
// // Check whether we have enougth place to hold this item or money
|
||||
// a_LogOutput(1, "[NormalATK]- CECTracedMatter- OnTouched- TRACE_PICKUP");
|
||||
// if (m_pHost.CanTakeItem(pMatter.GetTemplateID(), 1))
|
||||
// {
|
||||
// // Send pickup asking and wait response command
|
||||
// g_pGame.GetGameSession().c2s_CmdPickup(m_iObjectId, pMatter.GetTemplateID());
|
||||
// bActionDone = true;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// // Print a notify message
|
||||
// g_pGame.GetGameRun().AddFixedMessage(FIXMSG_PACKISFULL);
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// { // m_iReason == TRACE_GATHER
|
||||
// int tidMatter = pMatter.GetTemplateID();
|
||||
// a_LogOutput(1, "[NormalATK]- CECTracedMatter- OnTouched- TRACE_GATHER");
|
||||
// // Check mine level requirement
|
||||
// if (m_pHost.GetBasicProps().iLevel < pMatter.GetLevelReq())
|
||||
// {
|
||||
// g_pGame.GetGameRun().AddFixedMessage(FIXMSG_LEVELTOOLOW);
|
||||
// return bActionDone;
|
||||
// }
|
||||
|
||||
// // Check whether we have a mine tool
|
||||
// int iPack, iIndex, idTool;
|
||||
// if (m_pHost.FindMineTool(tidMatter, &iPack, &iIndex, &idTool))
|
||||
// {
|
||||
// DATA_TYPE DataType;
|
||||
// const MINE_ESSENCE* pData = (const MINE_ESSENCE*)g_pGame.GetElementDataMan().get_data_ptr(pMatter.GetTemplateID(), ID_SPACE_ESSENCE, DataType);
|
||||
// if (DataType != DT_MINE_ESSENCE)
|
||||
// {
|
||||
// ASSERT(DataType == DT_MINE_ESSENCE);
|
||||
// return bActionDone;
|
||||
// }
|
||||
|
||||
// if (m_pHost.GetCoolTime(GP_CT_PLAYER_GATHER))
|
||||
// {
|
||||
// g_pGame.GetGameRun().AddFixedMessage(FIXMSG_CMD_INCOOLTIME);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// // Send gather asking and wait response command
|
||||
// g_pGame.GetGameSession().c2s_CmdGatherMaterial(m_iObjectId, iPack, iIndex, idTool, pData.task_in);
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// g_pGame.GetGameRun().AddFixedMessage(FIXMSG_NEEDTOOL);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
return bActionDone;
|
||||
}
|
||||
|
||||
public override CECTracedObject Clone()
|
||||
{
|
||||
return new CECTracedMatter(this);
|
||||
}
|
||||
};
|
||||
public class CECHPWorkTrace : CECHPWork
|
||||
{
|
||||
// Trace reason
|
||||
public static class Trace_reason
|
||||
@@ -145,90 +514,417 @@ class CECHPWorkTrace : CECHPWork
|
||||
TRACE_GATHER = 4; // Gather object
|
||||
}
|
||||
// Constructor and Destructor
|
||||
public CECHPWorkTrace(CECHPWorkMan pWorkMan)
|
||||
public CECHPWorkTrace(CECHPWorkMan pWorkMan) : base(Host_work_ID.WORK_TRACEOBJECT, pWorkMan)
|
||||
{
|
||||
m_dwMask = Work_mask.MASK_TRACEOBJECT;
|
||||
m_dwTransMask = Work_mask.MASK_STAND | Work_mask.MASK_MOVETOPOS | Work_mask.MASK_FLYOFF | Work_mask.MASK_FREEFALL |
|
||||
Work_mask.MASK_FOLLOW | Work_mask.MASK_USEITEM;
|
||||
|
||||
}
|
||||
Reset();
|
||||
}
|
||||
|
||||
// Change trace target
|
||||
//void ChangeTarget(int idTarget, int iReason, bool bUseAutoPF=false);
|
||||
// 设定traceobject
|
||||
public void SetTraceTarget(CECTracedObject pTraceObj, bool bUseAutoPF = false)
|
||||
{
|
||||
ResetUseAutoPF(bUseAutoPF);
|
||||
if (!pTraceObj.GetTargetObject() || pTraceObj.GetObjectID() == m_pHost.GetCharacterID())
|
||||
{
|
||||
// This is special case
|
||||
ReplaceTarget(pTraceObj);
|
||||
return;
|
||||
}
|
||||
int idTarget = pTraceObj.GetObjectID();
|
||||
if (!GPDataTypeHelper.ISPLAYERID(idTarget) && !GPDataTypeHelper.ISNPCID(idTarget) && !GPDataTypeHelper.ISMATTERID(idTarget))
|
||||
{
|
||||
return;
|
||||
}
|
||||
CECObject pObject = pTraceObj.GetTargetObject();
|
||||
if (!pObject)
|
||||
{
|
||||
//delete pTraceObj;
|
||||
return;
|
||||
}
|
||||
ReplaceTarget(pTraceObj);
|
||||
if (m_pTraceObject.GetTargetObject())
|
||||
{
|
||||
A3DVECTOR3 vDirH = pTraceObj.GetTargetPos() - m_pHost.GetPos();
|
||||
vDirH.y = 0.0f;
|
||||
vDirH.Normalize();
|
||||
m_vCurDirH = !vDirH.IsZero() ? vDirH : m_vCurDirH = GPDataTypeHelper.g_vAxisZ;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
CECTracedObject CreatTraceTarget(int iTraceObjId, int iReason, bool bForceAttack = false);
|
||||
public CECTracedObject CreatTraceTarget(int iTraceObjId, int iReason, bool bForceAttack = false)
|
||||
{
|
||||
if (GPDataTypeHelper.ISPLAYERID(iTraceObjId))
|
||||
{
|
||||
return new CECTracedPlayer(TraceObjectType.TRACE_PLAYER, iTraceObjId, m_pHost, iReason, bForceAttack);
|
||||
}
|
||||
else if (GPDataTypeHelper.ISNPCID(iTraceObjId))
|
||||
{
|
||||
return new CECTracedNPC(TraceObjectType.TRACE_NPC, iTraceObjId, m_pHost, iReason, bForceAttack);
|
||||
}
|
||||
//else if (GPDataTypeHelper.ISMATTERID(iTraceObjId))
|
||||
//{
|
||||
// return new CECTracedMatter(TraceObjectType.TRACE_MATTER, iTraceObjId, m_pHost, iReason);
|
||||
//}
|
||||
return null;
|
||||
}
|
||||
|
||||
// Tick routine
|
||||
virtual bool Tick(DWORD dwDeltaTime);
|
||||
public virtual bool Tick(float dwDeltaTime)
|
||||
{
|
||||
base.Tick(dwDeltaTime);
|
||||
|
||||
CheckPrepSkill();
|
||||
|
||||
UpdateResetUseAutoPF();
|
||||
UpdateUseAutoPF();
|
||||
|
||||
// m_bFinished flag may be set both in OnFirstTick() and CheckPrepSkill(),
|
||||
// so check it here !
|
||||
if (m_bFinished)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (m_pTraceObject.IsTargetMissing())
|
||||
{
|
||||
OnTargetMissing();
|
||||
return true;
|
||||
}
|
||||
|
||||
if (m_bCheckTouch)
|
||||
{
|
||||
if (IsGoodTimeToTouch())
|
||||
{
|
||||
if (m_pTraceObject.CanTouchFrom(m_pHost.GetPos()))
|
||||
{
|
||||
OnTouchTarget();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
m_bCheckTouch = true;
|
||||
|
||||
if (!m_pHost.IsRooting())
|
||||
{
|
||||
// Continue tracing object
|
||||
float fDeltaTime = dwDeltaTime /** 0.001f*/;
|
||||
if (m_pHost.m_iMoveEnv == EC_Player.Move_environment.MOVEENV_GROUND)
|
||||
{
|
||||
// Play appropriate actions
|
||||
if (!m_pHost.IsJumping() && !m_pHost.IsPlayingAction((int)EC_Player.PLAYER_ACTION_TYPE.ACT_TRICK_RUN) &&
|
||||
m_pHost.m_iMoveMode != (int)MoveMode.MOVE_SLIDE)
|
||||
{
|
||||
int iAction = m_pHost.GetMoveStandAction(true);
|
||||
m_pHost.PlayAction(iAction, false, 200, false);
|
||||
}
|
||||
|
||||
Trace_Walk(fDeltaTime);
|
||||
}
|
||||
else // (m_pHost.m_iMoveEnv == CECPlayer::MOVEENV_AIR || m_pHost.m_iMoveEnv == CECPlayer::MOVEENV_WATER)
|
||||
{
|
||||
m_pHost.ResetJump();
|
||||
|
||||
// Play appropriate actions
|
||||
int iAction = m_pHost.GetMoveStandAction(true);
|
||||
m_pHost.PlayAction(iAction, false, 200, false);
|
||||
|
||||
Trace_FlySwim(fDeltaTime);
|
||||
}
|
||||
|
||||
m_bHaveMoved = true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
// Reset work
|
||||
virtual void Reset();
|
||||
public override void Reset()
|
||||
{
|
||||
base.Reset();
|
||||
|
||||
m_bHaveMoved = false;
|
||||
m_bMeetSlide = false;
|
||||
m_bCheckTouch = true;
|
||||
m_bReadyCancel = false;
|
||||
m_bMoreClose = false;
|
||||
//m_pPrepSkill = null;
|
||||
m_bForceAttack = false;
|
||||
m_bActionDone = false;
|
||||
ClearResetUseAutoPF();
|
||||
m_bUseAutoPF = false;
|
||||
m_dwAutoPFNextCheckTime = 0;
|
||||
m_pTraceObject = null;
|
||||
}
|
||||
// Work is cancel
|
||||
virtual void Cancel();
|
||||
public override void Cancel()
|
||||
{
|
||||
//if (m_pHost.m_pPrepSkill && m_pTraceObject.GetTraceReason() == Trace_reason.TRACE_SPELL)
|
||||
// m_pHost.m_pPrepSkill = null;
|
||||
|
||||
ClearResetUseAutoPF();
|
||||
if (GetUseAutoPF())
|
||||
{
|
||||
SetUseAutoPF(false);
|
||||
}
|
||||
//m_pHost.StopModelMove();
|
||||
base.Cancel();
|
||||
|
||||
//AP_ActionEvent(m_bActionDone ? AP_EVENT_TRACEOK : AP_EVENT_MOVEFINISHED, m_pTraceObject.GetTraceReason());
|
||||
}
|
||||
|
||||
// This work is do player moving ?
|
||||
virtual bool IsMoving() { return true; }
|
||||
public override bool IsMoving() { return true; }
|
||||
// Copy work data
|
||||
virtual bool CopyData(CECHPWork* pWork);
|
||||
public override bool CopyData(CECHPWork pWork)
|
||||
{
|
||||
if (!base.CopyData(pWork))
|
||||
return false;
|
||||
|
||||
CECHPWorkTrace pSrc = (CECHPWorkTrace)pWork;
|
||||
|
||||
m_bHaveMoved = pSrc.m_bHaveMoved;
|
||||
m_bMeetSlide = pSrc.m_bMeetSlide;
|
||||
m_bCheckTouch = pSrc.m_bCheckTouch;
|
||||
m_bReadyCancel = pSrc.m_bReadyCancel;
|
||||
m_bMoreClose = pSrc.m_bMoreClose;
|
||||
m_vCurDirH = pSrc.m_vCurDirH;
|
||||
//m_pPrepSkill = pSrc.m_pPrepSkill;
|
||||
m_bForceAttack = pSrc.m_bForceAttack;
|
||||
m_bActionDone = pSrc.m_bActionDone;
|
||||
m_bShouldResetUseAutoPF = pSrc.m_bShouldResetUseAutoPF;
|
||||
m_bUseAutoPFResetValue = pSrc.m_bUseAutoPFResetValue;
|
||||
m_bUseAutoPF = pSrc.m_bUseAutoPF;
|
||||
m_dwAutoPFNextCheckTime = pSrc.m_dwAutoPFNextCheckTime;
|
||||
|
||||
//delete m_pTraceObject;
|
||||
m_pTraceObject = pSrc.m_pTraceObject.Clone();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// User press cancel button
|
||||
void PressCancel();
|
||||
public void PressCancel()
|
||||
{
|
||||
m_bReadyCancel = true;
|
||||
//if (m_pTraceObject.GetTraceReason() == TRACE_SPELL)
|
||||
// m_pHost.m_pPrepSkill = NULL;
|
||||
}
|
||||
// Set move close flag
|
||||
void SetMoveCloseFlag(bool bMoveClose) { m_pTraceObject->SetMoveCloseFlag(bMoveClose); }
|
||||
public void SetMoveCloseFlag(bool bMoveClose) { m_pTraceObject.SetMoveCloseFlag(bMoveClose); }
|
||||
|
||||
// Set / Get force attack flag
|
||||
void SetForceAttack(bool bTrue) { m_bForceAttack = bTrue; }
|
||||
bool GetForceAttack() { return m_bForceAttack; }
|
||||
// Set / Get prepared skill
|
||||
void SetPrepSkill(CECSkill* pSkill) { m_pPrepSkill = pSkill; }
|
||||
CECSkill* GetPrepSkill() { return m_pPrepSkill; }
|
||||
// Get target ID
|
||||
int GetTarget() { return m_pTraceObject->GetObjectID(); }
|
||||
// Get trace reason
|
||||
int GetTraceReason() { return m_pTraceObject->GetTraceReason(); }
|
||||
// AutoPF
|
||||
void SetUseAutoPF(bool bUse);
|
||||
bool GetUseAutoPF()const;
|
||||
bool IsAutoPF()const;
|
||||
// Set / Get force attack flag
|
||||
public void SetForceAttack(bool bTrue) { m_bForceAttack = bTrue; }
|
||||
public bool GetForceAttack() { return m_bForceAttack; }
|
||||
// Set / Get prepared skill
|
||||
public void SetPrepSkill(CECSkill pSkill) { /*m_pPrepSkill = pSkill;*/ }
|
||||
public CECSkill GetPrepSkill() { /*return m_pPrepSkill;*/ return null; }
|
||||
// Get target ID
|
||||
public int GetTarget() { return m_pTraceObject.GetObjectID(); }
|
||||
// Get trace reason
|
||||
public int GetTraceReason() { return m_pTraceObject.GetTraceReason(); }
|
||||
// AutoPF
|
||||
public void SetUseAutoPF(bool bUse)
|
||||
{
|
||||
m_bUseAutoPF = bUse;
|
||||
//if (!m_bUseAutoPF && CECIntelligentRoute.Instance().IsUsageTrace())
|
||||
//{
|
||||
// CECIntelligentRoute.Instance().ResetSearch();
|
||||
//}
|
||||
}
|
||||
public bool GetUseAutoPF()
|
||||
{
|
||||
return m_bUseAutoPF;
|
||||
}
|
||||
public bool IsAutoPF()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void SetActionDone(bool bActionDone) { m_bActionDone = bActionDone; }
|
||||
public void SetActionDone(bool bActionDone) { m_bActionDone = bActionDone; }
|
||||
|
||||
void OnTargetMissing();
|
||||
public void OnTargetMissing()
|
||||
{
|
||||
StopMove(true);
|
||||
if ((m_pTraceObject.GetTraceType() == TraceObjectType.TRACE_NPC) || (m_pTraceObject.GetTraceType() == TraceObjectType.TRACE_PLAYER))
|
||||
{
|
||||
m_pTraceObject.OnTargetMissing();
|
||||
}
|
||||
//else if (m_pTraceObject.GetTraceReason() == Trace_reason.TRACE_SPELL)
|
||||
//{
|
||||
// m_pHost.m_pPrepSkill = null;
|
||||
//}
|
||||
}
|
||||
|
||||
void OnTouchTarget();
|
||||
bool CanTouch();
|
||||
public void OnTouchTarget()
|
||||
{
|
||||
StopMove(true);
|
||||
m_bActionDone = m_pTraceObject.OnTouched();
|
||||
}
|
||||
public bool CanTouch()
|
||||
{
|
||||
//CECSkill pPrepSkill = m_pHost.m_pPrepSkill;
|
||||
CheckPrepSkill();
|
||||
bool result = m_pTraceObject.CanTouchFrom(m_pHost.GetPos());
|
||||
//m_pHost.m_pPrepSkill = pPrepSkill;
|
||||
return result;
|
||||
}
|
||||
// Attributes
|
||||
|
||||
protected: // Attributes
|
||||
protected bool m_bHaveMoved; // Have moved flag
|
||||
protected bool m_bMeetSlide; // true, meet slide
|
||||
protected bool m_bCheckTouch; // Check whether touch target in this frame
|
||||
protected A3DVECTOR3 m_vCurDirH; // Current move direction
|
||||
protected bool m_bReadyCancel; // true, ready to cancel
|
||||
protected bool m_bMoreClose; // Move close flag
|
||||
protected bool m_bForceAttack; // Force attack flag
|
||||
protected CECSkill m_pPrepSkill; // Skill prepared to be casted
|
||||
protected bool m_bActionDone; // 目标行为成功发出
|
||||
protected bool m_bShouldResetUseAutoPF;
|
||||
protected bool m_bUseAutoPFResetValue;
|
||||
protected bool m_bUseAutoPF; // Use CECIntelligentRoute::Search
|
||||
protected uint m_dwAutoPFNextCheckTime; // 下次检查时间
|
||||
|
||||
bool m_bHaveMoved; // Have moved flag
|
||||
bool m_bMeetSlide; // true, meet slide
|
||||
bool m_bCheckTouch; // Check whether touch target in this frame
|
||||
A3DVECTOR3 m_vCurDirH; // Current move direction
|
||||
bool m_bReadyCancel; // true, ready to cancel
|
||||
bool m_bMoreClose; // Move close flag
|
||||
bool m_bForceAttack; // Force attack flag
|
||||
CECSkill* m_pPrepSkill; // Skill prepared to be casted
|
||||
bool m_bActionDone; // 目标行为成功发出
|
||||
bool m_bShouldResetUseAutoPF;
|
||||
bool m_bUseAutoPFResetValue;
|
||||
bool m_bUseAutoPF; // Use CECIntelligentRoute::Search
|
||||
DWORD m_dwAutoPFNextCheckTime; // 下次检查时间
|
||||
protected CECTracedObject m_pTraceObject; // 定义trace目标对象
|
||||
|
||||
CECTracedObject* m_pTraceObject; // 定义trace目标对象
|
||||
// Operations
|
||||
|
||||
protected: // Operations
|
||||
// On first tick
|
||||
protected virtual void OnFirstTick()
|
||||
{
|
||||
m_pHost.m_iMoveMode = (int)MoveMode.MOVE_MOVE;
|
||||
m_bHaveMoved = false;
|
||||
}
|
||||
|
||||
// On first tick
|
||||
virtual void OnFirstTick();
|
||||
// Trace on ground
|
||||
protected bool Trace_Walk(float fDeltaTime)
|
||||
{
|
||||
A3DVECTOR3 vCurPos = m_pHost.GetPos();
|
||||
A3DVECTOR3 vTargetPos = GetCurMovingDest();
|
||||
CDR_INFO cdr = m_pHost.m_CDRInfo;
|
||||
|
||||
// Trace on ground
|
||||
bool Trace_Walk(float fDeltaTime);
|
||||
if (m_pHost.m_iMoveMode == (int)MoveMode.MOVE_SLIDE)
|
||||
{
|
||||
m_pHost.PlayAction((int)EC_Player.PLAYER_ACTION_TYPE.ACT_JUMP_LOOP, false, 200, false);
|
||||
|
||||
// This will cause stop moming after we slide down.
|
||||
A3DVECTOR3 vDir = vTargetPos - vCurPos;
|
||||
vDir.y = 0;
|
||||
vDir.Normalize();
|
||||
|
||||
float fMaxSpeedV = 0f;
|
||||
m_bMeetSlide = m_pHost.m_MoveCtrl.MeetSlope(vDir, fMaxSpeedV);
|
||||
EC_Utility.a_ClampFloor(cdr.fYVel, -fMaxSpeedV);
|
||||
|
||||
if (!vDir.IsZero())
|
||||
m_vCurDirH = vDir;
|
||||
|
||||
vCurPos = m_pHost.m_MoveCtrl.GroundMove(m_vCurDirH, m_pHost.GetGroundSpeed(), fDeltaTime);
|
||||
if (m_pHost.m_MoveCtrl.MoveBlocked() >= 3)
|
||||
{
|
||||
m_pHost.m_MoveCtrl.SetSlideLock(true);
|
||||
m_pHost.m_MoveCtrl.SendStopMoveCmd(EC_Utility.ToVector3(vCurPos), m_pHost.GetGroundSpeed(), (int)GPMoveMode.GP_MOVE_SLIDE);
|
||||
m_bFinished = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_pHost.SetPos(EC_Utility.ToVector3(vCurPos));
|
||||
//if (GetUseAutoPF() && CECIntelligentRoute::Instance().IsMoveOn())
|
||||
//{
|
||||
// CECIntelligentRoute::Instance().OnPlayerPosChange(vCurPos);
|
||||
//}
|
||||
m_pHost.m_MoveCtrl.SendMoveCmd(vCurPos, 2, GPDataTypeHelper.g_vOrigin, EC_Utility.ToA3DVECTOR3(cdr.vAbsVelocity), (int)GPMoveMode.GP_MOVE_SLIDE);
|
||||
}
|
||||
}
|
||||
else if (!m_bMeetSlide)
|
||||
{
|
||||
int iMoveMode = m_pHost.m_bWalkRun ? (int)GPMoveMode.GP_MOVE_RUN : (int)GPMoveMode.GP_MOVE_WALK;
|
||||
if (m_pHost.IsJumping())
|
||||
iMoveMode = (int)GPMoveMode.GP_MOVE_JUMP;
|
||||
else if (!m_pHost.m_GndInfo.bOnGround)
|
||||
iMoveMode = (int)GPMoveMode.GP_MOVE_FALL;
|
||||
|
||||
if (m_pHost.m_GndInfo.bOnGround)
|
||||
{
|
||||
if (m_bReadyCancel)
|
||||
{
|
||||
StopMove(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Ajust direction only when player on ground
|
||||
A3DVECTOR3 vDirH = vTargetPos - vCurPos;
|
||||
A3DVECTOR3 v = A3DFuncs.a3d_Normalize(vDirH);
|
||||
if (Math.Abs(v.y) > 0.9848f)
|
||||
{
|
||||
PressCancel();
|
||||
return true;
|
||||
}
|
||||
|
||||
vDirH.y = 0.0f;
|
||||
vDirH.Normalize();
|
||||
if (!vDirH.IsZero())
|
||||
m_vCurDirH = vDirH;
|
||||
}
|
||||
|
||||
vCurPos = m_pHost.m_MoveCtrl.GroundMove(m_vCurDirH, m_pHost.GetGroundSpeed(), fDeltaTime, m_pHost.m_fVertSpeed);
|
||||
m_pHost.SetPos(EC_Utility.ToVector3(vCurPos));
|
||||
//if (GetUseAutoPF() && CECIntelligentRoute::Instance().IsMoveOn())
|
||||
//{
|
||||
// CECIntelligentRoute::Instance().OnPlayerPosChange(vCurPos);
|
||||
//}
|
||||
|
||||
if (cdr.vTPNormal == Vector3.zero)
|
||||
m_bCheckTouch = false;
|
||||
|
||||
//if (!m_vCurDirH.IsZero())
|
||||
//{
|
||||
// m_pHost.StartModelMove(m_vCurDirH, g_vAxisY, 0);
|
||||
//}
|
||||
|
||||
if (m_pHost.m_MoveCtrl.MoveBlocked() >= 3)
|
||||
{
|
||||
// m_pHost.m_MoveCtrl.SendStopMoveCmd(vCurPos, m_pHost.GetGroundSpeed(), iMoveMode);
|
||||
PressCancel();
|
||||
}
|
||||
else
|
||||
m_pHost.m_MoveCtrl.SendMoveCmd(vCurPos, 0, vTargetPos, EC_Utility.ToA3DVECTOR3(cdr.vAbsVelocity), iMoveMode);
|
||||
}
|
||||
else // m_bMeetSlide == true
|
||||
{
|
||||
if (m_bHaveMoved)
|
||||
m_pHost.m_MoveCtrl.SendStopMoveCmd(EC_Utility.ToVector3(vCurPos), m_pHost.GetGroundSpeed(), (int)GPMoveMode.GP_MOVE_SLIDE);
|
||||
|
||||
m_bFinished = true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
// Trace in air and water
|
||||
bool Trace_FlySwim(float fDeltaTime);
|
||||
public bool Trace_FlySwim(float fDeltaTime)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// Stop move when touch target
|
||||
void StopMove(bool bFinish);
|
||||
// Stop move when touch target
|
||||
public void StopMove(bool bFinish)
|
||||
{
|
||||
// If 'trace' work was transfered from a work which
|
||||
// needs moving (such as 'move to' work) and we touch the target
|
||||
// immediately (m_bHaveMoved = false), we must need to send 'stop move'
|
||||
// command
|
||||
if (m_bHaveMoved || !m_pHost.m_MoveCtrl.IsStop())
|
||||
m_pHost.m_MoveCtrl.SendStopMoveCmd();
|
||||
|
||||
m_pHost.m_vVelocity.Clear();
|
||||
//m_pHost.StopModelMove();
|
||||
|
||||
if (bFinish)
|
||||
{
|
||||
m_bFinished = true;
|
||||
}
|
||||
}
|
||||
// Handle the case that target died when host is tracing it
|
||||
bool OnTargetDied(CECObject* pTarget);
|
||||
// Is valid time to touch target ?
|
||||
@@ -239,7 +935,7 @@ bool GetTargetCurPos(A3DVECTOR3 &pos);
|
||||
A3DVECTOR3 GetCurMovingDest();
|
||||
void UpdateUseAutoPF();
|
||||
|
||||
void ReplaceTarget(CECTracedObject* ptraceobj);
|
||||
void ReplaceTarget(CECTracedObject ptraceobj);
|
||||
|
||||
void ResetUseAutoPF(bool bUseAutoPF);
|
||||
void UpdateResetUseAutoPF();
|
||||
|
||||
@@ -23,6 +23,7 @@ namespace PerfectWorld.Scripts.Managers
|
||||
Dictionary<int, int> m_UkPlayerTab = new Dictionary<int, int>();
|
||||
Dictionary<int, EC_ElsePlayer> m_PlayerTab = new Dictionary<int, EC_ElsePlayer>();
|
||||
private readonly object m_csPlayerTab = new object();
|
||||
CECHostPlayer m_pHostPlayer;
|
||||
public int HandlerId => (int)MANAGER_INDEX.MAN_PLAYER;
|
||||
public bool ProcessMessage(ECMSG Msg)
|
||||
{
|
||||
@@ -468,6 +469,20 @@ namespace PerfectWorld.Scripts.Managers
|
||||
return true;
|
||||
}
|
||||
|
||||
// Get a player (may be host or else player) by id
|
||||
public EC_Player GetPlayer(int cid, uint dwBornStamp = 0)
|
||||
{
|
||||
CECHostPlayer pHost = GetHostPlayer();
|
||||
if (pHost && pHost.GetCharacterID() == cid)
|
||||
return pHost;
|
||||
else
|
||||
return GetElsePlayer(cid, dwBornStamp);
|
||||
}
|
||||
|
||||
public CECHostPlayer GetHostPlayer()
|
||||
{
|
||||
return GameController.Instance.GetHostPlayer();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -186,8 +186,8 @@ public class CECObject : MonoBehaviour
|
||||
|
||||
protected int m_iCID; // Class ID
|
||||
protected bool m_bAdjustOrient; // Is adjusting orientation
|
||||
protected A3DQUATERNION m_quOrientStart; // Orientation start
|
||||
protected A3DQUATERNION m_quOrientEnd; // Orientation end
|
||||
//protected A3DQUATERNION m_quOrientStart; // Orientation start
|
||||
//protected A3DQUATERNION m_quOrientEnd; // Orientation end
|
||||
protected float m_dwOrientTime; // Orientation adjusting time counter
|
||||
protected uint m_dwOrientTimeCnt; // Orientation adjusting time counter
|
||||
|
||||
@@ -201,16 +201,31 @@ public class CECObject : MonoBehaviour
|
||||
|
||||
protected bool m_bSelectable; // whether the object can be selected
|
||||
|
||||
public inline const A3DVECTOR3& GetGroundNormal()const { return m_vecGroundNormal; }
|
||||
public inline bool GetUseGroundNormal()const { return m_bUseGroundNormal; }
|
||||
public A3DVECTOR3 GetGroundNormal(){ return m_vecGroundNormal; }
|
||||
public bool GetUseGroundNormal(){ return m_bUseGroundNormal; }
|
||||
|
||||
public void SetUseGroundNormal(bool bFlag)
|
||||
{
|
||||
//if (m_bUseGroundNormal == bFlag)
|
||||
// return;
|
||||
|
||||
//m_bUseGroundNormal = bFlag;
|
||||
//if (m_bUseGroundNormal)
|
||||
//{
|
||||
// // now reset dir and up to make the object show correct pose
|
||||
// SetDirAndUp(GetDir(), GetUp());
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// // now reset dir and up to make the player show correct pose
|
||||
// A3DVECTOR3 vLeft = CrossProduct(GetDir(), g_vAxisY);
|
||||
// A3DVECTOR3 vDir = Normalize(CrossProduct(g_vAxisY, vLeft));
|
||||
// SetDirAndUp(vDir, g_vAxisY);
|
||||
//}
|
||||
}
|
||||
public void SetGroundNormal(A3DVECTOR3 vecNormal)
|
||||
{
|
||||
|
||||
m_vecGroundNormalSet = vecNormal;
|
||||
}
|
||||
|
||||
protected void AdjustOrientation(float dwDeltaTime)
|
||||
|
||||
@@ -43,6 +43,7 @@ public class CECNPC : CECObject
|
||||
protected static CECStringTab m_ActionNames;
|
||||
|
||||
|
||||
|
||||
public virtual void SetUpCECNPC(CECNPCMan pNPCMan)
|
||||
{
|
||||
base.SetUpCECObject();
|
||||
@@ -866,6 +867,38 @@ public class CECNPC : CECObject
|
||||
public int vis_tid;// template id for shape
|
||||
};
|
||||
public const float MAX_LAGDIST = 25.0f;
|
||||
|
||||
// Get NPC's real position on server
|
||||
public A3DVECTOR3 GetServerPos()
|
||||
{
|
||||
return EC_Utility.ToA3DVECTOR3(m_vServerPos);
|
||||
}
|
||||
|
||||
// Get master id
|
||||
public int GetMasterID() { return m_idMaster; }
|
||||
// Is monster in invader camp in battle ?
|
||||
public virtual bool IsInBattleInvaderCamp() { return false; }
|
||||
// Is monster in defender camp in battle ?
|
||||
public virtual bool IsInBattleDefenderCamp() { return false; }
|
||||
// Get role in battle
|
||||
public virtual int GetRoleInBattle() { return 0; }
|
||||
public int GetOwnerFaction(){ return m_idOwnerFaction; }
|
||||
|
||||
public bool IsFactionPVPMineCar()
|
||||
{
|
||||
//if (const MONSTER_ESSENCE* pMonsterEssence = GetMonsterEssence()){
|
||||
// return (pMonsterEssence.faction & (1 << 19)) != 0;
|
||||
//}
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool IsFactionPVPMineBase()
|
||||
{
|
||||
//if (const MONSTER_ESSENCE *pMonsterEssence = GetMonsterEssence()){
|
||||
// return (pMonsterEssence->faction & (1 << 20)) != 0;
|
||||
//}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
public enum WorkType
|
||||
{
|
||||
|
||||
@@ -4,6 +4,7 @@ using CSNetwork;
|
||||
using PerfectWorld.Scripts.Managers.BrewMonster.Managers;
|
||||
using BrewMonster.Network;
|
||||
using UnityEngine.SceneManagement;
|
||||
using CSNetwork.GPDataType;
|
||||
|
||||
namespace BrewMonster
|
||||
{
|
||||
@@ -48,5 +49,35 @@ namespace BrewMonster
|
||||
{
|
||||
EC_ManMessage.Tick();
|
||||
}
|
||||
|
||||
// Get object by specified ID
|
||||
// iAliveFlag: 0, both alive and dead; 1, must be alive; 2, must be dead
|
||||
public CECObject GetObject(int idObject, int iAliveFlag)
|
||||
{
|
||||
CECObject pObject = null;
|
||||
|
||||
if (GPDataTypeHelper.ISNPCID(idObject))
|
||||
{
|
||||
if (!(pObject = _CECNPCMan.GetNPC(idObject)))
|
||||
return null;
|
||||
|
||||
if ((iAliveFlag == 1 && (pObject as CECNPC).IsDead()) ||
|
||||
(iAliveFlag == 2 && !(pObject as CECNPC).IsDead()))
|
||||
return null;
|
||||
}
|
||||
else if (GPDataTypeHelper.ISPLAYERID(idObject))
|
||||
{
|
||||
if (!(pObject = EC_ManPlayer.GetPlayer(idObject)))
|
||||
return null;
|
||||
|
||||
if ((iAliveFlag == 1 && (pObject as EC_Player).IsDead()) ||
|
||||
(iAliveFlag == 2 && !(pObject as EC_Player).IsDead()))
|
||||
return null;
|
||||
}
|
||||
//else if (GPDataTypeHelper.ISMATTERID(idObject))
|
||||
// pObject = GetMatterMan()->GetMatter(idObject);
|
||||
|
||||
return pObject;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -166,6 +166,16 @@ namespace BrewMonster.Network
|
||||
}
|
||||
}
|
||||
|
||||
public static void c2s_CmdNPCSevHello(int nid)
|
||||
{
|
||||
Instance._gameSession.c2s_SendCmdNPCSevHello(nid);
|
||||
}
|
||||
|
||||
public static void c2s_CmdNormalAttack(byte byPVPMask)
|
||||
{
|
||||
Instance._gameSession.c2s_CmdNormalAttack(byPVPMask);
|
||||
}
|
||||
|
||||
#region Task
|
||||
public static void c2s_CmdGetAllData(bool byPack, bool byEquip, bool byTask)
|
||||
{
|
||||
|
||||
@@ -30,9 +30,9 @@ namespace PerfectWorld.Scripts.Player
|
||||
int m_iGender; // Gender
|
||||
float m_fScaleBySkill = 1f;
|
||||
MOVECONST m_MoveConst; // Const used when moving control
|
||||
int m_iMoveEnv; // Move environment
|
||||
bool m_bWalkRun; // Walk-run switch, 0-walk, 1-run
|
||||
int m_iMoveMode; // Player's move mode
|
||||
//int m_iMoveEnv; // Move environment
|
||||
//bool m_bWalkRun; // Walk-run switch, 0-walk, 1-run
|
||||
//int m_iMoveMode; // Player's move mode
|
||||
|
||||
public MOVECONST[] aMoveConsts = new MOVECONST[PROFESSION.NUM_PROFESSION * GENDER.NUM_GENDER]
|
||||
{
|
||||
@@ -454,70 +454,8 @@ namespace PerfectWorld.Scripts.Player
|
||||
return result;
|
||||
}
|
||||
|
||||
private int GetMoveStandAction(bool bMove, bool bFight = false)
|
||||
{
|
||||
int iMoveEnv = m_iMoveEnv;
|
||||
//if (m_AttachMode != enumAttachNone)
|
||||
//{
|
||||
// bFight = false;
|
||||
// if (m_bHangerOn)
|
||||
// iMoveEnv = MOVEENV_GROUND;
|
||||
//}
|
||||
|
||||
int iAction = (int)PLAYER_ACTION_TYPE.ACT_STAND;
|
||||
|
||||
if (bMove)
|
||||
{
|
||||
// Play appropriate actions
|
||||
if (iMoveEnv == (int)MoveEnvironment.MOVEENV_GROUND)
|
||||
{
|
||||
if (m_bWalkRun)
|
||||
iAction = (int)PLAYER_ACTION_TYPE.ACT_RUN;
|
||||
else
|
||||
iAction = (int)PLAYER_ACTION_TYPE.ACT_WALK;
|
||||
}
|
||||
//else if (iMoveEnv == MOVEENV_AIR)
|
||||
//{
|
||||
// //if (/*UsingWing()*/ m_wingType == WINGTYPE_WING)
|
||||
// // iAction = ACT_FLY;
|
||||
// //else
|
||||
// // iAction = ACT_FLY_SWORD;
|
||||
//}
|
||||
//else if (iMoveEnv == MOVEENV_WATER)
|
||||
//{
|
||||
// //if (CanCombineWithMoveForSkill())
|
||||
// //{
|
||||
// // iAction = ACT_SWIM_FOR_MOVESKILL;
|
||||
// //}
|
||||
// //else
|
||||
// //{
|
||||
// // iAction = ACT_SWIM;
|
||||
// //}
|
||||
//}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Play appropriate actions
|
||||
if (iMoveEnv == (int)MoveEnvironment.MOVEENV_GROUND)
|
||||
{
|
||||
if (bFight)
|
||||
iAction = (int)PLAYER_ACTION_TYPE.ACT_FIGHTSTAND;
|
||||
else
|
||||
iAction = (int)PLAYER_ACTION_TYPE.ACT_STAND;
|
||||
}
|
||||
//else if (iMoveEnv == MOVEENV_AIR)
|
||||
//{
|
||||
// if (/*UsingWing()*/ m_wingType == WINGTYPE_WING)
|
||||
// iAction = ACT_HANGINAIR;
|
||||
// else
|
||||
// iAction = ACT_HANGINAIR_SWORD;
|
||||
//}
|
||||
//else if (iMoveEnv == MOVEENV_WATER)
|
||||
// iAction = ACT_HANGINWATER;
|
||||
}
|
||||
|
||||
return iAction;
|
||||
}
|
||||
// Get player's real position on server
|
||||
public A3DVECTOR3 GetServerPos() { return m_vServerPos; }
|
||||
|
||||
//public A3DVECTOR3 GetPos()
|
||||
//{
|
||||
|
||||
Reference in New Issue
Block a user