diff --git a/Lib9c/Action/AdventureBoss/ClaimAdventureBossReward.cs b/Lib9c/Action/AdventureBoss/ClaimAdventureBossReward.cs index 57fd8de3bc..7f1c90bc75 100644 --- a/Lib9c/Action/AdventureBoss/ClaimAdventureBossReward.cs +++ b/Lib9c/Action/AdventureBoss/ClaimAdventureBossReward.cs @@ -19,25 +19,26 @@ namespace Nekoyume.Action.AdventureBoss { [Serializable] [ActionType(TypeIdentifier)] - public class ClaimAdventureBossReward : ActionBase + public class ClaimAdventureBossReward : GameAction { public const string TypeIdentifier = "claim_adventure_boss_reward"; public long Season; public Address AvatarAddress; - public override IValue PlainValue => Dictionary.Empty - .Add("type_id", TypeIdentifier) - .Add("values", List.Empty - .Add(Season.Serialize()) - .Add(AvatarAddress.Serialize()) - ); + protected override IImmutableDictionary PlainValueInternal => + new Dictionary + { + ["s"] = (Integer)Season, + ["a"] = AvatarAddress.Serialize(), + }.ToImmutableDictionary(); - public override void LoadPlainValue(IValue plainValue) + protected override void LoadPlainValueInternal( + IImmutableDictionary plainValue + ) { - var values = (List)((Dictionary)plainValue)["values"]; - Season = values[0].ToInteger(); - AvatarAddress = values[1].ToAddress(); + Season = (Integer)plainValue["s"]; + AvatarAddress = plainValue["a"].ToAddress(); } public override IWorld Execute(IActionContext context) diff --git a/Lib9c/Action/AdventureBoss/ExploreAdventureBoss.cs b/Lib9c/Action/AdventureBoss/ExploreAdventureBoss.cs index 4cd6cfcf72..f456283312 100644 --- a/Lib9c/Action/AdventureBoss/ExploreAdventureBoss.cs +++ b/Lib9c/Action/AdventureBoss/ExploreAdventureBoss.cs @@ -9,7 +9,6 @@ using Nekoyume.Action.Exceptions.AdventureBoss; using Nekoyume.Battle; using Nekoyume.Battle.AdventureBoss; -using Nekoyume.Data; using Nekoyume.Extensions; using Nekoyume.Helper; using Nekoyume.Model.AdventureBoss; diff --git a/Lib9c/Action/AdventureBoss/SweepAdventureBoss.cs b/Lib9c/Action/AdventureBoss/SweepAdventureBoss.cs index 51fdaa69bc..29ec0debb5 100644 --- a/Lib9c/Action/AdventureBoss/SweepAdventureBoss.cs +++ b/Lib9c/Action/AdventureBoss/SweepAdventureBoss.cs @@ -38,10 +38,10 @@ public class SweepAdventureBoss : GameAction protected override IImmutableDictionary PlainValueInternal => new Dictionary { - ["season"] = (Integer)Season, - ["avatarAddress"] = AvatarAddress.Serialize(), - ["costumes"] = new List(Costumes.OrderBy(i => i).Select(e => e.Serialize())), - ["equipments"] = + ["s"] = (Integer)Season, + ["a"] = AvatarAddress.Serialize(), + ["c"] = new List(Costumes.OrderBy(i => i).Select(e => e.Serialize())), + ["e"] = new List(Equipments.OrderBy(i => i).Select(e => e.Serialize())), ["r"] = RuneInfos.OrderBy(x => x.SlotIndex).Select(x => x.Serialize()) .Serialize(), @@ -50,10 +50,10 @@ public class SweepAdventureBoss : GameAction protected override void LoadPlainValueInternal( IImmutableDictionary plainValue) { - Season = (Integer)plainValue["season"]; - AvatarAddress = plainValue["avatarAddress"].ToAddress(); - Costumes = ((List)plainValue["costumes"]).Select(e => e.ToGuid()).ToList(); - Equipments = ((List)plainValue["equipments"]).Select(e => e.ToGuid()).ToList(); + Season = (Integer)plainValue["s"]; + AvatarAddress = plainValue["a"].ToAddress(); + Costumes = ((List)plainValue["c"]).Select(e => e.ToGuid()).ToList(); + Equipments = ((List)plainValue["e"]).Select(e => e.ToGuid()).ToList(); RuneInfos = plainValue["r"].ToList(x => new RuneSlotInfo((List)x)); } diff --git a/Lib9c/Action/AdventureBoss/UnlockFloor.cs b/Lib9c/Action/AdventureBoss/UnlockFloor.cs index cf53e384b9..50aa32160c 100644 --- a/Lib9c/Action/AdventureBoss/UnlockFloor.cs +++ b/Lib9c/Action/AdventureBoss/UnlockFloor.cs @@ -1,4 +1,6 @@ using System; +using System.Collections.Generic; +using System.Collections.Immutable; using System.Linq; using Bencodex.Types; using Libplanet.Action; @@ -15,7 +17,7 @@ namespace Nekoyume.Action.AdventureBoss { [Serializable] [ActionType(TypeIdentifier)] - public class UnlockFloor : ActionBase + public class UnlockFloor : GameAction { public const string TypeIdentifier = "unlock_floor"; public const int TotalFloor = 20; @@ -25,21 +27,20 @@ public class UnlockFloor : ActionBase public Address AvatarAddress; public bool UseNcg; - public override IValue PlainValue => Dictionary.Empty - .Add("type_id", TypeIdentifier) - .Add("values", - List.Empty - .Add(Season.Serialize()) - .Add(AvatarAddress.Serialize()) - .Add(UseNcg.Serialize()) - ); + protected override IImmutableDictionary PlainValueInternal => + new Dictionary + { + ["s"] = (Integer)Season, + ["a"] = AvatarAddress.Serialize(), + ["u"] = UseNcg.Serialize(), + }.ToImmutableDictionary(); - public override void LoadPlainValue(IValue plainValue) + protected override void LoadPlainValueInternal( + IImmutableDictionary plainValue) { - var list = (List)((Dictionary)plainValue)["values"]; - Season = list[0].ToInteger(); - AvatarAddress = list[1].ToAddress(); - UseNcg = list[2].ToBoolean(); + Season = (Integer)plainValue["s"]; + AvatarAddress = plainValue["a"].ToAddress(); + UseNcg = plainValue["u"].ToBoolean(); } public override IWorld Execute(IActionContext context) diff --git a/Lib9c/Action/AdventureBoss/Wanted.cs b/Lib9c/Action/AdventureBoss/Wanted.cs index 3a37ef2a06..06cfcde6c7 100644 --- a/Lib9c/Action/AdventureBoss/Wanted.cs +++ b/Lib9c/Action/AdventureBoss/Wanted.cs @@ -1,4 +1,6 @@ using System; +using System.Collections.Generic; +using System.Collections.Immutable; using System.Linq; using Bencodex.Types; using Libplanet.Action; @@ -19,7 +21,7 @@ namespace Nekoyume.Action.AdventureBoss { [Serializable] [ActionType(TypeIdentifier)] - public class Wanted : ActionBase + public class Wanted : GameAction { public const string TypeIdentifier = "wanted"; @@ -27,20 +29,21 @@ public class Wanted : ActionBase public FungibleAssetValue Bounty; public Address AvatarAddress; - public override IValue PlainValue => - Dictionary.Empty - .Add("type_id", TypeIdentifier) - .Add("values", List.Empty - .Add(Season.Serialize()) - .Add(Bounty.Serialize()) - .Add(AvatarAddress.Serialize())); - - public override void LoadPlainValue(IValue plainValue) + protected override IImmutableDictionary PlainValueInternal => + new Dictionary + { + ["s"] = (Integer)Season, + ["b"] = Bounty.Serialize(), + ["a"] = AvatarAddress.Serialize() + }.ToImmutableDictionary(); + + protected override void LoadPlainValueInternal( + IImmutableDictionary plainValue + ) { - var list = (List)((Dictionary)plainValue)["values"]; - Season = list[0].ToInteger(); - Bounty = list[1].ToFungibleAssetValue(); - AvatarAddress = list[2].ToAddress(); + Season = (Integer)plainValue["s"]; + Bounty = plainValue["b"].ToFungibleAssetValue(); + AvatarAddress = plainValue["a"].ToAddress(); } public override IWorld Execute(IActionContext context)