Guest User

Untitled

a guest
May 4th, 2017
342
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.08 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3. using System.Text;
  4. using System.Collections.Generic;
  5.  
  6. using Plus.HabboHotel.Rooms;
  7. using Plus.Communication.Packets.Outgoing;
  8. using Plus.Communication.Packets.Outgoing.Nux;
  9. using Plus.Communication.Packets.Outgoing.Rooms.Notifications;
  10.  
  11. namespace Plus.Communication.Packets.Incoming.Rooms.Engine
  12. {
  13. class MoveAvatarEvent : IPacketEvent
  14. {
  15. public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
  16. {
  17. if (Session == null || Session.GetHabbo() == null)
  18. return;
  19.  
  20. if (!Session.GetHabbo().InRoom)
  21. return;
  22.  
  23. Room Room = Session.GetHabbo().CurrentRoom;
  24. if (Room == null)
  25. return;
  26.  
  27. RoomUser User = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);
  28. if (User == null || !User.CanWalk)
  29. return;
  30.  
  31. int MoveX = Packet.PopInt();
  32. int MoveY = Packet.PopInt();
  33.  
  34. if (MoveX == User.X && MoveY == User.Y)
  35. {
  36. if(!User.IsWalking)
  37. return;
  38. else
  39. User.SeatCount++;
  40.  
  41. if (User.SeatCount == 5)
  42. return;
  43. }
  44.  
  45. if (User.RidingHorse)
  46. {
  47. RoomUser Horse = Room.GetRoomUserManager().GetRoomUserByVirtualId(User.HorseID);
  48. if (Horse != null)
  49. Horse.MoveTo(MoveX, MoveY);
  50. }
  51.  
  52. User.MoveTo(MoveX, MoveY);
  53. if (Session.GetHabbo().NewUser)
  54. {
  55. var nuxStatus = new ServerPacket(ServerPacketHeader.NuxUserStatus);
  56. nuxStatus.WriteInteger(2);
  57. Session.SendPacket(nuxStatus);
  58. Session.SendPacket(new NuxAlertComposer("nux/lobbyoffer/hide"));
  59. Session.SendPacket(new NuxAlertComposer("helpBubble/add/HC_JOIN_BUTTON/" + PlusEnvironment.GetGame().GetLanguageLocale().TryGetValue("phrase_7_end") +""));
  60. }
  61. }
  62. }
  63. }
Add Comment
Please, Sign In to add comment