First commit

This commit is contained in:
2025-02-26 13:42:34 +01:00
commit f465c9072c
2467 changed files with 426214 additions and 0 deletions

View File

@@ -0,0 +1,11 @@
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
local portal = Tile(Position(32816, 32345, 13)):getItemById(1949)
if not portal then
local item = Game.createItem(1949, 1, Position(32816, 32345, 13))
item:setMovementId(17686)
else
portal:remove()
end
item:transform(item.itemid == 2772 and 2773 or 2772)
return true
end

View File

@@ -0,0 +1,30 @@
local config = {
[39511] = {
fromPosition = Position(32739, 32392, 14),
toPosition = Position(32739, 32391, 14)
},
[39512] = {
teleportPlayer = true,
fromPosition = Position(32739, 32391, 14),
toPosition = Position(32739, 32392, 14)
}
}
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
local useItem = config[item:getActionId()]
if not useItem then
return true
end
if useItem.teleportPlayer then
player:teleportTo(Position(32712, 32392, 13))
player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
player:say('Beauty has to be rewarded! Muahahaha!', TALKTYPE_MONSTER_SAY)
end
local tapestry = Tile(useItem.fromPosition):getItemById(6433)
if tapestry then
tapestry:moveTo(useItem.toPosition)
end
return true
end

View File

@@ -0,0 +1,8 @@
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
if item.itemid == 2772 then
player:teleportTo(Position(32806, 32328, 15))
player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
item:transform(2773)
end
return true
end

View File

@@ -0,0 +1,20 @@
local lava = {
Position(32912, 32209, 15),
Position(32913, 32209, 15),
Position(32912, 32210, 15),
Position(32913, 32210, 15)
}
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
local lavaTile
for i = 1, #lava do
lavaTile = Tile(lava[i]):getGround()
if lavaTile and isInArray({410, 727}, lavaTile.itemid) then
lavaTile:transform(lavaTile.itemid == 727 and 410 or 727)
lava[i]:sendMagicEffect(CONST_ME_POFF)
end
end
item:transform(item.itemid == 2772 and 2773 or 2772)
return true
end

View File

@@ -0,0 +1,37 @@
local config = {
[17653] = { doorPosition = {x = 32833, y = 32333, z = 11}, vocationIds = {4, 8} },
[17656] = { doorPosition = {x = 32835, y = 32333, z = 11}, vocationIds = {1, 5} },
[17655] = { doorPosition = {x = 32831, y = 32333, z = 11}, vocationIds = {3, 7} },
[17654] = { doorPosition = {x = 32837, y = 32333, z = 11}, vocationIds = {2, 6} }
}
local function doTransformDoors(position)
local tile = Tile(Position(position))
if tile then
local lockedDoor = tile:getItemById(1628)
local closedDoor = tile:getItemById(1629)
local openDoor = tile:getItemById(1630)
if lockedDoor then
lockedDoor:transform(1629, 1)
lockedDoor:decay()
elseif closedDoor then
closedDoor:transform(1628, 1)
closedDoor:decay()
elseif openDoor then
openDoor:transform(1628, 1)
openDoor:decay()
end
end
end
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
local configValue = config[item:getActionId()];
if isInArray(configValue.vocationIds, player:getVocation():getId()) then
doTransformDoors(configValue.doorPosition)
Position(configValue.doorPosition):sendMagicEffect(CONST_ME_FIREAREA)
item:transform(item.itemid == 2772 and 2773 or 2772)
return true
end
return false
end

View File

@@ -0,0 +1,30 @@
local pos = { Position(32861, 32305, 11), Position(32860, 32313, 11) }
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
if item:getId() ~= 2772 then
return false
end
item:transform(2773)
if item:getActionId() == 3301 then
local lava = Tile(pos[1]):getItemById(727)
if lava then
lava:transform(1771)
end
local dirtId, dirtItem = { 4797, 4799 }
for i = 1, #dirtId do
dirtItem = Tile(pos[1]):getItemById(dirtId[i])
if dirtItem then
dirtItem:remove()
end
end
elseif item:getActionId() == 3302 then
local item = Tile(pos[2]):getItemById(389)
if item then
item:remove()
end
end
return true
end

View File

@@ -0,0 +1,62 @@
local text = {
[1] = 'first', [2] = 'second', [3] = 'third', [4] = 'fourth', [5] = 'fifth',
[6] = 'sixth', [7] = 'seventh', [8] = 'eighth', [9] = 'ninth', [10] = 'tenth',
[11] = 'eleventh', [12] = 'twelfth', [13] = 'thirteenth', [14] = 'fourteenth', [15] = 'fifteenth'
}
local stonePositions = {
Position(32851, 32333, 12),
Position(32852, 32333, 12)
}
local function createStones()
for i = 1, #stonePositions do
Game.createItem(1791, 1, stonePositions[i])
end
setGlobalStorageValue(17657, 0)
end
local function revertLever(position)
local leverItem = Tile(position):getItemById(2773)
if leverItem then
leverItem:transform(2772)
end
end
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
if item:getId() ~= 2772 then
return false
end
local leverCount = math.max(0, getGlobalStorageValue(17657))
if item:getActionId() > 2049 and item:getActionId() < 2065 then
local number = item:getActionId() - 2049
if leverCount + 1 ~= number then
return false
end
setGlobalStorageValue(17657, number)
player:say('You flipped the ' .. text[number] .. ' lever. Hurry up and find the next one!', TALKTYPE_MONSTER_SAY, false, player, toPosition)
elseif item:getActionId() == 2065 then
if leverCount ~= 15 then
player:say('The final lever won\'t budge... yet.', TALKTYPE_MONSTER_SAY)
return true
end
local stone
for i = 1, #stonePositions do
stone = Tile(stonePositions[i]):getItemById(1791)
if stone then
stone:remove()
stonePositions[i]:sendMagicEffect(CONST_ME_EXPLOSIONAREA)
end
end
addEvent(createStones, 15 * 60 * 1000)
end
item:transform(2773)
addEvent(revertLever, 15 * 60 * 1000, toPosition)
return true
end

View File

@@ -0,0 +1,16 @@
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
if item.itemid == 2773 then
return false
end
toPosition.x = toPosition.x - 1
toPosition.y = toPosition.y + 1
local stone = Tile(toPosition):getItemById(1791)
if stone then
stone:remove()
end
item:transform(2773)
return true
end

View File

@@ -0,0 +1,33 @@
local bridgePosition = Position(32801, 32336, 11)
local function revertBridge()
Tile(bridgePosition):getItemById(409):transform(622)
end
local function revertLever(position)
local leverItem = Tile(position):getItemById(2773)
if leverItem then
leverItem:transform(2772)
end
end
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
if item.itemid ~= 2772 then
return false
end
if not Tile(Position(32795, 32337, 11)):getItemById(2886, FLUID_OIL) then
player:say('The lever is creaking and rusty.', TALKTYPE_MONSTER_SAY)
return true
end
local water = Tile(bridgePosition):getItemById(622)
if water then
water:transform(409)
addEvent(revertBridge, 10 * 60 * 1000)
end
item:transform(2773)
addEvent(revertLever, 10 * 60 * 1000, toPosition)
return true
end

View File

@@ -0,0 +1,12 @@
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
if item.itemid == 2772 then
local stonePosition = Position(32849, 32282, 10)
local stoneItem = Tile(stonePosition):getItemById(1791)
if stoneItem then
stoneItem:remove()
stonePosition:sendMagicEffect(CONST_ME_EXPLOSIONAREA)
item:transform(2773)
end
end
return true
end

View File

@@ -0,0 +1,14 @@
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
item:transform(item.itemid == 2772 and 2773 or 2772)
if item.itemid ~= 2772 then
return true
end
local stoneItem = Tile(Position(32826, 32274, 11)):getItemById(1772)
if stoneItem then
stoneItem:remove()
end
return true
end