mirror of
https://github.com/jie65535/mirai-console-jhr-plugin.git
synced 2025-06-02 17:39:16 +08:00
增加 胜率统计
This commit is contained in:
parent
30eb1b2883
commit
55ce2defc9
@ -12,4 +12,10 @@ object JHRPluginData : AutoSavePluginData("HorseRacingPluginData") {
|
|||||||
|
|
||||||
@ValueDescription("用户统计")
|
@ValueDescription("用户统计")
|
||||||
val playerStat: MutableMap<Long, PlayerStatistics> by value()
|
val playerStat: MutableMap<Long, PlayerStatistics> by value()
|
||||||
|
|
||||||
|
@ValueDescription("总比赛场次")
|
||||||
|
var totalRankCount by value(0)
|
||||||
|
|
||||||
|
@ValueDescription("赛马获胜计数")
|
||||||
|
val horseWinCount: MutableList<Int> by value()
|
||||||
}
|
}
|
@ -159,14 +159,13 @@ object JHorseRacing : KotlinPlugin(
|
|||||||
}
|
}
|
||||||
val mb = MessageChainBuilder()
|
val mb = MessageChainBuilder()
|
||||||
for (winner in winners) {
|
for (winner in winners) {
|
||||||
|
// 增加该赛马胜场
|
||||||
|
JHRPluginData.horseWinCount[winner-1] += 1
|
||||||
mb.add(JHRPluginConfig.winnerMessage[Random.nextInt(JHRPluginConfig.winnerMessage.size)].replace("?", winner.toString()))
|
mb.add(JHRPluginConfig.winnerMessage[Random.nextInt(JHRPluginConfig.winnerMessage.size)].replace("?", winner.toString()))
|
||||||
mb.add("\n")
|
mb.add("\n")
|
||||||
}
|
}
|
||||||
// if (winners.size == 1) {
|
// 增加总赛马场次
|
||||||
// mb.add("${winners[0]} 最终赢得了胜利,让我们为它鼓掌")
|
JHRPluginData.totalRankCount += 1
|
||||||
// } else {
|
|
||||||
// mb.add("${winners.joinToString()} 一起赢得了胜利,让我们为它们鼓掌")
|
|
||||||
// }
|
|
||||||
ranks.remove(subject.id)
|
ranks.remove(subject.id)
|
||||||
val pool = pools.remove(subject.id)
|
val pool = pools.remove(subject.id)
|
||||||
if (pool != null && pool.size > 0) {
|
if (pool != null && pool.size > 0) {
|
||||||
@ -200,6 +199,11 @@ object JHorseRacing : KotlinPlugin(
|
|||||||
JHRPluginData.reload()
|
JHRPluginData.reload()
|
||||||
JHRCommand.register()
|
JHRCommand.register()
|
||||||
|
|
||||||
|
// 初始化赛马胜场计数器
|
||||||
|
while (JHRPluginData.horseWinCount.size < horseCount) {
|
||||||
|
JHRPluginData.horseWinCount.add(0)
|
||||||
|
}
|
||||||
|
|
||||||
val eventChannel = GlobalEventChannel.parentScope(this)
|
val eventChannel = GlobalEventChannel.parentScope(this)
|
||||||
eventChannel.subscribeAlways<GroupMessageEvent> {
|
eventChannel.subscribeAlways<GroupMessageEvent> {
|
||||||
val msg = message.contentToString()
|
val msg = message.contentToString()
|
||||||
@ -448,6 +452,14 @@ object JHorseRacing : KotlinPlugin(
|
|||||||
.append("ヾ(◍°∇°◍)ノ゙继续加油吧!")
|
.append("ヾ(◍°∇°◍)ノ゙继续加油吧!")
|
||||||
subject.sendMessage(ret.asMessageChain())
|
subject.sendMessage(ret.asMessageChain())
|
||||||
}
|
}
|
||||||
|
msg == "胜率" -> {
|
||||||
|
val ret = MessageChainBuilder()
|
||||||
|
for (i in 0 until horseCount) {
|
||||||
|
ret.append("${horseLogo}${i+1} ${JHRPluginData.horseWinCount[i]}/${JHRPluginData.totalRankCount}\n")
|
||||||
|
}
|
||||||
|
if (ret.isNotEmpty())
|
||||||
|
subject.sendMessage(ret.asMessageChain())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,8 +1,26 @@
|
|||||||
package top.jie65535.jhr.game
|
package top.jie65535.jhr.game
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 玩家数据统计
|
||||||
|
*/
|
||||||
class PlayerStatistics {
|
class PlayerStatistics {
|
||||||
|
/**
|
||||||
|
* 下注次数
|
||||||
|
*/
|
||||||
var betCount = 0
|
var betCount = 0
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 胜利次数
|
||||||
|
*/
|
||||||
var winCount = 0
|
var winCount = 0
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 贡献次数(增加词条次数)
|
||||||
|
*/
|
||||||
var contribution = 0
|
var contribution = 0
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 签到次数
|
||||||
|
*/
|
||||||
var signCount = 0
|
var signCount = 0
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user