mirror of
https://github.com/Sarjuuk/aowow.git
synced 2025-11-29 15:58:16 +08:00
Itemset/Listpage
* implement filter: available to players
This commit is contained in:
@@ -18,7 +18,8 @@ class ItemsetList extends BaseType
|
||||
protected $queryBase = 'SELECT `set`.*, `set`.id AS ARRAY_KEY FROM ?_itemset `set`';
|
||||
protected $queryOpts = array(
|
||||
'set' => ['o' => 'maxlevel DESC'],
|
||||
'e' => ['j' => ['?_events e ON e.id = `set`.eventId', true], 's' => ', e.holidayId']
|
||||
'e' => ['j' => ['?_events e ON `e`.`id` = `set`.`eventId`', true], 's' => ', e.holidayId'],
|
||||
'src' => ['j' => ['?_source src ON `src`.`typeId` = `set`.`id` AND `src`.`type` = 4', true], 's' => ', src1, src2, src3, src4, src5, src6, src7, src8, src9, src10, src11, src12, src13, src14, src15, src16, src17, src18, src19, src20, src21, src22, src23, src24']
|
||||
);
|
||||
|
||||
public function __construct($conditions = [])
|
||||
@@ -176,15 +177,15 @@ class ItemsetListFilter extends Filter
|
||||
);
|
||||
|
||||
protected $genericFilter = array(
|
||||
2 => [FILTER_CR_NUMERIC, 'id', NUM_CAST_INT, true], // id
|
||||
3 => [FILTER_CR_NUMERIC, 'npieces', NUM_CAST_INT ], // pieces
|
||||
4 => [FILTER_CR_STRING, 'bonusText', STR_LOCALIZED ], // bonustext
|
||||
5 => [FILTER_CR_BOOLEAN, 'heroic' ], // heroic
|
||||
6 => [FILTER_CR_ENUM, 'e.holidayId', true, true], // relatedevent
|
||||
8 => [FILTER_CR_FLAG, 'cuFlags', CUSTOM_HAS_COMMENT ], // hascomments
|
||||
9 => [FILTER_CR_FLAG, 'cuFlags', CUSTOM_HAS_SCREENSHOT ], // hasscreenshots
|
||||
10 => [FILTER_CR_FLAG, 'cuFlags', CUSTOM_HAS_VIDEO ], // hasvideos
|
||||
12 => [FILTER_CR_NYI_PH, null, 1 ] // available to players [yn] - ugh .. scan loot, quest and vendor templates and write to ?_itemset
|
||||
2 => [FILTER_CR_NUMERIC, 'id', NUM_CAST_INT, true], // id
|
||||
3 => [FILTER_CR_NUMERIC, 'npieces', NUM_CAST_INT ], // pieces
|
||||
4 => [FILTER_CR_STRING, 'bonusText', STR_LOCALIZED ], // bonustext
|
||||
5 => [FILTER_CR_BOOLEAN, 'heroic' ], // heroic
|
||||
6 => [FILTER_CR_ENUM, 'e.holidayId', true, true], // relatedevent
|
||||
8 => [FILTER_CR_FLAG, 'cuFlags', CUSTOM_HAS_COMMENT ], // hascomments
|
||||
9 => [FILTER_CR_FLAG, 'cuFlags', CUSTOM_HAS_SCREENSHOT ], // hasscreenshots
|
||||
10 => [FILTER_CR_FLAG, 'cuFlags', CUSTOM_HAS_VIDEO ], // hasvideos
|
||||
12 => [FILTER_CR_CALLBACK, 'cbAvaliable', ] // available to players [yn]
|
||||
);
|
||||
|
||||
protected $inputFields = array(
|
||||
@@ -258,6 +259,19 @@ class ItemsetListFilter extends Filter
|
||||
|
||||
return $parts;
|
||||
}
|
||||
|
||||
protected function cbAvaliable($cr)
|
||||
{
|
||||
switch ($cr[1])
|
||||
{
|
||||
case 1: // Yes
|
||||
return ['src.typeId', null, '!'];
|
||||
case 2: // No
|
||||
return ['src.typeId', null];
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -2473,7 +2473,7 @@ DROP TABLE IF EXISTS `aowow_source`;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `aowow_source` (
|
||||
`type` tinyint(4) unsigned NOT NULL,
|
||||
`typeId` mediumint(9) unsigned NOT NULL,
|
||||
`typeId` mediumint(9) NOT NULL,
|
||||
`moreType` tinyint(4) unsigned DEFAULT NULL,
|
||||
`moreTypeId` mediumint(9) unsigned DEFAULT NULL,
|
||||
`moreZoneId` mediumint(9) unsigned DEFAULT NULL,
|
||||
@@ -3186,7 +3186,7 @@ UNLOCK TABLES;
|
||||
|
||||
LOCK TABLES `aowow_dbversion` WRITE;
|
||||
/*!40000 ALTER TABLE `aowow_dbversion` DISABLE KEYS */;
|
||||
INSERT INTO `aowow_dbversion` VALUES (1684793470,0,NULL,NULL);
|
||||
INSERT INTO `aowow_dbversion` VALUES (1684849476,0,NULL,NULL);
|
||||
/*!40000 ALTER TABLE `aowow_dbversion` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
|
||||
|
||||
@@ -274,7 +274,7 @@ SqlGen::register(new class extends SetupScript
|
||||
3) one itemset from one dbc entry (basic case). duplicate items per slot possible
|
||||
*/
|
||||
|
||||
if (!$pieces)
|
||||
if (count($pieces) < 2)
|
||||
{
|
||||
$row['cuFlags'] = CUSTOM_EXCLUDE_FOR_LISTVIEW;
|
||||
DB::Aowow()->query('REPLACE INTO ?_itemset (?#) VALUES (?a)', array_keys($row), array_values($row));
|
||||
@@ -295,11 +295,11 @@ SqlGen::register(new class extends SetupScript
|
||||
// create new
|
||||
if (!isset($sorted[$k][$data['slot']]))
|
||||
$sorted[$k][$data['slot']] = $data;
|
||||
// can have multiple
|
||||
// can have two
|
||||
else if (in_array($data['slot'], [INVTYPE_WEAPON, INVTYPE_FINGER, INVTYPE_TRINKET]))
|
||||
$sorted[$k][-$data['slot']] = $data;
|
||||
// use item with lower itemId
|
||||
else if ($sorted[$k][$data['slot']]['entry'] > $data['entry'])
|
||||
// slot confict. If item is being sold, replace old item (imperfect solution :/)
|
||||
else if (DB::World()->selectCell('SELECT SUM(n) FROM (SELECT COUNT(1) AS n FROM npc_vendor WHERE item = ?d UNION SELECT COUNT(1) AS n FROM game_event_npc_vendor WHERE item = ?d) x', $data['entry'], $data['entry']))
|
||||
$sorted[$k][$data['slot']] = $data;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,8 +11,8 @@ SqlGen::register(new class extends SetupScript
|
||||
{
|
||||
protected $command = 'source';
|
||||
|
||||
protected $tblDependancyAowow = ['spell', 'achievement', 'items', 'spawns', 'creature', 'zones', 'titles'];
|
||||
protected $tblDependancyTC = ['playercreateinfo_skills', 'playercreateinfo_item', 'skill_discovery_template', 'achievement_reward', 'skill_perfect_item_template', 'item_template', 'gameobject_template', 'quest_template', 'quest_template_addon', 'creature_template', 'creature', 'creature_default_trainer', 'npc_vendor', 'game_event_npc_vendor', 'reference_loot_template', 'item_loot_template', 'creature_loot_template', 'gameobject_loot_template', 'mail_loot_template', 'disenchant_loot_template', 'fishing_loot_template', 'skinning_loot_template', 'milling_loot_template', 'prospecting_loot_template', 'pickpocketing_loot_template'];
|
||||
protected $tblDependancyAowow = ['spell', 'achievement', 'items', 'itemset', 'spawns', 'creature', 'zones', 'titles'];
|
||||
protected $tblDependancyTC = ['playercreateinfo_skills', 'playercreateinfo_item', 'skill_discovery_template', 'achievement_reward', 'skill_perfect_item_template', 'item_template', 'gameobject_template', 'quest_template', 'quest_template_addon', 'creature_template', 'creature', 'npc_trainer', 'npc_vendor', 'game_event_npc_vendor', 'reference_loot_template', 'item_loot_template', 'creature_loot_template', 'gameobject_loot_template', 'mail_loot_template', 'disenchant_loot_template', 'fishing_loot_template', 'skinning_loot_template', 'milling_loot_template', 'prospecting_loot_template', 'pickpocketing_loot_template'];
|
||||
protected $dbcSourceFiles = ['charstartoutfit', 'talent', 'spell', 'skilllineability', 'itemextendedcost', 'lock'];
|
||||
|
||||
private $srcBuffer = [];
|
||||
@@ -118,6 +118,14 @@ SqlGen::register(new class extends SetupScript
|
||||
$this->titleAchievement(); # 12: Achievement #
|
||||
$this->titleCustomString(); # 13: Source-String #
|
||||
|
||||
/************/
|
||||
/* Itemsets */
|
||||
/************/
|
||||
|
||||
CLI::write(' - Itemsets');
|
||||
|
||||
$this->itemset(); # Meta category .. inherit from items #
|
||||
|
||||
|
||||
$t = new Timer(500);
|
||||
foreach ($this->srcBuffer as $type => $data)
|
||||
@@ -184,7 +192,7 @@ SqlGen::register(new class extends SetupScript
|
||||
$str = '';
|
||||
foreach ($rows as &$r)
|
||||
{
|
||||
array_walk($r, function(&$x) {$x = (int)$x < 1 ? 'NULL' : $x; });
|
||||
array_walk($r, function(&$x) {$x = (int)$x === 0 ? 'NULL' : $x; });
|
||||
$str .= '(' . implode(', ', $r) . '),';
|
||||
}
|
||||
|
||||
@@ -1156,6 +1164,43 @@ SqlGen::register(new class extends SetupScript
|
||||
foreach (Lang::game('pvpSources') as $src => $__)
|
||||
$this->pushBuffer(Type::TITLE, $src, SRC_CUSTOM_STRING, $src);
|
||||
}
|
||||
|
||||
private function itemset() : void
|
||||
{
|
||||
// every item in ?_itemset needs a source. if so merge fields. if not it's not available.
|
||||
|
||||
$sets = DB::Aowow()->select('SELECT id AS ARRAY_KEY, contentGroup, item1, item2, item3, item4, item5, item6, item7, item8, item9, item10 FROM ?_itemset');
|
||||
|
||||
$metaSrc = [];
|
||||
foreach ($sets as $id => $set)
|
||||
{
|
||||
$available = true;
|
||||
for ($i = 1; $i < 11; $i++)
|
||||
{
|
||||
if (!$set['item'.$i])
|
||||
continue;
|
||||
|
||||
if (!isset($this->srcBuffer[Type::ITEM][$set['item'.$i]]))
|
||||
{
|
||||
// Todo: remove HACK - neck in Zul'Gurub set ist created by spell from onUse item trigger
|
||||
if ($set['contentGroup'] == 11)
|
||||
continue;
|
||||
|
||||
$available = false;
|
||||
break;
|
||||
}
|
||||
|
||||
$metaSrc[$id] = ($metaSrc[$id] ?? []) + $this->srcBuffer[Type::ITEM][$set['item'.$i]][6];
|
||||
}
|
||||
|
||||
if (!$available)
|
||||
unset($metaSrc[$id]);
|
||||
}
|
||||
|
||||
foreach($metaSrc as $id => $bits)
|
||||
foreach ($bits as $src => $bit)
|
||||
$this->pushBuffer(Type::ITEMSET, $id, $src, $bit);
|
||||
}
|
||||
});
|
||||
|
||||
?>
|
||||
|
||||
2
setup/updates/1684849475_01.sql
Normal file
2
setup/updates/1684849475_01.sql
Normal file
@@ -0,0 +1,2 @@
|
||||
ALTER TABLE `aowow_source`
|
||||
MODIFY `typeId` mediumint(9) signed NOT NULL AFTER `type`;
|
||||
Reference in New Issue
Block a user