Commit a481f165 authored by mercury233's avatar mercury233

test2

parent 894a1a31
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
"version": 4918, "version": 4918,
"modules": { "modules": {
"welcome": "YGOPRO Server", "welcome": "YGOPRO Server",
"stop": "停服",
"tips": "http://mercury233.me/ygosrv233/tips.json", "tips": "http://mercury233.me/ygosrv233/tips.json",
"dialogues": "http://mercury233.me/ygosrv233/dialogues.json", "dialogues": "http://mercury233.me/ygosrv233/dialogues.json",
"post_start_watching": true, "post_start_watching": true,
......
...@@ -99,6 +99,7 @@ class Room ...@@ -99,6 +99,7 @@ class Room
#积分 #积分
return if @deleted return if @deleted
#log.info 'room-delete', this.name, Room.all.length #log.info 'room-delete', this.name, Room.all.length
@watcher_buffers = []
index = _.indexOf(Room.all, this) index = _.indexOf(Room.all, this)
#Room.all[index] = null unless index == -1 #Room.all[index] = null unless index == -1
Room.all.splice(index, 1) unless index == -1 Room.all.splice(index, 1) unless index == -1
...@@ -111,7 +112,7 @@ class Room ...@@ -111,7 +112,7 @@ class Room
client.server.connect @port, '127.0.0.1', -> client.server.connect @port, '127.0.0.1', ->
client.server.write buffer for buffer in client.pre_establish_buffers client.server.write buffer for buffer in client.pre_establish_buffers
client.established = true client.established = true
client.pre_establish_buffers = null client.pre_establish_buffers = []
disconnect: (client, error)-> disconnect: (client, error)->
if client.is_post_watcher if client.is_post_watcher
......
...@@ -131,6 +131,7 @@ ...@@ -131,6 +131,7 @@
if (this.deleted) { if (this.deleted) {
return; return;
} }
this.watcher_buffers = [];
index = _.indexOf(Room.all, this); index = _.indexOf(Room.all, this);
if (index !== -1) { if (index !== -1) {
Room.all.splice(index, 1); Room.all.splice(index, 1);
...@@ -149,7 +150,7 @@ ...@@ -149,7 +150,7 @@
client.server.write(buffer); client.server.write(buffer);
} }
client.established = true; client.established = true;
return client.pre_establish_buffers = null; return client.pre_establish_buffers = [];
}); });
} }
}; };
......
...@@ -197,6 +197,14 @@ ygopro.ctos_follow 'JOIN_GAME', false, (buffer, info, client, server)-> ...@@ -197,6 +197,14 @@ ygopro.ctos_follow 'JOIN_GAME', false, (buffer, info, client, server)->
} }
client.end() client.end()
else if settings.modules.stop
ygopro.stoc_send_chat(client,settings.modules.stop)
ygopro.stoc_send client, 'ERROR_MSG',{
msg: 1
code: 2
}
client.end()
else if !info.pass.length else if !info.pass.length
ygopro.stoc_send_chat(client,"房间为空,请修改房间名") ygopro.stoc_send_chat(client,"房间为空,请修改房间名")
ygopro.stoc_send client, 'ERROR_MSG',{ ygopro.stoc_send client, 'ERROR_MSG',{
......
...@@ -222,6 +222,13 @@ ...@@ -222,6 +222,13 @@
code: settings.version code: settings.version
}); });
return client.end(); return client.end();
} else if (settings.modules.stop) {
ygopro.stoc_send_chat(client, settings.modules.stop);
ygopro.stoc_send(client, 'ERROR_MSG', {
msg: 1,
code: 2
});
return client.end();
} else if (!info.pass.length) { } else if (!info.pass.length) {
ygopro.stoc_send_chat(client, "房间为空,请修改房间名"); ygopro.stoc_send_chat(client, "房间为空,请修改房间名");
ygopro.stoc_send(client, 'ERROR_MSG', { ygopro.stoc_send(client, 'ERROR_MSG', {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment