clean up last of normal warnings
This commit is contained in:
parent
4ce7fb2a26
commit
1b506e014f
@ -71,7 +71,7 @@ impl Default for CharacterLevelTable {
|
||||
}
|
||||
|
||||
CharacterLevelTable {
|
||||
table: table,
|
||||
table,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -49,8 +49,8 @@ struct PacketReceiver {
|
||||
impl PacketReceiver {
|
||||
fn new(socket: Arc<async_std::net::TcpStream>, cipher: Arc<Mutex<Box<dyn PSOCipher + Send>>>) -> PacketReceiver {
|
||||
PacketReceiver {
|
||||
socket: socket,
|
||||
cipher: cipher,
|
||||
socket,
|
||||
cipher,
|
||||
recv_buffer: Vec::new(),
|
||||
incoming_data: Vec::new(),
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ struct MessageReceiver {
|
||||
impl MessageReceiver {
|
||||
fn new(socket: async_std::net::TcpStream) -> MessageReceiver {
|
||||
MessageReceiver {
|
||||
socket: socket,
|
||||
socket,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -75,7 +75,7 @@ pub struct NewUserSettingsEntity {
|
||||
impl NewUserSettingsEntity {
|
||||
pub fn new(user_id: UserAccountId) -> NewUserSettingsEntity {
|
||||
NewUserSettingsEntity {
|
||||
user_id: user_id,
|
||||
user_id,
|
||||
settings: settings::UserSettings::default(),
|
||||
}
|
||||
}
|
||||
@ -98,7 +98,7 @@ pub struct NewGuildCardDataEntity {
|
||||
impl NewGuildCardDataEntity {
|
||||
pub fn new(user_id: UserAccountId) -> NewGuildCardDataEntity {
|
||||
NewGuildCardDataEntity {
|
||||
user_id: user_id,
|
||||
user_id,
|
||||
guildcard: guildcard::GuildCardData::default(),
|
||||
}
|
||||
}
|
||||
@ -116,7 +116,7 @@ impl GuildCardDataEntity {
|
||||
pub fn new(user_id: UserAccountId) -> GuildCardDataEntity {
|
||||
GuildCardDataEntity {
|
||||
id: GuildCardDataId(0),
|
||||
user_id: user_id,
|
||||
user_id,
|
||||
guildcard: guildcard::GuildCardData::default(),
|
||||
}
|
||||
}
|
||||
|
@ -314,7 +314,7 @@ impl From<PgWeapon> for weapon::Weapon {
|
||||
weapon: other.weapon,
|
||||
special: other.special,
|
||||
grind: other.grind,
|
||||
attrs: attrs,
|
||||
attrs,
|
||||
tekked: other.tekked,
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,4 @@
|
||||
use std::convert::{From, TryFrom, Into};
|
||||
use futures::future::join_all;
|
||||
use futures::TryStreamExt;
|
||||
use async_std::stream::StreamExt;
|
||||
use libpso::character::guildcard;
|
||||
@ -40,7 +39,7 @@ impl PostgresGateway {
|
||||
});
|
||||
|
||||
PostgresGateway {
|
||||
pool: pool,
|
||||
pool,
|
||||
}
|
||||
}
|
||||
|
||||
@ -96,13 +95,13 @@ impl PostgresGateway {
|
||||
|
||||
ItemDetail::Mag(mag)
|
||||
},
|
||||
item @ _ => item
|
||||
item => item
|
||||
};
|
||||
|
||||
ItemEntity {
|
||||
id: id,
|
||||
item: item,
|
||||
location: location
|
||||
id,
|
||||
item,
|
||||
location
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -247,10 +247,10 @@ impl ESWeapon {
|
||||
let name = ESWeapon::name_from_bytes(&bytes[6..12]);
|
||||
|
||||
ESWeapon {
|
||||
esweapon: esweapon,
|
||||
esweapon,
|
||||
special: special.ok(),
|
||||
grind: grind,
|
||||
name: name,
|
||||
grind,
|
||||
name,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -651,12 +651,12 @@ impl Mag {
|
||||
|
||||
Ok(Mag{
|
||||
mag: m,
|
||||
def: def,
|
||||
pow: pow,
|
||||
dex: dex,
|
||||
def,
|
||||
pow,
|
||||
dex,
|
||||
mnd: mind,
|
||||
synchro: sync,
|
||||
iq: iq,
|
||||
iq,
|
||||
photon_blast: [None, None, None], // TODO: actually get PBs from bytes
|
||||
color: data[15] % 18,
|
||||
//modifiers: Vec::new(),
|
||||
|
@ -1536,25 +1536,25 @@ impl Weapon {
|
||||
|
||||
// TODO: error handling
|
||||
pub fn from_bytes(data: [u8; 16]) -> Result<Weapon, ItemParseError> {
|
||||
let w = WeaponType::parse_type([data[0], data[1], data[2]]);
|
||||
if let Ok(w) = w {
|
||||
let mut s = None;
|
||||
let mut t = true;
|
||||
let g = data[3];
|
||||
let wep = WeaponType::parse_type([data[0], data[1], data[2]]);
|
||||
if let Ok(weapon) = wep {
|
||||
let mut special = None;
|
||||
let mut tekked = true;
|
||||
let grind = data[3];
|
||||
|
||||
if data[4] >= 0x81 && data[4] <= 0xA8 {
|
||||
s = WeaponSpecial::from(data[4] - 0x80);
|
||||
t = false;
|
||||
special = WeaponSpecial::from(data[4] - 0x80);
|
||||
tekked = false;
|
||||
}
|
||||
else if data[4] >= 0x01 && data[4] <= 0x28 {
|
||||
s = WeaponSpecial::from(data[4]);
|
||||
t = true;
|
||||
special = WeaponSpecial::from(data[4]);
|
||||
tekked = true;
|
||||
}
|
||||
// else {
|
||||
// return Err(ItemParseError::InvalidSpecial)
|
||||
// }
|
||||
|
||||
let mut a = [
|
||||
let mut attrs = [
|
||||
None,
|
||||
None,
|
||||
None
|
||||
@ -1562,26 +1562,22 @@ impl Weapon {
|
||||
|
||||
for i in 0..3 {
|
||||
if data[2 * (3 + i)] >= 1 && data[2 * (3 + i)] <= 5 {
|
||||
a[i] = Some(WeaponAttribute{
|
||||
attrs[i] = Some(WeaponAttribute{
|
||||
attr: Attribute::from(data[2 * (3 + i)]).unwrap(),
|
||||
value: data[2 * (3 + i) + 1] as i8,
|
||||
});
|
||||
} else {
|
||||
a[i] = None;
|
||||
attrs[i] = None;
|
||||
// return Err(ItemParseError::InvalidAttribute)
|
||||
}
|
||||
}
|
||||
|
||||
Ok(Weapon {
|
||||
weapon: w,
|
||||
special: s,
|
||||
grind: g,
|
||||
attrs:[
|
||||
a[0],
|
||||
a[1],
|
||||
a[2],
|
||||
],
|
||||
tekked: t,
|
||||
weapon,
|
||||
special,
|
||||
grind,
|
||||
attrs,
|
||||
tekked,
|
||||
})
|
||||
}
|
||||
else {
|
||||
|
@ -28,7 +28,7 @@ use crate::entity::item::tool::Tool;
|
||||
use crate::entity::item::mag::Mag;
|
||||
use crate::entity::character::{CharacterEntity, NewCharacterEntity, CharacterClass, TechLevel};
|
||||
|
||||
use crate::login::login::{get_login_status, check_if_already_online};
|
||||
use crate::login::login::{get_login_status};
|
||||
use crate::common::interserver::AuthToken;
|
||||
|
||||
pub const CHARACTER_PORT: u16 = 12001;
|
||||
@ -148,7 +148,7 @@ fn generate_param_data(path: &str) -> (ParamDataHeader, Vec<u8>) {
|
||||
}
|
||||
|
||||
(ParamDataHeader {
|
||||
files: files
|
||||
files
|
||||
}, buffer)
|
||||
}
|
||||
|
||||
@ -301,13 +301,13 @@ impl<EG: EntityGateway> CharacterServerState<EG> {
|
||||
let (param_header, param_data) = generate_param_data("data/param/");
|
||||
|
||||
CharacterServerState {
|
||||
entity_gateway: entity_gateway,
|
||||
param_header: param_header,
|
||||
param_data: param_data,
|
||||
entity_gateway,
|
||||
param_header,
|
||||
param_data,
|
||||
clients: HashMap::new(),
|
||||
ships: BTreeMap::new(),
|
||||
level_table: CharacterLevelTable::default(),
|
||||
auth_token: auth_token,
|
||||
auth_token,
|
||||
authenticated_ships: BTreeSet::new(),
|
||||
ship_sender: BTreeMap::new(),
|
||||
connected_clients: BTreeMap::new(),
|
||||
@ -481,7 +481,7 @@ impl<EG: EntityGateway> CharacterServerState<EG> {
|
||||
Ok(vec![SendCharacterPacket::ParamDataChunk(
|
||||
Box::new(ParamDataChunk {
|
||||
chunk: chunk as u32,
|
||||
data: data,
|
||||
data,
|
||||
})
|
||||
)])
|
||||
}
|
||||
|
@ -101,8 +101,8 @@ pub struct LoginServerState<EG: EntityGateway> {
|
||||
impl<EG: EntityGateway> LoginServerState<EG> {
|
||||
pub fn new(entity_gateway: EG, character_server_ip: net::Ipv4Addr) -> LoginServerState<EG> {
|
||||
LoginServerState {
|
||||
entity_gateway: entity_gateway,
|
||||
character_server_ip: character_server_ip,
|
||||
entity_gateway,
|
||||
character_server_ip,
|
||||
clients: HashMap::new(),
|
||||
}
|
||||
}
|
||||
|
@ -146,10 +146,10 @@ pub struct PatchServerState {
|
||||
impl PatchServerState {
|
||||
pub fn new(patch_file_tree: PatchFileTree, patch_file_lookup: HashMap<u32, PatchFile>, patch_motd: String) -> PatchServerState {
|
||||
PatchServerState {
|
||||
patch_file_tree: patch_file_tree,
|
||||
patch_file_lookup: patch_file_lookup,
|
||||
patch_file_tree,
|
||||
patch_file_lookup,
|
||||
patch_file_info: Vec::new(),
|
||||
patch_motd: patch_motd,
|
||||
patch_motd,
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -222,9 +222,9 @@ fn load_patch_dir(basedir: &str, patchbase: &str, file_ids: &mut HashMap<u32, Pa
|
||||
files.push(PatchFileTree::File(patch_path.to_path_buf(), file_ids.len() as u32));
|
||||
let (checksum, size) = get_checksum_and_size(&path).unwrap();
|
||||
file_ids.insert(file_ids.len() as u32, PatchFile {
|
||||
path: path,
|
||||
checksum: checksum,
|
||||
size: size,
|
||||
path,
|
||||
checksum,
|
||||
size,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ impl<'a> CharacterBytesBuilder<'a> {
|
||||
dfp: stats.dfp + character.materials.def as u16 * 2,
|
||||
ata: stats.ata,
|
||||
lck: stats.lck + character.materials.luck as u16 * 2,
|
||||
level: level,
|
||||
level,
|
||||
section_id: character.section_id.into(),
|
||||
ch_class: character.char_class.into(),
|
||||
costume: character.appearance.costume,
|
||||
@ -221,7 +221,7 @@ impl<'a> FullCharacterBytesBuilder<'a> {
|
||||
symbol_chats: *symbol_chat,
|
||||
tech_menu: *tech_menu,
|
||||
bank: bank.as_client_bank_items(),
|
||||
option_flags: option_flags,
|
||||
option_flags,
|
||||
..character::FullCharacter::default()
|
||||
}
|
||||
}
|
||||
|
@ -232,9 +232,9 @@ impl AttributeTable {
|
||||
let area_percent_patterns: AreaPercentPatterns = load_data_file(episode, difficulty, section_id, "area_percent_pattern.toml");
|
||||
|
||||
AttributeTable {
|
||||
attribute_rates: attribute_rates,
|
||||
percent_rates: percent_rates,
|
||||
area_percent_patterns: area_percent_patterns,
|
||||
attribute_rates,
|
||||
percent_rates,
|
||||
area_percent_patterns,
|
||||
}
|
||||
}
|
||||
|
||||
@ -258,7 +258,7 @@ impl AttributeTable {
|
||||
let percent = ((value + 1) * 5) as i8;
|
||||
|
||||
Some(WeaponAttribute {
|
||||
attr: attr,
|
||||
attr,
|
||||
value: percent
|
||||
})
|
||||
}
|
||||
@ -406,7 +406,7 @@ impl GenericWeaponTable {
|
||||
rank_table.insert(WeaponDropType::Wand, vec![WeaponType::Wand, WeaponType::Staff, WeaponType::Baton, WeaponType::Scepter]);
|
||||
|
||||
GenericWeaponTable {
|
||||
rank_table: rank_table,
|
||||
rank_table,
|
||||
weapon_ratio: WeaponRatios::new(episode, difficulty, section_id),
|
||||
grind_rates: GrindRates::new(episode, difficulty, section_id),
|
||||
attribute_table: AttributeTable::new(episode, difficulty, section_id),
|
||||
|
@ -87,7 +87,7 @@ impl RareDropTable {
|
||||
}).collect();
|
||||
|
||||
RareDropTable {
|
||||
rates: rates,
|
||||
rates,
|
||||
attribute_table: AttributeTable::new(episode, difficulty, section_id),
|
||||
armor_stats: GenericArmorTable::new(episode, difficulty, section_id),
|
||||
shield_stats: GenericShieldTable::new(episode, difficulty, section_id),
|
||||
@ -98,7 +98,7 @@ impl RareDropTable {
|
||||
match item {
|
||||
RareDropItem::Weapon(weapon) => {
|
||||
ItemDropType::Weapon(Weapon {
|
||||
weapon: weapon,
|
||||
weapon,
|
||||
special: None,
|
||||
grind: 0,
|
||||
attrs: self.attribute_table.generate_rare_attributes(map_area, rng),
|
||||
@ -108,7 +108,7 @@ impl RareDropTable {
|
||||
},
|
||||
RareDropItem::Armor(armor) => {
|
||||
ItemDropType::Armor(Armor {
|
||||
armor: armor,
|
||||
armor,
|
||||
dfp: self.armor_stats.dfp_modifier(&armor, rng) as u8,
|
||||
evp: self.armor_stats.evp_modifier(&armor, rng) as u8,
|
||||
slots: self.armor_stats.slots(map_area, rng) as u8,
|
||||
@ -116,20 +116,20 @@ impl RareDropTable {
|
||||
},
|
||||
RareDropItem::Shield(shield) => {
|
||||
ItemDropType::Shield(Shield {
|
||||
shield: shield,
|
||||
shield,
|
||||
dfp: self.shield_stats.dfp_modifier(&shield, rng) as u8,
|
||||
evp: self.shield_stats.evp_modifier(&shield, rng) as u8,
|
||||
})
|
||||
},
|
||||
RareDropItem::Unit(unit) => {
|
||||
ItemDropType::Unit(Unit {
|
||||
unit: unit,
|
||||
unit,
|
||||
modifier: None,
|
||||
})
|
||||
},
|
||||
RareDropItem::Tool(tool) => {
|
||||
ItemDropType::Tool(Tool {
|
||||
tool: tool,
|
||||
tool,
|
||||
})
|
||||
},
|
||||
RareDropItem::Mag(_mag) => {
|
||||
|
@ -167,7 +167,7 @@ impl CharacterBank {
|
||||
items.sort();
|
||||
CharacterBank {
|
||||
item_id_counter: 0,
|
||||
items: items,
|
||||
items,
|
||||
}
|
||||
}
|
||||
|
||||
@ -186,7 +186,7 @@ impl CharacterBank {
|
||||
})?;
|
||||
Some(BankItemHandle {
|
||||
bank: self,
|
||||
index: index,
|
||||
index,
|
||||
})
|
||||
}
|
||||
|
||||
@ -221,8 +221,8 @@ impl CharacterBank {
|
||||
},
|
||||
};
|
||||
character::BankItem {
|
||||
data1: data1,
|
||||
data2: data2,
|
||||
data1,
|
||||
data2,
|
||||
item_id: item.item_id().0,
|
||||
amount: amount as u16,
|
||||
flags: 1,
|
||||
|
@ -181,7 +181,7 @@ impl RoomFloorItems {
|
||||
let index = self.0.iter().position(|item| item.item_id() == item_id)?;
|
||||
Some(FloorItemHandle {
|
||||
floor: self,
|
||||
index: index,
|
||||
index,
|
||||
})
|
||||
}
|
||||
|
||||
@ -234,7 +234,7 @@ impl RoomFloorItems {
|
||||
self.0.push(FloorItem::Stacked(StackedFloorItem {
|
||||
entity_ids: consumed_item.entity_ids(),
|
||||
item_id: new_item_id,
|
||||
tool: tool,
|
||||
tool,
|
||||
map_area: item_drop_location.0,
|
||||
x: item_drop_location.1,
|
||||
y: item_drop_location.2,
|
||||
|
@ -339,8 +339,8 @@ impl<'a> InventoryItemHandle<'a> {
|
||||
})
|
||||
.ok_or(InventoryItemConsumeError::InvalidAmount)?;
|
||||
Ok(ConsumedItem::Stacked(StackedConsumedItem {
|
||||
entity_ids: entity_ids,
|
||||
tool: tool,
|
||||
entity_ids,
|
||||
tool,
|
||||
}))
|
||||
}
|
||||
}
|
||||
@ -365,7 +365,7 @@ impl CharacterInventory {
|
||||
pub fn new(items: Vec<InventoryItem>, equipped: &EquippedEntity) -> CharacterInventory {
|
||||
CharacterInventory{
|
||||
item_id_counter: 0,
|
||||
items: items,
|
||||
items,
|
||||
equipped: equipped.clone(),
|
||||
}
|
||||
}
|
||||
@ -394,7 +394,7 @@ impl CharacterInventory {
|
||||
inventory[slot].data1[4] = self.equipped.unit.iter()
|
||||
.enumerate()
|
||||
.find(|(_, u_id)| **u_id == Some(individual_item.entity_id))
|
||||
.map(|(a, b)| a)
|
||||
.map(|(a, _)| a)
|
||||
.unwrap_or(0) as u8
|
||||
}
|
||||
inventory[slot].equipped = 1;
|
||||
@ -421,7 +421,7 @@ impl CharacterInventory {
|
||||
})?;
|
||||
Some(InventoryItemHandle {
|
||||
inventory: self,
|
||||
slot: slot,
|
||||
slot,
|
||||
})
|
||||
}
|
||||
|
||||
@ -438,7 +438,7 @@ impl CharacterInventory {
|
||||
})?;
|
||||
Some(InventoryItemHandle {
|
||||
inventory: self,
|
||||
slot: slot,
|
||||
slot,
|
||||
})
|
||||
}
|
||||
|
||||
@ -455,7 +455,7 @@ impl CharacterInventory {
|
||||
})?;
|
||||
Some(InventoryItemHandle {
|
||||
inventory: self,
|
||||
slot: slot,
|
||||
slot,
|
||||
})
|
||||
}
|
||||
|
||||
@ -472,7 +472,7 @@ impl CharacterInventory {
|
||||
})?;
|
||||
Some(InventoryItemHandle {
|
||||
inventory: self,
|
||||
slot: slot,
|
||||
slot,
|
||||
})
|
||||
}
|
||||
|
||||
@ -489,7 +489,7 @@ impl CharacterInventory {
|
||||
})?;
|
||||
Some(InventoryItemHandle {
|
||||
inventory: self,
|
||||
slot: slot,
|
||||
slot,
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -1,12 +1,11 @@
|
||||
use crate::ship::items::ClientItemId;
|
||||
use std::collections::{HashMap, BTreeMap};
|
||||
use std::collections::HashMap;
|
||||
use thiserror::Error;
|
||||
use crate::entity::gateway::EntityGateway;
|
||||
use crate::entity::character::{CharacterEntity, CharacterEntityId, TechLevel};
|
||||
use crate::entity::item::{ItemDetail, ItemLocation, BankName};
|
||||
use crate::entity::item::{Meseta, NewItemEntity, ItemEntity, InventoryItemEntity, EquippedEntity, InventoryEntity, BankItemEntity, BankEntity};
|
||||
use crate::entity::item::{Meseta, NewItemEntity, ItemEntity, InventoryItemEntity, BankItemEntity};
|
||||
use crate::entity::item::tool::{Tool, ToolType};
|
||||
use crate::entity::item::unit;
|
||||
use crate::entity::item::weapon;
|
||||
use crate::ship::map::MapArea;
|
||||
use crate::ship::ship::ItemDropLocation;
|
||||
@ -237,7 +236,7 @@ impl ItemManager {
|
||||
Some(FloorItem::Individual(individual_floor_item)) => {
|
||||
let new_inventory_item = inventory.pick_up_individual_floor_item(individual_floor_item);
|
||||
match new_inventory_item {
|
||||
Some((new_inventory_item, slot)) => {
|
||||
Some((new_inventory_item, _slot)) => {
|
||||
entity_gateway.change_item_location(
|
||||
&new_inventory_item.entity_id,
|
||||
ItemLocation::Inventory {
|
||||
@ -258,7 +257,7 @@ impl ItemManager {
|
||||
let new_inventory_item = inventory.pick_up_stacked_floor_item(stacked_floor_item);
|
||||
|
||||
match new_inventory_item {
|
||||
Some((new_inventory_item, slot)) => {
|
||||
Some((new_inventory_item, _slot)) => {
|
||||
for entity_id in &new_inventory_item.entity_ids {
|
||||
entity_gateway.change_item_location(
|
||||
entity_id,
|
||||
@ -337,7 +336,7 @@ impl ItemManager {
|
||||
}).await?;
|
||||
FloorItem::Individual(IndividualFloorItem {
|
||||
entity_id: entity.id,
|
||||
item_id: item_id,
|
||||
item_id,
|
||||
item: item_detail,
|
||||
map_area: item_drop.map_area,
|
||||
x: item_drop.x,
|
||||
@ -358,8 +357,8 @@ impl ItemManager {
|
||||
}).await?;
|
||||
FloorItem::Stacked(StackedFloorItem {
|
||||
entity_ids: vec![entity.id],
|
||||
item_id: item_id,
|
||||
tool: tool,
|
||||
item_id,
|
||||
tool,
|
||||
map_area: item_drop.map_area,
|
||||
x: item_drop.x,
|
||||
y: item_drop.y,
|
||||
@ -368,8 +367,8 @@ impl ItemManager {
|
||||
},
|
||||
ItemOrMeseta::Meseta(meseta) => {
|
||||
FloorItem::Meseta(MesetaFloorItem {
|
||||
item_id: item_id,
|
||||
meseta: meseta,
|
||||
item_id,
|
||||
meseta,
|
||||
map_area: item_drop.map_area,
|
||||
x: item_drop.x,
|
||||
y: item_drop.y,
|
||||
@ -445,7 +444,7 @@ impl ItemManager {
|
||||
|
||||
let item_id = self.room_item_id_counter.get_mut(room_id).ok_or(ItemManagerError::NoCharacter(character.id))?();
|
||||
let floor_item = FloorItem::Meseta(MesetaFloorItem {
|
||||
item_id: item_id,
|
||||
item_id,
|
||||
meseta: Meseta(amount),
|
||||
map_area: drop_location.map_area,
|
||||
x: drop_location.x,
|
||||
@ -571,13 +570,13 @@ impl ItemManager {
|
||||
let inventory_item = inventory.withdraw_item(item_to_withdraw, amount).ok_or(ItemManagerError::Idunnoman)?;
|
||||
|
||||
match inventory_item {
|
||||
(InventoryItem::Individual(individual_inventory_item), slot) => {
|
||||
(InventoryItem::Individual(individual_inventory_item), _slot) => {
|
||||
entity_gateway.change_item_location(&individual_inventory_item.entity_id,
|
||||
ItemLocation::Inventory {
|
||||
character_id: character.id,
|
||||
}).await?;
|
||||
},
|
||||
(InventoryItem::Stacked(stacked_inventory_item), slot) => {
|
||||
(InventoryItem::Stacked(stacked_inventory_item), _slot) => {
|
||||
for entity_id in &stacked_inventory_item.entity_ids {
|
||||
entity_gateway.change_item_location(entity_id,
|
||||
ItemLocation::Inventory {
|
||||
@ -768,8 +767,8 @@ impl ItemManager {
|
||||
}
|
||||
let floor_item = StackedFloorItem {
|
||||
entity_ids: item_entities.into_iter().map(|i| i.id).collect(),
|
||||
item_id: item_id,
|
||||
tool: tool,
|
||||
item_id,
|
||||
tool,
|
||||
// TODO: this is gonna choke if I ever require the item being near the player for pickup
|
||||
map_area: MapArea::Pioneer2Ep1,
|
||||
x: 0.0,
|
||||
@ -777,7 +776,7 @@ impl ItemManager {
|
||||
z: 0.0,
|
||||
};
|
||||
let item_id = {
|
||||
let (picked_up_item, slot) = inventory.pick_up_stacked_floor_item(&floor_item).ok_or(ItemManagerError::CouldNotAddBoughtItemToInventory)?;
|
||||
let (picked_up_item, _slot) = inventory.pick_up_stacked_floor_item(&floor_item).ok_or(ItemManagerError::CouldNotAddBoughtItemToInventory)?;
|
||||
for entity_id in &picked_up_item.entity_ids {
|
||||
entity_gateway.change_item_location(entity_id,
|
||||
ItemLocation::Inventory {
|
||||
@ -795,7 +794,7 @@ impl ItemManager {
|
||||
}).await?;
|
||||
let floor_item = IndividualFloorItem {
|
||||
entity_id: item_entity.id,
|
||||
item_id: item_id,
|
||||
item_id,
|
||||
item: ItemDetail::Tool(tool),
|
||||
// TODO: this is gonna choke if I ever require the item being near the player for pickup
|
||||
map_area: MapArea::Pioneer2Ep1,
|
||||
@ -804,7 +803,7 @@ impl ItemManager {
|
||||
z: 0.0,
|
||||
};
|
||||
let item_id = {
|
||||
let (picked_up_item, slot) = inventory.pick_up_individual_floor_item(&floor_item).ok_or(ItemManagerError::CouldNotAddBoughtItemToInventory)?;
|
||||
let (picked_up_item, _slot) = inventory.pick_up_individual_floor_item(&floor_item).ok_or(ItemManagerError::CouldNotAddBoughtItemToInventory)?;
|
||||
entity_gateway.change_item_location(&picked_up_item.entity_id,
|
||||
ItemLocation::Inventory {
|
||||
character_id: character.id,
|
||||
@ -814,14 +813,14 @@ impl ItemManager {
|
||||
inventory.get_item_by_id(item_id).ok_or(ItemManagerError::ItemIdNotInInventory(item_id))?
|
||||
}
|
||||
},
|
||||
item_detail @ _ => {
|
||||
item_detail => {
|
||||
let item_entity = entity_gateway.create_item(NewItemEntity {
|
||||
location: ItemLocation::Shop,
|
||||
item: item_detail.clone(),
|
||||
}).await?;
|
||||
let floor_item = IndividualFloorItem {
|
||||
entity_id: item_entity.id,
|
||||
item_id: item_id,
|
||||
item_id,
|
||||
item: item_detail,
|
||||
// TODO: this is gonna choke if I ever require the item being near the player for pickup
|
||||
map_area: MapArea::Pioneer2Ep1,
|
||||
@ -830,7 +829,7 @@ impl ItemManager {
|
||||
z: 0.0,
|
||||
};
|
||||
let item_id = {
|
||||
let (picked_up_item, slot) = inventory.pick_up_individual_floor_item(&floor_item).ok_or(ItemManagerError::CouldNotAddBoughtItemToInventory)?;
|
||||
let (picked_up_item, _slot) = inventory.pick_up_individual_floor_item(&floor_item).ok_or(ItemManagerError::CouldNotAddBoughtItemToInventory)?;
|
||||
entity_gateway.change_item_location(&picked_up_item.entity_id,
|
||||
ItemLocation::Inventory {
|
||||
character_id: character.id,
|
||||
@ -911,8 +910,8 @@ impl ItemManager {
|
||||
entity_gateway.add_weapon_modifier(&entity_id, tek).await?;
|
||||
|
||||
inventory.add_item(InventoryItem::Individual(IndividualInventoryItem {
|
||||
entity_id: entity_id,
|
||||
item_id: item_id,
|
||||
entity_id,
|
||||
item_id,
|
||||
item: ItemDetail::Weapon(weapon.clone()),
|
||||
}))?;
|
||||
|
||||
|
@ -252,7 +252,7 @@ impl MapEnemy {
|
||||
};
|
||||
|
||||
Ok(MapEnemy {
|
||||
monster: monster,
|
||||
monster,
|
||||
map_area: *map_area,
|
||||
hp: 0,
|
||||
dropped_item: false,
|
||||
@ -263,8 +263,8 @@ impl MapEnemy {
|
||||
|
||||
pub fn new(monster: MonsterType, map_area: MapArea) -> MapEnemy {
|
||||
MapEnemy {
|
||||
monster: monster,
|
||||
map_area: map_area,
|
||||
monster,
|
||||
map_area,
|
||||
hp: 0,
|
||||
dropped_item: false,
|
||||
gave_exp: false,
|
||||
|
@ -280,7 +280,7 @@ impl Maps {
|
||||
object_data: map_variants.iter().map(|map_variant| {
|
||||
objects_from_map_data(map_variant.obj_file().into(), &room_mode.episode(), &map_variant.map)
|
||||
}).flatten().collect(),
|
||||
map_variants: map_variants,
|
||||
map_variants,
|
||||
};
|
||||
maps
|
||||
}
|
||||
|
@ -159,7 +159,7 @@ impl MapObject {
|
||||
};
|
||||
|
||||
Ok(MapObject {
|
||||
object: object,
|
||||
object,
|
||||
map: *map_area,
|
||||
dropped_item: false,
|
||||
})
|
||||
|
@ -75,10 +75,10 @@ impl MapVariant {
|
||||
};
|
||||
|
||||
MapVariant {
|
||||
map: map,
|
||||
mode: mode,
|
||||
major: major,
|
||||
minor: minor,
|
||||
map,
|
||||
mode,
|
||||
major,
|
||||
minor,
|
||||
}
|
||||
}
|
||||
else {
|
||||
@ -136,10 +136,10 @@ impl MapVariant {
|
||||
};
|
||||
|
||||
MapVariant {
|
||||
map: map,
|
||||
mode: mode,
|
||||
major: major,
|
||||
minor: minor,
|
||||
map,
|
||||
mode,
|
||||
major,
|
||||
minor,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -12,8 +12,8 @@ use crate::ship::shops::ShopItem;
|
||||
pub fn item_drop(client: u8, target: u8, item_drop: &FloorItem) -> Result<ItemDrop, ShipError> {
|
||||
let item_bytes = item_drop.as_client_bytes();
|
||||
Ok(ItemDrop {
|
||||
client: client,
|
||||
target: target,
|
||||
client,
|
||||
target,
|
||||
map_area: item_drop.map_area().area_value(),
|
||||
variety: 0,
|
||||
unknown: 0,
|
||||
@ -101,7 +101,7 @@ pub fn character_gained_exp(area_client: AreaClient, exp: u32) -> GiveCharacterE
|
||||
GiveCharacterExp {
|
||||
client: area_client.local_client.id(),
|
||||
target: 0,
|
||||
exp: exp,
|
||||
exp,
|
||||
}
|
||||
}
|
||||
|
||||
@ -138,7 +138,7 @@ pub fn player_no_longer_has_item(area_client: AreaClient, item_id: ClientItemId,
|
||||
client: area_client.local_client.id(),
|
||||
target: 0,
|
||||
item_id: item_id.0,
|
||||
amount: amount,
|
||||
amount,
|
||||
}
|
||||
}
|
||||
|
||||
@ -157,10 +157,10 @@ pub fn shop_list<I: ShopItem>(shop_type: u8, items: &[I]) -> ShopList {
|
||||
ShopList {
|
||||
client: 0,
|
||||
target: 0,
|
||||
shop_type: shop_type,
|
||||
shop_type,
|
||||
num_items: 0,
|
||||
unused: 0,
|
||||
items: items,
|
||||
items,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -14,7 +14,7 @@ use crate::ship::items::ItemManager;
|
||||
|
||||
pub fn player_header(tag: u32, client: &ClientState, area_client: &AreaClient) -> PlayerHeader {
|
||||
PlayerHeader {
|
||||
tag: tag,
|
||||
tag,
|
||||
guildcard: client.user.id.0,
|
||||
_unknown1: [0; 5],
|
||||
client_id: area_client.local_client.id() as u32,
|
||||
@ -40,6 +40,6 @@ pub fn player_info(tag: u32, client: &ClientState, area_client: &AreaClient, ite
|
||||
language: 0, // TODO: account language
|
||||
items: inventory.as_client_inventory_items(),
|
||||
},
|
||||
character: character,
|
||||
character,
|
||||
}
|
||||
}
|
||||
|
@ -59,9 +59,9 @@ pub fn quest_header(quest_menu_select: &QuestMenuSelect, data_blob: &[u8], suffi
|
||||
|
||||
pub fn quest_chunk(chunk_num: u32, filename: [u8; 16], blob: [u8; 0x400], blob_length: usize) -> QuestChunk {
|
||||
QuestChunk {
|
||||
chunk_num: chunk_num,
|
||||
filename: filename,
|
||||
blob: blob,
|
||||
chunk_num,
|
||||
filename,
|
||||
blob,
|
||||
blob_length: blob_length as u32,
|
||||
unknown: 0,
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ pub fn join_room(id: ClientId,
|
||||
Ok(JoinRoom {
|
||||
flag: all_clients.len() as u32,
|
||||
maps: room.maps.map_headers(),
|
||||
players: players,
|
||||
players,
|
||||
client: area_client.local_client.id(),
|
||||
leader: leader.local_client.id(),
|
||||
one: 1,
|
||||
|
@ -1,16 +1,7 @@
|
||||
use libpso::packet::login::{ShipList, ShipListEntry};
|
||||
use libpso::packet::ship::*;
|
||||
use crate::common::serverstate::ClientId;
|
||||
use crate::common::leveltable::CharacterLevelTable;
|
||||
use crate::ship::ship::{ShipError, ClientState, Clients};
|
||||
use crate::ship::location::{ClientLocation, RoomId, AreaClient, ClientLocationError};
|
||||
use crate::ship::room::RoomState;
|
||||
use crate::ship::items::ItemManager;
|
||||
use crate::ship::packet::builder::{player_header, player_info};
|
||||
use libpso::utf8_to_utf16_array;
|
||||
|
||||
use crate::common::interserver::Ship;
|
||||
use libpso::packet::ship::BLOCK_MENU_ID;
|
||||
use crate::login::character::SHIP_MENU_ID;
|
||||
|
||||
pub fn ship_list(ships: &[Ship]) -> ShipList {
|
||||
|
@ -2,7 +2,7 @@ use libpso::packet::login::{Login, LoginResponse, AccountStatus, Session};
|
||||
use libpso::packet::ship::*;
|
||||
use crate::common::serverstate::ClientId;
|
||||
use crate::ship::ship::{SendShipPacket, ShipError, ClientState, Clients};
|
||||
use crate::login::login::{get_login_status, check_if_already_online};
|
||||
use crate::login::login::get_login_status;
|
||||
use crate::entity::gateway::EntityGateway;
|
||||
use crate::ship::items::ItemManager;
|
||||
use crate::common::interserver::ShipMessage;
|
||||
|
@ -1,12 +1,11 @@
|
||||
use libpso::packet::ship::*;
|
||||
use libpso::packet::messages::*;
|
||||
use crate::entity::gateway::EntityGateway;
|
||||
use crate::entity::item::{ItemType};
|
||||
use crate::common::serverstate::ClientId;
|
||||
use crate::common::leveltable::CharacterLevelTable;
|
||||
use crate::ship::ship::{SendShipPacket, ShipError, Rooms, Clients, ItemDropLocation};
|
||||
use crate::ship::location::{ClientLocation, ClientLocationError};
|
||||
use crate::ship::items::{ItemManager, ClientItemId, InventoryItem};
|
||||
use crate::ship::items::{ItemManager, ClientItemId};
|
||||
use crate::ship::packet::builder;
|
||||
|
||||
pub async fn request_exp<EG: EntityGateway>(id: ClientId,
|
||||
|
@ -191,16 +191,16 @@ impl Quest {
|
||||
prs_dat.write_all(&dat)?;
|
||||
|
||||
Ok(Quest {
|
||||
name: name,
|
||||
description: description,
|
||||
full_description: full_description,
|
||||
id: id,
|
||||
language: language,
|
||||
name,
|
||||
description,
|
||||
full_description,
|
||||
id,
|
||||
language,
|
||||
bin_blob: prs_bin.into_inner().map_err(|_| QuestLoadError::CouldNotReadMetadata)?,
|
||||
dat_blob: prs_dat.into_inner().map_err(|_| QuestLoadError::CouldNotReadMetadata)?,
|
||||
enemies: enemies,
|
||||
objects: objects,
|
||||
map_areas: map_areas,
|
||||
enemies,
|
||||
objects,
|
||||
map_areas,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -238,7 +238,7 @@ impl RoomState {
|
||||
name: String::from_utf16_lossy(&create_room.name).trim_matches(char::from(0)).into(),
|
||||
password: create_room.password,
|
||||
maps: Maps::new(room_mode),
|
||||
section_id: section_id,
|
||||
section_id,
|
||||
drop_table: Box::new(DropTable::new(room_mode.episode(), room_mode.difficulty(), section_id)),
|
||||
bursting: false,
|
||||
map_areas: MapAreaLookup::new(&room_mode.episode()),
|
||||
|
@ -263,7 +263,7 @@ impl<R: Rng + SeedableRng> ToolShop<R> {
|
||||
};
|
||||
|
||||
ToolShopItem::Tech(TechniqueDisk {
|
||||
tech: tech,
|
||||
tech,
|
||||
level: level as u32,
|
||||
})
|
||||
})
|
||||
|
@ -329,8 +329,8 @@ pub struct WeaponShop<R: Rng + SeedableRng> {
|
||||
impl<R: Rng + SeedableRng> WeaponShop<R> {
|
||||
pub fn new(difficulty: Difficulty, section_id: SectionID) -> WeaponShop<R> {
|
||||
WeaponShop {
|
||||
difficulty: difficulty,
|
||||
section_id: section_id,
|
||||
difficulty,
|
||||
section_id,
|
||||
weapon: load_weapon_table(difficulty, section_id),
|
||||
special: load_special_table(),
|
||||
grind: load_grind_table(),
|
||||
@ -405,7 +405,7 @@ impl<R: Rng + SeedableRng> WeaponShop<R> {
|
||||
.choose(&mut self.rng)?;
|
||||
|
||||
Some(WeaponAttribute {
|
||||
attr: attr,
|
||||
attr,
|
||||
value: percent as i8,
|
||||
})
|
||||
}
|
||||
@ -432,7 +432,7 @@ impl<R: Rng + SeedableRng> WeaponShop<R> {
|
||||
.choose(&mut self.rng)?;
|
||||
|
||||
Some(WeaponAttribute {
|
||||
attr: attr,
|
||||
attr,
|
||||
value: percent as i8,
|
||||
})
|
||||
}
|
||||
@ -512,9 +512,9 @@ impl<R: Rng + SeedableRng> WeaponShop<R> {
|
||||
};
|
||||
|
||||
WeaponShopItem {
|
||||
weapon: weapon,
|
||||
grind: grind,
|
||||
special: special,
|
||||
weapon,
|
||||
grind,
|
||||
special,
|
||||
attributes: [attr1, attr2],
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user