123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- package main
- import "time"
- type YTConfig struct {
- Sectors int `json:"sectors"`
- Turns int `json:"turns"`
- Holds int `json:"holds"`
- PortReset int `json:"reset"` // What is this? (Amount ports replenish per day?, )
- DaysExpire int `json:"expire"`
- Lottery int `json:"lotto"` // What is this? (Number of times players can play?, Lotto seed?)
- }
- type YTSectorType uint16
- type YTSector struct {
- Sector YTSectorType
- Planet bool `json:"planet"` // This could be calculated
- Port bool `json:"port"` // This could be calculated
- Fighters uint `json:"fighters"`
- FighterOwner int `json:"owner"`
- Mines uint `json:"mines"`
- Sectors []YTSectorType `json:"sectors"` // Warps
- Players []int `json:"players`
- }
- func (sector YTSector) HasPlanet() bool {
- _, has := YTPlanets[sector.Sector]
- return has
- }
- func (sector YTSector) HasPort() bool {
- //_, has := YTSectors[sector.Sector]
- //return YTSectors[sector.Sector].Port
- var has bool
- _, has = YTPortMap[sector.Sector]
- return has
- }
- var YTSectors []YTSector
- type YTPlayer struct {
- Sector YTSectorType
- Name string `json:"name"`
- LastPlayed time.Time `json:"last"`
- Turns int `json:"turns"`
- Credits uint `json:"credits"` // Money!
- Holds int `json:"holds"`
- Amounts [3]uint `json:"holding"` // FUEL, ORG, EQU
- Lotto uint8 `json:"lotto` // Number of lottos able to be played
- Cloak uint16 `json:"cloak` // Cloak Energy (Percent)
- Fighters uint `json:"figs"`
- Mines uint `json:"mines"`
- Missiles uint `json:"missiles"`
- Scanner bool `json:"scanner"` // Danger Scanner
- Shields uint `json:"shields"`
- Forces uint `json:"forces"` // Ground Forces
- PortsOwned uint `json:"ports"` // Number of ports owned by this player
- PlasmaBolts uint `json:"bolts"`
- }
- // or to database? DB would also handle concurrency...
- type YTPlayers struct {
- Players map[uint]YTPlayer `json:"players"`
- }
- const (
- PORT_EARTH = 0
- PORT_FUEL = 1
- PORT_ORG = 2
- PORT_EQU = 3
- PORT_SPACEPORT = 4 // Maybe!?
- )
- // Or database? DB would work better for player info
- // YT Ports: Sell one thing, buy the others.
- type YTPort struct {
- Name string `json:"name"`
- Owner int `json:"owner"`
- Credits uint64 `json:"credits"`
- Type uint8 `json:"type"`
- Amounts [3]uint32 `json:"amounts"`
- }
- var YTPortMap map[YTSectorType]YTPort
- // Spending $$$ increases production of planets (Need to gather information)
- //
- // Putting money in the planet's bank produces interest (free money earned per day, need to get the formula)
- //
- // Forces grow as there are more stationed on the planet, also affects attack and defenses of the planet (Need to gather information on attacks and how much they grow by)
- //
- // When a planet exceeds a particular amount it encounters a recession loosing production and some items along the way (need information)
- type YTPlanet struct {
- Name string `json:"name"`
- Owner int `json:"owner"`
- Production [3]uint `json:"products"` // FUEL, ORG, EQU (Production per day)
- Amounts [3]uint `json:"amounts"` // FUEL, ORG, EQU (Amount)
- Fighters [2]uint `json:"figs"` // Production, Amount
- Missiles [2]uint `json:"missiles"`
- Mines [2]uint `json:"mines"`
- Credits [2]uint `json:"credits"` // Money! (Interest, Amount)
- Forces [2]uint `json:"forces"` // Ground Forces (Population Growth, Population)
- PlasmaBolts [2]uint `json:"bolts"`
- }
- var YTPlanets map[YTSectorType]YTPlanet
|