-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathtrollspeak.lic
145 lines (135 loc) · 3.28 KB
/
trollspeak.lic
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
=begin
Talk like a troll
;trollspeak <say|think|chat|psinet|echo|fam|familiar> <something>
author: Tillmen ([email protected])
game: Gemstone
tags: speech
version: 0.1
=end
def to_troll(common)
sub_list = {
'a' => [ 'ar', 'ra' ],
'b' => 'br',
'c' => '',
'd' => 'd',
'e' => "'",
'f' => 'f',
'g' => [ 'g', 'gr' ],
'h' => 'gh',
'i' => [ 'ir', 'ri' ],
'j' => 'j',
'k' => [ "r'k", 'kr', 'k' ],
'l' => [ 'lar', 'lor', 'lur' ],
'm' => [ 'mr', 'mor', 'mri' ],
'n' => 'n',
'o' => 'o',
'p' => [ "r'p", 'pr' ],
'q' => '',
'r' => [ "r'r", 'r', ],
's' => [ 'sr', "r's", 's' ],
't' => 't',
'u' => [ 'ru', 'ghu' ],
'v' => [ 'vr', "r'v" ],
'w' => [ 'wr', "r'w", 'w' ],
'x' => '',
'y' => '',
'z' => 'z'
}
=begin
troll = ''
for char in common.split('')
if sub_list[char].class.to_s == 'String'
troll = sub_list[char] + troll
elsif sub_list[char].class.to_s == 'Array'
troll = sub_list[char][rand(sub_list[char].length)] + troll
else
troll = char + troll
end
end
=end
troll = String.new
skip = false
skip_word = String.new
for char in common.split('')
if skip
if char =~ /^[A-Za-z]$/
skip_word += char
else
troll = char + skip_word + troll
skip = false
skip_word = String.new
end
else
if sub_list[char].class.to_s == 'String'
troll = sub_list[char] + troll
elsif sub_list[char].class.to_s == 'Array'
troll = sub_list[char][rand(sub_list[char].length)] + troll
elsif char == '\\'
skip = true
else
troll = char + troll
end
end
end
troll = skip_word + troll if skip
num_j = 0
fixed_troll = ''
for char in troll.split('')
if char == 'j'
num_j = num_j + 1
elsif char == ' '
num_j.times {
fixed_troll = fixed_troll + 'j'
}
num_j = 0
fixed_troll = fixed_troll + ' '
else
fixed_troll = fixed_troll + char
end
end
num_j.times {
fixed_troll = fixed_troll + 'j'
}
first_char = fixed_troll.split('')[0]
if [ '.', '!', '?' ].include?(first_char)
fixed_troll = fixed_troll.reverse.chop.reverse + first_char
end
fixed_troll.gsub!(' .', '. ')
fixed_troll.gsub!(' ,', ', ')
fixed_troll.gsub!(' ?', '? ')
fixed_troll.gsub!(' !', '! ')
fixed_troll.capitalize!
return fixed_troll
end
if script.vars[2] and [ 'say', 'think', 'chat', 'psinet', 'echo', 'familiar', 'fam', 'test' ].include?(script.vars[1])
common = script.vars[2..-1].join(' ').downcase
if script.vars[1] == 'say'
say_cmd = 'say'
script.vars.delete_at(0)
script.vars.delete_at(0)
while script.vars[0] =~ /^(\:|\]|~|=)/
say_cmd = say_cmd + ' ' + script.vars[0]
script.vars.delete_at(0)
end
common = script.vars.join(' ').downcase
put say_cmd + ' ' + to_troll(common)
elsif script.vars[1] == 'think'
put 'think ' + to_troll(common)
elsif script.vars[1] == 'chat'
echo_off
unique_send_to_script 'lnet', "chat #{to_troll(common)}"
echo_on
elsif script.vars[1] == 'psinet'
put 'chat ' + to_troll(common)
elsif (script.vars[1] == 'familiar') or (script.vars[1] == 'fam')
put 'tell familiar to say ' + to_troll(common)
elsif script.vars[1] == 'echo'
echo to_troll(common)
elsif script.vars[1] == 'test'
send_to_script 'trollhear', '"' + to_troll(common) + '"'
end
else
respond
respond 'Usage: ;trollspeak <say|think|chat|psinet|echo|fam|familiar> <something>'
respond
end