ctrl

package
v1.0.11 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 6, 2024 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ConfigFileName = "omipCfg.dat"
	DebounceTime   = 60 * 60 * 4
	TstCfgJson     = "TestCtrlMain.json"
)
View Source
const (

	// id ranges https://gist.github.com/a-tal/5ff5199fdbeb745b77cb633b7f4400bb
	EsiCorpIdLimit = 98000000
)

Variables

View Source
var ADhttpGetMock func(url string, data url.Values) (bodyBytes []byte, err error, resp *http.Response)
View Source
var CtrlTestEnable bool
View Source
var HttpPostDataMock string
View Source
var HttpRequestMock func(req *http.Request) (bodyBytes []byte, err error, resp *http.Response)
View Source
var TestAdashFlag bool

Functions

This section is empty.

Types

type ADashClient

type ADashClient struct {
	Username   string
	Password   string
	CorpTicker string
	CorpName   string
	LoginOK    bool
	Model      *model.Model
	CorpID     int
	AddLogCB   func(entry string)
	PapLogMap  map[string]int
	// contains filtered or unexported fields
}

func NewADashClient

func NewADashClient(username string, password string, ticker string, Model *model.Model, corpId int) *ADashClient
func (obj *ADashClient) CheckPapLinks() (result string)

func (*ADashClient) ConvertAdashPap2DB

func (obj *ADashClient) ConvertAdashPap2DB(pap *PapElem) *model.DBpap

func (*ADashClient) ConvertPapTimeStrToInt

func (obj *ADashClient) ConvertPapTimeStrToInt(timeString string) int64
func (obj *ADashClient) GetPapLinks() bool

func (*ADashClient) Login

func (obj *ADashClient) Login() bool

type Attackers_t

type Attackers_t struct {
	AllianceID     int32   `json:"alliance_id"`
	CharacterID    int32   `json:"character_id"`
	CorporationID  int32   `json:"corporation_id"`
	DamageDone     int32   `json:"damage_done"`
	FactionID      int32   `json:"faction_id"`
	FinalBlow      bool    `json:"final_blow"`
	SecurityStatus float32 `json:"security_status"`
	ShipTypeID     int32   `json:"ship_type_id"`
	WeaponTypeID   int32   `json:"weapon_type_id"`
}

type AuthCallBack

type AuthCallBack func(newChar *EsiChar)

type AuthResponse

type AuthResponse struct {
	AccessToken  string `json:"access_token"`
	ExpiresIn    int    `json:"expires_in"`
	TokenType    string `json:"token_type"`
	RefreshToken string `json:"refresh_token"`
}

type AuthValid

type AuthValid int
const (
	AUTH_STATUS_UNKOWN AuthValid = iota
	AUTH_STATUS_VALID
	AUTH_STATUS_INVALID
)

type CharacterInfo

type CharacterInfo struct {
	CharacterID          int
	CharacterName        string
	ExpiresOn            string
	Scopes               string
	TokenType            string
	CharacterOwnerHash   string
	IntellectualProperty string
}

type CharacterInfoExt

type CharacterInfoExt struct {
	AllianceId    int `json:"alliance_id"`
	CooperationId int `json:"corporation_id"`
	Director      bool
}

type CntrItems

type CntrItems struct {
	Is_included  bool  `json:"is_included"`
	Is_singleton bool  `json:"is_singleton"`
	Quantity     int   `json:"quantity"`
	Raw_quantity int   `json:"raw_quantity"`
	Record_id    int64 `json:"record_id"`
	Type_id      int   `json:"type_id"`
}

type Contracts

