This file is indexed.

/usr/share/irssi/scripts/dice.pl is in irssi-scripts 20170711.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
# dice / A RP Dice Simulator
#
# What is this?
#
# I often Dungeon Master on our Neverwinternights Servers called "Bund der
# alten Reiche" (eng. "Alliance of the old realms") at bundderaltenreiche.de
# (German Site) Often idling in our Channel I thought it might be Fun to have 
# a script to dice. Since I found nothing for irssi I wrote this little piece
# of script. The script assumes, that if a 'd' for english dice is given it 
# should print the output in english. On the other hand if a 'w' for german 
# "Würfel" is given it prints the output in german. 
#
# Usage.
#
# Anyone on the Channel kann ask "!dice" to toss the dice for him. He just has
# to say what dice he want to use. The notation should be well known from
# RP :-) Thus
# 
# Write: !dice: <quantity of dice>d[or w for german users]<sides on dice>
#
# Here are some examples
# 
# !dice: 2d20
# !dice: 3d6
#
# OK, I think you got it already :-)
#
# Write: !dice version 
# For Version Information
#
# Write: !dice help
# For Information about how to use it

use strict;
use vars qw($VERSION %IRSSI);

use Irssi qw(command_bind signal_add);
use IO::File;
$VERSION = '0.00.04';
%IRSSI = (
	authors			=> 'Marcel Kossin',
	contact			=> 'mkossin@enumerator.org',
	name			=> 'dice',
	description		=> 'A Dice Simulator for Roleplaying in Channels or just for fun.',
	license			=> 'GNU GPL Version 2 or later',
	url			=> 'http://www.enumerator.org/component/option,com_docman/task,view_category/Itemid,34/subcat,7/'	
);

sub own_question {
	my ($server, $msg, $nick, $address, $target) = @_;
	question($server, $msg, $nick, $target);
}

sub public_question {
	my ($server, $msg, $nick, $address, $target) = @_;
	question($server, $msg, $nick, $target);
}

sub question($server, $msg, $nick, $target) {
	my ($server, $msg, $nick, $target) = @_;
	$_ = $msg;
	
	if (!/^!dice/i) { return 0; }

	if (/^!dice:.+[d|w]\d+/i) {
		my $value;
		my $rnd;
		my $forloop;
		my $sides;
		my $lang;
		my @dice  = split(/ /,$_,2);
		my @dices = split(/[d|w|D|W]/,$dice[1],2);
		if ($_ = /^.*[w|W].*/i) {
			$lang = "DE";
		} else {
			$lang = "EN";
		}					
		SWITCH: {
			if ($lang eq "DE") {
				$server->command('msg '.$target.' '.$nick.' würfelt mit dem '.$dice[1].'..... ');
				last SWITCH; 
			}
			if ($lang eq "EN") {
				$server->command('msg '.$target.' '.$nick.' tosses with the '.$dice[1].'..... ');
				last SWITCH; 
			}					
		}		
		if($dices[1] > 1) {
			if($dices[1] < 100) {			
				if($dices[0] < 11) {		
					if($dices[0] < 1) {
						$dices[0] = 1;
					}
					for($forloop = 1; $forloop <= $dices[0]; $forloop++) {
						$rnd = int(rand($dices[1]-1));
						if($rnd == 0){
							$rnd = $dices[1];
						}
						$value = $value + $rnd;
						SWITCH: {
							if ($lang eq "DE") {
								$server->command('msg '.$target.' '.$nick.' würfelt beim '.$forloop.'. Wurf eine '.$rnd);	
								last SWITCH; 
							}
							if ($lang eq "EN") {
								$server->command('msg '.$target.' '.$nick.' tosses at his '.$forloop.'. try  a '.$rnd);	
								last SWITCH; 
							}					
						}						
			   	}
					SWITCH: {
						if ($lang eq "DE") {
							$server->command('msg '.$target.' '.$nick.' ist fertig mit Würfeln. Sein Ergebnis lautet: '.$value);	
							last SWITCH; 
						}
						if ($lang eq "EN") {
							$server->command('msg '.$target.' '.$nick.' finished. His result reads: '.$value);	
							last SWITCH; 
						}					
					}						
				} else {
					SWITCH: {
						if ($lang eq "DE") {
							$server->command('msg '.$target.' '.$nick.' meint wohl in d'.$dices[1].'´s baden zu müssen... Mal im Ernst versuch es mit weniger Würfeln!' );	
							last SWITCH; 
						}
						if ($lang eq "EN") {
							$server->command('msg '.$target.' '.$nick.' seems to wanna take a bath in d'.$dices[1].'´s... Seriously! Try less dice' );	
							last SWITCH; 
						}					
					}					
				}
			} else {
				SWITCH: {
					if ($lang eq "DE") {
						$server->command('msg '.$target.' '.$nick.' baut uns bald einen riiiiiesigen d'.$dices[1].'... Mal im Ernst versuch es mit weniger Augen!' );	
						last SWITCH; 
					}
					if ($lang eq "EN") {
						$server->command('msg '.$target.' '.$nick.' soon will build us a biiiiiiiiiig d'.$dices[1].'... Seriously! Try less sides' );	
						last SWITCH; 
					}					
				}				
			}
		} else {
			if($dices[1] == "0") {
				SWITCH: {
					if ($lang eq "DE") {
						$server->command('msg '.$target.' '.$nick.' ist dumm wie Knäckebrot... Oder hat jemand schonmal einen Würfel ohne Seiten gesehen?' );	
						last SWITCH; 
					}
					if ($lang eq "EN") {
						$server->command('msg '.$target.' '.$nick.' is chuckleheaded... Or has anybody ever seen a dice without sides?' );	
						last SWITCH; 
					}					
				}				
			}
			if($dices[1] == "1") {		
				SWITCH: {
					if ($lang eq "DE") {
						$server->command('msg '.$target.' '.$nick.' ist dumm wie Dosenthunfisch... Oder hat jemand schonmal einen Würfel mit einer Seite gesehen?' );	
						last SWITCH; 
					}
					if ($lang eq "EN") {
						$server->command('msg '.$target.' '.$nick.' plays possum... Or has anybody ever seen a dice with only one side?' );	
						last SWITCH; 
					}					
				}				
			}				
		}		
		return 0;
	} elsif (/^!dice: version$/i){
		$server->command('msg '.$target.' dice Version: '.$VERSION.' by mkossin');
		return 0;
	} elsif (/^!dice: help$/i){
		$server->command('msg '.$target.' '.$nick.' Please explain which dice you want to toss: "!dice: <quantity of dice>d<sides on dice>" e. g. "!dice: 2d20"');
		return 0;
	} elsif (/^!dice: hilfe$/i){
		$server->command('msg '.$target.' '.$nick.' Sag mir welchen Würfel du werfen möchtest: "!dice: <Anzahl der Würfel>w<Augen des Würfels>" z. B. "!dice: 2w20"');
		return 0;						
	} else {
		if(!/^!dice.*:/i){ 
			$server->command('msg '.$target.' '.$nick.' "!dice: help"  - gives you the english help');
			$server->command('msg '.$target.' '.$nick.' "!dice: hilfe" - zeigt die Deutsche Hilfe an');
			return 0;
		}
	}
}

signal_add("message public", "public_question");
signal_add("message own_public", "own_question");