1 | package CFPlus::Item; |
1 | package CFPlus::Item; |
2 | |
2 | |
3 | use strict; |
3 | use strict; |
4 | use utf8; |
4 | use utf8; |
|
|
5 | use Encode; |
5 | |
6 | |
6 | use Crossfire::Protocol::Constants; |
7 | use Crossfire::Protocol::Constants; |
7 | |
8 | |
8 | my $last_enter_count = 1; |
9 | my $last_enter_count = 1; |
9 | |
10 | |
… | |
… | |
114 | ["inscribe", # first try of an easier use of flint&steel |
115 | ["inscribe", # first try of an easier use of flint&steel |
115 | sub { |
116 | sub { |
116 | &::open_string_query ("Text to inscribe", sub { |
117 | &::open_string_query ("Text to inscribe", sub { |
117 | my ($entry, $txt) = @_; |
118 | my ($entry, $txt) = @_; |
118 | $::CONN->send ("mark ". pack "N", $self->{tag}); |
119 | $::CONN->send ("mark ". pack "N", $self->{tag}); |
119 | $::CONN->send ("command use_skill inscription $txt"); |
120 | $::CONN->send_utf8 ("command use_skill inscription $txt"); |
120 | }); |
121 | }); |
121 | } |
122 | } |
122 | ], |
123 | ], |
123 | ["rename", # first try of an easier use of flint&steel |
124 | ["rename", # first try of an easier use of flint&steel |
124 | sub { |
125 | sub { |
125 | &::open_string_query ("Rename item to:", sub { |
126 | &::open_string_query ("Rename item to:", sub { |
126 | my ($entry, $txt) = @_; |
127 | my ($entry, $txt) = @_; |
127 | $::CONN->send ("mark ". pack "N", $self->{tag}); |
128 | $::CONN->send ("mark ". pack "N", $self->{tag}); |
128 | $::CONN->send ("command rename to <$txt>"); |
129 | $::CONN->send_utf8 ("command rename to <$txt>"); |
129 | }, $self->{name}, |
130 | }, $self->{name}, |
130 | "If you input no name or erase the current custom name, the custom name will be unset"); |
131 | "If you input no name or erase the current custom name, the custom name will be unset"); |
131 | } |
132 | } |
132 | ], |
133 | ], |
133 | ["apply", sub { $::CONN->send ("apply $self->{tag}") }], |
134 | ["apply", sub { $::CONN->send ("apply $self->{tag}") }], |
… | |
… | |
194 | |
195 | |
195 | on_button_down => $button_cb, |
196 | on_button_down => $button_cb, |
196 | on_tooltip_show => sub { |
197 | on_tooltip_show => sub { |
197 | my ($widget) = @_; |
198 | my ($widget) = @_; |
198 | |
199 | |
199 | $::CONN->ex ($self->{tag}, sub { |
200 | $::CONN && $::CONN->ex ($self->{tag}, sub { |
200 | my ($long_desc) = @_; |
201 | my ($long_desc) = @_; |
201 | |
202 | |
202 | $long_desc =~ s/\s+$//; |
203 | $long_desc =~ s/\s+$//; |
203 | |
204 | |
204 | $self->{long_desc} = $long_desc; |
205 | $self->{long_desc} = $long_desc; |
… | |
… | |
228 | . ($self->{weight} >= 0 ? "One item weighs $self->{weight}g. " : "You have no idea how much this weighs. ") |
229 | . ($self->{weight} >= 0 ? "One item weighs $self->{weight}g. " : "You have no idea how much this weighs. ") |
229 | . ($self->{nrof} ? "You have $self->{nrof} of it. " : "Item cannot stack with others of it's kind. ") |
230 | . ($self->{nrof} ? "You have $self->{nrof} of it. " : "Item cannot stack with others of it's kind. ") |
230 | . "\n\n$tooltip_std" |
231 | . "\n\n$tooltip_std" |
231 | ); |
232 | ); |
232 | } |
233 | } |
|
|
234 | |