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
b65f471f
Commit
b65f471f
authored
Dec 30, 2018
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improve
parent
94601b6a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
0 deletions
+34
-0
ygopro-server.coffee
ygopro-server.coffee
+12
-0
ygopro-server.js
ygopro-server.js
+22
-0
No files found.
ygopro-server.coffee
View file @
b65f471f
...
@@ -372,6 +372,7 @@ ban_user = (name) ->
...
@@ -372,6 +372,7 @@ ban_user = (name) ->
ROOM_bad_ip[bad_ip]=99
ROOM_bad_ip[bad_ip]=99
settings.ban.banned_ip.push(player.ip)
settings.ban.banned_ip.push(player.ip)
ygopro.stoc_send_chat_to_room(room, "#{player.name} ${kicked_by_system}", ygopro.constants.COLORS.RED)
ygopro.stoc_send_chat_to_room(room, "#{player.name} ${kicked_by_system}", ygopro.constants.COLORS.RED)
CLIENT_send_replays(player, room)
CLIENT_kick(player)
CLIENT_kick(player)
continue
continue
return
return
...
@@ -1026,6 +1027,7 @@ class Room
...
@@ -1026,6 +1027,7 @@ class Room
@has_ygopro_error = true
@has_ygopro_error = true
@ygopro_error_length = if @ygopro_error_length then @ygopro_error_length + data.length else data.length
@ygopro_error_length = if @ygopro_error_length then @ygopro_error_length + data.length else data.length
if @ygopro_error_length > 10000
if @ygopro_error_length > 10000
@send_replays()
@process.kill()
@process.kill()
return
return
catch
catch
...
@@ -1194,6 +1196,14 @@ class Room
...
@@ -1194,6 +1196,14 @@ class Room
challonge_duel_log.scoresCsv = "0-0"
challonge_duel_log.scoresCsv = "0-0"
return challonge_duel_log
return challonge_duel_log
send_replays: () ->
return false unless settings.modules.replay_delay and @replays.length and @hostinfo.mode == 1
for player in @players
CLIENT_send_replays(player, this)
for player in @watchers
CLIENT_send_replays(player, this)
return true
add_windbot: (botdata)->
add_windbot: (botdata)->
@windbot = botdata
@windbot = botdata
request
request
...
@@ -1260,6 +1270,7 @@ class Room
...
@@ -1260,6 +1270,7 @@ class Room
roomlist.update(this) if !@windbot and !@started and settings.modules.http.websocket_roomlist
roomlist.update(this) if !@windbot and !@started and settings.modules.http.websocket_roomlist
#client.room = null
#client.room = null
else
else
@send_replays()
@process.kill()
@process.kill()
#client.room = null
#client.room = null
this.delete()
this.delete()
...
@@ -3314,6 +3325,7 @@ if settings.modules.http
...
@@ -3314,6 +3325,7 @@ if settings.modules.http
room.scores[room.dueling_players[0].name_vpass] = 0
room.scores[room.dueling_players[0].name_vpass] = 0
room.scores[room.dueling_players[1].name_vpass] = 0
room.scores[room.dueling_players[1].name_vpass] = 0
room.kicked = true
room.kicked = true
@send_replays()
room.process.kill()
room.process.kill()
room.delete()
room.delete()
response.writeHead(200)
response.writeHead(200)
...
...
ygopro-server.js
View file @
b65f471f
...
@@ -430,6 +430,7 @@
...
@@ -430,6 +430,7 @@
ROOM_bad_ip[bad_ip] = 99;
ROOM_bad_ip[bad_ip] = 99;
settings.ban.banned_ip.push(player.ip);
settings.ban.banned_ip.push(player.ip);
ygopro.stoc_send_chat_to_room(room, player.name + " ${kicked_by_system}", ygopro.constants.COLORS.RED);
ygopro.stoc_send_chat_to_room(room, player.name + " ${kicked_by_system}", ygopro.constants.COLORS.RED);
CLIENT_send_replays(player, room);
CLIENT_kick(player);
CLIENT_kick(player);
continue;
continue;
}
}
...
@@ -1309,6 +1310,7 @@
...
@@ -1309,6 +1310,7 @@
_this.has_ygopro_error = true;
_this.has_ygopro_error = true;
_this.ygopro_error_length = _this.ygopro_error_length ? _this.ygopro_error_length + data.length : data.length;
_this.ygopro_error_length = _this.ygopro_error_length ? _this.ygopro_error_length + data.length : data.length;
if (_this.ygopro_error_length > 10000) {
if (_this.ygopro_error_length > 10000) {
_this.send_replays();
_this.process.kill();
_this.process.kill();
}
}
};
};
...
@@ -1544,6 +1546,24 @@
...
@@ -1544,6 +1546,24 @@
return challonge_duel_log;
return challonge_duel_log;
};
};
Room.prototype.send_replays = function() {
var len2, len3, m, n, player, ref2, ref3;
if (!(settings.modules.replay_delay && this.replays.length && this.hostinfo.mode === 1)) {
return false;
}
ref2 = this.players;
for (m = 0, len2 = ref2.length; m < len2; m++) {
player = ref2[m];
CLIENT_send_replays(player, this);
}
ref3 = this.watchers;
for (n = 0, len3 = ref3.length; n < len3; n++) {
player = ref3[n];
CLIENT_send_replays(player, this);
}
return true;
};
Room.prototype.add_windbot = function(botdata) {
Room.prototype.add_windbot = function(botdata) {
this.windbot = botdata;
this.windbot = botdata;
request({
request({
...
@@ -1635,6 +1655,7 @@
...
@@ -1635,6 +1655,7 @@
roomlist.update(this);
roomlist.update(this);
}
}
} else {
} else {
this.send_replays();
this.process.kill();
this.process.kill();
this["delete"]();
this["delete"]();
}
}
...
@@ -4231,6 +4252,7 @@
...
@@ -4231,6 +4252,7 @@
room.scores[room.dueling_players[1].name_vpass] = 0;
room.scores[room.dueling_players[1].name_vpass] = 0;
}
}
room.kicked = true;
room.kicked = true;
this.send_replays();
room.process.kill();
room.process.kill();
room["delete"]();
room["delete"]();
}
}
...
...
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