1
[Aporte] Sistema para repartir el (( Loot )) de un (( Boss )) al morir Vie Jun 08, 2018 6:47 pm
[Adm] SevuOT
![[Adm] SevuOT](https://2img.net/u/2712/30/40/04/avatars/10743-22.jpg)
Miembro

Aquí les traigo el sistema que repartirá el loot de un boss entre los jugadores que le hayan hecho mas daño al boss. ( tambien se puede configurar para que el loot se reparta en modo aleatorio )
Aqui esta el mod: ( deben añadirlo a su carpeta de mods )
Aqui esta el mod: ( deben añadirlo a su carpeta de mods )
- Código:
<?xml version="1.0" encoding="ISO-8859-1"?>
<mod name="UnpackLoot System" version="1.1" author="Sevu Entertainment" contact="none.com" enabled="yes">
<config name="UnpackLoot_func"><![CDATA[
--[[SevuEntertainment(c)]]--
--[[SystemUnpackLootForDeathList_Players]]--
local _bosses = {
['Demon'] = true, -- example 1
['Dragon Lord'] = true
}
local _rewardRandomPlayers = false
_G['_isRewardMonster'] = function(cid)
return _bosses[getCreatureName(cid)]
end
_G['isContainerByItemId'] = function(itemid)
return getItemInfo(itemid).group == 2 and true or false
end
_G['Container_GetItemsContains'] = function(container, items)
local items = items or {}
if not isContainer(container) then return items end
for slot = 0, (getContainerSize(container) -1) do
local item = getContainerItem(container, slot)
if item.uid > 0 then
if isContainer(item.uid) then
items = Container_GetItemsContains(item.uid, items)
else
table.insert(items, item)
end
end
end
return items
end
_G['UnpackLootOnDeathList'] = function(t)
local position, corpseId, deathList = unpack(t)
local corpse = getTileItemById(position, corpseId)
if isContainer(corpse.uid) then
if corpse.itemid == corpseId then
local loot = Container_GetItemsContains(corpse.uid)
local current_player = 1
for _, item in pairs(loot) do
doPlayerAddItem(deathList[current_player], item.itemid, item.type)
doRemoveItem(item.uid)
if _rewardRandomPlayers then
current_player = math.random(1, #deathList)
else
current_player = (current_player +1) > #deathList and 1 or (current_player +1)
end
end
end
end
end
]]></config>
<event type="login" name="UnpackLootLogin" event="script"><![CDATA[
function onLogin(cid)
registerCreatureEvent(cid, "sendRegisterUnpackLoot")
return true
end]]></event>
<event type="death" name="UnpackEventDeath" event="script"><![CDATA[
domodlib('UnpackLoot_func')
function onDeath(cid, corpse, deathList)
if _isRewardMonster(cid) then
local t = {}
table.insert(t, 1, getThingPos(cid))
local lookCorpse = getMonsterInfo(getCreatureName(cid)).lookCorpse
if not isContainerByItemId(lookCorpse) then
return true
end
table.insert(t, 2, lookCorpse)
table.insert(t, 3, deathList)
addEvent(UnpackLootOnDeathList, 50, t)
end
return true
end
]]></event>
<event type="combat" name="sendRegisterUnpackLoot" event="script"><![CDATA[
domodlib('UnpackLoot_func')
if isPlayer(cid) and isMonster(target) and _isRewardMonster(target) then
registerCreatureEvent(target, "UnpackEventDeath")
end
return true]]></event>
</mod>
Última edición por The_Pain el Sáb Jun 09, 2018 1:47 pm, editado 1 vez (Razón : Convertido a mod para que sea mas facil la instalacion para los usuario)

Si necesitas hospedaje para tu servidor usa este enlace y mira los buenos planes de Windows y Linux:
Si tu cuenta de PayPal no esta verificada no importara, igual aceptan pagos con cuentas no verificadas.
![[Aporte] Sistema para repartir el (( Loot )) de un (( Boss )) al morir TRJEB8aSRYK5IulEU6ilJw](https://2img.net/image.prntscr.com/image/TRJEB8aSRYK5IulEU6ilJw.png)
Si tu cuenta de PayPal no esta verificada no importara, igual aceptan pagos con cuentas no verificadas.
![[Aporte] Sistema para repartir el (( Loot )) de un (( Boss )) al morir TRJEB8aSRYK5IulEU6ilJw](https://2img.net/image.prntscr.com/image/TRJEB8aSRYK5IulEU6ilJw.png)
5 participantes