it works?!
This commit is contained in:
parent
a7a6e62f04
commit
98213698e8
131
classes/Item.php
131
classes/Item.php
@ -60,6 +60,10 @@ abstract class Item
|
||||
public $mfuvorot;
|
||||
public $mfauvorot;
|
||||
|
||||
public $magic;
|
||||
public $magic_name = 'Неизвестная магия';
|
||||
public $magic_img;
|
||||
|
||||
/**
|
||||
* Item constructor.
|
||||
*
|
||||
@ -67,62 +71,66 @@ abstract class Item
|
||||
*/
|
||||
public function __construct($row)
|
||||
{
|
||||
$this->name = $row['name'];
|
||||
$this->massa = $row['massa'];
|
||||
$this->maxdur = $row['maxdur'];
|
||||
$this->img = $row['img'];
|
||||
|
||||
$this->type = $row['type'];
|
||||
|
||||
$this->nlevel = $row['nlevel'];
|
||||
$this->nalign = $row['nalign'];
|
||||
$this->nsila = $row['nsila'];
|
||||
$this->nlovk = $row['nlovk'];
|
||||
$this->ninta = $row['ninta'];
|
||||
$this->nvinos = $row['nvinos'];
|
||||
$this->nintel = $row['nintel'];
|
||||
$this->nmudra = $row['nmudra'];
|
||||
$this->nnoj = $row['nnoj'];
|
||||
$this->ntopor = $row['ntopor'];
|
||||
$this->ndubina = $row['ndubina'];
|
||||
$this->nmech = $row['nmech'];
|
||||
$this->nfire = $row['nfire'];
|
||||
$this->nwater = $row['nwater'];
|
||||
$this->nair = $row['nair'];
|
||||
$this->nearth = $row['nearth'];
|
||||
$this->nlight = $row['nlight'];
|
||||
$this->ngray = $row['ngray'];
|
||||
$this->ndark = $row['ndark'];
|
||||
|
||||
$this->minu = $row['minu'];
|
||||
$this->maxu = $row['maxu'];
|
||||
|
||||
$this->gsila = $row['gsila'];
|
||||
$this->glovk = $row['glovk'];
|
||||
$this->ginta = $row['ginta'];
|
||||
$this->gintel = $row['gintel'];
|
||||
$this->gnoj = $row['gnoj'];
|
||||
$this->gtopor = $row['gtopor'];
|
||||
$this->gdubina = $row['gdubina'];
|
||||
$this->gmech = $row['gmech'];
|
||||
$this->gfire = $row['gfire'];
|
||||
$this->gwater = $row['gwater'];
|
||||
$this->gair = $row['gair'];
|
||||
$this->gearth = $row['gearth'];
|
||||
$this->glight = $row['glight'];
|
||||
$this->ggray = $row['ggray'];
|
||||
$this->gdark = $row['gdark'];
|
||||
$this->ghp = $row['ghp'];
|
||||
|
||||
$this->bron1 = $row['bron1'];
|
||||
$this->bron2 = $row['bron2'];
|
||||
$this->bron3 = $row['bron3'];
|
||||
$this->bron4 = $row['bron4'];
|
||||
|
||||
$this->mfkrit = $row['mfkrit'];
|
||||
$this->mfakrit = $row['mfakrit'];
|
||||
$this->mfuvorot = $row['mfuvorot'];
|
||||
$this->mfauvorot = $row['mfauvorot'];
|
||||
foreach ($this as $key=>$value) {
|
||||
$this->$key = $row[$key];
|
||||
}
|
||||
// ТА ЛААААДНО?!
|
||||
// $this->name = $row['name'];
|
||||
// $this->massa = $row['massa'];
|
||||
// $this->maxdur = $row['maxdur'];
|
||||
// $this->img = $row['img'];
|
||||
//
|
||||
// $this->type = $row['type'];
|
||||
//
|
||||
// $this->nlevel = $row['nlevel'];
|
||||
// $this->nalign = $row['nalign'];
|
||||
// $this->nsila = $row['nsila'];
|
||||
// $this->nlovk = $row['nlovk'];
|
||||
// $this->ninta = $row['ninta'];
|
||||
// $this->nvinos = $row['nvinos'];
|
||||
// $this->nintel = $row['nintel'];
|
||||
// $this->nmudra = $row['nmudra'];
|
||||
// $this->nnoj = $row['nnoj'];
|
||||
// $this->ntopor = $row['ntopor'];
|
||||
// $this->ndubina = $row['ndubina'];
|
||||
// $this->nmech = $row['nmech'];
|
||||
// $this->nfire = $row['nfire'];
|
||||
// $this->nwater = $row['nwater'];
|
||||
// $this->nair = $row['nair'];
|
||||
// $this->nearth = $row['nearth'];
|
||||
// $this->nlight = $row['nlight'];
|
||||
// $this->ngray = $row['ngray'];
|
||||
// $this->ndark = $row['ndark'];
|
||||
//
|
||||
// $this->minu = $row['minu'];
|
||||
// $this->maxu = $row['maxu'];
|
||||
//
|
||||
// $this->gsila = $row['gsila'];
|
||||
// $this->glovk = $row['glovk'];
|
||||
// $this->ginta = $row['ginta'];
|
||||
// $this->gintel = $row['gintel'];
|
||||
// $this->gnoj = $row['gnoj'];
|
||||
// $this->gtopor = $row['gtopor'];
|
||||
// $this->gdubina = $row['gdubina'];
|
||||
// $this->gmech = $row['gmech'];
|
||||
// $this->gfire = $row['gfire'];
|
||||
// $this->gwater = $row['gwater'];
|
||||
// $this->gair = $row['gair'];
|
||||
// $this->gearth = $row['gearth'];
|
||||
// $this->glight = $row['glight'];
|
||||
// $this->ggray = $row['ggray'];
|
||||
// $this->gdark = $row['gdark'];
|
||||
// $this->ghp = $row['ghp'];
|
||||
//
|
||||
// $this->bron1 = $row['bron1'];
|
||||
// $this->bron2 = $row['bron2'];
|
||||
// $this->bron3 = $row['bron3'];
|
||||
// $this->bron4 = $row['bron4'];
|
||||
//
|
||||
// $this->mfkrit = $row['mfkrit'];
|
||||
// $this->mfakrit = $row['mfakrit'];
|
||||
// $this->mfuvorot = $row['mfuvorot'];
|
||||
// $this->mfauvorot = $row['mfauvorot'];
|
||||
|
||||
switch ($this->type) {
|
||||
case 1:
|
||||
@ -232,4 +240,15 @@ IMG;
|
||||
if ($this->bron3) echo "<br>Броня пояса" . $this->wrap($this->bron3);
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
11
test.php
11
test.php
@ -15,7 +15,16 @@ require_once 'config.php';
|
||||
# $items = []; foreach(фетч того ебучего массива as $value) {$items[$value['id']] = $value}
|
||||
|
||||
$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');
|
||||
while ($row = $result->fetch_assoc()) {
|
||||
$iteminfo[] = new ShopItem($row);
|
||||
|
Loading…
Reference in New Issue
Block a user