Browse Source

clippystuff

move_stuff_to_libpso
jake 1 year ago
parent
commit
f1e1fd72af
  1. 1
      src/entity/src/character.rs
  2. 4
      src/items/src/state.rs
  3. 4
      src/location/src/lib.rs
  4. 8
      src/login_server/src/character.rs
  5. 4
      src/pktbuilder/src/character.rs
  6. 3
      src/shops/src/tool.rs

1
src/entity/src/character.rs

@ -1,4 +1,3 @@
use std::convert::{From, Into};
use std::collections::HashMap; use std::collections::HashMap;
use serde::{Serialize, Deserialize}; use serde::{Serialize, Deserialize};

4
src/items/src/state.rs

@ -240,7 +240,7 @@ impl ItemState {
item_id: ClientItemId(0), item_id: ClientItemId(0),
item: InventoryItemDetail::Stacked(StackedItemDetail { item: InventoryItemDetail::Stacked(StackedItemDetail {
entity_ids: items.iter().map(|i| i.id).collect(), entity_ids: items.iter().map(|i| i.id).collect(),
tool: items.get(0)
tool: items.first()
.ok_or_else(|| ItemStateError::StackedItemError(items.clone()))? .ok_or_else(|| ItemStateError::StackedItemError(items.clone()))?
.item .item
.clone() .clone()
@ -284,7 +284,7 @@ impl ItemState {
BankItemEntity::Stacked(items) => { BankItemEntity::Stacked(items) => {
BankItemDetail::Stacked(StackedItemDetail { BankItemDetail::Stacked(StackedItemDetail {
entity_ids: items.iter().map(|i| i.id).collect(), entity_ids: items.iter().map(|i| i.id).collect(),
tool: items.get(0)
tool: items.first()
.ok_or_else(|| ItemStateError::StackedItemError(items.clone()))? .ok_or_else(|| ItemStateError::StackedItemError(items.clone()))?
.item .item
.clone() .clone()

4
src/location/src/lib.rs

@ -317,7 +317,7 @@ impl ClientLocation {
.flatten() .flatten()
.collect::<Vec<_>>(); .collect::<Vec<_>>();
r.sort_by_key(|k| k.time_join); r.sort_by_key(|k| k.time_join);
let c = r.get(0)
let c = r.first()
.ok_or(GetLeaderError::NoClientInArea)?; .ok_or(GetLeaderError::NoClientInArea)?;
Ok(**c) Ok(**c)
} }
@ -332,7 +332,7 @@ impl ClientLocation {
.flatten() .flatten()
.collect::<Vec<_>>(); .collect::<Vec<_>>();
l.sort_by_key(|k| k.time_join); l.sort_by_key(|k| k.time_join);
let c = l.get(0).ok_or(GetLeaderError::NoClientInArea)?;
let c = l.first().ok_or(GetLeaderError::NoClientInArea)?;
Ok(**c) Ok(**c)
} }

8
src/login_server/src/character.rs

@ -754,8 +754,8 @@ fn new_character_from_preview(user: &UserAccountEntity, preview: &CharacterPrevi
let mut character = NewCharacterEntity::new(user.id); let mut character = NewCharacterEntity::new(user.id);
character.slot = preview.slot; character.slot = preview.slot;
character.name = String::from_utf16_lossy(&preview.character.name).trim_matches(char::from(0)).into(); character.name = String::from_utf16_lossy(&preview.character.name).trim_matches(char::from(0)).into();
character.section_id = preview.character.section_id.into();
character.char_class = preview.character.ch_class.into();
character.section_id = preview.character.section_id;
character.char_class = preview.character.ch_class;
character.appearance.costume = preview.character.costume; character.appearance.costume = preview.character.costume;
character.appearance.skin = preview.character.skin; character.appearance.skin = preview.character.skin;
character.appearance.face = preview.character.face; character.appearance.face = preview.character.face;
@ -810,8 +810,8 @@ impl<'a> SelectScreenCharacterBuilder<'a> {
//model: character.model, //model: character.model,
//_unused: [0; 15], //_unused: [0; 15],
//name_color_checksum: character.name_color_checksum, //name_color_checksum: character.name_color_checksum,
section_id: character.section_id.into(),
ch_class: character.char_class.into(),
section_id: character.section_id,
ch_class: character.char_class,
//v2flags: character.v2flags, //v2flags: character.v2flags,
//version: character.version, //version: character.version,
//v1flags: character.v1flags, //v1flags: character.v1flags,

4
src/pktbuilder/src/character.rs

@ -62,8 +62,8 @@ impl<'a> CharacterBytesBuilder<'a> {
ata: stats.ata, ata: stats.ata,
lck: stats.lck + character.materials.luck as u16 * 2, lck: stats.lck + character.materials.luck as u16 * 2,
level, level,
section_id: character.section_id.into(),
ch_class: character.char_class.into(),
section_id: character.section_id,
ch_class: character.char_class,
costume: character.appearance.costume, costume: character.appearance.costume,
skin: character.appearance.skin, skin: character.appearance.skin,
face: character.appearance.face, face: character.appearance.face,

3
src/shops/src/tool.rs

@ -231,9 +231,6 @@ impl<R: Rng + SeedableRng> ToolShop<R> {
else { else {
let mut techs = Vec::new(); let mut techs = Vec::new();
let tier = tier.techs.iter() let tier = tier.techs.iter()
.map(|(tech, entry)| {
(tech, entry)
})
.collect::<Vec<_>>(); .collect::<Vec<_>>();
let tech_choice = WeightedIndex::new(tier.iter().map(|(_, e)| e.probability)).unwrap(); let tech_choice = WeightedIndex::new(tier.iter().map(|(_, e)| e.probability)).unwrap();

Loading…
Cancel
Save