local mp = Condition(CONDITION_ATTRIBUTES)
mp:setParameter(CONDITION_PARAM_TICKS, -1)
mp:setParameter(CONDITION_PARAM_STAT_MAXMANAPOINTSPERCENT, 110)
local magic = Condition(CONDITION_ATTRIBUTES)
magic:setParameter(CONDITION_PARAM_TICKS, -1)
magic:setParameter(CONDITION_PARAM_STAT_MAGICPOINTSPERCENT, 150)
magic:setParameter(CONDITION_PARAM_STAT_MAXMANAPOINTSPERCENT, 110)
local hp = Condition(CONDITION_ATTRIBUTES)
hp:setParameter(CONDITION_PARAM_TICKS, -1)
hp:setParameter(CONDITION_PARAM_STAT_MAXHITPOINTSPERCENT, 110)
local distance = Condition(CONDITION_ATTRIBUTES)
distance:setParameter(CONDITION_PARAM_TICKS, -1)
distance:setParameter(CONDITION_PARAM_SKILL_DISTANCEPERCENT, 150)
distance:setParameter(CONDITION_PARAM_STAT_MAXHITPOINTSPERCENT, 110)
local sword = Condition(CONDITION_ATTRIBUTES)
sword:setParameter(CONDITION_PARAM_TICKS, -1)
sword:setParameter(CONDITION_PARAM_SKILL_MELEEPERCENT, 150)
sword:setParameter(CONDITION_PARAM_STAT_MAXHITPOINTSPERCENT, 110)
oldOutfit = {}
outfitBonuses = {
[128] = {[4] = {[2] = {condition = hp}, [3] = {condition = sword}}},
[129] = {[3] = {[2] = {condition = hp}, [3] = {condition = distance}}},
[130] = {[1] = {[2] = {condition = mp}, [3] = {condition = magic}}}
}
function Creature
nChangeOutfit(outfit)
if self:isPlayer() then
local getOutfit = self:getOutfit()
oldOutfit[self:getId()] = { --Colors (Head, Body, Legs, Feet) and lookTypeEx are unused, but I still keep them here because I'm stupid.
lookHead = getOutfit.lookHead;
lookBody = getOutfit.lookBody;
lookLegs = getOutfit.lookLegs;
lookFeet = getOutfit.lookFeet;
lookType = getOutfit.lookType;
lookTypeEx = getOutfit.lookTypeEx;
lookAddons = getOutfit.lookAddons;
lookMount = getOutfit.lookMount;
}
local old = oldOutfit[self:getId()]
local oldOutfit_t = outfitBonuses[old.lookType][self:getVocation():getBase():getId()]
if oldOutfit_t and oldOutfit_t[old.lookAddons] then
local oldCondition = oldOutfit_t[old.lookAddons].condition
if type(oldCondition) == "table" then
for _, condition in pairs(oldCondition) do
self:removeCondition(condition:getType(), condition:getId())
end
else
self:removeCondition(oldCondition:getType(), oldCondition:getId())
end
end
local currentOutfit = outfitBonuses[outfit.lookType]
if currentOutfit and currentOutfit[outfit.lookAddons] then
local newCondition = currentOutfit[outfit.lookAddons].condition
if type(newCondition) == "table" then
for _, condition in pairs(newCondition) do
self:addCondition(condition)
end
else
self:addCondition(newCondition)
end
end
end
return true
end