-
Notifications
You must be signed in to change notification settings - Fork 27
/
item.php
741 lines (706 loc) · 21.1 KB
/
item.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
<?php
require_once('includes/game.php');
require_once('includes/allspells.php');
require_once('includes/allquests.php');
require_once('includes/allitems.php');
require_once('includes/allnpcs.php');
require_once('includes/allobjects.php');
require_once('includes/allcomments.php');
require_once('includes/allachievements.php');
// Загружаем файл перевода для smarty
$smarty->config_load($conf_file, 'item');
$id = intval($podrazdel);
$cache_key = cache_key($id);
if(!$item = load_cache(ITEM_PAGE, $cache_key))
{
unset($item);
// Информация о вещи...
$item = iteminfo($id, 1);
// Поиск мобов с которых эта вещь лутится
$drops_cr = drop('creature_loot_template', $item['entry']);
if($drops_cr)
{
$item['droppedby'] = array();
foreach($drops_cr as $lootid => $drop)
{
$rows = $DB->select('
SELECT c.?#, c.entry
{
, l.name_loc?d AS name_loc
, l.subname_loc?d AS subname_loc
}
FROM ?_factiontemplate, creature_template c
{ LEFT JOIN (locales_creature l) ON l.entry=c.entry AND ? }
WHERE
lootid=?d
AND factiontemplateID=faction_A
',
$npc_cols[0],
($_SESSION['locale']>0)? $_SESSION['locale']: DBSIMPLE_SKIP,
($_SESSION['locale']>0)? $_SESSION['locale']: DBSIMPLE_SKIP,
($_SESSION['locale']>0)? 1: DBSIMPLE_SKIP,
$lootid
);
foreach($rows as $row)
$item['droppedby'][] = @array_merge(creatureinfo2($row), $drop);
}
unset($rows);
unset($lootid);
unset($drop);
}
unset($drops_cr);
// Поиск объектов, из которых лутится эта вещь
$drops_go = drop('gameobject_loot_template', $item['entry']);
if($drops_go)
{
$item['containedinobject'] = array();
$item['minedfromobject'] = array();
$item['gatheredfromobject'] = array();
foreach($drops_go as $lootid => $drop)
{
// Сундуки
$rows = $DB->select('
SELECT g.entry, g.name, g.type, a.lockproperties1 {, l.name_loc?d AS name_loc}
FROM gameobject_template g LEFT JOIN ?_lock a ON a.lockID=g.data0
{ LEFT JOIN (locales_gameobject l) ON l.entry=g.entry AND ? }
WHERE
g.data1=?d
AND g.type IN (?d, ?d)
',
($_SESSION['locale']>0)? $_SESSION['locale']: DBSIMPLE_SKIP,
($_SESSION['locale']>0)? 1: DBSIMPLE_SKIP,
$lootid,
GAMEOBJECT_TYPE_CHEST,
GAMEOBJECT_TYPE_FISHINGHOLE
);
foreach($rows as $row)
{
// Залежи руды
if($row['lockproperties1'] == LOCK_PROPERTIES_MINING)
$item['minedfromobject'][] = @array_merge(objectinfo2($row), $drop);
// Собирается с трав
elseif($row['lockproperties1'] == LOCK_PROPERTIES_HERBALISM)
$item['gatheredfromobject'][] = @array_merge(objectinfo2($row), $drop);
// Сундуки
else
$item['containedinobject'][] = @array_merge(objectinfo2($row), $drop);
}
}
if(!$item['containedinobject'])
unset($item['containedinobject']);
if(!$item['minedfromobject'])
unset($item['minedfromobject']);
if(!$item['gatheredfromobject'])
unset($item['gatheredfromobject']);
unset($rows);
}
unset($drops_go);
// Поиск вендеров, которые эту вещь продают
$rows_soldby = $DB->select('
SELECT ?#, c.entry, v.ExtendedCost, v.maxcount AS stock
{
, l.name_loc?d AS name_loc
, l.subname_loc?d AS subname_loc
}
FROM npc_vendor v, ?_factiontemplate, creature_template c
{ LEFT JOIN (locales_creature l) ON l.entry=c.entry AND ? }
WHERE
v.item=?d
AND c.entry=v.entry
AND factiontemplateID=faction_A
ORDER BY 1 DESC, 2 DESC
',
$npc_cols['0'],
($_SESSION['locale']>0)? $_SESSION['locale']: DBSIMPLE_SKIP,
($_SESSION['locale']>0)? $_SESSION['locale']: DBSIMPLE_SKIP,
($_SESSION['locale']>0)? 1: DBSIMPLE_SKIP,
$item['entry']
);
if($rows_soldby)
{
$item['soldby'] = array();
foreach($rows_soldby as $i => $row)
{
$item['soldby'][$i] = array();
$item['soldby'][$i] = creatureinfo2($row);
$item['soldby'][$i]['stock'] = ($row['stock'] == 0 ? -1 : $row['stock']);
if($row['ExtendedCost'])
{
$item['soldby'][$i]['cost'] = array();
$extcost = $DB->selectRow('SELECT * FROM ?_item_extended_cost WHERE extendedcostID=?d LIMIT 1', abs($row['ExtendedCost']));
if($extcost['reqhonorpoints'])
$item['soldby'][$i]['cost']['honor'] = ($row['A'] == 1 ? 1 : -1) * $extcost['reqhonorpoints'];
if($extcost['reqarenapoints'])
$item['soldby'][$i]['cost']['arena'] = $extcost['reqarenapoints'];
$item['soldby'][$i]['cost']['items'] = array();
for ($j=1;$j<=5;$j++)
if(($extcost['reqitem'.$j]>0) and ($extcost['reqitemcount'.$j]>0))
{
allitemsinfo($extcost['reqitem'.$j], 0);
$item['soldby'][$i]['cost']['items'][] = array('item' => $extcost['reqitem'.$j], 'count' => $extcost['reqitemcount'.$j]);
}
}
else
$item['soldby'][$i]['cost']['money'] = $item['BuyPrice'];
}
unset($extcost);
}
unset($rows_soldby);
// Поиск квестов, для выполнения которых нужен этот предмет
$rows_qr = $DB->select('
SELECT q.?# {, l.Title_loc?d AS Title_loc}
FROM v_quest_template q
{ LEFT JOIN (locales_quest l) ON l.Id=q.entry AND ? }
WHERE
RequiredItemId1=?d
OR RequiredItemId2=?d
OR RequiredItemId3=?d
OR RequiredItemId4=?d
',
$quest_cols[2],
$_SESSION['locale'] > 0 ? $_SESSION['locale'] : DBSIMPLE_SKIP,
$_SESSION['locale'] > 0 ? 1 : DBSIMPLE_SKIP,
$item['entry'], $item['entry'], $item['entry'], $item['entry']
);
if($rows_qr)
{
$item['objectiveof'] = array();
foreach($rows_qr as $row)
$item['objectiveof'][] = GetQuestInfo($row, 0xFFFFFF);
}
unset($rows_qr);
// Поиск квестов, при взятии которых выдается этот предмет
$rows_qp = $DB->select('
SELECT q.?# {, l.Title_loc?d AS Title_loc}
FROM v_quest_template q
{ LEFT JOIN (locales_quest l) ON l.Id=q.entry AND ? }
WHERE SourceItemId=?d
',
$quest_cols[2],
$_SESSION['locale'] > 0 ? $_SESSION['locale'] : DBSIMPLE_SKIP,
$_SESSION['locale'] > 0 ? 1 : DBSIMPLE_SKIP,
$item['entry']
);
if($rows_qp)
{
$item['providedfor'] = array();
foreach($rows_qp as $row)
$item['providedfor'][] = GetQuestInfo($row, 0xFFFFFF);
}
unset($rows_qp);
// Поиск квестов, наградой за выполнение которых, является этот предмет
$rows_qrw = $DB->select('
SELECT q.?# {, l.Title_loc?d AS Title_loc}
FROM v_quest_template q
{ LEFT JOIN (locales_quest l) ON l.Id=q.entry AND ? }
WHERE
RewardItemId1=?d
OR RewardItemId2=?d
OR RewardItemId3=?d
OR RewardItemId4=?d
OR RewardChoiceItemId1=?d
OR RewardChoiceItemId2=?d
OR RewardChoiceItemId3=?d
OR RewardChoiceItemId4=?d
OR RewardChoiceItemId5=?d
OR RewardChoiceItemId6=?d
',
$quest_cols[2],
($_SESSION['locale']>0)? $_SESSION['locale']: DBSIMPLE_SKIP,
($_SESSION['locale']>0)? 1: DBSIMPLE_SKIP,
$item['entry'], $item['entry'], $item['entry'], $item['entry'], $item['entry'],
$item['entry'], $item['entry'], $item['entry'], $item['entry'], $item['entry']
);
if($rows_qrw)
{
$item['rewardof'] = array();
foreach($rows_qrw as $row)
$item['rewardof'][] = GetQuestInfo($row, 0xFFFFFF);
}
unset($rows_qrw);
// Поиск квестов, в награду за выполнение которых итем присылают почтой
$drops_qm = drop('mail_loot_template', $item['entry']);
if($drops_qm)
{
foreach($drops_qm as $lootid => $row)
{
$rows_qm = $DB->select('
SELECT q.?# {, l.Title_loc?d AS Title_loc}
FROM v_quest_template q
{ LEFT JOIN (locales_quest l) ON l.Id=q.entry AND ? }
WHERE RewardMailTemplateId=?d
',
$quest_cols[2],
$_SESSION['locale'] > 0 ? $_SESSION['locale'] : DBSIMPLE_SKIP,
$_SESSION['locale'] > 0 ? 1 : DBSIMPLE_SKIP,
$lootid
);
if($rows_qm)
{
if (!isset($item['rewardof']))
$item['rewardof'] = array();
foreach($rows_qm as $row)
$item['rewardof'][] = GetQuestInfo($row, 0xFFFFFF);
}
unset($rows_qm);
}
}
unset($drops_qm);
// Поиск вещей, в которых находятся эти вещи
$drops_cii = drop('item_loot_template', $item['entry']);
if($drops_cii)
{
$item['containedinitem'] = array();
foreach($drops_cii as $lootid => $drop)
{
$rows = $DB->select('
SELECT c.?#, c.entry, maxcount
{ , l.name_loc?d AS name_loc }
FROM ?_icons, item_template c
{ LEFT JOIN (locales_item l) ON l.entry=c.entry AND ? }
WHERE
c.entry=?d
AND id=displayid
',
$item_cols[2],
($_SESSION['locale']>0)? $_SESSION['locale']: DBSIMPLE_SKIP,
($_SESSION['locale']>0)? 1: DBSIMPLE_SKIP,
$lootid
);
foreach($rows as $row)
$item['containedinitem'][] = @array_merge(iteminfo2($row, 0), $drop);
}
unset($drops_cii);
unset($rows);
unset($lootid);
unset($drop);
}
// Какие вещи содержатся в этой вещи
if(!($item['contains'] = loot('item_loot_template', $item['entry'])))
unset($item['contains']);
// Поиск созданий, у которых воруется вещь
$drops_pp = drop('pickpocketing_loot_template', $item['entry']);
if($drops_pp)
{
$item['pickpocketingloot'] = array();
foreach($drops_pp as $lootid => $drop)
{
$rows = $DB->select('
SELECT c.?#, c.entry
{
, l.name_loc?d AS name_loc
, l.subname_loc?d AS subname_loc
}
FROM ?_factiontemplate, creature_template c
{ LEFT JOIN (locales_creature l) ON l.entry=c.entry AND ? }
WHERE
pickpocketloot=?d
AND factiontemplateID=faction_A
',
$npc_cols[0],
($_SESSION['locale']>0)? $_SESSION['locale']: DBSIMPLE_SKIP,
($_SESSION['locale']>0)? $_SESSION['locale']: DBSIMPLE_SKIP,
($_SESSION['locale']>0)? 1: DBSIMPLE_SKIP,
$lootid
);
foreach($rows as $row)
$item['pickpocketingloot'][] = @array_merge(creatureinfo2($row), $drop);
}
unset($rows);
unset($lootid);
unset($drop);
}
unset($drops_pp);
// Поиск созданий, с которых сдираеццо эта шкура
$drops_sk = drop('skinning_loot_template', $item['entry']);
if($drops_sk)
{
$item['skinnedfrom'] = array();
foreach($drops_sk as $lootid => $drop)
{
$rows = $DB->select('
SELECT c.?#, c.entry
{
, l.name_loc?d AS name_loc
, l.subname_loc?d AS subname_loc
}
FROM ?_factiontemplate, creature_template c
{ LEFT JOIN (locales_creature l) ON l.entry=c.entry AND ? }
WHERE
skinloot=?d
AND factiontemplateID=faction_A
',
$npc_cols[0],
($_SESSION['locale']>0)? $_SESSION['locale']: DBSIMPLE_SKIP,
($_SESSION['locale']>0)? $_SESSION['locale']: DBSIMPLE_SKIP,
($_SESSION['locale']>0)? 1: DBSIMPLE_SKIP,
$lootid
);
foreach($rows as $row)
$item['skinnedfrom'][] = @array_merge(creatureinfo2($row), $drop);
}
unset($rows);
unset($lootid);
unset($drop);
}
unset($drops_sk);
// Перерабатывается в:
if(!($item['prospecting'] = loot('prospecting_loot_template', $item['entry'])))
unset($item['prospecting']);
// Поиск вещей, из которых перерабатывается эта вещь
$drops_pr = drop('prospecting_loot_template', $item['entry']);
if($drops_pr)
{
$item['prospectingloot'] = array();
foreach($drops_pr as $lootid => $drop)
{
$rows = $DB->select('
SELECT c.?#, c.entry, maxcount
{
, l.name_loc?d AS name_loc
}
FROM ?_icons, item_template c
{ LEFT JOIN (locales_item l) ON l.entry=c.entry AND ? }
WHERE
c.entry = ?d
AND id = displayid
',
$item_cols[2],
($_SESSION['locale']>0)? $_SESSION['locale']: DBSIMPLE_SKIP,
($_SESSION['locale']>0)? 1: DBSIMPLE_SKIP,
$lootid
);
foreach($rows as $row)
$item['prospectingloot'][] = @array_merge(iteminfo2($row, 0), $drop);
}
unset($rows);
unset($lootid);
unset($drop);
}
unset($drops_pr);
// Дизенчантитcя в:
if(!($item['disenchanting'] = loot('disenchant_loot_template', $item['DisenchantID'])))
unset($item['disenchanting']);
// Получается дизэнчантом из..
$drops_de = drop('disenchant_loot_template', $item['entry']);
if($drops_de)
{
$item['disenchantedfrom'] = array();
foreach($drops_de as $lootid => $drop)
{
$rows = $DB->select('
SELECT c.?#, c.entry, maxcount
{
, l.name_loc?d AS name_loc
}
FROM ?_icons, item_template c
{ LEFT JOIN (locales_item l) ON l.entry=c.entry AND ? }
WHERE
DisenchantID=?d
AND id=displayid
',
$item_cols[2],
($_SESSION['locale']>0)? $_SESSION['locale']: DBSIMPLE_SKIP,
($_SESSION['locale']>0)? 1: DBSIMPLE_SKIP,
$lootid
);
foreach($rows as $row)
$item['disenchantedfrom'][] = @array_merge(iteminfo2($row, 0), $drop);
}
unset($rows);
unset($lootid);
unset($drop);
}
unset($drops_de);
// Поиск сумок в которые эту вещь можно положить
if($item['BagFamily'] == 256)
{
// Если это ключ
$item['key'] = true;
}
elseif($item['BagFamily'] > 0 and $item['ContainerSlots'] == 0)
{
$rows_cpi = $DB->select('
SELECT c.?#, c.entry, maxcount
{
, l.name_loc?d AS name_loc
}
FROM ?_icons, item_template c
{ LEFT JOIN (locales_item l) ON l.entry=c.entry AND ? }
WHERE
BagFamily=?d
AND ContainerSlots>0
AND id=displayid
',
$item_cols[2],
($_SESSION['locale']>0)? $_SESSION['locale']: DBSIMPLE_SKIP,
($_SESSION['locale']>0)? 1: DBSIMPLE_SKIP,
$item['BagFamily']
);
if($rows_cpi)
{
$item['canbeplacedin'] = array();
foreach($rows_cpi as $row)
$item['canbeplacedin'][] = iteminfo2($row, 0);
}
unset($rows_cpi);
}
// Реагент для...
$rows_r = $DB->select('
SELECT ?#, spellID
FROM ?_spell s, ?_spellicons i
WHERE
(( reagent1=?d
OR reagent2=?d
OR reagent3=?d
OR reagent4=?d
OR reagent5=?d
OR reagent6=?d
OR reagent7=?d
OR reagent8=?d
) AND ( i.id=s.spellicon))
',
$spell_cols[2],
$item['entry'], $item['entry'], $item['entry'], $item['entry'],
$item['entry'], $item['entry'], $item['entry'], $item['entry']
);
if($rows_r)
{
$item['reagentfor'] = array();
$quality = 1;
foreach($rows_r as $i=>$row)
{
$item['reagentfor'][$i] = array();
$item['reagentfor'][$i]['entry'] = $row['spellID'];
$item['reagentfor'][$i]['name'] = $row['spellname_loc'.$_SESSION['locale']];
$item['reagentfor'][$i]['school'] = $row['resistancesID'];
$item['reagentfor'][$i]['level'] = $row['levelspell'];
$item['reagentfor'][$i]['quality'] = '@';
for ($j=1;$j<=8;$j++)
if($row['reagent'.$j])
{
$item['reagentfor'][$i]['reagents'][]['entry'] = $row['reagent'.$j];
$item['reagentfor'][$i]['reagents'][count($item['reagentfor'][$i]['reagents'])-1]['count'] = $row['reagentcount'.$j];
allitemsinfo($row['reagent'.$j], 0);
}
for ($j=1;$j<=3;$j++)
if($row['effect'.$j.'itemtype'])
{
$item['reagentfor'][$i]['creates'][]['entry'] = $row['effect'.$j.'itemtype'];
$item['reagentfor'][$i]['creates'][count($item['reagentfor'][$i]['creates'])-1]['count'] = 1 + $row['effect'.$j.'BasePoints'];
allitemsinfo($row['effect'.$j.'itemtype'], 0);
@$item['reagentfor'][$i]['quality'] = 7 - $allitems[$row['effect'.$j.'itemtype']]['quality'];
}
// Добавляем в таблицу спеллов
allspellsinfo2($row);
}
unset($quality);
}
unset($rows_r);
// Создается из...
$rows_cf = $DB->select('
SELECT ?#, s.spellID
FROM ?_spell s, ?_spellicons i
WHERE
((s.effect1itemtype=?d
OR s.effect2itemtype=?d
OR s.effect3itemtype=?)
AND (i.id = s.spellicon))
',
$spell_cols[2],
$item['entry'], $item['entry'], $item['entry']
);
if($rows_cf)
{
$item['createdfrom'] = array();
foreach($rows_cf as $row)
{
$skillrow = $DB->selectRow('
SELECT skillID, min_value, max_value
FROM ?_skill_line_ability
WHERE spellID=?d
LIMIT 1
',
$row['spellID']
);
$item['createdfrom'][] = spellinfo2(@array_merge($row, $skillrow));
}
unset($skillrow);
}
unset($rows_cf);
// Ловится в ...
$drops_fi = drop('fishing_loot_template', $item['entry']);
if($drops_fi)
{
$item['fishedin'] = array();
foreach($drops_fi as $lootid => $drop)
{
// Обычные локации
$row = $DB->selectRow('
SELECT name_loc'.$_SESSION['locale'].' AS name, areatableID as id
FROM ?_zones
WHERE
areatableID=?d
/*AND (x_min!=0 AND x_max!=0 AND y_min!=0 AND y_max!=0)*/
LIMIT 1
',
$lootid
);
if($row)
{
$item['fishedin'][] = @array_merge($row, $drop);
}
else
{
// Инсты
$row = $DB->selectRow('
SELECT name_loc'.$_SESSION['locale'].' AS name, mapID as id
FROM ?_zones
WHERE
areatableID=?d
LIMIT 1
',
$lootid
);
if($row)
$item['fishedin'][] = @array_merge($row, $drop);
}
}
unset($row);
unset($num);
}
unset($drops_fi);
// Размалывается в
if(!$item['milling'] = loot('milling_loot_template', $item['entry']))
unset($item['milling']);
// Получается размалыванием из
$drops_mi = drop('milling_loot_template', $item['entry']);
if($drops_mi)
{
$item['milledfrom'] = array();
foreach($drops_mi as $lootid => $drop)
{
$rows = $DB->select('
SELECT c.?#, c.entry, maxcount
{
, l.name_loc?d AS name_loc
}
FROM ?_icons, item_template c
{ LEFT JOIN (locales_item l) ON l.entry=c.entry AND ? }
WHERE
c.entry=?d
AND id=displayid
',
$item_cols[2],
($_SESSION['locale']>0)? $_SESSION['locale']: DBSIMPLE_SKIP,
($_SESSION['locale']>0)? 1: DBSIMPLE_SKIP,
$lootid
);
foreach($rows as $row)
$item['milledfrom'][] = @array_merge(iteminfo2($row, 0), $drop);
}
unset($rows);
unset($lootid);
unset($drop);
}
unset($drops_mi);
// Валюта для...
$rows_cf = $DB->select('
SELECT ?#, i.entry, i.maxcount, n.`maxcount` as `drop-maxcount`, n.ExtendedCost,
{l.name_loc?d AS `name_loc`,}
reqitem1, reqitem2, reqitem3, reqitem4, reqitem5,
reqitemcount1, reqitemcount2, reqitemcount3, reqitemcount4, reqitemcount5,
reqhonorpoints, reqarenapoints
FROM npc_vendor n, ?_icons, ?_item_extended_cost iec, item_template i
{LEFT JOIN (locales_item l) ON l.entry=i.entry AND ?d}
WHERE (iec.reqitem1=?
OR iec.reqitem2=?
OR iec.reqitem3=?
OR iec.reqitem4=?
OR iec.reqitem5=?)
AND iec.extendedcostID=ABS(n.ExtendedCost)
AND i.entry=n.item
AND id=i.displayid
',
$item_cols[2],
($_SESSION['locale'])? $_SESSION['locale']: DBSIMPLE_SKIP,
($_SESSION['locale'])? 1: DBSIMPLE_SKIP,
$item['entry'], $item['entry'], $item['entry'], $item['entry'], $item['entry']
);
if($rows_cf)
{
$item['currencyfor'] = array();
foreach($rows_cf as $row)
{
$id=$row['entry'];
$item['currencyfor'][$id] = array();
$item['currencyfor'][$id] = iteminfo2($row);
$item['currencyfor'][$id]['maxcount'] = $row['drop-maxcount'];
$item['currencyfor'][$id]['cost'] = array();
if($row['BuyPrice']>0)
$npc['sells'][$id]['cost']['money'] = $row['BuyPrice'];
if($row['reqhonorpoints']>0)
$item['currencyfor'][$id]['cost']['honor'] =/* ($row['A']==1?1:-1)* */$row['reqhonorpoints']; //FIXME_BUG
if($row['reqarenapoints']>0)
$item['currencyfor'][$id]['cost']['arena'] = $row['reqarenapoints'];
$item['currencyfor'][$id]['cost']['items'] = array();
for($j=1; $j<=5; $j++)
if(($row['reqitem'.$j]>0) and ($row['reqitemcount'.$j]>0))
{
allitemsinfo($row['reqitem'.$j], 0);
$item['currencyfor'][$id]['cost']['items'][] = array(
'item' => $row['reqitem'.$j],
'count' => $row['reqitemcount'.$j]
);
}
}
}
unset($rows_cf);
// Цель критерии
$rows = $DB->select('
SELECT a.id, a.faction, a.name_loc?d AS name, a.description_loc?d AS description, a.category, a.points, s.iconname, z.areatableID
FROM ?_spellicons s, ?_achievementcriteria c, ?_achievement a
LEFT JOIN (?_zones z) ON a.map != -1 AND a.map = z.mapID
WHERE
a.icon = s.id
AND a.id = c.refAchievement
AND c.type IN (?a)
AND c.value1 = ?d
GROUP BY a.id
ORDER BY a.name_loc?d
',
$_SESSION['locale'],
$_SESSION['locale'],
array(ACHIEVEMENT_CRITERIA_TYPE_OWN_ITEM, ACHIEVEMENT_CRITERIA_TYPE_USE_ITEM, ACHIEVEMENT_CRITERIA_TYPE_LOOT_ITEM, ACHIEVEMENT_CRITERIA_TYPE_EQUIP_ITEM),
$item['entry'],
$_SESSION['locale']
);
if($rows)
{
$item['criteria_of'] = array();
foreach($rows as $row)
{
allachievementsinfo2($row['id']);
$item['criteria_of'][] = achievementinfo2($row);
}
}
save_cache(ITEM_PAGE, $cache_key, $item);
}
global $page;
$page = array(
'Mapper' => false,
'Book' => false,
'Title' => $item['name'].' - '.$smarty->get_config_vars('Items'),
'tab' => 0,
'type' => 3,
'typeid' => $item['entry'],
'path' => path(0, 0, $item['classs'], $item['subclass'], $item['type'])
);
$smarty->assign('page', $page);
// Комментарии
$smarty->assign('comments', getcomments($page['type'], $page['typeid']));
// Количество MySQL запросов
$smarty->assign('mysql', $DB->getStatistics());
$smarty->assign('item', $item);
$smarty->display('item.tpl');
?>