Majster12
Member
- Joined
- Feb 20, 2009
- Messages
- 134
- Solutions
- 1
- Reaction score
- 16
Tried to solve this by myself but without results.
If paladin or royal paladin use moonlight crystals on werewolf helmet he should receive enchanted werewolf helmet (paladin), but he always receive enchanted werewolf helmet (mage/druid).
If paladin or royal paladin use moonlight crystals on werewolf helmet he should receive enchanted werewolf helmet (paladin), but he always receive enchanted werewolf helmet (mage/druid).
Code:
local enchantableItems = {24716, 24718}
local moonlightcrystals = {24739}
local mageitems = {
[24716] = {24717},
[24718] = {24784}
}
local paladinitems = {
[24716] = {24717},
[24718] = {24772}
}
local knightitems = {
[24716] = {24717},
[24718] = {24783}
}
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
if isInArray(moonlightcrystals, item.itemid) then
if not isInArray(enchantableItems, target.itemid) then
fromPosition:sendMagicEffect(CONST_ME_POFF)
return true
end
local targetId = table.find(moonlightcrystals, item.itemid)
if not targetId then
return true
end
if getPlayerVocation(cid) == 1 or 5 or 4 or 6 then
target:transform(mageitems[target.itemid][targetId])
target:getPosition():sendMagicEffect(CONST_ME_MAGIC_RED)
item:remove(1)
return true
end
if getPlayerVocation(cid) == 3 or 7 then
target:transform(paladinitems[target.itemid][targetId])
target:getPosition():sendMagicEffect(CONST_ME_MAGIC_RED)
item:remove(1)
return true
end
if getPlayerVocation(cid) == 4 or 8 then
target:transform(knightitems[target.itemid][targetId])
target:getPosition():sendMagicEffect(CONST_ME_MAGIC_RED)
item:remove(1)
return true
end
end
end
Code:
<item id="24739" ="moonlight crystals" />
<item id="24716" ="werewolf amulet">
<item id="24717" ="enchanted werewolf amulet">
<item id="24718" ="werewolf helmet">
<item id="24784" ="enchanted werewolf helmet (mage/druid)">
<item id="24772" ="enchanted werewolf helmet (paladin)">
<item id="24783" ="enchanted werewolf helmet (knight)">