Advertisement
Guest User

Untitled

a guest
May 28th, 2015
857
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.58 KB | None | 0 0
  1. local config = {
  2.     -- base vocationId
  3.     [1] = {
  4.         -- skillId
  5.         [SKILL_FIST] = {
  6.             -- [{skillLevel}] = skillRate
  7.             [{10, 19}] = 10,
  8.             [{20, 29}] = 5
  9.         },
  10.         [SKILL_CLUB] = {
  11.             [{10, 19}] = 10,
  12.             [{20, 29}] = 5
  13.         },
  14.         [SKILL_SWORD] = {
  15.             [{10, 19}] = 10,
  16.             [{20, 29}] = 5
  17.         },
  18.         [SKILL_AXE] = {
  19.             [{10, 19}] = 10,
  20.             [{20, 29}] = 5
  21.         },
  22.         [SKILL_DISTANCE] = {
  23.             [{10, 19}] = 10,
  24.             [{20, 29}] = 5
  25.         },
  26.         [SKILL_SHIELD] = {
  27.             [{10, 19}] = 10,
  28.             [{20, 29}] = 5
  29.         },
  30.         [SKILL_FISHING] = {
  31.             [{10, 19}] = 10,
  32.             [{20, 29}] = 5
  33.         },
  34.         [SKILL_MAGLEVEL] = {
  35.             [{10, 19}] = 10,
  36.             [{20, 29}] = 5
  37.         }
  38.     }
  39. }
  40.  
  41. --[[
  42. function Vocation.getBase(self)
  43.     local demotion = self:getDemotion()
  44.     while demotion do
  45.         local tmp = demotion:getDemotion()
  46.         if not tmp then
  47.             return demotion
  48.         end
  49.         demotion = tmp
  50.     end
  51.     return self
  52. end
  53. ]]
  54.  
  55. local function getSkillRate(player, skillId)
  56.     local targetVocation = config[player:getVocation():getBase():getId()]
  57.     if targetVocation then
  58.         local targetSkillStage = targetVocation[skillId]
  59.         if targetSkillStage then
  60.             local skillLevel = player:getSkillLevel(skillId)
  61.             for level, rate in pairs(targetSkillStage) do
  62.                 if skillLevel >= level[1] and skillLevel <= level[2] then
  63.                     return rate
  64.                 end
  65.             end
  66.         end
  67.     end
  68.  
  69.     return skillId == SKILL_MAGLEVEL and configManager.getNumber(configKeys.RATE_MAGIC) or configManager.getNumber(configKeys.RATE_SKILL)
  70. end
  71.  
  72. function Player:onGainSkillTries(skill, tries)
  73.     if not APPLY_SKILL_MULTIPLIER then
  74.         return tries
  75.     end
  76.  
  77.     return tries * getSkillRate(self, skill)
  78. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement