// automatically generated by the FlatBuffers compiler, do not modify


// @generated

use core::mem;
use core::cmp::Ordering;

extern crate flatbuffers;
use self::flatbuffers::{EndianScalar, Follow};

pub enum WeaponStarTemplateOffset {}
#[derive(Copy, Clone, PartialEq)]

pub struct WeaponStarTemplate<'a> {
  pub _tab: flatbuffers::Table<'a>,
}

impl<'a> flatbuffers::Follow<'a> for WeaponStarTemplate<'a> {
  type Inner = WeaponStarTemplate<'a>;
  #[inline]
  unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
    Self { _tab: flatbuffers::Table::new(buf, loc) }
  }
}

impl<'a> WeaponStarTemplate<'a> {
  pub const VT_RARITY: flatbuffers::VOffsetT = 4;
  pub const VT_STAR: flatbuffers::VOffsetT = 6;
  pub const VT_MIN_LEVEL: flatbuffers::VOffsetT = 8;
  pub const VT_MAX_LEVEL: flatbuffers::VOffsetT = 10;
  pub const VT_STAR_RATE: flatbuffers::VOffsetT = 12;
  pub const VT_RAND_RATE: flatbuffers::VOffsetT = 14;
  pub const VT_UNK_6: flatbuffers::VOffsetT = 16;
  pub const VT_UNK_7: flatbuffers::VOffsetT = 18;
  pub const VT_UNK_8: flatbuffers::VOffsetT = 20;
  pub const VT_UNK_9: flatbuffers::VOffsetT = 22;
  pub const VT_UNK_10: flatbuffers::VOffsetT = 24;
  pub const VT_UNK_11: flatbuffers::VOffsetT = 26;
  pub const VT_UNK_12: flatbuffers::VOffsetT = 28;

  #[inline]
  pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
    WeaponStarTemplate { _tab: table }
  }
  #[allow(unused_mut)]
  pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>(
    _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>,
    args: &'args WeaponStarTemplateArgs
  ) -> flatbuffers::WIPOffset<WeaponStarTemplate<'bldr>> {
    let mut builder = WeaponStarTemplateBuilder::new(_fbb);
    builder.add_unk_12(args.unk_12);
    builder.add_unk_11(args.unk_11);
    builder.add_unk_10(args.unk_10);
    builder.add_unk_9(args.unk_9);
    builder.add_unk_8(args.unk_8);
    builder.add_unk_7(args.unk_7);
    builder.add_unk_6(args.unk_6);
    builder.add_rand_rate(args.rand_rate);
    builder.add_star_rate(args.star_rate);
    builder.add_max_level(args.max_level);
    builder.add_min_level(args.min_level);
    builder.add_star(args.star);
    builder.add_rarity(args.rarity);
    builder.finish()
  }


  #[inline]
  pub fn rarity(&self) -> u32 {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<u32>(WeaponStarTemplate::VT_RARITY, Some(0)).unwrap()}
  }
  #[inline]
  pub fn star(&self) -> u32 {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<u32>(WeaponStarTemplate::VT_STAR, Some(0)).unwrap()}
  }
  #[inline]
  pub fn min_level(&self) -> u32 {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<u32>(WeaponStarTemplate::VT_MIN_LEVEL, Some(0)).unwrap()}
  }
  #[inline]
  pub fn max_level(&self) -> u32 {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<u32>(WeaponStarTemplate::VT_MAX_LEVEL, Some(0)).unwrap()}
  }
  #[inline]
  pub fn star_rate(&self) -> u32 {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<u32>(WeaponStarTemplate::VT_STAR_RATE, Some(0)).unwrap()}
  }
  #[inline]
  pub fn rand_rate(&self) -> u32 {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<u32>(WeaponStarTemplate::VT_RAND_RATE, Some(0)).unwrap()}
  }
  #[inline]
  pub fn unk_6(&self) -> i32 {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<i32>(WeaponStarTemplate::VT_UNK_6, Some(0)).unwrap()}
  }
  #[inline]
  pub fn unk_7(&self) -> i32 {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<i32>(WeaponStarTemplate::VT_UNK_7, Some(0)).unwrap()}
  }
  #[inline]
  pub fn unk_8(&self) -> i32 {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<i32>(WeaponStarTemplate::VT_UNK_8, Some(0)).unwrap()}
  }
  #[inline]
  pub fn unk_9(&self) -> i32 {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<i32>(WeaponStarTemplate::VT_UNK_9, Some(0)).unwrap()}
  }
  #[inline]
  pub fn unk_10(&self) -> i32 {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<i32>(WeaponStarTemplate::VT_UNK_10, Some(0)).unwrap()}
  }
  #[inline]
  pub fn unk_11(&self) -> i32 {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<i32>(WeaponStarTemplate::VT_UNK_11, Some(0)).unwrap()}
  }
  #[inline]
  pub fn unk_12(&self) -> i32 {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<i32>(WeaponStarTemplate::VT_UNK_12, Some(0)).unwrap()}
  }
}

