├── packages
├── .gitignore
└── repositories.config
├── .nuget
├── NuGet.exe
└── NuGet.Config
├── Tests
├── packages
│ ├── NUnit.2.6.1
│ │ ├── license.txt
│ │ ├── NUnit.2.6.1.nupkg
│ │ └── lib
│ │ │ └── nunit.framework.dll
│ └── repositories.config
├── OpenStory.Tests.Helpers
│ ├── packages.config
│ ├── Helpers.cs
│ └── Properties
│ │ └── AssemblyInfo.cs
├── OpenStory.Framework.Contracts.Tests
│ ├── packages.config
│ └── Properties
│ │ └── AssemblyInfo.cs
├── OpenStory.Tests
│ ├── packages.config
│ ├── Common
│ │ ├── Game
│ │ │ └── KeyBindingFixture.cs
│ │ └── IO
│ │ │ └── ByteOrderFixture.cs
│ ├── OpenStory.Tests.csproj.DotSettings
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ └── Networking
│ │ └── ReceiveDescriptorFixture.cs
├── OpenStory.Server.Account.Tests
│ ├── packages.config
│ ├── app.config
│ └── Properties
│ │ └── AssemblyInfo.cs
├── OpenStory.Tests.Integration
│ ├── SingleProcessServerFixture.Auth.cs
│ ├── SingleProcessServerFixture.World.cs
│ ├── SingleProcessServerFixture.Channel.cs
│ ├── SingleProcessServerFixture.Nexus.cs
│ ├── app.config
│ ├── packages.config
│ └── Properties
│ │ └── AssemblyInfo.cs
└── OpenStory.Server.Tests
│ ├── packages.config
│ ├── app.config
│ ├── IvGeneratorFixture.cs
│ └── Properties
│ └── AssemblyInfo.cs
├── Core
└── OpenStory
│ ├── packages.config
│ ├── Common
│ ├── Game
│ │ ├── JobClass.cs
│ │ ├── GameConstants.cs
│ │ ├── AuthOperationType.cs
│ │ ├── Gender.cs
│ │ ├── ServerStatus.cs
│ │ ├── PinRequestType.cs
│ │ ├── IChannel.cs
│ │ ├── PinResponseType.cs
│ │ ├── ItemType.cs
│ │ ├── IWorld.cs
│ │ ├── GuildRank.cs
│ │ ├── InventoryType.cs
│ │ ├── KeyBinding.cs
│ │ ├── AuthenticationResult.cs
│ │ └── Elements.cs
│ ├── Tools
│ │ ├── Arrays.Generic.cs
│ │ └── Arrays.cs
│ ├── IO
│ │ ├── IPacketReader.cs
│ │ ├── PacketReadingException.cs
│ │ ├── HandshakeInfo.cs
│ │ └── ArraySegmentException.cs
│ ├── readme.md
│ ├── PacketValueAttribute.cs
│ └── IPacketCodeTable.cs
│ ├── Cryptography
│ ├── VersionMaskType.cs
│ ├── IRollingIvFactoryProvider.cs
│ ├── HeartbeatCrypto.cs
│ ├── KmstDecryptor.cs
│ └── KmstEncryptor.cs
│ ├── Networking
│ ├── IDescriptorContainer.cs
│ ├── INetworkSession.cs
│ ├── SocketErrorEventArgs.cs
│ ├── readme.md
│ ├── ConnectionClosingEventArgs.cs
│ ├── DataArrivedEventArgs.cs
│ └── PacketReceivedEventArgs.cs
│ ├── OpenStory.csproj.DotSettings
│ ├── readme.md
│ └── Properties
│ └── AssemblyInfo.cs
├── Server
├── OpenStory.Server.Nexus
│ ├── packages.config
│ ├── app.config
│ ├── NexusServerModule.cs
│ ├── NexusServer.cs
│ ├── WorldContainer.cs
│ └── Properties
│ │ └── AssemblyInfo.cs
├── OpenStory.Server.World
│ ├── packages.config
│ ├── app.config
│ ├── WorldConfiguration.cs
│ ├── WorldServerModule.cs
│ ├── StubWorldInfoProvider.cs
│ ├── ChannelContainer.cs
│ ├── ActiveChannel.cs
│ └── Properties
│ │ └── AssemblyInfo.cs
├── OpenStory.Server.Accounts
│ ├── packages.config
│ ├── app.config
│ ├── AccountServerModule.cs
│ └── Properties
│ │ └── AssemblyInfo.cs
├── OpenStory.Server.Channel
│ ├── IPlayerFacet.cs
│ ├── ChannelCharacter.cs
│ ├── IPlayerFacetFactory.cs
│ ├── app.config
│ ├── packages.config
│ ├── ChannelPacketCodeTable.cs
│ ├── Data
│ │ ├── BuddyListEntryStatus.cs
│ │ └── BuddyListEntry.cs
│ ├── ChannelClient.cs
│ ├── ChannelConfiguration.cs
│ ├── ChannelServer.cs
│ ├── ChannelServerModule.cs
│ ├── Player.cs
│ └── Properties
│ │ └── AssemblyInfo.cs
├── OpenStory.Framework.Contracts
│ ├── packages.config
│ ├── IServerSessionFactory.cs
│ ├── IBanProvider.cs
│ ├── IAccountProvider.cs
│ ├── IWorldInfoProvider.cs
│ ├── ServerSessionEventArgs.cs
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ └── PacketProcessingEventArgs.cs
├── OpenStory.Services.Contracts
│ ├── packages.config
│ ├── IBootstrapper.cs
│ ├── Auth
│ │ └── IAuthService.cs
│ ├── IServiceFactory.cs
│ ├── IConfigurableService.cs
│ ├── IServiceClientProvider.cs
│ ├── IServerProcess.cs
│ ├── IServiceContainer.cs
│ ├── IRegisteredProcess.cs
│ ├── Nexus
│ │ ├── IAuthToNexusRequestHandler.cs
│ │ ├── INexusToWorldRequestHandler.cs
│ │ ├── IChannelToWorldRequestHandler.cs
│ │ └── IWorldToChannelRequestHandler.cs
│ ├── IServiceStateChanged.cs
│ ├── IRegisteredService.cs
│ ├── OpenStory.Services.Contracts.csproj.DotSettings
│ ├── ServiceState.cs
│ ├── Account
│ │ └── IAccountSession.cs
│ ├── Registry
│ │ └── IRegistryService.cs
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── Extensions.cs
│ ├── BootstrapperBase.cs
│ └── ServerConfiguration.cs
├── OpenStory.Services.Wcf
│ ├── packages.config
│ ├── WcfServiceModule.cs
│ ├── NexusConnectionInfo.cs
│ ├── EnvironmentNexusConnectionProvider.cs
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ └── RegisteredClientProvider.cs
├── OpenStory.Framework.Model.Auth
│ ├── AuthCharacter.cs
│ ├── CharacterCreateResult.cs
│ ├── CharacterRemoveResult.cs
│ └── Properties
│ │ └── AssemblyInfo.cs
├── OpenStory.Server
│ ├── Registry
│ │ ├── IPlayerGroup.cs
│ │ └── IPlayerGroup.TUpdateInfo.cs
│ ├── app.config
│ ├── packages.config
│ ├── Networking
│ │ ├── ISocketAcceptorFactory.cs
│ │ └── SocketEventArgs.cs
│ ├── Processing
│ │ ├── IPacketScheduler.cs
│ │ ├── PacketScheduler.cs
│ │ ├── IServerOperator.cs
│ │ ├── IPacketFactory.cs
│ │ ├── PacketFactory.cs
│ │ ├── IGameClientFactory.cs
│ │ ├── ConfiguredHandshakeInfo.cs
│ │ ├── GameServerBase.cs
│ │ └── ServerOperator.cs
│ ├── IvGenerator.cs
│ ├── IPlayer.cs
│ ├── IllegalPacketException.cs
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ └── ServerModule.cs
├── OpenStory.Framework.Model.Common
│ ├── ICharacterExtension.cs
│ ├── GameMasterLevel.cs
│ ├── Inventory.cs
│ ├── AccountStatus.cs
│ ├── WorldInfo.cs
│ ├── CharacterAppearance.cs
│ ├── BanType.cs
│ ├── CharacterExtensionComparer.cs
│ ├── Character.cs
│ └── Properties
│ │ └── AssemblyInfo.cs
├── OpenStory.Server.Auth
│ ├── Packets.cs
│ ├── AuthClient.Helpers.cs
│ ├── app.config
│ ├── AuthConfiguration.cs
│ ├── packages.config
│ ├── PacketHelpers.cs
│ ├── AuthServer.cs
│ ├── AuthOperator.cs
│ ├── IAuthenticator.cs
│ ├── AuthServerModule.cs
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── AccountSession.cs
│ └── AuthClientState.cs
├── OpenStory.Services.Simple
│ ├── StubAccountProvider.cs
│ ├── packages.config
│ ├── Program.cs
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ └── app.config
├── OpenStory.Services.Accounts
│ ├── packages.config
│ ├── AccountService.cs
│ ├── Program.cs
│ └── Properties
│ │ └── AssemblyInfo.cs
├── OpenStory.Services.Channel
│ ├── packages.config
│ ├── ChannelService.cs
│ ├── Program.cs
│ └── Properties
│ │ └── AssemblyInfo.cs
└── OpenStory.Services.Auth
│ ├── packages.config
│ ├── AuthService.cs
│ ├── Program.cs
│ └── Properties
│ └── AssemblyInfo.cs
├── .gitattributes
├── .gitignore
├── Registry
└── OpenStory.Services.Registry
│ ├── packages.config
│ └── Properties
│ └── AssemblyInfo.cs
├── readme.md
├── OpenStory-Core.sln
└── OpenStory-Core.sln.DotSettings
/packages/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !repositories.config
3 | !.gitignore
--------------------------------------------------------------------------------
/.nuget/NuGet.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shoftee/OpenStory/HEAD/.nuget/NuGet.exe
--------------------------------------------------------------------------------
/Tests/packages/NUnit.2.6.1/license.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shoftee/OpenStory/HEAD/Tests/packages/NUnit.2.6.1/license.txt
--------------------------------------------------------------------------------
/Tests/packages/NUnit.2.6.1/NUnit.2.6.1.nupkg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shoftee/OpenStory/HEAD/Tests/packages/NUnit.2.6.1/NUnit.2.6.1.nupkg
--------------------------------------------------------------------------------
/Tests/packages/NUnit.2.6.1/lib/nunit.framework.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shoftee/OpenStory/HEAD/Tests/packages/NUnit.2.6.1/lib/nunit.framework.dll
--------------------------------------------------------------------------------
/Core/OpenStory/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Tests/packages/repositories.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Server/OpenStory.Server.Nexus/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Server/OpenStory.Server.World/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/.nuget/NuGet.Config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Server/OpenStory.Server.Accounts/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Core/OpenStory/Common/Game/JobClass.cs:
--------------------------------------------------------------------------------
1 | namespace OpenStory.Common.Game
2 | {
3 | internal enum JobClass
4 | {
5 | None = 0,
6 |
7 | Adventurer = 1,
8 |
9 | Legend = 2,
10 |
11 | Resistance = 3
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Tests/OpenStory.Tests.Helpers/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Tests/OpenStory.Framework.Contracts.Tests/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Server/OpenStory.Server.Channel/IPlayerFacet.cs:
--------------------------------------------------------------------------------
1 | namespace OpenStory.Server.Channel
2 | {
3 | ///
4 | /// Provides a managed extension interface for a player object.
5 | ///
6 | public interface IPlayerFacet
7 | {
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/Server/OpenStory.Framework.Contracts/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Server/OpenStory.Services.Contracts/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Server/OpenStory.Server.Channel/ChannelCharacter.cs:
--------------------------------------------------------------------------------
1 | using OpenStory.Framework.Model.Common;
2 |
3 | namespace OpenStory.Server.Channel
4 | {
5 | internal class ChannelCharacter : Character
6 | {
7 | public ChannelCharacter()
8 | {
9 | }
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/Tests/OpenStory.Tests/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Server/OpenStory.Services.Wcf/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Server/OpenStory.Framework.Model.Auth/AuthCharacter.cs:
--------------------------------------------------------------------------------
1 | using OpenStory.Framework.Model.Common;
2 |
3 | namespace OpenStory.Framework.Model.Auth
4 | {
5 | ///
6 | /// Represents a data object for a character.
7 | ///
8 | public sealed class AuthCharacter : Character
9 | {
10 | internal AuthCharacter()
11 | {
12 | }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/Server/OpenStory.Server/Registry/IPlayerGroup.cs:
--------------------------------------------------------------------------------
1 | namespace OpenStory.Server.Registry
2 | {
3 | ///
4 | /// Provides a base interface for player groups.
5 | ///
6 | public interface IPlayerGroup
7 | {
8 | ///
9 | /// Gets the 32-bit identifier for the group.
10 | ///
11 | int Id { get; }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Server/OpenStory.Services.Contracts/IBootstrapper.cs:
--------------------------------------------------------------------------------
1 | namespace OpenStory.Services.Contracts
2 | {
3 | ///
4 | /// Represents a thingie which starts the rest of the thingies.
5 | ///
6 | public interface IBootstrapper
7 | {
8 | ///
9 | /// Starts ALL the things!
10 | ///
11 | void Start();
12 | }
13 | }
--------------------------------------------------------------------------------
/Core/OpenStory/Common/Game/GameConstants.cs:
--------------------------------------------------------------------------------
1 | namespace OpenStory.Common.Game
2 | {
3 | ///
4 | /// A collection of game constants.
5 | ///
6 | public static class GameConstants
7 | {
8 | ///
9 | /// The number of keys in a KeyLayout.
10 | ///
11 | public static readonly int KeyCount = 90;
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Server/OpenStory.Services.Contracts/Auth/IAuthService.cs:
--------------------------------------------------------------------------------
1 | using System.ServiceModel;
2 |
3 | namespace OpenStory.Services.Contracts
4 | {
5 | ///
6 | /// Provides methods for accessing and managing the Authentication Service.
7 | ///
8 | [ServiceContract(Namespace = null, Name = "AuthenticationService")]
9 | public interface IAuthService
10 | {
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/Tests/OpenStory.Server.Account.Tests/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/Server/OpenStory.Framework.Model.Common/ICharacterExtension.cs:
--------------------------------------------------------------------------------
1 | namespace OpenStory.Framework.Model.Common
2 | {
3 | ///
4 | /// Provides a reference to a character.
5 | ///
6 | public interface ICharacterExtension
7 | {
8 | ///
9 | /// Gets the key of the associated character.
10 | ///
11 | CharacterKey Key { get; }
12 | }
13 | }
--------------------------------------------------------------------------------
/Core/OpenStory/Common/Tools/Arrays.Generic.cs:
--------------------------------------------------------------------------------
1 | namespace OpenStory.Common
2 | {
3 | ///
4 | /// Generic array helpers!
5 | ///
6 | /// The type of the array.
7 | public static class Arrays
8 | {
9 | ///
10 | /// An empty array instance.
11 | ///
12 | public static readonly T[] Empty = new T[0];
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/Server/OpenStory.Services.Contracts/IServiceFactory.cs:
--------------------------------------------------------------------------------
1 | namespace OpenStory.Services.Contracts
2 | {
3 | ///
4 | /// Represents a factory for service objects.
5 | ///
6 | public interface IServiceFactory
7 | {
8 | ///
9 | /// Creates an instance of the type.
10 | ///
11 | TService CreateService();
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Server/OpenStory.Server.Auth/Packets.cs:
--------------------------------------------------------------------------------
1 | using OpenStory.Common.Game;
2 | using OpenStory.Common.IO;
3 |
4 | namespace OpenStory.Server.Auth
5 | {
6 | internal static class Packets
7 | {
8 | public static void WriteWorld(this IPacketBuilder builder, IWorld world)
9 | {
10 | }
11 |
12 | private static void WriteChannel(this IPacketBuilder builder, IChannel channel)
13 | {
14 |
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Server/OpenStory.Server.Channel/IPlayerFacetFactory.cs:
--------------------------------------------------------------------------------
1 | using OpenStory.Framework.Model.Common;
2 |
3 | namespace OpenStory.Server.Channel
4 | {
5 | ///
6 | ///
7 | ///
8 | public interface IPlayerFacetFactory
9 | {
10 | ///
11 | ///
12 | ///
13 | TPlayerFacet CreateFacet(CharacterKey characterKey)
14 | where TPlayerFacet : IPlayerFacet;
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/Server/OpenStory.Services.Simple/StubAccountProvider.cs:
--------------------------------------------------------------------------------
1 | using OpenStory.Framework.Contracts;
2 | using OpenStory.Framework.Model.Common;
3 |
4 | namespace OpenStory.Services.Simple
5 | {
6 | class StubAccountProvider : IAccountProvider
7 | {
8 | public Account LoadByUserName(string userName)
9 | {
10 | return null;
11 | }
12 |
13 | public void Save(Account account)
14 | {
15 |
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Server/OpenStory.Server.Auth/AuthClient.Helpers.cs:
--------------------------------------------------------------------------------
1 | using OpenStory.Common.IO;
2 |
3 | namespace OpenStory.Server.Auth
4 | {
5 | partial class AuthClient
6 | {
7 | private bool CheckPin(IUnsafePacketReader reader)
8 | {
9 | string suggested = reader.ReadLengthString();
10 | string expected = Account.AccountPin;
11 | var isValid = suggested == expected;
12 | return isValid;
13 | }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/Server/OpenStory.Server/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Server/OpenStory.Server.Accounts/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Server/OpenStory.Server.Auth/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Server/OpenStory.Server.World/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Server/OpenStory.Server.Channel/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Server/OpenStory.Server.Nexus/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Server/OpenStory.Server/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Server/OpenStory.Server.Auth/AuthConfiguration.cs:
--------------------------------------------------------------------------------
1 | using OpenStory.Services.Contracts;
2 |
3 | namespace OpenStory.Server.Auth
4 | {
5 | ///
6 | /// Represents an AuthOperator configuration.
7 | ///
8 | public sealed class AuthConfiguration : ServerConfiguration
9 | {
10 | ///
11 | public AuthConfiguration(OsServiceConfiguration configuration)
12 | : base(configuration)
13 | {
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/Server/OpenStory.Server.Auth/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Server/OpenStory.Server.Channel/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Server/OpenStory.Services.Accounts/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Server/OpenStory.Services.Contracts/IConfigurableService.cs:
--------------------------------------------------------------------------------
1 | namespace OpenStory.Services.Contracts
2 | {
3 | ///
4 | /// Provides methods for configuring a service.
5 | ///
6 | public interface IConfigurableService
7 | {
8 | ///
9 | /// Configures the service.
10 | ///
11 | /// The configuration object.
12 | void Configure(OsServiceConfiguration configuration);
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/Core/OpenStory/Cryptography/VersionMaskType.cs:
--------------------------------------------------------------------------------
1 | namespace OpenStory.Cryptography
2 | {
3 | ///
4 | /// Denotes the type of the version representation.
5 | ///
6 | public enum VersionMaskType
7 | {
8 | ///
9 | /// The version is used as-is.
10 | ///
11 | None = 0,
12 |
13 | ///
14 | /// The one's complement of the version is used.
15 | ///
16 | Complement = 1
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Core/OpenStory/Cryptography/IRollingIvFactoryProvider.cs:
--------------------------------------------------------------------------------
1 | namespace OpenStory.Cryptography
2 | {
3 | ///
4 | /// Provides instances.
5 | ///
6 | public interface IRollingIvFactoryProvider
7 | {
8 | ///
9 | /// Gets a new .
10 | ///
11 | /// The version to use for the factory.
12 | RollingIvFactory CreateFactory(ushort version);
13 | }
14 | }
--------------------------------------------------------------------------------
/Server/OpenStory.Framework.Contracts/IServerSessionFactory.cs:
--------------------------------------------------------------------------------
1 | namespace OpenStory.Framework.Contracts
2 | {
3 | ///
4 | /// Provides methods for creating server sessions.
5 | ///
6 | public interface IServerSessionFactory
7 | {
8 | ///
9 | /// Creates a server session on top of the provided socket.
10 | ///
11 | /// a new object.
12 | IServerSession CreateSession();
13 | }
14 | }
--------------------------------------------------------------------------------
/Tests/OpenStory.Tests/Common/Game/KeyBindingFixture.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using FluentAssertions;
3 | using NUnit.Framework;
4 |
5 | namespace OpenStory.Common.Game
6 | {
7 | [TestFixture]
8 | [Category("OpenStory.Common.Game.KeyBinding")]
9 | public sealed class KeyBindingFixture
10 | {
11 | [Test]
12 | public void Constructor_Should_Not_Throw()
13 | {
14 | Action construction = () => new KeyBinding(0, 0);
15 | construction.ShouldNotThrow();
16 | }
17 | }
18 | }
--------------------------------------------------------------------------------
/Server/OpenStory.Server/Networking/ISocketAcceptorFactory.cs:
--------------------------------------------------------------------------------
1 | using System.Net;
2 |
3 | namespace OpenStory.Server.Networking
4 | {
5 | ///
6 | /// Provides methods for creating objects.
7 | ///
8 | public interface ISocketAcceptorFactory
9 | {
10 | ///
11 | /// Creates a new instance of the class.
12 | ///
13 | SocketAcceptor CreateSocketAcceptor(IPEndPoint endpoint);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/Server/OpenStory.Framework.Model.Auth/CharacterCreateResult.cs:
--------------------------------------------------------------------------------
1 | namespace OpenStory.Framework.Model.Auth
2 | {
3 | ///
4 | /// The possible results for a character creation operation.
5 | ///
6 | public enum CharacterCreateResult
7 | {
8 | ///
9 | /// The character was successfully created.
10 | ///
11 | Success,
12 |
13 | ///
14 | /// The name was unavailable.
15 | ///
16 | NameUnavailable,
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Server/OpenStory.Server/Processing/IPacketScheduler.cs:
--------------------------------------------------------------------------------
1 | using OpenStory.Framework.Contracts;
2 |
3 | namespace OpenStory.Server.Processing
4 | {
5 | ///
6 | /// Registers sessions for scheduling their packet processing.
7 | ///
8 | public interface IPacketScheduler
9 | {
10 | ///
11 | /// Registers a session for processing.
12 | ///
13 | /// The session to register.
14 | void Register(IServerSession session);
15 | }
16 | }
--------------------------------------------------------------------------------
/Core/OpenStory/Common/Game/AuthOperationType.cs:
--------------------------------------------------------------------------------
1 | namespace OpenStory.Common.Game
2 | {
3 | ///
4 | /// The type of an auth operation.
5 | ///
6 | public enum AuthOperationType
7 | {
8 | ///
9 | /// The operation for gender selection.
10 | ///
11 | [PacketValue(0x0A)]
12 | GenderSelect,
13 |
14 | ///
15 | /// The operation for PIN selection.
16 | ///
17 | [PacketValue(0x0B)]
18 | PinSelect,
19 | }
20 | }
--------------------------------------------------------------------------------
/Server/OpenStory.Services.Accounts/AccountService.cs:
--------------------------------------------------------------------------------
1 | using System.ServiceModel;
2 | using OpenStory.Server.Accounts;
3 | using OpenStory.Services.Wcf;
4 |
5 | namespace OpenStory.Services.Account
6 | {
7 | [ServiceBehavior(InstanceContextMode = InstanceContextMode.Single, ConcurrencyMode = ConcurrencyMode.Single)]
8 | internal sealed class AccountService : RegisteredServiceBase
9 | {
10 | public AccountService(AccountServer accountServer)
11 | : base(accountServer)
12 | {
13 | }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/Server/OpenStory.Services.Contracts/IServiceClientProvider.cs:
--------------------------------------------------------------------------------
1 | namespace OpenStory.Services.Contracts
2 | {
3 | ///
4 | /// Provides methods for creating client channels to services.
5 | ///
6 | /// The type of the service.
7 | public interface IServiceClientProvider
8 | where TChannel : class
9 | {
10 | ///
11 | /// Gets a service channel using discovery.
12 | ///
13 | TChannel CreateChannel();
14 | }
15 | }
--------------------------------------------------------------------------------
/Tests/OpenStory.Tests.Helpers/Helpers.cs:
--------------------------------------------------------------------------------
1 | using System.Security.Cryptography;
2 |
3 | namespace OpenStory.Tests.Helpers
4 | {
5 | public static class Helpers
6 | {
7 | public static readonly byte[] EmptyBuffer = new byte[0];
8 |
9 | private static readonly RandomNumberGenerator Rng = new RNGCryptoServiceProvider();
10 |
11 | public static byte[] GetRandomBytes(int count)
12 | {
13 | var buffer = new byte[count];
14 | Rng.GetBytes(buffer);
15 | return buffer;
16 | }
17 | }
18 | }
--------------------------------------------------------------------------------
/Server/OpenStory.Server.Channel/ChannelPacketCodeTable.cs:
--------------------------------------------------------------------------------
1 | using OpenStory.Common;
2 |
3 | namespace OpenStory.Server.Channel
4 | {
5 | internal sealed class ChannelPacketCodeTable : PacketCodeTable
6 | {
7 | public ChannelPacketCodeTable()
8 | {
9 | LoadPacketCodes();
10 | }
11 |
12 | #region Overrides of PacketCodeTable
13 |
14 | ///
15 | protected override void LoadPacketCodesInternal()
16 | {
17 | }
18 |
19 | #endregion
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/Server/OpenStory.Services.Contracts/IServerProcess.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using OpenStory.Framework.Contracts;
3 |
4 | namespace OpenStory.Services.Contracts
5 | {
6 | ///
7 | /// Provides methods for starting and stopping a server.
8 | ///
9 | public interface IServerProcess : IRegisteredProcess, IConfigurableService
10 | {
11 | ///
12 | /// Occurs when a new server session has started.
13 | ///
14 | event EventHandler ConnectionOpened;
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/Server/OpenStory.Services.Contracts/IServiceContainer.cs:
--------------------------------------------------------------------------------
1 | namespace OpenStory.Services.Contracts
2 | {
3 | ///
4 | /// Hosts other services!
5 | ///
6 | public interface IServiceContainer
7 | {
8 | ///
9 | /// Registers the provided service object.
10 | ///
11 | void Register(TService service);
12 |
13 | ///
14 | /// Unregisters the provided service object.
15 | ///
16 | void Unregister(TService service);
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Auto detect text files and perform LF normalization
2 | * text=auto
3 |
4 | # Custom for Visual Studio
5 | *.cs diff=csharp
6 | *.sln merge=union
7 | *.csproj merge=union
8 | *.vbproj merge=union
9 | *.fsproj merge=union
10 | *.dbproj merge=union
11 |
12 | # Standard to msysgit
13 | *.doc diff=astextplain
14 | *.DOC diff=astextplain
15 | *.docx diff=astextplain
16 | *.DOCX diff=astextplain
17 | *.dot diff=astextplain
18 | *.DOT diff=astextplain
19 | *.pdf diff=astextplain
20 | *.PDF diff=astextplain
21 | *.rtf diff=astextplain
22 | *.RTF diff=astextplain
23 |
--------------------------------------------------------------------------------
/Server/OpenStory.Services.Wcf/WcfServiceModule.cs:
--------------------------------------------------------------------------------
1 | using Ninject.Modules;
2 | using OpenStory.Services.Contracts;
3 |
4 | namespace OpenStory.Services.Wcf
5 | {
6 | ///
7 | /// Represents a ninject module for WCF stuff.
8 | ///
9 | public class WcfServiceModule : NinjectModule
10 | {
11 | ///
12 | public override void Load()
13 | {
14 | Bind().ToProvider();
15 | Bind().To();
16 | }
17 | }
18 | }
--------------------------------------------------------------------------------
/Server/OpenStory.Services.Channel/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Server/OpenStory.Server/Processing/PacketScheduler.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Threading.Tasks;
3 | using OpenStory.Framework.Contracts;
4 |
5 | namespace OpenStory.Server.Processing
6 | {
7 | internal sealed class PacketScheduler : IPacketScheduler
8 | {
9 | public void Register(IServerSession session)
10 | {
11 | session.ReadyForPush += OnReadyForPush;
12 | }
13 |
14 | private void OnReadyForPush(object sender, EventArgs e)
15 | {
16 | Task.Factory.StartNew(() => ((IServerSession)sender).Push());
17 | }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/Server/OpenStory.Server.Auth/PacketHelpers.cs:
--------------------------------------------------------------------------------
1 | using OpenStory.Common.Game;
2 | using OpenStory.Common.IO;
3 | using OpenStory.Server.Processing;
4 |
5 | namespace OpenStory.Server.Auth
6 | {
7 | internal static class PacketHelpers
8 | {
9 | public static byte[] PinResponse(this IPacketFactory packetFactory, PinResponseType result)
10 | {
11 | using (var builder = packetFactory.CreatePacket("PinResponse"))
12 | {
13 | builder.WriteByte(result);
14 |
15 | return builder.ToByteArray();
16 | }
17 | }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/Tests/OpenStory.Tests.Integration/SingleProcessServerFixture.Auth.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using FluentAssertions;
3 | using Ninject;
4 | using NUnit.Framework;
5 | using OpenStory.Server.Processing;
6 | using OpenStory.Services.Contracts;
7 |
8 | namespace OpenStory.Tests.Integration
9 | {
10 | public sealed partial class SingleProcessServerFixture
11 | {
12 | [TestCase(typeof(IServerOperator))]
13 | [TestCase(typeof(IServerProcess))]
14 | public void Auth_Should_Resolve(Type type)
15 | {
16 | _auth.TryGet(type).Should().NotBeNull();
17 | }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/Server/OpenStory.Server.Auth/AuthServer.cs:
--------------------------------------------------------------------------------
1 | using OpenStory.Server.Processing;
2 | using OpenStory.Services.Contracts;
3 |
4 | namespace OpenStory.Server.Auth
5 | {
6 | ///
7 | /// Represents an auth server.
8 | ///
9 | public class AuthServer : NetworkServer
10 | {
11 | ///
12 | /// Initializes a new instance of the class.
13 | ///
14 | public AuthServer(IServerProcess process, AuthOperator @operator)
15 | : base(process, @operator)
16 | {
17 | }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 |
2 | #ignore thumbnails created by windows
3 | Thumbs.db
4 |
5 | #Ignore files build by Visual Studio
6 | *.obj
7 | *.exe
8 | *.pdb
9 | *.user
10 | *.aps
11 | *.pch
12 | *.vspscc
13 | *_i.c
14 | *_p.c
15 | *.ncb
16 | *.suo
17 | *.tlb
18 | *.tlh
19 | *.bak
20 | *.cache
21 | *.ilk
22 | *.log
23 | [Bb]in
24 | [Dd]ebug*/
25 | *.lib
26 | *.sbr
27 | obj/
28 | [Rr]elease*/
29 | _ReSharper*/
30 | [Tt]est[Rr]esult*
31 |
32 | # and ignore other random things:
33 | *.rise
34 | Database/*
35 | *.png
36 | *.pfx
37 | *.pidb
38 | *.userprefs
39 | *.ncrunchsolution
40 | **/test-results/*
41 | OpenStory-Complete.sln.ide/*
42 | .vs/
43 |
--------------------------------------------------------------------------------
/Server/OpenStory.Server/Processing/IServerOperator.cs:
--------------------------------------------------------------------------------
1 | using OpenStory.Framework.Contracts;
2 | using OpenStory.Services.Contracts;
3 |
4 | namespace OpenStory.Server.Processing
5 | {
6 | ///
7 | /// Provides methods for operating with server network sessions.
8 | ///
9 | public interface IServerOperator : IConfigurableService
10 | {
11 | ///
12 | /// Registers a new session into the server.
13 | ///
14 | /// The server session to register.
15 | void RegisterSession(IServerSession session);
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Tests/OpenStory.Tests.Integration/SingleProcessServerFixture.World.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using FluentAssertions;
3 | using Ninject;
4 | using NUnit.Framework;
5 | using OpenStory.Framework.Contracts;
6 | using OpenStory.Services.Contracts;
7 |
8 | namespace OpenStory.Tests.Integration
9 | {
10 | public sealed partial class SingleProcessServerFixture
11 | {
12 | [TestCase(typeof(IServiceContainer))]
13 | [TestCase(typeof(IWorldInfoProvider))]
14 | public void World_Should_Resolve(Type type)
15 | {
16 | _world.TryGet(type).Should().NotBeNull();
17 | }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/Tests/OpenStory.Server.Tests/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/Server/OpenStory.Services.Contracts/IRegisteredProcess.cs:
--------------------------------------------------------------------------------
1 | namespace OpenStory.Services.Contracts
2 | {
3 | ///
4 | /// Provides methods for starting and stopping a service.
5 | ///
6 | public interface IRegisteredProcess
7 | {
8 | ///
9 | /// Gets whether the server is running or not.
10 | ///
11 | bool IsRunning { get; }
12 |
13 | ///
14 | /// Starts the server.
15 | ///
16 | void Start();
17 |
18 | ///
19 | /// Stops the server.
20 | ///
21 | void Stop();
22 | }
23 | }
--------------------------------------------------------------------------------
/Server/OpenStory.Services.Auth/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/Registry/OpenStory.Services.Registry/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/Core/OpenStory/Common/Game/Gender.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace OpenStory.Common.Game
4 | {
5 | ///
6 | /// The gender of a user.
7 | ///
8 | [Serializable]
9 | public enum Gender
10 | {
11 | ///
12 | /// Male gender.
13 | ///
14 | [PacketValue(0)]
15 | Male = 0,
16 |
17 | ///
18 | /// Female gender.
19 | ///
20 | [PacketValue(1)]
21 | Female = 1,
22 |
23 | ///
24 | /// Unspecified gender.
25 | ///
26 | [PacketValue(2)]
27 | Unspecified = 2
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/Server/OpenStory.Server/Processing/IPacketFactory.cs:
--------------------------------------------------------------------------------
1 | using OpenStory.Common.IO;
2 |
3 | namespace OpenStory.Server.Processing
4 | {
5 | ///
6 | /// Provides methods for creating packets.
7 | ///
8 | public interface IPacketFactory
9 | {
10 | ///
11 | /// Creates a new object for the specified packet label.
12 | ///
13 | /// The label of the packet type.
14 | /// a new initialized with the packet code for the specified label.
15 | PacketBuilder CreatePacket(string label);
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Server/OpenStory.Server/Registry/IPlayerGroup.TUpdateInfo.cs:
--------------------------------------------------------------------------------
1 | namespace OpenStory.Server.Registry
2 | {
3 | ///
4 | /// Provides properties and methods for registration and notification of player groups.
5 | ///
6 | /// The type that will be used for notification information.
7 | public interface IPlayerGroup : IPlayerGroup
8 | {
9 | ///
10 | /// Processes an update to the group state.
11 | ///
12 | /// The object containing the update information.
13 | void Update(TUpdateInfo updateInfo);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/Server/OpenStory.Framework.Model.Auth/CharacterRemoveResult.cs:
--------------------------------------------------------------------------------
1 | namespace OpenStory.Framework.Model.Auth
2 | {
3 | ///
4 | /// The possible results of a character removal operation.
5 | ///
6 | public enum CharacterRemoveResult
7 | {
8 | ///
9 | /// The character was successfully removed.
10 | ///
11 | Success,
12 |
13 | ///
14 | /// The character is the leader of a guild, so it cannot be removed.
15 | ///
16 | IsGuildLeader,
17 |
18 | ///
19 | /// Some other unknown error?
20 | ///
21 | Error,
22 | }
23 | }
--------------------------------------------------------------------------------
/Server/OpenStory.Services.Auth/AuthService.cs:
--------------------------------------------------------------------------------
1 | using System.ServiceModel;
2 | using OpenStory.Server.Auth;
3 | using OpenStory.Services.Wcf;
4 |
5 | namespace OpenStory.Services.Auth
6 | {
7 | [ServiceBehavior(InstanceContextMode = InstanceContextMode.Single, ConcurrencyMode = ConcurrencyMode.Single)]
8 | internal sealed class AuthService : RegisteredServiceBase
9 | {
10 | private readonly NexusConnectionInfo _nexusConnectionInfo;
11 |
12 | public AuthService(AuthServer authServer, NexusConnectionInfo nexusConnectionInfo)
13 | : base(authServer)
14 | {
15 | _nexusConnectionInfo = nexusConnectionInfo;
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Server/OpenStory.Services.Simple/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/Tests/OpenStory.Tests.Integration/SingleProcessServerFixture.Channel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using FluentAssertions;
3 | using Ninject;
4 | using NUnit.Framework;
5 | using OpenStory.Server.Processing;
6 | using OpenStory.Services.Contracts;
7 |
8 | namespace OpenStory.Tests.Integration
9 | {
10 | public sealed partial class SingleProcessServerFixture
11 | {
12 | [TestCase(typeof(IServerOperator))]
13 | [TestCase(typeof(IServerProcess))]
14 | [TestCase(typeof(IServiceContainer))]
15 | public void Channel_Should_Resolve(Type type)
16 | {
17 | _channel.TryGet(type).Should().NotBeNull();
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/Core/OpenStory/Common/IO/IPacketReader.cs:
--------------------------------------------------------------------------------
1 | namespace OpenStory.Common.IO
2 | {
3 | ///
4 | /// Provides simple packet reader methods.
5 | ///
6 | public interface IPacketReader
7 | {
8 | ///
9 | /// Gets the number of remaining bytes until the end of the buffer segment.
10 | ///
11 | int Remaining { get; }
12 |
13 | ///
14 | /// Returns a byte array of the remaining data in the
15 | /// stream and advances to the end of the stream.
16 | ///
17 | /// an array with the buffer's remaining data.
18 | byte[] ReadFully();
19 | }
20 | }
--------------------------------------------------------------------------------
/Server/OpenStory.Services.Contracts/Nexus/IAuthToNexusRequestHandler.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.ServiceModel;
3 | using OpenStory.Common.Game;
4 |
5 | namespace OpenStory.Services.Contracts
6 | {
7 | ///
8 | /// Provides properties and methods which a World Server exposes to an Auth Server.
9 | ///
10 | [ServiceContract(Namespace = null, Name = "AuthToNexusService")]
11 | public interface IAuthToNexusRequestHandler
12 | {
13 | ///
14 | /// Retrieves the information of the specified world.
15 | ///
16 | [OperationContract]
17 | IEnumerable GetWorlds();
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/Tests/OpenStory.Tests.Integration/SingleProcessServerFixture.Nexus.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using FluentAssertions;
3 | using Ninject;
4 | using NUnit.Framework;
5 | using OpenStory.Server.Processing;
6 | using OpenStory.Services.Contracts;
7 |
8 | namespace OpenStory.Tests.Integration
9 | {
10 | public sealed partial class SingleProcessServerFixture
11 | {
12 | [TestCase(typeof(IServerOperator))]
13 | [TestCase(typeof(IServiceContainer))]
14 | [TestCase(typeof(IAuthToNexusRequestHandler))]
15 | public void Nexus_Should_Resolve(Type type)
16 | {
17 | _auth.TryGet(type).Should().NotBeNull();
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/Server/OpenStory.Server/Processing/PacketFactory.cs:
--------------------------------------------------------------------------------
1 | using OpenStory.Common;
2 | using OpenStory.Common.IO;
3 |
4 | namespace OpenStory.Server.Processing
5 | {
6 | internal sealed class PacketFactory : IPacketFactory
7 | {
8 | private readonly IPacketCodeTable _packets;
9 |
10 | public PacketFactory(IPacketCodeTable packets)
11 | {
12 | _packets = packets;
13 | }
14 |
15 | public PacketBuilder CreatePacket(string label)
16 | {
17 | ushort code = _packets.GetOutgoingCode(label);
18 |
19 | var builder = new PacketBuilder();
20 | builder.WriteInt16(code);
21 | return builder;
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Server/OpenStory.Server.Accounts/AccountServerModule.cs:
--------------------------------------------------------------------------------
1 | using Ninject.Modules;
2 | using NodaTime;
3 | using OpenStory.Services.Contracts;
4 |
5 | namespace OpenStory.Server.Accounts
6 | {
7 | ///
8 | /// Account service module.
9 | ///
10 | public sealed class AccountServerModule : NinjectModule
11 | {
12 | ///
13 | public override void Load()
14 | {
15 | // No dependencies
16 | Bind().ToConstant(SystemClock.Instance);
17 |
18 | // AccountServer
19 | // ^ IClock
20 | Bind().To().InSingletonScope();
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Server/OpenStory.Services.Simple/Program.cs:
--------------------------------------------------------------------------------
1 | using System.Threading;
2 | using Ninject;
3 | using OpenStory.Services.Contracts;
4 |
5 | namespace OpenStory.Services.Simple
6 | {
7 | internal static class Program
8 | {
9 | public static void Main()
10 | {
11 | log4net.Config.XmlConfigurator.Configure();
12 |
13 | CreateKernel().Get().Start();
14 |
15 | Thread.Sleep(Timeout.Infinite);
16 | }
17 |
18 | private static IKernel CreateKernel()
19 | {
20 | var kernel = new StandardKernel();
21 | kernel.Bind().To();
22 | return kernel;
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Core/OpenStory/Common/Game/ServerStatus.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace OpenStory.Common.Game
4 | {
5 | ///
6 | /// World status options.
7 | ///
8 | [Serializable]
9 | public enum ServerStatus
10 | {
11 | ///
12 | /// The world is running normally and accepting players.
13 | ///
14 | Normal = 0,
15 |
16 | ///
17 | /// The world is very populated and may run slower than normally.
18 | ///
19 | HighlyPopulated = 1,
20 |
21 | ///
22 | /// The world is full and is not accepting more players.
23 | ///
24 | Full = 2
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Core/OpenStory/Common/readme.md:
--------------------------------------------------------------------------------
1 | # `OpenStory.Common`
2 |
3 | This namespace mostly contains boring stuff that you can't go without.
4 |
5 | ## Credits
6 |
7 | Credits go out to, and I never thought I'd say this, Java, for the `AtomicBoolean` class. My god, why does .NET not have `Interlocked` overloads for boolean values?
8 |
9 | ## Points of interest
10 |
11 | ### `IO` namespace
12 |
13 | `OpenStory.Common.IO` contains the classes which handle little-endian reading and writing for packets. They are *very* well-documented, so I don't think there's much to explain about them.
14 |
15 | ### `Game` namespace
16 |
17 | `OpenStory.Common.Game` contains game-related structures that have the same usage in both client and server endpoints.
--------------------------------------------------------------------------------
/Server/OpenStory.Server.Nexus/NexusServerModule.cs:
--------------------------------------------------------------------------------
1 | using OpenStory.Services.Contracts;
2 | using Ninject.Modules;
3 |
4 | namespace OpenStory.Server.Nexus
5 | {
6 | ///
7 | /// Nexus server module.
8 | ///
9 | public class NexusServerModule : NinjectModule
10 | {
11 | ///
12 | public override void Load()
13 | {
14 | // No dependencies
15 | Bind>().To().InSingletonScope();
16 |
17 | // NexusServer
18 | // ^ WorldContainer
19 | Bind().To().InSingletonScope();
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Server/OpenStory.Services.Channel/ChannelService.cs:
--------------------------------------------------------------------------------
1 | using System.ServiceModel;
2 | using OpenStory.Server.Channel;
3 | using OpenStory.Services.Wcf;
4 |
5 | namespace OpenStory.Services.Channel
6 | {
7 | [ServiceBehavior(InstanceContextMode = InstanceContextMode.Single, ConcurrencyMode = ConcurrencyMode.Single)]
8 | internal sealed class ChannelService : RegisteredServiceBase
9 | {
10 | private readonly NexusConnectionInfo _nexusConnectionInfo;
11 |
12 | public ChannelService(ChannelServer channelServer, NexusConnectionInfo nexusConnectionInfo)
13 | : base(channelServer)
14 | {
15 | _nexusConnectionInfo = nexusConnectionInfo;
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Tests/OpenStory.Tests.Integration/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/Tests/OpenStory.Server.Account.Tests/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/Server/OpenStory.Framework.Model.Common/GameMasterLevel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace OpenStory.Framework.Model.Common
4 | {
5 | ///
6 | /// Permission levels for Game Master users.
7 | ///
8 | [Serializable]
9 | public enum GameMasterLevel : byte
10 | {
11 | ///
12 | /// The user is a normal player and has no game master priviliges.
13 | ///
14 | None = 0,
15 |
16 | ///
17 | /// The use has some game master abilities.
18 | ///
19 | GameMasterHelper = 1,
20 |
21 | ///
22 | /// The user is a Game Master.
23 | ///
24 | GameMaster = 2
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/readme.md:
--------------------------------------------------------------------------------
1 | # OpenStory
2 |
3 | Hello. This is, simply put, a project to make a reusable, pretty, open-source class library for [MapleStory](http://www.maplestory.com/ "MapleStory global home page") emulators, be it client or server ones. Feel free to use it.
4 |
5 | # Contributing
6 |
7 | Pull, branch, code, and poke me for a merge. I'll review it mercilessly and probably throw it away, but you never know!
8 | But seriously, you could give me good ideas. So do it.
9 |
10 | # Credits
11 |
12 | Credits are written out in individual readme files like this one, and also in the code files where appropriate.
13 |
14 | # License
15 |
16 | This thing is supposedly licensed under the Apache 2 license. Although nobody's gonna honor that anyways, so the hell with it?
17 |
--------------------------------------------------------------------------------
/Server/OpenStory.Services.Wcf/NexusConnectionInfo.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace OpenStory.Services.Wcf
4 | {
5 | ///
6 | /// Represents connection information for a nexus service.
7 | ///
8 | public sealed class NexusConnectionInfo
9 | {
10 | ///
11 | /// Gets the access token required to communicate with the Nexus service.
12 | ///
13 | public Guid AccessToken { get; private set; }
14 |
15 | ///
16 | /// Initializes a new instance of the class.
17 | ///
18 | public NexusConnectionInfo(Guid accessToken)
19 | {
20 | AccessToken = accessToken;
21 | }
22 | }
23 | }
--------------------------------------------------------------------------------
/Core/OpenStory/Common/Game/PinRequestType.cs:
--------------------------------------------------------------------------------
1 | namespace OpenStory.Common.Game
2 | {
3 | ///
4 | /// The type of the PIN request.
5 | ///
6 | public enum PinRequestType
7 | {
8 | ///
9 | /// A pin is not set and needs to be requested back from the server.
10 | ///
11 | [PacketValue(0)]
12 | PinNotSet,
13 |
14 | ///
15 | /// A pin is provided and needs to be validated.
16 | ///
17 | [PacketValue(1)]
18 | CheckPin,
19 |
20 | ///
21 | /// A pin is provided and needs to be validated before it can be modified.
22 | ///
23 | [PacketValue(2)]
24 | AssignPin,
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Server/OpenStory.Services.Contracts/Nexus/INexusToWorldRequestHandler.cs:
--------------------------------------------------------------------------------
1 | using System.ServiceModel;
2 | using OpenStory.Common.Game;
3 |
4 | namespace OpenStory.Services.Contracts
5 | {
6 | ///
7 | /// Provides properties and methods which a World Server exposes to a Nexus Server.
8 | ///
9 | [ServiceContract(Namespace = null, Name = "NexusToWorldService")]
10 | public interface INexusToWorldRequestHandler
11 | {
12 | ///
13 | /// Gets the ID of the World.
14 | ///
15 | int WorldId { [OperationContract] get; }
16 |
17 | ///
18 | /// Retrieves the world details object for this server.
19 | ///
20 | IWorld GetDetails();
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Server/OpenStory.Server.Channel/Data/BuddyListEntryStatus.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace OpenStory.Server.Channel.Data
4 | {
5 | ///
6 | /// Denotes the status of the friend relationship.
7 | ///
8 | [Serializable]
9 | public enum BuddyListEntryStatus
10 | {
11 | ///
12 | /// The buddy request has not been accepted by the other party.
13 | ///
14 | Pending,
15 |
16 | ///
17 | /// The entry is active and all is good.
18 | ///
19 | Active,
20 |
21 | ///
22 | /// The entry is inactive for whatever reason, e.g. the other party has removed their entry.
23 | ///
24 | Inactive,
25 | }
26 | }
--------------------------------------------------------------------------------
/Server/OpenStory.Server/Processing/IGameClientFactory.cs:
--------------------------------------------------------------------------------
1 | using OpenStory.Framework.Contracts;
2 |
3 | namespace OpenStory.Server.Processing
4 | {
5 | ///
6 | /// Provides methods for creating game client instances.
7 | ///
8 | /// The type of the game clients.
9 | public interface IGameClientFactory
10 | where TClient : ClientBase
11 | {
12 | ///
13 | /// Creates a new game client.
14 | ///
15 | /// The underlying session for the new client.
16 | /// the new instance.
17 | TClient CreateClient(IServerSession serverSession);
18 | }
19 | }
--------------------------------------------------------------------------------
/Server/OpenStory.Services.Contracts/IServiceStateChanged.cs:
--------------------------------------------------------------------------------
1 | using System.ServiceModel;
2 |
3 | namespace OpenStory.Services.Contracts
4 | {
5 | ///
6 | /// Provides the callback interface for service state changes.
7 | ///
8 | [ServiceContract(Namespace = null, Name = "ServiceStateChangedCallback")]
9 | public interface IServiceStateChanged
10 | {
11 | ///
12 | /// Called when the state of the service changes.
13 | ///
14 | /// The state of the service before the change.
15 | /// The state of the service after the change.
16 | void OnServiceStateChanged(ServiceState oldState, ServiceState newState);
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Core/OpenStory/Cryptography/HeartbeatCrypto.cs:
--------------------------------------------------------------------------------
1 | namespace OpenStory.Cryptography
2 | {
3 | ///
4 | /// Some kinda magic used to please the HackShield gods.
5 | ///
6 | public sealed class HeartbeatCrypto
7 | {
8 | ///
9 | /// Transforms the provided heartbeat request.
10 | ///
11 | public static int TransformClientRequest(int request)
12 | {
13 | int right = request & (~0x7F);
14 | int middleRight = request & (~0x1F);
15 | int middleLeft = (request & (0x18)) ^ 0x10;
16 | int left = 7 - (request & 7);
17 |
18 | int response = (right | middleRight | middleLeft | left) - 1;
19 | return response;
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/OpenStory-Core.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 2012
4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenStory", "Core\OpenStory\OpenStory.csproj", "{5BEF25E3-9B8F-4E67-8B95-5DD39520D60E}"
5 | EndProject
6 | Global
7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
8 | Debug|x86 = Debug|x86
9 | Release|x86 = Release|x86
10 | EndGlobalSection
11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
12 | {5BEF25E3-9B8F-4E67-8B95-5DD39520D60E}.Debug|x86.ActiveCfg = Debug|Any CPU
13 | {5BEF25E3-9B8F-4E67-8B95-5DD39520D60E}.Release|x86.ActiveCfg = Release|Any CPU
14 | EndGlobalSection
15 | GlobalSection(SolutionProperties) = preSolution
16 | HideSolutionNode = FALSE
17 | EndGlobalSection
18 | EndGlobal
19 |
--------------------------------------------------------------------------------
/Server/OpenStory.Framework.Model.Common/Inventory.cs:
--------------------------------------------------------------------------------
1 | namespace OpenStory.Framework.Model.Common
2 | {
3 | ///
4 | /// Represents a strongly-typed game inventory.
5 | ///
6 | /// The type of the items in the inventory.
7 | public abstract class Inventory : ItemContainer
8 | where TItemInfo : ItemInfo
9 | {
10 | ///
11 | /// Initializes a new instance of .
12 | ///
13 | /// The initial slot capacity.
14 | ///
15 | protected Inventory(int slotCapacity)
16 | : base(slotCapacity)
17 | {
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/Server/OpenStory.Framework.Model.Common/AccountStatus.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace OpenStory.Framework.Model.Common
4 | {
5 | ///
6 | /// The status of an account.
7 | ///
8 | [Serializable]
9 | public enum AccountStatus
10 | {
11 | ///
12 | /// The account has never been accessed.
13 | ///
14 | FirstRun = 0,
15 |
16 | ///
17 | /// The account has been accessed at least once.
18 | ///
19 | Active = 1,
20 |
21 | ///
22 | /// The account is blocked.
23 | ///
24 | Blocked = 2,
25 |
26 | ///
27 | /// The account has been deleted.
28 | ///
29 | Deleted = 3
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/Core/OpenStory/Networking/IDescriptorContainer.cs:
--------------------------------------------------------------------------------
1 | using System.Net.Sockets;
2 |
3 | namespace OpenStory.Networking
4 | {
5 | ///
6 | /// A container for instances.
7 | ///
8 | public interface IDescriptorContainer
9 | {
10 | ///
11 | /// Gets the network socket for the session.
12 | ///
13 | Socket Socket { get; }
14 |
15 | ///
16 | /// Gets a value indicating whether the session is active.
17 | ///
18 | bool IsActive { get; }
19 |
20 | ///
21 | /// Closes the session.
22 | ///
23 | /// The reason for closing the connection.
24 | void Close(string reason);
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Core/OpenStory/Networking/INetworkSession.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace OpenStory.Networking
4 | {
5 | ///
6 | /// Provides some network-related stuff.
7 | ///
8 | public interface INetworkSession
9 | {
10 | ///
11 | /// Occurs when the session begins closing.
12 | ///
13 | event EventHandler Closing;
14 |
15 | ///
16 | /// Occurs when there's a connection error.
17 | ///
18 | event EventHandler SocketError;
19 |
20 | ///
21 | /// Closes the session.
22 | ///
23 | /// The reason for closing the session.
24 | void Close(string reason);
25 | }
26 | }
--------------------------------------------------------------------------------
/Server/OpenStory.Server.Auth/AuthOperator.cs:
--------------------------------------------------------------------------------
1 | using OpenStory.Server.Processing;
2 | using OpenStory.Services.Contracts;
3 |
4 | namespace OpenStory.Server.Auth
5 | {
6 | ///
7 | /// Represents an authentication server operator.
8 | ///
9 | public sealed class AuthOperator : ServerOperator
10 | {
11 | private AuthConfiguration _authConfiguration;
12 |
13 | ///
14 | public AuthOperator(IGameClientFactory gameClientFactory)
15 | : base(gameClientFactory)
16 | {
17 | }
18 |
19 | ///
20 | public override void Configure(OsServiceConfiguration configuration)
21 | {
22 | _authConfiguration = new AuthConfiguration(configuration);
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Server/OpenStory.Server.Channel/ChannelClient.cs:
--------------------------------------------------------------------------------
1 | using Ninject.Extensions.Logging;
2 | using OpenStory.Framework.Contracts;
3 | using OpenStory.Server.Processing;
4 |
5 | namespace OpenStory.Server.Channel
6 | {
7 | ///
8 | /// Represents a network client for a channel server.
9 | ///
10 | public sealed class ChannelClient : ClientBase
11 | {
12 | ///
13 | public ChannelClient(IServerSession serverSession, IPacketFactory packetFactory, ILogger logger)
14 | : base(serverSession, packetFactory, logger)
15 | {
16 | }
17 |
18 | ///
19 | protected override void ProcessPacket(PacketProcessingEventArgs args)
20 | {
21 | // TODO: Channel packet handling, hello?
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Core/OpenStory/Common/Game/IChannel.cs:
--------------------------------------------------------------------------------
1 | namespace OpenStory.Common.Game
2 | {
3 | ///
4 | /// Provides properties for game channels.
5 | ///
6 | public interface IChannel
7 | {
8 | ///
9 | /// Gets the numeric channel identifier.
10 | ///
11 | byte ChannelId { get; }
12 |
13 | ///
14 | /// Gets the numeric world identifier.
15 | ///
16 | byte WorldId { get; }
17 |
18 | ///
19 | /// Gets the name of the channel.
20 | ///
21 | string Name { get; }
22 |
23 | ///
24 | /// Gets a non-negative integer denoting how populated the channel is.
25 | ///
26 | int ChannelLoad { get; }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/Tests/OpenStory.Server.Tests/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/Core/OpenStory/Common/Game/PinResponseType.cs:
--------------------------------------------------------------------------------
1 | namespace OpenStory.Common.Game
2 | {
3 | ///
4 | /// The results of PIN operations.
5 | ///
6 | public enum PinResponseType
7 | {
8 | ///
9 | /// The specified PIN was accepted.
10 | ///
11 | [PacketValue(0)]
12 | PinAccepted,
13 |
14 | ///
15 | /// Set the specified PIN.
16 | ///
17 | [PacketValue(1)]
18 | SetPin,
19 |
20 | ///
21 | /// The entered PIN was invalid.
22 | ///
23 | [PacketValue(2)]
24 | InvalidPin,
25 |
26 | ///
27 | /// Check the entered PIN.
28 | ///
29 | [PacketValue(4)]
30 | CheckPin,
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/Core/OpenStory/Networking/SocketErrorEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Net.Sockets;
3 |
4 | namespace OpenStory.Networking
5 | {
6 | ///
7 | /// An EventArgs wrapper around .
8 | ///
9 | public sealed class SocketErrorEventArgs : EventArgs
10 | {
11 | ///
12 | /// Gets the wrapped SocketError.
13 | ///
14 | public SocketError Error { get; private set; }
15 |
16 | ///
17 | /// Initializes a new instance of the class.
18 | ///
19 | /// The to wrap.
20 | public SocketErrorEventArgs(SocketError error)
21 | {
22 | Error = error;
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Server/OpenStory.Server.World/WorldConfiguration.cs:
--------------------------------------------------------------------------------
1 | using OpenStory.Services.Contracts;
2 |
3 | namespace OpenStory.Server.World
4 | {
5 | ///
6 | /// Represents a configuration for a world server.
7 | ///
8 | public sealed class WorldConfiguration
9 | {
10 | ///
11 | /// Gets the configured world identifier.
12 | ///
13 | public int WorldId { get; private set; }
14 |
15 | ///
16 | /// Initializes a new instance of the class.
17 | ///
18 | ///
19 | public WorldConfiguration(OsServiceConfiguration configuration)
20 | {
21 | WorldId = configuration.Get("World");
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Tests/OpenStory.Tests.Integration/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Server/OpenStory.Server.Nexus/NexusServer.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Linq;
3 | using OpenStory.Common.Game;
4 | using OpenStory.Server.Processing;
5 | using OpenStory.Services.Contracts;
6 |
7 | namespace OpenStory.Server.Nexus
8 | {
9 | internal sealed class NexusServer : GameServerBase, IAuthToNexusRequestHandler
10 | {
11 | private readonly WorldContainer _worldContainer;
12 |
13 | public NexusServer(WorldContainer worldContainer)
14 | {
15 | _worldContainer = worldContainer;
16 | }
17 |
18 | ///
19 | public IEnumerable GetWorlds()
20 | {
21 | var services = _worldContainer.ToList();
22 | var details = services.Select(w => w.GetDetails()).AsParallel();
23 | return details.ToList();
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Core/OpenStory/Common/PacketValueAttribute.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace OpenStory.Common
4 | {
5 | ///
6 | /// Used to decorate members with their corresponding value in a serialized packet.
7 | ///
8 | [AttributeUsage(AttributeTargets.Field, AllowMultiple = false)]
9 | public sealed class PacketValueAttribute : Attribute
10 | {
11 | ///
12 | /// Initializes a new instance of the class.
13 | ///
14 | /// The packet value to set.
15 | public PacketValueAttribute(int value)
16 | {
17 | Value = value;
18 | }
19 |
20 | ///
21 | /// Gets the packet value for this attribute.
22 | ///
23 | public int Value { get; }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Server/OpenStory.Framework.Model.Common/WorldInfo.cs:
--------------------------------------------------------------------------------
1 | namespace OpenStory.Framework.Model.Common
2 | {
3 | ///
4 | /// An object mapping for the World table.
5 | ///
6 | public sealed class WorldInfo
7 | {
8 | ///
9 | /// Gets the world ID.
10 | ///
11 | public byte WorldId { get; set; }
12 |
13 | ///
14 | /// Gets the world name.
15 | ///
16 | public string WorldName { get; set; }
17 |
18 | ///
19 | /// Gets the number of channels in the world.
20 | ///
21 | public int ChannelCount { get; set; }
22 |
23 | ///
24 | /// Initializes a new instance of the class.
25 | ///
26 | public WorldInfo()
27 | {
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/Core/OpenStory/Networking/readme.md:
--------------------------------------------------------------------------------
1 | # `OpenStory.Networking`
2 |
3 | This is the networking component of OpenStory. Duh.
4 |
5 | ## Credits
6 |
7 | This is roughly inspired by Astaelan's Chronicle project. People who have seen it will notice the usage of the word "Descriptor".
8 |
9 | ## Points of interest
10 |
11 | ### `NetworkSession` and `EncryptedNetworkSession` classes
12 |
13 | These are the classes which handle the sending and receiving of packet data. `EncryptedNetworkSession` is a decorator around `NetworkSession`, which does the encryption and decryption along with the rest.
14 |
15 | ### `SendDescriptor` class
16 |
17 | This is a nifty class which handles outbound packets. Asynchronously. You can find interesting notes in the code itself.
18 |
19 | ### `ReceiveDescriptor` class
20 |
21 | This is a nifty class which handles inbound packets. Asynchronously. You can find interesting notes in the code itself.
--------------------------------------------------------------------------------
/Tests/OpenStory.Server.Tests/IvGeneratorFixture.cs:
--------------------------------------------------------------------------------
1 | using System.Linq;
2 | using System.Security.Cryptography;
3 | using Moq;
4 | using NUnit.Framework;
5 |
6 | namespace OpenStory.Server
7 | {
8 | [Category("OpenStory.Server")]
9 | [TestFixture]
10 | public class IvGeneratorFixture
11 | {
12 | [Test]
13 | public void GetNewIv_Should_Call_GetNonZeroBytes_Once()
14 | {
15 | var rngMock = new Mock(MockBehavior.Loose);
16 | var generator = new IvGenerator(rngMock.Object);
17 |
18 | generator.GetNewIv();
19 |
20 | rngMock.Verify(rng => rng.GetNonZeroBytes(ZeroByteArrayWithLength4()), Times.Once());
21 | }
22 |
23 | private static byte[] ZeroByteArrayWithLength4()
24 | {
25 | return It.Is(bytes => bytes.Length == 4 && bytes.All(b => b == 0));
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/Server/OpenStory.Server.Channel/ChannelConfiguration.cs:
--------------------------------------------------------------------------------
1 | using OpenStory.Services.Contracts;
2 |
3 | namespace OpenStory.Server.Channel
4 | {
5 | ///
6 | /// Represents a configuration for a channel server.
7 | ///
8 | public sealed class ChannelConfiguration : ServerConfiguration
9 | {
10 | ///
11 | /// Gets the configured channel identifier.
12 | ///
13 | public int ChannelId { get; private set; }
14 |
15 | ///
16 | /// Initializes a new instance of the class.
17 | ///
18 | ///
19 | public ChannelConfiguration(OsServiceConfiguration configuration)
20 | : base(configuration)
21 | {
22 | ChannelId = configuration.Get("Channel");
23 | }
24 | }
25 | }
--------------------------------------------------------------------------------
/Core/OpenStory/Networking/ConnectionClosingEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace OpenStory.Networking
4 | {
5 | ///
6 | /// Describes a reason for the connection being closed.
7 | ///
8 | public class ConnectionClosingEventArgs : EventArgs
9 | {
10 | internal static readonly ConnectionClosingEventArgs NoReason = new ConnectionClosingEventArgs("(no reason supplied)");
11 |
12 | ///
13 | /// Gets the reason for the event.
14 | ///
15 | public string Reason { get; private set; }
16 |
17 | ///
18 | /// Initializes a new instance of the class.
19 | ///
20 | internal ConnectionClosingEventArgs(string reason)
21 | {
22 | Guard.NotNullOrEmpty(() => reason, reason);
23 | Reason = reason;
24 | }
25 | }
26 | }
--------------------------------------------------------------------------------
/Server/OpenStory.Framework.Contracts/IBanProvider.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace OpenStory.Framework.Contracts
4 | {
5 | ///
6 | /// Provides methods for operating with bans.
7 | ///
8 | public interface IBanProvider
9 | {
10 | ///
11 | /// Bans an account by its identifier.
12 | ///
13 | /// The unique identifier of the account.
14 | /// A reason for the ban.
15 | /// An optional expiration date and time. The default value is .
16 | /// if the ban was successful; otherwise, .
17 | bool BanByAccountId(int accountId, string reason, DateTimeOffset? expiration = null);
18 |
19 | // TODO: more stuff to add here.
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/Server/OpenStory.Framework.Model.Common/CharacterAppearance.cs:
--------------------------------------------------------------------------------
1 | using OpenStory.Common.Game;
2 |
3 | namespace OpenStory.Framework.Model.Common
4 | {
5 | ///
6 | /// Represents a game player's appearance characteristics.
7 | ///
8 | public class CharacterAppearance
9 | {
10 | ///
11 | /// Gets the Gender of the Character.
12 | ///
13 | public Gender Gender { get; set; }
14 |
15 | ///
16 | /// Gets the ID of the Character's hair.
17 | ///
18 | public int HairId { get; set; }
19 |
20 | ///
21 | /// Gets the ID of the Character's face.
22 | ///
23 | public int FaceId { get; set; }
24 |
25 | ///
26 | /// Gets the ID of the Character's skin color.
27 | ///
28 | public int SkinColorId { get; set; }
29 | }
30 | }
--------------------------------------------------------------------------------
/Server/OpenStory.Framework.Contracts/IAccountProvider.cs:
--------------------------------------------------------------------------------
1 | using OpenStory.Framework.Model.Common;
2 |
3 | namespace OpenStory.Framework.Contracts
4 | {
5 | ///
6 | /// Provides methods for data operations with accounts.
7 | ///
8 | public interface IAccountProvider
9 | {
10 | ///
11 | /// Retrieves an instance of for the account with the specified user name.
12 | ///
13 | /// The user name of the account.
14 | /// an instance of , or if no account was found.
15 | Account LoadByUserName(string userName);
16 |
17 | ///
18 | /// Saves the provided account object.
19 | ///
20 | /// The account to save.
21 | void Save(Account account);
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Server/OpenStory.Server.World/WorldServerModule.cs:
--------------------------------------------------------------------------------
1 | using Ninject.Modules;
2 | using OpenStory.Framework.Contracts;
3 | using OpenStory.Services.Contracts;
4 |
5 | namespace OpenStory.Server.World
6 | {
7 | ///
8 | /// World server module.
9 | ///
10 | public sealed class WorldServerModule : NinjectModule
11 | {
12 | ///
13 | public override void Load()
14 | {
15 | // No dependencies
16 | Bind>().To().InSingletonScope();
17 | Bind().To().InSingletonScope();
18 |
19 | // WorldServer
20 | // ^ IServiceContainer, ChannelContainer, IWorldInfoProvider
21 | Bind().To().InSingletonScope();
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Core/OpenStory/Common/Game/ItemType.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace OpenStory.Common.Game
4 | {
5 | ///
6 | /// The type of an item.
7 | ///
8 | [Serializable]
9 | public enum ItemType
10 | {
11 | ///
12 | /// Default value.
13 | ///
14 | Unknown = 0,
15 |
16 | ///
17 | /// The item is an equip. It does not stack with
18 | /// other items and has a unique identifier.
19 | ///
20 | Equip = 1,
21 |
22 | ///
23 | /// The item is generic. It usually stacks with other items
24 | /// and usually does not have a unique identifier.
25 | ///
26 | Item = 2,
27 |
28 | ///
29 | /// This item is a pet. It does not stack with other items and it has a pet identifier.
30 | ///
31 | Pet = 3
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/Tests/OpenStory.Tests/OpenStory.Tests.csproj.DotSettings:
--------------------------------------------------------------------------------
1 |
2 | No
3 | False
4 | True
5 | True
6 | True
--------------------------------------------------------------------------------
/Core/OpenStory/OpenStory.csproj.DotSettings:
--------------------------------------------------------------------------------
1 |
2 | True
3 | True
4 | True
5 | True
6 | True
--------------------------------------------------------------------------------
/Core/OpenStory/Networking/DataArrivedEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace OpenStory.Networking
4 | {
5 | ///
6 | /// Provides access to properties related to an DataArrived event.
7 | ///
8 | public sealed class DataArrivedEventArgs : EventArgs
9 | {
10 | ///
11 | /// Gets the newly arrived data.
12 | ///
13 | public byte[] Data { get; private set; }
14 |
15 | ///
16 | /// Initializes a new instance of the class.
17 | ///
18 | /// The data encapsulated in this instance.
19 | ///
20 | /// Thrown if is .
21 | ///
22 | internal DataArrivedEventArgs(byte[] data)
23 | {
24 | Guard.NotNull(() => data, data);
25 |
26 | Data = data;
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/Core/OpenStory/Common/Game/IWorld.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 |
3 | namespace OpenStory.Common.Game
4 | {
5 | ///
6 | /// Provides properties of a game World.
7 | ///
8 | public interface IWorld
9 | {
10 | ///
11 | /// Gets the internal ID of the World.
12 | ///
13 | int Id { get; }
14 |
15 | ///
16 | /// Gets the name of the World.
17 | ///
18 | string Name { get; }
19 |
20 | ///
21 | /// Gets the number of channels in the World.
22 | ///
23 | int ChannelCount { get; }
24 |
25 | ///
26 | /// Gets the for the World.
27 | ///
28 | ServerStatus Status { get; }
29 |
30 | ///
31 | /// Gets an enumerable list of channels for the World.
32 | ///
33 | IEnumerable Channels { get; }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/Server/OpenStory.Framework.Contracts/IWorldInfoProvider.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using OpenStory.Framework.Model.Common;
3 |
4 | namespace OpenStory.Framework.Contracts
5 | {
6 | ///
7 | /// Provides methods for accessing world configuration data.
8 | ///
9 | public interface IWorldInfoProvider
10 | {
11 | ///
12 | /// Gets the configuration data for a world.
13 | ///
14 | /// The identifier of the world.
15 | /// an instance of representing the record in the database, or if none was found.
16 | WorldInfo GetWorldById(int id);
17 |
18 | ///
19 | /// Gets an over all the worlds in the database.
20 | ///
21 | /// a sequence with all the worlds in the database.
22 | IEnumerable GetAllWorlds();
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Server/OpenStory.Server.World/StubWorldInfoProvider.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using OpenStory.Framework.Contracts;
3 | using OpenStory.Framework.Model.Common;
4 |
5 | namespace OpenStory.Server.World
6 | {
7 | ///
8 | /// Provides... world info...
9 | ///
10 | internal sealed class StubWorldInfoProvider : IWorldInfoProvider
11 | {
12 | private readonly Dictionary _worlds =
13 | new Dictionary()
14 | {
15 | { 1, new WorldInfo() { WorldId = 1, WorldName = "Tespia", ChannelCount = 1, } }
16 | };
17 |
18 | ///
19 | public WorldInfo GetWorldById(int id)
20 | {
21 | WorldInfo worldInfo;
22 | _worlds.TryGetValue(id, out worldInfo);
23 | return worldInfo;
24 | }
25 |
26 | ///
27 | public IEnumerable GetAllWorlds()
28 | {
29 | return _worlds.Values;
30 | }
31 | }
32 | }
--------------------------------------------------------------------------------
/Core/OpenStory/Common/Game/GuildRank.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace OpenStory.Common.Game
4 | {
5 | ///
6 | /// A guild rank.
7 | ///
8 | [Serializable]
9 | public enum GuildRank
10 | {
11 | ///
12 | /// Default value
13 | ///
14 | None = 0,
15 |
16 | ///
17 | /// The rank given to the leader of a guild.
18 | ///
19 | Master = 1,
20 |
21 | ///
22 | /// The rank given to the assistants of a guild's leader.
23 | ///
24 | JuniorMaster = 2,
25 |
26 | ///
27 | /// Generic high-ranked member.
28 | ///
29 | HighMember = 3,
30 |
31 | ///
32 | /// Generic middle-ranked member.
33 | ///
34 | MediumMember = 4,
35 |
36 | ///
37 | /// Generic low-ranked member.
38 | ///
39 | LowMember = 5
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/Core/OpenStory/Common/Game/InventoryType.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace OpenStory.Common.Game
4 | {
5 | ///
6 | /// The type of an inventory.
7 | ///
8 | [Serializable]
9 | public enum InventoryType
10 | {
11 | ///
12 | /// Default value.
13 | ///
14 | Undefined = 0,
15 |
16 | ///
17 | /// The inventory contains equips.
18 | ///
19 | Equip = 1,
20 |
21 | ///
22 | /// The inventory contains useable items.
23 | ///
24 | Use = 2,
25 |
26 | ///
27 | /// The inventory contains setup items.
28 | ///
29 | Setup = 3,
30 |
31 | ///
32 | /// The inventory contains miscellaneous items.
33 | ///
34 | Etc = 4,
35 |
36 | ///
37 | /// The inventory contains Cash Shop items.
38 | ///
39 | Cash = 5,
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/Server/OpenStory.Server/Processing/ConfiguredHandshakeInfo.cs:
--------------------------------------------------------------------------------
1 | using OpenStory.Common.IO;
2 | using OpenStory.Services.Contracts;
3 |
4 | namespace OpenStory.Server.Processing
5 | {
6 | internal sealed class ConfiguredHandshakeInfo : HandshakeInfo
7 | {
8 | ///
9 | /// Initializes a new instance of the class.
10 | ///
11 | /// The server configuration.
12 | /// The client cryptographic IV.
13 | /// The server cryptographic IV.
14 | public ConfiguredHandshakeInfo(ServerConfiguration configuration, byte[] clientIv, byte[] serverIv)
15 | {
16 | Header = configuration.Header;
17 | Version = configuration.Version;
18 | Subversion = configuration.Subversion;
19 | LocaleId = configuration.LocaleId;
20 |
21 | ClientIv = clientIv;
22 | ServerIv = serverIv;
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Core/OpenStory/readme.md:
--------------------------------------------------------------------------------
1 | # OpenStory Core
2 |
3 | Hello.
4 |
5 | This folder contains the endpoint-invariant components of the library. Or in words niblets can understand, this means the code here can (and *should*) be used by clients and servers alike.
6 |
7 | # Namespaces
8 |
9 | ## `Common`
10 |
11 | `OpenStory.Common` contains logic that is endpoint-invariant for MapleStory, and also other utility classes and methods which are used across the OpenStory project. In other words, mostly boilerplate stuff. It tends to be riddled with parameter checking and XML documentation. If you find a place to add more of those, do so with pride!
12 |
13 | ## `Cryptography`
14 |
15 | `OpenStory.Cryptography` contains cryptography logic... duh. Go check its readme for the details.
16 |
17 | ## `Networking`
18 |
19 | `OpenStory.Networking` contains network handling logic for the socket accept process, and packet sending and receiving. It is written using the asynchronous execution pattern (`BeginReceive`, `EndReceive`, `BeginSend`, `EndSend`, etc.), it is however *not* multi-threaded.
20 |
--------------------------------------------------------------------------------
/Server/OpenStory.Server/Networking/SocketEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Net.Sockets;
3 |
4 | namespace OpenStory.Server.Networking
5 | {
6 | ///
7 | /// Represents an EventArgs wrapper around a Socket.
8 | ///
9 | public sealed class SocketEventArgs : EventArgs
10 | {
11 | ///
12 | /// Gets the socket of this instance.
13 | ///
14 | public Socket Socket { get; private set; }
15 |
16 | ///
17 | /// Initializes a new instance of the class.
18 | ///
19 | /// The socket for this instance.
20 | /// Thrown if is .
21 | public SocketEventArgs(Socket socket)
22 | {
23 | if (socket == null)
24 | {
25 | throw new ArgumentNullException(nameof(socket));
26 | }
27 |
28 | Socket = socket;
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/Core/OpenStory/Common/Game/KeyBinding.cs:
--------------------------------------------------------------------------------
1 | namespace OpenStory.Common.Game
2 | {
3 | ///
4 | /// Represents a key mapping for an in-game action.
5 | ///
6 | public sealed class KeyBinding
7 | {
8 | ///
9 | /// Gets the type of the action type identifier for the .
10 | ///
11 | public byte ActionTypeId { get; }
12 |
13 | ///
14 | /// Gets the action identifier for the .
15 | ///
16 | public int ActionId { get; }
17 |
18 | ///
19 | /// Initializes a new instance of the class.
20 | ///
21 | /// The action type identifier for the binding.
22 | /// The action identifier for the binding.
23 | public KeyBinding(byte actionTypeId, int actionId)
24 | {
25 | ActionTypeId = actionTypeId;
26 | ActionId = actionId;
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/Server/OpenStory.Services.Contracts/IRegisteredService.cs:
--------------------------------------------------------------------------------
1 | using System.ServiceModel;
2 |
3 | namespace OpenStory.Services.Contracts
4 | {
5 | ///
6 | /// Provides basic methods for game services.
7 | ///
8 | [ServiceContract(Namespace = null, Name = "GameService", CallbackContract = typeof(IServiceStateChanged))]
9 | public interface IRegisteredService
10 | {
11 | ///
12 | /// Initializes the service.
13 | ///
14 | [OperationContract]
15 | void Initialize(OsServiceConfiguration serviceConfiguration);
16 |
17 | ///
18 | /// Starts the service.
19 | ///
20 | [OperationContract]
21 | void Start();
22 |
23 | ///
24 | /// Stops the service.
25 | ///
26 | [OperationContract]
27 | void Stop();
28 |
29 | ///
30 | /// Pings the service, causing it to return its state.
31 | ///
32 | [OperationContract]
33 | void Ping();
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/Server/OpenStory.Server.Auth/IAuthenticator.cs:
--------------------------------------------------------------------------------
1 | using OpenStory.Common.Game;
2 | using OpenStory.Common.IO;
3 | using OpenStory.Framework.Model.Common;
4 | using OpenStory.Services.Contracts;
5 |
6 | namespace OpenStory.Server.Auth
7 | {
8 | ///
9 | /// Provides authentication methods.
10 | ///
11 | public interface IAuthenticator
12 | {
13 | ///
14 | /// Attempts to authenticate the given account credentials.
15 | ///
16 | /// An object from which to read the credential information.
17 | /// An variable to hold the resulting session.
18 | /// An variable to hold the loaded account data.
19 | /// an for the operation.
20 | AuthenticationResult Authenticate(IUnsafePacketReader credentialsReader, out IAccountSession session, out Account account);
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Server/OpenStory.Server/IvGenerator.cs:
--------------------------------------------------------------------------------
1 | using System.Security.Cryptography;
2 |
3 | namespace OpenStory.Server
4 | {
5 | ///
6 | /// Represents an object that generates IV byte arrays.
7 | ///
8 | public sealed class IvGenerator
9 | {
10 | private readonly RandomNumberGenerator _randomNumberGenerator;
11 |
12 | ///
13 | /// Initializes a new instance of the class.
14 | ///
15 | /// The random number generator to use.
16 | public IvGenerator(RandomNumberGenerator randomNumberGenerator)
17 | {
18 | _randomNumberGenerator = randomNumberGenerator;
19 | }
20 |
21 | ///
22 | /// Returns a new non-zero 4-byte IV array.
23 | ///
24 | /// a generated 4-byte IV array.
25 | public byte[] GetNewIv()
26 | {
27 | var iv = new byte[4];
28 | _randomNumberGenerator.GetNonZeroBytes(iv);
29 | return iv;
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/Server/OpenStory.Services.Contracts/OpenStory.Services.Contracts.csproj.DotSettings:
--------------------------------------------------------------------------------
1 |
2 | True
3 | True
4 | True
5 | True
6 | True
7 | True
--------------------------------------------------------------------------------
/Server/OpenStory.Services.Contracts/Nexus/IChannelToWorldRequestHandler.cs:
--------------------------------------------------------------------------------
1 | using System.ServiceModel;
2 | using OpenStory.Framework.Model.Common;
3 |
4 | namespace OpenStory.Services.Contracts
5 | {
6 | ///
7 | /// Provides properties and methods which a World Server exposes to a Channel Server.
8 | ///
9 | [ServiceContract(Namespace = null, Name = "ChannelToWorldService")]
10 | public interface IChannelToWorldRequestHandler
11 | {
12 | ///
13 | /// Gets the ID of the World.
14 | ///
15 | int WorldId { [OperationContract] get; }
16 |
17 | ///
18 | /// Broadcasts a message from the specified channel ID, to the specified targets.
19 | ///
20 | /// The ID of the source channel.
21 | /// The IDs of the recipients of the message.
22 | /// The message to broadcast.
23 | [OperationContract]
24 | void BroadcastFromChannel(int channelId, CharacterKey[] targets, byte[] data);
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Core/OpenStory/Networking/PacketReceivedEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using OpenStory.Common.IO;
3 |
4 | namespace OpenStory.Networking
5 | {
6 | ///
7 | /// Represents a received packet that can be passed with a raised event.
8 | ///
9 | public sealed class PacketReceivedEventArgs : EventArgs
10 | {
11 | private readonly byte[] _buffer;
12 |
13 | ///
14 | /// Gets a new for the packet.
15 | ///
16 | public PacketReader Reader => new PacketReader(_buffer);
17 |
18 | ///
19 | /// Initializes a new instance of the class.
20 | ///
21 | /// The packet data.
22 | ///
23 | /// Thrown if is .
24 | ///
25 | public PacketReceivedEventArgs(byte[] packet)
26 | {
27 | Guard.NotNull(() => packet, packet);
28 |
29 | _buffer = packet;
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/Server/OpenStory.Services.Wcf/EnvironmentNexusConnectionProvider.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Ninject.Activation;
3 | using OpenStory.Common;
4 |
5 | namespace OpenStory.Services.Wcf
6 | {
7 | ///
8 | /// Creates objects from data passed during command-line initialization.
9 | ///
10 | public sealed class EnvironmentNexusConnectionProvider : Provider
11 | {
12 | private const string AccessTokenKey = @"AccessToken";
13 |
14 | ///
15 | protected override NexusConnectionInfo CreateInstance(IContext context)
16 | {
17 | var parameters = ParameterList.FromEnvironment();
18 | var accessTokenString = parameters[AccessTokenKey];
19 |
20 | Guid token;
21 | if (!Guid.TryParse(accessTokenString, out token))
22 | {
23 | var error = String.Format(Strings.BootstrapTokenParseError, AccessTokenKey);
24 | throw new FormatException(error);
25 | }
26 |
27 | var info = new NexusConnectionInfo(token);
28 | return info;
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/Server/OpenStory.Server.Channel/Data/BuddyListEntry.cs:
--------------------------------------------------------------------------------
1 | using OpenStory.Framework.Model.Common;
2 |
3 | namespace OpenStory.Server.Channel.Data
4 | {
5 | ///
6 | /// Represents an entry in a player's buddy list.
7 | ///
8 | public class BuddyListEntry : ICharacterExtension
9 | {
10 | ///
11 | /// Gets the identifier of the buddy.
12 | ///
13 | public CharacterKey Key { get; private set; }
14 |
15 | ///
16 | /// Gets the group name of the buddy.
17 | ///
18 | public string Group { get; private set; }
19 |
20 | ///
21 | /// Gets the channel identifier for the buddy.
22 | ///
23 | public int? ChannelId { get; private set; }
24 |
25 | ///
26 | /// Gets a value indicating whether the buddy is currently visible.
27 | ///
28 | public bool Visible { get; private set; }
29 |
30 | ///
31 | /// Gets the status of the buddy.
32 | ///
33 | public BuddyListEntryStatus Status { get; private set; }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/Server/OpenStory.Server.Channel/ChannelServer.cs:
--------------------------------------------------------------------------------
1 | using OpenStory.Server.Processing;
2 | using OpenStory.Services.Contracts;
3 |
4 | namespace OpenStory.Server.Channel
5 | {
6 | ///
7 | /// Represents a channel server.
8 | ///
9 | public class ChannelServer : NetworkServer
10 | {
11 | private readonly IServiceContainer _world;
12 |
13 | ///
14 | /// Initializes a new instance of the class.
15 | ///
16 | public ChannelServer(IServerProcess process, ChannelOperator @operator, IServiceContainer world)
17 | : base(process, @operator)
18 | {
19 | _world = world;
20 | }
21 |
22 | ///
23 | protected override void OnStarting()
24 | {
25 | base.OnStarting();
26 |
27 | _world.Register(Operator);
28 | }
29 |
30 | ///
31 | protected override void OnStopping()
32 | {
33 | _world.Unregister(Operator);
34 |
35 | base.OnStopping();
36 | }
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/Server/OpenStory.Framework.Model.Common/BanType.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace OpenStory.Framework.Model.Common
4 | {
5 | ///
6 | /// The type of a ban.
7 | ///
8 | [Serializable]
9 | public enum BanType
10 | {
11 | ///
12 | /// Default value.
13 | ///
14 | None = 0,
15 |
16 | ///
17 | /// The user is banned by their account ID. They will be able to access other accounts.
18 | ///
19 | AccountId = 1,
20 |
21 | ///
22 | /// The user is banned by their current IP address. They will be able to access the game if their IP address changes.
23 | ///
24 | IpAddress = 2,
25 |
26 | ///
27 | /// The user is banned by their physical device address. They will be able to access the game if they use another device.
28 | ///
29 | MacAddress = 3,
30 |
31 | ///
32 | /// The user is banned by their hard drive's Serial ID. They will be able to access the game from a machine with a different one.
33 | ///
34 | VolumeSerialId = 4
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/Server/OpenStory.Services.Contracts/ServiceState.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace OpenStory.Services.Contracts
4 | {
5 | ///
6 | /// Specifies the operational state of a game service.
7 | ///
8 | [Serializable]
9 | public enum ServiceState
10 | {
11 | ///
12 | /// The state of the service is not known.
13 | ///
14 | Unknown = 0,
15 |
16 | ///
17 | /// The service is not initialized.
18 | ///
19 | NotInitialized,
20 |
21 | ///
22 | /// The service is currently initializing.
23 | ///
24 | Initializing,
25 |
26 | ///
27 | /// The service is ready to start operation.
28 | ///
29 | Ready,
30 |
31 | ///
32 | /// The service is starting operation.
33 | ///
34 | Starting,
35 |
36 | ///
37 | /// The service is operating.
38 | ///
39 | Running,
40 |
41 | ///
42 | /// The service is shutting down.
43 | ///
44 | Stopping,
45 | }
46 | }
--------------------------------------------------------------------------------
/Server/OpenStory.Framework.Contracts/ServerSessionEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace OpenStory.Framework.Contracts
4 | {
5 | ///
6 | /// Contains details for a -related event.
7 | ///
8 | public class ServerSessionEventArgs : EventArgs
9 | {
10 | ///
11 | /// Gets the related object.
12 | ///
13 | public IServerSession ServerSession { get; private set; }
14 |
15 | ///
16 | /// Initializes a new instance of the class.
17 | ///
18 | /// The instance.
19 | ///
20 | /// Thrown if is .
21 | ///
22 | public ServerSessionEventArgs(IServerSession serverSession)
23 | {
24 | if (serverSession == null)
25 | {
26 | throw new ArgumentNullException(nameof(serverSession));
27 | }
28 |
29 | ServerSession = serverSession;
30 | }
31 | }
32 | }
--------------------------------------------------------------------------------
/Server/OpenStory.Server.Nexus/WorldContainer.cs:
--------------------------------------------------------------------------------
1 | using System.Collections;
2 | using System.Collections.Generic;
3 | using OpenStory.Services.Contracts;
4 |
5 | namespace OpenStory.Server.Nexus
6 | {
7 | internal sealed class WorldContainer : IServiceContainer, IEnumerable
8 | {
9 | private readonly Dictionary _worlds;
10 |
11 | public WorldContainer()
12 | {
13 | _worlds = new Dictionary();
14 | }
15 |
16 | ///
17 | public void Register(INexusToWorldRequestHandler world)
18 | {
19 | _worlds.Add(world.WorldId, world);
20 | }
21 |
22 | ///
23 | public void Unregister(INexusToWorldRequestHandler world)
24 | {
25 | _worlds.Remove(world.WorldId);
26 | }
27 |
28 | public IEnumerator GetEnumerator()
29 | {
30 | return _worlds.Values.GetEnumerator();
31 | }
32 |
33 | IEnumerator IEnumerable.GetEnumerator()
34 | {
35 | return GetEnumerator();
36 | }
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/Server/OpenStory.Services.Contracts/Nexus/IWorldToChannelRequestHandler.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.ServiceModel;
3 | using OpenStory.Framework.Model.Common;
4 |
5 | namespace OpenStory.Services.Contracts
6 | {
7 | ///
8 | /// Provides methods for a World Server to operate with a Channel Server.
9 | ///
10 | [ServiceContract(Namespace = null, Name = "WorldToChannelService")]
11 | public interface IWorldToChannelRequestHandler
12 | {
13 | ///
14 | /// Gets the numeric channel identifier.
15 | ///
16 | int ChannelId { [OperationContract] get; }
17 |
18 | ///
19 | /// Gets a non-negative integer denoting how populated the channel is.
20 | ///
21 | int Population { [OperationContract] get; }
22 |
23 | ///
24 | /// Broadcasts a message to the specified targets.
25 | ///
26 | /// The targets to send the message to.
27 | /// The message to send.
28 | [OperationContract]
29 | void BroadcastIntoChannel(IEnumerable targets, byte[] data);
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/Server/OpenStory.Services.Contracts/Account/IAccountSession.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace OpenStory.Services.Contracts
4 | {
5 | ///
6 | /// Provides information for an account session.
7 | ///
8 | public interface IAccountSession : IDisposable
9 | {
10 | ///
11 | /// Gets the identifier for this session.
12 | ///
13 | int SessionId { get; }
14 |
15 | ///
16 | /// Gets the identifier of the account.
17 | ///
18 | int AccountId { get; }
19 |
20 | ///
21 | /// Gets the name of the account.
22 | ///
23 | string AccountName { get; }
24 |
25 | ///
26 | /// Attempts to keep the connection alive.
27 | ///
28 | /// A variable to hold the lag since the last keep alive attempt.
29 | ///
30 | /// if the signal was received successfully and the account was active at that time;
31 | /// if the connection was broken or the account was not active.
32 | ///
33 | bool TryKeepAlive(out TimeSpan lag);
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/Server/OpenStory.Server.World/ChannelContainer.cs:
--------------------------------------------------------------------------------
1 | using System.Collections;
2 | using System.Collections.Generic;
3 | using OpenStory.Services.Contracts;
4 |
5 | namespace OpenStory.Server.World
6 | {
7 | internal sealed class ChannelContainer : IServiceContainer, IEnumerable
8 | {
9 | private readonly Dictionary _channels;
10 |
11 | public ChannelContainer()
12 | {
13 | _channels = new Dictionary();
14 | }
15 |
16 | ///
17 | public void Register(IWorldToChannelRequestHandler channel)
18 | {
19 | _channels.Add(channel.ChannelId, channel);
20 | }
21 |
22 | ///
23 | public void Unregister(IWorldToChannelRequestHandler channel)
24 | {
25 | _channels.Remove(channel.ChannelId);
26 | }
27 |
28 | public IEnumerator GetEnumerator()
29 | {
30 | return _channels.Values.GetEnumerator();
31 | }
32 |
33 | IEnumerator IEnumerable.GetEnumerator()
34 | {
35 | return GetEnumerator();
36 | }
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/Server/OpenStory.Framework.Model.Common/CharacterExtensionComparer.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 |
3 | namespace OpenStory.Framework.Model.Common
4 | {
5 | ///
6 | /// Compares objects that refer to characters.
7 | ///
8 | public class CharacterExtensionComparer : EqualityComparer
9 | {
10 | private readonly IEqualityComparer _keyComparer;
11 |
12 | ///
13 | /// Initializes a new instance of the class.
14 | ///
15 | /// The to use internally.
16 | public CharacterExtensionComparer(IEqualityComparer keyComparer)
17 | {
18 | _keyComparer = keyComparer;
19 | }
20 |
21 | ///
22 | public override bool Equals(ICharacterExtension x, ICharacterExtension y)
23 | {
24 | return _keyComparer.Equals(x.Key, y.Key);
25 | }
26 |
27 | ///
28 | public override int GetHashCode(ICharacterExtension obj)
29 | {
30 | return obj != null ? _keyComparer.GetHashCode(obj.Key) : 0;
31 | }
32 | }
33 | }
--------------------------------------------------------------------------------
/Server/OpenStory.Server.Auth/AuthServerModule.cs:
--------------------------------------------------------------------------------
1 | using Ninject.Extensions.Factory;
2 | using Ninject.Modules;
3 | using OpenStory.Server.Processing;
4 | using OpenStory.Services.Contracts;
5 |
6 | namespace OpenStory.Server.Auth
7 | {
8 | ///
9 | /// Auth server module.
10 | ///
11 | public sealed class AuthServerModule : NinjectModule
12 | {
13 | ///
14 | public override void Load()
15 | {
16 | // AccountSession
17 | // ^ IAccountService
18 | Bind().To();
19 |
20 | // SimpleAuthenticator
21 | // ^ IAccountProvider, IAccountService
22 | Bind().To().InSingletonScope();
23 |
24 | // IGameClientFactory
25 | // ^ AuthClient
26 | // ^ IAuthenticator, IServerSession, IPacketFactory, ILogger (external)
27 | Bind>().ToFactory();
28 |
29 | // AuthOperator
30 | // ^ IGameClientFactory
31 | Bind().To();
32 |
33 | // AuthServer
34 | // ^ IServerProcess, AuthOperator
35 | Bind().To().InSingletonScope();
36 | }
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/Server/OpenStory.Server.Channel/ChannelServerModule.cs:
--------------------------------------------------------------------------------
1 | using Ninject.Extensions.Factory;
2 | using Ninject.Modules;
3 | using OpenStory.Common;
4 | using OpenStory.Server.Processing;
5 | using OpenStory.Services.Contracts;
6 |
7 | namespace OpenStory.Server.Channel
8 | {
9 | ///
10 | /// Channel server module.
11 | ///
12 | public class ChannelServerModule : NinjectModule
13 | {
14 | ///
15 | public override void Load()
16 | {
17 | // No dependencies
18 | Bind().To().InSingletonScope();
19 | Bind().To();
20 |
21 | // IGameClientFactory
22 | // ^ ChannelClient
23 | // ^ IServerSession, IPacketFactory, ILogger (external)
24 | Bind>().ToFactory();
25 |
26 | // ChannelOperator
27 | // ^ IGameClientFactory, IPlayerRegistry
28 | Bind().To();
29 |
30 | // ChannelServer
31 | // ^ IServerProcess, ChannelOperator, IServiceContainer
32 | Bind().To().InSingletonScope();
33 | }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/Server/OpenStory.Server.World/ActiveChannel.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.Serialization;
2 | using OpenStory.Common;
3 | using OpenStory.Common.Game;
4 |
5 | namespace OpenStory.Server.World
6 | {
7 | ///
8 | /// Contains basic information about an active game channel.
9 | ///
10 | [DataContract]
11 | internal sealed class ActiveChannel : IChannel
12 | {
13 | [DataMember]
14 | private readonly AtomicInteger _channelLoad;
15 |
16 | #region IChannel Members
17 |
18 | ///
19 | [DataMember]
20 | public byte ChannelId { get; private set; }
21 |
22 | ///
23 | [DataMember]
24 | public byte WorldId { get; private set; }
25 |
26 | ///
27 | [DataMember]
28 | public string Name { get; private set; }
29 |
30 | ///
31 | int IChannel.ChannelLoad => _channelLoad.Value;
32 |
33 | #endregion
34 |
35 | ///
36 | /// Gets the channel load value holder.
37 | ///
38 | public AtomicInteger ChannelLoad => _channelLoad;
39 |
40 | ///
41 | /// Initializes a new instance of the class.
42 | ///
43 | public ActiveChannel()
44 | {
45 | _channelLoad = 0;
46 | }
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/Server/OpenStory.Server/IPlayer.cs:
--------------------------------------------------------------------------------
1 | using OpenStory.Framework.Model.Common;
2 | using OpenStory.Server.Processing;
3 |
4 | namespace OpenStory.Server
5 | {
6 | ///
7 | /// Provides properties of a Player.
8 | ///
9 | public interface IPlayer
10 | {
11 | ///
12 | /// Gets the unique identifier for the character of this player.
13 | ///
14 | CharacterKey Key { get; }
15 |
16 | ///
17 | /// Gets the appearance information for the character of this player.
18 | ///
19 | CharacterAppearance Appearance { get; }
20 |
21 | ///
22 | /// Gets the ID of the channel the player is currently in.
23 | ///
24 | int ChannelId { get; }
25 |
26 | ///
27 | /// Gets the level of the character.
28 | ///
29 | int Level { get; }
30 |
31 | ///
32 | /// Gets the job ID of the character.
33 | ///
34 | int JobId { get; }
35 |
36 | ///
37 | /// Gets the ID of the map the player is currently in.
38 | ///
39 | int MapId { get; }
40 |
41 | ///
42 | /// Gets the client instance of the player.
43 | ///
44 | ClientBase Client { get; }
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/Core/OpenStory/Common/IO/PacketReadingException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.ComponentModel;
3 | using System.Runtime.Serialization;
4 |
5 | namespace OpenStory.Common.IO
6 | {
7 | ///
8 | /// Thrown when there is a problem with reading a packet.
9 | ///
10 | [Serializable]
11 | [Localizable(true)]
12 | public sealed class PacketReadingException : Exception
13 | {
14 | ///
15 | /// Initializes a new instance of the class.
16 | ///
17 | ///
18 | private PacketReadingException(string message)
19 | : base(message)
20 | {
21 | }
22 |
23 | ///
24 | /// Initializes a new instance of the class.
25 | ///
26 | ///
27 | private PacketReadingException(SerializationInfo info, StreamingContext context)
28 | : base(info, context)
29 | {
30 | }
31 |
32 | ///
33 | /// Constructs a which states that the end of the stream was reached.
34 | ///
35 | public static PacketReadingException EndOfStream()
36 | {
37 | return new PacketReadingException(CommonStrings.EndOfStreamReached);
38 | }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/Server/OpenStory.Services.Contracts/Registry/IRegistryService.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.ServiceModel;
3 |
4 | namespace OpenStory.Services.Contracts
5 | {
6 | ///
7 | /// Provides methods for Game Service Registration
8 | ///
9 | [ServiceContract(Namespace = null, Name = "RegistryService")]
10 | public interface IRegistryService
11 | {
12 | ///
13 | /// Attempts to register a service with the specified configuration.
14 | ///
15 | /// The configuration information for the service.
16 | /// the result of the operation.
17 | [OperationContract]
18 | Guid RegisterService(OsServiceConfiguration configuration);
19 |
20 | ///
21 | /// Attempts to unregister the service with the specified token.
22 | ///
23 | /// The registration token issued when the service was registered.
24 | /// the result of the operation.
25 | [OperationContract]
26 | void UnregisterService(Guid token);
27 |
28 | ///
29 | /// Attempts to retrieve all registered tokens.
30 | ///
31 | /// the result of the operation.
32 | [OperationContract]
33 | Guid[] GetRegistrations();
34 | }
35 | }
--------------------------------------------------------------------------------
/Server/OpenStory.Framework.Model.Common/Character.cs:
--------------------------------------------------------------------------------
1 | namespace OpenStory.Framework.Model.Common
2 | {
3 | ///
4 | /// Represents a base class for Character objects.
5 | ///
6 | public abstract class Character
7 | {
8 | ///
9 | /// Gets the ID of the world the Character resides in.
10 | ///
11 | public int WorldId { get; protected set; }
12 |
13 | ///
14 | /// Gets the unique identifier for this character.
15 | ///
16 | public CharacterKey Key { get; protected set; }
17 |
18 | ///
19 | /// Gets the appearance of the character.
20 | ///
21 | public CharacterAppearance Appearance { get; protected set; }
22 |
23 | ///
24 | /// Gets the ID of the Character's in-game job.
25 | ///
26 | public int JobId { get; set; }
27 |
28 | ///
29 | /// Gets the fame points of the Character.
30 | ///
31 | public int Fame { get; set; }
32 |
33 | ///
34 | /// Gets the level of the Character.
35 | ///
36 | public int Level { get; set; }
37 |
38 | ///
39 | /// Gets the buddy list capacity of the Character.
40 | ///
41 | public int BuddyListCapacity { get; set; }
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/Server/OpenStory.Server/IllegalPacketException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.Serialization;
3 |
4 | namespace OpenStory.Server
5 | {
6 | ///
7 | /// Represents the error when a packet contains incorrect information.
8 | ///
9 | [Serializable]
10 | public class IllegalPacketException : Exception
11 | {
12 | ///
13 | /// Initializes a new instance of the class.
14 | ///
15 | public IllegalPacketException()
16 | {
17 | }
18 |
19 | ///
20 | /// Initializes a new instance of the class.
21 | ///
22 | public IllegalPacketException(string message)
23 | : base(message)
24 | {
25 | }
26 |
27 | ///
28 | /// Initializes a new instance of the class.
29 | ///
30 | public IllegalPacketException(string message, Exception inner)
31 | : base(message, inner)
32 | {
33 | }
34 |
35 | ///
36 | /// Initializes a new instance of the class.
37 | ///
38 | protected IllegalPacketException(SerializationInfo info, StreamingContext context)
39 | : base(info, context)
40 | {
41 | }
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/Core/OpenStory/Common/IO/HandshakeInfo.cs:
--------------------------------------------------------------------------------
1 | namespace OpenStory.Common.IO
2 | {
3 | ///
4 | /// Represents handshake information.
5 | ///
6 | public abstract class HandshakeInfo
7 | {
8 | ///
9 | /// Gets or sets the 16-bit header for the handshake.
10 | ///
11 | public ushort? Header { get; protected set; }
12 |
13 | ///
14 | /// Gets or sets the game version.
15 | ///
16 | public ushort Version { get; protected set; }
17 |
18 | ///
19 | /// Gets or sets the game sub-version.
20 | ///
21 | public string Subversion { get; protected set; }
22 |
23 | ///
24 | /// Gets or sets the Client IV to be used.
25 | ///
26 | public byte[] ClientIv { get; protected set; }
27 |
28 | ///
29 | /// Gets or sets the Server IV to be used.
30 | ///
31 | public byte[] ServerIv { get; protected set; }
32 |
33 | ///
34 | /// Gets or sets the server locale identifier.
35 | ///
36 | public byte LocaleId { get; protected set; }
37 |
38 | ///
39 | /// Initializes a new instance of the class.
40 | ///
41 | protected HandshakeInfo()
42 | {
43 | }
44 | }
45 | }
--------------------------------------------------------------------------------
/Server/OpenStory.Server/Processing/GameServerBase.cs:
--------------------------------------------------------------------------------
1 | using OpenStory.Services.Contracts;
2 |
3 | namespace OpenStory.Server.Processing
4 | {
5 | ///
6 | /// Represents a generic game server.
7 | ///
8 | public abstract class GameServerBase : IRegisteredService
9 | {
10 | ///
11 | public void Initialize(OsServiceConfiguration serviceConfiguration)
12 | {
13 | OnInitializing(serviceConfiguration);
14 | }
15 |
16 | ///
17 | public void Start()
18 | {
19 | OnStarting();
20 | }
21 |
22 | ///
23 | public void Stop()
24 | {
25 | OnStopping();
26 | }
27 |
28 | ///
29 | public void Ping()
30 | {
31 | }
32 |
33 | ///
34 | /// Executed when the server is being initialized.
35 | ///
36 | protected virtual void OnInitializing(OsServiceConfiguration serviceConfiguration)
37 | {
38 | }
39 |
40 | ///
41 | /// Executed when the server is being started.
42 | ///
43 | protected virtual void OnStarting()
44 | {
45 | }
46 |
47 | ///
48 | /// Executed when the server is being stopped.
49 | ///
50 | protected virtual void OnStopping()
51 | {
52 | }
53 | }
54 | }
--------------------------------------------------------------------------------
/OpenStory-Core.sln.DotSettings:
--------------------------------------------------------------------------------
1 |
2 | F:\OpenStory\OpenStory.sln.DotSettings
3 | ..\OpenStory.sln.DotSettings
4 | True
5 | True
6 | 2
7 | True
8 | 1
--------------------------------------------------------------------------------
/Tests/OpenStory.Tests/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 |
4 | // General Information about an assembly is controlled through the following
5 | // set of attributes. Change these attribute values to modify the information
6 | // associated with an assembly.
7 | [assembly: AssemblyTitle("OpenStory.Tests")]
8 | [assembly: AssemblyDescription("")]
9 | [assembly: AssemblyConfiguration("")]
10 | [assembly: AssemblyCompany("")]
11 | [assembly: AssemblyProduct("OpenStory.Tests")]
12 | [assembly: AssemblyCopyright("Copyright © 2012")]
13 | [assembly: AssemblyTrademark("")]
14 | [assembly: AssemblyCulture("")]
15 |
16 | // Setting ComVisible to false makes the types in this assembly not visible
17 | // to COM components. If you need to access a type in this assembly from
18 | // COM, set the ComVisible attribute to true on that type.
19 | [assembly: ComVisible(false)]
20 |
21 | // The following GUID is for the ID of the typelib if this project is exposed to COM
22 | [assembly: Guid("0bb97f62-14f1-4222-8e04-b3d4415b9164")]
23 |
24 | // Version information for an assembly consists of the following four values:
25 | //
26 | // Major Version
27 | // Minor Version
28 | // Build Number
29 | // Revision
30 | //
31 | // You can specify all the values or you can default the Build and Revision Numbers
32 | // by using the '*' as shown below:
33 | // [assembly: AssemblyVersion("1.0.*")]
34 | [assembly: AssemblyVersion("1.0.0.0")]
35 | [assembly: AssemblyFileVersion("1.0.0.0")]
36 |
--------------------------------------------------------------------------------
/Core/OpenStory/Common/Game/AuthenticationResult.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace OpenStory.Common.Game
4 | {
5 | ///
6 | /// A response code for an authentication attempt.
7 | ///
8 | [Serializable]
9 | public enum AuthenticationResult
10 | {
11 | ///
12 | /// Client authenticated.
13 | ///
14 | [PacketValue(0x00)]
15 | Success,
16 |
17 | ///
18 | /// The account has been deleted or is blocked.
19 | ///
20 | [PacketValue(0x03)]
21 | AccountDeletedOrBlocked,
22 |
23 | ///
24 | /// Incorrect password.
25 | ///
26 | [PacketValue(0x04)]
27 | IncorrectPassword,
28 |
29 | ///
30 | /// The user name is not registered
31 | ///
32 | [PacketValue(0x05)]
33 | NotRegistered,
34 |
35 | ///
36 | /// The account already has another session running.
37 | ///
38 | [PacketValue(0x07)]
39 | AlreadyLoggedIn,
40 |
41 | ///
42 | /// The server has too many active connections.
43 | ///
44 | [PacketValue(0x0A)]
45 | TooManyConnections,
46 |
47 | ///
48 | /// This is the first time the account is logged into, show the License Agreement.
49 | ///
50 | [PacketValue(0x17)]
51 | FirstRun,
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/Server/OpenStory.Services.Accounts/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Threading;
3 | using OpenStory.Server.Accounts;
4 | using OpenStory.Services.Contracts;
5 | using OpenStory.Services.Wcf;
6 | using Ninject;
7 |
8 | namespace OpenStory.Services.Account
9 | {
10 | internal static class Program
11 | {
12 | public static void Main()
13 | {
14 | log4net.Config.XmlConfigurator.Configure();
15 |
16 | CreateKernel().Get().Start();
17 | Thread.Sleep(Timeout.Infinite);
18 | }
19 |
20 | private static IKernel CreateKernel()
21 | {
22 | var kernel = new StandardKernel(new AccountServerModule(), new WcfServiceModule());
23 |
24 | kernel.Bind().ToConstant(GetNexusConnectionInfo());
25 | kernel.Bind().ToConstant(GetWcfConfiguration());
26 |
27 | return kernel;
28 | }
29 |
30 | private static NexusConnectionInfo GetNexusConnectionInfo()
31 | {
32 | var accessToken = new Guid("24BBB937-49EE-422C-A040-A42432DAFB3C");
33 | return new NexusConnectionInfo(accessToken);
34 | }
35 |
36 | private static OsWcfConfiguration GetWcfConfiguration()
37 | {
38 | var baseUri = new Uri("net.tcp://localhost:0/OpenStory/Account");
39 | var configuration = OsWcfConfiguration.For(baseUri);
40 | return configuration;
41 | }
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/Server/OpenStory.Services.Auth/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Threading;
3 | using OpenStory.Server;
4 | using OpenStory.Server.Auth;
5 | using OpenStory.Services.Contracts;
6 | using OpenStory.Services.Wcf;
7 | using Ninject;
8 |
9 | namespace OpenStory.Services.Auth
10 | {
11 | internal static class Program
12 | {
13 | public static void Main()
14 | {
15 | log4net.Config.XmlConfigurator.Configure();
16 |
17 | CreateKernel().Get().Start();
18 | Thread.Sleep(Timeout.Infinite);
19 | }
20 |
21 | private static IKernel CreateKernel()
22 | {
23 | var kernel = new StandardKernel(new ServerModule(), new AuthServerModule(), new WcfServiceModule());
24 |
25 | kernel.Rebind().ToConstant(GetNexusConnectionInfo());
26 | kernel.Bind().ToConstant(GetWcfConfiguration());
27 |
28 | return kernel;
29 | }
30 |
31 | private static NexusConnectionInfo GetNexusConnectionInfo()
32 | {
33 | var accessToken = new Guid("18B87A4B-E405-43F4-A1C2-A0AED35E3E15");
34 | return new NexusConnectionInfo(accessToken);
35 | }
36 |
37 | private static OsWcfConfiguration GetWcfConfiguration()
38 | {
39 | var baseUri = new Uri("net.tcp://localhost:0/OpenStory/Auth");
40 | var configuration = OsWcfConfiguration.For(baseUri);
41 | return configuration;
42 | }
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/Tests/OpenStory.Server.Tests/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 |
4 | // General Information about an assembly is controlled through the following
5 | // set of attributes. Change these attribute values to modify the information
6 | // associated with an assembly.
7 | [assembly: AssemblyTitle("OpenStory.Server.Tests")]
8 | [assembly: AssemblyDescription("")]
9 | [assembly: AssemblyConfiguration("")]
10 | [assembly: AssemblyCompany("")]
11 | [assembly: AssemblyProduct("OpenStory.Server.Tests")]
12 | [assembly: AssemblyCopyright("Copyright © 2013")]
13 | [assembly: AssemblyTrademark("")]
14 | [assembly: AssemblyCulture("")]
15 |
16 | // Setting ComVisible to false makes the types in this assembly not visible
17 | // to COM components. If you need to access a type in this assembly from
18 | // COM, set the ComVisible attribute to true on that type.
19 | [assembly: ComVisible(false)]
20 |
21 | // The following GUID is for the ID of the typelib if this project is exposed to COM
22 | [assembly: Guid("6926ada4-c5df-4a1c-a07f-23c758803906")]
23 |
24 | // Version information for an assembly consists of the following four values:
25 | //
26 | // Major Version
27 | // Minor Version
28 | // Build Number
29 | // Revision
30 | //
31 | // You can specify all the values or you can default the Build and Revision Numbers
32 | // by using the '*' as shown below:
33 | // [assembly: AssemblyVersion("1.0.*")]
34 | [assembly: AssemblyVersion("1.0.0.0")]
35 | [assembly: AssemblyFileVersion("1.0.0.0")]
36 |
--------------------------------------------------------------------------------
/Tests/OpenStory.Tests.Helpers/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 |
4 | // General Information about an assembly is controlled through the following
5 | // set of attributes. Change these attribute values to modify the information
6 | // associated with an assembly.
7 | [assembly: AssemblyTitle("OpenStory.TestHelpers")]
8 | [assembly: AssemblyDescription("")]
9 | [assembly: AssemblyConfiguration("")]
10 | [assembly: AssemblyCompany("")]
11 | [assembly: AssemblyProduct("OpenStory.TestHelpers")]
12 | [assembly: AssemblyCopyright("Copyright © 2013")]
13 | [assembly: AssemblyTrademark("")]
14 | [assembly: AssemblyCulture("")]
15 |
16 | // Setting ComVisible to false makes the types in this assembly not visible
17 | // to COM components. If you need to access a type in this assembly from
18 | // COM, set the ComVisible attribute to true on that type.
19 | [assembly: ComVisible(false)]
20 |
21 | // The following GUID is for the ID of the typelib if this project is exposed to COM
22 | [assembly: Guid("8b2d7875-d50f-4ee6-aab5-b31b68903ee9")]
23 |
24 | // Version information for an assembly consists of the following four values:
25 | //
26 | // Major Version
27 | // Minor Version
28 | // Build Number
29 | // Revision
30 | //
31 | // You can specify all the values or you can default the Build and Revision Numbers
32 | // by using the '*' as shown below:
33 | // [assembly: AssemblyVersion("1.0.*")]
34 | [assembly: AssemblyVersion("1.0.0.0")]
35 | [assembly: AssemblyFileVersion("1.0.0.0")]
36 |
--------------------------------------------------------------------------------
/Server/OpenStory.Server.Channel/Player.cs:
--------------------------------------------------------------------------------
1 | using OpenStory.Framework.Model.Common;
2 | using OpenStory.Server.Processing;
3 |
4 | namespace OpenStory.Server.Channel
5 | {
6 | internal sealed partial class Player : IPlayer
7 | {
8 | #region Visible info
9 |
10 | public CharacterKey Key { get; }
11 |
12 | public CharacterAppearance Appearance { get; }
13 |
14 | public int JobId { get; private set; }
15 |
16 | public int Level { get; private set; }
17 |
18 | public int WorldId { get; private set; }
19 |
20 | public int ChannelId { get; private set; }
21 |
22 | public int MapId { get; private set; }
23 |
24 | public int Fame { get; private set; }
25 |
26 | #endregion
27 |
28 | public int Meso { get; private set; }
29 |
30 | public int Experience { get; private set; }
31 |
32 | public ChannelClient Client { get; set; }
33 |
34 | ClientBase IPlayer.Client => Client;
35 |
36 | private Player(ChannelClient client, ChannelCharacter character)
37 | {
38 | Client = client;
39 |
40 | // Get what we can from the transfer object.
41 | Key = character.Key;
42 | WorldId = character.WorldId;
43 |
44 | Appearance = character.Appearance;
45 |
46 | JobId = character.JobId;
47 | Fame = character.Fame;
48 | Level = character.Level;
49 |
50 | // TODO: There are still more things to add to ChannelCharacter
51 | }
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/Server/OpenStory.Server.Nexus/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 |
4 | // General Information about an assembly is controlled through the following
5 | // set of attributes. Change these attribute values to modify the information
6 | // associated with an assembly.
7 | [assembly: AssemblyTitle("OpenStory.Server.Nexus")]
8 | [assembly: AssemblyDescription("")]
9 | [assembly: AssemblyConfiguration("")]
10 | [assembly: AssemblyCompany("")]
11 | [assembly: AssemblyProduct("OpenStory.Server.Nexus")]
12 | [assembly: AssemblyCopyright("Copyright © 2014")]
13 | [assembly: AssemblyTrademark("")]
14 | [assembly: AssemblyCulture("")]
15 |
16 | // Setting ComVisible to false makes the types in this assembly not visible
17 | // to COM components. If you need to access a type in this assembly from
18 | // COM, set the ComVisible attribute to true on that type.
19 | [assembly: ComVisible(false)]
20 |
21 | // The following GUID is for the ID of the typelib if this project is exposed to COM
22 | [assembly: Guid("d62f0e12-0cd3-4513-bb14-7c6f974a1e88")]
23 |
24 | // Version information for an assembly consists of the following four values:
25 | //
26 | // Major Version
27 | // Minor Version
28 | // Build Number
29 | // Revision
30 | //
31 | // You can specify all the values or you can default the Build and Revision Numbers
32 | // by using the '*' as shown below:
33 | // [assembly: AssemblyVersion("1.0.*")]
34 | [assembly: AssemblyVersion("1.0.0.0")]
35 | [assembly: AssemblyFileVersion("1.0.0.0")]
36 |
--------------------------------------------------------------------------------
/Server/OpenStory.Services.Wcf/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 |
4 | // General Information about an assembly is controlled through the following
5 | // set of attributes. Change these attribute values to modify the information
6 | // associated with an assembly.
7 | [assembly: AssemblyTitle("OpenStory.Services.Wcf")]
8 | [assembly: AssemblyDescription("")]
9 | [assembly: AssemblyConfiguration("")]
10 | [assembly: AssemblyCompany("")]
11 | [assembly: AssemblyProduct("OpenStory.Services.Wcf")]
12 | [assembly: AssemblyCopyright("Copyright © 2013")]
13 | [assembly: AssemblyTrademark("")]
14 | [assembly: AssemblyCulture("")]
15 |
16 | // Setting ComVisible to false makes the types in this assembly not visible
17 | // to COM components. If you need to access a type in this assembly from
18 | // COM, set the ComVisible attribute to true on that type.
19 | [assembly: ComVisible(false)]
20 |
21 | // The following GUID is for the ID of the typelib if this project is exposed to COM
22 | [assembly: Guid("d07cf794-c121-4e02-ae22-e324d611085a")]
23 |
24 | // Version information for an assembly consists of the following four values:
25 | //
26 | // Major Version
27 | // Minor Version
28 | // Build Number
29 | // Revision
30 | //
31 | // You can specify all the values or you can default the Build and Revision Numbers
32 | // by using the '*' as shown below:
33 | // [assembly: AssemblyVersion("1.0.*")]
34 | [assembly: AssemblyVersion("1.0.0.0")]
35 | [assembly: AssemblyFileVersion("1.0.0.0")]
36 |
--------------------------------------------------------------------------------
/Server/OpenStory.Server.Accounts/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 |
4 | // General Information about an assembly is controlled through the following
5 | // set of attributes. Change these attribute values to modify the information
6 | // associated with an assembly.
7 | [assembly: AssemblyTitle("OpenStory.Server.Accounts")]
8 | [assembly: AssemblyDescription("")]
9 | [assembly: AssemblyConfiguration("")]
10 | [assembly: AssemblyCompany("")]
11 | [assembly: AssemblyProduct("OpenStory.Server.Accounts")]
12 | [assembly: AssemblyCopyright("Copyright © 2014")]
13 | [assembly: AssemblyTrademark("")]
14 | [assembly: AssemblyCulture("")]
15 |
16 | // Setting ComVisible to false makes the types in this assembly not visible
17 | // to COM components. If you need to access a type in this assembly from
18 | // COM, set the ComVisible attribute to true on that type.
19 | [assembly: ComVisible(false)]
20 |
21 | // The following GUID is for the ID of the typelib if this project is exposed to COM
22 | [assembly: Guid("163c55da-e325-4c22-ae43-eab5b0e68a7a")]
23 |
24 | // Version information for an assembly consists of the following four values:
25 | //
26 | // Major Version
27 | // Minor Version
28 | // Build Number
29 | // Revision
30 | //
31 | // You can specify all the values or you can default the Build and Revision Numbers
32 | // by using the '*' as shown below:
33 | // [assembly: AssemblyVersion("1.0.*")]
34 | [assembly: AssemblyVersion("1.0.0.0")]
35 | [assembly: AssemblyFileVersion("1.0.0.0")]
36 |
--------------------------------------------------------------------------------
/Tests/OpenStory.Tests.Integration/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 |
4 | // General Information about an assembly is controlled through the following
5 | // set of attributes. Change these attribute values to modify the information
6 | // associated with an assembly.
7 | [assembly: AssemblyTitle("OpenStory.Tests.Integration")]
8 | [assembly: AssemblyDescription("")]
9 | [assembly: AssemblyConfiguration("")]
10 | [assembly: AssemblyCompany("")]
11 | [assembly: AssemblyProduct("OpenStory.Tests.Integration")]
12 | [assembly: AssemblyCopyright("Copyright © 2014")]
13 | [assembly: AssemblyTrademark("")]
14 | [assembly: AssemblyCulture("")]
15 |
16 | // Setting ComVisible to false makes the types in this assembly not visible
17 | // to COM components. If you need to access a type in this assembly from
18 | // COM, set the ComVisible attribute to true on that type.
19 | [assembly: ComVisible(false)]
20 |
21 | // The following GUID is for the ID of the typelib if this project is exposed to COM
22 | [assembly: Guid("2ce159c8-e0b1-485a-904f-478029e58b8d")]
23 |
24 | // Version information for an assembly consists of the following four values:
25 | //
26 | // Major Version
27 | // Minor Version
28 | // Build Number
29 | // Revision
30 | //
31 | // You can specify all the values or you can default the Build and Revision Numbers
32 | // by using the '*' as shown below:
33 | // [assembly: AssemblyVersion("1.0.*")]
34 | [assembly: AssemblyVersion("1.0.0.0")]
35 | [assembly: AssemblyFileVersion("1.0.0.0")]
36 |
--------------------------------------------------------------------------------
/Server/OpenStory.Services.Channel/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Threading;
3 | using Ninject;
4 | using OpenStory.Server;
5 | using OpenStory.Server.Channel;
6 | using OpenStory.Services.Contracts;
7 | using OpenStory.Services.Wcf;
8 |
9 | namespace OpenStory.Services.Channel
10 | {
11 | internal static class Program
12 | {
13 | public static void Main()
14 | {
15 | log4net.Config.XmlConfigurator.Configure();
16 |
17 | CreateKernel().Get().Start();
18 | Thread.Sleep(Timeout.Infinite);
19 | }
20 |
21 | private static IKernel CreateKernel()
22 | {
23 | var kernel = new StandardKernel(new ServerModule(), new ChannelServerModule(), new WcfServiceModule());
24 |
25 | kernel.Rebind().ToConstant(GetNexusConnectionInfo());
26 | kernel.Bind().ToConstant(GetWcfConfiguration());
27 |
28 | return kernel;
29 | }
30 |
31 | private static NexusConnectionInfo GetNexusConnectionInfo()
32 | {
33 | var accessToken = new Guid("DEA61FBF-26F6-4F68-9E44-A34ABEEBDB93");
34 | return new NexusConnectionInfo(accessToken);
35 | }
36 |
37 | private static OsWcfConfiguration GetWcfConfiguration()
38 | {
39 | var baseUri = new Uri("net.tcp://localhost:0/OpenStory/Channel");
40 | var configuration = OsWcfConfiguration.For(baseUri);
41 | return configuration;
42 | }
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/Server/OpenStory.Services.Contracts/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 |
4 | // General Information about an assembly is controlled through the following
5 | // set of attributes. Change these attribute values to modify the information
6 | // associated with an assembly.
7 | [assembly: AssemblyTitle("OpenStory.Services.Contracts")]
8 | [assembly: AssemblyDescription("")]
9 | [assembly: AssemblyConfiguration("")]
10 | [assembly: AssemblyCompany("")]
11 | [assembly: AssemblyProduct("OpenStory.Services.Contracts")]
12 | [assembly: AssemblyCopyright("Copyright © 2013")]
13 | [assembly: AssemblyTrademark("")]
14 | [assembly: AssemblyCulture("")]
15 |
16 | // Setting ComVisible to false makes the types in this assembly not visible
17 | // to COM components. If you need to access a type in this assembly from
18 | // COM, set the ComVisible attribute to true on that type.
19 | [assembly: ComVisible(false)]
20 |
21 | // The following GUID is for the ID of the typelib if this project is exposed to COM
22 | [assembly: Guid("3f40cd6c-322d-411e-ba61-4d0fdfe30f24")]
23 |
24 | // Version information for an assembly consists of the following four values:
25 | //
26 | // Major Version
27 | // Minor Version
28 | // Build Number
29 | // Revision
30 | //
31 | // You can specify all the values or you can default the Build and Revision Numbers
32 | // by using the '*' as shown below:
33 | // [assembly: AssemblyVersion("1.0.*")]
34 | [assembly: AssemblyVersion("1.0.0.0")]
35 | [assembly: AssemblyFileVersion("1.0.0.0")]
36 |
--------------------------------------------------------------------------------
/Server/OpenStory.Framework.Contracts/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 |
4 | // General Information about an assembly is controlled through the following
5 | // set of attributes. Change these attribute values to modify the information
6 | // associated with an assembly.
7 | [assembly: AssemblyTitle("OpenStory.Framework.Contracts")]
8 | [assembly: AssemblyDescription("")]
9 | [assembly: AssemblyConfiguration("")]
10 | [assembly: AssemblyCompany("")]
11 | [assembly: AssemblyProduct("OpenStory.Framework.Contracts")]
12 | [assembly: AssemblyCopyright("Copyright © 2013")]
13 | [assembly: AssemblyTrademark("")]
14 | [assembly: AssemblyCulture("")]
15 |
16 | // Setting ComVisible to false makes the types in this assembly not visible
17 | // to COM components. If you need to access a type in this assembly from
18 | // COM, set the ComVisible attribute to true on that type.
19 | [assembly: ComVisible(false)]
20 |
21 | // The following GUID is for the ID of the typelib if this project is exposed to COM
22 | [assembly: Guid("c01aed2b-2570-478d-8cbb-3c86d3566689")]
23 |
24 | // Version information for an assembly consists of the following four values:
25 | //
26 | // Major Version
27 | // Minor Version
28 | // Build Number
29 | // Revision
30 | //
31 | // You can specify all the values or you can default the Build and Revision Numbers
32 | // by using the '*' as shown below:
33 | // [assembly: AssemblyVersion("1.0.*")]
34 | [assembly: AssemblyVersion("1.0.0.0")]
35 | [assembly: AssemblyFileVersion("1.0.0.0")]
36 |
--------------------------------------------------------------------------------
/Server/OpenStory.Framework.Model.Auth/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 |
4 | // General Information about an assembly is controlled through the following
5 | // set of attributes. Change these attribute values to modify the information
6 | // associated with an assembly.
7 | [assembly: AssemblyTitle("OpenStory.Framework.Model.Auth")]
8 | [assembly: AssemblyDescription("")]
9 | [assembly: AssemblyConfiguration("")]
10 | [assembly: AssemblyCompany("")]
11 | [assembly: AssemblyProduct("OpenStory.Framework.Model.Auth")]
12 | [assembly: AssemblyCopyright("Copyright © 2013")]
13 | [assembly: AssemblyTrademark("")]
14 | [assembly: AssemblyCulture("")]
15 |
16 | // Setting ComVisible to false makes the types in this assembly not visible
17 | // to COM components. If you need to access a type in this assembly from
18 | // COM, set the ComVisible attribute to true on that type.
19 | [assembly: ComVisible(false)]
20 |
21 | // The following GUID is for the ID of the typelib if this project is exposed to COM
22 | [assembly: Guid("b25ea7b2-463a-465f-aaca-f4239111c802")]
23 |
24 | // Version information for an assembly consists of the following four values:
25 | //
26 | // Major Version
27 | // Minor Version
28 | // Build Number
29 | // Revision
30 | //
31 | // You can specify all the values or you can default the Build and Revision Numbers
32 | // by using the '*' as shown below:
33 | // [assembly: AssemblyVersion("1.0.*")]
34 | [assembly: AssemblyVersion("1.0.0.0")]
35 | [assembly: AssemblyFileVersion("1.0.0.0")]
36 |
--------------------------------------------------------------------------------
/Server/OpenStory.Server.Auth/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 |
4 | // General Information about an assembly is controlled through the following
5 | // set of attributes. Change these attribute values to modify the information
6 | // associated with an assembly.
7 |
8 | [assembly: AssemblyTitle("OpenStory.Server.Auth")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("OpenStory.Server.Auth")]
13 | [assembly: AssemblyCopyright("Copyright © 2012")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 |
21 | [assembly: ComVisible(false)]
22 |
23 | // The following GUID is for the ID of the typelib if this project is exposed to COM
24 |
25 | [assembly: Guid("70b9f675-224c-4a76-89d1-d20130106b65")]
26 |
27 | // Version information for an assembly consists of the following four values:
28 | //
29 | // Major Version
30 | // Minor Version
31 | // Build Number
32 | // Revision
33 | //
34 | // You can specify all the values or you can default the Build and Revision Numbers
35 | // by using the '*' as shown below:
36 | // [assembly: AssemblyVersion("1.0.*")]
37 |
38 | [assembly: AssemblyVersion("1.0.0.0")]
39 | [assembly: AssemblyFileVersion("1.0.0.0")]
40 |
--------------------------------------------------------------------------------
/Tests/OpenStory.Server.Account.Tests/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 |
4 | // General Information about an assembly is controlled through the following
5 | // set of attributes. Change these attribute values to modify the information
6 | // associated with an assembly.
7 | [assembly: AssemblyTitle("OpenStory.Server.Account.Tests")]
8 | [assembly: AssemblyDescription("")]
9 | [assembly: AssemblyConfiguration("")]
10 | [assembly: AssemblyCompany("")]
11 | [assembly: AssemblyProduct("OpenStory.Server.Account.Tests")]
12 | [assembly: AssemblyCopyright("Copyright © 2013")]
13 | [assembly: AssemblyTrademark("")]
14 | [assembly: AssemblyCulture("")]
15 |
16 | // Setting ComVisible to false makes the types in this assembly not visible
17 | // to COM components. If you need to access a type in this assembly from
18 | // COM, set the ComVisible attribute to true on that type.
19 | [assembly: ComVisible(false)]
20 |
21 | // The following GUID is for the ID of the typelib if this project is exposed to COM
22 | [assembly: Guid("552b763b-51c9-4f33-849e-cfb36eee6ea3")]
23 |
24 | // Version information for an assembly consists of the following four values:
25 | //
26 | // Major Version
27 | // Minor Version
28 | // Build Number
29 | // Revision
30 | //
31 | // You can specify all the values or you can default the Build and Revision Numbers
32 | // by using the '*' as shown below:
33 | // [assembly: AssemblyVersion("1.0.*")]
34 | [assembly: AssemblyVersion("1.0.0.0")]
35 | [assembly: AssemblyFileVersion("1.0.0.0")]
36 |
--------------------------------------------------------------------------------
/Server/OpenStory.Framework.Model.Common/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 |
4 | // General Information about an assembly is controlled through the following
5 | // set of attributes. Change these attribute values to modify the information
6 | // associated with an assembly.
7 | [assembly: AssemblyTitle("OpenStory.Framework.Model.Common")]
8 | [assembly: AssemblyDescription("")]
9 | [assembly: AssemblyConfiguration("")]
10 | [assembly: AssemblyCompany("")]
11 | [assembly: AssemblyProduct("OpenStory.Framework.Model.Common")]
12 | [assembly: AssemblyCopyright("Copyright © 2013")]
13 | [assembly: AssemblyTrademark("")]
14 | [assembly: AssemblyCulture("")]
15 |
16 | // Setting ComVisible to false makes the types in this assembly not visible
17 | // to COM components. If you need to access a type in this assembly from
18 | // COM, set the ComVisible attribute to true on that type.
19 | [assembly: ComVisible(false)]
20 |
21 | // The following GUID is for the ID of the typelib if this project is exposed to COM
22 | [assembly: Guid("7296b53b-79c5-4254-83f3-77afeab82fad")]
23 |
24 | // Version information for an assembly consists of the following four values:
25 | //
26 | // Major Version
27 | // Minor Version
28 | // Build Number
29 | // Revision
30 | //
31 | // You can specify all the values or you can default the Build and Revision Numbers
32 | // by using the '*' as shown below:
33 | // [assembly: AssemblyVersion("1.0.*")]
34 | [assembly: AssemblyVersion("1.0.0.0")]
35 | [assembly: AssemblyFileVersion("1.0.0.0")]
36 |
--------------------------------------------------------------------------------
/Tests/OpenStory.Framework.Contracts.Tests/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 |
4 | // General Information about an assembly is controlled through the following
5 | // set of attributes. Change these attribute values to modify the information
6 | // associated with an assembly.
7 | [assembly: AssemblyTitle("OpenStory.Framework.Contracts.Tests")]
8 | [assembly: AssemblyDescription("")]
9 | [assembly: AssemblyConfiguration("")]
10 | [assembly: AssemblyCompany("")]
11 | [assembly: AssemblyProduct("OpenStory.Framework.Contracts.Tests")]
12 | [assembly: AssemblyCopyright("Copyright © 2013")]
13 | [assembly: AssemblyTrademark("")]
14 | [assembly: AssemblyCulture("")]
15 |
16 | // Setting ComVisible to false makes the types in this assembly not visible
17 | // to COM components. If you need to access a type in this assembly from
18 | // COM, set the ComVisible attribute to true on that type.
19 | [assembly: ComVisible(false)]
20 |
21 | // The following GUID is for the ID of the typelib if this project is exposed to COM
22 | [assembly: Guid("54d153a8-2b49-4c6d-b768-7c10a5915bfe")]
23 |
24 | // Version information for an assembly consists of the following four values:
25 | //
26 | // Major Version
27 | // Minor Version
28 | // Build Number
29 | // Revision
30 | //
31 | // You can specify all the values or you can default the Build and Revision Numbers
32 | // by using the '*' as shown below:
33 | // [assembly: AssemblyVersion("1.0.*")]
34 | [assembly: AssemblyVersion("1.0.0.0")]
35 | [assembly: AssemblyFileVersion("1.0.0.0")]
36 |
--------------------------------------------------------------------------------
/Server/OpenStory.Server.World/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 |
4 | // General Information about an assembly is controlled through the following
5 | // set of attributes. Change these attribute values to modify the information
6 | // associated with an assembly.
7 |
8 | [assembly: AssemblyTitle("OpenStory.Server.World")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("shoftee® Corporation")]
12 | [assembly: AssemblyProduct("OpenStory.Server.World")]
13 | [assembly: AssemblyCopyright("Copyright © shoftee® Corporation 2011")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 |
21 | [assembly: ComVisible(false)]
22 |
23 | // The following GUID is for the ID of the typelib if this project is exposed to COM
24 |
25 | [assembly: Guid("c9be81e4-46c0-4552-97e3-ed680c1ad169")]
26 |
27 | // Version information for an assembly consists of the following four values:
28 | //
29 | // Major Version
30 | // Minor Version
31 | // Build Number
32 | // Revision
33 | //
34 | // You can specify all the values or you can default the Build and Revision Numbers
35 | // by using the '*' as shown below:
36 | // [assembly: AssemblyVersion("1.0.*")]
37 |
38 | [assembly: AssemblyVersion("1.0.0.0")]
39 | [assembly: AssemblyFileVersion("1.0.0.0")]
40 |
--------------------------------------------------------------------------------
/Server/OpenStory.Server/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 |
4 | // General Information about an assembly is controlled through the following
5 | // set of attributes. Change these attribute values to modify the information
6 | // associated with an assembly.
7 |
8 | [assembly: AssemblyTitle("OpenStory.Server")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("shoftee® Corporation")]
12 | [assembly: AssemblyProduct("OpenStory.Server")]
13 | [assembly: AssemblyCopyright("Copyright © shoftee® Corporation 2011")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 |
21 | [assembly: ComVisible(false)]
22 |
23 | // The following GUID is for the ID of the typelib if this project is exposed to COM
24 |
25 | [assembly: Guid("92f5d448-8403-4c85-8171-c696e29f839f")]
26 |
27 | // Version information for an assembly consists of the following four values:
28 | //
29 | // Major Version
30 | // Minor Version
31 | // BuildAndReset Number
32 | // Revision
33 | //
34 | // You can specify all the values or you can default the BuildAndReset and Revision Numbers
35 | // by using the '*' as shown below:
36 | // [assembly: AssemblyVersion("1.0.*")]
37 |
38 | [assembly: AssemblyVersion("1.0.0.0")]
39 | [assembly: AssemblyFileVersion("1.0.0.0")]
40 |
--------------------------------------------------------------------------------
/Server/OpenStory.Server.Channel/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 |
4 | // General Information about an assembly is controlled through the following
5 | // set of attributes. Change these attribute values to modify the information
6 | // associated with an assembly.
7 |
8 | [assembly: AssemblyTitle("OpenStory.Server.Channel")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("shoftee® Corporation")]
12 | [assembly: AssemblyProduct("OpenStory.Server.Channel")]
13 | [assembly: AssemblyCopyright("Copyright © shoftee® Corporation 2011")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 |
21 | [assembly: ComVisible(false)]
22 |
23 | // The following GUID is for the ID of the typelib if this project is exposed to COM
24 |
25 | [assembly: Guid("72be69a3-ae02-4dbf-ac20-5347e2e05961")]
26 |
27 | // Version information for an assembly consists of the following four values:
28 | //
29 | // Major Version
30 | // Minor Version
31 | // Build Number
32 | // Revision
33 | //
34 | // You can specify all the values or you can default the Build and Revision Numbers
35 | // by using the '*' as shown below:
36 | // [assembly: AssemblyVersion("1.0.*")]
37 |
38 | [assembly: AssemblyVersion("1.0.0.0")]
39 | [assembly: AssemblyFileVersion("1.0.0.0")]
40 |
--------------------------------------------------------------------------------
/Server/OpenStory.Server.Auth/AccountSession.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using OpenStory.Framework.Model.Common;
3 | using OpenStory.Services.Contracts;
4 |
5 | namespace OpenStory.Server.Auth
6 | {
7 | ///
8 | /// Simple implementation of
9 | ///
10 | internal sealed class AccountSession : IAccountSession
11 | {
12 | private readonly IAccountService _service;
13 |
14 | ///
15 | public int SessionId { get; }
16 |
17 | ///
18 | public int AccountId { get; }
19 |
20 | ///
21 | public string AccountName { get; }
22 |
23 | ///
24 | /// Initializes a new instance of the class.
25 | ///
26 | /// The managing this session.
27 | /// The session identifier.
28 | /// The loaded session data.
29 | public AccountSession(IAccountService service, int sessionId, Account data)
30 | {
31 | SessionId = sessionId;
32 | AccountId = data.AccountId;
33 | AccountName = data.UserName;
34 |
35 | _service = service;
36 | }
37 |
38 | ///
39 | public bool TryKeepAlive(out TimeSpan lag)
40 | {
41 | return _service.TryKeepAlive(AccountId, out lag);
42 | }
43 |
44 | ///
45 | public void Dispose()
46 | {
47 | _service.TryUnregisterSession(AccountId);
48 | }
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/Server/OpenStory.Services.Contracts/Extensions.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace OpenStory.Services.Contracts
4 | {
5 | ///
6 | /// Provides extension methods. Which are useful. For stuff.
7 | ///
8 | public static class Extensions
9 | {
10 | ///
11 | /// Returns the provided object as an instance of .
12 | ///
13 | public static IDisposable AsDisposable(this object obj)
14 | {
15 | return obj as IDisposable;
16 | }
17 |
18 | ///
19 | /// Calls the specified client action by creating a client instance using the specified service client provider.
20 | ///
21 | public static void Call(this IServiceClientProvider provider, Action action)
22 | where TChannel : class
23 | {
24 | var channel = provider.CreateChannel();
25 | using (channel.AsDisposable())
26 | {
27 | action(channel);
28 | }
29 | }
30 |
31 | ///
32 | /// Calls the specified client function by creating a client instance using the specified service client provider.
33 | ///
34 | public static TResult Call(this IServiceClientProvider provider, Func func)
35 | where TChannel : class
36 | {
37 | var channel = provider.CreateChannel();
38 | using (channel.AsDisposable())
39 | {
40 | var result = func(channel);
41 | return result;
42 | }
43 | }
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/Server/OpenStory.Services.Channel/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 | using log4net.Config;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 |
9 | [assembly: AssemblyTitle("OpenStory.Services.Channel")]
10 | [assembly: AssemblyDescription("")]
11 | [assembly: AssemblyConfiguration("")]
12 | [assembly: AssemblyCompany("")]
13 | [assembly: AssemblyProduct("OpenStory.Services.Channel")]
14 | [assembly: AssemblyCopyright("Copyright © 2014")]
15 | [assembly: AssemblyTrademark("")]
16 | [assembly: AssemblyCulture("")]
17 |
18 | // Setting ComVisible to false makes the types in this assembly not visible
19 | // to COM components. If you need to access a type in this assembly from
20 | // COM, set the ComVisible attribute to true on that type.
21 | [assembly: ComVisible(false)]
22 |
23 | // The following GUID is for the ID of the typelib if this project is exposed to COM
24 | [assembly: Guid("94a866b7-67de-4139-b309-f2029ccf1049")]
25 |
26 | // Version information for an assembly consists of the following four values:
27 | //
28 | // Major Version
29 | // Minor Version
30 | // Build Number
31 | // Revision
32 | //
33 | // You can specify all the values or you can default the Build and Revision Numbers
34 | // by using the '*' as shown below:
35 | // [assembly: AssemblyVersion("1.0.*")]
36 | [assembly: AssemblyVersion("1.0.0.0")]
37 | [assembly: AssemblyFileVersion("1.0.0.0")]
38 |
39 | // The following line configures log4net to watch the default config file for changes.
40 | [assembly: XmlConfigurator(Watch = true)]
41 |
--------------------------------------------------------------------------------
/Server/OpenStory.Services.Simple/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 |
4 | // General Information about an assembly is controlled through the following
5 | // set of attributes. Change these attribute values to modify the information
6 | // associated with an assembly.
7 | using log4net.Config;
8 |
9 | [assembly: AssemblyTitle("OpenStory.Services.Simple")]
10 | [assembly: AssemblyDescription("")]
11 | [assembly: AssemblyConfiguration("")]
12 | [assembly: AssemblyCompany("")]
13 | [assembly: AssemblyProduct("OpenStory.Services.Simple")]
14 | [assembly: AssemblyCopyright("Copyright © shoftee 2014")]
15 | [assembly: AssemblyTrademark("")]
16 | [assembly: AssemblyCulture("")]
17 |
18 | // Setting ComVisible to false makes the types in this assembly not visible
19 | // to COM components. If you need to access a type in this assembly from
20 | // COM, set the ComVisible attribute to true on that type.
21 | [assembly: ComVisible(false)]
22 |
23 | // The following GUID is for the ID of the typelib if this project is exposed to COM
24 | [assembly: Guid("0bc1a467-68c6-41af-ae8f-af35e55ec54c")]
25 |
26 | // Version information for an assembly consists of the following four values:
27 | //
28 | // Major Version
29 | // Minor Version
30 | // Build Number
31 | // Revision
32 | //
33 | // You can specify all the values or you can default the Build and Revision Numbers
34 | // by using the '*' as shown below:
35 | // [assembly: AssemblyVersion("1.0.*")]
36 | [assembly: AssemblyVersion("1.0.0.0")]
37 | [assembly: AssemblyFileVersion("1.0.0.0")]
38 |
39 | // The following line configures log4net to watch the default config file for changes.
40 | [assembly: XmlConfigurator(Watch = true)]
41 |
--------------------------------------------------------------------------------
/Registry/OpenStory.Services.Registry/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 | using log4net.Config;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 |
9 | [assembly: AssemblyTitle("OpenStory.Services.Registry")]
10 | [assembly: AssemblyDescription("")]
11 | [assembly: AssemblyConfiguration("")]
12 | [assembly: AssemblyCompany("")]
13 | [assembly: AssemblyProduct("OpenStory.Services.Registry")]
14 | [assembly: AssemblyCopyright("Copyright © 2012")]
15 | [assembly: AssemblyTrademark("")]
16 | [assembly: AssemblyCulture("")]
17 |
18 | // Setting ComVisible to false makes the types in this assembly not visible
19 | // to COM components. If you need to access a type in this assembly from
20 | // COM, set the ComVisible attribute to true on that type.
21 | [assembly: ComVisible(false)]
22 |
23 | // The following GUID is for the ID of the typelib if this project is exposed to COM
24 | [assembly: Guid("3fa425b4-8631-4d01-82b9-c1667e9d6fee")]
25 |
26 | // Version information for an assembly consists of the following four values:
27 | //
28 | // Major Version
29 | // Minor Version
30 | // Build Number
31 | // Revision
32 | //
33 | // You can specify all the values or you can default the Build and Revision Numbers
34 | // by using the '*' as shown below:
35 | // [assembly: AssemblyVersion("1.0.*")]
36 | [assembly: AssemblyVersion("1.0.0.0")]
37 | [assembly: AssemblyFileVersion("1.0.0.0")]
38 |
39 | // The following line configures log4net to watch the default config file for changes.
40 | [assembly: XmlConfigurator(Watch = true)]
41 |
--------------------------------------------------------------------------------
/Server/OpenStory.Server/ServerModule.cs:
--------------------------------------------------------------------------------
1 | using System.Security.Cryptography;
2 | using Ninject.Extensions.Factory;
3 | using Ninject.Modules;
4 | using OpenStory.Cryptography;
5 | using OpenStory.Framework.Contracts;
6 | using OpenStory.Server.Networking;
7 | using OpenStory.Server.Processing;
8 | using OpenStory.Server.Registry;
9 | using OpenStory.Services.Contracts;
10 |
11 | namespace OpenStory.Server
12 | {
13 | ///
14 | /// Basic server module.
15 | ///
16 | public class ServerModule : NinjectModule
17 | {
18 | ///
19 | public override void Load()
20 | {
21 | // No dependencies
22 | Bind().To().InSingletonScope();
23 | Bind().To();
24 | Bind().To();
25 |
26 | // PacketFactory <= IPacketCodeTable (external)
27 | Bind().To();
28 |
29 | // IvGenerator <= RandomNumberGenerator
30 | Bind().To();
31 | Bind().ToSelf();
32 |
33 | // ServerSession <= IPacketCodeTable (external)
34 | Bind().To();
35 |
36 | // IServerSessionFactory <= IServerSession (external)
37 | // ServerProcess <= ISocketAcceptorFactory, IServerSessionFactory, IvGenerator, ILogger (external)
38 | Bind().ToFactory();
39 | Bind().ToFactory();
40 | Bind().To();
41 | }
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/Core/OpenStory/Cryptography/KmstDecryptor.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using OpenStory.Common;
3 |
4 | namespace OpenStory.Cryptography
5 | {
6 | ///
7 | /// Represents a decryption transformer based on the custom KMST algorithm.
8 | ///
9 | public sealed class KmstDecryptor : CryptoTransformBase
10 | {
11 | ///
12 | /// Initializes a new instance of .
13 | ///
14 | ///
15 | public KmstDecryptor(byte[] table, byte[] vector)
16 | : base(table, vector)
17 | {
18 | }
19 |
20 | ///
21 | public override void TransformArraySegment(byte[] data, byte[] vector, int segmentStart, int segmentEnd)
22 | {
23 | Guard.NotNull(() => data, data);
24 | Guard.NotNull(() => vector, vector);
25 |
26 | if (vector.Length != 4)
27 | {
28 | throw new ArgumentException(CommonStrings.IvMustBe4Bytes, nameof(vector));
29 | }
30 |
31 | // Thanks to Diamondo25 for this.
32 | byte[] stepIv = vector.FastClone();
33 | for (int i = segmentStart; i < segmentEnd; i++)
34 | {
35 | byte initial = data[i];
36 |
37 | byte x = (byte)(initial ^ Table[stepIv[0]]);
38 | byte b = (byte)((x >> 1) & 0x55);
39 | byte a = (byte)((x & 0xD5) << 1);
40 | byte r = (byte)(a | b);
41 |
42 | data[i] = (byte)((r >> 4) | (r << 4));
43 |
44 | // NOTE: passing the new value is CORRECT.
45 | ShuffleIvStep(stepIv, data[i]);
46 | }
47 | }
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/Server/OpenStory.Server.Auth/AuthClientState.cs:
--------------------------------------------------------------------------------
1 | namespace OpenStory.Server.Auth
2 | {
3 | ///
4 | /// Phase of the login process.
5 | ///
6 | public enum AuthClientState
7 | {
8 | ///
9 | /// The client has yet to authenticate. Default value.
10 | ///
11 | NotLoggedIn = 0,
12 |
13 | ///
14 | /// The client has yet to provide the gender for their account.
15 | ///
16 | SetGender,
17 |
18 | ///
19 | /// The client has yet to enter their registered PIN.
20 | ///
21 | AskPin,
22 |
23 | ///
24 | /// The client has yet to register a PIN.
25 | ///
26 | SetPin,
27 |
28 | ///
29 | /// The client has authenticated, but hasn't reached World Select yet.
30 | ///
31 | LoggedIn,
32 |
33 | ///
34 | /// The client is in the world selection screen.
35 | ///
36 | WorldSelect,
37 |
38 | ///
39 | /// The client is in the channel selection screen.
40 | ///
41 | ChannelSelect,
42 |
43 | ///
44 | /// The client is at the character selection screen.
45 | ///
46 | CharacterSelect,
47 |
48 | ///
49 | /// The client has selected a character, but not yet in server transition.
50 | ///
51 | PostCharacterSelect,
52 |
53 | ///
54 | /// The client is in the middle of the server transition.
55 | ///
56 | Transition
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/Core/OpenStory/Cryptography/KmstEncryptor.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using OpenStory.Common;
3 |
4 | namespace OpenStory.Cryptography
5 | {
6 | ///
7 | /// Represents an encryption transformer based on the custom KMST algorithm.
8 | ///
9 | public sealed class KmstEncryptor : CryptoTransformBase
10 | {
11 | ///
12 | /// Initializes a new instance of .
13 | ///
14 | ///
15 | public KmstEncryptor(byte[] table, byte[] vector)
16 | : base(table, vector)
17 | {
18 | }
19 |
20 | ///
21 | public override void TransformArraySegment(byte[] data, byte[] vector, int segmentStart, int segmentEnd)
22 | {
23 | Guard.NotNull(() => data, data);
24 | Guard.NotNull(() => vector, vector);
25 |
26 | if (vector.Length != 4)
27 | {
28 | throw new ArgumentException(CommonStrings.IvMustBe4Bytes, nameof(vector));
29 | }
30 |
31 | // Thanks to Diamondo25 for this.
32 | byte[] stepIv = vector.FastClone();
33 | for (int i = segmentStart; i < segmentEnd; i++)
34 | {
35 | byte initial = data[i];
36 |
37 | byte r = (byte)((initial << 4) | (initial >> 4));
38 | byte a = (byte)((r >> 1) & 0x55);
39 | byte b = (byte)((r & 0xD5) << 1);
40 | byte x = (byte)(a | b);
41 |
42 | data[i] = (byte)(Table[stepIv[0]] ^ x);
43 |
44 | // NOTE: passing the initial value is CORRECT.
45 | ShuffleIvStep(stepIv, initial);
46 | }
47 | }
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/Server/OpenStory.Services.Auth/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 | using log4net.Config;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 |
9 | [assembly: AssemblyTitle("OpenStory.AuthServer")]
10 | [assembly: AssemblyDescription("")]
11 | [assembly: AssemblyConfiguration("")]
12 | [assembly: AssemblyCompany("shoftee® Corporation")]
13 | [assembly: AssemblyProduct("OpenStory.AuthServer")]
14 | [assembly: AssemblyCopyright("Copyright © shoftee® Corporation 2011")]
15 | [assembly: AssemblyTrademark("")]
16 | [assembly: AssemblyCulture("")]
17 |
18 | // Setting ComVisible to false makes the types in this assembly not visible
19 | // to COM components. If you need to access a type in this assembly from
20 | // COM, set the ComVisible attribute to true on that type.
21 |
22 | [assembly: ComVisible(false)]
23 |
24 | // The following GUID is for the ID of the typelib if this project is exposed to COM
25 |
26 | [assembly: Guid("e2b4b464-62b0-4c1e-9f1f-f54040cccb98")]
27 |
28 | // Version information for an assembly consists of the following four values:
29 | //
30 | // Major Version
31 | // Minor Version
32 | // Build Number
33 | // Revision
34 | //
35 | // You can specify all the values or you can default the Build and Revision Numbers
36 | // by using the '*' as shown below:
37 | // [assembly: AssemblyVersion("1.0.*")]
38 |
39 | [assembly: AssemblyVersion("1.0.0.0")]
40 | [assembly: AssemblyFileVersion("1.0.0.0")]
41 |
42 | // The following line configures log4net to watch the default config file for changes.
43 | [assembly: XmlConfigurator(Watch = true)]
44 |
--------------------------------------------------------------------------------
/Core/OpenStory/Common/Game/Elements.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace OpenStory.Common.Game
4 | {
5 | ///
6 | /// Elemental attributes for a game skill.
7 | ///
8 | [Serializable]
9 | [Flags]
10 | public enum Elements
11 | {
12 | ///
13 | /// Default value.
14 | ///
15 | None = 0,
16 |
17 | ///
18 | /// The fire attribute.
19 | ///
20 | /// The associated character is F.
21 | Fire = 0x1, // F
22 |
23 | ///
24 | /// The ice attribute.
25 | ///
26 | /// The associated character is I.
27 | Ice = 0x2,
28 |
29 | ///
30 | /// The lightning attribute.
31 | ///
32 | /// The associated character is L.
33 | Lightning = 0x4,
34 |
35 | ///
36 | /// The poison attribute.
37 | ///
38 | /// The associated character is S.
39 | Poison = 0x8,
40 |
41 | ///
42 | /// The holy attribute.
43 | ///
44 | /// The associated character is H.
45 | Holy = 0x10,
46 |
47 | ///
48 | /// The dark attribute.
49 | ///
50 | /// The associated character is D.
51 | Dark = 0x20,
52 |
53 | ///
54 | /// No elemental attributes, a physical attack.
55 | ///
56 | /// The associated character is P.
57 | Physical = 0x40,
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/Core/OpenStory/Common/IO/ArraySegmentException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.ComponentModel;
3 |
4 | namespace OpenStory.Common.IO
5 | {
6 | ///
7 | /// The exception that is thrown when an array
8 | /// segment does not fit into an array's bounds.
9 | ///
10 | ///
11 | /// This exception is to be used when an array
12 | /// segment defined by either a start and an end offset
13 | /// or a start offset and a segment length,
14 | /// falls outside of an array's bounds.
15 | ///
16 | [Serializable]
17 | [Localizable(true)]
18 | public sealed class ArraySegmentException : Exception
19 | {
20 | ///
21 | /// Initializes a new instance of .
22 | ///
23 | ///
24 | private ArraySegmentException(string message)
25 | : base(message)
26 | {
27 | }
28 |
29 | ///
30 | /// Gets a new instance of with a message that
31 | /// an array segment with a given start offset and length does not fit into the array's bounds.
32 | ///
33 | /// The start offset of the invalid segment.
34 | /// The length of the invalid segment.
35 | /// an instance of .
36 | public static ArraySegmentException GetByStartAndLength(int startOffset, int length)
37 | {
38 | string formatted = string.Format(CommonStrings.BadArraySegmentLength, startOffset, length);
39 | return new ArraySegmentException(formatted);
40 | }
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/Server/OpenStory.Services.Wcf/RegisteredClientProvider.cs:
--------------------------------------------------------------------------------
1 | using System.ServiceModel;
2 | using OpenStory.Services.Contracts;
3 |
4 | namespace OpenStory.Services.Wcf
5 | {
6 | ///
7 | /// Provides client instances for a duplex service.
8 | ///
9 | /// The type of the service.
10 | public class RegisteredClientProvider : ServiceClientProvider
11 | where TChannel : class, IRegisteredService
12 | {
13 | private readonly DuplexChannelFactory _channelFactory;
14 |
15 | ///
16 | /// Initializes a new instance of the class.
17 | ///
18 | public RegisteredClientProvider()
19 | {
20 | _channelFactory = new DuplexChannelFactory(typeof(IServiceStateChanged), new NetTcpBinding(SecurityMode.Transport));
21 | }
22 |
23 | ///
24 | /// Initializes a new instance of the class.
25 | ///
26 | /// The object to use for service callbacks.
27 | public RegisteredClientProvider(IServiceStateChanged handler)
28 | {
29 | _channelFactory = new DuplexChannelFactory(handler, new NetTcpBinding(SecurityMode.Transport));
30 | }
31 |
32 | ///
33 | /// Gets a service channel using discovery.
34 | ///
35 | public override TChannel CreateChannel()
36 | {
37 | _channelFactory.Open();
38 | var channel = _channelFactory.CreateChannel(Metadata.Address);
39 | return channel;
40 | }
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/Server/OpenStory.Services.Accounts/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 | using log4net.Config;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 |
9 | [assembly: AssemblyTitle("OpenStory.AccountService")]
10 | [assembly: AssemblyDescription("")]
11 | [assembly: AssemblyConfiguration("")]
12 | [assembly: AssemblyCompany("shoftee® Corporation")]
13 | [assembly: AssemblyProduct("OpenStory.AccountService")]
14 | [assembly: AssemblyCopyright("Copyright © shoftee® Corporation 2011")]
15 | [assembly: AssemblyTrademark("")]
16 | [assembly: AssemblyCulture("")]
17 |
18 | // Setting ComVisible to false makes the types in this assembly not visible
19 | // to COM components. If you need to access a type in this assembly from
20 | // COM, set the ComVisible attribute to true on that type.
21 |
22 | [assembly: ComVisible(false)]
23 |
24 | // The following GUID is for the ID of the typelib if this project is exposed to COM
25 |
26 | [assembly: Guid("38336238-8621-42ac-9cd7-9c3520936d79")]
27 |
28 | // Version information for an assembly consists of the following four values:
29 | //
30 | // Major Version
31 | // Minor Version
32 | // Build Number
33 | // Revision
34 | //
35 | // You can specify all the values or you can default the Build and Revision Numbers
36 | // by using the '*' as shown below:
37 | // [assembly: AssemblyVersion("1.0.*")]
38 |
39 | [assembly: AssemblyVersion("1.0.0.0")]
40 | [assembly: AssemblyFileVersion("1.0.0.0")]
41 |
42 | // The following line configures log4net to watch the default config file for changes.
43 | [assembly: XmlConfigurator(Watch = true)]
44 |
--------------------------------------------------------------------------------
/packages/repositories.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/Server/OpenStory.Server/Processing/ServerOperator.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using OpenStory.Framework.Contracts;
3 | using OpenStory.Services.Contracts;
4 |
5 | namespace OpenStory.Server.Processing
6 | {
7 | ///
8 | /// A base class for implementations.
9 | ///
10 | /// The type of the clients to handle in this .
11 | public abstract class ServerOperator : IServerOperator
12 | where TClient : ClientBase
13 | {
14 | private readonly IGameClientFactory _gameClientFactory;
15 |
16 | ///
17 | /// Gets the list of registered clients.
18 | ///
19 | protected List Clients { get; }
20 |
21 | ///
22 | /// Initializes a new instance of .
23 | ///
24 | protected ServerOperator(IGameClientFactory gameClientFactory)
25 | {
26 | Clients = new List();
27 | _gameClientFactory = gameClientFactory;
28 | }
29 |
30 | ///
31 | public abstract void Configure(OsServiceConfiguration configuration);
32 |
33 | ///
34 | public void RegisterSession(IServerSession session)
35 | {
36 | var client = InitializeClient(session);
37 | Clients.Add(client);
38 | }
39 |
40 | private TClient InitializeClient(IServerSession session)
41 | {
42 | var client = _gameClientFactory.CreateClient(session);
43 |
44 | client.Closing += (s, e) => Clients.Remove(client);
45 |
46 | return client;
47 | }
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/Server/OpenStory.Services.Contracts/BootstrapperBase.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Ninject.Extensions.Logging;
3 | using Ninject.Syntax;
4 |
5 | namespace OpenStory.Services.Contracts
6 | {
7 | ///
8 | /// Represents a base implementation of the interface.
9 | ///
10 | public abstract class BootstrapperBase : IBootstrapper
11 | {
12 | ///
13 | /// Gets the resolution root for the bootstrapper.
14 | ///
15 | protected IResolutionRoot ResolutionRoot { get; private set; }
16 |
17 | ///
18 | /// Gets the logger for this bootstrapper.
19 | ///
20 | protected ILogger Logger { get; }
21 |
22 | ///
23 | /// Initializes it all.
24 | ///
25 | protected BootstrapperBase(IResolutionRoot resolutionRoot, ILogger logger)
26 | {
27 | ResolutionRoot = resolutionRoot;
28 | Logger = logger;
29 | }
30 |
31 | ///
32 | public void Start()
33 | {
34 | try
35 | {
36 | Logger.Info("Starting services...");
37 | OnStarting();
38 | Logger.Info("All services started.");
39 | }
40 | catch (Exception ex)
41 | {
42 | Logger.Error(ex, "Encountered an error while bootstrapping.");
43 | }
44 | }
45 |
46 | ///
47 | /// A hook to the middle of the public method.
48 | ///
49 | ///
50 | /// Implement this method for your custom bootstrapper logic.
51 | ///
52 | protected abstract void OnStarting();
53 | }
54 | }
--------------------------------------------------------------------------------
/Server/OpenStory.Services.Contracts/ServerConfiguration.cs:
--------------------------------------------------------------------------------
1 | using System.Net;
2 |
3 | namespace OpenStory.Services.Contracts
4 | {
5 | ///
6 | /// Represents a set of server configuration settings.
7 | ///
8 | public class ServerConfiguration
9 | {
10 | ///
11 | /// Gets the game version for the server.
12 | ///
13 | public ushort? Header { get; private set; }
14 |
15 | ///
16 | /// Gets the game version for the server.
17 | ///
18 | public ushort Version { get; private set; }
19 |
20 | ///
21 | /// Gets the game sub-version for the server.
22 | ///
23 | public string Subversion { get; private set; }
24 |
25 | ///
26 | /// Gets the locale ID for the server.
27 | ///
28 | public byte LocaleId { get; private set; }
29 |
30 | ///
31 | /// Gets the entry point definition for the server.
32 | ///
33 | public IPEndPoint Endpoint { get; private set; }
34 |
35 | ///
36 | /// Initializes a new instance of the class.
37 | ///
38 | /// The object containing the configuration values.
39 | public ServerConfiguration(OsServiceConfiguration configuration)
40 | {
41 | Endpoint = configuration.Get("Endpoint", true);
42 |
43 | Header = configuration.GetValue("Header");
44 | Version = configuration.Get("Version", true);
45 | Subversion = configuration.Get("Subversion", true);
46 | LocaleId = configuration.Get("LocaleId", true);
47 | }
48 | }
49 | }
--------------------------------------------------------------------------------
/Tests/OpenStory.Tests/Common/IO/ByteOrderFixture.cs:
--------------------------------------------------------------------------------
1 | using FluentAssertions;
2 | using NUnit.Framework;
3 |
4 | namespace OpenStory.Common.IO
5 | {
6 | [Category("OpenStory.Common.IO.ByteOrder")]
7 | [TestFixture]
8 | public class ByteOrderFixture
9 | {
10 | [Test]
11 | public void FlipBytes_Should_Flip_Int16()
12 | {
13 | short number = 0x1234;
14 |
15 | ByteOrder.FlipBytes(ref number);
16 |
17 | number.Should().Be(0x3412);
18 | }
19 |
20 | [Test]
21 | public void FlipBytes_Should_Flip_UInt16()
22 | {
23 | ushort number = 0xABCD;
24 |
25 | ByteOrder.FlipBytes(ref number);
26 |
27 | number.Should().Be(0xCDAB);
28 | }
29 |
30 | [Test]
31 | public void FlipBytes_Should_Flip_Int32()
32 | {
33 | int number = 0x12345678;
34 |
35 | ByteOrder.FlipBytes(ref number);
36 |
37 | number.Should().Be(0x78563412);
38 | }
39 |
40 | [Test]
41 | public void FlipBytes_Should_Flip_UInt32()
42 | {
43 | uint number = 0x890ABCDE;
44 |
45 | ByteOrder.FlipBytes(ref number);
46 |
47 | number.Should().Be(0xDEBC0A89);
48 | }
49 |
50 | [Test]
51 | public void FlipBytes_Should_Flip_Int64()
52 | {
53 | long number = 0x0123456789ABCDEF;
54 |
55 | ByteOrder.FlipBytes(ref number);
56 |
57 | number.Should().Be(unchecked((long)0xEFCDAB8967452301));
58 | }
59 |
60 | [Test]
61 | public void FlipBytes_Should_Flip_UInt64()
62 | {
63 | ulong number = 0x89ABCDEF01234567;
64 |
65 | ByteOrder.FlipBytes(ref number);
66 |
67 | number.Should().Be(0x67452301EFCDAB89);
68 | }
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/Tests/OpenStory.Tests/Networking/ReceiveDescriptorFixture.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using FluentAssertions;
3 | using Moq;
4 | using NUnit.Framework;
5 |
6 | namespace OpenStory.Networking
7 | {
8 | [Category("OpenStory.Common.Networking")]
9 | [TestFixture]
10 | public sealed class ReceiveDescriptorFixture
11 | {
12 | [Test]
13 | public void DataArrived_Should_Throw_When_Delegate_Already_Bound()
14 | {
15 | var descriptor = new ReceiveDescriptor(Mock.Of());
16 | descriptor.DataArrived += (o, e) => { };
17 |
18 | descriptor
19 | .Invoking(d => d.DataArrived += (o, e) => { })
20 | .ShouldThrow()
21 | .WithMessage(CommonStrings.EventMustHaveOnlyOneSubscriber);
22 | }
23 |
24 | #region StartReceive()
25 |
26 | [Test]
27 | public void StartReceive_Should_Throw_If_DataArrived_Has_No_Subscribers()
28 | {
29 | var descriptor = new ReceiveDescriptor(Mock.Of());
30 |
31 | descriptor
32 | .Invoking(d => d.StartReceive())
33 | .ShouldThrow()
34 | .WithMessage(CommonStrings.ReceiveEventHasNoSubscribers);
35 | }
36 |
37 | [Test]
38 | public void StartReceive_Should_Check_Container_IsActive()
39 | {
40 | var container = new Mock();
41 | container.SetupGet(c => c.IsActive).Returns(false);
42 |
43 | var descriptor = new ReceiveDescriptor(container.Object);
44 | descriptor.DataArrived += (sender, args) => { };
45 | descriptor.StartReceive();
46 |
47 | container.Verify(c => c.IsActive, Times.Once());
48 | }
49 |
50 | #endregion
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/Core/OpenStory/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Reflection;
3 | using System.Resources;
4 | using System.Runtime.CompilerServices;
5 | using System.Runtime.InteropServices;
6 |
7 | // General Information about an assembly is controlled through the following
8 | // set of attributes. Change these attribute values to modify the information
9 | // associated with an assembly.
10 |
11 | [assembly: AssemblyTitle("OpenStory")]
12 | [assembly: AssemblyDescription("Common components of OpenStory")]
13 | [assembly: AssemblyConfiguration("")]
14 | [assembly: AssemblyCompany("shoftee® Corporation")]
15 | [assembly: AssemblyProduct("OpenStory")]
16 | [assembly: AssemblyCopyright("Copyright © shoftee® Corporation 2010")]
17 | [assembly: AssemblyTrademark("")]
18 | [assembly: AssemblyCulture("")]
19 |
20 | // Resources stuff
21 | [assembly: NeutralResourcesLanguage("en-US")]
22 |
23 | // Setting ComVisible to false makes the types in this assembly not visible
24 | // to COM components. If you need to access a type in this assembly from
25 | // COM, set the ComVisible attribute to true on that type.
26 |
27 | [assembly: ComVisible(false)]
28 |
29 | // The following GUID is for the ID of the typelib if this project is exposed to COM
30 |
31 | [assembly: Guid("5f392b00-406b-4985-8220-16cad6176c67")]
32 |
33 | // CLSCompliant
34 |
35 | [assembly: CLSCompliant(false)]
36 |
37 | // Version information for an assembly consists of the following four values:
38 | //
39 | // Major Version
40 | // Minor Version
41 | // Build Number
42 | // Revision
43 | //
44 | // You can specify all the values or you can default the Build and Revision Numbers
45 | // by using the '*' as shown below:
46 | // [assembly: AssemblyVersion("1.0.*")]
47 |
48 | [assembly: AssemblyVersion("1.0.0.0")]
49 | [assembly: AssemblyFileVersion("1.0.0.0")]
50 |
51 | [assembly: InternalsVisibleTo("OpenStory.Tests")]
52 |
--------------------------------------------------------------------------------
/Server/OpenStory.Framework.Contracts/PacketProcessingEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using OpenStory.Common.IO;
3 |
4 | namespace OpenStory.Framework.Contracts
5 | {
6 | ///
7 | /// Contains event data for a packet that requires processing.
8 | ///
9 | public sealed class PacketProcessingEventArgs : EventArgs
10 | {
11 | private readonly PacketReader _reader;
12 |
13 | ///
14 | /// Gets the packet code of the packet.
15 | ///
16 | public ushort PacketCode { get; private set; }
17 |
18 | ///
19 | /// Gets the label of the packet.
20 | ///
21 | public string Label { get; private set; }
22 |
23 | ///
24 | /// Gets a fresh reader over the packet's content.
25 | ///
26 | public IUnsafePacketReader Reader => new PacketReader(_reader);
27 |
28 | ///
29 | /// Initializes a new instance of the class.
30 | ///
31 | /// The packet code of the packet.
32 | /// The known label of the packet.
33 | /// The packet reader, after having read the label code.
34 | ///
35 | /// Thrown if or is .
36 | ///
37 | public PacketProcessingEventArgs(ushort packetCode, string label, PacketReader reader)
38 | {
39 | if (reader == null)
40 | {
41 | throw new ArgumentNullException(nameof(reader));
42 | }
43 |
44 | PacketCode = packetCode;
45 | Label = label;
46 | _reader = reader;
47 | }
48 | }
49 | }
--------------------------------------------------------------------------------
/Core/OpenStory/Common/Tools/Arrays.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 |
5 | namespace OpenStory.Common
6 | {
7 | ///
8 | /// Array helpers!
9 | ///
10 | public static class Arrays
11 | {
12 | ///
13 | /// Concatenates the provided byte arrays.
14 | ///
15 | /// The arrays to concatenate.
16 | /// Thrown if is .
17 | /// the resulting array.
18 | public static byte[] FastJoin(IList arrays)
19 | {
20 | Guard.NotNull(() => arrays, arrays);
21 |
22 | return FastJoinList(arrays);
23 | }
24 |
25 | ///
26 | /// Concatenates the provided byte arrays.
27 | ///
28 | /// The arrays to concatenate.
29 | /// Thrown if is .
30 | /// the resulting array.
31 | public static byte[] FastJoin(params byte[][] arrays)
32 | {
33 | Guard.NotNull(() => arrays, arrays);
34 |
35 | return FastJoinList(arrays);
36 | }
37 |
38 | private static byte[] FastJoinList(IList arrays)
39 | {
40 | var totalLength = arrays.Sum(s => s.Length);
41 | var buffer = new byte[totalLength];
42 |
43 | int offset = 0;
44 | foreach (var array in arrays)
45 | {
46 | var count = array.Length;
47 | Buffer.BlockCopy(array, 0, buffer, offset, count);
48 | offset += count;
49 | }
50 |
51 | return buffer;
52 | }
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/Server/OpenStory.Services.Simple/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/Core/OpenStory/Common/IPacketCodeTable.cs:
--------------------------------------------------------------------------------
1 | namespace OpenStory.Common
2 | {
3 | ///
4 | /// Provides methods for looking up packet labels and op codes.
5 | ///
6 | public interface IPacketCodeTable
7 | {
8 | ///
9 | /// Retrieves the label for the specified incoming packet code.
10 | ///
11 | /// The incoming packet code to get the label for.
12 | /// The label for the specified packet code.
13 | string GetIncomingLabel(ushort code);
14 |
15 | ///
16 | /// Attempts to get the label for a specified incoming packet code.
17 | ///
18 | /// The packet code to look up the label of.
19 | /// A variable to hold the result.
20 | /// if there was an incoming packet code for the label; otherwise, .
21 | bool TryGetIncomingLabel(ushort code, out string label);
22 |
23 | ///
24 | /// Retrieves the packet code for the specified outgoing packet label.
25 | ///
26 | /// The outgoing packet label to get the code for.
27 | /// The outgoing packet code for the specified label.
28 | ushort GetOutgoingCode(string label);
29 |
30 | ///
31 | /// Attempts to get the outgoing packet code for a specified label.
32 | ///
33 | /// The label for the outgoing packet.
34 | /// The variable to hold the result.
35 | /// if there was an outgoing packet with the label; otherwise, .
36 | bool TryGetOutgoingCode(string label, out ushort code);
37 | }
38 | }
39 |
--------------------------------------------------------------------------------