Skip to content

Commit

Permalink
2.5.3: permit optional specification of player when setting PvP setti…
Browse files Browse the repository at this point in the history
…ngs to provide flexibility
  • Loading branch information
jpw1991 committed Jan 15, 2024
1 parent 7a18da6 commit b093a8a
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 26 deletions.
2 changes: 1 addition & 1 deletion ChebsValheimLibrary/Base.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace ChebsValheimLibrary
{
public class Base
{
public static readonly System.Version CurrentVersion = new("2.5.2");
public static readonly System.Version CurrentVersion = new("2.5.3");

public static bool VersionCheck(System.Version version, out string message)
{
Expand Down
2 changes: 1 addition & 1 deletion ChebsValheimLibrary/ChebsValheimLibrary.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<PropertyGroup>
<Title>ChebsValheimLibrary</Title>
<Description>A library which contains shared classes and things required by all my mods.</Description>
<Version>2.5.2</Version>
<Version>2.5.3</Version>
<ReleaseNotes>Initial</ReleaseNotes>
<Authors>Joshua Paul Woods</Authors>
<Owners>Joshua Paul Woods</Owners>
Expand Down
4 changes: 2 additions & 2 deletions ChebsValheimLibrary/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.5.2.0")]
[assembly: AssemblyFileVersion("2.5.2.0")]
[assembly: AssemblyVersion("2.5.3.0")]
[assembly: AssemblyFileVersion("2.5.3.0")]
12 changes: 7 additions & 5 deletions ChebsValheimLibrary/PvP/PvPManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -207,19 +207,21 @@ private static Dictionary<string, List<string>> ReadAllyFile()
/// </example>
/// </summary>
/// <param name="list"></param>
public static void UpdatePlayerFriendsDict(List<string> list)
/// <param name="player"></param>
public static void UpdatePlayerFriendsDict(List<string> list, Player player = null)
{
UpdatePlayerFriendsDict(string.Join(",", list.Select(s => s.Trim())));
UpdatePlayerFriendsDict(string.Join(",", list.Select(s => s.Trim())), player);
}

private static void UpdatePlayerFriendsDict(string list)
private static void UpdatePlayerFriendsDict(string list, Player player = null)
{
if (Player.m_localPlayer == null)
if (player == null) player = Player.m_localPlayer;
if (player == null)
{
Logger.LogWarning($"UpdatePlayerFriendsDict m_localPlayer is null");
return;
}
var content = $"{UpdateDictString};{Player.m_localPlayer.GetPlayerName()};{list}";
var content = $"{UpdateDictString};{player.GetPlayerName()};{list}";
var package = new ZPackage(Encoding.UTF8.GetBytes(content));
_pvPrpc.SendPackage(ZRoutedRpc.instance.GetServerPeerID(), package);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -281,13 +281,13 @@ <h5 class="decalaration">Declaration</h5>
</div>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/jpw1991/chebs-valheim-library/new/master/apiSpec/new?filename=ChebsValheimLibrary_PvP_PvPManager_UpdatePlayerFriendsDict_System_Collections_Generic_List_System_String__.md&amp;value=---%0Auid%3A%20ChebsValheimLibrary.PvP.PvPManager.UpdatePlayerFriendsDict(System.Collections.Generic.List%7BSystem.String%7D)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
<a href="https://github.com/jpw1991/chebs-valheim-library/new/master/apiSpec/new?filename=ChebsValheimLibrary_PvP_PvPManager_UpdatePlayerFriendsDict_System_Collections_Generic_List_System_String__Player_.md&amp;value=---%0Auid%3A%20ChebsValheimLibrary.PvP.PvPManager.UpdatePlayerFriendsDict(System.Collections.Generic.List%7BSystem.String%7D%2CPlayer)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/jpw1991/chebs-valheim-library/blob/master/ChebsValheimLibrary/PvP/PvPManager.cs/#L210">View Source</a>
<a href="https://github.com/jpw1991/chebs-valheim-library/blob/master/ChebsValheimLibrary/PvP/PvPManager.cs/#L211">View Source</a>
</span>
<a id="ChebsValheimLibrary_PvP_PvPManager_UpdatePlayerFriendsDict_" data-uid="ChebsValheimLibrary.PvP.PvPManager.UpdatePlayerFriendsDict*"></a>
<h4 id="ChebsValheimLibrary_PvP_PvPManager_UpdatePlayerFriendsDict_System_Collections_Generic_List_System_String__" data-uid="ChebsValheimLibrary.PvP.PvPManager.UpdatePlayerFriendsDict(System.Collections.Generic.List{System.String})">UpdatePlayerFriendsDict(List&lt;String&gt;)</h4>
<h4 id="ChebsValheimLibrary_PvP_PvPManager_UpdatePlayerFriendsDict_System_Collections_Generic_List_System_String__Player_" data-uid="ChebsValheimLibrary.PvP.PvPManager.UpdatePlayerFriendsDict(System.Collections.Generic.List{System.String},Player)">UpdatePlayerFriendsDict(List&lt;String&gt;, Player)</h4>
<div class="markdown level1 summary"><p>Update the server&apos;s dictionary of PvP friends for the local player.
<example>
Snippet taken from Cheb&apos;s Mercenaries command for adding a friend via console.<p>
Expand All @@ -306,7 +306,7 @@ <h4 id="ChebsValheimLibrary_PvP_PvPManager_UpdatePlayerFriendsDict_System_Collec
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static void UpdatePlayerFriendsDict(List&lt;string&gt; list)</code></pre>
<pre><code class="lang-csharp hljs">public static void UpdatePlayerFriendsDict(List&lt;string&gt; list, Player player = null)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-striped table-condensed">
Expand All @@ -323,6 +323,11 @@ <h5 class="parameters">Parameters</h5>
<td><span class="parametername">list</span></td>
<td></td>
</tr>
<tr>
<td><span class="xref">Player</span></td>
<td><span class="parametername">player</span></td>
<td></td>
</tr>
</tbody>
</table>
</article>
Expand Down
4 changes: 4 additions & 0 deletions ChebsValheimLibrary/_site/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ <h2 id="features">Features</h2>
<li>Mining</li>
</ul>
</li>
<li>PvP<ul>
<li>Via the PvP manager, friends/allies are remembered server-side and sent to clients when needed.</li>
</ul>
</li>
</ul>
<h2 id="requirements">Requirements</h2>
<ul>
Expand Down
8 changes: 4 additions & 4 deletions ChebsValheimLibrary/_site/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,10 @@
"output": {
".html": {
"relative_path": "index.html",
"hash": "PPcR6/9PdZ9Y6/KKoJ+rCgevmT8a+BDoU9hCCdwRWKE="
"hash": "iYxzXd5QMcAbm8DiaE1nkQV6vTRk4G8mLGNtzXpFbYw="
}
},
"is_incremental": true,
"is_incremental": false,
"version": ""
},
{
Expand Down Expand Up @@ -1188,7 +1188,7 @@
"output": {
".html": {
"relative_path": "api/ChebsValheimLibrary.PvP.PvPManager.html",
"hash": "Mvx+qN6gjYesNvmkPDSGeyGDrfNMNoCFY8YdcWnjcnQ="
"hash": "c+EqehOr2tpIonZGzlTVziGevVQsMEPjJeI1q3LhXnA="
}
},
"is_incremental": false,
Expand Down Expand Up @@ -1280,7 +1280,7 @@
"can_incremental": true,
"incrementalPhase": "build",
"total_file_count": 5,
"skipped_file_count": 5
"skipped_file_count": 4
},
"ManagedReferenceDocumentProcessor": {
"can_incremental": true,
Expand Down
18 changes: 9 additions & 9 deletions ChebsValheimLibrary/_site/xrefmap.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4914,15 +4914,15 @@ references:
isSpec: "True"
fullName: ChebsValheimLibrary.PvP.PvPManager.InitialFriendsListRequest
nameWithType: PvPManager.InitialFriendsListRequest
- uid: ChebsValheimLibrary.PvP.PvPManager.UpdatePlayerFriendsDict(System.Collections.Generic.List{System.String})
name: UpdatePlayerFriendsDict(List<String>)
href: api/ChebsValheimLibrary.PvP.PvPManager.html#ChebsValheimLibrary_PvP_PvPManager_UpdatePlayerFriendsDict_System_Collections_Generic_List_System_String__
commentId: M:ChebsValheimLibrary.PvP.PvPManager.UpdatePlayerFriendsDict(System.Collections.Generic.List{System.String})
name.vb: UpdatePlayerFriendsDict(List(Of String))
fullName: ChebsValheimLibrary.PvP.PvPManager.UpdatePlayerFriendsDict(System.Collections.Generic.List<System.String>)
fullName.vb: ChebsValheimLibrary.PvP.PvPManager.UpdatePlayerFriendsDict(System.Collections.Generic.List(Of System.String))
nameWithType: PvPManager.UpdatePlayerFriendsDict(List<String>)
nameWithType.vb: PvPManager.UpdatePlayerFriendsDict(List(Of String))
- uid: ChebsValheimLibrary.PvP.PvPManager.UpdatePlayerFriendsDict(System.Collections.Generic.List{System.String},Player)
name: UpdatePlayerFriendsDict(List<String>, Player)
href: api/ChebsValheimLibrary.PvP.PvPManager.html#ChebsValheimLibrary_PvP_PvPManager_UpdatePlayerFriendsDict_System_Collections_Generic_List_System_String__Player_
commentId: M:ChebsValheimLibrary.PvP.PvPManager.UpdatePlayerFriendsDict(System.Collections.Generic.List{System.String},Player)
name.vb: UpdatePlayerFriendsDict(List(Of String), Player)
fullName: ChebsValheimLibrary.PvP.PvPManager.UpdatePlayerFriendsDict(System.Collections.Generic.List<System.String>, Player)
fullName.vb: ChebsValheimLibrary.PvP.PvPManager.UpdatePlayerFriendsDict(System.Collections.Generic.List(Of System.String), Player)
nameWithType: PvPManager.UpdatePlayerFriendsDict(List<String>, Player)
nameWithType.vb: PvPManager.UpdatePlayerFriendsDict(List(Of String), Player)
- uid: ChebsValheimLibrary.PvP.PvPManager.UpdatePlayerFriendsDict*
name: UpdatePlayerFriendsDict
href: api/ChebsValheimLibrary.PvP.PvPManager.html#ChebsValheimLibrary_PvP_PvPManager_UpdatePlayerFriendsDict_
Expand Down

0 comments on commit b093a8a

Please sign in to comment.