What's new

Skrypty & Kody B?ad w konsoli

Status
Not open for further replies.

mial123

Advanced User
Joined
Apr 2, 2009
Messages
307
Reaction score
24
B?ad w konsoli, niewiem czy dobrze dzia? wybra?em :d
[LUA][3/10/2015 18:37:1] [Error - CreatureScript Interface]
[3/10/2015 18:37:1] In a timer event called from:
[3/10/2015 18:37:1] domodlib('itemstats_conf')
[3/10/2015 18:37:1] function round(n, s)
[3/10/2015 18:37:1] return tonumber(('%.' .. (s or 0) .. 'f'):format(n))
[3/10/2015 18:37:1] end
[3/10/2015 18:37:1] function getContentDescription(uid, sep)
[3/10/2015 18:37:1] local ret, i, containers = '', 0, {}
[3/10/2015 18:37:1] while( i < getContainerSize(uid) )do
[3/10/2015 18:37:1] local v, s = getContainerItem(uid, i), ''
[3/10/2015 18:37:1] local k = getItemInfo(v.itemid)
[3/10/2015 18:37:1] k.name = getItemAttribute(v.uid, 'name') or k.name
[3/10/2015 18:37:1] if( k.name ~= '' )then
[3/10/2015 18:37:1] if( v.type > 1 and k.stackable and k.showCount )then
[3/10/2015 18:37:1] s = v.type .. ' ' .. k.plural
[3/10/2015 18:37:1] else
[3/10/2015 18:37:1] local article = getItemAttribute(v.uid, 'article') or k.article
[3/10/2015 18:37:1] s = (article == '' and '' or article .. ' ') .. k.name
[3/10/2015 18:37:1] end
[3/10/2015 18:37:1] ret = ret .. (i == 0 and not sep and '' or ', ') .. s
[3/10/2015 18:37:1] if( isContainer(v.uid) and getContainerSize(v.uid) ~= 0 )then
[3/10/2015 18:37:1] table.insert(containers, v.uid)
[3/10/2015 18:37:1] end
[3/10/2015 18:37:1] else
[3/10/2015 18:37:1] ret = ret .. (i == 0 and not sep and '' or ', ') .. 'an item of type ' .. v.itemid .. ', please report it to gamemaster'
[3/10/2015 18:37:1] end
[3/10/2015 18:37:1] i = i + 1
[3/10/2015 18:37:1] end
[3/10/2015 18:37:1] for i = 1, #containers do
[3/10/2015 18:37:1] ret = ret .. getContentDescription(containers, true)
[3/10/2015 18:37:1] end
[3/10/2015 18:37:1] return ret
[3/10/2015 18:37:1] end
[3/10/2015 18:37:1] local function send(cid, corpse, monster)
[3/10/2015 18:37:1] if( isPlayer(cid) )then
[3/10/2015 18:37:1] local ret = isContainer(corpse) and getContentDescription(corpse)
[3/10/2015 18:37:1] doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'Loot of ' .. monster .. ': ' .. (ret ~= '' and ret or 'nothing'))
[3/10/2015 18:37:1] local party = getPlayerParty(cid)
[3/10/2015 18:37:1] if( party )then
[3/10/2015 18:37:1] for _, pid in ipairs(getPartyMembers(party)) do
[3/10/2015 18:37:1] doPlayerSendChannelMessage(pid, '', 'Loot of ' .. monster .. ': ' .. (ret ~= '' and ret or 'nothing'), TALKTYPE_CHANNEL_W, CHANNEL_PARTY)
[3/10/2015 18:37:1] end
[3/10/2015 18:37:1] end
[3/10/2015 18:37:1] end
[3/10/2015 18:37:1] end
[3/10/2015 18:37:1] local function createLoot(i, ext)
[3/10/2015 18:37:1] local item = type(i.id) == 'table' and i.id[math.random(#i.id)] or i.id
[3/10/2015 18:37:1] local random = math.ceil(math.random(100000) / ext)
[3/10/2015 18:37:1] local tmpItem, f
[3/10/2015 18:37:1] if( random < i.chance )then
[3/10/2015 18:37:1] if i.subType == -1 then
[3/10/2015 18:37:1] f = getItemInfo(item)
[3/10/2015 18:37:1] end
[3/10/2015 18:37:1] tmpItem = doCreateItemEx(item,
[3/10/2015 18:37:1] i.subType ~= -1 and i.subType or
[3/10/2015 18:37:1] f.stackable and random % i.count + 1 or
[3/10/2015 18:37:1] f.charges ~= 0 and f.charges or
[3/10/2015 18:37:1] 1
[3/10/2015 18:37:1] )
[3/10/2015 18:37:1] end
[3/10/2015 18:37:1] if( not tmpItem )then
[3/10/2015 18:37:1] return
[3/10/2015 18:37:1] end
[3/10/2015 18:37:1] if( i.actionId ~= -1 )then
[3/10/2015 18:37:1] doItemSetAttribute(tmpItem, 'aid', i.actionId)
[3/10/2015 18:37:1] end
[3/10/2015 18:37:1] if( i.uniqueId ~= -1 )then
[3/10/2015 18:37:1] doItemSetAttribute(tmpItem, 'uid', i.uniqueId)
[3/10/2015 18:37:1] end
[3/10/2015 18:37:1] if( i.text ~= '' )then
[3/10/2015 18:37:1] doItemSetAttribute(tmpItem, 'text', i.text)
[3/10/2015 18:37:1] end
[3/10/2015 18:37:1] local ret, done
[3/10/2015 18:37:1] for k, v in pairs(tiers) do
[3/10/2015 18:37:1] local cur, used = {}, {}
[3/10/2015 18:37:1] for i = 1, #v.chance do
[3/10/2015 18:37:1] if( math.random(100000) <= v.chance )then
[3/10/2015 18:37:1] if( f )then
[3/10/2015 18:37:1] f = getItemInfo(item)
[3/10/2015 18:37:1] end
[3/10/2015 18:37:1] if( not f.stackable )then
[3/10/2015 18:37:1] for m, n in pairs(attr) do
[3/10/2015 18:37:1] if( not table.find(used, m) and
[3/10/2015 18:37:1] (
[3/10/2015 18:37:1] ( table.find(n.types, MELEE) and table.find({WEAPON_SWORD, WEAPON_CLUB, WEAPON_AXE}, f.weaponType) ) or
[3/10/2015 18:37:1] ( table.find(n.types, DISTANCE) and f.weaponType == WEAPON_DIST and f.ammoType ~= 0 ) or
[3/10/2015 18:37:1] ( table.find(n.types, ARMOR) and f.armor ~= 0 and f.wieldPosition ~= CONST_SLOT_NECKLACE ) or
[3/10/2015 18:37:1] ( table.find(n.types, SHIELD) and f.defense ~= 0 and f.weaponType == WEAPON_SHIELD ) or
[3/10/2015 18:37:1] ( table.find(n.types, WAND) and f.weaponType == WEAPON_WAND ) or
[3/10/2015 18:37:1] ( table.find(n.types, DURATION_RING) and f.wieldPosition == CONST_SLOT_RING and f.transformEquipTo ~= 0 ) or
[3/10/2015 18:37:1] ( table.find(n.types, CHARGES) and table.find({CONST_SLOT_RING, CONST_SLOT_NECKLACE}, f.wieldPosition) and f.charges ~= 0 )
[3/10/2015 18:37:1] ) )then
[3/10/2015 18:37:1] table.insert(cur, m)
[3/10/2015 18:37:1] end
[3/10/2015 18:37:1] end
[3/10/2015 18:37:1] if( #cur ~= 0 )then
[3/10/2015 18:37:1] local n = cur[math.random(#cur)]
[3/10/2015 18:37:1] table.insert(used, n)
[3/10/2015 18:37:1] n = attr[n]
[3/10/2015 18:37:1] local percent, new, tmp = math.random(n.percent[1] + (v.extra[1] or 0), n.percent[2] + (v.extra[2] or 0))
[3/10/2015 18:37:1] -- hacks
[3/10/2015 18:37:1] if( n.attr == 'duration' )then
[3/10/2015 18:37:1] tmp = getItemInfo(f.transformEquipTo)
[3/10/2015 18:37:1] if tmp.transformDeEquipTo ~= item then
[3/10/2015 18:37:1] break
[3/10/2015 18:37:1] end
[3/10/2015 18:37:1] new = round( tmp.decayTime * (1 + percent / 100) * 1000 )
[3/10/2015 18:37:1] elseif( n.attr == 'attackSpeed' )then
[3/10/2015 18:37:1] new = round( vocation_base_attackspeed / (1 + percent / 100) )
[3/10/2015 18:37:1] elseif( n.attr == 'hitChance' ) then
[3/10/2015 18:37:1] new = round(
[3/10/2015 18:37:1] f.hitChance == -1 and
[3/10/2015 18:37:1] percent
[3/10/2015 18:37:1] or
[3/10/2015 18:37:1] f.hitChance * (1 + percent / 100)
[3/10/2015 18:37:1] )
[3/10/2015 18:37:1] else
[3/10/2015 18:37:1] new = round(
[3/10/2015 18:37:1] n.base and
[3/10/2015 18:37:1] f[n['attr']] + f[n['base']] * (percent / 100)
[3/10/2015 18:37:1] or
[3/10/2015 18:37:1] f[n['attr']] * (1 + percent / 100)
[3/10/2015 18:37:1] )
[3/10/2015 18:37:1] if( new == f[n[n.base and 'base' or 'attr']] )then -- no improvement
[3/10/2015 18:37:1] break
[3/10/2015 18:37:1] end
[3/10/2015 18:37:1] end
[3/10/2015 18:37:1] doItemSetAttribute(tmpItem, n.attr:lower(), new)
[3/10/2015 18:37:1] local name = getItemAttribute(tmpItem, 'name')
[3/10/2015 18:37:1] if( v.attrNames or not name )then
[3/10/2015 18:37:1] local name = (v.attrNames and used[#used] or k) .. ' ' .. (name or f.name)
[3/10/2015 18:37:1] doItemSetAttribute(tmpItem, 'name', name)
[3/10/2015 18:37:1] if( f.article ~= '' )then
[3/10/2015 18:37:1] local article = getArticle(name)
[3/10/2015 18:37:1] if( article ~= f.article )then
[3/10/2015 18:37:1] doItemSetAttribute(tmpItem, 'article', article)
[3/10/2015 18:37:1] end
[3/10/2015 18:37:1] end
[3/10/2015 18:37:1] end
[3/10/2015 18:37:1] local desc = getItemAttribute(tmpItem, 'description') or f.description
[3/10/2015 18:37:1] doItemSetAttribute(tmpItem, 'description', '[' .. n.name .. ': +' .. percent .. '%]' .. (desc == '' and '' or '\n' .. desc))
[3/10/2015 18:37:1] ret = k
[3/10/2015 18:37:1] end
[3/10/2015 18:37:1] cur = {}
[3/10/2015 18:37:1] if( #v.chance == i )then
[3/10/2015 18:37:1] done = true
[3/10/2015 18:37:1] end
[3/10/2015 18:37:1] end
[3/10/2015 18:37:1] else
[3/10/2015 18:37:1] done = i ~= 1
[3/10/2015 18:37:1] break
[3/10/2015 18:37:1] end
[3/10/2015 18:37:1] end
[3/10/2015 18:37:1] if( done )then
[3/10/2015 18:37:1] break
[3/10/2015 18:37:1] end
[3/10/2015 18:37:1] end
[3/10/2015 18:37:1] return tmpItem, ret
[3/10/2015 18:37:1] end
[3/10/2015 18:37:1] local function createChildLoot(parent, i, ext, pos)
[3/10/2015 18:37:1] if( not i or #i == 0 )then
[3/10/2015 18:37:1] return true
[3/10/2015 18:37:1] end
[3/10/2015 18:37:1] local size, cap = 0, getContainerCap(parent)
[3/10/2015 18:37:1] for k = 1, #i do
[3/10/2015 18:37:1] if( size == cap )then
[3/10/2015 18:37:1] break
[3/10/2015 18:37:1] end
[3/10/2015 18:37:1] local tmp, ret = createLoot(i[k], ext)
[3/10/2015 18:37:1] if( tmp )then
[3/10/2015 18:37:1] if( isContainer(tmp) )then
[3/10/2015 18:37:1] if( createChildLoot(tmp, i[k].child, ext, pos) )then
[3/10/2015 18:37:1] doAddContainerItemEx(parent, tmp)
[3/10/2015 18:37:1] size = size + 1
[3/10/2015 18:37:1] else
[3/10/2015 18:37:1] doRemoveItem(tmp)
[3/10/2015 18:37:1] end
[3/10/2015 18:37:1] else
[3/10/2015 18:37:1] if( ret )then
[3/10/2015 18:37:1] doSendMagicEffect(pos, CONST_ME_MAGIC_GREEN)
[3/10/2015 18:37:1] doSendAnimatedText(pos, ret:upper(), tiers[ret].color)
[3/10/2015 18:37:1] end
[3/10/2015 18:37:1] doAddContainerItemEx(parent, tmp)
[3/10/2015 18:37:1] size = size + 1
[3/10/2015 18:37:1] end
[3/10/2015 18:37:1] end
[3/10/2015 18:37:1] end
[3/10/2015 18:37:1] return size > 0
[3/10/2015 18:37:1] end
[3/10/2015 18:37:1] local function dropLoot(pos, v, ext, master, cid, target)
[3/10/2015 18:37:1] local corpse
[3/10/2015 18:37:1] if( not master or master == target )then -- 0.3/4
[3/10/2015 18:37:1] corpse = getTileItemById(pos, v.lookCorpse).uid
[3/10/2015 18:37:1] if( isContainer(corpse) )then
[3/10/2015 18:37:1] for i = 1, getContainerSize(corpse) do
[3/10/2015 18:37:1] doRemoveItem(getContainerItem(corpse, 0).uid)
[3/10/2015 18:37:1] end
[3/10/2015 18:37:1] local size, cap = 0, getContainerCap(corpse)
[3/10/2015 18:37:1] for i = 1, #v.loot do
[3/10/2015 18:37:1] if( size == cap )then
[3/10/2015 18:37:1] break
[3/10/2015 18:37:1] end
[3/10/2015 18:37:1] local tmp, ret = createLoot(v.loot, ext)
[3/10/2015 18:37:1] if( tmp )then
[3/10/2015 18:37:1] if( isContainer(tmp) )then
[3/10/2015 18:37:1] if( createChildLoot(tmp, v.loot.child, ext, pos) )then
[3/10/2015 18:37:1] doAddContainerItemEx(corpse, tmp)
[3/10/2015 18:37:1] size = size + 1
[3/10/2015 18:37:1] else
[3/10/2015 18:37:1] doRemoveItem(tmp)
[3/10/2015 18:37:1] end
[3/10/2015 18:37:1] else
[3/10/2015 18:37:1] if( ret )then
[3/10/2015 18:37:1] doSendMagicEffect(pos, CONST_ME_MAGIC_GREEN)
[3/10/2015 18:37:1] doSendAnimatedText(pos, ret:upper(), tiers[ret].color)
[3/10/2015 18:37:1] end
[3/10/2015 18:37:1] doAddContainerItemEx(corpse, tmp)
[3/10/2015 18:37:1] size = size + 1
[3/10/2015 18:37:1] end
[3/10/2015 18:37:1] end
[3/10/2015 18:37:1] end
[3/10/2015 18:37:1] end
[3/10/2015 18:37:1] end
[3/10/2015 18:37:1] send(cid, corpse, v.description)
[3/10/2015 18:37:1] end
[3/10/2015 18:37:1] function onKill(cid, target, damage, flags)
[3/10/2015 18:37:1] if( (damage == true or bit.band(flags, 1) == 1) and isMonster(target) )then -- 0.3/4
[3/10/2015 18:37:1] local v = getMonsterInfo(getCreatureName(target))
[3/10/2015 18:37:1] if( v and v.lookCorpse ~= 0 )then
[3/10/2015 18:37:1] local s = getCreatureStorage(cid, extra_loot_key)
[3/10/2015 18:37:1] addEvent(dropLoot, 0, getThingPos(target), v, s == -1 and rate or s, getCreatureMaster(target), cid, target)
[3/10/2015 18:37:1] end
[3/10/2015 18:37:1] end
[3/10/2015 18:37:1] return true
[3/10/2015 18:37:1] end
[3/10/2015 18:37:1] :eek:nKill
[3/10/2015 18:37:1] Description:
[3/10/2015 18:37:1] (luaGetThing) Thing not found
[/LUA]Wie kto? mo?e dlaczego tak wywala b?ad?? Od plik?w serverowych czy co? innego? B?ad sie pojawia gdy administrator zabije potorka
 

Glombersik

github.com/glombers
Joined
Oct 21, 2013
Messages
502
Reaction score
33
Odp: B?ad w konsoli

Przypadkiem nie masz
Notka moderatorska:
Random Item Stats?? Zobacz je?eli tak to go wy??cz
 
Status
Not open for further replies.
Top