boost

package
v0.0.0-...-aed8fa8 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2025 License: Unlicense Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ContractOrderSignup    = 0 // Signup order
	ContractOrderReverse   = 1 // Reverse order
	ContractOrderRandom    = 2 // Randomized when the contract starts. After 20 minutes the order changes to Sign-up.
	ContractOrderFair      = 3 // Fair based on position percentile of each farmers last 5 contracts. Those with no history use 50th percentile
	ContractOrderTimeBased = 4 // Time based order
	ContractOrderELR       = 5 // ELR based order
	ContractOrderTVal      = 6 // Token Value based order
	ContractOrderTokenAsk  = 7 // Token Ask order, less tokens boosts earlier

	ContractStateSignup    = 0 // Contract is in signup phase
	ContractStateFastrun   = 1 // Contract in Boosting as fastrun
	ContractStateWaiting   = 2 // Waiting for other(s) to join
	ContractStateCompleted = 3 // Contract is completed
	ContractStateArchive   = 4 // Contract is ready to archive
	//ContractStateDeprecated       = 5 // Deprecated
	ContractStateBanker = 6 // Contract is Boosting with Banker

	BoostStateUnboosted = 0 // Unboosted
	BoostStateTokenTime = 1 // TokenTime or turn to receive tokens
	BoostStateBoosted   = 2 // Boosted

	BoostOrderTimeThreshold = 20 // minutes to switch from random or fair to signup

	// These are used for the /speedrun command
	SpeedrunStyleBanker  = 0
	SpeedrunStyleFastrun = 1

	SinkBoostFollowOrder = -1 // Follow the order
	SinkBoostFirst       = 0  // First position
	SinkBoostLast        = 1  // Last position

	// These are an int64 flaglist to construct the style of the contract
	ContractFlagNone          = 0x0000
	ContractFlagCrt           = 0x0001
	ContractFlagSelfRuns      = 0x0002
	ContractFlag6Tokens       = 0x0100
	ContractFlag8Tokens       = 0x0200
	ContractFlagDynamicTokens = 0x0400
	ContractFlagFastrun       = 0x4000
	ContractFlagBanker        = 0x8000

	ContractStyleFastrun       = ContractFlagFastrun
	ContractStyleFastrunBanker = ContractFlagBanker

	ContractPlaystyleUnset          = 0 // Unset
	ContractPlaystyleChill          = 1 // Chill
	ContractPlaystyleACOCooperative = 2 // ACO Cooperative
	ContractPlaystyleFastrun        = 3 // Fastrun
	ContractPlaystyleLeaderboard    = 4 // Leaderboard
)

Constnts for the contract

Variables

View Source
var (
	// Contracts is a map of contracts and is saved to disk
	Contracts map[string]*Contract
)

SavedOptionsMap stores the options from a slash command for later retrieval

View Source
var TruthEggBreakpoints = []float64{
	5e7,
	1e9,
	1e10,
	7e10,
	5e11,
	2e12,
	7e12,
	2e13,
	6e13,
	1.5e14,
	5e14,
	1.5e15,
	4e15,
	1e16,
	2.5e16,
	5e16,
}

TruthEggBreakpoints is a slice containing all known tiers to 16 TE

Functions

func AddBoostTokens

func AddBoostTokens(s *discordgo.Session, i *discordgo.InteractionCreate, setCountWant int, countWantAdjust int) (int, int, error)

AddBoostTokens will add tokens to the current booster and adjust the count of the booster

func AddBoostTokensInteraction

func AddBoostTokensInteraction(s *discordgo.Session, i *discordgo.InteractionCreate, setCountWant int, countWantAdjust int)

AddBoostTokensInteraction handles the interactions responses for AddBoostTokens

func AddContractMember

func AddContractMember(s *discordgo.Session, guildID string, channelID string, operator string, mention string, guest string, order int) error

AddContractMember adds a member to a contract

func AdvancedTransform

func AdvancedTransform(key string) *diskv.PathKey

AdvancedTransform for storing KV pairs

func ArchiveContracts

func ArchiveContracts(s *discordgo.Session)

ArchiveContracts will set a contract state to Archive if it is older than 5 days

func Boosting

func Boosting(s *discordgo.Session, guildID string, channelID string) error

Boosting will mark a as boosted and advance to the next in the list

func ChangeBoostOrder

func ChangeBoostOrder(s *discordgo.Session, guildID string, channelID string, userID string, boostOrder string, redraw bool) (string, error)

ChangeBoostOrder will change the order of the boosters in the contract

func ChangeContractIDs

func ChangeContractIDs(s *discordgo.Session, guildID string, channelID string, userID string, contractID string, coopID string, coordinatorID string) error

ChangeContractIDs will change the contractID and/or coopID

func ChangeCurrentBooster

func ChangeCurrentBooster(s *discordgo.Session, guildID string, channelID string, userID string, newBooster string, redraw bool) error

