-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathattribute_shards.go
More file actions
65 lines (56 loc) · 1.5 KB
/
attribute_shards.go
File metadata and controls
65 lines (56 loc) · 1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
package stats
import (
"fmt"
notenoughupdates "skycrypt/src/NotEnoughUpdates"
"skycrypt/src/models"
"skycrypt/src/utility"
skycrypttypes "github.com/DuckySoLucky/SkyCrypt-Types"
)
func getMaxSyphon(shardRarity string) int {
switch shardRarity {
case "COMMON":
return 96
case "UNCOMMON":
return 64
case "RARE":
return 48
case "EPIC":
return 32
case "LEGENDARY":
return 24
}
return 0
}
func GetAttributeShards(userProfile *skycrypttypes.Member) models.AttributeShardsOutput {
output := models.AttributeShardsOutput{
Shards: []models.AttributeShard{},
MaxUnlocked: len(notenoughupdates.NEUConstants.AttributeShards),
}
for _, shard := range notenoughupdates.NEUConstants.AttributeShards {
owned := 0
captureTimesamp := int64(0)
syphoned := userProfile.Attributes.Stacks[shard.ShardStackId]
for _, ownedShard := range userProfile.Shards.Owned {
if ownedShard.Type == shard.ShardOwnedId {
owned = ownedShard.AmountOwned
captureTimesamp = ownedShard.Captured
break
}
}
output.Shards = append(output.Shards, models.AttributeShard{
Name: fmt.Sprintf("%s (%s Shard)", shard.Name, shard.ShardName),
Lore: shard.Lore,
Texture: fmt.Sprintf("%s%s", utility.GetDomain(), shard.Texture),
Owned: owned,
Syphoned: syphoned,
MaxSyphon: getMaxSyphon(shard.Rarity),
Captured: captureTimesamp,
})
output.MaxSyphoned += getMaxSyphon(shard.Rarity)
output.Syphoned += syphoned
if syphoned > 0 {
output.Unlocked += 1
}
}
return output
}