Пример #1
0
        private IEnumerable <Entity> GetNewEntities()
        {
            foreach (var i in Owner.Players.Where(i => clientEntities.Add(i.Value)))
            {
                yield return(i.Value);
            }

            foreach (var i in Owner.PlayersCollision.HitTest(X, Y, SIGHTRADIUS).OfType <Decoy>().Where(i => clientEntities.Add(i)))
            {
                yield return(i);
            }

            foreach (var i in Owner.PlayersCollision.HitTest(X, Y, SIGHTRADIUS).OfType <Pet>().Where(i => clientEntities.Add(i)))
            {
                yield return(i);
            }

            foreach (var i in Owner.PlayersCollision.HitTest(X, Y, SIGHTRADIUS).OfType <Entity>().Where(i => clientEntities.Add(i))) //Can be removed
            {
                yield return(i);
            }

            foreach (var i in Owner.PlayersCollision.HitTest(X, Y, SIGHTRADIUS).OfType <Enemy>().Where(i => clientEntities.Add(i))) //Change to Entity maybe.
            {
                yield return(i);
            }


            foreach (var i in Owner.EnemiesCollision.HitTest(X, Y, SIGHTRADIUS))
            {
                if (i is Container)
                {
                    var owner = (i as Container).BagOwners?.Length == 1 ? (i as Container).BagOwners[0] : null;
                    if (owner != null && owner != AccountId)
                    {
                        continue;
                    }

                    if (owner == AccountId)
                    {
                        if ((LootDropBoost || LootTierBoost) && (i.ObjectType != 0x500 || i.ObjectType != 0x506))
                        {
                            (i as Container).BoostedBag = false; //boosted bag
                        }
                    }
                }
                if (Tiles.Contains(new IntPoint((int)(i.X - X), (int)(i.Y - Y))))
                {
                    if (clientEntities.Add(i))
                    {
                        yield return(i);
                    }
                }
            }
            if (Quest != null && clientEntities.Add(Quest))
            {
                yield return(Quest);
            }
        }
Пример #2
0
        /// <summary>
        /// Add the specified tile.
        /// </summary>
        /// <param name="tile">Tile.</param>
        public void Add(Tile tile)
        {
            if (Tiles.Contains(tile))
            {
                throw new RepositoryException("The specified tile already exists");
            }

            Tiles.Add(tile);
        }
Пример #3
0
        bool CellContainsMaxDensity(CPos c, ResourceType t)
        {
            if (!Tiles.Contains(c))
            {
                return(false);
            }

            if (FindClearSides(t, c) != ClearSides.None)
            {
                return(false);
            }

            var tile = Tiles[c];

            // Empty tile
            if (tile.Type == null)
            {
                return(false);
            }

            var density = ResourceDensityAt(c);

            return(density > tile.Type.Info.MaxDensity / 2);
        }
Пример #4
0