public GroupInfoComposer(Group Group, GameClient Session, bool NewWindow = false) : base(ServerPacketHeader.GroupInfoMessageComposer) { DateTime Origin = new DateTime(1970, 1, 1, 0, 0, 0, 0).AddSeconds(Group.CreateTime); base.WriteInteger(Group.Id); base.WriteBoolean(true); base.WriteInteger(Group.GroupType == GroupType.OPEN ? 0 : Group.GroupType == GroupType.LOCKED ? 1 : 2); base.WriteString(Group.Name); base.WriteString(Group.Description); base.WriteString(Group.Badge); base.WriteInteger(Group.RoomId); base.WriteString((PlusEnvironment.GetGame().GetRoomManager().GenerateRoomData(Group.RoomId) == null) ? "No room found.." : PlusEnvironment.GetGame().GetRoomManager().GenerateRoomData(Group.RoomId).Name); // room name base.WriteInteger(Group.CreatorId == Session.GetHabbo().Id ? 3 : Group.HasRequest(Session.GetHabbo().Id) ? 2 : Group.IsMember(Session.GetHabbo().Id) ? 1 : 0); base.WriteInteger(Group.MemberCount); // Members base.WriteBoolean(false);//?? CHANGED base.WriteString(Origin.Day + "-" + Origin.Month + "-" + Origin.Year); base.WriteBoolean(Group.CreatorId == Session.GetHabbo().Id); base.WriteBoolean(Group.IsAdmin(Session.GetHabbo().Id)); // admin base.WriteString(PlusEnvironment.GetUsernameById(Group.CreatorId)); base.WriteBoolean(NewWindow); // Show group info base.WriteBoolean(Group.AdminOnlyDeco == 0); // Any user can place furni in home room base.WriteInteger(Group.CreatorId == Session.GetHabbo().Id ? Group.RequestCount : Group.IsAdmin(Session.GetHabbo().Id) ? Group.RequestCount : Group.IsMember(Session.GetHabbo().Id) ? 0 : 0); // Pending users //base.WriteInteger(0);//what the f**k base.WriteBoolean(Group != null ? Group.ForumEnabled : true);//HabboTalk. }
public bool TryGetGroup(int Id, out Group Group) { Group = null; if (this._groups.ContainsKey(Id)) return this._groups.TryGetValue(Id, out Group); lock (this._groupLoadingSync) { if (this._groups.ContainsKey(Id)) return this._groups.TryGetValue(Id, out Group); DataRow Row = null; using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT * FROM `groups` WHERE `id` = @id LIMIT 1"); dbClient.AddParameter("id", Id); Row = dbClient.getRow(); if (Row != null) { Group = new Group( Convert.ToInt32(Row["id"]), Convert.ToString(Row["name"]), Convert.ToString(Row["desc"]), Convert.ToString(Row["badge"]), Convert.ToInt32(Row["room_id"]), Convert.ToInt32(Row["owner_id"]), Convert.ToInt32(Row["created"]), Convert.ToInt32(Row["state"]), Convert.ToInt32(Row["colour1"]), Convert.ToInt32(Row["colour2"]), Convert.ToInt32(Row["admindeco"])); this._groups.TryAdd(Group.Id, Group); return true; } } } return false; }
public GroupMembersComposer(Group Group, ICollection<UserCache> Members, int MembersCount, int Page, bool Admin, int ReqType, string SearchVal) : base(ServerPacketHeader.GroupMembersMessageComposer) { base.WriteInteger(Group.Id); base.WriteString(Group.Name); base.WriteInteger(Group.RoomId); base.WriteString(Group.Badge); base.WriteInteger(MembersCount); base.WriteInteger(Members.Count); if (MembersCount > 0) { foreach (UserCache Data in Members) { base.WriteInteger(Group.CreatorId == Data.Id ? 0 : Group.IsAdmin(Data.Id) ? 1 : Group.IsMember(Data.Id) ? 2 : 3); base.WriteInteger(Data.Id); base.WriteString(Data.Username); base.WriteString(Data.Look); base.WriteString(string.Empty); } } base.WriteBoolean(Admin); base.WriteInteger(14); base.WriteInteger(Page); base.WriteInteger(ReqType); base.WriteString(SearchVal); }
public UpdateFavouriteGroupComposer(int Id, Group Group, int VirtualId) : base(ServerPacketHeader.UpdateFavouriteGroupMessageComposer) { base.WriteInteger(VirtualId);//Sends 0 on .COM base.WriteInteger(Group.Id); base.WriteInteger(3); base.WriteString(Group.Name); }
public HabboGroupBadgesComposer(Group Group) : base(ServerPacketHeader.HabboGroupBadgesMessageComposer) { base.WriteInteger(1);//count { base.WriteInteger(Group.Id); base.WriteString(Group.Badge); } }
public GroupFurniSettingsComposer(Group Group, int ItemId, int UserId) : base(ServerPacketHeader.GroupFurniSettingsMessageComposer) { base.WriteInteger(ItemId);//Item Id base.WriteInteger(Group.Id);//Group Id? base.WriteString(Group.Name); base.WriteInteger(Group.RoomId);//RoomId base.WriteBoolean(Group.IsMember(UserId));//Member? base.WriteBoolean(Group.ForumEnabled);//Has a forum }
public ManageGroupComposer(Group Group) : base(ServerPacketHeader.ManageGroupMessageComposer) { base.WriteInteger(0); base.WriteBoolean(true); base.WriteInteger(Group.Id); base.WriteString(Group.Name); base.WriteString(Group.Description); base.WriteInteger(1); base.WriteInteger(Group.Colour1); base.WriteInteger(Group.Colour2); base.WriteInteger(Group.GroupType == GroupType.OPEN ? 0 : Group.GroupType == GroupType.LOCKED ? 1 : 2); base.WriteInteger(Group.AdminOnlyDeco); base.WriteBoolean(false); base.WriteString(""); string[] BadgeSplit = Group.Badge.Replace("b", "").Split('s'); this.WriteInteger(5); int Req = 5 - BadgeSplit.Length; int Final = 0; string[] array2 = BadgeSplit; for (int i = 0; i < array2.Length; i++) { string Symbol = array2[i]; this.WriteInteger((Symbol.Length >= 6) ? int.Parse(Symbol.Substring(0, 3)) : int.Parse(Symbol.Substring(0, 2))); this.WriteInteger((Symbol.Length >= 6) ? int.Parse(Symbol.Substring(3, 2)) : int.Parse(Symbol.Substring(2, 2))); this.WriteInteger(Symbol.Length < 5 ? 0 : Symbol.Length >= 6 ? int.Parse(Symbol.Substring(5, 1)) : int.Parse(Symbol.Substring(4, 1))); } while (Final != Req) { this.WriteInteger(0); this.WriteInteger(0); this.WriteInteger(0); Final++; } base.WriteString(Group.Badge); base.WriteInteger(Group.MemberCount); }
public void Fill(DataRow Row) { Id = Convert.ToInt32(Row["id"]); Name = Convert.ToString(Row["caption"]); Description = Convert.ToString(Row["description"]); Type = Convert.ToString(Row["roomtype"]); OwnerId = Convert.ToInt32(Row["owner"]); OwnerName = ""; using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT `username` FROM `users` WHERE `id` = @owner LIMIT 1"); dbClient.AddParameter("owner", OwnerId); string result = dbClient.getString(); if (!String.IsNullOrEmpty(result)) OwnerName = result; } this.Access = RoomAccessUtility.ToRoomAccess(Row["state"].ToString().ToLower()); Category = Convert.ToInt32(Row["category"]); if (!string.IsNullOrEmpty(Row["users_now"].ToString())) UsersNow = Convert.ToInt32(Row["users_now"]); else UsersNow = 0; UsersMax = Convert.ToInt32(Row["users_max"]); ModelName = Convert.ToString(Row["model_name"]); Score = Convert.ToInt32(Row["score"]); Tags = new List<string>(); AllowPets = Convert.ToInt32(Row["allow_pets"].ToString()); AllowPetsEating = Convert.ToInt32(Row["allow_pets_eat"].ToString()); RoomBlockingEnabled = Convert.ToInt32(Row["room_blocking_disabled"].ToString()); Hidewall = Convert.ToInt32(Row["allow_hidewall"].ToString()); Password = Convert.ToString(Row["password"]); Wallpaper = Convert.ToString(Row["wallpaper"]); Floor = Convert.ToString(Row["floor"]); Landscape = Convert.ToString(Row["landscape"]); FloorThickness = Convert.ToInt32(Row["floorthick"]); WallThickness = Convert.ToInt32(Row["wallthick"]); WhoCanMute = Convert.ToInt32(Row["mute_settings"]); WhoCanKick = Convert.ToInt32(Row["kick_settings"]); WhoCanBan = Convert.ToInt32(Row["ban_settings"]); chatMode = Convert.ToInt32(Row["chat_mode"]); chatSpeed = Convert.ToInt32(Row["chat_speed"]); chatSize = Convert.ToInt32(Row["chat_size"]); TradeSettings = Convert.ToInt32(Row["trade_settings"]); Group G = null; if (PlusEnvironment.GetGame().GetGroupManager().TryGetGroup(Convert.ToInt32(Row["group_id"]), out G)) Group = G; else Group = null; foreach (string Tag in Row["tags"].ToString().Split(',')) { Tags.Add(Tag); } mModel = PlusEnvironment.GetGame().GetRoomManager().GetModel(ModelName); this.PushEnabled = PlusEnvironment.EnumToBool(Row["push_enabled"].ToString()); this.PullEnabled = PlusEnvironment.EnumToBool(Row["pull_enabled"].ToString()); this.SPushEnabled = PlusEnvironment.EnumToBool(Row["spush_enabled"].ToString()); this.SPullEnabled = PlusEnvironment.EnumToBool(Row["spull_enabled"].ToString()); this.EnablesEnabled = PlusEnvironment.EnumToBool(Row["enables_enabled"].ToString()); this.RespectNotificationsEnabled = PlusEnvironment.EnumToBool(Row["respect_notifications_enabled"].ToString()); this.PetMorphsAllowed = PlusEnvironment.EnumToBool(Row["pet_morphs_allowed"].ToString()); }
public bool TryCreateGroup(Habbo Player, string Name, string Description, int RoomId, string Badge, int Colour1, int Colour2, out Group Group) { Group = new Group(0, Name, Description, Badge, RoomId, Player.Id, (int)PlusEnvironment.GetUnixTimestamp(), 0, Colour1, Colour2, 0); if (string.IsNullOrWhiteSpace(Name) || string.IsNullOrWhiteSpace(Badge)) return false; using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("INSERT INTO `groups` (`name`, `desc`, `badge`, `owner_id`, `created`, `room_id`, `state`, `colour1`, `colour2`, `admindeco`) VALUES (@name, @desc, @badge, @owner, UNIX_TIMESTAMP(), @room, '0', @colour1, @colour2, '0')"); dbClient.AddParameter("name", Group.Name); dbClient.AddParameter("desc", Group.Description); dbClient.AddParameter("owner", Group.CreatorId); dbClient.AddParameter("badge", Group.Badge); dbClient.AddParameter("room", Group.RoomId); dbClient.AddParameter("colour1", Group.Colour1); dbClient.AddParameter("colour2", Group.Colour2); Group.Id = Convert.ToInt32(dbClient.InsertQuery()); Group.AddMember(Player.Id); Group.MakeAdmin(Player.Id); if (!this._groups.TryAdd(Group.Id, Group)) return false; else { dbClient.SetQuery("UPDATE `rooms` SET `group_id` = @gid WHERE `id` = @rid LIMIT 1"); dbClient.AddParameter("gid", Group.Id); dbClient.AddParameter("rid", Group.RoomId); dbClient.RunQuery(); dbClient.RunQuery("DELETE FROM `room_rights` WHERE `room_id` = '" + RoomId + "'"); } } return true; }