* 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
This commit is contained in:
Sarjuuk
2017-03-20 17:55:06 +01:00
parent 4f1854b138
commit 8b9b653028
20 changed files with 87 additions and 39 deletions

View File

@@ -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)

View File

@@ -21,7 +21,7 @@ class Markup
public function parseGlobalsFromText(&$jsg = [])
{
if (preg_match_all('/(?<!\\\\)\[(npc|object|item|itemset|quest|spell|zone|faction|pet|achievement|statistic|title|event|class|race|skill|currency|emote|enchantment|money)=(-?\d+)[^\]]*\]/i', $this->text, $matches, PREG_SET_ORDER))
if (preg_match_all('/(?<!\\\\)\[(npc|object|item|itemset|quest|spell|zone|faction|pet|achievement|statistic|title|event|class|race|skill|currency|emote|enchantment|money|sound)=(-?\d+)[^\]]*\]/i', $this->text, $matches, PREG_SET_ORDER))
{
foreach ($matches as $match)
{

View File

@@ -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]

View File

@@ -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();

View File

@@ -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'];
}

View File

@@ -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;

View File

@@ -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);

View File

@@ -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

View File

@@ -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)

View File

@@ -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']],

View File

@@ -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;
}

View File

@@ -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
{

View File

@@ -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;
}

View File

@@ -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 */

View File

@@ -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)

View File

@@ -40,13 +40,6 @@ if (isset($this->extraText)):
<?php
endif;
if (isset($this->unavailable)):
?>
<div class="pad"></div>
<b style="color: red"><?php echo Lang::main('_unavailable'); ?></b>
<?php
endif;
if (!empty($this->transfer)):
echo " <div class=\"pad\"></div>\n ".$this->transfer."\n";
endif;

View File

@@ -16,19 +16,19 @@
<?php $this->brick('redButtons'); ?>
<h1><?php echo $this->name; ?></h1>
<?php
$this->brick('tooltip');
$this->brick('article');
if ($this->disabled):
if ($this->unavailable):
?>
<div class="pad"></div>
<b style="color: red"><?php echo Lang::item('_unavailable'); ?></b>
<div class="pad"></div>
<?php
endif;
$this->brick('tooltip');
$this->brick('article');
if (!empty($this->transfer)):
echo " <div class=\"pad\"></div>\n ".$this->transfer."\n";
endif;

View File

@@ -21,7 +21,13 @@ if ($this->expansion):
else:
echo ' <h1>'.$this->name."</h1>\n";
endif;
if ($this->unavailable):
?>
<div class="pad"></div>
<b style="color: red"><?=Lang::itemset('_unavailable'); ?></b>
<div class="pad"></div>
<?php
endif;
$this->brick('article');
echo $this->description;
@@ -52,13 +58,6 @@ endforeach;
?>
//]]></script>
<?php
if ($this->unavailable):
?>
<div class="pad"></div>
<b style="color: red"><?=Lang::itemset('_unavailable'); ?></b>
<?php endif; ?>
<h3><?=Lang::itemset('_setBonuses').$this->bonusExt; ?></h3>
<?=" ".Lang::itemset('_conveyBonus')."\n"; ?>

View File

@@ -0,0 +1,33 @@
<?php $this->brick('header'); ?>
<div class="main" id="main">
<div class="main-precontents" id="main-precontents"></div>
<div class="main-contents" id="main-contents">
<?php
$this->brick('announcement');
$this->brick('pageTemplate');
?>
<div class="text">
<h1><?=Lang::privileges('privileges');?></h1>
<div style="float:right;line-height:1.2;max-width:410px;overflow:hidden;text-align:center"><img class="border" alt="" src="<?=STATIC_URL;?>/images/help/privileges/example.jpg" /></div>
<p><?=Lang::privileges('main');?></p>
<br><br>
<table class="wsa-list wsa-tbl">
<thead><th><?=Lang::privileges('privilege');?></th><th><?=Lang::privileges('requiredRep');?></th></thead>
<tbody>
<?php
foreach ($this->privileges as $id => list($earned, $name, $value)):
echo ' <tr'.($earned ? ' class="wsa-earned"' : '').'><td><div class="wsa-check" style="float:left;margin:0 3px 0 0">&nbsp;</div><a href="?privilege='.$id.'">'.$name.'</a></td><td class="number-right"><span>'.Lang::nf($value)."</span></td></tr>\n";
endforeach;
?>
</tbody>
</table>
</div>
<div class="clear"></div>
</div><!-- main-contents -->
</div><!-- main -->
<?php $this->brick('footer'); ?>

View File

@@ -19,6 +19,7 @@
<?php if ($this->unavailable): ?>
<div class="pad"></div>
<b style="color: red"><?php echo Lang::quest('unavailable'); ?></b>
<div class="pad"></div>
<?php
endif;