summaryrefslogtreecommitdiff
path: root/tests/MyGame/MonsterExtra.py
blob: d9e183617c382c3f319424d2e079d5443b981bdb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
# automatically generated by the FlatBuffers compiler, do not modify

# namespace: MyGame

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

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

    @classmethod
    def GetRootAs(cls, buf, offset: int = 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: bytes, pos: int):
        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: int):
        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) -> int:
        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) -> bool:
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(20))
        return o == 0

    # MonsterExtra
    def Fvec(self, j: int):
        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) -> int:
        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) -> bool:
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(22))
        return o == 0

def MonsterExtraStart(builder: flatbuffers.Builder):
    builder.StartObject(11)

def Start(builder: flatbuffers.Builder):
    MonsterExtraStart(builder)

def MonsterExtraAddD0(builder: flatbuffers.Builder, d0: float):
    builder.PrependFloat64Slot(0, d0, float('nan'))

def AddD0(builder: flatbuffers.Builder, d0: float):
    MonsterExtraAddD0(builder, d0)

def MonsterExtraAddD1(builder: flatbuffers.Builder, d1: float):
    builder.PrependFloat64Slot(1, d1, float('nan'))

def AddD1(builder: flatbuffers.Builder, d1: float):
    MonsterExtraAddD1(builder, d1)

def MonsterExtraAddD2(builder: flatbuffers.Builder, d2: float):
    builder.PrependFloat64Slot(2, d2, float('inf'))

def AddD2(builder: flatbuffers.Builder, d2: float):
    MonsterExtraAddD2(builder, d2)

def MonsterExtraAddD3(builder: flatbuffers.Builder, d3: float):
    builder.PrependFloat64Slot(3, d3, float('-inf'))

def AddD3(builder: flatbuffers.Builder, d3: float):
    MonsterExtraAddD3(builder, d3)

def MonsterExtraAddF0(builder: flatbuffers.Builder, f0: float):
    builder.PrependFloat32Slot(4, f0, float('nan'))

def AddF0(builder: flatbuffers.Builder, f0: float):
    MonsterExtraAddF0(builder, f0)

def MonsterExtraAddF1(builder: flatbuffers.Builder, f1: float):
    builder.PrependFloat32Slot(5, f1, float('nan'))

def AddF1(builder: flatbuffers.Builder, f1: float):
    MonsterExtraAddF1(builder, f1)

def MonsterExtraAddF2(builder: flatbuffers.Builder, f2: float):
    builder.PrependFloat32Slot(6, f2, float('inf'))

def AddF2(builder: flatbuffers.Builder, f2: float):
    MonsterExtraAddF2(builder, f2)

def MonsterExtraAddF3(builder: flatbuffers.Builder, f3: float):
    builder.PrependFloat32Slot(7, f3, float('-inf'))

def AddF3(builder: flatbuffers.Builder, f3: float):
    MonsterExtraAddF3(builder, f3)

def MonsterExtraAddDvec(builder: flatbuffers.Builder, dvec: int):
    builder.PrependUOffsetTRelativeSlot(8, flatbuffers.number_types.UOffsetTFlags.py_type(dvec), 0)

def AddDvec(builder: flatbuffers.Builder, dvec: int):
    MonsterExtraAddDvec(builder, dvec)

def MonsterExtraStartDvecVector(builder, numElems: int) -> int:
    return builder.StartVector(8, numElems, 8)

def StartDvecVector(builder, numElems: int) -> int:
    return MonsterExtraStartDvecVector(builder, numElems)

def MonsterExtraAddFvec(builder: flatbuffers.Builder, fvec: int):
    builder.PrependUOffsetTRelativeSlot(9, flatbuffers.number_types.UOffsetTFlags.py_type(fvec), 0)

def AddFvec(builder: flatbuffers.Builder, fvec: int):
    MonsterExtraAddFvec(builder, fvec)

def MonsterExtraStartFvecVector(builder, numElems: int) -> int:
    return builder.StartVector(4, numElems, 4)

def StartFvecVector(builder, numElems: int) -> int:
    return MonsterExtraStartFvecVector(builder, numElems)

def MonsterExtraEnd(builder: flatbuffers.Builder) -> int:
    return builder.EndObject()

def End(builder: flatbuffers.Builder) -> int:
    return MonsterExtraEnd(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 InitFromPackedBuf(cls, buf, pos=0):
        n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, pos)
        return cls.InitFromBuf(buf, pos+n)

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

    def __eq__(self, other):
        return type(self) == type(other) and \
            self.d0 == other.d0 and \
            self.d1 == other.d1 and \
            self.d2 == other.d2 and \
            self.d3 == other.d3 and \
            self.f0 == other.f0 and \
            self.f1 == other.f1 and \
            self.f2 == other.f2 and \
            self.f3 == other.f3 and \
            self.dvec == other.dvec and \
            self.fvec == other.fvec

    # 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:
                MonsterExtraStartDvecVector(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:
                MonsterExtraStartFvecVector(builder, len(self.fvec))
                for i in reversed(range(len(self.fvec))):
                    builder.PrependFloat32(self.fvec[i])
                fvec = builder.EndVector()
        MonsterExtraStart(builder)
        MonsterExtraAddD0(builder, self.d0)
        MonsterExtraAddD1(builder, self.d1)
        MonsterExtraAddD2(builder, self.d2)
        MonsterExtraAddD3(builder, self.d3)
        MonsterExtraAddF0(builder, self.f0)
        MonsterExtraAddF1(builder, self.f1)
        MonsterExtraAddF2(builder, self.f2)
        MonsterExtraAddF3(builder, self.f3)
        if self.dvec is not None:
            MonsterExtraAddDvec(builder, dvec)
        if self.fvec is not None:
            MonsterExtraAddFvec(builder, fvec)
        monsterExtra = MonsterExtraEnd(builder)
        return monsterExtra