From 8394a3863f329d877bb6e270a5d09c438210ece4 Mon Sep 17 00:00:00 2001 From: Sarjuuk Date: Sat, 15 Aug 2015 00:09:48 +0200 Subject: [PATCH] Misc * added column bitIdx to ?_titles * actually don't use COLLATE as it ignores indizes. Just search with lowerCase and properCase simultaneously --- includes/types/basetype.class.php | 9 +++------ includes/types/creature.class.php | 3 ++- includes/utilities.php | 7 ++++++- setup/db_structure.sql | 4 +++- setup/tools/dbc.class.php | 4 ++-- setup/tools/sqlgen/titles.func.php | 2 +- setup/updates/1439590146_01.sql | 7 +++++++ 7 files changed, 24 insertions(+), 12 deletions(-) create mode 100644 setup/updates/1439590146_01.sql diff --git a/includes/types/basetype.class.php b/includes/types/basetype.class.php index fe221e95..a34a2bb4 100644 --- a/includes/types/basetype.class.php +++ b/includes/types/basetype.class.php @@ -169,9 +169,6 @@ abstract class BaseType } else if (is_string($c[1])) { - if (!empty($miscData['forceCiCollate'])) - $field .= ' COLLATE utf8_general_ci'; - $op = (isset($c[2]) && $c[2] == '!') ? 'NOT LIKE' : 'LIKE'; $val = DB::Aowow()->escape($c[1]); } @@ -1031,10 +1028,10 @@ abstract class Filter private function genericString($field, $value, $localized) { - if (!$localized) - return [$field, (string)$value]; + if ($localized) + $field .= '_loc'.User::$localeId; - return $this->modularizeString([$field.'_loc'.User::$localeId], $value); + return $this->modularizeString([$field], (string)$value); } private function genericNumeric($field, &$value, $op, $castInt) diff --git a/includes/types/creature.class.php b/includes/types/creature.class.php index 58256930..8349f3ec 100644 --- a/includes/types/creature.class.php +++ b/includes/types/creature.class.php @@ -76,7 +76,8 @@ class CreatureList extends BaseType if ($type) $row3[] = Lang::game('ct', $type); - $row3[] = '('.Lang::npc('rank', $this->curTpl['rank']).')'; + if ($_ = Lang::npc('rank', $this->curTpl['rank'])) + $row3[] = '('.$_.')'; $x = ''; $x .= ''; diff --git a/includes/utilities.php b/includes/utilities.php index f92f8438..b65a4eec 100644 --- a/includes/utilities.php +++ b/includes/utilities.php @@ -1112,6 +1112,11 @@ class Util return mb_convert_case($str, MB_CASE_TITLE, 'UTF-8'); } + public static function lower($str) + { + return mb_strtolower($str, 'UTF-8'); + } + // note: valid integer > 32bit are returned as float public static function checkNumeric(&$data) { @@ -1592,7 +1597,7 @@ class Util return false; } - private static $realms; + private static $realms = []; public static function getRealms() { if (DB::isConnectable(DB_AUTH) && !self::$realms) diff --git a/setup/db_structure.sql b/setup/db_structure.sql index 85c99d94..80ef19c8 100644 --- a/setup/db_structure.sql +++ b/setup/db_structure.sql @@ -2278,6 +2278,7 @@ CREATE TABLE `aowow_titles` ( `expansion` tinyint(3) unsigned NOT NULL, `src12Ext` mediumint(9) unsigned NOT NULL, `eventId` smallint(5) unsigned NOT NULL, + `bitIdx` tinyint(3) unsigned NOT NULL, `male_loc0` varchar(33) NOT NULL, `male_loc2` varchar(35) NOT NULL, `male_loc3` varchar(37) NOT NULL, @@ -2288,7 +2289,8 @@ CREATE TABLE `aowow_titles` ( `female_loc3` varchar(39) NOT NULL, `female_loc6` varchar(35) NOT NULL, `female_loc8` varchar(41) NOT NULL, - PRIMARY KEY (`id`) + PRIMARY KEY (`id`), + INDEX `bitIdx` (`bitIdx`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; diff --git a/setup/tools/dbc.class.php b/setup/tools/dbc.class.php index 365f55fe..09db7886 100644 --- a/setup/tools/dbc.class.php +++ b/setup/tools/dbc.class.php @@ -48,7 +48,7 @@ class DBC 'battlemasterlist' => 'niixxxxxxixxxxxxxxxxxxxxxxxxixii', 'charbaseinfo' => 'bb', 'charstartoutfit' => 'nbbbXiiiiiiiiiiiiiiiiiiiixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', - 'chartitles' => 'nxsxssxxsxsxxxxxxxxsxssxxsxsxxxxxxxxx', + 'chartitles' => 'nxsxssxxsxsxxxxxxxxsxssxxsxsxxxxxxxxi', 'chrclasses' => 'nxixsxssxxsxsxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxsxixi', 'chrraces' => 'niixxxxixxxsxisxssxxsxsxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxi', 'creaturedisplayinfo' => 'nixixxssssxxxxxx', @@ -130,7 +130,7 @@ class DBC 'battlemasterlist' => 'Id,mapId,moreMapId,areaType,maxPlayers,minLevel,maxLevel', 'charbaseinfo' => 'raceId,classId', 'charstartoutfit' => 'Id,raceId,classId,gender,item1,item2,item3,item4,item5,item6,item7,item8,item9,item10,item11,item12,item13,item14,item15,item16,item17,item18,item19,item20', - 'chartitles' => 'Id,male_loc0,male_loc2,male_loc3,male_loc6,male_loc8,female_loc0,female_loc2,female_loc3,female_loc6,female_loc8', + 'chartitles' => 'Id,male_loc0,male_loc2,male_loc3,male_loc6,male_loc8,female_loc0,female_loc2,female_loc3,female_loc6,female_loc8,bitIdx', 'chrclasses' => 'Id,powerType,name_loc0,name_loc2,name_loc3,name_loc6,name_loc8,fileString,flags,expansion', 'chrraces' => 'Id,flags,factionId,baseLanguage,fileString,side,name_loc0,name_loc2,name_loc3,name_loc6,name_loc8,expansion', 'creaturedisplayinfo' => 'Id,modelid,extraInfoId,skin1,skin2,skin3,iconString', diff --git a/setup/tools/sqlgen/titles.func.php b/setup/tools/sqlgen/titles.func.php index 21382c03..65411dba 100644 --- a/setup/tools/sqlgen/titles.func.php +++ b/setup/tools/sqlgen/titles.func.php @@ -49,7 +49,7 @@ function titles() WHERE qt.RewardTitle <> 0'; - DB::Aowow()->query('REPLACE INTO ?_titles SELECT Id, 0, 0, 0, 0, 0, 0, 0, male_loc0, male_loc2, male_loc3, male_loc6, male_loc8, female_loc0, female_loc2, female_loc3, female_loc6, female_loc8 FROM dbc_chartitles'); + DB::Aowow()->query('REPLACE INTO ?_titles SELECT Id, 0, 0, 0, 0, 0, 0, 0, bitIdx, male_loc0, male_loc2, male_loc3, male_loc6, male_loc8, female_loc0, female_loc2, female_loc3, female_loc6, female_loc8 FROM dbc_chartitles'); // hide unused titles DB::Aowow()->query('UPDATE ?_titles SET cuFlags = ?d WHERE id BETWEEN 85 AND 123 AND id NOT IN (113, 120, 121, 122)', CUSTOM_EXCLUDE_FOR_LISTVIEW); diff --git a/setup/updates/1439590146_01.sql b/setup/updates/1439590146_01.sql new file mode 100644 index 00000000..fec077a0 --- /dev/null +++ b/setup/updates/1439590146_01.sql @@ -0,0 +1,7 @@ +ALTER TABLE `aowow_titles` + ADD COLUMN `bitIdx` tinyint(3) unsigned NOT NULL AFTER `eventId`, + ADD INDEX `bitIdx` (`bitIdx`); + +DROP TABLE IF EXISTS `dbc_chartitles`; + +UPDATE `aowow_dbversion` SET `sql` = CONCAT(`sql`, ' titles');
'.$this->getField('name', true).'