Compare commits
91 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
414818e314 | ||
|
|
a42e9a37fc | ||
|
|
dcd68aed67 | ||
|
|
7bb97af619 | ||
|
|
cdc58df13c | ||
|
|
fe5cc9a82a | ||
|
|
01542a7dc6 | ||
|
|
e1f24abd5d | ||
|
|
646050fb72 | ||
|
|
87dadb9c62 | ||
|
|
cf421c5614 | ||
|
|
fc64e1d261 | ||
|
|
45fc4a86a5 | ||
|
|
ad105e5cd2 | ||
|
|
f668f56d66 | ||
|
|
de6672507a | ||
|
|
2855d4e9ae | ||
|
|
0c05c25e8e | ||
|
|
8335ede7d7 | ||
|
|
d79246f161 | ||
|
|
a504506129 | ||
|
|
7bada81eb9 | ||
|
|
2929735429 | ||
|
|
04bb7a2575 | ||
|
|
f00ba48f60 | ||
|
|
08342e4a99 | ||
|
|
29a6041d7a | ||
|
|
c44433766c | ||
|
|
a987ed972a | ||
|
|
50777661c5 | ||
|
|
31fd014f55 | ||
|
|
760429e644 | ||
|
|
304d8501cc | ||
|
|
e9f7db5171 | ||
|
|
648b928b4e | ||
|
|
530a7d64c7 | ||
|
|
3453f4c505 | ||
|
|
25b466422b | ||
|
|
6baa59dd9b | ||
|
|
10afe7ce1e | ||
|
|
5eeb0c5fec | ||
|
|
e53ee27b39 | ||
|
|
75112b02fe | ||
|
|
8e92635231 | ||
|
|
6923295cb6 | ||
|
|
e5f98077f3 | ||
|
|
3296055841 | ||
|
|
89de192c20 | ||
|
|
a1297b9cbe | ||
|
|
99af078b32 | ||
|
|
b0bef746cd | ||
|
|
117a95e99c | ||
|
|
a6d4108ca7 | ||
|
|
7b45169d8d | ||
|
|
42bd45c3f0 | ||
|
|
5262739c3d | ||
|
|
c82a0c0d26 | ||
|
|
9ad7f9fc83 | ||
|
|
9e2dac52e5 | ||
|
|
118931f44d | ||
|
|
843ae34e31 | ||
|
|
46a720ff83 | ||
|
|
63d059b607 | ||
|
|
005ef18338 | ||
|
|
c0c1fe2566 | ||
|
|
c4ad17a7ed | ||
|
|
99fde6ec52 | ||
|
|
ca2c3eb212 | ||
|
|
b5a4577af1 | ||
|
|
ba93e4a3aa | ||
|
|
7d435da9d1 | ||
|
|
50008cf74a | ||
|
|
4b9b169483 | ||
|
|
25d251deff | ||
|
|
d8f7798f9f | ||
|
|
fb023aff5b | ||
|
|
6c91e20a4d | ||
|
|
93dae346d0 | ||
|
|
8e0b1cc99a | ||
|
|
c99acbcdb3 | ||
|
|
8beaee94da | ||
|
|
62238b4446 | ||
|
|
03f194ac4e | ||
|
|
d88ce552f6 | ||
|
|
9f982d1e63 | ||
|
|
f01d4b0bf0 | ||
|
|
3a3f186673 | ||
|
|
e775b05f9f | ||
|
|
b09b97bbd5 | ||
|
|
e441ccc601 | ||
|
|
dc7fb183f9 |
34
.github/workflows/build.yml
vendored
@@ -3,8 +3,16 @@ name: Build
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ "main" ]
|
branches: [ "main" ]
|
||||||
|
paths-ignore:
|
||||||
|
- '**/README.md'
|
||||||
|
- '**/.gitignore'
|
||||||
|
- '**/LICENSE'
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [ "main" ]
|
branches: [ "main" ]
|
||||||
|
paths-ignore:
|
||||||
|
- '**/README.md'
|
||||||
|
- '**/.gitignore'
|
||||||
|
- '**/LICENSE'
|
||||||
|
|
||||||
env:
|
env:
|
||||||
BUILD_NUMBER: ${{ github.run_number }}
|
BUILD_NUMBER: ${{ github.run_number }}
|
||||||
@@ -12,7 +20,6 @@ env:
|
|||||||
PROJECT_NAME: "WeaponPaints"
|
PROJECT_NAME: "WeaponPaints"
|
||||||
OUTPUT_PATH: "./WeaponPaints"
|
OUTPUT_PATH: "./WeaponPaints"
|
||||||
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
permissions: write-all
|
permissions: write-all
|
||||||
@@ -28,19 +35,40 @@ jobs:
|
|||||||
run: dotnet restore
|
run: dotnet restore
|
||||||
- name: Build
|
- name: Build
|
||||||
run: dotnet build ${{ env.PROJECT_PATH }} -c WeaponPaints -o ${{ env.OUTPUT_PATH }}
|
run: dotnet build ${{ env.PROJECT_PATH }} -c WeaponPaints -o ${{ env.OUTPUT_PATH }}
|
||||||
|
|
||||||
|
publish:
|
||||||
|
if: github.event_name == 'push'
|
||||||
|
permissions: write-all
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: build
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- name: Setup .NET
|
||||||
|
uses: actions/setup-dotnet@v3
|
||||||
|
with:
|
||||||
|
dotnet-version: 7.0.x
|
||||||
|
- name: Restore
|
||||||
|
run: dotnet restore
|
||||||
|
- name: Build
|
||||||
|
run: dotnet build ${{ env.PROJECT_PATH }} -c WeaponPaints -o ${{ env.OUTPUT_PATH }}
|
||||||
- name: Clean files
|
- name: Clean files
|
||||||
run: |
|
run: |
|
||||||
rm -f \
|
rm -f \
|
||||||
${{ env.OUTPUT_PATH }}/CounterStrikeSharp.API.dll \
|
${{ env.OUTPUT_PATH }}/CounterStrikeSharp.API.dll \
|
||||||
${{ env.OUTPUT_PATH }}/McMaster.NETCore.Plugins.dll \
|
${{ env.OUTPUT_PATH }}/McMaster.NETCore.Plugins.dll \
|
||||||
${{ env.OUTPUT_PATH }}/Microsoft.DotNet.PlatformAbstractions.dll \
|
${{ env.OUTPUT_PATH }}/Microsoft.DotNet.PlatformAbstractions.dll \
|
||||||
${{ env.OUTPUT_PATH }}/Microsoft.Extensions.DependencyModel.dll
|
${{ env.OUTPUT_PATH }}/Microsoft.Extensions.DependencyModel.dll \
|
||||||
|
- name: Copy skins.json
|
||||||
|
run: cp website/data/skins.json ${{ env.OUTPUT_PATH }}/skins.json
|
||||||
- name: Zip
|
- name: Zip
|
||||||
uses: thedoctor0/zip-release@0.7.5
|
uses: thedoctor0/zip-release@0.7.5
|
||||||
with:
|
with:
|
||||||
type: 'zip'
|
type: 'zip'
|
||||||
filename: '${{ env.PROJECT_NAME }}.zip'
|
filename: '${{ env.PROJECT_NAME }}.zip'
|
||||||
path: ${{ env.OUTPUT_PATH }}
|
path: ${{ env.OUTPUT_PATH }}
|
||||||
|
- name: Clean files Website
|
||||||
|
run: |
|
||||||
|
rm -rf website/img/
|
||||||
- name: Zip
|
- name: Zip
|
||||||
uses: thedoctor0/zip-release@0.7.5
|
uses: thedoctor0/zip-release@0.7.5
|
||||||
with:
|
with:
|
||||||
@@ -54,4 +82,4 @@ jobs:
|
|||||||
name: "Build ${{ env.BUILD_NUMBER }}"
|
name: "Build ${{ env.BUILD_NUMBER }}"
|
||||||
tag: "build-${{ env.BUILD_NUMBER }}"
|
tag: "build-${{ env.BUILD_NUMBER }}"
|
||||||
body: |
|
body: |
|
||||||
Place the plugin in game/csgo/addons/counterstrikesharp/plugins/WeaponPaints
|
Place the plugin in game/csgo/addons/counterstrikesharp/plugins/WeaponPaints
|
||||||
|
|||||||
117
Config.cs
@@ -1,32 +1,109 @@
|
|||||||
using CounterStrikeSharp.API.Core;
|
using CounterStrikeSharp.API.Core;
|
||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
namespace WeaponPaints
|
namespace WeaponPaints
|
||||||
{
|
{
|
||||||
public class WeaponPaintsConfig : BasePluginConfig
|
public class Messages
|
||||||
{
|
{
|
||||||
public override int Version { get; set; } = 1;
|
[JsonPropertyName("WebsiteMessageCommand")]
|
||||||
|
public string WebsiteMessageCommand { get; set; } = "Visit {WEBSITE} where you can change skins.";
|
||||||
|
[JsonPropertyName("SynchronizeMessageCommand")]
|
||||||
|
public string SynchronizeMessageCommand { get; set; } = "Type !wp to synchronize chosen skins.";
|
||||||
|
[JsonPropertyName("KnifeMessageCommand")]
|
||||||
|
public string KnifeMessageCommand { get; set; } = "Type !knife to open knife menu.";
|
||||||
|
[JsonPropertyName("CooldownRefreshCommand")]
|
||||||
|
public string CooldownRefreshCommand { get; set; } = "You can't refresh weapon paints right now.";
|
||||||
|
[JsonPropertyName("SuccessRefreshCommand")]
|
||||||
|
public string SuccessRefreshCommand { get; set; } = "Refreshing weapon paints.";
|
||||||
|
[JsonPropertyName("ChosenKnifeMenu")]
|
||||||
|
public string ChosenKnifeMenu { get; set; } = "You have chosen {KNIFE} as your knife.";
|
||||||
|
[JsonPropertyName("ChosenSkinMenu")]
|
||||||
|
public string ChosenSkinMenu { get; set; } = "You have chosen {SKIN} as your skin.";
|
||||||
|
[JsonPropertyName("ChosenKnifeMenuKill")]
|
||||||
|
public string ChosenKnifeMenuKill { get; set; } = "To correctly apply skin for knife, you need to type !kill.";
|
||||||
|
[JsonPropertyName("KnifeMenuTitle")]
|
||||||
|
public string KnifeMenuTitle { get; set; } = "Knife Menu.";
|
||||||
|
[JsonPropertyName("WeaponMenuTitle")]
|
||||||
|
public string WeaponMenuTitle { get; set; } = "Weapon Menu.";
|
||||||
|
[JsonPropertyName("SkinMenuTitle")]
|
||||||
|
public string SkinMenuTitle { get; set; } = "Select skin for {WEAPON}";
|
||||||
|
}
|
||||||
|
|
||||||
[JsonPropertyName("DatabaseHost")]
|
public class Additional
|
||||||
public string DatabaseHost { get; set; } = "localhost";
|
{
|
||||||
|
[JsonPropertyName("SkinVisibilityFix")]
|
||||||
|
public bool SkinVisibilityFix { get; set; } = true;
|
||||||
|
|
||||||
[JsonPropertyName("DatabasePort")]
|
[JsonPropertyName("KnifeEnabled")]
|
||||||
public int DatabasePort { get; set; } = 3306;
|
public bool KnifeEnabled { get; set; } = true;
|
||||||
|
|
||||||
[JsonPropertyName("DatabaseUser")]
|
[JsonPropertyName("SkinEnabled")]
|
||||||
public string DatabaseUser { get; set; } = "dbuser";
|
public bool SkinEnabled { get; set; } = true;
|
||||||
|
|
||||||
[JsonPropertyName("DatabasePassword")]
|
[JsonPropertyName("CommandWpEnabled")]
|
||||||
public string DatabasePassword { get; set; } = "dbuserpw";
|
public bool CommandWpEnabled { get; set; } = true;
|
||||||
|
|
||||||
[JsonPropertyName("DatabaseName")]
|
[JsonPropertyName("CommandKillEnabled")]
|
||||||
public string DatabaseName { get; set; } = "dbname";
|
public bool CommandKillEnabled { get; set; } = true;
|
||||||
|
|
||||||
[JsonPropertyName("CmdRefreshCooldownSeconds")]
|
[JsonPropertyName("CommandKnife")]
|
||||||
public int CmdRefreshCooldownSeconds { get; set; } = 60;
|
public string CommandKnife { get; set; } = "knife";
|
||||||
|
|
||||||
|
[JsonPropertyName("CommandSkin")]
|
||||||
|
public string CommandSkin { get; set; } = "ws";
|
||||||
|
|
||||||
|
[JsonPropertyName("CommandSkinSelection")]
|
||||||
|
public string CommandSkinSelection { get; set; } = "skins";
|
||||||
|
|
||||||
|
[JsonPropertyName("CommandRefresh")]
|
||||||
|
public string CommandRefresh { get; set; } = "wp";
|
||||||
|
|
||||||
|
[JsonPropertyName("CommandKill")]
|
||||||
|
public string CommandKill { get; set; } = "kill";
|
||||||
|
|
||||||
|
[JsonPropertyName("GiveRandomKnife")]
|
||||||
|
public bool GiveRandomKnife { get; set; } = false;
|
||||||
|
|
||||||
|
[JsonPropertyName("GiveRandomSkin")]
|
||||||
|
public bool GiveRandomSkin { get; set; } = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public class WeaponPaintsConfig : BasePluginConfig
|
||||||
|
{
|
||||||
|
public override int Version { get; set; } = 4;
|
||||||
|
|
||||||
|
[JsonPropertyName("DatabaseHost")]
|
||||||
|
public string DatabaseHost { get; set; } = "";
|
||||||
|
|
||||||
|
[JsonPropertyName("DatabasePort")]
|
||||||
|
public int DatabasePort { get; set; } = 3306;
|
||||||
|
|
||||||
|
[JsonPropertyName("DatabaseUser")]
|
||||||
|
public string DatabaseUser { get; set; } = "";
|
||||||
|
|
||||||
|
[JsonPropertyName("DatabasePassword")]
|
||||||
|
public string DatabasePassword { get; set; } = "";
|
||||||
|
|
||||||
|
[JsonPropertyName("DatabaseName")]
|
||||||
|
public string DatabaseName { get; set; } = "";
|
||||||
|
|
||||||
|
[JsonPropertyName("GlobalShare")]
|
||||||
|
public bool GlobalShare { get; set; } = false;
|
||||||
|
|
||||||
|
[JsonPropertyName("CmdRefreshCooldownSeconds")]
|
||||||
|
public int CmdRefreshCooldownSeconds { get; set; } = 60;
|
||||||
|
|
||||||
|
[JsonPropertyName("Prefix")]
|
||||||
|
public string Prefix { get; set; } = "[WeaponPaints]";
|
||||||
|
|
||||||
|
[JsonPropertyName("Website")]
|
||||||
|
public string Website { get; set; } = "example.com/skins";
|
||||||
|
|
||||||
|
[JsonPropertyName("Messages")]
|
||||||
|
public Messages Messages { get; set; } = new Messages();
|
||||||
|
|
||||||
|
[JsonPropertyName("Additional")]
|
||||||
|
public Additional Additional { get; set; } = new Additional();
|
||||||
|
}
|
||||||
|
|
||||||
[JsonPropertyName("WebSite")]
|
|
||||||
public string WebSite { get; set; } = "http://wp.example.com";
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
103
README.md
@@ -1,33 +1,80 @@
|
|||||||
# cs2-WeaponPaints
|
# CS2 Weapon Paints
|
||||||
|
|
||||||
[](https://ko-fi.com/E1E2G0P2O) or [Donate on Steam](https://steamcommunity.com/tradeoffer/new/?partner=41515647&token=gW2W-nXE)
|
## Description
|
||||||
|
Unfinished, unoptimized and not fully functional ugly demo weapon paints plugin for **[CSSharp](https://docs.cssharp.dev/)**.
|
||||||
|
|
||||||
|
## Created [Discord server](https://discord.gg/d9CvaYPSFe) where you can discus about plugin.
|
||||||
|
|
||||||
|
### Consider to donate instead of buying from unknown sources.
|
||||||
|
[](https://ko-fi.com/E1E2G0P2O) or [](https://steamcommunity.com/tradeoffer/new/?partner=41515647&token=gW2W-nXE)
|
||||||
|
|
||||||
|
## Features
|
||||||
|
- Changes only paint, seed and wear on weapons and knives;
|
||||||
|
- MySQL based or global website at [weaponpaints.fun](https://weaponpaints.fun/), so you dont need MySQL/Website;
|
||||||
|
- Data sync on player connect;
|
||||||
|
- Added command **`!wp`** to refresh skins; ***(with cooldown in second can be configured)***
|
||||||
|
- Added command **`!ws`** to show website;
|
||||||
|
- Added command **`!knife`** to show menu with knives;
|
||||||
|
- Knife change is now limited to have these cvars empty **`mp_t_default_melee ""`** and **`mp_ct_default_melee ""`**;
|
||||||
|
|
||||||
|
## CS2 Server
|
||||||
|
- Compile and copy plugin to plugins, [more info here](https://docs.cssharp.dev/guides/hello-world-plugin/);
|
||||||
|
- Setup **`addons/counterstrikesharp/configs/plugins/WeaponPaints/WeaponPaints.json`** set **`GlobalShare`** to **`true`** for global, or include database credentials;
|
||||||
|
- in **`addons/counterstrikesharp/configs/core.json`** set **FollowCS2ServerGuidelines** to **`false`**;
|
||||||
|
|
||||||
|
## Plugin Configuration
|
||||||
|
<details>
|
||||||
|
<summary>Spoiler warning</summary>
|
||||||
|
<code><pre>{
|
||||||
|
"Version": 4, // Don't touch
|
||||||
|
"DatabaseHost": "", // MySQL host (required if GlobalShare = false)
|
||||||
|
"DatabasePort": 3306, // MySQL port (required if GlobalShare = false)
|
||||||
|
"DatabaseUser": "", // MySQL username (required if GlobalShare = false)
|
||||||
|
"DatabasePassword": "", // MySQL user password (required if GlobalShare = false)
|
||||||
|
"DatabaseName": "", // MySQL database name (required if GlobalShare = false)
|
||||||
|
"GlobalShare": false, // Enable or disable GlobalShare, plugin can work without mysql credentials but with shared website at weaponpaints.fun
|
||||||
|
"CmdRefreshCooldownSeconds": 60, // Cooldown time in refreshing skins (!wp command)
|
||||||
|
"Prefix": "[WeaponPaints]", // Prefix every chat message
|
||||||
|
"Website": "example.com/skins", // Website used in WebsiteMessageCommand (!ws command)
|
||||||
|
"Messages": {
|
||||||
|
"WebsiteMessageCommand": "Visit {WEBSITE} where you can change skins.", // Information about website where player can change skins (!ws command) Set to empty to disable
|
||||||
|
"SynchronizeMessageCommand": "Type !wp to synchronize chosen skins.", // Information about skins refreshing (!ws command) Set to empty to disable
|
||||||
|
"KnifeMessageCommand": "Type !knife to open knife menu.", // Information about knife menu (!ws command) Set to empty to disable
|
||||||
|
"CooldownRefreshCommand": "You can\u0027t refresh weapon paints right now.", // Cooldown information (!wp command) Set to empty to disable
|
||||||
|
"SuccessRefreshCommand": "Refreshing weapon paints.", // Information about refreshing skins (!wp command) Set to empty to disable
|
||||||
|
"ChosenKnifeMenu": "You have chosen {KNIFE} as your knife.", // Information about choosen knife (!knife command) Set to empty to disable
|
||||||
|
"ChosenKnifeMenuKill": "To correctly apply skin for knife, you need to type !kill.", // Information about suicide after knife selection (!knife command) Set to empty to disable
|
||||||
|
"KnifeMenuTitle": "Knife Menu." // Menu title (!knife menu)
|
||||||
|
},
|
||||||
|
"Additional": {
|
||||||
|
"SkinVisibilityFix": true, // Enable or disable fix for skin visibility
|
||||||
|
"KnifeEnabled": true, // Enable or disable knife feature
|
||||||
|
"SkinEnabled": true, // Enable or disable skin feature
|
||||||
|
"CommandWpEnabled": true, // Enable or disable refreshing command
|
||||||
|
"CommandKillEnabled": true, // Enable or disable kill command
|
||||||
|
"CommandKnife": "knife", // Name of knife menu command, u can change to for e.g, knives
|
||||||
|
"CommandSkin": "ws", // Name of skin information command, u can change to for e.g, skins
|
||||||
|
"CommandRefresh": "wp", // Name of skin refreshing command, u can change to for e.g, refreshskins
|
||||||
|
"CommandKill": "kill", // Name of kill command, u can change to for e.g, suicide
|
||||||
|
"GiveRandomKnife": false // Give random knife to players if they didn't choose
|
||||||
|
},
|
||||||
|
|
||||||
|
"ConfigVersion": 4 // Don't touch
|
||||||
|
}</pre></code>
|
||||||
|
</details>
|
||||||
|
|
||||||
|
## Web install
|
||||||
|
Disregard if the config is **`GlobalShare = true`**;
|
||||||
|
- Requires PHP >= 7.4; ***(Tested on php ver **`8.2.3`** and nginx webserver)***
|
||||||
|
- Copy website to web server; ***(Folder `img` not needed)***
|
||||||
|
- Get [Steam API Key](https://steamcommunity.com/dev/apikey);
|
||||||
|
- Fill in database credentials and api key in `class/config.php`;
|
||||||
|
- Visit website and login via steam;
|
||||||
|
|
||||||
|
## Known issues
|
||||||
|
- Issue on Windows servers, no knives are given.
|
||||||
|
|
||||||
### Use this plugin at your own risk! Using this may lead to GSLT ban or something else Valve come with. [Valve Server guidelines](https://blog.counter-strike.net/index.php/server_guidelines/)
|
### Use this plugin at your own risk! Using this may lead to GSLT ban or something else Valve come with. [Valve Server guidelines](https://blog.counter-strike.net/index.php/server_guidelines/)
|
||||||
|
|
||||||
### Description
|
## Preview
|
||||||
Unfinished, unoptimized and not fully functional ugly demo weapon paints plugin for [CSSharp](https://docs.cssharp.dev/).
|
|
||||||
|
|
||||||
### Features
|
|
||||||
- changes only paint, seed and wear on weapons and knives
|
|
||||||
- mysql based
|
|
||||||
- data sync on player connect
|
|
||||||
- Added command `!wp` to refresh skins (with cooldown in second can be configured)
|
|
||||||
- Added command `!ws` to show website
|
|
||||||
- Added command `!knife` to show menu with knives
|
|
||||||
- Knife change is now limited to have these cvars empty `mp_t_default_melee ""` and `mp_ct_default_melee ""`
|
|
||||||
|
|
||||||
### CS2 server:
|
|
||||||
- compile and copy plugin to plugins. Info here [https://docs.cssharp.dev/guides/hello-world-plugin/](https://docs.cssharp.dev/guides/hello-world-plugin/)
|
|
||||||
- setup `addons/counterstrikesharp/configs/plugins/WeaponPaints/WeaponPaints.json` with database credentials
|
|
||||||
- in `addons/counterstrikesharp/configs/core.json` set **FollowCS2ServerGuidelines** to **false**
|
|
||||||
|
|
||||||
### Web install:
|
|
||||||
- requires PHP (tested on php ver `8.2.3` and nginx webserver)
|
|
||||||
- copy website to web server
|
|
||||||
- import `database.sql` to mysql
|
|
||||||
- get steam api key [https://steamcommunity.com/dev/apikey](https://steamcommunity.com/dev/apikey)
|
|
||||||
- fill in database credentials and api key in `class/config.php`
|
|
||||||
- visit website and login via steam
|
|
||||||
|
|
||||||
### Preview
|
|
||||||

|

|
||||||
|
|||||||
62
Utility.cs
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
using CounterStrikeSharp.API.Core;
|
||||||
|
using CounterStrikeSharp.API.Modules.Entities;
|
||||||
|
using CounterStrikeSharp.API.Modules.Utils;
|
||||||
|
using System.Reflection;
|
||||||
|
|
||||||
|
namespace WeaponPaints
|
||||||
|
{
|
||||||
|
public static class Utility
|
||||||
|
{
|
||||||
|
public static WeaponPaintsConfig? Config { get; set; }
|
||||||
|
|
||||||
|
public static bool IsPlayerValid(CCSPlayerController? player)
|
||||||
|
{
|
||||||
|
return (player != null && player.IsValid && !player.IsBot && !player.IsHLTV);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string ReplaceTags(string message)
|
||||||
|
{
|
||||||
|
if (message.Contains('{'))
|
||||||
|
{
|
||||||
|
string modifiedValue = message;
|
||||||
|
if (Config != null)
|
||||||
|
{
|
||||||
|
modifiedValue = modifiedValue.Replace("{WEBSITE}", Config.Website);
|
||||||
|
}
|
||||||
|
foreach (FieldInfo field in typeof(ChatColors).GetFields())
|
||||||
|
{
|
||||||
|
string pattern = $"{{{field.Name}}}";
|
||||||
|
if (message.Contains(pattern, StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
modifiedValue = modifiedValue.Replace(pattern, field.GetValue(null)!.ToString(), StringComparison.OrdinalIgnoreCase);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return modifiedValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void Log(string message)
|
||||||
|
{
|
||||||
|
Console.BackgroundColor = ConsoleColor.DarkGray;
|
||||||
|
Console.ForegroundColor = ConsoleColor.Cyan;
|
||||||
|
Console.WriteLine("[WeaponPaints] " + message);
|
||||||
|
Console.ResetColor();
|
||||||
|
}
|
||||||
|
public static void ShowAd(string moduleVersion)
|
||||||
|
{
|
||||||
|
Console.WriteLine(" ");
|
||||||
|
Console.WriteLine(" _ _ _______ _______ _______ _______ __ _ _______ _______ ___ __ _ _______ _______ ");
|
||||||
|
Console.WriteLine("| | _ | || || _ || || || | | || || _ || | | | | || || |");
|
||||||
|
Console.WriteLine("| || || || ___|| |_| || _ || _ || |_| || _ || |_| || | | |_| ||_ _|| _____|");
|
||||||
|
Console.WriteLine("| || |___ | || |_| || | | || || |_| || || | | | | | | |_____ ");
|
||||||
|
Console.WriteLine("| || ___|| || ___|| |_| || _ || ___|| || | | _ | | | |_____ |");
|
||||||
|
Console.WriteLine("| _ || |___ | _ || | | || | | || | | _ || | | | | | | | _____| |");
|
||||||
|
Console.WriteLine("|__| |__||_______||__| |__||___| |_______||_| |__||___| |__| |__||___| |_| |__| |___| |_______|");
|
||||||
|
Console.WriteLine(" >> Version: " + moduleVersion);
|
||||||
|
Console.WriteLine(" >> GitHub: https://github.com/Nereziel/cs2-WeaponPaints");
|
||||||
|
Console.WriteLine(" ");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
1468
WeaponPaints.cs
@@ -9,7 +9,9 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="CounterStrikeSharp.API" Version="*" />
|
<PackageReference Include="CounterStrikeSharp.API" Version="*" />
|
||||||
<PackageReference Include="Nexd.MySQL" Version="1.0.1" />
|
<PackageReference Include="Dapper" Version="2.1.21" />
|
||||||
|
<PackageReference Include="MySqlConnector" Version="2.3.1" />
|
||||||
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
96
website/class/utils.php
Normal file
@@ -0,0 +1,96 @@
|
|||||||
|
<?php
|
||||||
|
class UtilsClass
|
||||||
|
{
|
||||||
|
public static function skinsFromJson(): array
|
||||||
|
{
|
||||||
|
$skins = [];
|
||||||
|
$json = json_decode(file_get_contents(__DIR__ . "/../data/skins.json"), true);
|
||||||
|
|
||||||
|
foreach ($json as $skin) {
|
||||||
|
$skins[(int) $skin['weapon_defindex']][(int) $skin['paint']] = [
|
||||||
|
'weapon_name' => $skin['weapon_name'],
|
||||||
|
'paint_name' => $skin['paint_name'],
|
||||||
|
'image_url' => $skin['image'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $skins;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getWeaponsFromArray()
|
||||||
|
{
|
||||||
|
$weapons = [];
|
||||||
|
$temp = self::skinsFromJson();
|
||||||
|
|
||||||
|
foreach ($temp as $key => $value) {
|
||||||
|
if (key_exists($key, $weapons))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
$weapons[$key] = [
|
||||||
|
'weapon_name' => $value[0]['weapon_name'],
|
||||||
|
'paint_name' => $value[0]['paint_name'],
|
||||||
|
'image_url' => $value[0]['image_url'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $weapons;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getKnifeTypes()
|
||||||
|
{
|
||||||
|
$knifes = [];
|
||||||
|
$temp = self::getWeaponsFromArray();
|
||||||
|
|
||||||
|
foreach ($temp as $key => $weapon) {
|
||||||
|
if (
|
||||||
|
!in_array($key, [
|
||||||
|
500,
|
||||||
|
503,
|
||||||
|
505,
|
||||||
|
506,
|
||||||
|
507,
|
||||||
|
508,
|
||||||
|
509,
|
||||||
|
512,
|
||||||
|
514,
|
||||||
|
515,
|
||||||
|
516,
|
||||||
|
517,
|
||||||
|
518,
|
||||||
|
519,
|
||||||
|
520,
|
||||||
|
521,
|
||||||
|
522,
|
||||||
|
523,
|
||||||
|
525
|
||||||
|
])
|
||||||
|
)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
$knifes[$key] = [
|
||||||
|
'weapon_name' => $weapon['weapon_name'],
|
||||||
|
'paint_name' => rtrim(explode("|", $weapon['paint_name'])[0]),
|
||||||
|
'image_url' => $weapon['image_url'],
|
||||||
|
];
|
||||||
|
$knifes[0] = [
|
||||||
|
'weapon_name' => "weapon_knife",
|
||||||
|
'paint_name' => "Default knife",
|
||||||
|
'image_url' => "https://raw.githubusercontent.com/Nereziel/cs2-WeaponPaints/main/website/img/skins/weapon_knife.png",
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
ksort($knifes);
|
||||||
|
return $knifes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getSelectedSkins(array $temp)
|
||||||
|
{
|
||||||
|
$selected = [];
|
||||||
|
|
||||||
|
foreach ($temp as $weapon) {
|
||||||
|
$selected[$weapon['weapon_defindex']] = $weapon['weapon_paint_id'];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $selected;
|
||||||
|
}
|
||||||
|
}
|
||||||
1
website/data/skins.json
Normal file
1761
website/database.sql
BIN
website/img/skins/weapon_ak47.png
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
website/img/skins/weapon_ak47_am_bamboo_jungle_light.png
Normal file
|
After Width: | Height: | Size: 77 KiB |
BIN
website/img/skins/weapon_ak47_aq_ak47_cartel_light.png
Normal file
|
After Width: | Height: | Size: 82 KiB |
BIN
website/img/skins/weapon_ak47_aq_oiled_light.png
Normal file
|
After Width: | Height: | Size: 82 KiB |
|
After Width: | Height: | Size: 83 KiB |
BIN
website/img/skins/weapon_ak47_cu_ak47_anarchy_light.png
Normal file
|
After Width: | Height: | Size: 86 KiB |
BIN
website/img/skins/weapon_ak47_cu_ak47_anubis_light.png
Normal file
|
After Width: | Height: | Size: 81 KiB |
BIN
website/img/skins/weapon_ak47_cu_ak47_asiimov_light.png
Normal file
|
After Width: | Height: | Size: 76 KiB |
BIN
website/img/skins/weapon_ak47_cu_ak47_aztec_light.png
Normal file
|
After Width: | Height: | Size: 74 KiB |
BIN
website/img/skins/weapon_ak47_cu_ak47_cobra_light.png
Normal file
|
After Width: | Height: | Size: 70 KiB |
BIN
website/img/skins/weapon_ak47_cu_ak47_cogthings_light.png
Normal file
|
After Width: | Height: | Size: 82 KiB |
BIN
website/img/skins/weapon_ak47_cu_ak47_courage_alt_light.png
Normal file
|
After Width: | Height: | Size: 78 KiB |
BIN
website/img/skins/weapon_ak47_cu_ak47_mastery_light.png
Normal file
|
After Width: | Height: | Size: 67 KiB |
BIN
website/img/skins/weapon_ak47_cu_ak47_nightwish_light.png
Normal file
|
After Width: | Height: | Size: 97 KiB |
BIN
website/img/skins/weapon_ak47_cu_ak47_point_disarray_light.png
Normal file
|
After Width: | Height: | Size: 87 KiB |
BIN
website/img/skins/weapon_ak47_cu_ak47_rubber_light.png
Normal file
|
After Width: | Height: | Size: 80 KiB |
BIN
website/img/skins/weapon_ak47_cu_ak47_winter_sport_light.png
Normal file
|
After Width: | Height: | Size: 92 KiB |
BIN
website/img/skins/weapon_ak47_cu_ak_head_shot_holo_light.png
Normal file
|
After Width: | Height: | Size: 88 KiB |
BIN
website/img/skins/weapon_ak47_cu_ak_island_floral_light.png
Normal file
|
After Width: | Height: | Size: 84 KiB |
BIN
website/img/skins/weapon_ak47_cu_ak_jaguar_light.png
Normal file
|
After Width: | Height: | Size: 88 KiB |
BIN
website/img/skins/weapon_ak47_cu_ak_neon_rider_light.png
Normal file
|
After Width: | Height: | Size: 94 KiB |
BIN
website/img/skins/weapon_ak47_cu_ak_xray_light.png
Normal file
|
After Width: | Height: | Size: 85 KiB |
|
After Width: | Height: | Size: 81 KiB |
BIN
website/img/skins/weapon_ak47_cu_green_leather_ak47_light.png
Normal file
|
After Width: | Height: | Size: 72 KiB |
BIN
website/img/skins/weapon_ak47_cu_panther_ak47_light.png
Normal file
|
After Width: | Height: | Size: 85 KiB |
BIN
website/img/skins/weapon_ak47_cu_pinstripe_ak47_light.png
Normal file
|
After Width: | Height: | Size: 75 KiB |
BIN
website/img/skins/weapon_ak47_cu_tribute_ak47_light.png
Normal file
|
After Width: | Height: | Size: 83 KiB |
BIN
website/img/skins/weapon_ak47_cu_well_traveled_ak47_light.png
Normal file
|
After Width: | Height: | Size: 81 KiB |
BIN
website/img/skins/weapon_ak47_gs_ak47_abstract_light.png
Normal file
|
After Width: | Height: | Size: 83 KiB |
BIN
website/img/skins/weapon_ak47_gs_ak47_bloodsport_light.png
Normal file
|
After Width: | Height: | Size: 85 KiB |
BIN
website/img/skins/weapon_ak47_gs_ak47_empress_light.png
Normal file
|
After Width: | Height: | Size: 88 KiB |
BIN
website/img/skins/weapon_ak47_gs_ak47_gold_arabesque_light.png
Normal file
|
After Width: | Height: | Size: 83 KiB |
BIN
website/img/skins/weapon_ak47_gs_ak47_nibbler_light.png
Normal file
|
After Width: | Height: | Size: 87 KiB |
BIN
website/img/skins/weapon_ak47_gs_ak47_professional_light.png
Normal file
|
After Width: | Height: | Size: 74 KiB |
BIN
website/img/skins/weapon_ak47_gs_ak47_strone_light.png
Normal file
|
After Width: | Height: | Size: 80 KiB |
BIN
website/img/skins/weapon_ak47_gs_ak47_supercharged_light.png
Normal file
|
After Width: | Height: | Size: 84 KiB |
BIN
website/img/skins/weapon_ak47_gs_ak_colony01_red_light.png
Normal file
|
After Width: | Height: | Size: 74 KiB |
BIN
website/img/skins/weapon_ak47_hy_ak47lam_blue_light.png
Normal file
|
After Width: | Height: | Size: 79 KiB |
BIN
website/img/skins/weapon_ak47_hy_ak47lam_bw_light.png
Normal file
|
After Width: | Height: | Size: 80 KiB |
BIN
website/img/skins/weapon_ak47_hy_ak47lam_green_light.png
Normal file
|
After Width: | Height: | Size: 79 KiB |
BIN
website/img/skins/weapon_ak47_hy_ak47lam_light.png
Normal file
|
After Width: | Height: | Size: 78 KiB |
BIN
website/img/skins/weapon_ak47_hy_mesh_safetyorange_light.png
Normal file
|
After Width: | Height: | Size: 81 KiB |
BIN
website/img/skins/weapon_ak47_hy_veneto_purple_light.png
Normal file
|
After Width: | Height: | Size: 70 KiB |
BIN
website/img/skins/weapon_ak47_sp_mesh_tan_light.png
Normal file
|
After Width: | Height: | Size: 71 KiB |
BIN
website/img/skins/weapon_ak47_sp_spray_jungle_light.png
Normal file
|
After Width: | Height: | Size: 70 KiB |
BIN
website/img/skins/weapon_ak47_sp_zebracam_light.png
Normal file
|
After Width: | Height: | Size: 70 KiB |
BIN
website/img/skins/weapon_aug.png
Normal file
|
After Width: | Height: | Size: 16 KiB |
BIN
website/img/skins/weapon_aug_aa_fade_metallic_light.png
Normal file
|
After Width: | Height: | Size: 98 KiB |
BIN
website/img/skins/weapon_aug_am_aug_death_by_doggy_light.png
Normal file
|
After Width: | Height: | Size: 114 KiB |
BIN
website/img/skins/weapon_aug_am_aug_jumble_light.png
Normal file
|
After Width: | Height: | Size: 114 KiB |
BIN
website/img/skins/weapon_aug_am_bloom_blue_light.png
Normal file
|
After Width: | Height: | Size: 107 KiB |
BIN
website/img/skins/weapon_aug_am_circuitboard_orange_light.png
Normal file
|
After Width: | Height: | Size: 107 KiB |
BIN
website/img/skins/weapon_aug_am_intelligence_grey_light.png
Normal file
|
After Width: | Height: | Size: 105 KiB |
BIN
website/img/skins/weapon_aug_am_jade_light.png
Normal file
|
After Width: | Height: | Size: 102 KiB |
BIN
website/img/skins/weapon_aug_am_jorm_orange_light.png
Normal file
|
After Width: | Height: | Size: 112 KiB |
BIN
website/img/skins/weapon_aug_an_navy_bravo_light.png
Normal file
|
After Width: | Height: | Size: 97 KiB |
BIN
website/img/skins/weapon_aug_an_red_light.png
Normal file
|
After Width: | Height: | Size: 97 KiB |
BIN
website/img/skins/weapon_aug_cu_anime_aug_light.png
Normal file
|
After Width: | Height: | Size: 110 KiB |
BIN
website/img/skins/weapon_aug_cu_aug_chameleonaire_light.png
Normal file
|
After Width: | Height: | Size: 100 KiB |
BIN
website/img/skins/weapon_aug_cu_aug_momentum_light.png
Normal file
|
After Width: | Height: | Size: 106 KiB |
BIN
website/img/skins/weapon_aug_cu_aug_orange_triangle_light.png
Normal file
|
After Width: | Height: | Size: 103 KiB |
BIN
website/img/skins/weapon_aug_cu_aug_progressiv_light.png
Normal file
|
After Width: | Height: | Size: 95 KiB |
BIN
website/img/skins/weapon_aug_cu_aug_swallows_light.png
Normal file
|
After Width: | Height: | Size: 113 KiB |
BIN
website/img/skins/weapon_aug_cu_aug_whitefang_light.png
Normal file
|
After Width: | Height: | Size: 101 KiB |
BIN
website/img/skins/weapon_aug_gs_aug_aristocrat_light.png
Normal file
|
After Width: | Height: | Size: 110 KiB |
BIN
website/img/skins/weapon_aug_gs_aug_plague_light.png
Normal file
|
After Width: | Height: | Size: 109 KiB |
BIN
website/img/skins/weapon_aug_gs_aug_sand_storm_light.png
Normal file
|
After Width: | Height: | Size: 100 KiB |
BIN
website/img/skins/weapon_aug_gs_aug_stymphalian_birds_light.png
Normal file
|
After Width: | Height: | Size: 110 KiB |
BIN
website/img/skins/weapon_aug_gs_aug_syd_mead_light.png
Normal file
|
After Width: | Height: | Size: 105 KiB |
BIN
website/img/skins/weapon_aug_gs_aug_thunderstorm_light.png
Normal file
|
After Width: | Height: | Size: 107 KiB |
BIN
website/img/skins/weapon_aug_hy_aug_torn_orange_light.png
Normal file
|
After Width: | Height: | Size: 106 KiB |
BIN
website/img/skins/weapon_aug_hy_copperhead_light.png
Normal file
|
After Width: | Height: | Size: 108 KiB |
BIN
website/img/skins/weapon_aug_hy_dry_wood_light.png
Normal file
|
After Width: | Height: | Size: 107 KiB |
BIN
website/img/skins/weapon_aug_hy_dune_trap_light.png
Normal file
|
After Width: | Height: | Size: 114 KiB |
BIN
website/img/skins/weapon_aug_hy_feathers_aug_light.png
Normal file
|
After Width: | Height: | Size: 100 KiB |
BIN
website/img/skins/weapon_aug_hy_murano_blue_light.png
Normal file
|
After Width: | Height: | Size: 98 KiB |
BIN
website/img/skins/weapon_aug_hy_tiger_light.png
Normal file
|
After Width: | Height: | Size: 110 KiB |
BIN
website/img/skins/weapon_aug_so_pmc_light.png
Normal file
|
After Width: | Height: | Size: 100 KiB |
BIN
website/img/skins/weapon_aug_so_space_marine_light.png
Normal file
|
After Width: | Height: | Size: 103 KiB |
BIN
website/img/skins/weapon_aug_so_stormfront_light.png
Normal file
|
After Width: | Height: | Size: 104 KiB |
BIN
website/img/skins/weapon_aug_sp_labyrinth3_light.png
Normal file
|
After Width: | Height: | Size: 112 KiB |
BIN
website/img/skins/weapon_aug_sp_mesh_forest_fire_light.png
Normal file
|
After Width: | Height: | Size: 103 KiB |
BIN
website/img/skins/weapon_aug_sp_mesh_safetyblack_light.png
Normal file
|
After Width: | Height: | Size: 108 KiB |
BIN
website/img/skins/weapon_aug_sp_nukestripe_orange_aug_light.png
Normal file
|
After Width: | Height: | Size: 106 KiB |
BIN
website/img/skins/weapon_awp.png
Normal file
|
After Width: | Height: | Size: 16 KiB |
BIN
website/img/skins/weapon_awp_aa_awp_fade_light.png
Normal file
|
After Width: | Height: | Size: 65 KiB |
BIN
website/img/skins/weapon_awp_am_awp_glory_light.png
Normal file
|
After Width: | Height: | Size: 65 KiB |
BIN
website/img/skins/weapon_awp_am_awp_pawpaw_light.png
Normal file
|
After Width: | Height: | Size: 73 KiB |
BIN
website/img/skins/weapon_awp_am_crumple_bravo_light.png
Normal file
|
After Width: | Height: | Size: 61 KiB |
BIN
website/img/skins/weapon_awp_am_lightning_awp_light.png
Normal file
|
After Width: | Height: | Size: 63 KiB |
BIN
website/img/skins/weapon_awp_am_tigers_blue_light.png
Normal file
|
After Width: | Height: | Size: 71 KiB |