Documentation ¶
Overview ¶
Package for ORM access to freelancer game configs data.
configs_mapped allows directly accesing config files for reading in a type safe way and writing values back code is easily extendable without need to write explicit code for reading/writing to files, everything is done by universal custom ini reader
configs_export for type safer data export that has a lot of data already combined from configs for easy usage. See examples folder for how to use library.
This library is used in projects fl-darklint and fl-darkstat.
Checking stuff.
Example (ExportingData) ¶
ExampleExportingData demonstrating exporting freelancer folder data for comfortable usage
freelancer_folder := configs_settings.Env.FreelancerFolder configs := configs_mapped.NewMappedConfigs() logus.Log.Debug("scanning freelancer folder", utils_logus.FilePath(freelancer_folder)) // Reading to ini universal custom format and mapping to ORM objects // which have both reading and writing back capabilities configs.Read(freelancer_folder) // For elegantly exporting enriched data objects with better type safety for just reading access // it is already combined with multiple configs sources for flstat view exported := configs_export.Export(configs) for _, base := range exported.Bases { // do smth with exported bases fmt.Println(base.Name) fmt.Println(base.Infocard) fmt.Println(base.System) fmt.Println(base.SystemNickname) fmt.Printf("%d\n", base.InfocardID) break }
Output:
Example (ModifyingConfigs) ¶
ExampleModifyingData demononstrating how to change configs values
freelancer_folder := configs_settings.Env.FreelancerFolder configs := configs_mapped.NewMappedConfigs() logus.Log.Debug("scanning freelancer folder", utils_logus.FilePath(freelancer_folder)) // Reading ini reading universal format // and mapping to ORM objects configs.Read(freelancer_folder) // Modifying files for _, base := range configs.Universe_config.Bases { base.Nickname.Set(base.Nickname.Get()) base.System.Set(base.System.Get()) base.File.Set(base.File.Get()) } for _, system := range configs.Universe_config.Systems { system.Nickname.Set(system.Nickname.Get()) system.Msg_id_prefix.Set(system.Msg_id_prefix.Get()) if system.File.Get() != "" { system.File.Set(system.File.Get()) } } // Write without Dry Run for writing to files modified values back! configs.Write(configs_mapped.IsDruRun(true))
Output:
Directories ¶
Path | Synopsis |
---|---|
Tool to parse freelancer configs
|
Tool to parse freelancer configs |
freelancer_mapped/data_mapped
This package is equal to DATA folder present in Freelancer Discovery.
|
This package is equal to DATA folder present in Freelancer Discovery. |
freelancer_mapped/data_mapped/universe_mapped
parse universe.ini
|
parse universe.ini |
freelancer_mapped/exe_mapped/go-binary-pack
Package binary_pack performs conversions between some Go values represented as byte slices.
|
Package binary_pack performs conversions between some Go values represented as byte slices. |
parserutils/filefind
Package with reusable code for discovery of files and other reusable stuff like universal ini reader
|
Package with reusable code for discovery of files and other reusable stuff like universal ini reader |
parserutils/inireader
Okay we need to create syntax.
|
Okay we need to create syntax. |
parserutils/semantic
ORM mapper for Freelancer ini reader.
|
ORM mapper for Freelancer ini reader. |