1. finalize ekrshop

2. shop bying fixes
3. item class code clear
4. moved all gifts to separate file
5. removed artefact upgrade
This commit is contained in:
Igor Barkov [iwork]
2019-01-15 17:56:15 +02:00
parent a393f67ccd
commit 016e5a9ccd
7 changed files with 305 additions and 422 deletions

View File

@@ -98,64 +98,6 @@ abstract class Item
}
}
// ТА ЛААААДНО?!
// $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:
$this->typename = 'Серьги';

View File

@@ -10,19 +10,46 @@ class ShopItem extends Item
parent::printMagic();
}
public function buyItem($owner)
{
if ($owner) {
db::c()->query('
INSERT INTO `inventory` (`prototype`,`owner`,`name`,`type`,`massa`,`cost`,`img`,`maxdur`,`isrep`,`gsila`,`glovk`,`ginta`,`gintel`,
`ghp`,`gnoj`,`gtopor`,`gdubina`,`gmech`,`gfire`,`gwater`,`gair`,`gearth`,`glight`,`ggray`,`gdark`,
`needident`,`nsila`,`nlovk`,`ninta`,`nintel`,`nmudra`,`nvinos`,`nnoj`,`ntopor`,`ndubina`,`nmech`,
`nfire`,`nwater`,`nair`,`nearth`,`nlight`,`ngray`,`ndark`,`mfkrit`,`mfakrit`,`mfuvorot`,`mfauvorot`,
`bron1`,`bron2`,`bron3`,`bron4`,`maxu`,`minu`,`magic`,`nlevel`,`nalign`,`dategoden`,`goden`,`otdel`,
`artefact`, `koll`) VALUES (?i,?i,"?s",?i,?i,?i,"?s",?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,
?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,"?s",?i,?i)
', $this->id, $owner, $this->name, $this->type, $this->massa, $this->cost, $this->img, $this->maxdur,$this->isrep,$this->gsila,$this->glovk,$this->ginta,$this->gintel,
$this->ghp,$this->gnoj,$this->gtopor,$this->gdubina,$this->gmech,$this->gfire,$this->gwater,$this->gair,$this->gearth,$this->glight,$this->ggray,$this->gdark,
$this->needident,$this->nsila,$this->nlovk,$this->ninta,$this->nintel,$this->nmudra,$this->nvinos, $this->nnoj,$this->ntopor,$this->ndubina,$this->nmech,
$this->nfire,$this->nwater,$this->nair, $this->nearth,$this->nlight,$this->ngray,$this->ndark,$this->mfkrit,$this->mfakrit,$this->mfuvorot,$this->mfauvorot,
$this->bron1,$this->bron2,$this->bron3,$this->bron4,$this->maxu,$this->minu,$this->magic,$this->nlevel,$this->nalign,$this->dategoden,$this->goden,$this->razdel,
$this->artefact, $this->koll);
}
}
/**
* Для кнопок управления под картинкой прелмета в зависимости от ситуации.
*/
public function printControls($sell = false)
public function printControls($shopType = false)
{
if ($sell) {
$btnPrice = "Продать";
$btnLink = "/shop.php?sell={$this->id}&rnd=".mt_rand();
$this->maxdur = 0;
} else {
$btnPrice = "Купить за " . intval($this->cost) . " кр.";
$btnLink = "/shop.php?buy={$this->id}&rnd=" . mt_rand();
switch ($shopType) {
default:
$btnPrice = "Купить за " . intval($this->cost) . " кр.";
$btnLink = "/shop.php?buy={$this->id}&rnd=" . mt_rand();
break;
case 'ashop':
$btnPrice = "Купить за " . intval($this->ecost) . "р.";
$btnLink = "/ashop.php?buy={$this->id}&rnd=" . mt_rand();
break;
case 'sell':
$btnPrice = "Продать";
$btnLink = "/shop.php?sell={$this->id}&rnd=".mt_rand();
break;
}
echo <<<BTN
<p><input type="button" style="background: darkgrey; border: 1px solid grey; border-radius: 2px;" value="{$btnPrice}"
onclick="location='{$btnLink}'">