Documentation
¶
Index ¶
- Variables
- type By
- type CoopMemberActivity
- type CoopStatus
- func (c *CoopStatus) Display(sortBy By, activities map[string]*CoopMemberActivity)
- func (c *CoopStatus) GetOfflineAdjustedEggsLaid(activities map[string]*CoopMemberActivity) float64
- func (c *CoopStatus) GetOfflineAdjustedExpectedDurationUntilFinish(activities map[string]*CoopMemberActivity) time.Duration
- func (c *CoopStatus) HasCompleted() bool
- func (c *CoopStatus) HasNoTimeLeft() bool
- func (c *CoopStatus) IsOnTrackToFinish() bool
- func (c *CoopStatus) ProgressInfo() *contract.ProgressInfo
- func (c *CoopStatus) ProgressInfoWithProjection(projectedEggsLaid float64) *contract.ProgressInfo
Constants ¶
This section is empty.
Variables ¶
var ByEarningBonus = By(func(m1, m2 *api.CoopStatus_Member) bool {
return m1.EarningBonusOom > m2.EarningBonusOom
})
var ByEggsLaid = By(func(m1, m2 *api.CoopStatus_Member) bool {
return m1.EggsLaid > m2.EggsLaid
})
var ByLayingRate = By(func(m1, m2 *api.CoopStatus_Member) bool {
return m1.EggsPerSecond > m2.EggsPerSecond
})
Functions ¶
This section is empty.
Types ¶
type By ¶
type By func(m1, m2 *api.CoopStatus_Member) bool
func (By) Sort ¶
func (by By) Sort(members []*api.CoopStatus_Member)
type CoopMemberActivity ¶
type CoopMemberActivity struct { PlayerId string PlayerName string LastUpdateTime time.Time OfflineTime time.Duration EggsPerHourSince float64 // NoActivityRecorded indicates whether any activity has been recorded for a // player at all; the player could have stayed at the exact same eggs laid // since we start recording a coop, in which case NoActivityRecorded would // be true. NoActivityRecorded bool }
type CoopStatus ¶
type CoopStatus struct { *api.CoopStatus Contract *api.ContractProperties }
CoopStatus wraps api.CoopStatus and the corresponding api.ContractProperties.
func WrapCoopStatusWithContractList ¶
func WrapCoopStatusWithContractList(c *api.CoopStatus, contracts []*api.ContractProperties) *CoopStatus
Contract is set to nil if no matching contract is found in the list.
func (*CoopStatus) Display ¶
func (c *CoopStatus) Display(sortBy By, activities map[string]*CoopMemberActivity)
Display prints a formatted report about the coop's current status. activities is optional, and if passed, offline-adjusted eggs laid and time to complete, as well as an additional offline timer column, are displayed.
func (*CoopStatus) GetOfflineAdjustedEggsLaid ¶
func (c *CoopStatus) GetOfflineAdjustedEggsLaid(activities map[string]*CoopMemberActivity) float64
OfflineAdjustedEggsLaid returns confirmed EggsLaid plus expected amount laid during each member's offline time. Offline time is capped at 30hr, the max away time from fully upgraded pro permit silos (although it is possible that a player refilled their silos in between without syncing up to the server, we shouldn't get our hopes up).
func (*CoopStatus) GetOfflineAdjustedExpectedDurationUntilFinish ¶
func (c *CoopStatus) GetOfflineAdjustedExpectedDurationUntilFinish(activities map[string]*CoopMemberActivity) time.Duration
GetOfflineAdjustedExpectedDurationUntilFinish returns expected duration until finish assuming offline-adjusted eggs laid instead of confirmed eggs laid.
func (*CoopStatus) HasCompleted ¶
func (c *CoopStatus) HasCompleted() bool
func (*CoopStatus) HasNoTimeLeft ¶
func (c *CoopStatus) HasNoTimeLeft() bool
func (*CoopStatus) IsOnTrackToFinish ¶
func (c *CoopStatus) IsOnTrackToFinish() bool
func (*CoopStatus) ProgressInfo ¶
func (c *CoopStatus) ProgressInfo() *contract.ProgressInfo
func (*CoopStatus) ProgressInfoWithProjection ¶
func (c *CoopStatus) ProgressInfoWithProjection(projectedEggsLaid float64) *contract.ProgressInfo