ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra-Client/bin/pclient
(Generate patch)

Comparing deliantra/Deliantra-Client/bin/pclient (file contents):
Revision 1.198 by root, Fri May 5 19:10:16 2006 UTC vs.
Revision 1.200 by root, Mon May 8 17:23:08 2006 UTC

76our $MAPWIDGET; 76our $MAPWIDGET;
77our $BUTTONBAR; 77our $BUTTONBAR;
78our $LOGVIEW; 78our $LOGVIEW;
79our $CONSOLE; 79our $CONSOLE;
80our $METASERVER; 80our $METASERVER;
81our $LOGIN_BUTTON;
81 82
82our $FLOORBOX; 83our $FLOORBOX;
83our $GAUGES; 84our $GAUGES;
84our $STATWIDS; 85our $STATWIDS;
85 86
111 status "logging in..."; 112 status "logging in...";
112 113
113 my $mapsize = List::Util::min 32, List::Util::max 11, int $WIDTH * $CFG->{mapsize} * 0.01 / 32; 114 my $mapsize = List::Util::min 32, List::Util::max 11, int $WIDTH * $CFG->{mapsize} * 0.01 / 32;
114 115
115 $MAPCACHE = CFClient::db_table "mapcache_$CFG->{host}"; 116 $MAPCACHE = CFClient::db_table "mapcache_$CFG->{host}";
116
117 $MAP = new CFClient::Map $mapsize, $mapsize; 117 $MAP = new CFClient::Map $mapsize, $mapsize;
118 118
119 my ($host, $port) = split /:/, $CFG->{host}; 119 my ($host, $port) = split /:/, $CFG->{host};
120 120
121 $CONN = eval { 121 $CONN = eval {
128 maph => $mapsize, 128 maph => $mapsize,
129 ; 129 ;
130 }; 130 };
131 131
132 if ($CONN) { 132 if ($CONN) {
133 $LOGIN_BUTTON->set_text ("Logout");
134
133 status "login successful"; 135 status "login successful";
134 136
135 CFClient::lowdelay fileno $CONN->{fh}; 137 CFClient::lowdelay fileno $CONN->{fh};
136 } else { 138 } else {
137 status "unable to connect"; 139 status "unable to connect";
140 stop_game();
138 } 141 }
139} 142}
140 143
141sub stop_game { 144sub stop_game {
145 return unless $CONN;
146
147 status "connection closed";
148 $LOGIN_BUTTON->set_text ("Login");
149 $CONN->destroy;
150 $CONN = 0; # false, does not autovivify
151
152 undef $MAPCACHE;
142 undef $CONN; 153 undef $MAP;
143} 154}
144 155
145sub client_setup { 156sub client_setup {
146 my $dialog = new CFClient::UI::FancyFrame 157 my $dialog = new CFClient::UI::FancyFrame
147 title => "Client Setup", 158 title => "Client Setup",
571 582
572} 583}
573 584
574sub metaserver_dialog { 585sub metaserver_dialog {
575 my $dialog = new CFClient::UI::FancyFrame 586 my $dialog = new CFClient::UI::FancyFrame
576 title => "Metaserver", 587 title => "Server List",
577 child => (my $vbox = new CFClient::UI::VBox); 588 child => (my $vbox = new CFClient::UI::VBox);
578 589
579 $vbox->add ($dialog->{table} = new CFClient::UI::Table); 590 $vbox->add ($dialog->{table} = new CFClient::UI::Table);
580 591
581 $dialog 592 $dialog
683 694
684 $METASERVER = metaserver_dialog; 695 $METASERVER = metaserver_dialog;
685 696
686 $vbox->add (new CFClient::UI::Flopper 697 $vbox->add (new CFClient::UI::Flopper
687 expand => 1, 698 expand => 1,
688 text => "Metaserver", 699 text => "Server List",
689 other => $METASERVER, 700 other => $METASERVER,
690 tooltip => "Show a list of avaible crossfire servers", 701 tooltip => "Show a list of available crossfire servers",
691 connect_open => sub { 702 connect_open => sub {
692 update_metaserver $HOST; 703 update_metaserver $HOST;
693 } 704 }
694 ); 705 );
695 } 706 }
726 737
727 $CFG->{mapsize} = $self->{range}[0] = $value = int $value; 738 $CFG->{mapsize} = $self->{range}[0] = $value = int $value;
728 }, 739 },
729 ); 740 );
730 741
731 $table->add (1, 8, new CFClient::UI::Button expand => 1, align => 0, text => "Login", connect_activate => sub { 742 $table->add (1, 8, $LOGIN_BUTTON = new CFClient::UI::Button
743 expand => 1,
744 align => 0,
745 text => "Login",
746 connect_activate => sub {
747 $CONN ? stop_game
732 start_game; 748 : start_game;
749 },
733 }); 750 );
734 751
735 $dialog 752 $dialog
736} 753}
737 754
738sub message_window { 755sub message_window {
1178 } 1195 }
1179 1196
1180gotid: 1197gotid:
1181 $face->{id} = $id; 1198 $face->{id} = $id;
1182 $MAP->set_face ($facenum => $id); 1199 $MAP->set_face ($facenum => $id);
1183 $self->{faceid}[$facenum] = $id;#d#
1184 $TILECACHE->get ($id) 1200 $TILECACHE->get ($id)
1185} 1201}
1186 1202
1187sub conn::face_update { 1203sub conn::face_update {
1188 my ($self, $facenum, $face) = @_; 1204 my ($self, $facenum, $face) = @_;
1327 1343
1328 for my $skill (values %{$self->{skill_info}}) { 1344 for my $skill (values %{$self->{skill_info}}) {
1329 $MAPWIDGET->add_command ("ready_skill $skill", "Ready the skill '$skill'"); 1345 $MAPWIDGET->add_command ("ready_skill $skill", "Ready the skill '$skill'");
1330 $MAPWIDGET->add_command ("use_skill $skill", "Immediately use the skill '$skill'"); 1346 $MAPWIDGET->add_command ("use_skill $skill", "Immediately use the skill '$skill'");
1331 } 1347 }
1348
1349 $MAPWIDGET->add_command ("pet\\_mode defend", "Tell pets to stay close to you and defend you");
1350 $MAPWIDGET->add_command ("pet\\_mode arena", "Same as petmode attack, but also attack other players");
1351 $MAPWIDGET->add_command ("pet\\_mode sad", "Search & Destroy - tell pets to roam about and attack enemies");
1352 $MAPWIDGET->add_command ("kill\\_pets", "kill your pets");
1353}
1354
1355sub conn::eof {
1356 stop_game;
1332} 1357}
1333 1358
1334sub update_floorbox { 1359sub update_floorbox {
1335 $CFClient::UI::ROOT->on_refresh ($FLOORBOX => sub { 1360 $CFClient::UI::ROOT->on_refresh ($FLOORBOX => sub {
1361 return unless $CONN;
1362
1336 $FLOORBOX->clear; 1363 $FLOORBOX->clear;
1337 $FLOORBOX->add (new CFClient::UI::Empty expand => 1); 1364 $FLOORBOX->add (new CFClient::UI::Empty expand => 1);
1338 1365
1339 # we basically have to use the same sorting as everybody else 1366 # we basically have to use the same sorting as everybody else
1340 for my $item (@{ $CONN->{container}{0} }) { 1367 for my $item (@{ $CONN->{container}{0} }) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines