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 |
'ex' => 'cmd_lotto', |
JK |
19 |
'el' => 'cmd_lotto', |
|
20 |
'mini' => 'cmd_lotto', |
|
21 |
|
8bd4d9
|
22 |
'multi' => 'cmd_lotto', |
JK |
23 |
'multimulti' => 'cmd_lotto', |
|
24 |
'multilotek' => 'cmd_lotto', |
869f97
|
25 |
'mm' => 'cmd_lotto', |
JK |
26 |
|
|
27 |
'ka' => 'cmd_lotto', |
|
28 |
'kaskada' => 'cmd_lotto', |
|
29 |
|
8bd4d9
|
30 |
'twoj' => 'cmd_lotto', |
JK |
31 |
'tsn' => 'cmd_lotto', |
|
32 |
'jk' => 'cmd_lotto', |
|
33 |
'joker' => 'cmd_lotto', |
|
34 |
); |
|
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); |
869f97
|
51 |
GGapi::putRichText(', gdzie gra to: lotto, mini (Mini Lotto), mm (Multi Multi), kaskada lub joker.'); |
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', |
|
61 |
'mm' => 'Multi Multi', |
|
62 |
'mm2' => 'Multi Multi', |
|
63 |
'mm14' => 'Multi Multi (14:00)', |
|
64 |
'mm142' => 'Multi Multi (14:00)', |
|
65 |
'mm22' => 'Multi Multi (22:00)', |
|
66 |
'mm222' => 'Multi Multi (22:00)', |
|
67 |
'jk' => 'Joker', |
|
68 |
'jk2' => 'Jokera', |
869f97
|
69 |
'ka' => 'Kaskada', |
JK |
70 |
'ka2' => 'Kaskady', |
8bd4d9
|
71 |
); |
JK |
72 |
$arg_start = array( |
|
73 |
'dl' => 'dl', 'duzego' => 'dl', 'duzy' => 'dl', 'duzylotek' => 'dl', |
869f97
|
74 |
'el' => 'el', 'express' => 'el', 'ekspress' => 'el', 'expres' => 'el', 'ekspres' => 'el', 'ex' => 'el', 'minilotto' => 'el', 'm' => 'el', 'ml' => 'el', 'mlotto' => 'el', 'mini' => 'el', |
JK |
75 |
'mm' => 'mm', 'multilotka' => 'mm', 'multi' => 'mm', 'multimulti' => 'mm', |
|
76 |
'jk' => 'jk', 'joker' => 'jk', 'jokera' => 'jk', 'tsn' => 'jk', 'numerek' => 'jk', 'numerka' => 'jk', 'twojego' => 'jk', 'twoj' => 'jk', 'szczesliwego' => 'jk', 'szczesliwy' => '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 |
?> |