Thread Tools Display Modes
12/13/20, 03:49 PM   #1
tawniey
Join Date: Dec 2015
Posts: 7
Request: Custom Flavor-Text and Item Nicknames

Hello!

I've been looking for an addon to serve this function for a while, and I believe it to be possible using similar functions to Trait Rename (https://www.esoui.com/downloads/info...name.html#info) perhaps? Specifically, I would like to be able to rename an item in how it appears in the tooltip to me (ie: change "Fiord's Bow" to "Bow of Nyooming") and add flavor-text to an item's tooltip, similarly to how some quest-obtained items have their own flavor text. (ie: "This bow was given to you by Nathan after besting him at a sprinting competition. It imbues you with energy just holding it.")

I understand that, like Trait Rename, nicknames and flavor text would not be visible by anyone other than the player who set the name or text, and would not persist when traded -- but I would love to make use of something like this for my own personal RP/storytelling reasons, and believe it may be useful to others for more utilitarian reasons as well -- if only making a note on an item such as "transmute to [trait], low priority" etc that can't be easily conveyed in an FCO ItemSaver icon.

Would this be possible? I'd be very grateful if anyone would be interested in making it happen!
Thanks in advance for any consideration and feedback.
  Reply With Quote
12/13/20, 04:05 PM   #2
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,960
I doubt it's easily doable, maybe not doable at all.
Afaik we can only change the tooltips by adding information at the bottom, or overwriting portions like the traitname (where the addon you have linked only replaced the vanilla text constants with it's own ones so that every vanilla UI part or addon using the same text constants will return the changed texts). But afaik we cannot do this for itemnames or their quality text. The itemnames are determined via another function (e.g. function GetItemName(bagId, slotIndex)) , and not any constants we could overwrite/alter, which is getting the info from the c code, not the lua code. One maybe could hook this function to change the results, but this would be definately kiling some other addons in the end...

What you could do is add texts based on the itemIds, to the tooltips. e.g. use a settings panel to add an itemId, enter a text, save it and the next tooltip adds this text t the tooltip's bottom. But it won't replace the item's name nor the tooltips other text!

Last edited by Baertram : 12/13/20 at 04:08 PM.
  Reply With Quote
12/13/20, 04:23 PM   #3
tawniey
Join Date: Dec 2015
Posts: 7
Originally Posted by Baertram View Post
I doubt it's easily doable, maybe not doable at all.
Afaik we can only change the tooltips by adding information at the bottom, or overwriting portions like the traitname (where the addon you have linked only replaced the vanilla text constants with it's own ones so that every vanilla UI part or addon using the same text constants will return the changed texts). But afaik we cannot do this for itemnames or their quality text. The itemnames are determined via another function (e.g. function GetItemName(bagId, slotIndex)) , and not any constants we could overwrite/alter, which is getting the info from the c code, not the lua code. One maybe could hook this function to change the results, but this would be definately kiling some other addons in the end...

What you could do is add texts based on the itemIds, to the tooltips. e.g. use a settings panel to add an itemId, enter a text, save it and the next tooltip adds this text t the tooltip's bottom. But it won't replace the item's name nor the tooltips other text!
Aaah, okay. I confess, I am not fluent enough to understand how much of addon coding functions, but what you've said makes sense. I appreciate the explanation!

Personally, even if all that could be done is adding an additional tooltip to an item in the same font and text size as the typical flavor-text in tooltips, I'd still consider that a huge win! I'm just a story nerd who'd like to be able to remind myself of storytelling-significance to objects I have my characters carry around, or weapons I choose to have them use.
  Reply With Quote
12/14/20, 08:55 AM   #4
Hyperioxes
 
Hyperioxes's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2020
Posts: 6
Define function
Lua Code:
  1. local function TooltipHook(tooltipControl, method, linkFunc)
  2.     local origMethod = tooltipControl[method]
  3.  
  4.     tooltipControl[method] = function(self, ...)
  5.         local link = linkFunc(...) -- you'll need the item link since you only wanna change names of certain items, here for demonstration ill just change name of every item
  6.         local orgText = GetString(SI_TOOLTIP_ITEM_NAME)
  7.         SafeAddString(SI_TOOLTIP_ITEM_NAME, "your text", 1)    
  8.         origMethod(self, ...)
  9.         SafeAddString(SI_TOOLTIP_ITEM_NAME, orgText, 1)
  10.     end
  11. end

Call in addon's initialize function
Lua Code:
  1. TooltipHook(ItemTooltip, "SetBagItem", GetItemLink)
  2.     TooltipHook(ItemTooltip, "SetTradeItem", GetTradeItemLink)
  3.     TooltipHook(ItemTooltip, "SetBuybackItem", GetBuybackItemLink)
  4.     TooltipHook(ItemTooltip, "SetStoreItem", GetStoreItemLink)
  5.     TooltipHook(ItemTooltip, "SetAttachedMailItem", GetAttachedItemLink)
  6.     TooltipHook(ItemTooltip, "SetLootItem", GetLootItemLink)
  7.     TooltipHook(ItemTooltip, "SetTradingHouseItem", GetTradingHouseSearchResultItemLink)
  8.     TooltipHook(ItemTooltip, "SetTradingHouseListing", GetTradingHouseListingItemLink)
  9.     TooltipHook(ItemTooltip, "SetLink", ReturnItemLink)
  10.     TooltipHook(PopupTooltip, "SetLink", ReturnItemLink)



It won't change names on tooltips of equipped items, you'd need to find the function to hook on your own, I didn't bother finding it cuz I didn't need it for my alchemy addon. If you wanna see more how it works look into Alchemy Tooltips' code and look at file TooltipHooks.lua
  Reply With Quote
12/14/20, 09:48 AM   #5
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,960
Nice, didn't know the tooltips also use a constant for the name shown at the top (SI_TOOLTIP_ITEM_NAME), one could overwrite.
Thanks for sharing this info.
  Reply With Quote

ESOUI » AddOns » AddOn Search/Requests » Request: Custom Flavor-Text and Item Nicknames

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off