Module: Lich::Main::ArgvOptions::GameConnection
- Defined in:
- documented/main/argv_options.rb
Overview
Handle game connection configuration
Class Method Summary collapse
-
.determine_frontend ⇒ String
private
Inspects ARGV to select the active UI frontend (-s, -w, --avalon, etc.).
-
.execute(processed_options) ⇒ Hash
private
Routes ARGV flags to the appropriate game server connection handler and sets game_host, game_port, and $frontend accordingly.
-
.handle_dragonrealms_connection(processed_options) ⇒ void
private
Sets game server and frontend for DragonRealms (premium or free play).
-
.handle_explicit_game_connection(arg, processed_options) ⇒ void
private
Handles explicit -g/--game mode: parses host:port and sets frontend from ARGV.
-
.handle_fallen_connection(processed_options) ⇒ void
private
Sets game server and frontend for DragonRealms: Fallen (event realm).
-
.handle_gemstone_connection(processed_options) ⇒ void
private
Sets game server and frontend for GemStone IV (premium or free play).
-
.handle_shattered_connection(processed_options) ⇒ void
private
Sets game server and frontend for GemStone IV: Shattered (event realm).
Class Method Details
.determine_frontend ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Inspects ARGV to select the active UI frontend (-s, -w, --avalon, etc.).
Searches ARGV for frontend flags in order: -s/--stormfront, -w/--wizard, --avalon, --frostbite, --saga. Returns the first match found, or 'unknown' if none are present.
523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 |
# File 'documented/main/argv_options.rb', line 523 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' elsif ARGV.any? { |a| a == '--saga' } 'saga' else 'unknown' end end |
.execute(processed_options) ⇒ Hash
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Called after side effects; modifies global game connection state
Routes ARGV flags to the appropriate game server connection handler and sets game_host, game_port, and $frontend accordingly.
Detects force-mode flags (-g/--game, --shattered, --fallen, or authentication provider flags) and calls the corresponding handler. If no game mode is detected, sets game_host and game_port to nil. Also initializes Common::Frontend from the parent process for normal connections (not detachable-client mode).
338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 |
# File 'documented/main/argv_options.rb', line 338 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 Lich::Common::Authentication::LoginHelpers.gemstone_flag?(ARGV) handle_gemstone_connection() elsif Lich::Common::Authentication::LoginHelpers.dragonrealms_flag?(ARGV) 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) ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Sets global $platinum and $frontend
This method returns an undefined value.
Sets game server and frontend for DragonRealms (premium or free play).
Selects the appropriate server port based on --platinum flag and --test flag. Determines frontend from -s/--stormfront, --genie, --avalon, --frostbite, --saga, or defaults to wizard. Stormfront is preferred if specified; Genie is checked next; then the remaining flags in order.
480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 |
# File 'documented/main/argv_options.rb', line 480 def self.handle_dragonrealms_connection() if ARGV.include?('--platinum') $platinum = true if ARGV.any? { |a| a =~ /^-s$/i || a =~ /^--stormfront$/i } [:game_host] = 'dr.simutronics.net' [:game_port] = 11124 $frontend = 'stormfront' elsif ARGV.grep(/--genie/i).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$/i } ? 'avalon' : ARGV.any? { |a| a =~ /^--frostbite$/i } ? 'frostbite' : ARGV.any? { |a| a =~ /^--saga$/i } ? 'saga' : 'wizard' end else $platinum = false if ARGV.any? { |a| a =~ /^-s$/i || a =~ /^--stormfront$/i } [:game_host] = 'dr.simutronics.net' [:game_port] = ARGV.include?('--test') ? 11624 : 11024 $frontend = 'stormfront' elsif ARGV.grep(/--genie/i).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$/i } ? 'avalon' : ARGV.any? { |a| a =~ /^--frostbite$/i } ? 'frostbite' : ARGV.any? { |a| a =~ /^--saga$/i } ? 'saga' : 'wizard' end end end |
.handle_explicit_game_connection(arg, processed_options) ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
Handles explicit -g/--game mode: parses host:port and sets frontend from ARGV.
Extracts the game server address from ARGV immediately following -g or --game, splits on ':', converts port to Integer, and calls determine_frontend to select the UI. Initializes Common::Frontend from the parent process unless --detachable-client is present.
369 370 371 372 373 374 375 376 377 |
# File 'documented/main/argv_options.rb', line 369 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/i } Lich::Common::Frontend.init_from_parent(Process.ppid) end end |
.handle_fallen_connection(processed_options) ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Sets global $frontend and $platinum to false
This method returns an undefined value.
Sets game server and frontend for DragonRealms: Fallen (event realm).
Connects to dr.simutronics.net port 11324. Determines frontend from -s/--stormfront, --genie, --avalon, --frostbite, --saga, or defaults to wizard. Genie is preferred if specified; Stormfront is checked next.
451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 |
# File 'documented/main/argv_options.rb', line 451 def self.handle_fallen_connection() $platinum = false if ARGV.any? { |a| a =~ /^-s$/i || a =~ /^--stormfront$/i } [:game_host] = 'dr.simutronics.net' [:game_port] = 11324 $frontend = 'stormfront' elsif ARGV.grep(/--genie/i).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$/i } ? 'avalon' : ARGV.any? { |a| a =~ /^--frostbite$/i } ? 'frostbite' : ARGV.any? { |a| a =~ /^--saga$/i } ? 'saga' : 'wizard' end end |
.handle_gemstone_connection(processed_options) ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Sets global $platinum and $frontend
This method returns an undefined value.
Sets game server and frontend for GemStone IV (premium or free play).
Selects the appropriate server port based on --platinum flag and --test flag. Determines frontend from -s/--stormfront, --avalon, --frostbite, --saga, or defaults to wizard. Stormfront is preferred if specified; otherwise frontend flags are checked in the order listed.
391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 |
# File 'documented/main/argv_options.rb', line 391 def self.handle_gemstone_connection() if ARGV.include?('--platinum') $platinum = true if ARGV.any? { |a| a =~ /^-s$/i || a =~ /^--stormfront$/i } [: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$/i } ? 'avalon' : ARGV.any? { |a| a =~ /^--frostbite$/i } ? 'frostbite' : ARGV.any? { |a| a =~ /^--saga$/i } ? 'saga' : 'wizard' end else $platinum = false if ARGV.any? { |a| a =~ /^-s$/i || a =~ /^--stormfront$/i } [: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$/i } ? 'avalon' : ARGV.any? { |a| a =~ /^--frostbite$/i } ? 'frostbite' : ARGV.any? { |a| a =~ /^--saga$/i } ? 'saga' : 'wizard' end end end |
.handle_shattered_connection(processed_options) ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Sets global $frontend and $platinum to false
This method returns an undefined value.
Sets game server and frontend for GemStone IV: Shattered (event realm).
Connects to storm.gs4.game.play.net port 10324. Determines frontend from -s/--stormfront, --avalon, --frostbite, --saga, or defaults to wizard.
427 428 429 430 431 432 433 434 435 436 437 438 |
# File 'documented/main/argv_options.rb', line 427 def self.handle_shattered_connection() $platinum = false if ARGV.any? { |a| a =~ /^-s$/i || a =~ /^--stormfront$/i } [: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$/i } ? 'avalon' : ARGV.any? { |a| a =~ /^--frostbite$/i } ? 'frostbite' : ARGV.any? { |a| a =~ /^--saga$/i } ? 'saga' : 'wizard' end end |