Module: Lich::Main::ArgvOptions::GameConnection
- Defined in:
- documented/main/argv_options.rb
Overview
Module for handling game connection options This module processes game connection parameters from command line arguments.
Class Method Summary collapse
-
.determine_frontend ⇒ String
Determines the frontend type based on command line arguments.
-
.execute(processed_options) ⇒ Hash
Executes the game connection handling based on parsed options.
- .handle_dragonrealms_connection(processed_options) ⇒ Object
-
.handle_explicit_game_connection(arg, processed_options) ⇒ void
Handles explicit game connection parameters from command line arguments.
- .handle_fallen_connection(processed_options) ⇒ Object
- .handle_gemstone_connection(processed_options) ⇒ Object
- .handle_shattered_connection(processed_options) ⇒ Object
Class Method Details
.determine_frontend ⇒ String
Determines the frontend type based on command line arguments.
461 462 463 464 465 466 467 468 469 470 471 472 473 |
# File 'documented/main/argv_options.rb', line 461 def self.determine_frontend if ARGV.any? { |a| a == '-s' || a == '--stormfront' } 'stormfront' elsif ARGV.any? { |a| a == '-w' || a == '--wizard' } 'wizard' elsif ARGV.any? { |a| a == '--avalon' } 'avalon' elsif ARGV.any? { |a| a == '--frostbite' } 'frostbite' else 'unknown' end end |
.execute(processed_options) ⇒ Hash
Executes the game connection handling based on parsed options.
335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 |
# File 'documented/main/argv_options.rb', line 335 def self.execute() if (arg = ARGV.find { |a| a == '-g' || a == '--game' }) handle_explicit_game_connection(arg, ) elsif ARGV.include?('--shattered') handle_shattered_connection() elsif ARGV.include?('--fallen') handle_fallen_connection() elsif ARGV.include?('--gemstone') handle_gemstone_connection() elsif ARGV.include?('--dragonrealms') handle_dragonrealms_connection() else [:game_host] = nil [:game_port] = nil Lich.log 'info: no force-mode info given' end end |
.handle_dragonrealms_connection(processed_options) ⇒ Object
425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 |
# File 'documented/main/argv_options.rb', line 425 def self.handle_dragonrealms_connection() if ARGV.include?('--platinum') $platinum = true if ARGV.any? { |a| a == '-s' || a == '--stormfront' } [:game_host] = 'dr.simutronics.net' [:game_port] = 11124 $frontend = 'stormfront' elsif ARGV.grep(/--genie/).any? [:game_host] = 'dr.simutronics.net' [:game_port] = 11124 $frontend = 'genie' else [:game_host] = 'dr.simutronics.net' [:game_port] = 11124 $frontend = ARGV.any? { |a| a == '--avalon' } ? 'avalon' : ARGV.any? { |a| a == '--frostbite' } ? 'frostbite' : 'wizard' end else $platinum = false if ARGV.any? { |a| a == '-s' || a == '--stormfront' } [:game_host] = 'dr.simutronics.net' [:game_port] = ARGV.include?('--test') ? 11624 : 11024 $frontend = 'stormfront' elsif ARGV.grep(/--genie/).any? [:game_host] = 'dr.simutronics.net' [:game_port] = ARGV.include?('--test') ? 11624 : 11024 $frontend = 'genie' else [:game_host] = 'dr.simutronics.net' [:game_port] = ARGV.include?('--test') ? 11624 : 11024 $frontend = ARGV.any? { |a| a == '--avalon' } ? 'avalon' : ARGV.any? { |a| a == '--frostbite' } ? 'frostbite' : 'wizard' end end end |
.handle_explicit_game_connection(arg, processed_options) ⇒ void
Note:
This method modifies the processed_options hash.
This method returns an undefined value.
Handles explicit game connection parameters from command line arguments.
359 360 361 362 363 364 365 366 367 |
# File 'documented/main/argv_options.rb', line 359 def self.handle_explicit_game_connection(arg, ) [:game_host], [:game_port] = ARGV[ARGV.index(arg) + 1].split(':') [:game_port] = [:game_port].to_i $frontend = determine_frontend # Initialize frontend from parent process unless using detachable client unless ARGV.any? { |a| a =~ /^--detachable-client/ } Lich::Common::Frontend.init_from_parent(Process.ppid) end end |
.handle_fallen_connection(processed_options) ⇒ Object
408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 |
# File 'documented/main/argv_options.rb', line 408 def self.handle_fallen_connection() $platinum = false if ARGV.any? { |a| a == '-s' || a == '--stormfront' } [:game_host] = 'dr.simutronics.net' [:game_port] = 11324 $frontend = 'stormfront' elsif ARGV.grep(/--genie/).any? [:game_host] = 'dr.simutronics.net' [:game_port] = 11324 $frontend = 'genie' else [:game_host] = 'dr.simutronics.net' [:game_port] = 11324 $frontend = ARGV.any? { |a| a == '--avalon' } ? 'avalon' : ARGV.any? { |a| a == '--frostbite' } ? 'frostbite' : 'wizard' end end |
.handle_gemstone_connection(processed_options) ⇒ Object
369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 |
# File 'documented/main/argv_options.rb', line 369 def self.handle_gemstone_connection() if ARGV.include?('--platinum') $platinum = true if ARGV.any? { |a| a == '-s' || a == '--stormfront' } [:game_host] = 'storm.gs4.game.play.net' [:game_port] = 10124 $frontend = 'stormfront' else [:game_host] = 'storm.gs4.game.play.net' [:game_port] = 10124 $frontend = ARGV.any? { |a| a == '--avalon' } ? 'avalon' : 'wizard' end else $platinum = false if ARGV.any? { |a| a == '-s' || a == '--stormfront' } [:game_host] = 'storm.gs4.game.play.net' [:game_port] = ARGV.include?('--test') ? 10624 : 10024 $frontend = 'stormfront' else [:game_host] = 'storm.gs4.game.play.net' [:game_port] = ARGV.include?('--test') ? 10624 : 10024 $frontend = ARGV.any? { |a| a == '--avalon' } ? 'avalon' : 'wizard' end end end |
.handle_shattered_connection(processed_options) ⇒ Object
395 396 397 398 399 400 401 402 403 404 405 406 |
# File 'documented/main/argv_options.rb', line 395 def self.handle_shattered_connection() $platinum = false if ARGV.any? { |a| a == '-s' || a == '--stormfront' } [:game_host] = 'storm.gs4.game.play.net' [:game_port] = 10324 $frontend = 'stormfront' else [:game_host] = 'storm.gs4.game.play.net' [:game_port] = 10324 $frontend = ARGV.any? { |a| a == '--avalon' } ? 'avalon' : 'wizard' end end |