diff --git a/Taskfile.yml b/Taskfile.yml new file mode 100644 index 0000000..99e975c --- /dev/null +++ b/Taskfile.yml @@ -0,0 +1,34 @@ +# https://taskfile.dev + +version: '3' + +tasks: + default: + desc: Runs application + cmds: + - go run ./cmd/abyss-blackbox/ + silent: true + + test: + desc: Run all the go tests. + cmds: + - go test ./... + + install-deps: + desc: Install dependencies needed to build release + cmds: + - go get github.com/gonutz/rsrc + silent: true + + resources: + desc: Compile resource file + cmds: + - rsrc -manifest ./cmd/abyss-blackbox/main.manifest -ico ./trig_96x96.ico -o ./cmd/abyss-blackbox/rsrc.syso + + release: + desc: Builds artifacts for release + deps: [install-deps, resources] + cmds: + - go generate ./... + - go build -trimpath -ldflags="-H windowsgui -s -w" -o abyss-blackbox.exe ./cmd/abyss-blackbox + - go build -trimpath -ldflags="-s -w" ./cmd/extract/ diff --git a/build-release.bat b/build-release.bat index 947feb4..7f48bd7 100644 --- a/build-release.bat +++ b/build-release.bat @@ -1,4 +1,4 @@ -rsrc -manifest ./cmd/abyss-blackbox/main.manifest -ico ./trig_96x96.ico -o ./cmd/abyss-blackbox/rsrc.syso +Rem rsrc -manifest ./cmd/abyss-blackbox/main.manifest -ico ./trig_96x96.ico -o ./cmd/abyss-blackbox/rsrc.syso Rem go build -ldflags="-H windowsgui" -o abyss-blackbox.exe go generate ./... go build -trimpath -ldflags="-H windowsgui -s -w" -o abyss-blackbox.exe ./cmd/abyss-blackbox diff --git a/cmd/abyss-blackbox/config.go b/cmd/abyss-blackbox/config.go new file mode 100644 index 0000000..65563ca --- /dev/null +++ b/cmd/abyss-blackbox/config.go @@ -0,0 +1,166 @@ +package main + +import ( + "encoding/json" + "os" + "os/user" + "path/filepath" + "sync" + + "github.com/lxn/walk" + "github.com/shivas/abyss-blackbox/internal/mainwindow" +) + +type captureConfig struct { + sync.Mutex + X, Y, H int + AppRoot string + Recordings string + FilterThreshold int + FilteredPreview bool + EVEClientWindowTitle string + EVEGameLogsFolder string + TestServer bool + RecorderShortcutText string + RecorderShortcut walk.Shortcut + Weather30ShortcutText string + Weather30Shortcut walk.Shortcut + Weather50ShortcutText string + Weather50Shortcut walk.Shortcut + Weather70ShortcutText string + Weather70Shortcut walk.Shortcut + LootRecordDiscriminator string +} + +// SetRecorderShortcut satisfies ShortcutSetter interface. +func (c *captureConfig) SetRecorderShortcut(shorcutType int, s walk.Shortcut) { + switch shorcutType { + case mainwindow.ShortcutRecorder: + c.RecorderShortcut = s + c.RecorderShortcutText = s.String() + + case mainwindow.ShortcutWeather30: + c.Weather30Shortcut = s + c.Weather30ShortcutText = s.String() + + case mainwindow.ShortcutWeather50: + c.Weather50Shortcut = s + c.Weather50ShortcutText = s.String() + + case mainwindow.ShortcutWeather70: + c.Weather70Shortcut = s + c.Weather70ShortcutText = s.String() + } +} + +// readConfig reads configuration from json file, or creates one if file doesn't exist +func readConfig() (*captureConfig, error) { + appDir, err := filepath.Abs(filepath.Dir(os.Args[0])) + if err != nil { + return nil, err + } + + var c *captureConfig + + load := true + settingsFilename := filepath.Join(appDir, "settings.json") + + defaultRecorderShortcut := walk.Shortcut{Modifiers: walk.ModControl | walk.ModAlt, Key: walk.KeyEnd} + defaultWeather30Shortcut := walk.Shortcut{Modifiers: walk.ModControl | walk.ModAlt, Key: walk.KeyNumpad3} + defaultWeather50Shortcut := walk.Shortcut{Modifiers: walk.ModControl | walk.ModAlt, Key: walk.KeyNumpad5} + defaultWeather70Shortcut := walk.Shortcut{Modifiers: walk.ModControl | walk.ModAlt, Key: walk.KeyNumpad7} + + _, err = os.Stat(settingsFilename) + if os.IsNotExist(err) { + // fetch current user folder and try to point to Gamelogs folder + usr, errr := user.Current() + if errr != nil { + return nil, errr + } + + eveGameLogsFolder := filepath.Join(usr.HomeDir, "Documents", "EVE", "logs", "Gamelogs") + + c = &captureConfig{ + AppRoot: appDir, + X: 10, + Y: 10, + H: 400, + Recordings: filepath.Join(appDir, "recordings"), + FilterThreshold: 110, + FilteredPreview: false, + EVEGameLogsFolder: eveGameLogsFolder, + RecorderShortcutText: defaultRecorderShortcut.String(), + RecorderShortcut: defaultRecorderShortcut, + Weather30ShortcutText: defaultWeather30Shortcut.String(), + Weather30Shortcut: defaultWeather30Shortcut, + Weather50ShortcutText: defaultWeather50Shortcut.String(), + Weather50Shortcut: defaultWeather50Shortcut, + Weather70ShortcutText: defaultWeather70Shortcut.String(), + Weather70Shortcut: defaultWeather70Shortcut, + LootRecordDiscriminator: "Quafe", + } + load = false + } else if err != nil { + return c, err + } + + if load { + f, err := os.Open(settingsFilename) + if err != nil { + return c, err + } + defer f.Close() + + err = json.NewDecoder(f).Decode(&c) + if err != nil { + return c, err + } + + if c.RecorderShortcutText == "" { + c.RecorderShortcut = defaultRecorderShortcut + c.RecorderShortcutText = defaultRecorderShortcut.String() + } + + if c.Weather30ShortcutText == "" { + c.Weather30Shortcut = defaultWeather30Shortcut + c.Weather30ShortcutText = defaultWeather30Shortcut.String() + } + + if c.Weather50ShortcutText == "" { + c.Weather50Shortcut = defaultWeather50Shortcut + c.Weather50ShortcutText = defaultWeather50Shortcut.String() + } + + if c.Weather70ShortcutText == "" { + c.Weather70Shortcut = defaultWeather70Shortcut + c.Weather70ShortcutText = defaultWeather70Shortcut.String() + } + + if c.LootRecordDiscriminator == "" { + c.LootRecordDiscriminator = "Quafe" + } + } + + return c, nil +} + +// writeConfig saves configuration to json file +func writeConfig(c *captureConfig) error { + settingsFilename := filepath.Join(c.AppRoot, "settings.json") + + f, err := os.Create(settingsFilename) + if err != nil { + return err + } + defer f.Close() + + encoder := json.NewEncoder(f) + encoder.SetIndent("", " ") + + err = encoder.Encode(c) + if err != nil { + return err + } + + return nil +} diff --git a/cmd/abyss-blackbox/main.go b/cmd/abyss-blackbox/main.go index ee1d6aa..c177b8a 100644 --- a/cmd/abyss-blackbox/main.go +++ b/cmd/abyss-blackbox/main.go @@ -1,16 +1,12 @@ package main import ( - "encoding/json" "fmt" "image" "image/color" "log" "os" - "os/user" - "path/filepath" "regexp" - "sync" "time" "github.com/disintegration/imaging" @@ -28,25 +24,12 @@ var recordingChannel chan *image.Paletted var notificationChannel chan NotificationMessage var recorder *Recorder -type captureConfig struct { - sync.Mutex - X, Y, H int - AppRoot string - Recordings string - FilterThreshold int - FilteredPreview bool - EVEClientWindowTitle string - EVEGameLogsFolder string - TestServer bool - RecorderShortcutText string - RecorderShortcut walk.Shortcut -} - -// SetRecorderShortcut satisfies ShortcutSetter interface. -func (c *captureConfig) SetRecorderShortcut(s walk.Shortcut) { - c.RecorderShortcut = s - c.RecorderShortcutText = s.String() -} +const ( + hotkeyRecoder = iota + 1 + hotkeyWeather30 + hotkeyWeather50 + hotkeyWeather70 +) func main() { var err error @@ -67,7 +50,8 @@ func main() { defer recorder.StopLoop() - foundEVEClientWindows, err := screen.FindWindow(regexp.MustCompile(EVEClientWindowRe)) + foundEVEClientWindows, _ := screen.FindWindow(regexp.MustCompile(EVEClientWindowRe)) + foundEVEClientWindows = foundEVEClientWindows.EnsureUniqueNames() comboModel := make([]*mainwindow.WindowComboBoxItem, 0) for handle, title := range foundEVEClientWindows { @@ -137,6 +121,7 @@ func main() { armw.CombatLogCharacterGroup.SetEnabled(false) armw.CaptureSettingsGroup.SetEnabled(false) armw.ChooseLogDirButton.SetEnabled(false) + armw.LootRecordDiscriminatorEdit.SetEnabled(false) armw.TestServer.SetEnabled(false) _ = armw.RecordingButton.SetText("Stop recording") } else { @@ -148,41 +133,70 @@ func main() { armw.CaptureSettingsGroup.SetEnabled(true) armw.ChooseLogDirButton.SetEnabled(true) armw.TestServer.SetEnabled(true) + armw.LootRecordDiscriminatorEdit.SetEnabled(true) _ = armw.RecordingButton.SetText("Start recording") } } armw.RecordingButton.Clicked().Attach(recordingButtonHandler) armw.MainWindow.Hotkey().Attach(func(hkid int) { - if hkid == 1 { + switch hkid { + case hotkeyRecoder: recordingButtonHandler() + case hotkeyWeather30: + recorder.GetWeatherStrengthListener(30)() + case hotkeyWeather50: + recorder.GetWeatherStrengthListener(50)() + case hotkeyWeather70: + recorder.GetWeatherStrengthListener(70)() } }) - walk.RegisterGlobalHotKey(armw.MainWindow, 1, currentSettings.RecorderShortcut) - - shortcutRecorderHandler := func() { - if !armw.RecorderShortcutEdit.Enabled() { // start recording - armw.RecorderShortcutEdit.SetEnabled(true) - _ = armw.RecorderShortcutEdit.SetFocus() - _ = armw.RecorderShortcutRecordButton.SetText("Save") - - if !win.UnregisterHotKey(armw.MainWindow.Handle(), 1) { - walk.MsgBox(armw.MainWindow, "Failed unregistering hotkey", "failed unregistering key, please restart application", walk.MsgBoxIconWarning) - return - } - } else { // persist new shortcut and rebind - armw.RecorderShortcutEdit.SetEnabled(false) - _ = armw.RecorderShortcutRecordButton.SetText("Record shortcut") - if !walk.RegisterGlobalHotKey(armw.MainWindow, 1, currentSettings.RecorderShortcut) { - walk.MsgBox(armw.MainWindow, "Failed registering new hotkey", "failed registering new shortcut key, please restart application", walk.MsgBoxIconWarning) - return - } - _ = writeConfig(currentSettings) - } - } + walk.RegisterGlobalHotKey(armw.MainWindow, hotkeyRecoder, currentSettings.RecorderShortcut) + walk.RegisterGlobalHotKey(armw.MainWindow, hotkeyWeather30, currentSettings.Weather30Shortcut) + walk.RegisterGlobalHotKey(armw.MainWindow, hotkeyWeather50, currentSettings.Weather50Shortcut) + walk.RegisterGlobalHotKey(armw.MainWindow, hotkeyWeather70, currentSettings.Weather70Shortcut) + + shortcutRecorderHandler := GetShortcutRecordingHandler( + armw.RecorderShortcutEdit, + armw.RecorderShortcutRecordButton, + armw.MainWindow, + hotkeyRecoder, + currentSettings, + currentSettings.RecorderShortcut, + ) + + shortcutWeather30Handler := GetShortcutRecordingHandler( + armw.Weather30ShortcutEdit, + armw.Weather30ShortcutRecordButton, + armw.MainWindow, + hotkeyWeather30, + currentSettings, + currentSettings.Weather30Shortcut, + ) + + shortcutWeather50Handler := GetShortcutRecordingHandler( + armw.Weather50ShortcutEdit, + armw.Weather50ShortcutRecordButton, + armw.MainWindow, + hotkeyWeather50, + currentSettings, + currentSettings.Weather50Shortcut, + ) + + shortcutWeather70Handler := GetShortcutRecordingHandler( + armw.Weather70ShortcutEdit, + armw.Weather70ShortcutRecordButton, + armw.MainWindow, + hotkeyWeather70, + currentSettings, + currentSettings.Weather70Shortcut, + ) armw.RecorderShortcutRecordButton.Clicked().Attach(shortcutRecorderHandler) + armw.Weather30ShortcutRecordButton.Clicked().Attach(shortcutWeather30Handler) + armw.Weather50ShortcutRecordButton.Clicked().Attach(shortcutWeather50Handler) + armw.Weather70ShortcutRecordButton.Clicked().Attach(shortcutWeather70Handler) go func(cw *walk.CustomWidget) { t := time.NewTicker(time.Second) @@ -193,7 +207,7 @@ func main() { image.Rectangle{Min: image.Point{X: currentSettings.X, Y: currentSettings.Y}, Max: image.Point{X: currentSettings.X + 255, Y: currentSettings.Y + currentSettings.H}}, ) if errr != nil { - walk.MsgBox(armw.MainWindow, "Error capturing window area, restart of application is needed.", err.Error(), walk.MsgBoxIconWarning) + walk.MsgBox(armw.MainWindow, "Error capturing window area, restart of application is needed.", errr.Error(), walk.MsgBoxIconWarning) fmt.Printf("error lost capture window: %v", err) os.Exit(1) // exit } @@ -333,81 +347,3 @@ func paletted(img *image.NRGBA, cutoff uint32) *image.Paletted { return buffimg } - -// readConfig reads configuration from json file, or creates one if file doesn't exist -func readConfig() (*captureConfig, error) { - appDir, err := filepath.Abs(filepath.Dir(os.Args[0])) - if err != nil { - return nil, err - } - - var c *captureConfig - - load := true - settingsFilename := filepath.Join(appDir, "settings.json") - - _, err = os.Stat(settingsFilename) - if os.IsNotExist(err) { - // fetch current user folder and try to point to Gamelogs folder - usr, errr := user.Current() - if errr != nil { - return nil, errr - } - - eveGameLogsFolder := filepath.Join(usr.HomeDir, "Documents", "EVE", "logs", "Gamelogs") - - defaultShortcut := walk.Shortcut{Modifiers: walk.ModControl | walk.ModAlt, Key: walk.KeyEnd} - - c = &captureConfig{ - AppRoot: appDir, - X: 10, - Y: 10, - H: 400, - Recordings: filepath.Join(appDir, "recordings"), - FilterThreshold: 110, - FilteredPreview: false, - EVEGameLogsFolder: eveGameLogsFolder, - RecorderShortcutText: defaultShortcut.String(), - RecorderShortcut: defaultShortcut, - } - load = false - } else if err != nil { - return c, err - } - - if load { - f, err := os.Open(settingsFilename) - if err != nil { - return c, err - } - defer f.Close() - - err = json.NewDecoder(f).Decode(&c) - if err != nil { - return c, err - } - } - - return c, nil -} - -// writeConfig saves configuration to json file -func writeConfig(c *captureConfig) error { - settingsFilename := filepath.Join(c.AppRoot, "settings.json") - - f, err := os.Create(settingsFilename) - if err != nil { - return err - } - defer f.Close() - - encoder := json.NewEncoder(f) - encoder.SetIndent("", " ") - - err = encoder.Encode(c) - if err != nil { - return err - } - - return nil -} diff --git a/cmd/abyss-blackbox/recorder.go b/cmd/abyss-blackbox/recorder.go index eea1b83..2962290 100644 --- a/cmd/abyss-blackbox/recorder.go +++ b/cmd/abyss-blackbox/recorder.go @@ -37,6 +37,7 @@ type Recorder struct { notificationChannel chan NotificationMessage combatlogReader *combatlog.Reader charactersTracking map[string]combatlog.CombatLogFile + weatherStrength int } // NewRecorder constructs Recorder @@ -72,6 +73,20 @@ func (r *Recorder) ClipboardListener() { } } +// GetWeatherStrengthListener returs listener that will set weather strength when invoked. In not running state it is NOOP. +func (r *Recorder) GetWeatherStrengthListener(strength int) func() { + return func() { + if r.state != RecorderRunning { + return + } + + r.Lock() + defer r.Unlock() + r.weatherStrength = strength + r.notificationChannel <- NotificationMessage{Title: "Abyssal.Space recorder", Message: fmt.Sprintf("Weather strength set to: %d%%", strength)} + } +} + // StartLoop starts main recorded loop listening for frames and clipboard changes func (r *Recorder) StartLoop() { go func(r *Recorder) { @@ -156,6 +171,7 @@ func (r *Recorder) Start(characters []string) { r.frames = make([]*image.Paletted, 0) r.delays = make([]int, 0) r.lootRecords = make([]*encoding.LootRecord, 0) + r.weatherStrength = 0 r.state = RecorderAwaitingInitialLoot r.notificationChannel <- NotificationMessage{Title: "Recording starting...", Message: "CTRL+A, CTRL+C your inventory"} } @@ -196,10 +212,12 @@ func (r *Recorder) Stop() error { }() abyssFile := encoding.AbyssRecording{ - Overview: buf.Bytes(), - Loot: r.lootRecords, - CombatLog: r.combatlogReader.GetCombatLogRecords(r.charactersTracking), - TestServer: r.config.TestServer, + Overview: buf.Bytes(), + Loot: r.lootRecords, + CombatLog: r.combatlogReader.GetCombatLogRecords(r.charactersTracking), + TestServer: r.config.TestServer, + WeatherStrength: int32(r.weatherStrength), + LootRecordDiscriminator: r.config.LootRecordDiscriminator, } return abyssFile.Encode(file) diff --git a/cmd/abyss-blackbox/shortcuts.go b/cmd/abyss-blackbox/shortcuts.go new file mode 100644 index 0000000..0573f00 --- /dev/null +++ b/cmd/abyss-blackbox/shortcuts.go @@ -0,0 +1,37 @@ +package main + +import ( + "github.com/lxn/walk" + "github.com/lxn/win" +) + +// GetShortcutRecordingHandler creates handler for shortcut recording. +func GetShortcutRecordingHandler( + e *walk.LineEdit, + b *walk.PushButton, + m *walk.MainWindow, + id int, + settings *captureConfig, + shortcut walk.Shortcut, +) func() { + return func() { + if !e.Enabled() { // start recording + e.SetEnabled(true) + _ = e.SetFocus() + _ = b.SetText("Save") + + if !win.UnregisterHotKey(m.Handle(), id) { + walk.MsgBox(m, "Failed unregistering hotkey", "failed unregistering key, please restart application", walk.MsgBoxIconWarning) + return + } + } else { // persist new shortcut and rebind + e.SetEnabled(false) + _ = b.SetText("Record shortcut") + if !walk.RegisterGlobalHotKey(m, id, shortcut) { + walk.MsgBox(m, "Failed registering new hotkey", "failed registering new shortcut key, please restart application", walk.MsgBoxIconWarning) + return + } + _ = writeConfig(settings) + } + } +} diff --git a/cmd/extract/main.go b/cmd/extract/main.go index 069b081..ef141be 100644 --- a/cmd/extract/main.go +++ b/cmd/extract/main.go @@ -53,6 +53,8 @@ func main() { fmt.Println("Recording is from Live server (tranquility)") } + fmt.Printf("Recorded weather strength: %d%% and loot record discriminator: %q\n", abyssFile.WeatherStrength, abyssFile.LootRecordDiscriminator) + for _, logRecord := range abyssFile.CombatLog { fmt.Printf("combat log record language for character %q: %s\n", logRecord.CharacterName, logRecord.GetLanguageCode().String()) diff --git a/combatlog/combatlog.pb.go b/combatlog/combatlog.pb.go index 74060bf..206806c 100644 --- a/combatlog/combatlog.pb.go +++ b/combatlog/combatlog.pb.go @@ -1,13 +1,12 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.25.0 -// protoc v3.6.1 +// protoc-gen-go v1.26.0 +// protoc v3.17.3 // source: combatlog.proto package combatlog import ( - proto "github.com/golang/protobuf/proto" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -21,10 +20,6 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - type LanguageCode int32 const ( diff --git a/encoding/abyssfile.pb.go b/encoding/abyssfile.pb.go index 3aa1cf1..5a78029 100644 --- a/encoding/abyssfile.pb.go +++ b/encoding/abyssfile.pb.go @@ -1,13 +1,12 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.25.0 -// protoc v3.6.1 +// protoc-gen-go v1.26.0 +// protoc v3.17.3 // source: abyssfile.proto package encoding import ( - proto "github.com/golang/protobuf/proto" combatlog "github.com/shivas/abyss-blackbox/combatlog" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" @@ -22,19 +21,17 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - type AbyssRecording struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Overview []byte `protobuf:"bytes,1,opt,name=overview,proto3" json:"overview,omitempty"` - Loot []*LootRecord `protobuf:"bytes,2,rep,name=loot,proto3" json:"loot,omitempty"` - CombatLog []*combatlog.CombatLogRecord `protobuf:"bytes,3,rep,name=combat_log,json=combatLog,proto3" json:"combat_log,omitempty"` - TestServer bool `protobuf:"varint,4,opt,name=test_server,json=testServer,proto3" json:"test_server,omitempty"` + Overview []byte `protobuf:"bytes,1,opt,name=overview,proto3" json:"overview,omitempty"` + Loot []*LootRecord `protobuf:"bytes,2,rep,name=loot,proto3" json:"loot,omitempty"` + CombatLog []*combatlog.CombatLogRecord `protobuf:"bytes,3,rep,name=combat_log,json=combatLog,proto3" json:"combat_log,omitempty"` + TestServer bool `protobuf:"varint,4,opt,name=test_server,json=testServer,proto3" json:"test_server,omitempty"` + WeatherStrength int32 `protobuf:"varint,5,opt,name=weather_strength,json=weatherStrength,proto3" json:"weather_strength,omitempty"` + LootRecordDiscriminator string `protobuf:"bytes,6,opt,name=loot_record_discriminator,json=lootRecordDiscriminator,proto3" json:"loot_record_discriminator,omitempty"` } func (x *AbyssRecording) Reset() { @@ -97,6 +94,20 @@ func (x *AbyssRecording) GetTestServer() bool { return false } +func (x *AbyssRecording) GetWeatherStrength() int32 { + if x != nil { + return x.WeatherStrength + } + return 0 +} + +func (x *AbyssRecording) GetLootRecordDiscriminator() string { + if x != nil { + return x.LootRecordDiscriminator + } + return "" +} + type LootRecord struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -157,7 +168,7 @@ var File_abyssfile_proto protoreflect.FileDescriptor var file_abyssfile_proto_rawDesc = []byte{ 0x0a, 0x0f, 0x61, 0x62, 0x79, 0x73, 0x73, 0x66, 0x69, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x1a, 0x0f, 0x63, 0x6f, 0x6d, - 0x62, 0x61, 0x74, 0x6c, 0x6f, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xb2, 0x01, 0x0a, + 0x62, 0x61, 0x74, 0x6c, 0x6f, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x99, 0x02, 0x0a, 0x0e, 0x41, 0x62, 0x79, 0x73, 0x73, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x69, 0x6e, 0x67, 0x12, 0x1a, 0x0a, 0x08, 0x6f, 0x76, 0x65, 0x72, 0x76, 0x69, 0x65, 0x77, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x08, 0x6f, 0x76, 0x65, 0x72, 0x76, 0x69, 0x65, 0x77, 0x12, 0x28, 0x0a, 0x04, 0x6c, @@ -169,13 +180,20 @@ var file_abyssfile_proto_rawDesc = []byte{ 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x09, 0x63, 0x6f, 0x6d, 0x62, 0x61, 0x74, 0x4c, 0x6f, 0x67, 0x12, 0x1f, 0x0a, 0x0b, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x74, 0x65, 0x73, 0x74, 0x53, 0x65, 0x72, 0x76, 0x65, - 0x72, 0x22, 0x36, 0x0a, 0x0a, 0x4c, 0x6f, 0x6f, 0x74, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x12, - 0x14, 0x0a, 0x05, 0x66, 0x72, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, - 0x66, 0x72, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6c, 0x6f, 0x6f, 0x74, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x04, 0x6c, 0x6f, 0x6f, 0x74, 0x42, 0x2b, 0x5a, 0x29, 0x67, 0x69, 0x74, - 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x73, 0x68, 0x69, 0x76, 0x61, 0x73, 0x2f, 0x61, - 0x62, 0x79, 0x73, 0x73, 0x2d, 0x62, 0x6c, 0x61, 0x63, 0x6b, 0x62, 0x6f, 0x78, 0x2f, 0x65, 0x6e, - 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x72, 0x12, 0x29, 0x0a, 0x10, 0x77, 0x65, 0x61, 0x74, 0x68, 0x65, 0x72, 0x5f, 0x73, 0x74, 0x72, + 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0f, 0x77, 0x65, 0x61, + 0x74, 0x68, 0x65, 0x72, 0x53, 0x74, 0x72, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x3a, 0x0a, 0x19, + 0x6c, 0x6f, 0x6f, 0x74, 0x5f, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x5f, 0x64, 0x69, 0x73, 0x63, + 0x72, 0x69, 0x6d, 0x69, 0x6e, 0x61, 0x74, 0x6f, 0x72, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x17, 0x6c, 0x6f, 0x6f, 0x74, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x44, 0x69, 0x73, 0x63, 0x72, + 0x69, 0x6d, 0x69, 0x6e, 0x61, 0x74, 0x6f, 0x72, 0x22, 0x36, 0x0a, 0x0a, 0x4c, 0x6f, 0x6f, 0x74, + 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x66, 0x72, 0x61, 0x6d, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x66, 0x72, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, + 0x6c, 0x6f, 0x6f, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6c, 0x6f, 0x6f, 0x74, + 0x42, 0x2b, 0x5a, 0x29, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x73, + 0x68, 0x69, 0x76, 0x61, 0x73, 0x2f, 0x61, 0x62, 0x79, 0x73, 0x73, 0x2d, 0x62, 0x6c, 0x61, 0x63, + 0x6b, 0x62, 0x6f, 0x78, 0x2f, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/go.mod b/go.mod index f82219c..46c7a11 100644 --- a/go.mod +++ b/go.mod @@ -5,11 +5,11 @@ go 1.13 require ( github.com/disintegration/gift v1.2.1 github.com/disintegration/imaging v1.6.2 - github.com/golang/protobuf v1.4.1 + github.com/gonutz/rsrc v0.0.0-20180911104558-96f130112cb1 // indirect github.com/lxn/walk v0.0.0-20210112085537-c389da54e794 github.com/lxn/win v0.0.0-20210218163916-a377121e959e golang.org/x/sys v0.0.0-20210616094352-59db8d763f22 - google.golang.org/protobuf v1.25.0 + google.golang.org/protobuf v1.27.1 gopkg.in/Knetic/govaluate.v3 v3.0.0 // indirect ) diff --git a/go.sum b/go.sum index 9ffb447..30d663c 100644 --- a/go.sum +++ b/go.sum @@ -1,80 +1,28 @@ -cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/akavel/rsrc v0.10.2 h1:Zxm8V5eI1hW4gGaYsJQUhxpjkENuG91ki8B4zCrvEsw= +github.com/akavel/rsrc v0.10.2/go.mod h1:uLoCtb9J+EyAqh+26kdrTgmzRBFPGOolLWKpdxkKq+c= github.com/disintegration/gift v1.2.1 h1:Y005a1X4Z7Uc+0gLpSAsKhWi4qLtsdEcMIbbdvdZ6pc= github.com/disintegration/gift v1.2.1/go.mod h1:Jh2i7f7Q2BM7Ezno3PhfezbR1xpUg9dUg3/RlKGr4HI= github.com/disintegration/imaging v1.6.2 h1:w1LecBlG2Lnp8B3jk5zSuNqd7b4DXhcjwek1ei82L+c= github.com/disintegration/imaging v1.6.2/go.mod h1:44/5580QXChDfwIclfc/PCwrr44amcmDAg8hxG0Ewe4= -github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= -github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= -github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= -github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= -github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= -github.com/golang/protobuf v1.4.1 h1:ZFgWrT+bLgsYPirOnRfKLYJLvssAegOj/hgyMFdJZe0= -github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= -github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= -github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.0 h1:/QaMHBdZ26BB3SSst0Iwl10Epc+xhTquomWX0oZEB6w= -github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/gonutz/rsrc v0.0.0-20180911104558-96f130112cb1 h1:JBZIm+g0SvPFkGCPmy56YuEbiOXGHcOJpXTlW+4Pj+E= +github.com/gonutz/rsrc v0.0.0-20180911104558-96f130112cb1/go.mod h1:RlfulN6lLdBnR7EiTZBlgS0sD4Uv07qQHaxvNlVj/1A= +github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/shivas/walk v0.0.0-20210212094857-c0397ac21ff8 h1:XfZohVxBfVEqR8waXYFiLGyWwX/Z5W6BsxQx+T9lqtw= github.com/shivas/walk v0.0.0-20210212094857-c0397ac21ff8/go.mod h1:mApxRmv/+YmW2b+EFVr2Ve7hhrxDicu73W+uP7Za+VE= github.com/shivas/win v0.0.0-20210625114026-3e83f2d215c6 h1:8rO0BcQ2beWFsbGqFOsJVF4ABpQlkPGFB/cw9RXILws= github.com/shivas/win v0.0.0-20210625114026-3e83f2d215c6/go.mod h1:KxxjdtRkfNoYDCUP5ryK7XJJNTnpC8atvtmTheChOtk= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8 h1:hVwzHzIUGRjiF7EcUjqNxk3NCfkPxbDKRdnNE1Rpg0U= golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= -golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= -golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20201018230417-eeed37f84f13/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210616094352-59db8d763f22 h1:RqytpXGR1iVNX7psjB3ff8y7sNFinVFvkx1c8SjBkio= golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= -golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= -google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= -google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= -google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= -google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= -google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.25.0 h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c= -google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= +google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.27.1 h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+RurQ= +google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= gopkg.in/Knetic/govaluate.v3 v3.0.0 h1:18mUyIt4ZlRlFZAAfVetz4/rzlJs9yhN+U02F4u1AOc= gopkg.in/Knetic/govaluate.v3 v3.0.0/go.mod h1:csKLBORsPbafmSCGTEh3U7Ozmsuq8ZSIlKk1bcqph0E= -honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/internal/mainwindow/mainwindow.go b/internal/mainwindow/mainwindow.go index d150263..1d3adb6 100644 --- a/internal/mainwindow/mainwindow.go +++ b/internal/mainwindow/mainwindow.go @@ -9,8 +9,15 @@ import ( . "github.com/lxn/walk/declarative" // nolint:stylecheck,revive // we needs side effects ) +const ( + ShortcutRecorder = iota + ShortcutWeather30 + ShortcutWeather50 + ShortcutWeather70 +) + type ShortcutSetter interface { - SetRecorderShortcut(walk.Shortcut) + SetRecorderShortcut(int, walk.Shortcut) } type WindowComboBoxItem struct { @@ -19,20 +26,27 @@ type WindowComboBoxItem struct { } type AbyssRecorderWindow struct { - MainWindow *walk.MainWindow - FilteredPreview *walk.CheckBox - DataBinder *walk.DataBinder - CaptureWidget *walk.CustomWidget - HSetting *walk.NumberEdit - RecordingButton *walk.PushButton - CaptureWindowComboBox *walk.ComboBox - CombatLogCharacterGroup *walk.GroupBox - CaptureSettingsGroup *walk.GroupBox - EVEGameLogsFolderLabel *walk.TextLabel - ChooseLogDirButton *walk.PushButton - TestServer *walk.CheckBox - RecorderShortcutEdit *walk.LineEdit - RecorderShortcutRecordButton *walk.PushButton + MainWindow *walk.MainWindow + FilteredPreview *walk.CheckBox + DataBinder *walk.DataBinder + CaptureWidget *walk.CustomWidget + HSetting *walk.NumberEdit + RecordingButton *walk.PushButton + CaptureWindowComboBox *walk.ComboBox + CombatLogCharacterGroup *walk.GroupBox + CaptureSettingsGroup *walk.GroupBox + EVEGameLogsFolderLabel *walk.TextLabel + ChooseLogDirButton *walk.PushButton + TestServer *walk.CheckBox + RecorderShortcutEdit *walk.LineEdit + RecorderShortcutRecordButton *walk.PushButton + Weather30ShortcutEdit *walk.LineEdit + Weather30ShortcutRecordButton *walk.PushButton + Weather50ShortcutEdit *walk.LineEdit + Weather50ShortcutRecordButton *walk.PushButton + Weather70ShortcutEdit *walk.LineEdit + Weather70ShortcutRecordButton *walk.PushButton + LootRecordDiscriminatorEdit *walk.LineEdit } // NewAbyssRecorderWindow creates new main window of recorder. @@ -113,7 +127,7 @@ func NewAbyssRecorderWindow(config interface{}, customWidgetPaintFunc walk.Paint }, }, GroupBox{ - Title: "Server flag", + Title: "Server flag:", Layout: VBox{}, Alignment: AlignHNearVNear, Children: []Widget{ @@ -126,27 +140,27 @@ func NewAbyssRecorderWindow(config interface{}, customWidgetPaintFunc walk.Paint }, }, GroupBox{ - Title: "Combat log capture", + Title: "Loot recording settings:", Layout: VBox{}, Alignment: AlignHNearVNear, Children: []Widget{ TextLabel{ - Text: Bind("EVEGameLogsFolder"), - AssignTo: &obj.EVEGameLogsFolderLabel, + Text: "Ship loot record discriminator item: (quantity in each ship should be different)", }, - PushButton{ - Text: "Choose", - AssignTo: &obj.ChooseLogDirButton, - }, - GroupBox{ - Title: "Capture combatlog of characters:", - Layout: VBox{}, - Alignment: AlignHNearVNear, - AssignTo: &obj.CombatLogCharacterGroup, - Children: []Widget{}, - AlwaysConsumeSpace: true, - MinSize: Size{Height: 20}, + LineEdit{ + Text: Bind("LootRecordDiscriminator"), + AssignTo: &obj.LootRecordDiscriminatorEdit, + OnEditingFinished: func() { + _ = obj.DataBinder.Submit() + }, }, + }, + }, + GroupBox{ + Title: "Shortcut configuration:", + Layout: VBox{}, + Alignment: AlignHNearVNear, + Children: []Widget{ Composite{ Layout: HBox{}, Alignment: AlignHNearVNear, @@ -162,7 +176,7 @@ func NewAbyssRecorderWindow(config interface{}, customWidgetPaintFunc walk.Paint _ = obj.RecorderShortcutEdit.SetText(shortcut.String()) c, ok := config.(ShortcutSetter) if ok { - c.SetRecorderShortcut(shortcut) + c.SetRecorderShortcut(ShortcutRecorder, shortcut) } }, Enabled: false, @@ -175,6 +189,116 @@ func NewAbyssRecorderWindow(config interface{}, customWidgetPaintFunc walk.Paint }, }, }, + Composite{ + Layout: HBox{}, + Alignment: AlignHNearVNear, + Children: []Widget{ + TextLabel{ + Text: "Weather strength 30%", + }, + LineEdit{ + Text: Bind("Weather30ShortcutText"), + AssignTo: &obj.Weather30ShortcutEdit, + OnKeyPress: func(key walk.Key) { + shortcut := walk.Shortcut{Modifiers: walk.ModifiersDown(), Key: key} + _ = obj.Weather30ShortcutEdit.SetText(shortcut.String()) + c, ok := config.(ShortcutSetter) + if ok { + c.SetRecorderShortcut(ShortcutWeather30, shortcut) + } + }, + Enabled: false, + ReadOnly: true, + }, + PushButton{ + AssignTo: &obj.Weather30ShortcutRecordButton, + MinSize: Size{Height: 20}, + Text: "Record shortcut", + }, + }, + }, + Composite{ + Layout: HBox{}, + Alignment: AlignHNearVNear, + Children: []Widget{ + TextLabel{ + Text: "Weather strength 50%", + }, + LineEdit{ + Text: Bind("Weather50ShortcutText"), + AssignTo: &obj.Weather50ShortcutEdit, + OnKeyPress: func(key walk.Key) { + shortcut := walk.Shortcut{Modifiers: walk.ModifiersDown(), Key: key} + _ = obj.Weather50ShortcutEdit.SetText(shortcut.String()) + c, ok := config.(ShortcutSetter) + if ok { + c.SetRecorderShortcut(ShortcutWeather50, shortcut) + } + }, + Enabled: false, + ReadOnly: true, + }, + PushButton{ + AssignTo: &obj.Weather50ShortcutRecordButton, + MinSize: Size{Height: 20}, + Text: "Record shortcut", + }, + }, + }, + Composite{ + Layout: HBox{}, + Alignment: AlignHNearVNear, + Children: []Widget{ + TextLabel{ + Text: "Weather strength 70%", + }, + LineEdit{ + Text: Bind("Weather70ShortcutText"), + AssignTo: &obj.Weather70ShortcutEdit, + OnKeyPress: func(key walk.Key) { + shortcut := walk.Shortcut{Modifiers: walk.ModifiersDown(), Key: key} + _ = obj.Weather70ShortcutEdit.SetText(shortcut.String()) + c, ok := config.(ShortcutSetter) + if ok { + c.SetRecorderShortcut(ShortcutWeather70, shortcut) + } + }, + Enabled: false, + ReadOnly: true, + }, + PushButton{ + AssignTo: &obj.Weather70ShortcutRecordButton, + MinSize: Size{Height: 20}, + Text: "Record shortcut", + }, + }, + }, + }, + AlwaysConsumeSpace: true, + MinSize: Size{Height: 20}, + }, + GroupBox{ + Title: "Combat log capture", + Layout: VBox{}, + Alignment: AlignHNearVNear, + Children: []Widget{ + TextLabel{ + Text: Bind("EVEGameLogsFolder"), + AssignTo: &obj.EVEGameLogsFolderLabel, + }, + PushButton{ + Text: "Choose", + AssignTo: &obj.ChooseLogDirButton, + }, + GroupBox{ + Title: "Capture combatlog of characters:", + Layout: VBox{}, + Alignment: AlignHNearVNear, + AssignTo: &obj.CombatLogCharacterGroup, + Children: []Widget{}, + AlwaysConsumeSpace: true, + MinSize: Size{Height: 20}, + }, PushButton{ AssignTo: &obj.RecordingButton, MinSize: Size{Height: 40}, diff --git a/protobuf/abyssfile.proto b/protobuf/abyssfile.proto index f3bc9bb..b7db522 100644 --- a/protobuf/abyssfile.proto +++ b/protobuf/abyssfile.proto @@ -11,6 +11,8 @@ message AbyssRecording { repeated LootRecord loot = 2; repeated combatlog.CombatLogRecord combat_log = 3; bool test_server = 4; + int32 weather_strength = 5; + string loot_record_discriminator = 6; } message LootRecord { diff --git a/screen/screen.go b/screen/screen.go index 58ae78a..6807dd0 100644 --- a/screen/screen.go +++ b/screen/screen.go @@ -92,6 +92,26 @@ type winRGBQUAD struct { // FoundWindows holds map between window handle and window title type FoundWindows map[syscall.Handle]string +// EnsureUniqueNames renames windows if duplicate names found, possible if Tranquility and Singularity clients running at the same time with same character logged in. +func (fw FoundWindows) EnsureUniqueNames() FoundWindows { + z := 1 + + for i, name1 := range fw { + for j, name2 := range fw { + if i == j { + continue + } + + if name1 == name2 { + fw[j] = fmt.Sprintf("%s - %d", name2, z) + z++ + } + } + } + + return fw +} + func (fw FoundWindows) GetHandleByTitle(title string) syscall.Handle { for handle, wtitle := range fw { if wtitle == title {