blooket.js
Advanced tools
Comparing version 1.2.3 to 1.2.5
289
blooket.js
@@ -1,287 +0,4 @@ | ||
const ws = require('ws'); | ||
const EventEmitter = require("events"); | ||
const socketcheck = require('./modules/socket'); | ||
const {getdata, getquestions} = require('./modules/getdata') | ||
const message = require('./modules/messageHandler') | ||
const answerHandler = require("./modules/answerHandler") | ||
const {goldHandler, goldchance, getPlayers} = require("./modules/goldHandler") | ||
const delay = ms => new Promise(res => setTimeout(res, ms)); | ||
class Blooket extends EventEmitter { | ||
constructor(options) { | ||
super() | ||
// Game Options | ||
this.options = {} | ||
options = options || {} | ||
this.options.repeat = options.repeat || true | ||
// Cafe Mode Only Option | ||
this.options.cafebonus = options.cafebonus || 50 | ||
// Tower Defense Only Option | ||
this.options.towerbonus = options.towerbonus || 1 | ||
// Factory Mode Only Options | ||
this.options.blooktime = options.blooktime || 1000 | ||
this.options.blookcash = options.blookcash || 100 | ||
// Battle Royale and Classic mode Only Options | ||
this.options.answertime = options.answertime || 1 | ||
// All Game Modes | ||
this.questions = null | ||
this.mode = null | ||
this.pin = null | ||
this.socket = null | ||
this.gameid = null | ||
this.name = null | ||
this.animal = null | ||
this.mode = null | ||
this.CurrentIndex = 0 | ||
this.TotalIndex = null | ||
this.correct = null | ||
this.cash = 0 | ||
this.gamestarted = 0 | ||
// For Gold Game Mode | ||
this.prizes = null | ||
this.steal = null | ||
// For fatory mode only | ||
this.blooks = 0 | ||
// Battle Royale only | ||
this.shuffle = null | ||
} | ||
async join(pin, name, animal) { | ||
await socketcheck(pin).then((socket) => { this.socket = new ws(socket.url)}) | ||
this.pin = pin | ||
this.animal = animal | ||
this.name = name | ||
console.log("Connected!"); | ||
this.emit("SocketConnect", this.socket); | ||
await getdata(this).then((data) => { | ||
this.gameid = data[0] | ||
this.mode = data[1].toLowerCase() | ||
console.log(this.mode) | ||
if (this.mode == 'factory') { | ||
this.mode = 'fact' | ||
} else if (this.mode == 'racing') { | ||
this.mode = 'race' | ||
} else if (this.mode == 'defense') { | ||
this.mode = 'def' | ||
} | ||
console.log(this.mode) | ||
}) | ||
if (this.animal == "random") { | ||
this.animal = await this.randomblook() | ||
console.log("Random Animal Chosen: ") | ||
console.log(this.animal) | ||
} | ||
await this.connect() | ||
this.emit("joined", this) | ||
await getquestions(this.gameid).then((questions) => { | ||
this.questions = questions.questions | ||
this.TotalIndex = questions.questions.length - 1 | ||
}) | ||
if (this.mode == "royale" || this.mode == "classic") { | ||
this.socket.on('message', (data) => { | ||
console.log(data) | ||
if (data.includes("q-")) { | ||
console.log(JSON.parse(data).d.b.d.split("q-")[1].split("-")[0] - 1) | ||
console.log(JSON.parse(data).d) | ||
this.CurrentIndex = JSON.parse(data).d.b.d.split("q-")[1].split("-")[0] - 1 | ||
this.shuffle = JSON.parse(data).d.b.d.split("q-")[1].split("-")[1] | ||
this.startquestion() | ||
} | ||
}) | ||
} else { | ||
this.socket.on('message', (data) => {message(data, this)}) | ||
this.on("GameStart", function() { | ||
this.gamestarted = 1 | ||
this.CurrentIndex = 0 | ||
this.startquestion() | ||
}) | ||
} | ||
} | ||
randomblook() { | ||
return new Promise(async(resolve, reject) => { | ||
var blooklist = [] | ||
var playerlist = await getPlayers(this) | ||
for (var player in playerlist) { | ||
blooklist.push(playerlist[player].b) | ||
} | ||
var blooks = ["Chick","Chicken","Cow","Goat","Horse","Pig","Sheep","Duck","Dog","Cat","Rabbit","Goldfish","Hamster","Turtle","Kitten","Puppy","Bear","Moose","Fox","Raccoon","Squirrel","Owl","Hedgehog","Tiger","Orangutan","Cockatoo","Parrot","Anaconda","Jaguar","Macaw","Toucan","Panther","Capuchin","Snowy Owl","Polar Bear","Artic Fox","Baby Penguin","Penguin","Arctic Hare","Seal","Walrus","Witch","Wizard","Elf","Fairy","Slime Monster","Jester","Dragon","Queen","Unicorn","King","Two of Spades","Eat Me","Drink Me","Alice","Queen of Hearts","Dormouse","White Rabbit","Cheshire Cat","Caterpillar","Mad Hatter","King of Hearts","Toast","Cereal","Yogurt","Breakfast Combo","Orange Juice","Milk","Waffle","Pancakes","French Toast","Pizza","Earth","Meteor","Stars","Alien","Planet","UFO","Spaceship","Astronaut","Snow Globe","Holiday Gift","Hot Chocolate","Holiday Wreath","Gingerbread Man","Gingerbread House","Snowman","Santa Claus","Pumpkin","Swamp Monster","Frankenstein","Vampire","Zombie","Mummy","Werewolf","Ghost","Red Astronaut","Blue Astronaut","Green Astronaut","Pink Astronaut","Orange Astronaut","Yellow Astronaut","Black Astronaut","Purple Astronaut","Brown Astronaut","Cyan Astronaut","Lime Astronaut","Spooky Pumpkin","Spooky Mummy","Spooky Ghost","Frost Wreath","Tropical Globe"]; | ||
blooklist.forEach((blook) => { | ||
delete blooks[blooks.indexOf(blook)] | ||
}); | ||
var blooks = blooks.filter(function(blook) { | ||
return blook != null | ||
}); | ||
return resolve(blooks[Math.floor(Math.random() * blooks.length)]) | ||
}) | ||
} | ||
connect() { | ||
return new Promise((resolve,reject) => { | ||
this.socket.removeAllListeners() | ||
this.socket.send(`{"t":"d","d":{"r":2,"a":"p","b":{"p":"/${this.pin}/c/${this.name}","d":{"b":"${this.animal}"}}}}`) | ||
return resolve() | ||
}) | ||
} | ||
async startquestion() { | ||
console.log(this.CurrentIndex) | ||
if (this.mode != "royale" & this.mode != "classic") { | ||
this.socket.removeAllListeners() | ||
} | ||
if (this.CurrentIndex == this.TotalIndex & this.options.repeat == true) { | ||
this.CurrentIndex = 0 | ||
} else if (this.options.repat == false) { | ||
exit("OOQ => Out Of Questions"); | ||
} | ||
await delay(1000); | ||
this.emit("QuestionStart",this.questions[this.CurrentIndex]) | ||
} | ||
autocorrect() { | ||
var q = this.questions[this.CurrentIndex] | ||
if (this.mode == "royale" || this.mode == "classic") { | ||
return this.shuffle[q.answers.indexOf(q.correctAnswers[0])] | ||
} else { | ||
return q.answers.indexOf(q.correctAnswers[0]) + 1 | ||
} | ||
} | ||
async answer(a) { | ||
console.log("Answering Question: " + this.CurrentIndex) | ||
if (this.mode == "royale") { | ||
this.socket.send(`{"t":"d","d":{"r":1,"a":"p","b":{"p":"/${this.pin}/a/${this.name}","d":{"a":${a},"t":${this.options.answertime}}}}}`) | ||
} else if (this.mode == "classic") { | ||
this.socket.send(`{"t":"d","d":{"r":1,"a":"p","b":{"p":"/${this.pin}/c/${this.name}","d":{"a":${a},"t":${this.options.answertime}}}}}`) | ||
} else { | ||
await answerHandler(a-1, this).then((correct) => { | ||
this.correct = correct | ||
this.CurrentIndex += 1 | ||
}) | ||
if (this.correct == true) { | ||
this.emit("Correct") | ||
if (this.mode == "gold") { | ||
await goldchance().then((prizes) => { | ||
this.prizes = prizes | ||
this.emit("GetGold") | ||
}) | ||
} else if (this.mode == "cafe") { | ||
this.cash += this.options.cafebonus | ||
this.socket.send(`{"t":"d","d":{"r":1,"a":"p","b":{"p":"/${this.pin}/c/${this.name}","d":{"b":"${this.animal}","ca":${this.cash}}}}}`) | ||
game.emit("NextQuestion") | ||
} else if (this.mode == "fact") { | ||
if (Math.floor(Math.random() * 100) <= 80) { | ||
this.blooks += 1 | ||
console.log(`You have ${this.blooks} blooks`) | ||
setInterval(function() { | ||
game.cash += game.options.blookcash | ||
game.socket.send(`{"t":"d","d":{"r":1,"a":"p","b":{"p":"/${game.pin}/c/${game.name}","d":{"b":"${game.animal}","ca":${game.cash}}}}}`) | ||
}, this.options.blooktime); | ||
} else { | ||
if (Math.floor(Math.random() * 5) == 0) { | ||
this.glitch("la") | ||
} else if (Math.floor(Math.random() * 5) == 1) { | ||
this.glitch("f") | ||
} else if (Math.floor(Math.random() * 5) == 2) { | ||
this.glitch("sm") | ||
} else if (Math.floor(Math.random() * 5) == 3) { | ||
this.glitch("lo") | ||
} else { | ||
this.glitch("as") | ||
} | ||
} | ||
this.emit("NextQuestion") | ||
} else if (this.mode == "race") { | ||
this.cash += 1 // Cash is the race position in this index. | ||
this.socket.send(`{"t":"d","d":{"r":1,"a":"p","b":{"p":"/${this.pin}/c/${this.name}","d":{"b":"${this.animal}","pr":${this.cash}}}}}`) | ||
this.emit("NextQuestion") | ||
} else if (this.mode == "def") { | ||
this.cash += this.options.towerbonus | ||
console.log(this.cash) | ||
this.socket.send(`{"t":"d","d":{"r":1,"a":"p","b":{"p":"/${this.pin}/c/${this.name}","d":{"b":"${this.animal}","d":${this.cash}}}}}`) | ||
this.emit("NextQuestion") | ||
} | ||
} else { | ||
this.emit("Incorrect") | ||
} | ||
} | ||
} | ||
async getgold(p) { | ||
await goldHandler(p, this).then((e) => { | ||
if (e[1] == "l") { | ||
this.socket.send(`{"t":"d","d":{"r":2,"a":"p","b":{"p":"/${this.pin}/c/${this.name}","d":{"b":"${this.animal}","g":${this.cash}}}}}`) | ||
this.emit("NextQuestion") | ||
} else if (e[1] == "d") { | ||
this.cash = e[0] | ||
this.socket.send(`{"t":"d","d":{"r":1,"a":"p","b":{"p":"/${this.pin}/c/${this.name}","d":{"b":"${this.animal}","g":${this.cash}}}}}`) | ||
this.emit("NextQuestion") | ||
}else if (e[1] == "s") { | ||
this.steal = e | ||
this.emit("Swap",e[0]) | ||
} else if (e[2] == "t") { | ||
this.steal = e | ||
this.emit("Steal",e[0]) | ||
} | ||
}) | ||
} | ||
glitch(glitch) { | ||
this.socket.send('{"t":"d","d":{"r":1,"a":"p","b":{"p":"/' + this.pin + '/act","d":{"b":"' + this.animal + '","g":"' + glitch + '","n":"' + this.name + '"}}}}') | ||
} | ||
swap(player) { | ||
var targetanimal = this.steal[0][player].b | ||
this.socket.on("message", function(data) { | ||
data = JSON.parse(data) | ||
if (data.d.b.d.at) { | ||
console.log("You swapped!") | ||
game.cash = data.d.b.d.g || 0 | ||
game.emit("NextQuestion") | ||
} | ||
}) | ||
this.cash = Math.floor(this.cash) | ||
this.socket.send(`{"t":"d","d":{"r":1,"a":"p","b":{"p":"/${this.pin}/c/${player}","d":{"at":"${this.name}:${this.animal}:swap","b":"${targetanimal}","g":${this.cash}}}}}`) | ||
} | ||
rob(player) { | ||
var target = this.steal[0][player] | ||
var percent = this.steal[1] | ||
if (!target.g) { | ||
target.g = 0 | ||
} | ||
var amount = (percent / 100) * target.g | ||
var remaining = target.g - amount | ||
this.cash += amount | ||
this.socket.send(`{"t":"d","d":{"r":1,"a":"p","b":{"p":"/${this.pin}/c/${this.name}","d":{"at":"${player}:${target.b}:${amount}","b":"${this.animal}","g":${remaining}}}}}`) | ||
this.emit("NextQuestion") | ||
} | ||
async BotSpam(pin, name, animal, n) { | ||
await socketcheck(pin).then((socket) => { this.socket = new ws(socket.url)}) | ||
this.socket.on("open", async function() { | ||
if (animal == "random") { | ||
this.pin = pin | ||
this.name = name | ||
this.animal = animal | ||
this.socket = this | ||
animal = await new Promise(async(resolve, reject) => { | ||
var blooklist = [] | ||
var playerlist = await getPlayers(this) | ||
console.log(playerlist) | ||
for (var player in playerlist) { | ||
blooklist.push(playerlist[player].b) | ||
} | ||
console.log(blooklist) | ||
var blooks = ["Chick","Chicken","Cow","Goat","Horse","Pig","Sheep","Duck","Dog","Cat","Rabbit","Goldfish","Hamster","Turtle","Kitten","Puppy","Bear","Moose","Fox","Raccoon","Squirrel","Owl","Hedgehog","Tiger","Orangutan","Cockatoo","Parrot","Anaconda","Jaguar","Macaw","Toucan","Panther","Capuchin","Snowy Owl","Polar Bear","Artic Fox","Baby Penguin","Penguin","Arctic Hare","Seal","Walrus","Witch","Wizard","Elf","Fairy","Slime Monster","Jester","Dragon","Queen","Unicorn","King","Two of Spades","Eat Me","Drink Me","Alice","Queen of Hearts","Dormouse","White Rabbit","Cheshire Cat","Caterpillar","Mad Hatter","King of Hearts","Toast","Cereal","Yogurt","Breakfast Combo","Orange Juice","Milk","Waffle","Pancakes","French Toast","Pizza","Earth","Meteor","Stars","Alien","Planet","UFO","Spaceship","Astronaut","Snow Globe","Holiday Gift","Hot Chocolate","Holiday Wreath","Gingerbread Man","Gingerbread House","Snowman","Santa Claus","Pumpkin","Swamp Monster","Frankenstein","Vampire","Zombie","Mummy","Werewolf","Ghost","Red Astronaut","Blue Astronaut","Green Astronaut","Pink Astronaut","Orange Astronaut","Yellow Astronaut","Black Astronaut","Purple Astronaut","Brown Astronaut","Cyan Astronaut","Lime Astronaut","Spooky Pumpkin","Spooky Mummy","Spooky Ghost","Frost Wreath","Tropical Globe"]; | ||
blooklist.forEach((blook) => { | ||
delete blooks[blooks.indexOf(blook)] | ||
}); | ||
var blooks = blooks.filter(function(blook) { | ||
return blook != null | ||
}); | ||
return resolve(blooks[Math.floor(Math.random() * blooks.length)]) | ||
}) | ||
} | ||
var t = 0 | ||
while (n > t) { | ||
this.send(`{"t":"d","d":{"r":2,"a":"p","b":{"p":"/${pin}/c/${name + " " + t}","d":{"b":"${animal}"}}}}`) | ||
t += 1 | ||
console.log("Sent Player") | ||
} | ||
}) | ||
function Blooket() { | ||
console.log("Sorry! Blooket.JS has been removed.") | ||
} | ||
} | ||
module.exports = Blooket; | ||
module.exports = Blooket |
{ | ||
"name": "blooket.js", | ||
"version": "1.2.3", | ||
"description": "This is a terminal client for the quiz service known as Blooket", | ||
"version": "1.2.5", | ||
"description": "Blooket.js has been taken down per request of Blooket", | ||
"main": "blooket.js", | ||
@@ -22,12 +22,7 @@ "scripts": { | ||
"author": "RedYetiDev", | ||
"license": "ISC", | ||
"license": "CC-BY-4.0", | ||
"bugs": { | ||
"url": "https://github.com/RedYetiDev/blooket.js/issues" | ||
}, | ||
"homepage": "https://blooket.js.org", | ||
"dependencies": { | ||
"events": "^3.2.0", | ||
"got": "^11.8.1", | ||
"ws": "^7.4.3" | ||
} | ||
"homepage": "https://blooket.js.org" | ||
} |
202
README.md
@@ -1,200 +0,8 @@ | ||
![Blooket.JS](https://blooket.js.org/images/favicon_animated.svg) | ||
# Blooket.JS | ||
## Version 1.2.2 | ||
#### Table Of Contents | ||
- [Features](#features) | ||
- [Semi Bugs](#sbugs) | ||
- [Bugs](#bugs) | ||
- [Documentation](#docs) | ||
- [Installing](#install) | ||
- [Using](#use) | ||
- [Options](#options) | ||
- [Joining](#use) | ||
- [Functions](#functions) | ||
- [Connect](#connect) | ||
- [Join](#joinfunction) | ||
- [Start Question](#startquestionfunction) | ||
- [answer](#answer) | ||
- [autocorrect](#autocorrect) | ||
- [Get Gold](#getgoldfunction) | ||
- [Swap](#swapfunction) | ||
- [Rob](#rob) | ||
- [BotSpam](#bot) | ||
- [Events](#events) | ||
- [Joined](#joined) | ||
- [GameStart](#gamestart) | ||
- [QuestionStart](#questionstart) | ||
- [Correct](#correct) | ||
- [GetGold](#getgold) | ||
- [Swap](#swap) | ||
- [Steal](#steal) | ||
- [Examples](#examples) | ||
- [answer](#answerexample) | ||
- [GetGold](#gg) | ||
- [Swap and Steal](#ss) | ||
- [NextQuestion](#nq) | ||
- [Upcoming Features](#up) | ||
- [Other Projects](#other) | ||
### <a id="features"></a>Features | ||
- Joining games | ||
- Playing games | ||
- Bot Spam | ||
- Random Blook | ||
- Auto answer (can be set to do it correctly, see [this issue](https://github.com/RedYetiDev/blooket.js/issues/2)) | ||
- Can use "Prizes", like the normal client | ||
Blooket.JS has been removed per request by Blooket. The projects that will no longer be available are | ||
- Blooket API | ||
- Blooket.JS | ||
- Blooket.JS-web | ||
### <a id="sbugs"></a>Semi-Bugs | ||
###### (Bugs that are not bad) | ||
- Answering takes 1 second exactly | ||
- If a player swaps with the client, the client does not lose any gold | ||
### <a id="bugs"></a>Bugs | ||
- Client swapping does not work (Only for Gold Quest) | ||
- Client can't join mid-game (Not Applicable for Battle Royale or Classic Game Mode) | ||
- In `modules/socket.js`, there is a typo on `line 83`, causing some WebSocket issues. (Patched in Version 1.2) | ||
### <a id="docs"></a>Documentation | ||
#### <a id="install"></a>Installing | ||
Run `npm install blooket.js` to install Blooket.JS | ||
#### <a id="use"></a>Using | ||
To import the package, use | ||
```js | ||
const Blooket = require("blooket.js") | ||
const game = new Blooket() | ||
``` | ||
The `Blooket()` class can have options with it. The options you can use are below | ||
<a id="options"></a> | ||
| Option | Description | Type | Values | Default Value | | ||
|------------|----------------------------------------------------------------------------|-----------------------------------|-----------------------|---------------| | ||
| repeat | Once the client answers all questions, will it start over | Boolean | true/false | true | | ||
| blookcash | (Factory Mode Only) How much cash each block should give. | Integer | Any number | 100 | | ||
| blooktime | (Factory Mode Only) How long between the books generating cash | Integer (milliseconds) | Any Number | 1000 | | ||
| answertime | (Battle Royale Mode Only) How long it took the client to answer | Integer (milliseconds 1 to 20000) | Any number 1 to 20000 | 1 | | ||
| cafebonus | (Cafe Mode Only) The amount of cash to give the client after every answer. | Integer | Any number | 100 | | ||
| towerbonus | (Tower Defense Mode Only) The amount of cash to give the client after every answer. | Integer | Any number | 1 | | ||
The options should be formatted as a JSON object like such | ||
```js | ||
const game = new Blooket({ | ||
option: value | ||
}) | ||
``` | ||
## <a id="join"></a>Joining Games | ||
To join a game, run the following command | ||
```js | ||
game.join(pin,name,animal) | ||
``` | ||
## <a id="functions"></a>Functions | ||
- #### <a id="joinfunction"></a>join(pin, name, animal) | ||
This join function is the main function run by the user, | ||
It returns the events listed in the events section | ||
- #### <a id="connect"></a>connect() | ||
The connect function is run by join() function, as shown in the `blooket.js` file. It connected the user to the socket and game. | ||
- #### <a id="startquestionfunction"></a>startquestion() | ||
The startquestion function is used after `NextQuestion` is emited (see `NextQuestion` in `Events` and `NextQuestion` in `Examples`), it is used to start the next question. | ||
- #### <a id="answer"></a>answer(a) | ||
The answer function is used to answer the question. the `a` variable can be a number 1 through 4. The answer function is called by the user after `QuestionStart` is emitted. (See `QuestionStart` in `Events` and `answer` in `Examples`). | ||
- #### <a id="autocorrect">autocorrect() | ||
The `autocorrect` function is a function to be used in place of the `a` variable within the `game.answer` function. So, instead of running `game.answer(1,2,3 or 4)`, run `game.answer(game.autocorrect())` | ||
- #### <a id="getgoldfunction"></a>getgold(p) | ||
(Only in Gold Quest) The getgold function is used to collect your prize. The `p` variable can by a number 1 through 3. The prizes you can get are randomly selected (see `modules/goldchance.js`). This function is run when the user handles the `GetGold` event. (See `GetGold` in `Events`). | ||
- #### <a id="swapfunction"></a>swap(player) | ||
(Only in Gold Quest) The swap function is used to swap with a player. The `player` variable should be a name of a player in the game, or a `Object.keys()` function like `Object.keys({variable})[0]` replacing `0` with a number 0-through the amount of players subtracted by 1 (ex: 20 players means number 0 through 19). It is used while handling the `Swap` event (see `Swap` in `Events` and `Swap and Steal` in `Examples`). | ||
- #### <a id="rob"></a>rob(player) | ||
(Only in Gold Quest) The rob function is used to steal from a player. The `player` variable should be a name of a player in the game, or a `Object.keys()` function like `Object.keys({variable})[0]` replacing `0` with a number 0-through the amount of players subtracted by 1 (ex: 20 players means number 0 through 19). It is used while handling the `Steal` event (see `Steal` in `Events` and `Swap and Steal` in `Examples`). | ||
- #### <a id="bots"></a>BotSpam(pin, name, animal, n) | ||
Using the BotSpam function will unleash a army of even robots to destroy the world:boom: :scream: :boom:! No it will not... yet... The BotSpam function takes all the normal join arguments (`pin`, `name`, `animal`), and one extra, `n`. This variable should be positive number. It is the number of bots to spam the game with. (The bots will not answer questions but might in the future). The `BotSpam` function should be the **ONLY** function in the script when used. The correct way to call this function to use the following snippet | ||
```js | ||
const Blooket = require("blooket.js") | ||
const game = new Blooket() | ||
game.BotSpam(PIN,Name,Animal, Number) | ||
``` | ||
The Bot's names will be as such "Name0", "Name1", "Name2"... | ||
## <a id="events"></a>Events | ||
The Blooket.JS class emits events at different times. Below is a brief explanation of the events | ||
- #### <a id="joined"></a>Joined | ||
This is emitted when the client joins the game | ||
- #### <a id="gamestart"></a>GameStart | ||
The GameStart event is emitted when the game begins, this event does not work in Battle Royale Mode. | ||
- #### <a id="questionstart"></a>QuestionStart | ||
The QuestionStart event is emitted when a question begins. While handling this event, it is required to run the `game.answer()` function. | ||
- #### <a id="correct"></a>Correct | ||
The Correct event is emitted when a question is answered correctly. | ||
- #### <a id="getgold"></a>GetGold | ||
The GetGold event is emitted when a player gets a question correct, and they are playing in gold quest mode. When handling this event, it is required to run the `game.getgold()` function. | ||
- #### <a id="swap"></a>Swap | ||
The Swap event is emitted when the `game.getgold()` function returns `swap` as the prize. for more prize details, see the `modules/goldchance.js` file. When handling this event, it is required to run the `game.swap()` function. Returns a list of players | ||
- #### <a id="Steal"></a>Steal | ||
The Steal event is emitted similarly to the Swap event, except instead running `game.swap()`, it is required to run `game.rob()`. Returns a list of players | ||
- #### <a id="NextQuestion"></a>NextQuestion | ||
The NextQuestion event is emitted when the question has ended, and the prizes (gold, cash, blooks, etc.) have been processed, when handling this event, this is required to run the `game.startquestion()` function. | ||
- #### <a id="debug"></a>Debug Events | ||
- ##### <a id="socketconnect"></a>SocketConnect | ||
The SocketConnect event is emitted once the client connects to the Blooket.JS socket. | ||
## <a id="examples"></a>Examples | ||
- <a id="answerexample"></a>Answer | ||
```js | ||
game.on("QuestionStart", function() { | ||
game.answer(1) // can be 1,2,3,4 | ||
}) | ||
``` | ||
- <a id="gg"></a>GetGold | ||
```js | ||
game.on("GetGold", function() { | ||
game.getgold(1) // can be 1,2,3 | ||
}) | ||
``` | ||
- <a id="ss"></a>Swap and Steal | ||
```js | ||
game.on("Swap", function(p) { | ||
game.swap(Object.keys(p)[0]) | ||
}) | ||
// Or | ||
game.on("Steal", function(p) { | ||
game.rob(Object.keys(p)[0]) | ||
}) | ||
``` | ||
- <a id="nq"></a>NextQuestion | ||
```js | ||
game.on("NextQuestion", function() { | ||
game.startquestion() | ||
}) | ||
``` | ||
## <a id="up"></a>Upcoming Features | ||
- `Powerups/Glitch` support in Factory Mode | ||
- And more | ||
## <a id="other"></a>My Other Projects | ||
Some other projects I have created and worked on: | ||
- The First Transcontinental Railroad - [Website](https://redyetidev.github.io/First-Transcontinental-Railroad), [Repo](https://github.com/RedYetiDev/First-Transcontinental-Railroad) | ||
A website with information on the First Transcontinental Railroad, also good for a website example. (Uses examples from [w3schools](https://www.w3schools.com).) | ||
- Blooket API - [Website](https://redyetidev.github.io/Blooket-API), [Repo](https://github.com/RedYetiDev/Blooket-API) | ||
Similar to this project, but online, it is still buggy. | ||
- EmbedCode - [Website](https://redyetidev.github.io/embedCode), [Repo](https://github.com/redyetidev/embedCode) | ||
EmbedCode in a website that allows to embed your source code into an iframe, with syntax highlighting and line numbering. Check the repo for more info. | ||
I apologize for the inconvenience. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Copyleft License
License(Experimental) Copyleft license information was found.
Found 1 instance in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
Non-permissive License
License(Experimental) A license not known to be considered permissive was found.
Found 1 instance in 1 package
0
0
100
879
3
4
9
2
- Removedevents@^3.2.0
- Removedgot@^11.8.1
- Removedws@^7.4.3
- Removed@sindresorhus/is@4.6.0(transitive)
- Removed@szmarczak/http-timer@4.0.6(transitive)
- Removed@types/cacheable-request@6.0.3(transitive)
- Removed@types/http-cache-semantics@4.0.4(transitive)
- Removed@types/keyv@3.1.4(transitive)
- Removed@types/node@22.9.1(transitive)
- Removed@types/responselike@1.0.3(transitive)
- Removedcacheable-lookup@5.0.4(transitive)
- Removedcacheable-request@7.0.4(transitive)
- Removedclone-response@1.0.3(transitive)
- Removeddecompress-response@6.0.0(transitive)
- Removeddefer-to-connect@2.0.1(transitive)
- Removedend-of-stream@1.4.4(transitive)
- Removedevents@3.3.0(transitive)
- Removedget-stream@5.2.0(transitive)
- Removedgot@11.8.6(transitive)
- Removedhttp-cache-semantics@4.1.1(transitive)
- Removedhttp2-wrapper@1.0.3(transitive)
- Removedjson-buffer@3.0.1(transitive)
- Removedkeyv@4.5.4(transitive)
- Removedlowercase-keys@2.0.0(transitive)
- Removedmimic-response@1.0.13.1.0(transitive)
- Removednormalize-url@6.1.0(transitive)
- Removedonce@1.4.0(transitive)
- Removedp-cancelable@2.1.1(transitive)
- Removedpump@3.0.2(transitive)
- Removedquick-lru@5.1.1(transitive)
- Removedresolve-alpn@1.2.1(transitive)
- Removedresponselike@2.0.1(transitive)
- Removedundici-types@6.19.8(transitive)
- Removedwrappy@1.0.2(transitive)
- Removedws@7.5.10(transitive)