<reponame>tsingson/flatbuffers-sample
# automatically generated by the FlatBuffers compiler, do not modify

# namespace: Sample

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

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

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

    @classmethod
    def MonsterBufferHasIdentifier(cls, buf, offset, size_prefixed=False):
        return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x4D\x47\x4D\x45", size_prefixed=size_prefixed)

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

    # Monster
    def Pos(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
        if o != 0:
            x = o + self._tab.Pos
            from MyGame.Sample.Vec3 import Vec3
            obj = Vec3()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

    # Monster
    def Mana(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Int16Flags, o + self._tab.Pos)
        return 150

    # Monster
    def Hp(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Int16Flags, o + self._tab.Pos)
        return 100

    # Monster
    def Name(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
        if o != 0:
            return self._tab.String(o + self._tab.Pos)
        return None

    # Monster
    def Names(self, j):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12))
        if o != 0:
            a = self._tab.Vector(o)
            return self._tab.String(a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4))
        return ""

    # Monster
    def NamesLength(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12))
        if o != 0:
            return self._tab.VectorLen(o)
        return 0

    # Monster
    def NamesIsNone(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12))
        return o == 0

    # Monster
    def Inventory(self, j):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16))
        if o != 0:
            a = self._tab.Vector(o)
            return self._tab.Get(flatbuffers.number_types.Uint8Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 1))
        return 0

    # Monster
    def InventoryAsNumpy(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16))
        if o != 0:
            return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Uint8Flags, o)
        return 0

    # Monster
    def InventoryLength(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16))
        if o != 0:
            return self._tab.VectorLen(o)
        return 0

    # Monster
    def InventoryIsNone(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16))
        return o == 0

    # Monster
    def Color(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(18))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Int8Flags, o + self._tab.Pos)
        return 2

    # Monster
    def Weapons(self, j):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(20))
        if o != 0:
            x = self._tab.Vector(o)
            x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4
            x = self._tab.Indirect(x)
            from MyGame.Sample.Weapon import Weapon
            obj = Weapon()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

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

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

    # Monster
    def EquippedType(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(22))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos)
        return 0

    # Monster
    def Equipped(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(24))
        if o != 0:
            from flatbuffers.table import Table
            obj = Table(bytearray(), 0)
            self._tab.Union(obj, o)
            return obj
        return None

    # Monster
    def Path(self, j):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(26))
        if o != 0:
            x = self._tab.Vector(o)
            x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 12
            from MyGame.Sample.Vec3 import Vec3
            obj = Vec3()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

    # Monster
    def PathLength(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(26))
        if o != 0:
            return self._tab.VectorLen(o)
        return 0

    # Monster
    def PathIsNone(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(26))
        return o == 0

def MonsterStart(builder): builder.StartObject(12)
def MonsterAddPos(builder, pos): builder.PrependStructSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(pos), 0)
def MonsterAddMana(builder, mana): builder.PrependInt16Slot(1, mana, 150)
def MonsterAddHp(builder, hp): builder.PrependInt16Slot(2, hp, 100)
def MonsterAddName(builder, name): builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(name), 0)
def MonsterAddNames(builder, names): builder.PrependUOffsetTRelativeSlot(4, flatbuffers.number_types.UOffsetTFlags.py_type(names), 0)
def MonsterStartNamesVector(builder, numElems): return builder.StartVector(4, numElems, 4)
def MonsterAddInventory(builder, inventory): builder.PrependUOffsetTRelativeSlot(6, flatbuffers.number_types.UOffsetTFlags.py_type(inventory), 0)
def MonsterStartInventoryVector(builder, numElems): return builder.StartVector(1, numElems, 1)
def MonsterAddColor(builder, color): builder.PrependInt8Slot(7, color, 2)
def MonsterAddWeapons(builder, weapons): builder.PrependUOffsetTRelativeSlot(8, flatbuffers.number_types.UOffsetTFlags.py_type(weapons), 0)
def MonsterStartWeaponsVector(builder, numElems): return builder.StartVector(4, numElems, 4)
def MonsterAddEquippedType(builder, equippedType): builder.PrependUint8Slot(9, equippedType, 0)
def MonsterAddEquipped(builder, equipped): builder.PrependUOffsetTRelativeSlot(10, flatbuffers.number_types.UOffsetTFlags.py_type(equipped), 0)
def MonsterAddPath(builder, path): builder.PrependUOffsetTRelativeSlot(11, flatbuffers.number_types.UOffsetTFlags.py_type(path), 0)
def MonsterStartPathVector(builder, numElems): return builder.StartVector(12, numElems, 4)
def MonsterEnd(builder): return builder.EndObject()

