This commit is contained in:
aozhiwei 2022-11-21 16:52:24 +08:00
parent 887454e786
commit a1e724fea7
3 changed files with 46 additions and 5 deletions

View File

@ -4283,11 +4283,54 @@ void Human::ProcAddItemDto(AddItemDTO& dto)
void Human::DropWeapon(int weapon_idx, int num)
{
num = std::max(1, num);
switch (weapon_idx) {
case 101:
{
//医疗包
int slot_id = IS_HEALTHKIT;
if (GetInventory(slot_id) > 0) {
num = std::max(1, GetInventory(slot_id));
DecInventory(slot_id, num);
MarkSyncActivePlayer(__FILE__, __LINE__, __func__);
}
return;
}
break;
case 102:
{
//止痛药
int slot_id = IS_PAIN_KILLER;
if (GetInventory(slot_id) > 0) {
num = std::max(1, GetInventory(slot_id));
DecInventory(slot_id, num);
MarkSyncActivePlayer(__FILE__, __LINE__, __func__);
}
return;
}
break;
case 103:
{
//肾上腺速
int slot_id = IS_SHEN_BAO;
if (GetInventory(slot_id) > 0) {
num = std::max(1, GetInventory(slot_id));
DecInventory(slot_id, num);
MarkSyncActivePlayer(__FILE__, __LINE__, __func__);
}
return;
}
break;
default:
{
}
break;
}
if (weapon_idx < 0 ||
weapon_idx >= weapons.size()) {
return;
}
num = std::max(1, num);
bool drop_ok = false;
Weapon* weapon = &weapons[weapon_idx];
int weapon_id = weapon->weapon_id;

View File

@ -1090,9 +1090,7 @@ void Player::_CMExecCommand(f8::MsgHdr& hdr, const cs::CMExecCommand& msg)
void Player::UpdateDropWeapon()
{
if (drop_weapon_idx >= 0 &&
drop_weapon_idx < weapons.size() &&
!FreezeOperate()) {
if (!FreezeOperate()) {
DropWeapon(drop_weapon_idx, drop_num);
}
ResetAction();

View File

@ -1040,7 +1040,7 @@ message CMMove
optional float fly_distance = 7; //()
optional int32 select_weapon = 8; //()
optional int32 drop_weapon = 9; //
optional int32 drop_weapon = 9; // 101 102 103:
optional int32 drop_num = 43; //()
optional bool cancel_action = 10; //(使)