2 include_once("functions.php");
4 // Report generator class (класс генератора отчётов)
6 var $mark = ''; // Report uniquie id
7 var $disable_mark = false;// Disable mark check/add (single report on page)
8 var $ajax_mode = 0; // Report mode direct render / ajax load
9 var $fields = 0; // Columns array
10 var $page = 1; // Report page
11 var $size_limit = 0; // Report row limit
12 var $total_data = 0; // Total rows
13 var $sort_method= 0; // Sort
14 var $sort_default = ''; // Default sort
15 var $r_link = ''; // Base page link
16 var $rowCallback = ''; // Callback function for row render
18 var $column_conf=0; // Report config array
19 // NPC report generator config array, contain elements:
20 // 'field_name' =>array(
21 // 'class'=>'', - cell class (width, align)
22 // 'sort'=>'sort', - column sort type
23 // 'text'=>'text', - column header text
24 // 'draw'=>'r_drawFunc', - cell draw function name
25 // 'sort_str'=>'`name`', - sort require string
26 // 'fields'=>'`name`'); - fields require for draw cell
27 var $db=0; // DB class for get data (filled in
28 var $table = ''; // DB tables
29 var $db_fields = '*'; // DB fields
30 var $query_args = 0; // Helper for expand query placeholders
31 var $data_array = 0; // Report data stored here
32 // Init data for report (return false if no need create it)
33 function Init(&$fields, $link, $report_mark, $limit, $def_sort)
36 // Init data if need directly create report or upload in ajax mode
37 if ($ajaxmode == 0 ||
$this->disable_mark ||
$report_mark==@$_REQUEST['mark'])
39 // echo $report_mark."<br />";
40 $this->ajax_mode
= $ajaxmode;
41 $this->mark
= $report_mark; // This report mark
42 $this->fields
=& $fields; // Columns array
43 $this->sort_default
= $def_sort; // Default sort
44 $this->size_limit
= $limit; // Size limit (max row count)
45 $this->total_data
= -1; // Total exist data
46 $this->r_link
= $link; // Base page link
47 $this->data_array
= 0;
48 // In url exist page, sort for this report store it
49 if ($this->disable_mark ||
$report_mark==@$_REQUEST['mark'])
51 $this->page
= isset($_REQUEST['page']) ?
intval($_REQUEST['page']) : 1; // Store page
52 $this->sort_method
= isset($_REQUEST['sort']) ?
$_REQUEST['sort'] : $def_sort; // Store sort method
53 if ($this->page
< 1) $this->page
= 1;
56 // No data for this report - set default
59 $this->sort_method
= $def_sort;
64 // Add custom column config
65 function addColumnConfig($name, $conf) {$this->column_conf
[$name]=$conf;}
66 // Get total data count in result
67 function getTotalDataCount() {return $this->total_data
;}
68 // Disable report mark in link (single report on page)
69 function disableMark() {$this->disable_mark
= true;}
70 // Report link generator (for pages, headers)
71 function createLink($page, $sort)
73 $link = $this->r_link
;
74 if ($page > 1) $link.='&page='.$page;
75 if ($sort!=$this->sort_default
)
76 $link.='&sort='.$sort;
78 if (!$this->disable_mark
) $link.='&mark='.$this->mark
;
81 // Create reference to report
82 function createHref($page, $sort, $text)
84 return '<a href="'.$this->createLink($page, $sort).'" onClick="return uploadFromHref(this, \''.$this->mark
.'\');">'.$text.'</a>';
87 function createReport($header)
90 if (!$this->data_array ||
!$this->total_data ||
!$this->column_conf
) return;
92 $columns = count($this->fields
);
93 if ($this->ajax_mode
==0)
94 echo '<div class=reportContainer id="'.$this->mark
.'">';
96 echo '<table class=report width=500>';
98 echo '<tr class=head><td colspan='.$columns.'>'.$header.'</td></tr>';
100 foreach ($this->fields
as $field)
102 $f =& $this->column_conf
[$field];
104 if ($f['sort'] && $this->total_data
> 1)
105 echo $this->createHref($this->page
, $f['sort'], $f['text']);
113 foreach ($this->data_array
as &$data)
115 $cb = $this->rowCallback
;
116 $class = $cb ?
$cb($data) : 0;
117 $row_class = $class ?
' class='.$class : '';
118 echo '<tr'.$row_class.'>';
119 foreach ($this->fields
as $field)
121 $f =& $this->column_conf
[$field];
122 echo $f['class']?
'<td class='.$f['class'].'>' : '<td>';
129 if ($this->size_limit
&& $this->total_data
> $this->size_limit
)
131 $totalPage = floor($this->total_data
/$this->size_limit+
0.9999);
133 echo '<tr><td colspan='.$columns.' class=page>';
134 for ($i=1;$i<=$totalPage;$i++
)
136 if ($i!=$page) echo $this->createHref($i, $this->sort_method
, $i).' ';
137 else echo '<b><i>'.$i.' </i></b>';
141 echo '</tbody></table>';
142 if ($this->ajax_mode
==0)
146 $link = $this->createLink($this->page
, $this->sort_method
);
147 echo "<script type=\"text/javascript\">ajaxCacheHtmlId('$this->mark','$link');</script>";
148 $tabName = $this->total_data
> 1 ?
$header.' ('.$this->total_data
.')' : $header;
149 if (!$this->disable_mark
) addTab($tabName, $this->mark
);
152 // Remove column if all data zero
153 function removeIfAllZero($fname, $field)
156 foreach($this->data_array
as &$v) if (!isset($v[$fname]) OR $v[$fname]) {$set = 1;break;}
157 if (!$set) $this->removeField($field);
160 function removeField($name)
162 if ($id = array_search($name, $this->fields
))
163 unset($this->fields
[$id]);
165 // Expand placeholders func
166 function expandPlaceholdersCallback($m)
170 $value = array_pop($this->query_args
);
172 case 'a': return join(', ', $value);
173 case 'd': return intval($value);
174 case 'u': return sprintf('%u',$value);
175 case 'f': return str_replace(',', '.', floatval($value));
179 if (isset($m[1]) && strlen($block=$m[1]))
181 if (current($this->query_args
) === DBSIMPLE_SKIP
)
183 array_pop($this->query_args
);
186 return $this->_doPlaceholders($block);
190 function _doPlaceholders($query)
192 $re = '{(?>\{( (?> (?>[^{}]+) | (?R) )* )\}) | (?>(\?) ( [duaf]? ))}sx';
193 return preg_replace_callback($re, array(&$this,'expandPlaceholdersCallback'), $query);
195 function expandPlaceholders($data)
197 $this->query_args
= array_reverse($data);
198 return $this->_doPlaceholders(array_pop($this->query_args
));
200 // Database depend requirest generator
201 function doRequirest($where)
204 $locale = $config['locales_lang'];
205 $where_filter = $this->expandPlaceholders(func_get_args());
206 $tables = $this->table
;
207 $fields = $this->getFieldsRequirest();
208 $sort_str= $this->getSortRequirest();
210 $this->localiseRequirest($locale, $tables, $fields, $sort_str);
211 $reqString = 'SELECT '.$fields.' FROM '.$tables.' WHERE '.$where_filter.$sort_str.$this->getLimitRequirest();
212 // echo "<br />".$reqString."<br />";
213 if ($this->size_limit
> 0)
214 $this->data_array
= $this->db
->selectPage($this->total_data
, $reqString);
217 $this->data_array
= $this->db
->select($reqString);
218 $this->total_data
= count($this->data_array
);
221 // Manually slice on page
222 function setManualPagenateMode() {if ($this->size_limit
>=0) $this->size_limit
=-$this->size_limit
;}
225 if ($this->size_limit
>=0) return;
226 $this->total_data
= count($this->data_array
);
227 $this->size_limit
= -$this->size_limit
;
228 $this->data_array
= array_slice($this->data_array
,($this->page
-1)*$this->size_limit
, $this->size_limit
);
230 // Localise fields requirement and sort
231 function localiseRequirest($locale, &$fields, &$sort){return;}
232 // Build fields list depend from config
233 function getFieldsRequirest()
235 if ($this->db_fields
=='*')
237 $r = $this->db_fields
;
238 foreach($this->fields
as $f)
239 if ($data = $this->column_conf
[$f]['fields'])
241 return join(',', array_unique(explode(',', $r)));
243 function addFieldsRequirest($f)
245 if ($this->db_fields
=='*')
247 $this->db_fields
.=', '.$f;
249 // Get sort requirest depend from config
250 function getSortRequirest()
252 if ($this->sort_method
)
253 foreach($this->column_conf
as $c)
254 if ($this->sort_method
==$c['sort'])
255 return ' ORDER BY '.$c['sort_str'];
258 // Get limit requirest depend from page and page size
259 function getLimitRequirest()
261 if ($this->size_limit
> 0)
262 return ' LIMIT '.(($this->page
-1)*$this->size_limit
).', '.$this->size_limit
;
267 //==============================================================================
268 // Tabbed report functions
269 //==============================================================================
270 $tab_mode = 2; // disabled
271 function createReportTab()
273 global $tab_mode, $config, $ajaxmode;
274 if(!$config['use_tab_mode'] ||
$ajaxmode)
276 echo '<script type="text/javascript">report_hideHeaders()</script>';
277 echo '<br><ul class=my_tabs id="report_tabs"></ul>';
278 $tab_mode = 1; // First page select
280 function addTab($header, $mark)
283 if ($tab_mode > 1) return;
284 if (isset($_REQUEST['mark']))
285 $selected = $mark==$_REQUEST['mark'] ?
1 : 0;
287 $selected = $tab_mode?
1:0;
288 echo '<script type="text/javascript">report_addTab("'.$header.'", "'.$mark.'", '.$selected.');</script>';
289 $tab_mode = 0; // disable select page
293 function getRefrenceItemLoot($entry)
296 // Получаем рефренс лут
297 return $dDB->select('-- CACHE: 1h
298 SELECT `entry` AS ARRAY_KEY, `ChanceOrQuestChance`, `groupid`, `mincountOrRef`, `maxcount`, `condition_id` FROM `reference_loot_template` WHERE `item`=?d', $entry);
300 function getFactionTemplates($entry)
303 return $wDB->selectCol('-- CACHE: 1h
304 SELECT `id` FROM `wowd_faction_template` WHERE `faction` = ?d', $entry);
306 function getPlayerSpells($guid)
309 return $cDB->select('-- CACHE: 1h
310 SELECT `spell` AS ARRAY_KEY FROM `character_spell` WHERE `guid` = ?d AND `disabled` = 0', $guid);
314 function getHeroicList()
316 global $dDB, $gheroic;
318 $gheroic = $dDB->selectCol('-- CACHE: 1h
319 SELECT `difficulty_entry_1` AS ARRAY_KEY, `entry` FROM `creature_template` WHERE `difficulty_entry_1` <> 0');
324 function getHeroicList1()
326 global $dDB, $gheroic1;
328 $gheroic1 = $dDB->selectCol('-- CACHE: 1h
329 SELECT `difficulty_entry_2` AS ARRAY_KEY, `entry` FROM `creature_template` WHERE `difficulty_entry_2` <> 0');
334 function getHeroicList2()
336 global $dDB, $gheroic2;
338 $gheroic2 = $dDB->selectCol('-- CACHE: 1h
339 SELECT `difficulty_entry_3` AS ARRAY_KEY, `entry` FROM `creature_template` WHERE `difficulty_entry_3` <> 0');
342 //==============================================================================
343 // Callback functions
344 //==============================================================================
345 function playerSpellCallback($data)
347 $spells = getPlayerSpells($_REQUEST['guid']);
348 if (isset($spells[$data['id']]))
354 //==============================================================================
356 //==============================================================================
357 function r_lootChance($data)
359 if ($data['mincountOrRef'] < 0)
361 echo 'R'.($data['ChanceOrQuestChance']).'%';
363 else if ($data['ChanceOrQuestChance'] < 0)
364 echo 'Q'.(-$data['ChanceOrQuestChance']).'%';
366 echo $data['ChanceOrQuestChance'].'%';
368 function r_lootRequire($data)
371 $lootcondition=getConditionItem($data['condition_id']);
373 foreach ($lootcondition as $type)
375 switch ($type['type']){
376 case 1: // CONDITION_AURA - spell_id, effindex
377 $spell = getSpell($type['value1'], '`id`, `SpellIconID`');
378 echo $lang['condition1']; show_spell($spell['id'], $spell['SpellIconID'], 'quest');
380 case 2: // CONDITION_ITEM - item_id, count
381 $item = getItem($type['value1'], '`entry`, `displayid`');
382 echo $lang['condition2'].text_show_item($item['entry'], $item['displayid'], 'quest');
383 if ($type['value2'] > 1) echo 'x'.$type['value2'];
385 case 3: // CONDITION_ITEM_EQUIPPED - item_id, 0
386 $item = getItem($type['value1'], '`entry`, `displayid`');
387 echo $lang['condition3'].text_show_item($item['entry'], $item['displayid'], 'quest');
389 case 4: // CONDITION_AREAID - area_id 0, 1 (0: in (sub)area, 1: not in (sub)area)
390 if ($type['value2'] > 0 ) echo $lang['condition4_1'].getAreaName($type['value1']);
391 if ($type['value2'] == 0) echo getAreaName($type['value1']);
393 case 5: // CONDITION_REPUTATION_RANK_MIN - faction_id, min_rank
394 echo getFactionName($type['value1']).'=>('.getReputationRankName($type['value2']).')';
396 case 6: // CONDITION_TEAM player_team, 0 (469 - Alliance 67 - Horde)
397 echo getFactionName($type['value1']);
399 case 7: // CONDITION_SKILL skill_id, skill_value
400 echo $lang['condition7'].getSkillName($type['value1']);
401 if ($type['value2'] > 1) echo ' ('.$type['value2'].')';
403 case 8: // CONDITION_QUESTREWARDED quest_id, 0
404 echo $lang['condition8'].getQuestName($type['value1']);
406 case 9: // CONDITION_QUESTTAKEN quest_id 0, for condition true while quest active.
407 echo $lang['condition9'].getQuestName($type['value1']);
409 case 10: // CONDITION_AD_COMMISSION_AURA 0, 0 for condition true while one from AD сommission aura active
410 echo $lang['condition10'];
412 case 11: // CONDITION_NO_AURA spell_id, effindex
413 $spell = getSpell($type['value1'], '`id`, `SpellIconID`');
414 echo $lang['condition11']; show_spell($spell['id'], $spell['SpellIconID'], 'quest');
416 case 12: // CONDITION_ACTIVE_GAME_EVENT event_id
417 echo $lang['condition12'].getGameEventName($type['value1']);
419 case 13: // CONDITION_AREA_FLAG area_flag area_flag_not
420 if ($type['value1'] > 0) echo $lang['condition13_1'].$type['value1'];
421 if ($type['value2'] > 0) echo $lang['condition13_2'].$type['value2'];
423 case 14: // CONDITION_RACE_CLASS race_mask class_mask
424 if ($type['value1'] > 0) echo getAllowableRace($type['value1']).'<br>';
425 if ($type['value2'] > 0) echo getAllowableClass($type['value2']);
427 case 15: // CONDITION_LEVEL player_level 0, 1 or 2
428 if ($type['value1'] > 0) echo $type['value1'];
429 if (($type['value1'] > 0) && ($type['value2'] == 0)) echo $lang['condition15_1'];
430 if (($type['value1'] > 0) && ($type['value2'] == 1)) echo $lang['condition15_2'];
431 if (($type['value1'] > 0) && ($type['value2'] == 2)) echo $lang['condition15_3'];
433 case 16: // CONDITION_NOITEM item_id count
434 $item = getItem($type['value1'], '`entry`, `displayid`');
435 echo $lang['condition16'].text_show_item($item['entry'], $item['displayid'], 'quest');
436 if ($type['value1'] > 1) echo 'x'.$type['value2'];
438 case 17: // CONDITION_SPELL spell_id 0, 1 (0: has spell, 1: hasn't spell)
439 $spell = getSpell($type['value1'], '`id`, `SpellIconID`');
440 if ($type['value2'] > 0) { echo $lang['condition17_1']; show_spell($spell['id'], $spell['SpellIconID'], 'quest');}
441 else { echo $lang['condition17_2']; show_spell($spell['id'], $spell['SpellIconID'], 'quest');}
443 case 18: // CONDITION_INSTANCE_SCRIPT instance_condition_id 0, 1, 2, 3, 4
444 if ($type['value1'] == 0) echo $lang['condition18_0'];
445 if ($type['value1'] == 1) echo $lang['condition18_1'];
446 if ($type['value1'] == 2) echo $lang['condition18_2'];
447 if ($type['value1'] == 3) echo $lang['condition18_3'];
448 if ($type['value1'] == 4) echo $lang['condition18_4'];
450 case 20: // CONDITION_ACHIEVEMENT ach_id 0, 1 (0: has achievement, 1: hasn't achievement) for player
451 if ($type['value2'] > 0) echo $lang['condition20_1'].$type['value1'];
452 else echo $lang['condition20_2'].$type['value1'];
454 case 22: // CONDITION_QUEST_NONE quest_id
455 if ($type['value1'] > 0) echo $lang['condition22'].getQuestName($type['value1']);
457 case 23: // CONDITION_ITEM_WITH_BANK- item_id, count
458 $item = getItem($type['value1'], '`entry`, `displayid`');
459 echo $lang['condition23'].text_show_item($item['entry'], $item['displayid'], 'quest');
460 if ($type['value2'] > 1) echo 'x'.$type['value2'];
462 case 24: // NOITEM_WITH_BANK item_id count
463 $item = getItem($type['value1'], '`entry`, `displayid`');
464 echo $lang['condition24'].text_show_item($item['entry'], $item['displayid'], 'quest');
465 if ($type['value1'] > 1) echo 'x'.$type['value2'];
467 case 25: // CONDITION_NOT_ACTIVE_GAME_EVENT event_id
468 echo $lang['condition25'].getGameEventName($type['value1']);
470 case 26: // CONDITION_ACTIVE_HOLIDAY holiday_id
471 echo $lang['condition26'].getGameHolidayName($type['value1']);
473 case 27: // CONDITION_NOT_ACTIVE_HOLIDAY holiday_id
474 echo $lang['condition27'].getGameHolidayName($type['value1']);
476 case 28: // CONDITION_LEARNABLE_ABILITY spell_id 0 or item_id
477 $spell = getSpell($type['value1'], '`id`, `SpellIconID`');
478 if ($type['value2'] > 0) { $item = getItem($type['value2'], '`entry`, `displayid`'); echo $lang['condition28_1']; show_spell($spell['id'], $spell['SpellIconID'], 'quest'); echo $lang['condition28_2'].text_show_item($item['entry'], $item['displayid'], 'quest');}
479 else {echo $lang['condition28_1']; show_spell($spell['id'], $spell['SpellIconID'], 'quest');}
481 case 29: // CONDITION_SKILL_BELOW skill_id, skill_value
482 echo $lang['condition29'].getSkillName($type['value1']);
483 if ($type['value2'] > 1) echo ' ('.$type['value2'].')';
485 case 30: // CONDITION_REPUTATION_RANK_MAX - faction_id, max_rank
486 echo getFactionName($type['value1']).'<=('.getReputationRankName($type['value2']).')';
492 class LootReportGenerator
extends ReportGenerator
{
493 function LootReportGenerator($type='')
497 $this->db_fields
= '*';
499 default: $this->table
= '`creature_loot_template`'; break;
502 function loadSubList($lootId, $table)
504 $fields= $this->db_fields
;
505 $rows = $this->db
->select("SELECT $fields FROM $table
507 GROUP BY IF (`mincountOrRef` < 0, `mincountOrRef`, `item`)
508 ORDER BY `groupid`, `ChanceOrQuestChance`>0, ABS(`ChanceOrQuestChance`) DESC", $lootId);
511 foreach($rows as &$loot)
514 if ($loot['ChanceOrQuestChance'] == 0)
516 $group = $loot['groupid'];
518 foreach($rows as &$g)
519 if ($g['groupid'] == $group)
521 if ($g['ChanceOrQuestChance']>0) $chance+
=$g['ChanceOrQuestChance'];
524 $chance = round((100 - $chance) / $n, 3);
525 foreach($rows as &$g)
526 if ($g['groupid'] == $group && $g['ChanceOrQuestChance']==0)
527 $g['ChanceOrQuestChance'] =$chance;
529 if ($loot['mincountOrRef'] < 0)
532 $loot['item'] = $this->loadSubList(-$loot['mincountOrRef'], 'reference_loot_template');
533 $loot['maxcount'] = $this->db
->selectCell("SELECT `maxcount` FROM $table WHERE `entry` = ?d AND `mincountOrRef` = ?d", $lootId, $loot['mincountOrRef']);
538 function getLootList($lootId)
540 $this->total_data
= 0;
541 $this->data_array
= $this->loadSubList($lootId, $this->table
);
543 function renderSubList($lootList)
545 global $Quality, $lang;
549 foreach ($lootList as $loot)
552 if ($loot['groupid']!=$curloot)
554 echo "<tr><th colspan = 4>$lang[kill_kredit_group] $loot[groupid]</th></tr>";
555 $curloot = $loot['groupid'];
558 if ($loot['mincountOrRef'] > 0)
560 if ($item = getItem($loot['item'],"`entry`, `Quality`, `name`, `displayid`"))
562 echo '<td class=i_ico>';r_itemIcon($item);echo '</td>';
563 echo '<td class=left>';r_itemName($item);echo '</td>';
566 echo "<td>-</td><td>$lang[item_not_found] $loot[item]</td>";
568 else // Используется список вещей (падает только одна вещь из списка)
570 echo "<td>".$loot['maxcount']."x</td>";
571 echo "<td class=forsub>$gtext<table class=sublist><tbody>";
572 $this->renderSubList($loot['item']);
573 echo "</tbody></table></td>";
575 if ($loot['condition_id']){echo '<td>'; r_lootRequire($loot); echo '</td>';}
576 else echo '<td></td>';
577 if ($loot['ChanceOrQuestChance'] < 0) echo "<td align=center>Q".(-$loot['ChanceOrQuestChance'])."%</td>";
578 else if ($loot['ChanceOrQuestChance'] > 0) echo "<td align=center>".$loot['ChanceOrQuestChance']."%</td>";
582 function createReport($header)
585 if (!$this->data_array
)
587 if ($this->ajax_mode
==0)
588 echo '<div id="'.$this->mark
.'">';
589 echo '<table class=report width=500>';
591 echo '<tr><td colspan=4 class=head>'.$header.'</td></tr>';
592 echo '<tr><th width=1%></th><th>'.$lang['item_name'].'</th><th></th><th>'.$lang['drop'].'%</th></tr>';
593 $this->renderSubList($this->data_array
);
594 echo '</tbody></table>';
595 if ($this->ajax_mode
==0)
599 $link = $this->createLink($this->page
, $this->sort_method
);
600 echo "<script type=\"text/javascript\">ajaxCacheHtmlId('$this->mark','$link');</script>";
605 //=================================================================
606 // Item report functions and methods
607 //=================================================================
608 function r_itemIcon($data) {echo text_show_item($data['entry'], $data['displayid']);}
609 function r_itemName($data)
612 echo '<a class="'.$Quality[$data['Quality']].'" href="?item='.$data['entry'].'">'.(@$data['name_loc']?
$data['name_loc']:$data['name']).'</a>';
614 function r_itemLevel($data) {echo $data['ItemLevel'];}
615 function r_itemReqLevel($data){echo $data['RequiredLevel'];}
616 function r_itemGemProp($data) {echo ($data['GemProperties']?
getGemProperties($data['GemProperties']):'n/a');}
617 function r_itemArmor($data) {echo $data['armor'];}
618 function r_itemBlock($data) {echo $data['block'];}
619 function r_itemDPS($data) {echo $data['dps'] != 0 ?
number_format($data['dps'], 2, '.', ''):'n/a';}
620 function r_itemAmmoDPS($data) {echo $data['adps'] != 0 ?
number_format($data['adps'], 2, '.', ''):'n/a';}
621 function r_itemSpeed($data) {echo number_format($data['delay']/1000.00, 2, '.', '');}
622 function r_itemSlots($data) {echo $data['ContainerSlots'].' slot';}
623 function r_itemDesc($data) {echo (@$data['description_loc']?
$data['description_loc']:$data['description']);}
624 function r_itemSClass($data) {echo getSubclassName($data['class'], $data['subclass'], 0);}
625 function r_itemInvType($data) {echo getInventoryType($data['InventoryType'], 0);}
626 function r_itemRecipe($data) {$ritem = getRecipeItem($data); echo ($ritem ?
text_show_item($ritem['entry'], $ritem['displayid']):'-');}
627 function r_itemSpells($data)
630 for ($i=1;$i<=5;$i++
)
632 if ($id = $data['spellid_'.$i])
633 if ($desc = get_spell_details($id))
634 echo '<a href="?spell='.$id.'">'.$UseorEquip[$data['spelltrigger_'.$i]].' '.$desc.'</a><br>';
637 function r_itemRepRank($data) {echo $data['RequiredReputationFaction']?
getReputationRankName($data['RequiredReputationRank']):'n/a';}
638 function r_itemFlag($data) {echo dechex($data['Flags']);}
641 function r_vendorCost($data)
643 $flags2 = getItemFlags2($data['entry']);
644 if ($data['ExtendedCost']>0)
646 $cost = getExtendCost($data['ExtendedCost']);
647 if ($flags2&ITEM_FLAGS2_EXT_COST_REQUIRES_GOLD
)
648 echo money($data['BuyPrice']).''.r_excostCost($cost);
653 echo money($data['BuyPrice']);
655 function r_vendorCount($data) {echo $data['sold_count']?
$data['sold_count']:'∞';}
656 function r_vendorTime($data) {echo $data['incrtime']?
getTimeText($data['incrtime']):'';}
658 // NPC report generator config
659 $item_report = array(
660 'ITEM_REPORT_ICON' =>array('class'=>'i_ico','sort'=>'', 'text'=>'', 'draw'=>'r_itemIcon', 'sort_str'=>'', 'fields'=>'`displayid`' ),
661 'ITEM_REPORT_NAME' =>array('class'=>'left', 'sort'=>'name', 'text'=>$lang['item_name'], 'draw'=>'r_itemName', 'sort_str'=>'`name`', 'fields'=>'`Quality`, `name`'),
662 'ITEM_REPORT_LEVEL' =>array('class'=>'small','sort'=>'i_level', 'text'=>$lang['item_level'], 'draw'=>'r_itemLevel', 'sort_str'=>'`ItemLevel` DESC, `name`', 'fields'=>'`ItemLevel`' ),
663 'ITEM_REPORT_REQLEVEL' =>array('class'=>'small','sort'=>'level', 'text'=>$lang['item_req_level'], 'draw'=>'r_itemReqLevel', 'sort_str'=>'`RequiredLevel` DESC, `name`', 'fields'=>'`RequiredLevel`' ),
664 'ITEM_REPORT_GEMPROPETY' =>array('class'=>'left', 'sort'=>'gem_prop','text'=>$lang['item_gem_details'],'draw'=>'r_itemGemProp', 'sort_str'=>'`GemProperties`', 'fields'=>'`GemProperties`'),
665 'ITEM_REPORT_ARMOR' =>array('class'=>'', 'sort'=>'armor', 'text'=>$lang['item_armor'], 'draw'=>'r_itemArmor', 'sort_str'=>'`armor` DESC', 'fields'=>'`armor`'),
666 'ITEM_REPORT_BLOCK' =>array('class'=>'', 'sort'=>'block', 'text'=>$lang['item_block'], 'draw'=>'r_itemBlock', 'sort_str'=>'`block` DESC', 'fields'=>'`block`'),
667 'ITEM_REPORT_DPS' =>array('class'=>'', 'sort'=>'dps', 'text'=>$lang['item_dps'], 'draw'=>'r_itemDPS', 'sort_str'=>'`dps` DESC', 'fields'=>'(500*(`dmg_min1`+`dmg_max1`) / `delay`) AS `dps`'),
668 'ITEM_REPORT_AMMO_DPS' =>array('class'=>'', 'sort'=>'adps', 'text'=>$lang['item_dps'], 'draw'=>'r_itemAmmoDPS', 'sort_str'=>'`adps` DESC', 'fields'=>'((`dmg_min1`+`dmg_max1`)/2) AS `adps`'),
669 'ITEM_REPORT_SPEED' =>array('class'=>'', 'sort'=>'speed', 'text'=>$lang['item_speed'], 'draw'=>'r_itemSpeed', 'sort_str'=>'`delay` DESC', 'fields'=>'`delay`'),
670 'ITEM_REPORT_NUM_SLOTS' =>array('class'=>'', 'sort'=>'bag_slot','text'=>$lang['item_slot_num'], 'draw'=>'r_itemSlots', 'sort_str'=>'`ContainerSlots` DESC', 'fields'=>'`ContainerSlots`'),
671 'ITEM_REPORT_DESCRIPTION'=>array('class'=>'left', 'sort'=>'desc', 'text'=>$lang['item_desc'], 'draw'=>'r_itemDesc', 'sort_str'=>'`description` DESC', 'fields'=>'`description`'),
672 'ITEM_REPORT_SUBCLASS' =>array('class'=>'', 'sort'=>'subclass','text'=>$lang['item_type'], 'draw'=>'r_itemSClass', 'sort_str'=>'`subclass` DESC', 'fields'=>'`class`, `subclass`'),
673 'ITEM_REPORT_SLOTTYPE' =>array('class'=>'', 'sort'=>'type', 'text'=>$lang['item_slot'], 'draw'=>'r_itemInvType', 'sort_str'=>'`InventoryType` DESC', 'fields'=>'`InventoryType`'),
674 'ITEM_REPORT_RECIPE_ITEM'=>array('class'=>'i_ico','sort'=>'', 'text'=>'', 'draw'=>'r_itemRecipe', 'sort_str'=>'', 'fields'=>'`spellid_1`, `spellid_2`, `class`'),
675 'ITEM_REPORT_SPELL' =>array('class'=>'left', 'sort'=>'', 'text'=>$lang['item_spells'], 'draw'=>'r_itemSpells', 'sort_str'=>'', 'fields'=>'`spellid_1`, `spelltrigger_1`, `spellid_2`, `spelltrigger_2`, `spellid_3`, `spelltrigger_3`, `spellid_4`, `spelltrigger_4`, `spellid_5`, `spelltrigger_5`'),
676 'ITEM_REPORT_REQREP_RANK'=>array('class'=>'', 'sort'=>'rep_rank','text'=>$lang['item_faction_rank'],'draw'=>'r_itemRepRank', 'sort_str'=>'`RequiredReputationRank` DESC', 'fields'=>'`RequiredReputationFaction`, `RequiredReputationRank`'),
677 'ITEM_REPORT_FLAGS' =>array('class'=>'', 'sort'=>'', 'text'=>'flag', 'draw'=>'r_itemFlag', 'sort_str'=>'', 'fields'=>'`Flags`'),
678 // If set vendor class type
679 'VENDOR_REPORT_COST' =>array('class'=>'', 'sort'=>'cost', 'text'=>$lang['item_cost'], 'draw'=>'r_vendorCost', 'sort_str'=>'`ExtendedCost`, `BuyPrice`', 'fields'=>'`ExtendedCost`, `BuyPrice`'),
680 'VENDOR_REPORT_COUNT' =>array('class'=>'', 'sort'=>'count', 'text'=>$lang['item_count'], 'draw'=>'r_vendorCount', 'sort_str'=>'`sold_count`, `name`', 'fields'=>'`npc_vendor`.`maxcount` AS `sold_count`'),
681 'VENDOR_REPORT_INCTIME'=>array('class'=>'', 'sort'=>'time', 'text'=>$lang['item_incrtime'], 'draw'=>'r_vendorTime', 'sort_str'=>'`incrtime`, `name`', 'fields'=>'`incrtime`'),
682 // If set loot class type
683 'LOOT_REPORT_CHANCE'=>array('class'=>'', 'sort'=>'chance', 'text'=>$lang['loot_chance'], 'draw'=>'r_lootChance', 'sort_str'=>'ABS(`ChanceOrQuestChance`) DESC, `name`', 'fields'=>'`ChanceOrQuestChance`, `mincountOrRef`'),
684 'LOOT_REPORT_REQ' =>array('class'=>'', 'sort'=>'', 'text'=>$lang['loot_require'],'draw'=>'r_lootRequire','sort_str'=>'', 'fields'=>'`condition_id`'),
687 // Item localisation flags (for allow disable some fields localisation if need)
688 define('ITEM_LOCALE_NAME', 0x01);
689 define('ITEM_LOCALE_DESCRIPTION', 0x02);
690 define('ITEM_LOCALE_ALL', ITEM_LOCALE_NAME | ITEM_LOCALE_DESCRIPTION
);
693 class ItemReportGenerator
extends ReportGenerator
{
694 var $dolocale = ITEM_LOCALE_ALL
;
695 function ItemReportGenerator($type='')
697 global $item_report, $dDB;
699 $this->column_conf
=&$item_report;
700 $this->db_fields
= '`item_template`.`entry`';
702 case 'vendor' : $this->table
= '(`item_template` join `npc_vendor` ON `item_template`.`entry` = `npc_vendor`.`item`)'; break;
703 case 'loot': $this->table
= '(`item_loot_template` right join `item_template` ON `item_template`.`entry` = `item_loot_template`.`entry`)'; break;
704 case 'disenchant':$this->table
= '(`disenchant_loot_template` right join `item_template` ON `item_template`.`DisenchantID` = `disenchant_loot_template`.`entry`)'; break;
705 case 'milling': $this->table
= '(`milling_loot_template` right join `item_template` ON `item_template`.`entry` = `milling_loot_template`.`entry`)'; break;
706 case 'prospect': $this->table
= '(`prospecting_loot_template` right join `item_template` ON `item_template`.`entry` = `prospecting_loot_template`.`entry`)'; break;
707 default: $this->table
= '`item_template`'; break;
710 function disableNameLocalisation() {$this->dolocale
&= ~ITEM_LOCALE_NAME
;}
711 function localiseRequirest($locale, &$tables, &$fields, &$sort_str)
713 $tables .= ' LEFT JOIN `locales_item` ON `item_template`.`entry` = `locales_item`.`entry`';
714 if ($this->dolocale
& ITEM_LOCALE_NAME
)
716 $fields = str_replace('`name`','`name`, `locales_item`.`name_loc'.$locale.'` AS `name_loc`', $fields);
717 $sort_str = str_replace('`name`', '`name_loc`, `name`', $sort_str);
719 if ($this->dolocale
& ITEM_LOCALE_DESCRIPTION
)
721 $fields = str_replace('`description`','`description`, `locales_item`.`description_loc'.$locale."` AS `description_loc`", $fields);
722 $sort_str = str_replace('`description` DESC', '`description_loc` DESC, `name` DESC', $sort_str);
725 function vendorItemList($entry)
727 $this->doRequirest('`npc_vendor`.`entry` = ?d', $entry);
728 $this->removeIfAllZero('sold_count', 'VENDOR_REPORT_COUNT');
729 $this->removeIfAllZero('incrtime', 'VENDOR_REPORT_INCTIME');
731 function useSpell($entry)
733 $this->doRequirest('(`spellid_1` = ?d OR `spellid_2` = ?d OR `spellid_3` = ?d OR `spellid_4` = ?d OR `spellid_5` = ?d) AND `spellid_1` <> 483', $entry, $entry, $entry, $entry, $entry);
735 function recipeSpell($entry)
737 $this->doRequirest('`spellid_1` = 483 AND `spellid_2` = ?d', $entry);
739 function socketBonus($entry)
741 $this->doRequirest('`SocketBonus` = ?d', $entry);
743 function enchantByGems($entry)
746 if ($list = $wDB->selectCol("SELECT `id` FROM `wowd_gemproperties` WHERE `spellitemenchantement` = ?d", $entry))
747 $this->doRequirest('`GemProperties` IN (?a)', $list);
749 function requireReputation($entry)
751 $this->doRequirest('`RequiredReputationFaction` = ?d', $entry);
753 function lootItem($entry)
755 $ref_loot =& getRefrenceItemLoot($entry);
756 $this->doRequirest('(`item` = ?d AND `mincountOrRef` > 0) { OR -`mincountOrRef` IN (?a) } GROUP BY `entry`', $entry, count($ref_loot)==0 ? DBSIMPLE_SKIP
:array_keys($ref_loot));
757 $this->removeIfAllZero('condition_id', 'LOOT_REPORT_REQ');
761 //=================================================================
762 // Spell trainer list report functions and methods
763 //=================================================================
764 function r_trainerCost($data) {echo money($data['spellcost']);}
765 function r_trainerSpell($data)
767 if ($spell = getSpell($data['spell']))
769 if (!r_spellCreate($spell))
773 function r_trainerNSpell($data)
775 if ($spell = getSpell($data['spell']))
777 echo getSpellName($spell);
780 function r_trainerSkill($data) {if ($data['reqskill']) echo getSkillName($data['reqskill']);}
781 function r_trainerValue($data) {if ($data['reqskill']) echo $data['reqskillvalue'];}
782 function r_trainerSkillReq($data){if ($data['reqskill']) echo getSkillName($data['reqskill']).' ('.$data['reqskillvalue'].')';}
783 function r_trainerLevel($data) {echo $data['reqlevel']?
$data['reqlevel']:'';}
785 $train_report = array(
786 'TRAIN_REPORT_LEVEL' =>array('class'=>'small','sort'=>'level','text'=>$lang['trainer_level'], 'draw'=>'r_trainerLevel', 'sort_str'=>'`reqlevel`, `reqskillvalue`', 'fields'=>'`reqlevel`' ),
787 'TRAIN_REPORT_ICON' =>array('class'=>'i_ico', 'sort'=>'', 'text'=>'', 'draw'=>'r_trainerSpell', 'sort_str'=>'', 'fields'=>'`spell`' ),
788 'TRAIN_REPORT_NAME' =>array('class'=>'left', 'sort'=>'spell', 'text'=>$lang['trainer_spell'], 'draw'=>'r_trainerNSpell', 'sort_str'=>'`spell`', 'fields'=>'`spell`' ),
789 'TRAIN_REPORT_COST' =>array('class'=>'cost', 'sort'=>'cost', 'text'=>$lang['trainer_cost'], 'draw'=>'r_trainerCost', 'sort_str'=>'`spellcost`', 'fields'=>'`spellcost`'),
790 'TRAIN_REPORT_SKILL' =>array('class'=>'small','sort'=>'skill','text'=>$lang['trainer_skill'], 'draw'=>'r_trainerSkill', 'sort_str'=>'`reqskill`', 'fields'=>'`reqskill`' ),
791 'TRAIN_REPORT_VALUE' =>array('class'=>'small','sort'=>'value','text'=>$lang['trainer_value'], 'draw'=>'r_trainerValue', 'sort_str'=>'`reqskillvalue`','fields'=>'`reqskillvalue`'),
794 class NPCTrainerReportGenerator
extends ReportGenerator
{
795 // Database depend requirest generator
796 // Select only reuire for report fields from database
797 function NPCTrainerReportGenerator($type='')
799 global $train_report, $dDB;
801 $this->column_conf
=&$train_report;
802 $this->table
= '`npc_trainer`';
803 $this->db_fields
= '`entry`';
805 function trainSpell($entry)
807 $this->doRequirest('`entry` = ?d', $entry);
808 $this->removeIfAllZero('reqlevel', 'TRAIN_REPORT_LEVEL');
809 $this->removeIfAllZero('reqskill', 'TRAIN_REPORT_SKILL');
810 $this->removeIfAllZero('reqskillvalue', 'TRAIN_REPORT_VALUE');
814 //=================================================================
815 // Creature list report functions and methods
816 //=================================================================
817 function r_npcLvl($data)
819 echo $data['maxlevel'];
821 echo '<br><div class=rank>'.getCreatureRank($data['rank']).'</div>';
823 function r_npcName($data)
825 $h = getHeroicList();
826 $h1 = getHeroicList1();
827 $h2 = getHeroicList2();
828 if (isset($h[$data['entry']]))
830 $heroic = getCreature($h[$data['entry']]);
831 $data['name']=$heroic['name'].' (difficulty_1)';
832 $data['name_loc']=$heroic['name'].' (difficulty_1)';
833 $data['subname']=$heroic['subname'];
835 if (isset($h1[$data['entry']]))
837 $heroic = getCreature($h1[$data['entry']]);
838 $data['name']=$heroic['name'].' (difficulty_2)';
839 $data['name_loc']=$heroic['name'].' (difficulty_2)';
840 $data['subname']=$heroic['subname'];
842 if (isset($h2[$data['entry']]))
844 $heroic = getCreature($h2[$data['entry']]);
845 $data['name']=$heroic['name'].' (difficulty_3)';
846 $data['name_loc']=$heroic['name'].' (difficulty_3)';
847 $data['subname']=$heroic['subname'];
849 $name = @$data['name_loc'] ?
$data['name_loc'] : $data['name'];
850 $subname = @$data['subname_loc'] ?
$data['subname_loc'] : $data['subname'];
851 echo '<a href="?npc='.$data['entry'].'">'.($name?
$name:'no name').'</a>';
853 echo '<br><div class=subname><a href="?s=n&subname='.$subname.'"><'.$subname.'></a></div>';
855 function r_npcRName($data)
857 $h = getHeroicList();
858 $h1 = getHeroicList1();
859 $h2 = getHeroicList2();
860 if (isset($h[$data['entry']]))
862 $heroic = getCreature($h[$data['entry']]);
863 $data['name']=$heroic['name'].' (difficulty_1)';
864 $data['name_loc']=$heroic['name'].' (difficulty_1)';
865 $data['subname']=$heroic['subname'];
867 if (isset($h1[$data['entry']]))
869 $heroic = getCreature($h1[$data['entry']]);
870 $data['name']=$heroic['name'].' (difficulty_2)';
871 $data['name_loc']=$heroic['name'].' (difficulty_2)';
872 $data['subname']=$heroic['subname'];
874 if (isset($h2[$data['entry']]))
876 $heroic = getCreature($h2[$data['entry']]);
877 $data['name']=$heroic['name'].' (difficulty_3)';
878 $data['name_loc']=$heroic['name'].' (difficulty_3)';
879 $data['subname']=$heroic['subname'];
881 $name = @$data['name_loc'] ?
$data['name_loc'] : $data['name'];
882 $subname = @$data['subname_loc'] ?
$data['subname_loc'] : $data['subname'];
883 echo '<a href="?npc='.$data['entry'].'">'.($name?
$name:'no name').'</a> <font size=-3>('.getLoyality($data['faction_A']).')</font>';
885 echo '<br><div class=subname><a href="?s=n&subname='.$subname.'"><'.$subname.'></a></div>';
887 function r_npcReact($data) {echo getLoyality($data['faction_A']);}
888 function r_npcMap($data)
891 $h = getHeroicList();
892 $h1 = getHeroicList1();
893 $h2 = getHeroicList2();
895 if (isset($h2[$data['entry']]))
896 echo '<a href="?map&npc='.$h2[$data['entry']].'">'.$lang['map'].'</a>';
898 if (isset($h1[$data['entry']]))
899 echo '<a href="?map&npc='.$h1[$data['entry']].'">'.$lang['map'].'</a>';
901 if (isset($h[$data['entry']]))
902 echo '<a href="?map&npc='.$h[$data['entry']].'">'.$lang['map'].'</a>';
904 echo '<a href="?map&npc='.$data['entry'].'">'.$lang['map'].'</a>';
906 function r_npcRole($data)
908 $flag = $data['npcflag'];
909 if ($flag == 0) {return;}
910 if ($flag&0x00000001) echo '<img src=images/map_points/gossip_icon.png>';
911 if ($flag&0x00000002 && getNpcQuestrelation($data['entry'])) echo '<img src=images/map_points/available_quest_icon.gif>';
912 if ($flag&0x00000002 && getNpcInvolvedrelation($data['entry'])) echo '<img src=images/map_points/active_quest_icon.gif>';
913 if ($flag&0x00000070) echo '<img src=images/map_points/trainer_icon.gif>';
914 if ($flag&0x00000F80) echo '<img src=images/map_points/vendor_icon.gif>';
915 if ($flag&0x00001000) echo '<img src=images/map_points/repair.png>';
916 if ($flag&0x00002000) echo '<img src=images/map_points/taxi_icon.gif>';
917 if ($flag&0x00010000) echo '<img src=images/map_points/inn_icon.png>';
918 if ($flag&0x00820000) echo '<img src=images/map_points/banker_icon.gif>';
919 if ($flag&0x00100000) echo '<img src=images/map_points/battle_master_icon.gif>';
920 if ($flag&0x00200000) echo '<img src=images/map_points/banker_icon.gif>';
921 if ($flag&0x000C0000) echo '<img src=images/map_points/tabard_icon.gif>';
923 define('UNIT_NPC_FLAG_SPIRITHEALER', 0x00004000);
924 define('UNIT_NPC_FLAG_SPIRITGUIDE', 0x00008000);
925 define('UNIT_NPC_FLAG_STABLEMASTER', 0x00400000);*/
927 function r_OnKillRep($data)
929 $creature_rate1 = getCreatureRewRate($data['RewOnKillRepFaction1']);
930 $creature_rate2 = getCreatureRewRate($data['RewOnKillRepFaction2']);
931 if ($data['RewOnKillRepFaction1'])
933 echo ($data['RewOnKillRepValue1']>0?
'+':'').$data['RewOnKillRepValue1']*$creature_rate1.' '.getFactionName($data['RewOnKillRepFaction1']).' ('.getReputationRankName($data['MaxStanding1']).')';
934 $spillover=getRepSpillover($data['RewOnKillRepFaction1']);
936 foreach ($spillover as $faction)
938 if ($faction['faction1'])
939 echo '<br>'.($data['RewOnKillRepValue1']>0?
'+':'').$data['RewOnKillRepValue1']*$creature_rate1*$faction['rate_1'].' '.getFactionName($faction['faction1']).' ('.getReputationRankName($data['MaxStanding1']).')';
940 if ($faction['faction2'])
941 echo '<br>'.($data['RewOnKillRepValue1']>0?
'+':'').$data['RewOnKillRepValue1']*$creature_rate1*$faction['rate_2'].' '.getFactionName($faction['faction2']).' ('.getReputationRankName($data['MaxStanding1']).')';
942 if ($faction['faction3'])
943 echo '<br>'.($data['RewOnKillRepValue1']>0?
'+':'').$data['RewOnKillRepValue1']*$creature_rate1*$faction['rate_3'].' '.getFactionName($faction['faction3']).' ('.getReputationRankName($data['MaxStanding1']).')';
944 if ($faction['faction4'])
945 echo '<br>'.($data['RewOnKillRepValue1']>0?
'+':'').$data['RewOnKillRepValue1']*$creature_rate1*$faction['rate_4'].' '.getFactionName($faction['faction4']).' ('.getReputationRankName($data['MaxStanding1']).')';
948 if ($data['RewOnKillRepFaction2'])
950 if ($data['RewOnKillRepFaction1'] == 0)
951 echo ($data['RewOnKillRepValue2']>0?
'+':'').$data['RewOnKillRepValue2']*$creature_rate2.' '.getFactionName($data['RewOnKillRepFaction2']).' ('.getReputationRankName($data['MaxStanding2']).')';
953 echo '<br>'.($data['RewOnKillRepValue2']>0?
'+':'').$data['RewOnKillRepValue2']*$creature_rate2.' '.getFactionName($data['RewOnKillRepFaction2']).' ('.getReputationRankName($data['MaxStanding2']).')';
954 $spillover=getRepSpillover($data['RewOnKillRepFaction2']);
956 foreach ($spillover as $faction)
958 if ($faction['faction1'])
959 echo '<br>'.($data['RewOnKillRepValue2']>0?
'+':'').$data['RewOnKillRepValue2']*$creature_rate2*$faction['rate_1'].' '.getFactionName($faction['faction1']).' ('.getReputationRankName($data['MaxStanding2']).')';
960 if ($faction['faction2'])
961 echo '<br>'.($data['RewOnKillRepValue2']>0?
'+':'').$data['RewOnKillRepValue2']*$creature_rate2*$faction['rate_2'].' '.getFactionName($faction['faction2']).' ('.getReputationRankName($data['MaxStanding2']).')';
962 if ($faction['faction3'])
963 echo '<br>'.($data['RewOnKillRepValue2']>0?
'+':'').$data['RewOnKillRepValue2']*$creature_rate2*$faction['rate_3'].' '.getFactionName($faction['faction3']).' ('.getReputationRankName($data['MaxStanding2']).')';
964 if ($faction['faction4'])
965 echo '<br>'.($data['RewOnKillRepValue2']>0?
'+':'').$data['RewOnKillRepValue2']*$creature_rate2*$faction['rate_4'].' '.getFactionName($faction['faction4']).' ('.getReputationRankName($data['MaxStanding2']).')';
969 // NPC report generator config
971 'NPC_REPORT_LEVEL' =>array('class'=>'small','sort'=>'level','text'=>$lang['creature_level'], 'draw'=>'r_npcLvl', 'sort_str'=>'`maxlevel` DESC, `name`', 'fields'=>'`maxlevel`, `rank`'),
972 'NPC_REPORT_RANK' =>array('class'=>'small','sort'=>'rank', 'text'=>$lang['creature_level'], 'draw'=>'r_npcLvl', 'sort_str'=>'`rank` DESC, `maxlevel` DESC, `name`', 'fields'=>'`maxlevel`, `rank`'),
973 'NPC_REPORT_NAME' =>array('class'=>'left', 'sort'=>'name', 'text'=>$lang['creature_name'], 'draw'=>'r_npcName', 'sort_str'=>'`name`', 'fields'=>'`name`, `subname`'),
974 'NPC_REPORT_RNAME' =>array('class'=>'left', 'sort'=>'name', 'text'=>$lang['creature_name'], 'draw'=>'r_npcRName','sort_str'=>'`name`', 'fields'=>'`name`, `subname`, `faction_A`'),
975 'NPC_REPORT_REACTION'=>array('class'=>'small','sort'=>'', 'text'=>$lang['creature_react'], 'draw'=>'r_npcReact','sort_str'=>'', 'fields'=>'`faction_A`'),
976 'NPC_REPORT_ROLE' =>array('class'=>'', 'sort'=>'role', 'text'=>$lang['creature_role'], 'draw'=>'r_npcRole', 'sort_str'=>'`npcflag` DESC', 'fields'=>'`npcflag`'),
977 'NPC_REPORT_MAP' =>array('class'=>'small','sort'=>'', 'text'=>$lang['map'], 'draw'=>'r_npcMap', 'sort_str'=>'', 'fields'=>''),
979 'VENDOR_REPORT_COST' =>array('class'=>'', 'sort'=>'cost', 'text'=>$lang['item_cost'], 'draw'=>'r_vendorCost', 'sort_str'=>'`ExtendedCost`, `name`', 'fields'=>'`ExtendedCost`'),
980 'VENDOR_REPORT_COUNT' =>array('class'=>'', 'sort'=>'count','text'=>$lang['item_count'], 'draw'=>'r_vendorCount','sort_str'=>'`sold_count`, `name`', 'fields'=>'`npc_vendor`.`maxcount` AS `sold_count`'),
981 'VENDOR_REPORT_INCTIME'=>array('class'=>'', 'sort'=>'time', 'text'=>$lang['item_incrtime'], 'draw'=>'r_vendorTime', 'sort_str'=>'`incrtime`, `name`', 'fields'=>'`incrtime`'),
983 'TRAINER_REPORT_COST' =>array('class'=>'', 'sort'=>'scost', 'text'=>$lang['trainer_cost'], 'draw'=>'r_trainerCost', 'sort_str'=>'`spellcost`', 'fields'=>'`spellcost`'),
984 'TRAINER_REPORT_SPELL'=>array('class'=>'left','sort'=>'', 'text'=>$lang['trainer_spell'],'draw'=>'r_trainerSpell','sort_str'=>'', 'fields'=>'`spell`'),
985 'TRAINER_REPORT_SKILL'=>array('class'=>'', 'sort'=>'skill', 'text'=>$lang['trainer_skill'],'draw'=>'r_trainerSkillReq','sort_str'=>'`reqskill`, `reqskillvalue`','fields'=>'`reqskill`, `reqskillvalue`'),
986 'TRAINER_REPORT_LEVEL'=>array('class'=>'', 'sort'=>'slevel','text'=>$lang['trainer_level'],'draw'=>'r_trainerLevel','sort_str'=>'`reqlevel`', 'fields'=>'`reqlevel`'),
988 'LOOT_REPORT_CHANCE'=>array('class'=>'', 'sort'=>'chance', 'text'=>$lang['loot_chance'], 'draw'=>'r_lootChance', 'sort_str'=>'ABS(`ChanceOrQuestChance`) DESC, `name`', 'fields'=>'`ChanceOrQuestChance`, `mincountOrRef`'),
989 'LOOT_REPORT_REQ' =>array('class'=>'', 'sort'=>'', 'text'=>$lang['loot_require'],'draw'=>'r_lootRequire','sort_str'=>'', 'fields'=>'`condition_id`'),
991 'ONKILL_REPUTATION' =>array('class'=>'left', 'sort'=>'rep','text'=>$lang['onkill_rep'],'draw'=>'r_OnKillRep','sort_str'=>'`RewOnKillRepValue1` DESC, `RewOnKillRepValue2` DESC', 'fields'=>'`RewOnKillRepFaction1`, `RewOnKillRepValue1`, `MaxStanding1`, `RewOnKillRepValue2`, `RewOnKillRepFaction2`, `MaxStanding2`'),
994 define('NPC_LOCALE_NAME', 0x01);
995 define('NPC_LOCALE_SUBNAME', 0x02);
996 define('NPC_LOCALE_ALL', NPC_LOCALE_NAME | NPC_LOCALE_SUBNAME
);
998 // Creature report class
999 class CreatureReportGenerator
extends ReportGenerator
{
1000 var $dolocale = NPC_LOCALE_ALL
;
1001 function CreatureReportGenerator($type = '')
1003 global $npc_report, $dDB;
1005 $this->column_conf
=&$npc_report;
1006 $this->db_fields
= '`creature_template`.`entry`';
1008 case 'vendor': $this->table
= '(`creature_template` join `npc_vendor` ON `creature_template`.`entry` = `npc_vendor`.`entry`)'; break;
1009 case 'trainer':$this->table
= '(`creature_template` join `npc_trainer` ON `creature_template`.`entry` = `npc_trainer`.`entry`)'; break;
1010 case 'loot': $this->table
= '(`creature_template` join `creature_loot_template` ON `creature_template`.`lootid` = `creature_loot_template`.`entry`)'; break;
1011 case 'pick': $this->table
= '(`creature_template` join `pickpocketing_loot_template` ON `creature_template`.`pickpocketloot` = `pickpocketing_loot_template`.`entry`)'; break;
1012 case 'skin': $this->table
= '(`creature_template` join `skinning_loot_template` ON `creature_template`.`skinloot` = `skinning_loot_template`.`entry`)'; break;
1013 case 'position':$this->table
='(`creature_template` join `creature` ON `creature_template`.`entry` = `creature`.`id`)'; break;
1014 case 'reputation':$this->table
='(`creature_template` join `creature_onkill_reputation` ON `creature_template`.`entry` = `creature_onkill_reputation`.`creature_id`)'; break;
1015 default: $this->table
= '`creature_template`'; break;
1018 function disableNameLocalisation() {$this->dolocale
&= ~NPC_LOCALE_NAME
;}
1019 function disableSubnameLocalisation() {$this->dolocale
&= ~NPC_LOCALE_SUBNAME
;}
1020 function localiseRequirest($locale, &$tables, &$fields, &$sort_str)
1022 $tables.=' LEFT JOIN `locales_creature` ON `creature_template`.`entry` = `locales_creature`.`entry`';
1023 if ($this->dolocale
& NPC_LOCALE_NAME
)
1025 $fields = str_replace('`name`','`name`, `locales_creature`.`name_loc'.$locale.'` AS `name_loc`', $fields);
1026 $sort_str = str_replace('`name`','`name_loc`, `name`', $sort_str);
1028 if ($this->dolocale
& NPC_LOCALE_SUBNAME
)
1030 $fields = str_replace('`subname`','`subname`, `locales_creature`.`subname_loc'.$locale.'` AS `subname_loc`', $fields);
1031 $sort_str = str_replace('`subname`','`subname_loc`, `subname`', $sort_str);
1034 function castSpell($entry)
1037 $rows_1 = $dDB->selectCol('SELECT `entry` FROM `creature_template_spells` WHERE `spell1` = ?d OR `spell2` = ?d OR `spell3` = ?d OR `spell4` = ?d OR `spell5` = ?d OR `spell6` = ?d OR `spell7` = ?d OR `spell8` = ?d', $entry, $entry, $entry, $entry, $entry, $entry, $entry, $entry);
1038 $rows_2 = $dDB->selectCol('SELECT `creature_id` FROM `creature_ai_scripts` WHERE (`action1_type` = 11 AND `action1_param1`=?d) OR (`action2_type` = 11 AND `action2_param1`=?d) OR (`action3_type` = 11 AND `action3_param1`=?d)', $entry, $entry, $entry);
1039 $casters = array_unique(array_merge($rows_1, $rows_2));
1040 if (count($casters))
1041 $this->doRequirest('`creature_template`.`entry` in (?a)', $casters);
1043 function inFaction($entry)
1046 if ($templatesId =& getFactionTemplates($entry))
1047 $this->doRequirest('`faction_A` in (?a) OR `faction_H` in (?a)', $templatesId, $templatesId);
1049 function soldItem($entry, $price)
1051 $this->db_fields
.=', '.$price.' AS `BuyPrice`';
1052 $this->doRequirest('`item` = ?d', $entry);
1053 $this->removeIfAllZero('sold_count', 'VENDOR_REPORT_COUNT');
1054 $this->removeIfAllZero('incrtime', 'VENDOR_REPORT_INCTIME');
1056 function trainSpell($entry)
1058 $this->doRequirest('`spell` = ?d', $entry);
1059 $this->removeIfAllZero('reqskill', 'TRAINER_REPORT_SKILL');
1061 function kreditGroup($entry)
1063 $this->doRequirest('`KillCredit1` = ?d OR `KillCredit2` = ?d', $entry, $entry);
1065 function lootItem($entry)
1067 $ref_loot =& getRefrenceItemLoot($entry);
1068 $this->doRequirest('(`item` = ?d AND `mincountOrRef` > 0) { OR -`mincountOrRef` IN (?a) } GROUP BY `entry`', $entry, count($ref_loot)==0 ? DBSIMPLE_SKIP
:array_keys($ref_loot));
1069 $this->removeIfAllZero('condition_id', 'LOOT_REPORT_REQ');
1072 function onMap($entry)
1074 $this->doRequirest('`map` = ?d GROUP BY `id`', $entry);
1076 function onArea($area_data)
1078 $this->setManualPagenateMode();
1079 $this->addFieldsRequirest('`map`, `position_x`, `position_y`, `position_z`');
1080 $this->doRequirest('`map` = ?d AND `position_x` > ?d AND `position_x` < ?d AND `position_y` > ?d AND `position_y` < ?d', $area_data[0], $area_data[5], $area_data[4], $area_data[3], $area_data[2]);
1082 foreach($this->data_array
as $id=>$c)
1084 $zone = getZoneFromPoint($c['map'], $c['position_x'], $c['position_y'], $c['position_z']);
1085 if ($zone!=$area_data[1] ||
isset($setId[$c['entry']]))
1086 unset($this->data_array
[$id]);
1088 $setId[$c['entry']] = 1;
1092 function rewardFactionReputation($id)
1094 $this->doRequirest('`RewOnKillRepFaction1` = ?d OR `RewOnKillRepFaction2` = ?d', $id, $id);
1096 function rewardNpcFactionReputation($entry)
1098 $this->doRequirest('`creature_id` = ?d', $entry);
1102 //=================================================================
1103 // Gameobject list report functions and methods
1104 //=================================================================
1105 function r_objName($data)
1107 $name = @$data['name_loc'] ?
$data['name_loc'] : $data['name'];
1108 echo '<a href="?object='.$data['entry'].'">'.($name?
$name:'no name').'</a>';
1110 function r_objType($data) {echo getGameobjectType($data['type'], 0);}
1111 function r_objMap($data) {global $lang; echo '<a href="?map&obj='.$data['entry'].'">'.$lang['map'].'</a>';}
1113 // GO report generator config
1115 'GO_REPORT_NAME' =>array('class'=>'left', 'sort'=>'name', 'text'=>$lang['go_name'], 'draw'=>'r_objName', 'sort_str'=>'`name`', 'fields'=>'`name`'),
1116 'GO_REPORT_TYPE' =>array('class'=>'', 'sort'=>'type', 'text'=>$lang['go_type'], 'draw'=>'r_objType', 'sort_str'=>'`type`', 'fields'=>'`type`'),
1117 'GO_REPORT_MAP' =>array('class'=>'small','sort'=>'', 'text'=>$lang['map'], 'draw'=>'r_objMap', 'sort_str'=>'', 'fields'=>''),
1119 'LOOT_REPORT_CHANCE'=>array('class'=>'', 'sort'=>'chance', 'text'=>$lang['loot_chance'], 'draw'=>'r_lootChance', 'sort_str'=>'ABS(`ChanceOrQuestChance`) DESC, `name`', 'fields'=>'`ChanceOrQuestChance`, `mincountOrRef`'),
1120 'LOOT_REPORT_REQ' =>array('class'=>'', 'sort'=>'', 'text'=>$lang['loot_require'],'draw'=>'r_lootRequire','sort_str'=>'', 'fields'=>'`condition_id`'),
1123 define('GO_LOCALE_NAME', 0x01);
1124 define('GO_LOCALE_ALL', NPC_LOCALE_NAME
);
1127 class GameobjectReportGenerator
extends ReportGenerator
{
1128 var $dolocale = GO_LOCALE_ALL
;
1129 function GameobjectReportGenerator($type = '')
1131 global $go_report, $dDB;
1133 $this->column_conf
=&$go_report;
1134 $this->db_fields
= '`gameobject_template`.`entry`';
1138 '(`gameobject_template`
1140 `gameobject_loot_template`
1142 `gameobject_template`.`data1` = `gameobject_loot_template`.`entry` AND
1143 `gameobject_template`.`type` IN (3, 17, 25))';
1145 case 'position':$this->table
='(`gameobject_template` join `gameobject` ON `gameobject_template`.`entry` = `gameobject`.`id`)';break;
1146 default: $this->table
= '`gameobject_template`';break;
1149 function disableNameLocalisation() {$this->dolocale
&= ~GO_LOCALE_NAME
;}
1150 function localiseRequirest($locale, &$tables, &$fields, &$sort_str)
1152 $tables.= ' LEFT JOIN `locales_gameobject` ON `gameobject_template`.`entry` = `locales_gameobject`.`entry`';
1153 if ($this->dolocale
& GO_LOCALE_NAME
)
1155 $fields = str_replace('`name`', '`name`, `locales_gameobject`.`name_loc'.$locale.'` AS `name_loc`', $fields);
1156 $sort_str= str_replace('`name`', '`name_loc`, `name`', $sort_str);
1158 $fields = str_replace('`castbarcaption`','`castbarcaption`, `locales_gameobject`.`castbarcaption_loc'.$locale.'` AS `castbarcaption_loc`', $fields);
1160 function castSpell($entry)
1163 '(`type` = ?d AND `data3` = ?d) OR
1164 (`type` = ?d AND `data10` = ?d) OR
1165 (`type` = ?d AND `data1` = ?d) OR
1166 (`type` = ?d AND `data0` = ?d) OR
1167 (`type` = ?d AND (`data2` = ?d OR `data3` = ?d))',
1168 GAMEOBJECT_TYPE_TRAP
, $entry,
1169 GAMEOBJECT_TYPE_GOOBER
, $entry,
1170 GAMEOBJECT_TYPE_SUMMONING_RITUAL
, $entry,
1171 GAMEOBJECT_TYPE_SPELLCASTER
, $entry,
1172 GAMEOBJECT_TYPE_AURA_GENERATOR
, $entry, $entry);
1174 function inFaction($entry)
1177 if ($templatesId =& getFactionTemplates($entry))
1178 $this->doRequirest('`faction` in (?a)', $templatesId);
1180 function spellFocus($entry)
1182 $this->doRequirest('`type` = ?d AND `data0` = ?d', GAMEOBJECT_TYPE_SPELL_FOCUS
, $entry);
1184 function lootItem($entry)
1186 $ref_loot =& getRefrenceItemLoot($entry);
1187 $this->doRequirest('(`item` = ?d AND `mincountOrRef` > 0) { OR -`mincountOrRef` IN (?a) } GROUP BY `entry`', $entry, count($ref_loot)==0 ? DBSIMPLE_SKIP
:array_keys($ref_loot));
1188 $this->removeIfAllZero('condition_id', 'LOOT_REPORT_REQ');
1191 function onMap($entry)
1193 $this->doRequirest('`map` = ?d GROUP BY `id`', $entry);
1195 function onArea($area_data)
1197 $this->setManualPagenateMode();
1198 $this->addFieldsRequirest('`map`, `position_x`, `position_y`, `position_z`');
1199 $this->doRequirest('`map` = ?d AND `position_x` > ?d AND `position_x` < ?d AND `position_y` > ?d AND `position_y` < ?d', $area_data[0], $area_data[5], $area_data[4], $area_data[3], $area_data[2]);
1201 foreach($this->data_array
as $id=>$c)
1203 $zone = getZoneFromPoint($c['map'], $c['position_x'], $c['position_y'], $c['position_z']);
1204 if ($zone!=$area_data[1] ||
isset($setId[$c['entry']]))
1205 unset($this->data_array
[$id]);
1207 $setId[$c['entry']] = 1;
1212 //=================================================================
1213 // Quest list report functions and methods
1214 //=================================================================
1215 function r_questLvl($data) {echo $data['QuestLevel']; if ($data['Type']) echo '<br><FONT size=-3><b>'.getQuestType($data['Type']).'</b></FONT>';}
1216 function r_questReqLvl($data) {echo $data['MinLevel'];}
1217 function r_questName($data)
1220 $name = @$data['Title_loc']?
$data['Title_loc']:$data['Title'];
1221 if (getAllowableRace($data['RequiredRaces']) && ($data['RequiredRaces'] & 1101) && ($data['RequiredRaces'] !=1791))
1222 echo "<img width=22 height=22 src='images/player_info/factions_img/alliance.gif'> ";
1223 if (getAllowableRace($data['RequiredRaces']) && ($data['RequiredRaces'] & 690) && ($data['RequiredRaces'] !=1791))
1224 echo "<img width=22 height=22 src='images/player_info/factions_img/horde.gif'> ";
1225 echo '<a href="?quest='.$data['entry'].'">'.($name?
$name:'no name').'</a><br>';
1226 if ($data['ZoneOrSort']>0)
1227 echo '<div class=areaname><a href="?s=q&ZoneID='.$data['ZoneOrSort'].'">'.getAreaName($data['ZoneOrSort']).'</a></div>';
1229 if ($data['ZoneOrSort']<0 AND ((-$data['ZoneOrSort']) >= 374 OR (-$data['ZoneOrSort']) == 221 OR (-$data['ZoneOrSort']) == 241 OR ((-$data['ZoneOrSort']) >= 344 AND (-$data['ZoneOrSort']) < 371) or
1230 (-$data['ZoneOrSort']) == 284 OR (-$data['ZoneOrSort']) == 25 OR (-$data['ZoneOrSort']) == 41 OR (-$data['ZoneOrSort']) < 24))
1231 echo '<div class=areaname><a href="?s=q&SortID='.(-$data['ZoneOrSort']).'">'.getQuestSort(-$data['ZoneOrSort']).'</a></div>';
1232 if ($data['RequiredClasses'])
1233 echo '<div class=classqname>'.getQAllowableClass($data['RequiredClasses']).'</div>';
1234 if ($data['RequiredSkill'])
1235 echo '<div class=areaname><a href="?s=q&SkillID='.($data['RequiredSkill']).'">'.getSkillName($data['RequiredSkill'], 0).'('.$data['RequiredSkillValue'].')</a></div>';
1236 if ($data['SpecialFlags'] & QUEST_SPECIAL_FLAG_MONTHLY
)
1237 echo '<div class=areaname><a href="?s=q&Sfm='.($data['SpecialFlags']).'">'.$lang['quest_type3'].'</a></div>';
1238 if ($data['QuestFlags'] & QUEST_FLAGS_WEEKLY
)
1239 echo '<div class=areaname><a href="?s=q&Sfw='.($data['QuestFlags']).'">'.$lang['quest_type2'].'</a></div>';
1240 if ($data['QuestFlags'] & QUEST_FLAGS_DAILY
)
1241 echo '<div class=areaname><a href="?s=q&Sfd='.($data['QuestFlags']).'">'.$lang['quest_type1'].'</a></div>';
1242 if (($data['SpecialFlags'] & QUEST_SPECIAL_FLAG_REPEATABLE
) && (($data['SpecialFlags'] & QUEST_SPECIAL_FLAG_MONTHLY
) ==0) && ($data['QuestFlags'] & (QUEST_FLAGS_DAILY | QUEST_FLAGS_WEEKLY
)) == 0)
1243 echo '<div class=areaname><a href="?s=q&Sfr='.($data['SpecialFlags']).'">'.$lang['quest_type0'].'</a></div>';
1245 function r_questRelation($data)
1248 // Search creature quest giver
1249 if ($src = $dDB->select(
1250 'SELECT `entry`, `name`, `subname`, `faction_A`
1251 FROM `creature_template` left join `creature_questrelation` ON `creature_template`.`entry` = `creature_questrelation`.`id`
1252 WHERE `creature_questrelation`.`quest` = ?d', $data['entry']))
1254 foreach ($src as $creature){localiseCreature($creature);r_npcRName($creature);}
1257 // Search GO quest giver
1258 if ($src = $dDB->select(
1259 'SELECT `entry`, `name`
1260 FROM `gameobject_template` left join `gameobject_questrelation` ON `gameobject_template`.`entry` = `gameobject_questrelation`.`id`
1261 WHERE `gameobject_questrelation`.`quest` = ?d', $data['entry']))
1263 foreach ($src as $go) {localiseGameobject($go); r_objName($go);}
1266 // Search item quest giver
1267 if ($src = $dDB->select("SELECT `entry`, `name`, `Quality` FROM `item_template` WHERE `startquest` = ?d", $data['entry']))
1269 foreach ($src as $item) {localiseItem($item);r_itemName($item);}
1274 function r_questInvolvedrelation($data)
1277 // Search creature quest giver
1278 if ($src = $dDB->select(
1279 'SELECT `entry`, `name`, `subname`, `faction_A`
1280 FROM `creature_template` left join `creature_involvedrelation` ON `creature_template`.`entry` = `creature_involvedrelation`.`id`
1281 WHERE `creature_involvedrelation`.`quest` = ?d', $data['entry']))
1283 foreach ($src as $creature){localiseCreature($creature);r_npcRName($creature);}
1286 // Search GO quest giver
1287 if ($src = $dDB->select(
1288 'SELECT `entry`, `name`
1289 FROM `gameobject_template` left join `gameobject_involvedrelation` ON `gameobject_template`.`entry` = `gameobject_involvedrelation`.`id`
1290 WHERE `gameobject_involvedrelation`.`quest` = ?d', $data['entry']))
1292 foreach ($src as $go) {localiseGameobject($go); r_objName($go);}
1297 function r_questReward($quest)
1300 if ($quest['RewItemId1'] OR $quest['RewItemId2'] OR $quest['RewItemId3'] OR $quest['RewItemId4'])
1302 // echo $lang['Rew_item'].'<br>';
1303 if ($quest['RewItemId1']) echo text_show_item($quest['RewItemId1'], 0, 'quest');
1304 if ($quest['RewItemId2']) echo $lang['item_sel_and'].text_show_item($quest['RewItemId2'], 0, 'quest');
1305 if ($quest['RewItemId3']) echo $lang['item_sel_and'].text_show_item($quest['RewItemId3'], 0, 'quest');
1306 if ($quest['RewItemId4']) echo $lang['item_sel_and'].text_show_item($quest['RewItemId4'], 0, 'quest');
1309 if ($quest['RewChoiceItemId1'] OR $quest['RewChoiceItemId2'] OR $quest['RewChoiceItemId3'] OR
1310 $quest['RewChoiceItemId4'] OR $quest['RewChoiceItemId5'] OR $quest['RewChoiceItemId6'])
1312 echo $lang['Rew_select_item'].'<br>';
1313 if ($quest['RewChoiceItemId1']) echo text_show_item($quest['RewChoiceItemId1'], 0, 'quest');
1314 if ($quest['RewChoiceItemId2']) echo $lang['item_sel_or'].text_show_item($quest['RewChoiceItemId2'], 0, 'quest');
1315 if ($quest['RewChoiceItemId3']) echo $lang['item_sel_or'].text_show_item($quest['RewChoiceItemId3'], 0, 'quest');
1316 if ($quest['RewChoiceItemId4']) echo $lang['item_sel_or'].text_show_item($quest['RewChoiceItemId4'], 0, 'quest');
1317 if ($quest['RewChoiceItemId5']) echo $lang['item_sel_or'].text_show_item($quest['RewChoiceItemId5'], 0, 'quest');
1318 if ($quest['RewChoiceItemId6']) echo $lang['item_sel_or'].text_show_item($quest['RewChoiceItemId6'], 0, 'quest');
1321 if ($quest['RewSpell'] AND $quest['RewSpellCast'])
1323 show_spell($quest['RewSpell'], 0, 'quest');
1326 if (!$quest['RewSpell'] AND $quest['RewSpellCast'])
1328 show_spell($quest['RewSpellCast'], 0, 'quest');
1331 for ($i = 1; $i <= 5; $i++
)
1333 switch (ABS($quest['RewRepValueId'.$i])):
1334 case 1: $RepValueId[$i] = 10; break;
1335 case 2: $RepValueId[$i] = 25; break;
1336 case 3: $RepValueId[$i] = 75; break;
1337 case 4: $RepValueId[$i] = 150; break;
1338 case 5: $RepValueId[$i] = 250; break;
1339 case 6: $RepValueId[$i] = 350; break;
1340 case 7: $RepValueId[$i] = 500; break;
1341 case 8: $RepValueId[$i] = 1000; break;
1342 case 9: $RepValueId[$i] = 5; break;
1343 default: $RepValueId[$i] = 0;
1346 $quest_rate[$i] = getRepRewRate($quest['RewRepFaction'.$i]);
1348 if ($quest['RewRepValueId'.$i] < 0)
1349 $RepValueId[$i] = -$RepValueId[$i];
1351 if ($quest['RewRepValue'.$i] && $quest['RewRepValueId'.$i])
1352 $quest['RewRepValue'.$i] = $quest['RewRepValue'.$i]/100;
1354 if (!$quest['RewRepValue'.$i] && $quest['RewRepValueId'.$i])
1355 $quest['RewRepValue'.$i] = $RepValueId[$i];
1357 $quest['RewRepValue'.$i]=$quest['RewRepValue'.$i]*$quest_rate[$i];
1360 if ($quest['RewRepFaction1'] AND !$quest['RewRepFaction2'] AND
1361 !$quest['RewRepFaction3'] AND !$quest['RewRepFaction4'] AND
1362 !$quest['RewRepFaction5'])
1364 $spillover=getRepSpillover($quest['RewRepFaction1']);
1366 foreach ($spillover as $faction)
1368 if ($faction['faction1'])
1370 $quest['RewRepFaction2']=$faction['faction1'];
1371 $quest['RewRepValue2']=$quest['RewRepValue1']*$faction['rate_1'];
1373 if ($faction['faction2'])
1375 $quest['RewRepFaction3']=$faction['faction2'];
1376 $quest['RewRepValue3']=$quest['RewRepValue1']*$faction['rate_2'];
1378 if ($faction['faction3'])
1380 $quest['RewRepFaction4']=$faction['faction3'];
1381 $quest['RewRepValue4']=$quest['RewRepValue1']*$faction['rate_3'];
1383 if ($faction['faction4'])
1385 $quest['RewRepFaction5']=$faction['faction4'];
1386 $quest['RewRepValue5']=$quest['RewRepValue1']*$faction['rate_4'];
1391 if ($quest['RewRepFaction1'] && $quest['RewRepValue1'])echo getFactionName($quest['RewRepFaction1']).': '.$quest['RewRepValue1'].'<br>';
1392 if ($quest['RewRepFaction2'] && $quest['RewRepValue2'])echo getFactionName($quest['RewRepFaction2']).': '.$quest['RewRepValue2'].'<br>';
1393 if ($quest['RewRepFaction3'] && $quest['RewRepValue3'])echo getFactionName($quest['RewRepFaction3']).': '.$quest['RewRepValue3'].'<br>';
1394 if ($quest['RewRepFaction4'] && $quest['RewRepValue4'])echo getFactionName($quest['RewRepFaction4']).': '.$quest['RewRepValue4'].'<br>';
1395 if ($quest['RewRepFaction5'] && $quest['RewRepValue5'])echo getFactionName($quest['RewRepFaction5']).': '.$quest['RewRepValue5'].'<br>';
1396 if ($quest['RewMoneyMaxLevel'])
1397 echo $lang['Rew_XP'].' '.getQuestXPValue($quest).' xp<br>';
1398 if ($quest['RewOrReqMoney'])
1399 echo $lang['Rew_money'].' '.money($quest['RewOrReqMoney'], 7).'<br>';
1402 $quest_reward_fields =
1403 '`RewXPId`, `RewChoiceItemId1`, `RewChoiceItemId2`, `RewChoiceItemId3`, `RewChoiceItemId4`, `RewChoiceItemId5`, `RewChoiceItemId6`,
1404 `RewChoiceItemCount1`, `RewChoiceItemCount2`, `RewChoiceItemCount3`, `RewChoiceItemCount4`, `RewChoiceItemCount5`, `RewChoiceItemCount6`,
1405 `RewItemId1`, `RewItemId2`, `RewItemId3`, `RewItemId4`, `RewItemCount1`, `RewItemCount2`, `RewItemCount3`, `RewItemCount4`,
1406 `RewRepFaction1`, `RewRepFaction2`, `RewRepFaction3`, `RewRepFaction4`, `RewRepFaction5`,
1407 `RewRepValue1`, `RewRepValue2`, `RewRepValue3`, `RewRepValue4`, `RewRepValue5`,
1408 `RewRepValueId1`, `RewRepValueId2`, `RewRepValueId3`, `RewRepValueId4`, `RewRepValueId5`,
1409 `RewOrReqMoney`, `RewMoneyMaxLevel`, `RewSpell`, `RewSpellCast`, `RewMailTemplateId`, `RewMailDelaySecs`';
1411 $quest_report = array(
1412 'QUEST_REPORT_LEVEL' =>array('class'=>'small','sort'=>'level', 'text'=>$lang['quest_lvl'], 'draw'=>'r_questLvl', 'sort_str'=>'`QuestLevel` DESC', 'fields'=>'`QuestLevel`, `Type`'),
1413 'QUEST_REPORT_REQLEVEL'=>array('class'=>'small','sort'=>'req_lvl','text'=>$lang['quest_reqlvl'], 'draw'=>'r_questReqLvl','sort_str'=>'`MinLevel` DESC', 'fields'=>'`MinLevel`'),
1414 'QUEST_REPORT_NAME' =>array('class'=>'left', 'sort'=>'name', 'text'=>$lang['quest_name'], 'draw'=>'r_questName', 'sort_str'=>'`Title`', 'fields'=>'`Title`, `ZoneOrSort`, `RequiredSkill`, `RequiredSkillValue`, `RequiredClasses`, `RequiredRaces`, `QuestFlags`, `SpecialFlags`'),
1415 'QUEST_REPORT_GIVER' =>array('class'=>'left', 'sort'=>'', 'text'=>$lang['quest_giver'], 'draw'=>'r_questRelation', 'sort_str'=>'', 'fields'=>''),
1416 'QUEST_REPORT_GIVER_END'=>array('class'=>'left', 'sort'=>'', 'text'=>$lang['quest_giver_end'], 'draw'=>'r_questInvolvedrelation', 'sort_str'=>'', 'fields'=>''),
1417 'QUEST_REPORT_REWARD' =>array('class'=>'full', 'sort'=>'reward', 'text'=>$lang['quest_rewards'], 'draw'=>'r_questReward','sort_str'=>'`RewMoneyMaxLevel` DESC','fields'=>&$quest_reward_fields),
1419 'LOOT_REPORT_CHANCE'=>array('class'=>'', 'sort'=>'chance', 'text'=>$lang['loot_chance'], 'draw'=>'r_lootChance', 'sort_str'=>'ABS(`ChanceOrQuestChance`) DESC, `Title`', 'fields'=>'`ChanceOrQuestChance`, `mincountOrRef`'),
1420 'LOOT_REPORT_REQ' =>array('class'=>'', 'sort'=>'', 'text'=>$lang['loot_require'],'draw'=>'r_lootRequire','sort_str'=>'', 'fields'=>'`condition_id`'),
1423 define('QUEST_LOCALE_NAME', 0x01);
1424 define('QUEST_LOCALE_ALL', NPC_LOCALE_NAME
);
1426 // Quest report class
1427 class QuestReportGenerator
extends ReportGenerator
{
1428 var $dolocale = QUEST_LOCALE_ALL
;
1429 function QuestReportGenerator($type='')
1431 global $quest_report, $dDB;
1433 $this->column_conf
=&$quest_report;
1435 case 'go_giver': $this->table
= '(`quest_template` join `gameobject_questrelation` ON `quest_template`.`entry` = `gameobject_questrelation`.`quest`)';break;
1436 case 'go_take': $this->table
= '(`quest_template` join `gameobject_involvedrelation` ON `quest_template`.`entry` = `gameobject_involvedrelation`.`quest`)';break;
1437 case 'npc_giver': $this->table
= '(`quest_template` join `creature_questrelation` ON `quest_template`.`entry` = `creature_questrelation`.`quest`)';break;
1438 case 'npc_take': $this->table
= '(`quest_template` join `creature_involvedrelation` ON `quest_template`.`entry` = `creature_involvedrelation`.`quest`)';break;
1439 case 'mail_loot': $this->table
= '(`quest_template` join `mail_loot_template` ON `quest_template`.`RewMailTemplateId` = `mail_loot_template`.`entry`)';break;
1440 default: $this->table
= '`quest_template`';break;
1442 $this->db_fields
= '`quest_template`.`entry`';
1444 function disableNameLocalisation() {$this->dolocale
&= ~GO_LOCALE_NAME
;}
1445 function localiseRequirest($locale, &$tables, &$fields, &$sort_str)
1447 $tables.= ' LEFT JOIN `locales_quest` ON `quest_template`.`entry` = `locales_quest`.`entry`';
1448 if ($this->dolocale
& QUEST_LOCALE_NAME
)
1450 $fields = str_replace('`Title`', '`Title`, `locales_quest`.`Title_loc'.$locale.'` AS `Title_loc`', $fields);
1451 $sort_str = str_replace('`Title`', '`Title_loc`, `Title`', $sort_str);
1454 // Create quest givers/take list by entry
1455 function getGiveTakeList($entry)
1457 $this->doRequirest('`id` = ?d', $entry);
1459 // Create quest list require GO for comlete
1460 function requireGO($entry)
1462 $this->doRequirest('`ReqCreatureOrGOId1`= ?d OR `ReqCreatureOrGOId2`= ?d OR `ReqCreatureOrGOId3`= ?d OR `ReqCreatureOrGOId4`= ?d', -$entry, -$entry, -$entry, -$entry);
1464 // Create quest list require GO for comlete
1465 function requireCreature($entry)
1467 $this->doRequirest('`ReqCreatureOrGOId1`= ?d OR `ReqCreatureOrGOId2`= ?d OR `ReqCreatureOrGOId3`= ?d OR `ReqCreatureOrGOId4`= ?d', $entry, $entry, $entry, $entry);
1469 function oneQuest($entry)
1471 $this->doRequirest('`quest_template`.`entry` = ?d', $entry);
1473 // Create quest list require item for comlete
1474 function requireItem($entry, $giveQuest)
1476 $this->doRequirest('(`ReqItemId1`= ?d OR `ReqItemId2`= ?d OR `ReqItemId3`= ?d OR `ReqItemId4`= ?d OR `ReqItemId5`= ?d OR `ReqItemId6`= ?d OR `ReqSourceId1`= ?d OR `ReqSourceId2`= ?d OR `ReqSourceId3`= ?d OR `ReqSourceId4`= ?d) AND `quest_template`.`entry` <> ?d', $entry, $entry, $entry, $entry, $entry, $entry, $entry, $entry, $entry, $entry, $giveQuest);
1478 // Create quest list prowide item at take
1479 function provideItem($entry, $giveQuest)
1481 $this->doRequirest('`SrcItemId` = ?d AND `quest_template`.`entry` <> ?d', $entry, $giveQuest);
1483 // Create quest list reward item
1484 function rewardItem($entry)
1486 $this->doRequirest('`RewItemId1`= ?d OR `RewItemId2`= ?d OR `RewItemId3`= ?d OR `RewItemId4`= ?d OR
1487 `RewChoiceItemId1`= ?d OR`RewChoiceItemId2`= ?d OR `RewChoiceItemId3`= ?d OR `RewChoiceItemId4`= ?d OR `RewChoiceItemId5`= ?d OR `RewChoiceItemId6`= ?d',
1488 $entry, $entry, $entry, $entry, $entry, $entry, $entry, $entry, $entry, $entry);
1490 // Create quest list cast/reward spell
1491 function rewardSpell($entry)
1493 $this->doRequirest('`RewSpell` = ?d OR `RewSpellCast` = ?d', $entry, $entry);
1495 // Return quest list where exist faction reputation reward
1496 function rewardReputation($entry)
1498 $this->doRequirest('`RewRepFaction1`= ?d OR `RewRepFaction2`= ?d OR `RewRepFaction3`= ?d OR `RewRepFaction4`= ?d OR `RewRepFaction5`= ?d', $entry, $entry, $entry, $entry, $entry);
1501 function lootItem($entry)
1503 $ref_loot =& getRefrenceItemLoot($entry);
1504 $this->doRequirest('(`item` = ?d AND `mincountOrRef` > 0) { OR -`mincountOrRef` IN (?a) } GROUP BY `entry`', $entry, count($ref_loot)==0 ? DBSIMPLE_SKIP
:array_keys($ref_loot));
1505 $this->removeIfAllZero('condition_id', 'LOOT_REPORT_REQ');
1510 //=================================================================
1511 // Spell list report functions and methods
1512 //=================================================================
1513 function r_spellLevel($data) {echo $data['spellLevel'];}
1514 function r_spellIcon($data) {show_spell($data['id'], $data['SpellIconID']);}
1515 function r_spellName($data)
1517 echo '<a href="?spell='.$data['id'].'">'.$data['SpellName'].'</a>';
1519 echo '<div class=srank>'.$data['Rank'].'</div>';
1521 function r_spellRecipe($data)
1524 if ($skilname = getSkillNameForSpell($data['id']))
1525 echo '<div class=srank><'.$skilname.'></div>';
1527 function r_spellSkill($data)
1531 if ($data['RequiresSpellFocus'])
1532 echo '<div class=reqfocus>'.sprintf($lang['spell_req_focus'], getSpellFocusName($data['RequiresSpellFocus'], 2)).'</div>';
1533 if ($data['TotemCategory_1'] OR $data['TotemCategory_2'])
1536 if ($data['TotemCategory_1']) $text = getTotemCategory($data['TotemCategory_1']);
1537 if ($data['TotemCategory_2']) $text.= ", ".getTotemCategory($data['TotemCategory_2']);
1538 echo '<div class=reqfocus>'.sprintf($lang['spell_req_totem'], $text).'</div>';
1541 function r_spellSchool($data){echo getSpellSchool($data['SchoolMask']);}
1542 function r_spellReagents($data)
1544 echo '<table class=reagents><tr>';
1545 for ($i=1;$i<9;$i++
)
1546 if ($data['Reagent_'.$i])
1547 echo '<td>'.text_show_item($data['Reagent_'.$i],0,'reagent').'<br>x'.$data['ReagentCount_'.$i].'</td>';
1548 echo "</tr></table>";
1550 function r_spellCreate($data)
1552 if ($data['EffectItemType_1'] == 0 AND $data['EffectItemType_2'] == 0 AND $data['EffectItemType_3'] == 0)
1554 if ($data['EffectItemType_2'] == 0 AND $data['EffectItemType_3'] == 0)
1555 echo text_show_item($data['EffectItemType_1']);
1558 echo '<table class=reagents><tr>';
1559 for ($i=1;$i<4;$i++
)
1560 if ($data['EffectItemType_'.$i])
1561 echo '<td>'.text_show_item($data['EffectItemType_'.$i], 0, "reagent").($data['EffectBasePoints_'.$i]>0?
'<br>x '.($data['EffectBasePoints_'.$i]+
1):'').'</td>';
1562 echo '</tr></table>';
1566 function r_spellEquiped($data)
1568 echo $data['EquippedItemClass'].'<br />';
1569 echo $data['EquippedItemSubClassMask'].'<br />';
1570 echo $data['EquippedItemInventoryTypeMask'].'<br />';
1572 function r_skillLevel($data) {echo $data['min_value'];}
1573 function r_skillIcon($data)
1575 if ($data['EffectItemType_1'] OR $data['EffectItemType_2'] OR $data['EffectItemType_3'])
1576 r_spellCreate($data);
1580 $reagents= '`Reagent_1`, `Reagent_2`, `Reagent_3`, `Reagent_4`, `Reagent_5`, `Reagent_6`, `Reagent_7`, `Reagent_8`,
1581 `ReagentCount_1`, `ReagentCount_2`, `ReagentCount_3`, `ReagentCount_4`, `ReagentCount_5`, `ReagentCount_6`, `ReagentCount_7`, `ReagentCount_8`';
1582 // Spell report generator config
1583 $spell_report = array(
1584 'SPELL_REPORT_LEVEL' =>array('class'=>'small','sort'=>'level', 'text'=>$lang['spell_level'], 'draw'=>'r_spellLevel', 'sort_str'=>'`spellLevel`', 'fields'=>'`spellLevel`'),
1585 'SPELL_REPORT_ICON' =>array('class'=>'s_ico','sort'=>'icon', 'text'=>'', 'draw'=>'r_spellIcon', 'sort_str'=>'`SpellIconID`', 'fields'=>'`SpellIconID`'),
1586 'SPELL_REPORT_NAME' =>array('class'=>'left', 'sort'=>'name', 'text'=>$lang['spell_name'], 'draw'=>'r_spellName', 'sort_str'=>'`SpellName`, `id`','fields'=>'`SpellName`, `Rank`'),
1587 'SPELL_REPORT_RECIPE'=>array('class'=>'left', 'sort'=>'name', 'text'=>$lang['spell_name'], 'draw'=>'r_spellRecipe', 'sort_str'=>'`SpellName`, `id`','fields'=>'`SpellName`, `Rank`, `RequiresSpellFocus`, `TotemCategory_1`, `TotemCategory_2`'),
1588 'SPELL_REPORT_SCHOOL'=>array('class'=>'', 'sort'=>'school','text'=>$lang['spell_school'], 'draw'=>'r_spellSchool', 'sort_str'=>'`SchoolMask`', 'fields'=>'`SchoolMask`'),
1589 'SPELL_REPORT_REAGENTS'=>array('class'=>'reag','sort'=>'', 'text'=>$lang['spell_reagent'],'draw'=>'r_spellReagents','sort_str'=>'', 'fields'=>&$reagents),
1590 'SPELL_REPORT_CREATE'=>array('class'=>'skill','sort'=>'', 'text'=>$lang['spell_create'], 'draw'=>'r_spellCreate', 'sort_str'=>'', 'fields'=>'`EffectItemType_1`, `EffectItemType_2`, `EffectItemType_3`, `EffectBasePoints_1`, `EffectBasePoints_2`, `EffectBasePoints_3`'),
1591 'SPELL_REPORT_EQUIP'=>array('class'=>'left', 'sort'=>'', 'text'=>'', 'draw'=>'r_spellEquiped','sort_str'=>'', 'fields'=>'`EquippedItemClass`, `EquippedItemSubClassMask`, `EquippedItemInventoryTypeMask`'),
1593 'SKILL_REPORT_LEVEL' =>array('class'=>'small','sort'=>'skill_lvl', 'text'=>$lang['spell_level'],'draw'=>'r_skillLevel', 'sort_str'=>'`min_value`, `spellLevel`, `SpellName`, `id`', 'fields'=>'`min_value`'),
1594 'SKILL_REPORT_ICON' =>array('class'=>'skill','sort'=>'skill', 'text'=>'', 'draw'=>'r_skillIcon', 'sort_str'=>'`SpellIconID`', 'fields'=>'`SpellIconID`, `EffectItemType_1`, `EffectItemType_2`, `EffectItemType_3`, `EffectBasePoints_1`, `EffectBasePoints_2`, `EffectBasePoints_3`'),
1595 'SKILL_REPORT_NAME' =>array('class'=>'left', 'sort'=>'skill_name','text'=>$lang['spell_name'], 'draw'=>'r_spellSkill', 'sort_str'=>'`SpellName`, `id`','fields'=>'`SpellName`, `Rank`, `RequiresSpellFocus`, `TotemCategory_1`, `TotemCategory_2`'),
1598 // Spell report class
1599 class SpellReportGenerator
extends ReportGenerator
{
1600 function SpellReportGenerator($type='')
1602 global $spell_report, $wDB;
1604 $this->column_conf
=&$spell_report;
1606 case 'skill': $this->table
= '(`wowd_spell` join `wowd_skill_line_ability` ON `wowd_skill_line_ability`.`spellId` =`wowd_spell`.`id`)';break;
1607 default: $this->table
= '`wowd_spell`';break;
1609 $this->db_fields
= '`wowd_spell`.`id`';
1611 function summonGO($entry)
1613 $effList = array(50, 76, 104, 105, 106, 107);
1615 '(`EffectMiscValue_1` = ?d AND `Effect_1` IN (?a)) OR
1616 (`EffectMiscValue_2` = ?d AND `Effect_2` IN (?a)) OR
1617 (`EffectMiscValue_3` = ?d AND `Effect_3` IN (?a))', $entry, $effList, $entry, $effList, $entry, $effList);
1619 function summonCreature($entry)
1621 $effList = array(28, 56, 90, 93, 134);
1623 '(`EffectMiscValue_1` = ?d AND `Effect_1` IN (?a)) OR
1624 (`EffectMiscValue_2` = ?d AND `Effect_2` IN (?a)) OR
1625 (`EffectMiscValue_3` = ?d AND `Effect_3` IN (?a))', $entry, $effList, $entry, $effList, $entry, $effList);
1627 // List of spells use item as reagent
1628 function useRegent($entry)
1630 $this->doRequirest('`Reagent_1` = ?d OR `Reagent_2`=?d OR `Reagent_3`=?d OR `Reagent_4`=?d OR `Reagent_5`=?d OR `Reagent_6`=?d OR `Reagent_7`=?d OR `Reagent_8`=?d', $entry, $entry, $entry, $entry, $entry, $entry, $entry, $entry);
1632 foreach($this->data_array
as &$data)
1633 if ($data['EffectItemType_1'] OR $data['EffectItemType_2'] OR $data['EffectItemType_3'])
1635 if (!$create) $this->removeField('SPELL_REPORT_CREATE');
1637 // List of spells create this item
1638 function createItem($entry)
1640 $eff_list = array(107, 108, 109, 112);
1642 '(`EffectItemType_1` = ?d AND EffectApplyAuraName_1 NOT IN (?a)) OR
1643 (`EffectItemType_2` = ?d AND EffectApplyAuraName_1 NOT IN (?a)) OR
1644 (`EffectItemType_3` = ?d AND EffectApplyAuraName_1 NOT IN (?a))', $entry, $eff_list, $entry, $eff_list, $entry, $eff_list);
1646 // List os spells give faction reputation
1647 function giveReputation($entry)
1650 '(`EffectMiscValue_1` = ?d AND `Effect_1` = 103) OR
1651 (`EffectMiscValue_2` = ?d AND `Effect_2` = 103) OR
1652 (`EffectMiscValue_3` = ?d AND `Effect_3` = 103)', $entry, $entry, $entry);
1654 function triggerFromSpells($entry)
1657 '`EffectTriggerSpell_1` = ?d OR
1658 `EffectTriggerSpell_2` = ?d OR
1659 `EffectTriggerSpell_3` = ?d', $entry, $entry, $entry);
1661 function enchantFromSpells($entry)
1663 $effList = array(53, 54, 92);
1665 '(`EffectMiscValue_1` = ?d AND `Effect_1` IN (?a)) OR
1666 (`EffectMiscValue_2` = ?d AND `Effect_2` IN (?a)) OR
1667 (`EffectMiscValue_3` = ?d AND `Effect_3` IN (?a))', $entry, $effList, $entry, $effList, $entry, $effList);
1669 function affectedBySpells($family, $maskA, $maskB, $maskC)
1672 '`SpellFamilyName` = ?d AND
1674 (`EffectApplyAuraName_1` IN (107, 108) AND ( (`EffectSpellClassMaskA_1` & ?d) OR (`EffectSpellClassMaskA_2` & ?d) OR (`EffectSpellClassMaskA_3` & ?d) ) ) OR
1675 (`EffectApplyAuraName_2` IN (107, 108) AND ( (`EffectSpellClassMaskB_1` & ?d) OR (`EffectSpellClassMaskB_2` & ?d) OR (`EffectSpellClassMaskB_3` & ?d) ) ) OR
1676 (`EffectApplyAuraName_3` IN (107, 108) AND ( (`EffectSpellClassMaskC_1` & ?d) OR (`EffectSpellClassMaskC_2` & ?d) OR (`EffectSpellClassMaskC_3` & ?d) ) )
1677 )', $family, $maskA, $maskB, $maskC, $maskA, $maskB, $maskC, $maskA, $maskB, $maskC);
1679 function castByCreature($creature)
1682 $spell_list = array();
1684 // By creature fields
1685 for ($i=1;$i<9;$i++
)
1686 $spell_list = array_merge($spell_list, $dDB->selectCol('SELECT `spell'.$i.'` FROM `creature_template_spells` WHERE `entry` = ?d', $creature['entry']));
1688 // By event AI table
1689 for ($i=1;$i<=3;$i++
)
1690 $spell_list = array_merge($spell_list, $dDB->selectCol('SELECT `action1_param'.$i.'` as `id` FROM `creature_ai_scripts` WHERE `creature_id` = ?d AND `action'.$i.'_type` = 11', $creature['entry']));
1692 if (count($spell_list))
1693 $this->doRequirest('`id` IN (?a)', array_unique($spell_list));
1695 function doSkillList($skill)
1697 if (isset($_REQUEST['guid']))
1699 $spells = getPlayerSpells($_REQUEST['guid']);
1700 $this->rowCallback
= 'playerSpellCallback';
1702 $this->doRequirest('`skillId` = ?d', $skill);
1704 function lootItem($entry)
1707 $ref_loot =& getRefrenceItemLoot($entry);
1708 $spells = $dDB->select("SELECT `entry` AS ARRAY_KEY, `ChanceOrQuestChance`, `mincountOrRef` FROM `spell_loot_template` WHERE (`item` = ?d AND `mincountOrRef` > 0) { OR -`mincountOrRef` IN (?a) }", $entry, count($ref_loot)==0 ? DBSIMPLE_SKIP
:array_keys($ref_loot));
1710 $this->doRequirest('`id` IN (?a)', array_keys($spells));
1714 //=================================================================
1715 // Glyph list report functions and methods
1716 //=================================================================
1717 function r_glyphId($data) {echo $data['id'];}
1718 function r_glyphName($data) {$spell=getSpell($data['SpellId']); echo $spell['SpellName'];}
1719 function r_glyphIcon($data) {echo '<img src="'.getSpellIcon($data['iconId']).'">';}
1721 $glyph_report = array(
1722 'GLYPH_REPORT_ID' =>array('class'=>'small','sort'=>'','text'=>$lang['glyph_id' ], 'draw'=>'r_glyphId', 'sort_str'=>'', 'fields'=>''),
1723 'GLYPH_REPORT_NAME'=>array('class'=>'left', 'sort'=>'','text'=>$lang['glyph_name'], 'draw'=>'r_glyphName','sort_str'=>'', 'fields'=>'`SpellId`'),
1724 'GLYPH_REPORT_ICON'=>array('class'=>'i_ico','sort'=>'','text'=>'', 'draw'=>'r_glyphIcon','sort_str'=>'', 'fields'=>'`iconId`'),
1727 class GlyphReportGenerator
extends ReportGenerator
{
1728 // Database depend requirest generator
1729 // Select only reuire for report fields from database
1730 function GlyphReportGenerator($type='')
1732 global $glyph_report, $wDB;
1734 $this->column_conf
=&$glyph_report;
1735 $this->table
= '`wowd_glyphproperties`';
1736 $this->db_fields
= '`id`';
1738 function useSpell($entry)
1740 $this->doRequirest('`SpellId` = ?d', $entry);
1744 //=================================================================
1745 // Random Suffix list report functions and methods
1746 //=================================================================
1747 function r_rndSuffId($data) {echo $data['id'];}
1748 function r_rndSuffName($data) {echo ' ... '.$data['name'];}
1749 function r_rndSuffDetail($data)
1751 for ($j=1;$j<=3;$j++
)
1752 if ($data['EnchantID_'.$j])
1753 echo str_ireplace('$i', round($data['Prefix_'.$j]/100, 2).'%', getEnchantmentDesc($data['EnchantID_'.$j]))."<br>";
1756 $rsuff_report = array(
1757 'RSUFF_REPORT_ID' =>array('class'=>'small','sort'=>'', 'text'=>$lang['rand_enchant_id' ], 'draw'=>'r_rndSuffId', 'sort_str'=>'', 'fields'=>''),
1758 'RSUFF_REPORT_NAME' =>array('class'=>'left', 'sort'=>'name', 'text'=>$lang['rand_enchant_name'], 'draw'=>'r_rndSuffName', 'sort_str'=>'`name`', 'fields'=>'`name`'),
1759 'RSUFF_REPORT_ENCHANTS'=>array('class'=>'left', 'sort'=>'', 'text'=>$lang['rand_enchant_details'],'draw'=>'r_rndSuffDetail','sort_str'=>'', 'fields'=>'`Prefix_1`, `Prefix_2`, `Prefix_3`, `EnchantID_1`, `EnchantID_2`, `EnchantID_3`'),
1762 class RandomSuffixReportGenerator
extends ReportGenerator
{
1763 // Database depend requirest generator
1764 // Select only reuire for report fields from database
1765 function RandomSuffixReportGenerator($type='')
1767 global $rsuff_report, $wDB;
1769 $this->column_conf
=&$rsuff_report;
1770 $this->table
= '`wowd_item_random_suffix`';
1771 $this->db_fields
= '`id`';
1773 function enchantFrom($entry)
1775 $this->doRequirest('`EnchantID_1` = ?d OR `EnchantID_2` = ?d OR `EnchantID_3` = ?d', $entry, $entry, $entry);
1779 //=================================================================
1780 // Random Suffix list report functions and methods
1781 //=================================================================
1782 function r_rndPropId($data) {echo $data['id'];}
1783 function r_rndPropName($data) {echo ' ... '.$data['name'];}
1784 function r_rndPropDetail($data)
1786 for ($j=1;$j<=5;$j++
)
1787 if ($data['EnchantID_'.$j])
1788 echo getEnchantmentDesc($data['EnchantID_'.$j])."<br>";
1791 $rprop_report = array(
1792 'RPROP_REPORT_ID' =>array('class'=>'small','sort'=>'', 'text'=>$lang['rand_enchant_id' ], 'draw'=>'r_rndPropId', 'sort_str'=>'', 'fields'=>''),
1793 'RPROP_REPORT_NAME' =>array('class'=>'left', 'sort'=>'name', 'text'=>$lang['rand_enchant_name'], 'draw'=>'r_rndPropName', 'sort_str'=>'`name`', 'fields'=>'`name`'),
1794 'RPROP_REPORT_ENCHANTS'=>array('class'=>'left', 'sort'=>'', 'text'=>$lang['rand_enchant_details'],'draw'=>'r_rndPropDetail','sort_str'=>'', 'fields'=>'`EnchantID_1`, `EnchantID_2`, `EnchantID_3`, `EnchantID_4`, `EnchantID_5`'),
1797 class RandomPropetyReportGenerator
extends ReportGenerator
{
1798 // Database depend requirest generator
1799 // Select only reuire for report fields from database
1800 function RandomPropetyReportGenerator($type='')
1802 global $rprop_report, $wDB;
1804 $this->column_conf
=&$rprop_report;
1805 $this->table
= '`wowd_item_random_propety`';
1806 $this->db_fields
= '`id`';
1808 function enchantFrom($entry)
1810 $this->doRequirest('`EnchantID_1` = ?d OR `EnchantID_2` = ?d OR `EnchantID_3` = ?d OR `EnchantID_4` = ?d OR `EnchantID_5` = ?d', $entry, $entry, $entry, $entry, $entry);
1814 //=================================================================
1815 // Lock list report functions and methods
1816 //=================================================================
1817 function r_LockId($data) {echo $data['id'];}
1818 function r_LockKeys($data)
1820 for ($i=0;$i<8;$i++
)
1822 switch ($data['keytype_'.$i]){
1824 case 1: echo text_show_item($data['key_'.$i], 0, 'cost').($data['reqskill_'.$i]?
' ('.$data['reqskill_'.$i].')':'').'<br>';break;
1825 case 2: echo getLockType($data['key_'.$i]).($data['reqskill_'.$i]?
' ('.$data['reqskill_'.$i].')':'').'<br>';break;
1829 function r_LockProvide($data)
1832 if ($items = $dDB->select('SELECT `entry`, `Quality`, `displayid`, `name` FROM `item_template` WHERE `lockid` = ?d', $data['id']))
1833 foreach ($items as $i)
1834 show_item($i['entry'], $i['displayid'], 'sell');
1836 $data0 = array(GAMEOBJECT_TYPE_QUESTGIVER
,GAMEOBJECT_TYPE_CHEST
,GAMEOBJECT_TYPE_TRAP
,GAMEOBJECT_TYPE_GOOBER
,GAMEOBJECT_TYPE_CAMERA
);
1837 $data1 = array(GAMEOBJECT_TYPE_DOOR
, GAMEOBJECT_TYPE_BUTTON
);
1838 if ($go_list = $dDB->select('SELECT `entry`,`name` FROM `gameobject_template` WHERE (`type` IN (?a) AND `data0` = ?d) OR (`type` IN (?a) AND `data1` = ?d)', $data0, $data['id'], $data1, $data['id']))
1839 foreach ($go_list as $go)
1841 localiseGameobject($go);
1842 r_objName($go);echo '<br>';
1844 if (count($items) +
count($go_list) == 0)
1845 echo $lang['no_found'];
1848 $lock_report = array(
1849 'LOCK_REPORT_ID' =>array('class'=>'small','sort'=>'', 'text'=>$lang['lock_id'], 'draw'=>'r_LockId', 'sort_str'=>'', 'fields'=>''),
1850 'LOCK_REPORT_KEY' =>array('class'=>'', 'sort'=>'', 'text'=>$lang['lock_keys'],'draw'=>'r_LockKeys', 'sort_str'=>'', 'fields'=>''),
1851 'LOCK_REPORT_HAVE'=>array('class'=>'', 'sort'=>'', 'text'=>$lang['locked_list'],'draw'=>'r_LockProvide','sort_str'=>'', 'fields'=>''),
1854 class LockReportGenerator
extends ReportGenerator
{
1855 // Database depend requirest generator
1856 // Select only reuire for report fields from database
1857 function LockReportGenerator($type='')
1859 global $lock_report, $wDB;
1861 $this->column_conf
=&$lock_report;
1862 $this->table
= '`wowd_lock`';
1863 $this->db_fields
= '*';
1865 function haveItemAsKey($entry)
1868 '(`keytype_0` = 1 AND `key_0` = ?d) OR
1869 (`keytype_1` = 1 AND `key_1` = ?d) OR
1870 (`keytype_2` = 1 AND `key_2` = ?d) OR
1871 (`keytype_3` = 1 AND `key_3` = ?d) OR
1872 (`keytype_4` = 1 AND `key_4` = ?d)', $entry, $entry, $entry, $entry, $entry);
1876 //=================================================================
1877 // Extend cost list report functions and methods
1878 //=================================================================
1879 function r_excostId($data) {echo $data['id'];}
1880 function r_excostCost($data, $side = 0)
1882 if ($side) $side = "images/honor_horde.png";
1883 else $side = "images/honor_alliance.png";
1884 $str='<div class=ex_cost>';
1885 if ($data['reqhonorpoints']) $str.= $data['reqhonorpoints'].'x<img class=cost src='.$side.'>';
1886 if ($data['reqarenapoints']) $str.= $data['reqarenapoints'].'x<img class=cost src=images/arena_points.png>';
1887 for ($i=1;$i<6;$i++
)
1888 if ($data['reqitem_'.$i]) $str.= $data['reqitemcount_'.$i].' x '.text_show_item($data['reqitem_'.$i], 0, 'cost');
1892 function r_excostItem($data)
1895 if ($items = $dDB->selectCol("SELECT `item` FROM `npc_vendor` WHERE ExtendedCost = ?d GROUP BY `item`", $data['id']))
1896 foreach ($items as $itemid)
1897 show_item($itemid, 0, "sell");
1899 echo $lang['no_found'];
1901 $excost_report = array(
1902 'EXCOST_REPORT_ID' =>array('class'=>'small','sort'=>'id', 'text'=>$lang['excost_id'], 'draw'=>'r_excostId', 'sort_str'=>'`id`', 'fields'=>''),
1903 'EXCOST_REPORT_COST'=>array('class'=>'small','sort'=>'cost', 'text'=>$lang['excost_cost'], 'draw'=>'r_excostCost','sort_str'=>'`reqitemcount_1`,`reqitemcount_2`, `reqitemcount_3`', 'fields'=>''),
1904 'EXCOST_REPORT_ITEM'=>array('class'=>'', 'sort'=>'', 'text'=>$lang['excost_items'],'draw'=>'r_excostItem','sort_str'=>'', 'fields'=>''),
1907 class ExCostReportGenerator
extends ReportGenerator
{
1908 // Database depend requirest generator
1909 // Select only reuire for report fields from database
1910 function ExCostReportGenerator($type='')
1912 global $excost_report, $wDB;
1914 $this->column_conf
=&$excost_report;
1915 $this->table
= '`wowd_item_ex_cost`';
1916 $this->db_fields
= '*';
1918 function useItemAsCost($entry)
1921 '`reqitem_1` = ?d OR
1925 `reqitem_5` = ?d', $entry, $entry, $entry, $entry, $entry);
1929 //=================================================================
1930 // Item set list report functions and methods
1931 //=================================================================
1932 function r_setId($data) {echo $data['id'];}
1933 function r_setName($data){echo '<a href="?itemset='.$data['id'].'">'.$data['name'].'</a>';}
1934 function r_setItems($data)
1936 for($i=1;$i<18;$i++
)
1937 if ($set_item = $data['item_'.$i])
1938 echo ' '.text_show_item($set_item).' ';
1940 function r_setSpells($data)
1942 for($i=1; $i<9; $i++
)
1943 if ($spellID = $data['spell_'.$i])
1944 echo '<a class=spell href="?spell='.$spellID.'">('.$data['count_'.$i].') '.get_spell_details($spellID).'</a><br>';
1946 function r_setClass($data){}
1947 function r_setLevel($data){}
1949 $itemset_report = array(
1950 'SET_REPORT_ID' =>array('class'=>'small','sort'=>'id', 'text'=>$lang['set_id'], 'draw'=>'r_setId', 'sort_str'=>'`id`', 'fields'=>''),
1951 'SET_REPORT_NAME' =>array('class'=>'left', 'sort'=>'name', 'text'=>$lang['set_name'], 'draw'=>'r_setName', 'sort_str'=>'`name`','fields'=>''),
1952 'SET_REPORT_ITEM' =>array('class'=>'iset', 'sort'=>'', 'text'=>$lang['set_items'], 'draw'=>'r_setItems', 'sort_str'=>'', 'fields'=>''),
1953 'SET_REPORT_SPELL'=>array('class'=>'', 'sort'=>'', 'text'=>$lang['set_spells'],'draw'=>'r_setSpells','sort_str'=>'', 'fields'=>''),
1954 // Not supported yet
1955 'SET_REPORT_CLASS'=>array('class'=>'', 'sort'=>'class','text'=>$lang['set_class'], 'draw'=>'r_setClass', 'sort_str'=>'', 'fields'=>''),
1956 'SET_REPORT_LEVEL'=>array('class'=>'', 'sort'=>'level','text'=>$lang['set_level'], 'draw'=>'r_setLevel', 'sort_str'=>'', 'fields'=>''),
1959 class ItemSetReportGenerator
extends ReportGenerator
{
1960 // Database depend requirest generator
1961 // Select only reuire for report fields from database
1962 function ItemSetReportGenerator($type='')
1964 global $itemset_report, $wDB;
1966 $this->column_conf
=&$itemset_report;
1967 $this->table
= '`wowd_itemset`';
1968 $this->db_fields
= '*';
1970 function useSpell($entry)
1973 '`spell_1` = ?d OR `spell_2` = ?d OR `spell_3` = ?d OR `spell_4` = ?d OR
1974 `spell_5` = ?d OR `spell_6` = ?d OR `spell_7` = ?d OR `spell_8` = ?d', $entry, $entry, $entry, $entry, $entry, $entry, $entry, $entry);
1978 //=================================================================
1979 // Faction list report functions and methods
1980 //=================================================================
1981 function r_factionId($data) {echo $data['id'];}
1982 function r_factionName($data) {echo '<a href="?faction='.$data['id'].'">'.$data['name'].'</a>';}
1983 function r_factionDetail($data){echo $data['details'];}
1985 $faction_report = array(
1986 'FACTION_REPORT_ID' =>array('class'=>'small','sort'=>'', 'text'=>$lang['faction_id' ], 'draw'=>'r_factionId', 'sort_str'=>'', 'fields'=>''),
1987 'FACTION_REPORT_NAME' =>array('class'=>'left', 'sort'=>'name', 'text'=>$lang['faction_name'], 'draw'=>'r_factionName', 'sort_str'=>'`name`', 'fields'=>'`name`'),
1988 'FACTION_REPORT_DETAILS' =>array('class'=>'left', 'sort'=>'', 'text'=>$lang['faction_details'],'draw'=>'r_factionDetail','sort_str'=>'', 'fields'=>'`details`'),
1991 class FactionReportGenerator
extends ReportGenerator
{
1992 // Database depend requirest generator
1993 // Select only reuire for report fields from database
1994 function FactionReportGenerator($type='')
1996 global $faction_report, $wDB;
1998 $this->column_conf
=&$faction_report;
1999 $this->table
= '`wowd_faction`';
2000 $this->db_fields
= '`id`';
2004 //=================================================================
2005 // Enchants list report functions and methods
2006 //=================================================================
2007 function r_enchId($data) {echo $data['id'];}
2008 function r_enchName($data) {echo '<a href="?enchant='.$data['id'].'">'.$data['description'].'</a>';}
2009 function r_enchGem($data) { if ($data['GemID']) echo text_show_item($data['GemID']);}
2010 $enchants_report = array(
2011 'ENCH_REPORT_ID' =>array('class'=>'small','sort'=>'id', 'text'=>$lang['enchant_id'], 'draw'=>'r_enchId', 'sort_str'=>'`id`', 'fields'=>''),
2012 'ENCH_REPORT_NAME' =>array('class'=>'left', 'sort'=>'name', 'text'=>$lang['enchant_name'],'draw'=>'r_enchName', 'sort_str'=>'`description`','fields'=>'`description`'),
2013 'ENCH_REPORT_GEM' =>array('class'=>'small','sort'=>'', 'text'=>'', 'draw'=>'r_enchGem', 'sort_str'=>'', 'fields'=>'`GemID`'),
2016 class EnchantReportGenerator
extends ReportGenerator
{
2017 // Database depend requirest generator
2018 // Select only reuire for report fields from database
2019 function EnchantReportGenerator($type='')
2021 global $enchants_report, $wDB;
2023 $this->column_conf
=&$enchants_report;
2024 $this->table
= '`wowd_item_enchantment`';
2025 $this->db_fields
= '`id`';
2027 function useSpell($entry)
2029 $this->doRequirest('`spellid_1` = ?d OR `spellid_2` = ?d OR `spellid_3` = ?d', $entry, $entry, $entry);
2030 $this->removeIfAllZero('GemID', 'ENCH_REPORT_GEM');
2034 //=================================================================
2035 // Talents list report functions and methods
2036 //=================================================================
2037 function r_talentId($data) {echo $data['TalentTab'];}
2038 function r_talentName($data) {echo getTalentName($data['TalentTab']);}
2039 $talent_report = array(
2040 'TALENT_REPORT_ID' =>array('class'=>'small','sort'=>'', 'text'=>$lang['talent_id'], 'draw'=>'r_talentId', 'sort_str'=>'', 'fields'=>'`TalentTab`'),
2041 'TALENT_REPORT_NAME' =>array('class'=>'left', 'sort'=>'', 'text'=>$lang['talent_name'],'draw'=>'r_talentName', 'sort_str'=>'','fields'=>'`TalentTab`'),
2044 class TalentReportGenerator
extends ReportGenerator
{
2045 // Database depend requirest generator
2046 // Select only reuire for report fields from database
2047 function TalentReportGenerator($type='')
2049 global $talent_report, $wDB;
2051 $this->column_conf
=&$talent_report;
2052 $this->table
= '`wowd_talents`';
2053 $this->db_fields
= '`TalentID`';
2055 function useSpell($entry)
2057 $this->doRequirest('`Rank_1` = ?d OR `Rank_2` = ?d OR `Rank_3` = ?d OR `Rank_4` = ?d OR `Rank_5` = ?d', $entry, $entry, $entry, $entry, $entry);
2060 //=================================================================
2061 // Zones list report functions and methods
2062 //=================================================================
2063 function r_zoneId($data) {echo $data['id'];}
2064 function r_zoneName($data) {echo '<a href="?zone='.$data['id'].'">'.$data['name'].'</a>';}
2065 $zone_report = array(
2066 'ZONE_REPORT_ID' =>array('class'=>'small','sort'=>'id', 'text'=>$lang['zone_id'], 'draw'=>'r_zoneId', 'sort_str'=>'`id`', 'fields'=>''),
2067 'ZONE_REPORT_NAME' =>array('class'=>'left', 'sort'=>'name', 'text'=>$lang['zone_name'],'draw'=>'r_zoneName', 'sort_str'=>'`name`','fields'=>'`name`'),
2070 class ZoneReportGenerator
extends ReportGenerator
{
2071 function ZoneReportGenerator($type='')
2073 global $zone_report, $wDB;
2075 $this->column_conf
=&$zone_report;
2076 $this->table
= '`wowd_zones`';
2077 $this->db_fields
= '`id`';
2079 function parentZone($entry)
2081 $this->doRequirest('`id` = ?d', $entry);
2083 function subZones($entry)
2085 $this->doRequirest('`zone_id` = ?d', $entry);
2089 //=================================================================
2090 // Areatrigger teleport list report functions and methods
2091 //=================================================================
2092 function r_atId($data) {echo $data['id'];}
2093 function r_atName($data) {echo $data['name'];}
2094 function r_atReq($data)
2097 if ($data['required_level'])
2098 echo 'Req level: '.$data['required_level'].'<br>';
2100 if ($data['required_item'] OR $data['required_item2'])
2102 echo 'Req items:<br>';
2103 if ($data['required_item']) echo text_show_item($data['required_item'], 0, 'quest');
2104 if ($data['required_item2']) echo $lang['item_sel_and'].text_show_item($data['required_item2'], 0, 'quest');
2107 if ($data['heroic_key'] OR $data['heroic_key2'])
2109 echo 'Heroic key:<br>';
2110 if ($data['heroic_key']) echo text_show_item($data['heroic_key'], 0, 'quest');
2111 if ($data['heroic_key2']) echo $lang['item_sel_and'].text_show_item($data['heroic_key2'], 0, 'quest');
2117 'AT_REPORT_ID' =>array('class'=>'small','sort'=>'id', 'text'=>$lang['at_id'], 'draw'=>'r_atId', 'sort_str'=>'`id`', 'fields'=>''),
2118 'AT_REPORT_NAME' =>array('class'=>'left', 'sort'=>'name', 'text'=>$lang['at_name'],'draw'=>'r_atName', 'sort_str'=>'`name`','fields'=>'`name`'),
2119 'AT_REPORT_REQ' =>array('class'=>'left', 'sort'=>'', 'text'=>$lang['at_req'], 'draw'=>'r_atReq', 'sort_str'=>'', 'fields'=>'`required_level`, `required_item`, `required_item2`, `heroic_key`, `heroic_key2`, `required_quest_done`, `required_quest_done_heroic`'),
2122 class AreaTriggerReportGenerator
extends ReportGenerator
{
2123 function AreaTriggerReportGenerator($type='')
2125 global $at_report, $wDB;
2127 $this->column_conf
=&$at_report;
2128 $this->table
= '`areatrigger_teleport`';
2129 $this->db_fields
= '*';
2131 function onMap($entry)
2133 $this->doRequirest('`target_map` = ?d', $entry);
2135 function onArea($area_data)
2137 $this->doRequirest('`target_map` = ?d AND `target_position_x` > ?d AND `target_position_x` < ?d AND `target_position_y` > ?d AND `target_position_y` < ?d', $area_data[0], $area_data[5], $area_data[4], $area_data[3], $area_data[2]);
2141 //=================================================================
2142 // Players list report functions and methods
2143 //=================================================================
2144 function r_plGUID($data) {echo $data['guid'];}
2145 function r_plName($data) {echo '<a href=?player='.$data['guid'].'>'.$data['name'].'</a>';}
2146 function r_plRace($data) {echo '<img src="'.getRaceImage($data['race'],$data['gender']).'">';}
2147 function r_plClass($data) {echo '<img src="'.getClassImage($data['class']).'">';}
2148 function r_plFaction($data){echo '<img src="'.getFactionImage($data['race']).'">';}
2149 function r_plLevel($data) {echo $data['level'];}
2150 function r_plPos($data)
2153 $map_name = getMapNameFromPoint($data['map'], $data['position_x'], $data['position_y'], $data['position_z']);
2154 $area_name = getAreaNameFromPoint($data['map'], $data['position_x'], $data['position_y'], $data['position_z']);
2158 $extra_name = "<br><font size=-2>".$map_name."</font>";
2159 $map_name = "„".str_replace(' ',' ', $area_name)."“";
2162 $map_name = "„".str_replace(' ',' ',$map_name)."“";
2164 if ($config['show_map_ptr'])
2165 $map_name = "<a href=\"?map&point=$data[map]:$data[position_x]:$data[position_y]:$data[position_z]\">".$map_name."</a>";
2166 echo $map_name.$extra_name;
2168 function r_plGuildNote($data) {echo $data['pnote']."<br>".$data['offnote'];}
2169 function r_plGuildRank($data)
2171 // Получаем названия рангов в гильдии
2172 $rank = getGuildRankList($data['guildid']);
2173 echo @$rank[$data['rank']]['rname'];
2176 function r_plItem($data){show_item_by_data(explode(' ',$data['item_data']));}
2179 'PL_REPORT_GUID' =>array('class'=>'small', 'sort'=>'id', 'text'=>$lang['pl_guid'], 'draw'=>'r_plGUID', 'sort_str'=>'`id`', 'fields'=>''),
2180 'PL_REPORT_NAME' =>array('class'=>'player','sort'=>'name', 'text'=>$lang['pl_name'], 'draw'=>'r_plName', 'sort_str'=>'`name`', 'fields'=>'`name`'),
2181 'PL_REPORT_RACE' =>array('class'=>'i_ico', 'sort'=>'race', 'text'=>$lang['pl_race'], 'draw'=>'r_plRace', 'sort_str'=>'`race`', 'fields'=>'`race`, `gender`'),
2182 'PL_REPORT_CLASS' =>array('class'=>'i_ico', 'sort'=>'class', 'text'=>$lang['pl_class'], 'draw'=>'r_plClass', 'sort_str'=>'`class`', 'fields'=>'`class`'),
2183 'PL_REPORT_FACTION'=>array('class'=>'i_ico', 'sort'=>'', 'text'=>'', 'draw'=>'r_plFaction','sort_str'=>'', 'fields'=>'`race`'),
2184 'PL_REPORT_LEVEL' =>array('class'=>'small', 'sort'=>'level', 'text'=>$lang['pl_level'], 'draw'=>'r_plLevel', 'sort_str'=>'`level` DESC','fields'=>'`level`'),
2185 'PL_REPORT_POS' =>array('class'=>'zone', 'sort'=>'level', 'text'=>$lang['pl_pos'], 'draw'=>'r_plPos', 'sort_str'=>'', 'fields'=>'`map`, `position_x`, `position_y`, `position_z`'),
2186 // Guild member info
2187 'PL_REPORT_NOTE' =>array('class'=>'', 'sort'=>'', 'text'=>$lang['pl_note'], 'draw'=>'r_plGuildNote','sort_str'=>'', 'fields'=>'`pnote`, `offnote`'),
2188 'PL_REPORT_GRANK' =>array('class'=>'rank', 'sort'=>'rank', 'text'=>$lang['pl_rank'], 'draw'=>'r_plGuildRank','sort_str'=>'`rank`', 'fields'=>'`guildid`,`rank`'),
2190 'PL_REPORT_ITEM' =>array('class'=>'i_ico', 'sort'=>'', 'text'=>'', 'draw'=>'r_plItem' ,'sort_str'=>'', 'fields'=>'`item_instance`.`data` AS `item_data`'),
2193 class PlayerReportGenerator
extends ReportGenerator
{
2194 function PlayerReportGenerator($type='')
2196 global $pl_report, $cDB;
2198 $this->column_conf
=&$pl_report;
2200 case 'guild': $this->table
= '(`characters` join `guild_member` ON `guild_member`.`guid` = `characters`.`guid`)';break;
2201 case 'item': $this->table
= '(`characters` join `item_instance` ON `characters`.`guid` = `item_instance`.`owner_guid`)';break;
2202 default: $this->table
= '`characters`';break;
2205 $this->db_fields
= '`characters`.`guid`';
2209 $this->doRequirest('`online` <> 0 AND NOT `extra_flags`&'.PLAYER_EXTRA_GM_INVISIBLE
);
2211 // Select guild members by guild guid
2212 function guildMembers($gguid)
2214 $this->doRequirest('`guildid` = ?d', $gguid);
2216 function itemOwner($id)
2218 $this->doRequirest("(SUBSTRING_INDEX( SUBSTRING_INDEX(`item_instance`.`data` , ' ' , ?d) , ' ' , -1 )+0) = ?d", ITEM_FIELD_ENTRY +
1, $id);