About this mod
Makes blueprint and rune progression a bit faster
- Requirements
- Permissions and credits
Bronze chests now drop 1/4th the ore and red aether as a silver chest and fairy chest does.
Silver chests now drop the same amount of red aether as a fairy chest does
Fairy chests now drop the same amount of ore as a silver chest does
Additionally, Bronze chests have an additional 10% chance to drop an eligible blueprint, and a 10% chance to drop an eligible rune.
Installation:
- Install RL2 ModLoader: https://github.com/RL2-API/RL2.ModLoader
- Download the mod file FasterBlueprints.zip
- Move the dll and json file to the RL2 "Mods" folder
Example path for Steam: C:\Program Files (x86)\Steam\steamapps\common\Rogue Legacy 2\Rogue Legacy 2_Data\Mods
Supported versions:
The mod is built and tested for Rogue Legacy 2 version V1.2.2a-steam and RL2 ModLoader version V.1.0.4
Source code: (can't be bothered making a github repo)
using System;
using System.Collections;
using UnityEngine;
using Random = UnityEngine.Random;
namespace FasterBlueprints;
[ModEntrypoint]
public class Main
{
private readonly WaitUntil _disableInputYield = new ((Func<bool>) (() => RewiredMapController.IsMapEnabled(GameInputMode.Game)));
private readonly WaitRL_Yield _waitYield = new (0.0f);
public Main()
{
Messenger<GameMessenger, GameEvent>.AddListener(GameEvent.ChestOpened, OnChestOpened);
void OnChestOpened(MonoBehaviour arg1, EventArgs arg2)
{
if (arg1 is not ChestObj chestObj || arg2 is not ChestOpenedEventArgs eventArgs)
return;
// Drop rune or equipment
if (chestObj.ChestType == ChestType.Bronze && eventArgs.SpecialItemType is SpecialItemType.None or SpecialItemType.Gold)
{
var drop = Random.Range(0f, 1f) switch
{
< 0.1f => (ISpecialItemDrop) SpecialItemDropUtility.GetBlueprintDrop(chestObj.Level, ChestType_RL.GetChestRarity(chestObj.ChestType)),
< 0.2f => (ISpecialItemDrop) SpecialItemDropUtility.GetRuneDrop(chestObj.Level),
_ => null,
};
chestObj.StartCoroutine(SpecialDropCoroutine(drop));
}
// Drop ore
var dropPosition = chestObj.transform.position;
dropPosition.y++;
int equipmentOreToDrop = 0;
var runeOreToDrop = 0;
switch (chestObj.ChestType)
{
case ChestType.Bronze:
// 1/4th of silver chest
equipmentOreToDrop =
Mathf.CeilToInt(GetOreDropAmount(ItemDropType.EquipmentOre, chestObj.Level) * 0.6f * 0.25f);
// 1/4th of fairy chest
runeOreToDrop = Mathf.CeilToInt(GetOreDropAmount(ItemDropType.RuneOre, chestObj.Level) * 0.25f);
break;
case ChestType.Silver:
// Same as fairy chest
runeOreToDrop = GetOreDropAmount(ItemDropType.RuneOre, chestObj.Level);
break;
case ChestType.Fairy:
// Same as silver chest
equipmentOreToDrop =
Mathf.CeilToInt(GetOreDropAmount(ItemDropType.EquipmentOre, chestObj.Level) * 0.6f);
break;
}
Drop(ItemDropType.EquipmentOre, equipmentOreToDrop);
Drop(ItemDropType.RuneOre, runeOreToDrop);
void Drop(ItemDropType type, int amount)
{
if (amount < 1)
return;
ItemDropManager.DropItem(type, amount, dropPosition,
TraitManager.IsTraitActive(TraitType.ItemsGoFlying), fromChest: true);
}
// Derived from special drop case of ChestObj's OpenChestAnimCoroutine
IEnumerator SpecialDropCoroutine(ISpecialItemDrop? item)
{
if (item == null)
yield break;
yield return (object?) null;
var playerController = PlayerManager.GetPlayerController();
var chestAnimator = chestObj.GetComponentInChildren<Animator>();
GameManager.SetIsPaused(true);
AnimatorUpdateMode storedPlayerUpdateMode = playerController.Animator.updateMode;
AnimatorUpdateMode storedChestUpdateMode = chestAnimator.updateMode;
playerController.Animator.updateMode = AnimatorUpdateMode.UnscaledTime;
chestAnimator.updateMode = AnimatorUpdateMode.UnscaledTime;
playerController.CharacterMove.SetHorizontalMove(0.0f);
playerController.Animator.SetBool("Victory", true);
_waitYield.CreateNew(0.5f, true);
yield return (object) _waitYield;
ItemDropManager.DropSpecialItem(item);
yield return (object)_disableInputYield;
RewiredMapController.SetMapEnabled(GameInputMode.Game, false);
GameManager.SetIsPaused(true);
playerController.Animator.SetBool("Victory", false);
_waitYield.CreateNew(0.5f, true);
yield return (object) _waitYield;
playerController.CharacterHitResponse.SetInvincibleTime(1f, false, false);
RewiredMapController.SetMapEnabled(GameInputMode.Game, true);
GameManager.SetIsPaused(false);
playerController.Animator.updateMode = storedPlayerUpdateMode;
chestAnimator.updateMode = storedChestUpdateMode;
}
// Derived from from ChestObj.GetOreDropAmount
int GetOreDropAmount(ItemDropType oreDropType, int chestLevel)
{
int num1 = oreDropType == ItemDropType.RuneOre ? 170 : 190;
float num2 = oreDropType == ItemDropType.RuneOre ? 2.25f : 5.1f;
return (int)((double)num1 + (double)chestLevel * (double)num2);
}
}
}
}