type Contracts struct {
	Acceptor_id           int32   `json:"acceptor_id"`
	Assignee_id           int32   `json:"assignee_id"`
	Availability          string  `json:"availability"`
	Buyout                float64 `json:"buyout"`
	Collateral            float64 `json:"collateral"`
	Contract_id           int32   `json:"contract_id"`
	Date_accepted         string  `json:"date_accepted"`
	Date_completed        string  `json:"date_completed"`
	Date_expired          string  `json:"date_expired"`
	Date_issued           string  `json:"date_issued"`
	Days_to_complete      int32   `json:"days_to_complete"`
	End_location_id       int64   `json:"end_location_id"`
	For_corporation       bool    `json:"for_corporation"`
	Issuer_corporation_id int32   `json:"issuer_corporation_id"`
	Issuer_id             int32   `json:"issuer_id"`
	Price                 float64 `json:"price"`
	Reward                float64 `json:"reward"`
	Start_location_id     int64   `json:"start_location_id"`
	Status                string  `json:"status"`
	Title                 string  `json:"title"`
	Type                  string  `json:"type"`
	Volume                float64 `json:"volume"`
}

type CorpMiningSettings added in v1.0.11

type CorpMiningSettings struct {
	CharName       string
	FilterAmount   string
	SelType        string
	Percentage     float64
	GroupSelection string
}

type CorpWallet

type CorpWallet struct {
	Balance  float64 `json:"balance"`
	Division int     `json:"division"`
}

type Ctrl

type Ctrl struct {
	Model  *model.Model
	Esi    EsiData
	Svr    httpSrvData
	AuthCb AuthCallBack
	ADash  map[int]*ADashClient

	LogEntries  []string
	AddLogCB    func(entry string)
	GuiStatusCB func(entry string, fieldId int)

	Up         EsiUpdate
	NotifyInfo map[int64]bool // initialized in UpdateAllData()
	// contains filtered or unexported fields
}

func NewCtrl

func NewCtrl(model *model.Model) *Ctrl

func (*Ctrl) AddLogEntry

func (obj *Ctrl) AddLogEntry(entry string)

func (*Ctrl) CheckIfDirector

func (obj *Ctrl) CheckIfDirector(char *EsiChar) bool

func (*Ctrl) CheckServerUp

func (obj *Ctrl) CheckServerUp(char *EsiChar) (retval bool)

func (*Ctrl) CheckUpdatePreCon

func (obj *Ctrl) CheckUpdatePreCon() (ok bool, err error)

func (*Ctrl) GenerateMiningData added in v1.0.11

func (obj *Ctrl) GenerateMiningData()

func (*Ctrl) GetAllyInfoFromEsi added in v1.0.11

func (obj *Ctrl) GetAllyInfoFromEsi(char *EsiChar, allyID int) (dbAllyInfo *model.DBallyInfo, result bool)

func (*Ctrl) GetCharInfo

func (obj *Ctrl) GetCharInfo(char *EsiChar)

func (*Ctrl) GetCharInfoExt

func (obj *Ctrl) GetCharInfoExt(char *EsiChar)

func (*Ctrl) GetContractItems

func (obj *Ctrl) GetContractItems(char *EsiChar, corp bool, contractID int)

func (*Ctrl) GetCorp

func (obj *Ctrl) GetCorp(char *EsiChar) *EsiCorp

func (*Ctrl) GetCorpDirector

func (obj *Ctrl) GetCorpDirector(corpId int) *EsiChar

func (*Ctrl) GetCorpInfoFromEsi added in v1.0.11

func (obj *Ctrl) GetCorpInfoFromEsi(char *EsiChar, corpId int) (dbcorp *model.DBcorpInfo, result bool)

func (*Ctrl) GetCorpTicker

func (obj *Ctrl) GetCorpTicker(char *EsiChar) (corpTicker string)

func (*Ctrl) GetKillMail

func (obj *Ctrl) GetKillMail(char *EsiChar, dbKM *model.DBKillmail,
	nameMapping map[int]string, lossMapping map[string]float64)

func (*Ctrl) GetOreValueByAmount added in v1.0.11

func (obj *Ctrl) GetOreValueByAmount(oreTypeID int, amount int) (totalValue float64, err error)

func (*Ctrl) GetOreValueByM3 added in v1.0.11

func (obj *Ctrl) GetOreValueByM3(oreTypeID int, volumeM3 float64) (value float64, err error)

