From 156e61c3d7fb42b0dd7e824ce4412fe55136baea Mon Sep 17 00:00:00 2001 From: HungDK <> Date: Fri, 9 Jan 2026 15:12:31 +0700 Subject: [PATCH] Add look up NPC info --- .../Scripts/Managers/CECNPCMan.cs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/Assets/PerfectWorld/Scripts/Managers/CECNPCMan.cs b/Assets/PerfectWorld/Scripts/Managers/CECNPCMan.cs index 01f82e888a..4539c8ad88 100644 --- a/Assets/PerfectWorld/Scripts/Managers/CECNPCMan.cs +++ b/Assets/PerfectWorld/Scripts/Managers/CECNPCMan.cs @@ -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);