Пример #1
0
        public void RefreshData()
        {
            //load default locations first, doh
            locations.LoadData();

            if (data.StartingLocation.HasValue)
            {
                locations.StartingLocation = data.StartingLocation.Value;
            }
            if (data.AirShipLocation.HasValue)
            {
                locations.AirShipLocation = data.AirShipLocation.Value;
            }
            if (data.BridgeLocation.HasValue)
            {
                locations.BridgeLocation = data.BridgeLocation.Value;
            }
            if (data.CanalLocation.HasValue)
            {
                locations.CanalLocation = data.CanalLocation.Value;
            }

            locations.StoreData();

            foreach (var tf in data.TeleporterFixups)
            {
                exit[tf.Index.Value] = tf.To;
            }

            exit.StoreData();

            ShipLocations = new ShipLocations(locations, data.ShipLocations);

            ShipLocations.SetShipLocation(255);
        }
Пример #2
0
        public OwMapExchange(FF1Rom _rom, OverworldMap _overworldMap, OwMapExchangeData replacement)
        {
            rom          = _rom;
            overworldMap = _overworldMap;

            exit      = new ExitTeleData(rom);
            locations = new OwLocationData(rom);
            domains   = new DomainData(rom);

            data = replacement;

            ShipLocations = new ShipLocations(locations, data.ShipLocations);
        }
Пример #3
0
        public OwMapExchange(FF1Rom _rom, OverworldMap _overworldMap, string _name)
        {
            rom          = _rom;
            overworldMap = _overworldMap;
            name         = _name;

            exit      = new ExitTeleData(rom);
            locations = new OwLocationData(rom);
            domains   = new DomainData(rom);

            data = LoadJson(name);

            ShipLocations = new ShipLocations(locations, data.ShipLocations);
        }
Пример #4
0
        public SanityCheckerV2(List <Map> _maps, OverworldMap _overworldMap, NPCdata _npcdata, FF1Rom _rom, ItemShopSlot _declaredShopSlot, ShipLocations _shiplocations)
        {
            rom          = _rom;
            overworldMap = _overworldMap;
            maps         = _maps;
            npcdata      = _npcdata;

            locations = new OwLocationData(rom);
            locations.LoadData();

            Shiplocations = _shiplocations;

            allTreasures     = ItemLocations.AllTreasures.Select(r => r as TreasureChest).Where(r => r != null).ToDictionary(r => (byte)(r.Address - 0x3100));
            allQuestNpcs     = ItemLocations.AllNPCItemLocations.Select(r => r as MapObject).Where(r => r != null).ToDictionary(r => r.ObjectId);
            declaredShopSlot = _declaredShopSlot;

            UpdateNpcRequirements();

            Main = new SCMain(_maps, _overworldMap, _npcdata, locations, _rom);
        }
Пример #5
0
        public OwMapExchange(FF1Rom _rom, Flags flags, OverworldMap _overworldMap, MT19337 rng)
        {
            rom          = _rom;
            overworldMap = _overworldMap;

            exit      = new ExitTeleData(rom);
            locations = new OwLocationData(rom);
            domains   = new DomainData(rom);

            string name;

            if (flags.OwShuffledAccess && flags.OwUnsafeStart)
            {
                name = "unsafe256.zip";
            }
            else if (flags.OwShuffledAccess && !flags.OwUnsafeStart)
            {
                name = "shuffled256.zip";
            }
            else
            {
                name = "normal256.zip";
            }

            var assembly     = System.Reflection.Assembly.GetExecutingAssembly();
            var resourcePath = assembly.GetManifestResourceNames().First(str => str.EndsWith(name));

            using Stream stream = assembly.GetManifestResourceStream(resourcePath);

            var archive = new ZipArchive(stream);

            var maplist = archive.Entries.Where(e => e.Name.EndsWith(".json")).Select(e => e.Name).ToList();

            var map = maplist.PickRandom(rng);

            data = LoadJson(archive.GetEntry(map).Open());

            ShipLocations = new ShipLocations(locations, data.ShipLocations);
        }