Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NWN 8193.37 update. NWNX.NET implementation #11

Merged
merged 8 commits into from
Jan 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 52 additions & 17 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,50 +17,55 @@ on:

jobs:
compile:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'skip ci')"
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Setup .NET Core
uses: actions/setup-dotnet@v1
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
global-json-file: global.json

- name: Build
run: dotnet build --configuration Release

build:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
needs: compile
outputs:
version: ${{ steps.vars.outputs.version }}
version: ${{ steps.vars.outputs.VERSION }}
tag: ${{ steps.vars.outputs.TAG }}
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup .NET Core
uses: actions/setup-dotnet@v1
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
global-json-file: global.json

- name: Version and Tag
id: bump_version
uses: anothrNick/github-tag-action@1.61.0
uses: anothrNick/github-tag-action@1.71.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DEFAULT_BUMP: patch
RELEASE_BRANCHES: main
WITH_V: true
PRERELEASE_SUFFIX: alpha
PRERELEASE: ${{ github.ref != 'main' }}
TAG_CONTEXT: branch

- name: Prepare Outputs
id: vars
run: |
echo "::set-output name=version::$(echo ${{ steps.bump_version.outputs.tag }} | sed 's/[v]//g')"
echo "VERSION=$(echo ${{ steps.bump_version.outputs.tag }} | sed 's/[v]//g')" >> "$GITHUB_OUTPUT"
echo "TAG=$(echo ${{ steps.bump_version.outputs.tag }})" >> "$GITHUB_OUTPUT"

- name: Build Release Binaries
id: build
Expand All @@ -73,15 +78,45 @@ jobs:
path: bin/Release/
if-no-files-found: error

