diff --git a/.gitignore b/.gitignore
index 5aa7933..2e48831 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,6 @@
.vs/
**/obj
-**/bin
\ No newline at end of file
+**/bin
+
+# Ignore everything in BuildOutput directory
+BuildOutput/
\ No newline at end of file
diff --git a/Dapper.dll b/Dapper.dll
new file mode 100644
index 0000000..c8a0de4
Binary files /dev/null and b/Dapper.dll differ
diff --git a/MySqlConnector.dll b/MySqlConnector.dll
new file mode 100644
index 0000000..ea3237d
Binary files /dev/null and b/MySqlConnector.dll differ
diff --git a/Store/cs2-store.csproj b/Store/cs2-store.csproj
index e0c8a02..855763e 100644
--- a/Store/cs2-store.csproj
+++ b/Store/cs2-store.csproj
@@ -1,26 +1,46 @@
-
- net8.0
- enable
- enable
- false
- true
- true
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+ net8.0
+ enable
+ enable
+ true
+ $(ProjectDir)..\BuildOutput\plugins\cs2-store\
+ false
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Store/lang/ch.json b/Store/lang/ch.json
index 818d9b6..b8366a6 100644
--- a/Store/lang/ch.json
+++ b/Store/lang/ch.json
@@ -58,6 +58,7 @@
"menu_store": "T阵营模型",
"menu_store": "CT阵营模型",
"menu_store": "{0} - [{1}]",
+ "menu_store": "{0}",
"menu_store": "装备",
"menu_store": "脱下",
"menu_store": "出售 [{0}]",
diff --git a/Store/lang/en.json b/Store/lang/en.json
index 87364a2..8ea26e4 100644
--- a/Store/lang/en.json
+++ b/Store/lang/en.json
@@ -58,6 +58,7 @@
"menu_store": "T Models",
"menu_store": "CT Models",
"menu_store": "{0} - [{1}]",
+ "menu_store": "{0}",
"menu_store": "EQUIP",
"menu_store": "UNEQUIP",
"menu_store": "SELL [{0}]",
diff --git a/Store/lang/pt-BR.json b/Store/lang/pt-BR.json
index e07c02f..bdeea49 100644
--- a/Store/lang/pt-BR.json
+++ b/Store/lang/pt-BR.json
@@ -58,6 +58,7 @@
"menu_store": "Modelos T",
"menu_store": "Modelos CT",
"menu_store": "{0} - [{1}]",
+ "menu_store": "{0}",
"menu_store": "EQUIPAR",
"menu_store": "DESEQUIPAR",
"menu_store": "VENDER [{0}]",
diff --git a/Store/lang/ro.json b/Store/lang/ro.json
index a2e8a81..77ee3d1 100644
--- a/Store/lang/ro.json
+++ b/Store/lang/ro.json
@@ -58,6 +58,7 @@
"menu_store": "Modele T",
"menu_store": "Modele CT",
"menu_store": "{0} - [{1}]",
+ "menu_store": "{0}",
"menu_store": "ECHIPEAZĂ",
"menu_store": "DEZ-ECHIPEAZĂ",
"menu_store": "VINDE [{0}]",
diff --git a/Store/lang/ru.json b/Store/lang/ru.json
index 8a0f194..c05e4dc 100644
--- a/Store/lang/ru.json
+++ b/Store/lang/ru.json
@@ -58,6 +58,7 @@
"menu_store": "Модели t",
"menu_store": "Модели ct",
"menu_store": "{0} - [{1}]",
+ "menu_store": "{0}",
"menu_store": "ЭКИПИРОВАТЬ",
"menu_store": "СНЯТЬ",
"menu_store": "ПРОДАТЬ [{0}]",
diff --git a/Store/lang/sl.json b/Store/lang/sl.json
index c70ac57..dbd4e61 100644
--- a/Store/lang/sl.json
+++ b/Store/lang/sl.json
@@ -58,6 +58,7 @@
"menu_store": "T Modeli",
"menu_store": "CT Modeli",
"menu_store": "{0} - [{1}]",
+ "menu_store": "{0}",
"menu_store": "AKTIVIRAJ",
"menu_store": "DEAKTIVIRAJ",
"menu_store": "PRODAJ [{0}]",
diff --git a/Store/lang/tr.json b/Store/lang/tr.json
index 2ea47fe..98ff361 100644
--- a/Store/lang/tr.json
+++ b/Store/lang/tr.json
@@ -58,6 +58,7 @@
"menu_store": "T Modelleri",
"menu_store": "CT Modelleri",
"menu_store": "{0} - [{1}]",
+ "menu_store": "{0}",
"menu_store": "KUŞAN",
"menu_store": "BIRAK",
"menu_store": "SAT [{0}]",
diff --git a/Store/lang/ua.json b/Store/lang/ua.json
index 9216a46..65029c7 100644
--- a/Store/lang/ua.json
+++ b/Store/lang/ua.json
@@ -58,6 +58,7 @@
"menu_store": "Моделі t",
"menu_store": "Моделі ct",
"menu_store": "{0} - [{1}]",
+ "menu_store": "{0}",
"menu_store": "ЕКІПІРОВАТИ",
"menu_store": "ЗНЯТИ",
"menu_store": "ПРОДАТИ [{0}]",
diff --git a/Store/src/cs2-store.cs b/Store/src/cs2-store.cs
index ab22e98..e05f02c 100644
--- a/Store/src/cs2-store.cs
+++ b/Store/src/cs2-store.cs
@@ -9,7 +9,7 @@ namespace Store;
public class Store : BasePlugin, IPluginConfig
{
public override string ModuleName => "Store";
- public override string ModuleVersion => "1.5";
+ public override string ModuleVersion => "1.6";
public override string ModuleAuthor => "schwarper";
public Item_Config Config { get; set; } = new Item_Config();
@@ -41,6 +41,7 @@ public override void Load(bool hotReload)
Item_Gravity.OnPluginStart();
Item_GrenadeTrail.OnPluginStart();
Item_Health.OnPluginStart();
+ Item_Link.OnPluginStart();
Item_Open.OnPluginStart();
Item_PlayerSkin.OnPluginStart();
Item_Respawn.OnPluginStart();
diff --git a/Store/src/item/item.cs b/Store/src/item/item.cs
index bf4d12f..5e09e32 100644
--- a/Store/src/item/item.cs
+++ b/Store/src/item/item.cs
@@ -87,9 +87,14 @@ public static bool Purchase(CCSPlayerController player, Dictionary 0)
+ {
+ Credits.Give(player, -int.Parse(item["price"]));
+
+ player.PrintToChatMessage("Purchase Succeeded", item["name"]);
+ }
if (type.Equipable)
{
diff --git a/Store/src/item/items/link.cs b/Store/src/item/items/link.cs
index db1e5a1..46ba517 100644
--- a/Store/src/item/items/link.cs
+++ b/Store/src/item/items/link.cs
@@ -1,4 +1,3 @@
-using CounterStrikeSharp.API;
using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Modules.Utils;
diff --git a/Store/src/menu/menu.cs b/Store/src/menu/menu.cs
index 8aa6325..0f2a183 100644
--- a/Store/src/menu/menu.cs
+++ b/Store/src/menu/menu.cs
@@ -178,34 +178,42 @@ public static void DisplayItem(CCSPlayerController player, bool inventory, strin
}
else if (!inventory && !isHidden)
{
- AddMenuOption(player, menu, (player, option) =>
+ if (int.Parse(item["price"]) <= 0)
{
- if (Config.Menu.EnableConfirmMenu)
- {
- player.ExecuteClientCommand($"play {Config.Menu.MenuPressSoundYes}");
- DisplayConfirmationMenu(player, item, option);
- }
- else
- {
- if (Item.Purchase(player, item))
- {
- player.ExecuteClientCommand($"play {Config.Menu.MenuPressSoundYes}");
- DisplayItemOption(player, item, option);
- }
- else
- {
- player.ExecuteClientCommand($"play {Config.Menu.MenuPressSoundNo}");
- WasdManager.CloseMenu(player);
- }
- }
-
- }, "menu_store", item["name"], item["price"]);
+ AddMenuOption(player, menu, (player, option) => SelectPurchase(player, item, option, false), "menu_store", item["name"]);
+ }
+ else
+ {
+ AddMenuOption(player, menu, (player, option) => SelectPurchase(player, item, option, true), "menu_store", item["name"], item["price"]);
+ }
}
}
WasdManager.OpenSubMenu(player, menu);
}
+ private static void SelectPurchase(CCSPlayerController player, Dictionary item, IWasdMenuOption option, bool confirm)
+ {
+ if (confirm && Config.Menu.EnableConfirmMenu)
+ {
+ player.ExecuteClientCommand($"play {Config.Menu.MenuPressSoundYes}");
+ DisplayConfirmationMenu(player, item, option);
+ }
+ else
+ {
+ if (Item.Purchase(player, item))
+ {
+ player.ExecuteClientCommand($"play {Config.Menu.MenuPressSoundYes}");
+ DisplayItemOption(player, item, option);
+ }
+ else
+ {
+ player.ExecuteClientCommand($"play {Config.Menu.MenuPressSoundNo}");
+ WasdManager.CloseMenu(player);
+ }
+ }
+ }
+
public static void DisplayItemOption(CCSPlayerController player, Dictionary item, IWasdMenuOption? prev = null)
{
IWasdMenu menu = WasdManager.CreateMenu(item["name"]);
diff --git a/Store/src/menu/oldmenu.cs b/Store/src/menu/oldmenu.cs
index 911a403..a3b00b4 100644
--- a/Store/src/menu/oldmenu.cs
+++ b/Store/src/menu/oldmenu.cs
@@ -107,6 +107,7 @@ public static void DisplayItem(CCSPlayerController player, bool inventory, strin
}
bool isHidden = item.ContainsKey("hide") && item["hide"] == "true";
+
if (Item.PlayerHas(player, item["type"], item["uniqueid"], false))
{
AddMenuOption(player, menu, (player, option) =>
@@ -117,34 +118,42 @@ public static void DisplayItem(CCSPlayerController player, bool inventory, strin
}
else if (!inventory && !isHidden)
{
- AddMenuOption(player, menu, (player, option) =>
+ if (int.Parse(item["price"]) <= 0)
{
- if (Config.Menu.EnableConfirmMenu)
- {
- player.ExecuteClientCommand($"play {Config.Menu.MenuPressSoundYes}");
- DisplayConfirmationMenu(player, item);
- }
- else
- {
- if (Item.Purchase(player, item))
- {
- player.ExecuteClientCommand($"play {Config.Menu.MenuPressSoundYes}");
- DisplayItemOption(player, item);
- }
- else
- {
- player.ExecuteClientCommand($"play {Config.Menu.MenuPressSoundNo}");
- WasdManager.CloseMenu(player);
- }
- }
-
- }, false, "menu_store", item["name"], item["price"]);
+ AddMenuOption(player, menu, (player, option) => SelectPurchase(player, item, false), false, "menu_store", item["name"]);
+ }
+ else
+ {
+ AddMenuOption(player, menu, (player, option) => SelectPurchase(player, item, true), true, "menu_store", item["name"], item["price"]);
+ }
}
}
MenuManager.OpenCenterHtmlMenu(Instance, player, menu);
}
+ private static void SelectPurchase(CCSPlayerController player, Dictionary item, bool confirm)
+ {
+ if (confirm && Config.Menu.EnableConfirmMenu)
+ {
+ player.ExecuteClientCommand($"play {Config.Menu.MenuPressSoundYes}");
+ DisplayConfirmationMenu(player, item);
+ }
+ else
+ {
+ if (Item.Purchase(player, item))
+ {
+ player.ExecuteClientCommand($"play {Config.Menu.MenuPressSoundYes}");
+ DisplayItemOption(player, item);
+ }
+ else
+ {
+ player.ExecuteClientCommand($"play {Config.Menu.MenuPressSoundNo}");
+ WasdManager.CloseMenu(player);
+ }
+ }
+ }
+
public static void DisplayItemOption(CCSPlayerController player, Dictionary item)
{
CenterHtmlMenu menu = new(item["name"], Instance);
diff --git a/StoreApi/StoreApi.csproj b/StoreApi/StoreApi.csproj
index 2f68129..c3711d3 100644
--- a/StoreApi/StoreApi.csproj
+++ b/StoreApi/StoreApi.csproj
@@ -4,6 +4,8 @@
net8.0
enable
enable
+ $(ProjectDir)..\BuildOutput\shared\StoreApi\
+ false
diff --git a/Tomlyn.dll b/Tomlyn.dll
new file mode 100644
index 0000000..88d9d2a
Binary files /dev/null and b/Tomlyn.dll differ
diff --git a/config.toml b/config.toml
new file mode 100644
index 0000000..aaa35f8
--- /dev/null
+++ b/config.toml
@@ -0,0 +1,49 @@
+[Tag]
+Tag = "{red}[Store] "
+
+[DatabaseConnection]
+Host = ""
+Port = 3306
+User = ""
+Password = ""
+Name = ""
+DatabaseEquipTableName = "store_equipments"
+
+[Commands]
+Credits = [ "credits", "tl" ]
+Store = [ "store", "shop", "market" ]
+Inventory = [ "inv", "inventory" ]
+GiveCredits = [ "givecredits" ]
+Gift = [ "gift" ]
+ResetPlayer = [ "resetplayer" ]
+ResetDatabase = [ "resetdatabase" ]
+
+# Should you not wish to utilise the default model, you are free to leave the list blank.
+[DefaultModels]
+Terrorist = [ "characters/models/ctm_fbi/ctm_fbi_variantb.vmdl" ]
+CounterTerrorist = [ "characters/models/tm_leet/tm_leet_variantj.vmdl" ]
+
+[Credits]
+Start = 0
+IntervalActiveInActive = 60
+AmountActive = 10
+AmountInActive = 1
+AmountKill = 1
+IgnoreWarmup = true
+
+[Menu]
+EnableSelling = true
+EnableConfirmMenu = true
+UseWASDMenu = true # If you mark it as false, it will be used as CentreHtmlMenu.
+VipFlag = "@css/root" # Individuals in possession of the requisite authorisation shall be entitled to utilise equipable items free of charge. Making this field empty will result in the cancellation of Vip.
+MenuPressSoundYes = ""
+MenuPressSoundNo = ""
+
+[Settings]
+MaxHealth = 0
+MaxArmor = 0
+SellRatio = 0.6 # This setting determines the ratio of money you will receive when you sell the item.
+ApplyPlayerskinDelay = 0.6
+SellUsePurchaseCredit = false # If true, the selling ratio is calculated based on the price at which you bought the item. If false, it is calculated based on the current store price.
+DefaultModelDisableLeg = false
+Model0Model1Flag = "@css/root"
\ No newline at end of file
diff --git a/cs2-store.json b/cs2-store.json
new file mode 100644
index 0000000..ccdf4e7
--- /dev/null
+++ b/cs2-store.json
@@ -0,0 +1,259 @@
+{
+ "Items": {
+ "playerskins": {
+ "1": {
+ "name": "Fernandez Frogman",
+ "uniqueid": "characters/models/ctm_diver/ctm_diver_variantb.vmdl",
+ "armModel": "",
+ "type": "playerskin",
+ "price": "0",
+ "slot": "1",
+ "disable_leg": "false",
+ "expiration": "0",
+ "hide": "false",
+ "enable": "true"
+ },
+ "2": {
+ "name": "Number K",
+ "uniqueid": "characters/models/tm_professional/tm_professional_vari.vmdl",
+ "armModel": "",
+ "type": "playerskin",
+ "price": "0",
+ "slot": "2",
+ "disable_leg": "false",
+ "expiration": "0",
+ "hide": "false",
+ "enable": "true"
+ },
+ "3": {
+ "name": "Operator",
+ "uniqueid": "characters/models/ctm_fbi/ctm_fbi_variantf.vmdl",
+ "armModel": "",
+ "type": "playerskin",
+ "price": "0",
+ "slot": "3",
+ "disable_leg": "false",
+ "expiration": "86400",
+ "hide": "false",
+ "enable": "true"
+ }
+ },
+ "weapons": {
+ "1": {
+ "name": "AK47",
+ "uniqueid": "weapon_ak47",
+ "type": "weapon",
+ "price": "0",
+ "no_pistol_round": "true",
+ "enable": "true"
+ },
+ "2": {
+ "name": "Deagle",
+ "uniqueid": "weapon_deagle",
+ "type": "weapon",
+ "price": "0",
+ "no_pistol_round": "false",
+ "enable": "true"
+ }
+ },
+ "features": {
+ "1": {
+ "name": "Respawn",
+ "uniqueid": "respawn",
+ "type": "respawn",
+ "price": "0",
+ "enable": "true"
+ },
+ "2": {
+ "name": "50 HP",
+ "uniqueid": "health50",
+ "type": "health",
+ "price": "0",
+ "healthValue": "50",
+ "enable": "true"
+ },
+ "3": {
+ "name": "10 Armor",
+ "uniqueid": "armor10",
+ "type": "armor",
+ "price": "0",
+ "armorValue": "10",
+ "enable": "true"
+ },
+ "4": {
+ "name": "Open Doors",
+ "uniqueid": "open",
+ "type": "open",
+ "price": "0",
+ "enable": "true"
+ },
+ "5": {
+ "name": "Sound",
+ "uniqueid": "sounds/ambient/ambience/rainscapes/thunder_close01.vsnd_c",
+ "type": "sound",
+ "price": "0",
+ "enable": "true"
+ },
+ "6": {
+ "name": "Bunnyhop",
+ "uniqueid": "bunnyhop",
+ "type": "bunnyhop",
+ "price": "0",
+ "maxSpeed": "320.0",
+ "enable": "true"
+ }
+ },
+ "gravity": {
+ "1": {
+ "name": "0.1",
+ "uniqueid": "gravity0.1",
+ "type": "gravity",
+ "price": "0",
+ "gravityValue": "0.1",
+ "enable": "true"
+ },
+ "2": {
+ "name": "0.2",
+ "uniqueid": "gravity0.2",
+ "type": "gravity",
+ "price": "0",
+ "gravityValue": "0.2",
+ "enable": "true"
+ }
+ },
+ "speed": {
+ "1": {
+ "name": "1.1f Speed 1 Round",
+ "uniqueid": "speed10",
+ "type": "speed",
+ "price": "0",
+ "speedValue": "1.1",
+ "speedTimerValue": "0",
+ "enable": "true"
+ },
+ "2": {
+ "name": "5 Sec 1.1f Speed",
+ "uniqueid": "speed51.1",
+ "type": "speed",
+ "price": "0",
+ "speedValue": "1.1",
+ "speedTimerValue": "5",
+ "enable": "true"
+ }
+ },
+ "godmode": {
+ "1": {
+ "name": "5 Sec",
+ "uniqueid": "god5",
+ "type": "godmode",
+ "price": "0",
+ "godmodeTimerValue": "5",
+ "enable": "true"
+ },
+ "2": {
+ "name": "10 Sec",
+ "uniqueid": "god10",
+ "type": "godmode",
+ "price": "0",
+ "godmodeTimerValue": "10",
+ "enable": "true"
+ }
+ },
+ "smoke": {
+ "1": {
+ "name": "Random",
+ "uniqueid": "colorsmoke",
+ "type": "smoke",
+ "price": "0",
+ "slot": "1",
+ "enable": "true"
+ },
+ "2": {
+ "name": "Red",
+ "uniqueid": "redsmoke",
+ "type": "smoke",
+ "color": "255 0 0",
+ "price": "0",
+ "slot": "1",
+ "enable": "true"
+ }
+ },
+ "trail": {
+ "1": {
+ "name": "Energycirc Trail",
+ "uniqueid": "particles/ui/status_levels/ui_status_level_8_energycirc.vpcf",
+ "type": "trail",
+ "price": "0",
+ "slot": "1",
+ "lifetime": "1.3",
+ "acceptInputValue": "Start",
+ "angleValue": "90 0 0",
+ "enable": "true"
+ },
+ "2": {
+ "name": "Random color trail",
+ "uniqueid": "trailrandomcolor",
+ "type": "trail",
+ "price": "0",
+ "slot": "1",
+ "lifetime": "1.3",
+ "widthValue": "1.0",
+ "color": "",
+ "enable": "true"
+ },
+ "3": {
+ "name": "Green color trail",
+ "uniqueid": "trailgreencolor",
+ "type": "trail",
+ "price": "0",
+ "slot": "1",
+ "lifetime": "1.3",
+ "widthValue": "1.0",
+ "color": "0 255 0",
+ "enable": "true"
+ }
+ },
+ "tracer": {
+ "1": {
+ "name": "Energycirc Tracer",
+ "uniqueid": "particles/ui/status_levels/ui_status_level_8_energycirc.vpcf",
+ "type": "tracer",
+ "price": "0",
+ "slot": "1",
+ "lifetime": "0.3",
+ "acceptInputValue": "Start",
+ "enable": "true"
+ }
+ },
+ "grenadetrail": {
+ "1": {
+ "name": "Molotov effect",
+ "uniqueid": "particles/inferno_fx/molotov_fire01.vpcf",
+ "type": "grenadetrail",
+ "price": "0",
+ "slot": "1",
+ "acceptInputValue": "Start",
+ "enable": "true"
+ }
+ },
+ "coloredskins": {
+ "1": {
+ "name": "Random coloredskin",
+ "uniqueid": "coloredskin_random",
+ "type": "coloredskin",
+ "price": "0",
+ "slot": "1",
+ "enable": "true"
+ },
+ "2": {
+ "name": "Green coloredskin",
+ "uniqueid": "coloredskin_green",
+ "type": "coloredskin",
+ "price": "0",
+ "slot": "1",
+ "color": "0 255 0",
+ "enable": "true"
+ }
+ }
+ }
+}
\ No newline at end of file