func (*Ctrl) GetRequestMock added in v1.0.11

func (obj *Ctrl) GetRequestMock() (result ReqMockFuncT)

func (*Ctrl) GetStructureNameCached

func (obj *Ctrl) GetStructureNameCached(structureID int64, char *EsiChar) (name string)

func (*Ctrl) GetStructureNameFromEsi

func (obj *Ctrl) GetStructureNameFromEsi(char *EsiChar, structureId int64) (retval string)

func (*Ctrl) GetUniverseMock added in v1.0.11

func (obj *Ctrl) GetUniverseMock(inputReq string, inputUniData string) (result string)

func (*Ctrl) HTTPShutdown

func (obj *Ctrl) HTTPShutdown()

func (*Ctrl) InitiateKMSkipList

func (obj *Ctrl) InitiateKMSkipList(char *EsiChar, corp bool)

func (*Ctrl) Load

func (obj *Ctrl) Load(cfgFileName string, testEnable bool) (retval error)

func (*Ctrl) OpenAuthInBrowser

func (obj *Ctrl) OpenAuthInBrowser()

func (*Ctrl) ParseJournalDescription

func (obj *Ctrl) ParseJournalDescription(jourEntry *Journal)

func (*Ctrl) RefreshAuth

func (obj *Ctrl) RefreshAuth(char *EsiChar, enforce bool) (result bool)

func (*Ctrl) Save

func (obj *Ctrl) Save(cfgFileName string, testEnable bool) (retval error)

func (*Ctrl) ServerCancelled

func (obj *Ctrl) ServerCancelled() bool

func (*Ctrl) StartServer

func (obj *Ctrl) StartServer()

func (*Ctrl) SummaryLogEntry

func (obj *Ctrl) SummaryLogEntry(typeStr string, char *EsiChar, corp bool, statusMap map[string]int64)

func (*Ctrl) UpdateAllDataCmd

func (obj *Ctrl) UpdateAllDataCmd(updateProg func(c float64), finishCb func())

func (*Ctrl) UpdateChar

func (obj *Ctrl) UpdateChar(char *EsiChar)

func (*Ctrl) UpdateContractItems

func (obj *Ctrl) UpdateContractItems(char *EsiChar, corp bool)

func (*Ctrl) UpdateContracts

func (obj *Ctrl) UpdateContracts(char *EsiChar, corp bool)

func (*Ctrl) UpdateContractsInDb

func (obj *Ctrl) UpdateContractsInDb(char *EsiChar, corp bool, contractList []Contracts)

func (*Ctrl) UpdateCorp

func (obj *Ctrl) UpdateCorp(director *EsiChar)

func (*Ctrl) UpdateCorpMembers

func (obj *Ctrl) UpdateCorpMembers(director *EsiChar, corp bool)

func (*Ctrl) UpdateCorpMiningObs added in v1.0.11

func (obj *Ctrl) UpdateCorpMiningObs(char *EsiChar, corp bool)

UpdateCorpMiningObs retrieve list of corp mining observers via /corporation/{corporation_id}/mining/observers/

func (*Ctrl) UpdateGuiStatus1

func (obj *Ctrl) UpdateGuiStatus1(entry string)

func (*Ctrl) UpdateGuiStatus2

func (obj *Ctrl) UpdateGuiStatus2(entry string)

func (*Ctrl) UpdateIndustry

func (obj *Ctrl) UpdateIndustry(char *EsiChar, corp bool)

func (*Ctrl) UpdateIndustryInDb

func (obj *Ctrl) UpdateIndustryInDb(char *EsiChar, corp bool, jobList []JobInfos, statusMap map[string]int64)

func (*Ctrl) UpdateJournal

func (obj *Ctrl) UpdateJournal(char *EsiChar, corp bool, division int)

func (*Ctrl) UpdateKillMails

func (obj *Ctrl) UpdateKillMails(char *EsiChar, corp bool)

func (*Ctrl) UpdateMail

func (obj *Ctrl) UpdateMail(char *EsiChar)

