Files
lakebane/src/engine/objects/ItemTemplate.java
T

50 lines
2.0 KiB
Java
Raw Normal View History

2024-02-18 11:00:56 -05:00
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
// Magicbane Emulator Project © 2013 - 2022
// www.magicbane.com
package engine.objects;
2024-02-18 11:39:11 -05:00
import engine.math.Vector3fImmutable;
import org.json.simple.JSONArray;
2024-02-18 11:00:56 -05:00
import org.json.simple.JSONObject;
import java.util.HashMap;
public class ItemTemplate {
2024-02-18 11:39:11 -05:00
// Global template lookup
2024-02-18 11:00:56 -05:00
public static HashMap<Integer, ItemTemplate> itemTemplates = new HashMap<>();
2024-02-18 11:39:11 -05:00
// Template Properties
public String obj_name = "";
public Vector3fImmutable obj_scale = new Vector3fImmutable();
2024-02-18 11:41:24 -05:00
public int obj_render_object;
2024-02-18 12:15:13 -05:00
public HashMap<String, Float> combat_attack_resist = new HashMap<>();
2024-02-18 11:39:11 -05:00
2024-02-18 11:00:56 -05:00
public ItemTemplate(JSONObject jsonObject) {
2024-02-18 11:39:11 -05:00
obj_name = (String) jsonObject.get("obj_name");
2024-02-18 11:55:45 -05:00
2024-02-18 12:04:41 -05:00
JSONArray scaleData = (JSONArray) jsonObject.get("obj_scale");
obj_scale = new Vector3fImmutable(((Double) scaleData.get(0)).floatValue(), ((Double) scaleData.get(1)).floatValue(),
((Double) scaleData.get(2)).floatValue());
2024-02-18 11:55:45 -05:00
2024-02-18 11:49:24 -05:00
obj_render_object = ((Long) jsonObject.get("obj_render_object")).intValue();
2024-02-18 12:15:13 -05:00
2024-02-18 12:26:11 -05:00
JSONObject resist_json = (JSONObject) jsonObject.get("combat_attack_resist");
for (Object key : resist_json.keySet()) {
Float resist = (Float) resist_json.get((String) key);
combat_attack_resist.put((String) key, resist);
}
2024-02-18 11:00:56 -05:00
}
}