Beispiel #1
0
        public void Reload()
        {
            XElement xml = XElement.Parse(File.ReadAllText(@"scripts\admin\abteleport.xml"));
            XElement ex  = xml.Element("list");

            if (ex != null)
            {
                foreach (XElement m in ex.Elements())
                {
                    if (m.Name != "group")
                    {
                        continue;
                    }

                    ABTeleportGroup ab = new ABTeleportGroup
                    {
                        Id    = int.Parse(m.Attribute("id").Value),
                        Str   = m.Attribute("str").Value,
                        Name  = m.Attribute("name").Value,
                        Level = int.Parse(m.Attribute("level").Value)
                    };

                    foreach (ABTeleportEntry ae in m.Elements().Where(e => e.Name == "entry").Select(e => new ABTeleportEntry
                    {
                        Name = e.Attribute("name").Value,
                        X = int.Parse(e.Attribute("x").Value),
                        Y = int.Parse(e.Attribute("y").Value),
                        Z = int.Parse(e.Attribute("z").Value),
                        Id = ab.Teles.Count
                    }))
                    {
                        ab.Teles.Add(ae.Id, ae);
                    }

                    Groups.Add(ab.Id, ab);
                }
            }

            Log.Info($"AdminPlugin(Teleport): loaded {Groups.Count} groups.");
        }
Beispiel #2
0
        public void ShowGroup(L2Player player, int groupId)
        {
            if (!Groups.ContainsKey(groupId))
            {
                player.SendMessage($"teleport group #{groupId} was not found.");
                player.SendActionFailed();
                return;
            }

            ABTeleportGroup 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 (ABTeleportEntry 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);
        }