… | |
… | |
2504 | |
2504 | |
2505 | my $desc = $item->{nrof} < 2 |
2505 | my $desc = $item->{nrof} < 2 |
2506 | ? $item->{name} |
2506 | ? $item->{name} |
2507 | : "$item->{nrof} $item->{name_pl}"; |
2507 | : "$item->{nrof} $item->{name_pl}"; |
2508 | |
2508 | |
|
|
2509 | $item->{flags} & Crossfire::Protocol::F_OPEN |
|
|
2510 | and $desc .= " (open)"; |
|
|
2511 | $item->{flags} & Crossfire::Protocol::F_APPLIED |
|
|
2512 | and $desc .= " (applied)"; |
|
|
2513 | $item->{flags} & Crossfire::Protocol::F_UNPAID |
|
|
2514 | and $desc .= " (unpaid)"; |
|
|
2515 | $item->{flags} & Crossfire::Protocol::F_MAGIC |
|
|
2516 | and $desc .= " (magic)"; |
|
|
2517 | $item->{flags} & Crossfire::Protocol::F_CURSED |
|
|
2518 | and $desc .= " (cursed)"; |
|
|
2519 | $item->{flags} & Crossfire::Protocol::F_DAMNED |
|
|
2520 | and $desc .= " (damned)"; |
|
|
2521 | $item->{flags} & Crossfire::Protocol::F_LOCKED |
|
|
2522 | and $desc .= " *"; |
2509 | |
2523 | |
2510 | my $self = $class->SUPER::new ( |
2524 | my $self = $class->SUPER::new ( |
2511 | can_hover => 1, |
2525 | can_hover => 1, |
2512 | can_events => 1, |
2526 | can_events => 1, |
2513 | tooltip => (CFClient::UI::Label->escape ($desc) |
2527 | tooltip => (CFClient::UI::Label->escape ($desc) |
… | |
… | |
2519 | if ($ev->{button} == 1) { |
2533 | if ($ev->{button} == 1) { |
2520 | $::CONN->send ("move $::CONN->{player}{tag} $item->{tag} 0"); |
2534 | $::CONN->send ("move $::CONN->{player}{tag} $item->{tag} 0"); |
2521 | } elsif ($ev->{button} == 2) { |
2535 | } elsif ($ev->{button} == 2) { |
2522 | $::CONN->send ("apply $item->{tag}"); |
2536 | $::CONN->send ("apply $item->{tag}"); |
2523 | } elsif ($ev->{button} == 3) { |
2537 | } elsif ($ev->{button} == 3) { |
2524 | CFClient::UI::Menu->new ( |
2538 | my @menu_items = ( |
2525 | items => [ |
|
|
2526 | ["examine", sub { $::CONN->send ("examine $item->{tag}") }], |
2539 | ["examine", sub { $::CONN->send ("examine $item->{tag}") }], |
|
|
2540 | ["mark", sub { $::CONN->send ("mark $item->{tag}") }], |
|
|
2541 | ["apply", sub { $::CONN->send ("apply $item->{tag}") }], |
|
|
2542 | ["drop", sub { $::CONN->send ("move $main::OPENCONT $item->{tag} 0") }], |
2527 | [ |
2543 | [ |
2528 | $item->{flags} & Crossfire::Protocol::F_LOCKED ? "lock" : "unlock", |
2544 | $item->{flags} & Crossfire::Protocol::F_LOCKED ? "lock" : "unlock", |
2529 | sub { $::CONN->send ("lock $item->{tag}") }, |
2545 | sub { $::CONN->send ("lock ". () ."$item->{tag}") }, |
2530 | ], |
|
|
2531 | ["mark", sub { $::CONN->send ("mark $item->{tag}") }], |
|
|
2532 | ["apply", sub { $::CONN->send ("apply $item->{tag}") }], |
|
|
2533 | ["drop", sub { $::CONN->send ("move 0 $item->{tag} 0") }], |
|
|
2534 | ], |
2546 | ], |
2535 | )->popup ($ev); |
2547 | ); |
|
|
2548 | |
|
|
2549 | CFClient::UI::Menu->new (items => \@menu_items)->popup ($ev); |
2536 | } |
2550 | } |
2537 | |
2551 | |
2538 | 1 |
2552 | 1 |
2539 | }, |
2553 | }, |
2540 | %args |
2554 | %args |