-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathisland_booty.php
350 lines (252 loc) · 6.25 KB
/
island_booty.php
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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
<?php
require_once 'includes.php';
redirect_to_index_if_not($user, "island");
$type = get_team($user);
$ra = rand(1,625);
$miles_traveled = get_miles_traveled($user);
$your_coins = get_coin_total($user);
if ($ra < 50) {
$booby_trap = 1;
$bomb_on = get_bomb_on($user);
if($bomb_on == 0) {
$booby_trap = 0;
}
}
if($ra < 33) {
$booty = "a treasure map";
$booty_pic = $treasure_map_image;
$stuff_id = 1;
$map_count = get_map_count($user);
if($map_count > rand(5,10)) {
$rand = rand(1,10);
if($rand != 2) {
$booty = "some gold bars";
$booty_pic = $gold_image;
$stuff_id = 2;
}
}
}
else if($ra < 55) { $booty = "some gold bars";
$booty_pic = $gold_image;
$stuff_id = 2;
}
else if($ra < 80) {
$booty = "a message in a bottle";
$booty_pic = $message_in_a_bottle_image;
$stuff_id = 3;
}
else if($ra < 105) {
$booty = "some dynamite";
$booty_pic = $dynamite_image;
$stuff_id = 4;
}
else if($ra < 120) {
$booty = "a pirate flag";
$booty_pic = $flag_image;
$stuff_id = 5;
}
else if($ra < 125) {
$booty = "a monkey";
$booty_pic = $monkey_200;
$stuff_id = 7;
}
else if($ra < 158) {
$booty = "a pistol";
$booty_pic = $pistol_350;
$stuff_id = 8;
}
else if($ra < 170) {
$booty = "a sword";
$booty_pic = $sword_350;
$stuff_id = 10;
}
else if($ra < 180) {
$booty = "a parrot";
$booty_pic = $parrot_200;
$stuff_id = 11;
}
else if($ra < 190) {
$booty = "some rum";
$booty_pic = $rum_200;
$stuff_id = 9;
}
else if($ra < 212) {
$booty = "a bomb";
$booty_pic = $bomb_image;
$stuff_id = 6;
}
else if($ra < 530) {
//give possibly more coins if you traveled real far
if($miles_traveled > 10 && $miles_traveled < 100) {
$ra = rand($miles_traveled, 80);
//rarely give them 5x or 10x bonus on coins
$ra2 = rand(1,50000);
if($ra2 == 125) {
$ra = $ra * 3;
}
else if($ra2 == 200) {
$ra = $ra * 6;
}
}
else {
$ra = rand(10, 70);
}
$pvp_toggle = $memcache->get($user . 'pvp');
// echo "PVP TOGGLE $pvp_toggle";
//print "pvp toggle $pvp_toggle";
if($pvp_toggle != 'off') {
// echo 'COOL';
$ra = $ra + rand(10,50);
if($ra < 70) {
$ra = rand(70,100);
}
//rarely give them 5x or 10x bonus on coins
$ra2 = rand(1,1000);
if($ra2 == 125) {
$ra = $ra * 3;
}
else if($ra2 == 200) {
$ra = $ra * 6;
}
}
$booty = "$ra pirate coins";
$booty_pic = $pirate_coins_image;
$found_coins = TRUE;
}
else {
$booty = "nothing";
}
if($booby_trap) {
//is there a booby trap for this user
$dynamite = is_dynamite_set($user);
//echo 'dynamite: ';
//echo $dynamite;
if($dynamite < 1) { //no dynamite for this user
$ra = rand(3, 100);
$found_coins = true; // no booty or coins found they blew up
//$booty = "nothing";
$booty = "$ra pirate coins";
$booty_pic = $pirate_coins_image;
$stuff = 'nothing';
}
else {
$user_blown_up = blow_up_user($user);
$booty = "nothing"; // no booty or coins found they blew up
$found_coins = false;
//assumes there is at least 1 dynamite for this user
//unsets dynamite set for this user and takes away 20% of their highest item collection and 10% of their next highest
}
}
if($found_coins) {
$sql = 'update users set coin_total = coin_total + ? where id = ?';
$DB->Execute($sql, array($ra, $user));
$action = 'island coins';
log_coins($user, $ra, $action);
}
else if($booty != 'nothing' && $stuff != 'nothing') {
$sql = 'insert into stuff (user_id, stuff_id, how_many, updated_at) values(?, ?, 1, now()) on duplicate key update how_many = how_many + 1';
$DB->Execute($sql, array($user, $stuff_id));
}
?>
<?php
update_action($user, "NULL");
print dashboard();
?>
<center>
<?php
if($booty != 'nothing' && !$user_blown_up) {
success_msg("Ahoy!<br>You found $booty");
?>
<br>
<?php image($booty_pic); ?><br>
<?php
}
else if($user_blown_up) {
//print "BLOW UP";
print $user_blown_up;
}
else {
?>
<?php
//$last_treasure_mile = $DB->GetOne('select last_treasure_mile from users where id = ?', array($user));
$map_count = get_map_count($user);
$already_quested = $memcache->get($user . 'quested');
$pvp_off = $memcache->get($user . 'pvp');
//echo "pvp off $pvp_off";
$weekly_miles = $DB->GetOne('select weekly_miles from users where id = ?', array($user));
$crew_count = get_crew_count($user);
$sails = get_sails($user);
//echo "sails $sails";
if($sails < 25) {
$s = false;
}
else if($sails > 150) {
$s = true;
}
else {
$t = rand(0,1);
if($t == 0) {
$s = true;
}
else {
$s = false;
}
}
//$sails = 350;
//$weekly_miles = 100;
//$s =true;
//$already_quested = 0;
if($map_count > 0 && $already_quested != 1 && $pvp_off != 'off' && $weekly_miles > 50 && $crew_count > 2 && $s == true) {
//if(true) {
//echo $weekly_miles;
update_action($user, 'island_treasure');
//print_r($map_count);
if($map_count == 1) {
$map_text = 'map';
}
else {
$map_text = 'maps';
}
?>
<div class="standard_message has_padding"><h1 class="status">
<span style='font-size:125%; padding:10px;'>Yer crew found a spot on this island matching one of yer maps!!</span>
<table style='background-color:#FFFFFF; padding:10px; margin:10px' cellpadding='10px'><tr>
<td>
<?php image($item_treasuremap_small); ?>
</td>
<td>
<span style='font-size:115%'>
<br>If you go on the quest, your treasure map will be destroyed!
<br><br>Watch out for enemies - if you can't defeat them you won't get the treasure and won't get yer map back!
<br><br>Stock up on ham and rum before going on the quest!<br>
</span>
</td>
</tr></table>
<br>
<span style='font-size:125%'>Do you want to go <a <?php href('treasure_map_action.php'); ?> >on a quest for treasure?</a>
</span>
<br><br>Use treasure maps to find BOOTY (<?php echo $map_count; ?> <?php echo $map_text; ?> left)<br>
<?php
}
else {
?>
<div class="standard_message has_padding"><h1 class="status">ARRR!<br>You searched around the island but didn't find any booty!
<?php
}
?>
<p>
</p></h1></div>
<?php } ?>
<br>
<br><br>
<?php
/*
<fb:iframe src="http://ec2-67-202-31-235.compute-1.amazonaws.com/promotion.php" width="650" height="60" border="0" frameborder="0" scrolling="no" />
*/
print adsense_468($user);
?>
<br>
<h2 style='padding:20px' ><a <?php href('index.php'); ?>>Arrr..... return to sailin'</a></h2></center>
<?php
set_profile($user);
require_once 'footer.php'; ?>