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

Update v200200 Latest Data #2678

Merged
merged 10 commits into from
Jul 18, 2024
Merged
Show file tree
Hide file tree
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
62 changes: 34 additions & 28 deletions .Lib9c.Tests/Action/AdventureBoss/ClaimAdventureBossRewardTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,12 @@ public static IEnumerable<object[]> GetWantedTestData()
ItemReward = new Dictionary<int, int>
{
{ 600201, 168 },
{ 600202, 0 },
{ 600202, 18 },
{ 600203, 0 },
},
FavReward = new Dictionary<int, int>
{
{ 20001, 14 },
{ 20001, 0 },
{ 30001, 0 },
},
},
Expand All @@ -147,12 +147,12 @@ public static IEnumerable<object[]> GetWantedTestData()
{
600201, 168
}, // (200*1.2) * 0.7 / 0.5 * (120/240)
{ 600202, 0 },
{ 600202, 18 }, // (200*1.2) * 0.3 / 2 * (120/240)
{ 600203, 0 },
},
FavReward = new Dictionary<int, int>
{
{ 20001, 14 }, // (200*1.2) * 0.3 / 2.5 * (120/240)
{ 20001, 0 },
{ 30001, 0 },
},
},
Expand All @@ -169,12 +169,12 @@ public static IEnumerable<object[]> GetWantedTestData()
{
600201, 140
}, // (300*1.2) * 0.7 / 0.5 * (100/360)
{ 600202, 0 },
{ 600202, 15 }, // (300*1.2) * 0.3 / 2 * (100/360)
{ 600203, 0 },
},
FavReward = new Dictionary<int, int>
{
{ 20001, 11 }, // (300*1.2) * 0.3 / 2.5 * (100/360)
{ 20001, 0 },
{ 30001, 0 },
},
},
Expand All @@ -190,8 +190,8 @@ public static IEnumerable<object[]> GetExploreTestData()
NcgReward = (5 + 15) * NCG, // 5NCG for raffle, 15NCG for 15% distribution
ItemReward = new Dictionary<int, int>
{
{ 600201, 0 },
{ 600202, 66 }, // 100AP / 1.5 ratio * 100% contribution
{ 600201, 80 }, // 100AP * 0.4 Exchange / 0.5 ratio * 100% contribution
{ 600202, 0 },
{ 600203, 0 },
},
FavReward = new Dictionary<int, int>
Expand All @@ -215,8 +215,10 @@ public static IEnumerable<object[]> GetExploreTestData()
),
ItemReward = new Dictionary<int, int>
{
{ 600201, 0 },
{ 600202, 66 }, // total 200 AP / 1.5 ratio * 50% contribution
{
600201, 79
}, // total 200 AP * 0.4 Exchange / 0.5 ratio * 50% contribution
{ 600202, 0 },
{ 600203, 0 },
},
FavReward = new Dictionary<int, int>
Expand All @@ -237,8 +239,10 @@ public static IEnumerable<object[]> GetExploreTestData()
NcgReward = 15 * NCG,
ItemReward = new Dictionary<int, int>
{
{ 600201, 0 },
{ 600202, 66 }, // Total 200 AP / 1.5 Ratio * 50% Contribution
{
600201, 79
}, // Total 200 AP * 0.4 Exchange / 1.5 Ratio * 50% Contribution
{ 600202, 0 },
{ 600203, 0 },
},
FavReward = new Dictionary<int, int>
Expand All @@ -258,8 +262,8 @@ public static IEnumerable<object[]> GetExploreTestData()
NcgReward = 5 * NCG,
ItemReward = new Dictionary<int, int>
{
{ 600201, 0 },
{ 600202, 66 },
{ 600201, 80 },
{ 600202, 0 },
{ 600203, 0 },
},
FavReward = new Dictionary<int, int>
Expand All @@ -282,12 +286,12 @@ public static IEnumerable<object[]> GetPrevRewardTestData()
ItemReward = new Dictionary<int, int>
{
{ 600201, 168 },
{ 600202, 0 },
{ 600202, 18 },
{ 600203, 0 },
},
FavReward = new Dictionary<int, int>
{
{ 20001, 14 },
{ 20001, 0 },
{ 30001, 0 },
},
},
Expand All @@ -300,8 +304,8 @@ public static IEnumerable<object[]> GetPrevRewardTestData()
NcgReward = 20 * NCG, // 5NCG for explore raffle, 15NCG for 15% distribution
ItemReward = new Dictionary<int, int>
{
{ 600201, 0 },
{ 600202, 66 },
{ 600201, 80 },
{ 600202, 0 },
{ 600203, 0 },
},
FavReward = new Dictionary<int, int>
Expand All @@ -320,13 +324,13 @@ public static IEnumerable<object[]> GetPrevRewardTestData()
NcgReward = 20 * NCG,
ItemReward = new Dictionary<int, int>
{
{ 600201, 168 },
{ 600202, 66 },
{ 600201, 248 },
{ 600202, 18 },
{ 600203, 0 },
},
FavReward = new Dictionary<int, int>
{
{ 20001, 14 },
{ 20001, 0 },
{ 30001, 0 },
},
},
Expand Down Expand Up @@ -438,13 +442,13 @@ public void WantedMultipleSeason()
NcgReward = 0 * NCG, // No Raffle Reward
FavReward = new Dictionary<int, int>
{
{ 20001, 28 },
{ 20001, 0 },
{ 30001, 0 },
},
ItemReward = new Dictionary<int, int>
{
{ 600201, 336 },
{ 600202, 0 },
{ 600202, 36 },
{ 600203, 0 },
},
};
Expand Down Expand Up @@ -708,8 +712,10 @@ public void ExploreMultipleSeason()
},
ItemReward = new Dictionary<int, int>
{
{ 600201, 0 },
{ 600202, 132 }, // (100 AP / 1.5 Ratio * 100% contribution) for season 1 and 3
{
600201, 160
}, // (100 AP * 0.4 Exchange / 0.5 Ratio * 100% contribution) for season 1 and 3
{ 600202, 0 },
{ 600203, 0 },
},
};
Expand Down Expand Up @@ -831,13 +837,13 @@ public void AllReward()
NcgReward = 20 * NCG,
FavReward = new Dictionary<int, int>
{
{ 20001, 14 },
{ 20001, 0 },
{ 30001, 0 },
},
ItemReward = new Dictionary<int, int>
{
{ 600201, 168 },
{ 600202, 66 },
{ 600201, 248 },
{ 600202, 18 },
{ 600203, 0 },
},
};
Expand Down
73 changes: 52 additions & 21 deletions .Lib9c.Tests/Action/AdventureBoss/ExploreAdventureBossTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,58 +98,79 @@ public static IEnumerable<object[]> GetExecuteMemberData()
// No AP potion at all
yield return new object[]
{
0, 5, 0, 0, 0, null, new (int, int)[] { },
0, 5, 0, 0, 0, null, new (int, int)[] { }, new (int, int)[] { },
};
// Start from bottom, goes to 5
yield return new object[]
{
0, 5, 5, 10, 5, null,
0, 5, 5, 20, 10, null, // 2 potions per floor
new[]
{
(600301, 69), // 50 first Reward + 19 floor reward
(600302, 50), // 50 first reward
(600303, 7), // 7 floor reward
(600301, 10), // 10 floor reward
(600302, 30), // 10+5+5+5+5 first reward
(600303, 4), // 2+2 first reward
(600304, 0),
},
new[]
{
(10033, 5), // 5 first reward
(10034, 8), // 5 first reward + 3 floor reward
},
};
// Start from bottom, goes to 3 because of potion
yield return new object[]
{
0, 5, 3, 3, 0, null, new[]
0, 5, 3, 6, 0, null, new[]
{
(600301, 47), // 30 first reward + 17 floor reward
(600302, 30), // 30 first reward
(600303, 0),
(600301, 7), // 7 floor reward
(600302, 20), // 10+5+5 first reward
(600303, 4), // 2+2 first reward
(600304, 0),
},
new[]
{
(10033, 0),
(10034, 0),
},
};
// Start from 3, goes to 5 because of locked floor
yield return new object[]
{
2, 5, 5, 5, 2, null, new[]
2, 5, 5, 10, 4, null, new[]
{
(600301, 47), // 30 first reward + 17 floor reward
(600302, 30), // 30 first reward
(600303, 0),
(600301, 4), // 4 floor reward
(600302, 15), // 5+5+5 first reward
(600303, 2), // 2 first reward
(600304, 0),
},
new[]
{
(10033, 8), // 5 first reward + 3 floor reward
(10034, 5), // 5 first reward
},
};
// Start from 6, goes to 10
// Start from 6, goes to 9
yield return new object[]
{
5, 10, 10, 10, 5, null,
5, 10, 9, 20, 10, null,
new[]
{
(600301, 76), // 50 first reward + 26 floor reward
(600302, 50), // 50 first reward
(600303, 0),
(600203, 5), // 5 first reward
(600301, 0),
(600302, 5), // 5 floor reward
(600303, 15), // 5+5+5 first reward
(600304, 0),
},
new[]
{
(10033, 8), // 5 first reward + 3 floor reward
(10034, 3), // 3 floor reward
},
};
// Start from 20, cannot enter
yield return new object[]
{
20, 20, 20, 10, 10, typeof(InvalidOperationException), null,
20, 20, 20, 10, 10, typeof(InvalidOperationException), null, null,
};
}

