1
This commit is contained in:
parent
f4a36094e5
commit
1c28033fee
@ -251,7 +251,7 @@ int Creature::AddBuff(Creature* caster,
|
|||||||
SendDebugMsg(a8::Format("添加buff_id:%d effect:%d %s params:%d,%d,%d,%d,%d uniid:%d dur:%d",
|
SendDebugMsg(a8::Format("添加buff_id:%d effect:%d %s params:%d,%d,%d,%d,%d uniid:%d dur:%d",
|
||||||
{
|
{
|
||||||
buff_meta->i->buff_id(),
|
buff_meta->i->buff_id(),
|
||||||
buff_meta->i->buff_effect(),
|
buff_meta->i->buff_effect(),
|
||||||
buff_meta->i->name(),
|
buff_meta->i->name(),
|
||||||
buff_meta->int_param1,
|
buff_meta->int_param1,
|
||||||
buff_meta->int_param2,
|
buff_meta->int_param2,
|
||||||
|
@ -4155,12 +4155,13 @@ void Human::ProcAddItemDto(AddItemDTO& dto)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Human::DropWeapon(int weapon_idx)
|
void Human::DropWeapon(int weapon_idx, int num)
|
||||||
{
|
{
|
||||||
if (weapon_idx < 0 ||
|
if (weapon_idx < 0 ||
|
||||||
weapon_idx >= weapons.size()) {
|
weapon_idx >= weapons.size()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
num = std::max(1, num);
|
||||||
bool drop_ok = false;
|
bool drop_ok = false;
|
||||||
Weapon* weapon = &weapons[weapon_idx];
|
Weapon* weapon = &weapons[weapon_idx];
|
||||||
int weapon_id = weapon->weapon_id;
|
int weapon_id = weapon->weapon_id;
|
||||||
@ -4238,6 +4239,24 @@ void Human::DropWeapon(int weapon_idx)
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
|
weapon_ammo = std::min(weapon->ammo, num);
|
||||||
|
if (weapon_ammo > 0) {
|
||||||
|
drop_ok = true;
|
||||||
|
weapon->ammo = std::max(0, weapon->ammo - weapon_ammo);
|
||||||
|
if (weapon->ammo <= 0) {
|
||||||
|
*weapon = Weapon();
|
||||||
|
weapon->weapon_idx = weapon_idx;
|
||||||
|
if (GetCurrWeapon() == weapon) {
|
||||||
|
Weapon* next_weapon = ChooseNextSpecWeapon(weapon_idx);
|
||||||
|
if (!next_weapon) {
|
||||||
|
next_weapon = AutoChgWeapon();
|
||||||
|
}
|
||||||
|
if (next_weapon) {
|
||||||
|
SetCurrWeapon(next_weapon);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -367,7 +367,7 @@ protected:
|
|||||||
Weapon* TakeonWeapon(MetaData::Equip* equip_meta);
|
Weapon* TakeonWeapon(MetaData::Equip* equip_meta);
|
||||||
void LootInteraction(Loot* entity);
|
void LootInteraction(Loot* entity);
|
||||||
void ProcAddItemDto(AddItemDTO& dto);
|
void ProcAddItemDto(AddItemDTO& dto);
|
||||||
void DropWeapon(int weapon_idx);
|
void DropWeapon(int weapon_idx, int num);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void GenBattleReportData(a8::MutableXObject* params);
|
void GenBattleReportData(a8::MutableXObject* params);
|
||||||
|
@ -855,6 +855,7 @@ void Player::_CMMove(f8::MsgHdr& hdr, const cs::CMMove& msg)
|
|||||||
if (msg.has_drop_weapon()) {
|
if (msg.has_drop_weapon()) {
|
||||||
drop_weapon = true;
|
drop_weapon = true;
|
||||||
drop_weapon_idx = msg.drop_weapon();
|
drop_weapon_idx = msg.drop_weapon();
|
||||||
|
drop_num = msg.drop_num();
|
||||||
}
|
}
|
||||||
if (msg.has_use_scope()) {
|
if (msg.has_use_scope()) {
|
||||||
use_scope = true;
|
use_scope = true;
|
||||||
@ -1067,9 +1068,8 @@ void Player::UpdateDropWeapon()
|
|||||||
{
|
{
|
||||||
if (drop_weapon_idx >= 0 &&
|
if (drop_weapon_idx >= 0 &&
|
||||||
drop_weapon_idx < weapons.size() &&
|
drop_weapon_idx < weapons.size() &&
|
||||||
!HasBuffEffect(kBET_Terminator) &&
|
|
||||||
!FreezeOperate()) {
|
!FreezeOperate()) {
|
||||||
DropWeapon(drop_weapon_idx);
|
DropWeapon(drop_weapon_idx, drop_num);
|
||||||
}
|
}
|
||||||
ResetAction();
|
ResetAction();
|
||||||
AutoLoadingBullet();
|
AutoLoadingBullet();
|
||||||
|
@ -39,6 +39,7 @@ class Player : public Human
|
|||||||
|
|
||||||
bool drop_weapon = false;
|
bool drop_weapon = false;
|
||||||
size_t drop_weapon_idx = 0;
|
size_t drop_weapon_idx = 0;
|
||||||
|
size_t drop_num = 0;
|
||||||
|
|
||||||
bool cancel_action = false;
|
bool cancel_action = false;
|
||||||
|
|
||||||
|
@ -951,6 +951,7 @@ message CMMove
|
|||||||
|
|
||||||
optional int32 select_weapon = 8; //切换武器(没切换是不用发)
|
optional int32 select_weapon = 8; //切换武器(没切换是不用发)
|
||||||
optional int32 drop_weapon = 9; //丢弃武器
|
optional int32 drop_weapon = 9; //丢弃武器
|
||||||
|
optional int32 drop_num = 43; //丢弃武器(数量)
|
||||||
|
|
||||||
optional bool cancel_action = 10; //取消当前操作(比如取消使用道具装弹等)
|
optional bool cancel_action = 10; //取消当前操作(比如取消使用道具装弹等)
|
||||||
optional int32 use_item_idx = 11; //使用道具(对应库存索引0-16)
|
optional int32 use_item_idx = 11; //使用道具(对应库存索引0-16)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user