Esempio n. 1
0
 public static void OnDeath()
 {
     if (Randomizer.Sync)
     {
         RandomizerSyncManager.onDeath();
     }
     RandomizerBonusSkill.OnDeath();
     RandomizerTrackedDataManager.UpdateBitfields();
     RandomizerStatsManager.OnDeath();
 }
    public static void GivePickup(RandomizerAction Action, int coords, bool found_locally = true)
    {
        try {
            switch (Action.Action)
            {
            case "RP":
            case "MU":
                string[] pieces = ((string)Action.Value).Split('/');
                for (int i = 0; i < pieces.Length; i += 2)
                {
                    string code = pieces[i];
                    if (Randomizer.StringKeyPickupTypes.Contains(code))
                    {
                        RandomizerSwitch.GivePickup(new RandomizerAction(code, pieces[i + 1]), coords, false);
                    }
                    else
                    {
                        int id;
                        int.TryParse(pieces[i + 1], out id);
                        RandomizerSwitch.GivePickup(new RandomizerAction(code, id), coords, false);
                    }
                }
                SilentMode = false;
                break;

            case "AC":
                SkillPointPickup();
                break;

            case "EC":
                MaxEnergyContainerPickup();
                break;

            case "EX":
                ExpOrbPickup((int)Action.Value);
                break;

            case "KS":
                KeystonePickup();
                break;

            case "HC":
                MaxHealthContainerPickup();
                break;

            case "MS":
                MapStonePickup();
                break;

            case "SK":
                if (Randomizer.CutscenePickupLocs.Contains(coords))
                {
                    Randomizer.FixCutscenePickup = (int)Action.Value;
                }
                AbilityPickup((int)Action.Value);
                break;

            case "EV":
                EventPickup((int)Action.Value);
                break;

            case "RB":
                RandomizerBonus.UpgradeID((int)Action.Value);
                break;

            case "TP":
                TeleportPickup((string)Action.Value);
                break;

            case "SH":
                string message = ((string)Action.Value).Replace("AltR", RandomizerRebinding.ReturnToStart.FirstBindName());
                if (message.Length > 1 && message[1] == '=')
                {
                    var parts = message.Split(',').ToList();
                    var flags = parts.FindAll(ele => ele.Length >= 2 && ele[1] == '=');
                    message = String.Join(",", parts.FindAll(ele => ele.Length < 2 || ele[1] != '=').ToArray());
                    int duration = 120;
                    foreach (var flag in flags)
                    {
                        var p = flag.Split('=');
                        if (p.Length != 2)
                        {
                            continue;
                        }
                        if (p[0] == "d")
                        {
                            int.TryParse(p[1], out duration);
                        }
                        else if (p[0] == "s")
                        {
                            SilentMode = (p[1].Trim().ToLower() == "true");
                        }
                    }
                    Randomizer.showHint(message, duration);
                }
                else
                {
                    Randomizer.showHint(message);
                }
                break;

            case "WT":
                RandomizerTrackedDataManager.SetRelic(Randomizer.RelicZoneLookup[(string)Action.Value]);
                int    relics   = Characters.Sein.Inventory.GetRandomizerItem(302);
                string relicStr = "\n(" + relics.ToString() + "/" + Randomizer.RelicCount.ToString() + ")";
                if (relics >= Randomizer.RelicCount)
                {
                    relicStr = "$" + relicStr + "$";
                }
                PickupMessage((string)Action.Value + relicStr, 480);
                break;

            case "WS":
            case "WP":
                Randomizer.SaveAfterWarp = Action.Action == "WS";
                string[] xy = ((string)Action.Value).Split(',');
                if (xy.Length > 2 && xy[2] == "force")
                {
                    Randomizer.WarpTo(new UnityEngine.Vector3(float.Parse(xy[0]), float.Parse(xy[1])), 15);
                }
                else
                {
                    Randomizer.WarpTarget = new UnityEngine.Vector3(float.Parse(xy[0]), float.Parse(xy[1]));
                    Randomizer.WarpSource = Characters.Sein.Position;
                    Randomizer.CanWarp    = 7;
                }
                break;

            case "NO":
                break;
            }
            BingoController.OnItem(Action, coords);
            RandomizerTrackedDataManager.UpdateBitfields();
        }
        catch (Exception e) {
            Randomizer.LogError("Give Pickup(" + Action.ToString() + ", " + coords.ToString() + "): " + e.Message);
        }
        if (found_locally && Randomizer.Sync)
        {
            RandomizerSyncManager.FoundPickup(Action, coords);
        }
        if (found_locally)
        {
            Randomizer.OnCoord(coords);
        }
    }
