VOOZH about

URL: https://minecraft.wiki/w/Module:Get_drop_info

⇱ Module:Get drop info – Minecraft Wiki


Module:Get drop info

From Minecraft Wiki
Jump to navigation Jump to search
Documentation[view] [edit] [history] [purge]Jump to code ↴
This module is deprecated. It should not be used anywhere except sandboxes.
 
Please use {{DropTable}} instead.

Was called by {{Drop sources}}.

[view] [edit] [history] [purge]The above documentation is transcluded from Module:Get drop info/doc.
-- Portions sourced from https://oldschool.runescape.wiki/w/Module:Get_drop_info
localp={}
localspriteFile=require("Module:SpriteFile")
localdropsline=require("Module:DropsLine")
functionp.main(frame)
returnp._main(frame:getParent().args)
end
functionp._main(args)
localitemName=args.nameorargs[1]
ifnotitemNamethen
itemName=mw.title.getCurrentTitle().text
end
localquery=bucket('droptable')
.select('item','json')
.where('item',itemName)
.limit(500)
localretTable={}
ifquerythen
fori,vinipairs(query)do
localdropJSON=mw.text.jsonDecode(v['json']or'{}')
table.insert(retTable,makeDropLine(itemName,dropJSON))
end
end
-- Create the html table to display results
localt=mw.html.create('table')
t:addClass('wikitable sortable')
:css('text-align','center')
:tag('tr')
:tag('th'):attr('colspan',1):attr('rowspan',2):wikitext('Source'):done()
:tag('th'):attr('rowspan',2):wikitext('Roll Chance'):done()
:tag('th'):attr('colspan',4):wikitext('Quantity (Roll Chance)'):done()
:done()
:tag('tr')
:tag('th'):wikitext('Default'):done()
:tag('th'):wikitext('Looting I'):done()
:tag('th'):wikitext('Looting II'):done()
:tag('th'):wikitext('Looting III'):done()
-- insert all the drop lines we made before
mw.log('reTable pairs: '..#retTable)
fori,vinipairs(retTable)do
mw.log('Entry: '..tostring(v))
t:node(v)
end
localret=mw.html.create():wikitext(tostring(t)..mw.getCurrentFrame():extensionTag{name="references",args={group='d'}})
--TODO auto categories if on mainspace
returnret
end
functionmakeDropLine(itemName,data)
localdropSource=data['Dropped from']
-- local droppedItemNote = data['Dropped item note']
localquantityText=data['Quantity text']
localrollChanceText=data['Roll chance text']
localrollChanceNote=data['Roll chance note']
localversion=data['Version']
localplayerKillRequired=data['Player kill required']
localret=mw.html.create('tr')
localnameTag=ret:css('text-align','center')
:tag('td')
:css('text-align','left')
:wikitext(spriteFile.link({name="EntitySprite",scale=2,align='middle',dropSource}))
ifversion=='je'then
nameTag:wikitext(mw.getCurrentFrame():extensionTag{name='sub',content='(JE)',args={title="Only in Java Edition",style='cursor:help; margin-left:3px;'}})
elseifversion=='be'then
nameTag:wikitext(mw.getCurrentFrame():extensionTag{name='sub',content='(BE)',args={title="Only in Bedrock Edition",style='cursor:help; margin-left:3px;'}})
end
-- if droppedItemNote then -- Having to use this here indicates that it should really be split into just multiple items
-- nameTag:wikitext(mw.getCurrentFrame():extensionTag{ name='ref', content=droppedItemNote, args = {group='d'}})
-- end
localrollChanceTag=ret:tag('td'):wikitext(rollChanceText)
ifplayerKillRequired=="yes"then
rollChanceTag:wikitext(mw.getCurrentFrame():extensionTag{name='ref',content="Dropped only when kill credit is given to the player",args={group='d',name='player-kill'}})
end
ifrollChanceNotethen
rollChanceTag:wikitext(mw.getCurrentFrame():extensionTag{name='ref',content=rollChanceNote,args={group='d'}})
end
ret:tag('td'):wikitext(quantityText[1]):done()
:tag('td'):wikitext(quantityText[2]):done()
:tag('td'):wikitext(quantityText[3]):done()
:tag('td'):wikitext(quantityText[4]):done()
returnret:done()
end
returnp
--[[ debug:
mw.log(p._main({name='Blaze Rod'}))
--]]
Retrieved from "https://minecraft.wiki/w/Module:Get_drop_info?oldid=3148406"

Navigation menu