Module:SummonableCreatureData

From UO Outlands Wiki
Revision as of 05:16, 28 December 2024 by TheGmaster (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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

-- Unique summons, non-tameable not necro reskins
local p = {
  ["Daemon"] = {
    ["slots"] = 2,
    ["combat"] = "Spell",
    ["hits"] = 600,
    ["mindmg"] = 26,
    ["maxdmg"] = 32,
    ["wrestling"] = 95,
    ["armor"] = 50,
    ["magicresist"] = 100,
    ["innateability"] = "Fury",
    ["spellname"] = "Summon Daemon",
    ["spellicon"] = "summondaemon1",
  },
  ["Air Elemental"] = {
    ["slots"] = 2,
    ["combat"] = "Melee",
    ["hits"] = 500,
    ["mindmg"] = 34,
    ["maxdmg"] = 40,
    ["wrestling"] = 100,
    ["armor"] = 50,
    ["magicresist"] = 100,
    ["innateability"] = "Cleave",
    ["spellname"] = "Air Elemental",
    ["spellicon"] = "summonairele1",
  },
  ["Earth Elemental"] = {
    ["slots"] = 2,
    ["combat"] = "Melee",
    ["hits"] = 600,
    ["mindmg"] = 30,
    ["maxdmg"] = 36,
    ["wrestling"] = 95,
    ["armor"] = 75,
    ["magicresist"] = 50,
    ["specialresist"] = 0.33,
    ["innateability"] = "Rooted",
    ["spellname"] = "Earth Elemental",
    ["spellicon"] = "summonearthele1",
  },
  ["Water Elemental"] = {
    ["slots"] = 2,
    ["combat"] = "Spell",
    ["hits"] = 600,
    ["mindmg"] = 24,
    ["maxdmg"] = 30,
    ["wrestling"] = 100,
    ["armor"] = 50,
    ["magicresist"] = 150,
    ["poisonresist"] = 0.66,
    ["specialresist"] = 0.33,
    ["cooldownability"] = "Mirror",
    ["innateability"] = "Elusive Form",
    ["spellname"] = "Water Elemental",
    ["spellicon"] = "summonwaterele1",
  },
  ["Fire Elemental"] = {
    ["slots"] = 2,
    ["combat"] = "Spell",
    ["hits"] = 400,
    ["mindmg"] = 28,
    ["maxdmg"] = 34,
    ["wrestling"] = 85,
    ["armor"] = 25,
    ["magicresist"] = 100,
    ["cooldownability"] = "Epic Barrage",
    ["spellname"] = "Fire Elemental",
    ["spellicon"] = "summonfireele1",
  },
  ["Energy Vortex"] = {
    ["slots"] = 2,
    ["combat"] = "Melee",
    ["hits"] = 600,
    ["mindmg"] = 38,
    ["maxdmg"] = 46,
    ["wrestling"] = 105,
    ["armor"] = 50,
    ["magicresist"] = 100,
    ["poisonresist"] = 0.33,
    ["specialresist"] = 0.33,
    ["innateability"] = "Discharge",
    ["spellname"] = "Energy Vortex",
    ["spellicon"] = "summonev1",
  },
  ["Blade Spirit"] = {
    ["slots"] = 1,
    ["combat"] = "Melee",
    ["hits"] = 300,
    ["mindmg"] = 18,
    ["maxdmg"] = 22,
    ["wrestling"] = 90,
    ["armor"] = 50,
    ["magicresist"] = 50,
    ["poisonresist"] = 0.33,
    ["specialresist"] = 0.33,
    ["innateability"] = "Diversion",
    ["spellname"] = "Blade Spirits",
    ["spellicon"] = "bladespirit1",
  },
  ["Zombie"] = {
    ["slots"] = 1,
    ["combat"] = "Melee",
    ["hits"] = 175,
    ["mindmg"] = 12,
    ["maxdmg"] = 16,
    ["wrestling"] = 40,
    ["armor"] = 25,
    ["magicresist"] = 50,
    ["passiveability"] = "Disease",
    ["spellname"] = "Summon Creature",
    ["spellicon"] = "summoncreature",
    ["creaturepool"] = 1,
    ["necro"] = true,
  },
  ["Skeleton"] = {
    ["slots"] = 1,
    ["combat"] = "Melee",
    ["hits"] = 175,
    ["mindmg"] = 14,
    ["maxdmg"] = 18,
    ["wrestling"] = 45,
    ["armor"] = 25,
    ["magicresist"] = 50,
    ["passiveability"] = "Enrage",
    ["spellname"] = "Summon Creature",
    ["spellicon"] = "summoncreature",
    ["creaturepool"] = 1,
    ["necro"] = true,
  },
  ["Skeletal Knight"] = {
    ["slots"] = 1,
    ["combat"] = "Melee",
    ["hits"] = 200,
    ["mindmg"] = 14,
    ["maxdmg"] = 18,
    ["wrestling"] = 50,
    ["armor"] = 25,
    ["magicresist"] = 50,
    ["spellname"] = "Summon Creature",
    ["creaturepool"] = 2,
    ["spellicon"] = "summoncreature",
    ["passiveability"] = "Enrage",
    ["necro"] = true,
  },
  ["Ghoul"] = {
    ["slots"] = 1,
    ["combat"] = "Spell",
    ["hits"] = 100,
    ["mindmg"] = 5,
    ["maxdmg"] = 7,
    ["wrestling"] = 40,
    ["armor"] = 25,
    ["magicresist"] = 75,
    ["spellname"] = "Summon Creature",
    ["spellicon"] = "summoncreature",
    ["creaturepool"] = 2,
    ["necro"] = true,
  },
  ["Skeletal Mage"] = {
    ["slots"] = 1,
    ["combat"] = "Spell",
    ["hits"] = 150,
    ["mindmg"] = 7,
    ["maxdmg"] = 9,
    ["wrestling"] = 50,
    ["armor"] = 25,
    ["magicresist"] = 75,
    ["spellname"] = "Summon Creature",
    ["creaturepool"] = 3,
    ["spellicon"] = "summoncreature",
    ["necro"] = true,
  },
  ["Ghost"] = {
    ["slots"] = 1,
    ["combat"] = "Melee",
    ["hits"] = 200,
    ["mindmg"] = 16,
    ["maxdmg"] = 20,
    ["wrestling"] = 80,
    ["armor"] = 25,
    ["magicresist"] = 50,
    ["spellname"] = "Summon Creature",
    ["spellicon"] = "summoncreature",
    ["creaturepool"] = 3,
    ["necro"] = true,
  },
  ["Skeletal Marksman"] = {
    ["slots"] = 1,
    ["combat"] = "Melee",
    ["hits"] = 175,
    ["mindmg"] = 12,
    ["maxdmg"] = 16,
    ["wrestling"] = 70,
    ["armor"] = 25,
    ["magicresist"] = 50,
    ["spellname"] = "Summon Creature",
    ["creaturepool"] = 4,
    ["spellicon"] = "summoncreature",
    ["necro"] = true,
  },
  ["Rotting Flesh"] = {
    ["slots"] = 1,
    ["combat"] = "Melee",
    ["hits"] = 225,
    ["mindmg"] = 14,
    ["maxdmg"] = 18,
    ["wrestling"] = 70,
    ["armor"] = 25,
    ["magicresist"] = 50,
    ["poisonresist"] = 0.33,
    ["specialresist"] = 0.33,
    ["spellname"] = "Summon Creature",
    ["creaturepool"] = 4,
    ["spellicon"] = "summoncreature",
    ["necro"] = true,
  },
}

local necromancyConversions = {
  ["Vampire Thrall"] = "Daemon",
  ["Lich"] = "Fire Elemental",
  ["Ancient Mummy"] = "Earth Elemental",
  ["Skeletal Fiend"] = "Air Elemental",
  ["Jackel Spirit"] = "Energy Vortex",
  ["Rag Witch"] = "Water Elemental",
  ["Skeletal Husk"] = "Blade Spirit",
}

function CloneTable(t)
  local new_t = {}
  local i, v = next(t, nil)
  while i do
    new_t[i] = v
    i, v = next(t, i)
  end
  return new_t
end

-- Copy summon data for necro varients
for necroSummon, Summon in pairs(necromancyConversions) do
  p[necroSummon] = CloneTable(p[Summon])
  p[necroSummon]["necro"] = true
end

-- Helper function to add comma's between numbers
function FormatInt(int)
  int = string.reverse(int)

  if string.len(int) > 3 and string.len(int) < 6 then
    int = string.gsub(int, "(%d%d%d)", "%1,")
  elseif string.len(int) == 6 then
    int = string.gsub(int, "(%d%d%d)(%d%d%d)", "%1,%2")
  elseif string.len(int) > 6 and string.len(int) < 9 then
    int = string.gsub(int, "(%d%d%d)(%d%d%d)", "%1,%2,")
  end

  int = string.reverse(int)

  return int
end

for index, creature in pairs(p) do
  local defaultStatArray = {
    ["hits"] = "?",
    ["mindmg"] = "?",
    ["maxdmg"] = "?",
    ["wrestling"] = "",
    ["armor"] = "",
    ["magicresist"] = "",
    ["parry"] = "",
    ["atkspd"] = "?",
    ["magery"] = "",
    ["poisontype"] = "",
    ["poisoning"] = "",
    ["poisonresist"] = "",
    ["stealth"] = "",
    ["armormin"] = "",
    ["magicresistmin"] = "",
    ["poisonresistmin"] = "",
    ["slots"] = "?",
    ["combat"] = "?",
    ["cooldownability"] = "",
    ["innateability"] = "",
    ["passiveability"] = "",
    ["specialresist"] = "",
    ["spellname"] = "",
    ["spellicon"] = "",
    ["necro"] = false,
    ["creaturepool"] = "",
  }

  if type(creature.hits) == "number" then
    creature.unformattedhits = creature.hits
    creature.hits = FormatInt(creature.hits)
  end

  if creature.armormin then
    creature.armormin = "<br>(" .. creature.armormin .. " min)"
  end

  if creature.magicresistmin then
    creature.magicresistmin = "<br>(" .. creature.magicresistmin .. " min)"
  end

  if creature.poisonresistmin then
    creature.poisonresistmin = "<br>(" .. creature.poisonresistmin .. " min)"
  end

  if creature.poisonresist then
    creature.poisonresist = (creature.poisonresist * 100) .. "%"
  end

  if creature.specialresist then
    creature.specialresist = (creature.specialresist * 100) .. "%"
  end

  if creature.creaturepool then
    if creature.necro == true then
      creature.creaturepool = "<br>(Necro Pool " .. creature.creaturepool .. ")"
    else
      creature.creaturepool = "<br>(Pool " .. creature.creaturepool .. ")"
    end
  end

  for stat, defaultValue in pairs(defaultStatArray) do
    if creature[stat] == nil then
      creature[stat] = defaultValue
    end
  end
end

-- Copy tameable data for summonable tames
local tameableArray = require("Module:TameableCreatureData")

for tameableName, tameable in pairs(tameableArray) do
  if tameable.slots == 1 and tameable.taming >= 45 and tameable.taming <= 100 and tameable.mount == false then
    local pool

    if tameable.taming >= 45 and tameable.taming <= 55 then
      pool = 1
    elseif tameable.taming >= 60 and tameable.taming <= 70 then
      pool = 2
    elseif tameable.taming >= 75 and tameable.taming <= 85 then
      pool = 3
    elseif tameable.taming >= 90 and tameable.taming <= 100 then
      pool = 4
    end

    p[tameableName] = CloneTable(tameableArray[tameableName])
    p[tameableName].spellname = "Summon Creature"
    p[tameableName].spellicon = "summoncreature"
    p[tameableName].creaturepool = "<br>(Pool " .. pool .. ")"
  end
end

return p