[23:32:17.913] [Error - CreatureScript Interface]
[23:32:17.913] In a timer event called from:
[23:32:17.913] domodlib('itemstats_conf')
[23:32:17.913] function round(n, s)
[23:32:17.913] return tonumber(('%.' .. (s or 0) .. 'f'):format(n))
[23:32:17.913] end
[23:32:17.913] function getContentDescription(uid, sep)
[23:32:17.913] local ret, i, containers = '', 0, {}
[23:32:17.913] while( i < getContainerSize(uid) )do
[23:32:17.913] local v, s = getContainerItem(uid, i), ''
[23:32:17.913] local k = getItemInfo(v.itemid)
[23:32:17.913] k.name = getItemAttribute(v.uid, 'name') or k.name
[23:32:17.913] if( k.name ~= '' )then
[23:32:17.913] if( v.type > 1 and k.stackable and k.showCount )then
[23:32:17.913] s = v.type .. ' ' .. k.plural
[23:32:17.913] else
[23:32:17.913] local article = getItemAttribute(v.uid, 'article') or k.article
[23:32:17.913] s = (article == '' and '' or article .. ' ') .. k.name
[23:32:17.913] end
[23:32:17.913] ret = ret .. (i == 0 and not sep and '' or ', ') .. s
[23:32:17.913] if( isContainer(v.uid) and getContainerSize(v.uid) ~= 0 )then
[23:32:17.913] table.insert(containers, v.uid)
[23:32:17.913] end
[23:32:17.913] else
[23:32:17.913] ret = ret .. (i == 0 and not sep and '' or ', ') .. 'an item of type ' .. v.itemid .. ', please report it to gamemaster'
[23:32:17.913] end
[23:32:17.913] i = i + 1
[23:32:17.913] end
[23:32:17.913] for i = 1, #containers do
[23:32:17.913] ret = ret .. getContentDescription(containers, true)
[23:32:17.913] end
[23:32:17.913] return ret
[23:32:17.913] end
[23:32:17.913] local function send(cid, corpse, monster)
[23:32:17.913] if( isPlayer(cid) )then
[23:32:17.913] local ret = corpse and isContainer(corpse) and getContentDescription(corpse)
[23:32:17.913] doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'Loot of ' .. monster .. ': ' .. (ret ~= '' and ret or 'nothing'))
[23:32:17.913] local party = getPlayerParty(cid)
[23:32:17.913] if( party )then
[23:32:17.913] for _, pid in ipairs(getPartyMembers(party)) do
[23:32:17.913] doPlayerSendChannelMessage(pid, '', 'Loot of ' .. monster .. ': ' .. (ret ~= '' and ret or 'nothing'), TALKTYPE_CHANNEL_W, CHANNEL_PARTY)
[23:32:17.913] end
[23:32:17.913] end
[23:32:17.913] end
[23:32:17.913] end
[23:32:17.913] local function createLoot(i, ext)
[23:32:17.913] local item = type(i.id) == 'table' and i.id[math.random(#i.id)] or i.id
[23:32:17.913] local random = math.ceil(math.random(100000) / ext)
[23:32:17.913] local tmpItem, f
[23:32:17.913] if( random < i.chance )then
[23:32:17.913] if i.subType == -1 then
[23:32:17.913] f = getItemInfo(item)
[23:32:17.913] end
[23:32:17.913] tmpItem = doCreateItemEx(item,
[23:32:17.913] i.subType ~= -1 and i.subType or
[23:32:17.913] f.stackable and random % i.count + 1 or
[23:32:17.913] f.charges ~= 0 and f.charges or
[23:32:17.913] 1
[23:32:17.913] )
[23:32:17.913] end
[23:32:17.913] if( not tmpItem )then
[23:32:17.913] return
[23:32:17.913] end
[23:32:17.913] if( i.actionId ~= -1 )then
[23:32:17.913] doItemSetAttribute(tmpItem, 'aid', i.actionId)
[23:32:17.913] end
[23:32:17.913] if( i.uniqueId ~= -1 )then
[23:32:17.913] doItemSetAttribute(tmpItem, 'uid', i.uniqueId)
[23:32:17.913] end
[23:32:17.913] if( i.text ~= '' )then
[23:32:17.913] doItemSetAttribute(tmpItem, 'text', i.text)
[23:32:17.913] end
[23:32:17.913] local ret, done
[23:32:17.913] for k, v in pairs(tiers) do
[23:32:17.913] local cur, used = {}, {}
[23:32:17.913] for i = 1, #v.chance do
[23:32:17.913] if( math.random(100000) <= v.chance )then
[23:32:17.913] if( f )then
[23:32:17.913] f = getItemInfo(item)
[23:32:17.913] end
[23:32:17.913] if( not f.stackable )then
[23:32:17.913] for m, n in pairs(attr) do
[23:32:17.913] if( not table.find(used, m) and
[23:32:17.913] (
[23:32:17.913] ( table.find(n.types, MELEE) and table.find({WEAPON_SWORD, WEAPON_CLUB, WEAPON_AXE}, f.weaponType) ) or
[23:32:17.913] ( table.find(n.types, DISTANCE) and f.weaponType == WEAPON_DIST and f.ammoType ~= 0 ) or
[23:32:17.913] ( table.find(n.types, ARMOR) and f.armor ~= 0 and f.wieldPosition ~= CONST_SLOT_NECKLACE ) or
[23:32:17.913] ( table.find(n.types, SHIELD) and f.defense ~= 0 and f.weaponType == WEAPON_SHIELD ) or
[23:32:17.913] ( table.find(n.types, WAND) and f.weaponType == WEAPON_WAND ) or
[23:32:17.913] ( table.find(n.types, DURATION_RING) and f.wieldPosition == CONST_SLOT_RING and f.transformEquipTo ~= 0 ) or
[23:32:17.914] ( table.find(n.types, CHARGES) and table.find({CONST_SLOT_RING, CONST_SLOT_NECKLACE}, f.wieldPosition) and f.charges ~= 0 )
[23:32:17.914] ) )then
[23:32:17.914] table.insert(cur, m)
[23:32:17.914] end
[23:32:17.914] end
[23:32:17.914] if( #cur ~= 0 )then
[23:32:17.914] local n = cur[math.random(#cur)]
[23:32:17.914] table.insert(used, n)
[23:32:17.914] n = attr[n]
[23:32:17.914] local percent, new, tmp = math.random(n.percent[1] + (v.extra[1] or 0), n.percent[2] + (v.extra[2] or 0))
[23:32:17.914] -- hacks
[23:32:17.914] if( n.attr == 'duration' )then
[23:32:17.914] tmp = getItemInfo(f.transformEquipTo)
[23:32:17.914] if tmp.transformDeEquipTo ~= item then
[23:32:17.914] break
[23:32:17.914] end
[23:32:17.914] new = round( tmp.decayTime * (1 + percent / 100) * 1000 )
[23:32:17.914] elseif( n.attr == 'attackSpeed' )then
[23:32:17.914] new = round( vocation_base_attackspeed / (1 + percent / 100) )
[23:32:17.914] elseif( n.attr == 'hitChance' ) then
[23:32:17.914] new = round(
[23:32:17.914] f.hitChance == -1 and
[23:32:17.914] percent
[23:32:17.914] or
[23:32:17.914] f.hitChance * (1 + percent / 100)
[23:32:17.914] )
[23:32:17.914] else
[23:32:17.914] new = round(
[23:32:17.914] n.base and
[23:32:17.914] f[n['attr']] + f[n['base']] * (percent / 100)
[23:32:17.914] or
[23:32:17.914] f[n['attr']] * (1 + percent / 100)
[23:32:17.914] )
[23:32:17.914] if( new == f[n[n.base and 'base' or 'attr']] )then -- no improvement
[23:32:17.914] break
[23:32:17.914] end
[23:32:17.914] end
[23:32:17.914] doItemSetAttribute(tmpItem, n.attr:lower(), new)
[23:32:17.914] local name = getItemAttribute(tmpItem, 'name')
[23:32:17.914] if( v.attrNames or not name )then
[23:32:17.914] local name = (v.attrNames and used[#used] or k) .. ' ' .. (name or f.name)
[23:32:17.914] doItemSetAttribute(tmpItem, 'name', name)
[23:32:17.914] if( f.article ~= '' )then
[23:32:17.914] local article = getArticle(name)
[23:32:17.914] if( article ~= f.article )then
[23:32:17.914] doItemSetAttribute(tmpItem, 'article', article)
[23:32:17.914] end
[23:32:17.914] end
[23:32:17.914] end
[23:32:17.914] local desc = getItemAttribute(tmpItem, 'description') or f.description
[23:32:17.914] doItemSetAttribute(tmpItem, 'description', '[' .. n.name .. ': +' .. percent .. '%]' .. (desc == '' and '' or '\n' .. desc))
[23:32:17.914] ret = k
[23:32:17.914] end
[23:32:17.914] cur = {}
[23:32:17.914] if( #v.chance == i )then
[23:32:17.914] done = true
[23:32:17.914] end
[23:32:17.914] end
[23:32:17.914] else
[23:32:17.914] done = i ~= 1
[23:32:17.914] break
[23:32:17.914] end
[23:32:17.914] end
[23:32:17.914] if( done )then
[23:32:17.914] break
[23:32:17.914] end
[23:32:17.914] end
[23:32:17.914] return tmpItem, ret
[23:32:17.914] end