static bool Prefix(DescriptionTemplatesAbility __instance, bool isTooltip, DescriptionBricksBox box, AbilityData abilityData)
            {
                if (abilityData.ParamSpellSlot == null || abilityData.Blueprint.GetComponent <AbilityStoreSpellInFact>() == null)
                {
                    return(true);
                }

                string name = abilityData.Blueprint.Name;
                var    c    = abilityData.Blueprint.GetComponent <AbilityConvertSpell>().getSpellOrVariantBlueprint(abilityData.ParamSpellSlot.Spell.Blueprint);

                if (c != null)
                {
                    name += $" ({c.Name})";
                }

                DescriptionBrick descriptionBrick = DescriptionBuilder.Templates.IconNameHeader(box, name, abilityData.Blueprint.Icon, isTooltip);
                string           text1            = LocalizedTexts.Instance.AbilityTypes.GetText(abilityData.Blueprint.Type);
                string           text2            = abilityData.Blueprint.School == SpellSchool.None ? string.Empty : LocalizedTexts.Instance.SpellSchoolNames.GetText(abilityData.Blueprint.School);
                string           text3            = abilityData.Blueprint.School == SpellSchool.None ? string.Empty : (string)UIStrings.Instance.SpellBookTexts.Level + ": " + (object)abilityData.SpellLevel;

                descriptionBrick.SetText(text1, 1);
                descriptionBrick.SetText(text2, 2);
                if (abilityData.Blueprint.Type != AbilityType.Spell)
                {
                    return(false);
                }
                descriptionBrick.SetText(text3, 3);

                return(false);
            }
예제 #2
0
        public void mod_CopyButton(DescriptionBricksBox box, TooltipData data, bool isTooltip)
        {
            if (!KingmakerPatchSettings.UI.AddSpellbookNameToCopyScrollAction)
            {
                this.source_CopyButton(box, data, isTooltip);
                return;
            }

            if (data.Item == null || data.Item.Blueprint.GetComponent <CopyItem>() == null)
            {
                return;
            }

            UnitEntityData unit = UIUtility.GetCurrentCharacter();

            var component = data.Item.Blueprint.GetComponent <CopyItem>();

            if (component == null || !component.CanCopy(data.Item, unit) || !Kingmaker.Game.Instance.Player.Inventory.Contains(data.Item.Blueprint) || isTooltip)
            {
                return;
            }

            DescriptionBrick descriptionBrick = box.Add(DescriptionTemplatesBase.Bricks.GreenButton);

            string actionName = component.GetActionName(unit);

            actionName = CopyScrollNew.mod_GetSpellbookActionName(actionName, data.Item, unit);

            descriptionBrick.SetText(actionName);
            descriptionBrick.SetButtonAction(() => Kingmaker.Game.Instance.UI.DescriptionController.CopyItem(data.Item, unit));
        }