ChangeCurrentBooster will change the current booster to the specified userID

func DeleteContract

func DeleteContract(s *discordgo.Session, guildID string, channelID string) (string, error)

DeleteContract will delete the contract

func DownloadCoopStatusSiab

func DownloadCoopStatusSiab(contractID string, coopID string, offsetEndTime time.Duration) (string, map[string][]*discordgo.MessageEmbedField, string)

DownloadCoopStatusSiab will download the coop status for a given contract and coop ID

func DownloadCoopStatusStones

func DownloadCoopStatusStones(contractID string, coopID string, details bool, soloName string, useBuffHistory bool) (string, string, []*discordgo.MessageEmbedField)

DownloadCoopStatusStones will download the coop status for a given contract and coop ID

func DownloadCoopStatusTeamwork

func DownloadCoopStatusTeamwork(contractID string, coopID string, offsetEndTime time.Duration) (string, map[string][]*discordgo.MessageEmbedField, string)

DownloadCoopStatusTeamwork will download the coop status for a given contract and coop ID

func DrawBoostList

func DrawBoostList(s *discordgo.Session, contract *Contract) []discordgo.MessageComponent

DrawBoostList will draw the boost list for the contract

func EncodeData

func EncodeData(CxpToggle bool, Duration, TargetEgg, TokenTimer, Modifiers string, NumPlayers int) (string, error)

EncodeData generates and encodes configuration data for the SR Sandbox v-5 Parameters:

  • CxpToggle (bool): enables or disables CXP calculations.
  • Duration (string): total duration in days.
  • TargetEgg (string): target egg count.
  • TokenTimer (string): token timer interval in minutes.
  • Modifiers (string): TODO contract modifiers
  • NumPlayers (int): number of players.

Returns:

  • (string): version-tagged encoded SR Sandbox data.
  • (error): returned if encoding fails.

func FindEggEmoji

func FindEggEmoji(eggOrig string) string

FindEggEmoji will find the token emoji for the given guild

func FinishContract

func FinishContract(s *discordgo.Session, contract *Contract)

FinishContract is called only when the contract is complete

func GetContractDescription

func GetContractDescription(channelID string) string

GetContractDescription gets the description for a contract identified by the channel ID.

func GetHelp

func GetHelp(s *discordgo.Session, guildID string, channelID string, userID string) *discordgo.MessageSend

GetHelp will return the help string for the contract

func GetSignupComponents

func GetSignupComponents(contract *Contract) (string, []discordgo.MessageComponent)

GetSignupComponents returns the signup components for a contract

func GetSlasLinkAlternateCommand

func GetSlasLinkAlternateCommand(cmd string) *discordgo.ApplicationCommand

GetSlasLinkAlternateCommand allows a player to associate an alt

func GetSlashCalcContractTval

func GetSlashCalcContractTval(cmd string) *discordgo.ApplicationCommand

GetSlashCalcContractTval calculates the callers token value of a running contract

func GetSlashChangeCommand

func GetSlashChangeCommand(cmd string) *discordgo.ApplicationCommand

GetSlashChangeCommand adjust aspects of a running contract

func GetSlashChangeOneBoosterCommand

func GetSlashChangeOneBoosterCommand(cmd string) *discordgo.ApplicationCommand

GetSlashChangeOneBoosterCommand adjust aspects of a running contract

func GetSlashChangePingRoleCommand

func GetSlashChangePingRoleCommand(cmd string) *discordgo.ApplicationCommand

GetSlashChangePingRoleCommand adjust aspects of a running contract

func GetSlashChangePlannedStartCommand

func GetSlashChangePlannedStartCommand(cmd string) *discordgo.ApplicationCommand

GetSlashChangePlannedStartCommand adjust aspects of a running contract

func GetSlashChangeSpeedRunSinkCommand

func GetSlashChangeSpeedRunSinkCommand(cmd string) *discordgo.ApplicationCommand

GetSlashChangeSpeedRunSinkCommand returns the slash command for changing speedrun sink assignments

func GetSlashContractCommand

func GetSlashContractCommand(cmd string) *discordgo.ApplicationCommand

GetSlashContractCommand returns the slash command for creating a contract

func GetSlashCoopTval

func GetSlashCoopTval(cmd string) *discordgo.ApplicationCommand

GetSlashCoopTval calculates the coop token value of a running contract

func GetSlashCsEstimates

func GetSlashCsEstimates(cmd string) *discordgo.ApplicationCommand

GetSlashCsEstimates returns the slash command for estimating scores

func GetSlashEstimateTime

func GetSlashEstimateTime(cmd string) *discordgo.ApplicationCommand

GetSlashEstimateTime is the definition of the slash command

func GetSlashHelpCommand

func GetSlashHelpCommand(cmd string) *discordgo.ApplicationCommand

GetSlashHelpCommand returns the command for the /help command

