Skip to content

Commit d901acf

Browse files
committed
refactor: change the way we pass in URLs
1 parent 882cdd4 commit d901acf

32 files changed

Lines changed: 502 additions & 291 deletions

NotEnoughUpdates-REPO

src/api/hypixel_constants.go

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"fmt"
55
"io"
66
"net/http"
7+
"os"
78
"skycrypt/src/constants"
89
redis "skycrypt/src/db"
910
"skycrypt/src/models"
@@ -88,13 +89,18 @@ func processItems(items *[]models.HypixelItem) map[string]models.ProcessedHypixe
8889
item.Rarity = "common"
8990
}
9091

92+
texture := fmt.Sprintf("/api/item/%s", item.SkyBlockID)
93+
if os.Getenv("DEV") == "true" {
94+
texture = fmt.Sprintf("http://localhost:8080/api/item/%s", item.SkyBlockID)
95+
}
96+
9197
processed[item.SkyBlockID] = models.ProcessedHypixelItem{
9298
SkyblockID: item.SkyBlockID,
9399
Name: item.Name,
94100
ItemId: constants.BUKKIT_TO_ID[item.Material],
95101
Rarity: strings.ToLower(item.Rarity),
96102
Damage: item.Damage,
97-
Texture: fmt.Sprintf("http://localhost:8080/api/item/%s", item.SkyBlockID),
103+
Texture: texture,
98104
TextureId: utility.GetSkinHash(item.Skin.Value),
99105
Category: strings.ToLower(item.Category),
100106
Origin: item.Origin,
@@ -115,15 +121,23 @@ func processCollections(collections map[string]models.HypixelCollection) models.
115121
Collections: []models.ProcessedHypixelCollectionItem{},
116122
}
117123

124+
if os.Getenv("DEV") == "true" {
125+
category.Texture = strings.Replace(category.Texture, "/api/item/", "http://localhost:8080/api/item/", 1)
126+
}
127+
118128
for collectionId, collectionData := range categoryData.Items {
119129
processedItem := models.ProcessedHypixelCollectionItem{
120130
Id: collectionId,
121131
Name: collectionData.Name,
122-
Texture: fmt.Sprintf("http://localhost:8080/api/item/%s", collectionId),
132+
Texture: fmt.Sprintf("/api/item/%s", collectionId),
123133
MaxTier: collectionData.MaxTiers,
124134
Tiers: collectionData.Tiers,
125135
}
126136

137+
if os.Getenv("DEV") == "true" {
138+
processedItem.Texture = fmt.Sprintf("http://localhost:8080/api/item/%s", collectionId)
139+
}
140+
127141
category.Collections = append(category.Collections, processedItem)
128142
}
129143

src/constants/accessories.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package constants
22