impl flatbuffers::Verifiable for WeaponStarTemplate<'_> {
  #[inline]
  fn run_verifier(
    v: &mut flatbuffers::Verifier, pos: usize
  ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
    use self::flatbuffers::Verifiable;
    v.visit_table(pos)?
     .visit_field::<u32>("rarity", Self::VT_RARITY, false)?
     .visit_field::<u32>("star", Self::VT_STAR, false)?
     .visit_field::<u32>("min_level", Self::VT_MIN_LEVEL, false)?
     .visit_field::<u32>("max_level", Self::VT_MAX_LEVEL, false)?
     .visit_field::<u32>("star_rate", Self::VT_STAR_RATE, false)?
     .visit_field::<u32>("rand_rate", Self::VT_RAND_RATE, false)?
     .visit_field::<i32>("unk_6", Self::VT_UNK_6, false)?
     .visit_field::<i32>("unk_7", Self::VT_UNK_7, false)?
     .visit_field::<i32>("unk_8", Self::VT_UNK_8, false)?
     .visit_field::<i32>("unk_9", Self::VT_UNK_9, false)?
     .visit_field::<i32>("unk_10", Self::VT_UNK_10, false)?
     .visit_field::<i32>("unk_11", Self::VT_UNK_11, false)?
     .visit_field::<i32>("unk_12", Self::VT_UNK_12, false)?
     .finish();
    Ok(())
  }
}
pub struct WeaponStarTemplateArgs {
    pub rarity: u32,
    pub star: u32,
    pub min_level: u32,
    pub max_level: u32,
    pub star_rate: u32,
    pub rand_rate: u32,
    pub unk_6: i32,
    pub unk_7: i32,
    pub unk_8: i32,
    pub unk_9: i32,
    pub unk_10: i32,
    pub unk_11: i32,
    pub unk_12: i32,
}
impl<'a> Default for WeaponStarTemplateArgs {
  #[inline]
  fn default() -> Self {
    WeaponStarTemplateArgs {
      rarity: 0,
      star: 0,
      min_level: 0,
      max_level: 0,
      star_rate: 0,
      rand_rate: 0,
      unk_6: 0,
      unk_7: 0,
      unk_8: 0,
      unk_9: 0,
      unk_10: 0,
      unk_11: 0,
      unk_12: 0,
    }
  }
}

pub struct WeaponStarTemplateBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> {
  fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>,
  start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
}
impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> WeaponStarTemplateBuilder<'a, 'b, A> {
  #[inline]
  pub fn add_rarity(&mut self, rarity: u32) {
    self.fbb_.push_slot::<u32>(WeaponStarTemplate::VT_RARITY, rarity, 0);
  }
  #[inline]
  pub fn add_star(&mut self, star: u32) {
    self.fbb_.push_slot::<u32>(WeaponStarTemplate::VT_STAR, star, 0);
  }
  #[inline]
  pub fn add_min_level(&mut self, min_level: u32) {
    self.fbb_.push_slot::<u32>(WeaponStarTemplate::VT_MIN_LEVEL, min_level, 0);
  }
  #[inline]
  pub fn add_max_level(&mut self, max_level: u32) {
    self.fbb_.push_slot::<u32>(WeaponStarTemplate::VT_MAX_LEVEL, max_level, 0);
  }
  #[inline]
  pub fn add_star_rate(&mut self, star_rate: u32) {
    self.fbb_.push_slot::<u32>(WeaponStarTemplate::VT_STAR_RATE, star_rate, 0);
  }
  #[inline]
  pub fn add_rand_rate(&mut self, rand_rate: u32) {
    self.fbb_.push_slot::<u32>(WeaponStarTemplate::VT_RAND_RATE, rand_rate, 0);
  }
  #[inline]
  pub fn add_unk_6(&mut self, unk_6: i32) {
    self.fbb_.push_slot::<i32>(WeaponStarTemplate::VT_UNK_6, unk_6, 0);
  }
  #[inline]
  pub fn add_unk_7(&mut self, unk_7: i32) {
    self.fbb_.push_slot::<i32>(WeaponStarTemplate::VT_UNK_7, unk_7, 0);
  }
  #[inline]
  pub fn add_unk_8(&mut self, unk_8: i32) {
    self.fbb_.push_slot::<i32>(WeaponStarTemplate::VT_UNK_8, unk_8, 0);
  }
  #[inline]
  pub fn add_unk_9(&mut self, unk_9: i32) {
    self.fbb_.push_slot::<i32>(WeaponStarTemplate::VT_UNK_9, unk_9, 0);
  }
  #[inline]
  pub fn add_unk_10(&mut self, unk_10: i32) {
    self.fbb_.push_slot::<i32>(WeaponStarTemplate::VT_UNK_10, unk_10, 0);
  }
  #[inline]
  pub fn add_unk_11(&mut self, unk_11: i32) {
    self.fbb_.push_slot::<i32>(WeaponStarTemplate::VT_UNK_11, unk_11, 0);
  }
  #[inline]
  pub fn add_unk_12(&mut self, unk_12: i32) {
    self.fbb_.push_slot::<i32>(WeaponStarTemplate::VT_UNK_12, unk_12, 0);
  }
  #[inline]
  pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> WeaponStarTemplateBuilder<'a, 'b, A> {
    let start = _fbb.start_table();
    WeaponStarTemplateBuilder {
      fbb_: _fbb,
      start_: start,
    }
  }
  #[inline]
  pub fn finish(self) -> flatbuffers::WIPOffset<WeaponStarTemplate<'a>> {
    let o = self.fbb_.end_table(self.start_);
    flatbuffers::WIPOffset::new(o.value())
  }
}

