101 lines
3.3 KiB
Go
101 lines
3.3 KiB
Go
package taxonomy
|
|
|
|
import (
|
|
"log/slog"
|
|
|
|
"github.com/costap/quarkshologridledger/tongo-core/internal/domain/entity"
|
|
)
|
|
|
|
// YAMLLoader implements port.TaxonomyPort by reading from a YAML file.
|
|
type YAMLLoader struct {
|
|
path string
|
|
logger *slog.Logger
|
|
}
|
|
|
|
// New creates a new YAMLLoader instance.
|
|
func New(path string, logger *slog.Logger) *YAMLLoader {
|
|
return &YAMLLoader{
|
|
path: path,
|
|
logger: logger,
|
|
}
|
|
}
|
|
|
|
// Intermediary YAML file schema types
|
|
type taxonomyFile struct {
|
|
Quadrants []yamlQuadrant `yaml:"quadrants"`
|
|
MarketTemplates []yamlMarketTemplate `yaml:"market_templates"`
|
|
Venues []yamlVenue `yaml:"sector_pool"`
|
|
}
|
|
|
|
type yamlQuadrant struct {
|
|
ID string `yaml:"id"`
|
|
Name string `yaml:"name"`
|
|
Designation string `yaml:"designation"`
|
|
ColorCode string `yaml:"color_code"`
|
|
BaseVolatility float64 `yaml:"base_volatility"`
|
|
Factions []yamlFaction `yaml:"factions"`
|
|
}
|
|
|
|
type yamlFaction struct {
|
|
ID string `yaml:"id"`
|
|
Name string `yaml:"name"`
|
|
Abbreviation string `yaml:"abbreviation"`
|
|
Type string `yaml:"type"`
|
|
Homeworld string `yaml:"homeworld"`
|
|
ColorCode string `yaml:"color_code"`
|
|
EmblemGlyph string `yaml:"emblem_glyph"`
|
|
BaseShieldStrength int `yaml:"base_shield_strength"`
|
|
BaseAttackPower int `yaml:"base_attack_power"`
|
|
BaseEvasion int `yaml:"base_evasion"`
|
|
RivalryModifiers map[string]float64 `yaml:"rivalry_modifiers"`
|
|
}
|
|
|
|
type yamlVenue struct {
|
|
ID string `yaml:"id"`
|
|
Name string `yaml:"name"`
|
|
Quadrant string `yaml:"quadrant"`
|
|
Coordinates string `yaml:"coordinates"`
|
|
ShieldModifier float64 `yaml:"shield_modifier"`
|
|
DamageModifier float64 `yaml:"damage_modifier"`
|
|
EvasionModifier float64 `yaml:"evasion_modifier"`
|
|
SpecialEventChance float64 `yaml:"special_event_chance"`
|
|
Status string `yaml:"status"`
|
|
Tags []string `yaml:"tags"`
|
|
}
|
|
|
|
type yamlMarketTemplate struct {
|
|
ID string `yaml:"id"`
|
|
Name string `yaml:"name"`
|
|
Description string `yaml:"description"`
|
|
Category string `yaml:"category"`
|
|
Selections []yamlSelectionTemplate `yaml:"selections"`
|
|
}
|
|
|
|
type yamlSelectionTemplate struct {
|
|
Type string `yaml:"type"`
|
|
Name string `yaml:"name,omitempty"`
|
|
Suffix string `yaml:"suffix,omitempty"`
|
|
BasePrice float64 `yaml:"base_price"`
|
|
}
|
|
|
|
// LoadQuadrants returns all quadrant definitions including their factions.
|
|
func (l *YAMLLoader) LoadQuadrants() ([]entity.Quadrant, error) {
|
|
l.logger.Debug("Loading quadrants from taxonomy")
|
|
return nil, nil
|
|
}
|
|
|
|
// LoadVenues returns all sector pool venue definitions.
|
|
func (l *YAMLLoader) LoadVenues() ([]entity.Venue, error) {
|
|
l.logger.Debug("Loading venues from taxonomy")
|
|
return nil, nil
|
|
}
|
|
|
|
// LoadMarketTemplates returns all market template definitions.
|
|
func (l *YAMLLoader) LoadMarketTemplates() ([]entity.MarketTemplate, error) {
|
|
l.logger.Debug("Loading market templates from taxonomy")
|
|
return nil, nil
|
|
}
|
|
|
|
func (l *YAMLLoader) loadFile() (*taxonomyFile, error) {
|
|
return nil, nil
|
|
}
|