· 10 years ago · Nov 03, 2015, 04:42 AM
1#hide_me
2
3require 'mail'
4
5#send_emails = 'no'
6send_emails = 'yes'
7
8options = { :address => "smtp.gmail.com",
9 :port => 587,
10 :domain => 'gmail.com',
11 :user_name => 'gemstoneruby.smtp',
12 :password => 'Rubygemstone123!#',
13 :authentication => 'plain',
14 :enable_starttls_auto => true }
15
16Mail.defaults do
17 delivery_method :smtp, options
18end
19
20dangertriggers = /(ignor|continu|\btyp(e[sd]?|ing)\b|hello|respond|reply|answer|speak|spoken|whisper|scream|\bSEND\b|aloud|talk|\bscript(s?|ing|ed)\b|smil|frown|snort|\byell\b|exclaim|announc|declar|voic|say|claim|boom|shout|this place|you there|squeak|spider|alert|cheer|nod|jump|wav|stop|attention|\bsilver[s]?\b|responsive|wrong|spider|monkey|mouse|\brat\b|frog|demand)/i
21
22## *** Set room numbers for your city if not listed here.
23rivers_rest_rooms = /10863|10911|10949|10992|10915|10863|10935|11002/
24fwi_rooms = /3672|16349|12306|16363|3654|3845|16470/
25landing_rooms = /XXXX/
26icemule_rooms = /XXXX/
27solhaven_rooms = /XXXX/
28tavaalor_rooms = /13930|13943|13938|10327|10379|10329|10325|10396|10364|10332/
29teras_rooms = /5906|3727|3483|1957|1851|1838|1885|1886|1932|12511|1957/
30
31always_ignore_rooms = /#{rivers_rest_rooms}|#{fwi_rooms}|#{landing_rooms}|#{icemule_rooms}|#{solhaven_rooms}|#{tavaalor_rooms}|#{teras_rooms}/
32
33## *** Insert any known script triggers here, these will ALWAYS fire.
34prior_script_triggers = /^A sudden fierce gust|gruff voice|SEND|^You are buffeted|tell me|please respond|fairy|whatcha doin[g]?|^You hear someone applauding|^Roundtime changed to|^The ground begins to shake violently, making it hard to|answer that voice|what is wrong|how many silvers/i
35
36## ** Need to update these with additional magic casting
37ignore_magic_lines = /^\w+ (gestures while|makes a nearly)/
38
39## ** These are going to be specific to the creature/areas. Some will pop the line when not needed.
40always_ignore_strings = /#{ignore_magic_lines}|^[A|An] \w+ centaur ranger (snorts|notices)|^A sleek red squirrel hops nervously|^A rat skitters accross the ground near your feet|^You hear the booming|^You (pick|put|remove|tap|gather|swap|open|carefully)|^Running your fingers|^\w+ says, "Ah, so you're from|^Mana:|^With a quick flick of|^A crier hurries|^He continues, "Those citizens holding|^A jungle troll chieftain shouts, "Ird t'sum|^ With a satisfied rumble, it stalks off|^A fire giant shouts out|^A wave of dark ethereal|^You are buffeted by the dark|^As you place/
41
42## *** These lines ignore whole blocks. The first is combat, more lines likely needed here.
43ignore_start_lines_30wait = /(^You leap|^You make [a|an]|^You attempt to punch)/
44ignore_end_lines_30wait = /^Roundtime:/
45
46## *** Short 1 second blocks to ignore.
47ignore_start_lines_1wait = /(^\[[A-Z][a-z]|^You search |^ Maximum|^In the|^You rummage|^You are wearing|^ Skill Name|^Peering into)/
48ignore_end_lines_1wait = /^Obvious|^Total|^Click|^Further information|^Roundtime:/
49
50
51if $frontend == 'stormfront'
52 fam_window_begin = "<pushStream id=\"familiar\" ifClosedStyle=\"watching\"/>"
53 fam_window_end = "<popStream/>\r\n"
54else
55 fam_window_begin = "\034GSe\r\n"
56 fam_window_end = "\034GSf\r\n"
57end
58
59while line = get
60
61 if line =~ prior_script_triggers
62 puts("#{fam_window_begin}#{line}\r\n#{fam_window_end}")
63 puts("#{fam_window_begin}Unrecognized game line.\r\n#{Time.at(Time.now).strftime("%B %e, %Y at %I:%M %p")}\n#{fam_window_end}")
64
65 if send_emails == 'yes'
66 Mail.new(
67 to: 'gemstoneruby.smtp@gmail.com',
68 from: 'gemstoneruby.smtp@gmail.com',
69 subject: 'Prior scriptcheck patterns detected.',
70 body: "#{line}\r\nUnrecognized game line.\r\n#{Time.at(Time.now).strftime("%B %e, %Y at %I:%M %p")}\n"
71 ).deliver!
72 end
73 end
74
75 if line =~ ignore_start_lines_30wait
76 echo "Bypassing - 30 Wait, #{$1}"
77 matchtimeout 30, ignore_end_lines_30wait
78 next
79 end
80
81 if line !~ /^\[Merchant|^\[Prime/ && line =~ ignore_start_lines_1wait
82 echo "Bypassing - 1 Wait, #{$1}"
83 matchtimeout 1, ignore_end_lines_1wait
84 next
85 end
86
87 next if Room.current.id.to_s =~ always_ignore_rooms
88 next if line =~ always_ignore_strings
89 next if line =~ /^\[.*?\]\-[A-z]+\:|^\[server\]\: "/
90
91 ### Checks for CAPITAL letters length 5 to 1000.
92 if line =~ /([A-Z]{5,100})/ and line !~ /^Your SIGN OF ([A-Z]+)/ and line !~ /\s*(Strength|Constitution|Dexterity|Agility|Discipline|Aura|Logic|Intuition|Wisdom|Influence)\s+\((STR|CON|DEX|AGI|DIS|AUR|LOG|INT|WIS|INF)\)\:\s+\d+\s+\(-?\d+\)\s+\.\.\.\s+\d+\s+\(-?\d+\)/
93 puts("#{fam_window_begin}#{line}\r\n#{fam_window_end}")
94 puts("#{fam_window_begin}Unrecognized game line.\r\n#{Time.at(Time.now).strftime("%B %e, %Y at %I:%M %p")}\n#{fam_window_end}")
95 if send_emails == 'yes'
96 Mail.new(
97 to: 'gemstoneruby.smtp@gmail.com',
98 from: 'gemstoneruby.smtp@gmail.com',
99 subject: 'Capital letters scriptcheck patterns detected.',
100 body: "#{line}\r\nUnrecognized game line.\r\n#{Time.at(Time.now).strftime("%B %e, %Y at %I:%M %p")}\n"
101 ).deliver!
102 end
103 end
104
105 if line =~ dangertriggers
106 puts("#{fam_window_begin}#{line}\r\n#{fam_window_end}")
107 puts("#{fam_window_begin}Unrecognized game line.\r\n#{Time.at(Time.now).strftime("%B %e, %Y at %I:%M %p")}\n#{fam_window_end}")
108 if send_emails == 'yes'
109 Mail.new(
110 to: 'gemstoneruby.smtp@gmail.com',
111 from: 'gemstoneruby.smtp@gmail.com',
112 subject: 'Danger triggers scriptcheck patterns detected.',
113 body: "#{line}\r\nUnrecognized game line.\r\n#{Time.at(Time.now).strftime("%B %e, %Y at %I:%M %p")}\n"
114 ).deliver!
115 end
116 end
117
118end