diff --git a/data-canary/scripts/actions/other/costume_bag.lua b/data-canary/scripts/actions/other/costume_bag.lua deleted file mode 100644 index e67b8817c3d..00000000000 --- a/data-canary/scripts/actions/other/costume_bag.lua +++ /dev/null @@ -1,45 +0,0 @@ -local setting = { - -- Common - [653] = { - "orc warrior", - "pirate cutthroat", - "dworc voodoomaster", - "dwarf guard", - "minotaur mage", - }, - -- Uncommon - [654] = { - "quara hydromancer", - "diabolic imp", - "banshee", - "frost giant", - "lich", - }, - -- Deluxe - [655] = { - "serpent spawn", - "demon", - "juggernaut", - "behemoth", - "ashmunrah", - }, -} - -local costumeBag = Action() - -function costumeBag.onUse(player, item, fromPosition, target, toPosition, isHotkey) - local creatures = setting[item.itemid] - if not creatures then - return true - end - player:setMonsterOutfit(creatures[math.random(#creatures)], 5 * 60 * 10 * 1000) - item:getPosition():sendMagicEffect(CONST_ME_MAGIC_RED) - item:remove() - return true -end - -for index, value in pairs(setting) do - costumeBag:id(index) -end - -costumeBag:register() diff --git a/data/libs/functions/creature.lua b/data/libs/functions/creature.lua index 29e0303ca7e..be95a45144c 100644 --- a/data/libs/functions/creature.lua +++ b/data/libs/functions/creature.lua @@ -78,10 +78,6 @@ function Creature:setMonsterOutfit(monster, time) return false end - if self:isPlayer() and not (self:hasFlag(PlayerFlag_CanIllusionAll) or monsterType:isIllusionable()) then - return false - end - local condition = Condition(CONDITION_OUTFIT) condition:setOutfit(monsterType:getOutfit()) condition:setTicks(time) diff --git a/data-otservbr-global/scripts/actions/other/costume_bags.lua b/data/scripts/actions/items/costume_bags.lua similarity index 63% rename from data-otservbr-global/scripts/actions/other/costume_bags.lua rename to data/scripts/actions/items/costume_bags.lua index 4a159a1db3a..8dfe91ac3b9 100644 --- a/data-otservbr-global/scripts/actions/other/costume_bags.lua +++ b/data/scripts/actions/items/costume_bags.lua @@ -1,24 +1,27 @@ local config = { - [653] = { "orc warrior", "pirate cutthroat", "dworc voodoomaster", "dwarf guard", "minotaur mage", "ogre shaman", "ogre brute", "rat" }, -- common - [655] = { "serpent spawn", "demon", "juggernaut", "behemoth", "ashmunrah", "vexclaw", "grimeleech", "hellflayer", "black sheep" }, -- uncommon - [654] = { "quara hydromancer", "diabolic imp", "banshee", "frost giant", "lich", "vexclaw", "grimeleech", "hellflayer", "ogre shaman", "ogre brute", "pig" }, -- deluxe - [24949] = { "old beholder", "old bug", "old wolf", "old giant spider" }, -- old + [653] = { "orc warrior", "pirate cutthroat", "dworc voodoomaster", "dwarf guard", "minotaur mage", "ogre shaman", "ogre brute", "rat" }, + [654] = { "quara hydromancer", "diabolic imp", "banshee", "frost giant", "lich", "vexclaw", "grimeleech", "hellflayer", "ogre shaman", "ogre brute", "pig" }, + [655] = { "serpent spawn", "demon", "juggernaut", "behemoth", "ashmunrah", "vexclaw", "grimeleech", "hellflayer", "black sheep" }, + [24949] = { "old beholder", "old bug", "old wolf", "old giant spider" }, } local costumeBags = Action() function costumeBags.onUse(player, item, fromPosition, target, toPosition, isHotkey) - local monsterNames = config[item.itemid] - if not monsterNames then + local creatures = config[item.itemid] + if not creatures then return true end - player:sendTextMessage(MESSAGE_STATUS, "You will stay 5 minutes transformed in a monster!") - doSetMonsterOutfit(player, monsterNames[math.random(#monsterNames)], 300 * 1000) + + player:setMonsterOutfit(creatures[math.random(#creatures)], 5 * 60 * 10 * 1000) player:addAchievementProgress("Masquerader", 100) - item:getPosition():sendMagicEffect(36) + player:getPosition():sendMagicEffect(CONST_ME_MAGIC_RED) item:remove() return true end -costumeBags:id(653, 655, 654, 24949) +for k, v in pairs(config) do + costumeBags:id(k) +end + costumeBags:register()