|
4 | 4 | using Maple2.File.IO; |
5 | 5 | using Maple2.File.Parser.Enum; |
6 | 6 | using Maple2.File.Parser.Tools; |
| 7 | +using Maple2.File.Parser.Xml.Table; |
7 | 8 | using Maple2.File.Parser.Xml.Table.Server; |
| 9 | +using Fish = Maple2.File.Parser.Xml.Table.Server.Fish; |
| 10 | +using FishingSpot = Maple2.File.Parser.Xml.Table.Server.FishingSpot; |
| 11 | +using FishingSpotRoot = Maple2.File.Parser.Xml.Table.Server.FishingSpotRoot; |
| 12 | +using FishRoot = Maple2.File.Parser.Xml.Table.Server.FishRoot; |
| 13 | +using IndividualItemDrop = Maple2.File.Parser.Xml.Table.Server.IndividualItemDrop; |
| 14 | +using IndividualItemDropRoot = Maple2.File.Parser.Xml.Table.Server.IndividualItemDropRoot; |
| 15 | +using ItemMergeOptionRoot = Maple2.File.Parser.Xml.Table.Server.ItemMergeOptionRoot; |
| 16 | +using ItemOptionVariation = Maple2.File.Parser.Xml.Table.Server.ItemOptionVariation; |
| 17 | +using MergeOption = Maple2.File.Parser.Xml.Table.Server.MergeOption; |
8 | 18 |
|
9 | 19 | namespace Maple2.File.Parser; |
10 | 20 |
|
@@ -48,6 +58,7 @@ public class ServerTableParser { |
48 | 58 | private readonly XmlSerializer itemOptionProbabilitySerializer; |
49 | 59 | private readonly XmlSerializer itemOptionVariationSerializer; |
50 | 60 | private readonly XmlSerializer itemOptionRandomSerializer; |
| 61 | + private readonly XmlSerializer constantsSerializer; |
51 | 62 |
|
52 | 63 | public ServerTableParser(M2dReader xmlReader) { |
53 | 64 | this.xmlReader = xmlReader; |
@@ -89,6 +100,7 @@ public ServerTableParser(M2dReader xmlReader) { |
89 | 100 | itemOptionProbabilitySerializer = new XmlSerializer(typeof(ItemOptionProbabilityRoot)); |
90 | 101 | itemOptionVariationSerializer = new XmlSerializer(typeof(ItemOptionVariationRoot)); |
91 | 102 | itemOptionRandomSerializer = new XmlSerializer(typeof(ItemOptionRandomRoot)); |
| 103 | + constantsSerializer = new XmlSerializer(typeof(Constants)); |
92 | 104 |
|
93 | 105 | // var seen = new HashSet<string>(); |
94 | 106 | // this.bankTypeSerializer.UnknownAttribute += (sender, args) => { |
@@ -679,4 +691,15 @@ public ServerTableParser(M2dReader xmlReader) { |
679 | 691 | yield return (option.code, option); |
680 | 692 | } |
681 | 693 | } |
| 694 | + |
| 695 | + public IEnumerable<(string Key, Constants.Key key)> ParseConstants() { |
| 696 | + string xml = Sanitizer.RemoveEmpty(xmlReader.GetString(xmlReader.GetEntry("table/Server/constants.xml"))); |
| 697 | + var reader = XmlReader.Create(new StringReader(xml)); |
| 698 | + var data = constantsSerializer.Deserialize(reader) as Constants; |
| 699 | + Debug.Assert(data != null); |
| 700 | + |
| 701 | + foreach (Constants.Key key in data.v) { |
| 702 | + yield return (key.key, key); |
| 703 | + } |
| 704 | + } |
682 | 705 | } |
0 commit comments