DEADSOFTWARE

Convert codepage to utf8
[cavecraft.git] / libs / Lib_items_store.java
1 class Lib_items_store
2 {
3 /*Items*/
4 static byte[] item_type;
5 static byte[] item_tex;
6 static int[] item_max;
7 static byte[] item_info;
8 static byte[] item_flags;
9 /*Blocks*/
10 static byte[] block_tex;
11 static int[] block_hp;
12 static byte[] block_coll;
13 static byte[] block_tool;
14 static byte[] block_lvl;
15 static byte[] block_flags;
16 static byte[] block_tr;
17 static byte[] block_li;
18 /*Craft*/
19 static byte[] [] craftIN_item;
20 static byte[] [] craftIN_sum;
21 static byte[] craftOUT_item;
22 static int[] craftOUT_sum;
23 static byte[] craftOUT_flag;
24 /*Tools*/
25 static byte[] tool_type;
26 static byte[] tool_lvl;
27 static byte[] tool_speed;
28 static byte[] tool_damg;
30 /*Items*/
31 public static void resetitems(int len)
32 {
33 try {
34 item_type = new byte[len];
35 item_tex = new byte[len];
36 item_max = new int[len];
37 item_info = new byte[len];
38 item_flags = new byte[len];
39 } catch(Exception e) {e.printStackTrace();}
40 }
42 public static void setitemdata(int id, int type, int tex, int max, int info, int flags)
43 {
44 try {
45 item_type[id] = (byte) type;
46 item_tex[id] = (byte) tex;
47 item_max[id] = max;
48 item_info[id] = (byte) info;
49 item_flags[id] = (byte) flags;
50 } catch(Exception e) {e.printStackTrace();}
51 }
53 public static int getitemtype(int id)
54 {
55 try {
56 return (int) item_type[id] & 0xFF;
57 } catch(Exception e) {/*e.printStackTrace();*/ return 0;}
58 }
60 public static int getitemtex(int id)
61 {
62 try {
63 return (int) item_tex[id] & 0xFF;
64 } catch(Exception e) {/*e.printStackTrace();*/ return 0;}
65 }
67 public static int getitemmax(int id)
68 {
69 try{
70 return item_max[id];
71 } catch(Exception e) {/*e.printStackTrace();*/ return 0;}
72 }
74 public static int getiteminfo(int id)
75 {
76 try {
77 return (int) item_info[id] & 0xFF;
78 } catch(Exception e) {/*e.printStackTrace();*/ return 0;}
79 }
81 public static int getitemflags(int id)
82 {
83 try {
84 return (int) item_flags[id] & 0xFF;
85 } catch(Exception e) {/*e.printStackTrace();*/ return 0;}
86 }
88 /*Blocks*/
90 public static void resetblocks(int len)
91 {
92 try {
93 block_tex = new byte[len];
94 block_hp = new int[len];
95 block_coll = new byte[len];
96 block_tool = new byte[len];
97 block_lvl = new byte[len];
98 block_flags = new byte[len];
99 block_tr = new byte[len];
100 block_li = new byte[len];
101 } catch(Exception e) {e.printStackTrace();}
104 public static void setblockdata(int id, int tex, int hp, int coll, int tool, int lvl, int flags, int tr, int li)
106 try {
107 block_tex[id] = (byte) tex;
108 block_hp[id] = hp;
109 block_coll[id] = (byte) coll;
110 block_tool[id] = (byte) tool;
111 block_lvl[id] = (byte) lvl;
112 block_flags[id] = (byte) flags;
113 block_tr[id] = (byte) tr;
114 block_li[id] = (byte) li;
115 } catch(Exception e) {e.printStackTrace();}
118 public static int getblocktex(int id)
120 try {
121 return (int) block_tex[id] & 0xFF;
122 } catch(Exception e) {/*e.printStackTrace();*/ return 0;}
125 public static int getblockhp(int id)
127 try {
128 return block_hp[id];
129 } catch(Exception e) {/*e.printStackTrace();*/ return 0;}
132 public static int getblockcoll(int id)
134 try {
135 return (int) block_coll[id] & 0xFF;
136 } catch(Exception e) {/*e.printStackTrace();*/ return 0;}
139 public static int getblocktool(int id)
141 try {
142 return (int) block_tool[id] & 0xFF;
143 } catch(Exception e) {/*e.printStackTrace();*/ return 0;}
146 public static int getblocklvl(int id)
148 try {
149 return (int) block_lvl[id] & 0xFF;
150 } catch(Exception e) {/*e.printStackTrace();*/ return 0;}
153 public static int getblockflags(int id)
155 try {
156 return (int) block_flags[id] & 0xFF;
157 } catch(Exception e) {/*e.printStackTrace();*/ return 0;}
160 public static int getblocktr(int id)
162 try {
163 return (int) block_tr[id] & 0xFF;
164 } catch(Exception e) {/*e.printStackTrace();*/ return 0;}
167 public static int getblockli(int id)
169 try {
170 return (int) block_li[id] & 0xFF;
171 } catch(Exception e) {/*e.printStackTrace();*/ return 0;}
174 /*Craft*/
175 public static void reset_crafts(int len)
177 try {
178 craftIN_item = new byte[4][len];
179 craftIN_sum = new byte[4][len];
180 craftOUT_item = new byte[len];
181 craftOUT_sum = new int[len];
182 craftOUT_flag = new byte[len];
183 } catch(Exception e) {e.printStackTrace();}
186 public static void set_craft(int id, int item0, int sum0, int item1, int sum1, int item2, int sum2, int item3, int sum3, int outitem, int outsum, int flag)
188 try {
189 craftIN_item[0][id] = (byte) item0;
190 craftIN_sum[0][id] = (byte) sum0;
191 craftIN_item[1][id] = (byte) item1;
192 craftIN_sum[1][id] = (byte) sum1;
193 craftIN_item[2][id] = (byte) item2;
194 craftIN_sum[2][id] = (byte) sum2;
195 craftIN_item[3][id] = (byte) item3;
196 craftIN_sum[3][id] = (byte) sum3;
197 craftOUT_item[id] = (byte) outitem;
198 craftOUT_sum[id] = outsum;
199 craftOUT_flag[id] = (byte) flag;
200 } catch(Exception e) {e.printStackTrace();}
203 public static void set_craftin_item(int id, int num, int item)
205 try {
206 craftIN_item[num][id] = (byte) item;
207 } catch(Exception e) {/*e.printStackTrace();*/}
210 public static void set_craftin_sum(int id, int num, int sum)
212 try {
213 craftIN_sum[num][id] = (byte) sum;
214 } catch(Exception e) {/*e.printStackTrace();*/}
217 public static void set_craftout_item(int id, int item)
219 try {
220 craftOUT_item[id] = (byte) item;
221 } catch(Exception e) {/*e.printStackTrace();*/}
224 public static void set_craftout_sum(int id, int sum)
226 try {
227 craftOUT_sum[id] = sum;
228 } catch(Exception e) {/*e.printStackTrace();*/}
231 public static void set_craftout_flag(int id, int flag)
233 try {
234 craftOUT_flag[id] = (byte) flag;
235 } catch(Exception e) {/*e.printStackTrace();*/}
238 public static int get_craftin_item(int id, int num)
240 try {
241 return craftIN_item[num][id] & 0xFF;
242 } catch(Exception e) {/*e.printStackTrace();*/ return 0;}
245 public static int get_craftin_sum(int id, int num)
247 try {
248 return craftIN_sum[num][id] & 0xFF;
249 } catch(Exception e) {/*e.printStackTrace();*/ return 0;}
252 public static int get_craftout_item(int id)
254 try {
255 return craftOUT_item[id] & 0xFF;
256 } catch(Exception e) {/*e.printStackTrace();*/ return 0;}
259 public static int get_craftout_sum(int id)
261 try {
262 return craftOUT_sum[id];
263 } catch(Exception e) {/*e.printStackTrace();*/ return 0;}
266 public static int get_craftout_flag(int id)
268 try {
269 return craftOUT_flag[id] & 0xFF;
270 } catch(Exception e) {/*e.printStackTrace();*/ return 0xFF;}
273 /*Tools*/
274 public static void resettools(int len)
276 try {
277 tool_type = new byte[len];
278 tool_lvl = new byte[len];
279 tool_speed = new byte[len];
280 tool_damg = new byte[len];
281 } catch(Exception e) {e.printStackTrace();}
284 public static void settooldata(int id, int tool, int lvl, int speed, int damg)
286 try {
287 tool_type[id] = (byte) tool;
288 tool_lvl[id] = (byte) lvl;
289 tool_speed[id] = (byte) speed;
290 tool_damg[id] = (byte) damg;
291 } catch(Exception e) {e.printStackTrace();}
294 public static int gettooltype(int id)
296 try {
297 return tool_type[item_info[id]];
298 } catch(Exception e) {/*e.printStackTrace();*/ return 0;}
301 public static int gettoollvl(int id)
303 try {
304 return tool_lvl[item_info[id]];
305 } catch(Exception e) {/*e.printStackTrace();*/ return 0;}
308 public static int gettoolspeed(int id)
310 try {
311 return tool_speed[item_info[id]];
312 } catch(Exception e) {/*e.printStackTrace();*/ return 0;}
315 public static int gettooldamg(int id)
317 try {
318 return tool_damg[item_info[id]];
319 } catch(Exception e) {/*e.printStackTrace();*/ return 0;}