1.2.14 • Published 8 months ago

codyfight-game-client v1.2.14

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

codyfight-game-client

image

A library for interacting with Codyfight game API.

Easily implement Codyfight game actions.


šŸ“œ Make sure to checkout the game API documentation.

Install

npm install codyfight-game-client --save-dev

Usage

The constructor of the class takes an optional parameter apiURL, which is a string that represents the URL of the API to be used. The default value is https://game.codyfight.com/.

import it with the following code:

import GameAPI from 'codyfight-game-client'

const gameAPI = new GameAPI(apiURL, {
  // Override default headers (optional)
  headers: {
    'Content-Type': 'application/json',
    Accept: 'application/json',
  },
})

API

The API has the following public methods:

getGameConstants

This method returns an object with the game constants.

const constants = gameAPI.getGameConstants()

init

This method initializes a game with the given parameters and returns a Promise that resolves to the data received from the API.

const data = await gameAPI.init(ckey, mode, opponent)

cast

This method casts a skill with the given parameters and returns a Promise that resolves to the data received from the API.

const data = await gameAPI.cast(ckey, skill_id, x, y)

move

This method moves a player with the given parameters and returns a Promise that resolves to the data received from the API.

const data = await gameAPI.move(ckey, x, y)

check

This method checks the status of a game with the given ckey and returns a Promise that resolves to the data received from the API.

const data = await gameAPI.check(ckey)
1.2.12

8 months ago

1.2.13

8 months ago

1.2.14

8 months ago

1.2.10

10 months ago

1.2.11

10 months ago

1.1.1

2 years ago

1.1.0

2 years ago

1.2.8

2 years ago

1.2.7

2 years ago

1.2.5

2 years ago

1.2.4

2 years ago

1.2.3

2 years ago

1.2.2

2 years ago

1.2.1

2 years ago

1.2.9

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago