it works?!

This commit is contained in:
Igor Barkov [iwork] 2019-01-14 15:46:20 +02:00
parent a7a6e62f04
commit 98213698e8
2 changed files with 85 additions and 57 deletions

View File

@ -60,6 +60,10 @@ abstract class Item
public $mfuvorot; public $mfuvorot;
public $mfauvorot; public $mfauvorot;
public $magic;
public $magic_name = 'Неизвестная магия';
public $magic_img;
/** /**
* Item constructor. * Item constructor.
* *
@ -67,62 +71,66 @@ abstract class Item
*/ */
public function __construct($row) public function __construct($row)
{ {
$this->name = $row['name']; foreach ($this as $key=>$value) {
$this->massa = $row['massa']; $this->$key = $row[$key];
$this->maxdur = $row['maxdur']; }
$this->img = $row['img']; // ТА ЛААААДНО?!
// $this->name = $row['name'];
$this->type = $row['type']; // $this->massa = $row['massa'];
// $this->maxdur = $row['maxdur'];
$this->nlevel = $row['nlevel']; // $this->img = $row['img'];
$this->nalign = $row['nalign']; //
$this->nsila = $row['nsila']; // $this->type = $row['type'];
$this->nlovk = $row['nlovk']; //
$this->ninta = $row['ninta']; // $this->nlevel = $row['nlevel'];
$this->nvinos = $row['nvinos']; // $this->nalign = $row['nalign'];
$this->nintel = $row['nintel']; // $this->nsila = $row['nsila'];
$this->nmudra = $row['nmudra']; // $this->nlovk = $row['nlovk'];
$this->nnoj = $row['nnoj']; // $this->ninta = $row['ninta'];
$this->ntopor = $row['ntopor']; // $this->nvinos = $row['nvinos'];
$this->ndubina = $row['ndubina']; // $this->nintel = $row['nintel'];
$this->nmech = $row['nmech']; // $this->nmudra = $row['nmudra'];
$this->nfire = $row['nfire']; // $this->nnoj = $row['nnoj'];
$this->nwater = $row['nwater']; // $this->ntopor = $row['ntopor'];
$this->nair = $row['nair']; // $this->ndubina = $row['ndubina'];
$this->nearth = $row['nearth']; // $this->nmech = $row['nmech'];
$this->nlight = $row['nlight']; // $this->nfire = $row['nfire'];
$this->ngray = $row['ngray']; // $this->nwater = $row['nwater'];
$this->ndark = $row['ndark']; // $this->nair = $row['nair'];
// $this->nearth = $row['nearth'];
$this->minu = $row['minu']; // $this->nlight = $row['nlight'];
$this->maxu = $row['maxu']; // $this->ngray = $row['ngray'];
// $this->ndark = $row['ndark'];
$this->gsila = $row['gsila']; //
$this->glovk = $row['glovk']; // $this->minu = $row['minu'];
$this->ginta = $row['ginta']; // $this->maxu = $row['maxu'];
$this->gintel = $row['gintel']; //
$this->gnoj = $row['gnoj']; // $this->gsila = $row['gsila'];
$this->gtopor = $row['gtopor']; // $this->glovk = $row['glovk'];
$this->gdubina = $row['gdubina']; // $this->ginta = $row['ginta'];
$this->gmech = $row['gmech']; // $this->gintel = $row['gintel'];
$this->gfire = $row['gfire']; // $this->gnoj = $row['gnoj'];
$this->gwater = $row['gwater']; // $this->gtopor = $row['gtopor'];
$this->gair = $row['gair']; // $this->gdubina = $row['gdubina'];
$this->gearth = $row['gearth']; // $this->gmech = $row['gmech'];
$this->glight = $row['glight']; // $this->gfire = $row['gfire'];
$this->ggray = $row['ggray']; // $this->gwater = $row['gwater'];
$this->gdark = $row['gdark']; // $this->gair = $row['gair'];
$this->ghp = $row['ghp']; // $this->gearth = $row['gearth'];
// $this->glight = $row['glight'];
$this->bron1 = $row['bron1']; // $this->ggray = $row['ggray'];
$this->bron2 = $row['bron2']; // $this->gdark = $row['gdark'];
$this->bron3 = $row['bron3']; // $this->ghp = $row['ghp'];
$this->bron4 = $row['bron4']; //
// $this->bron1 = $row['bron1'];
$this->mfkrit = $row['mfkrit']; // $this->bron2 = $row['bron2'];
$this->mfakrit = $row['mfakrit']; // $this->bron3 = $row['bron3'];
$this->mfuvorot = $row['mfuvorot']; // $this->bron4 = $row['bron4'];
$this->mfauvorot = $row['mfauvorot']; //
// $this->mfkrit = $row['mfkrit'];
// $this->mfakrit = $row['mfakrit'];
// $this->mfuvorot = $row['mfuvorot'];
// $this->mfauvorot = $row['mfauvorot'];
switch ($this->type) { switch ($this->type) {
case 1: case 1:
@ -232,4 +240,15 @@ IMG;
if ($this->bron3) echo "<br>Броня пояса" . $this->wrap($this->bron3); if ($this->bron3) echo "<br>Броня пояса" . $this->wrap($this->bron3);
if ($this->bron4) echo "<br>Броня ног" . $this->wrap($this->bron4); if ($this->bron4) echo "<br>Броня ног" . $this->wrap($this->bron4);
} }
protected function printMagic()
{
if ($this->magic) {
echo "<br>Магические свойства:";
if ($this->magic_name) echo "<br><i style='color: dimgray;'>{$this->magic_name}</i>";
if ($this->magic_img) echo <<<IMG
<img src="//{$_SERVER['SERVER_NAME']}/i/sh/{$this->magic_img}" class="item-wrap-normal">
IMG;
}
}
} }

View File

@ -15,7 +15,16 @@ require_once 'config.php';
# $items = []; foreach(фетч того ебучего массива as $value) {$items[$value['id']] = $value} # $items = []; foreach(фетч того ебучего массива as $value) {$items[$value['id']] = $value}
$iteminfo =[]; $iteminfo =[];
$result = db::c()->query('SELECT * FROM `shop` LEFT JOIN `magic` ON `magic` = `magic`.`id` WHERE count > 0 LIMIT 25'); $result = db::c()->query('SELECT `shop`.*,
`magic`.`name` AS `magic_name`,
`magic`.`chanse` AS `magic_chanse`,
`magic`.`time` AS `magic_time`,
`magic`.`file` AS `magic_file`,
`magic`.`targeted` AS `magic_targeted`,
`magic`.`needcharge` AS `magic_needcharge`,
`magic`.`img` AS `magic_img`
FROM `shop` LEFT JOIN `magic` ON `magic` = `magic`.`id` WHERE count > 0 LIMIT 25');
$result2 = db::c()->query('SELECT * FROM `inventory` WHERE owner = 11263'); $result2 = db::c()->query('SELECT * FROM `inventory` WHERE owner = 11263');
while ($row = $result->fetch_assoc()) { while ($row = $result->fetch_assoc()) {
$iteminfo[] = new ShopItem($row); $iteminfo[] = new ShopItem($row);