/// Made by: Hebbo + Maarten, released by MoBaT [Under Permission].
using System;
using System.Threading;
using System.Collections;
using Holo.Managers;
using Holo.Virtual.Rooms;
using Ion.Storage;
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;
/// The room user ID (rUID) of the virtual user where this virtual user is currently trading items with. If not trading, then this value is -1.
///
internal int _tradePartnerRoomUID = -1;
///
/// Swimming pools only. Specifies the swimming pool outfit.
///
internal string swimOutfit;
///
/// Gamelobbies only. Specifies the amount of gamepoints that this user has for the game in the current gamelobby.
///
///
/// Is person diving or not?
///
internal bool Diving = false;
///
/// not used yet, for the queue
///
internal bool InQueue = false;
internal int gamePoints;
///
/// 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 = false;
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.
///
/// Turn the pettransform on or off.
///
internal bool petTransform_cat;
internal bool petTransform_dog;
internal bool petTransform_croc;
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()
{
Room.Refresh(this);
}
///
/// Returns the details string for this room user, containing username etc.
/// 0) { gBadge = Encoding.encodeVL64(User._groupID); } else { gBadge = "M"; }
string s = Encoding.encodeVL64(userID) + userName + Convert.ToChar(2) + userMotto + " " + Convert.ToChar(2) + UserFigure + Convert.ToChar(2) + Encoding.encodeVL64(roomUID) + Encoding.encodeVL64(X) + Encoding.encodeVL64(Y) + "H" + Convert.ToChar(2) + "HI" + userSex + Convert.ToChar(2) + userGamepoints + gBadge + "M" + swimOutfit + Convert.ToChar(2);
return s;
}
}
}
///
/// Returns the action string for this room user, containing position, movements, statuses etc.
///
internal string statusString
{
get
{
return Encoding.encodeVL64(roomUID) + Encoding.encodeVL64(X) + Encoding.encodeVL64(Y) + H.ToString().Replace(",", ".") + Convert.ToChar(2) + Encoding.encodeVL64(Z1) + Encoding.encodeVL64(Z2) + "/" + statusManager.ToString();
//return Encoding.encodeVL64(roomUID) + Encoding.encodeVL64(X) + Encoding.encodeVL64(Y) + H.ToString().Replace(",", ".") + Convert.ToChar(2) + Encoding.encodeVL64(Z1) + Encoding.encodeVL64(Z2) + "/" + statusManager.ToString();
}
}
}
}