@Override
    public void toggled() {
        if (!hasBeenOpened) {
            //first time openeing - set item levels to player level +3
            Player p = registry.getPlayerManager().getCurrentPlayer();
            
            for (int i = 0; i < inventorySize; i++) {
                int qty = inventory.getQtyFromSlot(i);
                if (qty > 0) {
                    int level = 1;
                    int levelCheck = Rand.getRange(1, 100);

                    if (p != null) {
                        level = p.getLevel();
                        if (levelCheck > 90) {
                            level += 3;
                        } else if (levelCheck > 75) {
                            level += 2;
                        } else if (levelCheck > 50) {
                            level += 1;
                        }
                    }
                    if (level < 1) {
                        level = 1;
                    }
                    if (level > 20) {
                        level = 20;
                    }
                    inventory.setLevelFromSlot(i, level);
                }
            }
            
            hasBeenOpened = true;
        }
    }