Exemplo n.º 1
0
 public void Revoke()
 {
     if (base.userProfile.HasAchievement(this.AchievementIdentifier))
     {
         base.userProfile.RevokeAchievement(this.AchievementIdentifier);
     }
     base.userProfile.RevokeUnlockable(UnlockableCatalog.GetUnlockableDef(this.UnlockableDef.nameToken));
 }
Exemplo n.º 2
0
        public void Revoke()
        {
            if (userProfile.HasAchievement(AchievementIdentifier))
            {
                userProfile.RevokeAchievement(AchievementIdentifier);
            }

            userProfile.RevokeUnlockable(UnlockableCatalog.GetUnlockableDef(UnlockableIdentifier));
        }
Exemplo n.º 3
0
 public static void CCunlockPrismAchievements(ConCommandArgs _)
 {
     if (LocalUserManager.isAnyUserSignedIn)
     {
         var scythe = UnlockableCatalog.GetUnlockableDef("Items.HealOnCrit");
         var merc   = UnlockableCatalog.GetUnlockableDef("Skills.Merc.EvisProjectile");
         LocalUserManager.GetFirstLocalUser().currentNetworkUser.CallCmdReportUnlock(scythe.index);
         LocalUserManager.GetFirstLocalUser().currentNetworkUser.CallCmdReportUnlock(merc.index);
     }
 }
Exemplo n.º 4
0
 // Token: 0x060025CC RID: 9676 RVA: 0x000B17C0 File Offset: 0x000AF9C0
 public virtual void OnGranted()
 {
     if (!string.IsNullOrEmpty(this.achievementDef.unlockableRewardIdentifier))
     {
         if (this.localUser.currentNetworkUser)
         {
             UnlockableDef unlockableDef = UnlockableCatalog.GetUnlockableDef(this.achievementDef.unlockableRewardIdentifier);
             this.localUser.currentNetworkUser.CallCmdReportUnlock(unlockableDef.index);
         }
         this.userProfile.AddUnlockToken(this.achievementDef.unlockableRewardIdentifier);
     }
 }
        public static void Init()
        {
            LocalUserManager.onUserSignIn += (user) =>
            {
                var prefix            = "MysticsItems_LastModVersion_";
                var lastModVersion    = "0.0.0";
                var storedAchievement = user.userProfile.achievementsList.FirstOrDefault(x => x.StartsWith(prefix, false, System.Globalization.CultureInfo.InvariantCulture));
                if (!string.IsNullOrEmpty(storedAchievement))
                {
                    lastModVersion = storedAchievement.Remove(0, prefix.Length);
                }
                var lastModVersionNum = ConvertVersionStringToInt(lastModVersion);
                if (lastModVersionNum != currentVersionNum)
                {
                    void ResetAchievements(params string[] achievementsToReset)
                    {
                        AchievementManager.availability.CallWhenAvailable(() =>
                        {
                            foreach (var achievementToReset in achievementsToReset)
                            {
                                if (AchievementManager.achievementNamesToDefs.TryGetValue(achievementToReset, out var achievementDef))
                                {
                                    if (achievementDef != null)
                                    {
                                        if (user.userProfile.HasAchievement(achievementDef.identifier))
                                        {
                                            user.userProfile.RevokeAchievement(achievementDef.identifier);
                                        }
                                        var unlockable = UnlockableCatalog.GetUnlockableDef(achievementDef.unlockableRewardIdentifier);
                                        if (unlockable && user.userProfile.HasUnlockable(unlockable))
                                        {
                                            user.userProfile.RevokeUnlockable(unlockable);
                                        }
                                    }
                                }
                            }
                        });
                    }

                    if (lastModVersionNum < 200)
                    {
                        ResetAchievements(
                            "MysticsItems_DiscDeath",
                            "MysticsItems_EscapeMoonAlone",
                            "MysticsItems_RepairBrokenSpotter"
                            );
                    }

                    user.userProfile.achievementsList.Remove(storedAchievement);
                    user.userProfile.achievementsList.Add(prefix + MysticsItemsPlugin.PluginVersion);
                }
            };
        }
