Skip to content

Commit

Permalink
[82] Added beta version of filters for item search. Now supported onl…
Browse files Browse the repository at this point in the history
…y `Dungeon and raids` and `Emblems rewards` options. I recommend to re-upload full DB dump (wowarmory_rc1_r82.7z) instead of upgrading from r79 by sql updates.
  • Loading branch information
Shadez committed Feb 26, 2010
1 parent a55a458 commit 101846a
Show file tree
Hide file tree
Showing 20 changed files with 53,413 additions and 1,263 deletions.
18 changes: 12 additions & 6 deletions INSTALL
Expand Up @@ -9,15 +9,18 @@ SYSTEM REQUIREMENTS:

INSTALLATION STEPS:
1. Create new MySQL database (`armory`, for expample) with utf8_general_ci encoding;
2. Unzip sql/wowarmory_rc1_r77.sql.7z to any folder;
3. Upload unpacked wowarmory_rc1_r77.sql into `armory` database.
2. Unzip sql/wowarmory_rc1_r82.sql.7z to any folder;
3. Upload unpacked wowarmory_rc1_r82.sql into `armory` database.
Attention! SQL Query will take a long time while uploading, be prepare for it!
If you get error 'MySQL server has gone away', change Query limit in MySQL server config file (my.ini (or my.cnf)).
Google it, if you don't know what it is;
4. Edit includes/classes/configuration.php (read comments).
5. Downloads icons archive from "Downloads" on GitHub.com and unpack it to "wow-icons/_images/"
6. Rename file htaccess to .htaccess for correct site work.
7. If there are some sql updates in 'sql/updates' dir (rev. 78 or higher), you need to upload it to DB too.
7. If there are some sql updates in 'sql/updates' dir (rev. 82 or higher), you need to upload it to DB too.
8. Run tools/build_loot_tables.php to generate bosses lootIds for search engine. Read tools/build_loot_tables_README.txt for more info.
If you using YTDB database, you can miss this step - there are already stored data in armory DB for this database.
9. Update your armory database with sql/armory_instance_data.sql - this is data for loot that stored in chests (gameobjects).

========================
Как установить Оружейную
Expand All @@ -30,12 +33,15 @@ INSTALLATION STEPS:

