Advertisement
Guest User

Untitled

a guest
Jan 17th, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.93 KB | None | 0 0
  1. using Plus.HabboHotel.GameClients;
  2. using Plus.Database.Interfaces;
  3. using Plus.HabboHotel.Rooms;
  4. using System;
  5. using System.Data;
  6. using Plus.Communication.Packets.Outgoing.Notifications;
  7. using Plus.HabboHotel.Quests;
  8.  
  9. namespace Plus.HabboHotel.Items.Interactor
  10. {
  11. public class InteractorRP : IFurniInteractor
  12. {
  13.  
  14. public void OnPlace(GameClient Session, Item Item)
  15. {
  16.  
  17. }
  18.  
  19. public void OnRemove(GameClient Session, Item Item)
  20. {
  21.  
  22. }
  23.  
  24. public void OnTrigger(GameClient Session, Item Item, int Request, bool HasRights)
  25. {
  26.  
  27. if (Item.BaseItem == 5315) // Informations-Konsole BaseID
  28. {
  29. string help = "================== Raumhilfe & Befehle ===================\n\n";
  30. using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
  31. {
  32. dbClient.SetQuery("SELECT * FROM `roomhelp` WHERE `roomid` = '" + Session.GetHabbo().CurrentRoomId + "'");
  33. DataTable Table = dbClient.getTable();
  34. foreach (DataRow Row in Table.Rows)
  35. {
  36. int HelpType = Convert.ToInt32(Row["type"]);
  37. if (HelpType == 1)
  38. {
  39. help += "" + Row["details"] + "\n";
  40. }
  41. else
  42. {
  43. help += "" + Row["details"] + "\n\n";
  44. }
  45. }
  46. }
  47. Session.SendMessage(new MOTDNotificationComposer("Informationen:\n\n" + help.ToString()));
  48. }
  49.  
  50. if (Session == null)
  51. return;
  52.  
  53. RoomUser User = Item.GetRoom().GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);
  54. if (User == null)
  55. return;
  56.  
  57. if (Gamemap.TilesTouching(Item.GetX, Item.GetY, User.X, User.Y))
  58. {
  59. int Modes = Item.GetBaseItem().Modes - 1;
  60.  
  61. if (Modes <= 0)
  62. return;
  63.  
  64. PlusEnvironment.GetGame().GetQuestManager().ProgressUserQuest(Session, QuestType.FURNI_SWITCH);
  65.  
  66. int CurrentMode = 0;
  67. int NewMode = 0;
  68.  
  69. if (!int.TryParse(Item.ExtraData, out CurrentMode))
  70. {
  71. }
  72.  
  73. if (CurrentMode <= 0)
  74. NewMode = 1;
  75. else if (CurrentMode >= Modes)
  76. NewMode = 0;
  77. else
  78. NewMode = CurrentMode + 1;
  79.  
  80. Item.ExtraData = NewMode.ToString();
  81. Item.UpdateState();
  82. }
  83. else
  84. User.MoveTo(Item.SquareInFront);
  85. }
  86.  
  87. public void OnWiredTrigger(Item Item)
  88. {
  89. }
  90. }
  91. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement