1
This commit is contained in:
parent
139e9d0012
commit
bee76b0d8a
@ -26,16 +26,8 @@ func IsAirDropNft(tokenId string) bool {
|
|||||||
return tokenIdInt64 >= 6000000000000000 && tokenIdInt64 <= 7000000000000000
|
return tokenIdInt64 >= 6000000000000000 && tokenIdInt64 <= 7000000000000000
|
||||||
}
|
}
|
||||||
|
|
||||||
func IsGenesisHero(tokenId string) bool {
|
func GetHeroStackingScore(quality int32) float64 {
|
||||||
tokenIdInt64, err := strconv.ParseInt(tokenId, 10, 64)
|
var score float64
|
||||||
if err != nil {
|
|
||||||
tokenIdInt64 = 0
|
|
||||||
}
|
|
||||||
return tokenIdInt64 > 6240603010001668 && tokenIdInt64 <= 6240603010002168
|
|
||||||
}
|
|
||||||
|
|
||||||
func GetHeroStackingScore(quality int32) int64 {
|
|
||||||
var score int64
|
|
||||||
switch quality {
|
switch quality {
|
||||||
case 2:
|
case 2:
|
||||||
score = 10
|
score = 10
|
||||||
@ -53,8 +45,8 @@ func GetHeroStackingScore(quality int32) int64 {
|
|||||||
return score
|
return score
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetFounderTagStackingScore(quality int32) int64 {
|
func GetFounderTagStackingScore(quality int32) float64 {
|
||||||
var score int64
|
var score float64
|
||||||
switch quality {
|
switch quality {
|
||||||
case 1:
|
case 1:
|
||||||
score = 20
|
score = 20
|
||||||
@ -68,15 +60,15 @@ func GetFounderTagStackingScore(quality int32) int64 {
|
|||||||
return score
|
return score
|
||||||
}
|
}
|
||||||
|
|
||||||
func CalcContributionScore(nfts []*NftStacking) int64 {
|
func CalcContributionScore(nfts []*NftStacking) float64 {
|
||||||
var score int64
|
var score float64
|
||||||
var baseScore int64
|
var baseScore float64
|
||||||
var rate float64
|
var rate float64
|
||||||
for _, v := range nfts {
|
for _, v := range nfts {
|
||||||
switch v.TokenType {
|
switch v.TokenType {
|
||||||
case NFT_TYPE_CFHERO, NFT_TYPE_CFHERO_NORMAL: {
|
case NFT_TYPE_CFHERO, NFT_TYPE_CFHERO_NORMAL: {
|
||||||
baseScore += GetHeroStackingScore(v.Quality)
|
baseScore += GetHeroStackingScore(v.Quality)
|
||||||
if IsGenesisHero(v.TokenId) {
|
if v.TokenType == NFT_TYPE_CFHERO {
|
||||||
rate += 0.05
|
rate += 0.05
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -89,6 +81,6 @@ func CalcContributionScore(nfts []*NftStacking) int64 {
|
|||||||
if rate > 1 {
|
if rate > 1 {
|
||||||
rate = 1
|
rate = 1
|
||||||
}
|
}
|
||||||
score = int64(float64(baseScore) * (1 + rate))
|
score = baseScore * (1 + rate)
|
||||||
return score
|
return score
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@ type accountStacking struct {
|
|||||||
nfts []*jccommon.NftStacking
|
nfts []*jccommon.NftStacking
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this* accountStacking) calcScore() int64 {
|
func (this* accountStacking) calcScore() float64 {
|
||||||
return jccommon.CalcContributionScore(this.nfts)
|
return jccommon.CalcContributionScore(this.nfts)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user