func (*Ctrl) UpdateMailLabels

func (obj *Ctrl) UpdateMailLabels(char *EsiChar, corp bool)

func (*Ctrl) UpdateMarket

func (obj *Ctrl) UpdateMarket(char *EsiChar, corp bool)

func (*Ctrl) UpdateMiningAllies added in v1.0.11

func (obj *Ctrl) UpdateMiningAllies(char *EsiChar, allyMap map[int]int)

func (*Ctrl) UpdateMiningChars added in v1.0.11

func (obj *Ctrl) UpdateMiningChars(char *EsiChar)

func (*Ctrl) UpdateMiningCorps added in v1.0.11

func (obj *Ctrl) UpdateMiningCorps(char *EsiChar)

func (*Ctrl) UpdateMiningMeta added in v1.0.11

func (obj *Ctrl) UpdateMiningMeta(char *EsiChar, corp bool)

UpdateMiningMeta ensure we know all the names from all entities

func (*Ctrl) UpdateNotifications

func (obj *Ctrl) UpdateNotifications(char *EsiChar, corp bool)

func (*Ctrl) UpdateOrders

func (obj *Ctrl) UpdateOrders(char *EsiChar, corp bool)

func (*Ctrl) UpdateOrdersInDb

func (obj *Ctrl) UpdateOrdersInDb(char *EsiChar, corp bool, orderList []Order)

func (*Ctrl) UpdateSkippListLastMonth

func (obj *Ctrl) UpdateSkippListLastMonth(char *EsiChar, corp bool)

func (*Ctrl) UpdateStructures

func (obj *Ctrl) UpdateStructures(char *EsiChar, corp bool)

func (*Ctrl) UpdateTransaction

func (obj *Ctrl) UpdateTransaction(char *EsiChar, corp bool)

func (*Ctrl) UpdateWallet

func (obj *Ctrl) UpdateWallet(char *EsiChar, corp bool)

func (*Ctrl) ZkillOk

func (obj *Ctrl) ZkillOk(kmId int) (retval bool)

type EsiChar

type EsiChar struct {
	InitAuth        AuthResponse
	RefreshAuthData AuthResponse
	CharInfoData    CharacterInfo
	CharInfoExt     CharacterInfoExt

	ImageFile         string
	NextAuthTimeStamp int64
	UpdateFlags       UpdateFlags
	KmSkipList        map[int32]bool // map[KillmailID]bool
	AuthValid         AuthValid
	GuiSettings       GuiSettings
	// contains filtered or unexported fields
}
var NewChar *EsiChar

type EsiCorp

type EsiCorp struct {
	Name          string
	CooperationId int
	AllianceId    int
	Ticker        string
	ImageFile     string
	UpdateFlags   UpdateFlags
	KmSkipList    map[int32]bool // map[KillmailID]bool
}

type EsiData

type EsiData struct {
	EsiCharList  []*EsiChar
	EsiCorpList  []*EsiCorp
	SecretCode   []byte
	NVConfig     NVConfigData
	ETags        map[string]string // map[url]=etag
	CacheEntries map[string]int64  // map[url]=future cache expire unix time stamp
}

type EsiFileErrCode

type EsiFileErrCode int
const (
	ESI_FILE_DECRYPT_ERROR EsiFileErrCode = iota
	ESI_FILE_OPEN_ERROR
	ESI_FILE_WRITE_ERROR
	ESI_FILE_JSON_ERROR
)

type EsiFileError

type EsiFileError struct {
	ErrorCode EsiFileErrCode
	FileName  string
	ExtErr    string
}

func (EsiFileError) Error

func (obj EsiFileError) Error() (result string)

type EsiUpdate

type EsiUpdate struct {
	UpdateFuncList []UpdateFunc
	UpdateMutex    sync.Mutex
	JobList        []string
}

type GuiSettings added in v1.0.11

type GuiSettings struct {
	Jour       JournalSettings
	CorpMining CorpMiningSettings
}

type Items_t

