Add look up NPC info

This commit is contained in:
HungDK
2026-01-09 15:12:31 +07:00
parent de05bf76af
commit 156e61c3d7
@@ -502,6 +502,25 @@ public class CECNPCMan : IMsgHandler
return npc;
}
// Find first NPC/Monster by template id (tid). Used by UI auto-move coordinate resolving.
// 通过模板ID(tid)查找第一个NPC/怪物。用于UI自动寻路坐标解析。
public CECNPC FindNPCByTemplateID(int tid)
{
if (tid == 0) return null;
foreach (var npc in m_NPCTab.Values)
{
if (!npc) continue;
var info = npc.GetNPCInfo();
if (info.tid == tid || info.vis_tid == tid)
{
return npc;
}
}
return null;
}
public CECNPC GetNPCFromAll(int nid)
{
CECNPC pNPC = GetNPC(nid);