示例#1
0
        /// <summary>
        /// Send the unix timestamps of each AccountDataType to the client.
        /// </summary>
        /// <param name="client"></param>
        public static void SendAccountDataTimes(IRealmClient client, CacheMask mask)
        {
            using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_ACCOUNT_DATA_TIMES))
            {
                var now = Utility.GetEpochTimeFromDT(DateTime.Now);
                packet.Write(now);                      // current server time
                packet.Write((byte)1);                  // unknown
                packet.Write((uint)mask);

                if (client.Account != null &&
                    client.Account.AccountData != null &&
                    client.Account.AccountData.TimeStamps != null)
                {
                    for (var i = 0; i < 8; i++)
                    {
                        if ((((uint)mask) & (1 << i)) != 0)
                        {
                            packet.Write(client.Account.AccountData.TimeStamps[i]);
                        }
                    }
                }
                else
                {
                    LogManager.GetCurrentClassLogger().Debug("Client was not properly logged in when sending ACCOUNT_DATA_TIMES: " + client);
                }

                client.Send(packet);
            }
        }
示例#2
0
		/// <summary>
		/// Send the unix timestamps of each AccountDataType to the client.
		/// </summary>
		/// <param name="client"></param>
		public static void SendAccountDataTimes(IRealmClient client, CacheMask mask)
		{
			using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_ACCOUNT_DATA_TIMES))
			{
				var now = Utility.GetEpochTimeFromDT(DateTime.Now);
				packet.Write(now);		// current server time
				packet.Write((byte)1);	// unknown
				packet.Write((uint)mask);

				if (client.Account != null &&
					client.Account.AccountData != null &&
					client.Account.AccountData.TimeStamps != null)
				{
					for (var i = 0; i < 8; i++)
					{
						if ((((uint)mask) & (1 << i)) != 0)
						{
							packet.Write(client.Account.AccountData.TimeStamps[i]);
						}
					}
				}
				else
				{
					LogManager.GetCurrentClassLogger().Debug("Client was not properly logged in when sending ACCOUNT_DATA_TIMES: " + client);
				}

				client.Send(packet);
			}
		}