From Dark and Darker Wiki
Script error: The function "create_monster_loot_tables" does not exist.
local p = {}
function p.create_loot_table(frame)
local droprate_filename = "Data:Droprate Monsters Bosses.json"
local lootdrop_filename = "Data:Lootdrop GhostKing.json"
local lootdrop_data = mw.loadJsonData(lootdrop_filename)
if lootdrop_data == nil then return "Lootdrop data file '" .. lootdrop_filename .. "' could not be found." end
local resulting_table = ""
resulting_table = resulting_table .. '<br>'
resulting_table = resulting_table .. '<table cellspacing="0" class="loottable stripedtable sortable jquery-tablesorter mw-collapsible" style="width:100%">'
resulting_table = resulting_table .. ' <caption>Loot Table at 0 Luck</caption>'
resulting_table = resulting_table .. ' <tr><th style="width:5%">Name</th><th class="tooltip" style="width:5%"><u>Luck Grade</u><span class="tooltiptext-left" style="left:50%; transform:translate(-50%); bottom:66%; width:100%">Luck Grades present on the graph but missing in the column below are associated with dropping nothing.</span></th><th style="width:5%">Rarity</th><th style="width:5%">Item Count</th></tr>"'
-- Create body of table
-- Item name, luck grade, rarity, item count
for i, item_name in ipairs(lootdrop_data["item_order"]) do
-- Get the item's data
local item_data = lootdrop_data["item"][item_name]
if item_data == nil then return "item_name '" .. item_name .. "' from item_order not found in lootdrop_data." end
-- Iterate each record in the item data
for j, item_record in ipairs(item_data) do
local luck_grade = item_record[1] --lua is index1 based
local rarity = item_record[2]
local count = item_record[3]
if luck_grade == nil then return "item_name '" .. item_name .. "' has a missing luck_grade." end
if rarity == nil then return "item_name '" .. item_name .. "' has a missing rarity." end
if count == nil then return "item_name '" .. item_name .. "' has a missing count." end
resulting_table = resulting_table .. "<tr>"
resulting_table = resulting_table .. "<td><div class='iconbox'><div class='rarity2 rounded relative'>[[File:"..item_name..".png|x80px|link="..item_name.."]]</div>[[" .. item_name .. "]]</div>" .. "</td>"
resulting_table = resulting_table .. "<td>" .. luck_grade .. "</td>"
resulting_table = resulting_table .. "<td>" .. rarity .. "</td>"
resulting_table = resulting_table .. "<td>" .. count .. "</td>"
resulting_table = resulting_table .. "</tr>"
end
end
resulting_table = resulting_table .. '</table><br>'
return resulting_table
end
return p