private bool LookupCharacterPosition( RequestCache requestCache, out string result_code) { bool success; CharacterQueries.GetCharacterPosition( requestCache.DatabaseContext, m_character_id, out m_current_room_key, out m_current_character_position, out m_current_character_angle); // Make sure the character's current game id is valid m_game_id = m_current_room_key.game_id; if (m_game_id >= 0) { result_code = SuccessMessages.GENERAL_SUCCESS; success = true; } else { result_code = ErrorMessages.NOT_BOUND; success = false; } return(success); }
protected override bool ProcessRequestInternal( RequestCache requestCache, out string result_code) { bool success = true; result_code = SuccessMessages.GENERAL_SUCCESS; CharacterQueries.GetCharacterPosition( requestCache.DatabaseContext, m_character_id, out m_current_room_key, out m_current_character_position, out m_current_character_angle); success = LookupCharacterGameID(requestCache, m_character_id, out m_game_id, out result_code); if (success) { success = LookupWorld(requestCache, m_game_id, out m_world, out result_code); } if (success) { success = m_world.GetRoom(requestCache.DatabaseContext, m_current_room_key, out m_room, out result_code); } if (success) { success = VerifyNavMeshConnectivity(out result_code); } if (success) { success = UpdateCharacterPosition(requestCache, out result_code); } if (success) { PostCharacterMovedEvent(requestCache); success = ComputeAIResponse(requestCache, out result_code); } if (success) { success = PingCharacter(requestCache, m_character_id, out m_result_event_list, out result_code); } return(success); }
public string GetCharacterPosition( int character_id) { CharacterGetPositionResponse response = new CharacterGetPositionResponse(); if (RestUtilities.ValidateJSONRequestHasAuthenticatedSession(Session, out response.result) && RestUtilities.ValidateJSONRequestSessionOwnsCharacter(Session, character_id, out response.result)) { RoomKey roomKey = null; float response_x = 0.0f; float response_y = 0.0f; float response_z = 0.0f; float response_angle = 0.0f; if (!CharacterQueries.GetCharacterPosition( ApplicationConstants.CONNECTION_STRING, character_id, out roomKey, out response_x, out response_y, out response_z, out response_angle)) { response.x = (double)response_x; response.y = (double)response_y; response.z = (double)response_z; response.angle = (double)response_angle; response.game_id = -1; response.room_x = 0; response.room_y = 0; response.room_z = 0; response.angle = 0; response.result = ErrorMessages.DB_ERROR; } } return(JSONUtilities.SerializeJSONResponse <CharacterGetPositionResponse>(response)); }
override protected bool ProcessRequestInternal( RequestCache requestCache, out string result_code) { bool success = true; bool is_touching_energy_tank = false; result_code = SuccessMessages.GENERAL_SUCCESS; CharacterQueries.GetCharacterPosition( requestCache.DatabaseContext, m_character_id, out m_current_room_key, out m_current_character_position, out m_current_character_angle); success = LookupCharacterGameID(requestCache, m_character_id, out m_game_id, out result_code); if (success) { m_current_character_energy = CharacterQueries.GetCharacterEnergy(requestCache.DatabaseContext, m_character_id); success = LookupWorld(requestCache, m_game_id, out m_world, out result_code); } if (success) { success = m_world.GetRoom(requestCache.DatabaseContext, m_current_room_key, out m_room, out result_code); } if (success) { // Goes to verifyNavMeshConnectivity if the character needs to move to reach the energy tank, // Otherwise skips to updateEnergyTankState // (Or failure if the energy tank can't be hacked) success = VerifyEnergyTank(requestCache, out is_touching_energy_tank, out result_code); } if (success) { success = VerifyNavMeshConnectivity(out result_code); if (success) { UpdateCharacterState(requestCache, out result_code); } if (success) { PostCharacterMovedEvent(requestCache); } } if (success) { success = UpdateEnergyTankState(requestCache, out result_code); } if (success) { PostEnergyTankDrainedEvent(requestCache); success = ComputeAIResponse(requestCache, out result_code); } if (success) { success = PingCharacter(requestCache, m_character_id, out m_result_event_list, out result_code); } return(success); }