const std = @import("std"); const Store = @import("../store.zig"); const BoundedSlotsArray = @import("./slot_array.zig").BoundedSlotsArray; const json_utils = @import("../json_utils.zig"); const json = std.json; const Items = BoundedSlotsArray(8); const SkillInfo = @This(); xp: u64, items: Items, pub fn parse(store: *Store, obj: json.ObjectMap) !SkillInfo { const items = json_utils.getArray(obj, "items") orelse return error.MissingProperty; const xp = try json_utils.getIntegerRequired(obj, "xp"); if (xp < 0) { return error.InvalidXp; } return SkillInfo{ .xp = @intCast(xp), .items = try Items.parse(store, items), }; }