local command = "!oldmw"
local storage = 777555
local newMagicWall = Combat()
newMagicWall:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGY)
newMagicWall:setParameter(COMBAT_PARAM_CREATEITEM, ITEM_MAGICWALL)
local oldMagicWall = Combat()
oldMagicWall:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGY)
oldMagicWall:setParameter(COMBAT_PARAM_CREATEITEM, ITEM_OLD_MAGICWALL)
local rune = Spell(SPELL_RUNE)
function rune.onCastSpell(creature, variant, isHotkey)
if creature:getStorageValue(storage) == 1 then
return oldMagicWall:execute(creature, variant)
end
return newMagicWall:execute(creature, variant)
end
rune:name("Magic Wall Rune")
rune:group("attack")
rune:runeId(2293)
rune:charges(3)
rune:id(86)
rune:cooldown(2000)
rune:groupCooldown(2000)
rune:level(32)
rune:magicLevel(9)
rune:allowFarUse(true)
rune:isPremium(false)
rune:isBlocking(true, true)
rune:register()
local talkAction = TalkAction(command)
function talkAction.onSay(player, words, param, type)
local state = param:lower():trim()
if state == "on" then
player:setStorageValue(storage, 1)
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You are now using old magic walls.")
elseif state == "off" then
player:setStorageValue(storage, 0)
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You are now using new magic walls.")
else
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Use " .. command .. " on/off")
end
return false
end
talkAction:separator(" ")
talkAction:register()