Documentation ¶
Overview ¶
Package datasheet provides a way to get additional context when processing network data.
Index ¶
- func Unmarshal(data []byte, v interface{}) error
- func UnmarshalReader(dataReader io.Reader, v interface{}) error
- type Action
- type ActionStore
- type BNPCBase
- type BNPCInfo
- type BNPCName
- type BNPCStore
- func (b *BNPCStore) GetBNPCInfo(bNPCNameID, bNPCBaseID, modelCharaID uint32) *BNPCInfo
- func (b *BNPCStore) PopulateBNPCBases(dataReader io.Reader) error
- func (b *BNPCStore) PopulateBNPCNames(dataReader io.Reader) error
- func (b *BNPCStore) PopulateModelCharas(dataReader io.Reader) error
- func (b *BNPCStore) PopulateModelSkeletons(dataReader io.Reader) error
- type ClassJob
- type ClassJobStore
- type Collection
- type CraftAction
- type DataEntry
- type Datasheet
- type FileReader
- type InvalidUnmarshalError
- type Item
- type MapInfo
- type MapStore
- func (m *MapStore) GetMap(key uint16) models.MapInfo
- func (m *MapStore) GetMaps(territoryID uint16) []models.MapInfo
- func (m *MapStore) PopulateMaps(dataReader io.Reader) error
- func (m *MapStore) PopulatePlaceNames(dataReader io.Reader) error
- func (m *MapStore) PopulateTerritories(dataReader io.Reader) error
- type ModelChara
- type ModelSkeleton
- type Omen
- type PlaceName
- type Recipe
- type RecipeLevel
- type RecipeStore
- type RepeatStructTagError
- type Status
- type StatusStore
- type TerritoryInfo
- type UnmarshalTypeError
- type World
- type WorldStore
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Unmarshal ¶
Unmarshal parses the CSV-encoded datasheet and stores the result in the slice of structs pointed to by v. It works very similarly to to json.Unmarshal.
If v is nil or not a pointer to a slice of structs, Unmarshal returns an InvalidUnmarshalError. If the data is invalid CSV data, it returns a error from ParseRawCSV. If Unmarshal is unable to assign to a field of v the data, it returns an UnmarshalTypeError.
func UnmarshalReader ¶
UnmarshalReader is a convenience wrapper around reading bytes from an io.Reader and storing the parsed data into the slice of structs pointed to by v.
Types ¶
type Action ¶
type Action struct { Key uint32 `datasheet:"key"` Name string `datasheet:"Name"` Range int8 `datasheet:"Range"` TargetArea bool `datasheet:"TargetArea"` CastType byte `datasheet:"CastType"` EffectRange byte `datasheet:"EffectRange"` XAxisModifier byte `datasheet:"XAxisModifier"` OmenID uint16 `datasheet:"Omen"` Omen string }
Action stores the data for a game Action
type ActionStore ¶
type ActionStore struct { Actions map[uint32]Action Omens map[uint16]Omen CraftActions map[uint32]CraftAction }
ActionStore stores all of the Action data. Note that querying actions directly on the map will result in an empty Omen field. You should use GetAction in order to have an action with a correctly populated field.
func (*ActionStore) GetAction ¶
func (a *ActionStore) GetAction(key uint32) Action
GetAction returns the Action associated with the action key. It will also populate the Omen field on the action. If the action is not found in the standard Action store, it will attempt to return an action from the CraftAction store.
func (*ActionStore) PopulateActions ¶
func (a *ActionStore) PopulateActions(dataReader io.Reader) error
PopulateActions will populate the ActionStore with Action data provided a path to the data sheet for Actions.
func (*ActionStore) PopulateCraftActions ¶
func (a *ActionStore) PopulateCraftActions(dataReader io.Reader) error
PopulateCraftActions will populate the ActionStore with CraftAction data provided a path to the data sheet for CraftActions
func (*ActionStore) PopulateOmens ¶
func (a *ActionStore) PopulateOmens(dataReader io.Reader) error
PopulateOmens will populate the ActionStore with Omen data provided a path to the data sheet for Omens
type BNPCStore ¶
type BNPCStore struct { BNPCNames map[uint32]BNPCName BNPCBases map[uint32]BNPCBase ModelCharas map[uint32]ModelChara ModelSkeletons map[uint32]ModelSkeleton }
BNPCStore stores information about all monsters
func (*BNPCStore) GetBNPCInfo ¶
GetBNPCInfo returns a BNPCInfo object matching the provided parameters If the entry is not found, it returns nil
func (*BNPCStore) PopulateBNPCBases ¶
PopulateBNPCBases will populate the BNPCStore with BNPC data provided a path to the data sheet for BNPCBases
func (*BNPCStore) PopulateBNPCNames ¶
PopulateBNPCNames will populate the BNPCStore with BNPC data provided a path to the data sheet for BNPCNames
func (*BNPCStore) PopulateModelCharas ¶
PopulateModelCharas will populate the BNPCStore with BNPC data provided a path to the data sheet for ModelCharas
type ClassJob ¶
type ClassJob struct { Key byte `datasheet:"key"` Name string `datasheet:"Name"` Abbreviation string `datasheet:"Abbreviation"` }
ClassJob stores the data for a game ClassJob
type ClassJobStore ¶
ClassJobStore stores all of the ClassJob data.
func (*ClassJobStore) PopulateClassJobs ¶
func (c *ClassJobStore) PopulateClassJobs(dataReader io.Reader) error
PopulateClassJobs will populate the ClassJobStore with ClassJob data provided a path to the data sheet for ClassJobs.
type Collection ¶
type Collection struct { MapData MapStore BNPCData BNPCStore ActionData ActionStore StatusData StatusStore ClassJobData ClassJobStore RecipeData RecipeStore WorldData WorldStore }
Collection encapsulates a collection of datasheets
func (*Collection) Populate ¶
func (c *Collection) Populate(dataPath string) error
type CraftAction ¶
CraftAction stores the data for a game crafting Action
type Datasheet ¶
type Datasheet []DataEntry
Datasheet is an internal structure for holding a set of CSV records
type FileReader ¶
type FileReader struct {
// contains filtered or unexported fields
}
FileReader handles reading files and errors if they don't exist
func (*FileReader) Error ¶
func (f *FileReader) Error() error
func (*FileReader) ReadFile ¶
func (f *FileReader) ReadFile(fileName string, cb fileReaderCallback)
ReadFile reads the file provided and calls the callback function with the io.Reader. It won't do anything if a previous ReadFile has encountered an error.
type InvalidUnmarshalError ¶
InvalidUnmarshalError describes an error returned when an invalid argument is passed to Unmarshal
func (*InvalidUnmarshalError) Error ¶
func (e *InvalidUnmarshalError) Error() string
Error returns a formatted error message for the InvalidUnmarshalError
type MapInfo ¶
type MapInfo struct { Key uint16 `datasheet:"key"` ID string `datasheet:"Id"` SizeFactor uint16 `datasheet:"SizeFactor"` OffsetX int16 `datasheet:"Offset{X}"` OffsetY int16 `datasheet:"Offset{Y}"` PlaceName uint16 `datasheet:"PlaceName"` PlaceNameSub uint16 `datasheet:"PlaceName{Sub}"` TerritoryType uint16 `datasheet:"TerritoryType"` }
MapInfo stores the information for a game Map
type MapStore ¶
type MapStore struct { Maps map[uint16]MapInfo Territories map[uint16]TerritoryInfo PlaceNames map[uint16]PlaceName // contains filtered or unexported fields }
MapStore stores information about all maps and territories
func (*MapStore) GetMap ¶
GetMap returns the models.MapInfo associated with the Map key. It returns an empty models.MapInfo if no entry is found.
func (*MapStore) GetMaps ¶
GetMaps returns all Maps associated with the territory ID. If no entry is found, it returns nil
func (*MapStore) PopulateMaps ¶
PopulateMaps will populate the MapStore with map data provided a path to the data sheet for Maps
func (*MapStore) PopulatePlaceNames ¶
PopulatePlaceNames will populate the MapStore with place name data provided a path to the data sheet for PlaceNames
type ModelChara ¶
ModelChara stores information about the models used for the character
type ModelSkeleton ¶
ModelSkeleton stores information about the base size of the model
type Recipe ¶
type Recipe struct { Key uint32 `datasheet:"key"` RecipeLevel uint16 `datasheet:"RecipeLevelTable"` ItemID uint32 `datasheet:"Item{Result}"` RecipeElement byte `datasheet:"RecipeElement"` DifficultyFactor uint16 `datasheet:"DifficultyFactor"` QualityFactor uint16 `datasheet:"QualityFactor"` DurabilityFactor uint16 `datasheet:"DurabilityFactor"` CanHQ bool `datasheet:"CanHq"` }
Recipe stores some of the data for a game Recipe
type RecipeLevel ¶
type RecipeLevel struct { Key uint16 `datasheet:"key"` Difficulty uint16 `datasheet:"Difficulty"` Quality uint16 `datasheet:"Quality"` Durability uint16 `datasheet:"Durability"` }
RecipeLevel stores information about the difficulty of the recipe to improve quality and and increase progress
type RecipeStore ¶
type RecipeStore struct { Recipes map[uint32]Recipe RecipeLevelTable map[uint16]RecipeLevel Items map[uint32]Item }
RecipeStore stores all of the Recipe data.
func (*RecipeStore) GetInfo ¶
func (r *RecipeStore) GetInfo(key uint32) *models.RecipeInfo
GetInfo returns the normalized information about the recipe
func (*RecipeStore) PopulateItems ¶
func (r *RecipeStore) PopulateItems(dataReader io.Reader) error
PopulateItems will populate the RecipeStore with Item data provided a path to the data sheet for Items.
func (*RecipeStore) PopulateRecipeLevelTable ¶
func (r *RecipeStore) PopulateRecipeLevelTable(dataReader io.Reader) error
PopulateRecipeLevelTable will populate the RecipeStore with RecipeLevel data provided a path to the data sheet for RecipeLevelTable.
func (*RecipeStore) PopulateRecipes ¶
func (r *RecipeStore) PopulateRecipes(dataReader io.Reader) error
PopulateRecipes will populate the RecipeStore with Recipe data provided a path to the data sheet for Recipes.
type RepeatStructTagError ¶
RepeatStructTagError describes an error returned when a repeat struct tag is encountered
func (*RepeatStructTagError) Error ¶
func (e *RepeatStructTagError) Error() string
Error returns a formatted error message for the RepeatStructTagError
type Status ¶
type Status struct { Key uint32 `datasheet:"key"` Name string `datasheet:"Name"` Description string `datasheet:"Description"` }
Status stores the data for a game Status
type StatusStore ¶
StatusStore stores all of the Status data.
func (*StatusStore) PopulateStatuses ¶
func (s *StatusStore) PopulateStatuses(dataReader io.Reader) error
PopulateStatuses will populate the StatusStore with Status data provided a path to the data sheet for Statuses.
type TerritoryInfo ¶
type TerritoryInfo struct { Key uint16 `datasheet:"key"` Name string `datasheet:"Name"` Map uint16 `datasheet:"Map"` }
TerritoryInfo stores information about the territory
type UnmarshalTypeError ¶
type UnmarshalTypeError struct { Value string Type reflect.Type Row int Struct string Field string }
UnmarshalTypeError describes an error returned when the data could not be assigned to a specific Go type
func (*UnmarshalTypeError) Error ¶
func (e *UnmarshalTypeError) Error() string
type WorldStore ¶
WorldStore stores all of the World data.
func (*WorldStore) PopulateWorlds ¶
func (w *WorldStore) PopulateWorlds(dataReader io.Reader) error
PopulateWorlds will populate the WorldStore with World data provided a path to the data sheet for Worlds.