Exemple #1
0
    }
    add_reward($user_id, $loan_sum);
    $sql = "UPDATE " . ADR_VAULT_USERS_TABLE . "\n\t\tSET loan_sum = {$loan_sum} ,\n\t\tloan_time = " . time() . "\n\t\tWHERE owner_id = {$user_id}";
    if (!$db->sql_query($sql)) {
        message_die(GENERAL_ERROR, 'Could not obtain accounts information', "", __LINE__, __FILE__, $sql);
    }
    $message = $lang['Adr_vault_loan_ok'] . $loan_sum . ' ' . get_reward_name();
    $message .= '<br /><br />' . sprintf($lang['Adr_return'], "<a href=\"" . append_sid("adr_vault.{$phpEx}") . "\">", "</a>");
    message_die(GENERAL_MESSAGE, $message);
}
if ($loan_back) {
    $pay_off = $vault['loan_sum'] * (1 + $vault_general['loan_interests'] / 100);
    if ($pay_off > $userdata['user_points']) {
        adr_previous(Adr_vault_loan_lack_points, adr_vault, '');
    }
    subtract_reward($user_id, $pay_off);
    $sql = "UPDATE " . ADR_VAULT_USERS_TABLE . "\n\t\tSET loan_sum = 0,\n\t\tloan_time = 0\n\t\tWHERE owner_id = {$user_id}";
    if (!$db->sql_query($sql)) {
        message_die(GENERAL_ERROR, 'Could not obtain accounts information', "", __LINE__, __FILE__, $sql);
    }
    adr_previous(Adr_vault_loan_pay_off_ok, adr_vault, '');
}
$sql = "SELECT * FROM " . ADR_VAULT_USERS_TABLE;
if (!($result = $db->sql_query($sql))) {
    message_die(CRITICAL_ERROR, 'Error Getting Vault Users!');
}
$vault_stats = $db->sql_fetchrowset($result);
$opened_accounts = 0;
$total_deposit = 0;
for ($i = 0; $i < count($vault_stats); $i++) {
    $opened_accounts = $opened_accounts + 1;
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&amp;shop_id=" . $shop_id);
    } else {
        $direction = append_sid("adr_shops.{$phpEx}?mode=view_store&amp;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);
    }
}
Exemple #3
0
function adr_character_replen_quota()
{
    global $db, $phpEx, $adr_general, $board_config, $lang, $table_prefix, $phpbb_root_path;
    // define some constants
    define('ADR_SHOPS_TABLE', $table_prefix . 'adr_shops');
    define('IN_ADR_SETTINGS', 1);
    define('IN_ADR_VAULT', 1);
    define('IN_ADR_BATTLE', 1);
    define('IN_ADR_CHARACTER', 1);
    $sql = "SELECT * FROM " . ADR_CHARACTERS_TABLE . "";
    $result = $db->sql_query($sql);
    if (!$result) {
        message_die(GENERAL_ERROR, 'Could not obtain character list', '', __LINE__, __FILE__, $sql);
    }
    $characters = $db->sql_fetchrowset($result);
    for ($c = 0; $c < count($characters); $c++) {
        if ($characters[$c]['character_id'] != '0' && $characters[$c]['character_id'] != '') {
            // Define some variables
            $character_id = $characters[$c]['character_id'];
            $points = get_reward($character_id);
            $adr_user['character_birth'] = $characters[$c]['character_birth'];
            $adr_user['character_limit_update'] = $characters[$c]['character_limit_update'];
            $adr_user['character_warehouse_update'] = $characters[$c]['character_warehouse_update'];
            $adr_user['character_warehouse'] = $characters[$c]['character_warehouse'];
            $adr_user['character_shop_update'] = $characters[$c]['character_shop_update'];
            $pm_wh = FALSE;
            $pm_shop = FALSE;
            $wh_msg = '';
            $shop_msg = '';
            // Vault account check
            $sql = "SELECT account_sum FROM " . ADR_VAULT_USERS_TABLE . "\n\t\t\t\tWHERE owner_id = '{$character_id}'";
            if (!($result = $db->sql_query($sql))) {
                message_die(GENERAL_ERROR, 'Could not query vault user table', '', __LINE__, __FILE__, $sql);
            }
            $vault_check = $db->sql_fetchrow($result);
            // Shop stats check
            $sql = "SELECT shop_id FROM " . ADR_SHOPS_TABLE . "\n\t\t\t\tWHERE shop_owner_id = '{$character_id}'";
            if (!($result = $db->sql_query($sql))) {
                message_die(GENERAL_ERROR, 'Could not query shops table', '', __LINE__, __FILE__, $sql);
            }
            $shop_check = $db->sql_fetchrow($result);
            // Work out how many days have passed since character_creation
            $character_days = floor((time() - $adr_user['character_birth']) / 86400);
            // START battle & skill regening
            if (is_numeric($character_id) && $adr_general['Adr_character_limit_enable'] != '0' && $character_days > $adr_user['character_limit_update'] + ($adr_general['Adr_limit_regen_duration'] - 1)) {
                $new_battle_limit = $adr_general['Adr_character_battle_limit'];
                $new_skill_limit = $adr_general['Adr_character_skill_limit'];
                $new_trading_limit = $adr_general['Adr_character_trading_limit'];
                $new_thief_limit = $adr_general['Adr_character_thief_limit'];
                $sql = " UPDATE " . ADR_CHARACTERS_TABLE . "\n\t\t\t\t\tSET character_battle_limit = {$new_battle_limit},\n\t\t\t\t\t\tcharacter_skill_limit = {$new_skill_limit},\n\t\t\t\t\t\tcharacter_trading_limit = {$new_trading_limit},\n\t\t\t\t\t\tcharacter_thief_limit = {$new_thief_limit},\n\t\t\t\t\t\tcharacter_limit_update = {$character_days}\n\t\t\t\t\tWHERE character_id = '{$character_id}'";
                if (!($results = $db->sql_query($sql))) {
                    message_die(GENERAL_MESSAGE, 'Error regening user battle & skill limits');
                }
            }
            // END battle & skill regening
            // START warehouse tax check
            if (is_numeric($character_id) && $character_days > $adr_user['character_warehouse_update'] + ($board_config['Adr_warehouse_duration'] - 1)) {
                $warehouse_days = $character_days - ($adr_user['character_warehouse_update'] + ($board_config['Adr_warehouse_duration'] - 1));
                $warehouse_tax = $board_config['Adr_warehouse_tax'] * $warehouse_days;
                if ($adr_user['character_warehouse'] != '0' && $board_config['Adr_warehouse_tax'] > '0') {
                    if ($points >= $warehouse_tax) {
                        // Remove tax from user_points
                        subtract_reward($character_id, $warehouse_tax);
                        $wh_msg = sprintf($lang['Adr_character_warehouse_tax'], $warehouse_tax, get_reward_name());
                    } elseif ($points < $warehouse_tax && is_numeric($vault_check['account_sum']) && $vault_check['account_sum'] >= $warehouse_tax) {
                        // Else remove from Vault
                        $sql = "UPDATE " . ADR_VAULT_USERS_TABLE . "\n\t\t\t\t\t\t\t\tSET account_sum = (account_sum - {$warehouse_tax})\n\t\t\t\t\t\t\t\tWHERE owner_id = '{$character_id}'";
                        if (!$db->sql_query($sql)) {
                            message_die(CRITICAL_ERROR, 'Error removing points for WH tax (vault)');
                        }
                        $wh_msg = sprintf($lang['Adr_character_warehouse_tax'], $warehouse_tax, get_reward_name());
                    } else {
                        // Close warehouse
                        $sql = " UPDATE " . ADR_CHARACTERS_TABLE . "\n\t\t\t\t\t\t\tSET character_warehouse = 0\n\t\t\t\t\t\t\t\tWHERE character_id = '{$character_id}'";
                        if (!$db->sql_query($sql)) {
                            message_die(GENERAL_MESSAGE, 'Error closing warehouse');
                        }
                        // Remove warehouse status from itemsif rent not paid
                        $sql = "UPDATE " . ADR_SHOPS_ITEMS_TABLE . "\n\t\t\t\t\t\t\tSET item_in_warehouse = 0\n\t\t\t\t\t\t\tWHERE item_owner_id = '{$character_id}'";
                        if (!$db->sql_query($sql)) {
                            message_die(GENERAL_ERROR, 'Could not remove WH status for items', "", __LINE__, __FILE__, $sql);
                        }
                        $wh_msg = sprintf($lang['Adr_character_warehouse_closed'], $warehouse_tax, get_reward_name());
                    }
                    // Check for any messages to use later on in PM to user
                    $pm_wh = TRUE;
                }
                // Update user warehouse update time
                $sql = " UPDATE " . ADR_CHARACTERS_TABLE . "\n\t\t\t\t\tSET character_warehouse_update = {$character_days}\n\t\t\t\t\t\tWHERE character_id = '{$character_id}'";
                if (!($results = $db->sql_query($sql))) {
                    message_die(GENERAL_MESSAGE, 'Error updating warehouse');
                }
            }
            // END warehouse tax check
            // START open shop tax check
            if (is_numeric($character_id) && $character_days > $adr_user['character_shop_update'] + ($board_config['Adr_shop_duration'] - 1)) {
                $shop_days = $character_days - ($adr_user['character_shop_update'] + ($board_config['Adr_shop_duration'] - 1));
                $shop_tax = $board_config['Adr_shop_tax'] * $shop_days;
                // see if user has a shop open
                if (is_numeric($shop_check['shop_id']) && $board_config['Adr_shop_tax'] > '0') {
                    if ($points >= $shop_tax) {
                        // Remove tax from user_points
                        subtract_reward($character_id, $shop_tax);
                        $shop_msg = sprintf($lang['Adr_character_shop_tax'], $shop_tax, get_reward_name());
                    } elseif ($points < $shop_tax && is_numeric($vault_check['account_sum']) && $vault_check['account_sum'] >= $shop_tax) {
                        $sql = "UPDATE " . ADR_VAULT_USERS_TABLE . "\n\t\t\t\t\t\t\t\tSET account_sum = (account_sum - {$shop_tax})\n\t\t\t\t\t\t\t\tWHERE owner_id = '{$character_id}'";
                        if (!$db->sql_query($sql)) {
                            message_die(CRITICAL_ERROR, 'Error removing points for shop (vault)');
                        }
                        $shop_msg = sprintf($lang['Adr_character_shop_tax'], $shop_tax, get_reward_name());
                    } else {
                        // Remove shop status from items & close shop if rent not paid
                        $sql = "UPDATE " . ADR_SHOPS_ITEMS_TABLE . "\n\t\t\t\t\t\t\tSET item_in_shop = 0\n\t\t\t\t\t\t\tWHERE item_owner_id = '{$character_id}'";
                        if (!$db->sql_query($sql)) {
                            message_die(GENERAL_ERROR, 'Could not remove shop status for items', "", __LINE__, __FILE__, $sql);
                        }
                        $sql = "DELETE FROM " . ADR_SHOPS_TABLE . "\n\t\t\t\t\t\t\tWHERE shop_owner_id = '{$character_id}'";
                        if (!$db->sql_query($sql)) {
                            message_die(GENERAL_ERROR, 'Could not delete shop', "", __LINE__, __FILE__, $sql);
                        }
                        // Remove all transaction logs for user store
                        $sql = "DELETE FROM " . ADR_STORES_USER_HISTORY . "\n\t\t\t\t\t\t\tWHERE user_store_owner_id = '{$character_id}'";
                        if (!$db->sql_query($sql)) {
                            message_die(GENERAL_ERROR, 'Could not delete user store trans logs', "", __LINE__, __FILE__, $sql);
                        }
                        $shop_msg = sprintf($lang['Adr_character_shop_closed'], $shop_tax, get_reward_name());
                    }
                    // Check for any messages to use later on in PM to user
                    $pm_shop = TRUE;
                }
                // Last shop update
                $sql = " UPDATE " . ADR_CHARACTERS_TABLE . "\n\t\t\t\t\tSET character_shop_update = {$character_days}\n\t\t\t\t\t\tWHERE character_id = '{$character_id}'";
                if (!($results = $db->sql_query($sql))) {
                    message_die(GENERAL_MESSAGE, 'Error updating warehouse');
                }
            }
            // END open shop tax check
            // Here we need to check whether to send user a PM notification of charges
            if ($pm_wh === TRUE || $pm_shop === TRUE) {
                $subject = sprintf($lang['Adr_tax_pm_sub']);
                if ($pm_wh === TRUE) {
                    $message = $wh_msg . '&nbsp;';
                }
                if ($pm_shop === TRUE) {
                    $message .= $shop_msg;
                }
                adr_send_pm($character_id, $subject, $message, 2);
            }
        }
    }
    return;
}
Exemple #4
0
         message_die(GENERAL_MESSAGE, $lang['Adr_cell_lack_money']);
     }
     $ssql = "SELECT celled_id FROM " . ADR_JAIL_USERS_TABLE . "\r\t\t\tORDER BY celled_id\r\t\t\tDESC LIMIT 1 ";
     if (!$db->sql_query($ssql)) {
         message_die(GENERAL_ERROR, "Could not update user's jail infos", '', __LINE__, __FILE__, $ssql);
     }
     $total = $db->sql_fetchrow($sresult);
     $cell_id = $total['celled_id'];
     $imprisonned = 0;
     $more_sql = '';
     if ($userdata['user_cell_time'] > 0) {
         $more_sql = 'AND celled_id <> ".$cell_id." ';
         $imprisonned = 1;
     }
     $sql = "DELETE FROM " . ADR_JAIL_USERS_TABLE . " \r\t\t\tWHERE user_id = {$user_id}\r\t\t\t{$more_sql} ";
     if (!($result = $db->sql_query($sql))) {
         message_die(GENERAL_ERROR, "", __LINE__, __FILE__, $sql);
     }
     $sql = "UPDATE " . USERS_TABLE . "\r\t\t\tSET user_points = user_points - " . $adr_general['cell_amount_user_blank'] . " ,\r\t\t  \t    user_cell_celleds = {$imprisonned}\r\t\t\tWHERE user_id = {$user_id} ";
     if (!($result = $db->sql_query($sql))) {
         message_die(GENERAL_ERROR, 'Could not update user points', '', __LINE__, __FILE__, $sql);
     }
     $message = $lang['Adr_cell_blank_done'] . '<br /><br />' . sprintf($lang['Adr_cell_return'], "<a href=\"" . append_sid("adr_courthouse.{$phpEx}") . "\">", "</a>");
     message_die(GENERAL_MESSAGE, $message);
     break;
 case 'caution_pay':
     $sledge_price = intval($HTTP_POST_VARS['sledge_price']);
     if ($userdata['user_points'] < $sledge_price) {
         message_die(GENERAL_MESSAGE, $lang['Adr_cell_lack_money']);
     }
     subtract_reward($user_id, $sledge_price);
Exemple #5
0
     ##=== START: steal points checks
     $challenger_points_spot_check = 10 + adr_modifier_calc($challenger['character_skill_thief']);
     $monster_points_attempt = $rand + $monster['monster_thief_skill'] > $challenger_points_spot_check && $rand != '1' || $rand == '20' ? TRUE : FALSE;
     ##=== END: steal points checks
     if ($success_chance == '20' && $monster_item_attempt == TRUE && $item_to_steal['item_name'] != '') {
         $damage = 0;
         // Mark the item as stolen
         $sql = "UPDATE " . ADR_SHOPS_ITEMS_TABLE . "\n\t\t\t\t\tSET item_monster_thief = 1\n\t\t\t\t\tWHERE item_owner_id = '{$user_id}'\n\t\t\t\t\tAND item_id = '" . $item_to_steal['item_id'] . "'";
         if (!($result = $db->sql_query($sql))) {
             message_die(GENERAL_ERROR, 'Could not update stolen item by monster', '', __LINE__, __FILE__, $sql);
         }
         $battle_message .= sprintf($lang['Adr_battle_opponent_thief_success'], $monster_name, adr_get_lang($item_to_steal['item_name']), $character_name);
     } elseif ($success_chance >= '15' && $success_chance != '20' && $user_points > '0' && $monster_points_attempt == TRUE) {
         $damage = 0;
         $points_stolen = floor($user_points / 100 * $board_config['Adr_thief_points']);
         subtract_reward($user_id, $points_stolen);
         $battle_message .= sprintf($lang['Adr_battle_opponent_thief_points'], $monster_name, $points_stolen, get_reward_name(), $character_name);
     } else {
         $damage = 0;
         $battle_message .= sprintf($lang['Adr_battle_opponent_thief_failure'], $monster_name, adr_get_lang($item_to_steal['item_name']), $character_name);
     }
 } else {
     $attack_type = rand(1, 20);
     ##=== START: Critical hit code
     $threat_range = $monster['monster_crit_hit'];
     //			list($crit_result, $power) = explode('-', adr_battle_make_crit_roll($bat['battle_opponent_att'], $monster['monster_level'], $bat['battle_challenger_def'], 0, $power, 0, $threat_range, 0));
     ##=== END: Critical hit code
     if ($bat['battle_opponent_mp'] > '0' && $bat['battle_opponent_mp'] >= $bat['battle_opponent_mp_power'] && $attack_type > '16') {
         $damage = 1;
         $power = ceil($power + adr_modifier_calc($bat['battle_opponent_mp_power']));
         $monster_elemental = adr_get_element_infos($opponent_element);
Exemple #6
0
    adr_previous(Adr_TownMap_Lake_Infos, adr_lake, '');
}
$donation_amount = $HTTP_POST_VARS['donation_amount'];
$donate = $HTTP_POST_VARS['donation'];
if ($donate) {
    if ($adr_char['character_hp'] < '1') {
        adr_previous(Adr_lake_donation_dead, adr_lake, '');
    }
    if (empty($donation_amount) || !is_numeric($donation_amount)) {
        adr_previous(Adr_lake_donation_none, adr_lake, '');
    }
    if ($userdata['user_points'] < $donation_amount) {
        adr_previous(Adr_lake_donation_not_enough, adr_lake, '');
    }
    // Remove donation from user
    subtract_reward($user_id, $donation_amount);
    // Update total donations to lake
    $total_donations = $adr_general['lake_total_donations'] + $donation_amount;
    $sql = "UPDATE " . ADR_GENERAL_TABLE . " SET config_value = {$total_donations} WHERE config_name = 'lake_total_donations'";
    if (!($result = $db->sql_query($sql))) {
        adr_previous(Adr_character_general_update_error, adr_lake, '');
    }
    $message = '<img src="adr/images/misc/gift02.jpg"><br /><br />';
    $message .= sprintf($lang['Adr_lake_donation_successful'], number_format($donation_amount), $board_config['points_name']) . '<br />';
    if ($donation_amount >= $adr_general['lake_min_donation']) {
        $min_chance = round($donation_amount / $adr_general['lake_chance_increase']);
        // Min chance cannot be more than 40%
        $min_chance = $min_chance > 40 ? 40 : $min_chance;
        $chance = rand($min_chance, 100);
        // Work out value for user to reach to win any type of item
        $win_chance = 100 - $adr_general['lake_win_chance'];