… | |
… | |
1673 | child => (my $table = new DC::UI::Table expand => 1, col_expand => [0, 1]), |
1673 | child => (my $table = new DC::UI::Table expand => 1, col_expand => [0, 1]), |
1674 | ); |
1674 | ); |
1675 | |
1675 | |
1676 | $table->add_at (0, 4, new DC::UI::Label align => 1, text => "Username"); |
1676 | $table->add_at (0, 4, new DC::UI::Label align => 1, text => "Username"); |
1677 | $table->add_at (1, 4, new DC::UI::Entry |
1677 | $table->add_at (1, 4, new DC::UI::Entry |
1678 | text => $CFG->{profile}{default}{user}, |
1678 | text => $PROFILE->{user}, |
1679 | tooltip => "The name of your character on the server. The name is case-sensitive!", |
1679 | tooltip => "The name of your character on the server. The name is case-sensitive!", |
1680 | on_changed => sub { my ($self, $value) = @_; $CFG->{profile}{default}{user} = $value; 1 } |
1680 | on_changed => sub { my ($self, $value) = @_; $PROFILE->{user} = $value; 1 } |
1681 | ); |
1681 | ); |
1682 | |
1682 | |
1683 | $table->add_at (0, 5, new DC::UI::Label align => 1, text => "Password"); |
1683 | $table->add_at (0, 5, new DC::UI::Label align => 1, text => "Password"); |
1684 | $table->add_at (1, 5, new DC::UI::Entry |
1684 | $table->add_at (1, 5, new DC::UI::Entry |
1685 | text => $CFG->{profile}{default}{password}, |
1685 | text => $PROFILE->{password}, |
1686 | hidden => 1, |
1686 | hidden => 1, |
1687 | tooltip => "The password for your character.", |
1687 | tooltip => "The password for your character.", |
1688 | on_changed => sub { my ($self, $value) = @_; $CFG->{profile}{default}{password} = $value; 1 } |
1688 | on_changed => sub { my ($self, $value) = @_; $PROFILE->{password} = $value; 1 } |
1689 | ); |
1689 | ); |
1690 | |
1690 | |
1691 | $table->add_at (1, 11, $LOGIN_BUTTON = new DC::UI::Button |
1691 | $table->add_at (1, 11, $LOGIN_BUTTON = new DC::UI::Button |
1692 | expand => 1, |
1692 | expand => 1, |
1693 | text => "Login / Register", |
1693 | text => "Login / Register", |
… | |
… | |
1729 | $table->add_at (1, $row, my $vbox = new DC::UI::VBox); |
1729 | $table->add_at (1, $row, my $vbox = new DC::UI::VBox); |
1730 | |
1730 | |
1731 | $vbox->add ( |
1731 | $vbox->add ( |
1732 | $HOST_ENTRY = new DC::UI::Entry |
1732 | $HOST_ENTRY = new DC::UI::Entry |
1733 | expand => 1, |
1733 | expand => 1, |
1734 | text => $CFG->{profile}{default}{host}, |
1734 | text => $PROFILE->{host}, |
1735 | tooltip => "The hostname or ip address of the Deliantra server to connect to (e.g. <b>gameserver.deliantra.net</b>)", |
1735 | tooltip => "The hostname or ip address of the Deliantra server to connect to (e.g. <b>gameserver.deliantra.net</b>)", |
1736 | on_changed => sub { |
1736 | on_changed => sub { |
1737 | my ($self, $value) = @_; |
1737 | my ($self, $value) = @_; |
1738 | $CFG->{profile}{default}{host} = $value; |
1738 | $PROFILE->{host} = $value; |
1739 | 1 |
1739 | 1 |
1740 | } |
1740 | } |
1741 | ); |
1741 | ); |
1742 | |
1742 | |
1743 | if (0) { #d# disabled |
1743 | if (0) { #d# disabled |
… | |
… | |
2781 | |
2781 | |
2782 | while (my ($k, $v) = each %DEF_CFG) { |
2782 | while (my ($k, $v) = each %DEF_CFG) { |
2783 | $CFG->{$k} = $v unless exists $CFG->{$k}; |
2783 | $CFG->{$k} = $v unless exists $CFG->{$k}; |
2784 | } |
2784 | } |
2785 | |
2785 | |
2786 | $CFG->{profile}{default}{host} ||= "gameserver.deliantra.net"; |
2786 | my @args = @ARGV; |
|
|
2787 | |
|
|
2788 | my $profile = 'default'; |
|
|
2789 | |
|
|
2790 | for (my $i = 0; $i < @args; $i++) { |
|
|
2791 | if ($args[$i] eq '-profile') { |
|
|
2792 | $profile = $args[$i + 1]; |
|
|
2793 | splice @args, $i, 2, (); |
|
|
2794 | $i = 0; |
|
|
2795 | } |
|
|
2796 | } |
|
|
2797 | |
|
|
2798 | $CFG->{profile}{$profile} ||= {}; |
2787 | $PROFILE = $CFG->{profile}{default}; |
2799 | $PROFILE = $CFG->{profile}{$profile}; |
|
|
2800 | $PROFILE->{host} ||= "gameserver.deliantra.net"; |
2788 | |
2801 | |
2789 | $PROFILE->{host} = $ARGV[0] if @ARGV > 0; |
2802 | $PROFILE->{host} = $args[0] if @args > 0; |
2790 | $PROFILE->{user} = $ARGV[1] if @ARGV > 1; |
2803 | $PROFILE->{user} = $args[1] if @args > 1; |
2791 | $PROFILE->{password} = $ARGV[2] if @ARGV > 2; |
2804 | $PROFILE->{password} = $args[2] if @args > 2; |
2792 | |
2805 | |
2793 | # convert old bindings (only default profile matters) |
2806 | # convert old bindings (only default profile matters) |
2794 | if (my $bindings = delete $PROFILE->{bindings}) { |
2807 | if (my $bindings = delete $PROFILE->{bindings}) { |
2795 | while (my ($mod, $syms) = each %$bindings) { |
2808 | while (my ($mod, $syms) = each %$bindings) { |
2796 | while (my ($sym, $cmds) = each %$syms) { |
2809 | while (my ($sym, $cmds) = each %$syms) { |