-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathkots_db.sql
More file actions
1704 lines (1436 loc) · 60.9 KB
/
kots_db.sql
File metadata and controls
1704 lines (1436 loc) · 60.9 KB
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
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
-- phpMyAdmin SQL Dump
-- version 2.11.2.1
-- http://www.phpmyadmin.net
--
-- Generation Time: Jun 02, 2008 at 09:18 PM
-- Server version: 5.0.24
-- PHP Version: 4.4.7
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
--
-- Database: `kots`
--
-- --------------------------------------------------------
--
-- Table structure for table `characters`
--
CREATE TABLE IF NOT EXISTS `characters` (
`id` int(10) unsigned NOT NULL auto_increment,
`name` varchar(45) NOT NULL,
`pass` varchar(45) NOT NULL,
`level` int(10) unsigned NOT NULL default '0',
`exp` int(10) unsigned NOT NULL default '0',
`resist` int(10) unsigned NOT NULL default '0',
`cubes` int(10) unsigned NOT NULL default '200',
`credits` int(10) unsigned NOT NULL default '0',
`rune_id` int(10) unsigned default NULL,
`datecreated` datetime NOT NULL,
`lastsaved` datetime default NULL,
`respawn_weapon` int(10) unsigned NOT NULL default '8',
`respawns` int(10) unsigned NOT NULL default '200',
`cursed` tinyint(1) NOT NULL default '0',
`loggedin` tinyint(1) NOT NULL default '0',
`isadmin` tinyint(1) NOT NULL default '0',
`isboss` tinyint(1) NOT NULL default '0',
`title` varchar(30) default NULL,
`gender` char(1) NOT NULL default 'M',
`king_id` int(4) unsigned default NULL,
`allow_login` tinyint(1) NOT NULL default '1',
`respec_points` int(4) NOT NULL default '0'
PRIMARY KEY (`id`),
UNIQUE KEY `name_ix` USING BTREE (`name`),
KEY `rune_id_ix` USING BTREE (`rune_id`),
KEY `respawn_weapon_ix` USING BTREE (`respawn_weapon`),
KEY `resist_ix` USING BTREE (`resist`),
KEY `king_id` (`king_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=2147 ;
-- --------------------------------------------------------
--
-- Table structure for table `characters_history`
--
CREATE TABLE IF NOT EXISTS `characters_history` (
`id` int(10) unsigned NOT NULL auto_increment,
`character_id` int(10) unsigned NOT NULL,
`logindate` datetime NOT NULL,
`ip_address` varchar(15) NOT NULL,
PRIMARY KEY (`id`),
KEY `ip_address` (`ip_address`),
KEY `FK_character_id` (`character_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC AUTO_INCREMENT=170866 ;
-- --------------------------------------------------------
--
-- Table structure for table `characters_persist`
--
CREATE TABLE IF NOT EXISTS `characters_persist` (
`character_id` int(10) unsigned NOT NULL,
`health` int(10) unsigned NOT NULL default '100',
`armor` int(10) unsigned NOT NULL default '0',
`shotgun` tinyint(1) NOT NULL default '0',
`supershotgun` tinyint(1) NOT NULL default '0',
`machinegun` tinyint(1) NOT NULL default '0',
`chaingun` tinyint(1) NOT NULL default '0',
`grenadelauncher` tinyint(1) NOT NULL default '0',
`rocketlauncher` tinyint(1) NOT NULL default '0',
`hyperblaster` tinyint(1) NOT NULL default '0',
`railgun` tinyint(1) NOT NULL default '0',
`bfg` tinyint(1) NOT NULL default '0',
`weapon` int(10) unsigned NOT NULL default '12',
`shells` int(10) unsigned NOT NULL default '0',
`bullets` int(10) unsigned NOT NULL default '0',
`grenades` int(10) unsigned NOT NULL default '0',
`rockets` int(10) unsigned NOT NULL default '0',
`cells` int(10) unsigned NOT NULL default '0',
`slugs` int(10) unsigned NOT NULL default '0',
`persist` tinyint(1) NOT NULL default '0',
PRIMARY KEY (`character_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `characters_player`
--
CREATE TABLE IF NOT EXISTS `characters_player` (
`character_id` int(10) unsigned NOT NULL,
`dexterity` int(10) unsigned NOT NULL default '0',
`strength` int(10) unsigned NOT NULL default '0',
`karma` int(10) unsigned NOT NULL default '0',
`wisdom` int(10) unsigned NOT NULL default '0',
`technical` int(10) unsigned NOT NULL default '0',
`spirit` int(10) unsigned NOT NULL default '0',
`rage` int(10) unsigned NOT NULL default '0',
`vithealth` int(10) unsigned NOT NULL default '0',
`vitarmor` int(10) unsigned NOT NULL default '0',
`munition` int(10) unsigned NOT NULL default '0',
`playersbought` int(10) unsigned NOT NULL default '0',
`playerpoints` int(10) unsigned NOT NULL default '0',
PRIMARY KEY (`character_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `characters_power`
--
CREATE TABLE IF NOT EXISTS `characters_power` (
`character_id` int(10) unsigned NOT NULL,
`expack` int(10) unsigned NOT NULL default '0',
`spiral` int(10) unsigned NOT NULL default '0',
`bide` int(10) unsigned NOT NULL default '0',
`kotsthrow` int(10) unsigned NOT NULL default '0',
`antiweapon` int(10) unsigned NOT NULL default '0',
`powersbought` int(10) unsigned NOT NULL default '0',
`powerpoints` int(10) unsigned NOT NULL default '0',
PRIMARY KEY (`character_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `characters_settings`
--
CREATE TABLE IF NOT EXISTS `characters_settings` (
`character_id` int(10) unsigned NOT NULL,
`highjump` tinyint(1) NOT NULL default '1',
`spiritswim` tinyint(1) NOT NULL default '1',
`pconvert` tinyint(1) NOT NULL default '0',
PRIMARY KEY (`character_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `characters_stats`
--
CREATE TABLE IF NOT EXISTS `characters_stats` (
`character_id` int(10) unsigned NOT NULL,
`kills` int(10) unsigned NOT NULL default '0',
`killed` int(10) unsigned NOT NULL default '0',
`telefrags` int(10) unsigned NOT NULL default '0',
`twofers` int(10) unsigned NOT NULL default '0',
`threefers` int(10) unsigned NOT NULL default '0',
`highestfer` int(10) unsigned NOT NULL default '0',
`sprees` int(10) unsigned NOT NULL default '0',
`spreewars` int(10) unsigned NOT NULL default '0',
`spreesbroken` int(10) unsigned NOT NULL default '0',
`spreewarsbroken` int(10) unsigned NOT NULL default '0',
`longestspree` int(10) unsigned NOT NULL default '0',
`suicides` int(10) unsigned NOT NULL default '0',
`teleports` int(10) unsigned NOT NULL default '0',
`timeplayed` int(10) unsigned NOT NULL default '0',
`total_packs` int(10) unsigned NOT NULL default '0',
`total_credits` int(10) unsigned NOT NULL default '0',
PRIMARY KEY (`character_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `characters_weapon`
--
CREATE TABLE IF NOT EXISTS `characters_weapon` (
`character_id` int(10) unsigned NOT NULL,
`sabre` int(10) unsigned NOT NULL default '0',
`shotgun` int(10) unsigned NOT NULL default '0',
`supershotgun` int(10) unsigned NOT NULL default '0',
`machinegun` int(10) unsigned NOT NULL default '0',
`chaingun` int(10) unsigned NOT NULL default '0',
`grenade` int(10) unsigned NOT NULL default '0',
`grenadelauncher` int(10) unsigned NOT NULL default '0',
`rocketlauncher` int(10) unsigned NOT NULL default '0',
`hyperblaster` int(10) unsigned NOT NULL default '0',
`railgun` int(10) unsigned NOT NULL default '0',
`bfg` int(10) unsigned NOT NULL default '0',
`antiweapon` int(4) unsigned NOT NULL default '0',
`weaponsbought` int(10) unsigned NOT NULL default '0',
`weaponpoints` int(10) unsigned NOT NULL default '0',
PRIMARY KEY (`character_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `characters_web`
--
CREATE TABLE IF NOT EXISTS `characters_web` (
`name` varchar(45) NOT NULL,
`email` varchar(50) NOT NULL,
`location` varchar(25) NOT NULL,
`age` int(11) NOT NULL,
`posts` int(11) NOT NULL,
`sig` text NOT NULL,
`lastseen` int(11) NOT NULL,
`avatar` int(3) NOT NULL default '1',
`av_ups` int(2) NOT NULL,
PRIMARY KEY (`name`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `comments`
--
CREATE TABLE IF NOT EXISTS `comments` (
`id` int(4) unsigned NOT NULL auto_increment,
`news_id` int(4) unsigned NOT NULL,
`msg` text NOT NULL,
`when` timestamp NOT NULL default CURRENT_TIMESTAMP,
`by` varchar(45) NOT NULL,
PRIMARY KEY (`id`),
KEY `news_id_ix` (`news_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=20 ;
-- --------------------------------------------------------
--
-- Table structure for table `ipbans`
--
CREATE TABLE IF NOT EXISTS `ipbans` (
`id` int(4) unsigned NOT NULL auto_increment,
`ip_address` varchar(15) NOT NULL,
`date` datetime NOT NULL,
`description` varchar(512) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `ip_address` (`ip_address`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=9 ;
-- --------------------------------------------------------
--
-- Table structure for table `kings`
--
CREATE TABLE IF NOT EXISTS `kings` (
`id` int(4) unsigned NOT NULL auto_increment,
`character_id` int(10) unsigned default NULL,
`title_male` varchar(50) NOT NULL,
`title_female` varchar(50) NOT NULL,
`desc` varchar(100) NOT NULL,
`priority` int(4) unsigned NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `ix_priority` (`priority`),
KEY `ix_character_id` (`character_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=42 ;
-- --------------------------------------------------------
--
-- Table structure for table `log`
--
CREATE TABLE IF NOT EXISTS `log` (
`id` int(10) unsigned NOT NULL auto_increment,
`date` datetime NOT NULL,
`info` varchar(2048) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=4358 ;
-- --------------------------------------------------------
--
-- Table structure for table `mutelist`
--
CREATE TABLE IF NOT EXISTS `mutelist` (
`id` int(10) unsigned NOT NULL auto_increment,
`date_muted` datetime NOT NULL,
`ip_address` varchar(15) NOT NULL,
`character_id` int(10) unsigned default NULL,
`name` varchar(45) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `mutes_ip_address_ix` (`ip_address`),
KEY `mutes_character_id_fk` (`character_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `news`
--
CREATE TABLE IF NOT EXISTS `news` (
`id` int(4) unsigned NOT NULL auto_increment,
`subj` varchar(255) NOT NULL,
`msg` text NOT NULL,
`when` timestamp NOT NULL default CURRENT_TIMESTAMP,
`by` varchar(45) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=24 ;
-- --------------------------------------------------------
--
-- Table structure for table `runes`
--
CREATE TABLE IF NOT EXISTS `runes` (
`id` int(10) unsigned NOT NULL auto_increment,
`name` varchar(30) NOT NULL,
`pickup_text` varchar(256) NOT NULL,
`model_name` varchar(64) NOT NULL,
`image_name` varchar(64) NOT NULL,
`sound_name` varchar(64) default NULL,
`mins` varchar(30) NOT NULL default '-16,-16,-16',
`maxs` varchar(30) NOT NULL default '16,16,16',
`effects` int(4) unsigned NOT NULL default '0',
`renderfx` int(4) unsigned NOT NULL default '0',
`rarity` double NOT NULL default '0',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=39 ;
-- --------------------------------------------------------
--
-- Table structure for table `runes_other`
--
CREATE TABLE IF NOT EXISTS `runes_other` (
`rune_id` int(10) unsigned NOT NULL,
`tballs` int(10) NOT NULL default '0',
`tball_regen` tinyint(1) NOT NULL default '0',
`tball_speed` tinyint(1) NOT NULL default '0',
`normal_resist` tinyint(1) NOT NULL default '0',
`energy_resist` tinyint(1) NOT NULL default '0',
PRIMARY KEY (`rune_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `runes_player`
--
CREATE TABLE IF NOT EXISTS `runes_player` (
`rune_id` int(10) unsigned NOT NULL,
`dexterity` int(4) NOT NULL default '0',
`strength` int(4) NOT NULL default '0',
`karma` int(4) NOT NULL default '0',
`wisdom` int(4) NOT NULL default '0',
`technical` int(4) NOT NULL default '0',
`spirit` int(4) NOT NULL default '0',
`rage` int(4) NOT NULL default '0',
`vithealth` int(4) NOT NULL default '0',
`vitarmor` int(4) NOT NULL default '0',
`munition` int(4) NOT NULL default '0',
PRIMARY KEY (`rune_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `runes_power`
--
CREATE TABLE IF NOT EXISTS `runes_power` (
`rune_id` int(10) unsigned NOT NULL,
`expack` int(4) NOT NULL default '0',
`spiral` int(4) NOT NULL default '0',
`bide` int(4) NOT NULL default '0',
`throw` int(4) NOT NULL default '0',
`antiweapon` int(4) NOT NULL default '0',
PRIMARY KEY (`rune_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `runes_weapon`
--
CREATE TABLE IF NOT EXISTS `runes_weapon` (
`rune_id` int(10) unsigned NOT NULL,
`sabre` int(4) NOT NULL default '0',
`shotgun` int(4) NOT NULL default '0',
`supershotgun` int(4) NOT NULL default '0',
`machinegun` int(4) NOT NULL default '0',
`chaingun` int(4) NOT NULL default '0',
`grenade` int(4) NOT NULL default '0',
`grenadelauncher` int(4) NOT NULL default '0',
`rocketlauncher` int(4) NOT NULL default '0',
`hyperblaster` int(4) NOT NULL default '0',
`railgun` int(4) NOT NULL default '0',
`bfg` int(4) NOT NULL default '0',
PRIMARY KEY (`rune_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `servers`
--
CREATE TABLE IF NOT EXISTS `servers` (
`id` int(4) unsigned NOT NULL auto_increment,
`name` varchar(128) NOT NULL,
`ip_address` varchar(15) default NULL,
`port` int(4) NOT NULL,
`max_players` int(4) NOT NULL,
`cur_players` int(4) NOT NULL,
`map` varchar(64) NOT NULL,
`last_updated` datetime NOT NULL,
`username` varchar(128) NOT NULL,
`is_public` tinyint(1) NOT NULL default '1',
`hostname` varchar(256) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `ix_servers_address` USING BTREE (`hostname`,`port`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=48 ;
-- --------------------------------------------------------
--
-- Table structure for table `settings`
--
CREATE TABLE IF NOT EXISTS `settings` (
`id` int(10) unsigned NOT NULL auto_increment,
`name` varchar(50) NOT NULL,
`value` varchar(50) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;
-- --------------------------------------------------------
--
-- Stand-in structure for view `v_possible_kings`
--
CREATE TABLE IF NOT EXISTS `v_possible_kings` (
`id` int(10) unsigned
,`name` varchar(45)
,`pass` varchar(45)
,`level` int(10) unsigned
,`exp` int(10) unsigned
,`resist` int(10) unsigned
,`cubes` int(10) unsigned
,`credits` int(10) unsigned
,`rune_id` int(10) unsigned
,`datecreated` datetime
,`lastsaved` datetime
,`respawn_weapon` int(10) unsigned
,`respawns` int(10) unsigned
,`cursed` tinyint(1)
,`loggedin` tinyint(1)
,`isadmin` tinyint(1)
,`title` varchar(30)
);
-- --------------------------------------------------------
--
-- Table structure for table `weapons`
--
CREATE TABLE IF NOT EXISTS `weapons` (
`id` int(10) unsigned NOT NULL,
`name` varchar(45) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Structure for view `v_possible_kings`
--
DROP TABLE IF EXISTS `v_possible_kings`;
CREATE ALGORITHM=UNDEFINED SQL SECURITY DEFINER VIEW `kots`.`v_possible_kings` AS select `a`.`id` AS `id`,`a`.`name` AS `name`,`a`.`pass` AS `pass`,`a`.`level` AS `level`,`a`.`exp` AS `exp`,`a`.`resist` AS `resist`,`a`.`cubes` AS `cubes`,`a`.`credits` AS `credits`,`a`.`rune_id` AS `rune_id`,`a`.`datecreated` AS `datecreated`,`a`.`lastsaved` AS `lastsaved`,`a`.`respawn_weapon` AS `respawn_weapon`,`a`.`respawns` AS `respawns`,`a`.`cursed` AS `cursed`,`a`.`loggedin` AS `loggedin`,`a`.`isadmin` AS `isadmin`,`a`.`title` AS `title` from (`kots`.`characters` `a` join `kots`.`characters_stats` `b` on((`a`.`id` = `b`.`character_id`))) where ((`a`.`isboss` = 0) and (`a`.`cursed` = 0) and (`a`.`level` >= 7) and (`a`.`lastsaved` >= (now() - interval 2 week)) and (`b`.`timeplayed` > ((60 * 60) * 2)));
--
-- Constraints for dumped tables
--
--
-- Constraints for table `characters_history`
--
ALTER TABLE `characters_history`
ADD CONSTRAINT `FK_character_id` FOREIGN KEY (`character_id`) REFERENCES `characters` (`id`) ON DELETE CASCADE;
--
-- Constraints for table `characters_persist`
--
ALTER TABLE `characters_persist`
ADD CONSTRAINT `FK_characters_persist_id` FOREIGN KEY (`character_id`) REFERENCES `characters` (`id`) ON DELETE CASCADE;
--
-- Constraints for table `characters_player`
--
ALTER TABLE `characters_player`
ADD CONSTRAINT `FK_characters_player_id` FOREIGN KEY (`character_id`) REFERENCES `characters` (`id`) ON DELETE CASCADE;
--
-- Constraints for table `characters_power`
--
ALTER TABLE `characters_power`
ADD CONSTRAINT `FK_characters_power_id` FOREIGN KEY (`character_id`) REFERENCES `characters` (`id`) ON DELETE CASCADE;
--
-- Constraints for table `characters_settings`
--
ALTER TABLE `characters_settings`
ADD CONSTRAINT `FK_characters_settings_id` FOREIGN KEY (`character_id`) REFERENCES `characters` (`id`) ON DELETE CASCADE;
--
-- Constraints for table `characters_stats`
--
ALTER TABLE `characters_stats`
ADD CONSTRAINT `FK_characters_stats_id` FOREIGN KEY (`character_id`) REFERENCES `characters` (`id`) ON DELETE CASCADE;
--
-- Constraints for table `characters_weapon`
--
ALTER TABLE `characters_weapon`
ADD CONSTRAINT `FK_characters_weapon_id` FOREIGN KEY (`character_id`) REFERENCES `characters` (`id`) ON DELETE CASCADE;
--
-- Constraints for table `kings`
--
ALTER TABLE `kings`
ADD CONSTRAINT `FK_kings_character_id` FOREIGN KEY (`character_id`) REFERENCES `characters` (`id`) ON DELETE SET NULL;
--
-- Constraints for table `mutelist`
--
ALTER TABLE `mutelist`
ADD CONSTRAINT `mutes_character_id_fk` FOREIGN KEY (`character_id`) REFERENCES `characters` (`id`);
--
-- Procedures
--
DELIMITER $$
--
$$
CREATE PROCEDURE `AdminLogin`(
name varchar(45),
pass varchar(45),
ip_address varchar(15),
out return_val int
)
BEGIN
declare realpass varchar(45);
declare id int;
declare isadmin tinyint;
/* NOTE: See kots_server.h for list of return values */
/* TODO: Possibly add an admins table that this uses instead of characters... */
/* Default the return value to everything ok */
set return_val = 0;
/* Get the character id and real password */
select a.id, a.pass, a.isadmin into id, realpass, isadmin
from characters a where a.name = name limit 1;
/* Check if the character was found */
if id is null
then
/* Not found */
set return_val = 2;
elseif (isadmin <> 1)
then
/* Not an admin */
set return_val = 7;
elseif (realpass <> MD5(pass))
then
/* Incorrect password */
set return_val = 3;
/* TODO: Possibly add some logging in here */
end if;
END
$$
CREATE PROCEDURE `UpdateServer3`(
name varchar(128),
port int(4),
max_players int(4),
cur_players int(4),
map varchar(64),
is_public tinyint
)
BEGIN
declare id int;
declare hostname varchar(256);
declare username varchar(128);
/* get ip address and server id if one exists */
select substr(user(), instr(user(), '@') + 1) into hostname;
select substr(user(), 1, instr(user(), '@') - 1) into username;
select a.id from `servers` a where a.hostname = hostname and a.port = port into id;
if id is null
then
insert into `servers` (name, port, max_players, cur_players, map, username, last_updated, is_public, hostname)
values (name, port, max_players, cur_players, map, username, NOW(), is_public, hostname);
else
update `servers`
set servers.name = name,
servers.max_players = max_players,
servers.cur_players = cur_players,
servers.map = map,
servers.username = username,
servers.is_public = is_public,
servers.last_updated = NOW()
where servers.id = id;
end if;
END
$$
CREATE PROCEDURE `BanIp`(
ip_address varchar(15),
description varchar(512)
)
BEGIN
declare id int;
select a.id into id
from ipbans a where a.ip_address = ip_address limit 1 for update;
if id is null
then
insert into ipbans
(ip_address, date, description)
values (ip_address, NOW(), description);
end if;
END
$$
CREATE PROCEDURE `CreateCharacter2`(
name varchar(45),
pass varchar(45),
out return_val int
)
BEGIN
declare id int;
/* NOTE: For list of return values see kots_server.h */
if exists (select 1 from settings a where a.name = 'disable_login' and value = '1')
then
/* Login has been disabled */
set return_val = 8;
elseif exists (select 1 from characters a where a.name = name for update)
then
/* Character already exists */
set return_val = 5;
else
insert into characters (name, pass, datecreated)
values (name, MD5(pass), NOW());
set id = @@IDENTITY;
insert into characters_power (character_id) values (id);
insert into characters_weapon (character_id) values (id);
insert into characters_player (character_id) values (id);
insert into characters_persist (character_id, persist) values (id, 0);
insert into characters_stats (character_id) values (id);
insert into characters_settings (character_id) values (id);
/* Everythign was successful */
set return_val = 0;
end if;
END
$$
CREATE PROCEDURE `DeleteAllCharacters`()
BEGIN
update kings set character_id = null;
delete from characters_persist;
delete from characters_player;
delete from characters_power;
delete from characters_weapon;
delete from characters;
END
$$
CREATE PROCEDURE `DeleteCharacter`(id int)
BEGIN
update kings set character_id = null where kings.character_id = id;
delete from characters_persist where characters_player.character_id = id;
delete from characters_player where characters_player.character_id = id;
delete from characters_power where characters_power.character_id = id;
delete from characters_weapon where characters_weapon.character_id = id;
delete from characters where characters.id = id;
END
$$
CREATE PROCEDURE `Load2`(
name varchar(45),
out return_val bool
)
BEGIN
declare id int;
select a.id into id
from characters a where a.name = name limit 1;
if id is null
then
set return_val = 2;
else
/*
We're not selecting id as a basic precaution
This will simply help prevent people from finding
out other characters id's. Any user or server
with the database access should be trustworthy,
but still this might be a useful security feature.
*/
select /*a.id,*/ a.level, a.exp, a.resist, a.cubes, a.credits, a.rune_id, a.respawn_weapon, a.respawns, a.gender,
b.sabre, b.shotgun, b.supershotgun, b.machinegun, b.chaingun, b.grenade, b.grenadelauncher, b.rocketlauncher, b.hyperblaster, b.railgun, b.bfg, b.weaponpoints, b.antiweapon as wantiweapon,
c.dexterity, c.strength, c.karma, c.wisdom, c.technical, c.spirit, c.rage, c.vithealth, c.vitarmor, c.munition, c.playerpoints,
d.expack, d.spiral, d.bide, d.kotsthrow, d.antiweapon, d.powerpoints,
f.kills, f.killed, f.telefrags, f.twofers, f.threefers, f.highestfer, f.sprees, f.spreewars, f.spreesbroken, f.spreewarsbroken, f.longestspree, f.suicides, f.teleports, f.timeplayed,
g.highjump, g.spiritswim, g.pconvert
from characters a inner join
characters_weapon b on a.id = b.character_id inner join
characters_player c on a.id = c.character_id inner join
characters_power d on a.id = d.character_id inner join
characters_stats f on a.id = f.character_id inner join
characters_settings g on a.id = g.character_id
where a.id = id;
set return_val = 0;
end if;
END
$$
CREATE PROCEDURE `LoadIpBans`()
BEGIN
select ip_address from ipbans;
END
$$
CREATE PROCEDURE `LoadMuteList`()
BEGIN
select a.ip_address, a.name, a.character_id
from mutelist a;
END
$$
CREATE PROCEDURE `LoadRunes`()
BEGIN
SELECT a.id, a.name, a.pickup_text, a.model_name, a.image_name, a.sound_name, a.effects, a.renderfx, a.rarity, a.mins, a.maxs,
b.dexterity, b.strength, b.karma, b.wisdom, b.technical, b.spirit, b.rage, b.vithealth, b.vitarmor, b.munition,
c.sabre, c.shotgun, c.supershotgun, c.machinegun, c.chaingun, c.grenade, c.grenadelauncher, c.rocketlauncher, c.hyperblaster, c.railgun, c.bfg,
d.expack, d.spiral, d.bide, d.throw, d.antiweapon,
e.tballs, e.tball_regen, e.tball_speed, e.normal_resist, e.energy_resist
FROM runes a inner join
runes_player b on a.id = b.rune_id inner join
runes_weapon c on a.id = c.rune_id inner join
runes_power d on a.id = d.rune_id inner join
runes_other e on a.id = e.rune_id;
END
$$
CREATE PROCEDURE `LoadServers`()
BEGIN
/*
Servers not updated for a while are considered down
*/
select name, ip_address, port, max_players, cur_players, map, hostname,
CASE
WHEN NOW() < DATE_ADD(last_updated, interval 60 minute) THEN 1
ELSE 0
END as status
from `servers`
where is_public = 1
having status = 1;
END
$$
CREATE PROCEDURE `Login3`(
name varchar(45),
pass varchar(45),
ip_address varchar(15),
out return_val int
)
BEGIN
declare title varchar(50);
declare realpass varchar(45);
declare id int;
declare lastsaved datetime;
declare isloggedin bool;
declare allow_login bool;
if exists (select 1 from settings a where a.name = 'disable_login' and value = '1')
then
/* Login has been disabled */
set return_val = 8;
else
select a.id, a.pass, a.lastsaved, a.loggedin, a.allow_login into id, realpass, lastsaved, isloggedin, allow_login
from characters a where a.name = name limit 1 for update;
if id is null
then
/* Character doesn't exist */
set return_val = 2;
elseif (realpass <> MD5(pass))
then
/* Incorrect password */
set return_val = 3;
elseif (isloggedin AND lastsaved is not null AND DATE_ADD(lastsaved, interval 10 minute) > NOW())
then
/* Already logged in */
set return_val = 4;
elseif not allow_login
then
/* Login for this character has been disabled */
set return_val = 8;
else
update characters a
set loggedin = 1,
lastsaved = NOW()
where a.id = id;
insert into characters_history
(character_id, logindate, ip_address)
values (id, NOW(), ip_address);
select a.id, a.level, a.exp, a.resist, a.cubes, a.credits, a.rune_id, a.respawn_weapon, a.respawns, a.isadmin, a.gender, a.cursed,
case
when length(a.title) <> 0 then a.title
when a.gender = 'f' then h.title_female
else h.title_male
end as title,
b.sabre, b.shotgun, b.supershotgun, b.machinegun, b.chaingun, b.grenade, b.grenadelauncher, b.rocketlauncher, b.hyperblaster, b.railgun, b.bfg, b.weaponpoints, b.antiweapon as wantiweapon, b.weaponsbought,
c.dexterity, c.strength, c.karma, c.wisdom, c.technical, c.spirit, c.rage, c.vithealth, c.vitarmor, c.munition, c.playerpoints, c.playersbought,
d.expack, d.spiral, d.bide, d.kotsthrow, d.antiweapon, d.powerpoints, d.powersbought,
e.health, e.armor, e.weapon, e.persist, e.shotgun as persist_shotgun, e.supershotgun as persist_supershotgun, e.machinegun as persist_machinegun, e.chaingun as persist_chaingun, e.grenadelauncher as persist_grenadelauncher, e.rocketlauncher as persist_rocketlauncher, e.hyperblaster as persist_hyperblaster, e.railgun as persist_railgun, e.bfg as persist_bfg, e.shells, e.bullets, e.grenades, e.rockets, e.cells, e.slugs,
f.kills, f.killed, f.telefrags, f.twofers, f.threefers, f.highestfer, f.sprees, f.spreewars, f.spreesbroken, f.spreewarsbroken, f.longestspree, f.suicides, f.teleports, f.timeplayed, f.total_credits, f.total_packs,
g.highjump, g.spiritswim, g.pconvert, a.respec_points
from characters a inner join
characters_weapon b on a.id = b.character_id inner join
characters_player c on a.id = c.character_id inner join
characters_power d on a.id = d.character_id inner join
characters_persist e on a.id = e.character_id inner join
characters_stats f on a.id = f.character_id inner join
characters_settings g on a.id = g.character_id left join
kings h on a.king_id = h.id
where a.id = id;
set return_val = 0;
end if;
end if;
END
$$
CREATE PROCEDURE `LogInfo`(
info varchar(2048)
)
BEGIN
insert into `log` (`date`, `info`)
values ( NOW(), info );
END
$$
CREATE PROCEDURE `MutePlayer`(
ip_address varchar(15),
name varchar(16),
character_id int
)
BEGIN
declare id int;
select a.id into id
from mutelist a where a.ip_address = ip_address limit 1 for update;
if id is null
then
if character_id = 0
then
set character_id = 0;
end if;
insert into mutelist
(ip_address, name, character_id, date_muted)
values (ip_address, name, character_id, NOW());
end if;
END
$$
CREATE PROCEDURE `SaveCharacter3`(
id int,
`level` int,
exp int,
gender char,
resist int,
cubes int,
credits int,
respawn_weapon int,
respawns int,
loggedin tinyint(1),
cursed tinyint(1),
isadmin tinyint(1),
respec_points int
)
BEGIN
update characters a
set a.`level` = `level`,
a.exp = exp,
a.gender = gender,
a.resist = resist,
a.cubes = cubes,
a.credits = credits,
a.respawn_weapon = respawn_weapon,
a.respawns = respawns,
a.lastsaved = NOW(),
a.loggedin = loggedin,
a.cursed = cursed,
a.isadmin = isadmin,
a.respec_points = respec_points
where a.id = id;
END
$$
CREATE PROCEDURE `SavePersist`(
id int,