1use strict;
2use vars qw($VERSION %IRSSI);
3
4use Irssi;
5$VERSION = '0.3';
6%IRSSI = (
7	authors     => 'Mankeli',
8	contact     => 'mankeli@einari.org',
9	name        => '#pelix Helpers',
10	description => 'This script allows you flood shit.',
11	license     => 'GNU/GPL',
12);
13
14# INSTRUCTIONS:
15# /pelix [cmd] [length]
16#
17# cmds are: wtf, biy0, sepi, jupe and veez
18# (sepi cmd is experimental and should be handled with extreme care)
19
20# VERSION HISTORY:
21# 0.1 		wtf
22# 0.1.5		biy0
23# 0.1.6		sepi
24# 0.2		jupe
25# 0.3		veez
26
27# biy0 script ripped from palomies mirc-script copyright(c) 2003 veezay/palomies.com(r) all rights reserved, used with permission.
28
29sub pelix_biyo
30{
31	my ($pituus) = @_;
32	my $temppi;
33	my $koht;
34	my $tod;
35	my $eka;
36	my $wanha;
37
38	$tod = int(rand(2));
39	if ($tod eq 0)
40	{
41		$koht = int(rand(6));
42		if ($koht eq 0) { $temppi = ":"; }
43		if ($koht eq 1) { $temppi = "."; }
44		if ($koht eq 2) { $temppi = "D"; }
45		if ($koht eq 3) { $temppi = "d"; }
46		if ($koht eq 4) { $temppi = ";"; }
47		if ($koht eq 5) { $temppi = ","; }
48	}
49	else
50	{
51		$temppi = ":";
52	}
53	$wanha = -1;
54	for ($koht=0; $koht<$pituus; $koht++)
55	{
56		$eka = int(rand(10));
57		if (($eka == 0) && ($wanha != 0)) { $temppi.=":"; }
58		if (($eka == 1) && ($wanha != 1)) { $temppi.="."; }
59		if (($eka == 2) && ($wanha != 2)) { $temppi.="d"; }
60		if (($eka == 3) && ($wanha != 3)) { $temppi.=";"; }
61		if (($eka == 4) && ($wanha != 4)) { $temppi.=","; }
62		if (($eka == 5) && ($wanha != 5)) { $temppi.=":"; }
63		if (($eka > 5) && ($eka <= 7) && ($wanha != $eka)) { $temppi.="D"; }
64		if (($eka == 9) && ($eka != $wanha)) { $temppi.="_"; }
65	}
66	return ($temppi);
67}
68
69sub pelix_wtf
70{
71	my ($pituus) = @_;
72	my $temppi;
73	my $koht;
74	$temppi = "";
75#	srand();
76	for ($koht=0; $koht<$pituus; $koht++)
77	{
78		if (int(rand(2)) eq 0)
79		{
80			$temppi.=";D ";
81		}
82		else
83		{
84			$temppi.="? ";
85		}
86	}
87	return($temppi);
88}
89
90sub pelix_jupe
91{
92        my ($pituus) = @_;
93        my $temppi;
94        my $koht;
95	my $luku;
96        $temppi = "";
97#       srand();
98        for ($koht=0; $koht<$pituus; $koht++)
99        {
100		$luku = int(rand(7));
101                if ($luku < 3)
102                {
103                        $temppi.=":P";
104                }
105		elsif($luku == 3)
106		{
107			$temppi.=";PP;"
108		}
109                else
110                {
111                        $temppi.="?";
112                }
113
114		if (int(rand(4)) < 3)
115		{
116			$temppi.=" ";
117		}
118        }
119        return($temppi);
120}
121
122sub pelix_veez
123{
124	my ($pituus) = @_;
125	my $temppi;
126	my $koht;
127	$temppi = "";
128	for ($koht=0; $koht<$pituus; $koht++)
129	{
130		if (int(rand(2)) eq 0)
131		{
132			$temppi.=";";
133		}
134		else
135		{
136			$temppi.=")";
137		}
138	}
139	return($temppi);
140
141}
142
143
144sub sepinsqd_smile
145{
146	my ($pituus) = @_;
147	my $temppi;
148	my $koht;
149	my $arvo;
150
151	$temppi = "";
152	for ($koht=0; $koht<$pituus; $koht++)
153	{
154		$arvo = int(rand(4));
155		if($arvo eq 0)
156		{
157			$temppi.="A";
158		}
159		elsif($arvo eq 1)
160		{
161			$temppi.="�";
162		}
163		else
164		{
165			$temppi.=";";
166		}
167	}
168	return($temppi);
169}
170
171sub pelix
172{
173	my @teksti;
174#     @version = $finger =~ /:\s*(\S+)\s*$/gm;
175	my ($data, $server, $witem) = @_;
176	my @arg = split(/ +/, $data);
177	my $tpit;
178
179	$tpit = @arg[1];
180
181
182	if (@arg[0] eq "biy0")
183	{
184		@teksti = pelix_biyo($tpit);
185	}
186	elsif (@arg[0] eq "wtf")
187	{
188		@teksti = pelix_wtf($tpit);
189	}
190	elsif (@arg[0] eq "jupe")
191	{
192		@teksti = pelix_jupe($tpit);
193	}
194	elsif (@arg[0] eq "veez")
195	{
196		@teksti = pelix_veez($tpit);
197	}
198	elsif (@arg[0] eq "sepi")
199	{
200		@teksti = sepinsqd_smile($tpit);
201	}
202	elsif (@arg[0] eq "")
203	{
204		Irssi::print("no �gZ�n specified.");
205		return;
206	}
207	else
208	{
209		Irssi::print("No such �gZ�n as @arg[0].");
210		return;
211	}
212
213	if (!$server || !$server->{connected})
214	{
215		Irssi::print("Not connected to server");
216		return;
217	}
218
219	if ($witem && ($witem->{type} eq "CHANNEL" || $witem->{type} eq "QUERY"))
220	{
221		$witem->command("MSG ".$witem->{name}." @teksti");
222	}
223		else
224	{
225		Irssi::print("No active channel/query in window");
226	}
227}
228
229sub pelix_help
230{
231	Irssi::print("Usage: runQ");
232}
233
234Irssi::command_bind('pelix', 'pelix');
235Irssi::command_bind('help pelix','pelix_help');
236