Skip to content

Commit

Permalink
wip major translation refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
wookiefriseur committed Jun 5, 2024
1 parent 5036010 commit c558fa3
Show file tree
Hide file tree
Showing 16 changed files with 1,096 additions and 928 deletions.
40 changes: 4 additions & 36 deletions FurCData.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,40 +7,8 @@ local recipeArray = nil
local ver = FurC.Constants.Versioning
local src = FurC.Constants.ItemSources

local function getCurrentChar()
currentChar = currentChar or zo_strformat(GetUnitName("player"))
return currentChar
end

-- GetItemLinkItemId doesn't work the way I need it
-- ToDo: fix this, should only take one type of link (not nil, number, string, links)
local function getItemId(itemLink)
if nil == itemLink or "" == itemLink then
return
end
if type(itemLink) == "number" and itemLink > 9999 then
return itemLink
end
local _, _, _, itemId = ZO_LinkHandler_ParseLink(itemLink)
return tonumber(itemId)
end
FurC.GetItemId = getItemId

--- Get item link from id
--- @param itemId any
--- @return string link or empty string
-- ToDo: fix this, should only take one type of input
local function getItemLink(itemId)
if nil == itemId or #tostring(itemId) < 4 then
return ""
end
itemId = tostring(itemId)
if #itemId > 55 then
return itemId
end
return zo_strformat("|H1:item:<<1>>:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0|h|h", itemId)
end
FurC.GetItemLink = getItemLink
local getItemId = FurC.Utils.GetItemId
local getCurrentChar = FurC.Utils.GetCurrentChar

local function printItemLink(itemId)
if nil == itemId then
Expand Down Expand Up @@ -94,7 +62,7 @@ function FurC.GetIngredients(itemLink, recipeArray)
local ingredients = {}
if {} ~= recipeArray and recipeArray.blueprint then
local blueprintLink = FurC.GetItemLink(recipeArray.blueprint)
numIngredients = GetItemLinkRecipeNumIngredients(blueprintLink)
local numIngredients = GetItemLinkRecipeNumIngredients(blueprintLink)
for ingredientIndex = 1, numIngredients do
local name, _, qty = GetItemLinkRecipeIngredientInfo(blueprintLink, ingredientIndex)
local ingredientLink = GetItemLinkRecipeIngredientItemLink(blueprintLink, ingredientIndex, LINK_STYLE_DEFAULT)
Expand Down Expand Up @@ -201,7 +169,7 @@ function FurC.Find(itemOrBlueprintLink)
end

function FurC.Delete(itemOrBlueprintLink) -- sets recipeArray, returns it - calls scanItemLink
local recipeArray = FurC.GetItemId(itemOrBlueprintLink)
local recipeArray = getItemId(itemOrBlueprintLink)
if nil == recipeArray then
return
end
Expand Down
4 changes: 3 additions & 1 deletion FurCDataParser.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
local db = FurC.settings["data"]

local getItemId = FurC.Utils.GetItemId

function FurC.PrintCraftingStation(itemId, recipeArray)
local craftingType = FurC.GetCraftingSkillType(itemId, recipeArray)
if not craftingType or not GetCraftingSkillName(craftingType) then
Expand Down Expand Up @@ -54,7 +56,7 @@ function FurC.PrintSource(itemLink, recipeArray)
return
end

local source = FurC.GetItemDescription(FurC.GetItemId(itemLink), recipeArray, true)
local source = FurC.GetItemDescription(getItemId(itemLink), recipeArray, true)
local output = string.format("%s: %s", itemLink, source)
if recipeArray.achievement and recipeArray.achievement ~= "" then
output = string.format("%s, requires %s", output, recipeArray.achievement)
Expand Down
4 changes: 2 additions & 2 deletions FurCDatabaseQuery.lua
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ local function getLuxurySource(recipeKey, recipeArray, stripColor)
local weekendString = (nil == itemData.itemDate and "") or zo_strformat(WEEKEND_DATE, formattedDate)
return zo_strformat(
SOLD_BY,
colourise(GetString(SI_FURC_STRING_ASSHOLE), colour.Vendor, stripColor),
colourise(GetString(SI_FURC_STRING_HC), colour.Vendor, stripColor),
colourise(GetString(SI_FURC_TRADERS_ZANIL), colour.Vendor, stripColor),
colourise(GetString(SI_FURC_LOC_COLDH_HOLLOW), colour.Vendor, stripColor),
colourise(itemData.itemPrice, colour.Gold, stripColor),
weekendString
)
Expand Down
4 changes: 3 additions & 1 deletion FurCEvents.lua
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ local function updateItemInInventory(control)

WINDOW_MANAGER:ApplyTemplateToControl(icon, templateName)

icon.data = { tooltipText = ((known and GetString(SI_FURC_CRAFTING_KNOWN)) or GetString(SI_FURC_CRAFTING_UNKNOWN)) }
icon.data = {
tooltipText = ((known and GetString(SI_FURC_FILTER_CRAFTING_KNOWN)) or GetString(SI_FURC_FILTER_CRAFTING_UNKNOWN)),
}
icon:SetHandler("OnMouseEnter", ZO_Options_OnMouseEnter)
icon:SetHandler("OnMouseExit", ZO_Options_OnMouseExit)
end
Expand Down
Loading

0 comments on commit c558fa3

Please sign in to comment.