Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add try catch for patrol reward sheet #6733

Merged
merged 1 commit into from
Jan 21, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 22 additions & 15 deletions nekoyume/Assets/_Scripts/UI/Model/PatrolReward.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,25 +73,32 @@ public static void LoadAvatarInfo(Address avatarAddress, long lastClaimedBlockIn
public static void LoadPolicyInfo(int level, long blockIndex)
{
var patrolRewardSheet = Game.Game.instance.TableSheets.PatrolRewardSheet;
var row = patrolRewardSheet.FindByLevel(level, blockIndex);
var rewards = new List<PatrolRewardModel>();
foreach (var rewardModel in row.Rewards)
try
{
rewards.Add(new PatrolRewardModel
var row = patrolRewardSheet.FindByLevel(level, blockIndex);
var rewards = new List<PatrolRewardModel>();
foreach (var rewardModel in row.Rewards)
{
Currency = rewardModel.Ticker,
ItemId = rewardModel.ItemId,
PerInterval = rewardModel.Count,
});
rewards.Add(new PatrolRewardModel
{
Currency = rewardModel.Ticker,
ItemId = rewardModel.ItemId,
PerInterval = rewardModel.Count,
});
}
var policy = new PolicyModel
{
MinimumLevel = row.MinimumLevel,
MaxLevel = row.MaxLevel,
RequiredBlockInterval = row.Interval,
Rewards = rewards,
};
SetPolicyModel(policy);
}
var policy = new PolicyModel
catch (InvalidOperationException)
{
MinimumLevel = row.MinimumLevel,
MaxLevel = row.MaxLevel,
RequiredBlockInterval = row.Interval,
Rewards = rewards,
};
SetPolicyModel(policy);
Debug.LogError("No activated policy matches the criteria.");
}
}

public static void ClaimReward(System.Action onSuccess)
Expand Down
Loading