artificer/api/schemas/skill_info.zig

22 lines
593 B
Zig

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: i64,
items: Items,
pub fn parse(store: *Store, obj: json.ObjectMap) !SkillInfo {
const items = json_utils.getArray(obj, "items") orelse return error.MissingProperty;
return SkillInfo{
.xp = try json_utils.getIntegerRequired(obj, "xp"),
.items = try Items.parse(store, items),
};
}