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

@goodgamestudios/cxf-events

v1.23.1

Published

Unified events for BigFarm, Empire and others

Downloads

331

Readme

cxf-events

💬 Unified events for CXF extensions

Motivation

Games exchange messages in different formats and with different IDs. For example, a login command looks different on BigFarm and Empire. cxf-events normalizes & standardizes basic events in a game-agnostic way. Your CXF extension can subscribe to cxf.* events and work in almost all games.

+------------------+
|                  |
| LOGIN_BASIC_DATA |--->------+
|                  |       becomes
+------------------+          ↓
                      +---------------+
                      |               |
                      |   cxf.login   |---→ your CXF Extension
                      |               |
                      +---------------+
+------------------+          ↑
|                  |       becomes
|        gbd       |--->------+
|                  |
+------------------+

Usage

  • Include @goodgamestudios/cxf-events in @goodgamestudios/cxf-plugins
// Wait for cxf to be ready
require('@goodgamestudios/cxf-ready').then(cxf => {
  // Subscribe to relevant events
  cxf.on(CxfEvents.Login, loginData => {
    // do something on login
  })
})

Events

cxf.login

Emitted after a successful player login. In addition to sending the login arguments with the event, cxf.login also stores them in cxf.playerId, cxf.instanceId, cxf.networkId, cxf.gameId and cxf.language.

  • Event ID cxf.login
  • Arguments { playerId, instanceId, networkId, gameId, language }

Example

require('@goodgamestudios/cxf-ready').then(cxf => {
  cxf.on(CxfEvents.Login, loginData => {
    // do something on login
  })
})

How to listen for new game events

Bigfarm

To be able to listen for a new event from bigfarm, you will need to either listen to its descriptive event or its ID event. For instance: If you want to listen for the SUBSCRIPTION_INFO event (ID 460) you will need to:

To be able to listen for a new event from bigfarm, you will need to either listen to its descriptive event and also its ID event. For instance, if you want to listen for the SUBSCRIPTION_INFO event (ID 460) you will need to:

// Just listening for this event is not enough
cxf.once('SUBSCRIPTION_INFO', (e: BigfarmEvent<BigfarmSubscriptionEvent>) => {
  // Your code here
});
// Subscribing to event id, so the first event will be fowarded to CXF
cxf.on('460', () => {});