… | |
… | |
24 | return @unpaid; |
24 | return @unpaid; |
25 | } |
25 | } |
26 | |
26 | |
27 | sub find_unpaid { |
27 | sub find_unpaid { |
28 | my ($ob) = @_; |
28 | my ($ob) = @_; |
29 | my @r = find_rec ($ob, sub { $_[0]->get_flag (cf::FLAG_UNPAID) }); |
29 | my @r = find_rec ($ob, sub { $_[0]->flag (cf::FLAG_UNPAID) }); |
30 | return @r; |
30 | return @r; |
31 | } |
31 | } |
32 | |
32 | |
33 | sub find_traded { |
33 | sub find_traded { |
34 | my ($ob) = @_; |
34 | my ($ob) = @_; |
… | |
… | |
111 | } |
111 | } |
112 | |
112 | |
113 | $self->apply_shop_mat ($who); |
113 | $self->apply_shop_mat ($who); |
114 | |
114 | |
115 | for my $item (find_traded ($who)) { |
115 | for my $item (find_traded ($who)) { |
116 | next if $item->get_flag (cf::FLAG_UNPAID); |
116 | next if $item->flag (cf::FLAG_UNPAID); |
117 | $item->set_value ($item->get_ob_key_value ('ext_reseller_orig_value')); |
117 | $item->set_value ($item->get_ob_key_value ('ext_reseller_orig_value')); |
118 | $item->set_ob_key_value (ext_reseller_seller => ''); |
118 | $item->set_ob_key_value (ext_reseller_seller => ''); |
119 | } |
119 | } |
120 | |
120 | |
121 | $obs[0]->set_ob_key_value (ext_reseller_sales => cf::to_json $sells); |
121 | $obs[0]->set_ob_key_value (ext_reseller_sales => cf::to_json $sells); |
… | |
… | |
127 | cf::register_attachment "reseller_floor", |
127 | cf::register_attachment "reseller_floor", |
128 | on_drop_on => sub { |
128 | on_drop_on => sub { |
129 | my ($on, $what, $who) = @_; |
129 | my ($on, $what, $who) = @_; |
130 | my $name = $what->custom_name; |
130 | my $name = $what->custom_name; |
131 | |
131 | |
132 | return if $what->get_flag (cf::FLAG_UNPAID); |
132 | return if $what->flag (cf::FLAG_UNPAID); |
133 | |
133 | |
134 | if ($what->type == cf::MONEY) { |
134 | if ($what->type == cf::MONEY) { |
135 | $who->message ("The shopkeeper says: Sorry, you can't sell money here.", cf::NDI_BROWN); |
135 | $who->message ("The shopkeeper says: Sorry, you can't sell money here.", cf::NDI_BROWN); |
136 | $what->insert_ob_in_ob ($who); |
136 | $what->insert_ob_in_ob ($who); |
137 | return cf::override; |
137 | return cf::override; |
138 | } |
138 | } |
139 | |
139 | |
140 | if (!$what->get_flag (cf::FLAG_IDENTIFIED) && $what->need_identify) { |
140 | if (!$what->flag (cf::FLAG_IDENTIFIED) && $what->need_identify) { |
141 | $who->message ("The shopkeeper says: Sorry, you can't sell unidentified stuff here.", cf::NDI_BROWN); |
141 | $who->message ("The shopkeeper says: Sorry, you can't sell unidentified stuff here.", cf::NDI_BROWN); |
142 | $what->insert_ob_in_ob ($who); |
142 | $what->insert_ob_in_ob ($who); |
143 | return cf::override; |
143 | return cf::override; |
144 | } |
144 | } |
145 | |
145 | |