private static void ParseModifierBin() { using (StreamReader rdr = new StreamReader(CryptApi.DecryptStream(GetStream(), CryptApi.NoxCryptFormat.MODIFIER))) { string type = ""; while (rdr.BaseStream.Position < rdr.BaseStream.Length) { string line = rdr.ReadLine().Trim(); if (line == "") { continue; } if (line == "END") { type = ""; continue; } if (line == "WEAPON_DEFINITIONS" || line == "ARMOR_DEFINITIONS" || line == "EFFECTIVENESS" || line == "MATERIAL" || line == "ENCHANTMENT") { type = line; continue; } Mods.Add(line, new Mod(rdr, line, type)); } } }
private static void ParseMonsterBin() { using (StreamReader rdr = new StreamReader(CryptApi.DecryptStream(GetStream(), CryptApi.NoxCryptFormat.MONSTER))) { string line; MonsterInfo minfo = new MonsterInfo(); bool monsterBlock = false; while (!rdr.EndOfStream) { line = rdr.ReadLine(); if (!monsterBlock && line.Length > 1) { minfo = new MonsterInfo(); minfo.Name = line; monsterBlock = true; continue; } if (line == "END") { monsterBlock = false; MonsterDict.Add(minfo.Name, minfo); continue; } string[] split = line.Split(' '); string type = "", val = ""; foreach (string s in split) { if (s.Length > 0) { if (s == "ARENA") { break; // ignore arena entries } if (s == "SOLO") { continue; } if (type.Length == 0) { type = s; } else { val = s; } } } switch (type) { case "HEALTH": minfo.Health = int.Parse(val); break; case "RETREAT_RATIO": minfo.RetreatRatio = float.Parse(val, NumberFormatInfo.InvariantInfo); break; case "RESUME_RATIO": minfo.ResumeRatio = float.Parse(val, NumberFormatInfo.InvariantInfo); break; case "STATUS": minfo.Status = val; break; } } } }
public NoxBinaryReader(Stream stream, CryptApi.NoxCryptFormat format) : base(CryptApi.DecryptStream(stream, format)) { }