ПОРЯДОК УСТАНОВКИ:
1. Создайте новую базу сервера MySQL (`armory`, к примеру) с кодировкой utf8_general_ci;
2. Распакуйте архив sql/wowarmory_rc1_r77.sql.7z в любую папку;
3. Залейте распакованный wowarmory_rc1_r77.sql в базу `armory`
2. Распакуйте архив sql/wowarmory_rc1_r82.sql.7z в любую папку;
3. Залейте распакованный wowarmory_rc1_r82.sql в базу `armory`
Внимание! SQL запрос будет выполняться достаточно долгое время, будьте к этому готовы!
Если вы получаете ошибку 'MySQL Server has gone away', измените лимит запроса в конфигурационном файле сервера MySQL
(my.ini (или my.cnf)). Используйте Google, если не знаете что это и как менять;
4. Отредактируйте файл includes/classes/configuration.php.
5. Скачайте архив иконок из раздела "Downloads" на GitHub.com и распакуйте в папку "wow-icons/_images/"
6. Переименуйте файл htaccess в .htaccess для правильной работы сайта.
7. Если в папке 'sql/updates' присутствуют обновления для базы (ревизии 78 и выше), вам будет необходимо так же залить их базу.
7. Если в папке 'sql/updates' присутствуют обновления для базы (ревизии 82 и выше), вам будет необходимо так же залить их базу.
8. Запустите tools/build_loot_tables.php для генерации lootid боссов (необходимо для работы поискового движка). Подробнее - в файле tools/build_loot_tables_README.txt
Если ваша база - YTDB, то этот скрипт можно не выполнять, в базе уже имеются данные для этой базы.
9. Обновите базу файлом sql/armory_instance_data.sql - данные для добычи, которая находится в сундуках (игровые объекты).
6 changes: 3 additions & 3 deletions includes/armory_loader.php
Expand Up @@ -3,7 +3,7 @@
/**
* @package World of Warcraft Armory
* @version Release Candidate 1
* @revision 80
* @revision 82
* @copyright (c) 2009-2010 Shadez
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
Expand Down Expand Up @@ -31,7 +31,7 @@
die('<b>Error:</b> can not load connector class!');
}

define('DB_VERSION', 'armory_r79');
define('DB_VERSION', 'armory_r82');
$armory = new Connector;
$armory->tpl->template_dir = 'includes/template/';
$armory->tpl->compile_dir = 'includes/cache/';
Expand Down Expand Up @@ -111,7 +111,7 @@
$_locale = (isset($_SESSION['armoryLocale'])) ? $_SESSION['armoryLocale'] : $armory->armoryconfig['defaultLocale'];
$armory->_locale = $_locale;
$armory->tpl->assign('menu_file', 'overall_menu_'.$_locale);
$armory->tpl->config_load($_locale . '.conf' );
$armory->tpl->config_load($_locale . '.conf');

$tpl_config_vars = array (
'siteCharset' => $armory->armoryconfig['siteCharset'],
Expand Down
15 changes: 12 additions & 3 deletions includes/classes/class.items.php
Expand Up @@ -3,7 +3,7 @@
/**
* @package World of Warcraft Armory
* @version Release Candidate 1
* @revision 78
* @revision 82
* @copyright (c) 2009-2010 Shadez
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
Expand Down Expand Up @@ -354,12 +354,12 @@ public function BuildLootTable($item, $vendor, $data=false) {
'map' => Mangos::GetNpcInfo($bItem['entry'], 'map'),
'difficult' => Mangos::GetNpcInfo($bItem['entry'], 'dungeonlevel'),
'instance_type' => Mangos::GetNpcInfo($bItem['entry'], 'instance_type'),
'drop_percent' => Mangos::DropPercent($bItem['ChanceOrQuestChance'])
'drop_percent' => Mangos::DropPercent($bItem['ChanceOrQuestChance'])
);
$i++;
}
}
break;
break;
case 'chest':
$ChestLoot = $this->wDB->select("
SELECT `entry`, `ChanceOrQuestChance`
Expand Down Expand Up @@ -776,5 +776,14 @@ public function my_replace($matches) {
}

// End of CSWOWD functions

public function GetItemSourceByKey($key) {
$locale = (isset($_SESSION['armoryLocale'])) ? $_SESSION['armoryLocale'] : $this->armoryconfig['defaultLocale'];
$name = $this->aDB->selectCell("SELECT `name_".$locale."` FROM `armory_instance_template` WHERE `id` IN (SELECT `instance_id` FROM `armory_instance_data` WHERE `key`=?)", $key);
if($name) {
return $name;
}
return false;
}
}
?>
201 changes: 200 additions & 1 deletion includes/classes/class.utils.php
Expand Up @@ -3,7 +3,7 @@
/**
* @package World of Warcraft Armory
* @version Release Candidate 1
* @revision 75
* @revision 82
* @copyright (c) 2009-2010 Shadez
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
Expand Down Expand Up @@ -665,5 +665,204 @@ public function GetDeclinedString(&$string) {
}
return $string['string3'];
}

public function AdvancedItemSearch($get_array, $count=false) {
if(!is_array($get_array)) {
return false;
}
$locale = (isset($_SESSION['armoryLocale'])) ? $_SESSION['armoryLocale'] : $this->armoryconfig['defaultLocale'];
$bosses_array = array();
$bosses_keys = array();
$extended_array = array(); // Extended costs for badges
$item_data_tmp = array();
$item_data = array(); // Our search results will be stored here
/*
$get_array structure:
fl[source] => dungeon/pvpAlliance/pvpHorde/quest/reputation,
fl[dungeon] => `armory_instance_template`.`key` (or `armory_item_source`.`key`), // dungeon
fl[boss] => `armory_instance_data`.`key` or 'all' (used only if fl[dungeon] != all)
fl[difficulty] => all/normal/heroic (used only if fl[dungeon] != all)
fl[pvp] => `armory_pvp_sources`.`key` or 'all' // pvpAlliance; pvpHorde
fl[faction] => `armory_reputation_rewards`.`key` or 'all' // reputation
fl[quest] => 0
*/
if(!isset($get_array['difficulty'])) {
$get_array['difficulty'] = 'all';
}
if(!isset($get_array['boss'])) {
$get_array['boss'] = 'all';
}
switch($get_array['source']) {
case 'dungeon':
if($get_array['dungeon'] == 'all') {
switch($get_array['difficulty']) {
case 'normal':
$bosses_array = $this->aDB->select("SELECT `lootid_1` AS `0`, `lootid_2` AS `1` FROM `armory_instance_data`");
break;
case 'heroic':
$bosses_array = $this->aDB->select("SELECT `lootid_3` AS `0`, `lootid_4` AS `1` FROM `armory_instance_data`");
break;
case 'all':
$bosses_array = $this->aDB->select("SELECT `lootid_1` AS `0`, `lootid_2` AS `1`, `lootid_3` AS `2`, `lootid_4` AS `3` FROM `armory_instance_data` LIMIT 50");
break;
}
}
elseif($this->IsExtendedCost($get_array['dungeon'])) {
$item_id = $this->aDB->selectCell("SELECT `item` FROM `armory_item_sources` WHERE `key`=?", $get_array['dungeon']);
if(!$item_id) {
return false;
}
$extended_array = $this->aDB->select("SELECT `id` AS `0` FROM `armory_extended_cost` WHERE `item1`=? OR `item2`=? OR `item3`=? OR `item4`=? OR `item5`=?", $item_id, $item_id, $item_id, $item_id, $item_id);
if(!$extended_array) {
return false;
}
$extended_count = count($extended_array);
$ids_array = array();
$o = 0;
for($i=0;$i<$extended_count;$i++) {
$ids_array[$i] = $this->wDB->select("SELECT `item` AS `0` FROM `npc_vendor` WHERE `ExtendedCost` IN (?a)", $extended_array[$i]);
foreach($ids_array[$i] as $id) {
if($o > 199 && !$count) {
return $item_data;
}
elseif($o > 199 && $count == true) {
return $o;
}
if(!$count) {
$item_data_tmp[$o] = $this->wDB->select("SELECT `entry`, `ItemLevel`, `Quality` FROM `item_template` WHERE `entry` IN (?a)", $id);
$item_data_tmp[$o][0]['name'] = Items::getItemName($item_data_tmp[$o][0]['entry']);
$item_data_tmp[$o][0]['icon'] = Items::getItemIcon($item_data_tmp[$o][0]['entry']);
$item_data[$o] = $item_data_tmp[$o][0];
}
$o++;
}
}
if($count == true) {
return $o;
}
}
else {
if($get_array['boss'] == 'all') {
$instance_data = $this->aDB->selectRow("SELECT `id`, `is_heroic` FROM `armory_instance_template` WHERE `key`=?", $get_array['dungeon']);
if(!$instance_data) {
return false;
}
switch($get_array['difficulty']) {
case 'normal':
$bosses_array = $this->aDB->select("SELECT `lootid_1` AS `0`, `lootid_2` AS `1` FROM `armory_instance_data` WHERE `instance_id`=?", $instance_data['id']);
break;
case 'heroic':
if($instance_data['is_heroic'] == 1) {
$bosses_array = $this->aDB->select("SELECT `lootid_3` AS `0`, `lootid_4` AS `1` FROM `armory_instance_data` WHERE `instance_id`=?", $instance_data['id']);
}
else {
$bosses_array = $this->aDB->select("SELECT `lootid_2` AS `0` FROM `armory_instance_data` WHERE `instance_id`=?", $instance_data['id']);
}
break;
case 'all':
$bosses_array = $this->aDB->select("SELECT `lootid_1` AS `0`, `lootid_2` AS `1`, `lootid_3` AS `2`, `lootid_4` AS `3` FROM `armory_instance_data` WHERE `instance_id`=?", $instance_data['id']);
break;
}
}
else {
$instance_data = $this->aDB->selectRow("SELECT `id`, `is_heroic` FROM `armory_instance_template` WHERE `key`=?", $get_array['dungeon']);
if(!$instance_data) {
return false;
}
switch($get_array['difficulty']) {
case 'normal':
if(is_numeric($get_array['boss'])) {
$bosses_array[0] = $this->aDB->selectRow("SELECT `lootid_1` AS `0`, `lootid_2` AS `1` FROM `armory_instance_data` WHERE `id`=? AND `instance_id`=?", $get_array['boss'], $instance_data['id']);
}
else {
$bosses_array[0] = $this->aDB->selectRow("SELECT `lootid_1` AS `0`, `lootid_2` AS `1` FROM `armory_instance_data` WHERE `key`=? AND `instance_id`=?", $get_array['boss'], $instance_data['id']);
}
break;
case 'heroic':
if($instance_data['is_heroic'] == '1') {
if(is_numeric($get_array['boss'])) {
$bosses_array[0] = $this->aDB->selectRow("SELECT `lootid_3` AS `0`, `lootid_4` AS `1` FROM `armory_instance_data` WHERE `id`=? AND `instance_id`=?", $get_array['boss'], $instance_data['id']);
}
else {
$bosses_array[0] = $this->aDB->selectRow("SELECT `lootid_3` AS `0`, `lootid_4` AS `1` FROM `armory_instance_data` WHERE `key`=? AND `instance_id`=?", $get_array['boss'], $instance_data['id']);
}
}
else {
if(is_numeric($get_array['boss'])) {
$bosses_array[0] = $this->aDB->selectRow("SELECT `lootid_2` AS `0` FROM `armory_instance_data` WHERE `id`=? AND `instance_id`=?", $get_array['boss'], $instance_data['id']);
}
else {
$bosses_array[0] = $this->aDB->selectRow("SELECT `lootid_2` AS `0` FROM `armory_instance_data` WHERE `key`=? AND `instance_id`=?", $get_array['boss'], $instance_data['id']);
}
}
break;
case 'all':
if(is_numeric($get_array['boss'])) {
$bosses_array[0] = $this->aDB->selectRow("SELECT `lootid_1` AS `0`, `lootid_2` AS `1`, `lootid_3` AS `2`, `lootid_4` AS `3` FROM `armory_instance_data` WHERE `id`=? AND `instance_id`=?", $get_array['boss'], $instance_data['id']);
}
else {
$bosses_array[0] = $this->aDB->selectRow("SELECT `lootid_1` AS `0`, `lootid_2` AS `1`, `lootid_3` AS `2`, `lootid_4` AS `3` FROM `armory_instance_data` WHERE `key`=? AND `instance_id`=?", $get_array['boss'], $instance_data['id']);
}
break;
}
}
}
if(!$bosses_array) {
return false;
}
$count_bosses = count($bosses_array);
$ids_array = array();
$o = 0;
for($i=0;$i<$count_bosses;$i++) {
$ids_array[$i] = $this->wDB->select("SELECT `item` AS `0` FROM `creature_loot_template` WHERE `entry` IN (?a)", $bosses_array[$i]);
if(!$ids_array[$i]) {
return false;
}
foreach($ids_array[$i] as $id) {
if($o > 199 && !$count) {
return $item_data;
}
elseif($o > 199 && $count == true) {
return $o;
}
if(!$count) {
$item_data_tmp[$o] = $this->wDB->select("SELECT `entry`, `ItemLevel`, `Quality` FROM `item_template` WHERE `entry` IN (?a)", $id);
$item_data_tmp[$o][0]['name'] = Items::getItemName($item_data_tmp[$o][0]['entry']);
$item_data_tmp[$o][0]['icon'] = Items::getItemIcon($item_data_tmp[$o][0]['entry']);
$item_data[$o] = $item_data_tmp[$o][0];
}
$o++;
}
}
if($count == true) {
return $o;
}
break;

case 'pvpAlliance':
break;

case 'pvpHorde':
break;

case 'reputation':

break;

case 'quest':
break;
}
if($item_data) {
return $item_data;
}
return false;
}

public function IsExtendedCost($key) {
if($key == 'emblemoffrost' || $key == 'emblemoftriumph' || $key == 'emblemofconquest' || $key == 'emblemofvalor' || $key == 'emblemofheroism' || $key == 'badgeofjustice') {
return true;
}
return false;
}
}
?>
4 changes: 3 additions & 1 deletion includes/template/error_page.tpl
Expand Up @@ -137,10 +137,12 @@
</script>
</div>
<script type="text/javascript">
{literal}
function setArmorySearchFocus() {
document.formSearch.armorySearch.focus();
}
window.onload = setArmorySearchFocus;
window.onload = setArmorySearchFocus;
{/literal}
</script>
</div>
</div>

0 comments on commit 101846a

Please sign in to comment.