mirror of
https://github.com/OpenMW/openmw.git
synced 2025-12-19 10:23:15 +00:00
Replace string.format with l10n in playerskillhandlers
This commit is contained in:
parent
0a04bfa46d
commit
f7ad7a8263
3 changed files with 26 additions and 10 deletions
|
|
@ -15,6 +15,9 @@ set(BUILTIN_DATA_MW_FILES
|
|||
# Generic UI messages that can be reused by mods
|
||||
l10n/Interface/gmst.yaml
|
||||
|
||||
# L10n for game-specific mechanics
|
||||
l10n/Mechanics/gmst.yaml
|
||||
|
||||
# L10n for OpenMW menus and non-game-specific messages
|
||||
l10n/OMWEngine/gmst.yaml
|
||||
|
||||
|
|
|
|||
17
files/data-mw/l10n/Mechanics/gmst.yaml
Normal file
17
files/data-mw/l10n/Mechanics/gmst.yaml
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
ReleasedFromPrison:
|
||||
pattern: |-
|
||||
{days, plural,
|
||||
one{{gmst:sNotifyMessage42}}
|
||||
other{{gmst:sNotifyMessage43}}
|
||||
}
|
||||
variables:
|
||||
- ["days"]
|
||||
- ["days"]
|
||||
SkillIncreasedTo:
|
||||
pattern: "{gmst:sNotifyMessage39}"
|
||||
variables:
|
||||
- ["skill", "level"]
|
||||
SkillDecreasedTo:
|
||||
pattern: "{gmst:sNotifyMessage44}"
|
||||
variables:
|
||||
- ["skill", "level"]
|
||||
|
|
@ -8,6 +8,7 @@ local NPC = types.NPC
|
|||
local Actor = types.Actor
|
||||
local ui = require('openmw.ui')
|
||||
local auxUtil = require('openmw_aux.util')
|
||||
local mechanicsL10n = core.l10n('Mechanics')
|
||||
|
||||
local function tableHasValue(table, value)
|
||||
for _, v in pairs(table) do
|
||||
|
|
@ -99,7 +100,7 @@ local function skillLevelUpHandler(skillid, source, params)
|
|||
|
||||
ambient.playSound("skillraise")
|
||||
|
||||
local message = string.format(core.getGMST('sNotifyMessage39'),skillRecord.name,skillStat.base)
|
||||
local message = mechanicsL10n('SkillIncreasedTo', { skill = skillRecord.name, level = skillStat.base })
|
||||
|
||||
if source == I.SkillProgression.SKILL_INCREASE_SOURCES.Book then
|
||||
message = '#{sBookSkillMessage}\n'..message
|
||||
|
|
@ -134,21 +135,16 @@ local function jailTimeServed(days)
|
|||
I.SkillProgression.skillLevelUp(skillid, I.SkillProgression.SKILL_INCREASE_SOURCES.Jail)
|
||||
end
|
||||
|
||||
local message = ''
|
||||
if days == 1 then
|
||||
message = string.format(core.getGMST('sNotifyMessage42'), days)
|
||||
else
|
||||
message = string.format(core.getGMST('sNotifyMessage43'), days)
|
||||
end
|
||||
local message = mechanicsL10n('ReleasedFromPrison', { days = days });
|
||||
for skillid, skillStat in pairs(NPC.stats.skills) do
|
||||
local diff = skillStat(self).base - oldSkillLevels[skillid]
|
||||
if diff ~= 0 then
|
||||
local skillMsg = core.getGMST('sNotifyMessage39')
|
||||
local skillMsg = 'SkillIncreasedTo'
|
||||
if diff < 0 then
|
||||
skillMsg = core.getGMST('sNotifyMessage44')
|
||||
skillMsg = 'SkillDecreasedTo'
|
||||
end
|
||||
local skillRecord = Skill.record(skillid)
|
||||
message = message..'\n'..string.format(skillMsg, skillRecord.name, skillStat(self).base)
|
||||
message = message..'\n'..mechanicsL10n(skillMsg, { skill = skillRecord.name, level = skillStat(self).base })
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue