1234567891011121314151617181920212223242526272829 |
- use moonmud::*;
- fn main() {
- let o: Option<Object> = Object::load_player_by_name(&"Test Player".to_string());
- match o {
- Some(o) => {
- println!("{:?}", o);
- }
- None => {
- let mut o = Object::default();
- o.id = next_id();
- o.kind = Kind::Player;
- o.name = "Test Player".to_string();
- o.set_password(&"12345".to_string());
- o.health = 10;
- o.max_health = 10;
- o.build = 1;
- o.max_build = 3;
- o.inv.add_one(1);
- o.inv.add(2, 2);
- if !o.save() {
- eprintln!("Failed saving?");
- } else {
- println!("{:?}", o);
- }
- }
- }
- }
|