-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathschema.sql
393 lines (329 loc) · 9.53 KB
/
schema.sql
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
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
CREATE TABLE Hero
(
id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
login VARCHAR(32) NOT NULL,
password VARCHAR(64) NOT NULL,
email VARCHAR(64) NOT NULL,
experience INT(12) NOT NULL,
money FLOAT(10, 2) NOT NULL,
money_art FLOAT(10, 2) NOT NULL,
location VARCHAR(1024) NOT NULL,
level INT(3) NOT NULL,
image_id INT NOT NULL,
number_of_wins INT(6) NOT NULL,
number_of_losses INT(6) NOT NULL,
number_of_draws INT(6) NOT NULL,
hp INT(6) NOT NULL,
capacity INT(6) NOT NULL,
strength INT(6) NOT NULL,
dexterity INT(6) NOT NULL,
intuition INT(6) NOT NULL,
health INT(6) NOT NULL,
swords INT(6) NOT NULL,
axes INT(6) NOT NULL,
knives INT(6) NOT NULL,
clubs INT(6) NOT NULL,
shields INT(6) NOT NULL,
date_of_birthday DATE NOT NULL,
sex INT(1) NOT NULL,
country VARCHAR(32),
city VARCHAR(32),
name VARCHAR(64),
about TEXT,
feature_id INT NOT NULL,
CONSTRAINT FK_hero_heroimage FOREIGN KEY (image_id)
REFERENCES HeroImage (id) ON DELETE CASCADE ON UPDATE RESTRICT,
CONSTRAINT FK_hero_herofeauture FOREIGN KEY (heature_id)
REFERENCES HearoFeature (id) ON DELETE CASCADE ON UPDATE RESTRICT
);
CREATE TABLE HeroFeature
(
id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
strength VARCHAR(32),
dexterity VARCHAR(32),
intuition VARCHAR(32),
health VARCHAR(32),
swords VARCHAR(32),
axes VARCHAR(32),
knives VARCHAR(32),
clubs VARCHAR(32),
shields VARCHAR(32),
protection_head VARCHAR(32),
protection_breast VARCHAR(32),
protection_zone VARCHAR(32),
protection_legs VARCHAR(32),
damage_min VARCHAR(32),
damage_max VARCHAR(32),
accuracy VARCHAR(32),
dodge VARCHAR(32),
devastate VARCHAR(32),
durability VARCHAR(32),
block_break VARCHAR(32),
armor_break VARCHAR(32),
hp VARCHAR(32),
strike_count VARCHAR(32),
block_count VARCHAR(32),
capacity VARCHAR(32),
CONSTRAINT FK_herofeature_hero FOREIGN KEY (hero_id)
REFERENCES Hero (id) ON DELETE CASCADE ON UPDATE RESTRICT
);
CREATE TABLE HeroImage
(
id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
image VARCHAR(32) NOT NULL,
is_art BOOL NOT NULL,
sex INT(1) NOT NULL,
);
CREATE TABLE HeroSkill
(
id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
name VARCHAR(32) NOT NULL
);
CREATE TABLE SkillFeature
(
id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
heroskill_id INT NOT NULL,
feature INT(3) NOT NULL,
plus INT(3) NOT NULL
);
CREATE TABLE HeroHeroSkill
(
id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
hero_id INT NOT NULL,
skill_id INT NOT NULL,
level INT(3) NOT NULL,
CONSTRAINT FK_hero FOREIGN KEY (hero_id)
REFERENCES Hero (id) ON DELETE CASCADE ON UPDATE RESTRICT,
CONSTRAINT FK_heroskill FOREIGN KEY (skill_id)
REFERENCES HeroSkill (id) ON DELETE CASCADE ON UPDATE RESTRICT
);
CREATE TABLE TableExperience
(
id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
level INT(3) NOT NULL,
experience INT(12) NOT NULL,
number_of_abilities INT(3) NOT NULL,
number_of_skills INT(3) NOT NULL,
number_of_parameters INT(3) NOT NULL,
money INT(6) NOT NULL
);
CREATE TABLE Thing
(
id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
name VARCHAR(32) NOT NULL,
money FLOAT(10, 2) NOT NULL,
type INT(3) NOT NULL,
is_art INT(1) NOT NULL,
is_bot INT(1) NOT NULL,
stability INT(6) NOT NULL,
weight INT(6) NOT NULL,
image VARCHAR(32) NOT NULL,
level_need INT(3) NOT NULL,
strength_need INT(6) DEFAULT 0,
dexterity_need INT(6) DEFAULT 0,
intuition_need INT(6) DEFAULT 0,
health_need INT(6) DEFAULT 0,
swords_need INT(6) DEFAULT 0,
axes_need INT(6) DEFAULT 0,
knives_need INT(6) DEFAULT 0,
clubs_need INT(6) DEFAULT 0,
shields_need INT(6) DEFAULT 0,
strength_give INT(6) DEFAULT 0,
dexterity_give INT(6) DEFAULT 0,
intuition_give INT(6) DEFAULT 0,
health_give INT(6) DEFAULT 0,
swords_give INT(6) DEFAULT 0,
axes_give INT(6) DEFAULT 0,
knives_give INT(6) DEFAULT 0,
clubs_give INT(6) DEFAULT 0,
shields_give INT(6) DEFAULT 0,
damage_min INT(6) DEFAULT 0,
damage_max INT(6) DEFAULT 0,
protection_head INT(6) DEFAULT 0,
protection_breast INT(6) DEFAULT 0,
protection_zone INT(6) DEFAULT 0,
protection_legs INT(6) DEFAULT 0,
accuracy INT(6) DEFAULT 0,
dodge INT(6) DEFAULT 0,
devastate INT(6) DEFAULT 0,
durability INT(6) DEFAULT 0,
block_break INT(6) DEFAULT 0,
armor_break INT(6) DEFAULT 0,
hp INT(6) DEFAULT 0,
time_duration INT(6) DEFAULT 0,
strike_count INT(3) DEFAULT 0,
block_count INT(3) DEFAULT 0,
capacity INT(3) DEFAULT 0,
take_two_hands INT(1) NOT NULL
);
CREATE TABLE HeroThing
(
id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
hero_id INT NOT NULL,
thing_id INT NOT NULL,
stability_all INT(6) NOT NULL,
stability_left INT(6) NOT NULL,
dressed INT(1) NOT NULL,
CONSTRAINT FK_hero FOREIGN KEY (hero_id)
REFERENCES Hero (id) ON DELETE CASCADE ON UPDATE RESTRICT,
CONSTRAINT FK_thing FOREIGN KEY (thing_id)
REFERENCES Thing (id) ON DELETE CASCADE ON UPDATE RESTRICT
);
CREATE TABLE HeroThingFeature
(
id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
herothing_id INT NOT NULL,
feature INT(3) NOT NULL,
plus INT(3) NOT NULL
);
CREATE TABLE Combat
(
id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
type INT(3) NOT NULL,
is_active INT(1) NOT NULL,
time_out INT(3) NOT NULL,
injury INT(1) NOT NULL,
with_things INT(1) NOT NULL,
time_wait INT(3) NOT NULL,
one_team_count INT(3),
two_team_count INT(3),
one_team_lvl_min INT(3),
one_team_lvl_max INT(3),
two_team_lvl_min INT(3),
two_team_lvl_max INT(3),
location VARCHAR(32) NOT NULL,
start_date_time DATETIME NOT NULL,
end_date_time DATETIME NOT NULL,
win_team INT(1) NOT NULL
);
CREATE TABLE CombatWarrior
(
id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
combat_id INT NOT NULL,
hero_id INT,
bot_id INT,
team INT(1) NOT NULL,
is_dead INT(1) DEFAULT 0,
is_join INT(1) DEFAULT 0,
is_out INT(1) DEFAULT 0,
CONSTRAINT FK_combatwarrior_combat FOREIGN KEY (combat_id)
REFERENCES Combat (id) ON DELETE CASCADE ON UPDATE RESTRICT
);
CREATE TABLE CombatLog
(
id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
combat_id INT NOT NULL,
is_bot_one INT(1) NOT NULL,
is_bot_two INT(1) NOT NULL,
hero_one_id INT,
hero_two_id INT,
bot_one_id INT,
bot_two_id INT,
hero_one_wstrike VARCHAR(16),
hero_two_wstrike VARCHAR(16),
hero_one_wblock VARCHAR(16),
hero_two_wblock VARCHAR(16),
hero_join INT(1) DEFAULT 0,
hero_out INT(1) DEFAULT 0,
hp_plus INT(6) DEFAULT 0,
text TEXT NOT NULL,
time TIME NOT NULL,
CONSTRAINT FK_combatlog_combat FOREIGN KEY (combat_id)
REFERENCES Combat (id) ON DELETE CASCADE ON UPDATE RESTRICT
);
CREATE TABLE Bot
(
id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
name VARCHAR(32) NOT NULL,
level INT(3) NOT NULL,
image_id INT NOT NULL,
hp INT(6) NOT NULL,
strenth INT(6) NOT NULL,
dexterity INT(6) NOT NULL,
intuition INT(6) NOT NULL,
health INT(6) NOT NULL,
swords INT(6) NOT NULL,
axes INT(6) NOT NULL,
knives INT(6) NOT NULL,
clubs INT(6) NOT NULL,
shields INT(6) NOT NULL,
coordinate_x1 INT(6) NOT NULL,
coordinate_y1 INT(6) NOT NULL,
coordinate_x2 INT(6) NOT NULL,
coordinate_y2 INT(6) NOT NULL
);
CREATE TABLE BotFeature
(
id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
bot_id INT NOT NULL,
strenth VARCHAR(32),
dexterity VARCHAR(32),
intuition VARCHAR(32),
health VARCHAR(32),
swords VARCHAR(32),
axes VARCHAR(32),
knives VARCHAR(32),
clubs VARCHAR(32),
shields VARCHAR(32),
protection_head VARCHAR(32),
protection_breast VARCHAR(32),
protection_zone VARCHAR(32),
protection_legs VARCHAR(32),
damage_min VARCHAR(32),
damage_max VARCHAR(32),
accuracy VARCHAR(32),
dodge VARCHAR(32),
devastate VARCHAR(32),
durability VARCHAR(32),
block_break VARCHAR(32),
armor_break VARCHAR(32),
hp VARCHAR(32),
strike_count VARCHAR(32),
block_count VARCHAR(32),
CONSTRAINT FK_botfeature_bot FOREIGN KEY (bot_id)
REFERENCES Bot (id) ON DELETE CASCADE ON UPDATE RESTRICT
);
CREATE TABLE BotThing
(
bot_id INT NOT NULL,
thing_id INT NOT NULL,
PRIMARY KEY (bot_id, thing_id),
CONSTRAINT FK_bot FOREIGN KEY (bot_id)
REFERENCES Bot (id) ON DELETE CASCADE ON UPDATE RESTRICT,
CONSTRAINT FK_thing FOREIGN KEY (thing_id)
REFERENCES Thing (id) ON DELETE CASCADE ON UPDATE RESTRICT
);
CREATE TABLE BotImage
(
id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
image VARCHAR(32) NOT NULL
);
CREATE TABLE Island
(
id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
name VARCHAR(32) NOT NULL,
image VARCHAR(32) NOT NULL
);
CREATE TABLE IslandPart
(
id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
island_id INT NOT NULL,
is_move INT(1) NOT NULL,
coordinate_x INT(6) NOT NULL,
coordinate_y INT(6) NOT NULL,
CONSTRAINT FK_islandpart_island FOREIGN KEY (island_id)
REFERENCES Island (id) ON DELETE CASCADE ON UPDATE RESTRICT
);
CREATE TABLE Building
(
id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
parent_id INT,
name VARCHAR(32) NOT NULL,
slug VARCHAR(32) NOT NULL,
plugin VARCHAR(32),
image VARCHAR(32) NOT NULL,
coordinate_x1 INT(6),
coordinate_y1 INT(6),
coordinate_x2 INT(6),
coordinate_y2 INT(6)
);