Module: Lich::Common::GUI::Authentication
- Defined in:
- documented/common/gui/authentication.rb
Class Method Summary collapse
-
.authenticate(account:, password:, character: nil, game_code: nil, legacy: false) ⇒ Boolean
Authenticates a user account with the provided credentials.
-
.create_entry_data(char_name:, game_code:, game_name:, user_id:, password:, frontend:, custom_launch: nil, custom_launch_dir: nil) ⇒ Hash
Creates a hash of entry data for a character.
-
.prepare_launch_data(auth_data, frontend, custom_launch = nil, custom_launch_dir = nil) ⇒ Array<String>
Prepares launch data for the specified frontend based on authentication data.
Class Method Details
.authenticate(account:, password:, character: nil, game_code: nil, legacy: false) ⇒ Boolean
Authenticates a user account with the provided credentials.
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'documented/common/gui/authentication.rb', line 19 def self.authenticate(account:, password:, character: nil, game_code: nil, legacy: false) if character && game_code EAccess.auth( account: account, password: password, character: character, game_code: game_code ) elsif legacy EAccess.auth( account: account, password: password, legacy: true ) else EAccess.auth( account: account, password: password ) end end |
.create_entry_data(char_name:, game_code:, game_name:, user_id:, password:, frontend:, custom_launch: nil, custom_launch_dir: nil) ⇒ Hash
Creates a hash of entry data for a character.
90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'documented/common/gui/authentication.rb', line 90 def self.create_entry_data(char_name:, game_code:, game_name:, user_id:, password:, frontend:, custom_launch: nil, custom_launch_dir: nil) { char_name: char_name, game_code: game_code, game_name: game_name, user_id: user_id, password: password, frontend: frontend, custom_launch: custom_launch, custom_launch_dir: custom_launch_dir } end |
.prepare_launch_data(auth_data, frontend, custom_launch = nil, custom_launch_dir = nil) ⇒ Array<String>
Prepares launch data for the specified frontend based on authentication data.
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'documented/common/gui/authentication.rb', line 49 def self.prepare_launch_data(auth_data, frontend, custom_launch = nil, custom_launch_dir = nil) launch_data = auth_data.map { |k, v| "#{k.upcase}=#{v}" } # Modify launch data based on frontend case frontend.to_s.downcase when 'wizard' launch_data.collect! { |line| line.sub(/GAMEFILE=.+/, 'GAMEFILE=WIZARD.EXE') .sub(/GAME=.+/, 'GAME=WIZ') .sub(/FULLGAMENAME=.+/, 'FULLGAMENAME=Wizard Front End') } when 'avalon' launch_data.collect! { |line| line.sub(/GAME=.+/, 'GAME=AVALON') } when 'suks' launch_data.collect! { |line| line.sub(/GAMEFILE=.+/, 'GAMEFILE=WIZARD.EXE') .sub(/GAME=.+/, 'GAME=SUKS') } end # Add custom launch information if provided if custom_launch launch_data.push "CUSTOMLAUNCH=#{custom_launch}" launch_data.push "CUSTOMLAUNCHDIR=#{custom_launch_dir}" if custom_launch_dir end launch_data end |