Documentation ¶
Overview ¶
The sde package is a fully functional library for use with the DUST514 Static Data Export. The package automatically can download and manage multiple versions of the SDE and has multiple data structures to manipulate data.
Index ¶
- Constants
- Variables
- func Debug(t time.Time)
- func DoRangeFilter(i interface{}) float64
- func DownloadAllVersions()
- func GiveSDE(s *SDE)
- func IntervalFilter(i interface{}) float64
- func LoadCache(filename string) error
- func PrintWorthyStats(t SDEType)
- func SaveCache(filename string) error
- type AtterSet
- type CLFMetadata
- type CLFModule
- type CLFPreset
- type CLFSuit
- type Class
- type Fit
- type Progress
- type SDE
- func (s *SDE) Dump() error
- func (s *SDE) GetType(id int) (SDEType, error)
- func (s *SDE) GetTypeByName(name string) (SDEType, error)
- func (s *SDE) GetTypeNoAttr(id int) (SDEType, error)
- func (s *SDE) GetTypeQ(id int) (SDEType, error)
- func (s *SDE) GetTypeWhereNameContains(name string) ([]*SDEType, error)
- func (s *SDE) GetTypesByClassName(name string) (map[int]*SDEType, string)
- func (s *SDE) GetTypesWithTag(tag int) []*SDEType
- func (s *SDE) GobDump() chan Progress
- func (s *SDE) IterFunc(f func(TypeID int) bool) error
- func (s *SDE) Search(search string) ([]*SDEType, error)
- type SDECache
- type SDEType
- func (s *SDEType) ESBA()
- func (s *SDEType) GetAttribute(attributeName string) error
- func (s *SDEType) GetAttributes() error
- func (s *SDEType) GetAttributesLike(attributeName string) error
- func (s *SDEType) GetDPS() float64
- func (s SDEType) GetEquipmentSlots() int
- func (s SDEType) GetGrenadeSlots() int
- func (s SDEType) GetHeavySlots() int
- func (s SDEType) GetHighSlots() int
- func (s SDEType) GetLowSlots() int
- func (s SDEType) GetName() string
- func (s SDEType) GetPrimarySlots() int
- func (s *SDEType) GetRoF() int
- func (s *SDEType) GetSharedTagTypes() ([]*SDEType, error)
- func (s SDEType) GetSidearmSlots() int
- func (s *SDEType) HasTag(tag int) bool
- func (s *SDEType) IsAurum() bool
- func (s *SDEType) IsFaction() bool
- func (s *SDEType) IsObtainable() bool
- func (s *SDEType) IsWeapon() bool
- func (s *SDEType) Lookup(depth int)
- func (s *SDEType) ParentSDE() *SDE
- func (s *SDEType) PrintTags()
- func (s *SDEType) ToJSON() (string, error)
- type SkillLevel
- type Stats
- type Version
Constants ¶
const (
ProtofitsBaseURL = "http://www.protofits.com/fittings/getCLF/"
)
Variables ¶
var (
PrintDebug bool
)
var ( // Versions is a map of all of the available versions. Versions map[string]Version )
var WorthyAttributes map[string]AtterSet
Functions ¶
func DoRangeFilter ¶
func DoRangeFilter(i interface{}) float64
func DownloadAllVersions ¶
func DownloadAllVersions()
DownloadAllVersions is a function to download every version of the SDE that is available.
func GiveSDE ¶
func GiveSDE(s *SDE)
GiveSDE is used to give the sde package your primary SDE that you've opened We need this for fits to pull the data from the correct database. If you're not using fits don't bother. All of the fit provider functions should warn if it's not set.
func IntervalFilter ¶
func IntervalFilter(i interface{}) float64
func PrintWorthyStats ¶
func PrintWorthyStats(t SDEType)
Types ¶
type CLFMetadata ¶
type CLFMetadata struct {
Title string `json:"title"`
}
CLFMetadata holds the metadata portion of a CLF fit
type CLFModule ¶
type CLFModule struct { SDEType SDEType `json:"-"` TypeID string `json:"typeid"` SlotType string `json:"slottype"` Index int `json:"index"` }
CLFModule holds an individual module in the fit
type Class ¶
Class is a data structure to represent a Class in a static data export. Currently unused.
type Fit ¶
type Fit struct { CLFVersion int `json:"clf-version"` CLFType string `json:"X-clf-type"` CLFGeneratedBy string `json:"X-generatedby"` Metadata CLFMetadata `json:"metadata"` Suit CLFSuit `json:"ship"` Fitting CLFPreset `json:"presets"` }
Fit is a structure representing a CLF fit for DUST514 and internal structures for calculating stats.
func GetFitClipboard ¶
GetFitClipboard gets a CLF fit from the clipboard.
func GetFitFromFile ¶
GetFitFromFile loads a CLF fit from file.
func GetFitProtofits ¶
GetFitProtoFits gets a CLF fit from Protofits.com You must provide the id of the fit and it must be shared
func (*Fit) ApplySuitBonus ¶
func (f *Fit) ApplySuitBonus(stats *Stats, skill SkillLevel)
ApplySuitBonus applies bonuses for the suit using the skill level provided.
func (*Fit) FillFields ¶
func (s *Fit) FillFields()
FillFields is an internal function used to fill all the extra non-json within the SDEFit structure and sub structures.
type SDE ¶
type SDE struct { DB *sql.DB `json:"-"` Version string `json:"version"` Cache bool `json:"useCache"` }
SDE is a struct containing the database object, the version of the SDE and many methods for working with the SDE.
var (
PrimarySDE *SDE
)
func (*SDE) Dump ¶
Dump attemps to dump all relevent types to a file. Uses lots of memory. Be careful.
func (*SDE) GetTypeNoAttr ¶
GetType returns an SDEType of the given TypeID
func (*SDE) GetTypeWhereNameContains ¶
GetTypeWhereNameContains should be thought of as a search function that checks the display name.
func (*SDE) GetTypesByClassName ¶
func (*SDE) GetTypesWithTag ¶
type SDEType ¶
type SDEType struct { TypeID int `json:"typeId"` TypeName string `json:"typeName"` Attributes map[string]interface{} `json:"attributes"` FromCache bool `json:"fromCache"` // contains filtered or unexported fields }
SDEType holds hopefully all of the information you will need about a type. The interface in the Attributes map will always be either a float64, int or a string. If the value is always going to a whole number pull an int out otherwise assume it's a float
func (*SDEType) ESBA ¶
func (s *SDEType) ESBA()
Not documented for a reason. Don't ask. Pretend this doesn't exist
func (*SDEType) GetAttribute ¶
func (*SDEType) GetAttributes ¶
GetAttributes grabs the attributes for the type and applied them. This is used to speed up querries for simple lookups.
func (*SDEType) GetAttributesLike ¶
func (*SDEType) GetDPS ¶
GetDPS returns the DPS of a type, if it can. Notice: CCP has some all kinds of fucked up shit with bursts and intervals don't expect these numbers to be accurate until I can finally fix all of it.
func (SDEType) GetEquipmentSlots ¶
func (SDEType) GetGrenadeSlots ¶
func (SDEType) GetHeavySlots ¶
func (SDEType) GetHighSlots ¶
func (SDEType) GetLowSlots ¶
func (SDEType) GetPrimarySlots ¶
func (*SDEType) GetRoF ¶
GetRoF gets the ROF of any weapon in rounds per minute. Must vall GetAttributes first
func (*SDEType) GetSharedTagTypes ¶
GetSharedTagTypes returns a slice of SDETypes that share the 'main' tag of a type.
func (SDEType) GetSidearmSlots ¶
func (*SDEType) IsAurum ¶
IsAurum returns if the item is puchased with aurum. Be the soldiar of tomorrow, today with Aurum(C)(TM)(LOLCCP) Will also return true if it's a pack item or special edition. The only special edition suits that aren't filtered are unique.
func (*SDEType) IsObtainable ¶
IsObtainable returns True if the item is consumable. The name is misleading but it should be used to check if an item is obtainable by a player.
func (*SDEType) Lookup ¶
Lookup goes through our attributes in search of attributes that may be a TypeID and change it's value to an *SDEType.
type SkillLevel ¶
type SkillLevel uint8
SkillLevel is a type for each skill level available
const ( // SkillLevels LevelZero SkillLevel = iota LevelOne LevelTwo LevelThree LevelFour LevelFive )
type Stats ¶
type Stats struct { HealArmorRate int64 `sde:"mVICProp.healArmorRate" json:"repairRate"` Shields int64 `sde:"mVICProp.maxShield" json:"shield"` Armor int64 `sde:"mVICProp.maxArmor" json:"armor"` HealShieldRate int64 `sde:"mVICProp.healShieldRate" json:"shieldRecharge"` ShieldDepletedDelay int64 `sde:"mVICProp.shieldRechargePauseOnShieldDepleted" json:"depletedDelay"` CPU int64 `sde:"mVICProp.maxPowerReserve" json:"cpu"` CPUUsed int64 `json:"cpuUsed` CPUPercent int `json:"cpuPercent"` PG int64 `sde:"mVICProp.maxPowerReserve" json:"pg"` PGUsed int64 `json:"pgUsed"` PGPercent int `json:"pgPercent"` Stamina float64 `sde:"mCharProp.maxStamina" json:"stamina"` StaminaRecovery float64 `sde:"mCharProp.staminaRecoveryPerSecond" json:"staminaRecovery"` ScanPrecision int64 `sde:"mVICProp.signatureScanPrecision" json:"scanPrecision"` ScanProfile int64 `sde:"mVICProp.signatureScanProfile" json:"scanProfile"` ScanRadius int64 `sde:"mVICProp.signatureScanRadius" json:"scanRadius"` MetaLevel int64 `sde:"metaLevel" json:"metaLevel"` }
Stats is a general structure to output all of the stats of a fit. Fields values are automatically inserted via ApplySuitBonuses. This structure is ready to be exported via JSON.