-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathbot.php
239 lines (209 loc) · 8.08 KB
/
bot.php
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
<?php
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Portions of this program are derived from publicly licensed software
* projects including, but not limited to phpBB, Magelo Clone,
* EQEmulator, EQEditor, and Allakhazam Clone.
*
* Author:
* Maudigan(Airwalking)
*
* April 17, 2020 - initial revision (Maudigan)
* April 25, 2020 - Maudigan
* implement multi-tenancy
* May 3, 2020 - Maudigan
* optimize character initialization
* March 16, 2022 - Maudigan
* added item type to the API for each item
* January 11, 2023 - Maudigan
* removed the heroic stats since they aren't used
*
***************************************************************************/
/*********************************************
INCLUDES
*********************************************/
//define this as an entry point to unlock includes
if ( !defined('INCHARBROWSER') )
{
define('INCHARBROWSER', true);
}
include_once(__DIR__ . "/include/common.php");
include_once(__DIR__ . "/include/bot_profile.php");
include_once(__DIR__ . "/include/profile.php");
include_once(__DIR__ . "/include/itemclass.php");
include_once(__DIR__ . "/include/db.php");
/*********************************************
SETUP CHARACTER CLASS & PERMISSIONS
*********************************************/
$botName = preg_Get_Post('bot', '/^[a-zA-Z]+$/', false, $language['MESSAGE_ERROR'],$language['MESSAGE_NO_BOT'], true);
//bot initializations
$bot = new Charbrowser_Bot($botName); //the profile class will sanitize the bot name
$charID = $bot->char_id();
$botID = $bot->bot_id();
$botName = $bot->GetValue('name');
//char initialization
$char = new Charbrowser_Character($charID, $showsoftdelete, $charbrowser_is_admin_page);
$charName = $char->GetValue('name');
//block view if user level doesnt have permission
if ($char->Permission('bot')) $cb_error->message_die($language['MESSAGE_NOTICE'],$language['MESSAGE_ITEM_NO_VIEW']);
/*********************************************
GATHER RELEVANT PAGE DATA
*********************************************/
//get bot info
$class = $bot->GetValue('class');
/*********************************************
DROP HEADER
*********************************************/
$d_title = " - ".$botName.$language['PAGE_TITLES_CHARACTER'];
include(__DIR__ . "/include/header.php");
/*********************************************
DROP PROFILE MENU
*********************************************/
output_profile_menu($charName, 'bot');
/*********************************************
POPULATE BODY
*********************************************/
$cb_template->set_filenames(array(
'bot' => 'bot_body.tpl')
);
$cb_template->assign_both_vars(array(
'NAME' => $charName,
'REGEN' => number_format($bot->getRegen()),
'FT' => number_format($bot->getFT()),
'DS' => number_format($bot->getDS()),
'HASTE' => $bot->getHaste(),
'DELETED' => (($char->GetValue('deleted_at')) ? " ".$language['CHAR_DELETED']:""),
'FIRST_NAME' => $botName,
'LAST_NAME' => $bot->GetValue('last_name'),
'TITLE' => $bot->GetValue('title'),
'LEVEL' => $bot->GetValue('level'),
'CLASS' => $dbclassnames[$class],
'RACE' => $dbracenames[$bot->GetValue('race')],
'RACE_ID' => $bot->GetValue('race'),
'GENDER_ID' => $bot->GetValue('gender'),
'FACE_ID' => $bot->GetValue('face'),
'AVATAR_IMG' => getAvatarImage($bot->GetValue('race'), $bot->GetValue('gender'), $bot->GetValue('face')),
'CLASS_NUM' => $class,
'DEITY' => $dbdeities[$bot->GetValue('deity')],
'HP' => number_format($bot->GetItemHP()),
'MANA' => number_format($bot->GetItemMana()),
'ENDR' => number_format($bot->GetItemEndurance()),
'AC' => number_format($bot->GetItemAC()),
'ATK' => number_format($bot->GetItemATK()),
'STR' => number_format($bot->getSTR()),
'STA' => number_format($bot->getSTA()),
'DEX' => number_format($bot->getDEX()),
'AGI' => number_format($bot->getAGI()),
'INT' => number_format($bot->getINT()),
'WIS' => number_format($bot->getWIS()),
'CHA' => number_format($bot->getCHA()),
'HSTR' => number_format($bot->getHSTR()),
'HSTA' => number_format($bot->getHSTA()),
'HDEX' => number_format($bot->getHDEX()),
'HAGI' => number_format($bot->getHAGI()),
'HINT' => number_format($bot->getHINT()),
'HWIS' => number_format($bot->getHWIS()),
'HCHA' => number_format($bot->getHCHA()),
'POISON' => $bot->getPR(),
'FIRE' => $bot->getFR(),
'MAGIC' => $bot->getMR(),
'DISEASE' => $bot->getDR(),
'COLD' => $bot->getCR(),
'CORRUPT' => $bot->getCOR(),
'HPOISON' => $bot->getHPR(),
'HFIRE' => $bot->getHFR(),
'HMAGIC' => $bot->getHMR(),
'HDISEASE' => $bot->getHDR(),
'HCOLD' => $bot->getHCR(),
'HCORRUPT' => $bot->getHCOR(),
'WEIGHT' => round($bot->getWT()/10))
);
$cb_template->assign_vars(array(
'ROOT_URL' => $charbrowser_root_url,
'L_HEADER_INVENTORY' => $language['CHAR_INVENTORY'],
'L_REGEN' => $language['CHAR_REGEN'],
'L_FT' => $language['CHAR_FT'],
'L_DS' => $language['CHAR_DS'],
'L_HASTE' => $language['CHAR_HASTE'],
'L_HP' => $language['CHAR_HP'],
'L_MANA' => $language['CHAR_MANA'],
'L_ENDR' => $language['CHAR_ENDR'],
'L_AC' => $language['CHAR_AC'],
'L_ATK' => $language['CHAR_ATK'],
'L_STR' => $language['CHAR_STR'],
'L_STA' => $language['CHAR_STA'],
'L_DEX' => $language['CHAR_DEX'],
'L_AGI' => $language['CHAR_AGI'],
'L_INT' => $language['CHAR_INT'],
'L_WIS' => $language['CHAR_WIS'],
'L_CHA' => $language['CHAR_CHA'],
'L_POISON' => $language['CHAR_POISON'],
'L_MAGIC' => $language['CHAR_MAGIC'],
'L_DISEASE' => $language['CHAR_DISEASE'],
'L_FIRE' => $language['CHAR_FIRE'],
'L_COLD' => $language['CHAR_COLD'],
'L_CORRUPT' => $language['CHAR_CORRUPT'],
'L_WEIGHT' => $language['CHAR_WEIGHT'],
'L_DONE' => $language['BUTTON_DONE'])
);
//---------------------------------
// SLOTS TEMPLATE VARS
//---------------------------------
//EQUIPMENT
for ( $i = SLOT_EQUIPMENT_START; $i <= SLOT_EQUIPMENT_END; $i++ ) {
$cb_template->assign_block_vars("equipslots", array(
'SLOT' => $i)
);
}
//---------------------------------
// ITEM ICONS TEMPLATE VARS
//---------------------------------
$allitems = $bot->getAllItems();
//EQUIPMENT
foreach ($allitems as $value) {
if ($value->type() != EQUIPMENT) continue;
$cb_template->assign_block_vars("equipitem", array(
'SLOT' => $value->slot(),
'ICON' => $value->icon(),
'STACK' => $value->stack())
);
}
//---------------------------------
// ITEM WINDOW TEMPLATE VARS
//---------------------------------
//the item inspect windows that hold
//the item stats. this does equipment,
//inventory, bank and shared bank
foreach ($allitems as $value) {
$cb_template->assign_both_block_vars("item", array(
'SLOT' => $value->slot(),
'ICON' => $value->icon(),
'NAME' => $value->name(),
'STACK' => $value->stack(),
'ID' => $value->id(),
'LINK' => QuickTemplate($link_item, array('ITEM_ID' => $value->id())),
'HTML' => $value->html(),
'ITEMTYPE' => $value->skill())
);
for ( $i = 0 ; $i < $value->augcount() ; $i++ ) {
$cb_template->assign_both_block_vars("item.augment", array(
'AUG_NAME' => $value->augname($i),
'AUG_ID' => $value->augid($i),
'AUG_LINK' => QuickTemplate($link_item, array('ITEM_ID' => $value->augid($i))),
'AUG_ICON' => $value->augicon($i),
'AUG_HTML' => $value->aughtml($i))
);
}
}
/*********************************************
OUTPUT BODY AND FOOTER
*********************************************/
$cb_template->pparse('bot');
$cb_template->destroy();
include(__DIR__ . "/include/footer.php");
?>