160 lines
5.3 KiB
Java
160 lines
5.3 KiB
Java
package p000;
|
|
|
|
import java.util.Vector;
|
|
|
|
/* renamed from: az */
|
|
/* loaded from: microcounterstrike.jar:az.class */
|
|
public final class WeaponLoadout {
|
|
|
|
/* renamed from: a */
|
|
public static Vector weaponCatalog = null;
|
|
|
|
/* renamed from: b */
|
|
public static int defaultPrimaryWeaponId = -1;
|
|
|
|
/* renamed from: c */
|
|
public static int defaultPistolWeaponId = -1;
|
|
|
|
/* renamed from: d */
|
|
public static int defaultKnifeWeaponId = -1;
|
|
|
|
/* renamed from: e */
|
|
public static int defaultAmmoPack1WeaponId = -1;
|
|
|
|
/* renamed from: f */
|
|
public static int defaultAmmoPack2WeaponId = -1;
|
|
|
|
/* renamed from: i */
|
|
public int activeSlot;
|
|
|
|
/* renamed from: g */
|
|
public int[] equippedWeaponIdBySlot = {-1, -1, -1, -1};
|
|
|
|
/* renamed from: h */
|
|
public int[] ammoBySlot = new int[4];
|
|
|
|
/* renamed from: j */
|
|
public int grenadeCharge = 0;
|
|
|
|
public WeaponLoadout() {
|
|
weaponCatalog = new Vector();
|
|
PlatformServices.getInstance().loadWeaponDefinitions(MainUiCanvasBase.getInstance().value183);
|
|
}
|
|
|
|
/* renamed from: a */
|
|
public static void registerWeapon(WeaponInfo c0042k) {
|
|
weaponCatalog.addElement(c0042k);
|
|
c0042k.weaponId = weaponCatalog.indexOf(c0042k);
|
|
if (defaultPrimaryWeaponId == -1 && c0042k.weaponCode / 10 == 1) {
|
|
defaultPrimaryWeaponId = c0042k.weaponId;
|
|
return;
|
|
}
|
|
if (defaultPistolWeaponId == -1 && c0042k.weaponCode / 10 == 2) {
|
|
defaultPistolWeaponId = c0042k.weaponId;
|
|
return;
|
|
}
|
|
if (defaultKnifeWeaponId == -1 && c0042k.weaponCode / 10 == 3) {
|
|
defaultKnifeWeaponId = c0042k.weaponId;
|
|
return;
|
|
}
|
|
if (defaultAmmoPack1WeaponId == -1 && c0042k.weaponCode == 50) {
|
|
defaultAmmoPack1WeaponId = c0042k.weaponId;
|
|
} else if (defaultAmmoPack2WeaponId == -1 && c0042k.weaponCode == 51) {
|
|
defaultAmmoPack2WeaponId = c0042k.weaponId;
|
|
}
|
|
}
|
|
|
|
/* renamed from: a */
|
|
public final void resetToDefaultLoadout() {
|
|
if (PlatformServices.getInstance().getBoolean152()) {
|
|
this.equippedWeaponIdBySlot[0] = MainUiCanvasBase.getInstance().value184;
|
|
this.ammoBySlot[0] = ((WeaponInfo) weaponCatalog.elementAt(this.equippedWeaponIdBySlot[0])).clipSize * 3;
|
|
this.equippedWeaponIdBySlot[1] = MainUiCanvasBase.getInstance().value185;
|
|
this.ammoBySlot[1] = ((WeaponInfo) weaponCatalog.elementAt(this.equippedWeaponIdBySlot[1])).clipSize * 5;
|
|
this.equippedWeaponIdBySlot[2] = defaultKnifeWeaponId;
|
|
this.equippedWeaponIdBySlot[3] = MainUiCanvasBase.getInstance().value186;
|
|
this.ammoBySlot[3] = ((WeaponInfo) weaponCatalog.elementAt(this.equippedWeaponIdBySlot[3])).clipSize * 5;
|
|
selectSlot(1);
|
|
} else {
|
|
this.equippedWeaponIdBySlot[0] = -1;
|
|
this.ammoBySlot[0] = 0;
|
|
this.equippedWeaponIdBySlot[1] = defaultPistolWeaponId;
|
|
this.ammoBySlot[1] = ((WeaponInfo) weaponCatalog.elementAt(this.equippedWeaponIdBySlot[1])).defaultAmmo;
|
|
this.equippedWeaponIdBySlot[2] = defaultKnifeWeaponId;
|
|
this.equippedWeaponIdBySlot[3] = -1;
|
|
this.ammoBySlot[3] = 0;
|
|
selectSlot(2);
|
|
}
|
|
this.grenadeCharge = 0;
|
|
}
|
|
|
|
/* renamed from: b */
|
|
public final void consumeAmmo() {
|
|
int[] iArr = this.ammoBySlot;
|
|
int i = this.activeSlot - 1;
|
|
iArr[i] = iArr[i] - 1;
|
|
}
|
|
|
|
/* renamed from: a */
|
|
public final boolean selectSlot(int i) {
|
|
if (this.equippedWeaponIdBySlot[i - 1] == -1) {
|
|
return false;
|
|
}
|
|
this.activeSlot = i;
|
|
return true;
|
|
}
|
|
|
|
/* renamed from: c */
|
|
public final int getActiveAmmo() {
|
|
return this.ammoBySlot[this.activeSlot - 1];
|
|
}
|
|
|
|
/* renamed from: d */
|
|
public final WeaponInfo getActiveWeaponInfo() {
|
|
return (WeaponInfo) weaponCatalog.elementAt(this.equippedWeaponIdBySlot[this.activeSlot - 1]);
|
|
}
|
|
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
/* renamed from: b */
|
|
public final void addWeaponOrAmmo(WeaponInfo c0042k) {
|
|
int i = c0042k.weaponCode / 10;
|
|
if (i == 1 || i == 2 || i == 4) {
|
|
this.equippedWeaponIdBySlot[i - 1] = c0042k.weaponId;
|
|
this.ammoBySlot[i - 1] = c0042k.defaultAmmo;
|
|
selectSlot(i);
|
|
} else {
|
|
if (i != 5) {
|
|
if (i == 6 && c0042k.weaponCode == 60) {
|
|
this.grenadeCharge = 100;
|
|
return;
|
|
}
|
|
return;
|
|
}
|
|
byte b = false;
|
|
if (c0042k.weaponCode == 51) {
|
|
b = true;
|
|
}
|
|
int[] iArr = this.ammoBySlot;
|
|
byte b2 = b;
|
|
iArr[b2 == true ? 1 : 0] = iArr[b2 == true ? 1 : 0] + ((WeaponInfo) weaponCatalog.elementAt(this.equippedWeaponIdBySlot[b == true ? 1 : 0])).clipSize;
|
|
}
|
|
}
|
|
|
|
/* renamed from: b */
|
|
public final void clearSlot(int i) {
|
|
this.equippedWeaponIdBySlot[i - 1] = -1;
|
|
this.ammoBySlot[i - 1] = 0;
|
|
}
|
|
|
|
/* renamed from: e */
|
|
public final void dispose() {
|
|
this.equippedWeaponIdBySlot = null;
|
|
this.ammoBySlot = null;
|
|
}
|
|
|
|
/* renamed from: f */
|
|
public static void clearWeaponCatalog() {
|
|
weaponCatalog = null;
|
|
}
|
|
}
|