charlemagne

package
v1.9.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 11, 2018 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindCurrentMeta

func FindCurrentMeta(platform, requestedActivity string) (*skillserver.EchoResponse, error)

FindCurrentMeta will return information about commonly used weapons via the Charlemagne API

func FindMostPopularActivities

func FindMostPopularActivities(platform string) (*skillserver.EchoResponse, error)

FindMostPopularActivities will generate an EchoResponse that describes the most popular activities currently being played.

func InitEnv added in v1.9.3

func InitEnv()

Types

type ActivityResponse

type ActivityResponse struct {
	*BaseResponse
	*InnerActivityResponse `json:"response"`
}

ActivityResponse contains all the stats returned by the Charlemagne API from the activity endpoints

type ActivitySummary

type ActivitySummary struct {
	ActivityHash     string `json:"activityHash"`
	Mode             int    `json:"mode"`
	ModeName         string
	PercentagePlayed float64 `json:"percentagePlayed"`
	RawScore         int     `json:"rawScore"`
}

ActivitySummary contains data that summarizes the activity stats. It seems (from the sample responses) that either activity hash or mode will be provided but not both

type BaseResponse

type BaseResponse struct {
	ErrorCode int    `json:"errorCode"`
	ErrorMsg  string `json:"errorMessage"`
}

BaseResponse contains the field that are present in all response from the Charlemagne API.

type Client

type Client struct {
	*http.Client
	BaseURL string
}

Client is a type that encapsulates functionality for making requests to the Charlemagne API.

func (*Client) GetCurrentMeta

func (c *Client) GetCurrentMeta(activityHash string, gameModes []string, membershipType string) (*MetaResponse, error)

GetCurrentMeta will request informatino about the current "meta" in Destiny 2. The parameters can be used to filter the meta information returned by the API if a particular activity is requested, a set of game modes, or a specific platform.

func (*Client) GetPlayerActivity

func (c *Client) GetPlayerActivity() (*ActivityResponse, error)

GetPlayerActivity will send a request to the Charlemagne API to get the current activity for all players in the game.

type InnerActivityResponse

type InnerActivityResponse struct {
	AverageConcurrentPlayers int                         `json:"averageConcurrentPlayers"`
	ActivityByMode           map[string]*ActivitySummary `json:"activityByModeType"`
	ActivityByRaid           map[string]*ActivitySummary `json:"activityByRaid"`
	ActivityByPlatform       map[string]*PlatformSummary `json:"activityByPlatform"`
}

InnerActivityResponse is a wrapper around the data inside the inner response JSON tag. This is where the majority of the (meaningful) data is stored.

type InnerMetaResponse

type InnerMetaResponse struct {
	WeekNumber        int            `json:"weekNumber"`
	ActivityHash      string         `json:"activityHash"`
	MembershipTypes   string         `json:"membershipTypes"` // Comma separated
	ModeTypes         string         `json:"modeTypes"`       // Comma separated
	TopKineticWeapons []*WeaponStats `json:"topKineticWeapons"`
	TopEnergyWeapons  []*WeaponStats `json:"topEnergyWeapons"`
	TopPowerWeapons   []*WeaponStats `json:"topPowerWeapons"`
}

InnerMetaResponse is a wrapper around the inner response JSON tag. This is where the majority of the data is stored.

type MetaResponse

type MetaResponse struct {
	*BaseResponse
	*InnerMetaResponse `json:"response"`
}

MetaResponse contains the fields returned from the Charlemagne API for meta endpoints

type PlatformSummary

type PlatformSummary struct {
	MembershipType int                         `json:"membershipType"`
	DisplayName    string                      `json:"displayName"`
	RawScore       int                         `json:"rawScore"`
	Percent        float64                     `json:"percent"`
	ActivityByMode map[string]*ActivitySummary `json:"activityByModeType"`
	ActivityByRaid map[string]*ActivitySummary `json:"activityByRaid"`
}

PlatformSummary contains the activity data for the different platfomrs. These summaries are keyed by the platform ID string.

type WeaponStats

type WeaponStats struct {
	WeaponID   int    `json:"weaponId"`
	WeaponName string `json:"weaponName"`
	TotalKills int    `json:"totalKills"`
	WeaponType string `json:"weaponType"`
}

WeaponStats summarizes statistics about a particular weapon in the meta responses

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL