Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Module:Item: Difference between revisions

From Growtopia Wiki
Sorenesss (talk | contribs)
No edit summary
mNo edit summary
 
(100 intermediate revisions by 6 users not shown)
Line 1: Line 1:
local item = {}
local item = {}
local md5 = require('Module:Md5')


local function in_array(h,a)  
local function in_array(h,a)  
Line 23: Line 20:




local function getSprite(file, pos, tsize, rowlen, class)
local function getSprite(spriteType, pos, tsize, rowlen, class)
     tsize = tsize or 32
     tsize = tsize or 32
     rowlen = rowlen or 64
     rowlen = rowlen or 128
     class = class or {}
     class = class or {}
    table.insert(class, "growsprite")
    spriteType = tostring(spriteType or ""):lower()
    if spriteType ~= "seed" and spriteType ~= "tree" and spriteType ~= "item" then
        spriteType = "item"
    end
      
      
     table.insert(class,"growsprite")
     table.insert(class, "growsprite-" .. spriteType)
      
 
     return "<span class='"..table.concat(class," ").."'>"..mw.getCurrentFrame():preprocess("{{filepath:"..file.."}}"):gsub("?cb=(.*)$","/window-crop/width/"..tsize.."/x-offset/"..(pos%rowlen)*tsize.."/y-offset/"..math.floor(pos/rowlen)*tsize.."/window-width/"..tsize.."/window-height/"..tsize.."?format=webp&fill=cb-%1").."</span>[".."[Category:AutoPurge]]"
     local x = (pos % rowlen) * tsize
    local y = math.floor(pos / rowlen) * tsize
 
     return "<span class='"..table.concat(class," ").."' " ..
          "style='background-position:-"..x.."px -"..y.."px;width:"..tsize.."px;height:"..tsize.."px;'></span>" ..
          "[[Category:AutoPurge]]"
end
end


local function getSpriteOffset(pos, tsize, rowlen)
local function getSpriteOffset(pos, tsize, rowlen)
     tsize = tsize or 32
     tsize = tsize or 32
     rowlen = rowlen or 64
     rowlen = rowlen or 128


     return "-"..(pos%rowlen)*tsize.."px -"..math.floor(pos/rowlen)*tsize.."px"
     return "-"..(pos%rowlen)*tsize.."px -"..math.floor(pos/rowlen)*tsize.."px"
Line 42: Line 51:
local function getSeedSprite(data)  
local function getSeedSprite(data)  
     local class = {"seed"}
     local class = {"seed"}
     local pos = data[1]
     local pos = math.floor(data[1]/2)
     return getSprite("SeedSprites.png",pos,16,false,class)
     return getSprite("seed",pos,16,false,class)
end
end
local function getTreeSprite(data)  
local function getTreeSprite(data)  
     local pos = data[1]
     local pos = math.floor(data[1]/2)
     return getSprite("TreeSprites.png",pos,32)
     return getSprite("tree",pos,32)
end
end
local function getItemSprite(data)  
local function getItemSprite(data)  
     local class = {}
     local class = {}
     local pos = data[1]
     local pos = math.floor(data[1]/2)
     if(data[6] == 25) then table.insert(class,"shifty") end
     if(data[6] == 25) then table.insert(class,"shifty") end
     return getSprite("ItemSprites.png",pos,32,false,class)
     return getSprite("item",pos,32,false,class)
end
end
local function getItemDescription(name, data)
data = getItemData(name)
local chat = require('Module:Chat')
    local descpage = math.floor(data[1]/4096)+1
    local desc = mw.loadData('Module:Item/Desc'..descpage)
    if(data[2] == 19) then return chat.parse(desc[data[3]]) end
    return chat.parse(desc[name])
end
local function getItemSpriteByName(name, data)
local function getItemSpriteByName(name, data)
     local class = {}
     local class = {}
     data = data or getItemData(md5.md5(name))
     data = data or getItemData(name)
     if(data[2] == -1) then
     if(data[2] == -1) then
         local treeTest_name = name:gsub("%sTree$","")
         local treeTest_name = name:gsub("%sTree$","")
         if(treeTest_name ~= name) then  
         if(treeTest_name ~= name) then  
             local data2 = getItemData(md5.md5(treeTest_name))
             local data2 = getItemData(treeTest_name)
             if(data2[2] > -1) then return getTreeSprite(data2) end
             if(data2[2] > -1) then return getTreeSprite(data2) end
         end
         end
Line 69: Line 88:
     if(data[2] == 19 and not in_array(name,{"Magic Egg","Mutated Seed"})) then return getSeedSprite(data) end
     if(data[2] == 19 and not in_array(name,{"Magic Egg","Mutated Seed"})) then return getSeedSprite(data) end
     return getItemSprite(data)
     return getItemSprite(data)
end
function item.Type(frame)
local name = frame.args[1] or ""
if name == "" then
return ""
end
    local d = getItemData(name)
    local seed = d[2] == 19
 
    local result = {}
if(seed ~= true) then
    local ca = getItemType("category",d[2])
    if(d[2]==20) then ca = getItemType("clothingType",d[8]) end
    if(not ca[1]) then table.insert(result," <i class='warning'>Unknown ("..d[2]..")</i>")
    else
    table.insert(result, ca[1])
        if(ca[4] ~= false and ca[4] ~= 'Foreground') then table.insert(result, " "..ca[4])
        end
    end
end
return table.concat(result)
end
end


Line 74: Line 117:
function item.Sprite(frame)
function item.Sprite(frame)
     return getItemSpriteByName(frame.args[1])
     return getItemSpriteByName(frame.args[1])
end
function item.Description(frame)
local name = frame.args[1] or mw.title.getCurrentTitle().text
return getItemDescription(name);
end
end


function item.SpriteOffset(frame)
function item.SpriteOffset(frame)
     local tsize = frame.args[2] or 32
     local tsize = frame.args[2] or 32
     local data = getItemData(md5.md5(frame.args[1]))
     local data = getItemData(frame.args[1])
     local pos = data[1]
     local pos = math.floor(data[1]/2)
     return getSpriteOffset(pos,tsize,false)
     return getSpriteOffset(pos,tsize,false)
