public void Use(L2Player player, int reply) { if (player.ViewingAdminTeleportGroup == -1 || !_groups.ContainsKey(player.ViewingAdminTeleportGroup)) { player.sendMessage("teleport group #" + player.ViewingAdminTeleportGroup + " was not found."); player.sendActionFailed(); return; } ab_teleport_group gr = _groups[player.ViewingAdminTeleportGroup]; ab_teleport_entry e = gr._teles[reply]; player.teleport(e.x, e.y, e.z); }
public void ShowGroup(L2Player player, int groupId) { if (!_groups.ContainsKey(groupId)) { player.sendMessage("teleport group #" + groupId + " was not found."); player.sendActionFailed(); return; } ab_teleport_group gr = _groups[groupId]; StringBuilder sb = new StringBuilder("<button value=\"Back\" action=\"bypass -h admin?ask=3&reply=0\" width=50 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"><center><font color=\"Blue\">Region : </font><font color=\"LEVEL\">" + gr.name + "</font><br>"); foreach (ab_teleport_entry e in gr._teles.Values) { sb.Append("<button value=\"" + e.name + "\" action=\"bypass -h admin?ask=2&reply=" + e.id + "\" width=150 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"><br1>"); } sb.Append("</center>"); player.ViewingAdminTeleportGroup = gr.id; player.ShowHtmAdmin(sb.ToString(), true); }
public void reload() { XElement xml = XElement.Parse(File.ReadAllText(@"scripts\admin\abteleport.xml")); XElement ex = xml.Element("list"); foreach (var m in ex.Elements()) { if (m.Name == "group") { ab_teleport_group ab = new ab_teleport_group(); ab.id = int.Parse(m.Attribute("id").Value); ab.str = m.Attribute("str").Value; ab.name = m.Attribute("name").Value; ab.level = int.Parse(m.Attribute("level").Value); foreach (var e in m.Elements()) { if (e.Name == "entry") { 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; ab._teles.Add(ae.id, ae); } } _groups.Add(ab.id, ab); } } CLogger.info("AdminPlugin(Teleport): loaded " + _groups.Count + " groups."); }