Anonymous
×
Create a new article
Write your page title here:
We currently have 496 articles on WIKI - Idle Pixel. Type your article name above or click on one of the titles below and start writing!



WIKI - Idle Pixel

Module:Breeding Enemy DB: Difference between revisions

No edit summary
Tag: Reverted
(Ops)
Tag: Undo
Line 1: Line 1:
u = require("Module:Util")
return {
edb = require("Module:Breeding_Enemy_DB")
adb = require("Module:Breeding_Area_DB")
lt = require("Module:Loot_Table")
inspect = require("Module:InspectLua")
local p = {}


function p.enemy_table(enemy)
-- Format: {Name, Area, Attack, HP, Difficult, {Loot1, Loot2, ...}},
    local result = [[]]
    if next(enemy[6]) == nil then
        return ''
    end
    return lt.lt(enemy[1],enemy[6])
end


function p.enemy_stats(enemy)
-- Loot Format: {Name},
return [[{{{!}} class="article-table"
! Enemy
!]] .. '[[File: Heart.png{{!}}20px]]' .. [[


!]] .. '[[File: Attack.png{{!}}20px]]' .. [[
-- Difficult: 1 = Normal, 2 = Hard and 3 = Very Hard


{{!}}-
--Fields
{{!}}]] .. '[[' .. [[File:Breeding]] .. lt.formatName(enemy[1]) .. 'Monster.png' .. [[{{!}}40px{{!}}link=]] .. enemy[1] .. ']]' .. [[
{"Squidshroom","Fields",1,5,1,{{"Red Mushroom"},{"Red Mushroom Cap"}}},
{"Snail","Fields",1,10,1,{{"Snail Sticky Glue"}}, {{"Small Snail Shell"}}, {{"Medium Snail Shell"}}, {{"Large Snail Shell"}}},


{{!}}]] .. enemy[4] .. [[
--Caves
 
}
{{!}}]] .. enemy[3] .. [[
 
{{!}}}
 
]] .. p.enemy_table(enemy)
end
 
function p.enemy_zone_tabber(areaEnemies)
    local enemies = {}
    local result = ""
    if type(areaEnemies) == 'string' then
        for _, enemy in ipairs(edb) do
            if enemy[2] == areaEnemies then
                table.insert(enemies, enemy)
            end
        end
    else
        enemies = areaEnemies
    end
    for index, e in ipairs(enemies) do
        result = result .. [[<htmltag tagname="input" type="radio" class="dTabsRadio" name="]] .. e[2] .. [[" id="]] .. e[1] .. [["]]
        if index == 1 then
result = result .. ' checked'
end
result = result .. [[></htmltag><htmltag tagname="label" for="]] .. e[1] .. [[" class="dTabsLabel">]] .. e[1] .. [[</htmltag>
<div class="dTabsContent dTabsSubcontent">
]] .. p.enemy_stats(e):gsub('|', '{{!}}') .. [[
</div>]]
    end
    return result
end
 
function p.enemy_all_tabber()
    local result = [[<div class="dTabs">]]
for idx, a in ipairs(adb) do
result = result .. '<htmltag tagname="input" type="radio" class="dTabsRadio" name="Areas" id="' .. a[1] .. '"'
if idx == 1 then
result = result .. ' checked'
end
result = result .. [[></htmltag><htmltag tagname="label" for="]] .. a[1] .. [[" class="dTabsLabel">]] .. a[1] .. [[</htmltag>
<div class="dTabsContent">]]
result = result .. p.enemy_zone_tabber(a[1]) .. [[</div>]]
    end
    return result .. [[</div>]]
end
 
function p.enemy_page_before(name)
    local enemy = nil
local l = ''
 
for _, e in ipairs(edb) do
l = l .. inspect(e)
if e[1] == name then
enemy = e
break
end
end
    return l
end
 
function p.enemy_page_after(name)
    local enemy = nil
    if type(name) == 'table' then
        enemy = name
        name = name[1]
    else
        for _, e in ipairs(edb) do
            if e[1] == name then
                enemy = e
                break
            end
        end
    end
    return [[{{Navbox Breeding Monsters}}
]] .. '[[Category:Breeding_' .. enemy[2] .. ']] [[Category:Breeding_Monsters]]' .. [[
]]
end
return p

Revision as of 19:49, 19 January 2025

Documentation for this module may be created at Module:Breeding Enemy DB/doc

return {

-- Format: {Name, Area, Attack, HP, Difficult, {Loot1, Loot2, ...}},

-- Loot Format: {Name},

-- Difficult: 1 = Normal, 2 = Hard and 3 = Very Hard

--Fields
{"Squidshroom","Fields",1,5,1,{{"Red Mushroom"},{"Red Mushroom Cap"}}},
{"Snail","Fields",1,10,1,{{"Snail Sticky Glue"}}, {{"Small Snail Shell"}}, {{"Medium Snail Shell"}}, {{"Large Snail Shell"}}},

--Caves
}