mirror of
https://github.com/roflmuffin/CounterStrikeSharp.git
synced 2025-12-07 16:36:35 -08:00
Compare commits
58 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d346a02f98 | ||
|
|
8ab61b00e8 | ||
|
|
c746c4e2e7 | ||
|
|
32d3e18657 | ||
|
|
d5fa42cb50 | ||
|
|
22809e3ec6 | ||
|
|
87d197309b | ||
|
|
e6bfb7939d | ||
|
|
0ae9227d73 | ||
|
|
7285d29454 | ||
|
|
124ffac7a9 | ||
|
|
267b017787 | ||
|
|
018bcba655 | ||
|
|
011401adb9 | ||
|
|
bebeedf272 | ||
|
|
7af153cf25 | ||
|
|
6f663164ee | ||
|
|
22f5c06c49 | ||
|
|
073728b4ce | ||
|
|
6511a0098a | ||
|
|
f50fb783bb | ||
|
|
49e8ab0e27 | ||
|
|
4be0634625 | ||
|
|
7025b62615 | ||
|
|
462ca52229 | ||
|
|
d7e23e8282 | ||
|
|
3ddfa71e3f | ||
|
|
688b226bcf | ||
|
|
0d23387347 | ||
|
|
68e6ffaebe | ||
|
|
2f8f370cd3 | ||
|
|
169d43e31d | ||
|
|
0ce4a2903c | ||
|
|
33b46eb214 | ||
|
|
a27ba3b005 | ||
|
|
57286c9990 | ||
|
|
ae808c05c8 | ||
|
|
c9f8e477d3 | ||
|
|
2398ba0a5d | ||
|
|
e45c20481d | ||
|
|
fe321ee93d | ||
|
|
be19103556 | ||
|
|
64cb26b86d | ||
|
|
637224dc55 | ||
|
|
3aca7c37f1 | ||
|
|
87f38d72ee | ||
|
|
5daf94791f | ||
|
|
c50213c442 | ||
|
|
c02d31cb2e | ||
|
|
98cbca44d4 | ||
|
|
4cf88fc03e | ||
|
|
f1dff6d4d3 | ||
|
|
414a59a36d | ||
|
|
f1c108087b | ||
|
|
47ddf42c11 | ||
|
|
ded133f1db | ||
|
|
bbc621acdc | ||
|
|
f7784c26c6 |
@@ -38,7 +38,7 @@ BraceWrapping:
|
||||
SplitEmptyNamespace: true
|
||||
|
||||
PointerAlignment: Left
|
||||
SortIncludes: CaseSensitive
|
||||
SortIncludes: Never
|
||||
IncludeBlocks: Regroup
|
||||
IncludeCategories:
|
||||
# External headers in <> with extension or /
|
||||
|
||||
@@ -1,11 +1,21 @@
|
||||
{
|
||||
"name": "SteamRT Sniper SDK",
|
||||
"image": "registry.gitlab.steamos.cloud/steamrt/sniper/sdk:latest",
|
||||
"customizations": {
|
||||
"updateContentCommand": "git submodule update --init --recursive",
|
||||
"postCreateCommand": "cmake -S . -B build -DCMAKE_BUILD_TYPE=RelWithDebInfo && cmake --build build -j$(nproc)",
|
||||
"customizations": {
|
||||
"vscode": {
|
||||
"extensions": [
|
||||
"ms-vscode.cpptools"
|
||||
"ms-dotnettools.csdevkit",
|
||||
"ms-vscode.cpptools",
|
||||
"ms-vscode.cpptools-extension-pack",
|
||||
"GitHub.copilot",
|
||||
"jeff-hykin.better-cpp-syntax"
|
||||
]
|
||||
}
|
||||
},
|
||||
"features": {
|
||||
"ghcr.io/devcontainers/features/dotnet": "8.0",
|
||||
"ghcr.io/devcontainers/features/node": "lts"
|
||||
}
|
||||
}
|
||||
@@ -1,30 +1,45 @@
|
||||
name: Build & Publish
|
||||
|
||||
env:
|
||||
BUILD_TYPE: Release
|
||||
|
||||
# Remove default permissions of GITHUB_TOKEN for security
|
||||
# https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs
|
||||
permissions: {}
|
||||
|
||||
on:
|
||||
push:
|
||||
paths-ignore:
|
||||
- "docfx/**"
|
||||
branches: ["main", "dev"]
|
||||
branches: ["main"]
|
||||
tags:
|
||||
- "v*"
|
||||
pull_request:
|
||||
branches: ["main", "dev"]
|
||||
|
||||
env:
|
||||
BUILD_TYPE: Release
|
||||
branches: ["main"]
|
||||
|
||||
jobs:
|
||||
setup:
|
||||
permissions:
|
||||
contents: write
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
buildnumber: ${{ steps.buildnumber.outputs.build_number }}
|
||||
gitversion_semver: ${{ steps.gitversion.outputs.semVer }}
|
||||
gitversion_fullsemver: ${{ steps.gitversion.outputs.fullSemVer }}
|
||||
gitversion_assemblysemver: ${{ steps.gitversion.outputs.assemblySemVer }}
|
||||
gitversion_informationalversion: ${{ steps.gitversion.outputs.informationalVersion }}
|
||||
steps:
|
||||
- name: Generate build number
|
||||
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
|
||||
id: buildnumber
|
||||
uses: onyxmueller/build-tag-number@v1
|
||||
with:
|
||||
token: ${{secrets.github_token}}
|
||||
- name: Install GitVersion
|
||||
uses: gittools/actions/gitversion/setup@v1
|
||||
with:
|
||||
versionSpec: 6.0.x
|
||||
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Execute GitVersion
|
||||
id: gitversion
|
||||
uses: gittools/actions/gitversion/execute@v1
|
||||
with:
|
||||
useConfigFile: true
|
||||
|
||||
build_windows:
|
||||
needs: setup
|
||||
@@ -32,16 +47,9 @@ jobs:
|
||||
steps:
|
||||
- name: Prepare env
|
||||
shell: bash
|
||||
run: echo "GITHUB_SHA_SHORT=${GITHUB_SHA::7}" >> $GITHUB_ENV
|
||||
|
||||
- name: Fallback build number
|
||||
if: ${{ github.event_name == 'pull_request' || github.ref != 'refs/heads/main' }}
|
||||
shell: bash
|
||||
run: echo "BUILD_NUMBER=0" >> $GITHUB_ENV
|
||||
|
||||
- name: Main build number
|
||||
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
|
||||
run: echo "BUILD_NUMBER=${{ needs.setup.outputs.buildnumber }}" >> $GITHUB_ENV
|
||||
run: |
|
||||
echo "GITHUB_SHA_SHORT=${GITHUB_SHA::7}" >> $GITHUB_ENV
|
||||
echo "SEMVER=${{ needs.setup.outputs.gitversion_semver }}" >> $GITHUB_ENV
|
||||
|
||||
- name: Visual Studio environment
|
||||
shell: cmd
|
||||
@@ -56,7 +64,7 @@ jobs:
|
||||
echo>>"%GITHUB_ENV%" %%a=%%b
|
||||
)
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: "recursive"
|
||||
|
||||
@@ -76,7 +84,7 @@ jobs:
|
||||
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: counterstrikesharp-build-windows-${{ env.GITHUB_SHA_SHORT }}
|
||||
name: counterstrikesharp-windows-${{ needs.setup.outputs.gitversion_semver }}
|
||||
path: build/output/
|
||||
|
||||
build_linux:
|
||||
@@ -88,18 +96,11 @@ jobs:
|
||||
steps:
|
||||
- name: Prepare env
|
||||
shell: bash
|
||||
run: echo "GITHUB_SHA_SHORT=${GITHUB_SHA::7}" >> $GITHUB_ENV
|
||||
run: |
|
||||
echo "GITHUB_SHA_SHORT=${GITHUB_SHA::7}" >> $GITHUB_ENV
|
||||
echo "SEMVER=${{ needs.setup.outputs.gitversion_semver }}" >> $GITHUB_ENV
|
||||
|
||||
- name: Fallback build number
|
||||
if: ${{ github.event_name == 'pull_request' || github.ref != 'refs/heads/main' }}
|
||||
shell: bash
|
||||
run: echo "BUILD_NUMBER=0" >> $GITHUB_ENV
|
||||
|
||||
- name: Main build number
|
||||
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
|
||||
run: echo "BUILD_NUMBER=${{ needs.setup.outputs.buildnumber }}" >> $GITHUB_ENV
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: "recursive"
|
||||
|
||||
@@ -117,7 +118,7 @@ jobs:
|
||||
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: counterstrikesharp-build-linux-${{ env.GITHUB_SHA_SHORT }}
|
||||
name: counterstrikesharp-linux-${{ needs.setup.outputs.gitversion_semver }}
|
||||
path: build/output/
|
||||
|
||||
build_managed:
|
||||
@@ -130,20 +131,11 @@ jobs:
|
||||
shell: bash
|
||||
run: echo "GITHUB_SHA_SHORT=${GITHUB_SHA::7}" >> $GITHUB_ENV
|
||||
|
||||
- name: Fallback build number
|
||||
if: ${{ github.event_name == 'pull_request' || github.ref != 'refs/heads/main' }}
|
||||
shell: bash
|
||||
run: echo "BUILD_NUMBER=0" >> $GITHUB_ENV
|
||||
|
||||
- name: Main build number
|
||||
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
|
||||
run: echo "BUILD_NUMBER=${{ needs.setup.outputs.buildnumber }}" >> $GITHUB_ENV
|
||||
|
||||
# We don't need expensive submodules for the managed side.
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Build runtime v${{ env.BUILD_NUMBER }}
|
||||
uses: actions/setup-dotnet@v3
|
||||
- name: Build runtime v${{ needs.setup.outputs.gitversion_semver }}
|
||||
uses: actions/setup-dotnet@v4
|
||||
with:
|
||||
dotnet-version: "8.0.x"
|
||||
|
||||
@@ -151,27 +143,36 @@ jobs:
|
||||
run: dotnet restore managed/CounterStrikeSharp.sln
|
||||
|
||||
- name: Run tests
|
||||
run: dotnet test --logger trx --results-directory "TestResults-${{ env.GITHUB_SHA_SHORT }}" managed/CounterStrikeSharp.API.Tests/CounterStrikeSharp.API.Tests.csproj
|
||||
run: dotnet test --logger trx --results-directory "TestResults-${{ needs.setup.outputs.gitversion_semver }}" managed/CounterStrikeSharp.API.Tests/CounterStrikeSharp.API.Tests.csproj
|
||||
|
||||
- name: Upload dotnet test results
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: test-results-${{ env.GITHUB_SHA_SHORT }}
|
||||
path: TestResults-${{ env.GITHUB_SHA_SHORT }}
|
||||
name: test-results-${{ needs.setup.outputs.gitversion_semver }}
|
||||
path: TestResults-${{ needs.setup.outputs.gitversion_semver }}
|
||||
if: ${{ always() }}
|
||||
|
||||
- name: Publish artifacts
|
||||
run: |
|
||||
dotnet publish -c Release /p:Version=1.0.${{ env.BUILD_NUMBER }} managed/CounterStrikeSharp.API
|
||||
dotnet pack -c Release /p:Version=1.0.${{ env.BUILD_NUMBER }} managed/CounterStrikeSharp.API
|
||||
dotnet publish -c Release \
|
||||
/p:Version=${{ needs.setup.outputs.gitversion_semver }} \
|
||||
/p:AssemblyVersion=${{ needs.setup.outputs.gitversion_assemblySemver }} \
|
||||
/p:InformationalVersion=${{ needs.setup.outputs.gitversion_informationalversion }} \
|
||||
managed/CounterStrikeSharp.API
|
||||
|
||||
dotnet pack -c Release \
|
||||
/p:Version=${{ needs.setup.outputs.gitversion_semver }} \
|
||||
/p:AssemblyVersion=${{ needs.setup.outputs.gitversion_assemblySemver }} \
|
||||
/p:InformationalVersion=${{ needs.setup.outputs.gitversion_informationalversion }} \
|
||||
managed/CounterStrikeSharp.API
|
||||
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: counterstrikesharp-build-api-${{ env.GITHUB_SHA_SHORT }}
|
||||
name: counterstrikesharp-api-${{ needs.setup.outputs.gitversion_semver }}
|
||||
path: managed/CounterStrikeSharp.API/bin/Release
|
||||
|
||||
publish:
|
||||
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
|
||||
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && github.repository == 'roflmuffin/CounterStrikeSharp' }}
|
||||
permissions:
|
||||
contents: write
|
||||
needs: ["setup", "build_linux", "build_windows", "build_managed"]
|
||||
@@ -181,19 +182,24 @@ jobs:
|
||||
shell: bash
|
||||
run: echo "GITHUB_SHA_SHORT=${GITHUB_SHA::7}" >> $GITHUB_ENV
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: counterstrikesharp-build-windows-${{ env.GITHUB_SHA_SHORT }}
|
||||
name: counterstrikesharp-windows-${{ needs.setup.outputs.gitversion_semver }}
|
||||
path: build/windows
|
||||
|
||||
- uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: counterstrikesharp-build-linux-${{ env.GITHUB_SHA_SHORT }}
|
||||
name: counterstrikesharp-linux-${{ needs.setup.outputs.gitversion_semver }}
|
||||
path: build/linux
|
||||
|
||||
- uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: counterstrikesharp-build-api-${{ env.GITHUB_SHA_SHORT }}
|
||||
name: counterstrikesharp-api-${{ needs.setup.outputs.gitversion_semver }}
|
||||
path: build/api
|
||||
|
||||
# TODO: This stuff should really be in a matrix
|
||||
@@ -206,8 +212,8 @@ jobs:
|
||||
|
||||
- name: Zip Builds
|
||||
run: |
|
||||
(cd build/linux && zip -qq -r ../../counterstrikesharp-build-${{ needs.setup.outputs.buildnumber }}-linux-${{ env.GITHUB_SHA_SHORT }}.zip *)
|
||||
(cd build/windows && zip -qq -r ../../counterstrikesharp-build-${{ needs.setup.outputs.buildnumber }}-windows-${{ env.GITHUB_SHA_SHORT }}.zip *)
|
||||
(cd build/linux && zip -qq -r ../../counterstrikesharp-linux-${{ needs.setup.outputs.gitversion_semver }}.zip *)
|
||||
(cd build/windows && zip -qq -r ../../counterstrikesharp-windows-${{ needs.setup.outputs.gitversion_semver }}.zip *)
|
||||
|
||||
- name: Add dotnet runtime
|
||||
run: |
|
||||
@@ -221,28 +227,44 @@ jobs:
|
||||
|
||||
- name: Zip Builds
|
||||
run: |
|
||||
(cd build/linux && zip -qq -r ../../counterstrikesharp-with-runtime-build-${{ needs.setup.outputs.buildnumber }}-linux-${{ env.GITHUB_SHA_SHORT }}.zip *)
|
||||
(cd build/windows && zip -qq -r ../../counterstrikesharp-with-runtime-build-${{ needs.setup.outputs.buildnumber }}-windows-${{ env.GITHUB_SHA_SHORT }}.zip *)
|
||||
(cd build/linux && zip -qq -r ../../counterstrikesharp-with-runtime-linux-${{ needs.setup.outputs.gitversion_semver }}.zip *)
|
||||
(cd build/windows && zip -qq -r ../../counterstrikesharp-with-runtime-windows-${{ needs.setup.outputs.gitversion_semver }}.zip *)
|
||||
|
||||
- name: Generate a changelog
|
||||
uses: orhun/git-cliff-action@v4
|
||||
id: git-cliff
|
||||
with:
|
||||
config: cliff.toml
|
||||
args: --current -s footer
|
||||
|
||||
- name: Release
|
||||
id: release
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
tag_name: v${{ needs.setup.outputs.buildnumber }}
|
||||
append_body: true
|
||||
body: |
|
||||
${{ steps.git-cliff.outputs.content }}
|
||||
|
||||
Please refer to [CHANGELOG.md](https://github.com/roflmuffin/CounterStrikeSharp/blob/${{ github.ref_name }}/CHANGELOG.md) for details.
|
||||
files: |
|
||||
counterstrikesharp-build-${{ needs.setup.outputs.buildnumber }}-windows-${{ env.GITHUB_SHA_SHORT }}.zip
|
||||
counterstrikesharp-with-runtime-build-${{ needs.setup.outputs.buildnumber }}-windows-${{ env.GITHUB_SHA_SHORT }}.zip
|
||||
counterstrikesharp-build-${{ needs.setup.outputs.buildnumber }}-linux-${{ env.GITHUB_SHA_SHORT }}.zip
|
||||
counterstrikesharp-with-runtime-build-${{ needs.setup.outputs.buildnumber }}-linux-${{ env.GITHUB_SHA_SHORT }}.zip
|
||||
counterstrikesharp-windows-${{ needs.setup.outputs.gitversion_semver }}.zip
|
||||
counterstrikesharp-with-runtime-windows-${{ needs.setup.outputs.gitversion_semver }}.zip
|
||||
counterstrikesharp-linux-${{ needs.setup.outputs.gitversion_semver }}.zip
|
||||
counterstrikesharp-with-runtime-linux-${{ needs.setup.outputs.gitversion_semver }}.zip
|
||||
|
||||
- name: Publish NuGet package
|
||||
run: |
|
||||
dotnet nuget push build/api/CounterStrikeSharp.API.1.0.${{ needs.setup.outputs.buildnumber }}.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate
|
||||
dotnet nuget push build/api/CounterStrikeSharp.API.1.0.${{ needs.setup.outputs.buildnumber }}.snupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate
|
||||
dotnet nuget push build/api/CounterStrikeSharp.API.${{ needs.setup.outputs.gitversion_semver }}.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate
|
||||
dotnet nuget push build/api/CounterStrikeSharp.API.${{ needs.setup.outputs.gitversion_semver }}.snupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate
|
||||
|
||||
- name: Send Notification to Discord
|
||||
env:
|
||||
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
|
||||
uses: Ilshidur/action-discord@0.3.2
|
||||
with:
|
||||
args: "A new release of CS# has been tagged (v${{ needs.setup.outputs.buildnumber }}) at ${{ steps.release.outputs.url }}"
|
||||
args: |
|
||||
A new release of CS# has been tagged [v${{ needs.setup.outputs.gitversion_semver }}](${{ steps.release.outputs.url }})
|
||||
|
||||
${{ steps.git-cliff.outputs.content }}
|
||||
|
||||
Please refer to [CHANGELOG.md](https://github.com/roflmuffin/CounterStrikeSharp/blob/${{ github.ref_name }}/CHANGELOG.md) for details.
|
||||
25
.github/workflows/lint-code.yaml
vendored
Normal file
25
.github/workflows/lint-code.yaml
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
name: Code format checks
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
paths:
|
||||
- '.github/workflows/**'
|
||||
- 'src/**'
|
||||
- '.clang-format'
|
||||
push:
|
||||
paths:
|
||||
- '.github/workflows/**'
|
||||
- 'src/**'
|
||||
- '.clang-format'
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
name: Lint code with clang-format
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: jidicula/clang-format-action@4726374d1aa3c6aecf132e5197e498979588ebc8
|
||||
with:
|
||||
clang-format-version: '20'
|
||||
check-path: 'src'
|
||||
exclude-regex: '(sdk|\.proto)'
|
||||
40
.vscode/tasks.json
vendored
Normal file
40
.vscode/tasks.json
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
{
|
||||
// See https://go.microsoft.com/fwlink/?LinkId=733558
|
||||
// for the documentation about the tasks.json format
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"label": "sync-linux",
|
||||
"type": "shell",
|
||||
"command": "lftp -c \"open -u $LINUX_SERVER_SFTP_USERNAME,$LINUX_SERVER_SFTP_PASSWORD $LINUX_SERVER_SFTP_HOST; mirror -R ${workspaceFolder}/build/addons /game/csgo/addons; mirror -R ${workspaceFolder}/managed/CounterStrikeSharp.API/bin/Release/net8.0/ /game/csgo/addons/counterstrikesharp/api\"",
|
||||
"dependsOn": [
|
||||
"build",
|
||||
"build-api"
|
||||
],
|
||||
"problemMatcher": []
|
||||
},
|
||||
{
|
||||
"label": "build",
|
||||
"type": "shell",
|
||||
"group": "build",
|
||||
"command": "cmake -S . -B build -DCMAKE_BUILD_TYPE=RelWithDebInfo && cmake --build build -j$(nproc)",
|
||||
},
|
||||
{
|
||||
"label": "build-api",
|
||||
"type": "shell",
|
||||
"group": "build",
|
||||
"command": "dotnet build -c Release",
|
||||
"options": {
|
||||
"cwd": "${workspaceFolder}/managed/CounterStrikeSharp.API"
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "generate-schema",
|
||||
"type": "shell",
|
||||
"command": "dotnet run -- ../CounterStrikeSharp.API/Core/Schema",
|
||||
"options": {
|
||||
"cwd": "${workspaceFolder}/managed/CounterStrikeSharp.SchemaGen"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
1406
CHANGELOG.md
Normal file
1406
CHANGELOG.md
Normal file
File diff suppressed because it is too large
Load Diff
@@ -5,6 +5,9 @@ project(counterstrikesharp C CXX ASM)
|
||||
|
||||
include("makefiles/shared.cmake")
|
||||
|
||||
# Find OpenSSL for httplib SSL support
|
||||
find_package(OpenSSL REQUIRED)
|
||||
|
||||
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
|
||||
|
||||
add_subdirectory(libraries/spdlog)
|
||||
@@ -43,6 +46,8 @@ set(SOURCE_FILES
|
||||
src/core/coreconfig.cpp
|
||||
src/core/gameconfig.h
|
||||
src/core/gameconfig.cpp
|
||||
src/core/gameconfig_updater.h
|
||||
src/core/gameconfig_updater.cpp
|
||||
src/core/log.h
|
||||
src/core/log.cpp
|
||||
src/scripting/script_engine.h
|
||||
@@ -84,6 +89,8 @@ set(SOURCE_FILES
|
||||
src/scripting/natives/natives_entities.cpp
|
||||
src/scripting/natives/natives_voice.cpp
|
||||
src/scripting/natives/natives_metamod.cpp
|
||||
src/scripting/natives/natives_cvariant.cpp
|
||||
src/scripting/natives/natives_cutil.cpp
|
||||
src/core/managers/entity_manager.cpp
|
||||
src/core/managers/entity_manager.h
|
||||
src/core/managers/chat_manager.cpp
|
||||
|
||||
17
Dockerfile
Normal file
17
Dockerfile
Normal file
@@ -0,0 +1,17 @@
|
||||
FROM registry.gitlab.steamos.cloud/steamrt/sniper/sdk:latest
|
||||
|
||||
WORKDIR /workspace
|
||||
|
||||
RUN apt update && apt install -y \
|
||||
clang-16 \
|
||||
cmake \
|
||||
ninja-build \
|
||||
git \
|
||||
zlib1g-dev \
|
||||
libssl-dev \
|
||||
libprotobuf-dev \
|
||||
protobuf-compiler \
|
||||
pkg-config \
|
||||
curl && \
|
||||
ln -sf /usr/bin/clang-16 /usr/bin/clang && \
|
||||
ln -sf /usr/bin/clang++-16 /usr/bin/clang++
|
||||
1
GitVersion.yml
Normal file
1
GitVersion.yml
Normal file
@@ -0,0 +1 @@
|
||||
workflow: GitHubFlow/v1
|
||||
85
cliff.toml
Normal file
85
cliff.toml
Normal file
@@ -0,0 +1,85 @@
|
||||
# git-cliff ~ configuration file
|
||||
# https://git-cliff.org/docs/configuration
|
||||
|
||||
[remote.github]
|
||||
owner = "roflmuffin"
|
||||
repo = "CounterStrikeSharp"
|
||||
# token = ""
|
||||
|
||||
[changelog]
|
||||
# A Tera template to be rendered for each release in the changelog.
|
||||
# See https://keats.github.io/tera/docs/#introduction
|
||||
body = """
|
||||
## What's Changed
|
||||
|
||||
{%- if version %} in {{ version }}{%- endif -%}
|
||||
{% for commit in commits %}
|
||||
* {{ commit.message | split(pat="\n") | first | trim }}\
|
||||
{% if commit.remote.username and commit.remote.username != remote.github.owner %} by \
|
||||
[@{{ commit.remote.username }}](https://github.com/{{ commit.remote.username }}) \
|
||||
{%- endif -%}
|
||||
{% if commit.remote.pr_number %} in \
|
||||
[#{{ commit.remote.pr_number }}]({{ self::remote_url() }}/pull/{{ commit.remote.pr_number }})\
|
||||
{%- endif %}
|
||||
{%- if commit.id %} ([{{ commit.id | truncate(length=7, end="") }}]({{ self::remote_url()}}/commit/{{ commit.id }})){%- endif -%}
|
||||
|
||||
{%- endfor -%}
|
||||
|
||||
{%- if github -%}
|
||||
{% if github.contributors | filter(attribute="is_first_time", value=true) | length != 0 %}
|
||||
{% raw %}\n{% endraw -%}
|
||||
## New Contributors
|
||||
{%- endif %}\
|
||||
{% for contributor in github.contributors | filter(attribute="is_first_time", value=true) %}
|
||||
* [@{{ contributor.username }}](https://github.com/{{ contributor.username }}) made their first contribution
|
||||
{%- if contributor.pr_number %} in \
|
||||
[#{{ contributor.pr_number }}]({{ self::remote_url() }}/pull/{{ contributor.pr_number }}) \
|
||||
{%- endif %}
|
||||
{%- endfor -%}
|
||||
{%- endif -%}
|
||||
|
||||
{% if version %}
|
||||
|
||||
{% else -%}
|
||||
{% raw %}\n{% endraw %}
|
||||
{% endif %}
|
||||
|
||||
{%- macro remote_url() -%}
|
||||
https://github.com/{{ remote.github.owner }}/{{ remote.github.repo }}
|
||||
{%- endmacro -%}
|
||||
"""
|
||||
# Remove leading and trailing whitespaces from the changelog's body.
|
||||
trim = true
|
||||
# A Tera template to be rendered as the changelog's footer.
|
||||
# See https://keats.github.io/tera/docs/#introduction
|
||||
footer = """
|
||||
<!-- generated by git-cliff -->
|
||||
"""
|
||||
# An array of regex based postprocessors to modify the changelog.
|
||||
# Replace the placeholder `<REPO>` with a URL.
|
||||
postprocessors = []
|
||||
|
||||
[git]
|
||||
# Parse commits according to the conventional commits specification.
|
||||
# See https://www.conventionalcommits.org
|
||||
conventional_commits = false
|
||||
# Exclude commits that do not match the conventional commits specification.
|
||||
filter_unconventional = true
|
||||
# Split commits on newlines, treating each line as an individual commit.
|
||||
split_commits = false
|
||||
# An array of regex based parsers to modify commit messages prior to further processing.
|
||||
commit_preprocessors = [
|
||||
{ pattern = '\((\w+\s)?#([0-9]+)\)', replace = "" },
|
||||
{ pattern = '\[no ci\]', replace = "" }
|
||||
]
|
||||
commit_parsers = [
|
||||
{ message = "^release:", skip = true }
|
||||
]
|
||||
# Exclude commits that are not matched by any commit parser.
|
||||
filter_commits = false
|
||||
# Order releases topologically instead of chronologically.
|
||||
topo_order = false
|
||||
# Order of commits in each group/release within the changelog.
|
||||
# Allowed values: newest, oldest
|
||||
sort_commits = "newest"
|
||||
tag_pattern = "v[0-9]+\\.[0-9]+\\.[0-9]+"
|
||||
@@ -6,5 +6,7 @@
|
||||
"PluginAutoLoadEnabled": true,
|
||||
"ServerLanguage": "en",
|
||||
"UnlockConCommands": true,
|
||||
"UnlockConVars": true
|
||||
"UnlockConVars": true,
|
||||
"AutoUpdateEnabled": true,
|
||||
"AutoUpdateURL": "https://gamedata.cssharp.dev"
|
||||
}
|
||||
@@ -56,8 +56,8 @@
|
||||
"GiveNamedItem": {
|
||||
"signatures": {
|
||||
"library": "server",
|
||||
"windows": "48 89 5C 24 ? 48 89 74 24 ? 55 57 41 ? 41 ? 41 ? 48 ? ? ? ? 48 ? ? ? ? ? ? 4D ? ? 48",
|
||||
"linux": "55 48 89 E5 41 57 41 56 4D 89 C6 41 55 49 89 D5 41 54 49 89 F4"
|
||||
"windows": "48 89 5C 24 ? 48 89 74 24 ? 55 57 41 55 41 56 41 57 48 8D AC 24",
|
||||
"linux": "55 48 89 E5 41 57 41 56 49 89 F6 41 55 4D 89 C5 41 54 49 89 D4"
|
||||
}
|
||||
},
|
||||
"UTIL_Remove": {
|
||||
@@ -71,7 +71,7 @@
|
||||
"signatures": {
|
||||
"library": "server",
|
||||
"windows": "44 89 4C 24 20 44 88 44 24 18",
|
||||
"linux": "55 48 89 E5 41 57 41 56 49 89 F6 41 55 4D 89 C5"
|
||||
"linux": "55 48 89 E5 41 57 41 56 49 89 F6 41 55 4D 89 C5 41 54 49 89 FC"
|
||||
}
|
||||
},
|
||||
"CBaseModelEntity_SetModel": {
|
||||
@@ -84,15 +84,15 @@
|
||||
"CCSPlayer_WeaponServices_CanUse": {
|
||||
"signatures": {
|
||||
"library": "server",
|
||||
"windows": "48 89 5C 24 ? 48 89 6C 24 ? 56 57 41 56 48 83 EC ? 48 8B 01 48 8B FA",
|
||||
"linux": "55 48 8D 15 ? ? ? ? 48 89 E5 41 55 49 89 FD 41 54 49 89 F4"
|
||||
"windows": "48 89 5C 24 ? 48 89 6C 24 ? 48 89 74 24 ? 57 48 83 EC ? 48 8B 01 48 8B F2",
|
||||
"linux": "55 48 8D 15 ? ? ? ? 48 89 E5 41 55 49 89 F5 41 54 49 89 FC 53 48 83 EC ? 48 8B 07 48 8B 80 ? ? ? ? 48 39 D0 0F 85 ? ? ? ? 80 BF"
|
||||
}
|
||||
},
|
||||
"CCSPlayer_ItemServices_CanAcquire": {
|
||||
"signatures": {
|
||||
"library": "server",
|
||||
"windows": "44 89 44 24 ? 48 89 54 24 ? 48 89 4C 24 ? 55 56 57 41 54 41 55 41 56 41 57 48 8B EC",
|
||||
"linux": "55 48 89 E5 41 57 41 56 41 55 49 89 CD 41 54 53 48 83 EC"
|
||||
"linux": "55 48 89 E5 41 57 41 56 48 8D 45 ? 41 55 41 54 53 48 89 CB"
|
||||
}
|
||||
},
|
||||
"GetCSWeaponDataFromKey": {
|
||||
@@ -153,6 +153,13 @@
|
||||
"linux": "48 85 FF 74 ? 55 48 89 E5 41 56"
|
||||
}
|
||||
},
|
||||
"CBaseEntity_EmitSoundFilter": {
|
||||
"signatures": {
|
||||
"library": "server",
|
||||
"windows": "48 89 5C 24 08 48 89 6C 24 10 48 89 74 24 18 48 89 7C 24 20 41 56 48 83 EC 30 48 8B EA",
|
||||
"linux": "55 48 89 E5 41 56 49 89 D6 41 55 41 89 F5 41 54 48"
|
||||
}
|
||||
},
|
||||
"CEntityInstance_AcceptInput": {
|
||||
"signatures": {
|
||||
"library": "server",
|
||||
@@ -260,6 +267,13 @@
|
||||
"linux": 0
|
||||
}
|
||||
},
|
||||
"CheckTransmit": {
|
||||
"signatures": {
|
||||
"library": "server",
|
||||
"windows": "48 8B C4 4C 89 48 ? 44 89 40 ? 48 89 50 ? 48 89 48 ? 55",
|
||||
"linux": "55 48 89 E5 41 57 49 89 CF 41 56 41 55 41 54 53 48 81 EC"
|
||||
}
|
||||
},
|
||||
"CheckTransmitPlayerSlot": {
|
||||
"offsets": {
|
||||
"windows": 584,
|
||||
|
||||
80
create-release.sh
Executable file
80
create-release.sh
Executable file
@@ -0,0 +1,80 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
DRY_RUN=false
|
||||
if [[ "$1" == "--dry-run" || "$1" == "-d" ]]; then
|
||||
DRY_RUN=true
|
||||
echo "Running in DRY-RUN mode - no changes will be pushed"
|
||||
fi
|
||||
|
||||
echo "Starting automated release process..."
|
||||
|
||||
echo "Fetching latest tags from remote..."
|
||||
git fetch --tags
|
||||
|
||||
LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "v1.0.0")
|
||||
echo "Latest tag found: $LATEST_TAG"
|
||||
|
||||
if [[ $LATEST_TAG =~ ^v([0-9]+)\.([0-9]+)\.([0-9]+)$ ]]; then
|
||||
MAJOR=${BASH_REMATCH[1]}
|
||||
MINOR=${BASH_REMATCH[2]}
|
||||
PATCH=${BASH_REMATCH[3]}
|
||||
else
|
||||
echo "Error: Could not parse version from tag $LATEST_TAG"
|
||||
echo "Expected format: v1.0.x (e.g., v1.0.322)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
NEW_PATCH=$((PATCH + 1))
|
||||
NEW_TAG="v$MAJOR.$MINOR.$NEW_PATCH"
|
||||
|
||||
echo "New version will be: $NEW_TAG"
|
||||
|
||||
echo "Generating changelog with git-cliff..."
|
||||
npx git-cliff -o CHANGELOG.md -t "$NEW_TAG"
|
||||
|
||||
if ! git diff --quiet CHANGELOG.md; then
|
||||
echo "Changelog updated successfully"
|
||||
|
||||
git add CHANGELOG.md
|
||||
|
||||
COMMIT_MSG="release: $NEW_TAG"
|
||||
echo "Committing changelog with message: $COMMIT_MSG"
|
||||
|
||||
if [ "$DRY_RUN" = true ]; then
|
||||
git commit -m "$COMMIT_MSG"
|
||||
|
||||
echo "Creating tag locally: $NEW_TAG"
|
||||
git tag "$NEW_TAG"
|
||||
|
||||
echo "DRY-RUN: Would push commit to remote"
|
||||
echo "DRY-RUN: Would push tag to remote"
|
||||
else
|
||||
git commit -m "$COMMIT_MSG"
|
||||
|
||||
echo "Pushing commit to remote..."
|
||||
git push origin $(git branch --show-current)
|
||||
|
||||
echo "Creating and pushing tag: $NEW_TAG"
|
||||
git tag "$NEW_TAG"
|
||||
git push origin tag "$NEW_TAG"
|
||||
fi
|
||||
|
||||
echo "Release $NEW_TAG completed successfully!"
|
||||
echo "Summary:"
|
||||
echo " - Previous version: $LATEST_TAG"
|
||||
echo " - New version: $NEW_TAG"
|
||||
echo " - Changelog updated: Yes"
|
||||
if [ "$DRY_RUN" = true ]; then
|
||||
echo " - Commit pushed: (dry-run)"
|
||||
echo " - Tag created and pushed: (dry-run)"
|
||||
else
|
||||
echo " - Commit pushed: Yes"
|
||||
echo " - Tag created and pushed: Yes"
|
||||
fi
|
||||
else
|
||||
echo "No changes detected in CHANGELOG.md"
|
||||
echo "This might indicate that there are no new commits since the last release."
|
||||
exit 1
|
||||
fi
|
||||
99
docfx/docs/guides/auto-build-and-deploy.md
Normal file
99
docfx/docs/guides/auto-build-and-deploy.md
Normal file
@@ -0,0 +1,99 @@
|
||||
---
|
||||
title: Automatically build/deploy your changes
|
||||
description: Automatically build and deploy plugin changes to a remote development server as you work.
|
||||
---
|
||||
|
||||
# Automatically build and deploy your changes
|
||||
|
||||
<sup>Adapted from the
|
||||
[original guide](https://github.com/uFloppyDisk/create-cssharp-plugin/blob/c8fca43f86a61a5e874624f2f3ed39c5271c9a55/templates/standard-plugin/docs/auto-live-hot-reloading.md).
|
||||
</sup>
|
||||
|
||||
During development of your plugin, you may find yourself repeating a workflow
|
||||
similar to the following:
|
||||
1. Make a change to your plugin
|
||||
2. Run your build task (ex. `dotnet build`)
|
||||
3. Upload plugin DLLs to your server using an FTP client
|
||||
4. Alt-tab to the game
|
||||
5. Test your changes
|
||||
6. Repeat
|
||||
|
||||
Iterating on your plugin this way is painfully slow and impacts your productivity.
|
||||
Below, you will find a guide and recommendations on how to setup your dev environment
|
||||
to watch for file changes and automatically update plugin files on your server as you work.
|
||||
By following this guide, your new workflow should look like this:
|
||||
1. Make a change to your plugin
|
||||
2. Alt-tab to the game
|
||||
3. Test your changes
|
||||
4. Repeat
|
||||
|
||||
> [!CAUTION]
|
||||
> Exercise caution when developing your plugin while using this workflow.
|
||||
> Build time errors are mostly caught by .NET SDK before files are committed
|
||||
> but incomplete implementation may lead to issues such as server crashes.
|
||||
> Avoid using this workflow on a production server meant for players.
|
||||
|
||||
## Setup
|
||||
|
||||
#### 1. Build plugin on file changes
|
||||
|
||||
The `dotnet` CLI, included with the .NET SDK, offers a convenient command for
|
||||
automatically watching for source file changes. If you have access to the `dotnet`
|
||||
CLI, run the following command to start watching your source code.
|
||||
```shell
|
||||
dotnet watch build --project path/to/projectName.csproj
|
||||
```
|
||||
<sup>By default, `dotnet watch` executes the `dotnet run` command on file changes
|
||||
so specifying `build` as the first argument is required.</sup>
|
||||
|
||||
Your plugin will now build automatically on file change. By default, your builds
|
||||
should be placed in `bin/<config>/<framework>` in the same directory as your `.csproj`.
|
||||
|
||||
```txt
|
||||
projectDirectory
|
||||
├── projectName.csproj
|
||||
├── bin
|
||||
│ └── Debug
|
||||
│ └── net8.0
|
||||
│ └── PLUGIN BUILDS HERE
|
||||
```
|
||||
|
||||
> [!TIP]
|
||||
> You can have your plugin build to a more convenient location by setting the
|
||||
> `<OutDir>` build property in your `.csproj` file.
|
||||
> Example: `<OutDir>./build/$(MSBuildProjectName)</OutDir>`
|
||||
|
||||
|
||||
#### 2. Setup automatic uploads
|
||||
|
||||
##### Using WinSCP (Windows only)
|
||||
Once connected to your server:
|
||||
1. Go to the `Commands` tab at the top of the WinSCP window
|
||||
and click `Keep Remote Directory up to Date`.
|
||||
2. Select the plugin build directory containing your DLLs.
|
||||
3. Select the plugin destination.
|
||||
(`csgo/addons/counterstrikesharp/plugins/<projectName>`)
|
||||
4. Click `Start`
|
||||
|
||||
> [!IMPORTANT]
|
||||
> **For WSL users:**
|
||||
> Applications running on Windows, such as WinSCP, cannot watch your Linux subsystem for file
|
||||
> changes. Try using [this workaround](#using-winscp-while-developing-in-wsl) or consider
|
||||
> moving development to Windows.
|
||||
|
||||
##### Using `lsyncd` (Linux)
|
||||
> **TODO:** in-depth guide for setting up lsyncd
|
||||
|
||||
Learn more about `lsyncd`: https://github.com/lsyncd/lsyncd
|
||||
|
||||
___
|
||||
|
||||
#### Using WinSCP while developing in WSL
|
||||
Run the following watch command in place of the one mentioned in
|
||||
[Step 1](#1-build-plugin-on-file-changes) to build to a directory in your Windows filesystem
|
||||
```shell
|
||||
dotnet watch build --project path/to/<projectName>.csproj --property:OutDir=/mnt/<drive-letter>/some/path/<projectName>`
|
||||
```
|
||||
and have [WinSCP in Step 2](#2-setup-automatic-uploads) watch that path instead.
|
||||
|
||||
[Learn about Windows filesystem mounts in WSL](https://blogs.windows.com/windowsdeveloper/2016/07/22/fun-with-the-windows-subsystem-for-linux/#Working%20with%20Windows%20files:~:text=Working%20with%20Windows%20files)
|
||||
@@ -8,4 +8,7 @@
|
||||
href: dependency-injection.md
|
||||
|
||||
- name: Referencing Players
|
||||
href: referencing-players.md
|
||||
href: referencing-players.md
|
||||
|
||||
- name: Automatically build and deploy your changes
|
||||
href: auto-build-and-deploy.md
|
||||
|
||||
@@ -47,3 +47,10 @@ When enabled, will remove the `FCVAR_HIDDEN`,`FCVAR_DEVELOPMENTONLY`, `FCVAR_MIS
|
||||
## UnlockConVars
|
||||
|
||||
When enabled, will remove the `FCVAR_HIDDEN`,`FCVAR_DEVELOPMENTONLY`, `FCVAR_MISSING0`, `FCVAR_MISSING1`, `FCVAR_MISSING2`, `FCVAR_MISSING3` flags from all console variables.
|
||||
|
||||
## AutoUpdateEnabled
|
||||
|
||||
When enabled, CS# will check for any updates to the gamedata.json file and automatically update it if a new version is available.
|
||||
|
||||
## AutoUpdateURL
|
||||
The URL to use for the auto-update feature. This URL should point to a JSON file that contains the latest version of the gamedata.json file.
|
||||
@@ -1,38 +1,60 @@
|
||||
using System.Text.Json.Serialization;
|
||||
using CounterStrikeSharp.API.Core;
|
||||
using CounterStrikeSharp.API.Core.Attributes;
|
||||
|
||||
namespace WithConfig;
|
||||
|
||||
public class SampleConfig : BasePluginConfig
|
||||
{
|
||||
[JsonPropertyName("ChatPrefix")] public string ChatPrefix { get; set; } = "My Cool Plugin";
|
||||
|
||||
[JsonPropertyName("ChatInterval")] public float ChatInterval { get; set; } = 60;
|
||||
}
|
||||
|
||||
[MinimumApiVersion(80)]
|
||||
public class WithConfigPlugin : BasePlugin, IPluginConfig<SampleConfig>
|
||||
{
|
||||
public override string ModuleName => "Example: With Config";
|
||||
public override string ModuleVersion => "1.0.0";
|
||||
|
||||
public SampleConfig Config { get; set; }
|
||||
|
||||
public void OnConfigParsed(SampleConfig config)
|
||||
{
|
||||
// Do manual verification of the config and override any invalid values
|
||||
if (config.ChatInterval > 60)
|
||||
{
|
||||
config.ChatInterval = 60;
|
||||
}
|
||||
|
||||
if (config.ChatPrefix.Length > 25)
|
||||
{
|
||||
throw new Exception($"Invalid value has been set to config value 'ChatPrefix': {config.ChatPrefix}");
|
||||
}
|
||||
|
||||
// Once we've validated the config, we can set it to the instance
|
||||
Config = config;
|
||||
}
|
||||
}
|
||||
using System.Text.Json.Serialization;
|
||||
using CounterStrikeSharp.API.Core;
|
||||
using CounterStrikeSharp.API.Core.Attributes;
|
||||
using CounterStrikeSharp.API.Core.Attributes.Registration;
|
||||
using CounterStrikeSharp.API.Modules.Admin;
|
||||
using CounterStrikeSharp.API.Modules.Commands;
|
||||
using CounterStrikeSharp.API.Modules.Config;
|
||||
using CounterStrikeSharp.API.Modules.Extensions;
|
||||
|
||||
namespace WithConfig;
|
||||
|
||||
public class SampleConfig : BasePluginConfig
|
||||
{
|
||||
[JsonPropertyName("ChatPrefix")] public string ChatPrefix { get; set; } = "My Cool Plugin";
|
||||
|
||||
[JsonPropertyName("ChatInterval")] public float ChatInterval { get; set; } = 60;
|
||||
}
|
||||
|
||||
[MinimumApiVersion(80)]
|
||||
public class WithConfigPlugin : BasePlugin, IPluginConfig<SampleConfig>
|
||||
{
|
||||
public override string ModuleName => "Example: With Config";
|
||||
public override string ModuleVersion => "1.0.0";
|
||||
|
||||
public SampleConfig Config { get; set; }
|
||||
|
||||
public void OnConfigParsed(SampleConfig config)
|
||||
{
|
||||
// Do manual verification of the config and override any invalid values
|
||||
if (config.ChatInterval > 60)
|
||||
{
|
||||
config.ChatInterval = 60;
|
||||
}
|
||||
|
||||
if (config.ChatPrefix.Length > 25)
|
||||
{
|
||||
throw new Exception($"Invalid value has been set to config value 'ChatPrefix': {config.ChatPrefix}");
|
||||
}
|
||||
|
||||
// Once we've validated the config, we can set it to the instance
|
||||
Config = config;
|
||||
}
|
||||
|
||||
[ConsoleCommand("css_reload_config", "Reloads the plugin config")]
|
||||
public void OnReloadConfig(CCSPlayerController? player, CommandInfo commandInfo)
|
||||
{
|
||||
commandInfo.ReplyToCommand("Chat Interval before reload: " + Config.ChatInterval);
|
||||
Config.Reload();
|
||||
commandInfo.ReplyToCommand("Chat Interval after reload: " + Config.ChatInterval);
|
||||
}
|
||||
|
||||
[ConsoleCommand("css_reset_config", "Resets the plugin config")]
|
||||
public void OnResetConfig(CCSPlayerController? player, CommandInfo commandInfo)
|
||||
{
|
||||
commandInfo.ReplyToCommand("Chat Interval before reset: " + Config.ChatInterval);
|
||||
Config.ChatInterval = 60;
|
||||
Config.Update();
|
||||
commandInfo.ReplyToCommand("Chat Interval after reset: " + Config.ChatInterval);
|
||||
}
|
||||
}
|
||||
|
||||
Submodule libraries/Protobufs updated: 3d85413bf7...53da9bc320
Submodule libraries/hl2sdk-cs2 updated: a26ca82e87...bc59586979
12818
libraries/httplib/httplib.h
Normal file
12818
libraries/httplib/httplib.h
Normal file
File diff suppressed because it is too large
Load Diff
Submodule libraries/metamod-source updated: 607301adc3...b17dc63de7
@@ -29,4 +29,6 @@ set(
|
||||
distorm
|
||||
funchook-static
|
||||
dynohook
|
||||
OpenSSL::SSL
|
||||
OpenSSL::Crypto
|
||||
)
|
||||
|
||||
@@ -35,10 +35,10 @@ else()
|
||||
add_definitions(-DGITHUB_SHA="Local")
|
||||
endif()
|
||||
|
||||
if(DEFINED ENV{BUILD_NUMBER})
|
||||
add_definitions(-DBUILD_NUMBER="$ENV{BUILD_NUMBER}")
|
||||
if(DEFINED ENV{SEMVER})
|
||||
add_definitions(-DSEMVER="$ENV{SEMVER}")
|
||||
else()
|
||||
add_definitions(-DBUILD_NUMBER="0")
|
||||
add_definitions(-DSEMVER="Local")
|
||||
endif()
|
||||
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
@@ -58,7 +58,6 @@ include_directories(
|
||||
${SOURCESDK}/public/tier1
|
||||
${SOURCESDK}/public/entity2
|
||||
${SOURCESDK}/public/game/server
|
||||
${SOURCESDK}/public/entity2
|
||||
${SOURCESDK}/public/schemasystem
|
||||
${METAMOD_DIR}/core
|
||||
${METAMOD_DIR}/core/sourcehook
|
||||
|
||||
@@ -19,4 +19,6 @@ set(COUNTER_STRIKE_SHARP_LINK_LIBRARIES
|
||||
distorm
|
||||
funchook-static
|
||||
dynohook
|
||||
OpenSSL::SSL
|
||||
OpenSSL::Crypto
|
||||
)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -218,6 +218,138 @@ namespace CounterStrikeSharp.API.Core
|
||||
}
|
||||
}
|
||||
|
||||
public static string GetStringFromSymbolLarge(IntPtr pointer){
|
||||
lock (ScriptContext.GlobalScriptContext.Lock) {
|
||||
ScriptContext.GlobalScriptContext.Reset();
|
||||
ScriptContext.GlobalScriptContext.Push(pointer);
|
||||
ScriptContext.GlobalScriptContext.SetIdentifier(0x600A804B);
|
||||
ScriptContext.GlobalScriptContext.Invoke();
|
||||
ScriptContext.GlobalScriptContext.CheckErrors();
|
||||
return (string)ScriptContext.GlobalScriptContext.GetResult(typeof(string));
|
||||
}
|
||||
}
|
||||
|
||||
public static uint GetVariantType(IntPtr pvariant){
|
||||
lock (ScriptContext.GlobalScriptContext.Lock) {
|
||||
ScriptContext.GlobalScriptContext.Reset();
|
||||
ScriptContext.GlobalScriptContext.Push(pvariant);
|
||||
ScriptContext.GlobalScriptContext.SetIdentifier(0x7AC3DA1C);
|
||||
ScriptContext.GlobalScriptContext.Invoke();
|
||||
ScriptContext.GlobalScriptContext.CheckErrors();
|
||||
return (uint)ScriptContext.GlobalScriptContext.GetResult(typeof(uint));
|
||||
}
|
||||
}
|
||||
|
||||
public static int GetVariantInt(IntPtr pvariant){
|
||||
lock (ScriptContext.GlobalScriptContext.Lock) {
|
||||
ScriptContext.GlobalScriptContext.Reset();
|
||||
ScriptContext.GlobalScriptContext.Push(pvariant);
|
||||
ScriptContext.GlobalScriptContext.SetIdentifier(0x78156617);
|
||||
ScriptContext.GlobalScriptContext.Invoke();
|
||||
ScriptContext.GlobalScriptContext.CheckErrors();
|
||||
return (int)ScriptContext.GlobalScriptContext.GetResult(typeof(int));
|
||||
}
|
||||
}
|
||||
|
||||
public static uint GetVariantUint(IntPtr pvariant){
|
||||
lock (ScriptContext.GlobalScriptContext.Lock) {
|
||||
ScriptContext.GlobalScriptContext.Reset();
|
||||
ScriptContext.GlobalScriptContext.Push(pvariant);
|
||||
ScriptContext.GlobalScriptContext.SetIdentifier(0x7AC49FA2);
|
||||
ScriptContext.GlobalScriptContext.Invoke();
|
||||
ScriptContext.GlobalScriptContext.CheckErrors();
|
||||
return (uint)ScriptContext.GlobalScriptContext.GetResult(typeof(uint));
|
||||
}
|
||||
}
|
||||
|
||||
public static float GetVariantFloat(IntPtr pvariant){
|
||||
lock (ScriptContext.GlobalScriptContext.Lock) {
|
||||
ScriptContext.GlobalScriptContext.Reset();
|
||||
ScriptContext.GlobalScriptContext.Push(pvariant);
|
||||
ScriptContext.GlobalScriptContext.SetIdentifier(0xD20595B4);
|
||||
ScriptContext.GlobalScriptContext.Invoke();
|
||||
ScriptContext.GlobalScriptContext.CheckErrors();
|
||||
return (float)ScriptContext.GlobalScriptContext.GetResult(typeof(float));
|
||||
}
|
||||
}
|
||||
|
||||
public static string GetVariantString(IntPtr pvariant){
|
||||
lock (ScriptContext.GlobalScriptContext.Lock) {
|
||||
ScriptContext.GlobalScriptContext.Reset();
|
||||
ScriptContext.GlobalScriptContext.Push(pvariant);
|
||||
ScriptContext.GlobalScriptContext.SetIdentifier(0x41C49F71);
|
||||
ScriptContext.GlobalScriptContext.Invoke();
|
||||
ScriptContext.GlobalScriptContext.CheckErrors();
|
||||
return (string)ScriptContext.GlobalScriptContext.GetResult(typeof(string));
|
||||
}
|
||||
}
|
||||
|
||||
public static bool GetVariantBool(IntPtr pvariant){
|
||||
lock (ScriptContext.GlobalScriptContext.Lock) {
|
||||
ScriptContext.GlobalScriptContext.Reset();
|
||||
ScriptContext.GlobalScriptContext.Push(pvariant);
|
||||
ScriptContext.GlobalScriptContext.SetIdentifier(0x7ABC76EA);
|
||||
ScriptContext.GlobalScriptContext.Invoke();
|
||||
ScriptContext.GlobalScriptContext.CheckErrors();
|
||||
return (bool)ScriptContext.GlobalScriptContext.GetResult(typeof(bool));
|
||||
}
|
||||
}
|
||||
|
||||
public static void SetVariantInt(IntPtr pvariant, int value){
|
||||
lock (ScriptContext.GlobalScriptContext.Lock) {
|
||||
ScriptContext.GlobalScriptContext.Reset();
|
||||
ScriptContext.GlobalScriptContext.Push(pvariant);
|
||||
ScriptContext.GlobalScriptContext.Push(value);
|
||||
ScriptContext.GlobalScriptContext.SetIdentifier(0x801EC403);
|
||||
ScriptContext.GlobalScriptContext.Invoke();
|
||||
ScriptContext.GlobalScriptContext.CheckErrors();
|
||||
}
|
||||
}
|
||||
|
||||
public static void SetVariantUint(IntPtr pvariant, uint value){
|
||||
lock (ScriptContext.GlobalScriptContext.Lock) {
|
||||
ScriptContext.GlobalScriptContext.Reset();
|
||||
ScriptContext.GlobalScriptContext.Push(pvariant);
|
||||
ScriptContext.GlobalScriptContext.Push(value);
|
||||
ScriptContext.GlobalScriptContext.SetIdentifier(0x83EC7436);
|
||||
ScriptContext.GlobalScriptContext.Invoke();
|
||||
ScriptContext.GlobalScriptContext.CheckErrors();
|
||||
}
|
||||
}
|
||||
|
||||
public static void SetVariantFloat(IntPtr pvariant, float value){
|
||||
lock (ScriptContext.GlobalScriptContext.Lock) {
|
||||
ScriptContext.GlobalScriptContext.Reset();
|
||||
ScriptContext.GlobalScriptContext.Push(pvariant);
|
||||
ScriptContext.GlobalScriptContext.Push(value);
|
||||
ScriptContext.GlobalScriptContext.SetIdentifier(0x266E8A0);
|
||||
ScriptContext.GlobalScriptContext.Invoke();
|
||||
ScriptContext.GlobalScriptContext.CheckErrors();
|
||||
}
|
||||
}
|
||||
|
||||
public static void SetVariantString(IntPtr pvariant, string value){
|
||||
lock (ScriptContext.GlobalScriptContext.Lock) {
|
||||
ScriptContext.GlobalScriptContext.Reset();
|
||||
ScriptContext.GlobalScriptContext.Push(pvariant);
|
||||
ScriptContext.GlobalScriptContext.Push(value);
|
||||
ScriptContext.GlobalScriptContext.SetIdentifier(0x2450A3E5);
|
||||
ScriptContext.GlobalScriptContext.Invoke();
|
||||
ScriptContext.GlobalScriptContext.CheckErrors();
|
||||
}
|
||||
}
|
||||
|
||||
public static void SetVariantBool(IntPtr pvariant, bool value){
|
||||
lock (ScriptContext.GlobalScriptContext.Lock) {
|
||||
ScriptContext.GlobalScriptContext.Reset();
|
||||
ScriptContext.GlobalScriptContext.Push(pvariant);
|
||||
ScriptContext.GlobalScriptContext.Push(value);
|
||||
ScriptContext.GlobalScriptContext.SetIdentifier(0x83F1967E);
|
||||
ScriptContext.GlobalScriptContext.Invoke();
|
||||
ScriptContext.GlobalScriptContext.CheckErrors();
|
||||
}
|
||||
}
|
||||
|
||||
public static T DynamicHookGetReturn<T>(IntPtr hook, int datatype){
|
||||
lock (ScriptContext.GlobalScriptContext.Lock) {
|
||||
ScriptContext.GlobalScriptContext.Reset();
|
||||
@@ -780,6 +912,21 @@ namespace CounterStrikeSharp.API.Core
|
||||
}
|
||||
}
|
||||
|
||||
public static uint EmitSoundFilter(ulong filtermask, uint ent, string sound, float volume, float pitch){
|
||||
lock (ScriptContext.GlobalScriptContext.Lock) {
|
||||
ScriptContext.GlobalScriptContext.Reset();
|
||||
ScriptContext.GlobalScriptContext.Push(filtermask);
|
||||
ScriptContext.GlobalScriptContext.Push(ent);
|
||||
ScriptContext.GlobalScriptContext.Push(sound);
|
||||
ScriptContext.GlobalScriptContext.Push(volume);
|
||||
ScriptContext.GlobalScriptContext.Push(pitch);
|
||||
ScriptContext.GlobalScriptContext.SetIdentifier(0x43C4A2B3);
|
||||
ScriptContext.GlobalScriptContext.Invoke();
|
||||
ScriptContext.GlobalScriptContext.CheckErrors();
|
||||
return (uint)ScriptContext.GlobalScriptContext.GetResult(typeof(uint));
|
||||
}
|
||||
}
|
||||
|
||||
public static void HookEvent(string name, InputArgument callback, bool ispost){
|
||||
lock (ScriptContext.GlobalScriptContext.Lock) {
|
||||
ScriptContext.GlobalScriptContext.Reset();
|
||||
|
||||
@@ -61,6 +61,12 @@ namespace CounterStrikeSharp.API.Core
|
||||
|
||||
[JsonPropertyName("UnlockConVars")]
|
||||
public bool UnlockConVars { get; set; } = true;
|
||||
|
||||
[JsonPropertyName("AutoUpdateEnabled")]
|
||||
public bool AutoUpdateEnabled { get; set; } = true;
|
||||
|
||||
[JsonPropertyName("AutoUpdateURL")]
|
||||
public string AutoUpdateURL { get; set; } = "https://gamedata.cssharp.dev";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -157,7 +163,7 @@ namespace CounterStrikeSharp.API.Core
|
||||
{
|
||||
var data = JsonSerializer.Deserialize<CoreConfigData>(File.ReadAllText(_coreConfigPath),
|
||||
new JsonSerializerOptions() { ReadCommentHandling = JsonCommentHandling.Skip });
|
||||
|
||||
|
||||
if (data != null)
|
||||
{
|
||||
_coreConfig = data;
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
|
||||
using System.Collections.Concurrent;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Extensions.Logging;
|
||||
@@ -26,7 +27,7 @@ namespace CounterStrikeSharp.API.Core
|
||||
/// </summary>
|
||||
public enum FunctionLifetime
|
||||
{
|
||||
/// <summary>Delegate will be removed after the first invocation.</summary>
|
||||
/// <summary>Delegate will be removed after the first invocation.</summary>
|
||||
SingleUse,
|
||||
|
||||
/// <summary>Delegate will remain in memory for the lifetime of the application (or until <see cref="FunctionReference.Remove"/> is called).</summary>
|
||||
@@ -57,7 +58,7 @@ namespace CounterStrikeSharp.API.Core
|
||||
_targetMethod = method;
|
||||
_nativeCallback = CreateWrappedCallback();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// <inheritdoc cref="FunctionLifetime"/>
|
||||
/// </summary>
|
||||
@@ -73,6 +74,25 @@ namespace CounterStrikeSharp.API.Core
|
||||
|
||||
private unsafe CallbackDelegate CreateWrappedCallback()
|
||||
{
|
||||
var methodName = _targetMethod.Method.DeclaringType?.FullName + "." + _targetMethod.Method.Name;
|
||||
var profileName = "ScriptCallback::Execute::" + _targetMethod.Method.Name;
|
||||
|
||||
var stackTrace = new StackTrace(2, true);
|
||||
var firstUserFrame = stackTrace.GetFrames()?.FirstOrDefault(frame =>
|
||||
{
|
||||
var declaring = frame.GetMethod()?.DeclaringType?.FullName;
|
||||
return declaring != null &&
|
||||
!declaring.StartsWith("CounterStrikeSharp") &&
|
||||
!declaring.Contains("SafeExecutor") &&
|
||||
!declaring.Contains("FunctionReference");
|
||||
});
|
||||
|
||||
string caller = firstUserFrame != null
|
||||
? $"{firstUserFrame.GetMethod()?.DeclaringType?.FullName}.{firstUserFrame.GetMethod()?.Name} @ {firstUserFrame.GetFileName()}:{firstUserFrame.GetFileLineNumber()}"
|
||||
: "Unknown (no user frame)";
|
||||
|
||||
Helpers.RegisterCallbackTrace(methodName, 1, profileName, caller);
|
||||
|
||||
return context =>
|
||||
{
|
||||
try
|
||||
@@ -176,4 +196,4 @@ namespace CounterStrikeSharp.API.Core
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -29,5 +29,8 @@ namespace CounterStrikeSharp.API.Core
|
||||
[SecurityCritical]
|
||||
[DllImport(dllPath, EntryPoint = "InvokeNative")]
|
||||
public static extern void InvokeNative(IntPtr ptr);
|
||||
|
||||
[DllImport(dllPath, EntryPoint = "RegisterCallbackTrace")]
|
||||
public static extern void RegisterCallbackTrace(string name, int count, string profile, string callerStack);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,4 +50,25 @@ public partial class CBaseEntity
|
||||
|
||||
return (T)Activator.CreateInstance(typeof(T), Marshal.ReadIntPtr(SubclassID.Handle + 4));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Emit a soundevent to all players.
|
||||
/// </summary>
|
||||
/// <param name="soundEventName">The name of the soundevent to emit.</param>
|
||||
/// <param name="recipients">The recipients of the soundevent.</param>
|
||||
/// <param name="volume">The volume of the soundevent.</param>
|
||||
/// <param name="pitch">The pitch of the soundevent.</param>
|
||||
/// <returns>The sound event guid.</returns>
|
||||
public uint EmitSound(string soundEventName, RecipientFilter? recipients = null, float volume = 1f, float pitch = 0)
|
||||
{
|
||||
Guard.IsValidEntity(this);
|
||||
|
||||
if (recipients == null)
|
||||
{
|
||||
recipients = new RecipientFilter();
|
||||
recipients.AddAllPlayers();
|
||||
}
|
||||
|
||||
return NativeAPI.EmitSoundFilter(recipients.GetRecipientMask(), this.Index, soundEventName, volume, pitch);
|
||||
}
|
||||
}
|
||||
|
||||
18
managed/CounterStrikeSharp.API/Core/Model/CUtlSymbolLarge.cs
Normal file
18
managed/CounterStrikeSharp.API/Core/Model/CUtlSymbolLarge.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
namespace CounterStrikeSharp.API.Core;
|
||||
|
||||
public class CUtlSymbolLarge : NativeObject
|
||||
{
|
||||
public CUtlSymbolLarge(IntPtr pointer) : base(pointer)
|
||||
{
|
||||
}
|
||||
|
||||
public bool IsValid => Handle != IntPtr.Zero;
|
||||
|
||||
public string String
|
||||
{
|
||||
get
|
||||
{
|
||||
return NativeAPI.GetStringFromSymbolLarge(Handle);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,56 @@
|
||||
namespace CounterStrikeSharp.API.Core;
|
||||
using System.Reflection.Metadata;
|
||||
|
||||
/// <summary>
|
||||
/// Placeholder for CVariant
|
||||
/// <see href="https://github.com/alliedmodders/hl2sdk/blob/cs2/public/variant.h"/>
|
||||
/// <remarks>A lot of entity outputs do not use this value</remarks>
|
||||
/// </summary>
|
||||
namespace CounterStrikeSharp.API.Core;
|
||||
|
||||
public class CVariant : NativeObject
|
||||
{
|
||||
public CVariant(IntPtr pointer) : base(pointer)
|
||||
{
|
||||
}
|
||||
|
||||
public bool IsValid => Handle != IntPtr.Zero;
|
||||
|
||||
public fieldtype_t FieldType => (fieldtype_t)NativeAPI.GetVariantType(Handle);
|
||||
|
||||
public T Get<T>()
|
||||
{
|
||||
var type = typeof(T);
|
||||
object result = type switch
|
||||
{
|
||||
_ when type == typeof(float) => NativeAPI.GetVariantFloat(Handle),
|
||||
_ when type == typeof(int) => NativeAPI.GetVariantInt(Handle),
|
||||
_ when type == typeof(uint) => NativeAPI.GetVariantUint(Handle),
|
||||
_ when type == typeof(string) => NativeAPI.GetVariantString(Handle),
|
||||
_ when type == typeof(bool) => NativeAPI.GetVariantBool(Handle),
|
||||
_ => throw new NotSupportedException(),
|
||||
};
|
||||
|
||||
return (T)result;
|
||||
}
|
||||
|
||||
public void Set<T>(T value)
|
||||
{
|
||||
var type = typeof(T);
|
||||
switch (type)
|
||||
{
|
||||
case var _ when value is float f:
|
||||
NativeAPI.SetVariantFloat(Handle, f);
|
||||
break;
|
||||
case var _ when value is int i:
|
||||
NativeAPI.SetVariantInt(Handle, i);
|
||||
break;
|
||||
case var _ when value is uint ui:
|
||||
NativeAPI.SetVariantUint(Handle, ui);
|
||||
break;
|
||||
case var _ when value is bool b:
|
||||
NativeAPI.SetVariantBool(Handle, b);
|
||||
break;
|
||||
case var _ when value is string s:
|
||||
NativeAPI.SetVariantString(Handle, s);
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,8 +58,8 @@ public partial class CBaseAnimGraph : CBaseModelEntity
|
||||
[SchemaMember("CBaseAnimGraph", "m_bRagdollClientSide")]
|
||||
public ref bool RagdollClientSide => ref Schema.GetRef<bool>(this.Handle, "CBaseAnimGraph", "m_bRagdollClientSide");
|
||||
|
||||
// m_nLastDestructiblePartDestroyedAnimgraphSetTick
|
||||
[SchemaMember("CBaseAnimGraph", "m_nLastDestructiblePartDestroyedAnimgraphSetTick")]
|
||||
public ref Int32 LastDestructiblePartDestroyedAnimgraphSetTick => ref Schema.GetRef<Int32>(this.Handle, "CBaseAnimGraph", "m_nLastDestructiblePartDestroyedAnimgraphSetTick");
|
||||
|
||||
// m_nLastDestructiblePartDestroyedAnimgraphSetTick
|
||||
[SchemaMember("CBaseAnimGraph", "m_nLastDestructiblePartDestroyedAnimgraphSetTick")]
|
||||
public ref Int32 LastDestructiblePartDestroyedAnimgraphSetTick => ref Schema.GetRef<Int32>(this.Handle, "CBaseAnimGraph", "m_nLastDestructiblePartDestroyedAnimgraphSetTick");
|
||||
|
||||
}
|
||||
|
||||
@@ -78,8 +78,8 @@ public partial class CBaseCSGrenadeProjectile : CBaseGrenade
|
||||
[SchemaMember("CBaseCSGrenadeProjectile", "m_nTicksAtZeroVelocity")]
|
||||
public ref Int32 TicksAtZeroVelocity => ref Schema.GetRef<Int32>(this.Handle, "CBaseCSGrenadeProjectile", "m_nTicksAtZeroVelocity");
|
||||
|
||||
// m_bHasEverHitEnemy
|
||||
[SchemaMember("CBaseCSGrenadeProjectile", "m_bHasEverHitEnemy")]
|
||||
public ref bool HasEverHitEnemy => ref Schema.GetRef<bool>(this.Handle, "CBaseCSGrenadeProjectile", "m_bHasEverHitEnemy");
|
||||
// m_bHasEverHitEnemy
|
||||
[SchemaMember("CBaseCSGrenadeProjectile", "m_bHasEverHitEnemy")]
|
||||
public ref bool HasEverHitEnemy => ref Schema.GetRef<bool>(this.Handle, "CBaseCSGrenadeProjectile", "m_bHasEverHitEnemy");
|
||||
|
||||
}
|
||||
|
||||
@@ -26,34 +26,34 @@ public partial class CBaseModelEntity : CBaseEntity
|
||||
[SchemaMember("CBaseModelEntity", "m_CHitboxComponent")]
|
||||
public CHitboxComponent CHitboxComponent => Schema.GetDeclaredClass<CHitboxComponent>(this.Handle, "CBaseModelEntity", "m_CHitboxComponent");
|
||||
|
||||
// m_nDestructiblePartInitialStateDestructed0
|
||||
[SchemaMember("CBaseModelEntity", "m_nDestructiblePartInitialStateDestructed0")]
|
||||
public ref HitGroup_t DestructiblePartInitialStateDestructed0 => ref Schema.GetRef<HitGroup_t>(this.Handle, "CBaseModelEntity", "m_nDestructiblePartInitialStateDestructed0");
|
||||
|
||||
// m_nDestructiblePartInitialStateDestructed1
|
||||
[SchemaMember("CBaseModelEntity", "m_nDestructiblePartInitialStateDestructed1")]
|
||||
public ref HitGroup_t DestructiblePartInitialStateDestructed1 => ref Schema.GetRef<HitGroup_t>(this.Handle, "CBaseModelEntity", "m_nDestructiblePartInitialStateDestructed1");
|
||||
|
||||
// m_nDestructiblePartInitialStateDestructed2
|
||||
[SchemaMember("CBaseModelEntity", "m_nDestructiblePartInitialStateDestructed2")]
|
||||
public ref HitGroup_t DestructiblePartInitialStateDestructed2 => ref Schema.GetRef<HitGroup_t>(this.Handle, "CBaseModelEntity", "m_nDestructiblePartInitialStateDestructed2");
|
||||
|
||||
// m_nDestructiblePartInitialStateDestructed3
|
||||
[SchemaMember("CBaseModelEntity", "m_nDestructiblePartInitialStateDestructed3")]
|
||||
public ref HitGroup_t DestructiblePartInitialStateDestructed3 => ref Schema.GetRef<HitGroup_t>(this.Handle, "CBaseModelEntity", "m_nDestructiblePartInitialStateDestructed3");
|
||||
|
||||
// m_nDestructiblePartInitialStateDestructed4
|
||||
[SchemaMember("CBaseModelEntity", "m_nDestructiblePartInitialStateDestructed4")]
|
||||
public ref HitGroup_t DestructiblePartInitialStateDestructed4 => ref Schema.GetRef<HitGroup_t>(this.Handle, "CBaseModelEntity", "m_nDestructiblePartInitialStateDestructed4");
|
||||
|
||||
// m_nLastHitDestructiblePartIndex
|
||||
[SchemaMember("CBaseModelEntity", "m_nLastHitDestructiblePartIndex")]
|
||||
public ref Int32 LastHitDestructiblePartIndex => ref Schema.GetRef<Int32>(this.Handle, "CBaseModelEntity", "m_nLastHitDestructiblePartIndex");
|
||||
|
||||
// m_LastHitGroup
|
||||
[SchemaMember("CBaseModelEntity", "m_LastHitGroup")]
|
||||
public ref HitGroup_t LastHitGroup => ref Schema.GetRef<HitGroup_t>(this.Handle, "CBaseModelEntity", "m_LastHitGroup");
|
||||
|
||||
// m_nDestructiblePartInitialStateDestructed0
|
||||
[SchemaMember("CBaseModelEntity", "m_nDestructiblePartInitialStateDestructed0")]
|
||||
public ref HitGroup_t DestructiblePartInitialStateDestructed0 => ref Schema.GetRef<HitGroup_t>(this.Handle, "CBaseModelEntity", "m_nDestructiblePartInitialStateDestructed0");
|
||||
|
||||
// m_nDestructiblePartInitialStateDestructed1
|
||||
[SchemaMember("CBaseModelEntity", "m_nDestructiblePartInitialStateDestructed1")]
|
||||
public ref HitGroup_t DestructiblePartInitialStateDestructed1 => ref Schema.GetRef<HitGroup_t>(this.Handle, "CBaseModelEntity", "m_nDestructiblePartInitialStateDestructed1");
|
||||
|
||||
// m_nDestructiblePartInitialStateDestructed2
|
||||
[SchemaMember("CBaseModelEntity", "m_nDestructiblePartInitialStateDestructed2")]
|
||||
public ref HitGroup_t DestructiblePartInitialStateDestructed2 => ref Schema.GetRef<HitGroup_t>(this.Handle, "CBaseModelEntity", "m_nDestructiblePartInitialStateDestructed2");
|
||||
|
||||
// m_nDestructiblePartInitialStateDestructed3
|
||||
[SchemaMember("CBaseModelEntity", "m_nDestructiblePartInitialStateDestructed3")]
|
||||
public ref HitGroup_t DestructiblePartInitialStateDestructed3 => ref Schema.GetRef<HitGroup_t>(this.Handle, "CBaseModelEntity", "m_nDestructiblePartInitialStateDestructed3");
|
||||
|
||||
// m_nDestructiblePartInitialStateDestructed4
|
||||
[SchemaMember("CBaseModelEntity", "m_nDestructiblePartInitialStateDestructed4")]
|
||||
public ref HitGroup_t DestructiblePartInitialStateDestructed4 => ref Schema.GetRef<HitGroup_t>(this.Handle, "CBaseModelEntity", "m_nDestructiblePartInitialStateDestructed4");
|
||||
|
||||
// m_nLastHitDestructiblePartIndex
|
||||
[SchemaMember("CBaseModelEntity", "m_nLastHitDestructiblePartIndex")]
|
||||
public ref Int32 LastHitDestructiblePartIndex => ref Schema.GetRef<Int32>(this.Handle, "CBaseModelEntity", "m_nLastHitDestructiblePartIndex");
|
||||
|
||||
// m_LastHitGroup
|
||||
[SchemaMember("CBaseModelEntity", "m_LastHitGroup")]
|
||||
public ref HitGroup_t LastHitGroup => ref Schema.GetRef<HitGroup_t>(this.Handle, "CBaseModelEntity", "m_LastHitGroup");
|
||||
|
||||
// m_flDissolveStartTime
|
||||
[SchemaMember("CBaseModelEntity", "m_flDissolveStartTime")]
|
||||
public ref float DissolveStartTime => ref Schema.GetRef<float>(this.Handle, "CBaseModelEntity", "m_flDissolveStartTime");
|
||||
@@ -96,7 +96,7 @@ public partial class CBaseModelEntity : CBaseEntity
|
||||
|
||||
// m_Collision
|
||||
[SchemaMember("CBaseModelEntity", "m_Collision")]
|
||||
public CCollisionProperty Collision => Schema.GetDeclaredClass<CCollisionProperty>(this.Handle, "CBaseModelEntity", "m_Collision");
|
||||
public new CCollisionProperty Collision => Schema.GetDeclaredClass<CCollisionProperty>(this.Handle, "CBaseModelEntity", "m_Collision");
|
||||
|
||||
// m_Glow
|
||||
[SchemaMember("CBaseModelEntity", "m_Glow")]
|
||||
|
||||
@@ -82,10 +82,6 @@ public partial class CBasePlayerController : CBaseEntity
|
||||
[SchemaMember("CBasePlayerController", "m_bPredict")]
|
||||
public ref bool Predict => ref Schema.GetRef<bool>(this.Handle, "CBasePlayerController", "m_bPredict");
|
||||
|
||||
// m_bAutoKickDisabled
|
||||
[SchemaMember("CBasePlayerController", "m_bAutoKickDisabled")]
|
||||
public ref bool AutoKickDisabled => ref Schema.GetRef<bool>(this.Handle, "CBasePlayerController", "m_bAutoKickDisabled");
|
||||
|
||||
// m_bIsLowViolence
|
||||
[SchemaMember("CBasePlayerController", "m_bIsLowViolence")]
|
||||
public ref bool IsLowViolence => ref Schema.GetRef<bool>(this.Handle, "CBasePlayerController", "m_bIsLowViolence");
|
||||
|
||||
@@ -52,7 +52,7 @@ public partial class CBasePropDoor : CDynamicProp
|
||||
|
||||
// m_hBlocker
|
||||
[SchemaMember("CBasePropDoor", "m_hBlocker")]
|
||||
public CHandle<CBaseEntity> Blocker => Schema.GetDeclaredClass<CHandle<CBaseEntity>>(this.Handle, "CBasePropDoor", "m_hBlocker");
|
||||
public new CHandle<CBaseEntity> Blocker => Schema.GetDeclaredClass<CHandle<CBaseEntity>>(this.Handle, "CBasePropDoor", "m_hBlocker");
|
||||
|
||||
// m_bFirstBlocked
|
||||
[SchemaMember("CBasePropDoor", "m_bFirstBlocked")]
|
||||
|
||||
@@ -88,7 +88,7 @@ public partial class CBeam : CBaseModelEntity
|
||||
|
||||
// m_fSpeed
|
||||
[SchemaMember("CBeam", "m_fSpeed")]
|
||||
public ref float Speed => ref Schema.GetRef<float>(this.Handle, "CBeam", "m_fSpeed");
|
||||
public new ref float Speed => ref Schema.GetRef<float>(this.Handle, "CBeam", "m_fSpeed");
|
||||
|
||||
// m_flFrame
|
||||
[SchemaMember("CBeam", "m_flFrame")]
|
||||
|
||||
@@ -20,6 +20,6 @@ public partial class CBodyComponentPoint : CBodyComponent
|
||||
|
||||
// m_sceneNode
|
||||
[SchemaMember("CBodyComponentPoint", "m_sceneNode")]
|
||||
public CGameSceneNode SceneNode => Schema.GetDeclaredClass<CGameSceneNode>(this.Handle, "CBodyComponentPoint", "m_sceneNode");
|
||||
public new CGameSceneNode SceneNode => Schema.GetDeclaredClass<CGameSceneNode>(this.Handle, "CBodyComponentPoint", "m_sceneNode");
|
||||
|
||||
}
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
// <auto-generated />
|
||||
#nullable enable
|
||||
#pragma warning disable CS1591
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using CounterStrikeSharp;
|
||||
using CounterStrikeSharp.API.Modules.Events;
|
||||
using CounterStrikeSharp.API.Modules.Entities;
|
||||
using CounterStrikeSharp.API.Modules.Memory;
|
||||
using CounterStrikeSharp.API.Modules.Utils;
|
||||
using CounterStrikeSharp.API.Core.Attributes;
|
||||
|
||||
namespace CounterStrikeSharp.API.Core;
|
||||
|
||||
public partial class CBreachCharge : CCSWeaponBase
|
||||
{
|
||||
public CBreachCharge (IntPtr pointer) : base(pointer) {}
|
||||
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
// <auto-generated />
|
||||
#nullable enable
|
||||
#pragma warning disable CS1591
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using CounterStrikeSharp;
|
||||
using CounterStrikeSharp.API.Modules.Events;
|
||||
using CounterStrikeSharp.API.Modules.Entities;
|
||||
using CounterStrikeSharp.API.Modules.Memory;
|
||||
using CounterStrikeSharp.API.Modules.Utils;
|
||||
using CounterStrikeSharp.API.Core.Attributes;
|
||||
|
||||
namespace CounterStrikeSharp.API.Core;
|
||||
|
||||
public partial class CBreachChargeProjectile : CBaseGrenade
|
||||
{
|
||||
public CBreachChargeProjectile (IntPtr pointer) : base(pointer) {}
|
||||
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
// <auto-generated />
|
||||
#nullable enable
|
||||
#pragma warning disable CS1591
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using CounterStrikeSharp;
|
||||
using CounterStrikeSharp.API.Modules.Events;
|
||||
using CounterStrikeSharp.API.Modules.Entities;
|
||||
using CounterStrikeSharp.API.Modules.Memory;
|
||||
using CounterStrikeSharp.API.Modules.Utils;
|
||||
using CounterStrikeSharp.API.Core.Attributes;
|
||||
|
||||
namespace CounterStrikeSharp.API.Core;
|
||||
|
||||
public partial class CBumpMine : CCSWeaponBase
|
||||
{
|
||||
public CBumpMine (IntPtr pointer) : base(pointer) {}
|
||||
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
// <auto-generated />
|
||||
#nullable enable
|
||||
#pragma warning disable CS1591
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using CounterStrikeSharp;
|
||||
using CounterStrikeSharp.API.Modules.Events;
|
||||
using CounterStrikeSharp.API.Modules.Entities;
|
||||
using CounterStrikeSharp.API.Modules.Memory;
|
||||
using CounterStrikeSharp.API.Modules.Utils;
|
||||
using CounterStrikeSharp.API.Core.Attributes;
|
||||
|
||||
namespace CounterStrikeSharp.API.Core;
|
||||
|
||||
public partial class CBumpMineProjectile : CBaseGrenade
|
||||
{
|
||||
public CBumpMineProjectile (IntPtr pointer) : base(pointer) {}
|
||||
|
||||
}
|
||||
@@ -286,10 +286,6 @@ public partial class CCSGameRules : CTeamplayRules
|
||||
[SchemaMember("CCSGameRules", "m_flNextRespawnWave")]
|
||||
public Span<float> NextRespawnWave => Schema.GetFixedArray<float>(this.Handle, "CCSGameRules", "m_flNextRespawnWave", 32);
|
||||
|
||||
// m_nServerQuestID
|
||||
[SchemaMember("CCSGameRules", "m_nServerQuestID")]
|
||||
public ref Int32 ServerQuestID => ref Schema.GetRef<Int32>(this.Handle, "CCSGameRules", "m_nServerQuestID");
|
||||
|
||||
// m_vMinimapMins
|
||||
[SchemaMember("CCSGameRules", "m_vMinimapMins")]
|
||||
public Vector MinimapMins => Schema.GetDeclaredClass<Vector>(this.Handle, "CCSGameRules", "m_vMinimapMins");
|
||||
@@ -302,9 +298,9 @@ public partial class CCSGameRules : CTeamplayRules
|
||||
[SchemaMember("CCSGameRules", "m_MinimapVerticalSectionHeights")]
|
||||
public Span<float> MinimapVerticalSectionHeights => Schema.GetFixedArray<float>(this.Handle, "CCSGameRules", "m_MinimapVerticalSectionHeights", 8);
|
||||
|
||||
// m_bSpawnedTerrorHuntHeavy
|
||||
[SchemaMember("CCSGameRules", "m_bSpawnedTerrorHuntHeavy")]
|
||||
public ref bool SpawnedTerrorHuntHeavy => ref Schema.GetRef<bool>(this.Handle, "CCSGameRules", "m_bSpawnedTerrorHuntHeavy");
|
||||
// m_ullLocalMatchID
|
||||
[SchemaMember("CCSGameRules", "m_ullLocalMatchID")]
|
||||
public ref UInt64 UllLocalMatchID => ref Schema.GetRef<UInt64>(this.Handle, "CCSGameRules", "m_ullLocalMatchID");
|
||||
|
||||
// m_nEndMatchMapGroupVoteTypes
|
||||
[SchemaMember("CCSGameRules", "m_nEndMatchMapGroupVoteTypes")]
|
||||
|
||||
@@ -42,6 +42,10 @@ public partial class CCSPlayerController : CBasePlayerController
|
||||
[SchemaMember("CCSPlayerController", "m_bHasCommunicationAbuseMute")]
|
||||
public ref bool HasCommunicationAbuseMute => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerController", "m_bHasCommunicationAbuseMute");
|
||||
|
||||
// m_uiCommunicationMuteFlags
|
||||
[SchemaMember("CCSPlayerController", "m_uiCommunicationMuteFlags")]
|
||||
public ref UInt32 UiCommunicationMuteFlags => ref Schema.GetRef<UInt32>(this.Handle, "CCSPlayerController", "m_uiCommunicationMuteFlags");
|
||||
|
||||
// m_szCrosshairCodes
|
||||
[SchemaMember("CCSPlayerController", "m_szCrosshairCodes")]
|
||||
public string CrosshairCodes
|
||||
@@ -98,10 +102,10 @@ public partial class CCSPlayerController : CBasePlayerController
|
||||
[SchemaMember("CCSPlayerController", "m_bRemoveAllItemsOnNextRoundReset")]
|
||||
public ref bool RemoveAllItemsOnNextRoundReset => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerController", "m_bRemoveAllItemsOnNextRoundReset");
|
||||
|
||||
// m_flLastJoinTeamTime
|
||||
[SchemaMember("CCSPlayerController", "m_flLastJoinTeamTime")]
|
||||
public ref float LastJoinTeamTime => ref Schema.GetRef<float>(this.Handle, "CCSPlayerController", "m_flLastJoinTeamTime");
|
||||
|
||||
// m_flLastJoinTeamTime
|
||||
[SchemaMember("CCSPlayerController", "m_flLastJoinTeamTime")]
|
||||
public ref float LastJoinTeamTime => ref Schema.GetRef<float>(this.Handle, "CCSPlayerController", "m_flLastJoinTeamTime");
|
||||
|
||||
// m_szClan
|
||||
[SchemaMember("CCSPlayerController", "m_szClan")]
|
||||
public string Clan
|
||||
@@ -162,6 +166,10 @@ public partial class CCSPlayerController : CBasePlayerController
|
||||
[SchemaMember("CCSPlayerController", "m_unActiveQuestId")]
|
||||
public ref UInt16 ActiveQuestId => ref Schema.GetRef<UInt16>(this.Handle, "CCSPlayerController", "m_unActiveQuestId");
|
||||
|
||||
// m_rtActiveMissionPeriod
|
||||
[SchemaMember("CCSPlayerController", "m_rtActiveMissionPeriod")]
|
||||
public ref UInt32 RtActiveMissionPeriod => ref Schema.GetRef<UInt32>(this.Handle, "CCSPlayerController", "m_rtActiveMissionPeriod");
|
||||
|
||||
// m_unPlayerTvControlFlags
|
||||
[SchemaMember("CCSPlayerController", "m_unPlayerTvControlFlags")]
|
||||
public ref UInt32 PlayerTvControlFlags => ref Schema.GetRef<UInt32>(this.Handle, "CCSPlayerController", "m_unPlayerTvControlFlags");
|
||||
@@ -178,6 +186,10 @@ public partial class CCSPlayerController : CBasePlayerController
|
||||
[SchemaMember("CCSPlayerController", "m_uiAbandonRecordedReason")]
|
||||
public ref UInt32 UiAbandonRecordedReason => ref Schema.GetRef<UInt32>(this.Handle, "CCSPlayerController", "m_uiAbandonRecordedReason");
|
||||
|
||||
// m_eNetworkDisconnectionReason
|
||||
[SchemaMember("CCSPlayerController", "m_eNetworkDisconnectionReason")]
|
||||
public ref UInt32 NetworkDisconnectionReason => ref Schema.GetRef<UInt32>(this.Handle, "CCSPlayerController", "m_eNetworkDisconnectionReason");
|
||||
|
||||
// m_bCannotBeKicked
|
||||
[SchemaMember("CCSPlayerController", "m_bCannotBeKicked")]
|
||||
public ref bool CannotBeKicked => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerController", "m_bCannotBeKicked");
|
||||
@@ -294,17 +306,17 @@ public partial class CCSPlayerController : CBasePlayerController
|
||||
[SchemaMember("CCSPlayerController", "m_iRoundsWon")]
|
||||
public ref Int32 RoundsWon => ref Schema.GetRef<Int32>(this.Handle, "CCSPlayerController", "m_iRoundsWon");
|
||||
|
||||
// m_recentKillQueue
|
||||
[SchemaMember("CCSPlayerController", "m_recentKillQueue")]
|
||||
public Span<byte> RecentKillQueue => Schema.GetFixedArray<byte>(this.Handle, "CCSPlayerController", "m_recentKillQueue", 8);
|
||||
|
||||
// m_nFirstKill
|
||||
[SchemaMember("CCSPlayerController", "m_nFirstKill")]
|
||||
public ref byte FirstKill => ref Schema.GetRef<byte>(this.Handle, "CCSPlayerController", "m_nFirstKill");
|
||||
|
||||
// m_nKillCount
|
||||
[SchemaMember("CCSPlayerController", "m_nKillCount")]
|
||||
public ref byte KillCount => ref Schema.GetRef<byte>(this.Handle, "CCSPlayerController", "m_nKillCount");
|
||||
// m_recentKillQueue
|
||||
[SchemaMember("CCSPlayerController", "m_recentKillQueue")]
|
||||
public Span<byte> RecentKillQueue => Schema.GetFixedArray<byte>(this.Handle, "CCSPlayerController", "m_recentKillQueue", 8);
|
||||
|
||||
// m_nFirstKill
|
||||
[SchemaMember("CCSPlayerController", "m_nFirstKill")]
|
||||
public ref byte FirstKill => ref Schema.GetRef<byte>(this.Handle, "CCSPlayerController", "m_nFirstKill");
|
||||
|
||||
// m_nKillCount
|
||||
[SchemaMember("CCSPlayerController", "m_nKillCount")]
|
||||
public ref byte KillCount => ref Schema.GetRef<byte>(this.Handle, "CCSPlayerController", "m_nKillCount");
|
||||
|
||||
// m_bMvpNoMusic
|
||||
[SchemaMember("CCSPlayerController", "m_bMvpNoMusic")]
|
||||
@@ -382,8 +394,8 @@ public partial class CCSPlayerController : CBasePlayerController
|
||||
[SchemaMember("CCSPlayerController", "m_nNonSuspiciousHitStreak")]
|
||||
public ref UInt32 NonSuspiciousHitStreak => ref Schema.GetRef<UInt32>(this.Handle, "CCSPlayerController", "m_nNonSuspiciousHitStreak");
|
||||
|
||||
// m_bFireBulletsSeedSynchronized
|
||||
[SchemaMember("CCSPlayerController", "m_bFireBulletsSeedSynchronized")]
|
||||
public ref bool FireBulletsSeedSynchronized => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerController", "m_bFireBulletsSeedSynchronized");
|
||||
|
||||
// m_bFireBulletsSeedSynchronized
|
||||
[SchemaMember("CCSPlayerController", "m_bFireBulletsSeedSynchronized")]
|
||||
public ref bool FireBulletsSeedSynchronized => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerController", "m_bFireBulletsSeedSynchronized");
|
||||
|
||||
}
|
||||
|
||||
@@ -26,8 +26,4 @@ public partial class CCSPlayer_ItemServices : CPlayer_ItemServices
|
||||
[SchemaMember("CCSPlayer_ItemServices", "m_bHasHelmet")]
|
||||
public ref bool HasHelmet => ref Schema.GetRef<bool>(this.Handle, "CCSPlayer_ItemServices", "m_bHasHelmet");
|
||||
|
||||
// m_bHasHeavyArmor
|
||||
[SchemaMember("CCSPlayer_ItemServices", "m_bHasHeavyArmor")]
|
||||
public ref bool HasHeavyArmor => ref Schema.GetRef<bool>(this.Handle, "CCSPlayer_ItemServices", "m_bHasHeavyArmor");
|
||||
|
||||
}
|
||||
|
||||
@@ -170,12 +170,12 @@ public partial class CCSPlayer_MovementServices : CPlayer_MovementServices_Human
|
||||
[SchemaMember("CCSPlayer_MovementServices", "m_flMaxJumpHeightLastJump")]
|
||||
public ref float MaxJumpHeightLastJump => ref Schema.GetRef<float>(this.Handle, "CCSPlayer_MovementServices", "m_flMaxJumpHeightLastJump");
|
||||
|
||||
// m_flStaminaAtJumpStart
|
||||
[SchemaMember("CCSPlayer_MovementServices", "m_flStaminaAtJumpStart")]
|
||||
public ref float StaminaAtJumpStart => ref Schema.GetRef<float>(this.Handle, "CCSPlayer_MovementServices", "m_flStaminaAtJumpStart");
|
||||
|
||||
// m_flAccumulatedJumpError
|
||||
[SchemaMember("CCSPlayer_MovementServices", "m_flAccumulatedJumpError")]
|
||||
public ref float AccumulatedJumpError => ref Schema.GetRef<float>(this.Handle, "CCSPlayer_MovementServices", "m_flAccumulatedJumpError");
|
||||
|
||||
// m_flStaminaAtJumpStart
|
||||
[SchemaMember("CCSPlayer_MovementServices", "m_flStaminaAtJumpStart")]
|
||||
public ref float StaminaAtJumpStart => ref Schema.GetRef<float>(this.Handle, "CCSPlayer_MovementServices", "m_flStaminaAtJumpStart");
|
||||
|
||||
// m_flAccumulatedJumpError
|
||||
[SchemaMember("CCSPlayer_MovementServices", "m_flAccumulatedJumpError")]
|
||||
public ref float AccumulatedJumpError => ref Schema.GetRef<float>(this.Handle, "CCSPlayer_MovementServices", "m_flAccumulatedJumpError");
|
||||
|
||||
}
|
||||
|
||||
@@ -86,10 +86,6 @@ public partial class CCSWeaponBase : CBasePlayerWeapon
|
||||
[SchemaMember("CCSWeaponBase", "m_flLastTimeInAir")]
|
||||
public ref float LastTimeInAir => ref Schema.GetRef<float>(this.Handle, "CCSWeaponBase", "m_flLastTimeInAir");
|
||||
|
||||
// m_flLastDeployTime
|
||||
[SchemaMember("CCSWeaponBase", "m_flLastDeployTime")]
|
||||
public ref float LastDeployTime => ref Schema.GetRef<float>(this.Handle, "CCSWeaponBase", "m_flLastDeployTime");
|
||||
|
||||
// m_nLastEmptySoundCmdNum
|
||||
[SchemaMember("CCSWeaponBase", "m_nLastEmptySoundCmdNum")]
|
||||
public ref Int32 LastEmptySoundCmdNum => ref Schema.GetRef<Int32>(this.Handle, "CCSWeaponBase", "m_nLastEmptySoundCmdNum");
|
||||
@@ -222,10 +218,10 @@ public partial class CCSWeaponBase : CBasePlayerWeapon
|
||||
[SchemaMember("CCSWeaponBase", "m_nextPrevOwnerTouchTime")]
|
||||
public ref float NextPrevOwnerTouchTime => ref Schema.GetRef<float>(this.Handle, "CCSWeaponBase", "m_nextPrevOwnerTouchTime");
|
||||
|
||||
// m_nextPrevOwnerUseTime
|
||||
[SchemaMember("CCSWeaponBase", "m_nextPrevOwnerUseTime")]
|
||||
public ref float NextPrevOwnerUseTime => ref Schema.GetRef<float>(this.Handle, "CCSWeaponBase", "m_nextPrevOwnerUseTime");
|
||||
|
||||
// m_nextPrevOwnerUseTime
|
||||
[SchemaMember("CCSWeaponBase", "m_nextPrevOwnerUseTime")]
|
||||
public ref float NextPrevOwnerUseTime => ref Schema.GetRef<float>(this.Handle, "CCSWeaponBase", "m_nextPrevOwnerUseTime");
|
||||
|
||||
// m_hPrevOwner
|
||||
[SchemaMember("CCSWeaponBase", "m_hPrevOwner")]
|
||||
public CHandle<CCSPlayerPawn> PrevOwner => Schema.GetDeclaredClass<CHandle<CCSPlayerPawn>>(this.Handle, "CCSWeaponBase", "m_hPrevOwner");
|
||||
|
||||
@@ -58,10 +58,10 @@ public partial class CDamageRecord : NativeObject
|
||||
[SchemaMember("CDamageRecord", "m_RecipientXuid")]
|
||||
public ref UInt64 RecipientXuid => ref Schema.GetRef<UInt64>(this.Handle, "CDamageRecord", "m_RecipientXuid");
|
||||
|
||||
// m_iBulletsDamage
|
||||
[SchemaMember("CDamageRecord", "m_iBulletsDamage")]
|
||||
public ref Int32 BulletsDamage => ref Schema.GetRef<Int32>(this.Handle, "CDamageRecord", "m_iBulletsDamage");
|
||||
|
||||
// m_iBulletsDamage
|
||||
[SchemaMember("CDamageRecord", "m_iBulletsDamage")]
|
||||
public ref Int32 BulletsDamage => ref Schema.GetRef<Int32>(this.Handle, "CDamageRecord", "m_iBulletsDamage");
|
||||
|
||||
// m_iDamage
|
||||
[SchemaMember("CDamageRecord", "m_iDamage")]
|
||||
public ref Int32 Damage => ref Schema.GetRef<Int32>(this.Handle, "CDamageRecord", "m_iDamage");
|
||||
|
||||
@@ -36,7 +36,7 @@ public partial class CEnvBeam : CBeam
|
||||
|
||||
// m_iszEndEntity
|
||||
[SchemaMember("CEnvBeam", "m_iszEndEntity")]
|
||||
public string EndEntity
|
||||
public new string EndEntity
|
||||
{
|
||||
get { return Schema.GetUtf8String(this.Handle, "CEnvBeam", "m_iszEndEntity"); }
|
||||
set { Schema.SetString(this.Handle, "CEnvBeam", "m_iszEndEntity", value); }
|
||||
@@ -56,7 +56,7 @@ public partial class CEnvBeam : CBeam
|
||||
|
||||
// m_speed
|
||||
[SchemaMember("CEnvBeam", "m_speed")]
|
||||
public ref Int32 Speed => ref Schema.GetRef<Int32>(this.Handle, "CEnvBeam", "m_speed");
|
||||
public new ref Int32 Speed => ref Schema.GetRef<Int32>(this.Handle, "CEnvBeam", "m_speed");
|
||||
|
||||
// m_restrike
|
||||
[SchemaMember("CEnvBeam", "m_restrike")]
|
||||
|
||||
@@ -44,6 +44,6 @@ public partial class CEnvLaser : CBeam
|
||||
|
||||
// m_flStartFrame
|
||||
[SchemaMember("CEnvLaser", "m_flStartFrame")]
|
||||
public ref float StartFrame => ref Schema.GetRef<float>(this.Handle, "CEnvLaser", "m_flStartFrame");
|
||||
public new ref float StartFrame => ref Schema.GetRef<float>(this.Handle, "CEnvLaser", "m_flStartFrame");
|
||||
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ using CounterStrikeSharp.API.Core.Attributes;
|
||||
|
||||
namespace CounterStrikeSharp.API.Core;
|
||||
|
||||
public partial class CEnvSoundscape : CBaseEntity
|
||||
public partial class CEnvSoundscape : CBaseEntity
|
||||
{
|
||||
public CEnvSoundscape (IntPtr pointer) : base(pointer) {}
|
||||
|
||||
@@ -58,16 +58,16 @@ public partial class CEnvSoundscape : CBaseEntity
|
||||
[SchemaMember("CEnvSoundscape", "m_bDisabled")]
|
||||
public ref bool Disabled => ref Schema.GetRef<bool>(this.Handle, "CEnvSoundscape", "m_bDisabled");
|
||||
|
||||
// m_soundscapeName
|
||||
[SchemaMember("CEnvSoundscape", "m_soundscapeName")]
|
||||
public string SoundscapeName
|
||||
{
|
||||
get { return Schema.GetUtf8String(this.Handle, "CEnvSoundscape", "m_soundscapeName"); }
|
||||
set { Schema.SetString(this.Handle, "CEnvSoundscape", "m_soundscapeName", value); }
|
||||
}
|
||||
|
||||
// m_soundEventHash
|
||||
[SchemaMember("CEnvSoundscape", "m_soundEventHash")]
|
||||
public ref UInt32 SoundEventHash => ref Schema.GetRef<UInt32>(this.Handle, "CEnvSoundscape", "m_soundEventHash");
|
||||
|
||||
// m_soundscapeName
|
||||
[SchemaMember("CEnvSoundscape", "m_soundscapeName")]
|
||||
public string SoundscapeName
|
||||
{
|
||||
get { return Schema.GetUtf8String(this.Handle, "CEnvSoundscape", "m_soundscapeName"); }
|
||||
set { Schema.SetString(this.Handle, "CEnvSoundscape", "m_soundscapeName", value); }
|
||||
}
|
||||
|
||||
// m_soundEventHash
|
||||
[SchemaMember("CEnvSoundscape", "m_soundEventHash")]
|
||||
public ref UInt32 SoundEventHash => ref Schema.GetRef<UInt32>(this.Handle, "CEnvSoundscape", "m_soundEventHash");
|
||||
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ public partial class CFish : CBaseAnimGraph
|
||||
|
||||
// m_speed
|
||||
[SchemaMember("CFish", "m_speed")]
|
||||
public ref float Speed => ref Schema.GetRef<float>(this.Handle, "CFish", "m_speed");
|
||||
public new ref float Speed => ref Schema.GetRef<float>(this.Handle, "CFish", "m_speed");
|
||||
|
||||
// m_desiredSpeed
|
||||
[SchemaMember("CFish", "m_desiredSpeed")]
|
||||
|
||||
@@ -32,7 +32,7 @@ public partial class CFishPool : CBaseEntity
|
||||
|
||||
// m_waterLevel
|
||||
[SchemaMember("CFishPool", "m_waterLevel")]
|
||||
public ref float WaterLevel => ref Schema.GetRef<float>(this.Handle, "CFishPool", "m_waterLevel");
|
||||
public new ref float WaterLevel => ref Schema.GetRef<float>(this.Handle, "CFishPool", "m_waterLevel");
|
||||
|
||||
// m_isDormant
|
||||
[SchemaMember("CFishPool", "m_isDormant")]
|
||||
|
||||
@@ -1,49 +0,0 @@
|
||||
// <auto-generated />
|
||||
#nullable enable
|
||||
#pragma warning disable CS1591
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using CounterStrikeSharp;
|
||||
using CounterStrikeSharp.API.Modules.Events;
|
||||
using CounterStrikeSharp.API.Modules.Entities;
|
||||
using CounterStrikeSharp.API.Modules.Memory;
|
||||
using CounterStrikeSharp.API.Modules.Utils;
|
||||
using CounterStrikeSharp.API.Core.Attributes;
|
||||
|
||||
namespace CounterStrikeSharp.API.Core;
|
||||
|
||||
public partial class CFists : CCSWeaponBase
|
||||
{
|
||||
public CFists (IntPtr pointer) : base(pointer) {}
|
||||
|
||||
// m_bPlayingUninterruptableAct
|
||||
[SchemaMember("CFists", "m_bPlayingUninterruptableAct")]
|
||||
public ref bool PlayingUninterruptableAct => ref Schema.GetRef<bool>(this.Handle, "CFists", "m_bPlayingUninterruptableAct");
|
||||
|
||||
// m_nUninterruptableActivity
|
||||
[SchemaMember("CFists", "m_nUninterruptableActivity")]
|
||||
public ref PlayerAnimEvent_t UninterruptableActivity => ref Schema.GetRef<PlayerAnimEvent_t>(this.Handle, "CFists", "m_nUninterruptableActivity");
|
||||
|
||||
// m_bRestorePrevWep
|
||||
[SchemaMember("CFists", "m_bRestorePrevWep")]
|
||||
public ref bool RestorePrevWep => ref Schema.GetRef<bool>(this.Handle, "CFists", "m_bRestorePrevWep");
|
||||
|
||||
// m_hWeaponBeforePrevious
|
||||
[SchemaMember("CFists", "m_hWeaponBeforePrevious")]
|
||||
public CHandle<CBasePlayerWeapon> WeaponBeforePrevious => Schema.GetDeclaredClass<CHandle<CBasePlayerWeapon>>(this.Handle, "CFists", "m_hWeaponBeforePrevious");
|
||||
|
||||
// m_hWeaponPrevious
|
||||
[SchemaMember("CFists", "m_hWeaponPrevious")]
|
||||
public CHandle<CBasePlayerWeapon> WeaponPrevious => Schema.GetDeclaredClass<CHandle<CBasePlayerWeapon>>(this.Handle, "CFists", "m_hWeaponPrevious");
|
||||
|
||||
// m_bDelayedHardPunchIncoming
|
||||
[SchemaMember("CFists", "m_bDelayedHardPunchIncoming")]
|
||||
public ref bool DelayedHardPunchIncoming => ref Schema.GetRef<bool>(this.Handle, "CFists", "m_bDelayedHardPunchIncoming");
|
||||
|
||||
// m_bDestroyAfterTaunt
|
||||
[SchemaMember("CFists", "m_bDestroyAfterTaunt")]
|
||||
public ref bool DestroyAfterTaunt => ref Schema.GetRef<bool>(this.Handle, "CFists", "m_bDestroyAfterTaunt");
|
||||
|
||||
}
|
||||
@@ -44,7 +44,7 @@ public partial class CFuncMover : CBaseModelEntity
|
||||
|
||||
// m_eMoveType
|
||||
[SchemaMember("CFuncMover", "m_eMoveType")]
|
||||
public ref CFuncMoverMove_t MoveType => ref Schema.GetRef<CFuncMoverMove_t>(this.Handle, "CFuncMover", "m_eMoveType");
|
||||
public new ref CFuncMoverMove_t MoveType => ref Schema.GetRef<CFuncMoverMove_t>(this.Handle, "CFuncMover", "m_eMoveType");
|
||||
|
||||
// m_bIsReversing
|
||||
[SchemaMember("CFuncMover", "m_bIsReversing")]
|
||||
@@ -52,7 +52,7 @@ public partial class CFuncMover : CBaseModelEntity
|
||||
|
||||
// m_vTarget
|
||||
[SchemaMember("CFuncMover", "m_vTarget")]
|
||||
public Vector Target => Schema.GetDeclaredClass<Vector>(this.Handle, "CFuncMover", "m_vTarget");
|
||||
public new Vector Target => Schema.GetDeclaredClass<Vector>(this.Handle, "CFuncMover", "m_vTarget");
|
||||
|
||||
// m_flStartSpeed
|
||||
[SchemaMember("CFuncMover", "m_flStartSpeed")]
|
||||
|
||||
@@ -44,6 +44,6 @@ public partial class CInstancedSceneEntity : CSceneEntity
|
||||
|
||||
// m_hTarget
|
||||
[SchemaMember("CInstancedSceneEntity", "m_hTarget")]
|
||||
public CHandle<CBaseEntity> Target => Schema.GetDeclaredClass<CHandle<CBaseEntity>>(this.Handle, "CInstancedSceneEntity", "m_hTarget");
|
||||
public new CHandle<CBaseEntity> Target => Schema.GetDeclaredClass<CHandle<CBaseEntity>>(this.Handle, "CInstancedSceneEntity", "m_hTarget");
|
||||
|
||||
}
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
// <auto-generated />
|
||||
#nullable enable
|
||||
#pragma warning disable CS1591
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using CounterStrikeSharp;
|
||||
using CounterStrikeSharp.API.Modules.Events;
|
||||
using CounterStrikeSharp.API.Modules.Entities;
|
||||
using CounterStrikeSharp.API.Modules.Memory;
|
||||
using CounterStrikeSharp.API.Modules.Utils;
|
||||
using CounterStrikeSharp.API.Core.Attributes;
|
||||
|
||||
namespace CounterStrikeSharp.API.Core;
|
||||
|
||||
public partial class CItemHeavyAssaultSuit : CItemAssaultSuit
|
||||
{
|
||||
public CItemHeavyAssaultSuit (IntPtr pointer) : base(pointer) {}
|
||||
|
||||
}
|
||||
@@ -52,7 +52,7 @@ public partial class CLogicMeasureMovement : CLogicalEntity
|
||||
|
||||
// m_hTarget
|
||||
[SchemaMember("CLogicMeasureMovement", "m_hTarget")]
|
||||
public CHandle<CBaseEntity> Target => Schema.GetDeclaredClass<CHandle<CBaseEntity>>(this.Handle, "CLogicMeasureMovement", "m_hTarget");
|
||||
public new CHandle<CBaseEntity> Target => Schema.GetDeclaredClass<CHandle<CBaseEntity>>(this.Handle, "CLogicMeasureMovement", "m_hTarget");
|
||||
|
||||
// m_hTargetReference
|
||||
[SchemaMember("CLogicMeasureMovement", "m_hTargetReference")]
|
||||
|
||||
@@ -50,8 +50,8 @@ public partial class CMapInfo : CPointEntity
|
||||
[SchemaMember("CMapInfo", "m_bFadePlayerVisibilityFarZ")]
|
||||
public ref bool FadePlayerVisibilityFarZ => ref Schema.GetRef<bool>(this.Handle, "CMapInfo", "m_bFadePlayerVisibilityFarZ");
|
||||
|
||||
// m_bRainTraceToSkyEnabled
|
||||
[SchemaMember("CMapInfo", "m_bRainTraceToSkyEnabled")]
|
||||
public ref bool RainTraceToSkyEnabled => ref Schema.GetRef<bool>(this.Handle, "CMapInfo", "m_bRainTraceToSkyEnabled");
|
||||
|
||||
// m_bRainTraceToSkyEnabled
|
||||
[SchemaMember("CMapInfo", "m_bRainTraceToSkyEnabled")]
|
||||
public ref bool RainTraceToSkyEnabled => ref Schema.GetRef<bool>(this.Handle, "CMapInfo", "m_bRainTraceToSkyEnabled");
|
||||
|
||||
}
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
// <auto-generated />
|
||||
#nullable enable
|
||||
#pragma warning disable CS1591
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using CounterStrikeSharp;
|
||||
using CounterStrikeSharp.API.Modules.Events;
|
||||
using CounterStrikeSharp.API.Modules.Entities;
|
||||
using CounterStrikeSharp.API.Modules.Memory;
|
||||
using CounterStrikeSharp.API.Modules.Utils;
|
||||
using CounterStrikeSharp.API.Core.Attributes;
|
||||
|
||||
namespace CounterStrikeSharp.API.Core;
|
||||
|
||||
public partial class CMelee : CCSWeaponBase
|
||||
{
|
||||
public CMelee (IntPtr pointer) : base(pointer) {}
|
||||
|
||||
}
|
||||
@@ -20,7 +20,7 @@ public partial class CPointEntityFinder : CBaseEntity
|
||||
|
||||
// m_hEntity
|
||||
[SchemaMember("CPointEntityFinder", "m_hEntity")]
|
||||
public CHandle<CBaseEntity> Entity => Schema.GetDeclaredClass<CHandle<CBaseEntity>>(this.Handle, "CPointEntityFinder", "m_hEntity");
|
||||
public new CHandle<CBaseEntity> Entity => Schema.GetDeclaredClass<CHandle<CBaseEntity>>(this.Handle, "CPointEntityFinder", "m_hEntity");
|
||||
|
||||
// m_iFilterName
|
||||
[SchemaMember("CPointEntityFinder", "m_iFilterName")]
|
||||
|
||||
@@ -34,14 +34,14 @@ public partial class CPointWorldText : CModelPointEntity
|
||||
set { Schema.SetStringBytes(this.Handle, "CPointWorldText", "m_FontName", value, 64); }
|
||||
}
|
||||
|
||||
// m_BackgroundMaterialName
|
||||
[SchemaMember("CPointWorldText", "m_BackgroundMaterialName")]
|
||||
public string BackgroundMaterialName
|
||||
{
|
||||
get { return Schema.GetString(this.Handle, "CPointWorldText", "m_BackgroundMaterialName"); }
|
||||
set { Schema.SetStringBytes(this.Handle, "CPointWorldText", "m_BackgroundMaterialName", value, 64); }
|
||||
}
|
||||
|
||||
// m_BackgroundMaterialName
|
||||
[SchemaMember("CPointWorldText", "m_BackgroundMaterialName")]
|
||||
public string BackgroundMaterialName
|
||||
{
|
||||
get { return Schema.GetString(this.Handle, "CPointWorldText", "m_BackgroundMaterialName"); }
|
||||
set { Schema.SetStringBytes(this.Handle, "CPointWorldText", "m_BackgroundMaterialName", value, 64); }
|
||||
}
|
||||
|
||||
// m_bEnabled
|
||||
[SchemaMember("CPointWorldText", "m_bEnabled")]
|
||||
public ref bool Enabled => ref Schema.GetRef<bool>(this.Handle, "CPointWorldText", "m_bEnabled");
|
||||
@@ -62,22 +62,22 @@ public partial class CPointWorldText : CModelPointEntity
|
||||
[SchemaMember("CPointWorldText", "m_flDepthOffset")]
|
||||
public ref float DepthOffset => ref Schema.GetRef<float>(this.Handle, "CPointWorldText", "m_flDepthOffset");
|
||||
|
||||
// m_bDrawBackground
|
||||
[SchemaMember("CPointWorldText", "m_bDrawBackground")]
|
||||
public ref bool DrawBackground => ref Schema.GetRef<bool>(this.Handle, "CPointWorldText", "m_bDrawBackground");
|
||||
|
||||
// m_flBackgroundBorderWidth
|
||||
[SchemaMember("CPointWorldText", "m_flBackgroundBorderWidth")]
|
||||
public ref float BackgroundBorderWidth => ref Schema.GetRef<float>(this.Handle, "CPointWorldText", "m_flBackgroundBorderWidth");
|
||||
|
||||
// m_flBackgroundBorderHeight
|
||||
[SchemaMember("CPointWorldText", "m_flBackgroundBorderHeight")]
|
||||
public ref float BackgroundBorderHeight => ref Schema.GetRef<float>(this.Handle, "CPointWorldText", "m_flBackgroundBorderHeight");
|
||||
|
||||
// m_flBackgroundWorldToUV
|
||||
[SchemaMember("CPointWorldText", "m_flBackgroundWorldToUV")]
|
||||
public ref float BackgroundWorldToUV => ref Schema.GetRef<float>(this.Handle, "CPointWorldText", "m_flBackgroundWorldToUV");
|
||||
|
||||
// m_bDrawBackground
|
||||
[SchemaMember("CPointWorldText", "m_bDrawBackground")]
|
||||
public ref bool DrawBackground => ref Schema.GetRef<bool>(this.Handle, "CPointWorldText", "m_bDrawBackground");
|
||||
|
||||
// m_flBackgroundBorderWidth
|
||||
[SchemaMember("CPointWorldText", "m_flBackgroundBorderWidth")]
|
||||
public ref float BackgroundBorderWidth => ref Schema.GetRef<float>(this.Handle, "CPointWorldText", "m_flBackgroundBorderWidth");
|
||||
|
||||
// m_flBackgroundBorderHeight
|
||||
[SchemaMember("CPointWorldText", "m_flBackgroundBorderHeight")]
|
||||
public ref float BackgroundBorderHeight => ref Schema.GetRef<float>(this.Handle, "CPointWorldText", "m_flBackgroundBorderHeight");
|
||||
|
||||
// m_flBackgroundWorldToUV
|
||||
[SchemaMember("CPointWorldText", "m_flBackgroundWorldToUV")]
|
||||
public ref float BackgroundWorldToUV => ref Schema.GetRef<float>(this.Handle, "CPointWorldText", "m_flBackgroundWorldToUV");
|
||||
|
||||
// m_Color
|
||||
[SchemaMember("CPointWorldText", "m_Color")]
|
||||
public Color Color
|
||||
|
||||
@@ -60,7 +60,7 @@ public partial class CPostProcessingVolume : CBaseTrigger
|
||||
|
||||
// m_bMaster
|
||||
[SchemaMember("CPostProcessingVolume", "m_bMaster")]
|
||||
public ref bool Master => ref Schema.GetRef<bool>(this.Handle, "CPostProcessingVolume", "m_bMaster");
|
||||
public new ref bool Master => ref Schema.GetRef<bool>(this.Handle, "CPostProcessingVolume", "m_bMaster");
|
||||
|
||||
// m_bExposureControl
|
||||
[SchemaMember("CPostProcessingVolume", "m_bExposureControl")]
|
||||
|
||||
@@ -30,8 +30,8 @@ public partial class CRagdollManager : CBaseEntity
|
||||
[SchemaMember("CRagdollManager", "m_bSaveImportant")]
|
||||
public ref bool SaveImportant => ref Schema.GetRef<bool>(this.Handle, "CRagdollManager", "m_bSaveImportant");
|
||||
|
||||
// m_bCanTakeDamage
|
||||
[SchemaMember("CRagdollManager", "m_bCanTakeDamage")]
|
||||
public ref bool CanTakeDamage => ref Schema.GetRef<bool>(this.Handle, "CRagdollManager", "m_bCanTakeDamage");
|
||||
|
||||
// m_bCanTakeDamage
|
||||
[SchemaMember("CRagdollManager", "m_bCanTakeDamage")]
|
||||
public ref bool CanTakeDamage => ref Schema.GetRef<bool>(this.Handle, "CRagdollManager", "m_bCanTakeDamage");
|
||||
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ public partial class CScriptedSequence : CBaseEntity
|
||||
|
||||
// m_iszEntity
|
||||
[SchemaMember("CScriptedSequence", "m_iszEntity")]
|
||||
public string Entity
|
||||
public new string Entity
|
||||
{
|
||||
get { return Schema.GetUtf8String(this.Handle, "CScriptedSequence", "m_iszEntity"); }
|
||||
set { Schema.SetString(this.Handle, "CScriptedSequence", "m_iszEntity", value); }
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
// <auto-generated />
|
||||
#nullable enable
|
||||
#pragma warning disable CS1591
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using CounterStrikeSharp;
|
||||
using CounterStrikeSharp.API.Modules.Events;
|
||||
using CounterStrikeSharp.API.Modules.Entities;
|
||||
using CounterStrikeSharp.API.Modules.Memory;
|
||||
using CounterStrikeSharp.API.Modules.Utils;
|
||||
using CounterStrikeSharp.API.Core.Attributes;
|
||||
|
||||
namespace CounterStrikeSharp.API.Core;
|
||||
|
||||
public partial class CSensorGrenade : CBaseCSGrenade
|
||||
{
|
||||
public CSensorGrenade (IntPtr pointer) : base(pointer) {}
|
||||
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
// <auto-generated />
|
||||
#nullable enable
|
||||
#pragma warning disable CS1591
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using CounterStrikeSharp;
|
||||
using CounterStrikeSharp.API.Modules.Events;
|
||||
using CounterStrikeSharp.API.Modules.Entities;
|
||||
using CounterStrikeSharp.API.Modules.Memory;
|
||||
using CounterStrikeSharp.API.Modules.Utils;
|
||||
using CounterStrikeSharp.API.Core.Attributes;
|
||||
|
||||
namespace CounterStrikeSharp.API.Core;
|
||||
|
||||
public partial class CSensorGrenadeProjectile : CBaseCSGrenadeProjectile
|
||||
{
|
||||
public CSensorGrenadeProjectile (IntPtr pointer) : base(pointer) {}
|
||||
|
||||
// m_fExpireTime
|
||||
[SchemaMember("CSensorGrenadeProjectile", "m_fExpireTime")]
|
||||
public ref float ExpireTime => ref Schema.GetRef<float>(this.Handle, "CSensorGrenadeProjectile", "m_fExpireTime");
|
||||
|
||||
// m_fNextDetectPlayerSound
|
||||
[SchemaMember("CSensorGrenadeProjectile", "m_fNextDetectPlayerSound")]
|
||||
public ref float NextDetectPlayerSound => ref Schema.GetRef<float>(this.Handle, "CSensorGrenadeProjectile", "m_fNextDetectPlayerSound");
|
||||
|
||||
// m_hDisplayGrenade
|
||||
[SchemaMember("CSensorGrenadeProjectile", "m_hDisplayGrenade")]
|
||||
public CHandle<CBaseEntity> DisplayGrenade => Schema.GetDeclaredClass<CHandle<CBaseEntity>>(this.Handle, "CSensorGrenadeProjectile", "m_hDisplayGrenade");
|
||||
|
||||
}
|
||||
@@ -42,14 +42,14 @@ public partial class CSmokeGrenadeProjectile : CBaseCSGrenadeProjectile
|
||||
[SchemaMember("CSmokeGrenadeProjectile", "m_VoxelFrameData")]
|
||||
public NetworkedVector<byte> VoxelFrameData => Schema.GetDeclaredClass<NetworkedVector<byte>>(this.Handle, "CSmokeGrenadeProjectile", "m_VoxelFrameData");
|
||||
|
||||
// m_nVoxelFrameDataSize
|
||||
[SchemaMember("CSmokeGrenadeProjectile", "m_nVoxelFrameDataSize")]
|
||||
public ref Int32 VoxelFrameDataSize => ref Schema.GetRef<Int32>(this.Handle, "CSmokeGrenadeProjectile", "m_nVoxelFrameDataSize");
|
||||
|
||||
// m_nVoxelUpdate
|
||||
[SchemaMember("CSmokeGrenadeProjectile", "m_nVoxelUpdate")]
|
||||
public ref Int32 VoxelUpdate => ref Schema.GetRef<Int32>(this.Handle, "CSmokeGrenadeProjectile", "m_nVoxelUpdate");
|
||||
|
||||
// m_nVoxelFrameDataSize
|
||||
[SchemaMember("CSmokeGrenadeProjectile", "m_nVoxelFrameDataSize")]
|
||||
public ref Int32 VoxelFrameDataSize => ref Schema.GetRef<Int32>(this.Handle, "CSmokeGrenadeProjectile", "m_nVoxelFrameDataSize");
|
||||
|
||||
// m_nVoxelUpdate
|
||||
[SchemaMember("CSmokeGrenadeProjectile", "m_nVoxelUpdate")]
|
||||
public ref Int32 VoxelUpdate => ref Schema.GetRef<Int32>(this.Handle, "CSmokeGrenadeProjectile", "m_nVoxelUpdate");
|
||||
|
||||
// m_flLastBounce
|
||||
[SchemaMember("CSmokeGrenadeProjectile", "m_flLastBounce")]
|
||||
public ref float LastBounce => ref Schema.GetRef<float>(this.Handle, "CSmokeGrenadeProjectile", "m_flLastBounce");
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
// <auto-generated />
|
||||
#nullable enable
|
||||
#pragma warning disable CS1591
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using CounterStrikeSharp;
|
||||
using CounterStrikeSharp.API.Modules.Events;
|
||||
using CounterStrikeSharp.API.Modules.Entities;
|
||||
using CounterStrikeSharp.API.Modules.Memory;
|
||||
using CounterStrikeSharp.API.Modules.Utils;
|
||||
using CounterStrikeSharp.API.Core.Attributes;
|
||||
|
||||
namespace CounterStrikeSharp.API.Core;
|
||||
|
||||
public partial class CTablet : CCSWeaponBase
|
||||
{
|
||||
public CTablet (IntPtr pointer) : base(pointer) {}
|
||||
|
||||
}
|
||||
@@ -20,7 +20,7 @@ public partial class CTriggerPhysics : CBaseTrigger
|
||||
|
||||
// m_gravityScale
|
||||
[SchemaMember("CTriggerPhysics", "m_gravityScale")]
|
||||
public ref float GravityScale => ref Schema.GetRef<float>(this.Handle, "CTriggerPhysics", "m_gravityScale");
|
||||
public new ref float GravityScale => ref Schema.GetRef<float>(this.Handle, "CTriggerPhysics", "m_gravityScale");
|
||||
|
||||
// m_linearLimit
|
||||
[SchemaMember("CTriggerPhysics", "m_linearLimit")]
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
// <auto-generated />
|
||||
#nullable enable
|
||||
#pragma warning disable CS1591
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using CounterStrikeSharp;
|
||||
using CounterStrikeSharp.API.Modules.Events;
|
||||
using CounterStrikeSharp.API.Modules.Entities;
|
||||
using CounterStrikeSharp.API.Modules.Memory;
|
||||
using CounterStrikeSharp.API.Modules.Utils;
|
||||
using CounterStrikeSharp.API.Core.Attributes;
|
||||
|
||||
namespace CounterStrikeSharp.API.Core;
|
||||
|
||||
public partial class CTriggerTripWire : CBaseTrigger
|
||||
{
|
||||
public CTriggerTripWire (IntPtr pointer) : base(pointer) {}
|
||||
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
// <auto-generated />
|
||||
#nullable enable
|
||||
#pragma warning disable CS1591
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using CounterStrikeSharp;
|
||||
using CounterStrikeSharp.API.Modules.Events;
|
||||
using CounterStrikeSharp.API.Modules.Entities;
|
||||
using CounterStrikeSharp.API.Modules.Memory;
|
||||
using CounterStrikeSharp.API.Modules.Utils;
|
||||
using CounterStrikeSharp.API.Core.Attributes;
|
||||
|
||||
namespace CounterStrikeSharp.API.Core;
|
||||
|
||||
public partial class CTripWireFire : CBaseCSGrenade
|
||||
{
|
||||
public CTripWireFire (IntPtr pointer) : base(pointer) {}
|
||||
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
// <auto-generated />
|
||||
#nullable enable
|
||||
#pragma warning disable CS1591
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using CounterStrikeSharp;
|
||||
using CounterStrikeSharp.API.Modules.Events;
|
||||
using CounterStrikeSharp.API.Modules.Entities;
|
||||
using CounterStrikeSharp.API.Modules.Memory;
|
||||
using CounterStrikeSharp.API.Modules.Utils;
|
||||
using CounterStrikeSharp.API.Core.Attributes;
|
||||
|
||||
namespace CounterStrikeSharp.API.Core;
|
||||
|
||||
public partial class CTripWireFireProjectile : CBaseGrenade
|
||||
{
|
||||
public CTripWireFireProjectile (IntPtr pointer) : base(pointer) {}
|
||||
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
// <auto-generated />
|
||||
#nullable enable
|
||||
#pragma warning disable CS1591
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using CounterStrikeSharp;
|
||||
using CounterStrikeSharp.API.Modules.Events;
|
||||
using CounterStrikeSharp.API.Modules.Entities;
|
||||
using CounterStrikeSharp.API.Modules.Memory;
|
||||
using CounterStrikeSharp.API.Modules.Utils;
|
||||
using CounterStrikeSharp.API.Core.Attributes;
|
||||
|
||||
namespace CounterStrikeSharp.API.Core;
|
||||
|
||||
public partial class CWeaponShield : CCSWeaponBaseGun
|
||||
{
|
||||
public CWeaponShield (IntPtr pointer) : base(pointer) {}
|
||||
|
||||
// m_flBulletDamageAbsorbed
|
||||
[SchemaMember("CWeaponShield", "m_flBulletDamageAbsorbed")]
|
||||
public ref float BulletDamageAbsorbed => ref Schema.GetRef<float>(this.Handle, "CWeaponShield", "m_flBulletDamageAbsorbed");
|
||||
|
||||
// m_flLastBulletHitSoundTime
|
||||
[SchemaMember("CWeaponShield", "m_flLastBulletHitSoundTime")]
|
||||
public ref float LastBulletHitSoundTime => ref Schema.GetRef<float>(this.Handle, "CWeaponShield", "m_flLastBulletHitSoundTime");
|
||||
|
||||
// m_flDisplayHealth
|
||||
[SchemaMember("CWeaponShield", "m_flDisplayHealth")]
|
||||
public ref float DisplayHealth => ref Schema.GetRef<float>(this.Handle, "CWeaponShield", "m_flDisplayHealth");
|
||||
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
// <auto-generated />
|
||||
#nullable enable
|
||||
#pragma warning disable CS1591
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using CounterStrikeSharp;
|
||||
using CounterStrikeSharp.API.Modules.Events;
|
||||
using CounterStrikeSharp.API.Modules.Entities;
|
||||
using CounterStrikeSharp.API.Modules.Memory;
|
||||
using CounterStrikeSharp.API.Modules.Utils;
|
||||
using CounterStrikeSharp.API.Core.Attributes;
|
||||
|
||||
namespace CounterStrikeSharp.API.Core;
|
||||
|
||||
public partial class CWeaponZoneRepulsor : CCSWeaponBaseGun
|
||||
{
|
||||
public CWeaponZoneRepulsor (IntPtr pointer) : base(pointer) {}
|
||||
|
||||
}
|
||||
@@ -13,17 +13,7 @@ public enum CSPlayerBlockingUseAction_t : uint
|
||||
k_CSPlayerBlockingUseAction_DefusingWithKit = 0x2,
|
||||
k_CSPlayerBlockingUseAction_HostageGrabbing = 0x3,
|
||||
k_CSPlayerBlockingUseAction_HostageDropping = 0x4,
|
||||
k_CSPlayerBlockingUseAction_OpeningSafe = 0x5,
|
||||
k_CSPlayerBlockingUseAction_EquippingParachute = 0x6,
|
||||
k_CSPlayerBlockingUseAction_EquippingHeavyArmor = 0x7,
|
||||
k_CSPlayerBlockingUseAction_EquippingContract = 0x8,
|
||||
k_CSPlayerBlockingUseAction_EquippingTabletUpgrade = 0x9,
|
||||
k_CSPlayerBlockingUseAction_TakingOffHeavyArmor = 0xA,
|
||||
k_CSPlayerBlockingUseAction_PayingToOpenDoor = 0xB,
|
||||
k_CSPlayerBlockingUseAction_CancelingSpawnRappelling = 0xC,
|
||||
k_CSPlayerBlockingUseAction_EquippingExoJump = 0xD,
|
||||
k_CSPlayerBlockingUseAction_PickingUpBumpMine = 0xE,
|
||||
k_CSPlayerBlockingUseAction_MapLongUseEntity_Pickup = 0xF,
|
||||
k_CSPlayerBlockingUseAction_MapLongUseEntity_Place = 0x10,
|
||||
k_CSPlayerBlockingUseAction_MaxCount = 0x11,
|
||||
k_CSPlayerBlockingUseAction_MapLongUseEntity_Pickup = 0x5,
|
||||
k_CSPlayerBlockingUseAction_MapLongUseEntity_Place = 0x6,
|
||||
k_CSPlayerBlockingUseAction_MaxCount = 0x7,
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace CounterStrikeSharp.API.Core;
|
||||
|
||||
public enum CSWeaponType : uint
|
||||
{
|
||||
WEAPONTYPE_KNIFE = 0x0,
|
||||
WEAPONTYPE_KNIFE = 0x0,
|
||||
WEAPONTYPE_PISTOL = 0x1,
|
||||
WEAPONTYPE_SUBMACHINEGUN = 0x2,
|
||||
WEAPONTYPE_RIFLE = 0x3,
|
||||
@@ -20,12 +20,5 @@ public enum CSWeaponType : uint
|
||||
WEAPONTYPE_GRENADE = 0x9,
|
||||
WEAPONTYPE_EQUIPMENT = 0xA,
|
||||
WEAPONTYPE_STACKABLEITEM = 0xB,
|
||||
WEAPONTYPE_FISTS = 0xC,
|
||||
WEAPONTYPE_BREACHCHARGE = 0xD,
|
||||
WEAPONTYPE_BUMPMINE = 0xE,
|
||||
WEAPONTYPE_TABLET = 0xF,
|
||||
WEAPONTYPE_MELEE = 0x10,
|
||||
WEAPONTYPE_SHIELD = 0x11,
|
||||
WEAPONTYPE_ZONE_REPULSOR = 0x12,
|
||||
WEAPONTYPE_UNKNOWN = 0x13,
|
||||
WEAPONTYPE_UNKNOWN = 0xC,
|
||||
}
|
||||
|
||||
@@ -13,7 +13,5 @@ public enum GrenadeType_t : uint
|
||||
GRENADE_TYPE_FIRE = 0x2,
|
||||
GRENADE_TYPE_DECOY = 0x3,
|
||||
GRENADE_TYPE_SMOKE = 0x4,
|
||||
GRENADE_TYPE_SENSOR = 0x5,
|
||||
GRENADE_TYPE_SNOWBALL = 0x6,
|
||||
GRENADE_TYPE_TOTAL = 0x7,
|
||||
GRENADE_TYPE_TOTAL = 0x5,
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Security;
|
||||
using System.Text;
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
<PackageReference Include="Serilog.Sinks.Console" Version="5.0.0"/>
|
||||
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0"/>
|
||||
<PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0"/>
|
||||
<PackageReference Include="Tomlyn" Version="0.19.0"/>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Core\Schema\"/>
|
||||
@@ -59,9 +60,9 @@
|
||||
</PropertyGroup>
|
||||
<Target Name="SetSourceRevisionId" BeforeTargets="InitializeSourceControlInformation">
|
||||
<Exec
|
||||
Command="git describe --long --always --exclude=* --abbrev=7"
|
||||
ConsoleToMSBuild="True"
|
||||
IgnoreExitCode="False"
|
||||
Command="git describe --long --always --exclude=* --abbrev=7"
|
||||
ConsoleToMSBuild="True"
|
||||
IgnoreExitCode="False"
|
||||
>
|
||||
<Output PropertyName="SourceRevisionId" TaskParameter="ConsoleOutput"/>
|
||||
</Exec>
|
||||
|
||||
@@ -14,18 +14,21 @@
|
||||
* along with CounterStrikeSharp. If not, see <https://www.gnu.org/licenses/>. *
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
|
||||
using CounterStrikeSharp.API.Core;
|
||||
using CounterStrikeSharp.API.Core.Logging;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Tomlyn;
|
||||
|
||||
namespace CounterStrikeSharp.API.Modules.Config
|
||||
{
|
||||
enum ConfigType
|
||||
{
|
||||
Json,
|
||||
Toml
|
||||
}
|
||||
|
||||
public static class ConfigManager
|
||||
{
|
||||
private static readonly DirectoryInfo? _rootDir;
|
||||
@@ -33,47 +36,59 @@ namespace CounterStrikeSharp.API.Modules.Config
|
||||
private static readonly string _pluginConfigsFolderPath;
|
||||
private static ILogger _logger = CoreLogging.Factory.CreateLogger("ConfigManager");
|
||||
|
||||
internal static JsonSerializerOptions JsonSerializerOptions { get; } = new()
|
||||
{
|
||||
WriteIndented = true,
|
||||
ReadCommentHandling = JsonCommentHandling.Skip
|
||||
};
|
||||
|
||||
internal static TomlModelOptions TomlModelOptions { get; } = new()
|
||||
{
|
||||
ConvertPropertyName = name => name
|
||||
};
|
||||
|
||||
static ConfigManager()
|
||||
{
|
||||
_rootDir = new FileInfo(Assembly.GetExecutingAssembly().Location).Directory.Parent;
|
||||
_pluginConfigsFolderPath = Path.Combine(_rootDir.FullName, "configs", "plugins");
|
||||
}
|
||||
|
||||
public static T Load<T>(string pluginName) where T : IBasePluginConfig, new()
|
||||
public static T Load<T>(string pluginName) where T : class, IBasePluginConfig, new()
|
||||
{
|
||||
string directoryPath = Path.Combine(_pluginConfigsFolderPath, pluginName);
|
||||
string configPath = Path.Combine(directoryPath, $"{pluginName}.json");
|
||||
string exampleConfigPath = Path.Combine(directoryPath, $"{pluginName}.example.json");
|
||||
string configPath = Path.Combine(directoryPath, $"{pluginName}");
|
||||
string exampleConfigPath = Path.Combine(directoryPath, $"{pluginName}.example");
|
||||
|
||||
T config = (T)Activator.CreateInstance(typeof(T))!;
|
||||
string[] configFilePaths =
|
||||
[
|
||||
$"{configPath}.toml",
|
||||
$"{configPath}.json",
|
||||
];
|
||||
|
||||
if (!File.Exists(configPath) && !File.Exists(exampleConfigPath))
|
||||
foreach (var path in configFilePaths)
|
||||
{
|
||||
try
|
||||
if (File.Exists(path))
|
||||
{
|
||||
if (!Directory.Exists(directoryPath))
|
||||
{
|
||||
Directory.CreateDirectory(directoryPath);
|
||||
}
|
||||
return Deserialize<T>(path);
|
||||
}
|
||||
}
|
||||
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.Append(
|
||||
$"// This configuration was automatically generated by CounterStrikeSharp for plugin '{pluginName}', at {DateTimeOffset.Now:yyyy/MM/dd hh:mm:ss}\n");
|
||||
builder.Append(JsonSerializer.Serialize<T>(config,
|
||||
new JsonSerializerOptions { WriteIndented = true }));
|
||||
File.WriteAllText(configPath, builder.ToString());
|
||||
return config;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Failed to generate configuration file for {PluginName}", pluginName);
|
||||
}
|
||||
} else if (File.Exists(exampleConfigPath) && !File.Exists(configPath))
|
||||
string[] exampleFilePaths =
|
||||
[
|
||||
$"{exampleConfigPath}.toml",
|
||||
$"{exampleConfigPath}.json"
|
||||
];
|
||||
|
||||
foreach (var path in exampleFilePaths)
|
||||
{
|
||||
if (!File.Exists(path)) continue;
|
||||
|
||||
try
|
||||
{
|
||||
_logger.LogInformation("Copying example configuration file for {PluginName}", pluginName);
|
||||
File.Copy(exampleConfigPath, configPath);
|
||||
var destPath = Path.Combine(directoryPath, Path.GetFileName(path).Replace(".example", ""));
|
||||
File.Copy(path, destPath);
|
||||
return Deserialize<T>(destPath);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -83,14 +98,58 @@ namespace CounterStrikeSharp.API.Modules.Config
|
||||
|
||||
try
|
||||
{
|
||||
config = JsonSerializer.Deserialize<T>(File.ReadAllText(configPath), new JsonSerializerOptions() { ReadCommentHandling = JsonCommentHandling.Skip })!;
|
||||
if (!Directory.Exists(directoryPath))
|
||||
{
|
||||
Directory.CreateDirectory(directoryPath);
|
||||
}
|
||||
|
||||
var config = new T();
|
||||
var output = Serialize(config, ConfigType.Json, pluginName);
|
||||
File.WriteAllText(Path.Combine(directoryPath, $"{pluginName}.json"), output);
|
||||
|
||||
return config;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Failed to parse configuration file for {PluginName}", pluginName);
|
||||
_logger.LogError(ex, "Failed to generate configuration file for {PluginName}", pluginName);
|
||||
return new T();
|
||||
}
|
||||
}
|
||||
|
||||
private static T Deserialize<T>(string path) where T : class, IBasePluginConfig, new()
|
||||
{
|
||||
switch (Path.GetExtension(path))
|
||||
{
|
||||
case ".toml":
|
||||
return Toml.ToModel<T>(File.ReadAllText(path), options: TomlModelOptions);
|
||||
case ".json":
|
||||
return JsonSerializer.Deserialize<T>(File.ReadAllText(path), JsonSerializerOptions)!;
|
||||
}
|
||||
|
||||
return config;
|
||||
throw new NotSupportedException("Unsupported configuration file format");
|
||||
}
|
||||
|
||||
private static string Serialize<T>(T config, ConfigType configType, string pluginName) where T : class, IBasePluginConfig, new()
|
||||
{
|
||||
StringBuilder builder = new StringBuilder();
|
||||
string comment =
|
||||
$"This configuration was automatically generated by CounterStrikeSharp for plugin '{pluginName}', at {DateTimeOffset.Now:yyyy/MM/dd hh:mm:ss}\n";
|
||||
|
||||
switch (configType)
|
||||
{
|
||||
case ConfigType.Json:
|
||||
builder.Append($"// {comment}");
|
||||
builder.Append(JsonSerializer.Serialize<T>(config, JsonSerializerOptions));
|
||||
break;
|
||||
case ConfigType.Toml:
|
||||
builder.Append($"# {comment}");
|
||||
builder.Append(Toml.FromModel(config, options: TomlModelOptions));
|
||||
break;
|
||||
default:
|
||||
throw new NotSupportedException("Unsupported configuration file format");
|
||||
}
|
||||
|
||||
return builder.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
using System;
|
||||
using CounterStrikeSharp.API.Core;
|
||||
using CounterStrikeSharp.API.Core.Attributes;
|
||||
using CounterStrikeSharp.API.Modules.Entities;
|
||||
|
||||
namespace CounterStrikeSharp.API.Modules.Events
|
||||
{
|
||||
[EventName("player_chat")]
|
||||
public class EventPlayerChat : GameEvent
|
||||
{
|
||||
public EventPlayerChat(IntPtr pointer) : base(pointer){}
|
||||
public EventPlayerChat(bool force) : base("player_chat", force){}
|
||||
|
||||
/// <summary>
|
||||
/// If this chat message was sent to team only
|
||||
/// </summary>
|
||||
public bool Teamonly
|
||||
{
|
||||
get => Get<bool>("teamonly");
|
||||
set => Set<bool>("teamonly", value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The user ID of the player who sent the chat message
|
||||
/// </summary>
|
||||
public int Userid
|
||||
{
|
||||
get => Get<int>("userid");
|
||||
set => Set<int>("userid", value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The text content of the chat message
|
||||
/// </summary>
|
||||
public string Text
|
||||
{
|
||||
get => Get<string>("text");
|
||||
set => Set<string>("text", value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,17 +1,14 @@
|
||||
using System.Text.Json;
|
||||
using System.Reflection;
|
||||
using System.Runtime.Serialization;
|
||||
using CounterStrikeSharp.API.Modules.Config;
|
||||
using Tomlyn;
|
||||
|
||||
namespace CounterStrikeSharp.API.Modules.Extensions;
|
||||
|
||||
public static class PluginConfigExtensions
|
||||
{
|
||||
private static readonly JsonSerializerOptions _jsonSerializerOptions = new()
|
||||
{
|
||||
WriteIndented = true,
|
||||
ReadCommentHandling = JsonCommentHandling.Skip
|
||||
};
|
||||
|
||||
public static JsonSerializerOptions JsonSerializerOptions => _jsonSerializerOptions;
|
||||
public static JsonSerializerOptions JsonSerializerOptions => ConfigManager.JsonSerializerOptions;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the configuration file path
|
||||
@@ -21,7 +18,24 @@ public static class PluginConfigExtensions
|
||||
public static string GetConfigPath<T>(this T _) where T : BasePluginConfig, new()
|
||||
{
|
||||
string assemblyName = typeof(T).Assembly.GetName().Name ?? string.Empty;
|
||||
return Path.Combine(Server.GameDirectory, "csgo", "addons", "counterstrikesharp", "configs", "plugins", assemblyName, $"{assemblyName}.json");
|
||||
|
||||
string[] configFilePaths =
|
||||
[
|
||||
Path.Combine(Server.GameDirectory, "csgo", "addons", "counterstrikesharp", "configs", "plugins", assemblyName,
|
||||
$"{assemblyName}.json"),
|
||||
Path.Combine(Server.GameDirectory, "csgo", "addons", "counterstrikesharp", "configs", "plugins", assemblyName,
|
||||
$"{assemblyName}.toml"),
|
||||
];
|
||||
|
||||
foreach (var path in configFilePaths)
|
||||
{
|
||||
if (File.Exists(path))
|
||||
{
|
||||
return path;
|
||||
}
|
||||
}
|
||||
|
||||
return configFilePaths[0];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -37,7 +51,22 @@ public static class PluginConfigExtensions
|
||||
{
|
||||
using var stream = new FileStream(configPath, FileMode.Create, FileAccess.Write, FileShare.None);
|
||||
using var writer = new StreamWriter(stream);
|
||||
writer.Write(JsonSerializer.Serialize(config, JsonSerializerOptions));
|
||||
|
||||
switch (Path.GetExtension(configPath))
|
||||
{
|
||||
case ".json":
|
||||
{
|
||||
writer.Write(JsonSerializer.Serialize(config, ConfigManager.JsonSerializerOptions));
|
||||
break;
|
||||
}
|
||||
case ".toml":
|
||||
writer.Write(Toml.FromModel(config, ConfigManager.TomlModelOptions));
|
||||
break;
|
||||
default:
|
||||
throw new NotSupportedException($"Configuration file type '{Path.GetExtension(configPath)}' is not supported.");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -63,8 +92,22 @@ public static class PluginConfigExtensions
|
||||
|
||||
var configContent = File.ReadAllText(configPath);
|
||||
|
||||
var newConfig = JsonSerializer.Deserialize<T>(configContent, JsonSerializerOptions)
|
||||
?? throw new JsonException($"Deserialization failed for configuration file '{configPath}'.");
|
||||
T? newConfig = null;
|
||||
switch (Path.GetExtension(configPath))
|
||||
{
|
||||
case ".json":
|
||||
newConfig = JsonSerializer.Deserialize<T>(configContent, ConfigManager.JsonSerializerOptions)
|
||||
?? throw new JsonException($"Deserialization failed for configuration file '{configPath}'.");
|
||||
break;
|
||||
case ".toml":
|
||||
newConfig = Toml.ToModel<T>(configContent, options: ConfigManager.TomlModelOptions);
|
||||
break;
|
||||
}
|
||||
|
||||
if (newConfig is null)
|
||||
{
|
||||
throw new SerializationException($"Deserialization failed for configuration file '{configPath}'.");
|
||||
}
|
||||
|
||||
foreach (var property in typeof(T).GetProperties(BindingFlags.Instance | BindingFlags.Public))
|
||||
{
|
||||
|
||||
@@ -124,6 +124,9 @@ public abstract class BaseMenuInstance : IMenuInstance
|
||||
|
||||
var menuItemIndex = CurrentOffset + desiredValue - 1;
|
||||
|
||||
if (Menu?.MenuOptions == null)
|
||||
return;
|
||||
|
||||
if (menuItemIndex >= 0 && menuItemIndex < Menu.MenuOptions.Count)
|
||||
{
|
||||
var menuOption = Menu.MenuOptions[menuItemIndex];
|
||||
|
||||
@@ -60,7 +60,7 @@ public class ChatColors
|
||||
case CsTeam.CounterTerrorist:
|
||||
return LightBlue;
|
||||
case CsTeam.Terrorist:
|
||||
return Yellow;
|
||||
return Orange;
|
||||
default:
|
||||
throw new ArgumentException($"Invalid team: ${team}");
|
||||
}
|
||||
|
||||
@@ -43,6 +43,8 @@ namespace CounterStrikeSharp.API
|
||||
Bullrush = (1 << 21),
|
||||
Grenade1 = (1 << 22), /** grenade 1 */
|
||||
Grenade2 = (1 << 23), /** grenade 2 */
|
||||
Attack3 = (1 << 24)
|
||||
Attack3 = (1 << 24),
|
||||
Scoreboard = ((ulong)1 << 33),
|
||||
Inspect = ((ulong)1 << 35),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,12 +26,8 @@ public static class NetworkClasses
|
||||
"CBaseViewModel",
|
||||
"CBeam",
|
||||
"CBombTarget",
|
||||
"CBreachCharge",
|
||||
"CBreachChargeProjectile",
|
||||
"CBreakable",
|
||||
"CBreakableProp",
|
||||
"CBumpMine",
|
||||
"CBumpMineProjectile",
|
||||
"CC4",
|
||||
"CChicken",
|
||||
"CColorCorrection",
|
||||
@@ -83,7 +79,6 @@ public static class NetworkClasses
|
||||
"CFireCrackerBlast",
|
||||
"CFireSmoke",
|
||||
"CFish",
|
||||
"CFists",
|
||||
"CFlashbang",
|
||||
"CFogController",
|
||||
"CFootstepControl",
|
||||
@@ -120,7 +115,6 @@ public static class NetworkClasses
|
||||
"CLightOrthoEntity",
|
||||
"CLightSpotEntity",
|
||||
"CMapVetoPickController",
|
||||
"CMelee",
|
||||
"CModelPointEntity",
|
||||
"CMolotovGrenade",
|
||||
"CMolotovProjectile",
|
||||
@@ -153,8 +147,6 @@ public static class NetworkClasses
|
||||
"CRectLight",
|
||||
"CRopeKeyframe",
|
||||
"CSceneEntity",
|
||||
"CSensorGrenade",
|
||||
"CSensorGrenadeProjectile",
|
||||
"CShatterGlassShardPhysics",
|
||||
"CSkyCamera",
|
||||
"CSmokeGrenade",
|
||||
@@ -172,15 +164,11 @@ public static class NetworkClasses
|
||||
"CSprite",
|
||||
"CSpriteOriented",
|
||||
"CSun",
|
||||
"CTablet",
|
||||
"CTeam",
|
||||
"CTextureBasedAnimatable",
|
||||
"CTonemapController2",
|
||||
"CTriggerBuoyancy",
|
||||
"CTriggerTripWire",
|
||||
"CTriggerVolume",
|
||||
"CTripWireFire",
|
||||
"CTripWireFireProjectile",
|
||||
"CVoteController",
|
||||
"CWaterBullet",
|
||||
"CWeaponAug",
|
||||
@@ -207,13 +195,11 @@ public static class NetworkClasses
|
||||
"CWeaponSawedoff",
|
||||
"CWeaponSCAR20",
|
||||
"CWeaponSG556",
|
||||
"CWeaponShield",
|
||||
"CWeaponSSG08",
|
||||
"CWeaponTaser",
|
||||
"CWeaponTec9",
|
||||
"CWeaponUMP45",
|
||||
"CWeaponXM1014",
|
||||
"CWeaponZoneRepulsor",
|
||||
"CWorld",
|
||||
};
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ internal static partial class Program
|
||||
if (IgnoreClasses.Contains(className))
|
||||
continue;
|
||||
|
||||
allClasses[className] = schemaClass;
|
||||
allClasses[className] = schemaClass with { Name = className };
|
||||
}
|
||||
}
|
||||
|
||||
@@ -174,7 +174,7 @@ internal static partial class Program
|
||||
{
|
||||
search.Compute(networkClassName);
|
||||
}
|
||||
|
||||
|
||||
// Clear output directory
|
||||
if (Directory.Exists(outputPath))
|
||||
{
|
||||
@@ -194,7 +194,7 @@ internal static partial class Program
|
||||
var newBuilder = new StringBuilder(enumBuilder.ToString());
|
||||
WriteEnum(newBuilder, enumName, schemaEnum);
|
||||
File.WriteAllText(Path.Combine(outputPath, "Enums", $"{SanitiseTypeName(enumName)}.g.cs"),
|
||||
newBuilder.ToString());
|
||||
newBuilder.ToString().ReplaceLineEndings("\r\n"));
|
||||
}
|
||||
|
||||
// Manually whitelist some classes
|
||||
@@ -217,20 +217,39 @@ internal static partial class Program
|
||||
var isPointeeType = pointeeTypes.Contains(className);
|
||||
|
||||
var newBuilder = new StringBuilder(classBuilder.ToString());
|
||||
WriteClass(newBuilder, className, schemaClass, parentToChildMap, isPointeeType);
|
||||
WriteClass(newBuilder, className, schemaClass, allClasses, isPointeeType);
|
||||
visitedClassNames.Add(className);
|
||||
|
||||
File.WriteAllText(Path.Combine(outputPath, "Classes", $"{SanitiseTypeName(className)}.g.cs"),
|
||||
newBuilder.ToString());
|
||||
newBuilder.ToString().ReplaceLineEndings("\r\n"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static IEnumerable<(SchemaClass clazz, SchemaField field)> GetAllParentFields(
|
||||
SchemaClass schemaClass,
|
||||
SortedDictionary<string, SchemaClass> allClasses)
|
||||
{
|
||||
while (schemaClass.Parent != null)
|
||||
{
|
||||
allClasses.TryGetValue(schemaClass.Parent, out var parentClass);
|
||||
if (parentClass == null)
|
||||
break;
|
||||
|
||||
foreach (var field in parentClass.Fields)
|
||||
{
|
||||
yield return (parentClass, field);
|
||||
}
|
||||
|
||||
schemaClass = parentClass;
|
||||
}
|
||||
}
|
||||
|
||||
private static void WriteClass(
|
||||
StringBuilder builder,
|
||||
string schemaClassName,
|
||||
SchemaClass schemaClass,
|
||||
IReadOnlyDictionary<string, ImmutableList<KeyValuePair<string, SchemaClass>>> parentToChildMap,
|
||||
SortedDictionary<string, SchemaClass> allClasses,
|
||||
bool isPointeeType)
|
||||
{
|
||||
var isEntityClass =
|
||||
@@ -242,8 +261,12 @@ internal static partial class Program
|
||||
builder.AppendLine();
|
||||
builder.Append($"public partial class {classNameCs}");
|
||||
|
||||
(SchemaClass clazz, SchemaField field)[] parentFields = [];
|
||||
if (schemaClass.Parent != null)
|
||||
{
|
||||
builder.Append($" : {schemaClass.Parent}");
|
||||
parentFields = GetAllParentFields(schemaClass, allClasses).ToArray();
|
||||
}
|
||||
|
||||
if (schemaClass.Parent == null)
|
||||
{
|
||||
@@ -276,6 +299,8 @@ internal static partial class Program
|
||||
if (IgnoreClasses.Contains(field.Type.Inner!.Name)) continue;
|
||||
}
|
||||
|
||||
var requiresNewKeyword = parentFields.Any(x => x.clazz.CsPropertyNameForField(x.clazz.Name, x.field) == schemaClass.CsPropertyNameForField(schemaClassName, field));
|
||||
|
||||
var handleParams = $"this.Handle, \"{schemaClassName}\", \"{field.Name}\"";
|
||||
|
||||
builder.AppendLine($"\t// {field.Name}");
|
||||
@@ -286,7 +311,7 @@ internal static partial class Program
|
||||
var getter = $"return Schema.GetString({handleParams});";
|
||||
var setter = $"Schema.SetString({handleParams}, value{(field.Type.ArraySize != null ? ", " + field.Type.ArraySize : "")});";
|
||||
builder.AppendLine(
|
||||
$"\tpublic {SanitiseTypeName(field.Type.CsTypeName)} {schemaClass.CsPropertyNameForField(schemaClassName, field)}");
|
||||
$"\tpublic {(requiresNewKeyword ? "new ": "")}{SanitiseTypeName(field.Type.CsTypeName)} {schemaClass.CsPropertyNameForField(schemaClassName, field)}");
|
||||
builder.AppendLine($"\t{{");
|
||||
builder.AppendLine(
|
||||
$"\t\tget {{ {getter} }}");
|
||||
@@ -301,7 +326,7 @@ internal static partial class Program
|
||||
var getter = $"return Schema.GetString({handleParams});";
|
||||
var setter = $"Schema.SetStringBytes({handleParams}, value, {field.Type.ArraySize});";
|
||||
builder.AppendLine(
|
||||
$"\tpublic {SanitiseTypeName(field.Type.CsTypeName)} {schemaClass.CsPropertyNameForField(schemaClassName, field)}");
|
||||
$"\tpublic {(requiresNewKeyword ? "new ": "")}{SanitiseTypeName(field.Type.CsTypeName)} {schemaClass.CsPropertyNameForField(schemaClassName, field)}");
|
||||
builder.AppendLine($"\t{{");
|
||||
builder.AppendLine(
|
||||
$"\t\tget {{ {getter} }}");
|
||||
@@ -316,7 +341,7 @@ internal static partial class Program
|
||||
var getter = $"return Schema.GetUtf8String({handleParams});";
|
||||
var setter = $"Schema.SetString({handleParams}, value);";
|
||||
builder.AppendLine(
|
||||
$"\tpublic {SanitiseTypeName(field.Type.CsTypeName)} {schemaClass.CsPropertyNameForField(schemaClassName, field)}");
|
||||
$"\tpublic {(requiresNewKeyword ? "new ": "")}{SanitiseTypeName(field.Type.CsTypeName)} {schemaClass.CsPropertyNameForField(schemaClassName, field)}");
|
||||
builder.AppendLine($"\t{{");
|
||||
builder.AppendLine(
|
||||
$"\t\tget {{ {getter} }}");
|
||||
@@ -330,7 +355,7 @@ internal static partial class Program
|
||||
var getter =
|
||||
$"Schema.GetFixedArray<{SanitiseTypeName(field.Type.Inner!.CsTypeName)}>({handleParams}, {field.Type.ArraySize});";
|
||||
builder.AppendLine(
|
||||
$"\tpublic Span<{SanitiseTypeName(field.Type.Inner!.CsTypeName)}> {schemaClass.CsPropertyNameForField(schemaClassName, field)} => {getter}");
|
||||
$"\tpublic {(requiresNewKeyword ? "new ": "")}Span<{SanitiseTypeName(field.Type.Inner!.CsTypeName)}> {schemaClass.CsPropertyNameForField(schemaClassName, field)} => {getter}");
|
||||
builder.AppendLine();
|
||||
}
|
||||
else if (field.Type.Category == SchemaTypeCategory.DeclaredClass &&
|
||||
@@ -338,7 +363,7 @@ internal static partial class Program
|
||||
{
|
||||
var getter = $"Schema.GetDeclaredClass<{SanitiseTypeName(field.Type.CsTypeName)}>({handleParams});";
|
||||
builder.AppendLine(
|
||||
$"\tpublic {SanitiseTypeName(field.Type.CsTypeName)} {schemaClass.CsPropertyNameForField(schemaClassName, field)} => {getter}");
|
||||
$"\tpublic {(requiresNewKeyword ? "new ": "")}{SanitiseTypeName(field.Type.CsTypeName)} {schemaClass.CsPropertyNameForField(schemaClassName, field)} => {getter}");
|
||||
builder.AppendLine();
|
||||
}
|
||||
else if ((field.Type.Category == SchemaTypeCategory.Builtin ||
|
||||
@@ -347,7 +372,7 @@ internal static partial class Program
|
||||
{
|
||||
var getter = $"ref Schema.GetRef<{SanitiseTypeName(field.Type.CsTypeName)}>({handleParams});";
|
||||
builder.AppendLine(
|
||||
$"\tpublic ref {SanitiseTypeName(field.Type.CsTypeName)} {schemaClass.CsPropertyNameForField(schemaClassName, field)} => {getter}");
|
||||
$"\tpublic {(requiresNewKeyword ? "new ": "")}ref {SanitiseTypeName(field.Type.CsTypeName)} {schemaClass.CsPropertyNameForField(schemaClassName, field)} => {getter}");
|
||||
builder.AppendLine();
|
||||
}
|
||||
else if (field.Type.Category == SchemaTypeCategory.Ptr)
|
||||
@@ -356,7 +381,7 @@ internal static partial class Program
|
||||
if (inner.Category != SchemaTypeCategory.DeclaredClass) continue;
|
||||
|
||||
builder.AppendLine(
|
||||
$"\tpublic {SanitiseTypeName(field.Type.CsTypeName)} {schemaClass.CsPropertyNameForField(schemaClassName, field)} => Schema.GetPointer<{SanitiseTypeName(inner.CsTypeName)}>({handleParams});");
|
||||
$"\tpublic {(requiresNewKeyword ? "new ": "")}{SanitiseTypeName(field.Type.CsTypeName)} {schemaClass.CsPropertyNameForField(schemaClassName, field)} => Schema.GetPointer<{SanitiseTypeName(inner.CsTypeName)}>({handleParams});");
|
||||
builder.AppendLine();
|
||||
}
|
||||
else if (field.Type is { Category: SchemaTypeCategory.Atomic, Name: "Color" })
|
||||
@@ -364,7 +389,7 @@ internal static partial class Program
|
||||
var getter = $"return Schema.GetCustomMarshalledType<{field.Type.CsTypeName}>({handleParams});";
|
||||
var setter = $"Schema.SetCustomMarshalledType<{field.Type.CsTypeName}>({handleParams}, value);";
|
||||
builder.AppendLine(
|
||||
$"\tpublic {SanitiseTypeName(field.Type.CsTypeName)} {schemaClass.CsPropertyNameForField(schemaClassName, field)}");
|
||||
$"\tpublic {(requiresNewKeyword ? "new ": "")}{SanitiseTypeName(field.Type.CsTypeName)} {schemaClass.CsPropertyNameForField(schemaClassName, field)}");
|
||||
builder.AppendLine($"\t{{");
|
||||
builder.AppendLine(
|
||||
$"\t\tget {{ {getter} }}");
|
||||
@@ -377,7 +402,7 @@ internal static partial class Program
|
||||
{
|
||||
var getter = $"Schema.GetDeclaredClass<{SanitiseTypeName(field.Type.CsTypeName)}>({handleParams});";
|
||||
builder.AppendLine(
|
||||
$"\tpublic {SanitiseTypeName(field.Type.CsTypeName)} {schemaClass.CsPropertyNameForField(schemaClassName, field)} => {getter}");
|
||||
$"\tpublic {(requiresNewKeyword ? "new ": "")}{SanitiseTypeName(field.Type.CsTypeName)} {schemaClass.CsPropertyNameForField(schemaClassName, field)} => {getter}");
|
||||
builder.AppendLine();
|
||||
}
|
||||
}
|
||||
@@ -425,4 +450,4 @@ internal static partial class Program
|
||||
|
||||
builder.AppendLine("}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7614,13 +7614,6 @@
|
||||
"name": "bool"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "m_bAutoKickDisabled",
|
||||
"type": {
|
||||
"category": 0,
|
||||
"name": "bool"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "m_bIsLowViolence",
|
||||
"type": {
|
||||
@@ -10570,14 +10563,6 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"CBreachCharge": {
|
||||
"fields": [],
|
||||
"parent": "CCSWeaponBase"
|
||||
},
|
||||
"CBreachChargeProjectile": {
|
||||
"fields": [],
|
||||
"parent": "CBaseGrenade"
|
||||
},
|
||||
"CBreakable": {
|
||||
"fields": [
|
||||
{
|
||||
@@ -11320,14 +11305,6 @@
|
||||
],
|
||||
"parent": "CBaseModelEntity"
|
||||
},
|
||||
"CBumpMine": {
|
||||
"fields": [],
|
||||
"parent": "CCSWeaponBase"
|
||||
},
|
||||
"CBumpMineProjectile": {
|
||||
"fields": [],
|
||||
"parent": "CBaseGrenade"
|
||||
},
|
||||
"CBuoyancyHelper": {
|
||||
"fields": [
|
||||
{
|
||||
@@ -13259,13 +13236,6 @@
|
||||
"name": "GameTime_t[32]"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "m_nServerQuestID",
|
||||
"type": {
|
||||
"category": 0,
|
||||
"name": "int32"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "m_vMinimapMins",
|
||||
"type": {
|
||||
@@ -13294,10 +13264,10 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "m_bSpawnedTerrorHuntHeavy",
|
||||
"name": "m_ullLocalMatchID",
|
||||
"type": {
|
||||
"category": 0,
|
||||
"name": "bool"
|
||||
"name": "uint64"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -14430,6 +14400,13 @@
|
||||
"name": "bool"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "m_uiCommunicationMuteFlags",
|
||||
"type": {
|
||||
"category": 0,
|
||||
"name": "uint32"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "m_szCrosshairCodes",
|
||||
"type": {
|
||||
@@ -14625,6 +14602,13 @@
|
||||
"name": "uint16"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "m_rtActiveMissionPeriod",
|
||||
"type": {
|
||||
"category": 0,
|
||||
"name": "uint32"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "m_nQuestProgressReason",
|
||||
"type": {
|
||||
@@ -14660,6 +14644,13 @@
|
||||
"name": "uint32"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "m_eNetworkDisconnectionReason",
|
||||
"type": {
|
||||
"category": 0,
|
||||
"name": "uint32"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "m_bCannotBeKicked",
|
||||
"type": {
|
||||
@@ -16571,13 +16562,6 @@
|
||||
"category": 0,
|
||||
"name": "bool"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "m_bHasHeavyArmor",
|
||||
"type": {
|
||||
"category": 0,
|
||||
"name": "bool"
|
||||
}
|
||||
}
|
||||
],
|
||||
"parent": "CPlayer_ItemServices"
|
||||
@@ -17468,13 +17452,6 @@
|
||||
"name": "GameTime_t"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "m_flLastDeployTime",
|
||||
"type": {
|
||||
"category": 5,
|
||||
"name": "GameTime_t"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "m_nLastEmptySoundCmdNum",
|
||||
"type": {
|
||||
@@ -26474,72 +26451,6 @@
|
||||
],
|
||||
"parent": "CBaseEntity"
|
||||
},
|
||||
"CFists": {
|
||||
"fields": [
|
||||
{
|
||||
"name": "m_bPlayingUninterruptableAct",
|
||||
"type": {
|
||||
"category": 0,
|
||||
"name": "bool"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "m_nUninterruptableActivity",
|
||||
"type": {
|
||||
"category": 6,
|
||||
"name": "PlayerAnimEvent_t"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "m_bRestorePrevWep",
|
||||
"type": {
|
||||
"category": 0,
|
||||
"name": "bool"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "m_hWeaponBeforePrevious",
|
||||
"type": {
|
||||
"atomic": 1,
|
||||
"category": 4,
|
||||
"inner": {
|
||||
"category": 5,
|
||||
"name": "CBasePlayerWeapon"
|
||||
},
|
||||
"name": "CHandle< CBasePlayerWeapon >",
|
||||
"outer": "CHandle"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "m_hWeaponPrevious",
|
||||
"type": {
|
||||
"atomic": 1,
|
||||
"category": 4,
|
||||
"inner": {
|
||||
"category": 5,
|
||||
"name": "CBasePlayerWeapon"
|
||||
},
|
||||
"name": "CHandle< CBasePlayerWeapon >",
|
||||
"outer": "CHandle"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "m_bDelayedHardPunchIncoming",
|
||||
"type": {
|
||||
"category": 0,
|
||||
"name": "bool"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "m_bDestroyAfterTaunt",
|
||||
"type": {
|
||||
"category": 0,
|
||||
"name": "bool"
|
||||
}
|
||||
}
|
||||
],
|
||||
"parent": "CCSWeaponBase"
|
||||
},
|
||||
"CFlashbang": {
|
||||
"fields": [],
|
||||
"parent": "CBaseCSGrenade"
|
||||
@@ -32732,10 +32643,6 @@
|
||||
],
|
||||
"parent": "CBaseModelEntity"
|
||||
},
|
||||
"CItemHeavyAssaultSuit": {
|
||||
"fields": [],
|
||||
"parent": "CItemAssaultSuit"
|
||||
},
|
||||
"CItemKevlar": {
|
||||
"fields": [],
|
||||
"parent": "CItem"
|
||||
@@ -35808,10 +35715,6 @@
|
||||
],
|
||||
"parent": "CLogicalEntity"
|
||||
},
|
||||
"CMelee": {
|
||||
"fields": [],
|
||||
"parent": "CCSWeaponBase"
|
||||
},
|
||||
"CMeshletDescriptor": {
|
||||
"fields": [
|
||||
{
|
||||
@@ -55640,42 +55543,6 @@
|
||||
],
|
||||
"parent": "CAnimUpdateNodeBase"
|
||||
},
|
||||
"CSensorGrenade": {
|
||||
"fields": [],
|
||||
"parent": "CBaseCSGrenade"
|
||||
},
|
||||
"CSensorGrenadeProjectile": {
|
||||
"fields": [
|
||||
{
|
||||
"name": "m_fExpireTime",
|
||||
"type": {
|
||||
"category": 5,
|
||||
"name": "GameTime_t"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "m_fNextDetectPlayerSound",
|
||||
"type": {
|
||||
"category": 5,
|
||||
"name": "GameTime_t"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "m_hDisplayGrenade",
|
||||
"type": {
|
||||
"atomic": 1,
|
||||
"category": 4,
|
||||
"inner": {
|
||||
"category": 5,
|
||||
"name": "CBaseEntity"
|
||||
},
|
||||
"name": "CHandle< CBaseEntity >",
|
||||
"outer": "CHandle"
|
||||
}
|
||||
}
|
||||
],
|
||||
"parent": "CBaseCSGrenadeProjectile"
|
||||
},
|
||||
"CSeqAutoLayer": {
|
||||
"fields": [
|
||||
{
|
||||
@@ -60297,10 +60164,6 @@
|
||||
],
|
||||
"parent": "CConcreteAnimParameter"
|
||||
},
|
||||
"CTablet": {
|
||||
"fields": [],
|
||||
"parent": "CCSWeaponBase"
|
||||
},
|
||||
"CTakeDamageInfo": {
|
||||
"fields": [
|
||||
{
|
||||
@@ -62408,10 +62271,6 @@
|
||||
"fields": [],
|
||||
"parent": "CBaseTrigger"
|
||||
},
|
||||
"CTriggerTripWire": {
|
||||
"fields": [],
|
||||
"parent": "CBaseTrigger"
|
||||
},
|
||||
"CTriggerVolume": {
|
||||
"fields": [
|
||||
{
|
||||
@@ -62437,14 +62296,6 @@
|
||||
],
|
||||
"parent": "CBaseModelEntity"
|
||||
},
|
||||
"CTripWireFire": {
|
||||
"fields": [],
|
||||
"parent": "CBaseCSGrenade"
|
||||
},
|
||||
"CTripWireFireProjectile": {
|
||||
"fields": [],
|
||||
"parent": "CBaseGrenade"
|
||||
},
|
||||
"CTurnHelperUpdateNode": {
|
||||
"fields": [
|
||||
{
|
||||
@@ -63748,32 +63599,6 @@
|
||||
"fields": [],
|
||||
"parent": "CCSWeaponBase"
|
||||
},
|
||||
"CWeaponShield": {
|
||||
"fields": [
|
||||
{
|
||||
"name": "m_flBulletDamageAbsorbed",
|
||||
"type": {
|
||||
"category": 0,
|
||||
"name": "float32"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "m_flLastBulletHitSoundTime",
|
||||
"type": {
|
||||
"category": 5,
|
||||
"name": "GameTime_t"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "m_flDisplayHealth",
|
||||
"type": {
|
||||
"category": 0,
|
||||
"name": "float32"
|
||||
}
|
||||
}
|
||||
],
|
||||
"parent": "CCSWeaponBaseGun"
|
||||
},
|
||||
"CWeaponTaser": {
|
||||
"fields": [
|
||||
{
|
||||
@@ -63809,10 +63634,6 @@
|
||||
"fields": [],
|
||||
"parent": "CCSWeaponBase"
|
||||
},
|
||||
"CWeaponZoneRepulsor": {
|
||||
"fields": [],
|
||||
"parent": "CCSWeaponBaseGun"
|
||||
},
|
||||
"CWorld": {
|
||||
"fields": [],
|
||||
"parent": "CBaseModelEntity"
|
||||
@@ -100411,56 +100232,16 @@
|
||||
"value": 4
|
||||
},
|
||||
{
|
||||
"name": "k_CSPlayerBlockingUseAction_OpeningSafe",
|
||||
"name": "k_CSPlayerBlockingUseAction_MapLongUseEntity_Pickup",
|
||||
"value": 5
|
||||
},
|
||||
{
|
||||
"name": "k_CSPlayerBlockingUseAction_EquippingParachute",
|
||||
"name": "k_CSPlayerBlockingUseAction_MapLongUseEntity_Place",
|
||||
"value": 6
|
||||
},
|
||||
{
|
||||
"name": "k_CSPlayerBlockingUseAction_EquippingHeavyArmor",
|
||||
"value": 7
|
||||
},
|
||||
{
|
||||
"name": "k_CSPlayerBlockingUseAction_EquippingContract",
|
||||
"value": 8
|
||||
},
|
||||
{
|
||||
"name": "k_CSPlayerBlockingUseAction_EquippingTabletUpgrade",
|
||||
"value": 9
|
||||
},
|
||||
{
|
||||
"name": "k_CSPlayerBlockingUseAction_TakingOffHeavyArmor",
|
||||
"value": 10
|
||||
},
|
||||
{
|
||||
"name": "k_CSPlayerBlockingUseAction_PayingToOpenDoor",
|
||||
"value": 11
|
||||
},
|
||||
{
|
||||
"name": "k_CSPlayerBlockingUseAction_CancelingSpawnRappelling",
|
||||
"value": 12
|
||||
},
|
||||
{
|
||||
"name": "k_CSPlayerBlockingUseAction_EquippingExoJump",
|
||||
"value": 13
|
||||
},
|
||||
{
|
||||
"name": "k_CSPlayerBlockingUseAction_PickingUpBumpMine",
|
||||
"value": 14
|
||||
},
|
||||
{
|
||||
"name": "k_CSPlayerBlockingUseAction_MapLongUseEntity_Pickup",
|
||||
"value": 15
|
||||
},
|
||||
{
|
||||
"name": "k_CSPlayerBlockingUseAction_MapLongUseEntity_Place",
|
||||
"value": 16
|
||||
},
|
||||
{
|
||||
"name": "k_CSPlayerBlockingUseAction_MaxCount",
|
||||
"value": 17
|
||||
"value": 7
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -100644,37 +100425,9 @@
|
||||
"name": "WEAPONTYPE_STACKABLEITEM",
|
||||
"value": 11
|
||||
},
|
||||
{
|
||||
"name": "WEAPONTYPE_FISTS",
|
||||
"value": 12
|
||||
},
|
||||
{
|
||||
"name": "WEAPONTYPE_BREACHCHARGE",
|
||||
"value": 13
|
||||
},
|
||||
{
|
||||
"name": "WEAPONTYPE_BUMPMINE",
|
||||
"value": 14
|
||||
},
|
||||
{
|
||||
"name": "WEAPONTYPE_TABLET",
|
||||
"value": 15
|
||||
},
|
||||
{
|
||||
"name": "WEAPONTYPE_MELEE",
|
||||
"value": 16
|
||||
},
|
||||
{
|
||||
"name": "WEAPONTYPE_SHIELD",
|
||||
"value": 17
|
||||
},
|
||||
{
|
||||
"name": "WEAPONTYPE_ZONE_REPULSOR",
|
||||
"value": 18
|
||||
},
|
||||
{
|
||||
"name": "WEAPONTYPE_UNKNOWN",
|
||||
"value": 19
|
||||
"value": 12
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -102444,17 +102197,9 @@
|
||||
"name": "GRENADE_TYPE_SMOKE",
|
||||
"value": 4
|
||||
},
|
||||
{
|
||||
"name": "GRENADE_TYPE_SENSOR",
|
||||
"value": 5
|
||||
},
|
||||
{
|
||||
"name": "GRENADE_TYPE_SNOWBALL",
|
||||
"value": 6
|
||||
},
|
||||
{
|
||||
"name": "GRENADE_TYPE_TOTAL",
|
||||
"value": 7
|
||||
"value": 5
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
@@ -4,6 +4,7 @@ namespace CounterStrikeSharp.SchemaGen;
|
||||
|
||||
public partial record SchemaClass(
|
||||
int Index,
|
||||
string Name,
|
||||
string? Parent,
|
||||
IReadOnlyList<SchemaField> Fields)
|
||||
{
|
||||
|
||||
@@ -1,41 +1,41 @@
|
||||
/*
|
||||
* This file is part of CounterStrikeSharp.
|
||||
* CounterStrikeSharp 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.
|
||||
*
|
||||
* CounterStrikeSharp 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 CounterStrikeSharp. If not, see <https://www.gnu.org/licenses/>. *
|
||||
*/
|
||||
#include "UserMessage.h"
|
||||
|
||||
#include "networksystem/inetworkserializer.h"
|
||||
|
||||
using namespace google;
|
||||
|
||||
namespace counterstrikesharp {
|
||||
int UserMessage::GetMessageID() { return msgSerializable->GetNetMessageInfo()->m_MessageId; }
|
||||
|
||||
std::string UserMessage::GetMessageName() { return msgSerializable->GetUnscopedName(); }
|
||||
|
||||
bool UserMessage::HasField(std::string fieldName)
|
||||
{
|
||||
const google::protobuf::Descriptor* descriptor = msg->GetDescriptor();
|
||||
const google::protobuf::FieldDescriptor* field = descriptor->FindFieldByName(fieldName);
|
||||
|
||||
if (field == nullptr || (field->label() == google::protobuf::FieldDescriptor::LABEL_REPEATED))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return this->msg->GetReflection()->HasField(*this->msg, field);
|
||||
}
|
||||
|
||||
const CNetMessagePB<google::protobuf::Message>* UserMessage::GetProtobufMessage() { return msg; }
|
||||
} // namespace counterstrikesharp
|
||||
/*
|
||||
* This file is part of CounterStrikeSharp.
|
||||
* CounterStrikeSharp 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.
|
||||
*
|
||||
* CounterStrikeSharp 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 CounterStrikeSharp. If not, see <https://www.gnu.org/licenses/>. *
|
||||
*/
|
||||
#include "UserMessage.h"
|
||||
|
||||
#include "networksystem/inetworkserializer.h"
|
||||
|
||||
using namespace google;
|
||||
|
||||
namespace counterstrikesharp {
|
||||
int UserMessage::GetMessageID() { return msgSerializable->GetNetMessageInfo()->m_MessageId; }
|
||||
|
||||
std::string UserMessage::GetMessageName() { return msgSerializable->GetUnscopedName(); }
|
||||
|
||||
bool UserMessage::HasField(std::string fieldName)
|
||||
{
|
||||
const google::protobuf::Descriptor* descriptor = msg->GetDescriptor();
|
||||
const google::protobuf::FieldDescriptor* field = descriptor->FindFieldByName(fieldName);
|
||||
|
||||
if (field == nullptr || (field->label() == google::protobuf::FieldDescriptor::LABEL_REPEATED))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return this->msg->GetReflection()->HasField(*this->msg, field);
|
||||
}
|
||||
|
||||
const CNetMessagePB<google::protobuf::Message>* UserMessage::GetProtobufMessage() { return msg; }
|
||||
} // namespace counterstrikesharp
|
||||
|
||||
@@ -60,6 +60,8 @@ bool CCoreConfig::Init(char* conf_error, int conf_error_size)
|
||||
ServerLanguage = m_json.value("ServerLanguage", ServerLanguage);
|
||||
UnlockConCommands = m_json.value("UnlockConCommands", UnlockConCommands);
|
||||
UnlockConVars = m_json.value("UnlockConVars", UnlockConVars);
|
||||
AutoUpdateEnabled = m_json.value("AutoUpdateEnabled", AutoUpdateEnabled);
|
||||
AutoUpdateURL = m_json.value("AutoUpdateURL", AutoUpdateURL);
|
||||
}
|
||||
catch (const std::exception& ex)
|
||||
{
|
||||
|
||||
@@ -35,6 +35,8 @@ class CCoreConfig
|
||||
std::string ServerLanguage = "en";
|
||||
bool UnlockConCommands = true;
|
||||
bool UnlockConVars = true;
|
||||
bool AutoUpdateEnabled = true;
|
||||
std::string AutoUpdateURL = std::string("https://gamedata.cssharp.dev");
|
||||
|
||||
using json = nlohmann::json;
|
||||
CCoreConfig(const std::string& path);
|
||||
|
||||
@@ -28,8 +28,7 @@ class CGameResourceService
|
||||
public:
|
||||
CGameEntitySystem* GetGameEntitySystem()
|
||||
{
|
||||
return *reinterpret_cast<CGameEntitySystem**>(
|
||||
(uintptr_t)(this) +
|
||||
counterstrikesharp::globals::gameConfig->GetOffset("GameEntitySystem"));
|
||||
return *reinterpret_cast<CGameEntitySystem**>((uintptr_t)(this) +
|
||||
counterstrikesharp::globals::gameConfig->GetOffset("GameEntitySystem"));
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
@@ -26,11 +26,10 @@
|
||||
#include "tier0/memdbgon.h"
|
||||
|
||||
namespace counterstrikesharp {
|
||||
void interfaces::Initialize() {
|
||||
pGameResourceServiceServer = (CGameResourceService*)modules::engine->FindInterface(
|
||||
GAMERESOURCESERVICESERVER_INTERFACE_VERSION);
|
||||
void interfaces::Initialize()
|
||||
{
|
||||
pGameResourceServiceServer = (CGameResourceService*)modules::engine->FindInterface(GAMERESOURCESERVICESERVER_INTERFACE_VERSION);
|
||||
g_pCVar = (ICvar*)modules::tier0->FindInterface(CVAR_INTERFACE_VERSION);
|
||||
g_pSource2GameEntities = (ISource2GameEntities*)modules::server->FindInterface(
|
||||
SOURCE2GAMEENTITIES_INTERFACE_VERSION);
|
||||
g_pSource2GameEntities = (ISource2GameEntities*)modules::server->FindInterface(SOURCE2GAMEENTITIES_INTERFACE_VERSION);
|
||||
}
|
||||
} // namespace counterstrikesharp
|
||||
} // namespace counterstrikesharp
|
||||
|
||||
@@ -25,6 +25,6 @@ namespace counterstrikesharp {
|
||||
namespace interfaces {
|
||||
void Initialize();
|
||||
|
||||
inline CGameResourceService *pGameResourceServiceServer = nullptr;
|
||||
} // namespace interfaces
|
||||
} // namespace counterstrikesharp
|
||||
inline CGameResourceService* pGameResourceServiceServer = nullptr;
|
||||
} // namespace interfaces
|
||||
} // namespace counterstrikesharp
|
||||
|
||||
@@ -33,8 +33,10 @@
|
||||
using SchemaKeyValueMap_t = CUtlMap<uint32_t, SchemaKey>;
|
||||
using SchemaTableMap_t = CUtlMap<uint32_t, SchemaKeyValueMap_t*>;
|
||||
|
||||
bool IsFieldNetworked(SchemaClassFieldData_t& field) {
|
||||
for (int i = 0; i < field.m_nStaticMetadataCount; i++) {
|
||||
bool IsFieldNetworked(SchemaClassFieldData_t& field)
|
||||
{
|
||||
for (int i = 0; i < field.m_nStaticMetadataCount; i++)
|
||||
{
|
||||
static auto networkEnabled = hash_32_fnv1a_const("MNetworkEnable");
|
||||
if (networkEnabled == hash_32_fnv1a_const(field.m_pStaticMetadata[i].m_pszName)) return true;
|
||||
}
|
||||
@@ -42,16 +44,16 @@ bool IsFieldNetworked(SchemaClassFieldData_t& field) {
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool InitSchemaFieldsForClass(SchemaTableMap_t* tableMap,
|
||||
const char* className,
|
||||
uint32_t classKey) {
|
||||
static bool InitSchemaFieldsForClass(SchemaTableMap_t* tableMap, const char* className, uint32_t classKey)
|
||||
{
|
||||
CSchemaSystemTypeScope* pType = counterstrikesharp::globals::schemaSystem->FindTypeScopeForModule(MODULE_PREFIX "server" MODULE_EXT);
|
||||
|
||||
if (!pType) return false;
|
||||
|
||||
SchemaClassInfoData_t* pClassInfo = pType->FindDeclaredClass(className).Get();
|
||||
|
||||
if (!pClassInfo) {
|
||||
if (!pClassInfo)
|
||||
{
|
||||
SchemaKeyValueMap_t* map = new SchemaKeyValueMap_t(0, 0, DefLessFunc(uint32_t));
|
||||
tableMap->Insert(classKey, map);
|
||||
|
||||
@@ -66,31 +68,34 @@ static bool InitSchemaFieldsForClass(SchemaTableMap_t* tableMap,
|
||||
keyValueMap->EnsureCapacity(fieldsSize);
|
||||
tableMap->Insert(classKey, keyValueMap);
|
||||
|
||||
for (int i = 0; i < fieldsSize; ++i) {
|
||||
for (int i = 0; i < fieldsSize; ++i)
|
||||
{
|
||||
SchemaClassFieldData_t& field = pFields[i];
|
||||
|
||||
keyValueMap->Insert(hash_32_fnv1a_const(field.m_pszName),
|
||||
{field.m_nSingleInheritanceOffset, IsFieldNetworked(field)});
|
||||
keyValueMap->Insert(hash_32_fnv1a_const(field.m_pszName), { field.m_nSingleInheritanceOffset, IsFieldNetworked(field) });
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int16_t schema::FindChainOffset(const char* className) {
|
||||
CSchemaSystemTypeScope* pType =
|
||||
counterstrikesharp::globals::schemaSystem->FindTypeScopeForModule(MODULE_PREFIX "server" MODULE_EXT);
|
||||
int16_t schema::FindChainOffset(const char* className)
|
||||
{
|
||||
CSchemaSystemTypeScope* pType = counterstrikesharp::globals::schemaSystem->FindTypeScopeForModule(MODULE_PREFIX "server" MODULE_EXT);
|
||||
|
||||
if (!pType) return false;
|
||||
|
||||
auto* pClassInfo = pType->FindDeclaredClass(className).Get();
|
||||
|
||||
do {
|
||||
do
|
||||
{
|
||||
SchemaClassFieldData_t* pFields = pClassInfo->m_pFields;
|
||||
short fieldsSize = pClassInfo->m_nFieldCount;
|
||||
for (int i = 0; i < fieldsSize; ++i) {
|
||||
for (int i = 0; i < fieldsSize; ++i)
|
||||
{
|
||||
SchemaClassFieldData_t& field = pFields[i];
|
||||
|
||||
if (V_strcmp(field.m_pszName, "__m_pChainEntity") == 0) {
|
||||
if (V_strcmp(field.m_pszName, "__m_pChainEntity") == 0)
|
||||
{
|
||||
return field.m_nSingleInheritanceOffset;
|
||||
}
|
||||
}
|
||||
@@ -99,29 +104,29 @@ int16_t schema::FindChainOffset(const char* className) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
SchemaKey schema::GetOffset(const char* className,
|
||||
uint32_t classKey,
|
||||
const char* memberName,
|
||||
uint32_t memberKey) {
|
||||
SchemaKey schema::GetOffset(const char* className, uint32_t classKey, const char* memberName, uint32_t memberKey)
|
||||
{
|
||||
static SchemaTableMap_t schemaTableMap(0, 0, DefLessFunc(uint32_t));
|
||||
int16_t tableMapIndex = schemaTableMap.Find(classKey);
|
||||
if (!schemaTableMap.IsValidIndex(tableMapIndex)) {
|
||||
if (InitSchemaFieldsForClass(&schemaTableMap, className, classKey))
|
||||
return GetOffset(className, classKey, memberName, memberKey);
|
||||
if (!schemaTableMap.IsValidIndex(tableMapIndex))
|
||||
{
|
||||
if (InitSchemaFieldsForClass(&schemaTableMap, className, classKey)) return GetOffset(className, classKey, memberName, memberKey);
|
||||
|
||||
return {0, 0};
|
||||
return { 0, 0 };
|
||||
}
|
||||
|
||||
SchemaKeyValueMap_t* tableMap = schemaTableMap[tableMapIndex];
|
||||
int16_t memberIndex = tableMap->Find(memberKey);
|
||||
if (!tableMap->IsValidIndex(memberIndex)) {
|
||||
return {0, 0};
|
||||
if (!tableMap->IsValidIndex(memberIndex))
|
||||
{
|
||||
return { 0, 0 };
|
||||
}
|
||||
|
||||
return tableMap->Element(memberIndex);
|
||||
}
|
||||
|
||||
void SetStateChanged(Z_CBaseEntity* pEntity, int offset) {
|
||||
void SetStateChanged(Z_CBaseEntity* pEntity, int offset)
|
||||
{
|
||||
// addresses::StateChanged(pEntity->m_NetworkTransmitComponent(), pEntity, offset, -1, -1);
|
||||
auto vars = counterstrikesharp::globals::getGlobalVars();
|
||||
|
||||
|
||||
@@ -30,29 +30,28 @@
|
||||
|
||||
#undef schema
|
||||
|
||||
struct SchemaKey {
|
||||
struct SchemaKey
|
||||
{
|
||||
int32_t offset;
|
||||
bool networked;
|
||||
};
|
||||
|
||||
class Z_CBaseEntity;
|
||||
void SetStateChanged(Z_CBaseEntity *pEntity, int offset);
|
||||
void SetStateChanged(Z_CBaseEntity* pEntity, int offset);
|
||||
|
||||
inline uint32_t val_32_const = 0x811c9dc5;
|
||||
inline uint32_t prime_32_const = 0x1000193;
|
||||
inline uint64_t val_64_const = 0xcbf29ce484222325;
|
||||
inline uint64_t prime_64_const = 0x100000001b3;
|
||||
|
||||
inline uint32_t hash_32_fnv1a_const(const char *str, const uint32_t value = val_32_const) noexcept {
|
||||
return (str[0] == '\0')
|
||||
? value
|
||||
: hash_32_fnv1a_const(&str[1], (value ^ uint32_t(str[0])) * prime_32_const);
|
||||
inline uint32_t hash_32_fnv1a_const(const char* str, const uint32_t value = val_32_const) noexcept
|
||||
{
|
||||
return (str[0] == '\0') ? value : hash_32_fnv1a_const(&str[1], (value ^ uint32_t(str[0])) * prime_32_const);
|
||||
}
|
||||
|
||||
inline uint64_t hash_64_fnv1a_const(const char *str, const uint64_t value = val_64_const) noexcept {
|
||||
return (str[0] == '\0')
|
||||
? value
|
||||
: hash_64_fnv1a_const(&str[1], (value ^ uint64_t(str[0])) * prime_64_const);
|
||||
inline uint64_t hash_64_fnv1a_const(const char* str, const uint64_t value = val_64_const) noexcept
|
||||
{
|
||||
return (str[0] == '\0') ? value : hash_64_fnv1a_const(&str[1], (value ^ uint64_t(str[0])) * prime_64_const);
|
||||
}
|
||||
|
||||
namespace schema {
|
||||
@@ -95,6 +94,6 @@ static std::vector<std::string> CS2BadList = {
|
||||
"m_nMusicID",
|
||||
};
|
||||
|
||||
int16_t FindChainOffset(const char *className);
|
||||
SchemaKey GetOffset(const char *className, uint32_t classKey, const char *memberName, uint32_t memberKey);
|
||||
} // namespace schema
|
||||
int16_t FindChainOffset(const char* className);
|
||||
SchemaKey GetOffset(const char* className, uint32_t classKey, const char* memberName, uint32_t memberKey);
|
||||
} // namespace schema
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user