Browse Source

killcounters, redbox mode, failing unseal test, and random debug strings

kill_counters
andy 3 years ago
parent
commit
a5a21d0968
  1. 4
      src/ship/packet/handler/direct_message.rs
  2. 3
      tests/test_unseal_items.rs

4
src/ship/packet/handler/direct_message.rs

@ -79,6 +79,7 @@ pub async fn request_item<EG>(id: ClientId,
where where
EG: EntityGateway 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_id = client_location.get_room(id).map_err(|err| -> ClientLocationError { err.into() })?;
let room = rooms.get_mut(room_id.0) let room = rooms.get_mut(room_id.0)
.ok_or(ShipError::InvalidRoom(room_id.0 as u32))? .ok_or(ShipError::InvalidRoom(room_id.0 as u32))?
@ -86,7 +87,9 @@ where
.ok_or(ShipError::InvalidRoom(room_id.0 as u32))?; .ok_or(ShipError::InvalidRoom(room_id.0 as u32))?;
let monster = room.maps.enemy_by_id(request_item.enemy_id as usize)?; let monster = room.maps.enemy_by_id(request_item.enemy_id as usize)?;
println!("room id: {:?}, monster: {:?}", room_id, monster);
if monster.dropped_item { if monster.dropped_item {
println!("monster {:?} already dropped an item!", monster);
return Err(ShipError::MonsterAlreadyDroppedItem(id, request_item.enemy_id).into()) return Err(ShipError::MonsterAlreadyDroppedItem(id, request_item.enemy_id).into())
} }
@ -95,6 +98,7 @@ where
let client_and_drop = clients_in_area.into_iter() let client_and_drop = clients_in_area.into_iter()
.filter_map(|area_client| { .filter_map(|area_client| {
if room.redbox { 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| { room.drop_table.get_rare_drop(&monster.map_area, &monster.monster).map(|item_drop_type| {
(area_client, item_drop_type) (area_client, item_drop_type)
}) })

3
tests/test_unseal_items.rs

@ -1,4 +1,7 @@
/* TODO: /* TODO:
1. test to check if sjs/lame/limiter drop with Some() kill counter enabled
2. test to make sure other items drop with None kill counter
3. test kill counters get incremented per kill
4. test unsealing item: 4. test unsealing item:
- client item id does not change - client item id does not change
- unsealed item no longer has kill counter - unsealed item no longer has kill counter

Loading…
Cancel
Save