Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: show vip xp bonus on exp rate at skills #1496

Merged
merged 4 commits into from
Aug 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion data-canary/scripts/creaturescripts/login.lua
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,16 @@ function login.onLogin(player)
-- Set Client XP Gain Rate --
if configManager.getBoolean(configKeys.XP_DISPLAY_MODE) then
local baseRate = player:getFinalBaseRateExperience()
player:setBaseXpGain(baseRate * 100)
baseRate = baseRate * 100
if configManager.getBoolean(configKeys.VIP_SYSTEM_ENABLED) then
local vipBonusExp = configManager.getNumber(configKeys.VIP_BONUS_EXP)
if vipBonusExp > 0 and player:isVip() then
vipBonusExp = (vipBonusExp > 100 and 100) or vipBonusExp
baseRate = baseRate * (1 + (vipBonusExp / 100))
player:sendTextMessage(MESSAGE_BOOSTED_CREATURE, "Normal base xp is: " .. baseRate .. "%, because you are VIP, bonus of " ..vipBonusExp .."%")
end
end
player:setBaseXpGain(baseRate)
end

local staminaBonus = player:getFinalBonusStamina()
Expand Down
11 changes: 10 additions & 1 deletion data-otservbr-global/scripts/creaturescripts/others/login.lua
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,16 @@ function playerLogin.onLogin(player)
-- Set Client XP Gain Rate --
if configManager.getBoolean(configKeys.XP_DISPLAY_MODE) then
local baseRate = player:getFinalBaseRateExperience()
player:setBaseXpGain(baseRate * 100)
baseRate = baseRate * 100
if configManager.getBoolean(configKeys.VIP_SYSTEM_ENABLED) then
local vipBonusExp = configManager.getNumber(configKeys.VIP_BONUS_EXP)
if vipBonusExp > 0 and player:isVip() then
vipBonusExp = (vipBonusExp > 100 and 100) or vipBonusExp
baseRate = baseRate * (1 + (vipBonusExp / 100))
player:sendTextMessage(MESSAGE_BOOSTED_CREATURE, "Normal base xp is: " .. baseRate .. "%, because you are VIP, bonus of " ..vipBonusExp .."%")
end
end
player:setBaseXpGain(baseRate)
end

local staminaBonus = player:getFinalBonusStamina()
Expand Down