Documentation
¶
Index ¶
- Constants
- func NewHTTPHandler(s *Service, c HTTPConfig) (http.Handler, error)
- func SetDefault(s *Service)
- func ShutdownHTTP(server *http.Server)
- func StartHTTP(s *Service, c HTTPConfig) (*http.Server, error)
- type Ability
- type Action
- type Art
- type Battle
- type Catalog
- type Character
- type Enemy
- type Equipment
- type Error
- type Growth
- type HTTPConfig
- type HTTPHandler
- type Hero
- type HistoryEntry
- type Opponent
- type PartyRequest
- type Profile
- type ProgressRequest
- type ProgressionRules
- type Pull
- type Region
- type Service
- func (s *Service) Act(ctx context.Context, player, battleID string, a Action) (Snapshot, error)
- func (s *Service) Catalog() Catalog
- func (s *Service) EnsurePlayer(ctx context.Context, aliases []string, name string) (Profile, error)
- func (s *Service) ExchangeTicket(ctx context.Context, ticket string) (string, error)
- func (s *Service) History(ctx context.Context, player string) ([]HistoryEntry, error)
- func (s *Service) IssueTicket(ctx context.Context, player string) (string, error)
- func (s *Service) Logout(ctx context.Context, session string) error
- func (s *Service) Progress(ctx context.Context, player, operation string, a ProgressRequest) (Snapshot, error)
- func (s *Service) Retreat(ctx context.Context, player, battleID, request string, revision int64) (Snapshot, error)
- func (s *Service) SessionPlayer(ctx context.Context, session string) (string, error)
- func (s *Service) SetParty(ctx context.Context, player string, a PartyRequest) (Snapshot, error)
- func (s *Service) Snapshot(ctx context.Context, id string) (Snapshot, error)
- func (s *Service) StartBattle(ctx context.Context, player, request string, stage int) (Snapshot, error)
- func (s *Service) Summon(ctx context.Context, player, request, banner string, count int) (Snapshot, error)
- type Snapshot
- type Stage
Constants ¶
View Source
const BannerID = "fajar-v1"
View Source
const RulesVersion = "arunika-v3"
Variables ¶
This section is empty.
Functions ¶
func NewHTTPHandler ¶
func NewHTTPHandler(s *Service, c HTTPConfig) (http.Handler, error)
func SetDefault ¶
func SetDefault(s *Service)
func ShutdownHTTP ¶
Types ¶
type Battle ¶
type Battle struct {
ID string `json:"id"`
Revision int64 `json:"revision"`
Rules string `json:"rules"`
Stage int `json:"stage"`
Round int `json:"round"`
Active int `json:"active"`
Target int `json:"target"`
Phase string `json:"phase"`
Done bool `json:"done"`
Result string `json:"result"`
FirstClear bool `json:"first_clear"`
RewardShards int `json:"reward_shards"`
RewardCoins int `json:"reward_coins"`
RewardXP int `json:"reward_xp"`
RewardTrainingXP int `json:"reward_training_xp"`
Heroes []Hero `json:"heroes"`
Enemies []Opponent `json:"enemies"`
Logs []string `json:"logs"`
}
type Catalog ¶
type Catalog struct {
Version string `json:"version"`
Characters []Character `json:"characters"`
Enemies []Enemy `json:"enemies"`
Regions []Region `json:"regions"`
Stages []Stage `json:"stages"`
Featured string `json:"featured"`
Equipment []Equipment `json:"equipment"`
Progression ProgressionRules `json:"progression"`
}
type Character ¶
type Character struct {
ID string `json:"id"`
Name string `json:"name"`
Rarity int `json:"rarity"`
Role string `json:"role"`
Element string `json:"element"`
RegionID string `json:"region_id"`
Visual string `json:"visual"`
Personality string `json:"personality"`
Skill Ability `json:"skill"`
Passive Ability `json:"passive"`
Art Art `json:"art"`
}
type Enemy ¶
type Enemy struct {
ID string `json:"id"`
Name string `json:"name"`
RegionID string `json:"region_id"`
Element string `json:"element"`
Archetype string `json:"archetype"`
MinLevel int `json:"min_level"`
MaxLevel int `json:"max_level"`
Visual string `json:"visual"`
Ability string `json:"ability"`
Art Art `json:"art"`
}
type HTTPConfig ¶
func (HTTPConfig) Validate ¶
func (c HTTPConfig) Validate() error
type HTTPHandler ¶
type HTTPHandler struct {
// contains filtered or unexported fields
}
func (*HTTPHandler) ServeHTTP ¶
func (h *HTTPHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
type Hero ¶
type Hero struct {
Awakening int `json:"awakening"`
CurrentAction string `json:"-"`
ShieldBreakRound int `json:"shield_break_round,omitempty"`
PassiveUsed bool `json:"passive_used,omitempty"`
PassiveRound int `json:"passive_round,omitempty"`
PassiveBoost float64 `json:"passive_boost,omitempty"`
SkillBoost bool `json:"skill_boost,omitempty"`
ShieldSource string `json:"shield_source,omitempty"`
Character
HP int `json:"hp"`
Max int `json:"max"`
Attack int `json:"attack"`
Defense int `json:"defense"`
Energy int `json:"energy"`
Acted bool `json:"acted"`
Guard bool `json:"guard"`
Level int `json:"level"`
Shield int `json:"shield"`
Taunt bool `json:"taunt"`
Regen int `json:"regen"`
Reflect bool `json:"reflect"`
Evade bool `json:"evade"`
Empower bool `json:"empower"`
}
type HistoryEntry ¶
type Opponent ¶
type Opponent struct {
MarkBonus int `json:"mark_bonus,omitempty"`
BlindChance int `json:"blind_chance,omitempty"`
BurnExpose bool `json:"burn_expose,omitempty"`
BurnSource string `json:"burn_source,omitempty"`
Enemy
HP int `json:"hp"`
Max int `json:"max"`
Attack int `json:"attack"`
Defense int `json:"defense"`
Kind string `json:"kind"`
Charged bool `json:"charged"`
Burn int `json:"burn"`
BurnPower int `json:"burn_power"`
Weaken int `json:"weaken"`
Expose int `json:"expose"`
Slow int `json:"slow"`
Blind int `json:"blind"`
Mark bool `json:"mark"`
Shield int `json:"shield"`
}
type PartyRequest ¶
type Profile ¶
type Profile struct {
ID string `json:"id"`
Name string `json:"name"`
Revision int64 `json:"revision"`
Version int `json:"version"`
Shards int `json:"shards"`
Coins int `json:"coins"`
Dust int `json:"dust"`
Pity5 int `json:"pity5"`
Pity4 int `json:"pity4"`
Guarantee bool `json:"guarantee"`
Unlocked int `json:"unlocked"`
Cleared []int `json:"cleared"`
Party []string `json:"party"`
Collection map[string]int `json:"collection"`
Awakening map[string]int `json:"awakening"`
Enhancements map[string]int `json:"enhancements"`
LastBattle string `json:"last_battle"`
Growth map[string]Growth `json:"growth"`
TrainingXP int `json:"training_xp"`
LevelCap int `json:"level_cap"`
Inventory map[string]int `json:"inventory"`
Loadouts map[string]map[string]string `json:"loadouts"`
}
type ProgressRequest ¶
type ProgressionRules ¶
type ProgressionRules struct {
AwakeningMax int `json:"awakening_max"`
AwakeningCoins int `json:"awakening_coins"`
AwakeningDust int `json:"awakening_dust"`
AwakeningPercent int `json:"awakening_percent"`
EnhancementMax int `json:"enhancement_max"`
EnhancementDust int `json:"enhancement_dust"`
EnhancementPercent int `json:"enhancement_percent"`
}
Costs are sent in the catalog so clients display the same deterministic rules.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func (*Service) EnsurePlayer ¶
EnsurePlayer is reachable only from the WhatsApp handler, never from HTTP. Trusted PN/LID aliases map to one internal ID so a different addressing mode does not create a second wallet. Conflicting existing accounts are not merged silently.
func (*Service) ExchangeTicket ¶
func (*Service) IssueTicket ¶
IssueTicket invalidates older, unused links for this player. Raw tickets and session tokens never enter the database or application logs.
func (*Service) SessionPlayer ¶
func (*Service) StartBattle ¶
Click to show internal directories.
Click to hide internal directories.