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
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
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
nanahira
srvpro
Commits
90ec4082
Commit
90ec4082
authored
Aug 10, 2016
by
mercury233
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add gag
parent
96780888
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
14 deletions
+45
-14
ygopro-server.coffee
ygopro-server.coffee
+21
-7
ygopro-server.js
ygopro-server.js
+24
-7
No files found.
ygopro-server.coffee
View file @
90ec4082
...
...
@@ -496,6 +496,7 @@ class Room
@
players
.
push
client
client
.
ip
=
client
.
remoteAddress
if
@
random_type
client
.
abuse_count
=
0
host_player
=
@
get_host
()
if
host_player
&&
(
host_player
!=
client
)
# 进来时已经有人在等待了,互相记录为匹配过
...
...
@@ -1300,24 +1301,33 @@ ygopro.ctos_follow 'CHAT', true, (buffer, info, client, server)->
# ygopro.stoc_send_hint_card_to_room(room, 2333365)
if
!
(
room
and
room
.
random_type
)
return
cancel
if
client
.
abuse_count
>=
5
log
.
warn
"BANNED CHAT"
,
client
.
name
,
client
.
remoteAddress
,
msg
ygopro
.
stoc_send_chat
(
client
,
"您已被禁言!"
,
ygopro
.
constants
.
COLORS
.
RED
)
return
true
oldmsg
=
msg
if
(
_
.
any
(
settings
.
ban
.
badword_level3
,
(
badword
)
->
regexp
=
new
RegExp
(
badword
,
'i'
)
return
msg
.
match
(
regexp
)
,
msg
))
log
.
warn
"BAD WORD LEVEL 3"
,
client
.
name
,
client
.
remoteAddress
,
oldmsg
ygopro
.
stoc_send_chat
(
client
,
"您的发言存在不适当的内容,禁止您使用随机对战功能!"
,
ygopro
.
constants
.
COLORS
.
RED
)
ROOM_ban_player
(
client
.
name
,
client
.
ip
,
"发言违规"
)
ROOM_ban_player
(
client
.
name
,
client
.
ip
,
"发言违规"
,
3
)
client
.
end
()
cancel
=
true
if
client
.
abuse_count
>
0
ygopro
.
stoc_send_chat
(
client
,
"您的发言存在严重不适当的内容,禁止您使用随机对战功能!"
,
ygopro
.
constants
.
COLORS
.
RED
)
ROOM_ban_player
(
client
.
name
,
client
.
ip
,
"发言违规"
)
ROOM_ban_player
(
client
.
name
,
client
.
ip
,
"发言违规"
,
3
)
client
.
end
()
return
true
else
client
.
abuse_count
=
client
.
abuse_count
+
4
ygopro
.
stoc_send_chat
(
client
,
"您的发言存在不适当的内容,发送失败!"
,
ygopro
.
constants
.
COLORS
.
RED
)
else
if
(
_
.
any
(
settings
.
ban
.
badword_level2
,
(
badword
)
->
regexp
=
new
RegExp
(
badword
,
'i'
)
return
msg
.
match
(
regexp
)
,
msg
))
log
.
warn
"BAD WORD LEVEL 2"
,
client
.
name
,
client
.
remoteAddress
,
oldmsg
ygopro
.
stoc_send_chat
(
client
,
"您的发言存在不适当的内容,发送失败,并记录一次违规!"
,
ygopro
.
constants
.
COLORS
.
RED
)
ROOM_ban_player
(
client
.
name
,
client
.
ip
,
"发言违规"
)
client
.
abuse_count
=
client
.
abuse_count
+
3
ygopro
.
stoc_send_chat
(
client
,
"您的发言存在不适当的内容,发送失败!"
,
ygopro
.
constants
.
COLORS
.
RED
)
cancel
=
true
else
_
.
each
(
settings
.
ban
.
badword_level1
,
(
badword
)
->
...
...
@@ -1328,7 +1338,8 @@ ygopro.ctos_follow 'CHAT', true, (buffer, info, client, server)->
,
msg
)
if
oldmsg
!=
msg
log
.
warn
"BAD WORD LEVEL 1"
,
client
.
name
,
client
.
remoteAddress
,
oldmsg
ygopro
.
stoc_send_chat
(
client
,
"请使用文明用语"
)
client
.
abuse_count
=
client
.
abuse_count
+
1
ygopro
.
stoc_send_chat
(
client
,
"请使用文明用语!"
)
struct
=
ygopro
.
structs
[
"chat"
]
struct
.
_setBuff
(
buffer
)
struct
.
set
(
"msg"
,
msg
)
...
...
@@ -1338,6 +1349,9 @@ ygopro.ctos_follow 'CHAT', true, (buffer, info, client, server)->
return
msg
.
match
(
regexp
)
,
msg
))
log
.
info
"BAD WORD LEVEL 0"
,
client
.
name
,
client
.
remoteAddress
,
oldmsg
if
client
.
abuse_count
>=
5
ygopro
.
stoc_send_chat_to_room
(
room
,
"
#{
client
.
name
}
已被禁言!"
,
ygopro
.
constants
.
COLORS
.
RED
)
ROOM_ban_player
(
client
.
name
,
client
.
ip
,
"发言违规"
)
return
cancel
ygopro
.
ctos_follow
'UPDATE_DECK'
,
true
,
(
buffer
,
info
,
client
,
server
)
->
...
...
ygopro-server.js
View file @
90ec4082
...
...
@@ -660,6 +660,7 @@
this
.
players
.
push
(
client
);
client
.
ip
=
client
.
remoteAddress
;
if
(
this
.
random_type
)
{
client
.
abuse_count
=
0
;
host_player
=
this
.
get_host
();
if
(
host_player
&&
(
host_player
!==
client
))
{
ROOM_players_oppentlist
[
host_player
.
remoteAddress
]
=
client
.
remoteAddress
;
...
...
@@ -1606,6 +1607,11 @@
if
(
!
(
room
&&
room
.
random_type
))
{
return
cancel
;
}
if
(
client
.
abuse_count
>=
5
)
{
log
.
warn
(
"
BANNED CHAT
"
,
client
.
name
,
client
.
remoteAddress
,
msg
);
ygopro
.
stoc_send_chat
(
client
,
"
您已被禁言!
"
,
ygopro
.
constants
.
COLORS
.
RED
);
return
true
;
}
oldmsg
=
msg
;
if
(
_
.
any
(
settings
.
ban
.
badword_level3
,
function
(
badword
)
{
var
regexp
;
...
...
@@ -1613,19 +1619,25 @@
return
msg
.
match
(
regexp
);
},
msg
))
{
log
.
warn
(
"
BAD WORD LEVEL 3
"
,
client
.
name
,
client
.
remoteAddress
,
oldmsg
);
ygopro
.
stoc_send_chat
(
client
,
"
您的发言存在不适当的内容,禁止您使用随机对战功能!
"
,
ygopro
.
constants
.
COLORS
.
RED
);
ROOM_ban_player
(
client
.
name
,
client
.
ip
,
"
发言违规
"
);
ROOM_ban_player
(
client
.
name
,
client
.
ip
,
"
发言违规
"
,
3
);
client
.
end
();
cancel
=
true
;
if
(
client
.
abuse_count
>
0
)
{
ygopro
.
stoc_send_chat
(
client
,
"
您的发言存在严重不适当的内容,禁止您使用随机对战功能!
"
,
ygopro
.
constants
.
COLORS
.
RED
);
ROOM_ban_player
(
client
.
name
,
client
.
ip
,
"
发言违规
"
);
ROOM_ban_player
(
client
.
name
,
client
.
ip
,
"
发言违规
"
,
3
);
client
.
end
();
return
true
;
}
else
{
client
.
abuse_count
=
client
.
abuse_count
+
4
;
ygopro
.
stoc_send_chat
(
client
,
"
您的发言存在不适当的内容,发送失败!
"
,
ygopro
.
constants
.
COLORS
.
RED
);
}
}
else
if
(
_
.
any
(
settings
.
ban
.
badword_level2
,
function
(
badword
)
{
var
regexp
;
regexp
=
new
RegExp
(
badword
,
'
i
'
);
return
msg
.
match
(
regexp
);
},
msg
))
{
log
.
warn
(
"
BAD WORD LEVEL 2
"
,
client
.
name
,
client
.
remoteAddress
,
oldmsg
);
ygopro
.
stoc_send_chat
(
client
,
"
您的发言存在不适当的内容,发送失败,并记录一次违规!
"
,
ygopro
.
constants
.
COLORS
.
RED
)
;
ROOM_ban_player
(
client
.
name
,
client
.
ip
,
"
发言违规
"
);
client
.
abuse_count
=
client
.
abuse_count
+
3
;
ygopro
.
stoc_send_chat
(
client
,
"
您的发言存在不适当的内容,发送失败!
"
,
ygopro
.
constants
.
COLORS
.
RED
);
cancel
=
true
;
}
else
{
_
.
each
(
settings
.
ban
.
badword_level1
,
function
(
badword
)
{
...
...
@@ -1635,7 +1647,8 @@
},
msg
);
if
(
oldmsg
!==
msg
)
{
log
.
warn
(
"
BAD WORD LEVEL 1
"
,
client
.
name
,
client
.
remoteAddress
,
oldmsg
);
ygopro
.
stoc_send_chat
(
client
,
"
请使用文明用语
"
);
client
.
abuse_count
=
client
.
abuse_count
+
1
;
ygopro
.
stoc_send_chat
(
client
,
"
请使用文明用语!
"
);
struct
=
ygopro
.
structs
[
"
chat
"
];
struct
.
_setBuff
(
buffer
);
struct
.
set
(
"
msg
"
,
msg
);
...
...
@@ -1648,6 +1661,10 @@
log
.
info
(
"
BAD WORD LEVEL 0
"
,
client
.
name
,
client
.
remoteAddress
,
oldmsg
);
}
}
if
(
client
.
abuse_count
>=
5
)
{
ygopro
.
stoc_send_chat_to_room
(
room
,
client
.
name
+
"
已被禁言!
"
,
ygopro
.
constants
.
COLORS
.
RED
);
ROOM_ban_player
(
client
.
name
,
client
.
ip
,
"
发言违规
"
);
}
return
cancel
;
});
...
...
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