Files
test/Assets/PerfectWorld/Scripts/Objet/Shortcut/CECShortcutSet.cs
T
2025-12-13 14:12:09 +07:00

1009 lines
35 KiB
C#

/*
* FILE: CECShortcutSet.cs
*
* DESCRIPTION: Shortcut set management
*
* CREATED BY: Duyuxin, 2005/1/5
* CONVERTED TO C#: 2025
*
* HISTORY:
*
* Copyright (c) 2005 Archosaur Studio, All Rights Reserved.
*/
using BrewMonster.Assets.PerfectWorld.Scripts.Skills;
using BrewMonster.Network;
using BrewMonster.Scripts.Skills;
using CSNetwork.GPDataType;
using System;
using System.Collections.Generic;
using Unity.VisualScripting;
using UnityEngine;
namespace BrewMonster
{
/// <summary>
/// Manages a set of shortcuts for quick access to items, skills, commands, etc.
/// </summary>
public class CECShortcutSet
{
#region Fields
private List<CECShortcut> m_aShortcuts; // Shortcut array
#endregion
#region Constructor and Destructor
public CECShortcutSet()
{
m_aShortcuts = new List<CECShortcut>();
}
#endregion
#region Initialization and Release
/// <summary>
/// Initialize the shortcut set with a specified size
/// </summary>
/// <param name="iSize">Number of shortcut slots</param>
/// <returns>True if successful</returns>
public bool Init(int iSize)
{
m_aShortcuts = new List<CECShortcut>(iSize);
for (int i = 0; i < iSize; i++)
{
m_aShortcuts.Add(null);
}
return true;
}
/// <summary>
/// Release all shortcuts and clear the set
/// </summary>
public void Release()
{
// Clear all shortcuts
for (int i = 0; i < m_aShortcuts.Count; i++)
{
if (m_aShortcuts[i] != null)
{
// In C#, we don't need explicit deletion, just clear references
m_aShortcuts[i] = null;
}
}
m_aShortcuts.Clear();
}
#endregion
#region Shortcut Creation Methods
/// <summary>
/// Create an item shortcut at specified position
/// </summary>
/* public bool CreateItemShortcut(int iSlot, int iIvtr, int iIvtrSlot, CECIvtrItem pItem)
{
CECSCItem pItemSC = new CECSCItem();
if (pItemSC == null)
return false;
if (!pItemSC.Init(iIvtr, iIvtrSlot, pItem))
{
Debug.LogError("CECShortcutSet::CreateItemShortcut, Failed to initialize item shortcut");
return false;
}
SetShortcut(iSlot, pItemSC);
return true;
}*/
/// <summary>
/// Create a skill shortcut at specified position
/// </summary>
public bool CreateSkillShortcut(int iSlot, CECSkill pSkill)
{
CECSCSkill pSkillSC = new CECSCSkill();
if (pSkillSC == null)
return false;
if (!pSkillSC.Init(pSkill))
{
Debug.LogError("CECShortcutSet::CreateSkillShortcut, Failed to initialize skill shortcut");
return false;
}
SetShortcut(iSlot, pSkillSC);
return true;
}
/// <summary>
/// Create a skill group shortcut at specified position
/// </summary>
/* public bool CreateSkillGroupShortcut(int iSlot, int iGroupIdx)
{
CECSCSkillGrp pSkillGrpSC = new CECSCSkillGrp();
if (pSkillGrpSC == null)
return false;
if (!pSkillGrpSC.Init(iGroupIdx))
{
Debug.LogError("CECShortcutSet::CreateSkillGroupShortcut, Failed to initialize skill group shortcut");
return false;
}
SetShortcut(iSlot, pSkillGrpSC);
return true;
}*/
/// <summary>
/// Create a pet shortcut at specified position
/// </summary>
/* public bool CreatePetShortcut(int iSlot, int iPetIndex)
{
CECSCPet pPetSC = new CECSCPet();
if (pPetSC == null)
return false;
if (!pPetSC.Init(iPetIndex))
{
Debug.LogError("CECShortcutSet::CreatePetShortcut, Failed to initialize pet shortcut");
return false;
}
SetShortcut(iSlot, pPetSC);
return true;
}*/
/// <summary>
/// Create an auto fashion shortcut at specified position
/// </summary>
/* public bool CreateAutoFashionShortcut(int iSlot, int iFashionIdx)
{
CECSCAutoFashion pAutoFashionSC = new CECSCAutoFashion();
if (pAutoFashionSC == null)
return false;
if (!pAutoFashionSC.Init(iFashionIdx))
{
Debug.LogError("CECShortcutSet::CreateAutoFashionShortcut, Failed to initialize auto fashion shortcut");
return false;
}
SetShortcut(iSlot, pAutoFashionSC);
return true;
}
/// <summary>
/// Create a system module shortcut at specified position
/// </summary>
public bool CreateSystemModuleShortcut(int iSlot, int iSys)
{
CECSCSysModule pSysModule = new CECSCSysModule();
if (pSysModule == null)
return false;
if (!pSysModule.Init(iSys))
{
Debug.LogError("CECShortcutSet::CreateSystemModuleShortcut, Failed to initialize system module shortcut");
return false;
}
SetShortcut(iSlot, pSysModule);
return true;
}*/
/// <summary>
/// Duplicate a shortcut to specified position
/// </summary>
/* public bool CreateClonedShortcut(int iSlot, CECShortcut pShortcut)
{
CECShortcut pDest = pShortcut.Clone();
if (pDest == null)
return false;
SetShortcut(iSlot, pDest);
return true;
}*/
#endregion
#region Shortcut Management
/// <summary>
/// Put a shortcut into set and return the old shortcut at that position
/// </summary>
/// <param name="iSlot">Slot index</param>
/// <param name="pShortcut">Shortcut to place</param>
/// <returns>Previous shortcut at that position</returns>
public CECShortcut PutShortcut(int iSlot, CECShortcut pShortcut)
{
if (iSlot < 0 || iSlot >= m_aShortcuts.Count)
return null;
CECShortcut pOldShortcut = m_aShortcuts[iSlot];
m_aShortcuts[iSlot] = pShortcut;
return pOldShortcut;
}
/// <summary>
/// Get a shortcut from set
/// </summary>
/// <param name="iSlot">Slot index</param>
/// <param name="bRemove">If true, remove the shortcut from the set</param>
/// <returns>Shortcut at the specified position</returns>
public CECShortcut GetShortcut(int iSlot, bool bRemove = false)
{
if (iSlot < 0 || iSlot >= m_aShortcuts.Count)
return null;
CECShortcut pShortcut = m_aShortcuts[iSlot];
if (bRemove)
m_aShortcuts[iSlot] = null;
return pShortcut;
}
/// <summary>
/// Set a shortcut into set and release old shortcut at this position automatically
/// </summary>
public void SetShortcut(int iSlot, CECShortcut pShortcut)
{
if (iSlot < 0 || iSlot >= m_aShortcuts.Count)
return;
// Clear old shortcut (C# garbage collection will handle cleanup)
if (m_aShortcuts[iSlot] != null)
{
m_aShortcuts[iSlot] = null;
}
m_aShortcuts[iSlot] = pShortcut;
}
/// <summary>
/// Exchange shortcuts in two slots
/// </summary>
public void ExchangeShortcut(int iSlot1, int iSlot2)
{
if (iSlot1 < 0 || iSlot1 >= m_aShortcuts.Count ||
iSlot2 < 0 || iSlot2 >= m_aShortcuts.Count)
return;
if (iSlot1 != iSlot2)
{
CECShortcut pShortcut = m_aShortcuts[iSlot1];
m_aShortcuts[iSlot1] = m_aShortcuts[iSlot2];
m_aShortcuts[iSlot2] = pShortcut;
}
}
/// <summary>
/// Remove all shortcuts
/// </summary>
public void RemoveAllShortcuts()
{
for (int i = 0; i < m_aShortcuts.Count; i++)
{
if (m_aShortcuts[i] != null)
{
m_aShortcuts[i] = null;
}
}
}
/// <summary>
/// Remove skill and skill group shortcuts
/// </summary>
public void RemoveSkillShortcuts()
{
for (int i = 0; i < m_aShortcuts.Count; i++)
{
CECShortcut pSC = m_aShortcuts[i];
if (pSC == null)
continue;
if (pSC.GetType() == (int)CECShortcut.ShortcutType.SCT_SKILL ||
pSC.GetType() == (int)CECShortcut.ShortcutType.SCT_SKILLGRP)
{
m_aShortcuts[i] = null;
}
}
}
#endregion
#region Update Methods
/// <summary>
/// Update item shortcut when item position changed
/// </summary>
/* public void UpdateMovedItemSC(int tidItem, int iSrcIvtr, int iSrcSlot, int iDstIvtr, int iDstSlot)
{
for (int i = 0; i < m_aShortcuts.Count; i++)
{
CECShortcut pSC = m_aShortcuts[i];
if (pSC == null || pSC.GetType() != CECShortcut.ShortcutType.SCT_ITEM)
continue;
CECSCItem pItemSC = (CECSCItem)pSC;
if (pItemSC.GetInventory() == iSrcIvtr && pItemSC.GetIvtrSlot() == iSrcSlot)
{
Debug.Assert(pItemSC.GetItemTID() == tidItem);
pItemSC.MoveItem(iDstIvtr, iDstSlot);
}
}
}*/
/// <summary>
/// Update item shortcut when item removed
/// </summary>
/* public void UpdateRemovedItemSC(int tidItem, int iIvtr, int iSlot, int iSameItem)
{
for (int i = 0; i < m_aShortcuts.Count; i++)
{
CECShortcut pSC = m_aShortcuts[i];
if (pSC == null || pSC.GetType() != CECShortcut.ShortcutType.SCT_ITEM)
continue;
CECSCItem pItemSC = (CECSCItem)pSC;
if (pItemSC.GetInventory() == iIvtr && pItemSC.GetIvtrSlot() == iSlot)
{
Debug.Assert(pItemSC.GetItemTID() == tidItem);
if (pItemSC.GetAutoFindFlag() && iSameItem >= 0)
pItemSC.MoveItem(iIvtr, iSameItem);
else
SetShortcut(i, null);
}
}
}*/
/// <summary>
/// Update item shortcut when two items exchanged
/// </summary>
/*public void UpdateExchangedItemSC(int tidItem1, int iIvtr1, int iSlot1,
int tidItem2, int iIvtr2, int iSlot2)
{
for (int i = 0; i < m_aShortcuts.Count; i++)
{
CECShortcut pSC = m_aShortcuts[i];
if (pSC == null || pSC.GetType() != CECShortcut.ShortcutType.SCT_ITEM)
continue;
CECSCItem pItemSC = (CECSCItem)pSC;
if (pItemSC.GetInventory() == iIvtr1 && pItemSC.GetIvtrSlot() == iSlot1)
{
Debug.Assert(pItemSC.GetItemTID() == tidItem1);
pItemSC.MoveItem(iIvtr2, iSlot2);
}
else if (pItemSC.GetInventory() == iIvtr2 && pItemSC.GetIvtrSlot() == iSlot2)
{
Debug.Assert(pItemSC.GetItemTID() == tidItem2);
pItemSC.MoveItem(iIvtr1, iSlot1);
}
}
}
/// <summary>
/// Update pet shortcut when pet freed
/// </summary>
public void UpdateFreedPetSC(int iPetIndex)
{
for (int i = 0; i < m_aShortcuts.Count; i++)
{
CECShortcut pSC = m_aShortcuts[i];
if (pSC == null || pSC.GetType() != CECShortcut.ShortcutType.SCT_PET)
continue;
CECSCPet pPetSC = (CECSCPet)pSC;
if (pPetSC.GetPetIndex() == iPetIndex)
SetShortcut(i, null);
}
}*/
#endregion
#region Skill Management
/// <summary>
/// Replace skill id in skill shortcuts
/// </summary>
public void ReplaceSkillID(int idOld, CECSkill pNewSkill)
{
for (int i = 0; i < m_aShortcuts.Count; i++)
{
CECShortcut pSC = m_aShortcuts[i];
if (pSC == null || pSC.GetType() != (int)CECShortcut.ShortcutType.SCT_SKILL)
continue;
// Replace skill
CECSCSkill pSkillSC = (CECSCSkill)pSC;
CECSkill pSkill = pSkillSC.GetSkill();
if (pSkill.GetSkillID() == idOld)
pSkillSC.SetSkill(pNewSkill);
}
}
/// <summary>
/// Replace skill id in skill shortcuts using skill array
/// </summary>
public void ReplaceSkillID(SkillArrayWrapper skillArray, CECSkill pNewSkill)
{
for (int i = 0; i < skillArray.Count(); i++)
{
ReplaceSkillID((int)skillArray[i], pNewSkill);
}
}
/// <summary>
/// Remove skill shortcut by skill ID
/// </summary>
public bool RemoveSkillShortcut(int idSkill)
{
bool bRemove = false;
for (int i = 0; i < GetShortcutNum(); i++)
{
CECShortcut pSC = GetShortcut(i);
if (pSC == null)
continue;
if (pSC.GetType() == (int)CECShortcut.ShortcutType.SCT_SKILL)
{
CECSCSkill pSkillSC = (CECSCSkill)pSC;
CECSkill pSkill = pSkillSC.GetSkill();
if (pSkill != null && pSkill.GetSkillID() == idSkill)
{
SetShortcut(i, null);
bRemove = true;
continue;
}
}
}
return bRemove;
}
#endregion
#region Serialization
/// <summary>
/// Save shortcut configs to specified buffer
/// </summary>
public bool SaveConfigData(out byte[] dataBuffer)
{
List<byte> data = new List<byte>();
for (int i = 0; i < m_aShortcuts.Count; i++)
{
CECShortcut pSC = m_aShortcuts[i];
if (pSC == null)
continue;
// Record shortcut's position and type
data.AddRange(BitConverter.GetBytes(i));
data.AddRange(BitConverter.GetBytes((int)pSC.GetType()));
switch ((CECShortcut.ShortcutType)pSC.GetType())
{
/* case CECShortcut.ShortcutType.SCT_COMMAND:
{
CECSCCommand cmdSC = (CECSCCommand)pSC;
data.AddRange(BitConverter.GetBytes(cmdSC.GetCommandID()));
data.AddRange(BitConverter.GetBytes((int)cmdSC.GetParam()));
break;
}
*/
case CECShortcut.ShortcutType.SCT_SKILL:
{
CECSCSkill skillSC = (CECSCSkill)pSC;
data.AddRange(BitConverter.GetBytes(skillSC.GetSkill().GetSkillID()));
break;
}
/* case CECShortcut.ShortcutType.SCT_ITEM:
{
CECSCItem itemSC = (CECSCItem)pSC;
data.AddRange(BitConverter.GetBytes(itemSC.GetInventory()));
data.AddRange(BitConverter.GetBytes(itemSC.GetIvtrSlot()));
data.AddRange(BitConverter.GetBytes(itemSC.GetItemTID()));
break;
}
case CECShortcut.ShortcutType.SCT_SKILLGRP:
{
CECSCSkillGrp skillGrpSC = (CECSCSkillGrp)pSC;
data.AddRange(BitConverter.GetBytes(skillGrpSC.GetGroupIndex()));
break;
}
case CECShortcut.ShortcutType.SCT_PET:
{
CECSCPet petSC = (CECSCPet)pSC;
data.AddRange(BitConverter.GetBytes(petSC.GetPetIndex()));
break;
}
case CECShortcut.ShortcutType.SCT_AUTOFASHION:
{
CECSCAutoFashion fashionSC = (CECSCAutoFashion)pSC;
data.AddRange(BitConverter.GetBytes(fashionSC.GetAutoFashionIndex()));
break;
}
case CECShortcut.ShortcutType.SCT_SYSMODULE:
{
CECSCSysModule sysSC = (CECSCSysModule)pSC;
data.AddRange(BitConverter.GetBytes(sysSC.GetSysModID()));
break;
}*/
default:
Debug.LogError("CECShortcutSet::SaveConfigData - Unknown shortcut type");
break;
}
}
// Add the end flag
data.AddRange(BitConverter.GetBytes(-1));
dataBuffer = data.ToArray();
return true;
}
/// <summary>
/// Load shortcut configs from specified buffer
/// </summary>
public bool LoadConfigData(byte[] pDataBuf, uint dwVer, ref int offset)
{
if (pDataBuf == null || pDataBuf.Length == 0)
{
return false;
}
CECGameRun pGameRun = EC_Game.GetGameRun();
CECHostPlayer pHost = pGameRun.GetHostPlayer();
Debug.Assert(pHost != null);
while (offset < pDataBuf.Length)
{
int iSlot = GPDataTypeHelper.FromBytes<int>(pDataBuf, offset);
offset += sizeof(int);
if (iSlot < 0)
break; // Meet end flag
int iSCType = GPDataTypeHelper.FromBytes<int>(pDataBuf, offset);
offset += sizeof(int);
switch ((CECShortcut.ShortcutType)iSCType)
{
/*case CECShortcut.ShortcutType.SCT_COMMAND:
{
int iCommand = BitConverter.ToInt32(pDataBuf, offset);
offset += sizeof(int);
int iParam = 0;
if (dwVer >= 2)
{
iParam = BitConverter.ToInt32(pDataBuf, offset);
offset += sizeof(int);
}
CECSCCommand pCmdSC = null;
if (iCommand == CECSCCommand.CMD_PLAYPOSE)
pCmdSC = pGameRun.GetPoseCmdShortcut(iParam);
else
pCmdSC = pGameRun.GetCmdShortcut(iCommand);
if (pCmdSC != null)
CreateClonedShortcut(iSlot, pCmdSC);
break;
}*/
case CECShortcut.ShortcutType.SCT_SKILL:
{
int idSkill = BitConverter.ToInt32(pDataBuf, offset);
offset += sizeof(int);
CECSkill pSkill = pHost.GetPositiveSkillByID(idSkill, true);
if (pSkill == null)
pSkill = pHost.GetEquipSkillByID(idSkill);
CECSkill pSkill2 = null;
/* CECHostGoblin pGoblin = (CECHostGoblin)pHost.GetGoblinModel();
if (pGoblin != null)
{
pSkill2 = pGoblin.GetSkillByID(idSkill);
}*/
if (pSkill != null)
CreateSkillShortcut(iSlot, pSkill);
else if (pSkill2 != null)
CreateSkillShortcut(iSlot, pSkill2);
break;
}
/* case CECShortcut.ShortcutType.SCT_ITEM:
{
int iPack = BitConverter.ToInt32(pDataBuf, offset);
offset += sizeof(int);
int iIvtrSlot = BitConverter.ToInt32(pDataBuf, offset);
offset += sizeof(int);
int idItem = BitConverter.ToInt32(pDataBuf, offset);
offset += sizeof(int);
CECInventory pPack = pHost.GetPack(iPack);
if (pPack == null)
{
Debug.LogError("CECShortcutSet::LoadConfigData - Invalid inventory");
return false;
}
CECIvtrItem pItem = pPack.GetItem(iIvtrSlot);
if (pItem != null)
CreateItemShortcut(iSlot, iPack, iIvtrSlot, pItem);
break;
}
case CECShortcut.ShortcutType.SCT_SKILLGRP:
{
if (dwVer >= 3)
{
int iGroupIdx = BitConverter.ToInt32(pDataBuf, offset);
offset += sizeof(int);
if (iGroupIdx >= 0)
CreateSkillGroupShortcut(iSlot, iGroupIdx);
}
else
{
Debug.LogError("CECShortcutSet::LoadConfigData - Invalid version for skill group");
return false;
}
break;
}
case CECShortcut.ShortcutType.SCT_PET:
{
if (dwVer >= 4)
{
int iPetIndex = BitConverter.ToInt32(pDataBuf, offset);
offset += sizeof(int);
if (iPetIndex >= 0)
CreatePetShortcut(iSlot, iPetIndex);
}
else
{
Debug.LogError("CECShortcutSet::LoadConfigData - Invalid version for pet");
return false;
}
break;
}
case CECShortcut.ShortcutType.SCT_AUTOFASHION:
{
if (dwVer >= 5)
{
int iAutoFashionIndex = BitConverter.ToInt32(pDataBuf, offset);
offset += sizeof(int);
if (iAutoFashionIndex >= 0)
CreateAutoFashionShortcut(iSlot, iAutoFashionIndex);
}
else
{
Debug.LogError("CECShortcutSet::LoadConfigData - Invalid version for auto fashion");
return false;
}
break;
}
case CECShortcut.ShortcutType.SCT_SYSMODULE:
{
if (dwVer > 10)
{
int iSys = BitConverter.ToInt32(pDataBuf, offset);
offset += sizeof(int);
if (iSys >= 0)
CreateSystemModuleShortcut(iSlot, iSys);
}
else
{
Debug.LogError("CECShortcutSet::LoadConfigData - Invalid version for system module");
return false;
}
break;
}*/
/* default:
//TODO: uncomment
//BMLogger.LogError("CECShortcutSet::LoadConfigData - Unknown shortcut type");
return false;*/
}
}
return true;
}
#endregion
#region Properties
/// <summary>
/// Get the number of shortcuts in the set
/// </summary>
public int GetShortcutNum()
{
return m_aShortcuts.Count;
}
#endregion
}
#region Placeholder Classes
// These classes are referenced but not defined in the provided files
// They should be implemented separately based on EC_Shortcut.h/cpp
public class CECShortcut
{
protected int m_iSCType;
public CECShortcut() { m_iSCType = (int)ShortcutType.SCT_UNKNOWN; }
public enum ShortcutType
{
SCT_UNKNOWN = -1,
SCT_SKILL = 0,
SCT_ITEM,
SCT_COMMAND,
SCT_SKILLGRP,
SCT_PET,
SCT_AUTOFASHION,
SCT_SYSMODULE,
}
public virtual int GetType()
{
return m_iSCType;
}
public virtual CECShortcut Clone()
{
return new CECShortcut();
}
public virtual bool Execute() { return true; }
}
public class CECSCCommand : CECShortcut
{
private int m_iCommand; // Command ID
private uint m_dwParam; // Parameter
public enum CommandID
{
CMD_UNKNOWN = -1,
CMD_SITDOWN = 0,
CMD_WALKRUN,
CMD_NORMALATTACK,
CMD_FINDTARGET,
CMD_ASSISTATTACK,
CMD_INVITETOTEAM,
CMD_LEAVETEAM,
CMD_KICKTEAMMEM,
CMD_FINDTEAM,
CMD_STARTTRADE,
CMD_SELLBOOTH,
CMD_BUYBOOTH,
CMD_PLAYPOSE,
CMD_INVITETOFACTION,
CMD_FLY,
CMD_PICKUP,
CMD_GATHER,
CMD_RUSHFLY,
CMD_BINDBUDDY,
}
public CECSCCommand(int iCommand)
{
m_iSCType = (int)ShortcutType.SCT_COMMAND;
m_iCommand = iCommand;
m_dwParam = 0;
}
public CECSCCommand(CECSCCommand src)
{
m_iCommand = src.m_iCommand;
m_dwParam = src.m_dwParam;
}
public const int CMD_PLAYPOSE = 1; // Example constant
// public override ShortcutType GetType() => ShortcutType.SCT_COMMAND;
public override CECShortcut Clone() => new CECSCCommand(this);
public int GetCommandID() => 0;
public int GetParam() => 0;
// Set / Get command parameter
public void SetParam(uint dwParam) { m_dwParam = dwParam; }
// Execute shortcut
public override bool Execute()
{
CECHostPlayer pHost = CECGameRun.Instance.GetHostPlayer();
if (!pHost || !pHost.IsAllResReady())
return false;
// if (GetCoolTime(0)>0)
// {
// bool bForbidCmd = true;
// if (m_iCommand == CMD_RUSHFLY && pHost.GetRushFlyFlag())
// bForbidCmd = false;
//
// if (bForbidCmd)
// {
// g_pGame->GetGameRun()->AddFixedMessage(FIXMSG_CMD_INCOOLTIME);
// return false;
// }
// }
switch (m_iCommand)
{
// case CMD_SITDOWN: pHost->CmdSitDown(!pHost->IsSitting()); break;
// case CMD_WALKRUN: pHost->CmdWalkRun(!pHost->GetWalkRunFlag()); break;
// case CMD_NORMALATTACK: pHost->CmdNormalAttack(); break;
// case CMD_FINDTARGET: pHost->CmdFindTarget(); break;
// case CMD_ASSISTATTACK: pHost->CmdAssistAttack(); break;
// case CMD_INVITETOTEAM: pHost->CmdInviteToTeam(); break;
// case CMD_LEAVETEAM: pHost->CmdLeaveTeam(); break;
// case CMD_KICKTEAMMEM: pHost->CmdKickTeamMember(); break;
// case CMD_FINDTEAM: pHost->CmdFindTeam(); break;
// case CMD_STARTTRADE: pHost->CmdStartTrade(); break;
// case CMD_SELLBOOTH: pHost->CmdSellBooth(); break;
// case CMD_BUYBOOTH: pHost->CmdBuyBooth(); break;
case (int)CommandID.CMD_PLAYPOSE: pHost.CmdStartPose((int)m_dwParam); break;
// case CMD_INVITETOFACTION: pHost->CmdInviteToFaction(); break;
// case CMD_FLY:
// {
// // Èç¹ûÆï³ËÒª·ÉÐУ¬ÔòÕâЩ action switcher£¬·ñÔò CmdFly
// if (!pHost->GetActionSwitcher() || !pHost->GetActionSwitcher()->OnRideToFlyAction())
// pHost->CmdFly();
// break;
// }
// case CMD_PICKUP: pHost->CmdPickup(); break;
// case CMD_GATHER: pHost->CmdGather(); break;
// case CMD_RUSHFLY: pHost->CmdRushFly(); break;
// case CMD_BINDBUDDY: pHost->CmdBindBuddy(pHost->GetSelectedTarget()); break;
default:
return false;
}
return true;
}
// Get item cool time
int GetCoolTime(ref int piMax/* NULL */)
{
CECHostPlayer pHost = CECGameRun.Instance.GetHostPlayer();
int iTime = 0;
switch ((CommandID)m_iCommand)
{
case CommandID.CMD_RUSHFLY:
// iTime = pHost.GetCoolTime(GP_CT_FLY_RUSH, piMax);
break;
case CommandID.CMD_PLAYPOSE:
// todo need to get cooldown here
// iTime = pHost.GetCoolTime(GP_CT_EMOTE, piMax);
break;
case CommandID.CMD_BINDBUDDY:
{
// CECCounter& cnt = pHost->GetBindCmdCoolCnt();
// iTime = cnt.GetPeriod() - cnt.GetCounter();
//
// if (piMax)
// *piMax = cnt.GetPeriod();
break;
}
default:
// if (piMax) *piMax = 0;
break;
}
return iTime;
}
}
/* public class CECSCSkill : CECShortcut
{
private CECSkill m_pSkill;
public override ShortcutType GetType() => ShortcutType.SCT_SKILL;
public override CECShortcut Clone() => null;
public bool Init(CECSkill pSkill) { m_pSkill = pSkill; return true; }
public CECSkill GetSkill() => m_pSkill;
public void SetSkill(CECSkill pSkill) { m_pSkill = pSkill; }
}
public class CECSCItem : CECShortcut
{
private int m_iInventory;
private int m_iIvtrSlot;
private int m_iItemTID;
private bool m_bAutoFind;
public override ShortcutType GetType() => ShortcutType.SCT_ITEM;
public override CECShortcut Clone() => null;
public bool Init(int iIvtr, int iSlot, CECIvtrItem pItem)
{
m_iInventory = iIvtr;
m_iIvtrSlot = iSlot;
return true;
}
public int GetInventory() => m_iInventory;
public int GetIvtrSlot() => m_iIvtrSlot;
public int GetItemTID() => m_iItemTID;
public bool GetAutoFindFlag() => m_bAutoFind;
public void MoveItem(int iIvtr, int iSlot) { m_iInventory = iIvtr; m_iIvtrSlot = iSlot; }
}*/
/* public class CECSCSkillGrp : CECShortcut
{
private int m_iGroupIdx;
public override ShortcutType GetType() => ShortcutType.SCT_SKILLGRP;
public override CECShortcut Clone() => null;
public bool Init(int iGroupIdx) { m_iGroupIdx = iGroupIdx; return true; }
public int GetGroupIndex() => m_iGroupIdx;
}
public class CECSCPet : CECShortcut
{
private int m_iPetIndex;
public override ShortcutType GetType() => ShortcutType.SCT_PET;
public override CECShortcut Clone() => null;
public bool Init(int iPetIndex) { m_iPetIndex = iPetIndex; return true; }
public int GetPetIndex() => m_iPetIndex;
}
public class CECSCAutoFashion : CECShortcut
{
private int m_iFashionIdx;
public override ShortcutType GetType() => ShortcutType.SCT_AUTOFASHION;
public override CECShortcut Clone() => null;
public bool Init(int iFashionIdx) { m_iFashionIdx = iFashionIdx; return true; }
public int GetAutoFashionIndex() => m_iFashionIdx;
}
public class CECSCSysModule : CECShortcut
{
private int m_iSysModID;
public override ShortcutType GetType() => ShortcutType.SCT_SYSMODULE;
public override CECShortcut Clone() => null;
public bool Init(int iSys) { m_iSysModID = iSys; return true; }
public int GetSysModID() => m_iSysModID;
}
// Placeholder classes for dependencies
public class CECIvtrItem { }
public class CECInventory
{
public CECIvtrItem GetItem(int slot) => null;
}
public class CECHostGoblin
{
public CECSkill GetSkillByID(int id) => null;
}*/
#endregion
}