public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params) { if (!Room.CheckRights(Session, true)) { Session.SendWhisper("Oops, only the room owner can run this command!"); return; } foreach (RoomUser User in Room.GetRoomUserManager().GetUserList().ToList()) { if (User == null || User.IsPet || !User.IsBot) continue; RoomUser BotUser = null; if (!Room.GetRoomUserManager().TryGetBot(User.BotData.Id, out BotUser)) return; using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("UPDATE `bots` SET `room_id` = '0' WHERE `id` = @id LIMIT 1"); dbClient.AddParameter("id", User.BotData.Id); dbClient.RunQuery(); } Session.GetHabbo().GetInventoryComponent().TryAddBot(new Bot(Convert.ToInt32(BotUser.BotData.Id), Convert.ToInt32(BotUser.BotData.ownerID), BotUser.BotData.Name, BotUser.BotData.Motto, BotUser.BotData.Look, BotUser.BotData.Gender)); Session.SendMessage(new BotInventoryComposer(Session.GetHabbo().GetInventoryComponent().GetBots())); Room.GetRoomUserManager().RemoveBot(BotUser.VirtualId, false); } Session.SendWhisper("Success, removed all bots."); }
public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params) { if (Session.GetHabbo().Id == Room.OwnerId) { //Let us check anyway. if (!Room.CheckRights(Session, true)) return; foreach (Item Item in Room.GetRoomItemHandler().GetWallAndFloor.ToList()) { if (Item == null || Item.UserID == Session.GetHabbo().Id) continue; GameClient TargetClient = PlusEnvironment.GetGame().GetClientManager().GetClientByUserID(Item.UserID); if (TargetClient != null && TargetClient.GetHabbo() != null) { Room.GetRoomItemHandler().RemoveFurniture(TargetClient, Item.Id); TargetClient.GetHabbo().GetInventoryComponent().AddNewItem(Item.Id, Item.BaseItem, Item.ExtraData, Item.GroupId, true, true, Item.LimitedNo, Item.LimitedTot); TargetClient.GetHabbo().GetInventoryComponent().UpdateItems(false); } else { Room.GetRoomItemHandler().RemoveFurniture(null, Item.Id); using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.RunQuery("UPDATE `items` SET `room_id` = '0' WHERE `id` = '" + Item.Id + "' LIMIT 1"); } } } } else { foreach (Item Item in Room.GetRoomItemHandler().GetWallAndFloor.ToList()) { if (Item == null || Item.UserID != Session.GetHabbo().Id) continue; GameClient TargetClient = PlusEnvironment.GetGame().GetClientManager().GetClientByUserID(Item.UserID); if (TargetClient != null && TargetClient.GetHabbo() != null) { Room.GetRoomItemHandler().RemoveFurniture(TargetClient, Item.Id); TargetClient.GetHabbo().GetInventoryComponent().AddNewItem(Item.Id, Item.BaseItem, Item.ExtraData, Item.GroupId, true, true, Item.LimitedNo, Item.LimitedTot); TargetClient.GetHabbo().GetInventoryComponent().UpdateItems(false); } else { Room.GetRoomItemHandler().RemoveFurniture(null, Item.Id); using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.RunQuery("UPDATE `items` SET `room_id` = '0' WHERE `id` = '" + Item.Id + "' LIMIT 1"); } } } } }
public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params) { if (!Room.CheckRights(Session, true)) { Session.SendWhisper("Oops, only the owner of this room can run this command!"); return; } Room.GetGameMap().DiagonalEnabled = !Room.GetGameMap().DiagonalEnabled; Session.SendWhisper("Successfully updated the diagonal boolean value for this room."); }
public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params) { if (!Room.CheckRights(Session, true)) { Session.SendWhisper("Oops, only the owner of this room can run this command!"); return; } Room.GetGameMap().GenerateMaps(); Session.SendWhisper("Game map of this room successfully re-generated."); }
public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params) { if (Session.GetHabbo().GetPermissions().HasRight("room_unload_any")) { Room R = null; if (!PlusEnvironment.GetGame().GetRoomManager().TryGetRoom(Room.Id, out R)) return; PlusEnvironment.GetGame().GetRoomManager().UnloadRoom(R, true); } else { if (Room.CheckRights(Session, true)) { PlusEnvironment.GetGame().GetRoomManager().UnloadRoom(Room); } } }
public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params) { if (!Room.CheckRights(Session, true)) return; if (Params.Length == 1) { Session.SendWhisper("Please enter a value for the roller speed."); return; } int Speed; if (int.TryParse(Params[1], out Speed)) { Session.GetHabbo().CurrentRoom.GetRoomItemHandler().SetSpeed(Speed); } else Session.SendWhisper("Invalid amount, please enter a valid number."); }
public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params) { if (!Room.CheckRights(Session, true)) return; Room.GetRoomItemHandler().RemoveItems(Session); using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("UPDATE `items` SET `room_id` = '0' WHERE `room_id` = @RoomId AND `user_id` = @UserId"); dbClient.AddParameter("RoomId", Room.Id); dbClient.AddParameter("UserId", Session.GetHabbo().Id); dbClient.RunQuery(); } List<Item> Items = Room.GetRoomItemHandler().GetWallAndFloor.ToList(); if (Items.Count > 0) Session.SendWhisper("There are still more items in this room, manually remove them or use :ejectall to eject them!"); Session.SendMessage(new FurniListUpdateComposer()); }
public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params) { if (!Room.CheckRights(Session, true)) return; if (Params.Length == 1) { Session.SendWhisper("Please enter a value for the room visitor limit."); return; } int MaxAmount; if (int.TryParse(Params[1], out MaxAmount)) { if (MaxAmount == 0) { MaxAmount = 10; Session.SendWhisper("visitor amount too low, visitor amount has been set to 10."); } else if (MaxAmount > 200 && !Session.GetHabbo().GetPermissions().HasRight("override_command_setmax_limit")) { MaxAmount = 200; Session.SendWhisper("visitor amount too high for your rank, visitor amount has been set to 200."); } else Session.SendWhisper("visitor amount set to " + MaxAmount + "."); Room.UsersMax = MaxAmount; Room.RoomData.UsersMax = MaxAmount; using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.RunQuery("UPDATE `rooms` SET `users_max` = " + MaxAmount + " WHERE `id` = '" + Room.Id + "' LIMIT 1"); } } else Session.SendWhisper("Invalid amount, please enter a valid number."); }
public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params) { if (Params.Length == 1) { Session.SendWhisper("Please enter the username of the user you wish to push."); return; } if (!Room.SPushEnabled && !Room.CheckRights(Session, true) && !Session.GetHabbo().GetPermissions().HasRight("room_override_custom_config")) { Session.SendWhisper("Oops, it appears that the room owner has disabled the ability to use the push command in here."); return; } GameClient TargetClient = PlusEnvironment.GetGame().GetClientManager().GetClientByUsername(Params[1]); if (TargetClient == null) { Session.SendWhisper("An error occoured whilst finding that user, maybe they're not online."); return; } RoomUser TargetUser = Room.GetRoomUserManager().GetRoomUserByHabbo(TargetClient.GetHabbo().Id); if (TargetUser == null) { Session.SendWhisper("An error occoured whilst finding that user, maybe they're not online or in this room."); return; } if (TargetClient.GetHabbo().Username == Session.GetHabbo().Username) { Session.SendWhisper("Come on, surely you don't want to push yourself!"); return; } if (TargetUser.TeleportEnabled) { Session.SendWhisper("Oops, you cannot push a user whilst they have their teleport mode enabled."); return; } RoomUser ThisUser = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id); if (ThisUser == null) return; if (!((Math.Abs(TargetUser.X - ThisUser.X) >= 2) || (Math.Abs(TargetUser.Y - ThisUser.Y) >= 2))) { if (TargetUser.SetX - 1 == Room.GetGameMap().Model.DoorX || TargetUser.SetY - 1 == Room.GetGameMap().Model.DoorY) { Session.SendWhisper("Please don't push that user out of the room :(!"); return; } if (TargetUser.SetX - 2 == Room.GetGameMap().Model.DoorX || TargetUser.SetY - 2 == Room.GetGameMap().Model.DoorY) { Session.SendWhisper("Please don't push that user out of the room :(!"); return; } if (TargetUser.SetX - 3 == Room.GetGameMap().Model.DoorX || TargetUser.SetY - 3 == Room.GetGameMap().Model.DoorY) { Session.SendWhisper("Please don't push that user out of the room :(!"); return; } if (TargetUser.RotBody == 4) { TargetUser.MoveTo(TargetUser.X, TargetUser.Y + 3); } if (ThisUser.RotBody == 0) { TargetUser.MoveTo(TargetUser.X, TargetUser.Y - 3); } if (ThisUser.RotBody == 6) { TargetUser.MoveTo(TargetUser.X - 3, TargetUser.Y); } if (ThisUser.RotBody == 2) { TargetUser.MoveTo(TargetUser.X + 3, TargetUser.Y); } if (ThisUser.RotBody == 3) { TargetUser.MoveTo(TargetUser.X + 3, TargetUser.Y); TargetUser.MoveTo(TargetUser.X, TargetUser.Y + 3); } if (ThisUser.RotBody == 1) { TargetUser.MoveTo(TargetUser.X + 3, TargetUser.Y); TargetUser.MoveTo(TargetUser.X, TargetUser.Y - 3); } if (ThisUser.RotBody == 7) { TargetUser.MoveTo(TargetUser.X - 3, TargetUser.Y); TargetUser.MoveTo(TargetUser.X, TargetUser.Y - 3); } if (ThisUser.RotBody == 5) { TargetUser.MoveTo(TargetUser.X - 3, TargetUser.Y); TargetUser.MoveTo(TargetUser.X, TargetUser.Y + 3); } Room.SendMessage(new ChatComposer(ThisUser.VirtualId, "*super pushes " + Params[1] + "*", 0, ThisUser.LastBubble)); } else { Session.SendWhisper("Oops, " + Params[1] + " is not close enough!"); } }
public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params) { if (!Room.CheckRights(Session, true)) { Session.SendWhisper("Oops, only the room owner can run this command!"); return; } if (Room.GetRoomUserManager().GetPets().Count > 0) { foreach (RoomUser Pet in Room.GetRoomUserManager().GetUserList().ToList()) { if (Pet == null) continue; if (Pet.RidingHorse) { RoomUser UserRiding = Room.GetRoomUserManager().GetRoomUserByVirtualId(Pet.HorseID); if (UserRiding != null) { UserRiding.RidingHorse = false; UserRiding.ApplyEffect(-1); UserRiding.MoveTo(new Point(UserRiding.X + 1, UserRiding.Y + 1)); } else Pet.RidingHorse = false; } Pet.PetData.RoomId = 0; Pet.PetData.PlacedInRoom = false; Pet pet = Pet.PetData; if (pet != null) { using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.RunQuery("UPDATE `bots` SET `room_id` = '0', `x` = '0', `Y` = '0', `Z` = '0' WHERE `id` = '" + pet.PetId + "' LIMIT 1"); dbClient.RunQuery("UPDATE `bots_petdata` SET `experience` = '" + pet.experience + "', `energy` = '" + pet.Energy + "', `nutrition` = '" + pet.Nutrition + "', `respect` = '" + pet.Respect + "' WHERE `id` = '" + pet.PetId + "' LIMIT 1"); } } if (pet.OwnerId != Session.GetHabbo().Id) { GameClient Target = PlusEnvironment.GetGame().GetClientManager().GetClientByUserID(pet.OwnerId); if (Target != null) { Target.GetHabbo().GetInventoryComponent().TryAddPet(Pet.PetData); Room.GetRoomUserManager().RemoveBot(Pet.VirtualId, false); Target.SendMessage(new PetInventoryComposer(Target.GetHabbo().GetInventoryComponent().GetPets())); return; } } Session.GetHabbo().GetInventoryComponent().TryAddPet(Pet.PetData); Room.GetRoomUserManager().RemoveBot(Pet.VirtualId, false); Session.SendMessage(new PetInventoryComposer(Session.GetHabbo().GetInventoryComponent().GetPets())); } Session.SendWhisper("Success, removed all pets."); } else { Session.SendWhisper("Oops, there isn't any pets in here!?"); } }
public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params) { if (Params.Length == 1) { Session.SendWhisper("Oops, you must choose a room option to disable."); return; } if (!Room.CheckRights(Session, true)) { Session.SendWhisper("Oops, only the room owner or staff can use this command."); return; } string Option = Params[1]; switch (Option) { case "list": { StringBuilder List = new StringBuilder(""); List.AppendLine("Room Command List"); List.AppendLine("-------------------------"); List.AppendLine("Pet Morphs: " + (Room.PetMorphsAllowed == true ? "enabled" : "disabled")); List.AppendLine("Pull: " + (Room.PullEnabled == true ? "enabled" : "disabled")); List.AppendLine("Push: " + (Room.PushEnabled == true ? "enabled" : "disabled")); List.AppendLine("Super Pull: " + (Room.SPullEnabled == true ? "enabled" : "disabled")); List.AppendLine("Super Push: " + (Room.SPushEnabled == true ? "enabled" : "disabled")); List.AppendLine("Respect: " + (Room.RespectNotificationsEnabled == true ? "enabled" : "disabled")); List.AppendLine("Enables: " + (Room.EnablesEnabled == true ? "enabled" : "disabled")); Session.SendNotification(List.ToString()); break; } case "push": { Room.PushEnabled = !Room.PushEnabled; using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("UPDATE `rooms` SET `push_enabled` = @PushEnabled WHERE `id` = '" + Room.Id +"' LIMIT 1"); dbClient.AddParameter("PushEnabled", PlusEnvironment.BoolToEnum(Room.PushEnabled)); dbClient.RunQuery(); } Session.SendWhisper("Push mode is now " + (Room.PushEnabled == true ? "enabled!" : "disabled!")); break; } case "spush": { Room.SPushEnabled = !Room.SPushEnabled; using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("UPDATE `rooms` SET `spush_enabled` = @PushEnabled WHERE `id` = '" + Room.Id + "' LIMIT 1"); dbClient.AddParameter("PushEnabled", PlusEnvironment.BoolToEnum(Room.SPushEnabled)); dbClient.RunQuery(); } Session.SendWhisper("Super Push mode is now " + (Room.SPushEnabled == true ? "enabled!" : "disabled!")); break; } case "spull": { Room.SPullEnabled = !Room.SPullEnabled; using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("UPDATE `rooms` SET `spull_enabled` = @PullEnabled WHERE `id` = '" + Room.Id + "' LIMIT 1"); dbClient.AddParameter("PullEnabled", PlusEnvironment.BoolToEnum(Room.SPullEnabled)); dbClient.RunQuery(); } Session.SendWhisper("Super Pull mode is now " + (Room.SPullEnabled == true ? "enabled!" : "disabled!")); break; } case "pull": { Room.PullEnabled = !Room.PullEnabled; using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("UPDATE `rooms` SET `pull_enabled` = @PullEnabled WHERE `id` = '" + Room.Id + "' LIMIT 1"); dbClient.AddParameter("PullEnabled", PlusEnvironment.BoolToEnum(Room.PullEnabled)); dbClient.RunQuery(); } Session.SendWhisper("Pull mode is now " + (Room.PullEnabled == true ? "enabled!" : "disabled!")); break; } case "enable": case "enables": { Room.EnablesEnabled = !Room.EnablesEnabled; using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("UPDATE `rooms` SET `enables_enabled` = @EnablesEnabled WHERE `id` = '" + Room.Id + "' LIMIT 1"); dbClient.AddParameter("EnablesEnabled", PlusEnvironment.BoolToEnum(Room.EnablesEnabled)); dbClient.RunQuery(); } Session.SendWhisper("Enables mode set to " + (Room.EnablesEnabled == true ? "enabled!" : "disabled!")); break; } case "respect": { Room.RespectNotificationsEnabled = !Room.RespectNotificationsEnabled; using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("UPDATE `rooms` SET `respect_notifications_enabled` = @RespectNotificationsEnabled WHERE `id` = '" + Room.Id + "' LIMIT 1"); dbClient.AddParameter("RespectNotificationsEnabled", PlusEnvironment.BoolToEnum(Room.RespectNotificationsEnabled)); dbClient.RunQuery(); } Session.SendWhisper("Respect notifications mode set to " + (Room.RespectNotificationsEnabled == true ? "enabled!" : "disabled!")); break; } case "pets": case "morphs": { Room.PetMorphsAllowed = !Room.PetMorphsAllowed; using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("UPDATE `rooms` SET `pet_morphs_allowed` = @PetMorphsAllowed WHERE `id` = '" + Room.Id + "' LIMIT 1"); dbClient.AddParameter("PetMorphsAllowed", PlusEnvironment.BoolToEnum(Room.PetMorphsAllowed)); dbClient.RunQuery(); } Session.SendWhisper("Human pet morphs notifications mode set to " + (Room.PetMorphsAllowed == true ? "enabled!" : "disabled!")); if (!Room.PetMorphsAllowed) { foreach (RoomUser User in Room.GetRoomUserManager().GetRoomUsers()) { if (User == null || User.GetClient() == null || User.GetClient().GetHabbo() == null) continue; User.GetClient().SendWhisper("The room owner has disabled the ability to use a pet morph in this room."); if (User.GetClient().GetHabbo().PetId > 0) { //Tell the user what is going on. User.GetClient().SendWhisper("Oops, the room owner has just disabled pet-morphs, un-morphing you."); //Change the users Pet Id. User.GetClient().GetHabbo().PetId = 0; //Quickly remove the old user instance. Room.SendMessage(new UserRemoveComposer(User.VirtualId)); //Add the new one, they won't even notice a thing!!11 8-) Room.SendMessage(new UsersComposer(User)); } } } break; } } }