private final Class101 method3588(ha var_ha, byte i, int i_13_, boolean bool) { anInt10131++; ObjectDefinition class266 = Class346_Sub7_Sub4_Sub2.aClass368_10161.method3838((byte) -116, aShort10140 & 0xffff); if (i != -107) return null; s var_s; s var_s_14_; if (aBoolean10156) { var_s = Node_Sub14_Sub29.aSArray9471[0]; var_s_14_ = (Node_Sub14_Sub12_Sub1.aSArray10306[((Interactable) this).aByte8322]); } else { if ((((Interactable) this).aByte8322 ^ 0xffffffff) <= -4) var_s = null; else var_s = (Node_Sub14_Sub29.aSArray9471[1 + ((Interactable) this).aByte8322]); var_s_14_ = (Node_Sub14_Sub29.aSArray9471[((Interactable) this).aByte8322]); } return class266.method2785( aByte10132, bool, null, i_13_, ((Interactable) this).anInt8317, var_ha, (byte) -36, ((Interactable) this).y, aByte10130, ((Interactable) this).x, var_s_14_, var_s); }
final ObjectDefinition method3838(byte i, int i_0_) { anInt4518++; ObjectDefinition class266; synchronized (aClass278_4520) { class266 = (ObjectDefinition) aClass278_4520.method2863(4, (long) i_0_); } if (class266 != null) return class266; byte[] is; synchronized (aClass381_4530) { is = aClass381_4530.method3922( (byte) 115, Class330.method3381(i_0_, 10663), Node_Sub14_Sub28.method2358(-75, i_0_)); } class266 = new ObjectDefinition(); ((ObjectDefinition) class266).anInt3043 = i_0_; ((ObjectDefinition) class266).aClass368_3110 = this; if (is != null) class266.method2787(new ByteStream(is), -87); class266.method2784(false); if (((ObjectDefinition) class266).aBoolean3082) { ((ObjectDefinition) class266).anInt3093 = 0; ((ObjectDefinition) class266).aBoolean3111 = false; } if (!((Class368) this).aBoolean4519 && ((ObjectDefinition) class266).aBoolean3016) { ((ObjectDefinition) class266).aStringArray3075 = null; ((ObjectDefinition) class266).anIntArray3029 = null; } synchronized (aClass278_4520) { aClass278_4520.method2867((byte) 0, (long) i_0_, class266); } if (i > -6) anIntArray4521 = null; return class266; }
final ObjectDefinition getObject(int i, int i_0_) { anInt3351++; ObjectDefinition class51; synchronized (aClass60_3350) { class51 = (ObjectDefinition) aClass60_3350.method583((long) i_0_, i ^ 0x32); } if (class51 != null) return class51; byte[] is; synchronized (aClass45_3343) { is = aClass45_3343.getChildArchive( Class239_Sub29.method1850(i_0_, 111), Class5_Sub1.method185(i_0_, (byte) -90)); } class51 = new ObjectDefinition(); ((ObjectDefinition) class51).anInt941 = i_0_; ((ObjectDefinition) class51).aClass263_933 = this; if (is != null) class51.method479((byte) 0, new ByteBuffer(is)); class51.method488(-105); if (i != 0) ((ObjectLoader) this).aClass60_3361 = null; if (!((ObjectLoader) this).aBoolean3359 && ((ObjectDefinition) class51).aBoolean942) { ((ObjectDefinition) class51).anIntArray917 = null; ((ObjectDefinition) class51).aStringArray913 = null; } if (((ObjectDefinition) class51).aBoolean876) { ((ObjectDefinition) class51).anInt920 = 0; ((ObjectDefinition) class51).aBoolean896 = false; } synchronized (aClass60_3350) { aClass60_3350.method582(class51, (long) i_0_, (byte) -109); } return class51; }
static final boolean method1547(int i, int i_13_, int i_14_) { anInt1657++; if (i_14_ == 11) { i_14_ = 10; } if (i_13_ != 1) { return true; } ObjectDefinition objectdefinition = Class186.aClass112_2256.method1145(i, 61); if ((i_14_ ^ 0xffffffff) <= -6 && (i_14_ ^ 0xffffffff) >= -9) { i_14_ = 4; } return objectdefinition.method3041(i_14_, 31); }
public GameObject( int id, int orientation, int position, int bY, int cY, int aY, int dY, int animationId, boolean randomFrame) { this.id = id; this.position = position; this.orientation = orientation; anInt1603 = aY; centre = bY; anInt1605 = cY; anInt1606 = dY; if (animationId != -1) { animation = Animation.animations[animationId]; currentFrameId = 0; lastFrameTick = Client.tick; if (randomFrame && animation.loopOffset != -1) { currentFrameId = (int) (Math.random() * animation.frameCount); lastFrameTick -= (int) (Math.random() * animation.duration(currentFrameId)); } } ObjectDefinition definition = ObjectDefinition.lookup(id); morphVarbitsIndex = definition.morphVarbitIndex; morphVariableIndex = definition.morphVariableIndex; morphisms = definition.morphisms; }
/** * Uses an item on a game object. * * @param item the item to use * @param target the game object to be used on by the item * @return <tt>true</tt> if the "Use" action had been used on both the inventory item and the game * object; otherwise <tt>false</tt> */ public static boolean useItem(Item item, GameObject target) { if (item != null && target != null) { for (int i = 0, r = Random.nextInt(5, 8); i < r; i++) { if (!isItemSelected()) { if (item.interact("Use")) { for (int j = 0; j < 10 && !isItemSelected(); j++) { Task.sleep(100, 200); } } else { return false; } } // just make sure in case something bad happened if (isItemSelected()) { final String itemName = item.getName(); final ObjectDefinition targetDef = target.getDef(); final Model targetModel = target.getModel(); if (targetDef != null && itemName != null && targetModel != null) { final String targetName = targetDef.getName(); Mouse.move(targetModel.getNextPoint()); final String action = "Use " + itemName.replace("<col=ff9040>", "") + " -> " + targetName.replace("<col=ff9040>", ""); for (int j = 0, s = Random.nextInt(5, 8); j < s; j++) { if (Menu.contains(action) && Menu.click(action)) { return true; } else { Mouse.move(targetModel.getNextPoint()); } } } // kay, since that failed, let's try just use if (target.interact("Use")) { return true; } } } } return false; }
@Override public final Model model() { int lastFrame = -1; if (animation != null) { int tickDelta = Client.tick - lastFrameTick; if (tickDelta > 100 && animation.loopOffset > 0) { tickDelta = 100; } while (tickDelta > animation.duration(currentFrameId)) { tickDelta -= animation.duration(currentFrameId); currentFrameId++; if (currentFrameId < animation.frameCount) { continue; } currentFrameId -= animation.loopOffset; if (currentFrameId >= 0 && currentFrameId < animation.frameCount) { continue; } animation = null; break; } lastFrameTick = Client.tick - tickDelta; if (animation != null) { lastFrame = animation.primaryFrames[currentFrameId]; } } ObjectDefinition definition = morphisms != null ? morph() : ObjectDefinition.lookup(id); return (definition == null) ? null : definition.modelAt( position, orientation, anInt1603, centre, anInt1605, anInt1606, lastFrame); }
public final ObjectDefinition morph() { int state = -1; if (morphVarbitsIndex != -1) { VariableBits bits = VariableBits.bits[morphVarbitsIndex]; int var = bits.setting; int lo = bits.low; int hi = bits.high; int mask = Client.BIT_MASKS[hi - lo]; state = client.settings[var] >> lo & mask; } else if (morphVariableIndex != -1) { state = client.settings[morphVariableIndex]; } if (state < 0 || state >= morphisms.length || morphisms[state] == -1) { return null; } return ObjectDefinition.lookup(morphisms[state]); }