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
6a196468
Commit
6a196468
authored
Feb 17, 2026
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add low lp hint
parent
641611fe
Pipeline
#43293
passed with stages
in 2 minutes and 17 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
68 additions
and
0 deletions
+68
-0
src/constants/trans.ts
src/constants/trans.ts
+4
-0
src/feats/feats-module.ts
src/feats/feats-module.ts
+2
-0
src/feats/lp-low-hint-service.ts
src/feats/lp-low-hint-service.ts
+62
-0
No files found.
src/constants/trans.ts
View file @
6a196468
...
...
@@ -129,6 +129,8 @@ export const TRANSLATIONS = {
cloud_replay_menu_play
:
'
Play Cloud Replay
'
,
cloud_replay_menu_download_yrp
:
'
Download YRP Replay
'
,
cloud_replay_menu_back
:
'
Back
'
,
lp_low_opponent
:
'
もはやお前のライフは風前の灯!
'
,
lp_low_self
:
'
*Low LP Alert*
'
,
botlist_menu_single
:
'
Single
'
,
botlist_menu_match
:
'
Match
'
,
botlist_menu_back
:
'
Back
'
,
...
...
@@ -254,6 +256,8 @@ export const TRANSLATIONS = {
cloud_replay_menu_play
:
'
播放云录像
'
,
cloud_replay_menu_download_yrp
:
'
下载 YRP 录像
'
,
cloud_replay_menu_back
:
'
返回
'
,
lp_low_opponent
:
'
你的生命已经如风中残烛了!
'
,
lp_low_self
:
'
背水一战!
'
,
botlist_menu_single
:
'
单局
'
,
botlist_menu_match
:
'
比赛
'
,
botlist_menu_back
:
'
返回
'
,
...
...
src/feats/feats-module.ts
View file @
6a196468
...
...
@@ -15,6 +15,7 @@ import { HidePlayerNameProvider } from './hide-player-name-provider';
import
{
CommandsService
,
KoishiContextService
}
from
'
../koishi
'
;
import
{
ChatgptService
}
from
'
./chatgpt-service
'
;
import
{
CloudReplayService
}
from
'
./cloud-replay
'
;
import
{
LpLowHintService
}
from
'
./lp-low-hint-service
'
;
export
const
FeatsModule
=
createAppContext
<
ContextState
>
()
.
provide
(
ClientKeyProvider
)
...
...
@@ -27,6 +28,7 @@ export const FeatsModule = createAppContext<ContextState>()
.
provide
(
PlayerStatusNotify
)
.
provide
(
CloudReplayService
)
// persist duel records
.
provide
(
ChatgptService
)
// AI-room chat replies
.
provide
(
LpLowHintService
)
// low LP hint in duel
.
provide
(
RefreshFieldService
)
.
provide
(
Reconnect
)
.
provide
(
WaitForPlayerProvider
)
// chat refresh
...
...
src/feats/lp-low-hint-service.ts
0 → 100644
View file @
6a196468
import
{
ChatColor
,
YGOProMsgDamage
,
YGOProMsgPayLpCost
}
from
'
ygopro-msg-encode
'
;
import
{
Context
}
from
'
../app
'
;
import
{
Client
}
from
'
../client
'
;
import
{
RoomManager
}
from
'
../room
'
;
export
class
LpLowHintService
{
private
roomManager
=
this
.
ctx
.
get
(()
=>
RoomManager
);
constructor
(
private
ctx
:
Context
)
{
this
.
ctx
.
middleware
(
YGOProMsgDamage
,
async
(
msg
,
client
,
next
)
=>
{
await
this
.
trySendLowLpHint
(
msg
.
player
,
client
,
'
#{lp_low_opponent}
'
);
return
next
();
});
this
.
ctx
.
middleware
(
YGOProMsgPayLpCost
,
async
(
msg
,
client
,
next
)
=>
{
await
this
.
trySendLowLpHint
(
msg
.
player
,
client
,
'
#{lp_low_self}
'
);
return
next
();
});
}
private
async
trySendLowLpHint
(
playerPos
:
number
,
client
:
Client
,
hintText
:
string
,
)
{
const
room
=
this
.
resolveRoom
(
client
);
if
(
!
room
)
{
return
;
}
const
fieldInfo
=
await
room
.
getCurrentFieldInfo
();
if
(
!
fieldInfo
?.
length
)
{
return
;
}
if
(
!
Number
.
isInteger
(
playerPos
)
||
playerPos
<
0
||
playerPos
>=
fieldInfo
.
length
)
{
return
;
}
const
lp
=
fieldInfo
[
playerPos
]?.
lp
;
if
(
typeof
lp
!==
'
number
'
||
lp
<=
0
||
lp
>
100
)
{
return
;
}
await
room
.
sendChat
(
hintText
,
ChatColor
.
PINK
);
}
private
resolveRoom
(
client
:
Client
)
{
if
(
!
client
.
roomName
)
{
return
undefined
;
}
const
room
=
this
.
roomManager
.
findByName
(
client
.
roomName
);
if
(
!
room
||
room
.
finalizing
)
{
return
undefined
;
}
return
room
;
}
}
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