$object['starts'][] = GetQuestInfo($row, 0xffffff); } } unset($rows_qs); // Заканчивают квесты... $rows_qe = $DB->select(' SELECT ?# FROM gameobject_involvedrelation i, quest_template q WHERE i.id = ?d AND q.entry = i.quest ', $quest_cols[2], $id); if ($rows_qe) { $object['ends'] = array(); foreach ($rows_qe as $numRow => $row) { $object['ends'][] = GetQuestInfo($row, 0xffffff); } } unset($rows_qe); // Положения объектофф: $data = $DB->select('SELECT position_y as y, position_x as x, map as m, spawntimesecs FROM gameobject WHERE id = ?d', $id); position($data); save_cache(3, $object['entry'], $object); } global $page; $page = array('Mapper' => false, 'Book' => false, 'Title' => $object['name'] . ' - ' . $smarty->get_config_vars('Objects'), 'tab' => 0, 'type' => 2, 'typeid' => $object['entry'], 'path' => '[0,5,' . $object['type'] . ']'); if ($object['pagetext']) { $page['Book'] = true; } $page['Mapper'] = true; $smarty->assign('page', $page);
if (!($quests = load_cache(12, $cache_str))) { unset($quests); global $DB, $quest_class, $quest_cols; $rows = $DB->select(' SELECT ?# FROM ?_quest_template q WHERE 1 = 1 { AND ZoneOrSort = ? } { AND ZoneOrSort IN (?a) } ORDER BY Title {LIMIT ?d} ', $quest_cols[2], isset($ZoneOrSort) ? $ZoneOrSort : DBSIMPLE_SKIP, (!isset($ZoneOrSort) and $Type) ? $quest_class[$Type] : DBSIMPLE_SKIP, $UDWBaseconf['limit'] > 0 ? $UDWBaseconf['limit'] : DBSIMPLE_SKIP); $quests = array(); foreach ($rows as $numRow => $row) { $quests[] = GetQuestInfo($row, QUEST_DATAFLAG_LISTINGS); } save_cache(12, $cache_str, $quests); } global $page; $page = array('Mapper' => false, 'Book' => false, 'Title' => $smarty->get_config_vars('Quests'), 'tab' => 0, 'type' => 0, 'typeid' => 0, 'path' => '[0, 3,' . $Type . ' ,' . $ZoneOrSort . ']'); $smarty->assign('page', $page); // Если хоть одна информация о вещи найдена - передаём массив с информацией о вещях шаблонизатору if ($allitems) { $smarty->assign('allitems', $allitems); } if ($quests) { $smarty->assign('quests', $quests); } // Количество MySQL запросов $smarty->assign('mysql', $DB->getStatistics());
foreach ($tmp as $t) { $m[] = $t['entry']; } } $rows = $DB->select(' SELECT * {, l.Title_loc?d AS `Title_loc`} FROM quest_template q {LEFT JOIN (locales_quest l) ON l.entry=q.entry AND ?d} WHERE Title LIKE ? {OR q.entry IN (?a)} ', $m ? $_SESSION['locale'] : DBSIMPLE_SKIP, $m ? 1 : DBSIMPLE_SKIP, $nsearch, $m ? $m : DBSIMPLE_SKIP); unset($m); unset($t); unset($tmp); foreach ($rows as $numRow => $row) { $found['quest'][] = GetQuestInfo($row, 0xffffff); } // Ищем наборы вещей $rows = $DB->select(' SELECT * FROM ?_itemset WHERE name LIKE ? ', $nsearch); foreach ($rows as $numRow => $row) { $found['itemset'][] = itemsetinfo2($row); } // Ищем спеллы $rows = $DB->select(' SELECT ?#, spellID FROM ?_spell s, ?_spellicons i WHERE
} unset($rows_qe); // Необходимы для квеста.. $rows_qo = $DB->select(' SELECT ?# FROM ?_quest_template WHERE ReqCreatureOrGOId1=? OR ReqCreatureOrGOId2=? OR ReqCreatureOrGOId3=? OR ReqCreatureOrGOId4=? ', $quest_cols[2], $id, $id, $id, $id); if ($rows_qo) { $npc['objectiveof'] = array(); foreach ($rows_qo as $numRow => $row) { $npc['objectiveof'][] = GetQuestInfo($row, 0xffffff); } } unset($rows_qo); // Положения созданий божих: position($npc['entry'], 'creature'); save_cache(1, $npc['entry'], $npc); } global $page; $page = array('Mapper' => true, 'Book' => false, 'Title' => $npc['name'] . ' - ' . $smarty->get_config_vars('NPCs'), 'tab' => 0, 'type' => 1, 'typeid' => $npc['entry'], 'path' => '[0,4,' . $npc['type'] . ']'); $smarty->assign('page', $page); // Комментарии $smarty->assign('comments', getcomments($page['type'], $page['typeid'])); // Если хоть одна информация о вещи найдена - передаём массив с информацией о вещях шаблонизатору if (isset($allitems)) { $smarty->assign('allitems', $allitems);
function allquestinfo($id) { global $allquests; if (!$allquests[$id]) { $allquests[$id] = GetQuestInfo($id, QUEST_DATAFLAG_MINIMUM); } return $allquests[$id]; }
unset($creature_rows); } // Квесты для этой фракции $quests_rows = $DB->select(' SELECT ?# FROM quest_template WHERE RewRepFaction1=?d OR RewRepFaction2=?d OR RewRepFaction3=?d OR RewRepFaction4=?d ', $quest_cols[2], $id, $id, $id, $id); if ($quests_rows) { $faction['quests'] = array(); foreach ($quests_rows as $i => $row) { $faction['quests'][] = GetQuestInfo($row, 0xffffff); } unset($quests_rows); } // Faction cache save_cache(18, $faction['entry'], $faction); } } $page = array('Mapper' => false, 'Book' => false, 'Title' => $faction['name'] . ' - ' . $smarty->get_config_vars('Factions'), 'tab' => 0, 'type' => 8, 'typeid' => $faction['entry'], 'path' => '[0, 7, 0]'); $smarty->assign('page', $page); // Комментарии $smarty->assign('comments', getcomments($page['type'], $page['typeid'])); // Данные о квесте $smarty->assign('faction', $faction); // Если хоть одна информация о вещи найдена - передаём массив с информацией о вещях шаблонизатору if (isset($allitems)) {
WHERE RewItemId1=?d OR RewItemId2=?d OR RewItemId3=?d OR RewItemId4=?d OR RewChoiceItemId1=?d OR RewChoiceItemId2=?d OR RewChoiceItemId3=?d OR RewChoiceItemId4=?d OR RewChoiceItemId5=?d OR RewChoiceItemId6=?d ', $quest_cols[2], $item['entry'], $item['entry'], $item['entry'], $item['entry'], $item['entry'], $item['entry'], $item['entry'], $item['entry'], $item['entry'], $item['entry']); if ($rows_qrw) { $item['rewardof'] = array(); foreach ($rows_qrw as $numRow => $row) { $item['rewardof'][] = GetQuestInfo($row, 0xffffff); } } unset($rows_qrw); // Поиск вещей, в которых находятся эти вещи $drops_cii = drop('?_item_loot_template', $item['entry']); if ($drops_cii) { $item['containedinitem'] = array(); foreach ($drops_cii as $lootid => $drop) { $rows = $DB->select(' SELECT c.?#, c.entry, maxcount { , l.name_loc?d AS `name_loc`} FROM ?_udwbase_icons, ?_item_template c { LEFT JOIN (?_locales_item l) ON l.entry=c.entry AND ? } WHERE c.entry=?d
unset($usedbyitemset); } // Спелл - награда за квест $questreward = $DB->select(' SELECT c.?# { , Title_loc?d AS Title_loc } FROM quest_template c { LEFT JOIN (locales_quest l) ON c.entry = l.entry AND ? } WHERE RewSpell = ?d OR RewSpellCast = ?d ', $quest_cols[2], $_SESSION['locale'] > 0 ? $_SESSION['locale'] : DBSIMPLE_SKIP, $_SESSION['locale'] > 0 ? 1 : DBSIMPLE_SKIP, $spell['entry'], $spell['entry']); if ($questreward) { $spell['questreward'] = array(); foreach ($questreward as $i => $row) { $spell['questreward'][] = GetQuestInfo($row, 0xffffff); } unset($questreward); } // Проверяем на пустые массивы if (!$spell['taughtbyitem']) { unset($spell['taughtbyitem']); } if (!$spell['taughtbynpc']) { unset($spell['taughtbynpc']); } // Цель критерии $rows = $DB->select(' SELECT a.id, a.faction, a.name_loc?d AS name, a.description_loc?d AS description, a.category, a.points, s.iconname, z.areatableID FROM ?_spellicons s, ?_achievementcriteria c, ?_achievement a LEFT JOIN (?_zones z) ON a.map != -1 AND a.map = z.mapID
unset($object); // Данные об объекте: $object = array(); $object = objectinfo($id, 1); // Начиниают квесты... $rows_qs = $DB->select(' SELECT o.?# FROM gameobject_questrelation q, quest_template o WHERE q.id = ?d AND o.entry = q.quest ', $quest_cols[2], $id); if ($rows_qs) { $object['starts'] = array(); foreach ($rows_qs as $numRow => $row) { $object['starts'][] = GetQuestInfo($row, 0xffffff); } } unset($rows_qs); // Заканчивают квесты... /*$rows_qe = $DB->select(' SELECT ?# FROM gameobject_involvedrelation i, quest_template q WHERE i.id = ?d AND q.entry = i.quest ', $quest_cols[2], $id ); if($rows_qe)
function GetDBQuestInfo($id, $dataflag = QUEST_DATAFLAG_MINIMUM) { global $DB, $questcols, $quest_class; $data = $DB->selectRow(' SELECT 1 {, ?# } {, ?# } {, ?# } {, ?# } {, ?# } FROM quest_template WHERE entry=?d LIMIT 1 ', $dataflag & QUEST_DATAFLAG_MINIMUM ? $questcols[QUEST_DATAFLAG_MINIMUM] : DBSIMPLE_SKIP, $dataflag & QUEST_DATAFLAG_STRINGS ? $questcols[QUEST_DATAFLAG_STRINGS] : DBSIMPLE_SKIP, $dataflag & QUEST_DATAFLAG_SERIES ? $questcols[QUEST_DATAFLAG_SERIES] : DBSIMPLE_SKIP, $dataflag & QUEST_DATAFLAG_PROPS ? $questcols[QUEST_DATAFLAG_PROPS] : DBSIMPLE_SKIP, $dataflag & QUEST_DATAFLAG_REWARDS ? $questcols[QUEST_DATAFLAG_REWARDS] : DBSIMPLE_SKIP, $id); if (!$data) { return false; } else { return GetQuestInfo($data, $dataflag); } }