Items/Enchantments
* cleanup list generation for random enchantments * note that rand enchants should be grouped purely by stat type, which requires more work than it is currently worth
This commit is contained in:
parent
d34765eed5
commit
8f9acedb8f
2 changed files with 9 additions and 32 deletions
|
|
@ -375,6 +375,8 @@ class ItemBaseResponse extends TemplateResponse implements ICache
|
|||
);
|
||||
|
||||
// merge identical stats and names for normal users (e.g. spellPower of a specific school became general spellPower with 3.0)
|
||||
// see: https://web.archive.org/web/20101118041612/wowhead.com/item=11946
|
||||
// stats should also be merged if only the keys are the same, resulting in "+(8 - 9) Spirit" etc.
|
||||
|
||||
if (!User::isInGroup(U_GROUP_EMPLOYEE))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -47,46 +47,21 @@ if ($this->subItems):
|
|||
?>
|
||||
<div class="clear"></div>
|
||||
<h3><?=Lang::item('_rndEnchants'); ?></h3>
|
||||
|
||||
<?php
|
||||
foreach (array_chunk($this->subItems['data'], ceil(count($this->subItems['data']) / 2)) as $columns):
|
||||
?>
|
||||
<div class="random-enchantments" style="margin-right: 25px">
|
||||
<ul>
|
||||
<?php
|
||||
foreach ($this->subItems['data'] as $k => $i):
|
||||
if ($k < (count($this->subItems['data']) / 2)):
|
||||
$eText = [];
|
||||
foreach ($i['enchantment'] as $eId => $txt):
|
||||
$eText[] = '<a style="text-decoration:none; color:#CCCCCC;" href="?enchantment='.$eId.'">'.$txt.'</a>';
|
||||
endforeach;
|
||||
|
||||
echo ' <li><div><span title="ID'.Lang::main('colon').$this->subItems['randIds'][$k].'" class="tip q'.$this->subItems['quality'].'">...'.$i['name'].'</span>';
|
||||
echo ' <small class="q0">'.Lang::item('_chance', [$i['chance']]).'</small><br />'.implode(', ', $eText).'</div></li>';
|
||||
endif;
|
||||
foreach ($columns as $k => ['name' => $name, 'enchantment' => $enchantment, 'chance' => $chance]):
|
||||
echo ' <li><div><span title="ID'.Lang::main('colon').$this->subItems['randIds'][$k].'" class="tip q'.$this->subItems['quality'].'">...'.$name.'</span> <small class="q0">'.Lang::item('_chance', [$chance]).'</small><br />';
|
||||
echo Lang::concat($enchantment, Lang::CONCAT_NONE, fn($txt, $eId) => '<a style="text-decoration:none; color:#CCCCCC;" href="?enchantment='.$eId.'">'.$txt.'</a>')."</div></li>\n";
|
||||
endforeach;
|
||||
?>
|
||||
</ul>
|
||||
</div>
|
||||
<?php
|
||||
if (count($this->subItems) > 1):
|
||||
?>
|
||||
<div class="random-enchantments" style="margin-right: 25px">
|
||||
<ul>
|
||||
<?php
|
||||
foreach ($this->subItems['data'] as $k => $i):
|
||||
if ($k >= (count($this->subItems['data']) / 2)):
|
||||
$eText = [];
|
||||
foreach ($i['enchantment'] as $eId => $txt):
|
||||
$eText[] = '<a style="text-decoration:none; color:#CCCCCC;" href="?enchantment='.$eId.'">'.$txt.'</a>';
|
||||
endforeach;
|
||||
|
||||
echo ' <li><div><span title="ID'.Lang::main('colon').$this->subItems['randIds'][$k].'" class="tip q'.$this->subItems['quality'].'">...'.$i['name'].'</span>';
|
||||
echo ' <small class="q0">'.sprintf(Lang::item('_chance'), $i['chance']).'</small><br />'.implode(', ', $eText).'</div></li>';
|
||||
endif;
|
||||
endforeach;
|
||||
?>
|
||||
</ul>
|
||||
</div>
|
||||
<?php
|
||||
endif;
|
||||
endforeach;
|
||||
endif;
|
||||
|
||||
$this->brick('book');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue