11package stats
22
33import (
4+ "fmt"
45 notenoughupdates "skycrypt/src/NotEnoughUpdates"
56 "skycrypt/src/constants"
67 "skycrypt/src/models"
@@ -65,7 +66,7 @@ func GetAccessories(useProfile *skycrypttypes.Member, items map[string][]*skycry
6566 continue
6667 }
6768
68- item .Lore = append (item .Lore , "" , "§7Inactive: §cNot in accessory bag" )
69+ item .Lore = append (item .Lore , "" , fmt . Sprintf ( "§7Inactive: §cFound in %s" , utility . TitleCase ( inventoryId )) )
6970 newAccessory := models.InsertAccessory {
7071 ProcessedItem : item ,
7172 Id : id ,
@@ -103,8 +104,17 @@ func GetAccessories(useProfile *skycrypttypes.Member, items map[string][]*skycry
103104
104105 if utility .RarityNameToInt (duplicateRarity ) < utility .RarityNameToInt (rarity ) {
105106 duplicates [i ].IsInactive = true
107+
108+ if ! strings .Contains (strings .Join (duplicates [i ].ProcessedItem .Lore , "\n " ), "§7Inactive:" ) {
109+ duplicates [i ].ProcessedItem .Lore = append (duplicates [i ].ProcessedItem .Lore , "" , fmt .Sprintf ("§7Inactive: §cLower rarity duplicate of %s" , accessory .DisplayName ))
110+ }
106111 } else if duplicate .Rarity == rarity {
107112 duplicates [i ].IsInactive = true
113+
114+ if ! strings .Contains (strings .Join (duplicates [i ].ProcessedItem .Lore , "\n " ), "§7Inactive:" ) {
115+ duplicates [i ].ProcessedItem .Lore = append (duplicates [i ].ProcessedItem .Lore , "" , fmt .Sprintf ("§7Inactive: §cDuplicate of %s" , accessory .DisplayName ))
116+ }
117+
108118 }
109119 }
110120
@@ -132,6 +142,17 @@ func GetAccessories(useProfile *skycrypttypes.Member, items map[string][]*skycry
132142 for i , acc := range accessories {
133143 if acc .Id == id && acc .Rarity == rarity {
134144 accessories [i ].IsInactive = false
145+
146+ // Remove the inactive lore line
147+ for j := len (accessories [i ].ProcessedItem .Lore ) - 1 ; j >= 0 ; j -- {
148+ if strings .HasPrefix (accessories [i ].ProcessedItem .Lore [j ], "§7Inactive:" ) {
149+ accessories [i ].ProcessedItem .Lore = append (accessories [i ].ProcessedItem .Lore [:j ], accessories [i ].ProcessedItem .Lore [j + 1 :]... )
150+ if j > 0 {
151+ accessories [i ].ProcessedItem .Lore = append (accessories [i ].ProcessedItem .Lore [:j - 1 ], accessories [i ].ProcessedItem .Lore [j - 1 + 1 :]... )
152+ }
153+ break
154+ }
155+ }
135156 break
136157 }
137158 }
@@ -148,6 +169,9 @@ func GetAccessories(useProfile *skycrypttypes.Member, items map[string][]*skycry
148169 for j , acc := range accessories {
149170 if acc .Id == upgrade {
150171 accessories [j ].IsInactive = true
172+ if ! strings .Contains (strings .Join (accessories [j ].ProcessedItem .Lore , "\n " ), "§7Inactive:" ) {
173+ accessories [j ].ProcessedItem .Lore = append (accessories [j ].ProcessedItem .Lore , "" , fmt .Sprintf ("§7Inactive: §cUpgraded to %s" , accessory .DisplayName ))
174+ }
151175 }
152176 }
153177 }
@@ -182,6 +206,7 @@ func GetAccessories(useProfile *skycrypttypes.Member, items map[string][]*skycry
182206 }
183207
184208 sort .Sort (itemSorter (accessories ))
209+
185210 output := models.AccessoriesOutput {
186211 Accessories : accessories ,
187212 AccessoryIds : accessoryIds ,
0 commit comments