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
2e5e115b
Commit
2e5e115b
authored
Feb 22, 2026
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add no_watch
parent
cc0fba76
Pipeline
#43388
passed with stages
in 3 minutes and 21 seconds
Changes
8
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
41 additions
and
2 deletions
+41
-2
config.example.yaml
config.example.yaml
+2
-0
src/constants/trans.ts
src/constants/trans.ts
+2
-0
src/join-handlers/join-roomlist.ts
src/join-handlers/join-roomlist.ts
+3
-2
src/room/default-hostinfo-provder.ts
src/room/default-hostinfo-provder.ts
+3
-0
src/room/default-hostinfo.ts
src/room/default-hostinfo.ts
+2
-0
src/room/no-watch-to-observer-guard.ts
src/room/no-watch-to-observer-guard.ts
+18
-0
src/room/room-module.ts
src/room/room-module.ts
+2
-0
src/room/room.ts
src/room/room.ts
+9
-0
No files found.
config.example.yaml
View file @
2e5e115b
...
...
@@ -110,3 +110,5 @@ hostinfoStartLp: 8000
hostinfoStartHand
:
5
hostinfoDrawCount
:
1
hostinfoTimeLimit
:
240
hostinfoNoWatch
:
0
hostinfoAutoDeath
:
0
src/constants/trans.ts
View file @
2e5e115b
...
...
@@ -178,6 +178,8 @@ export const TRANSLATIONS = {
botlist_menu_single
:
'
Single
'
,
botlist_menu_match
:
'
Match
'
,
botlist_menu_back
:
'
Back
'
,
watch_denied
:
'
Duel has begun, spectating is unallowed
'
,
watch_denied_room
:
'
Spectating is unallowed in this room
'
,
},
'
zh-CN
'
:
{
update_required
:
'
请更新你的客户端版本
'
,
...
...
src/join-handlers/join-roomlist.ts
View file @
2e5e115b
...
...
@@ -34,8 +34,9 @@ export class JoinRoomlist {
.
filter
(
(
room
)
=>
(
room
.
native
||
(
room
.
duelStage
!==
DuelStage
.
Begin
&&
room
.
challongeInfo
))
&&
!
room
.
name
.
includes
(
'
$
'
),
(
room
.
duelStage
!==
DuelStage
.
Begin
&&
!
room
.
windbot
))
&&
!
room
.
name
.
includes
(
'
$
'
)
&&
!
(
room
.
duelStage
!==
DuelStage
.
Begin
&&
room
.
hostinfo
?.
no_watch
),
)
.
map
((
room
)
=>
room
.
name
);
...
...
src/room/default-hostinfo-provder.ts
View file @
2e5e115b
...
...
@@ -258,6 +258,9 @@ export class DefaultHostInfoProvider {
return
{};
}
return
{
duel_rule
:
duelRule
};
})
.
registerRoomMode
(
'
(NOWATCH|NW)
'
,
{
no_watch
:
1
,
});
}
}
src/room/default-hostinfo.ts
View file @
2e5e115b
...
...
@@ -11,4 +11,6 @@ export const DefaultHostinfo: HostInfo = {
start_hand
:
5
,
draw_count
:
1
,
time_limit
:
240
,
no_watch
:
0
,
auto_death
:
0
,
};
src/room/no-watch-to-observer-guard.ts
0 → 100644
View file @
2e5e115b
import
{
YGOProCtosHsToObserver
,
ChatColor
}
from
'
ygopro-msg-encode
'
;
import
{
Context
}
from
'
../app
'
;
import
{
RoomManager
}
from
'
./room-manager
'
;
export
class
NoWatchToObserverGuard
{
constructor
(
private
ctx
:
Context
)
{}
async
init
()
{
this
.
ctx
.
middleware
(
YGOProCtosHsToObserver
,
async
(
_msg
,
client
,
next
)
=>
{
const
room
=
this
.
ctx
.
get
(()
=>
RoomManager
).
findByName
(
client
.
roomName
);
if
(
!
room
?.
hostinfo
?.
no_watch
)
{
return
next
();
}
await
client
.
sendChat
(
'
#{watch_denied_room}
'
,
ChatColor
.
BABYBLUE
);
return
;
});
}
}
src/room/room-module.ts
View file @
2e5e115b
...
...
@@ -5,6 +5,7 @@ import { DefaultHostInfoProvider } from './default-hostinfo-provder';
import
{
RoomManager
}
from
'
./room-manager
'
;
import
{
DefaultDeckChecker
}
from
'
./default-deck-checker
'
;
import
{
ZombieRoomCleaner
}
from
'
./zombie-room-cleaner
'
;
import
{
NoWatchToObserverGuard
}
from
'
./no-watch-to-observer-guard
'
;
export
const
RoomModule
=
createAppContext
<
ContextState
>
()
.
provide
(
DefaultHostInfoProvider
)
...
...
@@ -12,4 +13,5 @@ export const RoomModule = createAppContext<ContextState>()
.
provide
(
RoomManager
)
.
provide
(
DefaultDeckChecker
)
.
provide
(
ZombieRoomCleaner
)
.
provide
(
NoWatchToObserverGuard
)
.
define
();
src/room/room.ts
View file @
2e5e115b
...
...
@@ -109,6 +109,12 @@ import cryptoRandomString from 'crypto-random-string';
import
{
RoomCurrentFieldInfo
,
RoomInfo
}
from
'
./room-info
'
;
import
{
KoishiFragment
,
readCardWithReader
}
from
'
../utility
'
;
declare
module
'
ygopro-msg-encode
'
{
export
interface
HostInfo
{
no_watch
?:
number
;
}
}
const
{
OcgcoreScriptConstants
}
=
_OcgcoreConstants
;
export
type
RoomFinalizor
=
(
self
:
Room
)
=>
Awaitable
<
any
>
;
...
...
@@ -388,6 +394,9 @@ export class Room {
if
(
isPlayer
)
{
this
.
players
[
firstEmptyPlayerSlot
]
=
client
;
client
.
pos
=
firstEmptyPlayerSlot
;
}
else
if
(
this
.
hostinfo
.
no_watch
)
{
// not allowing watchers
return
client
.
die
(
'
#{watch_denied}
'
,
ChatColor
.
RED
);
}
else
{
this
.
watchers
.
add
(
client
);
client
.
pos
=
NetPlayerType
.
OBSERVER
;
...
...
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