Пример #1
0
        private void PlayerCustomize()
        {
            if (this.SelectedPlayer == null)
            {
                return;
            }
            const float sameLineOffset = 70f;

            if (this.SelectedPlayer.Customize != null)
            {
                ImGui.Text(Loc.Localize("Gender", "Gender"));
                ImGuiHelpers.ScaledRelativeSameLine(sameLineOffset);
                ImGui.Text(this.SelectedPlayer.CharaCustomizeData.Gender == 0
                               ? Loc.Localize("GenderMale", "Male")
                               : Loc.Localize("GenderFemale", "Female"));

                ImGui.Text(Loc.Localize("Race", "Race"));
                ImGuiHelpers.ScaledRelativeSameLine(sameLineOffset);
                ImGui.Text(PlayerTrackPlugin.DataManager.Race(this.SelectedPlayer.CharaCustomizeData.Race, this.SelectedPlayer.CharaCustomizeData.Gender));

                ImGui.Text(Loc.Localize("Tribe", "Tribe"));
                ImGuiHelpers.ScaledRelativeSameLine(sameLineOffset);
                ImGui.Text(PlayerTrackPlugin.DataManager.Tribe(this.SelectedPlayer.CharaCustomizeData.Tribe, this.SelectedPlayer.CharaCustomizeData.Gender));

                ImGui.Text(Loc.Localize("Height", "Height"));
                ImGuiHelpers.ScaledRelativeSameLine(sameLineOffset);
                ImGui.Text(string.Format(
                               Loc.Localize("PlayerHeightValue", "{0} in"),
                               CharHeightUtil.CalcInches(this.SelectedPlayer.CharaCustomizeData.Height, this.SelectedPlayer.CharaCustomizeData.Race, this.SelectedPlayer.CharaCustomizeData.Tribe, this.SelectedPlayer.CharaCustomizeData.Gender)));

                ImGuiHelpers.ScaledDummy(5f);
                if (this.SelectedPlayer.Customize is { Length : > 0 })
Пример #2
0
        private void Lodestone()
        {
            const float sameLineOffset       = 140f;
            var         isLodestoneAvailable = this.plugin.LodestoneService.IsLodestoneAvailable();
            var         requests             = this.plugin.LodestoneService.GetRequests();

            // heading
            WindowManager.SpacerNoTabs();
            ImGui.TextColored(ImGuiColors.DalamudViolet, Loc.Localize("Lodestone", "Lodestone"));

            // lodestone state
            ImGui.Text(Loc.Localize("LodestoneStatus", "Status"));
            ImGuiHelpers.ScaledRelativeSameLine(sameLineOffset);
            if (isLodestoneAvailable)
            {
                ImGui.TextColored(ImGuiColors.HealerGreen, Loc.Localize("LodestoneAvailable", "Available"));
            }
            else
            {
                ImGui.TextColored(ImGuiColors.DPSRed, Loc.Localize("LodestoneUnavailable", "Unavailable"));
            }

            // total requests
            ImGui.Text(Loc.Localize("LodestoneTotalRequests", "Request Count"));
            ImGuiHelpers.ScaledRelativeSameLine(sameLineOffset);
            ImGui.Text(requests.Length.ToString());

            // requests
            ImGuiHelpers.ScaledDummy(new Vector2(0, 5f));
            ImGui.TextColored(ImGuiColors.DalamudViolet, Loc.Localize("LodestoneRequestsInQueue", "Requests In Queue"));
            if (requests.Any())
            {
                foreach (var request in requests)
                {
                    ImGui.Text(request.PlayerName + " (" + request.WorldName + ")");
                }
            }
            else
            {
                ImGui.Text(Loc.Localize("LodestoneNoRequests", "There are no pending lodestone requests."));
            }
        }
        private void PlayerEncounters()
        {
            if (this.SelectedPlayer == null)
            {
                return;
            }
            const float sameLineOffset1 = 60f;
            const float sameLineOffset2 = 130f;
            const float sameLineOffset3 = 170f;
            const float sameLineOffset4 = 200f;

            if (this.SelectedEncounters != null && this.SelectedEncounters.Any())
            {
                ImGui.TextColored(ImGuiColors.DalamudViolet, Loc.Localize("Time", "Time"));
                ImGuiHelpers.ScaledRelativeSameLine(sameLineOffset1);
                ImGui.TextColored(ImGuiColors.DalamudViolet, Loc.Localize("Duration", "Duration"));
                ImGuiHelpers.ScaledRelativeSameLine(sameLineOffset2);
                ImGui.TextColored(ImGuiColors.DalamudViolet, Loc.Localize("Job", "Job"));
                ImGuiHelpers.ScaledRelativeSameLine(sameLineOffset3);
                ImGui.TextColored(ImGuiColors.DalamudViolet, Loc.Localize("Lvl", "Lvl"));
                ImGuiHelpers.ScaledRelativeSameLine(sameLineOffset4);
                ImGui.TextColored(ImGuiColors.DalamudViolet, Loc.Localize("Location", "Location"));

                foreach (var encounter in this.SelectedEncounters)
                {
                    ImGui.BeginGroup();
                    ImGui.Text(encounter.Created.ToTimeSpan());
                    ImGuiHelpers.ScaledRelativeSameLine(sameLineOffset1);
                    ImGui.Text((encounter.Updated - encounter.Created).ToDuration());
                    ImGuiHelpers.ScaledRelativeSameLine(sameLineOffset2);
                    ImGui.Text(encounter.JobCode);
                    ImGuiHelpers.ScaledRelativeSameLine(sameLineOffset3);
                    ImGui.Text(encounter.JobLvl.ToString());
                    ImGuiHelpers.ScaledRelativeSameLine(sameLineOffset4);
                    ImGui.Text(encounter.LocationName);
                    ImGui.EndGroup();
                    if (ImGui.IsItemClicked(ImGuiMouseButton.Right))
                    {
                        ImGui.OpenPopup("###PlayerTrack_Encounter_Popup_" + encounter.Id);
                    }

                    if (ImGui.BeginPopup("###PlayerTrack_Encounter_Popup_" + encounter.Id))
                    {
                        ImGui.Text(Loc.Localize("Delete", "Delete"));
                        if (ImGui.IsItemClicked(ImGuiMouseButton.Left))
                        {
                            this.plugin.EncounterService.DeleteEncounter(encounter);
                            this.SelectedEncounters = this.plugin.EncounterService.GetEncountersByPlayer(this.SelectedPlayer.Key).OrderByDescending(enc => enc.Created).ToList();
                        }

                        ImGui.EndPopup();
                    }
                }
            }
            else
            {
                ImGui.TextColored(ImGuiColors.DalamudYellow, Loc.Localize("NoEncounters", "No encounters found for this player."));
                ImGui.TextWrapped(Loc.Localize(
                                      "NoEncountersExplanation",
                                      "This can happen for characters manually added or if all the encounters have been deleted."));
            }
        }
Пример #4
0
        private void PlayerDisplay()
        {
            if (this.SelectedPlayer == null)
            {
                return;
            }
            const float sameLineOffset = 150f;

            // category
            ImGui.Text(Loc.Localize("PlayerCategory", "Category"));
            ImGuiHelpers.ScaledRelativeSameLine(sameLineOffset);
            var categoryNames   = this.plugin.CategoryService.GetCategoryNames().ToArray();
            var categoryIds     = this.plugin.CategoryService.GetCategoryIds().ToArray();
            var currentCategory = this.plugin.CategoryService.GetCategory(this.SelectedPlayer.CategoryId);
            var categoryIndex   = Array.IndexOf(categoryNames, currentCategory.Name);

            ImGui.SetNextItemWidth(150f * ImGuiHelpers.GlobalScale);
            if (ImGui.Combo(
                    "###PlayerTrack_PlayerCategory_Combo",
                    ref categoryIndex,
                    categoryNames,
                    categoryNames.Length))
            {
                this.SelectedPlayer.CategoryId = categoryIds[categoryIndex];
                this.plugin.PlayerService.UpdatePlayerCategory(this.SelectedPlayer);
                this.plugin.NamePlateManager.ForceRedraw();
            }

            ImGuiHelpers.ScaledDummy(0.5f);
            ImGui.Separator();

            // override warning
            ImGui.TextColored(ImGuiColors.DalamudYellow, Loc.Localize(
                                  "OverrideNote",
                                  "These config will override category config."));
            ImGuiHelpers.ScaledDummy(1f);

            // title
            ImGui.Text(Loc.Localize("Title", "Title"));
            ImGuiHelpers.ScaledRelativeSameLine(sameLineOffset);

            var title = this.SelectedPlayer.Title;

            ImGui.SetNextItemWidth(150f * ImGuiHelpers.GlobalScale);
            if (ImGui.InputText("###PlayerTrack_PlayerTitle_Input", ref title, 30))
            {
                this.SelectedPlayer.Title = title;
                this.plugin.PlayerService.UpdatePlayerTitle(this.SelectedPlayer);
            }

            ImGui.Spacing();

            // icon
            ImGui.Text(Loc.Localize("Icon", "Icon"));
            ImGuiHelpers.ScaledRelativeSameLine(sameLineOffset);

            ImGui.SetNextItemWidth(150f * ImGuiHelpers.GlobalScale);
            var iconIndex = this.plugin.IconListIndex(this.SelectedPlayer !.Icon);

            if (ImGui.Combo(
                    "###PlayerTrack_PlayerIcon_Combo",
                    ref iconIndex,
                    this.plugin.IconListNames(),
                    this.plugin.IconListNames().Length))
            {
                this.SelectedPlayer.Icon = this.plugin.IconListCodes()[iconIndex];
                this.plugin.PlayerService.UpdatePlayerIcon(this.SelectedPlayer);
            }

            ImGui.SameLine();
            ImGui.PushFont(UiBuilder.IconFont);
            ImGui.TextColored(
                ImGuiColors.DalamudWhite,
                ((FontAwesomeIcon)this.SelectedPlayer.Icon).ToIconString());
            ImGui.PopFont();
            ImGui.Spacing();

            // visibility
            ImGui.Text(Loc.Localize("VisibilityType", "Visibility"));
            ImGuiHelpers.ScaledRelativeSameLine(sameLineOffset);

            ImGui.SetNextItemWidth(150f * ImGuiHelpers.GlobalScale);
            var visibilityType = (int)this.SelectedPlayer.VisibilityType;

            if (ImGui.Combo(
                    "###PlayerTrack_VisibilityType_Combo",
                    ref visibilityType,
                    Enum.GetNames(typeof(VisibilityType)),
                    Enum.GetNames(typeof(VisibilityType)).Length))
            {
                this.SelectedPlayer.VisibilityType = (VisibilityType)visibilityType;
                this.plugin.PlayerService.UpdatePlayerVisibilityType(this.SelectedPlayer);
            }

            ImGui.Spacing();

            // list color
            ImGui.Text(Loc.Localize("List", "List"));
            ImGuiHelpers.ScaledRelativeSameLine(sameLineOffset);
            var listColor = this.SelectedPlayer.EffectiveListColor();

            if (ImGui.ColorButton("List Color###PlayerTrack_PlayerListColor_Button", listColor))
            {
                ImGui.OpenPopup("###PlayerTrack_PlayerListColor_Popup");
            }

            if (ImGui.BeginPopup("###PlayerTrack_PlayerListColor_Popup"))
            {
                if (ImGui.ColorPicker4("List Color###PlayerTrack_PlayerListColor_ColorPicker", ref listColor))
                {
                    this.SelectedPlayer.ListColor = listColor;
                    if (this.plugin.Configuration.DefaultNamePlateColorToListColor)
                    {
                        this.SelectedPlayer.NamePlateColor = listColor;
                    }

                    this.plugin.PlayerService.UpdatePlayerListColor(this.SelectedPlayer);
                }

                this.PlayerOverride_ListColorSwatchRow(0, 8);
                this.PlayerOverride_ListColorSwatchRow(8, 16);
                this.PlayerOverride_ListColorSwatchRow(16, 24);
                this.PlayerOverride_ListColorSwatchRow(24, 32);
                ImGui.EndPopup();
            }

            // nameplate color
            ImGui.Spacing();
            ImGui.Text(Loc.Localize("Nameplate", "Nameplate"));
            ImGuiHelpers.ScaledRelativeSameLine(sameLineOffset);
            var namePlateColor = this.SelectedPlayer.EffectiveNamePlateColor();

            if (ImGui.ColorButton("NamePlate Color###PlayerTrack_PlayerNamePlateColor_Button", namePlateColor))
            {
                ImGui.OpenPopup("###PlayerTrack_PlayerNamePlateColor_Popup");
            }

            if (ImGui.BeginPopup("###PlayerTrack_PlayerNamePlateColor_Popup"))
            {
                if (ImGui.ColorPicker4("NamePlate Color###PlayerTrack_PlayerNamePlateColor_ColorPicker", ref namePlateColor))
                {
                    this.SelectedPlayer.NamePlateColor = namePlateColor;
                    this.plugin.PlayerService.UpdatePlayerNamePlateColor(this.SelectedPlayer);
                }

                this.PlayerOverride_NamePlateColorSwatchRow(0, 8);
                this.PlayerOverride_NamePlateColorSwatchRow(8, 16);
                this.PlayerOverride_NamePlateColorSwatchRow(16, 24);
                this.PlayerOverride_NamePlateColorSwatchRow(24, 32);
                ImGui.EndPopup();
            }

            // fc name color
            ImGui.Spacing();
            ImGui.Text(Loc.Localize("OverrideFCNameColor", "Override FCNameColor"));
            ImGuiHelpers.ScaledRelativeSameLine(sameLineOffset);
            var overrideFCNameColor = this.SelectedPlayer.OverrideFCNameColor;

            if (ImGui.Checkbox(
                    "###PlayerTrack_PlayerOverrideFCNameColor_Checkbox",
                    ref overrideFCNameColor))
            {
                this.SelectedPlayer.OverrideFCNameColor = overrideFCNameColor;
                this.plugin.PlayerService.UpdatePlayerOverrideFCNameColor(this.SelectedPlayer);
            }

            // alerts
            ImGui.Spacing();
            ImGui.Text(Loc.Localize("Alerts", "Alerts"));
            ImGuiHelpers.ScaledRelativeSameLine(sameLineOffset);
            var isAlertEnabled = this.SelectedPlayer.IsAlertEnabled;

            if (ImGui.Checkbox(
                    "###PlayerTrack_PlayerAlerts_Checkbox",
                    ref isAlertEnabled))
            {
                this.SelectedPlayer.IsAlertEnabled = isAlertEnabled;
                this.plugin.PlayerService.UpdatePlayerAlert(this.SelectedPlayer);
            }

            // reset
            ImGuiHelpers.ScaledDummy(5f);
            if (ImGui.Button(Loc.Localize("Reset", "Reset") + "###PlayerTrack_PlayerOverrideModalReset_Button"))
            {
                this.SelectedPlayer.Reset();
                this.plugin.PlayerService.ResetPlayerOverrides(this.SelectedPlayer);
            }
        }
Пример #5
0
        private void PlayerSummary()
        {
            if (this.SelectedPlayer == null)
            {
                return;
            }

            var sameLineOffset1 = 100f;
            var sameLineOffset2 = 260f;
            var sameLineOffset3 = 360f;

            // Override for more spacing
            string[] overrideLangCodes = { "fr", "it", "es" };
            if (overrideLangCodes.Contains(PlayerTrackPlugin.PluginInterface.UiLanguage))
            {
                sameLineOffset1 = 120f;
                sameLineOffset2 = 280f;
                sameLineOffset3 = 450f;
            }

            ImGui.TextColored(ImGuiColors.DalamudViolet, Loc.Localize("PlayerInfo", "Player Info"));
            ImGuiHelpers.ScaledRelativeSameLine(sameLineOffset2);
            ImGui.TextColored(ImGuiColors.DalamudViolet, Loc.Localize("PlayerStats", "Player Stats"));

            ImGui.Text(Loc.Localize("PlayerName", "Name"));
            ImGuiHelpers.ScaledRelativeSameLine(sameLineOffset1);
            if (this.SelectedPlayer.Names.Count > 1)
            {
                ImGui.BeginGroup();
                ImGui.Text(this.SelectedPlayer.Names.First());
                ImGui.SameLine();
                ImGui.PushFont(UiBuilder.IconFont);
                ImGui.TextColored(ImGuiColors.DalamudYellow, FontAwesomeIcon.InfoCircle.ToIconString());
                ImGui.PopFont();
                ImGui.EndGroup();
                if (ImGui.IsItemHovered())
                {
                    ImGui.SetTooltip(string.Format(
                                         Loc.Localize("PlayerPreviousNames", "Previously known as {0}"),
                                         string.Join(", ", this.SelectedPlayer.Names.Skip(1))));
                }
            }
            else
            {
                ImGui.Text(this.SelectedPlayer.Names !.First());
            }

            ImGuiHelpers.ScaledRelativeSameLine(sameLineOffset2);
            ImGui.Text(Loc.Localize("PlayerFirstSeen", "First Seen"));
            ImGuiHelpers.ScaledRelativeSameLine(sameLineOffset3);
            ImGui.Text(this.SelectedPlayer.SeenCount != 0 ? this.SelectedPlayer.Created.ToTimeSpan() : "N/A");

            ImGui.Text(Loc.Localize("PlayerHomeworld", "Homeworld"));
            ImGuiHelpers.ScaledRelativeSameLine(sameLineOffset1);
            if (this.SelectedPlayer.HomeWorlds.Count > 1)
            {
                ImGui.BeginGroup();
                ImGui.Text(this.SelectedPlayer.HomeWorlds !.First().Value);
                ImGui.SameLine();
                ImGui.PushFont(UiBuilder.IconFont);
                ImGui.TextColored(ImGuiColors.DalamudYellow, FontAwesomeIcon.InfoCircle.ToIconString());
                ImGui.PopFont();
                ImGui.EndGroup();
                if (ImGui.IsItemHovered())
                {
                    ImGui.SetTooltip(string.Format(
                                         Loc.Localize("PlayerPreviousWorlds", "Previously on {0}"),
                                         string.Join(", ", this.SelectedPlayer.HomeWorlds.Skip(1).Select(kvp => kvp.Value))));
                }
            }
            else
            {
                ImGui.Text(this.SelectedPlayer.HomeWorlds !.First().Value);
            }

            ImGuiHelpers.ScaledRelativeSameLine(sameLineOffset2);
            ImGui.Text(Loc.Localize("PlayerLastSeen", "Last Seen"));
            ImGuiHelpers.ScaledRelativeSameLine(sameLineOffset3);
            ImGui.Text(this.SelectedPlayer.SeenCount != 0 ? this.SelectedPlayer.Updated.ToTimeSpan() : "N/A");

            ImGui.Text(Loc.Localize("FreeCompany", "Free Company"));
            ImGuiHelpers.ScaledRelativeSameLine(sameLineOffset1);
            ImGui.Text(this.SelectedPlayer.FreeCompany);

            ImGuiHelpers.ScaledRelativeSameLine(sameLineOffset2);
            ImGui.Text(Loc.Localize("PlayerLastLocation", "Last Location"));
            ImGuiHelpers.ScaledRelativeSameLine(sameLineOffset3);
            ImGui.Text(this.SelectedPlayer.LastLocationName);

            ImGui.Text(Loc.Localize("PlayerLodestone", "Lodestone"));
            ImGuiHelpers.ScaledRelativeSameLine(sameLineOffset1);
            if (this.SelectedPlayer.LodestoneStatus != LodestoneStatus.Failed)
            {
                ImGui.Text(this.SelectedPlayer.LodestoneStatus.ToString());
            }
            else
            {
                ImGui.BeginGroup();
                ImGui.Text(this.SelectedPlayer.LodestoneStatus.ToString());
                ImGui.SameLine();
                ImGui.PushFont(UiBuilder.IconFont);
                ImGui.TextColored(ImGuiColors.DPSRed, FontAwesomeIcon.Redo.ToIconString());
                ImGui.PopFont();
                ImGui.EndGroup();
                if (ImGui.IsItemClicked())
                {
                    this.SelectedPlayer.LodestoneStatus       = LodestoneStatus.Unverified;
                    this.SelectedPlayer.LodestoneFailureCount = 0;
                    this.plugin.PlayerService.UpdatePlayerLodestoneState(this.SelectedPlayer);
                    this.plugin.PlayerService.SubmitLodestoneRequest(this.SelectedPlayer);
                }
            }

            ImGuiHelpers.ScaledRelativeSameLine(sameLineOffset2);
            ImGui.Text(Loc.Localize("PlayerSeenCount", "Seen Count"));
            ImGuiHelpers.ScaledRelativeSameLine(sameLineOffset3);
            ImGui.Text(this.SelectedPlayer.SeenCount != 0 ? this.SelectedPlayer.SeenCount + "x" : "N/A");

            // add tag
            if (this.plugin.Configuration.ShowPlayerTags)
            {
                ImGui.Spacing();
                ImGui.TextColored(ImGuiColors.DalamudViolet, Loc.Localize("PlayerTags", "Tags"));
                ImGui.SetNextItemWidth(150f * ImGuiHelpers.GlobalScale);
                ImGui.InputText(
                    "###PlayerTrack_PlayerNotes_InputText",
                    ref this.newTag,
                    20);

                ImGui.SameLine();
                if (ImGui.Button("Add"))
                {
                    if (!string.IsNullOrEmpty(this.newTag))
                    {
                        this.SelectedPlayer.Tags.Add(this.newTag);
                        this.plugin.PlayerService.UpdatePlayerTags(this.SelectedPlayer);
                        this.newTag = string.Empty;
                    }
                }

                // tags
                ImGui.Spacing();
                for (var i = 0; i < this.SelectedPlayer.Tags.Count; i++)
                {
                    if (ImGui.SmallButton(this.SelectedPlayer.Tags[i] + " ×"))
                    {
                        this.SelectedPlayer.Tags.RemoveAt(i);
                        this.plugin.PlayerService.UpdatePlayerTags(this.SelectedPlayer);
                    }

                    ImGui.SameLine();
                }

                if (this.SelectedPlayer.Tags.Count > 0)
                {
                    ImGuiHelpers.ScaledDummy(5f);
                }
            }

            ImGui.Spacing();
            ImGui.TextColored(ImGuiColors.DalamudViolet, Loc.Localize("PlayerNotes", "Notes"));
            var notes = this.SelectedPlayer.Notes;

            if (ImGui.InputTextMultiline(
                    "###PlayerTrack_PlayerNotes_MultiText",
                    ref notes,
                    2000,
                    new Vector2(
                        x: ImGui.GetWindowSize().X - (5f * ImGuiHelpers.GlobalScale),
                        y: -1 - (5f * ImGuiHelpers.GlobalScale))))
            {
                this.SelectedPlayer.Notes = notes;
                this.plugin.PlayerService.UpdatePlayerNotes(this.SelectedPlayer);
            }
        }