Module:Creatures: Difference between revisions

From UO Outlands Wiki
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
 
(192 intermediate revisions by the same user not shown)
Line 2: Line 2:


function p.singleCreature(frame)
function p.singleCreature(frame)
  local creatureName = frame.args["name"]
  local creatureType = frame.args["type"]
  local imageOverride = frame.args["image"]
  local section = frame.args["section"]
  local namespace = frame.args["namespace"]
  local iconImage = ""
   local creatureArray = mw.loadData("Module:WildCreatureData") -- Array containing wild creature data from another module
   local creatureArray = mw.loadData("Module:WildCreatureData") -- Array containing wild creature data from another module
  local shipsArray = mw.loadData("Module:ShipCreatureData")
  local strangelandsArray = mw.loadData("Module:StrangelandsCreatureData")


   local creatureName = frame.args[1]
   local wikiTable = ""
   local creatureType = frame.args[2]
   local array
  local imageOverride = frame.args[3]
  local namespace = frame.args[4]
  local iconImage = ""


  local wikiTable = ""
  local array = creatureArray
   -- Change the array being pulled from if a valid creatureType is provided, also formats the creatureType to be used in Err messages and sets an iconImage
   -- Change the array being pulled from if a valid creatureType is provided, also formats the creatureType to be used in Err messages and sets an iconImage
   if string.lower(creatureType) == "strangelands" then
   if string.find(string.lower(creatureType), "strangeland") then
     array = mw.loadData("Module:StrangelandsCreatureData")
     array = strangelandsArray
     creatureType = " " .. creatureType .. ""
     creatureType = " " .. creatureType .. ""
     iconImage = "[[File:icon-strangelands.png|right|50px|link=Strangelands#Strangelands_Creatures|Strangeland Creature]]"
     iconImage = "[[File:icon-strangelands.png|right|50px|link=Strangelands#Strangelands_Creatures|Strangeland Creature]]"
   elseif string.lower(creatureType) == "ships" then
   elseif string.find(string.lower(creatureType), "ship") then
     array = mw.loadData("Module:ShipCreatureData")
     array = shipsArray
     creatureType = " " .. creatureType .. ""
     creatureType = " " .. creatureType .. ""
     iconImage = "[[File:shipdeed.png|right|30px|link=Ships|Ship Creature]]"
     iconImage = "[[File:shipdeed.png|right|30px|link=Ships|Ship Creature]]"
   else
   else
    array = creatureArray
     creatureType = " wild "
     creatureType = " wild "
   end
   end
Line 30: Line 35:
     local formmatedName = string.gsub(string.lower(creatureName), "%s+", "")
     local formmatedName = string.gsub(string.lower(creatureName), "%s+", "")
     local imageName = string.gsub(formmatedName, "%p+", "") .. ".jpg"
     local imageName = string.gsub(formmatedName, "%p+", "") .. ".jpg"
    if section and section ~= "" then
      wikiTable = wikiTable .. "\n== " .. section .. " ==\n"
    end


     if imageOverride and imageOverride ~= "" then
     if imageOverride and imageOverride ~= "" then
       imageName = imageOverride
       imageName = imageOverride
    elseif mw.title.new(imageName, 'File').exists == false then
      imageName = string.gsub(formmatedName, "%p+", "") .. ".png"
      if mw.title.new(imageName, 'File').exists == false then
        imageName = string.gsub(formmatedName, "%p+", "") .. ".gif"
      end
     end
     end


     -- Automaticly add categories
     -- Automaticly add categories
     if namespace == "" or namespace == nil then
     if namespace == "" or namespace == nil then
       wikiTable = wikiTable .. "[[Category:" .. creature.location .. "]]"
       wikiTable = wikiTable .. "[[Category:Creatures]]"
       wikiTable = wikiTable .. "[[Category:" .. creature.slayer .. " Creatures]]"
       wikiTable = wikiTable .. "[[Category:" .. creature.slayer .. " Creatures]]"


       if creature.bosstype ~= "" then
      if creature.locationtable then
         wikiTable = wikiTable .. "[[Category:" .. creature.bosstype .. "es]] [[Category:Bosses]]"
        for i, location in ipairs(creature.locationtable) do
          wikiTable = wikiTable .. "[[Category:" .. string.gsub(location, "%p+", "") .. "]]"
        end
      elseif creature.location and creature.location ~= "?" then
        wikiTable = wikiTable .. "[[Category:" .. string.gsub(creature.location, "%p+", "") .. "]]"
      end
 
       if creature.bosstype ~= "" and creature.bosstype ~= "Boss Summon" then
         if creature.bosstype ~= "Undermountain Boss" then
          wikiTable = wikiTable .. "[[Category:" .. creature.bosstype .. "es]]"
        else
          wikiTable = wikiTable .. "[[Category:Bosses]]"
        end
       end
       end
     end
     end


     wikiTable = [=[__NOTOC__
     wikiTable = wikiTable .. [=[__NOTOC__
         <table class="wikitable" style="text-align:center">
         <table class="wikitable" style="text-align:center">
         <th style="border-right:none; border-bottom:none; width:110px">
         <th style="border-right:none; border-bottom:none; width:110px">
Line 89: Line 115:
         <td>]=] .. creature.poisonresist .. creature.poisonresistmin .. [=[
         <td>]=] .. creature.poisonresist .. creature.poisonresistmin .. [=[
         <td>]=] .. creature.stealth .. [=[
         <td>]=] .. creature.stealth .. [=[
         <td>]=] .. creature.ai .. "</table>"
         <td>]=] .. creature.ai
 
    if array == creatureArray then
      wikiTable = wikiTable .. [[
        <tr><td colspan="9">
        <tr>
        <td colspan="9">'''Location: ''']] .. creature.location
    end
 
    wikiTable = wikiTable .. "</table>"


     return wikiTable
     return wikiTable
   else
   elseif creatureArray[creatureName] == nil and shipsArray[creatureName] == nil and strangelandsArray[creatureName] == nil and namespace == "" then
     return '<h1 style="color:FireBrick;"><big>Creature Table Template Error: No' ..
     -- Rule out summons that aren't wild
        creatureType .. 'creature by the name "' .. creatureName .. '" was found (Case-sensitive)</big></h1>'
    if mw.loadData("Module:SummonableCreatureData")[creatureName] == nil then
      return "[[Category:Incomplete Pages]]"
    end
   end
   end
end
end
Line 104: Line 141:


   -- Parameters passed when the function is invoked
   -- Parameters passed when the function is invoked
   local followerName = frame.args[1] -- Sun Wyrm
   local followerName = frame.args["name"]   -- Sun Wyrm
   local imageOverride = frame.args[2] -- sunwyrm.png
  local followerType = frame.args["type"]  -- tame/summon
   local followerType = frame.args[3] -- Tameable/Summon
   local imageOverride = frame.args["image"] -- sunwyrm.png
   local namespace = frame.args[4]     -- {{NAMESPACE}}
   local section = frame.args["section"]
 
   local namespace = frame.args["namespace"] -- {{NAMESPACE}}
  local mountIcon = ""
   local wikiTable = ""
   local wikiTable = ""


Line 115: Line 153:
   local summon = summonArray[followerName]
   local summon = summonArray[followerName]


   if string.lower(followerType) ~= "summon" and tameable then
   if not string.find(string.lower(followerType), "summon") and tameable then
     local formmatedName = string.gsub(string.lower(followerName), "%s+", "")
     local formmatedName = string.gsub(string.lower(followerName), "%s+", "")
     local imageName = string.gsub(formmatedName, "%p+", "") .. ".jpg"
     local imageName = string.gsub(formmatedName, "%p+", "") .. ".jpg"
    if section and section ~= "" then
      wikiTable = wikiTable .. "\n== " .. section .. " ==\n"
    end


     if imageOverride and imageOverride ~= "" then
     if imageOverride and imageOverride ~= "" then
Line 125: Line 167:
     -- Automaticlly add categories
     -- Automaticlly add categories
     if namespace == "" or namespace == nil then
     if namespace == "" or namespace == nil then
      if creature then
        wikiTable = wikiTable .. "[[Category:" .. creature.location .. "]]"
        wikiTable = wikiTable .. "[[Category:" .. creature.slayer .. " Creatures]]"
      end
       wikiTable = wikiTable .. "[[Category:Tameable Creatures]]"
       wikiTable = wikiTable .. "[[Category:Tameable Creatures]]"
      wikiTable = wikiTable .. "[[Category:" .. tameable.class .. " Class Tameable]]"
      wikiTable = wikiTable .. "[[Category:" .. tameable.combat .. " Tameable]]"
     end
     end


     wikiTable = [=[__NOTOC__
    if tameable.mount == true then
      mountIcon = "[[File:horse1891.png|40px|link=Mounts|This creature is a mount and can be ridden]]"
    end
 
     wikiTable = wikiTable .. [=[__NOTOC__
       <table class="wikitable" style="text-align:center">
       <table class="wikitable" style="text-align:center">
       <th style="border-right:none; border-bottom:none; width:110px">
       <th style="border-right:none; border-bottom:none; width:110px; text-align:left; vertical-align:top;margin-right: 15px;">]=] ..
        mountIcon .. [=[
       <th colspan="6" style="border-width: 1px 0px 0px; height:100px; vertical-align:bottom;"> [[File:]=] ..
       <th colspan="6" style="border-width: 1px 0px 0px; height:100px; vertical-align:bottom;"> [[File:]=] ..
         imageName .. [=[|link=]]
         imageName .. [=[|link=]]
Line 177: Line 218:
       <td>]=] .. tameable.poisoning .. [=[
       <td>]=] .. tameable.poisoning .. [=[
       <td>]=] .. tameable.stealth .. [=[
       <td>]=] .. tameable.stealth .. [=[
       <td>]=] .. tameable.underdogscalar .. "</table>"
       <td>]=] .. tameable.underdogscalar .. "</table>\n"


     return wikiTable
     return wikiTable
   elseif string.lower(followerType) ~= "tameable" and summon then
   elseif not string.find(string.lower(followerType), "tame") and summon then
     local formmatedName = string.gsub(string.lower(followerName), "%s+", "")
     local formmatedName = string.gsub(string.lower(followerName), "%s+", "")
     local imageName = string.gsub(formmatedName, "%p+", "") .. ".jpg"
     local imageName = string.gsub(formmatedName, "%p+", "") .. ".jpg"
     local spelliconImage = "[[File:" ..
     local spelliconImage = "[[File:" ..
    summon.spellicon ..
        summon.spellicon ..
    ".png|44px|link=Spirit Speak#" .. summon.spellname .. "|" .. summon.spellname .. summon.tometier .. "|right]]"
        ".png|44px|link=Spirit Speak#" ..
        summon.spellname .. "|" .. summon.spellname .. summon.creaturepool .. "|right]]"


     if summon.necro == true then
     if summon.necro == true then
       spelliconImage = spelliconImage ..
       spelliconImage = spelliconImage ..
           "[[File:SpellPlus.png|right]]<br><br>[[File:iconvengefulspirit.png|link=Necromancy#Undead Summons|Vengeful Spirit|right]]"
           "[[File:SpellPlus.png|right]]<br><br>[[File:iconvengefulspirit.png|link=Necromancy#Undead Summons|Vengeful Spirit|right]]"
    end
    if section and section ~= "" then
      wikiTable = wikiTable .. "\n== " .. section .. " ==\n"
     end
     end


Line 198: Line 244:
     -- Automaticlly add categories
     -- Automaticlly add categories
     if namespace == "" or namespace == nil then
     if namespace == "" or namespace == nil then
      if creature then
        wikiTable = wikiTable .. "[[Category:" .. creature.location .. "]]"
        wikiTable = wikiTable .. "[[Category:" .. creature.slayer .. " Creatures]]"
      end
       wikiTable = wikiTable .. "[[Category:Summonable Creatures]]"
       wikiTable = wikiTable .. "[[Category:Summonable Creatures]]"
     end
     end


     wikiTable = [=[__NOTOC__
     wikiTable = wikiTable .. [=[__NOTOC__
       <table class="wikitable" style="text-align:center">
       <table class="wikitable" style="text-align:center">
       <th style="border-right:none; border-bottom:none; width:110px">
       <th style="border-right:none; border-bottom:none; width:110px">
Line 222: Line 264:
       <th>Wrestling
       <th>Wrestling
       <tr>
       <tr>
       <td>]=] .. summon.spellname .. summon.tometier .. [=[
       <td>]=] .. summon.spellname .. [=[
       <td>]=] .. summon.slots .. [=[
       <td>]=] .. summon.slots .. [=[
       <td>]=] .. summon.hits .. [=[
       <td>]=] .. summon.hits .. [=[
Line 246: Line 288:


     return wikiTable
     return wikiTable
  else
    --[[else
    return '<h1 style="color:FireBrick;"><big>CreatureTable Template Error: No tamed/summoned follower found by the name "' ..
    return '<h1 style="color:FireBrick;"><big>FollowerTable Template Error: No tamed/summoned follower found by the name "' ..
         followerName .. '" (Case-sensitive)</big></h1>'
         followerName .. '" (Case-sensitive)</big></h1>']]
   end
   end
end
end
Line 323: Line 365:
   local wikiTable = ""
   local wikiTable = ""


   local array = creatureArray
   local array
 
  -- Change the array being pulled from if a valid creatureType is provided, also formats the creatureType to be used in Err messages and sets an iconImage
   if string.lower(locationGroup) == "strangelands" then
   if string.find(string.lower(locationGroup), "strangeland") then
     array = mw.loadData("Module:StrangelandsCreatureData")
     array = mw.loadData("Module:StrangelandsCreatureData")
   elseif string.lower(locationGroup) == "ships" then
   elseif string.find(string.lower(locationGroup), "ship") then
     array = mw.loadData("Module:ShipCreatureData")
     array = mw.loadData("Module:ShipCreatureData")
  else
    array = mw.loadData("Module:WildCreatureData")
   end
   end


Line 384: Line 428:
     wikiTable = wikiTable .. "</table>"
     wikiTable = wikiTable .. "</table>"
   end
   end
  return wikiTable
end
function p.listFollowerGroup(frame)
  local followerArray
  local followerGroup = frame.args["group"]
  local wikiTable = ""
  if string.find(string.lower(followerGroup), "tame") then
    followerArray = mw.loadData("Module:TameableCreatureData")
    local creatureArray = mw.loadData("Module:WildCreatureData")
    wikiTable = [[<table class="wikitable sortable" style="text-align:center">
        <th>Name
        <th>Location
        <th>Slots
        <th>Taming
        <th>Class
        <th>Hits
        <th>Combat
        <th colspan="2"> Damage
        <th>Wrestling
        <th>Armor
        <th>Magic Resist
        <th>AtkSpd
        <th>Poison
        <th>Poisoning
        <th>Poison Resist
        <th>Special Resist
        <th>Stealth
        <th>Cooldown Ability
        <th>Innate Ability
        <th>Passive Ability
        <th>Underdog Scalar]]
    for followerName, follower in pairs(followerArray) do
      local creature = creatureArray[followerName]
      local cooldownability = follower.cooldownability
      local innateability = follower.innateability
      local passiveability = follower.passiveability
      local location
      if type(follower.cooldownability) == "table" then
        cooldownability = ""
        for i, ability in ipairs(follower.cooldownability) do
          if i > 1 then
            cooldownability = cooldownability .. ", "
          end
          cooldownability = cooldownability .. ability
        end
      end
      if type(follower.innateability) == "table" then
        innateability = ""
        for i, ability in ipairs(follower.innateability) do
          if i > 1 then
            innateability = innateability .. ", "
          end
          innateability = innateability .. ability
        end
      end
      if type(follower.passiveability) == "table" then
        passiveability = ""
        for i, ability in ipairs(follower.passiveability) do
          if i > 1 then
            passiveability = passiveability .. ", "
          end
          passiveability = passiveability .. ability
        end
      end
      if creature and creature.location then
        location = creature.location
      else
        location = "?"
      end
      wikiTable = wikiTable .. [=[<tr>
          <td>[[]=] .. followerName .. [=[]]
          <td>]=] .. location .. [=[
          <td>]=] .. follower.slots .. [[
          <td>]] .. follower.taming .. [[
          <td>]] .. follower.class .. [[
          <td>]] .. follower.hits .. [[
          <td>]] .. follower.combat .. [[
          <td colspan="2">]] .. follower.mindmg .. " - " .. follower.maxdmg .. [[
          <td>]] .. follower.wrestling .. [[
          <td>]] .. follower.armor .. [[
          <td>]] .. follower.magicresist .. [[
          <td>]] .. follower.atkspd .. [[
          <td>]] .. follower.poisontype .. [[
          <td>]] .. follower.poisoning .. [[
          <td>]] .. follower.poisonresist .. [[
          <td>]] .. follower.specialresist .. [[
          <td>]] .. follower.stealth .. [[
          <td>]] .. cooldownability .. [[
          <td>]] .. innateability .. [[
          <td>]] .. passiveability .. [[
          <td>]] .. follower.underdogscalar
    end
  elseif string.find(string.lower(followerGroup), "summon") then
    followerArray = mw.loadData("Module:SummonableCreatureData")
    wikiTable = [[<table class="wikitable sortable" style="text-align:center">
        <th>Name
        <th>Spell
        <th>Type
        <th>Slots
        <th>Hits
        <th>Combat
        <th colspan="2"> Damage
        <th>Wrestling
        <th>Armor
        <th>Magic Resist
        <th>AtkSpd
        <th>Poison
        <th>Poisoning
        <th>Poison Resist
        <th>Special Resist
        <th>Stealth
        <th>Cooldown Ability
        <th>Innate Ability
        <th>Passive Ability]]
    for followerName, follower in pairs(followerArray) do
      local cooldownability = follower.cooldownability
      local innateability = follower.innateability
      local passiveability = follower.passiveability
      local summonType
      if type(follower.cooldownability) == "table" then
        cooldownability = ""
        for i, ability in ipairs(follower.cooldownability) do
          if i > 1 then
            cooldownability = cooldownability .. ", "
          end
          cooldownability = cooldownability .. ability
        end
      end
      if type(follower.innateability) == "table" then
        innateability = ""
        for i, ability in ipairs(follower.innateability) do
          if i > 1 then
            innateability = innateability .. ", "
          end
          innateability = innateability .. ability
        end
      end
      if type(follower.passiveability) == "table" then
        passiveability = ""
        for i, ability in ipairs(follower.passiveability) do
          if i > 1 then
            passiveability = passiveability .. ", "
          end
          passiveability = passiveability .. ability
        end
      end
      if follower.necro and follower.necro == true then
        summonType = "[[Necromancy]]"
      else
        summonType = "[[Spirit Speak|Regular]]"
      end
      wikiTable = wikiTable .. [=[<tr>
          <td>[[]=] .. followerName .. [=[]]
          <td>]=] .. follower.spellname .. [[
          <td>]] .. summonType .. [[
          <td>]] .. follower.slots .. [[
          <td>]] .. follower.hits .. [[
          <td>]] .. follower.combat .. [[
          <td colspan="2">]] .. follower.mindmg .. " - " .. follower.maxdmg .. [[
          <td>]] .. follower.wrestling .. [[
          <td>]] .. follower.armor .. [[
          <td>]] .. follower.magicresist .. [[
          <td>]] .. follower.atkspd .. [[
          <td>]] .. follower.poisontype .. [[
          <td>]] .. follower.poisoning .. [[
          <td>]] .. follower.poisonresist .. [[
          <td>]] .. follower.specialresist .. [[
          <td>]] .. follower.stealth .. [[
          <td>]] .. cooldownability .. [[
          <td>]] .. innateability .. [[
          <td>]] .. passiveability
    end
  end
  wikiTable = wikiTable .. "</table>"


   return wikiTable
   return wikiTable
Line 391: Line 636:
   local creatureArray = mw.loadData("Module:WildCreatureData")
   local creatureArray = mw.loadData("Module:WildCreatureData")


   local bossesToList = frame.args[1] -- Main Boss
   local bossesToList = frame.args["bosstype"] -- Main Boss
   local typeOfBoss = string.lower(bossesToList)
   local typeOfBoss = string.lower(bossesToList)
  local typeHeader = ""
  local typeRow = ""
  if typeOfBoss == "all" then
    typeHeader = "<th> Type"
  end


   local wikiTable = [[<table class="wikitable sortable" style="text-align:center">
   local wikiTable = [[<table class="wikitable sortable" style="text-align:center">
     <th>Name
     <th>Name]] .. typeHeader .. [[
     <th>Location
     <th>Location
     <th>Slayer
     <th>Slayer
Line 415: Line 666:
     if string.lower(creature.bosstype) == typeOfBoss or typeOfBoss == "all" then
     if string.lower(creature.bosstype) == typeOfBoss or typeOfBoss == "all" then
       if creature.bosstype ~= "" and creature.bosstype ~= "Boss Summon" then
       if creature.bosstype ~= "" and creature.bosstype ~= "Boss Summon" then
         local imageType = ".jpg"
         local formmatedName = string.gsub(string.gsub(string.lower(creatureName), "%s+", ""), "%p+", "")
        local imageType
         local imagePrefix = ""
         local imagePrefix = ""


         if creature.bosstype == "Main Boss" then
        if bossesToList == "all" then
          typeRow = "<td>" .. creature.bosstype
        end
 
         if creature.bosstype == "Omni Boss" then
          imagePrefix = "omni"
        end
 
        if mw.title.new(imagePrefix .. formmatedName .. ".jpg", 'File').exists == true then
          imageType = ".jpg"
        elseif mw.title.new(imagePrefix .. formmatedName .. ".gif", 'File').exists == true then
           imageType = ".gif"
           imageType = ".gif"
         elseif creature.bosstype == "Shrine Boss" then
         else
           imageType = ".png"
           imageType = ".png"
        elseif creature.bosstype == "Omni Boss" then
          imageType = ".gif"
          imagePrefix = "omni"
         end
         end


        local formmatedName = string.gsub(string.lower(creatureName), "%s+", "")
         local imageName = imagePrefix .. string.gsub(formmatedName, "%p+", "") .. imageType
         local imageName = imagePrefix .. string.gsub(formmatedName, "%p+", "") .. imageType


         wikiTable = wikiTable .. [[<tr>
         wikiTable = wikiTable .. [[<tr>
           <td>]] .. "[[File:" .. imageName .. "|link=" .. creatureName .. "]]<br />[[" .. creatureName .. [=[]]
           <td>]] ..
           <td>]=] .. creature.location .. [=[
            "[[File:" ..
            imageName .. "|link=" .. creatureName .. "]]<br />[[" .. creatureName .. [=[]]]=] .. typeRow .. [[
           <td>]] .. creature.location .. [=[
           <td>]=] .. creature.slayer .. [[
           <td>]=] .. creature.slayer .. [[
           <td>]] .. creature.difficulty .. [[
           <td>]] .. creature.difficulty .. [[
Line 456: Line 716:
end
end


function p.listAbilities(frame)
function p.listFollowerAbilities(frame)
   local tameableArray = mw.loadData("Module:TameableCreatureData")
   local tameableArray = mw.loadData("Module:TameableCreatureData")
   local summonArray = mw.loadData("Module:SummonableCreatureData")
   local summonArray = mw.loadData("Module:SummonableCreatureData")
   local abilityArray = mw.loadData("Module:FollowerAbilityData")
   local abilityArray = mw.loadData("Module:FollowerAbilityData")


   local creature = frame.args[1]     -- Warpig
   local creature = frame.args["name"]
   local followerType = frame.args[2] -- Tameable/Summon
   local followerType = frame.args["type"] -- Tameable/Summon
  local section = frame.args["section"]
   local follower = ""
   local follower = ""


   if string.lower(followerType) ~= "summon" and tameableArray[creature] then
   if not string.find(string.lower(followerType), "summon") and tameableArray[creature] then
     follower = tameableArray[creature]
     follower = tameableArray[creature]
   elseif string.lower(followerType) ~= "tameable" and summonArray[creature] then
   elseif not string.find(string.lower(followerType), "tame") and summonArray[creature] then
     follower = summonArray[creature]
     follower = summonArray[creature]
   else
   else
     follower = "undefined"
     follower = "unknown"
   end
   end


   local wikiTable = ""
   local wikiTable = ""


   if follower and follower ~= "undefined" then -- List a follower's abilities if a follower is given
   if follower and follower ~= "unknown" then -- List a follower's abilities if a follower is given
    wikiTable = [[<table class="wikitable" style="text-align:center">
      <th>Ability
      <th>Type
      <th>Description]]
 
     local abilities = {}
     local abilities = {}
    local abilityCount = 0


     for i, creatureAbility in pairs({ follower.cooldownability, follower.innateability, follower.passiveability }) do
     for i, creatureAbility in pairs({ follower.cooldownability, follower.innateability, follower.passiveability }) do
Line 491: Line 748:
         table.insert(abilities, creatureAbility)
         table.insert(abilities, creatureAbility)
       end
       end
    end
    for i, ability in ipairs(abilities) do
      abilityCount = abilityCount + 1
    end
    if abilityCount >= 1 then
      if section and section ~= "" then
        wikiTable = wikiTable .. "\n=== " .. section .. " ===\n"
      end
      wikiTable = wikiTable .. [[<table class="wikitable" style="text-align:center">
      <th colspan="2">Ability
      <th>Type
      <th>Description]]
     end
     end


     for i, ability in pairs(abilities) do
     for i, ability in pairs(abilities) do
      local abilityImage = "[[File:followerability-" .. string.gsub(string.lower(ability), "%s+", "") .. ".png|link=]]"
       wikiTable = wikiTable .. [[<tr>
       wikiTable = wikiTable .. [[<tr>
           <td>]] .. ability .. [[
           <td style="background-color: #000008; border-right:none; padding: 10px">]] .. abilityImage ..[[
          <th style="background-color: #000008; border-left:none; padding: 0px 10px 0px 0px">]] .. ability .. [[
           <td>]] .. abilityArray[ability].type .. [[
           <td>]] .. abilityArray[ability].type .. [[
           <td style="text-align:left">]] .. abilityArray[ability].description
           <td>]] .. abilityArray[ability].description
 
     end
     end
   elseif follower == "undefined" then -- List all abilities and the followers that have them
   elseif creature == "" or string.lower(creature) == "all" then -- List all abilities and the followers that have them
     wikiTable = [[<table class="wikitable sortable" style="text-align:center">
    if section and section ~= "" then
       <th>Ability
      wikiTable = wikiTable .. "\n== " .. section .. " ==\n"
    end
 
     wikiTable = wikiTable .. [[<table class="wikitable sortable" style="text-align:center">
       <th colspan="2">Ability
       <th>Type
       <th>Type
       <th>Description
       <th>Description
Line 507: Line 787:


     for abilityName, ability in pairs(abilityArray) do
     for abilityName, ability in pairs(abilityArray) do
      local abilityImage = "[[File:followerability-" .. string.gsub(string.lower(abilityName), "%s+", "") .. ".png|link=]]"
       wikiTable = wikiTable .. [[<tr>
       wikiTable = wikiTable .. [[<tr>
           <td>]] .. abilityName .. [[
           <td style="border-right:none; padding: 10px">]] .. abilityImage .. [[
          <th style="background-color: #000008; border-left:none; padding: 0px 10px 0px 0px">]] .. abilityName .. [[
           <td>]] .. ability.type .. [[
           <td>]] .. ability.type .. [[
           <td style="text-align:left">]] .. ability.description .. [[<td>]]
           <td>]] .. ability.description .. [[<td>]]  


       -- Find and list any followers with the ability
       -- Find and list any followers with the ability
       for i, array in pairs({ tameableArray, summonArray }) do
       for i, array in pairs({ tameableArray, summonArray }) do
         for followerName, followerStats in pairs(array) do
         for followerName, followerStats in pairs(array) do
           local followerAbilityType = ""
           local followerAbilityType = ""


Line 529: Line 811:
             for creatureName, value in pairs(followerAbilityType) do
             for creatureName, value in pairs(followerAbilityType) do
               if value == abilityName then
               if value == abilityName then
                 if array == summonArray and tameableArray[followerName] and summonArray[followerName] then
                 if array ~= summonArray then
                  wikiTable = wikiTable .. "[[" .. followerName .. "|"..followerName.." (Summon)]],<br>"
                  if not tameableArray[followerName] or not summonArray[followerName] then
                    wikiTable = wikiTable .. "[[" .. followerName .. "]]<br>"
                  end
                 else
                 else
                   wikiTable = wikiTable .. "[[" .. followerName .. "]],<br>"
                   wikiTable = wikiTable .. "[[" .. followerName .. "]]<br>"
                 end
                 end
               end
               end
             end
             end
           elseif followerAbilityType == abilityName then
           elseif followerAbilityType == abilityName then
             if array == summonArray and tameableArray[followerName] and summonArray[followerName] then
             if array ~= summonArray then
              wikiTable = wikiTable .. "[[" .. followerName .. "|"..followerName.." (Summon)]],<br>"
              if not tameableArray[followerName] or not summonArray[followerName] then
                wikiTable = wikiTable .. "[[" .. followerName .. "]]<br>"
              end
             else
             else
               wikiTable = wikiTable .. "[[" .. followerName .. "]],<br>"
               wikiTable = wikiTable .. "[[" .. followerName .. "]]<br>"
             end
             end
           end
           end
Line 549: Line 835:
       if string.find(wikiTable, "<br>") then
       if string.find(wikiTable, "<br>") then
         wikiTable = string.reverse(wikiTable)
         wikiTable = string.reverse(wikiTable)
         wikiTable = string.sub(wikiTable, 6)
         wikiTable = string.sub(wikiTable, 5)
         wikiTable = string.reverse(wikiTable)
         wikiTable = string.reverse(wikiTable)
       end
       end
     end
     end
  else -- If a follower is given but doesn't exist
    --[[else -- If a follower is given but doesn't exist
     return
     return
    '<h1 style="color:FireBrick;"><big>Follower Ability Table Template Error: No tamed/summoned follower found by the name "' ..
        '<h1 style="color:FireBrick;"><big>Follower Ability Table Template Error: No tamed/summoned follower found by the name "' ..
    creature .. '" (Case-sensitive)</big></h1>'
        creature .. '" (Case-sensitive)</big></h1>']]
   end
   end


   wikiTable = wikiTable .. "</table>"
   wikiTable = wikiTable .. "</table>\n"


   return wikiTable
   return wikiTable
Line 567: Line 853:
   local summonArray = mw.loadData("Module:SummonableCreatureData")
   local summonArray = mw.loadData("Module:SummonableCreatureData")


   local summonName = frame.args[1] -- A summon given to display, defaults to {{PAGENAME}}
   local summonName = frame.args["name"] -- A summon given to display, defaults to {{PAGENAME}}
   local wikiTable = '<table class="wikitable" style="text-align:center">'
  local section = frame.args["section"]
  local pageName = frame.args["pagename"]
   local wikiTable =
  '<table class="wikitable" style="text-align:center"><td colspan="6" style="border-bottom:none">\n<tr>\n'


   local summon = summonArray[summonName]
   local summon = summonArray[summonName]
Line 582: Line 871:
       ["magicresist"] = summon.magicresist
       ["magicresist"] = summon.magicresist
     }
     }
    local hitsScale = 1.5
    local atkspdScale = 0.25
    local dmgScale = 0.5
    local wrestlingScale = 0.5
    local armorIncrease = 25
    local resistIncrease = 50


     for statName, stat in pairs(stats) do
     for statName, stat in pairs(stats) do
Line 589: Line 886:
     end
     end


     wikiTable = wikiTable .. [=[<th colspan="6">[[File:]=] .. summon.spellicon .. [=[.png|center|link=]]<br>[[]=] .. summonName .. [=[]]
    if section and section ~= "" then
      wikiTable = wikiTable .. "\n=== " .. section .. " ===\n"
    end
 
     wikiTable = wikiTable ..
        [=[<th colspan="6" style="border-top:none">[[File:]=] ..
        summon.spellicon .. [=[.png|center|link=]]<br>[[]=] .. summonName .. [=[]]
       <tr>
       <tr>
       <th rowspan="2">Stat
       <th rowspan="2">Stat
Line 602: Line 905:
       <th>Hits
       <th>Hits
       <td>]=] .. stats.hits .. [[
       <td>]=] .. stats.hits .. [[
       <td>]] .. stats.hits * 1.5 * (80 / 100) .. [[
       <td>]] .. stats.hits + (stats.hits * (hitsScale * (80 / 100))) .. [[
       <td>]] .. stats.hits * 1.5 * (100 / 100) .. [[
       <td>]] .. stats.hits + (stats.hits * (hitsScale * (100 / 100))) .. [[
       <td>]] .. stats.hits * 1.5 * (120 / 100) .. [[
       <td>]] .. stats.hits + (stats.hits * (hitsScale * (120 / 100))) .. [[
       <td>]] .. stats.hits * 1.5 * (150 / 100) .. [[
       <td>]] .. stats.hits + (stats.hits * (hitsScale * (150 / 100))) .. [[
       <tr>
       <tr>
       <th>Attack Speed
       <th>Attack Speed
       <td>]] .. stats.atkspd .. [[
       <td>]] .. stats.atkspd .. [[
       <td>]] .. stats.atkspd * 1.125 * (80 / 100) .. [[
       <td>]] .. stats.atkspd + (stats.atkspd * (atkspdScale * (80 / 100))) .. [[
       <td>]] .. stats.atkspd * 1.125 * (100 / 100) .. [[
       <td>]] .. stats.atkspd + (stats.atkspd * (atkspdScale * (100 / 100))) .. [[
       <td>]] .. stats.atkspd * 1.125 * (120 / 100) .. [[
       <td>]] .. stats.atkspd + (stats.atkspd * (atkspdScale * (120 / 100))) .. [[
       <td>]] .. stats.atkspd * 1.125 * (150 / 100) .. [[
       <td>]] .. stats.atkspd + (stats.atkspd * (atkspdScale * (150 / 100))) .. [[
       <tr>
       <tr>
       <th>]] .. summon.combat .. [[ Damage
       <th>]] .. summon.combat .. [[ Damage
       <td>]] .. stats.mindmg .. " - " .. stats.maxdmg .. [[
       <td>]] .. stats.mindmg .. " - " .. stats.maxdmg .. [[
       <td>]] .. stats.mindmg * 1.25 * (80 / 100) .. " - " .. stats.maxdmg * 1.25 * (80 / 100) .. [[
       <td>]] ..
       <td>]] .. stats.mindmg * 1.25 * (100 / 100) .. " - " .. stats.maxdmg * 1.25 * (100 / 100) .. [[
        stats.mindmg + (stats.mindmg * (dmgScale * (80 / 100))) ..
       <td>]] .. stats.mindmg * 1.25 * (120 / 100) .. " - " .. stats.maxdmg * 1.25 * (120 / 100) .. [[
        " - " .. stats.maxdmg + (stats.maxdmg * (dmgScale * (80 / 100))) .. [[
       <td>]] .. stats.mindmg * 1.25 * (150 / 100) .. " - " .. stats.maxdmg * 1.25 * (150 / 100) .. [[
       <td>]] ..
        stats.mindmg + (stats.mindmg * (dmgScale * (100 / 100))) ..
        " - " .. stats.maxdmg + (stats.maxdmg * (dmgScale * (100 / 100))) .. [[
       <td>]] ..
        stats.mindmg + (stats.mindmg * (dmgScale * (120 / 100))) ..
        " - " .. stats.maxdmg + (stats.maxdmg * (dmgScale * (120 / 100))) .. [[
       <td>]] ..
        stats.mindmg + (stats.mindmg * (dmgScale * (150 / 100))) ..
        " - " .. stats.maxdmg + (stats.maxdmg * (dmgScale * (150 / 100))) .. [[
       <tr>
       <tr>
       <th>Wrestling
       <th>Wrestling
       <td>]] .. stats.wrestling .. [[
       <td>]] .. stats.wrestling .. [[
       <td>]] .. stats.wrestling * 1.25 * (80 / 100) .. [[
       <td>]] .. stats.wrestling + (stats.wrestling * (wrestlingScale * (80 / 100))) .. [[
       <td>]] .. stats.wrestling * 1.25 * (100 / 100) .. [[
       <td>]] .. stats.wrestling + (stats.wrestling * (wrestlingScale * (100 / 100))) .. [[
       <td>]] .. stats.wrestling * 1.25 * (120 / 100) .. [[
       <td>]] .. stats.wrestling + (stats.wrestling * (wrestlingScale * (120 / 100))) .. [[
       <td>]] .. stats.wrestling * 1.25 * (150 / 100) .. [[
       <td>]] .. stats.wrestling + (stats.wrestling * (wrestlingScale * (150 / 100))) .. [[
       <tr>
       <tr>
       <th>Armor
       <th>Armor
       <td>]] .. stats.armor .. [[
       <td>]] .. stats.armor .. [[
       <td>]] .. stats.armor + (25 * (80 / 100)) .. [[
       <td>]] .. stats.armor + (armorIncrease * (80 / 100)) .. [[
       <td>]] .. stats.armor + (25 * (100 / 100)) .. [[
       <td>]] .. stats.armor + (armorIncrease * (100 / 100)) .. [[
       <td>]] .. stats.armor + (25 * (120 / 100)) .. [[
       <td>]] .. stats.armor + (armorIncrease * (120 / 100)) .. [[
       <td>]] .. stats.armor + (25 * (150 / 100)) .. [[
       <td>]] .. stats.armor + (armorIncrease * (150 / 100)) .. [[
       <tr>
       <tr>
       <th>Magic Resist
       <th>Magic Resist
       <td>]] .. stats.magicresist .. [[
       <td>]] .. stats.magicresist .. [[
       <td>]] .. stats.magicresist + (50 * (80 / 100)) .. [[
       <td>]] .. stats.magicresist + (resistIncrease * (80 / 100)) .. [[
       <td>]] .. stats.magicresist + (50 * (100 / 100)) .. [[
       <td>]] .. stats.magicresist + (resistIncrease * (100 / 100)) .. [[
       <td>]] .. stats.magicresist + (50 * (120 / 100)) .. [[
       <td>]] .. stats.magicresist + (resistIncrease * (120 / 100)) .. [[
       <td>]] .. stats.magicresist + (50 * (150 / 100)) .. [[
       <td>]] .. stats.magicresist + (resistIncrease * (150 / 100)) .. [[
       </table>]]
       </table>]]


     return wikiTable
     return wikiTable
  else
    --[[else
     return '<h1 style="color:FireBrick;"><big>Summon Stat Table Template Error: No summoned follower found by the name "' ..
     return '<h1 style="color:FireBrick;"><big>Summon Stat Table Template Error: No summoned follower found by the name "' ..
         summonName .. '" (Case-sensitive)</big></h1>'
         summonName .. '" (Case-sensitive)</big></h1>']]
  end
end
 
function p.summonCreaturePools(frame)
  local summonArray = mw.loadData("Module:SummonableCreatureData")
 
  local summonType = frame.args["type"] -- The type of summon given to list, Regular/Default or Undead/Necro
  local wikiTable = [[<table class="wikitable" style="text-align:center">
  <tr>
  <th> Pool 1
  <th> Pool 2
  <th> Pool 3
  <th> Pool 4]]
  local pool1 = ""
  local pool2 = ""
  local pool3 = ""
  local pool4 = ""
 
  for summonName, summon in pairs(summonArray) do
    if not string.find(string.lower(summonType), "undead") and not string.find(string.lower(summonType), "necro") then
      if summon.necro ~= true then
 
        if string.find(summon.creaturepool, " 1") then
          pool1 = pool1 .. "[[" .. summonName .. "]]<br>"
        elseif string.find(summon.creaturepool, " 2") then
          pool2 = pool2 .. "[[" .. summonName .. "]]<br>"
        elseif string.find(summon.creaturepool, " 3") then
          pool3 = pool3 .. "[[" .. summonName .. "]]<br>"
        elseif string.find(summon.creaturepool, " 4") then
          pool4 = pool4 .. "[[" .. summonName .. "]]<br>"
        end
      end
    else
      if summon.necro == true then
 
        if string.find(summon.creaturepool, " 1") then
          pool1 = pool1 .. "[[" .. summonName .. "]]<br>"
        elseif string.find(summon.creaturepool, " 2") then
          pool2 = pool2 .. "[[" .. summonName .. "]]<br>"
        elseif string.find(summon.creaturepool, " 3") then
          pool3 = pool3 .. "[[" .. summonName .. "]]<br>"
        elseif string.find(summon.creaturepool, " 4") then
          pool4 = pool4 .. "[[" .. summonName .. "]]<br>"
        end
      end
    end
   end
   end
  wikiTable = wikiTable .. [[<tr>
  <td style="vertical-align:top">]] .. pool1 .. [[
  <td style="vertical-align:top">]] .. pool2 .. [[
  <td style="vertical-align:top">]] .. pool3 .. [[
  <td style="vertical-align:top">]] .. pool4 ..[[
  </table>]]
  return wikiTable
end
end


function p.checkCreatureValue(frame)
function p.checkCreatureValue(frame)
   local creatureName = frame.args[1] -- Name of the creature to check for
   local creatureName = frame.args["name"] -- Name of the creature to check for
   local creatureType = frame.args[2] -- Wild/Tameable/Summonable/Ships/Strangelands, defaults to Wild
   local creatureType = frame.args["type"] -- Wild/Tameable/Summonable/Ships/Strangelands, defaults to Wild
   local creatureStat = frame.args[3] -- location/name/slayer
   local creatureStat = frame.args["stat"] -- location/name/slayer
   local value = frame.args[4] -- Aegis Keep/Molten Mongbat/Deamonic/true, defaults to true (has value)
   local value = frame.args["value"]       -- Aegis Keep/Molten Mongbat/Deamonic/true, defaults to true (has value)
  local valueIfTrue = frame.args["iftrue"]
  local valueIfFalse = frame.args["iffalse"]
 
  if not creatureStat or creatureStat == "" then
    creatureStat = "name"
  end
 
   local dataSource
   local dataSource


Line 677: Line 1,051:
     local stat = creature[creatureStat]
     local stat = creature[creatureStat]


     if stat then
     if creatureStat == "name" then
      if string.lower(stat) == "name" and creature == value then
      return valueIfTrue -- "creature match found in datasource"
         return "creature matches the value"
    elseif not value or value == "" then
       elseif string.lower(stat) == string.lower(value) or value == "" then
      if stat then
         return "stat found or is equal to the value"
         return valueIfTrue  -- "stat exists for this creature"
      else
        return valueIfFalse -- "stat does not exist for this creature"
       end
    else
      if stat and string.lower(stat) == string.lower(value) then
         return valueIfTrue  -- "stat is equal to the value"
       else
       else
         return "stat is not equal to the value"
         return valueIfFalse -- "stat is not equal to the value or doesn't exist"
       end
       end
    else
      return "no stat found by that name"
     end
     end
   
   else
   else
     return "no creature by that name found"
     return valueIfFalse -- "creature not found in datasource"
  end
end
 
function p.findImageFormat(frame)
  local creatureName = frame.args['image']
  local formmatedName = string.gsub(string.lower(creatureName), "%s+", "")
  local imagePrefix = ""
  local creature = mw.loadData("Module:WildCreatureData")[creatureName]
 
 
  if creature and creature.bosstype == "Omni Boss" then
    imagePrefix = "omni"
  end
 
  local image = string.gsub(imagePrefix .. formmatedName, "%p+", "") .. ".jpg"
 
  if mw.title.new(image, 'File').exists == false then
    image = string.gsub(imagePrefix .. formmatedName, "%p+", "") .. ".gif"
    if mw.title.new(image, 'File').exists == false then
      image = string.gsub(imagePrefix .. formmatedName, "%p+", "") .. ".png"
    end
  end
 
  return image
end
 
function p.listImages(frame)
  local creatureArray = mw.loadData("Module:WildCreatureData")
  local wikiTable = [[<table class="wikitable sortable">
<th>Name
<th>png
<th>jpg
<th>gif
<tr>]]
 
  for creatureName, creature in pairs(creatureArray) do
    local formmatedName = string.gsub(string.lower(creatureName), "%s+", "")
    local jpgImageName = string.gsub(formmatedName, "%p+", "") .. ".jpg"
    local pngImageName = string.gsub(formmatedName, "%p+", "") .. ".png"
    local gifImageName = string.gsub(formmatedName, "%p+", "") .. ".gif"
 
    wikiTable = wikiTable .. "<td>[["..creatureName.."]] <td> [[File:"..pngImageName..[=[]]
<td> [[File:]=]..jpgImageName..[=[]]
<td> [[File:]=]..gifImageName..[=[]]
<td><tr>]=]
   end
   end
  wikiTable = wikiTable.."</table>"
  return wikiTable
end
end


return p
return p

Latest revision as of 03:17, 1 September 2025

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

local p = {}

function p.singleCreature(frame)
  local creatureName = frame.args["name"]
  local creatureType = frame.args["type"]
  local imageOverride = frame.args["image"]
  local section = frame.args["section"]
  local namespace = frame.args["namespace"]
  local iconImage = ""

  local creatureArray = mw.loadData("Module:WildCreatureData") -- Array containing wild creature data from another module
  local shipsArray = mw.loadData("Module:ShipCreatureData")
  local strangelandsArray = mw.loadData("Module:StrangelandsCreatureData")

  local wikiTable = ""
  local array

  -- Change the array being pulled from if a valid creatureType is provided, also formats the creatureType to be used in Err messages and sets an iconImage
  if string.find(string.lower(creatureType), "strangeland") then
    array = strangelandsArray
    creatureType = " " .. creatureType .. ""
    iconImage = "[[File:icon-strangelands.png|right|50px|link=Strangelands#Strangelands_Creatures|Strangeland Creature]]"
  elseif string.find(string.lower(creatureType), "ship") then
    array = shipsArray
    creatureType = " " .. creatureType .. ""
    iconImage = "[[File:shipdeed.png|right|30px|link=Ships|Ship Creature]]"
  else
    array = creatureArray
    creatureType = " wild "
  end

  local creature = array[creatureName]

  if creature then
    local formmatedName = string.gsub(string.lower(creatureName), "%s+", "")
    local imageName = string.gsub(formmatedName, "%p+", "") .. ".jpg"

    if section and section ~= "" then
      wikiTable = wikiTable .. "\n== " .. section .. " ==\n"
    end

    if imageOverride and imageOverride ~= "" then
      imageName = imageOverride
    elseif mw.title.new(imageName, 'File').exists == false then
      imageName = string.gsub(formmatedName, "%p+", "") .. ".png"
      if mw.title.new(imageName, 'File').exists == false then
        imageName = string.gsub(formmatedName, "%p+", "") .. ".gif"
      end
    end

    -- Automaticly add categories
    if namespace == "" or namespace == nil then
      wikiTable = wikiTable .. "[[Category:Creatures]]"
      wikiTable = wikiTable .. "[[Category:" .. creature.slayer .. " Creatures]]"

      if creature.locationtable then
        for i, location in ipairs(creature.locationtable) do
          wikiTable = wikiTable .. "[[Category:" .. string.gsub(location, "%p+", "") .. "]]"
        end
      elseif creature.location and creature.location ~= "?" then
        wikiTable = wikiTable .. "[[Category:" .. string.gsub(creature.location, "%p+", "") .. "]]"
      end

      if creature.bosstype ~= "" and creature.bosstype ~= "Boss Summon" then
        if creature.bosstype ~= "Undermountain Boss" then
          wikiTable = wikiTable .. "[[Category:" .. creature.bosstype .. "es]]"
        else
          wikiTable = wikiTable .. "[[Category:Bosses]]"
        end
      end
    end

    wikiTable = wikiTable .. [=[__NOTOC__
        <table class="wikitable" style="text-align:center">
        <th style="border-right:none; border-bottom:none; width:110px">
        <th colspan="7" style="border-width: 1px 0px 0px; height:100px; vertical-align:bottom;"> [[File:]=] ..
        imageName .. [=[|link=]]
        <th style="vertical-align:top; border-left:none; border-bottom:none; margin-left: 15px; width:110px>]=] ..
        iconImage .. [=[
        <tr>
        <th style="border-top:none" colspan="9">[[]=] .. creatureName .. [=[]]
        <tr>
        <th>Slayer
        <th>Difficulty
        <th>Gold Value
        <th>Hits
        <th colspan="2">Melee Damage
        <th>Wrestling
        <th>Armor
        <th>Magic Resist
        <tr>
        <td>]=] .. creature.slayer .. [=[
        <td>]=] .. creature.difficulty .. [=[
        <td>]=] .. creature.goldvalue .. [=[
        <td>]=] .. creature.hits .. [=[
        <td colspan="2">]=] .. creature.minmeleedmg .. creature.maxmeleedmg .. [=[
        <td>]=] .. creature.wrestling .. [=[
        <td>]=] .. creature.armor .. creature.armormin .. [=[
        <td>]=] .. creature.magicresist .. creature.magicresistmin .. [=[
        <tr>
        <th>Parry
        <th>Attack Speed
        <th>Magery
        <th colspan="2">Spell Damage
        <th>Poison
        <th>Poison Resist
        <th>Stealth
        <th>AI
        <tr>
        <td>]=] .. creature.parry .. [=[
        <td>]=] .. creature.atkspd .. [=[
        <td>]=] .. creature.magery .. [=[
        <td colspan="2">]=] .. creature.minspelldmg .. creature.maxspelldmg .. [=[
        <td>]=] .. creature.poisontype .. [=[
        <td>]=] .. creature.poisonresist .. creature.poisonresistmin .. [=[
        <td>]=] .. creature.stealth .. [=[
        <td>]=] .. creature.ai

    if array == creatureArray then
      wikiTable = wikiTable .. [[
        <tr><td colspan="9">
        <tr>
        <td colspan="9">'''Location: ''']] .. creature.location
    end

    wikiTable = wikiTable .. "</table>"

    return wikiTable
  elseif creatureArray[creatureName] == nil and shipsArray[creatureName] == nil and strangelandsArray[creatureName] == nil and namespace == "" then
    -- Rule out summons that aren't wild
    if mw.loadData("Module:SummonableCreatureData")[creatureName] == nil then
      return "[[Category:Incomplete Pages]]"
    end
  end
end

function p.singleFollower(frame)
  local creatureArray = mw.loadData("Module:WildCreatureData")
  local tameableArray = mw.loadData("Module:TameableCreatureData")
  local summonArray = mw.loadData("Module:SummonableCreatureData")

  -- Parameters passed when the function is invoked
  local followerName = frame.args["name"]   -- Sun Wyrm
  local followerType = frame.args["type"]   -- tame/summon
  local imageOverride = frame.args["image"] -- sunwyrm.png
  local section = frame.args["section"]
  local namespace = frame.args["namespace"] -- {{NAMESPACE}}
  local mountIcon = ""
  local wikiTable = ""

  local creature = creatureArray[followerName]
  local tameable = tameableArray[followerName]
  local summon = summonArray[followerName]

  if not string.find(string.lower(followerType), "summon") and tameable then
    local formmatedName = string.gsub(string.lower(followerName), "%s+", "")
    local imageName = string.gsub(formmatedName, "%p+", "") .. ".jpg"

    if section and section ~= "" then
      wikiTable = wikiTable .. "\n== " .. section .. " ==\n"
    end

    if imageOverride and imageOverride ~= "" then
      imageName = imageOverride
    end

    -- Automaticlly add categories
    if namespace == "" or namespace == nil then
      wikiTable = wikiTable .. "[[Category:Tameable Creatures]]"
    end

    if tameable.mount == true then
      mountIcon = "[[File:horse1891.png|40px|link=Mounts|This creature is a mount and can be ridden]]"
    end

    wikiTable = wikiTable .. [=[__NOTOC__
      <table class="wikitable" style="text-align:center">
      <th style="border-right:none; border-bottom:none; width:110px; text-align:left; vertical-align:top;margin-right: 15px;">]=] ..
        mountIcon .. [=[
      <th colspan="6" style="border-width: 1px 0px 0px; height:100px; vertical-align:bottom;"> [[File:]=] ..
        imageName .. [=[|link=]]
      <th style="vertical-align:top; border-left:none; border-bottom:none; margin-left: 15px; width:110px>[[File:icon-]=] ..
        string.lower(tameable.class) .. [=[class.png|link=Animal_Taming#Tamed_Classes|]=] ..
        tameable.class .. [=[ Class|right]]
      <tr>
      <th style="border-top:none" colspan="8">[[]=] .. followerName .. [=[]]
      <tr>
      <th>Min Taming
      <th>Control Slots
      <th>Hits
      <th>Class
      <th colspan="2">]=] .. tameable.combat .. [=[ Damage
      <th>Armor
      <th>Wrestling
      <tr>
      <td>]=] .. tameable.taming .. [=[
      <td>]=] .. tameable.slots .. [=[
      <td>]=] .. tameable.hits .. [=[
      <td>]=] .. tameable.class .. [=[
      <td colspan="2>]=] .. tameable.mindmg .. " - " .. tameable.maxdmg .. [=[
      <td>]=] .. tameable.armor .. tameable.armormin .. [=[
      <td>]=] .. tameable.wrestling .. [=[
      <tr>
      <th>Attack Speed
      <th>Magic Resist
      <th>Poison Resist
      <th>Special Resist
      <th>Poison
      <th>Poisoning
      <th>Stealth
      <th>Underdog Scalar
      <tr>
      <td>]=] .. tameable.atkspd .. [=[
      <td>]=] .. tameable.magicresist .. tameable.magicresistmin .. [=[
      <td>]=] .. tameable.poisonresist .. tameable.poisonresistmin .. [=[
      <td>]=] .. tameable.specialresist .. [=[
      <td>]=] .. tameable.poisontype .. [=[
      <td>]=] .. tameable.poisoning .. [=[
      <td>]=] .. tameable.stealth .. [=[
      <td>]=] .. tameable.underdogscalar .. "</table>\n"

    return wikiTable
  elseif not string.find(string.lower(followerType), "tame") and summon then
    local formmatedName = string.gsub(string.lower(followerName), "%s+", "")
    local imageName = string.gsub(formmatedName, "%p+", "") .. ".jpg"
    local spelliconImage = "[[File:" ..
        summon.spellicon ..
        ".png|44px|link=Spirit Speak#" ..
        summon.spellname .. "|" .. summon.spellname .. summon.creaturepool .. "|right]]"

    if summon.necro == true then
      spelliconImage = spelliconImage ..
          "[[File:SpellPlus.png|right]]<br><br>[[File:iconvengefulspirit.png|link=Necromancy#Undead Summons|Vengeful Spirit|right]]"
    end

    if section and section ~= "" then
      wikiTable = wikiTable .. "\n== " .. section .. " ==\n"
    end

    if imageOverride and imageOverride ~= "" then
      imageName = imageOverride
    end

    -- Automaticlly add categories
    if namespace == "" or namespace == nil then
      wikiTable = wikiTable .. "[[Category:Summonable Creatures]]"
    end

    wikiTable = wikiTable .. [=[__NOTOC__
      <table class="wikitable" style="text-align:center">
      <th style="border-right:none; border-bottom:none; width:110px">
      <th colspan="5" style="border-width: 1px 0px 0px; height:100px; vertical-align:bottom;"> [[File:]=] ..
        imageName .. [=[|link=]]
      <th style="vertical-align:top; border-left:none; border-bottom:none; margin-left: 5px; width:110px>]=] ..
        spelliconImage .. [=[
      <tr>
      <th style="border-top:none" colspan="7">[[]=] .. followerName .. [=[]]
      <tr>
      <th>Spell
      <th>Control Slots
      <th>Hits
      <th colspan="2">]=] .. summon.combat .. [=[ Damage
      <th>Armor
      <th>Wrestling
      <tr>
      <td>]=] .. summon.spellname .. [=[
      <td>]=] .. summon.slots .. [=[
      <td>]=] .. summon.hits .. [=[
      <td colspan="2>]=] .. summon.mindmg .. " - " .. summon.maxdmg .. [=[
      <td>]=] .. summon.armor .. summon.armormin .. [=[
      <td>]=] .. summon.wrestling .. [=[
      <tr>
      <th>Attack Speed
      <th>Magic Resist
      <th>Poison Resist
      <th>Special Resist
      <th>Poison
      <th>Poisoning
      <th>Stealth
      <tr>
      <td>]=] .. summon.atkspd .. [=[
      <td>]=] .. summon.magicresist .. summon.magicresistmin .. [=[
      <td>]=] .. summon.poisonresist .. summon.poisonresistmin .. [=[
      <td>]=] .. summon.specialresist .. [=[
      <td>]=] .. summon.poisontype .. [=[
      <td>]=] .. summon.poisoning .. [=[
      <td>]=] .. summon.stealth .. "</table>"

    return wikiTable
    --[[else
     return '<h1 style="color:FireBrick;"><big>FollowerTable Template Error: No tamed/summoned follower found by the name "' ..
        followerName .. '" (Case-sensitive)</big></h1>']]
  end
end

function p.listSlayerGroup(frame)
  local creatureArray = mw.loadData("Module:WildCreatureData")

  local slayerGroup = frame.args[1]
  local position = frame.args[2]
  local wikiTable = ""

  if position and string.find(string.lower(position), "start") then
    wikiTable = [[<table class="wikitable sortable" style="text-align:center">
        <th>Name
        <th>Location
        <th>Slayer
        <th>Difficulty
        <th>Gold Value
        <th>Hits
        <th colspan="2">Melee Dmg
        <th>Wrestling
        <th>Armor
        <th>Magic Resist
        <th>Parry
        <th>AtkSpd
        <th>Magery
        <th colspan="2">Spell Dmg
        <th>Poison
        <th>Poisoning
        <th>Poison Resist
        <th>Stealth
        <th>AI
        <th>Speed
        <th>Unique Scalar]]
  else
    wikiTable = ""
  end

  for creatureName, creature in pairs(creatureArray) do
    if creature.slayer == slayerGroup then
      wikiTable = wikiTable .. [=[<tr>
          <td>[[]=] .. creatureName .. [=[]]
          <td>]=] .. creature.location .. [=[
          <td>]=] .. creature.slayer .. [[
          <td>]] .. creature.difficulty .. [[
          <td>]] .. creature.goldvalue .. [[
          <td>]] .. creature.hits .. [[
          <td colspan="2">]] .. creature.minmeleedmg .. creature.maxmeleedmg .. [[
          <td>]] .. creature.wrestling .. [[
          <td>]] .. creature.armor .. creature.armormin .. [[
          <td>]] .. creature.magicresist .. creature.magicresistmin .. [[
          <td>]] .. creature.parry .. [[
          <td>]] .. creature.atkspd .. [[
          <td>]] .. creature.magery .. [[
          <td colspan="2">]] .. creature.minspelldmg .. creature.maxspelldmg .. [[
          <td>]] .. creature.poisontype .. [[
          <td>]] .. creature.poisoning .. [[
          <td>]] .. creature.poisonresist .. creature.poisonresistmin .. [[
          <td>]] .. creature.stealth .. [[
          <td>]] .. creature.ai .. [[
          <td>]] .. creature.speed .. [[
          <td>]] .. creature.uniquescalar
    end
  end
  if position and position and string.find(string.lower(position), "end") then
    wikiTable = wikiTable .. "</table>"
  end
  return wikiTable
end

function p.listLocationGroup(frame)
  local locationGroup = frame.args[1]
  local position = frame.args[2]
  local wikiTable = ""

  local array
  -- Change the array being pulled from if a valid creatureType is provided, also formats the creatureType to be used in Err messages and sets an iconImage
  if string.find(string.lower(locationGroup), "strangeland") then
    array = mw.loadData("Module:StrangelandsCreatureData")
  elseif string.find(string.lower(locationGroup), "ship") then
    array = mw.loadData("Module:ShipCreatureData")
  else
    array = mw.loadData("Module:WildCreatureData")
  end

  if position and string.find(string.lower(position), "start") then
    wikiTable = [[<table class="wikitable sortable" style="text-align:center">
      <th>Name
      <th>Slayer
      <th>Difficulty
      <th>Gold Value
      <th>Hits
      <th colspan="2">Melee Dmg
      <th>Wrestling
      <th>Armor
      <th>Magic Resist
      <th>Parry
      <th>AtkSpd
      <th>Magery
      <th colspan="2">Spell Dmg
      <th>Poison
      <th>Poisoning
      <th>Poison Resist
      <th>Stealth
      <th>AI
      <th>Speed
      <th>Unique Scalar]]
  end

  for creatureName, creature in pairs(array) do
    if string.find(creature.location, "[[" .. locationGroup .. "]]") then
      wikiTable = wikiTable .. [=[<tr>
        <td>[[]=] .. creatureName .. [=[]]
        <td>]=] .. creature.slayer .. [[
        <td>]] .. creature.difficulty .. [[
        <td>]] .. creature.goldvalue .. [[
        <td>]] .. creature.hits .. [[
        <td colspan="2">]] .. creature.minmeleedmg .. creature.maxmeleedmg .. [[
        <td>]] .. creature.wrestling .. [[
        <td>]] .. creature.armor .. creature.armormin .. [[
        <td>]] .. creature.magicresist .. creature.magicresistmin .. [[
        <td>]] .. creature.parry .. [[
        <td>]] .. creature.atkspd .. [[
        <td>]] .. creature.magery .. [[
        <td colspan="2">]] .. creature.minspelldmg .. creature.maxspelldmg .. [[
        <td>]] .. creature.poisontype .. [[
        <td>]] .. creature.poisoning .. [[
        <td>]] .. creature.poisonresist .. creature.poisonresistmin .. [[
        <td>]] .. creature.stealth .. [[
        <td>]] .. creature.ai .. [[
        <td>]] .. creature.speed .. [[
        <td>]] .. creature.uniquescalar
    end
  end

  if position and position and string.find(string.lower(position), "end") then
    wikiTable = wikiTable .. "</table>"
  end

  return wikiTable
end

function p.listFollowerGroup(frame)
  local followerArray

  local followerGroup = frame.args["group"]
  local wikiTable = ""

  if string.find(string.lower(followerGroup), "tame") then
    followerArray = mw.loadData("Module:TameableCreatureData")
    local creatureArray = mw.loadData("Module:WildCreatureData")

    wikiTable = [[<table class="wikitable sortable" style="text-align:center">
        <th>Name
        <th>Location
        <th>Slots
        <th>Taming
        <th>Class
        <th>Hits
        <th>Combat
        <th colspan="2"> Damage
        <th>Wrestling
        <th>Armor
        <th>Magic Resist
        <th>AtkSpd
        <th>Poison
        <th>Poisoning
        <th>Poison Resist
        <th>Special Resist
        <th>Stealth
        <th>Cooldown Ability
        <th>Innate Ability
        <th>Passive Ability
        <th>Underdog Scalar]]

    for followerName, follower in pairs(followerArray) do
      local creature = creatureArray[followerName]
      local cooldownability = follower.cooldownability
      local innateability = follower.innateability
      local passiveability = follower.passiveability
      local location

      if type(follower.cooldownability) == "table" then
        cooldownability = ""
        for i, ability in ipairs(follower.cooldownability) do
          if i > 1 then
            cooldownability = cooldownability .. ", "
          end

          cooldownability = cooldownability .. ability
        end
      end

      if type(follower.innateability) == "table" then
        innateability = ""
        for i, ability in ipairs(follower.innateability) do
          if i > 1 then
            innateability = innateability .. ", "
          end

          innateability = innateability .. ability
        end
      end

      if type(follower.passiveability) == "table" then
        passiveability = ""
        for i, ability in ipairs(follower.passiveability) do
          if i > 1 then
            passiveability = passiveability .. ", "
          end

          passiveability = passiveability .. ability
        end
      end

      if creature and creature.location then
        location = creature.location
      else
        location = "?"
      end

      wikiTable = wikiTable .. [=[<tr>
          <td>[[]=] .. followerName .. [=[]]
          <td>]=] .. location .. [=[
          <td>]=] .. follower.slots .. [[
          <td>]] .. follower.taming .. [[
          <td>]] .. follower.class .. [[
          <td>]] .. follower.hits .. [[
          <td>]] .. follower.combat .. [[
          <td colspan="2">]] .. follower.mindmg .. " - " .. follower.maxdmg .. [[
          <td>]] .. follower.wrestling .. [[
          <td>]] .. follower.armor .. [[
          <td>]] .. follower.magicresist .. [[
          <td>]] .. follower.atkspd .. [[
          <td>]] .. follower.poisontype .. [[
          <td>]] .. follower.poisoning .. [[
          <td>]] .. follower.poisonresist .. [[
          <td>]] .. follower.specialresist .. [[
          <td>]] .. follower.stealth .. [[
          <td>]] .. cooldownability .. [[
          <td>]] .. innateability .. [[
          <td>]] .. passiveability .. [[
          <td>]] .. follower.underdogscalar
    end
  elseif string.find(string.lower(followerGroup), "summon") then
    followerArray = mw.loadData("Module:SummonableCreatureData")

    wikiTable = [[<table class="wikitable sortable" style="text-align:center">
        <th>Name
        <th>Spell
        <th>Type
        <th>Slots
        <th>Hits
        <th>Combat
        <th colspan="2"> Damage
        <th>Wrestling
        <th>Armor
        <th>Magic Resist
        <th>AtkSpd
        <th>Poison
        <th>Poisoning
        <th>Poison Resist
        <th>Special Resist
        <th>Stealth
        <th>Cooldown Ability
        <th>Innate Ability
        <th>Passive Ability]]

    for followerName, follower in pairs(followerArray) do
      local cooldownability = follower.cooldownability
      local innateability = follower.innateability
      local passiveability = follower.passiveability
      local summonType

      if type(follower.cooldownability) == "table" then
        cooldownability = ""
        for i, ability in ipairs(follower.cooldownability) do
          if i > 1 then
            cooldownability = cooldownability .. ", "
          end

          cooldownability = cooldownability .. ability
        end
      end

      if type(follower.innateability) == "table" then
        innateability = ""
        for i, ability in ipairs(follower.innateability) do
          if i > 1 then
            innateability = innateability .. ", "
          end

          innateability = innateability .. ability
        end
      end

      if type(follower.passiveability) == "table" then
        passiveability = ""
        for i, ability in ipairs(follower.passiveability) do
          if i > 1 then
            passiveability = passiveability .. ", "
          end

          passiveability = passiveability .. ability
        end
      end

      if follower.necro and follower.necro == true then
        summonType = "[[Necromancy]]"
      else
        summonType = "[[Spirit Speak|Regular]]"
      end

      wikiTable = wikiTable .. [=[<tr>
          <td>[[]=] .. followerName .. [=[]]
          <td>]=] .. follower.spellname .. [[
          <td>]] .. summonType .. [[
          <td>]] .. follower.slots .. [[
          <td>]] .. follower.hits .. [[
          <td>]] .. follower.combat .. [[
          <td colspan="2">]] .. follower.mindmg .. " - " .. follower.maxdmg .. [[
          <td>]] .. follower.wrestling .. [[
          <td>]] .. follower.armor .. [[
          <td>]] .. follower.magicresist .. [[
          <td>]] .. follower.atkspd .. [[
          <td>]] .. follower.poisontype .. [[
          <td>]] .. follower.poisoning .. [[
          <td>]] .. follower.poisonresist .. [[
          <td>]] .. follower.specialresist .. [[
          <td>]] .. follower.stealth .. [[
          <td>]] .. cooldownability .. [[
          <td>]] .. innateability .. [[
          <td>]] .. passiveability
    end
  end



  wikiTable = wikiTable .. "</table>"

  return wikiTable
end

function p.listBosses(frame)
  local creatureArray = mw.loadData("Module:WildCreatureData")

  local bossesToList = frame.args["bosstype"] -- Main Boss
  local typeOfBoss = string.lower(bossesToList)
  local typeHeader = ""
  local typeRow = ""

  if typeOfBoss == "all" then
    typeHeader = "<th> Type"
  end

  local wikiTable = [[<table class="wikitable sortable" style="text-align:center">
    <th>Name]] .. typeHeader .. [[
    <th>Location
    <th>Slayer
    <th>Difficulty
    <th>Base Hits
    <th colspan="2">Melee Damage
    <th>Wrestling
    <th>Armor
    <th>Magic Resist
    <th>Parry
    <th>Magery
    <th colspan="2">Spell Damage
    <th>Poison
    <th>Poisoning
    <th>Poison Resist
    <th>Stealth]]

  for creatureName, creature in pairs(creatureArray) do
    if string.lower(creature.bosstype) == typeOfBoss or typeOfBoss == "all" then
      if creature.bosstype ~= "" and creature.bosstype ~= "Boss Summon" then
        local formmatedName = string.gsub(string.gsub(string.lower(creatureName), "%s+", ""), "%p+", "")
        local imageType
        local imagePrefix = ""

        if bossesToList == "all" then
          typeRow = "<td>" .. creature.bosstype
        end

        if creature.bosstype == "Omni Boss" then
          imagePrefix = "omni"
        end

        if mw.title.new(imagePrefix .. formmatedName .. ".jpg", 'File').exists == true then
          imageType = ".jpg"
        elseif mw.title.new(imagePrefix .. formmatedName .. ".gif", 'File').exists == true then
          imageType = ".gif"
        else
          imageType = ".png"
        end

        local imageName = imagePrefix .. string.gsub(formmatedName, "%p+", "") .. imageType

        wikiTable = wikiTable .. [[<tr>
          <td>]] ..
            "[[File:" ..
            imageName .. "|link=" .. creatureName .. "]]<br />[[" .. creatureName .. [=[]]]=] .. typeRow .. [[
          <td>]] .. creature.location .. [=[
          <td>]=] .. creature.slayer .. [[
          <td>]] .. creature.difficulty .. [[
          <td>]] .. creature.hits .. [[
          <td colspan="2">]] .. creature.minmeleedmg .. creature.maxmeleedmg .. [[
          <td>]] .. creature.wrestling .. [[
          <td>]] .. creature.armor .. creature.armormin .. [[
          <td>]] .. creature.magicresist .. creature.magicresistmin .. [[
          <td>]] .. creature.parry .. [[
          <td>]] .. creature.magery .. [[
          <td colspan="2">]] .. creature.minspelldmg .. creature.maxspelldmg .. [[
          <td>]] .. creature.poisontype .. [[
          <td>]] .. creature.poisoning .. [[
          <td>]] .. creature.poisonresist .. creature.poisonresistmin .. [[
          <td>]] .. creature.stealth
      end
    end
  end

  wikiTable = wikiTable .. "</table>"

  return wikiTable
end

function p.listFollowerAbilities(frame)
  local tameableArray = mw.loadData("Module:TameableCreatureData")
  local summonArray = mw.loadData("Module:SummonableCreatureData")
  local abilityArray = mw.loadData("Module:FollowerAbilityData")

  local creature = frame.args["name"]
  local followerType = frame.args["type"] -- Tameable/Summon
  local section = frame.args["section"]
  local follower = ""

  if not string.find(string.lower(followerType), "summon") and tameableArray[creature] then
    follower = tameableArray[creature]
  elseif not string.find(string.lower(followerType), "tame") and summonArray[creature] then
    follower = summonArray[creature]
  else
    follower = "unknown"
  end

  local wikiTable = ""

  if follower and follower ~= "unknown" then -- List a follower's abilities if a follower is given
    local abilities = {}
    local abilityCount = 0

    for i, creatureAbility in pairs({ follower.cooldownability, follower.innateability, follower.passiveability }) do
      if creatureAbility and creatureAbility ~= "" and type(creatureAbility) == "table" then
        for index, ability in pairs(creatureAbility) do
          table.insert(abilities, ability)
        end
      elseif creatureAbility and creatureAbility ~= "" then
        table.insert(abilities, creatureAbility)
      end
    end

    for i, ability in ipairs(abilities) do
      abilityCount = abilityCount + 1
    end

    if abilityCount >= 1 then
      if section and section ~= "" then
        wikiTable = wikiTable .. "\n=== " .. section .. " ===\n"
      end

      wikiTable = wikiTable .. [[<table class="wikitable" style="text-align:center">
      <th colspan="2">Ability
      <th>Type
      <th>Description]]
    end

    for i, ability in pairs(abilities) do
      local abilityImage = "[[File:followerability-" .. string.gsub(string.lower(ability), "%s+", "") .. ".png|link=]]"

      wikiTable = wikiTable .. [[<tr>
          <td style="background-color: #000008; border-right:none; padding: 10px">]] .. abilityImage ..[[
          <th style="background-color: #000008; border-left:none; padding: 0px 10px 0px 0px">]] .. ability .. [[
          <td>]] .. abilityArray[ability].type .. [[
          <td>]] .. abilityArray[ability].description

    end
  elseif creature == "" or string.lower(creature) == "all" then -- List all abilities and the followers that have them
    if section and section ~= "" then
      wikiTable = wikiTable .. "\n== " .. section .. " ==\n"
    end

    wikiTable = wikiTable .. [[<table class="wikitable sortable" style="text-align:center">
      <th colspan="2">Ability
      <th>Type
      <th>Description
      <th>Creatures]]

    for abilityName, ability in pairs(abilityArray) do
      local abilityImage = "[[File:followerability-" .. string.gsub(string.lower(abilityName), "%s+", "") .. ".png|link=]]"

      wikiTable = wikiTable .. [[<tr>
          <td style="border-right:none; padding: 10px">]] .. abilityImage .. [[
          <th style="background-color: #000008; border-left:none; padding: 0px 10px 0px 0px">]] .. abilityName .. [[
          <td>]] .. ability.type .. [[
          <td>]] .. ability.description .. [[<td>]] 

      -- Find and list any followers with the ability
      for i, array in pairs({ tameableArray, summonArray }) do
        for followerName, followerStats in pairs(array) do
          local followerAbilityType = ""

          if ability.type == "Cooldown" then
            followerAbilityType = followerStats.cooldownability
          elseif ability.type == "Innate" then
            followerAbilityType = followerStats.innateability
          elseif ability.type == "Passive" then
            followerAbilityType = followerStats.passiveability
          end

          if type(followerAbilityType) == "table" then
            for creatureName, value in pairs(followerAbilityType) do
              if value == abilityName then
                if array ~= summonArray then
                  if not tameableArray[followerName] or not summonArray[followerName] then
                    wikiTable = wikiTable .. "[[" .. followerName .. "]]<br>"
                  end
                else
                  wikiTable = wikiTable .. "[[" .. followerName .. "]]<br>"
                end
              end
            end
          elseif followerAbilityType == abilityName then
            if array ~= summonArray then
              if not tameableArray[followerName] or not summonArray[followerName] then
                wikiTable = wikiTable .. "[[" .. followerName .. "]]<br>"
              end
            else
              wikiTable = wikiTable .. "[[" .. followerName .. "]]<br>"
            end
          end
        end
      end

      -- Cut out the extra line break
      if string.find(wikiTable, "<br>") then
        wikiTable = string.reverse(wikiTable)
        wikiTable = string.sub(wikiTable, 5)
        wikiTable = string.reverse(wikiTable)
      end
    end
    --[[else -- If a follower is given but doesn't exist
    return
        '<h1 style="color:FireBrick;"><big>Follower Ability Table Template Error: No tamed/summoned follower found by the name "' ..
        creature .. '" (Case-sensitive)</big></h1>']]
  end

  wikiTable = wikiTable .. "</table>\n"

  return wikiTable
end

function p.summonStatIncrease(frame)
  local summonArray = mw.loadData("Module:SummonableCreatureData")

  local summonName = frame.args["name"] -- A summon given to display, defaults to {{PAGENAME}}
  local section = frame.args["section"]
  local pageName = frame.args["pagename"]
  local wikiTable =
  '<table class="wikitable" style="text-align:center"><td colspan="6" style="border-bottom:none">\n<tr>\n'

  local summon = summonArray[summonName]

  if summon then
    local stats = {
      ["hits"] = summon.unformattedhits,
      ["atkspd"] = summon.atkspd,
      ["mindmg"] = summon.mindmg,
      ["maxdmg"] = summon.maxdmg,
      ["wrestling"] = summon.wrestling,
      ["armor"] = summon.armor,
      ["magicresist"] = summon.magicresist
    }

    local hitsScale = 1.5
    local atkspdScale = 0.25
    local dmgScale = 0.5
    local wrestlingScale = 0.5
    local armorIncrease = 25
    local resistIncrease = 50


    for statName, stat in pairs(stats) do
      if type(stats[statName]) == "string" then
        stats[statName] = 0
      end
    end

    if section and section ~= "" then
      wikiTable = wikiTable .. "\n=== " .. section .. " ===\n"
    end

    wikiTable = wikiTable ..
        [=[<th colspan="6" style="border-top:none">[[File:]=] ..
        summon.spellicon .. [=[.png|center|link=]]<br>[[]=] .. summonName .. [=[]]
      <tr>
      <th rowspan="2">Stat
      <th colspan="5"> Spirit Speak Skill
      <tr>
      <th>Base
      <th>80
      <th>100
      <th>120
      <th>150
      <tr>
      <th>Hits
      <td>]=] .. stats.hits .. [[
      <td>]] .. stats.hits + (stats.hits * (hitsScale * (80 / 100))) .. [[
      <td>]] .. stats.hits + (stats.hits * (hitsScale * (100 / 100))) .. [[
      <td>]] .. stats.hits + (stats.hits * (hitsScale * (120 / 100))) .. [[
      <td>]] .. stats.hits + (stats.hits * (hitsScale * (150 / 100))) .. [[
      <tr>
      <th>Attack Speed
      <td>]] .. stats.atkspd .. [[
      <td>]] .. stats.atkspd + (stats.atkspd * (atkspdScale * (80 / 100))) .. [[
      <td>]] .. stats.atkspd + (stats.atkspd * (atkspdScale * (100 / 100))) .. [[
      <td>]] .. stats.atkspd + (stats.atkspd * (atkspdScale * (120 / 100))) .. [[
      <td>]] .. stats.atkspd + (stats.atkspd * (atkspdScale * (150 / 100))) .. [[
      <tr>
      <th>]] .. summon.combat .. [[ Damage
      <td>]] .. stats.mindmg .. " - " .. stats.maxdmg .. [[
      <td>]] ..
        stats.mindmg + (stats.mindmg * (dmgScale * (80 / 100))) ..
        " - " .. stats.maxdmg + (stats.maxdmg * (dmgScale * (80 / 100))) .. [[
      <td>]] ..
        stats.mindmg + (stats.mindmg * (dmgScale * (100 / 100))) ..
        " - " .. stats.maxdmg + (stats.maxdmg * (dmgScale * (100 / 100))) .. [[
      <td>]] ..
        stats.mindmg + (stats.mindmg * (dmgScale * (120 / 100))) ..
        " - " .. stats.maxdmg + (stats.maxdmg * (dmgScale * (120 / 100))) .. [[
      <td>]] ..
        stats.mindmg + (stats.mindmg * (dmgScale * (150 / 100))) ..
        " - " .. stats.maxdmg + (stats.maxdmg * (dmgScale * (150 / 100))) .. [[
      <tr>
      <th>Wrestling
      <td>]] .. stats.wrestling .. [[
      <td>]] .. stats.wrestling + (stats.wrestling * (wrestlingScale * (80 / 100))) .. [[
      <td>]] .. stats.wrestling + (stats.wrestling * (wrestlingScale * (100 / 100))) .. [[
      <td>]] .. stats.wrestling + (stats.wrestling * (wrestlingScale * (120 / 100))) .. [[
      <td>]] .. stats.wrestling + (stats.wrestling * (wrestlingScale * (150 / 100))) .. [[
      <tr>
      <th>Armor
      <td>]] .. stats.armor .. [[
      <td>]] .. stats.armor + (armorIncrease * (80 / 100)) .. [[
      <td>]] .. stats.armor + (armorIncrease * (100 / 100)) .. [[
      <td>]] .. stats.armor + (armorIncrease * (120 / 100)) .. [[
      <td>]] .. stats.armor + (armorIncrease * (150 / 100)) .. [[
      <tr>
      <th>Magic Resist
      <td>]] .. stats.magicresist .. [[
      <td>]] .. stats.magicresist + (resistIncrease * (80 / 100)) .. [[
      <td>]] .. stats.magicresist + (resistIncrease * (100 / 100)) .. [[
      <td>]] .. stats.magicresist + (resistIncrease * (120 / 100)) .. [[
      <td>]] .. stats.magicresist + (resistIncrease * (150 / 100)) .. [[
      </table>]]

    return wikiTable
    --[[else
    return '<h1 style="color:FireBrick;"><big>Summon Stat Table Template Error: No summoned follower found by the name "' ..
        summonName .. '" (Case-sensitive)</big></h1>']]
  end
end

function p.summonCreaturePools(frame)
  local summonArray = mw.loadData("Module:SummonableCreatureData")

  local summonType = frame.args["type"] -- The type of summon given to list, Regular/Default or Undead/Necro
  local wikiTable = [[<table class="wikitable" style="text-align:center">
  <tr>
  <th> Pool 1
  <th> Pool 2
  <th> Pool 3
  <th> Pool 4]]
  local pool1 = ""
  local pool2 = ""
  local pool3 = ""
  local pool4 = ""

  for summonName, summon in pairs(summonArray) do
    if not string.find(string.lower(summonType), "undead") and not string.find(string.lower(summonType), "necro") then
      if summon.necro ~= true then

        if string.find(summon.creaturepool, " 1") then
          pool1 = pool1 .. "[[" .. summonName .. "]]<br>"
        elseif string.find(summon.creaturepool, " 2") then
          pool2 = pool2 .. "[[" .. summonName .. "]]<br>"
        elseif string.find(summon.creaturepool, " 3") then
          pool3 = pool3 .. "[[" .. summonName .. "]]<br>"
        elseif string.find(summon.creaturepool, " 4") then
          pool4 = pool4 .. "[[" .. summonName .. "]]<br>"
        end
      end
    else
      if summon.necro == true then

        if string.find(summon.creaturepool, " 1") then
          pool1 = pool1 .. "[[" .. summonName .. "]]<br>"
        elseif string.find(summon.creaturepool, " 2") then
          pool2 = pool2 .. "[[" .. summonName .. "]]<br>"
        elseif string.find(summon.creaturepool, " 3") then
          pool3 = pool3 .. "[[" .. summonName .. "]]<br>"
        elseif string.find(summon.creaturepool, " 4") then
          pool4 = pool4 .. "[[" .. summonName .. "]]<br>"
        end
      end
    end
  end


  wikiTable = wikiTable .. [[<tr>
  <td style="vertical-align:top">]] .. pool1 .. [[
  <td style="vertical-align:top">]] .. pool2 .. [[
  <td style="vertical-align:top">]] .. pool3 .. [[
  <td style="vertical-align:top">]] .. pool4 ..[[
  </table>]]

  return wikiTable
end

function p.checkCreatureValue(frame)
  local creatureName = frame.args["name"] -- Name of the creature to check for
  local creatureType = frame.args["type"] -- Wild/Tameable/Summonable/Ships/Strangelands, defaults to Wild
  local creatureStat = frame.args["stat"] -- location/name/slayer
  local value = frame.args["value"]       -- Aegis Keep/Molten Mongbat/Deamonic/true, defaults to true (has value)
  local valueIfTrue = frame.args["iftrue"]
  local valueIfFalse = frame.args["iffalse"]

  if not creatureStat or creatureStat == "" then
    creatureStat = "name"
  end

  local dataSource

  -- Set the requested data source
  if creatureType and string.lower(creatureType) == "tameable" then
    dataSource = mw.loadData("Module:TameableCreatureData")
  elseif creatureType and string.lower(creatureType) == "summonable" then
    dataSource = mw.loadData("Module:SummonableCreatureData")
  elseif creatureType and string.lower(creatureType) == "ships" then
    dataSource = mw.loadData("Module:ShipCreatureData")
  elseif creatureType and string.lower(creatureType) == "tameable" then
    dataSource = mw.loadData("Module:TameableCreatureData")
  elseif creatureType and string.lower(creatureType) == "strangelands" then
    dataSource = mw.loadData("Module:StrangelandsCreatureData")
  else
    dataSource = mw.loadData("Module:WildCreatureData")
  end

  local creature = dataSource[creatureName]

  if creature then
    local stat = creature[creatureStat]

    if creatureStat == "name" then
      return valueIfTrue -- "creature match found in datasource"
    elseif not value or value == "" then
      if stat then
        return valueIfTrue  -- "stat exists for this creature"
      else
        return valueIfFalse -- "stat does not exist for this creature"
      end
    else
      if stat and string.lower(stat) == string.lower(value) then
        return valueIfTrue  -- "stat is equal to the value"
      else
        return valueIfFalse -- "stat is not equal to the value or doesn't exist"
      end
    end
  else
    return valueIfFalse -- "creature not found in datasource"
  end
end

function p.findImageFormat(frame)
  local creatureName = frame.args['image']
  local formmatedName = string.gsub(string.lower(creatureName), "%s+", "")
  local imagePrefix = ""
  local creature = mw.loadData("Module:WildCreatureData")[creatureName]


  if creature and creature.bosstype == "Omni Boss" then
    imagePrefix = "omni"
  end

  local image = string.gsub(imagePrefix .. formmatedName, "%p+", "") .. ".jpg"

  if mw.title.new(image, 'File').exists == false then
    image = string.gsub(imagePrefix .. formmatedName, "%p+", "") .. ".gif"
    if mw.title.new(image, 'File').exists == false then
      image = string.gsub(imagePrefix .. formmatedName, "%p+", "") .. ".png"
    end
  end

  return image
end

function p.listImages(frame)
  local creatureArray = mw.loadData("Module:WildCreatureData")
  local wikiTable = [[<table class="wikitable sortable">
<th>Name
<th>png
<th>jpg
<th>gif
<tr>]]

  for creatureName, creature in pairs(creatureArray) do
    local formmatedName = string.gsub(string.lower(creatureName), "%s+", "")
    local jpgImageName = string.gsub(formmatedName, "%p+", "") .. ".jpg"
    local pngImageName = string.gsub(formmatedName, "%p+", "") .. ".png"
    local gifImageName = string.gsub(formmatedName, "%p+", "") .. ".gif"

    wikiTable = wikiTable .. "<td>[["..creatureName.."]] <td> [[File:"..pngImageName..[=[]]
<td> [[File:]=]..jpgImageName..[=[]]
<td> [[File:]=]..gifImageName..[=[]]
<td><tr>]=]
  end
  wikiTable = wikiTable.."</table>"
  return wikiTable
end

return p