static void Postfix(CharBSelectorLayer __instance, BlueprintCharacterClass charClass, BlueprintArchetype[] archetypesList)
        {
            try
            {
                var self  = __instance;
                var items = self.SelectorItems;
                if (items == null || archetypesList == null || items.Count == 0 || Main.settings?.RelaxAncientLorekeeper == true)
                {
                    return;
                }

                // Note: conceptually this is the same as `CharBSelectorLayer.FillDataLightClass()`,
                // but for archetypes.

                // TODO: changing race won't refresh the prereq, although it does update if you change class.
                var state = Game.Instance.UI.CharacterBuildController.LevelUpController.State;
                foreach (var item in items)
                {
                    var archetype = item?.Archetype;
                    if (archetype == null || !archetypesList.Contains(archetype))
                    {
                        continue;
                    }

                    item.Show(state: true);
                    item.Toggle.interactable = item.enabled = OracleArchetypes.MeetsPrerequisites(archetype, state.Unit, state);
                    var classData = state.Unit.Progression.GetClassData(state.SelectedClass);
                    self.SilentSwitch(classData.Archetypes.Contains(archetype), item);
                }
            }
            catch (Exception e)
            {
                Log.Error(e);
            }
        }
Esempio n. 2
0
            public static bool Prefix(CharBFeatureSelector __instance, SpellSelectionData spellSelectionData, int spellLevel)
            {
                if (!settings.toggleMulticlass)
                {
                    return(false);
                }
                __instance.Init();
                CharBSelectorLayer selectorLayerBody = __instance.SelectorLayerBody;

                if (selectorLayerBody.CurrentSpellSelectionData != null &&
                    spellSelectionData.SpellList == selectorLayerBody.CurrentSpellSelectionData.SpellList &&
                    spellSelectionData.Spellbook == selectorLayerBody.CurrentSpellSelectionData.Spellbook && // Mod Line
                    spellLevel == selectorLayerBody.CurrentLevel)
                {
                    selectorLayerBody.FillSpellLightUpdate();
                }
                else
                {
                    __instance.SetFilter();
                    __instance.FilterState.ShowAll = false;
                    __instance.Filter.SetupButtonStates();
                    __instance.FilterState.ShowAllAvailible = false;
                    __instance.SetLabel((string)__instance.t.CharGen.Spells);
                    if (spellLevel < 0)
                    {
                        selectorLayerBody.SwitchOffElementsFromIndex(0);
                    }
                    else
                    {
                        selectorLayerBody.FillSpellLevel(spellSelectionData, spellLevel, true, __instance);
                    }
                    __instance.SwitchToMultiSelector(false);
                }
                return(true);
            }