- Joined
- Jul 11, 2020
- Messages
- 0
- Reaction score
- 26
- Points
- 0
Voraussetzungen sind:
a) EventAPI (hier von darkmagician6)
b) TimeUtil/TimeHelper (wie ihr es genannt habt)
Viel Spaß
[HIDE]
[/HIDE]
a) EventAPI (hier von darkmagician6)
b) TimeUtil/TimeHelper (wie ihr es genannt habt)
Viel Spaß
[HIDE]
Code:
public class AutoArmor extends Module {
private TimeHelper time;
private int[] boots;
private int[] chestplate;
private int[] helmet;
private int[] leggings;
public AutoArmor() {
super("AutoArmor", "AutoArmor", Category.COMBAT);
this.time = new TimeHelper();
this.boots = new int[] { 313, 309, 317, 305, 301 };
this.chestplate = new int[] { 311, 307, 315, 303, 299 };
this.helmet = new int[] { 310, 306, 314, 302, 298 };
this.leggings = new int[] { 312, 308, 316, 304, 300 };
}
@EventTarget
public void onUpdate(EventUpdate e) {
if (this.mc.thePlayer.openContainer != null && this.mc.thePlayer.openContainer.windowId != 0) {
return;
}
int v1 = -1;
if (this.mc.thePlayer.inventory.armorInventory[0] == null) {
int[] v3;
for (int v2 = (v3 = this.boots).length, v4 = 0; v4 < v2; ++v4) {
final int v5 = v3[v4];
if (this.findItem(v5) != -1) {
v1 = this.findItem(v5);
break;
}
}
}
if (this.armourIsBetter(0, this.boots)) {
v1 = 8;
}
if (this.mc.thePlayer.inventory.armorInventory[3] == null) {
int[] v3;
for (int v2 = (v3 = this.helmet).length, v4 = 0; v4 < v2; ++v4) {
final int v5 = v3[v4];
if (this.findItem(v5) != -1) {
v1 = this.findItem(v5);
break;
}
}
}
if (this.armourIsBetter(3, this.helmet)) {
v1 = 5;
}
if (this.mc.thePlayer.inventory.armorInventory[1] == null) {
int[] v3;
for (int v2 = (v3 = this.leggings).length, v4 = 0; v4 < v2; ++v4) {
final int v5 = v3[v4];
if (this.findItem(v5) != -1) {
v1 = this.findItem(v5);
break;
}
}
}
if (this.armourIsBetter(1, this.leggings)) {
v1 = 7;
}
if (this.mc.thePlayer.inventory.armorInventory[2] == null) {
int[] v3;
for (int v2 = (v3 = this.chestplate).length, v4 = 0; v4 < v2; ++v4) {
final int v5 = v3[v4];
if (this.findItem(v5) != -1) {
v1 = this.findItem(v5);
break;
}
}
}
if (this.armourIsBetter(2, this.chestplate)) {
v1 = 6;
}
if (v1 != -1) {
this.mc.playerController.windowClick(0, v1, 0, 1, this.mc.thePlayer);
this.time.setLastMS();
}
}
public boolean armourIsBetter(final int a1, final int[] a2) {
if (this.mc.thePlayer.inventory.armorInventory[a1] != null) {
int v1 = 0;
int v2 = -1;
int v3 = 0;
int v4 = -1;
for (final int v7 : a2) {
if (Item.getIdFromItem(this.mc.thePlayer.inventory.armorInventory[a1].getItem()) == v7) {
v2 = v1;
break;
}
++v1;
}
for (final int v7 : a2) {
if (this.findItem(v7) != -1) {
v4 = v3;
break;
}
++v3;
}
if (v4 > -1) {
return v4 < v2;
}
}
return false;
}
private int findItem(final int a1) {
for (int v1 = 9; v1 < 45; ++v1) {
final ItemStack v2 = this.mc.thePlayer.inventoryContainer.getSlot(v1).getStack();
if (v2 != null && Item.getIdFromItem(v2.getItem()) == a1) {
return v1;
}
}
return -1;
}
public void onEnable() {
EventManager.register(this);
}
public void onDisable() {
EventManager.unregister(this);
}
}
Last edited by a moderator: