-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclass_info.lua
71 lines (53 loc) · 1.55 KB
/
class_info.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
local base_path = 'custom/steady_leveling/'
local config = require(base_path .. 'config')
local DEFAULT_CLASSES = config.DEFAULT_CLASSES
local SKILL_ID_SKILL_NAME_MAP = config.SKILL_ID_SKILL_NAME_MAP
M = {}
local function get_default_class(class_id)
return DEFAULT_CLASSES[class_id]
end
local function generate_custom_class(pid)
local player_class = Players[pid].data.customClass
local data = {}
data.name = player_class.name
data.description = player_class.description
local major = {}
local minor = {}
for _, index in ipairs({ 0, 1, 2, 3, 4 }) do
table.insert(major, tes3mp.GetClassMajorSkill(pid, index))
end
for _, index in ipairs({ 0, 1, 2, 3, 4 }) do
table.insert(minor, tes3mp.GetClassMinorSkill(pid, index))
end
data.majorSkills = major
data.minorSkills = minor
return data
end
function M.get_player_class(pid)
if tes3mp.IsClassDefault(pid) == 1 then
return get_default_class(Players[pid].data.character.class)
else
return generate_custom_class(pid)
end
end
function M.is_skill_major(pid, skill)
local player_class = M.get_player_class(pid)
local found = false
for _, player_skill in ipairs(player_class.majorSkills) do
if SKILL_ID_SKILL_NAME_MAP[player_skill] == skill then
found = true
end
end
return found
end
function M.is_skill_minor(pid, skill)
local player_class = M.get_player_class(pid)
local found = false
for _, player_skill in ipairs(player_class.minorSkills) do
if SKILL_ID_SKILL_NAME_MAP[player_skill] == skill then
found = true
end
end
return found
end
return M