forked from dduleone/craps
-
Notifications
You must be signed in to change notification settings - Fork 4
/
index.html
executable file
·897 lines (872 loc) · 35.2 KB
/
index.html
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
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
<!DOCTYPE html>
<html><!-- xmlns:fb="http://ogp.me/ns/fb#" -->
<head>
<title>DuLeone Craps</title>
<meta name="description" content="HTML5 Craps" />
<meta name="keywords" content="Craps, Free Craps, HTML5 Craps, Play Craps, Learn Craps, Craps Tutorial, Online Craps, Learn to play Craps, Craps for free, casino, Craps casino, online casino games, online casino, las vegas, atlantic city, free casino, HTML5 Casino, craps odds, play casino craps, casino craps online, casino craps games" />
<meta name="author" content="Matt DuLeone" />
<meta charset="UTF-8" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<!-- meta property='og:title' content='HTML5 Craps' />
<meta property='og:type' content='website' />
<meta property='og:image' content='https://dule.one/craps/img/dice.png' />
<meta property='og:description' content='HTML5 Craps by Matt DuLeone' />
<meta property='og:url' content='https://dule.one/craps/' />
<meta name="appsfuel_code" content="ce06541daa02a75"/ -->
<!--meta name="viewport" content="user-scalable=0, width=device-width, height=device-height, initial-scale=1.0, maximum-scale=1.0, target-densityDpi=device-dpi" / -->
<!-- meta name="viewport" content="user-scalable=0, initial-scale=1.0, maximum-scale=1.0" / -->
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<script type='text/javascript' language='javascript'>
//snippet from http://www.abeautifulsite.net/blog/2011/11/detecting-mobile-devices-with-javascript/
var isMobile = {
Android: function() {
return navigator.userAgent.match(/Android/i);
},
BlackBerry: function() {
return navigator.userAgent.match(/BlackBerry/i);
},
iOS: function() {
return navigator.userAgent.match(/iPhone|iPad|iPod/i);
},
Opera: function() {
return navigator.userAgent.match(/Opera Mini/i);
},
Windows: function() {
return navigator.userAgent.match(/IEMobile/i);
},
any: function() {
return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows());
}
};
//end snippet
var viewport = document.createElement('meta');
viewport.setAttribute('name', 'viewport');
if(isMobile.iOS()){
viewport.setAttribute('content','content',"user-scalable=0, initial-scale=1.0, maximum-scale=1.0");
var apple = document.createElement('meta');
apple.setAttribute('name','apple-mobile-web-app-capable')
apple.setAttribute('content','yes')
document.getElementsByTagName('head')[0].appendChild(apple);
} else {
viewport.setAttribute('content',"user-scalable=0, width=device-width, height=device-height, initial-scale=1.0, maximum-scale=1.0, target-densityDpi=device-dpi");
}
document.getElementsByTagName('head')[0].appendChild(viewport);
</script>
<link href="css/layout.css" media="all" rel="stylesheet" type="text/css" />
<link href="css/css3-gmail-style.css" media="all" rel="stylesheet" type="text/css" />
<link rel="icon" type="image/x-icon" href="/craps/img/dice_small.ico" />
<link rel="icon" type="image/png" sizes="32x32" href="/craps/img/dice_small.ico" />
<link rel="stylesheet" href="font-awesome/css/font-awesome.min.css">
</head>
<body>
<div id="fb-root"></div>
<canvas id="board"></canvas>
<div id='modalScreen' onclick="closeModal()" class='modalScreen'></div>
<div id='betForm' class='round modalBG'>
<fieldset id='betInfo' class='round'>
<legend>Create a Bet!</legend>
<select id='betType' name='betType'></select><br />
<div>Available Bank: <span id='avail2'></span></div>
<div id='betName'></div>
<div id='betDesc'></div>
<label id='betValLabel' for='betValue'>Bet Value</label>
<input id='betValue' name='betValue' type='number' onchange='updateSlider(this.value)' /><br />
<i onclick='decrement()' style='cursor: pointer; vertical-align: super;' class='icon-minus-sign-alt'></i>
<input id='betValSlide' name='betValue' type='range' min='0' max='10000' step='10' value='10' onchange='betValSlide(this.value)' />
<i onclick='increment()' style='cursor: pointer; vertical-align: super;' class='icon-plus-sign-alt'></i><br />
<label for='repeat'>Repeat Bet on Win?</label>
<input id='betRepeat' name='betRepeat' type='checkbox' />
<span id='origBet'></span>
<p>
<div id='create' unselectable='on' class='bttn blue' onclick='create()'>Create Bet!</div>
<div id='cancel' unselectable='on' class='bttn red' onclick='cancel()'>Close</div>
</p>
</fieldset>
</div>
<div id='betListBG' class='smallRound modalBG'>
<div id='betListWindow' class='modalWindow'>
<div id='playerArea'>
<div id='bank'>
<table>
<tr>
<th>Available Bank:</th>
<th>Money In Play:</th>
<th>Total Worth:</th>
</tr>
<tr>
<td><span id='availBank'></span></td>
<td><span id='inPlay'></span></td>
<td><span id='totBank'></span></td>
</tr>
</table>
</div>
</div>
<div id='betListing'></div>
</div>
<div id='closeBets' class='bttn red' onclick='closeBets()'>Close</div>
</div>
<div id='singleBetListBG' class='smallRound modalBG'>
<div id='singleBetListWindow' class='modalWindow'>
<div id='singleBetListing'></div>
</div>
<div id='closeSingle' class='bttn red' onclick='closeSingle()'>Close</div>
</div>
<div id='tutorialBG' class='modalBG smallRound tutorial'>
<div id='tutorialWindow' class='modalWindow'>
<p id='tutorialDescription'>Now I have stuff</p>
</div>
<div id='closeTutorial' class='bttn red' onclick='closeTutorial()'>Close Tutorial</div>
</div>
<div id='drawer' class='smallRound modalBG'>
<div id='drawerButtons'>
<div id='gameplayButton' class='tab active' onclick='clickModalButton("gameplay")'>Game Play</div>
<div id='rulesButton' class='tab' onclick='clickModalButton("rules")'>Bet Types</div>
<div id='settingsButton' class='tab' onclick='clickModalButton("settings")'>Settings</div>
<div id='tutorialButton' class='tab' onclick='clickModalButton("tutorial")'>Tutorial</div>
<div id='aboutButton' class='tab' onclick='clickModalButton("about")'>About</div>
</div>
<div id='drawerWindow' class='modalWindow'>
<div id='about' class='drawerWindow off'>
<h3>
About the Author
</h3>
<p>
Matt DuLeone<br />
<a href='mailto:[email protected]?subject=Craps%20HTML5%20Game' target="_blank">[email protected]</a><br />
github: <a href='https://github.com/mduleone/craps' target="_blank">https://github.com/mduleone/craps/</a><br />
facebook: <a href='https://www.facebook.com/CasinoCraps' target="_blank">https://www.facebook.com/CasinoCraps</a><br />
Linked In: <a href='http://www.linkedin.com/pub/matt-duleone/10/a65/123' target="_blank">http://www.linkedin.com/pub/matt-duleone/10/a65/123</a><br />
Version: 1.1.0
</p>
</div>
<div id='tutorial' class='drawerWindow'>
<!--p id='tutorialStartDescription'></p -->
<p>
This tutorial will teach you how to place a Pass Line bet, as well as a Pass Line Odds bet and walk you through a Pass Line bet sequence.<br /><br />
The Pass Line bet is the traditional/standard bet in Craps, and the one that most people think of when they think of Craps.<br /><br />
While you are completing the tutorial, this window will describe what is happening, but you can close this window with the 'Close' button below to see your bets. To open this window again, click the 'Tutorial' button.<br /><br />
Starting the tutorial will remove all your bets and reset the game.<br /><br />
To start the tutorial, click 'Start Tutorial'.
</p>
<div id='startTutorial' class='bttn yellow' onclick='startTutorial()'>Start Tutorial</div>
<!--div id='closeTutorial' class='bttn red' onclick='closeTutorial()'>Close Tutorial</div -->
</div>
<div id='settings' class='drawerWindow'>
<label for='startingBank'>Starting Bank: </label>
<input id='startingBank' type='number' size="10"><br /><br />
<label for='settingsName'>Your Name: </label>
<input id='settingsName' type='text' size="10" placeholder="Set your name!"><br /><br />
<center>Timing Settings (ms)<br />To turn animation off and remove the delay, try 0</center><br />
<label for='modalTiming'>Modal Fade Out: </label>
<input id='modalTiming' type='number' placeholder="0" size="10"><br /><br />
<label for='betFormTiming'>Bet Form Slide: </label>
<input id='betFormTiming' type='number' placeholder="0" size="10"><br /><br />
<label for='diceTiming'>Dice Roll: </label>
<input id='diceTiming' type='number' placeholder="1000" size="10"><br /><br />
<center>
<label for='colorScheme'>Color Scheme: </label>
<select id='colorScheme' onchange='updateColors()'>
<option value = "0">Standard Board</option>
<option value = "1">Red Board</option>
<option value = "2">Blue Board</option>
<option value = "3">Purple Board</option>
<option value = "4">Charcoal Board</option>
<option value = "5">Customize Your Own Scheme!</option>
</select>
</center><br />
<div id='customColors'>
<label for='boardColor'>Board: #</label><input id='boardColor' class='color' size="10"><br /><br />
<label for='border'>Board Border: #</label><input id='border' class='color' size="10"><br /><br />
<label for='lines'>Lines: #</label><input id='lines' class='color' size="10"><br /><br />
<label for='specialText'>Special 1: #</label><input id='specialText' class='color' size="10"><br /><br />
<label for='finalText'>Special 2: #</label><input id='finalText' class='color' size="10"><br /><br />
<label for='dice'>Dice: #</label><input id='dice' class='color' size="10"><br /><br />
<label for='dicePips'>Dice Pips: #</label><input id='dicePips' class='color' size="10"><br /><br />
<label for='text'>Text: #</label><input id='text' class='color' size="10"><br /><br />
<label for='pointBorder'>Point Border: #</label><input id='pointBorder' class='color' size="10"><br /><br />
<label for='pointOff'>Point Off: #</label><input id='pointOff' class='color' size="10"><br /><br />
<label for='pointOn'>Point On: #</label><input id='pointOn' class='color' size="10"><br /><br />
<label for='buttonText'>Point Text: #</label><input id='buttonText' class='color' size="10"><br /><br />
<label for='betFill'>Bet Fill: #</label><input id='betFill' class='color' size="10"><br /><br />
<label for='betBorder'>Bet Border: #</label><input id='betBorder' class='color' size="10"><br /><br />
<div id='apply' class='bttn yellow' onclick='saveSettings()'>Apply</div>
<div id='resetColors' class='bttn yellow' onclick='resetColors()'>Reset Custom Colors</div>
</div>
</div>
<div id='rules' class='drawerWindow'>
<div id='rulesButtons'>
<div id='standardButton' class='insideTab active' onclick='clickRulesButton("standard")'>Standard</div>
<div id='multiButton' class='insideTab' onclick='clickRulesButton("multi")'>Multi-Roll</div>
<div id='singleButton' class='insideTab' onclick='clickRulesButton("single")'>Single-Roll</div>
<div id='fireButton' class='insideTab' onclick='clickRulesButton("fire")'>Fire</div>
</div>
<div id='rulesWindow'>
<div id='standard'>
<ul>
<li>
Passline<br />
You may only place when the point is Off. If you have a Passline Bet on and a point gets set, you may not remove it.<br />
When the point is off:
<ul>
<li>7 & 11 win 1 to 1</li>
<li>2 & 3 lose</li>
<li>12 pushes</li>
<li>Anything else sets a point</li>
</ul>
When the point is on:
<ul>
<li>The point wins 1 to 1</li>
<li>7 loses</li>
<li>Anything else, roll again</li>
</ul>
</li>
<li>
Don't Pass<br />
You may only place when the point is Off. If you have a Don't Pass Bet on and a point gets set, you may not remove it.<br />
When the point is off:
<ul>
<li>7 & 11 lose</li>
<li>2 & 3 win 1 to 1</li>
<li>12 pushes</li>
<li>Anything else sets a point</li>
</ul>
When the point is on:
<ul>
<li>The point loses</li>
<li>7 wins 1 to 1</li>
<li>Anything else, roll again</li>
</ul>
</li>
<li>
Come<br />
A Passline bet, but on its own point cycle. You may place it whenever.
</li>
<li>
Don't Come<br />
A Don't Pass bet, but on its own point cycle. You may place it whenever.
</li>
<li>
Odds<br />
You may only place when you have a bet of the corresponding type on the table (Pass Line/Don't Pass Line/Come/Don't Come), and the bet has a point on.<br />
Same winning conditions as the associated bet.<br />
Payout:<br />Point 4, 10: 1 pays 2<br />Point 5, 9: 2 pays 3 <br />Point 6, 8: 5 pays 6
</li>
</ul>
</div>
<div id='multi'>
You may place these whenever. Usually off when the point is off.
<ul>
<li>
Place Bets<br />
<ul>
<li>The place number wins</li>
<li>7 loses</li>
<li>Anything else pushes</li>
</ul>
</li>
<li>
Hardways Bets<br />
<ul>
<li>Hardways (doubles) wins</li>
<li>Easy loses</li>
<li>7 loses</li>
<li>Anything else pushes</li>
</ul>
</li>
<li>
Big 6/8<br />
<ul>
<li>6 or 8 wins</li>
<li>7 loses</li>
<li>Anything else pushes</li>
</ul>
</li>
</ul>
</div>
<div id='single'>
You may place these whenever. Usually off when the point is off.<br /><br />
See the individual bet for the win conditions.
</div>
<div id='fire'>
A Fire Bet may only be placed during the initial Come out roll, when there is no point established, and no fire markers on the table.<br /><br />
A Fire bet pays out only when four or more unique points are made before a Seven-Out.<br /><br />
$10 maximum bet<br />
Payout:<br />4 points in a row: 1 pays 24<br />5 points in a row: 1 pays 249<br />6 points in a row: 1 pays 999
</div>
</div>
</div>
<div id='gameplay' class='drawerWindow'>
<ul>
<li>To read about the different bets, check out the "Bets" tab.</li>
<li>To roll, press the dice on the table.</li>
<li>To place a bet, press the area of the board you want to place a bet.
<ul>
<li>Once you are satisfied with the bet, press "Create Bet!".</li>
<li>If you decide you don't want to create the bet, press "Cancel".</li>
<li>To place a Passline/Don't Pass odds bet, press the Passline/Don't Pass<br />area when there is a point on.</li>
</ul>
</li>
<li>To change a bet's amount, open the bet or bet list, and press the amount.</li>
<li>To reset your game and bankroll, press the "Reset Game" button.</li>
</li>
</ul>
<u>Bet List Key:</u>
<table>
<tr>
<th>Heading</th>
<th>Meaning</td>
</tr>
<tr>
<td class='imageKey'><img src='img/bet-type.png'></td>
<td class='keyText'>Bet Type</td>
</tr>
<tr>
<td class='imageKey'><i class='icon-money icon-large' style='color:#000' /></td>
<td class='keyText'>Bet Amount</td>
</tr>
<tr>
<td class='imageKey'><i class='icon-off icon-large' style='color:#000' /></td>
<td class='keyText'>Bet On?</td>
</tr>
<tr>
<td class='imageKey'><i class='icon-repeat icon-large' style='color:#000' /></td>
<td class='keyText'>Repeat Bet on Win?</td>
</tr>
<tr>
<td class='imageKey'><i class='icon-exclamation icon-large' style='color:#000' /></td>
<td class='keyText'>Bet Point</td>
</tr>
<tr>
<td class='imageKey'><i class='icon-eraser icon-large' style='color:#f00' /></td>
<td class='keyText'>Clear All Bets</td>
</tr>
</table>
</div>
</div>
<div id='closeDrawer' class='bttn red' onclick='closeModal()'>Close</div>
</div>
<div id='glossary' class='modalBG smallRound glossary'>
<span id='glossaryTerm' style='display:block'></span>
<span id='glossaryDefinition' style='display:block'></span>
</div>
<div id='glossaryScreen' onclick="closeGlossary()" class='modalScreen'></div>
<div id='betResultsBG' class='smallRound' class='modalBG'>
<div id='betResultsWindow' class='modalWindow'>
<div id='lastRoll'>
Your last roll was <span id='die1'></span> <span id='die2'></span>
</div>
<div id='winningBets'>
<div id='wins'>
</div>
</div>
<div id='losingBets'>
<div id='losses'>
</div>
</div>
</div>
<div id='closeBetResults' class='bttn red' onclick='closeBetResults()'>Close</div>
</div>
</body>
<footer>
<script src="js/jquery.min.js" lang='javascript' type='text/javascript'></script>
<script src="js/jquery.color.js" lang='javascript' type='text/javascript'></script>
<script src='js/jscolor.js' lang='javascript' type='text/javascript'></script>
<script type='text/javascript' language='javascript' src='js/utils.js'></script>
<script type='text/javascript' language='javascript' src='js/html5slider.js'></script>
<script type='text/javascript' language='javascript' src='js/dice.js'></script>
<script type='text/javascript' language='javascript' src='js/crapsDice.js'></script>
<script type='text/javascript' language='javascript' src='js/bets.js'></script>
<script type='text/javascript' language='javascript' src='js/crapsBets.js'></script>
<script type='text/javascript' language='javascript' src='js/players.js'></script>
<script type='text/javascript' language='javascript' src='js/crapsPlayers.js'></script>
<script type='text/javascript' language='javascript' src='js/craps.js'></script>
<script type='text/javascript' language='javascript' src='js/board.js'></script>
<script type='text/javascript' language='javascript' src='js/modal.js'></script>
<script type='text/javascript' language='javascript' src='js/betForm.js'></script>
<script type='text/javascript' language='javascript'>
function draw(Board) {
//console.log('drawing');
var canvas = document.getElementById("board");
var board;
if(colors){
var pips = colors['dicePips'];
}
colors = $.extend({}, getColors($('#colorScheme').val()));
if(pips){
colors['dicePips'] = pips;
}
for(i in colors){
if(colors[i].slice(0,1) != "#"){
colors[i] = '#' + colors[i];
}
}
$('body').css('backgroundColor',colors['board']);
board = new Board(canvas, colors);
board.draw();
canvas.onclick = function(e) {
//console.log('(x = ' + ((e.clientX - board.canvas.offsetLeft)/ board.canvas.clientWidth) * 2000 + ',','y = ' + ((e.clientY - board.canvas.offsetTop)/ board.canvas.clientHeight) * 1000 + ')');
boardArea = board.processClick(e.clientX - canvas.offsetLeft, e.clientY - canvas.offsetTop);
if(boardArea){
if(boardArea.name == "Dice"){
if(GameState.tutorial){
if((GameState.tutorialState == 0 && _CRAPS.dealer.betManager.bets.length == 0) ||
(GameState.tutorialState == 3 && _CRAPS.dealer.betManager.bets.length == 1) ||
GameState.tutorialState == 7){
return;
}
}
roll();
return;
}
if(boardArea.name == "Reset"){
if(GameState.tutorial){
return;
}
if(_CRAPS.dealer.betManager.bets.length > 0){
if(!confirm("You have bets on the table. Are you sure you want to reset?")){
return;
}
}
var bets = _CRAPS.dealer.betManager.bets;
for(bet in bets){
_CRAPS.dealer.betManager.removeBet(bets[bet].bet.betId);
}
_CRAPS.dealer.betManager.displayBets();
GameState.point = null;
for(i in GameState.fireArray){
GameState.fireArray[i] = false;
}
nextBetId = 1;
PlayerManager.players[0].player.bank = initBank;
PlayerManager.updatePlayerArea();
$('#buffer').empty();
draw(Board);
return;
}
if(boardArea.name == "Menu"){
if(GameState.tutorial){
return;
}
openModal();
return;
}
if(boardArea.name == "Show Bets"){
openBets()
return;
}
if(boardArea.name == "Last Roll"){
openBetResults();
return;
}
clickAreaPlaceBet(boardArea);
}
};
}
var getColors = function (val){
switch(val){
case '0':
return colors0;
break;
case '1':
return colors1;
break;
case '2':
return colors2;
break;
case '3':
return colors3;
break;
case '4':
return colors4;
break;
case '5':
return colors5;
break;
default:
return 'you fail';
}
}
var savePoint;
var saveBets;
var saveFireArray;
var saveDice;
var name;
var bank;
var initBank;
var MODAL_FADE_INTERVAL;
var BET_FORM_FADE_OUT;
var DICE_ROLL;
if(localStorage["initBank"]){
initBank = parseInt(localStorage["initBank"]);
} else {
initBank = 10000;
}
if(localStorage['point']){
if(localStorage['point'] == "null"){
GameState.point = null;
} else {
GameState.point = parseInt(localStorage['point']);
}
}
if(localStorage['fireArray']){
GameState.fireArray = JSON.parse(localStorage['fireArray']);
}
if(localStorage['colors']){
$('#colorScheme').val(localStorage['colors']);
}
if(localStorage["modalTiming"]){
MODAL_FADE_INTERVAL = parseInt(localStorage["modalTiming"]);
} else {
MODAL_FADE_INTERVAL = 500;
}
if(localStorage["betFormTiming"]){
BET_FORM_FADE_OUT = parseInt(localStorage["betFormTiming"]);
} else {
BET_FORM_FADE_OUT = 500;
}
if(localStorage["diceTiming"]){
DICE_ROLL = parseInt(localStorage["diceTiming"]);
} else {
DICE_ROLL = 1000;
}
if(localStorage['colors5']){
colors5 = JSON.parse(localStorage['colors5']);
}
$('#modalTiming').val(MODAL_FADE_INTERVAL);
$('#betFormTiming').val(BET_FORM_FADE_OUT);
$('#diceTiming').val(DICE_ROLL);
$('#startingBank').val(initBank);
if(window.location.hash != ""){
var crapsInfo = parseHash(window.location.hash);
window.location.hash = "";
makeCrapsPlayer(crapsInfo[0].slice(3), crapsInfo[1]);
} else {
if(localStorage["name"]){
name = localStorage["name"];
} else {
name = "Set your name!";
}
if(localStorage["bank"]){
bank = parseInt(localStorage["bank"]);
} else {
bank = initBank;
}
}
makeCrapsPlayer(name, bank);
//var drawer = setInterval(function(){draw(Board);}, 200);
draw(Board);
$('div').click(function(){
draw(Board);
});
//draw(Board);
if(localStorage['bet0']){
var betNum = 0;
while(localStorage['bet' + betNum]){
var bet = JSON.parse(localStorage['bet' + betNum]);
_CRAPS.dealer.betManager.bets.push(bet);
betNum++;
}
nextBetId = _CRAPS.dealer.betManager.bets[_CRAPS.dealer.betManager.bets.length - 1].bet.betId + 1;
}
function saveGameState(){
//prompt("Copy URL to take game to another device!", "http://duleone.com/craps/#!/" + encodeURIComponent(PlayerManager.players[0].player.name) + '/' + (PlayerManager.players[0].player.bank).toString(36));
prompt("Copy URL to take game to another device!\nAll bets on the table and Fire Bet progress will be lost!", "http://duleone.com/craps/" + "#!/" + encodeURIComponent(PlayerManager.players[0].player.name) + '/' + (PlayerManager.players[0].player.bank).toString(36));
//window.location.hash = '!/' + encodeURIComponent(PlayerManager.players[0].player.name) + '/' + (PlayerManager.players[0].player.bank).toString(36);
}
function parseHash(str){
var retArray = [];
var name = decodeURIComponent(str.slice(0, str.lastIndexOf('/')));
retArray.push(name);
retArray.push(parseInt(str.slice(str.lastIndexOf('/') + 1), 36));
return retArray;
}
var p = PlayerManager.players[0];
PlayerManager.updatePlayerArea();
var BET_FADE_INTERVAL = 2000;
function roll(){
if(roller != null){
return;
}
_CRAPS.roll();
localStorage['point'] = GameState.point;
localStorage['fireArray'] = JSON.stringify(GameState.fireArray);
//draw(Board);
//$('#pointWindow').html('Point: ' + ((GameState.point>0)?GameState.point:'None'));
var animateTimeout = setTimeout(
function(){
_CRAPS.dealer.betManager.displayBets();
PlayerManager.updatePlayerArea();
draw(Board);
}, (DICE_ROLL + 100));
}
function reset(){
var _bets = _CRAPS.dealer.betManager.bets
if(GameState.tutorial && GameState.tutorialState > -1){
alert("You cannot take down a Tutorial bet.");
return;
}
for(x in _bets){
if(GameState.tutorial){
_CRAPS.dealer.betManager.removeBet(_bets[x].bet.betId);
continue;
}else if(_bets[x].type == 'passline'){
if(GameState.point > 0){
continue;
}else{
_CRAPS.dealer.betManager.removeBet(_bets[x].bet.betId);
}
}else if(_bets[x].type == 'come'){
if(_bets[x].point > 0){
continue;
}else{
_CRAPS.dealer.betManager.removeBet(_bets[x].bet.betId);
}
}
_CRAPS.dealer.betManager.removeBet(_bets[x].bet.betId);
}
}
(function() {
$('#rules').hide();
$('#settings').hide();
$('#tutorial').hide();
$('#about').hide();
//$('#betResultsWindow').height($('#betResultsBG').height() - 35);
$('#betValue').attr('value', '100');
$('#betValue').css({width: '50px'});
$('#betForm').css({left: ($('#board').offset().left + $('#board').width() + 2)});
resizeDrawer();
$('#settingsName').val(PlayerManager.players[0].player.name);
$('#settingsName').change(function(){
PlayerManager.players[0].player.changeName($('#settingsName').val());
PlayerManager.updatePlayerArea();
});
PlayerManager.updatePlayerArea();
_CRAPS.dealer.betManager.displayBets();
_CRAPS.dealer.betManager.animateBets();
})();
$(window).resize(function(){
PlayerManager.updatePlayerArea();
});
function prettyToName(betType){
switch(betType){
case "Pass Line":
return 'passline';
break;
case "Pass Line Odds":
return 'passlineOdds';
break;
case "Don't Pass":
return 'dontPass';
break;
case "Don't Pass Odds":
return 'dontPassOdds';
break;
case "Come":
return 'come';
break;
case "Come Odds":
case "ComeOdds4":
case "ComeOdds5":
case "ComeOdds6":
case "ComeOdds8":
case "ComeOdds9":
case "ComeOdds10":
return 'comeOdds';
break;
case "Don't Come":
return 'dontCome';
break;
case "Don't Come Odds":
case "DontComeOdds4":
case "DontComeOdds5":
case "DontComeOdds6":
case "DontComeOdds8":
case "DontComeOdds9":
case "DontComeOdds10":
return 'dontComeOdds';
break;
case "Place 4":
return 'place4';
break;
case "Place 5":
return 'place5';
break;
case "Place 6":
return 'place6';
break;
case "Place 8":
return 'place8';
break;
case "Place 9":
return 'place9';
break;
case "Place 10":
return 'place10';
break;
case "Big 6":
return 'big6';
break;
case "Big 8":
return 'big8';
break;
case "Field":
return 'field';
break;
case "C and E":
return 'cAndE';
break;
case "Seven":
return 'any7';
break;
case "Hard 4":
return 'hard4';
break;
case "Hard 6":
return 'hard6';
break;
case "Hard 8":
return 'hard8';
break;
case "Hard 10":
return 'hard10';
break;
case "Ace Two":
return 'aceTwo';
break;
case "Snake Eyes":
return 'snakeEyes';
break;
case "Midnight":
return 'midnight';
break;
case "Yo-leven":
return 'yoleven';
break;
case "Craps":
return 'anyCraps';
break;
case "Horn":
return 'horn';
break;
case "World":
return 'world';
break;
case "Fire":
return 'fire';
break;
default:
return;
}
}
function nameToPretty(betType){
switch(betType){
case 'passline':
return "Pass Line";
break;
case 'passlineOdds':
return "Pass Line Odds";
break;
case 'dontPass':
return "Don't Pass";
break;
case 'dontPassOdds':
return "Don't Pass Odds";
break;
case 'come':
return "Come";
break;
case 'comeOdds':
return "Come Odds";
break;
case 'dontCome':
return "Don't Come";
break;
case 'dontComeOdds':
return "Don't Come Odds";
break;
case 'place4':
return "Place 4";
break;
case 'place5':
return "Place 5";
break;
case 'place6':
return "Place 6";
break;
case 'place8':
return "Place 8";
break;
case 'place9':
return "Place 9";
break;
case 'place10':
return "Place 10";
break;
case 'big6':
return "Big 6";
break;
case 'big8':
return "Big 8";
break;
case 'field':
return "Field";
break;
case 'cAndE':
return "C and E";
break;
case 'any7':
return "Seven";
break;
case 'hard4':
return "Hard 4";
break;
case 'hard6':
return "Hard 6";
break;
case 'hard8':
return "Hard 8";
break;
case 'hard10':
return "Hard 10";
break;
case 'aceTwo':
return "Ace Two";
break;
case 'snakeEyes':
return "Snake Eyes";
break;
case 'midnight':
return "Midnight";
break;
case 'yoleven':
return "Yo-leven";
break;
case 'anyCraps':
return "Craps";
break;
case 'horn':
return "Horn";
break;
case 'world':
return "World"
break;
case 'fire':
return "Fire";
break;
default:
return;
}
}
</script>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-41114215-1', 'duleone.com');
ga('send', 'pageview');
</script>
</footer>
</html>