// TODO Refactor public override void HandleMessage(Yupi.Model.Domain.Habbo session, Yupi.Protocol.Buffers.ClientMessage request, Yupi.Protocol.IRouter router) { int groupId = request.GetInteger(); string name = request.GetString(); string description = request.GetString(); Group theGroup = GroupRepository.Find(groupId); if (theGroup?.Creator != session.Info) { return; } theGroup.Name = name; theGroup.Description = description; GroupRepository.Save(theGroup); if (session.Room != null) { session.Room.EachUser( (entitySession) => { entitySession.Router.GetComposer <GroupDataMessageComposer>() .Compose(entitySession, theGroup, session.Info); }); } else { router.GetComposer <GroupDataMessageComposer>().Compose(session, theGroup, session.Info); } }
public override void HandleMessage(Yupi.Model.Domain.Habbo session, Yupi.Protocol.Buffers.ClientMessage request, Yupi.Protocol.IRouter router) { request.GetBool(); // TODO Unused string idAsString = request.GetString(); int userId; int.TryParse(idAsString, out userId); if (userId == 0) { return; } string message = request.GetString(); Habbo guide = GuideManager.GetRandomGuide(); if (guide == null) { router.GetComposer <OnGuideSessionErrorComposer>().Compose(session); return; } router.GetComposer <OnGuideSessionAttachedMessageComposer>().Compose(session, false, userId, message, 30); router.GetComposer <OnGuideSessionAttachedMessageComposer>().Compose(guide, true, userId, message, 15); guide.GuideOtherUser = session; session.GuideOtherUser = guide; }
public override void HandleMessage(Yupi.Model.Domain.Habbo session, Yupi.Protocol.Buffers.ClientMessage message, Yupi.Protocol.IRouter router) { string gender = message.GetString(); string look = message.GetString(); // TODO Validate gender & look session.Info.Look = look; session.Info.Gender = gender; UserRepository.Save(session.Info); AchievementManager.ProgressUserAchievement(session, ProfileAchievement.AvatarLooks); if (session.Room == null) { return; } router.GetComposer <UpdateAvatarAspectMessageComposer>().Compose(session, session.Info); session.Room.EachUser( (roomSession) => { roomSession.Router.GetComposer <UpdateUserDataMessageComposer>() .Compose(roomSession, session.Info, session.RoomEntity.Id); } ); MessengerController.UpdateUser(session.Info); }
public override void HandleMessage(Yupi.Model.Domain.Habbo session, Yupi.Protocol.Buffers.ClientMessage request, Yupi.Protocol.IRouter router) { session.ReleaseName = request.GetString(); string unknown1 = request.GetString(); int unknown2 = request.GetInteger(); int unknown3 = request.GetInteger(); }
public override void HandleMessage(Yupi.Model.Domain.Habbo session, Yupi.Protocol.Buffers.ClientMessage request, Yupi.Protocol.IRouter router) { string tmp = request.GetString(); // TODO unused // TODO Store in DB? session.MachineId = request.GetString(); }
public override void HandleMessage(Yupi.Model.Domain.Habbo session, Yupi.Protocol.Buffers.ClientMessage request, Yupi.Protocol.IRouter router) { uint pId = request.GetUInt32(); string gender = request.GetString(); string look = request.GetString(); /* * * Yupi.Messages.Rooms room = session.GetHabbo().CurrentRoom; * * RoomItem item = room?.GetRoomItemHandler().GetItem(pId); * * if (item == null || item.GetBaseItem().InteractionType != Interaction.FootballGate) * return; * * string[] figures = item.ExtraData.Split(','); * string[] newFigures = new string[2]; * * switch (gender.ToUpper()) * { * case "M": * { * newFigures[0] = look; * * newFigures[1] = figures.Length > 1 ? figures[1] : "hd-99999-99999.ch-630-62.lg-695-62"; * * item.ExtraData = string.Join(",", newFigures); * } * break; * * case "F": * { * newFigures[0] = !string.IsNullOrWhiteSpace(figures[0]) ? figures[0] : "hd-99999-99999.lg-270-62"; * * newFigures[1] = look; * * item.ExtraData = string.Join(",", newFigures); * } * break; * } * * using (IQueryAdapter queryReactor = Yupi.GetDatabaseManager().GetQueryReactor()) * { * queryReactor.SetQuery("UPDATE items_rooms SET extra_data = @extraData WHERE id = @id"); * queryReactor.AddParameter("extraData", item.ExtraData); * queryReactor.AddParameter("id", item.Id); * queryReactor.RunQuery(); * } * * router.GetComposer<UpdateRoomItemMessageComposer> ().Compose (session, item); */ throw new NotImplementedException(); }
public override void HandleMessage(Yupi.Model.Domain.Habbo session, Yupi.Protocol.Buffers.ClientMessage request, Yupi.Protocol.IRouter router) { if (session.RoomEntity == null) { return; } string command = request.GetString(); int bubbleId = request.GetInteger(); ChatBubbleStyle bubble; if (!ChatBubbleStyle.TryFromInt32(bubbleId, out bubble)) { return; } string[] args = command.Split(new char[] { ' ' }, 2); if (args.Length != 2) { return; } string targetUsername = args[0]; string msg = args[1]; RoomEntity target = session.Room.GetEntity(targetUsername); Chat.Whisper(session, msg, bubble, target, -1); }
public override void HandleMessage(Yupi.Model.Domain.Habbo session, Yupi.Protocol.Buffers.ClientMessage message, Yupi.Protocol.IRouter router) { string newName = message.GetString(); List <string> alternatives; NameChangedUpdatesMessageComposer.Status status = Validate(newName, session.Info.Name, out alternatives); if (status == NameChangedUpdatesMessageComposer.Status.OK) { session.Info.Name = newName; router.GetComposer <UpdateUsernameMessageComposer>().Compose(session, newName); // TODO Refactor UserRepository.Save(session.Info); if (session.Room != null) { session.Room.EachUser( (roomSession) => { router.GetComposer <UserUpdateNameInRoomMessageComposer>() .Compose(roomSession, session); } ); } // TODO Update room owner // TODO Notify messenger } }
public override void HandleMessage(Yupi.Model.Domain.Habbo session, Yupi.Protocol.Buffers.ClientMessage message, Yupi.Protocol.IRouter router) { string whatever = message.GetString(); // TODO What does the string contain? router.GetComposer <CitizenshipStatusMessageComposer>().Compose(session, whatever); }
public override void HandleMessage(Yupi.Model.Domain.Habbo session, Yupi.Protocol.Buffers.ClientMessage request, Yupi.Protocol.IRouter router) { int toId = request.GetInteger(); string text = request.GetString(); if (string.IsNullOrWhiteSpace(text)) { return; } Relationship friend = session.Info.Relationships.FindByUser(toId); if (friend != null) { MessengerMessage message = new MessengerMessage() { From = session.Info, UnfilteredText = text, Text = Wordfilter.Filter(text), Timestamp = DateTime.Now, }; var friendSession = ClientManager.GetByInfo(friend.Friend); friendSession?.Router.GetComposer <ConsoleChatMessageComposer>().Compose(session, message); message.Read = friendSession != null; // TODO Store for offline // TODO Store for chatlog } }
public override void HandleMessage(Yupi.Model.Domain.Habbo session, Yupi.Protocol.Buffers.ClientMessage message, Yupi.Protocol.IRouter router) { string motto = message.GetString(); // TODO Filter! session.Info.Motto = motto; UserRepository.Save(session.Info); if (session.Room == null) { return; } session.Room.EachUser( (roomSession) => { router.GetComposer <UpdateUserDataMessageComposer>() .Compose(roomSession, session.Info, session.RoomEntity.Id); } ); AchievementManager.ProgressUserAchievement(session, ProfileAchievement.Motto); }
public override void HandleMessage(Yupi.Model.Domain.Habbo session, Yupi.Protocol.Buffers.ClientMessage request, Yupi.Protocol.IRouter router) { string friendName = request.GetString(); UserInfo friend = UserRepository.Find(x => x.Name == friendName); if (friend != null) { if (friend.HasFriendRequestsDisabled) { router.GetComposer <NotAcceptingRequestsMessageComposer>().Compose(session); } else { IRepository <FriendRequest> requests = DependencyFactory.Resolve <IRepository <FriendRequest> > (); if (!requests.Exists(x => x.To == friend && x.From == session.Info)) { var friendRequest = new FriendRequest(session.Info, friend); requests.Save(friendRequest); var friendSession = ClientManager.GetByInfo(friend); if (friendSession != null) { friendSession.Router.GetComposer <ConsoleSendFriendRequestMessageComposer>() .Compose(friendSession, friendRequest); } } } } }
public override void HandleMessage(Yupi.Model.Domain.Habbo session, Yupi.Protocol.Buffers.ClientMessage request, Yupi.Protocol.IRouter router) { int count = request.GetInteger(); int[] users = new int[count]; for (int i = 0; i < count; i++) { users[i] = request.GetInteger(); } string content = request.GetString(); foreach (int userId in users) { Relationship relationship = session.Info.Relationships.FindByUser(userId); if (relationship == null) { continue; } var friendSession = ClientManager.GetByInfo(relationship.Friend); friendSession?.Router.GetComposer <ConsoleInvitationMessageComposer>() .Compose(friendSession, session.Info.Id, content); } }
public override void HandleMessage(Yupi.Model.Domain.Habbo session, Yupi.Protocol.Buffers.ClientMessage request, Yupi.Protocol.IRouter router) { string type = request.GetString(); router.GetComposer <SellablePetBreedsMessageComposer>().Compose(session, type); }
public override void HandleMessage(Yupi.Model.Domain.Habbo session, Yupi.Protocol.Buffers.ClientMessage request, Yupi.Protocol.IRouter router) { if (session.Room == null || !session.Room.Data.HasRights(session.Info)) { return; } int id = request.GetInteger(); string locationData = request.GetString(); /* * UserItem item = session.GetHabbo ().GetInventoryComponent ().GetItem (id); * * if (item == null) * return; * * WallCoordinate wallCoord = new WallCoordinate (":" + locationData.Split (':') [1]); * * RoomItem item2 = new RoomItem (item.Id, room.RoomId, item.BaseItem.Name, item.ExtraData, wallCoord, room, * session.GetHabbo ().Id, item.GroupId, false); * * if (room.GetRoomItemHandler ().SetWallItem (session, item2)) * session.GetHabbo ().GetInventoryComponent ().RemoveItem (id, true); */ throw new NotImplementedException(); }
public override void HandleMessage(Yupi.Model.Domain.Habbo session, Yupi.Protocol.Buffers.ClientMessage request, Yupi.Protocol.IRouter router) { string username = request.GetString(); // TODO Implement //session.Router.GetComposer<HotelClosedMessageComposer> ().Compose (session, 8, 0, false); if (username != session.Info.Name) { // TODO Should we check this and disconnect on mismatch? } // TODO Welcome message //router.GetComposer<SuperNotificationMessageComposer>().Compose(session, T._("Welcome"), T._("This is a development build")); /* * YupiWriterManager.WriteLine(request.GetString() + " joined game. With IP " + session.RemoteAddress, "Yupi.User", ConsoleColor.DarkGreen); * * if (!ServerConfigurationSettings.Data.ContainsKey("welcome.message.enabled") || * ServerConfigurationSettings.Data["welcome.message.enabled"] != "true") * return; * * if (!ServerConfigurationSettings.Data.ContainsKey("welcome.message.image") || * string.IsNullOrEmpty(ServerConfigurationSettings.Data["welcome.message.image"])) * session.SendNotifWithScroll(ServerExtraSettings.WelcomeMessage.Replace("%username%", * session.GetHabbo().Name)); * else * session.SendNotif(ServerExtraSettings.WelcomeMessage.Replace("%username%", session.GetHabbo().Name), * ServerConfigurationSettings.Data.ContainsKey("welcome.message.title") * ? ServerConfigurationSettings.Data["welcome.message.title"] * : string.Empty, ServerConfigurationSettings.Data["welcome.message.image"]); */ }
public override void HandleMessage(Yupi.Model.Domain.Habbo session, Yupi.Protocol.Buffers.ClientMessage request, Yupi.Protocol.IRouter router) { if (!session.Info.HasPermission("fuse_lock_trade")) return; int userId = request.GetInteger(); string message = request.GetString(); int hours = request.GetInteger(); UserInfo user = UserRepository.Find(userId); user.TradeLocks.Add(new TradeLock() { ExpiresAt = DateTime.Now.AddHours(hours) }); UserRepository.Save(user); var target = ClientManager.GetByInfo(user); if (target != null) { target.Router.GetComposer<AlertNotificationMessageComposer>().Compose(target, message); } }
public override void HandleMessage(Yupi.Model.Domain.Habbo session, Yupi.Protocol.Buffers.ClientMessage request, Yupi.Protocol.IRouter router) { int roomId = request.GetInteger(); bool shouldAdd = request.GetBool(); string word = request.GetString(); RoomData room = RoomRepository.Find(roomId); if (room != null && room.HasOwnerRights(session.Info)) { bool hasChanged = false; if (shouldAdd) { hasChanged = room.WordFilter.Add (word); } else { hasChanged = room.WordFilter.Remove (word); } if (hasChanged) { RoomRepository.Save(room); } } }
public override void HandleMessage(Yupi.Model.Domain.Habbo session, Yupi.Protocol.Buffers.ClientMessage request, Yupi.Protocol.IRouter router) { string name = request.GetString(); // TODO Refactor switch (name) { case "predefined_noob_lobby": { /* * int roomId = Convert.ToUInt32(Yupi.GetDbConfig().DbData["noob.lobby.roomid"]); * router.GetComposer<RoomForwardMessageComposer> ().Compose (session, roomId);*/ throw new NotImplementedException(); break; } case "random_friending_room": { Room room = RoomManager.GetActive().ToList().Random(); router.GetComposer <RoomForwardMessageComposer>().Compose(session, room.Data.Id); break; } } }
public override void HandleMessage(Yupi.Model.Domain.Habbo session, Yupi.Protocol.Buffers.ClientMessage message, Yupi.Protocol.IRouter router) { string code = message.GetString(); router.GetComposer <HotelViewHallOfFameMessageComposer>().Compose(session, code); }
public override void HandleMessage(Yupi.Model.Domain.Habbo session, Yupi.Protocol.Buffers.ClientMessage request, Yupi.Protocol.IRouter router) { string ssoTicket = request.GetString(); SSOManager.TryLogin(session, ssoTicket); }
public override void HandleMessage(Yupi.Model.Domain.Habbo session, Yupi.Protocol.Buffers.ClientMessage message, Yupi.Protocol.IRouter router) { string badgeCode = message.GetString(); bool hasBadge = session.Info.Badges.HasBadge(badgeCode); router.GetComposer <SendCampaignBadgeMessageComposer>().Compose(session, badgeCode, hasBadge); }
public override void HandleMessage(Yupi.Model.Domain.Habbo session, Yupi.Protocol.Buffers.ClientMessage request, Yupi.Protocol.IRouter router) { string staticId = request.GetString(); string query = request.GetString(); NavigatorView view; if (!NavigatorView.TryParse(staticId, out view)) { return; } // TODO Create SearchResult class instead of Dictionary IDictionary <NavigatorCategory, IList <RoomData> > categories = view.GetCategories(query, session.Info); router.GetComposer <SearchResultSetComposer>().Compose(session, staticId, query, categories); }
public override void HandleMessage(Yupi.Model.Domain.Habbo session, Yupi.Protocol.Buffers.ClientMessage request, Yupi.Protocol.IRouter router) { string message = request.GetString(); router.GetComposer <OnGuideSessionMsgMessageComposer>() .Compose(session.GuideOtherUser, message, session.Info.Id); router.GetComposer <OnGuideSessionMsgMessageComposer>().Compose(session, message, session.Info.Id); }
public override void HandleMessage(Yupi.Model.Domain.Habbo session, Yupi.Protocol.Buffers.ClientMessage request, Yupi.Protocol.IRouter router) { string name = request.GetString(); string description = request.GetString(); string roomModel = request.GetString(); int categoryId = request.GetInteger(); int maxVisitors = request.GetInteger(); int tradeStateId = request.GetInteger(); RoomModel model; TradingState tradeState; if (!RoomModel.TryParse(roomModel, out model) || !TradingState.TryFromInt32(tradeStateId, out tradeState)) { return; } NavigatorCategory category = NavigatorRepository.Find(categoryId); if (category.MinRank > session.Info.Rank) { return; } // TODO Filter Name, Description, max visitors RoomData data = new RoomData() { Name = name, Description = description, Model = model, Category = category, UsersMax = maxVisitors, TradeState = tradeState, Owner = session.Info }; RoomRepository.Save(data); router.GetComposer <OnCreateRoomInfoMessageComposer>().Compose(session, data); }
public override void HandleMessage(Yupi.Model.Domain.Habbo session, Yupi.Protocol.Buffers.ClientMessage request, Yupi.Protocol.IRouter router) { // TODO Refactor string value1 = request.GetString(); string value2 = request.GetString(); UserSearchLog naviLog = new UserSearchLog() { Value1 = value1, Value2 = value2 }; session.Info.NavigatorLog.Add(naviLog); UserRepository.Save(session.Info); router.GetComposer <NavigatorSavedSearchesComposer>().Compose(session, session.Info.NavigatorLog); }
public override void HandleMessage(Yupi.Model.Domain.Habbo session, Yupi.Protocol.Buffers.ClientMessage message, Yupi.Protocol.IRouter router) { int slot = message.GetInteger(); string look = message.GetString(); string gender = message.GetString(); // TODO Filter look & gender if (gender.Length == 1 && Enum.IsDefined(typeof(Gender), gender [0])) { WardrobeItem item = session.Info.Inventory.Wardrobe.FirstOrDefault(x => x.Slot == slot); if (item != default(WardrobeItem)) { item.Look.Look = look; item.Look.Gender = (Gender)gender[0]; } } }
public override void HandleMessage(Yupi.Model.Domain.Habbo session, Yupi.Protocol.Buffers.ClientMessage request, Yupi.Protocol.IRouter router) { request.GetInteger(); // TODO Unused roomid? string name = request.GetString(); string description = request.GetString(); /* * Room room = Yupi.GetGame().GetRoomManager().GetRoom(session.GetHabbo().CurrentRoomId); * * if (room == null || !room.CheckRights(session, true) || room.RoomData.Event == null) * return; * * room.RoomData.Event.Name = name; * room.RoomData.Event.Description = description; * * Yupi.GetGame().GetRoomEvents().UpdateEvent(room.RoomData.Event); */ throw new NotImplementedException(); }
public override void HandleMessage(Yupi.Model.Domain.Habbo session, Yupi.Protocol.Buffers.ClientMessage message, Yupi.Protocol.IRouter router) { string name = message.GetString(); SongData song = SongRepository.Find(x => x.CodeName == name); if (song != null) { router.GetComposer <RetrieveSongIDMessageComposer>().Compose(session, name, song.Id); } }
public override void HandleMessage(Yupi.Model.Domain.Habbo session, Yupi.Protocol.Buffers.ClientMessage message, Yupi.Protocol.IRouter router) { string trackType = message.GetString(); TalentType talentType; if (TalentType.TryParse(trackType, out talentType)) { List <Talent> talents = TalentRepository.FilterBy(x => x.Type == talentType).ToList(); router.GetComposer <TalentsTrackMessageComposer>().Compose(session, talentType, talents); } }