mirror of
https://github.com/ErikasKontenis/SabrehavenServer.git
synced 2025-05-18 17:29:19 +02:00
finish training statue placeing and payment for offline training
This commit is contained in:
parent
33d9dd7dcd
commit
0666223787
@ -1 +1 @@
|
||||
next: 17723
|
||||
next: 17729
|
@ -239,7 +239,7 @@
|
||||
<action itemid="3031" script="misc/changegold.lua" />
|
||||
<action itemid="3035" script="misc/changegold.lua" />
|
||||
<action itemid="3043" script="misc/changegold.lua" />
|
||||
<action fromid="2032" toid="2032" script="misc/skill_trainer.lua" />
|
||||
<action fromaid="17724" toaid="17728" script="misc/skill_trainer.lua" />
|
||||
|
||||
<!-- Chests -->
|
||||
<action itemid="2479" script="misc/chests.lua" />
|
||||
|
@ -1,13 +1,13 @@
|
||||
local statues = {
|
||||
[2032] = SKILL_SWORD,
|
||||
[18489] = SKILL_AXE,
|
||||
[18490] = SKILL_CLUB,
|
||||
[18491] = SKILL_DISTANCE,
|
||||
[18492] = SKILL_MAGLEVEL
|
||||
[17725] = SKILL_SWORD,
|
||||
[17724] = SKILL_AXE,
|
||||
[17726] = SKILL_CLUB,
|
||||
[17727] = SKILL_DISTANCE,
|
||||
[17728] = SKILL_MAGLEVEL
|
||||
}
|
||||
|
||||
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
|
||||
local skill = statues[item:getId()]
|
||||
local skill = statues[item:getActionId()]
|
||||
if not player:isPremium() then
|
||||
player:sendCancelMessage(RETURNVALUE_YOUNEEDPREMIUMACCOUNT)
|
||||
return true
|
||||
@ -16,8 +16,15 @@ function onUse(player, item, fromPosition, target, toPosition, isHotkey)
|
||||
if player:isPzLocked() then
|
||||
return false
|
||||
end
|
||||
|
||||
|
||||
local entreePrice = 1000
|
||||
if player:getBankBalance() < entreePrice then
|
||||
player:sendCancelMessage("You do not have 1000 gold coins in your bank account balance to participate in offline training.")
|
||||
return true
|
||||
end
|
||||
|
||||
player:setOfflineTrainingSkill(skill)
|
||||
player:setBankBalance(player:getBankBalance() - entreePrice)
|
||||
player:remove()
|
||||
return true
|
||||
end
|
||||
|
@ -10,7 +10,8 @@ function onLogin(player)
|
||||
player:setOfflineTrainingSkill(-1)
|
||||
|
||||
if offlineTime < 600 then
|
||||
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You must be logged out for more than 10 minutes to start offline training.")
|
||||
player:setBankBalance(player:getBankBalance() + 1000)
|
||||
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You must be logged out for more than 10 minutes to start offline training. Your 1000 gold coins entree fee were returned to your bank account.")
|
||||
return true
|
||||
end
|
||||
|
||||
|
@ -1,5 +1,38 @@
|
||||
local trainingStatues = {17724, 17725, 17726, 17727, 17728}
|
||||
|
||||
function Player:onLook(thing, position, distance)
|
||||
local description = "You see " .. thing:getDescription(distance)
|
||||
|
||||
if thing:isItem() and thing:getId() == 2028 then
|
||||
if isInArray(trainingStatues, thing:getActionId()) then
|
||||
local trainingTime = math.min(43200, self:getOfflineTrainingTime() / 1000)
|
||||
local text = "You have"
|
||||
local hours = math.floor(trainingTime / 3600)
|
||||
if hours > 1 then
|
||||
text = string.format("%s %d hours", text, hours)
|
||||
elseif hours == 1 then
|
||||
text = string.format("%s 1 hour", text)
|
||||
end
|
||||
|
||||
local minutes = math.floor((trainingTime % 3600) / 60)
|
||||
if minutes ~= 0 then
|
||||
if hours ~= 0 then
|
||||
text = string.format("%s and", text)
|
||||
end
|
||||
|
||||
if minutes > 1 then
|
||||
text = string.format("%s %d minutes", text, minutes)
|
||||
else
|
||||
text = string.format("%s 1 minute", text)
|
||||
end
|
||||
end
|
||||
|
||||
text = string.format(" %s offline training time remaining.", text)
|
||||
|
||||
description = string.format(description .. "%s", text)
|
||||
end
|
||||
end
|
||||
|
||||
if self:getGroup():getAccess() then
|
||||
if thing:isItem() then
|
||||
description = string.format("%s\nItem ID: %d", description, thing:getId())
|
||||
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user