完成背包数值
This commit is contained in:
parent
38a05c0214
commit
22d271e65e
@ -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()) -
|
||||||
|
@ -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);
|
||||||
|
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;
|
Vector2D dir = Vector2D::UP;
|
||||||
dir.Rotate(a8::RandAngle());
|
dir.Rotate(a8::RandAngle());
|
||||||
pos = pos + dir * (25 + rand() % 50);
|
pos = pos + dir * (25 + rand() % 50);
|
||||||
}
|
}
|
||||||
CreateLoot(item_id, pos, item_count);
|
CreateLoot(item_id, pos, drop_num);
|
||||||
|
total_count -= drop_num;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Room::CreateBuilding(int thing_id, float building_x, float building_y)
|
void Room::CreateBuilding(int thing_id, float building_x, float building_y)
|
||||||
|
@ -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
|
||||||
{
|
{
|
||||||
|
@ -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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user