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 check slot logic #3091

Merged
11 changes: 11 additions & 0 deletions Lib9c/Action/AdventureBoss/ExploreAdventureBoss.cs
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,17 @@ public override IWorld Execute(IActionContext context)
break;
}

// just validate
foreach (var runeSlotInfo in runeSlotState.GetRuneSlot())
{
if (runeSlotInfo.RuneId is null)
{
continue;
}

runeStates.GetRuneState(runeSlotInfo.RuneId.Value);
}
Copy link
Member

@ipdae ipdae Dec 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

다른 액션들과 동작이 조금 다른데(루프를 도는 대상도 다른듯하고) 이유가 있을까요?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rune state를 가져오는 구현이 다른것처럼 보입니다

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

잘못 확인했네요 구현 통일할 수 있어 보입니다


exploreBoard.UsedApPotion += exploreAp;
explorer.UsedApPotion += exploreAp;

Expand Down
6 changes: 6 additions & 0 deletions Lib9c/Action/EventDungeonBattle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,12 @@ is Bencodex.Types.List serializedEventDungeonInfoList
states = states.SetRuneState(AvatarAddress, runeStates);
}

// just validate
foreach (var runeSlotInfo in RuneInfos)
{
runeStates.GetRuneState(runeSlotInfo.RuneId);
}

var random = context.GetRandom();
var collectionModifiers = new List<StatModifier>();
if (collectionExist)
Expand Down
6 changes: 6 additions & 0 deletions Lib9c/Action/HackAndSlash.cs
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,12 @@ public IWorld Execute(
states = states.SetRuneState(AvatarAddress, runeStates);
}

// just validate
foreach (var runeSlotInfo in RuneInfos)
{
runeStates.GetRuneState(runeSlotInfo.RuneId);
}

slotstateActivity?.Dispose();
sw.Stop();
Log.Verbose("{AddressesHex} {Source} HAS {Process} from #{BlockIndex}: {Elapsed}",
Expand Down
6 changes: 6 additions & 0 deletions Lib9c/Action/HackAndSlashSweep.cs
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,12 @@ public override IWorld Execute(IActionContext context)
states = states.SetRuneState(avatarAddress, runeStates);
}

// just validate
foreach (var runeSlotInfo in runeInfos)
{
runeStates.GetRuneState(runeSlotInfo.RuneId);
}

var equippedRune = new List<RuneState>();
foreach (var runeInfo in runeSlotState.GetEquippedRuneSlotInfos())
{
Expand Down
6 changes: 6 additions & 0 deletions Lib9c/Action/Raid.cs
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,12 @@ public override IWorld Execute(IActionContext context)
states = states.SetRuneState(AvatarAddress, runeStates);
}

// just validate
foreach (var runeSlotInfo in RuneInfos)
{
runeStates.GetRuneState(runeSlotInfo.RuneId);
}

var collectionModifiers = new List<StatModifier>();
if (collectionExist)
{
Expand Down
6 changes: 3 additions & 3 deletions Lib9c/Model/State/AvatarState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,7 @@ public void ValidateEquipments(List<Guid> equipmentIds, long blockIndex)
{
if (!inventory.TryGetNonFungibleItem(itemId, out ItemUsable outNonFungibleItem))
{
continue;
throw new ItemDoesNotExistException($"Equipment {itemId} does not exist.");
}

var equipment = (Equipment) outNonFungibleItem;
Expand Down Expand Up @@ -673,7 +673,7 @@ public List<Equipment> ValidateEquipmentsV2(List<Guid> equipmentIds, long blockI
{
if (!inventory.TryGetNonFungibleItem(itemId, out ItemUsable outNonFungibleItem))
{
continue;
throw new ItemDoesNotExistException($"Equipment {itemId} does not exist.");
}

var equipment = (Equipment)outNonFungibleItem;
Expand Down Expand Up @@ -755,7 +755,7 @@ public List<Equipment> ValidateEquipmentsV3(List<Guid> equipmentIds, long blockI
{
if (!inventory.TryGetNonFungibleItem(itemId, out ItemUsable outNonFungibleItem))
{
continue;
throw new ItemDoesNotExistException($"Equipment {itemId} does not exist.");
}

var equipment = (Equipment)outNonFungibleItem;
Expand Down
3 changes: 1 addition & 2 deletions Lib9c/Model/State/RuneSlotState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
using Nekoyume.Action;
using Nekoyume.Model.EnumType;
using Nekoyume.Model.Rune;
using Nekoyume.TableData;
using Nekoyume.TableData.Rune;

namespace Nekoyume.Model.State
Expand All @@ -18,7 +17,7 @@ public static Address DeriveAddress(Address avatarAddress, BattleType battleType

public BattleType BattleType { get; }

private readonly List<RuneSlot> _slots = new List<RuneSlot>();
private readonly List<RuneSlot> _slots = new();

public RuneSlotState(BattleType battleType)
{
Expand Down
Loading