mirror of
https://github.com/Nereziel/cs2-WeaponPaints.git
synced 2026-02-18 10:43:22 +00:00
Compare commits
40 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
29a6041d7a | ||
|
|
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 |
16
.github/workflows/build.yml
vendored
16
.github/workflows/build.yml
vendored
@@ -28,6 +28,22 @@ 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 \
|
||||||
|
|||||||
121
Config.cs
121
Config.cs
@@ -3,54 +3,95 @@ using System.Text.Json.Serialization;
|
|||||||
|
|
||||||
namespace WeaponPaints
|
namespace WeaponPaints
|
||||||
{
|
{
|
||||||
public class Messages
|
public class Messages
|
||||||
{
|
{
|
||||||
[JsonPropertyName("WebsiteMessageCommand")]
|
[JsonPropertyName("WebsiteMessageCommand")]
|
||||||
public string WebsiteMessageCommand { get; set; } = "Visit {WEBSITE} where you can change skins.";
|
public string WebsiteMessageCommand { get; set; } = "Visit {WEBSITE} where you can change skins.";
|
||||||
[JsonPropertyName("SynchronizeMessageCommand")]
|
[JsonPropertyName("SynchronizeMessageCommand")]
|
||||||
public string SynchronizeMessageCommand { get; set; } = "Type !wp to synchronize chosen skins.";
|
public string SynchronizeMessageCommand { get; set; } = "Type !wp to synchronize chosen skins.";
|
||||||
[JsonPropertyName("KnifeMessageCommand")]
|
[JsonPropertyName("KnifeMessageCommand")]
|
||||||
public string KnifeMessageCommand { get; set; } = "Type !knife to open knife menu.";
|
public string KnifeMessageCommand { get; set; } = "Type !knife to open knife menu.";
|
||||||
[JsonPropertyName("CooldownRefreshCommand")]
|
[JsonPropertyName("CooldownRefreshCommand")]
|
||||||
public string CooldownRefreshCommand { get; set; } = "You can't refresh weapon paints right now.";
|
public string CooldownRefreshCommand { get; set; } = "You can't refresh weapon paints right now.";
|
||||||
[JsonPropertyName("SuccessRefreshCommand")]
|
[JsonPropertyName("SuccessRefreshCommand")]
|
||||||
public string SuccessRefreshCommand { get; set; } = "Refreshing weapon paints.";
|
public string SuccessRefreshCommand { get; set; } = "Refreshing weapon paints.";
|
||||||
[JsonPropertyName("ChosenKnifeMenu")]
|
[JsonPropertyName("ChosenKnifeMenu")]
|
||||||
public string ChosenKnifeMenu { get; set; } = "You have chosen {KNIFE} as your knife.";
|
public string ChosenKnifeMenu { get; set; } = "You have chosen {KNIFE} as your knife.";
|
||||||
[JsonPropertyName("KnifeMenuTitle")]
|
[JsonPropertyName("ChosenKnifeMenuKill")]
|
||||||
public string KnifeMenuTitle { get; set; } = "Knife Menu.";
|
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.";
|
||||||
|
}
|
||||||
|
|
||||||
public class WeaponPaintsConfig : BasePluginConfig
|
public class Additional
|
||||||
{
|
{
|
||||||
public override int Version { get; set; } = 2;
|
[JsonPropertyName("SkinVisibilityFix")]
|
||||||
|
public bool SkinVisibilityFix { get; set; } = true;
|
||||||
|
|
||||||
[JsonPropertyName("DatabaseHost")]
|
[JsonPropertyName("KnifeEnabled")]
|
||||||
public string DatabaseHost { get; set; } = "";
|
public bool KnifeEnabled { get; set; } = true;
|
||||||
|
|
||||||
[JsonPropertyName("DatabasePort")]
|
[JsonPropertyName("SkinEnabled")]
|
||||||
public int DatabasePort { get; set; } = 3306;
|
public bool SkinEnabled { get; set; } = true;
|
||||||
|
|
||||||
[JsonPropertyName("DatabaseUser")]
|
[JsonPropertyName("CommandWpEnabled")]
|
||||||
public string DatabaseUser { get; set; } = "";
|
public bool CommandWpEnabled { get; set; } = true;
|
||||||
|
|
||||||
[JsonPropertyName("DatabasePassword")]
|
[JsonPropertyName("CommandKillEnabled")]
|
||||||
public string DatabasePassword { get; set; } = "";
|
public bool CommandKillEnabled { get; set; } = true;
|
||||||
|
|
||||||
[JsonPropertyName("DatabaseName")]
|
[JsonPropertyName("CommandKnife")]
|
||||||
public string DatabaseName { get; set; } = "";
|
public string CommandKnife { get; set; } = "knife";
|
||||||
|
|
||||||
[JsonPropertyName("CmdRefreshCooldownSeconds")]
|
[JsonPropertyName("CommandSkin")]
|
||||||
public int CmdRefreshCooldownSeconds { get; set; } = 60;
|
public string CommandSkin { get; set; } = "ws";
|
||||||
|
|
||||||
[JsonPropertyName("Prefix")]
|
[JsonPropertyName("CommandRefresh")]
|
||||||
public string Prefix { get; set; } = "[WeaponPaints]";
|
public string CommandRefresh { get; set; } = "wp";
|
||||||
|
|
||||||
[JsonPropertyName("Website")]
|
[JsonPropertyName("CommandKill")]
|
||||||
public string Website { get; set; } = "example.com/skins";
|
public string CommandKill { get; set; } = "kill";
|
||||||
|
|
||||||
|
[JsonPropertyName("GiveRandomKnife")]
|
||||||
|
public bool GiveRandomKnife { 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("Messages")]
|
|
||||||
public Messages Messages { get; set; } = new Messages();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
52
README.md
52
README.md
@@ -4,14 +4,14 @@
|
|||||||
Unfinished, unoptimized and not fully functional ugly demo weapon paints plugin for [CSSharp](https://docs.cssharp.dev/).
|
Unfinished, unoptimized and not fully functional ugly demo weapon paints plugin for [CSSharp](https://docs.cssharp.dev/).
|
||||||
There will be a lot of frequent changes which may break functionality or compatibility. You have been warned!
|
There will be a lot of frequent changes which may break functionality or compatibility. You have been warned!
|
||||||
|
|
||||||
## Created [Discord server](https://discord.gg/mwEQppJ5AT) where you can discus about plugin.
|
## Created [Discord server](https://discord.gg/EEg6qtNScq) where you can discus about plugin.
|
||||||
|
|
||||||
### Consider to donate instead of buying from unknown sources.
|
### Consider to donate instead of buying from unknown sources.
|
||||||
[](https://ko-fi.com/E1E2G0P2O) or [Donate on Steam](https://steamcommunity.com/tradeoffer/new/?partner=41515647&token=gW2W-nXE)
|
[](https://ko-fi.com/E1E2G0P2O) or [Donate on Steam](https://steamcommunity.com/tradeoffer/new/?partner=41515647&token=gW2W-nXE)
|
||||||
|
|
||||||
### Features
|
### Features
|
||||||
- changes only paint, seed and wear on weapons and knives
|
- changes only paint, seed and wear on weapons and knives
|
||||||
- mysql based
|
- mysql based or global website at [weaponpaints.fun](https://weaponpaints.fun/), so you dont need mysql/website
|
||||||
- data sync on player connect
|
- data sync on player connect
|
||||||
- Added command `!wp` to refresh skins (with cooldown in second can be configured)
|
- Added command `!wp` to refresh skins (with cooldown in second can be configured)
|
||||||
- Added command `!ws` to show website
|
- Added command `!ws` to show website
|
||||||
@@ -20,10 +20,53 @@ There will be a lot of frequent changes which may break functionality or compati
|
|||||||
|
|
||||||
### CS2 server:
|
### 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/)
|
- 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
|
- 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**
|
- 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:
|
### Web install:
|
||||||
|
- not needed if config `GlobalShare = true`
|
||||||
- requires PHP min v7.3 (tested on php ver `8.2.3` and nginx webserver)
|
- requires PHP min v7.3 (tested on php ver `8.2.3` and nginx webserver)
|
||||||
- copy website to web server (img folder not needed)
|
- copy website to web server (img folder not needed)
|
||||||
- import `database.sql` to mysql
|
- import `database.sql` to mysql
|
||||||
@@ -31,6 +74,9 @@ There will be a lot of frequent changes which may break functionality or compati
|
|||||||
- fill in database credentials and api key in `class/config.php`
|
- fill in database credentials and api key in `class/config.php`
|
||||||
- visit website and login via steam
|
- 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/)
|
||||||
|
|
||||||
### Preview
|
### Preview
|
||||||
|
|||||||
1143
WeaponPaints.cs
1143
WeaponPaints.cs
File diff suppressed because it is too large
Load Diff
@@ -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>
|
||||||
|
|||||||
@@ -7,7 +7,8 @@ class UtilsClass
|
|||||||
$json = json_decode(file_get_contents(__DIR__ . "/../data/skins.json"), true);
|
$json = json_decode(file_get_contents(__DIR__ . "/../data/skins.json"), true);
|
||||||
|
|
||||||
foreach ($json as $skin) {
|
foreach ($json as $skin) {
|
||||||
$skins[(int)$skin['weapon_defindex']][(int)$skin['paint']] = [
|
$skins[(int) $skin['weapon_defindex']][(int) $skin['paint']] = [
|
||||||
|
'weapon_name' => $skin['weapon_name'],
|
||||||
'paint_name' => $skin['paint_name'],
|
'paint_name' => $skin['paint_name'],
|
||||||
'image_url' => $skin['image'],
|
'image_url' => $skin['image'],
|
||||||
];
|
];
|
||||||
@@ -21,11 +22,12 @@ class UtilsClass
|
|||||||
$weapons = [];
|
$weapons = [];
|
||||||
$temp = self::skinsFromJson();
|
$temp = self::skinsFromJson();
|
||||||
|
|
||||||
foreach ($temp as $key => $value)
|
foreach ($temp as $key => $value) {
|
||||||
{
|
if (key_exists($key, $weapons))
|
||||||
if (key_exists($key, $weapons)) continue;
|
continue;
|
||||||
|
|
||||||
$weapons[$key] = [
|
$weapons[$key] = [
|
||||||
|
'weapon_name' => $value[0]['weapon_name'],
|
||||||
'paint_name' => $value[0]['paint_name'],
|
'paint_name' => $value[0]['paint_name'],
|
||||||
'image_url' => $value[0]['image_url'],
|
'image_url' => $value[0]['image_url'],
|
||||||
];
|
];
|
||||||
@@ -34,15 +36,61 @@ class UtilsClass
|
|||||||
return $weapons;
|
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)
|
public static function getSelectedSkins(array $temp)
|
||||||
{
|
{
|
||||||
$selected = [];
|
$selected = [];
|
||||||
|
|
||||||
foreach ($temp as $weapon)
|
foreach ($temp as $weapon) {
|
||||||
{
|
|
||||||
$selected[$weapon['weapon_defindex']] = $weapon['weapon_paint_id'];
|
$selected[$weapon['weapon_defindex']] = $weapon['weapon_paint_id'];
|
||||||
}
|
}
|
||||||
|
|
||||||
return $selected;
|
return $selected;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,46 +0,0 @@
|
|||||||
-- phpMyAdmin SQL Dump
|
|
||||||
-- version 5.2.1
|
|
||||||
-- https://www.phpmyadmin.net/
|
|
||||||
--
|
|
||||||
-- Host: localhost
|
|
||||||
-- Generation Time: Nov 02, 2023 at 11:12 AM
|
|
||||||
-- Server version: 10.11.2-MariaDB
|
|
||||||
-- PHP Version: 8.2.3
|
|
||||||
|
|
||||||
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
|
|
||||||
START TRANSACTION;
|
|
||||||
SET time_zone = "+00:00";
|
|
||||||
|
|
||||||
|
|
||||||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
|
||||||
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
|
||||||
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
|
||||||
/*!40101 SET NAMES utf8mb4 */;
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Database: `cs2server`
|
|
||||||
--
|
|
||||||
|
|
||||||
-- --------------------------------------------------------
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Table structure for table `wp_player_skins`
|
|
||||||
--
|
|
||||||
|
|
||||||
CREATE TABLE `wp_player_skins` (
|
|
||||||
`steamid` varchar(64) NOT NULL,
|
|
||||||
`weapon_defindex` int(6) NOT NULL,
|
|
||||||
`weapon_paint_id` int(6) NOT NULL,
|
|
||||||
`weapon_wear` float NOT NULL DEFAULT 0.0001,
|
|
||||||
`weapon_seed` int(16) NOT NULL DEFAULT 0
|
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Table structure for table `wp_player_knife`
|
|
||||||
--
|
|
||||||
|
|
||||||
CREATE TABLE `wp_player_knife` (
|
|
||||||
`steamid` varchar(64) NOT NULL,
|
|
||||||
`knife` varchar(64) NOT NULL,
|
|
||||||
UNIQUE (`steamid`)
|
|
||||||
) ENGINE = InnoDB;
|
|
||||||
BIN
website/img/skins/weapon_knife.png
Normal file
BIN
website/img/skins/weapon_knife.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 19 KiB |
@@ -7,26 +7,32 @@ require_once 'class/utils.php';
|
|||||||
|
|
||||||
$db = new DataBase();
|
$db = new DataBase();
|
||||||
if (isset($_SESSION['steamid'])) {
|
if (isset($_SESSION['steamid'])) {
|
||||||
|
$steamid = $_SESSION['steamid'];
|
||||||
include('steamauth/userInfo.php');
|
|
||||||
$steamid = $steamprofile['steamid'];
|
|
||||||
|
|
||||||
$weapons = UtilsClass::getWeaponsFromArray();
|
$weapons = UtilsClass::getWeaponsFromArray();
|
||||||
$skins = UtilsClass::skinsFromJson();
|
$skins = UtilsClass::skinsFromJson();
|
||||||
$querySelected = $query3 = $db->select("SELECT `weapon_defindex`, `weapon_paint_id` FROM `wp_player_skins` WHERE `wp_player_skins`.`steamid` = :steamid", ["steamid" => $steamid]);
|
$querySelected = $query3 = $db->select("SELECT `weapon_defindex`, `weapon_paint_id` FROM `wp_player_skins` WHERE `wp_player_skins`.`steamid` = :steamid", ["steamid" => $steamid]);
|
||||||
$selectedSkins = UtilsClass::getSelectedSkins($querySelected);
|
$selectedSkins = UtilsClass::getSelectedSkins($querySelected);
|
||||||
|
$selectedKnife = $db->select("SELECT * FROM `wp_player_knife` WHERE `wp_player_knife`.`steamid` = :steamid", ["steamid" => $steamid])[0];
|
||||||
|
$knifes = UtilsClass::getKnifeTypes();
|
||||||
|
|
||||||
if (isset($_POST['forma'])) {
|
if (isset($_POST['forma'])) {
|
||||||
$ex = explode("-", $_POST['forma']);
|
$ex = explode("-", $_POST['forma']);
|
||||||
|
|
||||||
if (array_key_exists($ex[1], $skins[$ex[0]])) {
|
if ($ex[0] == "knife") {
|
||||||
if (array_key_exists($ex[0], $selectedSkins)) {
|
$db->query("INSERT INTO `wp_player_knife` (`steamid`, `knife`) VALUES(:steamid, :knife) ON DUPLICATE KEY UPDATE `knife` = :knife", ["steamid" => $steamid, "knife" => $knifes[$ex[1]]['weapon_name']]);
|
||||||
$db->query("UPDATE wp_player_skins SET weapon_paint_id = :weapon_paint_id WHERE steamid = :steamid AND weapon_defindex = :weapon_defindex", ["steamid" => $steamid, "weapon_defindex" => $ex[0], "weapon_paint_id" => $ex[1]]);
|
} else {
|
||||||
} else {
|
if (!is_int($ex[1]))
|
||||||
$db->query("INSERT INTO wp_player_skins (`steamid`, `weapon_defindex`, `weapon_paint_id`) VALUES (:steamid, :weapon_defindex, :weapon_paint_id)", ["steamid" => $steamid, "weapon_defindex" => $ex[0], "weapon_paint_id" => $ex[1]]);
|
header("Location: index.php");
|
||||||
|
if (array_key_exists($ex[1], $skins[$ex[0]])) {
|
||||||
|
if (array_key_exists($ex[0], $selectedSkins)) {
|
||||||
|
$db->query("UPDATE wp_player_skins SET weapon_paint_id = :weapon_paint_id WHERE steamid = :steamid AND weapon_defindex = :weapon_defindex", ["steamid" => $steamid, "weapon_defindex" => $ex[0], "weapon_paint_id" => $ex[1]]);
|
||||||
|
} else {
|
||||||
|
$db->query("INSERT INTO wp_player_skins (`steamid`, `weapon_defindex`, `weapon_paint_id`) VALUES (:steamid, :weapon_defindex, :weapon_paint_id)", ["steamid" => $steamid, "weapon_defindex" => $ex[0], "weapon_paint_id" => $ex[1]]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
header("Location: index.php");
|
|
||||||
}
|
}
|
||||||
|
header("Location: index.php");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
@@ -54,7 +60,47 @@ if (isset($_SESSION['steamid'])) {
|
|||||||
echo "</h2></div>";
|
echo "</h2></div>";
|
||||||
} else {
|
} else {
|
||||||
echo "<div class='bg-primary'>Your current weapon skin loadout<form action='' method='get'><button class='btn btn-secondary' name='logout' type='submit'>Logout</button></form></div>";
|
echo "<div class='bg-primary'>Your current weapon skin loadout<form action='' method='get'><button class='btn btn-secondary' name='logout' type='submit'>Logout</button></form></div>";
|
||||||
echo "<div class='card-group'>";
|
echo "<div class='card-group mt-2'>";
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="col-sm-2">
|
||||||
|
<div class="card text-center mb-3 border border-primary">
|
||||||
|
<div class="card-body">
|
||||||
|
<?php
|
||||||
|
$actualKnife = $knifes[0];
|
||||||
|
foreach ($knifes as $knife) {
|
||||||
|
if ($selectedKnife['knife'] == $knife['weapon_name']) {
|
||||||
|
$actualKnife = $knife;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "<div class='card-header'>";
|
||||||
|
echo "<h6 class='card-title item-name'>Knife type</h6>";
|
||||||
|
echo "<h5 class='card-title item-name'>{$actualKnife["paint_name"]}</h5>";
|
||||||
|
echo "</div>";
|
||||||
|
echo "<img src='{$actualKnife["image_url"]}' class='skin-image'>";
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
<div class="card-footer">
|
||||||
|
<form action="" method="POST">
|
||||||
|
<select name="forma" class="form-control select" onchange="this.form.submit()" class="SelectWeapon">
|
||||||
|
<option disabled>Select knife</option>
|
||||||
|
<?php
|
||||||
|
foreach ($knifes as $knifeKey => $knife) {
|
||||||
|
if ($selectedKnife['knife'] == $knife['weapon_name'])
|
||||||
|
echo "<option selected value=\"knife-{$knifeKey}\">{$knife['paint_name']}</option>";
|
||||||
|
else
|
||||||
|
echo "<option value=\"knife-{$knifeKey}\">{$knife['paint_name']}</option>";
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php
|
||||||
foreach ($weapons as $defindex => $default) { ?>
|
foreach ($weapons as $defindex => $default) { ?>
|
||||||
<div class="col-sm-2">
|
<div class="col-sm-2">
|
||||||
<div class="card text-center mb-3">
|
<div class="card text-center mb-3">
|
||||||
@@ -64,7 +110,7 @@ if (isset($_SESSION['steamid'])) {
|
|||||||
echo "<div class='card-header'>";
|
echo "<div class='card-header'>";
|
||||||
echo "<h5 class='card-title item-name'>{$skins[$defindex][$selectedSkins[$defindex]]["paint_name"]}</h5>";
|
echo "<h5 class='card-title item-name'>{$skins[$defindex][$selectedSkins[$defindex]]["paint_name"]}</h5>";
|
||||||
echo "</div>";
|
echo "</div>";
|
||||||
echo "<img src='{$skins[$defindex][$selectedSkins[$defindex]]['image_url']}' class='skin-image' >";
|
echo "<img src='{$skins[$defindex][$selectedSkins[$defindex]]['image_url']}' class='skin-image'>";
|
||||||
} else {
|
} else {
|
||||||
echo "<div class='card-header'>";
|
echo "<div class='card-header'>";
|
||||||
echo "<h5 class='card-title item-name'>{$default["paint_name"]}</h5>";
|
echo "<h5 class='card-title item-name'>{$default["paint_name"]}</h5>";
|
||||||
@@ -76,7 +122,7 @@ if (isset($_SESSION['steamid'])) {
|
|||||||
<div class="card-footer">
|
<div class="card-footer">
|
||||||
<form action="" method="POST">
|
<form action="" method="POST">
|
||||||
<select name="forma" class="form-control select" onchange="this.form.submit()" class="SelectWeapon">
|
<select name="forma" class="form-control select" onchange="this.form.submit()" class="SelectWeapon">
|
||||||
<option>Select skin</option>
|
<option disabled>Select skin</option>
|
||||||
<?php
|
<?php
|
||||||
foreach ($skins[$defindex] as $paintKey => $paint) {
|
foreach ($skins[$defindex] as $paintKey => $paint) {
|
||||||
if (array_key_exists($defindex, $selectedSkins) && $selectedSkins[$defindex] == $paintKey)
|
if (array_key_exists($defindex, $selectedSkins) && $selectedSkins[$defindex] == $paintKey)
|
||||||
|
|||||||
Reference in New Issue
Block a user