-
-
Notifications
You must be signed in to change notification settings - Fork 235
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #122 from valheimPlus/0.9.0
0.9.0
- Loading branch information
Showing
19 changed files
with
351 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
using HarmonyLib; | ||
using UnityEngine; | ||
using UnityEngine.UI; | ||
using ValheimPlus.UI; | ||
|
||
namespace ValheimPlus | ||
{ | ||
[HarmonyPatch(typeof(FejdStartup), "SetupGui")] | ||
class PatchUI | ||
{ | ||
static void Postfix() | ||
{ | ||
GameObject logo = GameObject.Find("LOGO"); | ||
logo.GetComponent<Image>().sprite = VPlusMainMenu.VPlusLogoSprite; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd"> | ||
<Costura> | ||
<IncludeAssemblies> | ||
INIFileParser | ||
YamlDotNet | ||
</IncludeAssemblies> | ||
</Costura> | ||
</Weavers> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Reflection; | ||
using BepInEx; | ||
using ValheimPlus.Configurations; | ||
|
||
namespace ValheimPlus.RPC | ||
{ | ||
public class VPlusConfigSync | ||
{ | ||
public static void RPC_VPlusConfigSync(long sender, ZPackage configPkg) | ||
{ | ||
if (ZNet.m_isServer) //Server | ||
{ | ||
ZPackage pkg = new ZPackage(); | ||
|
||
string[] rawConfigData = File.ReadAllLines(ConfigurationExtra.ConfigIniPath); | ||
List<string> cleanConfigData = new List<string>(); | ||
|
||
for (int i = 0; i < rawConfigData.Length; i++) | ||
{ | ||
if (rawConfigData[i].Trim().StartsWith(";") || | ||
rawConfigData[i].Trim().StartsWith("#")) continue; //Skip comments | ||
|
||
if (rawConfigData[i].Trim().IsNullOrWhiteSpace()) continue; //Skip blank lines | ||
|
||
//Add to clean data | ||
cleanConfigData.Add(rawConfigData[i]); | ||
} | ||
|
||
//Add number of clean lines to package | ||
pkg.Write(cleanConfigData.Count); | ||
|
||
//Add each line to the package | ||
foreach (string line in cleanConfigData) | ||
{ | ||
pkg.Write(line); | ||
|
||
ZLog.Log("SENTCONFIG: " + line); | ||
} | ||
|
||
ZRoutedRpc.instance.InvokeRoutedRPC(sender, "VPlusConfigSync", new object[] | ||
{ | ||
pkg | ||
}); | ||
|
||
ZLog.Log("VPlus configuration synced to peer #" + sender); | ||
} | ||
else //Client | ||
{ | ||
if (configPkg != null && | ||
configPkg.Size() > 0 && | ||
sender == ZRoutedRpc.instance.GetServerPeerID()) //Validate the message is from the server and not another client. | ||
{ | ||
int numLines = configPkg.ReadInt(); | ||
|
||
if (numLines == 0) | ||
{ | ||
ZLog.LogWarning("Got zero line config file from server. Cannot load."); | ||
return; | ||
} | ||
|
||
using (MemoryStream memStream = new MemoryStream()) | ||
{ | ||
using (StreamWriter tmpWriter = new StreamWriter(memStream)) | ||
{ | ||
for (int i = 0; i < numLines; i++) | ||
{ | ||
string line = configPkg.ReadString(); | ||
|
||
tmpWriter.WriteLine(line); | ||
|
||
ZLog.Log("CONFIGDATA: " + line); | ||
} | ||
|
||
tmpWriter.Flush(); //Flush to memStream | ||
memStream.Position = 0; //Rewind stream | ||
|
||
Configuration.Current = ConfigurationExtra.LoadFromIni(memStream); | ||
|
||
ZLog.Log("Successfully synced VPlus configuration from server."); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
|
||
} | ||
} |
Oops, something went wrong.