Вход Регистрация
Файл: html/hunt/attack.php
Строк: 364
<?php
require_once ('../system/func.php');
require 
'../system/dbc.php';

auth();
// Закроем от неавторизированых
requestModer();
// Закроем для тех у кого есть запрос на модератора
//проверяем что герой не в бою
if ($mc->query("SELECT * FROM `battle` WHERE `Mid`='" $user['id'] . "' AND `player_activ`='1' AND `end_battle`='0'")->num_rows 0) {
    
?><script>/*nextshowcontemt*/showContent("/hunt/battle.php");</script><?php
    
exit(0);
}
//проверяем результаты если есть то перекинем туда чтобы обработало монстров
if ($mc->query("SELECT * FROM `resultbattle` WHERE `id_user`='" $user['id'] . "' ORDER BY `id` DESC LIMIT 1")->num_rows 0) {
    
?><script>/*nextshowcontemt*/showContent("/hunt/result.php");</script><?php
    
exit(0);
}
?>
<style>
    .otrazit{
        transform: scale(-1, 1); 
    }
</style>
<?php
if (isset($_GET['id'])) {
    
$mobid $_GET['id'];
} else {
    
?>
    <script>showContent("/main.php");</script>
    <?php
    
exit(0);
}
if (
$user['location'] == || $user['location'] == 2) {
    
$user['location'] = 102;
}
if (
$result221 $mc->query("SELECT * FROM `hunt` WHERE `id` = '" json_decode($user['huntList'])[$mobid] . "'")) {
    
$mob $result221->fetch_array(MYSQLI_ASSOC);
} else {
    
?>
    <script>showContent("/main.php");</script>
    <?php
    
exit(0);
}
?>


<center>
    - <?php echo $mob['name']; ?> -
</center>
<table class="table_block2" >
    <tr>
        <td class="block01" style="width: 2%"></td>
        <td class="block02" style="width: 96%"></td>
        <td class="block03" style="width: 2%"></td>
    </tr>
    <tr>
        <td class="block04"></td>
        <td class="block05">
    <center>
        <div>
            <canvas id="MiniCanvas"></canvas>
        </div>
        <div>
            <?php if ($user['access'] > 2) { ?> 
                <a onclick="showContent('/admin/hunt.php?mob=edit&id=<?php echo $mob['id']; ?>')">Изменить моба id[<?= $mob['id']; ?>] (Админ)</a> 
            <?php ?>        </div>  
    </center>
</td>
<td class="block06"></td>
</tr>
<tr>
    <td class="block07"></td>
    <td class="block08"></td>
    <td class="block09"></td>
</tr>
</table>
<center>
    <div class="button_alt_00  arrowHunt<?= $mob['id']; ?>" onclick="HuntMobBattleOne('<?php echo $mobid?>')">Атаковать</div>
</center>
<script>
    var MiniCanvas = $("mobitva:eq(-1)").find("#MiniCanvas").get(0);
    var ctxMiniCanvas = MiniCanvas.getContext("2d");
    var buffMiniCanvas = document.createElement("canvas");
    var ctxbuffMiniCanvas = buffMiniCanvas.getContext("2d");
    var requestAnimationFrame = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || window.msRequestAnimationFrame;
    var cancelAnimationFrame = window.cancelAnimationFrame || window.mozCancelAnimationFrame;
    var myReq;
    var weaponData = [];
    var imageweapon;
    var spriteData = [];
    var spriteImage = [];
    var PshieldNC = 0;
    var Pshield = 0;
    var Panimation = 0;
    var Pweapon = 0;
    var Panimationcount = 0;
    var Pico = <?php echo $mob['iconid']; ?>;
    var PposX = -170;
    var PposY = -130;
    MiniCanvas.width = buffMiniCanvas.width = 280;
    MiniCanvas.height = buffMiniCanvas.height = 150;

    if (Pico === 9||Pico === 19||Pico === 29||Pico === 39||Pico === 49||Pico === 59||Pico === 69) {
        PposX = -170;
        PposY = -75;
        MiniCanvas.width = buffMiniCanvas.width = 280;
        MiniCanvas.height = buffMiniCanvas.height = 200;
    }


    $.ajax({
        url: "./json/weapon/weapon_new.json?139.1114",
        dataType: "json",
        success: function (a) {
            weaponData = JSON.parse(JSON.stringify(a));
            imageweapon = new Image;
            imageweapon.src = weaponData.img;
        }
    });
    $.ajax({
        url: "./json/Mob/animation.json?136.3331",
        dataType: "json",
        success: function (a) {
            spriteData = JSON.parse(JSON.stringify(a));
            var newJson = {};
                for (a = 1; a <= spriteData.AnimCount; a++) {
                    newJson[a] = spriteData[spriteData.keyToAnim[a]];
                }
                newJson.img = spriteData.img;
                spriteData = newJson;
            for (a = 1; a < spriteData.img.length + 1; a++)
                spriteImage[a] = new Image, spriteImage[a].src = spriteData.img[a - 1];
        }
    });
    function render() {
        MiniCanvas.width = MiniCanvas.width;
        try {
            //ctxMiniCanvas.fillStyle = "#ff0000";
            //ctxMiniCanvas.fillRect(0,0,MiniCanvas.width,MiniCanvas.height);
            ctxMiniCanvas.drawImage(buffMiniCanvas,
                    0,
                    0,
                    MiniCanvas.width,
                    MiniCanvas.height,
                    0,
                    0,
                    buffMiniCanvas.width,
                    buffMiniCanvas.height
                    );
        } catch (e) {
        }
        MyLib.setTimeid[200] = setTimeout(function () {
            myReq = requestAnimationFrame(render);
        }, 1000 / 10);
    }
    myReq = requestAnimationFrame(render);

    MyLib.intervaltimer[1] = setInterval(function () {
        buffMiniCanvas.width = buffMiniCanvas.width;
        try {
            if (Panimationcount >= spriteData[Pico][Panimation].length) {
                Panimationcount = 0;
            }
            for (var a = 0; a < spriteData[Pico][Panimation][Panimationcount].length; a++) {
                if (spriteData[Pico][Panimation][Panimationcount][a][9] !== -1) {
                    ctxbuffMiniCanvas.save();
                    ctxbuffMiniCanvas.translate(Math.round(buffMiniCanvas.width / 2 + spriteData[Pico][Panimation][Panimationcount][a][4] + spriteData[Pico][Panimation][Panimationcount][a][6] / 2) + PposX, Math.round(spriteData[Pico][Panimation][Panimationcount][a][5] + spriteData[Pico][Panimation][Panimationcount][a][7] / 2) + PposY);
                    ctxbuffMiniCanvas.rotate(spriteData[Pico][Panimation][Panimationcount][a][8] * Math.PI / 180);
                    ctxbuffMiniCanvas.drawImage(spriteImage[Pico], spriteData[Pico][Panimation][Panimationcount][a][0], spriteData[Pico][Panimation][Panimationcount][a][1], spriteData[Pico][Panimation][Panimationcount][a][2], spriteData[Pico][Panimation][Panimationcount][a][3], Math.round(-spriteData[Pico][Panimation][Panimationcount][a][6] / 2), Math.round(-spriteData[Pico][Panimation][Panimationcount][a][7] / 2), spriteData[Pico][Panimation][Panimationcount][a][6], spriteData[Pico][Panimation][Panimationcount][a][7]);
                    ctxbuffMiniCanvas.restore();
                } else {
                    ctxbuffMiniCanvas.save();
                    ctxbuffMiniCanvas.translate(Math.round(buffMiniCanvas.width / 2 + spriteData[Pico][Panimation][Panimationcount][a][4] + spriteData[Pico][Panimation][Panimationcount][a][6] / 2) + PposX, Math.round(spriteData[Pico][Panimation][Panimationcount][a][5] + spriteData[Pico][Panimation][Panimationcount][a][7] / 2) + PposY);
                    ctxbuffMiniCanvas.rotate(spriteData[Pico][Panimation][Panimationcount][a][8] * Math.PI / 180);
                    ctxbuffMiniCanvas.drawImage(imageweapon, weaponData.imgC[Pweapon][0], weaponData.imgC[Pweapon][1], weaponData.imgC[Pweapon][2], weaponData.imgC[Pweapon][3], Math.round(-weaponData.imgC[Pweapon][2] / 2), Math.round(-weaponData.imgC[Pweapon][3] / 2), weaponData.imgC[Pweapon][2], weaponData.imgC[Pweapon][3]);
                    ctxbuffMiniCanvas.restore();
                }
            }
        } catch (e) {

        }

        Panimationcount++;
    }, 200);



</script>
<?php
$footval 
'huntattack';
require_once (
'../system/foot/foot.php');
?>
Онлайн: 1
Реклама