Esempio n. 1
0
        public static void GetRegionNpcIn(Map pMap, ushort region_x, ushort region_z, ref Packet result, ref ushort t_count, ushort nEventRoom)
        {
            if (pMap == null)
            {
                return;
            }

            Region pRegion = pMap.GetRegion(region_x, region_z);

            if (pRegion == null)
            {
                return;
            }

            lock (pRegion.m_RegionNpcArray)
            {
                if (pRegion.m_RegionNpcArray.Count <= 0)
                {
                    return;
                }

                foreach (var itr in pRegion.m_RegionNpcArray.Values)
                {
                    Npc pNpc = m_NpcList.Values.Where(i => i.GetID() == itr).FirstOrDefault();
                    if (pNpc == null)
                    {
                        continue;
                    }

                    result += pNpc.GetID();
                    pNpc.GetNpcInfo(ref result);
                    t_count++;
                }
            }
        }
Esempio n. 2
0
        public void RequestNpcIn(Packet pkt)
        {
            Packet result = new Packet(WIZ.REQ_NPCIN);
            short  user_count = pkt, online_count = 0;

            if (user_count > 1000)
            {
                user_count = 1000;
            }

            Packet temp = new Packet();

            for (int i = 0; i < user_count; i++)
            {
                short ssid = pkt;
                Npc   pNpc = g_pMain.m_NpcList.Values.Where(it => it.GetID() == ssid).FirstOrDefault();
                if (pNpc == null)// || !pNpc.isInGame())
                {
                    continue;
                }

                temp = temp + pNpc.GetID();
                pNpc.GetNpcInfo(ref temp);

                online_count++;
            }
            result = result + online_count + temp;
            Send(result);
        }