TigerEmu/Game/Rooms/Room.cs

131 lines
4.0 KiB
C#
Raw Permalink Normal View History

using Tiger.Communication.Messages.Types;
using Tiger.Game.Habbos;
namespace Tiger.Game.Rooms;
public class Room
{
public virtual int Id { get; set; }
public virtual string Name { get; set; } = null!;
public virtual string Description { get; set; } = null!;
public virtual int ModelId { get; set; }
public virtual string Password { get; set; } = null!;
public virtual string State { get; set; } = null!;
public virtual int UsersIn { get; set; }
public virtual int UsersMax { get; set; }
public virtual int Score { get; set; }
public virtual string Floor { get; set; } = null!;
public virtual string Wallpaper { get; set; } = null!;
public virtual string Landscape { get; set; } = null!;
public virtual int WallThickness { get; set; }
public virtual int WallHeight { get; set; }
public virtual int FloorThickness { get; set; }
public virtual string MoodlightData { get; set; } = null!;
public virtual IList<string> Tags { get; set; } = new List<string>();
public virtual bool IsPublic { get; set; }
public virtual bool IsStaffPicked { get; set; }
public virtual bool AllowOtherPets { get; set; }
public virtual bool AllowOtherPetsEat { get; set; }
public virtual bool AllowWalkthrough { get; set; }
public virtual bool HideWalls { get; set; }
public virtual int ChatMode { get; set; }
public virtual int ChatWeight { get; set; }
public virtual int ChatSpeed { get; set; }
public virtual int ChatHearingDistance { get; set; }
public virtual int ChatProtection { get; set; }
public virtual bool OverrideModel { get; set; }
public virtual int WhoCanMute { get; set; }
public virtual int WhoCanKick { get; set; }
public virtual int WhoCanBan { get; set; }
public virtual int RollerSpeed { get; set; }
public virtual bool Promoted { get; set; }
public virtual int TradeMode { get; set; }
public virtual bool MoveDiagonally { get; set; }
public virtual bool JukeboxActive { get; set; }
public virtual bool HideWired { get; set; }
public virtual bool IsForSale { get; set; }
public virtual Habbo? Owner { get; set; }
public virtual RoomPrivateCategory Category { get; set; } = null!;
public virtual int StateNumber => State switch
{
"locked" => 1,
"password" => 2,
"invisible" => 3,
_ => 0
};
public virtual int Base
{
get
{
var @base = 0;
// if (Guild != null)
// {
// @base += 2;
// }
// if (Promoted)
// {
// @base += 4;
// }
if (!IsPublic)
{
@base += 8;
}
if (!IsPublic && AllowOtherPets)
{
@base += 16;
}
return @base;
}
}
public virtual void Serialize(ServerMessage response)
{
response.AppendInt32(Id);
response.AppendString(Name);
if (IsPublic)
{
response.AppendInt32(0);
response.AppendString(string.Empty);
}
else
{
response.AppendInt32(Owner?.Id ?? 0);
response.AppendString(Owner?.Username ?? string.Empty);
}
response.AppendInt32(StateNumber);
response.AppendInt32(UsersIn);
response.AppendInt32(UsersMax);
response.AppendString(Description);
response.AppendInt32(0);
response.AppendInt32(Score);
response.AppendInt32(0);
response.AppendInt32(Category.Id);
response.AppendInt32(Tags.Count);
foreach (var tag in Tags)
{
response.AppendString(tag);
}
response.AppendInt32(Base);
// if (Guild != null)
// {
// response.AppendInt32(Guild.Id);
// response.WriteString(Guild.Name);
// response.WriteString(Guild.Badge);
// }
// TODO: Promotion
}
}