ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/maps/perl/reseller.ext
(Generate patch)

Comparing deliantra/maps/perl/reseller.ext (file contents):
Revision 1.13 by root, Fri Sep 8 15:21:04 2006 UTC vs.
Revision 1.14 by root, Fri Sep 8 16:22:14 2006 UTC

93 93
94 my $sells = cf::from_json $obs[0]->get_ob_key_value ('ext_reseller_sales'); 94 my $sells = cf::from_json $obs[0]->get_ob_key_value ('ext_reseller_sales');
95 95
96 for my $item (find_unpaid ($who)) { 96 for my $item (find_unpaid ($who)) {
97 if ($item->get_ob_key_value ('ext_reseller_seller') eq $who->name) { 97 if ($item->get_ob_key_value ('ext_reseller_seller') eq $who->name) {
98 $item->set_flag (cf::FLAG_UNPAID, 0); 98 $item->flag (cf::FLAG_UNPAID, 0);
99 $item->remove; 99 $item->remove;
100 $item->insert_ob_in_ob ($who); 100 $item->insert_ob_in_ob ($who);
101 next; 101 next;
102 } 102 }
103 103
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->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->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);
122 122
186 "The shopkeeper says: Ok, got the fee of " . cf::cost_string_from_value ($fee) . " for the item", 186 "The shopkeeper says: Ok, got the fee of " . cf::cost_string_from_value ($fee) . " for the item",
187 cf::NDI_BROWN 187 cf::NDI_BROWN
188 ); 188 );
189 } 189 }
190 190
191 $what->set_value ($value); 191 $what->value ($value);
192 my $cost = $what->query_cost ($who, cf::F_BUY | cf::F_SHOP) / ($what->nrof || 1); 192 my $cost = $what->query_cost ($who, cf::F_BUY | cf::F_SHOP) / ($what->nrof || 1);
193 193
194 my $fact = 0; 194 my $fact = 0;
195 if ($cost) { 195 if ($cost) {
196 $fact = $value / $cost; 196 $fact = $value / $cost;
197 $what->set_value (cf::ceil ($value * $fact)); 197 $what->value (cf::ceil ($value * $fact));
198 } 198 }
199 199
200# warn "END VALUE: $value * $fact => " . $what->value . "\n"; 200# warn "END VALUE: $value * $fact => " . $what->value . "\n";
201 201
202# my $cost = $what->query_cost ($who, cf::F_BUY | cf::F_SHOP) / $what->nrof; 202# my $cost = $what->query_cost ($who, cf::F_BUY | cf::F_SHOP) / $what->nrof;
210 ); 210 );
211 211
212 $what->set_ob_key_value (ext_reseller_seller => $who->name); 212 $what->set_ob_key_value (ext_reseller_seller => $who->name);
213 $what->set_ob_key_value (ext_reseller_orig_value => $orig_value); 213 $what->set_ob_key_value (ext_reseller_orig_value => $orig_value);
214# warn "SET SELLER ON " . $what->name . " + " . $what->{seller}->[0] . "\n"; 214# warn "SET SELLER ON " . $what->name . " + " . $what->{seller}->[0] . "\n";
215 $what->set_custom_name (
216 $what->name . " (by " . $who->name . ")" 215 $what->custom_name ($what->name . " (by " . $who->name . ")");
217 );
218 $what->set_flag (cf::FLAG_UNPAID, 1); 216 $what->flag (cf::FLAG_UNPAID, 1);
219 $what->insert_ob_in_map_at ($who->map, $who, cf::INS_BELOW_ORIGINATOR, $who->x, $who->y); 217 $what->insert_ob_in_map_at ($who->map, $who, cf::INS_BELOW_ORIGINATOR, $who->x, $who->y);
220 218
221 cf::override; 219 cf::override;
222 }, 220 },
223; 221;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines