function es_bridge_gp_dohook($hook, $args)
{
    global $session, $baseaccount;
    $item = httpget('item');
    $action = httpget('action');
    if ($session['user']['armor'] != $baseaccount['armor'] && ($action == 'weararmor' || $action == 'buyarmor') && $session['user']['armor'] == $item) {
        $category = 'armor';
        $defense = $session['user']['defense'];
    } elseif ($session['user']['weapon'] != $baseaccount['weapon'] && ($action == 'wearweapon' || $action == 'buyweapon') && $session['user']['weapon'] == $item) {
        $category = 'weapon';
        $attack = $session['user']['attack'];
    } else {
        $category = false;
    }
    if ($category && get_module_pref($category, 'mysticalshop')) {
        $current_id = get_module_pref($category . 'id', 'mysticalshop');
        debug("Current ID is {$current_id}");
        require_once './modules/mysticalshop/lib.php';
        mysticalshop_destroyitem($category);
        mysticalshop_resetbuffs($current_id);
        require_once './modules/mysticalshop_buffs/stripbuff.php';
        mysticalshop_buffs_stripbuff();
        if ($category == 'armor') {
            $session['user']['defense'] = $defense;
        } else {
            $session['user']['attack'] = $attack;
        }
        debuglog('es_bridge_gp: ' . $category . ' (ID: ' . $current_id . ') item removed on action "' . $action . '".');
    }
    return $args;
}
        $sql = "SELECT buffid FROM " . db_prefix("magicitems") . " WHERE id={$id}";
        $result = db_query($sql);
        $row = db_fetch_assoc($result);
        $buffid = $row['buffid'];
        if ($buffid > 0) {
            strip_buff("mystical-{$buffid}");
        }
    }
    if (get_module_pref("misc", "mysticalshop") == 0) {
        $id = get_module_pref("miscid", "mysticalshop");
        $sql = "SELECT buffid FROM " . db_prefix("magicitems") . " WHERE id={$id}";
        $result = db_query($sql);
        $row = db_fetch_assoc($result);
        $buffid = $row['buffid'];
        if ($buffid > 0) {
            strip_buff("mystical-{$buffid}");
        }
    }
    if (get_module_pref("helm", "mysticalshop") == 0) {
        $id = get_module_pref("helmid", "mysticalshop");
        $sql = "SELECT buffid FROM " . db_prefix("magicitems") . " WHERE id={$id}";
        $result = db_query($sql);
        $row = db_fetch_assoc($result);
        $buffid = $row['buffid'];
        if ($buffid > 0) {
            strip_buff("mystical-{$buffid}");
        }
    }
}
mysticalshop_buffs_stripbuff();