impls add player admin action
This commit is contained in:
@@ -49,6 +49,7 @@ impl Loot {
|
||||
}
|
||||
}
|
||||
|
||||
type ItemDesc<'a> = (&'a str, i32);
|
||||
/// An item being looted or bought.
|
||||
///
|
||||
/// The owner is set to 0 in case of looting,
|
||||
@@ -60,3 +61,21 @@ struct NewLoot<'a> {
|
||||
base_price: i32,
|
||||
owner_id: i32,
|
||||
}
|
||||
|
||||
impl<'a> NewLoot<'a> {
|
||||
fn to_group(desc: ItemDesc<'a>) -> Self {
|
||||
Self {
|
||||
name: desc.0,
|
||||
base_price: desc.1,
|
||||
owner_id: 0,
|
||||
}
|
||||
}
|
||||
|
||||
fn to_player(player: i32, desc: ItemDesc<'a>) -> Self {
|
||||
Self {
|
||||
name: desc.0,
|
||||
base_price: desc.1,
|
||||
owner_id: player,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user