protected SerializerBase(string inputFile) { this.Features = new SupportedFeatures(); this.FileName = inputFile; this.DataRoot = new DataRoot(); this.defaultEncoding = Encoding.GetEncoding("iso-8859-9"); }
/// <inheritdoc/> public async Task <IEnumerable <WriteConcernResult> > ExecuteAsync(IWriteBinding binding, CancellationToken cancellationToken) { Ensure.IsNotNull(binding, nameof(binding)); using (EventContext.BeginOperation()) using (var channelSource = await binding.GetWriteChannelSourceAsync(cancellationToken).ConfigureAwait(false)) using (var channel = await channelSource.GetChannelAsync(cancellationToken).ConfigureAwait(false)) { if (SupportedFeatures.AreWriteCommandsSupported(channel.ConnectionDescription.ServerVersion) && _writeConcern.IsAcknowledged) { var emulator = CreateEmulator(); var result = await emulator.ExecuteAsync(channel, cancellationToken).ConfigureAwait(false); return(new[] { result }); } else { if (_documentSource.Batch == null) { return(await InsertMultipleBatchesAsync(channel, cancellationToken).ConfigureAwait(false)); } else { var result = await InsertSingleBatchAsync(channel, cancellationToken).ConfigureAwait(false); return(new[] { result }); } } } }
private AsyncCursor <TResult> CreateCursor(IChannelSourceHandle channelSource, IChannelHandle channel, BsonDocument command, AggregateResult result) { if (SupportedFeatures.IsAggregateCursorResultSupported(channel.ConnectionDescription.ServerVersion) && _useCursor.GetValueOrDefault(true)) { return(CreateCursorFromCursorResult(channelSource, command, result)); } return(CreateCursorFromInlineResult(command, result)); }
public void Execute_should_return_expected_result_when_maxTime_is_provided( [Values(false, true)] bool async) { if (SupportedFeatures.AreFailPointsSupported(CoreTestConfiguration.ServerVersion)) { // TODO: port FailPoint infrastructure from Driver.Tests to Core.Tests } }
public void Execute_should_return_expected_result_when_maxTime_is_provided( [Values(false, true)] bool async) { if (SupportedFeatures.IsMaxTimeSupported(CoreTestConfiguration.ServerVersion)) { // TODO: implement EvalOperation MaxTime test } }
// methods /// <inheritdoc/> protected internal override BsonDocument CreateCommand(SemanticVersion serverVersion) { var command = base.CreateCommand(serverVersion); if (_bypassDocumentValidation.HasValue && SupportedFeatures.IsBypassDocumentValidationSupported(serverVersion)) { command["bypassDocumentValidation"] = _bypassDocumentValidation.Value; } return(command); }
public void TestSupportedFeatures(ProtocolChanges protocolChanges) { var firstMobile = new Mobile(0x1); firstMobile.DefaultMobileInit(); firstMobile.Name = "Test Mobile"; var account = new TestAccount(new[] { firstMobile, null, null, null, null }); var ns = new NetState( new TestConnectionContext { RemoteEndPoint = IPEndPoint.Parse("127.0.0.1") } ) { Account = account, ProtocolChanges = protocolChanges }; var data = new SupportedFeatures(ns).Compile(); Span <byte> expectedData = stackalloc byte[ns.ExtendedSupportedFeatures ? 5 : 3]; var pos = 0; expectedData[pos++] = 0xB9; // Packet ID var flags = ExpansionInfo.GetFeatures(Expansion.EJ); if (ns.Account.Limit >= 6) { flags |= FeatureFlags.LiveAccount; flags &= ~FeatureFlags.UOTD; if (ns.Account.Limit > 6) { flags |= FeatureFlags.SeventhCharacterSlot; } else { flags |= FeatureFlags.SixthCharacterSlot; } } if (ns.ExtendedSupportedFeatures) { expectedData.Write(ref pos, (uint)flags); } else { expectedData.Write(ref pos, (ushort)flags); } AssertThat.Equal(data, expectedData); }
// private methods private IReadOperation <IAsyncCursor <BsonDocument> > CreateOperation(IChannel channel) { if (SupportedFeatures.IsListIndexesCommandSupported(channel.ConnectionDescription.ServerVersion)) { return(new ListIndexesUsingCommandOperation(_collectionNamespace, _messageEncoderSettings)); } else { return(new ListIndexesUsingQueryOperation(_collectionNamespace, _messageEncoderSettings)); } }
private IAuthenticator CreateAuthenticator(ConnectionDescription description) { if (SupportedFeatures.IsScramSha1AuthenticationSupported(description.ServerVersion)) { return(new ScramSha1Authenticator(_credential, _randomStringGenerator)); } else { return(new MongoDBCRAuthenticator(_credential)); } }
// private methods private IWriteOperation <BsonDocument> CreateOperation(IChannel channel) { if (SupportedFeatures.IsCreateIndexesCommandSupported(channel.ConnectionDescription.ServerVersion)) { return(new CreateIndexesUsingCommandOperation(_collectionNamespace, _requests, _messageEncoderSettings)); } else { return(new CreateIndexesUsingInsertOperation(_collectionNamespace, _requests, _messageEncoderSettings)); } }
public static void SendErrorOnCharacterCreation(NetState state, string message) { Console.WriteLine("Login: {0}: Character creation failed. {1}", state, message); if (Core.AOS) { state.Send(SupportedFeatures.Instantiate(state)); } state.Send(new CharacterList(state.Account, state.CityInfo)); state.Send(new AsciiMessage(Serial.MinusOne, -1, MessageType.Regular, 38, 0, "System", message)); }
internal SupportedFeatures(SupportedFeatures source) { ProtocolVersion = source.ProtocolVersion; Ping = source.Ping; None = source.None; Drop = source.Drop; Subscription = source.Subscription; Cluster = source.Cluster; Heartbeats = source.Heartbeats; TestConnection = source.TestConnection; Replication = source.Replication; DataCompression = source.DataCompression; }
public void CreateCommand_should_create_the_correct_command( [Values("2.4.0", "2.6.0", "2.8.0", "3.0.0", "3.2.0")] string serverVersion, [Values(null, false, true)] bool?allowDiskUse, [Values(null, 10, 20)] int?batchSize, [Values(null, 2000)] int?maxTime, [Values(null, ReadConcernLevel.Local, ReadConcernLevel.Majority)] ReadConcernLevel?readConcernLevel, [Values(null, false, true)] bool?useCursor) { var semanticServerVersion = SemanticVersion.Parse(serverVersion); var subject = new AggregateOperation <BsonDocument>(_collectionNamespace, Enumerable.Empty <BsonDocument>(), BsonDocumentSerializer.Instance, _messageEncoderSettings) { AllowDiskUse = allowDiskUse, BatchSize = batchSize, MaxTime = maxTime.HasValue ? TimeSpan.FromMilliseconds(maxTime.Value) : (TimeSpan?)null, ReadConcern = new ReadConcern(readConcernLevel), UseCursor = useCursor }; var expectedResult = new BsonDocument { { "aggregate", _collectionNamespace.CollectionName }, { "pipeline", new BsonArray(subject.Pipeline) }, { "allowDiskUse", () => allowDiskUse.Value, allowDiskUse.HasValue }, { "maxTimeMS", () => maxTime.Value, maxTime.HasValue } }; if (!subject.ReadConcern.IsServerDefault) { expectedResult["readConcern"] = subject.ReadConcern.ToBsonDocument(); } if (SupportedFeatures.IsAggregateCursorResultSupported(semanticServerVersion) && useCursor.GetValueOrDefault(true)) { expectedResult["cursor"] = new BsonDocument { { "batchSize", () => batchSize.Value, batchSize.HasValue } }; } if (!subject.ReadConcern.IsSupported(semanticServerVersion)) { Action act = () => subject.CreateCommand(semanticServerVersion); act.ShouldThrow <MongoClientException>(); } else { var result = subject.CreateCommand(semanticServerVersion); result.Should().Be(expectedResult); } }
// public methods public BulkWriteOperationResult Execute(IChannelHandle channel, CancellationToken cancellationToken) { using (EventContext.BeginOperation()) { if (SupportedFeatures.AreWriteCommandsSupported(channel.ConnectionDescription.ServerVersion)) { return(ExecuteBatches(channel, cancellationToken)); } else { var emulator = CreateEmulator(); return(emulator.Execute(channel, cancellationToken)); } } }
private async Task <CursorBatch <TDocument> > GetNextBatchAsync(CancellationToken cancellationToken) { using (EventContext.BeginOperation(_operationId)) using (var channel = await _channelSource.GetChannelAsync(cancellationToken).ConfigureAwait(false)) { if (SupportedFeatures.IsFindCommandSupported(channel.ConnectionDescription.ServerVersion)) { return(await ExecuteGetMoreCommandAsync(channel, cancellationToken).ConfigureAwait(false)); } else { return(await ExecuteGetMoreProtocolAsync(channel, cancellationToken).ConfigureAwait(false)); } } }
public async Task <BulkWriteOperationResult> ExecuteAsync(IChannelHandle channel, CancellationToken cancellationToken) { using (EventContext.BeginOperation()) { if (SupportedFeatures.AreWriteCommandsSupported(channel.ConnectionDescription.ServerVersion)) { return(await ExecuteBatchesAsync(channel, cancellationToken).ConfigureAwait(false)); } else { var emulator = CreateEmulator(); return(await emulator.ExecuteAsync(channel, cancellationToken).ConfigureAwait(false)); } } }
private CursorBatch <TDocument> GetNextBatch(CancellationToken cancellationToken) { using (EventContext.BeginOperation(_operationId)) using (var channel = _channelSource.GetChannel(cancellationToken)) { if (SupportedFeatures.IsFindCommandSupported(channel.ConnectionDescription.ServerVersion)) { return(ExecuteGetMoreCommand(channel, cancellationToken)); } else { return(ExecuteGetMoreProtocol(channel, cancellationToken)); } } }
public BadgeCaps(int version, int width, int height, int bitDepth, SupportedFeatures caps, int baud) { Version = version; Width = width; Height = height; BitsPerPixel = bitDepth; ColorValues = 1 << BitsPerPixel; WidthInBlocks = (width + 7) / 8; BytesPerBlock = bitDepth; FrameStride = WidthInBlocks * BytesPerBlock; FrameSize = FrameStride * Height; IntermediateFrameStride = WidthInBlocks * PixelsPerBlockBitPlane; IntermediateFrameSize = IntermediateFrameStride * Height; SupportedFeatures = caps; Baud = baud; }
private IReadOperation <IAsyncCursor <TDocument> > CreateOperation(SemanticVersion serverVersion) { var hasExplainModifier = _modifiers != null && _modifiers.Contains("$explain"); if (SupportedFeatures.IsFindCommandSupported(serverVersion) && !hasExplainModifier) { return(CreateFindCommandOperation()); } else { // this is here because FindOpcodeOperation doesn't support // read concern _readConcern.ThrowIfNotSupported(serverVersion); return(CreateFindOpcodeOperation()); } }
/// <inheritdoc/> public async Task <WriteConcernResult> ExecuteAsync(IWriteBinding binding, CancellationToken cancellationToken) { Ensure.IsNotNull(binding, nameof(binding)); using (EventContext.BeginOperation()) using (var channelSource = await binding.GetWriteChannelSourceAsync(cancellationToken).ConfigureAwait(false)) using (var channel = await channelSource.GetChannelAsync(cancellationToken).ConfigureAwait(false)) { if (SupportedFeatures.AreWriteCommandsSupported(channel.ConnectionDescription.ServerVersion) && _writeConcern.IsAcknowledged) { var emulator = CreateEmulator(); return(await emulator.ExecuteAsync(channel, cancellationToken).ConfigureAwait(false)); } else { return(await ExecuteProtocolAsync(channel, cancellationToken).ConfigureAwait(false)); } } }
public override int GetHashCode() { int hash = 1; if (Error.Length != 0) { hash ^= Error.GetHashCode(); } if (SupportedFeatures != 0UL) { hash ^= SupportedFeatures.GetHashCode(); } hash ^= file_.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
// public methods /// <inheritdoc/> public WriteConcernResult Execute(IWriteBinding binding, CancellationToken cancellationToken) { Ensure.IsNotNull(binding, nameof(binding)); using (EventContext.BeginOperation()) using (var channelSource = binding.GetWriteChannelSource(cancellationToken)) using (var channel = channelSource.GetChannel(cancellationToken)) { if (SupportedFeatures.AreWriteCommandsSupported(channel.ConnectionDescription.ServerVersion) && _writeConcern.IsAcknowledged) { var emulator = CreateEmulator(); return(emulator.Execute(channel, cancellationToken)); } else { return(ExecuteProtocol(channel, cancellationToken)); } } }
internal BsonDocument CreateCommand(SemanticVersion serverVersion) { _readConcern.ThrowIfNotSupported(serverVersion); var command = new BsonDocument { { "aggregate", _collectionNamespace.CollectionName }, { "pipeline", new BsonArray(_pipeline) }, { "allowDiskUse", () => _allowDiskUse.Value, _allowDiskUse.HasValue }, { "maxTimeMS", () => _maxTime.Value.TotalMilliseconds, _maxTime.HasValue }, { "readConcern", () => _readConcern.ToBsonDocument(), !_readConcern.IsServerDefault } }; if (SupportedFeatures.IsAggregateCursorResultSupported(serverVersion) && _useCursor.GetValueOrDefault(true)) { command["cursor"] = new BsonDocument { { "batchSize", () => _batchSize.Value, _batchSize.HasValue } }; } return(command); }
public static void OldClient_OnCommand(CommandEventArgs e) { Mobile m = e.Mobile; if (m.Player && m.Account != null) { IAccount acct = m.Account; if (e.Arguments.Length == 0) { m.SendMessage("Old style client packets is currently {0}.", acct.SFO == FeatureFlags.None ? "OFF" : "ON"); } else { bool turnon = e.Arguments[0].ToLower() == "on"; acct.SFO = turnon ? (FeatureFlags)0x03 : (FeatureFlags)0x0; m.SendMessage("Old style client packets has been turned {0}.", turnon ? "ON" : "OFF"); m.Send(new MobileIncoming(m, m)); m.Send(SupportedFeatures.Instantiate(m.NetState)); m.Send(new MobileUpdate(m)); m.Send(new MobileAttributes(m)); } } }
public static int DecodeCapsSetting(byte[] buffer, int offset, out byte version, out byte width, out byte height, out byte bitDepth, out SupportedFeatures capBits) { System.Diagnostics.Debug.Assert((ResponseCodes)(buffer[offset] >> 4) == ResponseCodes.Setting); System.Diagnostics.Debug.Assert((SettingValue)(buffer[offset] & 0xF) == SettingValue.Caps); version = buffer[offset + 1]; width = buffer[offset + 2]; height = (byte)(buffer[offset + 3] >> 4); bitDepth = (byte)(buffer[offset + 3] & 0xF); capBits = (SupportedFeatures)buffer[offset + 4]; return(5); }
public void CreateCommand_should_create_the_correct_command( [Values(null, 10)] int?maxTimeMS, [Values(null, "{a: 1}")] string projection, [Values(null, "{b: 1}")] string sort, [Values(null, "{ w : 2 }")] string writeConcernString, [Values("3.0.0", "3.1.1")] string serverVersionString) { var projectionDoc = projection == null ? (BsonDocument)null : BsonDocument.Parse(projection); var sortDoc = sort == null ? (BsonDocument)null : BsonDocument.Parse(sort); var writeConcern = writeConcernString == null ? null : WriteConcern.FromBsonDocument(BsonDocument.Parse(writeConcernString)); var serverVersion = SemanticVersion.Parse(serverVersionString); var subject = new FindOneAndDeleteOperation <BsonDocument>(_collectionNamespace, _filter, BsonDocumentSerializer.Instance, _messageEncoderSettings) { MaxTime = maxTimeMS.HasValue ? TimeSpan.FromMilliseconds(maxTimeMS.Value) : (TimeSpan?)null, Projection = projectionDoc, Sort = sortDoc, WriteConcern = writeConcern }; var expectedResult = new BsonDocument { { "findAndModify", _collectionNamespace.CollectionName }, { "query", _filter }, { "sort", sortDoc, sortDoc != null }, { "remove", true }, { "fields", projectionDoc, projectionDoc != null }, { "maxTimeMS", () => maxTimeMS.Value, maxTimeMS.HasValue }, { "writeConcern", () => writeConcern.ToBsonDocument(), writeConcern != null && SupportedFeatures.IsFindAndModifyWriteConcernSupported(serverVersion) } }; var result = subject.CreateCommand(serverVersion); result.Should().Be(expectedResult); }
public void CreateCommand_should_create_the_correct_command( [Values(null, false, true)] bool?allowDiskUse, [Values(null, false, true)] bool?bypassDocumentValidation, [Values(null, 2000)] int?maxTime, [Values("3.0.0", "3.1.3")] string serverVersionString) { var subject = new AggregateToCollectionOperation(_collectionNamespace, _pipeline, _messageEncoderSettings) { AllowDiskUse = allowDiskUse, BypassDocumentValidation = bypassDocumentValidation, MaxTime = maxTime.HasValue ? TimeSpan.FromMilliseconds(maxTime.Value) : (TimeSpan?)null, }; var serverVersion = SemanticVersion.Parse(serverVersionString); var expectedResult = new BsonDocument { { "aggregate", _collectionNamespace.CollectionName }, { "pipeline", new BsonArray(subject.Pipeline) }, { "allowDiskUse", () => allowDiskUse.Value, allowDiskUse.HasValue }, { "bypassDocumentValidation", () => bypassDocumentValidation.Value, bypassDocumentValidation.HasValue&& SupportedFeatures.IsBypassDocumentValidationSupported(serverVersion) }, { "maxTimeMS", () => maxTime.Value, maxTime.HasValue } }; var result = subject.CreateCommand(serverVersion); result.Should().Be(expectedResult); }
// methods internal override BsonDocument CreateCommand(SemanticVersion serverVersion) { return(new BsonDocument { { "findAndModify", CollectionNamespace.CollectionName }, { "query", _filter }, { "sort", _sort, _sort != null }, { "update", _update }, { "new", _returnDocument == ReturnDocument.After }, { "fields", _projection, _projection != null }, { "upsert", _isUpsert }, { "maxTimeMS", () => _maxTime.Value.TotalMilliseconds, _maxTime.HasValue }, { "writeConcern", () => WriteConcern.ToBsonDocument(), WriteConcern != null && !WriteConcern.IsServerDefault && SupportedFeatures.IsFindAndModifyWriteConcernSupported(serverVersion) }, { "bypassDocumentValidation", () => _bypassDocumentValidation.Value, _bypassDocumentValidation.HasValue&& SupportedFeatures.IsBypassDocumentValidationSupported(serverVersion) } }); }
protected override void OnTarget(Mobile from, object o) { try { Mobile m = o as Mobile; if (m is BaseCreature) { ((BaseCreature)m).DisableAI(); } NetState ns = from.NetState; from.CloseAllGumps(); ns.BlockAllPackets = true; from.NetState = null; m.NetState = ns; ns.Mobile = m; ns.BlockAllPackets = false; ns.Send(new LoginConfirm(m)); if (m.Map != null) { ns.Send(new MapChange(m)); } ns.Send(new MapPatches()); ns.Send(SeasonChange.Instantiate(m.GetSeason(), true)); ns.Send(SupportedFeatures.Instantiate(ns)); ns.Sequence = 0; ns.Send(new MobileUpdateOld(m)); ns.Send(new MobileUpdateOld(m)); m.CheckLightLevels(true); ns.Send(new MobileUpdateOld(m)); ns.Send(new MobileIncomingOld(m, m)); //ns.Send( new MobileAttributes( m ) ); ns.Send(new MobileStatus(m, m)); ns.Send(Server.Network.SetWarMode.Instantiate(m.Warmode)); m.SendEverything(); ns.Send(SupportedFeatures.Instantiate(ns)); ns.Send(new MobileUpdateOld(m)); //ns.Send( new MobileAttributes( m ) ); ns.Send(new MobileStatus(m, m)); ns.Send(Server.Network.SetWarMode.Instantiate(m.Warmode)); ns.Send(new MobileIncomingOld(m, m)); ns.Send(LoginComplete.Instance); ns.Send(new CurrentTime()); ns.Send(SeasonChange.Instantiate(m.GetSeason(), true)); ns.Send(new MapChange(m)); from.LogoutLocation = from.Location; from.Map = Map.Internal; //PacketHandlers.DoLogin(ns, origo); //origo.NetState = from.NetState; //from.NetState.Mobile = origo; //from.InvalidateProperties(); //from.NetState.Flush(); } catch (Exception ex) { Misc.ExceptionLogging.WriteLine(ex); } }
public void Process(byte[] packet, Account a) { //a.TcpClient.NoDelay = true; //a.TcpClient.Client.DontFragment = true; //a.TcpClient.Client.NoDelay = false; //a.TcpClient.Client.SendBufferSize = 74; //a.TcpClient.LingerState = new LingerOption(false, 0); //a.TcpClient.SendTimeout = 0; //a.TcpClient.Client.SendTimeout = 0; //a.TcpClient.Client.LingerState = new LingerOption(false, 0); try { switch (packet[0]) { case 0x80: ServerList serverList = new ServerList(); serverList.Build(); //serverList.Send(a.TcpClient); a.NetworkStream.Write(serverList.Data, 0, serverList.PacketSize); break; case 0xA0: if (a.TcpClient.Client.LocalEndPoint != null) { IPAddress addr = ((IPEndPoint)a.TcpClient.Client.LocalEndPoint).Address; Int16 port = Int16.Parse(((IPEndPoint)a.TcpClient.Client.LocalEndPoint).Port.ToString()); ServerConnect serverConnect = new ServerConnect(addr, port, a.AccountID) { GameServerIp = IPAddress.Parse( ((IPEndPoint)a.TcpClient.Client.RemoteEndPoint).Address.ToString()) }; serverConnect.Build(); a.NetworkStream.Write(serverConnect.Data, 0, serverConnect.PacketSize); } break; case 0x91: a.LoadChars(); CharacterList characterList = new CharacterList(a.CharList); characterList.Build(); a.NetworkStream.Write(characterList.Data, 0, characterList.PacketSize); break; case 0x5D: ClientVersion clientVersion = new ClientVersion(); clientVersion.Build(); clientVersion.Compress(); clientVersion.Send(a.NetworkStream); break; case 0xBD: UOPackets.ServerPackets.LoginConfirm loginConfirm = new UOPackets.ServerPackets.LoginConfirm(); loginConfirm.Body = 400; loginConfirm.Direction131 = Direction13.North; loginConfirm.X = 2520; loginConfirm.Y = 521; loginConfirm.Z = 0; loginConfirm.MapHeight = 4096; loginConfirm.MapWidth = 7168; loginConfirm.Serial = 2420; loginConfirm.Build(); loginConfirm.Compress(); loginConfirm.Send(a.NetworkStream); MapChange mapChange = new MapChange(); mapChange.MapId = Map102.felucca; mapChange.Build(); mapChange.Compress(); mapChange.Send(a.NetworkStream); MapPatches mapPatches = new MapPatches(); mapPatches.MapsCount = 4; mapPatches.Build(); mapPatches.Compress(); mapPatches.Send(a.NetworkStream); SeasonChange seasonChange = new SeasonChange(); seasonChange.Season750 = Season75.summer; seasonChange.PlayMusic761 = PlayMusic76.yes; seasonChange.Build(); seasonChange.Compress(); seasonChange.Send(a.NetworkStream); Int16 feat = 0x00; SupportedFeatures supportedFeatures = new SupportedFeatures(); feat = (Int16)Flags73.enablethirddownfeatures; feat += (Int16)Flags73.enableT2Afeatureschatbuttonregions; feat += (Int16)Flags73.enableMLfeatureselvenracespellsskills; feat += (Int16)Flags73.enableAOSfeaturesskillsspellsmapfightbook; feat += (Int16)Flags73.enablerenaissancefeatures; feat += (Int16)Flags73.enableLBRfeaturesskillsmap; supportedFeatures.Flags730 = feat; supportedFeatures.Build(); supportedFeatures.Compress(); supportedFeatures.Send(a.NetworkStream); MobileUpdate mobileUpdate = new MobileUpdate(); mobileUpdate.Direction163 = Direction16.North; mobileUpdate.Flags151 = Flags15.WarMode; mobileUpdate.Hue = 33770; mobileUpdate.X = 2520; mobileUpdate.Y = 521; mobileUpdate.Z = 0; mobileUpdate.Serial = 2420; mobileUpdate.Body = 400; mobileUpdate.Build(); mobileUpdate.Compress(); mobileUpdate.Send(a.NetworkStream); mobileUpdate.Send(a.NetworkStream); GlobalLight globalLight = new GlobalLight(); globalLight.LightLevel240 = LightLevel24.Bright; globalLight.Build(); globalLight.Compress(); globalLight.Send(a.NetworkStream); Infravision infraVision = new Infravision(); infraVision.Active = 0x00; infraVision.Serial = 2420; infraVision.Build(); infraVision.Compress(); infraVision.Send(a.NetworkStream); mobileUpdate.Send(a.NetworkStream); //TODO: Pegar tudo do BD MobileIncoming mobileIncoming = new MobileIncoming(); mobileIncoming.Body = 400; mobileIncoming.Direction490 = (Direction49)((short)(Direction49.Running) + (short)(Direction49.Up)); mobileIncoming.Flags501 = Flags50.Hidden; mobileIncoming.Notoriety512 = Notoriety51.Canbeattacked; mobileIncoming.Serial = 2420; mobileIncoming.X = 2520; mobileIncoming.Y = 521; mobileIncoming.Z = 0; mobileIncoming.Hue = 0x83ea; mobileIncoming.Items3.Add(new Items() { ItemSerial = 0x40000380, ItemID = 0x0e7c, ItemLayer = ItemLayer8.Bank, ItemHue = 0x00 }); mobileIncoming.Items3.Add(new Items() { ItemSerial = 0x7fffd62f, ItemID = 0xa03b, ItemLayer = ItemLayer8.Hair, ItemHue = 0x044e }); mobileIncoming.Items3.Add(new Items() { ItemSerial = 0x66666666, ItemID = 0xa03b, ItemLayer = ItemLayer8.Hair, ItemHue = 0x044e }); mobileIncoming.Build(); mobileIncoming.Compress(); mobileIncoming.Send(a.NetworkStream); MobileStatus mobileStatus = new MobileStatus(); mobileStatus.Serial = 2420; mobileStatus.Name = "lokis ".ToCharArray(); mobileStatus.HitPoints = 0x50; mobileStatus.MaximumHitPoints = 0x50; mobileStatus.AllowNameChange50 = AllowNameChange5.no; mobileStatus.SupportedFeatures61 = SupportedFeatures6.MLattributes; mobileStatus.Gender = 0x00; mobileStatus.Strength = 0x3c; mobileStatus.Dexterity = 0x0a; mobileStatus.Intelligence = 0x0a; mobileStatus.Stamina = 0x0a; mobileStatus.MaximumStamina = 0x0a; mobileStatus.Mana = 0x0a; mobileStatus.MaximumMana = 0x0a; mobileStatus.Gold = 0; mobileStatus.ArmorRating = 0; mobileStatus.Weight = 0x0e; mobileStatus.MaximumWeight = 0x0136; mobileStatus.Race72 = Race7.Human; mobileStatus.StatCap = 0xe1; mobileStatus.Followers = 0; mobileStatus.MaximumFollowers = 5; mobileStatus.FireResistance = 0; mobileStatus.ColdResistance = 0; mobileStatus.PoisonResistance = 0; mobileStatus.EnergyResistance = 0; mobileStatus.Luck = 0; mobileStatus.MinimumWeaponDamage = 1; mobileStatus.MaximumWeaponDamage = 5; mobileStatus.TithingPoints = 0; mobileStatus.Build(); mobileStatus.Compress(); mobileStatus.Send(a.NetworkStream); WarMode warMode = new WarMode(); warMode.Warmode = 0x00; warMode.Build(); warMode.Compress(); warMode.Send(a.NetworkStream); OPLInfo oplInfo2 = new OPLInfo(); oplInfo2.Serial = 2420; oplInfo2.Hash = 0x400f9705; oplInfo2.Build(); oplInfo2.Compress(); oplInfo2.Send(a.NetworkStream); //mobileIncoming.Send(a.TcpClient); OPLInfo oplInfo = new OPLInfo(); //oplInfo.Serial = 2420; oplInfo.Serial = 0x40013082; //oplInfo.Hash = 0x4301baee; oplInfo.Hash = 0x400f9705; oplInfo.Build(); oplInfo.Compress(); oplInfo.Send(a.NetworkStream); oplInfo2.Send(a.NetworkStream); supportedFeatures.Send(a.NetworkStream); mobileUpdate.Send(a.NetworkStream); mobileStatus.Send(a.NetworkStream); warMode.Send(a.NetworkStream); mobileIncoming.Send(a.NetworkStream); //oplInfo2.Send(a.NetworkStream); LoginConfirmed loginConfirmed = new LoginConfirmed(); loginConfirmed.Build(); loginConfirmed.Compress(); loginConfirmed.Send(a.NetworkStream); GameTime gameTime = new GameTime(); gameTime.Hour = Convert.ToByte(DateTime.Now.Hour); gameTime.Minute = Convert.ToByte(DateTime.Now.Minute); gameTime.Second = Convert.ToByte(DateTime.Now.Second); gameTime.Build(); gameTime.Compress(); gameTime.Send(a.NetworkStream); seasonChange.Send(a.NetworkStream); mapChange.Send(a.NetworkStream); /*globalLight.Send(a.NetworkStream); * infraVision.Send(a.NetworkStream); * gameTime.Send(a.NetworkStream); * * DisplayPaperdoll displayPaperdoll = new DisplayPaperdoll(); * displayPaperdoll.Flags550 = Flags55.CanLift; * displayPaperdoll.Serial = 400; * displayPaperdoll.Text = "lokis, Apprentice smith ".ToCharArray(); * displayPaperdoll.Build(); * displayPaperdoll.Compress(); * * * displayPaperdoll.Send(a.NetworkStream); * * oplInfo.Send(a.NetworkStream); * * //break; * * //case 0xD6: * globalLight = new GlobalLight(); * globalLight.LightLevel240 = LightLevel24.Bright; * globalLight.Build(); * globalLight.Compress(); * * infraVision = new Infravision(); * infraVision.Active = 0x00; * infraVision.Serial = 2420; * infraVision.Build(); * infraVision.Compress(); * * mapChange = new MapChange(); * mapChange.MapId = Map102.felucca; * mapChange.Build(); * mapChange.Compress(); * * mapChange.Send(a.NetworkStream); * infraVision.Send(a.NetworkStream); * globalLight.Send(a.NetworkStream); * * * mobileUpdate.Send(a.NetworkStream); * mobileStatus.Send(a.NetworkStream); * * warMode.Send(a.NetworkStream); * mobileIncoming.Send(a.NetworkStream); * oplInfo.Send(a.NetworkStream); * * SkillsUpdate skillsUpdate = new SkillsUpdate(); * skillsUpdate.ListType220 = ListType22.capped; * * * for (int i = 0; i < 55; i++) * { * Random rand = new Random(); * Int16 skillBaseValue = 100; * Int16 skillCappedValue = 100; * Int16 skillValue = 100; * * skillsUpdate.Skills.Add(new Skills() { SkillID = (SkillName)i, LockStatus = 0x00, SkillBaseValue = skillBaseValue, SkillCappedValue = skillCappedValue, SkillValue = skillValue }); * } * * skillsUpdate.Build(); * skillsUpdate.Compress(); * skillsUpdate.Send(a.NetworkStream);*/ DisplayPaperdoll displayPaperdoll = new DisplayPaperdoll(); displayPaperdoll.Flags550 = Flags55.CanLift; displayPaperdoll.Serial = 2420; displayPaperdoll.Text = "LoKiS, Apprentice smith"; displayPaperdoll.Build(); displayPaperdoll.Compress(); displayPaperdoll.Send(a.NetworkStream); break; case 0x34: SkillsUpdate skillsUpdate = new SkillsUpdate(); skillsUpdate.ListType220 = ListType22.capped; for (int i = 0; i < 55; i++) { Random rand = new Random(); Int16 skillBaseValue = 100; Int16 skillCappedValue = 100; Int16 skillValue = 100; skillsUpdate.Skills.Add(new Skills() { SkillID = (SkillName)i + 1, LockStatus = 0x00, SkillBaseValue = skillBaseValue, SkillCappedValue = skillCappedValue, SkillValue = skillValue }); } skillsUpdate.Build(); skillsUpdate.Compress(); skillsUpdate.Send(a.NetworkStream); break; case 0x02: MovementAccepted movAccepted = new MovementAccepted(); movAccepted.Sequence = packet[2]; movAccepted.Status = 0x03; movAccepted.Build(); movAccepted.Compress(); movAccepted.Send(a.NetworkStream); /*AsciiMessage asciiMessage = new AsciiMessage(); * asciiMessage.Serial = 0xFFFFFFFF; * asciiMessage.Hue = 0x3b2; * asciiMessage.Graphic = 0xFFFF; * asciiMessage.Font = 3; * asciiMessage.Name = "PELUPELUPELUPELUPELUPELUPELUU".ToCharArray(); * asciiMessage.TextMessage = "PELUDO"; * asciiMessage.MessageType140 = MessageType14.System; * asciiMessage.Build(); * asciiMessage.Compress(); * asciiMessage.Send(a.NetworkStream);*/ /* Pacotes * 5D - PlayCharacter CS * BD - ClientVersion SC * BD - ClientVersion CS * 1B - LoginConfirm SC * 34 - MobileQuery CS * BD - ClientVersion CS * BF.05 - ScreenSize CS * BF.0B - ClientLanguage CS * BF.0F - ClientInfo CS * BF.08 - MapChange SC * BF.18 - MapPatches SC * BC - SeasonChange SC * B9 - SupportedFeatures SC * 20 - MobileUpdate SC * 20 - MobileUpdate SC * 4F - GlobalBright SC * 4E - Infravision SC * 20 - MobileUpdate SC * 78 - MobileIncoming SC * 11 - MobileStatus SC * 72 - Warmode SC * 78 - MobileIncoming SC * DC - OPLInfo SC * B9 - SupportedFeatures SC * 20 - MobileUpdate SC * 11 - MobileStatus SC * 72 - Warmode SC * 78 - MobileIncoming SC * 55 - LoginConfirmed SC * 06 - DoubleClick CS * 5B - GameTime SC * BC - SeasonChange SC * BF - MapChange SC * 4F - GlobalBright SC * 4E - Infravision SC * AE - UnicodeMessage SC * D6 - BatchQueryProperties CS * 1C - AsciiMessage SC * 3A - SkillsUpdate SC * 88 - DisplayPaperdoll SC * DC - OPLInfo SC * D6 - BatchQueryProperties CS * BF.24 - Unknown CS */ /* Ordem da DoLogin(): * LoginConfirm - * MapChange - * SeasonChange - * SupportedFeatures - * MobileUpdate- * MobileUpdate- * MobileUpdate- * MobileIncoming * MobileStatus - * SetWarMode - * SupportedFeatures - * MobileUpdate - * MobileStatus - * MobileIncoming * LoginComplete - * CurrentTime * SeasonChange - * MapChange- * LoginEventArgs */ /* * LoginConfirm loginConfirm = new LoginConfirm( a.CharList[0] ); * loginConfirm.Build(); * loginConfirm.Send(a.TcpClient); * * * UOPackets.ServerPackets.LoginConfirm loginConfirm = new UOPackets.ServerPackets.LoginConfirm(); * loginConfirm.Body = 0; * loginConfirm.Direction131 = Direction13.North; * loginConfirm.X = 2520; * loginConfirm.Y = 521; * loginConfirm.Z = 0; * * * * //a.TcpClient.Client.Send(loginConfirm.Data, 0, loginConfirm.PacketSize, SocketFlags.None); * * CharacterMapChange characterMapChange = new CharacterMapChange(0x01); * characterMapChange.Build(); * Subcommands subCommands = new Subcommands(characterMapChange); * subCommands.Build(); * * characterMapChange.Send(a.TcpClient); * //a.TcpClient.Client.Send(characterMapChange.Data, 0, characterMapChange.PacketSize, SocketFlags.None); * * UOPackets.ServerPackets.SeasonChange seasonChange = new UOPackets.ServerPackets.SeasonChange(); * seasonChange.PlayMusic761 = PlayMusic76.yes; * seasonChange.Season750 = Season75.summer; * seasonChange.Build(); * seasonChange.Compress(); * seasonChange.Send(a.TcpClient); * * UOPackets.ServerPackets.SupportedFeatures supportedFeatures = new UOPackets.ServerPackets.SupportedFeatures(); * supportedFeatures.Flags730 = Flags73.enableAOSfeaturesskillsspellsmapfightbook; * supportedFeatures.Build(); * supportedFeatures.Compress(); * supportedFeatures.Send(a.TcpClient); * * UOPackets.ServerPackets.MobileUpdate mobileUpdate = new UOPackets.ServerPackets.MobileUpdate(); * mobileUpdate.Body = 0; * mobileUpdate.Direction163 = Direction16.North; * mobileUpdate.Flags151 = 0; * mobileUpdate.Hue = 0; * mobileUpdate.X = 2520; * mobileUpdate.Y = 521; * mobileUpdate.Z = 0; * mobileUpdate.Serial = 0; * mobileUpdate.Build(); * mobileUpdate.Compress(); * mobileUpdate.Send(a.TcpClient); * mobileUpdate.Send(a.TcpClient); * mobileUpdate.Send(a.TcpClient); * * * UOPackets.ServerPackets.MobileStatus mobileStatus = new UOPackets.ServerPackets.MobileStatus(); * mobileStatus.Serial = 0; * mobileStatus.Name = "teste".ToCharArray(); * mobileStatus.HitPoints = 100; * mobileStatus.MaximumHitPoints = 100; * mobileStatus.AllowNameChange50 = AllowNameChange5.yes; * mobileStatus.SupportedFeatures61 = SupportedFeatures6.AOSattributes; * mobileStatus.Gender = 0; * mobileStatus.Strength = 100; * mobileStatus.Dexterity = 100; * mobileStatus.Intelligence = 100; * mobileStatus.Stamina = 100; * mobileStatus.MaximumStamina = 100; * mobileStatus.Mana = 100; * mobileStatus.MaximumMana = 100; * mobileStatus.Gold = 500; * mobileStatus.ArmorRating = 100; * mobileStatus.Weight = 50; * mobileStatus.StatCap = 300; * mobileStatus.Followers = 0; * mobileStatus.MaximumFollowers = 6; * mobileStatus.FireResistance = 0; * mobileStatus.ColdResistance = 0; * mobileStatus.PoisonResistance = 0; * mobileStatus.EnergyResistance = 0; * mobileStatus.Luck = 0; * mobileStatus.MinimumWeaponDamage = 0; * mobileStatus.MaximumWeaponDamage = 100; * mobileStatus.TithingPoints = 0; * mobileStatus.Build(); * mobileStatus.Compress(); * mobileStatus.Send(a.TcpClient); * * * UOPackets.ServerPackets.WarMode setWarMode = new UOPackets.ServerPackets.WarMode(); * setWarMode.Warmode = 0; * setWarMode.Build(); * setWarMode.Compress(); * setWarMode.Send(a.TcpClient); * * * supportedFeatures.Send(a.TcpClient); * mobileUpdate.Send(a.TcpClient); * mobileStatus.Send(a.TcpClient); * * * UOPackets.LoginComplete loginComplete = new LoginComplete(); * loginComplete.Build(); * loginComplete.Send(a.TcpClient); * * * seasonChange.Send(a.TcpClient); * UOPackets.ServerPackets.MapChange mapChange = new UOPackets.ServerPackets.MapChange(); * mapChange.Build(); * mapChange.Send(a.TcpClient); * * * * * //ClientFeatures clientFeatures = new ClientFeatures(); * //clientFeatures.Build(); * * //a.TcpClient.Client.Send(clientFeatures.m_Data, 0, clientFeatures.PacketSize, SocketFlags.None); * /* * CharacterWarmode characterWarmode = new CharacterWarmode(); * characterWarmode.Build(); * * a.TcpClient.Client.Send( characterWarmode.Data, 0, characterWarmode.PacketSize, SocketFlags.None ); * * * * a.TcpClient.Client.Send(subCommands.Data, 0, subCommands.PacketSize, SocketFlags.None); * * * CharacterSync characterSync = new CharacterSync(a.CharList[0]); * characterSync.Build(); * * a.TcpClient.Client.Send(characterSync.Data, 0, characterSync.PacketSize, SocketFlags.None); * * LoginComplete loginComplete = new LoginComplete(); * loginComplete.Build(); * * a.TcpClient.Client.Send(loginComplete.Data, 0, loginComplete.PacketSize, SocketFlags.None); * */ break; } } catch (Exception ex) { } }