using System; using DFEngine.Content.Game; using DFEngine.Content.Items; using DFEngine.Content.Tutorial; using DFEngine.Network; using DFEngine.Server; namespace DFEngine.Content.GameObjects { /// /// Class that contains avatar information. This class is not used /// in-game, but just stands to display a instance. /// public class Avatar { public NetworkConnection Connection { get; set; } public Zone Zone { get; set; } /// /// The character's unique ID. /// public int CharNo { get; set; } /// /// The time that the character was deleted. /// public DateTime DeleteTime { get; set; } /// /// Represents the items that the character current has equipped. /// public Equipment Equipment { get; set; } /// /// Returns true if the character was deleted. /// public bool IsDeleted { get; set; } /// /// The character's KQ start date. /// public DateTime KQDate { get; set; } /// /// The handle of the character's current KQ instance. /// public int KQHandle { get; set; } /// /// The character's current KQ map index name. /// public string KQMapIndx { get; set; } /// /// The character's position in their KQ instance. /// public Vector2 KQPosition { get; set; } /// /// The character's level. /// public byte Level { get; set; } /// /// The index name of the character's map. /// public string MapIndx { get; set; } /// /// The character's name. /// public string Name { get; set; } /// /// The shape of the character. /// public CharacterShape Shape { get; set; } /// /// The character's slot. /// public byte Slot { get; set; } /// /// The state of the character's tutorial instance. /// public TutorialState TutorialState { get; set; } /// /// The step of the character's tutorial instance. /// public byte TutorialStep { get; set; } public byte[] WindowPosData { get; set; } public byte[] ShortcutData { get; set; } public byte[] ShortcutSizeData { get; set; } public byte[] GameOptionData { get; set; } public byte[] KeyMapData { get; set; } public bool HasLoggedIn { get; set; } /// /// Creates a new instance of the class. /// public Avatar() { Shape = new CharacterShape(); Equipment = new Equipment(); } public void Login(NetworkConnection connection, Zone zone) { if (zone == null) { new PROTO_NC_CHAR_LOGINFAIL_ACK((ushort) CharLoginError.MAP_UNDER_MAINT).Send(connection); return; } Connection = connection; Zone = zone; new PROTO_NC_CHAR_LOGIN_ACK(Zone).Send(connection); new PROTO_NC_CHAR_OPTION_IMPROVE_GET_SHORTCUTDATA_CMD(ShortcutSizeData).Send(connection); new PROTO_NC_CHAR_OPTION_IMPROVE_GET_KEYMAP_CMD(KeyMapData).Send(connection); new PROTO_NC_CHAR_OPTION_IMPROVE_GET_GAMEOPTION_CMD(GameOptionData).Send(connection); } public void FinalizeLogin(string mapIndx, Zone zone) { MapIndx = mapIndx; Zone = zone; if (!HasLoggedIn) { HasLoggedIn = true; new PROTO_NC_MAP_LINKEND_CLIENT_CMD().Send(Connection); } } } }