func GetSlashRenameThread

func GetSlashRenameThread(cmd string) *discordgo.ApplicationCommand

GetSlashRenameThread is the definition of the slash command

func GetSlashReplayEvalCommand

func GetSlashReplayEvalCommand(cmd string) *discordgo.ApplicationCommand

GetSlashReplayEvalCommand returns the command for the /launch-helper command

func GetSlashScoreExplorerCommand

func GetSlashScoreExplorerCommand(cmd string) *discordgo.ApplicationCommand

GetSlashScoreExplorerCommand returns the slash command for token tracking

func GetSlashSiabEval

func GetSlashSiabEval(cmd string) *discordgo.ApplicationCommand

GetSlashSiabEval will return the discord command for calculating token values of a running contract

func GetSlashSpeedrunCommand

func GetSlashSpeedrunCommand(cmd string) *discordgo.ApplicationCommand

GetSlashSpeedrunCommand returns the slash command for speedrun

func GetSlashStones

func GetSlashStones(cmd string) *discordgo.ApplicationCommand

GetSlashStones will return the discord command for calculating ideal stone set

func GetSlashTeamworkEval

func GetSlashTeamworkEval(cmd string) *discordgo.ApplicationCommand

GetSlashTeamworkEval will return the discord command for calculating token values of a running contract

func GetSlashTimer

func GetSlashTimer(cmd string) *discordgo.ApplicationCommand

GetSlashTimer will return the discord command for calculating ideal stone set

func GetSlashTokenEditCommand

func GetSlashTokenEditCommand(cmd string) *discordgo.ApplicationCommand

GetSlashTokenEditCommand returns the slash command for token tracking removal

func GetSlashVirtueCommand

func GetSlashVirtueCommand(cmd string) *discordgo.ApplicationCommand

GetSlashVirtueCommand returns the command for the /launch-helper command

func GetSlashVolunteerSink

func GetSlashVolunteerSink(cmd string) *discordgo.ApplicationCommand

GetSlashVolunteerSink is used to volunteer as token sink for a contract

func GetSlashVoluntellSink

func GetSlashVoluntellSink(cmd string) *discordgo.ApplicationCommand

GetSlashVoluntellSink is used to volunteer as token sink for a contract

func GetTargetTval

func GetTargetTval(cxpVersion int, contractMinutes float64, minutesPerToken float64) float64

GetTargetTval will return the target tval for the contract based on the contract duration and minutes per token

func GetWish

func GetWish(guildID string, channelID string) string

GetWish gets the wish for a contract identified by the guild ID and channel ID.

func HandleAdminContractFinish

func HandleAdminContractFinish(s *discordgo.Session, i *discordgo.InteractionCreate)

HandleAdminContractFinish is called when the contract is complete

func HandleAdminContractList

func HandleAdminContractList(s *discordgo.Session, i *discordgo.InteractionCreate)

HandleAdminContractList will list all contracts

func HandleAdminGetContractData

func HandleAdminGetContractData(s *discordgo.Session, i *discordgo.InteractionCreate)

HandleAdminGetContractData get JSON data about a contract given the contract and coop id

func HandleAdminListRoles

func HandleAdminListRoles(s *discordgo.Session, i *discordgo.InteractionCreate)

HandleAdminListRoles is the handler for the list roles command

func HandleAllContractsAutoComplete

func HandleAllContractsAutoComplete(s *discordgo.Session, i *discordgo.InteractionCreate)

HandleAllContractsAutoComplete will handle the contract auto complete of contract-id's default to new contracts but allow searching all contracts

func HandleAltsAutoComplete

func HandleAltsAutoComplete(s *discordgo.Session, i *discordgo.InteractionCreate)

HandleAltsAutoComplete will populate with linked alternate names

func HandleArtifactCommand

func HandleArtifactCommand(s *discordgo.Session, i *discordgo.InteractionCreate)

HandleArtifactCommand handles the /artifacts command

func HandleArtifactReactions

func HandleArtifactReactions(s *discordgo.Session, i *discordgo.InteractionCreate)

HandleArtifactReactions handles all the button reactions for a contract settings

func HandleBoostCommand

func HandleBoostCommand(s *discordgo.Session, i *discordgo.InteractionCreate)

HandleBoostCommand will handle the /boost command

func HandleBumpCommand

func HandleBumpCommand(s *discordgo.Session, i *discordgo.InteractionCreate)

HandleBumpCommand will handle the /bump command

func HandleChangeCommand

func HandleChangeCommand(s *discordgo.Session, i *discordgo.InteractionCreate)

HandleChangeCommand will handle the /change command

func HandleChangeOneBoosterCommand

func HandleChangeOneBoosterCommand(s *discordgo.Session, i *discordgo.InteractionCreate)

HandleChangeOneBoosterCommand will handle the /change-one-booster command

func HandleChangePingRoleCommand