import MyGame.Sample.Equipment
import MyGame.Sample.Vec3
import MyGame.Sample.Weapon
import weapons.Gun
try:
    from typing import List, Optional, Union
except:
    pass

class MonsterT(object):

    # MonsterT
    def __init__(self):
        self.pos = None  # type: Optional[MyGame.Sample.Vec3.Vec3T]
        self.mana = 150  # type: int
        self.hp = 100  # type: int
        self.name = None  # type: str
        self.names = None  # type: List[str]
        self.inventory = None  # type: List[int]
        self.color = 2  # type: int
        self.weapons = None  # type: List[MyGame.Sample.Weapon.WeaponT]
        self.equippedType = 0  # type: int
        self.equipped = None  # type: Union[None, MyGame.Sample.Weapon.WeaponT, MyGame.Sample.Weapon.WeaponT, weapons.Gun.GunT]
        self.path = None  # type: List[MyGame.Sample.Vec3.Vec3T]

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

    @classmethod
    def InitFromObj(cls, monster):
        x = MonsterT()
        x._UnPack(monster)
        return x

    # MonsterT
    def _UnPack(self, monster):
        if monster is None:
            return
        if monster.Pos() is not None:
            self.pos = MyGame.Sample.Vec3.Vec3T.InitFromObj(monster.Pos())
        self.mana = monster.Mana()
        self.hp = monster.Hp()
        self.name = monster.Name()
        if not monster.NamesIsNone():
            self.names = []
            for i in range(monster.NamesLength()):
                self.names.append(monster.Names(i))
        if not monster.InventoryIsNone():
            if np is None:
                self.inventory = []
                for i in range(monster.InventoryLength()):
                    self.inventory.append(monster.Inventory(i))
            else:
                self.inventory = monster.InventoryAsNumpy()
        self.color = monster.Color()
        if not monster.WeaponsIsNone():
            self.weapons = []
            for i in range(monster.WeaponsLength()):
                if monster.Weapons(i) is None:
                    self.weapons.append(None)
                else:
                    weapon_ = MyGame.Sample.Weapon.WeaponT.InitFromObj(monster.Weapons(i))
                    self.weapons.append(weapon_)
        self.equippedType = monster.EquippedType()
        self.equipped = MyGame.Sample.Equipment.EquipmentCreator(self.equippedType, monster.Equipped())
        if not monster.PathIsNone():
            self.path = []
            for i in range(monster.PathLength()):
                if monster.Path(i) is None:
                    self.path.append(None)
                else:
                    vec3_ = MyGame.Sample.Vec3.Vec3T.InitFromObj(monster.Path(i))
                    self.path.append(vec3_)

    # MonsterT
    def Pack(self, builder):
        if self.name is not None:
            name = builder.CreateString(self.name)
        if self.names is not None:
            nameslist = []
            for i in range(len(self.names)):
                nameslist.append(builder.CreateString(self.names[i]))
            MonsterStartNamesVector(builder, len(self.names))
            for i in reversed(range(len(self.names))):
                builder.PrependUOffsetTRelative(nameslist[i])
            names = builder.EndVector(len(self.names))
        if self.inventory is not None:
            if np is not None and type(self.inventory) is np.ndarray:
                inventory = builder.CreateNumpyVector(self.inventory)
            else:
                MonsterStartInventoryVector(builder, len(self.inventory))
                for i in reversed(range(len(self.inventory))):
                    builder.PrependUint8(self.inventory[i])
                inventory = builder.EndVector(len(self.inventory))
        if self.weapons is not None:
            weaponslist = []
            for i in range(len(self.weapons)):
                weaponslist.append(self.weapons[i].Pack(builder))
            MonsterStartWeaponsVector(builder, len(self.weapons))
            for i in reversed(range(len(self.weapons))):
                builder.PrependUOffsetTRelative(weaponslist[i])
            weapons = builder.EndVector(len(self.weapons))
        if self.equipped is not None:
            equipped = self.equipped.Pack(builder)
        if self.path is not None:
            MonsterStartPathVector(builder, len(self.path))
            for i in reversed(range(len(self.path))):
                self.path[i].Pack(builder)
            path = builder.EndVector(len(self.path))
        MonsterStart(builder)
        if self.pos is not None:
            pos = self.pos.Pack(builder)
            MonsterAddPos(builder, pos)
        MonsterAddMana(builder, self.mana)
        MonsterAddHp(builder, self.hp)
        if self.name is not None:
            MonsterAddName(builder, name)
        if self.names is not None:
            MonsterAddNames(builder, names)
        if self.inventory is not None:
            MonsterAddInventory(builder, inventory)
        MonsterAddColor(builder, self.color)
        if self.weapons is not None:
            MonsterAddWeapons(builder, weapons)
        MonsterAddEquippedType(builder, self.equippedType)
        if self.equipped is not None:
            MonsterAddEquipped(builder, equipped)
        if self.path is not None:
            MonsterAddPath(builder, path)
        monster = MonsterEnd(builder)
        return monster

# automatically generated by the FlatBuffers compiler, do not modify

# namespace: Sample

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

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

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

    @classmethod
    def MonsterBufferHasIdentifier(cls, buf, offset, size_prefixed=False):
        return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x4D\x47\x4D\x45", size_prefixed=size_prefixed)

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

    # Monster
    def Pos(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
        if o != 0:
            x = o + self._tab.Pos
            from MyGame.Sample.Vec3 import Vec3
            obj = Vec3()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

    # Monster
    def Mana(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Int16Flags, o + self._tab.Pos)
        return 150

    # Monster
    def Hp(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Int16Flags, o + self._tab.Pos)
        return 100

    # Monster
    def Name(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
        if o != 0:
            return self._tab.String(o + self._tab.Pos)
        return None

    # Monster
    def Names(self, j):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12))
        if o != 0:
            a = self._tab.Vector(o)
            return self._tab.String(a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4))
        return ""

    # Monster
    def NamesLength(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12))
        if o != 0:
            return self._tab.VectorLen(o)
        return 0

    # Monster
    def NamesIsNone(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12))
        return o == 0

    # Monster
    def Inventory(self, j):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16))
        if o != 0:
            a = self._tab.Vector(o)
            return self._tab.Get(flatbuffers.number_types.Uint8Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 1))
        return 0

    # Monster
    def InventoryAsNumpy(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16))
        if o != 0:
            return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Uint8Flags, o)
        return 0

    # Monster
    def InventoryLength(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16))
        if o != 0:
            return self._tab.VectorLen(o)
        return 0

    # Monster
    def InventoryIsNone(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16))
        return o == 0

    # Monster
    def Color(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(18))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Int8Flags, o + self._tab.Pos)
        return 2

    # Monster
    def Weapons(self, j):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(20))
        if o != 0:
            x = self._tab.Vector(o)
            x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4
            x = self._tab.Indirect(x)
            from MyGame.Sample.Weapon import Weapon
            obj = Weapon()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

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

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

    # Monster
    def EquippedType(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(22))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos)
        return 0

    # Monster
    def Equipped(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(24))
        if o != 0:
            from flatbuffers.table import Table
            obj = Table(bytearray(), 0)
            self._tab.Union(obj, o)
            return obj
        return None

    # Monster
    def Path(self, j):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(26))
        if o != 0:
            x = self._tab.Vector(o)
            x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 12
            from MyGame.Sample.Vec3 import Vec3
            obj = Vec3()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

    # Monster
    def PathLength(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(26))
        if o != 0:
            return self._tab.VectorLen(o)
        return 0

    # Monster
    def PathIsNone(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(26))
        return o == 0

