Skip to content

Commit

Permalink
added version updater; moved scripts to dedicated folders and added v…
Browse files Browse the repository at this point in the history
…ersion number for future updater
  • Loading branch information
chompy committed Nov 17, 2021
1 parent f4c49c5 commit 4eef581
Show file tree
Hide file tree
Showing 18 changed files with 74 additions and 69 deletions.
22 changes: 3 additions & 19 deletions FFTools_ACT_Plugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,16 @@
using Advanced_Combat_Tracker;

[assembly: AssemblyTitle("FFTools")]
[assembly: AssemblyDescription("Extends FFXIV parsing with Lua scripts that support TTS callouts, web UI, and more.")]
[assembly: AssemblyDescription("Extends FFXIV parsing with Lua scripts that support TTS callouts, web views, and more.")]
[assembly: AssemblyCompany("Chompy#3436")]
[assembly: AssemblyVersion("0.02")]
[assembly: AssemblyVersion("0.03")]

namespace ACT_Plugin
{
public class FFTools : UserControl, IActPluginV1
{

const int VERSION_NUMBER = 2;
const int VERSION_NUMBER = 3;

const UInt16 DAEMON_PORT = 31593; // Port to send to daemon on.

Expand Down Expand Up @@ -67,7 +67,6 @@ public class FFTools : UserControl, IActPluginV1
private LogLineEventArgs lastPlayerChangeLine; // Last player change log line
private string lastScriptSelected; // Name of last script selected in list
private Process scriptDaemon; // Instance of script daemon process
private FileSystemWatcher watcher; // Script config watcher

private System.Windows.Forms.ListBox formScriptList; // Form element containing list of available Lua scripts
private System.Windows.Forms.TextBox formScriptInfo; // Form element containing information about selected script
Expand Down Expand Up @@ -193,8 +192,6 @@ public void InitPlugin(TabPage pluginScreenSpace, Label pluginStatusText)
p.tpPluginSpace.Text = "FFTools";
}
}
// enable watcher
this.watchScriptConfigs();
}

public void DeInitPlugin()
Expand All @@ -221,8 +218,6 @@ public void DeInitPlugin()
if (this.scriptDaemon != null) {
this.scriptDaemon.Kill();
}
// disable watcher
this.watcher.EnableRaisingEvents = false;
// update plugin status text
lblStatus.Text = "Plugin Exited";
}
Expand Down Expand Up @@ -607,17 +602,6 @@ string getScriptConfigFile(string name)
return path;
}

void watchScriptConfigs()
{
string path = getPluginDirectory() + "\\config";
this.watcher = new FileSystemWatcher();
this.watcher.Path = path;
this.watcher.NotifyFilter = NotifyFilters.LastWrite;
this.watcher.Filter = "*.yaml";
this.watcher.Changed += new FileSystemEventHandler(this.onScriptConfigChanges);
this.watcher.EnableRaisingEvents = true;
}

