0 && $mass_all <=20){ $def_type = "light_armor"; } if($mass_all > 20){ $def_type = "heavy_armor"; } $new_def = $WINNER_DATA["$def_type"]+0.1; $battle_id=$WINNER_DATA["battle"]; $BATTLE_SQL_L="UPDATE battles SET status='finished',win='$team' WHERE id='$battle'"; $BS=mysql_query($BATTLE_SQL_L); $WINNER_SQL="UPDATE characters SET battle='0',win='$new_win',exp='$new_exp',$weapon_t='$new_wp_c',$vladenie='$new_vl',$def_type='$new_def',battle_opponent='',battle_pos='',battle_team='' WHERE login='$player'"; $WINNER=mysql_query($WINNER_SQL); if($WINNER && !empty($player)){ say($player,"Внимание!!! Бой окончен! Вы победили! Всего вами нанесено: $hitted_win HP, получено опыта: $w_exp.",$player); } if($team == 1){ $TEAM_U = mysql_query("UPDATE team1 SET over = '1' WHERE player='$player'"); } else{ $TEAM_U = mysql_query("UPDATE team2 SET over = '1' WHERE player='$player'"); } $cur = $WINNER_DATA["hp"]; $all = $WINNER_DATA["hp_all"]; setHP($player,$cur,$all); $cur_m = $WINNER_DATA["mp"]; $all_m = $WINNER_DATA["mp_all"]; setMN($player,$cur_m,$all_m); $_SESSION["zayavka_c_m"] = 0; $_SESSION["zayavka_c_o"] = 0; $_SESSION["battle_ref"] = 0; } } else if($team == 2){ $T = mysql_query("SELECT * FROM team2 WHERE battle_id=$cr AND over='0'"); $T = mysql_query("SELECT * FROM team1 WHERE battle_id=$cr AND over='0'"); while($DATA = mysql_fetch_array($T)){ $player=$DATA["player"]; $WINNER_SQL_D="SELECT * FROM characters WHERE login='$player'"; $WINNER_QUERY_D=mysql_query($WINNER_SQL_D); $WINNER_DATA=mysql_fetch_array($WINNER_QUERY_D); $exp_table=array(); $exp_table[0]="5"; $exp_table[1]="10"; $exp_table[2]="15"; $exp_table[3]="15"; $exp_table[4]="20"; $exp_table[5]="40"; $exp_table[6]="50"; $exp_table[7]="100"; $exp_table[8]="300"; $exp_table[9]="600"; $exp_table[10]="1000"; $pos=$WINNER_DATA["battle_pos"]; if($team == 1){ $SS = mysql_query("SELECT * FROM team1 WHERE battle_id=$cr AND player='$player'"); } if($team == 2){ $SS = mysql_query("SELECT * FROM team2 WHERE battle_id=$cr AND player='$player'"); } $DD = mysql_fetch_array($SS); $hitted_win=$DD["hitted"]; $new_win=$WINNER_DATA["win"]+1; $a = $user_level_t2+$price_all_t2+$user_level_t4+$price_all_t4; $a1 = $user_level_t1+$price_all_t1+$user_level_t3+$price_all_t3; if($WINNER_DATA["orden"]==5){ $add_exp = floor(floor($a1/$a)*$exp_table[$user_level])/2); } else{ $add_exp = floor($a1/$a)*$exp_table[$user_level]; } $new_exp=$WINNER_DATA["exp"]+$add_exp; $w_exp=$add_exp; if($WINNER_DATA["hand_l"]!=0){ $wp_type=$WINNER_DATA["hand_l_type"]; if($wp_type=="sword"){ $weapon_t="sword_bt"; $vladenie="sword"; } else if($wp_type=="axe"){ $weapon_t="axe_bt"; $vladenie="axe"; } else if($wp_type=="fail"){ $weapon_t="fail_bt"; $vladenie="fail"; } else if($wp_type=="knife"){ $weapon_t="knife_bt"; $vladenie="knife"; } else if($wp_type=="staff"){ $weapon_t="staff_bt"; $vladenie="staff"; } } else{ $weapon_t="phisic_bt"; $vladenie="phisic"; } $new_wp_c=$WINNER_DATA["$weapon_t"]+1; $new_vl=$WINNER_DATA["$vladenie"]+0.05; if($WINNER_DATA["hand_r"]!=0){ $wp_type=$WINNER_DATA["hand_r_type"]; if($wp_type=="sword"){ $weapon_t="sword_bt"; $vladenie="sword"; } else if($wp_type=="axe"){ $weapon_t="axe_bt"; $vladenie="axe"; } else if($wp_type=="fail"){ $weapon_t="fail_bt"; $vladenie="fail"; } else if($wp_type=="knife"){ $weapon_t="knife_bt"; $vladenie="knife"; } else if($wp_type=="staff"){ $weapon_t="staff_bt"; $vladenie="staff"; } } else{ $weapon_t="phisic_bt"; $vladenie="phisic"; } $new_wp_c=$WINNER_DATA["$weapon_t"]+1; $new_vl=$WINNER_DATA["$vladenie"]+0.05; $mass_all = $WINNER_DATA["mass"]; if($mass_all == 0){ $def_type = "no_armor"; } if($mass_all > 0 && $mass_all <=20){ $def_type = "light_armor"; } if($mass_all > 20){ $def_type = "heavy_armor"; } $new_def = $WINNER_DATA["$def_type"]+0.1; $battle_id=$WINNER_DATA["battle"]; $BATTLE_SQL_L="UPDATE battles SET status='finished',win='$team' WHERE id='$battle'"; $BS=mysql_query($BATTLE_SQL_L); $WINNER_SQL="UPDATE characters SET battle='0',win='$new_win',exp='$new_exp',$weapon_t='$new_wp_c',$vladenie='$new_vl',$def_type='$new_def',battle_opponent='',battle_pos='',battle_team='' WHERE login='$player'"; $WINNER=mysql_query($WINNER_SQL); if($WINNER && !empty($player)){ say($player,"Внимание!!! Бой окончен! Вы победили! Всего вами нанесено: $hitted_win HP, получено опыта: $w_exp.",$player); } if($team == 1){ $TEAM_U = mysql_query("UPDATE team1 SET over = '1' WHERE player='$player'"); } else{ $TEAM_U = mysql_query("UPDATE team2 SET over = '1' WHERE player='$player'"); } $cur = $WINNER_DATA["hp"]; $all = $WINNER_DATA["hp_all"]; setHP($player,$cur,$all); $cur_m = $WINNER_DATA["mp"]; $all_m = $WINNER_DATA["mp_all"]; setMN($player,$cur_m,$all_m); $_SESSION["zayavka_c_m"] = 0; $_SESSION["zayavka_c_o"] = 0; $_SESSION["battle_ref"] = 0; } } ?>