ItemParamStringData.java 577 Bytes
Newer Older
1
2
3
package emu.grasscutter.data.common;

public class ItemParamStringData {
Melledy's avatar
Melledy committed
4
5
	private int id;
    private String count;
6
7
8
9

    public ItemParamStringData() {}

	public int getId() {
Melledy's avatar
Melledy committed
10
		return id;
11
12
13
	}

	public String getCount() {
Melledy's avatar
Melledy committed
14
		return count;
15
16
17
	}
	
	public ItemParamData toItemParamData() {
Melledy's avatar
Melledy committed
18
19
20
21
22
		if (count.contains(";")) {
			String[] split = count.split(";");
			count = count.split(";")[split.length - 1];
		} else if (count.contains(".")) {
			return new ItemParamData(id, (int) Math.ceil(Double.parseDouble(count)));
23
		}
Melledy's avatar
Melledy committed
24
		return new ItemParamData(id, Integer.parseInt(count));
25
26
	}
}