From 8b9b653028272750a0dfeb8dce256f0092d25c5a Mon Sep 17 00:00:00 2001 From: Sarjuuk Date: Mon, 20 Mar 2017 17:55:06 +0100 Subject: [PATCH] Disables * display db-entries as disabled or unavailable if appropriate * affects now achievements and quests in addition to spells * flag items without source as unavailable * flag quests without starter als unavailable Privileges * i guess i forgott to add the template... ...among other things --- includes/defines.php | 4 +-- includes/markup.class.php | 2 +- includes/types/quest.class.php | 6 ++-- pages/item.php | 2 +- pages/items.php | 2 +- pages/screenshot.php | 2 +- pages/search.php | 4 +-- pages/spell.php | 1 - setup/tools/clisetup/update.func.php | 2 ++ setup/tools/sqlGen.class.php | 4 +-- setup/tools/sqlgen/achievement.func.php | 5 ++++ setup/tools/sqlgen/quests.func.php | 10 +++++-- setup/tools/sqlgen/quests_startend.func.php | 3 ++ setup/tools/sqlgen/source.func.php | 7 ++++- setup/tools/sqlgen/spell.func.php | 4 +-- template/pages/detail-page-generic.tpl.php | 7 ----- template/pages/item.tpl.php | 12 ++++---- template/pages/itemset.tpl.php | 15 +++++----- template/pages/privileges.tpl.php | 33 +++++++++++++++++++++ template/pages/quest.tpl.php | 1 + 20 files changed, 87 insertions(+), 39 deletions(-) create mode 100644 template/pages/privileges.tpl.php diff --git a/includes/defines.php b/includes/defines.php index 0a9e3812..9499d8aa 100644 --- a/includes/defines.php +++ b/includes/defines.php @@ -215,9 +215,9 @@ define('SOUND_TYPE_MP3', 2); define('CUSTOM_HAS_COMMENT', 0x01000000); define('CUSTOM_HAS_SCREENSHOT', 0x02000000); define('CUSTOM_HAS_VIDEO', 0x04000000); -define('CUSTOM_DISABLED', 0x08000000); +define('CUSTOM_DISABLED', 0x08000000); // contained in world.disables define('CUSTOM_SERVERSIDE', 0x10000000); -define('CUSTOM_UNAVAILABLE', 0x20000000); +define('CUSTOM_UNAVAILABLE', 0x20000000); // no source for X or questFlag define('CUSTOM_EXCLUDE_FOR_LISTVIEW', 0x40000000); // will not show up in search or on listPage (override for staff) // Custom Flags (per type) diff --git a/includes/markup.class.php b/includes/markup.class.php index d2d1809e..2f2bec18 100644 --- a/includes/markup.class.php +++ b/includes/markup.class.php @@ -21,7 +21,7 @@ class Markup public function parseGlobalsFromText(&$jsg = []) { - if (preg_match_all('/(?text, $matches, PREG_SET_ORDER)) + if (preg_match_all('/(?text, $matches, PREG_SET_ORDER)) { foreach ($matches as $match) { diff --git a/includes/types/quest.class.php b/includes/types/quest.class.php index 5f24d740..06acbc98 100644 --- a/includes/types/quest.class.php +++ b/includes/types/quest.class.php @@ -249,6 +249,8 @@ class QuestList extends BaseType // if ($this->isRepeatable()) // dafuque..? says repeatable and is used as 'disabled'..? // $data[$this->id]['wflags'] |= QUEST_CU_REPEATABLE; + if ($this->curTpl['cuFlags'] & (CUSTOM_UNAVAILABLE | CUSTOM_DISABLED)) + $data[$this->id]['wflags'] |= QUEST_CU_REPEATABLE; if ($this->curTpl['flags'] & QUEST_FLAG_DAILY) { @@ -505,9 +507,9 @@ class QuestListFilter extends Filter if ($this->int2Bool($cr[1])) { if ($cr[1]) - return ['AND', [['cuFlags', CUSTOM_EXCLUDE_FOR_LISTVIEW, '&'], 0], [['flags', QUEST_FLAG_UNAVAILABLE, '&'], 0]]; + return [['cuFlags', CUSTOM_UNAVAILABLE | CUSTOM_DISABLED, '&'], 0]; else - return ['OR', ['cuFlags', CUSTOM_EXCLUDE_FOR_LISTVIEW, '&'], ['flags', QUEST_FLAG_UNAVAILABLE, '&']]; + return ['cuFlags', CUSTOM_UNAVAILABLE | CUSTOM_DISABLED, '&']; } break; case 23: // itemchoices [op] [int] diff --git a/pages/item.php b/pages/item.php index 56db9ecc..7dfc2b5c 100644 --- a/pages/item.php +++ b/pages/item.php @@ -374,7 +374,7 @@ class ItemPage extends genericPage ); // availablility - $this->disabled = false; // todo (med): get itemSources (which are not yet in DB :x) or + $this->unavailable = $this->subject->getField('cuFlags') & CUSTOM_UNAVAILABLE; // subItems $this->subject->initSubItems(); diff --git a/pages/items.php b/pages/items.php index 271a7200..dfb5a494 100644 --- a/pages/items.php +++ b/pages/items.php @@ -452,7 +452,7 @@ class ItemsPage extends GenericPage $form = $this->filterObj->getForm('form'); if (count($this->path) == 4 && $this->category[0] == 4 && isset($form['sl']) && !is_array($form['sl'])) $this->path[] = $form['sl']; - else if ($this->category[0] == 0 && isset($form['ty']) && !is_array($form['ty'])) + else if (!empty($this->category[0]) && $this->category[0] == 0 && isset($form['ty']) && !is_array($form['ty'])) $this->path[] = $form['ty']; } diff --git a/pages/screenshot.php b/pages/screenshot.php index d0b14bcd..86fe3e4c 100644 --- a/pages/screenshot.php +++ b/pages/screenshot.php @@ -107,7 +107,7 @@ class ScreenshotPage extends GenericPage { $this->imgHash = Util::createHash(16); - if (User::$banStatus & ACC_BAN_SCREENSHOT) + if (User::canUploadScreenshot()) { $_SESSION['error']['ss'] = Lang::screenshot('error', 'notAllowed'); return false; diff --git a/pages/search.php b/pages/search.php index 6c4cfd1e..016c0f9b 100644 --- a/pages/search.php +++ b/pages/search.php @@ -943,7 +943,7 @@ class SearchPage extends GenericPage { $cnd = array_merge($cndBase, array( [['flagsExtra', 0x80], 0], // exclude trigger creatures - // [['cuFlags', MASK, '&'], 0], // todo (med): exclude difficulty entries + [['cuFlags', NPC_CU_DIFFICULTY_DUMMY, '&'], 0], // exclude difficulty entries $this->createLookup() )); $npcs = new CreatureList($cnd); @@ -977,7 +977,7 @@ class SearchPage extends GenericPage private function _searchQuest($cndBase) // 15 Quests $searchMask & 0x0008000 { $cnd = array_merge($cndBase, array( - // [['cuFlags', MASK, '&'], 0], // todo (med): identify disabled quests + [['flags', CUSTOM_UNAVAILABLE | CUSTOM_DISABLED, '&'], 0], $this->createLookup() )); $quests = new QuestList($cnd); diff --git a/pages/spell.php b/pages/spell.php index cb5d5fe9..4ac18787 100644 --- a/pages/spell.php +++ b/pages/spell.php @@ -274,7 +274,6 @@ class SpellPage extends GenericPage $this->school = [Util::asHex($this->subject->getField('schoolMask')), Lang::getMagicSchools($this->subject->getField('schoolMask'))]; $this->dispel = $this->subject->getField('dispelType') ? Lang::game('dt', $this->subject->getField('dispelType')) : null; $this->mechanic = $this->subject->getField('mechanic') ? Lang::game('me', $this->subject->getField('mechanic')) : null; - $this->unavailable = $this->subject->getField('cuFlags') & CUSTOM_UNAVAILABLE; $this->redButtons = $redButtons; // minRange exists.. prepend diff --git a/setup/tools/clisetup/update.func.php b/setup/tools/clisetup/update.func.php index 4c919f59..c8c197f0 100644 --- a/setup/tools/clisetup/update.func.php +++ b/setup/tools/clisetup/update.func.php @@ -23,6 +23,8 @@ function update() $pi = pathinfo($file); list($fDate, $fPart) = explode('_', $pi['filename']); + $fData = intVal($fDate); + if ($date && $fDate < $date) continue; else if ($part && $date && $fDate == $date && $fPart <= $part) diff --git a/setup/tools/sqlGen.class.php b/setup/tools/sqlGen.class.php index 125e4dc3..4946017d 100644 --- a/setup/tools/sqlGen.class.php +++ b/setup/tools/sqlGen.class.php @@ -54,13 +54,13 @@ class SqlGen 'emotes' => [null, null, null, null], 'sounds' => [null, null, null, null], 'itemenchantment' => [null, null, null, ['spell_enchant_proc_data']], - 'achievement' => [null, null, null, ['dbc_achievement']], + 'achievement' => [null, null, null, ['dbc_achievement', 'disables']], 'creature' => [null, null, null, ['creature_template', 'creature_template_locale', 'creature_classlevelstats', 'instance_encounters']], 'currencies' => [null, null, null, ['item_template', 'locales_item']], 'events' => [null, null, null, ['game_event', 'game_event_prerequisite']], 'objects' => [null, null, null, ['gameobject_template', 'gameobject_template_locale', 'gameobject_questitem']], 'pet' => [null, null, null, ['creature_template', 'creature']], - 'quests' => [null, null, null, ['quest_template', 'quest_template_addon', 'locales_quest', 'game_event', 'game_event_seasonal_questrelation']], + 'quests' => [null, null, null, ['quest_template', 'quest_template_addon', 'locales_quest', 'game_event', 'game_event_seasonal_questrelation', 'disables']], 'quests_startend' => [null, null, null, ['creature_queststarter', 'creature_questender', 'game_event_creature_quest', 'gameobject_queststarter', 'gameobject_questender', 'game_event_gameobject_quest', 'item_template']], 'spell' => [null, null, null, ['skill_discovery_template', 'item_template', 'creature_template', 'creature_template_addon', 'smart_scripts', 'npc_trainer', 'disables', 'spell_ranks', 'spell_dbc']], 'spelldifficulty' => [null, null, null, ['spelldifficulty_dbc']], diff --git a/setup/tools/sqlgen/achievement.func.php b/setup/tools/sqlgen/achievement.func.php index 89eae271..c2fbcb24 100644 --- a/setup/tools/sqlgen/achievement.func.php +++ b/setup/tools/sqlgen/achievement.func.php @@ -9,6 +9,7 @@ if (!CLI) /* deps: * dbc_achievement + * disables */ // Higher Learning - item rewarded through gossip @@ -60,6 +61,10 @@ function achievement(array $ids = []) } } + // apply disables + if ($criteria = DB::World()->selectCol('SELECT entry FROM disables WHERE sourceType = 4')) + DB::Aowow()->query('UPDATE aowow_achievement a JOIN aowow_achievementcriteria ac ON a.id = ac.refAchievementId SET a.cuFlags = ?d WHERE ac.id IN (?a)', CUSTOM_DISABLED, $criteria); + return true; } diff --git a/setup/tools/sqlgen/quests.func.php b/setup/tools/sqlgen/quests.func.php index 4dfdaca0..f5928f87 100644 --- a/setup/tools/sqlgen/quests.func.php +++ b/setup/tools/sqlgen/quests.func.php @@ -13,6 +13,7 @@ if (!CLI) * locales_quest * game_event * game_event_seasonal_questrelation + * disables */ @@ -39,9 +40,12 @@ function quests(array $ids = []) IFNULL(qa.NextQuestId, 0), IFNULL(qa.ExclusiveGroup, 0), RewardNextQuest, - Flags, + q.Flags, IFNULL(qa.SpecialFlags, 0), - 0 AS cuFlags, -- cuFlags + ( + IF(d.entry IS NULL, 0, 134217728) + -- disabled + IF(q.Flags & 16384, 536870912, 0) -- unavailable + ) AS cuFlags, -- cuFlags IFNULL(qa.AllowableClasses, 0), AllowableRaces, IFNULL(qa.RequiredSkillId, 0), IFNULL(qa.RequiredSkillPoints, 0), @@ -101,6 +105,8 @@ function quests(array $ids = []) locales_quest lq ON q.ID = lq.Id LEFT JOIN game_event_seasonal_questrelation gesqr ON gesqr.questId = q.ID + LEFT JOIN + disables d ON d.entry = q.ID AND d.sourceType = 1 WHERE q.Id > ?d { diff --git a/setup/tools/sqlgen/quests_startend.func.php b/setup/tools/sqlgen/quests_startend.func.php index 0744bc83..391c038c 100644 --- a/setup/tools/sqlgen/quests_startend.func.php +++ b/setup/tools/sqlgen/quests_startend.func.php @@ -48,6 +48,9 @@ function quests_startend(/* array $ids = [] */) DB::Aowow()->query('INSERT INTO ?_quests_startend (?#) VALUES (?a) ON DUPLICATE KEY UPDATE method = method | VALUES(method), eventId = IF(eventId = 0, VALUES(eventId), eventId)', array_keys($d), array_values($d)); } + // update quests without start as unavailable + Db::Aowow()->query('UPDATE ?_quests q LEFT JOIN ?_quests_startend qse ON qse.questId = q.id AND qse.method & 1 SET q.cuFlags = q.cuFlags | ?d WHERE qse.questId IS NULL', CUSTOM_UNAVAILABLE); + return true; } diff --git a/setup/tools/sqlgen/source.func.php b/setup/tools/sqlgen/source.func.php index 70f9ac14..dccbc377 100644 --- a/setup/tools/sqlgen/source.func.php +++ b/setup/tools/sqlgen/source.func.php @@ -406,7 +406,8 @@ function source(array $ids = []) SELECT RewardItem1 AS item, ID, COUNT(1) AS qty, IF(AllowableRaces & 0x2B2 AND !(AllowableRaces & 0x44D), 2, IF(AllowableRaces & 0x44D AND !(AllowableRaces & 0x2B2), 1, 3)) AS side FROM quest_template WHERE RewardItem1 > 0 GROUP BY item UNION SELECT RewardItem2 AS item, ID, COUNT(1) AS qty, IF(AllowableRaces & 0x2B2 AND !(AllowableRaces & 0x44D), 2, IF(AllowableRaces & 0x44D AND !(AllowableRaces & 0x2B2), 1, 3)) AS side FROM quest_template WHERE RewardItem2 > 0 GROUP BY item UNION SELECT RewardItem3 AS item, ID, COUNT(1) AS qty, IF(AllowableRaces & 0x2B2 AND !(AllowableRaces & 0x44D), 2, IF(AllowableRaces & 0x44D AND !(AllowableRaces & 0x2B2), 1, 3)) AS side FROM quest_template WHERE RewardItem3 > 0 GROUP BY item UNION - SELECT RewardItem4 AS item, ID, COUNT(1) AS qty, IF(AllowableRaces & 0x2B2 AND !(AllowableRaces & 0x44D), 2, IF(AllowableRaces & 0x44D AND !(AllowableRaces & 0x2B2), 1, 3)) AS side FROM quest_template WHERE RewardItem4 > 0 GROUP BY item + SELECT RewardItem4 AS item, ID, COUNT(1) AS qty, IF(AllowableRaces & 0x2B2 AND !(AllowableRaces & 0x44D), 2, IF(AllowableRaces & 0x44D AND !(AllowableRaces & 0x2B2), 1, 3)) AS side FROM quest_template WHERE RewardItem4 > 0 GROUP BY item UNION + SELECT StartItem AS item, ID, COUNT(1) AS qty, IF(AllowableRaces & 0x2B2 AND !(AllowableRaces & 0x44D), 2, IF(AllowableRaces & 0x44D AND !(AllowableRaces & 0x2B2), 1, 3)) AS side FROM quest_template WHERE StartItem > 0 GROUP BY item ) n JOIN item_template it ON it.entry = n.item GROUP BY item' ); @@ -993,6 +994,7 @@ function source(array $ids = []) if ($spellBuff) DB::Aowow()->query(queryfy('[V]', $spellBuff, $insMore), 22, 22, 22); + ############### # 23: Skinned # ############### @@ -1044,6 +1046,9 @@ function source(array $ids = []) DB::Aowow()->query(queryfy('[V]', $spellBuff, $insMore), 23, 23, 23); + // flagging aowow_items for source (note: this is not exact! creatures dropping items may not be spawnd, quests granting items may be disabled) + DB::Aowow()->query('UPDATE ?_items SET cuFlags = cuFlags & ?d', ~CUSTOM_UNAVAILABLE); + DB::Aowow()->query('UPDATE ?_items i LEFT JOIN ?_source s ON s.typeId = i.id AND s.type = ?d SET i.cuFlags = i.cuFlags | ?d WHERE s.typeId IS NULL', TYPE_ITEM, CUSTOM_UNAVAILABLE); /*********/ /* Spell */ diff --git a/setup/tools/sqlgen/spell.func.php b/setup/tools/sqlgen/spell.func.php index f213fc7d..7260824b 100644 --- a/setup/tools/sqlgen/spell.func.php +++ b/setup/tools/sqlgen/spell.func.php @@ -257,8 +257,8 @@ function spell() if ($serverside) DB::Aowow()->query('UPDATE ?_spell SET cuFlags = cuFlags | ?d WHERE id IN (?a)', CUSTOM_SERVERSIDE, $serverside); - // apply flag: CUSTOM_DISABLED - if ($disables = DB::World()->selectCol('SELECT entry FROM disables WHERE sourceType = 0 AND flags & 0xD')) // 0xD: players (0x1), pets (0x4), general (0x8) + // apply flag: CUSTOM_DISABLED [0xD: players (0x1), pets (0x4), general (0x8); only generally disabled spells] + if ($disables = DB::World()->selectCol('SELECT entry FROM disables WHERE sourceType = 0 AND params_0 = "" AND params_1 = "" AND flags & 0xD')) DB::Aowow()->query('UPDATE ?_spell SET cuFlags = cuFlags | ?d WHERE id IN (?a)', CUSTOM_DISABLED, $disables); // apply spell ranks (can't use skilllineability.dbc, as it does not contain ranks for non-player/pet spells) diff --git a/template/pages/detail-page-generic.tpl.php b/template/pages/detail-page-generic.tpl.php index 5a03ee9d..1a397203 100644 --- a/template/pages/detail-page-generic.tpl.php +++ b/template/pages/detail-page-generic.tpl.php @@ -40,13 +40,6 @@ if (isset($this->extraText)): unavailable)): -?> -
- -transfer)): echo "
\n ".$this->transfer."\n"; endif; diff --git a/template/pages/item.tpl.php b/template/pages/item.tpl.php index 8717f9a6..9ea64d2b 100644 --- a/template/pages/item.tpl.php +++ b/template/pages/item.tpl.php @@ -16,19 +16,19 @@ brick('redButtons'); ?>

name; ?>

- brick('tooltip'); - - $this->brick('article'); - -if ($this->disabled): +if ($this->unavailable): ?>
+
brick('tooltip'); + + $this->brick('article'); + if (!empty($this->transfer)): echo "
\n ".$this->transfer."\n"; endif; diff --git a/template/pages/itemset.tpl.php b/template/pages/itemset.tpl.php index 51224dde..92944936 100644 --- a/template/pages/itemset.tpl.php +++ b/template/pages/itemset.tpl.php @@ -21,7 +21,13 @@ if ($this->expansion): else: echo '

'.$this->name."

\n"; endif; - +if ($this->unavailable): +?> +
+ +
+brick('article'); echo $this->description; @@ -52,13 +58,6 @@ endforeach; ?> //]]> -unavailable): -?> -
- - -

bonusExt; ?>

diff --git a/template/pages/privileges.tpl.php b/template/pages/privileges.tpl.php new file mode 100644 index 00000000..bf49e25b --- /dev/null +++ b/template/pages/privileges.tpl.php @@ -0,0 +1,33 @@ +brick('header'); ?> + +
+
+
+ +brick('announcement'); + + $this->brick('pageTemplate'); +?> + +
+

+
+

+

+ + + +privileges as $id => list($earned, $name, $value)): + echo ' \n"; + endforeach; +?> + +
 
'.$name.'
'.Lang::nf($value)."
+
+
+
+
+ +brick('footer'); ?> diff --git a/template/pages/quest.tpl.php b/template/pages/quest.tpl.php index ee706e52..60f09105 100644 --- a/template/pages/quest.tpl.php +++ b/template/pages/quest.tpl.php @@ -19,6 +19,7 @@ unavailable): ?>
+