Skip to content

Commit

Permalink
Update player.lua
Browse files Browse the repository at this point in the history
  • Loading branch information
luanluciano93 committed Apr 29, 2024
1 parent e08a7bf commit 2701281
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions data/events/scripts/player.lua
Original file line number Diff line number Diff line change
Expand Up @@ -111,22 +111,31 @@ local function useStamina(player, isStaminaEnabled)
return false
end

local xpBoostLeftMinutesByDailyReward = self:kv():get("daily-reward-xp-boost") or 0

Check warning on line 114 in data/events/scripts/player.lua

View workflow job for this annotation

GitHub Actions / luacheck

[luacheck] reported by reviewdog 🐶 unused variable 'xpBoostLeftMinutesByDailyReward' Raw Output: data/events/scripts/player.lua:114:8: unused variable 'xpBoostLeftMinutesByDailyReward'
local currentTime = os.time()
local timePassed = currentTime - _G.NextUseStaminaTime[playerId]
if timePassed <= 0 then
return
end

local xpBoostLeftMinutesByDailyReward = player:kv():get("daily-reward-xp-boost") or 0

Check warning on line 121 in data/events/scripts/player.lua

View workflow job for this annotation

GitHub Actions / luacheck

[luacheck] reported by reviewdog 🐶 variable 'xpBoostLeftMinutesByDailyReward' was previously defined on line 114 Raw Output: data/events/scripts/player.lua:121:8: variable 'xpBoostLeftMinutesByDailyReward' was previously defined on line 114
if timePassed > 60 then
if staminaMinutes > 2 then
staminaMinutes = staminaMinutes - 2
if xpBoostLeftMinutesByDailyReward > 2 then
player:kv():set("daily-reward-xp-boost", xpBoostLeftMinutesByDailyReward - 2)
end
else
staminaMinutes = 0
player:kv():remove("daily-reward-xp-boost")
end
_G.NextUseStaminaTime[playerId] = currentTime + 120
player:removePreyStamina(120)
else
staminaMinutes = staminaMinutes - 1
if xpBoostLeftMinutesByDailyReward > 0 then
player:kv():set("daily-reward-xp-boost", xpBoostLeftMinutesByDailyReward - 1)
end
_G.NextUseStaminaTime[playerId] = currentTime + 60
player:removePreyStamina(60)
end
Expand Down

0 comments on commit 2701281

Please sign in to comment.