Nav/RedButtons

* pass parameters as ready to use - objects
This commit is contained in:
Sarjuuk
2017-02-20 02:34:26 +01:00
parent 739e7bc81a
commit 090410cbf8
18 changed files with 54 additions and 23 deletions

View File

@@ -146,8 +146,14 @@ class AchievementPage extends GenericPage
$this->series = $series ? [[$series, null]] : null;
$this->description = $this->subject->getField('description', true);
$this->redButtons = array(
BUTTON_LINKS => ['color' => 'ffffff00', 'linkId' => Util::$typeStrings[TYPE_ACHIEVEMENT].':'.$this->typeId.':"..UnitGUID("player")..":0:0:0:0:0:0:0:0'],
BUTTON_WOWHEAD => !($this->subject->getField('cuFlags') & CUSTOM_SERVERSIDE)
BUTTON_WOWHEAD => !($this->subject->getField('cuFlags') & CUSTOM_SERVERSIDE),
BUTTON_LINKS => array(
'linkColor' => 'ffffff00',
'linkId' => Util::$typeStrings[TYPE_ACHIEVEMENT].':'.$this->typeId.':"..UnitGUID("player")..":0:0:0:0:0:0:0:0',
'linkName' => $this->name,
'type' => $this->type,
'typeId' => $this->typeId
)
);
$this->criteria = array(
'reqQty' => $this->subject->getField('reqCriteriaCount'),

View File

@@ -96,7 +96,7 @@ class ClassPage extends GenericPage
$this->expansion = Util::$expansionString[$this->subject->getField('expansion')];
$this->headIcons = ['class_'.strtolower($this->subject->getField('fileString'))];
$this->redButtons = array(
BUTTON_LINKS => ['color' => '', 'linkId' => ''],
BUTTON_LINKS => ['type' => $this->type, 'typeId' => $this->typeId],
BUTTON_WOWHEAD => true,
BUTTON_TALENT => ['href' => '?talent#'.Util::$tcEncoding[$tcClassId[$this->typeId] * 3], 'pet' => false],
BUTTON_FORUM => false // todo (low): CFG_BOARD_URL + X

View File

@@ -81,6 +81,10 @@ class EmotePage extends GenericPage
$this->extraText = $text;
$this->infobox = $infobox ? '[ul][li]'.implode('[/li][li]', $infobox).'[/li][/ul]' : null;
$this->redButtons = array(
BUTTON_LINKS => ['type' => $this->type, 'typeId' => $this->typeId],
BUTTON_WOWHEAD => false
);
/**************/
/* Extra Tabs */

View File

@@ -80,6 +80,11 @@ class EnchantmentPage extends GenericPage
$this->infobox = $infobox ? '[ul][li]'.implode('[/li][li]', $infobox).'[/li][/ul]' : null;
$this->redButtons = array(
BUTTON_LINKS => ['type' => $this->type, 'typeId' => $this->typeId],
BUTTON_WOWHEAD => false
);
$this->effects = [];
// 3 effects
for ($i = 1; $i < 4; $i++)

View File

@@ -94,7 +94,7 @@ class EventPage extends GenericPage
$this->headIcons = [$this->subject->getField('iconString')];
$this->redButtons = array(
BUTTON_WOWHEAD => $this->hId > 0,
BUTTON_LINKS => true
BUTTON_LINKS => ['type' => $this->type, 'typeId' => $this->typeId]
);
/**************/

View File

@@ -88,7 +88,7 @@ class FactionPage extends GenericPage
$this->infobox = $infobox ? '[ul][li]'.implode('[/li][li]', $infobox).'[/li][/ul]' : null;
$this->redButtons = array(
BUTTON_WOWHEAD => true,
BUTTON_LINKS => true
BUTTON_LINKS => ['type' => $this->type, 'typeId' => $this->typeId]
);
// Spillover Effects

View File

@@ -360,11 +360,17 @@ class ItemPage extends genericPage
$this->tooltip = $this->subject->renderTooltip(true);
$this->redButtons = array(
BUTTON_WOWHEAD => true,
BUTTON_LINKS => ['color' => 'ff'.Util::$rarityColorStings[$this->subject->getField('quality')], 'linkId' => 'item:'.$this->typeId.':0:0:0:0:0:0:0:0'],
BUTTON_VIEW3D => in_array($_slot, $_visSlots) && $_model ? ['displayId' => $this->subject->getField('displayId'), 'slot' => $_slot, 'type' => TYPE_ITEM, 'typeId' => $this->typeId] : false,
BUTTON_COMPARE => $_cu,
BUTTON_EQUIP => in_array($_class, [ITEM_CLASS_WEAPON, ITEM_CLASS_ARMOR]),
BUTTON_UPGRADE => $_cu ? ['class' => $_class, 'slot' => $_slot] : false
BUTTON_UPGRADE => ($_cu ? ['class' => $_class, 'slot' => $_slot] : false),
BUTTON_LINKS => array(
'linkColor' => 'ff'.Util::$rarityColorStings[$this->subject->getField('quality')],
'linkId' => 'item:'.$this->typeId.':0:0:0:0:0:0:0:0',
'linkName' => $this->name,
'type' => $this->type,
'typeId' => $this->typeId
)
);
// availablility

View File

@@ -163,7 +163,7 @@ class ItemsetPage extends GenericPage
$this->expansion = 0;
$this->redButtons = array(
BUTTON_WOWHEAD => $this->typeId > 0, // bool only
BUTTON_LINKS => ['color' => '', 'linkId' => ''],
BUTTON_LINKS => ['type' => $this->type, 'typeId' => $this->typeId],
BUTTON_VIEW3D => ['type' => TYPE_ITEMSET, 'typeId' => $this->typeId, 'equipList' => $eqList],
BUTTON_COMPARE => ['eqList' => implode(':', $compare), 'qty' => $_cnt]
);

View File

@@ -323,7 +323,7 @@ class NpcPage extends GenericPage
$this->reputation = $this->getOnKillRep($_altIds, $mapType);
$this->redButtons = array(
BUTTON_WOWHEAD => true,
BUTTON_LINKS => true,
BUTTON_LINKS => ['type' => $this->type, 'typeId' => $this->typeId],
BUTTON_VIEW3D => ['type' => TYPE_NPC, 'typeId' => $this->typeId, 'displayId' => $this->subject->getRandomModelId()]
);

View File

@@ -249,7 +249,7 @@ class ObjectPage extends GenericPage
$this->relBoss = $relBoss;
$this->redButtons = array(
BUTTON_WOWHEAD => true,
BUTTON_LINKS => true,
BUTTON_LINKS => ['type' => $this->type, 'typeId' => $this->typeId],
BUTTON_VIEW3D => ['displayId' => $this->subject->getField('displayId'), 'type' => TYPE_OBJECT, 'typeId' => $this->typeId]
);

View File

@@ -67,7 +67,7 @@ class PetPage extends GenericPage
$this->expansion = Util::$expansionString[$this->subject->getField('expansion')];
$this->redButtons = array(
BUTTON_WOWHEAD => true,
BUTTON_LINKS => true,
BUTTON_LINKS => ['type' => $this->type, 'typeId' => $this->typeId],
BUTTON_TALENT => ['href' => '?petcalc#'.Util::$tcEncoding[(int)($this->typeId / 10)] . Util::$tcEncoding[(2 * ($this->typeId % 10) + ($this->subject->getField('exotic') ? 1 : 0))], 'pet' => true]
);

View File

@@ -559,8 +559,14 @@ class QuestPage extends GenericPage
$this->suggestedPl = $this->subject->getField('suggestedPlayers');
$this->unavailable = $_flags & QUEST_FLAG_UNAVAILABLE || $this->subject->getField('cuFlags') & CUSTOM_EXCLUDE_FOR_LISTVIEW;
$this->redButtons = array(
BUTTON_LINKS => ['color' => 'ffffff00', 'linkId' => 'quest:'.$this->typeId.':'.$_level.''],
BUTTON_WOWHEAD => true
BUTTON_LINKS => array(
'linkColor' => 'ffffff00',
'linkId' => 'quest:'.$this->typeId.':'.$_level;
'linkName' => $this->name,
'type' => $this->type,
'typeId' => $this->typeId
)
);
if ($maTab)

View File

@@ -96,7 +96,7 @@ class RacePage extends GenericPage
);
$this->redButtons = array(
BUTTON_WOWHEAD => true,
BUTTON_LINKS => true
BUTTON_LINKS => ['type' => $this->type, 'typeId' => $this->typeId]
);

View File

@@ -52,7 +52,7 @@ class SkillPage extends GenericPage
$this->headIcons = [$this->subject->getField('iconString')];
$this->redButtons = array(
BUTTON_WOWHEAD => true,
BUTTON_LINKS => true
BUTTON_LINKS => ['type' => $this->type, 'typeId' => $this->typeId]
);
if ($_ = $this->subject->getField('description', true))

View File

@@ -122,9 +122,15 @@ class SpellPage extends GenericPage
$_cat = $this->subject->getField('typeCat');
$redButtons = array(
BUTTON_LINKS => ['color' => 'ff71d5ff', 'linkId' => Util::$typeStrings[TYPE_SPELL].':'.$this->typeId],
BUTTON_VIEW3D => false,
BUTTON_WOWHEAD => true
BUTTON_WOWHEAD => true,
BUTTON_LINKS => array(
'linkColor' => 'ff71d5ff',
'linkId' => Util::$typeStrings[TYPE_SPELL].':'.$this->typeId,
'linkName' => $this->name,
'type' => $this->type,
'typeId' => $this->typeId
)
);
/***********/

View File

@@ -75,7 +75,7 @@ class TitlePage extends GenericPage
$this->expansion = Util::$expansionString[$this->subject->getField('expansion')];
$this->redButtons = array(
BUTTON_WOWHEAD => true,
BUTTON_LINKS => ['name' => $this->nameFixed]
BUTTON_LINKS => ['type' => $this->type, 'typeId' => $this->typeId]
);
// factionchange-equivalent

View File

@@ -446,7 +446,7 @@ class ZonePage extends GenericPage
$this->expansion = Util::$expansionString[$this->subject->getField('expansion')];
$this->redButtons = array(
BUTTON_WOWHEAD => true,
BUTTON_LINKS => true
BUTTON_LINKS => ['type' => $this->type, 'typeId' => $this->typeId]
);
/*

View File

@@ -11,9 +11,7 @@ endif;
// ingame-links/markdown/ect
if (isset($this->redButtons[BUTTON_LINKS])):
if ($b = $this->redButtons[BUTTON_LINKS]):
echo '<a href="javascript:;" id="open-links-button" class="button-red" onclick="this.blur(); Links.show({' .
(isset($b['color']) ? "linkColor: '".$b['color']."', " : null) . (isset($b['linkId']) ? "linkId: '".$b['linkId']."', " : null) .
"linkName: '".Util::jsEscape(isset($b['name']) ? $b['name'] : $this->name)."', type: ".$this->type.', typeId: '.$this->typeId.' });"><em><b><i>'.Lang::main('links').'</i></b><span>'.Lang::main('links').'</span></em></a>';
echo '<a href="javascript:;" id="open-links-button" class="button-red" onclick="this.blur(); Links.show('.strtr(Util::toJSON($b, JSON_NUMERIC_CHECK | JSON_UNSECAPED_UNICODE | JSON_HEX_APOS), ['"' => "'"]).');"><em><b><i>'.Lang::main('links').'</i></b><span>'.Lang::main('links').'</span></em></a>';
else:
echo '<a href="javascript:;" id="open-links-button" class="button-red button-red-disabled"><em><b><i>'.Lang::main('links').'</i></b><span>'.Lang::main('links').'</span></em></a>';
endif;
@@ -22,7 +20,7 @@ endif;
// view in 3D
if (isset($this->redButtons[BUTTON_VIEW3D])):
if ($b = $this->redButtons[BUTTON_VIEW3D]): // json_encode puts property names in brackets wich is not cool with inline javascript
echo '<a href="javascript:;" id="view3D-button" class="button-red" onclick="this.blur(); ModelViewer.show('.strtr(Util::toJSON($b, JSON_NUMERIC_CHECK), ['"' => '']).')"><em><b><i>'.Lang::main('view3D').'</i></b><span>'.Lang::main('view3D').'</span></em></a>';
echo '<a href="javascript:;" id="view3D-button" class="button-red" onclick="this.blur(); ModelViewer.show('.strtr(Util::toJSON($b, JSON_NUMERIC_CHECK | JSON_UNSECAPED_UNICODE | JSON_HEX_APOS), ['"' => "'"]).')"><em><b><i>'.Lang::main('view3D').'</i></b><span>'.Lang::main('view3D').'</span></em></a>';
else:
echo '<a href="javascript:;" id="view3D-button" class="button-red button-red-disabled"><em><b><i>'.Lang::main('view3D').'</i></b><span>'.Lang::main('view3D').'</span></em></a>';
endif;
@@ -51,7 +49,7 @@ if (isset($this->redButtons[BUTTON_TALENT])):
if ($b = $this->redButtons[BUTTON_TALENT]):
echo '<a href="'.$b['href'].'" class="button-red"><em><b><i>'.($b['pet'] ? Lang::main('petCalc') : Lang::main('talentCalc')).'</i></b><span>'.($b['pet'] ? Lang::main('petCalc') : Lang::main('talentCalc')).'</span></em></a>';
else:
echo '<a href="javascript:;" class="button-red button-red-disabled"><em><b><i>{if $b.pet}'.Lang::main('petCalc').'else:'.Lang::main('talentCalc').'endif;</i></b><span>{if $b.pet}'.Lang::main('petCalc').'else:'.Lang::main('talentCalc').'endif;</span></em></a>';
echo '<a href="javascript:;" class="button-red button-red-disabled"><em><b><i>'.Lang::main('talentCalc').'</i></b><span>'.Lang::main('talentCalc').'</span></em></a>';
endif;
endif;