Esempio n. 3
0
    // Token: 0x06003848 RID: 14408
    public static void Tick()
    {
        long tick = DateTime.Now.Ticks % 10000000L;

        if (tick < Randomizer.LastTick)
        {
            if (ResetVolume == 1)
            {
                ResetVolume = 0;
                GameSettings.Instance.SoundEffectsVolume = CachedVolume;
            }
            else if (ResetVolume > 1)
            {
                ResetVolume--;
            }

            if (RepeatableCooldown > 0)
            {
                RepeatableCooldown--;
            }
            if (RandomizerStatsManager.StatsTimer > 0)
            {
                RandomizerStatsManager.StatsTimer--;
            }
            RandomizerStatsManager.IncTime();
            if (Scenes.Manager.CurrentScene != null)
            {
                string scene = Scenes.Manager.CurrentScene.Scene;
                if (scene == "titleScreenSwallowsNest")
                {
                    ResetTrackerCount++;
                    if (ResetTrackerCount > 10)
                    {
                        RandomizerTrackedDataManager.Reset();
                        ResetTrackerCount = 0;
                    }
                    if (RandomizerCreditsManager.CreditsDone)
                    {
                        RandomizerCreditsManager.CreditsDone = false;
                    }
                }
                else if (scene == "creditsScreen")
                {
                    if (!CreditsActive && !RandomizerCreditsManager.CreditsDone)
                    {
                        CreditsActive = true;
                        RandomizerCreditsManager.Initialize();
                    }
                }
                else if (scene == "theSacrifice" && RandomizerStatsManager.Active)
                {
                    foreach (SceneManagerScene sms in Scenes.Manager.ActiveScenes)
                    {
                        if (sms.MetaData.Scene == "creditsScreen" && sms.CurrentState == SceneManagerScene.State.Loading)
                        {
                            RandomizerStatsManager.Finish();
                        }
                    }
                }
            }

            if (CreditsActive && !RandomizerCreditsManager.CreditsDone)
            {
                RandomizerCreditsManager.Tick();
            }

            if (Characters.Sein)
            {
                if (JustSpawned && SpawnWith != "" && Characters.Sein.Inventory)
                {
                    JustSpawned = false;
                    RandomizerAction spawnItem;
                    if (Randomizer.StringKeyPickupTypes.Contains(SpawnWith.Substring(0, 2)))
                    {
                        spawnItem = new RandomizerAction(SpawnWith.Substring(0, 2), SpawnWith.Substring(2));
                    }
                    else
                    {
                        spawnItem = new RandomizerAction(SpawnWith.Substring(0, 2), int.Parse(SpawnWith.Substring(2)));
                    }
                    RandomizerSwitch.GivePickup(spawnItem, 2, true);
                }
                if (!Characters.Sein.IsSuspended && Scenes.Manager.CurrentScene != null)
                {
                    ResetTrackerCount = 0;
                    RandomizerTrackedDataManager.UpdateBitfields();
                    RandomizerColorManager.UpdateHotColdTarget();
                    if (Characters.Sein.Position.y > 937f && Sein.World.Events.WarmthReturned && Scenes.Manager.CurrentScene.Scene == "ginsoTreeWaterRisingEnd")
                    {
                        if (Characters.Sein.Abilities.Bash.IsBashing)
                        {
                            Characters.Sein.Abilities.Bash.BashGameComplete(0f);
                        }
                        Characters.Sein.Position = new Vector3(750f, -120f);
                        return;
                    }
                    if (Scenes.Manager.CurrentScene.Scene == "catAndMouseResurrectionRoom" && !Randomizer.canFinalEscape())
                    {
                        if (Randomizer.Entrance)
                        {
                            Randomizer.EnterDoor(new Vector3(-242f, 489f));
                            return;
                        }
                        Characters.Sein.Position = new Vector3(20f, 105f);
                        return;
                    }
                    else if (!Characters.Sein.Controller.CanMove && Scenes.Manager.CurrentScene.Scene == "moonGrottoGumosHideoutB")
                    {
                        Randomizer.LockedCount++;
                        if (Randomizer.LockedCount >= 4)
                        {
                            GameController.Instance.ResetInputLocks();
                            return;
                        }
                    }
                    else
                    {
                        Randomizer.LockedCount = 0;
                    }
                }
            }
        }
        Randomizer.LastTick = tick;
    }
    public static void GivePickup(RandomizerAction Action, int coords, bool found_locally = true)
    {
        try {
            if (found_locally && Randomizer.Sync)
            {
                RandomizerSyncManager.FoundPickup(Action, coords);
            }

            switch (Action.Action)
            {
            case "RP":
            case "MU":
                string[] pieces = ((string)Action.Value).Split('/');
                for (int i = 0; i < pieces.Length; i += 2)
                {
                    string code = pieces[i];
                    if (Randomizer.StringKeyPickupTypes.Contains(code))
                    {
                        RandomizerSwitch.GivePickup(new RandomizerAction(code, pieces[i + 1]), coords, found_locally);
                    }
                    else
                    {
                        int id;
                        int.TryParse(pieces[i + 1], out id);
                        RandomizerSwitch.GivePickup(new RandomizerAction(code, id), coords, found_locally);
                    }
                }
                break;

            case "AC":
                SkillPointPickup();
                break;

            case "EC":
                MaxEnergyContainerPickup();
                break;

            case "EX":
                ExpOrbPickup((int)Action.Value);
                break;

            case "KS":
                KeystonePickup();
                break;

            case "HC":
                MaxHealthContainerPickup();
                break;

            case "MS":
                MapStonePickup();
                break;

            case "SK":
                AbilityPickup((int)Action.Value);
                break;

            case "EV":
                EventPickup((int)Action.Value);
                break;

            case "RB":
                RandomizerBonus.UpgradeID((int)Action.Value);
                break;

            case "TP":
                TeleportPickup((string)Action.Value);
                break;

            case "SH":
                Randomizer.showHint((string)Action.Value);
                break;

            case "WT":
                Characters.Sein.Inventory.IncRandomizerItem(302, 1);
                int relics = Characters.Sein.Inventory.GetRandomizerItem(302);
                RandomizerTrackedDataManager.SetRelic(Randomizer.RelicZoneLookup[(string)Action.Value]);
                string relicStr = "\n(" + relics.ToString() + "/" + Randomizer.RelicCount.ToString() + ")";
                if (relics >= Randomizer.RelicCount)
                {
                    relicStr = "$" + relicStr + "$";
                }
                Randomizer.showHint((string)Action.Value + relicStr, 480);
                break;

            case "WS":
            case "WP":
                Randomizer.SaveAfterWarp = Action.Action == "WS";
                string[] xy = ((string)Action.Value).Split(',');
                Randomizer.WarpTo(new UnityEngine.Vector3(float.Parse(xy[0]), float.Parse(xy[1])), 15);
                break;

            case "NO":
                break;
            }
            RandomizerTrackedDataManager.UpdateBitfields();
        }
        catch (Exception e) {
            Randomizer.LogError("Give Pickup: " + e.Message);
        }
    }