private static unsafe List <Perk> GetFullPerkMap() { List <Perk> perks = new List <Perk>(); IntPtr pEngine = N3Engine_t.GetInstance(); if (pEngine == IntPtr.Zero) { return(perks); } foreach (PerkMemStruct perkMemStruct in N3EngineClientAnarchy_t.GetFullPerkMap(pEngine)->ToList <PerkMemStruct>()) { Perk perk = new Perk(perkMemStruct.Instance, perkMemStruct.TemplateInstance, perkMemStruct.PrerequisitePerkInstance, perkMemStruct.PerkType, perkMemStruct.AllowedProfessions, perkMemStruct.ActionInstance, perkMemStruct.RequiredExperience); perks.Add(perk); } // I'm not doing the following in the Perk constructor because we need the full perk // map to do it and querying the entire perk map again in the constructor is too expensive string currentName = "NoName"; int currentLevel = 1; foreach (Perk perk in perks.OrderBy(perk => perk.Instance)) { if (perk.Name != currentName) { currentName = perk.Name; currentLevel = 1; } perk.Level = currentLevel; currentLevel++; } return(perks); }