-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFloorItemPacker.java
More file actions
96 lines (67 loc) · 2.63 KB
/
FloorItemPacker.java
File metadata and controls
96 lines (67 loc) · 2.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
package com.rs.tools;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.IOException;
import java.io.LineNumberReader;
import com.rs.game.Region;
import com.rs.game.item.FloorItem;
import com.rs.cache.Cache;
import com.rs.utils.Utils;
public class FloorItemPacker {
public static int floorItemsCount = 0;
public static final void main(String[] args) throws IOException {
Cache.init();
BufferedReader in = new BufferedReader(new FileReader("./data/items/UnpackedFloorItems.txt"));
DataOutputStream out = new DataOutputStream(new FileOutputStream("./data/items/FloorItems.ib"));
System.out.println("FloorItem Count: " + countLines() );
while (true) {
String line = in.readLine();
if (line == null){ break; }
if (line.startsWith("//")){ continue; }
String[] splitedLine = line.split(" - ");
String[] splitedLine2 = splitedLine[2].split(" ");
out.writeShort( Integer.valueOf(splitedLine[0]) ); //index
out.writeShort( Integer.valueOf(splitedLine[1]) ); //ID
out.writeShort( Integer.valueOf(splitedLine2[0]) ); //amount
out.writeShort( Integer.valueOf(splitedLine2[1]) ); //x
out.writeShort( Integer.valueOf(splitedLine2[2]) ); //y
out.writeShort( Integer.valueOf(splitedLine2[3]) ); //z
//System.out.println(" " + splitedLine[0] );
//System.out.println(" " + splitedLine[1] );
//System.out.println(" " + splitedLine2[0] );
//System.out.println(" " + splitedLine2[1] );
//System.out.println(" " + splitedLine2[2] );
//System.out.println(" " + splitedLine2[3] );
}
out.close();
in.close();
}//end method
public static int countLines() throws IOException {
Cache.init();
BufferedReader in = new BufferedReader(new FileReader("./data/items/UnpackedFloorItems.txt"));
LineNumberReader reader = null;
try {
reader = new LineNumberReader(new FileReader("./data/items/UnpackedFloorItems.txt"));
while ((reader.readLine()) != null){
floorItemsCount++;
}
return floorItemsCount -1 ; //-1 to account for the // comment at the top
} catch (Exception ex) {
return -1;
} finally {
if(reader != null)
reader.close();
}
}
public static int getMax() {
//max amount of created flooritems, used for settings.
try {
return countLines();
} catch (Exception ex) {
}
return -1;
}
}//end class