Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static int packObject(Store source_cache, Store target_cache, int id, boolean rewriteTables) throws IOException {
- int objectSize = Utils.getObjectDefinitionsSize(target_cache);
- com.rs.cache.defs.osrs.ObjectDefinitions osrsObject = com.rs.cache.defs.osrs.ObjectDefinitions.getObjectDefinitions(source_cache, id);
- com.rs.cache.defs.rs2.ObjectDefinitions object = com.rs.cache.defs.rs2.ObjectDefinitions.getObjectDefinition(target_cache, objectSize, false);
- if (osrsObject.modelIds == null)
- return -1;
- System.out.println("Attempting to pack osrs object id=" + id + ", name=" + osrsObject.name + " ...");
- System.out.println("Attempting to pack osrs object models as new ones ...");
- int[] modelsIds = new int[osrsObject.modelIds.length];
- for (int i = 0; i < modelsIds.length; i++) {
- int newModelId = packedModels.get(osrsObject.modelIds[i]) != null ? packedModels.get(osrsObject.modelIds[i]) : packModel(source_cache, target_cache, osrsObject.modelIds[i], false);
- if (packedModels.get(osrsObject.modelIds[i]) == null)
- packedModels.put(osrsObject.modelIds[i], newModelId);
- modelsIds[i] = newModelId;
- }
- object.possibleTypes = osrsObject.possibleTypes == null ? new byte[] { 10 } : osrsObject.possibleTypes;
- object.modelIds = new int[object.possibleTypes.length][osrsObject.possibleTypes == null ? modelsIds.length : 1];
- if (osrsObject.possibleTypes == null) {
- object.modelIds[0] = modelsIds;
- } else
- for (int i = 0; i < object.possibleTypes.length; i++)
- object.modelIds[i][0] = modelsIds[i];
- if (rewriteTables) {
- System.out.println("\t ^ Rewriting Models table..");
- target_cache.getIndexes()[7].rewriteTable();
- System.out.println("\t ^ Finished!");
- if (packTextures) {
- System.out.println("\t ^ Rewriting Textures table..");
- target_cache.getIndexes()[9].rewriteTable();
- System.out.println("\t ^ Finished!");
- System.out.println("\t ^ Rewriting Materials table..");
- target_cache.getIndexes()[26].rewriteTable();
- System.out.println("\t ^ Finished!");
- }
- }
- object.name = osrsObject.name;
- object.sizeX = osrsObject.sizeX;
- object.sizeY = osrsObject.sizeY;
- // object.projectileCliped = osrsObject.projectileCliped; TODO
- object.secondInt = osrsObject.secondInt;
- object.nonFlatShading = false;
- object.objectDrawMechanic = (byte) osrsObject.aByte3912;
- object.clipType = osrsObject.clipType;
- // if (osrsObject.objectAnimation != -1) {
- // System.out.println("Attempting to pack osrs object animation as new one ...");
- // int newAnimationId = packedAnimations.get(osrsObject.objectAnimation) != null ? packedAnimations.get(osrsObject.objectAnimation) : packAnimation(source_cache, target_cache, osrsObject.objectAnimation, rewriteTables);
- // if (packedAnimations.get(osrsObject.objectAnimation) == null)
- // packedAnimations.put(osrsObject.objectAnimation, newAnimationId);
- // object.objectAnimation = newAnimationId;
- // } TODO
- object.options = osrsObject.options;
- // if (osrsObject.name.equalsIgnoreCase("null"))
- // object.hideExamine = true;
- object.originalColors = osrsObject.originalModelColors;
- object.modifiedColors = osrsObject.modifiedModelColors;
- object.originalTextures = osrsObject.originalTextureColors;
- object.replacementTextures = osrsObject.modifiedTextureColors;
- object.test_cflag = osrsObject.cflag;
- object.ignoreClipOnAlternativeRoute = osrsObject.ignoreClipOnAlternativeRoute;
- object.parameters = osrsObject.parameters;
- object.objectDrawMechanic = 1;
- object.castsShadow = false;
- object.nonFlatShading = true;
- object.occludes = 0;
- object.aBoolean3853 = false;
- object.brightness = 25;
- object.contrast = 15;
- object.secondInt = 0;
- object.anInt5418 = 26;
- object.offsetY = -2;
- object.write(target_cache);
- if (rewriteTables) {
- System.out.println("\t ^ Rewriting Objects table..");
- target_cache.getIndexes()[16].rewriteTable();
- System.out.println("\t ^ Finished!");
- }
- System.out.println("\t ^ Finished packing object with new id " + objectSize + "!");
- return objectSize;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement