Documentation
¶
Index ¶
- Constants
- func CalcXPToNext(level int) int
- func Init()
- func Shutdown()
- type AnimDef
- type CustomDialogue
- type DialogueCategory
- type DialogueResponse
- type PetCatalogueEntry
- type PetInstance
- type PetStore
- func (s *PetStore) AddXP(amount int) (*PetInstance, bool)
- func (s *PetStore) CheckStreak()
- func (s *PetStore) GetPet() *PetInstance
- func (s *PetStore) GetProfile() *PlayerProfile
- func (s *PetStore) IncrementCommands()
- func (s *PetStore) Interact(action string) *PetInstance
- func (s *PetStore) Load()
- func (s *PetStore) Save() error
- func (s *PetStore) SelectPet(petID string, name string) *PetInstance
- func (s *PetStore) SetCustomDialogues(dialogues []CustomDialogue)
- func (s *PetStore) UpdateMood()
- func (s *PetStore) UpdatePlaytime(seconds int64)
- func (s *PetStore) UpdateState(state string)
- type PlayerProfile
- type SessionData
- type SessionTracker
Constants ¶
const ( MaxLevel = 10 XPPerMinute = 2 XPPerCommand = 5 XPPerFocusSession = 50 XPStreakMultiplier = 25 IdleTimeoutSec = 300 // 5 minutes SaveIntervalSec = 30 MoodHappy = "happy" MoodNeutral = "neutral" MoodSad = "sad" MoodHungry = "hungry" MoodSleepy = "sleepy" StateActive = "ACTIVE" StateIdle = "IDLE" StateSleeping = "SLEEPING" StateCelebrating = "CELEBRATING" StateGrabbed = "GRABBED" )
XP and leveling constants
Variables ¶
This section is empty.
Functions ¶
func CalcXPToNext ¶
CalcXPToNext returns XP needed for the next level Formula: 100 * level * 1.5
Types ¶
type CustomDialogue ¶
type CustomDialogue struct {
ID string `json:"id"`
TextVI string `json:"textVi"`
TextEN string `json:"textEn"`
Mood string `json:"mood,omitempty"` // show only for this mood, empty = all
TimeFrom int `json:"timeFrom,omitempty"` // show from this hour (0-23), 0 = anytime
TimeTo int `json:"timeTo,omitempty"`
}
CustomDialogue — user-defined pet dialogue
type DialogueCategory ¶
type DialogueCategory string
DialogueCategory represents types of dialogues
const ( DialogueRandom DialogueCategory = "random" DialogueHealth DialogueCategory = "health" DialogueLevelUp DialogueCategory = "levelup" DialogueCustom DialogueCategory = "custom" )
type DialogueResponse ¶
type DialogueResponse struct {
Text string `json:"text"`
Type string `json:"type"` // random, health, levelup, custom
}
DialogueResponse wraps a dialogue text with metadata
func GetDialogue ¶
func GetDialogue(mood string, hour int, lang string) DialogueResponse
GetDialogue returns a random dialogue based on mood, hour, and language
type PetCatalogueEntry ¶
type PetCatalogueEntry struct {
ID string `json:"id"`
Name string `json:"name"`
SpriteSheet string `json:"spriteSheet"`
FrameWidth int `json:"frameWidth"`
FrameHeight int `json:"frameHeight"`
Animations map[string]AnimDef `json:"animations"`
Type string `json:"type"` // pokemon, shimeji, custom
DiscordAssetKey string `json:"discordAssetKey"`
}
PetCatalogueEntry — metadata for a pet type
func GetCatalogue ¶
func GetCatalogue() []PetCatalogueEntry
GetCatalogue returns the available pet catalogue
type PetInstance ¶
type PetInstance struct {
ID string `json:"id"`
PetID string `json:"petId"`
Name string `json:"name"`
Level int `json:"level"`
XP int `json:"xp"`
XPToNext int `json:"xpToNext"`
Progress float64 `json:"progress"` // 0.0 - 1.0
Mood string `json:"mood"` // happy, neutral, sad, hungry, sleepy
State string `json:"state"` // ACTIVE, IDLE, SLEEPING, CELEBRATING, GRABBED
Hunger float64 `json:"hunger"` // 0.0 (sated) - 1.0 (starving)
Energy float64 `json:"energy"` // 0.0 (exhausted) - 1.0 (full)
SpawnedAt time.Time `json:"spawnedAt"`
TotalPlaytime int64 `json:"totalPlaytime"` // seconds
}
PetInstance — the active pet being raised
func GetCurrentPet ¶
func GetCurrentPet() (*PetInstance, error)
GetCurrentPet returns the current pet instance
func Interact ¶
func Interact(action string) (*PetInstance, error)
Interact handles user interaction (pet/feed)
func SelectPet ¶
func SelectPet(petID string) (*PetInstance, error)
SelectPet creates or switches to a new pet
type PetStore ¶
type PetStore struct {
// contains filtered or unexported fields
}
PetStore handles persistence of pet and profile data
func (*PetStore) AddXP ¶
func (s *PetStore) AddXP(amount int) (*PetInstance, bool)
AddXP adds experience points and handles level ups Returns true if pet leveled up
func (*PetStore) CheckStreak ¶
func (s *PetStore) CheckStreak()
CheckStreak checks and updates the daily streak
func (*PetStore) GetPet ¶
func (s *PetStore) GetPet() *PetInstance
GetPet returns the current pet instance
func (*PetStore) GetProfile ¶
func (s *PetStore) GetProfile() *PlayerProfile
GetProfile returns the player profile
func (*PetStore) IncrementCommands ¶
func (s *PetStore) IncrementCommands()
IncrementCommands increments the total command count
func (*PetStore) Interact ¶
func (s *PetStore) Interact(action string) *PetInstance
Interact handles user interactions (pet, feed)
func (*PetStore) SelectPet ¶
func (s *PetStore) SelectPet(petID string, name string) *PetInstance
SelectPet creates or switches to a new pet
func (*PetStore) SetCustomDialogues ¶
func (s *PetStore) SetCustomDialogues(dialogues []CustomDialogue)
SetCustomDialogues saves custom dialogues
func (*PetStore) UpdateMood ¶
func (s *PetStore) UpdateMood()
UpdateMood updates the pet's mood based on hunger, energy, and time
func (*PetStore) UpdatePlaytime ¶
UpdatePlaytime adds elapsed seconds to total playtime
func (*PetStore) UpdateState ¶
UpdateState sets the pet's current state
type PlayerProfile ¶
type PlayerProfile struct {
ActivePetID string `json:"activePetId"`
CompletedPets []string `json:"completedPets"`
StreakDays int `json:"streakDays"`
LastActiveDate string `json:"lastActiveDate"` // YYYY-MM-DD
TotalFocusTime int64 `json:"totalFocusTime"` // seconds
TotalCommands int `json:"totalCommands"`
Achievements []string `json:"achievements"`
CustomDialogues []CustomDialogue `json:"customDialogues,omitempty"`
}
PlayerProfile — player progression data
type SessionData ¶
type SessionData struct {
StartedAt time.Time `json:"startedAt"`
ActiveTime int64 `json:"activeTime"` // seconds
CommandCount int `json:"commandCount"`
IdleSince time.Time `json:"idleSince"`
IsIdle bool `json:"isIdle"`
CurrentProject string `json:"currentProject"`
DiscordConnected bool `json:"discordConnected"`
}
SessionData — current session (not persisted across restarts)
func GetSessionData ¶
func GetSessionData() (*SessionData, error)
GetSessionData returns current session data
type SessionTracker ¶
type SessionTracker struct {
// contains filtered or unexported fields
}
SessionTracker tracks the current coding session
func GetSessionTracker ¶
func GetSessionTracker() *SessionTracker
GetSession returns the global session tracker
func NewSessionTracker ¶
func NewSessionTracker(store *PetStore) *SessionTracker
NewSessionTracker creates and starts a new session tracker
func (*SessionTracker) GetSession ¶
func (st *SessionTracker) GetSession() SessionData
GetSession returns a copy of the current session data
func (*SessionTracker) OnActivity ¶
func (st *SessionTracker) OnActivity()
OnActivity marks the session as active (user typed/interacted)
func (*SessionTracker) OnCommand ¶
func (st *SessionTracker) OnCommand()
OnCommand is called when a terminal command is executed
func (*SessionTracker) SetDiscordConnected ¶
func (st *SessionTracker) SetDiscordConnected(connected bool)
SetDiscordConnected updates the Discord connection status
func (*SessionTracker) SetProject ¶
func (st *SessionTracker) SetProject(project string)
SetProject updates the current project name