WIP - skills module

This commit is contained in:
MrNewb committed 2025-04-28 09:17:43 -04:00
1 parent 9881292602
commit a17eb15217
11 files changed
+179 -1

No files matched your search

+15
View File
@@ -0,0 +1,15 @@
Skills = Skills or {}
local resourceName = "OT_skills"
local configValue = BridgeSharedConfig.Skills
if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end
---@diagnostic disable-next-line: duplicate-set-field
Skills.GetResourceName = function()
return resourceName
end
---@diagnostic disable-next-line: duplicate-set-field
Skills.GetSkillLevel = function(skillName)
local skillData = exports.OT_skills:getSkill(skillName)
return skillData.level or 0
end
+29
View File
@@ -0,0 +1,29 @@
Skills = Skills or {}
local resourceName = "OT_skills"
local configValue = BridgeSharedConfig.Skills
if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end
---@diagnostic disable-next-line: duplicate-set-field
Skills.GetResourceName = function()
return resourceName
end
---@diagnostic disable-next-line: duplicate-set-field
Skills.GetSkillLevel = function(src, skillName)
local skillData = exports.OT_skills:getSkill(src, skillName)
return skillData.level or 0
end
Skills.AddXp = function(src, skillName, amount)
local skillData = exports.OT_skills:getSkill(src, skillName)
if not skillData then return false, print("Skill not found") end
exports.OT_skills:addXP(src, skillName, amount)
return true
end
Skills.RemoveXp = function(src, skillName, amount)
local skillData = exports.OT_skills:getSkill(src, skillName)
if not skillData then return false, print("Skill not found") end
exports.OT_skills:removeXP(src, skillName, amount)
return true
end
+15
View File
@@ -0,0 +1,15 @@
Skills = Skills or {}
local function warnUser()
print("Currently only a few skill systems are supported by Community Bridge, you are using a resource that requires the skills module to be used.")
end
---@diagnostic disable-next-line: duplicate-set-field
Skills.GetResourceName = function()
return "none"
end
---@diagnostic disable-next-line: duplicate-set-field
Skills.GetSkillLevel = function(skillName)
return 0, warnUser()
end
+25
View File
@@ -0,0 +1,25 @@
Skills = Skills or {}
local function warnUser()
print("Currently only a few skill systems are supported by Community Bridge, you are using a resource that requires the skills module to be used.")
end
---@diagnostic disable-next-line: duplicate-set-field
Skills.GetResourceName = function()
return "none"
end
---@diagnostic disable-next-line: duplicate-set-field
Skills.GetSkillLevel = function(src, skillName)
return 0, warnUser()
end
---@diagnostic disable-next-line: duplicate-set-field
Skills.AddXp = function(src, skillName, amount)
return false, warnUser()
end
---@diagnostic disable-next-line: duplicate-set-field
Skills.RemoveXp = function(src, skillName, amount)
return false, warnUser()
end
+15
View File
@@ -0,0 +1,15 @@
Skills = Skills or {}
local resourceName = "evolent_skills"
local configValue = BridgeSharedConfig.Skills
if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end
---@diagnostic disable-next-line: duplicate-set-field
Skills.GetResourceName = function()
return resourceName
end
---@diagnostic disable-next-line: duplicate-set-field
Skills.GetSkillLevel = function(skillName)
local skillData = exports.evolent_skills:getSkillLevel(skillName)
return skillData or 0
end
+31
View File
@@ -0,0 +1,31 @@
Skills = Skills or {}
local resourceName = "evolent_skills"
local configValue = BridgeSharedConfig.Skills
if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end
---@diagnostic disable-next-line: duplicate-set-field
Skills.GetResourceName = function()
return resourceName
end
---@diagnostic disable-next-line: duplicate-set-field
Skills.GetSkillLevel = function(src, skillName)
local skillData = exports.evolent_skills:getSkillLevel(src, skillName)
return skillData or 0
end
---@diagnostic disable-next-line: duplicate-set-field
Skills.AddXp = function(src, skillName, amount)
local skillData = exports.evolent_skills:getSkillLevel(src, skillName)
if not skillData then return false, print("Skill not found") end
exports.evolent_skills:addXp(src, skillName, amount)
return true
end
---@diagnostic disable-next-line: duplicate-set-field
Skills.RemoveXp = function(src, skillName, amount)
local skillData = exports.evolent_skills:getSkillLevel(src, skillName)
if not skillData then return false, print("Skill not found") end
exports.evolent_skills:removeXp(src, skillName, amount)
return true
end
+15
View File
@@ -0,0 +1,15 @@
Skills = Skills or {}
local resourceName = "pickle_xp"
local configValue = BridgeSharedConfig.Skills
if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end
---@diagnostic disable-next-line: duplicate-set-field
Skills.GetResourceName = function()
return resourceName
end
---@diagnostic disable-next-line: duplicate-set-field
Skills.GetSkillLevel = function(skillName)
local skillData = exports.OT_skills:GetLevel(skillName)
return skillData or 0
end
+29
View File
@@ -0,0 +1,29 @@
Skills = Skills or {}
local resourceName = "pickle_xp"
local configValue = BridgeSharedConfig.Skills
if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end
---@diagnostic disable-next-line: duplicate-set-field
Skills.GetResourceName = function()
return resourceName
end
---@diagnostic disable-next-line: duplicate-set-field
Skills.GetSkillLevel = function(src, skillName)
local skillData = exports.pickle_xp:GetPlayerLevel(src, skillName)
return skillData or 0
end
Skills.AddXp = function(src, skillName, amount)
local skillData = exports.pickle_xp:GetPlayerLevel(src, skillName)
if not skillData then return false, print("Skill not found") end
exports.pickle_xp:AddPlayerXP(src, skillName, amount)
return true
end
Skills.RemoveXp = function(src, skillName, amount)
local skillData = exports.pickle_xp:GetPlayerLevel(src, skillName)
if not skillData then return false, print("Skill not found") end
exports.pickle_xp:RemovePlayerXP(src, skillName, amount)
return true
end