Файл: map.php
Строк: 95
<?php
include_once('data/mysql.cfg');
// MAP FILE
$dsql = mysql_query("
SELECT *
FROM user
WHERE login='".$_GET['login']."'");
$data = mysql_fetch_assoc($dsql);
$psy = $data['posy']+1;
$osql = mysql_query("
SELECT *
FROM user
WHERE loc='".$data['loc']."'
AND posx='".$data['posx']."'
AND posy='".$psy."'");
$oata = mysql_fetch_assoc($osql);
if(empty($oata['race']))
{
$oata['race'] = 'texture';
$oata['avatar'] = 'trans.png';
}
$mapsql = mysql_query("
SELECT *
FROM map
WHERE location='".$data['loc']."'");
if(!$mapsql)
{
echo '<div class="error">Error: '.mysql_error().'</div>';
}
$mdata = mysql_fetch_assoc($mapsql);
$m = explode('|', $mdata[$data['posy']]);
$mt = explode('|', $mdata[$data['posy']-1]);
$mtt = explode('|', $mdata[$data['posy']-2]);
$mb = explode('|', $mdata[$data['posy']+1]);
$mbb = explode('|', $mdata[$data['posy']+2]);
// TOP LINE
$t = $mt[$data['posx']];
if(empty($t)) $t ='0.png';
$tt = $mtt[$data['posx']];
if(empty($tt)) $tt ='0.png';
$tl = $mt[$data['posx']-1];
if(empty($tl)) $tl ='0.png';
$ttl = $mtt[$data['posx']-1];
if(empty($ttl)) $ttl ='0.png';
$tll = $mt[$data['posx']-2];
if(empty($tll)) $tll ='0.png';
$ttll = $mtt[$data['posx']-2];
if(empty($ttll))$ttll = '0.png';
$tr = $mt[$data['posx']+1];
if(empty($tr)) $tr ='0.png';
$ttr = $mtt[$data['posx']+1];
if(empty($ttr)) $ttr ='0.png';
$trr = $mt[$data['posx']+2];
if(empty($trr)) $trr ='0.png';
$ttrr = $mtt[$data['posx']+2];
if(empty($ttrr)) $ttrr ='0.png';
// CENTER LINE
$c = $m[$data['posx']];
$cl = $m[$data['posx']-1];
if(empty($cl)) $cl ='0.png';
$cll = $m[$data['posx']-2];
if(empty($cll)) $cll ='0.png';
$cr = $m[$data['posx']+1];
if(empty($cr)) $cr ='0.png';
$crr = $m[$data['posx']+2];
if(empty($crr)) $crr ='0.png';
// BOTTOM LINE
$b = $mb[$data['posx']];
if(empty($b)) $b ='0.png';
$bb = $mbb[$data['posx']];
if(empty($bb)) $bb ='0.png';
$bl = $mb[$data['posx']-1];
if(empty($bl)) $bl ='0.png';
$bbl = $mbb[$data['posx']-1];
if(empty($bbl)) $bbl ='0.png';
$bll = $mb[$data['posx']-2];
if(empty($bll)) $bll ='0.png';
$bbll = $mbb[$data['posx']-2];
if(empty($bbll)) $bbll ='0.png';
$br = $mb[$data['posx']+1];
if(empty($br)) $br ='0.png';
$bbr = $mbb[$data['posx']+1];
if(empty($bbr)) $bbr ='0.png';
$brr = $mb[$data['posx']+2];
if(empty($brr)) $brr ='0.png';
$bbrr = $mbb[$data['posx']+2];
if(empty($bbrr)) $bbrr ='0.png';
// IMAGE CREATING
$dest = imagecreatefrompng('interface/graphics/texture/clear.png');
$imgc = imagecreatefrompng('interface/graphics/map/'.$c);
$imgava = imagecreatefrompng('interface/graphics/'.$data['race'].'/'.$data['avatar']);
#$imgava2 = imagecreatefrompng('interface/graphics/'.$oata['race'].'/'.$oata['avatar']);
$imgcr = imagecreatefrompng('interface/graphics/map/'.$cr);
$imgcrr = imagecreatefrompng('interface/graphics/map/'.$crr);
$imgcl = imagecreatefrompng('interface/graphics/map/'.$cl);
$imgcll = imagecreatefrompng('interface/graphics/map/'.$cll);
$imgt = imagecreatefrompng('interface/graphics/map/'.$t);
$imgtl = imagecreatefrompng('interface/graphics/map/'.$tl);
$imgtll = imagecreatefrompng('interface/graphics/map/'.$tll);
$imgtr = imagecreatefrompng('interface/graphics/map/'.$tr);
$imgtrr = imagecreatefrompng('interface/graphics/map/'.$trr);
$imgtt = imagecreatefrompng('interface/graphics/map/'.$tt);
$imgttl = imagecreatefrompng('interface/graphics/map/'.$ttl);
$imgttll = imagecreatefrompng('interface/graphics/map/'.$ttll);
$imgttr = imagecreatefrompng('interface/graphics/map/'.$ttr);
$imgttrr = imagecreatefrompng('interface/graphics/map/'.$ttrr);
$imgb = imagecreatefrompng('interface/graphics/map/'.$b);
$imgbr = imagecreatefrompng('interface/graphics/map/'.$br);
$imgbrr = imagecreatefrompng('interface/graphics/map/'.$brr);
$imgbl = imagecreatefrompng('interface/graphics/map/'.$bl);
$imgbll = imagecreatefrompng('interface/graphics/map/'.$bll);
$imgbb = imagecreatefrompng('interface/graphics/map/'.$bb);
$imgbbr = imagecreatefrompng('interface/graphics/map/'.$bbr);
$imgbbrr = imagecreatefrompng('interface/graphics/map/'.$bbrr);
$imgbbl = imagecreatefrompng('interface/graphics/map/'.$bbl);
$imgbbll = imagecreatefrompng('interface/graphics/map/'.$bbll);
// IMAGE COPYING
#include_once('s.php');
// TOP
imagecopy($dest, $imgttll, 0, 0, 0, 0, 100, 100);
imagecopy($dest, $imgttl, 20, 0, 0, 0, 100, 100);
imagecopy($dest, $imgtt, 40, 0, 0, 0, 100, 100);
imagecopy($dest, $imgttr, 60, 0, 0, 0, 100, 100);
imagecopy($dest, $imgttrr, 80, 0, 0, 0, 100, 100);
// TOP
imagecopy($dest, $imgtll, 0, 20, 0, 0, 100, 100);
imagecopy($dest, $imgtl, 20, 20, 0, 0, 100, 100);
imagecopy($dest, $imgt, 40, 20, 0, 0, 100, 100);
imagecopy($dest, $imgtr, 60, 20, 0, 0, 100, 100);
imagecopy($dest, $imgtrr, 80, 20, 0, 0, 100, 100);
// CENTER
imagecopy($dest, $imgcll, 0, 40, 0, 0, 100, 100);
imagecopy($dest, $imgcl, 20, 40, 0, 0, 100, 100);
imagecopy($dest, $imgc, 40, 40, 0, 0, 100, 100);
imagecopy($dest, $imgava, 40, 40, 0, 0, 100, 100);
imagecopy($dest, $imgcr, 60, 40, 0, 0, 100, 100);
imagecopy($dest, $imgcrr, 80, 40, 0, 0, 100, 100);
// BOTTOM
imagecopy($dest, $imgbll, 0, 60, 0, 0, 100, 100);
imagecopy($dest, $imgbl, 20, 60, 0, 0, 100, 100);
imagecopy($dest, $imgb, 40, 60, 0, 0, 100, 100);
#imagecopy($dest, $imgava2, 40, 60, 0, 0, 100, 100);
imagecopy($dest, $imgbr, 60, 60, 0, 0, 100, 100);
imagecopy($dest, $imgbrr, 80, 60, 0, 0, 100, 100);
// BOTTOM
imagecopy($dest, $imgbbll, 0, 80, 0, 0, 100, 100);
imagecopy($dest, $imgbbl, 20, 80, 0, 0, 100, 100);
imagecopy($dest, $imgbb, 40, 80, 0, 0, 100, 100);
imagecopy($dest, $imgbbr, 60, 80, 0, 0, 100, 100);
imagecopy($dest, $imgbbrr, 80, 80, 0, 0, 100, 100);
// PRINT IMAGE
header('Content-Type: image/png');
imagepng($dest);
// DESTROY TEXTURES
imagedestroy($dest);
imagedestroy($imgc);
imagedestroy($imgcl);
imagedestroy($imgcll);
imagedestroy($imgcr);
imagedestroy($imgcrr);
imagedestroy($imgt);
imagedestroy($imgtt);
imagedestroy($imgtl);
imagedestroy($imgttl);
imagedestroy($imgtr);
imagedestroy($imgttr);
imagedestroy($imgttll);
imagedestroy($imgttrr);
imagedestroy($imgb);
imagedestroy($imgbb);
imagedestroy($imgbl);
imagedestroy($imgbbl);
imagedestroy($imgbr);
imagedestroy($imgbbr);
imagedestroy($imgbbll);
imagedestroy($imgbbrr);