summaryrefslogtreecommitdiff
path: root/src/map/magic-interpreter.py
blob: 8170f27bf8aef7f3e7e574e47f8f24d3f83a2d74 (plain) (blame)
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
class area_t(object):
    ''' print an area_t
    '''
    __slots__ = ('_value')
    name = 'area_t'
    enabled = True

    def __init__(self, value):
        self._value = value

    def to_string(self):
        return None

    def children(self):
        v = self._value
        yield 'size', v['size']
        ty = v['ty']
        yield 'ty', ty
        a = v['a']
        if ty == 0:
            yield 'a.a_loc', a['a_loc']
        elif ty == 1:
            yield 'a.a_union', a['a_union']
        elif ty == 2:
            yield 'a.a_rect', a['a_rect']
        elif ty == 3:
            yield 'a.a_bar', a['a_bar']


class val_t(object):
    ''' print a val_t
    '''
    __slots__ = ('_value')
    name = 'val_t'
    enabled = True

    def __init__(self, value):
        self._value = value

    def to_string(self):
        return None

    def children(self):
        v = self._value
        ty = v['ty']
        yield 'ty', ty
        u = v['v']
        if ty == 1:
            yield 'v.v_int', u['v_int']
        elif ty == 2:
            yield 'v.v_dir', u['v_dir']
        elif ty == 3:
            yield 'v.v_string', u['v_string']
        elif ty == 4:
            yield 'v.v_int', u['v_int']
            yield 'v.v_entity', u['v_entity']
        elif ty == 5:
            yield 'v.v_location', u['v_location']
        elif ty == 6:
            yield 'v.v_area', u['v_area']
        elif ty == 7:
            yield 'v.v_spell', u['v_spell']
        elif ty == 8:
            yield 'v.v_int', u['v_int']
            yield 'v.v_invocation', u['v_invocation']


class e_area_t(object):
    ''' print an e_area_t
    '''
    __slots__ = ('_value')
    name = 'e_area_t'
    enabled = True

    def __init__(self, value):
        self._value = value

    def to_string(self):
        return None

    def children(self):
        v = self._value
        ty = v['ty']
        yield 'ty', ty
        a = v['a']
        if ty == 0:
            yield 'a.a_loc', a['a_loc']
        elif ty == 1:
            yield 'a.a_union', a['a_union']
        elif ty == 2:
            yield 'a.a_rect', a['a_rect']
        elif ty == 3:
            yield 'a.a_bar', a['a_bar']


class expr_t(object):
    ''' print an expr_t
    '''
    __slots__ = ('_value')
    name = 'expr_t'
    enabled = True

    def __init__(self, value):
        self._value = value

    def to_string(self):
        return None

    def children(self):
        v = self._value
        ty = v['ty']
        yield 'ty', ty
        u = v['e']
        if ty == 0:
            yield 'e.e_val', u['e_val']
        elif ty == 1:
            yield 'e.e_location', u['e_location']
        elif ty == 2:
            yield 'e.e_area', u['e_area']
        elif ty == 3:
            yield 'e.e_funapp', u['e_funapp']
        elif ty == 4:
            yield 'e.e_id', u['e_id']
        elif ty == 5:
            yield 'e.e_field', u['e_field']


class effect_t(object):
    ''' print an effect_t
    '''
    __slots__ = ('_value')
    name = 'effect_t'
    enabled = True

    def __init__(self, value):
        self._value = value

    def to_string(self):
        return None

    def children(self):
        v = self._value
        yield 'next', v['next']
        ty = v['ty']
        yield 'ty', ty
        u = v['e']
        if ty == 2:
            yield 'e.e_assign', u['e_assign']
        elif ty == 3:
            yield 'e.e_foreach', u['e_foreach']
        elif ty == 4:
            yield 'e.e_for', u['e_for']
        elif ty == 5:
            yield 'e.e_if', u['e_if']
        elif ty == 6:
            yield 'e.e_sleep', u['e_sleep']
        elif ty == 7:
            yield 'e.e_script', u['e_script']
        elif ty == 9:
            yield 'e.e_op', u['e_op']
        elif ty == 11:
            yield 'e.e_call', u['e_call']


class spellguard_t(object):
    ''' print a spellguard_t
    '''
    __slots__ = ('_value')
    name = 'spellguard_t'
    enabled = True

    def __init__(self, value):
        self._value = value

    def to_string(self):
        return None

    def children(self):
        v = self._value
        yield 'next', v['next']
        ty = v['ty']
        yield 'ty', ty
        u = v['s']
        if ty == 0:
            yield 's.s_condition', u['s_condition']
        elif ty == 1:
            yield 's.s_components', u['s_components']
        elif ty == 2:
            yield 's.s_catalysts', u['s_catalysts']
        elif ty == 3:
            yield 's.s_alt', u['s_alt']
        elif ty == 4:
            yield 's.s_mana', u['s_mana']
        elif ty == 5:
            yield 's.s_casttime', u['s_casttime']
        elif ty == 6:
            yield 's.s_effect', u['s_effect']


class cont_activation_record_t(object):
    ''' print a cont_activation_record_t
    '''
    __slots__ = ('_value')
    name = 'cont_activation_record_t'
    enabled = True

    def __init__(self, value):
        self._value = value

    def to_string(self):
        return None

    def children(self):
        v = self._value
        yield 'return_location', v['return_location']
        ty = v['ty']
        yield 'ty', ty
        u = v['c']
        if ty == 0:
            yield 'c.c_foreach', u['c_foreach']
        elif ty == 1:
            yield 'c.c_for', u['c_for']
        elif ty == 2:
            yield 'c.c_proc', u['c_proc']