2026-10-17 09:51:20 -04:00
|
|
|
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
|
|
|
|
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
|
|
|
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
|
|
|
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
|
|
|
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
|
|
|
|
// Magicbane Emulator Project © 2013 - 2026
|
|
|
|
|
// https://www.magicbane.com
|
|
|
|
|
|
|
|
|
|
package engine.parsers.objects;
|
|
|
|
|
|
|
|
|
|
import engine.math.Vector3fImmutable;
|
|
|
|
|
import engine.mbEnums;
|
|
|
|
|
import org.json.JSONArray;
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.EnumMap;
|
|
|
|
|
import java.util.EnumSet;
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
import java.util.LinkedHashMap;
|
|
|
|
|
|
|
|
|
|
// Item template as defined by the client's cache data
|
|
|
|
|
// (MBDATA/data/COBJECTS/ITEM). Field names match the JSON keys.
|
|
|
|
|
// Field layout follows ArcItemTemplate_Load (sb.exe 0x4AABD0).
|
|
|
|
|
//
|
|
|
|
|
// Values are kept as the client defines them: no req/res splitting,
|
|
|
|
|
// no defaults substituted. Strings with a matching enum in mbEnums
|
|
|
|
|
// are stored as that enum; everything else stays a String.
|
|
|
|
|
//
|
|
|
|
|
// Not to be confused with engine.objects.ItemTemplate, which is loaded
|
|
|
|
|
// from the database. Read only once loaded.
|
|
|
|
|
|
2026-10-17 13:33:34 -04:00
|
|
|
public class ItemTemplate implements CObjectTemplate {
|
2026-10-17 09:51:20 -04:00
|
|
|
|
|
|
|
|
public static HashMap<Integer, ItemTemplate> _items = new HashMap<>();
|
|
|
|
|
|
|
|
|
|
public int template_id;
|
|
|
|
|
|
|
|
|
|
// obj_
|
|
|
|
|
|
|
|
|
|
public String obj_name;
|
|
|
|
|
public boolean obj_pickable;
|
|
|
|
|
public float obj_gravity;
|
|
|
|
|
public float obj_cull_distance;
|
|
|
|
|
public Vector3fImmutable obj_scale;
|
|
|
|
|
public int obj_render_object;
|
|
|
|
|
public boolean obj_double_fusion;
|
|
|
|
|
public Vector3fImmutable obj_forward_vector;
|
|
|
|
|
public String obj_tracking_name;
|
|
|
|
|
public float obj_max_tracking_distance;
|
|
|
|
|
public int obj_icon;
|
|
|
|
|
public float obj_gravity_f;
|
|
|
|
|
public final LinkedHashMap<String, Integer> obj_sound_events = new LinkedHashMap<>();
|
|
|
|
|
public JSONArray obj_arc_hardpoint_list;
|
|
|
|
|
public final HashMap<String, String> obj_sparse_data = new HashMap<>();
|
|
|
|
|
public int obj_render_object_low_detail;
|
|
|
|
|
public Vector3fImmutable obj_default_alignment;
|
|
|
|
|
public String obj_sound_table;
|
|
|
|
|
|
|
|
|
|
// combat_
|
|
|
|
|
|
|
|
|
|
public float combat_health_current;
|
|
|
|
|
public float combat_health_full;
|
|
|
|
|
public final EnumMap<mbEnums.DamageType, Float> combat_attack_resist = new EnumMap<>(mbEnums.DamageType.class);
|
|
|
|
|
public JSONArray combat_powers;
|
|
|
|
|
|
|
|
|
|
// item_
|
|
|
|
|
|
|
|
|
|
public mbEnums.ItemType item_type;
|
|
|
|
|
|
|
|
|
|
// Index into the client's equip slot names; the leading slot of EQSLOTAND.
|
|
|
|
|
public int item_eq_slots_value;
|
|
|
|
|
|
|
|
|
|
// true: any one of item_eq_slots_or; false: all of item_eq_slots_and (sb.exe 0x4AC430).
|
|
|
|
|
public boolean item_eq_slots_type;
|
|
|
|
|
public final EnumSet<mbEnums.EquipSlotType> item_eq_slots_or = EnumSet.noneOf(mbEnums.EquipSlotType.class);
|
|
|
|
|
public final EnumSet<mbEnums.EquipSlotType> item_eq_slots_and = EnumSet.noneOf(mbEnums.EquipSlotType.class);
|
|
|
|
|
public boolean item_takeable;
|
|
|
|
|
public int item_value;
|
|
|
|
|
public int item_wt;
|
|
|
|
|
public float item_passive_defense_mod;
|
|
|
|
|
public String item_base_name;
|
|
|
|
|
public String item_dsc;
|
|
|
|
|
public int item_render_object_female;
|
|
|
|
|
public float item_health_full;
|
|
|
|
|
public String item_skill_used;
|
|
|
|
|
public String item_skill_mastery_used;
|
|
|
|
|
public int item_parry_anim_id;
|
|
|
|
|
public final EnumMap<mbEnums.ShrineType, Integer> item_offering_info = new EnumMap<>(mbEnums.ShrineType.class);
|
|
|
|
|
|
|
|
|
|
// WEAPON only; null otherwise.
|
|
|
|
|
public Weapon item_weapon;
|
|
|
|
|
public mbEnums.AttributeType item_primary_attr;
|
|
|
|
|
public mbEnums.AttributeType item_secondary_attr;
|
|
|
|
|
|
|
|
|
|
// ARMOR only.
|
|
|
|
|
public float item_bulk_factor;
|
|
|
|
|
public int item_defense_rating;
|
|
|
|
|
|
|
|
|
|
public final EnumSet<mbEnums.ItemFlags> item_flags = EnumSet.noneOf(mbEnums.ItemFlags.class);
|
|
|
|
|
public final EnumSet<mbEnums.ItemUseFlags> item_use_flags = EnumSet.noneOf(mbEnums.ItemUseFlags.class);
|
|
|
|
|
public int item_post_item_id;
|
|
|
|
|
public int item_initial_charges;
|
|
|
|
|
|
|
|
|
|
// Read as an unsigned value, possibly a hash; 0 in every ITEM file.
|
|
|
|
|
public int item_book_arcana;
|
|
|
|
|
public final LinkedHashMap<String, Integer> item_skill_req = new LinkedHashMap<>();
|
|
|
|
|
|
|
|
|
|
// For race, class and disc: restrict true means the list is excluded
|
|
|
|
|
// (RACERESTRICT), false means it is required (RACEREQ).
|
|
|
|
|
public boolean item_race_req_restrict;
|
|
|
|
|
public final EnumSet<mbEnums.MonsterType> item_race_req = EnumSet.noneOf(mbEnums.MonsterType.class);
|
|
|
|
|
public boolean item_class_req_restrict;
|
|
|
|
|
public final EnumSet<mbEnums.ClassType> item_class_req = EnumSet.noneOf(mbEnums.ClassType.class);
|
|
|
|
|
public boolean item_disc_req_restrict;
|
|
|
|
|
public final EnumSet<mbEnums.DisciplineType> item_disc_req = EnumSet.noneOf(mbEnums.DisciplineType.class);
|
|
|
|
|
public final EnumMap<mbEnums.AttributeType, Integer> item_attr_req = new EnumMap<>(mbEnums.AttributeType.class);
|
|
|
|
|
public int item_level_req;
|
|
|
|
|
public int item_rank_req;
|
|
|
|
|
public mbEnums.SexType item_sex_req;
|
|
|
|
|
public final ArrayList<UserPowerAction> item_user_power_action = new ArrayList<>();
|
|
|
|
|
public final ArrayList<PowerGrant> item_power_grant = new ArrayList<>();
|
|
|
|
|
public final LinkedHashMap<String, ArrayList<int[]>> item_power_action = new LinkedHashMap<>();
|
|
|
|
|
|
|
|
|
|
// Sheath fields are only present when item_sheathable is true.
|
|
|
|
|
public boolean item_sheathable;
|
|
|
|
|
public mbEnums.SheathSlot item_sheath_slot;
|
|
|
|
|
public Vector3fImmutable item_sheath_offset;
|
|
|
|
|
public Vector3fImmutable item_sheath_rotation;
|
|
|
|
|
|
|
|
|
|
// The JSON holds false, or [flag, id] when the stub is present (ArcItemStubHolder2, sb.exe 0x4A8D40).
|
|
|
|
|
// Meaning of the flag is not known.
|
|
|
|
|
public boolean item_has_stub;
|
|
|
|
|
public boolean item_stub_flag;
|
|
|
|
|
public int item_stub_id;
|
|
|
|
|
|
|
|
|
|
public final EnumMap<mbEnums.ShrineType, Integer> item_offering_adjustments = new EnumMap<>(mbEnums.ShrineType.class);
|
|
|
|
|
public final EnumMap<mbEnums.ResourceType, Integer> item_resource_costs = new EnumMap<>(mbEnums.ResourceType.class);
|
|
|
|
|
public int item_bane_rank;
|
|
|
|
|
public boolean item_ignore_saved_actions;
|
|
|
|
|
|
|
|
|
|
// item_weapon (ArcAttackInfo_LoadWeapon, sb.exe 0x61FA60).
|
|
|
|
|
|
|
|
|
|
public static class Weapon {
|
|
|
|
|
|
|
|
|
|
public float weapon_wepspeed;
|
|
|
|
|
public float weapon_max_range;
|
|
|
|
|
public int weapon_projectile_id;
|
|
|
|
|
public float weapon_projectile_speed;
|
|
|
|
|
public int weapon_combat_idle_anim;
|
|
|
|
|
public final ArrayList<Damage> weapon_damage = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
// [animation, duration] pairs in file order; names from engine.objects.ItemTemplate, not the client.
|
|
|
|
|
public final ArrayList<int[]> weapon_attack_anim_right = new ArrayList<>();
|
|
|
|
|
public final ArrayList<int[]> weapon_attack_anim_left = new ArrayList<>();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// One entry of weapon_damage.
|
|
|
|
|
|
|
|
|
|
public static class Damage {
|
|
|
|
|
|
|
|
|
|
public mbEnums.DamageType damage_type;
|
|
|
|
|
public int damage_min;
|
|
|
|
|
public int damage_max;
|
|
|
|
|
}
|
|
|
|
|
}
|