def MonsterStart(builder): builder.StartObject(12)
def MonsterAddPos(builder, pos): builder.PrependStructSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(pos), 0)
def MonsterAddMana(builder, mana): builder.PrependInt16Slot(1, mana, 150)
def MonsterAddHp(builder, hp): builder.PrependInt16Slot(2, hp, 100)
def MonsterAddName(builder, name): builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(name), 0)
def MonsterAddNames(builder, names): builder.PrependUOffsetTRelativeSlot(4, flatbuffers.number_types.UOffsetTFlags.py_type(names), 0)
def MonsterStartNamesVector(builder, numElems): return builder.StartVector(4, numElems, 4)
def MonsterAddInventory(builder, inventory): builder.PrependUOffsetTRelativeSlot(6, flatbuffers.number_types.UOffsetTFlags.py_type(inventory), 0)
def MonsterStartInventoryVector(builder, numElems): return builder.StartVector(1, numElems, 1)
def MonsterAddColor(builder, color): builder.PrependInt8Slot(7, color, 2)
def MonsterAddWeapons(builder, weapons): builder.PrependUOffsetTRelativeSlot(8, flatbuffers.number_types.UOffsetTFlags.py_type(weapons), 0)
def MonsterStartWeaponsVector(builder, numElems): return builder.StartVector(4, numElems, 4)
def MonsterAddEquippedType(builder, equippedType): builder.PrependUint8Slot(9, equippedType, 0)
def MonsterAddEquipped(builder, equipped): builder.PrependUOffsetTRelativeSlot(10, flatbuffers.number_types.UOffsetTFlags.py_type(equipped), 0)
def MonsterAddPath(builder, path): builder.PrependUOffsetTRelativeSlot(11, flatbuffers.number_types.UOffsetTFlags.py_type(path), 0)
def MonsterStartPathVector(builder, numElems): return builder.StartVector(12, numElems, 4)
def MonsterEnd(builder): return builder.EndObject()

import MyGame.Sample.Equipment
import MyGame.Sample.Vec3
import MyGame.Sample.Weapon
import weapons.Gun
try:
    from typing import List, Optional, Union
except:
    pass

