Skip to content

worldspawn-web/rarity_force

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rarity Force

Thunderstore Version BepInEx

A mod for Megabonk that allows you to force rarity for chests and Moai.

Controls

Key Action
F1 Toggle forced rarity ON/OFF
F2 Toggle sound effects ON/OFF
Mouse Wheel Up Next rarity (Common → Uncommon → Rare → Legendary)
Mouse Wheel Down Previous rarity (Legendary → Rare → Uncommon → Common)

📋 Requirements

  • Megabonk (Steam version)
  • BepInEx 6.0.0+ (Unity IL2CPP version)

Installation

Automatic (Recommended)

  1. Install r2modman or Thunderstore Mod Manager
  2. Search for RarityForce in the mod manager
  3. Click "Install"
  4. Launch the game through the mod manager

Manual

  1. Download and install BepInEx 6.0.0+ IL2CPP for your game
  2. Run the game once to generate BepInEx folders
  3. Download the latest release from Thunderstore or GitHub Releases
  4. Extract RarityForce.dll into BepInEx/plugins/ folder
  5. Launch the game

Building from Source

  1. Clone the repository:

    git clone https://github.com/worldspawn-web/rarity_force.git
    cd rarity_force
  2. Copy required DLLs from your Megabonk installation to libs/ folder:

    • BepInEx/core/BepInEx.Core.dll
    • BepInEx/core/BepInEx.Unity.IL2CPP.dll
    • BepInEx/core/0Harmony.dll
    • BepInEx/core/Il2CppInterop.Runtime.dll
    • BepInEx/interop/UnityEngine.dll
    • BepInEx/interop/UnityEngine.CoreModule.dll
    • BepInEx/interop/Assembly-CSharp.dll
    • BepInEx/interop/Il2Cppmscorlib.dll
  3. Build the project:

    dotnet build -c Release

    Or use the build script:

    • Windows: build.bat
    • Linux/Mac: ./build.sh
  4. The compiled DLL will be in bin/Release/net6.0/RarityForce.dll

How It Works

The mod uses Harmony to patch the game's GetItemRarity method. When forced rarity is enabled (F1), it overrides the game's random rarity selection with your chosen rarity.

Technical Details:

  • Patches Assets.Scripts.Inventory__Items__Pickups.Rarity.GetItemRarity()
  • Uses reflection to access Unity's Input system for IL2CPP compatibility
  • Asynchronous sound playback via Task.Run() to prevent game freezing

About

Megabonk mod that allows to manipulate next rarity. Works with chests and Moai.

Topics

Resources

Stars

Watchers

Forks

Contributors

Languages