Skip to content

Commit

Permalink
Merge branch 'main' into fix/support-outfit-crashs
Browse files Browse the repository at this point in the history
  • Loading branch information
elsongabriel authored Jul 2, 2024
2 parents 87b5a52 + d3ddea0 commit 37dd41d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
10 changes: 10 additions & 0 deletions data/modules/scripts/gamestore/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -540,13 +540,23 @@ end

-- Both functions use same formula!
function parseOpenTransactionHistory(playerId, msg)
local player = Player(playerId)
if not player then
return
end

local page = 1
GameStore.DefaultValues.DEFAULT_VALUE_ENTRIES_PER_PAGE = msg:getByte()
sendStoreTransactionHistory(playerId, page, GameStore.DefaultValues.DEFAULT_VALUE_ENTRIES_PER_PAGE)
player:updateUIExhausted()
end

function parseRequestTransactionHistory(playerId, msg)
local player = Player(playerId)
if not player then
return
end

local page = msg:getU32()
sendStoreTransactionHistory(playerId, page + 1, GameStore.DefaultValues.DEFAULT_VALUE_ENTRIES_PER_PAGE)
player:updateUIExhausted()
Expand Down
15 changes: 10 additions & 5 deletions data/scripts/creaturescripts/player/offline_training.lua
Original file line number Diff line number Diff line change
Expand Up @@ -55,18 +55,23 @@ function offlineTraining.onLogin(player)
local vocation = player:getVocation()
local promotion = vocation:getPromotion()
local topVocation = not promotion and vocation or promotion
local updateSkills = false

local tries = nil
if table.contains({ SKILL_CLUB, SKILL_SWORD, SKILL_AXE, SKILL_DISTANCE }, offlineTrainingSkill) then
local modifier = topVocation:getBaseAttackSpeed() / 1000 / configManager.getFloat(configKeys.RATE_OFFLINE_TRAINING_SPEED)
updateSkills = player:addOfflineTrainingTries(offlineTrainingSkill, (trainingTime / modifier) / (offlineTrainingSkill == SKILL_DISTANCE and 4 or 2))
local modifier = topVocation:getBaseAttackSpeed() / 1000
tries = (trainingTime / modifier) / (offlineTrainingSkill == SKILL_DISTANCE and 4 or 2)
elseif offlineTrainingSkill == SKILL_MAGLEVEL then
local gainTicks = topVocation:getManaGainTicks() * 2
local gainTicks = topVocation:getManaGainTicks() / 1000
if gainTicks == 0 then
gainTicks = 1
end

updateSkills = player:addOfflineTrainingTries(SKILL_MAGLEVEL, trainingTime * (vocation:getManaGainAmount() / gainTicks))
tries = trainingTime * (vocation:getManaGainAmount() / gainTicks)
end

local updateSkills = false
if tries then
updateSkills = player:addOfflineTrainingTries(offlineTrainingSkill, tries * configManager.getFloat(configKeys.RATE_OFFLINE_TRAINING_SPEED))
end

if updateSkills then
Expand Down

0 comments on commit 37dd41d

Please sign in to comment.