Expand All @@ -162,7 +183,8 @@ public void Execute(
int initialPotion,
int expectedPotion,
Type exc,
(int, int)[] expectedRewards
(int, int)[] expectedItemRewards,
(int, int)[] expectedFavRewards
)
{
// Settings
Expand All @@ -179,6 +201,7 @@ public void Execute(
var sheets = state.GetSheets(sheetTypes: new[]
{
typeof(MaterialItemSheet),
typeof(RuneSheet),
});
var materialSheet = sheets.GetSheet<MaterialItemSheet>();
var materialRow =
Expand Down Expand Up @@ -275,7 +298,7 @@ public void Execute(
Assert.Equal(expectedFloor, explorer.Floor);

var inventory = state.GetInventoryV2(TesterAvatarAddress);
foreach (var (id, amount) in expectedRewards)
foreach (var (id, amount) in expectedItemRewards)
{
if (amount == 0)
{
Expand All @@ -287,6 +310,14 @@ public void Execute(
}
}

var runeSheet = sheets.GetSheet<RuneSheet>();
foreach (var (id, amount) in expectedFavRewards)
{
var ticker = runeSheet.Values.First(rune => rune.Id == id).Ticker;
var currency = Currencies.GetRune(ticker);
Assert.Equal(amount, state.GetBalance(TesterAvatarAddress, currency).RawValue);
}

itemSlotState =
state.TryGetLegacyState(itemSlotStateAddress, out rawItemSlotState)
? new ItemSlotState(rawItemSlotState)
Expand Down
6 changes: 3 additions & 3 deletions .Lib9c.Tests/Action/AdventureBoss/SweepAdventureBossTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,19 +87,19 @@ public static IEnumerable<object[]> GetExecuteMemberData()
};
yield return new object[]
{
1, 100, 98, null, new[] { (600301, 8), (600302, 0), (600303, 0), (600304, 0), },
1, 100, 99, null, new[] { (600301, 3), (600302, 0), (600303, 0), (600304, 0), },
};
yield return new object[]
{
1, 0, 0, typeof(NotEnoughMaterialException), null,
};
yield return new object[]
{
10, 10, 10, typeof(NotEnoughMaterialException), null,
10, 1, 1, typeof(NotEnoughMaterialException), null,
};
yield return new object[]
{
20, 40, 0, null, new[] { (600301, 67), (600302, 67), (600303, 0), (600304, 0), },
20, 20, 0, null, new[] { (600301, 9), (600302, 10), (600303, 8), (600304, 8), },
};
}

Expand Down
15 changes: 12 additions & 3 deletions .Lib9c.Tests/Action/AdventureBoss/UnlockFloorTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ namespace Lib9c.Tests.Action.AdventureBoss
using Nekoyume.Model.State;
using Nekoyume.Module;
using Nekoyume.TableData;
using Nekoyume.TableData.AdventureBoss;
using Xunit;

public class UnlockFloorTest
Expand Down Expand Up @@ -86,7 +87,9 @@ public class UnlockFloorTest
// Not enough resources
[InlineData(false, true, 5, 5, typeof(NotEnoughMaterialException))]
[InlineData(true, true, 5, 5, typeof(InsufficientBalanceException))]
public void Execute(bool useNcg, bool notEnough, int startFloor, int expectedFloor, Type exc)
public void Execute(
bool useNcg, bool notEnough, int startFloor, int expectedFloor, Type exc
)
{
// Settings
var state = _initialState;
Expand All @@ -104,14 +107,20 @@ public void Execute(bool useNcg, bool notEnough, int startFloor, int expectedFlo

if (!notEnough)
{
var unlockRow = state.GetSheet<AdventureBossUnlockFloorCostSheet>().Values
.First(row => row.FloorId == 6);
if (useNcg)
{
state = state.MintAsset(new ActionContext(), TesterAddress, 5 * NCG);
state = state.MintAsset(
new ActionContext(),
TesterAddress,
unlockRow.NcgPrice * NCG
);
}
else
{
var inventory = state.GetInventoryV2(TesterAvatarAddress);
inventory.AddItem(goldenDust, 5);
inventory.AddItem(goldenDust, unlockRow.GoldenDustPrice);
state = state.SetInventory(TesterAvatarAddress, inventory);
}
}
Expand Down
Loading
Loading