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 🙏

© 2025 – Pkg Stats / Ryan Hefner

anime-gacha-system

v1.0.1

Published

Sistema de gacha de personajes de anime basado en puntajes para bots de Discord, Telegram, WhatsApp y más. Incluye +5000 personajes con sistema de rareza.

Readme

🎲 Anime Gacha Package

Sistema de gacha de personajes de anime basado en puntajes, diseñado para bots de Discord, Telegram, WhatsApp y otras plataformas. Incluye más de 5,000 personajes con sistema de rareza, rolls y estadísticas.

📦 Instalación

npm install anime-gacha-system

🚀 Uso Rápido

const gacha = require('anime-gacha-system');

const character = gacha.roll();
console.log(`${character.name} - Score: ${character.score}`);

🎯 Funciones Principales

Sistema de Gacha

roll()

Realiza un roll aleatorio de personaje.

const char = gacha.roll();
// Retorna: { id, name, rarity, rarityLevel, stars, value, score, rank, ... }

rollMultiple(count)

Realiza múltiples rolls (máximo 10).

const chars = gacha.rollMultiple(5);

rollWithPity(pityLevel)

Roll con boost de rareza (0-100).

const char = gacha.rollWithPity(75);
console.log(char.pityActivated); // true/false

Sistema de Rareza

| Nivel | Nombre | Estrellas | Valor | Drop Rate | |-------|--------|-----------|-------|-----------| | 1 | Common | ⭐ | 10 | 65.9% | | 2 | Uncommon | ⭐⭐ | 25 | 25.7% | | 3 | Rare | ⭐⭐⭐ | 50 | 5.6% | | 4 | Epic | ⭐⭐⭐⭐ | 100 | 2.2% | | 5 | Legendary | ⭐⭐⭐⭐⭐ | 250 | 0.4% | | 6 | Mythic | ⭐⭐⭐⭐⭐⭐ | 500 | 0.1% |

Fórmula de Score: baseValue + (favorites / 100)

getCharactersByRarity(level)

Obtiene personajes por nivel de rareza (1-6).

const legendaries = gacha.getCharactersByRarity(5);

getRarityStats()

Obtiene estadísticas de distribución.

const stats = gacha.getRarityStats();
// { 1: { level, name, stars, value, count, percentage, dropRate }, ... }

Búsqueda y Filtrado

getCharacterById(id)

Busca por ID de MyAnimeList.

const lelouch = gacha.getCharacterById(417);

searchCharactersByName(query)

Busca por nombre.

const results = gacha.searchCharactersByName('Naruto');

getTopCharacters(limit)

Obtiene los más populares.

const top10 = gacha.getTopCharacters(10);

getCharactersByScore(minScore, maxScore)

Filtra por rango de puntaje.

const highScorers = gacha.getCharactersByScore(1000);

Utilidades

formatCharacter(character, options)

Formatea un personaje para exportar.

const formatted = gacha.formatCharacter(char, {
  includeUrl: true,
  includeImage: true,
  includeAnime: true,
  includeScore: true,
  includeFullData: false
});

getStarsString(stars, symbol)

Genera string de estrellas.

const stars = gacha.getStarsString(5, '⭐'); // "⭐⭐⭐⭐⭐"

calculateCollectionScore(characters)

Calcula estadísticas de una colección.

const collection = gacha.rollMultiple(10);
const stats = gacha.calculateCollectionScore(collection);
// { totalScore, totalValue, averageScore, count, rarityDistribution }

getSimilarCharacters(characterId, limit)

Obtiene personajes similares.

const similar = gacha.getSimilarCharacters(417, 5);

📊 Estructura de Datos

Character Object

{
  id: 417,
  name: "Lelouch Lamperouge",
  nameKanji: "ルルーシュ・ランペルージ",
  url: "https://myanimelist.net/character/417/...",
  image: "https://cdn.myanimelist.net/images/...",
  favorites: 174976,
  rarity: "Mythic",
  rarityLevel: 6,
  stars: 6,
  value: 500,
  score: 2249,
  rank: 1,
  anime: "Code Geass",
  fullData: { ... }
}

🤖 Ejemplos de Implementación

Discord Bot

const { Client, EmbedBuilder } = require('discord.js');
const gacha = require('anime-gacha-system');

