Esempio n. 1
0
        public ItemInfoProvider(SeedOptions options, ItemUnlockingMap unlockingMap)
        {
            this.unlockingMap = unlockingMap;

            useItems        = new Dictionary <EInventoryUseItemType, ItemInfo>();
            relicItems      = new Dictionary <EInventoryRelicType, ItemInfo>();
            enquipmentItems = new Dictionary <EInventoryEquipmentType, ItemInfo>();
            familierItems   = new Dictionary <EInventoryFamiliarType, ItemInfo>();
            orbItems        = new Dictionary <int, ItemInfo>();
            statItems       = new Dictionary <EItemType, ItemInfo>();

            progressiveItems = new Dictionary <ItemInfo, PogRessiveItemInfo>();

            MakeGearsProgressive();
            MakeBroochProgressive();

            if (options.ProgressiveKeycard)
            {
                MakeKeycardsProgressive();
            }

            if (options.ProgressiveVerticalMovement)
            {
                MakeVerticalMovementProgressive();
            }
        }
Esempio n. 2
0
        static void SpawnBoss(Level level, SeedOptions seedOptions, int vanillaBossId)
        {
            if (!level.GameSave.GetSettings().BossRando.Value || TargetBossId == -1 || !level.GameSave.GetSaveBool("IsFightingBoss"))
            {
                return;
            }

            BossAttributes vanillaBossInfo  = BestiaryManager.GetBossAttributes(level, vanillaBossId);
            BossAttributes replacedBossInfo = BestiaryManager.GetReplacedBoss(level, vanillaBossId);

            level.JukeBox.StopSong();
            level.PlayCue(Timespinner.GameAbstractions.ESFX.FoleyWarpGyreIn);

            if (seedOptions.GasMaw && (vanillaBossId == (int)EBossID.Maw || (vanillaBossId == (int)EBossID.FelineSentry && level.GameSave.GetSaveBool("TSRando_IsVileteSaved"))))
            {
                FillRoomWithGas(level);
            }

            if (replacedBossInfo.ShouldSpawn)
            {
                ObjectTileSpecification bossTile = new ObjectTileSpecification();
                bossTile.Category = EObjectTileCategory.Enemy;
                bossTile.Layer    = ETileLayerType.Objects;
                bossTile.ObjectID = replacedBossInfo.TileId;
                bossTile.Argument = replacedBossInfo.Argument;
                bossTile.IsFlippedHorizontally = !replacedBossInfo.IsFacingLeft;

                var boss = replacedBossInfo.BossType.CreateInstance(false, replacedBossInfo.Position, level, replacedBossInfo.Sprite, -1, bossTile);
                level.AsDynamic().RequestAddObject(boss);
            }

            level.JukeBox.StopSong();
            level.JukeBox.PlaySong(vanillaBossInfo.Song);
            TargetBossId = -1;
        }
Esempio n. 3
0
        public static GenerationResult Generate(FillingMethod fillingMethod, SeedOptions options)
        {
            var random = new Random();

            Seed seed;
            var  itterations = 0;

            var stopwatch = new Stopwatch();

            stopwatch.Start();

            do
            {
                itterations++;
                seed = Seed.GenerateRandom(options, random);
            } while (!IsBeatable(seed, fillingMethod));

            stopwatch.Stop();

            Console.Out.WriteLine($"Spend {itterations} itterations to generate seed {seed}, in {stopwatch.Elapsed}");

            return(new GenerationResult
            {
                Seed = seed,
                Itterations = itterations,
                Elapsed = stopwatch.Elapsed
            });
        }
Esempio n. 4
0
        protected override void Initialize(SeedOptions options)
        {
            bool isRandomized = Level.GameSave.GetSettings().BossRando.Value;

            if (!isRandomized)
            {
                return;
            }

            if (!Level.GameSave.GetSaveBool("IsFightingBoss"))
            {
                foreach (Monster visibleEnemy in Level.AsDynamic().GetVisibleEnemies())
                {
                    visibleEnemy.SilentKill();
                }
                Dynamic.SilentKill();

                //abort already triggered scripts
                ((List <ScriptAction>)LevelReflected._activeScripts).Clear();
                ((Queue <DialogueBox>)LevelReflected._dialogueQueue).Clear();
                ((Queue <ScriptAction>)LevelReflected._waitingScripts).Clear();
            }
            else
            {
                // Set invulnerability during the Maw intro
                Level.AsDynamic().TogglePlayerIsInvulnerable(true);
            }
        }
Esempio n. 5
0
        protected override void Initialize(SeedOptions options)
        {
            if (Dynamic._isBroken)
            {
                return;
            }

            if ((Level.ID != 2 || Level.RoomID != 20) &&          // Right side libarary elevator room
                (Level.ID != 14 || Level.RoomID != 8) &&                 // Ravenlord
                (Level.ID != 14 || Level.RoomID != 6))                     // Ifrit
            {
                return;
            }

            Dynamic._isBroken     = true;
            Dynamic._orbSaveState = SaveOrbStateType.GetEnumValue("Dead");

            var orbAppendage = (Appendage)Dynamic._orbAppendage;

            orbAppendage.ChangeAnimation(5);             //5 = broken
            orbAppendage.ClearBattleAnimations();
            orbAppendage.IsGlowing = false;

            ((SFXCueInstance)Dynamic._glowCueInstance)?.Stop();
        }
Esempio n. 6
0
        public override void Initialize(ItemLocationMap _, GCM gameContentManager)
        {
            GameContentManager = gameContentManager;

            var saveFile      = (GameSave)Dynamic.SaveFile;
            var seed          = saveFile.GetSeed();
            var fillingMethod = saveFile.GetFillingMethod();

            if (!seed.HasValue)
            {
                seed = Seed.Zero;
            }

            Console.Out.WriteLine($"Seed: {seed}");

            seedOptions = seed.Value.Options;

            ItemLocations = Randomizer.Randomize(seed.Value, fillingMethod);
            ItemLocations.BaseOnSave(Level.GameSave);

            ItemTrackerUplink.UpdateState(ItemTrackerState.FromItemLocationMap(ItemLocations));

            LevelReflected._random = new DeRandomizer(LevelReflected._random, seed.Value);

            ItemManipulator.Initialize(ItemLocations);
        }
        void AddRandomItemsToLocationMap(Random random, SeedOptions options)
        {
            PlaceStarterProgressionItems(random);

            if (!options.GassMaw)
            {
                PlaceGassMaskInALegalSpot(random);
            }

            var alreadyAssingedItems = ItemLocations
                                       .Where(l => l.IsUsed)
                                       .Select(l => l.ItemInfo)
                                       .ToArray();

            var itemsThatUnlockProgression = UnlockingMap.AllProgressionItems
                                             .Where(i => alreadyAssingedItems.All(x => x.Identifier != i))
                                             .Select(i => ItemInfoProvider.Get(i))
                                             .ToList();

            var unusedItemLocations = ItemLocations
                                      .Where(l => !l.IsUsed)
                                      .ToList();

            while (itemsThatUnlockProgression.Count > 0)
            {
                var item     = itemsThatUnlockProgression.PopRandom(random);
                var location = unusedItemLocations.PopRandom(random);

                PutItemAtLocation(item, location);
            }

            FillRemainingChests(random);
        }
Esempio n. 8
0
 protected override void Initialize(SeedOptions options)
 {
     if (Dynamic._isDemonDoor)
     {
         Dynamic._isDemonDoor = false;
         Dynamic.IsLocked     = false;
     }
 }
        public SeedOptionsCollection(SeedOptions seedOptions)
        {
            foreach (var option in Options)
            {
                AddItem(option.Key);

                Inventory[option.Key].IsActive = (seedOptions.Flags & option.Key) > 0;
            }
        }
Esempio n. 10
0
        public static void OnChangeRoom(Level level, SeedOptions seedOptions, ItemLocationMap itemLocations, int levelId, int roomId)
        {
            var roomKey = new RoomItemKey(levelId, roomId);

            if (RoomTriggers.TryGetValue(roomKey, out var trigger))
            {
                trigger.trigger(level, itemLocations[roomKey], seedOptions);
            }
        }
Esempio n. 11
0
        protected override void Initialize(SeedOptions options)
        {
            if (AreTriggerConditionsMet())
            {
                return;
            }

            Dynamic.SilentKill();
        }
Esempio n. 12
0
        protected override void Initialize(SeedOptions options)
        {
            if (ItemInfo == null)
            {
                return;
            }

            Dynamic._hasKeycard = !IsPickedUp;
        }
 FullRandomItemLocationRandomizer(
     SeedOptions options,
     ItemInfoProvider itemInfoProvider,
     ItemUnlockingMap unlockingMap,
     ItemLocationMap itemLocationMap,
     bool progressionOnly
     ) : base(options, itemInfoProvider, itemLocationMap, unlockingMap, progressionOnly)
 {
 }
Esempio n. 14
0
        protected override void Initialize(SeedOptions options)
        {
            Dynamic.SilentKill();

            //abort already triggered scripts
            ((List <ScriptAction>)LevelReflected._activeScripts).Clear();
            ((Queue <DialogueBox>)LevelReflected._dialogueQueue).Clear();
            ((Queue <ScriptAction>)LevelReflected._waitingScripts).Clear();
        }
Esempio n. 15
0
 public SolrSeeder(IConfiguration configuration, IPostRelationalRepository postRelationalRepository, IPostNoSqlRepository postNoSqlRepository,
                   ILogger <SolrSeeder> logger)
 {
     _postRelationalRepository = postRelationalRepository;
     _postNoSqlRepository      = postNoSqlRepository;
     _configuration            = configuration;
     _logger  = logger;
     _options = new SeedOptions();
 }
Esempio n. 16
0
        protected override void Initialize(SeedOptions options)
        {
            if (ItemInfo == null)
            {
                return;
            }

            Scripts.UpdateRelicOrbGetToastToItem(Level, ItemInfo);
        }
Esempio n. 17
0
        public static void OnChangeRoom(
            Level level, SeedOptions seedOptions, ItemLocationMap itemLocations, int levelId, int roomId)
        {
            var roomKey = new RoomItemKey(levelId, roomId);

            if (TextReplacers.TryGetValue(roomKey, out var replacer))
            {
                replacer.replacer(level, itemLocations, seedOptions);
            }
        }
Esempio n. 18
0
 public InitializationService(UserManager <ApplicationUser> userManager, RoleManager <IdentityRole> roleManager, IOptions <SeedOptions> seedOptions, ICrowdactionService crowdactionService, IImageService imageService, IBackgroundJobClient jobClient, ApplicationDbContext context, ILogger <InitializationService> logger)
 {
     this.userManager        = userManager;
     this.roleManager        = roleManager;
     this.seedOptions        = seedOptions.Value;
     this.crowdactionService = crowdactionService;
     this.imageService       = imageService;
     this.jobClient          = jobClient;
     this.context            = context;
     this.logger             = logger;
 }
Esempio n. 19
0
        public static void OnChangeRoom(
            Level level, SeedOptions seedOptions, SettingCollection gameSettings, ItemLocationMap itemLocations, ScreenManager screenManager,
            int levelId, int roomId)
        {
            var roomKey = new RoomItemKey(levelId, roomId);

            if (RoomTriggers.TryGetValue(roomKey, out var trigger))
            {
                trigger.trigger(level, itemLocations[roomKey], seedOptions, gameSettings, screenManager);
            }
        }
Esempio n. 20
0
        protected override void Initialize(SeedOptions options)
        {
            bool hasTimespinnerPieces = AreTriggerConditionsMet();

            Level.GameSave.SetValue("TSRando_IsLabTSReady", hasTimespinnerPieces);

            if ((Level.GameSave.GetSettings().BossRando.Value&& Level.GameSave.GetSaveBool("IsFightingBoss")) || !hasTimespinnerPieces)
            {
                Dynamic.SilentKill();
            }
        }
Esempio n. 21
0
        static int CalculateCapacity(SeedOptions options)
        {
            var capacity = 160;

            if (options.DownloadableItems)
            {
                capacity += 14;
            }

            return(capacity);
        }
Esempio n. 22
0
        protected override void Initialize(SeedOptions options)
        {
            // Remove all exits during fights in boss rando
            Level level        = (Level)Dynamic._level;
            bool  isRandomized = level.GameSave.GetSettings().BossRando.Value;

            if (!isRandomized || !level.GameSave.GetSaveBool("IsFightingBoss"))
            {
                return;
            }

            Dynamic.SilentKill();
        }
Esempio n. 23
0
        private static void RunSeeding(SeedOptions opts)
        {
            var seeder  = new Seeder(opts);
            var success = seeder.Run(out var message);

            if (success)
            {
                Console.WriteLine("Data seeding has been successful");
            }
            else
            {
                Console.WriteLine(message);
            }
        }
        public ActionResult <Result> seed([Bind("FlushDB", "UsersCount", "SeasonsCount", "SeriesCount", "MoviesCount", "EpsoidsCount", "SeeksCount")] SeedOptions seedOptions)
        {
            String text = "Done";

            AddUsers(seedOptions.UsersCount, seedOptions.FlushDB);
            AddSeries(seedOptions.SeriesCount, seedOptions.SeasonsCount, seedOptions.FlushDB);
            AddMovies(seedOptions.MoviesCount, seedOptions.FlushDB);
            AddEpsoids(seedOptions.EpsoidsCount, seedOptions.FlushDB);
            AddSeeks(seedOptions.SeeksCount, seedOptions.FlushDB);

            return(new Result {
                Text = text
            });
        }
