Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
S
srvpro2
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
srvpro2
Commits
89ff66d0
Commit
89ff66d0
authored
Feb 14, 2026
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
support tag match
parent
79b2e3f7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
4 deletions
+29
-4
src/room/default-hostinfo-provder.ts
src/room/default-hostinfo-provder.ts
+27
-2
src/room/room.ts
src/room/room.ts
+2
-2
No files found.
src/room/default-hostinfo-provder.ts
View file @
89ff66d0
...
@@ -2,6 +2,23 @@ import { HostInfo } from 'ygopro-msg-encode';
...
@@ -2,6 +2,23 @@ import { HostInfo } from 'ygopro-msg-encode';
import
{
Context
}
from
'
../app
'
;
import
{
Context
}
from
'
../app
'
;
import
{
DefaultHostinfo
}
from
'
./default-hostinfo
'
;
import
{
DefaultHostinfo
}
from
'
./default-hostinfo
'
;
const
TAG_MODE_BIT
=
0x2
;
const
MATCH_WINS_BITS_MASK
=
0xfd
;
const
encodeWinMatchCountBits
=
(
winMatchCount
:
number
):
number
=>
{
// room.ts decode: ((mode & 0x1) | ((mode & 0xfc) >>> 1)) + 1
const
value
=
Math
.
max
(
1
,
winMatchCount
)
-
1
;
return
(
value
&
0x1
)
|
((
value
&
0x7e
)
<<
1
);
};
const
setTagBit
=
(
mode
:
number
,
isTag
:
boolean
):
number
=>
isTag
?
mode
|
TAG_MODE_BIT
:
mode
&
~
TAG_MODE_BIT
;
const
setWinMatchCountBits
=
(
mode
:
number
,
winMatchCount
:
number
):
number
=>
{
const
nonTagBits
=
encodeWinMatchCountBits
(
winMatchCount
)
&
MATCH_WINS_BITS_MASK
;
return
(
mode
&
TAG_MODE_BIT
)
|
nonTagBits
;
};
export
class
DefaultHostInfoProvider
{
export
class
DefaultHostInfoProvider
{
constructor
(
private
ctx
:
Context
)
{}
constructor
(
private
ctx
:
Context
)
{}
...
@@ -70,12 +87,20 @@ export class DefaultHostInfoProvider {
...
@@ -70,12 +87,20 @@ export class DefaultHostInfoProvider {
const
rule
=
rulePrefix
[
1
].
toUpperCase
();
const
rule
=
rulePrefix
[
1
].
toUpperCase
();
if
(
/
(
^|,|,
)(
M|MATCH
)(
,|,|$
)
/
.
test
(
rule
))
{
if
(
/
(
^|,|,
)(
M|MATCH
)(
,|,|$
)
/
.
test
(
rule
))
{
hostinfo
.
mode
=
1
;
hostinfo
.
mode
=
setWinMatchCountBits
(
hostinfo
.
mode
,
2
)
;
}
}
if
(
/
(
^|,|,
)(
T|TAG
)(
,|,|$
)
/
.
test
(
rule
))
{
if
(
/
(
^|,|,
)(
T|TAG
)(
,|,|$
)
/
.
test
(
rule
))
{
hostinfo
.
mode
=
2
;
hostinfo
.
mode
=
setTagBit
(
hostinfo
.
mode
,
true
)
;
hostinfo
.
start_lp
=
defaultHostinfo
.
start_lp
*
2
;
hostinfo
.
start_lp
=
defaultHostinfo
.
start_lp
*
2
;
}
}
const
boParam
=
rule
.
match
(
/
(
^|,|,
)
BO
(\d
+
)(
,|,|$
)
/
);
if
(
boParam
)
{
const
bo
=
Number
.
parseInt
(
boParam
[
2
],
10
);
// only odd BOx is valid (e.g. BO1/3/5...)
if
(
!
Number
.
isNaN
(
bo
)
&&
bo
>
0
&&
bo
%
2
===
1
)
{
hostinfo
.
mode
=
setWinMatchCountBits
(
hostinfo
.
mode
,
(
bo
+
1
)
/
2
);
}
}
if
(
/
(
^|,|,
)(
OOR|OCGONLYRANDOM
)(
,|,|$
)
/
.
test
(
rule
))
{
if
(
/
(
^|,|,
)(
OOR|OCGONLYRANDOM
)(
,|,|$
)
/
.
test
(
rule
))
{
hostinfo
.
rule
=
0
;
hostinfo
.
rule
=
0
;
hostinfo
.
lflist
=
0
;
hostinfo
.
lflist
=
0
;
...
...
src/room/room.ts
View file @
89ff66d0
...
@@ -117,10 +117,10 @@ export class Room {
...
@@ -117,10 +117,10 @@ export class Room {
}
}
get
isTag
()
{
get
isTag
()
{
return
this
.
hostinfo
.
mode
===
2
;
return
(
this
.
hostinfo
.
mode
&
0x2
)
!==
0
;
}
}
players
=
new
Array
<
Client
|
undefined
>
(
this
.
hostinfo
.
mode
===
2
?
4
:
2
);
players
=
new
Array
<
Client
|
undefined
>
(
this
.
isTag
?
4
:
2
);
watchers
=
new
Set
<
Client
>
();
watchers
=
new
Set
<
Client
>
();
get
playingPlayers
()
{
get
playingPlayers
()
{
return
this
.
players
.
filter
((
p
)
=>
p
)
as
Client
[];
return
this
.
players
.
filter
((
p
)
=>
p
)
as
Client
[];
...
...
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