<?xml version="1.0" encoding="UTF-8"?>
<mod name="Arena Play Ground" enabled="yes">
<!--<!---->
oldPosition - pozycje graczy przed wej?ciem
newPosition - pozycje graczy gdzie si? znajda po poci?gni?ciu wajchy
arena - pozycje areny(z jednego rogu do przeciwnego)
-->
<config name="arena_config"><![CDATA[
config = {
oldPosition = {
{x = 1017, y = 1020, z = 7},
{x = 1017, y = 1021, z = 7}
},
newPosition = {
{x = 1017, y = 1007, z = 7},
{x = 1025, y = 1016, z = 7}
},
arena = {
fromPos = {x = 1017, y = 1007, z = 7},
toPos = {x = 1025, y= 1016, z = 7}
}
}
]]></config>
<event type="login" name="arena_login" event="script"><![CDATA[
return registerCreatureEvent(cid, "arena_dead")
]]></event>
<event type="statschange" name="arena_dead" event="script"><![CDATA[
domodlib("arena_config")
if type == 1 and getCreatureHealth(cid) <= value and isCreature(attacker) and isPlayer(cid) then
if isInRange(getThingPos(cid), config.arena.fromPos, config.arena.toPos) then
doCreatureAddHealth(cid, getCreatureMaxHealth(cid), false)
doCreatureAddMana(cid, getCreatureMaxMana(cid), false)
doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)), true)
return false
end
end
return true
]]></event>
<!--<!---->
action uniqueid - UID WAJCHY NA MAPIE
-->
<action uniqueid="1981" event="script"><![CDATA[
domodlib("arena_config")
if item.itemid == 1945 then
return doTransformItem(item.uid, 1946)
end
local players = {}
for _, old in ipairs(config.oldPosition) do
local creature = getTopCreature(old).uid
if isPlayer(creature) then
table.insert(players, creature)
end
end
if #players ~= 2 then
return doPlayerSendTextMessage(cid, 27, "You need 2 players to start.")
end
for i, player in ipairs(players) do
doSendMagicEffect(getThingPos(player), CONST_ME_POFF)
doTeleportThing(player, config.newPosition[i], true)
doSendMagicEffect(config.newPosition[i], CONST_ME_TELEPORT)
end
doTransformItem(item.uid, 1945)
return true
]]></action>
</mod>