game/_incl_data/class/Battle/Info.php

209 lines
5.4 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
namespace Battle;
use Core\Db;
class Info
{
public readonly int $id;
public readonly string $city;
public readonly int $timeStart;
public readonly int $testFinish;
public readonly string $players;
public readonly int $timeout;
public readonly int $type;
public readonly int $status;
public readonly int $kulak;
public readonly int $invis;
public readonly int $noinc;
public readonly int $travmchance;
public readonly int $typebattle;
private float $addexp;
public readonly float $money;
public readonly float $money3;
public readonly int $timeover;
private int $teamwin;
public readonly string $dungeon;
public readonly int $razdel;
public readonly int $dnId;
public readonly int $x;
public readonly int $y;
public readonly string $fdate;
public readonly int $izlom;
public readonly int $izlomlvl;
private int $izlomround;
private int $start1;
private int $start2;
public readonly int $izlomroundsee;
public readonly int $izlomobr;
public readonly int $izlomobrnow;
public readonly int $turnir;
public readonly int $inturnir;
public readonly int $clone;
private int $playersC;
private int $playersCC;
private int $playersCC2;
public readonly int $fastfight;
public readonly ?int $nobot;
public readonly ?int $kingfight;
public readonly ?int $arand;
public readonly ?int $noatack;
public readonly ?int $noeff;
public readonly ?int $smert;
public readonly ?int $noart;
public readonly int $zarad;
public readonly int $priz;
public readonly int $otmorozok;
public readonly int $otmorozokUse;
public readonly int $hod;
public readonly int $clan1;
public readonly int $clan2;
public function getAddexp(): float
{
return $this->addexp;
}
public function getTeamwin(): int
{
return $this->teamwin;
}
public function getIzlomround(): int
{
return $this->izlomround;
}
public function getStart1(): int
{
return $this->start1;
}
public function getStart2(): int
{
return $this->start2;
}
public function getPlayersC(): int
{
return $this->playersC;
}
public function getPlayersCC(): int
{
return $this->playersCC;
}
public function getPlayersCC2(): int
{
return $this->playersCC2;
}
/**
* Иноформация о поединке.
* @param int $battleId
*/
public function __construct(int $battleId)
{
$b = Db::getRow('select * from battle where id = ?', [$battleId]);
if (!$b) {
return;
}
$this->id = $b['id'];
$this->city = $b['city'];
$this->timeStart = $b['time_start'];
$this->testFinish = $b['testfinish'];
$this->players = $b['players'];
$this->timeout = $b['timeout'];
$this->type = $b['type'];
$this->status = $b['status'];
$this->kulak = $b['kulak'];
$this->invis = $b['invis'];
$this->noinc = $b['noinc'];
$this->travmchance = $b['travmChance'];
$this->typebattle = $b['typeBattle'];
$this->addexp = $b['addExp'];
$this->money = $b['money'];
$this->money3 = $b['money3'];
$this->timeover = $b['time_over'];
$this->teamwin = $b['team_win'];
$this->dungeon = $b['dungeon'];
$this->razdel = $b['razdel'];
$this->dnId = $b['dn_id'];
$this->x = $b['x'];
$this->y = $b['y'];
$this->fdate = $b['fDate'];
$this->izlom = $b['izlom'];
$this->izlomlvl = $b['izlomLvl'];
$this->izlomround = $b['izlomRound'];
$this->start1 = $b['start1'];
$this->start2 = $b['start2'];
$this->izlomroundsee = $b['izlomRoundSee'];
$this->izlomobr = $b['izlomObr'];
$this->izlomobrnow = $b['izlomObrNow'];
$this->turnir = $b['turnir'];
$this->inturnir = $b['inTurnir'];
$this->clone = $b['clone'];
$this->playersC = $b['players_c'];
$this->fastfight = $b['fastfight'];
$this->nobot = $b['nobot'];
$this->kingfight = $b['kingfight'];
$this->arand = $b['arand'];
$this->noatack = $b['noatack'];
$this->noeff = $b['noeff'];
$this->smert = $b['smert'];
$this->noart = $b['noart'];
$this->zarad = $b['zarad'];
$this->priz = $b['priz'];
$this->otmorozok = $b['otmorozok'];
$this->otmorozokUse = $b['otmorozok_use'];
$this->hod = $b['hod'];
$this->clan1 = $b['clan1'];
$this->clan2 = $b['clan2'];
}
/**
* Ничья
* @return void
*/
public function setDraw(): void
{
$this->playersCC = 0;
$this->playersCC2 = 0;
}
public function setTeamWin(int $team = 0): void
{
$this->teamwin = $team;
}
public function modifyAddExp(int $value): void
{
$this->addexp += $value;
}
public function setStart1(): void
{
$this->start1 = time();
}
public function setStart2(): void
{
$this->start2 = time();
}
public function setIzlomround(int $izlomround): void
{
$this->izlomround = $izlomround;
}
public function setPlayerC(): void
{
$this->playersC =
Db::getValue("select count(id) from users where login not like '%(зверь%' and battle = ?", [$this->id]);
}
}