mirror of
https://github.com/Sarjuuk/aowow.git
synced 2025-11-29 15:58:16 +08:00
Locks
* implemented display of LOCK_TYPE_SPELL (3 cases) * show "unlocks" tab on spell detail page * closes #288
This commit is contained in:
@@ -592,12 +592,14 @@ class ItemBaseResponse extends TemplateResponse implements ICache
|
||||
), SpellList::$brickFile));
|
||||
}
|
||||
|
||||
// tab: unlocks (object or item) - LOCK_TYPE_ITEM: 1
|
||||
// tab: unlocks (object or item)
|
||||
$lockIds = DB::Aowow()->selectCol(
|
||||
'SELECT `id` FROM ?_lock WHERE (`type1` = 1 AND `properties1` = ?d) OR
|
||||
(`type2` = 1 AND `properties2` = ?d) OR (`type3` = 1 AND `properties3` = ?d) OR
|
||||
(`type4` = 1 AND `properties4` = ?d) OR (`type5` = 1 AND `properties5` = ?d)',
|
||||
$this->typeId, $this->typeId, $this->typeId, $this->typeId, $this->typeId
|
||||
'SELECT `id` FROM ?_lock WHERE (`type1` = ?d AND `properties1` = ?d) OR
|
||||
(`type2` = ?d AND `properties2` = ?d) OR (`type3` = ?d AND `properties3` = ?d) OR
|
||||
(`type4` = ?d AND `properties4` = ?d) OR (`type5` = ?d AND `properties5` = ?d)',
|
||||
LOCK_TYPE_ITEM, $this->typeId, LOCK_TYPE_ITEM, $this->typeId,
|
||||
LOCK_TYPE_ITEM, $this->typeId, LOCK_TYPE_ITEM, $this->typeId,
|
||||
LOCK_TYPE_ITEM, $this->typeId
|
||||
);
|
||||
|
||||
if ($lockIds)
|
||||
|
||||
@@ -1166,6 +1166,55 @@ class SpellBaseResponse extends TemplateResponse implements ICache
|
||||
}
|
||||
}
|
||||
|
||||
// tab: unlocks (object or item)
|
||||
$lockIds = DB::Aowow()->selectCol(
|
||||
'SELECT `id` FROM ?_lock WHERE (`type1` = ?d AND `properties1` = ?d) OR
|
||||
(`type2` = ?d AND `properties2` = ?d) OR (`type3` = ?d AND `properties3` = ?d) OR
|
||||
(`type4` = ?d AND `properties4` = ?d) OR (`type5` = ?d AND `properties5` = ?d)',
|
||||
LOCK_TYPE_SPELL, $this->typeId, LOCK_TYPE_SPELL, $this->typeId,
|
||||
LOCK_TYPE_SPELL, $this->typeId, LOCK_TYPE_SPELL, $this->typeId,
|
||||
LOCK_TYPE_SPELL, $this->typeId
|
||||
);
|
||||
|
||||
// we know this spell effect is only in use on index 1
|
||||
if ($this->subject->getField('effect1Id') == SPELL_EFFECT_OPEN_LOCK && ($lockId = $this->subject->getField('effect1MiscValue')))
|
||||
$lockIds += DB::Aowow()->selectCol(
|
||||
'SELECT `id` FROM ?_lock WHERE (`type1` = ?d AND `properties1` = ?d) OR
|
||||
(`type2` = ?d AND `properties2` = ?d) OR (`type3` = ?d AND `properties3` = ?d) OR
|
||||
(`type4` = ?d AND `properties4` = ?d) OR (`type5` = ?d AND `properties5` = ?d)',
|
||||
LOCK_TYPE_SKILL, $lockId, LOCK_TYPE_SKILL, $lockId,
|
||||
LOCK_TYPE_SKILL, $lockId, LOCK_TYPE_SKILL, $lockId,
|
||||
LOCK_TYPE_SKILL, $lockId
|
||||
);
|
||||
|
||||
if ($lockIds)
|
||||
{
|
||||
// objects
|
||||
$lockedObj = new GameObjectList(array(Cfg::get('SQL_LIMIT_NONE'), ['lockId', $lockIds]));
|
||||
if (!$lockedObj->error)
|
||||
{
|
||||
$this->addDataLoader('zones');
|
||||
$this->lvTabs->addListviewTab(new Listview(array(
|
||||
'data' => $lockedObj->getListviewData(),
|
||||
'name' => '$LANG.tab_unlocks',
|
||||
'id' => 'unlocks-object',
|
||||
'visibleCols' => $lockedObj->hasSetFields('reqSkill') ? ['skill'] : null
|
||||
), GameObjectList::$brickFile));
|
||||
}
|
||||
|
||||
$lockedItm = new ItemList(array(Cfg::get('SQL_LIMIT_NONE'), ['lockId', $lockIds]));
|
||||
if (!$lockedItm->error)
|
||||
{
|
||||
$this->extendGlobalData($lockedItm->getJSGlobals(GLOBALINFO_SELF));
|
||||
|
||||
$this->lvTabs->addListviewTab(new Listview(array(
|
||||
'data' => $lockedItm->getListviewData(),
|
||||
'name' => '$LANG.tab_unlocks',
|
||||
'id' => 'unlocks-item'
|
||||
), ItemList::$brickFile));
|
||||
}
|
||||
}
|
||||
|
||||
// find associated NPC, Item and merge results
|
||||
// taughtbypets (unused..?)
|
||||
// taughtbyquest (usually the spell casted as quest reward teaches something; exclude those seplls from taughtBySpell)
|
||||
|
||||
@@ -99,7 +99,7 @@ class GameObjectList extends DBTypeList
|
||||
if (isset($this->curTpl['lockId']))
|
||||
if ($locks = Lang::getLocks($this->curTpl['lockId']))
|
||||
foreach ($locks as $l)
|
||||
$x .= '<tr><td>'.sprintf(Lang::game('requires'), $l).'</td></tr>';
|
||||
$x .= '<tr><td>'.Lang::game('requires', [$l]).'</td></tr>';
|
||||
|
||||
$x .= '</table>';
|
||||
|
||||
|
||||
@@ -937,7 +937,7 @@ class ItemList extends DBTypeList
|
||||
|
||||
// locked or openable
|
||||
if ($locks = Lang::getLocks($this->curTpl['lockId'], $arr, true))
|
||||
$x .= '<span class="q0">'.Lang::item('locked').'<br />'.implode('<br />', array_map(function($x) { return sprintf(Lang::game('requires'), $x); }, $locks)).'</span><br />';
|
||||
$x .= '<span class="q0">'.Lang::item('locked').'<br />'.implode('<br />', array_map(fn($x) => Lang::game('requires', [$x]), $locks)).'</span><br />';
|
||||
else if ($this->curTpl['flags'] & ITEM_FLAG_OPENABLE)
|
||||
$x .= '<span class="q2">'.Lang::item('openClick').'</span><br />';
|
||||
|
||||
|
||||
@@ -609,6 +609,7 @@ define('TEAM_NEUTRAL', 2);
|
||||
// Lock Types
|
||||
define('LOCK_TYPE_ITEM', 1);
|
||||
define('LOCK_TYPE_SKILL', 2);
|
||||
define('LOCK_TYPE_SPELL', 3);
|
||||
|
||||
// Lock-Properties (also categorizes GOs)
|
||||
define('LOCK_PROPERTY_FOOTLOCKER', 1);
|
||||
|
||||
@@ -267,11 +267,12 @@ class Lang
|
||||
$rank = $lock['reqSkill'.$i];
|
||||
$name = '';
|
||||
|
||||
if ($lock['type'.$i] == LOCK_TYPE_ITEM)
|
||||
switch ($lock['type'.$i])
|
||||
{
|
||||
case LOCK_TYPE_ITEM:
|
||||
$name = ItemList::getName($prop);
|
||||
if (!$name)
|
||||
continue;
|
||||
continue 2;
|
||||
|
||||
if ($fmt == self::FMT_HTML)
|
||||
$name = $interactive ? '<a class="q1" href="?item='.$prop.'">'.$name.'</a>' : '<span class="q1">'.$name.'</span>';
|
||||
@@ -280,15 +281,12 @@ class Lang
|
||||
$name = '[item='.$prop.']';
|
||||
$ids[Type::ITEM][] = $prop;
|
||||
}
|
||||
else
|
||||
$name = $prop;
|
||||
|
||||
}
|
||||
else if ($lock['type'.$i] == LOCK_TYPE_SKILL)
|
||||
{
|
||||
break;
|
||||
case LOCK_TYPE_SKILL:
|
||||
$name = self::spell('lockType', $prop);
|
||||
if (!$name)
|
||||
continue;
|
||||
continue 2;
|
||||
|
||||
// skills
|
||||
if (in_array($prop, [1, 2, 3, 20]))
|
||||
@@ -308,7 +306,7 @@ class Lang
|
||||
$ids[Type::SKILL][] = $skills[$prop];
|
||||
}
|
||||
else
|
||||
$name = $skills[$prop];
|
||||
$name = SkillList::getName($prop);
|
||||
|
||||
if ($rank > 0)
|
||||
$name .= ' ('.$rank.')';
|
||||
@@ -323,7 +321,6 @@ class Lang
|
||||
$name = '[spell=1842]';
|
||||
$ids[Type::SPELL][] = 1842;
|
||||
}
|
||||
// else $name = $name
|
||||
}
|
||||
// exclude unusual stuff
|
||||
else if (User::isInGroup(U_GROUP_STAFF))
|
||||
@@ -332,10 +329,25 @@ class Lang
|
||||
$name .= ' ('.$rank.')';
|
||||
}
|
||||
else
|
||||
continue;
|
||||
continue 2;
|
||||
break;
|
||||
case LOCK_TYPE_SPELL:
|
||||
$name = SpellList::getName($prop);
|
||||
if (!$name)
|
||||
continue 2;
|
||||
|
||||
if ($fmt == self::FMT_HTML)
|
||||
$name = $interactive ? '<a class="q1" href="?spell='.$prop.'">'.$name.'</a>' : '<span class="q1">'.$name.'</span>';
|
||||
else if ($interactive && $fmt == self::FMT_MARKUP)
|
||||
{
|
||||
$name = '[spell='.$prop.']';
|
||||
$ids[Type::SPELL][] = $prop;
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
continue 2;
|
||||
}
|
||||
else
|
||||
continue;
|
||||
|
||||
$locks[$lock['type'.$i] == LOCK_TYPE_ITEM ? $prop : -$prop] = $name;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user