Beispiel #1
0
        public override void OnItemTooltip(TooltipTweaks.ItemTooltip tooltip, InventoryItem itemInfo)
        {
            var c = tooltip[DurabilityPercent];

            if (c != null && !(c.Payloads[0] is TextPayload tp && tp.Text.StartsWith("?")))
            {
                tooltip[DurabilityPercent] = new SeString(new List <Payload>()
                {
                    new TextPayload((itemInfo.Condition / 300f).ToString(Config.TrailingZero ? "F2" : "0.##") + "%")
                });
            }
        }
Beispiel #2
0
        public override void OnItemTooltip(TooltipTweaks.ItemTooltip tooltip, InventoryItem itemInfo)
        {
            var seStr = tooltip[ItemUiCategory];

            if (seStr == null)
            {
                return;
            }
            var id = Service.GameGui.HoveredItem;

            if (id < 2000000)
            {
                id %= 500000;
            }
            seStr.Payloads.Add(new UIForegroundPayload(3));
            seStr.Payloads.Add(new TextPayload($"   [{id}]"));
            seStr.Payloads.Add(new UIForegroundPayload(0));
            tooltip[ItemUiCategory] = seStr;
        }
        public override void OnItemTooltip(TooltipTweaks.ItemTooltip tooltip, InventoryItem itemInfo)
        {
            var seStr = tooltip[ItemUiCategory];

            if (seStr == null)
            {
                return;
            }
            var id = Plugin.PluginInterface.Framework.Gui.HoveredItem;

            if (id < 2000000)
            {
                id %= 500000;
            }
            seStr.Payloads.Add(new UIForegroundPayload(PluginInterface.Data, 3));
            seStr.Payloads.Add(new TextPayload($"   [{id}]"));
            seStr.Payloads.Add(new UIForegroundPayload(PluginInterface.Data, 0));
            tooltip[ItemUiCategory] = seStr;
        }
Beispiel #4
0
        public override void OnItemTooltip(TooltipTweaks.ItemTooltip tooltip, InventoryItem itemInfo)
        {
            if (Config.HideHotkeysOnTooltip)
            {
                return;
            }
            var seStr = tooltip[TooltipTweaks.ItemTooltip.TooltipField.ControlsDisplay];

            if (seStr == null)
            {
                return;
            }

            var split = seStr.TextValue.Split(new string[] { weirdTabChar }, StringSplitOptions.None);

            if (split.Length > 0)
            {
                seStr.Payloads.Clear();
                seStr.Payloads.Add(new TextPayload(string.Join("\n", split)));
            }

            if (Config.CopyHotkeyEnabled)
            {
                seStr.Payloads.Add(new TextPayload($"\n{string.Join("+", Config.CopyHotkey.Select(k => k.GetKeyName()))}  Copy item name"));
            }
            if (Config.TeamcraftLinkHotkeyEnabled)
            {
                seStr.Payloads.Add(new TextPayload($"\n{string.Join("+", Config.TeamcraftLinkHotkey.Select(k => k.GetKeyName()))}  View on Teamcraft"));
            }
            if (Config.GardlandToolsLinkHotkeyEnabled)
            {
                seStr.Payloads.Add(new TextPayload($"\n{string.Join("+", Config.GardlandToolsLinkHotkey.Select(k => k.GetKeyName()))}  View on Garland Tools"));
            }
            if (Config.GamerEscapeLinkHotkeyEnabled)
            {
                seStr.Payloads.Add(new TextPayload($"\n{string.Join("+", Config.GamerEscapeLinkHotkey.Select(k => k.GetKeyName()))}  View on Gamer Escape"));
            }

            SimpleLog.Verbose(seStr.Payloads);
            tooltip[TooltipTweaks.ItemTooltip.TooltipField.ControlsDisplay] = seStr;
        }
Beispiel #5
0
        public override unsafe void OnItemTooltip(TooltipTweaks.ItemTooltip tooltip, InventoryItem itemInfo)
        {
            var id = PluginInterface.Framework.Gui.HoveredItem;

            if (id < 2000000)
            {
                id %= 500000;

                var item = PluginInterface.Data.Excel.GetSheet <Sheets.ExtendedItem>().GetRow((uint)id);
                if (item != null && item.Desynth > 0)
                {
                    var classJobOffset = 2 * (int)(item.ClassJobRepair.Row - 8);
                    var desynthLevel   = *(ushort *)(Common.PlayerStaticAddress + (0x6A6 + classJobOffset)) / 100f;
                    var desynthDelta   = item.LevelItem.Row - desynthLevel;

                    var useDescription = desynthesisInDescription.Contains(item.ItemSearchCategory.Row);

                    var seStr = tooltip[useDescription ? ItemDescription : ExtractableProjectableDesynthesizable];

                    if (seStr != null)
                    {
                        if (seStr.Payloads.Last() is TextPayload textPayload)
                        {
                            if (PluginConfig.TooltipTweaks.DesynthesisDelta)
                            {
                                textPayload.Text = textPayload.Text.Replace($"{item.LevelItem.Row},00", $"{item.LevelItem.Row} ({desynthDelta:+#;-#}");
                                textPayload.Text = textPayload.Text.Replace($"{item.LevelItem.Row}.00", $"{item.LevelItem.Row} ({desynthDelta:+#;-#})");
                            }
                            else
                            {
                                textPayload.Text = textPayload.Text.Replace($"{item.LevelItem.Row},00", $"{item.LevelItem.Row} ({desynthLevel:F0})");
                                textPayload.Text = textPayload.Text.Replace($"{item.LevelItem.Row}.00", $"{item.LevelItem.Row} ({desynthLevel:F0})");
                            }
                            tooltip[useDescription ? ItemDescription : ExtractableProjectableDesynthesizable] = seStr;
                        }
                    }
                }
            }
        }