client.on('messageCreate', message => {
  if (message.content === '!roll') {
    const char = gacha.roll();
    
    const embed = new EmbedBuilder()
      .setTitle(`${char.name} ${gacha.getStarsString(char.stars, '⭐')}`)
      .setDescription(`**${char.rarity}** (Level ${char.rarityLevel})`)
      .addFields(
        { name: 'Score', value: char.score.toString(), inline: true },
        { name: 'Value', value: char.value.toString(), inline: true },
        { name: 'Rank', value: char.rank ? `#${char.rank}` : 'Unranked', inline: true }
      )
      .setImage(char.image)
      .setColor(getRarityColor(char.rarityLevel));
    
    message.reply({ embeds: [embed] });
  }
});

function getRarityColor(level) {
  const colors = [null, 0xFFFFFF, 0x00FF00, 0x0000FF, 0x800080, 0xFF8C00, 0xFF0000];
  return colors[level] || 0xFFFFFF;
}

Telegram Bot

const TelegramBot = require('node-telegram-bot-api');
const gacha = require('anime-gacha-system');

bot.onText(/\/roll/, (msg) => {
  const char = gacha.roll();
  const stars = gacha.getStarsString(char.stars, '⭐');
  
  const text = `
${stars} ${char.name}
━━━━━━━━━━━━━━━
🎭 Rarity: ${char.rarity} (Lv${char.rarityLevel})
💎 Score: ${char.score}
💰 Value: ${char.value}
📊 Rank: ${char.rank ? `#${char.rank}` : 'Unranked'}
📺 Anime: ${char.anime || 'Unknown'}
  `.trim();
  
  bot.sendPhoto(msg.chat.id, char.image, { caption: text });
});

WhatsApp Bot (Baileys)

const gacha = require('anime-gacha-system');

sock.ev.on('messages.upsert', async ({ messages }) => {
  const msg = messages[0];
  if (msg.message?.conversation === '!roll') {
    const char = gacha.roll();
    const stars = gacha.getStarsString(char.stars, '⭐');
    
    await sock.sendMessage(msg.key.remoteJid, {
      image: { url: char.image },
      caption: `${stars} ${char.name}\n\nRarity: ${char.rarity}\nScore: ${char.score}\nValue: ${char.value}`
    });
  }
});

API REST

const express = require('express');
const gacha = require('anime-gacha-system');
const app = express();

app.get('/api/roll', (req, res) => {
  const char = gacha.roll();
  const formatted = gacha.formatCharacter(char, {
    includeUrl: true,
    includeImage: true,
    includeAnime: true,
    includeScore: true
  });
  res.json(formatted);
});

app.get('/api/roll/multi/:count', (req, res) => {
  const count = parseInt(req.params.count) || 3;
  const chars = gacha.rollMultiple(count);
  res.json(chars);
});

app.get('/api/top/:limit', (req, res) => {
  const limit = parseInt(req.params.limit) || 10;
  const top = gacha.getTopCharacters(limit);
  res.json(top);
});

app.listen(3000);

🎮 Sistema de Pity

let pityCounter = 0;

function rollWithPitySystem() {
  pityCounter += 10;
  const result = gacha.rollWithPity(pityCounter);
  
  if (result.rarityLevel >= 5) {
    pityCounter = 0;
  }
  
  return result;
}

💾 Sistema de Colección

const userCollection = [];

function addToCollection(character) {
  userCollection.push(character);
  const stats = gacha.calculateCollectionScore(userCollection);
  
  console.log(`Collection Score: ${stats.totalScore}`);
  console.log(`Total Characters: ${stats.count}`);
  console.log(`Average Score: ${stats.averageScore}`);
  
  return stats;
}

🔧 Constantes Disponibles

const { RARITY_TIERS } = gacha;

console.log(RARITY_TIERS);
// {
//   1: { min: 0, max: 1000, name: 'Common', value: 10, stars: 1 },
//   2: { min: 1001, max: 5000, name: 'Uncommon', value: 25, stars: 2 },
//   ...
// }

📝 Funciones Exportadas

{
  getAllCharacters,
  getCharacterById,
  getTopCharacterIds,
  getTopCharacters,
  searchCharactersByName,
  getRandomCharacter,
  getCharactersByFavorites,
  getDatabaseInfo,
  roll,
  rollMultiple,
  rollWithPity,
  getCharactersByRarity,
  formatCharacter,
  getStarsString,
  getSimilarCharacters,
  getRarityStats,
  calculateRarity,
  calculateScore,
  calculateCollectionScore,
  getCharactersByScore,
  RARITY_TIERS
}

📄 Licencia

MIT

👤 Autor

zumberr

🔗 Links