1
This commit is contained in:
parent
b6a9003514
commit
fab51d4d99
@ -524,11 +524,7 @@ void Player::LootInteraction(Loot* entity)
|
||||
} else {
|
||||
weapons[0].weapon_idx = 0;
|
||||
weapons[0].weapon_id = entity->item_id;
|
||||
#if 1
|
||||
weapons[0].weapon_lv = std::max(1, entity->item_level);
|
||||
#else
|
||||
weapons[0].weapon_lv = std::max(1, GetWeaponConfigLv(weapons[0].weapon_id));
|
||||
#endif
|
||||
weapons[0].ammo = 0;
|
||||
weapons[0].meta = item_meta;
|
||||
weapons[0].Recalc();
|
||||
@ -537,17 +533,18 @@ void Player::LootInteraction(Loot* entity)
|
||||
SyncAroundPlayers(__FILE__, __LINE__, __func__);
|
||||
} else {
|
||||
Weapon* weapon = nullptr;
|
||||
bool switch_gun = false;
|
||||
if (weapons[GUN_SLOT1].weapon_id == 0) {
|
||||
weapon = &weapons[GUN_SLOT1];
|
||||
weapon->weapon_idx = GUN_SLOT1;
|
||||
if (GetCurrWeapon() != &weapons[GUN_SLOT2] && !FreezeOperate()) {
|
||||
SetCurrWeapon(&weapons[GUN_SLOT1]);
|
||||
switch_gun = true;
|
||||
}
|
||||
} else if (weapons[GUN_SLOT2].weapon_id == 0) {
|
||||
weapon = &weapons[GUN_SLOT2];
|
||||
weapon->weapon_idx = GUN_SLOT2;
|
||||
if (GetCurrWeapon() != &weapons[GUN_SLOT1] && !FreezeOperate()) {
|
||||
SetCurrWeapon(&weapons[GUN_SLOT2]);
|
||||
switch_gun = true;
|
||||
}
|
||||
}
|
||||
if (!weapon) {
|
||||
@ -559,11 +556,7 @@ void Player::LootInteraction(Loot* entity)
|
||||
return;
|
||||
}
|
||||
weapon->weapon_id = entity->item_id;
|
||||
#if 1
|
||||
weapon->weapon_lv = std::max(1, entity->item_level);
|
||||
#else
|
||||
weapon->weapon_lv = std::max(1, GetWeaponConfigLv(weapon->weapon_id));
|
||||
#endif
|
||||
weapon->ammo = 0;
|
||||
weapon->meta = item_meta;
|
||||
weapon->Recalc();
|
||||
@ -571,6 +564,9 @@ void Player::LootInteraction(Loot* entity)
|
||||
} else {
|
||||
AutoLoadingBullet();
|
||||
}
|
||||
if (switch_gun) {
|
||||
SetCurrWeapon(weapon);
|
||||
}
|
||||
need_sync_active_player = true;
|
||||
SyncAroundPlayers(__FILE__, __LINE__, __func__);
|
||||
}
|
||||
|
@ -20,55 +20,59 @@ void Trigger::UnInit()
|
||||
void Trigger::TakeonWeapon(Weapon* old_weapon, Weapon* new_weapon)
|
||||
{
|
||||
{
|
||||
MetaData::Equip* weapon_meta = new_weapon->meta;
|
||||
for (int cond = kCondBuffUpdateWeaponId; cond <= kCondBuffUpdateWeaponType; cond++) {
|
||||
TraverseCondBuffs
|
||||
(cond,
|
||||
[this, cond, weapon_meta] (Buff* buff, bool& stop)
|
||||
{
|
||||
if (weapon_meta->Match((CondAddBuff_e)cond, buff->meta->int_param2)) {
|
||||
switch (buff->meta->int_param3) {
|
||||
case kWeaponOptTakeoff:
|
||||
case kWeaponOptKeep:
|
||||
{
|
||||
RemoveBuffs(buff->meta->int_param1, buff->meta->param4_int_list);
|
||||
MetaData::Equip* weapon_meta = old_weapon ? old_weapon->meta : nullptr;
|
||||
if (weapon_meta) {
|
||||
for (int cond = kCondBuffUpdateWeaponId; cond <= kCondBuffUpdateWeaponType; cond++) {
|
||||
TraverseCondBuffs
|
||||
(cond,
|
||||
[this, cond, weapon_meta] (Buff* buff, bool& stop)
|
||||
{
|
||||
if (weapon_meta->Match((CondAddBuff_e)cond, buff->meta->int_param3)) {
|
||||
switch (buff->meta->int_param2) {
|
||||
case kWeaponOptTakeoff:
|
||||
case kWeaponOptKeep:
|
||||
{
|
||||
RemoveBuffs(buff->meta->int_param1, buff->meta->param4_int_list);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
MetaData::Equip* weapon_meta = new_weapon->meta;
|
||||
for (int cond = kCondBuffUpdateWeaponId; cond <= kCondBuffUpdateWeaponType; cond++) {
|
||||
TraverseCondBuffs
|
||||
(cond,
|
||||
[this, cond, weapon_meta] (Buff* buff, bool& stop)
|
||||
{
|
||||
if (weapon_meta->Match((CondAddBuff_e)cond, buff->meta->int_param2)) {
|
||||
switch (buff->meta->int_param3) {
|
||||
case kWeaponOptTakeon:
|
||||
{
|
||||
AddBuffs(buff->meta->int_param1, buff->meta->param4_int_list);
|
||||
MetaData::Equip* weapon_meta = new_weapon ? new_weapon->meta : nullptr;
|
||||
if (weapon_meta) {
|
||||
for (int cond = kCondBuffUpdateWeaponId; cond <= kCondBuffUpdateWeaponType; cond++) {
|
||||
TraverseCondBuffs
|
||||
(cond,
|
||||
[this, cond, weapon_meta] (Buff* buff, bool& stop)
|
||||
{
|
||||
if (weapon_meta->Match((CondAddBuff_e)cond, buff->meta->int_param3)) {
|
||||
switch (buff->meta->int_param2) {
|
||||
case kWeaponOptTakeon:
|
||||
{
|
||||
AddBuffs(buff->meta->int_param1, buff->meta->param4_int_list);
|
||||
}
|
||||
break;
|
||||
case kWeaponOptKeep:
|
||||
{
|
||||
TryAddBuffs(buff->meta->int_param1, buff->meta->param4_int_list);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case kWeaponOptKeep:
|
||||
{
|
||||
TryAddBuffs(buff->meta->int_param1, buff->meta->param4_int_list);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -214,8 +218,8 @@ void Trigger::ActiveBuff(MetaData::Buff* buff_meta)
|
||||
(cond,
|
||||
[this, cond, buff_meta] (Buff* buff, bool& stop)
|
||||
{
|
||||
if (buff_meta->Match((CondAddBuff_e)cond, buff->meta->int_param2)) {
|
||||
switch (buff->meta->int_param3) {
|
||||
if (buff_meta->Match((CondAddBuff_e)cond, buff->meta->int_param3)) {
|
||||
switch (buff->meta->int_param2) {
|
||||
case kBuffOptActive:
|
||||
{
|
||||
AddBuffs(buff->meta->int_param1, buff->meta->param4_int_list);
|
||||
@ -243,8 +247,8 @@ void Trigger::DeactiveBuff(MetaData::Buff* buff_meta)
|
||||
(cond,
|
||||
[this, cond, buff_meta] (Buff* buff, bool& stop)
|
||||
{
|
||||
if (buff_meta->Match((CondAddBuff_e)cond, buff->meta->int_param2)) {
|
||||
switch (buff->meta->int_param3) {
|
||||
if (buff_meta->Match((CondAddBuff_e)cond, buff->meta->int_param3)) {
|
||||
switch (buff->meta->int_param2) {
|
||||
case kBuffOptDeactive:
|
||||
case kBuffOptKeep:
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user