Skip to content
Merged
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
35 changes: 19 additions & 16 deletions data/scripts/movements/special_tiles.lua
Original file line number Diff line number Diff line change
@@ -1,22 +1,29 @@
local increasing = { [419] = 420, [431] = 430, [452] = 453, [563] = 564, [549] = 562, [10145] = 10146 }
local decreasing = { [420] = 419, [430] = 431, [453] = 452, [564] = 563, [562] = 549, [10146] = 10145 }

function Player:checkAndSendDepotMessage()
local function checkAndSendDepotMessage(player)
for _, direction in ipairs(DIRECTIONS_TABLE) do
local playerPosition = self:getPosition()
local playerPosition = player:getPosition()
playerPosition:getNextPosition(direction)
local depotItem = playerPosition:getTile():getItemByType(ITEM_TYPE_DEPOT)
if depotItem ~= nil or self:getGroup():getAccess() then
local depotItems = 0
for id = 1, configManager.getNumber(configKeys.DEPOT_BOXES) do
depotItems = depotItems + self:getDepotChest(id, true):getItemHoldingCount()

local tile = playerPosition:getTile()
if tile then
local depotItem = tile:getItemByType(ITEM_TYPE_DEPOT)
if depotItem then
local depotItems = 0
for id = 1, configManager.getNumber(configKeys.DEPOT_BOXES) do
depotItems = depotItems + player:getDepotChest(id, true):getItemHoldingCount()
end

local depotMessage = string.format("Your depot contains %d item%s", depotItems, depotItems ~= 1 and "s." or ".")
local stashMessage = string.format("Your supply stash contains %d item%s", player:getStashCount(), player:getStashCount() ~= 1 and "s." or ".")

player:sendTextMessage(MESSAGE_STATUS, string.format("%s %s", depotMessage, stashMessage))
player:setSpecialContainersAvailable(true, true, true)
end
self:sendTextMessage(MESSAGE_STATUS, string.format("Your depot contains %d item%s Your supply stash contains %d item%s", depotItems, depotItems > 1 and "s." or ".", self:getStashCount(), self:getStashCount() > 1 and "s." or "."))
self:setSpecialContainersAvailable(true, true, true)
return true
end
end
return false
return true
end

local tile = MoveEvent()
Expand All @@ -27,10 +34,6 @@ function tile.onStepIn(creature, item, position, fromPosition)
return true
end

if player:isInGhostMode() then
return player:checkAndSendDepotMessage()
end

if not increasing[item.itemid] then
return true
end
Expand All @@ -47,7 +50,7 @@ function tile.onStepIn(creature, item, position, fromPosition)
end

if Tile(position):hasFlag(TILESTATE_PROTECTIONZONE) then
return player:checkAndSendDepotMessage()
return checkAndSendDepotMessage(player)
end

if item.actionid ~= 0 and player:getStorageValue(item.actionid) <= 0 then
Expand Down