-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathinn.php
More file actions
59 lines (49 loc) · 1.18 KB
/
inn.php
File metadata and controls
59 lines (49 loc) · 1.18 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
<?php
$pagetitle = 'Inn Database';
$NEEDPUB = true;
require 'common.php';
$_GET['inn'] = preg_replace("/[^0-9]/", "", $_GET['inn'] );
if (!isset($_GET['inn']))
{
$tpl->message = 'No inn ID specified.';
$tpl->Execute(null);
exit;
}
$inns = array();
$quizzes = array();
$inn = $eoserv_inns->Get($_GET['inn']);
if (!$inn)
{
$tpl->message = 'Inn ID #'. $_GET['inn']. ' Does Not Exist';
$tpl->Execute(null);
exit;
}
$inn->lowname = $eoserv_maps->Get($inn->spawnmap)->name;
$inn->hiname = $eoserv_maps->Get($inn->hi_spawnmap)->name;
foreach ($inn->quizzes as $quiz)
{
$quizzes[] = array(
'question' => $quiz->question,
'answer' => $quiz->answer,
);
}
$npc_count = 0;
foreach ($eoserv_npcs->Data() as $npc)
{
if ($npc->type == 7 && $npc->shopid == $inn->id)
{
$image = 'npcimage/gif/' . (61 + $eoserv_npcs->Get($npc->id)->graphic * 40) . '.gif';
if (!file_exists($image)) $image = null;
$inns[] = array(
'npcid' => $npc->id,
'name' => $npc->name,
'image' => $image,
'row' => $npc_count % 4
);
++$npc_count;
}
}
$tpl->inns = (count($inns) == 0) ? null : $inns;
$tpl->quizzes = (count($quizzes) == 0) ? null : $quizzes;
$tpl->inn = (array)$inn;
$tpl->Execute('inn');