Code: Select all
|Bazaarupdate.mac
|Written By Zacaria
|04-Jan-2004
| 1.0c
|----------------------
| Script Description
|----------------------
|
|This Script is used to Update your Bazaar Trader
|It will search the bazaar using the Bazaar Search Plugin (Make Sure you Have it Loaded)
|It uses the Bazaar Ini in your everquest Directory and also have a Bypass file so you can specify how you want your items handled
|
| Syntax: /mac Bazaarupdate <verbose>
| Example: /mac Bazaarupdate 1
|
| With Verbose on the Outputted "Echos" Will be spamtastic!
#turbo
#Event MaxBazaar "The bazaar has reached its maximum number of traders. Please try again in a few minutes."
Sub Main(Verbose)
|Global Declares
/declare BZRINI global
/declare l2 global
/declare l11 global
/declare ByPassIni global
/declare OutSellPrice global
/declare OutSellPriceH global
/declare PricePctV global
/declare MQ_Directory global
/declare BazaarDelay global
|User Set Variables!
|
|PricePctV = Sell Percentage Difference. So if someone has an item and your Ini says its 50% less then him, it will up it to this value (Handy for when sellers leave etc)
/varset PricePctV 50
|OutSellPrice This is the amount (In Copper) that you want your Items to outbid everyone by [default of 1000 = 1pp]
/varset OutSellPrice 1000
|ByPass Ini is the File used for Item Bypassing etc.
|Syntax in the File: 1= Bypass it completly and you will setup the price, 2= Set to sell fast (Lowest Price), 0= Average Price of everyone.
/varset ByPassIni $char(name)_bypass.ini
|BZRINI Here is the location of your Bazaar File!!!
/varset BZRINI "c:\progra~1\games\Everqu~1\BZR_"
|BZRINI Dont Change This (Should be the same for Everyone
/varcat BZRINI $char(name)_
|BZRINI This is For your Server... Check your Trader file for it
/varcat BZRINI Xenogy
|BZRINI Shouldnt have to change this
/varcat BZRINI ".ini"
|YOU MUST SETUP YOUR MQ Directory Here.
/varset MQ_Directory c:\Mq2\
|
|End User Set Variables
/varcat MQ_Directory locations.txt
|This is where I cleanup the Windows Prior to Running This.
/call TraderWindowStuff 0
/call ConvertPlat @OutSellPrice
/varset OutSellPriceH "$return"
/for l2 0 to 7
/if "$pack(@l2,name)"!~"Trader's Satchel" /next l2
/if $pack(@l2,empty)==TRUE /next l2
/for l11 0 to 9
/if "$item(@l2,@l11,name)"=="NULL" /next l11
/if "$item(@l2,@l11,name)"!="NULL" {
/call Add_Item "$item(@l2,@l11,name)" @Verbose
}
/next l11
/next l2
/call TraderWindowstuff 1
/return
Sub Add_Item(ItemName,Verbose)
/declare Spell local
/declare Ini_Price local
/declare Ini_PriceH local
/declare l1 local
/declare length local
/declare price local
/declare traderid local
/declare index local
/declare Average_Price local
/declare PriceH local
/declare Low_Price local
/declare Item_Value local
/declare Item_ValueH local
/declare PricePct Local
/declare OutSell local
/varset Average_Price 0
/if "$ini("@ByPassIni","Item","@ItemName")"=="NOTFOUND" {
/ini "@ByPassIni" "Item" "@ItemName" "0"
/echo @ItemName not in the Bypass File (@ByPassIni) Skipping Price Update until Next Run of the Script!!
/goto :next
} else {
/if n $ini("@ByPassIni","Item","@ItemName")==1 {
/echo @ItemName Currently Flagged to Not Be Messed With. SKIPPING!!!! Change @ByPassIni if you want to change this.
/goto :next
}
/if n $ini("@ByPassIni","Item","@ItemName")==2 {
/echo @ItemName Currently Flagged for FAST SELL! Putting it at the Lowest possible Bazaar Price (Minus @OutSellPriceH).
/varset OutSell 1
}
}
/varset Item_Value $int($item(@l2,@l11,value))
/varset length $strlen("@ItemName")
|Setup the Bypass Ini File
|Get The Ini Price of the Item from the Bazaar Ini File
/if n $instr(:,"@ItemName")!=-1 {
/varset Spell "@ItemName:1"
/varset Ini_Price $ini(@BZRINI,"ItemToSell","@Spell")
} else {
/varset Ini_Price $ini(@BZRINI,"ItemToSell","@ItemName")
}
| Start the Search Portion
/if "@Ini_Price"!="NOTFOUND" {
/call ConvertPlat "@Ini_Price"
/varset Ini_PriceH "$return"
} else {
/varset Ini_Price 0
/varset Ini_PriceH "--Not Set Add Your Own Price!--"
}
/if "@ItemName"=="NULL" /return
/call SpamTastic "@Verbose" "Currently Searching for @ItemName (INI Price: @Ini_PriceH)"
/bzsrch race any class any @ItemName
| is request done?
:loop
/delay 1
/if "$bazaar()"=="FALSE" /goto :loop
/if n $bazaar(count)==0 {
/call SpamTastic "@Verbose" "\---@ItemName not found (Current Price: @Ini_PriceH)"
/goto :next
}
/varset price $bazaar(0,price)
/varset traderid $bazaar(0,trader)
/if n $bazaar(count)>=1 {
/if n @index==-1 {
/call SpamTastic "@Verbose" "\-----No matches for @ItemName found."
/goto :next
}
/if n $bazaar(count)==1 {
/if n @Ini_Price>@price {
/varset PricePct $int($calc($calc(1-$calc(@price/@Ini_Price))*100))
/if n @PricePct>@PricePctV {
/echo @ItemName Currently The Price Difference is GREATER then @PricePctV% (@PricePct %), So I am going to leave
the price at Previous Setting as not to lower the price too much.
/goto :next
}
} else {
/varset PricePct $int($calc($calc(1-$calc(@Ini_Price/@price))*100))
/if n @PricePct>@PricePctV {
/echo @ItemName Currrently The Price Different is GREATER then @PricePctV% (@PricePct %), Which means your
underbidding him by that much. Upping the Price by $int($calc(@PricePct-@PricePctV))%
/varset Low_Price $int($calc(@price-$calc(0.@PricePctV*@price)))
/varset Ini_Price @price
/goto :onward
}
}
}
/for l1 0 to $calc($bazaar(count)-1)
/if "@ItemName"=="$bazaar(@l1,name)" {
/varset Average_Price $calc(@Average_Price+$bazaar(@l1,price))
/if n $bazaar(@l1,price)<@price {
/varset price $bazaar(@l1,price)
/varset traderid $bazaar(@l1,trader)
}
}
/next l1
/if n OutSell==1 {
/varset Low_Price $int(@price)
/varsub Low_Price @OutSellPrice
/varset Low_Price $int(@Low_Price)
} else {
/varset Average_Price $calc(@Average_Price/$bazaar(count))
/varset Low_Price @Average_Price
}
:onward
/call ConvertPlat @Low_Price
/varset PriceH "$return"
/call ConvertPlat @Item_Value
/varset Item_ValueH "$return"
/if n $instr(:,"@ItemName")!=-1 {
/if n @Ini_Price>0 {
/if n @Ini_Price!=@Item_Value {
/if n @Item_Value>@Low_Price {
/ini "@BZRINI" "ItemToSell" "@Spell" "@Item_Value"
/echo Item below its Value! @ItemName!! [Price Set to @Item_ValueH]
/goto :next
}
} else {
/goto :next
}
}
/if n "@Ini_Price">"@Low_Price" {
/echo Lowered the Price of the @ItemName due to demands! (Old: @Ini_PriceH New: @PriceH )
/ini "@BZRINI" "ItemToSell" "@Spell" "@Low_Price"
/goto :next
}
}
/if n @Ini_Price>0 {
/if n @Ini_Price!=@Item_Value {
/if n @Item_Value>@Low_Price {
/ini "@BZRINI" "ItemToSell" "@ItemName" "@Item_Value"
/echo Item below its Value! @ItemName!! [Price Set to @Item_ValueH]
/goto :next
}
} else {
/goto :next
}
}
/if n "@Ini_Price">"@Low_Price" {
/echo Lowered the Price of the @ItemName due to demands! (Old: @Ini_PriceH New: @PriceH)
/ini "@BZRINI" "ItemToSell" "@ItemName" "@Low_Price"
}
/call SpamTastic "@Verbose" "\-----Nothing to Do for @ItemName, Going to Next Item"
:next
}
/return
sub ConvertPlat(CashAmt)
/declare platAmt local
/declare goldAmt local
/declare silverAmt local
/declare copperAmt local
/varset platAmt $int($calc(@CashAmt/1000))
/varset goldAmt $int($calc(@CashAmt%1000\100))
/varset silverAmt $int($calc(@CashAmt%100\10))
/varset copperAmt $int($calc(@CashAmt%10))
/varset CashAmt "@platAmt Platinum"
/if n @goldAmt>0 {
/varcat CashAmt " @goldAmt Gold"
}
/if n @silverAmt>0 {
/varcat CashAmt " @silverAmt Silver"
}
/if n @copperAmt>0 {
/varcat CashAmt " @copperAmt Copper"
}
/return @CashAmt
sub SpamTastic
/if n @Param0==1 {
/echo @Param1
}
/return
sub TraderWindowStuff(TraderWindowVar)
/if n @TraderWindowVar==1 {
/trader
/click left bzrtrader_start
/delay 20
/doevents
/return
}
/cleanup
|Adding Stuff to the Locations File so that I can reference to it later.
/if $ini("@MQ_Directory","bzrtrader_start","UILabel")=="NOTFOUND" {
/ini "@MQ_Directory" "bzrtrader_start" "UILabel" "BazaarWnd"
/ini "@MQ_Directory" "bzrtrader_start" "XMLFile" "EQUI_BazaarWnd.xml"
/ini "@MQ_Directory" "bzrtrader_start" "ScreenID" "BZW_End_Button"
}
/return
sub Event_MaxBazaar
/delay @BazaarDelay
/varset BazaarDelay 15s
/call TraderWindowStuff 1
/return
