Skip to content

Commit

Permalink
refactor: costume bags to core (#2333)
Browse files Browse the repository at this point in the history
  • Loading branch information
omarcopires authored Feb 29, 2024
1 parent 31a57b0 commit 80a731f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 59 deletions.
45 changes: 0 additions & 45 deletions data-canary/scripts/actions/other/costume_bag.lua

This file was deleted.

4 changes: 0 additions & 4 deletions data/libs/functions/creature.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
@@ -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()

0 comments on commit 80a731f

Please sign in to comment.