Skip to content

Commit

Permalink
wip LLM (large language modification)
Browse files Browse the repository at this point in the history
  • Loading branch information
wookiefriseur committed Jun 5, 2024
1 parent c558fa3 commit 47ebab2
Show file tree
Hide file tree
Showing 16 changed files with 1,681 additions and 1,611 deletions.
4 changes: 2 additions & 2 deletions FurCContextMenu.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FurC_LinkHandlerBackup_OnLinkMouseUp = nil

local FURC_S_SHOPPINGLIST_1 = GetString(SI_FURC_ONE_TO_SHOPPINGLIST)
local FURC_S_SHOPPINGLIST_5 = GetString(SI_FURC_FIVE_TO_SHOPPINGLIST)
local FURC_S_SHOPPINGLIST_1 = GetString(SI_FURC_PLUGIN_SL_ADD_ONE)
local FURC_S_SHOPPINGLIST_5 = GetString(SI_FURC_PLUGIN_SL_ADD_FIVE)
local FURC_S_TOGGLE_SL = GetString(SI_FURC_TOGGLE_SHOPPINGLIST)

local linkStyle = LINK_STYLE_DEFAULT
Expand Down
4 changes: 2 additions & 2 deletions FurCControlBridge.lua
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,10 @@ function FurC.GuiHideTooltip(control)
end

function FurC.GetRumourTooltip()
return GetString((FurC.GetShowRumours() and SI_FURC_HIDE_RUMOUR_TT) or SI_FURC_SHOW_RUMOUR_TT)
return GetString((FurC.GetShowRumours() and SI_FURC_FILTER_RUMOUR_HIDE_TT) or SI_FURC_SHOW_RUMOUR_TT)
end
function FurC.GetCrownTooltip()
return GetString((FurC.GetShowCrownstore() and SI_FURC_HIDE_CROWN_TT) or SI_FURC_SHOW_CROWN_TT)
return GetString((FurC.GetShowCrownstore() and SI_FURC_FILTER_CROWN_HIDE_TT) or SI_FURC_SHOW_CROWN_TT)
end

function FurC.GuiOnSearchBoxClick(control, mouseButton, doubleClick)
Expand Down
4 changes: 2 additions & 2 deletions FurCDatabaseQuery.lua
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ local function getEventDropSource(recipeKey, recipeArray, stripColor)
end
FurC.getEventDropSource = getEventDropSource

local emptyString = GetString(SI_FURC_ITEMSOURCE_EMPTY)
local emptyString = GetString(SI_FURC_SRC_EMPTY)
local function registerEmptyItem(recipeKey)
if recipeKey and tonumber(recipeKey) > 0 then
FurC.settings.emptyItemSources[recipeKey] = ", --" .. GetItemLinkName(FurC.GetItemLink(recipeKey))
Expand Down Expand Up @@ -236,7 +236,7 @@ end
FurC.getRecipeSource = getRecipeSource

function FurC.getRumourSource(recipeKey, recipeArray)
return (recipeArray.blueprint and GetString(SI_FURC_RUMOUR_SOURCE_RECIPE)) or GetString(SI_FURC_RUMOUR_SOURCE_ITEM)
return (recipeArray.blueprint and GetString(SI_FURC_SRC_RUMOUR_RECIPE)) or GetString(SI_FURC_SRC_RUMOUR_ITEM)
end

function FurC.GetCrafterList(itemLink, recipeArray)
Expand Down
4 changes: 3 additions & 1 deletion FurCEvents.lua
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ local function updateItemInInventory(control)
WINDOW_MANAGER:ApplyTemplateToControl(icon, templateName)

icon.data = {
tooltipText = ((known and GetString(SI_FURC_FILTER_CRAFTING_KNOWN)) or GetString(SI_FURC_FILTER_CRAFTING_UNKNOWN)),
tooltipText = ((known and GetString(SI_FURC_FILTER_SRC_CRAFTING_KNOWN)) or GetString(
SI_FURC_FILTER_SRC_CRAFTING_UNKNOWN
)),
}
icon:SetHandler("OnMouseEnter", ZO_Options_OnMouseEnter)
icon:SetHandler("OnMouseExit", ZO_Options_OnMouseExit)
Expand Down
79 changes: 61 additions & 18 deletions FurCUtil.lua
Original file line number Diff line number Diff line change
Expand Up @@ -110,20 +110,21 @@ function this.Join(strings, conjunction)
return ""
end

conjunction = conjunction or (" " .. GetString(SI_FURC_OR) .. " ")
conjunction = conjunction or (" " .. GetString(SI_FURC_GRAMMAR_CONJ_OR) .. " ")
return table.concat(strings, conjunction)
end

-- GAME UTILS --

-- TODO #REFACTOR: collecting those in 1 place for now, move later, make some available in API

---Get the current character name in desired format
---@return string
function this.GetCurrentChar()
return zo_strformat(GetUnitName("player"))
end

-- TODO #REFACTOR: collecting those in 1 place for now, move later, make some available in API
-- TODO #REFACTOR: for now separate formatters for each use case for more flexibility, later merge into one

local colours = FurC.ItemLinkColours
local currencies = {
[CURT_NONE] = {
Expand Down Expand Up @@ -201,29 +202,71 @@ function this.FormatPartOf(itemid, note)
return result_str
end

local prepDefault = GetString(SI_FURC_GRAMMAR_LOC_PREP_DEFAULT)
---Format a location string containing an optional preposition like "Summerset^on".
---<br>Will remove the preposition by default.
---@param locRef string location reference like SI_FURC_LOC_SUMMERSET, saved as "Summerset^on"
---@param showPrep boolean|nil show the preposition, defaults to false
local prepDefault = GetString(SI_FURC_GRAMMAR_PREP_LOC_DEFAULT) -- "in"
local wordOrder = GetString(SI_FURC_GRAMMAR_ORDER_LOC) -- "<<1>> <<2>>"
---Format a location string containing an optional preposition form.
---<br>- if a preposition is requested but missing, the default is used (EN: "in")
---@param loc string location resolved by GetString like "Summerset;on Summerset"
---@param showPrep boolean|nil show the preposition form, defaults to false
---@return string locStr location with or without preposition, like "on Summerset" and "Summerset"
function this.GetLocationString(locRef, showPrep)
local format = GetString(SI_FURC_GRAMMAR_WORDORDER_LOC)
local locStr = GetString(locRef)
function this.FormatLocation(loc, showPrep)
local locStr = GetString(loc)
local prepIndex = string.find(locStr, ";")
local withPrep = ""
local noPrep = locStr

-- if the translation contains a preposition, get it out of the location string
local preposition = prepDefault
local prepIndex = string.find(locStr, "^")
if prepIndex then
preposition = string.sub(locStr, prepIndex + 1)
locStr = string.sub(locStr, 1, prepIndex - 1)
withPrep = string.sub(locStr, prepIndex + 1)
noPrep = string.sub(locStr, 1, prepIndex - 1)
end

if showPrep then
return zo_strformat(format, preposition, locStr)
return prepIndex and withPrep or zo_strformat(wordOrder, prepDefault, noPrep)
end

return noPrep
end

---Formatted Event String
---@param events table Resolved names from GetString(SI_FURC_XYZ) like {"Bounties of Blackwood", "Elsweyr Dragons"}
---@return string formatted like "Events: Bounties of Blackwood, Elsweyr Dragons"
function this.FormatEvent(events)
local prefix = GetString(SI_FURC_EVENT)
local colonIndex = string.find(prefix, ";")

local joined = ""
-- decide on singular or plural from event;events
if #events > 1 then
joined = this.Join(events, ", ")
prefix = string.sub(prefix, colonIndex + 1)
else
return locStr
joined = events[1]
prefix = string.sub(prefix, 1, colonIndex - 1)
end

prefix = LocaleAwareToUpper(string.sub(prefix, 1, 1)) .. string.sub(prefix, 2)
return prefix .. ": " .. joined
end

---Formatted Dungeon String
---@param dungeons table Resolved names from GetString(SI_FURC_XYZ) like {"Fungal Grotto", "Depths of Malatar"}
---@return string formatted like "Dungeon: Depths of Malatar"
function this.FormatDungeon(dungeons)
local prefix = GetString(SI_FURC_DUNG)
local colonIndex = string.find(prefix, ";")

local joined = ""
-- decide on singular or plural from dungeon;dungeons
if #dungeons > 1 then
joined = this.Join(dungeons, ", ")
prefix = string.sub(prefix, colonIndex + 1)
else
joined = dungeons[1]
prefix = string.sub(prefix, 1, colonIndex - 1)
end

prefix = LocaleAwareToUpper(string.sub(prefix, 1, 1)) .. string.sub(prefix, 2)
return prefix .. ": " .. joined
end

-- TODO #INVESTIGATE: GetZoneNameById, GetZoneNameByIndex for all map available zones?
Expand Down
2 changes: 1 addition & 1 deletion FurnitureCatalogue_DevUtility/ContextMenu.lua
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ FurCDev.GetQuestId = getQuestId
local s2 = "\t"
local s4 = "\t\t"
-- local s_default = (s2 .. "[%d] = GetString(SI_FURC_EXISITING_ITEMSOURCE_UNKNOWN_YET)," .. s2 .. "-- %s\n")
local s_default = (s2 .. "[%d] = getCrownPrice(99)," .. s4 .. " " .. "-- %s")
local s_default = (s2 .. "[%d] = strCrown(99)," .. s4 .. " " .. "-- %s")
local s_letter = (s2 .. "[%d] = rumourSource," .. s4 .. " " .. "-- %s")
local s_withPrice = (s2 .. "[%d] = {" .. s4 .. "-- %s\n" .. s4 .. "itemPrice = %d,\n" .. s2 .. "},")
local s_withAchievement = (
Expand Down
2 changes: 1 addition & 1 deletion data/AchievementVendors.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ local function getQuestString(questIdOrName)
if type(questIdOrName) == "number" then
questName = GetQuestName(questIdOrName)
end
return zo_strformat("<<1>>: <<2>>", GetString(SI_FURC_ITEMSRC_QUEST), questName)
return zo_strformat("<<1>>: <<2>>", GetString(SI_FURC_SRC_QUEST), questName)
end

local b2 = {
Expand Down
Loading

0 comments on commit 47ebab2

Please sign in to comment.