· 4 years ago · Jan 18, 2021, 07:30 PM
1DROP PROCEDURE IF EXISTS createUserInfo;
2DELIMITER $$
3CREATE PROCEDURE createUserInfo(in stid text, in stname text charset utf8mb4, in ipaddr text, in ostime bigint)
4BEGIN
5 set @Count = (SELECT COUNT(*) AS Cnt FROM player WHERE `SteamID`=stid);
6 if (@Count = 0) then
7 insert into player (`SteamID`, `SteamName`, `FirstJoined`, `Vars`) VALUES (stid, stname, ostime, null);
8 insert into player_iplog (`SteamID`, `Address`, `LastSeen`) VALUES(stid, ipaddr, -1);
9 select 1 as Created;
10 else
11 select 0 as Created;
12 end if;
13END; $$
14DELIMITER ;
15
16DROP PROCEDURE IF EXISTS selectUserInfo;
17DELIMITER $$
18CREATE PROCEDURE selectUserInfo(in stid text)
19BEGIN
20 SELECT player.SteamName, player.Rank, player.TimePlayed, player.FirstJoined, player.Vars, player_iplog.Address, player_iplog.LastSeen FROM player, player_iplog WHERE player.SteamID=stid AND player_iplog.SteamID=stid ORDER BY LastSeen DESC LIMIT 1;
21END; $$
22DELIMITER ;
23
24DROP PROCEDURE IF EXISTS updateUserInfo;
25DELIMITER $$
26CREATE PROCEDURE updateUserInfo(in stid text, in steamname text, in ipaddr text, in ostime bigint)
27BEGIN
28 update player set `SteamName` = steamname where `SteamID` = stid;
29 delete from player_iplog where `SteamID` = stid and `Address` = ipaddr;
30 INSERT INTO player_iplog (`SteamID`, `Address`, `LastSeen`) VALUES (stid, ipaddr, ostime);
31END; $$
32DELIMITER ;
33
34DROP PROCEDURE IF EXISTS removeItem;
35DELIMITER $$
36CREATE PROCEDURE removeItem(in cid int)
37BEGIN
38 update mg_items set ownerid = 0 where id = cid;
39END; $$
40DELIMITER ;
41
42DROP PROCEDURE IF EXISTS transferItem;
43DELIMITER $$
44CREATE PROCEDURE transferItem(in cid int, in owner bigint)
45BEGIN
46 update mg_items set ownerid = owner where id = cid;
47END; $$
48DELIMITER ;
49
50DROP PROCEDURE IF EXISTS updateItemStat;
51DELIMITER $$
52CREATE PROCEDURE updateItemStat(in cid int, in stat char(1), in newval float)
53BEGIN
54 update mg_itemstats set statid = newval where weaponid = cid;
55END; $$
56DELIMITER ;
57
58DROP PROCEDURE IF EXISTS insertItemName;
59DELIMITER $$
60CREATE PROCEDURE insertItemName(in uid int unsigned, in nstr varchar(32))
61BEGIN
62 insert into moat_inv_items_names (weaponid, nickname) values (uid, nstr);
63 select uid as cid;
64END; $$
65DELIMITER ;
66
67DROP PROCEDURE IF EXISTS selectStats;
68DELIMITER $$
69CREATE PROCEDURE selectStats(in steamid bigint)
70BEGIN
71 select var, val from mg_players where id = steamid;
72END; $$
73DELIMITER ;
74
75DROP PROCEDURE IF EXISTS selectStat;
76DELIMITER $$
77CREATE PROCEDURE selectStat(in steamid bigint, in stat char(1))
78BEGIN
79 select var, val from mg_players where id = steamid and var = stat;
80END; $$
81DELIMITER ;
82
83DROP PROCEDURE IF EXISTS saveStat;
84DELIMITER $$
85CREATE PROCEDURE saveStat(in `steamid` bigint, in `stat` CHAR(1), in `num` INT)
86BEGIN
87 insert into mg_players (id, var, val) values (steamid, stat, num) on duplicate key update val = num;
88END; $$
89DELIMITER ;
90
91DROP PROCEDURE IF EXISTS getSteamIDFromDiscordTag;
92DELIMITER $$
93CREATE PROCEDURE getSteamIDFromDiscordTag(in tag varchar(255))
94BEGIN
95 SET @mid = (SELECT member_id FROM memberssocialinfo_sites WHERE discord LIKE tag LIMIT 1);
96 if (FOUND_ROWS() = 0) then
97 select 0 as steamid;
98 else
99 select steamid FROM core_members WHERE member_id LIKE @mid LIMIT 1;
100 end if;
101END; $$
102DELIMITER ;
103
104DROP PROCEDURE IF EXISTS selectRconCommands;
105DELIMITER $$
106CREATE PROCEDURE selectRconCommands(in `srvr` varchar(255))
107BEGIN
108 select id, staff_steamid, staff_rank, staff_name, command, args, steamid from rcon_commands as rc inner join rcon_queue as rq on rc.id = rq.cmdid where rq.server = srvr;
109END; $$
110DELIMITER ;
111
112DROP PROCEDURE IF EXISTS insertRconCommand;
113DELIMITER $$
114CREATE PROCEDURE insertRconCommand(in `sid` varchar(30), in `srank` tinytext, in `sname` text, in `cmd` text, in `srvr` varchar(255), in `arg` text, in `sido` varchar(30))
115BEGIN
116 insert into rcon_commands (staff_steamid, staff_rank, staff_name, `server`, command, args, steamid) values (sid, srank, sname, srvr, cmd, arg, sido);
117
118 set @cid = LAST_INSERT_ID();
119 if (srvr = "*") then
120 set @num = (SELECT COUNT(*) FROM player_servers);
121 while @num > 0 do
122 select ip, port into @i, @p from player_servers where id = @num;
123 insert into rcon_queue (cmdid, server) values (@cid, concat(@i, ":", @p));
124 set @num = @num - 1;
125 end while;
126 else
127 insert into rcon_queue (cmdid, server) values (@cid, srvr);
128 end if;
129
130 select @cid as cmd_id;
131END; $$
132DELIMITER ;
133
134DROP PROCEDURE IF EXISTS insertRconCommand;
135DELIMITER $$
136CREATE PROCEDURE insertRconCommand(in `sid` varchar(30), in `srank` tinytext, in `sname` text, in `cmd` text, in `srvr` varchar(255), in `arg` text, in `sido` varchar(30))
137BEGIN
138 insert into rcon_commands (staff_steamid, staff_rank, staff_name, `server`, command, args, steamid) values (sid, srank, sname, srvr, cmd, arg, sido);
139
140 set @cid = LAST_INSERT_ID();
141 if (srvr = "*") then
142 set @num = (SELECT COUNT(*) FROM player_servers);
143 while @num > 0 do
144 select ip, port into @i, @p from player_servers where id = @num;
145 insert into rcon_queue (cmdid, server) values (@cid, concat(@i, ":", @p));
146 set @num = @num - 1;
147 end while;
148 else
149 insert into rcon_queue (cmdid, server) values (@cid, srvr);
150 end if;
151
152 select @cid as cmd_id;
153END; $$
154DELIMITER ;
155
156DROP PROCEDURE IF EXISTS selectContract;
157DELIMITER $$
158CREATE PROCEDURE selectContract(in `id` varchar(255))
159BEGIN
160 SELECT score as myscore, steamid, (SELECT COUNT(*) FROM moat_contractplayers_v2 WHERE score >= myscore) AS position, (SELECT COUNT(steamid) FROM moat_contractplayers_v2) AS players FROM moat_contractplayers_v2 WHERE steamid = id;
161END; $$
162DELIMITER ;
163
164DROP PROCEDURE IF EXISTS removeRconCommands;
165DELIMITER $$
166CREATE PROCEDURE removeRconCommands(in srvr varchar(255))
167BEGIN
168 delete from rcon_queue where server = srvr;
169END; $$
170DELIMITER ;
171
172DROP PROCEDURE IF EXISTS selectContracts;
173DELIMITER $$
174CREATE PROCEDURE selectContracts(in `ip` varchar(255))
175BEGIN
176 SELECT `moat_contractplayers`.`score` as myscore, `moat_contractplayers`.`steamid`, (SELECT COUNT(*) FROM `moat_contractplayers` WHERE score >= myscore) AS position, (SELECT COUNT(steamid) FROM moat_contractplayers) AS players FROM `moat_contractplayers` INNER JOin `player_sessions` ON (`moat_contractplayers`.`steamid` = `player_sessions`.`steamid64` AND `player_sessions`.`server` = ip) ORDER BY score;
177END; $$
178DELIMITER ;
179
180DROP PROCEDURE IF EXISTS insertPayload;
181DELIMITER $$
182CREATE PROCEDURE insertPayload(in `pl` mediumtext)
183BEGIN
184 INSERT INTO github_payloads (payload) VALUES (pl);
185 SELECT LAST_INSERT_ID() AS pid;
186END; $$
187DELIMITER ;
188
189DROP PROCEDURE IF EXISTS updateGithubAuthors;
190DELIMITER $$
191CREATE PROCEDURE updateGithubAuthors(in `puid` varchar(255), in `pname` text, in `pemail` text, in `pnode_id` text, in `pavatar_url` text, in `pgithub_url` text)
192BEGIN
193 INSERT INTO github_authors (uid, name, email, node_id, avatar_url, github_url) VALUES (puid, pname, pemail, pnode_id, pavatar_url, pgithub_url) ON DUPLICATE KEY UPDATE name = pname, email = pemail, avatar_url = pavatar_url, github_url = pgithub_url;
194 SELECT id FROM github_authors WHERE uid = puid;
195END; $$
196DELIMITER ;
197
198DROP PROCEDURE IF EXISTS selectInventory;
199DELIMITER $$
200CREATE PROCEDURE selectInventory(in `steamid64` bigint)
201BEGIN
202 SELECT id, itemid, slotid, classname FROM mg_items WHERE ownerid = steamid64;
203 SELECT id, statid, value FROM mg_itemstats as ws INNER JOin mg_items as wd ON ws.weaponid = wd.id WHERE wd.ownerid = steamid64;
204 SELECT id, talentid, required, modification, value FROM mg_itemtalents as wt INNER JOin mg_items as wd ON wt.weaponid = wd.id WHERE wd.ownerid = steamid64 ORDER BY modification;
205 SELECT id, nickname FROM mg_itemnames as wn INNER JOin mg_items as wd ON wn.weaponid = wd.id WHERE wd.ownerid = steamid64;
206 SELECT id, type, paintid FROM mg_itempaints as wp INNER JOin mg_items as wd ON wp.weaponid = wd.id WHERE wd.ownerid = steamid64;
207END; $$
208DELIMITER ;
209
210CREATE TABLE IF NOT EXISTS `core_dev_ttt` (
211 `steamid` varchar(100) NOT NULL,
212 `max_slots` int(255) NOT NULL,
213 `credits` mediumtext NOT NULL,
214 `l_slot1` mediumtext DEFAULT NULL,
215 `l_slot2` mediumtext DEFAULT NULL,
216 `l_slot3` mediumtext DEFAULT NULL,
217 `l_slot4` mediumtext DEFAULT NULL,
218 `l_slot5` mediumtext DEFAULT NULL,
219 `l_slot6` mediumtext DEFAULT NULL,
220 `l_slot7` mediumtext DEFAULT NULL,
221 `l_slot8` mediumtext DEFAULT NULL,
222 `l_slot9` mediumtext DEFAULT NULL,
223 `l_slot10` mediumtext DEFAULT NULL,
224 `inventory` longtext NOT NULL,
225 PRIMARY KEY (`steamid`)
226);
227
228CREATE TABLE IF NOT EXISTS `ac_hash_track_real` (
229 `steamid` bigint(20) unsigned NOT NULL,
230 `hash` binary(64) NOT NULL,
231 PRIMARY KEY (`steamid`,`hash`)
232);
233
234CREATE TABLE IF NOT EXISTS `ac_hashes_real` (
235 `hash` binary(64) NOT NULL,
236 `triggers` int(10) unsigned NOT NULL DEFAULT 1,
237 PRIMARY KEY (`hash`)
238);
239
240CREATE TABLE IF NOT EXISTS `bounties_current` (
241 `ID` int(11) NOT NULL AUTO_INCREMENT,
242 `bounties` text NOT NULL,
243 PRIMARY KEY (`ID`)
244);
245
246CREATE TABLE IF NOT EXISTS `bounties_players` (
247 `steamid` varchar(100) NOT NULL,
248 `score` text NOT NULL,
249 PRIMARY KEY (`steamid`)
250);
251
252CREATE TABLE IF NOT EXISTS `core_members` (
253 `member_id` mediumint(8) NOT NULL AUTO_INCREMENT,
254 `name` varchar(255) NOT NULL DEFAULT '',
255 `member_group_id` smallint(3) NOT NULL DEFAULT 0,
256 `email` varchar(150) NOT NULL DEFAULT '',
257 `joined` int(10) NOT NULL DEFAULT 0,
258 `ip_address` varchar(46) NOT NULL DEFAULT '',
259 `skin` smallint(5) DEFAULT NULL,
260 `warn_level` int(10) DEFAULT NULL,
261 `warn_lastwarn` int(10) NOT NULL DEFAULT 0,
262 `language` mediumint(4) DEFAULT NULL,
263 `restrict_post` int(10) NOT NULL DEFAULT 0,
264 `bday_day` int(2) DEFAULT NULL,
265 `bday_month` int(2) DEFAULT NULL,
266 `bday_year` int(4) DEFAULT NULL,
267 `msg_count_new` int(2) NOT NULL DEFAULT 0,
268 `msg_count_total` int(3) NOT NULL DEFAULT 0,
269 `msg_count_reset` int(1) NOT NULL DEFAULT 0,
270 `msg_show_notification` int(1) NOT NULL DEFAULT 0,
271 `last_visit` int(10) DEFAULT 0,
272 `last_activity` int(10) DEFAULT 0,
273 `mod_posts` int(10) NOT NULL DEFAULT 0,
274 `auto_track` varchar(255) DEFAULT '0',
275 `temp_ban` int(10) DEFAULT 0,
276 `mgroup_others` varchar(245) NOT NULL DEFAULT '',
277 `member_login_key_expire` int(10) NOT NULL DEFAULT 0,
278 `members_seo_name` varchar(255) NOT NULL DEFAULT '',
279 `members_cache` mediumtext DEFAULT NULL,
280 `failed_logins` text DEFAULT NULL,
281 `failed_login_count` smallint(3) NOT NULL DEFAULT 0,
282 `members_profile_views` int(10) unsigned NOT NULL DEFAULT 0,
283 `members_pass_hash` varchar(255) DEFAULT NULL,
284 `members_pass_salt` varchar(22) DEFAULT NULL,
285 `members_bitoptions` int(10) unsigned NOT NULL DEFAULT 0,
286 `fb_uid` bigint(20) unsigned NOT NULL DEFAULT 0,
287 `members_day_posts` varchar(32) NOT NULL DEFAULT '0,0',
288 `live_id` varchar(32) DEFAULT NULL,
289 `twitter_id` varchar(255) NOT NULL DEFAULT '',
290 `twitter_token` varchar(255) NOT NULL DEFAULT '',
291 `twitter_secret` varchar(255) NOT NULL DEFAULT '',
292 `notification_cnt` mediumint(9) NOT NULL DEFAULT 0,
293 `fb_token` text DEFAULT NULL,
294 `ipsconnect_id` int(10) NOT NULL DEFAULT 0,
295 `google_id` varchar(50) DEFAULT NULL,
296 `linkedin_id` varchar(32) DEFAULT NULL,
297 `pp_last_visitors` text DEFAULT NULL,
298 `pp_main_photo` text DEFAULT NULL,
299 `pp_main_width` int(5) DEFAULT NULL,
300 `pp_main_height` int(5) DEFAULT NULL,
301 `pp_thumb_photo` text DEFAULT NULL,
302 `pp_thumb_width` int(5) DEFAULT NULL,
303 `pp_thumb_height` int(5) DEFAULT NULL,
304 `pp_setting_count_comments` int(2) DEFAULT NULL,
305 `pp_reputation_points` int(10) DEFAULT NULL,
306 `pp_photo_type` varchar(20) DEFAULT NULL,
307 `signature` text DEFAULT NULL,
308 `pconversation_filters` text DEFAULT NULL,
309 `fb_photo` text DEFAULT NULL,
310 `fb_photo_thumb` text DEFAULT NULL,
311 `fb_bwoptions` int(10) DEFAULT NULL,
312 `tc_last_sid_import` varchar(50) DEFAULT NULL,
313 `tc_photo` text DEFAULT NULL,
314 `tc_bwoptions` int(10) DEFAULT NULL,
315 `pp_customization` mediumtext DEFAULT NULL,
316 `timezone` varchar(64) DEFAULT NULL,
317 `pp_cover_photo` varchar(255) NOT NULL DEFAULT '',
318 `profilesync` text DEFAULT NULL,
319 `profilesync_lastsync` int(10) NOT NULL DEFAULT 0 COMMENT 'Indicates the last time any profile sync service was ran',
320 `google_token` text DEFAULT NULL,
321 `linkedin_token` text DEFAULT NULL,
322 `live_token` text DEFAULT NULL,
323 `allow_admin_mails` bit(1) DEFAULT b'0',
324 `members_bitoptions2` int(10) unsigned NOT NULL DEFAULT 0,
325 `create_menu` text DEFAULT NULL COMMENT 'Cached contents of the "Create" drop down menu.',
326 `ipsconnect_revalidate_url` text DEFAULT NULL,
327 `members_disable_pm` tinyint(1) unsigned NOT NULL DEFAULT 0 COMMENT '0 - not disabled, 1 - disabled, member can re-enable, 2 - disabled',
328 `marked_site_read` int(10) unsigned DEFAULT 0,
329 `pp_cover_offset` int(10) NOT NULL DEFAULT 0,
330 `acp_skin` smallint(6) DEFAULT NULL,
331 `acp_language` mediumint(9) DEFAULT NULL,
332 `member_title` varchar(64) DEFAULT NULL,
333 `member_posts` mediumint(7) NOT NULL DEFAULT 0,
334 `member_last_post` int(10) DEFAULT NULL,
335 `member_streams` text DEFAULT NULL,
336 `photo_last_update` int(10) DEFAULT NULL,
337 `steamid` varchar(17) DEFAULT NULL,
338 `kuzi_song_path` varchar(255) DEFAULT '' COMMENT 'Profile song path.',
339 `failed_mfa_attempts` smallint(3) unsigned DEFAULT 0 COMMENT 'Number of times tried and failed MFA',
340 `unlucky_enable` int(1) DEFAULT 0,
341 `unlucky_url` varchar(255) DEFAULT '',
342 `mfa_details` text DEFAULT NULL,
343 `permission_array` text DEFAULT NULL COMMENT 'A cache of the clubs and social groups that the member is in',
344 `discord_id` varchar(20) DEFAULT NULL,
345 `discord_name` varchar(50) DEFAULT NULL,
346 `account_closed` tinyint(1) unsigned DEFAULT 0,
347 `account_closed_reason` text DEFAULT NULL,
348 `autoreplypm_on` tinyint(1) DEFAULT 0,
349 `autoreplypm_text` text DEFAULT NULL,
350 `nbcontentratings_positive` int(10) unsigned DEFAULT NULL,
351 `nbcontentratings_negative` int(10) unsigned DEFAULT NULL,
352 `nbcontentratings_neutral` int(10) unsigned DEFAULT NULL,
353 `tm_member_tracked` tinyint(1) NOT NULL DEFAULT 0,
354 `tm_member_tracked_deadline` int(10) NOT NULL DEFAULT 0,
355 `tm_member_tracked_log_entries` int(10) NOT NULL DEFAULT 0,
356 `tm_member_tracked_actions` text DEFAULT NULL,
357 `completed` bit(1) NOT NULL DEFAULT b'0' COMMENT 'Whether the account is completed or not',
358 `conv_password` varchar(255) DEFAULT NULL,
359 `conv_password_extra` varchar(255) DEFAULT NULL,
360 `membermap_location_synced` tinyint(1) DEFAULT 0,
361 `cm_credits` text DEFAULT NULL,
362 `cm_no_sev` tinyint(1) DEFAULT 0,
363 `cm_return_group` smallint(3) DEFAULT 0,
364 `idm_block_submissions` tinyint(1) unsigned DEFAULT 0 COMMENT 'Blocked from submitting Downloads files?',
365 PRIMARY KEY (`member_id`),
366 UNIQUE KEY `discord_id` (`discord_id`),
367 KEY `bday_day` (`bday_day`),
368 KEY `bday_month` (`bday_month`),
369 KEY `members_bitoptions` (`members_bitoptions`),
370 KEY `ip_address` (`ip_address`),
371 KEY `failed_login_count` (`failed_login_count`),
372 KEY `joined` (`joined`),
373 KEY `fb_uid` (`fb_uid`),
374 KEY `twitter_id` (`twitter_id`(191)),
375 KEY `email` (`email`),
376 KEY `member_groups` (`member_group_id`,`mgroup_others`(188)),
377 KEY `google_id` (`google_id`),
378 KEY `linkedin_id` (`linkedin_id`),
379 KEY `mgroup` (`member_id`,`member_group_id`),
380 KEY `allow_admin_mails` (`allow_admin_mails`),
381 KEY `name_index` (`name`(191)),
382 KEY `ipsconnect_id` (`ipsconnect_id`),
383 KEY `mod_posts` (`mod_posts`),
384 KEY `photo_last_update` (`photo_last_update`),
385 KEY `steamid` (`steamid`),
386 KEY `last_activity` (`last_activity`),
387 KEY `completed` (`completed`,`temp_ban`),
388 KEY `profilesync` (`profilesync_lastsync`,`profilesync`(150))
389);
390
391CREATE TABLE IF NOT EXISTS `github_authors` (
392 `id` int(11) NOT NULL AUTO_INCREMENT,
393 `uid` varchar(255) NOT NULL,
394 `name` mediumtext NOT NULL,
395 `email` mediumtext NOT NULL,
396 `node_id` mediumtext DEFAULT NULL,
397 `avatar_url` mediumtext DEFAULT NULL,
398 `github_url` mediumtext DEFAULT NULL,
399 `moat_url` mediumtext DEFAULT NULL,
400 `steam_url` mediumtext DEFAULT NULL,
401 `bio` text DEFAULT NULL,
402 `jobs` int(1) DEFAULT NULL,
403 `hide` tinyint(1) DEFAULT NULL,
404 PRIMARY KEY (`uid`),
405 UNIQUE KEY `id` (`id`,`uid`) USING BTREE
406);
407
408CREATE TABLE IF NOT EXISTS `github_commits` (
409 `id` int(11) NOT NULL AUTO_INCREMENT,
410 `sha` varchar(40) NOT NULL,
411 `date` datetime NOT NULL,
412 `repo_id` mediumtext NOT NULL,
413 `author_id` int(11) NOT NULL,
414 `summary` mediumtext NOT NULL,
415 `type` mediumtext DEFAULT NULL,
416 `branch` mediumtext NOT NULL,
417 `files_modified` int(11) NOT NULL,
418 `payload` int(11) NOT NULL,
419 `hide` tinyint(1) DEFAULT NULL,
420 `lines_added` int(11) DEFAULT NULL,
421 `lines_removed` int(11) DEFAULT NULL,
422 PRIMARY KEY (`sha`),
423 UNIQUE KEY `id` (`id`) USING BTREE
424);
425
426CREATE TABLE IF NOT EXISTS `github_payloads` (
427 `pid` int(11) NOT NULL AUTO_INCREMENT,
428 `time` timestamp DEFAULT CURRENT_TIMESTAMP,
429 `payload` longtext NOT NULL,
430 PRIMARY KEY (`pid`)
431);
432
433CREATE TABLE IF NOT EXISTS `gmod_owners` (
434 `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
435 `date` varchar(255) NOT NULL,
436 `start` int(11) NOT NULL,
437 `end` int(11) NOT NULL,
438 `difference` int(11) NOT NULL,
439 PRIMARY KEY (`id`)
440);
441
442CREATE TABLE IF NOT EXISTS `lola_error_reports` (
443 `id` int(11) NOT NULL,
444 `messageid` varchar(30) NOT NULL,
445 PRIMARY KEY (`id`)
446);
447
448CREATE TABLE IF NOT EXISTS `mg_items` (
449 `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
450 `itemid` int(10) unsigned NOT NULL,
451 `ownerid` bigint(20) unsigned NOT NULL,
452 `slotid` int(10) DEFAULT NULL,
453 `classname` varchar(32) DEFAULT NULL,
454 `createdat` timestamp DEFAULT CURRENT_TIMESTAMP,
455 `updatedat` timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
456 PRIMARY KEY (`id`),
457 KEY `ownerid` (`ownerid`)
458);
459
460CREATE TABLE IF NOT EXISTS `mg_itemnames` (
461 `weaponid` int(10) unsigned NOT NULL,
462 `nickname` varchar(32) NOT NULL,
463 `updatedat` timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
464 PRIMARY KEY (`weaponid`),
465 CONSTRAINT `fk_mg_itemnames_mg_items` FOREIGN KEY (`weaponid`) REFERENCES `mg_items` (`id`) ON DELETE CASCADE
466);
467
468CREATE TABLE IF NOT EXISTS `mg_itempaints` (
469 `weaponid` int(10) unsigned NOT NULL,
470 `type` smallint(5) unsigned NOT NULL,
471 `paintid` smallint(5) unsigned NOT NULL,
472 `updatedat` timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
473 PRIMARY KEY (`weaponid`,`type`),
474 KEY `weaponid` (`weaponid`),
475 CONSTRAINT `fk_mg_itempaints_mg_items` FOREIGN KEY (`weaponid`) REFERENCES `mg_items` (`id`) ON DELETE CASCADE
476);
477
478
479
480CREATE TABLE IF NOT EXISTS `mg_itemstats` (
481 `weaponid` int(10) unsigned NOT NULL,
482 `statid` char(1) NOT NULL,
483 `value` float NOT NULL,
484 `updatedat` timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
485 PRIMARY KEY (`weaponid`,`statid`),
486 KEY `weaponid` (`weaponid`),
487 CONSTRAINT `fk_mg_itemstats_mg_items` FOREIGN KEY (`weaponid`) REFERENCES `mg_items` (`id`) ON DELETE CASCADE
488);
489
490CREATE TABLE IF NOT EXISTS `mg_itemtalents` (
491 `weaponid` int(10) unsigned NOT NULL,
492 `talentid` smallint(5) unsigned NOT NULL,
493 `required` smallint(5) unsigned DEFAULT NULL,
494 `modification` tinyint(3) unsigned NOT NULL,
495 `value` float NOT NULL,
496 `updatedat` timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
497 KEY `weaponid` (`weaponid`),
498 CONSTRAINT `fk_mg_itemtalents_mg_items` FOREIGN KEY (`weaponid`) REFERENCES `mg_items` (`id`) ON DELETE CASCADE
499);
500
501CREATE TABLE IF NOT EXISTS `mg_players` (
502 `id` bigint(20) unsigned NOT NULL,
503 `var` char(1) NOT NULL,
504 `val` int(10) unsigned NOT NULL,
505 `createdat` timestamp DEFAULT CURRENT_TIMESTAMP,
506 `updatedat` timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
507 PRIMARY KEY (`id`,`var`),
508 UNIQUE KEY `id` (`id`,`var`) USING BTREE
509);
510
511CREATE TABLE IF NOT EXISTS `moat_alt` (
512 `steamid64` bigint(20) NOT NULL,
513 `fp1` int(11) NOT NULL,
514 `fp2` bigint(20) NOT NULL,
515 `fp3` bigint(20) NOT NULL,
516 PRIMARY KEY (`steamid64`),
517 KEY `fp1` (`fp1`),
518 KEY `fp2` (`fp2`),
519 KEY `fp3` (`fp3`)
520);
521
522CREATE TABLE IF NOT EXISTS `moat_battlepass` (
523 `steamid` varchar(32) NOT NULL,
524 `tier` int(11) DEFAULT NULL,
525 `xp` int(11) DEFAULT NULL,
526 PRIMARY KEY (`steamid`)
527);
528
529CREATE TABLE IF NOT EXISTS `moat_comps` (
530 `ID` int(11) NOT NULL AUTO_INCREMENT,
531 `time` int(11) NOT NULL,
532 `steamid` varchar(255) NOT NULL,
533 `admin` mediumtext NOT NULL,
534 `link` mediumtext NOT NULL,
535 `ic` mediumtext NOT NULL,
536 `ec` mediumtext NOT NULL,
537 `sc` mediumtext DEFAULT NULL,
538 `item` mediumtext NOT NULL,
539 `class` mediumtext NOT NULL,
540 `talent1` mediumtext NOT NULL,
541 `talent2` mediumtext NOT NULL,
542 `talent3` mediumtext NOT NULL,
543 `talent4` mediumtext NOT NULL,
544 `comment` mediumtext NOT NULL,
545 `approved` mediumtext NOT NULL,
546 PRIMARY KEY (`ID`)
547);
548
549CREATE TABLE IF NOT EXISTS `moat_contract_cache` (
550 `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
551 `wpns` int(10) unsigned DEFAULT NULL,
552 `kills` int(10) unsigned DEFAULT NULL,
553 `last_updated` timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
554 PRIMARY KEY (`id`)
555);
556
557CREATE TABLE IF NOT EXISTS `moat_contractplayers` (
558 `steamid` varchar(100) NOT NULL,
559 `score` int(11) NOT NULL,
560 PRIMARY KEY (`steamid`)
561);
562
563CREATE TABLE IF NOT EXISTS `moat_contractplayers_v2` (
564 `steamid` varchar(100) NOT NULL,
565 `score` int(11) NOT NULL,
566 PRIMARY KEY (`steamid`)
567);
568
569CREATE TABLE IF NOT EXISTS `moat_contractrig` (
570 `contract` varchar(100) NOT NULL,
571 PRIMARY KEY (`contract`)
572);
573
574CREATE TABLE IF NOT EXISTS `moat_contracts` (
575 `ID` int(11) NOT NULL AUTO_INCREMENT,
576 `contract` varchar(255) NOT NULL,
577 `start_time` int(11) NOT NULL,
578 `active` int(11) NOT NULL,
579 `refresh_next` int(11) DEFAULT NULL,
580 `updating_server` varchar(32) DEFAULT NULL,
581 PRIMARY KEY (`ID`),
582 KEY `active` (`active`),
583 KEY `refresh_next` (`refresh_next`)
584);
585
586CREATE TABLE IF NOT EXISTS `moat_contracts_revamped` (
587 `ID` int(11) NOT NULL AUTO_INCREMENT,
588 `contract` varchar(255) NOT NULL,
589 `start_time` timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
590 `updating_server` varchar(32) DEFAULT NULL,
591 PRIMARY KEY (`ID`)
592);
593
594CREATE TABLE IF NOT EXISTS `moat_contracts_test` (
595 `ID` int(11) NOT NULL AUTO_INCREMENT,
596 `contract` varchar(255) NOT NULL,
597 `start_time` int(11) NOT NULL,
598 `active` int(11) NOT NULL,
599 `refresh_next` int(11) DEFAULT NULL,
600 `updating_server` varchar(32) DEFAULT NULL,
601 PRIMARY KEY (`ID`)
602);
603
604CREATE TABLE IF NOT EXISTS `moat_contracts_v2` (
605 `ID` int(11) NOT NULL AUTO_INCREMENT,
606 `contract` varchar(64) NOT NULL,
607 `start_time` timestamp NULL DEFAULT NULL,
608 `contract_id` int(11) NOT NULL,
609 `updating_server` varchar(32) DEFAULT NULL,
610 PRIMARY KEY (`ID`)
611);
612
613CREATE TABLE IF NOT EXISTS `moat_contractwinners` (
614 `steamid` varchar(32) NOT NULL,
615 `place` int(11) NOT NULL,
616 PRIMARY KEY (`steamid`)
617);
618
619CREATE TABLE IF NOT EXISTS `moat_contractwinners_v2` (
620 `steamid` bigint(20) unsigned NOT NULL,
621 `place` int(10) unsigned NOT NULL,
622 PRIMARY KEY (`steamid`)
623);
624
625CREATE TABLE IF NOT EXISTS `moat_discord` (
626 `steamid` varchar(32) NOT NULL,
627 `oauth` mediumtext NOT NULL,
628 `date` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
629 PRIMARY KEY (`steamid`)
630);
631
632CREATE TABLE IF NOT EXISTS `moat_errors` (
633 `id` int(11) NOT NULL AUTO_INCREMENT,
634 `error` mediumtext NOT NULL,
635 `serverip` varchar(255) NOT NULL,
636 `realm` tinyint(1) NOT NULL,
637 `stack` mediumtext DEFAULT NULL,
638 `steamid` varchar(20) DEFAULT NULL,
639 `date` timestamp DEFAULT CURRENT_TIMESTAMP,
640 PRIMARY KEY (`id`)
641);
642
643CREATE TABLE IF NOT EXISTS `moat_feedback` (
644 `vote` int(11) NOT NULL,
645 `map` varchar(100) NOT NULL,
646 `steamid` varchar(32) NOT NULL,
647 KEY `vote` (`vote`),
648 KEY `map` (`map`),
649 KEY `steamid` (`steamid`)
650);
651
652CREATE TABLE IF NOT EXISTS `moat_forums` (
653 `id` varchar(30) NOT NULL DEFAULT '',
654 `num` int(11) DEFAULT NULL,
655 PRIMARY KEY (`id`)
656);
657
658CREATE TABLE IF NOT EXISTS `moat_gchat` (
659 `ID` int(11) NOT NULL AUTO_INCREMENT,
660 `steamid` varchar(255) NOT NULL,
661 `time` int(11) NOT NULL,
662 `name` varchar(255) CHARACTER SET utf8mb4 NOT NULL,
663 `msg` mediumtext NOT NULL,
664 PRIMARY KEY (`ID`),
665 KEY `time` (`time`)
666);
667
668CREATE TABLE IF NOT EXISTS `moat_inv_items` (
669 `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
670 `itemid` int(10) unsigned NOT NULL,
671 `ownerid` bigint(20) unsigned NOT NULL,
672 `slotid` int(10) DEFAULT NULL,
673 `classname` varchar(32) DEFAULT NULL,
674 `createdat` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
675 `updatedat` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
676 PRIMARY KEY (`id`),
677 KEY `ownerid` (`ownerid`)
678);
679
680CREATE TABLE IF NOT EXISTS `moat_inv_items_names` (
681 `weaponid` int(10) unsigned NOT NULL,
682 `nickname` varchar(32) NOT NULL,
683 `changerid` bigint(20) unsigned NOT NULL,
684 `updatedat` timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
685);
686
687CREATE TABLE IF NOT EXISTS `moat_inv_items_paints` (
688 `weaponid` int(10) unsigned NOT NULL,
689 `type` smallint(5) unsigned NOT NULL,
690 `paintid` smallint(5) unsigned NOT NULL,
691 `updatedat` timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
692);
693
694CREATE TABLE IF NOT EXISTS `moat_inv_items_talents` (
695 `weaponid` int(10) unsigned NOT NULL,
696 `talentid` smallint(5) unsigned NOT NULL,
697 `required` smallint(5) unsigned DEFAULT NULL,
698 `modification` tinyint(3) unsigned NOT NULL,
699 `value` float NOT NULL,
700 `updatedat` timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
701 KEY `weaponid` (`weaponid`),
702 CONSTRAINT `fk_moat_inv_items_talents_moat_inv_items` FOREIGN KEY (`weaponid`) REFERENCES `moat_inv_items` (`id`) ON DELETE CASCADE
703);
704
705CREATE TABLE IF NOT EXISTS `moat_inv_players` (
706 `id` bigint(20) unsigned NOT NULL,
707 `var` char(1) NOT NULL,
708 `val` int(10) unsigned NOT NULL,
709 `createdat` timestamp DEFAULT CURRENT_TIMESTAMP,
710 `updatedat` timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
711 PRIMARY KEY (`id`,`var`),
712 UNIQUE KEY `id` (`id`,`var`) USING BTREE
713);
714
715CREATE TABLE IF NOT EXISTS `moat_inventories` (
716 `steamid` varchar(100) NOT NULL,
717 `max_slots` int(255) NOT NULL,
718 `credits` mediumtext NOT NULL,
719 `l_slot1` mediumtext DEFAULT NULL,
720 `l_slot2` mediumtext DEFAULT NULL,
721 `l_slot3` mediumtext DEFAULT NULL,
722 `l_slot4` mediumtext DEFAULT NULL,
723 `l_slot5` mediumtext DEFAULT NULL,
724 `l_slot6` mediumtext DEFAULT NULL,
725 `l_slot7` mediumtext DEFAULT NULL,
726 `l_slot8` mediumtext DEFAULT NULL,
727 `l_slot9` mediumtext DEFAULT NULL,
728 `l_slot10` mediumtext DEFAULT NULL,
729 `inventory` longtext NOT NULL,
730 PRIMARY KEY (`steamid`)
731);
732
733CREATE TABLE IF NOT EXISTS `moat_inventories_dev` (
734 `steamid` varchar(255) NOT NULL,
735 `max_slots` int(255) NOT NULL,
736 `credits` text NOT NULL,
737 `l_slot1` text DEFAULT NULL,
738 `l_slot2` text DEFAULT NULL,
739 `l_slot3` text DEFAULT NULL,
740 `l_slot4` text DEFAULT NULL,
741 `l_slot5` text DEFAULT NULL,
742 `l_slot6` text DEFAULT NULL,
743 `l_slot7` text DEFAULT NULL,
744 `l_slot8` text DEFAULT NULL,
745 `l_slot9` text DEFAULT NULL,
746 `l_slot10` text DEFAULT NULL,
747 `inventory` mediumtext NOT NULL,
748 PRIMARY KEY (`steamid`)
749);
750
751CREATE TABLE IF NOT EXISTS `moat_inventories_test` (
752 `steamid` varchar(100) NOT NULL,
753 `max_slots` int(255) NOT NULL,
754 `credits` mediumtext NOT NULL,
755 `l_slot1` mediumtext DEFAULT NULL,
756 `l_slot2` mediumtext DEFAULT NULL,
757 `l_slot3` mediumtext DEFAULT NULL,
758 `l_slot4` mediumtext DEFAULT NULL,
759 `l_slot5` mediumtext DEFAULT NULL,
760 `l_slot6` mediumtext DEFAULT NULL,
761 `l_slot7` mediumtext DEFAULT NULL,
762 `l_slot8` mediumtext DEFAULT NULL,
763 `l_slot9` mediumtext DEFAULT NULL,
764 `l_slot10` mediumtext DEFAULT NULL,
765 `inventory` longtext NOT NULL,
766 PRIMARY KEY (`steamid`)
767);
768
769CREATE TABLE IF NOT EXISTS `moat_itemqueue` (
770 `id` int(255) NOT NULL AUTO_INCREMENT,
771 `steamid` varchar(255) NOT NULL,
772 `item` mediumtext NOT NULL,
773 PRIMARY KEY (`id`)
774);
775
776CREATE TABLE IF NOT EXISTS `moat_jpgames` (
777 `ID` int(11) NOT NULL AUTO_INCREMENT,
778 `time_end` int(11) NOT NULL,
779 `active` int(11) NOT NULL,
780 `cool` int(11) DEFAULT NULL,
781 PRIMARY KEY (`ID`)
782);
783
784CREATE TABLE IF NOT EXISTS `moat_jpplayers` (
785 `steamid` varchar(255) NOT NULL,
786 `money` text NOT NULL,
787 `winner` int(11) DEFAULT NULL,
788 PRIMARY KEY (`steamid`)
789);
790
791CREATE TABLE IF NOT EXISTS `moat_jpservers` (
792 `ID` int(11) NOT NULL AUTO_INCREMENT,
793 `crc` mediumtext NOT NULL,
794 PRIMARY KEY (`ID`)
795);
796
797CREATE TABLE IF NOT EXISTS `moat_jpwinners` (
798 `steamid` varchar(32) NOT NULL,
799 `money` mediumtext NOT NULL,
800 PRIMARY KEY (`steamid`)
801);
802
803CREATE TABLE IF NOT EXISTS `moat_lastnum` (
804 `num` int(11) NOT NULL,
805 PRIMARY KEY (`num`)
806);
807
808CREATE TABLE IF NOT EXISTS `moat_levels` (
809 `steam_id` bigint(20) NOT NULL,
810 `color_r` int(11) DEFAULT NULL,
811 `color_g` int(11) DEFAULT NULL,
812 `color_b` int(11) DEFAULT NULL,
813 `color_effect` int(11) DEFAULT NULL,
814 `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
815 PRIMARY KEY (`steam_id`)
816);
817
818CREATE TABLE IF NOT EXISTS `moat_logs` (
819 `ID` int(11) NOT NULL AUTO_INCREMENT,
820 `time` int(11) NOT NULL,
821 `message` mediumtext NOT NULL,
822 PRIMARY KEY (`ID`)
823);
824
825CREATE TABLE IF NOT EXISTS `moat_lottery` (
826 `amount` int(11) NOT NULL,
827 PRIMARY KEY (`amount`)
828);
829
830CREATE TABLE IF NOT EXISTS `moat_lottery_last` (
831 `num` int(11) NOT NULL,
832 PRIMARY KEY (`num`)
833);
834
835CREATE TABLE IF NOT EXISTS `moat_lottery_players` (
836 `steamid` varchar(32) NOT NULL,
837 `name` varchar(255) DEFAULT NULL,
838 `ticket` int(11) NOT NULL,
839 PRIMARY KEY (`steamid`)
840);
841
842CREATE TABLE IF NOT EXISTS `moat_lottery_winners` (
843 `steamid` varchar(32) NOT NULL,
844 `amount` int(11) NOT NULL,
845 PRIMARY KEY (`steamid`)
846);
847
848CREATE TABLE IF NOT EXISTS `moat_mapvote_prevent` (
849 `active` tinyint(4) NOT NULL,
850 PRIMARY KEY (`active`)
851);
852
853CREATE TABLE IF NOT EXISTS `moat_megavape` (
854 `itemid` varchar(100) NOT NULL,
855 `time` int(11) NOT NULL,
856 PRIMARY KEY (`itemid`)
857);
858
859CREATE TABLE IF NOT EXISTS `moat_namerewards` (
860 `steamid` varchar(32) NOT NULL,
861 `last_name` int(11) NOT NULL,
862 `last_reward` int(11) NOT NULL,
863 `pending_ic` int(11) NOT NULL,
864 `pending_sc` int(11) NOT NULL,
865 PRIMARY KEY (`steamid`)
866);
867
868CREATE TABLE IF NOT EXISTS `moat_pendingitems` (
869 `steamid` varchar(32) NOT NULL,
870 `item` mediumtext NOT NULL
871);
872
873CREATE TABLE IF NOT EXISTS `moat_rollsave` (
874 `id` int(255) NOT NULL AUTO_INCREMENT,
875 `steamid` varchar(32) NOT NULL,
876 `item_tbl` mediumtext NOT NULL,
877 PRIMARY KEY (`id`),
878 KEY `steamid` (`steamid`)
879);
880
881CREATE TABLE IF NOT EXISTS `moat_staff_commands` (
882 `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
883 `staff_steamid` varchar(30) NOT NULL,
884 `staff_rank` text NOT NULL,
885 `staff_name` mediumtext NOT NULL,
886 `command` mediumtext NOT NULL,
887 `steamid` varchar(30) DEFAULT NULL,
888 `args` mediumtext DEFAULT NULL,
889 `server_for` mediumtext DEFAULT NULL,
890 `server_ran` mediumtext NOT NULL,
891 `date` timestamp DEFAULT CURRENT_TIMESTAMP,
892 PRIMARY KEY (`id`)
893);
894
895CREATE TABLE IF NOT EXISTS `moat_stats` (
896 `steamid` varchar(32) NOT NULL,
897 `stats_tbl` mediumtext NOT NULL,
898 PRIMARY KEY (`steamid`)
899);
900
901CREATE TABLE IF NOT EXISTS `moat_tradebans` (
902 `steamid64` bigint(20) unsigned NOT NULL,
903 `banner` bigint(20) unsigned DEFAULT NULL,
904 `reason` varchar(128) NOT NULL,
905 `unban_time` timestamp NULL DEFAULT NULL,
906 KEY `steamid64` (`steamid64`) USING BTREE
907);
908
909CREATE TABLE IF NOT EXISTS `moat_trades` (
910 `ID` int(11) NOT NULL AUTO_INCREMENT,
911 `time` int(11) NOT NULL,
912 `my_steamid` varchar(30) NOT NULL,
913 `their_steamid` varchar(30) NOT NULL,
914 `my_nick` mediumtext NOT NULL,
915 `their_nick` mediumtext NOT NULL,
916 `trade_tbl` mediumtext NOT NULL,
917 PRIMARY KEY (`ID`)
918);
919
920CREATE TABLE IF NOT EXISTS `moat_versus` (
921 `steamid` varchar(20) NOT NULL,
922 `money` int(11) NOT NULL,
923 `time` int(11) DEFAULT NULL,
924 `other` varchar(20) DEFAULT NULL,
925 `winner` varchar(20) DEFAULT NULL,
926 `rewarded` tinyint(1) DEFAULT NULL,
927 PRIMARY KEY (`steamid`)
928);
929
930CREATE TABLE IF NOT EXISTS `moat_versus_dev` (
931 `steamid` varchar(100) NOT NULL,
932 `money` int(11) NOT NULL,
933 `time` int(11) DEFAULT NULL,
934 `other` varchar(255) DEFAULT NULL,
935 `winner` varchar(255) DEFAULT NULL,
936 `rewarded` tinyint(1) DEFAULT NULL,
937 PRIMARY KEY (`steamid`)
938);
939
940CREATE TABLE IF NOT EXISTS `moat_versus_meme` (
941 `steamid` varchar(100) NOT NULL,
942 `money` int(11) NOT NULL,
943 `time` int(11) DEFAULT NULL,
944 `other` varchar(255) DEFAULT NULL,
945 `winner` varchar(255) DEFAULT NULL,
946 `rewarded` tinyint(1) DEFAULT NULL,
947 PRIMARY KEY (`steamid`)
948);
949
950CREATE TABLE IF NOT EXISTS `moat_versus_test` (
951 `steamid` varchar(20) NOT NULL,
952 `money` int(11) NOT NULL,
953 `time` int(11) DEFAULT NULL,
954 `other` varchar(20) DEFAULT NULL,
955 `winner` varchar(20) DEFAULT NULL,
956 PRIMARY KEY (`steamid`)
957);
958
959CREATE TABLE IF NOT EXISTS `moat_versus_v2` (
960 `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
961 `creator_steamid64` bigint(20) unsigned NOT NULL,
962 `money` int(10) unsigned NOT NULL,
963 `taker_steamid64` bigint(20) unsigned DEFAULT NULL,
964 `roll_time` timestamp NULL DEFAULT NULL,
965 `creator_won` tinyint(1) DEFAULT NULL,
966 `reward_time` timestamp NULL DEFAULT NULL,
967 `cancel_time` timestamp NULL DEFAULT NULL,
968 `creation_time` timestamp DEFAULT CURRENT_TIMESTAMP,
969 PRIMARY KEY (`id`),
970 KEY `id` (`id`,`reward_time`)
971);
972
973CREATE TABLE IF NOT EXISTS `moat_versuslogs` (
974 `ID` int(11) NOT NULL AUTO_INCREMENT,
975 `steamid` varchar(255) NOT NULL,
976 `other` varchar(255) NOT NULL,
977 `winner` varchar(255) NOT NULL,
978 `amount` int(11) NOT NULL,
979 `time` int(11) NOT NULL,
980 `tax` int(11) DEFAULT NULL,
981 PRIMARY KEY (`ID`)
982);
983
984CREATE TABLE IF NOT EXISTS `moat_versusstreaks` (
985 `steamid` varchar(100) NOT NULL,
986 `streak` int(11) NOT NULL,
987 PRIMARY KEY (`steamid`)
988);
989
990CREATE TABLE IF NOT EXISTS `moat_versusstreaks_history` (
991 `ID` int(11) NOT NULL AUTO_INCREMENT,
992 `steamid` varchar(255) NOT NULL,
993 `streak` int(11) NOT NULL,
994 `time` int(11) NOT NULL,
995 PRIMARY KEY (`ID`)
996);
997
998CREATE TABLE IF NOT EXISTS `moat_veterangamers` (
999 `steamid` varchar(20) NOT NULL,
1000 PRIMARY KEY (`steamid`)
1001);
1002
1003CREATE TABLE IF NOT EXISTS `moat_vswinners` (
1004 `ID` int(11) NOT NULL AUTO_INCREMENT,
1005 `steamid` varchar(255) NOT NULL,
1006 `money` int(11) NOT NULL,
1007 PRIMARY KEY (`ID`)
1008);
1009
1010CREATE TABLE IF NOT EXISTS `mse_logs` (
1011 `id` int(11) NOT NULL AUTO_INCREMENT,
1012 `steamid` varchar(30) NOT NULL,
1013 `cmd` mediumtext NOT NULL,
1014 `time` mediumtext NOT NULL,
1015 PRIMARY KEY (`id`)
1016);
1017
1018CREATE TABLE IF NOT EXISTS `mse_players` (
1019 `id` int(11) NOT NULL AUTO_INCREMENT,
1020 `steamid` varchar(30) NOT NULL,
1021 `rank` mediumtext NOT NULL,
1022 `cooldown` int(11) NOT NULL,
1023 `amount` int(11) NOT NULL,
1024 PRIMARY KEY (`id`)
1025);
1026
1027CREATE TABLE IF NOT EXISTS `player` (
1028 `steam_id` bigint(17) NOT NULL,
1029 `name` varchar(100) DEFAULT NULL,
1030 `rank` varchar(60) DEFAULT NULL,
1031 `first_join` int(10) DEFAULT NULL,
1032 `last_join` int(10) DEFAULT NULL,
1033 `avatar_url` varchar(150) DEFAULT NULL,
1034 `playtime` int(10) DEFAULT NULL,
1035 `inventory_credits` int(10) unsigned DEFAULT NULL,
1036 `event_credits` int(10) unsigned DEFAULT NULL,
1037 `donator_credits` int(10) unsigned DEFAULT NULL,
1038 `extra` varchar(150) DEFAULT NULL,
1039 `rank_expire` int(11) DEFAULT NULL,
1040 `rank_expire_to` varchar(32) DEFAULT NULL,
1041 `rank_changed` int(11) DEFAULT NULL,
1042 `mvp_access` int(11) DEFAULT NULL,
1043 PRIMARY KEY (`steam_id`),
1044 KEY `rank` (`rank`),
1045 KEY `inventory_credits` (`inventory_credits`),
1046 KEY `playtime` (`playtime`),
1047 KEY `last_join` (`last_join`),
1048 FULLTEXT KEY `name` (`name`)
1049);
1050
1051CREATE TABLE IF NOT EXISTS `player_bans` (
1052 `id` int(5) NOT NULL AUTO_INCREMENT,
1053 `time` int(11) DEFAULT NULL,
1054 `steam_id` bigint(17) DEFAULT NULL,
1055 `staff_steam_id` bigint(17) DEFAULT NULL,
1056 `name` varchar(100) DEFAULT NULL,
1057 `staff_name` varchar(100) DEFAULT NULL,
1058 `length` int(11) DEFAULT NULL,
1059 `reason` varchar(200) DEFAULT NULL,
1060 `unban_reason` varchar(200) DEFAULT NULL,
1061 PRIMARY KEY (`id`),
1062 KEY `SteamID` (`steam_id`),
1063 KEY `A_SteamID` (`staff_steam_id`),
1064 KEY `Name` (`name`),
1065 KEY `A_Name` (`staff_name`),
1066 KEY `length` (`length`),
1067 KEY `time` (`time`)
1068);
1069
1070CREATE TABLE IF NOT EXISTS `player_bans_comms` (
1071 `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
1072 `ban_type` tinyint(3) unsigned NOT NULL,
1073 `steam_id` bigint(20) unsigned NOT NULL,
1074 `staff_steam_id` bigint(20) unsigned NOT NULL,
1075 `name` varchar(32) DEFAULT NULL,
1076 `staff_name` varchar(32) DEFAULT NULL,
1077 `length` int(10) unsigned DEFAULT NULL,
1078 `time` int(10) unsigned DEFAULT NULL,
1079 `reason` varchar(255) DEFAULT NULL,
1080 `unban_reason` varchar(255) DEFAULT NULL,
1081 `date` timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
1082 PRIMARY KEY (`id`),
1083 KEY `steam_id` (`steam_id`),
1084 KEY `length` (`length`),
1085 KEY `time` (`time`),
1086 KEY `unban_reason` (`unban_reason`)
1087);
1088
1089CREATE TABLE IF NOT EXISTS `player_bans_trading` (
1090 `steam_id` bigint(20) NOT NULL,
1091 `staff_steam_id` bigint(20) NOT NULL,
1092 `reason` varchar(255) NOT NULL,
1093 `date` timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
1094 PRIMARY KEY (`steam_id`)
1095);
1096
1097CREATE TABLE IF NOT EXISTS `player_bans_votekick` (
1098 `steam_id` bigint(20) NOT NULL,
1099 `staff_steam_id` bigint(20) NOT NULL,
1100 `reason` varchar(255) NOT NULL,
1101 `date` timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
1102 PRIMARY KEY (`steam_id`)
1103);
1104
1105CREATE TABLE IF NOT EXISTS `player_cmds` (
1106 `name` varchar(100) NOT NULL,
1107 `flag` char(1) DEFAULT NULL,
1108 `weight` bit(1) DEFAULT b'0',
1109 `args` mediumtext DEFAULT NULL,
1110 PRIMARY KEY (`name`)
1111);
1112
1113CREATE TABLE IF NOT EXISTS `player_gmod` (
1114 `data_day` timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
1115 `owners` int(11) NOT NULL,
1116 `price` float NOT NULL,
1117 `event` varchar(255) DEFAULT NULL,
1118 `event_link` varchar(255) DEFAULT NULL,
1119 PRIMARY KEY (`data_day`)
1120);
1121
1122CREATE TABLE IF NOT EXISTS `player_iplog` (
1123 `LastSeen` bigint(20) NOT NULL,
1124 `SteamID` varchar(50) NOT NULL,
1125 `Address` varchar(50) NOT NULL,
1126 KEY `SteamID` (`SteamID`),
1127 KEY `Address` (`Address`)
1128);
1129
1130CREATE TABLE IF NOT EXISTS `player_logs` (
1131 `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
1132 `steam_id` bigint(20) unsigned NOT NULL,
1133 `name` varchar(100) NOT NULL,
1134 `cmd` varchar(100) NOT NULL,
1135 `args` text NOT NULL,
1136 `date` timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
1137 PRIMARY KEY (`id`)
1138);
1139
1140CREATE TABLE IF NOT EXISTS `player_ranks` (
1141 `name` varchar(255) NOT NULL,
1142 `weight` int(11) NOT NULL,
1143 `flags` tinytext NOT NULL,
1144 PRIMARY KEY (`name`)
1145);
1146
1147CREATE TABLE IF NOT EXISTS `player_servers` (
1148 `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
1149 `name` varchar(255) NOT NULL,
1150 `full_ip` varchar(45) DEFAULT NULL,
1151 `map` varchar(255) DEFAULT 'NULL',
1152 `players` int(10) unsigned DEFAULT NULL,
1153 `staff` int(10) unsigned DEFAULT NULL,
1154 `ip` varchar(255) NOT NULL,
1155 `port` varchar(10) NOT NULL,
1156 `custom_ip` varchar(255) NOT NULL,
1157 `join_url` varchar(255) DEFAULT NULL,
1158 `hostname` varchar(255) DEFAULT 'NULL',
1159 `map_changed` int(10) unsigned DEFAULT NULL,
1160 `max_players` int(10) unsigned DEFAULT NULL,
1161 `rounds_left` int(10) unsigned DEFAULT NULL,
1162 `round_state` varchar(50) NOT NULL,
1163 `time_left` int(10) unsigned DEFAULT NULL,
1164 `map_time_left` int(10) unsigned DEFAULT NULL,
1165 `traitors_alive` int(10) unsigned DEFAULT NULL,
1166 `innocents_alive` int(10) unsigned DEFAULT NULL,
1167 `others_alive` int(10) unsigned DEFAULT NULL,
1168 `spectators` int(10) unsigned DEFAULT NULL,
1169 `traitor_wins` int(10) unsigned DEFAULT NULL,
1170 `innocent_wins` int(10) unsigned DEFAULT NULL,
1171 `top_player_steamid` bigint(20) unsigned DEFAULT NULL,
1172 `top_player_name` varchar(255) DEFAULT NULL,
1173 `top_player_score` int(10) unsigned DEFAULT NULL,
1174 `special_round` varchar(255) DEFAULT NULL,
1175 `map_event` varchar(255) DEFAULT NULL,
1176 `last_update` timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
1177 PRIMARY KEY (`id`),
1178 UNIQUE KEY `ip` (`ip`,`port`),
1179 UNIQUE KEY `full_ip` (`full_ip`)
1180);
1181
1182CREATE TABLE IF NOT EXISTS `player_sessions` (
1183 `steamid64` bigint(20) NOT NULL,
1184 `time` int(11) NOT NULL,
1185 `server` varchar(32) NOT NULL,
1186 `name` varchar(100) NOT NULL,
1187 `rank` mediumtext NOT NULL,
1188 `level` int(11) NOT NULL,
1189 `team_kills` int(11) NOT NULL,
1190 `slays` int(11) NOT NULL,
1191 PRIMARY KEY (`steamid64`),
1192 KEY `name` (`name`)
1193);
1194
1195CREATE TABLE IF NOT EXISTS `player_warns` (
1196 `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
1197 `steam_id` bigint(20) unsigned NOT NULL,
1198 `staff_steam_id` bigint(20) unsigned NOT NULL,
1199 `name` varchar(100) NOT NULL,
1200 `staff_name` varchar(100) NOT NULL,
1201 `time` int(10) unsigned NOT NULL,
1202 `reason` varchar(255) NOT NULL,
1203 `acknowledged` int(10) unsigned DEFAULT NULL,
1204 PRIMARY KEY (`id`),
1205 KEY `acknowledged` (`acknowledged`),
1206 KEY `steam_id` (`steam_id`)
1207);
1208
1209CREATE TABLE IF NOT EXISTS `rcon_commands` (
1210 `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
1211 `staff_steamid` varchar(30) NOT NULL,
1212 `staff_rank` text NOT NULL,
1213 `staff_name` text DEFAULT NULL,
1214 `server` varchar(255) NOT NULL,
1215 `command` mediumtext NOT NULL,
1216 `args` text DEFAULT NULL,
1217 `steamid` varchar(30) DEFAULT NULL,
1218 `date` timestamp DEFAULT CURRENT_TIMESTAMP,
1219 PRIMARY KEY (`id`)
1220);
1221
1222CREATE TABLE IF NOT EXISTS `rcon_errors` (
1223 `id` int(11) NOT NULL AUTO_INCREMENT,
1224 `error` mediumtext NOT NULL,
1225 `serverip` varchar(255) NOT NULL,
1226 `realm` tinyint(1) NOT NULL,
1227 `stack` mediumtext DEFAULT NULL,
1228 `steamid` varchar(20) DEFAULT NULL,
1229 `date` timestamp DEFAULT CURRENT_TIMESTAMP,
1230 PRIMARY KEY (`id`)
1231);
1232
1233CREATE TABLE IF NOT EXISTS `rcon_queue` (
1234 `cmdid` int(10) unsigned NOT NULL,
1235 `server` varchar(255) NOT NULL,
1236 `date` timestamp DEFAULT CURRENT_TIMESTAMP,
1237 PRIMARY KEY (`cmdid`,`server`),
1238 CONSTRAINT `fk_rcon_queue_rcon_commands` FOREIGN KEY (`cmdid`) REFERENCES `rcon_commands` (`id`) ON DELETE CASCADE
1239);
1240
1241CREATE TABLE IF NOT EXISTS `staff_tracker` (
1242 `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
1243 `steamid` bigint(20) unsigned NOT NULL,
1244 `join_time` timestamp DEFAULT CURRENT_TIMESTAMP,
1245 `leave_time` timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
1246 `rounds_played` tinyint(10) unsigned NOT NULL DEFAULT 0,
1247 `rounds_on` int(10) unsigned NOT NULL DEFAULT 0,
1248 `time_played` int(10) unsigned NOT NULL DEFAULT 0,
1249 `reports_handled` smallint(10) unsigned NOT NULL DEFAULT 0,
1250 `server_ip` int(4) unsigned NOT NULL,
1251 `server_port` smallint(2) unsigned NOT NULL,
1252 PRIMARY KEY (`id`),
1253 KEY `join_time` (`join_time`),
1254 KEY `leave_time` (`leave_time`),
1255 KEY `steamid` (`steamid`),
1256 KEY `server_ip` (`server_ip`),
1257 KEY `server_port` (`server_port`)
1258);
1259
1260CREATE TABLE IF NOT EXISTS `stats` (
1261 `id` int(11) NOT NULL AUTO_INCREMENT,
1262 `steamid` varchar(30) NOT NULL,
1263 `credits` int(11) NOT NULL,
1264 `time` int(11) NOT NULL,
1265 `rank` mediumtext NOT NULL,
1266 `name` mediumtext NOT NULL,
1267 PRIMARY KEY (`id`)
1268);
1269
1270CREATE TABLE IF NOT EXISTS `steam_rewards` (
1271 `steam` char(20) NOT NULL,
1272 `value` int(11) NOT NULL,
1273 PRIMARY KEY (`steam`)
1274);
1275
1276CREATE TABLE IF NOT EXISTS `titles` (
1277 `id` int(11) NOT NULL AUTO_INCREMENT,
1278 `steamid` varchar(30) NOT NULL,
1279 `title` mediumtext NOT NULL,
1280 `color` mediumtext NOT NULL,
1281 `changerid` varchar(30) NOT NULL,
1282 PRIMARY KEY (`id`),
1283 UNIQUE KEY `steamid` (`steamid`)
1284);
1285
1286CREATE TABLE IF NOT EXISTS `customnotifications_notifications` (
1287 `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID Number',
1288 `options` mediumtext DEFAULT NULL,
1289 `enabled` tinyint(1) NOT NULL DEFAULT 1,
1290 `to_run` int(10) DEFAULT 0,
1291 `bf_options` int(11) NOT NULL DEFAULT 0,
1292 `url` mediumtext DEFAULT NULL,
1293 `member_id` int(11) NOT NULL DEFAULT 0,
1294 `sent_on` int(11) DEFAULT NULL,
1295 PRIMARY KEY (`id`)
1296);
1297
1298CREATE TABLE IF NOT EXISTS `damagelog_oldlogs` (
1299 `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
1300 `date` timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
1301 `server` tinytext NOT NULL,
1302 `map` tinytext NOT NULL,
1303 `round` tinyint(4) NOT NULL,
1304 `damagelog` longblob NOT NULL,
1305 PRIMARY KEY (`id`)
1306);
1307
1308CREATE TABLE IF NOT EXISTS `damagelog_weapons` (
1309 `class` varchar(100) NOT NULL,
1310 `name` varchar(255) NOT NULL,
1311 PRIMARY KEY (`class`)
1312);
1313
1314CREATE TABLE IF NOT EXISTS `core_ttt_oct` (
1315 `steamid` varchar(100) NOT NULL,
1316 `max_slots` int(255) NOT NULL,
1317 `credits` mediumtext NOT NULL,
1318 `l_slot1` mediumtext DEFAULT NULL,
1319 `l_slot2` mediumtext DEFAULT NULL,
1320 `l_slot3` mediumtext DEFAULT NULL,
1321 `l_slot4` mediumtext DEFAULT NULL,
1322 `l_slot5` mediumtext DEFAULT NULL,
1323 `l_slot6` mediumtext DEFAULT NULL,
1324 `l_slot7` mediumtext DEFAULT NULL,
1325 `l_slot8` mediumtext DEFAULT NULL,
1326 `l_slot9` mediumtext DEFAULT NULL,
1327 `l_slot10` mediumtext DEFAULT NULL,
1328 `inventory` longtext NOT NULL,
1329 PRIMARY KEY (`steamid`)
1330);
1331
1332CREATE TABLE IF NOT EXISTS `core_ttt_old` (
1333 `steamid` varchar(100) NOT NULL,
1334 `max_slots` int(255) NOT NULL,
1335 `credits` mediumtext NOT NULL,
1336 `l_slot1` mediumtext DEFAULT NULL,
1337 `l_slot2` mediumtext DEFAULT NULL,
1338 `l_slot3` mediumtext DEFAULT NULL,
1339 `l_slot4` mediumtext DEFAULT NULL,
1340 `l_slot5` mediumtext DEFAULT NULL,
1341 `l_slot6` mediumtext DEFAULT NULL,
1342 `l_slot7` mediumtext DEFAULT NULL,
1343 `l_slot8` mediumtext DEFAULT NULL,
1344 `l_slot9` mediumtext DEFAULT NULL,
1345 `l_slot10` mediumtext DEFAULT NULL,
1346 `inventory` longtext NOT NULL,
1347 PRIMARY KEY (`steamid`)
1348);