clans fixes

This commit is contained in:
lopar 2018-03-03 19:16:13 +02:00
parent 6700bed0d5
commit 55ee806723
3 changed files with 45 additions and 17 deletions

View File

@ -9,38 +9,44 @@ class nick
{ {
private $user_data; private $user_data;
/** /**
* nick constructor. * nick constructor.
* @param int $playerId * @param int $playerId
*/ */
public function __construct($playerId) { public function __construct($playerId)
{
if (!$this->user_data) { if (!$this->user_data) {
$user = db::c()->query('SELECT `login`, `level`, `hp`, `align`, `klan`, `hp`, `maxhp` FROM `users` WHERE `id` = ?i',$playerId)->fetch_assoc(); $user = db::c()->query('SELECT `login`, `level`, `align`, (SELECT `short` FROM `clans` WHERE `clans`.`id` = `klan`) AS `klan`, `hp`, `maxhp` FROM `users` WHERE `id` = ?i', $playerId)->fetch_assoc();
$this->user_data = $user; $this->user_data = $user;
} }
} }
/** /**
* @param int $showInvisibility * @param int $showInvisibility
* @return array
*/ */
public function login($showInvisibility = 0){ public function show($showInvisibility = 0)
{
$n ='';
if ($showInvisibility) { if ($showInvisibility) {
$this->user_data['login'] = 'Невидимка'; $this->user_data['login'] = '<i>невидимка</i>';
$this->user_data['level'] = '??'; $this->user_data['level'] = '??';
} else {
if ($this->user_data['align']) {
$n .= sprintf('<img src="i/align_%s.gif">', $this->user_data['align']);
}
if ($this->user_data['klan']) {
$n .= sprintf('<img src="i/klan/%s.gif">', $this->user_data['klan']);
}
} }
if ($this->user_data['align']) { $n .= sprintf('<b>%s</b> [%s] <a href="inf.php?%s" target="_blank"><img src="i/inf.gif" style="width:12px;height:11px"></a>', $this->user_data['login'], $this->user_data['level'], $this->user_data['login']);
$n.= sprintf('<img src="i/align_%s.gif">', $this->user_data['align']);
}
if ($this->user_data['klan']) {
$n. = sprintf('');
}
// if ($this->invis){ // if ($this->invis){
// // db::c()->query('SELECT `time` FROM `effects` WHERE `owner` = ?i AND `type` = ?i', $id, 1022)->fetch_assoc(); // // db::c()->query('SELECT `time` FROM `effects` WHERE `owner` = ?i AND `type` = ?i', $id, 1022)->fetch_assoc();
// $user['login'] = 'невидимка'; // $user['login'] = 'невидимка';
// $user['level'] = 100; // $user['level'] = 100;
// } // }
return $this->user_data; echo $n;
} }
} }

View File

@ -1470,8 +1470,27 @@ function getslot($i, $user1 = 0)
} }
} }
function nickname(){ /**
$s=1; * @param $playerId
* @param int $showInvisibility
*/
function nickname($playerId, $showInvisibility = 0){
$user = db::c()->query('SELECT `login`, `level`, `align`, (SELECT `short` FROM `clans` WHERE `clans`.`id` = `klan`) AS `klan`, `hp`, `maxhp` FROM `users` WHERE `id` = ?i', $playerId)->fetch_assoc();
$n ='';
if ($showInvisibility) {
$user['login'] = '<i>невидимка</i>';
$user['level'] = '??';
} else {
if ($user['align']) {
$n .= sprintf('<img src="i/align_%s.gif">', $user['align']);
}
if ($user['klan']) {
$n .= sprintf('<img src="i/klan/%s.gif">', $user['klan']);
}
}
$n .= sprintf('<b>%s</b> [%s] <a href="inf.php?%s" target="_blank"><img src="i/inf.gif" style="width:12px;height:11px"></a>', $user['login'], $user['level'], $user['login']);
echo $n;
} }
function nick($user) function nick($user)

View File

@ -4,6 +4,8 @@ session_start();
if ($_SESSION['uid'] == null) header("Location: index.php"); if ($_SESSION['uid'] == null) header("Location: index.php");
include_once 'config.php'; include_once 'config.php';
include_once 'functions.php'; include_once 'functions.php';
if (!$user['klan']) { if (!$user['klan']) {
die(err('Вы не состоите в клане!')); die(err('Вы не состоите в клане!'));
} }
@ -58,8 +60,8 @@ $polno = unserialize($klan['vozm']);
Hint3Name = ''; Hint3Name = '';
} }
function use() { function use(option) {
document.getElementById("add_member").innerHTML = "<form method='post'><input placeholder='Имя персонажа' name='login'><button name='add_member' type='submit'>Ок</button></form>"; document.getElementById(option).innerHTML = "<form method='post'><input placeholder='Имя персонажа' name='login'><button name='"+option+"' type='submit'>Ок</button></form>";
} }
</script> </script>
</head> </head>
@ -94,7 +96,7 @@ $polno = unserialize($klan['vozm']);
?> ?>
<span id="add_member"><input type="submit" onclick="use()" value="Принять в клан"></span> <span id="add_member"><input type="submit" onclick="use('add_member')" value="Принять в клан"></span>
<?php <?php
if ($klan['glava'] == $user['id'] OR $polno[$user['id']][0] == 1 OR $polno[$user['id']][1] == 1) { if ($klan['glava'] == $user['id'] OR $polno[$user['id']][0] == 1 OR $polno[$user['id']][1] == 1) {
@ -229,6 +231,7 @@ $polno = unserialize($klan['vozm']);
while ($row = $data->fetch_assoc()) { while ($row = $data->fetch_assoc()) {
if ($row['online'] > 0) { if ($row['online'] > 0) {
echo '<A HREF="javascript:top.AddToPrivate(\'', nick7($row['id']), '\', top.CtrlPress)" target=refreshed><img src="i/lock.gif" width=20 height=15></A>'; echo '<A HREF="javascript:top.AddToPrivate(\'', nick7($row['id']), '\', top.CtrlPress)" target=refreshed><img src="i/lock.gif" width=20 height=15></A>';
nickname($row['id']);
nick2($row['id']); nick2($row['id']);
if ($row['id'] == $klan['glava']) { if ($row['id'] == $klan['glava']) {
echo ' - <font color=#008080><b>Глава клана</b></font>'; echo ' - <font color=#008080><b>Глава клана</b></font>';