Ejemplo n.º 1
0
function GetQuestInfo(&$data, $dataflag = QUEST_DATAFLAG_MINIMUM)
{
    global $DB, $quest_class, $quest_faction_reward;
    // Локализация
    if ($dataflag & QUEST_DATAFLAG_LOCALE && $_SESSION['locale'] > 0) {
        $loc = $_SESSION['locale'];
        $row = $DB->selectRow('
				SELECT
					Title_loc?d AS Title_loc,
					Details_loc?d AS Details_loc,
					Objectives_loc?d AS Objectives_loc,
					OfferRewardText_loc?d AS OfferRewardText_loc,
					RequestItemsText_loc?d AS RequresItemsText_loc,
					EndText_loc?d AS EndText_loc,
					ObjectiveText1_loc?d AS ObjectiveText1_loc,
					ObjectiveText2_loc?d AS ObjectiveText2_loc,
					ObjectiveText3_loc?d AS ObjectiveText3_loc,
					ObjectiveText4_loc?d AS ObjectiveText4_loc
				FROM locales_quest
				WHERE Id = ?d
				LIMIT 1
			', $loc, $loc, $loc, $loc, $loc, $loc, $loc, $loc, $loc, $loc, $data['entry']);
        if ($row) {
            $data = @array_merge($data, $row);
        }
    }
    // Минимальные данные
    // ID квеста
    $data['Id'] = $data['Id'];
    // Имя квеста
    $data['Title'] = GetQuestTitle($data);
    // Описания
    if ($dataflag & QUEST_DATAFLAG_STRINGS) {
        GetQuestStrings($data);
    }
    // Свойства
    if ($dataflag & QUEST_DATAFLAG_PROPS) {
        // Уровень квеста
        $data['Level'] = $data['Level'];
        // Требуемый уровень квеста
        $data['MinLevel'] = $data['MinLevel'];
        // Доступен расам
        $data['side'] = races($data['RequiredRaces']);
        // Флаги
        $data['Flags'] = $data['Flags'];
        // Ежедневный квест?
        if ($data['Flags'] & QUEST_FLAGS_DAILY) {
            $data['Daily'] = true;
        }
        // Тип квеста
        $data['type'] = $data['Type'];
        global $quest_type;
        if (isset($quest_type[$data['type']])) {
            $data['typename'] = $quest_type[$data['type']];
        } else {
            $data['typename'] = $data['type'];
        }
        // Путь к этому разделу (главная категория)
        foreach ($quest_class as $i => $class) {
            if (in_array($data['ZoneOrSort'], $class)) {
                $data['maincat'] = $i;
                break;
            }
        }
        // Категория 1
        $data['category'] = $data['ZoneOrSort'];
        // Категория 2 ???
        $data['category2'] = $data['Flags'];
        // Требуемое пати
        if ($data['SuggestedPlayers'] > 1) {
            $data['splayers'] = $data['SuggestedPlayers'];
        }
        // Лимит времени
        if ($data['LimitTime'] > 0) {
            $data['LimitTime'] = sec_to_time($data['LimitTime']);
        } else {
            unset($data['LimitTime']);
        }
        if ($data['Flags'] & QUEST_FLAGS_SHARABLE) {
            $data['Sharable'] = true;
        }
        if ($data['SpecialFlags'] & QUEST_SPECIALFLAGS_REPEATABLE) {
            $data['Repeatable'] = true;
        }
        if ($data['RewardTitleId'] > 0) {
            $data['titlereward'] = $DB->selectCell('SELECT name_loc' . $_SESSION['locale'] . ' FROM ?_char_titles WHERE id=?d LIMIT 1', $data['RewardTitleId']);
        }
    }
    // Награды и задания
    if ($dataflag & QUEST_DATAFLAG_REWARDS) {
        // Опыт/деньги@70
        $data['xp'] = GetQuestXpOrMoney($data);
        // Награды вещей
        for ($j = 0; $j <= 6; ++$j) {
            if ($data['RewardChoiceItemId' . $j] != 0 and $data['RewardChoiceItemCount' . $j] != 0) {
                $data['itemchoices'][] = @array_merge(allitemsinfo($data['RewardChoiceItemId' . $j], 0), array('count' => $data['RewardChoiceItemCount' . $j]));
            }
        }
        for ($j = 0; $j <= 4; ++$j) {
            if ($data['RewardItemId' . $j] != 0 and $data['RewardItemCount' . $j] != 0) {
                $data['itemrewards'][] = @array_merge(allitemsinfo($data['RewardItemId' . $j], 0), array('count' => $data['RewardItemCount' . $j]));
            }
        }
        // Вознаграждение репутацией
        for ($j = 1; $j <= 5; $j++) {
            if ($data['RewardFactionValueId' . $j] != 0) {
                $value = $data['RewardFactionValueId' . $j];
                $id = $data['RewardFactionId' . $j];
                if (!$value && isset($quest_faction_reward[$id])) {
                    $value = $quest_faction_reward[$id];
                }
                if ($value) {
                    $data['reprewards'][] = @array_merge(factioninfo($data['RewardFactionValueId' . $j]), array('value' => $value));
                }
            }
        }
        // Вознаграждение деньгами
        if ($data['RewardOrRequiredMoney'] > 0) {
            $data['money'] = money2coins($data['RewardOrRequiredMoney']);
        } elseif ($data['RewardOrRequiredMoney'] < 0) {
            $data['moneyreq'] = money2coins(-$data['RewardOrRequiredMoney']);
        }
        if ($data['RewardMoneyMaxLevel']) {
            $data['moneymaxlevel'] = money2coins($data['RewardMoneyMaxLevel']);
        }
    }
    // Последовательность квестов, требования, цепочки
    if ($dataflag & QUEST_DATAFLAG_SERIES) {
        // не используется для вычисления самих сериесов, исключительно для внесения соответствующих полей в массив информации
    }
    // Все ОК. Это не обязательный return, но в некоторых функциях нужен.
    return $data;
}
/**
 *
 * @param type $row
 * @return type 
 */
function spellinfo2(&$row)
{
    global $DB;
    global $item_cols;
    if ($row) {
        $spell = array();
        $spell['entry'] = $row['spellID'];
        $spell['quality'] = '@';
        $spell['name'] = $row['spellname_loc' . $_SESSION['locale']];
        $spell['rank'] = $row['rank_loc' . $_SESSION['locale']];
        $spell['level'] = $row['levelspell'];
        $spell['school'] = $row['resistancesID'];
        // TODO: Что за cat?
        $spell['cat'] = 0;
        // Скилл
        //		if(!(isset($row['skillID'])))
        //		$skillrow = list($row['skillID'],$row['req_skill_value'],$row['min_value'],$row['max_value']);//$DB->selectRow('SELECT skillID, req_skill_value, min_value, max_value  FROM ?_aowow_skill_line_ability WHERE spellID=?d LIMIT 1', $spell['entry']);
        if (isset($row['skillID'])) {
            //			if($skillrow['req_skill_value'] != 1)
            //				$spell['learnedat'] = $skillrow['req_skill_value'];
            // TODO: На каком уровне скилла можно обучиться спеллу (поле learnedat)
            if ($row['min_value'] and $row['max_value']) {
                $spell['colors'] = array();
                $spell['colors'][0] = '';
                $spell['colors'][1] = $row['min_value'];
                $spell['colors'][2] = floor(($row['max_value'] + $row['min_value']) / 2);
                $spell['colors'][3] = $row['max_value'];
            }
            $spell['skill'] = $row['skillID'];
        }
        // Реагенты
        $spell['reagents'] = array();
        $i = 0;
        global $allitems;
        for ($j = 1; $j <= 8; $j++) {
            if ($row['reagent' . $j]) {
                $spell['reagents'][$i] = array();
                // ID реагента
                $spell['reagents'][$i]['entry'] = $row['reagent' . $j];
                // Доп данные о реагенте
                // Если данных для этой вещи ещё нет:
                allitemsinfo($spell['reagents'][$i]['entry'], 0);
                // Количество реагентов
                $spell['reagents'][$i]['count'] = $row['reagentcount' . $j];
                $i++;
            }
        }
        // Создает вещь:
        $i = 0;
        for ($j = 1; $j <= 3; $j++) {
            if (isset($row['effect' . $j . 'id']) && $row['effect' . $j . 'id'] == 24) {
                $spell['creates'][$i] = array();
                $spell['creates'][$i]['entry'] = $row['effect' . $j . 'itemtype'];
                $spell['creates'][$i]['count'] = $row['effect' . $j . 'BasePoints'] + 1;
                if (!isset($allitems[$spell['creates'][$i]['entry']])) {
                    $createrow = $DB->selectRow('
						SELECT ?#
						FROM ?_item_template, ?_aowow_icons
						WHERE
							entry=?d
							AND id=displayid
						LIMIT 1', $item_cols[0], $spell['creates'][$i]['entry']);
                    allitemsinfo2($createrow, 0);
                }
                if (!isset($allitems[$spell['creates'][$i]['entry']])) {
                    // Если так и не существует - нет соответствующей записи в таблице вещей
                    $spell['quality'] = 6;
                } else {
                    $spell['quality'] = 6 - $allitems[$spell['creates'][$i]['entry']]['quality'];
                }
                $i++;
            }
        }
        allspellsinfo2($row, 0);
        return $spell;
    } else {
        return;
    }
}
Ejemplo n.º 3
0
            $item['reagentfor'][$numRow]['name'] = $row['spellname_loc' . $_SESSION['locale']];
            $item['reagentfor'][$numRow]['school'] = $row['resistancesID'];
            $item['reagentfor'][$numRow]['level'] = $row['levelspell'];
            $item['reagentfor'][$numRow]['quality'] = '@';
            for ($j = 1; $j <= 8; $j++) {
                if ($row['reagent' . $j]) {
                    $item['reagentfor'][$numRow]['reagents'][]['entry'] = $row['reagent' . $j];
                    $item['reagentfor'][$numRow]['reagents'][count($item['reagentfor'][$numRow]['reagents']) - 1]['count'] = $row['reagentcount' . $j];
                    allitemsinfo($row['reagent' . $j], 0);
                }
            }
            for ($j = 1; $j <= 3; $j++) {
                if ($row['effect' . $j . 'itemtype']) {
                    $item['reagentfor'][$numRow]['creates'][]['entry'] = $row['effect' . $j . 'itemtype'];
                    $item['reagentfor'][$numRow]['creates'][count($item['reagentfor'][$numRow]['creates']) - 1]['count'] = 1 + $row['effect' . $j . 'BasePoints'];
                    allitemsinfo($row['effect' . $j . 'itemtype'], 0);
                    @($item['reagentfor'][$numRow]['quality'] = 6 - $allitems[$row['effect' . $j . 'itemtype']]['quality']);
                }
            }
            // Добавляем в таблицу спеллов
            allspellsinfo2($row);
        }
        unset($quality);
    }
    unset($rows_r);
    // Создается из...
    $rows_cf = $DB->select('
		SELECT ?#, s.spellID
		FROM ?_udwbase_spell s, ?_udwbase_spellicons i
		WHERE
			((s.effect1itemtype=?d
Ejemplo n.º 4
0
function ParseTextLinks($text)
{
    if (!preg_match_all('/(\\[(achievement|item|quest|spell)=(\\d+)\\])/', $text, $matches)) {
        return;
    }
    $types = $matches[2];
    $ids = $matches[3];
    foreach ($types as $i => $type) {
        $id = $ids[$i];
        switch ($type) {
            case 'achievement':
                require_once 'includes/allachievements.php';
                allachievementsinfo($id);
                break;
            case 'item':
                require_once 'includes/allitems.php';
                allitemsinfo($id);
                break;
            case 'quest':
                require_once 'includes/allquests.php';
                allquestinfo($id);
                break;
            case 'spell':
                require_once 'includes/allspells.php';
                allspellsinfo($id);
                break;
        }
    }
}
Ejemplo n.º 5
0
 case ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET2:
 case ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL:
 case ACHIEVEMENT_CRITERIA_TYPE_LEARN_SPELL:
 case ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL2:
     $tmp['link'] = array('href' => '?spell=' . $row['value1'], 'text' => $row['name']);
     $tmp['icon'] = $iconId;
     $achievement['icons'][] = array('itr' => $iconId++, 'type' => 'g_spells', 'id' => $row['value1']);
     allspellsinfo($row['value1']);
     break;
     // Добавляем ссылку и иконку предмета
 // Добавляем ссылку и иконку предмета
 case ACHIEVEMENT_CRITERIA_TYPE_OWN_ITEM:
 case ACHIEVEMENT_CRITERIA_TYPE_USE_ITEM:
 case ACHIEVEMENT_CRITERIA_TYPE_LOOT_ITEM:
 case ACHIEVEMENT_CRITERIA_TYPE_EQUIP_ITEM:
     $item = allitemsinfo($row['value1']);
     $tmp['link'] = array('href' => '?item=' . $row['value1'], 'text' => $row['name'], 'quality' => $item['quality']);
     $tmp['icon'] = $iconId;
     $achievement['icons'][] = array('itr' => $iconId++, 'type' => 'g_items', 'id' => $row['value1'], 'count' => $row['value2']);
     break;
     // Добавляем ссылку на фракцию и требуемую репутацию
 // Добавляем ссылку на фракцию и требуемую репутацию
 case ACHIEVEMENT_CRITERIA_TYPE_GAIN_REPUTATION:
     $tmp['link'] = array('href' => '?faction=' . $row['value1'], 'text' => $row['name']);
     $tmp['extra_text'] = ' (' . reputations($row['value2']) . ')';
     break;
     // Добавляем иконку золотой монетки
 // Добавляем иконку золотой монетки
 case ACHIEVEMENT_CRITERIA_TYPE_MONEY_FROM_QUEST_REWARD:
 case ACHIEVEMENT_CRITERIA_TYPE_LOOT_MONEY:
     $tmp['standard'] = true;
Ejemplo n.º 6
0
         $npc['sells'][$numRow] = array();
         $npc['sells'][$numRow] = iteminfo2($row);
         $npc['sells'][$numRow]['maxcount'] = $row['drop-maxcount'];
         $npc['sells'][$numRow]['cost'] = array();
         if ($row['ExtendedCost']) {
             $extcost = $DB->selectRow('SELECT * FROM ?_item_extended_cost WHERE extendedcostID=?d LIMIT 1', abs($row['ExtendedCost']));
             if ($extcost['reqhonorpoints'] > 0) {
                 $npc['sells'][$numRow]['cost']['honor'] = ($npc['A'] == 1 ? 1 : -1) * $extcost['reqhonorpoints'];
             }
             if ($extcost['reqarenapoints'] > 0) {
                 $npc['sells'][$numRow]['cost']['arena'] = $extcost['reqarenapoints'];
             }
             $npc['sells'][$numRow]['cost']['items'] = array();
             for ($j = 1; $j <= 5; $j++) {
                 if ($extcost['reqitem' . $j] > 0 and $extcost['reqitemcount' . $j] > 0) {
                     allitemsinfo($extcost['reqitem' . $j], 0);
                     $npc['sells'][$numRow]['cost']['items'][] = array('item' => $extcost['reqitem' . $j], 'count' => $extcost['reqitemcount' . $j]);
                 }
             }
         }
         if ($row['BuyPrice'] > 0) {
             $npc['sells'][$numRow]['cost']['money'] = $row['BuyPrice'];
         }
     }
     unset($row);
     unset($numRow);
     unset($extcost);
 }
 unset($rows_s);
 // Дроп
 if (!($npc['drop'] = loot('creature_loot_template', $lootid))) {
Ejemplo n.º 7
0
// Настройка БД
global $DB;
require_once 'includes/db.php';
function str_normalize($string)
{
    return strtr($string, array('\\' => '\\\\', "'" => "\\'", '"' => '\\"', "\r" => '\\r', "\n" => '\\n', '</' => '<\\/'));
}
// Параметры передаваемые скрипту
@(list($what, $id) = explode("=", $_SERVER['QUERY_STRING']));
$id = intval($id);
$x = '';
switch ($what) {
    case 'item':
        if (!($item = load_cache(6, $id))) {
            require_once 'includes/allitems.php';
            $item = allitemsinfo($id, 1);
            save_cache(6, $id, $item);
        }
        $x .= '$WowheadPower.registerItem(' . $id . ', 0, {';
        if ($item['name']) {
            $x .= 'name: \'' . str_normalize($item['name']) . '\',';
        }
        if ($item['quality']) {
            $x .= 'quality: ' . $item['quality'] . ',';
        }
        if ($item['icon']) {
            $x .= 'icon: \'' . str_normalize($item['icon']) . '\',';
        }
        if ($item['info']) {
            $x .= 'tooltip: \'' . str_normalize($item['info']) . '\'';
        }
Ejemplo n.º 8
0
            $item['currencyfor'][$id]['maxcount'] = $row['drop-maxcount'];
            $item['currencyfor'][$id]['cost'] = array();
            if ($row['BuyPrice'] > 0) {
                $npc['sells'][$id]['cost']['money'] = $row['BuyPrice'];
            }
            if ($row['reqhonorpoints'] > 0) {
                $item['currencyfor'][$id]['cost']['honor'] = $row['reqhonorpoints'];
            }
            //FIXME_BUG
            if ($row['reqarenapoints'] > 0) {
                $item['currencyfor'][$id]['cost']['arena'] = $row['reqarenapoints'];
            }
            $item['currencyfor'][$id]['cost']['items'] = array();
            for ($j = 1; $j <= 5; $j++) {
                if ($row['reqitem' . $j] > 0 and $row['reqitemcount' . $j] > 0) {
                    allitemsinfo($row['reqitem' . $j], 0);
                    $item['currencyfor'][$id]['cost']['items'][] = array('item' => $row['reqitem' . $j], 'count' => $row['reqitemcount' . $j]);
                }
            }
        }
    }
    unset($rows_cf);
    // Цель критерии
    $rows = $DB->select('
			SELECT a.id, a.faction, a.name_loc?d AS name, a.description_loc?d AS description, a.category, a.points, s.iconname, z.areatableID
			FROM ?_spellicons s, ?_achievementcriteria c, ?_achievement a
			LEFT JOIN (?_zones z) ON a.map != -1 AND a.map = z.mapID
			WHERE
				a.icon = s.id
				AND a.id = c.refAchievement
				AND c.type IN (?a)
Ejemplo n.º 9
0
             $spell['effect'][$i]['name'] .= ': ' . $spell_aura_names[$row['effect' . $j . 'Aura']] . ' (<a href="?npc=' . $row['effect' . $j . 'MiscValue'] . '">' . $row['effect' . $j . 'MiscValue'] . '</a>)';
             break;
         default:
             $spell['effect'][$i]['name'] .= ': ' . $spell_aura_names[$row['effect' . $j . 'Aura']];
             if ($row['effect' . $j . 'MiscValue'] > 0) {
                 $spell['effect'][$i]['name'] .= ' (' . $row['effect' . $j . 'MiscValue'] . ')';
             }
     }
 } elseif ($row['effect' . $j . 'Aura'] > 0) {
     $spell['effect'][$i]['name'] .= ': Unknown Aura (' . $row['effect' . $j . 'Aura'] . ')';
 }
 // Создает вещь:
 if ($row['effect' . $j . 'id'] == 24) {
     $spell['effect'][$i]['item'] = array();
     $spell['effect'][$i]['item']['entry'] = $row['effect' . $j . 'itemtype'];
     $tmpRow = allitemsinfo($spell['effect'][$i]['item']['entry'], 0);
     $spell['effect'][$i]['item']['name'] = $tmpRow['name'];
     $spell['effect'][$i]['item']['quality'] = $tmpRow['quality'];
     $spell['effect'][$i]['item']['count'] = $row['effect' . $j . 'BasePoints'] + 1;
     // Иконка итема, если спелл создает этот итем
     if (!isset($spell['icon'])) {
         $spell['icon'] = $tmpRow['iconname'];
     }
 }
 // Создает спелл
 if ($row['effect' . $j . 'triggerspell'] > 0) {
     $spell['effect'][$i]['spell'] = array();
     $spell['effect'][$i]['spell']['entry'] = $row['effect' . $j . 'triggerspell'];
     $spell['effect'][$i]['spell']['name'] = $DB->selectCell('SELECT spellname_loc' . $_SESSION['locale'] . ' FROM ?_spell WHERE spellID = ?d LIMIT 1', $spell['effect'][$i]['spell']['entry']);
     allspellsinfo($spell['effect'][$i]['spell']['entry']);
 }