Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
S
srvpro
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
3
Merge Requests
3
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
srvpro
Commits
70c97420
Commit
70c97420
authored
Dec 21, 2016
by
mercury233
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
give spammers rag
parent
91c6c3ed
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
56 additions
and
1 deletion
+56
-1
config.json
config.json
+2
-1
ygopro-server.coffee
ygopro-server.coffee
+26
-0
ygopro-server.js
ygopro-server.js
+28
-0
No files found.
config.json
View file @
70c97420
...
...
@@ -115,7 +115,8 @@
"badword_level1"
:
[
"傻逼"
,
"鸡巴"
],
"badword_level2"
:
[
"死妈"
,
"草你妈"
],
"badword_level3"
:
[
"迷奸"
,
"仿真枪"
],
"illegal_id"
:
[
"^Lv.
\\
d+"
,
"^VIP.
\\
d+"
]
"illegal_id"
:
[
"^Lv
\\
.-*
\\
d+
\\
s*(.*)"
,
"^VIP
\\
.
\\
d+
\\
s*(.*)"
],
"spam_word"
:
[
"——"
]
},
"tip"
:
[
"欢迎来到本服务器"
,
...
...
ygopro-server.coffee
View file @
70c97420
...
...
@@ -825,6 +825,15 @@ ygopro.ctos_follow 'PLAYER_INFO', true, (buffer, info, client, server)->
# checkmate use username$password, but here don't
# so remove the password
name
=
info
.
name
.
split
(
"$"
)[
0
]
if
(
_
.
any
(
settings
.
ban
.
illegal_id
,
(
badid
)
->
regexp
=
new
RegExp
(
badid
,
'i'
)
matchs
=
name
.
match
(
regexp
)
if
matchs
name
=
matchs
[
1
]
return
true
return
false
,
name
))
client
.
rag
=
true
struct
=
ygopro
.
structs
[
"CTOS_PlayerInfo"
]
struct
.
_setBuff
(
buffer
)
struct
.
set
(
"name"
,
name
)
...
...
@@ -1418,6 +1427,23 @@ ygopro.ctos_follow 'CHAT', true, (buffer, info, client, server)->
else
client
.
abuse_count
=
client
.
abuse_count
+
4
ygopro
.
stoc_send_chat
(
client
,
"您的发言存在不适当的内容,发送失败!"
,
ygopro
.
constants
.
COLORS
.
RED
)
else
if
(
client
.
rag
and
room
.
started
)
client
.
rag
=
false
#ygopro.stoc_send_chat(client, "发言失败", ygopro.constants.COLORS.RED)
cancel
=
true
else
if
(
msg
.
length
>
100
)
log
.
warn
"SPAM WORD"
,
client
.
name
,
client
.
ip
,
oldmsg
client
.
abuse_count
=
client
.
abuse_count
+
2
ygopro
.
stoc_send_chat
(
client
,
"请不要发送垃圾信息!"
,
ygopro
.
constants
.
COLORS
.
RED
)
cancel
=
true
else
if
(
_
.
any
(
settings
.
ban
.
spam_word
,
(
badword
)
->
regexp
=
new
RegExp
(
badword
,
'i'
)
return
msg
.
match
(
regexp
)
,
msg
))
#log.warn "SPAM WORD", client.name, client.ip, oldmsg
client
.
abuse_count
=
client
.
abuse_count
+
2
ygopro
.
stoc_send_chat
(
client
,
"请不要发送垃圾信息!"
,
ygopro
.
constants
.
COLORS
.
RED
)
cancel
=
true
else
if
(
_
.
any
(
settings
.
ban
.
badword_level2
,
(
badword
)
->
regexp
=
new
RegExp
(
badword
,
'i'
)
return
msg
.
match
(
regexp
)
...
...
ygopro-server.js
View file @
70c97420
...
...
@@ -1040,6 +1040,18 @@
ygopro
.
ctos_follow
(
'
PLAYER_INFO
'
,
true
,
function
(
buffer
,
info
,
client
,
server
)
{
var
name
,
struct
;
name
=
info
.
name
.
split
(
"
$
"
)[
0
];
if
(
_
.
any
(
settings
.
ban
.
illegal_id
,
function
(
badid
)
{
var
matchs
,
regexp
;
regexp
=
new
RegExp
(
badid
,
'
i
'
);
matchs
=
name
.
match
(
regexp
);
if
(
matchs
)
{
name
=
matchs
[
1
];
return
true
;
}
return
false
;
},
name
))
{
client
.
rag
=
true
;
}
struct
=
ygopro
.
structs
[
"
CTOS_PlayerInfo
"
];
struct
.
_setBuff
(
buffer
);
struct
.
set
(
"
name
"
,
name
);
...
...
@@ -1753,6 +1765,22 @@
client
.
abuse_count
=
client
.
abuse_count
+
4
;
ygopro
.
stoc_send_chat
(
client
,
"
您的发言存在不适当的内容,发送失败!
"
,
ygopro
.
constants
.
COLORS
.
RED
);
}
}
else
if
(
client
.
rag
&&
room
.
started
)
{
client
.
rag
=
false
;
cancel
=
true
;
}
else
if
(
msg
.
length
>
100
)
{
log
.
warn
(
"
SPAM WORD
"
,
client
.
name
,
client
.
ip
,
oldmsg
);
client
.
abuse_count
=
client
.
abuse_count
+
2
;
ygopro
.
stoc_send_chat
(
client
,
"
请不要发送垃圾信息!
"
,
ygopro
.
constants
.
COLORS
.
RED
);
cancel
=
true
;
}
else
if
(
_
.
any
(
settings
.
ban
.
spam_word
,
function
(
badword
)
{
var
regexp
;
regexp
=
new
RegExp
(
badword
,
'
i
'
);
return
msg
.
match
(
regexp
);
},
msg
))
{
client
.
abuse_count
=
client
.
abuse_count
+
2
;
ygopro
.
stoc_send_chat
(
client
,
"
请不要发送垃圾信息!
"
,
ygopro
.
constants
.
COLORS
.
RED
);
cancel
=
true
;
}
else
if
(
_
.
any
(
settings
.
ban
.
badword_level2
,
function
(
badword
)
{
var
regexp
;
regexp
=
new
RegExp
(
badword
,
'
i
'
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment