Browse Source

warnings

pbs
jake 5 years ago
parent
commit
fe85c8081e
  1. 3
      src/ship/monster.rs
  2. 3
      src/ship/packet/handler/message.rs
  3. 6
      tests/common.rs
  4. 22
      tests/test_exp_gain.rs
  5. 7
      tests/test_item_pickup.rs

3
src/ship/monster.rs

@ -1,10 +1,9 @@
#![allow(dead_code)] #![allow(dead_code)]
use std::collections::HashMap; use std::collections::HashMap;
use std::fs::File; use std::fs::File;
use std::io::{Read, Cursor};
use std::io::Read;
use std::path::PathBuf; use std::path::PathBuf;
use serde::{Serialize, Deserialize}; use serde::{Serialize, Deserialize};
use byteorder::{LittleEndian, ReadBytesExt};
use crate::ship::room::{Difficulty, Episode, RoomMode}; use crate::ship::room::{Difficulty, Episode, RoomMode};

3
src/ship/packet/handler/message.rs

@ -1,11 +1,10 @@
use log::warn;
use libpso::packet::ship::*; use libpso::packet::ship::*;
use libpso::packet::messages::*; use libpso::packet::messages::*;
use crate::entity::gateway::EntityGateway; use crate::entity::gateway::EntityGateway;
use crate::common::serverstate::ClientId; use crate::common::serverstate::ClientId;
use crate::common::leveltable::CharacterLevelTable; use crate::common::leveltable::CharacterLevelTable;
use crate::ship::ship::{SendShipPacket, ShipError, Rooms, Clients, ItemDropLocation}; use crate::ship::ship::{SendShipPacket, ShipError, Rooms, Clients, ItemDropLocation};
use crate::ship::location::{ClientLocation, ClientLocationError, RoomLobby};
use crate::ship::location::{ClientLocation, ClientLocationError};
use crate::ship::map::{MapArea}; use crate::ship::map::{MapArea};
use crate::ship::items::{ItemManager, ClientItemId}; use crate::ship::items::{ItemManager, ClientItemId};
use crate::ship::packet::builder; use crate::ship::packet::builder;

6
tests/common.rs

@ -1,16 +1,12 @@
use std::time::SystemTime; use std::time::SystemTime;
use elseware::common::serverstate::{ClientId, ServerState}; use elseware::common::serverstate::{ClientId, ServerState};
use elseware::entity::gateway::{EntityGateway, InMemoryGateway};
use elseware::entity::gateway::EntityGateway;
use elseware::entity::account::{UserAccountEntity, NewUserAccountEntity, NewUserSettingsEntity}; use elseware::entity::account::{UserAccountEntity, NewUserAccountEntity, NewUserSettingsEntity};
use elseware::entity::character::{CharacterEntity, NewCharacterEntity}; use elseware::entity::character::{CharacterEntity, NewCharacterEntity};
//use elseware::entity::item::{NewItemEntity, ItemDetail, ItemLocation};
use elseware::entity::item;
use elseware::ship::ship::{ShipServerState, RecvShipPacket}; use elseware::ship::ship::{ShipServerState, RecvShipPacket};
use elseware::ship::items::{ClientItemId, ActiveItemEntityId, HeldItemType, FloorItemType};
use libpso::packet::ship::*; use libpso::packet::ship::*;
use libpso::packet::messages::*;
use libpso::packet::login::{Login, Session}; use libpso::packet::login::{Login, Session};
use libpso::{utf8_to_array, utf8_to_utf16_array}; use libpso::{utf8_to_array, utf8_to_utf16_array};

22
tests/test_exp_gain.rs

@ -1,20 +1,11 @@
use std::time::SystemTime;
use elseware::common::serverstate::{ClientId, ServerState}; use elseware::common::serverstate::{ClientId, ServerState};
use elseware::entity::gateway::{EntityGateway, InMemoryGateway}; use elseware::entity::gateway::{EntityGateway, InMemoryGateway};
use elseware::entity::account::{UserAccountEntity, NewUserAccountEntity, NewUserSettingsEntity};
use elseware::entity::character::{CharacterEntity, NewCharacterEntity};
//use elseware::entity::item::{NewItemEntity, ItemDetail, ItemLocation};
use elseware::entity::item;
use elseware::common::leveltable::CharacterLevelTable; use elseware::common::leveltable::CharacterLevelTable;
use elseware::ship::ship::{ShipServerState, SendShipPacket, RecvShipPacket}; use elseware::ship::ship::{ShipServerState, SendShipPacket, RecvShipPacket};
use elseware::ship::items::{ClientItemId, ActiveItemEntityId, HeldItemType, FloorItemType};
use elseware::ship::monster::MonsterType; use elseware::ship::monster::MonsterType;
use libpso::packet::ship::*; use libpso::packet::ship::*;
use libpso::packet::messages::*; use libpso::packet::messages::*;
use libpso::packet::login::{Login, Session};
use libpso::{utf8_to_array, utf8_to_utf16_array};
#[path = "common.rs"] #[path = "common.rs"]
mod common; mod common;
@ -70,12 +61,11 @@ async fn test_character_levels_up() {
let enemy_id = { let enemy_id = {
let room = ship.rooms[0].as_ref().unwrap(); let room = ship.rooms[0].as_ref().unwrap();
let (enemy_id, map_enemy) = (0..).filter_map(|i| {
room.maps.enemy_by_id(i).map(|enemy| {
(i, enemy)
(0..).filter_map(|i| {
room.maps.enemy_by_id(i).map(|_| {
i
}).ok() }).ok()
}).next().unwrap();
enemy_id
}).next().unwrap()
}; };
let levelup_pkt = ship.handle(ClientId(1), &RecvShipPacket::Message(Message::new(GameMessage::RequestExp(RequestExp{ let levelup_pkt = ship.handle(ClientId(1), &RecvShipPacket::Message(Message::new(GameMessage::RequestExp(RequestExp{
@ -140,8 +130,8 @@ async fn test_character_levels_up_multiple_times() {
async fn test_one_character_gets_full_exp_and_other_attacker_gets_partial() { async fn test_one_character_gets_full_exp_and_other_attacker_gets_partial() {
let mut entity_gateway = InMemoryGateway::new(); let mut entity_gateway = InMemoryGateway::new();
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
let (_user1, _char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let (_user2, _char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
let mut ship = ShipServerState::new(entity_gateway.clone()); let mut ship = ShipServerState::new(entity_gateway.clone());
log_in_char(&mut ship, ClientId(1), "a1", "a").await; log_in_char(&mut ship, ClientId(1), "a1", "a").await;

7
tests/test_item_pickup.rs

@ -1,18 +1,11 @@
use std::time::SystemTime;
use elseware::common::serverstate::{ClientId, ServerState}; use elseware::common::serverstate::{ClientId, ServerState};
use elseware::entity::gateway::{EntityGateway, InMemoryGateway}; use elseware::entity::gateway::{EntityGateway, InMemoryGateway};
use elseware::entity::account::{UserAccountEntity, NewUserAccountEntity, NewUserSettingsEntity};
use elseware::entity::character::{CharacterEntity, NewCharacterEntity};
//use elseware::entity::item::{NewItemEntity, ItemDetail, ItemLocation};
use elseware::entity::item; use elseware::entity::item;
use elseware::ship::ship::{ShipServerState, RecvShipPacket}; use elseware::ship::ship::{ShipServerState, RecvShipPacket};
use elseware::ship::items::{ClientItemId, ActiveItemEntityId, HeldItemType, FloorItemType}; use elseware::ship::items::{ClientItemId, ActiveItemEntityId, HeldItemType, FloorItemType};
use libpso::packet::ship::*; use libpso::packet::ship::*;
use libpso::packet::messages::*; use libpso::packet::messages::*;
use libpso::packet::login::{Login, Session};
use libpso::{utf8_to_array, utf8_to_utf16_array};
#[path = "common.rs"] #[path = "common.rs"]
mod common; mod common;

Loading…
Cancel
Save