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
c0d4a60be2
commit
3936b8d63c
@ -180,6 +180,7 @@ object JHorseRacing : KotlinPlugin(
|
|||||||
for (bet in pool) {
|
for (bet in pool) {
|
||||||
val score = JHRPluginData.Scores[bet.id]!!
|
val score = JHRPluginData.Scores[bet.id]!!
|
||||||
val stat = getPlayerStat(bet.id)
|
val stat = getPlayerStat(bet.id)
|
||||||
|
stat.betCount += 1
|
||||||
stat.totalBetScore += bet.score
|
stat.totalBetScore += bet.score
|
||||||
val income = if (winners.indexOf(bet.number) != -1) {
|
val income = if (winners.indexOf(bet.number) != -1) {
|
||||||
stat.winCount += 1
|
stat.winCount += 1
|
||||||
@ -190,10 +191,13 @@ object JHorseRacing : KotlinPlugin(
|
|||||||
JHRPluginData.Scores[bet.id] = score + income
|
JHRPluginData.Scores[bet.id] = score + income
|
||||||
mb.add("\n")
|
mb.add("\n")
|
||||||
mb.add(At(bet.id))
|
mb.add(At(bet.id))
|
||||||
if (income > 0)
|
if (income > 0) {
|
||||||
mb.add(" +$income")
|
mb.add(" +$income")
|
||||||
else
|
stat.totalWinScore += income
|
||||||
|
} else {
|
||||||
mb.add(" $income")
|
mb.add(" $income")
|
||||||
|
stat.totalLossScore += income
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
subject.sendMessage(mb.asMessageChain())
|
subject.sendMessage(mb.asMessageChain())
|
||||||
@ -315,7 +319,8 @@ object JHorseRacing : KotlinPlugin(
|
|||||||
return@subscribeAlways
|
return@subscribeAlways
|
||||||
}
|
}
|
||||||
|
|
||||||
getPlayerStat(sender.id).betCount += 1
|
// 结算时再计数
|
||||||
|
// getPlayerStat(sender.id).betCount += 1
|
||||||
pool.add(Bet(sender.id, no, coin))
|
pool.add(Bet(sender.id, no, coin))
|
||||||
subject.sendMessage(JHRPluginConfig.betMessage[Random.nextInt(JHRPluginConfig.betMessage.size)].replace("?", no.toString()))
|
subject.sendMessage(JHRPluginConfig.betMessage[Random.nextInt(JHRPluginConfig.betMessage.size)].replace("?", no.toString()))
|
||||||
}
|
}
|
||||||
@ -454,6 +459,28 @@ object JHorseRacing : KotlinPlugin(
|
|||||||
}
|
}
|
||||||
subject.sendMessage(msgB.asMessageChain())
|
subject.sendMessage(msgB.asMessageChain())
|
||||||
}
|
}
|
||||||
|
msg == "白给榜" -> {
|
||||||
|
val msgB = MessageChainBuilder(11)
|
||||||
|
msgB.append("白给榜\n")
|
||||||
|
JHRPluginData.playerStat.entries.filter { subject.contains(it.key) }
|
||||||
|
.sortedByDescending { it.value.totalLossScore }
|
||||||
|
.take(10)
|
||||||
|
.onEach {
|
||||||
|
msgB.append("| ${it.value.totalLossScore} | ${subject[it.key]!!.nameCardOrNick}\n")
|
||||||
|
}
|
||||||
|
subject.sendMessage(msgB.asMessageChain())
|
||||||
|
}
|
||||||
|
msg == "收益榜" -> {
|
||||||
|
val msgB = MessageChainBuilder(11)
|
||||||
|
msgB.append("收益榜\n")
|
||||||
|
JHRPluginData.playerStat.entries.filter { subject.contains(it.key) }
|
||||||
|
.sortedByDescending { it.value.totalWinScore }
|
||||||
|
.take(10)
|
||||||
|
.onEach {
|
||||||
|
msgB.append("| ${it.value.totalWinScore} | ${subject[it.key]!!.nameCardOrNick}\n")
|
||||||
|
}
|
||||||
|
subject.sendMessage(msgB.asMessageChain())
|
||||||
|
}
|
||||||
msg == "统计" -> {
|
msg == "统计" -> {
|
||||||
val ret = MessageChainBuilder()
|
val ret = MessageChainBuilder()
|
||||||
ret.append(message.quote())
|
ret.append(message.quote())
|
||||||
|
@ -31,11 +31,23 @@ class PlayerStatistics {
|
|||||||
*/
|
*/
|
||||||
var totalBetScore = 0
|
var totalBetScore = 0
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获胜积分累计
|
||||||
|
*/
|
||||||
|
var totalWinScore = 0
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 失败积分累计
|
||||||
|
*/
|
||||||
|
var totalLossScore = 0
|
||||||
|
|
||||||
override fun toString(): String {
|
override fun toString(): String {
|
||||||
return "下注次数:${betCount}\n" +
|
return "下注次数:${betCount}\n" +
|
||||||
"获胜次数:${winCount}\n" +
|
"获胜次数:${winCount}\n" +
|
||||||
"贡献次数:${contribution}\n" +
|
"贡献次数:${contribution}\n" +
|
||||||
"签到次数:${signCount}\n" +
|
"签到次数:${signCount}\n" +
|
||||||
"下注积分:${totalBetScore}"
|
"下注积分:${totalBetScore}\n" +
|
||||||
|
"收益:${totalWinScore}\n" +
|
||||||
|
"亏损:${totalLossScore}"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user