├── .gitattributes
├── .gitignore
├── BlazeLibWV
├── Blaze.cs
├── BlazeLibWV.csproj
├── BlazePrettyPrinter.cs
└── Properties
│ └── AssemblyInfo.cs
├── CNCEmu.sln
├── CNCEmu
├── App.config
├── BackendLog.cs
├── BlazeServer.cs
├── CNCEmu.csproj
├── CleanPackets.cs
├── Commands
│ ├── NotifyClientGameSetupCommand.cs
│ ├── NotifyGamePlayerStateChangeCommand.cs
│ ├── NotifyGameSettingsChangeCommand.cs
│ ├── NotifyGameStateChangeCommand.cs
│ ├── NotifyPlatformHostInitializedCommand.cs
│ ├── NotifyPlayerJoinCompletedCommand.cs
│ ├── NotifyPlayerJoiningCommand.cs
│ ├── NotifyPlayerRemovedCommand.cs
│ ├── NotifyServerGameSetupCommand.cs
│ ├── NotifyUserAddedCommand.cs
│ ├── NotifyUserRemovedCommand.cs
│ ├── NotifyUserStatusCommand.cs
│ ├── UserAddedCommand.cs
│ ├── UserAuthenticatedCommand.cs
│ ├── UserSessionExtendedDataUpdateNotificationCommand.cs
│ └── UserUpdatedCommand.cs
├── Components
│ ├── AccountsComponent.cs
│ ├── AssociationListsComponent.cs
│ ├── AsyncNotification
│ │ ├── AsyncGameManager.cs
│ │ ├── AsyncStats.cs
│ │ └── AsyncUserSessions.cs
│ ├── AuthenticationComponent.cs
│ ├── BlazeHelper.cs
│ ├── GameManagerComponent.cs
│ ├── InventoryComponent.cs
│ ├── RSPComponent.cs
│ ├── StatsComponent.cs
│ ├── UserSessionsComponent.cs
│ └── UtilComponent.cs
├── Config.cs
├── Form1.Designer.cs
├── Form1.cs
├── Form1.resx
├── Form2.Designer.cs
├── Form2.cs
├── Form2.resx
├── GameInfo.cs
├── GenFiles.cs
├── Helper.cs
├── Logger.cs
├── PlayerInfo.cs
├── Profile.cs
├── Program.cs
├── Properties
│ ├── AssemblyInfo.tt
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
├── ProviderInfo.cs
├── RedirectorServer.cs
├── Resources
│ └── external.png
├── Utils.cs
└── blaze.ico
├── LICENSE
├── README.md
└── cnc_shellui_wwwroot-1.2.2.zip
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Auto detect text files and perform LF normalization
2 | * text=auto
3 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 | ##
4 | ## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore
5 |
6 | # User-specific files
7 | *.rsuser
8 | *.suo
9 | *.user
10 | *.userosscache
11 | *.sln.docstates
12 |
13 | # User-specific files (MonoDevelop/Xamarin Studio)
14 | *.userprefs
15 |
16 | # Mono auto generated files
17 | mono_crash.*
18 |
19 | # Build results
20 | [Dd]ebug/
21 | [Dd]ebugPublic/
22 | [Rr]elease/
23 | [Rr]eleases/
24 | x64/
25 | x86/
26 | [Ww][Ii][Nn]32/
27 | [Aa][Rr][Mm]/
28 | [Aa][Rr][Mm]64/
29 | bld/
30 | [Bb]in/
31 | [Oo]bj/
32 | [Ll]og/
33 | [Ll]ogs/
34 |
35 | # Visual Studio 2015/2017 cache/options directory
36 | .vs/
37 | # Uncomment if you have tasks that create the project's static files in wwwroot
38 | #wwwroot/
39 |
40 | # Visual Studio 2017 auto generated files
41 | Generated\ Files/
42 |
43 | # MSTest test Results
44 | [Tt]est[Rr]esult*/
45 | [Bb]uild[Ll]og.*
46 |
47 | # NUnit
48 | *.VisualState.xml
49 | TestResult.xml
50 | nunit-*.xml
51 |
52 | # Build Results of an ATL Project
53 | [Dd]ebugPS/
54 | [Rr]eleasePS/
55 | dlldata.c
56 |
57 | # Benchmark Results
58 | BenchmarkDotNet.Artifacts/
59 |
60 | # .NET Core
61 | project.lock.json
62 | project.fragment.lock.json
63 | artifacts/
64 |
65 | # ASP.NET Scaffolding
66 | ScaffoldingReadMe.txt
67 |
68 | # StyleCop
69 | StyleCopReport.xml
70 |
71 | # Files built by Visual Studio
72 | *_i.c
73 | *_p.c
74 | *_h.h
75 | *.ilk
76 | *.meta
77 | *.obj
78 | *.iobj
79 | *.pch
80 | *.pdb
81 | *.ipdb
82 | *.pgc
83 | *.pgd
84 | *.rsp
85 | *.sbr
86 | *.tlb
87 | *.tli
88 | *.tlh
89 | *.tmp
90 | *.tmp_proj
91 | *_wpftmp.csproj
92 | *.log
93 | *.tlog
94 | *.vspscc
95 | *.vssscc
96 | .builds
97 | *.pidb
98 | *.svclog
99 | *.scc
100 |
101 | # Chutzpah Test files
102 | _Chutzpah*
103 |
104 | # Visual C++ cache files
105 | ipch/
106 | *.aps
107 | *.ncb
108 | *.opendb
109 | *.opensdf
110 | *.sdf
111 | *.cachefile
112 | *.VC.db
113 | *.VC.VC.opendb
114 |
115 | # Visual Studio profiler
116 | *.psess
117 | *.vsp
118 | *.vspx
119 | *.sap
120 |
121 | # Visual Studio Trace Files
122 | *.e2e
123 |
124 | # TFS 2012 Local Workspace
125 | $tf/
126 |
127 | # Guidance Automation Toolkit
128 | *.gpState
129 |
130 | # ReSharper is a .NET coding add-in
131 | _ReSharper*/
132 | *.[Rr]e[Ss]harper
133 | *.DotSettings.user
134 |
135 | # TeamCity is a build add-in
136 | _TeamCity*
137 |
138 | # DotCover is a Code Coverage Tool
139 | *.dotCover
140 |
141 | # AxoCover is a Code Coverage Tool
142 | .axoCover/*
143 | !.axoCover/settings.json
144 |
145 | # Coverlet is a free, cross platform Code Coverage Tool
146 | coverage*.json
147 | coverage*.xml
148 | coverage*.info
149 |
150 | # Visual Studio code coverage results
151 | *.coverage
152 | *.coveragexml
153 |
154 | # NCrunch
155 | _NCrunch_*
156 | .*crunch*.local.xml
157 | nCrunchTemp_*
158 |
159 | # MightyMoose
160 | *.mm.*
161 | AutoTest.Net/
162 |
163 | # Web workbench (sass)
164 | .sass-cache/
165 |
166 | # Installshield output folder
167 | [Ee]xpress/
168 |
169 | # DocProject is a documentation generator add-in
170 | DocProject/buildhelp/
171 | DocProject/Help/*.HxT
172 | DocProject/Help/*.HxC
173 | DocProject/Help/*.hhc
174 | DocProject/Help/*.hhk
175 | DocProject/Help/*.hhp
176 | DocProject/Help/Html2
177 | DocProject/Help/html
178 |
179 | # Click-Once directory
180 | publish/
181 |
182 | # Publish Web Output
183 | *.[Pp]ublish.xml
184 | *.azurePubxml
185 | # Note: Comment the next line if you want to checkin your web deploy settings,
186 | # but database connection strings (with potential passwords) will be unencrypted
187 | *.pubxml
188 | *.publishproj
189 |
190 | # Microsoft Azure Web App publish settings. Comment the next line if you want to
191 | # checkin your Azure Web App publish settings, but sensitive information contained
192 | # in these scripts will be unencrypted
193 | PublishScripts/
194 |
195 | # NuGet Packages
196 | *.nupkg
197 | # NuGet Symbol Packages
198 | *.snupkg
199 | # The packages folder can be ignored because of Package Restore
200 | **/[Pp]ackages/*
201 | # except build/, which is used as an MSBuild target.
202 | !**/[Pp]ackages/build/
203 | # Uncomment if necessary however generally it will be regenerated when needed
204 | #!**/[Pp]ackages/repositories.config
205 | # NuGet v3's project.json files produces more ignorable files
206 | *.nuget.props
207 | *.nuget.targets
208 |
209 | # Microsoft Azure Build Output
210 | csx/
211 | *.build.csdef
212 |
213 | # Microsoft Azure Emulator
214 | ecf/
215 | rcf/
216 |
217 | # Windows Store app package directories and files
218 | AppPackages/
219 | BundleArtifacts/
220 | Package.StoreAssociation.xml
221 | _pkginfo.txt
222 | *.appx
223 | *.appxbundle
224 | *.appxupload
225 |
226 | # Visual Studio cache files
227 | # files ending in .cache can be ignored
228 | *.[Cc]ache
229 | # but keep track of directories ending in .cache
230 | !?*.[Cc]ache/
231 |
232 | # Others
233 | ClientBin/
234 | ~$*
235 | *~
236 | *.dbmdl
237 | *.dbproj.schemaview
238 | *.jfm
239 | *.pfx
240 | *.publishsettings
241 | orleans.codegen.cs
242 |
243 | # Including strong name files can present a security risk
244 | # (https://github.com/github/gitignore/pull/2483#issue-259490424)
245 | #*.snk
246 |
247 | # Since there are multiple workflows, uncomment next line to ignore bower_components
248 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
249 | #bower_components/
250 |
251 | # RIA/Silverlight projects
252 | Generated_Code/
253 |
254 | # Backup & report files from converting an old project file
255 | # to a newer Visual Studio version. Backup files are not needed,
256 | # because we have git ;-)
257 | _UpgradeReport_Files/
258 | Backup*/
259 | UpgradeLog*.XML
260 | UpgradeLog*.htm
261 | ServiceFabricBackup/
262 | *.rptproj.bak
263 |
264 | # SQL Server files
265 | *.mdf
266 | *.ldf
267 | *.ndf
268 |
269 | # Business Intelligence projects
270 | *.rdl.data
271 | *.bim.layout
272 | *.bim_*.settings
273 | *.rptproj.rsuser
274 | *- [Bb]ackup.rdl
275 | *- [Bb]ackup ([0-9]).rdl
276 | *- [Bb]ackup ([0-9][0-9]).rdl
277 |
278 | # Microsoft Fakes
279 | FakesAssemblies/
280 |
281 | # GhostDoc plugin setting file
282 | *.GhostDoc.xml
283 |
284 | # Node.js Tools for Visual Studio
285 | .ntvs_analysis.dat
286 | node_modules/
287 |
288 | # Visual Studio 6 build log
289 | *.plg
290 |
291 | # Visual Studio 6 workspace options file
292 | *.opt
293 |
294 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
295 | *.vbw
296 |
297 | # Visual Studio 6 auto-generated project file (contains which files were open etc.)
298 | *.vbp
299 |
300 | # Visual Studio 6 workspace and project file (working project files containing files to include in project)
301 | *.dsw
302 | *.dsp
303 |
304 | # Visual Studio 6 technical files
305 | *.ncb
306 | *.aps
307 |
308 | # Visual Studio LightSwitch build output
309 | **/*.HTMLClient/GeneratedArtifacts
310 | **/*.DesktopClient/GeneratedArtifacts
311 | **/*.DesktopClient/ModelManifest.xml
312 | **/*.Server/GeneratedArtifacts
313 | **/*.Server/ModelManifest.xml
314 | _Pvt_Extensions
315 |
316 | # Paket dependency manager
317 | .paket/paket.exe
318 | paket-files/
319 |
320 | # FAKE - F# Make
321 | .fake/
322 |
323 | # CodeRush personal settings
324 | .cr/personal
325 |
326 | # Python Tools for Visual Studio (PTVS)
327 | __pycache__/
328 | *.pyc
329 |
330 | # Cake - Uncomment if you are using it
331 | # tools/**
332 | # !tools/packages.config
333 |
334 | # Tabs Studio
335 | *.tss
336 |
337 | # Telerik's JustMock configuration file
338 | *.jmconfig
339 |
340 | # BizTalk build output
341 | *.btp.cs
342 | *.btm.cs
343 | *.odx.cs
344 | *.xsd.cs
345 |
346 | # OpenCover UI analysis results
347 | OpenCover/
348 |
349 | # Azure Stream Analytics local run output
350 | ASALocalRun/
351 |
352 | # MSBuild Binary and Structured Log
353 | *.binlog
354 |
355 | # NVidia Nsight GPU debugger configuration file
356 | *.nvuser
357 |
358 | # MFractors (Xamarin productivity tool) working folder
359 | .mfractor/
360 |
361 | # Local History for Visual Studio
362 | .localhistory/
363 |
364 | # Visual Studio History (VSHistory) files
365 | .vshistory/
366 |
367 | # BeatPulse healthcheck temp database
368 | healthchecksdb
369 |
370 | # Backup folder for Package Reference Convert tool in Visual Studio 2017
371 | MigrationBackup/
372 |
373 | # Ionide (cross platform F# VS Code tools) working folder
374 | .ionide/
375 |
376 | # Fody - auto-generated XML schema
377 | FodyWeavers.xsd
378 |
379 | # VS Code files for those working on multiple tools
380 | .vscode/*
381 | !.vscode/settings.json
382 | !.vscode/tasks.json
383 | !.vscode/launch.json
384 | !.vscode/extensions.json
385 | *.code-workspace
386 |
387 | # Local History for Visual Studio Code
388 | .history/
389 |
390 | # Windows Installer files from build outputs
391 | *.cab
392 | *.msi
393 | *.msix
394 | *.msm
395 | *.msp
396 |
397 | # JetBrains Rider
398 | *.sln.iml
399 |
400 | *.vsidx
401 | /CNCEmu/Properties/AssemblyInfo.cs
402 | /CNCEmu/Properties/AssemblyInfo.cs
403 | /CNCEmu/Properties/AssemblyInfo.cs
404 |
--------------------------------------------------------------------------------
/BlazeLibWV/BlazeLibWV.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {7CE2BF11-C78D-49AB-A37A-538D2D0E0418}
8 | Library
9 | Properties
10 | BlazeLibWV
11 | BlazeLibWV
12 | v4.6.1
13 | 512
14 | true
15 |
16 |
17 | true
18 | full
19 | false
20 | bin\Debug\
21 | DEBUG;TRACE
22 | prompt
23 | 4
24 |
25 |
26 | pdbonly
27 | true
28 | bin\Release\
29 | TRACE
30 | prompt
31 | 4
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/BlazeLibWV/BlazePrettyPrinter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace BlazeLibWV
8 | {
9 | public static class BlazePrettyPrinter
10 | {
11 | public static string PrintPacket(Blaze.Packet p)
12 | {
13 | StringBuilder sb = new StringBuilder();
14 | sb.AppendFormat("[{0}][{1}:{2}] {3}", Blaze.PacketToDescriber(p), p.Component.ToString("X4"), p.Command.ToString("X4"), p.QType == 0 ? "from client" : "from server");
15 | sb.AppendLine();
16 | sb.AppendLine("{");
17 | List content = Blaze.ReadPacketContent(p);
18 | foreach (Blaze.Tdf tdf in content)
19 | sb.Append(PrintTdf(tdf, 1));
20 | sb.AppendLine("}");
21 | return sb.ToString();
22 | }
23 |
24 | public static string PrintTdf(Blaze.Tdf tdf, int tabs)
25 | {
26 | StringBuilder sb = new StringBuilder();
27 | string tab = "";
28 | for (int i = 0; i < tabs; i++)
29 | tab += "\t";
30 | sb.Append(tab + "[" + tdf.Label + "]:" + tdf.GetTypeDesc() + " = ");
31 | long n;
32 | string s;
33 | Blaze.DoubleVal dv;
34 | List tdfl;
35 | switch (tdf.Type)
36 | {
37 | case 0:
38 | n = ((Blaze.TdfInteger)tdf).Value;
39 | sb.AppendLine("0x" + n.ToString("X") + "(" + n + ")");
40 | break;
41 | case 1:
42 | s = ((Blaze.TdfString)tdf).Value;
43 | sb.AppendLine("\"" + s + "\"");
44 | break;
45 | case 3:
46 | tdfl = ((Blaze.TdfStruct)tdf).Values;
47 | sb.AppendLine();
48 | if (((Blaze.TdfStruct)tdf).startswith2)
49 | sb.AppendLine(tab + "{(*starts with 0x02)");
50 | else
51 | sb.AppendLine(tab + "{");
52 | foreach (Blaze.Tdf tdf2 in tdfl)
53 | sb.Append(PrintTdf(tdf2, tabs + 1));
54 | sb.AppendLine(tab + "}");
55 | break;
56 | case 4:
57 | sb.AppendLine();
58 | sb.AppendLine(tab + "{");
59 | sb.Append(PrintTdfList((Blaze.TdfList)tdf, tabs + 1));
60 | sb.AppendLine(tab + "}");
61 | break;
62 | case 5:
63 | sb.AppendLine();
64 | sb.AppendLine(tab + "{");
65 | sb.Append(PrintTdfDoubleList((Blaze.TdfDoubleList)tdf, tabs + 1));
66 | sb.AppendLine(tab + "}");
67 | break;
68 | case 6:
69 | if (((Blaze.TdfUnion)tdf).Type != 0x7f)
70 | {
71 | sb.AppendLine();
72 | sb.AppendLine(tab + "{");
73 | sb.Append(PrintTdf(((Blaze.TdfUnion)tdf).UnionContent, tabs + 1));
74 | sb.AppendLine(tab + "}");
75 | }
76 | break;
77 | case 8:
78 | dv = ((Blaze.TdfDoubleVal)tdf).Value;
79 | sb.AppendLine("{0x" + dv.v1.ToString("X") + "(" + dv.v1 + "),0x" + dv.v2.ToString("X") + "(" + dv.v2 + ")}");
80 | break;
81 | default:
82 | sb.AppendLine();
83 | break;
84 | }
85 | return sb.ToString();
86 | }
87 |
88 | public static string PrintTdfList(Blaze.TdfList list, int tabs)
89 | {
90 | StringBuilder sb = new StringBuilder();
91 | string tab = "";
92 | for (int i = 0; i < tabs; i++)
93 | tab += "\t";
94 | List li;
95 | List ls;
96 | List lt;
97 | int count = 0;
98 | switch (list.SubType)
99 | {
100 | case 0:
101 | li = ((List)list.List);
102 | foreach (long l in li)
103 | sb.AppendLine(tab + "0x" + l.ToString("X") + "(" + l + "),");
104 | break;
105 | case 1:
106 | ls = ((List)list.List);
107 | foreach (string s in ls)
108 | sb.AppendLine(tab + "\"" + s + "\",");
109 | break;
110 | case 3:
111 | lt = ((List)list.List);
112 | foreach (Blaze.TdfStruct tdf in lt)
113 | {
114 | tdf.Type = 3;
115 | tdf.Label = (count++).ToString();
116 | sb.Append(PrintTdf(tdf, tabs));
117 | }
118 | break;
119 | }
120 | return sb.ToString();
121 | }
122 |
123 | public static string PrintTdfDoubleList(Blaze.TdfDoubleList list, int tabs)
124 | {
125 | StringBuilder sb = new StringBuilder();
126 | string tab = "";
127 | for (int i = 0; i < tabs; i++)
128 | tab += "\t";
129 | long l;
130 | string s;
131 | Blaze.TdfStruct t;
132 | for (int i = 0; i < list.Count; i++)
133 | {
134 | switch (list.SubType1)
135 | {
136 | case 0:
137 | l = ((List)list.List1)[i];
138 | sb.Append(tab + "0x" + l.ToString("X") + "(" + l + ") = ");
139 | break;
140 | case 1:
141 | s = ((List)list.List1)[i];
142 | sb.Append(tab + "\"" + s + "\" = ");
143 | break;
144 | default:
145 | sb.Append(tab + " = ");
146 | break;
147 | }
148 | switch (list.SubType2)
149 | {
150 | case 0:
151 | l = ((List)list.List2)[i];
152 | sb.AppendLine("0x" + l.ToString("X") + "(" + l + "),");
153 | break;
154 | case 1:
155 | s = ((List)list.List2)[i];
156 | sb.AppendLine("\"" + s + "\",");
157 | break;
158 | case 3:
159 | t = ((List)list.List2)[i];
160 | sb.AppendLine(" [" + i + "]:TdfStruct{");
161 | foreach (Blaze.Tdf tdf in t.Values)
162 | sb.Append(PrintTdf(tdf, tabs + 1));
163 | sb.AppendLine(tab + "},");
164 | break;
165 | default:
166 | sb.AppendLine(",");
167 | break;
168 | }
169 | }
170 | return sb.ToString();
171 | }
172 |
173 | }
174 | }
175 |
--------------------------------------------------------------------------------
/BlazeLibWV/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // Allgemeine Informationen über eine Assembly werden über die folgenden
6 | // Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
7 | // die einer Assembly zugeordnet sind.
8 | [assembly: AssemblyTitle("BlazeLibWV")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("BlazeLibWV")]
13 | [assembly: AssemblyCopyright("Copyright © 2021")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Durch Festlegen von ComVisible auf FALSE werden die Typen in dieser Assembly
18 | // für COM-Komponenten unsichtbar. Wenn Sie auf einen Typ in dieser Assembly von
19 | // COM aus zugreifen müssen, sollten Sie das ComVisible-Attribut für diesen Typ auf "True" festlegen.
20 | [assembly: ComVisible(false)]
21 |
22 | // Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird
23 | [assembly: Guid("7ce2bf11-c78d-49ab-a37a-538d2d0e0418")]
24 |
25 | // Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
26 | //
27 | // Hauptversion
28 | // Nebenversion
29 | // Buildnummer
30 | // Revision
31 | //
32 | // Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden,
33 | // indem Sie "*" wie unten gezeigt eingeben:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/CNCEmu.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 17
4 | VisualStudioVersion = 17.8.34408.163
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CNCEmu", "CNCEmu\CNCEmu.csproj", "{1AA2DF60-D199-4C55-BBDD-0549E99C8949}"
7 | EndProject
8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BlazeLibWV", "BlazeLibWV\BlazeLibWV.csproj", "{7CE2BF11-C78D-49AB-A37A-538D2D0E0418}"
9 | EndProject
10 | Global
11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
12 | Debug|Any CPU = Debug|Any CPU
13 | Release|Any CPU = Release|Any CPU
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {1AA2DF60-D199-4C55-BBDD-0549E99C8949}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
17 | {1AA2DF60-D199-4C55-BBDD-0549E99C8949}.Debug|Any CPU.Build.0 = Debug|Any CPU
18 | {1AA2DF60-D199-4C55-BBDD-0549E99C8949}.Release|Any CPU.ActiveCfg = Release|Any CPU
19 | {1AA2DF60-D199-4C55-BBDD-0549E99C8949}.Release|Any CPU.Build.0 = Release|Any CPU
20 | {7CE2BF11-C78D-49AB-A37A-538D2D0E0418}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
21 | {7CE2BF11-C78D-49AB-A37A-538D2D0E0418}.Debug|Any CPU.Build.0 = Debug|Any CPU
22 | {7CE2BF11-C78D-49AB-A37A-538D2D0E0418}.Release|Any CPU.ActiveCfg = Release|Any CPU
23 | {7CE2BF11-C78D-49AB-A37A-538D2D0E0418}.Release|Any CPU.Build.0 = Release|Any CPU
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | GlobalSection(ExtensibilityGlobals) = postSolution
29 | SolutionGuid = {BD5AF215-D368-4918-89D9-F5A2181F8B4F}
30 | EndGlobalSection
31 | EndGlobal
32 |
--------------------------------------------------------------------------------
/CNCEmu/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/CNCEmu/BackendLog.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 |
8 | namespace CNCEmu
9 | {
10 | public static class BackendLog
11 | {
12 | public static string logFile = "BackendLog.txt";
13 | public static void Clear()
14 | {
15 | if (File.Exists(logFile))
16 | File.Delete(logFile);
17 | }
18 |
19 | public static void Write(string s)
20 | {
21 | File.AppendAllText(logFile, s);
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/CNCEmu/BlazeServer.cs:
--------------------------------------------------------------------------------
1 | using BlazeLibWV;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Drawing;
5 | using System.IO;
6 | using System.Net;
7 | using System.Net.Sockets;
8 | using System.Threading;
9 | using System.Windows.Forms;
10 |
11 | namespace CNCEmu
12 | {
13 | public static class BlazeServer
14 | {
15 | public static readonly object _sync = new object();
16 | public static bool _exit;
17 | public static bool _isRunning = false;
18 | public static RichTextBox box = null;
19 | public static TcpListener lBlaze = null;
20 | public static int idCounter;
21 | public static List allClients = new List();
22 |
23 | public static void Start()
24 | {
25 | SetExit(false);
26 | _isRunning = true;
27 | Log("Starting Blaze...");
28 | new Thread(tBlazeMain) { IsBackground = true }.Start();
29 | idCounter = 1;
30 | for (int i = 0; i < 10; i++)
31 | {
32 | Thread.Sleep(10);
33 | Application.DoEvents();
34 | }
35 | }
36 |
37 | public static void Stop()
38 | {
39 | Log("Backend stopping...");
40 | if (lBlaze != null) lBlaze.Stop();
41 | SetExit(true);
42 | Log("Done.");
43 | }
44 |
45 | public static void tBlazeMain(object obj)
46 | {
47 | try
48 | {
49 | Log("[MAIN] Blaze starting...");
50 | Profiles.Refresh();
51 | lBlaze = new TcpListener(IPAddress.Parse(ProviderInfo.backendIP), 3659);
52 | Log("[MAIN] Blaze bound to port: 3659");
53 | lBlaze.Start();
54 | Log("[MAIN] Blaze listening...");
55 | TcpClient client;
56 | while (!GetExit())
57 | {
58 | client = lBlaze.AcceptTcpClient();
59 | new Thread(tBlazeClientHandler) { IsBackground = true }.Start(client);
60 | }
61 | }
62 | catch (Exception ex)
63 | {
64 | LogError("MAIN", ex);
65 | }
66 | }
67 |
68 | public static void tBlazeClientHandler(object obj)
69 | {
70 | TcpClient client = (TcpClient)obj;
71 | NetworkStream ns = client.GetStream();
72 | PlayerInfo pi = new PlayerInfo();
73 | allClients.Add(pi);
74 | pi.userId = idCounter++;
75 | if (idCounter > 100)
76 | idCounter = 0;
77 | pi.exIp = 0;
78 | pi.ns = ns;
79 | pi.timeout = new System.Diagnostics.Stopwatch();
80 | pi.timeout.Start();
81 | Log("[CLNT] #" + pi.userId + " Handler started");
82 | //try
83 | //{
84 | while (!GetExit())
85 | {
86 | byte[] data = Helper.ReadContentTCP(ns);
87 | if (data != null && data.Length != 0)
88 | ProcessPackets(data, pi, ns);
89 | Thread.Sleep(1);
90 | if (pi.timeout.ElapsedMilliseconds > 5000 * 60)
91 | throw new Exception("Client timed out!");
92 | }
93 | //}
94 | //catch (Exception ex)
95 | //{
96 | // LogError("CLNT", ex, "Handler " + pi.userId);
97 | // throw new Exception(ex.StackTrace);
98 | //}
99 | client.Close();
100 | Log("[CLNT] #" + pi.userId + " Client disconnected", System.Drawing.Color.Orange);
101 | BlazeServer.allClients.Remove(pi);
102 | }
103 |
104 | public static void ProcessPackets(byte[] data, PlayerInfo pi, NetworkStream ns)
105 | {
106 | List packets = Blaze.FetchAllBlazePackets(new MemoryStream(data));
107 |
108 | if (Config.MakePacket.ToLower() == "true")
109 | {
110 | Logger.LogPacket("CLNT", Convert.ToInt32(pi.userId), data);
111 | }
112 |
113 | foreach (Blaze.Packet p in packets)
114 | {
115 | Log("[CLNT] #" + pi.userId + " " + Blaze.PacketToDescriber(p),System.Drawing.Color.Gray);
116 |
117 | switch (p.Component)
118 | {
119 | case 0x1:
120 | AuthenticationComponent.HandlePacket(p, pi, ns);
121 | break;
122 | case 0x4:
123 | GameManagerComponent.HandlePacket(p, pi, ns);
124 | break;
125 | case 0x7:
126 | StatsComponent.HandlePacket(p, pi, ns);
127 | break;
128 | case 0x9:
129 | UtilComponent.HandlePacket(p, pi, ns);
130 | break;
131 | case 0x19:
132 | AssociationListsComponent.HandlePacket(p, pi, ns);
133 | break;
134 | case 0x23:
135 | AccountsComponent.HandlePacket(p, pi, ns);
136 | break;
137 | case 0x801:
138 | RSPComponent.HandlePacket(p, pi, ns);
139 | break;
140 | case 0x803:
141 | InventoryComponent.HandlePacket(p, pi, ns);
142 | break;
143 | case 0x7802:
144 | UserSessionsComponent.HandlePacket(p, pi, ns);
145 | break;
146 | default:
147 | Log("[CLNT] #" + pi.userId + " Component: " + p.Component + " not found.", System.Drawing.Color.Red);
148 | break;
149 | }
150 | }
151 | }
152 |
153 | public static void SetExit(bool state)
154 | {
155 | lock (_sync)
156 | {
157 | _exit = state;
158 | }
159 | }
160 |
161 | public static bool GetExit()
162 | {
163 | bool result;
164 | lock (_sync)
165 | {
166 | result = _exit;
167 | }
168 | return result;
169 | }
170 |
171 | public static void Log(string s, object color = null)
172 | {
173 | if (box == null) return;
174 | try
175 | {
176 | box.Invoke(new Action(delegate
177 | {
178 | string stamp = DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToLongTimeString() + " : ";
179 | Color c;
180 | if (color != null)
181 | c = (Color)color;
182 | else
183 | c = Color.Black;
184 | box.SelectionStart = box.TextLength;
185 | box.SelectionLength = 0;
186 | box.SelectionColor = c;
187 | box.AppendText(stamp + s + "\n");
188 | BackendLog.Write(stamp + s + "\n");
189 | box.SelectionColor = box.ForeColor;
190 | box.ScrollToCaret();
191 | }));
192 | }
193 | catch { }
194 | }
195 |
196 | public static void LogError(string who, Exception e, string cName = "")
197 | {
198 | string result = "";
199 | if (who != "") result = "[" + who + "] " + cName + " ERROR: ";
200 | result += e.Message;
201 | if (e.InnerException != null)
202 | result += " - " + e.InnerException.Message;
203 | Log(result);
204 | }
205 | }
206 | }
207 |
--------------------------------------------------------------------------------
/CNCEmu/CNCEmu.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {1AA2DF60-D199-4C55-BBDD-0549E99C8949}
8 | WinExe
9 | CNCEmu
10 | CNCEmu
11 | v4.6.1
12 | 512
13 | true
14 | true
15 |
16 |
17 | AnyCPU
18 | true
19 | full
20 | false
21 | bin\Debug\
22 | DEBUG;TRACE
23 | prompt
24 | 4
25 |
26 |
27 | AnyCPU
28 | pdbonly
29 | true
30 | bin\Release\
31 | TRACE
32 | prompt
33 | 4
34 |
35 |
36 | blaze.ico
37 |
38 |
39 | true
40 | true
41 | false
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 | Form
92 |
93 |
94 | Form1.cs
95 |
96 |
97 | Form
98 |
99 |
100 | Form2.cs
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 | True
111 | True
112 | AssemblyInfo.tt
113 |
114 |
115 |
116 |
117 |
118 | Form1.cs
119 | Designer
120 |
121 |
122 | Form2.cs
123 |
124 |
125 | ResXFileCodeGenerator
126 | Resources.Designer.cs
127 | Designer
128 |
129 |
130 | True
131 | Resources.resx
132 | True
133 |
134 |
135 | SettingsSingleFileGenerator
136 | Settings.Designer.cs
137 |
138 |
139 | True
140 | Settings.settings
141 | True
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 | {7ce2bf11-c78d-49ab-a37a-538d2d0e0418}
150 | BlazeLibWV
151 |
152 |
153 |
154 |
155 | TextTemplatingFileGenerator
156 | AssemblyInfo.cs
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
--------------------------------------------------------------------------------
/CNCEmu/CleanPackets.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 |
8 | namespace CNCEmu
9 | {
10 | public static class CleanPackets
11 | {
12 | public static void Clean()
13 | {
14 | if (Directory.Exists("logs\\packets"))
15 | Directory.Delete("logs\\packets",true);
16 | if (Directory.Exists("logs"))
17 | Directory.Delete("logs",true);
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/CNCEmu/Commands/NotifyClientGameSetupCommand.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using BlazeLibWV;
7 | using System.Net.Sockets;
8 |
9 |
10 | namespace CNCEmu
11 | {
12 | class NotifyClientGameSetupCommand
13 | {
14 | public static List NotifyClientGameSetup(PlayerInfo pi, PlayerInfo srv)
15 | {
16 | long reas = 1;
17 | List Result = new List();
18 | List GAME = new List();
19 | GAME.Add(Blaze.TdfList.Create("ADMN", 0, 1, new List(new long[] { srv.userId })));
20 | if (srv.game.ATTR != null)
21 | GAME.Add(srv.game.ATTR);
22 | GAME.Add(Blaze.TdfList.Create("CAP\0", 0, 2, new List(new long[] { 0x20, 0 })));
23 | GAME.Add(Blaze.TdfInteger.Create("GID\0", srv.game.id));
24 | GAME.Add(Blaze.TdfString.Create("GNAM", srv.game.GNAM));
25 | GAME.Add(Blaze.TdfInteger.Create("GPVH", 666));
26 | GAME.Add(Blaze.TdfInteger.Create("GSET", srv.game.GSET));
27 | GAME.Add(Blaze.TdfInteger.Create("GSID", 1));
28 | GAME.Add(Blaze.TdfInteger.Create("GSTA", srv.game.GSTA));
29 | GAME.Add(Blaze.TdfString.Create("GTYP", ""));
30 | GAME.Add(BlazeHelper.CreateNETField(srv, "HNET"));
31 | GAME.Add(Blaze.TdfInteger.Create("HSES", 13666));
32 | GAME.Add(Blaze.TdfInteger.Create("IGNO", 0));
33 | GAME.Add(Blaze.TdfInteger.Create("MCAP", 0x20));
34 | GAME.Add(BlazeHelper.CreateNQOSField(srv, "NQOS"));
35 | GAME.Add(Blaze.TdfInteger.Create("NRES", 0));
36 | GAME.Add(Blaze.TdfInteger.Create("NTOP", 1));
37 | GAME.Add(Blaze.TdfString.Create("PGID", ""));
38 | List PHST = new List();
39 | PHST.Add(Blaze.TdfInteger.Create("HPID", srv.userId));
40 | PHST.Add(Blaze.TdfInteger.Create("HSLT", srv.slot));
41 | GAME.Add(Blaze.TdfStruct.Create("PHST", PHST));
42 | GAME.Add(Blaze.TdfInteger.Create("PRES", 1));
43 | GAME.Add(Blaze.TdfString.Create("PSAS", "wv"));
44 | GAME.Add(Blaze.TdfInteger.Create("QCAP", 0x10));
45 | GAME.Add(Blaze.TdfInteger.Create("SEED", 0x2CF2048F));
46 | GAME.Add(Blaze.TdfInteger.Create("TCAP", 0x10));
47 | List THST = new List();
48 | THST.Add(Blaze.TdfInteger.Create("HPID", srv.userId));
49 | THST.Add(Blaze.TdfInteger.Create("HSLT", srv.slot));
50 | GAME.Add(Blaze.TdfStruct.Create("THST", THST));
51 | List playerIdList = new List();
52 | for (int i = 0; i < 32; i++)
53 | if (srv.game.slotUse[i] != -1)
54 | playerIdList.Add(srv.game.slotUse[i]);
55 | GAME.Add(Blaze.TdfList.Create("TIDS", 0, 2, playerIdList));
56 | GAME.Add(Blaze.TdfString.Create("UUID", "f5193367-c991-4429-aee4-8d5f3adab938"));
57 | GAME.Add(Blaze.TdfInteger.Create("VOIP", srv.game.VOIP));
58 | GAME.Add(Blaze.TdfString.Create("VSTR", srv.game.VSTR));
59 | Result.Add(Blaze.TdfStruct.Create("GAME", GAME));
60 | List PROS = new List();
61 | for (int i = 0; i < 32; i++)
62 | if (srv.game.players[i] != null)
63 | PROS.Add(BlazeHelper.MakePROSEntry(i, srv.game.players[i]));
64 | Result.Add(Blaze.TdfList.Create("PROS", 3, PROS.Count, PROS));
65 | List VALU = new List();
66 | VALU.Add(Blaze.TdfInteger.Create("DCTX", reas));
67 | Result.Add(Blaze.TdfUnion.Create("REAS", 0, Blaze.TdfStruct.Create("VALU", VALU)));
68 |
69 | return Result;
70 | }
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/CNCEmu/Commands/NotifyGamePlayerStateChangeCommand.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using BlazeLibWV;
7 | using System.Net.Sockets;
8 |
9 | namespace CNCEmu
10 | {
11 | class NotifyGamePlayerStateChangeCommand
12 | {
13 | public static List NotifyGamePlayerStateChange(PlayerInfo pi, long stat)
14 | {
15 | List Result = new List();
16 | Result.Add(Blaze.TdfInteger.Create("GID\0", pi.game.id));
17 | Result.Add(Blaze.TdfInteger.Create("PID\0", pi.userId));
18 | Result.Add(Blaze.TdfInteger.Create("STAT", stat));
19 | return Result;
20 | }
21 |
22 |
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/CNCEmu/Commands/NotifyGameSettingsChangeCommand.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using BlazeLibWV;
7 | using System.Net.Sockets;
8 |
9 | namespace CNCEmu
10 | {
11 | class NotifyGameSettingsChangeCommand
12 | {
13 | public static List NotifyGameSettingsChange(PlayerInfo pi)
14 | {
15 | List Result = new List();
16 | Result.Add(Blaze.TdfInteger.Create("ATTR", pi.game.GSET));
17 | Result.Add(Blaze.TdfInteger.Create("GID", pi.game.id));
18 | return Result;
19 | }
20 |
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/CNCEmu/Commands/NotifyGameStateChangeCommand.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using BlazeLibWV;
7 | using System.Net.Sockets;
8 |
9 | namespace CNCEmu
10 | {
11 | public static class NotifyGameStateChangeCommand
12 | {
13 | public static List NotifyGameStateChange(PlayerInfo pi)
14 | {
15 | List Result = new List();
16 | Result.Add(Blaze.TdfInteger.Create("GID\0", pi.game.id));
17 | Result.Add(Blaze.TdfInteger.Create("GSTA", pi.game.GSTA));
18 | return Result;
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/CNCEmu/Commands/NotifyPlatformHostInitializedCommand.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using BlazeLibWV;
7 | using System.Net.Sockets;
8 |
9 | namespace CNCEmu
10 | {
11 | public static class NotifyPlatformHostInitializedCommand
12 | {
13 | public static List NotifyPlatformHostInitialized(PlayerInfo pi)
14 | {
15 | List Result = new List();
16 | Result.Add(Blaze.TdfInteger.Create("GID\0", pi.game.id));
17 | Result.Add(Blaze.TdfInteger.Create("PHID", pi.userId));
18 | Result.Add(Blaze.TdfInteger.Create("PHST", 0));
19 | return Result;
20 | }
21 |
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/CNCEmu/Commands/NotifyPlayerJoinCompletedCommand.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using BlazeLibWV;
7 | using System.Net.Sockets;
8 |
9 |
10 | namespace CNCEmu
11 | {
12 | class NotifyPlayerJoinCompletedCommand
13 | {
14 | public static List NotifyPlayerJoinCompleted(PlayerInfo pi)
15 | {
16 | List Result = new List();
17 | Result.Add(Blaze.TdfInteger.Create("GID\0", pi.game.id));
18 | Result.Add(Blaze.TdfInteger.Create("PID\0", pi.userId));
19 | return Result;
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/CNCEmu/Commands/NotifyPlayerJoiningCommand.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using BlazeLibWV;
7 | using System.Net.Sockets;
8 |
9 | namespace CNCEmu
10 | {
11 | class NotifyPlayerJoiningCommand
12 | {
13 | public static List NotifyPlayerJoining(PlayerInfo pi)
14 | {
15 | uint t = Blaze.GetUnixTimeStamp();
16 | List Result = new List();
17 | Result.Add(Blaze.TdfInteger.Create("GID\0", pi.game.id));
18 | List PDAT = new List();
19 | PDAT.Add(Blaze.TdfInteger.Create("EXID", pi.userId));
20 | PDAT.Add(Blaze.TdfInteger.Create("GID\0", pi.game.id));
21 | PDAT.Add(Blaze.TdfInteger.Create("LOC\0", pi.loc));
22 | PDAT.Add(Blaze.TdfString.Create("NAME", pi.profile.name));
23 | PDAT.Add(Blaze.TdfInteger.Create("PID\0", pi.userId));
24 | PDAT.Add(BlazeHelper.CreateNETFieldUnion(pi, "PNET"));
25 | PDAT.Add(Blaze.TdfInteger.Create("SID\0", pi.slot));
26 | PDAT.Add(Blaze.TdfInteger.Create("STAT", pi.stat));
27 | PDAT.Add(Blaze.TdfInteger.Create("TIDX", 0xFFFF));
28 | PDAT.Add(Blaze.TdfInteger.Create("TIME", t));
29 | PDAT.Add(Blaze.TdfInteger.Create("UID\0", pi.userId));
30 | Result.Add(Blaze.TdfStruct.Create("PDAT", PDAT));
31 |
32 | return Result;
33 | }
34 |
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/CNCEmu/Commands/NotifyPlayerRemovedCommand.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using BlazeLibWV;
7 | using System.Net.Sockets;
8 |
9 | namespace CNCEmu
10 | {
11 | class NotifyPlayerRemovedCommand
12 | {
13 | public static List NotifyPlayerRemoved(PlayerInfo pi, long pid, long cntx, long reas)
14 | {
15 | List Result = new List();
16 | Result.Add(Blaze.TdfInteger.Create("CNTX", cntx));
17 | Result.Add(Blaze.TdfInteger.Create("GID\0", pi.game.id));
18 | Result.Add(Blaze.TdfInteger.Create("PID\0", pid));
19 | Result.Add(Blaze.TdfInteger.Create("REAS", reas));
20 | return Result;
21 | }
22 |
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/CNCEmu/Commands/NotifyServerGameSetupCommand.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using BlazeLibWV;
7 | using System.Net.Sockets;
8 |
9 | namespace CNCEmu
10 | {
11 | public static class NotifyServerGameSetupCommand
12 | {
13 | public static List NotifyServerGameSetup(Blaze.Packet p, PlayerInfo pi)
14 | {
15 | List input = Blaze.ReadPacketContent(p);
16 |
17 | uint t = Blaze.GetUnixTimeStamp();
18 | pi.game.GNAM = ((Blaze.TdfString)input[4]).Value;
19 | pi.game.GSET = ((Blaze.TdfInteger)input[5]).Value;
20 | pi.game.VOIP = ((Blaze.TdfInteger)input[22]).Value;
21 | pi.game.VSTR = ((Blaze.TdfString)input[23]).Value;
22 | List result = new List();
23 | List GAME = new List();
24 | GAME.Add(Blaze.TdfList.Create("ADMN", 0, 1, new List(new long[] { pi.userId })));
25 | GAME.Add(Blaze.TdfList.Create("CAP\0", 0, 2, new List(new long[] { 0x20, 0 })));
26 | GAME.Add(Blaze.TdfInteger.Create("GID\0", pi.game.id));
27 | GAME.Add(Blaze.TdfString.Create("GNAM", pi.game.GNAM));
28 | GAME.Add(Blaze.TdfInteger.Create("GPVH", 666));
29 | GAME.Add(Blaze.TdfInteger.Create("GSET", pi.game.GSET));
30 | GAME.Add(Blaze.TdfInteger.Create("GSID", 1));
31 | GAME.Add(Blaze.TdfInteger.Create("GSTA", pi.game.GSTA));
32 | GAME.Add(Blaze.TdfString.Create("GTYP", ""));
33 | GAME.Add(BlazeHelper.CreateNETField(pi, "HNET"));
34 | GAME.Add(Blaze.TdfInteger.Create("HSES", 13666));
35 | GAME.Add(Blaze.TdfInteger.Create("IGNO", 0));
36 | GAME.Add(Blaze.TdfInteger.Create("MCAP", 0x20));
37 | GAME.Add(BlazeHelper.CreateNQOSField(pi, "NQOS"));
38 | GAME.Add(Blaze.TdfInteger.Create("NRES", 0));
39 | GAME.Add(Blaze.TdfInteger.Create("NTOP", 1));
40 | GAME.Add(Blaze.TdfString.Create("PGID", ""));
41 | List PHST = new List();
42 | PHST.Add(Blaze.TdfInteger.Create("HPID", pi.userId));
43 | GAME.Add(Blaze.TdfStruct.Create("PHST", PHST));
44 | GAME.Add(Blaze.TdfInteger.Create("PRES", 1));
45 | GAME.Add(Blaze.TdfString.Create("PSAS", "wv"));
46 | GAME.Add(Blaze.TdfInteger.Create("QCAP", 0x10));
47 | GAME.Add(Blaze.TdfInteger.Create("SEED", 0x2CF2048F));
48 | GAME.Add(Blaze.TdfInteger.Create("TCAP", 0x10));
49 | List THST = new List();
50 | THST.Add(Blaze.TdfInteger.Create("HPID", pi.userId));
51 | GAME.Add(Blaze.TdfStruct.Create("THST", THST));
52 | GAME.Add(Blaze.TdfList.Create("TIDS", 0, 2, new List(new long[] { 1, 2 })));
53 | GAME.Add(Blaze.TdfString.Create("UUID", "f5193367-c991-4429-aee4-8d5f3adab938"));
54 | GAME.Add(Blaze.TdfInteger.Create("VOIP", pi.game.VOIP));
55 | GAME.Add(Blaze.TdfString.Create("VSTR", pi.game.VSTR));
56 | result.Add(Blaze.TdfStruct.Create("GAME", GAME));
57 | List PROS = new List();
58 | List ee0 = new List();
59 | ee0.Add(Blaze.TdfInteger.Create("EXID", pi.userId));
60 | ee0.Add(Blaze.TdfInteger.Create("GID\0", pi.game.id));
61 | ee0.Add(Blaze.TdfInteger.Create("LOC\0", pi.loc));
62 | ee0.Add(Blaze.TdfString.Create("NAME", pi.profile.name));
63 | ee0.Add(Blaze.TdfInteger.Create("PID\0", pi.userId));
64 | ee0.Add(BlazeHelper.CreateNETFieldUnion(pi, "PNET"));
65 | ee0.Add(Blaze.TdfInteger.Create("SID\0", pi.slot));
66 | ee0.Add(Blaze.TdfInteger.Create("SLOT", 0));
67 | ee0.Add(Blaze.TdfInteger.Create("STAT", 2));
68 | ee0.Add(Blaze.TdfInteger.Create("TIDX", 0xFFFF));
69 | ee0.Add(Blaze.TdfInteger.Create("TIME", t));
70 | ee0.Add(Blaze.TdfInteger.Create("UID\0", pi.userId));
71 | PROS.Add(Blaze.TdfStruct.Create("0", ee0));
72 | result.Add(Blaze.TdfList.Create("PROS", 3, 1, PROS));
73 | List VALU = new List();
74 | VALU.Add(Blaze.TdfInteger.Create("DCTX", 0));
75 | result.Add(Blaze.TdfUnion.Create("REAS", 0, Blaze.TdfStruct.Create("VALU", VALU)));
76 |
77 | return result;
78 | }
79 |
80 |
81 | }
82 | }
83 |
--------------------------------------------------------------------------------
/CNCEmu/Commands/NotifyUserAddedCommand.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using BlazeLibWV;
7 | using System.Net.Sockets;
8 |
9 | namespace CNCEmu
10 | {
11 | class NotifyUserAddedCommand
12 | {
13 | public static List NotifyUserAdded(PlayerInfo pi)
14 | {
15 | List Result = new List();
16 | Result.Add(BlazeHelper.CreateUserDataStruct(pi));
17 | Result.Add(BlazeHelper.CreateUserStruct(pi));
18 | return Result;
19 | }
20 |
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/CNCEmu/Commands/NotifyUserRemovedCommand.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using BlazeLibWV;
7 | using System.Net.Sockets;
8 |
9 | namespace CNCEmu
10 | {
11 | class NotifyUserRemovedCommand
12 | {
13 | public static List NotifyUserRemoved(PlayerInfo pi, long pid)
14 | {
15 | List Result = new List();
16 | Result.Add(Blaze.TdfInteger.Create("BUID", pid));
17 | return Result;
18 | }
19 |
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/CNCEmu/Commands/NotifyUserStatusCommand.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using BlazeLibWV;
7 | using System.Net.Sockets;
8 |
9 |
10 | namespace CNCEmu
11 | {
12 | class NotifyUserStatusCommand
13 | {
14 | public static List NotifyUserStatus(PlayerInfo pi)
15 | {
16 | List Result = new List();
17 | Result.Add(Blaze.TdfInteger.Create("FLGS", 3));
18 | Result.Add(Blaze.TdfInteger.Create("ID\0\0", pi.userId));
19 | return Result;
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/CNCEmu/Commands/UserAddedCommand.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using BlazeLibWV;
7 | using System.Net.Sockets;
8 |
9 | namespace CNCEmu
10 | {
11 | public static class UserAddedCommand
12 | {
13 | public static List UserAdded(PlayerInfo pi)
14 | {
15 | List Result = new List();
16 | List DATA = new List();
17 | List USER = new List();
18 | List QDAT = new List();
19 | DATA.Add(Blaze.TdfString.Create("BPS", "ams")); //Best PingSite
20 | DATA.Add(Blaze.TdfString.Create("CTY", "")); //Country
21 | DATA.Add(Blaze.TdfInteger.Create("HWFG", 0)); //Hardware Flags
22 | List t = Helper.ConvertStringList("{354} {376} {241} {177} {206} {37}");
23 | List t2 = new List();
24 | foreach (string v in t)
25 | t2.Add(Convert.ToInt64(v));
26 | DATA.Add(Blaze.TdfList.Create("PSLM", 0, t2.Count, t2)); //PingSite list # in ms
27 | DATA.Add(Blaze.TdfStruct.Create("QDAT", QDAT)); //Quality of Service Data
28 | DATA.Add(Blaze.TdfInteger.Create("UATT", 0)); //UserInfoAttribute
29 | Result.Add(Blaze.TdfStruct.Create("DATA", DATA));
30 |
31 | USER.Add(Blaze.TdfInteger.Create("AID", pi.userId));
32 | USER.Add(Blaze.TdfInteger.Create("ALOC", 1701729619));
33 | USER.Add(Blaze.TdfInteger.Create("ID", pi.userId));
34 | USER.Add(Blaze.TdfString.Create("NAME", pi.profile.name));
35 | USER.Add(Blaze.TdfInteger.Create("ORIG", pi.userId));
36 | USER.Add(Blaze.TdfInteger.Create("PIDI", 0));
37 | Result.Add(Blaze.TdfStruct.Create("USER", USER));
38 |
39 | return Result;
40 | }
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/CNCEmu/Commands/UserAuthenticatedCommand.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using BlazeLibWV;
7 | using System.Net.Sockets;
8 |
9 | namespace CNCEmu
10 | {
11 | public static class UserAuthenticatedCommand
12 | {
13 | public static List UserAuthenticated(PlayerInfo pi)
14 | {
15 | List Result = new List();
16 | Result.Add(Blaze.TdfInteger.Create("ALOC", 1403663841));
17 | Result.Add(Blaze.TdfInteger.Create("BUID", pi.userId));
18 | Result.Add(Blaze.TdfString.Create("DSNM", pi.profile.name));
19 | Result.Add(Blaze.TdfInteger.Create("FRSC", 0));
20 | Result.Add(Blaze.TdfInteger.Create("FRST", 0));
21 | Result.Add(Blaze.TdfString.Create("KEY", "SESSKY"));
22 | Result.Add(Blaze.TdfInteger.Create("LAST", 1403663841));
23 | Result.Add(Blaze.TdfInteger.Create("LLOG", 1403663841));
24 | Result.Add(Blaze.TdfString.Create("MAIL", "cnc.server.pc@ea.com"));
25 | Result.Add(Blaze.TdfInteger.Create("PID", pi.userId));
26 | Result.Add(Blaze.TdfInteger.Create("PLAT", 4));
27 | Result.Add(Blaze.TdfInteger.Create("UID", pi.userId));
28 | Result.Add(Blaze.TdfInteger.Create("USTP", 0));
29 | Result.Add(Blaze.TdfInteger.Create("XREF", 0));
30 |
31 | return Result;
32 | }
33 |
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/CNCEmu/Commands/UserSessionExtendedDataUpdateNotificationCommand.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using BlazeLibWV;
7 | using System.Net.Sockets;
8 |
9 | namespace CNCEmu
10 | {
11 | class UserSessionExtendedDataUpdateNotificationCommand
12 | {
13 | public static List UserSessionExtendedDataUpdateNotification(PlayerInfo pi)
14 | {
15 | List Result = new List();
16 | Result.Add(BlazeHelper.CreateUserDataStruct(pi));
17 | Result.Add(Blaze.TdfInteger.Create("USID", pi.userId));
18 | return Result;
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/CNCEmu/Commands/UserUpdatedCommand.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using BlazeLibWV;
7 | using System.Net.Sockets;
8 |
9 | namespace CNCEmu
10 | {
11 | public static class UserUpdatedCommand
12 | {
13 | public static List UserUpdated(PlayerInfo pi)
14 | {
15 | List Result = new List();
16 | Result.Add(Blaze.TdfInteger.Create("FLGS", 3));
17 | Result.Add(Blaze.TdfInteger.Create("ID", pi.userId));
18 |
19 | return Result;
20 | }
21 |
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/CNCEmu/Components/AccountsComponent.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using BlazeLibWV;
7 | using System.Net.Sockets;
8 |
9 | namespace CNCEmu
10 | {
11 | public static class AccountsComponent
12 | {
13 | public static void HandlePacket(Blaze.Packet p, PlayerInfo pi, NetworkStream ns)
14 | {
15 | switch (p.Command)
16 | {
17 | case 0x0:
18 | //AuthLogin(p, pi, ns);
19 | break;
20 | default:
21 | Logger.Log("[CLNT] #" + pi.userId + " Component: [" + p.Component + "] # Command: " + p.Command + " [at] " + " [ACCOUNTS] " + " not found.", System.Drawing.Color.Red);
22 | break;
23 | }
24 | }
25 |
26 | public static void AuthLogin(Blaze.Packet p, PlayerInfo pi, NetworkStream ns)
27 | {
28 |
29 | }
30 |
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/CNCEmu/Components/AssociationListsComponent.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using BlazeLibWV;
7 | using System.Net.Sockets;
8 |
9 | namespace CNCEmu
10 | {
11 | public static class AssociationListsComponent
12 | {
13 | public static void HandlePacket(Blaze.Packet p, PlayerInfo pi, NetworkStream ns)
14 | {
15 | switch (p.Command)
16 | {
17 | case 0x00:
18 | break;
19 | default:
20 | Logger.Log("[CLNT] #" + pi.userId + " Component: [" + p.Component + "] # Command: " + p.Command + " [at] " + " [ASSOCIATIONLISTCOMP] " + " not found.", System.Drawing.Color.Red);
21 | break;
22 | }
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/CNCEmu/Components/AsyncNotification/AsyncGameManager.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using BlazeLibWV;
7 | using System.Net.Sockets;
8 |
9 | namespace CNCEmu
10 | {
11 | public static class AsyncGameManager
12 | {
13 | public static void NotifyPlatformHostInitialized(PlayerInfo src, Blaze.Packet p, PlayerInfo pi, NetworkStream ns)
14 | {
15 | List result = new List();
16 | result.Add(Blaze.TdfInteger.Create("GID\0", pi.game.id));
17 | result.Add(Blaze.TdfInteger.Create("PHID", pi.userId));
18 | result.Add(Blaze.TdfInteger.Create("PHST", 0));
19 | byte[] buff = Blaze.CreatePacket(4, 0x47, 0, 0x2000, 0, result);
20 | ns.Write(buff, 0, buff.Length);
21 | ns.Flush();
22 | BlazeServer.Log("[CLNT] #" + src.userId + " [0004:0047] NotifyPlatformHostInitialized");
23 | }
24 |
25 | public static void NotifyGameStateChange(PlayerInfo src, Blaze.Packet p, PlayerInfo pi, NetworkStream ns)
26 | {
27 | List result = new List();
28 | result.Add(Blaze.TdfInteger.Create("GID\0", pi.game.id));
29 | result.Add(Blaze.TdfInteger.Create("GSTA", pi.game.GSTA));
30 | byte[] buff = Blaze.CreatePacket(4, 0x64, 0, 0x2000, 0, result);
31 | ns.Write(buff, 0, buff.Length);
32 | ns.Flush();
33 | BlazeServer.Log("[CLNT] #" + src.userId + " [0004:0064] NotifyGameStateChange");
34 | }
35 |
36 | public static void NotifyServerGameSetup(PlayerInfo src, Blaze.Packet p, PlayerInfo pi, NetworkStream ns)
37 | {
38 | List input = Blaze.ReadPacketContent(p);
39 | uint t = Blaze.GetUnixTimeStamp();
40 | pi.game.GNAM = ((Blaze.TdfString)input[2]).Value;
41 | pi.game.GSET = ((Blaze.TdfInteger)input[3]).Value;
42 | pi.game.VOIP = ((Blaze.TdfInteger)input[21]).Value;
43 | pi.game.VSTR = ((Blaze.TdfString)input[22]).Value;
44 | List result = new List();
45 | List GAME = new List();
46 | GAME.Add(Blaze.TdfList.Create("ADMN", 0, 1, new List(new long[] { pi.userId })));
47 | GAME.Add(Blaze.TdfList.Create("CAP\0", 0, 2, new List(new long[] { 0x20, 0 })));
48 | GAME.Add(Blaze.TdfInteger.Create("GID\0", pi.game.id));
49 | GAME.Add(Blaze.TdfString.Create("GNAM", pi.game.GNAM));
50 | GAME.Add(Blaze.TdfInteger.Create("GPVH", 666));
51 | GAME.Add(Blaze.TdfInteger.Create("GSET", pi.game.GSET));
52 | GAME.Add(Blaze.TdfInteger.Create("GSID", 1));
53 | GAME.Add(Blaze.TdfInteger.Create("GSTA", pi.game.GSTA));
54 | GAME.Add(Blaze.TdfString.Create("GTYP", ""));
55 | GAME.Add(BlazeHelper.CreateNETField(pi, "HNET"));
56 | GAME.Add(Blaze.TdfInteger.Create("HSES", 13666));
57 | GAME.Add(Blaze.TdfInteger.Create("IGNO", 0));
58 | GAME.Add(Blaze.TdfInteger.Create("MCAP", 0x20));
59 | GAME.Add(BlazeHelper.CreateNQOSField(pi, "NQOS"));
60 | GAME.Add(Blaze.TdfInteger.Create("NRES", 0));
61 | GAME.Add(Blaze.TdfInteger.Create("NTOP", 1));
62 | GAME.Add(Blaze.TdfString.Create("PGID", ""));
63 | List PHST = new List();
64 | PHST.Add(Blaze.TdfInteger.Create("HPID", pi.userId));
65 | GAME.Add(Blaze.TdfStruct.Create("PHST", PHST));
66 | GAME.Add(Blaze.TdfInteger.Create("PRES", 1));
67 | GAME.Add(Blaze.TdfString.Create("PSAS", "wv"));
68 | GAME.Add(Blaze.TdfInteger.Create("QCAP", 0x10));
69 | GAME.Add(Blaze.TdfInteger.Create("SEED", 0x2CF2048F));
70 | GAME.Add(Blaze.TdfInteger.Create("TCAP", 0x10));
71 | List THST = new List();
72 | THST.Add(Blaze.TdfInteger.Create("HPID", pi.userId));
73 | GAME.Add(Blaze.TdfStruct.Create("THST", THST));
74 | GAME.Add(Blaze.TdfList.Create("TIDS", 0, 2, new List(new long[] { 1, 2 })));
75 | GAME.Add(Blaze.TdfString.Create("UUID", "f5193367-c991-4429-aee4-8d5f3adab938"));
76 | GAME.Add(Blaze.TdfInteger.Create("VOIP", pi.game.VOIP));
77 | GAME.Add(Blaze.TdfString.Create("VSTR", pi.game.VSTR));
78 | result.Add(Blaze.TdfStruct.Create("GAME", GAME));
79 | List PROS = new List();
80 | List ee0 = new List();
81 | ee0.Add(Blaze.TdfInteger.Create("EXID", pi.userId));
82 | ee0.Add(Blaze.TdfInteger.Create("GID\0", pi.game.id));
83 | ee0.Add(Blaze.TdfInteger.Create("LOC\0", pi.loc));
84 | ee0.Add(Blaze.TdfString.Create("NAME", pi.profile.name));
85 | ee0.Add(Blaze.TdfInteger.Create("PID\0", pi.userId));
86 | ee0.Add(BlazeHelper.CreateNETFieldUnion(pi, "PNET"));
87 | ee0.Add(Blaze.TdfInteger.Create("SID\0", pi.slot));
88 | ee0.Add(Blaze.TdfInteger.Create("SLOT", 0));
89 | ee0.Add(Blaze.TdfInteger.Create("STAT", 2));
90 | ee0.Add(Blaze.TdfInteger.Create("TIDX", 0xFFFF));
91 | ee0.Add(Blaze.TdfInteger.Create("TIME", t));
92 | ee0.Add(Blaze.TdfInteger.Create("UID\0", pi.userId));
93 | PROS.Add(Blaze.TdfStruct.Create("0", ee0));
94 | result.Add(Blaze.TdfList.Create("PROS", 3, 1, PROS));
95 | List VALU = new List();
96 | VALU.Add(Blaze.TdfInteger.Create("DCTX", 0));
97 | result.Add(Blaze.TdfUnion.Create("REAS", 0, Blaze.TdfStruct.Create("VALU", VALU)));
98 | byte[] buff = Blaze.CreatePacket(p.Component, 0x14, 0, 0x2000, 0, result);
99 | ns.Write(buff, 0, buff.Length);
100 | ns.Flush();
101 | BlazeServer.Log("[CLNT] #" + src.userId + " [0004:0014] NotifyServerGameSetup");
102 | }
103 |
104 | public static void NotifyGameSettingsChange(PlayerInfo src, Blaze.Packet p, PlayerInfo pi, NetworkStream ns)
105 | {
106 | List result = new List();
107 | result.Add(Blaze.TdfInteger.Create("ATTR", pi.game.GSET));
108 | result.Add(Blaze.TdfInteger.Create("GID", pi.game.id));
109 | byte[] buff = Blaze.CreatePacket(p.Component, 0x6E, 0, 0x2000, 0, result);
110 | ns.Write(buff, 0, buff.Length);
111 | ns.Flush();
112 | BlazeServer.Log("[CLNT] #" + src.userId + " [0004:006E] NotifyGameSettingsChange");
113 | }
114 |
115 | public static void NotifyClientGameSetup(PlayerInfo src, Blaze.Packet p, PlayerInfo pi, PlayerInfo srv, NetworkStream ns, long reas = 1)
116 | {
117 | List result = new List();
118 | List GAME = new List();
119 | GAME.Add(Blaze.TdfList.Create("ADMN", 0, 1, new List(new long[] { srv.userId })));
120 | if (srv.game.ATTR != null)
121 | GAME.Add(srv.game.ATTR);
122 | GAME.Add(Blaze.TdfList.Create("CAP\0", 0, 2, new List(new long[] { 0x20, 0 })));
123 | GAME.Add(Blaze.TdfInteger.Create("GID\0", srv.game.id));
124 | GAME.Add(Blaze.TdfString.Create("GNAM", srv.game.GNAM));
125 | GAME.Add(Blaze.TdfInteger.Create("GPVH", 666));
126 | GAME.Add(Blaze.TdfInteger.Create("GSET", srv.game.GSET));
127 | GAME.Add(Blaze.TdfInteger.Create("GSID", 1));
128 | GAME.Add(Blaze.TdfInteger.Create("GSTA", srv.game.GSTA));
129 | GAME.Add(Blaze.TdfString.Create("GTYP", ""));
130 | GAME.Add(BlazeHelper.CreateNETField(srv, "HNET"));
131 | GAME.Add(Blaze.TdfInteger.Create("HSES", 13666));
132 | GAME.Add(Blaze.TdfInteger.Create("IGNO", 0));
133 | GAME.Add(Blaze.TdfInteger.Create("MCAP", 0x20));
134 | GAME.Add(BlazeHelper.CreateNQOSField(srv, "NQOS"));
135 | GAME.Add(Blaze.TdfInteger.Create("NRES", 0));
136 | GAME.Add(Blaze.TdfInteger.Create("NTOP", 1));
137 | GAME.Add(Blaze.TdfString.Create("PGID", ""));
138 | List PHST = new List();
139 | PHST.Add(Blaze.TdfInteger.Create("HPID", srv.userId));
140 | PHST.Add(Blaze.TdfInteger.Create("HSLT", srv.slot));
141 | GAME.Add(Blaze.TdfStruct.Create("PHST", PHST));
142 | GAME.Add(Blaze.TdfInteger.Create("PRES", 1));
143 | GAME.Add(Blaze.TdfString.Create("PSAS", "wv"));
144 | GAME.Add(Blaze.TdfInteger.Create("QCAP", 0x10));
145 | GAME.Add(Blaze.TdfInteger.Create("SEED", 0x2CF2048F));
146 | GAME.Add(Blaze.TdfInteger.Create("TCAP", 0x10));
147 | List THST = new List();
148 | THST.Add(Blaze.TdfInteger.Create("HPID", srv.userId));
149 | THST.Add(Blaze.TdfInteger.Create("HSLT", srv.slot));
150 | GAME.Add(Blaze.TdfStruct.Create("THST", THST));
151 | List playerIdList = new List();
152 | for (int i = 0; i < 32; i++)
153 | if (srv.game.slotUse[i] != -1)
154 | playerIdList.Add(srv.game.slotUse[i]);
155 | GAME.Add(Blaze.TdfList.Create("TIDS", 0, 2, playerIdList));
156 | GAME.Add(Blaze.TdfString.Create("UUID", "f5193367-c991-4429-aee4-8d5f3adab938"));
157 | GAME.Add(Blaze.TdfInteger.Create("VOIP", srv.game.VOIP));
158 | GAME.Add(Blaze.TdfString.Create("VSTR", srv.game.VSTR));
159 | result.Add(Blaze.TdfStruct.Create("GAME", GAME));
160 | List PROS = new List();
161 | for (int i = 0; i < 32; i++)
162 | if (srv.game.players[i] != null)
163 | PROS.Add(BlazeHelper.MakePROSEntry(i, srv.game.players[i]));
164 | result.Add(Blaze.TdfList.Create("PROS", 3, PROS.Count, PROS));
165 | List VALU = new List();
166 | VALU.Add(Blaze.TdfInteger.Create("DCTX", reas));
167 | result.Add(Blaze.TdfUnion.Create("REAS", 0, Blaze.TdfStruct.Create("VALU", VALU)));
168 | byte[] buff = Blaze.CreatePacket(0x4, 0x14, 0, 0x2000, 0, result);
169 | ns.Write(buff, 0, buff.Length);
170 | ns.Flush();
171 | BlazeServer.Log("[CLNT] #" + src.userId + " [0004:0014] NotifyClientGameSetup");
172 | }
173 |
174 | public static void NotifyPlayerJoining(PlayerInfo src, Blaze.Packet p, PlayerInfo pi, NetworkStream ns)
175 | {
176 | uint t = Blaze.GetUnixTimeStamp();
177 | List result = new List();
178 | result.Add(Blaze.TdfInteger.Create("GID\0", pi.game.id));
179 | List PDAT = new List();
180 | PDAT.Add(Blaze.TdfInteger.Create("EXID", pi.userId));
181 | PDAT.Add(Blaze.TdfInteger.Create("GID\0", pi.game.id));
182 | PDAT.Add(Blaze.TdfInteger.Create("LOC\0", pi.loc));
183 | PDAT.Add(Blaze.TdfString.Create("NAME", pi.profile.name));
184 | PDAT.Add(Blaze.TdfInteger.Create("PID\0", pi.userId));
185 | PDAT.Add(BlazeHelper.CreateNETFieldUnion(pi, "PNET"));
186 | PDAT.Add(Blaze.TdfInteger.Create("SID\0", pi.slot));
187 | PDAT.Add(Blaze.TdfInteger.Create("STAT", pi.stat));
188 | PDAT.Add(Blaze.TdfInteger.Create("TIDX", 0xFFFF));
189 | PDAT.Add(Blaze.TdfInteger.Create("TIME", t));
190 | PDAT.Add(Blaze.TdfInteger.Create("UID\0", pi.userId));
191 | result.Add(Blaze.TdfStruct.Create("PDAT", PDAT));
192 | byte[] buff = Blaze.CreatePacket(0x4, 0x15, 0, 0x2000, 0, result);
193 | ns.Write(buff, 0, buff.Length);
194 | ns.Flush();
195 | BlazeServer.Log("[CLNT] #" + src.userId + " [0004:0015] NotifyPlayerJoining");
196 | }
197 |
198 | public static void NotifyGamePlayerStateChange(PlayerInfo src, Blaze.Packet p, PlayerInfo pi, NetworkStream ns, long stat)
199 | {
200 | List result = new List();
201 | result.Add(Blaze.TdfInteger.Create("GID\0", pi.game.id));
202 | result.Add(Blaze.TdfInteger.Create("PID\0", pi.userId));
203 | result.Add(Blaze.TdfInteger.Create("STAT", stat));
204 | byte[] buff = Blaze.CreatePacket(0x4, 0x74, 0, 0x2000, 0, result);
205 | ns.Write(buff, 0, buff.Length);
206 | ns.Flush();
207 | BlazeServer.Log("[CLNT] #" + src.userId + " [0004:0074] NotifyGamePlayerStateChange");
208 | }
209 |
210 | public static void NotifyPlayerJoinCompleted(PlayerInfo src, Blaze.Packet p, PlayerInfo pi, NetworkStream ns)
211 | {
212 | List result = new List();
213 | result.Add(Blaze.TdfInteger.Create("GID\0", pi.game.id));
214 | result.Add(Blaze.TdfInteger.Create("PID\0", pi.userId));
215 | byte[] buff = Blaze.CreatePacket(0x4, 0x1E, 0, 0x2000, 0, result);
216 | ns.Write(buff, 0, buff.Length);
217 | ns.Flush();
218 | BlazeServer.Log("[CLNT] #" + src.userId + " [0004:001E] NotifyPlayerJoinCompleted");
219 | }
220 |
221 | public static void NotifyPlayerRemoved(PlayerInfo src, Blaze.Packet p, PlayerInfo pi, NetworkStream ns, long pid, long cntx, long reas)
222 | {
223 | List result = new List();
224 | result.Add(Blaze.TdfInteger.Create("CNTX", cntx));
225 | result.Add(Blaze.TdfInteger.Create("GID\0", pi.game.id));
226 | result.Add(Blaze.TdfInteger.Create("PID\0", pid));
227 | result.Add(Blaze.TdfInteger.Create("REAS", reas));
228 | byte[] buff = Blaze.CreatePacket(4, 0x28, 0, 0x2000, 0, result);
229 | ns.Write(buff, 0, buff.Length);
230 | ns.Flush();
231 | BlazeServer.Log("[CLNT] #" + src.userId + " [0004:001E] NotifyPlayerRemoved");
232 | }
233 |
234 | }
235 | }
236 |
--------------------------------------------------------------------------------
/CNCEmu/Components/AsyncNotification/AsyncStats.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using BlazeLibWV;
7 | using System.Net.Sockets;
8 |
9 | namespace CNCEmu
10 | {
11 | public static class AsyncStats
12 | {
13 | public static void GetStatsAsyncNotification(Blaze.Packet p, PlayerInfo pi, NetworkStream ns)
14 | {
15 | List input = Blaze.ReadPacketContent(p);
16 | string statSpace = ((Blaze.TdfString)input[2]).Value;
17 | long vid = ((Blaze.TdfInteger)input[7]).Value;
18 | long eid = ((List)((Blaze.TdfList)input[1]).List)[0];
19 | List Result = new List();
20 | Result.Add(Blaze.TdfString.Create("GRNM", statSpace));
21 | Result.Add(Blaze.TdfString.Create("KEY\0", "No_Scope_Defined"));
22 | Result.Add(Blaze.TdfInteger.Create("LAST", 1));
23 | List STS = new List();
24 | List STAT = new List();
25 | List e0 = new List();
26 | e0.Add(Blaze.TdfInteger.Create("EID\0", eid));
27 | e0.Add(Blaze.TdfDoubleVal.Create("ETYP", new Blaze.DoubleVal(30722, 1)));
28 | e0.Add(Blaze.TdfInteger.Create("POFF", 0));
29 | List values = new List();
30 | //if (statSpace == "crit")
31 | // values.AddRange(new string[] { pi.profile.level.ToString(),
32 | // pi.profile.xp.ToString(),
33 | // "10000" });
34 | //else
35 | // values.AddRange(new string[] { pi.profile.kit.ToString(),
36 | // pi.profile.head.ToString(),
37 | // pi.profile.face.ToString(),
38 | // pi.profile.shirt.ToString()});
39 | e0.Add(Blaze.TdfList.Create("STAT", 1, values.Count, values));
40 | STAT.Add(Blaze.TdfStruct.Create("0", e0));
41 | STS.Add(Blaze.TdfList.Create("STAT", 3, STAT.Count, STAT));
42 | Result.Add(Blaze.TdfStruct.Create("STS\0", STS));
43 | Result.Add(Blaze.TdfInteger.Create("VID\0", vid));
44 | byte[] buff = Blaze.CreatePacket(7, 0x32, 0, 0x2000, 0, Result);
45 | ns.Write(buff, 0, buff.Length);
46 | ns.Flush();
47 | BlazeServer.Log("[CLNT] #" + pi.userId + " [0007:0032] GetStatsAsyncNotification");
48 | }
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/CNCEmu/Components/AsyncNotification/AsyncUserSessions.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using BlazeLibWV;
7 | using System.Net.Sockets;
8 |
9 | namespace CNCEmu
10 | {
11 | public static class AsyncUserSessions
12 | {
13 | public static void UserSessionExtendedDataUpdateNotification(PlayerInfo src, Blaze.Packet p, PlayerInfo pi, NetworkStream ns)
14 | {
15 | List Result = new List();
16 | Result.Add(BlazeHelper.CreateUserDataStruct(pi));
17 | Result.Add(Blaze.TdfInteger.Create("USID", pi.userId));
18 | byte[] buff = Blaze.CreatePacket(0x7802, 1, 0, 0x2000, 0, Result);
19 | ns.Write(buff, 0, buff.Length);
20 | ns.Flush();
21 | BlazeServer.Log("[CLNT] #" + src.userId + " [7802:0001] UserSessionExtendedDataUpdateNotification");
22 | }
23 |
24 | public static void NotifyUserAdded(PlayerInfo src, Blaze.Packet p, PlayerInfo pi, NetworkStream ns)
25 | {
26 | List result = new List();
27 | result.Add(BlazeHelper.CreateUserDataStruct(pi));
28 | result.Add(BlazeHelper.CreateUserStruct(pi));
29 | byte[] buff = Blaze.CreatePacket(0x7802, 0x2, 0, 0x2000, 0, result);
30 | ns.Write(buff, 0, buff.Length);
31 | ns.Flush();
32 | BlazeServer.Log("[CLNT] #" + src.userId + " [7802:0001] NotifyUserAdded");
33 | }
34 |
35 | public static void NotifyUserRemoved(PlayerInfo src, Blaze.Packet p, long pid, NetworkStream ns)
36 | {
37 | List result = new List();
38 | result.Add(Blaze.TdfInteger.Create("BUID", pid));
39 | byte[] buff = Blaze.CreatePacket(0x7802, 0x3, 0, 0x2000, 0, result);
40 | ns.Write(buff, 0, buff.Length);
41 | ns.Flush();
42 | BlazeServer.Log("[CLNT] #" + src.userId + " [7802:0001] NotifyUserRemoved");
43 | }
44 |
45 | public static void NotifyUserStatus(PlayerInfo src, Blaze.Packet p, PlayerInfo pi, NetworkStream ns)
46 | {
47 | List result = new List();
48 | result.Add(Blaze.TdfInteger.Create("FLGS", 3));
49 | result.Add(Blaze.TdfInteger.Create("ID\0\0", pi.userId));
50 | byte[] buff = Blaze.CreatePacket(0x7802, 0x5, 0, 0x2000, 0, result);
51 | ns.Write(buff, 0, buff.Length);
52 | ns.Flush();
53 | BlazeServer.Log("[CLNT] #" + src.userId + " [7802:0001] NotifyUserStatus");
54 | }
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/CNCEmu/Components/AuthenticationComponent.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using BlazeLibWV;
7 | using static BlazeLibWV.Blaze;
8 | using System.Net.Sockets;
9 |
10 | namespace CNCEmu
11 | {
12 | public static class AuthenticationComponent
13 | {
14 | public static void HandlePacket(Blaze.Packet p, PlayerInfo pi, NetworkStream ns)
15 | {
16 | switch (p.Command)
17 | {
18 | case 0x00:
19 | break;
20 | case 0x3C:
21 | ExpressLogin(p, pi, ns);
22 | break;
23 | case 0x28:
24 | Login(p, pi, ns);
25 | break;
26 | case 0x64:
27 | ListPersonas(p, pi, ns);
28 | break;
29 | case 0x6E:
30 | LoginPersona(p, pi, ns);
31 | break;
32 | case 0x78:
33 | LogoutPersona(p, pi, ns);
34 | break;
35 | case 0x46:
36 | logout(p, pi, ns);
37 | break;
38 | default:
39 | Logger.Log("[CLNT] #" + pi.userId + " Component: [" + p.Component + "] # Command: " + p.Command + " [at] " + " [AUTHENTICATIONCOMP] " + " not found.", System.Drawing.Color.Red);
40 | break;
41 | }
42 | }
43 |
44 | public static void ExpressLogin(Blaze.Packet p, PlayerInfo pi, NetworkStream ns)
45 | {
46 | uint t = GetUnixTimeStamp();
47 |
48 | List Result = new List
49 | {
50 | TdfInteger.Create("AGUP", 0), // Can Age Up
51 | TdfInteger.Create("ANON", 0), // Is Anonymous
52 | TdfInteger.Create("NTOS", 0), // Needs Legal Docs (TOS)
53 | TdfString.Create("PCTK", "PlayerTicket_1337") // PCLogin Token
54 | };
55 |
56 | List SESS = new List();
57 |
58 | SESS.Add(Blaze.TdfInteger.Create("BUID", pi.userId)); //BlazeUserID
59 | SESS.Add(Blaze.TdfString.Create("KEY", "SessionKey_1337"));
60 | SESS.Add(Blaze.TdfString.Create("MAIL", "cnc-2013-pc@ea.com"));
61 | SESS.Add(Blaze.TdfInteger.Create("UID\0", pi.userId));
62 | SESS.Add(Blaze.TdfInteger.Create("FRSC", 0));
63 | SESS.Add(Blaze.TdfInteger.Create("FRST", 0));
64 | SESS.Add(Blaze.TdfInteger.Create("LLOG", 1403663841));
65 |
66 | Result.Add(Blaze.TdfStruct.Create("SESS", SESS));
67 |
68 | List PDTL = new List();
69 | PDTL.Add(Blaze.TdfString.Create("DSNM", pi.profile.name));
70 | PDTL.Add(Blaze.TdfInteger.Create("LAST", t));
71 | PDTL.Add(Blaze.TdfInteger.Create("PID\0", pi.userId));
72 | PDTL.Add(Blaze.TdfInteger.Create("PLAT", 4)); //#1 XBL2 #2 PS3 #3 WII #4 PC
73 | PDTL.Add(Blaze.TdfInteger.Create("STAS", 2));
74 | PDTL.Add(Blaze.TdfInteger.Create("XREF", 0));
75 | Result.Add(Blaze.TdfStruct.Create("PDTL", PDTL));
76 | Result.Add(Blaze.TdfInteger.Create("SPAM", 0));
77 | Result.Add(Blaze.TdfInteger.Create("UNDR", 0));
78 |
79 | byte[] buff = Blaze.CreatePacket(p.Component, p.Command, 0, 0x1000, p.ID, Result);
80 | Logger.LogPacket("ExpressLog", Convert.ToInt32(pi.userId), buff); //TestLog
81 | ns.Write(buff, 0, buff.Length);
82 |
83 | // Send UserAuthenticated Packet
84 | List Result2 = UserAuthenticatedCommand.UserAuthenticated(pi);
85 | byte[] buff2 = Blaze.CreatePacket(0x7802, 8, 0, 0x2000, p.ID, Result2);
86 | Logger.LogPacket("UserAuthenticated", Convert.ToInt32(pi.userId), buff2); //TestLog
87 | ns.Write(buff2, 0, buff2.Length);
88 |
89 | //Send UserUpdated Packet
90 | List Result3 = UserUpdatedCommand.UserUpdated(pi);
91 | byte[] buff3 = Blaze.CreatePacket(0x7802, 5, 0, 0x2000, p.ID, Result3);
92 | Logger.LogPacket("UserUpdated", Convert.ToInt32(pi.userId), buff3); //TestLog
93 | ns.Write(buff3, 0, buff3.Length);
94 |
95 | //Send UserAdded Packet
96 | List Result4 = UserAddedCommand.UserAdded(pi);
97 | byte[] buff4 = Blaze.CreatePacket(0x7802, 2, 0, 0x2000, p.ID, Result4);
98 | Logger.LogPacket("UserAdded", Convert.ToInt32(pi.userId), buff4); //TestLog
99 | ns.Write(buff4, 0, buff4.Length);
100 |
101 | ns.Flush();
102 | }
103 |
104 | public static void Login(Blaze.Packet p, PlayerInfo pi, NetworkStream ns)
105 | {
106 | if (!pi.isServer)
107 | {
108 | List input = Blaze.ReadPacketContent(p);
109 | Blaze.TdfString MAIL = (Blaze.TdfString)input[0];
110 | string mail = MAIL.Value;
111 | long id = 0;
112 |
113 | foreach (Profile profile in Profiles.profiles)
114 | if (profile.mail == mail)
115 | {
116 | pi.profile = profile;
117 | id = profile.id;
118 | break;
119 | }
120 | if (pi.profile == null)
121 | {
122 | BlazeServer.Log("[CLNT] #" + pi.userId + " Could not find player profile for mail: " + mail + " !", System.Drawing.Color.Red);
123 | pi.userId = 0;
124 | return;
125 | }
126 | else
127 | {
128 | for (int i = 0; i < BlazeServer.allClients.Count; i++)
129 | if (BlazeServer.allClients[i].userId == id)
130 | {
131 | BlazeServer.allClients.RemoveAt(i);
132 | i--;
133 | }
134 | pi.userId = id;
135 | BlazeServer.Log("[CLNT] New ID #" + pi.userId + " Client Playername = \"" + pi.profile.name + "\"", System.Drawing.Color.Blue);
136 | }
137 | }
138 |
139 |
140 | List Result = new List();
141 | //List List = new List();
142 |
143 | Result.Add(Blaze.TdfInteger.Create("ANON", 0));
144 | Result.Add(Blaze.TdfInteger.Create("NTOS", 0));
145 | Result.Add(Blaze.TdfString.Create("PCTK", ""));
146 |
147 | List playerentries = new List();
148 | List PlayerEntry = new List();
149 | PlayerEntry.Add(Blaze.TdfString.Create("DSNM", pi.profile.name));
150 | PlayerEntry.Add(Blaze.TdfInteger.Create("LAST", 0));
151 | PlayerEntry.Add(Blaze.TdfInteger.Create("PID\0", pi.userId));
152 | PlayerEntry.Add(Blaze.TdfInteger.Create("STAS", 2));
153 | PlayerEntry.Add(Blaze.TdfInteger.Create("XREF", 0));
154 | PlayerEntry.Add(Blaze.TdfInteger.Create("XTYP", 0));
155 | playerentries.Add(Blaze.TdfStruct.Create("0", PlayerEntry));
156 | Result.Add(Blaze.TdfList.Create("PLST", 3, 1, playerentries));
157 |
158 | Result.Add(Blaze.TdfString.Create("SKEY", "123456"));
159 | Result.Add(Blaze.TdfInteger.Create("SPAM", 0));
160 | Result.Add(Blaze.TdfInteger.Create("UID\0", pi.userId));
161 | Result.Add(Blaze.TdfInteger.Create("UNDR", 0));
162 |
163 | byte[] buff = Blaze.CreatePacket(p.Component, p.Command, 0, 0x1000, p.ID, Result);
164 | Logger.LogPacket("Log", Convert.ToInt32(pi.userId), buff); //TestLog
165 |
166 | ns.Write(buff, 0, buff.Length);
167 | ns.Flush();
168 | }
169 |
170 | public static void LoginPersona(Blaze.Packet p, PlayerInfo pi, NetworkStream ns)
171 | {
172 | uint t = Blaze.GetUnixTimeStamp();
173 | List SESS = new List();
174 | SESS.Add(Blaze.TdfInteger.Create("BUID", pi.userId));
175 | SESS.Add(Blaze.TdfInteger.Create("FRST", 0));
176 | SESS.Add(Blaze.TdfString.Create("KEY\0", "some_client_key"));
177 | SESS.Add(Blaze.TdfInteger.Create("LLOG", t));
178 | SESS.Add(Blaze.TdfString.Create("MAIL", ""));
179 | List PDTL = new List();
180 | PDTL.Add(Blaze.TdfString.Create("DSNM", pi.profile.name));
181 | PDTL.Add(Blaze.TdfInteger.Create("LAST", t));
182 | PDTL.Add(Blaze.TdfInteger.Create("PID\0", pi.userId));
183 | PDTL.Add(Blaze.TdfInteger.Create("STAS", 0));
184 | PDTL.Add(Blaze.TdfInteger.Create("XREF", 0));
185 | PDTL.Add(Blaze.TdfInteger.Create("XTYP", 0));
186 | SESS.Add(Blaze.TdfStruct.Create("PDTL", PDTL));
187 | SESS.Add(Blaze.TdfInteger.Create("UID\0", pi.userId));
188 | byte[] buff = Blaze.CreatePacket(p.Component, p.Command, 0, 0x1000, p.ID, SESS);
189 | ns.Write(buff, 0, buff.Length);
190 | ns.Flush();
191 |
192 | AsyncUserSessions.NotifyUserAdded(pi, p, pi, ns);
193 | AsyncUserSessions.NotifyUserStatus(pi, p, pi, ns);
194 |
195 | // Send UserAuthenticated Packet
196 | List Result2 = UserAuthenticatedCommand.UserAuthenticated(pi);
197 | byte[] buff2 = Blaze.CreatePacket(0x7802, 8, 0, 0x2000, p.ID, Result2);
198 | Logger.LogPacket("UserAuthenticated", Convert.ToInt32(pi.userId), buff2); //TestLog
199 | ns.Write(buff2, 0, buff2.Length);
200 |
201 | //Send UserUpdated Packet
202 | List Result3 = UserUpdatedCommand.UserUpdated(pi);
203 | byte[] buff3 = Blaze.CreatePacket(0x7802, 5, 0, 0x2000, p.ID, Result3);
204 | Logger.LogPacket("UserUpdated", Convert.ToInt32(pi.userId), buff3); //TestLog
205 | ns.Write(buff3, 0, buff3.Length);
206 |
207 | //Send UserAdded Packet
208 | List Result4 = UserAddedCommand.UserAdded(pi);
209 | byte[] buff4 = Blaze.CreatePacket(0x7802, 2, 0, 0x2000, p.ID, Result4);
210 | Logger.LogPacket("UserAdded", Convert.ToInt32(pi.userId), buff4); //TestLog
211 | ns.Write(buff4, 0, buff4.Length);
212 | }
213 |
214 | public static void LogoutPersona(Blaze.Packet p, PlayerInfo pi, NetworkStream ns)
215 | {
216 | List result = new List();
217 | byte[] buff = Blaze.CreatePacket(p.Component, p.Command, 0, 0x1000, p.ID, result);
218 | ns.Write(buff, 0, buff.Length);
219 | ns.Flush();
220 |
221 | AsyncUserSessions.NotifyUserRemoved(pi, p, pi.userId, ns);
222 | AsyncUserSessions.NotifyUserStatus(pi, p, pi, ns);
223 | }
224 |
225 | public static void logout(Blaze.Packet p, PlayerInfo pi, NetworkStream ns)
226 | {
227 | //Send logout Packet
228 | List Result = UserAddedCommand.UserAdded(pi);
229 | byte[] buff = Blaze.CreatePacket(1, 46, 0, 0x2000, p.ID, Result);
230 | Logger.LogPacket("logout", Convert.ToInt32(pi.userId), buff); //TestLog
231 | ns.Write(buff, 0, buff.Length);
232 | }
233 |
234 | public static void ListPersonas(Blaze.Packet p, PlayerInfo pi, NetworkStream ns)
235 | {
236 | List result = new List();
237 | List entries = new List();
238 | List e = new List();
239 | e.Add(Blaze.TdfString.Create("DSNM", pi.profile.name));
240 | e.Add(Blaze.TdfInteger.Create("LAST", Blaze.GetUnixTimeStamp()));
241 | e.Add(Blaze.TdfInteger.Create("PID\0", pi.profile.id));
242 | e.Add(Blaze.TdfInteger.Create("STAS", 2));
243 | e.Add(Blaze.TdfInteger.Create("XREF", 0));
244 | e.Add(Blaze.TdfInteger.Create("XTYP", 0));
245 | entries.Add(Blaze.TdfStruct.Create("0", e));
246 | result.Add(Blaze.TdfList.Create("PINF", 3, 1, entries));
247 | byte[] buff = Blaze.CreatePacket(p.Component, p.Command, 0, 0x1000, p.ID, result);
248 | ns.Write(buff, 0, buff.Length);
249 | ns.Flush();
250 | }
251 |
252 | }
253 | }
--------------------------------------------------------------------------------
/CNCEmu/Components/BlazeHelper.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using BlazeLibWV;
7 | using System.Net.Sockets;
8 |
9 |
10 | namespace CNCEmu
11 | {
12 | public static class BlazeHelper
13 | {
14 | public static Blaze.TdfStruct MakeStatGroupEntry(int idx, string catg, string dflt, string ldsc, string name, string sdsc)
15 | {
16 | List result = new List();
17 | result.Add(Blaze.TdfString.Create("CATG", catg));
18 | result.Add(Blaze.TdfString.Create("DFLT", dflt));
19 | result.Add(Blaze.TdfInteger.Create("DRVD", 0));
20 | result.Add(Blaze.TdfString.Create("FRMT", "%d"));
21 | result.Add(Blaze.TdfString.Create("KIND", ""));
22 | result.Add(Blaze.TdfString.Create("LDSC", ldsc));
23 | result.Add(Blaze.TdfString.Create("META", ""));
24 | result.Add(Blaze.TdfString.Create("NAME", name));
25 | result.Add(Blaze.TdfString.Create("SDSC", sdsc));
26 | result.Add(Blaze.TdfInteger.Create("TYPE", 0));
27 | return Blaze.TdfStruct.Create(idx.ToString(), result);
28 | }
29 |
30 | public static Blaze.TdfStruct MakePROSEntry(int idx, PlayerInfo pi)
31 | {
32 | uint t = Blaze.GetUnixTimeStamp();
33 | List result = new List();
34 | result.Add(Blaze.TdfInteger.Create("EXID", pi.userId));
35 | result.Add(Blaze.TdfInteger.Create("GID\0", pi.game.id));
36 | result.Add(Blaze.TdfInteger.Create("LOC\0", pi.loc));
37 | result.Add(Blaze.TdfString.Create("NAME", pi.profile.name));
38 | result.Add(Blaze.TdfInteger.Create("PID\0", pi.userId));
39 | result.Add(BlazeHelper.CreateNETFieldUnion(pi, "PNET"));
40 | result.Add(Blaze.TdfInteger.Create("SID\0", pi.slot));
41 | result.Add(Blaze.TdfInteger.Create("STAT", pi.stat));
42 | result.Add(Blaze.TdfInteger.Create("TIDX", 0xFFFF));
43 | result.Add(Blaze.TdfInteger.Create("TIME", t));
44 | result.Add(Blaze.TdfInteger.Create("UID\0", pi.userId));
45 | return Blaze.TdfStruct.Create(idx.ToString(), result);
46 | }
47 |
48 | public static Blaze.Tdf CreateNETField(PlayerInfo pi, string label)
49 | {
50 | List list = new List();
51 | List e0 = new List();
52 | List EXIP = new List();
53 | EXIP.Add(Blaze.TdfInteger.Create("IP\0\0", pi.exIp));
54 | EXIP.Add(Blaze.TdfInteger.Create("PORT", pi.exPort));
55 | e0.Add(Blaze.TdfStruct.Create("EXIP", EXIP));
56 | List INIP = new List();
57 | INIP.Add(Blaze.TdfInteger.Create("IP\0\0", pi.inIp));
58 | INIP.Add(Blaze.TdfInteger.Create("PORT", pi.inPort));
59 | e0.Add(Blaze.TdfStruct.Create("INIP", INIP));
60 | list.Add(Blaze.TdfStruct.Create("0", e0, true));
61 | return Blaze.TdfList.Create(label, 3, 1, list);
62 | }
63 |
64 | public static Blaze.Tdf CreateNETFieldUnion(PlayerInfo pi, string label)
65 | {
66 | List VALU = new List();
67 | List EXIP = new List();
68 | EXIP.Add(Blaze.TdfInteger.Create("IP", pi.exIp));
69 | EXIP.Add(Blaze.TdfInteger.Create("PORT", pi.exPort));
70 | VALU.Add(Blaze.TdfStruct.Create("EXIP", EXIP));
71 | List INIP = new List();
72 | INIP.Add(Blaze.TdfInteger.Create("IP", pi.inIp));
73 | INIP.Add(Blaze.TdfInteger.Create("PORT", pi.inPort));
74 | VALU.Add(Blaze.TdfStruct.Create("INIP", INIP));
75 | return Blaze.TdfUnion.Create(label, 2, Blaze.TdfStruct.Create("VALU", VALU));
76 | }
77 |
78 | public static Blaze.Tdf CreateADDRField(PlayerInfo pi)
79 | {
80 | List ADDR = new List();
81 | List EXIP = new List();
82 | EXIP.Add(Blaze.TdfInteger.Create("IP", pi.exIp));
83 | EXIP.Add(Blaze.TdfInteger.Create("PORT", pi.exPort));
84 | ADDR.Add(Blaze.TdfStruct.Create("EXIP", EXIP));
85 | List INIP = new List();
86 | INIP.Add(Blaze.TdfInteger.Create("IP", pi.inIp));
87 | INIP.Add(Blaze.TdfInteger.Create("PORT", pi.inPort));
88 | ADDR.Add(Blaze.TdfStruct.Create("INIP", INIP));
89 | return Blaze.TdfStruct.Create("ADDR", ADDR, true);
90 | }
91 |
92 | public static Blaze.Tdf CreateNQOSField(PlayerInfo pi, string label)
93 | {
94 | List NQOS = new List();
95 | NQOS.Add(Blaze.TdfInteger.Create("DBPS", 0));
96 | NQOS.Add(Blaze.TdfInteger.Create("NATT", pi.nat));
97 | NQOS.Add(Blaze.TdfInteger.Create("UBPS", 0));
98 | return Blaze.TdfStruct.Create(label, NQOS);
99 | }
100 |
101 | public static Blaze.TdfStruct CreateUserStruct(PlayerInfo pi)
102 | {
103 | List USER = new List();
104 | USER.Add(Blaze.TdfInteger.Create("AID\0", pi.userId));
105 | USER.Add(Blaze.TdfInteger.Create("ALOC", pi.loc));
106 | USER.Add(Blaze.TdfInteger.Create("EXID\0", pi.userId));
107 | USER.Add(Blaze.TdfInteger.Create("ID\0\0", pi.userId));
108 | USER.Add(Blaze.TdfString.Create("NAME", pi.profile.name));
109 | return Blaze.TdfStruct.Create("USER", USER);
110 | }
111 |
112 | public static Blaze.Tdf CreateUserDataStruct(PlayerInfo pi, string name = "DATA")
113 | {
114 | List DATA = new List();
115 | DATA.Add(BlazeHelper.CreateNETFieldUnion(pi, "ADDR"));
116 | DATA.Add(BlazeHelper.CreateNQOSField(pi, "QDAT"));
117 | return Blaze.TdfStruct.Create(name, DATA);
118 | }
119 |
120 | }
121 | }
122 |
--------------------------------------------------------------------------------
/CNCEmu/Components/InventoryComponent.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using BlazeLibWV;
8 | using System.Net.Sockets;
9 |
10 | namespace CNCEmu
11 | {
12 | public static class InventoryComponent
13 | {
14 | public static void HandlePacket(Blaze.Packet p, PlayerInfo pi, NetworkStream ns)
15 | {
16 | switch (p.Command)
17 | {
18 | case 0x00:
19 | break;
20 | case 0x01:
21 | GetItems(p, pi, ns);
22 | break;
23 | case 0x06:
24 | GetTemplate(p, pi, ns);
25 | break;
26 | default:
27 | Logger.Log("[CLNT] #" + pi.userId + " Component: [" + p.Component + "] # Command: " + p.Command + " [at] " + " [INVENTORY] " + " not found.", System.Drawing.Color.Red);
28 | break;
29 | }
30 | }
31 |
32 | public static void GetItems(Blaze.Packet p, PlayerInfo pi, NetworkStream ns)
33 | {
34 | byte[] buff = Blaze.CreatePacket(p.Component, p.Command, 0, 0x1000, p.ID, new List());
35 | ns.Write(buff, 0, buff.Length);
36 | ns.Flush();
37 | }
38 |
39 | public static void GetTemplate(Blaze.Packet p, PlayerInfo pi, NetworkStream ns)
40 | {
41 | List Result = new List();
42 | List t = Helper.ConvertStringList("{aek971_acog} {aek971_eotech}");
43 | Result.Add(Blaze.TdfList.Create("ILST", 1, t.Count, t));
44 | byte[] buff = Blaze.CreatePacket(p.Component, p.Command, 0, 0x1000, p.ID, Result);
45 | ns.Write(buff, 0, buff.Length);
46 | ns.Flush();
47 | }
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/CNCEmu/Components/RSPComponent.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using BlazeLibWV;
7 | using System.Net.Sockets;
8 |
9 | namespace CNCEmu
10 | {
11 | public static class RSPComponent
12 | {
13 | public static void HandlePacket(Blaze.Packet p, PlayerInfo pi, NetworkStream ns)
14 | {
15 | switch (p.Command)
16 | {
17 | case 0x00:
18 | break;
19 | default:
20 | Logger.Log("[CLNT] #" + pi.userId + " Component: [" + p.Component + "] # Command: " + p.Command + " [at] " + " [RSPComp] " + " not found.", System.Drawing.Color.Red);
21 | break;
22 | }
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/CNCEmu/Components/StatsComponent.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using BlazeLibWV;
7 | using System.Net.Sockets;
8 |
9 | namespace CNCEmu
10 | {
11 | public static class StatsComponent
12 | {
13 | public static void HandlePacket(Blaze.Packet p, PlayerInfo pi, NetworkStream ns)
14 | {
15 | switch (p.Command)
16 | {
17 | case 0x00:
18 | break;
19 | default:
20 | Logger.Log("[CLNT] #" + pi.userId + " Component: [" + p.Component + "] # Command: " + p.Command + " [at] " + " [STATS] " + " not found.", System.Drawing.Color.Red);
21 | break;
22 | }
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/CNCEmu/Components/UserSessionsComponent.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using BlazeLibWV;
7 | using System.Net.Sockets;
8 |
9 | namespace CNCEmu
10 | {
11 | public static class UserSessionsComponent
12 | {
13 | public static void HandlePacket(Blaze.Packet p, PlayerInfo pi, NetworkStream ns)
14 | {
15 | switch (p.Command)
16 | {
17 | case 0x00:
18 | break;
19 | case 0x14:
20 | UpdateNetworkInfo(p, pi, ns);
21 | break;
22 | default:
23 | Logger.Log("[CLNT] #" + pi.userId + " Component: [" + p.Component + "] # Command: " + p.Command + " [at] " + " [USERSESSION] " + " not found.", System.Drawing.Color.Red);
24 | break;
25 | }
26 | }
27 |
28 | public static void UpdateNetworkInfo(Blaze.Packet p, PlayerInfo pi, NetworkStream ns)
29 | {
30 | List input = Blaze.ReadPacketContent(p);
31 | Blaze.TdfUnion addr = (Blaze.TdfUnion)input[0];
32 | Blaze.TdfStruct valu = (Blaze.TdfStruct)addr.UnionContent;
33 | Blaze.TdfStruct exip = (Blaze.TdfStruct)valu.Values[0];
34 | Blaze.TdfStruct inip = (Blaze.TdfStruct)valu.Values[1];
35 | pi.inIp = ((Blaze.TdfInteger)inip.Values[0]).Value;
36 | pi.exIp = ((Blaze.TdfInteger)exip.Values[0]).Value;
37 | pi.exPort = pi.inPort = (uint)((Blaze.TdfInteger)inip.Values[1]).Value;
38 | Blaze.TdfStruct nqos = (Blaze.TdfStruct)input[2];
39 | pi.nat = ((Blaze.TdfInteger)nqos.Values[1]).Value;
40 | byte[] buff = Blaze.CreatePacket(p.Component, p.Command, 0, 0x1000, p.ID, new List());
41 | ns.Write(buff, 0, buff.Length);
42 |
43 | // Send UserSessionExtendedDataUpdateNotification Packet
44 | List Result2 = UserSessionExtendedDataUpdateNotificationCommand.UserSessionExtendedDataUpdateNotification(pi);
45 | byte[] buff2 = Blaze.CreatePacket(0x7802, 1, 0, 0x2000, p.ID, Result2);
46 | Logger.LogPacket("UserSessionExtendedDataUpdateNotification", Convert.ToInt32(pi.userId), buff2); //TestLog
47 | ns.Write(buff2, 0, buff2.Length);
48 |
49 | ns.Flush();
50 | }
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/CNCEmu/Components/UtilComponent.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using BlazeLibWV;
7 | using System.Net.Sockets;
8 |
9 | namespace CNCEmu
10 | {
11 | public static class UtilComponent
12 | {
13 | public static void HandlePacket(Blaze.Packet p, PlayerInfo pi, NetworkStream ns)
14 | {
15 | switch (p.Command)
16 | {
17 | case 0x02:
18 | Ping(p, pi, ns);
19 | break;
20 | case 0x05:
21 | getTelemetryServer(p, pi,ns);
22 | break;
23 | case 0x07:
24 | PreAuth(p, pi, ns);
25 | break;
26 | case 0x08:
27 | PostAuth(p,pi,ns);
28 | break;
29 | case 0x16:
30 | SetClientMetrics(p, pi,ns);
31 | break;
32 | default:
33 | Logger.Log("[CLNT] #" + pi.userId + " Component: [" + p.Component + "] # Command: " + p.Command + " [at] " + " [UTIL] " + " not found.", System.Drawing.Color.Red);
34 | break;
35 | }
36 | }
37 |
38 | public static void Ping(Blaze.Packet p, PlayerInfo pi, NetworkStream ns)
39 | {
40 | pi.timeout.Restart();
41 | List Result = new List();
42 | Result.Add(Blaze.TdfInteger.Create("STIM", Blaze.GetUnixTimeStamp()));
43 | byte[] buff = Blaze.CreatePacket(p.Component, p.Command, 0, 0x1000, p.ID, Result);
44 | ns.Write(buff, 0, buff.Length);
45 | ns.Flush();
46 | }
47 |
48 | public static void getTelemetryServer(Blaze.Packet p, PlayerInfo pi, NetworkStream ns)
49 | {
50 | List Result = new List();
51 | List TELE = new List();
52 |
53 | TELE.Add(Blaze.TdfString.Create("ADRS", "http://river.data.ea.com"));
54 | TELE.Add(Blaze.TdfInteger.Create("ANON", 0));
55 | TELE.Add(Blaze.TdfString.Create("DISA", "AD,AF,AG,AI,AL,AM,AN,AO,AQ,AR,AS,AW,AX,AZ,BA,BB,BD,BF,BH,BI,BJ,BM,BN,BO,BR,BS,BT,BV,BW,BY,BZ,CC,CD,CF,CG,CI,CK,CL,CM,CN,CO,CR,CU,CV,CX,DJ,DM,DO,DZ,EC,EG,EH,ER,ET,FJ,FK,FM,FO,GA,GD,GE,GF,GG,GH,GI,GL,GM,GN,GP,GQ,GS,GT,GU,GW,GY,HM,HN,HT,ID,IL,IM,IN,IO,IQ,IR,IS,JE,JM,JO,KE,KG,KH,KI,KM,KN,KP,KR,KW,KY,KZ,LA,LB,LC,LI,LK,LR,LS,LY,MA,MC,MD,ME,MG,MH,ML,MM,MN,MO,MP,MQ,MR,MS,MU,MV,MW,MY,MZ,NA,NC,NE,NF,NG,NI,NP,NR,NU,OM,PA,PE,PF,PG,PH,PK,PM,PN,PS,PW,PY,QA,RE,RS,RW,SA,SB,SC,SD,SG,SH,SJ,SL,SM,SN,SO,SR,ST,SV,SY,SZ,TC,TD,TF,TG,TH,TJ,TK,TL,TM,TN,TO,TT,TV,TZ,UA,UG,UM,UY,UZ,VA,VC,VE,VG,VN,VU,WF,WS,YE,YT,ZM,ZW,ZZ"));
56 | TELE.Add(Blaze.TdfInteger.Create("EDCT", 1));
57 | TELE.Add(Blaze.TdfString.Create("FILT", "-GAME/COMM/EXPD"));
58 | TELE.Add(Blaze.TdfInteger.Create("LOC", 1701729619));
59 | TELE.Add(Blaze.TdfInteger.Create("MINR", 0));
60 | TELE.Add(Blaze.TdfString.Create("NOOK", "US, CA, MX"));
61 | TELE.Add(Blaze.TdfInteger.Create("PORT", 0x1BB));
62 | TELE.Add(Blaze.TdfInteger.Create("SDLY", 15000));
63 | TELE.Add(Blaze.TdfString.Create("SESS", "session_key_telemetry"));
64 | TELE.Add(Blaze.TdfString.Create("SKEY", ""));
65 | TELE.Add(Blaze.TdfInteger.Create("SPCT", 0));
66 | TELE.Add(Blaze.TdfString.Create("STIM", "Default"));
67 | TELE.Add(Blaze.TdfString.Create("SVNM", "telemetry - 3 - common"));
68 |
69 | Result.Add(Blaze.TdfStruct.Create("TELE", TELE));
70 |
71 | byte[] buff = Blaze.CreatePacket(p.Component, p.Command, 0, 0x1000, p.ID, Result);
72 | ns.Write(buff, 0, buff.Length);
73 | ns.Flush();
74 | }
75 |
76 | public static void PreAuth(Blaze.Packet p, PlayerInfo pi, NetworkStream ns)
77 | {
78 | uint utime = Blaze.GetUnixTimeStamp();
79 |
80 | List input = Blaze.ReadPacketContent(p);
81 | Blaze.TdfStruct CDAT = (Blaze.TdfStruct)input[0];
82 | Blaze.TdfInteger TYPE = (Blaze.TdfInteger)CDAT.Values[3];
83 | pi.isServer = TYPE.Value != 0;
84 |
85 | if (pi.isServer) //Make as a Server !
86 | {
87 | pi.game = new GameInfo();
88 | pi.profile = Profiles.Create("rts.server", 999, "rts.server.pc@ea.com");
89 | pi.userId = 999;
90 | }
91 |
92 | Blaze.TdfStruct CINF = (Blaze.TdfStruct)input[1];
93 | Blaze.TdfString CVER = (Blaze.TdfString)CINF.Values[5];
94 | Blaze.TdfInteger LOC = (Blaze.TdfInteger)CINF.Values[8];
95 | pi.loc = LOC.Value;
96 | pi.version = CVER.Value;
97 | BlazeServer.Log("[CLNT] #" + pi.userId + " is a " + (pi.isServer ? "server" : "client"), System.Drawing.Color.Blue);
98 |
99 | List Result = new List