<?xml version="1.0" encoding="UTF-8"?>
<mod name="Super Loot Event" version="1.0" author="GarQet" contact="https://otland.net/members/garqet.30076/" enabled="yes">
<description>
--Add lane to your login.lua in creaturescripts:
registerCreatureEvent(cid, "SuperLoot")
</description>
<config name="sloot"><![CDATA[
config = {
message = "Holytimes have come! Everyone can drop extra loot from monster for another 3 hours!",
finished = "Holytimes has ended!",
timer = 180, -- minutes
auto = "yes",
storage = "111111",
random_amount_if_more_than_one = "yes",
-- {item_id, amount, percent},
items = {
{8888, 1, 100},
{8889, 1, 5},
{2160, 5, 33}
}
}
]]></config>
<globalevent name="SuperLootAuto" time="16:00" event="script"><![CDATA[
domodlib('sloot')
function onTime(interval, lastExecution)
if config.timer == "yes" then
doBroadcastMessage(config.message, MESSAGE_STATUS_WARNING)
setGlobalStorageValue(config.storage, 1)
addEvent(function()
doBroadcastMessage(config.finished, MESSAGE_STATUS_WARNING)
setGlobalStorageValue(config.storage, 0)
end, config.timer * 60 * 1000)
return true
end
return true
end
]]></globalevent>
<talkaction words="!holytimes" event="script"><![CDATA[
domodlib('sloot')
function onSay(cid, words, param, channel)
if getPlayerGroupId(cid) <= 3 then
return false
end
if getPlayerGroupId(cid) > 3 then
if param == "" then
doPlayerSendCancel(cid, "Command param required. Available: start, stop.")
elseif string.lower(param) == "start" then
if getGlobalStorageValue(config.storage) == 1 then
doPlayerSendCancel(cid, "You cannot start event, event is running.")
return true
end
doBroadcastMessage(config.message, MESSAGE_STATUS_WARNING)
setGlobalStorageValue(config.storage, 1)
addEvent(function()
doBroadcastMessage(config.finished, MESSAGE_STATUS_WARNING)
setGlobalStorageValue(config.storage, 0)
end, config.timer * 60 * 1000)
elseif string.lower(param) == "stop" then
doBroadcastMessage(config.finished, MESSAGE_STATUS_WARNING)
setGlobalStorageValue(config.storage, 0)
end
return true
end
return true
end
]]></talkaction>
<event type="kill" name="SuperLoot" event="script"><![CDATA[
domodlib('sloot')
function onKill(cid, target, lastHit)
if getGlobalStorageValue(config.storage) ~= 1 then
return true
end
local corpse = getMonsterInfo(getCreatureName(target)).lookCorpse
local pos = getCreaturePosition(target)
if isMonster(target) and getCreatureMaster(target) == target then
addEvent(function(pos, corpse)
if isContainer(getTileItemById(pos, corpse).uid) then
local change = math.random(1, 100)
for i = 1, #config.items do
if chance <= config.items[i][3] then
local amount = config.items[i][2]
if amount > 1 and config.random_amount_if_more_than_one == "yes" then
amount = math.random(1, config.items[i][2])
end
doAddContainerItem(getTileItemById(pos, corpse).uid, amount, config.items[i][1])
end
end
end
end, 1, pos, corpseId)
return true
end
return true
end
]]></event>
</mod>