fix: 调整邀请码

This commit is contained in:
叁玖领域 2026-06-04 02:24:18 +08:00
parent a36c44a63e
commit 7ec5cb559e
9 changed files with 79 additions and 28 deletions

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="AndroidProjectSystem">
<option name="providerId" value="com.android.tools.idea.GradleProjectSystem" />
</component>
</project>

View File

@ -4,13 +4,14 @@
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="distributionType" value="LOCAL" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleHome" value="$PROJECT_DIR$/../../projEnv/gradle/gradle-8.7" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
</set>
</option>
<option name="myGradleHome" value="G:\projEnv\gradle\gradle-8.7" />
</GradleProjectSettings>
</option>
</component>

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="MaterialThemeProjectNewConfig">
<option name="metadata">
<MTProjectMetadataState>
<option name="userId" value="43b882ab:19e8e7ab67a:-7ff2" />
</MTProjectMetadataState>
</option>
</component>
</project>

View File

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="SqlDialectMappings">
<file url="file://$PROJECT_DIR$/src/main/kotlin/top/r3944realms/ltdmanager/module/GroupRequestHandlerModule.kt" dialect="GenericSQL" />
<file url="file://$PROJECT_DIR$/src/main/resources/init.sql" dialect="MySQL" />
<file url="PROJECT" dialect="MySQL" />
</component>
</project>

View File

@ -3,5 +3,5 @@ org.gradle.downloadSources=false
org.gradle.parallel=true
org.gradle.degree_of_parallelism=16
project_group=top.r3944realms.ltdmanager
project_version=1.17-SNAPSHOT
project_version=1.19-SNAPSHOT
dg_lab_version=4.4.14.19

View File

@ -43,7 +43,7 @@ class GameClientOperation(
var clientSelf: DGPBClientManager? = null
private var hasBinding = false
private var bindingTimeoutJob: kotlinx.coroutines.Job? = null // 保存倒计时任务
var info: ClientManager.ClientStrengthInfo? = null
override fun ClientStartingHandler() {
LoggerUtil.logger.debug("Player $playerId is starting the client...")
scope.launch {
@ -245,19 +245,19 @@ class GameClientOperation(
// }
when (p0?.commandType) {
PowerBoxDataType.STRENGTH -> scope.launch {
// val strengthInfo : IPowerBoxMsg.StrengthInfo
//
// strengthInfo = IPowerBoxMsg.StrengthInfo.read(
// PowerBoxMessage.createPowerBoxMessage(
// p0,
// MessageDirection.of(
// MessageDirection.DirectType.PLACEHOLDER_TO_PLACEHOLDER,
// ROM_UUID,
// ROM_UUID
// )
// )
// )
val strengthInfo : IPowerBoxMsg.StrengthInfo
strengthInfo = IPowerBoxMsg.StrengthInfo.read(
PowerBoxMessage.createPowerBoxMessage(
p0,
MessageDirection.of(
MessageDirection.DirectType.PLACEHOLDER_TO_PLACEHOLDER,
ROM_UUID,
ROM_UUID
)
)
)
info = ClientManager.ClientStrengthInfo(strengthInfo.aValue, strengthInfo.aMax, strengthInfo.bValue, strengthInfo.bMax)
// napCatClient.sendUnit(SendPrivateMsgRequest(listOf(MessageElement.text("强度信息:\n A:${strengthInfo.aValue}/${strengthInfo.aMax} \n B:${strengthInfo.bValue}/${strengthInfo.bMax}")), ID.long(playerId)))
}
PowerBoxDataType.PULSE -> scope.launch {

View File

@ -350,7 +350,7 @@ class DGLabModule(
private var dgLabState = loadState()
override fun getState(): DgLabState = dgLabState
override fun getStateFileInternal(): File = stateFile
private var refreshJob: Job? = null
private val triggerFilter by lazy {
TriggerMessageFilter(
listOf(
@ -377,9 +377,16 @@ class DGLabModule(
if (loaded) handleMessages(messages)
}
}
refreshJob = scope!!.launch {
while (isActive) {
delay(30 * 1000L) // 30秒
refreshPlayerList()
}
}
}
override suspend fun onUnload() {
saveState(dgLabState)
refreshJob?.cancel()
dgLabManager?.close()
scope?.cancel()
LoggerUtil.logger.info("[$name] 模块已卸载完成")
@ -502,6 +509,40 @@ class DGLabModule(
.associate { it.userId to it.nickname })
dgLabManager?.initClientManager()
}
private suspend fun refreshPlayerList() {
try {
val getGroupMemberListEvent = napCatClient.send<GetGroupMemberListEvent>(
GetGroupMemberListRequest(
ID.long(groupMessagePollingModule.targetGroupId),
false
)
)
val currentMembers = getGroupMemberListEvent.data.filter { !it.isRobot }
.associate { it.userId to it.nickname }
val playerManager = dgLabManager?.getPlayerManager() ?: return
// 获取当前玩家列表
val existingPlayers = playerManager.allPlayers().map { it.id }.toSet()
val targetPlayers = currentMembers.keys.toSet()
// 新增玩家
(targetPlayers - existingPlayers).forEach { id ->
playerManager.addPlayer(Player(id, currentMembers[id] ?: id.toString(), false))
LoggerUtil.logger.info("[$name] 定时刷新 - 新增玩家: $id")
}
// 移除不存在的玩家
(existingPlayers - targetPlayers).forEach { id ->
playerManager.removePlayer(id)
dgLabManager?.removeClient(id.toString())
LoggerUtil.logger.info("[$name] 定时刷新 - 移除玩家: $id")
}
} catch (e: Exception) {
LoggerUtil.logger.error("[$name] 刷新玩家列表失败", e)
}
}
// private fun getHelp(): Int {
// scope?.launch {
// sendMessage()

View File

@ -76,7 +76,7 @@ class InvitationCodesModule(
private val mailModule: MailModule,
private val apiToken: String,
selfId: Long,
private val cooldownMillis: Long = 120_000,
private val cooldownMillis: Long = 120_000L,
private val keywords: Set<String> = setOf("申请邀请码")
) : BaseModule(Modules.INVITATION_CODE, moduleName), PersistentState<InvitationCodesModule.LastTriggerMapState> {
@ -448,9 +448,10 @@ class InvitationCodesModule(
if (response.response is InvitationCodeGenerationResponse) {
if (response.response.success) {
response.response.data
} else
} else {
LoggerUtil.logger.warn("[$name] API返回失败: ${response.response.message}")
null
}
} else {
LoggerUtil.logger.warn("[$name] 返回非预期对象类型: ${response.response.javaClass}")
null

View File

@ -93,7 +93,7 @@
</div>
<p>请点击下方按钮前往注册:</p>
<a href="https://skins.r3944realms.top/auth/register" class="button">皮肤站注册</a>
<a href="https://skins.bot.leisuretimedock.top/auth/register" class="button">皮肤站注册</a>
<p style="margin-top:25px;">如有任何问题,欢迎随时联系我们的
<a href="mailto:f256198830@hotmail.com" style="color:#0066cc;">技术支持</a>