Skip to content

Commit d61b4c1

Browse files
committed
Merge branch 'main' into multiRole
2 parents 8e57d00 + dcbca75 commit d61b4c1

27 files changed

+481
-210
lines changed

API/constants/xp_tables.js

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,17 @@ module.exports = {
1313
social: 25,
1414
dungeoneering: 50,
1515
hotm: 10,
16+
gardenXp: 15,
17+
wheat: 46,
18+
carrot: 46,
19+
potato: 46,
20+
melon: 46,
21+
pumpkin: 46,
22+
sugarCane: 46,
23+
cocoaBeans: 46,
24+
cactus: 46,
25+
mushroom: 46,
26+
netherWart: 46,
1627
},
1728
normal: [
1829
50, 125, 200, 300, 500, 750, 1000, 1500, 2000, 3500, 5000, 7500, 10000, 15000, 20000, 30000, 50000, 75000, 100000,
@@ -44,4 +55,65 @@ module.exports = {
4455
blaze: [10, 30, 250, 1500, 5000, 20000, 100000, 400000, 1000000],
4556
vampire: [20, 75, 240, 840, 2400],
4657
},
58+
gardenXp: [0, 70, 70, 140, 240, 600, 1500, 2000, 2500, 3000, 10000, 10000, 10000, 10000, 10000],
59+
wheat: [
60+
30, 50, 80, 170, 330, 670, 1330, 2500, 3500, 5000, 6500, 8000, 10000, 20000, 35000, 50000, 75000, 100000, 175000,
61+
250000, 350000, 500000, 750000, 1000000, 1300000, 1600000, 2000000, 2300000, 2600000, 3000000, 3000000, 3000000,
62+
3000000, 3000000, 3000000, 3000000, 3000000, 3000000, 3000000, 3000000, 3000000, 3000000, 3000000, 3000000, 3000000,
63+
3000000,
64+
],
65+
carrot: [
66+
100, 150, 250, 500, 1500, 2500, 5000, 7500, 10000, 15000, 20000, 25000, 40000, 70000, 100000, 200000, 250000,
67+
250000, 500000, 750000, 1000000, 1500000, 2000000, 3000000, 4000000, 5000000, 6000000, 7000000, 8000000, 9000000,
68+
10000000, 10000000, 10000000, 10000000, 10000000, 10000000, 10000000, 10000000, 10000000, 10000000, 10000000,
69+
10000000, 10000000, 10000000, 10000000, 10000000,
70+
],
71+
potato: [
72+
100, 150, 250, 500, 1500, 2500, 5000, 7500, 10000, 15000, 20000, 25000, 40000, 70000, 100000, 200000, 250000,
73+
250000, 500000, 750000, 1000000, 1500000, 2000000, 3000000, 4000000, 5000000, 6000000, 7000000, 8000000, 9000000,
74+
10000000, 10000000, 10000000, 10000000, 10000000, 10000000, 10000000, 10000000, 10000000, 10000000, 10000000,
75+
10000000, 10000000, 10000000, 10000000, 10000000,
76+
],
77+
melon: [
78+
150, 250, 400, 850, 1650, 3350, 6650, 12500, 17500, 25000, 32500, 40000, 50000, 100000, 175000, 250000, 375000,
79+
500000, 875000, 1250000, 1750000, 2500000, 3750000, 5000000, 6500000, 8000000, 10000000, 11500000, 13000000,
80+
15000000, 15000000, 15000000, 15000000, 15000000, 15000000, 15000000, 15000000, 15000000, 15000000, 15000000,
81+
15000000, 15000000, 15000000, 15000000, 15000000, 15000000,
82+
],
83+
pumpkin: [
84+
30, 50, 80, 170, 330, 670, 1330, 2500, 3500, 5000, 6500, 8000, 10000, 20000, 35000, 50000, 75000, 100000, 175000,
85+
250000, 350000, 500000, 750000, 1000000, 1300000, 1600000, 2000000, 2300000, 2600000, 3000000, 3000000, 3000000,
86+
3000000, 3000000, 3000000, 3000000, 3000000, 3000000, 3000000, 3000000, 3000000, 3000000, 3000000, 3000000, 3000000,
87+
3000000,
88+
],
89+
sugarCane: [
90+
60, 100, 160, 340, 660, 1340, 2660, 5000, 7000, 10000, 13000, 16000, 20000, 40000, 70000, 100000, 150000, 200000,
91+
350000, 500000, 700000, 1000000, 1500000, 2000000, 2600000, 3200000, 4000000, 4600000, 5200000, 6000000, 6000000,
92+
6000000, 6000000, 6000000, 6000000, 6000000, 6000000, 6000000, 6000000, 6000000, 6000000, 6000000, 6000000, 6000000,
93+
6000000, 6000000,
94+
],
95+
cocoaBeans: [
96+
90, 150, 250, 500, 1000, 2000, 4000, 7500, 10000, 15000, 20000, 25000, 30000, 50000, 100000, 150000, 200000, 300000,
97+
500000, 750000, 1000000, 1500000, 2000000, 3000000, 4000000, 5000000, 6000000, 7000000, 8000000, 9000000, 9000000,
98+
9000000, 9000000, 9000000, 9000000, 9000000, 9000000, 9000000, 9000000, 9000000, 9000000, 9000000, 9000000, 9000000,
99+
9000000, 9000000,
100+
],
101+
cactus: [
102+
60, 100, 160, 340, 660, 1340, 2660, 5000, 7000, 10000, 13000, 16000, 20000, 40000, 70000, 100000, 150000, 200000,
103+
350000, 500000, 700000, 1000000, 1500000, 2000000, 2600000, 3200000, 4000000, 4600000, 5200000, 6000000, 6000000,
104+
6000000, 6000000, 6000000, 6000000, 6000000, 6000000, 6000000, 6000000, 6000000, 6000000, 6000000, 6000000, 6000000,
105+
6000000, 6000000,
106+
],
107+
mushroom: [
108+
30, 50, 80, 170, 330, 670, 1330, 2500, 3500, 5000, 6500, 8000, 10000, 20000, 35000, 50000, 75000, 100000, 175000,
109+
250000, 350000, 500000, 750000, 1000000, 1300000, 1600000, 2000000, 2300000, 2600000, 3000000, 3000000, 3000000,
110+
3000000, 3000000, 3000000, 3000000, 3000000, 3000000, 3000000, 3000000, 3000000, 3000000, 3000000, 3000000, 3000000,
111+
3000000,
112+
],
113+
netherWart: [
114+
90, 150, 250, 500, 1000, 2000, 4000, 7500, 10000, 15000, 20000, 25000, 30000, 50000, 100000, 150000, 200000, 300000,
115+
500000, 750000, 1000000, 1500000, 2000000, 3000000, 4000000, 5000000, 6000000, 7000000, 8000000, 9000000, 9000000,
116+
9000000, 9000000, 9000000, 9000000, 9000000, 9000000, 9000000, 9000000, 9000000, 9000000, 9000000, 9000000, 9000000,
117+
9000000, 9000000,
118+
],
47119
};

API/functions/getGarden.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/* eslint-disable no-throw-literal */
2+
const config = require("../../config.json");
3+
const axios = require("axios");
4+
5+
async function getGarden(profileID, uuid) {
6+
try {
7+
const { data } = await axios.get(
8+
`https://api.hypixel.net/v2/skyblock/garden?key=${config.minecraft.API.hypixelAPIkey}&profile=${profileID}`,
9+
);
10+
11+
if (data === undefined || data.success === false) {
12+
throw "Request to Hypixel API failed. Please try again!";
13+
}
14+
15+
return { garden: data.garden };
16+
} catch (e) {
17+
throw new Error(e);
18+
}
19+
}
20+
21+
module.exports = { getGarden };

API/functions/getLatestProfile.js

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
/* eslint-disable no-throw-literal */
22
const { getUUID } = require("../../src/contracts/API/mowojangAPI.js");
33
const { getMuseum } = require("./getMuseum.js");
4+
const { getGarden } = require("./getGarden.js");
45
const { isUuid } = require("../utils/uuid.js");
56
const config = require("../../config.json");
67
const axios = require("axios");
78

89
const cache = new Map();
910

10-
async function getLatestProfile(uuid, options = { museum: false }) {
11+
async function getLatestProfile(uuid, options = { museum: false, garden: false }) {
1112
if (!isUuid(uuid)) {
1213
uuid = await getUUID(uuid).catch((error) => {
1314
throw error;
@@ -22,21 +23,16 @@ async function getLatestProfile(uuid, options = { museum: false }) {
2223
}
2324
}
2425

25-
const [{ data: playerRes }, { data: profileRes }] = await Promise.all([
26-
axios.get(`https://api.hypixel.net/v2/player?key=${config.minecraft.API.hypixelAPIkey}&uuid=${uuid}`),
26+
const [{ data: profileRes }] = await Promise.all([
2727
axios.get(`https://api.hypixel.net/v2/skyblock/profiles?key=${config.minecraft.API.hypixelAPIkey}&uuid=${uuid}`),
2828
]).catch((error) => {
2929
throw error?.response?.data?.cause ?? "Request to Hypixel API failed. Please try again!";
3030
});
3131

32-
if (playerRes.success === false || profileRes.success === false) {
32+
if (profileRes.success === false) {
3333
throw "Request to Hypixel API failed. Please try again!";
3434
}
3535

36-
if (playerRes.player == null) {
37-
throw "Player not found. It looks like this player has never joined the Hypixel.";
38-
}
39-
4036
if (profileRes.profiles == null || profileRes.profiles.length == 0) {
4137
throw "Player has no SkyBlock profiles.";
4238
}
@@ -56,9 +52,9 @@ async function getLatestProfile(uuid, options = { museum: false }) {
5652
profiles: profileRes.profiles,
5753
profile: profile,
5854
profileData: profileData,
59-
playerRes: playerRes.player,
6055
uuid: uuid,
6156
...(options.museum ? await getMuseum(profileData.profile_id, uuid) : {}),
57+
...(options.garden ? await getGarden(profileData.profile_id) : {}),
6258
};
6359

6460
cache.set(uuid, output);

API/stats/garden.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
const calcSkill = require("../constants/skills.js");
2+
3+
module.exports = (profile) => {
4+
return {
5+
level: calcSkill("gardenXp", profile?.garden_experience || 0),
6+
cropMilesstone: {
7+
wheat: calcSkill("wheat", profile?.resources_collected?.WHEAT || 0),
8+
carrot: calcSkill("carrot", profile?.resources_collected?.CARROT_ITEM || 0),
9+
sugarCane: calcSkill("sugarCane", profile?.resources_collected?.SUGAR_CANE || 0),
10+
potato: calcSkill("potato", profile?.resources_collected?.POTATO_ITEM || 0),
11+
netherWart: calcSkill("netherWart", profile?.resources_collected?.NETHER_STALK || 0),
12+
pumpkin: calcSkill("pumpkin", profile?.resources_collected?.PUMPKIN || 0),
13+
melon: calcSkill("melon", profile?.resources_collected?.MELON || 0),
14+
mushroom: calcSkill("mushroom", profile?.resources_collected?.MUSHROOM_COLLECTION || 0),
15+
cocoaBeans: calcSkill("cocoaBeans", profile?.resources_collected?.["INK_SACK:3"] || 0),
16+
cactus: calcSkill("cactus", profile?.resources_collected?.CACTUS || 0),
17+
},
18+
};
19+
};

API/stats/hotm.js

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,8 @@ const miningConst = require("../constants/mining.js");
44
const calcSkill = require("../constants/skills.js");
55
const moment = require("moment");
66

7-
module.exports = (player, profile) => {
7+
module.exports = (profile) => {
88
try {
9-
const commissions = {
10-
total: player?.achievements?.skyblock_hard_working_miner ?? 0,
11-
milestone: 0,
12-
};
13-
14-
// CREDITS: https://github.com/SkyCryptWebsite/SkyCrypt/blob/b9842bea6f1494fa2d2fd005b64f57d84646c188/src/stats/mining.js#L129
15-
if (profile.objectives?.tutorial !== undefined) {
16-
for (const key of profile.objectives.tutorial) {
17-
if (key.startsWith("commission_milestone_reward_mining_xp_tier_") === false) {
18-
continue;
19-
}
20-
21-
const tier = parseInt(key.slice(43));
22-
commissions.milestone = Math.max(commissions.milestone, tier);
23-
}
24-
}
25-
269
const forgeItems = [];
2710
if (profile.forge?.forge_processes?.forge_1) {
2811
const forge = Object.values(profile.forge.forge_processes.forge_1);
@@ -80,7 +63,6 @@ module.exports = (player, profile) => {
8063
},
8164
level: calcSkill("hotm", profile?.mining_core?.experience || 0),
8265
ability: titleCase(profile?.mining_core?.selected_pickaxe_ability || "none", true),
83-
commissions: commissions,
8466
forge: forgeItems,
8567
};
8668
} catch (error) {

data/linked.json

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/Application.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
const MinecraftManager = require("./minecraft/MinecraftManager.js");
2+
const { existsSync, mkdirSync, writeFileSync } = require("fs");
23
const DiscordManager = require("./discord/DiscordManager.js");
34
const webManager = require("./web/WebsiteManager.js");
4-
// eslint-disable-next-line no-unused-vars
5-
const Configuration = require("./Configuration.js");
6-
// eslint-disable-next-line no-unused-vars
7-
const Updater = require("./Updater.js");
85

96
class Application {
7+
constructor() {
8+
require("./Configuration.js");
9+
require("./Updater.js");
10+
if (!existsSync("./data/")) mkdirSync("./data/", { recursive: true });
11+
if (!existsSync("./data/linked.json")) writeFileSync("./data/linked.json", JSON.stringify({}));
12+
}
13+
1014
async register() {
1115
this.discord = new DiscordManager(this);
1216
this.minecraft = new MinecraftManager(this);

src/discord/commands/blacklistCommand.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
const HypixelDiscordChatBridgeError = require("../../contracts/errorHandler.js");
2+
const delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
23
const { SuccessEmbed } = require("../../contracts/embedHandler.js");
34

45
module.exports = {
@@ -24,24 +25,28 @@ module.exports = {
2425
],
2526
},
2627
{
27-
name: "name",
28+
name: "username",
2829
description: "Minecraft Username",
2930
type: 3,
3031
required: true,
3132
},
3233
],
3334

3435
execute: async (interaction) => {
35-
const name = interaction.options.getString("name");
36+
const name = interaction.options.getString("username");
3637
const arg = interaction.options.getString("arg").toLowerCase();
3738

39+
bot.chat("/lobby megawalls");
40+
await delay(250);
3841
if (arg == "add") {
3942
bot.chat(`/ignore add ${name}`);
4043
} else if (arg == "remove") {
4144
bot.chat(`/ignore remove ${name}`);
4245
} else {
4346
throw new HypixelDiscordChatBridgeError("Invalid Usage: `/ignore [add/remove] [name]`.");
4447
}
48+
await delay(250);
49+
bot.chat("/limbo");
4550

4651
const embed = new SuccessEmbed(
4752
`Successfully ${arg == "add" ? "added" : "removed"} \`${name}\` ${arg == "add" ? "to" : "from"} the blacklist.`,

src/discord/commands/demoteCommand.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ module.exports = {
77
requiresBot: true,
88
options: [
99
{
10-
name: "name",
10+
name: "username",
1111
description: "Minecraft Username",
1212
type: 3,
1313
required: true,
1414
},
1515
],
1616

1717
execute: async (interaction) => {
18-
const name = interaction.options.getString("name");
18+
const name = interaction.options.getString("username");
1919
bot.chat(`/g demote ${name}`);
2020

2121
const embed = new SuccessEmbed(`Successfully demoted \`${name}\` by one guild rank.`);

src/discord/commands/forceVerifyCommand.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ module.exports = {
1414
required: true,
1515
},
1616
{
17-
name: "name",
17+
name: "username",
1818
description: "Minecraft Username",
1919
type: 3,
2020
required: true,

0 commit comments

Comments
 (0)