mirror of
https://github.com/Sarjuuk/aowow.git
synced 2025-11-29 15:58:16 +08:00
Items/ExtraLoot
* break down chances for loot from skill_extra_item_template * rename tab to make it clear that its content is a bonus
This commit is contained in:
@@ -682,6 +682,7 @@ class SpellPage extends GenericPage
|
|||||||
$lv = $spellLoot->getResult();
|
$lv = $spellLoot->getResult();
|
||||||
$extraCols = $spellLoot->extraCols;
|
$extraCols = $spellLoot->extraCols;
|
||||||
$extraCols[] = '$Listview.extraCols.percent';
|
$extraCols[] = '$Listview.extraCols.percent';
|
||||||
|
$lvName = '$LANG.tab_contains';
|
||||||
|
|
||||||
if ($extraItem && $this->subject->canCreateItem())
|
if ($extraItem && $this->subject->canCreateItem())
|
||||||
{
|
{
|
||||||
@@ -691,8 +692,10 @@ class SpellPage extends GenericPage
|
|||||||
{
|
{
|
||||||
if (($bar = $this->subject->getField('effect'.$i.'CreateItemId')) && isset($foo[$bar]))
|
if (($bar = $this->subject->getField('effect'.$i.'CreateItemId')) && isset($foo[$bar]))
|
||||||
{
|
{
|
||||||
|
$lvName = '$LANG.tab_bonusloot';
|
||||||
$lv[$bar] = $foo[$bar];
|
$lv[$bar] = $foo[$bar];
|
||||||
$lv[$bar]['percent'] = $extraItem['additionalCreateChance'];
|
$lv[$bar]['percent'] = $extraItem['additionalCreateChance'];
|
||||||
|
$lv[$bar]['pctstack'] = $this->buildPctStack($extraItem['additionalCreateChance'] / 100, $extraItem['additionalMaxNum']);
|
||||||
$lv[$bar]['condition'][0][$this->typeId][] = [[CND_SPELL, $extraItem['requiredSpecialization']]];
|
$lv[$bar]['condition'][0][$this->typeId][] = [[CND_SPELL, $extraItem['requiredSpecialization']]];
|
||||||
$this->extendGlobalIds(Type::SPELL, $extraItem['requiredSpecialization']);
|
$this->extendGlobalIds(Type::SPELL, $extraItem['requiredSpecialization']);
|
||||||
$extraCols[] = '$Listview.extraCols.condition';
|
$extraCols[] = '$Listview.extraCols.condition';
|
||||||
@@ -706,7 +709,7 @@ class SpellPage extends GenericPage
|
|||||||
|
|
||||||
$this->lvTabs[] = [ItemList::$brickFile, array(
|
$this->lvTabs[] = [ItemList::$brickFile, array(
|
||||||
'data' => array_values($lv),
|
'data' => array_values($lv),
|
||||||
'name' => '$LANG.tab_contains',
|
'name' => $lvName,
|
||||||
'id' => 'contains',
|
'id' => 'contains',
|
||||||
'hiddenCols' => ['side', 'slot', 'source', 'reqlevel'],
|
'hiddenCols' => ['side', 'slot', 'source', 'reqlevel'],
|
||||||
'extraCols' => array_unique($extraCols)
|
'extraCols' => array_unique($extraCols)
|
||||||
@@ -1244,6 +1247,27 @@ class SpellPage extends GenericPage
|
|||||||
return sprintf($this->powerTpl, $this->typeId, User::$localeId, Util::toJSON($power, JSON_AOWOW_POWER));
|
return sprintf($this->powerTpl, $this->typeId, User::$localeId, Util::toJSON($power, JSON_AOWOW_POWER));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function buildPctStack(float $baseChance, int $maxStack) : string
|
||||||
|
{
|
||||||
|
// note: pctStack does not contain absolute values but chances relative to the overall drop chance
|
||||||
|
// e.g.: dropChance is 17% then [1 => 50, 2 => 25, 3 => 25] displays > Stack of 1: 8%; Stack of 2: 4%; Stack of 3: 4%
|
||||||
|
$maxStack = $maxStack ?: 1;
|
||||||
|
$pctStack = [];
|
||||||
|
for ($i = 1; $i <= $maxStack; $i++)
|
||||||
|
{
|
||||||
|
$pctStack[$i] = (($baseChance ** $i) * 100) / $baseChance ;
|
||||||
|
|
||||||
|
// remove chance from previous stacks
|
||||||
|
for ($j = 1; $j < $i; $j++)
|
||||||
|
$pctStack[$j] -= ($pctStack[$i] / ($i - 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
// cleanup tiny fractions
|
||||||
|
$pctStack = array_filter($pctStack, function($x) use ($baseChance) { return $x * $baseChance >= 0.01; });
|
||||||
|
|
||||||
|
return json_encode($pctStack, JSON_NUMERIC_CHECK);
|
||||||
|
}
|
||||||
|
|
||||||
private function appendReagentItem(&$reagentResult, $_iId, $_qty, $_mult, $_level, $_path, $alreadyUsed)
|
private function appendReagentItem(&$reagentResult, $_iId, $_qty, $_mult, $_level, $_path, $alreadyUsed)
|
||||||
{
|
{
|
||||||
if (in_array($_iId, $alreadyUsed))
|
if (in_array($_iId, $alreadyUsed))
|
||||||
|
|||||||
@@ -3176,6 +3176,7 @@ var LANG = {
|
|||||||
tab_weaponskills: "Waffenfertigkeit",
|
tab_weaponskills: "Waffenfertigkeit",
|
||||||
tab_world: "Welt",
|
tab_world: "Welt",
|
||||||
tab_zones: "Gebiete",
|
tab_zones: "Gebiete",
|
||||||
|
tab_bonusloot: "Bonusbeute", // aowow - custom from BONUS_LOOT_LABEL
|
||||||
|
|
||||||
numberofupvotesreceived_tip: "Anzahl von positiven Bewertungen erhalten",
|
numberofupvotesreceived_tip: "Anzahl von positiven Bewertungen erhalten",
|
||||||
deletethisreply_stc: "Antwort löschen",
|
deletethisreply_stc: "Antwort löschen",
|
||||||
|
|||||||
@@ -3225,6 +3225,7 @@ var LANG = {
|
|||||||
tab_weaponskills: "Weapon Skills",
|
tab_weaponskills: "Weapon Skills",
|
||||||
tab_world: "World",
|
tab_world: "World",
|
||||||
tab_zones: "Zones",
|
tab_zones: "Zones",
|
||||||
|
tab_bonusloot: "Bonus Loot", // aowow - custom from BONUS_LOOT_LABEL
|
||||||
|
|
||||||
numberofupvotesreceived_tip: "Number of upvotes received",
|
numberofupvotesreceived_tip: "Number of upvotes received",
|
||||||
deletethisreply_stc: "Delete this reply",
|
deletethisreply_stc: "Delete this reply",
|
||||||
|
|||||||
@@ -3176,6 +3176,7 @@ var LANG = {
|
|||||||
tab_weaponskills: "Habilidades con armas",
|
tab_weaponskills: "Habilidades con armas",
|
||||||
tab_world: "Mundo",
|
tab_world: "Mundo",
|
||||||
tab_zones: "Zonas",
|
tab_zones: "Zonas",
|
||||||
|
tab_bonusloot: "Bonus de botín", // aowow - custom from BONUS_LOOT_LABEL
|
||||||
|
|
||||||
numberofupvotesreceived_tip: "Número de valoraciones positivas recibidas ",
|
numberofupvotesreceived_tip: "Número de valoraciones positivas recibidas ",
|
||||||
deletethisreply_stc: "Borrar esta respuesta",
|
deletethisreply_stc: "Borrar esta respuesta",
|
||||||
|
|||||||
@@ -3177,6 +3177,7 @@ var LANG = {
|
|||||||
tab_weaponskills: "Compétences d'armes",
|
tab_weaponskills: "Compétences d'armes",
|
||||||
tab_world: "Monde",
|
tab_world: "Monde",
|
||||||
tab_zones: "Zones",
|
tab_zones: "Zones",
|
||||||
|
tab_bonusloot: "Butin bonus", // aowow - custom from BONUS_LOOT_LABEL
|
||||||
|
|
||||||
numberofupvotesreceived_tip: "Nombre de votes positifs reçus",
|
numberofupvotesreceived_tip: "Nombre de votes positifs reçus",
|
||||||
deletethisreply_stc: "Effacer cette réponse",
|
deletethisreply_stc: "Effacer cette réponse",
|
||||||
|
|||||||
@@ -3177,6 +3177,7 @@ var LANG = {
|
|||||||
tab_weaponskills: "Оружейные навыки",
|
tab_weaponskills: "Оружейные навыки",
|
||||||
tab_world: "Игровой мир",
|
tab_world: "Игровой мир",
|
||||||
tab_zones: "Местности",
|
tab_zones: "Местности",
|
||||||
|
tab_bonusloot: "Доп. добыча", // aowow - custom from BONUS_LOOT_LABEL
|
||||||
|
|
||||||
numberofupvotesreceived_tip: "Голосов получено",
|
numberofupvotesreceived_tip: "Голосов получено",
|
||||||
deletethisreply_stc: "Удалить этот ответ",
|
deletethisreply_stc: "Удалить этот ответ",
|
||||||
|
|||||||
@@ -3224,6 +3224,7 @@ var LANG = {
|
|||||||
tab_weaponskills: "武器技能",
|
tab_weaponskills: "武器技能",
|
||||||
tab_world: "世界",
|
tab_world: "世界",
|
||||||
tab_zones: "地区",
|
tab_zones: "地区",
|
||||||
|
tab_bonusloot: "奖励战利品", // aowow - custom from BONUS_LOOT_LABEL
|
||||||
|
|
||||||
numberofupvotesreceived_tip: "收到顶票数量",
|
numberofupvotesreceived_tip: "收到顶票数量",
|
||||||
deletethisreply_stc: "删除本评论",
|
deletethisreply_stc: "删除本评论",
|
||||||
|
|||||||
Reference in New Issue
Block a user