mirror of
https://github.com/ErikasKontenis/SabrehavenServer.git
synced 2025-06-15 21:24:28 +02:00
introduce global rate boost talkaction
This commit is contained in:
parent
f22ca79046
commit
3ae18f0c5f
@ -1 +1 @@
|
||||
next: 17585
|
||||
next: 17593
|
@ -191,6 +191,10 @@ function Player:onGainExperience(source, exp, rawExp)
|
||||
end
|
||||
end
|
||||
|
||||
if getGlobalStorageValue(17589) > os.time() then
|
||||
exp = exp * (1 + getGlobalStorageValue(17585) / 100)
|
||||
end
|
||||
|
||||
return exp
|
||||
end
|
||||
|
||||
@ -204,7 +208,20 @@ function Player:onGainSkillTries(skill, tries)
|
||||
end
|
||||
|
||||
if skill == SKILL_MAGLEVEL then
|
||||
return tries * configManager.getNumber(configKeys.RATE_MAGIC)
|
||||
tries = tries * configManager.getNumber(configKeys.RATE_MAGIC)
|
||||
|
||||
if getGlobalStorageValue(17591) > os.time() then
|
||||
tries = tries * (1 + getGlobalStorageValue(17587) / 100)
|
||||
end
|
||||
|
||||
return tries
|
||||
end
|
||||
return tries * configManager.getNumber(configKeys.RATE_SKILL)
|
||||
|
||||
tries = tries * configManager.getNumber(configKeys.RATE_SKILL)
|
||||
|
||||
if getGlobalStorageValue(17590) > os.time() then
|
||||
tries = tries * (1 + getGlobalStorageValue(17586) / 100)
|
||||
end
|
||||
|
||||
return tries
|
||||
end
|
||||
|
@ -207,6 +207,8 @@
|
||||
<vocation name="Druid" />
|
||||
<vocation name="Master Sorcerer" />
|
||||
<vocation name="Elder Druid" />
|
||||
<vocation name="Paladin" />
|
||||
<vocation name="Royal Paladin" />
|
||||
</instant>
|
||||
|
||||
<!-- Attack Rune Spells -->
|
||||
|
48
data/talkactions/scripts/global_rate_boost.lua
Normal file
48
data/talkactions/scripts/global_rate_boost.lua
Normal file
@ -0,0 +1,48 @@
|
||||
local config = {
|
||||
['exp'] = {skillKey = 17585, timeKey = 17589},
|
||||
['skill'] = {skillKey = 17586, timeKey = 17590},
|
||||
['magic'] = {skillKey = 17587, timeKey = 17591},
|
||||
['loot'] = {skillKey = 17588, timeKey = 17592} -- TODO
|
||||
}
|
||||
|
||||
function onSay(player, words, param)
|
||||
if not player:getGroup():getAccess() then
|
||||
return true
|
||||
end
|
||||
|
||||
if player:getAccountType() < ACCOUNT_TYPE_GOD then
|
||||
return false
|
||||
end
|
||||
|
||||
local split = param:split(",")
|
||||
if split[3] == nil then
|
||||
player:sendCancelMessage("Insufficient parameters [(exp,skill,loot,magic),percentage,hours].")
|
||||
return false
|
||||
end
|
||||
|
||||
local skillName = split[1]
|
||||
local percentage = tonumber(split[2])
|
||||
local hours = tonumber(split[3])
|
||||
|
||||
local globalStorage = config[skillName]
|
||||
if not globalStorage then
|
||||
player:sendCancelMessage("Skill name value must be one of the following: exp, skill, loot, magic.")
|
||||
return false
|
||||
end
|
||||
|
||||
if percentage <= 0 then
|
||||
player:sendCancelMessage("Percentage value must be higher than 0. For example, 50% means 1.5x higher rate.")
|
||||
return false
|
||||
end
|
||||
|
||||
if hours <= 0 then
|
||||
player:sendCancelMessage("Hours value must be higher than 0.")
|
||||
return false
|
||||
end
|
||||
|
||||
setGlobalStorageValue(globalStorage.skillKey, percentage)
|
||||
setGlobalStorageValue(globalStorage.timeKey, os.time() + hours * 60 * 60)
|
||||
broadcastMessage(player:getName() .. " have activated the global " .. percentage .. "% " .. skillName .. " rate boost for next " .. hours .. " " .. (hours == 1 and "hour" or "hours") .. ".", MESSAGE_STATUS_WARNING)
|
||||
|
||||
return false
|
||||
end
|
@ -28,9 +28,9 @@
|
||||
<talkaction words="/removetutor" separator=" " script="remove_tutor.lua" />
|
||||
<talkaction words="/looktype" separator=" " script="looktype.lua" />
|
||||
<talkaction words="/summon" separator=" " script="place_summon.lua" />
|
||||
<talkaction words="/reload" separator=" " script="reload.lua" />
|
||||
<talkaction words="/save" script="save.lua" />
|
||||
<talkaction words="/chameleon" separator=" " script="chameleon.lua" />
|
||||
<talkaction words="/reload" separator=" " script="reload.lua" />
|
||||
<talkaction words="/save" script="save.lua" />
|
||||
<talkaction words="/chameleon" separator=" " script="chameleon.lua" />
|
||||
<talkaction words="/addskill" separator=" " script="add_skill.lua" />
|
||||
<talkaction words="/mccheck" script="mccheck.lua" />
|
||||
<talkaction words="/ghost" script="ghost.lua" />
|
||||
@ -38,11 +38,12 @@
|
||||
<talkaction words="/storagevalue" separator=" " script="storagevalue.lua" />
|
||||
<talkaction words="/minimap" separator=" " script="minimap_scan.lua" />
|
||||
<talkaction words="/removehouse" separator=" " script="remove_house.lua" />
|
||||
<talkaction words="/globalboost" separator=" " script="global_rate_boost.lua" />
|
||||
|
||||
<!-- player talkactions -->
|
||||
<talkaction words="!buypremium" script="buyprem.lua"/>
|
||||
<talkaction words="!buyhouse" script="buyhouse.lua"/>
|
||||
<talkaction words="!sellhouse" separator=" " script="sellhouse.lua" />
|
||||
<talkaction words="!sellhouse" separator=" " script="sellhouse.lua" />
|
||||
<talkaction words="!leavehouse" script="leavehouse.lua"/>
|
||||
<talkaction words="!changesex" script="changesex.lua"/>
|
||||
<talkaction words="!uptime" script="uptime.lua"/>
|
||||
|
Loading…
x
Reference in New Issue
Block a user