Module:StrangelandsCreatureData

From UO Outlands Wiki
Revision as of 23:32, 3 November 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:StrangelandsCreatureData/doc

local p = {
    ["Ankheg"] = {
        ["location"] = "Strangelands",
        ["difficulty"] = 23.9,
        ["goldvalue"] = 239,
        ["hits"] = 1500,
        ["minmeleedmg"] = 25,
        ["maxmeleedmg"] = 35,
        ["wrestling"] = 80,
        ["armor"] = 75,
        ["magicresist"] = 25,
        ["poisoning"] = 50,
        ["poisonresist"] = 0.4,
        ["slayer"] = "Beastial",
        ["ai"] = "Melee",
        ["speed"] = "Slow",
        ["uniquescalar"] = 1.25,
    },
    ["Bullvore"] = {
        ["location"] = "Strangelands",
        ["difficulty"] = 34,
        ["goldvalue"] = 341,
        ["hits"] = 2000,
        ["minmeleedmg"] = 35,
        ["maxmeleedmg"] = 45,
        ["wrestling"] = 90,
        ["armor"] = 50,
        ["magicresist"] = 25,
        ["slayer"] = "Beastial",
        ["ai"] = "Melee",
        ["speed"] = "Fast",
        ["uniquescalar"] = 1.1,
    },
    ["Devilbat"] = {
        ["location"] = "Strangelands",
        ["difficulty"] = 11.2,
        ["goldvalue"] = 110,
        ["hits"] = 800,
        ["minmeleedmg"] = 10,
        ["maxmeleedmg"] = 20,
        ["wrestling"] = 90,
        ["armor"] = 25,
        ["magicresist"] = 25,
        ["slayer"] = "Beastial",
        ["ai"] = "Melee",
        ["speed"] = "VeryFast",
        ["uniquescalar"] = 1.25,
    },
    ["Giant Slug"] = {
        ["location"] = "Strangelands",
        ["difficulty"] = 6.7,
        ["goldvalue"] = 67,
        ["hits"] = 600,
        ["minmeleedmg"] = 10,
        ["maxmeleedmg"] = 20,
        ["wrestling"] = 50,
        ["armor"] = 25,
        ["magicresist"] = 25,
        ["poisonresist"] = 0.4,
        ["slayer"] = "Nature",
        ["ai"] = "Melee",
        ["speed"] = "Slow",
        ["uniquescalar"] = 1.14,
    },
    ["Giant Spider"] = {
        ["location"] = "Strangelands",
        ["difficulty"] = 16.5,
        ["goldvalue"] = 166,
        ["hits"] = 1200,
        ["minmeleedmg"] = 15,
        ["maxmeleedmg"] = 25,
        ["wrestling"] = 80,
        ["armor"] = 25,
        ["magicresist"] = 25,
        ["poisontype"] = "Deadly",
        ["poisoning"] = 50,
        ["poisonresist"] = 0.6,
        ["slayer"] = "Beastial",
        ["ai"] = "Melee",
        ["speed"] = "Medium",
        ["uniquescalar"] = 1.1,
    },
    ["Great Hart"] = {
        ["location"] = "Strangelands",
        ["difficulty"] = 6,
        ["goldvalue"] = 61,
        ["hits"] = 600,
        ["minmeleedmg"] = 10,
        ["maxmeleedmg"] = 20,
        ["wrestling"] = 60,
        ["armor"] = 25,
        ["magicresist"] = 25,
        ["slayer"] = "Beastial",
        ["ai"] = "Melee",
        ["speed"] = "Fast",
        ["uniquescalar"] = 1,
    },
    ["Guar"] = {
        ["location"] = "Strangelands",
        ["difficulty"] = 7.7,
        ["goldvalue"] = 78,
        ["hits"] = 800,
        ["minmeleedmg"] = 10,
        ["maxmeleedmg"] = 20,
        ["wrestling"] = 50,
        ["armor"] = 50,
        ["magicresist"] = 25,
        ["slayer"] = "Beastial",
        ["ai"] = "Melee",
        ["speed"] = "Medium",
        ["uniquescalar"] = 1,
    },
    ["Primordial"] = {
        ["location"] = "Strangelands",
        ["difficulty"] = 12.8,
        ["goldvalue"] = 128,
        ["hits"] = 1000,
        ["minmeleedmg"] = 15,
        ["maxmeleedmg"] = 25,
        ["wrestling"] = 80,
        ["armor"] = 25,
        ["magicresist"] = 25,
        ["slayer"] = "Beastial",
        ["ai"] = "Melee",
        ["speed"] = "VeryFast",
        ["uniquescalar"] = 1.1,
    },
    ["Stalker"] = {
        ["location"] = "Strangelands",
        ["difficulty"] = 26.8,
        ["goldvalue"] = 269,
        ["hits"] = 1500,
        ["minmeleedmg"] = 30,
        ["maxmeleedmg"] = 40,
        ["wrestling"] = 90,
        ["armor"] = 25,
        ["magicresist"] = 25,
        ["stealth"] = "X",
        ["slayer"] = "Beastial",
        ["ai"] = "Melee",
        ["speed"] = "VeryFast",
        ["uniquescalar"] = 1.2,
    },
}

-- 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

-- Fill out or format values
for index, creature in pairs(p) do
    local defaultStatArray = {
        ["location"] = "Strangelands",
        ["difficulty"] = "?",
        ["goldvalue"] = "?",
        ["hits"] = "?",
        ["minmeleedmg"] = "",
        ["maxmeleedmg"] = "",
        ["wrestling"] = "",
        ["armor"] = "",
        ["magicresist"] = "",
        ["parry"] = "",
        ["atkspd"] = "?",
        ["magery"] = "",
        ["minspelldmg"] = "",
        ["maxspelldmg"] = "",
        ["poisontype"] = "",
        ["poisoning"] = "",
        ["poisonresist"] = "",
        ["stealth"] = "",
        ["slayer"] = "?",
        ["ai"] = "?",
        ["speed"] = "?",
        ["uniquescalar"] = "?",
        ["bosstype"] = "",
        ["armormin"] = "",
        ["magicresistmin"] = "",
        ["poisonresistmin"] = "",
    }

    if type(creature.location) == "table" then
        local locations = ""
        for i, spawnLocation in pairs(creature.location) do
            if locations ~= "" then
                locations = locations .. "<br>"
            end

            locations = locations .. "[[" .. spawnLocation .. "]]"
        end
        creature.location = locations
    elseif type(creature.location) == "string" and creature.location ~= "?" then
        creature.location = "[[" .. creature.location .. "]]"
    end

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

    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.minmeleedmg and creature.minmeleedmg ~= creature.maxmeleedmg then
        creature.minmeleedmg = creature.minmeleedmg .. " - "
    elseif creature.minmeleedmg == creature.maxmeleedmg then
        creature.maxmeleedmg = ""
    end

    if creature.minspelldmg and creature.minspelldmg ~= creature.maxspelldmg then
        creature.minspelldmg = creature.minspelldmg .. " - "
    elseif creature.minspelldmg == creature.maxspelldmg then
        creature.maxspelldmg = ""
    end

    if creature.tometier then
        creature.tometier = " (Tier " .. creature.tometier .. ")"
    end

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

return p