# automatically generated by the FlatBuffers compiler, do not modify

# namespace: AOC

import flatbuffers

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

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

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

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

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

    # Player
    def State(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Int8Flags, o + self._tab.Pos)
        return 0

    # Player
    def Food(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Float32Flags, o + self._tab.Pos)
        return 0.0

    # Player
    def Wood(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 0.0

    # Player
    def Stone(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 0.0

    # Player
    def Gold(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 0.0

    # Player
    def Headroom(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 0.0

    # Player
    def Population(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(20))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Float32Flags, o + self._tab.Pos)
        return 0.0

    # Player
    def PopulationCap(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(22))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Float32Flags, o + self._tab.Pos)
        return 0.0

    # Player
    def CumulativeHousedTime(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(24))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Float32Flags, o + self._tab.Pos)
        return 0.0

    # Player
    def CumulativePopCappedTime(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(26))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Float32Flags, o + self._tab.Pos)
        return 0.0

    # Player
    def CivilianPopulation(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(28))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Float32Flags, o + self._tab.Pos)
        return 0.0

    # Player
    def MilitaryPopulation(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(30))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Float32Flags, o + self._tab.Pos)
        return 0.0

    # Player
    def PercentMapExplored(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(32))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Float32Flags, o + self._tab.Pos)
        return 0.0

    # Player
    def VictoryPointsAndAttributes(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(34))
        if o != 0:
            x = o + self._tab.Pos
            from .VictoryPointsAndAttributes import VictoryPointsAndAttributes
            obj = VictoryPointsAndAttributes()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

    # Player
    def Techs(self, j):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(36))
        if o != 0:
            x = self._tab.Vector(o)
            x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 12
            from .Tech import Tech
            obj = Tech()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

    # Player
    def TechsLength(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(36))
        if o != 0:
            return self._tab.VectorLen(o)
        return 0

def PlayerStart(builder): builder.StartObject(17)
def PlayerAddId(builder, id): builder.PrependUint8Slot(0, id, 0)
def PlayerAddName(builder, name): builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(name), 0)
def PlayerAddState(builder, state): builder.PrependInt8Slot(2, state, 0)
def PlayerAddFood(builder, food): builder.PrependFloat32Slot(3, food, 0.0)
def PlayerAddWood(builder, wood): builder.PrependFloat32Slot(4, wood, 0.0)
def PlayerAddStone(builder, stone): builder.PrependFloat32Slot(5, stone, 0.0)
def PlayerAddGold(builder, gold): builder.PrependFloat32Slot(6, gold, 0.0)
def PlayerAddHeadroom(builder, headroom): builder.PrependFloat32Slot(7, headroom, 0.0)
def PlayerAddPopulation(builder, population): builder.PrependFloat32Slot(8, population, 0.0)
def PlayerAddPopulationCap(builder, populationCap): builder.PrependFloat32Slot(9, populationCap, 0.0)
def PlayerAddCumulativeHousedTime(builder, cumulativeHousedTime): builder.PrependFloat32Slot(10, cumulativeHousedTime, 0.0)
def PlayerAddCumulativePopCappedTime(builder, cumulativePopCappedTime): builder.PrependFloat32Slot(11, cumulativePopCappedTime, 0.0)
def PlayerAddCivilianPopulation(builder, civilianPopulation): builder.PrependFloat32Slot(12, civilianPopulation, 0.0)
def PlayerAddMilitaryPopulation(builder, militaryPopulation): builder.PrependFloat32Slot(13, militaryPopulation, 0.0)
def PlayerAddPercentMapExplored(builder, percentMapExplored): builder.PrependFloat32Slot(14, percentMapExplored, 0.0)
def PlayerAddVictoryPointsAndAttributes(builder, victoryPointsAndAttributes): builder.PrependStructSlot(15, flatbuffers.number_types.UOffsetTFlags.py_type(victoryPointsAndAttributes), 0)
def PlayerAddTechs(builder, techs): builder.PrependUOffsetTRelativeSlot(16, flatbuffers.number_types.UOffsetTFlags.py_type(techs), 0)
def PlayerStartTechsVector(builder, numElems): return builder.StartVector(12, numElems, 4)
def PlayerEnd(builder): return builder.EndObject()
