Skip to content

Commit 580ec08

Browse files
author
尧杰 曾
committed
添加项目文件。
1 parent 57d37bd commit 580ec08

21 files changed

+1379
-0
lines changed

CDK.sln

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.0.32126.317
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CDK", "CDK\CDK.csproj", "{FB965A30-58FD-4BE4-8683-2BF007DAE933}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{FB965A30-58FD-4BE4-8683-2BF007DAE933}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{FB965A30-58FD-4BE4-8683-2BF007DAE933}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{FB965A30-58FD-4BE4-8683-2BF007DAE933}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{FB965A30-58FD-4BE4-8683-2BF007DAE933}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
GlobalSection(ExtensibilityGlobals) = postSolution
23+
SolutionGuid = {AABE4B55-3375-46F0-B281-6DE9B2290870}
24+
EndGlobalSection
25+
EndGlobal

CDK/CDK.csproj

+139
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4+
<PropertyGroup>
5+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7+
<ProjectGuid>{FB965A30-58FD-4BE4-8683-2BF007DAE933}</ProjectGuid>
8+
<OutputType>Library</OutputType>
9+
<AppDesignerFolder>Properties</AppDesignerFolder>
10+
<RootNamespace>CDK</RootNamespace>
11+
<AssemblyName>CDK</AssemblyName>
12+
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
13+
<FileAlignment>512</FileAlignment>
14+
<Deterministic>true</Deterministic>
15+
</PropertyGroup>
16+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
17+
<DebugSymbols>true</DebugSymbols>
18+
<DebugType>full</DebugType>
19+
<Optimize>false</Optimize>
20+
<OutputPath>bin\Debug\</OutputPath>
21+
<DefineConstants>DEBUG;TRACE</DefineConstants>
22+
<ErrorReport>prompt</ErrorReport>
23+
<WarningLevel>4</WarningLevel>
24+
</PropertyGroup>
25+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
26+
<DebugType>pdbonly</DebugType>
27+
<Optimize>true</Optimize>
28+
<OutputPath>bin\Release\</OutputPath>
29+
<DefineConstants>TRACE</DefineConstants>
30+
<ErrorReport>prompt</ErrorReport>
31+
<WarningLevel>4</WarningLevel>
32+
</PropertyGroup>
33+
<ItemGroup>
34+
<Reference Include="Assembly-CSharp, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
35+
<SpecificVersion>False</SpecificVersion>
36+
<HintPath>lib\Assembly-CSharp.dll</HintPath>
37+
<Private>False</Private>
38+
</Reference>
39+
<Reference Include="BouncyCastle.Crypto, Version=1.8.9.0, Culture=neutral, PublicKeyToken=0e99375e54769942">
40+
<HintPath>..\packages\BouncyCastle.1.8.9\lib\BouncyCastle.Crypto.dll</HintPath>
41+
</Reference>
42+
<Reference Include="com.rlabrecque.steamworks.net, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
43+
<SpecificVersion>False</SpecificVersion>
44+
<HintPath>lib\com.rlabrecque.steamworks.net.dll</HintPath>
45+
<Private>False</Private>
46+
</Reference>
47+
<Reference Include="Google.Protobuf, Version=3.20.1.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL">
48+
<HintPath>..\packages\Google.Protobuf.3.20.1\lib\net45\Google.Protobuf.dll</HintPath>
49+
</Reference>
50+
<Reference Include="K4os.Compression.LZ4, Version=1.2.16.0, Culture=neutral, PublicKeyToken=2186fa9121ef231d, processorArchitecture=MSIL">
51+
<HintPath>..\packages\K4os.Compression.LZ4.1.2.16\lib\net46\K4os.Compression.LZ4.dll</HintPath>
52+
</Reference>
53+
<Reference Include="K4os.Compression.LZ4.Streams, Version=1.2.16.0, Culture=neutral, PublicKeyToken=2186fa9121ef231d, processorArchitecture=MSIL">
54+
<HintPath>..\packages\K4os.Compression.LZ4.Streams.1.2.16\lib\net46\K4os.Compression.LZ4.Streams.dll</HintPath>
55+
</Reference>
56+
<Reference Include="K4os.Hash.xxHash, Version=1.0.7.0, Culture=neutral, PublicKeyToken=32cd54395057cec3, processorArchitecture=MSIL">
57+
<HintPath>..\packages\K4os.Hash.xxHash.1.0.7\lib\net46\K4os.Hash.xxHash.dll</HintPath>
58+
</Reference>
59+
<Reference Include="MySql.Data, Version=8.0.29.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
60+
<HintPath>..\packages\MySql.Data.8.0.29\lib\net48\MySql.Data.dll</HintPath>
61+
</Reference>
62+
<Reference Include="Rocket.API, Version=4.9.3.4, Culture=neutral, processorArchitecture=MSIL">
63+
<SpecificVersion>False</SpecificVersion>
64+
<HintPath>lib\Rocket.API.dll</HintPath>
65+
<Private>False</Private>
66+
</Reference>
67+
<Reference Include="Rocket.Core, Version=4.9.3.4, Culture=neutral, processorArchitecture=MSIL">
68+
<SpecificVersion>False</SpecificVersion>
69+
<HintPath>lib\Rocket.Core.dll</HintPath>
70+
<Private>False</Private>
71+
</Reference>
72+
<Reference Include="Rocket.Unturned, Version=4.9.3.13, Culture=neutral, processorArchitecture=MSIL">
73+
<SpecificVersion>False</SpecificVersion>
74+
<HintPath>lib\Rocket.Unturned.dll</HintPath>
75+
<Private>False</Private>
76+
</Reference>
77+
<Reference Include="System" />
78+
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
79+
<HintPath>..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath>
80+
</Reference>
81+
<Reference Include="System.ComponentModel" />
82+
<Reference Include="System.ComponentModel.DataAnnotations" />
83+
<Reference Include="System.Configuration" />
84+
<Reference Include="System.Configuration.Install" />
85+
<Reference Include="System.Core" />
86+
<Reference Include="System.Management" />
87+
<Reference Include="System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
88+
<HintPath>..\packages\System.Memory.4.5.4\lib\net461\System.Memory.dll</HintPath>
89+
</Reference>
90+
<Reference Include="System.Numerics" />
91+
<Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
92+
<HintPath>..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
93+
</Reference>
94+
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
95+
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
96+
</Reference>
97+
<Reference Include="System.Transactions" />
98+
<Reference Include="System.Xml.Linq" />
99+
<Reference Include="System.Data.DataSetExtensions" />
100+
<Reference Include="Microsoft.CSharp" />
101+
<Reference Include="System.Data" />
102+
<Reference Include="System.Net.Http" />
103+
<Reference Include="System.Xml" />
104+
<Reference Include="Ubiety.Dns.Core, Version=2.2.1.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
105+
<HintPath>..\packages\MySql.Data.8.0.29\lib\net48\Ubiety.Dns.Core.dll</HintPath>
106+
</Reference>
107+
<Reference Include="Uconomy">
108+
<HintPath>lib\Uconomy.dll</HintPath>
109+
</Reference>
110+
<Reference Include="UnityEngine, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
111+
<SpecificVersion>False</SpecificVersion>
112+
<HintPath>lib\UnityEngine.dll</HintPath>
113+
<Private>False</Private>
114+
</Reference>
115+
<Reference Include="UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
116+
<SpecificVersion>False</SpecificVersion>
117+
<HintPath>lib\UnityEngine.CoreModule.dll</HintPath>
118+
<Private>False</Private>
119+
</Reference>
120+
<Reference Include="ZstdNet, Version=1.4.5.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
121+
<HintPath>..\packages\MySql.Data.8.0.29\lib\net48\ZstdNet.dll</HintPath>
122+
</Reference>
123+
</ItemGroup>
124+
<ItemGroup>
125+
<Compile Include="CDKCommand.cs" />
126+
<Compile Include="Data\CDKData.cs" />
127+
<Compile Include="Config.cs" />
128+
<Compile Include="DatabaseManager.cs" />
129+
<Compile Include="Data\LogData.cs" />
130+
<Compile Include="Enum\ELogQueryType.cs" />
131+
<Compile Include="Main.cs" />
132+
<Compile Include="Properties\AssemblyInfo.cs" />
133+
</ItemGroup>
134+
<ItemGroup>
135+
<None Include="app.config" />
136+
<None Include="packages.config" />
137+
</ItemGroup>
138+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
139+
</Project>

CDK/CDKCommand.cs

+96
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
using Rocket.API;
7+
using Rocket.Unturned.Player;
8+
using Steamworks;
9+
using Rocket.Unturned.Chat;
10+
11+
namespace CDK
12+
{
13+
public class CDKCommand : IRocketCommand
14+
{
15+
public string Name => "CDK";
16+
17+
public string Help => "";
18+
19+
public AllowedCaller AllowedCaller => AllowedCaller.Player;
20+
21+
public string Syntax => "CDK <Key>";
22+
23+
public List<string> Permissions => new List<string>() { "CDK" };
24+
25+
public List<string> Aliases => new List<string>();
26+
27+
public void Execute(IRocketPlayer caller,string[] args)
28+
{
29+
//if (!Main.Instance.Configuration.Instance.MySQLSupport)
30+
//{
31+
// if (args.Length == 1)
32+
// {
33+
// Main.Instance.CDKRedeem(UnturnedPlayer.FromName(caller.DisplayName), args[0]);
34+
// }
35+
// else if (args.Length == 2 && args[0].ToLower() == "reset")
36+
// {
37+
// if (caller.HasPermission("cdk.reset"))
38+
// {
39+
// if (Main.Instance.ResetKeyCount(args[1]))
40+
// {
41+
// UnturnedChat.Say(caller, Main.Instance.Translate("reset_count"));
42+
// }
43+
// else
44+
// {
45+
// UnturnedChat.Say(caller, Main.Instance.Translate("key_dones't_exist"), UnityEngine.Color.red);
46+
// }
47+
// }
48+
// }
49+
// else
50+
// {
51+
// UnturnedChat.Say(caller, Main.Instance.Translate("invaild_param"), UnityEngine.Color.red);
52+
// }
53+
//}
54+
//else if(Main.Instance.Configuration.Instance.MySQLSupport)
55+
//{
56+
if(args.Length == 1)
57+
{
58+
if (!Main.Instance.Database.IsPurchased(UnturnedPlayer.FromName(caller.DisplayName), args[0]))
59+
{
60+
switch (Main.Instance.Database.RedeemCDK(UnturnedPlayer.FromName(caller.DisplayName), args[0]))
61+
{
62+
case DatabaseManager.RedeemCDKResult.Success:
63+
UnturnedChat.Say(caller, Main.Instance.Translate("success"));
64+
break;
65+
case DatabaseManager.RedeemCDKResult.Redeemed:
66+
UnturnedChat.Say(caller, Main.Instance.Translate("already_redeemed"), UnityEngine.Color.red);
67+
break;
68+
case DatabaseManager.RedeemCDKResult.KeyNotFound:
69+
UnturnedChat.Say(caller, Main.Instance.Translate("key_dones't_exist"), UnityEngine.Color.red);
70+
break;
71+
case DatabaseManager.RedeemCDKResult.MaxRedeemed:
72+
UnturnedChat.Say(caller, Main.Instance.Translate("maxcount_reached"), UnityEngine.Color.red);
73+
break;
74+
case DatabaseManager.RedeemCDKResult.Renewed:
75+
UnturnedChat.Say(caller, Main.Instance.Translate("key_renewed"));
76+
break;
77+
case DatabaseManager.RedeemCDKResult.Error:
78+
UnturnedChat.Say(caller, Main.Instance.Translate("error"), UnityEngine.Color.red);
79+
break;
80+
case DatabaseManager.RedeemCDKResult.PlayerNotMatch:
81+
UnturnedChat.Say(caller, Main.Instance.Translate("player_not_match"), UnityEngine.Color.red);
82+
break;
83+
}
84+
}
85+
else
86+
{
87+
UnturnedChat.Say(caller, Main.Instance.Translate("already_purchased"), UnityEngine.Color.red);
88+
}
89+
}
90+
else
91+
{
92+
UnturnedChat.Say(caller, Main.Instance.Translate("invaild_param"), UnityEngine.Color.red);
93+
}
94+
}
95+
}
96+
}

CDK/Config.cs

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
using Rocket.API;
7+
8+
namespace CDK
9+
{
10+
public class Config : IRocketPluginConfiguration
11+
{
12+
public int MySQLTableVer;
13+
//public bool MySQLSupport;
14+
//public List<CDK> CDKs;
15+
//public bool BypassAdmin;
16+
public string DatabaseAddress;
17+
public string DatabaseUsername;
18+
public string DatabasePassword;
19+
public string DatabaseName;
20+
public string DatabaseCDKTableName;
21+
public string DatabaseRedeemLogTableName;
22+
public int DatabasePort;
23+
24+
public void LoadDefaults()
25+
{
26+
MySQLTableVer = 1;
27+
//MySQLSupport = false;
28+
//BypassAdmin = true;
29+
DatabaseAddress = "127.0.0.1";
30+
DatabaseUsername = "unturned";
31+
DatabasePassword = "password";
32+
DatabaseName = "unturned";
33+
DatabaseCDKTableName = "cdk";
34+
DatabaseRedeemLogTableName = "redeemedlog";
35+
DatabasePort = 3306;
36+
//CDKs = new List<CDK>() { new CDK() { Key = "Key", Items = "100,1000,1500",XP = 111 , RedeemPermission = "Test",GrantPermissionGroup="VIP1" ,MaxCount = 100,CurrentCount = 0,Vehicle = 1,Money = 1000 } };
37+
}
38+
}
39+
40+
//public class CDK
41+
//{
42+
// public CDK() { }
43+
44+
// public string Key;
45+
// public string Items;
46+
// public ushort? Vehicle = null;
47+
// public uint? XP = null;
48+
// public decimal? Money = null;
49+
// public string RedeemPermission = "";
50+
// public int? MaxCount = 0;
51+
// public int? CurrentCount = 0;
52+
// public string GrantPermissionGroup = "";
53+
54+
//}
55+
}

