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
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
Show 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
...
@@ -496,6 +496,7 @@ class Room
@
players
.
push
client
@
players
.
push
client
client
.
ip
=
client
.
remoteAddress
client
.
ip
=
client
.
remoteAddress
if
@
random_type
if
@
random_type
client
.
abuse_count
=
0
host_player
=
@
get_host
()
host_player
=
@
get_host
()
if
host_player
&&
(
host_player
!=
client
)
if
host_player
&&
(
host_player
!=
client
)
# 进来时已经有人在等待了,互相记录为匹配过
# 进来时已经有人在等待了,互相记录为匹配过
...
@@ -1300,24 +1301,33 @@ ygopro.ctos_follow 'CHAT', true, (buffer, info, client, server)->
...
@@ -1300,24 +1301,33 @@ ygopro.ctos_follow 'CHAT', true, (buffer, info, client, server)->
# ygopro.stoc_send_hint_card_to_room(room, 2333365)
# ygopro.stoc_send_hint_card_to_room(room, 2333365)
if
!
(
room
and
room
.
random_type
)
if
!
(
room
and
room
.
random_type
)
return
cancel
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
oldmsg
=
msg
if
(
_
.
any
(
settings
.
ban
.
badword_level3
,
(
badword
)
->
if
(
_
.
any
(
settings
.
ban
.
badword_level3
,
(
badword
)
->
regexp
=
new
RegExp
(
badword
,
'i'
)
regexp
=
new
RegExp
(
badword
,
'i'
)
return
msg
.
match
(
regexp
)
return
msg
.
match
(
regexp
)
,
msg
))
,
msg
))
log
.
warn
"BAD WORD LEVEL 3"
,
client
.
name
,
client
.
remoteAddress
,
oldmsg
log
.
warn
"BAD WORD LEVEL 3"
,
client
.
name
,
client
.
remoteAddress
,
oldmsg
ygopro
.
stoc_send_chat
(
client
,
"您的发言存在不适当的内容,禁止您使用随机对战功能!"
,
ygopro
.
constants
.
COLORS
.
RED
)
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
,
"发言违规"
)
ROOM_ban_player
(
client
.
name
,
client
.
ip
,
"发言违规"
,
3
)
ROOM_ban_player
(
client
.
name
,
client
.
ip
,
"发言违规"
,
3
)
client
.
end
()
client
.
end
()
cancel
=
true
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
)
->
else
if
(
_
.
any
(
settings
.
ban
.
badword_level2
,
(
badword
)
->
regexp
=
new
RegExp
(
badword
,
'i'
)
regexp
=
new
RegExp
(
badword
,
'i'
)
return
msg
.
match
(
regexp
)
return
msg
.
match
(
regexp
)
,
msg
))
,
msg
))
log
.
warn
"BAD WORD LEVEL 2"
,
client
.
name
,
client
.
remoteAddress
,
oldmsg
log
.
warn
"BAD WORD LEVEL 2"
,
client
.
name
,
client
.
remoteAddress
,
oldmsg
ygopro
.
stoc_send_chat
(
client
,
"您的发言存在不适当的内容,发送失败,并记录一次违规!"
,
ygopro
.
constants
.
COLORS
.
RED
)
client
.
abuse_count
=
client
.
abuse_count
+
3
ROOM_ban_player
(
client
.
name
,
client
.
ip
,
"发言违规"
)
ygopro
.
stoc_send_chat
(
client
,
"您的发言存在不适当的内容,发送失败!"
,
ygopro
.
constants
.
COLORS
.
RED
)
cancel
=
true
cancel
=
true
else
else
_
.
each
(
settings
.
ban
.
badword_level1
,
(
badword
)
->
_
.
each
(
settings
.
ban
.
badword_level1
,
(
badword
)
->
...
@@ -1328,7 +1338,8 @@ ygopro.ctos_follow 'CHAT', true, (buffer, info, client, server)->
...
@@ -1328,7 +1338,8 @@ ygopro.ctos_follow 'CHAT', true, (buffer, info, client, server)->
,
msg
)
,
msg
)
if
oldmsg
!=
msg
if
oldmsg
!=
msg
log
.
warn
"BAD WORD LEVEL 1"
,
client
.
name
,
client
.
remoteAddress
,
oldmsg
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
=
ygopro
.
structs
[
"chat"
]
struct
.
_setBuff
(
buffer
)
struct
.
_setBuff
(
buffer
)
struct
.
set
(
"msg"
,
msg
)
struct
.
set
(
"msg"
,
msg
)
...
@@ -1338,6 +1349,9 @@ ygopro.ctos_follow 'CHAT', true, (buffer, info, client, server)->
...
@@ -1338,6 +1349,9 @@ ygopro.ctos_follow 'CHAT', true, (buffer, info, client, server)->
return
msg
.
match
(
regexp
)
return
msg
.
match
(
regexp
)
,
msg
))
,
msg
))
log
.
info
"BAD WORD LEVEL 0"
,
client
.
name
,
client
.
remoteAddress
,
oldmsg
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
return
cancel
ygopro
.
ctos_follow
'UPDATE_DECK'
,
true
,
(
buffer
,
info
,
client
,
server
)
->
ygopro
.
ctos_follow
'UPDATE_DECK'
,
true
,
(
buffer
,
info
,
client
,
server
)
->
...
...
ygopro-server.js
View file @
90ec4082
...
@@ -660,6 +660,7 @@
...
@@ -660,6 +660,7 @@
this
.
players
.
push
(
client
);
this
.
players
.
push
(
client
);
client
.
ip
=
client
.
remoteAddress
;
client
.
ip
=
client
.
remoteAddress
;
if
(
this
.
random_type
)
{
if
(
this
.
random_type
)
{
client
.
abuse_count
=
0
;
host_player
=
this
.
get_host
();
host_player
=
this
.
get_host
();
if
(
host_player
&&
(
host_player
!==
client
))
{
if
(
host_player
&&
(
host_player
!==
client
))
{
ROOM_players_oppentlist
[
host_player
.
remoteAddress
]
=
client
.
remoteAddress
;
ROOM_players_oppentlist
[
host_player
.
remoteAddress
]
=
client
.
remoteAddress
;
...
@@ -1606,6 +1607,11 @@
...
@@ -1606,6 +1607,11 @@
if
(
!
(
room
&&
room
.
random_type
))
{
if
(
!
(
room
&&
room
.
random_type
))
{
return
cancel
;
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
;
oldmsg
=
msg
;
if
(
_
.
any
(
settings
.
ban
.
badword_level3
,
function
(
badword
)
{
if
(
_
.
any
(
settings
.
ban
.
badword_level3
,
function
(
badword
)
{
var
regexp
;
var
regexp
;
...
@@ -1613,19 +1619,25 @@
...
@@ -1613,19 +1619,25 @@
return
msg
.
match
(
regexp
);
return
msg
.
match
(
regexp
);
},
msg
))
{
},
msg
))
{
log
.
warn
(
"
BAD WORD LEVEL 3
"
,
client
.
name
,
client
.
remoteAddress
,
oldmsg
);
log
.
warn
(
"
BAD WORD LEVEL 3
"
,
client
.
name
,
client
.
remoteAddress
,
oldmsg
);
ygopro
.
stoc_send_chat
(
client
,
"
您的发言存在不适当的内容,禁止您使用随机对战功能!
"
,
ygopro
.
constants
.
COLORS
.
RED
);
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
,
"
发言违规
"
);
ROOM_ban_player
(
client
.
name
,
client
.
ip
,
"
发言违规
"
,
3
);
ROOM_ban_player
(
client
.
name
,
client
.
ip
,
"
发言违规
"
,
3
);
client
.
end
();
client
.
end
();
cancel
=
true
;
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
)
{
}
else
if
(
_
.
any
(
settings
.
ban
.
badword_level2
,
function
(
badword
)
{
var
regexp
;
var
regexp
;
regexp
=
new
RegExp
(
badword
,
'
i
'
);
regexp
=
new
RegExp
(
badword
,
'
i
'
);
return
msg
.
match
(
regexp
);
return
msg
.
match
(
regexp
);
},
msg
))
{
},
msg
))
{
log
.
warn
(
"
BAD WORD LEVEL 2
"
,
client
.
name
,
client
.
remoteAddress
,
oldmsg
);
log
.
warn
(
"
BAD WORD LEVEL 2
"
,
client
.
name
,
client
.
remoteAddress
,
oldmsg
);
ygopro
.
stoc_send_chat
(
client
,
"
您的发言存在不适当的内容,发送失败,并记录一次违规!
"
,
ygopro
.
constants
.
COLORS
.
RED
)
;
client
.
abuse_count
=
client
.
abuse_count
+
3
;
ROOM_ban_player
(
client
.
name
,
client
.
ip
,
"
发言违规
"
);
ygopro
.
stoc_send_chat
(
client
,
"
您的发言存在不适当的内容,发送失败!
"
,
ygopro
.
constants
.
COLORS
.
RED
);
cancel
=
true
;
cancel
=
true
;
}
else
{
}
else
{
_
.
each
(
settings
.
ban
.
badword_level1
,
function
(
badword
)
{
_
.
each
(
settings
.
ban
.
badword_level1
,
function
(
badword
)
{
...
@@ -1635,7 +1647,8 @@
...
@@ -1635,7 +1647,8 @@
},
msg
);
},
msg
);
if
(
oldmsg
!==
msg
)
{
if
(
oldmsg
!==
msg
)
{
log
.
warn
(
"
BAD WORD LEVEL 1
"
,
client
.
name
,
client
.
remoteAddress
,
oldmsg
);
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
=
ygopro
.
structs
[
"
chat
"
];
struct
.
_setBuff
(
buffer
);
struct
.
_setBuff
(
buffer
);
struct
.
set
(
"
msg
"
,
msg
);
struct
.
set
(
"
msg
"
,
msg
);
...
@@ -1648,6 +1661,10 @@
...
@@ -1648,6 +1661,10 @@
log
.
info
(
"
BAD WORD LEVEL 0
"
,
client
.
name
,
client
.
remoteAddress
,
oldmsg
);
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
;
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