public IoBuffer buildAddAppearanceEquipmentDelta(TangibleObject item) { CreatureObject creature = (CreatureObject) object; IoBuffer buffer = bufferPool.allocate(100, false).order(ByteOrder.LITTLE_ENDIAN); buffer.putInt(1); buffer.putInt(creature.getAppearanceEquipmentListUpdateCounter()); buffer.put((byte) 1); buffer.putShort((short) creature.getAppearanceEquipmentList().indexOf(item)); if (item.getCustomization() == null || item.getCustomization().length == 0) { buffer.putShort((short) 0); } else { buffer.putShort((short) item.getCustomization().length); buffer.put(item.getCustomization()); } buffer.putInt(item.getArrangementId()); buffer.putLong(item.getObjectID()); buffer.putInt(CRC.StringtoCRC(item.getTemplate())); buffer.put((byte) 0); int size = buffer.position(); buffer = bufferPool.allocate(size, false).put(buffer.array(), 0, size); buffer.flip(); buffer = createDelta("CREO", (byte) 6, (short) 1, (short) 0x21, buffer, size + 4); return buffer; }
public IoBuffer buildFactionDelta(String faction) { IoBuffer buffer = bufferPool.allocate(4, false).order(ByteOrder.LITTLE_ENDIAN); buffer.putInt(CRC.StringtoCRC(faction)); int size = buffer.position(); buffer.flip(); buffer = createDelta("CREO", (byte) 3, (short) 1, (short) 0x04, buffer, size + 4); return buffer; }
public IoBuffer buildBaseline3() { CreatureObject creature = (CreatureObject) object; IoBuffer buffer = bufferPool.allocate(100, false).order(ByteOrder.LITTLE_ENDIAN); buffer.setAutoExpand(true); buffer.putShort((short) 19); // Object Count buffer.putFloat(1); buffer.put(getAsciiString(creature.getStfFilename())); buffer.putInt(0); buffer.put(getAsciiString(creature.getStfName())); buffer.put(getUnicodeString(creature.getCustomName())); buffer.putInt(0x000F4240); // unk String factionCRC = creature.getFaction(); if (factionCRC == null) buffer.putInt(0); else if (factionCRC.equals("neutral")) buffer.putInt(0); else buffer.putInt(CRC.StringtoCRC(factionCRC)); buffer.putInt(creature.getFactionStatus()); byte[] customizationData = creature.getCustomization(); if (customizationData.length <= 0) buffer.putShort((short) 0); else { buffer.putShort((short) customizationData.length); buffer.put(customizationData); } buffer.putInt(1); buffer.putInt(0); // TANO Data buffer.putInt(0); buffer.putInt(0x80); buffer.putInt(creature.getIncapTimer()); buffer.putInt(0); buffer.putInt(0x3A98); buffer.put((byte) 1); buffer.put((byte) 0); buffer.put((byte) 1); buffer.putLong(creature.getOwnerId()); float height = creature.getHeight(); if (height < 0.7 || height > 1.5) height = 1; buffer.putFloat(height); buffer.putInt(0); // battle fatigue buffer.putLong(creature.getStateBitmask()); int size = buffer.position(); buffer = bufferPool.allocate(size, false).put(buffer.array(), 0, size); buffer.flip(); buffer = createBaseline("CREO", (byte) 3, buffer, size); return buffer; }
public BaseSWGCommand getCommandByCRC(int commandCRC) { Vector<BaseSWGCommand> commands = new Vector<BaseSWGCommand>(commandLookup); for (BaseSWGCommand command : commands) { if (command.getCommandCRC() == commandCRC) { return command; } } try { String[] tableArray = new String[] { "client_command_table", "command_table", "client_command_table_ground", "command_table_ground", "client_command_table_space", "command_table_space" }; for (int n = 0; n < tableArray.length; n++) { DatatableVisitor visitor = ClientFileManager.loadFile( "datatables/command/" + tableArray[n] + ".iff", DatatableVisitor.class); for (int i = 0; i < visitor.getRowCount(); i++) { if (visitor.getObject(i, 0) != null) { String name = ((String) visitor.getObject(i, 0)).toLowerCase(); if (CRC.StringtoCRC(name) == commandCRC) { if (isCombatCommand(name)) { CombatCommand command = new CombatCommand(name.toLowerCase()); commandLookup.add(command); return command; } else { BaseSWGCommand command = new BaseSWGCommand(name.toLowerCase()); commandLookup.add(command); return command; } } } } } } catch (InstantiationException | IllegalAccessException e) { e.printStackTrace(); } return null; }
@Override public IoBuffer serialize() { String galaxy = NGECore.getInstance().getGalaxyName(); IoBuffer buffer = IoBuffer.allocate(27 + galaxy.length() + characterName.length()) .order(ByteOrder.LITTLE_ENDIAN); buffer.putShort((short) 5); if (join) buffer.putInt(Opcodes.ChatOnEnteredRoom); else buffer.putInt(CRC.StringtoCRC("ChatOnLeaveRoom")); buffer.put(getAsciiString("SWG")); buffer.put(getAsciiString(galaxy)); buffer.put(getAsciiString(characterName.toLowerCase())); buffer.putInt(success); buffer.putInt(roomId); buffer.putInt(0); return buffer.flip(); }
public boolean removeCooldown(int actionCounter, BaseSWGCommand command) { if (cooldowns.containsKey(command.getCooldownGroup())) { cooldowns.remove(command.getCooldownGroup()); getClient() .getSession() .write( new ObjControllerMessage( 0x0B, new StartTask( actionCounter, getObjectID(), command.getCommandCRC(), CRC.StringtoCRC(command.getCooldownGroup()), -1)) .serialize()); return true; } return false; }
@Override public byte[] getBytes() { IoBuffer buffer = bufferPool.allocate(28, false).order(ByteOrder.LITTLE_ENDIAN); buffer.putInt(CRC.StringtoCRC(buffName.toLowerCase())); if (duration > 0) { buffer.putInt((int) (totalPlayTime + getRemainingDuration())); buffer.putInt(0); buffer.putInt((int) duration); } else { buffer.putInt(-1); buffer.putInt(0); buffer.putInt(0); } buffer.putLong(ownerId); buffer.putInt(stacks); // stacks buffer.flip(); return buffer.array(); }
public void sendBaselines(Client destination) { if (destination != null && destination.getSession() != null) { destination.getSession().write(getBaseline(3).getBaseline()); destination.getSession().write(getBaseline(6).getBaseline()); Client parent = ((getGrandparent() == null) ? null : getGrandparent().getClient()); if (parent != null && destination == parent) { destination.getSession().write(getBaseline(8).getBaseline()); destination.getSession().write(getBaseline(9).getBaseline()); } if (destination.getParent() != this) { UpdatePVPStatusMessage upvpm = new UpdatePVPStatusMessage(getObjectID()); upvpm.setFaction(CRC.StringtoCRC(getFaction())); upvpm.setStatus( NGECore.getInstance() .factionService .calculatePvpStatus((CreatureObject) destination.getParent(), this)); destination.getSession().write(upvpm.serialize()); } } }
public void setFaction(String faction) { notifyClients(getBaseline(3).set("faction", CRC.StringtoCRC(faction)), true); updatePvpStatus(); }
public void registerAlias(String name, String target) { aliases.put(CRC.StringtoCRC(name.toLowerCase()), CRC.StringtoCRC(target.toLowerCase())); }
public void processCombatCommand( CreatureObject attacker, SWGObject target, CombatCommand command, int actionCounter, String commandArgs) { if (FileUtilities.doesFileExist( "scripts/commands/combat/" + command.getCommandName() + ".py")) { core.scriptService.callScript( "scripts/commands/combat/", command.getCommandName(), "setup", core, attacker, target, command); } boolean success = true; // if((command.getHitType() == 5 || command.getHitType() == 7) && !(target instanceof // CreatureObject)) // success = false; if (!(command.getAttackType() == 2) && !(command.getHitType() == 5) && !(command.getHitType() == 0)) { if (target == null || !(target instanceof TangibleObject) || target == attacker) success = false; } else { if (target == null) target = attacker; else if (!(target instanceof TangibleObject)) return; } if (attacker.getPosture() == 13 || attacker.getPosture() == 14) success = false; if (target instanceof CreatureObject) { if (!(command.getHitType() == 5)) if (((CreatureObject) target).getPosture() == 13) success = false; if (!(command.getHitType() == 7)) if (((CreatureObject) target).getPosture() == 14) success = false; } if (command.getHitType() == 7 && target.getClient() == null) success = false; WeaponObject weapon; if (attacker.getWeaponId() == 0) weapon = (WeaponObject) attacker.getSlottedObject( "default_weapon"); // use unarmed/default weapon if no weapon is equipped else weapon = (WeaponObject) core.objectService.getObject(attacker.getWeaponId()); float maxRange = 0; if (command.getMaxRange() == 0) maxRange = weapon.getMaxRange(); else maxRange = command.getMaxRange(); Point3D attackerPos = attacker.getWorldPosition(); Point3D defenderPos = attacker.getWorldPosition(); if (attackerPos.getDistance(defenderPos) > maxRange && maxRange != 0) success = false; if (command.getMinRange() > 0) { if (attackerPos.getDistance(defenderPos) < command.getMinRange()) success = false; } if (target != attacker && success && !core.simulationService.checkLineOfSight(attacker, target)) { attacker.showFlyText("@combat_effects:cant_see", 1.5f, new RGB(72, 209, 204), 1, true); success = false; } if (!success && attacker.getClient() != null) { IoSession session = attacker.getClient().getSession(); CommandEnqueueRemove commandRemove = new CommandEnqueueRemove(attacker.getObjectId(), actionCounter); session.write(new ObjControllerMessage(0x0B, commandRemove).serialize()); StartTask startTask = new StartTask( actionCounter, attacker.getObjectID(), command.getCommandCRC(), CRC.StringtoCRC(command.getCooldownGroup()), -1); session.write(new ObjControllerMessage(0x0B, startTask).serialize()); } else { if (command.getHitType() == 5) { core.combatService.doHeal( attacker, (CreatureObject) target, weapon, command, actionCounter); return; } if (command.getHitType() == 7) { core.combatService.doRevive( attacker, (CreatureObject) target, weapon, command, actionCounter); return; } if (command.getHitType() == 0 && command.getBuffNameSelf() != null && command.getBuffNameSelf().length() > 0) { core.combatService.doSelfBuff(attacker, weapon, command, actionCounter); return; } for (int i = 0; i < command.getAttack_rolls(); i++) { core.combatService.doCombat( attacker, (TangibleObject) target, weapon, command, actionCounter); } } }
public IoBuffer buildBaseline3() { CreatureObject creature = (CreatureObject) object; IoBuffer buffer = bufferPool.allocate(100, false).order(ByteOrder.LITTLE_ENDIAN); buffer.setAutoExpand(true); if (creature.getStfName() == null || creature.getStfFilename() == null) { creature.setStfName(""); creature.setStfFilename(""); } buffer.putShort((short) 19); // Object Count buffer.putFloat(1); buffer.put(getAsciiString(creature.getStfFilename())); buffer.putInt(0); buffer.put(getAsciiString(creature.getStfName())); if (creature.getCustomName() == null) { creature.setCustomName(""); } // Not all CreatureObjects have CustomName (Shuttles) buffer.put(getUnicodeString(creature.getCustomName())); // buffer.putInt(0x000F4240); // volume buffer.putInt(1); buffer.putInt(CRC.StringtoCRC(creature.getFaction())); buffer.putInt(creature.getFactionStatus()); byte[] customizationData = creature.getCustomization(); if (customizationData == null || customizationData.length <= 0) // Shuttles have no customization data buffer.putShort((short) 0); else { buffer.putShort((short) customizationData.length); buffer.put(customizationData); } // buffer.putInt(1); buffer.putInt(0); // TANO Data buffer.putInt(0); buffer.putInt(creature.getOptionsBitmask()); // 0x80 = Player, 0x08 = Quest NPC, // buffer.putInt(0x80); buffer.putInt(creature.getIncapTimer()); buffer.putInt(0); buffer.putInt(0x3A98); buffer.put((byte) 1); buffer.put((byte) creature.getPosture()); buffer.put((byte) 0); buffer.putLong(creature.getOwnerId()); float height = creature.getHeight(); // if (height < 0.7 || height > 1.5) // height = 1; buffer.putFloat(height); buffer.putInt(0); // battle fatigue buffer.putLong(creature.getStateBitmask()); int size = buffer.position(); buffer = bufferPool.allocate(size, false).put(buffer.array(), 0, size); buffer.flip(); buffer = createBaseline("CREO", (byte) 3, buffer, size); return buffer; }
public IoBuffer buildBaseline6() { CreatureObject creature = (CreatureObject) object; IoBuffer buffer = bufferPool.allocate(100, false).order(ByteOrder.LITTLE_ENDIAN); buffer.setAutoExpand(true); buffer.putShort((short) 0x23); buffer.putInt(0x43); // serverId buffer.putShort((short) 0); // detaiLStfFilename buffer.putInt(0); // detailStfSpacer buffer.putShort((short) 0); // detailStfName // TANO 6 lists TODO: research buffer.put(creature.getCombatFlag()); buffer.putLong(0); // List<Long> possibly defenders list buffer.putInt(0); // Int buffer.putLong(0); // List<Long> buffer.putLong(0); // List<Int> buffer.putLong(0); // List<Unknown> buffer.putShort(creature.getLevel()); buffer.putInt( creature .getGrantedHealth()); // From player_level.iff. Ranges from 0-2000 as you level, // consistent with that table. // 0A if (creature.getCurrentAnimation() == null || creature.getCurrentAnimation().length() == 0) buffer.putShort((short) 0); else buffer.put(getAsciiString(creature.getCurrentAnimation())); if (creature.getMoodAnimation() == null || creature.getMoodAnimation().length() == 0) buffer.put(getAsciiString("neutral")); else buffer.put(getAsciiString(creature.getMoodAnimation())); buffer.putLong(creature.getWeaponId()); buffer.putLong(creature.getGroupId()); buffer.putLong(creature.getInviteSenderId()); if (creature.getInviteSenderName() == null || creature.getInviteSenderName().length() == 0) buffer.putShort((short) 0); else buffer.put(getAsciiString(creature.getInviteSenderName())); buffer.putLong(creature.getInviteCounter()); buffer.putInt(creature.getGuildId()); buffer.putLong(creature.getLookAtTarget()); // lookAtTarget 0x10 buffer.putLong(creature.getIntendedTarget()); // intendedTarget 0x11 buffer.put(creature.getMoodId()); buffer.putInt(creature.getPerformanceCounter()); /* * minor dilemma: performance ID is needed for XP calculation, but it can't be sent * in the CREO, otherwise the evul note bubbles appear */ buffer.putInt((creature.getPerformanceType()) ? 0 : creature.getPerformanceId()); buffer.putInt(6); // Current HAM buffer.putInt(creature.getHamListCounter()); buffer.putInt(creature.getHealth()); // 1A buffer.putInt(0); buffer.putInt(creature.getAction()); buffer.putInt(0); buffer.putInt(0x2C01); buffer.putInt(0); buffer.putInt(6); // Max HAM buffer.putInt(creature.getMaxHAMListCounter()); buffer.putInt(creature.getMaxHealth()); buffer.putInt(0); buffer.putInt(creature.getMaxAction()); buffer.putInt(0); buffer.putInt(0x2C01); buffer.putInt(0); if (creature.getEquipmentList().isEmpty()) { buffer.putInt(0); buffer.putInt(creature.getEquipmentListUpdateCounter()); } else { buffer.putInt(creature.getEquipmentList().size()); buffer.putInt(creature.getEquipmentListUpdateCounter()); for (SWGObject obj : creature.getEquipmentList().get()) { if (obj instanceof TangibleObject && !(obj instanceof WeaponObject)) { TangibleObject tangible = (TangibleObject) obj; if (tangible.getCustomization() == null || tangible.getCustomization().length == 0) { buffer.putShort((short) 0); } else { buffer.putShort((short) tangible.getCustomization().length); buffer.put(tangible.getCustomization()); } buffer.putInt(tangible.getArrangementId()); buffer.putLong(tangible.getObjectID()); buffer.putInt(CRC.StringtoCRC(tangible.getTemplate())); buffer.put((byte) 0); } else if (obj instanceof WeaponObject) { WeaponObject weapon = (WeaponObject) obj; if (weapon.getCustomization() == null || weapon.getCustomization().length == 0) { buffer.putShort((short) 0); } else { buffer.putShort((short) weapon.getCustomization().length); buffer.put(weapon.getCustomization()); } buffer.putInt(weapon.getArrangementId()); buffer.putLong(weapon.getObjectID()); buffer.putInt(CRC.StringtoCRC(weapon.getTemplate())); buffer.put((byte) 1); buffer.put(weapon.getMessageBuilder().buildBaseline3()); buffer.put(weapon.getMessageBuilder().buildBaseline6()); } else { System.out.println("Bad equipment object"); } } } buffer.putShort((short) 0); // costume // buffer.put(getAsciiString("appearance/gungan_m.sat")); buffer.put((byte) (creature.isInStealth() ? 0 : 1)); if (creature.getBuffList().isEmpty()) { buffer.putInt(0); buffer.putInt(creature.getBuffListCounter()); } else { buffer.putInt(creature.getBuffList().size() + 1); buffer.putInt(creature.getBuffListCounter()); buffer.put((byte) 0); // buffer.putInt(0x2098793D); buffer.putInt(0); buffer.putInt(-1); buffer.putInt(0); buffer.putInt(0); buffer.putLong(creature.getObjectID()); PlayerObject player = (PlayerObject) creature.getSlottedObject("ghost"); for (Buff buff : creature.getBuffList().get()) { if (player != null) buff.setTotalPlayTime( (int) (player.getTotalPlayTime() + (System.currentTimeMillis() - player.getLastPlayTimeUpdate()) / 1000)); else buff.setTotalPlayTime(0); buffer.put((byte) 1); buffer.putInt(0); buffer.putInt(CRC.StringtoCRC(buff.getBuffName().toLowerCase())); if (buff.getDuration() > 0) { buffer.putInt((int) (buff.getTotalPlayTime() + buff.getRemainingDuration())); buffer.putInt(0); buffer.putInt((int) buff.getDuration()); } else { buffer.putInt(-1); buffer.putInt(0); buffer.putInt(0); } buffer.putLong(creature.getObjectID()); } buffer.putInt(1); } buffer.put( (byte) (creature.isStationary() ? 1 : 0)); // if the server accepts transforms from the object buffer.put(creature.getDifficulty()); if (creature.isHologram()) buffer.putInt(0); else buffer.putInt(0xFFFFFFFF); buffer.put((byte) (creature.isRadarVisible() ? 1 : 0)); buffer.put((byte) 0); // no effect for 1? buffer.put((byte) 0); // no effect for 1? if (creature.getAppearanceEquipmentList().isEmpty()) { buffer.putInt(0); buffer.putInt(creature.getAppearanceEquipmentListUpdateCounter()); } else { buffer.putInt(creature.getAppearanceEquipmentList().size()); buffer.putInt(creature.getAppearanceEquipmentListUpdateCounter()); for (SWGObject obj : creature.getAppearanceEquipmentList().get()) { if (obj instanceof TangibleObject) { TangibleObject tangible = (TangibleObject) obj; if (tangible.getCustomization() == null || tangible.getCustomization().length == 0) { buffer.putShort((short) 0); } else { buffer.putShort((short) tangible.getCustomization().length); buffer.put(tangible.getCustomization()); } buffer.putInt(tangible.getArrangementId()); buffer.putLong(tangible.getObjectID()); buffer.putInt(CRC.StringtoCRC(tangible.getTemplate())); buffer.put((byte) 0); } else { System.out.println("Bad appearance equipment object"); } } } buffer.putLong(0); // unk long int size = buffer.position(); buffer = bufferPool.allocate(size, false).put(buffer.array(), 0, size); buffer.flip(); buffer = createBaseline("CREO", (byte) 6, buffer, size); return buffer; }
public IoBuffer buildBaseline6() { CreatureObject creature = (CreatureObject) object; IoBuffer buffer = bufferPool.allocate(100, false).order(ByteOrder.LITTLE_ENDIAN); buffer.setAutoExpand(true); buffer.putShort((short) 0x23); buffer.putInt(0x4E); buffer.putInt(0); // defenders list unused in NGE buffer.putInt(0); buffer.put(creature.getCombatFlag()); buffer.putLong(0); buffer.putLong(0); buffer.putLong(0); // Vehicle vars or TANO 6 vars TODO: research buffer.putLong(0); buffer.putInt(0); // buffer.putShort(creature.getLevel()); buffer.putShort((short) 90); buffer.putInt(0xD007); // unk if (creature.getCurrentAnimation() == null || creature.getCurrentAnimation().length() == 0) buffer.putShort((short) 0); else buffer.put(getAsciiString(creature.getCurrentAnimation())); if (creature.getMoodAnimation() == null || creature.getMoodAnimation().length() == 0) buffer.put(getAsciiString("neutral")); else buffer.put(getAsciiString(creature.getMoodAnimation())); buffer.putLong(creature.getWeaponId()); buffer.putLong(creature.getGroupId()); buffer.putLong(creature.getInviteSenderId()); if (creature.getInviteSenderName() == null || creature.getInviteSenderName().length() == 0) buffer.putShort((short) 0); else buffer.put(getAsciiString(creature.getInviteSenderName())); buffer.putLong(creature.getInviteCounter()); buffer.putInt(creature.getGuildId()); buffer.putLong(creature.getTargetId()); buffer.put(creature.getMoodId()); buffer.putInt(creature.getPerformanceCounter()); buffer.putInt(creature.getPerformanceId()); buffer.putInt(0); // unks buffer.putInt(0); buffer.putInt(6); // Current HAM buffer.putInt(creature.getHamListCounter()); buffer.putInt(creature.getHealth()); buffer.putInt(0); buffer.putInt(creature.getAction()); buffer.putInt(0); buffer.putInt(0x2C01); buffer.putInt(0); buffer.putInt(6); // Max HAM buffer.putInt(0); buffer.putInt(creature.getMaxHealth()); buffer.putInt(0); buffer.putInt(creature.getMaxAction()); buffer.putInt(0); buffer.putInt(0x2C01); buffer.putInt(0); if (creature.getEquipmentList().isEmpty()) { buffer.putInt(0); buffer.putInt(0); } else { buffer.putInt(creature.getEquipmentList().size()); buffer.putInt(0); for (SWGObject obj : creature.getEquipmentList().get()) { if (obj instanceof TangibleObject) { TangibleObject tangible = (TangibleObject) obj; if (tangible.getCustomization() == null || tangible.getCustomization().length == 0) { buffer.putShort((short) 0); } else { buffer.putShort((short) tangible.getCustomization().length); buffer.put(tangible.getCustomization()); } buffer.putInt(tangible.getArrangementId()); buffer.putLong(tangible.getObjectID()); buffer.putInt(CRC.StringtoCRC(tangible.getTemplate())); buffer.put((byte) 0); } else if (obj instanceof WeaponObject) { WeaponObject weapon = (WeaponObject) obj; if (weapon.getCustomization() == null || weapon.getCustomization().length == 0) { buffer.putShort((short) 0); } else { buffer.putShort((short) weapon.getCustomization().length); buffer.put(weapon.getCustomization()); } buffer.putInt(weapon.getArrangementId()); buffer.putLong(weapon.getObjectID()); buffer.putInt(CRC.StringtoCRC(weapon.getTemplate())); buffer.put((byte) 1); buffer.put(weapon.getMessageBuilder().buildBaseline3()); buffer.put(weapon.getMessageBuilder().buildBaseline6()); } else { System.out.println("Bad equipment object"); } } } buffer.putShort((short) 0); // buffer.put(getAsciiString("appearance/gungan_m.sat")); buffer.put((byte) 1); if (creature.getBuffList().isEmpty()) { buffer.putInt(0); buffer.putInt(creature.getBuffListCounter()); } else { buffer.putInt(creature.getBuffList().size() + 1); buffer.putInt(creature.getBuffListCounter()); buffer.put((byte) 0); // buffer.putInt(0x2098793D); buffer.putInt(0); buffer.putInt(-1); buffer.putInt(0); buffer.putInt(0); buffer.putLong(creature.getObjectID()); PlayerObject player = (PlayerObject) creature.getSlottedObject("ghost"); for (Buff buff : creature.getBuffList().get()) { buff.setTotalPlayTime( (int) (player.getTotalPlayTime() + (System.currentTimeMillis() - player.getLastPlayTimeUpdate()) / 1000)); buffer.put((byte) 1); buffer.putInt(0); buffer.putInt(CRC.StringtoCRC(buff.getBuffName())); if (buff.getDuration() > 0) { buffer.putInt((int) (buff.getTotalPlayTime() + buff.getRemainingDuration())); buffer.putInt(0); buffer.putInt((int) buff.getDuration()); } else { buffer.putInt(-1); buffer.putInt(0); buffer.putInt(0); } buffer.putLong(creature.getObjectID()); } buffer.putInt(1); } buffer.putShort((short) 0); buffer.putInt(0xFFFFFFFF); buffer.put((byte) 1); buffer.putShort((short) 0); if (creature.getAppearanceEquipmentList().isEmpty()) { buffer.putInt(0); buffer.putInt(0); } else { buffer.putInt(creature.getAppearanceEquipmentList().size()); buffer.putInt(0); for (SWGObject obj : creature.getAppearanceEquipmentList().get()) { if (obj instanceof TangibleObject) { TangibleObject tangible = (TangibleObject) obj; if (tangible.getCustomization() == null || tangible.getCustomization().length == 0) { buffer.putShort((short) 0); } else { buffer.putShort((short) tangible.getCustomization().length); buffer.put(tangible.getCustomization()); } buffer.putInt(tangible.getArrangementId()); buffer.putLong(tangible.getObjectID()); buffer.putInt(CRC.StringtoCRC(tangible.getTemplate())); buffer.put((byte) 0); } else { System.out.println("Bad appearance equipment object"); } } } buffer.putInt(0); buffer.putInt(0); int size = buffer.position(); buffer = bufferPool.allocate(size, false).put(buffer.array(), 0, size); buffer.flip(); buffer = createBaseline("CREO", (byte) 6, buffer, size); return buffer; }