Файл: alinar.ru/modules/wears.php
Строк: 47
<?
class WEARS {
var $shmot = array(
"weapon1" => '',
"weapon2" => '',
"ring1" => '',
"ring2" => '',
"amulet" => '',
"helmet" => '',
"body" => '',
"belt" => '',
"arms" => '',
"gloves" => '',
"foots" => ''
);
function get_wears($id) {
$wears = query ("SELECT * FROM inventory WHERE owner=".$id." and weared=1");
while($w=mysql_fetch_array($wears)):
if ($w["stype"]=='sword' || $w["stype"]=='axe'):
$this->shmot["weapon1"] = array($w["ID"],$w["name"],$w["image"],'');
elseif ($w["stype"]=='knife'):
if (!is_array($this->shmot["weapon2"])):
$this->shmot["weapon2"] = array($w["ID"],$w["name"],$w["image"],'');
else:
$this->shmot["weapon1"] = array($w["ID"],$w["name"],$w["image"],'');
endif;
elseif ($w["stype"]=='ring'):
if (!is_array($this->shmot["ring1"])):
$this->shmot["ring1"] = array($w["ID"],$w["name"],$w["image"],'');
else:
$this->shmot["ring2"] = array($w["ID"],$w["name"],$w["image"],'');
endif;
elseif ($w["stype"]=='amulet'):
$this->shmot["amulet"] = array($w["ID"],$w["name"],$w["image"],'');
elseif ($w["stype"]=='helmet'):
$this->shmot["helmet"] = array($w["ID"],$w["name"],$w["image"],'');
elseif ($w["stype"]=='body'):
$this->shmot["body"] = array($w["ID"],$w["name"],$w["image"],'');
elseif ($w["stype"]=='belt'):
$this->shmot["belt"] = array($w["ID"],$w["name"],$w["image"],'');
elseif ($w["stype"]=='arms'):
$this->shmot["arms"] = array($w["ID"],$w["name"],$w["image"],'');
elseif ($w["stype"]=='gloves'):
$this->shmot["gloves"] = array($w["ID"],$w["name"],$w["image"],'');
elseif ($w["stype"]=='foots'):
$this->shmot["foots"] = array($w["ID"],$w["name"],$w["image"],'');
endif;
endwhile;
}
function wears_character_string () {
$out = '';
foreach ($this->shmot as $k=>$v):
if ($out<>''): $out = $out . ','; endif;
$out = $out . "['".$k."','".$v[0]."','".$v[1]."','".$v[2]."','".$v[3]."']";
endforeach;
echo $out;
}
function wears_API_string () {
$out = '';
foreach ($this->shmot as $k=>$v):
if ($out<>''): $out = $out . '&'; endif;
$out = $out . $k."|".$v[0]."|".$v[1]."|".$v[2]."|".$v[3];
endforeach;
return $out;
}
}
?>