battles/classes/nick.php

41 lines
1.1 KiB
PHP
Raw Normal View History

2018-03-01 14:51:01 +00:00
<?php
/**
* Copyright (c) 2018.
* Author: Igor Barkov <lopar.4ever@gmail.com>
* Project name: Battles-Game
*/
class nick
{
2018-03-01 16:56:17 +00:00
private $invis;
2018-03-02 23:49:16 +00:00
private $user_data;
2018-03-03 00:07:27 +00:00
/**
* nick constructor.
2018-03-03 00:34:12 +00:00
* @param int $playerId
2018-03-03 00:07:27 +00:00
*/
2018-03-03 00:34:12 +00:00
public function __construct($playerId) {
2018-03-02 23:49:16 +00:00
if (!$this->user_data) {
$user = db::c()->query('SELECT `login`, `level`, `hp`, `align`, `klan`, `hp`, `maxhp` FROM `users` WHERE `id` = ?i',$playerId)->fetch_assoc();
$this->user_data = $user;
}
2018-03-01 16:56:17 +00:00
2018-03-01 14:51:01 +00:00
}
2018-03-03 00:34:12 +00:00
/**
* @param int $showInvisibility
* @return array
*/
2018-03-03 00:37:05 +00:00
public function login($showInvisibility = 0){
2018-03-03 00:34:12 +00:00
if ($showInvisibility) {
$this->user_data['login'] = 'Невидимка';
$this->user_data['level'] = '??';
}
2018-03-02 23:49:16 +00:00
// if ($this->invis){
// // db::c()->query('SELECT `time` FROM `effects` WHERE `owner` = ?i AND `type` = ?i', $id, 1022)->fetch_assoc();
// $user['login'] = 'невидимка';
// $user['level'] = 100;
// }
return $this->user_data;
2018-03-01 14:51:01 +00:00
}
}