Commit ff8cf381 authored by nanahira's avatar nanahira

Merge branch 'mc'

parents d9fc3b46 bef24b52
Pipeline #3120 passed with stages
in 5 minutes and 15 seconds
......@@ -1802,6 +1802,48 @@ class Room
ygopro.stoc_send_chat_to_room(room, "#{player.name}${using_athletic_deck}", ygopro.constants.COLORS.BABYBLUE)
))
await return
join_post_watch: (client) ->
if @duel_stage != ygopro.constants.DUEL_STAGE.BEGIN
if settings.modules.cloud_replay.enable_halfway_watch and !@hostinfo.no_watch
client.setTimeout(300000) #连接后超时5分钟
client.rid = _.indexOf(ROOM_all, this)
client.is_post_watcher = true
if settings.modules.vip.enabled and await CLIENT_check_vip(client)
playWords = await dataManager.getUserWords(CLIENT_get_authorize_key(client))
if playWords
@playLines(playWords)
else if settings.modules.words.enabled and words.words[client.name]
@playLines words.words[client.name][Math.floor(Math.random() * words.words[client.name].length)]
ygopro.stoc_send_chat_to_room(this, "#{client.name} ${watch_join}")
@watchers.push client
ygopro.stoc_send_chat(client, "${watch_watching}", ygopro.constants.COLORS.BABYBLUE)
for buffer in @watcher_buffers
client.write buffer
return true
else
ygopro.stoc_die(client, "${watch_denied}")
return false
else
return false
join_player: (client) ->
if @error
ygopro.stoc_die(client, @error)
return false
if @duel_stage != ygopro.constants.DUEL_STAGE.BEGIN
return @join_post_watch(client)
if @hostinfo.no_watch and @players.length >= (if @hostinfo.mode == 2 then 4 else 2)
ygopro.stoc_die(client, "${watch_denied_room}")
return true
if @challonge_info
for player in @get_playing_player() when player and player != client and player.challonge_info.id == client.challonge_info.id
ygopro.stoc_die(client, "${challonge_player_already_in}")
return false
client.setTimeout(300000) #连接后超时5分钟
client.rid = _.indexOf(ROOM_all, this)
@connect(client)
return true
playLines: (lines) ->
for line in _.lines lines
......@@ -2243,33 +2285,8 @@ ygopro.ctos_follow 'JOIN_GAME', true, (buffer, info, client, server, datas)->
if !room
ygopro.stoc_die(client, "${server_full}")
else if room.error
ygopro.stoc_die(client, room.error)
else if room.duel_stage != ygopro.constants.DUEL_STAGE.BEGIN
if settings.modules.cloud_replay.enable_halfway_watch and !room.hostinfo.no_watch
client.setTimeout(300000) #连接后超时5分钟
client.rid = _.indexOf(ROOM_all, room)
client.is_post_watcher = true
if settings.modules.vip.enabled and await CLIENT_check_vip(client)
playWords = await dataManager.getUserWords(CLIENT_get_authorize_key(client))
if playWords
room.playLines(playWords)
else if settings.modules.words.enabled and words.words[client.name]
room.playLines words.words[client.name][Math.floor(Math.random() * words.words[client.name].length)]
ygopro.stoc_send_chat_to_room(room, "#{client.name} ${watch_join}")
room.watchers.push client
ygopro.stoc_send_chat(client, "${watch_watching}", ygopro.constants.COLORS.BABYBLUE)
for buffer in room.watcher_buffers
client.write buffer
else
ygopro.stoc_die(client, "${watch_denied}")
else if room.hostinfo.no_watch and room.players.length >= (if room.hostinfo.mode == 2 then 4 else 2)
ygopro.stoc_die(client, "${watch_denied_room}")
else
#client.room = room
client.setTimeout(300000) #连接后超时5分钟
client.rid = _.indexOf(ROOM_all, room)
room.connect(client)
else
room.join_player(client)
return
_async.auto({
......@@ -2369,15 +2386,8 @@ ygopro.ctos_follow 'JOIN_GAME', true, (buffer, info, client, server, datas)->
buffer = struct.buffer
pre_room = ROOM_find_by_name(info.pass)
if pre_room and pre_room.duel_stage != ygopro.constants.DUEL_STAGE.BEGIN and settings.modules.cloud_replay.enable_halfway_watch and !pre_room.hostinfo.no_watch
room = pre_room
client.setTimeout(300000) #连接后超时5分钟
client.rid = _.indexOf(ROOM_all, room)
client.is_post_watcher = true
ygopro.stoc_send_chat_to_room(room, "#{client.name} ${watch_join}")
room.watchers.push client
ygopro.stoc_send_chat(client, "${watch_watching}", ygopro.constants.COLORS.BABYBLUE)
for buffer in room.watcher_buffers
client.write buffer
pre_room.join_post_watch(client)
return
else
ygopro.stoc_send_chat(client, '${loading_user_info}', ygopro.constants.COLORS.BABYBLUE)
client.setTimeout(300000) #连接后超时5分钟
......@@ -2434,36 +2444,8 @@ ygopro.ctos_follow 'JOIN_GAME', true, (buffer, info, client, server, datas)->
room.welcome = "${challonge_match_created}"
if !room
ygopro.stoc_die(client, "${server_full}")
else if room.error
ygopro.stoc_die(client, room.error)
else if room.duel_stage != ygopro.constants.DUEL_STAGE.BEGIN
if settings.modules.cloud_replay.enable_halfway_watch and !room.hostinfo.no_watch
#client.setTimeout(300000) #连接后超时5分钟
client.rid = _.indexOf(ROOM_all, room)
client.is_post_watcher = true
if settings.modules.vip.enabled and await CLIENT_check_vip(client)
playWords = await dataManager.getUserWords(CLIENT_get_authorize_key(client))
if playWords
room.playLines(playWords)
else if settings.modules.words.enabled and words.words[client.name]
room.playLines words.words[client.name][Math.floor(Math.random() * words.words[client.name].length)]
ygopro.stoc_send_chat_to_room(room, "#{client.name} ${watch_join}")
room.watchers.push client
ygopro.stoc_send_chat(client, "${watch_watching}", ygopro.constants.COLORS.BABYBLUE)
for buffer in room.watcher_buffers
client.write buffer
else
ygopro.stoc_die(client, "${watch_denied}")
else if room.hostinfo.no_watch and room.players.length >= (if room.hostinfo.mode == 2 then 4 else 2)
ygopro.stoc_die(client, "${watch_denied_room}")
else
for player in room.get_playing_player() when player and player != client and player.challonge_info.id == client.challonge_info.id
ygopro.stoc_die(client, "${challonge_player_already_in}")
return
#client.room = room
#client.setTimeout(300000) #连接后超时5分钟
client.rid = _.indexOf(ROOM_all, room)
room.connect(client)
room.join_player(client)
return
)
......@@ -2510,32 +2492,8 @@ ygopro.ctos_follow 'JOIN_GAME', true, (buffer, info, client, server, datas)->
room = await ROOM_find_or_create_by_name(info.pass, client.ip)
if !room
ygopro.stoc_die(client, "${server_full}")
else if room.error
ygopro.stoc_die(client, room.error)
else if room.duel_stage != ygopro.constants.DUEL_STAGE.BEGIN
if settings.modules.cloud_replay.enable_halfway_watch and !room.hostinfo.no_watch
client.setTimeout(300000) #连接后超时5分钟
client.rid = _.indexOf(ROOM_all, room)
client.is_post_watcher = true
if settings.modules.vip.enabled and await CLIENT_check_vip(client)
playWords = await dataManager.getUserWords(CLIENT_get_authorize_key(client))
if playWords
room.playLines(playWords)
else if settings.modules.words.enabled and words.words[client.name]
room.playLines words.words[client.name][Math.floor(Math.random() * words.words[client.name].length)]
ygopro.stoc_send_chat_to_room(room, "#{client.name} ${watch_join}")
room.watchers.push client
ygopro.stoc_send_chat(client, "${watch_watching}", ygopro.constants.COLORS.BABYBLUE)
for buffer in room.watcher_buffers
client.write buffer
else
ygopro.stoc_die(client, "${watch_denied}")
else if room.hostinfo.no_watch and room.players.length >= (if room.hostinfo.mode == 2 then 4 else 2)
ygopro.stoc_die(client, "${watch_denied_room}")
else
client.setTimeout(300000) #连接后超时5分钟
client.rid = _.indexOf(ROOM_all, room)
room.connect(client)
room.join_player(client)
await return
ygopro.stoc_follow 'JOIN_GAME', false, (buffer, info, client, server, datas)->
......
This diff is collapsed.
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