259 lines
7.4 KiB
C#
259 lines
7.4 KiB
C#
using BrewMonster.Managers;
|
|
using BrewMonster.Network;
|
|
using BrewMonster.Scripts;
|
|
using BrewMonster.UI;
|
|
using CSNetwork.GPDataType;
|
|
using PerfectWorld.Scripts.Managers;
|
|
using UnityEngine;
|
|
using static BrewMonster.Scripts.CECHPWork;
|
|
using static BrewMonster.CECHPWorkTrace;
|
|
|
|
namespace BrewMonster
|
|
{
|
|
public partial class CECHostPlayer
|
|
{
|
|
public bool GetWalkRunFlag() => m_bWalkRun;
|
|
public bool GetRushFlyFlag() => m_bRushFly;
|
|
|
|
CECCounter m_BindCmdCoolCnt = new CECCounter();
|
|
|
|
public CECCounter GetBindCmdCoolCnt() => m_BindCmdCoolCnt;
|
|
|
|
void InitBindCmdCoolCnt()
|
|
{
|
|
m_BindCmdCoolCnt.SetPeriod(35000);
|
|
m_BindCmdCoolCnt.Reset(true);
|
|
}
|
|
|
|
// Sit down / Stand up
|
|
// 坐下 / 站起
|
|
public bool CmdSitDown(bool bSitDown)
|
|
{
|
|
if (!CanDo(ActionCanDo.CANDO_SITDOWN))
|
|
return false;
|
|
|
|
if (bSitDown)
|
|
UnityGameSession.c2s_CmdSitDown();
|
|
else
|
|
UnityGameSession.c2s_CmdStandUp();
|
|
|
|
return true;
|
|
}
|
|
|
|
// Switch walk and run state
|
|
// 切换走/跑状态
|
|
public bool CmdWalkRun(bool bRun)
|
|
{
|
|
m_bWalkRun = bRun;
|
|
return true;
|
|
}
|
|
|
|
// Find a near target (stub)
|
|
// 寻找附近目标(占位)
|
|
public bool CmdFindTarget()
|
|
{
|
|
return true;
|
|
}
|
|
|
|
// Select other player's attacked target
|
|
// 选择队友正在攻击的目标
|
|
public bool CmdAssistAttack()
|
|
{
|
|
if (m_pWorkMan.IsSitting())
|
|
{
|
|
UnityGameSession.c2s_CmdStandUp();
|
|
return false;
|
|
}
|
|
|
|
if (CanDo(ActionCanDo.CANDO_ASSISTSEL))
|
|
UnityGameSession.c2s_CmdTeamAssistSel(m_idSelTarget);
|
|
|
|
return true;
|
|
}
|
|
|
|
// Invite selected player to join team
|
|
// 邀请选中的玩家入队
|
|
public bool CmdInviteToTeam()
|
|
{
|
|
if (IsDead() || !GPDataTypeHelper.ISPLAYERID(m_idSelTarget) || m_idSelTarget == GetCharacterID())
|
|
return false;
|
|
|
|
UnityGameSession.c2s_CmdTeamInvite(m_idSelTarget);
|
|
return true;
|
|
}
|
|
|
|
// Leave current team (confirmation dialog)
|
|
// 离开当前队伍(确认框)
|
|
public bool CmdLeaveTeam()
|
|
{
|
|
if (IsDead() || m_pTeam == null)
|
|
return false;
|
|
|
|
string szMsg = CECUIManager.Instance?.GetInGameUIMan()?.GetStringFromTable(235)
|
|
?? "Are you sure you want to leave the team?";
|
|
CECUIManager.Instance?.ShowMessageBoxYesAndNo("", szMsg, null,
|
|
() => UnityGameSession.c2s_CmdTeamLeaveParty(), null);
|
|
return true;
|
|
}
|
|
|
|
// Kick one member of team (stub)
|
|
// 踢出队员(占位)
|
|
public bool CmdKickTeamMember()
|
|
{
|
|
return true;
|
|
}
|
|
|
|
// Search for a team (stub)
|
|
// 寻找队伍(占位)
|
|
public bool CmdFindTeam()
|
|
{
|
|
return true;
|
|
}
|
|
|
|
// Start trade with other selected player
|
|
// 与选中玩家开始交易
|
|
public bool CmdStartTrade()
|
|
{
|
|
if (m_pWorkMan.IsSitting())
|
|
{
|
|
UnityGameSession.c2s_CmdStandUp();
|
|
return false;
|
|
}
|
|
|
|
if (!CanDo(ActionCanDo.CANDO_TRADE))
|
|
return false;
|
|
|
|
if (!GPDataTypeHelper.ISPLAYERID(m_idSelTarget) || m_idSelTarget == m_PlayerInfo.cid)
|
|
return false;
|
|
|
|
UnityGameSession.trade_Start(m_idSelTarget);
|
|
return true;
|
|
}
|
|
|
|
// Open booth for selling items
|
|
// 开摊出售
|
|
public bool CmdSellBooth()
|
|
{
|
|
if (IsInvisible())
|
|
{
|
|
CECGameRun.Instance?.AddFixedMessage((int)FixedMsg.FIXMSG_CANNOT_USE_WHEN_INVISIBLE);
|
|
return false;
|
|
}
|
|
|
|
if (m_pWorkMan.IsSitting())
|
|
{
|
|
UnityGameSession.c2s_CmdStandUp();
|
|
return false;
|
|
}
|
|
|
|
if (m_pWorkMan.IsFollowing())
|
|
m_pWorkMan.FinishAllWork(true);
|
|
|
|
if (!CanDo(ActionCanDo.CANDO_BOOTH))
|
|
return false;
|
|
|
|
UnityGameSession.c2s_CmdOpenBoothTest();
|
|
return true;
|
|
}
|
|
|
|
// Open booth for buying items (stub)
|
|
// 开摊收购(占位)
|
|
public bool CmdBuyBooth()
|
|
{
|
|
return true;
|
|
}
|
|
|
|
// Invite selected player to join faction (stub)
|
|
// 邀请入帮(占位)
|
|
public bool CmdInviteToFaction()
|
|
{
|
|
return true;
|
|
}
|
|
|
|
/*public bool CmdPickup()
|
|
{
|
|
if (m_pWorkMan.IsSitting())
|
|
{
|
|
UnityGameSession.c2s_CmdStandUp();
|
|
return false;
|
|
}
|
|
|
|
if (!CanDo(ActionCanDo.CANDO_PICKUP))
|
|
return false;
|
|
|
|
CECHPWork pWork = m_pWorkMan.GetWork(Host_work_ID.WORK_TRACEOBJECT);
|
|
if (pWork is CECHPWorkTrace pTrace &&
|
|
pTrace.GetTraceReason() == Trace_reason.TRACE_PICKUP)
|
|
return true;
|
|
|
|
EC_ManMatter matterMan = EC_ManMessageMono.Instance?.EC_ManMatter;
|
|
CECMatter pMatter = matterMan?.FindMatterNearHost(10.0f, true);
|
|
if (pMatter != null)
|
|
PickupObject(pMatter.GetMatterID(), false);
|
|
|
|
return true;
|
|
}*/
|
|
|
|
public bool CmdGather()
|
|
{
|
|
if (m_pWorkMan.IsSitting())
|
|
{
|
|
UnityGameSession.c2s_CmdStandUp();
|
|
return false;
|
|
}
|
|
|
|
if (!CanDo(ActionCanDo.CANDO_GATHER))
|
|
return false;
|
|
|
|
CECHPWork pWork = m_pWorkMan.GetWork(Host_work_ID.WORK_TRACEOBJECT);
|
|
if (pWork is CECHPWorkTrace pTrace &&
|
|
pTrace.GetTraceReason() == Trace_reason.TRACE_GATHER)
|
|
return true;
|
|
|
|
PickupObject(m_idSelTarget, true);
|
|
return true;
|
|
}
|
|
|
|
public bool CmdRushFly()
|
|
{
|
|
if (m_bAboutToDie || IsDead() || !IsFlying())
|
|
return false;
|
|
|
|
UnityGameSession.c2s_CmdActiveRushFly(!m_bRushFly);
|
|
return true;
|
|
}
|
|
|
|
public bool CmdBindBuddy(int idTarget)
|
|
{
|
|
if (!m_BindCmdCoolCnt.IsFull())
|
|
{
|
|
CECGameRun.Instance?.AddFixedMessage((int)FixedMsg.FIXMSG_CMD_INCOOLTIME);
|
|
return false;
|
|
}
|
|
|
|
if (!CanDo(ActionCanDo.CANDO_BINDBUDDY) || !GPDataTypeHelper.ISPLAYERID(idTarget) ||
|
|
idTarget == GetCharacterID())
|
|
return false;
|
|
|
|
EC_ElsePlayer pPlayer = m_pPlayerMan?.GetElsePlayer(idTarget);
|
|
if (pPlayer == null || pPlayer.GetGender() == GetGender())
|
|
return false;
|
|
|
|
A3DVECTOR3 vDist = pPlayer.GetServerPos() - GetPos();
|
|
if (vDist.Magnitude() >= 2.8f)
|
|
{
|
|
CECGameRun.Instance?.AddFixedMessage((int)FixedMsg.FIXMSG_TARGETISFAR);
|
|
return false;
|
|
}
|
|
|
|
if (GetGender() == GENDER.GENDER_MALE)
|
|
UnityGameSession.c2s_CmdBindPlayerInvite(idTarget);
|
|
else
|
|
UnityGameSession.c2s_CmdBindPlayerRequest(idTarget);
|
|
|
|
m_BindCmdCoolCnt.Reset();
|
|
return true;
|
|
}
|
|
}
|
|
}
|