fix: 修复分数计算得多位小数的问题。

main
NorthLan 3 years ago
parent 2ec0ceb880
commit 14b460760f

@ -10,7 +10,6 @@ Etcd:
NonBlock: true
Log:
Mode: console
Path: logs/live-service
KeepDays: 7
Level: info
DB:

@ -9,28 +9,31 @@ Etcd:
NonBlock: true
Log:
Mode: file
Path: logs/user_center
KeepDays: 7
Level: info
DB:
#DataSource: root:root@tcp(192.168.1.100:3306)/dmgame?charset=utf8mb4&loc=Asia%2FShanghai&parseTime=true
DataSource: root:root@tcp(127.0.0.1:3306)/dmgame?charset=utf8mb4&loc=Asia%2FShanghai&parseTime=true
Kafka:
UserNotify:
UserCoinNotify:
Addr: [ "127.0.0.1:9093" ]
Topic: "notify-user"
Topic: "notify-user-coin"
RankUpdate:
Addr: [ "127.0.0.1:9093" ]
Topic: "rank-update"
RewardPool:
Addr: [ "127.0.0.1:9093" ]
Topic: "rewardPool"
UserRetriever:
Enabled: true
UpdateDuration: 720 # 720 hours = 30 Day = 1 Month
NobilityPlatforms: [ "bilibili" ] # 需要获取贵族的平台列表
Cron:
PlatformUser: "0 0/5 * * * ?" # 每隔5分钟执行一次
Nobility: "0 0/10 * * * ?" # 每隔10分钟执行一次
NobilityPlatforms: [ "bilibili" ] # 需要获取贵族的平台列表
Bilibili:
RoomId: 8722013
Mid: 6704420
RoomId: 6925399
# Mid: 6704420
RoomShortInfoApi: https://api.live.bilibili.com/room/v1/Room/room_init
TopListApi: https://api.live.bilibili.com/guard/topList
Rank:
@ -38,27 +41,142 @@ Rank:
Cron:
Update: "@every 10s" # 10s一次
Persistence: "@every 10m" # 10min一次
Submit:
# 未列举的榜
0:
Best: [30,10,8,6,5,5]
Consolation: 1
# 名将
3:
TitleId: 1000
Best: [50,30,20,15,10,8]
Consolation: 1
# 小兵终结者
5:
TitleId: 1001
Best: [50,30,20,15,10,8]
Consolation: 1
# 拆迁办
7:
TitleId: 1002
Best: [60,40,25.6,18,10,8]
Consolation: 1
# 获胜榜
9:
TitleId: 1003
Best: [45.6,23.4,15,10,8,6]
Consolation: 1
# 一血
11:
TitleId: 1004
Best: [66.6,45.6,28,18,10,6]
Consolation: 2
# 怒送一血
12:
TitleId: 1005
Best: [66.6,45.6,28,18,10,6]
Consolation: 2
GiftCollector:
Enabled: true
Platforms: [ "bilibili" ]
Cron:
CollectGift: "0 0 0/6 * * ?" # 每隔6小时执行一次
Integral:
# 签到积分配置
Coin:
# 签到配置
CheckIn:
# 签到积分 一周 0(周日) 1 2 3 4 5 6
Points: [ 10000,2500,2500,3500,5000,6500,8000 ]
Critical: 0.15 # 签到积分暴击率
CriticalRadio: [ 1.0, 1.0, 1.2, 1.5, 1.8 ] # 暴击倍率
BattleReport:
GeneralIntegral: 1000 # 名将积分
WinRadio: 0.02 # 伤害量 1/50
LostRadio: 0.008 # 伤害量 1/120
# RMB到积分的转换
RMBToIntegral: 1000
# 签到 一周 0(周日) 1 2 3 4 5 6
Points: [ 60,10,15,20,25,30,50 ]
Critical: 0.08 # 签到暴击率
CriticalRadio: [ 1.2, 1.3, 1.5 ] # 暴击倍率
# RMB到弹币的转换
RMBToCoin: 10
# 平台礼物到RMB的转换
GiftToRMB:
bilibili: 0.001
# 平台免费礼物到积分的转换
FreeToIntegral:
bilibili: 0.00025
# 平台免费礼物到弹币的转换
FreeToCoin:
bilibili: 0.01 # 价值1毛
Elite:
LiveDict: { "1": "0", "2": "1001", "3": "1002" }
DefaultId: 0
Items:
- Id: 1001
Sort: 2
PriceDay: 80
PriceForever: 26660
- Id: 1002
Sort: 3
PriceDay: 60
PriceForever: 18888
Title:
LiveDict: { "1": "2000" }
Items:
- Id: 99999
Name: 无上意志
Type: custom
- Id: 1
Name: 祁池帝姬
Type: custom
- Id: 2
Name: 废物舰长
Type: custom
- Id: 3
Name: Joe王
Type: custom
- Id: 4
Name: 我是弟弟
Type: custom
- Id: 5
Name: 萌新导师
Type: custom
- Id: 6
Name: 群萌新
Type: custom
- Id: 1000
Name: 军神 # 名将榜首
Type: rank
RankType: 3
- Id: 1001
Name: 人屠 # 小兵击杀榜首
Type: rank
RankType: 5
- Id: 1002
Name: 破营 # 拆迁榜首
Type: rank
RankType: 7
- Id: 1003
Name: 不败 # 常胜榜首
Type: rank
RankType: 9
- Id: 1004
Name: 勇冠三军 # 一血榜首
Type: rank
RankType: 11
- Id: 1005
Name: 求放过 # 被一血榜首
Type: rank
RankType: 12
- Id: 2000
Name: 无用之人
Type: default
PriceDay: 50
PriceForever: 100000
GiftPackMap:
- PackType: starter
PackName: 新手礼包
Condition:
UserLimit: 1
UserResetType: unset
StartTime: "2022-05-21 09:00:00"
EndTime: "2022-05-21 09:00:00"
Content:
Coin: 50
- PackType: subsistence
PackName: 低保
Condition:
UserLimit: 3
UserResetType: daily
StartTime: "2022-05-21 09:00:00"
EndTime: "2022-05-21 09:00:00"
Content:
Coins: [ 10, 15, 20 ]

@ -163,10 +163,14 @@ func (l *StatPvpReportLogic) calcScoreResponse(sum sumType, items []*statPvPRepo
Mul(decimal.NewFromInt(30)).
Round(1).Float64()
itemResp.Score += float32(damageScore)
itemResp.Score += float32(deDamageScore)
itemResp.Score += float32(killPlayerScore)
itemResp.Score += float32(kdScore)
tmpScore, _ := decimal.NewFromFloat32(itemResp.Score).
Add(decimal.NewFromFloat(damageScore)).
Add(decimal.NewFromFloat(deDamageScore)).
Add(decimal.NewFromFloat(killPlayerScore)).
Add(decimal.NewFromFloat(kdScore)).
Round(1).Float64()
itemResp.Score += float32(tmpScore)
if item.firstBlood {
itemResp.Score += 5
}

Loading…
Cancel
Save