func HandleChangePingRoleCommand(s *discordgo.Session, i *discordgo.InteractionCreate)

HandleChangePingRoleCommand will handle the /change-ping-role command

func HandleChangePlannedStartCommand

func HandleChangePlannedStartCommand(s *discordgo.Session, i *discordgo.InteractionCreate)

HandleChangePlannedStartCommand will handle the /change--planned-start command

func HandleChangeSpeedrunSinkCommand

func HandleChangeSpeedrunSinkCommand(s *discordgo.Session, i *discordgo.InteractionCreate)

HandleChangeSpeedrunSinkCommand handles the change speedrun sink command

func HandleContractAutoComplete

func HandleContractAutoComplete(s *discordgo.Session, i *discordgo.InteractionCreate)

HandleContractAutoComplete will handle the contract auto complete of contract-id's

func HandleContractCalcContractTvalCommand

func HandleContractCalcContractTvalCommand(s *discordgo.Session, i *discordgo.InteractionCreate)

HandleContractCalcContractTvalCommand will handle the /contract-token-tval command

func HandleContractCommand

func HandleContractCommand(s *discordgo.Session, i *discordgo.InteractionCreate)

HandleContractCommand will handle the /contract command

func HandleContractDelete

func HandleContractDelete(s *discordgo.Session, i *discordgo.InteractionCreate)

HandleContractDelete facilitates the deletion of a channel contract

func HandleContractReactions

func HandleContractReactions(s *discordgo.Session, i *discordgo.InteractionCreate)

HandleContractReactions handles all the button reactions for a contract

func HandleContractSettingsCommand

func HandleContractSettingsCommand(s *discordgo.Session, i *discordgo.InteractionCreate)

HandleContractSettingsCommand will handle the /contract-settings command

func HandleContractSettingsReactions

func HandleContractSettingsReactions(s *discordgo.Session, i *discordgo.InteractionCreate)

HandleContractSettingsReactions handles all the button reactions for a contract settings

func HandleCoopAutoComplete

func HandleCoopAutoComplete(s *discordgo.Session, i *discordgo.InteractionCreate)

HandleCoopAutoComplete will handle the contract auto complete of contract-id's

func HandleCoopETACommand

func HandleCoopETACommand(s *discordgo.Session, i *discordgo.InteractionCreate)

HandleCoopETACommand will handle the /coopeta command

func HandleCoopTvalCommand

func HandleCoopTvalCommand(s *discordgo.Session, i *discordgo.InteractionCreate)

HandleCoopTvalCommand will handle the /contract-token-tval command

func HandleCsEstimatesCommand

func HandleCsEstimatesCommand(s *discordgo.Session, i *discordgo.InteractionCreate)

HandleCsEstimatesCommand handles the estimate scores command

func HandleEggIDModalSubmit

func HandleEggIDModalSubmit(s *discordgo.Session, i *discordgo.InteractionCreate)

HandleEggIDModalSubmit handles the modal submission for an egginc ID

func HandleEstimateTimeCommand

func HandleEstimateTimeCommand(s *discordgo.Session, i *discordgo.InteractionCreate)

HandleEstimateTimeCommand will handle the estimate-contract-time command

func HandleHelpCommand

func HandleHelpCommand(s *discordgo.Session, i *discordgo.InteractionCreate)

HandleHelpCommand will handle the help command

func HandleJoinCommand

func HandleJoinCommand(s *discordgo.Session, i *discordgo.InteractionCreate)

HandleJoinCommand will handle the /join command

func HandleLinkAlternateAutoComplete

func HandleLinkAlternateAutoComplete(s *discordgo.Session, i *discordgo.InteractionCreate)

HandleLinkAlternateAutoComplete will handle the /link-alternate autocomplete

func HandleLinkAlternateCommand

func HandleLinkAlternateCommand(s *discordgo.Session, i *discordgo.InteractionCreate)

HandleLinkAlternateCommand will handle the /link-alternate command

func HandleMenuReactions

func HandleMenuReactions(s *discordgo.Session, i *discordgo.InteractionCreate)

HandleMenuReactions handles the menu reactions for the contract

func HandlePruneCommand

func HandlePruneCommand(s *discordgo.Session, i *discordgo.InteractionCreate)

HandlePruneCommand will handle the /prune command

func HandleRenameThreadCommand

func HandleRenameThreadCommand(s *discordgo.Session, i *discordgo.InteractionCreate)

HandleRenameThreadCommand will handle the thread rename command

func HandleReplayEval

func HandleReplayEval(s *discordgo.Session, i *discordgo.InteractionCreate)

HandleReplayEval handles the /replay-eval command

func HandleScoreExplorerCommand

func HandleScoreExplorerCommand(s *discordgo.Session, i *discordgo.InteractionCreate)

HandleScoreExplorerCommand will handle the /playground command

func HandleScoreExplorerPage

func HandleScoreExplorerPage(s *discordgo.Session, i *discordgo.InteractionCreate)

HandleScoreExplorerPage steps a page of cached teamwork data

func HandleSiabEvalCommand

func HandleSiabEvalCommand(s *discordgo.Session, i *discordgo.InteractionCreate)

HandleSiabEvalCommand will handle the /siab command

func HandleSiabPage

func HandleSiabPage(s *discordgo.Session, i *discordgo.InteractionCreate)

HandleSiabPage steps a page of cached siab data

func HandleSkipCommand

func HandleSkipCommand(s *discordgo.Session, i *discordgo.InteractionCreate)

HandleSkipCommand will handle the /skip command

func HandleSlashVolunteerSinkCommand

func HandleSlashVolunteerSinkCommand(s *discordgo.Session, i *discordgo.InteractionCreate)

HandleSlashVolunteerSinkCommand is used to volunteer as token sink for a contract

func HandleSlashVoluntellSinkCommand

func HandleSlashVoluntellSinkCommand(s *discordgo.Session, i *discordgo.InteractionCreate)

HandleSlashVoluntellSinkCommand is used to volunteer as token sink for a contract

func HandleSpeedrunCommand

func HandleSpeedrunCommand(s *discordgo.Session, i *discordgo.InteractionCreate)

HandleSpeedrunCommand handles the speedrun command

func HandleStonesCommand

func HandleStonesCommand(s *discordgo.Session, i *discordgo.InteractionCreate)

HandleStonesCommand will handle the /stones command

func HandleStonesPage

func HandleStonesPage(s *discordgo.Session, i *discordgo.InteractionCreate)

HandleStonesPage steps a page of cached stones data

func HandleTeamworkEvalCommand

func HandleTeamworkEvalCommand(s *discordgo.Session, i *discordgo.InteractionCreate)

HandleTeamworkEvalCommand will handle the /teamwork command

func HandleTeamworkPage

func HandleTeamworkPage(s *discordgo.Session, i *discordgo.InteractionCreate)

HandleTeamworkPage steps a page of cached teamwork data

func HandleTimerCommand

func HandleTimerCommand(s *discordgo.Session, i *discordgo.InteractionCreate)

HandleTimerCommand will handle the /stones command

func HandleToggleContractPingsCommand

func HandleToggleContractPingsCommand(s *discordgo.Session, i *discordgo.InteractionCreate)

HandleToggleContractPingsCommand will handle the /toggle-contract-pings command

func HandleTokenCommand

func HandleTokenCommand(s *discordgo.Session, i *discordgo.InteractionCreate)

HandleTokenCommand takes the main command and adds the current contract to the message

func HandleTokenEditCommand

func HandleTokenEditCommand(s *discordgo.Session, i *discordgo.InteractionCreate) string

HandleTokenEditCommand will handle the /token-edit command

func HandleTokenIDAutoComplete

HandleTokenIDAutoComplete will handle the /token-edit token-id autocomplete

func HandleTokenListAutoComplete

HandleTokenListAutoComplete will handle the /token-remove autocomplete

func HandleTokenReceiverAutoComplete

func HandleTokenReceiverAutoComplete(s *discordgo.Session, i *discordgo.InteractionCreate) (string, []*discordgo.ApplicationCommandOptionChoice)

HandleTokenReceiverAutoComplete will handle the /token-edit new-receiver autocomplete

func HandleUnboostCommand

func HandleUnboostCommand(s *discordgo.Session, i *discordgo.InteractionCreate)

HandleUnboostCommand will handle the /unboost command

func HandleVirtue

func HandleVirtue(s *discordgo.Session, i *discordgo.InteractionCreate)

HandleVirtue handles the /virtue command

func InverseTransform

func InverseTransform(pathKey *diskv.PathKey) (key string)

InverseTransform for storing KV pairs

func IsUserCreatorOfAnyContract

func IsUserCreatorOfAnyContract(s *discordgo.Session, userID string) bool

IsUserCreatorOfAnyContract will return true if the user is the creator of any contract

func JoinContract

func JoinContract(s *discordgo.Session, guildID string, channelID string, userID string, bell bool) error

JoinContract will add a user to the contract

func LaunchIndependentTimers

func LaunchIndependentTimers(s *discordgo.Session)

LaunchIndependentTimers will start all the timers that are active

func LoadContractData

func LoadContractData(filename string)

LoadContractData will load contract data from a file

func MoveBooster

func MoveBooster(s *discordgo.Session, guildID string, channelID string, userID string, boosterName string, boosterPosition int, redraw bool) error

MoveBooster will move a booster to a new position in the contract

func PopulateContractFromProto

func PopulateContractFromProto(contractProtoBuf *ei.Contract) ei.EggIncContract

PopulateContractFromProto will populate a contract from a protobuf

func ProductionSchedule

