All bags must be open and not over lapping.
You must select the casino dealer you wish to deal with.
After Macro has completed you will recieve a stat report of the following:
**Edit Corrected a stat problem
**Edit #2 Corrected gold ticket problem

Code: Select all
| Casino.mac
| By: Frequency
| All bags must be Open
| Casino Merchant you wish to deal with must be targeted
|
#event NoWin "#*#Lady Luck is not on your side today.#*#"
#event SmallWin "#*#here is your small prize.#*#"
#event MediumWin "#*#Not a bad hand for you#*#"
#event PrettyGoodWin "#*#That is a pretty good hand#*#"
#event GoodWin "#*#That is a good hand!#*#"
#event IllusionWin "#*#mask your appearance#*#"
#event TokenWin "#*#here are your#*#King's Court tokens.#*#"
Sub main
/declare NoWin int outer
/declare SmallWin int outer
/declare MediumWin int outer
/declare PrettyGoodWin int outer
/declare GoodWin int outer
/declare IllusionWin int outer
/declare TokenWin int outer
/declare StartTokens int outer
/varset StartTokens ${FindItemCount[=King's Court Token]}
/declare CasinoNPC int local
/varset CasinoNPC ${Target.ID}
/if ( !${CasinoNPC} ) {
/echo You need to target an NPC you wish to run the casino with
/endmacro
}
/declare TradeSlot int local
/varset TradeSlot 0
/declare TurnInsRemaining int local
/varset TurnInsRemaining 0
:MainLoop
/if ( ${FindItemCount[=King's Court Token]} == 0 ) /goto :Done
/if ( ${FindItemCount[=Gold Ticket]} > 0 ) /goto :Done
/if ( !${Me.FreeInventory} ) /goto :Done
/if ( ${FindItemCount[=King's Court Token]} > 4 ) {
/varset TurnInsRemaining 3
} else {
/varset TurnInsRemaining ${Math.Calc[${FindItemCount[=King's Court Token]} - 1]}
}
/for TradeSlot 0 to ${TurnInsRemaining}
/call ClearCursor
/call GetToken
/if ( !${TradeSlot} ) {
/target ID ${CasinoNPC}
/click Left Target
/delay 2
:WaitForWindow
/if ( !${Window[GiveWnd].Open} ) /goto :WaitForWindow
} else {
/target ID ${CasinoNPC}
/click Left Target
/delay 2
}
/next TradeSlot
/notify GiveWnd GVW_Give_Button leftmouseup
/delay 5
/doevents
/call ClearCursor
/goto :MainLoop
:Done
/call Report
/call BeepLoop
/return
Sub GetToken
/ctrlkey /itemnotify ${FindItem[=King's Court Token].InvSlot} leftmouseup
/delay 10
/if ( ( ${Cursor.ID} ) && ( ${Cursor.Name.NotEqual[King's Court Token]} ) ) {
/call ClearCursor
/call GetToken
}
/return
Sub ClearCursor
/if ( ${Cursor.ID} ) {
:ClearLoop
/autoinv
/delay 1
/if ( ${Cursor.ID} ) /goto :ClearLoop
}
/return
Sub BeepLoop
:BeepLoop
/beep
/delay 5
/beep
/delay 4
/beep
/delay 3
/beep
/delay 2
/beep
/delay 1
/goto :BeepLoop
}
/return
Sub Report
/doevents
/declare TotalPlays int local
/varset TotalPlays ${Math.Calc[${SmallWin} + ${MediumWin} + ${PrettyGoodWin} + ${GoodWin} + ${IllusionWin} + ${TokenWin} + ${NoWin}]}
/declare TotalWins int local
/varset TotalWins ${Math.Calc[${SmallWin} + ${MediumWin} + ${PrettyGoodWin} + ${GoodWin} + ${IllusionWin} + ${TokenWin}]}
/echo Total Plays: ${TotalPlays}
/echo Wins: ${TotalWins}
/echo Win Percentage: ${Math.Calc[(${TotalWins} / ${TotalPlays}) * 100]}%
/echo Small Wins: ${SmallWin} - ${Math.Calc[(${SmallWin} / ${TotalPlays}) * 100]}%
/echo Medium Wins: ${MediumWin} - ${Math.Calc[(${MediumWin} / ${TotalPlays}) * 100]}%
/echo Pretty Good Wins: ${PrettyGoodWin} - ${Math.Calc[(${PrettyGoodWin} / ${TotalPlays}) * 100]}%
/echo Good Wins: ${GoodWin} - ${Math.Calc[(${GoodWin} / ${TotalPlays}) * 100]}%
/echo Illusion Wins: ${IllusionWin} - ${Math.Calc[(${IllusionWin} / ${TotalPlays}) * 100]}%
/echo Tokens Wins: ${TokenWin} - ${Math.Calc[(${TokenWin} / ${TotalPlays}) * 100]}%
/echo Tokens Won: ${Math.Calc[${TotalPlays} - ${StartTokens}]}
/echo Total Time Running: ${Math.Calc[${Macro.RunTime} / 60]} Minutes
/return
Sub Event_NoWin
/varcalc NoWin ${NoWin} + 1
/return
Sub Event_SmallWin
/varcalc SmallWin ${SmallWin} + 1
/return
Sub Event_MediumWin
/varcalc MediumWin ${MediumWin} + 1
/return
Sub Event_PrettyGoodWin
/varcalc PrettyGoodWin ${PrettyGoodWin} + 1
/return
Sub Event_GoodWin
/varcalc GoodWin ${GoodWin} + 1
/return
Sub Event_IllusionWin
/varcalc IllusionWin ${IllusionWin} + 1
/return
Sub Event_TokenWin
/varcalc TokenWin ${TokenWin} + 1
/return