Exemplo n.º 6
0
        // Token: 0x06002821 RID: 10273 RVA: 0x000ABB68 File Offset: 0x000A9D68
        private void OnUnlockCheck(UserProfile userProfile, string unlockableToken)
        {
            UnlockableDef unlockableDef = UnlockableCatalog.GetUnlockableDef(unlockableToken);

            if (unlockableDef == null)
            {
                return;
            }
            if (userProfile == base.userProfile && LogCollectorAchievement.IsUnlockableMonsterLog(unlockableDef))
            {
                this.Check();
            }
        }
        // Token: 0x06002644 RID: 9796 RVA: 0x000B1E04 File Offset: 0x000B0004
        private void OnUnlockCheck(UserProfile userProfile, string unlockableToken)
        {
            UnlockableDef unlockableDef = UnlockableCatalog.GetUnlockableDef(unlockableToken);

            if (unlockableDef == null)
            {
                return;
            }
            if (userProfile == this.userProfile && FindUniqueNewtStatues.IsUnlockableNewtStatue(unlockableDef))
            {
                this.Check();
            }
        }
Exemplo n.º 8
0
        private bool EveryoneCanPlay()
        {
            UnlockableDef def = UnlockableCatalog.GetUnlockableDef("COMPLETE_MAINENDING_DILUVIAN_UNLOCKABLE");
            ReadOnlyCollection <NetworkUser> onlyInstancesList = NetworkUser.readOnlyInstancesList;

            for (int index = 0; index < onlyInstancesList.Count; ++index)
            {
                if (!onlyInstancesList[index].unlockables.Contains(def))
                {
                    return(false);
                }
            }
            return(true);
        }
Exemplo n.º 9
0
        public static void UnlockAll()
        {
            //Goes through resource file containing all unlockables... Easily updatable, just paste "RoR2.UnlockCatalog" and GetAllUnlockable does the rest.
            //This is needed to unlock logs
            foreach (var unlockableName in Main.unlockableNames)
            {
                var         unlockableDef = UnlockableCatalog.GetUnlockableDef(unlockableName);
                NetworkUser networkUser   = Util.LookUpBodyNetworkUser(Main.LocalPlayerBody);
                if (networkUser)
                {
                    networkUser.ServerHandleUnlock(unlockableDef);
                }
            }

            //Gives all achievements.
            var achievementManager = AchievementManager.GetUserAchievementManager(LocalUserManager.GetFirstLocalUser());

            foreach (var achievement in AchievementManager.allAchievementDefs)
            {
                achievementManager.GrantAchievement(achievement);
            }

            //Give all survivors
            var profile = LocalUserManager.GetFirstLocalUser().userProfile;

            foreach (var survivor in SurvivorCatalog.allSurvivorDefs)
            {
                if (profile.statSheet.GetStatValueDouble(RoR2.Stats.PerBodyStatDef.totalTimeAlive, survivor.bodyPrefab.name) == 0.0)
                {
                    profile.statSheet.SetStatValueFromString(RoR2.Stats.PerBodyStatDef.totalTimeAlive.FindStatDef(survivor.bodyPrefab.name), "0.1");
                }
            }

            //All items and equipments
            foreach (string itemName in Enum.GetNames(typeof(ItemIndex)))
            {
                ItemIndex itemIndex = (ItemIndex)Enum.Parse(typeof(ItemIndex), itemName);
                profile.DiscoverPickup(PickupCatalog.FindPickupIndex(itemIndex));
            }

            foreach (string equipmentName in Enum.GetNames(typeof(EquipmentIndex)))
            {
                EquipmentIndex equipmentIndex = (EquipmentIndex)Enum.Parse(typeof(EquipmentIndex), equipmentName);
                profile.DiscoverPickup(PickupCatalog.FindPickupIndex(equipmentIndex));
            }
        }
        // Token: 0x0600259A RID: 9626 RVA: 0x000A39F4 File Offset: 0x000A1BF4
        private void Rebuild()
        {
            SurvivorDef survivorDef = SurvivorCatalog.GetSurvivorDef(this.survivorIndex);

            if (survivorDef != null)
            {
                GameObject bodyPrefab = survivorDef.bodyPrefab;
                if (bodyPrefab)
                {
                    CharacterBody component = bodyPrefab.GetComponent <CharacterBody>();
                    if (component)
                    {
                        if (this.survivorIcon)
                        {
                            this.survivorIcon.texture = component.portraitIcon;
                        }
                        string viewableName = string.Format(CultureInfo.InvariantCulture, "/Survivors/{0}", this.survivorIndex.ToString());
                        if (this.viewableTag)
                        {
                            this.viewableTag.viewableName = viewableName;
                            this.viewableTag.Refresh();
                        }
                        if (this.loadoutViewableTag)
                        {
                            this.loadoutViewableTag.viewableName = string.Format(CultureInfo.InvariantCulture, "/Loadout/Bodies/{0}/", BodyCatalog.GetBodyName(SurvivorCatalog.GetBodyIndexFromSurvivorIndex(this.survivorIndex)));
                            this.loadoutViewableTag.Refresh();
                        }
                        if (this.viewableTrigger)
                        {
                            this.viewableTrigger.viewableName = viewableName;
                        }
                        if (this.tooltipProvider)
                        {
                            UnlockableDef unlockableDef = UnlockableCatalog.GetUnlockableDef(survivorDef.unlockableName);
                            if (unlockableDef != null)
                            {
                                this.tooltipProvider.titleToken       = "UNIDENTIFIED";
                                this.tooltipProvider.titleColor       = Color.gray;
                                this.tooltipProvider.overrideBodyText = unlockableDef.getHowToUnlockString();
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 11
0
 private static TooltipContent LogBookControllerOnGetPickupTooltipContent(On.RoR2.UI.LogBook.LogBookController.orig_GetPickupTooltipContent orig, UserProfile userProfile, Entry entry, EntryStatus status)
 {
     if (IsCustomItemOrEquipment((PickupIndex)entry.extraData))
     {
         UnlockableDef  unlockableDef = UnlockableCatalog.GetUnlockableDef(((PickupIndex)entry.extraData).GetUnlockableName());
         TooltipContent result        = default;
         result.titleToken = entry.nameToken;
         result.titleColor = entry.color;
         if (unlockableDef != null)
         {
             result.overrideBodyText = unlockableDef.getUnlockedString();
         }
         result.bodyToken = "LOGBOOK_CATEGORY_ITEM";
         result.bodyColor = ColorCatalog.GetColor(ColorCatalog.ColorIndex.Unlockable);
         return(result);
     }
     return(orig(userProfile, entry, status));
 }
Exemplo n.º 12
0
        public void Awake()
        {
            // lets not ruin peoples save files
            On.RoR2.UserProfile.Save += (orig, self, blocking) =>
            {
                return(true);
            };

            // just incase they do add the artifacts we dont want duplicates in the unlockableDefTable and
            // since they dont check for those we will do that for them
            On.RoR2.UnlockableCatalog.RegisterUnlockable += (orig, name, unlockableDef) =>
            {
                if (UnlockableCatalog.GetUnlockableDef(name) != null)
                {
                    return;
                }

                orig(name, unlockableDef);
            };

            // add artifacts to unlocks
            On.RoR2.UnlockableCatalog.Init += (orig) =>
            {
                for (var artifactIdx = ArtifactIndex.Command; artifactIdx < ArtifactIndex.Count; artifactIdx++)
                {
                    var artifactDef = ArtifactCatalog.GetArtifactDef(artifactIdx);
                    if (artifactDef?.unlockableName.Length < 0)
                    {
                        continue;
                    }

                    Reflection.InvokeMethod(typeof(UnlockableCatalog), "RegisterUnlockable",
                                            artifactDef.unlockableName, new UnlockableDef
                    {
                        hidden = true,
                    });
                }

                orig();
            };

            // set neat colors and tooltips for artifacts that have none
            On.RoR2.RuleDef.FromArtifact += (orig, artifactIdx) =>
            {
                var tooltipClr  = ColorCatalog.GetColor(ColorCatalog.ColorIndex.Tier3ItemDark);
                var artifactDef = ArtifactCatalog.GetArtifactDef(artifactIdx);

                var ruleDef = new RuleDef("Artifacts." + artifactIdx.ToString(), artifactDef.nameToken);
                {
                    var ruleChoiceDef1 = ruleDef.AddChoice("On", null, false);
                    ruleChoiceDef1.spritePath       = artifactDef.smallIconSelectedPath;
                    ruleChoiceDef1.tooltipNameColor = tooltipClr;
                    ruleChoiceDef1.unlockableName   = artifactDef.unlockableName;
                    ruleChoiceDef1.artifactIndex    = artifactIdx;

                    var ruleChoiceDef2 = ruleDef.AddChoice("Off", null, false);
                    ruleChoiceDef2.spritePath       = artifactDef.smallIconDeselectedPath;
                    ruleChoiceDef2.tooltipNameColor = tooltipClr;
                    ruleChoiceDef2.materialPath     = "Materials/UI/matRuleChoiceOff";
                    ruleChoiceDef2.tooltipBodyToken = null;

                    switch (artifactIdx)
                    {
                    case ArtifactIndex.Bomb:
                        ruleChoiceDef1.tooltipNameToken = "Spite";
                        ruleChoiceDef2.tooltipNameToken = ruleChoiceDef1.tooltipNameToken;
                        ruleChoiceDef1.tooltipBodyToken = "Makes monsters explode on death";
                        ruleChoiceDef2.tooltipBodyToken = ruleChoiceDef1.tooltipBodyToken;
                        break;

                    case ArtifactIndex.Spirit:
                        ruleChoiceDef1.tooltipNameToken = "Spirit";
                        ruleChoiceDef2.tooltipNameToken = ruleChoiceDef1.tooltipNameToken;
                        ruleChoiceDef1.tooltipBodyToken = "Makes you and monsters move faster at low health";
                        ruleChoiceDef2.tooltipBodyToken = ruleChoiceDef1.tooltipBodyToken;
                        break;

                    case ArtifactIndex.Enigma:
                        ruleChoiceDef1.tooltipNameToken = "Enigma";
                        ruleChoiceDef2.tooltipNameToken = ruleChoiceDef1.tooltipNameToken;
                        ruleChoiceDef1.tooltipBodyToken = "Give you a special use item that triggers a random effect on use";
                        ruleChoiceDef2.tooltipBodyToken = ruleChoiceDef1.tooltipBodyToken;
                        break;

                    default:
                        ruleChoiceDef1.tooltipNameToken = "Work in Progress";
                        ruleChoiceDef2.tooltipNameToken = ruleChoiceDef1.tooltipNameToken;
                        ruleChoiceDef1.tooltipBodyToken = "This artifact does not do anything yet";
                        ruleChoiceDef2.tooltipBodyToken = ruleChoiceDef1.tooltipBodyToken;
                        break;
                    }
                }

                ruleDef.MakeNewestChoiceDefault();

                return(ruleDef);
            };

            // unlock artifacts for the current user
            LocalUserManager.onUserSignIn += (user) =>
            {
                for (var artifactIdx = ArtifactIndex.Command; artifactIdx < ArtifactIndex.Count; artifactIdx++)
                {
                    var artifactDef = ArtifactCatalog.GetArtifactDef(artifactIdx);
                    if (artifactDef?.unlockableName.Length < 0)
                    {
                        continue;
                    }

                    var unlockableDef = UnlockableCatalog.GetUnlockableDef(artifactDef.unlockableName);
                    if (unlockableDef is null)
                    {
                        Logger.LogError($"Could not unlock artifact {artifactDef.nameToken}, " +
                                        "UnlockableDef does not exist");
                        continue;
                    }

                    user.userProfile.GrantUnlockable(unlockableDef);
                }
            };
        }
        // Token: 0x0600207D RID: 8317 RVA: 0x00099094 File Offset: 0x00097294
        public void SetAchievement(string achievementIdentifier, UserProfile userProfile)
        {
            AchievementDef achievementDef = AchievementManager.GetAchievementDef(achievementIdentifier);

            if (achievementDef != null)
            {
                bool flag  = userProfile.HasAchievement(achievementIdentifier);
                bool flag2 = userProfile.CanSeeAchievement(achievementIdentifier);
                if (this.iconImage)
                {
                    this.iconImage.sprite = (flag ? achievementDef.GetAchievedIcon() : achievementDef.GetUnachievedIcon());
                }
                if (this.nameLabel)
                {
                    this.nameLabel.token = (userProfile.CanSeeAchievement(achievementIdentifier) ? achievementDef.nameToken : "???");
                }
                if (this.descriptionLabel)
                {
                    this.descriptionLabel.token = (userProfile.CanSeeAchievement(achievementIdentifier) ? achievementDef.descriptionToken : "???");
                }
                if (this.unlockedImage)
                {
                    this.unlockedImage.gameObject.SetActive(flag);
                }
                if (this.cantBeAchievedImage)
                {
                    this.cantBeAchievedImage.gameObject.SetActive(!flag2);
                }
                if (this.tooltipProvider)
                {
                    string overrideBodyText = "???";
                    if (flag2)
                    {
                        if (flag)
                        {
                            UnlockableDef unlockableDef = UnlockableCatalog.GetUnlockableDef(achievementDef.unlockableRewardIdentifier);
                            if (unlockableDef != null)
                            {
                                string @string = Language.GetString("ACHIEVEMENT_CARD_REWARD_FORMAT");
                                string string2 = Language.GetString(unlockableDef.nameToken);
                                overrideBodyText = string.Format(@string, string2);
                            }
                        }
                        else
                        {
                            string string3 = Language.GetString("ACHIEVEMENT_CARD_REWARD_FORMAT");
                            string arg     = "???";
                            overrideBodyText = string.Format(string3, arg);
                        }
                    }
                    else
                    {
                        AchievementDef achievementDef2 = AchievementManager.GetAchievementDef(achievementDef.prerequisiteAchievementIdentifier);
                        if (achievementDef2 != null)
                        {
                            string string4 = Language.GetString("ACHIEVEMENT_CARD_PREREQ_FORMAT");
                            string string5 = Language.GetString(achievementDef2.nameToken);
                            overrideBodyText = string.Format(string4, string5);
                        }
                    }
                    this.tooltipProvider.titleToken       = (flag2 ? achievementDef.nameToken : "???");
                    this.tooltipProvider.overrideBodyText = overrideBodyText;
                }
                if (this.tabLayoutElement)
                {
                    this.tabLayoutElement.preferredWidth = (float)AchievementCardController.CalcAchievementTabCount(achievementIdentifier) * this.tabWidth;
                }
            }
        }
        private void RebuildPage()
        {
            var survivorIndicies = survivorIndexList.Skip(currentPageIndex * survivorsPerPage).Take(survivorsPerPage).ToArray();

            var elements = survivorIconControllers.elements;

            for (var index = 0; index < elements.Count; ++index)
            {
                var element = elements[index];
                if (index >= survivorIndicies.Length)
                {
                    element.gameObject.SetActive(false);
                    continue;
                }
                element.gameObject.SetActive(true);

                var survivorIndex = survivorIndicies[index];
                var survivorDef   = SurvivorCatalog.GetSurvivorDef(survivorIndex);
                element.survivorIndex = survivorIndex;
                var buttonComponent = element.GetComponent <HGButton>();

                var survivorDescription = Language.GetString(survivorDef.descriptionToken);
                var length = survivorDescription.IndexOf(Environment.NewLine);
                if (length != -1)
                {
                    survivorDescription = survivorDescription.Substring(0, length);
                }

                var unlockableDef = UnlockableCatalog.GetUnlockableDef(survivorDef.unlockableName);
                if (unlockableDef != null)
                {
                    if (SurvivorCatalog.SurvivorIsUnlockedOnThisClient(survivorIndex))
                    {
                        buttonComponent.hoverToken = Language.GetStringFormatted("CHARACTER_DESCRIPTION_AND_UNLOCK_FORMAT", survivorDescription, unlockableDef.getUnlockedString());
                    }
                    else
                    {
                        buttonComponent.hoverToken = Language.GetStringFormatted("CHARACTER_DESCRIPTION_AND_UNLOCK_FORMAT", Language.GetString("UNIDENTIFIED"), unlockableDef.getHowToUnlockString());
                    }
                }
                else
                {
                    buttonComponent.hoverToken = survivorDescription;
                }
                element.shouldRebuild = true;
            }

            for (var index = 0; index < fillerCount; index++)
            {
                fillerIcons[index].gameObject.SetActive(IsOnLastPage);
            }

            if (buttonHistory && buttonHistory.lastRememberedGameObject)
            {
                if (eventSystemLocator && eventSystemLocator.eventSystem)
                {
                    if (eventSystemLocator.eventSystem.currentInputSource == MPEventSystem.InputSource.Gamepad)
                    {
                        if (buttonHistory.lastRememberedGameObject.activeInHierarchy)
                        {
                            buttonHistory.lastRememberedGameObject.GetComponent <HGButton>().OnSelect(new BaseEventData(EventSystem.current));
                        }
                        else
                        {
                            elements.LastOrDefault(el => el.gameObject.activeInHierarchy)?.GetComponent <HGButton>().Select();
                        }
                    }
                }
            }

            previousButtonComponent.interactable = !IsOnFirstPage;
            nextButtonComponent.interactable     = !IsOnLastPage;
        }
Exemplo n.º 15
0
        public static void UnlockAll()
        {
            //This is needed to unlock logs
            var unlockables = UmbraMenu.unlockables;

            foreach (var unlockable in unlockables)
            {
                NetworkUser networkUser = Util.LookUpBodyNetworkUser(UmbraMenu.LocalPlayerBody);
                if (networkUser)
                {
                    networkUser.ServerHandleUnlock(unlockable.Value);
                }
            }

            //Gives all achievements.
            var achievementManager = AchievementManager.GetUserAchievementManager(LocalUserManager.GetFirstLocalUser());

            foreach (var achievement in AchievementManager.allAchievementDefs)
            {
                achievementManager.GrantAchievement(achievement);
            }

            //Give all survivors
            var profile = LocalUserManager.GetFirstLocalUser().userProfile;

            foreach (var survivor in SurvivorCatalog.allSurvivorDefs)
            {
                if (profile.statSheet.GetStatValueDouble(RoR2.Stats.PerBodyStatDef.totalTimeAlive, survivor.bodyPrefab.name) == 0.0)
                {
                    profile.statSheet.SetStatValueFromString(RoR2.Stats.PerBodyStatDef.totalTimeAlive.FindStatDef(survivor.bodyPrefab.name), "0.1");
                }
                if (profile.statSheet.GetStatValueULong(RoR2.Stats.PerBodyStatDef.totalWins, survivor.bodyPrefab.name) == 0L)
                {
                    profile.statSheet.SetStatValueFromString(RoR2.Stats.PerBodyStatDef.totalWins.FindStatDef(survivor.bodyPrefab.name), "1");
                }
                if (profile.statSheet.GetStatValueULong(RoR2.Stats.PerBodyStatDef.timesPicked, survivor.bodyPrefab.name) == 0L)
                {
                    profile.statSheet.SetStatValueFromString(RoR2.Stats.PerBodyStatDef.timesPicked.FindStatDef(survivor.bodyPrefab.name), "1");
                }
            }

            //All items and equipments
            foreach (ItemIndex itemIndex in ItemCatalog.allItems)
            {
                profile.DiscoverPickup(PickupCatalog.FindPickupIndex(itemIndex));
            }

            foreach (EquipmentIndex equipmentIndex in EquipmentCatalog.allEquipment)
            {
                profile.DiscoverPickup(PickupCatalog.FindPickupIndex(equipmentIndex));
            }

            //All Eclipse unlockables as well
            StringBuilder stringBuilder = HG.StringBuilderPool.RentStringBuilder();

            foreach (SurvivorDef survivorDef in SurvivorCatalog.allSurvivorDefs)
            {
                for (int i = 2; i < 9; i++)
                {
                    stringBuilder.Clear().Append("Eclipse.").Append(survivorDef.cachedName).Append(".").AppendInt(i, 0U, uint.MaxValue);
                    UnlockableDef unlockableDef = UnlockableCatalog.GetUnlockableDef(stringBuilder.ToString());
                    NetworkUser   networkUser   = Util.LookUpBodyNetworkUser(UmbraMenu.LocalPlayerBody);
                    if (networkUser)
                    {
                        networkUser.ServerHandleUnlock(unlockableDef);
                    }
                }
            }
        }
Exemplo n.º 16
0
        public static bool Prefix(ref Dictionary <string, AchievementDef> ___achievementNamesToDefs, ref List <string> ___achievementIdentifiers, ref AchievementDef[] ___achievementDefs, ref AchievementDef[] ___serverAchievementDefs, ref Action ___onAchievementsRegistered, Dictionary <string, AchievementDef> map)
        {
            //Setup logging
            var achievementLogger = new ManualLogSource("AchievementLoader.Achievement");

            BepInEx.Logging.Logger.Sources.Add(achievementLogger);

            achievementLogger.LogMessage("__== Achievement Loader ==__");
            achievementLogger.LogInfo("Searching for overrides");

            //Search and collect overrides
            IEnumerable <Type> achievementOverrides =
                from t in AppDomain.CurrentDomain.GetAssemblies().Where(a => a.GetName().Name != "ConfigurationManager").SelectMany(a => { achievementLogger.LogDebug(String.Format("Scanning assembly {0} for override defs", a.FullName)); try { return(a.GetTypes()); } catch { achievementLogger.LogError(String.Format("Unable to scan {0} for override defs", a.FullName)); return(new Type[0]); } })
                let attributes = t.GetCustomAttributes(typeof(OverrideAchievement), true)
                                 where attributes != null && attributes.Length > 0
                                 select attributes.Cast <OverrideAchievement>().ToArray()[0].achievementType;

            //Convert from IEnum to List since it's way faster to search a list lmao
            List <Type> achievementOverrideTypes = achievementOverrides.ToList();

            achievementLogger.LogInfo(string.Format("Found {0} overrides", achievementOverrides.Count()));

            //Used for building achievement unlock chains?
            List <AchievementDef> list = new List <AchievementDef>();

            //Used for building achievement unlock chains?
            map.Clear();

            //Get all classes that inherit from BaseAchievement

            foreach (Type achievementClass in from type in (AppDomain.CurrentDomain.GetAssemblies()
                                                            .Where(a => !a.IsDynamic)
                                                            .SelectMany(a => { try { return(a.GetTypes()); } catch { achievementLogger.LogError(String.Format("Unable to scan {0} for achievements", a.FullName)); return(new Type[0]); } }))
                     where type.IsSubclassOf(typeof(BaseAchievement))
                     orderby type.Name
                     select type)
            {
                //Check if the achievement has an override defined
                if (achievementOverrideTypes.Contains(achievementClass))
                {
                    //If it does, don't add it
                    continue;
                }

                //Get the achievement attribute
                RegisterAchievementAttribute registerAchievementAttribute = (RegisterAchievementAttribute)Attribute.GetCustomAttribute(achievementClass, typeof(RegisterAchievementAttribute));

                //Get the custom achievement attribute
                CustomAchievementAttribute customAchievementAttribute = (CustomAchievementAttribute)Attribute.GetCustomAttribute(achievementClass, typeof(CustomAchievementAttribute));

                //If it's found, set the vanilla attribute to have the same values so we don't have to change a bunch of stuff
                if (customAchievementAttribute != null)
                {
                    registerAchievementAttribute = customAchievementAttribute;
                }

                //Check if the achievement was registered
                if (registerAchievementAttribute != null)
                {
                    //Make sure each achievement is unique
                    if (map.ContainsKey(registerAchievementAttribute.identifier))
                    {
                        Debug.LogErrorFormat("Class {0} attempted to register as achievement {1}, but class {2} has already registered as that achievement.", new object[]
                        {
                            achievementClass.FullName,
                            registerAchievementAttribute.identifier,
                            ___achievementNamesToDefs[registerAchievementAttribute.identifier].type.FullName
                        });
                    }
                    else
                    {
                        //Create the vanilla resource path
                        string iconPath = "Textures/AchievementIcons/tex" + registerAchievementAttribute.identifier + "Icon";

                        //Create the icon name
                        string iconName = "tex" + registerAchievementAttribute.identifier + "Icon";

                        //If it's a custom achievement, get the path for it
                        if (customAchievementAttribute != null)
                        {
                            iconPath = customAchievementAttribute.GetPath(iconName);
                        }

                        //If  the achievement is unique, build the achievement
                        AchievementDef achievementDef2 = new AchievementDef
                        {
                            identifier = registerAchievementAttribute.identifier,
                            unlockableRewardIdentifier        = registerAchievementAttribute.unlockableRewardIdentifier,
                            prerequisiteAchievementIdentifier = registerAchievementAttribute.prerequisiteAchievementIdentifier,
                            nameToken         = "ACHIEVEMENT_" + registerAchievementAttribute.identifier.ToUpper(CultureInfo.InvariantCulture) + "_NAME",
                            descriptionToken  = "ACHIEVEMENT_" + registerAchievementAttribute.identifier.ToUpper(CultureInfo.InvariantCulture) + "_DESCRIPTION",
                            iconPath          = iconPath,
                            type              = achievementClass,
                            serverTrackerType = registerAchievementAttribute.serverTrackerType
                        };

                        //Add the achievement identifier to the achievement identifier list
                        ___achievementIdentifiers.Add(registerAchievementAttribute.identifier);

                        //Used for building achievement unlock chains?
                        map.Add(registerAchievementAttribute.identifier, achievementDef2);

                        //Used to build achievement defs array?
                        list.Add(achievementDef2);

                        //Get the related unlockable def
                        UnlockableDef unlockableDef = UnlockableCatalog.GetUnlockableDef(achievementDef2.unlockableRewardIdentifier);

                        //If there is an unlockable def, set the how to unlock and unlocked text
                        if (unlockableDef != null)
                        {
                            string achievementName        = Language.GetString(achievementDef2.nameToken);
                            string achievementDescription = Language.GetString(achievementDef2.descriptionToken);
                            unlockableDef.getHowToUnlockString = (() => Language.GetStringFormatted("UNLOCK_VIA_ACHIEVEMENT_FORMAT", new object[]
                            {
                                achievementName,
                                achievementDescription
                            }));

                            unlockableDef.getUnlockedString = (() => Language.GetStringFormatted("UNLOCKED_FORMAT", new object[]
                            {
                                achievementName,
                                achievementDescription
                            }));
                        }
                    }
                }
                else
                {
                    //Warn that a class inheriting from BaseAchievement doesn't have a AchievementAttribute
                    string msg = string.Format("Class {0} in {1} inherits from BaseAchievement but doesn't have a RegisterAchievement attribute.", new object[] { achievementClass.FullName, achievementClass.Assembly.GetName().Name });
                    achievementLogger.LogWarning(msg);
                }
            }

            ___achievementDefs = list.ToArray();

            //Order achievements
            ___achievementDefs = ___achievementDefs.OrderBy(def => UnlockableCatalog.GetUnlockableSortScore(def.unlockableRewardIdentifier)).ToArray();

            //Get achievements that need to be server tracked
            ___serverAchievementDefs = (from achievementDef in ___achievementDefs
                                        where achievementDef.serverTrackerType != null
                                        select achievementDef).ToArray <AchievementDef>();

            //Build achievements to be tracked by client?
            for (int i = 0; i < ___achievementDefs.Length; i++)
            {
                ___achievementDefs[i].index = new AchievementIndex
                {
                    intValue = i
                };
            }

            //Build achievements to be tracked by server?
            for (int j = 0; j < ___serverAchievementDefs.Length; j++)
            {
                ___serverAchievementDefs[j].serverIndex = new ServerAchievementIndex
                {
                    intValue = j
                };
            }

            //Build achievement requirement chains?
            for (int k = 0; k < ___achievementIdentifiers.Count; k++)
            {
                string currentAchievementIdentifier = ___achievementIdentifiers[k];
                map[currentAchievementIdentifier].childAchievementIdentifiers = (from v in ___achievementIdentifiers
                                                                                 where map[v].prerequisiteAchievementIdentifier == currentAchievementIdentifier
                                                                                 select v).ToArray <string>();
            }

            //Let the system know all achievements have been created
            Action action = ___onAchievementsRegistered;

            if (action == null)
            {
                return(false);
            }
            action();

            //Skip the original code
            return(false);
        }