<?php

if (isset($args['applyall']) && $args['applyall']) {
    $buffs = array('attack' => 'attack', 'defense' => 'defense', 'charm' => 'charm', 'hitpoints' => 'maxhitpoints', 'turns' => 'turns', 'favor' => 'deathpower');
    require_once "modules/mysticalshop/lib.php";
    $args = mysticalshop_applyenh($buffs, $args);
    $args['applyall'] = false;
}
            }
            $rare = FALSE;
            if (get_module_setting('dkreaddrare') && $row['rare']) {
                $rare = $id;
            }
            require_once "modules/mysticalshop/lib.php";
            mysticalshop_destroyitem($item, $rare);
            if (!$autolose) {
                output_notl('`3%s`0`n', $lose_message[$item]);
            }
        }
    }
}
// --------------------------------Restore Stats--------------------------------
if (get_module_setting('restoreAll') && get_module_pref('restoreIndiv') == 0 || get_module_pref('restoreIndiv') == 1) {
    $buffs = array('attack' => 'attack', 'defense' => 'defense', 'turns' => 'turns', 'favor' => 'deathpower');
    if (!is_module_active('globalhp') || !get_module_setting('carrydk', 'globalhp')) {
        $buffs['hitpoints'] = 'maxhitpoints';
    }
    // don't re-add hitpoints if they are not reset at DK
    // Charm doesn't get reset at DK, no need to restore it.
    require_once "modules/mysticalshop/lib.php";
    mysticalshop_applyenh($buffs, false);
}
//------------------------------------------------------------------------------
if (get_module_pref("turnadd") < 0) {
    set_module_pref("turnadd", 0);
}
if ($session['user']['hitpoints'] < 1) {
    $session['user']['hitpoints'] = 1;
}