public void RequestTeleportList(L2Citizen npc, L2Player player, int groupId, int itemId) { if (!Teleports.npcs.ContainsKey(npc.Template.NpcId)) { player.ShowHtmPlain("no teleports available for you", npc); player.sendActionFailed(); return; } ab_teleport_group group = Teleports.npcs[npc.Template.NpcId].groups[groupId]; StringBuilder sb = new StringBuilder("&$556;<br><br>"); foreach (ab_teleport_entry e in group._teles.Values) { string cost = ""; int id = itemId != -1 ? itemId : e.itemId; if (player.Level >= 40) { cost = " - " + e.cost + " &#" + id + ";"; } sb.Append("<a action=\"bypass -h teleport_next?ask=" + groupId + "&reply=" + e.id + "\" msg=\"811;" + e.name + "\">" + e.name + "" + cost + "</a><br1>"); } player.TeleportPayID = itemId; player.ShowHtmPlain(sb.ToString(), npc); }
private void reload() { XElement xml = XElement.Parse(File.ReadAllText(@"scripts\nd_teleports.xml")); XElement ex = xml.Element("list"); foreach (var m in ex.Elements()) { if (m.Name == "npc") { ab_teleport_npc npc = new ab_teleport_npc(); npc.id = int.Parse(m.Attribute("id").Value); foreach (var x in m.Elements()) { if (x.Name == "group") { ab_teleport_group ab = new ab_teleport_group(); ab.id = int.Parse(x.Attribute("id").Value); foreach (var e in x.Elements()) { if (e.Name == "e") { ab_teleport_entry ae = new ab_teleport_entry(); ae.name = e.Attribute("name").Value; ae.x = int.Parse(e.Attribute("x").Value); ae.y = int.Parse(e.Attribute("y").Value); ae.z = int.Parse(e.Attribute("z").Value); ae.id = ab._teles.Count; if (e.Attribute("cost") != null) { ae.cost = long.Parse(e.Attribute("cost").Value); } if (e.Attribute("itemId") != null) { ae.itemId = int.Parse(e.Attribute("itemId").Value); } ab._teles.Add(ae.id, ae); } } npc.groups.Add(ab.id, ab); } } if (npcs.ContainsKey(npc.id)) { CLogger.error("NpcData(Teleporter) dublicate npc str " + npc.id); } else { npcs.Add(npc.id, npc); } } } CLogger.info("NpcData(Teleporter): loaded " + npcs.Count + " npcs."); }
public void RequestTeleport(L2Citizen npc, L2Player player, int type, int entryId) { ab_teleport_group group = null; try { group = Teleports.npcs[npc.Template.NpcId].groups[type]; } catch { CLogger.error("ND:RequestTeleport cant find teleport group " + type); player.sendActionFailed(); return; } ab_teleport_entry e = group._teles[entryId]; if (!player.hasItem(e.itemId, e.cost)) { switch (e.itemId) { case 57: player.sendSystemMessage(279); //You do not have enough adena. break; case 6651: player.ShowHtm("fornonoblessitem.htm", npc); break; default: player.sendSystemMessage(701); //You do not have enough required items. break; } player.sendActionFailed(); return; } switch (e.itemId) { case 57: player.reduceAdena(e.cost, true, true); break; default: player.Inventory.destroyItem(e.itemId, e.cost, true, true); break; } player.teleport(e.x, e.y, e.z); }