本文整理汇总了PHP中adr_get_user_infos函数的典型用法代码示例。如果您正苦于以下问题:PHP adr_get_user_infos函数的具体用法?PHP adr_get_user_infos怎么用?PHP adr_get_user_infos使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了adr_get_user_infos函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: adr_previous
$total_challenger = $db->sql_fetchrow($result);
// Make sure challenger hasn't already exceeded max active PvP battles
if ($adr_general['battle_pvp_defies_max'] <= $total_challenger['total'] && $adr_general['battle_pvp_defies_max']) {
adr_previous(Adr_pvp_defy_too_much, adr_character_pvp, '');
}
// Make sure character isn't already dead
if ($char['character_hp'] < '1') {
$message = $lang['Adr_battle_character_dead'];
$message .= '<br /><br />' . sprintf($lang['Adr_battle_temple'], "<a href=\"" . 'adr_temple.' . $phpEx . "\">", "</a>");
$message .= '<br /><br />' . sprintf($lang['Adr_character_return'], "<a href=\"" . 'adr_character.' . $phpEx . "\">", "</a>");
message_die(GENERAL_MESSAGE, $message);
}
##=== END challenger checks ===##
##=== START opponent checks ===##
// Grab opponent infos
$other_user = adr_get_user_infos($defied);
// Be sure he has a character
if (!is_numeric($other_user['character_id'])) {
adr_previous(Adr_your_character_lack, adr_character, '');
}
// Check opponent has enough quota left for today
// if(($adr_general['Adr_character_limit_enable'] == '1') && ($other_user['character_pvp_limit'] < '1'))
// adr_previous(Adr_pvp_no_quota_other, adr_character_pvp, '');
// Check if the user hasn't already his maximum number of defies allowed
$sql = "SELECT count(*) AS total FROM " . ADR_BATTLE_PVP_TABLE . "\n\t\t\t\tWHERE (battle_result = 0 OR battle_result = 3)\n\t\t\t\tAND (battle_opponent_id = {$defied}\tOR battle_challenger_id = {$defied})";
if (!($result = $db->sql_query($sql))) {
message_die(GENERAL_ERROR, 'Could not obtain user list', '', __LINE__, __FILE__, $sql);
}
$total_opponent = $db->sql_fetchrow($result);
// Make sure challenger hasn't already exceeded max active PvP battles
if ($adr_general['battle_pvp_defies_max'] <= $total_opponent['total'] && $adr_general['battle_pvp_defies_max']) {
示例2: adr_steal_item
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&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);
}
//.........这里部分代码省略.........
示例3: define
define('IN_ADR_SHOPS', true);
define('IN_ADR_CHARACTER', true);
$phpbb_root_path = './';
include $phpbb_root_path . 'extension.inc';
include $phpbb_root_path . 'common.' . $phpEx;
$loc = 'town';
$sub_loc = 'adr_enchant';
//
// Start session management
$userdata = session_pagestart($user_ip, PAGE_ADR);
init_userprefs($userdata);
// End session management
//
$user_id = $userdata['user_id'];
$points = $userdata['user_points'];
include $phpbb_root_path . 'adr/includes/adr_global.' . $phpEx;
// Sorry , only logged users ...
if (!$userdata['session_logged_in']) {
$redirect = "adr_familiar.{$phpEx}";
$redirect .= isset($user_id) ? '&user_id=' . $user_id : '';
header('Location: ' . append_sid("login.{$phpEx}?redirect={$redirect}", true));
}
// Includes the tpl and the header
adr_template_file('adr_enchant_body.tpl');
include $phpbb_root_path . 'includes/page_header.' . $phpEx;
// Get the general config
$adr_general = adr_get_general_config();
//
//BEGIN zone Enchant Restriction
//
$zone_user = adr_get_user_infos($user_id);
示例4: adr_previous
}
$total_opponent = $db->sql_fetchrow($result);
// Make sure challenger hasn't already exceeded max active PvP battles
if ($adr_general['battle_pvp_defies_max'] <= $total_opponent['total'] && $adr_general['battle_pvp_defies_max']) {
adr_previous(Adr_pvp_defy_too_much_opponent, adr_character_pvp, '');
}
// Make sure character isn't already dead
if ($other_user['character_hp'] < '1') {
$message = $lang['Adr_battle_character_dead'];
$message .= '<br /><br />' . sprintf($lang['Adr_battle_temple'], "<a href=\"" . 'adr_temple.' . $phpEx . "\">", "</a>");
$message .= '<br /><br />' . sprintf($lang['Adr_character_return'], "<a href=\"" . 'adr_character.' . $phpEx . "\">", "</a>");
message_die(GENERAL_MESSAGE, $message);
}
##=== END opponent checks ===##
$sql = " SELECT battle_id FROM " . ADR_BATTLE_PVP_TABLE . "\r\t\t\t\tORDER BY battle_id DESC LIMIT 1 ";
if (!($result = $db->sql_query($sql))) {
message_die(GENERAL_ERROR, 'Could not obtain user list', '', __LINE__, __FILE__, $sql);
}
$last_row = $db->sql_fetchrow($result);
$last_id = $last_row['battle_id'] + 1;
// Fix the items ids
$armor = intval($HTTP_POST_VARS['item_armor']);
$buckler = intval($HTTP_POST_VARS['item_buckler']);
$helm = intval($HTTP_POST_VARS['item_helm']);
$greave = intval($HTTP_POST_VARS['item_greave']);
$boot = intval($HTTP_POST_VARS['item_boot']);
$gloves = intval($HTTP_POST_VARS['item_gloves']);
$amulet = intval($HTTP_POST_VARS['item_amulet']);
$ring = intval($HTTP_POST_VARS['item_ring']);
// Get the user infos
$char = adr_get_user_infos($user_id);
示例5: message_die
//}
// Show user list
$sql = "SELECT u.user_id , u.username , c.* FROM " . USERS_TABLE . " u , " . ADR_CHARACTERS_TABLE . " c\r\n\tWHERE u.user_id = c.character_id \r\n\tAND c.character_hp < c.character_hp_max\r\n\tAND c.character_hp > 0\r\n\tORDER by u.username ";
if (!($result = $db->sql_query($sql))) {
message_die(GENERAL_ERROR, 'Could not obtain user list', '', __LINE__, __FILE__, $sql);
}
$users = $db->sql_fetchrowset($result);
$chars_list = '<select name="cast">';
$chars_list .= '<option value = "0" >Select member:</option>';
for ($i = 0; $i < count($users); $i++) {
$chars_list .= '<option value = "' . $users[$i]['user_id'] . '" >' . $users[$i]['character_name'] . ' ( HP: ' . $users[$i]['character_hp'] . '/' . $users[$i]['character_hp_max'] . ' - MP: ' . $users[$i]['character_mp'] . '/' . $users[$i]['character_mp_max'] . ' - ' . $lang['Adr_character_level'] . ': ' . $users[$i]['character_level'] . ' ) </option>';
}
$chars_list .= '</select>';
if ($cast_spell) {
// Get other char info
$other_member = adr_get_user_infos($to_member_id);
// Get spell info
$sql = "SELECT * FROM " . ADR_SHOPS_SPELLS_TABLE . " \r\n\t\tWHERE spell_owner_id = {$user_id}\r\n\t\tAND spell_original_id = {$spell_id}\r\n\t\tLIMIT 1";
if (!($result = $db->sql_query($sql))) {
adr_previous(Adr_shop_items_failure_deleted, adr_spellbook, '');
}
$item = $db->sql_fetchrow($result);
$spell_skill = $item['item_type_use'];
$power = 0;
// Spell components check
if ($item['spell_items_req'] != '' && $item['spell_items_req'] != '0') {
adr_spell_check_components($spell_id, $user_id, 'adr_spellbook');
}
// MP check
if ($adr_user['character_mp'] < $item['spell_mp_use'] + $item['spell_power'] || $adr_user['character_mp'] < 0) {
adr_previous(Adr_battle_check_two, 'adr_spellbook', '');
示例6: message_die
//if ( $access == '0' )
// adr_previous( Adr_zone_building_noaccess , adr_zones , '' );
// Clan list
if (!isset($_GET['action']) || $_GET['action'] == "list") {
$this_title = $lang['clans_title_clanslist'];
// Get clans user belongs to!
$sql = "SELECT * FROM " . ADR_CLANS_TABLE . "\r\n\t\t\tWHERE leader = '" . $user_id . "' OR members LIKE '%ß" . $user_id . "Þ%' OR approvelist LIKE '%ß" . $user_id . "Þ%'\r\n\t\t\tORDER BY name,id";
if (!($result = $db->sql_query($sql))) {
message_die(GENERAL_ERROR, 'Error retrieving data', '', __LINE__, __FILE__, $sql);
}
if ($db->sql_numrows($result) < 1) {
$template->assign_block_vars('no_userclans', array('L_NONE' => $lang['clans_none']));
}
if ($row = $db->sql_fetchrow($result)) {
// Get leader name!
$Lrow = adr_get_user_infos($row['leader']);
$leader = '<a href="' . $phpbb_root_path . 'adr_character.php?' . POST_USERS_URL . '=' . $row['leader'] . '" target="_blank">' . $Lrow['character_name'] . '</a>';
// Get member names!
$members = '';
if ($row['members'] == '') {
$members = $lang['clans_none'];
} else {
$allmembers = str_replace("ß", "", $row['members']);
$newmembers = explode("Þ", $allmembers);
$count = count($newmembers);
for ($x = 0; $x < $count; $x++) {
$Usql = "SELECT character_name FROM " . ADR_CHARACTERS_TABLE . "\r\n\t\t\t\t\t\tWHERE character_id = '" . $newmembers[$x] . "' ";
if (!($Uresult = $db->sql_query($Usql))) {
message_die(GENERAL_ERROR, 'Error retrieving data', '', __LINE__, __FILE__, $Usql);
}
while ($Urow = $db->sql_fetchrow($Uresult)) {
示例7: message_die
message_die(GENERAL_ERROR, 'Could not delete PvP battle at exploit', '', __LINE__, __FILE__, $sql);
}
adr_previous(Adr_pvp_exploit_error, adr_character, '');
}
// have the mail sender infos , it will be of use later
$script_name = preg_replace('/^\\/?(.*?)\\/?$/', "\\1", trim($board_config['script_path']));
$script_name = $script_name != '' ? $script_name . '/adr_battle_pvp.' . $phpEx : 'adr_battle_pvp.' . $phpEx;
$server_name = trim($board_config['server_name']);
$server_protocol = $board_config['cookie_secure'] ? 'https://' : 'http://';
$server_port = $board_config['server_port'] != 80 ? ':' . trim($board_config['server_port']) . '/' : '/';
// Includes the tpl and the header
adr_template_file('adr_battle_pvp_body.tpl');
include $phpbb_root_path . 'includes/page_header.' . $phpEx;
// Grab both user infos
$current_infos = $user_id === $battle_pvp['battle_challenger_id'] ? adr_get_user_infos($battle_pvp['battle_challenger_id']) : adr_get_user_infos($battle_pvp['battle_opponent_id']);
$opponent_infos = $user_id === $battle_pvp['battle_challenger_id'] ? adr_get_user_infos($battle_pvp['battle_opponent_id']) : adr_get_user_infos($battle_pvp['battle_challenger_id']);
### START restriction checks ###
$item_sql = adr_make_restrict_sql($current_infos);
### END restriction checks ###
// Get the current user and the opponent infos
if ($user_id == $battle_pvp['battle_challenger_id']) {
$current_hp = $battle_pvp['battle_challenger_hp'];
$current_mp = $battle_pvp['battle_challenger_mp'];
$current_hp_max = $battle_pvp['battle_challenger_hp_max'];
$current_mp_max = $battle_pvp['battle_challenger_mp_max'];
$current_hp_regen = $battle_pvp['battle_challenger_hp_regen'];
$current_mp_regen = $battle_pvp['battle_challenger_mp_regen'];
$current_att = $battle_pvp['battle_challenger_att'];
$current_def = $battle_pvp['battle_challenger_def'];
$current_element = $battle_pvp['battle_challenger_element'];
$current_alignment = $current_infos['character_alignment'];
示例8: isset
//
include $phpbb_root_path . 'adr/includes/adr_global.' . $phpEx;
// Sorry , only logged users ...
if (!$userdata['session_logged_in']) {
$redirect = "adr_character.{$phpEx}";
$redirect .= isset($user_id) ? '&user_id=' . $user_id : '';
header('Location: ' . append_sid("login.{$phpEx}?redirect={$redirect}", true));
}
// Includes the tpl and the header
adr_template_file('adr_character_prefs_body.tpl');
include $phpbb_root_path . 'includes/page_header.' . $phpEx;
$user_id = $userdata['user_id'];
// Get the general settings
$adr_general = adr_get_general_config();
adr_enable_check();
adr_ban_check($user_id);
adr_character_created_check($user_id);
if (!(isset($HTTP_POST_VARS[POST_USERS_URL]) || isset($HTTP_GET_VARS[POST_USERS_URL])) || empty($HTTP_POST_VARS[POST_USERS_URL]) && empty($HTTP_GET_VARS[POST_USERS_URL])) {
$view_userdata = $userdata;
} else {
$view_userdata = get_userdata(intval($HTTP_GET_VARS[POST_USERS_URL]));
}
$searchid = $view_userdata['user_id'];
if ($user_id != $searchid) {
$message = $lang['Adr_no_access'] . '<br /><br />' . sprintf($lang['Adr_return'], "<a href=\"" . append_sid("adr_character.{$phpEx}?" . POST_USERS_URL . "={$searchid}") . "\">", "</a>");
message_die(GENERAL_MESSAGE, $message);
}
// Get the general settings
$adr_general = adr_get_general_config();
// See if the user has ever created a character or no
$row = adr_get_user_infos($user_id);
示例9: adr_shield_skill_check
function adr_shield_skill_check($user_id)
{
global $db, $lang, $adr_general, $item;
$char = adr_get_user_infos($user_id);
$sql = "SELECT * FROM " . ADR_CHARACTERS_TABLE . "\r\n\t\tWHERE character_id = {$user_id} ";
if (!($result = $db->sql_query($sql))) {
message_die(GENERAL_ERROR, 'Could not obtain user list', '', __LINE__, __FILE__, $sql);
}
if ($char['character_skill_shield_uses'] + 1 >= $adr_general['weapon_prof'] * $char['character_skill_shield_level']) {
$sql = "UPDATE " . ADR_CHARACTERS_TABLE . "\r\n\t\t\tSET character_skill_shield_uses = 0 , \r\n\t\t\t\tcharacter_skill_shield_level = character_skill_shield_level + 1\r\n\t\t\tWHERE character_id = {$user_id} ";
$result = $db->sql_query($sql);
if (!$result) {
message_die(GENERAL_ERROR, 'Could not obtain skill information', "", __LINE__, __FILE__, $sql);
}
} else {
$sql = "UPDATE " . ADR_CHARACTERS_TABLE . "\r\n\t\t\tSET character_skill_shield_uses = character_skill_shield_uses + 1\r\n\t\t\tWHERE character_id = {$user_id} ";
$result = $db->sql_query($sql);
if (!$result) {
message_die(GENERAL_ERROR, 'Could not obtain item information', "", __LINE__, __FILE__, $sql);
}
}
}
示例10: floor
if ($defend && $bat['battle_turn'] == 1) {
$def = TRUE;
$power = floor($monster['monster_level'] * rand(1, 3) / 2);
$battle_message .= sprintf($lang['Adr_battle_defend'], $challenger['character_name'], $monster['monster_name']) . '<br>';
// Update the database
$sql = "UPDATE " . ADR_BATTLE_LIST_TABLE . "\n\t\t\tSET\tbattle_turn = 2,\n\t\t\t\tbattle_round = (battle_round + 1)\n\t\t\tWHERE battle_challenger_id = {$user_id}\n\t\t\tAND battle_result = 0\n\t\t\tAND battle_type = 1 ";
if (!($result = $db->sql_query($sql))) {
message_die(GENERAL_ERROR, 'Could not update battle', '', __LINE__, __FILE__, $sql);
}
}
}
}
}
}
// Get the user infos
$challenger = adr_get_user_infos($user_id);
##=== START: additional status checks on user ===##
if ($bat['battle_turn'] == '1' && ($attack || $item_spell || $item_potion || $defend || $flee || $equip)) {
$hp_regen = adr_hp_regen_check($user_id, $bat['battle_challenger_hp']);
$challenger['character_hp'] += $hp_regen;
$mp_regen = adr_mp_regen_check($user_id, $bat['battle_challenger_mp']);
$battle_message .= '<span class="gensmall"><font color="#FF0000">';
// prefix new span class
if ($hp_regen > '0' && $mp_regen == '0' || $mp_regen > '0' && $hp_regen == '0') {
if ($hp_regen > '0') {
$battle_message .= ' > ' . sprintf($lang['Adr_battle_regen_xp'], $challenger['character_name'], intval($hp_regen)) . '<br />';
} elseif ($mp_regen > '0') {
$battle_message .= ' > ' . sprintf($lang['Adr_battle_regen_mp'], $challenger['character_name'], intval($mp_regen)) . '<br />';
}
} elseif ($hp_regen > '0' && $mp_regen > '0') {
$battle_message .= ' > ' . sprintf($lang['Adr_battle_regen_both'], $challenger['character_name'], intval($hp_regen), intval($mp_regen)) . '<br />';
示例11: adr_admin_cmd_endpvp
function adr_admin_cmd_endpvp($battle_id)
{
global $db, $lang;
$user_id = $user_infos['user_id'];
$battle_id = intval($battle_id);
$sql = "SELECT battle_id, battle_challenger_id, battle_opponent_id FROM " . ADR_BATTLE_PVP_TABLE . "\r\n\t\tWHERE battle_id = '{$battle_id}'";
if (!($result = $db->sql_query($sql))) {
message_die(GENERAL_ERROR, 'Could not query battle list', '', __LINE__, __FILE__, $sql);
}
$bat = $db->sql_fetchrow($result);
if (is_numeric($bat['battle_id'])) {
if ($user_id == $battle_pvp['battle_challenger_id']) {
$battle_result = 9;
} else {
$battle_result = 8;
}
$challenger_name = adr_get_user_infos($bat['battle_challenger_id']);
$opponent_name = adr_get_user_infos($bat['battle_opponent_id']);
$sql = "UPDATE " . ADR_BATTLE_PVP_TABLE . "\r\n\t\t\tSET battle_result = {$battle_result}\r\n\t\t\tWHERE battle_id = '{$battle_id}'";
if (!($result = $db->sql_query($sql))) {
message_die(GENERAL_ERROR, 'Could not update battle', '', __LINE__, __FILE__, $sql);
}
$error_messages = sprintf($lang['Adr_global_shout_endpvp_yes'], $challenger_name['character_name'], $opponent_name['character_name']);
} else {
$error_messages = sprintf($lang['Adr_global_shout_endpvp_none'], $battle_id);
}
return $error_messages;
}
示例12: adr_use_skill
function adr_use_skill($user_id, $tool, $recipe_item_id, $skill_id, $type)
{
global $db;
$user_id = intval($user_id);
$item_id = intval($item_id);
$tool = intval($tool);
$recipe_item_id = intval($recipe_item_id);
$new_item_id = 0;
$adr_general = adr_get_general_config();
$adr_user = adr_get_user_infos($user_id);
$skill_data = adr_get_skill_data($skill_id);
$current_file = 'adr_' . $type;
$character_skill = 'character_skill_' . $type;
$character_skill_uses = 'character_skill_' . $type . '_uses';
// START skill limit check
if ($adr_general['Adr_character_limit_enable'] != 0 && $adr_user['character_skill_limit'] < 1) {
adr_previous(Adr_skill_limit, $current_file, "mode=view&known_recipes={$recipe_item_id}");
}
// END skill limit check
$sql = " SELECT * FROM " . ADR_SHOPS_ITEMS_TABLE . "\r\n\t\tWHERE item_in_shop = 0 \r\n\t\tAND item_owner_id = {$user_id} \r\n\t\tAND item_id = {$tool} ";
if (!($result = $db->sql_query($sql))) {
message_die(GENERAL_ERROR, 'Could not query tool informations', '', __LINE__, __FILE__, $sql);
}
$item = $db->sql_fetchrow($result);
// get the information of the item that will be crafted
//get original recipe information
$sql = "SELECT * FROM " . ADR_SHOPS_ITEMS_TABLE . "\r\n\t\tWHERE item_owner_id = 1\r\n\t\tAND item_original_recipe_id = {$recipe_item_id}\r\n\t\t";
$result = $db->sql_query($sql);
if (!$result) {
message_die(GENERAL_ERROR, 'Could not obtain owners recipes information', "", __LINE__, __FILE__, $sql);
}
$original_recipe = $db->sql_fetchrow($result);
//get original (up-to-date) recipe info now
$sql_recipe = "SELECT * FROM " . ADR_SHOPS_ITEMS_TABLE . "\r\n\t\tWHERE item_id = " . $original_recipe['item_recipe_linked_item'] . "\r\n\t\tAND item_owner_id = 1\r\n\t\t";
$result_recipe = $db->sql_query($sql_recipe);
if (!$result_recipe) {
message_die(GENERAL_ERROR, "Couldn't select recipe info", "", __LINE__, __FILE__, $sql_recipe);
}
$crafted_item = $db->sql_fetchrow($result_recipe);
if ($item['item_duration'] < 0) {
adr_previous(Adr_forge_broken, $current_file, "mode=view&known_recipes={$recipe_item_id}");
}
// Alter the tool
adr_use_item($tool, $user_id);
//roll
$difference = intval($adr_user['character_skill_' . $type . ''] - $original_recipe['item_power']);
$impossible_loose_bonus = 0;
switch (TRUE) {
case $difference < -9:
$modifier = '-100%';
$lose_roll = 100;
$impossible_loose_bonus = 1;
break;
//Impossible
//Impossible
case $difference >= -9 && $difference < -6:
$modifier = '-80%';
$lose_roll = 80;
$item_quality = rand(1, 2);
break;
//Very Hard
//Very Hard
case $difference >= -6 && $difference < -4:
$modifier = '-60%';
$lose_roll = 60;
$item_quality = rand(1, 3);
break;
//Hard
//Hard
case $difference >= -4 && $difference < -2:
$modifier = '-40%';
$lose_roll = 40;
$item_quality = rand(1, 4);
break;
//Normal
//Normal
case $difference >= -2 && $difference < 0:
$modifier = '-20%';
$lose_roll = 20;
$item_quality = rand(1, 5);
break;
//Easy
//Easy
case $difference >= 0:
$modifier = '-1%';
$lose_roll = 5;
$item_quality = rand(1, 6);
break;
//Very Easy
}
$user_chance = rand(0, $adr_user['character_skill_' . $type . ''] * 100);
$user_chance = $user_chance + floor($user_chance * $modifier / 100);
$loose_chance = rand($impossible_loose_bonus, $adr_user['character_skill_' . $type . ''] * $lose_roll);
/*
echo $modifier." : modifier<br>";
echo $difference." : difference<br>";
echo $user_chance." : user chance<br>";
echo $loose_chance." : loose_chance<br>";
*/
// loose a needed item if the rolled dice is bad
//.........这里部分代码省略.........
示例13: adr_character_replenish_timer
function adr_character_replenish_timer($user_id)
{
global $db, $phpEx, $adr_general;
$user_id = intval($user_id);
$adr_user = adr_get_user_infos($user_id);
// Show time until next replenish
$replenish_timer = 24 - floor(((time() - $adr_user['character_birth']) / 86400 - ($adr_user['character_limit_update'] + ($adr_general['Adr_limit_regen_duration'] - 1))) * 24);
$replenish_timer = $replenish_timer < '1' ? '1' : $replenish_timer;
return $replenish_timer;
}
示例14: adr_consume
function adr_consume($consumable_id, $user_id)
{
global $db;
// Fix the values
$consumable_id = intval($consumable_id);
$user_id = intval($user_id);
$user = adr_get_user_infos($user_id);
//get effects of the consumable
$sql_consumable = "SELECT * FROM " . ADR_SHOPS_ITEMS_TABLE . "\r\n\t\tWHERE item_owner_id = {$user_id}\r\n\t\tAND item_id = {$consumable_id} ";
$result_consumable = $db->sql_query($sql_consumable);
if (!$result_consumable) {
message_die(GENERAL_ERROR, "Couldn't get owners consumable effects", "", __LINE__, __FILE__, $sql_consumable);
}
$consumable = $db->sql_fetchrow($result_consumable);
//check if user has a battle in progress with already a temp effect consumable used
$sql = " SELECT * FROM " . ADR_BATTLE_LIST_TABLE . " \r\n\t\tWHERE battle_challenger_id = {$user_id}\r\n\t\tAND battle_result = 0\r\n\t\tAND battle_type = 1 \r\n\t\tAND battle_effects != ''\r\n\t\t";
$result = $db->sql_query($sql);
if (!($check_battle = $db->sql_fetchrow($result))) {
//check if user has already used a temp effect consumable before entering a battle
if ($user['character_pre_effects'] != '' && $user['character_pre_effects'] != NULL && (substr_count($consumable['item_effect'], 'M:1:PERM:0') || substr_count($consumable['item_effect'], 'M:0:PERM:0'))) {
//already ate consumable with temp effects
$message = "You already have temporary effects added to your character !";
return array(0, $message);
} else {
$effects = array();
$effects = explode(':', $consumable['item_effect']);
for ($i = 0; $i < count($effects); $i++) {
switch (TRUE) {
case $effects[$i] == 'HP' || $effects[$i] == 'MP':
if (substr_count($effects[$i + 1], '%')) {
$value = floor($user['character_' . strtolower($effects[$i]) . ''] * $effects[$i + 1] / 100);
} else {
$value = $effects[$i + 1];
}
if (substr_count($effects[$i + 1], '-')) {
$pre_message = 'Your character is losing ' . $value . ' ' . $effects[$i] . ' !<br />';
} else {
$pre_message = 'Your character refreshed ' . $value . ' ' . $effects[$i] . ' !<br />';
}
if ($effects[$i + 3] == 1) {
//effect hits the monster
//nothing happens, only possible in battle
$pre_message = 'You can\'t use the ' . $effects[$i] . ' effect of this consumable cause it\'s meant to hit an opponent<br />';
} else {
//effect hits the user
if ($user['character_' . strtolower($effects[$i]) . ''] + $value > $user['character_' . strtolower($effects[$i]) . '_max']) {
$value_sql = 'character_' . strtolower($effects[$i]) . ' = ' . $user['character_' . strtolower($effects[$i]) . '_max'];
} else {
if ($user['character_' . strtolower($effects[$i]) . ''] + $value < 0) {
$value_sql = 'character_' . strtolower($effects[$i]) . ' = 0';
} else {
$value_sql = 'character_' . strtolower($effects[$i]) . ' = character_' . strtolower($effects[$i]) . ' + ' . $value;
}
}
$sql = "UPDATE " . ADR_CHARACTERS_TABLE . "\r\n\t\t\t\t\t\t\t\tSET {$value_sql}\r\n\t\t\t\t\t\t\t\tWHERE character_id = {$user_id} ";
if (!$db->sql_query($sql)) {
message_die(GENERAL_ERROR, 'Couldn\'t update characters ' . $effects[$i] . '', '', __LINE__, __FILE__, $sql);
}
$use_the_consumable = 1;
}
$message .= $pre_message;
break;
case $effects[$i] == 'AC' || $effects[$i] == 'STR' || $effects[$i] == 'DEX' || $effects[$i] == 'CON' || $effects[$i] == 'INT' || $effects[$i] == 'WIS' || $effects[$i] == 'CHA' || $effects[$i] == 'MA' || $effects[$i] == 'MD' || $effects[$i] == 'EXP' || $effects[$i] == 'SP':
$effects[$i] = $effects[$i] == 'STR' ? 'might' : $effects[$i];
$effects[$i] = $effects[$i] == 'DEX' ? 'dexterity' : $effects[$i];
$effects[$i] = $effects[$i] == 'CON' ? 'constitution' : $effects[$i];
$effects[$i] = $effects[$i] == 'INT' ? 'intelligence' : $effects[$i];
$effects[$i] = $effects[$i] == 'WIS' ? 'wisdom' : $effects[$i];
$effects[$i] = $effects[$i] == 'CHA' ? 'charisma' : $effects[$i];
$effects[$i] = $effects[$i] == 'MA' ? 'magic_attack' : $effects[$i];
$effects[$i] = $effects[$i] == 'MD' ? 'magic_resistance' : $effects[$i];
$effects[$i] = $effects[$i] == 'EXP' ? 'xp' : $effects[$i];
if (substr_count($effects[$i + 1], '%')) {
$value = floor($user['character_' . strtolower($effects[$i]) . ''] * $effects[$i + 1] / 100);
} else {
$value = $effects[$i + 1];
}
if (substr_count($effects[$i + 1], '-')) {
if ($effects[$i + 5] == 1) {
// if perm effect
$pre_message = 'Your character is losing ' . $value . ' ' . $effects[$i] . ' !<br />';
} else {
if ($effects[$i + 3] == 1) {
// hits monster
$pre_message = 'For the next battle, your opponent is losing ' . $value . ' ' . $effects[$i] . ' !<br />';
} else {
$pre_message = 'For the next battle your character is losing ' . $value . ' ' . $effects[$i] . ' !<br />';
}
}
} else {
if ($effects[$i + 5] == 1) {
// if perm effect
$pre_message = 'Your character gains ' . $value . ' ' . $effects[$i] . ' !<br />';
} else {
if ($effects[$i + 3] == 1) {
// hits monster
$pre_message = 'For the next battle, your opponent gets +' . $value . ' ' . $effects[$i] . ' !<br />';
} else {
$pre_message = 'For the next battle your character gets +' . $value . ' ' . $effects[$i] . ' !<br />';
}
//.........这里部分代码省略.........
示例15: header
header('Location: ' . append_sid("login.{$phpEx}?redirect={$redirect}", true));
}
include $phpbb_root_path . 'includes/page_header.' . $phpEx;
if (!(isset($_POST[POST_USERS_URL]) || isset($_GET[POST_USERS_URL])) || empty($_POST[POST_USERS_URL]) && empty($_GET[POST_USERS_URL])) {
$view_userdata = $userdata;
} else {
$view_userdata = get_userdata(intval($_GET[POST_USERS_URL]));
}
$searchid = $view_userdata['user_id'];
// Get the general config
$adr_general = adr_get_general_config();
adr_enable_check();
adr_ban_check($user_id);
adr_character_created_check($user_id);
// See if the user has ever created a character or no
$char = adr_get_user_infos($searchid);
// Deny access if user is imprisioned
if ($userdata['user_cell_time']) {
adr_previous(Adr_shops_no_thief, adr_cell, '');
}
$equip_armor = $char['equip_armor'];
$equip_buckler = $char['equip_buckler'];
$equip_helm = $char['equip_helm'];
$equip_gloves = $char['equip_gloves'];
$equip_amulet = $char['equip_amulet'];
$equip_ring = $char['equip_ring'];
adr_template_file('adr_equipment_body.tpl');
$submit = isset($_POST['equip']);
if ($submit && $user_id == $searchid) {
$armor = intval($_POST['item_armor']);
$buckler = intval($_POST['item_buckler']);