Exemplo n.º 1
0
 public IEnumerable <T> GetNearFriends <T>(Vector3 position, int distance) where T : WowUnit
 => WowObjects.OfType <T>()
 .Where(e => e.Guid != PlayerGuid &&
        !e.IsDead &&
        !e.IsNotAttackable &&
        WowInterface.HookManager.GetUnitReaction(Player, e) == WowUnitReaction.Friendly &&
        e.Position.GetDistance(position) < distance);
Exemplo n.º 2
0
        private void CachePois()
        {
            IEnumerable <WowGameobject> wowGameobjects = wowObjects.OfType <WowGameobject>();
            IEnumerable <WowUnit>       wowUnits       = wowObjects.OfType <WowUnit>();

            // Remember Ore/Herb positions for farming
            foreach (WowGameobject gameobject in wowGameobjects.Where(e => Enum.IsDefined(typeof(OreNode), e.DisplayId)))
            {
                WowInterface.Db.CacheOre(MapId, (OreNode)gameobject.DisplayId, gameobject.Position);
            }

            foreach (WowGameobject gameobject in wowGameobjects.Where(e => Enum.IsDefined(typeof(HerbNode), e.DisplayId)))
            {
                WowInterface.Db.CacheHerb(MapId, (HerbNode)gameobject.DisplayId, gameobject.Position);
            }

            // Remember Mailboxes
            foreach (WowGameobject gameobject in wowGameobjects.Where(e => e.GameobjectType == WowGameobjectType.Mailbox))
            {
                WowInterface.Db.CachePoi(MapId, PoiType.Mailbox, gameobject.Position);
            }

            // Remember Auctioneers
            foreach (WowUnit unit in wowUnits.Where(e => e.IsAuctioneer))
            {
                WowInterface.Db.CachePoi(MapId, PoiType.Auctioneer, unit.Position);
            }

            // Remember Fishingspots and places where people fished at
            foreach (WowGameobject gameobject in wowGameobjects.Where(e => e.GameobjectType == WowGameobjectType.FishingHole || e.GameobjectType == WowGameobjectType.FishingBobber))
            {
                WowUnit originUnit = WowObjects.OfType <WowUnit>().FirstOrDefault(e => e.Guid == gameobject.CreatedBy);

                // dont cache positions too close to eachother
                if (originUnit != null &&
                    !WowInterface.Db.TryGetPointsOfInterest(MapId, PoiType.FishingSpot, originUnit.Position, 5.0, out IEnumerable <Vector3> pois))
                {
                    WowInterface.Db.CachePoi(MapId, PoiType.FishingSpot, originUnit.Position);
                }
            }

            // Remember Vendors
            foreach (WowUnit unit in wowUnits.Where(e => e.IsVendor))
            {
                WowInterface.Db.CachePoi(MapId, PoiType.Vendor, unit.Position);
            }

            // Remember Repair Vendors
            foreach (WowUnit unit in wowUnits.Where(e => e.IsRepairVendor))
            {
                WowInterface.Db.CachePoi(MapId, PoiType.Repair, unit.Position);
            }
        }
Exemplo n.º 3
0
 public T GetWowObjectByGuid <T>(ulong guid) where T : WowObject
 => WowObjects.OfType <T>().FirstOrDefault(e => e.Guid == guid);
Exemplo n.º 4
0
 public WowPlayer GetWowPlayerByName(string playername, StringComparison stringComparison = StringComparison.OrdinalIgnoreCase)
 => WowObjects.OfType <WowPlayer>().FirstOrDefault(e => e.Name.Equals(playername.ToUpper(), stringComparison));