當前位置: 首頁>>代碼示例>>PHP>>正文


PHP WoW::GetFilters方法代碼示例

本文整理匯總了PHP中WoW::GetFilters方法的典型用法代碼示例。如果您正苦於以下問題:PHP WoW::GetFilters方法的具體用法?PHP WoW::GetFilters怎麽用?PHP WoW::GetFilters使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在WoW的用法示例。


在下文中一共展示了WoW::GetFilters方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: GetFilterForNPCs

 private static function GetFilterForNPCs()
 {
     $filter_string = null;
     $andOr = 1;
     $all_filters = WoW::GetFilters();
     if (is_array($all_filters)) {
         foreach ($all_filters as $filter) {
             if (!isset($filter['key']) || !isset($filter['values'])) {
                 continue;
             }
             $val_count = count($filter['values']);
             switch ($filter['key']) {
                 // Family
                 case 'fa':
                     if ($val_count == 1) {
                         $filter_string .= '{COND} `a`.`family` = ' . $filter['values'][0];
                     } else {
                         $filter_string .= '{COND} `a`.`family` IN (';
                         self::ApplyMultiFiltersToString($val_count, $filter, $filter_string);
                     }
                     break;
             }
         }
     }
     return str_replace('{COND}', $andOr == 2 ? 'OR' : 'AND', $filter_string);
 }
開發者ID:Kheros,項目名稱:wowhead,代碼行數:26,代碼來源:class.npcs.php

示例2: GetFiltersForItems

 private static function GetFiltersForItems()
 {
     $filter_string = null;
     $andOr = 1;
     $all_filters = WoW::GetFilters();
     if (is_array($all_filters)) {
         foreach ($all_filters as $filter) {
             if (!isset($filter['key']) || !isset($filter['values'])) {
                 continue;
             }
             $val_count = count($filter['values']);
             switch ($filter['key']) {
                 // Name
                 case 'na':
                     if (WoW_Locale::GetLocaleID() > 0) {
                         $filter_string .= sprintf(" {COND} ((`b`.`name_loc%d` LIKE '%s') OR (`a`.`name` LIKE '%s'))", WoW_Locale::GetLocaleID(), '%' . $filter['values'][0] . '%', '%' . $filter['values'][0] . '%');
                     } else {
                         $filter_string .= sprintf("' {COND} `a`.`name` LIKE '%s'", '%' . $filter['values'][0] . '%');
                     }
                     break;
                     // Quality
                 // Quality
                 case 'qu':
                     if ($val_count == 1) {
                         $filter_string .= sprintf(' {COND} `a`.`Quality` = %d', $filter['values'][0]);
                     } else {
                         $filter_string .= ' {COND} `a`.`Quality` IN ( ';
                         self::ApplyMultiFiltersToString($val_count, $filter, $filter_string);
                     }
                     break;
                     // Min item level
                 // Min item level
                 case 'minle':
                     $filter_string .= sprintf(' {COND} `a`.`ItemLevel` >= %d', $filter['values'][0]);
                     break;
                     // Max item level
                 // Max item level
                 case 'maxle':
                     $filter_string .= sprintf(' {COND} `a`.`ItemLevel` <= %d', $filter['values'][0]);
                     break;
                     // At least one?
                 // At least one?
                 case 'ma':
                     if ($filter['values'][0] == 1) {
                         $andOr = 2;
                     }
                     break;
                     // Min req level
                 // Min req level
                 case 'minrl':
                     $filter_string .= sprintf(' {COND} `a`.`RequiredLevel` >= %d', $filter['values'][0]);
                     break;
                     // Max req level
                 // Max req level
                 case 'maxrl':
                     $filter_string .= sprintf(' {COND} `a`.`RequiredLevel` <= %d', $filter['values'][0]);
                     break;
                     // Slot
                 // Slot
                 case 'sl':
                     if ($val_count == 1) {
                         $filter_string .= sprintf(' {COND} `a`.`InventoryType` = %d', $filter['values'][0]);
                         WoW_Template::SetPageData('breadcrumb', WoW_Template::GetPageData('breadcrumb') . ',' . $filter['values'][0]);
                     } else {
                         $filter_string .= ' {COND} `a`.`InventoryType` IN( ';
                         self::ApplyMultiFiltersToString($val_count, $filter, $filter_string);
                     }
                     break;
                     // Side
                 // Side
                 case 'si':
                     switch ($filter['values'][0]) {
                         case -1:
                             // Alliance only
                             $filter_string .= ' {COND} `a`.`AllowableRace` = ' . WoW_Utils::GetFactionBitMaskByFactionId(FACTION_ALLIANCE);
                             break;
                         case 1:
                             // Alliance
                             $filter_string .= ' {COND} `a`.`AllowableRace` & ' . WoW_Utils::GetFactionBitMaskByFactionId(FACTION_ALLIANCE);
                             break;
                         case -2:
                             // Horde only
                             $filter_string .= ' {COND} `a`.`AllowableRace` = ' . WoW_Utils::GetFactionBitMaskByFactionId(FACTION_HORDE);
                             break;
                         case 2:
                             // Horde
                             $filter_string .= ' {COND} `a`.`AllowableRace` & ' . WoW_Utils::GetFactionBitMaskByFactionId(FACTION_HORDE);
                             break;
                         default:
                             // Skip "3" - useable by all
                             break;
                     }
                     break;
                     // Useable by class ID
                 // Useable by class ID
                 case 'ub':
                     if (!($filter['values'][0] < CLASS_WARRIOR) && !($filter['values'][0] >= MAX_CLASSES)) {
                         $filter_string .= ' {COND} `a`.`AllowableClass` & ' . WoW_Utils::GetClassBitMaskByClassId($filter['values'][0]);
                     }
                     break;
//.........這裏部分代碼省略.........
開發者ID:Kheros,項目名稱:wowhead,代碼行數:101,代碼來源:class.items.php


注:本文中的WoW::GetFilters方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。