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

drop-plugin

v1.1.1

Published

drop item plugin for pomelo

Downloads

1

Readme

DropPlugin

drop item or prize gift in an mobile game,base on pomelo

用途分析

  • 游戏是让玩家花时间或者金钱换取游戏世界中虚拟的东西,那么给用户东西的需求随处可见,几乎伴随着游戏一生.
  • 于是,某做了一个掉落物品的插件,可用于礼包,抽奖,关卡掉落,宝箱开启等相关物品产出的功能的开发.

使用方法

  • 本插件基于pomelo,终端进入game-server
npm install drop-plugin
  • 在config下新增文件夹drop,在drop文件夹下新增drop.json
{
  "development": "/app/data/json/drop",  // 指向掉落所需要的json文件
  "production": "/app/data/json/drop"    // 指向掉落所需要的json文件
}
  • 在需要掉落产出的地方,例如:通关奖励,抽卡等功能写下如下代码
require('drop-plugin').drop('1001');  // '1001'为json数据文件(非配置文件,下文详细说明)中的掉落组id
  • 掉落的返回内容如下
[ { outId: '2017', outNum: 1 } ]      // json结构,其中'2017',是你物品表中的物品id

json文件

  • 本插件中提供了测试用的json文件.
  • json文件其实是由倒表工具将excel转成的json数据.
  • 如果对倒表工具感兴趣,我这可提供一个,是于小懒先生写的,我修改了一下.

excel字段

第一个页签叫drop,是掉落包的设置

|掉落组集id|是否全部掉落0否1是|掉落次数|是否允许重复掉落0否1是 |是否为包中包0否1是| |:-------:|:-------------:|:-----:|:-----------------:|:-------------:| |id     |allDrop |dropNum|repeat |isGroup | |1001 |1 |0 |1 |1 |

第二个页签叫drop.out,是掉落的产出数据,可填写空产出以达到你的某些需求

|id |产出id(可以是掉落组id,也可以是你的物品表的id)|产出个数|权重 | |:---:|:-------------------------------------:|:-----:|:-----:| |id |outId |outNum |percent| |1001 |1 |1 |1 |

掉落组

  • 根据权重,掉落物品和数量.

掉落组集

  • 先掉落掉落组ID, 再根据掉落组ID, 掉落物品, 各掉落组的物品产出放入同一数组.

支持掉落情形

  • m,n为正整数
  • m里掉落n个,根据权重随机掉落n次,结果可重复.
  • m里掉落n个, m > n, 结果不可重复.单次掉落后重新计算权重.(若m > n请直接使用全部掉落)
  • m里全部掉落

版本说明

  • 1.1.0之前版本虽能使用,但使用起来没那么方便.
  • 1.1.0版本readme说明中有bug,我将尽快更新1.1.1版本.
  • 以上版本共有95个下载者,对这些下载者带来的不便和困惑,某表示抱歉,并保证以后发包的准确性.
  • 1.1.1版本代码上未做改动,修复了readme中的bug,增加了用途分析.