Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local config = {
- -- base vocationId
- [1] = {
- -- skillId
- [SKILL_FIST] = {
- -- [{skillLevel}] = skillRate
- [{10, 19}] = 10,
- [{20, 29}] = 5
- },
- [SKILL_CLUB] = {
- [{10, 19}] = 10,
- [{20, 29}] = 5
- },
- [SKILL_SWORD] = {
- [{10, 19}] = 10,
- [{20, 29}] = 5
- },
- [SKILL_AXE] = {
- [{10, 19}] = 10,
- [{20, 29}] = 5
- },
- [SKILL_DISTANCE] = {
- [{10, 19}] = 10,
- [{20, 29}] = 5
- },
- [SKILL_SHIELD] = {
- [{10, 19}] = 10,
- [{20, 29}] = 5
- },
- [SKILL_FISHING] = {
- [{10, 19}] = 10,
- [{20, 29}] = 5
- },
- [SKILL_MAGLEVEL] = {
- [{10, 19}] = 10,
- [{20, 29}] = 5
- }
- }
- }
- --[[
- function Vocation.getBase(self)
- local demotion = self:getDemotion()
- while demotion do
- local tmp = demotion:getDemotion()
- if not tmp then
- return demotion
- end
- demotion = tmp
- end
- return self
- end
- ]]
- local function getSkillRate(player, skillId)
- local targetVocation = config[player:getVocation():getBase():getId()]
- if targetVocation then
- local targetSkillStage = targetVocation[skillId]
- if targetSkillStage then
- local skillLevel = player:getSkillLevel(skillId)
- for level, rate in pairs(targetSkillStage) do
- if skillLevel >= level[1] and skillLevel <= level[2] then
- return rate
- end
- end
- end
- end
- return skillId == SKILL_MAGLEVEL and configManager.getNumber(configKeys.RATE_MAGIC) or configManager.getNumber(configKeys.RATE_SKILL)
- end
- function Player:onGainSkillTries(skill, tries)
- if not APPLY_SKILL_MULTIPLIER then
- return tries
- end
- return tries * getSkillRate(self, skill)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement