Beispiel #1
0
        public void WriteAccountData(AccountDataMasks mask, ref WorldClass session)
        {
            PacketWriter accountInitialized = new PacketWriter(LegacyMessage.AccountDataInitialized);

            accountInitialized.WriteUnixTime();
            accountInitialized.WriteUInt8(0);
            accountInitialized.WriteUInt32((uint)mask);

            for (int i = 0; i <= 8; ++i)
            {
                if (((int)mask & (1 << i)) != 0)
                {
                    if (i == 1 && mask == AccountDataMasks.GlobalCacheMask)
                    {
                        accountInitialized.WriteUnixTime();
                    }
                    else
                    {
                        accountInitialized.WriteUInt32(0);
                    }
                }
            }

            session.Send(accountInitialized);
        }
Beispiel #2
0
        /*
         * void WorldSession::LoadGlobalAccountData()
         * {
         * PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_ACCOUNT_DATA);
         * stmt->setUInt32(0, GetAccountId());
         * LoadAccountData(CharacterDatabase.Query(stmt), GLOBAL_CACHE_MASK);
         * }
         *
         * void WorldSession::LoadAccountData(PreparedQueryResult result, uint32 mask)
         * {
         * for (uint32 i = 0; i < NUM_ACCOUNT_DATA_TYPES; ++i)
         * if (mask & (1 << i))
         *  m_accountData[i] = AccountData();
         *
         * if (!result)
         * return;
         *
         * do
         * {
         * Field* fields = result->Fetch();
         * uint32 type = fields[0].GetUInt8();
         * if (type >= NUM_ACCOUNT_DATA_TYPES)
         * {
         *  sLog->outError(LOG_FILTER_GENERAL, "Table `%s` have invalid account data type (%u), ignore.",
         *      mask == GLOBAL_CACHE_MASK ? "account_data" : "character_account_data", type);
         *  continue;
         * }
         *
         * if ((mask & (1 << type)) == 0)
         * {
         *  sLog->outError(LOG_FILTER_GENERAL, "Table `%s` have non appropriate for table  account data type (%u), ignore.",
         *      mask == GLOBAL_CACHE_MASK ? "account_data" : "character_account_data", type);
         *  continue;
         * }
         *
         * m_accountData[type].Time = time_t(fields[1].GetUInt32());
         * m_accountData[type].Data = fields[2].GetString();
         * }
         * while (result->NextRow());
         * }
         *
         * void WorldSession::SetAccountData(AccountDataType type, time_t tm, std::string data)
         * {
         * uint32 id = 0;
         * uint32 index = 0;
         * if ((1 << type) & GLOBAL_CACHE_MASK)
         * {
         * id = GetAccountId();
         * index = CHAR_REP_ACCOUNT_DATA;
         * }
         * else
         * {
         * // _player can be NULL and packet received after logout but m_GUID still store correct guid
         * if (!m_GUIDLow)
         *  return;
         *
         * id = m_GUIDLow;
         * index = CHAR_REP_PLAYER_ACCOUNT_DATA;
         * }
         *
         * PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(index);
         * stmt->setUInt32(0, id);
         * stmt->setUInt8 (1, type);
         * stmt->setUInt32(2, uint32(tm));
         * stmt->setString(3, data);
         * CharacterDatabase.Execute(stmt);
         *
         * m_accountData[type].Time = tm;
         * m_accountData[type].Data = data;
         * }
         */
        public void SendAccountDataTimes(AccountDataMasks mask)
        {
            PacketWriter data = new PacketWriter(Opcodes.SMSG_AccountDataTimes);

            data.WriteUnixTime();
            data.WriteUInt8(0);
            data.WriteUInt32((uint)mask);

            for (int i = 0; i <= (int)AccountDataTypes.NumAccountDataTypes; ++i)
            {
                if (((int)mask & (1 << i)) != 0)
                {
                    if (i == 1 && mask == AccountDataMasks.GlobalCacheMask)
                    {
                        data.WriteUnixTime();
                    }
                    else
                    {
                        data.WriteUInt32(0);
                    }
                }
            }

            Send(data);
        }
Beispiel #3
0
        public void WriteAccountDataTimes(AccountDataMasks mask, ref WorldClass session)
        {
            PacketWriter accountDataTimes = new PacketWriter(ServerMessage.AccountDataTimes);

            for (int i = 0; i < 8; i++)
            {
                accountDataTimes.WriteUInt32(0);
            }

            accountDataTimes.WriteUInt32((uint)mask);
            accountDataTimes.WriteUnixTime();
            accountDataTimes.WriteUInt8(0);

            session.Send(ref accountDataTimes);
        }