Documentation
¶
Index ¶
- Constants
- Variables
- func Allocate(preferers Preferers, nations godip.Nations) ([]godip.Nation, error)
- func BanID(ctx context.Context, userIds []string) (*datastore.Key, error)
- func ChannelID(ctx context.Context, gameID *datastore.Key, members Nations) (*datastore.Key, error)
- func FlaggedMessagesID(ctx context.Context, gameID *datastore.Key, userId string) (*datastore.Key, error)
- func GameResultID(ctx context.Context, gameID *datastore.Key) *datastore.Key
- func GameStateID(ctx context.Context, gameID *datastore.Key, nation godip.Nation) (*datastore.Key, error)
- func OrderID(ctx context.Context, phaseID *datastore.Key, srcProvince godip.Province) (*datastore.Key, error)
- func PP(i interface{}) string
- func PhaseID(ctx context.Context, gameID *datastore.Key, phaseOrdinal int64) (*datastore.Key, error)
- func PhaseResultID(ctx context.Context, gameID *datastore.Key, phaseOrdinal int64) (*datastore.Key, error)
- func PhaseStateID(ctx context.Context, phaseID *datastore.Key, nation godip.Nation) (*datastore.Key, error)
- func SeenMarkerID(ctx context.Context, channelID *datastore.Key, owner godip.Nation) (*datastore.Key, error)
- func SetFCMConf(ctx context.Context, fcmConf *FCMConf) error
- func SetSendGrid(ctx context.Context, sendGrid *SendGrid) error
- func SetupRouter(r *mux.Router)
- func UpdateGlickosASAP(ctx context.Context) error
- func UpdateUserStatsASAP(ctx context.Context, uids []string) error
- func UserStatsID(ctx context.Context, userId string) *datastore.Key
- type Allocation
- type AllocationMember
- type AllocationMembers
- type AllocationMethod
- type Ban
- type Bans
- type Bounce
- type Channel
- type Channels
- type DelayFunc
- type Diplicity
- type Dislodged
- type Dislodger
- type FCMConf
- type FCMData
- type FlaggedMessage
- type FlaggedMessages
- type FlaggedMessagess
- type Game
- func (g *Game) AbbrNat(nat godip.Nation) godip.Nation
- func (g *Game) AbbrNats(nats Nations) Nations
- func (g *Game) DescFor(nat godip.Nation) string
- func (g *Game) GetMemberByNation(nation godip.Nation) (*Member, bool)
- func (g *Game) GetMemberByUserId(userID string) (*Member, bool)
- func (g *Game) Item(r Request) *Item
- func (g *Game) Joinable() bool
- func (g *Game) Leavable() bool
- func (g *Game) Redact(viewer *auth.User)
- func (g *Game) Refresh()
- func (g *Game) Save(ctx context.Context) error
- type GameResult
- type GameResults
- type GameScore
- type GameState
- type GameStates
- type Games
- func (g Games) Item(r Request, user *auth.User, cursor *datastore.Cursor, limit int, name string, ...) *Item
- func (g Games) Len() int
- func (g Games) Less(i, j int) bool
- func (g *Games) RemoveBanned(ctx context.Context, uid string) ([][]Ban, error)
- func (g *Games) RemoveCustomFiltered(filters []func(g *Game) bool)
- func (g *Games) RemoveFiltered(userStats *UserStats) [][]string
- func (g Games) Swap(i, j int)
- type Glicko
- type GlobalStats
- type Histogram
- type Member
- type Members
- type Message
- type MessageFlag
- type Messages
- type NMessagesSince
- type Nations
- type Order
- type Orders
- type Phase
- func (p *Phase) ID(ctx context.Context) (*datastore.Key, error)
- func (p *Phase) Item(r Request) *Item
- func (p *Phase) Orders(ctx context.Context) (map[godip.Nation]map[godip.Province][]string, error)
- func (p *Phase) Recalc() error
- func (p *Phase) Save(ctx context.Context) error
- func (p *Phase) ScheduleResolution(ctx context.Context) error
- func (p *Phase) State(ctx context.Context, variant vrt.Variant, ...) (*state.State, error)
- type PhaseMeta
- type PhaseResolver
- type PhaseResult
- type PhaseState
- type PhaseStates
- type Phases
- type Preferer
- type Preferers
- type Resolution
- type SC
- type SeenMarker
- type SendGrid
- type UnitWrapper
- type UserStats
- type UserStatsNumbers
- type UserStatsSlice
Constants ¶
View Source
const ( GetSWJSRoute = "GetSWJS" GetMainJSRoute = "GetMainJS" ConfigureRoute = "AuthConfigure" IndexRoute = "Index" ListOpenGamesRoute = "ListOpenGames" ListStartedGamesRoute = "ListStartedGames" ListFinishedGamesRoute = "ListFinishedGames" ListMyStagingGamesRoute = "ListMyStagingGames" ListMyStartedGamesRoute = "ListMyStartedGames" ListMyFinishedGamesRoute = "ListMyFinishedGames" ListOtherStagingGamesRoute = "ListOtherStagingGames" ListOtherStartedGamesRoute = "ListOtherStartedGames" ListOtherFinishedGamesRoute = "ListOtherFinishedGames" ListOrdersRoute = "ListOrders" ListPhasesRoute = "ListPhases" ListPhaseStatesRoute = "ListPhaseStates" ListGameStatesRoute = "ListGameStates" ListOptionsRoute = "ListOptions" ListChannelsRoute = "ListChannels" ListMessagesRoute = "ListMessages" ListBansRoute = "ListBans" ListTopRatedPlayersRoute = "ListTopRatedPlayers" ListTopReliablePlayersRoute = "ListTopReliablePlayers" ListTopHatedPlayersRoute = "ListTopHatedPlayers" ListTopHaterPlayersRoute = "ListTopHaterPlayers" ListTopQuickPlayersRoute = "ListTopQuickPlayers" ListFlaggedMessagesRoute = "ListFlaggedMessages" DevResolvePhaseTimeoutRoute = "DevResolvePhaseTimeout" DevUserStatsUpdateRoute = "DevUserStatsUpdate" ReceiveMailRoute = "ReceiveMail" RenderPhaseMapRoute = "RenderPhaseMap" ReRateRoute = "ReRate" GlobalStatsRoute = "GlobalStats" RssRoute = "Rss" ResaveRoute = "Resave" AllocateNationsRoute = "AllocateNations" ReapInactiveWaitingPlayersRoute = "ReapInactiveWaitingPlayersRoute" ReScheduleRoute = "ReSchedule" ReScheduleAllBrokenRoute = "ReScheduleAllBroken" )
View Source
const (
MAX_PHASE_DEADLINE = 30 * 24 * 60
)
View Source
const (
MAX_STAGING_GAME_INACTIVITY = 30 * 24 * time.Hour
)
Variables ¶
View Source
var ( MessageFlagResource *Resource FlaggedMessagesResource *Resource )
View Source
var ( UpdateUserStatsFunc *DelayFunc UserStatsResource *Resource )
View Source
var (
AllocationResource *Resource
)
View Source
var BanResource *Resource
View Source
var (
GameResource *Resource
)
View Source
var GameResultResource = &Resource{
Load: loadGameResult,
FullPath: "/Game/{game_id}/GameResult",
}
View Source
var GameStateResource *Resource
View Source
var MemberResource = &Resource{
Create: createMember,
Delete: deleteMember,
Update: updateMember,
CreatePath: "/Game/{game_id}/Member",
FullPath: "/Game/{game_id}/Member/{user_id}",
}
View Source
var (
MessageResource *Resource
)
View Source
var OrderResource *Resource
View Source
var (
PhaseResource *Resource
)
View Source
var PhaseResultResource = &Resource{
Load: loadPhaseResult,
FullPath: "/Game/{game_id}/Phase/{phase_ordinal}/Result",
}
View Source
var PhaseStateResource *Resource
Functions ¶
func FlaggedMessagesID ¶
func GameStateID ¶
func PhaseResultID ¶
func PhaseStateID ¶
func SeenMarkerID ¶
func SetupRouter ¶
func UpdateGlickosASAP ¶
Types ¶
type Allocation ¶
type Allocation struct { Members AllocationMembers `methods:"POST"` Variant string `methods:"POST"` }
func (*Allocation) Item ¶
func (a *Allocation) Item(r Request) *Item
type AllocationMember ¶
func (AllocationMember) Preferences ¶
func (a AllocationMember) Preferences() godip.Nations
type AllocationMembers ¶
type AllocationMembers []AllocationMember
func (AllocationMembers) Each ¶
func (a AllocationMembers) Each(f func(int, Preferer))
func (AllocationMembers) Len ¶
func (a AllocationMembers) Len() int
type AllocationMethod ¶
type AllocationMethod int
const ( RandomAllocation AllocationMethod = iota PreferenceAllocation )
type Channel ¶
type Channel struct { GameID *datastore.Key Members Nations NMessages int NMessagesSince NMessagesSince `datastore:"-"` }
func (*Channel) CountSince ¶
type DelayFunc ¶
type DelayFunc struct {
// contains filtered or unexported fields
}
var (
FCMSendToTokensFunc *DelayFunc
)
func NewDelayFunc ¶
type FlaggedMessage ¶
type FlaggedMessages ¶
type FlaggedMessages struct { GameID *datastore.Key UserId string Messages []FlaggedMessage CreatedAt time.Time }
func (*FlaggedMessages) Item ¶
func (f *FlaggedMessages) Item(r Request) *Item
type FlaggedMessagess ¶
type FlaggedMessagess []FlaggedMessages
type Game ¶
type Game struct { ID *datastore.Key `datastore:"-"` Started bool // Game has started. Closed bool // Game is no longer joinable.. Finished bool // Game has reached its end. Desc string `methods:"POST" datastore:",noindex"` Variant string `methods:"POST"` PhaseLengthMinutes time.Duration `methods:"POST"` MaxHated float64 `methods:"POST"` MaxHater float64 `methods:"POST"` MinRating float64 `methods:"POST"` MaxRating float64 `methods:"POST"` MinReliability float64 `methods:"POST"` MinQuickness float64 `methods:"POST"` Private bool `methods:"POST"` NoMerge bool `methods:"POST"` DisableConferenceChat bool `methods:"POST"` DisableGroupChat bool `methods:"POST"` DisablePrivateChat bool `methods:"POST"` NationAllocation AllocationMethod `methods:"POST"` NMembers int Members Members StartETA time.Time NewestPhaseMeta []PhaseMeta ActiveBans []Ban `datastore:"-"` FailedRequirements []string `datastore:"-"` FirstMember *Member `datastore:"-" json:",omitempty" methods:"POST"` CreatedAt time.Time CreatedAgo time.Duration `datastore:"-" ticker:"true"` StartedAt time.Time StartedAgo time.Duration `datastore:"-" ticker:"true"` FinishedAt time.Time FinishedAgo time.Duration `datastore:"-" ticker:"true"` }
func (*Game) GetMemberByNation ¶
type GameResult ¶
type GameResult struct { GameID *datastore.Key SoloWinnerMember godip.Nation SoloWinnerUser string DIASMembers []godip.Nation DIASUsers []string NMRMembers []godip.Nation NMRUsers []string EliminatedMembers []godip.Nation EliminatedUsers []string AllUsers []string Scores []GameScore Rated bool Private bool CreatedAt time.Time }
func (*GameResult) AssignScores ¶
func (g *GameResult) AssignScores()
func (*GameResult) Item ¶
func (g *GameResult) Item(r Request) *Item
type GameResults ¶
type GameResults []GameResult
type GameState ¶
type GameStates ¶
type GameStates []GameState
func (GameStates) Item ¶
func (g GameStates) Item(r Request, gameID *datastore.Key) *Item
type Games ¶
type Games []Game
func (*Games) RemoveBanned ¶
func (*Games) RemoveCustomFiltered ¶
func (*Games) RemoveFiltered ¶
type Glicko ¶
type GlobalStats ¶
type Member ¶
type Member struct { User auth.User Nation godip.Nation GameAlias string `methods:"POST,PUT" datastore:",noindex"` NationPreferences string `methods:"POST,PUT" datastore:",noindex"` NewestPhaseState PhaseState UnreadMessages int }
func (Member) Preferences ¶
type Message ¶
type MessageFlag ¶
type MessageFlag struct { GameID *datastore.Key ChannelMembers Nations From time.Time `methods:"POST"` To time.Time `methods:"POST"` }
func (*MessageFlag) Item ¶
func (m *MessageFlag) Item(r Request) *Item
type NMessagesSince ¶
type Nations ¶
func (*Nations) FromString ¶
type Order ¶
type Phase ¶
type Phase struct { PhaseMeta GameID *datastore.Key Units []UnitWrapper SCs []SC Dislodgeds []Dislodged Dislodgers []Dislodger Bounces []Bounce Resolutions []Resolution Host string // Ignore this field completely, it should never be used, and is simply hard to remove. Scheme string }
type PhaseMeta ¶
type PhaseMeta struct { PhaseOrdinal int64 Season godip.Season Year int Type godip.PhaseType Resolved bool CreatedAt time.Time CreatedAgo time.Duration `datastore:"-" ticker:"true"` ResolvedAt time.Time ResolvedAgo time.Duration `datastore:"-" ticker:"true"` DeadlineAt time.Time NextDeadlineIn time.Duration `datastore:"-" ticker:"true"` UnitsJSON string `datastore:",noindex"` SCsJSON string `datastore:",noindex"` }
type PhaseResolver ¶
type PhaseResolver struct { Context context.Context Game *Game Phase *Phase PhaseStates PhaseStates TimeoutTriggered bool // contains filtered or unexported fields }
func (*PhaseResolver) Act ¶
func (p *PhaseResolver) Act() error
type PhaseResult ¶
type PhaseResult struct { GameID *datastore.Key PhaseOrdinal int64 NMRUsers []string ActiveUsers []string ReadyUsers []string AllUsers []string Private bool }
func (*PhaseResult) Item ¶
func (p *PhaseResult) Item(r Request) *Item
type PhaseState ¶
type PhaseState struct { GameID *datastore.Key PhaseOrdinal int64 Nation godip.Nation ReadyToResolve bool `methods:"PUT"` WantsDIAS bool `methods:"PUT"` OnProbation bool NoOrders bool Eliminated bool ZippedOptions []byte `skip:"true"` Note string `datastore:",noindex"` }
func (*PhaseState) Item ¶
func (p *PhaseState) Item(r Request) *Item
type PhaseStates ¶
type PhaseStates []PhaseState
func (PhaseStates) Item ¶
func (p PhaseStates) Item(r Request, phase *Phase) *Item
type Resolution ¶
type SeenMarker ¶
type UserStats ¶
type UserStats struct { UserId string UserStatsNumbers PrivateStats UserStatsNumbers Glicko Glicko User auth.User }
type UserStatsNumbers ¶
type UserStatsNumbers struct { StartedGames int FinishedGames int SoloGames int DIASGames int EliminatedGames int DroppedGames int NMRPhases int ActivePhases int ReadyPhases int Reliability float64 Quickness float64 OwnedBans int Hated float64 Hater float64 }
func (*UserStatsNumbers) Recalculate ¶
Click to show internal directories.
Click to hide internal directories.