Example #1
0
        private void ProcessSpecialTileProps(int x, int y, byte tileId, SCTileDef tileDef)
        {
            var poi = new SCPointOfInterest
            {
                Coords  = new SCCoords(x, y),
                TileDef = tileDef,
                TileId  = tileId
            };

            if ((tileDef.OWBitFlags & SCBitFlags.Enter) > 0)
            {
                var overworldTeleport = (OverworldTeleportIndex)(tileDef.TileProp.Byte2 & 0x3F);
                var teleDef           = enter[(int)overworldTeleport];
                var t = new SCTeleport {
                    Coords = poi.Coords, Type = SCPointOfInterestType.OwEntrance, TargetMap = teleDef.Map, TargetCoords = new SCCoords {
                        X = teleDef.X, Y = teleDef.Y
                    }, OverworldTeleport = overworldTeleport
                };
                Exits.Add(t);

                poi.Type     = SCPointOfInterestType.Tele;
                poi.Teleport = t;
                PointsOfInterest.Add(poi);
            }
            else if ((tileDef.OWBitFlags & SCBitFlags.Caravan) > 0)
            {
                poi.Type   = SCPointOfInterestType.Shop;
                poi.ShopId = 69;
                PointsOfInterest.Add(poi);
            }
        }
        public SCDungeon(SCTeleport et, OverworldTeleportIndex overworldTeleport, Dictionary <MapId, SCMap> _scmaps, HashSet <SCTeleport> _usedEnterTeles)
        {
            scmaps            = _scmaps;
            usedEnterTeles    = _usedEnterTeles;
            OverworldTeleport = overworldTeleport;

            AddEnterTele(et);

            PointsOfInterest = poiDic.Values.ToList();
        }
        private void AddEnterTele(SCTeleport teleport)
        {
            if (usedEnterTeles.Contains(teleport))
            {
                return;
            }
            usedEnterTeles.Add(teleport);

            if (entrances.Contains(teleport))
            {
                entrances.Add(teleport);
            }

            AddTele(null, teleport, SCBitFlagSet.NoRequirements, true);
        }
        private void AddTele(SCArea currentArea, SCTeleport teleport, SCBitFlagSet bitFlagSet, bool topfloor)
        {
            var map      = scmaps[teleport.TargetMap];
            var entrance = map.Entrances.FirstOrDefault(e => e.Coords == teleport.TargetCoords);
            var area     = map.Areas.FirstOrDefault(area => area.Entrances.Contains(entrance));

            if (!Areas.Contains(area))
            {
                Areas.Add(area);

                if (currentArea != null)
                {
                    currentArea.ChildAreas.Add(area);
                    area.IsRoot = false;
                }
            }

            AddEntrance(area, entrance, bitFlagSet, topfloor);
        }
Example #5
0
        private void ProcessSpecialTileProps(int x, int y, byte tileId, SCTileDef tileDef)
        {
            var poi = new SCPointOfInterest
            {
                Coords  = new SCCoords(x, y),
                TileDef = tileDef,
                TileId  = tileId
            };

            if (tileDef.TileProp.TilePropFunc == (TilePropFunc.TP_NOMOVE | TilePropFunc.TP_SPEC_DOOR) && tileDef.TileProp.ShopId > 0)
            {
                poi.Type   = SCPointOfInterestType.Shop;
                poi.ShopId = tileDef.TileProp.ShopId;
                PointsOfInterest.Add(poi);
            }
            else if (tileDef.SpBitFlags == SCBitFlags.Warp)
            {
                if ((CFlags & SCMapCheckFlags.NoWarp) > 0)
                {
                    return;
                }

                var t = new SCTeleport {
                    Coords = poi.Coords, Type = SCPointOfInterestType.Warp
                };
                Exits.Add(t);

                poi.Type     = SCPointOfInterestType.Warp;
                poi.Teleport = t;
                PointsOfInterest.Add(poi);
            }
            else if (tileDef.SpBitFlags == SCBitFlags.Teleport)
            {
                var teleDef = tele[tileDef.TileProp.Byte2];
                var t       = new SCTeleport {
                    Coords = poi.Coords, Type = SCPointOfInterestType.Tele, TargetMap = teleDef.Map, TargetCoords = new SCCoords {
                        X = teleDef.X, Y = teleDef.Y
                    }.SmClamp
                };
                Exits.Add(t);

                poi.Type     = SCPointOfInterestType.Tele;
                poi.Teleport = t;
                PointsOfInterest.Add(poi);
            }
            else if ((tileDef.SpBitFlags & SCBitFlags.Exit) == SCBitFlags.Exit)
            {
                var teleDef = exit[tileDef.TileProp.Byte2];
                var t       = new SCTeleport {
                    Coords = poi.Coords, Type = SCPointOfInterestType.Exit, TargetMap = teleDef.Map, TargetCoords = new SCCoords {
                        X = teleDef.X, Y = teleDef.Y
                    }
                };
                Exits.Add(t);

                poi.Type     = SCPointOfInterestType.Exit;
                poi.Teleport = t;
                PointsOfInterest.Add(poi);
            }
            else if (tileDef.SpBitFlags == SCBitFlags.Treasure)
            {
                poi.Type       = SCPointOfInterestType.Treasure;
                poi.TreasureId = tileDef.TileProp.Byte2;
                PointsOfInterest.Add(poi);

                Tiles[x, y].Tile |= SCBitFlags.Blocked;
            }
            else if (tileDef.SpBitFlags == SCBitFlags.EarthOrb)
            {
                poi.Type   = SCPointOfInterestType.Orb;
                poi.ItemId = Item.EarthOrb;
                PointsOfInterest.Add(poi);
            }
            else if (tileDef.SpBitFlags == SCBitFlags.FireOrb)
            {
                poi.Type   = SCPointOfInterestType.Orb;
                poi.ItemId = Item.FireOrb;
                PointsOfInterest.Add(poi);
            }
            else if (tileDef.SpBitFlags == SCBitFlags.WaterOrb)
            {
                poi.Type   = SCPointOfInterestType.Orb;
                poi.ItemId = Item.WaterOrb;
                PointsOfInterest.Add(poi);
            }
            else if (tileDef.SpBitFlags == SCBitFlags.AirOrb)
            {
                poi.Type   = SCPointOfInterestType.Orb;
                poi.ItemId = Item.AirOrb;
                PointsOfInterest.Add(poi);
            }
        }