adds docs, removes some useless pub statements

This commit is contained in:
2019-10-19 16:12:27 +02:00
parent a552d7beee
commit 24807615f7
5 changed files with 47 additions and 16 deletions

View File

@@ -148,6 +148,7 @@ pub fn execute(
response.push_update(Update::Wealth(total_amount));
}
ApiActions::SellItems(id, params) => {
// TODO: Different procedure for group and other players
let mut all_results: Vec<db::Wealth> = Vec::with_capacity(params.len());
let mut sold_items: u16 = 0;
for (loot_id, price_mod) in params.into_iter() {
@@ -178,7 +179,19 @@ pub fn execute(
response.notify(format!("Bof! Finalement non."));
}
// Group actions
ApiActions::AddLoot(items) => {}
ApiActions::AddLoot(items) => {
let mut added_items = 0;
for item in items.into_iter() {
if let Ok(added) = db::LootManager(conn, 0).add_from(&item) {
response.push_update(Update::ItemAdded(added));
added_items += 1;
} else {
response.push_error(format!("Error adding {:?}", item));
}
}
response.notify(format!("{} objets lootés !", added_items));
// TODO: notify players throught persistent notifications
}
}
Ok(response)
}