-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
158 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
const minecraftCommand = require("../../contracts/minecraftCommand.js"); | ||
const delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms)); | ||
const helperFunctions = require("../../contracts/helperFunctions.js"); | ||
|
||
class BooCommand extends minecraftCommand { | ||
constructor(minecraft) { | ||
super(minecraft); | ||
|
||
this.name = "boo"; | ||
this.aliases = []; | ||
this.description = "Boo someone!"; | ||
this.options = [ | ||
{ | ||
name: "username", | ||
description: "User you want to boo!", | ||
required: true, | ||
}, | ||
]; | ||
this.isOnCooldown = false; | ||
} | ||
|
||
async onCommand(username, message) { | ||
try { | ||
if (this.getArgs(message).length === 0) { | ||
// eslint-disable-next-line no-throw-literal | ||
throw "You must provide a user to boo!"; | ||
} | ||
|
||
if (9 !== new Date().getMonth()) { | ||
// eslint-disable-next-line no-throw-literal | ||
throw "It's not October!"; | ||
} | ||
|
||
if (this.isOnCooldown) { | ||
return this.send(`/gc ${this.name} Command is on cooldown`); | ||
} | ||
|
||
this.send(`/boo ${this.getArgs(message)[0]}`); | ||
await delay(690); | ||
this.send(`/msg ${this.getArgs(message)[0]} ${username} Booed You!`); | ||
await delay(690); | ||
this.send(`/gc Booed ${this.getArgs(message)[0]}!`); | ||
this.isOnCooldown = true; | ||
// CREDITS: @jaxieflaxie for finding this cooldown reset | ||
setTimeout(() => { | ||
bot.chat( | ||
`/w ${ | ||
bot.username | ||
} jaxieflaxie is the best wristspasm member! your cool if u see this - ${helperFunctions.generateID(24)}`, | ||
); | ||
setTimeout(() => { | ||
bot.chat(`/w ${bot.username} ${helperFunctions.generateID(48)}`); | ||
this.isOnCooldown = false; | ||
}, 30000); | ||
}, 30000); | ||
this.isOnCooldown = false; | ||
} catch (error) { | ||
this.send(`/gc [ERROR] ${error}`); | ||
} | ||
} | ||
} | ||
|
||
module.exports = BooCommand; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
const minecraftCommand = require("../../contracts/minecraftCommand.js"); | ||
|
||
|
||
/* | ||
Derpy = 368 mod 24 = 8 | ||
Jerry = 376 mod 24 = 16 | ||
Scorpius = 384 mod 24 = 0 | ||
https://hypixel-skyblock.fandom.com/wiki/Mayor_Election#Special_Candidates_Election_Cycle | ||
*/ | ||
|
||
const hourMs = 50000; | ||
const dayMs = 24 * hourMs; | ||
const monthLength = 31; | ||
const yearLength = 12; | ||
|
||
const monthMs = monthLength * dayMs; | ||
const yearMs = yearLength * monthMs; | ||
|
||
const yearZero = 1560275700000; | ||
|
||
const currentSkyblockYear = timeToSkyblockYear(Date.now()); | ||
|
||
var yearsUntilSpecial = 0; | ||
var diffSkyblockYear = currentSkyblockYear; | ||
var specialMayor = ""; | ||
|
||
|
||
function timeToSkyblockYear(time) { | ||
return Math.floor((time - yearZero) / yearMs) + 1; | ||
} | ||
|
||
function getSpecialMayor(skyblockYear) { | ||
if (diffSkyblockYear % 24 == 8){ | ||
specialMayor = "Derpy"; | ||
} else if (diffSkyblockYear % 24 == 16){ | ||
specialMayor = "Jerry"; | ||
} else if (diffSkyblockYear % 24 == 0){ | ||
specialMayor = "Scorpius"; | ||
} else { | ||
specialMayor = "Error!"; | ||
} | ||
return specialMayor; | ||
} | ||
|
||
class SpecialMayorCommand extends minecraftCommand { | ||
constructor(minecraft) { | ||
super(minecraft); | ||
|
||
this.name = "specialmayor"; | ||
this.aliases = ["specmayor"]; | ||
this.description = "How many years until next special mayor, along with speculated special mayor."; | ||
this.options = []; | ||
} | ||
|
||
async onCommand() { | ||
try { | ||
|
||
if (currentSkyblockYear % 8 == 0){ | ||
specialMayor = getSpecialMayor(currentSkyblockYear); | ||
this.send(`/gc Special Mayor this year! It is speculated to be ${specialMayor}.`); | ||
} else { | ||
while (diffSkyblockYear % 8 != 0){ | ||
yearsUntilSpecial += 1; | ||
diffSkyblockYear += 1; | ||
specialMayor = getSpecialMayor(diffSkyblockYear); | ||
} | ||
this.send(`/gc Not Special Mayor, ${yearsUntilSpecial} years until the next one! It is speculated to be ${specialMayor}.`); | ||
} | ||
|
||
} catch (error) { | ||
console.log(error) | ||
this.send(`/gc [ERROR] ${error}`); | ||
} | ||
} | ||
} | ||
|
||
module.exports = SpecialMayorCommand; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters