… | |
… | |
252 | 0 |
252 | 0 |
253 | }, |
253 | }, |
254 | ); |
254 | ); |
255 | |
255 | |
256 | # center: swap stats |
256 | # center: swap stats |
257 | my ($sw1, $sw2) = map +(new CFClient::UI::Combobox |
257 | my ($sw1, $sw2) = map +(new CFClient::UI::Selector |
258 | expand => 1, |
258 | expand => 1, |
259 | value => $_, |
259 | value => $_, |
260 | options => [ |
260 | options => [ |
261 | [1 => "Str", "Strength ($conn->{stat}{+CS_STAT_STR})"], |
261 | [1 => "Str", "Strength ($conn->{stat}{+CS_STAT_STR})"], |
262 | [2 => "Dex", "Dexterity ($conn->{stat}{+CS_STAT_DEX})"], |
262 | [2 => "Dex", "Dexterity ($conn->{stat}{+CS_STAT_DEX})"], |
… | |
… | |
687 | can_hover => 1, can_events => 1, |
687 | can_hover => 1, can_events => 1, |
688 | tooltip => "The weight of the player including all inventory items."); |
688 | tooltip => "The weight of the player including all inventory items."); |
689 | $hb0->add ($STATWIDS->{m_weight} = new CFClient::UI::Label valign => 0, align => -1, text => "Max weight:", expand => 1, |
689 | $hb0->add ($STATWIDS->{m_weight} = new CFClient::UI::Label valign => 0, align => -1, text => "Max weight:", expand => 1, |
690 | can_hover => 1, can_events => 1, |
690 | can_hover => 1, can_events => 1, |
691 | tooltip => "The weight limit: you cannot carry more than this."); |
691 | tooltip => "The weight limit: you cannot carry more than this."); |
692 | |
|
|
693 | |
692 | |
694 | $vb->add (my $hb = new CFClient::UI::HBox expand => 1); |
693 | $vb->add (my $hb = new CFClient::UI::HBox expand => 1); |
695 | $hb->add (my $tbl = new CFClient::UI::Table expand => 1); |
694 | $hb->add (my $tbl = new CFClient::UI::Table expand => 1); |
696 | |
695 | |
697 | my $color2 = [1, 1, 0]; |
696 | my $color2 = [1, 1, 0]; |
… | |
… | |
1133 | $QUIT_DIALOG = new CFClient::UI::FancyFrame |
1132 | $QUIT_DIALOG = new CFClient::UI::FancyFrame |
1134 | x => "center", |
1133 | x => "center", |
1135 | y => "center", |
1134 | y => "center", |
1136 | z => 50, |
1135 | z => 50, |
1137 | title => "Really Quit?", |
1136 | title => "Really Quit?", |
|
|
1137 | on_key_down => sub { |
|
|
1138 | my ($dialog, $ev) = @_; |
|
|
1139 | $ev->{sym} == 27 and $dialog->hide; |
|
|
1140 | } |
1138 | ; |
1141 | ; |
1139 | |
1142 | |
1140 | $QUIT_DIALOG->add (my $vb = new CFClient::UI::VBox expand => 1); |
1143 | $QUIT_DIALOG->add (my $vb = new CFClient::UI::VBox expand => 1); |
1141 | |
1144 | |
1142 | $vb->add (new CFClient::UI::Label |
1145 | $vb->add (new CFClient::UI::Label |
… | |
… | |
1156 | on_activate => sub { exit }, |
1159 | on_activate => sub { exit }, |
1157 | ); |
1160 | ); |
1158 | } |
1161 | } |
1159 | |
1162 | |
1160 | $QUIT_DIALOG->show; |
1163 | $QUIT_DIALOG->show; |
|
|
1164 | $QUIT_DIALOG->grab_focus; |
1161 | } |
1165 | } |
1162 | |
1166 | |
1163 | sub autopickup_setup { |
1167 | sub autopickup_setup { |
1164 | my $table = new CFClient::UI::Table; |
1168 | my $table = new CFClient::UI::Table; |
1165 | |
1169 | |
… | |
… | |
1255 | }); |
1259 | }); |
1256 | |
1260 | |
1257 | $table |
1261 | $table |
1258 | } |
1262 | } |
1259 | |
1263 | |
|
|
1264 | my %SORT_ORDER = ( |
|
|
1265 | type => undef, |
|
|
1266 | mtime => sub { sort { |
|
|
1267 | ($a->{flags} & F_LOCKED) <=> ($b->{flags} & F_LOCKED) |
|
|
1268 | or $b->{mtime} <=> $a->{mtime} |
|
|
1269 | or $a->{type} <=> $b->{type} |
|
|
1270 | } @_ }, |
|
|
1271 | weight => sub { sort { |
|
|
1272 | $a->{weight} * ($a->{nrof} || 1) <=> $b->{weight} * ($b->{nrof} || 1) |
|
|
1273 | or $a->{type} <=> $b->{type} |
|
|
1274 | } @_ }, |
|
|
1275 | ); |
|
|
1276 | |
1260 | sub inventory_widget { |
1277 | sub inventory_widget { |
1261 | my $hb = new CFClient::UI::HBox homogeneous => 1; |
1278 | my $hb = new CFClient::UI::HBox homogeneous => 1; |
1262 | |
1279 | |
1263 | $hb->add (my $vb1 = new CFClient::UI::VBox); |
1280 | $hb->add (my $vb1 = new CFClient::UI::VBox); |
1264 | $vb1->add (new CFClient::UI::Label align => 0, text => "Player"); |
1281 | $vb1->add (new CFClient::UI::Label align => 0, text => "Player"); |
1265 | |
1282 | |
1266 | $vb1->add (my $hb1 = new CFClient::UI::HBox); |
1283 | $vb1->add (my $hb1 = new CFClient::UI::HBox); |
1267 | |
1284 | |
1268 | use sort 'stable'; |
1285 | use sort 'stable'; |
1269 | |
1286 | |
1270 | $hb1->add (new CFClient::UI::Combobox |
1287 | $hb1->add (new CFClient::UI::Selector |
1271 | value => undef, |
1288 | value => $::CFG->{inv_sort}, |
1272 | options => [ |
1289 | options => [ |
1273 | [undef, "Type/Name"], |
1290 | [type => "Type/Name"], |
1274 | [ |
1291 | [mtime => "Recent/Normal/Locked"], |
1275 | sub { sort { |
|
|
1276 | $a->{weight} * ($a->{nrof} || 1) <=> $b->{weight} * ($b->{nrof} || 1) |
|
|
1277 | or $a->{type} <=> $b->{type} |
|
|
1278 | } @_ }, |
|
|
1279 | "Weight/Type", |
1292 | [weight => "Weight/Type"], |
1280 | ], |
|
|
1281 | [sub { } => "#TODO#"], |
|
|
1282 | ], |
1293 | ], |
1283 | on_changed => sub { |
1294 | on_changed => sub { |
|
|
1295 | $::CFG->{inv_sort} = $_[1]; |
1284 | $INV->set_sort_order ($_[1]); |
1296 | $INV->set_sort_order ($SORT_ORDER{$_[1]}); |
1285 | }, |
1297 | }, |
1286 | ); |
1298 | ); |
1287 | $hb1->add (new CFClient::UI::Label text => "Weight: ", align => 1, expand => 1); |
1299 | $hb1->add (new CFClient::UI::Label text => "Weight: ", align => 1, expand => 1); |
1288 | #TODO# update to weigh/maxweight |
1300 | #TODO# update to weigh/maxweight |
1289 | $hb1->add ($STATWIDS->{i_weight} = new CFClient::UI::Label align => -1); |
1301 | $hb1->add ($STATWIDS->{i_weight} = new CFClient::UI::Label align => -1); |
… | |
… | |
1562 | $vbox->add (my $buttons = new CFClient::UI::HBox); |
1574 | $vbox->add (my $buttons = new CFClient::UI::HBox); |
1563 | $vbox->add (my $viewer = new CFClient::UI::TextScroller |
1575 | $vbox->add (my $viewer = new CFClient::UI::TextScroller |
1564 | expand => 1, fontsize => 0.8, padding_x => 4); |
1576 | expand => 1, fontsize => 0.8, padding_x => 4); |
1565 | |
1577 | |
1566 | $buttons->add (new CFClient::UI::Label text => "Choose a document to display: "); |
1578 | $buttons->add (new CFClient::UI::Label text => "Choose a document to display: "); |
1567 | $buttons->add (my $combo = new CFClient::UI::Combobox |
1579 | $buttons->add (my $combo = new CFClient::UI::Selector |
1568 | value => undef, |
1580 | value => undef, |
1569 | options => [ |
1581 | options => [ |
1570 | [intro => "Introduction"], |
1582 | [intro => "Introduction"], |
1571 | [manual => "Main Manual"], |
1583 | [manual => "Main Manual"], |
1572 | [skill_help => "Skill Reference"], |
1584 | [skill_help => "Skill Reference"], |
… | |
… | |
1985 | bgm_volume => 0.25, |
1997 | bgm_volume => 0.25, |
1986 | face_prefetch => 0, |
1998 | face_prefetch => 0, |
1987 | output_sync => 1, |
1999 | output_sync => 1, |
1988 | output_count => 1, |
2000 | output_count => 1, |
1989 | pickup => 0, |
2001 | pickup => 0, |
|
|
2002 | inv_sort => "mtime", |
1990 | default => "profile", # default profile |
2003 | default => "profile", # default profile |
1991 | ); |
2004 | ); |
1992 | |
2005 | |
1993 | while (my ($k, $v) = each %DEF_CFG) { |
2006 | while (my ($k, $v) = each %DEF_CFG) { |
1994 | $CFG->{$k} = $v unless exists $CFG->{$k}; |
2007 | $CFG->{$k} = $v unless exists $CFG->{$k}; |