Item: update rarity description display
This commit is contained in:
@@ -19,7 +19,7 @@ local ItemFactory = Smc.requireItemFactory()
|
||||
local TITLE_RARITY_COLOR = true
|
||||
|
||||
---Shows rarity on a separate line.
|
||||
local SHOW_RARITY = false
|
||||
local SHOW_RARITY = true
|
||||
|
||||
---Determines whether common rarity will be shown in item descriptions or not.
|
||||
local SHOW_COMMON_RARITY = true
|
||||
@@ -59,25 +59,18 @@ local Item = Class:extend({
|
||||
}
|
||||
})
|
||||
|
||||
local DESC_PATTERNS = {
|
||||
[1] = '{title}\n {desc}',
|
||||
[2] = '{title}\n {desc}\n{rarity_title}'
|
||||
}
|
||||
|
||||
---Returns an item description pattern in accordance
|
||||
---with global rarity display settings.
|
||||
---@param rarity Item.Rarity
|
||||
---@return string
|
||||
local function getDescPattern(rarity)
|
||||
if not SHOW_RARITY then
|
||||
return DESC_PATTERNS[1]
|
||||
---@param rarity Item.Rarity
|
||||
---@param descColor ColorString
|
||||
---@return string
|
||||
local function getDescPattern(rarity, descColor)
|
||||
if not SHOW_RARITY or (not SHOW_COMMON_RARITY and rarity == 'common') then
|
||||
return '{title}\n {desc}'
|
||||
end
|
||||
|
||||
if not SHOW_COMMON_RARITY and rarity == 'common' then
|
||||
return DESC_PATTERNS[1]
|
||||
end
|
||||
|
||||
return DESC_PATTERNS[2]
|
||||
return '{title}\n {desc}\n\n '..
|
||||
coreColorize(descColor, coreTranslate('item', 'Rarity')..': ')..'{rarity_title}'
|
||||
end
|
||||
|
||||
---@param itemDef Item.ItemDefinition
|
||||
@@ -120,7 +113,7 @@ local function itemDefToLuantiDef(itemDef)
|
||||
s._description = description
|
||||
s._rarity_title = rarityTitle
|
||||
|
||||
local luantiDescription = smcConcatItemDescription(s, nil, getDescPattern(s._rarity))
|
||||
local luantiDescription = smcConcatItemDescription(s, nil, getDescPattern(s._rarity, s._description_color))
|
||||
s.description = luantiDescription..ITEM_DESC_BACKGROUND_ESCAPE_SEQ
|
||||
|
||||
local luantiDef = tableMerge(s, c, true) --[[@as ItemDefinition]]
|
||||
|
||||
Reference in New Issue
Block a user