private void ReadAllowedArtifacts(BinaryFileReader reader) { if (mapObject.Header.Version != EMapFormat.ROE) { int bytes = (mapObject.Header.Version == EMapFormat.AB ? 17 : 18); HashSet <int> allowedList = new HashSet <int>(); reader.ReadBitMask(allowedList, bytes, GameConstants.ARTIFACTS_QUANTITY); } }
private void ReadAllowedSpellsAbilities(BinaryFileReader reader) { if (mapObject.Header.Version >= EMapFormat.SOD) { HashSet <int> allowedSpells = new HashSet <int>(); HashSet <int> allowedSkills = new HashSet <int>(); // Reading allowed spells (9 bytes) const int spell_bytes = 9; reader.ReadBitMask(allowedSpells, spell_bytes, GameConstants.SPELLS_QUANTITY); Console.WriteLine("allowedSpells: " + JsonConvert.SerializeObject(allowedSpells)); // Allowed hero's abilities (4 bytes) const int skill_bytes = 4; reader.ReadBitMask(allowedSkills, skill_bytes, GameConstants.SKILL_QUANTITY); Console.WriteLine("allowedSkills: " + JsonConvert.SerializeObject(allowedSkills)); } }
private void ReadAllowedHeroes(BinaryFileReader reader) { int byteCount = 20; //// mapHeader->version == EMapFormat::ROE ? 16 : 20; HashSet <int> allowedHeroSet = new HashSet <int>(); reader.ReadBitMask(allowedHeroSet, byteCount, GameConstants.HEROES_QUANTITY, false); // Probably reserved for further heroes if (true) { uint placeholdersQty = reader.ReadUInt32(); reader.Skip((int)placeholdersQty); // std::vector<ui16> placeholdedHeroes; // // for(int p = 0; p < placeholdersQty; ++p) // { // placeholdedHeroes.push_back(reader.readUInt8()); // } } }
private void ReadPredefinedHeroes(BinaryFileReader reader) { if (mapObject.Header.Version == EMapFormat.WOG || mapObject.Header.Version == EMapFormat.SOD) { for (int z = 0; z < GameConstants.HEROES_QUANTITY; z++) { Console.WriteLine(string.Format("===Reading Predefined Hero [{0}]", z)); int custom = reader.ReadUInt8(); if (custom == 0) { Console.WriteLine("is not custom."); continue; } // Create Hero bool hasExp = reader.ReadBool(); if (hasExp) { uint exp = reader.ReadUInt32(); Console.WriteLine("Has exp:" + exp); } bool hasSecondSkills = reader.ReadBool(); if (hasSecondSkills) { uint howMany = reader.ReadUInt32(); Console.WriteLine("Has Second Skills count=" + howMany); for (int yy = 0; yy < howMany; ++yy) { int first = reader.ReadUInt8(); int second = reader.ReadUInt8(); Console.WriteLine(string.Format("Skill First: {0} Second: {1}", first, second)); } } // Set Artifacts bool artSet = reader.ReadBool(); if (artSet) { Console.WriteLine("Artifact is set."); if (false) { // Already set the pack } for (int pom = 0; pom < 16; pom++) { LoadArtifactToSlot(reader, null, pom); } if (true) { LoadArtifactToSlot(reader, null, 0); //catapult } LoadArtifactToSlot(reader, null, 0); //SpellBook // Misc5 possibly LoadArtifactToSlot(reader, null, 0); //Misc // Backpack items int amount = reader.ReadUInt16(); Console.WriteLine("Backpack item amount:" + amount); for (int ss = 0; ss < amount; ++ss) { LoadArtifactToSlot(reader, null, 0); } } bool hasCustomBio = reader.ReadBool(); if (hasCustomBio) { string biography = reader.ReadString(); Console.WriteLine("biography: " + biography); } int sex = reader.ReadUInt8(); Console.WriteLine("sex: " + sex); // Spells bool hasCustomSpells = reader.ReadBool(); if (hasCustomSpells) { HashSet <int> spells = new HashSet <int>(); reader.ReadBitMask(spells, 9, GameConstants.SPELLS_QUANTITY, false); Console.WriteLine("Spells: " + JsonConvert.SerializeObject(spells)); } bool hasCustomPrimSkills = reader.ReadBool(); if (hasCustomPrimSkills) { Console.WriteLine("Has Custom Primary Skills."); for (int xx = 0; xx < GameConstants.PRIMARY_SKILLS; xx++) { int value = reader.ReadUInt8(); Console.WriteLine("Primary Skills: " + value); } } } } }