fix test; add tusk, crest, pincer

This commit is contained in:
Christof Petig 2022-07-10 17:22:49 +02:00
parent 8c5901516e
commit 5ee72f8a5e
2 changed files with 27 additions and 21 deletions

View File

@ -30,8 +30,11 @@
(4.0, Item("common.items.crafting_ing.hide.animal_hide")), (4.0, Item("common.items.crafting_ing.hide.animal_hide")),
// Mob Drops // Mob Drops
(0.10, Item("common.items.crafting_ing.animal_misc.long_tusk")),
(0.15, Item("common.items.crafting_ing.animal_misc.elegant_crest")),
(0.15, Item("common.items.crafting_ing.animal_misc.grim_eyeball")), (0.15, Item("common.items.crafting_ing.animal_misc.grim_eyeball")),
(0.15, Item("common.items.crafting_ing.animal_misc.icy_fang")), (0.15, Item("common.items.crafting_ing.animal_misc.icy_fang")),
(0.2, Item("common.items.crafting_ing.animal_misc.strong_pincer")),
(0.5, Item("common.items.crafting_ing.animal_misc.raptor_feather")), (0.5, Item("common.items.crafting_ing.animal_misc.raptor_feather")),
(1.2, Item("common.items.crafting_ing.animal_misc.claw")), (1.2, Item("common.items.crafting_ing.animal_misc.claw")),
(2.5, Item("common.items.crafting_ing.animal_misc.fur")), (2.5, Item("common.items.crafting_ing.animal_misc.fur")),

View File

@ -906,7 +906,7 @@ impl TradePricing {
#[cfg(test)] #[cfg(test)]
fn print_sorted(&self) { fn print_sorted(&self) {
use crate::comp::item::{armor, ItemKind, MaterialStatManifest}; use crate::comp::item::armor; //, ItemKind, MaterialStatManifest};
println!("Item, ForSale, Amount, Good, Quality, Deal, Unit,"); println!("Item, ForSale, Amount, Good, Quality, Deal, Unit,");
@ -968,27 +968,30 @@ impl TradePricing {
}, },
) in sorted.iter() ) in sorted.iter()
{ {
let it = Item::new_from_item_definition_id( Item::new_from_item_definition_id(
item_id.as_ref(), item_id.as_ref(),
AbilityMap::load(), &AbilityMap::load().read(),
MaterialStatManifest::load(), &MaterialStatManifest::load().read(),
); )
//let price = mat_use.iter().map(|(amount, _good)| *amount).sum::<f32>(); .ok()
let prob = 1.0 / pricesum; .map(|it| {
let (info, unit) = more_information(&it, prob); //let price = mat_use.iter().map(|(amount, _good)| *amount).sum::<f32>();
let materials = mat_use let prob = 1.0 / pricesum;
.iter() let (info, unit) = more_information(&it, prob);
.fold(String::new(), |agg, i| agg + &format!("{:?}.", i.1)); let materials = mat_use
println!( .iter()
"{:?}, {}, {:>4.2}, {}, {:?}, {}, {},", .fold(String::new(), |agg, i| agg + &format!("{:?}.", i.1));
&item_id, println!(
if *can_sell { "yes" } else { "no" }, "{:?}, {}, {:>4.2}, {}, {:?}, {}, {},",
pricesum, &item_id,
materials, if *can_sell { "yes" } else { "no" },
it.quality(), pricesum,
info, materials,
unit, it.quality(),
); info,
unit,
);
});
} }
} }
} }