T
tejdi
Guest
As some of you know I was ripped off by the hoster OTSMATERIA.PL so I will publish at once more are the elements of the OTS.
Today you publish Pandora Box - Event.
Description (from otsmateria):
Every four hours a OTSMATERIA world PvP drops Pandora Box 8.6, the probability of this is, however, not totality sure. When you click in the box of Pandora is released in waves of deadly creature. Pandora tempted by the presence of candles, treats when no one arrives it can take over the world and mniejszyc exp about 50%! Pandora, however, after a few waves of monsters is getting weaker and the world puts their boss. After killing the boss, all players can stretch for 40 seconds of the few interesting items, then leave the world of Pandora to gather strength for another attack. (All values can change in the configuration.]
Cya, peace /Tejdi :*
Today you publish Pandora Box - Event.
Description (from otsmateria):
Every four hours a OTSMATERIA world PvP drops Pandora Box 8.6, the probability of this is, however, not totality sure. When you click in the box of Pandora is released in waves of deadly creature. Pandora tempted by the presence of candles, treats when no one arrives it can take over the world and mniejszyc exp about 50%! Pandora, however, after a few waves of monsters is getting weaker and the world puts their boss. After killing the boss, all players can stretch for 40 seconds of the few interesting items, then leave the world of Pandora to gather strength for another attack. (All values can change in the configuration.]
XML:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="Pandora Box" version="1.2" author="Oskar" contact="[email protected]" enabled="yes">
<config name="pandoraBox_conf"><![CDATA[
pandoraBox = {
monstersPositions = {
leftTopCorner = {x=33236,y=31693,z=7},
rightBottomCorner = {x=33247,y=31703,z=7}
},
pandoraBoxAccesToUseCommand = 4,
--box config
boxId = 9661,
timeOnPutBox = 10, --in minutes
chance = 100,
pandoraBoxPosition = {x=33241,y=31698,z=7},
--monsters config
monstersName = {'dragon lord',4,'serpent spawn',8,'Grim Reaper',6,'demon',5,'Hand Of Cursed Fate',11,'dragon',10,'Blightwalker',4,
'Fury',1,'Hellhound',2,'Undead Dragon',6,'Juggernaut',5,'Draken Elite',4,
'diabolic imp',10,'fire elemental',4,'Medusa',9,'Lost Soul',1,'Hellfire Fighter',1,'Defiler',3,'Draken Abomination',2}, --'name', chance, 'name1', chance1
monstersSpawnCount = {80,110}, --{from, to}
--waves config
wavesCount = {9,11}, --{from, to}
timeBetweenWaves = 90, --in seconds
timeOnKillAllMonsters = 13, --in minutes
timeOnGetRewards = 20, --in seconds
bossPositionToSamePandoraBox = true,
bossName = 'Pandora',
pandoraGuards = 'fallen island warlock',
pandoraGuardsCount = 10,
expRateValue = 0.25,
}
pandoraBoxRewards = {
--[vocationId] = {itemid, count, itemid1, count1, ...}
[1] = {2160, 25, 9969, 1, 9932, 1}, --sorc
[2] = {2160, 25, 9969, 1, 9932, 1}, --druid
[3] = {2160, 25, 9969, 1, 9932, 100}, --pall
[4] = {2160, 25, 9969, 1, 9932, 1}, --knight
[5] = {2160, 30, 9969, 1, 9932, 1}, --ms
[6] = {2160, 30, 9969, 1, 9932, 1}, --ed
[7] = {2160, 30, 9969, 1, 9932, 1}, --rp
[8] = {2160, 30, 9969, 1, 9932, 1}, --ek
}
function getArea(pandoraBox)
local LTCx, LTCy, LTCz = pandoraBox.monstersPositions.leftTopCorner.x, pandoraBox.monstersPositions.leftTopCorner.y, pandoraBox.monstersPositions.leftTopCorner.z
local RBCx, RBCy, RBCz = pandoraBox.monstersPositions.rightBottomCorner.x, pandoraBox.monstersPositions.rightBottomCorner.y, pandoraBox.monstersPositions.rightBottomCorner.z
local centerPos, rangex, rangey = {x=(LTCx+RBCx)/2,y=(LTCy+RBCy)/2,z=(LTCz+RBCz)/2}, math.abs(RBCx-LTCx), math.abs(RBCy-LTCy)
return centerPos, rangex, rangey
end
function isWalkable(pos, creature, proj, pz)
if getTileThingByPos({x=pos.x,y=pos.y,z=pos.z,stackpos=0}).itemid == 0 then return false end
if getTopCreature(pos).uid > 0 and creature then return false end
if getTileInfo(pos).protection and pz then return false, true end
local n = not proj and 3 or 2
for i = 0, 255 do
pos.stackpos = i
local tile = getTileThingByPos(pos)
if tile.itemid ~= 0 and not isCreature(tile.uid) then
if hasProperty(tile.uid, n) or hasProperty(tile.uid, 7) then
return false
end
end
end
return true
end
function checkPositions(fromPos, toPos, nb)
local pos = {x=math.random(fromPos.x,toPos.x), y=math.random(fromPos.y,toPos.y), z=math.random(fromPos.z,toPos.z)}
if isWalkable(pos, true, true, true) then
return pos
end
return (nb < 200 and checkPositions(fromPos, toPos, nb+1) or pos)
end
function setMonster(pandoraBox)
for i = 1, #pandoraBox.monstersName/2 do
local pos = checkPositions(pandoraBox.monstersPositions.leftTopCorner, pandoraBox.monstersPositions.rightBottomCorner, 0)
if pos and math.random(100000) <= pandoraBox.monstersName[i*2]*1000 then
local mon = doCreateMonster(pandoraBox.monstersName[i*2-1], pos, false, false, false)
return (isCreature(mon) and doCreatureSetStorage(mon, 1000, 1) or true)
end
end
return setMonster(pandoraBox)
end
function setPandoraBoxMonsters(pandoraBox)
for j = 1, math.random(pandoraBox.wavesCount[1], pandoraBox.wavesCount[2]) do
addEvent(function()
doBroadcastMessage('Next wave is raid on the city! Beware mortals, death come for you!')
for i = 1, math.random(pandoraBox.monstersSpawnCount[1], pandoraBox.monstersSpawnCount[2]) do
setMonster(pandoraBox)
end return true end,
(j == 1 and 1000 or pandoraBox.timeBetweenWaves * 1000 * (j-1)),
pandoraBox
)
end
return true
end
function setPandoraBox(pandoraBox)
if getStorage(5000) ~= -1 then
return addEvent(setPandoraBox, pandoraBox.timeOnPutBox * 60 * 1000, pandoraBox) end
if math.random(100000) <= pandoraBox.chance*1000 then
doSetStorage(5000, 0)
local item = doCreateItem(pandoraBox.boxId, pandoraBox.pandoraBoxPosition)
doItemSetAttribute(item, 'uid', 2000)
doItemSetAttribute(item, 'name', 'Pandora Box')
return doBroadcastMessage('Pandora Box is appeared somewhere in the city!')
end
return doSetStorage(5000, -1) and addEvent(setPandoraBox, pandoraBox.timeOnPutBox * 60 * 1000, pandoraBox)
end
function checkMonsters(pandoraBox, n)
local centerPos, rangex, rangey = getArea(pandoraBox)
if getSpectators(centerPos, rangex, rangey) then
for _, v in ipairs(getSpectators(centerPos, rangex, rangey)) do
if isMonster(v) and getCreatureStorage(v, 1000) == 1 then
for _, k in ipairs(getPlayersOnline()) do
if n == 0 then
doBroadcastMessage('Experience rate is to decreased by '.. pandoraBox.expRateValue * 100 ..' percent and not grow, until the evil from Pandora Box walk on the city.')
n = 60
end
doPlayerSetExperienceRate(k, pandoraBox.expRateValue)
end
return addEvent(checkMonsters, 5000, pandoraBox, n - 1)
end
end
end
doBroadcastMessage('Evil from Pandora Box is defeated! '..pandoraBox.bossName..' in his own person be came to the city for revenage!')
local pand = doCreateMonster(pandoraBox.bossName, (pandoraBox.bossPositionToSamePandoraBox and pandoraBox.pandoraBoxPosition or checkPositions(pandoraBox.monstersPositions.leftTopCorner, pandoraBox.monstersPositions.rightBottomCorner, 0)), false, false, false)
local pos = getThingPos(pand)
for i = 1, pandoraBox.pandoraGuardsCount do
pos.x = pos.x + math.random(-4,4)
pos.y = pos.y + math.random(-4,4)
doCreateMonster(pandoraBox.pandoraGuards, pos, false, false, false)
end
return (isMonster(pand) and registerCreatureEvent(pand, 'pandoraDeath') or false)
end
]]></config>
<event type="death" name="pandoraDeath" event="script"><![CDATA[
domodlib('pandoraBox_conf')
function onDeath(cid)
if getTileItemById(pandoraBox.pandoraBoxPosition, pandoraBox.boxId).uid == 2000 then
item = getTileItemById(pandoraBox.pandoraBoxPosition, pandoraBox.boxId)
end
addEvent(function()
doSetStorage(5000, -1)
doBroadcastMessage('Pandora Box is disappeared from the world!')
if getTileItemById(pandoraBox.pandoraBoxPosition, pandoraBox.boxId).uid == 2000 then
return doRemoveItem(getTileItemById(pandoraBox.pandoraBoxPosition, pandoraBox.boxId).uid)
end
return true end,
pandoraBox.timeOnGetRewards * 1000,
pandoraBox
)
return item and doItemSetAttribute(item.uid, 'pandoraBox', 1000) and doBroadcastMessage('The ancient evil has been defeated! The Pandora\'s Box are the reward for each, but only for '..timeOnGetRewards..' seconds!') or true
end
]]></event>
<action uniqueid="2000" event="script"><![CDATA[
domodlib('pandoraBox_conf')
function onUse(cid, item, fromPosition, itemEx, toPosition)
if item.itemid == pandoraBox.boxId and getItemAttribute(item.uid, 'pandoraBox') == nil then
doItemSetAttribute(item.uid, 'pandoraBox', 500)
addEvent(checkMonsters, pandoraBox.timeOnKillAllMonsters * 1000 * 60, pandoraBox, 0)
return setPandoraBoxMonsters(pandoraBox)
elseif item.itemid == pandoraBox.boxId and getItemAttribute(item.uid, 'pandoraBox') == 1000 then
if getPlayerStorageValue(cid, 150) ~= -1 then
return doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'It\'s empty.') end
if pandoraBoxRewards[getPlayerVocation(cid)] then
doPlayerSetStorageValue(cid, 150, 0)
msg = 'You have found '
for i = 1, #pandoraBoxRewards[getPlayerVocation(cid)]/2 do
msg = msg .. getItemNameById(pandoraBoxRewards[getPlayerVocation(cid)][i*2-1]) .. (i < #pandoraBoxRewards[getPlayerVocation(cid)]/2-1 and ', ' or i == #pandoraBoxRewards[getPlayerVocation(cid)]/2-1 and ' and ' or '.')
doPlayerAddItem(cid, pandoraBoxRewards[getPlayerVocation(cid)][i*2-1], pandoraBoxRewards[getPlayerVocation(cid)][i*2])
end
return doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, msg)
end
end
return false
end
]]></action>
<globalevent name="pandoraTime" time="19:00" event="script"><![CDATA[
domodlib("pandoraBox_conf")
function onTime(time)
return doSetStorage(5000, -1) and setPandoraBox(pandoraBox)
end
]]></globalevent>
<talkaction words="!pandoraBox" event="script"><![CDATA[
domodlib('pandoraBox_conf')
function onSay(cid, words, param, channel)
return getPlayerAccess(cid) >= pandoraBox.pandoraBoxAccesToUseCommand and doSetStorage(5000, -1) and setPandoraBox(pandoraBox) or true
end
]]></talkaction>
</mod>
Cya, peace /Tejdi :*