Skip to content

Commit

Permalink
Changed AgentState to ignore unlockedOptions during serialization and…
Browse files Browse the repository at this point in the history
… deserialization
  • Loading branch information
greymistcube committed Feb 28, 2024
1 parent be6c238 commit dc8a64c
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions Lib9c/Model/State/AgentState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@ public class AgentState : State, ICloneable

public readonly Dictionary<int, Address> avatarAddresses;

[Obsolete(
"No longer used. Any changes will be ignored when serialized. " +
"Should be removed once old actions referencing this field is removed.")]
public HashSet<int> unlockedOptions;

public int MonsterCollectionRound { get; private set; }

public int Version { get; private set; }
Expand All @@ -41,9 +45,7 @@ public AgentState(Dictionary serialized)
kv => kv.Value.ToAddress()
);
#pragma warning restore LAA1002
unlockedOptions = serialized.ContainsKey((IKey)(Text) "unlockedOptions")
? serialized["unlockedOptions"].ToHashSet(StateExtensions.ToInteger)
: new HashSet<int>();
unlockedOptions = new HashSet<int>();
MonsterCollectionRound = serialized.ContainsKey((IKey) (Text) MonsterCollectionRoundKey)
? serialized[MonsterCollectionRoundKey].ToInteger()
: 0;
Expand All @@ -61,7 +63,7 @@ public AgentState(List serialized)
kv => kv.Value.ToAddress()
);
#pragma warning restore LAA1002
unlockedOptions = serialized[3].ToHashSet(StateExtensions.ToInteger);
unlockedOptions = new HashSet<int>();
MonsterCollectionRound = serialized[4].ToInteger();
}

Expand Down Expand Up @@ -97,7 +99,7 @@ public override IValue SerializeList()
new KeyValuePair<IKey, IValue>(
new Binary(BitConverter.GetBytes(kv.Key)),
kv.Value.Serialize()))),
unlockedOptions.Select(i => i.Serialize()).Serialize(),
new List(),
#pragma warning restore LAA1002
MonsterCollectionRound.Serialize());
}
Expand Down

0 comments on commit dc8a64c

Please sign in to comment.