-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathcharacter.php
More file actions
71 lines (60 loc) · 2.28 KB
/
character.php
File metadata and controls
71 lines (60 loc) · 2.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<?php
$pagetitle = 'Character';
$NEEDPUB = array('EIF' => true, 'ECF' => true, 'ESF' => true);
require 'common.php';
if (!$logged)
{
$tpl->message = 'You must be logged in to view this page.';
$tpl->Execute(null);
exit;
}
if (empty($_GET['name']))
{
$tpl->message = 'No character name specified.';
$tpl->Execute(null);
exit;
}
if ($GM)
{
$character = webcp_db_fetchall("SELECT * FROM characters WHERE name = ? LIMIT 1", strtolower($_GET['name']));
}
else
{
$character = webcp_db_fetchall("SELECT * FROM characters WHERE name = ? AND account = ? LIMIT 1", strtolower($_GET['name']), $sess->username);
}
if (empty($character))
{
$tpl->message = 'Character does not exist' . ($GM ? '.' : ' or is not yours.');
$tpl->Execute(null);
exit;
}
$character = $character[0];
$character['name'] = ucfirst($character['name']);
$character['gender'] = $character['gender']?'Male':'Female';
$character['title'] = empty($character['title'])?'-':ucfirst($character['title']);
$character['home'] = empty($character['home'])?'-':ucfirst($character['home']);
$character['usage_str'] = floor($character['usage']/60).' hour(s)';
$character['karma_str'] = karma_str($character['karma']);
$character['inventory'] = unserialize_inventory($character['inventory']);
$character['bank'] = unserialize_inventory($character['bank']);
$character['paperdoll'] = unserialize_paperdoll($character['paperdoll']);
$character['spells'] = unserialize_spells($character['spells']);
if (!empty($character['guild']))
{
$guildinfo = webcp_db_fetchall("SELECT * FROM guilds WHERE tag = ?", $character['guild']);
if (!empty($guildinfo[0]))
{
$character['guild_name'] = ucfirst($guildinfo[0]['name']);
$character['guild_rank_str'] = guildrank_str(unserialize_guildranks($guildinfo[0]['ranks']), $character['guild_rank']);
}
}
$character['class_str'] = class_str($character['class']);
$character['haircolor_str'] = haircolor_str($character['haircolor']);
$character['race_str'] = race_str($character['race']);
$character['partner'] = empty($character['partner'])?'-':ucfirst($character['partner']);
$character['exp'] = number_format($character['exp']);
$character['admin_str'] = adminrank_str($character['admin']);
$pagetitle .= ': '.htmlentities($character['name']);
$tpl->pagetitle = $pagetitle;
$tpl->character = $character;
$tpl->Execute('character');