end
end
Line 97: Line 145:
          
          
     end
     end
     local d = getItemData(md5.md5(name))
     local d = getItemData(name)
     local s = getItemSpriteByName(name, d)
     local s = getItemSpriteByName(name, d)
     if(d[2] == -1) then
     if(d[2] == -1) then
         local tname = name:gsub("%sTree$","")
         local tname = name:gsub("%sTree$","")
         if(getItemData(md5.md5(tname))[2] ~= -1) then
         if(getItemData(tname)[2] ~= -1) then
             return s.." [["..tname.."|"..name.."]]"
             return s.." [["..tname.."|"..name.."]]"
         end
         end
         return s.." Unknown Item"
         return s.."<s>[["..name.."]]</s>"
     end
     end
     if(d[2] == 19) then
     if(d[2] == 19) then
         local iname = name:gsub("%sSeed$","")
         local iname = name:gsub("%sSeed$","")
         if(d[3] ~= md5.md5(iname)) then return s.." [["..name.."]]" end
         if(d[3] ~= iname) then return s.." [["..name.."]]" end
         return s.." [["..iname.."|"..dname.."]]"
         return s.." [["..iname.."|"..dname.."]]"
     else
     else
Line 116: Line 164:


function item.Infobox(frame)  
function item.Infobox(frame)  
     local name = frame.args["name"] or mw.title.getCurrentTitle().text
     local name = mw.text.trim(frame.args["name"] or "")
     local d = getItemData(md5.md5(name))
    if(name == "") then name = mw.title.getCurrentTitle().text end
    local event = frame.args["event"] or ""
     local d = getItemData(name)
    local seed = d[2] == 19
    local ca = false
    if(seed) then
    d = getItemData(d[3])
    end
      
      
     local s = {}
     local s = {}
      
      
     if(d[2] == -1 or d[2] == 19) then
     if(d[2] == -1) then
         table.insert(s,"<div><b style='color: #F00'>Invalid Item</b></div>")
         table.insert(s,"<div><b style='color: #F00'>Unknown Item - "..name.."</b></div>")
         if(mw.title.getCurrentTitle().nsText=="") then  
         if(mw.title.getCurrentTitle().nsText=="") then  
             addCategory(s,"Invalid Item")
             addCategory(s,"Invalid Item")
Line 131: Line 186:
     local c = {}
     local c = {}
     addCategory(c,"Item")
     addCategory(c,"Item")
     table.insert(s,"__NOTOC__<div class='gtw-card item-card'>")
     table.insert(s,"__NOTOC__<div class='gtw-card item-card'>")
     table.insert(s,"<div class='card-header'><h3>")
     table.insert(s,"<div class='card-header'><h3>")
     table.insert(s,getItemSprite(d))
     if(seed) then
    table.insert(s,getSeedSprite(d))
    else
    table.insert(s,getItemSprite(d))
    end
     table.insert(s,"&nbsp;<b>"..name)
     table.insert(s,"&nbsp;<b>"..name)
    if(d[3]<999) then
    if(d[3]<999) then
         table.insert(s,"&nbsp;<small>(Rarity: "..d[3]..")</small>")
         table.insert(s,"&nbsp;<small>(Rarity: "..d[3]..")</small>")
     end
     end
     table.insert(s,"</b></h3><span></span></div>")
     table.insert(s,"</b></h3><span></span></div>")
     --------------------
     --------------------
     table.insert(s,"<div class='card-text'>")
     table.insert(s,"<div class='card-text colorable'>")
     if((frame.args[1] or ""):len()>0) then
     if(d[2]==64) then table.insert(s,"This is a 1 lb. "..name..". ") end
        if(d[2]==64) then table.insert(s,"This is a 1 lb. "..name..". ") end
--    if((frame.args[1] or ""):len()>0) then
        table.insert(s,frame.args[1])
--        table.insert(s,frame.args[1])
    else
--    else
        table.insert(s,"<i class='warning'>Description missing.</i>")
    table.insert(s,getItemDescription(name,d))
        addCategory(c,"Missing Description")
--    end
    end
     table.insert(s,"</div>")
     table.insert(s,"</div>")
     --------------------
     --------------------
Line 154: Line 213:
      
      
     local l = {}
     local l = {}
     if((d[4]/1)%2>=1) then
     if(seed) then
        table.insert(l,"This item can be placed in two directions, depending on the direction you're facing.") end
    if((d[4]/4)%2>=1) then
     if((d[4]/16384)%2>=1) then
        table.insert(l,"This item never drops any [[seed]]s.") end
        if(name=="Shark Tooth") then table.insert(l,"This item can only be created during [[SummerFest]]!")
     else
        elseif(name=="Eternal Rose" or name=="Heart Wallpaper") then table.insert(l,"This item can only be [[Guide:Splicing|spliced]] during [[Valentine's Week]].")
    if((d[4]/1)%2>=1) then
        elseif(name=="Backwards Ballcap" or name=="Hand Chair" or name=="Gummy Bear Block - Red" or name=="Gummy Bear Block - Green" or name=="Gummy Bear Block - Yellow") then table.insert(l,"This item can only be [[Guide:Splicing|spliced]] during the [[Grow4Good Week]]!")
        table.insert(l,"This item can be placed in two directions, depending on the direction you're facing.") end
        elseif(name=="Grow-Cola Block") then table.insert(l,"This item can only be [[Guide:Splicing|spliced]] during [[Thanksgiving Week]].")
    if((d[4]/16384)%2>=1) then
        elseif(name=="Fortune Cookie" or name=="Lucky Token" or name=="Year of the Pig Lucky Token" or name=="Lucky Fortune Cookie" or name=="Year of the Rat Lucky Token" or name=="Year of the Ox Lucky Token" or name=="Cottage Doorway" or name=="Golden Leprechaun Hat" or name=="Golden Leprechaun Suit" or name=="Bouncy Castle Block") then table.insert(l,"This item can't be spliced by mortal man.")
    if(event ~= "") then
        elseif(name=="Lollipop Garden") then table.insert(l,"This item can only be spliced during Easter event.")
    if(event:lower()=="mortal man") then table.insert(l,"This item can't be spliced by mortal man.")
        else table.insert(l,"This item can only be created during [[WinterFest]]!") end
    else table.insert(l,"This item can only be created during " .. event .. ".")
    end
    end
    if((d[4]/4)%2>=1) then
        else table.insert(l,"This item can only be created during its release event.") end
        table.insert(l,"This item never drops any [[seed]]s.") end
    end
    if((d[4]/2)%2>=1) then
    if((d[4]/4)%2>=1) then
        table.insert(l,"This item has special properties you can adjust with the [[Wrench]].") end
        table.insert(l,"This item never drops any [[seed]]s.") end
    if((d[4]/32)%2>=1) then
    if((d[4]/2)%2>=1) then
        if(d[2]==20) then table.insert(l,"This item can kill zombies during a Pandemic!")  
        table.insert(l,"This item has special properties you can adjust with the [[Wrench]].") end
        else table.insert(l,"This item can't be used on yourself.") end
    if((d[4]/32)%2>=1) then
    end
        if(d[2]==20) then  
    if((d[4]/128)%2>=1) then
        table.insert(l,"This item can kill zombies during a Pandemic!")
        table.insert(l,"This item can only be used in World-Locked worlds.") end
        addCategory(s,"Zombie Weapon Mod Items")
    if((d[4]/512)%2>=1) then
        else table.insert(l,"This item can't be used on yourself.") end
        table.insert(l,"This item can't be destroyed - smashing it will return it to your backpack if you have room!")  
    end
    end
    if((d[4]/128)%2>=1) then
    if((d[4]/2048)%2>=1) then
        table.insert(l,"This item can only be used in World-Locked worlds.") end
        table.insert(l,"A tree of this type can bear surprising fruit!") end
    if((d[4]/512)%2>=1) then
    if((d[4]/4096)%2>=1) then
        table.insert(l,"This item can't be destroyed - smashing it will return it to your backpack if you have room!")  
        table.insert(l,"This item is PUBLIC: Even if it's locked, anyone can smash it.") end
    end
    if((d[4]/32768)%2>=1) then
    if((d[4]/2048)%2>=1) then
        table.insert(l,"This item cannot be [[dropping|dropped]] or [[trading|traded]].")
        table.insert(l,"A tree of this type can bear surprising fruit!")  
        addCategory(s,"Untradeable")  end
        addCategory(s,"Surprising Fruit Items")
    if((d[14]/262144)%2>=1) then
        end
        table.insert(l,"This item can be [[:Category:Transmutable|transmuted]].")
    if((d[4]/4096)%2>=1) then
        addCategory(s,"Transmutable") end
        table.insert(l,"This item is PUBLIC: Even if it's locked, anyone can smash it.")
    if(d[2]==3) then
        addCategory(s,"Public Items") end
        table.insert(l,"A lock makes it so only you (and designated friends) can edit an area.") end
    if((d[4]/32768)%2>=1) then
    if(d[2]==37 or d[2]==114) then
        table.insert(l,"This item cannot be [[dropping|dropped]] or [[trading|traded]].")
        table.insert(l,"This item has no use... by itself.") end
        addCategory(s,"Untradeable")  end
    if(d[2]==64) then
    if((d[14]/262144)%2>=1) then
        table.insert(l,"This is a fish. It can only be placed in a [[Fish Tank]]. You can't divide fish into pieces.") end
        table.insert(l,"This item can be [[:Category:Transmutable|transmuted]].")
    if(d[2]==107 and name ~= "Ancient Shards" and name ~= "Samille's Soul Abductor") then
        addCategory(s,"Transmutable") end
        table.insert(l,"This item can be upgraded.") end
    if(d[2]==3) then
        table.insert(l,"A lock makes it so only you (and designated friends) can edit an area.") end
    if(d[2]==37 or d[2]==114) then
        table.insert(l,"This item has no use... by itself.") end
    if(d[2]==64) then
        table.insert(l,"This is a fish. It can only be placed in a [[Fish Tank]]. You can't divide fish into pieces.") end
    if(d[2]==107 and name:find("^Ancestral") ~= nil) then
        table.insert(l,"This item can be upgraded.") end
    if(name=="Party Projector" or name=="Snow Machine") then
        table.insert(l,"This item can't be destroyed - smashing it will always yield a new one.") end
end
      
      
     if(#l==0) then table.insert(s,"None")
     if(#l==0) then table.insert(s,"None")
Line 204: Line 273:
     table.insert(s,"<table class='card-field'>")
     table.insert(s,"<table class='card-field'>")
      
      
     table.insert(s,"<tr><th>Type</th><td>")
     if(seed ~= true) then
    local ca = getItemType("category",d[2])
    table.insert(s,"<tr><th>Type</th><td>")
    if(d[2]==20) then ca = getItemType("clothingType",d[8]) end
    ca = getItemType("category",d[2])
    if(not ca[1]) then table.insert(s,getItemSpriteByName("Blank").." <i class='warning'>Unknown ("..d[2]..")</i>")
    if(d[2]==20) then ca = getItemType("clothingType",d[8]) end
    else
    if(not ca[1]) then table.insert(s,getItemSpriteByName("Blank").." <i class='warning'>Unknown ("..d[2]..")</i>")
        table.insert(s,getItemSpriteByName(ca[3]).." "..ca[1])
    else
        if(ca[4] ~= false) then table.insert(s,"<small> - "..ca[4].."</small>") end
        table.insert(s,getItemSpriteByName(ca[3]).." "..ca[1])
        if(#ca[2] > 0) then table.insert(s,"<br><small class='desc'>"..ca[2].."</small>") end
        if(ca[4] ~= false) then table.insert(s,"<small> - "..ca[4].."</small>") end
    end
        if(#ca[2] > 0) then table.insert(s,"<br><small class='desc'>"..ca[2].."</small>") end
    end
end
      
      
     table.insert(s,"</td></tr><tr><th>Chi</th><td>")
     table.insert(s,"</td></tr><tr><th>Chi</th><td>")
Line 225: Line 296:
         addCategory(c,"Missing Chi")
         addCategory(c,"Missing Chi")
     end
     end
    table.insert(s,"</td></tr><tr><th>Texture Type</th><td>")
if(seed ~= true) then
    local tt = getItemType("textureType",d[5])
    table.insert(s,"</td></tr><tr><th>Texture Type</th><td>")
    table.insert(s,getSprite("TextureTypeSprite.png", d[5], 32, 8).." "..(tt[1] or "<i class='warning'>Unknown</i>"))
    local tt = getItemType("textureType",d[5])
    table.insert(s,getSprite("TextureTypeSprite.png", d[5], 32, 8).." "..(tt[1] or "<i class='warning'>Unknown</i>"))
    table.insert(s,"</td></tr><tr><th>Collision Type</th><td>")
    local ct = getItemType("collisionType",d[7])
    table.insert(s,"</td></tr><tr><th>Collision Type</th><td>")
    table.insert(s,getSprite("CollisionTypeSprite.png", d[7], 32, 8).." "..(ct[1] or "<i class='warning'>Unknown</i>"))
    local ct = getItemType("collisionType",d[7])
   
    table.insert(s,getSprite("CollisionTypeSprite.png", d[7], 32, 8).." "..(ct[1] or "<i class='warning'>Unknown</i>"))
    table.insert(s,"</td></tr><tr><th>Hardness</th><td>"..getItemSpriteByName("Fist").." ")
   
    table.insert(s,math.ceil(d[9]/6).." Hits<br>"..getItemSpriteByName("Pickaxe").." ")
    table.insert(s,"</td></tr><tr><th>Hardness</th><td>"..getItemSpriteByName("Fist").." ")
    table.insert(s,math.ceil(d[9]/8).." Hits<br><small>Restores after <b>"..d[10].."s</b>")
    table.insert(s,math.ceil(d[9]/6).." Hits<br>"..getItemSpriteByName("Pickaxe").." ")
    table.insert(s," of inactivity.</small></td></tr>")
    table.insert(s,math.ceil(d[9]/8).." Hits<br><small>Restores after <b>"..d[10].."s</b>")
    table.insert(s," of inactivity.</small></td></tr>")
end
      
      
     table.insert(s,"<tr><th>Seed Color</th><td class='seedColor'>"..getSeedSprite(d).." <div>")
     table.insert(s,"<tr><th>Seed Color</th><td class='seedColor'>"..getSeedSprite(d).." <div>")
Line 261: Line 334:
     table.insert(s,"</table>")
     table.insert(s,"</table>")
      
      
     if(ca[4] =="Foreground" or ca[4] =="Background") then
     if(seed ~= true and (ca[4] =="Foreground" or ca[4] =="Background")) then
         table.insert(s,"<b class='card-title nomobile'>Paint Preview</b>")
         table.insert(s,"<b class='card-title nomobile'>Paint Preview</b>")
         table.insert(s,"<div class='card-text paint-preview nomobile'>")
         table.insert(s,"<div class='card-text paint-preview nomobile'>")
Line 280: Line 353:
   
   
     ----- [Handle Category] -----
     ----- [Handle Category] -----
     if(d[2]==2) then  
     if(seed) then
        addCategory(c,"Doors")
    addCategory(c,"Seed")
    elseif(d[2]==3) then  
    else
        addCategory(c,"Locks")
    if(d[2]==2) then  
    elseif(d[2]==5) then  
        addCategory(c,"Doors")
        addCategory(c,"Treasure Blocks")
    elseif(d[2]==3) then  
    elseif(d[2]==6) then  
        addCategory(c,"Locks")
        addCategory(c,"Deadly Blocks")
    elseif(d[2]==5) then  
    elseif(d[2]==7) then  
        addCategory(c,"Treasure Blocks")
        addCategory(c,"Trampoline Blocks")
    elseif(d[2]==6) then  
    elseif(d[2]==8) then  
        addCategory(c,"Deadly Blocks")
        addCategory(c,"Consumables")
    elseif(d[2]==7) then  
    elseif(d[2]==9 or d[2]==104 or d[2]==105 or d[2]==106) then  
        addCategory(c,"Trampoline Blocks")
        addCategory(c,"Entrances")
    elseif(d[2]==8) then  
    elseif(d[2]==10) then  
        addCategory(c,"Consumables")
        addCategory(c,"Signs")
    elseif(d[2]==9 or d[2]==104 or d[2]==105 or d[2]==106) then  
    elseif(d[2]==11) then  
        addCategory(c,"Entrances")
        addCategory(c,"SFX Foreground Blocks")
    elseif(d[2]==10) then  
    elseif(d[2]==12) then  
        addCategory(c,"Signs")
        addCategory(c,"Toggleable Animated Foreground Blocks")
    elseif(d[2]==11) then  
    elseif(d[2]==14) then  
        addCategory(c,"SFX Foreground Blocks")
        addCategory(c,"Platforms")
    elseif(d[2]==12) then  
    elseif(d[2]==16) then  
        addCategory(c,"Toggleable Animated Foreground Blocks")
        addCategory(c,"Pain Blocks (Lava)")
    elseif(d[2]==14) then  
    elseif(d[2]==20) then  
        addCategory(c,"Platforms")
        addCategory(c,"Clothes")
    elseif(d[2]==16) then  
        addCategory(c,getItemType("clothingType",d[8])[1].." (Clothes)")
        addCategory(c,"Pain Blocks (Lava)")
    elseif(d[2]==21) then  
    elseif(d[2]==20) then  
        addCategory(c,"Animated Foreground Blocks")
        addCategory(c,"Clothes")
    elseif(d[2]==22) then  
        addCategory(c,getItemType("clothingType",d[8])[1].." (Clothes)")
        addCategory(c,"SFX Background Blocks")
    elseif(d[2]==21) then  
    elseif(d[2]==23) then  
        addCategory(c,"Animated Foreground Blocks")
        addCategory(c,"Toggleable Background Blocks")
    elseif(d[2]==22) then  
    elseif(d[2]==24) then  
        addCategory(c,"SFX Background Blocks")
        addCategory(c,"Bouncy Blocks")
    elseif(d[2]==23) then  
    elseif(d[2]==25) then  
        addCategory(c,"Toggleable Background Blocks")
        addCategory(c,"Pain Blocks (Spike)")
    elseif(d[2]==24) then  
    elseif(d[2]==26) then  
        addCategory(c,"Bouncy Blocks")
        addCategory(c,"Portals")
    elseif(d[2]==25) then  
    elseif(d[2]==27) then  
        addCategory(c,"Pain Blocks (Spike)")
        addCategory(c,"Checkpoints")
    elseif(d[2]==26) then  
    elseif(d[2]==28) then  
        addCategory(c,"Portals")
        addCategory(c,"Sheet Music")
    elseif(d[2]==27) then  
    elseif(d[2]==29) then  
        addCategory(c,"Checkpoints")
        addCategory(c,"Slippery Blocks")
    elseif(d[2]==28) then  
    elseif(d[2]==31) then  
        addCategory(c,"Sheet Music")
        addCategory(c,"Toggleable Blocks")
    elseif(d[2]==29) then  
    elseif(d[2]==32) then  
        addCategory(c,"Slippery Blocks")
        addCategory(c,"Chests")
    elseif(d[2]==31) then  
    elseif(d[2]==33) then  
        addCategory(c,"Toggleable Blocks")
        addCategory(c,"Mailboxes")
    elseif(d[2]==32) then  
    elseif(d[2]==34) then  
        addCategory(c,"Chests")
        addCategory(c,"Bulletin Boards")
    elseif(d[2]==33) then  
    elseif(d[2]==35) then  
        addCategory(c,"Mailboxes")
        addCategory(c,"Event Mystery Blocks")
    elseif(d[2]==34) then  
    elseif(d[2]==36) then  
        addCategory(c,"Bulletin Boards")
        addCategory(c,"Random Blocks")
    elseif(d[2]==35) then  
    elseif(d[2]==37 or d[2]==129) then  
        addCategory(c,"Event Mystery Blocks")
        addCategory(c,"Components")
    elseif(d[2]==36) then  
    elseif(d[2]==38) then  
        addCategory(c,"Random Blocks")
        addCategory(c,"Providers")
    elseif(d[2]==37 or d[2]==129) then  
    elseif(d[2]==39) then  
        addCategory(c,"Components")
        addCategory(c,"Chemical Combiners")
    elseif(d[2]==38) then  
    elseif(d[2]==41 or d[2]==81 or d[2]==89) then  
        addCategory(c,"Providers")
        addCategory(c,"Weather Machines")
    elseif(d[2]==39) then  
    elseif(d[2]==45) then  
        addCategory(c,"Chemical Combiners")
        addCategory(c,"Toggleable Deadly Blocks")
    elseif(d[2]==41 or d[2]==81 or d[2]==89) then  
    elseif(d[2]==47) then  
        addCategory(c,"Weather Machines")
        addCategory(c,"Donation Boxes")
    elseif(d[2]==45) then  
    elseif(d[2]==49) then  
        addCategory(c,"Toggleable Deadly Blocks")
        addCategory(c,"Mannequins")
    elseif(d[2]==47) then  
    elseif(d[2]==50) then
        addCategory(c,"Donation Boxes")
        addCategory(c,"Security Cameras")
    elseif(d[2]==49) then  
    elseif(d[2]==52) then  
        addCategory(c,"Mannequins")
        addCategory(c,"Game Blocks")
    elseif(d[2]==50) then
    elseif(d[2]==56) then  
        addCategory(c,"Security Cameras")
        addCategory(c,"Crystals")
    elseif(d[2]==52) then  
    elseif(d[2]==60) then  
        addCategory(c,"Game Blocks")
        addCategory(c,"Pushing Blocks")
    elseif(d[2]==56) then  
    elseif(d[2]==64) then  
        addCategory(c,"Crystals")
        addCategory(c,"Fish")
    elseif(d[2]==60) then  
    elseif(d[2]==98) then  
        addCategory(c,"Pushing Blocks")
        addCategory(c,"Cooking Ovens")
    elseif(d[2]==64) then  
    elseif(d[2]==107) then  
        addCategory(c,"Fishes")
        addCategory(c,"Artifacts")
    elseif(d[2]==93) then
    elseif(d[2]==108) then  
    addCategory(c,"Howlers")
        addCategory(c,"Jelly Blocks")
    elseif(d[2]==98) then  
    elseif(d[2]==113) then  
        addCategory(c,"Cooking Ovens")
        addCategory(c,"CyBlock Bots")
    elseif(d[2]==107) then  
    elseif(d[2]==114) then  
        addCategory(c,"Artifacts")
        addCategory(c,"CyBlock Commands")
    elseif(d[2]==108) then  
    elseif(d[2]==115) then  
        addCategory(c,"Jelly Blocks")
        addCategory(c,"Lucky Tokens")
    elseif(d[2]==113) then  
    elseif(d[2]==120) then  
        addCategory(c,"CyBlock Bots")
        addCategory(c,"Startopia Starship Blocks")
    elseif(d[2]==114) then  
    elseif(d[2]==122) then  
        addCategory(c,"CyBlock Commands")
        addCategory(c,"Toggleable Multi-Framed Animated Foreground Blocks")
    elseif(d[2]==115) then  
    elseif(d[2]==123 or d[2]==124 or d[2]==125) then  
        addCategory(c,"Lucky Tokens")
        addCategory(c,"Autobreaking Blocks")
    elseif(d[2]==120) then  
    elseif(d[2]==128) then  
        addCategory(c,"Startopia Starship Blocks")
        addCategory(c,"Puddle Blocks")
    elseif(d[2]==122) then  
    elseif(d[2]==136) then  
        addCategory(c,"Toggleable Multi-Framed Animated Foreground Blocks")
        addCategory(c,"Pain Blocks (Acid)")
    elseif(d[2]==123 or d[2]==124 or d[2]==125) then  
    end
        addCategory(c,"Autobreaking Blocks")
    local isBlock = false
    elseif(d[2]==128) then  
    if(ca[4] =="Foreground") then
        addCategory(c,"Puddle Blocks")
        addCategory(c,"Foreground Blocks")
    elseif(d[2]==136) then  
        isBlock = true
        addCategory(c,"Pain Blocks (Acid)")
    end
    end
    if(ca[4] =="Background") then
    local isBlock = false
        addCategory(c,"Background Blocks")
    if(ca[4] =="Foreground") then
        isBlock = true
        addCategory(c,"Foreground Blocks")
    end
        isBlock = true
    if(d[7]==0 and isBlock) then
    end
        addCategory(c,"Non-solid Blocks")
    if(ca[4] =="Background") then
    end
        addCategory(c,"Background Blocks")
    if(isBlock) then
        isBlock = true
    addCategory(c,"Blocks")
    end
    end
    if(d[7]==0 and isBlock) then
        addCategory(c,"Non-solid Blocks")
    end
    if(isBlock) then
    addCategory(c,"Blocks")
    end
    if(d[3]<999) then
    addCategory(c,"Rarity "..d[3])
    end
end
     if(mw.title.getCurrentTitle().nsText=="") then
     if(mw.title.getCurrentTitle().nsText=="") then
         table.insert(s,table.concat(c))
         table.insert(s,table.concat(c))

Latest revision as of 09:48, 12 January 2026

Documentation for this module may be created at Module:Item/doc

local item = {}

local function in_array(h,a) 
    for k,v in ipairs(a) do if v == h then return true end end return false
end
local function addCategory(t,n) 
   table.insert(t,"[".."[Category:"..n.."]]") 
end


local function getItemData(hash)
    local a = mw.loadData('Module:Item/Data')
    return a[hash] or {-1, -1}
end

local function getItemType(name,id)
    local a = mw.loadData('Module:Item/Type')
    return (a[name] or {})[id] or {}
end


local function getSprite(spriteType, pos, tsize, rowlen, class)
    tsize = tsize or 32
    rowlen = rowlen or 128
    class = class or {}

    table.insert(class, "growsprite")

    spriteType = tostring(spriteType or ""):lower()
    if spriteType ~= "seed" and spriteType ~= "tree" and spriteType ~= "item" then
        spriteType = "item"
    end
    
    table.insert(class, "growsprite-" .. spriteType)

    local x = (pos % rowlen) * tsize
    local y = math.floor(pos / rowlen) * tsize

    return "<span class='"..table.concat(class," ").."' " ..
           "style='background-position:-"..x.."px -"..y.."px;width:"..tsize.."px;height:"..tsize.."px;'></span>" ..
           "[[Category:AutoPurge]]"
end

local function getSpriteOffset(pos, tsize, rowlen)
    tsize = tsize or 32
    rowlen = rowlen or 128

    return "-"..(pos%rowlen)*tsize.."px -"..math.floor(pos/rowlen)*tsize.."px"
end

local function getSeedSprite(data) 
    local class = {"seed"}
    local pos = math.floor(data[1]/2)
    return getSprite("seed",pos,16,false,class)
end
local function getTreeSprite(data) 
    local pos = math.floor(data[1]/2)
    return getSprite("tree",pos,32)
end
local function getItemSprite(data) 
    local class = {}
    local pos = math.floor(data[1]/2)
    if(data[6] == 25) then table.insert(class,"shifty") end
    return getSprite("item",pos,32,false,class)
end

local function getItemDescription(name, data)
	data = getItemData(name)
	local chat = require('Module:Chat')
    local descpage = math.floor(data[1]/4096)+1
    local desc = mw.loadData('Module:Item/Desc'..descpage)
    if(data[2] == 19) then return chat.parse(desc[data[3]]) end
    return chat.parse(desc[name])
end

local function getItemSpriteByName(name, data)
    local class = {}
    data = data or getItemData(name)
    if(data[2] == -1) then
        local treeTest_name = name:gsub("%sTree$","")
        if(treeTest_name ~= name) then 
            local data2 = getItemData(treeTest_name)
            if(data2[2] > -1) then return getTreeSprite(data2) end
        end
    end
        

    if(data[2] == 19 and not in_array(name,{"Magic Egg","Mutated Seed"})) then return getSeedSprite(data) end
    return getItemSprite(data)
end

function item.Type(frame)
	local name = frame.args[1] or ""
	if name == "" then
		return ""
	end
	
    local d = getItemData(name)
    local seed = d[2] == 19
  
    local result = {}
	if(seed ~= true) then
	    local ca = getItemType("category",d[2])
	    if(d[2]==20) then ca = getItemType("clothingType",d[8]) end
	    if(not ca[1]) then table.insert(result," <i class='warning'>Unknown ("..d[2]..")</i>")
	    else
	    	table.insert(result, ca[1])
	        if(ca[4] ~= false and ca[4] ~= 'Foreground') then table.insert(result, " "..ca[4])
	        end
	    end
	end
	
	return table.concat(result)
end


function item.Sprite(frame)
    return getItemSpriteByName(frame.args[1])
end

function item.Description(frame)
	 local name = frame.args[1] or mw.title.getCurrentTitle().text
	 return getItemDescription(name);
end

function item.SpriteOffset(frame)
    local tsize = frame.args[2] or 32
    local data = getItemData(frame.args[1])
    local pos = math.floor(data[1]/2)
    return getSpriteOffset(pos,tsize,false)
end

function item.SpritePos(frame)
    return getSprite(frame.args[1],frame.args[2],frame.args[3],frame.args[4])
end

function item.ItemLink(frame)
    local name = frame.args[1] or ""
    dname = name
    if(name == "Card Block Seed") then
        name = "Card Block - Spade Seed"
    end
    if(name == "Tangram Block Seed") then
        name = "Tangram Block A Seed"
        
    end
    local d = getItemData(name)
    local s = getItemSpriteByName(name, d)
    if(d[2] == -1) then
        local tname = name:gsub("%sTree$","")
        if(getItemData(tname)[2] ~= -1) then
            return s.." [["..tname.."|"..name.."]]"
        end
        return s.."<s>[["..name.."]]</s>"
    end
    if(d[2] == 19) then
        local iname = name:gsub("%sSeed$","")
        if(d[3] ~= iname) then return s.." [["..name.."]]" end
        return s.." [["..iname.."|"..dname.."]]"
    else
        return s.." [["..name.."]]"
    end
end

function item.Infobox(frame) 
    local name = mw.text.trim(frame.args["name"] or "")
    if(name == "") then name = mw.title.getCurrentTitle().text end
    local event = frame.args["event"] or ""
    local d = getItemData(name)
    local seed = d[2] == 19
    local ca = false
    if(seed) then
    	d = getItemData(d[3])
    end
    
    local s = {}
    
    if(d[2] == -1) then
        table.insert(s,"<div><b style='color: #F00'>Unknown Item - "..name.."</b></div>")
        if(mw.title.getCurrentTitle().nsText=="") then 
            addCategory(s,"Invalid Item")
        end
        return table.concat(s)
    end
    
    local c = {}
    addCategory(c,"Item")

    table.insert(s,"__NOTOC__<div class='gtw-card item-card'>")
    table.insert(s,"<div class='card-header'><h3>")
    if(seed) then
    	table.insert(s,getSeedSprite(d))
    else
	    table.insert(s,getItemSprite(d))
    end
    table.insert(s,"&nbsp;<b>"..name)
    if(d[3]<999) then
        table.insert(s,"&nbsp;<small>(Rarity: "..d[3]..")</small>")
    end
    table.insert(s,"</b></h3><span></span></div>")
    --------------------
    table.insert(s,"<div class='card-text colorable'>")
    if(d[2]==64) then table.insert(s,"This is a 1 lb. "..name..". ") end
--    if((frame.args[1] or ""):len()>0) then
--        table.insert(s,frame.args[1])
--    else
    table.insert(s,getItemDescription(name,d))
--    end
    table.insert(s,"</div>")
    --------------------
    table.insert(s,"<b class='card-title'>Properties</b>")
    table.insert(s,"<div class='card-text'>")
    
    local l = {}
    if(seed) then
    	if((d[4]/4)%2>=1) then
	        table.insert(l,"This item never drops any [[seed]]s.") end
    else
	    if((d[4]/1)%2>=1) then
	        table.insert(l,"This item can be placed in two directions, depending on the direction you're facing.") end
	    if((d[4]/16384)%2>=1) then
	    	if(event ~= "") then
	    		if(event:lower()=="mortal man") then table.insert(l,"This item can't be spliced by mortal man.")  
	    		else table.insert(l,"This item can only be created during " .. event .. ".")
	    	end
	        else table.insert(l,"This item can only be created during its release event.") end
	    end
	    if((d[4]/4)%2>=1) then
	        table.insert(l,"This item never drops any [[seed]]s.") end
	    if((d[4]/2)%2>=1) then
	        table.insert(l,"This item has special properties you can adjust with the [[Wrench]].") end
	    if((d[4]/32)%2>=1) then
	        if(d[2]==20) then 
	        	table.insert(l,"This item can kill zombies during a Pandemic!")
	        	addCategory(s,"Zombie Weapon Mod Items")
	        else table.insert(l,"This item can't be used on yourself.") end
	    end
	    if((d[4]/128)%2>=1) then
	        table.insert(l,"This item can only be used in World-Locked worlds.") end
	    if((d[4]/512)%2>=1) then
	        table.insert(l,"This item can't be destroyed - smashing it will return it to your backpack if you have room!") 
	    end
	    if((d[4]/2048)%2>=1) then
	        table.insert(l,"A tree of this type can bear surprising fruit!") 
	        addCategory(s,"Surprising Fruit Items")
	        end
	    if((d[4]/4096)%2>=1) then
	        table.insert(l,"This item is PUBLIC: Even if it's locked, anyone can smash it.") 
	        addCategory(s,"Public Items") end
	    if((d[4]/32768)%2>=1) then
	        table.insert(l,"This item cannot be [[dropping|dropped]] or [[trading|traded]].")
	        addCategory(s,"Untradeable")  end
	    if((d[14]/262144)%2>=1) then
	        table.insert(l,"This item can be [[:Category:Transmutable|transmuted]].")
	        addCategory(s,"Transmutable") end
	    if(d[2]==3) then
	        table.insert(l,"A lock makes it so only you (and designated friends) can edit an area.") end
	    if(d[2]==37 or d[2]==114) then
	        table.insert(l,"This item has no use... by itself.") end
	    if(d[2]==64) then
	        table.insert(l,"This is a fish. It can only be placed in a [[Fish Tank]]. You can't divide fish into pieces.") end
	    if(d[2]==107 and name:find("^Ancestral") ~= nil) then
	        table.insert(l,"This item can be upgraded.") end
	    if(name=="Party Projector" or name=="Snow Machine") then
	        table.insert(l,"This item can't be destroyed - smashing it will always yield a new one.") end
	end
    
    if(#l==0) then table.insert(s,"None")
    else table.insert(s,table.concat(l,"<br>")) end
    table.insert(s,"</div>")
    --------------------
    table.insert(s,"<b class='card-title'>Data</b>")
    table.insert(s,"<table class='card-field'>")
    
    if(seed ~= true) then
	    table.insert(s,"<tr><th>Type</th><td>")
	    ca = getItemType("category",d[2])
	    if(d[2]==20) then ca = getItemType("clothingType",d[8]) end
	    if(not ca[1]) then table.insert(s,getItemSpriteByName("Blank").." <i class='warning'>Unknown ("..d[2]..")</i>")
	    else
	        table.insert(s,getItemSpriteByName(ca[3]).." "..ca[1])
	        if(ca[4] ~= false) then table.insert(s,"<small> - "..ca[4].."</small>") end
	        if(#ca[2] > 0) then table.insert(s,"<br><small class='desc'>"..ca[2].."</small>") end
	    end
	end
    
    table.insert(s,"</td></tr><tr><th>Chi</th><td>")
    local chi_uc = mw.getContentLanguage():ucfirst((frame.args[2] or ""):lower())
    if(chi_uc == "None" or in_array(d[2],{20,107})) then
        table.insert(s,"None")
    elseif(in_array(chi_uc,{"Fire","Water","Earth","Wind"})) then
        table.insert(s,getItemSpriteByName("Element - "..chi_uc).." "..chi_uc)
        addCategory(c,"Chi - "..chi_uc)
    else
        table.insert(s,"<i class='warning'>Unknown</i>")
        addCategory(c,"Missing Chi")
    end
	
	if(seed ~= true) then
	    table.insert(s,"</td></tr><tr><th>Texture Type</th><td>")
	    local tt = getItemType("textureType",d[5])
	    table.insert(s,getSprite("TextureTypeSprite.png", d[5], 32, 8).." "..(tt[1] or "<i class='warning'>Unknown</i>"))
	 
	    table.insert(s,"</td></tr><tr><th>Collision Type</th><td>")
	    local ct = getItemType("collisionType",d[7])
	    table.insert(s,getSprite("CollisionTypeSprite.png", d[7], 32, 8).." "..(ct[1] or "<i class='warning'>Unknown</i>"))
	    
	    table.insert(s,"</td></tr><tr><th>Hardness</th><td>"..getItemSpriteByName("Fist").." ")
	    table.insert(s,math.ceil(d[9]/6).." Hits<br>"..getItemSpriteByName("Pickaxe").." ")
	    table.insert(s,math.ceil(d[9]/8).." Hits<br><small>Restores after <b>"..d[10].."s</b>")
	    table.insert(s," of inactivity.</small></td></tr>")
	end
    
    table.insert(s,"<tr><th>Seed Color</th><td class='seedColor'>"..getSeedSprite(d).." <div>")
    table.insert(s,"<span style='background:"..d[11].."'></span> "..d[11].."<br>")
    table.insert(s,"<span style='background:"..d[12].."'></span> "..d[12].."</div></td></tr>")
    
    table.insert(s,"<tr><th>Grow Time</th><td>"..getTreeSprite(d).." ")
    if(d[13]>=604800) then table.insert(s,math.floor(d[13]/604800).."w ") end
    if(d[13]>=86400) then table.insert(s,math.floor(d[13]%604800/86400).."d ") end
    if(d[13]>=3600) then table.insert(s,math.floor(d[13]%86400/3600).."h ") end
    if(d[13]>=60) then table.insert(s,math.floor(d[13]%3600/60).."m ") end
    table.insert(s,(d[13]%60).."s</td></tr>")
    
    table.insert(s,"<tr><th>Default Gems Drop</th><td>"..getItemSpriteByName("Gems").." ")
    if(d[3]==999) then table.insert(s,"N/A".."</td></tr>")
    else
        if((d[14]/131072)%2>=1) then table.insert(s,"0</td></tr>")
        elseif(d[3]>30) then table.insert(s,"0 - "..math.floor(d[3]/4+1).."</td></tr>")
        elseif(d[3]>=8) then table.insert(s,"0 - "..math.floor(math.floor(d[3]/4)*0.75+1).."</td></tr>")
        else table.insert(s,"0 - 1</td></tr>") end
    end
    
    table.insert(s,"</table>")
    
    if(seed ~= true and (ca[4] =="Foreground" or ca[4] =="Background")) then
        table.insert(s,"<b class='card-title nomobile'>Paint Preview</b>")
        table.insert(s,"<div class='card-text paint-preview nomobile'>")
        table.insert(s,"<div class='paint'>"..getItemSprite(d).."<i>None</i></div>")
        table.insert(s,"<div class='paint red'>"..getItemSprite(d).."<i>"..getItemSpriteByName("Paint Bucket - Red").." Red</i></div>")
        table.insert(s,"<div class='paint yellow'>"..getItemSprite(d).."<i>"..getItemSpriteByName("Paint Bucket - Yellow").." Yellow</i></div>")
        table.insert(s,"<div class='paint green'>"..getItemSprite(d).."<i>"..getItemSpriteByName("Paint Bucket - Green").." Green</i></div>")
        table.insert(s,"<div class='paint aqua'>"..getItemSprite(d).."<i>"..getItemSpriteByName("Paint Bucket - Aqua").." Aqua</i></div>")
        table.insert(s,"<div class='paint blue'>"..getItemSprite(d).."<i>"..getItemSpriteByName("Paint Bucket - Blue").." Blue</i></div>")
        table.insert(s,"<div class='paint purple'>"..getItemSprite(d).."<i>"..getItemSpriteByName("Paint Bucket - Purple").." Purple</i></div>")
        table.insert(s,"<div class='paint charcoal'>"..getItemSprite(d).."<i>"..getItemSpriteByName("Paint Bucket - Charcoal").." Charcoal</i></div>")
        table.insert(s,"</div>")
    end
    
    --table.insert(s,mw.getCurrentFrame():preprocess("<div class='footer'>Incorrect Texture? Press [{{fullurl:{{FULLPAGENAME}}|action=purge}} here] to reload it.</div>"))
    table.insert(s,"</div>")
 
 
    ----- [Handle Category] -----
    if(seed) then
    	addCategory(c,"Seed")
    else
	    if(d[2]==2) then 
	        addCategory(c,"Doors")
	    elseif(d[2]==3) then 
	        addCategory(c,"Locks")
	    elseif(d[2]==5) then 
	        addCategory(c,"Treasure Blocks")
	    elseif(d[2]==6) then 
	        addCategory(c,"Deadly Blocks")
	    elseif(d[2]==7) then 
	        addCategory(c,"Trampoline Blocks")
	    elseif(d[2]==8) then 
	        addCategory(c,"Consumables")
	    elseif(d[2]==9 or d[2]==104 or d[2]==105 or d[2]==106) then 
	        addCategory(c,"Entrances")
	    elseif(d[2]==10) then 
	        addCategory(c,"Signs")
	    elseif(d[2]==11) then 
	        addCategory(c,"SFX Foreground Blocks")
	    elseif(d[2]==12) then 
	        addCategory(c,"Toggleable Animated Foreground Blocks")
	    elseif(d[2]==14) then 
	        addCategory(c,"Platforms")
	    elseif(d[2]==16) then 
	        addCategory(c,"Pain Blocks (Lava)")
	    elseif(d[2]==20) then 
	        addCategory(c,"Clothes")
	        addCategory(c,getItemType("clothingType",d[8])[1].." (Clothes)")
	    elseif(d[2]==21) then 
	        addCategory(c,"Animated Foreground Blocks")
	    elseif(d[2]==22) then 
	        addCategory(c,"SFX Background Blocks")
	    elseif(d[2]==23) then 
	        addCategory(c,"Toggleable Background Blocks")
	    elseif(d[2]==24) then 
	        addCategory(c,"Bouncy Blocks")
	    elseif(d[2]==25) then 
	        addCategory(c,"Pain Blocks (Spike)")
	    elseif(d[2]==26) then 
	        addCategory(c,"Portals")
	    elseif(d[2]==27) then 
	        addCategory(c,"Checkpoints")
	    elseif(d[2]==28) then 
	        addCategory(c,"Sheet Music")
	    elseif(d[2]==29) then 
	        addCategory(c,"Slippery Blocks")
	    elseif(d[2]==31) then 
	        addCategory(c,"Toggleable Blocks")
	    elseif(d[2]==32) then 
	        addCategory(c,"Chests")
	    elseif(d[2]==33) then 
	        addCategory(c,"Mailboxes")
	    elseif(d[2]==34) then 
	        addCategory(c,"Bulletin Boards")
	    elseif(d[2]==35) then 
	        addCategory(c,"Event Mystery Blocks")
	    elseif(d[2]==36) then 
	        addCategory(c,"Random Blocks")
	    elseif(d[2]==37 or d[2]==129) then 
	        addCategory(c,"Components")
	    elseif(d[2]==38) then 
	        addCategory(c,"Providers")
	    elseif(d[2]==39) then 
	        addCategory(c,"Chemical Combiners")
	    elseif(d[2]==41 or d[2]==81 or d[2]==89) then 
	        addCategory(c,"Weather Machines")
	    elseif(d[2]==45) then 
	        addCategory(c,"Toggleable Deadly Blocks")
	    elseif(d[2]==47) then 
	        addCategory(c,"Donation Boxes")
	    elseif(d[2]==49) then 
	        addCategory(c,"Mannequins")
	    elseif(d[2]==50) then
	        addCategory(c,"Security Cameras")
	    elseif(d[2]==52) then 
	        addCategory(c,"Game Blocks")
	    elseif(d[2]==56) then 
	        addCategory(c,"Crystals")
	    elseif(d[2]==60) then 
	        addCategory(c,"Pushing Blocks")
	    elseif(d[2]==64) then 
	        addCategory(c,"Fishes")
	    elseif(d[2]==93) then
	    	addCategory(c,"Howlers")
	    elseif(d[2]==98) then 
	        addCategory(c,"Cooking Ovens")
	    elseif(d[2]==107) then 
	        addCategory(c,"Artifacts")
	    elseif(d[2]==108) then 
	        addCategory(c,"Jelly Blocks")
	    elseif(d[2]==113) then 
	        addCategory(c,"CyBlock Bots")
	    elseif(d[2]==114) then 
	        addCategory(c,"CyBlock Commands")
	    elseif(d[2]==115) then 
	        addCategory(c,"Lucky Tokens")
	    elseif(d[2]==120) then 
	        addCategory(c,"Startopia Starship Blocks")
	    elseif(d[2]==122) then 
	        addCategory(c,"Toggleable Multi-Framed Animated Foreground Blocks")
	    elseif(d[2]==123 or d[2]==124 or d[2]==125) then 
	        addCategory(c,"Autobreaking Blocks")
	    elseif(d[2]==128) then 
	        addCategory(c,"Puddle Blocks")
	    elseif(d[2]==136) then 
	        addCategory(c,"Pain Blocks (Acid)")
	    end
	    local isBlock = false
	    if(ca[4] =="Foreground") then
	        addCategory(c,"Foreground Blocks")
	        isBlock = true
	    end
	    if(ca[4] =="Background") then
	        addCategory(c,"Background Blocks")
	        isBlock = true
	    end
	    if(d[7]==0 and isBlock) then
	        addCategory(c,"Non-solid Blocks")
	    end
	    if(isBlock) then
	    	addCategory(c,"Blocks")
	    end
	    if(d[3]<999) then
	    	addCategory(c,"Rarity "..d[3])
	    end
	end
    if(mw.title.getCurrentTitle().nsText=="") then
        table.insert(s,table.concat(c))
    end
    return table.concat(s)
end

return item