-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathwow_alpha_game_objects.php
383 lines (271 loc) · 10.2 KB
/
wow_alpha_game_objects.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
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
<?php
/*
Author: X'Genesis Qhulut <XGenesis-Qhulut@protonmail.com>
Date: August 2022
See LICENSE for license details.
*/
// GAME OBJECTS
// See: https://github.com/cmangos/issues/wiki/gameobject_template
function simulateGameObject ($info)
{
global $id;
global $maps, $quests;
$row = $info ['row'];
comment ('SIMULATE GAME OBJECT');
boxTitle ('Details');
// SIMULATE GAME OBJECT
echo "<div class='simulate_box gameobject'>\n";
if ($row ['name'])
echo "<h3 style='color:yellow;'>" . fixHTML ($row ['name'] ) . "</h3>\n";
echo expandSimple (GAMEOBJECT_TYPE, $row ['type'], false);
if ($row ['mingold'])
echo "<p>Money: " . convertGold ($row ['mingold']) . ' to ' . convertGold ($row ['maxgold']);
if ($row ['type'] == GAMEOBJECT_TYPE_CHEST)
{
if ($row ['data2'])
echo "<p>Restock time: " . convertTimeGeneral ($row ['data2'] * 1000);
if ($row ['data3'])
echo "<br>Consumable\n";
if ($row ['data4'])
{
echo "<br>Loot attempts allowed: " . $row ['data4'];
if ($row ['data5'] != $row ['data4'])
echo ' to ' . $row ['data5']. "\n";
}
} // end of chest
endDiv ('simulate_box gameobject');
} // end of simulateGameObject
function listGameObjectSpawnPoints ($id)
{
$where = 'spawn_entry = ? AND ignored = 0';
$param = array ('i', &$id);
$count = 0;
comment ('SPAWN POINTS - EASTERN KINGDOMS');
// show spawn points - Eastern Kingdoms'
$results = dbQueryParam ("SELECT * FROM ".SPAWNS_GAMEOBJECTS."
WHERE $where AND spawn_map = 0", $param);
$count += listSpawnPoints ($results, 'Spawn points - Eastern Kingdoms', 'alpha_world.spawns_gameobjects',
'spawn_id', 'spawn_positionX', 'spawn_positionY', 'spawn_positionZ', 'spawn_map');
comment ('SPAWN POINTS - KALIMDOR');
// show spawn points - Kalimdor
$results = dbQueryParam ("SELECT * FROM ".SPAWNS_GAMEOBJECTS."
WHERE $where AND spawn_map = 1", $param);
$count += listSpawnPoints ($results, 'Spawn points - Kalimdor', 'alpha_world.spawns_gameobjects',
'spawn_id', 'spawn_positionX', 'spawn_positionY', 'spawn_positionZ', 'spawn_map');
comment ('SPAWN POINTS - OTHER');
// show spawn points - everywhere else
$results = dbQueryParam ("SELECT * FROM ".SPAWNS_GAMEOBJECTS."
WHERE $where AND spawn_map > 1", $param);
$count += listSpawnPoints ($results, 'Spawn points - Instances', 'alpha_world.spawns_gameobjects',
'spawn_id', 'spawn_positionX', 'spawn_positionY', 'spawn_positionZ', 'spawn_map');
if (!$count)
showNoSpawnPoints ();
comment ('END SPAWN POINTS');
} // end of listGameObjectSpawnPoints
// ---------------- QUESTS -----------------
function listGameObjectQuests ($id)
{
global $quests;
comment ('QUESTS GIVEN');
// what quests they give
$results = dbQueryParam ("SELECT * FROM ".GAMEOBJECT_QUEST_STARTER." WHERE entry = ?", array ('i', &$id));
/* I'm not so sure about this now ... The quest should exist, right?
$results = dbQueryParam ("SELECT T1.* FROM ".GAMEOBJECT_QUEST_STARTER." AS T1
INNER JOIN ".QUEST_TEMPLATE." AS T2 ON (T1.quest = T2.entry)
WHERE T1.entry = ? AND T2.ignored = 0", array ('i', &$id));
*/
listItems ('Game object starts these quests', GAMEOBJECT_QUEST_STARTER, count ($results), $results,
function ($row) use ($quests)
{
listThing ($quests, $row ['quest'], 'show_quest');
} // end listing function
, true // goes up top, slightly different CSS
);
comment ('QUESTS FINISHED');
// what quests they finish
$results = dbQueryParam ("SELECT * FROM ".GAMEOBJECT_QUEST_FINISHER." WHERE entry = ?", array ('i', &$id));
/* I'm not so sure about this now ... The quest should exist, right?
$results = dbQueryParam ("SELECT T1.* FROM ".GAMEOBJECT_QUEST_FINISHER." AS T1
INNER JOIN ".QUEST_TEMPLATE." AS T2 ON (T1.quest = T2.entry)
WHERE T1.entry = ? AND T2.ignored = 0", array ('i', &$id));
*/
listItems ('Game object finishes these quests', GAMEOBJECT_QUEST_FINISHER, count ($results), $results,
function ($row) use ($quests)
{
listThing ($quests, $row ['quest'], 'show_quest');
} // end listing function
, true // goes up top, slightly different CSS
);
} // end of listGameObjectQuests
function showGameObjectLoot ($info)
{
global $items;
$row = $info ['row'];
// ---------------- CHEST LOOT -----------------
// show chest loot, which includes mining and herb nodes
if ($row ['type'] == GAMEOBJECT_TYPE_CHEST)
{
$lootResults = dbQueryParam (
"SELECT * FROM ".GAMEOBJECT_LOOT_TEMPLATE." WHERE entry = ?
ORDER BY ChanceOrQuestChance DESC", array ('i', &$row ['data1']));
usort($lootResults, 'loot_item_compare');
listItems ('Game object loot', GAMEOBJECT_LOOT_TEMPLATE, count ($lootResults), $lootResults,
function ($row) use ($items)
{
$chance = $row ['ChanceOrQuestChance'];
listThing ($items, $row ['item'], 'show_item', $chance . "%");
} // end listing function
);
} // end of chest type
} // end of showGameObjectLoot
function showGameObjectModel ($row)
{
global $documentRoot, $executionDir;
// ---------------- IMAGE OF GAME OBJECT -----------------
if ($row ["displayId"])
{
$display_id = $row ['displayId'];
$model = $display_id . '.webp';
if (!file_exists ("$documentRoot$executionDir/game_objects/$model"))
{
comment ("$documentRoot$executionDir/game_objects/$model NOT ON FILE");
$model = 'missing_game_object.webp';
}
echo "
<!-- MODEL DISPLAY ID -->
<img
class='model-display'
src='game_objects/$model'
alt='Game object model for display ID $display_id'
/>
<!-- END MODEL DISPLAY ID -->
";
} // end of if non-zero display ID
} // end of showGameObjectModel
function gameobjectTopLeft ($info)
{
global $id;
$row = $info ['row'];
$extras = $info ['extras'];
$limit = $info ['limit'];
showGameObjectModel ($row);
comment ('SHORT LISTING OF FIELDS');
showOneThing (GAMEOBJECT_TEMPLATE, 'entry',
$id, "", "name", $extras, $limit);
} // end of gameobjectTopLeft
function gameobjectTopMiddle ($info)
{
global $id;
listGameObjectSpawnPoints ($id);
listGameObjectQuests ($id);
} // end of gameobjectTopMiddle
function gameobjectTopRight ($info)
{
global $id;
comment ('SPAWN POINTS ON MAP');
echo "<div class='caroussel__maps'>\n";
$where = 'spawn_entry = ? AND ignored = 0';
$param = array ('i', &$id);
// doArrowsForMap (SPAWNS_GAMEOBJECTS, $where, $param, 'spawn_map');
comment ('KALIMDOR');
// show spawn points - Kalimdor
$results = dbQueryParam ("SELECT * FROM ".SPAWNS_GAMEOBJECTS."
WHERE $where AND spawn_map = 1", $param);
showSpawnPoints ($results, 'Spawn points - Kalimdor', SPAWNS_GAMEOBJECTS,
'spawn_id', 'spawn_positionX', 'spawn_positionY', 'spawn_positionZ', 'spawn_map');
comment ('EASTERN KINGDOMS');
// show spawn points - Eastern Kingdoms
$results = dbQueryParam ("SELECT * FROM ".SPAWNS_GAMEOBJECTS."
WHERE $where AND spawn_map = 0", $param) ;
showSpawnPoints ($results, 'Spawn points - Eastern Kingdoms', SPAWNS_GAMEOBJECTS,
'spawn_id', 'spawn_positionX', 'spawn_positionY', 'spawn_positionZ', 'spawn_map');
comment ('END MAP SPAWN POINTS');
endDiv ('caroussel__maps');
} // end of gameobjectTopRight
function gameobjectDetails ($info)
{
global $id;
$row = $info ['row'];
topSection ($info, function ($info) use ($id)
{
topLeft ($info, 'gameobjectTopLeft');
topMiddle ($info, 'gameobjectTopMiddle');
topRight ($info , 'gameobjectTopRight');
});
middleSection ($info, function ($info) use ($id, $row)
{
middleDetails ($info, 'simulateGameObject');
listGameObjectQuests ($info);
showGameObjectLoot ($info);
});
bottomSection ($info, function ($info) use ($id)
{
$extras = $info ['extras'];
showOneThing (GAMEOBJECT_TEMPLATE, 'entry', $id,
"Database entry for game object", "name", $extras);
});
} // end of gameobjectDetails
function showOneGameobject ()
{
global $id;
if (($id === false && !repositionSearch()) || !checkID ())
return;
// we need the game object info in this function
$row = dbQueryOneParam ("SELECT * FROM ".GAMEOBJECT_TEMPLATE." WHERE entry = ?", array ('i', &$id));
if (!$row)
{
ShowWarning ("Game object $id is not on the database");
return;
} // end of not finding it
// this is the short summary fields
$limit = array (
'entry',
'type',
'faction',
'displayId',
'size',
);
// stuff to be displayed differently
$extras = array (
'faction' => 'npc_faction',
'type' => 'gameobject_type',
);
$name = $row ['name'];
setTitle ("G/O $name");
// we pass this stuff around to the helper functions
$info = array ('row' => $row, 'extras' => $extras, 'limit' => $limit);
// ready to go! show the page info and work our way down into the sub-functions
pageContent ($info, 'Gameobject', $name, 'game_objects', 'gameobjectDetails', GAMEOBJECT_TEMPLATE);
} // end of showOneGameobject
function showGameObjects ()
{
global $where, $params, $npc_factions, $sort_order, $matches;
$sortFields = array (
'entry',
'name',
'faction',
);
if (!in_array ($sort_order, $sortFields))
$sort_order = 'name';
setTitle ("Game objects listing");
$td = function ($s) use (&$row) { tdx ($row [$s]); };
$headings = array ('Entry', 'Name', 'Faction');
$results = setUpSearch ('Game Objects', $sortFields, $headings);
if (!$results)
return;
$searchURI = makeSearchURI (true);
$pos = 0;
foreach ($results as $row)
{
$pos++;
echo "<tr>\n";
$id = $row ['entry'];
tdh ("<a href='?action=show_go&id=$id$searchURI&pos=$pos&max=$matches'>$id</a>");
tdh ("<a href='?action=show_go&id=$id$searchURI&pos=$pos&max=$matches'>" . fixHTML ($row ['name']) . "</a>");
td (expandSimple ($npc_factions, $row ["faction"]));;
showFilterColumn ($row);
echo "</tr>\n";
}
wrapUpSearch ();
} // end of showGameObjects
?>