mirror of
https://github.com/ErikasKontenis/SabrehavenServer.git
synced 2025-10-14 14:44:55 +02:00
Full Distribution
This commit is contained in:
45
data/actions/scripts/misc/baking.lua
Normal file
45
data/actions/scripts/misc/baking.lua
Normal file
@@ -0,0 +1,45 @@
|
||||
local ovens = {
|
||||
2535, 2537, 2539, 2541, 3510
|
||||
}
|
||||
|
||||
local milestone = {
|
||||
1943, 1944, 1945, 1946
|
||||
}
|
||||
|
||||
function onUse(player, item, fromPosition, target, toPosition)
|
||||
if not target:isItem() then
|
||||
return false
|
||||
end
|
||||
|
||||
if item:getId() == 3603 then
|
||||
if (target:getId() == 2524 or target:getId() == 2873) and target:getFluidType() == FLUID_WATER then
|
||||
target:transform(target:getId(), FLUID_NONE)
|
||||
local parent = item:getParent()
|
||||
if parent:isContainer() or parent:isPlayer() then
|
||||
parent:addItem(3604, 1):decay()
|
||||
else
|
||||
Game.createItem(3604, 1, item:getPosition()):decay()
|
||||
end
|
||||
item:remove(1)
|
||||
return true
|
||||
end
|
||||
elseif item:getId() == 3604 then
|
||||
if table.contains(ovens, target:getId()) then
|
||||
Game.createItem(3600, 1, target:getPosition())
|
||||
item:remove(1)
|
||||
return true
|
||||
end
|
||||
elseif item:getId() == 3605 then
|
||||
if table.contains(milestone, target:getId()) then
|
||||
local parent = item:getParent()
|
||||
if parent:isContainer() or parent:isPlayer() then
|
||||
parent:addItem(3603, 1):decay()
|
||||
else
|
||||
Game.createItem(3603, 1, item:getPosition()):decay()
|
||||
end
|
||||
item:remove(1)
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
9
data/actions/scripts/misc/birdcage.lua
Normal file
9
data/actions/scripts/misc/birdcage.lua
Normal file
@@ -0,0 +1,9 @@
|
||||
function onUse(player, item, fromPosition, target, toPosition)
|
||||
if math.random(1, 100) <= 1 and math.random(1, 100) <= 10 then
|
||||
item:transform(2975, 0)
|
||||
item:decay()
|
||||
else
|
||||
item:getPosition():sendMagicEffect(22)
|
||||
end
|
||||
return true
|
||||
end
|
6
data/actions/scripts/misc/blueberry_bush.lua
Normal file
6
data/actions/scripts/misc/blueberry_bush.lua
Normal file
@@ -0,0 +1,6 @@
|
||||
function onUse(player, item, fromPosition, target, toPosition)
|
||||
item:transform(3700, 1)
|
||||
item:decay()
|
||||
Game.createItem(3588, 3, fromPosition)
|
||||
return true
|
||||
end
|
20
data/actions/scripts/misc/botanist_container.lua
Normal file
20
data/actions/scripts/misc/botanist_container.lua
Normal file
@@ -0,0 +1,20 @@
|
||||
function onUse(player, item, fromPosition, target, toPosition)
|
||||
if not target:isItem() then
|
||||
return false
|
||||
end
|
||||
|
||||
if target:getId() == 3874 and player:getStorageValue(305) == 1 then
|
||||
item:transform(4868, 1)
|
||||
target:getPosition():sendMagicEffect(10)
|
||||
return true
|
||||
elseif target:getId() == 3885 and player:getStorageValue(305) == 3 then
|
||||
item:transform(4870, 1)
|
||||
target:getPosition():sendMagicEffect(10)
|
||||
return true
|
||||
elseif target:getId() == 3878 and player:getStorageValue(305) == 5 then
|
||||
item:transform(4869, 1)
|
||||
target:getPosition():sendMagicEffect(10)
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
28
data/actions/scripts/misc/butterfly_conservation_kit.lua
Normal file
28
data/actions/scripts/misc/butterfly_conservation_kit.lua
Normal file
@@ -0,0 +1,28 @@
|
||||
function onUse(player, item, fromPosition, target, toPosition)
|
||||
if not target:isItem() then
|
||||
return false
|
||||
end
|
||||
|
||||
if target:getId() == 4992 and player:getStorageValue(304) == 1 then
|
||||
target:getPosition():sendMagicEffect(17)
|
||||
item:transform(4865, 1)
|
||||
item:decay()
|
||||
target:remove()
|
||||
elseif target:getId() == 4993 and player:getStorageValue(304) == 3 then
|
||||
target:getPosition():sendMagicEffect(17)
|
||||
item:transform(4866, 1)
|
||||
item:decay()
|
||||
target:remove()
|
||||
elseif target:getId() == 4991 and player:getStorageValue(304) == 5 then
|
||||
target:getPosition():sendMagicEffect(17)
|
||||
item:transform(4864, 1)
|
||||
item:decay()
|
||||
target:remove()
|
||||
elseif target:getId() == 5013 and player:getStorageValue(304) == 5 then
|
||||
target:getPosition():sendMagicEffect(17)
|
||||
item:transform(5089, 1)
|
||||
item:decay()
|
||||
target:remove()
|
||||
end
|
||||
return false
|
||||
end
|
49
data/actions/scripts/misc/chests.lua
Normal file
49
data/actions/scripts/misc/chests.lua
Normal file
@@ -0,0 +1,49 @@
|
||||
function onUse(player, item, fromPosition, target, toPosition)
|
||||
local chestQuestNumber = item:getAttribute(ITEM_ATTRIBUTE_CHESTQUESTNUMBER)
|
||||
|
||||
if player:getStorageValue(chestQuestNumber) > 0 then
|
||||
player:sendTextMessage(MESSAGE_INFO_DESCR, "The " .. item:getName() .. " is empty.")
|
||||
return true
|
||||
end
|
||||
|
||||
local playerCapacity = player:getFreeCapacity()
|
||||
|
||||
if item:getSize() <= 0 then
|
||||
player:sendTextMessage(MESSAGE_INFO_DESCR, "The chest is empty. This is a bug, report it to a gamemaster.")
|
||||
return true
|
||||
end
|
||||
|
||||
local reward = item:getItem(0)
|
||||
local stackable = reward:getType():isStackable()
|
||||
local rewardName = reward:getName()
|
||||
local rewardWeight = reward:getWeight()
|
||||
|
||||
if stackable then
|
||||
if reward:getCount() > 1 then
|
||||
rewardName = reward:getCount() .. " " .. reward:getPluralName()
|
||||
else
|
||||
rewardName = reward:getName()
|
||||
end
|
||||
end
|
||||
|
||||
if reward:getArticle():len() > 0 and reward:getCount() <= 1 then
|
||||
rewardName = reward:getArticle() .. " " .. rewardName
|
||||
end
|
||||
|
||||
if rewardWeight > playerCapacity and not getPlayerFlagValue(player, layerFlag_HasInfiniteCapacity) then
|
||||
local term = "it is"
|
||||
if stackable and reward:getCount() > 1 then
|
||||
term = "they are"
|
||||
end
|
||||
|
||||
player:sendTextMessage(MESSAGE_INFO_DESCR, string.format("You have found %s. Weighing %d.%02d oz %s too heavy.", rewardName, rewardWeight / 100, rewardWeight % 100, term))
|
||||
return true
|
||||
end
|
||||
|
||||
player:sendTextMessage(MESSAGE_INFO_DESCR, "You have found " .. rewardName .. ".")
|
||||
player:addItemEx(reward:clone(), true)
|
||||
if not getPlayerFlagValue(player, PlayerFlag_HasInfiniteCapacity) then
|
||||
player:setStorageValue(chestQuestNumber, 1)
|
||||
end
|
||||
return true
|
||||
end
|
9
data/actions/scripts/misc/closed_trap.lua
Normal file
9
data/actions/scripts/misc/closed_trap.lua
Normal file
@@ -0,0 +1,9 @@
|
||||
function onUse(player, item, fromPosition, target, toPosition)
|
||||
if Tile(item:getPosition()):hasFlag(TILESTATE_PROTECTIONZONE) then
|
||||
item:getPosition():sendMagicEffect(3)
|
||||
else
|
||||
item:transform(3482, 1)
|
||||
item:decay()
|
||||
end
|
||||
return true
|
||||
end
|
61
data/actions/scripts/misc/cornucopia.lua
Normal file
61
data/actions/scripts/misc/cornucopia.lua
Normal file
@@ -0,0 +1,61 @@
|
||||
function onUse(player, item, fromPosition, target, toPosition)
|
||||
if math.random(1, 100) <= 95 then
|
||||
item:getPosition():sendMagicEffect(19)
|
||||
local parent = item:getParent()
|
||||
if parent:isContainer() or parent:isPlayer() then
|
||||
parent:addItem(3592, 1)
|
||||
parent:addItem(3592, 1)
|
||||
parent:addItem(3592, 1)
|
||||
parent:addItem(3592, 1)
|
||||
parent:addItem(3592, 1)
|
||||
parent:addItem(3592, 1)
|
||||
parent:addItem(3592, 1)
|
||||
parent:addItem(3592, 1)
|
||||
parent:addItem(3592, 1)
|
||||
parent:addItem(3592, 1)
|
||||
else
|
||||
Game.createItem(3592, 1, fromPosition)
|
||||
Game.createItem(3592, 1, fromPosition)
|
||||
Game.createItem(3592, 1, fromPosition)
|
||||
Game.createItem(3592, 1, fromPosition)
|
||||
Game.createItem(3592, 1, fromPosition)
|
||||
Game.createItem(3592, 1, fromPosition)
|
||||
Game.createItem(3592, 1, fromPosition)
|
||||
Game.createItem(3592, 1, fromPosition)
|
||||
Game.createItem(3592, 1, fromPosition)
|
||||
Game.createItem(3592, 1, fromPosition)
|
||||
Game.createItem(3592, 1, fromPosition)
|
||||
end
|
||||
else
|
||||
item:getPosition():sendMagicEffect(19)
|
||||
local parent = item:getParent()
|
||||
if parent:isContainer() or parent:isPlayer() then
|
||||
parent:addItem(3592, 1)
|
||||
parent:addItem(3592, 1)
|
||||
parent:addItem(3592, 1)
|
||||
parent:addItem(3592, 1)
|
||||
parent:addItem(3592, 1)
|
||||
parent:addItem(3592, 1)
|
||||
parent:addItem(3592, 1)
|
||||
parent:addItem(3592, 1)
|
||||
parent:addItem(3592, 1)
|
||||
parent:addItem(3592, 1)
|
||||
parent:addItem(3592, 1)
|
||||
else
|
||||
Game.createItem(3592, 1, fromPosition)
|
||||
Game.createItem(3592, 1, fromPosition)
|
||||
Game.createItem(3592, 1, fromPosition)
|
||||
Game.createItem(3592, 1, fromPosition)
|
||||
Game.createItem(3592, 1, fromPosition)
|
||||
Game.createItem(3592, 1, fromPosition)
|
||||
Game.createItem(3592, 1, fromPosition)
|
||||
Game.createItem(3592, 1, fromPosition)
|
||||
Game.createItem(3592, 1, fromPosition)
|
||||
Game.createItem(3592, 1, fromPosition)
|
||||
Game.createItem(3592, 1, fromPosition)
|
||||
end
|
||||
item:transform(3592, 1)
|
||||
item:decay()
|
||||
end
|
||||
return true
|
||||
end
|
36
data/actions/scripts/misc/crowbar.lua
Normal file
36
data/actions/scripts/misc/crowbar.lua
Normal file
@@ -0,0 +1,36 @@
|
||||
function onUse(player, item, fromPosition, target, toPosition)
|
||||
if not target:isItem() then
|
||||
return false
|
||||
end
|
||||
|
||||
if target:getId() == 4848 and player:getStorageValue(297) == 0 then
|
||||
player:setStorageValue(297, 1)
|
||||
target:getPosition():sendMagicEffect(1)
|
||||
target:transform(4849, 1)
|
||||
target:decay()
|
||||
return true
|
||||
elseif target:getId() == 4848 and player:getStorageValue(297) == 1 then
|
||||
player:setStorageValue(297, 2)
|
||||
target:getPosition():sendMagicEffect(1)
|
||||
target:transform(4849, 1)
|
||||
target:decay()
|
||||
return true
|
||||
elseif target:getId() == 4848 and player:getStorageValue(297) == 2 then
|
||||
player:setStorageValue(297, 3)
|
||||
target:getPosition():sendMagicEffect(1)
|
||||
target:transform(4849, 3)
|
||||
target:decay()
|
||||
return true
|
||||
elseif target:getId() == 1628 and toPosition.x == 32680 and toPosition.y == 32083 and toPosition.z == 09 then
|
||||
Game.transformItemOnMap({x = 32680, y = 32083, z = 09}, 1628, 1630)
|
||||
return true
|
||||
elseif target:getId() == 3501 and toPosition.x == 32013 and toPosition.y == 31562 and toPosition.z == 04 and player:getStorageValue(228) == 1 then
|
||||
Game.sendMagicEffect({x = 32013, y = 31562, z = 04}, 15)
|
||||
player:setStorageValue(228, 2)
|
||||
return true
|
||||
elseif target:getId() == 3501 and toPosition.x == 32013 and toPosition.y == 31562 and toPosition.z == 04 then
|
||||
Game.sendMagicEffect({x = 32013, y = 31562, z = 04}, 3)
|
||||
return true
|
||||
end
|
||||
return doDestroyItem(target)
|
||||
end
|
175
data/actions/scripts/misc/doors.lua
Normal file
175
data/actions/scripts/misc/doors.lua
Normal file
@@ -0,0 +1,175 @@
|
||||
local lockedDoors = {
|
||||
1628, 1631, 1650, 1653, 1668, 1671, 1682, 1691, 5006, 5007
|
||||
}
|
||||
|
||||
local closedNormalDoors = {
|
||||
[1629] = 1630,
|
||||
[1632] = 1633,
|
||||
[1638] = 1639,
|
||||
[1640] = 1641,
|
||||
[1651] = 1652,
|
||||
[1654] = 1655,
|
||||
[1656] = 1657,
|
||||
[1658] = 1659,
|
||||
[1669] = 1670,
|
||||
[1672] = 1673,
|
||||
[1683] = 1684,
|
||||
[1685] = 1686,
|
||||
[1692] = 1693,
|
||||
[1694] = 1695,
|
||||
[4912] = 4911,
|
||||
[4913] = 4914,
|
||||
[5082] = 5083,
|
||||
[5084] = 5085,
|
||||
[2177] = 2178,
|
||||
[2179] = 2180,
|
||||
}
|
||||
|
||||
local openVerticalDoors = {
|
||||
[1630] = 1629,
|
||||
[1639] = 1638,
|
||||
[1643] = 1642,
|
||||
[1647] = 1646,
|
||||
[1652] = 1651,
|
||||
[1657] = 1656,
|
||||
[1661] = 1660,
|
||||
[1665] = 1664,
|
||||
[1670] = 1669,
|
||||
[1675] = 1674,
|
||||
[1679] = 1678,
|
||||
[1693] = 1692,
|
||||
[1695] = 1694,
|
||||
[1697] = 1696,
|
||||
[1699] = 1698,
|
||||
[4914] = 4913,
|
||||
[5083] = 5082,
|
||||
[2178] = 2177,
|
||||
}
|
||||
|
||||
local openHorizontalDoors = {
|
||||
[1633] = 1632,
|
||||
[1641] = 1640,
|
||||
[1645] = 1644,
|
||||
[1649] = 1648,
|
||||
[1655] = 1654,
|
||||
[1659] = 1658,
|
||||
[1663] = 1662,
|
||||
[1667] = 1666,
|
||||
[1673] = 1672,
|
||||
[1677] = 1676,
|
||||
[1681] = 1680,
|
||||
[1684] = 1683,
|
||||
[1686] = 1685,
|
||||
[1688] = 1687,
|
||||
[1690] = 1689,
|
||||
[4911] = 4912,
|
||||
[5085] = 5084,
|
||||
[2180] = 2179,
|
||||
}
|
||||
|
||||
local levelDoors = {
|
||||
[1646] = 1647,
|
||||
[1648] = 1649,
|
||||
[1664] = 1665,
|
||||
[1666] = 1667,
|
||||
[1678] = 1679,
|
||||
[1680] = 1681,
|
||||
[1687] = 1688,
|
||||
[1696] = 1697,
|
||||
}
|
||||
|
||||
local questDoors = {
|
||||
[1642] = 1643,
|
||||
[1644] = 1645,
|
||||
[1660] = 1661,
|
||||
[1662] = 1663,
|
||||
[1674] = 1675,
|
||||
[1676] = 1677,
|
||||
[1689] = 1690,
|
||||
[1698] = 1699,
|
||||
}
|
||||
|
||||
local passthrough = {
|
||||
[2334] = 2335,
|
||||
[2335] = 2334,
|
||||
[2336] = 2337,
|
||||
[2337] = 2336,
|
||||
[2338] = 2339,
|
||||
[2339] = 2338,
|
||||
[2340] = 2341,
|
||||
[2341] = 2340,
|
||||
}
|
||||
|
||||
function onUse(player, item, fromPosition, target, toPosition)
|
||||
if table.contains(lockedDoors, item:getId()) then
|
||||
player:sendTextMessage(MESSAGE_INFO_DESCR, "It is locked.")
|
||||
return true
|
||||
end
|
||||
|
||||
local door = closedNormalDoors[item:getId()]
|
||||
if door then
|
||||
item:transform(door, 1)
|
||||
item:decay()
|
||||
return true
|
||||
end
|
||||
|
||||
door = openVerticalDoors[item:getId()]
|
||||
if door then
|
||||
local doorCreature = Tile(item:getPosition()):getTopCreature()
|
||||
if doorCreature then
|
||||
doorCreature:teleportTo(item:getPosition():moveRel(1, 0, 0), true)
|
||||
end
|
||||
item:transform(door, 1)
|
||||
item:decay()
|
||||
return true
|
||||
end
|
||||
|
||||
door = openHorizontalDoors[item:getId()]
|
||||
if door then
|
||||
local doorCreature = Tile(item:getPosition()):getTopCreature()
|
||||
if doorCreature then
|
||||
doorCreature:teleportTo(item:getPosition():moveRel(0, 1, 0), true)
|
||||
end
|
||||
item:transform(door, 1)
|
||||
item:decay()
|
||||
return true
|
||||
end
|
||||
|
||||
door = levelDoors[item:getId()]
|
||||
if door then
|
||||
if player:getLevel() < item:getAttribute(ITEM_ATTRIBUTE_DOORLEVEL) then
|
||||
player:sendTextMessage(MESSAGE_INFO_DESCR, item:getType():getDescription() .. ".")
|
||||
return true
|
||||
end
|
||||
|
||||
player:teleportTo(item:getPosition(), true)
|
||||
item:transform(door, 1)
|
||||
item:decay()
|
||||
return true
|
||||
end
|
||||
|
||||
door = questDoors[item:getId()]
|
||||
if door then
|
||||
local questNumber = item:getAttribute(ITEM_ATTRIBUTE_DOORQUESTNUMBER)
|
||||
local questValue = item:getAttribute(ITEM_ATTRIBUTE_DOORQUESTVALUE)
|
||||
if questNumber > 0 then
|
||||
if player:getStorageValue(questNumber) ~= questValue then
|
||||
player:sendTextMessage(MESSAGE_INFO_DESCR, "The door seems to be sealed against unwanted intruders.")
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
player:teleportTo(item:getPosition(), true)
|
||||
item:transform(door, 1)
|
||||
item:decay()
|
||||
return true
|
||||
end
|
||||
|
||||
door = passthrough[item:getId()]
|
||||
if door then
|
||||
item:transform(door, 1)
|
||||
item:decay()
|
||||
return true
|
||||
end
|
||||
return true
|
||||
end
|
14
data/actions/scripts/misc/ectoplasm_container.lua
Normal file
14
data/actions/scripts/misc/ectoplasm_container.lua
Normal file
@@ -0,0 +1,14 @@
|
||||
function onUse(player, item, fromPosition, target, toPosition)
|
||||
if not target:isItem() then
|
||||
return false
|
||||
end
|
||||
|
||||
if target:getId() == 4094 then
|
||||
item:transform(4853, 1)
|
||||
item:decay()
|
||||
target:getPosition():sendMagicEffect(12)
|
||||
item:getPosition():sendMagicEffect(13)
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
39
data/actions/scripts/misc/fishing_rod.lua
Normal file
39
data/actions/scripts/misc/fishing_rod.lua
Normal file
@@ -0,0 +1,39 @@
|
||||
local water = {
|
||||
4597, 4598, 4599, 4600, 4601, 4602,
|
||||
4609, 4610, 4611, 4612, 4613, 4614,
|
||||
4615, 4616, 4617, 4618, 4619, 4620,
|
||||
622
|
||||
}
|
||||
|
||||
local fishableWater = {
|
||||
4597, 4598, 4599, 4600, 4601, 4602
|
||||
}
|
||||
|
||||
function onUse(player, item, fromPosition, target, toPosition)
|
||||
if not target:isItem() then
|
||||
return false
|
||||
end
|
||||
|
||||
if not table.contains(water, target:getId()) then
|
||||
return false
|
||||
end
|
||||
|
||||
if not Tile(player:getPosition()):hasFlag(TILESTATE_PROTECTIONZONE) then
|
||||
if player:getItemCount(3492) >= 1 then
|
||||
player:addSkillTries(SKILL_FISHING, 1)
|
||||
if math.random(1, 100) <= math.min(math.max(10 + (player:getEffectiveSkillLevel(SKILL_FISHING) - 10) * 0.597, 10), 50) then
|
||||
player:addItem(3578, 1)
|
||||
|
||||
if target:getId() ~= 622 then
|
||||
target:transform(4609, 1)
|
||||
end
|
||||
|
||||
target:decay()
|
||||
player:removeItem(3492, 1)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
target:getPosition():sendMagicEffect(2)
|
||||
return true
|
||||
end
|
102
data/actions/scripts/misc/fluids.lua
Normal file
102
data/actions/scripts/misc/fluids.lua
Normal file
@@ -0,0 +1,102 @@
|
||||
local drunk = Condition(CONDITION_DRUNK)
|
||||
drunk:setParameter(CONDITION_PARAM_TICKS, 60000)
|
||||
|
||||
local poison = Condition(CONDITION_POISON)
|
||||
poison:setParameter(CONDITION_PARAM_DELAYED, true)
|
||||
poison:setParameter(CONDITION_PARAM_MINVALUE, -50)
|
||||
poison:setParameter(CONDITION_PARAM_MAXVALUE, -120)
|
||||
poison:setParameter(CONDITION_PARAM_STARTVALUE, -5)
|
||||
poison:setParameter(CONDITION_PARAM_TICKINTERVAL, 5000)
|
||||
poison:setParameter(CONDITION_PARAM_FORCEUPDATE, true)
|
||||
|
||||
local messages = {
|
||||
[FLUID_WATER] = "Gulp.",
|
||||
[FLUID_WINE] = "Aah...",
|
||||
[FLUID_BEER] = "Aah...",
|
||||
[FLUID_MUD] = "Gulp.",
|
||||
[FLUID_BLOOD] = "Gulp.",
|
||||
[FLUID_SLIME] = "Urgh!",
|
||||
[FLUID_OIL] = "Gulp.",
|
||||
[FLUID_URINE] = "Urgh!",
|
||||
[FLUID_MILK] = "Mmmh.",
|
||||
[FLUID_MANAFLUID] = "Aaaah...",
|
||||
[FLUID_LIFEFLUID] = "Aaaah...",
|
||||
[FLUID_LEMONADE] = "Mmmh."
|
||||
}
|
||||
|
||||
function onUse(player, item, fromPosition, target, toPosition)
|
||||
local targetItemType = ItemType(target:getId())
|
||||
if targetItemType and targetItemType:isFluidContainer() then
|
||||
if target:getFluidType() == 0 and item:getFluidType() ~= 0 then
|
||||
target:transform(target:getId(), item:getFluidType())
|
||||
item:transform(item:getId(), 0)
|
||||
return true
|
||||
elseif target:getFluidType() ~= 0 and item:getFluidType() == 0 then
|
||||
target:transform(target:getId(), 0)
|
||||
item:transform(item:getId(), target:getFluidType())
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
if target:isCreature() then
|
||||
if item:getFluidType() == FLUID_NONE then
|
||||
player:sendCancelMessage("It is empty.")
|
||||
else
|
||||
local self = target == player
|
||||
if self and item:getFluidType() == FLUID_BEER or item:getFluidType() == FLUID_WINE then
|
||||
player:addCondition(drunk)
|
||||
elseif self and item:getFluidType() == FLUID_SLIME then
|
||||
player:addCondition(slime)
|
||||
elseif item:getFluidType() == FLUID_MANAFLUID then
|
||||
target:addMana(math.random(50, 100))
|
||||
target:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE)
|
||||
elseif item:getFluidType() == FLUID_LIFEFLUID then
|
||||
target:addHealth(math.random(25, 50))
|
||||
target:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE)
|
||||
end
|
||||
|
||||
if not self then
|
||||
if item:getFluidType() ~= FLUID_MANAFLUID and item:getFluidType() ~= FLUID_LIFEFLUID then
|
||||
if toPosition.x == CONTAINER_POSITION then
|
||||
toPosition = player:getPosition()
|
||||
end
|
||||
Game.createItem(2886, item:getFluidType(), toPosition):decay()
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
local message = messages[item:getFluidType()]
|
||||
if message then
|
||||
target:say(message, TALKTYPE_MONSTER_SAY)
|
||||
else
|
||||
target:say("Gulp.", TALKTYPE_MONSTER_SAY)
|
||||
end
|
||||
item:transform(item:getId(), FLUID_NONE)
|
||||
end
|
||||
else
|
||||
if toPosition.x == CONTAINER_POSITION then
|
||||
toPosition = player:getPosition()
|
||||
end
|
||||
|
||||
local tile = Tile(toPosition)
|
||||
if not tile then
|
||||
return false
|
||||
end
|
||||
|
||||
if item:getFluidType() ~= FLUID_NONE and tile:hasFlag(TILESTATE_IMMOVABLEBLOCKSOLID) then
|
||||
return false
|
||||
end
|
||||
|
||||
local fluidSource = targetItemType and targetItemType:getFluidSource() or FLUID_NONE
|
||||
if fluidSource ~= FLUID_NONE then
|
||||
item:transform(item:getId(), fluidSource)
|
||||
elseif item:getFluidType() == FLUID_NONE then
|
||||
player:sendTextMessage(MESSAGE_STATUS_SMALL, "It is empty.")
|
||||
else
|
||||
|
||||
Game.createItem(2886, item.type, toPosition):decay()
|
||||
item:transform(item:getId(), 0)
|
||||
end
|
||||
end
|
||||
return true
|
||||
end
|
12
data/actions/scripts/misc/food.lua
Normal file
12
data/actions/scripts/misc/food.lua
Normal file
@@ -0,0 +1,12 @@
|
||||
function onUse(player, item, fromPosition, target, toPosition)
|
||||
local itemType = ItemType(item:getId())
|
||||
local condition = player:getCondition(CONDITION_REGENERATION, CONDITIONID_DEFAULT)
|
||||
if condition and math.floor(condition:getTicks() / 1000 + (itemType:getNutrition() * 12)) >= 1200 then
|
||||
player:sendTextMessage(MESSAGE_STATUS_SMALL, "You are full.")
|
||||
else
|
||||
player:feed(itemType:getNutrition() * 12)
|
||||
item:remove(1)
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
61
data/actions/scripts/misc/furniture_parcels.lua
Normal file
61
data/actions/scripts/misc/furniture_parcels.lua
Normal file
@@ -0,0 +1,61 @@
|
||||
local parcels = {
|
||||
[2775] = 2374,
|
||||
[2776] = 2378,
|
||||
[2777] = 2358,
|
||||
[2778] = 2382,
|
||||
[2779] = 2366,
|
||||
[2780] = 2418,
|
||||
[2781] = 2422,
|
||||
[2782] = 2319,
|
||||
[2783] = 2316,
|
||||
[2784] = 2315,
|
||||
[2785] = 2314,
|
||||
[2786] = 2346,
|
||||
[2787] = 2349,
|
||||
[2788] = 2351,
|
||||
[2789] = 2433,
|
||||
[2790] = 2441,
|
||||
[2791] = 2449,
|
||||
[2792] = 2524,
|
||||
[2793] = 2523,
|
||||
[2794] = 2483,
|
||||
[2795] = 2465,
|
||||
[2796] = 2976,
|
||||
[2797] = 2979,
|
||||
[2798] = 2934,
|
||||
[2799] = 3485,
|
||||
[2800] = 2998,
|
||||
[2801] = 2445,
|
||||
[2802] = 2025,
|
||||
[2803] = 2029,
|
||||
[2804] = 2030,
|
||||
[2805] = 2904,
|
||||
[2806] = 3510,
|
||||
[2807] = 2959,
|
||||
[2808] = 2963,
|
||||
[2809] = 2426,
|
||||
[2810] = 2352,
|
||||
[2811] = 2982,
|
||||
[2812] = 2986,
|
||||
[5086] = 5046,
|
||||
[5087] = 5055,
|
||||
[5088] = 5056,
|
||||
}
|
||||
|
||||
function onUse(player, item, fromPosition, target, toPosition)
|
||||
local parcel = parcels[item:getId()]
|
||||
if not parcel then
|
||||
return false
|
||||
end
|
||||
|
||||
if not item:getParent():isTile() then
|
||||
item:getPosition():sendMagicEffect(CONST_ME_POFF)
|
||||
elseif not Tile(fromPosition):getHouse() then
|
||||
item:getPosition():sendMagicEffect(CONST_ME_POFF)
|
||||
else
|
||||
item:transform(parcel)
|
||||
item:getPosition():sendMagicEffect(CONST_ME_POFF)
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
14
data/actions/scripts/misc/helmet_of_the_ancients.lua
Normal file
14
data/actions/scripts/misc/helmet_of_the_ancients.lua
Normal file
@@ -0,0 +1,14 @@
|
||||
function onUse(player, item, fromPosition, target, toPosition)
|
||||
if not target:isItem() then
|
||||
return false
|
||||
end
|
||||
|
||||
if target:getId() == 3030 then
|
||||
item:getPosition():sendMagicEffect(14)
|
||||
item:transform(3230, 1)
|
||||
item:decay()
|
||||
target:remove(1)
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
18
data/actions/scripts/misc/ice_pick.lua
Normal file
18
data/actions/scripts/misc/ice_pick.lua
Normal file
@@ -0,0 +1,18 @@
|
||||
function onUse(player, item, fromPosition, target, toPosition)
|
||||
if not target:isItem() then
|
||||
return false
|
||||
end
|
||||
|
||||
if target:getId() == 4994 and player:getStorageValue(306) == 1 and player:getStorageValue(307) == 0 then
|
||||
local parent = item:getParent()
|
||||
if parent:isContainer() or parent:isPlayer() then
|
||||
parent:addItem(4837, 1)
|
||||
else
|
||||
Game.createItem(4837, 1, item:getPosition())
|
||||
end
|
||||
target:getPosition():sendMagicEffect(2)
|
||||
player:setStorageValue(307, 1)
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
14
data/actions/scripts/misc/instruments.lua
Normal file
14
data/actions/scripts/misc/instruments.lua
Normal file
@@ -0,0 +1,14 @@
|
||||
function onUse(player, item, fromPosition, target, toPosition)
|
||||
if item:getId() >= 2948 and item:getId() <= 2950 or item:getId() >= 2952 and item:getId() <= 2958 or
|
||||
item:getId() >= 2963 and item:getId() <= 2964 then
|
||||
item:getPosition():sendMagicEffect(CONST_ME_SOUND_GREEN)
|
||||
elseif (item:getId() >= 2959 and item:getId() <= 2962 or item:getId() == 2965) and math.random(1, 100) <= 50 then
|
||||
item:getPosition():sendMagicEffect(CONST_ME_SOUND_GREEN)
|
||||
elseif item:getId() >= 2959 and item:getId() <= 2962 or item:getId() == 2965 then
|
||||
item:getPosition():sendMagicEffect(CONST_ME_SOUND_PURPLE)
|
||||
elseif item:getId() == 3219 then
|
||||
item:getPosition():sendMagicEffect(19)
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
56
data/actions/scripts/misc/key.lua
Normal file
56
data/actions/scripts/misc/key.lua
Normal file
@@ -0,0 +1,56 @@
|
||||
local closedDoors = {
|
||||
[1628] = 1630,
|
||||
[1629] = 1628,
|
||||
[1631] = 1633,
|
||||
[1632] = 1631,
|
||||
[1650] = 1652,
|
||||
[1651] = 1650,
|
||||
[1653] = 1655,
|
||||
[1654] = 1653,
|
||||
[1668] = 1670,
|
||||
[1669] = 1668,
|
||||
[1671] = 1673,
|
||||
[1672] = 1671,
|
||||
[1682] = 1684,
|
||||
[1683] = 1682,
|
||||
[1691] = 1693,
|
||||
[1692] = 1691,
|
||||
}
|
||||
|
||||
local openDoors = {
|
||||
[1630] = 1628,
|
||||
[1633] = 1631,
|
||||
[1652] = 1650,
|
||||
[1655] = 1653,
|
||||
[1670] = 1668,
|
||||
[1673] = 1671,
|
||||
[1684] = 1682,
|
||||
[1693] = 1691,
|
||||
}
|
||||
|
||||
function onUse(player, item, fromPosition, target, toPosition)
|
||||
if not target:isItem() then
|
||||
return false
|
||||
end
|
||||
|
||||
local door = closedDoors[target:getId()]
|
||||
if not door then
|
||||
door = openDoors[target:getId()]
|
||||
end
|
||||
|
||||
if not door then
|
||||
return false
|
||||
end
|
||||
|
||||
local keyNumber = item:getAttribute(ITEM_ATTRIBUTE_KEYNUMBER)
|
||||
local keyHoleNumber = target:getAttribute(ITEM_ATTRIBUTE_KEYHOLENUMBER)
|
||||
|
||||
if keyHoleNumber == 0 or keyNumber ~= keyHoleNumber then
|
||||
player:sendCancelMessage("The key does not match.")
|
||||
return true
|
||||
end
|
||||
|
||||
target:transform(door)
|
||||
target:decay()
|
||||
return true
|
||||
end
|
12
data/actions/scripts/misc/knife.lua
Normal file
12
data/actions/scripts/misc/knife.lua
Normal file
@@ -0,0 +1,12 @@
|
||||
function onUse(player, item, fromPosition, target, toPosition)
|
||||
if not target:isItem() then
|
||||
return false
|
||||
end
|
||||
|
||||
if target:getId() == 3594 then
|
||||
target:transform(2977, 1)
|
||||
target:decay()
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
10
data/actions/scripts/misc/letter_bag.lua
Normal file
10
data/actions/scripts/misc/letter_bag.lua
Normal file
@@ -0,0 +1,10 @@
|
||||
function onUse(player, item, fromPosition, target, toPosition)
|
||||
if target:getId() == 3221 and toPosition.x == 31948 and toPosition.y == 31711 and toPosition.z == 06 then
|
||||
item:transform(2859, 1)
|
||||
item:decay()
|
||||
player:setStorageValue(244, 2)
|
||||
Game.sendMagicEffect({x = 31948, y = 31711, z = 06}, 19)
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
19
data/actions/scripts/misc/machete.lua
Normal file
19
data/actions/scripts/misc/machete.lua
Normal file
@@ -0,0 +1,19 @@
|
||||
function onUse(player, item, fromPosition, target, toPosition)
|
||||
if not target:isItem() then
|
||||
return false
|
||||
end
|
||||
|
||||
if target:getId() == 3696 then
|
||||
target:transform(3695, 1)
|
||||
target:decay()
|
||||
return true
|
||||
elseif target:getId() == 3702 then
|
||||
target:transform(3701, 1)
|
||||
target:decay()
|
||||
return true
|
||||
elseif target:getId() == 2130 then
|
||||
target:remove()
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
6
data/actions/scripts/misc/open_trap.lua
Normal file
6
data/actions/scripts/misc/open_trap.lua
Normal file
@@ -0,0 +1,6 @@
|
||||
function onUse(player, item, fromPosition, target, toPosition)
|
||||
item:transform(3481, 1)
|
||||
item:decay()
|
||||
item:getPosition():sendMagicEffect(3)
|
||||
return true
|
||||
end
|
4
data/actions/scripts/misc/panda_teddy.lua
Normal file
4
data/actions/scripts/misc/panda_teddy.lua
Normal file
@@ -0,0 +1,4 @@
|
||||
function onUse(player, item, fromPosition, target, toPosition)
|
||||
player:sendCancelMessage("Hug me ^^")
|
||||
return true
|
||||
end
|
34
data/actions/scripts/misc/pick.lua
Normal file
34
data/actions/scripts/misc/pick.lua
Normal file
@@ -0,0 +1,34 @@
|
||||
function onUse(player, item, fromPosition, target, toPosition)
|
||||
local tile = Tile(toPosition)
|
||||
if not tile then
|
||||
return false
|
||||
end
|
||||
|
||||
local ground = tile:getGround()
|
||||
if not ground then
|
||||
return false
|
||||
end
|
||||
|
||||
if ground:getId() == 372 then
|
||||
ground:transform(394, 1)
|
||||
ground:decay()
|
||||
return true
|
||||
elseif target:getId() == 1772 and toPosition.x == 32648 and toPosition.y == 32134 and toPosition.z == 10 and math.random(1, 100) <= 40 then
|
||||
Game.sendMagicEffect({x = 32648, y = 32134, z = 10}, 3)
|
||||
Game.removeItemOnMap({x = 32648, y = 32134, z = 10}, 1772)
|
||||
return true
|
||||
elseif target:getId() == 1772 and toPosition.x == 32648 and toPosition.y == 32134 and toPosition.z == 10 then
|
||||
Game.sendMagicEffect({x = 32648, y = 32134, z = 10}, 3)
|
||||
doTargetCombatHealth(0, player, COMBAT_PHYSICALDAMAGE, -40, -40)
|
||||
return true
|
||||
elseif target:getId() == 1791 and toPosition.x == 32356 and toPosition.y == 32074 and toPosition.z == 10 and math.random(1, 100) <= 40 then
|
||||
Game.sendMagicEffect({x = 32356, y = 32074, z = 10}, 3)
|
||||
Game.removeItemOnMap({x = 32356, y = 32074, z = 10}, 1791)
|
||||
return true
|
||||
elseif target:getId() == 1791 and toPosition.x == 32356 and toPosition.y == 32074 and toPosition.z == 10 then
|
||||
Game.sendMagicEffect({x = 32356, y = 32074, z = 10}, 3)
|
||||
doTargetCombatHealth(0, player, COMBAT_PHYSICALDAMAGE, -50, -50)
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
5
data/actions/scripts/misc/present.lua
Normal file
5
data/actions/scripts/misc/present.lua
Normal file
@@ -0,0 +1,5 @@
|
||||
function onUse(player, item, fromPosition, target, toPosition)
|
||||
item:getPosition():sendMagicEffect(3)
|
||||
item:remove()
|
||||
return true
|
||||
end
|
13
data/actions/scripts/misc/pumpkin_head.lua
Normal file
13
data/actions/scripts/misc/pumpkin_head.lua
Normal file
@@ -0,0 +1,13 @@
|
||||
function onUse(player, item, fromPosition, target, toPosition)
|
||||
if not target:isItem() then
|
||||
return false
|
||||
end
|
||||
|
||||
if target:getId() == 2917 then
|
||||
item:transform(2978, 1)
|
||||
item:decay()
|
||||
target:remove()
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
46
data/actions/scripts/misc/rope.lua
Normal file
46
data/actions/scripts/misc/rope.lua
Normal file
@@ -0,0 +1,46 @@
|
||||
local ropeSpots = {
|
||||
386, 421
|
||||
}
|
||||
|
||||
local holeSpots = {
|
||||
293, 294, 369, 370, 385, 394, 411, 412,
|
||||
421, 432, 433, 435, 482, 5081, 483, 594,
|
||||
595, 607, 609, 610, 615, 1066, 1067, 1080
|
||||
}
|
||||
|
||||
function onUse(player, item, fromPosition, target, toPosition)
|
||||
local tile = Tile(toPosition)
|
||||
if not tile then
|
||||
return false
|
||||
end
|
||||
|
||||
if not tile:getGround() then
|
||||
return false
|
||||
end
|
||||
|
||||
if table.contains(ropeSpots, tile:getGround():getId()) then
|
||||
player:teleportTo(target:getPosition():moveRel(0, 1, -1))
|
||||
return true
|
||||
elseif table.contains(holeSpots, tile:getGround():getId()) or target:getId() == 435 then
|
||||
local tile = Tile(target:getPosition():moveRel(0, 0, 1))
|
||||
if not tile then
|
||||
return false
|
||||
end
|
||||
|
||||
local thing = tile:getTopCreature()
|
||||
if not thing then
|
||||
thing = tile:getTopVisibleThing()
|
||||
end
|
||||
|
||||
if thing:isCreature() then
|
||||
thing:teleportTo(target:getPosition():moveRel(0, 1, 0), false)
|
||||
return true
|
||||
end
|
||||
if thing:isItem() and thing:getType():isMovable() then
|
||||
thing:moveTo(target:getPosition():moveRel(0, 1, 0))
|
||||
return true
|
||||
end
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
16
data/actions/scripts/misc/scythe.lua
Normal file
16
data/actions/scripts/misc/scythe.lua
Normal file
@@ -0,0 +1,16 @@
|
||||
function onUse(player, item, fromPosition, target, toPosition)
|
||||
if not target:isItem() then
|
||||
return false
|
||||
end
|
||||
|
||||
if target:getId() == 3652 then
|
||||
player:sendCancelMessage(target:getType():getDescription() .. ".")
|
||||
return true
|
||||
elseif target:getId() == 3653 then
|
||||
target:transform(3651, 1)
|
||||
target:decay()
|
||||
Game.createItem(3605, 1, target:getPosition())
|
||||
return true
|
||||
end
|
||||
return doDestroyItem(target)
|
||||
end
|
10
data/actions/scripts/misc/sheet_of_tracing_paper.lua
Normal file
10
data/actions/scripts/misc/sheet_of_tracing_paper.lua
Normal file
@@ -0,0 +1,10 @@
|
||||
function onUse(player, item, fromPosition, target, toPosition)
|
||||
if target:getId() == 2199 and toPosition.x == 32754 and toPosition.y == 32559 and toPosition.z == 09 and player:getStorageValue(315) == 1 then
|
||||
item:transform(4843, 1)
|
||||
item:decay()
|
||||
player:setStorageValue(316, 1)
|
||||
target:getPosition():sendMagicEffect(4)
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
57
data/actions/scripts/misc/shovel.lua
Normal file
57
data/actions/scripts/misc/shovel.lua
Normal file
@@ -0,0 +1,57 @@
|
||||
function onUse(player, item, fromPosition, target, toPosition)
|
||||
local tile = Tile(toPosition)
|
||||
if not tile then
|
||||
return false
|
||||
end
|
||||
|
||||
local ground = tile:getGround()
|
||||
if not ground then
|
||||
return false
|
||||
end
|
||||
|
||||
local toTarget = target;
|
||||
|
||||
local itemType = ItemType(target:getId())
|
||||
if itemType:isSplash() then
|
||||
toTarget = ground
|
||||
end
|
||||
|
||||
if toTarget:getId() == 231 then
|
||||
toTarget:getPosition():sendMagicEffect(3)
|
||||
return true
|
||||
elseif toTarget:getId() == 593 then
|
||||
toTarget:transform(594, 1)
|
||||
toTarget:decay()
|
||||
doRelocate(toTarget:getPosition(), toTarget:getPosition():moveRel(0,0,1))
|
||||
return true
|
||||
elseif toTarget:getId() == 606 then
|
||||
toTarget:transform(607, 1)
|
||||
toTarget:decay()
|
||||
doRelocate(toTarget:getPosition(), toTarget:getPosition():moveRel(0,0,1))
|
||||
return true
|
||||
elseif toTarget:getId() == 608 then
|
||||
toTarget:transform(609, 1)
|
||||
toTarget:decay()
|
||||
doRelocate(toTarget:getPosition(), toTarget:getPosition():moveRel(0,0,1))
|
||||
elseif toTarget:getId() == 614 and math.random(1, 100) <= 50 then
|
||||
toTarget:transform(615, 1)
|
||||
toTarget:decay()
|
||||
toTarget:getPosition():sendMagicEffect(3)
|
||||
doRelocate(toTarget:getPosition(), toTarget:getPosition():moveRel(0,0,1))
|
||||
elseif toTarget:getId() == 614 then
|
||||
toTarget:getPosition():sendMagicEffect(3)
|
||||
elseif toTarget:getId() == 616 and math.random(1, 100) <= 95 then
|
||||
toTarget:transform(617, 1)
|
||||
toTarget:decay()
|
||||
toTarget:getPosition():sendMagicEffect(3)
|
||||
Game.createMonster("scarab", toTarget:getPosition())
|
||||
elseif toTarget:getId() == 616 then
|
||||
toTarget:getPosition():sendMagicEffect(3)
|
||||
Game.createItem(3042, 1, toTarget:getPosition())
|
||||
toTarget:transform(617, 1)
|
||||
toTarget:decay()
|
||||
elseif toTarget:getId() == 617 then
|
||||
toTarget:getPosition():sendMagicEffect(3)
|
||||
end
|
||||
return false
|
||||
end
|
15
data/actions/scripts/misc/snake_destroyer.lua
Normal file
15
data/actions/scripts/misc/snake_destroyer.lua
Normal file
@@ -0,0 +1,15 @@
|
||||
function onUse(player, item, fromPosition, target, toPosition)
|
||||
if not target:isItem() then
|
||||
return false
|
||||
end
|
||||
|
||||
if target:getId() == 4850 and player:getStorageValue(293) == 17 then
|
||||
target:transform(4851, 1)
|
||||
target:decay()
|
||||
player:setStorageValue(299, 1)
|
||||
item:remove()
|
||||
target:getPosition():sendMagicEffect(7)
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
4
data/actions/scripts/misc/snowheap.lua
Normal file
4
data/actions/scripts/misc/snowheap.lua
Normal file
@@ -0,0 +1,4 @@
|
||||
function onUse(player, item, fromPosition, target, toPosition)
|
||||
Game.createItem(2992, 1, fromPosition)
|
||||
return true
|
||||
end
|
37
data/actions/scripts/misc/special_rights.lua
Normal file
37
data/actions/scripts/misc/special_rights.lua
Normal file
@@ -0,0 +1,37 @@
|
||||
function onUse(player, item, fromPosition, target, toPosition)
|
||||
if player:hasFlag(PlayerFlag_SpecialMoveUse) then
|
||||
if item:getId() == 372 then
|
||||
item:transform(394, 1)
|
||||
item:decay()
|
||||
elseif item:getId() == 386 or item:getId() == 421 then
|
||||
local relPos = item:getPosition():moveRel(0, 1, -1)
|
||||
player:teleportTo(relPos)
|
||||
elseif item:getId() == 593 then
|
||||
item:transform(594, 1)
|
||||
item:decay()
|
||||
doRelocate(item:getPosition(),item:getPosition():moveRel(0, 0, 1))
|
||||
elseif item:getId() == 606 or item:getId() == 608 then
|
||||
item:transform(607, 1)
|
||||
item:decay()
|
||||
doRelocate(item:getPosition(), item:getPosition():moveRel(0, 0, 1))
|
||||
elseif item:getId() == 614 then
|
||||
item:transform(615, 1)
|
||||
item:decay()
|
||||
item:getPosition():sendMagicEffect(3)
|
||||
doRelocate(item:getPosition(), item:getPosition():moveRel(0, 0, 1))
|
||||
elseif item:getId() == 3653 then
|
||||
item:transform(3651, 1)
|
||||
item:decay()
|
||||
Game.createItem(3605, 1, item:getPosition())
|
||||
elseif item:getId() == 3696 then
|
||||
item:transform(3695, 1)
|
||||
item:decay()
|
||||
elseif item:getId() == 3702 then
|
||||
item:transform(3701, 1)
|
||||
item:decay()
|
||||
end
|
||||
else
|
||||
return false
|
||||
end
|
||||
return true
|
||||
end
|
12
data/actions/scripts/misc/spectral_stone.lua
Normal file
12
data/actions/scripts/misc/spectral_stone.lua
Normal file
@@ -0,0 +1,12 @@
|
||||
function onUse(player, item, fromPosition, target, toPosition)
|
||||
if target:getId() == 599 and toPosition.x == 32665 and toPosition.y == 32736 and toPosition.z == 06 and player:getStorageValue(320) == 5 then
|
||||
player:setStorageValue(321,1)
|
||||
target:getPosition():sendMagicEffect(13)
|
||||
return true
|
||||
elseif target:getId() == 599 and toPosition.x == 32497 and toPosition.y == 31622 and toPosition.z == 06 and player:getStorageValue(320) == 5 then
|
||||
player:setStorageValue(322,1)
|
||||
target:getPosition():sendMagicEffect(13)
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
32
data/actions/scripts/misc/spellbook.lua
Normal file
32
data/actions/scripts/misc/spellbook.lua
Normal file
@@ -0,0 +1,32 @@
|
||||
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
|
||||
local count = getPlayerInstantSpellCount(player)
|
||||
local text = ""
|
||||
local spells = {}
|
||||
for i = 0, count - 1 do
|
||||
local spell = getPlayerInstantSpellInfo(player, i)
|
||||
if spell.level ~= 0 then
|
||||
if spell.manapercent > 0 then
|
||||
spell.mana = spell.manapercent .. "%"
|
||||
end
|
||||
spells[#spells + 1] = spell
|
||||
end
|
||||
end
|
||||
|
||||
table.sort(spells, function(a, b) return a.level < b.level end)
|
||||
|
||||
local prevLevel = -1
|
||||
for i, spell in ipairs(spells) do
|
||||
local line = ""
|
||||
if prevLevel ~= spell.level then
|
||||
if i ~= 1 then
|
||||
line = "\n"
|
||||
end
|
||||
line = line .. "Spells for Level " .. spell.level .. "\n"
|
||||
prevLevel = spell.level
|
||||
end
|
||||
text = text .. line .. " " .. spell.words .. " - " .. spell.name .. " : " .. spell.mana .. "\n"
|
||||
end
|
||||
|
||||
player:showTextDialog(item:getId(), text)
|
||||
return true
|
||||
end
|
15
data/actions/scripts/misc/strange_lever.lua
Normal file
15
data/actions/scripts/misc/strange_lever.lua
Normal file
@@ -0,0 +1,15 @@
|
||||
function onUse(player, item, fromPosition, target, toPosition)
|
||||
if item:getId() == 2566 then
|
||||
item:transform(2567, 1)
|
||||
item:decay()
|
||||
elseif item:getId() == 2567 then
|
||||
player:sendCancelMessage("It doesn't move.")
|
||||
elseif item:getId() == 2569 then
|
||||
item:transform(2570, 1)
|
||||
item:decay()
|
||||
elseif item:getId() == 2570 then
|
||||
item:transform(2569, 1)
|
||||
item:decay()
|
||||
end
|
||||
return true
|
||||
end
|
16
data/actions/scripts/misc/teleporters.lua
Normal file
16
data/actions/scripts/misc/teleporters.lua
Normal file
@@ -0,0 +1,16 @@
|
||||
local downstairs = {
|
||||
435
|
||||
}
|
||||
|
||||
local upstairs = {
|
||||
1948, 1968
|
||||
}
|
||||
|
||||
function onUse(player, item, fromPosition, target, toPosition)
|
||||
if table.contains(downstairs, item:getId()) then
|
||||
player:teleportTo(item:getPosition():moveRel(0, 0, 1))
|
||||
elseif table.contains(upstairs, item:getId()) then
|
||||
player:teleportTo(item:getPosition():moveRel(0, 1, -1))
|
||||
end
|
||||
return true
|
||||
end
|
4
data/actions/scripts/misc/time.lua
Normal file
4
data/actions/scripts/misc/time.lua
Normal file
@@ -0,0 +1,4 @@
|
||||
function onUse(player, item, fromPosition, target, toPosition)
|
||||
player:sendTextMessage(MESSAGE_INFO_DESCR, "The time is " .. getFormattedWorldTime() .. ".")
|
||||
return true
|
||||
end
|
13
data/actions/scripts/misc/used_lamp.lua
Normal file
13
data/actions/scripts/misc/used_lamp.lua
Normal file
@@ -0,0 +1,13 @@
|
||||
function onUse(player, item, fromPosition, target, toPosition)
|
||||
if not target:isItem() then
|
||||
return false
|
||||
end
|
||||
|
||||
if target:getId() == 2874 and target:getFluidType() == FLUID_OIL then
|
||||
target:transform(target:getId(), FLUID_NONE)
|
||||
item:transform(2914, 1)
|
||||
item:decay()
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
9
data/actions/scripts/misc/water_pipe.lua
Normal file
9
data/actions/scripts/misc/water_pipe.lua
Normal file
@@ -0,0 +1,9 @@
|
||||
function onUse(player, item, fromPosition, target, toPosition)
|
||||
if math.random(1, 100) <= 90 then
|
||||
item:getPosition():sendMagicEffect(3)
|
||||
return true
|
||||
else
|
||||
player:getPosition():sendMagicEffect(3)
|
||||
end
|
||||
return true
|
||||
end
|
3
data/actions/scripts/misc/weapons.lua
Normal file
3
data/actions/scripts/misc/weapons.lua
Normal file
@@ -0,0 +1,3 @@
|
||||
function onUse(player, item, fromPosition, target, toPosition)
|
||||
return doDestroyItem(target)
|
||||
end
|
Reference in New Issue
Block a user