void onScriptConfigChanges(object source, FileSystemEventArgs e)
{
string scriptName = Path.GetFileNameWithoutExtension(e.Name);
Expand Down
6 changes: 2 additions & 4 deletions TODO
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
- Seperate log files for each script with log rotation
- View logs from ACT plugin
- Import scripts from Git
- Script auto update
- Script repository
- ACT plugin auto update
- Move config watcher to Go daemon
- Check if ACT sends party order data in logs
- Auto update more than just daemon exe
- Reload scripts when config files are changed
- Recreate original ffliveparse features
- Overlays
4 changes: 2 additions & 2 deletions config/_app.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
###
YOU WILL NEED TO RESTART ACT FOR THE FOLLOWING
CHANGES TO TAKE EFFECT!
# YOU WILL NEED TO RESTART ACT FOR THE FOLLOWING
# CHANGES TO TAKE EFFECT!
###

# enable proxy to allow sharing of web views with other people
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ end
function info()
return {
name = "Auto End Encounter",
desc = "Tells ACT to end the encounter upon party wipe."
desc = "Tells ACT to end the encounter upon party wipe.",
version = "0.01"
}
end
3 changes: 2 additions & 1 deletion scripts/auto_markers/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ end
function info()
return {
name = "Auto Markers",
desc = "Provides event for auto marking player characters."
desc = "Enables the use of auto player markers. Used for UWU Titan Jails (and maybe more).",
version = "0.01"
}
end
24 changes: 0 additions & 24 deletions scripts/broil_count.lua

This file was deleted.

2 changes: 0 additions & 2 deletions scripts/live_parse/default.yaml

This file was deleted.

3 changes: 2 additions & 1 deletion scripts/live_parse/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ end
function info()
return {
name = "Live Parse",
desc = "Output parses to web server in real time."
desc = "Output parses to web view in real time.",
version = "0.01"
}
end
3 changes: 2 additions & 1 deletion scripts/tea_limit_cut.lua → scripts/tea_limit_cut/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ end
function info()
return {
name = "TEA Limit Cut Number",
desc = "Calls the player's limit cut number in TEA and other fights that use the same markers."
desc = "Calls the player's limit cut number in The Epic of Alexander (Ultimate) and other fights that use the same markers.",
version = "0.01"
}
end
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ end
function info()
return {
name = "TEA Third Nisi",
desc = "Calls the player's partner for third Nisi pass in TEA."
desc = "Calls the player's partner for third Nisi pass in The Epic of Alexander (Ultimate).",
version = "0.01"
}
end
3 changes: 2 additions & 1 deletion scripts/tea_trines.lua → scripts/tea_trines/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ end
function info()
return {
name = "TEA Trine Callouts",
desc = "Calls starting and ending spots for trines, using standard markers with C-1-3-4 in TEA."
desc = "Calls starting and ending spots for trines, using standard markers with C-1-3-4 in The Epic of Alexander (Ultimate).",
version = "0.01"
}
end
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ end
function info()
return {
name = "UCOB Nael Quotes",
desc = "Calls out the mechanics for the Nael quotes in UCOB."
desc = "Calls out the Nael quote mechanics in The Unending Coil of Bahamut (Ultimate).",
version = "0.01"
}
end
5 changes: 3 additions & 2 deletions scripts/uwu_jails/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ end

function info()
return {
name = "UWU Jails Callout",
desc = "Calls out your Titan jail number in The Weapon's Refrain (Ultimate). Compatible with Auto Markers."
name = "UWU Jails",
desc = "Calls out your Titan jail number in The Weapon's Refrain (Ultimate). If the 'Auto Markers' script is enabled then this will also mark the players.",
version = "0.01"
}
end
6 changes: 6 additions & 0 deletions src/daemon/act_conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const dataTypeActScriptReload = 204
const dataTypeActPlayer = 205
const dataTypeActSay = 206
const dataTypeActEnd = 207
const dataTypeActUpdated = 208

var actConn *net.UDPConn = nil
var remoteAddr *net.UDPAddr = nil
Expand Down Expand Up @@ -205,3 +206,8 @@ func actRequestPlayer() error {
logInfo("[ACT] Request primary player.")
return actRawSend([]byte{byte(dataTypeActPlayer)})
}

func actRequestUpdate() error {
logInfo("[ACT] Request version update.")
return actRawSend([]byte{byte(dataTypeActUpdated)})
}
8 changes: 4 additions & 4 deletions src/daemon/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,10 +177,10 @@ func configAppDefault() *configApp {
LogMaxSize: 262144, // 256KB
EnableProxy: true,
EnableKeyPress: true,
//ProxyAddress: "proxy.fftools.net:31595",
ProxyAddress: "localhost:31595",
//ProxyURL: "https://proxy.fftools.net/",
ProxyURL: "http://localhost:31596/",
ProxyAddress: "proxy.fftools.net:31595",
//ProxyAddress: "localhost:31595",
ProxyURL: "https://proxy.fftools.net/",
//ProxyURL: "http://localhost:31596/",
}
}

Expand Down
6 changes: 4 additions & 2 deletions src/daemon/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,18 @@ go 1.17

require (
github.com/go-vgo/robotgo v0.100.6
github.com/mouuff/go-rocket-update v1.5.2
github.com/yuin/gopher-lua v0.0.0-20210529063254-f4c35e4016d9
gopkg.in/natefinch/lumberjack.v2 v2.0.0
gopkg.in/yaml.v2 v2.4.0
)

require (
github.com/BurntSushi/toml v0.4.1 // indirect
github.com/StackExchange/wmi v1.2.1 // indirect
github.com/go-ole/go-ole v1.2.5 // indirect
github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0 // indirect
github.com/lxn/win v0.0.0-20210218163916-a377121e959e // indirect
github.com/oklog/ulid/v2 v2.0.2 // indirect
github.com/otiai10/gosseract v2.2.1+incompatible // indirect
github.com/robotn/gohook v0.31.2 // indirect
github.com/robotn/xgb v0.0.0-20190912153532-2cb92d044934 // indirect
Expand All @@ -25,5 +28,4 @@ require (
github.com/vcaesar/tt v0.20.0 // indirect
golang.org/x/image v0.0.0-20210628002857-a66eb6448b8d // indirect
golang.org/x/sys v0.0.0-20210925032602-92d5a993a665 // indirect
gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect
)
9 changes: 6 additions & 3 deletions src/daemon/go.sum
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
github.com/BurntSushi/freetype-go v0.0.0-20160129220410-b763ddbfe298/go.mod h1:D+QujdIlUNfa0igpNMk6UIvlb6C252URs4yupRUV4lQ=
github.com/BurntSushi/graphics-go v0.0.0-20160129215708-b43f31a4a966/go.mod h1:Mid70uvE93zn9wgF92A/r5ixgnvX8Lh68fxp9KQBaI0=
github.com/BurntSushi/toml v0.4.1 h1:GaI7EiDXDRfa8VshkTj7Fym7ha+y8/XxIgD2okUIjLw=
github.com/BurntSushi/toml v0.4.1/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
github.com/StackExchange/wmi v1.2.1 h1:VIkavFPXSjcnS+O8yTq7NI32k0R5Aj+v39y29VYDOSA=
github.com/StackExchange/wmi v1.2.1/go.mod h1:rcmrprowKIVzvc+NUiLncP2uuArMWLCbu9SBzvHz7e8=
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
Expand All @@ -12,16 +14,17 @@ github.com/go-ole/go-ole v1.2.5 h1:t4MGB5xEDZvXI+0rMjjsfBsD7yAgp/s9ZDkL1JndXwY=
github.com/go-ole/go-ole v1.2.5/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0=
github.com/go-vgo/robotgo v0.100.6 h1:SHq7b9ECUu1qE2if7pXcan2YWIKWOnf9A90RG72xbLU=
github.com/go-vgo/robotgo v0.100.6/go.mod h1:GCjwxRFoUkuekzm02WexYBV0paDLCbrrlKEfxt/CB10=
github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0 h1:iQTw/8FWTuc7uiaSepXwyf3o52HaUYcV+Tu66S3F5GA=
github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0/go.mod h1:1NbS8ALrpOvjt0rHPNLyCIeMtbizbir8U//inJ+zuB8=
github.com/lxn/win v0.0.0-20210218163916-a377121e959e h1:H+t6A/QJMbhCSEH5rAuRxh+CtW96g0Or0Fxa9IKr4uc=
github.com/lxn/win v0.0.0-20210218163916-a377121e959e/go.mod h1:KxxjdtRkfNoYDCUP5ryK7XJJNTnpC8atvtmTheChOtk=
github.com/oklog/ulid/v2 v2.0.2 h1:r4fFzBm+bv0wNKNh5eXTwU7i85y5x+uwkxCUTNVQqLc=
github.com/oklog/ulid/v2 v2.0.2/go.mod h1:mtBL0Qe/0HAx6/a4Z30qxVIAL1eQDweXq5lxOEiwQ68=
github.com/mouuff/go-rocket-update v1.5.2 h1:v5uz7aDdrm1v47g0qc1+8kpvarwWS0WxK97ii4Fpas4=
github.com/mouuff/go-rocket-update v1.5.2/go.mod h1:CnOyUYCxAJyC1g1mebSGC7gJysLTlX+RpxKgD1B0zLs=
github.com/otiai10/curr v0.0.0-20150429015615-9b4961190c95/go.mod h1:9qAhocn7zKJG+0mI8eUu6xqkFDYS2kb2saOteoSB3cE=
github.com/otiai10/gosseract v2.2.1+incompatible h1:Ry5ltVdpdp4LAa2bMjsSJH34XHVOV7XMi41HtzL8X2I=
github.com/otiai10/gosseract v2.2.1+incompatible/go.mod h1:XrzWItCzCpFRZ35n3YtVTgq5bLAhFIkascoRo8G32QE=
github.com/otiai10/mint v1.3.0 h1:Ady6MKVezQwHBkGzLFbrsywyp09Ah7rkmfjV3Bcr5uc=
github.com/otiai10/mint v1.3.0/go.mod h1:F5AjcsTsWUqX+Na9fpHb52P8pcRX2CI6A3ctIT91xUo=
github.com/pborman/getopt v0.0.0-20170112200414-7148bc3a4c30/go.mod h1:85jBQOZwpVEaDAr341tbn15RS4fCAsIst0qp7i8ex1o=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/robotn/gohook v0.31.2 h1:ADIppQ3T0Sd+kaDMb4Vnv6UeSmhNfK0H0HpPWCd8G5I=
Expand Down
30 changes: 30 additions & 0 deletions src/daemon/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,28 +22,58 @@ import (
"os"
"path/filepath"

"github.com/mouuff/go-rocket-update/pkg/provider"
"github.com/mouuff/go-rocket-update/pkg/updater"
"gopkg.in/natefinch/lumberjack.v2"
)

const version = "0.03"

func main() {
// set log output
log.SetOutput(&lumberjack.Logger{
Filename: filepath.Join(getBasePath(), logPath),
MaxSize: 10,
MaxBackups: 0,
})
// set auto update
u := &updater.Updater{
Provider: &provider.Github{
RepositoryURL: "github.com/chompy/fftools",
ArchiveName: "fftools.zip",
},
ExecutableName: "fftools_daemon.exe",
Version: "v" + version,
}
go func() {
s, err := u.Update()
if err != nil {
logWarn("[UPDATE] " + err.Error())
return
}
if s == updater.Updated {
actRequestUpdate()
}
}()

// enable scripts
luaEnableScripts()
// run testers if test data provided
stat, _ := os.Stdin.Stat()
if (stat.Mode() & os.ModeCharDevice) == 0 {
testLogLines := testerParse(os.Stdin)
if len(testLogLines) > 0 {
testerReplay(testLogLines)
}
}
// enable proxy
config := configAppLoad()
if config.EnableProxy {
go webProxyConnect()
}
// enable web view
go initWeb()
// listen for act packets
if err := actListenUDP(); err != nil {
logPanic(err)
}
Expand Down

0 comments on commit 4eef581

Please sign in to comment.