From 7d90b9a9270d6dbd0345727a0fc380759d95aef3 Mon Sep 17 00:00:00 2001 From: Elson Costa Date: Thu, 22 Feb 2024 14:43:45 -0300 Subject: [PATCH] fix: scripts and achievements (#2301) Co-authored-by: Jonyrewind --- .../scripts/actions/tools/toolgear.lua | 23 ----- data-otservbr-global/lib/core/storages.lua | 3 + .../scripts/actions/other/fishing.lua | 4 + .../quests/cults_of_tibia/bosses_levers.lua | 14 +-- .../scripts/actions/tools/skinning.lua | 87 ++++++++++++++++--- .../scripts/actions/tools/toolgear.lua | 15 ---- data/libs/functions/functions.lua | 6 +- data/npclib/npc_system/modules.lua | 1 + .../actions/items/usable_outfit_items.lua | 36 +++++--- data/scripts/actions/tools/toolgear.lua | 23 +++++ data/scripts/lib/register_actions.lua | 3 + data/scripts/lib/register_lever_tables.lua | 2 +- 12 files changed, 143 insertions(+), 74 deletions(-) delete mode 100644 data-canary/scripts/actions/tools/toolgear.lua delete mode 100644 data-otservbr-global/scripts/actions/tools/toolgear.lua create mode 100644 data/scripts/actions/tools/toolgear.lua diff --git a/data-canary/scripts/actions/tools/toolgear.lua b/data-canary/scripts/actions/tools/toolgear.lua deleted file mode 100644 index c7dacca1968..00000000000 --- a/data-canary/scripts/actions/tools/toolgear.lua +++ /dev/null @@ -1,23 +0,0 @@ -local toolgear = Action() - -function toolgear.onUse(player, item, fromPosition, target, toPosition, isHotkey) - if math.random(100) > 5 then - return ActionsLib.useRope(player, item, fromPosition, target, toPosition, isHotkey) - or ActionsLib.useShovel(player, item, fromPosition, target, toPosition, isHotkey) - or ActionsLib.usePick(player, item, fromPosition, target, toPosition, isHotkey) - or ActionsLib.useMachete(player, item, fromPosition, target, toPosition, isHotkey) - or ActionsLib.useCrowbar(player, item, fromPosition, target, toPosition, isHotkey) - or ActionsLib.useSpoon(player, item, fromPosition, target, toPosition, isHotkey) - or ActionsLib.useScythe(player, item, fromPosition, target, toPosition, isHotkey) - or ActionsLib.useSickle(player, item, fromPosition, target, toPosition, isHotkey) - or ActionsLib.useKitchenKnife(player, item, fromPosition, target, toPosition, isHotkey) - else - player:say("Oh no! Your tool is jammed and can't be used for a minute.", TALKTYPE_MONSTER_SAY) - item:transform(item.itemid + 1) - item:decay() - end - return true -end - -toolgear:id(9594, 9596, 9598) -toolgear:register() diff --git a/data-otservbr-global/lib/core/storages.lua b/data-otservbr-global/lib/core/storages.lua index f8d8922b9f1..8dd5ff45a61 100644 --- a/data-otservbr-global/lib/core/storages.lua +++ b/data-otservbr-global/lib/core/storages.lua @@ -2105,6 +2105,9 @@ Storage = { JumpTimer = 41841, }, VampireHunter = {}, + TheMutatedPumpkin = { + Skinned = 41860, + }, }, U8_4 = { -- update 8.4 - Reserved Storages 41901 - 42145 BloodBrothers = { diff --git a/data-otservbr-global/scripts/actions/other/fishing.lua b/data-otservbr-global/scripts/actions/other/fishing.lua index f9e27ccb7cd..86a53075dd9 100644 --- a/data-otservbr-global/scripts/actions/other/fishing.lua +++ b/data-otservbr-global/scripts/actions/other/fishing.lua @@ -118,16 +118,20 @@ function fishing.onUse(player, item, fromPosition, target, toPosition, isHotkey) local rareChance = math.random(100) if rareChance == 1 then player:addItem(7158, 1) + player:addAchievementProgress("Exquisite Taste", 250) return true elseif rareChance <= 4 then player:addItem(3580, 1) + player:addAchievementProgress("Exquisite Taste", 250) return true elseif rareChance <= 10 then player:addItem(7159, 1) + player:addAchievementProgress("Exquisite Taste", 250) return true end end player:addItem(3578, 1) + player:addAchievementProgress("Here, Fishy Fishy!", 250) end return true end diff --git a/data-otservbr-global/scripts/actions/quests/cults_of_tibia/bosses_levers.lua b/data-otservbr-global/scripts/actions/quests/cults_of_tibia/bosses_levers.lua index 7c974fb939b..0bbad4d1e32 100644 --- a/data-otservbr-global/scripts/actions/quests/cults_of_tibia/bosses_levers.lua +++ b/data-otservbr-global/scripts/actions/quests/cults_of_tibia/bosses_levers.lua @@ -193,7 +193,7 @@ function cultsOfTibiaLevers.onUse(player, item, fromPosition, itemEx, toPosition Game.createMonster("Wine Cask", Position(33162, 31945, 15)) local leiden = Game.createMonster("Leiden", Position(33162, 31950, 15)) leiden:setHealth(leiden:getHealth() / 2) - kickerPlayerRoomAfferMin(convertTable, frompos, topos, Position(33121, 31951, 15), "You were kicked for exceeding the time limit within the boss room.", "", 60, true, ittable, blockmonsters) + kickerPlayerRoomAfterMin(convertTable, frompos, topos, Position(33121, 31951, 15), "You were kicked for exceeding the time limit within the boss room.", "", 60, true, ittable, blockmonsters) end end if item:getActionId() == 5502 and item:getId() == 8912 then -- The False God @@ -241,7 +241,7 @@ function cultsOfTibiaLevers.onUse(player, item, fromPosition, itemEx, toPosition addEvent(transformMonster, 13 * 15000, 3, 3, "Sphere Of Wrath", {}, {}, 0) Game.createMonster("The False God", Position(33159, 31914, 15)) -- funçao - kickerPlayerRoomAfferMin(convertTable, frompos, topos, Position(33181, 31894, 15), "You were kicked for exceeding the time limit within the boss room.", "", 60, true, ittable, blockmonsters) + kickerPlayerRoomAfterMin(convertTable, frompos, topos, Position(33181, 31894, 15), "You were kicked for exceeding the time limit within the boss room.", "", 60, true, ittable, blockmonsters) end end @@ -285,7 +285,7 @@ function cultsOfTibiaLevers.onUse(player, item, fromPosition, itemEx, toPosition player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) end end - kickerPlayerRoomAfferMin(convertTable, frompos, topos, Position(33091, 31963, 15), "You were kicked for exceeding the time limit within the boss room.", "", 60, true, ittable, blockmonsters) + kickerPlayerRoomAfterMin(convertTable, frompos, topos, Position(33091, 31963, 15), "You were kicked for exceeding the time limit within the boss room.", "", 60, true, ittable, blockmonsters) Game.createMonster("Pillar of Summoning", Position(33093, 31919, 15)) Game.createMonster("Pillar of Death", Position(33098, 31915, 15)) Game.createMonster("Pillar of Protection", Position(33103, 31919, 15)) @@ -339,7 +339,7 @@ function cultsOfTibiaLevers.onUse(player, item, fromPosition, itemEx, toPosition player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) end end - kickerPlayerRoomAfferMin(convertTable, frompos, topos, Position(33109, 31887, 15), "You were kicked for exceeding the time limit within the boss room.", "", 60, true, ittable, blockmonsters) + kickerPlayerRoomAfterMin(convertTable, frompos, topos, Position(33109, 31887, 15), "You were kicked for exceeding the time limit within the boss room.", "", 60, true, ittable, blockmonsters) Game.createMonster("The Sinister Hermit Dirty", Position(33131, 31925, 15)) ativarGeyser() end @@ -429,7 +429,7 @@ function cultsOfTibiaLevers.onUse(player, item, fromPosition, itemEx, toPosition Game.createMonster("Containment Machine", Position(33133, 31864, 15)):registerEvent("MachineDeath") Game.createMonster("The Armored Voidborn", Position(33135, 31859, 15)):registerEvent("MachineDeath") - kickerPlayerRoomAfferMin(convertTable, frompos, topos, Position(33179, 31840, 15), "You were kicked for exceeding the time limit within the boss room.", "", 60, true, ittable, blockmonsters) + kickerPlayerRoomAfterMin(convertTable, frompos, topos, Position(33179, 31840, 15), "You were kicked for exceeding the time limit within the boss room.", "", 60, true, ittable, blockmonsters) end end if item:getActionId() == 5505 then -- Boss da areia @@ -485,7 +485,7 @@ function cultsOfTibiaLevers.onUse(player, item, fromPosition, itemEx, toPosition Game.createMonster("the sandking fake", Position(33099, 31858, 15)):registerEvent("SandkingThink") Game.setStorageValue("sandking", 1) - kickerPlayerRoomAfferMin(convertTable, frompos, topos, Position(33459, 32269, 10), "You were kicked for exceeding the time limit within the boss room.", "", 60, true, ittable, blockmonsters) + kickerPlayerRoomAfterMin(convertTable, frompos, topos, Position(33459, 32269, 10), "You were kicked for exceeding the time limit within the boss room.", "", 60, true, ittable, blockmonsters) end end @@ -531,7 +531,7 @@ function cultsOfTibiaLevers.onUse(player, item, fromPosition, itemEx, toPosition spawnDarkSoul(1, 30) spawnDarkSoul(2, 30) spawnStolenSoul(30) - kickerPlayerRoomAfferMin(convertTable, frompos, topos, Position(33072, 31867, 15), "You were kicked for exceeding the time limit within the boss room.", "", 60, true, ittable, blockmonsters) + kickerPlayerRoomAfterMin(convertTable, frompos, topos, Position(33072, 31867, 15), "You were kicked for exceeding the time limit within the boss room.", "", 60, true, ittable, blockmonsters) end end return true diff --git a/data-otservbr-global/scripts/actions/tools/skinning.lua b/data-otservbr-global/scripts/actions/tools/skinning.lua index b87f9c92cca..f6785f91378 100644 --- a/data-otservbr-global/scripts/actions/tools/skinning.lua +++ b/data-otservbr-global/scripts/actions/tools/skinning.lua @@ -1,4 +1,3 @@ ----- if you want protected corpses (10 second protection after monster being killed) to be skinned/dusted, delete '--#' in the appropriate lines; be careful, it may cause abuses ---- local CREATURE_SKINNING_CHANCE = 25000 -- 25% probability local config = { [5908] = { @@ -70,10 +69,28 @@ local config = { [22742] = { value = CREATURE_SKINNING_CHANCE, newItem = 22186, after = 22744 }, -- after being killed -- The Mutated Pumpkin - [12816] = { { value = 5000, newItem = 123 }, { value = 10000, newItem = 653 }, { value = 20000, 6491 }, { value = 26764, newItem = 8032 }, { value = 45000, newItem = 3594 }, { value = 60000, newItem = 2977 }, { value = 90000, newItem = 8177, amount = 50 } }, + [12816] = { + { value = 5000, newItem = 8032 }, -- spiderwebs + { value = 5000, newItem = 8178 }, -- toy spider + { value = 5000, newItem = 6491 }, -- bat decoration + { value = 20000, newItem = 6525 }, -- skeleton decoration + { value = 90000, newItem = 8177, amount = 20 }, -- yummy gummy worm + { value = 10000, newItem = 6571 }, -- surprise bag (red) + { value = 10000, newItem = 6570 }, -- surprise bag (blue) + { value = 50000, newItem = 6574 }, -- bar of chocolate + { value = 60000, newItem = 2977 }, -- pumpkinhead + { value = 45000, newItem = 3594 }, -- pumpkin + { value = 90000, newItem = 3599, amount = 50 }, -- candy cane + { value = 90000, newItem = 6569, amount = 50 }, -- candy + { value = 2000, newItem = 6574, amount = 50 }, -- bar of chocolate + }, -- Marble - [10426] = { { value = 10000, newItem = 10429, desc = "This little figurine of Tibiasula was masterfully sculpted by |PLAYERNAME|." }, { value = 26764, newItem = 10428, desc = "This little figurine made by |PLAYERNAME| has some room for improvement." }, { value = 60000, newItem = 10427, desc = "This shoddy work was made by |PLAYERNAME|." } }, + [10426] = { + { value = 10000, newItem = 10429, desc = "This little figurine of Tibiasula was masterfully sculpted by |PLAYERNAME|." }, + { value = 26764, newItem = 10428, desc = "This little figurine made by |PLAYERNAME| has some room for improvement." }, + { value = 60000, newItem = 10427, desc = "This shoddy work was made by |PLAYERNAME|." }, + }, -- Ice Cube [7441] = { value = 22344, newItem = 7442 }, @@ -101,7 +118,15 @@ local config = { local skinning = Action() function skinning.onUse(player, item, fromPosition, target, toPosition, isHotkey) + local topItem = false local skin = config[item.itemid][target.itemid] + local tile = Tile(toPosition) + if tile then + topItem = tile:getTopDownItem() + if topItem then + skin = config[item.itemid][topItem.itemid] + end + end if item.itemid == 5908 then if target:getId() == CONST_FIREWORK_ITEMID_DISASSEMBLE then @@ -146,6 +171,22 @@ function skinning.onUse(player, item, fromPosition, target, toPosition, isHotkey end end + if target:getId() == 12816 then + if player:getStorageValue(Storage.Quest.U8_2.TheMutatedPumpkin.Skinned) > os.time() then + player:sendCancelMessage("You already used your knife on the corpse.") + return true + end + + player:setStorageValue(Storage.Quest.U8_2.TheMutatedPumpkin.Skinned, os.time() + 4 * 60 * 60) + player:say("Happy Halloween!", TALKTYPE_MONSTER_SAY) + player:getPosition():sendMagicEffect(CONST_ME_GIFT_WRAPS) + player:addAchievement("Mutated Presents") + local reward = math.random(1, #skin) + player:addItem(skin[reward].newItem, skin[reward].amount or 1) + effect = CONST_ME_HITAREA + return true + end + if not skin then player:sendCancelMessage(RETURNVALUE_NOTPOSSIBLE) return true @@ -167,11 +208,15 @@ function skinning.onUse(player, item, fromPosition, target, toPosition, isHotkey _skin = skin[i] if random <= _skin.value then if target.itemid == 10426 then - target:getPosition():sendMagicEffect(CONST_ME_ICEAREA) + target:getPosition():sendMagicEffect(CONST_ME_HITAREA) local gobletItem = player:addItem(_skin.newItem, _skin.amount or 1) if gobletItem then gobletItem:setDescription(_skin.desc:gsub("|PLAYERNAME|", player:getName())) end + if _skin.newItem == 10429 then + player:addAchievement("Marblelous") + player:addAchievementProgress("Marble Madness", 5) + end target:remove() added = true else @@ -182,11 +227,9 @@ function skinning.onUse(player, item, fromPosition, target, toPosition, isHotkey end end - if not added and target.itemid == 12816 then - effect = CONST_ME_POFF - transform = false - elseif not added and target.itemid == 10426 then - effect = CONST_ME_POFF + if not added and target.itemid == 10426 then + effect = CONST_ME_HITAREA + player:say("Your attempt at shaping that marble rock failed miserably.", TALKTYPE_MONSTER_SAY) transform = false target:remove() end @@ -194,11 +237,23 @@ function skinning.onUse(player, item, fromPosition, target, toPosition, isHotkey if isInArray({ 7441, 7442, 7444, 7445 }, target.itemid) then if skin.newItem == 7446 then player:addAchievement("Ice Sculptor") + player:addAchievementProgress("Cold as Ice", 10) end target:transform(skin.newItem, 1) effect = CONST_ME_HITAREA + return true else - player:addItem(skin.newItem, skin.amount or 1) + if table.contains({ 5906, 5905 }, skin.newItem) then + player:addAchievementProgress("Ashes to Dust", 500) + else + player:addAchievementProgress("Skin-Deep", 500) + end + local container = Container(item:getParent().uid) + if fromPosition.x == CONTAINER_POSITION and container:getEmptySlots() ~= 0 then + container:addItem(skin.newItem, skin.amount or 1) + else + player:addItem(skin.newItem, skin.amount or 1) + end end else if isInArray({ 7441, 7442, 7444, 7445 }, target.itemid) then @@ -206,17 +261,21 @@ function skinning.onUse(player, item, fromPosition, target, toPosition, isHotkey effect = CONST_ME_HITAREA target:remove() else - effect = CONST_ME_POFF + effect = CONST_ME_BLOCKHIT end end - -- SE BUGAR, PEGAR SCRIPT ANTIGO - toPosition:sendMagicEffect(effect) + if transform then - target:transform(skin.after or target:getType():getDecayId() or target.itemid + 1) + topItem:transform(skin.after or topItem:getType():getDecayId() or topItem.itemid + 1) else target:remove() end + if toPosition.x == CONTAINER_POSITION then + toPosition = player:getPosition() + end + toPosition:sendMagicEffect(effect) + return true end diff --git a/data-otservbr-global/scripts/actions/tools/toolgear.lua b/data-otservbr-global/scripts/actions/tools/toolgear.lua deleted file mode 100644 index 7afafd32bea..00000000000 --- a/data-otservbr-global/scripts/actions/tools/toolgear.lua +++ /dev/null @@ -1,15 +0,0 @@ -local toolGear = Action() - -function toolGear.onUse(player, item, fromPosition, target, toPosition, isHotkey) - return onUseRope(player, item, fromPosition, target, toPosition, isHotkey) - or onUseShovel(player, item, fromPosition, target, toPosition, isHotkey) - or onUsePick(player, item, fromPosition, target, toPosition, isHotkey) - or onUseMachete(player, item, fromPosition, target, toPosition, isHotkey) - or onUseCrowbar(player, item, fromPosition, target, toPosition, isHotkey) - or onUseSpoon(player, item, fromPosition, target, toPosition, isHotkey) - or onUseScythe(player, item, fromPosition, target, toPosition, isHotkey) - or onUseKitchenKnife(player, item, fromPosition, target, toPosition, isHotkey) -end - -toolGear:id(9594, 9596, 9598) -toolGear:register() diff --git a/data/libs/functions/functions.lua b/data/libs/functions/functions.lua index 422d0df212a..9eb1b0b57b5 100644 --- a/data/libs/functions/functions.lua +++ b/data/libs/functions/functions.lua @@ -588,7 +588,7 @@ function cleanAreaQuest(frompos, topos, itemtable, blockmonsters) return true end -function kickerPlayerRoomAfferMin(playername, fromPosition, toPosition, teleportPos, message, monsterName, minutes, firstCall, itemtable, blockmonsters) +function kickerPlayerRoomAfterMin(playername, fromPosition, toPosition, teleportPos, message, monsterName, minutes, firstCall, itemtable, blockmonsters) local players = false if type(playername) == table then players = true @@ -658,7 +658,7 @@ function kickerPlayerRoomAfferMin(playername, fromPosition, toPosition, teleport end local min = 60 -- Use the 60 for 1 minute if firstCall then - addEvent(kickerPlayerRoomAfferMin, 1000, playername, fromPosition, toPosition, teleportPos, message, monsterName, minutes, false, itemtable, blockmonsters) + addEvent(kickerPlayerRoomAfterMin, 1000, playername, fromPosition, toPosition, teleportPos, message, monsterName, minutes, false, itemtable, blockmonsters) else local subt = minutes - 1 if monsterName ~= "" then @@ -666,7 +666,7 @@ function kickerPlayerRoomAfferMin(playername, fromPosition, toPosition, teleport subt = 2 end end - addEvent(kickerPlayerRoomAfferMin, min * 1000, playername, fromPosition, toPosition, teleportPos, message, monsterName, subt, false, itemtable, blockmonsters) + addEvent(kickerPlayerRoomAfterMin, min * 1000, playername, fromPosition, toPosition, teleportPos, message, monsterName, subt, false, itemtable, blockmonsters) end end diff --git a/data/npclib/npc_system/modules.lua b/data/npclib/npc_system/modules.lua index 5e7db715080..f9177d9c96d 100644 --- a/data/npclib/npc_system/modules.lua +++ b/data/npclib/npc_system/modules.lua @@ -240,6 +240,7 @@ if Modules == nil then player:kv():set("npc-exhaustion", os.time() + 3) -- 3 seconds player:teleportTo(destination) playerPosition:sendMagicEffect(CONST_ME_TELEPORT) + player:addAchievementProgress("Ship's Kobold", 1250) -- What a foolish Quest - Mission 3 if Storage.WhatAFoolish.PieBoxTimer ~= nil then diff --git a/data/scripts/actions/items/usable_outfit_items.lua b/data/scripts/actions/items/usable_outfit_items.lua index f9e3b5b61dd..faa5a5af0eb 100644 --- a/data/scripts/actions/items/usable_outfit_items.lua +++ b/data/scripts/actions/items/usable_outfit_items.lua @@ -10,25 +10,29 @@ local outfitConfig = { [16257] = { female = 513, male = 512, addon = 2, effect = CONST_ME_GIANTICE, achievement = "Crystal Clear" }, -- makeshift warrior - [27655] = { female = 1043, male = 1042 }, - [27657] = { female = 1043, male = 1042, addon = 1, achievement = "Cobbled and Patched" }, - [27656] = { female = 1043, male = 1042, addon = 2, achievement = "Cobbled and Patched" }, + [27655] = { female = 1043, male = 1042, whiteText = "By using the plan you knock together a makeshift armour out of wooden planks, rusty nails and leather rags." }, + [27657] = { female = 1043, male = 1042, addon = 1, achievement = "Cobbled and Patched", whiteText = "You use the wooden planks to knock up a makeshift shield and weapon." }, + [27656] = { female = 1043, male = 1042, addon = 2, achievement = "Cobbled and Patched", whiteText = "You use the tinged pot as a makeshift helmet." }, -- hand of the inquisition [31738] = { female = 1244, male = 1243, addon = 1, effect = CONST_ME_HOLYAREA, achievement = "Inquisition's Arm" }, [31737] = { female = 1244, male = 1243, addon = 2, effect = CONST_ME_HOLYAREA, achievement = "Inquisition's Arm" }, -- poltergeist - [32630] = { female = 1271, male = 1270, addon = 1, effect = CONST_ME_BLUE_GHOST, achievement = "Mainstreet Nightmare" }, - [32631] = { female = 1271, male = 1270, addon = 2, effect = CONST_ME_BLUE_GHOST, achievement = "Mainstreet Nightmare" }, + [32630] = { female = 1271, male = 1270, addon = 1, effect = CONST_ME_BLUE_GHOST, achievement = "Mainstreet Nightmare", orangeText = "The spooky hood is yours!" }, + [32631] = { female = 1271, male = 1270, addon = 2, effect = CONST_ME_BLUE_GHOST, achievement = "Mainstreet Nightmare", orangeText = "You can use the ghost claw now!" }, + + -- revenant + [34075] = { female = 1323, male = 1322, addon = 1, effect = CONST_ME_HOLYAREA, achievement = "Unleash the Beast", orangeText = "Now the beast is unleashed!" }, + [34076] = { female = 1323, male = 1322, addon = 2, effect = CONST_ME_HOLYAREA, achievement = "Unleash the Beast", orangeText = "Wild power flows though your body!" }, -- rascoohan - [35595] = { female = 1372, male = 1371, addon = 1, achievement = "Honorary Rascoohan" }, - [35695] = { female = 1372, male = 1371, addon = 2, achievement = "Honorary Rascoohan" }, + [35595] = { female = 1372, male = 1371, addon = 1, achievement = "Honorary Rascoohan", orangeText = "You feel a bit more raccoonish." }, + [35695] = { female = 1372, male = 1371, addon = 2, achievement = "Honorary Rascoohan", orangeText = "Hmmm, trash cans!!" }, -- fire-fighter - [39544] = { female = 1569, male = 1568, addon = 1, achievement = "Friendly Fire" }, - [39545] = { female = 1569, male = 1568, addon = 2, achievement = "Friendly Fire" }, + [39544] = { female = 1569, male = 1568, addon = 1, achievement = "Friendly Fire", orangeText = "You feel like fighting a fire!" }, + [39545] = { female = 1569, male = 1568, addon = 2, achievement = "Friendly Fire", orangeText = "The flame engulfs you!" }, } local usableOutfitItems = Action() @@ -49,7 +53,12 @@ function usableOutfitItems.onUse(player, item, fromPosition, target, toPosition, player:addOutfit(outfitInfo.female) player:addOutfit(outfitInfo.male) - player:getPosition():sendMagicEffect(outfitInfo.effect) + player:getPosition():sendMagicEffect(outfitInfo.effect or CONST_ME_GIFT_WRAPS) + if outfitInfo.orangeText then + player:say(outfitInfo.orangeText, TALKTYPE_MONSTER_SAY) + elseif outfitInfo.whiteText then + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, outfitInfo.whiteText) + end item:remove(1) return true end @@ -61,7 +70,12 @@ function usableOutfitItems.onUse(player, item, fromPosition, target, toPosition, player:addOutfitAddon(outfitInfo.female, outfitInfo.addon) player:addOutfitAddon(outfitInfo.male, outfitInfo.addon) - player:getPosition():sendMagicEffect(outfitInfo.effect) + player:getPosition():sendMagicEffect(outfitInfo.effect or CONST_ME_GIFT_WRAPS) + if outfitInfo.orangeText then + player:say(outfitInfo.orangeText, TALKTYPE_MONSTER_SAY) + elseif outfitInfo.whiteText then + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, outfitInfo.whiteText) + end if player:hasOutfit(looktype, 3) then player:addAchievement(outfitInfo.achievement) diff --git a/data/scripts/actions/tools/toolgear.lua b/data/scripts/actions/tools/toolgear.lua new file mode 100644 index 00000000000..8db5506c52d --- /dev/null +++ b/data/scripts/actions/tools/toolgear.lua @@ -0,0 +1,23 @@ +local toolGear = Action() + +function toolGear.onUse(player, item, fromPosition, target, toPosition, isHotkey) + if math.random(100) > 5 then + return onUseRope(player, item, fromPosition, target, toPosition, isHotkey) + or onUseShovel(player, item, fromPosition, target, toPosition, isHotkey) + or onUsePick(player, item, fromPosition, target, toPosition, isHotkey) + or onUseMachete(player, item, fromPosition, target, toPosition, isHotkey) + or onUseCrowbar(player, item, fromPosition, target, toPosition, isHotkey) + or onUseSpoon(player, item, fromPosition, target, toPosition, isHotkey) + or onUseScythe(player, item, fromPosition, target, toPosition, isHotkey) + or onUseKitchenKnife(player, item, fromPosition, target, toPosition, isHotkey) + else + player:say("Oh no! Your tool is jammed and can't be used for a minute.", TALKTYPE_MONSTER_SAY) + player:addAchievementProgress("Bad Timing", 10) + item:transform(item.itemid + 1) + item:decay() + end + return true +end + +toolGear:id(9594, 9596, 9598) +toolGear:register() diff --git a/data/scripts/lib/register_actions.lua b/data/scripts/lib/register_actions.lua index 1522ad20417..b8e5f765a2c 100644 --- a/data/scripts/lib/register_actions.lua +++ b/data/scripts/lib/register_actions.lua @@ -471,6 +471,7 @@ function onUseShovel(player, item, fromPosition, target, toPosition, isHotkey) return true end player:teleportTo(toPosition, false) + player:addAchievementProgress("The Undertaker", 500) elseif target.itemid == 1822 and target:getPosition() == Position(33222, 31100, 7) then player:teleportTo(Position(33223, 31100, 8)) elseif table.contains({ 231, 231 }, target.itemid) then @@ -480,6 +481,7 @@ function onUseShovel(player, item, fromPosition, target, toPosition, isHotkey) target:decay() elseif rand == 1 then Game.createItem(3042, 1, toPosition) + player:addAchievementProgress("Gold Digger", 100) elseif rand > 95 then Game.createMonster("Scarab", toPosition) end @@ -625,6 +627,7 @@ function onUsePick(player, item, fromPosition, target, toPosition, isHotkey) end target:getPosition():sendMagicEffect(CONST_ME_BLOCKHIT) target:remove(1) + player:addAchievementProgress("Petrologist", 100) elseif target.itemid == 7200 then target:transform(7236) target:decay() diff --git a/data/scripts/lib/register_lever_tables.lua b/data/scripts/lib/register_lever_tables.lua index ce8ad6a02b8..66a78f42a11 100644 --- a/data/scripts/lib/register_lever_tables.lua +++ b/data/scripts/lib/register_lever_tables.lua @@ -10,5 +10,5 @@ AscendingFerumbrasConfig = { days = 3, range = 20, time = 60, -- time in minutes to remove the player - vortex = 23482, + vortex = 23726, }