# automatically generated by the FlatBuffers compiler, do not modify

# namespace: AOC

import flatbuffers

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

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

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

    # GameMessage
    def StateReaderVersion(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
        if o != 0:
            return self._tab.String(o + self._tab.Pos)
        return None

    # GameMessage
    def GameIndex(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos)
        return 0

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

    # GameMessage
    def GameFinished(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
        if o != 0:
            return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos))
        return False

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

    # GameMessage
    def Players(self, j):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14))
        if o != 0:
            x = self._tab.Vector(o)
            x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4
            x = self._tab.Indirect(x)
            from .Player import Player
            obj = Player()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

    # GameMessage
    def PlayersLength(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14))
        if o != 0:
            return self._tab.VectorLen(o)
        return 0

    # GameMessage
    def Objects(self, j):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16))
        if o != 0:
            x = self._tab.Vector(o)
            x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 68
            from .Object import Object
            obj = Object()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

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

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

    # GameMessage
    def StateChangesLength(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(18))
        if o != 0:
            return self._tab.VectorLen(o)
        return 0

def GameMessageStart(builder): builder.StartObject(8)
def GameMessageAddStateReaderVersion(builder, stateReaderVersion): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(stateReaderVersion), 0)
def GameMessageAddGameIndex(builder, gameIndex): builder.PrependInt32Slot(1, gameIndex, 0)
def GameMessageAddWorldTime(builder, worldTime): builder.PrependUint32Slot(2, worldTime, 0)
def GameMessageAddGameFinished(builder, gameFinished): builder.PrependBoolSlot(3, gameFinished, 0)
def GameMessageAddMarketCoefficients(builder, marketCoefficients): builder.PrependStructSlot(4, flatbuffers.number_types.UOffsetTFlags.py_type(marketCoefficients), 0)
def GameMessageAddPlayers(builder, players): builder.PrependUOffsetTRelativeSlot(5, flatbuffers.number_types.UOffsetTFlags.py_type(players), 0)
def GameMessageStartPlayersVector(builder, numElems): return builder.StartVector(4, numElems, 4)
def GameMessageAddObjects(builder, objects): builder.PrependUOffsetTRelativeSlot(6, flatbuffers.number_types.UOffsetTFlags.py_type(objects), 0)
def GameMessageStartObjectsVector(builder, numElems): return builder.StartVector(68, numElems, 4)
def GameMessageAddStateChanges(builder, stateChanges): builder.PrependUOffsetTRelativeSlot(7, flatbuffers.number_types.UOffsetTFlags.py_type(stateChanges), 0)
def GameMessageStartStateChangesVector(builder, numElems): return builder.StartVector(12, numElems, 4)
def GameMessageEnd(builder): return builder.EndObject()
