Ejemplo n.º 1
0
        public static async void Warp(EliteAPI api, Structs.WarpPoint nextWP)
        {
            if (nextWP.zone == 0)
            {
                Chat.SendEcho(api, "Error with nextWP! No zone detected.");
                return;
            }

            //Mark flag for status gui text update.
            isWarping = true;
            Chat.SendEcho(api, Chat.Warp.warmupNotify);

            //Start warp.
            MaintenanceMode(api, true);

            await Task.Delay(1000);

            api.Player.X = nextWP.pos.X;
            api.Player.Y = nextWP.pos.Y;
            api.Player.Z = nextWP.pos.Z;

            //Finish warp.
            await Task.Delay(2000);

            MaintenanceMode(api, false);

            if (warpAccepted)
            {
                warpAccepted = false;
            }

            Chat.SendEcho(api, Chat.Warp.arrivedNotify);
            isWarping = false;
        }
Ejemplo n.º 2
0
        public static Structs.WarpPoint GetNyzulWP(EliteAPI api)
        {
            Structs.WarpPoint WP = new Structs.WarpPoint();
            WP.title = "null";

            const Int32
                PC   = 0x0001,
                NPC  = 0x0002,
                Mob  = 0x0010,
                Self = 0x000D;

            for (var x = 0; x < 4096; x++)
            {
                var  entity            = api.Entity.GetEntity(x);
                bool invalid           = entity.WarpPointer == 0,
                     dead              = entity.HealthPercent <= 0,
                     outsideRange      = entity.Distance > 50.0f || float.IsNaN(entity.Distance) || entity.Distance <= 0,
                     isRendered        = (entity.Render0000 & 0x200) == 0x200,
                     isSelf            = (entity.SpawnFlags & Self) == Self || entity.Name == api.Player.Name,
                     isMob             = (entity.SpawnFlags & Mob) == Mob,
                     isNPC             = (entity.SpawnFlags & NPC) == NPC,
                     isPC              = (entity.SpawnFlags & PC) == PC,
                     invalidPlayerName = isPC && (entity.Name.Length <Structs.FFXI.Name.MINLENGTH || entity.Name.Length> Structs.FFXI.Name.MAXLENGTH || !Regex.IsMatch(entity.Name, @"^[a-zA-Z]+$")),
                     inWhitelist       = isPC && Structs.Speed.whitelist.IndexOf(entity.Name) != -1;

                if (invalid || dead || outsideRange || !isRendered || isSelf || invalidPlayerName)
                {
                    continue;
                }

                if (entity.Name.Contains("Transfer"))
                {
                    WP.title = "Rune of Transfer";
                    WP.zone  = api.Player.ZoneId;
                    WP.pos.X = entity.X;
                    WP.pos.X = entity.Y;
                    WP.pos.X = entity.Z;
                    return(WP);
                }
            }
            return(WP);
        }
Ejemplo n.º 3
0
        public static void LoadWarps()
        {
            try
            {
                settingsDoc = XDocument.Load(SETTINGS);
                IEnumerable <XElement> allElements =
                    from xEle in settingsDoc.Descendants("Zones")
                    select xEle;

                foreach (XElement result in allElements)
                {
                    result.Descendants("WarpPoint").Select(t => new
                    {
                        zone  = t.Parent.Attribute("id").Value,
                        title = t.Attribute("title").Value,
                        x     = t.Element("X").Value,
                        y     = t.Element("Y").Value,
                        z     = t.Element("Z").Value,
                    }).ToList().ForEach(t =>
                    {
                        Structs.Position pos = new Structs.Position();
                        pos.X = float.Parse(t.x);
                        pos.Y = float.Parse(t.y);
                        pos.Z = float.Parse(t.z);

                        Structs.WarpPoint wp = new Structs.WarpPoint();
                        wp.title             = t.title;
                        wp.zone = int.Parse(t.zone);
                        wp.pos  = pos;
                        Structs.warpPoints.Add(wp);
                    });
                }
            }
            catch (FileNotFoundException)
            {
                XML.Create();
            }
        }
