function XAR.OnShopOpen()
local cost = GetRepairAllCost()
local costEquipped = 0;
if GetCurrentMoney() >= cost then
if XAR.Saved.onlyEquipped then
XAR.RepairOnlyEquippedItems()
else
XAR.RepairAllItems()
end
elseif XAR.Saved.onlyEquipped then
local _, bagSlots = GetBagInfo(BAG_WORN)
for slotIndex=0, bagSlots - 1 do
local condition = GetItemCondition(bagId, slotIndex)
if condition < 100 then
local icon, stackCount, _, _, _, _, _, quality = GetItemInfo(bagId, slotIndex)
if stackCount > 0 then
local repairCost = GetItemRepairCost(bagId, slotIndex)
if repairCost > 0 then
costEquipped = costEquipped + repairCost;
end
end
end
end
if GetCurrentMoney() >= costEquipped then
XAR.RepairOnlyEquippedItems()
else
XAR.print("Not enough gold")
end
else
XAR.print("Not enough gold")
end
end