public PlayerWeaponBagData CombineOverridedBagData(IPlayerWeaponSharedGetter getter, PlayerWeaponBagData playerWeaponBagData) { playerWeaponBagData.CopyTo(_playerWeaponBagData); if (getter.OverrideBagTactic < 1) { return(_playerWeaponBagData); } bool replace = false; foreach (var weapon in playerWeaponBagData.weaponList) { var slot = PlayerWeaponBagData.Index2Slot(weapon.Index); if (slot == EWeaponSlotType.TacticWeapon) { weapon.WeaponTplId = getter.OverrideBagTactic; replace = true; } } if (!replace) { _playerWeaponBagData.weaponList.Add(new PlayerWeaponData { Index = PlayerWeaponBagData.Slot2Index(EWeaponSlotType.TacticWeapon), WeaponTplId = getter.OverrideBagTactic, }); } return(_playerWeaponBagData); }
public PlayerWeaponBagData GetOverridedBagData(PlayerEntity playerEntity, PlayerWeaponBagData playerWeaponBagData) { if (!playerEntity.hasOverrideBag) { return(playerWeaponBagData); } if (playerEntity.overrideBag.TacticWeapon > 0) { if (null == _playerWeaponBagData) { _playerWeaponBagData = new PlayerWeaponBagData(); } playerWeaponBagData.CopyTo(_playerWeaponBagData); bool replace = false; foreach (var weapon in _playerWeaponBagData.weaponList) { var slot = PlayerWeaponBagData.Index2Slot(weapon.Index); if (slot == Core.EWeaponSlotType.TacticWeapon) { weapon.WeaponTplId = playerEntity.overrideBag.TacticWeapon; replace = true; } } if (!replace) { _playerWeaponBagData.weaponList.Add(new PlayerWeaponData { Index = PlayerWeaponBagData.Slot2Index(Core.EWeaponSlotType.TacticWeapon), WeaponTplId = playerEntity.overrideBag.TacticWeapon, }); } return(_playerWeaponBagData); } return(playerWeaponBagData); }