Beispiel #1
0
        public void SendUpdateCharacter(int characterId, PlayerSaveStateData state)
        {
            Console.WriteLine("send update char: characterId: {0}, state: {1}", characterId, state);
            ProfileUpdateCharacter packet = (ProfileUpdateCharacter)IntrepidSerialize.TakeFromPool(PacketType.ProfileUpdateCharacter);

            packet.characterId = characterId;
            packet.state       = state;
            socket.Send(packet);
        }
Beispiel #2
0
        private void ProcessProfileUpdateCharacter(RequestSetup requestInProcess)
        {
            ProfileUpdateCharacter request = requestInProcess.request as ProfileUpdateCharacter;
            bool result = accountQuerier.UpdateCharacterProfile(
                request.characterId,
                request.state);

            if (!result)
            {
                // If this fails there is little the game can do about it, so possibly not worth telling it
                Console.Error.WriteLine("Failed to update character: characterId: {0}, state: {1}",
                                        request.characterId, request.state);
            }
        }
Beispiel #3
0
    private void UpdateSaveStatePacket(UpdatePlayerSaveStatePacket packet)
    {
        // We pass these create / update requests to the profile server we're connected to
        if (saveState.characterId == PlayerSaveState.NO_CHARACTER_ID)
        {
            ProfileCreateCharacterRequest request = (ProfileCreateCharacterRequest)IntrepidSerialize.TakeFromPool(PacketType.ProfileCreateCharacterRequest);
            request.accountId     = saveState.accountId;
            request.productName   = "hungry hippos"; //TODO: configure this!
            request.characterName = saveState.name;  // TODO: Need to have some kind of create character packet where they can specify name
            request.state         = packet.state;
            Server.SendToProfileServer(request);
        }
        else
        {
            ProfileUpdateCharacter request = (ProfileUpdateCharacter)IntrepidSerialize.TakeFromPool(PacketType.ProfileUpdateCharacter);
            request.characterId = saveState.characterId;
            request.state       = packet.state;
            Server.SendToProfileServer(request);
        }

        // We assume the state will be created / saved
        saveState.state = packet.state;
    }