… | |
… | |
2554 | connect_button_down => sub { |
2554 | connect_button_down => sub { |
2555 | my ($self, $ev, $x, $y) = @_; |
2555 | my ($self, $ev, $x, $y) = @_; |
2556 | |
2556 | |
2557 | # todo: maybe put examine on 1? but should just be a tooltip :( |
2557 | # todo: maybe put examine on 1? but should just be a tooltip :( |
2558 | if ($ev->{button} == 1) { |
2558 | if ($ev->{button} == 1) { |
|
|
2559 | my $targ = $::CONN->{player}{tag}; |
|
|
2560 | |
|
|
2561 | if ($item->{container} == $::CONN->{player}{tag}) { |
|
|
2562 | $targ = $main::OPENCONT; |
|
|
2563 | } |
|
|
2564 | |
2559 | $::CONN->send ("move $::CONN->{player}{tag} $item->{tag} 0"); |
2565 | $::CONN->send ("move $targ $item->{tag} 0"); |
2560 | } elsif ($ev->{button} == 2) { |
2566 | } elsif ($ev->{button} == 2) { |
2561 | $::CONN->send ("apply $item->{tag}"); |
2567 | $::CONN->send ("apply $item->{tag}"); |
2562 | } elsif ($ev->{button} == 3) { |
2568 | } elsif ($ev->{button} == 3) { |
2563 | my @menu_items = ( |
2569 | my @menu_items = ( |
2564 | ["examine", sub { $::CONN->send ("examine $item->{tag}") }], |
2570 | ["examine", sub { $::CONN->send ("examine $item->{tag}") }], |
2565 | ["mark", sub { $::CONN->send ("mark $item->{tag}") }], |
2571 | ["mark", sub { $::CONN->send ("mark $item->{tag}") }], |
2566 | ["apply", sub { $::CONN->send ("apply $item->{tag}") }], |
2572 | ["apply", sub { $::CONN->send ("apply $item->{tag}") }], |
2567 | ["drop", sub { $::CONN->send ("move $main::OPENCONT $item->{tag} 0") }], |
2573 | ["drop", sub { $::CONN->send ("move $main::OPENCONT $item->{tag} 0") }], |
2568 | [ |
2574 | [ |
2569 | $item->{flags} & Crossfire::Protocol::F_LOCKED ? "lock" : "unlock", |
2575 | $item->{flags} & Crossfire::Protocol::F_LOCKED ? "lock" : "unlock", |
2570 | sub { $::CONN->send ("lock ". () ."$item->{tag}") }, |
2576 | sub { $::CONN->send ("lock $item->{tag}") }, |
2571 | ], |
2577 | ], |
2572 | ); |
2578 | ); |
2573 | |
2579 | |
2574 | CFClient::UI::Menu->new (items => \@menu_items)->popup ($ev); |
2580 | CFClient::UI::Menu->new (items => \@menu_items)->popup ($ev); |
2575 | } |
2581 | } |