From eb1cdbb72b8ab5f43cbc29064b6ddcd17cfadae6 Mon Sep 17 00:00:00 2001 From: Ben Peddell Date: Mon, 1 Aug 2016 10:43:47 +1000 Subject: [PATCH 1/5] Count players with names --- tools/arkmanager | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/tools/arkmanager b/tools/arkmanager index aede241..0f77f3a 100755 --- a/tools/arkmanager +++ b/tools/arkmanager @@ -616,7 +616,17 @@ function numPlayersConnected(){ } ord(substr($data, 4, 1)) != 0x44 and (print "-1" and exit(1)); my $players = ord(substr($data, 5, 1)); - print "$players\n"; + my $active = 0; + my $pdata = substr($data, 6); + for my $i (0 .. $players) { + my $idx = ord(substr($pdata, 0, 1)); + my ($name, $rest) = split(/\x00/, substr($pdata, 1), 2); + $pdata = substr($rest, 8); + if ($name != "") { + $active = $active + 1; + } + } + print "$active\n"; ' "$(getQueryPort)" "${ark_MultiHome:-127.0.0.1}" else perl -MSocket -e ' @@ -2114,7 +2124,17 @@ printStatus(){ } ord(substr($data, 4, 1)) != 0x44 and (print ("A2S_PLAYERS Response: : " . unpack("H*", $data)) and exit(1)); my $players = ord(substr($data, 5, 1)); - print "Active Players: $players\n"; + my $active = 0; + my $pdata = substr($data, 6); + for my $i (0 .. $players) { + my $idx = ord(substr($pdata, 0, 1)); + my ($name, $rest) = split(/\x00/, substr($pdata, 1), 2); + $pdata = substr($rest, 8); + if ($name != "") { + $active = $active + 1; + } + } + print "Active Players: $active\n"; ' "$(getQueryPort)" "${ark_MultiHome:-127.0.0.1}" if isTheServerOnline; then From ea03c35fafb74e8e6f478986841444adfd203f42 Mon Sep 17 00:00:00 2001 From: Ben Peddell Date: Tue, 2 Aug 2016 02:48:31 +1000 Subject: [PATCH 2/5] Perl string inequality is "ne" --- tools/arkmanager | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/arkmanager b/tools/arkmanager index 0f77f3a..01d7814 100755 --- a/tools/arkmanager +++ b/tools/arkmanager @@ -622,7 +622,7 @@ function numPlayersConnected(){ my $idx = ord(substr($pdata, 0, 1)); my ($name, $rest) = split(/\x00/, substr($pdata, 1), 2); $pdata = substr($rest, 8); - if ($name != "") { + if ($name ne "") { $active = $active + 1; } } @@ -2130,7 +2130,7 @@ printStatus(){ my $idx = ord(substr($pdata, 0, 1)); my ($name, $rest) = split(/\x00/, substr($pdata, 1), 2); $pdata = substr($rest, 8); - if ($name != "") { + if ($name ne "") { $active = $active + 1; } } From af44f8df85c1a565d155af66c50a71857b21bec2 Mon Sep 17 00:00:00 2001 From: Ben Peddell Date: Sun, 7 Aug 2016 08:50:48 +1000 Subject: [PATCH 3/5] Add installmods command --- tools/arkmanager | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tools/arkmanager b/tools/arkmanager index 01d7814..36577f1 100755 --- a/tools/arkmanager +++ b/tools/arkmanager @@ -1802,6 +1802,15 @@ doInstallMod(){ fi } +# +# Downloads and installs all requested mods +# +doInstallAllMods(){ + for modid in $(getModids); do + doInstallMod "$modid" + done +} + # # Removes mod from mods directory # @@ -2476,6 +2485,9 @@ main(){ installmod) doInstallMod "${args[@]}" ;; + installmods) + doInstallAllMods + ;; uninstallmod) doUninstallMod "${args[@]}" ;; From 2bc7c3e9f2d6d47dc7fdfeab68e7db4ad88aa501 Mon Sep 17 00:00:00 2001 From: Ben Peddell Date: Sun, 7 Aug 2016 09:01:46 +1000 Subject: [PATCH 4/5] Fix shift typo --- tools/arkmanager | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/arkmanager b/tools/arkmanager index 36577f1..7b709d3 100755 --- a/tools/arkmanager +++ b/tools/arkmanager @@ -1806,7 +1806,7 @@ doInstallMod(){ # Downloads and installs all requested mods # doInstallAllMods(){ - for modid in $(getModids); do + for modid in $(getModIds); do doInstallMod "$modid" done } From dfb35396c3f0da5c4ff0c4072a31e168ad7ee0a8 Mon Sep 17 00:00:00 2001 From: Ben Peddell Date: Sun, 7 Aug 2016 09:12:48 +1000 Subject: [PATCH 5/5] Add installmods command to readme --- README.asciidoc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.asciidoc b/README.asciidoc index b73fd91..3bc4e16 100644 --- a/README.asciidoc +++ b/README.asciidoc @@ -226,6 +226,10 @@ instances. `checkupdate`:: Checks if an ARK server update is available +`installmods`:: + Installs all mods specified in the instance config into the + `ShooterGame/Content/Mods` directory + `installmod `:: Installs the specified mod into the `ShooterGame/Content/Mods` directory