mirror of
https://github.com/Sarjuuk/aowow.git
synced 2025-11-29 15:58:16 +08:00
Loot/Difficulty
* fixed encoding Dungeon Difficulty in source * resolve difficulty dummy loot sources to base creature if able * added listview note for difficulty source on item detail page * misc: fixed parsing color UI escape sequence
This commit is contained in:
@@ -880,11 +880,21 @@ trait sourceHelper
|
||||
|
||||
if (isset($this->sources[$this->id][SRC_DROP][0]))
|
||||
{
|
||||
$dd = $this->sources[$this->id][SRC_DROP][0];
|
||||
if ($this->curTpl['moreMask'] & SRC_FLAG_RAID_DROP)
|
||||
$sm['dd'] = (1 << ($dd - 1));
|
||||
else if ($this->curTpl['moreMask'] & SRC_FLAG_DUNGEON_DROP)
|
||||
$sm['dd'] = (1 << ($dd - 1)) * -1;
|
||||
/*
|
||||
mode srcFlag log2 dd Flag
|
||||
10N/D-NH 0b0001 0 0b001
|
||||
25N/D-HC 0b0010 1 0b010
|
||||
10H 0b0100 2 0b011
|
||||
25H 0b1000 3 0b100
|
||||
*/
|
||||
if ($this->curTpl['moreMask'] & SRC_FLAG_DUNGEON_DROP)
|
||||
$sm['dd'] = $this->sources[$this->id][SRC_DROP][0] * -1;
|
||||
else if ($this->curTpl['moreMask'] & SRC_FLAG_RAID_DROP)
|
||||
{
|
||||
$dd = log($this->sources[$this->id][SRC_DROP][0], 2);
|
||||
if ($dd == intVal($dd)) // only one bit set
|
||||
$sm['dd'] = $dd + 1;
|
||||
}
|
||||
}
|
||||
|
||||
if ($sm)
|
||||
|
||||
@@ -389,24 +389,24 @@ class Loot
|
||||
|
||||
// [fileName, tabData, tabName, tabId, extraCols, hiddenCols, visibleCols]
|
||||
$tabsFinal = array(
|
||||
['item', [], '$LANG.tab_containedin', 'contained-in-item', [], [], []],
|
||||
['item', [], '$LANG.tab_disenchantedfrom', 'disenchanted-from', [], [], []],
|
||||
['item', [], '$LANG.tab_prospectedfrom', 'prospected-from', [], [], []],
|
||||
['item', [], '$LANG.tab_milledfrom', 'milled-from', [], [], []],
|
||||
['creature', [], '$LANG.tab_droppedby', 'dropped-by', [], [], []],
|
||||
['creature', [], '$LANG.tab_pickpocketedfrom', 'pickpocketed-from', [], [], []],
|
||||
['creature', [], '$LANG.tab_skinnedfrom', 'skinned-from', [], [], []],
|
||||
['creature', [], '$LANG.tab_minedfromnpc', 'mined-from-npc', [], [], []],
|
||||
['creature', [], '$LANG.tab_salvagedfrom', 'salvaged-from', [], [], []],
|
||||
['creature', [], '$LANG.tab_gatheredfromnpc', 'gathered-from-npc', [], [], []],
|
||||
['quest', [], '$LANG.tab_rewardfrom', 'reward-from-quest', [], [], []],
|
||||
['zone', [], '$LANG.tab_fishedin', 'fished-in-zone', [], [], []],
|
||||
['object', [], '$LANG.tab_containedin', 'contained-in-object', [], [], []],
|
||||
['object', [], '$LANG.tab_minedfrom', 'mined-from-object', [], [], []],
|
||||
['object', [], '$LANG.tab_gatheredfrom', 'gathered-from-object', [], [], []],
|
||||
['object', [], '$LANG.tab_fishedin', 'fished-in-object', [], [], []],
|
||||
['spell', [], '$LANG.tab_createdby', 'created-by', [], [], []],
|
||||
['achievement', [], '$LANG.tab_rewardfrom', 'reward-from-achievement', [], [], []]
|
||||
[Type::ITEM, [], '$LANG.tab_containedin', 'contained-in-item', [], [], []],
|
||||
[Type::ITEM, [], '$LANG.tab_disenchantedfrom', 'disenchanted-from', [], [], []],
|
||||
[Type::ITEM, [], '$LANG.tab_prospectedfrom', 'prospected-from', [], [], []],
|
||||
[Type::ITEM, [], '$LANG.tab_milledfrom', 'milled-from', [], [], []],
|
||||
[Type::NPC, [], '$LANG.tab_droppedby', 'dropped-by', [], [], []],
|
||||
[Type::NPC, [], '$LANG.tab_pickpocketedfrom', 'pickpocketed-from', [], [], []],
|
||||
[Type::NPC, [], '$LANG.tab_skinnedfrom', 'skinned-from', [], [], []],
|
||||
[Type::NPC, [], '$LANG.tab_minedfromnpc', 'mined-from-npc', [], [], []],
|
||||
[Type::NPC, [], '$LANG.tab_salvagedfrom', 'salvaged-from', [], [], []],
|
||||
[Type::NPC, [], '$LANG.tab_gatheredfromnpc', 'gathered-from-npc', [], [], []],
|
||||
[Type::QUEST, [], '$LANG.tab_rewardfrom', 'reward-from-quest', [], [], []],
|
||||
[Type::ZONE, [], '$LANG.tab_fishedin', 'fished-in-zone', [], [], []],
|
||||
[Type::OBJECT, [], '$LANG.tab_containedin', 'contained-in-object', [], [], []],
|
||||
[Type::OBJECT, [], '$LANG.tab_minedfrom', 'mined-from-object', [], [], []],
|
||||
[Type::OBJECT, [], '$LANG.tab_gatheredfrom', 'gathered-from-object', [], [], []],
|
||||
[Type::OBJECT, [], '$LANG.tab_fishedin', 'fished-in-object', [], [], []],
|
||||
[Type::SPELL, [], '$LANG.tab_createdby', 'created-by', [], [], []],
|
||||
[Type::ACHIEVEMENT, [], '$LANG.tab_rewardfrom', 'reward-from-achievement', [], [], []]
|
||||
);
|
||||
$refResults = [];
|
||||
$query = 'SELECT
|
||||
@@ -580,13 +580,28 @@ class Loot
|
||||
if (!$ids)
|
||||
continue;
|
||||
|
||||
$parentData = [];
|
||||
switch ($tabsFinal[abs($tabId)][0])
|
||||
{
|
||||
case 'creature': // new CreatureList
|
||||
case 'item': // new ItemList
|
||||
case 'zone': // new ZoneList
|
||||
$oName = ucFirst($tabsFinal[abs($tabId)][0]).'List';
|
||||
$srcObj = new $oName(array([$field, $ids]));
|
||||
case TYPE::NPC: // new CreatureList
|
||||
if ($baseIds = DB::Aowow()->selectCol(
|
||||
'SELECT `difficultyEntry1` AS ARRAY_KEY, `id` FROM ?_creature WHERE difficultyEntry1 IN (?a) UNION
|
||||
SELECT `difficultyEntry2` AS ARRAY_KEY, `id` FROM ?_creature WHERE difficultyEntry2 IN (?a) UNION
|
||||
SELECT `difficultyEntry3` AS ARRAY_KEY, `id` FROM ?_creature WHERE difficultyEntry3 IN (?a)',
|
||||
$ids, $ids, $ids))
|
||||
{
|
||||
$parentObj = new CreatureList(array(['id', $baseIds]));
|
||||
if (!$parentObj->error)
|
||||
{
|
||||
self::storeJSGlobals($parentObj->getJSGlobals());
|
||||
$parentData = $parentObj->getListviewData();
|
||||
$ids = array_diff($ids, $baseIds);
|
||||
}
|
||||
}
|
||||
|
||||
case Type::ITEM: // new ItemList
|
||||
case Type::ZONE: // new ZoneList
|
||||
$srcObj = Type::newList($tabsFinal[abs($tabId)][0], array([$field, $ids]));
|
||||
if (!$srcObj->error)
|
||||
{
|
||||
$srcData = $srcObj->getListviewData();
|
||||
@@ -603,7 +618,11 @@ class Loot
|
||||
else if ($tabId < 0)
|
||||
$tabId = abs($tabId); // general case (skinning)
|
||||
|
||||
$tabsFinal[$tabId][1][] = array_merge($srcData[$srcObj->id], $result[$srcObj->getField($field)]);
|
||||
if (($p = $srcObj->getField('parentId')) && ($d = $parentData[$p] ?? null))
|
||||
$tabsFinal[$tabId][1][] = array_merge($d, $result[$srcObj->getField($field)]);
|
||||
else
|
||||
$tabsFinal[$tabId][1][] = array_merge($srcData[$srcObj->id], $result[$srcObj->getField($field)]);
|
||||
|
||||
$tabsFinal[$tabId][4][] = '$Listview.extraCols.percent';
|
||||
}
|
||||
}
|
||||
@@ -620,15 +639,15 @@ class Loot
|
||||
);
|
||||
|
||||
if ($data[4])
|
||||
$tabData['extraCols'] = array_unique($data[4]);
|
||||
$tabData['extraCols'] = array_unique($data[4]);
|
||||
|
||||
if ($data[5])
|
||||
$tabData['hiddenCols'] = array_unique($data[5]);
|
||||
$tabData['hiddenCols'] = array_unique($data[5]);
|
||||
|
||||
if ($data[6])
|
||||
$tabData['visibleCols'] = array_unique($data[6]);
|
||||
|
||||
$this->results[$tabId] = [$data[0], $tabData];
|
||||
$this->results[$tabId] = [Type::getFileString($data[0]), $tabData];
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -220,7 +220,7 @@ class GenericPage
|
||||
'calendar' => ['template' => 'holidaycal', 'id' => 'calendar', 'parent' => 'lv-generic', 'data' => [], 'name' => '$LANG.tab_calendar' ],
|
||||
'class' => ['template' => 'classs', 'id' => 'classes', 'parent' => 'lv-generic', 'data' => [], 'name' => '$LANG.tab_classes' ],
|
||||
'commentpreview' => ['template' => 'commentpreview', 'id' => 'comments', 'parent' => 'lv-generic', 'data' => [], 'name' => '$LANG.tab_comments' ],
|
||||
'creature' => ['template' => 'npc', 'id' => 'npcs', 'parent' => 'lv-generic', 'data' => [], 'name' => '$LANG.tab_npcs' ],
|
||||
'npc' => ['template' => 'npc', 'id' => 'npcs', 'parent' => 'lv-generic', 'data' => [], 'name' => '$LANG.tab_npcs' ],
|
||||
'currency' => ['template' => 'currency', 'id' => 'currencies', 'parent' => 'lv-generic', 'data' => [], 'name' => '$LANG.tab_currencies' ],
|
||||
'emote' => ['template' => 'emote', 'id' => 'emotes', 'parent' => 'lv-generic', 'data' => [] ],
|
||||
'enchantment' => ['template' => 'enchantment', 'id' => 'enchantments', 'parent' => 'lv-generic', 'data' => [] ],
|
||||
|
||||
@@ -466,6 +466,21 @@ class ItemPage extends genericPage
|
||||
if ($idx == 16)
|
||||
$createdBy = array_column($tabData['data'], 'id');
|
||||
|
||||
$s = $sm = null;
|
||||
if ($idx == 4 && $this->subject->getSources($s, $sm) && $s[0] == SRC_DROP && isset($sm[0]['dd']))
|
||||
{
|
||||
switch ($sm[0]['dd'])
|
||||
{
|
||||
case -1: $tabData['note'] = '$LANG.lvnote_itemdropsinnormalonly'; break;
|
||||
case -2: $tabData['note'] = '$LANG.lvnote_itemdropsinheroiconly'; break;
|
||||
case -3: $tabData['note'] = '$LANG.lvnote_itemdropsinnormalheroic'; break;
|
||||
case 1: $tabData['note'] = '$LANG.lvnote_itemdropsinnormal10only'; break;
|
||||
case 2: $tabData['note'] = '$LANG.lvnote_itemdropsinnormal25only'; break;
|
||||
case 3: $tabData['note'] = '$LANG.lvnote_itemdropsinheroic10only'; break;
|
||||
case 4: $tabData['note'] = '$LANG.lvnote_itemdropsinheroic25only'; break;
|
||||
}
|
||||
}
|
||||
|
||||
$this->lvTabs[] = [$file, $tabData];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,9 +29,9 @@ SqlGen::register(new class extends SetupScript
|
||||
/*********************************/
|
||||
|
||||
$this->dummyNPCs = DB::Aowow()->select(
|
||||
'SELECT difficultyEntry1 AS ARRAY_KEY, 2 AS "0", `id` AS "1" FROM ?_creature WHERE difficultyEntry1 > 0 UNION
|
||||
SELECT difficultyEntry2 AS ARRAY_KEY, 4 AS "0", `id` AS "1" FROM ?_creature WHERE difficultyEntry2 > 0 UNION
|
||||
SELECT difficultyEntry3 AS ARRAY_KEY, 8 AS "0", `id` AS "1" FROM ?_creature WHERE difficultyEntry3 > 0'
|
||||
'SELECT difficultyEntry1 AS ARRAY_KEY, 2 AS "0", `id` AS "1" FROM ?_creature WHERE difficultyEntry1 > 0 UNION
|
||||
SELECT difficultyEntry2 AS ARRAY_KEY, 4 AS "0", `id` AS "1" FROM ?_creature WHERE difficultyEntry2 > 0 UNION
|
||||
SELECT difficultyEntry3 AS ARRAY_KEY, 8 AS "0", `id` AS "1" FROM ?_creature WHERE difficultyEntry3 > 0'
|
||||
);
|
||||
// todo: do the same for GOs
|
||||
|
||||
|
||||
1
setup/updates/1702576294_01.sql
Normal file
1
setup/updates/1702576294_01.sql
Normal file
@@ -0,0 +1 @@
|
||||
UPDATE `aowow_dbversion` SET `sql` = CONCAT(IFNULL(`sql`, ''), ' source');
|
||||
Reference in New Issue
Block a user