Пример #1
0
function adr_zone_cheat_imprison($celled_id, $submit, $user_id)
{
    global $board_config, $lang, $HTTP_POST_VARS, $userdata;
    if (!$celled_id) {
        message_die(GENERAL_ERROR, 'No User Selected!', 'Error');
    }
    #==== End: Add By aUsTiN =============================== |
    #======================================================= |
    $time_day = intval($HTTP_POST_VARS['time_day']);
    $time_hour = intval($HTTP_POST_VARS['time_hour']);
    $time_minute = intval($HTTP_POST_VARS['time_minute']);
    $caution = intval($HTTP_POST_VARS['caution']);
    $cautionable = intval($HTTP_POST_VARS['cautionable']);
    $freeable = intval($HTTP_POST_VARS['freeable']);
    $punishment = intval($HTTP_POST_VARS['punishment']);
    $sentence = addslashes(stripslashes($HTTP_POST_VARS['sentence']));
    if ($time_day == '' && $time_hour == '' && $time_minute == '' || !$punishment) {
        message_die(MESSAGE, $lang['Fields_empty']);
    }
    // Modified for ADR Zones Test Board
    if ($userdata['user_level'] == ADMIN) {
        adr_cell_imprison_user($celled_id, $time_day, $time_hour, $time_minute, $caution, $cautionable, $freeable, $sentence, $punishment);
    } else {
        if ($submit && $userdata['user_level'] != ADMIN) {
            $message = 'You are unable to change settings!!  You are ONLY allowed to view the Zone MOD ACP Settings!';
            message_die(GENERAL_ERROR, $message);
        }
    }
    // Modified for ADR Zones Test Board
}
Пример #2
0
function adr_steal_item($user_id, $item_id, $shop_owner_id, $shop_id)
{
    global $db, $lang, $phpEx, $adr_general, $board_config, $store_id;
    // Fix the values
    $user_id = intval($user_id);
    $item_id = intval($item_id);
    $shop_owner_id = intval($shop_owner_id);
    $shop_id = intval($shop_id);
    if ($shop_owner_id != 1) {
        $direction = append_sid("adr_shops.{$phpEx}?mode=see_shop&shop_id=" . $shop_id);
    } else {
        $direction = append_sid("adr_shops.{$phpEx}?mode=view_store&shop_id=" . $shop_id);
    }
    // Check if stealing is enabled by admin
    if (!$adr_general['allow_shop_steal']) {
        $message = sprintf($lang['Adr_steal_item_forbidden'], $sum, $points_name);
        $message .= '<br /><br />' . sprintf($lang['Adr_return'], "<a href=\"" . $direction . "\">", "</a>");
        message_die(GENERAL_MESSAGE, $message);
    }
    // Check if user is high enough lvl to be allowed steal attempt
    if ($adr_general['Adr_shop_steal_min_lvl'] > '0') {
        $adr_user = adr_get_user_infos($user_id);
        if ($adr_user['character_level'] < $adr_general['Adr_shop_steal_min_lvl']) {
            $message = $lang['Adr_shop_steal_min_lvl'] . '<br /><br />';
            $message .= sprintf($lang['Adr_shop_steal_min_lvl2'], '<b>', $adr_general['Adr_shop_steal_min_lvl'], '</b>');
            $message .= '<br /><br />' . sprintf($lang['Adr_return'], "<a href=\"" . $direction . "\">", "</a>");
            message_die(GENERAL_MESSAGE, $message);
        }
    }
    $sql = "SELECT character_thief_limit FROM " . ADR_CHARACTERS_TABLE . "\n\t\tWHERE character_id = {$user_id} ";
    $result = $db->sql_query($sql);
    if (!$result) {
        message_die(GENERAL_ERROR, 'Could not obtain thief limit info', "", __LINE__, __FILE__, $sql);
    }
    $thief_limit = $db->sql_fetchrow($result);
    if ($adr_general['Adr_character_limit_enable'] != 0 && $thief_limit['character_thief_limit'] < 1) {
        adr_previous(Adr_thief_limit, adr_shops, '');
    }
    // Select the item infos
    $shop_more_sql = $shop_owner_id != '1' ? 'AND item_in_shop = 1' : '';
    $sql = "SELECT * FROM " . ADR_SHOPS_ITEMS_TABLE . "\n\t\tWHERE item_owner_id = '{$shop_owner_id}'\n\t\tAND item_id = '{$item_id}'\n\t\t{$shop_more_sql}";
    $result = $db->sql_query($sql);
    if (!$result) {
        message_die(GENERAL_ERROR, 'Could not obtain shops items information', "", __LINE__, __FILE__, $sql);
    }
    $item_data = $db->sql_fetchrow($result);
    // Check item is stealable
    if ($item_data['item_steal_dc'] == '0' && $shop_owner_id == '1') {
        //		adr_previous(Adr_store_not_stealable, shops, "view_store&amp;shop_id=".$shop_id."", '', 'adr/images/store_owners/'.$store_info['shop_logo'].'');
        adr_previous(Adr_store_not_stealable, adr_shops);
    }
    // Check for successful steal or not
    $success = adr_use_skill_thief($user_id, $item_data['item_steal_dc']);
    if ($success == TRUE) {
        // Make the new id for the item
        $sql = "SELECT item_id FROM " . ADR_SHOPS_ITEMS_TABLE . "\n\t\t\tWHERE item_owner_id = '{$user_id}'\n\t\t\tORDER BY item_id\n\t\t\tDESC LIMIT 1";
        $result = $db->sql_query($sql);
        if (!$result) {
            message_die(GENERAL_ERROR, 'Could not obtain item information', "", __LINE__, __FILE__, $sql);
        }
        $data = $db->sql_fetchrow($result);
        $new_item_id = $data['item_id'] + 1;
        if ($shop_owner_id != '1') {
            // This will never be TRUE as of v0.4.3 because there is no player store stealing allowed
            $sql = "UPDATE " . ADR_SHOPS_ITEMS_TABLE . "\n\t\t\t\tSET item_owner_id = {$user_id},\n\t\t\t\t\titem_id = {$new_item_id},\n\t\t\t\t\titem_bought_timestamp = " . time() . ",\n\t\t\t\t\titem_in_shop = '0', \n\t\t\t\t\titem_auth = '0'\n\t\t\t\t\titem_stolen_by = '',\n\t\t\t\t\titem_stolen_timestamp = " . time . "\n\t\t\t\tWHERE item_owner_id = '{$shop_owner_id}'\n\t\t\t\tAND item_id = '{$item_id}'";
            $result = $db->sql_query($sql);
            if (!$result) {
                message_die(GENERAL_ERROR, 'Could not obtain shops items information', "", __LINE__, __FILE__, $sql);
            }
        } else {
            // Insert item details
            $type = 1;
            //This is so the insert function knows that this is a stolen item for update purposes only (optional function variable)
            adr_shop_insert_item($item_id, $new_item_id, $user_id, $shop_owner_id, $type, $shop_id);
        }
        adr_thief_limit($user_id);
        adr_store_stats_update_steal($success, $user_id, $shop_owner_id, $store_id);
        $message = sprintf($lang['Adr_steal_item_success'], $sum, $points_name);
        $message .= '<br /><br />' . sprintf($lang['Adr_return'], "<a href=\"" . $direction . "\">", "</a>");
        message_die(GENERAL_MESSAGE, $message);
    } else {
        $message = sprintf($lang['Adr_steal_item_failure'], $sum, $points_name);
        if ($adr_general['skill_thief_failure_damage']) {
            // Select the item price
            $shop_more_sql = $shop_owner_id != 1 ? 'AND i.item_in_shop = 1' : '';
            // Prevents users to buy items not in shops
            $sql = "SELECT i.item_price, i.item_name, u.user_points FROM " . ADR_SHOPS_ITEMS_TABLE . " i , " . USERS_TABLE . " u\n\t\t\t\tWHERE i.item_owner_id = {$shop_owner_id}\n\t\t\t\t\tAND u.user_id = {$user_id}\n\t\t\t\t\tAND i.item_id = {$item_id} \n\t\t\t\t{$shop_more_sql} ";
            $result = $db->sql_query($sql);
            if (!$result) {
                message_die(GENERAL_ERROR, 'Could not obtain shops items information', "", __LINE__, __FILE__, $sql);
            }
            $data = $db->sql_fetchrow($result);
            $user_points = $data['user_points'];
            $price = $data['item_price'];
            $fine = $price < intval($adr_general['skill_thief_failure_damage']) ? intval($adr_general['skill_thief_failure_damage']) : $price;
            if ($fine > $user_points && $adr_general['skill_thief_failure_punishment']) {
                $sql = " SELECT owner_id , account_sum FROM " . ADR_VAULT_USERS_TABLE . "\n\t\t\t\t\t\tWHERE owner_id = {$user_id} ";
                if (!($result = $db->sql_query($sql))) {
                    message_die(GENERAL_ERROR, 'Could not query user stats page', '', __LINE__, __FILE__, $sql);
                }
                $vault_sum = $db->sql_fetchrow($result);
                if ($adr_general['skill_thief_failure_punishment'] == 1) {
                    if (is_numeric($vault_sum['owner_id']) && $vault_sum['account_sum'] >= $fine) {
                        $vault_fine = $fine;
                        $fine = 0;
                        // Remove cash from Vault instead
                        $sql = "UPDATE " . ADR_VAULT_USERS_TABLE . "\n\t\t\t\t\t\t\tSET account_sum = account_sum - {$vault_fine}\n\t\t\t\t\t\t\tWHERE owner_id = {$user_id} ";
                        if (!$db->sql_query($sql)) {
                            message_die(GENERAL_ERROR, 'Could not update user points from Vault', "", __LINE__, __FILE__, $sql);
                        }
                    } elseif (is_numeric($vault_sum['owner_id']) && $vault_sum['account_sum'] > 0 && $vault_sum['account_sum'] < $fine) {
                        $vault_fine = $vault_sum['account_sum'];
                        $fine = 0;
                        // Remove cash from Vault instead
                        $sql = "UPDATE " . ADR_VAULT_USERS_TABLE . "\n\t\t\t\t\t\t\tSET account_sum = account_sum - {$vault_fine}\n\t\t\t\t\t\t\tWHERE owner_id = {$user_id} ";
                        if (!$db->sql_query($sql)) {
                            message_die(GENERAL_ERROR, 'Could not update user points from Vault', "", __LINE__, __FILE__, $sql);
                        }
                    } else {
                        $fine = $user_points;
                        $vault_fine = 0;
                    }
                } else {
                    if ($adr_general['skill_thief_failure_punishment'] == 2) {
                        adr_cell_imprison_user($user_id, 0, $adr_general['skill_thief_failure_time'], 0, $price, 1, 1, $lang['Adr_steal_item_failure_critical_all_sentence'], $adr_general['skill_thief_failure_type']);
                        $failure[0] = $lang['Adr_steal_item_failure_critical_all'];
                        $failure[1] = $lang['Adr_steal_item_failure_critical_post'];
                        $failure[2] = $lang['Adr_steal_item_failure_critical_read'];
                        $fail = $failure[$adr_general['skill_thief_failure_type']];
                        $fail_message = sprintf($lang['Adr_steal_item_failure_critical'], '<b>', adr_get_lang($data['item_name']), '</b>') . '<br /><br />' . $fail;
                        $fail_message .= '<br /><br />' . sprintf($lang['Adr_return'], "<a href=\"" . $direction . "\">", "</a>");
                        message_die(GENERAL_MESSAGE, $fail_message);
                    }
                }
            }
            adr_thief_limit($user_id);
            adr_store_stats_update_steal($success, $user_id, $shop_owner_id, $store_id);
            subtract_reward($user_id, $fine);
        }
        if ($fine != 0) {
            $fine = $fine;
        } else {
            $fine = $vault_fine;
        }
        $message .= '<br /><br />' . sprintf($lang['Adr_steal_item_failure_suite'], $fine, $points_name);
        $message .= '<br /><br />' . sprintf($lang['Adr_return'], "<a href=\"" . $direction . "\">", "</a>");
        message_die(GENERAL_MESSAGE, $message);
    }
}
Пример #3
0
     message_die(GENERAL_ERROR, 'No User Selected!', 'Error');
 }
 #==== End: Add By aUsTiN =============================== |
 #======================================================= |
 $time_day = intval($HTTP_POST_VARS['time_day']);
 $time_hour = intval($HTTP_POST_VARS['time_hour']);
 $time_minute = intval($HTTP_POST_VARS['time_minute']);
 $caution = intval($HTTP_POST_VARS['caution']);
 $cautionable = intval($HTTP_POST_VARS['cautionable']);
 $freeable = intval($HTTP_POST_VARS['freeable']);
 $punishment = intval($HTTP_POST_VARS['punishment']);
 $sentence = addslashes(stripslashes($HTTP_POST_VARS['sentence']));
 if ($time_day == '' && $time_hour == '' && $time_minute == '' || !$punishment) {
     message_die(MESSAGE, $lang['Fields_empty']);
 }
 adr_cell_imprison_user($celled_id, $time_day, $time_hour, $time_minute, $caution, $cautionable, $freeable, $sentence, $punishment);
 $sql = "SELECT * FROM " . ADR_CHEAT_LOG_TABLE . "\r\n\t\t\t\t\t\tWHERE cheat_id = '{$cheat_id}'";
 $result = $db->sql_query($sql);
 if (!$result) {
     message_die(GENERAL_ERROR, "Couldn't get cheat log info", "", __LINE__, __FILE__, $sql);
 }
 $cheat_info = $db->sql_fetchrow($result);
 $cheat_punishment_array = explode('~', $cheat_info['cheat_punished']);
 $cheat_punishment_array[2] = '1';
 $cheat_punishment_array[3] = 'Imprisoned for ';
 if ($time_day) {
     if ($time_day > 1) {
         $cheat_punishment_array[3] .= $time_day . ' Days';
     } else {
         $cheat_punishment_array[3] .= $time_day . ' Day';
     }