use std::collections::HashMap;
use crate::defines::{ReeFloat, ReeInt};
#[derive(Debug)]
pub struct Container<T> {
pub data: Vec<T>,
pub errors: Vec<String>,
}
impl<T> Container<T> {
pub fn new(data: Vec<T>, errors: Vec<String>) -> Container<T> {
Container { data, errors }
}
}
#[derive(Debug)]
pub enum Primitive {
Null,
Bool(bool),
Int(ReeInt),
Float(ReeFloat),
String(String),
}
#[derive(Debug)]
pub struct Item {
pub id: ReeInt,
pub group_id: ReeInt,
}
impl Item {
pub fn new(id: ReeInt, group_id: ReeInt) -> Item {
Item { id, group_id }
}
}
#[derive(Debug)]
pub struct ItemGroup {
pub id: ReeInt,
pub category_id: ReeInt,
}
impl ItemGroup {
pub fn new(id: ReeInt, category_id: ReeInt) -> ItemGroup {
ItemGroup { id, category_id }
}
}
#[derive(Debug)]
pub struct Attr {
pub id: ReeInt,
pub stackable: bool,
pub high_is_good: bool,
pub default_value: ReeFloat,
}
impl Attr {
pub fn new(id: ReeInt, stackable: bool, high_is_good: bool, default_value: ReeFloat) -> Attr {
Attr {
id,
stackable,
high_is_good,
default_value,
}
}
}
#[derive(Debug)]
pub struct ItemAttr {
pub item_id: ReeInt,
pub attr_id: ReeInt,
pub value: ReeFloat,
}
impl ItemAttr {
pub fn new(item_id: ReeInt, attr_id: ReeInt, value: ReeFloat) -> ItemAttr {
ItemAttr {
item_id,
attr_id,
value,
}
}
}
#[derive(Debug)]
pub struct Effect {
pub id: ReeInt,
pub category_id: ReeInt,
pub is_assistance: bool,
pub is_offensive: bool,
pub is_warp_safe: bool,
pub discharge_attr_id: Option<ReeInt>,
pub duration_attr_id: Option<ReeInt>,
pub range_attr_id: Option<ReeInt>,
pub falloff_attr_id: Option<ReeInt>,
pub tracking_attr_id: Option<ReeInt>,
pub usage_chance_attr_id: Option<ReeInt>,
pub resist_attr_id: Option<ReeInt>,
pub mods: Vec<EffectMod>,
}
impl Effect {
pub fn new(
id: ReeInt,
category_id: ReeInt,
is_assistance: bool,
is_offensive: bool,
is_warp_safe: bool,
discharge_attr_id: Option<ReeInt>,
duration_attr_id: Option<ReeInt>,
range_attr_id: Option<ReeInt>,
falloff_attr_id: Option<ReeInt>,
tracking_attr_id: Option<ReeInt>,
usage_chance_attr_id: Option<ReeInt>,
resist_attr_id: Option<ReeInt>,
mods: Vec<EffectMod>,
) -> Effect {
Effect {
id,
category_id,
is_assistance,
is_offensive,
is_warp_safe,
discharge_attr_id,
duration_attr_id,
range_attr_id,
falloff_attr_id,
tracking_attr_id,
usage_chance_attr_id,
resist_attr_id,
mods,
}
}
}
#[derive(Debug)]
pub struct EffectMod {
pub func: String,
pub args: HashMap<String, Primitive>,
}
impl EffectMod {
pub fn new<T: Into<String>>(func: T, args: HashMap<String, Primitive>) -> EffectMod {
EffectMod {
func: func.into(),
args,
}
}
}
#[derive(Debug)]
pub struct ItemEffect {
pub item_id: ReeInt,
pub effect_id: ReeInt,
pub is_default: bool,
}
impl ItemEffect {
pub fn new(item_id: ReeInt, effect_id: ReeInt, is_default: bool) -> ItemEffect {
ItemEffect {
item_id,
effect_id,
is_default,
}
}
}
#[derive(Debug)]
pub struct MutaItemConv {
pub muta_id: ReeInt,
pub in_item_id: ReeInt,
pub out_item_id: ReeInt,
}
impl MutaItemConv {
pub fn new(muta_id: ReeInt, in_item_id: ReeInt, out_item_id: ReeInt) -> MutaItemConv {
MutaItemConv {
muta_id,
in_item_id,
out_item_id,
}
}
}
#[derive(Debug)]
pub struct MutaAttrMod {
pub muta_id: ReeInt,
pub attr_id: ReeInt,
pub min_attr_mult: ReeFloat,
pub max_attr_mult: ReeFloat,
}
impl MutaAttrMod {
pub fn new(muta_id: ReeInt, attr_id: ReeInt, min_attr_mult: ReeFloat, max_attr_mult: ReeFloat) -> MutaAttrMod {
MutaAttrMod {
muta_id,
attr_id,
min_attr_mult,
max_attr_mult,
}
}
}
#[derive(Debug)]
pub struct Buff {
pub id: ReeInt,
pub aggregate_mode: String,
pub operation: String,
pub item_mods: Vec<BuffIM>,
pub loc_mods: Vec<BuffLM>,
pub locgroup_mods: Vec<BuffLGM>,
pub locsrq_mods: Vec<BuffLRSM>,
}
impl Buff {
pub fn new<T: Into<String>, U: Into<String>>(
id: ReeInt,
aggregate_mode: T,
operation: U,
item_mods: Vec<BuffIM>,
loc_mods: Vec<BuffLM>,
locgroup_mods: Vec<BuffLGM>,
locsrq_mods: Vec<BuffLRSM>,
) -> Buff {
Buff {
id,
aggregate_mode: aggregate_mode.into(),
operation: operation.into(),
item_mods,
loc_mods,
locgroup_mods,
locsrq_mods,
}
}
}
#[derive(Debug)]
pub struct BuffIM {
pub attr_id: ReeInt,
}
impl BuffIM {
pub fn new(attr_id: ReeInt) -> BuffIM {
BuffIM { attr_id }
}
}
#[derive(Debug)]
pub struct BuffLM {
pub attr_id: ReeInt,
}
impl BuffLM {
pub fn new(attr_id: ReeInt) -> BuffLM {
BuffLM { attr_id }
}
}
#[derive(Debug)]
pub struct BuffLGM {
pub attr_id: ReeInt,
pub group_id: ReeInt,
}
impl BuffLGM {
pub fn new(attr_id: ReeInt, group_id: ReeInt) -> BuffLGM {
BuffLGM { attr_id, group_id }
}
}
#[derive(Debug)]
pub struct BuffLRSM {
pub attr_id: ReeInt,
pub skill_id: ReeInt,
}
impl BuffLRSM {
pub fn new(attr_id: ReeInt, skill_id: ReeInt) -> BuffLRSM {
BuffLRSM { attr_id, skill_id }
}
}
#[derive(Debug)]
pub struct FighterAbil {
pub id: ReeInt,
pub target_mode: String,
pub disallow_hisec: bool,
pub disallow_lowsec: bool,
}
impl FighterAbil {
pub fn new<T: Into<String>>(
id: ReeInt,
target_mode: T,
disallow_hisec: bool,
disallow_lowsec: bool,
) -> FighterAbil {
FighterAbil {
id,
target_mode: target_mode.into(),
disallow_hisec,
disallow_lowsec,
}
}
}
#[derive(Debug)]
pub struct ItemFighterAbil {
pub item_id: ReeInt,
pub abil_id: ReeInt,
pub cooldown: Option<ReeFloat>,
pub charge_count: Option<ReeInt>,
pub charge_rearm_time: Option<ReeFloat>,
}
impl ItemFighterAbil {
pub fn new(
item_id: ReeInt,
abil_id: ReeInt,
cooldown: Option<ReeFloat>,
charge_count: Option<ReeInt>,
charge_rearm_time: Option<ReeFloat>,
) -> ItemFighterAbil {
ItemFighterAbil {
item_id,
abil_id,
cooldown,
charge_count,
charge_rearm_time,
}
}
}
#[derive(Debug)]
pub struct ItemSkillReq {
pub item_id: ReeInt,
pub skill_id: ReeInt,
pub level: ReeInt,
}
impl ItemSkillReq {
pub fn new(item_id: ReeInt, skill_id: ReeInt, level: ReeInt) -> ItemSkillReq {
ItemSkillReq {
item_id,
skill_id,
level,
}
}
}