mr:chests
Table of Contents
Chests - Code References
Java Classes
- Heap Types: Heap.java - Defines CHEST, LOCKED_CHEST, CRYSTAL_CHEST types
- Open Chest Action: OpenChest.java - Handles chest opening logic
- Level Treasure: Level.java - Locked/crystal chest handling
- Room Painters: Various painters place chests:
- VaultPainter.java - Places LOCKED_CHEST and CRYSTAL_CHEST
- TreasuryPainter.java - Places CHEST (may spawn Mimic)
- PoolPainter.java - Places CHEST
- TrapsPainter.java - Places CHEST
- RatKingPainter.java - Places CHEST (may spawn Mimic)
Java Class Content
// Heap.java - Chest type definitions public enum Type { // ... CHEST, LOCKED_CHEST, CRYSTAL_CHEST, // ... } // Heap.java - Chest spawn weights static { regularHeaps.put(Type.CHEST, 4f); sageHeaps.put(Type.CHEST, 4f); } // OpenChest.java - Chest opening logic public class OpenChest extends CharAction { public OpenChest(int dst) { // ... if (heap != null && (heap.type == Heap.Type.CHEST || heap.type == Heap.Type.TOMB || heap.type == Heap.Type.SKELETON || heap.type == Heap.Type.LOCKED_CHEST || heap.type == Heap.Type.CRYSTAL_CHEST || heap.type == Heap.Type.MIMIC)) { // Handle chest opening if (heap.type == Heap.Type.LOCKED_CHEST || heap.type == Heap.Type.CRYSTAL_CHEST) { // Requires key if (!hasKey) { GLog.w(StringsManager.getVar(R.string.Hero_LockedChest)); } } } } }
Key Properties from Code
- Chest Types:
- `CHEST` - Regular chest, can be opened freely
- `LOCKED_CHEST` - Requires skeleton key to open
- `CRYSTAL_CHEST` - Requires crystal key to open
- `MIMIC` - May appear instead of CHEST (hostile monster)
- Spawn Weights: CHEST has weight of 4f in regular and sage heap distributions
- Key Requirement: LOCKED_CHEST and CRYSTAL_CHEST require corresponding keys
- Mimic Chance: Some chest spawns may be replaced by Mimics
JSON Configuration
- Level configurations that may include treasure: levelsDesc/
- Chest contents are generated dynamically by the Generator class
String Resources
<!-- English strings --> <string name="Hero_LockedChest">This chest is locked and you don't have a key</string> <string name="WndInfoItem_Chest">Chest</string> <string name="WndInfoItem_CrystalChest">Crystal chest</string> <string name="WndInfoItem_LockedChest">Locked chest</string>
Lua Scripts
This entity is implemented in Java, no Lua script exists
Sprite References
Related Entities
- Mimic: mimic_mob - May appear instead of chest
- Skeleton Key: skeleton_key_item - Opens LOCKED_CHEST
- Crystal Key: crystal_key_item - Opens CRYSTAL_CHEST
- English Page: chests
- Russian Page: chests
mr/chests.txt · Last modified: by 127.0.0.1



