Advertisement
Guest User

Untitled

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