Module:Sandbox/BotAntony

local getStat = require('Module:Npcinfo').stat local info = require('Module:Npcinfo').info local cargo = mw.ext.cargo

local p = {}

-- Terraria.DataStructures.GameModeData.cs local multipliers = { normal = { EnemyDamageMultiplier = 1, EnemyDefenseMultiplier = 1, EnemyMoneyDropMultiplier = 1, },	expert = { EnemyDamageMultiplier = 2, EnemyDefenseMultiplier = 1, EnemyMoneyDropMultiplier = 2.5, },	master = { EnemyDamageMultiplier = 3, EnemyDefenseMultiplier = 1, EnemyMoneyDropMultiplier = 2.5, } }

local normalEnemies = {} local expertEnemies = {} local expert_hm_Enemies = {} local expert_pp_Enemies = {} local masterEnemies = {} local master_hm_Enemies = {} local master_pp_Enemies = {}

-- HalloweenWeapons class, Conditions.cs local function getInfoNormal(id) local num1 = 500 * multipliers.normal.EnemyMoneyDropMultiplier local num2 = 40 * multipliers.normal.EnemyDamageMultiplier local num3 = 20 * multipliers.normal.EnemyDefenseMultiplier return getStat(id, "value") > 0 and getStat(id, "value") < num1 and getStat(id, "damage") < num2 and getStat(id, "defense") < num2 end

local function getInfoExpert(id) local num1 = 500 * multipliers.expert.EnemyMoneyDropMultiplier local num2 = 40 * multipliers.expert.EnemyDamageMultiplier local num3 = 20 * multipliers.expert.EnemyDefenseMultiplier return getStat(id, "value_e") > 0 and getStat(id, "value_e") < num1 and getStat(id, "damage_e") < num2 and getStat(id, "defense_e") < num2 end

local function getInfoExpertHM(id) local num1 = 500 * multipliers.expert.EnemyMoneyDropMultiplier local num2 = 40 * multipliers.expert.EnemyDamageMultiplier local num3 = 20 * multipliers.expert.EnemyDefenseMultiplier return getStat(id, "value_e_hm") > 0 and getStat(id, "value_e_hm") < num1 and getStat(id, "damage_e_hm") < num2 and getStat(id, "defense_e_hm") < num2 end

local function getInfoExpertPP(id) local num1 = 500 * multipliers.expert.EnemyMoneyDropMultiplier local num2 = 40 * multipliers.expert.EnemyDamageMultiplier local num3 = 20 * multipliers.expert.EnemyDefenseMultiplier return getStat(id, "value_e_pp") > 0 and getStat(id, "value_e_pp") < num1 and getStat(id, "damage_e_pp") < num2 and getStat(id, "defense_e_pp") < num2 end

local function getInfoMaster(id) local num1 = 500 * multipliers.master.EnemyMoneyDropMultiplier local num2 = 40 * multipliers.master.EnemyDamageMultiplier local num3 = 20 * multipliers.master.EnemyDefenseMultiplier return getStat(id, "value_m") > 0 and getStat(id, "value_m") < num1 and getStat(id, "damage_m") < num2 and getStat(id, "defense_m") < num2 end

local function getInfoMasterHM(id) local num1 = 500 * multipliers.master.EnemyMoneyDropMultiplier local num2 = 40 * multipliers.master.EnemyDamageMultiplier local num3 = 20 * multipliers.master.EnemyDefenseMultiplier return getStat(id, "value_m_hm") > 0 and getStat(id, "value_m_hm") < num1 and getStat(id, "damage_m_hm") < num2 and getStat(id, "defense_m_hm") < num2 end

local function getInfoMasterPP(id) local num1 = 500 * multipliers.master.EnemyMoneyDropMultiplier local num2 = 40 * multipliers.master.EnemyDamageMultiplier local num3 = 20 * multipliers.master.EnemyDefenseMultiplier return getStat(id, "value_m_pp") > 0 and getStat(id, "value_m_pp") < num1 and getStat(id, "damage_m_pp") < num2 and getStat(id, "defense_m_pp") < num2 end

local function addNpcTotables(id) if info.IDs.isValid(id) then local result = cargo.query('NPCs', 'hardmode, expert, master', {			where = "npcid='" .. id .. "'",			limit = 1		}) if not (result["expert"] or result["master"]) and getInfoNormal(id) then normalEnemies[#normalEnemies + 1] = id		end if not (result["master"] or result["hardmode"]) and getInfoExpert(id) then expertEnemies[#expertEnemies + 1] = id		end if not result["master"] and getInfoExpertHM(id) then expert_hm_Enemies[#expert_hm_Enemies + 1] = id		end if not result["master"] and getInfoExpertPP(id) then expert_pp_Enemies[#expert_pp_Enemies + 1] = id		end if not result["hardmode"] and getInfoMaster(id) then masterEnemies[#masterEnemies + 1] = id		end if getInfoMasterHM(id) then master_hm_Enemies[#master_hm_Enemies + 1] = id		end if getInfoMasterPP(id) then master_pp_Enemies[#master_pp_Enemies + 1] = id		end end end

function p.main(frame) for i = info.IDs.min, info.IDs.max do		addNpcTotables(i) end return frame:callParserFunction{name = "#arraydefine:normal", args = {table.concat(normalEnemies, ","), ","}} .. frame:callParserFunction{name = "#arraydefine:expert", args = {table.concat(expertEnemies, ","), ","}} .. frame:callParserFunction{name = "#arraydefine:expert_hm", args = {table.concat(expert_hm_Enemies, ","), ","}} .. frame:callParserFunction{name = "#arraydefine:expert_pp", args = {table.concat(expert_pp_Enemies, ","), ","}} .. frame:callParserFunction{name = "#arraydefine:master", args = {table.concat(masterEnemies, ","), ","}} .. frame:callParserFunction{name = "#arraydefine:master_hm", args = {table.concat(master_hm_Enemies, ","), ","}} .. frame:callParserFunction{name = "#arraydefine:master_pp", args = {table.concat(master_pp_Enemies, ","), ","}} end

return p