aozhiwei fcf9c6eaf6 1
2024-07-24 15:56:43 +08:00

91 lines
1.5 KiB
Go

package jccommon
import (
"strconv"
)
func GetGoldBullionGoldNum(itemId int32) int32 {
switch itemId {
case V_ITEM_GOLD_BULLION_1K: {
return 1000
}
case V_ITEM_GOLD_BULLION_1W: {
return 10000 * 1
}
default: {
return 0
}
}
}
func IsAirDropNft(tokenId string) bool {
tokenIdInt64, err := strconv.ParseInt(tokenId, 10, 64)
if err != nil {
tokenIdInt64 = 0
}
return tokenIdInt64 >= 6000000000000000 && tokenIdInt64 <= 7000000000000000
}
func GetHeroStackingScore(quality int32) float64 {
var score float64
switch quality {
case 2:
score = 10
case 3:
score = 20
case 4:
score = 40
case 5:
score = 80
case 6:
score = 160
default:
score = 10
}
return score
}
func GetFounderTagStackingScore(quality int32) float64 {
var score float64
switch quality {
case 1:
score = 20
case 2:
score = 40
case 3:
score = 100
default:
score = 20
}
return score
}
func CalcContributionScore(nfts []*NftStacking) float64 {
var score float64
var baseScore float64
var rate float64
for _, v := range nfts {
switch v.TokenType {
case NFT_TYPE_CFHERO, NFT_TYPE_CFHERO_NORMAL: {
baseScore += GetHeroStackingScore(v.Quality)
if v.TokenType == NFT_TYPE_CFHERO {
rate += 0.05
}
}
case NFT_TYPE_FOUNDER_TAG: {
baseScore += GetFounderTagStackingScore(v.Quality)
rate += 0.1
}
}
}
if rate > 1 {
rate = 1
}
score = baseScore * (1 + rate)
return score
}
func IsValidSessionId(accountId string, sessionId string) bool {
return true
}