This commit is contained in:
aozhiwei 2024-07-22 11:05:06 +08:00
parent 139e9d0012
commit bee76b0d8a
2 changed files with 10 additions and 18 deletions

View File

@ -26,16 +26,8 @@ func IsAirDropNft(tokenId string) bool {
return tokenIdInt64 >= 6000000000000000 && tokenIdInt64 <= 7000000000000000
}
func IsGenesisHero(tokenId string) bool {
tokenIdInt64, err := strconv.ParseInt(tokenId, 10, 64)
if err != nil {
tokenIdInt64 = 0
}
return tokenIdInt64 > 6240603010001668 && tokenIdInt64 <= 6240603010002168
}
func GetHeroStackingScore(quality int32) int64 {
var score int64
func GetHeroStackingScore(quality int32) float64 {
var score float64
switch quality {
case 2:
score = 10
@ -53,8 +45,8 @@ func GetHeroStackingScore(quality int32) int64 {
return score
}
func GetFounderTagStackingScore(quality int32) int64 {
var score int64
func GetFounderTagStackingScore(quality int32) float64 {
var score float64
switch quality {
case 1:
score = 20
@ -68,15 +60,15 @@ func GetFounderTagStackingScore(quality int32) int64 {
return score
}
func CalcContributionScore(nfts []*NftStacking) int64 {
var score int64
var baseScore int64
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 IsGenesisHero(v.TokenId) {
if v.TokenType == NFT_TYPE_CFHERO {
rate += 0.05
}
}
@ -89,6 +81,6 @@ func CalcContributionScore(nfts []*NftStacking) int64 {
if rate > 1 {
rate = 1
}
score = int64(float64(baseScore) * (1 + rate))
score = baseScore * (1 + rate)
return score
}

View File

@ -19,7 +19,7 @@ type accountStacking struct {
nfts []*jccommon.NftStacking
}
func (this* accountStacking) calcScore() int64 {
func (this* accountStacking) calcScore() float64 {
return jccommon.CalcContributionScore(this.nfts)
}