commit | author | age
|
8bd4d9
|
1 |
<?php |
JK |
2 |
class lotto implements module { |
|
3 |
static function register_cmd() { |
|
4 |
return array( |
|
5 |
'lotto' => 'cmd_lotto', |
|
6 |
'lootto' => 'cmd_lotto', |
|
7 |
'lotek' => 'cmd_lotto', |
|
8 |
'wyniki' => 'cmd_lotto', |
|
9 |
'l' => 'cmd_lotto', |
|
10 |
'duzy' => 'cmd_lotto', |
869f97
|
11 |
'dl' => 'cmd_lotto', |
JK |
12 |
|
8bd4d9
|
13 |
'express' => 'cmd_lotto', |
JK |
14 |
'expres' => 'cmd_lotto', |
|
15 |
'ekspress' => 'cmd_lotto', |
|
16 |
'ekspress' => 'cmd_lotto', |
|
17 |
'exp' => 'cmd_lotto', |
869f97
|
18 |
'el' => 'cmd_lotto', |
JK |
19 |
'mini' => 'cmd_lotto', |
993fc0
|
20 |
|
JK |
21 |
'ekstra' => 'cmd_lotto', |
|
22 |
'extra' => 'cmd_lotto', |
|
23 |
'pensja' => 'cmd_lotto', |
|
24 |
'ep' => 'cmd_lotto', |
|
25 |
'ex' => 'cmd_lotto', |
869f97
|
26 |
|
8bd4d9
|
27 |
'multi' => 'cmd_lotto', |
JK |
28 |
'multimulti' => 'cmd_lotto', |
|
29 |
'multilotek' => 'cmd_lotto', |
869f97
|
30 |
'mm' => 'cmd_lotto', |
JK |
31 |
|
|
32 |
'ka' => 'cmd_lotto', |
|
33 |
'kaskada' => 'cmd_lotto', |
8bd4d9
|
34 |
); |
JK |
35 |
} |
|
36 |
|
|
37 |
static function help($cmd=NULL) { |
|
38 |
if($cmd === NULL) { |
|
39 |
GGapi::putRichText('lotto ', TRUE); |
|
40 |
GGapi::putRichText('[gra]', FALSE, TRUE); |
|
41 |
GGapi::putRichText("\n".' Wyniki gry liczbowej TS'."\n"); |
|
42 |
} |
|
43 |
else |
|
44 |
{ |
|
45 |
GGapi::putRichText('lotto ', TRUE); |
|
46 |
GGapi::putRichText('[gra]', FALSE, TRUE); |
|
47 |
GGapi::putRichText(' (alias: '); |
|
48 |
GGapi::putRichText('lotek, wyniki, l', TRUE); |
|
49 |
GGapi::putRichText(')'."\n".' Podaje wyniki ostatniego losowania gry Totalizatora Sportowego '); |
|
50 |
GGapi::putRichText('[gra]', FALSE, TRUE); |
993fc0
|
51 |
GGapi::putRichText(', gdzie gra to: lotto, mini (Mini Lotto), mm (Multi Multi), kaskada lub pensja (Ekstra Pensja).'); |
8bd4d9
|
52 |
} |
JK |
53 |
} |
|
54 |
|
|
55 |
static function cmd_lotto($name, $arg) { |
|
56 |
$skrot_nazwa = array( |
|
57 |
'dl' => 'Lotto', |
|
58 |
'dl2' => 'Lotto', |
|
59 |
'el' => 'Mini Lotto', |
|
60 |
'el2' => 'Mini Lotto', |
993fc0
|
61 |
'ep' => 'Ekstra Pensja', |
JK |
62 |
'ep2' => 'Ekstra Pensji', |
8bd4d9
|
63 |
'mm' => 'Multi Multi', |
JK |
64 |
'mm2' => 'Multi Multi', |
|
65 |
'mm14' => 'Multi Multi (14:00)', |
|
66 |
'mm142' => 'Multi Multi (14:00)', |
|
67 |
'mm22' => 'Multi Multi (22:00)', |
|
68 |
'mm222' => 'Multi Multi (22:00)', |
869f97
|
69 |
'ka' => 'Kaskada', |
JK |
70 |
'ka2' => 'Kaskady', |
8bd4d9
|
71 |
); |
JK |
72 |
$arg_start = array( |
|
73 |
'dl' => 'dl', 'duzego' => 'dl', 'duzy' => 'dl', 'duzylotek' => 'dl', |
993fc0
|
74 |
'el' => 'el', 'express' => 'el', 'ekspress' => 'el', 'expres' => 'el', 'ekspres' => 'el', 'minilotto' => 'el', 'm' => 'el', 'ml' => 'el', 'mlotto' => 'el', 'mini' => 'el', |
JK |
75 |
'ep' => 'ep', 'ekstra' => 'ep', 'pensja' => 'ep', 'extra' => 'ep', 'ekstrapensja' => 'ep', 'extrapensja' => 'ep', 'ex' => 'ep', |
869f97
|
76 |
'mm' => 'mm', 'multilotka' => 'mm', 'multi' => 'mm', 'multimulti' => 'mm', |
JK |
77 |
'ka' => 'ka', 'kaskada' => 'ka', 'k' => 'ka', |
8bd4d9
|
78 |
); |
JK |
79 |
$arg = explode(' ', funcs::utfToAscii($arg)); |
|
80 |
array_unshift($arg, $name); |
|
81 |
|
|
82 |
foreach($arg as $value) { |
|
83 |
if(empty($value)) |
|
84 |
continue; |
|
85 |
$value = trim($value, "\t\n\r .,:;'\""); |
|
86 |
if(isset($arg_start[$value])) { |
|
87 |
$gra = $arg_start[$value]; |
|
88 |
break; |
|
89 |
} |
|
90 |
} |
|
91 |
|
869f97
|
92 |
if(!isset($gra) || !$gra) { |
8bd4d9
|
93 |
$gra = 'dl'; |
JK |
94 |
} |
|
95 |
|
|
96 |
if($gra == 'mm') { |
|
97 |
$typy = array('14', '22'); |
|
98 |
} |
|
99 |
else { |
|
100 |
$typy = array(''); |
|
101 |
} |
|
102 |
|
|
103 |
$txt = ''; |
|
104 |
foreach($typy as $addon) { |
|
105 |
$dane = unserialize(file_get_contents('./data/lotto/'.$gra.$addon.'.txt')); |
|
106 |
$txt .= 'Losowanie '.$skrot_nazwa[$gra.'2'].''.($addon ? ' '.$addon.':00' : '').' z dnia '.$dane['data']."\n"; |
|
107 |
$gt = 1; |
|
108 |
if($gra == 'jk') { |
|
109 |
$txt .= $skrot_nazwa['jk'].': '.$dane[1]."\n".'Cztery liczby: '.$dane[2]; |
|
110 |
$gt = 2; |
|
111 |
} |
|
112 |
else |
|
113 |
{ |
|
114 |
$txt .= 'Liczby: '.$dane[1]; |
|
115 |
} |
|
116 |
|
|
117 |
foreach($dane as $i => $l) { |
|
118 |
if(is_numeric($i) && $i>$gt) { |
|
119 |
$txt .= ', '.$l; |
|
120 |
} |
|
121 |
} |
|
122 |
|
|
123 |
if($gra == 'ml' || $gra == 'mm') { |
|
124 |
$txt .= "\n".'Plus: '.$dane['plus']."\n\n"; |
|
125 |
} |
|
126 |
} |
|
127 |
|
|
128 |
GGapi::putText(trim($txt)); |
|
129 |
} |
|
130 |
} |
79d1cc
|
131 |
?> |