diff --git a/server/gameserver/player.cc b/server/gameserver/player.cc index 20bd90c..2d2c24f 100644 --- a/server/gameserver/player.cc +++ b/server/gameserver/player.cc @@ -575,9 +575,11 @@ void Player::LootInteraction(Loot* entity) if (item_meta->i->equip_subtype() == 1) { //近战 if (default_weapon.weapon_id != weapons[0].weapon_id) { + /* cs::SMPickup notifymsg; notifymsg.set_error_code(2); SendNotifyMsg(notifymsg); + */ return; } else { weapons[0].weapon_idx = 0; @@ -603,9 +605,11 @@ void Player::LootInteraction(Loot* entity) } } if (!weapon) { + /* cs::SMPickup notifymsg; notifymsg.set_error_code(2); SendNotifyMsg(notifymsg); + */ return; } weapon->weapon_id = entity->item_id; @@ -634,9 +638,11 @@ void Player::LootInteraction(Loot* entity) if (GetInventory(item_meta->i->_inventory_slot()) >= GetVolume(item_meta->i->_inventory_slot()) ) { + /* cs::SMPickup notifymsg; notifymsg.set_error_code(1); SendNotifyMsg(notifymsg); + */ return; } int add_num = GetVolume(item_meta->i->_inventory_slot()) - diff --git a/server/gameserver/room.cc b/server/gameserver/room.cc index 893edd4..2534e4a 100644 --- a/server/gameserver/room.cc +++ b/server/gameserver/room.cc @@ -336,12 +336,20 @@ void Room::FillSMMapInfo(cs::SMMapInfo& map_info) void Room::DropItem(Vector2D pos, int item_id, int item_count) { - { - Vector2D dir = Vector2D::UP; - dir.Rotate(a8::RandAngle()); - pos = pos + dir * (25 + rand() % 50); + MetaData::Equip* equip_meta = MetaMgr::Instance()->GetEquip(item_id); + if (equip_meta && equip_meta->i->group_num() > 0 && item_count > 0) { + int total_count = item_count; + 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) diff --git a/server/tools/protobuild/cs_proto.proto b/server/tools/protobuild/cs_proto.proto index 42ea21e..7ff4f1d 100755 --- a/server/tools/protobuild/cs_proto.proto +++ b/server/tools/protobuild/cs_proto.proto @@ -682,14 +682,6 @@ message SMGameOver 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 { diff --git a/server/tools/protobuild/metatable.proto b/server/tools/protobuild/metatable.proto index 1304e61..fc63c68 100755 --- a/server/tools/protobuild/metatable.proto +++ b/server/tools/protobuild/metatable.proto @@ -66,10 +66,11 @@ message Equip optional int32 time = 17; //时间 optional string volume = 19; //装备容量 optional int32 bullet_rad = 20; //子弹半径 + optional int32 group_num = 21; //每组数量 optional string bullet_born_offset = 30; //子弹出生偏移 - optional string inventory_slot = 21; //库存槽位 - optional int32 _inventory_slot = 22; //库存槽位 + optional string inventory_slot = 31; //库存槽位 + optional int32 _inventory_slot = 32; //库存槽位 } message Player