69 lines
2.2 KiB
C#
69 lines
2.2 KiB
C#
using CSNetwork;
|
|
using CSNetwork.GPDataType;
|
|
using System;
|
|
using UnityEngine;
|
|
|
|
public class CECNPCMan : IMsgHandler
|
|
{
|
|
public int HandlerId => (int)MANAGER_INDEX.MAN_NPC;
|
|
|
|
public bool ProcessMessage(ECMSG Msg)
|
|
{
|
|
if (Msg.iSubID == 0)
|
|
{
|
|
switch (Msg.dwMsg)
|
|
{
|
|
case long value when value == EC_MsgDef.MSG_NM_NPCINFO: OnMsgNPCInfo(Msg); break;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
|
|
private void OnMsgNPCInfo(ECMSG msg)
|
|
{
|
|
switch (msg.dwParam2)
|
|
{
|
|
case CommandID.NPC_INFO_LIST:
|
|
{
|
|
/* cmd_npc_info_list* pCmd = (cmd_npc_info_list*)Msg.dwParam1;
|
|
BYTE* pDataBuf = &pCmd->placeholder;
|
|
|
|
for (int i = 0; i < pCmd->count; i++)
|
|
{
|
|
const info_npc&Info = *(const info_npc*)pDataBuf;
|
|
|
|
// Calculate npc info data size and skip it
|
|
int iSize = sizeof(info_npc);
|
|
if (Info.state & GP_STATE_EXTEND_PROPERTY)
|
|
iSize += sizeof(DWORD) * OBJECT_EXT_STATE_COUNT;
|
|
|
|
if (Info.state & GP_STATE_NPC_PET)
|
|
iSize += sizeof(int);
|
|
|
|
if (Info.state & GP_STATE_NPC_NAME)
|
|
{
|
|
BYTE len = *(BYTE*)(pDataBuf + iSize);
|
|
iSize += sizeof(BYTE) + len;
|
|
}
|
|
if (Info.state & GP_STATE_MULTIOBJ_EFFECT)
|
|
{
|
|
int count = *(int*)(pDataBuf + iSize);
|
|
iSize += sizeof(int);
|
|
iSize += count * (sizeof(int) + sizeof(char));
|
|
}
|
|
if (Info.state & GP_STATE_NPC_MAFIA)
|
|
{
|
|
iSize += sizeof(int);
|
|
}
|
|
|
|
a_LogOutput(1, "HoangDev: NPC_INFO_LIST, nid: %d, tid: %d, vis_tid: %d, pos: %f %f %f", Info.nid, Info.tid, Info.vis_tid, Info.pos.x, Info.pos.y, Info.pos.z);
|
|
|
|
NPCEnter(Info, false);
|
|
pDataBuf += iSize;*/
|
|
}
|
|
|
|
break;
|
|
}
|
|
}
|
|
}
|