func ProductionSchedule(
	targetEggAmount float64,
	initialElr float64,
	deltaElr float64,
	alpha float64,
	elapsedTimeSec float64,
	eggsShipped float64,
	startLocal time.Time,
	tz string,
) (
	switchTime time.Time,
	switchTimestamp int64,
	finishTimeWithSwitch time.Time,
	finishTimestampWithSwitch int64,
	finishTimeWithoutSwitch time.Time,
	finishTimestampWithoutSwitch int64,
	err error,
)

ProductionSchedule calculates key timestamps for a production schedule based on egg production.

Created by: James WST DiscordID: @james.wst Parameters:

targetEggAmount: float64 - Target Egg Amount in quadrillion eggs. (q = 10^15)
initialElr: float64 - The initial elr from all players in quadrillion eggs per hour. (q/h)
deltaElr: float64 - The change in ELR per hour due to one person SiaB->Gusset switching (q/h)
alpha: float64 - The fraction of the total contract duration at which the switch occurs. 0 < alpha < 1.
elapsedTimeSec: float64 - The elapsed time in seconds since the start of the contract. (s)
eggsShipped: float64 - The number of eggs already shipped in quadrillion eggs. (q)
startLocal: time.Time - The start time of the contract in local time.
tz: string - The timezone of the start time, e.g., "Europe/Berlin".

Returns:

switchTime, switchTimestamp: (time.Time, int64) - The time and Unix timestamp when the switch occurs.
finishTimeWithSwitch, finishTimestampWithSwitch: (time.Time, int64) - The time and Unix timestamp when the contract finishes with the switch.
finishTimeWithoutSwitch, finishTimestampWithoutSwitch: (time.Time, int64) - The time and Unix timestamp when the contract finishes without the switch.
err: error - An error if any calculation or timezone loading fails.

func ReactionAdd

func ReactionAdd(s *discordgo.Session, r *discordgo.MessageReaction) string

ReactionAdd is called when a reaction is added to a message

func ReactionRemove

func ReactionRemove(s *discordgo.Session, r *discordgo.MessageReaction)

ReactionRemove handles a user removing a reaction from a message

func RedrawBoostList

func RedrawBoostList(s *discordgo.Session, guildID string, channelID string) error

RedrawBoostList will move the boost message to the bottom of the channel

func RemoveAddedReaction

func RemoveAddedReaction(s *discordgo.Session, r *discordgo.MessageReaction)

RemoveAddedReaction removes an added reaction from a message so it can be reactivated

func RemoveFarmerByMention

func RemoveFarmerByMention(s *discordgo.Session, guildID string, channelID string, operator string, mention string) error

RemoveFarmerByMention will remove a booster from the contract by mention

func ReplayEval

func ReplayEval(s *discordgo.Session, i *discordgo.InteractionCreate, percent int, eiID string, contractID string, okayToSave bool)

ReplayEval evaluates the contract history and provides replay guidance

func RequestEggIncIDModal

func RequestEggIncIDModal(s *discordgo.Session, i *discordgo.InteractionCreate, action string)

RequestEggIncIDModal sends a modal to the user requesting their Egg Inc ID

func SaveAllData

func SaveAllData()

SaveAllData will remove a token from the Contracts

func SaveOptions

SaveOptions saves the options from a slash command into a map for later retrieval

func SetListMessageID

func SetListMessageID(contract *Contract, channelID string, messageID string)

SetListMessageID will save the list messageID for the contract

func SetReactionID

func SetReactionID(contract *Contract, channelID string, reactionID string)

SetReactionID will save the reactionID for the contract

func SetWish

func SetWish(guildID string, channelID string, wish string) error

SetWish sets the wish for a contract identified by the guild ID and channel ID.

func SkipBooster

func SkipBooster(s *discordgo.Session, guildID string, channelID string, userID string) error

SkipBooster will skip the current booster and move to the next

func SlashAdminGetContractData

func SlashAdminGetContractData(cmd string) *discordgo.ApplicationCommand

SlashAdminGetContractData is the slash to get contract JSON data

func SlashAdminListRoles

func SlashAdminListRoles(cmd string) *discordgo.ApplicationCommand

SlashAdminListRoles is the slash to info about bot roles

func SlashArtifactsCommand

func SlashArtifactsCommand(cmd string) *discordgo.ApplicationCommand

SlashArtifactsCommand creates a new slash command for setting Egg, Inc name

func StartContractBoosting

func StartContractBoosting(s *discordgo.Session, guildID string, channelID string, userID string) error

StartContractBoosting will start the contract

func Unboost

func Unboost(s *discordgo.Session, guildID string, channelID string, mention string) error

Unboost will mark a user as unboosted

func UpdateContractTime

func UpdateContractTime(contractID string, coopID string, startTime time.Time, contractDurationSeconds float64)

UpdateContractTime will update the contract start time and estimated duration

func UpdateThreadName

func UpdateThreadName(s *discordgo.Session, contract *Contract)

