Пример #1
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);
        }
        public TeleportShuffle(FF1Rom _rom, OwMapExchangeData data)
        {
            rom = _rom;

            if (data?.OverworldCoordinates != null)
            {
                OverworldCoordinates = data.OverworldCoordinates.Select(kv => (Enum.Parse <OverworldTeleportIndex>(kv.Key), new Coordinate(kv.Value.X, kv.Value.Y, CoordinateLocale.Overworld))).ToDictionary(kv => kv.Item1, kv => kv.Item2);
            }
            else
            {
                OverworldCoordinates = VanillaOverworldCoordinates;
            }
        }
Пример #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);
        }
 public OwMapExchangeData(OwMapExchangeData copy)
 {
     this.StartingLocation     = copy.StartingLocation;
     this.AirShipLocation      = copy.AirShipLocation;
     this.BridgeLocation       = copy.BridgeLocation;
     this.CanalLocation        = copy.CanalLocation;
     this.ShipLocations        = copy.ShipLocations;
     this.TeleporterFixups     = copy.TeleporterFixups;
     this.DomainFixups         = copy.DomainFixups;
     this.DomainUpdates        = copy.DomainUpdates;
     this.OverworldCoordinates = copy.OverworldCoordinates;
     this.DecompressedMapRows  = copy.DecompressedMapRows;
     this.FFRVersion           = copy.FFRVersion;
     this.Checksum             = copy.Checksum;
     this.Seed = copy.Seed;
 }
        public string ComputeChecksum()
        {
            var copy = new OwMapExchangeData(this);

            copy.FFRVersion = "";
            copy.Checksum   = "";
            copy.Seed       = 0;

            var content = JsonConvert.SerializeObject(copy);

            using (SHA256 hasher = SHA256.Create())
            {
                Blob JsonBlob = Encoding.UTF8.GetBytes(content);
                Blob hash     = hasher.ComputeHash(JsonBlob);
                return(Convert.ToHexString(hash).Substring(0, 32));
            }
        }
Пример #6
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);
        }