Beispiel #6
0
        public override void OnItemTooltip(TooltipTweaks.ItemTooltip tooltip, InventoryItem itemInfo)
        {
            var id = Service.GameGui.HoveredItem;

            if (id < 2000000)
            {
                var hq = id >= 500000;
                id %= 500000;
                var item = itemSheet.GetRow((uint)id);
                if (item == null)
                {
                    return;
                }
                var action = item.ItemAction?.Value;

                if (action != null && action.Type is 844 or 845 or 846)
                {
                    var itemFood = foodSheet.GetRow(hq ? action.DataHQ[1] : action.Data[1]);
                    if (itemFood != null)
                    {
                        var payloads  = new List <Payload>();
                        var hasChange = false;

                        foreach (var bonus in itemFood.UnkStruct1)
                        {
                            if (bonus.BaseParam == 0)
                            {
                                continue;
                            }
                            var param = bpSheet.GetRow(bonus.BaseParam);
                            if (param == null)
                            {
                                continue;
                            }
                            var value = hq ? bonus.ValueHQ : bonus.Value;
                            var max   = hq ? bonus.MaxHQ : bonus.Max;
                            if (bonus.IsRelative)
                            {
                                hasChange = true;

                                var currentStat = getBaseParam(playerStaticAddress, bonus.BaseParam);
                                var relativeAdd = (short)(currentStat * (value / 100f));
                                var change      = relativeAdd > max ? max : relativeAdd;

                                if (payloads.Count > 0)
                                {
                                    payloads.Add(new TextPayload("\n"));
                                }

                                payloads.Add(new TextPayload($"{param.Name} +"));

                                if (Config.Highlight && change < max)
                                {
                                    payloads.Add(new UIForegroundPayload(500));
                                }
                                payloads.Add(new TextPayload($"{value}%"));
                                if (change < max)
                                {
                                    if (Config.Highlight)
                                    {
                                        payloads.Add(new UIForegroundPayload(0));
                                    }
                                    payloads.Add(new TextPayload($" (Current "));
                                    if (Config.Highlight)
                                    {
                                        payloads.Add(new UIForegroundPayload(500));
                                    }
                                    payloads.Add(new TextPayload($"{change}"));
                                    if (Config.Highlight)
                                    {
                                        payloads.Add(new UIForegroundPayload(0));
                                    }
                                    payloads.Add(new TextPayload($")"));
                                }

                                payloads.Add(new TextPayload(" (Max "));
                                if (Config.Highlight && change == max)
                                {
                                    payloads.Add(new UIForegroundPayload(500));
                                }
                                payloads.Add(new TextPayload($"{max}"));
                                if (Config.Highlight && change == max)
                                {
                                    payloads.Add(new UIForegroundPayload(0));
                                }
                                payloads.Add(new TextPayload(")"));
                            }
                            else
                            {
                                if (payloads.Count > 0)
                                {
                                    payloads.Add(new TextPayload("\n"));
                                }
                                payloads.Add(new TextPayload($"{param.Name} +{value}"));
                            }
                        }

                        if (payloads.Count > 0 && hasChange)
                        {
                            var seStr = new SeString(payloads);
                            tooltip[TooltipTweaks.ItemTooltip.TooltipField.Effects] = seStr;
                        }
                    }
                }
            }
        }
        public override void OnItemTooltip(TooltipTweaks.ItemTooltip tooltip, InventoryItem itemInfo)
        {
            if (!(Config.Delta || Config.Total == false))
            {
                Config.Total = true;                                           // Config invalid check
            }
            try {
                var item = PluginInterface.Data.Excel.GetSheet <Sheets.ExtendedItem>().GetRow(itemInfo.ItemId);
                if (item == null)
                {
                    return;
                }
                if (item.MateriaSlotCount == 0)
                {
                    return;
                }
                var itemLevel = PluginInterface.Data.Excel.GetSheet <ExtendedItemLevel>().GetRow(item.LevelItem.Row);
                if (itemLevel == null)
                {
                    return;
                }
                var baseParams        = new Dictionary <uint, ExtendedBaseParam>();
                var baseParamDeltas   = new Dictionary <uint, int>();
                var baseParamOriginal = new Dictionary <uint, int>();
                var baseParamLimits   = new Dictionary <uint, int>();
                foreach (var bp in item.BaseParam)
                {
                    if (bp.Value == 0 || bp.BaseParam.Row == 0)
                    {
                        continue;
                    }
                    baseParamDeltas.Add(bp.BaseParam.Row, 0);
                    baseParamOriginal.Add(bp.BaseParam.Row, bp.Value);
                    baseParamLimits.Add(bp.BaseParam.Row, (int)Math.Ceiling(itemLevel.BaseParam[bp.BaseParam.Row] * (bp.BaseParam.Value.EquipSlotCategoryPct[item.EquipSlotCategory.Row] / 100f)));
                    baseParams.Add(bp.BaseParam.Row, bp.BaseParam.Value);
                }

                if (itemInfo.IsHQ)
                {
                    foreach (var bp in item.BaseParamSpecial)
                    {
                        if (bp.Value == 0 || bp.BaseParam.Row == 0)
                        {
                            continue;
                        }
                        if (baseParamOriginal.ContainsKey(bp.BaseParam.Row))
                        {
                            baseParamOriginal[bp.BaseParam.Row] += bp.Value;
                        }
                    }
                }

                if (baseParamDeltas.Count == 0)
                {
                    return;
                }

                foreach (var(materiaId, level) in itemInfo.Materia())
                {
                    if (level >= 10)
                    {
                        continue;
                    }
                    var materia = PluginInterface.Data.Excel.GetSheet <Materia>().GetRow(materiaId);
                    if (materia == null)
                    {
                        continue;
                    }
                    if (materia.BaseParam.Row == 0)
                    {
                        continue;
                    }
                    if (!baseParamDeltas.ContainsKey(materia.BaseParam.Row))
                    {
                        continue;
                    }
                    baseParamDeltas[materia.BaseParam.Row] += materia.Value[level];
                }
                foreach (var bp in baseParamDeltas)
                {
                    var param = baseParams[bp.Key];
                    if (bp.Value == 0)
                    {
                        continue;
                    }

                    foreach (var field in Fields())
                    {
                        var data = tooltip[field];
                        if (data == null)
                        {
                            continue;
                        }

                        if (data.TextValue.Contains(param.Name))
                        {
                            data.Payloads.Add(new TextPayload($" ["));
                            var totalValue  = baseParamOriginal[bp.Key] + bp.Value;
                            var deltaValue  = bp.Value;
                            var exceedLimit = false;
                            if (totalValue > baseParamLimits[bp.Key])
                            {
                                exceedLimit = true;
                                totalValue  = baseParamLimits[bp.Key];
                                deltaValue  = baseParamLimits[bp.Key] - baseParamOriginal[bp.Key];
                            }
                            if (Config.Delta)
                            {
                                if (!(Config.Total && Config.SimpleCombined))
                                {
                                    data.Payloads.Add(new TextPayload($"+"));
                                }
                                if (Config.Colour && !Config.Total)
                                {
                                    data.Payloads.Add(new UIForegroundPayload(PluginInterface.Data, (ushort)(exceedLimit ? 14 : 500)));
                                }
                                data.Payloads.Add(new TextPayload($"{deltaValue}"));
                                if (Config.Colour && !Config.Total)
                                {
                                    data.Payloads.Add(new UIForegroundPayload(PluginInterface.Data, 0));
                                }
                                if (Config.Total && !Config.SimpleCombined)
                                {
                                    data.Payloads.Add(new TextPayload("="));
                                }
                                else if (Config.Total)
                                {
                                    data.Payloads.Add(new TextPayload(" "));
                                }
                            }
                            if (Config.Total)
                            {
                                if (Config.Colour)
                                {
                                    data.Payloads.Add(new UIForegroundPayload(PluginInterface.Data, (ushort)(exceedLimit ? 14 : 500)));
                                }
                                data.Payloads.Add(new TextPayload($"{totalValue}"));
                                if (Config.Colour)
                                {
                                    data.Payloads.Add(new UIForegroundPayload(PluginInterface.Data, 0));
                                }
                            }

                            data.Payloads.Add(new TextPayload("]"));

                            tooltip[field] = data;
                        }
                    }
                }
            } catch (Exception ex) {
                SimpleLog.Error(ex);
            }
        }