use of net.runelite.cache.io.OutputStream in project runelite by runelite.
the class TrackLoader method load.
private void load(TrackDefinition def, InputStream var1) {
// Some of the names are from https://www.rune-server.ee/runescape-development/rs-503-client-server/snippets/311669-rs-music-file-structure-conversion.html
var1.setOffset(var1.getLength() - 3);
int tracks = var1.readUnsignedByte();
int division = var1.readUnsignedShort();
int offset = 14 + tracks * 10;
var1.setOffset(0);
int tempoOpcodes = 0;
int ctrlChangeOpcodes = 0;
int noteOnOpcodes = 0;
int noteOffOpcodes = 0;
int wheelChangeOpcodes = 0;
int chnnlAfterTchOpcodes = 0;
int keyAfterTchOpcodes = 0;
int progmChangeOpcodes = 0;
int var13;
int opcode;
int controlChangeIndex;
for (var13 = 0; var13 < tracks; ++var13) {
opcode = -1;
while (true) {
controlChangeIndex = var1.readUnsignedByte();
if (controlChangeIndex != opcode) {
++offset;
}
opcode = controlChangeIndex & 15;
if (controlChangeIndex == JAG_END_OF_TRACK) {
break;
}
if (controlChangeIndex == JAG_TEMPO) {
++tempoOpcodes;
} else if (opcode == JAG_NOTE_ON) {
++noteOnOpcodes;
} else if (opcode == JAG_NOTE_OFF) {
++noteOffOpcodes;
} else if (opcode == JAG_CONTROL_CHANGE) {
++ctrlChangeOpcodes;
} else if (opcode == JAG_PITCH_BEND) {
++wheelChangeOpcodes;
} else if (opcode == JAG_CHANNEL_PRESSURE) {
++chnnlAfterTchOpcodes;
} else if (opcode == JAG_POLY_PRESSURE) {
++keyAfterTchOpcodes;
} else if (opcode == JAG_PROGRAM_CHANGE) {
++progmChangeOpcodes;
} else {
throw new RuntimeException();
}
}
}
offset += 5 * tempoOpcodes;
offset += 2 * (noteOnOpcodes + noteOffOpcodes + ctrlChangeOpcodes + wheelChangeOpcodes + keyAfterTchOpcodes);
offset += chnnlAfterTchOpcodes + progmChangeOpcodes;
var13 = var1.getOffset();
opcode = tracks + tempoOpcodes + ctrlChangeOpcodes + noteOnOpcodes + noteOffOpcodes + wheelChangeOpcodes + chnnlAfterTchOpcodes + keyAfterTchOpcodes + progmChangeOpcodes;
for (controlChangeIndex = 0; controlChangeIndex < opcode; ++controlChangeIndex) {
var1.readVarInt();
}
offset += var1.getOffset() - var13;
controlChangeIndex = var1.getOffset();
int modulationWheelSize = 0;
int modulationWheel2Size = 0;
int channelVolumeSize = 0;
int channelVolume2Size = 0;
int panSize = 0;
int pan2Size = 0;
int nonRegisteredMsbSize = 0;
int nonRegisteredLsbSize = 0;
int registeredNumberMsb = 0;
int registeredLsbSize = 0;
int commandsSize = 0;
int otherSize = 0;
int controllerNumber = 0;
int var29;
for (var29 = 0; var29 < ctrlChangeOpcodes; ++var29) {
controllerNumber = controllerNumber + var1.readUnsignedByte() & 127;
if (controllerNumber == CONTROLLER_BANK_SELECT || controllerNumber == CONTROLLER_BANK_SELECT_2) {
++progmChangeOpcodes;
} else if (controllerNumber == CONTROLLER_MODULATION_WHEEL) {
++modulationWheelSize;
} else if (controllerNumber == CONTROLLER_MODULATION_WHEEL2) {
++modulationWheel2Size;
} else if (controllerNumber == CONTROLLER_CHANNEL_VOLUME) {
++channelVolumeSize;
} else if (controllerNumber == CONTROLLER_CHANNEL_VOLUME_2) {
++channelVolume2Size;
} else if (controllerNumber == CONTROLLER_PAN) {
++panSize;
} else if (controllerNumber == CONTROLLER_PAN_2) {
++pan2Size;
} else if (controllerNumber == CONTROLLER_NON_REGISTERED_PARAMETER_NUMBER_MSB) {
++nonRegisteredMsbSize;
} else if (controllerNumber == CONTROLLER_NON_REGISTERED_PARAMETER_NUMBER_LSB) {
++nonRegisteredLsbSize;
} else if (controllerNumber == CONTROLLER_REGISTERED_PARAMETER_NUMBER_MSB) {
++registeredNumberMsb;
} else if (controllerNumber == CONTROLLER_REGISTERED_PARAMETER_NUMBER_LSB) {
++registeredLsbSize;
} else if (controllerNumber != CONTROLLER_DAMPER_PEDAL && controllerNumber != CONTROLLER_PORTAMENTO && controllerNumber != CONTROLLER_ALL_SOUND_OFF && controllerNumber != CONTROLLER_RESET_ALL_CONTROLLERS && controllerNumber != CONTROLLER_ALL_NOTES_OFF) {
++otherSize;
} else {
++commandsSize;
}
}
var29 = 0;
int commandsIndex = var1.getOffset();
var1.skip(commandsSize);
int polyPressureIndex = var1.getOffset();
var1.skip(keyAfterTchOpcodes);
int channelPressureIndex = var1.getOffset();
var1.skip(chnnlAfterTchOpcodes);
int pitchWheelHighIndex = var1.getOffset();
var1.skip(wheelChangeOpcodes);
int modulationWheelOffset = var1.getOffset();
var1.skip(modulationWheelSize);
int channelVolumeOffset = var1.getOffset();
var1.skip(channelVolumeSize);
int panOffset = var1.getOffset();
var1.skip(panSize);
int notesIndex = var1.getOffset();
var1.skip(noteOnOpcodes + noteOffOpcodes + keyAfterTchOpcodes);
int notesOnIndex = var1.getOffset();
var1.skip(noteOnOpcodes);
int otherIndex = var1.getOffset();
var1.skip(otherSize);
int notesOffIndex = var1.getOffset();
var1.skip(noteOffOpcodes);
int modulationWheel2Offset = var1.getOffset();
var1.skip(modulationWheel2Size);
int channelVolume2Offset = var1.getOffset();
var1.skip(channelVolume2Size);
int pan2Offset = var1.getOffset();
var1.skip(pan2Size);
int programChangeIndex = var1.getOffset();
var1.skip(progmChangeOpcodes);
int pitchWheelLowIndex = var1.getOffset();
var1.skip(wheelChangeOpcodes);
int nonRegisteredMsbIndex = var1.getOffset();
var1.skip(nonRegisteredMsbSize);
int nonRegisteredLsbIndex = var1.getOffset();
var1.skip(nonRegisteredLsbSize);
int registeredMsbIndex = var1.getOffset();
var1.skip(registeredNumberMsb);
int registeredLsbIndex = var1.getOffset();
var1.skip(registeredLsbSize);
int tempoOffset = var1.getOffset();
var1.skip(tempoOpcodes * 3);
OutputStream var51 = new OutputStream(offset);
// MThd header
var51.writeInt(MTHD_MAGIC);
// length of header
var51.writeInt(6);
// format
var51.writeShort(tracks > 1 ? 1 : 0);
// tracks
var51.writeShort(tracks);
// division
var51.writeShort(division);
var1.setOffset(var13);
int channel = 0;
int var53 = 0;
int var54 = 0;
int var55 = 0;
int var56 = 0;
int var57 = 0;
int var58 = 0;
int[] var59 = new int[128];
controllerNumber = 0;
label361: for (int var60 = 0; var60 < tracks; ++var60) {
// MTrk
var51.writeInt(MTRK_MAGIC);
// length gets written here later
var51.skip(4);
int var61 = var51.getOffset();
int var62 = -1;
while (true) {
int deltaTick = var1.readVarInt();
// delta time
var51.writeVarInt(deltaTick);
int status = var1.getArray()[var29++] & 255;
boolean var65 = status != var62;
var62 = status & 15;
if (status == JAG_END_OF_TRACK) {
// if (var65) -- client has this if, but it causes broken midi to be produced
{
var51.writeByte(META);
}
// type - end of track
var51.writeByte(END_OF_TRACK);
// length
var51.writeByte(0);
var51.writeLengthFromMark(var51.getOffset() - var61);
continue label361;
}
if (status == JAG_TEMPO) {
// if (var65) -- client has this if, but it causes broken midi to be produced
{
// meta event FF
var51.writeByte(META);
}
// type - set tempo
var51.writeByte(TEMPO);
// length
var51.writeByte(3);
var51.writeByte(var1.getArray()[tempoOffset++]);
var51.writeByte(var1.getArray()[tempoOffset++]);
var51.writeByte(var1.getArray()[tempoOffset++]);
} else {
channel ^= status >> 4;
if (var62 == JAG_NOTE_ON) {
if (var65) {
var51.writeByte(NOTE_ON + channel);
}
var53 += var1.getArray()[notesIndex++];
var54 += var1.getArray()[notesOnIndex++];
var51.writeByte(var53 & 127);
var51.writeByte(var54 & 127);
} else if (var62 == JAG_NOTE_OFF) {
if (var65) {
var51.writeByte(NOTE_OFF + channel);
}
var53 += var1.getArray()[notesIndex++];
var55 += var1.getArray()[notesOffIndex++];
var51.writeByte(var53 & 127);
var51.writeByte(var55 & 127);
} else if (var62 == JAG_CONTROL_CHANGE) {
if (var65) {
var51.writeByte(CONTROL_CHANGE + channel);
}
controllerNumber = controllerNumber + var1.getArray()[controlChangeIndex++] & 127;
var51.writeByte(controllerNumber);
byte var66;
if (controllerNumber == CONTROLLER_BANK_SELECT || controllerNumber == CONTROLLER_BANK_SELECT_2) {
var66 = var1.getArray()[programChangeIndex++];
} else if (controllerNumber == CONTROLLER_MODULATION_WHEEL) {
var66 = var1.getArray()[modulationWheelOffset++];
} else if (controllerNumber == CONTROLLER_MODULATION_WHEEL2) {
var66 = var1.getArray()[modulationWheel2Offset++];
} else if (controllerNumber == CONTROLLER_CHANNEL_VOLUME) {
var66 = var1.getArray()[channelVolumeOffset++];
} else if (controllerNumber == CONTROLLER_CHANNEL_VOLUME_2) {
var66 = var1.getArray()[channelVolume2Offset++];
} else if (controllerNumber == CONTROLLER_PAN) {
var66 = var1.getArray()[panOffset++];
} else if (controllerNumber == CONTROLLER_PAN_2) {
var66 = var1.getArray()[pan2Offset++];
} else if (controllerNumber == CONTROLLER_NON_REGISTERED_PARAMETER_NUMBER_MSB) {
var66 = var1.getArray()[nonRegisteredMsbIndex++];
} else if (controllerNumber == CONTROLLER_NON_REGISTERED_PARAMETER_NUMBER_LSB) {
var66 = var1.getArray()[nonRegisteredLsbIndex++];
} else if (controllerNumber == CONTROLLER_REGISTERED_PARAMETER_NUMBER_MSB) {
var66 = var1.getArray()[registeredMsbIndex++];
} else if (controllerNumber == CONTROLLER_REGISTERED_PARAMETER_NUMBER_LSB) {
var66 = var1.getArray()[registeredLsbIndex++];
} else if (controllerNumber != CONTROLLER_DAMPER_PEDAL && controllerNumber != CONTROLLER_PORTAMENTO && controllerNumber != CONTROLLER_ALL_SOUND_OFF && controllerNumber != CONTROLLER_RESET_ALL_CONTROLLERS && controllerNumber != CONTROLLER_ALL_NOTES_OFF) {
var66 = var1.getArray()[otherIndex++];
} else {
var66 = var1.getArray()[commandsIndex++];
}
int var67 = var66 + var59[controllerNumber];
var59[controllerNumber] = var67;
var51.writeByte(var67 & 127);
} else if (var62 == JAG_PITCH_BEND) {
if (var65) {
var51.writeByte(PITCH_WHEEL_CHANGE + channel);
}
var56 += var1.getArray()[pitchWheelLowIndex++];
var56 += var1.getArray()[pitchWheelHighIndex++] << 7;
var51.writeByte(var56 & 127);
var51.writeByte(var56 >> 7 & 127);
} else if (var62 == JAG_CHANNEL_PRESSURE) {
if (var65) {
var51.writeByte(CHANNEL_PRESSURE + channel);
}
var57 += var1.getArray()[channelPressureIndex++];
var51.writeByte(var57 & 127);
} else if (var62 == JAG_POLY_PRESSURE) {
if (var65) {
var51.writeByte(POLYPHONIC_KEY_PRESSURE + channel);
}
var53 += var1.getArray()[notesIndex++];
var58 += var1.getArray()[polyPressureIndex++];
var51.writeByte(var53 & 127);
var51.writeByte(var58 & 127);
} else if (var62 == JAG_PROGRAM_CHANGE) {
if (var65) {
var51.writeByte(PROGRAM_CHANGE + channel);
}
var51.writeByte(var1.getArray()[programChangeIndex++]);
} else {
throw new RuntimeException();
}
}
}
}
def.midi = var51.flip();
}
use of net.runelite.cache.io.OutputStream in project runelite by runelite.
the class InterfaceSaver method saveNoScript.
private byte[] saveNoScript(InterfaceDefinition def) {
OutputStream out = new OutputStream();
out.writeByte(def.type);
out.writeByte(def.field2222);
out.writeShort(def.contentType);
out.writeShort(def.originalX);
out.writeShort(def.originalY);
out.writeShort(def.originalWidth);
out.writeShort(def.field2231);
out.writeByte(def.opacity);
out.writeShort(def.parentId);
out.writeShort(def.field2334);
if (def.tableActions != null) {
out.writeByte(def.tableActions.length);
for (int i = 0; i < def.tableActions.length; ++i) {
out.writeByte(def.tableActions[i]);
out.writeShort(def.field2333[i]);
}
} else {
out.writeByte(0);
}
if (def.dynamicValues != null) {
out.writeByte(def.dynamicValues.length);
for (int i = 0; i < def.dynamicValues.length; ++i) {
out.writeShort(def.dynamicValues[i].length);
for (int j = 0; j < def.dynamicValues[i].length; ++j) {
out.writeShort(def.dynamicValues[i][j]);
}
}
} else {
out.writeByte(0);
}
if (def.type == 0) {
out.writeShort(def.scrollHeight);
out.writeByte(def.isHidden ? 1 : 0);
}
if (def.type == 1) {
out.writeShort(0);
out.writeByte(0);
}
if (def.type == 2) {
out.writeByte((def.config & 268435456) != 0 ? 1 : 0);
out.writeByte((def.config & 1073741824) != 0 ? 1 : 0);
out.writeByte((def.config & Integer.MIN_VALUE) != 0 ? 1 : 0);
out.writeByte((def.config & 536870912) != 0 ? 1 : 0);
out.writeByte(def.paddingX);
out.writeByte(def.paddingY);
for (int i = 0; i < 20; ++i) {
if (def.field2289[i] != -1) {
out.writeByte(1);
out.writeShort(def.xSprites[i]);
out.writeShort(def.field2288[i]);
out.writeShort(def.field2289[i]);
} else {
out.writeByte(0);
}
}
for (int i = 0; i < 5; ++i) {
if (def.configActions[i] != null) {
out.writeString(def.configActions[i]);
} else {
out.writeString("");
}
}
}
if (def.type == 3) {
out.writeByte(def.field2267 ? 1 : 0);
}
if (def.type == 4 || def.type == 1) {
out.writeByte(def.field2219);
out.writeByte(def.field2283);
out.writeByte(def.field2212);
out.writeShort(def.fontId);
out.writeByte(def.textShadowed ? 1 : 0);
}
if (def.type == 4) {
out.writeString(def.text);
out.writeString(def.field2241);
}
if (def.type == 1 || def.type == 3 || def.type == 4) {
out.writeInt(def.textColor);
}
if (def.type == 3 || def.type == 4) {
out.writeInt(def.field2245);
out.writeInt(def.field2280);
out.writeInt(def.field2247);
}
if (def.type == 5) {
out.writeInt(def.spriteId);
out.writeInt(def.field2332);
}
if (def.type == 6) {
out.writeShort(def.modelId);
out.writeShort(def.field2265);
out.writeShort(def.field2266);
out.writeShort(def.field2276);
out.writeShort(def.modelZoom);
out.writeShort(def.rotationX);
out.writeShort(def.rotationZ);
}
if (def.type == 7) {
out.writeByte(def.field2219);
out.writeShort(def.fontId);
out.writeByte(def.textShadowed ? 1 : 0);
out.writeInt(def.textColor);
out.writeShort(def.paddingX);
out.writeShort(def.paddingY);
out.writeByte((def.config & 1073741824) != 0 ? 1 : 0);
for (int i = 0; i < 5; ++i) {
out.writeString(def.configActions[i]);
}
}
if (def.type == 8) {
out.writeString(def.text);
}
if (def.field2222 == 2 || def.type == 2) {
out.writeString(def.selectedAction);
out.writeString(def.field2335);
out.writeShort((def.config >>> 11) & 63);
}
if (def.field2222 == 1 || def.field2222 == 4 || def.field2222 == 5 || def.field2222 == 6) {
out.writeString(def.tooltip);
}
return out.flip();
}
use of net.runelite.cache.io.OutputStream in project runelite by runelite.
the class LocationSaver method save.
public byte[] save(LocationsDefinition locs) {
Multimap<Integer, Location> locById = LinkedListMultimap.create();
List<Location> sortedLocs = new ArrayList<>(locs.getLocations());
sortedLocs.sort((l1, l2) -> Integer.compare(l1.getId(), l2.getId()));
for (Location loc : sortedLocs) {
locById.put(loc.getId(), loc);
}
OutputStream out = new OutputStream();
int prevId = -1;
for (Integer id : locById.keySet()) {
int diffId = id - prevId;
prevId = id;
out.writeShortSmart(diffId);
Collection<Location> locations = locById.get(id);
int position = 0;
for (Location loc : locations) {
int packedPosition = (loc.getPosition().getZ() << 12) | (loc.getPosition().getX() << 6) | (loc.getPosition().getY());
int diffPos = packedPosition - position;
position = packedPosition;
out.writeShortSmart(diffPos + 1);
int packedAttributes = (loc.getType() << 2) | loc.getOrientation();
out.writeByte(packedAttributes);
}
out.writeShortSmart(0);
}
out.writeShortSmart(0);
return out.flip();
}
use of net.runelite.cache.io.OutputStream in project runelite by runelite.
the class NpcSaver method save.
public byte[] save(NpcDefinition npc) {
OutputStream out = new OutputStream();
if (npc.models != null) {
out.writeByte(1);
out.writeByte(npc.models.length);
for (int modelId : npc.models) {
out.writeShort(modelId);
}
}
if (npc.name != null) {
out.writeByte(2);
out.writeString(npc.name);
}
if (npc.tileSpacesOccupied != 1) {
out.writeByte(12);
out.writeByte(npc.tileSpacesOccupied);
}
if (npc.stanceAnimation != -1) {
out.writeByte(13);
out.writeShort(npc.stanceAnimation);
}
if (npc.walkAnimation != -1) {
out.writeByte(14);
out.writeShort(npc.walkAnimation);
}
if (npc.anInt2165 != -1) {
out.writeByte(15);
out.writeShort(npc.anInt2165);
}
if (npc.anInt2189 != -1) {
out.writeByte(16);
out.writeShort(npc.anInt2189);
}
if (npc.rotate180Animation != -1 || npc.rotate90LeftAnimation != -1 || npc.rotate90RightAnimation != -1) {
out.writeByte(17);
out.writeShort(npc.walkAnimation);
out.writeShort(npc.rotate180Animation);
out.writeShort(npc.rotate90RightAnimation);
out.writeShort(npc.rotate90LeftAnimation);
}
for (int i = 0; i < 5; ++i) {
if (npc.options[i] != null) {
out.writeByte(30 + i);
out.writeString(npc.options[i]);
}
}
if (npc.recolorToFind != null && npc.recolorToReplace != null) {
out.writeByte(40);
out.writeByte(npc.recolorToFind.length);
for (int i = 0; i < npc.recolorToFind.length; ++i) {
out.writeShort(npc.recolorToFind[i]);
out.writeShort(npc.recolorToReplace[i]);
}
}
if (npc.retextureToFind != null && npc.retextureToReplace != null) {
out.writeByte(41);
out.writeByte(npc.retextureToFind.length);
for (int i = 0; i < npc.retextureToFind.length; ++i) {
out.writeShort(npc.retextureToFind[i]);
out.writeShort(npc.retextureToReplace[i]);
}
}
if (npc.models_2 != null) {
out.writeByte(60);
out.writeByte(npc.models_2.length);
for (int modelId : npc.models_2) {
out.writeShort(modelId);
}
}
if (!npc.renderOnMinimap) {
out.writeByte(93);
}
if (npc.combatLevel != -1) {
out.writeByte(95);
out.writeShort(npc.combatLevel);
}
out.writeByte(97);
out.writeShort(npc.resizeX);
out.writeByte(98);
out.writeShort(npc.resizeY);
if (npc.hasRenderPriority) {
out.writeByte(99);
}
out.writeByte(100);
out.writeByte(npc.ambient);
out.writeByte(101);
out.writeByte(npc.contrast);
if (npc.headIcon != -1) {
out.writeByte(102);
out.writeShort(npc.headIcon);
}
out.writeByte(103);
out.writeShort(npc.anInt2156);
if (!npc.isClickable) {
out.writeByte(107);
}
if (!npc.aBool2170) {
out.writeByte(109);
}
if (npc.aBool2190) {
out.writeByte(111);
}
if (npc.anIntArray2185 != null) {
out.writeByte(118);
out.writeShort(npc.anInt2174);
out.writeShort(npc.anInt2187);
int[] c = npc.anIntArray2185;
out.writeShort(c[c.length - 1]);
out.writeByte(c.length - 2);
for (int i = 0; i <= c.length - 2; ++i) {
out.writeShort(c[i]);
}
}
if (npc.params != null) {
out.writeByte(249);
out.writeByte(npc.params.size());
for (Map.Entry<Integer, Object> entry : npc.params.entrySet()) {
out.writeByte(entry.getValue() instanceof String ? 1 : 0);
out.write24BitInt(entry.getKey());
if (entry.getValue() instanceof String) {
out.writeString((String) entry.getValue());
} else {
out.writeInt((Integer) entry.getValue());
}
}
}
out.writeByte(0);
return out.flip();
}
use of net.runelite.cache.io.OutputStream in project runelite by runelite.
the class ItemSaver method save.
public byte[] save(ItemDefinition item) {
OutputStream out = new OutputStream();
if (item.inventoryModel != 0) {
out.writeByte(1);
out.writeShort(item.inventoryModel);
}
if (item.name != null) {
out.writeByte(2);
out.writeString(item.name);
}
out.writeByte(4);
out.writeShort(item.zoom2d);
out.writeByte(5);
out.writeShort(item.xan2d);
out.writeByte(6);
out.writeShort(item.yan2d);
out.writeByte(7);
out.writeShort(item.xOffset2d);
out.writeByte(8);
out.writeShort(item.yOffset2d);
if (item.stackable != 0) {
out.writeByte(11);
}
out.writeByte(12);
out.writeInt(item.cost);
if (item.members) {
out.writeByte(16);
}
if (item.maleModel0 != -1 || item.maleOffset != 0) {
out.writeByte(23);
out.writeShort(item.maleModel0);
out.writeByte(item.maleOffset);
}
if (item.maleModel1 != -1) {
out.writeByte(24);
out.writeShort(item.maleModel1);
}
if (item.femaleModel0 != -1 || item.femaleOffset != 0) {
out.writeByte(25);
out.writeShort(item.femaleModel0);
out.writeByte(item.femaleOffset);
}
if (item.femaleModel1 != -1) {
out.writeByte(26);
out.writeShort(item.femaleModel1);
}
for (int i = 0; i < 5; ++i) {
if (item.options[i] != null) {
out.writeByte(30 + i);
out.writeString(item.options[i]);
}
}
for (int i = 0; i < 5; ++i) {
if (item.interfaceOptions[i] != null) {
out.writeByte(35 + i);
out.writeString(item.interfaceOptions[i]);
}
}
if (item.colorFind != null && item.colorReplace != null) {
out.writeByte(40);
out.writeByte(item.colorFind.length);
for (int i = 0; i < item.colorFind.length; ++i) {
out.writeShort(item.colorFind[i]);
out.writeShort(item.colorReplace[i]);
}
}
if (item.textureFind != null && item.textureReplace != null) {
out.writeByte(41);
out.writeByte(item.textureFind.length);
for (int i = 0; i < item.textureFind.length; ++i) {
out.writeShort(item.textureFind[i]);
out.writeShort(item.textureReplace[i]);
}
}
out.writeByte(42);
out.writeByte(item.shiftClickDropIndex);
if (item.isTradeable) {
out.writeByte(65);
}
if (item.maleModel2 != -1) {
out.writeByte(78);
out.writeShort(item.maleModel2);
}
if (item.femaleModel2 != -1) {
out.writeByte(79);
out.writeShort(item.femaleModel2);
}
if (item.maleHeadModel != -1) {
out.writeByte(90);
out.writeShort(item.maleHeadModel);
}
if (item.femaleHeadModel != -1) {
out.writeByte(91);
out.writeShort(item.femaleHeadModel);
}
if (item.maleHeadModel2 != -1) {
out.writeByte(92);
out.writeShort(item.maleHeadModel2);
}
if (item.femaleHeadModel2 != -1) {
out.writeByte(93);
out.writeShort(item.femaleHeadModel2);
}
out.writeByte(95);
out.writeShort(item.zan2d);
if (item.notedID != -1) {
out.writeByte(97);
out.writeShort(item.notedID);
}
if (item.notedTemplate != -1) {
out.writeByte(98);
out.writeShort(item.notedTemplate);
}
if (item.countObj != null) {
for (int i = 0; i < 10; ++i) {
out.writeByte(100 + i);
out.writeShort(item.countObj[i]);
out.writeShort(item.countCo[i]);
}
}
out.writeByte(110);
out.writeShort(item.resizeX);
out.writeByte(111);
out.writeShort(item.resizeY);
out.writeByte(112);
out.writeShort(item.resizeZ);
out.writeByte(113);
out.writeByte(item.ambient);
out.writeByte(114);
out.writeByte(item.contrast);
out.writeByte(115);
out.writeByte(item.team);
if (item.boughtId != -1) {
out.writeByte(139);
out.writeShort(item.boughtId);
}
if (item.boughtTemplateId != -1) {
out.writeByte(140);
out.writeShort(item.boughtTemplateId);
}
if (item.placeholderId != -1) {
out.writeByte(148);
out.writeShort(item.placeholderId);
}
if (item.placeholderTemplateId != -1) {
out.writeByte(149);
out.writeShort(item.placeholderTemplateId);
}
if (item.params != null) {
out.writeByte(249);
out.writeByte(item.params.size());
for (Entry<Integer, Object> entry : item.params.entrySet()) {
out.writeByte(entry.getValue() instanceof String ? 1 : 0);
out.write24BitInt(entry.getKey());
if (entry.getValue() instanceof String) {
out.writeString((String) entry.getValue());
} else {
out.writeInt((Integer) entry.getValue());
}
}
}
out.writeByte(0);
return out.flip();
}
Aggregations