artificer/api/schemas/skill_info.zig

22 lines
592 B
Zig

const std = @import("std");
const Server = @import("../server.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(api: *Server, 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(api, items),
};
}