public static void unpackConfig(StreamLoader streamLoader) { stream = new Stream(streamLoader.getDataForName("obj.dat")); Stream stream2 = new Stream(streamLoader.getDataForName("obj.idx")); totalItems = stream2.readUnsignedWord(); streamIndices = new int[totalItems + 10000]; Debug.Log("Items Loaded: " + totalItems); int i = 2; for (int j = 0; j < totalItems; j++) { streamIndices[j] = i; i += stream2.readUnsignedWord(); } cache = new ItemDef[10]; for (int k = 0; k < 10; k++) { cache[k] = new ItemDef(); } }
private void toLend() { ItemDef itemDef = forID(lentItemID); actions = new String[5]; modelID = itemDef.modelID; modelOffset1 = itemDef.modelOffset1; modelRotation2 = itemDef.modelRotation2; modelOffset2 = itemDef.modelOffset2; modelZoom = itemDef.modelZoom; modelRotation1 = itemDef.modelRotation1; anInt204 = itemDef.anInt204; value = 0; ItemDef itemDef_1 = forID(lendID); anInt166 = itemDef_1.anInt166; editedModelColor = itemDef_1.editedModelColor; anInt185 = itemDef_1.anInt185; maleEquip2 = itemDef_1.maleEquip2; anInt173 = itemDef_1.anInt173; anInt175 = itemDef_1.anInt175; groundActions = itemDef_1.groundActions; maleEquip1 = itemDef_1.maleEquip1; name = itemDef_1.name; femaleEquip1 = itemDef_1.femaleEquip1; membersObject = itemDef_1.membersObject; anInt197 = itemDef_1.anInt197; femaleEquip2 = itemDef_1.femaleEquip2; anInt162 = itemDef_1.anInt162; newModelColor = itemDef_1.newModelColor; team = itemDef_1.team; if (itemDef_1.actions != null) { for (int i_33_ = 0; i_33_ < 4; i_33_++) { actions[i_33_] = itemDef_1.actions[i_33_]; } } actions[4] = "Discard"; }
public static ItemDef forID(int i) { for (int j = 0; j < 10; j++) { if (cache[j].ID == i) { return(cache[j]); } } cacheIndex = (cacheIndex + 1) % 10; ItemDef itemDef = cache[cacheIndex]; stream.currentOffset = streamIndices[i]; itemDef.ID = i; itemDef.setDefaults(); itemDef.readValues(stream); if (itemDef.editedModelColor != null) { int[] oldc = itemDef.editedModelColor; int[] newc = itemDef.newModelColor; itemDef.editedModelColor = new int[oldc.Length + 1]; itemDef.newModelColor = new int[newc.Length + 1]; for (int index = 0; index < itemDef.editedModelColor.Length; index++) { if (index < itemDef.editedModelColor.Length - 1) { itemDef.editedModelColor[index] = oldc[index]; itemDef.newModelColor[index] = newc[index]; } else { itemDef.editedModelColor[index] = 0; itemDef.newModelColor[index] = 1; } } } else { itemDef.editedModelColor = new int[1]; itemDef.newModelColor = new int[1]; itemDef.editedModelColor[0] = 0; itemDef.newModelColor[0] = 1; } if (itemDef.certTemplateID != -1) { itemDef.toNote(); } if (itemDef.lentItemID != -1) { itemDef.toLend(); } if (!isMembers && itemDef.membersObject) { itemDef.name = "Members Object"; itemDef.description = "Login to a members' server to use this object."; itemDef.groundActions = null; itemDef.actions = null; itemDef.team = 0; } if (itemDef.editedModelColor != null) { int[] oldc = itemDef.editedModelColor; int[] newc = itemDef.newModelColor; itemDef.editedModelColor = new int[oldc.Length + 1]; itemDef.newModelColor = new int[newc.Length + 1]; for (int index = 0; index < itemDef.editedModelColor.Length; index++) { if (index < itemDef.editedModelColor.Length - 1) { itemDef.editedModelColor[index] = oldc[index]; itemDef.newModelColor[index] = newc[index]; } else { itemDef.editedModelColor[index] = 0; itemDef.newModelColor[index] = 1; } } } else { itemDef.editedModelColor = new int[1]; itemDef.newModelColor = new int[1]; itemDef.editedModelColor[0] = 0; itemDef.newModelColor[0] = 1; } return(itemDef); }
public static Sprite getSprite(int i, int j, int k) { if (k == 0) { Sprite sprite = (Sprite)mruNodes1.insertFromCache(i); if (sprite != null && sprite.anInt1445 != j && sprite.anInt1445 != -1) { sprite.unlink(); sprite = null; } if (sprite != null) { return(sprite); } } ItemDef itemDef = forID(i); if (itemDef.stackIDs == null) { j = -1; } if (j > 1) { int i1 = -1; for (int j1 = 0; j1 < 10; j1++) { if (j >= itemDef.stackAmounts[j1] && itemDef.stackAmounts[j1] != 0) { i1 = itemDef.stackIDs[j1]; } } if (i1 != -1) { itemDef = forID(i1); } } Model model = itemDef.method201(1); if (model == null) { return(null); } Sprite sprite2 = null; if (itemDef.certTemplateID != -1) { sprite2 = getSprite(itemDef.certID, 10, -1); if (sprite2 == null) { return(null); } } if (itemDef.lentItemID != -1) { sprite2 = getSprite(itemDef.lendID, 50, 0); if (sprite2 == null) { return(null); } } Sprite sprite3 = new Sprite(32, 32); int k1 = Texture.center_x; int l1 = Texture.center_y; int[] ai = Texture.lineOffsets; int[] ai1 = DrawingArea.pixels; //float[] depthBuffer = DrawingArea.depthBuffer; int i2 = DrawingArea.width; int j2 = DrawingArea.height; int k2 = DrawingArea.topX; int l2 = DrawingArea.bottomX; int i3 = DrawingArea.topY; int j3 = DrawingArea.bottomY; Texture.notTextured = false; DrawingArea.initDrawingArea(32, 32, sprite3.myPixels); //, new float[32*32]); DrawingArea.drawPixels(32, 0, 0, 0, 32); Texture.method364(); int k3 = itemDef.modelZoom; if (k == -1) { k3 = (int)((double)k3 * 1.5D); } if (k > 0) { k3 = (int)((double)k3 * 1.04D); } int l3 = Texture.SINE[itemDef.modelRotation1] * k3 >> 16; int i4 = Texture.COSINE[itemDef.modelRotation1] * k3 >> 16; model.method482(itemDef.modelRotation2, itemDef.anInt204, itemDef.modelRotation1, itemDef.modelOffset1, l3 + model.modelHeight / 2 + itemDef.modelOffset2, i4 + itemDef.modelOffset2); for (int i5 = 31; i5 >= 0; i5--) { for (int j4 = 31; j4 >= 0; j4--) { if (sprite3.myPixels[i5 + j4 * 32] == 0) { if (i5 > 0 && sprite3.myPixels[(i5 - 1) + j4 * 32] > 1) { sprite3.myPixels[i5 + j4 * 32] = 1; } else if (j4 > 0 && sprite3.myPixels[i5 + (j4 - 1) * 32] > 1) { sprite3.myPixels[i5 + j4 * 32] = 1; } else if (i5 < 31 && sprite3.myPixels[i5 + 1 + j4 * 32] > 1) { sprite3.myPixels[i5 + j4 * 32] = 1; } else if (j4 < 31 && sprite3.myPixels[i5 + (j4 + 1) * 32] > 1) { sprite3.myPixels[i5 + j4 * 32] = 1; } } } } if (k > 0) { for (int j5 = 31; j5 >= 0; j5--) { for (int k4 = 31; k4 >= 0; k4--) { if (sprite3.myPixels[j5 + k4 * 32] == 0) { if (j5 > 0 && sprite3.myPixels[(j5 - 1) + k4 * 32] == 1) { sprite3.myPixels[j5 + k4 * 32] = k; } else if (k4 > 0 && sprite3.myPixels[j5 + (k4 - 1) * 32] == 1) { sprite3.myPixels[j5 + k4 * 32] = k; } else if (j5 < 31 && sprite3.myPixels[j5 + 1 + k4 * 32] == 1) { sprite3.myPixels[j5 + k4 * 32] = k; } else if (k4 < 31 && sprite3.myPixels[j5 + (k4 + 1) * 32] == 1) { sprite3.myPixels[j5 + k4 * 32] = k; } } } } } else if (k == 0) { for (int k5 = 31; k5 >= 0; k5--) { for (int l4 = 31; l4 >= 0; l4--) { if (sprite3.myPixels[k5 + l4 * 32] == 0 && k5 > 0 && l4 > 0 && sprite3.myPixels[(k5 - 1) + (l4 - 1) * 32] > 0) { sprite3.myPixels[k5 + l4 * 32] = 0x302020; } } } } if (itemDef.certTemplateID != -1) { int l5 = sprite2.anInt1444; int j6 = sprite2.anInt1445; sprite2.anInt1444 = 32; sprite2.anInt1445 = 32; sprite2.drawSprite(0, 0); sprite2.anInt1444 = l5; sprite2.anInt1445 = j6; } if (itemDef.lentItemID != -1) { int l5 = sprite2.anInt1444; int j6 = sprite2.anInt1445; sprite2.anInt1444 = 32; sprite2.anInt1445 = 32; sprite2.drawSprite(0, 0); sprite2.anInt1444 = l5; sprite2.anInt1445 = j6; } if (k == 0) { mruNodes1.removeFromCache(sprite3, i); } DrawingArea.initDrawingArea(j2, i2, ai1); //, depthBuffer); DrawingArea.setDrawingArea(j3, k2, l2, i3); Texture.center_x = k1; Texture.center_y = l1; Texture.lineOffsets = ai; Texture.notTextured = true; if (itemDef.stackable) { sprite3.anInt1444 = 33; } else { sprite3.anInt1444 = 32; } sprite3.anInt1445 = j; return(sprite3); }
public Model method453() { if (!visible) { return(null); } if (desc != null) { return(desc.method160()); } bool flag = false; for (int i = 0; i < 12; i++) { int j = equipment[i]; if (j >= 256 && j < 512 && !IDK.cache[j - 256].method539()) { flag = true; } if (j >= 512 && !ItemDef.forID(j - 512).method192(anInt1702)) { flag = true; } } if (flag) { return(null); } Model[] aclass30_sub2_sub4_sub6s = new Model[12]; int k = 0; for (int l = 0; l < 12; l++) { int i1 = equipment[l]; if (i1 >= 256 && i1 < 512) { Model model_1 = IDK.cache[i1 - 256].method540(); if (model_1 != null) { aclass30_sub2_sub4_sub6s[k++] = model_1; } } if (i1 >= 512) { Model model_2 = ItemDef.forID(i1 - 512).method194(anInt1702); if (model_2 != null) { aclass30_sub2_sub4_sub6s[k++] = model_2; } } } Model model = new Model(k, aclass30_sub2_sub4_sub6s); for (int j1 = 0; j1 < 5; j1++) { if (anIntArray1700[j1] != 0) { model.method476(UnityClient.anIntArrayArray1003[j1][0], UnityClient.anIntArrayArray1003[j1][anIntArray1700[j1]]); if (j1 == 1) { model.method476(UnityClient.anIntArray1204[0], UnityClient.anIntArray1204[anIntArray1700[j1]]); } } } return(model); }
public Model method452() { if (desc != null) { int j = -1; if (base.anim >= 0 && base.anInt1529 == 0) { j = Animation.anims[base.anim].anIntArray353[base.anInt1527]; } else if (base.anInt1517 >= 0) { j = Animation.anims[base.anInt1517].anIntArray353[base.anInt1518]; } Model model = desc.method164(-1, j, null); return(model); } long l = aLong1718; int k = -1; int i1 = -1; int j1 = -1; int k1 = -1; if (base.anim >= 0 && base.anInt1529 == 0) { Animation animation = Animation.anims[base.anim]; k = animation.anIntArray353[base.anInt1527]; if (base.anInt1517 >= 0 && base.anInt1517 != base.anInt1511) { i1 = Animation.anims[base.anInt1517].anIntArray353[base.anInt1518]; } if (animation.anInt360 >= 0) { j1 = animation.anInt360; l += j1 - equipment[5] << 40; } if (animation.anInt361 >= 0) { k1 = animation.anInt361; l += k1 - equipment[3] << 48; } } else if (base.anInt1517 >= 0) { k = Animation.anims[base.anInt1517].anIntArray353[base.anInt1518]; } Model model_1 = (Model)mruNodes.insertFromCache(l); if (model_1 == null) { bool flag = false; for (int i2 = 0; i2 < 12; i2++) { int k2 = equipment[i2]; if (k1 >= 0 && i2 == 3) { k2 = k1; } if (j1 >= 0 && i2 == 5) { k2 = j1; } if (k2 >= 256 && k2 < 512 && !IDK.cache[k2 - 256].method537()) { flag = true; } if (k2 >= 512 && !ItemDef.forID(k2 - 512).method195(anInt1702)) { flag = true; } } if (flag) { if (aLong1697 != -1L) { model_1 = (Model)mruNodes.insertFromCache(aLong1697); } if (model_1 == null) { return(null); } } } if (model_1 == null) { Model[] aclass30_sub2_sub4_sub6s = new Model[12]; int j2 = 0; for (int l2 = 0; l2 < 12; l2++) { int i3 = equipment[l2]; if (k1 >= 0 && l2 == 3) { i3 = k1; } if (j1 >= 0 && l2 == 5) { i3 = j1; } if (i3 >= 256 && i3 < 512) { Model model_3 = IDK.cache[i3 - 256].method538(); if (model_3 != null) { aclass30_sub2_sub4_sub6s[j2++] = model_3; } } if (i3 >= 512) { Model model_4 = ItemDef.forID(i3 - 512).method196(anInt1702); if (model_4 != null) { aclass30_sub2_sub4_sub6s[j2++] = model_4; } } } model_1 = new Model(j2, aclass30_sub2_sub4_sub6s); for (int j3 = 0; j3 < 5; j3++) { if (anIntArray1700[j3] != 0) { model_1.method476(UnityClient.anIntArrayArray1003[j3][0], UnityClient.anIntArrayArray1003[j3][anIntArray1700[j3]]); if (j3 == 1) { model_1.method476(UnityClient.anIntArray1204[0], UnityClient.anIntArray1204[anIntArray1700[j3]]); } } } model_1.method469(); model_1.method479(64, 850, -30, -50, -30, true); mruNodes.removeFromCache(model_1, l); aLong1697 = l; } if (aBoolean1699) { return(model_1); } Model model_2 = Model.aModel_1621; model_2.method464(model_1, Class36.method532(k) & Class36.method532(i1)); if (k != -1 && i1 != -1) { model_2.method471(Animation.anims[base.anim].anIntArray357, i1, k); } else if (k != -1) { model_2.method470(k); } model_2.method466(); model_2.anIntArrayArray1658 = null; model_2.anIntArrayArray1657 = null; return(model_2); }
public void updatePlayer(Stream stream) { stream.currentOffset = 0; anInt1702 = stream.readUnsignedByte(); headIcon = stream.readUnsignedByte(); skullIcon = stream.readUnsignedByte(); desc = null; team = 0; for (int j = 0; j < 12; j++) { int k = stream.readUnsignedByte(); if (k == 0) { equipment[j] = 0; continue; } int i1 = stream.readUnsignedByte(); equipment[j] = (k << 8) + i1; if (j == 0 && equipment[0] == 65535) { desc = EntityDef.forID(stream.readUnsignedWord()); break; } if (equipment[j] >= 512 && equipment[j] - 512 < ItemDef.totalItems) { int l1 = ItemDef.forID(equipment[j] - 512).team; if (l1 != 0) { team = l1; } } } for (int l = 0; l < 5; l++) { int j1 = stream.readUnsignedByte(); if (j1 < 0 || j1 >= UnityClient.anIntArrayArray1003[l].Length) { j1 = 0; } anIntArray1700[l] = j1; } base.anInt1511 = stream.readUnsignedWord(); if (base.anInt1511 == 65535) { base.anInt1511 = -1; } base.anInt1512 = stream.readUnsignedWord(); if (base.anInt1512 == 65535) { base.anInt1512 = -1; } base.anInt1554 = stream.readUnsignedWord(); if (base.anInt1554 == 65535) { base.anInt1554 = -1; } base.anInt1555 = stream.readUnsignedWord(); if (base.anInt1555 == 65535) { base.anInt1555 = -1; } base.anInt1556 = stream.readUnsignedWord(); if (base.anInt1556 == 65535) { base.anInt1556 = -1; } base.anInt1557 = stream.readUnsignedWord(); if (base.anInt1557 == 65535) { base.anInt1557 = -1; } base.anInt1505 = stream.readUnsignedWord(); if (base.anInt1505 == 65535) { base.anInt1505 = -1; } name = TextClass.fixName(TextClass.nameForLong(stream.readQWord())); combatLevel = stream.readUnsignedByte(); skill = stream.readUnsignedWord(); visible = true; aLong1718 = 0L; for (int k1 = 0; k1 < 12; k1++) { aLong1718 <<= 4; if (equipment[k1] >= 256) { aLong1718 += equipment[k1] - 256; } } if (equipment[0] >= 256) { aLong1718 += equipment[0] - 256 >> 4; } if (equipment[1] >= 256) { aLong1718 += equipment[1] - 256 >> 8; } for (int i2 = 0; i2 < 5; i2++) { aLong1718 <<= 3; aLong1718 += anIntArray1700[i2]; } aLong1718 <<= 1; aLong1718 += anInt1702; }
public override Model getRotatedModel() { ItemDef itemDef = ItemDef.forID(ID); return itemDef.method201(anInt1559); }