public void Recive(NetIncomingMessage msg) { msg.Position = 0; short opcode = msg.ReadInt16(); switch (opcode) { case MovePacket.OpCode: { MovePacket move = new MovePacket(); move.X = msg.ReadFloat(); move.Y = msg.ReadFloat(); Console.WriteLine($"{User.ID} X:{move.X} Y:{move.Y}"); break; } case RoomStartGamePacket.OpCode: { if (GameRoom.Room.Master == User) { GameRoom.Start(); } else { //logowanie że cos jest nie tak } break; } } }
public void Move(RealmTime time, MovePacket pkt) { if (pkt.Position.X == -1 || pkt.Position.Y == -1) return; double newX = X; double newY = Y; if (newX != pkt.Position.X) { newX = pkt.Position.X; UpdateCount++; } if (newY != pkt.Position.Y) { newY = pkt.Position.Y; UpdateCount++; } if (HasConditionEffect(ConditionEffects.Paused) == true) { ApplyConditionEffect(new ConditionEffect() { Effect = ConditionEffectIndex.Paused, DurationMS = -1 }); } else if (HasConditionEffect(ConditionEffects.Paused) == false) { ApplyConditionEffect(new ConditionEffect() { Effect = ConditionEffectIndex.Paused, DurationMS = 0 }); } Move((float)newX, (float)newY); }
public static void ReadPacket(ref NetIncomingMessage msg, ref MovePacket packet) { packet.uid = msg.ReadInt64(); packet.posX = msg.ReadInt32(); packet.posY = msg.ReadInt32(); packet.facingDirection = (Player.FacingDirections)msg.ReadInt32(); }
public void AddNewMovement(MovePacket packet) { var physicsObject = _gameObjects[packet.Id]; physicsObject.Moves.Add(packet.Move, packet.Duration); physicsObject.Rotations.Add(packet.Rotation, packet.Duration); }
public void Move(float x, float y) { var targetPos = new Vector2(x, y); var p = new MovePacket(targetPos); conn.Send(p); }
// Token: 0x0600046C RID: 1132 RVA: 0x000176C8 File Offset: 0x000158C8 public void move(MovePacket move) { if (!Settings.Default.EnableAntiAFK) { return; } DateTime now = DateTime.Now; if (this._lastLocation.X != move.NewPosition.X || this._lastLocation.Y != move.NewPosition.Y) { this._lastMove = now; this._lastLocation = move.NewPosition; } if (now.Subtract(this._lastMove) > TimeSpan.FromMinutes(5.0)) { this._lastMove = now; Process[] processesByName = Process.GetProcessesByName("RotMG Exalt"); if (processesByName.Any <Process>()) { Console.WriteLine("Client: Activating Anti AFK"); AntiAFK.PostMessage(processesByName.First <Process>().MainWindowHandle, 513u, 1, 1); Thread.Sleep(32); AntiAFK.PostMessage(processesByName.First <Process>().MainWindowHandle, 514u, 0, 1); } } }
// Token: 0x06000499 RID: 1177 RVA: 0x00018F5C File Offset: 0x0001715C public void move(MovePacket move) { if (this._WYanjAEAeovcd96Ghpur7VAJRUlA) { this._WYanjAEAeovcd96Ghpur7VAJRUlA = false; this._sOwc8Hz5GYPFJ7BLvgRX72MvmaK(move._Nx46RcGIU0H1BCGWaJXjN1ieopt, 2595, byte.MaxValue, move.NewPosition); } }
// Token: 0x0600050E RID: 1294 RVA: 0x0001E150 File Offset: 0x0001C350 public void move(MovePacket move) { this._y197qHnAdnQHPqX30R0Bq0tjIOcA = Environment.TickCount; if (this._W6Ov6AArxzTTDnCyBtZPqkqNaKf.Player != null) { this._W6Ov6AArxzTTDnCyBtZPqkqNaKf.Player.ClientPosition = move.NewPosition; } }
public void TestSerde() { var targetPos = new Vector2(1, 2); var a = new MovePacket(targetPos); var b = SerializeAndDeserialize(a); Assert.Equal(a, b); }
public static void WritePacket(ref NetOutgoingMessage msg, ref MovePacket packet) { msg.Write((byte)Types.MOVE); msg.Write(packet.uid); msg.Write(packet.posX); msg.Write(packet.posY); msg.Write((Int32)packet.facingDirection); }
private void EnqueueAction(Vector2 delta) { var p = new MovePacket { Id = _clientService.Id, Direction = delta * (3.0f * Time.deltaTime), ServerTick = 0 }; _clientService.SendPacketSerializable(PacketType.Movement, p, SendType.Unreliable); }
private void Update(MovePacket packet) { Entity self = this[SelfID]; self.Position = packet.Position; Time = packet.Time; self.OnUpdated(); }
public void ClientTick(RealmTime time, MovePacket packet) { oldClientTime = curClientTime; curClientTime = packet.Time; if (first5 < 5) { first5++; } }
void HandleMove(Session session, MovePacket p) { var holder = GetPlayerHolder(session); if (holder.Mode == PlayerMode.Player) { var player = holder.Player; var speed = Config.PlayerSpeed; player.TargetPosition = p.TargetPos; player.Speed = speed; } }
public void Setup() { _packet = new MovePacket(Guid.NewGuid(), new Vector3(), new Quaternion(), 1.0f); _mockGuidSerializer = Substitute.For <IPacketConverter <Guid> >(); _mockVectorSerializer = Substitute.For <IPacketConverter <Vector3> >(); _mockQuaternionSerializer = Substitute.For <IPacketConverter <Quaternion> >(); _serializer = new MovePacketSerializer( _mockGuidSerializer, _mockVectorSerializer, _mockQuaternionSerializer); }
// Token: 0x060004B5 RID: 1205 RVA: 0x0001AD5C File Offset: 0x00018F5C public void move(MovePacket move) { if (move.TickId == 0) { this._y197qHnAdnQHPqX30R0Bq0tjIOcA = move._Nx46RcGIU0H1BCGWaJXjN1ieopt; this._9uQC3m47mudh1sCSmEtgs0EPXSo(move._Nx46RcGIU0H1BCGWaJXjN1ieopt, 0, move.NewPosition); } else { this._9uQC3m47mudh1sCSmEtgs0EPXSo(move._Nx46RcGIU0H1BCGWaJXjN1ieopt, move._Nx46RcGIU0H1BCGWaJXjN1ieopt - this._y197qHnAdnQHPqX30R0Bq0tjIOcA, move.NewPosition); this._y197qHnAdnQHPqX30R0Bq0tjIOcA = move._Nx46RcGIU0H1BCGWaJXjN1ieopt; } this._0qPs3ICAiKqEpockvHdkXyWtLLK = move.NewPosition; }
internal void HandlePacket(MovePacket packet, PacketSession peerSession) { if (_player != null && _player.ObjectId == packet.ObjectId) { return; } Character findOne; if (!_characters.TryGetValue(packet.ObjectId, out findOne)) { return; } findOne.Correction(packet.CurrentPoint, packet.State, packet.Direction); }
public void Handle(MovePacket packet, PacketSession peerSession) { var targetObject = _context.GetGameObjecct(packet.ObjectId); if (targetObject == null) { return; } targetObject.Position = packet.CurrentPoint; targetObject.MoveState = packet.State; targetObject.Direction = packet.Direction; // 다른 유저들에게 해당 유저가 움직인다는 사실을 알려준다. _context.BroadcastPacket(targetObject.ToMovePacket(), peerSession); }
public bool Process(NetIncomingMessage msg) { msg.Position = 0; short opcode = msg.ReadInt16(); switch (opcode) { case MovePacket.OpCode: { MovePacket move = new MovePacket(); move.X = msg.ReadFloat(); move.Y = msg.ReadFloat(); Console.WriteLine($"{Current.ID} X:{move.X} Y:{move.Y}"); // ForwardVector = new Vector2(move.X, move.Y); /*foreach (UserSession otherPlayers in UserRoom.PlayersInRoomCollection) * { * if (otherPlayers.Connection != msg.SenderConnection && otherPlayers.ID != Current.ID) * { * NetOutgoingMessage SendToCurrentPlayerAboutPlayers = otherPlayers.Connection.Peer.CreateMessage(); * SendToCurrentPlayerAboutPlayers.Write(MovePacket.OpCode); * SendToCurrentPlayerAboutPlayers.Write(Current.ID); * SendToCurrentPlayerAboutPlayers.Write(move.X); * SendToCurrentPlayerAboutPlayers.Write(move.Y); * otherPlayers.Connection.SendMessage(SendToCurrentPlayerAboutPlayers, NetDeliveryMethod.UnreliableSequenced, SendToCurrentPlayerAboutPlayers.LengthBytes); * //Console.WriteLine($"ID:{Current.ID} POS: X{move.X};Y{move.Y}"); * } * }*/ break; } case 2620: { break; } } return(false); }
// Token: 0x060004A8 RID: 1192 RVA: 0x0001A180 File Offset: 0x00018380 public void Move(MovePacket move) { if (Settings.Default.EnableAutoLoot && !this._inVault) { foreach (GameObject gameObject in this.client.Objects.Values.ToList <GameObject>()) { if (Enum.IsDefined(typeof(Bags), gameObject.ObjectType)) { byte b = 0; while ((int)b < gameObject.Inventory.Length) { int num = gameObject.Inventory[(int)b]; if (num != -1) { if (this.CheckLootTier((ushort)num)) { if (Settings.Default.AutoLootQuests) { QuestObjIdPacket questObjIdPacket = (QuestObjIdPacket)Packet.Create(PacketType.QUESTOBJID); questObjIdPacket.ObjectId = gameObject.ObjectId; questObjIdPacket._4jOLjW4f3NFdoiR8aTchgxYgk8f = new int[0]; this._lootQuest = gameObject.ObjectId; this.client.SendToClient(questObjIdPacket); } if (gameObject.ServerPosition.DistanceSquaredTo(move.NewPosition) <= 1.0) { if (move._Nx46RcGIU0H1BCGWaJXjN1ieopt - this.Time > 600) { this.PickupItem(move.NewPosition, move._Nx46RcGIU0H1BCGWaJXjN1ieopt, gameObject.ObjectId, num, b); } return; } } } b += 1; } } } return; } }
public void TestWalkMove() { // login, create character, start game FakeNetworkClient client = HandlerTestHelper.InitializeTestEnvironment(); WalkPacket walkPacket = new WalkPacket { Speed = 11, XCoordinate = 89, YCoordinate = 126 }; // send walkpacket to client client.ReceivePacket(walkPacket); string mvPacket = HandlerTestHelper.WaitForPacket(client, "mv"); MovePacket movePacket = PacketFactory.Deserialize <MovePacket>(mvPacket); Assert.AreEqual(walkPacket.XCoordinate, movePacket.PositionX); Assert.AreEqual(walkPacket.YCoordinate, movePacket.PositionY); Assert.AreEqual(walkPacket.Speed, movePacket.Speed); HandlerTestHelper.ShutdownTestingEnvironment(); Assert.Pass(); }
public void Move(RealmTime time, MovePacket pkt) { if (pkt.Position.X == -1 || pkt.Position.Y == -1) { return; } double newX = X; double newY = Y; if (newX != pkt.Position.X) { newX = pkt.Position.X; UpdateCount++; } if (newY != pkt.Position.Y) { newY = pkt.Position.Y; UpdateCount++; } Move((float)newX, (float)newY); psr.Database.SaveCharacter(psr.Account, psr.Character); }
public void ClientTick(RealmTime time, MovePacket packet) { //oldClientTime = curClientTime; //curClientTime = packet.Time; //if (first5 < 5) first5++; //if (oldClientTime == 0 || first5 < 5) return; //if (curClientTime - oldClientTime >= 500 || curClientTime - oldClientTime <= 100) //{ // Client.Disconnect(); // Owner.BroadcastPacket(new TextPacket // { // Name = "@ANNOUNCEMENT", // BubbleTime = 0, // CleanText = "", // ObjectId = 0, // Recipient = "", // Stars = -1, // Text = String.Format("{0} just tried to speedhack!\ntimedifference: {1}", Name, curClientTime - oldClientTime) // }, null); //} //SendInfo((curClientTime - oldClientTime).ToString()); }
private void handleMovePacket(MovePacket p) { //Move packet recieved server side if (m.map.getData((int)p.from.X, (int)p.from.Y) == null) { return; } if (m.map.getData((int)p.to.X, (int)p.to.Y) != null) { return; } if (m.map.getData((int)p.from.X, (int)p.from.Y).AP == 0) { return; } Unit u = m.map.getData((int)p.from.X, (int)p.from.Y); u.AP--; m.map.setData((int)p.to.X, (int)p.to.Y, u); updateTile(p.from); updateTile(p.to); }
public void Recive(NetIncomingMessage msg) { msg.Position = 0; short opcode = msg.ReadInt16(); switch (opcode) { case MovePacket.OpCode: { MovePacket move = new MovePacket(); move.X = msg.ReadFloat(); move.Y = msg.ReadFloat(); //User.position = new Vector2(move.X, move.Y); ClickPosition = new Vector2(move.X, move.Y); DestinationVector = (ClickPosition - User.position); DestinationVector = Vector2.Normalize(DestinationVector); var dotProduct = Vector2.Dot(DestinationVector, Forward); if (Engine.GameUtility.AdditionalMath.MyMath.AngleDir(Forward, DestinationVector) >= 0) { SideMultiplier = -1; } else { SideMultiplier = 1; } PlayerIsReady = true; Console.WriteLine($"{User.ID} X:{move.X} Y:{move.Y}"); break; } } }
internal void OnPacketReceived(object sender, PacketEventArgs e) { var worker = (SocketProxyWorker)sender; if (e.ID == worker.PacketTable.UPDATE) { var packet = UpdatePacket.Read(new NBufferReader(e.Content)); Update(packet); } else if (e.ID == worker.PacketTable.MOVE) { var packet = MovePacket.Read(new NBufferReader(e.Content)); Update(packet); } else if (e.ID == worker.PacketTable.NEW_TICK) { var packet = NewTickPacket.Read(new NBufferReader(e.Content)); Update(packet); } else if (e.ID == worker.PacketTable.CREATE_SUCCESS) { SelfID = (uint)IPAddress.NetworkToHostOrder(BitConverter.ToInt32(e.Content, 0)); } }
// Token: 0x06000474 RID: 1140 RVA: 0x00017990 File Offset: 0x00015B90 public void Move(MovePacket move) { this._lastUpdate = Environment.TickCount; }
private void OnMove(Client client, MovePacket packet) { client.PreviousTime = packet.Time; client.LastUpdate = Environment.TickCount; client.PlayerData.Pos = packet.NewPosition; }
public void _tX4Fl2mBYL4XNqNEIW0OPnopM9i(MovePacket move) { //Discarded unreachable code: IL_0095 if (!Settings.Default.EnableAntiAFK) { goto IL_000f; } goto IL_019b; IL_019b: DateTime now = DateTime.Now; int num; int num2; if (_LAY5qDOXeCwwE8WGSZkOMs9oNKh._PositionX != move._NewPosition._PositionX) { num = -893787978; num2 = num; } else { num = -1561388819; num2 = num; } goto IL_0014; IL_0014: Process[] processesByName = default(Process[]); while (true) { uint num3; switch ((num3 = (uint)num ^ 0xBC60D0C9u) % 11u) { case 0u: break; default: return; case 5u: { int num6; int num7; if (_LAY5qDOXeCwwE8WGSZkOMs9oNKh._PositionY != move._NewPosition._PositionY) { num6 = -1515855326; num7 = num6; } else { num6 = -511799426; num7 = num6; } num = num6 ^ ((int)num3 * -1746480963); continue; } case 9u: _lk4TXx0LrA0Y1fFpntuJjMzmkAb = now; num = -1805755535; continue; case 2u: return; case 10u: goto IL_00a7; case 4u: _pJUJvZoXSjrgx8QMiXvHh3JZaJF(processesByName.First().MainWindowHandle, 513u, 1, 1); Thread.Sleep(32); _pJUJvZoXSjrgx8QMiXvHh3JZaJF(processesByName.First().MainWindowHandle, 514u, 0, 1); num = ((int)num3 * -586613325) ^ -809795664; continue; case 3u: { _lk4TXx0LrA0Y1fFpntuJjMzmkAb = now; processesByName = Process.GetProcessesByName("RotMG Exalt"); int num4; int num5; if (!processesByName.Any()) { num4 = 1115580018; num5 = num4; } else { num4 = 688981905; num5 = num4; } num = num4 ^ ((int)num3 * -1937885201); continue; } case 6u: _LAY5qDOXeCwwE8WGSZkOMs9oNKh = move._NewPosition; num = (int)(num3 * 849265353) ^ -1527796078; continue; case 8u: Program._JWptdPwuTlZYlLpGrinhw8DeS3h("client", "Activating Anti AFK"); num = ((int)num3 * -1373275299) ^ -1315480851; continue; case 7u: goto IL_019b; case 1u: return; } break; IL_00a7: int num8; if (!(now.Subtract(_lk4TXx0LrA0Y1fFpntuJjMzmkAb) > TimeSpan.FromMinutes(5.0))) { num = -2023818197; num8 = num; } else { num = -1136649474; num8 = num; } } goto IL_000f; IL_000f: num = -1588894782; goto IL_0014; }
/// <summary> /// Allows the game to run logic such as updating the world, /// checking for collisions, gathering input, and playing audio. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Update(GameTime gameTime) { if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape)) { Exit(); } MouseState mouse = Mouse.GetState(); /////////TEST akumulator += gameTime.ElapsedGameTime.TotalMilliseconds; foreach (PlayerClass otherPl in OtherPlayerList) { otherPl.Interpolate(); } /* if (akumulator > movePacketInterval && player.PlayerNetInfo != null && player.Forward != player.OldForward) * { * var newMSG = Client.CreateMessage(); * newMSG.Write((short)6066); * newMSG.Write(player.Forward.X); * newMSG.Write(player.Forward.Y); * Client.SendMessage(newMSG, NetDeliveryMethod.UnreliableSequenced); * akumulator = 0; * }*/ /* * if (akumulator > movePacketInterval && player.PlayerNetInfo!=null) * { * var newMSG = Client.CreateMessage(); * newMSG.Write((short)6066); * newMSG.Write(player.Position.X); * newMSG.Write(player.Position.Y); * Client.SendMessage(newMSG, NetDeliveryMethod.UnreliableSequenced); * akumulator = 0; * }*/ /////////TEST NetIncomingMessage message; while ((message = Client.ReadMessage()) != null) { switch (message.MessageType) { case NetIncomingMessageType.Data: { // handle custom messages if (message.LengthBytes >= 2) { short opcode; opcode = message.ReadInt16(); if (opcode == 2000) { PlayerClass SpawnPlayerPacket = new PlayerClass(); SpawnPlayerPacket.ID = message.PeekInt32(); //message.ReadAllProperties((object) player); player.PlayerNetInfo = SpawnPlayerPacket; var newMSG = Client.CreateMessage(); JoinRoomPacket joinRoom = new JoinRoomPacket(roomName); newMSG.Write(JoinRoomPacket.OpCode); newMSG.Write(joinRoom.RoomName); Client.SendMessage(newMSG, NetDeliveryMethod.ReliableSequenced); akumulator = 0; } else if (opcode == 2620) { PlayerClass playerTemp = new PlayerClass(); message.ReadAllProperties(playerTemp); // playerTemp.isAlive = true; OtherPlayerList.Add(playerTemp); } else if (opcode == 6066) { MovePacket movePacket = new MovePacket(); message.ReadAllProperties(movePacket); PlayerClass player2Move = OtherPlayerList.FirstOrDefault(x => x.ID == movePacket.ID); if (player2Move != null) { player2Move.StartPosition = player2Move.EndPosition; player2Move.EndPosition = new Vector2(movePacket.X, movePacket.Y); player2Move.interStep = 0; } } else if (opcode == ResurrectPointAddPacket.OpCode) { ResurrectPointAddPacket resurrectPlayerPoint = new ResurrectPointAddPacket(); message.ReadAllProperties(resurrectPlayerPoint); PlayerClass player = OtherPlayerList.FirstOrDefault(x => x.ID == resurrectPlayerPoint.ID); // player.isAlive = false; if (player != null) { ResurrectPoint ressurectPoint = new ResurrectPoint("ResurrectID" + player.ID); ressurectPoint.Position = new Vector2(resurrectPlayerPoint.X, resurrectPlayerPoint.Y); //Tu też będzie sie ustawiało kolor żeby gracz wiedział o kogo chodzi poza tym kto sie będzie respawnił po najechaniu na pole decydować bedzie serwer(oczywiście respawnić będzie legitnego człowieka) Map.MapElements.Add(ressurectPoint); } } else if (opcode == RevivedPlayerPacket.OpCode) { RevivedPlayerPacket revivedPlayer = new RevivedPlayerPacket(); message.ReadAllProperties(revivedPlayer); PlayerClass player = OtherPlayerList.FirstOrDefault(x => x.ID == revivedPlayer.ID); // player.isAlive = true; ResurrectPoint revivePoint = (ResurrectPoint)Map.GetMapElementByName <IMapElement>("ResurrectID" + player.ID); if (revivePoint != null) { Map.MapElements.Remove(revivePoint); } } } break; } case NetIncomingMessageType.StatusChanged: // handle connection status messages switch (message.SenderConnection.Status) { case NetConnectionStatus.Connected: { var newMSG = Client.CreateMessage(); newMSG.Write((short)2000); newMSG.Write("Client"); Client.SendMessage(newMSG, NetDeliveryMethod.UnreliableSequenced); break; } } break; case NetIncomingMessageType.DebugMessage: // handle debug messages // (only received when compiled in DEBUG mode) break; /* .. */ default: break; } } foreach (IKeyStroke key in keys) { key.Update(); } if (IsActive) { Ray _castRay = ((BasicCamera)Director.InstanceDirector.Camera).CalculateCursorRay(mouse.X, mouse.Y); positionOnPlane = PlaneControll.IntersectPoint(_castRay.Direction, _castRay.Position, Vector3.Up, new Vector3(1, 0, 1)); StandFloorDebug = Map.UpdatePlayerMovmentType(player); collision = Map.MapPath[0].FloorPolygon.IsCollide(player.CollisionObject); } // player.Update(gameTime, positionOnPlane); if (mouse.RightButton == ButtonState.Pressed && player.AliveBoiiii == false && IsActive == true) { var newMSG = Client.CreateMessage(); newMSG.Write((short)6066); newMSG.Write(positionOnPlane.X); newMSG.Write(positionOnPlane.Z); Client.SendMessage(newMSG, NetDeliveryMethod.UnreliableSequenced); } Director.InstanceDirector.Camera.Update(gameTime); Map.Update(gameTime); player.OldForward = player.Forward; base.Update(gameTime); }