# automatically generated by the FlatBuffers compiler, do not modify

# namespace: MyGame

import flatbuffers
from flatbuffers.compat import import_numpy
np = import_numpy()

class MonsterExtra(object):
    __slots__ = ['_tab']

    @classmethod
    def GetRootAs(cls, buf, offset=0):
        n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
        x = MonsterExtra()
        x.Init(buf, n + offset)
        return x

    @classmethod
    def GetRootAsMonsterExtra(cls, buf, offset=0):
        """This method is deprecated. Please switch to GetRootAs."""
        return cls.GetRootAs(buf, offset)
    @classmethod
    def MonsterExtraBufferHasIdentifier(cls, buf, offset, size_prefixed=False):
        return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x4D\x4F\x4E\x45", size_prefixed=size_prefixed)

    # MonsterExtra
    def Init(self, buf, pos):
        self._tab = flatbuffers.table.Table(buf, pos)

    # MonsterExtra
    def D0(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos)
        return float('nan')

    # MonsterExtra
    def D1(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos)
        return float('nan')

    # MonsterExtra
    def D2(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos)
        return float('inf')

    # MonsterExtra
    def D3(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos)
        return float('-inf')

    # MonsterExtra
    def F0(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Float32Flags, o + self._tab.Pos)
        return float('nan')

    # MonsterExtra
    def F1(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Float32Flags, o + self._tab.Pos)
        return float('nan')

    # MonsterExtra
    def F2(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Float32Flags, o + self._tab.Pos)
        return float('inf')

    # MonsterExtra
    def F3(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(18))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Float32Flags, o + self._tab.Pos)
        return float('-inf')

    # MonsterExtra
    def Dvec(self, j):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(20))
        if o != 0:
            a = self._tab.Vector(o)
            return self._tab.Get(flatbuffers.number_types.Float64Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 8))
        return 0

    # MonsterExtra
    def DvecAsNumpy(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(20))
        if o != 0:
            return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Float64Flags, o)
        return 0

    # MonsterExtra
    def DvecLength(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(20))
        if o != 0:
            return self._tab.VectorLen(o)
        return 0

    # MonsterExtra
    def DvecIsNone(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(20))
        return o == 0

    # MonsterExtra
    def Fvec(self, j):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(22))
        if o != 0:
            a = self._tab.Vector(o)
            return self._tab.Get(flatbuffers.number_types.Float32Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4))
        return 0

    # MonsterExtra
    def FvecAsNumpy(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(22))
        if o != 0:
            return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Float32Flags, o)
        return 0

    # MonsterExtra
    def FvecLength(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(22))
        if o != 0:
            return self._tab.VectorLen(o)
        return 0

    # MonsterExtra
    def FvecIsNone(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(22))
        return o == 0

def Start(builder): builder.StartObject(11)
def MonsterExtraStart(builder):
    """This method is deprecated. Please switch to Start."""
    return Start(builder)
def AddD0(builder, d0): builder.PrependFloat64Slot(0, d0, float('nan'))
def MonsterExtraAddD0(builder, d0):
    """This method is deprecated. Please switch to AddD0."""
    return AddD0(builder, d0)
def AddD1(builder, d1): builder.PrependFloat64Slot(1, d1, float('nan'))
def MonsterExtraAddD1(builder, d1):
    """This method is deprecated. Please switch to AddD1."""
    return AddD1(builder, d1)
def AddD2(builder, d2): builder.PrependFloat64Slot(2, d2, float('inf'))
def MonsterExtraAddD2(builder, d2):
    """This method is deprecated. Please switch to AddD2."""
    return AddD2(builder, d2)
def AddD3(builder, d3): builder.PrependFloat64Slot(3, d3, float('-inf'))
def MonsterExtraAddD3(builder, d3):
    """This method is deprecated. Please switch to AddD3."""
    return AddD3(builder, d3)
def AddF0(builder, f0): builder.PrependFloat32Slot(4, f0, float('nan'))
def MonsterExtraAddF0(builder, f0):
    """This method is deprecated. Please switch to AddF0."""
    return AddF0(builder, f0)
def AddF1(builder, f1): builder.PrependFloat32Slot(5, f1, float('nan'))
def MonsterExtraAddF1(builder, f1):
    """This method is deprecated. Please switch to AddF1."""
    return AddF1(builder, f1)
def AddF2(builder, f2): builder.PrependFloat32Slot(6, f2, float('inf'))
def MonsterExtraAddF2(builder, f2):
    """This method is deprecated. Please switch to AddF2."""
    return AddF2(builder, f2)
