Originally Posted by merlight
No, in French it's in the middle: Glyphe Fort Vital
You could get away with splitting it into words and removing those found in the 0-level name. Seems a bit too complicated (and error-prone) for something that can be done with one table per language.
|
True, but where is the fun in that :P
Lua Code:
local allowedItemType = {
[ITEMTYPE_GLYPH_WEAPON] = true,
[ITEMTYPE_GLYPH_ARMOR] = true,
[ITEMTYPE_GLYPH_JEWELRY] = true,
}
local function GetItemLinkGlyphStrengthLabel(link)
if(not allowedItemType[GetItemLinkItemType(link)]) then return end
-- get the base name of the glyph
local data = {zo_strsplit(":", link)}
data[4], data[5] = 0, 0 -- at quality and level 0 there is no prefix
local baseName = zo_strformat("<<t:1>>", GetItemLinkName(table.concat(data, ":")))
-- generate a lookup table of all words in the name
local baseTokens = {}
baseName:gsub("(%a+)%s*", function(token) baseTokens[token] = true end)
-- remove the base name from the link
local name = zo_strformat("<<t:1>>", GetItemLinkName(link))
return name:gsub("(%a+)%s*", function(token)
if(baseTokens[token]) then return "" end
end):gsub("^%s*(.-)%s*$", "%1")
end
local prefix = GetItemLinkGlyphStrengthLabel("|H1:item:5364:0:1:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0|h|h")
df("'%s'", prefix)