Documentation ¶
Index ¶
- Constants
- Variables
- func BaseURL() string
- func ConfigureRouter(router *mux.Router)
- func DescriptionForRarity(rarity float64) string
- func DescriptionForXPTransaction(tx *types.PPXPTransaction) string
- func DoXPTransaction(node sqalx.Node, player *types.PPPlayer, when time.Time, value int, ...) error
- func Initialize(ppconfig Config) error
- func MonthStart() time.Time
- func NameForNotificationMethod(notifMethod string) string
- func NameForNotificationType(notifType string) string
- func RegisterDiscussionParticipationCallback(userID string, XPreward int) bool
- func RegisterEventWinCallback(userID, messageID string, XPreward int, eventType string) bool
- func RegisterReport(report types.Report)
- func RegisterTripFirstEdit(trip *types.Trip)
- func RegisterTripSubmission(trip *types.Trip)
- func RegisterXPTransaction(tx *types.PPXPTransaction)
- func ReloadAchievements() error
- func ReloadTemplates() error
- func WeekStart() time.Time
- type Config
- type ConnectionHandler
- func (h *ConnectionHandler) DisplayName() string
- func (h *ConnectionHandler) GetConnectionsForPair(node sqalx.Node, pair *types.APIPair) ([]types.PairConnection, error)
- func (h *ConnectionHandler) ID() string
- func (h *ConnectionHandler) TryCreateConnection(node sqalx.Node, code, deviceName string, pair *types.APIPair) bool
- type DiscordEventParticipationAchievementStrategy
- func (s *DiscordEventParticipationAchievementStrategy) CriteriaHTML(context *types.PPAchievementContext) string
- func (s *DiscordEventParticipationAchievementStrategy) HandleXPTransaction(context *types.PPAchievementContext, transaction *types.PPXPTransaction, ...) error
- func (s *DiscordEventParticipationAchievementStrategy) ID() string
- func (s *DiscordEventParticipationAchievementStrategy) Progress(context *types.PPAchievementContext) (current, total int, err error)
- func (s *DiscordEventParticipationAchievementStrategy) ProgressHTML(context *types.PPAchievementContext) string
- type PairConnection
- type PairConnectionExtra
- type ReachLevelAchievementStrategy
- func (s *ReachLevelAchievementStrategy) CriteriaHTML(context *types.PPAchievementContext) string
- func (s *ReachLevelAchievementStrategy) HandleXPTransaction(context *types.PPAchievementContext, transaction *types.PPXPTransaction, ...) error
- func (s *ReachLevelAchievementStrategy) ID() string
- func (s *ReachLevelAchievementStrategy) Progress(context *types.PPAchievementContext) (current, total int, err error)
- func (s *ReachLevelAchievementStrategy) ProgressHTML(context *types.PPAchievementContext) string
- type Session
- type StubAchievementStrategy
- func (s *StubAchievementStrategy) CriteriaHTML(context *types.PPAchievementContext) string
- func (s *StubAchievementStrategy) HandleDisturbanceReport(context *types.PPAchievementContext, report *types.LineDisturbanceReport) error
- func (s *StubAchievementStrategy) HandleTrip(context *types.PPAchievementContext, trip *types.Trip) error
- func (s *StubAchievementStrategy) HandleTripEdit(context *types.PPAchievementContext, trip *types.Trip) error
- func (s *StubAchievementStrategy) HandleXPTransaction(context *types.PPAchievementContext, transaction *types.PPXPTransaction, ...) error
- func (s *StubAchievementStrategy) Progress(context *types.PPAchievementContext) (current, total int, err error)
- func (s *StubAchievementStrategy) ProgressHTML(context *types.PPAchievementContext) string
- type SubmitAchievementStrategy
- func (s *SubmitAchievementStrategy) CriteriaHTML(context *types.PPAchievementContext) string
- func (s *SubmitAchievementStrategy) HandleDisturbanceReport(context *types.PPAchievementContext, report *types.LineDisturbanceReport) error
- func (s *SubmitAchievementStrategy) HandleTrip(context *types.PPAchievementContext, trip *types.Trip) error
- func (s *SubmitAchievementStrategy) HandleTripEdit(context *types.PPAchievementContext, trip *types.Trip) error
- func (s *SubmitAchievementStrategy) ID() string
- type TripDuringDisturbanceAchievementStrategy
- func (s *TripDuringDisturbanceAchievementStrategy) CriteriaHTML(context *types.PPAchievementContext) string
- func (s *TripDuringDisturbanceAchievementStrategy) HandleTrip(context *types.PPAchievementContext, trip *types.Trip) error
- func (s *TripDuringDisturbanceAchievementStrategy) ID() string
- func (s *TripDuringDisturbanceAchievementStrategy) Progress(context *types.PPAchievementContext) (current, total int, err error)
- type VisitStationsAchievementStrategy
- func (s *VisitStationsAchievementStrategy) CriteriaHTML(context *types.PPAchievementContext) string
- func (s *VisitStationsAchievementStrategy) HandleTrip(context *types.PPAchievementContext, trip *types.Trip) error
- func (s *VisitStationsAchievementStrategy) ID() string
- func (s *VisitStationsAchievementStrategy) Progress(context *types.PPAchievementContext) (current, total int, err error)
- func (s *VisitStationsAchievementStrategy) ProgressHTML(context *types.PPAchievementContext) string
- type VisitThroughoutLineAchievementStrategy
- func (s *VisitThroughoutLineAchievementStrategy) CriteriaHTML(context *types.PPAchievementContext) string
- func (s *VisitThroughoutLineAchievementStrategy) HandleTrip(context *types.PPAchievementContext, trip *types.Trip) error
- func (s *VisitThroughoutLineAchievementStrategy) ID() string
- func (s *VisitThroughoutLineAchievementStrategy) Progress(context *types.PPAchievementContext) (current, total int, err error)
Constants ¶
const ( // DEBUG is whether this is a debug build DEBUG = true // SessionName is the name of the PosPlay session in the session store SessionName = "posplay" // GameTimezone is the timezone where the game is played GameTimezone = "Europe/Lisbon" // CSRFfieldName is the name of the form field used for CSRF protection CSRFfieldName = "posplay.csrf" CSRFcookieName = "_posplay_csrf" // PairProcessLongevity sets the timeout for pairing a device with a PosPlay account PairProcessLongevity = 30 * time.Second // PosPlayVersion is the version of this PosPlay subsystem release PosPlayVersion = "vDEBUG" )
const ( // PrivateLBPrivacy is used when users don't want to appear in leaderboards PrivateLBPrivacy string = "PRIVATE" // PublicLBPrivacy is used when users want to appear in leaderboards PublicLBPrivacy string = "PUBLIC" // PrivateProfilePrivacy is used when users don't want to show their profile to anyone PrivateProfilePrivacy string = "PRIVATE" // PlayersOnlyProfilePrivacy is used when users only want to show their profile to other PosPlay players PlayersOnlyProfilePrivacy string = "PLAYERS_ONLY" // PublicProfilePrivacy is used when users want to show their profile to everyone PublicProfilePrivacy string = "PUBLIC" )
const ( // UsernameDiscriminatorNameType is used when users want to appear like gbl08ma#3988 UsernameDiscriminatorNameType string = "USERNAME_DISCRIM" // UsernameNameType is used when users want to appear like gbl08ma UsernameNameType string = "USERNAME" // NicknameNameType is used when users want to appear as their nickname in the project's guild NicknameNameType string = "NICKNAME" )
const ( // NotificationMethodDiscordDM corresponds to sending notifications through Discord DMs NotificationMethodDiscordDM string = "DISCORD_DM" // NotificationMethodAppNotif corresponds to sending notifications to the paired app NotificationMethodAppNotif string = "APP_NOTIF" )
const ( // NotificationTypeAchievementAchieved is used when the user achieved an achievement NotificationTypeAchievementAchieved string = "ACHIEVEMENT_ACHIEVED" // NotificationTypeGuildEventWon is used when the user won a Discord guild event NotificationTypeGuildEventWon string = "GUILD_EVENT_WON" )
Variables ¶
var Consts = map[string]reflect.Value{ "CSRFcookieName": reflect.ValueOf(CSRFcookieName), "CSRFfieldName": reflect.ValueOf(CSRFfieldName), "DEBUG": reflect.ValueOf(DEBUG), "GameTimezone": reflect.ValueOf(GameTimezone), "NicknameNameType": reflect.ValueOf(NicknameNameType), "NotificationMethodAppNotif": reflect.ValueOf(NotificationMethodAppNotif), "NotificationMethodDiscordDM": reflect.ValueOf(NotificationMethodDiscordDM), "NotificationTypeAchievementAchieved": reflect.ValueOf(NotificationTypeAchievementAchieved), "NotificationTypeGuildEventWon": reflect.ValueOf(NotificationTypeGuildEventWon), "PairProcessLongevity": reflect.ValueOf(PairProcessLongevity), "PlayersOnlyProfilePrivacy": reflect.ValueOf(PlayersOnlyProfilePrivacy), "PosPlayVersion": reflect.ValueOf(PosPlayVersion), "PrivateLBPrivacy": reflect.ValueOf(PrivateLBPrivacy), "PrivateProfilePrivacy": reflect.ValueOf(PrivateProfilePrivacy), "PublicLBPrivacy": reflect.ValueOf(PublicLBPrivacy), "PublicProfilePrivacy": reflect.ValueOf(PublicProfilePrivacy), "SessionName": reflect.ValueOf(SessionName), "UsernameDiscriminatorNameType": reflect.ValueOf(UsernameDiscriminatorNameType), "UsernameNameType": reflect.ValueOf(UsernameNameType), }
var Functions = map[string]reflect.Value{ "BaseURL": reflect.ValueOf(BaseURL), "ConfigureRouter": reflect.ValueOf(ConfigureRouter), "DescriptionForRarity": reflect.ValueOf(DescriptionForRarity), "DescriptionForXPTransaction": reflect.ValueOf(DescriptionForXPTransaction), "DoXPTransaction": reflect.ValueOf(DoXPTransaction), "GetSession": reflect.ValueOf(GetSession), "Initialize": reflect.ValueOf(Initialize), "MonthStart": reflect.ValueOf(MonthStart), "NameForNotificationMethod": reflect.ValueOf(NameForNotificationMethod), "NameForNotificationType": reflect.ValueOf(NameForNotificationType), "NewSession": reflect.ValueOf(NewSession), "RegisterDiscussionParticipationCallback": reflect.ValueOf(RegisterDiscussionParticipationCallback), "RegisterEventWinCallback": reflect.ValueOf(RegisterEventWinCallback), "RegisterReport": reflect.ValueOf(RegisterReport), "RegisterTripFirstEdit": reflect.ValueOf(RegisterTripFirstEdit), "RegisterTripSubmission": reflect.ValueOf(RegisterTripSubmission), "RegisterXPTransaction": reflect.ValueOf(RegisterXPTransaction), "ReloadAchievements": reflect.ValueOf(ReloadAchievements), "ReloadTemplates": reflect.ValueOf(ReloadTemplates), "WeekStart": reflect.ValueOf(WeekStart), }
var NotificationDefaults = map[string]map[string]bool{ NotificationTypeAchievementAchieved: map[string]bool{ NotificationMethodDiscordDM: false, NotificationMethodAppNotif: true, }, NotificationTypeGuildEventWon: map[string]bool{ NotificationMethodDiscordDM: true, NotificationMethodAppNotif: false, }, }
NotificationDefaults contains defaults for notification settings
var Types = map[string]reflect.Type{ "Config": reflect.TypeOf((*Config)(nil)).Elem(), "ConnectionHandler": reflect.TypeOf((*ConnectionHandler)(nil)).Elem(), "DiscordEventParticipationAchievementStrategy": reflect.TypeOf((*DiscordEventParticipationAchievementStrategy)(nil)).Elem(), "PairConnection": reflect.TypeOf((*PairConnection)(nil)).Elem(), "PairConnectionExtra": reflect.TypeOf((*PairConnectionExtra)(nil)).Elem(), "ReachLevelAchievementStrategy": reflect.TypeOf((*ReachLevelAchievementStrategy)(nil)).Elem(), "Session": reflect.TypeOf((*Session)(nil)).Elem(), "StubAchievementStrategy": reflect.TypeOf((*StubAchievementStrategy)(nil)).Elem(), "SubmitAchievementStrategy": reflect.TypeOf((*SubmitAchievementStrategy)(nil)).Elem(), "TripDuringDisturbanceAchievementStrategy": reflect.TypeOf((*TripDuringDisturbanceAchievementStrategy)(nil)).Elem(), "VisitStationsAchievementStrategy": reflect.TypeOf((*VisitStationsAchievementStrategy)(nil)).Elem(), "VisitThroughoutLineAchievementStrategy": reflect.TypeOf((*VisitThroughoutLineAchievementStrategy)(nil)).Elem(), }
var Variables = map[string]reflect.Value{ "NotificationDefaults": reflect.ValueOf(&NotificationDefaults), "TheConnectionHandler": reflect.ValueOf(&TheConnectionHandler), }
Functions ¶
func BaseURL ¶
func BaseURL() string
BaseURL returns the base URL of the website without trailing slash
func ConfigureRouter ¶
ConfigureRouter configures a router to handle PosPlay paths
func DescriptionForRarity ¶
DescriptionForRarity returns a human-friendly description of a achievement rarity value (range 0 to 100)
func DescriptionForXPTransaction ¶
func DescriptionForXPTransaction(tx *types.PPXPTransaction) string
DescriptionForXPTransaction returns a human-friendly description of a XP transaction
func DoXPTransaction ¶
func DoXPTransaction(node sqalx.Node, player *types.PPPlayer, when time.Time, value int, txType string, extra map[string]interface{}, attemptMerge bool) error
DoXPTransaction adds a XP transaction to a user, performing the necessary checks and calling the necessary handlers
func Initialize ¶
Initialize initializes the PosPlay subsystem
func MonthStart ¶
MonthStart returns when the current competition month started
func NameForNotificationMethod ¶
NameForNotificationMethod returns a human-friendly name of a notification method
func NameForNotificationType ¶
NameForNotificationType returns a human-friendly name of a notification type
func RegisterDiscussionParticipationCallback ¶
RegisterDiscussionParticipationCallback gives a user a XP reward for participating in the Discord channels
func RegisterEventWinCallback ¶
RegisterEventWinCallback gives a user a XP reward for a Discord event, if he has not received a reward for that event yet
func RegisterReport ¶
RegisterReport schedules a report for analysis
func RegisterTripFirstEdit ¶
RegisterTripFirstEdit schedules a trip resubmission (edit, confirmation) for analysis
func RegisterTripSubmission ¶
RegisterTripSubmission schedules a trip submission for analysis
func RegisterXPTransaction ¶
func RegisterXPTransaction(tx *types.PPXPTransaction)
RegisterXPTransaction is exclusively meant for use when bootstrapping the achievements system on a database with previous XP transactions
func ReloadAchievements ¶
func ReloadAchievements() error
ReloadAchievements reloads the achievement cache
func ReloadTemplates ¶
func ReloadTemplates() error
ReloadTemplates reloads the templates for the website
Types ¶
type Config ¶
type Config struct { Keybox *keybox.Keybox Log *log.Logger Store *sessions.CookieStore Node sqalx.Node GitCommit string SendAppNotification func(pair *types.APIPair, msgType string, data map[string]string) // contains filtered or unexported fields }
Config contains runtime PosPlay subsystem configuration
type ConnectionHandler ¶
type ConnectionHandler struct {
// contains filtered or unexported fields
}
ConnectionHandler implements resource.PairConnectionHandler
var TheConnectionHandler *ConnectionHandler
TheConnectionHandler is the pair connection handler for PosPlay
func (*ConnectionHandler) DisplayName ¶
func (h *ConnectionHandler) DisplayName() string
DisplayName implements resource.PairConnectionHandler
func (*ConnectionHandler) GetConnectionsForPair ¶
func (h *ConnectionHandler) GetConnectionsForPair(node sqalx.Node, pair *types.APIPair) ([]types.PairConnection, error)
GetConnectionsForPair implements resource.PairConnectionHandler
func (*ConnectionHandler) ID ¶
func (h *ConnectionHandler) ID() string
ID implements resource.PairConnectionHandler
func (*ConnectionHandler) TryCreateConnection ¶
func (h *ConnectionHandler) TryCreateConnection(node sqalx.Node, code, deviceName string, pair *types.APIPair) bool
TryCreateConnection implements resource.PairConnectionHandler
type DiscordEventParticipationAchievementStrategy ¶
type DiscordEventParticipationAchievementStrategy struct {
StubAchievementStrategy
}
DiscordEventParticipationAchievementStrategy is an achievement strategy that rewards users when they participate in a set number of Discord events
func (*DiscordEventParticipationAchievementStrategy) CriteriaHTML ¶
func (s *DiscordEventParticipationAchievementStrategy) CriteriaHTML(context *types.PPAchievementContext) string
CriteriaHTML implements types.PPAchievementStrategy
func (*DiscordEventParticipationAchievementStrategy) HandleXPTransaction ¶
func (s *DiscordEventParticipationAchievementStrategy) HandleXPTransaction(context *types.PPAchievementContext, transaction *types.PPXPTransaction, actualValueDiff int) error
HandleXPTransaction implements types.PPAchievementStrategy
func (*DiscordEventParticipationAchievementStrategy) ID ¶
func (s *DiscordEventParticipationAchievementStrategy) ID() string
ID returns the ID for this PPAchievementStrategy
func (*DiscordEventParticipationAchievementStrategy) Progress ¶
func (s *DiscordEventParticipationAchievementStrategy) Progress(context *types.PPAchievementContext) (current, total int, err error)
Progress implements types.PPAchievementStrategy
func (*DiscordEventParticipationAchievementStrategy) ProgressHTML ¶
func (s *DiscordEventParticipationAchievementStrategy) ProgressHTML(context *types.PPAchievementContext) string
ProgressHTML implements types.PPAchievementStrategy
type PairConnection ¶
type PairConnection struct {
// contains filtered or unexported fields
}
PairConnection implements types.PairConnection
func (*PairConnection) Created ¶
func (c *PairConnection) Created() time.Time
Created returns the creation time of this connection
func (*PairConnection) Extra ¶
func (c *PairConnection) Extra() interface{}
Extra returns the extra bundle for this connection
func (*PairConnection) Pair ¶
func (c *PairConnection) Pair() *types.APIPair
Pair returns the pair of this connection
type PairConnectionExtra ¶
type PairConnectionExtra struct { DiscordID uint64 `msgpack:"discordID" json:"discordID"` Username string `msgpack:"username" json:"username"` AvatarURL string `msgpack:"avatarURL" json:"avatarURL"` Level int `msgpack:"level" json:"level"` LevelProgress float64 `msgpack:"levelProgress" json:"levelProgress"` XP int `msgpack:"xp" json:"xp"` XPthisWeek int `msgpack:"xpThisWeek" json:"xpThisWeek"` Rank int `msgpack:"rank" json:"rank"` RankThisWeek int `msgpack:"rankThisWeek" json:"rankThisWeek"` }
PairConnectionExtra is the extra info bundle for PairConnections. This is serialized and sent to clients
type ReachLevelAchievementStrategy ¶
type ReachLevelAchievementStrategy struct {
StubAchievementStrategy
}
ReachLevelAchievementStrategy is an achievement strategy that rewards users when they reach a specified level
func (*ReachLevelAchievementStrategy) CriteriaHTML ¶
func (s *ReachLevelAchievementStrategy) CriteriaHTML(context *types.PPAchievementContext) string
CriteriaHTML implements types.PPAchievementStrategy
func (*ReachLevelAchievementStrategy) HandleXPTransaction ¶
func (s *ReachLevelAchievementStrategy) HandleXPTransaction(context *types.PPAchievementContext, transaction *types.PPXPTransaction, actualValueDiff int) error
HandleXPTransaction implements types.PPAchievementStrategy
func (*ReachLevelAchievementStrategy) ID ¶
func (s *ReachLevelAchievementStrategy) ID() string
ID returns the ID for this PPAchievementStrategy
func (*ReachLevelAchievementStrategy) Progress ¶
func (s *ReachLevelAchievementStrategy) Progress(context *types.PPAchievementContext) (current, total int, err error)
Progress implements types.PPAchievementStrategy
func (*ReachLevelAchievementStrategy) ProgressHTML ¶
func (s *ReachLevelAchievementStrategy) ProgressHTML(context *types.PPAchievementContext) string
ProgressHTML implements types.PPAchievementStrategy
type Session ¶
type Session struct { DiscordToken *oauth2.Token DiscordInfo *discordgo.User DisplayName string GoToOnboarding bool }
Session represents a user session in the PosPlay subsystem
func GetSession ¶
func GetSession(r *http.Request, w http.ResponseWriter, doLogin bool) (ppsession *Session, redirected bool, err error)
GetSession retrieves the Session from the specified request, if one exists, and if not, optionally redirects the user to the authentication page
type StubAchievementStrategy ¶
type StubAchievementStrategy struct{}
StubAchievementStrategy partially implements types.PPAchievementStrategy
func (*StubAchievementStrategy) CriteriaHTML ¶
func (s *StubAchievementStrategy) CriteriaHTML(context *types.PPAchievementContext) string
CriteriaHTML implements types.PPAchievementStrategy context.Player may be nil when calling this function
func (*StubAchievementStrategy) HandleDisturbanceReport ¶
func (s *StubAchievementStrategy) HandleDisturbanceReport(context *types.PPAchievementContext, report *types.LineDisturbanceReport) error
HandleDisturbanceReport implements types.PPAchievementStrategy
func (*StubAchievementStrategy) HandleTrip ¶
func (s *StubAchievementStrategy) HandleTrip(context *types.PPAchievementContext, trip *types.Trip) error
HandleTrip implements types.PPAchievementStrategy
func (*StubAchievementStrategy) HandleTripEdit ¶
func (s *StubAchievementStrategy) HandleTripEdit(context *types.PPAchievementContext, trip *types.Trip) error
HandleTripEdit implements types.PPAchievementStrategy
func (*StubAchievementStrategy) HandleXPTransaction ¶
func (s *StubAchievementStrategy) HandleXPTransaction(context *types.PPAchievementContext, transaction *types.PPXPTransaction, actualValueDiff int) error
HandleXPTransaction implements types.PPAchievementStrategy
func (*StubAchievementStrategy) Progress ¶
func (s *StubAchievementStrategy) Progress(context *types.PPAchievementContext) (current, total int, err error)
Progress implements types.PPAchievementStrategy If total == 0: this achievement has no progress, it's "all or nothing" If total == -1: this achievement is still locked for the user, show a censured version If total < -1: this achievement is still locked for the user, do not show it at all
func (*StubAchievementStrategy) ProgressHTML ¶
func (s *StubAchievementStrategy) ProgressHTML(context *types.PPAchievementContext) string
ProgressHTML implements types.PPAchievementStrategy
type SubmitAchievementStrategy ¶
type SubmitAchievementStrategy struct {
StubAchievementStrategy
}
SubmitAchievementStrategy is an achievement strategy that rewards users when they submit a trip, trip edit, or disturbance report
func (*SubmitAchievementStrategy) CriteriaHTML ¶
func (s *SubmitAchievementStrategy) CriteriaHTML(context *types.PPAchievementContext) string
CriteriaHTML implements types.PPAchievementStrategy
func (*SubmitAchievementStrategy) HandleDisturbanceReport ¶
func (s *SubmitAchievementStrategy) HandleDisturbanceReport(context *types.PPAchievementContext, report *types.LineDisturbanceReport) error
HandleDisturbanceReport implements types.PPAchievementStrategy
func (*SubmitAchievementStrategy) HandleTrip ¶
func (s *SubmitAchievementStrategy) HandleTrip(context *types.PPAchievementContext, trip *types.Trip) error
HandleTrip implements types.PPAchievementStrategy
func (*SubmitAchievementStrategy) HandleTripEdit ¶
func (s *SubmitAchievementStrategy) HandleTripEdit(context *types.PPAchievementContext, trip *types.Trip) error
HandleTripEdit implements types.PPAchievementStrategy
func (*SubmitAchievementStrategy) ID ¶
func (s *SubmitAchievementStrategy) ID() string
ID returns the ID for this PPAchievementStrategy
type TripDuringDisturbanceAchievementStrategy ¶
type TripDuringDisturbanceAchievementStrategy struct {
StubAchievementStrategy
}
TripDuringDisturbanceAchievementStrategy is an achievement strategy that rewards users when they submit a trip performed during a disturbance
func (*TripDuringDisturbanceAchievementStrategy) CriteriaHTML ¶
func (s *TripDuringDisturbanceAchievementStrategy) CriteriaHTML(context *types.PPAchievementContext) string
CriteriaHTML implements types.PPAchievementStrategy
func (*TripDuringDisturbanceAchievementStrategy) HandleTrip ¶
func (s *TripDuringDisturbanceAchievementStrategy) HandleTrip(context *types.PPAchievementContext, trip *types.Trip) error
HandleTrip implements types.PPAchievementStrategy
func (*TripDuringDisturbanceAchievementStrategy) ID ¶
func (s *TripDuringDisturbanceAchievementStrategy) ID() string
ID returns the ID for this PPAchievementStrategy
func (*TripDuringDisturbanceAchievementStrategy) Progress ¶
func (s *TripDuringDisturbanceAchievementStrategy) Progress(context *types.PPAchievementContext) (current, total int, err error)
Progress implements types.PPAchievementStrategy
type VisitStationsAchievementStrategy ¶
type VisitStationsAchievementStrategy struct {
StubAchievementStrategy
}
VisitStationsAchievementStrategy is an achievement strategy that rewards users when they visit certain stations
func (*VisitStationsAchievementStrategy) CriteriaHTML ¶
func (s *VisitStationsAchievementStrategy) CriteriaHTML(context *types.PPAchievementContext) string
CriteriaHTML implements types.PPAchievementStrategy
func (*VisitStationsAchievementStrategy) HandleTrip ¶
func (s *VisitStationsAchievementStrategy) HandleTrip(context *types.PPAchievementContext, trip *types.Trip) error
HandleTrip implements types.PPAchievementStrategy
func (*VisitStationsAchievementStrategy) ID ¶
func (s *VisitStationsAchievementStrategy) ID() string
ID returns the ID for this PPAchievementStrategy
func (*VisitStationsAchievementStrategy) Progress ¶
func (s *VisitStationsAchievementStrategy) Progress(context *types.PPAchievementContext) (current, total int, err error)
Progress implements types.PPAchievementStrategy
func (*VisitStationsAchievementStrategy) ProgressHTML ¶
func (s *VisitStationsAchievementStrategy) ProgressHTML(context *types.PPAchievementContext) string
ProgressHTML implements types.PPAchievementStrategy
type VisitThroughoutLineAchievementStrategy ¶
type VisitThroughoutLineAchievementStrategy struct {
StubAchievementStrategy
}
VisitThroughoutLineAchievementStrategy is an achievement strategy that rewards users when they visit one line from one end to another in a single trip
func (*VisitThroughoutLineAchievementStrategy) CriteriaHTML ¶
func (s *VisitThroughoutLineAchievementStrategy) CriteriaHTML(context *types.PPAchievementContext) string
CriteriaHTML implements types.PPAchievementStrategy
func (*VisitThroughoutLineAchievementStrategy) HandleTrip ¶
func (s *VisitThroughoutLineAchievementStrategy) HandleTrip(context *types.PPAchievementContext, trip *types.Trip) error
HandleTrip implements types.PPAchievementStrategy
func (*VisitThroughoutLineAchievementStrategy) ID ¶
func (s *VisitThroughoutLineAchievementStrategy) ID() string
ID returns the ID for this PPAchievementStrategy
func (*VisitThroughoutLineAchievementStrategy) Progress ¶
func (s *VisitThroughoutLineAchievementStrategy) Progress(context *types.PPAchievementContext) (current, total int, err error)
Progress implements types.PPAchievementStrategy