-- Configuration table for conditions and messages
local conditionConfig = {
[140] = {name = "noble", magic = 2, shield = 2, melee = 2, fist = 2, distance = 2},
[132] = {name = "noble", magic = 2, shield = 2, melee = 2, fist = 2, distance = 2},
[138] = {name = "mage", magic = 2, shield = 2, melee = 2, fist = 2, distance = 2},
[130] = {name = "mage", magic = 2, shield = 2, melee = 2, fist = 2, distance = 2},
[136] = {name = "Citizen", magic = 2, shield = 2, melee = 2, fist = 2, distance = 2},
[128] = {name = "Citizen", magic = 2, shield = 2, melee = 2, fist = 2, distance = 2},
[137] = {name = "hunter", magic = 2, shield = 2, melee = 2, fist = 2, distance = 2},
[129] = {name = "hunter", magic = 2, shield = 2, melee = 2, fist = 2, distance = 2},
[139] = {name = "Knight", magic = 2, shield = 2, melee = 2, fist = 2, distance = 2},
[131] = {name = "Knight", magic = 2, shield = 2, melee = 2, fist = 2, distance = 2},
[141] = {name = "Summoner", magic = 2, shield = 2, melee = 2, fist = 2, distance = 2},
[133] = {name = "Summoner", magic = 2, shield = 2, melee = 2, fist = 2, distance = 2},
[142] = {name = "Warrior", magic = 2, shield = 2, melee = 2, fist = 2, distance = 2},
[134] = {name = "Warrior", magic = 2, shield = 2, melee = 2, fist = 2, distance = 2},
[147] = {name = "Barbarian", magic = 2, shield = 2, melee = 2, fist = 2, distance = 2},
[143] = {name = "Barbarian", magic = 2, shield = 2, melee = 2, fist = 2, distance = 2},
[148] = {name = "Druid", magic = 2, shield = 2, melee = 2, fist = 2, distance = 2},
[144] = {name = "Druid", magic = 2, shield = 2, melee = 2, fist = 2, distance = 2},
[149] = {name = "Wizard", magic = 2, shield = 2, melee = 2, fist = 2, distance = 2},
[145] = {name = "Wizard", magic = 2, shield = 2, melee = 2, fist = 2, distance = 2},
[150] = {name = "Oriental", magic = 2, shield = 2, melee = 2, fist = 2, distance = 2},
[146] = {name = "Oriental", magic = 2, shield = 2, melee = 2, fist = 2, distance = 2},
[264] = {name = "Custom", magic = 2, shield = 2, melee = 2, fist = 2, distance = 2}
}
-- Function to set up conditions based on config
local conditions = {}
local function setupConditions()
for _, config in pairs(conditionConfig) do
local condition = Condition(CONDITION_ATTRIBUTES)
condition:setParameter(CONDITION_PARAM_TICKS, -1)
condition:setParameter(CONDITION_PARAM_STAT_MAGICPOINTS, config.magic)
condition:setParameter(CONDITION_PARAM_SKILL_SHIELD, config.shield)
condition:setParameter(CONDITION_PARAM_SKILL_MELEE, config.melee)
condition:setParameter(CONDITION_PARAM_SKILL_FIST, config.fist)
condition:setParameter(CONDITION_PARAM_SKILL_DISTANCE, config.distance)
conditions[config.name] = condition
end
end
setupConditions()
local function formatMessage(outfitConfig)
return string.format("You are eligible for a bonus %s addon.\n[Magic Level] +%d\n[Shield] +%d\n[Sword] +%d\n[Club] +%d\n[Fist] +%d\n[Distance] +%d\n[Axe] +%d",
outfitConfig.name, outfitConfig.magic, outfitConfig.shield, outfitConfig.melee, outfitConfig.melee, outfitConfig.fist, outfitConfig.distance, outfitConfig.melee)
end
local addonBonus = CreatureEvent("AddonBonus")
function addonBonus.onLogin(player)
-- Getting the player's outfit directly
local outfit = player:getOutfit()
local lookType = outfit.lookType
local lookAddons = outfit.lookAddons
local outfitConfig = conditionConfig[lookType]
if outfitConfig and lookAddons == 3 then
local message = formatMessage(outfitConfig)
player:sendTextMessage(MESSAGE_EVENT_ORANGE, message)
player:addCondition(conditions[outfitConfig.name])
else
player:sendTextMessage(MESSAGE_EVENT_ORANGE, "You are not eligible for a bonus addon")
end
return true
end
addonBonus:register()