コード例 #1
0
    private InlineElement?GetWorshipDisplayText()
    {
        if (CurrentCritter == null)
        {
            return(null);
        }

        var result = new ComplexInlineElement();

        // "Worships: "
        result.AppendContent(_translations[1500] + "  ", "char-ui-worship-label");
        if (CurrentCritter.IsPC())
        {
            var deity = (DeityId)GameSystems.Stat.StatLevelGet(CurrentCritter, Stat.deity);
            result.AppendContent(GameSystems.Deity.GetName(deity));
        }
        else
        {
            result.AppendContent("--");
        }
        return(result);
    }
コード例 #2
0
    public InlineElement GetCritterDescriptionContent(GameObject critter, GameObject observer)
    {
        var content = new ComplexInlineElement();

        // Start by appending the name
        content.AppendContent(GameSystems.MapObject.GetDisplayName(critter, observer));

        content.AppendContent("\n\n");
        AppendHitPointDescription(critter, content);

        if (GameSystems.Party.IsInParty(critter))
        {
            var level = critter.GetStat(Stat.level);
            if (level > 0)
            {
                content.AppendContent("\n");
                content.AppendContent(_translations[104]); // Level
                content.AppendContent(": ");
                content.AppendContent(level.ToString());
            }

            if (GameSystems.Combat.IsCombatActive())
            {
                content.AppendContent("\n");
                content.AppendContent(_translations[111]); // Initiative
                content.AppendContent(": ");
                var initiative = GameSystems.D20.Initiative.GetInitiative(critter);
                content.AppendContent(initiative.ToString());
            }
        }

        var dispIo = DispIoTooltip.Default;

        critter.GetDispatcher()?.Process(DispatcherType.Tooltip, D20DispatcherKey.NONE, dispIo);

        foreach (var line in dispIo.Lines)
        {
            content.AppendContent("\n");
            content.AppendContent(line);
        }

        return(content);
    }
コード例 #3
0
    public override void Render()
    {
        UpdatePortrait();

        var         hpMax     = GameSystems.Stat.StatLevelGet(_obj, Stat.hp_max);
        var         hpCurrent = GameSystems.Stat.StatLevelGet(_obj, Stat.hp_current);
        WidgetImage imageToUse;

        if (hpCurrent < 1)
        {
            // TODO: This should probably use a D20 dispatch to see if
            // TODO: the character has the disabled or dying status
            imageToUse = _greyPortrait;
        }
        else
        {
            if (ButtonState == LgcyButtonState.Disabled)
            {
                imageToUse = _greyPortrait;
            }
            else
            {
                imageToUse = _normalPortrait;
            }
        }

        ClearContent();
        AddContent(imageToUse);

        if (Globals.Config.ShowPartyHitPoints)
        {
            _hpLabel ??= new WidgetText();

            var text = new ComplexInlineElement();
            text.AppendContent($"{hpCurrent}/{hpMax}");
            var subdualDamage = _obj.GetInt32(obj_f.critter_subdual_damage);
            if (subdualDamage > 0)
            {
                text.AppendContent($"({subdualDamage})", _hpTextSubdualStyle);
            }

            _hpLabel.Content = text;
            _hpLabel.Y       = Height - 12;
            AddContent(_hpLabel);
        }

        // TODO: Render flashing get-hit indicator

        if (GameSystems.Party.IsSelected(_obj))
        {
            AddContent(_highlight);
        }

        if (ButtonState == LgcyButtonState.Hovered || UiSystems.Party.ForceHovered == _obj)
        {
            AddContent(_highlightHover);

            if (!UiSystems.CharSheet.HasCurrentCritter && !UiSystems.Logbook.IsVisible)
            {
                UiSystems.InGameSelect.Focus = _obj;
            }
        }
        else if (ButtonState == LgcyButtonState.Down || UiSystems.Party.ForcePressed == _obj)
        {
            AddContent(_highlightPressed);

            if (!UiSystems.CharSheet.HasCurrentCritter)
            {
                UiSystems.InGameSelect.AddToFocusGroup(_obj);
            }
        }

        base.Render();
    }