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
7c899532
Commit
7c899532
authored
Jun 21, 2018
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
d50829ed
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
61 additions
and
59 deletions
+61
-59
ygopro-server.coffee
ygopro-server.coffee
+40
-29
ygopro-server.js
ygopro-server.js
+21
-30
No files found.
ygopro-server.coffee
View file @
7c899532
...
@@ -40,6 +40,33 @@ moment.locale('zh-cn', {
...
@@ -40,6 +40,33 @@ moment.locale('zh-cn', {
}
}
})
})
import_datas
=
[
"abuse_count"
,
"rag"
,
"rid"
,
"is_post_watcher"
,
"retry_count"
,
"name"
,
"is_first"
,
"lp"
,
"card_count"
,
"is_host"
,
"pos"
,
"surrend_confirm"
,
"kick_count"
,
"deck_saved"
,
"main"
,
"side"
,
"side_interval"
,
"side_tcount"
,
"selected_preduel"
,
"last_game_msg"
,
"last_game_msg_title"
,
"last_hint_msg"
,
"start_deckbuf"
,
"ready_trap"
]
merge
=
require
'deepmerge'
merge
=
require
'deepmerge'
loadJSON
=
require
(
'load-json-file'
).
sync
loadJSON
=
require
(
'load-json-file'
).
sync
...
@@ -468,37 +495,14 @@ CLIENT_import_data = (client, old_client, room) ->
...
@@ -468,37 +495,14 @@ CLIENT_import_data = (client, old_client, room) ->
room
.
players
[
index
]
=
client
room
.
players
[
index
]
=
client
break
break
room
.
dueling_players
[
old_client
.
pos
]
=
client
room
.
dueling_players
[
old_client
.
pos
]
=
client
if
room
.
waiting_for_player
=
old_client
if
room
.
waiting_for_player
=
=
old_client
room
.
waiting_for_player
=
client
room
.
waiting_for_player
=
client
if
room
.
waiting_for_player2
=
old_client
if
room
.
waiting_for_player2
=
=
old_client
room
.
waiting_for_player2
=
client
room
.
waiting_for_player2
=
client
if
room
.
selecting_tp
=
old_client
if
room
.
selecting_tp
=
=
old_client
room
.
selecting_tp
=
client
room
.
selecting_tp
=
client
client
.
abuse_count
=
old_client
.
abuse_count
for
key
in
import_datas
# client.established = old_client.established
client
[
key
]
=
old_client
[
key
]
# client.pre_establish_buffers = old_client.pre_establish_buffers
client
.
rag
=
old_client
.
rag
client
.
rid
=
old_client
.
rid
client
.
is_post_watcher
=
old_client
.
is_post_watcher
client
.
retry_count
=
old_client
.
retry_count
client
.
name
=
old_client
.
name
client
.
is_first
=
old_client
.
is_first
client
.
lp
=
old_client
.
lp
client
.
card_count
=
old_client
.
card_count
client
.
is_host
=
old_client
.
is_host
client
.
pos
=
old_client
.
pos
client
.
surrend_confirm
=
old_client
.
surrend_confirm
client
.
kick_count
=
old_client
.
kick_count
client
.
deck_saved
=
old_client
.
deck_saved
client
.
main
=
old_client
.
main
client
.
side
=
old_client
.
side
client
.
side_interval
=
old_client
.
side_interval
client
.
side_tcount
=
old_client
.
side_tcount
client
.
selected_preduel
=
old_client
.
selected_preduel
client
.
last_game_msg
=
old_client
.
last_game_msg
client
.
last_game_msg_title
=
old_client
.
last_game_msg_title
client
.
last_hint_msg
=
old_client
.
last_hint_msg
client
.
start_deckbuf
=
old_client
.
start_deckbuf
old_client
.
had_new_reconnection
=
true
old_client
.
had_new_reconnection
=
true
return
return
...
@@ -1789,9 +1793,16 @@ ygopro.stoc_follow 'GAME_MSG', true, (buffer, info, client, server)->
...
@@ -1789,9 +1793,16 @@ ygopro.stoc_follow 'GAME_MSG', true, (buffer, info, client, server)->
if
ygopro
.
constants
.
MSG
[
msg
]
==
'SUMMONING'
or
ygopro
.
constants
.
MSG
[
msg
]
==
'SPSUMMONING'
or
ygopro
.
constants
.
MSG
[
msg
]
==
'CHAINING'
if
ygopro
.
constants
.
MSG
[
msg
]
==
'SUMMONING'
or
ygopro
.
constants
.
MSG
[
msg
]
==
'SPSUMMONING'
or
ygopro
.
constants
.
MSG
[
msg
]
==
'CHAINING'
card
=
buffer
.
readUInt32LE
(
1
)
card
=
buffer
.
readUInt32LE
(
1
)
trigger_location
=
buffer
.
readUInt8
(
6
)
trigger_location
=
buffer
.
readUInt8
(
6
)
if
dialogues
.
dialogues
[
card
]
and
(
ygopro
.
constants
.
MSG
[
msg
]
!=
'CHAINING'
or
(
trigger_location
&
0x8
)
and
!
(
trigger_location
&
0x200
)
)
if
dialogues
.
dialogues
[
card
]
and
(
ygopro
.
constants
.
MSG
[
msg
]
!=
'CHAINING'
or
(
trigger_location
&
0x8
)
and
client
.
ready_trap
)
for
line
in
_
.
lines
dialogues
.
dialogues
[
card
][
Math
.
floor
(
Math
.
random
()
*
dialogues
.
dialogues
[
card
].
length
)]
for
line
in
_
.
lines
dialogues
.
dialogues
[
card
][
Math
.
floor
(
Math
.
random
()
*
dialogues
.
dialogues
[
card
].
length
)]
ygopro
.
stoc_send_chat
(
client
,
line
,
ygopro
.
constants
.
COLORS
.
PINK
)
ygopro
.
stoc_send_chat
(
client
,
line
,
ygopro
.
constants
.
COLORS
.
PINK
)
if
ygopro
.
constants
.
MSG
[
msg
]
==
'POS_CHANGE'
loc
=
buffer
.
readUInt8
(
6
)
ppos
=
buffer
.
readUInt8
(
8
)
cpos
=
buffer
.
readUInt8
(
9
)
client
.
ready_trap
=
!!
(
loc
&
0x8
)
and
!!
(
ppos
&
0xa
)
and
!!
(
cpos
&
0x5
)
else
if
ygopro
.
constants
.
MSG
[
msg
]
!=
'UPDATE_CARD'
and
ygopro
.
constants
.
MSG
[
msg
]
!=
'WAITING'
client
.
ready_trap
=
false
return
false
return
false
#房间管理
#房间管理
...
...
ygopro-server.js
View file @
7c899532
// Generated by CoffeeScript 1.12.7
// Generated by CoffeeScript 1.12.7
(
function
()
{
(
function
()
{
var
CLIENT_get_authorize_key
,
CLIENT_import_data
,
CLIENT_is_able_to_reconnect
,
CLIENT_is_player
,
CLIENT_kick
,
CLIENT_pre_reconnect
,
CLIENT_reconnect
,
CLIENT_reconnect_register
,
CLIENT_reconnect_unregister
,
CLIENT_send_pre_reconnect_info
,
CLIENT_send_reconnect_info
,
Cloud_replay_ids
,
ROOM_all
,
ROOM_bad_ip
,
ROOM_ban_player
,
ROOM_clear_disconnect
,
ROOM_connected_ip
,
ROOM_find_by_name
,
ROOM_find_by_port
,
ROOM_find_by_title
,
ROOM_find_or_create_ai
,
ROOM_find_or_create_by_name
,
ROOM_find_or_create_random
,
ROOM_players_banned
,
ROOM_players_oppentlist
,
ROOM_unwelcome
,
ROOM_validate
,
Room
,
SERVER_clear_disconnect
,
_
,
addCallback
,
badwords
,
ban_user
,
bunyan
,
chat_color
,
config
,
cppversion
,
crypto
,
date
,
default_config
,
default_data
,
dialogues
,
disconnect_list
,
duel_log
,
e
,
exec
,
execFile
,
fs
,
geoip
,
get_memory_usage
,
http
,
http_server
,
https
,
https_server
,
j
,
l
,
len
,
len1
,
lflists
,
list
,
loadJSON
,
load_dialogues
,
load_tips
,
log
,
memory_usage
,
merge
,
moment
,
net
,
oldbadwords
,
oldconfig
,
olddialogues
,
oldduellog
,
oldtips
,
options
,
os
,
path
,
pgClient
,
pg_client
,
pg_query
,
redis
,
redisdb
,
ref
,
ref1
,
release_disconnect
,
report_to_big_brother
,
request
,
requestListener
,
roomlist
,
setting_change
,
setting_save
,
settings
,
spawn
,
spawnSync
,
tips
,
url
,
users_cache
,
wait_room_start
,
wait_room_start_arena
,
windbot_bin
,
windbot_parameters
,
windbot_process
,
windbots
,
ygopro
,
zlib
;
var
CLIENT_get_authorize_key
,
CLIENT_import_data
,
CLIENT_is_able_to_reconnect
,
CLIENT_is_player
,
CLIENT_kick
,
CLIENT_pre_reconnect
,
CLIENT_reconnect
,
CLIENT_reconnect_register
,
CLIENT_reconnect_unregister
,
CLIENT_send_pre_reconnect_info
,
CLIENT_send_reconnect_info
,
Cloud_replay_ids
,
ROOM_all
,
ROOM_bad_ip
,
ROOM_ban_player
,
ROOM_clear_disconnect
,
ROOM_connected_ip
,
ROOM_find_by_name
,
ROOM_find_by_port
,
ROOM_find_by_title
,
ROOM_find_or_create_ai
,
ROOM_find_or_create_by_name
,
ROOM_find_or_create_random
,
ROOM_players_banned
,
ROOM_players_oppentlist
,
ROOM_unwelcome
,
ROOM_validate
,
Room
,
SERVER_clear_disconnect
,
_
,
addCallback
,
badwords
,
ban_user
,
bunyan
,
chat_color
,
config
,
cppversion
,
crypto
,
date
,
default_config
,
default_data
,
dialogues
,
disconnect_list
,
duel_log
,
e
,
exec
,
execFile
,
fs
,
geoip
,
get_memory_usage
,
http
,
http_server
,
https
,
https_server
,
import_datas
,
j
,
l
,
len
,
len1
,
lflists
,
list
,
loadJSON
,
load_dialogues
,
load_tips
,
log
,
memory_usage
,
merge
,
moment
,
net
,
oldbadwords
,
oldconfig
,
olddialogues
,
oldduellog
,
oldtips
,
options
,
os
,
path
,
pgClient
,
pg_client
,
pg_query
,
redis
,
redisdb
,
ref
,
ref1
,
release_disconnect
,
report_to_big_brother
,
request
,
requestListener
,
roomlist
,
setting_change
,
setting_save
,
settings
,
spawn
,
spawnSync
,
tips
,
url
,
users_cache
,
wait_room_start
,
wait_room_start_arena
,
windbot_bin
,
windbot_parameters
,
windbot_process
,
windbots
,
ygopro
,
zlib
;
net
=
require
(
'
net
'
);
net
=
require
(
'
net
'
);
...
@@ -58,6 +58,8 @@
...
@@ -58,6 +58,8 @@
}
}
});
});
import_datas
=
[
"
abuse_count
"
,
"
rag
"
,
"
rid
"
,
"
is_post_watcher
"
,
"
retry_count
"
,
"
name
"
,
"
is_first
"
,
"
lp
"
,
"
card_count
"
,
"
is_host
"
,
"
pos
"
,
"
surrend_confirm
"
,
"
kick_count
"
,
"
deck_saved
"
,
"
main
"
,
"
side
"
,
"
side_interval
"
,
"
side_tcount
"
,
"
selected_preduel
"
,
"
last_game_msg
"
,
"
last_game_msg_title
"
,
"
last_hint_msg
"
,
"
start_deckbuf
"
,
"
ready_trap
"
];
merge
=
require
(
'
deepmerge
'
);
merge
=
require
(
'
deepmerge
'
);
loadJSON
=
require
(
'
load-json-file
'
).
sync
;
loadJSON
=
require
(
'
load-json-file
'
).
sync
;
...
@@ -628,7 +630,7 @@
...
@@ -628,7 +630,7 @@
};
};
CLIENT_import_data
=
function
(
client
,
old_client
,
room
)
{
CLIENT_import_data
=
function
(
client
,
old_client
,
room
)
{
var
index
,
len2
,
m
,
player
,
ref2
;
var
index
,
key
,
len2
,
len3
,
m
,
n
,
player
,
ref2
;
ref2
=
room
.
players
;
ref2
=
room
.
players
;
for
(
index
=
m
=
0
,
len2
=
ref2
.
length
;
m
<
len2
;
index
=
++
m
)
{
for
(
index
=
m
=
0
,
len2
=
ref2
.
length
;
m
<
len2
;
index
=
++
m
)
{
player
=
ref2
[
index
];
player
=
ref2
[
index
];
...
@@ -638,38 +640,19 @@
...
@@ -638,38 +640,19 @@
}
}
}
}
room
.
dueling_players
[
old_client
.
pos
]
=
client
;
room
.
dueling_players
[
old_client
.
pos
]
=
client
;
if
(
room
.
waiting_for_player
=
old_client
)
{
if
(
room
.
waiting_for_player
=
==
old_client
)
{
room
.
waiting_for_player
=
client
;
room
.
waiting_for_player
=
client
;
}
}
if
(
room
.
waiting_for_player2
=
old_client
)
{
if
(
room
.
waiting_for_player2
=
==
old_client
)
{
room
.
waiting_for_player2
=
client
;
room
.
waiting_for_player2
=
client
;
}
}
if
(
room
.
selecting_tp
=
old_client
)
{
if
(
room
.
selecting_tp
=
==
old_client
)
{
room
.
selecting_tp
=
client
;
room
.
selecting_tp
=
client
;
}
}
client
.
abuse_count
=
old_client
.
abuse_count
;
for
(
n
=
0
,
len3
=
import_datas
.
length
;
n
<
len3
;
n
++
)
{
client
.
rag
=
old_client
.
rag
;
key
=
import_datas
[
n
];
client
.
rid
=
old_client
.
rid
;
client
[
key
]
=
old_client
[
key
];
client
.
is_post_watcher
=
old_client
.
is_post_watcher
;
}
client
.
retry_count
=
old_client
.
retry_count
;
client
.
name
=
old_client
.
name
;
client
.
is_first
=
old_client
.
is_first
;
client
.
lp
=
old_client
.
lp
;
client
.
card_count
=
old_client
.
card_count
;
client
.
is_host
=
old_client
.
is_host
;
client
.
pos
=
old_client
.
pos
;
client
.
surrend_confirm
=
old_client
.
surrend_confirm
;
client
.
kick_count
=
old_client
.
kick_count
;
client
.
deck_saved
=
old_client
.
deck_saved
;
client
.
main
=
old_client
.
main
;
client
.
side
=
old_client
.
side
;
client
.
side_interval
=
old_client
.
side_interval
;
client
.
side_tcount
=
old_client
.
side_tcount
;
client
.
selected_preduel
=
old_client
.
selected_preduel
;
client
.
last_game_msg
=
old_client
.
last_game_msg
;
client
.
last_game_msg_title
=
old_client
.
last_game_msg_title
;
client
.
last_hint_msg
=
old_client
.
last_hint_msg
;
client
.
start_deckbuf
=
old_client
.
start_deckbuf
;
old_client
.
had_new_reconnection
=
true
;
old_client
.
had_new_reconnection
=
true
;
};
};
...
@@ -1946,7 +1929,7 @@
...
@@ -1946,7 +1929,7 @@
}
}
ygopro
.
stoc_follow
(
'
GAME_MSG
'
,
true
,
function
(
buffer
,
info
,
client
,
server
)
{
ygopro
.
stoc_follow
(
'
GAME_MSG
'
,
true
,
function
(
buffer
,
info
,
client
,
server
)
{
var
card
,
count
,
hint_type
,
len2
,
line
,
loc
,
m
,
msg
,
oppo_pos
,
phase
,
playertype
,
pos
,
reason
,
ref2
,
ref3
,
ref4
,
room
,
trigger_location
,
val
,
win_pos
;
var
card
,
count
,
cpos
,
hint_type
,
len2
,
line
,
loc
,
m
,
msg
,
oppo_pos
,
phase
,
playertype
,
pos
,
p
pos
,
reason
,
ref2
,
ref3
,
ref4
,
room
,
trigger_location
,
val
,
win_pos
;
room
=
ROOM_all
[
client
.
rid
];
room
=
ROOM_all
[
client
.
rid
];
if
(
!
(
room
&&
!
client
.
reconnecting
))
{
if
(
!
(
room
&&
!
client
.
reconnecting
))
{
return
;
return
;
...
@@ -2184,7 +2167,7 @@
...
@@ -2184,7 +2167,7 @@
if
(
ygopro
.
constants
.
MSG
[
msg
]
===
'
SUMMONING
'
||
ygopro
.
constants
.
MSG
[
msg
]
===
'
SPSUMMONING
'
||
ygopro
.
constants
.
MSG
[
msg
]
===
'
CHAINING
'
)
{
if
(
ygopro
.
constants
.
MSG
[
msg
]
===
'
SUMMONING
'
||
ygopro
.
constants
.
MSG
[
msg
]
===
'
SPSUMMONING
'
||
ygopro
.
constants
.
MSG
[
msg
]
===
'
CHAINING
'
)
{
card
=
buffer
.
readUInt32LE
(
1
);
card
=
buffer
.
readUInt32LE
(
1
);
trigger_location
=
buffer
.
readUInt8
(
6
);
trigger_location
=
buffer
.
readUInt8
(
6
);
if
(
dialogues
.
dialogues
[
card
]
&&
(
ygopro
.
constants
.
MSG
[
msg
]
!==
'
CHAINING
'
||
(
trigger_location
&
0x8
)
&&
!
(
trigger_location
&
0x200
)
))
{
if
(
dialogues
.
dialogues
[
card
]
&&
(
ygopro
.
constants
.
MSG
[
msg
]
!==
'
CHAINING
'
||
(
trigger_location
&
0x8
)
&&
client
.
ready_trap
))
{
ref4
=
_
.
lines
(
dialogues
.
dialogues
[
card
][
Math
.
floor
(
Math
.
random
()
*
dialogues
.
dialogues
[
card
].
length
)]);
ref4
=
_
.
lines
(
dialogues
.
dialogues
[
card
][
Math
.
floor
(
Math
.
random
()
*
dialogues
.
dialogues
[
card
].
length
)]);
for
(
m
=
0
,
len2
=
ref4
.
length
;
m
<
len2
;
m
++
)
{
for
(
m
=
0
,
len2
=
ref4
.
length
;
m
<
len2
;
m
++
)
{
line
=
ref4
[
m
];
line
=
ref4
[
m
];
...
@@ -2192,6 +2175,14 @@
...
@@ -2192,6 +2175,14 @@
}
}
}
}
}
}
if
(
ygopro
.
constants
.
MSG
[
msg
]
===
'
POS_CHANGE
'
)
{
loc
=
buffer
.
readUInt8
(
6
);
ppos
=
buffer
.
readUInt8
(
8
);
cpos
=
buffer
.
readUInt8
(
9
);
client
.
ready_trap
=
!!
(
loc
&
0x8
)
&&
!!
(
ppos
&
0xa
)
&&
!!
(
cpos
&
0x5
);
}
else
if
(
ygopro
.
constants
.
MSG
[
msg
]
!==
'
UPDATE_CARD
'
&&
ygopro
.
constants
.
MSG
[
msg
]
!==
'
WAITING
'
)
{
client
.
ready_trap
=
false
;
}
}
}
return
false
;
return
false
;
});
});
...
...
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