Файл: func.js
Строк: 52
<?php
/* Обновление игры под PHP 8.4 / PDO и усиление безопасности: by Метриум (Стэлп) */
function attack_arena(url) {
var xhr = new XMLHttpRequest();
xhr.open('GET', url, false);
xhr.send();
if (xhr.status != 200) {
alert('Перезагрузите игру');
} else {
stats = JSON.parse(xhr.responseText);
if(stats.error!=0){
alert('Перезагрузите игру');
}else{
att_user=stats.att_user;
att_vrag=stats.att_vrag;
if(hp_vrag>0){
hp_user=hp_user-att_vrag;
hp_vrag=hp_vrag-att_user;
if(hp_user<1){hp_user=0;window.location = "/ursa?m=load";}
if(hp_vrag<1){hp_vrag=0;window.location = "/ursa?m=load";}
proc_user=(hp_user/hp_user_max)*100;
proc_vrag=(hp_vrag/hp_vrag_max)*100;
document.getElementById('hp_proc_block2_v').style.width =proc_vrag+'%';
document.getElementById('hp_proc_block2_u').style.width =proc_user+'%';
document.getElementById('hp_proc_block2_small_v').style.width =proc_vrag+'%';
document.getElementById('hp_proc_block2_small_u').style.width =proc_user+'%';
document.getElementById('hp_small_v').innerHTML =hp_vrag;
document.getElementById('hp_small_u').innerHTML =hp_user;
document.getElementById('hp_del_v').innerHTML ='-'+att_user;
document.getElementById('hp_del_u').innerHTML ='-'+att_vrag;
document.getElementById('hp_del_v').style.display ='block';
document.getElementById('hp_del_u').style.display ='block';
setTimeout("hp_del()", 1000);
}else{
window.location = "/ursa?m=load";
}
}
}
}
function hp_del(user,vrag) {
document.getElementById('hp_del_v').style.display ='none';
document.getElementById('hp_del_u').style.display ='none';
}
?>