完成背包数值

This commit is contained in:
aozhiwei 2019-04-26 15:36:34 +08:00
parent 38a05c0214
commit 22d271e65e
4 changed files with 22 additions and 15 deletions

View File

@ -575,9 +575,11 @@ void Player::LootInteraction(Loot* entity)
if (item_meta->i->equip_subtype() == 1) { if (item_meta->i->equip_subtype() == 1) {
//近战 //近战
if (default_weapon.weapon_id != weapons[0].weapon_id) { if (default_weapon.weapon_id != weapons[0].weapon_id) {
/*
cs::SMPickup notifymsg; cs::SMPickup notifymsg;
notifymsg.set_error_code(2); notifymsg.set_error_code(2);
SendNotifyMsg(notifymsg); SendNotifyMsg(notifymsg);
*/
return; return;
} else { } else {
weapons[0].weapon_idx = 0; weapons[0].weapon_idx = 0;
@ -603,9 +605,11 @@ void Player::LootInteraction(Loot* entity)
} }
} }
if (!weapon) { if (!weapon) {
/*
cs::SMPickup notifymsg; cs::SMPickup notifymsg;
notifymsg.set_error_code(2); notifymsg.set_error_code(2);
SendNotifyMsg(notifymsg); SendNotifyMsg(notifymsg);
*/
return; return;
} }
weapon->weapon_id = entity->item_id; weapon->weapon_id = entity->item_id;
@ -634,9 +638,11 @@ void Player::LootInteraction(Loot* entity)
if (GetInventory(item_meta->i->_inventory_slot()) >= if (GetInventory(item_meta->i->_inventory_slot()) >=
GetVolume(item_meta->i->_inventory_slot()) GetVolume(item_meta->i->_inventory_slot())
) { ) {
/*
cs::SMPickup notifymsg; cs::SMPickup notifymsg;
notifymsg.set_error_code(1); notifymsg.set_error_code(1);
SendNotifyMsg(notifymsg); SendNotifyMsg(notifymsg);
*/
return; return;
} }
int add_num = GetVolume(item_meta->i->_inventory_slot()) - int add_num = GetVolume(item_meta->i->_inventory_slot()) -

View File

@ -336,12 +336,20 @@ void Room::FillSMMapInfo(cs::SMMapInfo& map_info)
void Room::DropItem(Vector2D pos, int item_id, int item_count) void Room::DropItem(Vector2D pos, int item_id, int item_count)
{ {
{ MetaData::Equip* equip_meta = MetaMgr::Instance()->GetEquip(item_id);
Vector2D dir = Vector2D::UP; if (equip_meta && equip_meta->i->group_num() > 0 && item_count > 0) {
dir.Rotate(a8::RandAngle()); int total_count = item_count;
pos = pos + dir * (25 + rand() % 50); while (total_count > 0) {
int drop_num = std::min(total_count, equip_meta->i->group_num());
{
Vector2D dir = Vector2D::UP;
dir.Rotate(a8::RandAngle());
pos = pos + dir * (25 + rand() % 50);
}
CreateLoot(item_id, pos, drop_num);
total_count -= drop_num;
}
} }
CreateLoot(item_id, pos, item_count);
} }
void Room::CreateBuilding(int thing_id, float building_x, float building_y) void Room::CreateBuilding(int thing_id, float building_x, float building_y)

View File

@ -682,14 +682,6 @@ message SMGameOver
repeated MFPlayerStats player_stats = 6; // repeated MFPlayerStats player_stats = 6; //
} }
//
message SMPickup
{
optional int32 error_code = 1; //0: 1: 2: 3:
optional int32 item_id = 2; //id
optional int32 count = 3; //
}
//线 //线
message SMDisconnectNotify message SMDisconnectNotify
{ {

View File

@ -66,10 +66,11 @@ message Equip
optional int32 time = 17; // optional int32 time = 17; //
optional string volume = 19; // optional string volume = 19; //
optional int32 bullet_rad = 20; // optional int32 bullet_rad = 20; //
optional int32 group_num = 21; //
optional string bullet_born_offset = 30; // optional string bullet_born_offset = 30; //
optional string inventory_slot = 21; // optional string inventory_slot = 31; //
optional int32 _inventory_slot = 22; // optional int32 _inventory_slot = 32; //
} }
message Player message Player