Table of Contents

Chests - Code References

Java Classes

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

JSON Configuration

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