forked from elanthia-online/dr-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
crowns.lic
153 lines (135 loc) · 4.31 KB
/
crowns.lic
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
=begin
Documentation: https://elanthipedia.play.net/Lich_script_repository#crowns
=end
custom_require.call(%w[events common-travel common common-items common-money])
class Dice
include DRC
include DRCI
include DRCM
include DRCT
def initialize
arg_definitions = [
[
{ name: 'bet', regex: /\d+/, optional: true, description: 'Optional override for betting amount.' }
]
]
settings = get_settings
@trash_items = settings.hollow_eve_junk.map { |x| /\b#{x}\b/i }
@dice_bet_amount = settings.dice_bet_amount || args.bet
@dice_money_on_hand = settings.dice_money_on_hand
@withdraw = settings.dice_withdraw
@hollow_eve_loot_container = settings.hollow_eve_loot_container
@dice = ["anchor", "crown", "heart", "lightning", "ship", "trident"]
Flags.add('bet', /"Place your bets! Place your bets!"/)
Flags.add('no_more_bets', "The libik yells")
Flags.add('out_of_money', /You don't have that many kronars!/)
dice_game
end
def dice_game
loop do
walk_to_table
play_dice
check_prize
end
end
def check_money
get_money if check_wealth('kronars') < 200 && @withdraw
end
def get_money
DRC.message("*** Heading to bank to get money! ***")
DRCT.walk_to(16_315)
case DRC.bput("withdraw #{@dice_money_on_hand}", 'we are not lending money at this time', 'The clerk counts out')
when 'we are not lending money at this time'
exit
end
fput('balance')
end
def walk_to_table
DRC.message("*** Heading to Dice Table! ***")
DRCT.walk_to(16_306) unless (DRRoom.title.include?("Crown and Anchor, Table"))
loop do
break if (DRRoom.title.include?("Crown and Anchor, Table"))
case DRC.bput("go cerulean curtain", "Reflecting", "As you peer")
when "Reflecting"
break
when "As you peer"
case DRC.bput("go carmine curtain", "Reflecting", "As you peer")
when "Reflecting"
break
when "As you peer"
DRC.message("*** Waiting for table to open! ***")
pause 30
end
end
end
end
def play_dice
loop do
count = 0
@dice.each do |id|
case DRC.bput("bet #{@dice_bet_amount} on #{id}", /You bet/, /You can't bet right now./, /You don't have that many kronars!/)
when /You don't have that many kronars!/
DRC.message("******* Out of money! ********")
when /You bet/
count += 1
when /You can't bet right now./
pause 2 until Flags['bet']
Flags.reset('bet')
case DRC.bput("bet #{@dice_bet_amount} on #{id}", /You bet/, /You can't bet right now./, /You don't have that many kronars!/)
when /You don't have that many kronars!/
DRC.message("******* Out of money! ********")
when /You bet/
count += 1
when /You can't bet right now./
pause 2 until Flags['bet']
Flags.reset('bet')
case DRC.bput("bet #{@dice_bet_amount} on #{id}", /You bet/, /You can't bet right now./, /You don't have that many kronars!/)
when /You don't have that many kronars!/
DRC.message("******* Out of money! ********")
when /You bet/
count += 1
end
end
end
end
if count = 6
pause 2 until Flags['no_more_bets']
Flags.reset('no_more_bets')
pause 30 if Flags['out_of_money'] # gives enough time for game to finish and collect any winnings.
Flags.reset('out_of_money')
break
end
end
end
def check_prize
[left_hand, right_hand]
.compact
.each do |in_hand|
if in_hand
case in_hand
when *@trash_items
DRC.bput("put my #{in_hand} in bucket", 'You put', 'You drop', 'What were', 'Stow what?')
else
# Coil rope so we can store it
if /\brope\b/ =~ in_hand
fput("coil my #{in_hand}")
end
if !DRCI.put_away_item?(in_hand, @hollow_eve_loot_container)
DRC.message("*** The item is either too big to fit or no more room in the container(s)! ***")
beep_exit
end
end
end
end
end
def beep_exit
DRC.beep
exit
end
end
before_dying do
Flags.delete('bet')
Flags.delete('no_more_bets')
Flags.delete('out_of_money')
end
Dice.new