;+----------------------------------------------------------------------------------------------------- ;| Name: Sell ;| In: none ;| Returns: none ;| Description: Targets the nearest vendor that can also repair. Then loops through your inventory ;| selling items that are listed in the Sell section of InventoryManagement.xml ;| ;| ©2005 Fippy ;+----------------------------------------------------------------------------------------------------- function Sell() { declare Bags int local 0 declare Slots int local 0 declare Vendor guidlist local declare Count int 1 move -stop ;Unload the setting to ensure we are getting a fresh copy SettingXML[${InventorySettingFile}]:Unload ; Do an objects search and find the nearest merchant Unit if ${AutoRepair} { Vendor:Search[-units,-merchant,-repair,-nearest] } else { Vendor:Search[-units,-merchant,-nearest] } ; If we dont find a vendor disable selling and exit. if ${Vendor.Count}<1 { AutoSell:Set[FALSE] AutoRepair:Set[FALSE] Return } ;Make sure we are close enough call movetoobject ${Vendor.GUID[1]} 5 ;Use the target to open the merchant window Unit[${Vendor.GUID[1]}]:Use if ${AutoRepair} { wait 400 ${WoWScript[GossipFrame:IsShown()]} WoWScript SelectGossipOption(1) ;Wait for the vendor window to open. wait 400 ${WoWScript[MerchantFrame:IsShown()]} } else { ;Wait for the vendor window to open. wait 400 ${WoWScript[MerchantFrame:IsShown()]} } ;If we are auto selling then sell if ${AutoSell} { ;Loop through our inventory and sell if required do { Slots:Set[1] do { if ${Me.Bag[${Bags}].Item[${Slots}](exists)}&&!${WoWBotInv.IsInKeep[${Me.Bag[${Bags}].Item[${Slots}].Name}]} { if (${WoWBotInv.IsInSell[${Me.Bag[${Bags}].Item[${Slots}].Name}]}&&${SellByName})||(${SellByRarity} && ${Me.Bag[${Bags}].Item[${Slots}].Rarity}<=${SellByRarityLevel}) { call UpdateHudStatus "Selling ${Me.Bag[${Bags}].Item[${Slots}]}" Me.Bag[${Bags}].Item[${Slots}]:Use wait 20 } } } while ${Slots:Inc}<=${Me.Bag[${Bags}].Slots}&&!${Me.InCombat} } while ${Me.Bag[${Bags:Inc}](exists)}&&!${Me.InCombat} } ;Repair all our gear WoWScript RepairAllItems() wait 20 ;Calculate our money gained moneygain:Set[${moneygain} + ${WoWScript[GetMoney()]} - ${storedmoney}] storedmoney:Set[${WoWScript[GetMoney()]}] ; Check we are not still full if so disable selling if ${Me.EmptyInventorySlots}-${KeepEmpty}<1 { AutoSell:Set[FALSE] } ;All done carry on. AtMerchant:Set[FALSE] NeedRepair:Set[FALSE] TravelState:Set[PATROLING] TargetGUID:Set[NOTARGET] ForcedSell:Set[FALSE] checkinv }