1local increasing = {[416] = 417, [426] = 425, [446] = 447, [3216] = 3217, [3202] = 3215, [11062] = 11063}
2local decreasing = {[417] = 416, [425] = 426, [447] = 446, [3217] = 3216, [3215] = 3202, [11063] = 11062}
3
4function onStepIn(creature, item, position, fromPosition)
5 if not increasing[item.itemid] then
6 return true
7 end
8
9 if not creature:isPlayer() or creature:isInGhostMode() then
10 return true
11 end
12
13 item:transform(increasing[item.itemid])
14 if _NEW_RULES_ONLINE then
15 if item.itemid == 11062 or item.itemid == 11063 then
16 creature:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Personagens em treino ganham 1x Online Coins a cada 3 horas.")
17 end
18 end
19
20 if item.actionid >= actionIds.levelDoor then
21 if creature:getLevel() < item.actionid - actionIds.levelDoor then
22 creature:teleportTo(fromPosition, false)
23 position:sendMagicEffect(CONST_ME_MAGIC_BLUE)
24 creature:sendTextMessage(MESSAGE_EVENT_ADVANCE, "The tile seems to be protected against unwanted intruders.")
25 end
26 return true
27 end
28
29 if Tile(position):hasFlag(TILESTATE_PROTECTIONZONE) then
30 local lookPosition = creature:getPosition()
31 lookPosition:getNextPosition(creature:getDirection())
32 local depotItem = Tile(lookPosition):getItemByType(ITEM_TYPE_DEPOT)
33 if depotItem then
34 local depotItems = creature:getDepotChest(getDepotId(depotItem:getUniqueId()), true):getItemHoldingCount()
35 creature:sendTextMessage(MESSAGE_STATUS_DEFAULT, "Your depot contains " .. depotItems .. " item" .. (depotItems > 1 and "s." or "."))
36 creature:addAchievementProgress("Safely Stored Away", 1000)
37 return true
38 end
39 end
40
41 if item.actionid ~= 0 and creature:getStorageValue(item.actionid) <= 0 then
42 creature:teleportTo(fromPosition, false)
43 position:sendMagicEffect(CONST_ME_MAGIC_BLUE)
44 creature:sendTextMessage(MESSAGE_EVENT_ADVANCE, "The tile seems to be protected against unwanted intruders.")
45 return true
46 end
47 return true
48end
49
50function onStepOut(creature, item, position, fromPosition)
51 if not decreasing[item.itemid] then
52 return true
53 end
54
55 if creature:isPlayer() and creature:isInGhostMode() then
56 return true
57 end
58
59 item:transform(decreasing[item.itemid])
60 return true
61end
62