33
import (
44
"fmt"
5+
"os"
56
"skycrypt/src/models"
67
"slices"
78
"time"
@@ -248,9 +249,15 @@ func GetAllAccessories() []Accessory {
248249

249250
texturePath := ""
250251
if item.Texture != "" {
251-
texturePath = fmt.Sprintf("http://localhost:8080/api/head/%s", item.Texture)
252+
texturePath = fmt.Sprintf("api/head/%s", item.Texture)
253+
if os.Getenv("DEV") == "true" {
254+
texturePath = fmt.Sprintf("http://localhost:8080/api/head/%s", item.Texture)
255+
}
252256
} else {
253-
texturePath = fmt.Sprintf("http://localhost:8080/api/item/%s:%d", item.Material, item.Damage)
257+
texturePath = fmt.Sprintf("/api/item/%s:%d", item.Material, item.Damage)
258+
if os.Getenv("DEV") == "true" {
259+
texturePath = fmt.Sprintf("http://localhost:8080/api/item/%s:%d", item.Material, item.Damage)
260+
}
254261
}
255262

256263
accessory := Accessory{

src/constants/collections.go

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ import "skycrypt/src/models"
55
var COLLECTIONS = models.ProcessedHypixelCollection{}
66

77
var COLLECTION_ICONS = map[string]string{
8-
"farming": "http://localhost:8080/api/item/GOLDEN_HOE",
9-
"mining": "http://localhost:8080/api/item/STONE_PICKAXE",
10-
"combat": "http://localhost:8080/api/item/STONE_SWORD",
11-
"foraging": "http://localhost:8080/api/item/JUNGLE_SAPLING",
12-
"fishing": "http://localhost:8080/api/item/FISHING_ROD",
13-
"rift": "http://localhost:8080/api/item/MYCELIUM",
8+
"farming": "/api/item/GOLDEN_HOE",
9+
"mining": "/api/item/STONE_PICKAXE",
10+
"combat": "/api/item/STONE_SWORD",
11+
"foraging": "/api/item/JUNGLE_SAPLING",
12+
"fishing": "/api/item/FISHING_ROD",
13+
"rift": "/api/item/MYCELIUM",
1414
}
1515

1616
type bossCollection struct {
@@ -22,42 +22,42 @@ type bossCollection struct {
2222
var BOSS_COLLECTIONS = []bossCollection{
2323
{
2424
Name: "Bonzo",
25-
Texture: "http://localhost:8080/api/head/12716ecbf5b8da00b05f316ec6af61e8bd02805b21eb8e440151468dc656549c",
25+
Texture: "/api/head/12716ecbf5b8da00b05f316ec6af61e8bd02805b21eb8e440151468dc656549c",
2626
Collections: []int{25, 50, 100, 150, 250, 1000},
2727
},
2828
{
2929
Name: "Scarf",
30-
Texture: "http://localhost:8080/api/head/7de7bbbdf22bfe17980d4e20687e386f11d59ee1db6f8b4762391b79a5ac532d",
30+
Texture: "/api/head/7de7bbbdf22bfe17980d4e20687e386f11d59ee1db6f8b4762391b79a5ac532d",
3131
Collections: []int{25, 50, 100, 150, 250, 1000},
3232
},
3333
{
3434
Name: "The Professor",
35-
Texture: "http://localhost:8080/api/head/9971cee8b833a62fc2a612f3503437fdf93cad692d216b8cf90bbb0538c47dd8",
35+
Texture: "/api/head/9971cee8b833a62fc2a612f3503437fdf93cad692d216b8cf90bbb0538c47dd8",
3636
Collections: []int{25, 50, 100, 150, 250, 1000},
3737
},
3838
{
3939
Name: "Thorn",
40-
Texture: "http://localhost:8080/api/head/8b6a72138d69fbbd2fea3fa251cabd87152e4f1c97e5f986bf685571db3cc0",
40+
Texture: "/api/head/8b6a72138d69fbbd2fea3fa251cabd87152e4f1c97e5f986bf685571db3cc0",
4141
Collections: []int{50, 100, 150, 250, 400, 1000},
4242
},
4343
{
4444
Name: "Livid",
45-
Texture: "http://localhost:8080/api/head/c1007c5b7114abec734206d4fc613da4f3a0e99f71ff949cedadc99079135a0b",
45+
Texture: "/api/head/c1007c5b7114abec734206d4fc613da4f3a0e99f71ff949cedadc99079135a0b",
4646
Collections: []int{50, 100, 150, 250, 500, 750, 1000},
4747
},
4848
{
4949
Name: "Sadan",
50-
Texture: "http://localhost:8080/api/head/fa06cb0c471c1c9bc169af270cd466ea701946776056e472ecdaeb49f0f4a4dc",
50+
Texture: "/api/head/fa06cb0c471c1c9bc169af270cd466ea701946776056e472ecdaeb49f0f4a4dc",
5151
Collections: []int{50, 100, 150, 250, 500, 750, 1000},
5252
},
5353
{
5454
Name: "Necron",
55-
Texture: "http://localhost:8080/api/head/a435164c05cea299a3f016bbbed05706ebb720dac912ce4351c2296626aecd9a",
55+
Texture: "/api/head/a435164c05cea299a3f016bbbed05706ebb720dac912ce4351c2296626aecd9a",
5656
Collections: []int{50, 100, 150, 250, 500, 750, 1000},
5757
},
5858
{
5959
Name: "Kuudra",
60-
Texture: "http://localhost:8080/api/head/82ee25414aa7efb4a2b4901c6e33e5eaa705a6ab212ebebfd6a4de984125c7a0",
60+
Texture: "/api/head/82ee25414aa7efb4a2b4901c6e33e5eaa705a6ab212ebebfd6a4de984125c7a0",
6161
Collections: []int{10, 100, 500, 2000, 5000},
6262
},
6363
}

src/constants/crimson_isle.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,23 @@ type kuudraTier struct {
1616
var KUUDRA_TIERS = map[string]kuudraTier{
1717
"none": {
1818
Name: "Basic",
19-
Texture: "http://localhost:8080/api/head/bfd3e71838c0e76f890213120b4ce7449577736604338a8d28b4c86db2547e71",
19+
Texture: "/api/head/bfd3e71838c0e76f890213120b4ce7449577736604338a8d28b4c86db2547e71",
2020
},
2121
"hot": {
2222
Name: "Hot",
23-
Texture: "http://localhost:8080/api/head/c0259e8964c3deb95b1233bb2dc82c986177e63ae36c11265cb385180bb91cc0",
23+
Texture: "/api/head/c0259e8964c3deb95b1233bb2dc82c986177e63ae36c11265cb385180bb91cc0",
2424
},
2525
"burning": {
2626
Name: "Burning",
27-
Texture: "http://localhost:8080/api/head/330f6f6e63b245f839e3ccdce5a5f22056201d0274411dfe5d94bbe449c4ece",
27+
Texture: "/api/head/330f6f6e63b245f839e3ccdce5a5f22056201d0274411dfe5d94bbe449c4ece",
2828
},
2929
"fiery": {
3030
Name: "Fiery",
31-
Texture: "http://localhost:8080/api/head/bd854393bbf9444542502582d4b5a23cc73896506e2fc739d545bc35bc7b1c06",
31+
Texture: "/api/head/bd854393bbf9444542502582d4b5a23cc73896506e2fc739d545bc35bc7b1c06",
3232
},
3333
"infernal": {
3434
Name: "Infernal",
35-
Texture: "http://localhost:8080/api/head/82ee25414aa7efb4a2b4901c6e33e5eaa705a6ab212ebebfd6a4de984125c7a0",
35+
Texture: "/api/head/82ee25414aa7efb4a2b4901c6e33e5eaa705a6ab212ebebfd6a4de984125c7a0",
3636
},
3737
}
3838

@@ -44,30 +44,30 @@ type dojoChallenge struct {
4444
var DOJO = map[string]dojoChallenge{
4545
"mob_kb": {
4646
Name: "Force",
47-
Texture: "http://localhost:8080/api/item/STICK",
47+
Texture: "/api/item/STICK",
4848
},
4949
"wall_jump": {
5050
Name: "Stamina",
51-
Texture: "http://localhost:8080/api/item/RABBIT_FOOT",
51+
Texture: "/api/item/RABBIT_FOOT",
5252
},
5353
"archer": {
5454
Name: "Mastery",
55-
Texture: "http://localhost:8080/api/item/BOW",
55+
Texture: "/api/item/BOW",
5656
},
5757
"sword_swap": {
5858
Name: "Discipline",
59-
Texture: "http://localhost:8080/api/item/DIAMOND_SWORD",
59+
Texture: "/api/item/DIAMOND_SWORD",
6060
},
6161
"snake": {
6262
Name: "Swiftness",
63-
Texture: "http://localhost:8080/api/item/LEAD",
63+
Texture: "/api/item/LEAD",
6464
},
6565
"lock_head": {
6666
Name: "Control",
67-
Texture: "http://localhost:8080/api/item/ENDER_EYE",
67+
Texture: "/api/item/ENDER_EYE",
6868
},
6969
"fireball": {
7070
Name: "Tenacity",
71-
Texture: "http://localhost:8080/api/item/FIRE_CHARGE",
71+
Texture: "/api/item/FIRE_CHARGE",
7272
},
7373
}

src/constants/dungeons.go

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,79 +15,79 @@ var DUNGEONS = dungeons{
1515
"catacombs": {
1616
{
1717
Name: "Entrance",
18-
Texture: "http://localhost:8080/api/head/35c3024f4d9d12ddf5959b6aea3c810f5ee85176aab1b2e7f462aa1c194c342b",
18+
Texture: "/api/head/35c3024f4d9d12ddf5959b6aea3c810f5ee85176aab1b2e7f462aa1c194c342b",
1919
ID: "0",
2020
},
2121
{
2222
Name: "Floor 1",
23-
Texture: "http://localhost:8080/api/head/726f384acdfbb7218e96efac630e9ae1a14fd2f820ab660cc68322a59b165a12",
23+
Texture: "/api/head/726f384acdfbb7218e96efac630e9ae1a14fd2f820ab660cc68322a59b165a12",
2424
ID: "1",
2525
},
2626
{
2727
Name: "Floor 2",
28-
Texture: "http://localhost:8080/api/head/ebaf2ae74553a64587840d6e70fb27d2c0ae2f8bdfacbe56654c8db4001cdc98",
28+
Texture: "/api/head/ebaf2ae74553a64587840d6e70fb27d2c0ae2f8bdfacbe56654c8db4001cdc98",
2929
ID: "2",
3030
},
3131
{
3232
Name: "Floor 3",
33-
Texture: "http://localhost:8080/api/head/5a2f67500a65f3ce79d34ec150de93df8f60ebe52e248f5e1cdb69b0726256f7",
33+
Texture: "/api/head/5a2f67500a65f3ce79d34ec150de93df8f60ebe52e248f5e1cdb69b0726256f7",
3434
ID: "3",
3535
},
3636
{
3737
Name: "Floor 4",
38-
Texture: "http://localhost:8080/api/head/5720917cda0567442617f2721e88be9d2ffbb0b26a3f4c2fe21655814d4f4476",
38+
Texture: "/api/head/5720917cda0567442617f2721e88be9d2ffbb0b26a3f4c2fe21655814d4f4476",
3939
ID: "4",
4040
},
4141
{
4242
Name: "Floor 5",
43-
Texture: "http://localhost:8080/api/head/5720917cda0567442617f2721e88be9d2ffbb0b26a3f4c2fe21655814d4f4476",
43+
Texture: "/api/head/5720917cda0567442617f2721e88be9d2ffbb0b26a3f4c2fe21655814d4f4476",
4444
ID: "5",
4545
},
4646
{
4747
Name: "Floor 6",
48-
Texture: "http://localhost:8080/api/head/3ce69d2ddcc81c9fc2e9948c92003eb0f7ebf0e7e952e801b7f2069dcee76d85",
48+
Texture: "/api/head/3ce69d2ddcc81c9fc2e9948c92003eb0f7ebf0e7e952e801b7f2069dcee76d85",
4949
ID: "6",
5050
},
5151
{
5252
Name: "Floor 7",
53-
Texture: "http://localhost:8080/api/head/76965e3fd619de6b0a7ce1673072520a9360378e1cb8c19d4baf0c86769d3764",
53+
Texture: "/api/head/76965e3fd619de6b0a7ce1673072520a9360378e1cb8c19d4baf0c86769d3764",
5454
ID: "7",
5555
},
5656
},
5757
"master_catacombs": {
5858
{
5959
Name: "Floor 1",
60-
Texture: "http://localhost:8080/api/head/1eb5b21af330af122b268b7aa390733bd1b699b4d0923233ecd24f81e08b9bce",
60+
Texture: "/api/head/1eb5b21af330af122b268b7aa390733bd1b699b4d0923233ecd24f81e08b9bce",
6161
ID: "1",
6262
},
6363
{
6464
Name: "Floor 2",
65-
Texture: "http://localhost:8080/api/head/32292e4e0fa62667256ef8da0f01982a996499f4d5d894bd058c3e6f3d2fb2d9",
65+
Texture: "/api/head/32292e4e0fa62667256ef8da0f01982a996499f4d5d894bd058c3e6f3d2fb2d9",
6666
ID: "2",
6767
},
6868
{
6969
Name: "Floor 3",
70-
Texture: "http://localhost:8080/api/head/c969f6b148648aa8d027228a52fb5a3ca1ee84dc76e47851f14db029a730a8a3",
70+
Texture: "/api/head/c969f6b148648aa8d027228a52fb5a3ca1ee84dc76e47851f14db029a730a8a3",
7171
ID: "3",
7272
},
7373
{
7474
Name: "Floor 4",
75-
Texture: "http://localhost:8080/api/head/d7b69021f9c09647dfd9b34df3deaff70cfc740f6a26f612dd47503fc34c97f0",
75+
Texture: "/api/head/d7b69021f9c09647dfd9b34df3deaff70cfc740f6a26f612dd47503fc34c97f0",
7676
ID: "4",
7777
},
7878
{
7979
Name: "Floor 5",
80-
Texture: "http://localhost:8080/api/head/d65cbce40e60e7a59a87fa8f4ecb6ccfc1514338c262614bf33739a6263f5405",
80+
Texture: "/api/head/d65cbce40e60e7a59a87fa8f4ecb6ccfc1514338c262614bf33739a6263f5405",
8181
ID: "5",
8282
},
8383
{
8484
Name: "Floor 6",
85-
Texture: "http://localhost:8080/api/head/d65cbce40e60e7a59a87fa8f4ecb6ccfc1514338c262614bf33739a6263f5405",
85+
Texture: "/api/head/d65cbce40e60e7a59a87fa8f4ecb6ccfc1514338c262614bf33739a6263f5405",
8686
ID: "6",
8787
},
8888
{
8989
Name: "Floor 7",
90-
Texture: "http://localhost:8080/api/head/d65cbce40e60e7a59a87fa8f4ecb6ccfc1514338c262614bf33739a6263f5405",
90+
Texture: "/api/head/d65cbce40e60e7a59a87fa8f4ecb6ccfc1514338c262614bf33739a6263f5405",
9191
ID: "7",
9292
},
9393
},

src/constants/enchanting.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ var EXPERIMENTS = experiments{
2121
"pairings": {Name: "Superpairs"},
2222
},
2323
Tiers: []tier{
24-
{Name: "Beginner", Texture: "http://localhost:8080/api/item/INK_SACK:12"},
25-
{Name: "High", Texture: "http://localhost:8080/api/item/INK_SACK:10"},
26-
{Name: "Grand", Texture: "http://localhost:8080/api/item/INK_SACK:11"},
27-
{Name: "Supreme", Texture: "http://localhost:8080/api/item/INK_SACK:14"},
28-
{Name: "Transcendent", Texture: "http://localhost:8080/api/item/INK_SACK:1"},
29-
{Name: "Metaphysical", Texture: "http://localhost:8080/api/item/INK_SACK:13"},
24+
{Name: "Beginner", Texture: "/api/item/INK_SACK:12"},
25+
{Name: "High", Texture: "/api/item/INK_SACK:10"},
26+
{Name: "Grand", Texture: "/api/item/INK_SACK:11"},
27+
{Name: "Supreme", Texture: "/api/item/INK_SACK:14"},
28+
{Name: "Transcendent", Texture: "/api/item/INK_SACK:1"},
29+
{Name: "Metaphysical", Texture: "/api/item/INK_SACK:13"},
3030
},
3131
}

src/constants/leveling.go

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -81,23 +81,23 @@ var COSMETIC_SKILLS = []string{"runecrafting", "social"}
8181
var INFINITE = []string{"dungeoneering", "skyblock_level"}
8282

8383
var SKILL_ICONS = map[string]string{
84-
"skyblock_level": "http://localhost:8080/api/head/2e2cc42015e6678f8fd49ccc01fbf787f1ba2c32bcf559a015332fc5db50",
85-
"farming": "http://localhost:8080/api/item/GOLDEN_HOE",
86-
"combat": "http://localhost:8080/api/item/STONE_SWORD",
87-
"fishing": "http://localhost:8080/api/item/FISHING_ROD",
88-
"alchemy": "http://localhost:8080/api/item/BREWING_STAND",
89-
"runecrafting": "http://localhost:8080/api/item/MAGMA_CREAM",
90-
"taming": "http://localhost:8080/api/item/SPAWN_EGG",
91-
"mining": "http://localhost:8080/api/item/STONE_PICKAXE",
92-
"foraging": "http://localhost:8080/api/item/SAPLING:3",
93-
"enchanting": "http://localhost:8080/api/item/ENCHANTING_TABLE",
94-
"carpentry": "http://localhost:8080/api/item/CRAFTING_TABLE",
95-
"social": "http://localhost:8080/api/item/EMERALD",
96-
"dungeoneering": "http://localhost:8080/api/head/964e1c3e315c8d8fffc37985b6681c5bd16a6f97ffd07199e8a05efbef103793",
97-
"healer": "http://localhost:8080/api/potion/normal/f52423",
98-
"mage": "http://localhost:8080/api/item/BLAZE_ROD",
99-
"archer": "http://localhost:8080/api/item/BOW",
100-
"berserk": "http://localhost:8080/api/item/IRON_SWORD",
101-
"tank": "http://localhost:8080/api/leather/chestplate/955e3b",
102-
"garden": "http://localhost:8080/api/item/DOUBLE_PLANT",
84+
"skyblock_level": "/api/head/2e2cc42015e6678f8fd49ccc01fbf787f1ba2c32bcf559a015332fc5db50",
85+
"farming": "/api/item/GOLDEN_HOE",
86+
"combat": "/api/item/STONE_SWORD",
87+
"fishing": "/api/item/FISHING_ROD",
88+
"alchemy": "/api/item/BREWING_STAND",
89+
"runecrafting": "/api/item/MAGMA_CREAM",
90+
"taming": "/api/item/SPAWN_EGG",
91+
"mining": "/api/item/STONE_PICKAXE",
92+
"foraging": "/api/item/SAPLING:3",
93+
"enchanting": "/api/item/ENCHANTING_TABLE",
94+
"carpentry": "/api/item/CRAFTING_TABLE",
95+
"social": "/api/item/EMERALD",
96+
"dungeoneering": "/api/head/964e1c3e315c8d8fffc37985b6681c5bd16a6f97ffd07199e8a05efbef103793",
97+
"healer": "/api/potion/normal/f52423",
98+
"mage": "/api/item/BLAZE_ROD",
99+
"archer": "/api/item/BOW",
100+
"berserk": "/api/item/IRON_SWORD",
101+
"tank": "/api/leather/chestplate/955e3b",
102+
"garden": "/api/item/DOUBLE_PLANT",
103103
}

src/constants/mining.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,10 @@ var FOSSILS = []string{
6262
}
6363

6464
var CORPSES = map[string]string{
65-
"lapis": "http://localhost:8080/api/item/LAPIS_ARMOR_HELMET",
66-
"umber": "http://localhost:8080/api/item/ARMOR_OF_YOG_HELMET",
67-
"tungsten": "http://localhost:8080/api/item/MINERAL_HELMET",
68-
"vanguard": "http://localhost:8080/api/item/VANGUARD_HELMET",
65+
"lapis": "/api/item/LAPIS_ARMOR_HELMET",
66+
"umber": "/api/item/ARMOR_OF_YOG_HELMET",
67+
"tungsten": "/api/item/MINERAL_HELMET",
68+
"vanguard": "/api/item/VANGUARD_HELMET",
6969
}
7070

7171
type forgeItem struct {

0 commit comments

Comments
 (0)