Требование: PHP => 5.3, часть 2
[cswowd.git] / include / creature_table.php
blob5b3b73e9bf868577b90dcbdd3273da76730511e6
1 <?php
3 define('UNIT_FLAG_UNK_0', 0x00000001);
4 define('UNIT_FLAG_NON_ATTACKABLE', 0x00000002);
5 define('UNIT_FLAG_DISABLE_MOVE', 0x00000004);
6 define('UNIT_FLAG_PVP_ATTACKABLE', 0x00000008);
7 define('UNIT_FLAG_RENAME', 0x00000010);
8 define('UNIT_FLAG_PREPARATION', 0x00000020);
9 define('UNIT_FLAG_UNK_6', 0x00000040);
10 define('UNIT_FLAG_NOT_ATTACKABLE_1', 0x00000080);
11 define('UNIT_FLAG_OOC_NOT_ATTACKABLE', 0x00000100);
12 define('UNIT_FLAG_PASSIVE', 0x00000200);
13 define('UNIT_FLAG_LOOTING', 0x00000400);
14 define('UNIT_FLAG_PET_IN_COMBAT', 0x00000800);
15 define('UNIT_FLAG_PVP', 0x00001000);
16 define('UNIT_FLAG_SILENCED', 0x00002000);
17 define('UNIT_FLAG_UNK_14', 0x00004000);
18 define('UNIT_FLAG_UNK_15', 0x00008000);
19 define('UNIT_FLAG_UNK_16', 0x00010000);
20 define('UNIT_FLAG_PACIFIED', 0x00020000);
21 define('UNIT_FLAG_STUNNED', 0x00040000);
22 define('UNIT_FLAG_IN_COMBAT', 0x00080000);
23 define('UNIT_FLAG_TAXI_FLIGHT', 0x00100000);
24 define('UNIT_FLAG_DISARMED', 0x00200000);
25 define('UNIT_FLAG_CONFUSED', 0x00400000);
26 define('UNIT_FLAG_FLEEING', 0x00800000);
27 define('UNIT_FLAG_PLAYER_CONTROLLED', 0x01000000);
28 define('UNIT_FLAG_NOT_SELECTABLE', 0x02000000);
29 define('UNIT_FLAG_SKINNABLE', 0x04000000);
30 define('UNIT_FLAG_MOUNT', 0x08000000);
31 define('UNIT_FLAG_UNK_28', 0x10000000);
32 define('UNIT_FLAG_UNK_29', 0x20000000);
33 define('UNIT_FLAG_SHEATHE', 0x40000000);
34 define('UNIT_FLAG_UNK_31', 0x80000000);
36 define('CREATURE_TYPEFLAGS_HERBLOOT', 0x00000100);
37 define('CREATURE_TYPEFLAGS_MININGLOOT', 0x00000200);
38 define('CREATURE_TYPEFLAGS_ENGINEERLOOT', 0x00008000);
40 define('UNIT_NPC_FLAG_NONE', 0x00000000);
41 define('UNIT_NPC_FLAG_GOSSIP', 0x00000001);
42 define('UNIT_NPC_FLAG_QUESTGIVER', 0x00000002);
43 define('UNIT_NPC_FLAG_UNK1', 0x00000004);
44 define('UNIT_NPC_FLAG_UNK2', 0x00000008);
45 define('UNIT_NPC_FLAG_TRAINER', 0x00000010);
46 define('UNIT_NPC_FLAG_TRAINER_CLASS', 0x00000020);
47 define('UNIT_NPC_FLAG_TRAINER_PROFESSION', 0x00000040);
48 define('UNIT_NPC_FLAG_VENDOR', 0x00000080);
49 define('UNIT_NPC_FLAG_VENDOR_AMMO', 0x00000100);
50 define('UNIT_NPC_FLAG_VENDOR_FOOD', 0x00000200);
51 define('UNIT_NPC_FLAG_VENDOR_POISON', 0x00000400);
52 define('UNIT_NPC_FLAG_VENDOR_REAGENT', 0x00000800);
53 define('UNIT_NPC_FLAG_REPAIR', 0x00001000);
54 define('UNIT_NPC_FLAG_FLIGHTMASTER', 0x00002000);
55 define('UNIT_NPC_FLAG_SPIRITHEALER', 0x00004000);
56 define('UNIT_NPC_FLAG_SPIRITGUIDE', 0x00008000);
57 define('UNIT_NPC_FLAG_INNKEEPER', 0x00010000);
58 define('UNIT_NPC_FLAG_BANKER', 0x00020000);
59 define('UNIT_NPC_FLAG_PETITIONER', 0x00040000);
60 define('UNIT_NPC_FLAG_TABARDDESIGNER', 0x00080000);
61 define('UNIT_NPC_FLAG_BATTLEMASTER', 0x00100000);
62 define('UNIT_NPC_FLAG_AUCTIONEER', 0x00200000);
63 define('UNIT_NPC_FLAG_STABLEMASTER', 0x00400000);
64 define('UNIT_NPC_FLAG_GUILD_BANKER', 0x00800000);
65 define('UNIT_NPC_FLAG_SPELLCLIC', 0x01000000);
66 define('UNIT_NPC_FLAG_UNK25', 0x02000000);
67 define('UNIT_NPC_FLAG_UNK26', 0x04000000);
68 define('UNIT_NPC_FLAG_UNK27', 0x08000000);
69 define('UNIT_NPC_FLAG_UNK28', 0x10000000);
70 define('UNIT_NPC_FLAG_UNK29', 0x20000000);
71 define('UNIT_NPC_FLAG_UNK30', 0x40000000);
72 define('UNIT_NPC_FLAG_UNK31', 0x80000000);
74 function noBorderCreatureTable($npc)
76 global $game_text, $lang;
77 $loyality= getLoyality($npc['FactionAlliance']);
78 $type = $npc['CreatureType'];
79 $rank = $npc['Rank'];
80 $family =$npc['Family'];
81 $npcdmgmin = ROUND(($npc['MinMeleeDmg']+$npc['MeleeAttackPower'])*$npc['DamageMultiplier']);
82 $npcdmgmax = ROUND(($npc['MaxMeleeDmg']+$npc['MeleeAttackPower'])*$npc['DamageMultiplier']);
84 if ($npc['ScriptName']=="" && $npc['AIName']=="") {$npcscr='No script';}
85 else if ($npc['AIName']=="EventAI" && $npc['ScriptName']=="") {$npcscr='EventAI';}
86 else if ($npc['AIName']=="NullAI" && $npc['ScriptName']=="") {$npcscr='NullAI';}
87 else if ($npc['AIName']=="AggressorAI" && $npc['ScriptName']=="") {$npcscr='AggressorAI';}
88 else if ($npc['AIName']=="ReactorAI" && $npc['ScriptName']=="") {$npcscr='ReactorAI';}
89 else if ($npc['AIName']=="GuardAI" && $npc['ScriptName']=="") {$npcscr='GuardAI';}
90 else if ($npc['AIName']=="PetAI" && $npc['ScriptName']=="") {$npcscr='PetAI';}
91 else if ($npc['AIName']=="TotemAI" && $npc['ScriptName']=="") {$npcscr='TotemAI';}
92 else if ($npc['ScriptName']=="generic_creature") {$npcscr='Caster';}
93 else if ($npc['ScriptName']<>"" && $npc['AIName']=="EventAI") {$npcscr='EventAI&nbsp;+&nbsp;SD2';}
94 else {$npcscr='SD2';}
96 $npc['Name'] = str_replace('(1)', '(Difficulty1)', $npc['Name']);
97 $npc['Name'] = str_replace('(2)', '(Difficulty2)', $npc['Name']);
98 $npc['Name'] = str_replace('(3)', '(Difficulty3)', $npc['Name']);
100 echo "<table class=creature cellspacing=0>";
101 echo "<tbody>";
102 echo "<tr><td colspan=2><b>$npc[Name]&nbsp;($loyality)</b>";
103 if ($npc['SubName']!="")
104 echo "<br><font color=#008800 size=-3>&lt;$npc[SubName]&gt;</font>";
105 echo "</td></tr>";
106 if ($rank)
107 echo "<td>".$game_text['npc_rank']."</td><td align=right>".getCreatureRank($rank)."</td></tr>";
109 echo "<tr><td>".$game_text['npc_type']."</td><td align=right>".getCreatureType($type)."</td></tr>";
110 if ($npc['Family']!=0)
111 echo "<tr><td>".$game_text['npc_family']."</td><td align=right>".getCreatureFamily($family)."</td></tr>";
112 echo "<tr><td>".$game_text['npc_level']."</td><td align=right>$npc[MaxLevel]</td></tr>";
113 if ($npc['MinLevelHealth']==$npc['MaxLevelHealth'])
114 echo "<tr><td>".$game_text['npc_health']."</td><td align=right>$npc[MaxLevelHealth]</td></tr>";
115 else
116 echo "<tr><td>".$game_text['npc_health']."</td><td align=right>$npc[MinLevelHealth]-$npc[MaxLevelHealth]</td></tr>";
117 if ($npc['MinLevelMana']!=0)
119 if ($npc['MinLevelMana']!=$npc['MaxLevelMana'])
120 echo "<tr><td>".$game_text['npc_mana']."</td><td align=right>$npc[MinLevelMana]-$npc[MaxLevelMana]</td></tr>";
121 else
122 echo "<tr><td>".$game_text['npc_mana']."</td><td align=right>$npc[MinLevelMana]</td></tr>";
124 if ($npc['Armor']!=0)
125 echo "<tr><td>".$game_text['npc_armor']."</td><td align=right>$npc[Armor]</td></tr>";
126 echo "<tr><td>".$game_text['npc_damage']."</td><td align=right>$npcdmgmin&nbsp;-&nbsp;$npcdmgmax</td></tr>";
127 echo "<tr><td>".$game_text['npc_ap']."</td><td align=right>$npc[MeleeAttackPower]</td></tr>";
128 $attackTime = $npc['MeleeBaseAttackTime']/1000;
129 echo "<tr><td>".$game_text['npc_attack']."</td><td align=right>$attackTime&nbsp;$lang[sec]</td></tr>";
130 echo "<tr><td>".$game_text['faction']."</td><td align=right>".getFactionTemplateName($npc['FactionAlliance'])."</td></tr>";
131 if ($npc['ModelId1'])
132 echo "<tr><td>".$game_text['display1']."</td><td align=right>$npc[ModelId1]</td></tr>";
133 if ($npc['ModelId2'])
134 echo "<tr><td>".$game_text['display2']."</td><td align=right>$npc[ModelId2]</td></tr>";
135 if ($npc['ModelId3'])
136 echo "<tr><td>".$game_text['display3']."</td><td align=right>$npc[ModelId3]</td></tr>";
137 if ($npc['ModelId4'])
138 echo "<tr><td>".$game_text['display4']."</td><td align=right>$npc[ModelId4]</td></tr>";
139 echo "<tr><td>".$game_text['npc_script']."</td><td align=right>$npcscr</td></tr>";
140 if ($npc['NpcFlags'])
141 echo "<tr><td colspan=2>".getCreatureFlagsList($npc['NpcFlags'])."</td></tr>";
142 echo "</tbody></table>";
144 function generateCreatureTable($npc)
146 echo "<table class=border cellspacing=0 cellpadding=0><tbody>";
147 echo "<tr><td class=btopl></td><td class=btop></td><td class=btopr></td></tr>";
148 echo "<tr><td class=bl></td><td class=bbody>";
149 noBorderCreatureTable($npc);
150 echo "</td><td class=br></td></tr>";
151 echo "<tr><td class=bbottoml></td><td class=bbottom></td><td class=bbottomr></td></tr>";
152 echo "</tbody></table>";