CDK/CreateCDKCommand.cs

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
using Rocket.API;
7+
using Rocket.Unturned.Chat;
8+
9+
namespace CDK
10+
{
11+
public class CreateCDKCommand : IRocketCommand
12+
{
13+
public string Name => "createcdk";
14+
15+
public string Syntax => "createcdk <CDK> <ItemString> <Vehicle> <Experience> <Money> [GrantPermissionGoup] [MaxRedeem]";
16+
17+
public string Help => "Create a CDK with give paramters";
18+
19+
public AllowedCaller AllowedCaller => AllowedCaller.Both;
20+
21+
public List<string> Aliases => new List<string>();
22+
23+
public List<string> Permissions => new List<string>() { "cdk.create" };
24+
25+
public void Execute(IRocketPlayer caller,string[] args)
26+
{
27+
UnturnedChat.Say(caller, "This command is under developing!",UnityEngine.Color.yellow);
28+
return;
29+
}
30+
}
31+
}

CDK/Data/CDKData.cs

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
using Steamworks;
7+
8+
namespace CDK.Data
9+
{
10+
public class CDKData
11+
{
12+
public string CDK { get; internal set; }
13+
public string Items { get; internal set; }
14+
public string Amount { get; internal set; }
15+
public ushort? Vehicle { get; internal set; }
16+
public ushort? Experience { get; internal set; }
17+
public decimal? Money { get; internal set; }
18+
public int? Reputation { get; internal set; }
19+
public string GrantPermissionGroup { get; internal set; }
20+
public int RedeemedTimes { get; internal set; }
21+
public int? MaxRedeem { get; internal set; }
22+
public DateTime ValidUntil { get; internal set; }
23+
public bool Renew { get; internal set; }
24+
public CSteamID Owner { get; internal set; }
25+
public CDKData(string cdk,string items,string amount,ushort? vehicle,ushort? exp,decimal? money,int? reputation,string permissonGroup,int redeemedTimes,int? maxredeem,DateTime validuntill,CSteamID steamID,bool renew)
26+
{
27+
CDK = cdk;
28+
Items = items;
29+
Amount = amount;
30+
Vehicle = vehicle;
31+
Experience = exp;
32+
Money = money;
33+
Reputation = reputation;
34+
GrantPermissionGroup = permissonGroup;
35+
RedeemedTimes = redeemedTimes;
36+
MaxRedeem = maxredeem;
37+
ValidUntil = validuntill;
38+
Owner = steamID;
39+
Renew = renew;
40+
}
41+
42+
}
43+
}

0 commit comments

Comments
 (0)