Nutritious Pomegranate Muffins

    @goodgamestudios/cxf-events
    TypeScript icon, indicating that this package has built-in type declarations

    1.22.0 • Public • Published

    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
      })
    })

    Keywords

    Install

    npm i @goodgamestudios/cxf-events

    DownloadsWeekly Downloads

    29

    Version

    1.22.0

    License

    MIT

    Unpacked Size

    66.3 kB

    Total Files

    7

    Last publish

    Collaborators

    • abuhler_ggs
    • jonasbraga-ggs
    • tduman-ext-gg
    • keep_it_simple
    • lsetton-ext
    • rschmidt-ggs
    • ssydorenko-ggs
    • vtenekedzhiev-ggs
    • tschrader-ggs
    • goodgame
    • jenkinshtml5migra
    • azeino-ggs
    • ddepaolis-ggs
    • boczujda_ggs
    • guest-ggs
    • andreaspizsa
    • cgeisler-ggs
    • amartin-ggs
    • mabdallah-ggs
    • jenkinsempire-ggs
    • chadestioco
    • evmoroz
    • ggs-skunkbot
    • stp_ci_ggs
    • it_office
    • iskliarenko