Skip to content

Commit

Permalink
Merge pull request #6191 from planetarium/bugfix/world-boss-reward
Browse files Browse the repository at this point in the history
fix world boss reward
  • Loading branch information
tyrosine1153 authored Oct 23, 2024
2 parents b9a3eda + 6e2224a commit 2086b32
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6618,7 +6618,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!224 &1097120982747635510
RectTransform:
m_ObjectHideFlags: 0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Nekoyume.Helper;
using Nekoyume.TableData;
Expand Down Expand Up @@ -45,12 +46,24 @@ public void Reset()

public void Set(WorldBossBattleRewardSheet.Row row)
{
SetRewardItem((row.RuneMin, row.RuneMax), row.Crystal, new[] { (600402, row.Circle) });
var materials = new List<(int itemId, int quantity)>();
if (row.Circle > 0)
{
materials.Add((600402, row.Circle));
}

SetRewardItem((row.RuneMin, row.RuneMax), row.Crystal, materials);
}

public void Set(WorldBossKillRewardSheet.Row row)
{
SetRewardItem((row.RuneMin, row.RuneMax), row.Crystal, new[] { (600402, row.Circle) });
var materials = new List<(int itemId, int quantity)>();
if (row.Circle > 0)
{
materials.Add((600402, row.Circle));
}

SetRewardItem((row.RuneMin, row.RuneMax), row.Crystal, materials);
}

public void Set(WorldBossRankingRewardSheet.Row row, int myRank, int userCount)
Expand Down Expand Up @@ -93,13 +106,13 @@ public void Set(WorldBossRankingRewardSheet.Row row, int myRank, int userCount)
}

var runeSum = row.Runes.Sum(x => x.RuneQty);
SetRewardItem((runeSum, runeSum), row.Crystal, row.Materials.ToArray());
SetRewardItem((runeSum, runeSum), row.Crystal, row.Materials);
}

private void SetRewardItem(
(int min, int max) rune,
int crystal,
(int itemId, int quantity)[] materials)
List<(int itemId, int quantity)> materials)
{
runeItem.container.gameObject.SetActive(rune.max > 0);
runeItem.text.text = rune.min == rune.max
Expand All @@ -112,7 +125,7 @@ private void SetRewardItem(
for (var i = 0; i < materialItems.Length; i++)
{
var material = materialItems[i];
if (i < materials.Length)
if (i < materials.Count)
{
var (itemId, quantity) = materials[i];
material.container.gameObject.SetActive(true);
Expand Down

0 comments on commit 2086b32

Please sign in to comment.