Esempio n. 25
0
 protected override void Initialize(SeedOptions options)
 {
     if (!(!LevelReflected.GetLevelSaveBool("HasWinchBeenUsed") ? false : LevelReflected.GetLevelSaveBool("IsDrawbridgeRaised")))
     {
         Dynamic._isEngineerDead    = true;
         Dynamic._isRaising         = true;
         Dynamic._raiseLowerCounter = 0.0f;
     }
     else
     {
         Dynamic._isRaising         = false;
         Dynamic._raiseLowerCounter = 4f;
     }
 }
Esempio n. 26
0
        protected override IList <TaskEntity> Seed(SeedOptions options)
        {
            IList <TaskEntity> tasks = new Faker().Make(100, count =>
            {
                TaskEntity task = new Faker <TaskEntity>()
                                  .RuleFor(entity => entity.DueDate, faker => faker.Date.Soon())
                                  .RuleFor(entity => entity.Id, Guid.NewGuid())
                                  .RuleFor(entity => entity.Title, faker => faker.Random.String())
                                  .Ignore(entity => entity.UserId);

                return(task);
            });

            return(tasks);
        }
Esempio n. 27
0
        protected override IList <UserEntity> Seed(SeedOptions options)
        {
            IList <UserEntity> users = new Faker().Make(10, count =>
            {
                UserEntity user = new Faker <UserEntity>()
                                  .RuleFor(entity => entity.Address, faker => faker.Address.FullAddress())
                                  .RuleFor(entity => entity.Email, faker => faker.Internet.Email())
                                  .RuleFor(entity => entity.Id, Guid.NewGuid())
                                  .RuleFor(entity => entity.Username, faker => faker.Internet.UserName())
                                  .Ignore(entity => entity.Tasks);

                return(user);
            });

            return(users);
        }
Esempio n. 28
0
        protected override void Initialize(SeedOptions options)
        {
            if (ItemInfo == null)
            {
                return;
            }

            if (IsPickedUp)
            {
                Dynamic.Kill();
            }

            Dynamic.ChangeAnimation(ItemInfo.AnimationIndex);

            hasCardC = Level.GameSave.Inventory.RelicInventory.Inventory.ContainsKey((int)EInventoryRelicType.ScienceKeycardC);
        }
Esempio n. 29
0
        protected override void Initialize(SeedOptions options)
        {
            if (ItemInfo == null)
            {
                return;
            }

            if (IsPickedUp)
            {
                Dynamic.Kill();
            }
            else
            {
                Dynamic.IsFound = false;
                hasDroppedLoot  = false;
            }

            Dynamic._itemData = ItemInfo.BestiaryItemDropSpecification;
            Dynamic._category = ItemInfo.Identifier.LootType.ToEInventoryCategoryType();

            switch (ItemInfo.Identifier.LootType)
            {
            case LootType.ConstRelic:
                Dynamic._relicType = ItemInfo.Identifier.Relic;
                break;

            case LootType.ConstUseItem:
                Dynamic._useItemType = ItemInfo.Identifier.UseItem;
                break;

            case LootType.ConstEquipment:
                Dynamic._equipmentType = ItemInfo.Identifier.Equipment;
                break;

            case LootType.ConstStat:
            case LootType.ConstOrb:
            case LootType.ConstFamiliar:
                Dynamic._category      = EInventoryCategoryType.Equipment;
                Dynamic._equipmentType = EInventoryEquipmentType.None;
                break;

            default:
                throw new NotImplementedException($"LoottType {ItemInfo.Identifier.LootType} is not supported by ItemDropPickup");
            }

            Dynamic.ChangeAnimation(ItemInfo.AnimationIndex);
        }
Esempio n. 30
0
        protected override void Initialize(SeedOptions options)
        {
            if (ItemInfo == null)
            {
                return;
            }

            if (IsPickedUp)
            {
                Level.RequestRemoveObject(TypedObject);
                return;
            }

            UpdateContainedLootSprite();

            appendagesCount = Appendages.Count;
        }