snapshot updates

This commit is contained in:
Bitl 2022-09-19 15:21:50 -07:00
parent 8722ec2309
commit 34d19ba432
9 changed files with 191 additions and 48 deletions

View File

@ -21,6 +21,8 @@ public class GlobalPaths
public static readonly string DataDir = BinDir + @"\\data";
public static readonly string ClientDir = BasePath + @"\\clients";
public static readonly string MapsDir = BasePath + @"\\maps";
public static readonly string AddonDir = BasePath + @"\\addons";
public static readonly string AddonCoreDir = AddonDir + @"\\core";
public static readonly string MapsDirCustom = MapsDir + @"\\Custom";
public static readonly string MapsDirBase = "maps";
public static readonly string BaseGameDir = "rbxasset://../../../";
@ -109,6 +111,7 @@ public class GlobalPaths
public static readonly string ServerInfoFileName = "serverinfo.txt";
public static readonly string ConsoleHelpFileName = "consolehelp.txt";
public static readonly string ClientScriptDocumentationFileName = "documentation.txt";
public static readonly string AddonLoaderFileName = "AddonLoader.lua";
#endregion
}
#endregion

View File

@ -10,6 +10,7 @@
#region Usings
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Windows.Forms;
#endregion

View File

@ -330,6 +330,8 @@ public static class Util
File.Copy(src, dest, overwrite);
File.SetAttributes(dest, FileAttributes.Normal);
return;
}
public static void FixedFileDelete(string src)

View File

@ -1,6 +1,7 @@
#region Usings
using Ionic.Zip;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
@ -17,7 +18,14 @@ public class ModManager
ModCreation
}
public enum ModType
{
ModPackage,
AddonScript
}
private ModMode globalMode;
private ModType globalType;
private OpenFileDialog openFileDialog1;
private SaveFileDialog saveFileDialog1;
private string installOutcome = "";
@ -49,8 +57,8 @@ public class ModManager
default:
openFileDialog1 = new OpenFileDialog()
{
FileName = "Select a mod .zip file",
Filter = "Compressed zip files (*.zip)|*.zip",
FileName = "Select a mod .zip or addon *.lua file",
Filter = "Compressed zip files (*.zip)|*.zip|LUA Script (*.lua)|*.lua",
Title = "Open mod .zip"
};
break;
@ -79,10 +87,14 @@ public class ModManager
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
MessageBox.Show("Your mod is loading. You will recieve a notification when it is installed. Please keep the launcher open. You can see the installation progress in the Console.", "Novetus - Mod Loading");
try
{
globalType = (ModType)(openFileDialog1.FilterIndex - 1);
if (globalType == ModType.ModPackage)
{
MessageBox.Show("Your mod is loading. You will recieve a notification when it is installed. Please keep the launcher open. You can see the installation progress in the Console.", "Novetus - Mod Loading");
int filecount = 0;
StringBuilder filelistbuilder = new StringBuilder();
StringBuilder filelistcutdown = new StringBuilder();
@ -127,6 +139,43 @@ public class ModManager
installOutcome = "Mod " + openFileDialog1.SafeFileName + " installed! " + filecount + " files copied!" + Environment.NewLine + "Files added/modified:" + Environment.NewLine + Environment.NewLine + filelist;
}
}
else if (globalType == ModType.AddonScript)
{
try
{
Util.FixedFileCopy(openFileDialog1.FileName, GlobalPaths.AddonDir + @"\" + openFileDialog1.SafeFileName, false);
string AddonPath = GlobalPaths.AddonCoreDir + "\\" + GlobalPaths.AddonLoaderFileName;
var lines = File.ReadLines(AddonPath);
List<string> FileLines = lines.ToList();
for (var i = 0; i < FileLines.Count; i++)
{
if (FileLines[i].Contains("Addons"))
{
if (FileLines[i].Contains(Path.GetFileNameWithoutExtension(openFileDialog1.SafeFileName)))
{
installOutcome = "Error: Script has already been added.";
break;
}
string[] list = FileLines[i].Replace("Addons", "").Replace("=", "").Replace("{", "").Replace("}", "").Replace(" ", "").Split(',');
List<string> Addons = list.ToList();
Addons.Add("\"" + Path.GetFileNameWithoutExtension(openFileDialog1.SafeFileName) + "\"");
string newline = "Addons = {" + string.Join(", ", Addons) + "}";
FileLines[i] = newline;
File.WriteAllLines(AddonPath, FileLines.ToArray());
installOutcome = "Addon Script " + openFileDialog1.SafeFileName + " installed!";
break;
}
}
}
catch (Exception ex)
{
Util.LogExceptions(ex);
installOutcome = "Error: Script has already been added.";
}
}
}
catch (Exception ex)
{
Util.LogExceptions(ex);

View File

@ -63,8 +63,6 @@ namespace NovetusLauncher
private ToolTip contextToolTip;
#endregion
#region Form Event Functions
public void InitForm()
{
@ -433,7 +431,7 @@ namespace NovetusLauncher
Parent.Visible = true;
}
if (GlobalVars.isConsoleOnly && !GlobalVars.isConsoleOnly)
if (GlobalVars.isConsoleOnly)
{
CloseEventInternal();
}

View File

@ -777,14 +777,14 @@
<Rectangle x:Name="mapsGroupBox" Fill="#FFDEDCDC" HorizontalAlignment="Left" Height="207" Margin="73,10,0,0" Stroke="Black" VerticalAlignment="Top" Width="509" Grid.Column="1" Grid.ColumnSpan="2"/>
<Rectangle x:Name="mapsLabelBox" Fill="#FFAAA8A8" HorizontalAlignment="Left" Height="30" Margin="73,10,0,0" Stroke="Black" VerticalAlignment="Top" Width="509" Grid.Column="1" Grid.ColumnSpan="2"/>
<Label x:Name="mapsLabel" Content="Places" HorizontalAlignment="Left" Margin="166,9,0,0" VerticalAlignment="Top" FontSize="15" Width="52" Grid.Column="2"/>
<TextBox x:Name="mapsDescBox" Grid.Column="2" HorizontalAlignment="Left" Height="147" Margin="298,64,0,0" TextWrapping="Wrap" FontFamily="Comic Sans MS" FontSize="12" VerticalAlignment="Top" Width="139" IsReadOnly="True" HorizontalContentAlignment="Left" VerticalContentAlignment="Top"/>
<TextBox x:Name="mapsDescBox" Grid.Column="2" HorizontalAlignment="Left" Height="168" Margin="298,43,0,0" TextWrapping="Wrap" FontFamily="Comic Sans MS" FontSize="12" VerticalAlignment="Top" Width="139" IsReadOnly="True" HorizontalContentAlignment="Left" VerticalContentAlignment="Top"/>
<WindowsFormsHost x:Name="formHost" Margin="82,64,154,48" Grid.Column="1" FontFamily="Comic Sans MS" FontSize="9" Background="#FFEDEDED" Grid.ColumnSpan="2">
<wf:TreeView x:Name="mapsBox" AfterSelect="mapsBox_AfterSelect" BeforeSelect="mapsBox_BeforeSelect"/>
</WindowsFormsHost>
<TextBox x:Name="searchBox" Grid.Column="1" HorizontalAlignment="Left" Height="20" Margin="82,43,0,0" Text="" VerticalAlignment="Top" Width="346" HorizontalContentAlignment="Left" VerticalContentAlignment="Top" Grid.ColumnSpan="2"/>
<Button x:Name="searchButton" Style="{DynamicResource SearchButton}" Content="" Grid.Column="2" HorizontalAlignment="Left" Margin="310,44,0,0" VerticalAlignment="Top" Width="24" Height="17" Click="searchButton_Click"/>
<Button x:Name="refreshButton" Style="{DynamicResource RefreshButton}" Content="" Grid.Column="2" HorizontalAlignment="Left" Margin="334,44,0,0" VerticalAlignment="Top" Width="26" Height="17" Click="refreshButton_Click"/>
<Button x:Name="addMapButton" Content="Add Place" Grid.Column="2" HorizontalAlignment="Left" Margin="365,45,0,0" VerticalAlignment="Top" Width="72" Click="addMapButton_Click"/>
<TextBox x:Name="searchBox" Grid.Column="1" HorizontalAlignment="Left" Height="20" Margin="82,43,0,0" Text="" VerticalAlignment="Top" Width="204" HorizontalContentAlignment="Left" VerticalContentAlignment="Top" Grid.ColumnSpan="2"/>
<Button x:Name="searchButton" Style="{DynamicResource SearchButton}" Content="" Grid.Column="2" HorizontalAlignment="Left" Margin="166,46,0,0" VerticalAlignment="Top" Width="24" Height="17" Click="searchButton_Click"/>
<Button x:Name="refreshButton" Style="{DynamicResource RefreshButton}" Content="" Grid.Column="2" HorizontalAlignment="Left" Margin="190,46,0,0" VerticalAlignment="Top" Width="26" Height="17" Click="refreshButton_Click"/>
<Button x:Name="addMapButton" Content="Add Place" Grid.Column="2" HorizontalAlignment="Left" Margin="221,47,0,0" VerticalAlignment="Top" Width="72" Click="addMapButton_Click"/>
<Button x:Name="customizeButton" Style="{DynamicResource ImportantButton}" Content="Customize Player" HorizontalAlignment="Left" Margin="0,10,0,0" VerticalAlignment="Top" Width="169" Click="customizeButton_Click" Height="32" Grid.ColumnSpan="2"/>
<Button x:Name="ServerButton" Style="{DynamicResource HostButton}" Content="" HorizontalAlignment="Left" Margin="156,223,0,0" VerticalAlignment="Top" Width="92" Height="32" RenderTransformOrigin="1.3,0.863" Click="ServerOptionsButton_Click" Grid.Column="2"/>
</Grid>
@ -822,12 +822,11 @@
<ColumnDefinition Width="409*"/>
</Grid.ColumnDefinitions>
<Rectangle Fill="#FFDEDCDC" HorizontalAlignment="Left" Height="245" Margin="0,10,0,0" Stroke="Black" VerticalAlignment="Top" Width="683" Grid.ColumnSpan="3"/>
<ListBox x:Name="clientListBox" HorizontalAlignment="Left" Height="102" Margin="10,19,0,0" VerticalAlignment="Top" Width="663" Grid.ColumnSpan="3" HorizontalContentAlignment="Left" VerticalContentAlignment="Top" SelectionChanged="clientListBox_SelectionChanged">
<ListBox x:Name="clientListBox" HorizontalAlignment="Left" Height="228" Margin="10,19,0,0" VerticalAlignment="Top" Width="327" Grid.ColumnSpan="3" HorizontalContentAlignment="Left" VerticalContentAlignment="Top" SelectionChanged="clientListBox_SelectionChanged" ScrollViewer.HorizontalScrollBarVisibility="Hidden">
<ListBox.ItemTemplate>
<DataTemplate>
<Grid Margin="0,2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="300" />
</Grid.ColumnDefinitions>
<TextBlock Text="{Binding ClientName}" />
@ -835,14 +834,14 @@
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<TextBox x:Name="clientWarningBox" HorizontalAlignment="Left" Height="47" Margin="10,126,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="663" Grid.ColumnSpan="3" IsReadOnly="True" Foreground="Red" FontWeight="Bold" Text="CLIENT WARNING" FontSize="10"/>
<TextBox x:Name="clientDescBox" HorizontalAlignment="Left" Height="65" Margin="10,178,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="663" Grid.ColumnSpan="3" IsReadOnly="True" HorizontalContentAlignment="Left" VerticalContentAlignment="Top" FontFamily="Comic Sans MS"/>
<TextBox x:Name="clientWarningBox" HorizontalAlignment="Left" Height="103" Margin="68,19,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="331" IsReadOnly="True" Foreground="Red" FontWeight="Bold" Text="CLIENT WARNING" FontSize="10" Grid.Column="2"/>
<TextBox x:Name="clientDescBox" HorizontalAlignment="Left" Height="120" Margin="68,127,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="331" IsReadOnly="True" HorizontalContentAlignment="Left" VerticalContentAlignment="Top" FontFamily="Comic Sans MS" Grid.Column="2"/>
</Grid>
</TabItem>
<TabItem x:Name="changesTab" Header="CHANGES" Style="{DynamicResource TabItemStyleSeperatorsInbetween}" BorderBrush="{x:Null}" Background="#FFEDEDED" Foreground="White" IsSelected="True">
<Grid Background="#FFEDEDED">
<Rectangle x:Name="changelogGroupBox" Fill="#FFDEDCDC" HorizontalAlignment="Left" Height="245" Margin="0,10,0,0" Stroke="Black" VerticalAlignment="Top" Width="683"/>
<TextBox x:Name="changelogBox" HorizontalAlignment="Left" Height="224" Margin="10,19,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="663" HorizontalContentAlignment="Left" VerticalContentAlignment="Top" IsReadOnly="True" FontFamily="Comic Sans MS"/>
<TextBox x:Name="changelogBox" HorizontalAlignment="Left" Height="228" Margin="10,19,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="663" HorizontalContentAlignment="Left" VerticalContentAlignment="Top" IsReadOnly="True" FontFamily="Comic Sans MS"/>
</Grid>
</TabItem>
<TabItem x:Name="optionsTab" Header="OPTIONS" Style="{DynamicResource TabItemStyleNoSeperators}" BorderBrush="{x:Null}" Background="#FFEDEDED" Foreground="White" IsSelected="True">

View File

@ -1,3 +1,11 @@
1.3 Snapshot v22.8297.27455.1
Enhancements:
- Added the ability to install Addon Scripts with the "Install Mod Package" feature.
- Changed the look of the Versions tab in Stylish.
Fixes:
- Fixed the Novetus Console not exiting when the client is closed.
----------------------------------------------------------------------------
1.3 Snapshot v22.8297.22678.1
Enhancements:
- Added most NovetusCMD server command line parameters to the Novetus Console.

83
old/query.php Normal file
View File

@ -0,0 +1,83 @@
<?php
/*
This file is part of Novetus, but unlike the rest of the program where it is under the MIT license,
this file is under the GPL 3.0 license.
Novetus's query.php is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Novetus's query.php is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Novetus's query.php. If not, see <https://www.gnu.org/licenses/>.
*/
//NOVETUS MASTER SERVER QUERY CODE
//thanks to idkwhatnametoget for the port fix
//name
$name = $_GET["name"];
//port
$port = $_GET["port"];
//client
$client = $_GET["client"];
//version
$version = $_GET["version"];
if (!empty($port) and $port < 65535 and is_numeric($port) and !empty($name) and !empty($client) and !empty($version))
{
//server ip
$ip = $_GET["ip"];
//online status
$online = $_GET["online"];
//strings
$deleteentry = 1;
$status = "Offline";
$file = 'serverlist.txt';
//ONLY the $name and $client arguments will show up in the master server!
$text = base64_encode(base64_encode($name).'|'.base64_encode($ip).'|'.base64_encode($port).'|'.base64_encode($client).'|'.base64_encode($version))."\r\n";
if ($online == 1)
{
$deleteentry = 0;
foreach(file($file) as $line)
{
if (strpos($line, $text) !== false)
{
$file_contents = file_get_contents($file);
$contents = str_replace($line, '', $file_contents);
file_put_contents($file, $contents);
}
}
file_put_contents($file, $text, FILE_APPEND);
$status = "Online";
}
if ($deleteentry == 1)
{
foreach(file($file) as $line)
{
if (strpos($line, $text) !== false)
{
$file_contents = file_get_contents($file);
$contents = str_replace($line, '', $file_contents);
file_put_contents($file, $contents);
}
}
}
// Display the server info to browsers.
echo "" . htmlspecialchars($name) . ". A " . htmlspecialchars($client) . " server running on ". htmlspecialchars($version) .". Server Status: " . htmlspecialchars($status) . "";
}
?>