Fixes
This commit is contained in:
parent
39b273ad1c
commit
e17370a89f
4 changed files with 23 additions and 10 deletions
12
Data.lua
12
Data.lua
|
|
@ -12,12 +12,12 @@ AltSystem.Data.SkillLevels = {
|
||||||
["Master"] = 4,
|
["Master"] = 4,
|
||||||
}
|
}
|
||||||
|
|
||||||
-- The "Unskilled" entry is always the first (default) skill
|
-- The "Inept" entry is always the first (default) skill
|
||||||
local UNSKILLED_ENTRY = { name = "Unskilled", level = "Unskilled", modifier = -4 }
|
local UNSKILLED_ENTRY = { name = "Inept", level = "Inept", modifier = -4 }
|
||||||
|
|
||||||
-- Default/fallback skill list used when no TRP3 profile skills are found
|
-- Default/fallback skill list used when no TRP3 profile skills are found
|
||||||
local DEFAULT_SKILLS = {
|
local DEFAULT_SKILLS = {
|
||||||
{ name = "Unskilled", level = "Unskilled", modifier = -4 },
|
{ name = "Inept", level = "Inept", modifier = -4 },
|
||||||
{ name = "Novice Skill", level = "Novice", modifier = -2 },
|
{ name = "Novice Skill", level = "Novice", modifier = -2 },
|
||||||
{ name = "Adept Skill", level = "Adept", modifier = 0 },
|
{ name = "Adept Skill", level = "Adept", modifier = 0 },
|
||||||
{ name = "Expert Skill", level = "Expert", modifier = 2 },
|
{ name = "Expert Skill", level = "Expert", modifier = 2 },
|
||||||
|
|
@ -56,12 +56,12 @@ local function ParseSkillLevel(numericValue)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Fetch skills from the current TRP3 profile's personality traits.
|
-- Fetch skills from the current TRP3 profile's personality traits.
|
||||||
-- Returns an array of skill entries, always starting with "Unskilled".
|
-- Returns an array of skill entries, always starting with "Inept".
|
||||||
-- Falls back to the default list if no profile or no valid skills are found.
|
-- Falls back to the default list if no profile or no valid skills are found.
|
||||||
function AltSystem.Data:RefreshSkills()
|
function AltSystem.Data:RefreshSkills()
|
||||||
local skills = {}
|
local skills = {}
|
||||||
|
|
||||||
-- Always add Unskilled as the first entry
|
-- Always add Inept as the first entry
|
||||||
table.insert(skills, { name = UNSKILLED_ENTRY.name, level = UNSKILLED_ENTRY.level, modifier = UNSKILLED_ENTRY.modifier })
|
table.insert(skills, { name = UNSKILLED_ENTRY.name, level = UNSKILLED_ENTRY.level, modifier = UNSKILLED_ENTRY.modifier })
|
||||||
|
|
||||||
local foundAny = false
|
local foundAny = false
|
||||||
|
|
@ -89,7 +89,7 @@ function AltSystem.Data:RefreshSkills()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- If no valid skills were found, use the default fallback list (skip first "Unskilled" since we already added it)
|
-- If no valid skills were found, use the default fallback list (skip first "Inept" since we already added it)
|
||||||
if not foundAny then
|
if not foundAny then
|
||||||
skills = {}
|
skills = {}
|
||||||
for _, skill in ipairs(DEFAULT_SKILLS) do
|
for _, skill in ipairs(DEFAULT_SKILLS) do
|
||||||
|
|
|
||||||
13
Roll.lua
13
Roll.lua
|
|
@ -31,6 +31,19 @@ end)
|
||||||
|
|
||||||
-- Calculate the final result based on the roll type and selected modifiers
|
-- Calculate the final result based on the roll type and selected modifiers
|
||||||
function AltSystem:CalculateAndDisplayResult(rollType, rollValue)
|
function AltSystem:CalculateAndDisplayResult(rollType, rollValue)
|
||||||
|
-- Critical rolls bypass normal calculation
|
||||||
|
if rollValue == 1 then
|
||||||
|
if AltSystem.ResultText then
|
||||||
|
AltSystem.ResultText:SetText("|cffff0000Critical Failure|r")
|
||||||
|
end
|
||||||
|
return
|
||||||
|
elseif rollValue == 20 then
|
||||||
|
if AltSystem.ResultText then
|
||||||
|
AltSystem.ResultText:SetText("|cff00ff00Critical Success|r")
|
||||||
|
end
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
local state = AltSystem.State
|
local state = AltSystem.State
|
||||||
local skill = AltSystem.Data.Skills[state.selectedSkillIndex]
|
local skill = AltSystem.Data.Skills[state.selectedSkillIndex]
|
||||||
local item = AltSystem.Data.Items[state.selectedItemIndex]
|
local item = AltSystem.Data.Items[state.selectedItemIndex]
|
||||||
|
|
|
||||||
4
UI.lua
4
UI.lua
|
|
@ -16,7 +16,7 @@ local function BuildSkillOptions()
|
||||||
for _, skill in ipairs(AltSystem.Data.Skills) do
|
for _, skill in ipairs(AltSystem.Data.Skills) do
|
||||||
local sign = skill.modifier >= 0 and "+" or ""
|
local sign = skill.modifier >= 0 and "+" or ""
|
||||||
local text
|
local text
|
||||||
if skill.level == "Unskilled" then
|
if skill.level == "Inept" then
|
||||||
text = skill.name .. " (" .. sign .. skill.modifier .. ")"
|
text = skill.name .. " (" .. sign .. skill.modifier .. ")"
|
||||||
else
|
else
|
||||||
text = skill.name .. " (" .. skill.level .. " " .. sign .. skill.modifier .. ")"
|
text = skill.name .. " (" .. skill.level .. " " .. sign .. skill.modifier .. ")"
|
||||||
|
|
@ -210,7 +210,7 @@ end
|
||||||
function AltSystem:RefreshSkillDropdown()
|
function AltSystem:RefreshSkillDropdown()
|
||||||
AltSystem.Data:RefreshSkills()
|
AltSystem.Data:RefreshSkills()
|
||||||
|
|
||||||
-- Reset selection to 1 (Unskilled) since the skill list may have changed
|
-- Reset selection to 1 (Inept) since the skill list may have changed
|
||||||
AltSystem.State.selectedSkillIndex = 1
|
AltSystem.State.selectedSkillIndex = 1
|
||||||
if AltSystem.SetSkillIndex then
|
if AltSystem.SetSkillIndex then
|
||||||
AltSystem.SetSkillIndex(1)
|
AltSystem.SetSkillIndex(1)
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,6 @@
|
||||||
- Expert: 11-19
|
- Expert: 11-19
|
||||||
- Master: 20
|
- Master: 20
|
||||||
- should a skill have a value of 0 or no value, it should be omitted from the list
|
- should a skill have a value of 0 or no value, it should be omitted from the list
|
||||||
- The list should have a default selected value of "Unskilled" which corresponds to a -4 modifier
|
- The list should have a default selected value of "Inept" which corresponds to a -4 modifier
|
||||||
- In case no skills are found in the profile, or no profile is selected, a default list should be displayed
|
- In case no skills are found in the profile, or no profile is selected, a default list should be displayed
|
||||||
- Unskilled, Novice Skill, Adept Skill, Expert Skill, Master Skill
|
- Inept, Novice Skill, Adept Skill, Expert Skill, Master Skill
|
||||||
Loading…
Add table
Add a link
Reference in a new issue