-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathwow_alpha_creatures.php
executable file
·767 lines (586 loc) · 21.5 KB
/
wow_alpha_creatures.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
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
<?php
/*
Author: X'Genesis Qhulut <[email protected]>
Date: August 2022
See LICENSE for license details.
*/
// CREATURES (NPCs)
// See: https://mangoszero-docs.readthedocs.io/en/latest/database/world/creature-loot-template.html
function creatureTopLeft ($info)
{
global $id;
global $documentRoot, $executionDir;
$row = $info ['row'];
$extras = $info ['extras'];
$limit = $info ['limit'];
// ---------------- IMAGE OF CREATURE -----------------
$navDotSize = 13;
$halfNavDotSize = $navDotSize / 2;
$count = getCount ($row, 'display_id', 4);
echo "
<!-- CAROUSSEL DISPLAY ID -->
<div class='caroussel-model' id='caroussel-model' data-modelcount='$count'>
";
for ($i = 1; $i <= 4; $i++)
{
$display_id = $row ["display_id$i"];
if ($display_id)
{
$model = $display_id . '.webp';
if (!file_exists ("$documentRoot$executionDir/creatures/$model"))
{
comment ("$documentRoot$executionDir/creatures/$model NOT ON FILE");
$model = 'missing_creature.webp';
}
$display = ($i == 1) ? 'block' : 'none';
echo "<!-- MODEL DISPLAY ID $display_id -->
<img
class='model-display'
src='creatures/$model'
alt='Creature model for display ID $display_id'
title='Model for display ID $display_id'
id='model$i'
style='display:$display;'
>
";
} // end of having a display ID
} // end of for all 4 possible display IDs
$display3 = $count > 2 ? '' : 'none';
$display4 = $count > 3 ? '' : 'none';
if ($count > 1)
{
echo "
<div class='dot-container'>
<i
id='model_navigate1'
class='fas fa-circle'
onclick='modelPage(event)'
data-page='1'
style='color:whitesmoke'
></i>
<i
id='model_navigate2'
class='fas fa-circle'
onclick='modelPage(event)'
data-page='2'
></i>
<i
id='model_navigate3'
class='fas fa-circle'
onclick='modelPage(event)'
data-page='3'
style='display:$display3'
></i>
<i
id='model_navigate4'
class='fas fa-circle'
onclick='modelPage(event)'
data-page='4'
style='display:$display4'
></i>
</div>
";
} // if we have more than one model
endDiv ('caroussel-model');
comment ('SHORT LISTING OF FIELDS');
showOneThing (CREATURE_TEMPLATE, 'entry',
$id, "", "name", $extras, $limit);
} // end of creatureTopLeft
function creatureTopMiddle ($info)
{
global $id;
global $quests, $spells, $items;
global $countOfSpawnPoints;
comment ('SPAWN POINTS - EASTERN KINGDOMS');
$countOfSpawnPoints = 0;
$where = '(spawn_entry1 = ? OR spawn_entry2 = ? OR spawn_entry3 = ? OR spawn_entry4 = ?)' .
' AND ignored = 0 ';
$param = array ('iiii', &$id, &$id, &$id, &$id);
// show spawn points - Eastern Kingdoms
$results = dbQueryParam ("SELECT * FROM ".SPAWNS_CREATURES."
WHERE $where AND map = 0", $param) ;
$countOfSpawnPoints += listSpawnPoints ($results, 'Spawn points — Eastern Kingdoms', SPAWNS_CREATURES,
'spawn_id', 'position_x', 'position_y', 'position_z', 'map', 'movement_type');
comment ('SPAWN POINTS - KALIMDOR');
// show spawn points - Kalimdor
$results = dbQueryParam ("SELECT * FROM ".SPAWNS_CREATURES."
WHERE $where AND map = 1", $param);
$countOfSpawnPoints += listSpawnPoints ($results, 'Spawn points — Kalimdor', SPAWNS_CREATURES,
'spawn_id', 'position_x', 'position_y', 'position_z', 'map', 'movement_type');
comment ('SPAWN POINTS - OTHER');
// show spawn points - other
$results = dbQueryParam ("SELECT * FROM ".SPAWNS_CREATURES."
WHERE $where AND map > 1", $param);
$countOfSpawnPoints += listSpawnPoints ($results, 'Spawn points — Instances', SPAWNS_CREATURES,
'spawn_id', 'position_x', 'position_y', 'position_z', 'map', 'movement_type');
if (!$countOfSpawnPoints)
showNoSpawnPoints ();
comment ('END SPAWN POINTS');
// ---------------- QUESTS -----------------
// show quests they start
comment ('QUESTS GIVEN');
// what quests they give
$results = dbQueryParam ("SELECT * FROM ".CREATURE_QUEST_STARTER." WHERE entry = ?", array ('i', &$id));
listItems ('NPC starts these quests', CREATURE_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 ".CREATURE_QUEST_FINISHER." WHERE entry = ?", array ('i', &$id));
listItems ('NPC finishes these quests', CREATURE_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
);
return $countOfSpawnPoints;
} // end of creatureTopMiddle
function creatureTopRight ($info)
{
global $id, $creatures;
comment ('SPAWN POINTS ON MAP');
echo "<div class='caroussel__maps'>\n";
$where = '(spawn_entry1 = ? OR spawn_entry2 = ? OR spawn_entry3 = ? OR spawn_entry4 = ?)' .
' AND ignored = 0 ';
$param = array ('iiii', &$id, &$id, &$id, &$id);
comment ('KALIMDOR');
// show spawn points - Kalimdor
$results = dbQueryParam ("SELECT * FROM ".SPAWNS_CREATURES."
WHERE $where AND map = 1", $param);
// add in creature name
foreach ($results as &$row)
$row ['name'] = $creatures [$id];
showSpawnPoints ($results, 'Spawn points — Kalimdor', SPAWNS_CREATURES,
'spawn_id', 'position_x', 'position_y', 'position_z', 'map', 'movement_type');
comment ('EASTERN KINGDOMS');
// show spawn points - Eastern Kingdoms
$results = dbQueryParam ("SELECT * FROM ".SPAWNS_CREATURES."
WHERE $where AND map = 0", $param) ;
// add in creature name
foreach ($results as &$row)
$row ['name'] = $creatures [$id];
showSpawnPoints ($results, 'Spawn points — Eastern Kingdoms', SPAWNS_CREATURES,
'spawn_id', 'position_x', 'position_y', 'position_z', 'map', 'movement_type');
comment ('END MAP SPAWN POINTS');
endDiv ('caroussel__maps');
} // end of creatureTopRight
function creatureSpells ($info)
{
global $id;
global $documentRoot, $executionDir;
global $spells;
$row = $info ['row'];
comment ('SPELLS THEY CAST');
if ($row ['spell_list_id'])
{
$spellListRow = dbQueryOneParam ("SELECT * FROM ".CREATURE_SPELLS." WHERE entry = ?", array ('i', &$row ['spell_list_id']));
if ($spellListRow)
{
$results = array ();
for ($i = 1; $i <= 8; $i++)
{
if ($spellListRow ["spellId_$i"])
{
$details =
"Probability: " . $spellListRow ["probability_$i"] . "%\n" .
"Target type: " . expandSimple (TARGET_TYPE, $spellListRow ["castTarget_$i"]) . "\n";
if ($spellListRow ["targetParam1_$i"] || $spellListRow ["targetParam2_$i"])
{
$details .= " (param1: " . $spellListRow ["targetParam1_$i"] .
", param2: " . $spellListRow ["targetParam2_$i"] . ")\n";
}
if ($spellListRow ["castFlags_$i"])
$details .= "Flags: " . expandShiftedMask (SPELL_CAST_FLAGS, $spellListRow ["castFlags_$i"], false) . "\n";
$details .= "Initial delay: " . $spellListRow ["delayInitialMin_$i"];
if ($spellListRow ["delayInitialMin_$i"] != $spellListRow ["delayInitialMax_$i"])
$details .= ' to ' . $spellListRow ["delayInitialMax_$i"];
$details .= "\n";
$details .= "Repeat delay: " . $spellListRow ["delayRepeatMin_$i"];
if ($spellListRow ["delayRepeatMin_$i"] != $spellListRow ["delayRepeatMax_$i"])
$details .= ' to ' . $spellListRow ["delayRepeatMax_$i"];
$details .= "\n";
if ($spellListRow ["scriptId_$i"])
$details .= "Script ID: " . $spellListRow ["scriptId_$i"] . "\n";
$results [] = array ( 'ID' => $spellListRow ["spellId_$i"], 'details' => $details );
} // end of if this spell entry is there (non-zero)
} // end of for each of the 8 possible spells
listItems ('Spells they cast', CREATURE_SPELLS, count ($results), $results,
function ($row) use ($spells)
{
listThing ($spells, $row ['ID'], 'show_spell', '', '', $row ['details']);
} // end listing function
);
} // if we found the spell list
} // end of if they had a spell_list_id
} // end of creatureSpells
function creatureVendorItems ($info)
{
global $id;
global $items;
comment ('VENDOR ITEMS');
// what they sell
$results = dbQueryParam ("SELECT * FROM ".NPC_VENDOR." WHERE entry = ?", array ('i', &$id));
usort($results, 'item_compare');
listItems ('NPC sells', NPC_VENDOR, count ($results), $results,
function ($row) use ($items)
{
$maxcount = $row ['maxcount'];
listThing ($items, $row ['item'], 'show_item', $maxcount > 0 ? "(limit $maxcount)" : 0);
} // end listing function
);
} // end of creatureVendorItems
function creatureEquippedItems ($info)
{
global $id;
global $items;
comment ('EQUIPPED ITEMS');
// what they equip
$totalResults = array ();
for ($i = 1; $i <= CREATURE_EQUIP_ITEMS; $i++)
{
$results = dbQueryParam ("SELECT equipentry$i AS item FROM ".CREATURE_EQUIP_TEMPLATE." WHERE entry = ? AND equipentry$i <> 0", array ('i', &$id));
if ($results)
$totalResults [] = $results [0];
} // for each entry
usort($totalResults, 'item_compare');
listItems ('NPC equips', CREATURE_EQUIP_TEMPLATE, count ($totalResults), $totalResults,
function ($row) use ($items)
{
listThing ($items, $row ['item'], 'show_item');
} // end listing function
);
} // end of creatureEquippedItems
function creatureTrainer ($info)
{
global $id, $spells;
$row = $info ['row'];
comment ('WHAT THEY TRAIN');
// what they train
$results = dbQueryParam ("SELECT * FROM ".TRAINER_TEMPLATE." WHERE template_entry = ?",
array ('i', &$row ['trainer_id']));
usort($results, 'trainer_spell_compare');
listItems ('NPC trains', TRAINER_TEMPLATE, count ($results), $results,
function ($row) use ($spells)
{
listThing ($spells, $row ['playerspell'], 'show_spell');
} // end listing function
);
} // end of creatureTrainer
function creatureQuestLoot ($info)
{
global $id, $items;
$row = $info ['row'];
comment ('QUEST LOOT');
// show loot
$loot_id = $row ['loot_id'];
if (!$loot_id)
$loot_id = $id;
$creature_loot_template = CREATURE_LOOT_TEMPLATE;
$results = dbQueryParam ("SELECT * FROM $creature_loot_template
WHERE entry = ? AND mincountOrRef > 0 AND ChanceOrQuestChance < 0",
array ('i', &$loot_id));
$count = count ($results);
usort($results, 'loot_item_compare');
listItems ('Quest item loot', CREATURE_LOOT_TEMPLATE, $count, $results,
function ($row) use ($items)
{
$chance = $row ['ChanceOrQuestChance'];
listThing ($items, $row ['item'], 'show_item', -$chance . "%");
} // end listing function
);
} // end of creatureQuestLoot
function creatureLoot ($info)
{
global $id, $items;
$row = $info ['row'];
comment ('NON-QUEST LOOT');
// show loot
$loot_id = $row ['loot_id'];
if (!$loot_id)
$loot_id = $id;
$creature_loot_template = CREATURE_LOOT_TEMPLATE;
$reference_loot_template = REFERENCE_LOOT_TEMPLATE;
$results = dbQueryParam ("SELECT * FROM $creature_loot_template
WHERE entry = ? AND mincountOrRef > 0 AND ChanceOrQuestChance >= 0
ORDER BY ChanceOrQuestChance DESC",
array ('i', &$loot_id));
$count = count ($results);
usort($results, 'loot_item_compare');
listItems ('Loot', CREATURE_LOOT_TEMPLATE, $count, $results,
function ($row) use ($items)
{
listThing ($items, $row ['item'], 'show_item', roundChance ($row ['ChanceOrQuestChance']));
} // end listing function
);
} // end of creatureLoot
function creatureReferenceLoot ($info)
{
global $id, $items;
$row = $info ['row'];
comment ('NON-QUEST LOOT');
// show loot
$loot_id = $row ['loot_id'];
if (!$loot_id)
$loot_id = $id;
$creature_loot_template = CREATURE_LOOT_TEMPLATE;
$reference_loot_template = REFERENCE_LOOT_TEMPLATE;
// reference loot - the creature_loot_template table points to the reference_loot_template table
// if the mincountOrRef field is negative, which may lead to multiple loot items for one reference
// item - I presume to allow batches of loot to be attached to one creature_loot_template entry
$lootResults = dbQueryParam ("SELECT $reference_loot_template.item AS refItem,
$creature_loot_template.ChanceOrQuestChance AS chance,
$reference_loot_template.mincountOrRef as minCount
FROM $creature_loot_template
INNER JOIN $reference_loot_template
ON ($reference_loot_template.entry = $creature_loot_template.item)
WHERE $creature_loot_template.entry = ?
AND $creature_loot_template.mincountOrRef < 0
ORDER BY chance DESC",
array ('i', &$loot_id));
usort ($lootResults, 'reference_item_compare'); // ordering by loot chance now
listItems ('Reference loot', REFERENCE_LOOT_TEMPLATE, count ($lootResults), $lootResults,
function ($row) use ($items)
{
$chance = $row ['chance'];
$info2 = '';
if ($chance < 0)
{
$chance = -$chance;
$info2 = 'Quest';
}
listThing ($items, $row ['refItem'], 'show_item', roundChance ($chance), $info2);
} // end listing function
);
} // end of creatureReferenceLoot
function creaturePickpocketingLoot ($info)
{
global $id, $items;
$row = $info ['row'];
// show pickpocketing loot
comment ('PICKPOCKETING LOOT');
$loot_id = $row ['pickpocket_loot_id'];
if (!$loot_id)
$loot_id = $id;
$lootResults = dbQueryParam ("SELECT * FROM ".PICKPOCKETING_LOOT_TEMPLATE."
WHERE entry = ?
ORDER BY ChanceOrQuestChance DESC", array ('i', &$loot_id));
usort($lootResults, 'loot_item_compare');
listItems ('Pickpocketing loot', PICKPOCKETING_LOOT_TEMPLATE, count ($lootResults), $lootResults,
function ($row) use ($items)
{
$chance = $row ['ChanceOrQuestChance'];
listThing ($items, $row ['item'], 'show_item', roundChance ($chance));
} // end listing function
);
} // end of creaturePickpocketingLoot
function creatureSkinningLoot ($info)
{
global $id, $items;
$row = $info ['row'];
// show skinning loot
comment ('SKINNING LOOT');
$loot_id = $row ['skinning_loot_id'];
if (!$loot_id)
$loot_id = $id;
$lootResults = dbQueryParam ("SELECT * FROM ".SKINNING_LOOT_TEMPLATE." WHERE entry = ?", array ('i', &$loot_id));
usort($lootResults, 'loot_item_compare');
listItems ('Skinning loot', SKINNING_LOOT_TEMPLATE, count ($lootResults), $lootResults,
function ($row) use ($items)
{
$chance = $row ['ChanceOrQuestChance'];
listThing ($items, $row ['item'], 'show_item', roundChance ($chance));
} // end listing function
);
} // end of creatureSkinningLoot
function creatureDetails ($info)
{
global $id;
$row = $info ['row'];
topSection ($info, function ($info)
{
global $countOfSpawnPoints;
topLeft ($info, 'creatureTopLeft');
topMiddle ($info, 'creatureTopMiddle');
if ($countOfSpawnPoints > 0)
topRight ($info , 'creatureTopRight');
});
middleSection ($info, function ($info) use ($row)
{
global $listedItemsCount;
$listedItemsCount = 0;
if ($row ['spell_list_id'])
creatureSpells ($info);
creatureVendorItems ($info);
creatureTrainer ($info);
creatureQuestLoot ($info);
creatureLoot ($info);
creatureReferenceLoot ($info);
creaturePickpocketingLoot ($info);
creatureSkinningLoot ($info);
creatureEquippedItems ($info);
if ($listedItemsCount == 0)
middleDetails ($info, function ($info)
{
showNoSpawnPoints ('Extra information', 'No further information about this NPC.');
});
});
bottomSection ($info, function ($info) use ($id)
{
$extras = $info ['extras'];
showOneThing (CREATURE_TEMPLATE, 'entry', $id,
"Database entry for NPC", "name", $extras);
});
} // end of creatureDetails
function showOneCreature ()
{
global $id;
if (($id === false && !repositionSearch()) || !checkID ())
return;
// we need the item info in this function
$row = dbQueryOneParam ("SELECT * FROM ".CREATURE_TEMPLATE." WHERE entry = ?", array ('i', &$id));
if (!$row)
{
ShowWarning ("Creature $id is not on the database");
return;
} // end of not finding it
$extras = array (
'spell_id1' => 'spell',
'spell_id2' => 'spell',
'spell_id3' => 'spell',
'spell_id4' => 'spell',
'faction' => 'npc_faction',
'mechanic_immune_mask' => 'mechanic_mask',
'school_immune_mask' => 'school_mask', // I think this might be out by one
'inhabit_type' => 'inhabit_type_mask',
'movement_type' => 'movement_type',
'flags_extra' => 'flags_extra_mask',
'npc_flags' => 'npc_flags_mask',
'rank' => 'rank',
'gold_min' => 'gold',
'gold_max' => 'gold',
'damage_school' => 'spell_school',
'base_attack_time' => 'time',
'ranged_attack_time' => 'time',
'type' => 'creature_type',
'static_flags' => 'creature_static_flags',
'school_immune_mask' => 'mask',
// 'trainer_spell' => 'spell', // Hmmm, must have the wrong end of the stick here
);
if ($row ['npc_flags'] & TRAINER_FLAG)
{
$extras ['trainer_type'] = 'trainer_type';
$extras ['trainer_class'] = 'class';
$extras ['trainer_race'] = 'race';
}
$name = $row ['name'];
if ($row ['subname'])
$name .= ' <' . $row ['subname'] . '>';
setTitle ("NPC $name");
$limit = array (
'entry',
'display_id1',
'level_min',
'health_multiplier',
'mana_multiplier',
'faction',
'npc_flags',
);
// 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, 'Creature', $name, 'creatures', 'creatureDetails', CREATURE_TEMPLATE);
} // end of showOneCreature
function showCreatures ()
{
global $where, $params, $sort_order, $matches;
$sortFields = array (
'entry',
'name',
'subname',
'level_min',
);
setTitle ("NPCs listing");
if (!in_array ($sort_order, $sortFields))
$sort_order = 'name';
$td = function ($s) use (&$row) { td ($row [$s]); };
$headings = array ('Entry', 'Name', 'Subname', 'Level');
$results = setUpSearch ('Creatures', $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_creature&id=$id$searchURI&pos=$pos&max=$matches'>$id</a>");
tdh ("<a href='?action=show_creature&id=$id$searchURI&pos=$pos&max=$matches'>" . fixHTML ($row ['name']) . "</a>");
$td ('subname');
if ($row ['level_min'] != $row ['level_max'])
td ($row ['level_min'] . '-' . $row ['level_max'] );
else
$td ('level_min');
showFilterColumn ($row);
echo "</tr>\n";
} // end of foreach
wrapUpSearch ();
} // end of showCreatures
function og_creature ()
{
global $id, $documentRoot, $executionDir;
if ($id === false)
repositionSearch();
if ($id)
$row = dbQueryOneParam ("SELECT * FROM ".CREATURE_TEMPLATE." WHERE entry = ?", array ('i', &$id));
else
{
comment ("No ID for NPC");
$id = 0;
$row = false;
}
if (!$row)
{
comment ("NPC not on file");
$title = 'NPC not on file';
$image = '/creatures/missing_creature.webp';
$description = '';
}
else
{
$title = $row ['name'];
if ($row ['subname'])
$title .= ' ‹' . $row ['subname'] . '›';
$display_id = $row ['display_id1'];
if ($display_id)
{
$model = $display_id . '.webp';
$image = "/creatures/$model";
if (!file_exists ("$documentRoot$executionDir/creatures/$model"))
{
comment ("$documentRoot$executionDir/creatures/$model NOT ON FILE");
$image = '/creatures/missing_creature.webp';
} // end if not on file
}
else
{
comment ("No display ID for NPC");
$image = '/creatures/missing_creature.webp';
}
$level_min = $row ['level_min'];
$level_max = $row ['level_max'];
$description = "Entry: $id, Display ID: $display_id, Level: $level_min";
if ($level_min != $level_max)
$description .= "–$level_max";
$npc_flags = $row ['npc_flags'];
if ($npc_flags)
$description .= ', ' . expandNpcFlagsMask ($npc_flags, false);
}
sendOgMeta ($title, $image, 'webp', $description);
} // end of og_creature
?>