public static void GetRegionNpcList(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++; } } }
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); }
public void Add(Npc pNpc) { lock (m_RegionNpcArray) { m_RegionNpcArray.Add(pNpc.GUID, pNpc.GetID()); } }
private void ClientEvent(short sNpcID) { int iEventID = 0; Npc pNpc = g_pMain.GetNpcPtr(sNpcID); if (pNpc == null) { return; } m_sEventNid = sNpcID; m_sEventSid = pNpc.m_sSid; // For convenience purposes with Lua scripts. if (pNpc.GetProtoID() == SAW_BLADE_SSID) { if (GetZoneID() == ZONE_CHAOS_DUNGEON) { HpChange(-5000 / 10); } else if (GetZoneID() == ZONE_KROWAZ_DOMINION) { HpChange(-370, pNpc.GetID()); } return; } else if (pNpc.GetType() == NPC_KISS) { KissUser(); return; } else if (pNpc.GetType() == NPC_ROLLINGSTONE) { HpChange(-3000, pNpc.GetID()); return; } var helpers = g_pMain.m_HelperList.Where(i => i.sNpcId == pNpc.GetProtoID()).ToList(); Database.ServerManager.QUEST_HELPER pHelper = null; foreach (var itr in helpers) { if (itr == null || itr.sEventDataIndex > 0 || itr.bEventStatus > 0 || (itr.bNation != 3 && itr.bNation != m_bNation) || (itr.bClass != 5 && itr.bClass != m_sClass)) { continue; } pHelper = itr; break; } if (pHelper == null) { return; } QuestV2RunEvent(pHelper, pHelper.nEventTriggerIndex); }