remove 3rd attr for killcounter weapons and fix tests
This commit is contained in:
parent
b4866a3e59
commit
0976bd9ab0
@ -97,21 +97,19 @@ impl RareDropTable {
|
||||
pub fn apply_item_stats<R: Rng>(&self, map_area: &MapArea, item: RareDropItem, rng: &mut R) -> ItemDropType {
|
||||
match item {
|
||||
RareDropItem::Weapon(weapon) => {
|
||||
ItemDropType::Weapon(Weapon {
|
||||
let mut dropped_weapon = Weapon {
|
||||
weapon,
|
||||
special: None,
|
||||
grind: 0,
|
||||
attrs: self.attribute_table.generate_rare_attributes(map_area, rng),
|
||||
tekked: false,
|
||||
kills: {
|
||||
if weapon.has_counter() {
|
||||
Some(0)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
},
|
||||
})
|
||||
|
||||
kills: None,
|
||||
};
|
||||
if dropped_weapon.weapon.has_counter() {
|
||||
dropped_weapon.attrs[2] = None;
|
||||
dropped_weapon.kills = Some(0);
|
||||
};
|
||||
ItemDropType::Weapon(dropped_weapon)
|
||||
},
|
||||
RareDropItem::Armor(armor) => {
|
||||
ItemDropType::Armor(Armor {
|
||||
|
@ -79,7 +79,6 @@ pub async fn request_item<EG>(id: ClientId,
|
||||
where
|
||||
EG: EntityGateway
|
||||
{
|
||||
println!("src::ship::packet::handler::request_item() - requesting an item!");
|
||||
let room_id = client_location.get_room(id).map_err(|err| -> ClientLocationError { err.into() })?;
|
||||
let room = rooms.get_mut(room_id.0)
|
||||
.ok_or(ShipError::InvalidRoom(room_id.0 as u32))?
|
||||
@ -87,9 +86,7 @@ where
|
||||
.ok_or(ShipError::InvalidRoom(room_id.0 as u32))?;
|
||||
|
||||
let monster = room.maps.enemy_by_id(request_item.enemy_id as usize)?;
|
||||
println!("room id: {:?}, monster: {:?}", room_id, monster);
|
||||
if monster.dropped_item {
|
||||
println!("monster {:?} already dropped an item!", monster);
|
||||
return Err(ShipError::MonsterAlreadyDroppedItem(id, request_item.enemy_id).into())
|
||||
}
|
||||
|
||||
@ -98,7 +95,6 @@ where
|
||||
let client_and_drop = clients_in_area.into_iter()
|
||||
.filter_map(|area_client| {
|
||||
if room.redbox {
|
||||
println!("red box mode is currently enabled. dropping red box!");
|
||||
room.drop_table.get_rare_drop(&monster.map_area, &monster.monster).map(|item_drop_type| {
|
||||
(area_client, item_drop_type)
|
||||
})
|
||||
|
@ -542,7 +542,6 @@ impl<EG: EntityGateway> ShipServerState<EG> {
|
||||
handler::direct_message::guildcard_send(id, guildcard_send, target, &block.client_location, &self.clients)
|
||||
},
|
||||
GameMessage::RequestItem(request_item) => {
|
||||
println!("someone requested an item from the ship!");
|
||||
handler::direct_message::request_item(id, request_item, &mut self.entity_gateway, &block.client_location, &mut self.clients, &mut block.rooms, &mut self.item_manager).await?
|
||||
},
|
||||
GameMessage::PickupItem(pickup_item) => {
|
||||
|
@ -40,58 +40,11 @@ async fn test_item_drops_with_kill_counter() {
|
||||
join_lobby(&mut ship, ClientId(1)).await;
|
||||
create_ep2_room_with_difficulty(&mut ship, ClientId(1), "room", "", Difficulty::Ultimate).await;
|
||||
|
||||
// ship.handle(ClientId(1), &RecvShipPacket()).await.unwrap().for_each(drop);
|
||||
|
||||
// ship.handle(ClientId(1), &RecvShipPacket::Message(Message::new(GameMessage::PlayerWarpingToFloor(PlayerWarpingToFloor{
|
||||
// client: 0,
|
||||
// target: 0,
|
||||
// area: 9, // seaside
|
||||
// data: 0,
|
||||
// })))).await.unwrap().for_each(drop);
|
||||
|
||||
|
||||
// ship.handle(ClientId(1), &RecvShipPacket::Message(Message::new(GameMessage::PlayerWarping(PlayerWarping{
|
||||
// client: 0,
|
||||
// target: 0,
|
||||
// })))).await.unwrap().for_each(drop);
|
||||
|
||||
// ship.handle(ClientId(1), &RecvShipPacket::Message(Message::new(GameMessage::PlayerLoadedIn(PlayerLoadedIn{
|
||||
// client: 0,
|
||||
// target: 0,
|
||||
// unknown1: [0,0],
|
||||
// rotation: 0,
|
||||
// area: 9,
|
||||
// room: 1,
|
||||
// x: 100.0,
|
||||
// y: 10.0,
|
||||
// z: -20.0,
|
||||
// })))).await.unwrap().for_each(drop);
|
||||
|
||||
// ship.handle(ClientId(1), &RecvShipPacket::Message(Message::new(GameMessage::PlayerChangedMap2(PlayerChangedMap2{
|
||||
// client: 0,
|
||||
// target: 0,
|
||||
// map_area: 9,
|
||||
// _unknown1: 0,
|
||||
// })))).await.unwrap().for_each(drop);
|
||||
|
||||
// ship.handle(ClientId(1), &RecvShipPacket::Message(Message::new(GameMessage::PlayerSpawnedIntoArea(PlayerSpawnedIntoArea{
|
||||
// client: 0,
|
||||
// target: 0,
|
||||
// })))).await.unwrap().for_each(drop);
|
||||
|
||||
// ship.handle(ClientId(1), &RecvShipPacket::Message(Message::new(GameMessage::PlayerDoneChangingMap(PlayerDoneChangingMap{
|
||||
// client: 0,
|
||||
// target: 0,
|
||||
// })))).await.unwrap().for_each(drop);
|
||||
|
||||
let room = ship.blocks.0[0].rooms[0].as_mut().unwrap();
|
||||
room.toggle_redbox_mode(); // enable redbox mode for sjs
|
||||
|
||||
// println!("room redbox mode: {:?}", room.redbox);
|
||||
// println!("room.mode: {:?}", room.mode);
|
||||
// println!("killing gigue for sjs!");
|
||||
let gigue_id = room.maps.get_enemy_id_by_monster_type(MonsterType::GiGue).unwrap();
|
||||
// println!("found gigue id: {:?}!", gigue_id);
|
||||
|
||||
let packets = ship.handle(ClientId(1), &RecvShipPacket::DirectMessage(DirectMessage::new(0, GameMessage::RequestItem(RequestItem {
|
||||
client: 0,
|
||||
target: 0,
|
||||
@ -108,7 +61,7 @@ async fn test_item_drops_with_kill_counter() {
|
||||
SendShipPacket::Message(Message {msg: GameMessage::ItemDrop(item_drop)}) => {
|
||||
assert_eq!(item_drop.item_bytes[10], 0x80)
|
||||
}
|
||||
_ => panic!("")
|
||||
_ => panic!("SJS didn't drop with the expected value! attr[2] should be 0x80 (128) for 0 kills")
|
||||
}
|
||||
}
|
||||
|
||||
@ -156,18 +109,15 @@ async fn test_all_equipped_kill_counters_increase_per_kill() {
|
||||
unit: [Some(p1_inv[1].id), None, None, None],
|
||||
mag: None,
|
||||
};
|
||||
|
||||
entity_gateway.set_character_equips(&char1.id, &equipped).await.unwrap();
|
||||
entity_gateway.set_character_inventory(&char1.id, &item::InventoryEntity::new(p1_inv)).await.unwrap();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
log_in_char(&mut ship, ClientId(1), "a1", "a").await;
|
||||
join_lobby(&mut ship, ClientId(1)).await;
|
||||
create_room(&mut ship, ClientId(1), "room", "").await;
|
||||
|
||||
|
||||
assert!(true);
|
||||
}
|
||||
|
||||
// #[async_std::test]
|
||||
|
Loading…
x
Reference in New Issue
Block a user