|-------------------------------------------------------------|
| Checks your /trader prices and updates if needed.
|-------------------------------------------------------------**|
Sub CheckTraderPrices
/declare slot int local -1
/declare dupCheck int local
/declare searchResult int local
/declare lowestPrice int local
/declare found int local 0
/declare dataWaitVar int local 0
/declare Excludelist string local
/declare ShopingListMin int local 2000000
/declare ShopingListMax int local 0
/declare ShopingListRunning int local 0
/call logIt "3" "Checking current prices."
/if (${SellerReview}) /call logIt "2" "Seller Review Mode is: ${SellerReview}"
/if (!${AggressiveSeller}) {
/call logIt "1" "Undercutting all other vendors by \ag${UndercutPct}%"
} else {
/call logIt "1" "Undercutting all other vendors by \ag${UndercutAmount}\ay platinum."
}
/for slot 0 to 144
/call logIt "3" "Scanning Trader Slot ${slot}"
/varset lowestPrice 2000000
/varset ShopingListMin 2000000
/varset ShopingListMax 0
/varset ShopingListRunning 0
/notify BazaarWnd BZR_BazaarSlot${slot} leftmouseup
/varset thisItem ${Window[BazaarWnd].Child[BZR_BazaarSlot${slot}].Tooltip}
/varset currentPrice ${Window[BazaarWnd].Child[BZW_Money0].Text}
/if (!${Window[BazaarWnd].Child[BZR_BazaarSlot${slot}].Tooltip.Length}) /break
/if (${Bool[${Window[BazaarWnd].Child[BZR_BazaarSlot${slot}].Tooltip}]}) {
|Check if this item should be skipped
/if (${Ini[${itemPrices},${thisItem},SellPriceMax]} == -1) {
/call logIt "2" "\aoINI set to skip this item, skipping." "${thisItem}"
/varset SkipItem TRUE
}
/if (${slot}) {
/for dupCheck 0 to ${Math.Calc[${slot}-1]}
/if (${Window[BazaarWnd].Child[BZR_BazaarSlot${dupCheck}].Tooltip.Equal[${thisItem}]}) {
/call logIt "2" "\aoPreviously checked, skipping." "${thisItem}"
/varset SkipItem TRUE
}
/next dupCheck
}
/if (${SkipItem}) {
/varset SkipItem FALSE
/continue
}
/varset SellerFound FALSE
/notify BazaarWnd BZR_BazaarSlot${slot} leftmouseup
/delay 5
/call logIt "3" "Your current asking price is (\ag${currentPrice}\ax)" "${thisItem}"
/call logIt "2" "Checking item. Your \aoMin: \ag${Ini[${itemPrices},${thisItem},SellPriceMin]}\ay, \aoMax: \ag${Ini[${itemPrices},${thisItem},SellPriceMax]}" "${thisItem}"
|If my Current Price is less than SellPriceMin set new price to SellPriceMin
/if (${Ini[${itemPrices},${thisItem},SellPriceMin]} != 1) {
/if (${currentPrice} < ${Ini[${itemPrices},${thisItem},SellPriceMin]}) {
/call logIt "3" "The price was less than SellPriceMin: ${Ini[${itemPrices},${thisItem},SellPriceMin]}" "${thisItem}"
/varset newPrice ${Ini[${itemPrices},${thisItem},SellPriceMin]}
}
}
|If you have a max price, default to that. Profits First!
/if (${Ini[${itemPrices},${thisItem},SellPriceMax]} != 1) {
/call logIt "3" "Setting starting price to SellPriceMax: (\ag${Ini[${itemPrices},${thisItem},SellPriceMax]}\ay)" "${thisItem}"
/varset newPrice ${Ini[${itemPrices},${thisItem},SellPriceMax]}
} else {
/call logIt "3" "Your SellPriceMax not set. Using current starting price: (\ag${currentPrice}\ay)" "${thisItem}"
/varset newPrice ${currentPrice}
}
/call BazaarSearch
|Lets make sure we have some results
/varset found 0
/for dataWaitVar 1 to ${SearchWaitTime}
/varset found ${Window[BazaarSearchWnd].Child[BZR_ItemList].List[1,3]}
/delay 5
/if (${found}>0) /break
/next dataWaitVar
/if (${dataWaitVar} >=${SearchWaitTime}) {
/call logIt "0" "Notice! No search results returned." "${thisItem}"
/call logIt "1" "If this was a common item you may wish to consider increasing your SearchWaitTime" "${thisItem}"
}
/call logIt "3" "Waited ${dataWaitVar} cycles for Sellers" "${thisItem}"
/for searchResult 1 to 255
/if (${Bool[${Window[BazaarSearchWnd].Child[BZR_ItemList].List[${searchResult},3]}]}) {
/if (${Window[BazaarSearchWnd].Child[BZR_ItemList].List[${searchResult},2].Equal[${thisItem}]}) {
/if (!${Ini[${BazINI},Excludes,ExcludeList].Find[${Window[BazaarSearchWnd].Child[BZR_ItemList].List[${searchResult},8]}]}) {
/if (${Ini[${itemPrices},${thisItem},SellPriceMin]} <= ${Window[BazaarSearchWnd].Child[BZR_ItemList].List[${searchResult},4]}) {
/call logIt "3" "\am${Window[BazaarSearchWnd].Child[BZR_ItemList].List[${searchResult},8]}'s\ay price is (\ag${Window[BazaarSearchWnd].Child[BZR_ItemList].List[${searchResult},4]}\ay)" "${thisItem}"
/varset SellerFound TRUE
/if (${lowestPrice} > ${Window[BazaarSearchWnd].Child[BZR_ItemList].List[${searchResult},4]}) {
/varset lowestPrice ${Window[BazaarSearchWnd].Child[BZR_ItemList].List[${searchResult},4]}
/call logIt "3" "\am${Window[BazaarSearchWnd].Child[BZR_ItemList].List[${searchResult},8]}'s\ay price (\ag${Window[BazaarSearchWnd].Child[BZR_ItemList].List[${searchResult},4]}\ay) is now current lowest qualified." "${thisItem}"
}
} else {
/call logIt "2" "\am${Window[BazaarSearchWnd].Child[BZR_ItemList].List[${searchResult},8]}'s\a-y price (\ag${Window[BazaarSearchWnd].Child[BZR_ItemList].List[${searchResult},4]}\a-y) was lower than SellPriceMin. Ignoring Trader" "${thisItem}"
}
/if (${Window[BazaarSearchWnd].Child[BZR_ItemList].List[${searchResult},4]}>${ShopingListMax}) /varset ShopingListMax ${Window[BazaarSearchWnd].Child[BZR_ItemList].List[${searchResult},4]}
/if (${Window[BazaarSearchWnd].Child[BZR_ItemList].List[${searchResult},4]}<${ShopingListMin}) /varset ShopingListMin ${Window[BazaarSearchWnd].Child[BZR_ItemList].List[${searchResult},4]}
/varcalc ShopingListRunning ${ShopingListRunning}+${Window[BazaarSearchWnd].Child[BZR_ItemList].List[${searchResult},4]}
} else {
/call logIt "2" "\am${Window[BazaarSearchWnd].Child[BZR_ItemList].List[${searchResult},8]}\aw was on the Excluded Traders list." "${thisItem}"
}
} else {
/call logIt "3" "\a-y${Window[BazaarSearchWnd].Child[BZR_ItemList].List[${searchResult},2]} is not the same as ${thisItem}" "${thisItem}"
}
} else {
/break
}
/delay 10s ${Window[BazaarSearchWnd].Child[BZR_QueryButton].Enabled}
/next searchResult
} else {
/call logIt "3" "No more items to check. Finished updating prices." "${thisItem}"
/break
}
|What to do if there are no other sellers.
/if (!${SellerFound}) {
|What to do if there are no other sellers.
/if (${Ini[${itemPrices},${thisItem},SellPriceMax]} != 1) {
/if (${newPrice} < ${Ini[${itemPrices},${thisItem},SellPriceMax]}) {
/varset newPrice ${Ini[${itemPrices},${thisItem},SellPriceMax]}
/call logIt "3" "Proposed new price is: (\ag${newPrice}\ay) (Your SellPriceMax)" "${thisItem}"
}
}
} else {
|A Seller was found.
/if (!${AggressiveSeller}) {
/varcalc newPrice ${lowestPrice}-${Math.Calc[${lowestPrice}*0.${UndercutPct}]}
/if (${newPrice} > 100) {
/call roundDown
}
} else {
/varcalc newPrice ${lowestPrice} - ${UndercutAmount}
}
|Make sure we are selling within our set parameters
/call logIt "3" "Proposed new asking price is: (\ag${newPrice}\ay)" "${thisItem}"
/if (${Ini[${itemPrices},${thisItem},SellPriceMin]} != 1) {
/if (${newPrice} < ${Ini[${itemPrices},${thisItem},SellPriceMin]}) {
/call logIt "3" "The proposed price of was less than SellPriceMin: (\ag${Ini[${itemPrices},${thisItem},SellPriceMin]}\ax) - Increasing to SellPriceMin" "${thisItem}"
/varset newPrice ${Ini[${itemPrices},${thisItem},SellPriceMin]}
}
}
/if (${Ini[${itemPrices},${thisItem},SellPriceMax]} != 1) {
/if (${newPrice} > ${Ini[${itemPrices},${thisItem},SellPriceMax]}) {
/call logIt "3" "Proposed price was greater than SellPriceMax: (\ag${Ini[${itemPrices},${thisItem},SellPriceMax]}\ax) - Decreasing to SellPriceMax" "${thisItem}"
/varset newPrice ${Ini[${itemPrices},${thisItem},SellPriceMax]}
}
}
}
|Make sure we are selling it for more than what a vendor will pay
/call logIt "4" "Verifing a vendor won't just pay more." "${thisItem}"
/if (${Int[${FindItem[${thisItem}].Value}]} > 1001) {
/call logIt "4" "Vendor value is greater than 1pp" "${thisItem}"
/if (${Int[${Math.Calc[${FindItem[${thisItem}].Value}/1000]}]} > ${newPrice}) {
/call logIt "2" "Proposed price was less than Vendor Purchase price: (\ag${Int[${Math.Calc[${Int[${Math.Calc[${FindItem[${thisItem}].Value}/1000]}]}+1]}]}\ax) - Beating Vendor Price." "${thisItem}"
/varset newPrice ${Int[${Math.Calc[${Int[${Math.Calc[${FindItem[${thisItem}].Value}/1000]}]}+1]}]}
}
}
/if (${newPrice} != ${currentPrice}) {
/if (${currentPrice}<${newPrice}) {
/call logIt "1" "\agIncreasing\ao price from (\aw${currentPrice}\ao) to (\ag${newPrice}\ao)" "${thisItem}"
} else {
/call logIt "1" "\arDecreasing\ao price from (\aw${currentPrice}\ao) to (\ar${newPrice}\ao)" "${thisItem}"
}
/call UpdatePrice ${newPrice}
} else {
/call logIt "3" "Current price (\ag${currentPrice}\ay) is the same as the proposed price (\ag${newPrice}\ay)." "${thisItem}"
}
/varset lowestPrice 0
/if (${SellerReview}) /call INIReviewInterface
/if (${LogLevel}>=4 && !${SellerReview}) {
/call logIt "4" "Verbose Logging Enabled, Pausing so you may read the spam." "${thisItem}"
/mqpause on
}
|----------- Write to shopping list
/if (${CreateShoppingList}) {
/mqlogcustom bazaar3_${EverQuest.Server}_Shopping_List.cvs ${Time.Date};${Time};seller;${Me.Name};"${thisItem}";${ShopingListMin};${ShopingListMax};${Math.Calc[${ShopingListRunning}/${searchResult}]};0;0;0;${Ini[${itemPrices},${thisItem},SellPriceMin]};${Ini[${itemPrices},${thisItem},SellPriceMax]};${Ini[${itemPrices},${thisItem},BuyPriceMin]};${Ini[${itemPrices},${thisItem},BuyPriceMax]};${Ini[${itemPrices},${thisItem},MinBuyCount]}
}
/next slot
/return