npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

owop-bot-lib

v0.7.0

Published

browser/Node JS package for creating OWOP bots

Downloads

8

Readme

OWOP bot lib

OWOP - Our World Of Pixels
docs are not fully finished

Client

Client extends EventEmitter Node.js

const OWOPBotLib = require("owop-bot-lib"); // { Client, utils, gameSettings, WebSocket, Buffer (buffer package), createClient  }
const bot = new OWOPBotLib.Client();
bot.on("join", console.log) // logs id 

OPM (the library is not published on opm yet)

const { createClient } = OPM.require("owop-bot-lib"); // Client

const bot = createClient();
bot.on("join", console.log) // logs id 

you can also import owop-bot-lib using es modules

import { createClient } from "owop-bot-lib";

possible Client.options

teleport (buggy)

if enabled accepts teleport from server

unsafe

ignores permissions stops checking can send message can set pixel

and all other options from Client.defaultOptions

static defaultOptions

Default options which will be deep copied and set to ClientInstance.options

const Client = OPM.require("owop-bot-lib").Client;
console.log(Client.defaultOptions) /*{
wsUrl:  "wss://ourworldofpixels.com", // address it connects to
captchaSiteKey:  "6LcgvScUAAAAAARUXtwrM8MP0A0N70z4DHNJh-KI", // not used
autoMakeSocket:  true, // should connect to websocket after instance created
autoConnectWorld:  true, // should connect to world after it gets 3rd captcha state
wsOptions: {
origin:  "https://ourworldofpixels.com"
},
protocol:  1, // 0 - bop it OWOP 1 - original owop and my latest OWOP server
worldName:  "main",
worldVerification:  gameSettings.misc.worldVerification // world verification code default 25565
}*/
// Client.options.wsOptions doesn't works on browser

makeSocket()

makes socket TO-DO example with proxies or something

messageHandler(message: websocketMessageEvent)

if someone needs it exists

sendMessage(message: string) => boolean

Sends message to chat

bot.sendMessage("BOB"); // true
bot.once("message", console.log); //this.player.id: BOB

join(worldName: string = "main") => this

joins world TO-DO example

leave() => this

disconnects websocket

playerUpdate(x: number = this.player.x, y: number = this.player.y, color: anyTypeOfArray = this.player.color, toolId: number = this.player.toolId) => this

Sends move, colorUpdate, toolUpdate in one packet

// you can do
bot.playerUpdate(123, 123, [53, 123, 43]);
// 1 packet(faster)
// instead of 
bot.move(123, 123);
bot.setColor([53, 123, 43]);
bot.setTool(gameSettings.toolsIds["cursor"] /* 0 */)
// 3 packets(slower)

move(x: number, y: number) => this

moves bot example in player update

setColor(color: anyTypeOfArray = this.player.color) => this

example in player update

setTool(toolId: number = this.player.toolId) => this

example in player update

pasteChunk(chunkX: number = this.player.chunkX, chunkY: number = this.player.chunkY, data: Uint8Array = new Uint8ClampedArray(chunkSize * chunkSize * 3))

setPixel(x: number = this.player.x, y: number = this.player.y, color: ArrayLike = this.player.color, wolfMove: boolean, sneaky: boolean, move: boolean = this.player.rank < 3) => this

Sets pixel on x y with color TO-DO explain what is wolfMove, sneaky, move

procetChunk(chunkX: number = this.player.chunkX, chunkY: number = this.player.chunkY, newState: boolean) => this

protects chunk required rank 2

client.protectChunk(10, 12, true);

setChunkRGB(chunkX: number = this.player.chunkX, chunkY: number = this.player.chunkY, color: ArrayLike = [255, 255, 255]) => this

sets chunk with color

async requestChunk(chunkX: number = this.player.chunkX, chunkY: number = this.player.chunkY) => Promise<Uint8Array>

Uint8Array is chunk\

you can request as much times as you want one chunk and it will ask the server only once for chunk

client.requestChunk(0, 0); // requestChunk always returns a Promise which resolves Uint8Array(chunkSize * chunkSize * 3) or error

async requestArea(chunkX1: number, chunkY1: number, chunkX2: number, chunkY2: number) => Promise<Array<Uint8Array>>

read requestChunk

async getPixel(x: number = this.player.x, y: number = this.player.y) => Promise

returns array with array [R, G, B]