rendered paste bodyfunction main(bool move = TRUE)
{
;DO NOT change below this line unless you know what you're doing.
;---------------------------------------------------------------
/*
* Handle settings
*/
LavishSettings:AddSet[AutoBtmScan]
declarevariable AutoBtmScan settingsetref script
declarevariable Path settingsetref script
AutoBtmScan:Set[${LavishSettings[AutoBtmScan]}]
AutoBtmScan:Clear
AutoBtmScan:Import[config/AutoBtmScan.xml]
Path:Set[${AutoBtmScan.FindSet[Path]}]
Path:Clear
Path:Import[config/${WoWScript[GetRealZoneText()]}.xml]
/*
* Declare the variables for the script
*/
declarevariable EventSys EventSystem script
declarevariable Auctioneer Auctioneer script
declarevariable Characters Characters script
declarevariable GUI GUI script
declarevariable map Mapper script
declarevariable Status Status script
declarevariable DONE bool script FALSE
declarevariable DEAD bool global FALSE
declarevariable Version string script "1.1.2"
/*
* Load UI
*/
UI -load "${Script.CurrentDirectory}/gui/gui.xml"
/*
* Initial user config output
*/
Echo "Automatic BottomScanner ${Version} Loaded"
/*
* Event creation
*/
EventSys:CreateEvents
/*
* LUA script to check if the AH is open
*/
WoWScript "function AHFrameOpen() if(AuctionFrame) then if(AuctionFrame:IsShown()) then return 1; else return 0; end else return 0; end end"
call deathHandler
call useAuctioneer ${move}
/*
* Main loop for handling buying
*/
while !${DONE}
{
if ${WoWScript[AHFrameOpen()]}
{
if ${WoWScript[BtmScan.Prompt:IsVisible()]}
{
WoWScript BtmScan.PerformPurchase()
Event[ITEM_BOUGHT]:Execute
}
ISXWoW:ResetIdle
waitframe
}
call deathHandler
}
Echo "DETECTED LOGOUT: ENDED SCRIPT"
endscript scan
}
function atexit()
{
AutoBtmScan.FindSet[Path]:Clear
AutoBtmScan.FindSet[Path]:AddComment[RunFromGY Path]
AutoBtmScan:Export[config/AutoBtmScan.xml]
UI -unload "${Script.CurrentDirectory}/gui/gui.xml"
}
objectdef Mapper
{
variable int i
variable string zone
variable settingsetref zoneSet
variable settingsetref POIs
method Initialize()
{
zone:Set[${WoWScript[GetRealZoneText()]}]
LavishSettings:AddSet[${zone}]
zoneSet:Set[${LavishSettings[${zone}]}]
zoneSet:AddSet[POIs]
POIs:Set[${zoneSet.FindSet[POIs]}]
i:Set[1]
}
method addPoint()
{
variable string point
point:Set["${Me.X}:${Me.Y}"]
zoneSet:AddSetting[${i},${point}]
echo added point at ${point}
i:Inc
}
method addGY()
{
variable string point
point:Set["${Me.X}:${Me.Y}"]
POIs:AddSetting[Graveyard,${point}]
echo added GY at ${point}
}
method addAH()
{
variable string point
point:Set["${Me.X}:${Me.Y}"]
POIs:AddSetting[AH,${point}]
echo added AH at ${point}
}
method export()
{
zoneSet:Export[config/${zone}.xml]
echo exported
}
}
objectdef Characters
{
variable settingsetref currentCharacterSet
variable settingsetref charactersSet
method Initialize()
{
charactersSet:Set[${AutoBtmScan.FindSet[Characters]}]
This:FindCharacter
}
member corpseAtAH()
{
variable float AHX
variable float AHY
AHX:Set[${Path.FindSet[POIs].FindSetting[AH].String.Token[1,:]}]
AHY:Set[${Path.FindSet[POIs].FindSetting[AH].String.Token[2,:]}]
;echo AHX ${AHX} AHY ${AHY} CorpseX ${Me.Corpse.X} CorpseY ${Me.Corpse.Y}
;echo AHToCorpseDist ${Math.Distance[${Me.Corpse.X},${Me.Corpse.Y},${AHX},${AHY}]}
if ${Math.Distance[${Me.Corpse.X},${Me.Corpse.Y},${AHX},${AHY}]}<20
return TRUE
else
return FALSE
}
member atGY()
{
variable float GYX
variable float GYY
GYX:Set[${Path.FindSet[POIs].FindSetting[Graveyard].String.Token[1,:]}]
GYY:Set[${Path.FindSet[POIs].FindSetting[Graveyard].String.Token[2,:]}]
;echo GYX ${GYX} GYY ${GYY} CorpseX ${Me.Corpse.X} CorpseY ${Me.Corpse.Y}
;echo GYDist ${Math.Distance[${Me.X},${Me.Y},${GYX},${GYY}]}
if ${Math.Distance[${Me.X},${Me.Y},${GYX},${GYY}]}<20
return TRUE
else
return FALSE
}
member atAH()
{
variable float AHX
variable float AHY
AHX:Set[${Path.FindSet[POIs].FindSetting[AH].String.Token[1,:]}]
AHY:Set[${Path.FindSet[POIs].FindSetting[AH].String.Token[2,:]}]
if ${Math.Distance[${Me.X},${Me.Y},${AHX},${AHY}]}<20
return TRUE
else
return FALSE
}
member CharacterExists()
{
variable iterator Iterator
charactersSet:GetSetIterator[Iterator]
if !${Iterator:First(exists)}
return FALSE
do
{
if ${Iterator.Value.FindSetting[Name].String.Equal[${Me.Name}]}
{
currentCharacterSet:Set[${Iterator.Value}]
return TRUE
}
}
while ${Iterator:Next(exists)}
return FALSE
}
method FindCharacter()
{
variable iterator Iterator
charactersSet:GetSetIterator[Iterator]
if !${Iterator:First(exists)}
return
do
{
if ${Iterator.Value.FindSetting[Name].String.Equal[${Me.Name}]}
{
currentCharacterSet:Set[${Iterator.Value}]
}
}
while ${Iterator:Next(exists)}
}
method AddCharacter()
{
variable int count
count:Set[${charactersSet.FindSetting[Count].String}]
count:Inc
charactersSet:AddSetting[Count,${count}]
charactersSet:AddSet[${count}]
charactersSet.FindSet[${count}]:AddSetting[Name,${Me.Name}]
charactersSet.FindSet[${count}]:AddSetting[Level,${Me.Level}]
charactersSet.FindSet[${count}]:AddSetting[Zone,${WoWScript[GetRealZoneText()]}]
GUI:updateLbCharacters[1,${Me.Name}]
}
method RemoveCharacter()
{
variable int count
count:Set[${charactersSet.FindSetting[Count].String}]
count:Dec
This:FindCharacter
variable int characterSetIndex
characterSetIndex:Set[${currentCharacterSet.Name.Right[1]}]
;Echo ${This.CharacterExists}
GUI:updateLbCharacters[0,${Me.Name}]
currentCharacterSet:Rename[old]
currentCharacterSet:Clear
charactersSet:AddSetting[Count,${count}]
variable int i
for (i:Set[${characterSetIndex} + 1];${i}<=${Math.Calc[${count} + 1]};i:Inc)
{
variable int newNameInt
newNameInt:Set[${i} - 1]
charactersSet.FindSet[${i}]:Rename[${newNameInt}]
}
}
}
objectdef GUI
{
method pausePlayVisibility()
{
if ${AutoBtmScan.FindSetting[Active]}
{
UIElement[Pause@chkRunFromGY@Main@Tabs@AutoBtmScan]:Show
UIElement[Play@chkRunFromGY@Main@Tabs@AutoBtmScan]:Hide
}
else
{
UIElement[Pause@chkRunFromGY@Main@Tabs@AutoBtmScan]:Hide
UIElement[Play@chkRunFromGY@Main@Tabs@AutoBtmScan]:Show
}
}
method updateLbCharacters(int theAction, string theName)
{
switch ${theAction}
{
case 0
{
UIElement[lbCharacters@Characters@Tabs@AutoBtmScan].ItemByText[${theName}]:Remove
break
}
case 1
{
UIElement[lbCharacters@Characters@Tabs@AutoBtmScan]:AddItem[${theName}]
UIElement[lbCharacters@Characters@Tabs@AutoBtmScan].ItemByText[${theName}]:SetTextColor[FF2DAF23]
break
}
}
}
method populateLbCharacters()
{
variable iterator Iterator
Characters.charactersSet:GetSetIterator[Iterator]
variable string color
if !${Iterator:First(exists)}
return
do
{
UIElement[lbCharacters@Characters@Tabs@AutoBtmScan]:AddItem[${Iterator.Value.FindSetting[Name].String}]
if ${Iterator.Value.FindSetting[Name].String.Equal[${Me.Name}]}
{
UIElement[lbCharacters@Characters@Tabs@AutoBtmScan].ItemByText[${Me.Name}]:SetTextColor[FF2DAF23]
}
}
while ${Iterator:Next(exists)}
}
method populateCmbDeathCount()
{
variable int i
for(i:Set[1];${i} <= 20;i:Inc)
{
UIElement[cmbDeathCount@Characters@Tabs@AutoBtmScan]:AddItem[${i},${i}]
if ${i} == ${AutoBtmScan.FindSetting[DeathCount]}
{
UIElement[cmbDeathCount@Characters@Tabs@AutoBtmScan].ItemByText[${i}]:Select
}
}
}
}
objectdef Auctioneer
{
variable guidlist auctioneers
variable objectref currentAuctioneer
member findAuctioneers()
{
auctioneers:Search[-nearest,-auctioneer,-range 0-25]
if ${auctioneers.Count} > 0
{
currentAuctioneer:Set[${auctioneers.GUID[1]}]
return TRUE
}
return FALSE
}
}
objectdef EventSystem
{
variable int soundTimeDelay = ${LavishScript.RunningTime}
variable int soundDelay = 2
variable string SoundToPlay
variable string SndInform = ${String["${Script.CurrentDirectory}/sounds/inform.wav"].Replace['/','\\']}
variable string SndStop = ${String["${Script.CurrentDirectory}/sounds/stop.wav"].Replace['/','\\']}
variable string SndSuccess = ${String["${Script.CurrentDirectory}/sounds/lovesuccess.wav"].Replace['/','\\']}
variable string SndInvite = ${String["${Script.CurrentDirectory}/sounds/invite.wav"].Replace['/','\\']}
method CreateEvents()
{
;CHAT EVENTS
LavishScript:RegisterEvent[CHAT_MSG_WHISPER]
LavishScript:RegisterEvent[CHAT_MSG_SAY]
LavishScript:RegisterEvent[CHAT_MSG_EMOTE]
LavishScript:RegisterEvent[CHAT_MSG_TEXT_EMOTE]
Event[CHAT_MSG_WHISPER]:AttachAtom[This:chatAlert]
Event[CHAT_MSG_SAY]:AttachAtom[This:chatAlert]
Event[CHAT_MSG_EMOTE]:AttachAtom[This:chatAlert]
Event[CHAT_MSG_TEXT_EMOTE]:AttachAtom[This:chatAlert]
;INVITE EVENTS
LavishScript:RegisterEvent[PARTY_INVITE_REQUEST]
LavishScript:RegisterEvent[GUILD_INVITE_REQUEST]
Event[PARTY_INVITE_REQUEST]:AttachAtom[This:inviteAlert]
Event[GUILD_INVITE_REQUEST]:AttachAtom[This:inviteAlert]
;DEATH EVENT
LavishScript:RegisterEvent[PLAYER_DEAD]
Event[PLAYER_DEAD]:AttachAtom[This:deadAlert]
;SUCCESS EVENT
LavishScript:RegisterEvent[ITEM_BOUGHT]
Event[ITEM_BOUGHT]:AttachAtom[This:boughtAlert]
;LOGOUT EVENT
LavishScript:RegisterEvent[PLAYER_LEAVING_WORLD]
Event[PLAYER_LEAVING_WORLD]:AttachAtom[This:logout]
Echo "EVENTS CREATED"
}
method playSound(string s)
{
SoundToPlay:Set[${s}]
if ${LavishScript.RunningTime} > ${soundTimeDelay}
{
soundTimeDelay:Set[${LavishScript.RunningTime}+(${soundDelay}*1000)]
System:APICall["${System.GetProcAddress["WinMM.dll","PlaySound"].Hex}",${SoundToPlay}.String,0,"Math.Dec[22001]"]
}
}
method chatAlert(uint EventID, string EventName, ... Params)
{
variable string temp=${EventName.Token[3,:]}
EventName:Set[${temp.Left[${Math.Calc[${temp.Find["]"]}-1]}]}]
echo ${EventName}
if ${AutoBtmScan.FindSetting[ChatAlert]}
This:playSound["SndInform"]
if ${EventName.Equal[CHAT_MSG_SAY]}
Status.sayCount:Inc
elseif ${EventName.Equal[CHAT_MSG_WHISPER]}
Status.whisperCount:Inc
elseif ${EventName.Equal[CHAT_MSG_EMOTE]} || ${EventName.Equal[CHAT_MSG_TEXT_EMOTE]}
Status.emoteCount:Inc
}
method deadAlert()
{
if ${AutoBtmScan.FindSetting[DeathAlert]}
This:playSound["SndStop"]
Status.deathCount:Inc
DEAD:Set[TRUE]
}
method inviteAlert(uint EventID, string EventName, ... Params)
{
variable string temp=${EventName.Token[3,:]}
EventName:Set[${temp.Left[${Math.Calc[${temp.Find["]"]}-1]}]}]
echo ${EventName}
if ${AutoBtmScan.FindSetting[PartyDecline]} && ${EventName.Equal[PARTY_INVITE_REQUEST]}
WoWScript DeclineGroup()
if ${AutoBtmScan.FindSetting[GuildDecline]} && ${EventName.Equal[GUILD_INVITE_REQUEST]}
WoWScript DeclineGuild()
if ${AutoBtmScan.FindSetting[InviteAlert]}
This:playSound["SndInvite"]
if ${EventName.Equal[PARTY_INVITE_REQUEST]}
Status.partyInviteCount:Inc
if ${EventName.Equal[GUILD_INVITE_REQUEST]}
Status.guildInviteCount:Inc
if !${WoWScript[AHFrameOpen()]} && ${Auctioneer.currentAuctioneer(exists)} && ${Auctioneer.currentAuctioneer.Distance} < 4.5
{
Auctioneer.currentAuctioneer:Use
}
}
method boughtAlert()
{
if ${AutoBtmScan.FindSetting[SuccessAlert]}
This:playSound["SndSuccess"]
Status.purchaseCount:Inc
}
method logout()
{
DONE:Set[TRUE]
}
}
objectdef Status
{
variable int whisperCount
variable int sayCount
variable int emoteCount
variable int partyInviteCount
variable int guildInviteCount
variable int deathCount
variable int purchaseCount
method Initialize()
{
whisperCount:Set[0]
sayCount:Set[0]
emoteCount:Set[0]
partyInviteCount:Set[0]
guildInviteCount:Set[0]
deathCount:Set[0]
purchaseCount:Set[0]
}
}
function moveto(float X,float Y)
{
face ${X} ${Y}
wait 10 !${ISXWoW.Facing}
wowpress -hold moveforward
do
{
if !${ISXWoW.Facing}
face ${X} ${Y}
waitframe
}
while "${Math.Distance[${Me.X},${Me.Y},${X},${Y}]}>4.5"
wowpress -release moveforward
}
function deathHandler()
{
if !${Me.Ghost} && ${WoWScript[GetReleaseTimeRemaining()]}
{
WoWScript RepopMe()
}
if ${AutoBtmScan.FindSetting[RunFromGY]} && (${Me.Ghost} && ${Characters.corpseAtAH} || ${DEAD}) && ${Characters.atGY}
{
variable iterator Iterator
AutoBtmScan.FindSet[Path]:GetSettingIterator[Iterator]
variable float X
variable float Y
do
{
while !${AutoBtmScan.FindSetting[Active]}
{
}
X:Set[${Iterator.Value.String.Token[1,:]}]
Y:Set[${Iterator.Value.String.Token[2,:]}]
call moveto ${X} ${Y}
call waitUntilAtLocation ${X} ${Y}
}
while ${Iterator:Next(exists)} && ${AutoBtmScan.FindSetting[RunFromGY]}
}
if ${Math.Distance[${Me.X},${Me.Y},${Me.Corpse.X},${Me.Corpse.Y}]} < 20
{
while !${AutoBtmScan.FindSetting[Active]}
{
}
call moveto ${Me.Corpse.X} ${Me.Corpse.Y}
call waitUntilAtLocation ${Me.Corpse.X} ${Me.Corpse.Y}
WoWScript RetrieveCorpse()
wait 10
call useAuctioneer
DEAD:Set[FALSE]
}
}
function waitUntilAtLocation(float X, float Y)
{
while (${Math.Distance[${Me.X},${Me.Y},${X},${Y}]}>4.5)
{
waitframe
}
return
}
function useAuctioneer(bool move=TRUE)
{
/*
* Initially find auctioneer, move to him, and use him
*/
if ${Auctioneer.findAuctioneers}
{
echo FOUND
if ${move}
{
while !${AutoBtmScan.FindSetting[Active]}
{
}
echo MOVING
Call moveto ${Auctioneer.currentAuctioneer.X} ${Auctioneer.currentAuctioneer.Y}
}
Auctioneer.currentAuctioneer:Use
}
else
{
Echo "Could not find any auctioneers in the near vicinity"
}
/*
* If the use above failed, we should be at the auctioneer but for some reason we didn't use him (AH fram isnot open), so use him here
*/
if !${WoWScript[AHFrameOpen()]} && ${Auctioneer.currentAuctioneer(exists)}
{
Auctioneer.currentAuctioneer:Use
}
/*
* If the AH frame is open then begin scanning
*/
wait 40
if ${WoWScript[AHFrameOpen()]}
{
WoWScript BtmScan.BeginScan()
}
}