class MonsterT(object):

    # MonsterT
    def __init__(self):
        self.pos = None  # type: Optional[MyGame.Sample.Vec3.Vec3T]
        self.mana = 150  # type: int
        self.hp = 100  # type: int
        self.name = None  # type: str
        self.names = None  # type: List[str]
        self.inventory = None  # type: List[int]
        self.color = 2  # type: int
        self.weapons = None  # type: List[MyGame.Sample.Weapon.WeaponT]
        self.equippedType = 0  # type: int
        self.equipped = None  # type: Union[None, MyGame.Sample.Weapon.WeaponT, MyGame.Sample.Weapon.WeaponT, weapons.Gun.GunT]
        self.path = None  # type: List[MyGame.Sample.Vec3.Vec3T]

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

    @classmethod
    def InitFromObj(cls, monster):
        x = MonsterT()
        x._UnPack(monster)
        return x

    # MonsterT
    def _UnPack(self, monster):
        if monster is None:
            return
        if monster.Pos() is not None:
            self.pos = MyGame.Sample.Vec3.Vec3T.InitFromObj(monster.Pos())
        self.mana = monster.Mana()
        self.hp = monster.Hp()
        self.name = monster.Name()
        if not monster.NamesIsNone():
            self.names = []
            for i in range(monster.NamesLength()):
                self.names.append(monster.Names(i))
        if not monster.InventoryIsNone():
            if np is None:
                self.inventory = []
                for i in range(monster.InventoryLength()):
                    self.inventory.append(monster.Inventory(i))
            else:
                self.inventory = monster.InventoryAsNumpy()
        self.color = monster.Color()
        if not monster.WeaponsIsNone():
            self.weapons = []
            for i in range(monster.WeaponsLength()):
                if monster.Weapons(i) is None:
                    self.weapons.append(None)
                else:
                    weapon_ = MyGame.Sample.Weapon.WeaponT.InitFromObj(monster.Weapons(i))
                    self.weapons.append(weapon_)
        self.equippedType = monster.EquippedType()
        self.equipped = MyGame.Sample.Equipment.EquipmentCreator(self.equippedType, monster.Equipped())
        if not monster.PathIsNone():
            self.path = []
            for i in range(monster.PathLength()):
                if monster.Path(i) is None:
                    self.path.append(None)
                else:
                    vec3_ = MyGame.Sample.Vec3.Vec3T.InitFromObj(monster.Path(i))
                    self.path.append(vec3_)

    # MonsterT
    def Pack(self, builder):
        if self.name is not None:
            name = builder.CreateString(self.name)
        if self.names is not None:
            nameslist = []
            for i in range(len(self.names)):
                nameslist.append(builder.CreateString(self.names[i]))
            MonsterStartNamesVector(builder, len(self.names))
            for i in reversed(range(len(self.names))):
                builder.PrependUOffsetTRelative(nameslist[i])
            names = builder.EndVector(len(self.names))
        if self.inventory is not None:
            if np is not None and type(self.inventory) is np.ndarray:
                inventory = builder.CreateNumpyVector(self.inventory)
            else:
                MonsterStartInventoryVector(builder, len(self.inventory))
                for i in reversed(range(len(self.inventory))):
                    builder.PrependUint8(self.inventory[i])
                inventory = builder.EndVector(len(self.inventory))
        if self.weapons is not None:
            weaponslist = []
            for i in range(len(self.weapons)):
                weaponslist.append(self.weapons[i].Pack(builder))
            MonsterStartWeaponsVector(builder, len(self.weapons))
            for i in reversed(range(len(self.weapons))):
                builder.PrependUOffsetTRelative(weaponslist[i])
            weapons = builder.EndVector(len(self.weapons))
        if self.equipped is not None:
            equipped = self.equipped.Pack(builder)
        if self.path is not None:
            MonsterStartPathVector(builder, len(self.path))
            for i in reversed(range(len(self.path))):
                self.path[i].Pack(builder)
            path = builder.EndVector(len(self.path))
        MonsterStart(builder)
        if self.pos is not None:
            pos = self.pos.Pack(builder)
            MonsterAddPos(builder, pos)
        MonsterAddMana(builder, self.mana)
        MonsterAddHp(builder, self.hp)
        if self.name is not None:
            MonsterAddName(builder, name)
        if self.names is not None:
            MonsterAddNames(builder, names)
        if self.inventory is not None:
            MonsterAddInventory(builder, inventory)
        MonsterAddColor(builder, self.color)
        if self.weapons is not None:
            MonsterAddWeapons(builder, weapons)
        MonsterAddEquippedType(builder, self.equippedType)
        if self.equipped is not None:
            MonsterAddEquipped(builder, equipped)
        if self.path is not None:
            MonsterAddPath(builder, path)
        monster = MonsterEnd(builder)
        return monster
# automatically generated by the FlatBuffers compiler, do not modify # namespace: Sample # Monster # Monster # Monster # Monster # Monster # Monster # Monster # Monster # Monster # Monster # Monster # Monster # Monster # Monster # Monster # Monster # Monster # Monster # Monster # Monster # Monster # MonsterT # type: Optional[MyGame.Sample.Vec3.Vec3T] # type: int # type: int # type: str # type: List[str] # type: List[int] # type: int # type: List[MyGame.Sample.Weapon.WeaponT] # type: int # type: Union[None, MyGame.Sample.Weapon.WeaponT, MyGame.Sample.Weapon.WeaponT, weapons.Gun.GunT] # type: List[MyGame.Sample.Vec3.Vec3T] # MonsterT # MonsterT