source: aowow/includes/allobjects.php

Last change on this file was 170, checked in by maron, 16 years ago
  • Property svn:executable set to *
File size: 15.1 KB
Line 
1<?php
2/*
3* AoWoW: MaNGOS Web Interface
4*
5* © Arcano 2007-2008
6* Runixer@gmail.com
7*
8* Released under the terms and conditions of the
9* GNU General Public License (http://gnu.org).
10*
11* allobjects.php - All functions, constants, etc, which deals with game objects
12*/
13
14// Types of Game Objects
15define("GAMEOBJECT_TYPE_DOOR", 0);
16define("GAMEOBJECT_TYPE_BUTTON", 1);
17define("GAMEOBJECT_TYPE_QUESTGIVER", 2);
18define("GAMEOBJECT_TYPE_CHEST", 3);
19define("GAMEOBJECT_TYPE_BINDER", 4);
20define("GAMEOBJECT_TYPE_GENERIC", 5);
21define("GAMEOBJECT_TYPE_TRAP", 6);
22define("GAMEOBJECT_TYPE_CHAIR", 7);
23define("GAMEOBJECT_TYPE_SPELL_FOCUS", 8);
24define("GAMEOBJECT_TYPE_TEXT", 9);
25define("GAMEOBJECT_TYPE_GOOBER", 10);
26define("GAMEOBJECT_TYPE_TRANSPORT", 11);
27define("GAMEOBJECT_TYPE_AREADAMAGE", 12);
28define("GAMEOBJECT_TYPE_CAMERA", 13);
29define("GAMEOBJECT_TYPE_MAP_OBJECT", 14);
30define("GAMEOBJECT_TYPE_MO_TRANSPORT", 15);
31define("GAMEOBJECT_TYPE_DUEL_ARBITER", 16);
32define("GAMEOBJECT_TYPE_FISHINGNODE", 17);
33define("GAMEOBJECT_TYPE_RITUAL", 18);
34define("GAMEOBJECT_TYPE_MAILBOX", 19);
35define("GAMEOBJECT_TYPE_AUCTIONHOUSE", 20);
36define("GAMEOBJECT_TYPE_GUARDPOST", 21);
37define("GAMEOBJECT_TYPE_SPELLCASTER", 22);
38define("GAMEOBJECT_TYPE_MEETINGSTONE", 23);
39define("GAMEOBJECT_TYPE_FLAGSTAND", 24);
40define("GAMEOBJECT_TYPE_FISHINGHOLE", 25);
41define("GAMEOBJECT_TYPE_FLAGDROP", 26);
42define("GAMEOBJECT_TYPE_MINI_GAME", 27);
43define("GAMEOBJECT_TYPE_LOTTERY_KIOSK", 28);
44define("GAMEOBJECT_TYPE_CAPTURE_POINT", 29);
45define("GAMEOBJECT_TYPE_AURA_GENERATOR", 30);
46define("GAMEOBJECT_TYPE_DUNGEON_DIFFICULTY", 31);
47define("GAMEOBJECT_TYPE_UNK", 32);
48define("GAMEOBJECT_TYPE_DESTRUCTIBLE_BUILDING", 33);
49define("GAMEOBJECT_TYPE_GUILD_BANK", 34);
50
51// Column LockProperties in Lock.dbc
52define("LOCK_PROPERTIES_FOOTLOCK",1);
53define("LOCK_PROPERTIES_HERBALISM",2);
54define("LOCK_PROPERTIES_MINING",3);
55
56// objectinfo required columns
57$object_cols[0] = array('entry', 'name', 'type');
58$object_cols[1] = array('entry', 'name', 'type', 'data0', 'data1', 'data7');
59
60// Функция информации об объекте
61function objectinfo($id, $level=0)
62{
63 global $DB;
64 global $object_cols;
65 $row = $DB->selectRow('
66 SELECT g.?#
67 {, l.name_loc?d AS `name_loc`}
68 FROM gameobject_template g
69 {LEFT JOIN (locales_gameobject l) ON l.entry=g.entry AND ?d}
70 WHERE g.entry = ?d
71 LIMIT 1
72 ',
73 $object_cols[$level],
74 ($_SESSION['locale']>0)? $_SESSION['locale']: DBSIMPLE_SKIP,
75 ($_SESSION['locale']>0)? 1: DBSIMPLE_SKIP,
76 $id
77 );
78 return objectinfo2($row, $level);
79}
80
81// Функция информации об объекте
82// $Row - ссылка на ассоциативный массив из базы
83function objectinfo2(&$Row, $level=0)
84{
85 global $DB;
86 // Номер объекта
87 $object['entry'] = $Row['entry'];
88 // Название объекта
89 $object['name'] = !empty($Row['name_loc'])?$Row['name_loc']:$Row['name'];
90 // Тип объекта
91 $object['type'] = $Row['type'];
92 if ($level>0)
93 {
94 // В зависимости от типа объекта, заполняем поля:
95 switch ($object['type']):
96 case GAMEOBJECT_TYPE_DOOR:
97 /*
98 * data0: startOpen (Boolean flag)
99 * data1: open (LockId from Lock.dbc)
100 * data2: autoClose (long unknown flag)
101 * data3: noDamageImmune (Boolean flag)
102 * data4: openTextID (Unknown Text ID)
103 * data5: closeTextID (Unknown Text ID)
104 */
105 $object['lockid'] = $Row['data1'];
106 break;
107 case GAMEOBJECT_TYPE_BUTTON:
108 /*
109 * data0: startOpen (State)
110 * data1: open (LockId from Lock.dbc)
111 * data2: autoClose (long unknown flag)
112 * data3: linkedTrap (gameobject_template.entry (Spawned GO type 6))
113 * data4: noDamageImmune (Boolean flag)
114 * data5: large? (Boolean flag)
115 * data6: openTextID (Unknown Text ID)
116 * data7: closeTextID (Unknown Text ID)
117 * data8: losOK (Boolean flag)
118 */
119 $object['lockid'] = $Row['data1'];
120 case GAMEOBJECT_TYPE_QUESTGIVER:
121 /*
122 * data0: open (LockId from Lock.dbc)
123 * data1: questList (unknown ID)
124 * data2: pageMaterial (PageTextMaterial.dbc)
125 * data3: gossipID (unknown ID)
126 * data4: customAnim (unknown value from 1 to 4)
127 * data5: noDamageImmune (Boolean flag)
128 * data6: openTextID (Unknown Text ID)
129 * data7: losOK (Boolean flag)
130 * data8: allowMounted (Boolean flag)
131 * data9: large? (Boolean flag)
132 */
133 $object['lockid'] = $Row['data0'];
134 break;
135 case GAMEOBJECT_TYPE_CHEST:
136 /*
137 * data0: open (LockId from Lock.dbc)
138 * data1: chestLoot (gameobject_loot_template.entry) *This field is obtained from WDB data and is not to be changed*
139 * data2: chestRestockTime (time in seconds)
140 * data3: consumable (State: Boolean flag)
141 * data4: minRestock (Min successful loot attempts for Mining, Herbalism etc)
142 * data5: maxRestock (Max successful loot attempts for Mining, Herbalism etc)
143 * data6: lootedEvent (unknown ID)
144 * data7: linkedTrap (gameobject_template.entry (Spawned GO type 6))
145 * data8: questID (quest_template.entry of completed quest)
146 * data9: level (minimal level required to open this gameobject)
147 * data10: losOK (Boolean flag)
148 * data11: leaveLoot (Boolean flag)
149 * data12: notInCombat (Boolean flag)
150 * data13: log loot (Boolean flag)
151 * data14: openTextID (Unknown ID)
152 * data15: use group loot rules (Boolean flag)
153 */
154 $object['lockid'] = $Row['data0'];
155 $object['lootid'] = $Row['data1'];
156 break;
157 case GAMEOBJECT_TYPE_BINDER:
158 /* Object type not used */
159 break;
160 case GAMEOBJECT_TYPE_GENERIC:
161 /*
162 * data0: floatingTooltip (Boolean flag)
163 * data1: highlight (Boolean flag)
164 * data2: serverOnly? (Always 0)
165 * data3: large? (Boolean flag)
166 * data4: floatOnWater (Boolean flag)
167 * data5: questID (Required active quest_template.entry to work)
168 */
169 break;
170 case GAMEOBJECT_TYPE_TRAP:
171 /*
172 * data0: open (LockId from Lock.dbc)
173 * data1: level (npc equivalent level for casted spell)
174 * data2: radius (Distance)
175 * data3: spell (Spell Id from spell.dbc)
176 * data4: charges (0 or 1)
177 * data5: cooldown (time in seconds)
178 * data6: ? (unknown flag)
179 * data7: startDelay? (time in seconds)
180 * data8: serverOnly? (always 0)
181 * data9: stealthed (Boolean flag)
182 * data10: large? (Boolean flag)
183 * data11: stealthAffected (Boolean flag)
184 * data12: openTextID (Unknown ID)
185 */
186 $object['lockid'] = $Row['data0'];
187 break;
188 case GAMEOBJECT_TYPE_CHAIR:
189 /*
190 * data0: chairslots (number of players that can sit down on it)
191 * data1: chairorientation? (number of usable side?)
192 */
193 break;
194 case GAMEOBJECT_TYPE_SPELL_FOCUS:
195 /*
196 * data0: spellFocusType (from SpellFocusObject.dbc)
197 * data1: radius (Distance)
198 * data2: linkedTrap (gameobject_template.entry (Spawned GO type 6))
199 */
200 break;
201 case GAMEOBJECT_TYPE_TEXT:
202 /*
203 * data0: pageID (page_text.entry)
204 * data1: language (from Languages.dbc)
205 * data2: pageMaterial (PageTextMaterial.dbc)
206 */
207 $object['pageid'] = $Row['data0'];
208 break;
209 case GAMEOBJECT_TYPE_GOOBER:
210 /*
211 * data0: open (LockId from Lock.dbc)
212 * data1: questID (Required active quest_template.entry to work)
213 * data2: eventID (Unknown Event ID)
214 * data3: ? (unknown flag)
215 * data4: customAnim (unknown)
216 * data5: consumable (Boolean flag controling if gameobject will despawn or not)
217 * data6: cooldown (time is seconds)
218 * data7: pageID (page_text.entry)
219 * data8: language (from Languages.dbc)
220 * data9: pageMaterial (PageTextMaterial.dbc)
221 * data10: spell (Spell Id from spell.dbc)
222 * data11: noDamageImmune (Boolean flag)
223 * data12: linkedTrap (gameobject_template.entry (Spawned GO type 6))
224 * data13: large? (Boolean flag)
225 * data14: openTextID (Unknown ID)
226 * data15: closeTextID (Unknown ID)
227 * data16: losOK (Boolean flag)
228 */
229 $object['lockid'] = $Row['data0'];
230 $object['pageid'] = $Row['data7'];
231 break;
232 case GAMEOBJECT_TYPE_TRANSPORT:
233 /* No data data used, all are always 0 */
234 break;
235 case GAMEOBJECT_TYPE_AREADAMAGE:
236 /* Object type not used */
237 break;
238 case GAMEOBJECT_TYPE_CAMERA:
239 /*
240 * data0: open (LockId from Lock.dbc)
241 * data1: camera (Cinematic entry from CinematicCamera.dbc)
242 */
243 $object['lockid'] = $Row['data0'];
244 break;
245 case GAMEOBJECT_TYPE_MAP_OBJECT:
246 /* No data data used, all are always 0 */
247 break;
248 case GAMEOBJECT_TYPE_MO_TRANSPORT:
249 /*
250 * data0: taxiPathID (Id from TaxiPath.dbc)
251 * data1: moveSpeed
252 * data2: accelRate
253 */
254 break;
255 case GAMEOBJECT_TYPE_DUEL_ARBITER:
256 /* Only one Gameobject with this type (21680) and no data data */
257 break;
258 case GAMEOBJECT_TYPE_FISHINGNODE:
259 /* Only one Gameobject with this type (35591) and no data data */
260 break;
261 case GAMEOBJECT_TYPE_RITUAL:
262 /*
263 * data0: casters?
264 * data1: spell (Spell Id from spell.dbc)
265 * data2: animSpell (Spell Id from spell.dbc)
266 * data3: ritualPersistent (Boolean flag)
267 * data4: casterTargetSpell (Spell Id from spell.dbc)
268 * data5: casterTargetSpellTargets (Boolean flag)
269 * data6: castersGrouped (Boolean flag)
270 */
271 break;
272 case GAMEOBJECT_TYPE_MAILBOX:
273 /* No data data used, all are always 0 */
274 break;
275 case GAMEOBJECT_TYPE_AUCTIONHOUSE:
276 /* data0: actionHouseID (From AuctionHouse.dbc ?) */
277 break;
278 case GAMEOBJECT_TYPE_GUARDPOST:
279 /* Object type not used */
280 break;
281 case GAMEOBJECT_TYPE_SPELLCASTER:
282 /*
283 * data0: spell (Spell Id from spell.dbc)
284 * data1: charges
285 * data2: partyOnly (Boolean flag, need to be in group to use it)
286 */
287 break;
288 case GAMEOBJECT_TYPE_MEETINGSTONE:
289 /*
290 * data0: minLevel
291 * data1: maxLevel
292 * data2: areaID (From AreaTable.dbc)
293 */
294 break;
295 case GAMEOBJECT_TYPE_FLAGSTAND:
296 /*
297 * data0: open (LockId from Lock.dbc)
298 * data1: pickupSpell (Spell Id from spell.dbc)
299 * data2: radius (distance)
300 * data3: returnAura (Spell Id from spell.dbc)
301 * data4: returnSpell (Spell Id from spell.dbc)
302 * data5: noDamageImmune (Boolean flag)
303 * data6: ?
304 * data7: losOK (Boolean flag)
305 */
306 $object['lockid'] = $Row['data0'];
307 break;
308 case GAMEOBJECT_TYPE_FISHINGHOLE:
309 /*
310 * data0: radius (distance)
311 * data1: chestLoot (gameobject_loot_template.entry)
312 * data2: minRestock
313 * data3: maxRestock
314 */
315 $object['lootid'] = $Row['data1'];
316 break;
317 case GAMEOBJECT_TYPE_FLAGDROP:
318 /*
319 * data0: open (LockId from Lock.dbc)
320 * data1: eventID (Unknown Event ID)
321 * data2: pickupSpell (Spell Id from spell.dbc)
322 * data3: noDamageImmune (Boolean flag)
323 */
324 $object['lockid'] = $Row['data0'];
325 break;
326 case GAMEOBJECT_TYPE_MINI_GAME:
327 /* Object type not used
328 Reused in core for CUSTOM_TELEPORT
329 * data0: areatrigger_teleport.id
330 */
331 break;
332 case GAMEOBJECT_TYPE_LOTTERY_KIOSK:
333 /* Object type not used */
334 break;
335 case GAMEOBJECT_TYPE_CAPTURE_POINT:
336 /*
337 * data0: radius (Distance)
338 * data1: spell (Unknown ID, not a spell id in dbc file, maybe server only side spell)
339 * data2: worldState1
340 * data3: worldstate2
341 * data4: winEventID1 (Unknown Event ID)
342 * data5: winEventID2 (Unknown Event ID)
343 * data6: contestedEventID1 (Unknown Event ID)
344 * data7: contestedEventID2 (Unknown Event ID)
345 * data8: progressEventID1 (Unknown Event ID)
346 * data9: progressEventID2 (Unknown Event ID)
347 * data10: neutralEventID1 (Unknown Event ID)
348 * data11: neutralEventID2 (Unknown Event ID)
349 * data12: neutralPercent
350 * data13: worldstate3
351 * data14: minSuperiority
352 * data15: maxSuperiority
353 * data16: minTime (in seconds)
354 * data17: maxTime (in seconds)
355 * data18: large? (Boolean flag)
356 */
357 break;
358 case GAMEOBJECT_TYPE_AURA_GENERATOR:
359 /*
360 * data0: startOpen (Boolean flag)
361 * data1: radius (Distance)
362 * data2: auraID1 (Spell Id from spell.dbc)
363 * data3: conditionID1 (Unknown ID)
364 */
365 break;
366 case GAMEOBJECT_TYPE_DUNGEON_DIFFICULTY:
367 /*
368 * data0: mapID (From Maps.dbc)
369 * data1: difficulty (0 or 1)
370 */
371 break;
372 case GAMEOBJECT_TYPE_UNK:
373 /* Object type not used */
374 break;
375 case GAMEOBJECT_TYPE_DESTRUCTIBLE_BUILDING:
376 /* Object type not used */
377 break;
378 case GAMEOBJECT_TYPE_GUILD_BANK:
379 /* No data data used, all are always 0 */
380 break;
381 endswitch;
382 // Тип объекта и требуемый уровень скилла, и какого скилла
383 if($object['lockid'])
384 {
385 $lock_row = $DB->selectRow('
386 SELECT *
387 FROM ?_lock
388 WHERE lockID=?d
389 LIMIT 1
390 ',
391 $object['lockid']
392 );
393 if ($lock_row)
394 {
395 for ($j=1;$j<=5;$j++)
396 {
397 switch ($lock_row['type'.$j]):
398 case 0:
399 // Не замок
400 break;
401 case 1:
402 // Ключ
403 $object['key'] = array();
404 $object['key'] = $DB->selectRow('SELECT entry as id, name, quality FROM item_template WHERE entry=?d LIMIT 1', $lock_row['lockproperties'.$j]);
405 break;
406 case 2:
407 // Скилл
408 switch ($lock_row['lockproperties'.$j]):
409 case LOCK_PROPERTIES_FOOTLOCK:
410 // Сундук
411 $object['type'] = -5;
412 $object['lockpicking'] = $lock_row['requiredskill'.$j];
413 break;
414 case LOCK_PROPERTIES_HERBALISM:
415 // Трава
416 $object['type'] = -3;
417 $object['herbalism'] = $lock_row['requiredskill'.$j];
418 break;
419 case LOCK_PROPERTIES_MINING:
420 // Руда
421 $object['type'] = -4;
422 $object['mining'] = $lock_row['requiredskill'.$j];
423 break;
424 endswitch;
425 endswitch;
426 }
427 }
428 }
429 // Текст страниц
430 if($object['pageid'])
431 {
432 while($object['pageid']>0)
433 {
434 $row = $DB->selectRow('
435 SELECT text, next_page
436 {, text_loc?d}
437 FROM page_text p
438 {LEFT JOIN (locales_page_text l) ON l.entry = p.entry AND ?}
439 WHERE
440 p.entry = ?d
441 LIMIT 1
442 ',
443 $_SESSION['locale'] ? $_SESSION['locale'] : DBSIMPLE_SKIP,
444 $_SESSION['locale'] ? 1 : DBSIMPLE_SKIP,
445 $object['pageid']
446 );
447 /*
448 if($_SESSION['locale']>0)
449 $text = QuestReplaceStr($DB->selectCell('SELECT Text_loc?d FROM locales_page_text WHERE entry = ?d LIMIT 1', $_SESSION['locale'], $object['pageid']));
450 if($text)
451 $next_page = $DB->selectCell('SELECT next_page FROM page_text WHERE entry = ?d LIMIT 1', $object['pageid']);
452 else
453 list($text, $next_page) = $DB->selectRow('SELECT text AS \'0\', next_page AS \'1\' FROM page_text WHERE entry = ?d LIMIT 1', $object['pageid']);
454 */
455 $row['text'] = QuestReplaceStr(!empty($row['text_loc']) ? $row['text_loc'] : $row['text']);
456 if(empty($row['text']))
457 break;
458 $object['pagetext'][] = $row['text'];
459 $object['pageid'] = $row['next_page'];
460 }
461 }
462 // Лут...
463 if (IsSet($object['lootid']))
464 {
465 $object['drop'] = array();
466 if (!($object['drop'] = loot('gameobject_loot_template', $object['lootid'])))
467 unset ($object['drop']);
468 }
469 }
470 return $object;
471}
472
473?>
Note: See TracBrowser for help on using the repository browser.