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

rpgjs-character-select

v1.1.2

Published

It's a plugin of [RPG JS](https://rpgjs.dev/) engine that gives possibility to select character just after logging in with a GUI.

Downloads

7

Readme

RPG JS Character select plugin

Description

It's a plugin of RPG JS engine that gives possibility to select character just after logging in with a GUI.

Requirements ⚠️

Features

✅ GUI for selecting actor after first login to game
✅ Possibility to assign graphics to the clsas

Watch the video

Installation

You can easily install the RPG JS Plugin using npm. Open your terminal and run the following command:

npx rpgjs add rpgjs-character-select

Remember to add plugin to the rpg.toml

modules = [
   'rpg-character-select',
]

Usage

1. You have to define class using extended decorator from this package.

import { Class } from "rpgjs-character-select";

@Class({
    /* ... other properties */
    graphics: {
        pernament: ['body-light', 'head-light', 'male-spiked2-sandy'],
        baseEquipment: {
            torso: 'shortsleeve-charcoal',
            legs: 'pants-black',
        },
        animations: ['slash'],
    }
})
export default class Archer {}

pernament are graphics displayed for player everytime.

baseEquipment is separated from pernament and animations graphics to have possibility to change them eg. when you want to equip some item and change graphic for it.

animations it's array of animations like slash of a sword or casting some skill. ⚠️ This property may be removed in future.

Example:

graphics: {
    pernament: ['body-light', 'head-light', 'long-light-ears', 'male-bangslong-platinum'],
    baseEquipment: {
        torso: 'vest-black',
        legs: 'pants-black',
    },
    animations: ['slash', 'fire-ball-cast'],
}

2. Next assign this class to the actor

import { Actor } from '@rpgjs/database'

const { MAXHP } = Presets

@Actor({
    /* ... other parameters */
    class: Archer
})
export default class Elf {}

3. Add actor ids to plugin configuration in the rpg.toml

[characterSelect]
  actors = [
    'human',
    'elf',
    'vampire',
  ]

4. Assign actor id to the player and show graphics in player.ts

const player: RpgPlayerHooks = {
    /* ... */
    onCharacterSelected(player: RpgPlayer, actorId: string) {
        player.setActor(actorId);
    },
    onAuthSuccess(player: RpgPlayer) {
        const graphics = player._class.graphics as ClassGraphics;

        player.setGraphic([
            ...graphics.pernament,
            ...graphics.animations,
            ...Object.values(graphics.baseEquipment),
        ]);
    }
}

⚠️ Important ⚠️

Keep in mind that that onCharacterSelected hook is executed before onAuthSuccess

Customization

You can override variables and styles in theme.scss

/* variables */

$character-select-screen-background: url('../assets/backgrounds/character-select.png');
$character-select-arrow-left-image: url('../assets/gui/arrow-left.png') !default;
$character-select-arrow-right-image: url('../assets/gui/arrow-right.png') !default;
$window-button-success-color: #1c8634;
$window-button-success-shadow: #0d4c30;
$window-button-color: rgba(128, 130, 162, 0.7);
$window-button-shadow: rgb(128, 130, 162);

/* styles */

.character-select {
  &__class-name {
    color: $primary;
  }

  &__arrow-left {
    width: 75px;
    height: 75px;

    &:hover {
      background: url('@/modules/config/assets/gui/shared/left_arrow_h.png');
      background-size: 100% 100%;
      filter: brightness(1);
    }
  }

  &__arrow-right {
    width: 75px;
    height: 75px;

    &:hover {
      background: url('@/modules/config/assets/gui/shared/right_arrow_h.png');
      background-size: 100% 100%;
    }
  }

  &__submit-button {
    width: 200px;
    height: 75px;
    font-weight: normal;

    &:hover {
      box-shadow: none;
    }
  }

  &__description-content {
    &:before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        background: url('@/modules/config/assets/gui/boxes/news_top_ornament.png');
        background-size: 100% 100%;
        width: 100%;
        height: 35px;
        margin-top: -32px;
        filter: brightness(1.5);
    }

    &:after {
      content: '';
      position: absolute;
      bottom: 0;
      left: 50%;
      transform: translateX(-50%);
      background: url('@/modules/config/assets/gui/boxes/news_bottom.png');
      background-size: 100% 100%;
      width: 50%;
      height: 35px;
      margin-bottom: -32px;
      filter: brightness(1.5);
    }

    &::-webkit-scrollbar-track {
      background: #fff;
      width: 7px;
    }

    &::-webkit-scrollbar {
      background: #fff;
      width: 7px;
    }

    &::-webkit-scrollbar-thumb {
      background: rgba(0, 0, 0, .5);

      &:hover {
        background: rgba(0, 0, 0, .7);
      }
    }
  }
}

Custom view