using System; using System.Threading; using System.Collections; using Holo.Managers; using Holo.Virtual.Rooms; using Holo.Source; using Holo.Source.Virtual.Users; namespace Holo.Virtual.Users { /// /// Represents a virtual user in a virtual room. /// public class virtualRoomUser { /// /// The database ID of the user. /// internal int userID; /// /// The ID of the virtual room where the user is in. /// internal int roomID; /// /// The ID of the user in the virtual room. /// internal int roomUID; /// /// The X position of the user in the virtual room. /// internal int X; /// /// The Y position of the user in the virtual room. /// internal int Y; /// /// The height of the user in the virtual room. /// internal double H; /// /// The rotation of the user's head in the virtual room. /// internal byte Z1; /// /// The rotation of the user's body in the virtual room. /// internal byte Z2; /// /// The X position where the user wants to walk to. If not walking, -1. /// internal int goalX; /// /// The Y position where the user wants to walk to. If not walking, -1. /// internal int goalY; /// /// Specifies if the user can walk. /// internal bool walkLock; /// /// Specifies if the user is on his way of leaving the room after clicking the door. /// internal bool walkDoor; /// /// Guestroom only. Specifies if the user has voted on the guestroom already. /// internal bool hasVoted; /// /// Lido diving only. Specifies if the user has voted on the diver already. /// internal bool hasLidoVoted = false; /// /// Swimming pools only. Specifies the swimming pool outfit. /// internal string SwimOutfit; /// /// The parent virtual user of this room user. /// internal virtualUser User; /// /// The status manager of this room user. /// internal virtualRoomUserStatusManager statusManager; /// /// Indicates if the room user is currently typing a chat message. /// internal bool isTyping; /// /// Indicates if the room user is able to use the special teleport cast, which allows him to teleport around the room. /// internal bool SPECIAL_TELEPORTABLE; private delegate void walkSleepPointer(); /// /// Initializes a virtual room user. /// /// The database ID of the virtual user of this room user object. /// The database ID of the room where the room user is in. /// The ID that identifies the room user in the virtual room. /// The parent vittual user of this room user. /// The status manager of this room user. internal virtualRoomUser(int userID, int roomID, int roomUID, virtualUser User, virtualRoomUserStatusManager statusManager) { this.userID = userID; this.roomID = roomID; this.roomUID = roomUID; this.User = User; this.statusManager = statusManager; } /// /// The virtualRoom object that represents the room where this room user is in. /// internal virtualRoom Room { get { return roomManager.getRoom(roomID); } } /// /// Refreshes the status of this room user in the virtual room. /// internal void Refresh() { if (Room != null) Room.Refresh(this); else Out.WriteLine("Room was null."); } ///// ///// Returns the details string for this room user, containing username etc. ///// //internal string detailsString //{ // get // { // string s = "i:" + roomUID + Convert.ToChar(13) + "a:" + userID + Convert.ToChar(13) + "n:" + User._Username + Convert.ToChar(13) + "f:" + User._Figure + Convert.ToChar(13) + "l:" + X + " " + Y + " " + H + Convert.ToChar(13); // if (User._Mission != "") { s += "c:" + User._Mission + Convert.ToChar(13); } // if (User._nowBadge != "") { s += "b:" + User._nowBadge + Convert.ToChar(13); } // if (SwimOutfit != "") { s += "p:" + SwimOutfit + Convert.ToChar(13); } // if (User._groupID > 0) { s += "g:" + User._groupID + Convert.ToChar(13) + "t:" + User._groupMemberRank + Convert.ToChar(13); } // return s; // } //} /// /// Returns the details string for this room user, containing username etc. /// internal string detailsString { get { FuseBuilder Message = new FuseBuilder(); Message.Append("i:"); Message.AppendString(roomUID, 13); Message.Append("a:"); Message.AppendString(userID, 13); Message.Append("n:"); Message.AppendString(User._Username, 13); Message.Append("f:"); Message.AppendString(User._Figure, 13); Message.Append("l:"); Message.AppendString(X, ' '); Message.AppendString(Y, ' '); Message.AppendString(H, 13); Message.Append("c:"); Message.AppendString(User._Mission, 13); Message.Append("b:"); foreach(userBadge badge in User.Badges) if (badge.slotID > 0) { Message.AppendString(badge.slotID, ':'); Message.AppendString(badge.badgeID, ','); } Message.AppendChar(13); if (SwimOutfit != null) { Message.Append("p:"); Message.AppendString(SwimOutfit, 13); } if (User._groupID > 0) { Message.Append("g:"); Message.AppendString(User._groupID, 13); Message.Append("t:"); Message.AppendString(User._groupMemberRank, 13); } return Message.ToString(); } } /// /// Returns the action string for this room user, containing position, movements, statuses etc. /// internal string statusString { get { FuseBuilder Message = new FuseBuilder(); Message.AppendString(roomUID, ' '); Message.AppendString(X, ','); Message.AppendString(Y, ','); Message.AppendString(H.ToString().Replace(",", "."), ','); Message.AppendString(Z1, ','); Message.AppendString(Z2, '/'); Message.Append(statusManager.ToString()); return Message.ToString(); } } } }