private void loadItems(StatsDat sDat, TagsDat tagsDat) { foreach (int addr in RecordAddresses()) { var r = new ModRecord(M, sDat, tagsDat, addr); if (records.ContainsKey(r.Key)) { continue; } records.Add(r.Key, r); bool addToItemIiers = r.Domain != 3; if (!addToItemIiers) { continue; } Tuple <string, ModType> byTierKey = Tuple.Create(r.Group, r.AffixType); List <ModRecord> groupMembers; if (!recordsByTier.TryGetValue(byTierKey, out groupMembers)) { groupMembers = new List <ModRecord>(); recordsByTier[byTierKey] = groupMembers; } groupMembers.Add(r); } foreach (var list in recordsByTier.Values) { list.Sort(ModRecord.ByLevelComparer); } }
// more fields can be added (see in visualGGPK) public ModRecord(Memory m, StatsDat sDat, TagsDat tagsDat, long addr) { Address = addr; Key = m.ReadStringU(m.ReadLong(addr + 0)); Unknown8 = m.ReadLong(addr + 0x8); MinLevel = m.ReadInt(addr + 0x1C); StatNames = new[] { m.ReadLong(addr + 0x28) == 0 ? null : sDat.records[m.ReadStringU(m.ReadLong(m.ReadLong(addr + 0x28)))], m.ReadLong(addr + 0x38) == 0 ? null : sDat.records[m.ReadStringU(m.ReadLong(m.ReadLong(addr + 0x38)))], m.ReadLong(addr + 0x48) == 0 ? null : sDat.records[m.ReadStringU(m.ReadLong(m.ReadLong(addr + 0x48)))], m.ReadLong(addr + 0x58) == 0 ? null : sDat.records[m.ReadStringU(m.ReadLong(m.ReadLong(addr + 0x58)))] }; Domain = (ModDomain)m.ReadInt(addr + 0x60); UserFriendlyName = m.ReadStringU(m.ReadLong(addr + 0x64)); AffixType = (ModType)m.ReadInt(addr + 0x6C); Group = m.ReadStringU(m.ReadLong(addr + 0x70)); StatRange = new[] { new IntRange(m.ReadInt(addr + 0x78), m.ReadInt(addr + 0x7C)), new IntRange(m.ReadInt(addr + 0x80), m.ReadInt(addr + 0x84)), new IntRange(m.ReadInt(addr + 0x88), m.ReadInt(addr + 0x8C)), new IntRange(m.ReadInt(addr + 0x90), m.ReadInt(addr + 0x94)) }; Tags = new TagsDat.TagRecord[m.ReadLong(addr + 0x98)]; long ta = m.ReadLong(addr + 0xA0); for (int i = 0; i < Tags.Length; i++) { long ii = ta + 0x8 + 0x10 * i; Tags[i] = tagsDat.records[m.ReadStringU(m.ReadLong(ii, 0), 255)]; } TagChances = new Dictionary <string, int>(m.ReadInt(addr + 0xA8)); long tc = m.ReadLong(addr + 0xB0); for (int i = 0; i < Tags.Length; i++) { TagChances[Tags[i].Key] = m.ReadInt(tc + 4 * i); } IsEssence = m.ReadByte(addr + 0x1AC) == 0x01; Tier = m.ReadStringU(m.ReadLong(addr + 0x1C5)); }
public FsController(Memory mem) { files = new Dictionary<string, int>(); this.mem = mem; BaseItemTypes = new BaseItemTypes(mem, FindFile("Data/BaseItemTypes.dat")); Tags = new TagsDat(mem, FindFile("Data/Tags.dat")); Stats = new StatsDat(mem, FindFile("Data/Stats.dat")); Mods = new ModsDat(mem, FindFile("Data/Mods.dat"), Stats, Tags); }
// more fields can be added (see in visualGGPK) public ModRecord(Memory m, StatsDat sDat, TagsDat tagsDat, int addr) { Key = m.ReadStringU(m.ReadInt(addr + 0)); Unknown4 = m.ReadInt(addr + 4); MinLevel = m.ReadInt(addr + 0x10); StatNames = new[] { m.ReadInt(addr + 0x18) == 0 ? null : sDat.records[m.ReadStringU(m.ReadInt(m.ReadInt(addr + 0x18)))], m.ReadInt(addr + 0x20) == 0 ? null : sDat.records[m.ReadStringU(m.ReadInt(m.ReadInt(addr + 0x20)))], m.ReadInt(addr + 0x28) == 0 ? null : sDat.records[m.ReadStringU(m.ReadInt(m.ReadInt(addr + 0x28)))], m.ReadInt(addr + 0x30) == 0 ? null : sDat.records[m.ReadStringU(m.ReadInt(m.ReadInt(addr + 0x30)))] }; Domain = m.ReadInt(addr + 0x34); UserFriendlyName = m.ReadStringU(m.ReadInt(addr + 0x38)); AffixType = (ModType)m.ReadInt(addr + 0x3C); Group = m.ReadStringU(m.ReadInt(addr + 0x40)); StatRange = new[] { new IntRange(m.ReadInt(addr + 0x44), m.ReadInt(addr + 0x48)), new IntRange(m.ReadInt(addr + 0x4C), m.ReadInt(addr + 0x50)), new IntRange(m.ReadInt(addr + 0x54), m.ReadInt(addr + 0x58)), new IntRange(m.ReadInt(addr + 0x5C), m.ReadInt(addr + 0x60)) }; Tags = new TagsDat.TagRecord[m.ReadInt(addr + 0x64)]; int ta = m.ReadInt(addr + 0x68); for (int i = 0; i < Tags.Length; i++) { int ii = ta + 4 + 8 * i; Tags[i] = tagsDat.records[m.ReadStringU(m.ReadInt(ii, 0), 255)]; } TagChances = new int[m.ReadInt(addr + 0x6C)]; int tc = m.ReadInt(addr + 0x70); for (int i = 0; i < Tags.Length; i++) { TagChances[i] = m.ReadInt(tc + 4 * i); } }
public ModsDat(Memory m, int address, StatsDat sDat, TagsDat tagsDat) : base(m, address) { loadItems(sDat, tagsDat); }