Skip to content

Commit

Permalink
history rewrite
Browse files Browse the repository at this point in the history
  • Loading branch information
Eternal-ll committed Dec 28, 2022
1 parent 6b23c5b commit ea497e8
Show file tree
Hide file tree
Showing 561 changed files with 24,530 additions and 9 deletions.
13 changes: 12 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@
*.userosscache
*.sln.docstates

Ethereal.FAF.UI.Client/appsettings.json
beta/appsettings.json

# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs

.Документация/
# Build results
[Dd]ebug/
[Dd]ebugPublic/
Expand All @@ -21,6 +24,7 @@
x64/
x86/
bld/
!jre/bin/
[Bb]in/
[Oo]bj/
[Ll]og/
Expand Down Expand Up @@ -333,3 +337,10 @@ ASALocalRun/

# Local History for Visual Studio
.localhistory/
/Документация
/ConsoleApp1
/ConsoleApp2
/ReplayParser
/Ethereal.FAF.UI.Client/appsettings.json
/beta/appsettings.json
/beta/appsettings.Development.json
78 changes: 78 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# Changelog

## [2.0.11](https://github.com/Eternal-ll/Ethereal-FAF-Client/releases/tag/2.0.11) (2022-10-31)

**Changelog**

- Added client updater
- Added safe handler in patcher for busy files
- Added game logs on 'C:\ProgramData\FAForever\logs\game_{uid}.log'
- Fixed background when hosting
- Moved fonts to separate DLL (ligher updates)

## [2.0.10](https://github.com/Eternal-ll/Ethereal-FAF-Client/releases/tag/2.0.10) (2022-10-23)

**Changelog**

- Fix game patcher
- Fix custom map downloading on game launch
- Fix idle games list not updating on game launch
- Fix oauth logo
- Host page background now transparent
- Added clean patch initialization (no more dependant on exist patch folder, but still using auto-game detect method)
- Added game filters: OnlyGeneratedMaps / HidePrivateLobbies / EnableMapsBlacklist
- Added players ratinsg to idle/live custom/coop games
- Carefully closing ice adapter
- Host page moved into navigation frame
- Code cleanup


**FAQ**

How to hide specific map?

- Right click on game card
- Click on "Ban map"

## [2.0.9](https://github.com/Eternal-ll/Ethereal-FAF-Client/releases/tag/2.0.9) (2022-10-22)

#### Changelog

- Full support of IRC chat
- Open private DM with player
- Filter channel users
- Support emoji syntax `:emoji:` on chat input
- Remember last user channels for next IRC session
- Parallel initilization of patch watcher (faster launch)
- Updated ICE to 3.2.2


#### FAQ

**How to join channel/s?**

- Use chat input **/join #channel1, #channel2, ..., <#channel>**
- Use channel/user input <#channel> and press Enter

**How to leave channel/s?**

- Use chat input **/part #channel1, #channel2, ..., <#channel>**
- Use leave button, hover on required channel in the sidebar list and press "Leave" button

**RAW IRC commands**

- Use slash '/'

Example:
- UI: /join #channel
- IRC: JOIN #channel

**Emoji Sample:**
1. Write `:tada:`
2. Converted to 🎉

**How to copy message?**

1. Right click on message
2. Click on "Copy text"
3. Done!
521 changes: 514 additions & 7 deletions Ethereal-FAF-Client.sln

Large diffs are not rendered by default.

13 changes: 13 additions & 0 deletions Ethereal.FA.Mod/Ethereal.FA.Mod.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>disable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="NLua" Version="1.6.0" />
</ItemGroup>

</Project>
115 changes: 115 additions & 0 deletions Ethereal.FA.Mod/ModScenario.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
using NLua;

