/trunk/Demo.Mmose.GameServer/W.O.W Server/WOW Server/Common/Database/Model/Account.cs

# · C# · 334 lines · 191 code · 24 blank · 119 comment · 0 complexity · 257cf36d8b06e396086f8385c4c14e63 MD5 · raw file

  1. #region zh-CHS 版权所有 (C) 2006 - 2006 DemoSoft Corporation. 保留所有权利 | en Copyright (C) 2006 - 2006 DemoSoft Corporation. All Rights Reserved.
  2. // COPYRIGHT NOTES
  3. // ---------------
  4. //
  5. // This file is a part of the G.O.S.E(Game Online Server Engine) for .NET.
  6. //
  7. // 2007-2008 Demo Software, All Rights Reserved.
  8. //
  9. // This source code can only be used under the terms and conditions outlined
  10. // in the accompanying license agreement.
  11. //
  12. //
  13. // First Version : by H.Q.Cai - mailto:caihuanqing@hotmail.com
  14. #region zh-CHS 包含名字空间 | en Include namespace
  15. using System;
  16. using DevExpress.Xpo;
  17. #endregion
  18. namespace Demo.Wow.Database.Ver1a
  19. {
  20. /// <summary>
  21. /// 游戏的账号信息
  22. /// </summary>
  23. public class Account : XPObject
  24. {
  25. #region zh-CHS 构造和初始化和清理 | en Constructors and Initializers and Dispose
  26. /// <summary>
  27. ///
  28. /// </summary>
  29. public Account() { }
  30. /// <summary>
  31. ///
  32. /// </summary>
  33. /// <param name="session"></param>
  34. public Account( Session session ) : base( session ) { }
  35. #endregion
  36. #region zh-CHS 属性 | en Properties
  37. #region zh-CHS 私有成员变量 | en Private Member Variables
  38. /// <summary>
  39. /// 游戏账号的名称
  40. /// </summary>
  41. private string m_AccountName;
  42. #endregion
  43. /// <summary>
  44. /// 游戏账号的名称
  45. /// </summary>
  46. [Size( 64 )]
  47. [Indexed( Unique = true )]
  48. public string AccountName
  49. {
  50. get { return m_AccountName; }
  51. set { SetPropertyValue<string>( "AccountName", ref m_AccountName, value ); }
  52. }
  53. #region zh-CHS 私有成员变量 | en Private Member Variables
  54. /// <summary>
  55. /// 游戏账号的密码
  56. /// </summary>
  57. private string m_Password;
  58. #endregion
  59. /// <summary>
  60. /// 游戏账号的密码
  61. /// </summary>
  62. [Indexed]
  63. [Size( 32 )]
  64. public string Password
  65. {
  66. get { return m_Password; }
  67. set { SetPropertyValue<string>( "Password", ref m_Password, value ); }
  68. }
  69. #region zh-CHS 私有成员变量 | en Private Member Variables
  70. /// <summary>
  71. /// 游戏账号中的权限等级
  72. /// </summary>
  73. private byte m_GMLevel;
  74. #endregion
  75. /// <summary>
  76. /// 游戏账号中的权限等级
  77. /// </summary>
  78. public byte GMLevel
  79. {
  80. get { return m_GMLevel; }
  81. set { SetPropertyValue<byte>( "GMLevel", ref m_GMLevel, value ); }
  82. }
  83. #region zh-CHS 私有成员变量 | en Private Member Variables
  84. /// <summary>
  85. /// 游戏账号是否已登陆锁定不允许再次登陆或冻结
  86. /// </summary>
  87. private bool m_IsLocked;
  88. #endregion
  89. /// <summary>
  90. /// 游戏账号是否已登陆锁定不允许再次登陆或冻结
  91. /// </summary>
  92. public bool IsLocked
  93. {
  94. get { return m_IsLocked; }
  95. set { SetPropertyValue<bool>( "IsLocked", ref m_IsLocked, value ); }
  96. }
  97. #region zh-CHS 私有成员变量 | en Private Member Variables
  98. /// <summary>
  99. /// 游戏账号是否已封停
  100. /// </summary>
  101. private bool m_IsBanned;
  102. #endregion
  103. /// <summary>
  104. /// 游戏账号是否已封停
  105. /// </summary>
  106. public bool IsBanned
  107. {
  108. get { return m_IsBanned; }
  109. set { SetPropertyValue<bool>( "IsBanned", ref m_IsBanned, value ); }
  110. }
  111. #region zh-CHS 私有成员变量 | en Private Member Variables
  112. /// <summary>
  113. /// 游戏账号创建的日期
  114. /// </summary>
  115. private DateTime m_CreateDate;
  116. #endregion
  117. /// <summary>
  118. /// 游戏账号创建的日期
  119. /// </summary>
  120. public DateTime CreateDate
  121. {
  122. get { return m_CreateDate; }
  123. set { SetPropertyValue<DateTime>( "CreateDate", ref m_CreateDate, value ); }
  124. }
  125. /// <summary>
  126. /// 游戏账号创建者的电子邮件
  127. /// </summary>
  128. [Delayed]
  129. [Size( 50 )]
  130. [NullValue( "" )]
  131. public string Email
  132. {
  133. get { return GetDelayedPropertyValue<string>( "Email" ); }
  134. set { SetDelayedPropertyValue<string>( "Email", value ); }
  135. }
  136. /// <summary>
  137. /// 游戏账号创建者的电子邮件是否已激活
  138. /// </summary>
  139. [Delayed]
  140. [NullValue( false )]
  141. public bool ActiveEmail
  142. {
  143. get { return GetDelayedPropertyValue<bool>( "ActiveEmail" ); }
  144. set { SetDelayedPropertyValue<bool>( "ActiveEmail", value ); }
  145. }
  146. /// <summary>
  147. /// 用于游戏账号创建者的电子邮件激活检验的(KEY)
  148. /// </summary>
  149. [Size( 32 )]
  150. [NullValue( "" )]
  151. [Delayed]
  152. public string ActiveEmailKey
  153. {
  154. get { return GetDelayedPropertyValue<string>( "ActiveEmailKey" ); }
  155. set { SetPropertyValue<string>( "ActiveEmailKey", value ); }
  156. }
  157. /// <summary>
  158. /// 游戏账号检验的正式(CD-KEY)
  159. /// </summary>
  160. [Delayed]
  161. [Size( 32 )]
  162. [NullValue( "" )]
  163. public string SessionKey
  164. {
  165. get { return GetDelayedPropertyValue<string>( "SessionKey" ); }
  166. set { SetDelayedPropertyValue<string>( "SessionKey", value ); }
  167. }
  168. #region zh-CHS 私有成员变量 | en Private Member Variables
  169. /// <summary>
  170. /// 游戏账号登陆失败的次数
  171. /// </summary>
  172. private int m_FailedLogins;
  173. #endregion
  174. /// <summary>
  175. /// 游戏账号登陆失败的次数
  176. /// </summary>
  177. [NullValue( 0 )]
  178. public int FailedLogins
  179. {
  180. get { return m_FailedLogins; }
  181. set { SetPropertyValue<int>( "FailedLogins", ref m_FailedLogins, value ); }
  182. }
  183. #region zh-CHS 私有成员变量 | en Private Member Variables
  184. /// <summary>
  185. /// 游戏者最后登陆的(IP)地址(IPv4/IPv6)
  186. /// </summary>
  187. private string m_LastIP;
  188. #endregion
  189. /// <summary>
  190. /// 游戏者最后登陆的(IP)地址(IPv4/IPv6)
  191. /// </summary>
  192. [Size( 24 )]
  193. [NullValue( "" )]
  194. public string LastIP
  195. {
  196. get { return m_LastIP; }
  197. set { SetPropertyValue<string>( "LastIP", ref m_LastIP, value ); }
  198. }
  199. #region zh-CHS 私有成员变量 | en Private Member Variables
  200. /// <summary>
  201. /// 游戏者最后登陆的时间
  202. /// </summary>
  203. private DateTime m_LastLoginDate;
  204. #endregion
  205. /// <summary>
  206. /// 游戏者最后登陆的时间
  207. /// </summary>
  208. [NullValue( null )]
  209. public DateTime LastLoginDate
  210. {
  211. get { return m_LastLoginDate; }
  212. set { SetPropertyValue<DateTime>( "LastLoginDate", ref m_LastLoginDate, value ); }
  213. }
  214. #region zh-CHS 私有成员变量 | en Private Member Variables
  215. /// <summary>
  216. /// 游戏最后登陆的游戏服务所在的区
  217. /// </summary>
  218. private long m_LastServerGuid;
  219. #endregion
  220. /// <summary>
  221. /// 游戏最后登陆的游戏服务所在的区
  222. /// </summary>
  223. [NullValue( 0 )]
  224. public long LastServerGuid
  225. {
  226. get { return m_LastServerGuid; }
  227. set { SetPropertyValue<long>( "LastServerGuid", ref m_LastServerGuid, value ); }
  228. }
  229. #region zh-CHS 私有成员变量 | en Private Member Variables
  230. /// <summary>
  231. /// 游戏最后使用的游戏人物
  232. /// </summary>
  233. private CharacterBase m_LastCharacter;
  234. #endregion
  235. /// <summary>
  236. /// 游戏最后使用的游戏人物
  237. /// </summary>
  238. [NullValue( null )]
  239. public CharacterBase LastCharacter
  240. {
  241. get { return m_LastCharacter; }
  242. set { SetPropertyValue<CharacterBase>( "LastCharacter", ref m_LastCharacter, value ); }
  243. }
  244. /// <summary>
  245. /// 全部的游戏人物
  246. /// </summary>
  247. [Association( "Account-CharacterBase" )]
  248. public XPCollection<CharacterBase> Characters
  249. {
  250. get { return GetCollection<CharacterBase>( "Characters" ); }
  251. }
  252. #region zh-CHS 私有成员变量 | en Private Member Variables
  253. /// <summary>
  254. /// 是否是资料片(TBC)的拥有者
  255. /// </summary>
  256. private bool m_IsTBC;
  257. #endregion
  258. /// <summary>
  259. /// 是否是资料片(TBC)的拥有者
  260. /// </summary>
  261. public bool IsTBC
  262. {
  263. get { return m_IsTBC; }
  264. set { SetPropertyValue<bool>( "IsTBC", ref m_IsTBC, value ); }
  265. }
  266. #region zh-CHS 私有成员变量 | en Private Member Variables
  267. /// <summary>
  268. /// 是否是资料片(WLK)的拥有者
  269. /// </summary>
  270. private bool m_IsWLK;
  271. #endregion
  272. /// <summary>
  273. /// 是否是资料片(WLK)的拥有者
  274. /// </summary>
  275. public bool IsWLK
  276. {
  277. get { return m_IsWLK; }
  278. set { SetPropertyValue<bool>( "IsWLK", ref m_IsWLK, value ); }
  279. }
  280. #endregion
  281. #region zh-CHS 方法 | en Method
  282. /// <summary>
  283. /// 初始化
  284. /// </summary>
  285. public override void AfterConstruction()
  286. {
  287. // 防止违反索引唯一的规者
  288. AccountName = Guid.NewGuid().ToString();
  289. Password = string.Empty;
  290. GMLevel = 100;
  291. IsLocked = false;
  292. IsBanned = false;
  293. CreateDate = DateTime.Now;
  294. Email = "null@null.com";
  295. ActiveEmail = false;
  296. ActiveEmailKey = string.Empty;
  297. SessionKey = string.Empty;
  298. FailedLogins = 0;
  299. LastIP = "127.0.0.1";
  300. LastLoginDate = DateTime.Now;
  301. LastServerGuid = 0;
  302. LastCharacter = null;
  303. IsTBC = true; // 默认支持资料片
  304. IsWLK = true;
  305. base.AfterConstruction();
  306. }
  307. #endregion
  308. }
  309. }
  310. #endregion