Ejemplo n.º 4
0
        public static void DeleteWarp(EliteAPI api, bool updating = false)
        {
            settingsDoc = XDocument.Load(SETTINGS);
            if (NailClipr.GUI_WARP.Text == "")
            {
                return;
            }
            int    zone     = api.Player.ZoneId;
            string zoneName = Structs.Zones.NameFromID(zone);
            string delName  = NailClipr.GUI_WARP.Text;

            if (!updating)
            {
                Chat.SendEcho(api, " Deleting warp point: " + zoneName + " - " + delName + ".");
                NailClipr.GUI_WARP.Text = "";
            }

            Structs.WarpPoint delWP = Structs.zonePoints.Find(wp => wp.title == delName);

            if (delWP.Equals(default(Structs.WarpPoint)))
            {
                Chat.SendEcho(api, "No warp point with that name found.");
                return;
            }

            XElement delNode = settingsDoc.Descendants("WarpPoint")
                               .Where(a => a.Parent.Attribute("id").Value == zone + "" && a.Attribute("title").Value == delName)
                               .FirstOrDefault();

            delNode.Remove();
            settingsDoc.Save(SETTINGS);
            Structs.zonePoints.Remove(delWP);
            Structs.warpPoints.Remove(delWP);

            NailClipr.GUI_WARP.Items.Remove(delWP.title);
        }
Ejemplo n.º 5
0
 public static void AddZonePoint(Structs.WarpPoint wp)
 {
     NailClipr.GUI_WARP.Items.Add(wp.title);
     Structs.zonePoints.Add(wp);
 }
Ejemplo n.º 6
0
        public static void SaveWarp(EliteAPI api)
        {
            try
            {
                settingsDoc = XDocument.Load(SETTINGS);
                //http://www.c-sharpcorner.com/UploadFile/de41d6/learning-linq-made-easy-linq-to-xml-tutorial-3/

                Structs.Position pos = new Structs.Position();
                pos.X = api.Player.X;
                pos.Y = api.Player.Z;
                pos.Z = api.Player.Y;

                Structs.WarpPoint wp       = new Structs.WarpPoint();
                string            warpText = NailClipr.GUI_WARP.Text;
                if (warpText == "")
                {
                    NailClipr.GUI_WARP.Text = "Untitled Location"; wp.title = "Untitled Location";
                }
                else
                {
                    wp.title = warpText;
                }
                wp.zone = api.Player.ZoneId;
                wp.pos  = pos;
                string zoneName = Structs.Zones.NameFromID(wp.zone);

                //Updating - delete old and save new.
                int index = Structs.zonePoints.FindIndex(p => p.title == wp.title);
                if (index >= 0)
                {
                    Chat.SendEcho(api, " Updating warp point: " + zoneName + " - " + NailClipr.GUI_WARP.Text + ".");
                    DeleteWarp(api, true);
                }
                else
                {
                    Chat.SendEcho(api, " Saving new warp point: " + zoneName + " - " + NailClipr.GUI_WARP.Text + ".");
                }

                Structs.warpPoints.Add(wp);
                Functions.AddZonePoint(wp);

                try
                {
                    string s = settingsDoc.Element("NailClipr").Element("Zones").Elements("Zone").Single(z => z.Attribute("id").Value == wp.zone + "").Value;
                }
                catch (InvalidOperationException)
                {
                    settingsDoc.Element("NailClipr").Element("Zones").Add(new XElement("Zone",
                                                                                       new XAttribute("id", wp.zone),
                                                                                       new XAttribute("title", zoneName)));
                    settingsDoc.Save(SETTINGS);
                }


                settingsDoc.Element("NailClipr").Elements("Zones").Elements("Zone").Single(z => z.Attribute("id").Value == wp.zone + "")
                .Add(
                    new XElement("WarpPoint",
                                 new XAttribute("title", wp.title),
                                 new XElement("X", wp.pos.X),
                                 new XElement("Y", wp.pos.Y),
                                 new XElement("Z", wp.pos.Z)
                                 ));
                settingsDoc.Save(SETTINGS);
            }
            catch (FileNotFoundException)
            {
                Create();
                SaveWarp(api);
            }
        }