예제 #1
0
        public static PrestigeMetadata Parse(MemoryMappedFile m2dFile, IEnumerable <PackFileEntry> entries)
        {
            PrestigeMetadata prestigeMetadata = new PrestigeMetadata();

            foreach (PackFileEntry entry in entries)
            {
                // Only check for reward for now, abilities will need to be added later
                if (!entry.Name.StartsWith("table/adventurelevelreward"))
                {
                    continue;
                }

                // Parse XML
                XmlDocument document = m2dFile.GetDocument(entry.FileHeader);
                XmlNodeList rewards  = document.SelectNodes("/ms2/reward");

                foreach (XmlNode reward in rewards)
                {
                    int    level = int.Parse(reward.Attributes["level"].Value);
                    string type  = reward.Attributes["type"].Value;
                    int    id    = int.Parse(reward.Attributes["id"].Value.Length == 0 ? "0" : reward.Attributes["id"].Value);
                    int    value = int.Parse(reward.Attributes["value"].Value);

                    prestigeMetadata.Rewards.Add(new PrestigeReward(level, type, id, value));
                }
            }

            return(prestigeMetadata);
        }
예제 #2
0
        public static void Init()
        {
            using FileStream stream = File.OpenRead($"{Paths.RESOURCES}/ms2-prestige-metadata");
            PrestigeMetadata metadata = Serializer.Deserialize <PrestigeMetadata>(stream);

            foreach (PrestigeReward reward in metadata.Rewards)
            {
                rewards.Add(reward.Level, reward);
            }
        }
예제 #3
0
        static PrestigeMetadataStorage()
        {
            using FileStream stream = File.OpenRead("Maple2Storage/Resources/ms2-prestige-metadata");
            PrestigeMetadata metadata = Serializer.Deserialize <PrestigeMetadata>(stream);

            foreach (PrestigeReward reward in metadata.Rewards)
            {
                rewards.Add(reward.Level, reward);
            }
        }
        public void Export()
        {
            string headerFile            = VariableDefines.XML_PATH.Replace(".m2d", ".m2h");
            List <PackFileEntry> files   = FileList.ReadFile(File.OpenRead(headerFile));
            MemoryMappedFile     memFile = MemoryMappedFile.CreateFromFile(VariableDefines.XML_PATH);

            // Parse and save some item data from xml file
            PrestigeMetadata PrestigeMetadata = PrestigeParser.Parse(memFile, files);

            PrestigeParser.Write(PrestigeMetadata);
        }
예제 #5
0
 public static void Write(PrestigeMetadata prestigeMetadata)
 {
     using (FileStream writeStream = File.Create(VariableDefines.OUTPUT + "ms2-prestige-metadata"))
     {
         Serializer.Serialize(writeStream, prestigeMetadata);
     }
     using (FileStream readStream = File.OpenRead(VariableDefines.OUTPUT + "ms2-prestige-metadata"))
     {
         // Ensure the file is read equivalent
         // Debug.Assert(skills.SequenceEqual(Serializer.Deserialize<List<SkillMetadata>>(readStream)));
     }
     Console.WriteLine("\rSuccessfully parsed prestige metadata!");
 }
예제 #6
0
        public static void Export(List <PackFileEntry> files, MemoryMappedFile memFile)
        {
            if (Hash.CheckHash(VariableDefines.OUTPUT + "ms2-prestige-metadata"))
            {
                Console.WriteLine("\rSkipping prestige metadata!");
                return;
            }

            // Parse and save some item data from xml file
            PrestigeMetadata PrestigeMetadata = PrestigeParser.Parse(memFile, files);

            PrestigeParser.Write(PrestigeMetadata);
            Hash.WriteHash(VariableDefines.OUTPUT + "ms2-prestige-metadata");
        }