using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Data; using Uber.Storage; using Uber.Messages; using Uber.HabboHotel.GameClients; using Uber.HabboHotel.Pathfinding; using Uber.HabboHotel.Rooms; namespace Uber.HabboHotel.Items.Interactors { class InteractorGenericSwitch : FurniInteractor { int Modes; public InteractorGenericSwitch(int Modes) { this.Modes = (Modes - 1); if (this.Modes < 0) { this.Modes = 0; } } public override void OnPlace(GameClient Session, RoomItem Item) { } public override void OnRemove(GameClient Session, RoomItem Item) { } public override void OnTrigger(GameClient Session, RoomItem Item, int Request, bool UserHasRights) { if (!UserHasRights) { return; } if (this.Modes == 0) { return; } int currentMode = 0; int newMode = 0; try { currentMode = int.Parse(Item.ExtraData); } catch (Exception) { } if (currentMode <= 0) { newMode = 1; } else if (currentMode >= Modes) { newMode = 0; } else { newMode = currentMode + 1; } Item.ExtraData = newMode.ToString(); Item.UpdateState(); } } }