type Items_t struct {
	Flag              int32     `json:"flag"`
	ItemTypeID        int32     `json:"item_type_id"`
	SubItems          []Items_t `json:"items"`
	QuantityDestroyed int32     `json:"quantity_destroyed"`
	QuantityDropped   int32     `json:"quantity_dropped"`
	Singleton         int32     `json:"singleton"`
}

type JobInfos

type JobInfos struct {
	ActivityId           int     `json:"activity_id"`
	BlueprintId          int64   `json:"blueprint_id"`
	BlueprintLocationId  int64   `json:"blueprint_location_id"`
	BlueprintTypeId      int     `json:"blueprint_type_id"`
	CompletedCharacterId int     `json:"completed_character_id"`
	CompletedDate        string  `json:"completed_date"`
	Cost                 float64 `json:"cost"`
	Duration             int     `json:"duration"`
	EndDate              string  `json:"end_date"`
	FacilityId           int64   `json:"facility_id"`
	InstallerId          int     `json:"installer_id"`
	JobId                int     `json:"job_id"`
	LicensedRuns         int     `json:"licensed_runs"`
	OutputLocationId     int64   `json:"output_location_id"`
	PauseDate            string  `json:"pause_date"`
	Probability          float64 `json:"probability"`
	ProductTypeId        int     `json:"product_type_id"`
	Runs                 int     `json:"runs"`
	StartDate            string  `json:"start_date"`
	StationId            int64   `json:"station_id"`
	Status               string  `json:"status"`
	SuccessfulRuns       int     `json:"successful_runs"`
}

type Journal

type Journal struct {
	Amount          float64 `json:"amount"`
	Balance         float64 `json:"balance"`
	Context_id      int64   `json:"context_id"`
	Context_id_type string  `json:"context_id_type"`
	Date            string  `json:"date"`
	Description     string  `json:"description"`
	First_party_id  int64   `json:"first_party_id"`
	Id              int64   `json:"id"`
	Reason          string  `json:"reason"`
	Ref_type        string  `json:"ref_type"`
	Second_party_id int64   `json:"second_party_id"`
	Tax             float64 `json:"tax"`
	Tax_receiver_id int64   `json:"tax_receiver_id"`
}

type JournalSettings added in v1.0.11

type JournalSettings struct {
	FilterPeriod   string
	FilterAmount   string
	FilterRefTypes string
	FilterDate     string
}

type KillMail_t

type KillMail_t struct {
	Attackers     []Attackers_t `json:"attackers"`
	KillMailID    int32         `json:"killmail_id"`
	KillMailTime  string        `json:"killmail_time"`
	MoonID        int32         `json:"moon_id"`
	SolarSystemID int32         `json:"solar_system_id"`
	Victim        Victim_t      `json:"victim"`
	WarID         int32         `json:"war_id"`
}

type KillMailsRecent_t

type KillMailsRecent_t struct {
	KillMailHash string `json:"killmail_hash"`
	KillmailID   int32  `json:"killmail_id"`
}

type Mail

type Mail struct {
	From       int          `json:"from"`
	IsRead     bool         `json:"is_read"`
	Labels     []int        `json:"labels"`
	MailId     int          `json:"mail_id"`
	Recipients []Recipients `json:"recipients"`
	Subject    string       `json:"subject"`
	Timestamp  string       `json:"timestamp"`
}

type MailLabel

type MailLabel struct {
	Color       string `json:"color"`
	LabelId     int    `json:"label_id"`
	Name        string `json:"name"`
	UnreadCount int    `json:"unread_count"`
}

type MailStatus

type MailStatus struct {
	Labels           []MailLabel `json:"labels"`
	TotalUnreadCount int         `json:"total_unread_count"`
}

MailStatus struct for mail labels https://esi.evetech.net/v3/characters/%d/mail/labels/?datasource=tranquility

type MarketPrice

type MarketPrice struct {
	Adjusted_price float64 `json:"adjusted_price"`
	Average_price  float64 `json:"average_price"`
	Type_id        int     `json:"type_id"`
}

type MiningData added in v1.0.11

type MiningData struct {
	CharacterID    int32  `json:"character_id"`
	LastUpdated    string `json:"last_updated"`
	Quantity       int32  `json:"quantity"`
	RecordedCorpId int32  `json:"recorded_corporation_id"`
	TypeId         int32  `json:"type_id"`
}

type MiningObservers added in v1.0.11

type MiningObservers struct {
	LastUpdated  string `json:"last_updated"`
	ObserverID   int64  `json:"observer_id"`
	ObserverType string `json:"observer_type"`
}

type NVConfigData

type NVConfigData struct {
	PeriodFilter string
}

NVConfigData non-volatile config

type Notification

type Notification struct {
	Is_read         bool   `json:"is_read"`
	Notification_id int64  `json:"notification_id"`
	Sender_id       int32  `json:"sender_id"`
	Sender_type     string `json:"sender_type"`
	Text            string `json:"text"`
	Timestamp       string `json:"timestamp"`
	Type            string `json:"type"`
}

type Order

type Order struct {
	Duration      int64   `json:"duration"`
	Escrow        float64 `json:"escrow"`
	IsBuyOrder    bool    `json:"is_buy_order"`
	IsCorporation bool    `json:"is_corporation"`
	Issued        string  `json:"issued"`
	LocationID    int64   `json:"location_id"`
	MinVolume     int     `json:"min_volume"`
	OrderID       int64   `json:"order_id"`
	Price         float64 `json:"price"`
	Range         string  `json:"range"`
	RegionID      int     `json:"region_id"`
	TypeID        int     `json:"type_id"`
	VolumeRemain  int     `json:"volume_remain"`
	VolumeTotal   int     `json:"volume_total"`
}

type PapElem

type PapElem struct {
	CorpId     int
	PapLink    string
	ChName     string
	CoTicker   string
	AlShort    string
	ShTypeName string
	Sub        string
	Loc        string
	Timestamp  string
}

type Position_t

type Position_t struct {
	X float64 `json:"x"`
	Y float64 `json:"y"`
	Z float64 `json:"z"`
}

type Recipients

type Recipients struct {
	RecipientId   int    `json:"recipient_id"`
	RecipientType string `json:"recipient_type"`
}

type ReqMockFuncT added in v1.0.11

type ReqMockFuncT func(req *http.Request) (bodyBytes []byte, err error, resp *http.Response)
var TestMockReq ReqMockFuncT

type ServerStatus

type ServerStatus struct {
	Players       int    `json:"players"`
	ServerVersion int    `json:"server_version"`
	StartTime     string `json:"start_time"`
	Vip           bool   `json:"vip"`
}

type Transaction

type Transaction struct {
	ClientID      int     `json:"client_id"`
	Date          string  `json:"date"`
	IsBuy         bool    `json:"is_buy"`
	JournalRefID  int64   `json:"journal_ref_id"`
	LocationID    int64   `json:"location_id"`
	Quantity      int     `json:"quantity"`
	TransactionID int64   `json:"transaction_id"`
	TypeID        int     `json:"type_id"`
	UnitPrice     float64 `json:"unit_price"`
}

type UpdateFlags

type UpdateFlags struct {
	PapLinks     bool
	Contracts    bool
	Corpmembers  bool
	IndustryJobs bool
	Journal      bool
	Killmails    bool
	Structures   bool
	Wallet       bool
	MailLabels   bool
	Mining       bool
}

type UpdateFunc

type UpdateFunc func(char *EsiChar, corp bool)

type Victim_t

type Victim_t struct {
	AllianceID    int32      `json:"alliance_id"`
	CharacterID   int32      `json:"character_id"`
	CorporationID int32      `json:"corporation_id"`
	DamageTaken   int32      `json:"damage_taken"`
	FactionID     int32      `json:"faction_id"`
	Items         []Items_t  `json:"items"`
	Position      Position_t `json:"position"`
	ShipTypeID    int32      `json:"ship_type_id"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL