private void GetLogicvalues(AppObjInfoMap_Logic objAppObjInfoMap_Logic)
        {
            StaticItem si1 = new StaticItem();

            si1.DataValue = "-1";
            si1.TextValue = "Select";

            if (objAppObjInfoMap_Logic.AppObjInfoMap_LogicValues_List_VW != null)
            {
                foreach (AppObjInfoMap_LogicValues obj in objAppObjInfoMap_Logic.AppObjInfoMap_LogicValues_List_VW)
                {
                    StaticItem si = new StaticItem();
                    si.DataValue = obj.OptionValue;
                    si.TextValue = obj.OptionText;

                    if (obj.OptionFor == 1)
                    {
                        Value1List_VW.Add(si);
                    }

                    if (obj.OptionFor == 2)
                    {
                        Value2List_VW.Add(si);
                    }

                    if (obj.OptionFor == 3)
                    {
                        Value3List_VW.Add(si);
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public void LoadStatics(TileMatrixData tileData, Map map)
        {
            // get data from the tile Matrix
            var groundData  = tileData.GetLandChunk(ChunkX, ChunkY);
            var staticsData = tileData.GetStaticChunk(ChunkX, ChunkY, out int staticLength);
            // load the ground data into the tiles.
            var groundDataIndex = 0;

            for (var i = 0; i < 64; i++)
            {
                var tileID = groundData[groundDataIndex++] + (groundData[groundDataIndex++] << 8);
                var tileZ  = (sbyte)groundData[groundDataIndex++];
                var ground = new Ground(tileID, map);
                ground.Position.Set((int)ChunkX * 8 + i % 8, (int)ChunkY * 8 + (i / 8), tileZ);
            }
            // load the statics data into the tiles
            var countStatics    = staticLength / 7;
            var staticDataIndex = 0;

            for (var i = 0; i < countStatics; i++)
            {
                var tileID = staticsData[staticDataIndex++] + (staticsData[staticDataIndex++] << 8);
                var x      = staticsData[staticDataIndex++];
                var y      = staticsData[staticDataIndex++];
                var tileZ  = (sbyte)staticsData[staticDataIndex++];
                var hue    = staticsData[staticDataIndex++] + (staticsData[staticDataIndex++] * 256);
                var item   = new StaticItem(tileID, hue, i, map);
                item.Position.Set((int)ChunkX * 8 + x, (int)ChunkY * 8 + y, tileZ);
            }
        }
Ejemplo n.º 3
0
        public void Load(TileMatrixRaw tileData, Map map)
        {
            // get data from the tile Matrix
            byte[] groundData  = tileData.GetLandBlock(X, Y);
            byte[] staticsData = tileData.GetStaticBlock(X, Y);

            // load the ground data into the tiles.
            int groundDataIndex = 0;

            for (int i = 0; i < 64; i++)
            {
                int iTileID = groundData[groundDataIndex++] + (groundData[groundDataIndex++] << 8);
                int iTileZ  = (sbyte)groundData[groundDataIndex++];

                Ground ground = new Ground(iTileID, map);
                ground.Position.Set(X * 8 + i % 8, Y * 8 + (i / 8), iTileZ);
            }

            // load the statics data into the tiles
            int countStatics    = staticsData.Length / 7;
            int staticDataIndex = 0;

            for (int i = 0; i < countStatics; i++)
            {
                int iTileID = staticsData[staticDataIndex++] + (staticsData[staticDataIndex++] << 8);
                int iX      = staticsData[staticDataIndex++];
                int iY      = staticsData[staticDataIndex++];
                int iTileZ  = (sbyte)staticsData[staticDataIndex++];
                int hue     = staticsData[staticDataIndex++] + (staticsData[staticDataIndex++] * 256);

                StaticItem item = new StaticItem(iTileID, hue, i, map);
                item.Position.Set(X * 8 + iX, Y * 8 + iY, iTileZ);
            }
        }
Ejemplo n.º 4
0
        private void InitialLoadTiles()
        {
            int px = Position.X;
            int py = Position.Y;

            foreach (MultiComponentList.MultiItem item in m_Components.Items)
            {
                int x = px + item.OffsetX;
                int y = py + item.OffsetY;

                MapTile tile = Map.GetMapTile((uint)x, (uint)y);
                if (tile != null)
                {
                    if (tile.ItemExists(item.ItemID, item.OffsetZ))
                    {
                        continue;
                    }

                    StaticItem staticItem = new StaticItem(item.ItemID, 0, 0, Map);
                    if (staticItem.ItemData.IsDoor)
                    {
                        continue;
                    }
                    staticItem.Position.Set(x, y, Z + item.OffsetZ);
                }
            }
        }
Ejemplo n.º 5
0
        public List <StaticItem> GetModuleName()
        {
            List <StaticItem> objOfModuleMappingList = new List <StaticItem>();
            string            vComTxt = @"select ModuleCode,ModuleName from LS_Module ";

            try
            {
                SqlConnection connection = _supplierDbContext.GetConn();
                connection.Open();
                SqlDataReader dr;
                SqlCommand    command = new SqlCommand(vComTxt, connection);
                dr = command.ExecuteReader();
                while (dr.Read())
                {
                    StaticItem objModuleObjMapping = new StaticItem();

                    objModuleObjMapping.DataValue = dr["ModuleCode"].ToString();
                    objModuleObjMapping.TextValue = dr["ModuleName"].ToString();

                    objOfModuleMappingList.Add(objModuleObjMapping);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(objOfModuleMappingList);
        }
Ejemplo n.º 6
0
        private void PlaceTilesIntoNewlyLoadedChunk(MapChunk chunk)
        {
            int px = Position.X;
            int py = Position.Y;

            Rectangle bounds = new Rectangle((int)chunk.ChunkX * 8, (int)chunk.ChunkY * 8, 8, 8);

            foreach (MultiComponentList.MultiItem item in m_Components.Items)
            {
                int x = px + item.OffsetX;
                int y = py + item.OffsetY;

                if (bounds.Contains(x, y))
                {
                    // would it be faster to get the tile from the chunk?
                    MapTile tile = Map.GetMapTile(x, y);
                    if (tile != null)
                    {
                        if (!tile.ItemExists(item.ItemID, item.OffsetZ))
                        {
                            StaticItem staticItem = new StaticItem(item.ItemID, 0, 0, Map);
                            staticItem.Position.Set(x, y, Z + item.OffsetZ);
                        }
                    }
                }
            }
        }
Ejemplo n.º 7
0
        public void Fire(StaticItem source, FiringState firingState, Direction direction)
        {
            if (direction == Direction.None)
            {
                throw new ArgumentOutOfRangeException(nameof(direction));
            }

            if (firingState != FiringState.Pulse || source.Energy < 4)
            {
                return;
            }

            var adjacentTilePos = source.TilePosition.GetPositionAfterOneMove(direction);
            var itemsOnTile     = GlobalServices.GameState.GetItemsOnTile(adjacentTilePos);

            if (itemsOnTile.Any(item => item.Properties.Get(GameObjectProperties.EffectOfShot) == EffectOfShot.Impervious))
            {
                return;
            }

            var startPos = source.TilePosition.ToPosition() + direction.ToVector() * Constants.CentreOfTile;

            GlobalServices.GameState.AddStandardShot(startPos, direction, source.Energy >> 2, source);

            source.PlaySound(GameSound.PlayerShoots);
            _countOfShotsBeforeCostingEnergy--;
            if (_countOfShotsBeforeCostingEnergy < 0)
            {
                _countOfShotsBeforeCostingEnergy = 3;
                source.ReduceEnergy(1);
            }
        }
Ejemplo n.º 8
0
        public List <StaticItem> GetModuleList()
        {
            List <StaticItem> ListModule          = new List <StaticItem>();
            StaticItem        objStaticItemSelect = new StaticItem();

            objStaticItemSelect.DataValue = "0";
            objStaticItemSelect.TextValue = "Select";
            ListModule.Add(objStaticItemSelect);
            string sSql = @"select ModuleCode, ModuleName from LS_Module";

            SqlConnection connection = _supplierDbContext.GetConn();

            connection.Open();
            SqlDataReader dr;
            SqlCommand    objDbCommand = new SqlCommand(sSql, connection);

            dr = objDbCommand.ExecuteReader();

            while (dr.Read())
            {
                StaticItem objStaticItem = new StaticItem();
                objStaticItem.DataValue = dr["ModuleCode"].ToString();
                objStaticItem.TextValue = dr["ModuleName"].ToString();
                ListModule.Add(objStaticItem);
            }

            return(ListModule);
        }
Ejemplo n.º 9
0
 public void AddStaticThatNeedsUpdating(StaticItem item)
 {
     if (item.IsDisposed || item.Overheads.Count == 0)
     {
         return;
     }
     _activeStatics.Add(item);
 }
Ejemplo n.º 10
0
 public Command(StaticItem item)
     : this(GestureType.OneHandTap,
            KeywordType.Invariant,
            InteractableType.Widget,
            InteractableType.Invariant,
            item)
 {
 }
Ejemplo n.º 11
0
 public static void GetSortValues(AEntity e, out int z, out int type, out int threshold, out int tiebreaker)
 {
     if (e is AEffect)
     {
         AEffect effect = e as AEffect;
         z          = effect.Z;
         type       = 4;
         threshold  = 2;
         tiebreaker = 0;
     }
     else if (e is DeferredEntity)
     {
         DeferredEntity mobile = (DeferredEntity)e;
         z          = mobile.Z;
         type       = 2;
         threshold  = 1;
         tiebreaker = 0;
     }
     else if (e is Mobile)
     {
         Mobile mobile = (Mobile)e;
         z          = mobile.Z;
         type       = mobile.IsSitting ? 0 : 3;
         threshold  = 2;
         tiebreaker = mobile.IsClientEntity ? 0x40000000 : (int)mobile.Serial;
     }
     else if (e is Ground)
     {
         Ground tile = (Ground)e;
         z          = tile.GetView().SortZ;
         type       = 0;
         threshold  = 0;
         tiebreaker = 0;
     }
     else if (e is StaticItem)
     {
         StaticItem item = (StaticItem)e;
         z          = item.Z;
         type       = 1;
         threshold  = (item.ItemData.Height > 0 ? 1 : 0) + (item.ItemData.IsBackground ? 0 : 1);
         tiebreaker = item.SortInfluence;
     }
     else if (e is Item)
     {
         Item item = (Item)e;
         z          = item.Z;
         type       = ((item.ItemID & 0x3fff) == 0x2006) ? 4 : 2; // corpses show on top of mobiles and items.
         threshold  = (item.ItemData.Height > 0 ? 1 : 0) + (item.ItemData.IsBackground ? 0 : 1);
         tiebreaker = item.Serial;
     }
     else
     {
         z          = 0;
         threshold  = 0;
         type       = 0;
         tiebreaker = 0;
     }
 }
Ejemplo n.º 12
0
        public object this [string name] {
            get {
                StaticItem item = _Objects [name] as StaticItem;
                if (item == null)
                {
                    return(null);
                }

                return(item.Instance);
            }
        }
Ejemplo n.º 13
0
        public void Fire(StaticItem source, World world, FiringState firingState, Direction direction)
        {
            if (firingState != FiringState.Pulse || this._countOfMinesRemaining < 1)
                return;

            TilePos tp = source.TilePosition;
            if (world.IsStaticItemOnTile(tp))
                return;

            world.AddMine(tp.ToPosition());
            this._countOfMinesRemaining--;
        }
Ejemplo n.º 14
0
 public Command(GestureType gesture,
                KeywordType keyword,
                InteractableType focused,
                InteractableType selected,
                StaticItem item)
 {
     Gesture  = gesture;
     Keyword  = keyword;
     Focused  = focused;
     Selected = selected;
     Item     = item;
 }
Ejemplo n.º 15
0
        public static Sprite Create(float x, float y, Entity entity)
        {
            Sprite sprite = null;

            switch (entity.Category)
            {
            case EntityCategoryType.Human:
                switch (entity.Type)
                {
                case EntityType.Player:
                    sprite = new Player(x, y);
                    break;

                case EntityType.Boss1:
                case EntityType.Boss2:
                case EntityType.Boss3:
                case EntityType.Boss4:
                case EntityType.Boss5:
                    sprite = new Boss(x, y, entity.Type);
                    break;

                case EntityType.Student1:
                case EntityType.Student2:
                case EntityType.Student3:
                case EntityType.Student4:
                    sprite = new Student(x, y, entity.Type);
                    break;

                default:
                    throw new InvalidOperationException();
                }
                break;

            case EntityCategoryType.Key:
            case EntityCategoryType.Health:
            case EntityCategoryType.Mana:
            case EntityCategoryType.Knowledge:
            case EntityCategoryType.Defense:
            case EntityCategoryType.Certificate:
                sprite = new DynamicItem(x, y, entity);
                break;

            case EntityCategoryType.Door:
            case EntityCategoryType.WorldItems:
                sprite = new StaticItem(x, y, entity);
                break;

            default:
                throw new InvalidOperationException();
            }
            return(sprite);
        }
Ejemplo n.º 16
0
        internal HttpStaticObjectsCollection Clone()
        {
            HttpStaticObjectsCollection coll = new HttpStaticObjectsCollection();

            coll._Objects = new Hashtable();
            foreach (string key in _Objects.Keys)
            {
                StaticItem item = new StaticItem((StaticItem)_Objects [key]);
                coll._Objects [key] = item;
            }

            return(coll);
        }
Ejemplo n.º 17
0
        public Command(SpeechInteractionEventArgs eventArgs)
        {
            Gesture  = GestureType.None;
            Keyword  = eventArgs.Keyword;
            Selected = eventArgs.Selected.Type;
            Focused  = eventArgs.Focused.Type;
            Item     = StaticItem.None;

            if (Focused == InteractableType.Widget)
            {
                Item = eventArgs.Focused.GetComponent <StaticInteractable>().Item;
            }
        }
Ejemplo n.º 18
0
        public void Eqip(StaticItem item)
        {
            var features   = Features.Where(claim => claim.Type != RpgClaimTypes.Slot).ToList();
            var baseSlots  = Features.Where(c => c.Type == RpgClaimTypes.Slot).GroupBy(c => c.Value);
            var takenSlots = Eqipped.SelectMany(i => i.Requirements).Where(c => c.Type == RpgClaimTypes.Slot);

            foreach (var group in baseSlots)
            {
                features.AddRange(group.Skip(takenSlots.Count(c => c.Value == group.Key)));
            }

            item.CheckRequirements(features);

            Eqipped.Add(item);
        }
Ejemplo n.º 19
0
        public void Eqip(StaticItem item)
        {
            var features = Features.Where(claim => claim.Type != RpgClaimTypes.Slot).ToList();
            var baseSlots = Features.Where(c => c.Type == RpgClaimTypes.Slot).GroupBy(c=>c.Value);
            var takenSlots = Eqipped.SelectMany(i => i.Requirements).Where(c => c.Type == RpgClaimTypes.Slot);
            foreach (var group in baseSlots)
            {
                features.AddRange(group.Skip(takenSlots.Count(c=>c.Value == group.Key)));
            }           

            item.CheckRequirements(features);

            Eqipped.Add(item);

        }
Ejemplo n.º 20
0
        public void SetStaticItem(string name, int x, int y, Bitmap bitmap, int draw_x_add = 0, int draw_y_add = 0)
        {
            StaticItem m;

            if (!StaticItems.TryGetValue(name, out m))
            {
                m = new StaticItem();
            }
            m.x          = x * this.ChipSize; //マップタイルは16x16
            m.y          = y * this.ChipSize;
            m.draw_x_add = draw_x_add;
            m.draw_y_add = draw_y_add;
            m.bitmap     = ImageUtil.CloneBitmap(bitmap);
            U.MakeTransparent(m.bitmap);
            StaticItems[name] = m;
        }
        private static bool IsOk(bool ignoreDoors, int ourZ, int ourTop, StaticItem[] tiles, List <Item> items)
        {
            for (int i = 0; i < tiles.Length; ++i)
            {
                StaticItem check = tiles[i];

                if ((check.ItemData.Flags & ImpassableSurface) != 0)                 // Impassable || Surface
                {
                    int checkZ   = (int)check.Z;
                    int checkTop = checkZ + check.ItemData.CalcHeight;

                    if (checkTop > ourZ && ourTop > checkZ)
                    {
                        return(false);
                    }
                }
            }

            for (int i = 0; i < items.Count; ++i)
            {
                Item        item     = items[i];
                int         itemID   = item.ItemID & 0x3FFF;
                IO.ItemData itemData = IO.TileData.ItemData[itemID];
                TileFlag    flags    = itemData.Flags;

                if ((flags & ImpassableSurface) != 0)                 // Impassable || Surface
                {
                    if (ignoreDoors && ((flags & TileFlag.Door) != 0 || itemID == 0x692 || itemID == 0x846 || itemID == 0x873 || (itemID >= 0x6F5 && itemID <= 0x6F6)))
                    {
                        continue;
                    }

                    int checkZ   = item.Z;
                    int checkTop = checkZ + itemData.CalcHeight;

                    if (checkTop > ourZ && ourTop > checkZ)
                    {
                        return(false);
                    }
                }
            }

            return(true);
        }
        internal HttpStaticObjectsCollection Clone()
        {
            HttpStaticObjectsCollection coll = new HttpStaticObjectsCollection();

            if (objects == null)
            {
                return(coll);
            }

            var collObjects = coll.Objects;

            foreach (var de in objects)
            {
                StaticItem item = new StaticItem((StaticItem)de.Value);
                collObjects [de.Key] = item;
            }

            return(coll);
        }
Ejemplo n.º 23
0
        public void Fire(StaticItem source, FiringState firingState, Direction direction)
        {
            if (firingState != FiringState.Pulse || this._countOfMinesRemaining < 1)
            {
                return;
            }

            TilePos tp = source.TilePosition;

            if (GlobalServices.GameState.IsStaticItemOnTile(tp))
            {
                return;
            }

            var mine = GlobalServices.GameState.AddMine(tp.ToPosition());

            mine.PlaySound(GameSound.MineLaid);

            this._countOfMinesRemaining--;
        }
        public object this [string name] {
            get {
                if (objects == null)
                {
                    return(null);
                }

                StaticItem item = null;
                object     o;
                if (Objects.TryGetValue(name, out o))
                {
                    item = o as StaticItem;
                }

                if (item == null)
                {
                    return(null);
                }

                return(item.Instance);
            }
        }
Ejemplo n.º 25
0
        private void TranslateMapChunk(MapChunk chunk, Seasons season)
        {
            if (chunk == null)
            {
                return;
            }

            for (int tile = 0; tile < 64; tile++)
            {
                foreach (AEntity e in chunk.Tiles[tile].Entities)
                {
                    int[]      translations;
                    StaticItem si = (e as StaticItem);
                    if (si == null)
                    {
                        continue;
                    }
                    if (m_TranslationTable.TryGetValue(si.ItemID, out translations))
                    {
                        si.DisplayItemID = (season == Seasons.Spring) ? si.ItemID : translations[(int)season - 1];
                    }
                }
            }
        }
Ejemplo n.º 26
0
 void Start()
 {
     StaticItem sword = new StaticItem();
     StaticItem bread = new StaticItem();
     StaticItem cape  = new StaticItem();
 }
Ejemplo n.º 27
0
		internal HttpStaticObjectsCollection Clone ()
		{
			HttpStaticObjectsCollection coll = new HttpStaticObjectsCollection ();
			if (objects == null)
				return coll;
			
			var collObjects = coll.Objects;
			foreach (var de in objects) {
				StaticItem item = new StaticItem ((StaticItem) de.Value);
				collObjects [de.Key] = item;
			}
			
			return coll;
		}
        private static void getStartZ(AEntity m, Map map, Position3D loc, List <Item> itemList, out int zLow, out int zTop)
        {
            int xCheck = (int)loc.X, yCheck = (int)loc.Y;

            MapTile mapTile = map.GetMapTile(xCheck, yCheck);

            if (mapTile == null)
            {
                zLow = int.MinValue;
                zTop = int.MinValue;
            }

            bool landBlocks = mapTile.Ground.LandData.IsImpassible;             //(TileData.LandTable[landTile.ID & 0x3FFF].Flags & TileFlag.Impassable) != 0;

            // if (landBlocks && m.CanSwim && (TileData.LandTable[landTile.ID & 0x3FFF].Flags & TileFlag.Wet) != 0)
            //     landBlocks = false;
            // else if (m.CantWalk && (TileData.LandTable[landTile.ID & 0x3FFF].Flags & TileFlag.Wet) == 0)
            //     landBlocks = true;

            int landLow = 0, landCenter = 0, landTop = 0;

            landCenter = map.GetAverageZ(xCheck, yCheck, ref landLow, ref landTop);

            bool considerLand = !mapTile.Ground.IsIgnored;

            int  zCenter = zLow = zTop = 0;
            bool isSet   = false;

            if (considerLand && !landBlocks && loc.Z >= landCenter)
            {
                zLow    = landLow;
                zCenter = landCenter;

                if (!isSet || landTop > zTop)
                {
                    zTop = landTop;
                }

                isSet = true;
            }

            StaticItem[] staticTiles = mapTile.GetStatics().ToArray();

            for (int i = 0; i < staticTiles.Length; ++i)
            {
                StaticItem tile = staticTiles[i];

                int calcTop = ((int)tile.Z + tile.ItemData.CalcHeight);

                if ((!isSet || calcTop >= zCenter) && ((tile.ItemData.Flags & TileFlag.Surface) != 0) && loc.Z >= calcTop)
                {
                    //  || (m.CanSwim && (id.Flags & TileFlag.Wet) != 0)
                    // if (m.CantWalk && (id.Flags & TileFlag.Wet) == 0)
                    //     continue;

                    zLow    = (int)tile.Z;
                    zCenter = calcTop;

                    int top = (int)tile.Z + tile.ItemData.Height;

                    if (!isSet || top > zTop)
                    {
                        zTop = top;
                    }

                    isSet = true;
                }
            }

            for (int i = 0; i < itemList.Count; ++i)
            {
                Item item = itemList[i];

                IO.ItemData id = item.ItemData;

                int calcTop = item.Z + id.CalcHeight;

                if ((!isSet || calcTop >= zCenter) && ((id.Flags & TileFlag.Surface) != 0) && loc.Z >= calcTop)
                {
                    //  || (m.CanSwim && (id.Flags & TileFlag.Wet) != 0)
                    // if (m.CantWalk && (id.Flags & TileFlag.Wet) == 0)
                    //     continue;

                    zLow    = item.Z;
                    zCenter = calcTop;

                    int top = item.Z + id.Height;

                    if (!isSet || top > zTop)
                    {
                        zTop = top;
                    }

                    isSet = true;
                }
            }

            if (!isSet)
            {
                zLow = zTop = (int)loc.Z;
            }
            else if (loc.Z > zTop)
            {
                zTop = (int)loc.Z;
            }
        }
        private static bool check(Map map, Mobile m, List <Item> items, int x, int y, int startTop, int startZ, out int newZ)
        {
            newZ = 0;

            MapTile mapTile = map.GetMapTile(x, y);

            if (mapTile == null)
            {
                return(false);
            }

            StaticItem[] tiles = mapTile.GetStatics().ToArray();

            bool landBlocks   = (mapTile.Ground.LandData.Flags & TileFlag.Impassable) != 0;
            bool considerLand = !mapTile.Ground.IsIgnored;

            //if (landBlocks && canSwim && (TileData.LandTable[landTile.ID & 0x3FFF].Flags & TileFlag.Wet) != 0)	//Impassable, Can Swim, and Is water.  Don't block it.
            //    landBlocks = false;
            // else
            // if (cantWalk && (TileData.LandTable[landTile.ID & 0x3FFF].Flags & TileFlag.Wet) == 0)	//Can't walk and it's not water
            //     landBlocks = true;

            int landLow = 0, landCenter = 0, landTop = 0;

            landCenter = map.GetAverageZ(x, y, ref landLow, ref landTop);

            bool moveIsOk = false;

            int stepTop  = startTop + StepHeight;
            int checkTop = startZ + PersonHeight;

            bool ignoreDoors = (!m.Alive || m.BodyID == 0x3DB);

            #region Tiles
            for (int i = 0; i < tiles.Length; ++i)
            {
                StaticItem tile = tiles[i];

                if ((tile.ItemData.Flags & ImpassableSurface) == TileFlag.Surface)                 //  || (canSwim && (flags & TileFlag.Wet) != 0) Surface && !Impassable
                {
                    // if (cantWalk && (flags & TileFlag.Wet) == 0)
                    //     continue;

                    int itemZ   = (int)tile.Z;
                    int itemTop = itemZ;
                    int ourZ    = itemZ + tile.ItemData.CalcHeight;
                    int ourTop  = ourZ + PersonHeight;
                    int testTop = checkTop;

                    if (moveIsOk)
                    {
                        int cmp = Math.Abs(ourZ - m.Z) - Math.Abs(newZ - m.Z);

                        if (cmp > 0 || (cmp == 0 && ourZ > newZ))
                        {
                            continue;
                        }
                    }

                    if (ourZ + PersonHeight > testTop)
                    {
                        testTop = ourZ + PersonHeight;
                    }

                    if (!tile.ItemData.IsBridge)
                    {
                        itemTop += tile.ItemData.Height;
                    }

                    if (stepTop >= itemTop)
                    {
                        int landCheck = itemZ;

                        if (tile.ItemData.Height >= StepHeight)
                        {
                            landCheck += StepHeight;
                        }
                        else
                        {
                            landCheck += tile.ItemData.Height;
                        }

                        if (considerLand && landCheck < landCenter && landCenter > ourZ && testTop > landLow)
                        {
                            continue;
                        }

                        if (IsOk(ignoreDoors, ourZ, testTop, tiles, items))
                        {
                            newZ     = ourZ;
                            moveIsOk = true;
                        }
                    }
                }
            }
            #endregion

            #region Items
            for (int i = 0; i < items.Count; ++i)
            {
                Item        item     = items[i];
                IO.ItemData itemData = item.ItemData;
                TileFlag    flags    = itemData.Flags;

                if ((flags & ImpassableSurface) == TileFlag.Surface)                 // Surface && !Impassable && !Movable
                {
                    //  || (m.CanSwim && (flags & TileFlag.Wet) != 0))
                    // !item.Movable &&
                    // if (cantWalk && (flags & TileFlag.Wet) == 0)
                    //     continue;

                    int itemZ   = item.Z;
                    int itemTop = itemZ;
                    int ourZ    = itemZ + itemData.CalcHeight;
                    int ourTop  = ourZ + PersonHeight;
                    int testTop = checkTop;

                    if (moveIsOk)
                    {
                        int cmp = Math.Abs(ourZ - m.Z) - Math.Abs(newZ - m.Z);

                        if (cmp > 0 || (cmp == 0 && ourZ > newZ))
                        {
                            continue;
                        }
                    }

                    if (ourZ + PersonHeight > testTop)
                    {
                        testTop = ourZ + PersonHeight;
                    }

                    if (!itemData.IsBridge)
                    {
                        itemTop += itemData.Height;
                    }

                    if (stepTop >= itemTop)
                    {
                        int landCheck = itemZ;

                        if (itemData.Height >= StepHeight)
                        {
                            landCheck += StepHeight;
                        }
                        else
                        {
                            landCheck += itemData.Height;
                        }

                        if (considerLand && landCheck < landCenter && landCenter > ourZ && testTop > landLow)
                        {
                            continue;
                        }

                        if (IsOk(ignoreDoors, ourZ, testTop, tiles, items))
                        {
                            newZ     = ourZ;
                            moveIsOk = true;
                        }
                    }
                }
            }

            #endregion

            if (considerLand && !landBlocks && (stepTop) >= landLow)
            {
                int ourZ    = landCenter;
                int ourTop  = ourZ + PersonHeight;
                int testTop = checkTop;

                if (ourZ + PersonHeight > testTop)
                {
                    testTop = ourZ + PersonHeight;
                }

                bool shouldCheck = true;

                if (moveIsOk)
                {
                    int cmp = Math.Abs(ourZ - m.Z) - Math.Abs(newZ - m.Z);

                    if (cmp > 0 || (cmp == 0 && ourZ > newZ))
                    {
                        shouldCheck = false;
                    }
                }

                if (shouldCheck && IsOk(ignoreDoors, ourZ, testTop, tiles, items))
                {
                    newZ     = ourZ;
                    moveIsOk = true;
                }
            }

            return(moveIsOk);
        }
			public StaticItem (StaticItem item)
			{
				this.type = item.type;
			}
		internal HttpStaticObjectsCollection Clone ()
		{
			HttpStaticObjectsCollection coll = new HttpStaticObjectsCollection ();
			coll._Objects = new Hashtable ();
			foreach (string key in _Objects.Keys) {
				StaticItem item = new StaticItem ((StaticItem) _Objects [key]);
				coll._Objects [key] = item;
			}
			
			return coll;
		}
Ejemplo n.º 32
0
 public static void GetSortValues(AEntity e, out int z, out int threshold, out int type, out int tiebreaker)
 {
     if (e is AEffect)
     {
         AEffect effect = e as AEffect;
         z          = effect.Z;
         threshold  = 2;
         type       = 4;
         tiebreaker = 0;
     }
     else if (e is DeferredEntity)
     {
         DeferredEntity mobile = (DeferredEntity)e;
         z          = mobile.Z;
         threshold  = 1;
         type       = 2;
         tiebreaker = 0;
     }
     else if (e is Mobile)
     {
         Mobile mobile = (Mobile)e;
         z         = mobile.Z;
         threshold = 2;
         type      = 3;
         if (mobile.IsClientEntity)
         {
             tiebreaker = 0x40000000;
         }
         else
         {
             tiebreaker = mobile.Serial;
         }
     }
     else if (e is Ground)
     {
         Ground tile = (Ground)e;
         z          = tile.GetView().SortZ;
         threshold  = 0;
         type       = 0;
         tiebreaker = 0;
     }
     else if (e is StaticItem)
     {
         int        sort;
         StaticItem item = (StaticItem)e;
         z = item.Z;
         if (item.ItemData.IsBackground)
         {
             sort = 0;
         }
         else
         {
             sort = 1;
         }
         threshold  = (item.ItemData.Height == 0) ? sort : (sort + 1);
         type       = 1;
         tiebreaker = item.SortInfluence;
     }
     else if (e is Item) // this was previously dynamicitem - I think Kirros and I use the word 'Dynamic' for different purposes.
     {
         int  sort;
         Item item = (Item)e;
         z = item.Z;
         if (item.ItemData.IsBackground)
         {
             sort = 0;
         }
         else
         {
             sort = 1;
         }
         threshold  = (item.ItemData.Height == 0) ? sort : (sort + 1);
         type       = ((item.ItemID & 0x3fff) == 0x2006) ? 4 : 2; // is corpse? Corpse inherits from Container, which inherits from Item, so this works here.
         tiebreaker = item.Serial;
     }
     else
     {
         z          = 0;
         threshold  = 0;
         type       = 0;
         tiebreaker = 0;
     }
 }
Ejemplo n.º 33
0
 public StaticItem(StaticItem item)
 {
     this.type = item.type;
 }