├── SCore.dll
├── SharpDX.dll
├── SCore
├── SCore
│ ├── SCore.cpp
│ ├── app.ico
│ ├── app.rc
│ ├── resource.h
│ ├── Stdafx.cpp
│ ├── Stdafx.h
│ ├── AutoCriticalSection.cpp
│ ├── AutoCriticalSection.h
│ ├── SCore.h
│ ├── AsyncTimer.h
│ ├── AsyncTimer.Native.h
│ ├── AssemblyInfo.cpp
│ ├── ReadMe.txt
│ ├── AsyncTimer.cpp
│ ├── SCore.vcxproj.filters
│ ├── AsyncTimer.Native.cpp
│ └── SCore.vcxproj
└── SCore.sln
├── clipper_library.dll
├── GatewayServer
├── App.config
├── Services
│ ├── Session.cs
│ ├── Launcher.cs
│ ├── Shard.cs
│ └── Patch.cs
├── Properties
│ └── AssemblyInfo.cs
├── Data
│ └── Globals.cs
├── Program.cs
├── Gateway.cs
├── GatewayServer.csproj
├── ClientContext.cs
└── PacketProcessor.cs
├── SR_GameServer
├── App.config
├── Data
│ ├── Structures.cs
│ ├── RefData
│ │ ├── RefCharGen.cs
│ │ ├── RefDropGold.cs
│ │ ├── RefFmnTidGroupMap.cs
│ │ ├── RefLevel.cs
│ │ ├── RefShop.cs
│ │ ├── RefRegion.cs
│ │ └── RefTeleport.cs
│ ├── NavMesh
│ │ ├── JmxObj.cs
│ │ ├── JmxRes.cs
│ │ ├── Structures.cs
│ │ ├── JmxMesh.cs
│ │ └── JmxNavmesh.cs
│ ├── Enumarations.cs
│ └── Globals.cs
├── GObjNPC.cs
├── GObjItem.cs
├── Properties
│ └── AssemblyInfo.cs
├── SQLTableMapping.cs
├── Enumarations.cs
├── Services
│ └── UniqueID.cs
├── Program.cs
├── GObjMob.cs
├── Formula.cs
├── SRGame.cs
├── Structures.cs
└── SR_GameServer.csproj
├── SCommon
├── Enumerations.cs
├── Security
│ ├── PacketWriter.cs
│ ├── PacketReader.cs
│ └── TransferBuffer.cs
├── SCommon.shproj
├── SCommon.projitems
├── ObjectPool.cs
├── Logging.cs
├── Geometry.cs
├── Opcode.cs
├── Networking
│ └── TCPServer.cs
├── Utility.cs
├── Database
│ └── MSSQL.cs
└── PooledList.cs
├── README.md
├── SilkroadProject.sln
└── .gitignore
/SCore.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tanisman/SilkroadProject/HEAD/SCore.dll
--------------------------------------------------------------------------------
/SharpDX.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tanisman/SilkroadProject/HEAD/SharpDX.dll
--------------------------------------------------------------------------------
/SCore/SCore/SCore.cpp:
--------------------------------------------------------------------------------
1 | // This is the main DLL file.
2 |
3 | #include "stdafx.h"
4 |
5 |
--------------------------------------------------------------------------------
/SCore/SCore/app.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tanisman/SilkroadProject/HEAD/SCore/SCore/app.ico
--------------------------------------------------------------------------------
/SCore/SCore/app.rc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tanisman/SilkroadProject/HEAD/SCore/SCore/app.rc
--------------------------------------------------------------------------------
/clipper_library.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tanisman/SilkroadProject/HEAD/clipper_library.dll
--------------------------------------------------------------------------------
/SCore/SCore/resource.h:
--------------------------------------------------------------------------------
1 | //{{NO_DEPENDENCIES}}
2 | // Microsoft Visual C++ generated include file.
3 | // Used by app.rc
4 |
--------------------------------------------------------------------------------
/GatewayServer/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/SR_GameServer/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/SCore/SCore/Stdafx.cpp:
--------------------------------------------------------------------------------
1 | // stdafx.cpp : source file that includes just the standard includes
2 | // SCore.pch will be the pre-compiled header
3 | // stdafx.obj will contain the pre-compiled type information
4 |
5 | #include "stdafx.h"
6 |
--------------------------------------------------------------------------------
/SCommon/Enumerations.cs:
--------------------------------------------------------------------------------
1 | namespace SCommon
2 | {
3 | ///
4 | /// The SecurityFlags enum used for class
5 | ///
6 | public enum SecurityFlags
7 | {
8 | None = 0,
9 | Handshake = 1,
10 | Blowfish = 2,
11 | SecurityBytes = 4,
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/SCore/SCore/Stdafx.h:
--------------------------------------------------------------------------------
1 | // stdafx.h : include file for standard system include files,
2 | // or project specific include files that are used frequently,
3 | // but are changed infrequently
4 |
5 | #pragma once
6 |
7 |
8 | #define ASIO_STANDALONE
9 | #define ASIO_MSVC _MSC_VER
10 |
11 | #define ASIO_HAS_CONSTEXPR 1
12 | #define ASIO_HAS_VARIADIC_TEMPLATES 1
13 |
14 | #include
15 |
--------------------------------------------------------------------------------
/SCommon/Security/PacketWriter.cs:
--------------------------------------------------------------------------------
1 | namespace SCommon.Security
2 | {
3 | using System.IO;
4 |
5 | public class PacketWriter : BinaryWriter
6 | {
7 | MemoryStream m_ms;
8 |
9 | public PacketWriter()
10 | {
11 | m_ms = new MemoryStream();
12 | this.OutStream = m_ms;
13 | }
14 |
15 | public byte[] GetBytes()
16 | {
17 | return m_ms.ToArray();
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/SCore/SCore/AutoCriticalSection.cpp:
--------------------------------------------------------------------------------
1 | #include "Stdafx.h"
2 | #include "AutoCriticalSection.h"
3 | using namespace SCore::Native;
4 |
5 | AutoCriticalSection::AutoCriticalSection()
6 | {
7 | InitializeCriticalSection(&m_cs);
8 | }
9 |
10 |
11 | AutoCriticalSection::~AutoCriticalSection()
12 | {
13 | DeleteCriticalSection(&m_cs);
14 | }
15 |
16 | void AutoCriticalSection::Lock()
17 | {
18 | EnterCriticalSection(&m_cs);
19 | }
20 |
21 | void AutoCriticalSection::Unlock()
22 | {
23 | LeaveCriticalSection(&m_cs);
24 | }
--------------------------------------------------------------------------------
/SR_GameServer/Data/Structures.cs:
--------------------------------------------------------------------------------
1 | namespace SR_GameServer.Data
2 | {
3 | using System;
4 | using System.Collections.Generic;
5 |
6 | public struct AccountInfo
7 | {
8 | public int SID;
9 | public string StrUserID;
10 | public string Password;
11 | public AuthType Auth;
12 | public List> Characters; //charid, index, deleting
13 | }
14 |
15 | public struct _teleport_restrict
16 | {
17 | public int Restrict;
18 | public int Data1, Data2;
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/SCommon/Security/PacketReader.cs:
--------------------------------------------------------------------------------
1 | namespace SCommon.Security
2 | {
3 | using System.IO;
4 |
5 | public class PacketReader : System.IO.BinaryReader
6 | {
7 | byte[] m_input;
8 |
9 | public PacketReader(byte[] input)
10 | : base(new MemoryStream(input, false))
11 | {
12 | m_input = input;
13 | }
14 |
15 | public PacketReader(byte[] input, int index, int count)
16 | : base(new MemoryStream(input, index, count, false))
17 | {
18 | m_input = input;
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/SR_GameServer/GObjNPC.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 SR_GameServer
8 | {
9 | public class GObjNPC : GObj
10 | {
11 | #region Public Properties and Fields
12 |
13 | public GObjTalkFlags m_talkFlag;
14 | public List m_talkOptions;
15 |
16 | #endregion
17 |
18 | #region Constructors and Destructors
19 |
20 | public GObjNPC()
21 | : base (GObjType.GObjNPC)
22 | {
23 | m_talkOptions = new List();
24 | }
25 |
26 | #endregion
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/SCore/SCore/AutoCriticalSection.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #define WIN32_LEAN_AND_MEAN
4 | #include
5 | namespace SCore
6 | {
7 | namespace Native
8 | {
9 | class AutoCriticalSection
10 | {
11 | private:
12 | CRITICAL_SECTION m_cs;
13 | public:
14 | AutoCriticalSection();
15 | AutoCriticalSection(DWORD dwSpinCount);
16 | ~AutoCriticalSection();
17 | void Lock();
18 | bool TryLock();
19 | void Unlock();
20 | };
21 |
22 | class AutoLockScope
23 | {
24 | private:
25 | AutoCriticalSection *m_pAcs;
26 | public:
27 | AutoLockScope(AutoCriticalSection *pAcs)
28 | : m_pAcs(pAcs)
29 | {
30 | m_pAcs->Lock();
31 | }
32 | ~AutoLockScope()
33 | {
34 | m_pAcs->Unlock();
35 | }
36 | };
37 | }
38 | }
--------------------------------------------------------------------------------
/SR_GameServer/Data/RefData/RefCharGen.cs:
--------------------------------------------------------------------------------
1 | namespace SR_GameServer.Data.RefData
2 | {
3 | using System.Collections.Generic;
4 |
5 | public class RefCharGen
6 | {
7 | #region Public Properties and Fields
8 |
9 | public int RefObjID { get; private set; }
10 |
11 | #endregion
12 |
13 | #region Constructors & Destructors
14 |
15 | public RefCharGen(int id)
16 | {
17 | RefObjID = id;
18 | }
19 |
20 | #endregion
21 | }
22 |
23 | public static class RefCharGenExtensions
24 | {
25 | public static void Load(this List list)
26 | {
27 | using (var reader = Globals.ShardDB.ExecuteReader("SELECT * FROM _RefCharGen WHERE Service = 1"))
28 | {
29 | while (reader.Read())
30 | list.Add(new RefCharGen((int)reader["RefObjID"]));
31 | }
32 | }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/SCore/SCore/SCore.h:
--------------------------------------------------------------------------------
1 | // SCore.h
2 |
3 | #pragma once
4 | #include "stdafx.h"
5 | #include
6 |
7 | using namespace System;
8 |
9 | namespace SCore
10 | {
11 | static asio::io_service ios(2);
12 | static asio::io_service::work w(ios);
13 | static std::list ioworkers;
14 |
15 | void run(int numthreads)
16 | {
17 | unsigned int worker_count = numthreads;
18 |
19 | if (worker_count < 1)
20 | {
21 | SYSTEM_INFO sysinfo;
22 | GetSystemInfo(&sysinfo);
23 | worker_count = sysinfo.dwNumberOfProcessors * 2;
24 | }
25 |
26 | if (worker_count == 0)
27 | worker_count = 16;
28 |
29 | for (int i = 0; i < worker_count; i++)
30 | ioworkers.emplace_back([&] { ios.run(); });
31 | }
32 |
33 | public ref class TimerService
34 | {
35 | internal:
36 |
37 | public:
38 | static void Initialize(int numthreads)
39 | {
40 | run(numthreads);
41 | }
42 |
43 | static void Initialize()
44 | {
45 | run(0);
46 | }
47 | };
48 | }
49 |
--------------------------------------------------------------------------------
/SCore/SCore.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 2013
4 | VisualStudioVersion = 12.0.21005.1
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SCore", "SCore\SCore.vcxproj", "{A0E9C09C-CC53-474F-BDD5-A641F57E2215}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Win32 = Debug|Win32
11 | Release|Win32 = Release|Win32
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {A0E9C09C-CC53-474F-BDD5-A641F57E2215}.Debug|Win32.ActiveCfg = Debug|Win32
15 | {A0E9C09C-CC53-474F-BDD5-A641F57E2215}.Debug|Win32.Build.0 = Debug|Win32
16 | {A0E9C09C-CC53-474F-BDD5-A641F57E2215}.Release|Win32.ActiveCfg = Release|Win32
17 | {A0E9C09C-CC53-474F-BDD5-A641F57E2215}.Release|Win32.Build.0 = Release|Win32
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | EndGlobal
23 |
--------------------------------------------------------------------------------
/SCommon/SCommon.shproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 1ced3d69-af5c-44f5-985c-33f28c7f521a
5 | 14.0
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/SR_GameServer/Data/RefData/RefDropGold.cs:
--------------------------------------------------------------------------------
1 | namespace SR_GameServer.Data.RefData
2 | {
3 | public class RefDropGold
4 | {
5 | #region Public Properties and Fields
6 |
7 | public byte MonLevel;
8 | public double DropProb;
9 | public int GoldMin, GoldMax;
10 |
11 | #endregion
12 | }
13 |
14 | public static class RefDropGoldExtensions
15 | {
16 | public static void Load(this RefDropGold[] list)
17 | {
18 | using (var reader = Globals.ShardDB.ExecuteReader("SELECT * FROM _RefDropGold"))
19 | {
20 | while (reader.Read())
21 | {
22 | byte tmp_monlvl = (byte)reader["MonLevel"];
23 | list[tmp_monlvl] = new RefDropGold();
24 | list[tmp_monlvl].MonLevel = tmp_monlvl;
25 | list[tmp_monlvl].DropProb = (float)reader["DropProb"];
26 | list[tmp_monlvl].GoldMin = (int)reader["GoldMin"];
27 | list[tmp_monlvl].GoldMax = (int)reader["GoldMax"];
28 | }
29 | }
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/SR_GameServer/GObjItem.cs:
--------------------------------------------------------------------------------
1 | namespace SR_GameServer
2 | {
3 | using System;
4 |
5 | using SCommon;
6 |
7 | public class GObjItem : GObj
8 | {
9 | #region Public Properties and Fields
10 |
11 | public int m_data;
12 | public byte m_optLevel;
13 | public GObjChar m_owner;
14 |
15 | public bool IsGold => Data.Globals.Ref.ObjItem[m_model].Type == Data.ItemType.GOLD;
16 | public bool IsQuest => Data.Globals.Ref.ObjItem[m_model].Type == Data.ItemType.EVENT_ITEM;
17 | public bool IsGoods => Data.Globals.Ref.ObjItem[m_model].Type == Data.ItemType.ETC_TRADE_ITEM;
18 |
19 | #endregion
20 |
21 | #region Constructors & Destructors
22 |
23 | public GObjItem()
24 | : base (GObjType.GObjItem)
25 | {
26 | StartDisappear(60000);
27 | }
28 |
29 | #endregion
30 |
31 | #region Private Methods
32 |
33 | protected override void DisappearTimer_Callback(object sender, object state)
34 | {
35 | base.DisappearTimer_Callback(sender, state);
36 | m_owner = null;
37 | }
38 |
39 | #endregion
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/SR_GameServer/Data/RefData/RefFmnTidGroupMap.cs:
--------------------------------------------------------------------------------
1 | namespace SR_GameServer.Data.RefData
2 | {
3 | using System.Collections.Generic;
4 |
5 | public class RefFmnTidGroupMap
6 | {
7 | #region Public Properties and Fields
8 |
9 | public int TidGroup;
10 | public byte TID1, TID2, TID3, TID4;
11 |
12 | #endregion
13 | }
14 |
15 | public static class RefFmnTidGroupExtensions
16 | {
17 | public static void Load(this List list)
18 | {
19 | using (var reader = Globals.ShardDB.ExecuteReader("SELECT * FROM _RefFmnTidGroupMap WHERE Service = 1"))
20 | {
21 | while (reader.Read())
22 | {
23 | int dmp_id = (int)reader["TidGroupID"];
24 | RefFmnTidGroupMap tid = new RefFmnTidGroupMap();
25 | tid.TidGroup = dmp_id;
26 | tid.TID1 = (byte)reader["TypeID1"];
27 | tid.TID2 = (byte)reader["TypeID2"];
28 | tid.TID3 = (byte)reader["TypeID3"];
29 | tid.TID4 = (byte)reader["TypeID4"];
30 | list.Add(tid);
31 | }
32 | }
33 | }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/SCore/SCore/AsyncTimer.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include "AsyncTimer.Native.h"
3 |
4 | using namespace System;
5 | using namespace System::Runtime::InteropServices;
6 |
7 |
8 | namespace SCore
9 | {
10 | public ref class AsyncTimer : IDisposable
11 | {
12 | private:
13 | delegate void NativeCallbackDelegate(Native::AsyncTimer &, void *);
14 | Native::AsyncTimer *m_nativeHandle;
15 | Object^ m_data;
16 | EventHandler