This cleaned and refactored version is brought to you by Lessaire.
Original idea: Gesior
This revision attempts to register the creatureEvents in the buffered login script at the bottom.
If for whatever reason that doesn't work, you need to just move them to your regular login.lua.
-------------------------------------------------------------------------------------------------
This mod lets you apply skill rates per skill, per vocation class,
and support for a rating multiplier for monks/offline training.
The only real caveat emptor here is that these rates are synergetic with the config.lua settings
That is, if you have skill rate x12 in global config,
and 12x in a skill stage, the effective rate the player gets is 144!
Remember this!
You may disable stage rating any skill just by commenting those lines out in CUSTOM_RATE_STAGES.
I expect most who want to use fishing skill stages will want to use the same ones for all vocs
so all you need to do is define them once in the "local SKILL_FISHING"
and uncomment the appropriate line in CUSTOM_RATE_STAGES
This uses the "isMage" type functions to determine what "vocation family" a character is.
-------------------------------------------------------------------------------------------------
getPlayerStorageValue(cid, config.monkStorage)
local function doRatings(class, training)
local classStages = CUSTOM_RATE_STAGES[class]
for skill, stages in pairs(classStages) do
local skillLevel = 0
if(skill >= 0 and skill <= 6) then
skillLevel = getPlayerSkillLevel(cid, skill)
else
-- if out of range, presume magic
skillLevel = getPlayerMagLevel(cid, true)
end
local skillRate = 1
-- gotta check cuz some are empty in the defaults like fishing
if(classStages[skill] ~= nil) then
for i, skillStage in pairs(stages) do
if(skillLevel >= skillStage[1]) then
skillRate = skillStage[2]
else
break
end
end
skillRate = skillRate * (training and config.monkRating or 1)
doPlayerSetRate(cid, skill, skillRate)
end
end
return getPlayerRates(cid)
end
if (type(evented) == "string") then
doPlayerSendTextMessage(cid, config.loginColor, evented)
end
return oldRates, doRatings(getClass(cid), training)
end
]]>
= 0 and skill <= 6) then
configRate = SERVER_RATE_SR
else
configRate = SERVER_RATE_ML
end
local message = string.format("%s rate changed from %sx to %sx.",
SKILL_NAMES[skill], oldRates[skill] * configRate, newRates[skill] * configRate)
doPlayerSendTextMessage(cid, config.advanceColor, message)
doPlayerSendTextMessage(cid, config.advanceColor, getPlayerSkillRatesText(cid))
end
return true
end
]]>