diff --git a/data-canary/scripts/actions/other/blessing_charms.lua b/data-canary/scripts/actions/other/blessing_charms.lua deleted file mode 100644 index 5a5cd972964..00000000000 --- a/data-canary/scripts/actions/other/blessing_charms.lua +++ /dev/null @@ -1,13 +0,0 @@ -dofile(CORE_DIRECTORY .. "/modules/scripts/blessings/blessings.lua") - -local blessingCharms = Action() - -function blessingCharms.onUse(player, item, fromPosition, target, toPosition, isHotkey) - return Blessings.useCharm(player, item) -end - -for blessingId = 10341, 10345 do - blessingCharms:id(blessingId) -end - -blessingCharms:register() diff --git a/data-canary/scripts/actions/other/blueberry_bush.lua b/data-canary/scripts/actions/other/blueberry_bush.lua deleted file mode 100644 index 4e33c794262..00000000000 --- a/data-canary/scripts/actions/other/blueberry_bush.lua +++ /dev/null @@ -1,11 +0,0 @@ -local blueberryBush = Action() - -function blueberryBush.onUse(player, item, fromPosition, target, toPosition, isHotkey) - item:transform(3700) - item:decay() - Game.createItem(3588, 3, fromPosition) - return true -end - -blueberryBush:id(3699) -blueberryBush:register() diff --git a/data-canary/scripts/actions/other/clay_lump.lua b/data-canary/scripts/actions/other/clay_lump.lua deleted file mode 100644 index 932f35ad744..00000000000 --- a/data-canary/scripts/actions/other/clay_lump.lua +++ /dev/null @@ -1,50 +0,0 @@ -local setting = { - { - chance = { 0.0, 1.54 }, - transformId = 10425, - description = "This little figurine of Brog, the raging Titan, was skillfully made by |PLAYERNAME|.", - }, - { - chance = { 1.54, 9.16 }, - transformId = 10424, - description = "It was made by |PLAYERNAME| and is clearly a little figurine of.. hm, one does not recognise that yet.", - }, - { - chance = { 9.16, 25.48 }, - transformId = 10423, - description = "It was made by |PLAYERNAME|, whose potter skills could use some serious improvement.", - }, - { - chance = { 25.48, 100.0 }, - remove = true, - sound = "Aw man. That did not work out too well.", - }, -} - -local clayLump = Action() - -function clayLump.onUse(player, item, fromPosition, target, toPosition, isHotkey) - local random, tmpItem = math.random(0, 10000) * 0.01 - for i = 1, #setting do - tmpItem = setting[i] - if random >= tmpItem.chance[1] and random < tmpItem.chance[2] then - item:getPosition():sendMagicEffect(CONST_ME_POFF) - if tmpItem.remove then - item:remove() - else - item:transform(tmpItem.transformId) - end - if tmpItem.sound then - player:say(tmpItem.sound, TALKTYPE_MONSTER_SAY, false, player) - end - if tmpItem.description then - item:setAttribute(ITEM_ATTRIBUTE_DESCRIPTION, tmpItem.description:gsub("|PLAYERNAME|", player:getName())) - end - break - end - end - return true -end - -clayLump:id(10422) -clayLump:register() diff --git a/data-canary/scripts/actions/other/piggy_bank.lua b/data-canary/scripts/actions/other/piggy_bank.lua deleted file mode 100644 index 0e290e3f817..00000000000 --- a/data-canary/scripts/actions/other/piggy_bank.lua +++ /dev/null @@ -1,16 +0,0 @@ -local piggyBank = Action() - -function piggyBank.onUse(player, item, fromPosition, target, toPosition, isHotkey) - if math.random(6) == 1 then - item:getPosition():sendMagicEffect(CONST_ME_POFF) - player:addItem(ITEM_GOLD_COIN, 1) - item:transform(2996) - else - item:getPosition():sendMagicEffect(CONST_ME_SOUND_YELLOW) - player:addItem(ITEM_PLATINUM_COIN, 1) - end - return true -end - -piggyBank:id(2995) -piggyBank:register() diff --git a/data-canary/scripts/actions/other/watch.lua b/data-canary/scripts/actions/other/watch.lua deleted file mode 100644 index 23ced8b0a61..00000000000 --- a/data-canary/scripts/actions/other/watch.lua +++ /dev/null @@ -1,9 +0,0 @@ -local watch = Action() - -function watch.onUse(player, item, fromPosition, target, toPosition, isHotkey) - player:sendTextMessage(MESSAGE_LOOK, "The time is " .. getFormattedWorldTime() .. ".") - return true -end - -watch:id(751, 2445, 2446, 2447, 2448, 2906, 2771) -watch:register() diff --git a/data-canary/scripts/actions/other/waterpipe.lua b/data-canary/scripts/actions/other/waterpipe.lua deleted file mode 100644 index 45e114b9db9..00000000000 --- a/data-canary/scripts/actions/other/waterpipe.lua +++ /dev/null @@ -1,13 +0,0 @@ -local waterpipe = Action() - -function waterpipe.onUse(player, item, fromPosition, target, toPosition, isHotkey) - if math.random(3) == 1 then - item:getPosition():sendMagicEffect(CONST_ME_POFF) - else - player:getPosition():sendMagicEffect(CONST_ME_POFF) - end - return true -end - -waterpipe:id(2974, 2980) -waterpipe:register() diff --git a/data-canary/scripts/movements/cake.lua b/data-canary/scripts/movements/cake.lua deleted file mode 100644 index 7e917e4f978..00000000000 --- a/data-canary/scripts/movements/cake.lua +++ /dev/null @@ -1,14 +0,0 @@ -local cake = MoveEvent() -cake:type("additem") - -function cake.onAddItem(moveitem, tileitem, position) - if moveitem.itemid == 2918 then - tileitem:transform(6280) - moveitem:remove() - position:sendMagicEffect(CONST_ME_MAGIC_RED) - end - return true -end - -cake:id(6279) -cake:register() diff --git a/data-canary/scripts/movements/decay_to.lua b/data-canary/scripts/movements/decay_to.lua deleted file mode 100644 index f87123fe165..00000000000 --- a/data-canary/scripts/movements/decay_to.lua +++ /dev/null @@ -1,19 +0,0 @@ -local setting = { - [293] = 294, - [475] = 476, - [1066] = 1067, -} - -local decayTo = MoveEvent() -decayTo:type("stepin") - -function decayTo.onStepIn(creature, item, position, fromPosition) - item:transform(setting[item.itemid]) - return true -end - -for index, value in pairs(setting) do - decayTo:id(index) -end - -decayTo:register() diff --git a/data-canary/scripts/movements/dough.lua b/data-canary/scripts/movements/dough.lua deleted file mode 100644 index 01173a56241..00000000000 --- a/data-canary/scripts/movements/dough.lua +++ /dev/null @@ -1,16 +0,0 @@ -local dough = MoveEvent() -dough:type("additem") - -function dough.onAddItem(moveitem, tileitem, position) - if moveitem.itemid == 3604 then - moveitem:transform(3600) - position:sendMagicEffect(CONST_ME_HITBYFIRE) - elseif moveitem.itemid == 6276 then - moveitem:transform(3598, 12) - position:sendMagicEffect(CONST_ME_HITBYFIRE) - end - return true -end - -dough:id(2535, 2537, 2539, 2541) -dough:register() diff --git a/data-canary/scripts/movements/trap.lua b/data-canary/scripts/movements/trap.lua deleted file mode 100644 index d3f537548cd..00000000000 --- a/data-canary/scripts/movements/trap.lua +++ /dev/null @@ -1,54 +0,0 @@ -local traps = { - [2145] = { transformTo = 2146, damage = { -50, -100 } }, - [2147] = { transformTo = 2148, damage = { -50, -100 } }, - [3481] = { transformTo = 3482, damage = { -15, -30 } }, - [3944] = { transformTo = 3945, damage = { -15, -30 }, type = COMBAT_EARTHDAMAGE }, -} - -local trap = MoveEvent() -trap:type("stepin") - -function trap.onStepIn(creature, item, position, fromPosition) - local trap = traps[item.itemid] - if not trap then - return true - end - - if creature:isMonster() then - doTargetCombatHealth(0, creature, trap.type or COMBAT_PHYSICALDAMAGE, trap.damage[1], trap.damage[2], CONST_ME_NONE) - end - - if trap.transformTo then - item:transform(trap.transformTo) - end - return true -end - -trap:id(2145, 2147, 3481, 3944) -trap:register() - -trap = MoveEvent() -trap:type("stepout") - -function trap.onStepOut(creature, item, position, fromPosition) - item:transform(item.itemid - 1) - return true -end - -trap:id(2146) -trap:register() - -trap = MoveEvent() -trap:type("removeitem") - -function trap.onRemoveItem(item, position) - local itemPosition = item:getPosition() - if itemPosition:getDistance(position) > 0 then - item:transform(tileitem.itemid - 1) - position:sendMagicEffect(CONST_ME_POFF) - end - return true -end - -trap:id(3482) -trap:register() diff --git a/data-otservbr-global/scripts/actions/other/check_bless.lua b/data-otservbr-global/scripts/actions/other/check_bless.lua deleted file mode 100644 index 0d2478f5f11..00000000000 --- a/data-otservbr-global/scripts/actions/other/check_bless.lua +++ /dev/null @@ -1,10 +0,0 @@ -dofile(CORE_DIRECTORY .. "/modules/scripts/blessings/blessings.lua") - -local checkBless = Action() - -function checkBless.onUse(player, item, fromPosition, target, toPosition, isHotkey) - return Blessings.checkBless(player) -end - -checkBless:id(6561, 11468) -checkBless:register() diff --git a/data-otservbr-global/scripts/actions/other/lottery_ticket.lua b/data-otservbr-global/scripts/actions/other/lottery_ticket.lua deleted file mode 100644 index 9411590088b..00000000000 --- a/data-otservbr-global/scripts/actions/other/lottery_ticket.lua +++ /dev/null @@ -1,15 +0,0 @@ -local lotteryTicket = Action() - -function lotteryTicket.onUse(player, item, fromPosition, target, toPosition, isHotkey) - if math.random(98) == 1 then - player:getPosition():sendMagicEffect(CONST_ME_SOUND_YELLOW) - item:transform(5958) - else - item:getPosition():sendMagicEffect(CONST_ME_POFF) - item:remove(1) - end - return true -end - -lotteryTicket:id(5957) -lotteryTicket:register() diff --git a/data-otservbr-global/scripts/actions/other/party_hat.lua b/data-otservbr-global/scripts/actions/other/party_hat.lua deleted file mode 100644 index 0652786d737..00000000000 --- a/data-otservbr-global/scripts/actions/other/party_hat.lua +++ /dev/null @@ -1,14 +0,0 @@ -local partyHat = Action() - -function partyHat.onUse(player, item, fromPosition, target, toPosition, isHotkey) - local slot = player:getSlotItem(CONST_SLOT_HEAD) - if slot and item.uid == slot.uid then - player:addAchievementProgress("Party Animal", 200) - player:getPosition():sendMagicEffect(CONST_ME_GIFT_WRAPS) - return true - end - return false -end - -partyHat:id(6578) -partyHat:register() diff --git a/data-otservbr-global/scripts/actions/other/sweet_heart.lua b/data-otservbr-global/scripts/actions/other/sweet_heart.lua deleted file mode 100644 index 1a2c7caf277..00000000000 --- a/data-otservbr-global/scripts/actions/other/sweet_heart.lua +++ /dev/null @@ -1,20 +0,0 @@ -local sweetHeart = Action() - -function sweetHeart.onUse(cid, item, fromPosition, itemEx, toPosition) - local player = Player(cid) - if not player then - return false - end - - if player:getSlotItem(CONST_SLOT_RING) then - if player:getSlotItem(CONST_SLOT_RING):getId() == item:getId() then - player:getPosition():sendMagicEffect(CONST_ME_HEARTS) - end - else - return false - end - return true -end - -sweetHeart:id(21955) -sweetHeart:register() diff --git a/data-otservbr-global/scripts/actions/other/blessing_charms.lua b/data/scripts/actions/items/blessing_charms.lua similarity index 100% rename from data-otservbr-global/scripts/actions/other/blessing_charms.lua rename to data/scripts/actions/items/blessing_charms.lua diff --git a/data-otservbr-global/scripts/actions/other/blueberry_bush.lua b/data/scripts/actions/items/blueberry_bush.lua similarity index 100% rename from data-otservbr-global/scripts/actions/other/blueberry_bush.lua rename to data/scripts/actions/items/blueberry_bush.lua diff --git a/data-canary/scripts/actions/other/check_bless.lua b/data/scripts/actions/items/check_bless.lua similarity index 100% rename from data-canary/scripts/actions/other/check_bless.lua rename to data/scripts/actions/items/check_bless.lua diff --git a/data-otservbr-global/scripts/actions/other/clay_lump.lua b/data/scripts/actions/items/clay_lump.lua similarity index 67% rename from data-otservbr-global/scripts/actions/other/clay_lump.lua rename to data/scripts/actions/items/clay_lump.lua index f8f0f852546..eb71c84814a 100644 --- a/data-otservbr-global/scripts/actions/other/clay_lump.lua +++ b/data/scripts/actions/items/clay_lump.lua @@ -8,31 +8,29 @@ local config = { local clayLump = Action() function clayLump.onUse(player, item, fromPosition, target, toPosition, isHotkey) - local random, tmpItem = math.random(0, 10000) * 0.01 - for i = 1, #config do - tmpItem = config[i] - if random >= tmpItem.chance[1] and random < tmpItem.chance[2] then + local randomChance = math.random() * 100 + for _, itemConfig in ipairs(config) do + if randomChance >= itemConfig.chance[1] and randomChance < itemConfig.chance[2] then item:getPosition():sendMagicEffect(CONST_ME_POFF) - if tmpItem.remove then + if itemConfig.remove then item:remove() else - item:transform(tmpItem.transformId) + item:transform(itemConfig.transformId) end - if tmpItem.sound then - player:say(tmpItem.sound, TALKTYPE_MONSTER_SAY, false, player) + if itemConfig.sound then + player:say(itemConfig.sound, TALKTYPE_MONSTER_SAY, false, player) end - if tmpItem.description then - item:setDescription(tmpItem.description:gsub("|PLAYERNAME|", player:getName())) + if itemConfig.description then + item:setDescription(itemConfig.description:gsub("|PLAYERNAME|", player:getName())) end - if tmpItem.achievement then + if itemConfig.achievement then player:addAchievement("Clay Fighter") player:addAchievementProgress("Clay to Fame", 5) end - break end end diff --git a/data-canary/scripts/actions/other/lottery_ticket.lua b/data/scripts/actions/items/lottery_ticket.lua similarity index 100% rename from data-canary/scripts/actions/other/lottery_ticket.lua rename to data/scripts/actions/items/lottery_ticket.lua diff --git a/data-canary/scripts/actions/other/party_hat.lua b/data/scripts/actions/items/party_hat.lua similarity index 87% rename from data-canary/scripts/actions/other/party_hat.lua rename to data/scripts/actions/items/party_hat.lua index 38b28661b2d..dad167573d5 100644 --- a/data-canary/scripts/actions/other/party_hat.lua +++ b/data/scripts/actions/items/party_hat.lua @@ -7,6 +7,7 @@ function partyHat.onUse(player, item, fromPosition, target, toPosition, isHotkey end player:getPosition():sendMagicEffect(CONST_ME_GIFT_WRAPS) + player:addAchievementProgress("Party Animal", 200) return true end diff --git a/data-otservbr-global/scripts/actions/other/piggy_bank.lua b/data/scripts/actions/items/piggy_bank.lua similarity index 100% rename from data-otservbr-global/scripts/actions/other/piggy_bank.lua rename to data/scripts/actions/items/piggy_bank.lua diff --git a/data-canary/scripts/actions/other/premium_scroll.lua b/data/scripts/actions/items/premium_scroll.lua similarity index 100% rename from data-canary/scripts/actions/other/premium_scroll.lua rename to data/scripts/actions/items/premium_scroll.lua diff --git a/data-canary/scripts/actions/other/sweetheart_ring.lua b/data/scripts/actions/items/sweetheart_ring.lua similarity index 100% rename from data-canary/scripts/actions/other/sweetheart_ring.lua rename to data/scripts/actions/items/sweetheart_ring.lua diff --git a/data-otservbr-global/scripts/actions/other/water_pipe.lua b/data/scripts/actions/items/water_pipe.lua similarity index 100% rename from data-otservbr-global/scripts/actions/other/water_pipe.lua rename to data/scripts/actions/items/water_pipe.lua diff --git a/data-otservbr-global/scripts/actions/other/watch.lua b/data/scripts/actions/tools/watch.lua similarity index 100% rename from data-otservbr-global/scripts/actions/other/watch.lua rename to data/scripts/actions/tools/watch.lua diff --git a/data-otservbr-global/scripts/movements/others/cake.lua b/data/scripts/movements/cake.lua similarity index 92% rename from data-otservbr-global/scripts/movements/others/cake.lua rename to data/scripts/movements/cake.lua index 3f1e5781a47..a7ab2eef569 100644 --- a/data-otservbr-global/scripts/movements/others/cake.lua +++ b/data/scripts/movements/cake.lua @@ -1,7 +1,6 @@ local cake = MoveEvent() function cake.onAddItem(moveitem, tileitem, position) - -- has to be a candle if moveitem.itemid ~= 2918 then return true end diff --git a/data-otservbr-global/scripts/movements/others/decay.lua b/data/scripts/movements/decay_to.lua similarity index 100% rename from data-otservbr-global/scripts/movements/others/decay.lua rename to data/scripts/movements/decay_to.lua diff --git a/data-otservbr-global/scripts/movements/others/dough.lua b/data/scripts/movements/dough.lua similarity index 100% rename from data-otservbr-global/scripts/movements/others/dough.lua rename to data/scripts/movements/dough.lua diff --git a/data-otservbr-global/scripts/movements/others/trap.lua b/data/scripts/movements/trap.lua similarity index 100% rename from data-otservbr-global/scripts/movements/others/trap.lua rename to data/scripts/movements/trap.lua