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
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
3
Merge Requests
3
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
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
MyCard
srvpro
Commits
94e878a7
Commit
94e878a7
authored
Jan 22, 2021
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update deck check and fix death cancel
parent
8de92df4
Pipeline
#2180
passed with stages
in 7 minutes and 15 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
81 additions
and
78 deletions
+81
-78
ygopro-server.coffee
ygopro-server.coffee
+36
-35
ygopro-server.js
ygopro-server.js
+45
-43
No files found.
ygopro-server.coffee
View file @
94e878a7
...
@@ -3320,41 +3320,42 @@ ygopro.ctos_follow 'UPDATE_DECK', true, (buffer, info, client, server, datas)->
...
@@ -3320,41 +3320,42 @@ ygopro.ctos_follow 'UPDATE_DECK', true, (buffer, info, client, server, datas)->
struct
.
set
(
"sidec"
,
1
)
struct
.
set
(
"sidec"
,
1
)
struct
.
set
(
"deckbuf"
,
[
4392470
,
4392470
])
struct
.
set
(
"deckbuf"
,
[
4392470
,
4392470
])
ygopro
.
stoc_send_chat
(
client
,
"${deck_incorrect_reconnect}"
,
ygopro
.
constants
.
COLORS
.
RED
)
ygopro
.
stoc_send_chat
(
client
,
"${deck_incorrect_reconnect}"
,
ygopro
.
constants
.
COLORS
.
RED
)
else
if
room
.
duel_stage
==
ygopro
.
constants
.
DUEL_STAGE
.
BEGIN
and
room
.
hostinfo
.
mode
==
1
and
settings
.
modules
.
tournament_mode
.
enabled
and
settings
.
modules
.
tournament_mode
.
deck_check
and
fs
.
readdirSync
(
settings
.
modules
.
tournament_mode
.
deck_path
).
length
else
if
room
.
duel_stage
==
ygopro
.
constants
.
DUEL_STAGE
.
BEGIN
and
settings
.
modules
.
tournament_mode
.
enabled
and
settings
.
modules
.
tournament_mode
.
deck_check
and
fs
.
readdirSync
(
settings
.
modules
.
tournament_mode
.
deck_path
).
length
struct
.
set
(
"mainc"
,
1
)
decks
=
await
fs
.
promises
.
readdir
(
settings
.
modules
.
tournament_mode
.
deck_path
)
struct
.
set
(
"sidec"
,
1
)
if
decks
.
length
struct
.
set
(
"deckbuf"
,
[
4392470
,
4392470
])
struct
.
set
(
"mainc"
,
1
)
buffer
=
struct
.
buffer
struct
.
set
(
"sidec"
,
1
)
found_deck
=
false
struct
.
set
(
"deckbuf"
,
[
4392470
,
4392470
])
decks
=
fs
.
readdirSync
(
settings
.
modules
.
tournament_mode
.
deck_path
)
buffer
=
struct
.
buffer
for
deck
in
decks
found_deck
=
false
if
deck_name_match
(
deck
,
client
.
name
)
for
deck
in
decks
found_deck
=
deck
if
deck_name_match
(
deck
,
client
.
name
)
if
found_deck
found_deck
=
deck
deck_text
=
fs
.
readFileSync
(
settings
.
modules
.
tournament_mode
.
deck_path
+
found_deck
,{
encoding
:
"ASCII"
})
if
found_deck
deck_array
=
deck_text
.
split
(
"
\n
"
)
deck_text
=
await
fs
.
promises
.
readFile
(
settings
.
modules
.
tournament_mode
.
deck_path
+
found_deck
,{
encoding
:
"ASCII"
})
deck_main
=
[]
deck_array
=
deck_text
.
split
(
"
\n
"
)
deck_side
=
[]
deck_main
=
[]
current_deck
=
deck_main
deck_side
=
[]
for
line
in
deck_array
current_deck
=
deck_main
if
line
.
indexOf
(
"!side"
)
>=
0
for
line
in
deck_array
current_deck
=
deck_side
if
line
.
indexOf
(
"!side"
)
>=
0
card
=
parseInt
(
line
)
current_deck
=
deck_side
current_deck
.
push
(
card
)
unless
isNaN
(
card
)
card
=
parseInt
(
line
)
if
_
.
isEqual
(
buff_main
,
deck_main
)
and
_
.
isEqual
(
buff_side
,
deck_side
)
current_deck
.
push
(
card
)
unless
isNaN
(
card
)
deckbuf
=
deck_main
.
concat
(
deck_side
)
if
_
.
isEqual
(
buff_main
,
deck_main
)
and
_
.
isEqual
(
buff_side
,
deck_side
)
struct
.
set
(
"mainc"
,
deck_main
.
length
)
deckbuf
=
deck_main
.
concat
(
deck_side
)
struct
.
set
(
"sidec"
,
deck_side
.
length
)
struct
.
set
(
"mainc"
,
deck_main
.
length
)
struct
.
set
(
"deckbuf"
,
deckbuf
)
struct
.
set
(
"sidec"
,
deck_side
.
length
)
buffer
=
struct
.
buffer
struct
.
set
(
"deckbuf"
,
deckbuf
)
#log.info("deck ok: " + client.name)
buffer
=
struct
.
buffer
ygopro
.
stoc_send_chat
(
client
,
"${deck_correct_part1}
#{
found_deck
}
${deck_correct_part2}"
,
ygopro
.
constants
.
COLORS
.
BABYBLUE
)
#log.info("deck ok: " + client.name)
ygopro
.
stoc_send_chat
(
client
,
"${deck_correct_part1}
#{
found_deck
}
${deck_correct_part2}"
,
ygopro
.
constants
.
COLORS
.
BABYBLUE
)
else
#log.info("bad deck: " + client.name + " / " + buff_main + " / " + buff_side)
ygopro
.
stoc_send_chat
(
client
,
"${deck_incorrect_part1}
#{
found_deck
}
${deck_incorrect_part2}"
,
ygopro
.
constants
.
COLORS
.
RED
)
else
else
#log.info("bad deck: " + client.name + " / " + buff_main + " / " + buff_side)
#log.info("player deck not found: " + client.name)
ygopro
.
stoc_send_chat
(
client
,
"${deck_incorrect_part1}
#{
found_deck
}
${deck_incorrect_part2}"
,
ygopro
.
constants
.
COLORS
.
RED
)
ygopro
.
stoc_send_chat
(
client
,
"
#{
client
.
name
}
${deck_not_found}"
,
ygopro
.
constants
.
COLORS
.
RED
)
else
#log.info("player deck not found: " + client.name)
ygopro
.
stoc_send_chat
(
client
,
"
#{
client
.
name
}
${deck_not_found}"
,
ygopro
.
constants
.
COLORS
.
RED
)
await
return
false
await
return
false
ygopro
.
ctos_follow
'RESPONSE'
,
false
,
(
buffer
,
info
,
client
,
server
,
datas
)
->
ygopro
.
ctos_follow
'RESPONSE'
,
false
,
(
buffer
,
info
,
client
,
server
,
datas
)
->
...
@@ -3908,7 +3909,7 @@ if true
...
@@ -3908,7 +3909,7 @@ if true
response
.
end
(
addCallback
(
u
.
query
.
callback
,
"['密码错误', 0]"
))
response
.
end
(
addCallback
(
u
.
query
.
callback
,
"['密码错误', 0]"
))
return
return
death_room_found
=
false
death_room_found
=
false
_async
.
each
(
rooms
,
(
room
,
done
)
->
_async
.
each
(
ROOM_all
,
(
room
,
done
)
->
if
!
(
room
and
(
u
.
query
.
deathcancel
==
"all"
or
u
.
query
.
deathcancel
==
room
.
process_pid
.
toString
()
or
u
.
query
.
deathcancel
==
room
.
name
))
if
!
(
room
and
(
u
.
query
.
deathcancel
==
"all"
or
u
.
query
.
deathcancel
==
room
.
process_pid
.
toString
()
or
u
.
query
.
deathcancel
==
room
.
name
))
done
()
done
()
return
return
...
...
ygopro-server.js
View file @
94e878a7
...
@@ -783,7 +783,7 @@
...
@@ -783,7 +783,7 @@
var
memoryInfo
,
percentUsed
;
var
memoryInfo
,
percentUsed
;
memoryInfo
=
(
await
osu
.
mem
.
info
());
memoryInfo
=
(
await
osu
.
mem
.
info
());
percentUsed
=
100
-
memoryInfo
.
freeMemPercentage
;
percentUsed
=
100
-
memoryInfo
.
freeMemPercentage
;
console
.
log
(
percentUsed
);
// console.log(percentUsed)
memory_usage
=
global
.
memory_usage
=
percentUsed
;
memory_usage
=
global
.
memory_usage
=
percentUsed
;
};
};
...
@@ -4421,52 +4421,54 @@
...
@@ -4421,52 +4421,54 @@
struct
.
set
(
"
deckbuf
"
,
[
4392470
,
4392470
]);
struct
.
set
(
"
deckbuf
"
,
[
4392470
,
4392470
]);
ygopro
.
stoc_send_chat
(
client
,
"
${deck_incorrect_reconnect}
"
,
ygopro
.
constants
.
COLORS
.
RED
);
ygopro
.
stoc_send_chat
(
client
,
"
${deck_incorrect_reconnect}
"
,
ygopro
.
constants
.
COLORS
.
RED
);
}
}
}
else
if
(
room
.
duel_stage
===
ygopro
.
constants
.
DUEL_STAGE
.
BEGIN
&&
room
.
hostinfo
.
mode
===
1
&&
settings
.
modules
.
tournament_mode
.
enabled
&&
settings
.
modules
.
tournament_mode
.
deck_check
&&
fs
.
readdirSync
(
settings
.
modules
.
tournament_mode
.
deck_path
).
length
)
{
}
else
if
(
room
.
duel_stage
===
ygopro
.
constants
.
DUEL_STAGE
.
BEGIN
&&
settings
.
modules
.
tournament_mode
.
enabled
&&
settings
.
modules
.
tournament_mode
.
deck_check
&&
fs
.
readdirSync
(
settings
.
modules
.
tournament_mode
.
deck_path
).
length
)
{
struct
.
set
(
"
mainc
"
,
1
);
decks
=
(
await
fs
.
promises
.
readdir
(
settings
.
modules
.
tournament_mode
.
deck_path
));
struct
.
set
(
"
sidec
"
,
1
);
if
(
decks
.
length
)
{
struct
.
set
(
"
deckbuf
"
,
[
4392470
,
4392470
]);
struct
.
set
(
"
mainc
"
,
1
);
buffer
=
struct
.
buffer
;
struct
.
set
(
"
sidec
"
,
1
);
found_deck
=
false
;
struct
.
set
(
"
deckbuf
"
,
[
4392470
,
4392470
]);
decks
=
fs
.
readdirSync
(
settings
.
modules
.
tournament_mode
.
deck_path
);
buffer
=
struct
.
buffer
;
for
(
j
=
0
,
len
=
decks
.
length
;
j
<
len
;
j
++
)
{
found_deck
=
false
;
deck
=
decks
[
j
];
for
(
j
=
0
,
len
=
decks
.
length
;
j
<
len
;
j
++
)
{
if
(
deck_name_match
(
deck
,
client
.
name
))
{
deck
=
decks
[
j
];
found_deck
=
deck
;
if
(
deck_name_match
(
deck
,
client
.
name
))
{
found_deck
=
deck
;
}
}
}
}
if
(
found_deck
)
{
if
(
found_deck
)
{
deck_text
=
(
await
fs
.
promises
.
readFile
(
settings
.
modules
.
tournament_mode
.
deck_path
+
found_deck
,
{
deck_text
=
fs
.
readFileSync
(
settings
.
modules
.
tournament_mode
.
deck_path
+
found_deck
,
{
encoding
:
"
ASCII
"
encoding
:
"
ASCII
"
}));
});
deck_array
=
deck_text
.
split
(
"
\n
"
);
deck_array
=
deck_text
.
split
(
"
\n
"
);
deck_main
=
[];
deck_main
=
[];
deck_side
=
[];
deck_side
=
[];
current_deck
=
deck_main
;
current_deck
=
deck_main
;
for
(
l
=
0
,
len1
=
deck_array
.
length
;
l
<
len1
;
l
++
)
{
for
(
l
=
0
,
len1
=
deck_array
.
length
;
l
<
len1
;
l
++
)
{
line
=
deck_array
[
l
];
line
=
deck_array
[
l
];
if
(
line
.
indexOf
(
"
!side
"
)
>=
0
)
{
if
(
line
.
indexOf
(
"
!side
"
)
>=
0
)
{
current_deck
=
deck_side
;
current_deck
=
deck_side
;
}
card
=
parseInt
(
line
);
if
(
!
isNaN
(
card
))
{
current_deck
.
push
(
card
);
}
}
}
card
=
parseInt
(
line
);
if
(
_
.
isEqual
(
buff_main
,
deck_main
)
&&
_
.
isEqual
(
buff_side
,
deck_side
))
{
if
(
!
isNaN
(
card
))
{
deckbuf
=
deck_main
.
concat
(
deck_side
);
current_deck
.
push
(
card
);
struct
.
set
(
"
mainc
"
,
deck_main
.
length
);
struct
.
set
(
"
sidec
"
,
deck_side
.
length
);
struct
.
set
(
"
deckbuf
"
,
deckbuf
);
buffer
=
struct
.
buffer
;
//log.info("deck ok: " + client.name)
ygopro
.
stoc_send_chat
(
client
,
`\${deck_correct_part1}
${
found_deck
}
\${deck_correct_part2}`
,
ygopro
.
constants
.
COLORS
.
BABYBLUE
);
}
else
{
//log.info("bad deck: " + client.name + " / " + buff_main + " / " + buff_side)
ygopro
.
stoc_send_chat
(
client
,
`\${deck_incorrect_part1}
${
found_deck
}
\${deck_incorrect_part2}`
,
ygopro
.
constants
.
COLORS
.
RED
);
}
}
}
if
(
_
.
isEqual
(
buff_main
,
deck_main
)
&&
_
.
isEqual
(
buff_side
,
deck_side
))
{
deckbuf
=
deck_main
.
concat
(
deck_side
);
struct
.
set
(
"
mainc
"
,
deck_main
.
length
);
struct
.
set
(
"
sidec
"
,
deck_side
.
length
);
struct
.
set
(
"
deckbuf
"
,
deckbuf
);
buffer
=
struct
.
buffer
;
//log.info("deck ok: " + client.name)
ygopro
.
stoc_send_chat
(
client
,
`\${deck_correct_part1}
${
found_deck
}
\${deck_correct_part2}`
,
ygopro
.
constants
.
COLORS
.
BABYBLUE
);
}
else
{
}
else
{
//log.info("
bad deck: " + client.name + " / " + buff_main + " / " + buff_sid
e)
//log.info("
player deck not found: " + client.nam
e)
ygopro
.
stoc_send_chat
(
client
,
`
\${deck_incorrect_part1}
${
found_deck
}
\${deck_incorrect_part2
}`
,
ygopro
.
constants
.
COLORS
.
RED
);
ygopro
.
stoc_send_chat
(
client
,
`
${
client
.
name
}
\${deck_not_found
}`
,
ygopro
.
constants
.
COLORS
.
RED
);
}
}
}
else
{
//log.info("player deck not found: " + client.name)
ygopro
.
stoc_send_chat
(
client
,
`
${
client
.
name
}
\${deck_not_found}`
,
ygopro
.
constants
.
COLORS
.
RED
);
}
}
}
}
return
false
;
return
false
;
...
@@ -5182,7 +5184,7 @@
...
@@ -5182,7 +5184,7 @@
return
;
return
;
}
}
death_room_found
=
false
;
death_room_found
=
false
;
_async
.
each
(
rooms
,
function
(
room
,
done
)
{
_async
.
each
(
ROOM_all
,
function
(
room
,
done
)
{
if
(
!
(
room
&&
(
u
.
query
.
deathcancel
===
"
all
"
||
u
.
query
.
deathcancel
===
room
.
process_pid
.
toString
()
||
u
.
query
.
deathcancel
===
room
.
name
)))
{
if
(
!
(
room
&&
(
u
.
query
.
deathcancel
===
"
all
"
||
u
.
query
.
deathcancel
===
room
.
process_pid
.
toString
()
||
u
.
query
.
deathcancel
===
room
.
name
)))
{
done
();
done
();
return
;
return
;
...
...
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