namespace Ethereal.FA.Mod
{
/// <summary>
///
/// </summary>
public class ModScenario
{
/// <summary>
///
/// </summary>
/// <param name="scenarioFile"></param>
/// <returns></returns>
public static ModScenario FromFile(string scenarioFile)
{
if (!File.Exists(scenarioFile)) return null;
var lua = new Lua();
lua.DoString(scenarioFile);
var scenario = new ModScenario();

if (lua["name"] is string name) scenario.Name = name;
if (lua["uid"] is string uid) scenario.Uid = uid;
if (lua["description"] is string description) scenario.Description = description;
if (lua["copyright"] is string copyright) scenario.Copyright = copyright;
if (lua["author"] is string author) scenario.Author = author;
if (lua["url"] is string url) scenario.Url = url;
if (lua["icon"] is string icon) scenario.Icon = icon;
if (lua["version"] is string version) scenario.Version = version;
if (lua["exclusive"] is bool exclusive) scenario.IsExclusive = exclusive;
if (lua["ui_only"] is bool ui_only) scenario.IsUI = ui_only;
if (lua[""] is LuaTable table) scenario.Requires = GetList(table);
if (lua[""] is LuaTable table2) scenario.Conflicts = GetList(table2);
if (lua[""] is LuaTable table3) scenario.Before = GetList(table3);
if (lua[""] is LuaTable table4) scenario.After = GetList(table4);

return scenario;
}

private static string[] GetList(LuaTable table)
{
var data = new string[table.Keys.Count];
for (int i = 1; i <= table.Keys.Count; i++)
{
data[i - 1] = (string)table[1];
}
return data;
}

/// <summary>
/// mod name
/// </summary>
public string Name { get; set; }
/// <summary>
/// an ID every mod needs, you can generate a random one
/// </summary>
public string Uid { get; set; }
/// <summary>
/// use a versioning pattern of your choice, the current FAF mod vault will only display a single integer though
/// </summary>
public string Version { get; set; }
/// <summary>
/// mention how you want copying to be treated
/// </summary>
public string Copyright { get; set; }
/// <summary>
/// mod description
/// </summary>
public string Description { get; set; }
/// <summary>
/// Author name
/// </summary>
public string Author { get; set; }
/// <summary>
/// if you have one, for example a forum thread that you could be making to show us your mod
/// </summary>
public string Url { get; set; }
/// <summary>
/// Preview logo
/// </summary>
public string Icon { get; set; }
/// <summary>
/// true|false : whether the mod should be selectable in the ingame lobby
/// </summary>
public bool IsSelectable { get; set; }
/// <summary>
/// true|false
/// </summary>
public bool IsEnabled { get; set; }
/// <summary>
/// true|false:
/// </summary>
public bool IsExclusive { get; set; }
/// <summary>
/// true|false: whether all players need to mod for the game to run.SIM mods are needed by everyone, UI mods not
/// </summary>
public bool IsUI { get; set; }
/// <summary>
/// table of requirements for your mod(for example "common mod tools"), enter the UIDs here
/// </summary>
public string[] Requires { get; set; }
/// <summary>
/// table of conflicts, this way the lobby will warn the player that they don't work together
/// </summary>
public string[] Conflicts { get; set; }
/// <summary>
/// mods that will have to be hooked in before your mod is hooked
/// </summary>
public string[] Before { get; set; }
/// <summary>
/// mods that have to be hooked in after your mod
/// </summary>
public string[] After { get; set; }
}
}
17 changes: 17 additions & 0 deletions Ethereal.FA.Scmap/DDSImage.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
namespace Ethereal.FA.Vault
{
public static class DDSImage
{
public static unsafe void ConvertToPng(byte[] data, string targetFile)
{
using var ms = new MemoryStream(data);
using var image = Pfim.Pfimage.FromStream(ms);

fixed (byte* ptr = image.Data)
{
using var bitmap = new System.Drawing.Bitmap(image.Width, image.Height, image.Stride, System.Drawing.Imaging.PixelFormat.Format32bppArgb, (IntPtr)ptr);
bitmap.Save(targetFile, System.Drawing.Imaging.ImageFormat.Png);
}
}
}
}
17 changes: 17 additions & 0 deletions Ethereal.FA.Scmap/Ethereal.FA.Vault.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>disable</Nullable>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="NLua" Version="1.6.0" />
<PackageReference Include="Pfim" Version="0.11.1" />
<PackageReference Include="System.Drawing.Common" Version="5.0.2" />
</ItemGroup>


</Project>
105 changes: 105 additions & 0 deletions Ethereal.FA.Scmap/MapScenario.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
using NLua;
using System.Text.RegularExpressions;

namespace Ethereal.FA.Vault
{
public static class FAUtils
{
public static double KmFromPixels(double pixels) => pixels switch
{
2096 => 80,
2048 => 40,
1024 => 20,
512 => 10,
256 => 5,
_ => pixels
};
}
public class MapScenario
{
public string Name { get; set; }
public string Description { get; set; }
public string Preview { get; set; }
public int MapVersion { get; set; }
public bool IsAdaptiveMap { get; set; }
public string Type { get; set; }
public double Width { get; set; }
public double Height { get; set; }

public double WidthInKm => FAUtils.KmFromPixels(Width);
public double HeigthInKm => FAUtils.KmFromPixels(Height);

public string PathToMap { get; set; }
public string PathToSave { get; set; }
public string PathToScript { get; set; }

public double NoRushRadius { get; set; }

public bool Starts { get; set; }

public List<string> Armies { get; set; }

/// <summary>
///
/// </summary>
/// <param name="scenario"></param>
/// <returns></returns>
public static MapScenario FromFile(string file)
{
if (!File.Exists(file)) return null;
var scenario = new MapScenario();
var test = File.ReadAllText(file);
var regex = new Regex(@"STRING\( (.*) \)");
var match = regex.Match(test);
test = regex.Replace(test, match.Groups[^1].Value);
using Lua lua = new Lua();
lua.DoString(test);
if (lua["ScenarioInfo.name"] is string name) scenario.Name = name;
if (lua["ScenarioInfo.description"] is string description)
{

scenario.Description = description;
}
if (lua["ScenarioInfo.preview"] is string preview) scenario.Preview = preview;
if (lua["ScenarioInfo.map_version"] is double version) scenario.MapVersion = (int)version;
if (lua["ScenarioInfo.AdaptiveMap"] is bool adaptive) scenario.IsAdaptiveMap = adaptive;
if (lua["ScenarioInfo.type"] is string type) scenario.Type = type;
if (lua["ScenarioInfo.size"] is LuaTable sizes && sizes.Keys.Count == 2 && sizes[1] is long width && sizes[2] is long height)
{
scenario.Width = width;
scenario.Height = height;
}
if (lua["ScenarioInfo.starts"] is bool starts) scenario.Starts = starts;
if (lua["ScenarioInfo.map"] is string map) scenario.PathToMap = map;
if (lua["ScenarioInfo.save"] is string save) scenario.PathToSave = save;
if (lua["ScenarioInfo.script"] is string script) scenario.PathToScript = script;
if (lua["ScenarioInfo.norushradius"] is double norush) scenario.NoRushRadius = norush;
if (lua["ScenarioInfo.Configurations"] is LuaTable configurations)
{
foreach (KeyValuePair<object, object> item in configurations)
{
if (item.Value is LuaTable config)
{
if (config["teams"] is LuaTable teams)
{
if (teams[1] is LuaTable data)
{
if (data["armies"] is LuaTable armiesTable)
{
var armies = new List<string>();
foreach (var army in armiesTable.Values)
{
armies.Add((string)army);
}
scenario.Armies = armies;
}
}
}
}
}
}
lua.Dispose();
return scenario;
}
}
}
Loading

0 comments on commit ea497e8

Please sign in to comment.