UpdateThreadName will update a threads name to the current contract state

func UserBoost

func UserBoost(s *discordgo.Session, guildID string, channelID string, userID string) error

UserBoost will trigger a contract boost of a user

func Virtue

func Virtue(s *discordgo.Session, i *discordgo.InteractionCreate, percent int, eiID string, okayToSave bool)

Virtue processes the virtue command

Types

type ArtifactSet

type ArtifactSet struct {
	Artifacts []ei.Artifact
	LayRate   float64
	ShipRate  float64
}

ArtifactSet holds the data for each set of artifacts

type BankerInfo

type BankerInfo struct {
	CurrentBanker      string // Current Banker
	ParadeSinkUserID   string // Alt Parade Sink User ID
	BoostingSinkUserID string // Boosting Sink User ID
	PostSinkUserID     string // Sink End of Contract User ID
	SinkBoostPosition  int    // Sink Boost Position
}

BankerInfo holds information about contract Banker

type Booster

type Booster struct {
	UserID      string // Egg Farmer
	GlobalName  string
	UserName    string
	ChannelName string
	GuildID     string // Discord Guild where this User is From
	GuildName   string
	Ping        bool      // True/False
	Register    time.Time //o Time Farmer registered to boost

	Name          string
	Unique        string
	Nick          string
	Mention       string // String which mentions user
	Color         int
	Alts          []string // Array of alternate ids for the user
	AltsIcons     []string // Array of alternate icons for the user
	AltController string   // User ID of the controller of this alternate

	BoostState             int           // Indicates if current booster
	TokensReceived         int           // indicate number of boost tokens
	TokensWanted           int           // indicate number of boost tokens
	TokenValue             float64       // Current Token Value
	TokenRequestFlag       bool          // Flag to indicate if the token request is active
	StartTime              time.Time     // Time Farmer started boost turn
	EndTime                time.Time     // Time Farmer ended boost turn
	Duration               time.Duration // Duration of boost
	BoostingTokenTimestamp time.Time     // When the boosting token was last received
	VotingList             []string      // Record list of those that voted to boost
	RunChickensTime        time.Time     // Time Farmer triggered chicken run reaction
	RanChickensOn          []string      // Array of users that the farmer ran chickens on
	BoostTriggerTime       time.Time     // Used for time remaining in boost
	Hint                   []string      // Used to track which hints have been given
	ArtifactSet            ArtifactSet   // Set of artifacts for this booster
	EstDurationOfBoost     time.Duration // Estimated duration of the boost
	EstEndOfBoost          time.Time     // Estimated end of the boost
	EstRequestChickenRuns  time.Time     // Estimated time to request chicken runs
	Ultra                  bool          // Does this player have Ultra
	// Alt Parade
	Kind           Kind
	ParaderMention Parader
}

Booster holds the data for each booster within a Contract

func AddFarmerToContract

func AddFarmerToContract(s *discordgo.Session, contract *Contract, guildID string, channelID string, userID string, order int, progenitor bool) (*Booster, error)

AddFarmerToContract adds a farmer to a contract

type BotTimer

type BotTimer struct {
	ID       string // Unique ID for this timer
	Reminder time.Time

	Message   string
	UserID    string
	ChannelID string
	MsgID     string
	Active    bool
	// contains filtered or unexported fields
}

BotTimer holds the data for each timer

type CompMap

type CompMap struct {
	Emoji          string
	ID             string
	Name           string
	Style          discordgo.ButtonStyle
	CustomID       string
	ComponentEmoji *discordgo.ComponentEmoji
}

CompMap is a cached set of components for this contract

type Contract

type Contract struct {
	ContractHash string // ContractID-CoopID
	Location     []*LocationData
	CreatorID    []string // Slice of creators
	//SignupMsgID    map[string]string // Message ID for the Signup Message
	ContractID                string // Contract ID
	CoopID                    string // CoopID
	SeasonalScoring           int    // 1 = new scoring
	Name                      string
	Description               string
	Egg                       int32
	EggName                   string
	EggEmoji                  string
	TokenStr                  string // Emoji for Token
	TargetAmount              []float64
	ChickenRuns               int // Number of Chicken Runs for this contract
	ChickenRunCooldownMinutes int
	MinutesPerToken           int
	EstimatedDuration         time.Duration
	CompletionDuration        time.Duration
	EstimatedEndTime          time.Time
	EstimatedDurationValid    bool
	ThreadName                string
	ThreadRenameTime          time.Time
	EstimateUpdateTime        time.Time
	TimeBoosting              time.Time // When the contract boost started

	CRMessageIDs []string // Array of message IDs for chicken run messages

	CoopSize            int
	Ultra               bool
	UltraCount          int
	Style               int64 // Mask for the Contract Style
	PlayStyle           int   // Playstyle of the contract
	NewToPlayStyle      bool  // Someone in the contract is new to this playstyle
	LengthInSeconds     int
	BoostOrder          int // How the contract is sorted
	BoostVoting         int
	BoostPosition       int       // Starting Slot
	State               int       // Boost Completed
	StartTime           time.Time // When Contract is started
	EndTime             time.Time // When final booster ends
	PlannedStartTime    time.Time // Parameter start time
	ActualStartTime     time.Time // Actual start time for token tracking
	RegisteredNum       int
	Boosters            map[string]*Booster // Boosters Registered
	ParadeList          []*Parader          // List of Paraders
	WaitlistBoosters    []string            // Waitlist of UserID's
	AltIcons            []string            // Array of alternate icons for the Boosters
	Order               []string
	BoostedOrder        []string   // Actual order of boosting
	OrderRevision       int        // Incremented when Order is changed
	Banker              BankerInfo // Banker for the contract
	TokenLog            []ei.TokenUnitLog
	TokensPerMinute     float64
	CalcOperations      int
	CalcOperationTime   time.Time
	CoopTokenValueMsgID string
	LastWishPrompt      string    // saved prompt for this contract
	LastInteractionTime time.Time // last time the contract was drawn

	SavedStats  bool // Saved stats for this contract
	NewFeature  int  // Used to slide in new features
	DynamicData *DynamicTokenData
	// contains filtered or unexported fields
}

Contract is the main struct for each contract

func CreateContract

func CreateContract(s *discordgo.Session, contractID string, coopID string, playStyle int, coopSize int, BoostOrder int, guildID string, channelID string, progenitors []string, userID string) (*Contract, error)

CreateContract creates a new contract or joins an existing contract if run from a different location

func FindContract

func FindContract(channelID string) *Contract

FindContract will find the contract by the guildID and channelID

func FindContractByMessageID

func FindContractByMessageID(channelID string, messageID string) *Contract

FindContractByMessageID will find the contract by the messageID

type DeliveryTimeValue

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

DeliveryTimeValue is a struct to hold the values for a delivery time

type DeliveryTimeValueSiab

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

DeliveryTimeValueSiab is a struct to hold the values for a delivery time

type DynamicTokenData

type DynamicTokenData struct {
	TokenTimer int

	HabNumber             int64
	OfflineIHR            int64
	Name                  string
	ELR                   float64
	TokenBoost            [5]int64
	BoostTimeSeconds      [5]time.Duration
	ChickenRunTimeSeconds [5]time.Duration
	IhrBase               int64
	FourHabsOffline       int64
	MaxHab                float64
	ChickenRunHab         float64
	IHRMultiplier         float64
	ColleggtibleEaster    float64
}

DynamicTokenData is a struct that holds the data needed to calculate dynamic tokens

type Kind

type Kind int

Kind represents the type of booster

const (
	// Normal Booster Farmer
	Normal Kind = iota
	// Parade Farmer Slot
	Parade
)

type LocationData

type LocationData struct {
	GuildID           string
	GuildName         string
	ChannelID         string // Contract Discord Channel
	ChannelMention    string
	GuildContractRole discordgo.Role
	RoleMention       string
	ListMsgID         string   // Message ID for the Last Boost Order message
	ReactionID        string   // Message ID for the reaction Order String
	MessageIDs        []string // Array of message IDs for any contract message
	TokenXStr         string   // Emoji for Token
	TokenXReactionStr string   // Emoji for Token Reaction
}

LocationData holds server specific Data for a contract

type Parader

type Parader struct {
	UserID        string // Egg Farmer
	Name          string
	Unique        string
	Nick          string
	Mention       string // String which mentions user
	GlobalName    string
	UserName      string
	RanChickensOn []string
}

Parader holds the data for each parader within a Contract

type ScoreCalcParams

type ScoreCalcParams struct {
	Grade ei.Contract_PlayerGrade `json:"grade"`

	Deflector            float64   `json:"deflector"`
	DeflectorDownMinutes int       `json:"deflector_down_minutes"`
	Siab                 float64   `json:"siab"`
	SiabMinutes          int       `json:"siab_minutes"`
	Style                int       `json:"style"`
	PlayStyleValues      []float64 `json:"play_style_values"`
	FairShare            float64   `json:"fair_share"`
	TvalSent             int       `json:"tval_sent"`
	TvalReceived         int       `json:"tval_received"`
	ChickenRuns          int

	SiabTimes []int `json:"siab_times"`
	SiabIndex int   `json:"siab_index"`

	DeflIndex int `json:"defl_index"`
	// contains filtered or unexported fields
}

ScoreCalcParams is the parameters for the score calculator

type TokenUnit

type TokenUnit struct {
	Time   time.Time // Time token was received
	Value  float64   // Last calculated value of the token
	UserID string    // Who sent or received the token
	Serial string    // Serial number of the token
}

TokenUnit holds the data for each token

Jump to

Keyboard shortcuts

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