local function isMountOnly(outfit_one, outfit_two)
if outfit_one.lookMount ~= outfit_two.lookMount then
return outfit_one.lookType == outfit_two.lookType
end
return false
end
function Creature:onChangeOutfit(outfit)
if self:isPlayer() then
local getOutfit = self:getOutfit()
-- if the only thing changed was mount id, don't re-apply the bonuses
if isMountOnly(getOutfit, outfit) then
return true
end
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]
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(), condition:getSubId())
end
else
self:removeCondition(oldCondition:getType(), oldCondition:getId(), oldCondition:getSubId())
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