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

main
NorthLan 2 years ago
parent 2ec0ceb880
commit 14b460760f

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

@ -9,28 +9,31 @@ Etcd:
NonBlock: true NonBlock: true
Log: Log:
Mode: file Mode: file
Path: logs/user_center
KeepDays: 7 KeepDays: 7
Level: info Level: info
DB: 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 DataSource: root:root@tcp(127.0.0.1:3306)/dmgame?charset=utf8mb4&loc=Asia%2FShanghai&parseTime=true
Kafka: Kafka:
UserNotify: UserCoinNotify:
Addr: [ "127.0.0.1:9093" ] Addr: [ "127.0.0.1:9093" ]
Topic: "notify-user" Topic: "notify-user-coin"
RankUpdate: RankUpdate:
Addr: [ "127.0.0.1:9093" ] Addr: [ "127.0.0.1:9093" ]
Topic: "rank-update" Topic: "rank-update"
RewardPool:
Addr: [ "127.0.0.1:9093" ]
Topic: "rewardPool"
UserRetriever: UserRetriever:
Enabled: true Enabled: true
UpdateDuration: 720 # 720 hours = 30 Day = 1 Month UpdateDuration: 720 # 720 hours = 30 Day = 1 Month
NobilityPlatforms: [ "bilibili" ] # 需要获取贵族的平台列表
Cron: Cron:
PlatformUser: "0 0/5 * * * ?" # 每隔5分钟执行一次 PlatformUser: "0 0/5 * * * ?" # 每隔5分钟执行一次
Nobility: "0 0/10 * * * ?" # 每隔10分钟执行一次 Nobility: "0 0/10 * * * ?" # 每隔10分钟执行一次
NobilityPlatforms: [ "bilibili" ] # 需要获取贵族的平台列表
Bilibili: Bilibili:
RoomId: 8722013 RoomId: 6925399
Mid: 6704420 # Mid: 6704420
RoomShortInfoApi: https://api.live.bilibili.com/room/v1/Room/room_init RoomShortInfoApi: https://api.live.bilibili.com/room/v1/Room/room_init
TopListApi: https://api.live.bilibili.com/guard/topList TopListApi: https://api.live.bilibili.com/guard/topList
Rank: Rank:
@ -38,27 +41,142 @@ Rank:
Cron: Cron:
Update: "@every 10s" # 10s一次 Update: "@every 10s" # 10s一次
Persistence: "@every 10m" # 10min一次 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: GiftCollector:
Enabled: true Enabled: true
Platforms: [ "bilibili" ] Platforms: [ "bilibili" ]
Cron: Cron:
CollectGift: "0 0 0/6 * * ?" # 每隔6小时执行一次 CollectGift: "0 0 0/6 * * ?" # 每隔6小时执行一次
Integral: Coin:
# 签到积分配置 # 签到配置
CheckIn: CheckIn:
# 签到积分 一周 0(周日) 1 2 3 4 5 6 # 签到 一周 0(周日) 1 2 3 4 5 6
Points: [ 10000,2500,2500,3500,5000,6500,8000 ] Points: [ 60,10,15,20,25,30,50 ]
Critical: 0.15 # 签到积分暴击率 Critical: 0.08 # 签到暴击率
CriticalRadio: [ 1.0, 1.0, 1.2, 1.5, 1.8 ] # 暴击倍率 CriticalRadio: [ 1.2, 1.3, 1.5 ] # 暴击倍率
BattleReport: # RMB到弹币的转换
GeneralIntegral: 1000 # 名将积分 RMBToCoin: 10
WinRadio: 0.02 # 伤害量 1/50
LostRadio: 0.008 # 伤害量 1/120
# RMB到积分的转换
RMBToIntegral: 1000
# 平台礼物到RMB的转换 # 平台礼物到RMB的转换
GiftToRMB: GiftToRMB:
bilibili: 0.001 bilibili: 0.001
# 平台免费礼物到积分的转换 # 平台免费礼物到弹币的转换
FreeToIntegral: FreeToCoin:
bilibili: 0.00025 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)). Mul(decimal.NewFromInt(30)).
Round(1).Float64() Round(1).Float64()
itemResp.Score += float32(damageScore) tmpScore, _ := decimal.NewFromFloat32(itemResp.Score).
itemResp.Score += float32(deDamageScore) Add(decimal.NewFromFloat(damageScore)).
itemResp.Score += float32(killPlayerScore) Add(decimal.NewFromFloat(deDamageScore)).
itemResp.Score += float32(kdScore) Add(decimal.NewFromFloat(killPlayerScore)).
Add(decimal.NewFromFloat(kdScore)).
Round(1).Float64()
itemResp.Score += float32(tmpScore)
if item.firstBlood { if item.firstBlood {
itemResp.Score += 5 itemResp.Score += 5
} }

Loading…
Cancel
Save