Skip to content

Commit

Permalink
feat: Add VIP status check and related actions
Browse files Browse the repository at this point in the history
  • Loading branch information
omarcopires committed Apr 17, 2024
1 parent 6b06484 commit bc21673
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 22 deletions.
20 changes: 0 additions & 20 deletions data-otservbr-global/scripts/creaturescripts/customs/vip.lua

This file was deleted.

22 changes: 20 additions & 2 deletions data/scripts/creaturescripts/player/login.lua
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ function playerLoginGlobal.onLogin(player)

-- Boosted
player:sendTextMessage(MESSAGE_BOOSTED_CREATURE, "Today's boosted creature: " .. Game.getBoostedCreature() .. " \
Boosted creatures yield more experience points, carry more loot than usual and respawn at a faster rate.")
Boosted creatures yield more experience points, carry more loot than usual and respawn at a faster rate.")
player:sendTextMessage(MESSAGE_BOOSTED_CREATURE, "Today's boosted boss: " .. Game.getBoostedBoss() .. " \
Boosted bosses contain more loot and count more kills for your Bosstiary.")
Boosted bosses contain more loot and count more kills for your Bosstiary.")

-- Rewards
local rewards = #player:getRewardList()
Expand Down Expand Up @@ -118,6 +118,24 @@ function playerLoginGlobal.onLogin(player)
player:setStaminaXpBoost(player:getFinalBonusStamina() * 100)
player:getFinalLowLevelBonus()

-- Updates the player's VIP status and executes corresponding actions if applicable.
if configManager.getBoolean(configKeys.VIP_SYSTEM_ENABLED) then
local isVipNow = player:isVip()
local wasVip = player:kv():scoped("account"):get("vip-system") or false

if wasVip ~= isVipNow then
if wasVip then
player:onRemoveVip()
else
player:onAddVip(player:getVipDays())
end
end

if isVipNow then
CheckPremiumAndPrint(player, MESSAGE_LOGIN)
end
end

-- Set Ghost Mode
if player:getGroup():getId() >= GROUP_TYPE_GAMEMASTER then
player:setGhostMode(true)
Expand Down

0 comments on commit bc21673

Please sign in to comment.