def AddF3(builder, f3): builder.PrependFloat32Slot(7, f3, float('-inf'))
def MonsterExtraAddF3(builder, f3):
    """This method is deprecated. Please switch to AddF3."""
    return AddF3(builder, f3)
def AddDvec(builder, dvec): builder.PrependUOffsetTRelativeSlot(8, flatbuffers.number_types.UOffsetTFlags.py_type(dvec), 0)
def MonsterExtraAddDvec(builder, dvec):
    """This method is deprecated. Please switch to AddDvec."""
    return AddDvec(builder, dvec)
def StartDvecVector(builder, numElems): return builder.StartVector(8, numElems, 8)
def MonsterExtraStartDvecVector(builder, numElems):
    """This method is deprecated. Please switch to Start."""
    return StartDvecVector(builder, numElems)
def AddFvec(builder, fvec): builder.PrependUOffsetTRelativeSlot(9, flatbuffers.number_types.UOffsetTFlags.py_type(fvec), 0)
def MonsterExtraAddFvec(builder, fvec):
    """This method is deprecated. Please switch to AddFvec."""
    return AddFvec(builder, fvec)
def StartFvecVector(builder, numElems): return builder.StartVector(4, numElems, 4)
def MonsterExtraStartFvecVector(builder, numElems):
    """This method is deprecated. Please switch to Start."""
    return StartFvecVector(builder, numElems)
def End(builder): return builder.EndObject()
def MonsterExtraEnd(builder):
    """This method is deprecated. Please switch to End."""
    return End(builder)
try:
    from typing import List
except:
    pass

class MonsterExtraT(object):

    # MonsterExtraT
    def __init__(self):
        self.d0 = float('nan')  # type: float
        self.d1 = float('nan')  # type: float
        self.d2 = float('inf')  # type: float
        self.d3 = float('-inf')  # type: float
        self.f0 = float('nan')  # type: float
        self.f1 = float('nan')  # type: float
        self.f2 = float('inf')  # type: float
        self.f3 = float('-inf')  # type: float
        self.dvec = None  # type: List[float]
        self.fvec = None  # type: List[float]

    @classmethod
    def InitFromBuf(cls, buf, pos):
        monsterExtra = MonsterExtra()
        monsterExtra.Init(buf, pos)
        return cls.InitFromObj(monsterExtra)

    @classmethod
    def InitFromObj(cls, monsterExtra):
        x = MonsterExtraT()
        x._UnPack(monsterExtra)
        return x

    # MonsterExtraT
    def _UnPack(self, monsterExtra):
        if monsterExtra is None:
            return
        self.d0 = monsterExtra.D0()
        self.d1 = monsterExtra.D1()
        self.d2 = monsterExtra.D2()
        self.d3 = monsterExtra.D3()
        self.f0 = monsterExtra.F0()
        self.f1 = monsterExtra.F1()
        self.f2 = monsterExtra.F2()
        self.f3 = monsterExtra.F3()
        if not monsterExtra.DvecIsNone():
            if np is None:
                self.dvec = []
                for i in range(monsterExtra.DvecLength()):
                    self.dvec.append(monsterExtra.Dvec(i))
            else:
                self.dvec = monsterExtra.DvecAsNumpy()
        if not monsterExtra.FvecIsNone():
            if np is None:
                self.fvec = []
                for i in range(monsterExtra.FvecLength()):
                    self.fvec.append(monsterExtra.Fvec(i))
            else:
                self.fvec = monsterExtra.FvecAsNumpy()

    # MonsterExtraT
    def Pack(self, builder):
        if self.dvec is not None:
            if np is not None and type(self.dvec) is np.ndarray:
                dvec = builder.CreateNumpyVector(self.dvec)
            else:
                StartDvecVector(builder, len(self.dvec))
                for i in reversed(range(len(self.dvec))):
                    builder.PrependFloat64(self.dvec[i])
                dvec = builder.EndVector()
        if self.fvec is not None:
            if np is not None and type(self.fvec) is np.ndarray:
                fvec = builder.CreateNumpyVector(self.fvec)
            else:
                StartFvecVector(builder, len(self.fvec))
                for i in reversed(range(len(self.fvec))):
                    builder.PrependFloat32(self.fvec[i])
                fvec = builder.EndVector()
        Start(builder)
        AddD0(builder, self.d0)
        AddD1(builder, self.d1)
        AddD2(builder, self.d2)
        AddD3(builder, self.d3)
        AddF0(builder, self.f0)
        AddF1(builder, self.f1)
        AddF2(builder, self.f2)
        AddF3(builder, self.f3)
        if self.dvec is not None:
            AddDvec(builder, dvec)
        if self.fvec is not None:
            AddFvec(builder, fvec)
        monsterExtra = End(builder)
        return monsterExtra
