ps2

package
v0.0.0-...-53ca90f Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2016 License: MIT Imports: 7 Imported by: 1

Documentation

Index

Examples

Constants

View Source
const (
	DefaultBase      = "http://census.daybreakgames.com"
	DefaultDomain    = "ps2"
	DefaultServiceID = "example"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Character

type Character struct {
	CharacterID int64 `json:"character_id,string"`
	Name        struct {
		First      string `json:"first"`
		FirstLower string `json:"first_lower"`
	} `json:"name"`
	FactionID Faction `json:"faction_id,string"`
	HeadID    int     `json:"head_id,string"`
	TitleID   int     `json:"title_id,string"`
	Times     struct {
		Creation      int64 `json:"creation,string"`
		LastSave      int64 `json:"last_save,string"`
		LastLogin     int64 `json:"last_login,string"`
		LoginCount    int   `json:"login_count,string"`
		MinutesPlayed int   `json:"minutes_played,string"`
	} `json:"times"`
	Certs struct {
		EarnedPoints    int     `json:"earned_points,string"`
		GiftedPoints    int     `json:"gifted_points,string"`
		SpentPoints     int     `json:"spent_points,string"`
		AvailablePoints int     `json:"available_points,string"`
		PercentToNext   float64 `json:"percent_to_next,string"`
	} `json:"certs"`
	BattleRank struct {
		PercentToNext float64 `json:"percent_to_next,string"`
		Value         int     `json:"value,string"`
	} `json:"battle_rank"`
	ProfileID   int `json:"profile_id,string"`
	DailyRibbon struct {
		Count int `json:"count,string"`
	} `json:"daily_ribbon"`

	Items []struct {
		ItemID     int64 `json:"item_id,string"`
		StackCount int   `json:"stack_count,string"`
	} `json:"items"`

	ItemsFull []struct {
		ItemID              int64             `json:"item_id,string"`
		StackCount          int               `json:"stack_count,string"`
		ItemTypeID          int64             `json:"item_type_id,string"`
		ItemCategoryID      int64             `json:"item_category_id,string"`
		IsVehicleWeapon     int               `json:"is_vehicle_weapon,string"`
		Name                map[string]string `json:"name"`
		Description         map[string]string `json:"description"`
		FactionID           Faction           `json:"faction_id,string"`
		MaxStackSize        int               `json:"max_stack_size,string"`
		ImageSetID          int64             `json:"image_set_id,string"`
		ImageID             int64             `json:"image_id,string"`
		ImagePath           string            `json:"image_path"`
		IsDefaultAttachment int               `json:"is_default_attachment,string"`
	}

	Profile *struct {
		ProfileTypeID          int64             `json:"profile_type_id,string"`
		ProfileTypeDescription string            `json:"profile_type_description"`
		FactionID              Faction           `json:"faction_id,string"`
		Name                   map[string]string `json:"name"`
		Description            map[string]string `json:"description"`
		ImageSetID             int64             `json:"image_set_id,string"`
		ImageID                int64             `json:"image_id,string"`
		ImagePath              string            `json:"image_path"`
		MovementSpeed          int               `json:"movement_speed,string"`
		BackpedalSpeedModifier float64           `json:"backpedal_speed_modifier,string"`
		SprintSpeedModifier    float64           `json:"sprint_speed_modifier,string"`
		StrafeSpeedModifier    float64           `json:"strafe_speed_modifier,string"`
	} `json:"profile"`

	Faction *struct {
		Name           map[string]string `json:"faction"`
		ImageSetID     int64             `json:"image_set_id,string"`
		ImageID        int64             `json:"image_id,string"`
		ImagePath      string            `json:"image_path"`
		CodeTag        string            `json:"code_tag"`
		UserSelectable int               `json:"user_selectable,string"`
	} `json:"faction"`

	Stats []struct {
		StatName        string `json:"stat_name"`
		ProfileID       int64  `json:"profile_id,string"`
		ValueForever    int    `json:"value_forever,string"`
		ValueMonthly    int    `json:"value_monthly,string"`
		ValueWeekly     int    `json:"value_weekly,string"`
		ValueDaily      int    `json:"value_daily,string"`
		ValueOneLifeMax int    `json:"value_one_life_max,string"`
		LastSave        int64  `json:"last_save,string"`
	} `json:"stats"`

	OnlineStatus int `json:"online_status,string"`

	FriendList []struct {
		CharacterID   int64 `json:"character_id,string"`
		LastLoginTime int64 `json:"last_login_time,string"`
		Online        int   `json:"online,string"`
	} `json:"friend_list"`
}

type Client

type Client struct {
	C         *http.Client
	Base      string
	ServiceID string
	Domain    string
}
Example
var c Client
chars, err := c.Get().Character(
	map[string]string{
		"name.first": "^DeedleFake",
	},
	&Config{
		Sort: Sort{
			{
				Field: "times.creation",
			},
		},
		Resolve: []string{
			"faction",
		},
		Limit: 3,
	},
)
if err != nil {
	panic(err)
}

for _, c := range chars {
	fmt.Printf("%v (%v)\n", c.Name.First, c.Faction.CodeTag)
}
Output:

DeedleFake (NC)
DeedleFakeConnery (VS)
DeedleFakeTR (TR)

func (*Client) Get

func (c *Client) Get() *Get

type Config

type Config struct {
	Show            []string
	Hide            []string
	Sort            Sort
	Has             []string
	Resolve         []string
	IgnoreCase      bool
	Limit           int
	LimitPerDB      int
	Start           int
	Lang            string
	ExactMatchFirst bool
	TryOnce         bool
}

type Faction

type Faction int64

Faction is a convenience type for dealing with PlanetSide 2 faction IDs.

const (
	NaniteSystems   Faction = 0
	VanuSovereignty Faction = 1
	NewConglomerate Faction = 2
	TerranRepublic  Faction = 3
)

func (Faction) String

func (f Faction) String() string

type Get

type Get struct {
	// contains filtered or unexported fields
}

func (*Get) Character

func (g *Get) Character(search map[string]string, config *Config) (list []Character, err error)

func (*Get) Custom

func (g *Get) Custom(out interface{}, col string, search map[string]string, config *Config) error

type Sort

type Sort []SortDir

type SortDir

type SortDir struct {
	Field string
	Dir   int
}

func (SortDir) String

func (dir SortDir) String() string

type UnknownCollectionError

type UnknownCollectionError string

func (UnknownCollectionError) Error

func (err UnknownCollectionError) Error() string

type World

type World int64

World is a convenience type for dealing with PlanetSide 2 world IDs.

const (
	Connery World = 1
	Miller  World = 10
	Cobalt  World = 13
	Emerald World = 17
	Jaeger  World = 19
	Briggs  World = 25
)

func (World) String

func (w World) String() string

type Zone

type Zone int64

Zone is a convenience type for dealing PlanetSide 2 zone IDs.

const (
	Indar        Zone = 2
	Hossin       Zone = 4
	Amerish      Zone = 6
	Esamir       Zone = 8
	VRTrainingNC Zone = 96
	VRTrainingTR Zone = 97
	VRTrainingVS Zone = 98
	Cleanroom    Zone = 200
)

func (Zone) String

func (z Zone) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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