impl core::fmt::Debug for WeaponStarTemplate<'_> {
  fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
    let mut ds = f.debug_struct("WeaponStarTemplate");
      ds.field("rarity", &self.rarity());
      ds.field("star", &self.star());
      ds.field("min_level", &self.min_level());
      ds.field("max_level", &self.max_level());
      ds.field("star_rate", &self.star_rate());
      ds.field("rand_rate", &self.rand_rate());
      ds.field("unk_6", &self.unk_6());
      ds.field("unk_7", &self.unk_7());
      ds.field("unk_8", &self.unk_8());
      ds.field("unk_9", &self.unk_9());
      ds.field("unk_10", &self.unk_10());
      ds.field("unk_11", &self.unk_11());
      ds.field("unk_12", &self.unk_12());
      ds.finish()
  }
}
pub enum WeaponStarTemplateTbOffset {}
#[derive(Copy, Clone, PartialEq)]

pub struct WeaponStarTemplateTb<'a> {
  pub _tab: flatbuffers::Table<'a>,
}

impl<'a> flatbuffers::Follow<'a> for WeaponStarTemplateTb<'a> {
  type Inner = WeaponStarTemplateTb<'a>;
  #[inline]
  unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
    Self { _tab: flatbuffers::Table::new(buf, loc) }
  }
}

impl<'a> WeaponStarTemplateTb<'a> {
  pub const VT_DATA: flatbuffers::VOffsetT = 4;

  #[inline]
  pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
    WeaponStarTemplateTb { _tab: table }
  }
  #[allow(unused_mut)]
  pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>(
    _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>,
    args: &'args WeaponStarTemplateTbArgs<'args>
  ) -> flatbuffers::WIPOffset<WeaponStarTemplateTb<'bldr>> {
    let mut builder = WeaponStarTemplateTbBuilder::new(_fbb);
    if let Some(x) = args.data { builder.add_data(x); }
    builder.finish()
  }


  #[inline]
  pub fn data(&self) -> Option<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<WeaponStarTemplate<'a>>>> {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<WeaponStarTemplate>>>>(WeaponStarTemplateTb::VT_DATA, None)}
  }
}

impl flatbuffers::Verifiable for WeaponStarTemplateTb<'_> {
  #[inline]
  fn run_verifier(
    v: &mut flatbuffers::Verifier, pos: usize
  ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
    use self::flatbuffers::Verifiable;
    v.visit_table(pos)?
     .visit_field::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'_, flatbuffers::ForwardsUOffset<WeaponStarTemplate>>>>("data", Self::VT_DATA, false)?
     .finish();
    Ok(())
  }
}
pub struct WeaponStarTemplateTbArgs<'a> {
    pub data: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<WeaponStarTemplate<'a>>>>>,
}
impl<'a> Default for WeaponStarTemplateTbArgs<'a> {
  #[inline]
  fn default() -> Self {
    WeaponStarTemplateTbArgs {
      data: None,
    }
  }
}

pub struct WeaponStarTemplateTbBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> {
  fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>,
  start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
}
impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> WeaponStarTemplateTbBuilder<'a, 'b, A> {
  #[inline]
  pub fn add_data(&mut self, data: flatbuffers::WIPOffset<flatbuffers::Vector<'b , flatbuffers::ForwardsUOffset<WeaponStarTemplate<'b >>>>) {
    self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(WeaponStarTemplateTb::VT_DATA, data);
  }
  #[inline]
  pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> WeaponStarTemplateTbBuilder<'a, 'b, A> {
    let start = _fbb.start_table();
    WeaponStarTemplateTbBuilder {
      fbb_: _fbb,
      start_: start,
    }
  }
  #[inline]
  pub fn finish(self) -> flatbuffers::WIPOffset<WeaponStarTemplateTb<'a>> {
    let o = self.fbb_.end_table(self.start_);
    flatbuffers::WIPOffset::new(o.value())
  }
}

impl core::fmt::Debug for WeaponStarTemplateTb<'_> {
  fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
    let mut ds = f.debug_struct("WeaponStarTemplateTb");
      ds.field("data", &self.data());
      ds.finish()
  }
}