release:
runs-on: ubuntu-latest
if: (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && github.ref == 'refs/heads/main'
needs: build
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Download Release Artifacts
uses: actions/download-artifact@v4
with:
name: Binaries
path: binaries

- name: Zip Binaries
run: zip -r ../NWN.Native.zip ./*
working-directory: binaries

- name: Upload Release Binaries
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create ${{ needs.build.outputs.tag }} --title "Release ${{ needs.build.outputs.version }}"
gh release upload ${{ needs.build.outputs.tag }} NWN.Native.zip

nuget:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
needs: build
steps:
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
- name: Checkout
uses: actions/checkout@v4

- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
global-json-file: global.json

- name: Download Release Artifacts
uses: actions/download-artifact@v4
Expand Down
76 changes: 52 additions & 24 deletions NWN.Native.csproj
Original file line number Diff line number Diff line change
@@ -1,28 +1,56 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netcoreapp3.1;net5.0;net6.0;net7.0;net8.0</TargetFrameworks>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<RuntimeIdentifier>linux-x64</RuntimeIdentifier>
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
<PackageId>NWN.Native</PackageId>
<Authors>NWN.NET</Authors>
<PackageTags>Neverwinter Nights;NWN;</PackageTags>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<EnableDynamicLoading>true</EnableDynamicLoading>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<RepositoryUrl>https://github.com/nwn-dotnet/NWN.Native</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<NoWarn>108</NoWarn>
</PropertyGroup>

<ItemGroup>
<Compile Remove="src\main\API\ICGameObject.cs" />
<Compile Remove="src\main\API\ICNWItem.cs" />
</ItemGroup>
<!--Build-->
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<RuntimeIdentifier>linux-x64</RuntimeIdentifier>
<SatelliteResourceLanguages>en</SatelliteResourceLanguages>

<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>

<ProduceReferenceAssembly>false</ProduceReferenceAssembly>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<SourceControlInformationFeatureSupported>true</SourceControlInformationFeatureSupported>
<EnableDynamicLoading>true</EnableDynamicLoading>

<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<NoWarn>108,109</NoWarn>

<RootNamespace>NWN.Native.API</RootNamespace>
</PropertyGroup>

<!--Package-->
<PropertyGroup>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>

<PackageId>$(AssemblyName)</PackageId>
<Authors>NWN.NET</Authors>

<RepositoryUrl>https://github.com/nwn-dotnet/NWN.Native</RepositoryUrl>
<RepositoryType>git</RepositoryType>

<PackageTags>Neverwinter Nights;NWN;</PackageTags>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
</PropertyGroup>

<!--Debug/Source Link-->
<PropertyGroup>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<IncludeSymbols>true</IncludeSymbols>
<DebugSymbols>true</DebugSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
</PropertyGroup>

<ItemGroup>
<Compile Remove="src\main\API\ICGameObject.cs" />
<Compile Remove="src\main\API\ICNWItem.cs" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All"/>
<PackageReference Include="NWNX.NET" Version="1.0.1" />
</ItemGroup>

</Project>
3 changes: 2 additions & 1 deletion NWN.Native.csproj.DotSettings
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=src_005Cmain_005Capi/@EntryIndexedValue">False</s:Boolean></wpf:ResourceDictionary>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=src_005Cmain/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=src_005Cmain_005Capi/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
6 changes: 6 additions & 0 deletions global.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"sdk": {
"version": "8.0.0",
"rollForward": "latestFeature"
}
}
7 changes: 6 additions & 1 deletion src/main/API/C2DA.cs
Original file line number Diff line number Diff line change
Expand Up @@ -336,8 +336,13 @@ public int SetBlankEntry(CExoString sRowLabel, int nColumn) {
return retVal;
}

public int Load2DArray(int optional) {
int retVal = NWNXLibPINVOKE.C2DA_Load2DArray__SWIG_0(swigCPtr, optional);
return retVal;
}

public int Load2DArray() {
int retVal = NWNXLibPINVOKE.C2DA_Load2DArray(swigCPtr);
int retVal = NWNXLibPINVOKE.C2DA_Load2DArray__SWIG_1(swigCPtr);
return retVal;
}

Expand Down
39 changes: 8 additions & 31 deletions src/main/API/CAppManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,35 +112,13 @@ public CServerExoApp m_pServerExoApp {
}
}

public CNWTileSetManager m_pNWTileSetManager {
public SWIGTYPE_p_CNWTileSetManager m_pNWTileSetManager {
set {
NWNXLibPINVOKE.CAppManager_m_pNWTileSetManager_set(swigCPtr, CNWTileSetManager.getCPtr(value));
NWNXLibPINVOKE.CAppManager_m_pNWTileSetManager_set(swigCPtr, SWIGTYPE_p_CNWTileSetManager.getCPtr(value));
}
get {
global::System.IntPtr cPtr = NWNXLibPINVOKE.CAppManager_m_pNWTileSetManager_get(swigCPtr);
CNWTileSetManager ret = (cPtr == global::System.IntPtr.Zero) ? null : new CNWTileSetManager(cPtr, false);
return ret;
}
}

public CObjectTableManager m_pClientObjectTableManager {
set {
NWNXLibPINVOKE.CAppManager_m_pClientObjectTableManager_set(swigCPtr, CObjectTableManager.getCPtr(value));
}
get {
global::System.IntPtr cPtr = NWNXLibPINVOKE.CAppManager_m_pClientObjectTableManager_get(swigCPtr);
CObjectTableManager ret = (cPtr == global::System.IntPtr.Zero) ? null : new CObjectTableManager(cPtr, false);
return ret;
}
}

public CObjectTableManager m_pServerObjectTableManager {
set {
NWNXLibPINVOKE.CAppManager_m_pServerObjectTableManager_set(swigCPtr, CObjectTableManager.getCPtr(value));
}
get {
global::System.IntPtr cPtr = NWNXLibPINVOKE.CAppManager_m_pServerObjectTableManager_get(swigCPtr);
CObjectTableManager ret = (cPtr == global::System.IntPtr.Zero) ? null : new CObjectTableManager(cPtr, false);
SWIGTYPE_p_CNWTileSetManager ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_CNWTileSetManager(cPtr, false);
return ret;
}
}
Expand Down Expand Up @@ -225,12 +203,6 @@ public int m_bLogModelErrors {
public CAppManager() : this(NWNXLibPINVOKE.new_CAppManager(), true) {
}

public CObjectTableManager GetObjectTableManager(uint dwClientServer) {
global::System.IntPtr cPtr = NWNXLibPINVOKE.CAppManager_GetObjectTableManager(swigCPtr, dwClientServer);
CObjectTableManager ret = (cPtr == global::System.IntPtr.Zero) ? null : new CObjectTableManager(cPtr, false);
return ret;
}

public void DoSaveGameScreenShot(CExoString sFile) {
NWNXLibPINVOKE.CAppManager_DoSaveGameScreenShot(swigCPtr, CExoString.getCPtr(sFile));
if (NWNXLibPINVOKE.SWIGPendingException.Pending) throw NWNXLibPINVOKE.SWIGPendingException.Retrieve();
Expand Down Expand Up @@ -301,6 +273,11 @@ public byte GetLanguageId() {
return retVal;
}

public CExoString GetAdvancedVersionString() {
CExoString ret = new CExoString(NWNXLibPINVOKE.CAppManager_GetAdvancedVersionString(swigCPtr), true);
return ret;
}

public void _Destructor() {
NWNXLibPINVOKE.CAppManager__Destructor(swigCPtr);
}
Expand Down
21 changes: 6 additions & 15 deletions src/main/API/CBaseExoApp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ public override int GetHashCode() {
return !Equals(left, right);
}

public virtual int AdmitNetworkAddress(uint nProtocol, CExoString sAddress) {
int retVal = NWNXLibPINVOKE.CBaseExoApp_AdmitNetworkAddress(swigCPtr, nProtocol, CExoString.getCPtr(sAddress));
public virtual int AdmitNetworkAddress(CExoString sAddress) {
int retVal = NWNXLibPINVOKE.CBaseExoApp_AdmitNetworkAddress(swigCPtr, CExoString.getCPtr(sAddress));
if (NWNXLibPINVOKE.SWIGPendingException.Pending) throw NWNXLibPINVOKE.SWIGPendingException.Retrieve();
return retVal;
}
Expand All @@ -102,8 +102,8 @@ public virtual int AdmitPlayerName(CExoString sPlayerName) {
return retVal;
}

public virtual int SetNetworkAddressBan(uint nProtocol, CExoString sAddress, int bBanPlayer) {
int retVal = NWNXLibPINVOKE.CBaseExoApp_SetNetworkAddressBan(swigCPtr, nProtocol, CExoString.getCPtr(sAddress), bBanPlayer);
public virtual int SetNetworkAddressBan(CExoString sAddress, int bBanPlayer) {
int retVal = NWNXLibPINVOKE.CBaseExoApp_SetNetworkAddressBan(swigCPtr, CExoString.getCPtr(sAddress), bBanPlayer);
if (NWNXLibPINVOKE.SWIGPendingException.Pending) throw NWNXLibPINVOKE.SWIGPendingException.Retrieve();
return retVal;
}
Expand All @@ -116,9 +116,8 @@ public virtual void PlayerListChange(uint nPlayerId, int bEnter) {
NWNXLibPINVOKE.CBaseExoApp_PlayerListChange__SWIG_1(swigCPtr, nPlayerId, bEnter);
}

public virtual int HandleMessage(uint nPlayerId, byte* pData, uint dwSize, int bRawMessage) {
int retVal = NWNXLibPINVOKE.CBaseExoApp_HandleMessage(swigCPtr, nPlayerId, pData, dwSize, bRawMessage);
return retVal;
public virtual void HandleMessage(uint nPlayerId, byte* pData, uint dwSize) {
NWNXLibPINVOKE.CBaseExoApp_HandleMessage(swigCPtr, nPlayerId, pData, dwSize);
}

public virtual float GetFPS() {
Expand Down Expand Up @@ -152,14 +151,6 @@ public virtual CExtendedServerInfo GetExtendedServerInfo() {
return ret;
}

public virtual void HandleGameSpyToServerMessage(int nKeyId, void* pOutBuf, int nIndex) {
NWNXLibPINVOKE.CBaseExoApp_HandleGameSpyToServerMessage__SWIG_0(swigCPtr, nKeyId, (global::System.IntPtr)pOutBuf, nIndex);
}

public virtual void HandleGameSpyToServerMessage(int nKeyId, void* pOutBuf) {
NWNXLibPINVOKE.CBaseExoApp_HandleGameSpyToServerMessage__SWIG_1(swigCPtr, nKeyId, (global::System.IntPtr)pOutBuf);
}

public virtual SWIGTYPE_p_CConnectionLib GetConnectionLib() {
global::System.IntPtr cPtr = NWNXLibPINVOKE.CBaseExoApp_GetConnectionLib(swigCPtr);
SWIGTYPE_p_CConnectionLib ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_CConnectionLib(cPtr, false);
Expand Down
5 changes: 4 additions & 1 deletion src/main/API/CCombatInformation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,10 @@ public byte m_nDamageDie {

}

public CCombatInformation() : this(NWNXLibPINVOKE.new_CCombatInformation(), true) {
public CCombatInformation() : this(NWNXLibPINVOKE.new_CCombatInformation__SWIG_0(), true) {
}

public CCombatInformation(CCombatInformation m_ExistingCombatDataToCopy) : this(NWNXLibPINVOKE.new_CCombatInformation__SWIG_1(CCombatInformation.getCPtr(m_ExistingCombatDataToCopy)), true) {
}

public int SaveData(CResGFF pRes, CResStruct pStruct) {
Expand Down
4 changes: 2 additions & 2 deletions src/main/API/CEffectIconObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,12 @@ public override int GetHashCode() {
return !Equals(left, right);
}

public byte m_nIcon {
public ushort m_nIcon {
set {
NWNXLibPINVOKE.CEffectIconObject_m_nIcon_set(swigCPtr, value);
}
get {
byte retVal = NWNXLibPINVOKE.CEffectIconObject_m_nIcon_get(swigCPtr);
ushort retVal = NWNXLibPINVOKE.CEffectIconObject_m_nIcon_get(swigCPtr);
return retVal;
}

Expand Down
Loading
Loading