Commit 82c5518b authored by nanahira's avatar nanahira

Merge branch 'master' into tcg_random

parents 17e9dd97 eb2e1c2e
...@@ -35,8 +35,7 @@ RUN xbuild /property:Configuration=Release /property:TargetFrameworkVersion="v4. ...@@ -35,8 +35,7 @@ RUN xbuild /property:Configuration=Release /property:TargetFrameworkVersion="v4.
# infos # infos
WORKDIR /ygopro-server WORKDIR /ygopro-server
EXPOSE 7911 EXPOSE 7911 7922 7933
EXPOSE 7922 # VOLUME [ /ygopro-server/config, /ygopro-server/decks, /ygopro-server/replays, /redis ]
VOLUME [ /ygopro-server/config, /ygopro-server/decks, /ygopro-server/replays, /redis ]
CMD [ "pm2-docker", "start", "/ygopro-server/data/pm2-docker.json" ] CMD [ "pm2-docker", "start", "/ygopro-server/data/pm2-docker.json" ]
...@@ -26,8 +26,7 @@ RUN git submodule foreach git checkout master && \ ...@@ -26,8 +26,7 @@ RUN git submodule foreach git checkout master && \
# infos # infos
WORKDIR /ygopro-server WORKDIR /ygopro-server
EXPOSE 7911 EXPOSE 7911 7922 7933
EXPOSE 7922 # VOLUME [ /ygopro-server/config, /ygopro-server/decks, /ygopro-server/replays ]
VOLUME [ /ygopro-server/config, /ygopro-server/decks, /ygopro-server/replays ]
CMD [ "node", "ygopro-server.js" ] CMD [ "node", "ygopro-server.js" ]
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
"rule": 0, "rule": 0,
"mode": 0, "mode": 0,
"comment": "rule: 0=OCGONLY, 1=TCGONLY, 2=OT; mode: 0=SINGLE, 1=MATCH, 2=TAG", "comment": "rule: 0=OCGONLY, 1=TCGONLY, 2=OT; mode: 0=SINGLE, 1=MATCH, 2=TAG",
"enable_priority": false, "duel_rule": 4,
"no_check_deck": false, "no_check_deck": false,
"no_shuffle_deck": false, "no_shuffle_deck": false,
"start_lp": 8000, "start_lp": 8000,
......
...@@ -29,7 +29,7 @@ update = (room)-> ...@@ -29,7 +29,7 @@ update = (room)->
broadcast('update', room_data(room), 'waiting') if !room.private broadcast('update', room_data(room), 'waiting') if !room.private
start = (room)-> start = (room)->
broadcast('delete', room_data(room), 'waiting') if !room.private broadcast('delete', room.name, 'waiting') if !room.private
broadcast('create', room_data(room), 'started') broadcast('create', room_data(room), 'started')
_delete = (room)-> _delete = (room)->
......
...@@ -74,7 +74,7 @@ ...@@ -74,7 +74,7 @@
start = function(room) { start = function(room) {
if (!room["private"]) { if (!room["private"]) {
broadcast('delete', room_data(room), 'waiting'); broadcast('delete', room.name, 'waiting');
} }
return broadcast('create', room_data(room), 'started'); return broadcast('create', room_data(room), 'started');
}; };
......
...@@ -296,6 +296,14 @@ if settings.modules.update_util.password ...@@ -296,6 +296,14 @@ if settings.modules.update_util.password
}) })
delete settings.modules.update_util.password delete settings.modules.update_util.password
imported = true imported = true
#import the old enable_priority hostinfo
if settings.hostinfo.enable_priority or settings.hostinfo.enable_priority == false
if settings.hostinfo.enable_priority
settings.hostinfo.duel_rule = 3
else
settings.hostinfo.duel_rule = 4
delete settings.hostinfo.enable_priority
imported = true
#finish #finish
if imported if imported
setting_save(settings) setting_save(settings)
...@@ -1187,7 +1195,7 @@ class Room ...@@ -1187,7 +1195,7 @@ class Room
else if (param = name.match /^(\d)(\d)(T|F)(T|F)(T|F)(\d+),(\d+),(\d+)/i) else if (param = name.match /^(\d)(\d)(T|F)(T|F)(T|F)(\d+),(\d+),(\d+)/i)
@hostinfo.rule = parseInt(param[1]) @hostinfo.rule = parseInt(param[1])
@hostinfo.mode = parseInt(param[2]) @hostinfo.mode = parseInt(param[2])
@hostinfo.enable_priority = param[3] == 'T' @hostinfo.duel_rule = (if param[3] == 'T' then 3 else 4)
@hostinfo.no_check_deck = param[4] == 'T' @hostinfo.no_check_deck = param[4] == 'T'
@hostinfo.no_shuffle_deck = param[5] == 'T' @hostinfo.no_shuffle_deck = param[5] == 'T'
@hostinfo.start_lp = parseInt(param[6]) @hostinfo.start_lp = parseInt(param[6])
...@@ -1291,8 +1299,13 @@ class Room ...@@ -1291,8 +1299,13 @@ class Room
if (rule.match /(^|,|,)(NOSHUFFLE|NS)(,|,|$)/) if (rule.match /(^|,|,)(NOSHUFFLE|NS)(,|,|$)/)
@hostinfo.no_shuffle_deck = true @hostinfo.no_shuffle_deck = true
if (rule.match /(^|,|,)(IGPRIORITY|PR)(,|,|$)/) if (rule.match /(^|,|,)(IGPRIORITY|PR)(,|,|$)/) # deprecated
@hostinfo.enable_priority = true @hostinfo.duel_rule = 3
if (param = rule.match /(^|,|,)(DUELRULE|MR)(\d+)(,|,|$)/)
duel_rule = parseInt(param[3])
if duel_rule and duel_rule > 0 and duel_rule <= 4
@hostinfo.duel_rule = duel_rule
if (rule.match /(^|,|,)(NOWATCH|NW)(,|,|$)/) if (rule.match /(^|,|,)(NOWATCH|NW)(,|,|$)/)
@hostinfo.no_watch = true @hostinfo.no_watch = true
...@@ -1311,7 +1324,7 @@ class Room ...@@ -1311,7 +1324,7 @@ class Room
if (settings.modules.tournament_mode.enabled and settings.modules.tournament_mode.replay_safe) or (@hostinfo.mode == 1 and settings.modules.replay_delay) if (settings.modules.tournament_mode.enabled and settings.modules.tournament_mode.replay_safe) or (@hostinfo.mode == 1 and settings.modules.replay_delay)
@hostinfo.replay_mode |= 0x2 @hostinfo.replay_mode |= 0x2
param = [0, @hostinfo.lflist, @hostinfo.rule, @hostinfo.mode, (if @hostinfo.enable_priority then 'T' else 'F'), param = [0, @hostinfo.lflist, @hostinfo.rule, @hostinfo.mode, @hostinfo.duel_rule,
(if @hostinfo.no_check_deck then 'T' else 'F'), (if @hostinfo.no_shuffle_deck then 'T' else 'F'), (if @hostinfo.no_check_deck then 'T' else 'F'), (if @hostinfo.no_shuffle_deck then 'T' else 'F'),
@hostinfo.start_lp, @hostinfo.start_hand, @hostinfo.draw_count, @hostinfo.time_limit, @hostinfo.replay_mode] @hostinfo.start_lp, @hostinfo.start_hand, @hostinfo.draw_count, @hostinfo.time_limit, @hostinfo.replay_mode]
...@@ -2169,7 +2182,7 @@ ygopro.ctos_follow 'JOIN_GAME', false, (buffer, info, client, server, datas)-> ...@@ -2169,7 +2182,7 @@ ygopro.ctos_follow 'JOIN_GAME', false, (buffer, info, client, server, datas)->
time_limit: 180 time_limit: 180
rule: (opt1 >> 5) & 3 rule: (opt1 >> 5) & 3
mode: (opt1 >> 3) & 3 mode: (opt1 >> 3) & 3
enable_priority: !!((opt1 >> 2) & 1) duel_rule: (if !!((opt1 >> 2) & 1) then 3 else 4)
no_check_deck: !!((opt1 >> 1) & 1) no_check_deck: !!((opt1 >> 1) & 1)
no_shuffle_deck: !!(opt1 & 1) no_shuffle_deck: !!(opt1 & 1)
start_lp: opt2 start_lp: opt2
......
...@@ -349,6 +349,16 @@ ...@@ -349,6 +349,16 @@
imported = true; imported = true;
} }
if (settings.hostinfo.enable_priority || settings.hostinfo.enable_priority === false) {
if (settings.hostinfo.enable_priority) {
settings.hostinfo.duel_rule = 3;
} else {
settings.hostinfo.duel_rule = 4;
}
delete settings.hostinfo.enable_priority;
imported = true;
}
if (imported) { if (imported) {
setting_save(settings); setting_save(settings);
} }
...@@ -1440,7 +1450,7 @@ ...@@ -1440,7 +1450,7 @@
Room = (function() { Room = (function() {
function Room(name, hostinfo) { function Room(name, hostinfo) {
var death_time, draw_count, error, lflist, list_official_to_pre, list_pre_to_official, official_database, param, pre_release_database, rule, start_hand, start_lp, temp_list, time_limit; var death_time, draw_count, duel_rule, error, lflist, list_official_to_pre, list_pre_to_official, official_database, param, pre_release_database, rule, start_hand, start_lp, temp_list, time_limit;
this.hostinfo = hostinfo; this.hostinfo = hostinfo;
this.name = name; this.name = name;
this.players = []; this.players = [];
...@@ -1526,7 +1536,7 @@ ...@@ -1526,7 +1536,7 @@
} else if ((param = name.match(/^(\d)(\d)(T|F)(T|F)(T|F)(\d+),(\d+),(\d+)/i))) { } else if ((param = name.match(/^(\d)(\d)(T|F)(T|F)(T|F)(\d+),(\d+),(\d+)/i))) {
this.hostinfo.rule = parseInt(param[1]); this.hostinfo.rule = parseInt(param[1]);
this.hostinfo.mode = parseInt(param[2]); this.hostinfo.mode = parseInt(param[2]);
this.hostinfo.enable_priority = param[3] === 'T'; this.hostinfo.duel_rule = (param[3] === 'T' ? 3 : 4);
this.hostinfo.no_check_deck = param[4] === 'T'; this.hostinfo.no_check_deck = param[4] === 'T';
this.hostinfo.no_shuffle_deck = param[5] === 'T'; this.hostinfo.no_shuffle_deck = param[5] === 'T';
this.hostinfo.start_lp = parseInt(param[6]); this.hostinfo.start_lp = parseInt(param[6]);
...@@ -1655,7 +1665,13 @@ ...@@ -1655,7 +1665,13 @@
this.hostinfo.no_shuffle_deck = true; this.hostinfo.no_shuffle_deck = true;
} }
if (rule.match(/(^|,|,)(IGPRIORITY|PR)(,|,|$)/)) { if (rule.match(/(^|,|,)(IGPRIORITY|PR)(,|,|$)/)) {
this.hostinfo.enable_priority = true; this.hostinfo.duel_rule = 3;
}
if ((param = rule.match(/(^|,|,)(DUELRULE|MR)(\d+)(,|,|$)/))) {
duel_rule = parseInt(param[3]);
if (duel_rule && duel_rule > 0 && duel_rule <= 4) {
this.hostinfo.duel_rule = duel_rule;
}
} }
if (rule.match(/(^|,|,)(NOWATCH|NW)(,|,|$)/)) { if (rule.match(/(^|,|,)(NOWATCH|NW)(,|,|$)/)) {
this.hostinfo.no_watch = true; this.hostinfo.no_watch = true;
...@@ -1676,7 +1692,7 @@ ...@@ -1676,7 +1692,7 @@
if ((settings.modules.tournament_mode.enabled && settings.modules.tournament_mode.replay_safe) || (this.hostinfo.mode === 1 && settings.modules.replay_delay)) { if ((settings.modules.tournament_mode.enabled && settings.modules.tournament_mode.replay_safe) || (this.hostinfo.mode === 1 && settings.modules.replay_delay)) {
this.hostinfo.replay_mode |= 0x2; this.hostinfo.replay_mode |= 0x2;
} }
param = [0, this.hostinfo.lflist, this.hostinfo.rule, this.hostinfo.mode, (this.hostinfo.enable_priority ? 'T' : 'F'), (this.hostinfo.no_check_deck ? 'T' : 'F'), (this.hostinfo.no_shuffle_deck ? 'T' : 'F'), this.hostinfo.start_lp, this.hostinfo.start_hand, this.hostinfo.draw_count, this.hostinfo.time_limit, this.hostinfo.replay_mode]; param = [0, this.hostinfo.lflist, this.hostinfo.rule, this.hostinfo.mode, this.hostinfo.duel_rule, (this.hostinfo.no_check_deck ? 'T' : 'F'), (this.hostinfo.no_shuffle_deck ? 'T' : 'F'), this.hostinfo.start_lp, this.hostinfo.start_hand, this.hostinfo.draw_count, this.hostinfo.time_limit, this.hostinfo.replay_mode];
try { try {
this.process = spawn('./ygopro', param, { this.process = spawn('./ygopro', param, {
cwd: 'ygopro' cwd: 'ygopro'
...@@ -2723,7 +2739,7 @@ ...@@ -2723,7 +2739,7 @@
time_limit: 180, time_limit: 180,
rule: (opt1 >> 5) & 3, rule: (opt1 >> 5) & 3,
mode: (opt1 >> 3) & 3, mode: (opt1 >> 3) & 3,
enable_priority: !!((opt1 >> 2) & 1), duel_rule: (!!((opt1 >> 2) & 1) ? 3 : 4),
no_check_deck: !!((opt1 >> 1) & 1), no_check_deck: !!((opt1 >> 1) & 1),
no_shuffle_deck: !!(opt1 & 1), no_shuffle_deck: !!(opt1 & 1),
start_lp: opt2, start_lp: opt2,
......
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