1
This commit is contained in:
parent
1436e0ae7e
commit
2ffe856c05
@ -3495,21 +3495,11 @@ void Human::GMAddItem(int item_id, int item_num)
|
||||
weapons[0].Recalc();
|
||||
}
|
||||
} else {
|
||||
Weapon* weapon = nullptr;
|
||||
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]);
|
||||
}
|
||||
} 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]);
|
||||
}
|
||||
}
|
||||
Weapon* weapon = weapon = TakeonWeapon(item_meta);
|
||||
if (weapon) {
|
||||
if (GetCurrWeapon() != weapon) {
|
||||
SetCurWeapon(weapon);
|
||||
}
|
||||
weapon->weapon_id = item_id;
|
||||
weapon->weapon_lv = std::max(1, 1);
|
||||
weapon->ammo = 0;
|
||||
@ -3865,7 +3855,7 @@ void Human::ProcUseItem(int item_id)
|
||||
}
|
||||
}
|
||||
|
||||
Weapon* Human::TakeWeapon(MetaData::Equip* equip_meta)
|
||||
Weapon* Human::TakeonWeapon(MetaData::Equip* equip_meta)
|
||||
{
|
||||
Weapon* weapon = nullptr;
|
||||
if (equip_meta->i->equip_type() == EQUIP_TYPE_WEAPON) {
|
||||
@ -3875,8 +3865,8 @@ Weapon* Human::TakeWeapon(MetaData::Equip* equip_meta)
|
||||
if (weapons[i].weapon_id == 0) {
|
||||
weapon = &weapons[i];
|
||||
weapon->weapon_idx = i;
|
||||
} else if (weapons[i].meta->i->equip_subtype() ==
|
||||
equip_meta->i->equip_subtype()){
|
||||
} else if (weapons[i].meta->i->equip_subtype() == equip_meta->i->equip_subtype() &&
|
||||
weapons[i].meta->group_id == equip_meta->group_id){
|
||||
if (equip_meta->i->quality() > weapons[i].meta->i->quality()) {
|
||||
weapon = &weapons[i];
|
||||
weapon->weapon_idx = i;
|
||||
|
@ -242,6 +242,7 @@ protected:
|
||||
void ProcCamoutflage(Loot* entity, MetaData::Equip* item_meta);
|
||||
void ProcSpoils(Loot* entity, MetaData::Equip* item_meta);
|
||||
void CancelRevive();
|
||||
Weapon* TakeonWeapon(MetaData::Equip* equip_meta);
|
||||
|
||||
private:
|
||||
void ClearFrameData();
|
||||
@ -275,7 +276,6 @@ private:
|
||||
virtual void OnBuffRemove(Buff& buff) override;
|
||||
virtual void DoSkillPreProc(int skill_id, int target_id, const a8::Vec2& target_pos) override;
|
||||
virtual void DoSkillPostProc(bool used, int skill_id, int target_id, const a8::Vec2& target_pos) override;
|
||||
Weapon* TakeWeapon(MetaData::Equip* equip_meta);
|
||||
|
||||
protected:
|
||||
int level_ = 0;
|
||||
|
@ -88,6 +88,7 @@ namespace MetaData
|
||||
int car_active_buff_id = 0;
|
||||
int car_deactive_buff_id = 0;
|
||||
long long special_damage_type = 0;
|
||||
int group_id = 0;
|
||||
|
||||
void Init();
|
||||
void Init2();
|
||||
|
@ -103,6 +103,9 @@ public:
|
||||
std::map<int, MetaData::AI*> ai_hash;
|
||||
std::map<std::string, std::string> text_hash;
|
||||
|
||||
int curr_group_id = 1001;
|
||||
std::map<long long, int> weapon_group_hash;
|
||||
|
||||
void Load()
|
||||
{
|
||||
if (!f8::IsOnlineEnv()) {
|
||||
@ -575,6 +578,15 @@ private:
|
||||
if (meta._inventory_slot() > -1) {
|
||||
equip_slot_hash[meta._inventory_slot()] = &item;
|
||||
}
|
||||
if (meta.equip_type() == EQUIP_TYPE_WEAPON) {
|
||||
auto itr = weapon_group_hash.find(meta.id());
|
||||
if (itr != weapon_group_hash.end()) {
|
||||
item.group_id = itr->second;
|
||||
} else {
|
||||
item.group_id = ++curr_group_id;
|
||||
weapon_group_hash[meta.id()] = item.group_id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (auto& meta : player_meta_list) {
|
||||
|
@ -549,24 +549,11 @@ void Player::LootInteraction(Loot* entity)
|
||||
if (FreezeOperate()) {
|
||||
return;
|
||||
}
|
||||
Weapon* weapon = nullptr;
|
||||
bool switch_gun = false;
|
||||
#if 0
|
||||
#else
|
||||
if (weapons[GUN_SLOT1].weapon_id == 0) {
|
||||
weapon = &weapons[GUN_SLOT1];
|
||||
weapon->weapon_idx = GUN_SLOT1;
|
||||
if (GetCurrWeapon() != &weapons[GUN_SLOT2] && !FreezeOperate()) {
|
||||
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()) {
|
||||
switch_gun = true;
|
||||
}
|
||||
Weapon* weapon = TakeonWeapon(item_meta);
|
||||
if (weapon && GetCurrWeapon() != weapon) {
|
||||
switch_gun = true;
|
||||
}
|
||||
#endif
|
||||
if (!weapon) {
|
||||
/*
|
||||
cs::SMPickup notifymsg;
|
||||
|
Loading…
x
Reference in New Issue
Block a user