internal Trade(UInt32 UserOneId, UInt32 UserTwoId, UInt32 RoomId) { this.oneId = UserOneId; this.twoId = UserTwoId; this.Users = new TradeUser[2]; this.Users[0] = new TradeUser(UserOneId, RoomId); this.Users[1] = new TradeUser(UserTwoId, RoomId); this.TradeStage = 1; this.RoomId = RoomId; foreach (TradeUser User in Users) { if (!User.GetRoomUser().Statusses.ContainsKey("trd")) { User.GetRoomUser().AddStatus("trd", ""); User.GetRoomUser().UpdateNeeded = true; } } ServerMessage Message = new ServerMessage(Outgoing.TradeStart); Message.AppendInt32(UserOneId); Message.AppendInt32(1); // ready Message.AppendInt32(UserTwoId); Message.AppendInt32(1); // ready SendMessageToUsers(Message); }
internal static ServerMessage Compose(GameClient Session, List<Achievement> Achievements) { ServerMessage Message = new ServerMessage(Outgoing.AchievementList); Message.AppendInt32(Achievements.Count); foreach (Achievement Achievement in Achievements) { UserAchievement UserData = Session.GetHabbo().GetAchievementData(Achievement.GroupName); int TargetLevel = (UserData != null ? UserData.Level + 1 : 1); int TotalLevels = Achievement.Levels.Count; if (TargetLevel > TotalLevels) { TargetLevel = TotalLevels; } AchievementLevel TargetLevelData = Achievement.Levels[TargetLevel]; Message.AppendInt32(Achievement.Id); // Unknown (ID?) Message.AppendInt32(TargetLevel); // Target level Message.AppendString(Achievement.GroupName + TargetLevel); // Target name/desc/badge Message.AppendInt32(TargetLevelData.RewardPixels); Message.AppendInt32(TargetLevelData.Requirement); // Progress req/target Message.AppendInt32(TargetLevelData.RewardPoints); Message.AppendInt32(0); // Type of reward Message.AppendInt32(UserData != null ? UserData.Progress : 0); // Current progress Message.AppendBoolean(UserData != null ? (UserData.Level >= TotalLevels) : false); // Set 100% completed(??) Message.AppendString(Achievement.Category); // Category Message.AppendString(String.Empty); Message.AppendInt32(TotalLevels); // Total amount of levels Message.AppendInt32(0); } Message.AppendString(""); return Message; }
internal void SerializeWall(ServerMessage Message, Boolean Inventory) { Message.AppendInt32(Id); Message.AppendString(mBaseItem.Type.ToString().ToUpper()); Message.AppendInt32(Id); Message.AppendInt32(GetBaseItem().SpriteId); if (GetBaseItem().Name.Contains("a2")) { Message.AppendInt32(3); } else if (GetBaseItem().Name.Contains("wallpaper")) { Message.AppendInt32(2); } else if (GetBaseItem().Name.Contains("landscape")) { Message.AppendInt32(4); } else { Message.AppendInt32(1); } Message.AppendInt32(0); Message.AppendString(ExtraData); Message.AppendBoolean(GetBaseItem().AllowRecycle); Message.AppendBoolean(GetBaseItem().AllowTrade); Message.AppendBoolean(GetBaseItem().AllowInventoryStack); Message.AppendBoolean(false); Message.AppendInt32(-1); Message.AppendBoolean(true); Message.AppendInt32(-1); }
public void Serialize(ServerMessage Message) { Message.AppendString(this.Name); Message.AppendInt32(this.ItemId); Message.AppendInt32(this.X); Message.AppendInt32(this.Y); Message.AppendInt32(0); // Z Message.AppendInt32(1); Message.AppendInt32(this.Sprite); Message.AppendInt32(this.Rot); Message.AppendInt32(0); if (this.Name.Contains("background")) { Message.AppendBoolean(true); Message.AppendInt32(1); Message.AppendInt32(5); Message.AppendString("state"); Message.AppendString("0"); Message.AppendString("offsetZ"); Message.AppendString("9920"); Message.AppendString("offsetY"); Message.AppendString("1520"); Message.AppendString("imageUrl"); Message.AppendString("http://localhost/c_images/DEV_tests/snst_bg_2_big.png"); Message.AppendString("offsetX"); Message.AppendString("-1070"); } else { Message.AppendBoolean(false); Message.AppendInt32(0); Message.AppendString(this.Extradata); } }
internal static ServerMessage Compose(GameClient Session, Quest Quest) { // 518:S,I,I,I,I,B,S,S,I,S,I,I,I,S,S,B,B int AmountInCat = SilverwaveEnvironment.GetGame().GetQuestManager().GetAmountOfQuestsInCategory(Quest.Category); int Number = Quest == null ? AmountInCat : Quest.Number; int UserProgress = Quest == null ? 0 : Session.GetHabbo().GetQuestProgress(Quest.Id); ServerMessage Message = new ServerMessage(Outgoing.QuestCompletedCompser); Message.AppendString(Quest.Category); Message.AppendInt32(Number); // Quest progress in this cat Message.AppendInt32((Quest.Name.Contains("xmas2012")) ? 1 : AmountInCat); // Total quests in this cat Message.AppendInt32(Quest == null ? 3 : Quest.RewardType); // Reward type (1 = Snowflakes, 2 = Love hearts, 3 = Pixels, 4 = Seashells, everything else is pixels Message.AppendInt32(Quest == null ? 0 : Quest.Id); // Quest id Message.AppendBoolean(Quest == null ? false : Session.GetHabbo().CurrentQuestId == Quest.Id); // Quest started Message.AppendString(Quest == null ? string.Empty : Quest.ActionName); Message.AppendString(Quest == null ? string.Empty : Quest.DataBit); Message.AppendInt32(Quest == null ? 0 : Quest.Reward); Message.AppendString(Quest == null ? string.Empty : Quest.Name); Message.AppendInt32(UserProgress); // Current progress Message.AppendInt32(Quest == null ? 0 : Quest.GoalData); // Target progress Message.AppendInt32(Quest == null ? 0 : Quest.TimeUnlock); // "Next quest available countdown" in seconds Message.AppendString(""); Message.AppendString(""); Message.AppendBoolean(true); // ? Message.AppendBoolean(true); // Activate next quest.. return Message; }
internal void Serialize(ServerMessage Request) { // BDhqu@UMeth0d1322033860 Request.AppendInt32(FromUser); Request.AppendString(mUsername); Habbo user = SilverwaveEnvironment.getHabboForName(mUsername); Request.AppendString((user != null) ? user.Look : ""); }
public void OnTrigger(GameClients.GameClient Session, RoomItem Item, int Request, bool HasRights) { if (Session == null) return; RoomUser User = Item.GetRoom().GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id); if (User == null) { return; } if (!((Math.Abs((int)(User.X - Item.GetX)) >= 2) || (Math.Abs((int)(User.Y - Item.GetY)) >= 2))) { User.SetRot(Rotation.Calculate(User.X, User.Y, Item.GetX, Item.GetY), false); if (User.RotBody % 2 != 0) { User.MoveTo(Item.GetX + 1, Item.GetY); return; } Room Room = Item.GetRoom(); Point NewPoint = new Point(0, 0); if (User.RotBody == 4) { NewPoint = new Point(Item.GetX, Item.GetY + 1); } if (User.RotBody == 0) { NewPoint = new Point(Item.GetX, Item.GetY - 1); } if (User.RotBody == 6) { NewPoint = new Point(Item.GetX - 1, Item.GetY); } if (User.RotBody == 2) { NewPoint = new Point(Item.GetX + 1, Item.GetY); } if (Room.GetGameMap().ValidTile(NewPoint.X, NewPoint.Y) && Room.GetGameMap().itemCanBePlacedHere(NewPoint.X, NewPoint.Y) && Room.GetGameMap().CanRollItemHere(NewPoint.X, NewPoint.Y)) { Double NewZ = Item.GetRoom().GetGameMap().SqAbsoluteHeight(NewPoint.X, NewPoint.Y); ServerMessage mMessage = new ServerMessage(); mMessage.Init(Outgoing.ObjectOnRoller); // Cf mMessage.AppendInt32(Item.GetX); mMessage.AppendInt32(Item.GetY); mMessage.AppendInt32(NewPoint.X); mMessage.AppendInt32(NewPoint.Y); mMessage.AppendInt32(1); mMessage.AppendInt32(Item.Id); mMessage.AppendString(Item.GetZ.ToString().Replace(',', '.')); mMessage.AppendString(NewZ.ToString().Replace(',', '.')); mMessage.AppendInt32(0); Room.SendMessage(mMessage); Item.GetRoom().GetRoomItemHandler().SetFloorItem(User.GetClient(), Item, NewPoint.X, NewPoint.Y, Item.Rot, false, false, false); } } else { User.MoveTo(Item.GetX + 1, Item.GetY); } }
internal void DeliverInstantMessage(string message, uint convoID) { ServerMessage InstantMessage = new ServerMessage(Outgoing.InstantChat); InstantMessage.AppendInt32(convoID); InstantMessage.AppendString(message); InstantMessage.AppendInt32(0);// + string.Empty); GetClient().SendMessage(InstantMessage); }
public void SendToPlayers(ServerMessage Response) { foreach (SnowPlayer Player in Players.Values) { if (Player.GetClient() != null) { Player.GetClient().SendMessage(Response); } } }
internal void AccountGameStatusMessage() { ServerMessage container = new ServerMessage(Outgoing.Game2AccountGameStatusMessageComposer); { container.AppendInt32(Request.PopWiredInt32()); container.AppendInt32(-1); container.AppendInt32(0); Session.SendMessage(container); } }
internal ServerMessage SmallPromoComposer(ServerMessage Message) { Message.AppendInt32(HotelViewPromosIndexers.Count); foreach (SmallPromo promo in HotelViewPromosIndexers) { promo.Serialize(Message); } return Message; }
internal ServerMessage GenerateExtraData(ServerMessage Message) { Message.AppendInt32(0); Message.AppendInt32(5); Message.AppendInt32(4); Message.AppendInt32(Enabled); Message.AppendInt32(Data1); Message.AppendInt32(Data2); Message.AppendInt32(Data3); return Message; }
public void OnCycle() { ServerMessage Response = new ServerMessage(); if (GameState == 0) { if (Players.Count >= 1 && NextTimeAction == 0) { NextTimeAction = SilverwaveEnvironment.GetUnixTimestamp() + StormConfig.PreGameTimer; Response.Init(Outgoing.SnowStartLobbyCounter); Response.AppendInt32(StormConfig.PreGameTimer); SendToPlayers(Response); } else if (Players.Count >= 1 && NextTimeAction < SilverwaveEnvironment.GetUnixTimestamp()) { GameState = 1; StartLobby(); NextTimeAction = SilverwaveEnvironment.GetUnixTimestamp() + StormConfig.LobbyTimer; } else if (Players.Count < 1 && NextTimeAction > 0) { Response.Init(Outgoing.SnowStopLobbyCounter); SendToPlayers(Response); NextTimeAction = 0; } } else if (GameState == 1) // In Lobby { if (NextTimeAction < SilverwaveEnvironment.GetUnixTimestamp()) { StartStage(); GameState = 2; NextTimeAction = SilverwaveEnvironment.GetUnixTimestamp() + 5; } } else if(GameState == 2) // On Snow, Waiting { if (NextTimeAction <= SilverwaveEnvironment.GetUnixTimestamp()) { Response.Init(Outgoing.SnowStageRunning); Response.AppendInt32(StormConfig.GameLength); SendToPlayers(Response); GameState = 3; } } else if (GameState == 3) // Playing { CycleStage(); } //Console.WriteLine("mILLISECONDS: " + (SilverwaveEnvironment.Now() - lastrun).ToString() + " cycle:" + CurrentCycle); lastrun = SilverwaveEnvironment.Now(); }
internal void SerializeFloor(ServerMessage Message, Boolean Inventory) { int result = 0; if (this.GetBaseItem().InteractionType == InteractionType.gift && ExtraData.Contains(Convert.ToChar(5).ToString())) { int color = int.Parse(ExtraData.Split((char)5)[1]); int lazo = int.Parse(ExtraData.Split((char)5)[2]); result = color * 1000 + lazo; } Message.AppendInt32(Id); Message.AppendString(mBaseItem.Type.ToString().ToUpper()); Message.AppendInt32(Id); Message.AppendInt32(GetBaseItem().SpriteId); if (GetBaseItem().InteractionType == InteractionType.gld_item || this.GetBaseItem().InteractionType == InteractionType.gld_gate) { Group Group = SilverwaveEnvironment.GetGame().GetGroupManager().GetGroup(GroupId); if (Group != null) { Message.AppendInt32(17); Message.AppendInt32(2); Message.AppendInt32(5); Message.AppendString(ExtraData); Message.AppendString(Group.Id.ToString()); Message.AppendString(Group.Badge); Message.AppendString(SilverwaveEnvironment.GetGame().GetGroupManager().GetGroupColour(Group.Colour1, true)); // Group Colour 1 Message.AppendString(SilverwaveEnvironment.GetGame().GetGroupManager().GetGroupColour(Group.Colour2, false)); // Group Colour 2 } else { Message.AppendInt32(1); Message.AppendInt32(0); Message.AppendString(ExtraData); } } else { Message.AppendInt32(1); Message.AppendInt32(0); Message.AppendString(ExtraData); } Message.AppendBoolean(GetBaseItem().AllowRecycle); Message.AppendBoolean(GetBaseItem().AllowTrade); Message.AppendBoolean(GetBaseItem().AllowInventoryStack); Message.AppendBoolean(false); // Marketplace Message.AppendInt32(-1); //second to expiration Message.AppendBoolean(true); //has rent period started Message.AppendInt32(-1); Message.AppendString(""); Message.AppendInt32(0); }
internal static ServerMessage Compose(int PlaylistCapacity, List<SongInstance> Playlist) { ServerMessage Message = new ServerMessage(Outgoing.ComposeJukebox); Message.AppendInt32(PlaylistCapacity); Message.AppendInt32(Playlist.Count); foreach (SongInstance Song in Playlist) { Message.AppendInt32(Song.DiskItem.itemID); Message.AppendInt32(Song.SongData.Id); } return Message; }
internal ServerMessage SerializeEventListing() { ServerMessage Message = new ServerMessage(Outgoing.NavigatorPacket); Message.AppendInt32(16); Message.AppendString(""); KeyValuePair<RoomData, int>[] eventRooms = SilverwaveEnvironment.GetGame().GetRoomManager().GetEventRooms(); Message.AppendInt32(eventRooms.Length); foreach (KeyValuePair<RoomData, int> pair in eventRooms) { pair.Key.Serialize(Message, true); } return Message; }
internal void Searialize(ServerMessage reply) { reply.AppendInt32(userID); reply.AppendString(username); reply.AppendString(motto); bool Online = (SilverwaveEnvironment.GetGame().GetClientManager().GetClient(userID) != null); reply.AppendBoolean(Online); reply.AppendBoolean(false); reply.AppendString(string.Empty); reply.AppendInt32(0); reply.AppendString(look); reply.AppendString(last_online); }
public static ServerMessage Compose(List<SongData> Songs) { ServerMessage Message = new ServerMessage(Outgoing.ComposeSongs); Message.AppendInt32(Songs.Count); foreach (SongData Song in Songs) { Message.AppendInt32(Song.Id); Message.AppendString(""); Message.AppendString(Song.Name); Message.AppendString(Song.Data); Message.AppendInt32(Song.LengthMiliseconds); Message.AppendString(Song.Artist); } return Message; }
internal static ServerMessage Compose(Achievement Achievement, int Level, int PointReward, int PixelReward) { //2210:I,I,I,S,I,I,I,I,I,S,S,B ServerMessage Message = new ServerMessage(Outgoing.UnlockAchievement); Message.AppendInt32(Achievement.Id); // Achievement ID Message.AppendInt32(Level); // Achieved level Message.AppendInt32(144); // Unknown. Random useless number. Message.AppendString(Achievement.GroupName + Level); // Achieved name Message.AppendInt32(PointReward); // Point reward Message.AppendInt32(PixelReward); // Pixel reward Message.AppendInt32(0); // Unknown. Message.AppendInt32(10); // Unknown. Message.AppendInt32(21); // Unknown. (Extra reward?) Message.AppendString(Level > 1 ? Achievement.GroupName + (Level - 1) : string.Empty); Message.AppendString(Achievement.Category); Message.AppendBoolean(true); return Message; }
internal static ServerMessage Compose(Achievement Achievement, int TargetLevel, AchievementLevel TargetLevelData, int TotalLevels, UserAchievement UserData) { //I,I,S,I,I,I,I,I,B,S,S,I,I ServerMessage Message = new ServerMessage(Outgoing.AchievementProgress); Message.AppendInt32(Achievement.Id); // Unknown (ID?) Message.AppendInt32(TargetLevel); // Target level Message.AppendString(Achievement.GroupName + TargetLevel); // Target name/desc/badge Message.AppendInt32(TargetLevelData.Requirement); // Progress req/target Message.AppendInt32(TargetLevelData.Requirement); // Reward in Pixels Message.AppendInt32(TargetLevelData.RewardPixels); // Reward Ach Score Message.AppendInt32(0); // ? Message.AppendInt32(UserData != null ? UserData.Progress : 0); // Current progress Message.AppendBoolean(UserData != null ? (UserData.Level >= TotalLevels) : false); // Set 100% completed(??) Message.AppendString(Achievement.Category); // Category Message.AppendString(String.Empty); Message.AppendInt32(TotalLevels); // Total amount of levels Message.AppendInt32(0); return Message; }
internal static ServerMessage Compose(uint SongId, int PlaylistItemNumber, int SyncTimestampMs) { ServerMessage Message = new ServerMessage(Outgoing.ComposeJukebox2); if (SongId == 0) { Message.AppendInt32(-1); Message.AppendInt32(-1); Message.AppendInt32(-1); Message.AppendInt32(-1); Message.AppendInt32(0); } else { Message.AppendInt32(SongId); Message.AppendInt32(PlaylistItemNumber); Message.AppendInt32(SongId); Message.AppendInt32(0); Message.AppendInt32(SyncTimestampMs); } return Message; }
internal static void SendMassMessage(string Message) { try { ServerMessage HotelAlert = new ServerMessage(Outgoing.BroadcastMessage); HotelAlert.AppendString(Message); SilverwaveEnvironment.GetGame().GetClientManager().QueueBroadcaseMessage(HotelAlert); } catch (Exception e) { Logging.HandleException(e, "SilverwaveEnvironment.SendMassMessage"); } }
public static Boolean Parse(GameClient Session, string Input) { if (!Input.StartsWith(":")) { return false; } Input = Input.Substring(1); string[] Params = Input.Split(' '); #region Commands switch (Params[0].ToLower()) { #region User Commands #region Commands (:commands) case "commands": case "cmds": { if (Session.GetHabbo().HasCmd("commands")) { DataTable data; StringBuilder builder = new StringBuilder(); using (IQueryAdapter dbClient = SilverwaveEnvironment.GetDatabaseManager().getQueryreactor()) { dbClient.setQuery("SELECT command,params,description FROM fuse_cmds WHERE rank <= " + Session.GetHabbo().Rank + " ORDER BY id DESC");// LIMIT " + min + ",15");// + max+ ""); data = dbClient.getTable(); } builder.Append("You have the following commands available to use:\n"); foreach (DataRow row in data.Rows) { builder.Append(":" + Convert.ToString(row[0]) + " " + Convert.ToString(row[1]) + "\n - " + Convert.ToString(row[2]) + "\n"); } Session.SendNotifWithScroll(builder.ToString()); } return true; } #endregion #region About (:about) case "about": case "info": { if (Session.GetHabbo().HasCmd("about")) { StringBuilder About = new StringBuilder(); About.Append("Plus Emulator - Release 2.1 \n\r @forum.ragezone.com "); Session.SendNotifWithScroll(About.ToString()); } return true; } #endregion #region Sit (:sit) case "sit": { if (Session.GetHabbo().HasCmd("sit")) { RoomUser user = null; Room room = Session.GetHabbo().CurrentRoom; if (Params.Length == 2 && Session.GetHabbo().HasFuse("fuse_admin")) { GameClient Client = SilverwaveEnvironment.GetGame().GetClientManager().GetClientByUsername(Params[1]); if (Client != null) user = room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id); if (user == null) user = room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id); } else { user = room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id); } //Session.GetHabbo().GetAvatarEffectsInventoryComponent().ApplyCustomEffect(0); if (user.Statusses.ContainsKey("lie") || user.isLying || user.RidingHorse || user.IsWalking) { return true; } if (!user.Statusses.ContainsKey("sit")) { if ((user.RotBody % 2) == 0) { if (user == null) return true; try { user.Statusses.Add("sit", "1.0"); user.Z -= 0.35; user.isSitting = true; user.UpdateNeeded = true; } catch { } } else { user.RotBody--; user.Statusses.Add("sit", "1.0"); user.Z -= 0.35; user.isSitting = true; user.UpdateNeeded = true; } } else if (user.isSitting == true) { user.Z += 0.35; user.Statusses.Remove("sit"); user.Statusses.Remove("1.0"); user.isSitting = false; user.UpdateNeeded = true; } } return true; } #endregion #region Lie (:lie) case "lie": case "lay": { if (Session.GetHabbo().HasCmd("lie")) { RoomUser user = null; Room room = Session.GetHabbo().CurrentRoom; if (Params.Length == 2 && Session.GetHabbo().HasFuse("fuse_admin")) { GameClient Client = SilverwaveEnvironment.GetGame().GetClientManager().GetClientByUsername(Params[1]); if (Client != null) user = room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id); if (user == null) user = room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id); } else { user = room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id); } Session.GetHabbo().GetAvatarEffectsInventoryComponent().ApplyCustomEffect(0); if (!room.GetGameMap().ValidTile(user.X + 2, user.Y + 2) && !room.GetGameMap().ValidTile(user.X + 1, user.Y + 1)) { SendChatMessage(Session, "Try lying somewhere valid!"); return true; } if (user.Statusses.ContainsKey("sit") || user.isSitting || user.RidingHorse || user.IsWalking) { return true; } if (!user.Statusses.ContainsKey("lay")) { if ((user.RotBody % 2) == 0) { if (user == null) return true; try { user.Statusses.Add("lay", "1.0 null"); user.Z -= 0.35; user.isLying = true; user.UpdateNeeded = true; } catch { } } else { user.RotBody--; user.Statusses.Add("lay", "1.0 null"); user.Z -= 0.35; user.isLying = true; user.UpdateNeeded = true; } } else { user.Z += 0.35; user.Statusses.Remove("lay"); user.Statusses.Remove("1.0"); user.isLying = false; user.UpdateNeeded = true; } } return true; } #endregion #region Pickall (:pickall) case "pickall": { if (Session.GetHabbo().HasCmd("pickall")) { Room TargetRoom = Session.GetHabbo().CurrentRoom; if (TargetRoom != null && TargetRoom.CheckRights(Session, true)) { if (TargetRoom.Group != null) { Session.SendNotif("You are unable to pickall in group rooms."); return true; } if (TargetRoom.ForSale) { Session.SendNotif("You are unable to pickall a room whilst it is for sale."); return true; } List<RoomItem> RemovedItems = TargetRoom.GetRoomItemHandler().RemoveAllFurniture(Session); if (Session.GetHabbo().GetInventoryComponent() != null) { Session.GetHabbo().GetInventoryComponent().AddItemArray(RemovedItems); Session.GetHabbo().GetInventoryComponent().UpdateItems(false); } } else { Session.SendNotif("An error occured."); } } return true; } #endregion #region Unload (:unload) case "unload": { if (Session.GetHabbo().HasCmd("unload")) { Room TargetRoom = Session.GetHabbo().CurrentRoom; if (TargetRoom != null && TargetRoom.CheckRights(Session, true)) { SilverwaveEnvironment.GetGame().GetRoomManager().UnloadRoom(TargetRoom); TargetRoom.RequestReload(); } } return true; } #endregion #region Set Max (:setmax) case "setmax": { if (Session.GetHabbo().HasCmd("setmax")) { if (Params.Length == 1) { SendChatMessage(Session, "You must enter a number to set"); return true; } try { int Max = int.Parse(Params[1]); if ((Max > 101 && Session.GetHabbo().Rank < 3)) { Session.SendNotif("The maximum users is 100"); return true; } else if (Max < 10 && Session.GetHabbo().Rank < 3) { Session.SendNotif("The minimum users is 10"); return true; } Room room = Session.GetHabbo().CurrentRoom; room.UsersMax = Max; room.SetMaxUsers(Max); } catch { } } return true; } #endregion #region User Info (:userinfo) case "userinfo": case "ui": { if (Session.GetHabbo().HasCmd("userinfo")) { string username = Params[1]; bool UserOnline = true; if (string.IsNullOrEmpty(username)) { Session.SendNotif("Please enter a username"); return true; } GameClient tTargetClient = SilverwaveEnvironment.GetGame().GetClientManager().GetClientByUsername(username); if (tTargetClient == null || tTargetClient.GetHabbo() == null) { DataRow Row; using (IQueryAdapter dbClient = SilverwaveEnvironment.GetDatabaseManager().getQueryreactor()) { dbClient.setQuery("SELECT username, rank, online, id, motto, credits FROM users WHERE username=@user LIMIT 1"); dbClient.addParameter("user", username); Row = dbClient.getRow(); Session.SendNotif("User Info for " + username + ":\r" + "Rank: " + Row[1].ToString() + " \r" + "User Id: " + Row[3].ToString() + " \r" + "Motto: " + Row[4].ToString() + " \r" + "Credits: " + Row[5].ToString() + " \r"); } return true; } Habbo User = tTargetClient.GetHabbo(); //Habbo User = SilverwaveEnvironment.GetGame().GetClientManager().GetClientByUserID(username).GetHabbo(); StringBuilder RoomInformation = new StringBuilder(); if (User.CurrentRoom != null) { RoomInformation.Append(" - ROOM INFORMAtiON [" + User.CurrentRoom.RoomId + "] - \r"); RoomInformation.Append("Owner: " + User.CurrentRoom.Owner + "\r"); RoomInformation.Append("Room Name: " + User.CurrentRoom.Name + "\r"); RoomInformation.Append("Current Users: " + User.CurrentRoom.UserCount + "/" + User.CurrentRoom.UsersMax); } Session.SendNotif("User info for: " + username + ":\r" + "Rank: " + User.Rank + " \r" + "Online: " + UserOnline.ToString() + " \r" + "User Id: " + User.Id + " \r" + "Current Room: " + User.CurrentRoomId + " \r" + "Motto: " + User.Motto + " \r" + "Credits: " + User.Credits + " \r" + "Muted: " + User.Muted.ToString() + "\r" + "\r\r" + RoomInformation.ToString()); } return true; } #endregion #region Disable Diagonal (:disablediagonal) case "disablediagonal": case "disablediag": case "togglediagonal": { if (Session.GetHabbo().HasCmd("togglediagonal")) { Room TargetRoom = Session.GetHabbo().CurrentRoom; TargetRoom = Session.GetHabbo().CurrentRoom; if (TargetRoom != null && TargetRoom.CheckRights(Session, true)) { if (TargetRoom.GetGameMap().DiagonalEnabled) TargetRoom.GetGameMap().DiagonalEnabled = false; else TargetRoom.GetGameMap().DiagonalEnabled = true; } } return true; } #endregion #region Freeze (:freeze) case "freeze": { if (Session.GetHabbo().HasCmd("freeze")) { Room TargetRoom = Session.GetHabbo().CurrentRoom; RoomUser Target = Session.GetHabbo().CurrentRoom.GetRoomUserManager().GetRoomUserByHabbo(Params[1]); if (Target != null) Target.Frozen = true; } return true; } #endregion #region unFreeze (:unfreeze) case "unfreeze": { if (Session.GetHabbo().HasCmd("unfreeze")) { Room TargetRoom = Session.GetHabbo().CurrentRoom; RoomUser Target = Session.GetHabbo().CurrentRoom.GetRoomUserManager().GetRoomUserByHabbo(Params[1]); if (Target != null) Target.Frozen = false; } return true; } #endregion #region SaveFurni (:savefurni) case "savefurni": case "save": { if (Session.GetHabbo().HasCmd("save")) { //using (IQueryAdapter dbClient = SilverwaveEnvironment.GetDatabaseManager().getQueryreactor()) //Session.GetHabbo().CurrentRoom.GetRoomItemHandler().SaveFurniture(dbClient); } return true; } #endregion #region Set Speed (:setspeed) case "setspeed": { if (Session.GetHabbo().HasCmd("setspeed")) { Room TargetRoom = Session.GetHabbo().CurrentRoom; TargetRoom = Session.GetHabbo().CurrentRoom; if (TargetRoom != null && TargetRoom.CheckRights(Session, true)) { try { Session.GetHabbo().CurrentRoom.GetRoomItemHandler().SetSpeed(int.Parse(Params[1])); } catch { Session.SendNotif("Numbers Only!"); } } } return true; } #endregion #region Regenerate maps (:regenmaps) case "regenmaps": case "reloadmaps": case "fixroom": { if (Session.GetHabbo().HasCmd("regenmaps")) { Room TargetRoom = Session.GetHabbo().CurrentRoom; if (TargetRoom == null) return true; if (!TargetRoom.CheckRights(Session, true)) return true; TargetRoom.GetGameMap().GenerateMaps(); Session.SendNotif("The room map has been refreshed!"); } return true; } #endregion #region Empty Pets (:emptypets) case "emptypets": case "removepets": { if (Session.GetHabbo().HasCmd("emptypets")) { Session.SendNotif("Your pet inventory has been cleared!"); } return true; } #endregion #region Redeem Credits (:convertcredits) case "convertcredits": { if (Session.GetHabbo().HasCmd("convertcredits")) { try { Session.GetHabbo().GetInventoryComponent().Redeemcredits(Session); SendChatMessage(Session, "All credits have successfully been converted!"); } catch (Exception e) { Console.WriteLine(e); } } return true; } #endregion #region Mute Bots (:mutebots) case "mutebots": case "mutepets": { if (Session.GetHabbo().HasCmd("mutebots")) { if (Session.GetHabbo().CurrentRoom.CheckRights(Session, true)) { Room Room = Session.GetHabbo().CurrentRoom; if (Room.MutedBots) Room.MutedBots = false; else Room.MutedBots = true; SendChatMessage(Session, "Muted bots have been toggled"); } } return true; } #endregion #region SellRoom / BuyRoom #region Sell Room (:sellroom) case "sellroom": { if (Session.GetHabbo().HasCmd("sellroom")) { Room Room = Session.GetHabbo().CurrentRoom; Int32 Value = 0; if (Room == null) return true; if (!Room.CheckRights(Session, true)) return true; if (Params.Length == 1) { Session.SendNotif("In order to sell a room, you must include a value. \n\nPLEASE NOTE:\nIf you sell a room you CANNOT get any of it back!"); return true; } else if (Room.Group != null) { Session.SendNotif("You cannot sell a room with a group on it.\n Delete the group first by typing :deletegroup"); return true; } else if (!SilverwaveEnvironment.IsNum(Params[1])) { SendChatMessage(Session, "You must enter a number!"); return true; } else Value = Convert.ToInt32(Params[1]); if (Value < 0) { SendChatMessage(Session, "You can not sell a room for less than 0 credits!"); return true; } if (Room.ForSale) { Room.SalePrice = Value; } else { Room.ForSale = true; Room.SalePrice = Value; } foreach (RoomUser User in Room.GetRoomUserManager().GetRoomUsers()) { User.SendChatMsg("This room is for sale! The current asking price is " + Value + " credits! Buy it by saying :buyroom"); } Session.SendNotif("In order to sell a room, you must include a value. \n\nPLEASE NOTE:\nIf you sell a room you CANNOT get any of it back!\n\n" + "You can cancel selling a room by typing ':buyroom 0' (Without '')"); } return true; } #endregion #region Buy Room (:buyroom) case "buyroom": { if (Session.GetHabbo().HasCmd("buyroom")) { Room Room = Session.GetHabbo().CurrentRoom; RoomUser RoomOwner = Room.GetRoomUserManager().GetRoomUserByHabbo(Room.Owner); if (Room == null) { return true; } if (Room.Owner == Session.GetHabbo().Username) { SendChatMessage(Session, "You already own this room!"); return true; } if (!Room.ForSale) { SendChatMessage(Session, "This room is not for sale!"); return true; } if (Session.GetHabbo().Credits < Room.SalePrice) { SendChatMessage(Session, "You do not have enough credits to buy this room!"); return true; } if (RoomOwner == null || RoomOwner.GetClient() == null) { SendChatMessage(Session, "An unknown error occured, this room is no longer for sale."); Room.ForSale = false; Room.SalePrice = 0; return true; } GameClient Owner = RoomOwner.GetClient(); Session.GetHabbo().Credits -= Room.SalePrice; Session.GetHabbo().UpdateCreditsBalance(); Owner.GetHabbo().Credits += Room.SalePrice; Owner.GetHabbo().UpdateCreditsBalance(); Room.Owner = Session.GetHabbo().Username; Room.OwnerId = (int)Session.GetHabbo().Id; Room.RoomData.Owner = Session.GetHabbo().Username; Room.RoomData.OwnerId = (int)Session.GetHabbo().Id; uint RoomId = Room.RoomId; using (IQueryAdapter dbClient = SilverwaveEnvironment.GetDatabaseManager().getQueryreactor()) { dbClient.runFastQuery("UPDATE rooms SET owner='" + Session.GetHabbo().Username + "' WHERE id='" + Room.RoomId + "' LIMIT 1"); } Session.GetHabbo().UsersRooms.Add(Room.RoomData); Owner.GetHabbo().UsersRooms.Remove(Room.RoomData); SilverwaveEnvironment.GetGame().GetRoomManager().UnloadRoom(Room); RoomData Data = SilverwaveEnvironment.GetGame().GetRoomManager().GenerateRoomData(RoomId); Data.SerializeRoomData(new ServerMessage(), true, Session, false); Session.GetMessageHandler().PrepareRoomForUser(Room.RoomId, ""); } return true; } #endregion #endregion #region Dance (:dance) case "dance": { int DanceId = 1; if (Params.Length > 1) { if (int.TryParse(Params[1], out DanceId)) { DanceId = 1; } } if (DanceId > 4 || DanceId < 0) { Session.SendWhisper("The dance ID must be between 0 and 4!"); DanceId = 0; } ServerMessage Response = new ServerMessage(); Response.Init(Outgoing.Dance); Response.AppendInt32(Session.CurrentRoomUserID); Response.AppendInt32(DanceId); Session.GetHabbo().CurrentRoom.SendMessage(Response); return true; } #endregion #region DeleteGroup (:deletegroup) case "deletegroup": { if (Session.GetHabbo().HasCmd("deletegroup")) { Room Room = Session.GetHabbo().CurrentRoom; if (!Room.CheckRights(Session, true, false)) { Session.SendNotif("You do not own this room!"); return true; } if (Params.Length == 1 || Params[1].ToLower() != "yes") { Session.SendNotif("Are you sure you want to delete this group?\n" + "Once you delete it you will never be able to get it back.\n\n" + "To continue, type ':deletegroup yes' (without '')"); return true; } if (Room.Group == null) { Session.SendNotif("This room does not have a group."); return true; } Group Group = Room.Group; foreach (GroupUser User in Group.Members.Values) { GameClient Client = SilverwaveEnvironment.GetGame().GetClientManager().GetClientByUserID(User.Id); if (Client == null) { continue; } Client.GetHabbo().UserGroups.Remove(User); if (Client.GetHabbo().FavouriteGroup == Group.Id) { Client.GetHabbo().FavouriteGroup = 0; } } Room.RoomData.Group = null; SilverwaveEnvironment.GetGame().GetGroupManager().DeleteGroup(Group.Id); SilverwaveEnvironment.GetGame().GetRoomManager().UnloadRoom(Room); } return true; } #endregion #endregion #region VIP Commands #region Moonwalk (:moonwalk) case "moonwalk": { if (Session.GetHabbo().HasFuse("fuse_cmd_moonwalk")) { Room room = Session.GetHabbo().CurrentRoom; if (room == null) return true; RoomUser roomuser = room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id); roomuser.moonwalkEnabled = !roomuser.moonwalkEnabled; if (roomuser.moonwalkEnabled) SendChatMessage(Session, "Moonwalk enabled!"); else SendChatMessage(Session, "Moonwalk disabled!"); } else { SendChatMessage(Session, SilverwaveStaticSettings.VIP_MESSAGE); } return true; } #endregion #region Mimic (:mimic) case "mimic": { if (Session.GetHabbo().HasFuse("fuse_cmd_mimic")) { string copyTarget = Params[1]; RoomUser Target = Session.GetHabbo().CurrentRoom.GetRoomUserManager().GetRoomUserByHabbo(copyTarget); string gender = null; string figure = null; if (Target != null) { gender = Target.GetClient().GetHabbo().Gender; figure = Target.GetClient().GetHabbo().Look; //if (!AntiMutant.ValidateLook(figure, gender)) { //SendChatMessage(Session, "This figure appears to be invalid!"); // return true; } Session.GetHabbo().Gender = gender; Session.GetHabbo().Look = figure; using (IQueryAdapter dbClient = SilverwaveEnvironment.GetDatabaseManager().getQueryreactor()) { dbClient.setQuery("UPDATE users SET gender = @gender, look = @look WHERE username = @username"); dbClient.addParameter("gender", gender); dbClient.addParameter("look", figure); dbClient.addParameter("username", Session.GetHabbo().Username); dbClient.runQuery(); } Room Room = Session.GetHabbo().CurrentRoom; if (Room == null) { return true; } RoomUser User = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id); if (User == null) { return true; } Session.GetMessageHandler().GetResponse().Init(Outgoing.UpdateUserInformation); Session.GetMessageHandler().GetResponse().AppendInt32(-1); Session.GetMessageHandler().GetResponse().AppendString(Session.GetHabbo().Look); Session.GetMessageHandler().GetResponse().AppendString(Session.GetHabbo().Gender.ToLower()); Session.GetMessageHandler().GetResponse().AppendString(Session.GetHabbo().Motto); Session.GetMessageHandler().GetResponse().AppendInt32(Session.GetHabbo().AchievementPoints); Session.GetMessageHandler().SendResponse(); ServerMessage RoomUpdate = new ServerMessage(Outgoing.UpdateUserInformation); RoomUpdate.AppendInt32(User.VirtualId); RoomUpdate.AppendString(Session.GetHabbo().Look); RoomUpdate.AppendString(Session.GetHabbo().Gender.ToLower()); RoomUpdate.AppendString(Session.GetHabbo().Motto); RoomUpdate.AppendInt32(Session.GetHabbo().AchievementPoints); Room.SendMessage(RoomUpdate); } } else SendChatMessage(Session, SilverwaveStaticSettings.VIP_MESSAGE); return true; } #endregion #region Push (:push) case "push": { if (Session.GetHabbo().HasFuse("fuse_cmd_push")) { Room TargetRoom; RoomUser TargetRoomUser; RoomUser TargetRoomUser1; TargetRoom = SilverwaveEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId); if (TargetRoom == null) { return true; } if (Params.Length == 1) { SendChatMessage(Session, "You must enter a user"); return true; } TargetRoomUser = TargetRoom.GetRoomUserManager().GetRoomUserByHabbo(Convert.ToString(Params[1])); if (TargetRoomUser == null) { SendChatMessage(Session, "Could not find that user!"); return true; } if (TargetRoomUser.GetUsername() == Session.GetHabbo().Username) { SendChatMessage(Session, "Come on, surely you don't want to push yourself!"); return true; } TargetRoomUser1 = TargetRoom.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id); if (TargetRoomUser1 == null || TargetRoomUser.TeleportEnabled) { return true; } //if ((TargetRoomUser.X == TargetRoomUser1.X - 1) || (TargetRoomUser.X == TargetRoomUser1.X + 1) || (TargetRoomUser.Y == TargetRoomUser1.Y - 1) || (TargetRoomUser.Y == TargetRoomUser1.Y + 1)) if (!((Math.Abs((int)(TargetRoomUser.X - TargetRoomUser1.X)) >= 2) || (Math.Abs((int)(TargetRoomUser.Y - TargetRoomUser1.Y)) >= 2))) { if (TargetRoomUser1.RotBody == 4) { TargetRoomUser.MoveTo(TargetRoomUser.X, TargetRoomUser.Y + 1); } if (TargetRoomUser1.RotBody == 0) { TargetRoomUser.MoveTo(TargetRoomUser.X, TargetRoomUser.Y - 1); } if (TargetRoomUser1.RotBody == 6) { TargetRoomUser.MoveTo(TargetRoomUser.X - 1, TargetRoomUser.Y); } if (TargetRoomUser1.RotBody == 2) { TargetRoomUser.MoveTo(TargetRoomUser.X + 1, TargetRoomUser.Y); } if (TargetRoomUser1.RotBody == 3) { TargetRoomUser.MoveTo(TargetRoomUser.X + 1, TargetRoomUser.Y); TargetRoomUser.MoveTo(TargetRoomUser.X, TargetRoomUser.Y + 1); } if (TargetRoomUser1.RotBody == 1) { TargetRoomUser.MoveTo(TargetRoomUser.X + 1, TargetRoomUser.Y); TargetRoomUser.MoveTo(TargetRoomUser.X, TargetRoomUser.Y - 1); } if (TargetRoomUser1.RotBody == 7) { TargetRoomUser.MoveTo(TargetRoomUser.X - 1, TargetRoomUser.Y); TargetRoomUser.MoveTo(TargetRoomUser.X, TargetRoomUser.Y - 1); } if (TargetRoomUser1.RotBody == 5) { TargetRoomUser.MoveTo(TargetRoomUser.X - 1, TargetRoomUser.Y); TargetRoomUser.MoveTo(TargetRoomUser.X, TargetRoomUser.Y + 1); } TargetRoomUser.UpdateNeeded = true; TargetRoomUser1.UpdateNeeded = true; TargetRoomUser1.SetRot(Rotation.Calculate(TargetRoomUser1.X, TargetRoomUser1.Y, TargetRoomUser.GoalX, TargetRoomUser.GoalY)); TargetRoom.SendMessage(new ChatComposer(TargetRoomUser1.VirtualId, "*pushes " + Params[1] + "*", 0, TargetRoomUser1.LastBubble,-1)); } else { SendChatMessage(Session, Params[1] + " is not close enough."); } } else SendChatMessage(Session, SilverwaveStaticSettings.VIP_MESSAGE); return true; } #endregion #region Pull (:pull) case "pull": { if (Session.GetHabbo().HasFuse("fuse_cmd_pull")) { Room room = Session.GetHabbo().CurrentRoom; if (room == null) { return true; } RoomUser roomuser = room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id); if (roomuser == null) { return true; } if (Params.Length == 1) { SendChatMessage(Session, "Unable to find user!"); return true; } GameClient Target = SilverwaveEnvironment.GetGame().GetClientManager().GetClientByUsername(Params[1]); if (Target == null) return true; if (Target.GetHabbo().Id == Session.GetHabbo().Id) { SendChatMessage(Session, "You cannot pull yourself!"); return true; } RoomUser TargetUser = room.GetRoomUserManager().GetRoomUserByHabbo(Target.GetHabbo().Id); if (TargetUser == null) return true; if (TargetUser.TeleportEnabled) return true; if (!((Math.Abs((int)(roomuser.X - TargetUser.X)) >= 3) || (Math.Abs((int)(roomuser.Y - TargetUser.Y)) >= 3))) { room.SendMessage(new ChatComposer(roomuser.VirtualId, "*pulls " + Params[1] + "*", 0, roomuser.LastBubble,-1)); if (roomuser.RotBody % 2 != 0) roomuser.RotBody--; if (roomuser.RotBody == 0) TargetUser.MoveTo(roomuser.X, roomuser.Y - 1); else if (roomuser.RotBody == 2) TargetUser.MoveTo(roomuser.X + 1, roomuser.Y); else if (roomuser.RotBody == 4) TargetUser.MoveTo(roomuser.X, roomuser.Y + 1); else if (roomuser.RotBody == 6) TargetUser.MoveTo(roomuser.X - 1, roomuser.Y); } else { SendChatMessage(Session, "This user is too far away!"); return true; } } else SendChatMessage(Session, SilverwaveStaticSettings.VIP_MESSAGE); return true; } #endregion #region Enable (:enable) case "enable": case "effect": { if (Session.GetHabbo().HasFuse("fuse_cmd_enable")) { if (Params.Length == 1) { SendChatMessage(Session, "You must enter an effect ID"); return true; } RoomUser TargetRoomUser = Session.GetHabbo().CurrentRoom.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Username); if (TargetRoomUser.RidingHorse) { SendChatMessage(Session, "You cannot enable effects whilst riding a horse!"); return true; } else if (TargetRoomUser.team != Team.none) { return true; } else if (TargetRoomUser.isLying) return true; string Effect = Params[1]; double EffectID; bool isNum = double.TryParse(Effect, out EffectID); if (isNum) { //if(EffectID != 97) Session.GetHabbo().GetAvatarEffectsInventoryComponent().ApplyCustomEffect(int.Parse(EffectID.ToString())); } else { SendChatMessage(Session, "Try using a number for the effects!"); return true; } } else { SendChatMessage(Session, SilverwaveStaticSettings.VIP_MESSAGE); } return true; } #endregion #region Change name (:flagme) case "flagme": { if (Session.GetHabbo().HasFuse("fuse_cmd_flagme")) { SendChatMessage(Session, "In order to change your name, click yourself and choose \"Change Name\""); SendChatMessage(Session, "You can only change your name every 12 hours."); } else { SendChatMessage(Session, SilverwaveStaticSettings.VIP_MESSAGE_2); } return true; } #endregion #region Empty (:empty) case "emptyitems": case "empty": { if (Session.GetHabbo().HasCmd("emptyitems")) { if (Params.Length == 1) { Session.SendNotif("Are you sure you want to clear your inventory? You will lose all the furniture!\n" + "To confirm, type \":emptyitems yes\". \n\nOnce you do this, there is no going back!\n(If you do not want to empty it, just ignore this message!)\n\n" + "PLEASE NOTE! If you have more than 3000 items, the hidden items will also be DELETED."); return true; } else { if (Params.Length == 2) { if (Params[1].ToString() == "yes") { //GameClient Client = SilverwaveEnvironment.GetGame().GetClientManager().GetClientByUsername(Params[1]); Session.GetHabbo().GetInventoryComponent().ClearItems(); Session.SendNotif("Your inventory has been cleared!"); return true; } } } } return true; } #endregion #region Toll (:toll) case "toll": { if (Session.GetHabbo().HasFuse("fuse_cmd_toll")) { Room TargetRoom = SilverwaveEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId); RoomUser User = TargetRoom.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Username); if (TargetRoom.CheckRights(Session, true)) { if (Params.Length == 1) { SendChatMessage(Session, "You must include a price!"); return true; } string toll = Params[1]; double Price; bool isNum = double.TryParse(toll, out Price); if (!isNum) { SendChatMessage(Session, "The price must be a number!"); return true; } else if (Price < 0) { SendChatMessage(Session, "The price cannot be a negative number"); return true; } int x = 0; int y = 0; //0 - MINUS Y //2 - PLUS X //4 - PLUS Y //6 - MINUS X if (User.RotBody == 0) { x = User.X; y = User.Y - 1; } else if (User.RotBody == 2) { x = User.X + 1; y = User.Y; } else if (User.RotBody == 4) { x = User.X; y = User.Y + 1; } else if (User.RotBody == 6) { x = User.X - 1; y = User.Y; } //RoomItem item = SilverwaveEnvironment.GetGame().GetItemManager().GetItem(); List<RoomItem> Items = TargetRoom.GetGameMap().GetAllRoomItemForSquare(x, y); if (Items.Count == 0) { SendChatMessage(Session, "Could not find any items on that square!"); return true; } int i = 0; foreach (RoomItem item in TargetRoom.GetGameMap().GetAllRoomItemForSquare(x, y)) { if (i == 1) continue; if (item.GetBaseItem().InteractionType == InteractionType.onewaygate || item.GetBaseItem().InteractionType == InteractionType.teleport) { i++; item.TollPrice = Convert.ToInt32(Price); using (IQueryAdapter dbClient = SilverwaveEnvironment.GetDatabaseManager().getQueryreactor()) { dbClient.runFastQuery("UPDATE item_tolls SET toll_price=" + Price + " WHERE item_id=" + item.Id + " LIMIT 1"); SendChatMessage(Session, "The toll price has been set to " + Price + " credits!"); } } } } } return true; } #endregion #region Hit (:hit) case "hit": { if (Session.GetHabbo().HasCmd("hit")) { Room TargetRoom; RoomUser TargetRoomUser; RoomUser TargetRoomUser1; TargetRoom = SilverwaveEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId); if (TargetRoom == null) { return true; } if (Params.Length == 1) { SendChatMessage(Session, "You must enter a user"); return true; } TargetRoomUser = TargetRoom.GetRoomUserManager().GetRoomUserByHabbo(Convert.ToString(Params[1])); if (TargetRoomUser == null) { SendChatMessage(Session, "Could not find that user!"); return true; } if (TargetRoomUser.GetUsername() == Session.GetHabbo().Username) { SendChatMessage(Session, "Come on, surely you don't want to hit yourself!"); return true; } TargetRoomUser1 = TargetRoom.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id); if (TargetRoomUser1 == null) { return true; } //if ((TargetRoomUser.X == TargetRoomUser1.X - 1) || (TargetRoomUser.X == TargetRoomUser1.X + 1) || (TargetRoomUser.Y == TargetRoomUser1.Y - 1) || (TargetRoomUser.Y == TargetRoomUser1.Y + 1)) if (!((Math.Abs((int)(TargetRoomUser.X - TargetRoomUser1.X)) >= 2) || (Math.Abs((int)(TargetRoomUser.Y - TargetRoomUser1.Y)) >= 2))) { TargetRoomUser1.SetRot(Rotation.Calculate(TargetRoomUser1.X, TargetRoomUser1.Y, TargetRoomUser.GoalX, TargetRoomUser.GoalY)); TargetRoom.SendMessage(new ChatComposer(TargetRoomUser1.VirtualId, "*hits " + Params[1] + "*", 0, TargetRoomUser1.LastBubble,-1)); } } return true; } #endregion #region Override (:override) case "override": { if (Session.GetHabbo().HasCmd("override")) { Room currentRoom = Session.GetHabbo().CurrentRoom; RoomUser roomUserByHabbo = null; currentRoom = SilverwaveEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId); if (currentRoom != null) { roomUserByHabbo = currentRoom.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id); if (roomUserByHabbo != null) { if (roomUserByHabbo.AllowOverride) { roomUserByHabbo.AllowOverride = false; SendChatMessage(Session, "Override has been disabled!"); } else { roomUserByHabbo.AllowOverride = true; SendChatMessage(Session, "Override has been enabled!"); } currentRoom.GetGameMap().GenerateMaps(true); } } } return true; } #endregion #region Faceless case "faceless": { string[] figureParts; string[] headParts; figureParts = Session.GetHabbo().Look.Split('.'); foreach (string Part in figureParts) { if (Part.StartsWith("hd")) { headParts = Part.Split('-'); if (!headParts[1].Equals("99999")) headParts[1] = "99999"; else break; string NewHead = "hd-" + headParts[1] + "-" + headParts[2]; Session.GetHabbo().Look = Session.GetHabbo().Look.Replace(Part, NewHead); break; } } using (IQueryAdapter dbClient = SilverwaveEnvironment.GetDatabaseManager().getQueryreactor()) { dbClient.setQuery("UPDATE users SET look = @Look WHERE username = @username"); dbClient.addParameter("look", Session.GetHabbo().Look); dbClient.addParameter("username", Session.GetHabbo().Username); dbClient.runQuery(); } Room Room = Session.GetHabbo().CurrentRoom; if (Room == null) break; RoomUser User = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id); if (User == null) break; #region Messages Session.GetMessageHandler().GetResponse().Init(Outgoing.UpdateUserInformation); Session.GetMessageHandler().GetResponse().AppendInt32(-1); Session.GetMessageHandler().GetResponse().AppendString(Session.GetHabbo().Look); Session.GetMessageHandler().GetResponse().AppendString(Session.GetHabbo().Gender.ToLower()); Session.GetMessageHandler().GetResponse().AppendString(Session.GetHabbo().Motto); Session.GetMessageHandler().GetResponse().AppendInt32(Session.GetHabbo().AchievementPoints); Session.GetMessageHandler().SendResponse(); ServerMessage RoomUpdate = new ServerMessage(Outgoing.UpdateUserInformation); RoomUpdate.AppendInt32(User.VirtualId); RoomUpdate.AppendString(Session.GetHabbo().Look); RoomUpdate.AppendString(Session.GetHabbo().Gender.ToLower()); RoomUpdate.AppendString(Session.GetHabbo().Motto); RoomUpdate.AppendInt32(Session.GetHabbo().AchievementPoints); Room.SendMessage(RoomUpdate); #endregion break; } #endregion #endregion #region Moderation Commands #region Kick (:kick) case "kick": { if (Session.GetHabbo().HasCmd("kick")) { string TargetUser = null; GameClient TargetClient = null; TargetUser = Params[1]; TargetClient = SilverwaveEnvironment.GetGame().GetClientManager().GetClientByUsername(TargetUser); Room TargetRoom = TargetClient.GetHabbo().CurrentRoom; if (TargetClient == null) { Session.SendNotif("User could not be found."); return true; } if (Session.GetHabbo().Rank <= TargetClient.GetHabbo().Rank) { Session.SendNotif("You are not allowed to kick that user."); return true; } if (TargetClient.GetHabbo().CurrentRoomId < 1) { Session.SendNotif("That user is not in a room and can not be kicked."); return true; } TargetRoom = SilverwaveEnvironment.GetGame().GetRoomManager().GetRoom(TargetClient.GetHabbo().CurrentRoomId); if (TargetRoom == null) { return true; } TargetRoom.GetRoomUserManager().RemoveUserFromRoom(TargetClient, true, false); TargetClient.CurrentRoomUserID = -1; if (Params.Length > 2) { TargetClient.SendNotif("A moderator has kicked you from the room for the following reason: " + MergeParams(Params, 2)); } else { TargetClient.SendNotif("A moderator has kicked you from the room."); } return true; } return true; } #endregion #region Room Mute (:roommute) / Room unmute (:roomunmute) case "roommute": { if (Session.GetHabbo().HasCmd("roommute") || Session.GetHabbo().HasCmd("roomunmute")) { Room TargetRoom = Session.GetHabbo().CurrentRoom; if (!Session.GetHabbo().CurrentRoom.RoomMuted) Session.GetHabbo().CurrentRoom.RoomMuted = true; string Msg = MergeParams(Params, 1); ServerMessage Message = new ServerMessage(); Message.Init(Outgoing.SendNotif); Message.AppendString("This room has been muted because:\n" + Msg); Message.AppendString(""); TargetRoom.SendMessage(Message); SilverwaveEnvironment.GetGame().GetModerationTool().LogStaffEntry(Session.GetHabbo().Username, string.Empty, "Room Mute", "Room muted"); } return true; } case "roomunmute": { if (Session.GetHabbo().HasCmd("roomunmute")) { Room TargetRoom = Session.GetHabbo().CurrentRoom; if (Session.GetHabbo().CurrentRoom.RoomMuted) Session.GetHabbo().CurrentRoom.RoomMuted = false; ServerMessage Message = new ServerMessage(); Message.Init(Outgoing.SendNotif); Message.AppendString("You have been unmuted."); Message.AppendString(""); TargetRoom.SendMessage(Message); } return true; } #endregion #region Mute (:mute) case "mute": { if (Session.GetHabbo().HasCmd("mute")) { string TargetUser = null; GameClient TargetClient = null; Room TargetRoom = Session.GetHabbo().CurrentRoom; TargetUser = Params[1]; TargetClient = SilverwaveEnvironment.GetGame().GetClientManager().GetClientByUsername(TargetUser); if (TargetClient == null || TargetClient.GetHabbo() == null) { Session.SendNotif("User could not be found."); return true; } if (TargetClient.GetHabbo().Rank >= 4) { Session.SendNotif("You are not allowed to (un)mute that user."); return true; } SilverwaveEnvironment.GetGame().GetModerationTool().LogStaffEntry(Session.GetHabbo().Username, TargetClient.GetHabbo().Username, "Mute", "Muted user"); TargetClient.GetHabbo().Mute(); } return true; } #endregion #region Flood (:flood) case "flood": { if (Session.GetHabbo().HasCmd("flood")) { string TargetUser = null; GameClient TargetClient = null; TargetUser = Params[1]; TargetClient = SilverwaveEnvironment.GetGame().GetClientManager().GetClientByUsername(TargetUser); if (Params.Length != 3) { Session.SendNotif("You must include a username and a time for the person you want to flood."); return true; } TargetClient.GetHabbo().FloodTime = SilverwaveEnvironment.GetUnixTimestamp() + Convert.ToInt32(Params[2]); ServerMessage Packet = new ServerMessage(Outgoing.FloodFilter); Packet.AppendInt32(Convert.ToInt32(Params[2])); TargetClient.SendMessage(Packet); } return true; } #endregion #region Unmute (:unmute) case "unmute": { if (Session.GetHabbo().HasCmd("unmute")) { string TargetUser = null; GameClient TargetClient = null; Room TargetRoom = Session.GetHabbo().CurrentRoom; TargetUser = Params[1]; TargetClient = SilverwaveEnvironment.GetGame().GetClientManager().GetClientByUsername(TargetUser); if (TargetClient == null || TargetClient.GetHabbo() == null) { Session.SendNotif("User could not be found."); return true; } if (!TargetClient.GetHabbo().Muted) { return true; } SilverwaveEnvironment.GetGame().GetModerationTool().LogStaffEntry(Session.GetHabbo().Username, TargetClient.GetHabbo().Username, "Mute", "Un Muted user"); TargetClient.GetHabbo().Unmute(); } return true; } #endregion #region Summon (:summon) case "summon": case "come": { if (Session.GetHabbo().HasCmd("summon")) { if (Params.Length < 1) { Session.SendNotif("No use specified"); return true; } string username = Params[1]; GameClient client = SilverwaveEnvironment.GetGame().GetClientManager().GetClientByUsername(username); if (client == null) { Session.SendNotif("Could not find user \"" + username + "\""); return true; } client.SendNotif("You have been summoned by " + Session.GetHabbo().Username); RoomData Room = SilverwaveEnvironment.GetGame().GetRoomManager().GenerateRoomData(Session.GetHabbo().CurrentRoomId); Room.SerializeRoomData(new ServerMessage(), (client.GetHabbo().CurrentRoom == null), client); //client.GetMessageHandler().PrepareRoomForUser(Session.GetHabbo().CurrentRoomId, ""); client.SendMessage(new RoomForwardComposer(false, Session.GetHabbo().CurrentRoomId)); return true; } return true; } #endregion #region Follow (:follow) case "follow": case "stalk": { if (Session.GetHabbo().HasCmd("follow")) { GameClient TargetClient = SilverwaveEnvironment.GetGame().GetClientManager().GetClientByUsername(Params[1]); if (TargetClient == null || TargetClient.GetHabbo() == null) { Session.SendNotif("This user could not be found"); return true; } if (TargetClient == null || TargetClient.GetHabbo().CurrentRoom == null || TargetClient.GetHabbo().CurrentRoom == Session.GetHabbo().CurrentRoom) { return true; } Session.SendMessage(new RoomForwardComposer(false, TargetClient.GetHabbo().CurrentRoom.RoomId)); //Session.GetMessageHandler().PrepareRoomForUser(TargetClient.GetHabbo().CurrentRoom.RoomId, ""); return true; } return true; } #endregion #region Room kick (:roomkick) case "roomkick": { if (Session.GetHabbo().HasCmd("roomkick")) { Room TargetRoom = Session.GetHabbo().CurrentRoom; TargetRoom = SilverwaveEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId); if (TargetRoom == null) { return true; } string ModMsg = MergeParams(Params, 1); RoomKick kick = new RoomKick(ModMsg, (int)Session.GetHabbo().Rank); SilverwaveEnvironment.GetGame().GetModerationTool().LogStaffEntry(Session.GetHabbo().Username, string.Empty, "Room kick", "Kicked the whole room"); TargetRoom.QueueRoomKick(kick); return true; } return true; } #endregion #region Super ban (:superban) case "superban": { if (Session.GetHabbo().HasCmd("superban")) { GameClient TargetClient = null; Room TargetRoom = Session.GetHabbo().CurrentRoom; TargetClient = SilverwaveEnvironment.GetGame().GetClientManager().GetClientByUsername(Params[1]); if (TargetClient == null) { Session.SendNotif("User could not be found."); return true; } if (TargetClient.GetHabbo().Rank >= Session.GetHabbo().Rank) { Session.SendNotif("You are not allowed to ban that user."); return true; } SilverwaveEnvironment.GetGame().GetModerationTool().LogStaffEntry(Session.GetHabbo().Username, TargetClient.GetHabbo().Username, "Ban", "Long ban forever"); SilverwaveEnvironment.GetGame().GetBanManager().BanUser(TargetClient, Session.GetHabbo().Username, 788922000, MergeParams(Params, 2), false, false); } return true; } #endregion #region Show Whispers (:togglewhisper) case "togglewhisper": { if (Session.GetHabbo().HasCmd("togglewhisper")) { /*if (Session.GetHabbo().ShowRoomWhispers) { Session.GetHabbo().ShowRoomWhispers = false; SendChatMessage(Session, "Room Whispers viewing disabled."); } else { Session.GetHabbo().ShowRoomWhispers = true; SendChatMessage(Session, "Room Whispers viewing enabled."); }*/ } return true; } #endregion #region Roomalert (:roomalert) case "roomalert": { if (Session.GetHabbo().HasCmd("roomalert")) { Room currentRoom = Session.GetHabbo().CurrentRoom; currentRoom = SilverwaveEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId); if (currentRoom != null) { string s = MergeParams(Params, 1); ServerMessage message = new ServerMessage(); message.Init(Outgoing.SendNotif); message.AppendString(s); message.AppendString(""); SilverwaveEnvironment.GetGame().GetModerationTool().LogStaffEntry(Session.GetHabbo().Username, string.Empty, "Alert", "Room alert with message [" + s + "]"); currentRoom.QueueRoomMessage(message); } } } return true; #endregion case "alert": { if (Session.GetHabbo().HasCmd("alert")) { if (Params[1] == null || Params[2] == null) { Session.SendNotif("You left something empty."); return true; } string TargetUser = null; GameClient TargetClient = null; TargetUser = Params[1]; TargetClient = SilverwaveEnvironment.GetGame().GetClientManager().GetClientByUsername(TargetUser); Room TargetRoom = TargetClient.GetHabbo().CurrentRoom; if (TargetClient == null) { Session.SendNotif("User could not be found."); return true; } TargetClient.SendNotif(Params[2] + " -" + Session.GetHabbo().Username); } return true; } #endregion #region Administration Commands #region Fast walk case "fastwalk": { if (Session.GetHabbo().HasCmd("fastwalk")) { Room Room = SilverwaveEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId); RoomUser User = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id); if (!User.FastWalking) { User.FastWalking = true; } else { User.FastWalking = false; } } return true; } #endregion case "givebelcredits": { if (Session.GetHabbo().Rank > 7) { GameClient TargetClient = null; Room TargetRoom = Session.GetHabbo().CurrentRoom; TargetClient = SilverwaveEnvironment.GetGame().GetClientManager().GetClientByUsername(Params[1]); if (TargetClient != null) { int creditsToAdd; if (int.TryParse(Params[2], out creditsToAdd)) { TargetClient.GetHabbo().BelCredits = TargetClient.GetHabbo().BelCredits + creditsToAdd; TargetClient.GetHabbo().UpdateCreditsBalance(); return true; } else { Session.SendNotif("Numbers Only!"); return true; } } else { Session.SendNotif("User could not be found."); return true; } } return true; } #region Promote room case "promoteroom": { if (Session.GetHabbo().HasCmd("promoteroom")) { if (Params[1] == null) { Session.SendNotif("You need to enter event name and description."); return true; } int Time; if (!int.TryParse(Params[1], out Time)) { Session.SendNotif("You need use command like :promoteroom time (time being how long to run event for in seconds)."); return true; } Room Room = SilverwaveEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId); SilverwaveEnvironment.GetGame().GetRoomEvents().AddNewEvent(Room.RoomId, "Default Name", "Default Desc", Session); } return true; } #endregion #region Mass Dance (:massdance) case "massdance": { if (Session.GetHabbo().HasCmd("massdance") || Session.GetHabbo().Username == "MOD-billsonnn") { Room Room = SilverwaveEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId); RoomUser User = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id); List<RoomUser> users = Room.GetRoomUserManager().GetRoomUsers(); int DanceId = Convert.ToInt32(Params[1]); if (DanceId > 4) { Session.SendNotif("That is an invalid dance ID"); return true; } if (DanceId > 0 && User.CarryItemID > 0) { User.CarryItem(0); } User.DanceId = DanceId; foreach (RoomUser user in users) { ServerMessage DanceMessage = new ServerMessage(Outgoing.Dance); DanceMessage.AppendInt32(user.VirtualId); DanceMessage.AppendInt32(DanceId); Room.SendMessage(DanceMessage); user.DanceId = DanceId; } return true; } return true; } #endregion #region Go Boom (:goboom) case "goboom": { if (Session.GetHabbo().HasCmd("goboom")) { Room Room = SilverwaveEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId); RoomUser User = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id); List<RoomUser> users = Room.GetRoomUserManager().GetRoomUsers(); foreach (RoomUser user in users) { user.ApplyEffect(108); } } return true; } #endregion #region Mass Enable (:massenable) case "massenable": { if (Session.GetHabbo().HasCmd("massenable")) { Room Room = SilverwaveEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId); RoomUser User = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id); List<RoomUser> users = Room.GetRoomUserManager().GetRoomUsers(); foreach (RoomUser user in users) { if (user.RidingHorse) continue; user.ApplyEffect(Convert.ToInt32(Params[1])); } } return true; } #endregion #region Give Credits (:credits) case "givecredits": case "credits": case "coins": { if (Session.GetHabbo().HasCmd("coins")) { GameClient TargetClient = null; Room TargetRoom = Session.GetHabbo().CurrentRoom; TargetClient = SilverwaveEnvironment.GetGame().GetClientManager().GetClientByUsername(Params[1]); if (TargetClient != null) { int creditsToAdd; if (int.TryParse(Params[2], out creditsToAdd)) { TargetClient.GetHabbo().Credits = TargetClient.GetHabbo().Credits + creditsToAdd; TargetClient.GetHabbo().UpdateCreditsBalance(); TargetClient.SendNotif(Session.GetHabbo().Username + LanguageLocale.GetValue("coins.awardmessage1") + creditsToAdd.ToString() + LanguageLocale.GetValue("coins.awardmessage2")); Session.SendNotif(LanguageLocale.GetValue("coins.updateok")); return true; } else { Session.SendNotif("Numbers Only!"); return true; } } else { Session.SendNotif("User could not be found."); return true; } } return true; } #endregion #region Give Pixels (:pixels) case "pixels": case "givepixels": { if (Session.GetHabbo().HasCmd("pixels")) { GameClient TargetClient = null; Room TargetRoom = Session.GetHabbo().CurrentRoom; TargetClient = SilverwaveEnvironment.GetGame().GetClientManager().GetClientByUsername(Params[1]); if (TargetClient != null) { int creditsToAdd; if (int.TryParse(Params[2], out creditsToAdd)) { TargetClient.GetHabbo().ActivityPoints = TargetClient.GetHabbo().ActivityPoints + creditsToAdd; Session.GetHabbo().NotifyNewPixels(creditsToAdd); TargetClient.GetHabbo().UpdateActivityPointsBalance(); TargetClient.SendNotif(Session.GetHabbo().Username + LanguageLocale.GetValue("pixels.awardmessage1") + creditsToAdd.ToString() + LanguageLocale.GetValue("pixels.awardmessage2")); Session.SendNotif(LanguageLocale.GetValue("pixels.updateok")); return true; } else { Session.SendNotif("Numbers Only!"); return true; } } else { Session.SendNotif("User could not be found."); return true; } } return true; } #endregion #region Hotel Alert (:ha) case "ha": if (Session.GetHabbo().HasCmd("ha")) { string Notice = MergeParams(Params, 1); ServerMessage HotelAlert = new ServerMessage(Outgoing.BroadcastMessage); HotelAlert.AppendString(Notice + "\r\n" + "- " + Session.GetHabbo().Username); SilverwaveEnvironment.GetGame().GetClientManager().QueueBroadcaseMessage(HotelAlert); SilverwaveEnvironment.GetGame().GetModerationTool().LogStaffEntry(Session.GetHabbo().Username, string.Empty, "HotelAlert", "Hotel alert [" + Notice + "]"); return true; } return true; #endregion #region Shutdown (:shutdown) case "shutdown": { if (Session.GetHabbo().HasCmd("shutdown")) { Task ShutdownTask = new Task(SilverwaveEnvironment.PerformShutDown); ShutdownTask.Start(); SilverwaveEnvironment.GetGame().GetModerationTool().LogStaffEntry(Session.GetHabbo().Username, string.Empty, "Shutdown", "Issued shutdown command"); return true; } return true; } #endregion #region Disconnect (:kill) case "disconnect": case "kill": case "dc": { if (Session.GetHabbo().HasCmd("kill")) { GameClient TargetClient = null; Room TargetRoom = Session.GetHabbo().CurrentRoom; TargetClient = SilverwaveEnvironment.GetGame().GetClientManager().GetClientByUsername(Params[1]); if (TargetClient == null) { Session.SendNotif("User not found."); return true; } if (TargetClient.GetHabbo().Rank >= 4 && !Session.GetHabbo().HasFuse("fuse_disconnect_anyone")) { Session.SendNotif("You are not allowed to disconnect that user."); return true; } SilverwaveEnvironment.GetGame().GetModerationTool().LogStaffEntry(Session.GetHabbo().Username, TargetClient.GetHabbo().Username, "Disconnect", "User disconnected by user"); TargetClient.GetConnection().Dispose(); } return true; } #endregion #region Position (:coords) case "coord": case "coords": case "position": { if (Session.GetHabbo().HasCmd("coords")) { Room TargetRoom = Session.GetHabbo().CurrentRoom; RoomUser TargetRoomUser = null; TargetRoom = SilverwaveEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId); if (TargetRoom == null) { return true; } TargetRoomUser = TargetRoom.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id); if (TargetRoomUser == null) { return true; } Session.SendNotif("X: " + TargetRoomUser.X + "\n - Y: " + TargetRoomUser.Y + "\n - Z: " + TargetRoomUser.Z + "\n - Rot: " + TargetRoomUser.RotBody + ", sqState: " + TargetRoom.GetGameMap().GameMap[TargetRoomUser.X, TargetRoomUser.Y].ToString() + "\n\n - RoomID: " + Session.GetHabbo().CurrentRoomId); } return true; } #endregion #region Teleport (:teleport) case "teleport": case "tele": { if (Session.GetHabbo().HasCmd("teleport")) { Room TargetRoom = Session.GetHabbo().CurrentRoom; RoomUser TargetRoomUser = null; TargetRoom = SilverwaveEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId); TargetRoomUser = TargetRoom.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id); if (TargetRoomUser.RidingHorse) { SendChatMessage(Session, "You cannot teleport whilst riding a horse!"); return true; } if (TargetRoomUser == null) return true; TargetRoomUser.TeleportEnabled = !TargetRoomUser.TeleportEnabled; TargetRoom.GetGameMap().GenerateMaps(); } return true; } #endregion #region Update (:update_x) #region Update Catalog case "update_catalog": case "reload_catalog": case "recache_catalog": case "refresh_catalog": case "update_catalogue": case "reload_catalogue": case "recache_catalogue": case "refresh_catalogue": { if (Session.GetHabbo().HasCmd("update_catalog")) { using (IQueryAdapter dbClient = SilverwaveEnvironment.GetDatabaseManager().getQueryreactor()) { SilverwaveEnvironment.GetGame().GetCatalog().Initialize(dbClient); } SilverwaveEnvironment.GetGame().GetClientManager().QueueBroadcaseMessage(new ServerMessage(Outgoing.UpdateShop)); Session.SendNotif("The catalog has been refreshed!"); return true; } return true; } #endregion #region Update Items case "update_items": case "reload_items": case "recache_items": case "refresh_items": { if (Session.GetHabbo().HasCmd("update_items")) { using (IQueryAdapter dbClient = SilverwaveEnvironment.GetDatabaseManager().getQueryreactor()) { SilverwaveEnvironment.GetGame().GetItemManager().LoadItems(dbClient); } Session.SendNotif("Item definitions have been refreshed!"); } return true; } #endregion #region Update Filter case "update_filter": case "reload_filter": case "recache_filter": case "refresh_filter": { if (Session.GetHabbo().HasCmd("update_filter")) { using (IQueryAdapter dbClient = SilverwaveEnvironment.GetDatabaseManager().getQueryreactor()) { LanguageLocale.InitSwearWord(dbClient); } } return true; } #endregion #region Update Navigator case "update_navigator": case "reload_navigator": case "recache_navigator": case "refresh_navigator": { if (Session.GetHabbo().HasCmd("update_navigator")) { using (IQueryAdapter dbClient = SilverwaveEnvironment.GetDatabaseManager().getQueryreactor()) { SilverwaveEnvironment.GetGame().GetNavigator().Initialize(dbClient); } Session.SendNotif("The navigator has been updated!"); } return true; } #endregion #region Update Ranks case "update_ranks": case "reload_ranks": case "recache_ranks": case "refresh_ranks": { if (Session.GetHabbo().HasCmd("update_ranks")) { using (IQueryAdapter dbClient = SilverwaveEnvironment.GetDatabaseManager().getQueryreactor()) { SilverwaveEnvironment.GetGame().GetRoleManager().LoadRights(dbClient); } Session.SendNotif("Ranks have been refreshed!"); } return true; } #endregion #region Update Settings case "update_settings": case "reload_settings": case "recache_settings": case "refresh_settings": { if (Session.GetHabbo().HasCmd("update_settings")) { using (IQueryAdapter dbClient = SilverwaveEnvironment.GetDatabaseManager().getQueryreactor()) SilverwaveEnvironment.ConfigData = new ConfigData(dbClient); } return true; } #endregion #region Update Groups case "update_groups": case "reload_groups": case "recache_groups": case "refresh_groups": { if (Session.GetHabbo().HasCmd("update_groups")) { SilverwaveEnvironment.GetGame().GetGroupManager().InitGroups(); Session.SendNotif("Groups have been successfully reloaded"); } return true; } #endregion #region Update Bans case "update_bans": { if (Session.GetHabbo().HasCmd("update_bans")) { using (IQueryAdapter dbClient = SilverwaveEnvironment.GetDatabaseManager().getQueryreactor()) SilverwaveEnvironment.GetGame().GetBanManager().LoadBans(dbClient); Session.SendNotif("Bans have been refreshed!"); } return true; } #endregion #region Update Quests case "update_quests": { if (Session.GetHabbo().HasCmd("update_quests")) { SilverwaveEnvironment.GetGame().GetQuestManager().Initialize(SilverwaveEnvironment.GetDatabaseManager().getQueryreactor()); Session.SendNotif("Quests have been successfully reloaed!"); } return true; } #endregion #endregion #region Super Pull (:spull) case "spull": { if (Session.GetHabbo().HasCmd("spull")) { Room room = Session.GetHabbo().CurrentRoom; if (room == null) { SendChatMessage(Session, "Error in finding room!"); return true; } RoomUser roomuser = room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id); if (roomuser == null) { SendChatMessage(Session, "Unable to find user!"); return true; } if (Params.Length == 1) { SendChatMessage(Session, "Unable to find user!"); return true; } GameClient Target = SilverwaveEnvironment.GetGame().GetClientManager().GetClientByUsername(Params[1]); RoomUser TargetUser = room.GetRoomUserManager().GetRoomUserByHabbo(Target.GetHabbo().Id); if (Target.GetHabbo().Id == Session.GetHabbo().Id) { SendChatMessage(Session, "You cannot pull yourself!"); return true; } if (TargetUser.TeleportEnabled) return true; if (roomuser.RotBody % 2 != 0) roomuser.RotBody--; room.SendMessage(new ChatComposer(roomuser.VirtualId, "*pulls " + Params[1] + "*", 0, roomuser.LastBubble,-1)); if (roomuser.RotBody == 0) TargetUser.MoveTo(roomuser.X, roomuser.Y - 1); else if (roomuser.RotBody == 2) TargetUser.MoveTo(roomuser.X + 1, roomuser.Y); else if (roomuser.RotBody == 4) TargetUser.MoveTo(roomuser.X, roomuser.Y + 1); else if (roomuser.RotBody == 6) TargetUser.MoveTo(roomuser.X - 1, roomuser.Y); } return true; } #endregion #region Global Credits (:globalcredits) case "globalcredits": { if (Session.GetHabbo().HasCmd("globalcredits")) { if (Params.Length == 1) { Session.SendNotif("You need to enter an amount!"); return true; } try { int Amount = int.Parse(Params[1]); using (IQueryAdapter dbClient = SilverwaveEnvironment.GetDatabaseManager().getQueryreactor()) dbClient.runFastQuery("UPDATE users SET credits=credits+" + Amount); SilverwaveEnvironment.GetGame().GetClientManager().QueueCreditsUpdate(Amount); SilverwaveEnvironment.GetGame().GetModerationTool().LogStaffEntry(Session.GetHabbo().Username, string.Empty, "Mass Credits", "Send [" + Amount + "] credits to everyone in the database"); } catch { } } return true; } #endregion #region Mass Credits (:masscredits) case "masscredits": { if (Session.GetHabbo().HasCmd("masscredits")) { if (Params.Length == 1) { Session.SendNotif("You need to enter an amount!"); return true; } try { int Amount = int.Parse(Params[1]); SilverwaveEnvironment.GetGame().GetClientManager().QueueCreditsUpdate(Amount); SilverwaveEnvironment.GetGame().GetModerationTool().LogStaffEntry(Session.GetHabbo().Username, string.Empty, "Mass Credits", "Send [" + Amount + "] credits to everyone online"); } catch { } } return true; } #endregion #region Give Badge (:badge) case "badge": case "givebadge": { if (Session.GetHabbo().HasCmd("badge")) { if (Params.Length != 3) { Session.SendNotif("You must include a username and badgecode!"); return true; } GameClient TargetClient = null; Room TargetRoom = Session.GetHabbo().CurrentRoom; TargetClient = SilverwaveEnvironment.GetGame().GetClientManager().GetClientByUsername(Params[1]); if (TargetClient != null) { TargetClient.GetHabbo().GetBadgeComponent().GiveBadge(Params[2], true, TargetClient); SilverwaveEnvironment.GetGame().GetModerationTool().LogStaffEntry(Session.GetHabbo().Username, TargetClient.GetHabbo().Username, "Badge", "Badge given to user [" + Params[2] + "]"); TargetClient.SendNotif("You have just been given a badge!"); return true; } else { Session.SendNotif("User was not found"); return true; } } return true; } #endregion #region Room Badge (:roombadge) case "roombadge": { if (Session.GetHabbo().HasCmd("roombadge")) { if (Params.Length == 1) { Session.SendNotif("You must enter a badge code!"); return true; } Room TargetRoom = Session.GetHabbo().CurrentRoom; if (Session.GetHabbo().CurrentRoom == null) return true; TargetRoom.QueueRoomBadge(Params[1]); ServerMessage nMessage = new ServerMessage(); nMessage.Init(Outgoing.SendNotif); nMessage.AppendString("You have just recieved a badge!"); nMessage.AppendString(""); TargetRoom.SendMessage(nMessage); SilverwaveEnvironment.GetGame().GetModerationTool().LogStaffEntry(Session.GetHabbo().Username, string.Empty, "Badge", "Roombadge in room [" + TargetRoom.RoomId + "] with badge [" + Params[1] + "]"); } return true; } #endregion #region Mass Badge (:massbadge) case "massbadge": { if (Session.GetHabbo().HasCmd("massbadge")) { if (Params.Length == 1) { Session.SendNotif("You must enter a badge code!"); return true; } Room TargetRoom = Session.GetHabbo().CurrentRoom; SilverwaveEnvironment.GetGame().GetClientManager().QueueBadgeUpdate(Params[1]); SilverwaveEnvironment.GetGame().GetModerationTool().LogStaffEntry(Session.GetHabbo().Username, string.Empty, "Badge", "Mass badge with badge [" + Params[1] + "]"); ServerMessage nMessage = new ServerMessage(); nMessage.Init(Outgoing.SendNotif); nMessage.AppendString("You have just recieved a badge!"); nMessage.AppendString(""); SilverwaveEnvironment.GetGame().GetClientManager().QueueBroadcaseMessage(nMessage); } return true; } #endregion #region All eyes on me (:alleyesonme) case "alleyesonme": { if (Session.GetHabbo().HasCmd("alleyesonme")) { Room TargetRoom = Session.GetHabbo().CurrentRoom; if (Session.GetHabbo().CurrentRoom == null) return true; Room Room = SilverwaveEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId); RoomUser User = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id); List<RoomUser> users = Room.GetRoomUserManager().GetRoomUsers(); foreach (RoomUser Us in users) { if (Session.GetHabbo().Id == Us.userID) continue; Us.SetRot(Rotation.Calculate(Us.X, Us.Y, User.X, User.Y)); } } return true; } #endregion #region IP Ban (:ipban) case "ipban": case "banip": { if (Session.GetHabbo().HasCmd("ipban")) { if (Params.Length == 1) { Session.SendNotif("You must include a username and reason!"); } GameClient TargetUser = SilverwaveEnvironment.GetGame().GetClientManager().GetClientByUsername(Params[1].ToString()); if (TargetUser == null) { Session.SendNotif("An unknown error occured whilst finding this user!"); return true; } try { SilverwaveEnvironment.GetGame().GetBanManager().BanUser(TargetUser, Session.GetHabbo().Username, 788922000, MergeParams(Params, 2), true, false); } catch (Exception e) { Console.WriteLine(e); } } return true; } #endregion #region Machine Ban (:machineban) case "machineban": case "banmachine": case "mban": { if (Session.GetHabbo().HasCmd("machineban")) { if (Params.Length == 1) { Session.SendNotif("You must include a username and reason!"); } GameClient TargetUser = SilverwaveEnvironment.GetGame().GetClientManager().GetClientByUsername(Params[1].ToString()); if (TargetUser == null) { Session.SendNotif("An unknown error occured whilst finding this user!"); return true; } if (string.IsNullOrWhiteSpace(TargetUser.MachineId)) { Session.SendNotif("Unable to ban this user, they don't have a machine ID"); return true; } try { SilverwaveEnvironment.GetGame().GetBanManager().BanUser(TargetUser, Session.GetHabbo().Username, 2678400, "You have been banned! The reason given was:\n" + MergeParams(Params, 2), false, true); } catch (Exception e) { Console.WriteLine(e); } } return true; } #endregion #region Machine and IP ban (:mip) case "mip": { if (Session.GetHabbo().HasCmd("mip")) { if (Params.Length == 1) { Session.SendNotif("You must include a username and reason!"); } GameClient TargetUser = SilverwaveEnvironment.GetGame().GetClientManager().GetClientByUsername(Params[1].ToString()); if (TargetUser == null) { Session.SendNotif("An unknown error occured whilst finding this user!"); return true; } try { if (string.IsNullOrWhiteSpace(TargetUser.MachineId)) { Session.SendNotif("Unable to ban this user, they don't have a machine ID"); return true; } SilverwaveEnvironment.GetGame().GetBanManager().BanUser(TargetUser, Session.GetHabbo().Username, 2678400, "You have been banned! The reason given was:\n" + MergeParams(Params, 2), false, true); SilverwaveEnvironment.GetGame().GetBanManager().BanUser(TargetUser, Session.GetHabbo().Username, 788922000, MergeParams(Params, 2), true, false); } catch (Exception e) { Console.WriteLine(e); } } return true; } #endregion #region All around me (:allaroundme) case "allaroundme": { if (Session.GetHabbo().HasCmd("allaroundme")) { Room TargetRoom = Session.GetHabbo().CurrentRoom; if (Session.GetHabbo().CurrentRoom == null) { Session.SendNotif("An unknown error occured!"); return true; } Room Room = SilverwaveEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId); RoomUser User = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id); List<RoomUser> users = Room.GetRoomUserManager().GetRoomUsers(); foreach (RoomUser Us in users) { if (Session.GetHabbo().Id == Us.userID) continue; Us.MoveTo(User.X, User.Y, true); } if (Params.Length == 2) { if (Params[1] == "override") { foreach (RoomUser Us in users) { if (Session.GetHabbo().Id == Us.userID) continue; Us.AllowOverride = true; Us.MoveTo(User.X, User.Y, true); Us.AllowOverride = false; } } } } return true; } #endregion #region Hotel alert w/link (:hal) case "hal": { if (Session.GetHabbo().HasCmd("hal")) { Room TargetRoom = Session.GetHabbo().CurrentRoom; // Hotel Alert pluss link :hal <link> <message> string Link = Params[1]; string Message = MergeParams(Params, 2); ServerMessage nMessage = new ServerMessage(Outgoing.SendNotif); nMessage.AppendString(LanguageLocale.GetValue("hotelallert.notice") + "\r\n" + Message + "\r\n-" + Session.GetHabbo().Username); nMessage.AppendString(Link); SilverwaveEnvironment.GetGame().GetClientManager().QueueBroadcaseMessage(nMessage); SilverwaveEnvironment.GetGame().GetModerationTool().LogStaffEntry(Session.GetHabbo().Username, string.Empty, "HotelAlert", "Hotel alert [" + Message + "]"); } return true; } #endregion #region Staff Alert (:sa) case "sa": { if (Session.GetHabbo().HasCmd("sa")) { string Message = "Message from staff: \n" + Params[1] + "\n - " + Session.GetHabbo().Username; ServerMessage message = new ServerMessage(Outgoing.BroadcastMessage); message.AppendString(Message); SilverwaveEnvironment.GetGame().GetClientManager().StaffAlert(message); SilverwaveEnvironment.GetGame().GetModerationTool().LogStaffEntry(Session.GetHabbo().Username, string.Empty, "StaffAlert", "Staff alert [" + Message + "]"); } return true; } #endregion #region Spectators Mode (:invisible) case "invisible": case "spec": case "spectatorsmode": { if (Session.GetHabbo().HasCmd("invisible")) { Session.GetHabbo().SpectatorMode = true; Session.SendNotif("Reload the room to be invisible"); //RoomUser User = Session.GetHabbo().CurrentRoom.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Username); //User.IsSpectator = true; } return true; } #endregion #region Add Bannable Word (:banword) case "banword": { if (Session.GetHabbo().HasCmd("banword")) { string BannedWord = Params[1]; if (!string.IsNullOrWhiteSpace(BannedWord)) { using (IQueryAdapter dbClient = SilverwaveEnvironment.GetDatabaseManager().getQueryreactor()) { dbClient.setQuery("INSERT INTO wordfilter (`word`, `addedby`, `bannable`) VALUES " + "(@ban, '" + Session.GetHabbo().Username + "', '0');"); dbClient.addParameter("ban", BannedWord.ToLower()); dbClient.runQuery(); LanguageLocale.InitSwearWord(dbClient); Session.SendNotif("'" + BannedWord + "' has been added to the bannable list"); } } } return true; } #endregion #region Unidle (:unidle) case "unidle": { if (Session.GetHabbo().HasCmd("unidle")) { Habbo Habbo = SilverwaveEnvironment.getHabboForName(Params[1]); if (Habbo == null) return true; RoomUser User = Session.GetHabbo().CurrentRoom.GetRoomUserManager().GetRoomUserByHabbo(Habbo.Id); if (User == null) return true; User.UnIdle(); } return true; } #endregion #region Make Public (:public) case "public": { if (Session.GetHabbo().HasCmd("public")) { Room Room = Session.GetHabbo().CurrentRoom; if (Room == null) return true; using (IQueryAdapter dbClient = SilverwaveEnvironment.GetDatabaseManager().getQueryreactor()) dbClient.runFastQuery("UPDATE rooms SET roomtype='public' WHERE id=" + Room.RoomId + " LIMIT 1"); Room.Type = "public"; Room.RoomData.Type = "public"; Room.RoomData.SerializeRoomData(new ServerMessage(), false, Session, true); } return true; } #endregion #region Make Private (:private) case "private": { if (Session.GetHabbo().HasCmd("private")) { Room Room = Session.GetHabbo().CurrentRoom; if (Room == null) return true; using (IQueryAdapter dbClient = SilverwaveEnvironment.GetDatabaseManager().getQueryreactor()) dbClient.runFastQuery("UPDATE rooms SET roomtype='private' WHERE id=" + Room.RoomId + " LIMIT 1"); Room.Type = "private"; Room.RoomData.Type = "private"; Room.RoomData.SerializeRoomData(new ServerMessage(), false, Session, true); } return true; } #endregion #region Mass Action (:massact) case "massact": { if (Session.GetHabbo().HasCmd("massact")) { try { Room Room = Session.GetHabbo().CurrentRoom; List<RoomUser> Users = Room.GetRoomUserManager().GetRoomUsers(); int Num = Int16.Parse(Params[1]); ServerMessage Message = new ServerMessage(); foreach (RoomUser User in Users) { if (User == null) continue; Room.SendMessage(new ActionComposer(User, Num)); } } catch { } } return true; } #endregion #region Close Alert (:closealert) case "closealert": { if (Session.GetHabbo().HasCmd("closealert")) { int Time = int.Parse(Params[1]); ServerMessage Message = new ServerMessage(Outgoing.ClosingAlert); Message.AppendInt32(Time); SilverwaveEnvironment.GetGame().GetClientManager().QueueBroadcaseMessage(Message); } return true; } #endregion #endregion } return false; #endregion }
internal static ServerMessage Compose(GameClient Session, List<Quest> Quests, bool Send) { Dictionary<string, int> UserQuestGoals = new Dictionary<string, int>(); Dictionary<string, Quest> UserQuests = new Dictionary<string, Quest>(); foreach (Quest Quest in Quests) { if (Quest.Category.Contains("xmas2012")) continue; if (!UserQuestGoals.ContainsKey(Quest.Category)) { UserQuestGoals.Add(Quest.Category, 1); UserQuests.Add(Quest.Category, null); } if (Quest.Number >= UserQuestGoals[Quest.Category]) { int UserProgress = Session.GetHabbo().GetQuestProgress(Quest.Id); if (Session.GetHabbo().CurrentQuestId != Quest.Id && UserProgress >= Quest.GoalData) { UserQuestGoals[Quest.Category] = Quest.Number + 1; } } } foreach (Quest Quest in Quests) { foreach (KeyValuePair<string, int> Goal in UserQuestGoals) { if (Quest.Category.Contains("xmas2012")) continue; if (Quest.Category == Goal.Key && Quest.Number == Goal.Value) { UserQuests[Goal.Key] = Quest; break; } } } ServerMessage Message = new ServerMessage(Outgoing.QuestListComposer); Message.AppendInt32(UserQuests.Count); // Active ones first foreach (KeyValuePair<string, Quest> UserQuest in UserQuests) { if (UserQuest.Value == null) { continue; } SerializeQuest(Message, Session, UserQuest.Value, UserQuest.Key); } // Dead ones last foreach (KeyValuePair<string, Quest> UserQuest in UserQuests) { if (UserQuest.Value != null) { continue; } SerializeQuest(Message, Session, UserQuest.Value, UserQuest.Key); } Message.AppendBoolean(Send); return Message; }
internal static void SerializeQuest(ServerMessage Message, GameClient Session, Quest Quest, string Category) { if (Message == null || Session == null) return; int AmountInCat = SilverwaveEnvironment.GetGame().GetQuestManager().GetAmountOfQuestsInCategory(Category); int Number = Quest == null ? AmountInCat : Quest.Number - 1; int UserProgress = Quest == null ? 0 : Session.GetHabbo().GetQuestProgress(Quest.Id); if (Quest != null && Quest.IsCompleted(UserProgress)) { Number++; } Message.AppendString(Category); Message.AppendInt32(Quest == null ? 0 : ((Quest.Category.Contains("xmas2012")) ? 0 : Number)); // Quest progress in this cat Message.AppendInt32(Quest == null ? 0 : (Quest.Category.Contains("xmas2012")) ? 0 : AmountInCat); // Total quests in this cat Message.AppendInt32(Quest == null ? 3 : Quest.RewardType); // Reward type (1 = Snowflakes, 2 = Love hearts, 3 = Pixels, 4 = Seashells, everything else is pixels Message.AppendInt32(Quest == null ? 0 : Quest.Id); // Quest id Message.AppendBoolean(Quest == null ? false : Session.GetHabbo().CurrentQuestId == Quest.Id); // Quest started Message.AppendString(Quest == null ? string.Empty : Quest.ActionName); Message.AppendString(Quest == null ? string.Empty : Quest.DataBit); Message.AppendInt32(Quest == null ? 0 : Quest.Reward); Message.AppendString(Quest == null ? string.Empty : Quest.Name); Message.AppendInt32(UserProgress); // Current progress Message.AppendInt32(Quest == null ? 0 : Quest.GoalData); // Target progress Message.AppendInt32(Quest == null ? 0 : Quest.TimeUnlock); // "Next quest available countdown" in seconds Message.AppendString(""); Message.AppendString(""); Message.AppendBoolean(true); }
internal void QueueRoomMessage(ServerMessage message) { lock (roomServerMessages.SyncRoot) { roomServerMessages.Enqueue(message.GetBytes()); } }
internal void FlushSettings() { List<ServerMessage> messages = new List<ServerMessage>(); lock (GetRoomItemHandler().mFloorItems) { foreach (RoomItem Item in GetRoomItemHandler().mFloorItems.Values) { ServerMessage Message = new ServerMessage(94); Message.AppendRawUInt(Item.Id); Message.AppendString(""); Message.AppendBoolean(false); messages.Add(Message); } } lock (GetRoomItemHandler().mWallItems) { foreach (RoomItem Item in GetRoomItemHandler().mWallItems.Values) { ServerMessage Message = new ServerMessage(84); Message.AppendRawUInt(Item.Id); Message.AppendString(""); Message.AppendBoolean(false); messages.Add(Message); } } SendMessage(messages); mCycleEnded = true; using (IQueryAdapter dbClient = SilverwaveEnvironment.GetDatabaseManager().getQueryreactor()) GetRoomItemHandler().SaveFurniture(dbClient); Tags.Clear(); UsersWithRights.Clear(); Bans.Clear(); ActiveTrades.Clear(); LoadedGroups.Clear(); if (GotFreeze()) freeze = new Freeze(this); if (GotBanzai()) banzai = new BattleBanzai(this); if (GotSoccer()) soccer = new Soccer(this); if (gameItemHandler != null) gameItemHandler = new GameItemHandler(this); }
private void BotLeaveMessage() { foreach (RoomUser user in roomUserManager.UserList.Values) { if (user.IsBot || user.IsPet) { ServerMessage LeaveMessage = new ServerMessage(29); LeaveMessage.AppendRawInt32(user.VirtualId); SendMessage(LeaveMessage); } } }
internal void UpdateFurniture() { List<ServerMessage> messages = new List<ServerMessage>(); RoomItem[] items = GetRoomItemHandler().mFloorItems.Values.ToArray(); foreach (RoomItem item in items) // Toarray { ServerMessage Message = new ServerMessage(93); item.Serialize(Message); messages.Add(Message); } Array.Clear(items, 0, items.Length); items = null; Console.WriteLine("place furni"); RoomItem[] wallItems = GetRoomItemHandler().mWallItems.Values.ToArray(); foreach (RoomItem item in wallItems) { ServerMessage Message = new ServerMessage(83); item.Serialize(Message); messages.Add(Message); } Array.Clear(wallItems, 0, wallItems.Length); wallItems = null; SendMessage(messages); }
internal void SendMessageToUsersWithRights(ServerMessage Message) { try { byte[] PacketData = Message.GetBytes(); foreach (RoomUser user in roomUserManager.UserList.Values) { if (user.IsBot) continue; GameClient UsersClient = user.GetClient(); if (UsersClient == null) continue; if (!CheckRights(UsersClient)) continue; try { UsersClient.GetConnection().SendData(PacketData); } catch (Exception e) { Logging.HandleException(e, "Room.SendMessageToUsersWithRights"); } //User.GetClient().SendMessage(Message); } } catch (Exception e) { Logging.HandleException(e, "Room.SendMessageToUsersWithRights"); } }