forked from elanthia-online/dr-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
common-validation.lic
52 lines (40 loc) · 1.55 KB
/
common-validation.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
# quiet
=begin
Documentation: https://elanthipedia.play.net/Lich_script_development#common-validation
=end
class CharacterValidator
def initialize(announce, sleep, greet, name)
waitrt?
fput('sleep') if sleep
@lnet = (Script.running + Script.hidden).find { |val| val.name == 'lnet' }
@validated_characters = []
@greet = greet
@name = name
@lnet.unique_buffer.push("chat #{@name} is up and running in room #{Room.current.id}! Whisper me 'help' for more details.") if announce
end
def send_slack_token(character)
message = "slack_token: #{UserVars.slack_token || 'Not Found'}"
echo "Attempting to DM #{character} with message: #{message}"
@lnet.unique_buffer.push("chat to #{character} #{message}")
end
def validate(character)
return if valid?(character)
echo "Attempting to validate: #{character}"
@lnet.unique_buffer.push("who #{character}")
end
def confirm(character)
return if valid?(character)
echo "Successfully validated: #{character}"
@validated_characters << character
return unless @greet
put "whisper #{character} Hi! I'm your friendly neighborhood #{@name}. Whisper me 'help' for more details. Don't worry, I've memorized your name so you won't see this message again."
end
def valid?(character)
@validated_characters.include?(character)
end
def send_bankbot_balance(character, balance)
message = "Current Balance: #{balance}"
echo "Attempting to DM #{character} with message: #{message}"
@lnet.unique_buffer.push("chat to #{character} #{message}")
end
end