public GroupInfoComposer(Group group, GameClient session, bool newWindow = false) : base(ServerPacketHeader.GroupInfoMessageComposer) { var origin = new DateTime(1970, 1, 1, 0, 0, 0, 0).AddSeconds(group.CreateTime); WriteInteger(group.Id); WriteBoolean(true); WriteInteger(group.GroupType == GroupType.OPEN ? 0 : group.GroupType == GroupType.LOCKED ? 1 : 2); WriteString(group.Name); WriteString(group.Description); WriteString(group.Badge); WriteInteger(group.RoomId); WriteString(PlusEnvironment.GetGame().GetRoomManager().GenerateRoomData(group.RoomId) == null ? "No room found.." : PlusEnvironment.GetGame().GetRoomManager().GenerateRoomData(group.RoomId).Name); // room name WriteInteger(group.CreatorId == session.GetHabbo().Id ? 3 : group.HasRequest(session.GetHabbo().Id) ? 2 : group.IsMember(session.GetHabbo().Id) ? 1 : 0); WriteInteger(group.MemberCount); // Members WriteBoolean(false); //?? CHANGED WriteString(origin.Day + "-" + origin.Month + "-" + origin.Year); WriteBoolean(group.CreatorId == session.GetHabbo().Id); WriteBoolean(group.IsAdmin(session.GetHabbo().Id)); // admin WriteString(PlusEnvironment.GetUsernameById(group.CreatorId)); WriteBoolean(newWindow); // Show group info WriteBoolean(group.AdminOnlyDeco == 0); // Any user can place furni in home room 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 WriteBoolean(group != null ? group.ForumEnabled : true); //HabboTalk. }
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); WriteInteger(Group.Id); WriteBoolean(true); WriteInteger(Group.Type == GroupType.Open ? 0 : Group.Type == GroupType.Locked ? 1 : 2); WriteString(Group.Name); WriteString(Group.Description); WriteString(Group.Badge); WriteInteger(Group.RoomId); WriteString(Group.GetRoom() != null ? Group.GetRoom().Name : "No room found.."); // room name WriteInteger(Group.CreatorId == Session.Habbo.Id ? 3 : Group.HasRequest(Session.Habbo.Id) ? 2 : Group.IsMember(Session.Habbo.Id) ? 1 : 0); WriteInteger(Group.MemberCount); // Members WriteBoolean(false); //?? CHANGED WriteString(Origin.Day + "-" + Origin.Month + "-" + Origin.Year); WriteBoolean(Group.CreatorId == Session.Habbo.Id); WriteBoolean(Group.IsAdmin(Session.Habbo.Id)); // admin WriteString(PlusEnvironment.GetUsernameById(Group.CreatorId)); WriteBoolean(NewWindow); // Show group info WriteBoolean(Group.AdminOnlyDeco == 0); // Any user can place furni in home room WriteInteger(Group.CreatorId == Session.Habbo.Id ? Group.RequestCount : Group.IsAdmin(Session.Habbo.Id) ? Group.RequestCount : Group.IsMember(Session.Habbo.Id) ? 0 : 0); // Pending users //base.WriteInteger(0);//what the f**k WriteBoolean(Group != null ? Group.ForumEnabled : true); //HabboTalk. }
public void Parse(GameClient session, ClientPacket packet) { if (!session.GetHabbo().InRoom) { return; } int userId = packet.PopInt(); packet.PopInt(); //roomId int time = packet.PopInt(); Room room = session.GetHabbo().CurrentRoom; if (room == null) { return; } if (((room.WhoCanMute == 0 && !room.CheckRights(session, true) && room.Group == null) || (room.WhoCanMute == 1 && !room.CheckRights(session)) && room.Group == null) || (room.Group != null && !room.CheckRights(session, false, true))) { return; } RoomUser target = room.GetRoomUserManager().GetRoomUserByHabbo(PlusEnvironment.GetUsernameById(userId)); if (target == null) { return; } else if (target.GetClient().GetHabbo().GetPermissions().HasRight("mod_tool")) { return; } if (room.MutedUsers.ContainsKey(userId)) { if (room.MutedUsers[userId] < PlusEnvironment.GetUnixTimestamp()) { room.MutedUsers.Remove(userId); } else { return; } } room.MutedUsers.Add(userId, (PlusEnvironment.GetUnixTimestamp() + (time * 60))); target.GetClient().SendWhisper("The room owner has muted you for " + time + " minutes!"); PlusEnvironment.GetGame().GetAchievementManager().ProgressAchievement(session, "ACH_SelfModMuteSeen", 1); }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { if (!Session.GetHabbo().InRoom) { return; } int UserId = Packet.PopInt(); int RoomId = Packet.PopInt(); int Time = Packet.PopInt(); Room Room = Session.GetHabbo().CurrentRoom; if (Room == null) { return; } if (((Room.WhoCanMute == 0 && !Room.CheckRights(Session, true) && Room.Group == null) || (Room.WhoCanMute == 1 && !Room.CheckRights(Session)) && Room.Group == null) || (Room.Group != null && !Room.CheckRights(Session, false, true))) { return; } RoomUser Target = Room.GetRoomUserManager().GetRoomUserByHabbo(PlusEnvironment.GetUsernameById(UserId)); if (Target == null) { return; } else if (Target.GetClient().GetHabbo().GetPermissions().HasRight("mod_tool")) { return; } if (Room.MutedUsers.ContainsKey(UserId)) { if (Room.MutedUsers[UserId] < PlusEnvironment.GetUnixTimestamp()) { Room.MutedUsers.Remove(UserId); } else { return; } } Room.MutedUsers.Add(UserId, (PlusEnvironment.GetUnixTimestamp() + (Time * 60))); Target.GetClient().SendWhisper("The room owner has muted you for " + Time + " minutes!"); PlusEnvironment.GetGame().GetAchievementManager().ProgressAchievement(Session, "ACH_SelfModMuteSeen", 1); }
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); bool IsAdmin = false; if (Group.IsAdmin(Session.GetHabbo().Id)) { IsAdmin = true; } if (Session.GetHabbo().GetPermissions().HasRight("corporation_rights")) { IsAdmin = true; } bool IsOwner = false; if (Group.CreatorId == Session.GetHabbo().Id) { IsOwner = true; } if (Session.GetHabbo().GetPermissions().HasRight("roleplay_corp_manager")) { IsOwner = true; } 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(0); //Group.RoomId base.WriteString((PlusEnvironment.GetGame().GetRoomManager().GenerateRoomData(Group.RoomId) == null) ? "Nenhum quarto encontrado.." : 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.Id < 1000 ? (Group.Members.Count + 1) : Group.Members.Count); // Members base.WriteBoolean(false); //?? CHANGED base.WriteString(Origin.Day + "-" + Origin.Month + "-" + Origin.Year); base.WriteBoolean(IsOwner); // Owner Check base.WriteBoolean(IsAdmin); // Admin Check 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((IsOwner || IsAdmin) ? Group.Requests.Count : 0); // Pending users //base.WriteInteger(0);//what the f**k base.WriteBoolean(Group != null ? Group.ForumEnabled : true); //HabboTalk. }
public string GetUsername() { if (IsBot) { return(string.Empty); } if (GetClient() != null) { if (GetClient().GetHabbo() != null) { return(GetClient().GetHabbo().Username); } return(PlusEnvironment.GetUsernameById(HabboId)); } return(PlusEnvironment.GetUsernameById(HabboId)); }
public override void Compose(ServerPacket packet) { packet.WriteInteger(Group.Id); packet.WriteBoolean(true); packet.WriteInteger(Group.Type == GroupType.Open ? 0 : Group.Type == GroupType.Locked ? 1 : 2); packet.WriteString(Group.Name); packet.WriteString(Group.Description); packet.WriteString(Group.Badge); packet.WriteInteger(Group.RoomId); packet.WriteString(Group.GetRoom() != null ? Group.GetRoom().Name : "No room found.."); // room name packet.WriteInteger(Group.CreatorId == Habbo.Id ? 3 : Group.HasRequest(Habbo.Id) ? 2 : Group.IsMember(Habbo.Id) ? 1 : 0); packet.WriteInteger(Group.MemberCount); // Members packet.WriteBoolean(false); //?? CHANGED packet.WriteString(Origin.Day + "-" + Origin.Month + "-" + Origin.Year); packet.WriteBoolean(Group.CreatorId == Habbo.Id); packet.WriteBoolean(Group.IsAdmin(Habbo.Id)); // admin packet.WriteString(PlusEnvironment.GetUsernameById(Group.CreatorId)); packet.WriteBoolean(NewWindow); // Show group info packet.WriteBoolean(Group.AdminOnlyDeco == 0); // Any user can place furni in home room packet.WriteInteger(Group.CreatorId == Habbo.Id ? Group.RequestCount : Group.IsAdmin(Habbo.Id) ? Group.RequestCount : Group.IsMember(Habbo.Id) ? 0 : 0); // Pending users //base.WriteInteger(0);//what the f**k packet.WriteBoolean(Group != null ? Group.ForumEnabled : true); //HabboTalk. }
private void WriteUser(RoomUser User) { if (!User.IsPet && !User.IsBot) { Habbo Habbo = User.GetClient().Habbo; Group Group = null; if (Habbo != null) { if (Habbo.GetStats() != null) { if (Habbo.GetStats().FavouriteGroupId > 0) { if (!PlusEnvironment.GetGame().GetGroupManager().TryGetGroup(Habbo.GetStats().FavouriteGroupId, out Group)) { Group = null; } } } } if (Habbo.PetId == 0) { WriteInteger(Habbo.Id); WriteString(Habbo.Username); WriteString(Habbo.Motto); WriteString(Habbo.Look); WriteInteger(User.VirtualId); WriteInteger(User.X); WriteInteger(User.Y); WriteDouble(User.Z); WriteInteger(0); //2 for user, 4 for bot. WriteInteger(1); //1 for user, 2 for pet, 3 for bot. WriteString(Habbo.Gender.ToLower()); if (Group != null) { WriteInteger(Group.Id); WriteInteger(0); WriteString(Group.Name); } else { WriteInteger(0); WriteInteger(0); WriteString(""); } WriteString(""); //Whats this? WriteInteger(Habbo.GetStats().AchievementPoints); //Achievement score WriteBoolean(false); //Builders club? } else if (Habbo.PetId > 0 && Habbo.PetId != 100) { WriteInteger(Habbo.Id); WriteString(Habbo.Username); WriteString(Habbo.Motto); WriteString(PetFigureForType(Habbo.PetId)); WriteInteger(User.VirtualId); WriteInteger(User.X); WriteInteger(User.Y); WriteDouble(User.Z); WriteInteger(0); WriteInteger(2); //Pet. WriteInteger(Habbo.PetId); //pet type. WriteInteger(Habbo.Id); //UserId of the owner. WriteString(Habbo.Username); //Username of the owner. WriteInteger(1); WriteBoolean(false); //Has saddle. WriteBoolean(false); //Is someone riding this horse? WriteInteger(0); WriteInteger(0); WriteString(""); } else if (Habbo.PetId > 0 && Habbo.PetId == 100) { WriteInteger(Habbo.Id); WriteString(Habbo.Username); WriteString(Habbo.Motto); WriteString(Habbo.Look.ToLower()); WriteInteger(User.VirtualId); WriteInteger(User.X); WriteInteger(User.Y); WriteDouble(User.Z); WriteInteger(0); WriteInteger(4); WriteString(Habbo.Gender.ToLower()); // ? WriteInteger(Habbo.Id); //Owner Id WriteString(Habbo.Username); // Owner name WriteInteger(0); //Action Count } } else if (User.IsPet) { WriteInteger(User.BotAI.BaseId); WriteString(User.BotData.Name); WriteString(User.BotData.Motto); //base.WriteString("26 30 ffffff 5 3 302 4 2 201 11 1 102 12 0 -1 28 4 401 24"); WriteString(User.BotData.Look.ToLower() + ((User.PetData.Saddle > 0) ? " 3 2 " + User.PetData.PetHair + " " + User.PetData.HairDye + " 3 " + User.PetData.PetHair + " " + User.PetData.HairDye + " 4 " + User.PetData.Saddle + " 0" : " 2 2 " + User.PetData.PetHair + " " + User.PetData.HairDye + " 3 " + User.PetData.PetHair + " " + User.PetData.HairDye + "")); WriteInteger(User.VirtualId); WriteInteger(User.X); WriteInteger(User.Y); WriteDouble(User.Z); WriteInteger(0); WriteInteger((User.BotData.AiType == BotAIType.Pet) ? 2 : 4); WriteInteger(User.PetData.Type); WriteInteger(User.PetData.OwnerId); // userid WriteString(User.PetData.OwnerName); // username WriteInteger(1); WriteBoolean(User.PetData.Saddle > 0); WriteBoolean(User.RidingHorse); WriteInteger(0); WriteInteger(0); WriteString(""); } else if (User.IsBot) { WriteInteger(User.BotAI.BaseId); WriteString(User.BotData.Name); WriteString(User.BotData.Motto); WriteString(User.BotData.Look.ToLower()); WriteInteger(User.VirtualId); WriteInteger(User.X); WriteInteger(User.Y); WriteDouble(User.Z); WriteInteger(0); WriteInteger((User.BotData.AiType == BotAIType.Pet) ? 2 : 4); WriteString(User.BotData.Gender.ToLower()); // ? WriteInteger(User.BotData.OwnerId); //Owner Id WriteString(PlusEnvironment.GetUsernameById(User.BotData.OwnerId)); // Owner name WriteInteger(5); //Action Count WriteShort(1); //Copy looks WriteShort(2); //Setup speech WriteShort(3); //Relax WriteShort(4); //Dance WriteShort(5); //Change name } }
private void WriteUser(RoomUser User) { if (!User.IsPet && !User.IsBot) { Habbo Habbo = User.GetClient().GetHabbo(); Group Group = GroupManager.GetJob(User.GetClient().GetRoleplay().JobId); if (Habbo.PetId == 0) { base.WriteInteger(Habbo.Id); base.WriteString(Habbo.Username); base.WriteString(Habbo.Motto); base.WriteString(Habbo.Look); base.WriteInteger(User.VirtualId); base.WriteInteger(User.X); base.WriteInteger(User.Y); base.WriteDouble(User.Z); base.WriteInteger(0); //2 for user, 4 for bot. base.WriteInteger(1); //1 for user, 2 for pet, 3 for bot. base.WriteString(Habbo.Gender.ToLower()); if (Group != null) { base.WriteInteger(Group.Id); base.WriteInteger(0); base.WriteString(Group.Name); } else { base.WriteInteger(0); base.WriteInteger(0); base.WriteString(""); } base.WriteString(""); //Whats this? base.WriteInteger(Habbo.GetStats().AchievementPoints); //Achievement score base.WriteBoolean(false); //Builders club? } else if (Habbo.PetId > 0 && Habbo.PetId != 100) { base.WriteInteger(Habbo.Id); base.WriteString(Habbo.Username); base.WriteString(Habbo.Motto); base.WriteString((Habbo.PetFigure == null) ? PetFigureForType(Habbo) : Habbo.PetFigure); base.WriteInteger(User.VirtualId); base.WriteInteger(User.X); base.WriteInteger(User.Y); base.WriteDouble(User.Z); base.WriteInteger(0); base.WriteInteger(2); //Pet. base.WriteInteger(Habbo.PetId); //pet type. base.WriteInteger(Habbo.Id); //UserId of the owner. base.WriteString(Habbo.Username); //Username of the owner. base.WriteInteger(1); base.WriteBoolean(false); //Has saddle. base.WriteBoolean(false); //Is someone riding this horse? base.WriteInteger(0); base.WriteInteger(0); base.WriteString(""); } else if (Habbo.PetId > 0 && Habbo.PetId == 100) { base.WriteInteger(Habbo.Id); base.WriteString(Habbo.Username); base.WriteString(Habbo.Motto); base.WriteString(Habbo.Look.ToLower()); base.WriteInteger(User.VirtualId); base.WriteInteger(User.X); base.WriteInteger(User.Y); base.WriteDouble(User.Z); base.WriteInteger(0); base.WriteInteger(4); base.WriteString(Habbo.Gender.ToLower()); // ? base.WriteInteger(Habbo.Id); //Owner Id base.WriteString(Habbo.Username); // Owner name base.WriteInteger(0); //Action Count } } else if (User.IsPet) { base.WriteInteger(User.BotAI.BaseId); base.WriteString(User.BotData.Name); base.WriteString(User.BotData.Motto); //base.WriteString("26 30 ffffff 5 3 302 4 2 201 11 1 102 12 0 -1 28 4 401 24"); base.WriteString(User.BotData.Look.ToLower() + ((User.PetData.Saddle > 0) ? " 3 2 " + User.PetData.PetHair + " " + User.PetData.HairDye + " 3 " + User.PetData.PetHair + " " + User.PetData.HairDye + " 4 " + User.PetData.Saddle + " 0" : " 2 2 " + User.PetData.PetHair + " " + User.PetData.HairDye + " 3 " + User.PetData.PetHair + " " + User.PetData.HairDye + "")); base.WriteInteger(User.VirtualId); base.WriteInteger(User.X); base.WriteInteger(User.Y); base.WriteDouble(User.Z); base.WriteInteger(0); base.WriteInteger((User.BotData.AiType == BotAIType.PET) ? 2 : 4); base.WriteInteger(User.PetData.Type); base.WriteInteger(User.PetData.OwnerId); // userid base.WriteString(User.PetData.OwnerName); // username base.WriteInteger(1); base.WriteBoolean(User.PetData.Saddle > 0); base.WriteBoolean(User.RidingHorse); base.WriteInteger(0); base.WriteInteger(0); base.WriteString(""); } else if (User.IsBot) { if (User.IsRoleplayBot) { string[] Outfit = User.GetBotRoleplay().GetOutFit(); #region BOT Profile Type 1 base.WriteInteger(User.BotAI.BaseId + 1000000); base.WriteString(User.GetBotRoleplay().Name); base.WriteString(Outfit[1]); base.WriteString(Outfit[0]); base.WriteInteger(User.VirtualId); base.WriteInteger(User.X); base.WriteInteger(User.Y); base.WriteDouble(User.Z); base.WriteInteger(0); //2 for user, 4 for bot. base.WriteInteger(1); //1 for user, 2 for pet, 3 for bot. base.WriteString(User.GetBotRoleplay().Gender.ToLower()); Group BotGroup = GroupManager.GetJob(User.GetBotRoleplay().Corporation); if (BotGroup != null) { base.WriteInteger(BotGroup.Id); base.WriteInteger(0); base.WriteString(BotGroup.Name); } else { base.WriteInteger(0); base.WriteInteger(0); base.WriteString(""); } base.WriteString(""); //Whats this? base.WriteInteger(0); //Achievement score base.WriteBoolean(false); //Builders club? #endregion } else { #region BOT Profile Type 2 base.WriteInteger(User.BotAI.BaseId); base.WriteString(User.BotData.Name); base.WriteString(User.BotData.Motto); base.WriteString(User.BotData.Look.ToLower()); base.WriteInteger(User.VirtualId); base.WriteInteger(User.X); base.WriteInteger(User.Y); base.WriteDouble(User.Z); base.WriteInteger(0); base.WriteInteger((User.BotData.AiType == BotAIType.PET) ? 2 : 4); base.WriteString(User.BotData.Gender.ToLower()); // ? base.WriteInteger(User.BotData.ownerID); //Owner Id base.WriteString(PlusEnvironment.GetUsernameById(User.BotData.ownerID)); // Owner name base.WriteInteger(5); //Action Count base.WriteShort(1); //Copy looks base.WriteShort(2); //Setup speech base.WriteShort(3); //Relax base.WriteShort(4); //Dance base.WriteShort(5); //Change name #endregion } } }