Exemplo n.º 1
0
        private TypedFlags <eBindGameAction> LookupCharacterData(
            RequestCache requestCache)
        {
            TypedFlags <eBindGameAction> actionFlags = new TypedFlags <eBindGameAction>();

            actionFlags.Clear();

            // Get the current state of the character before moving them to another game
            m_character_state = CharacterQueries.GetFullCharacterState(requestCache.DatabaseContext, m_character_id);

            // Get the previous game this character was a part of, if any
            m_previous_game_id = m_character_state.game_id;

            // Only bother doing anything if the character isn't already bound to this game
            if (m_previous_game_id != m_game_id)
            {
                if (m_previous_game_id != -1)
                {
                    actionFlags.Set(eBindGameAction.leaveGame, true);
                }

                actionFlags.Set(eBindGameAction.joinGame, true);
            }

            return(actionFlags);
        }
        private bool LookupCharacterState(out string result_code)
        {
            bool success =
                CharacterQueries.GetFullCharacterState(
                    this.GetCurrentConnectionString(),
                    m_character_id,
                    out m_character_state,
                    out result_code);

            result_code = success ? SuccessMessages.GENERAL_SUCCESS : ErrorMessages.DB_ERROR + "(Unable to retrieve character state)";

            return(success);
        }
Exemplo n.º 3
0
        public string GetCharacterFullState(int character_id)
        {
            CharacterStateResponse response = new CharacterStateResponse();

            if (RestUtilities.ValidateJSONRequestHasAuthenticatedSession(Session, out response.result))
            {
                if (CharacterQueries.GetFullCharacterState(
                        ApplicationConstants.CONNECTION_STRING,
                        character_id,
                        out response.character_state,
                        out response.result))
                {
                    response.result = SuccessMessages.GENERAL_SUCCESS;
                }
            }

            return(JSONUtilities.SerializeJSONResponse <CharacterStateResponse>(response));
        }