diff --git a/Database.sql b/Database.sql index 78faeb5..2ebcb2e 100644 --- a/Database.sql +++ b/Database.sql @@ -1,7 +1,7 @@ -- MoparRSC DB Structure -- -- ------------------------------------------------------ --- Server version 5.1.49-1ubuntu8.1 +-- Server version 5.1.49-1ubuntu8.1-log /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; @@ -20,42 +20,24 @@ CREATE DATABASE IF NOT EXISTS moparclassic; USE moparclassic; -CREATE TABLE `moparclassic`.`bans` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `username` varchar(200) DEFAULT NULL, - `ip` varchar(255) DEFAULT NULL, - `email` varchar(80) DEFAULT NULL, - `message` varchar(255) DEFAULT NULL, - `expire` int(10) unsigned DEFAULT NULL, - `ban_creator` int(10) unsigned NOT NULL DEFAULT '0', - PRIMARY KEY (`id`), - KEY `bans_username_idx` (`username`(25)) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; -CREATE TABLE `moparclassic`.`categories` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `cat_name` varchar(80) NOT NULL DEFAULT 'New Category', - `disp_position` int(10) NOT NULL DEFAULT '0', - PRIMARY KEY (`id`) -) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; -CREATE TABLE `moparclassic`.`censoring` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `search_for` varchar(60) NOT NULL DEFAULT '', - `replace_with` varchar(60) NOT NULL DEFAULT '', - PRIMARY KEY (`id`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; -CREATE TABLE `moparclassic`.`config` ( - `conf_name` varchar(255) NOT NULL DEFAULT '', - `conf_value` text, - PRIMARY KEY (`conf_name`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; +-- +-- Definition of table `moparclassic`.`drops` +-- +DROP TABLE IF EXISTS `moparclassic`.`drops`; CREATE TABLE `moparclassic`.`drops` ( `id` int(11) DEFAULT NULL, `item` varchar(255) DEFAULT NULL, `amount` int(11) DEFAULT NULL, `weight` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +-- +-- Definition of table `moparclassic`.`dupe_data` +-- + +DROP TABLE IF EXISTS `moparclassic`.`dupe_data`; CREATE TABLE `moparclassic`.`dupe_data` ( `user` varchar(255) NOT NULL, `userhash` varchar(255) NOT NULL, @@ -63,92 +45,33 @@ CREATE TABLE `moparclassic`.`dupe_data` ( `time` varchar(255) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; +-- +-- Definition of table `moparclassic`.`error_reports` +-- + +DROP TABLE IF EXISTS `moparclassic`.`error_reports`; CREATE TABLE `moparclassic`.`error_reports` ( `data` text, `email` varchar(255) DEFAULT NULL, `ip` varchar(255) DEFAULT NULL, `unix` varchar(255) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; -CREATE TABLE `moparclassic`.`forum_perms` ( - `group_id` int(10) NOT NULL DEFAULT '0', - `forum_id` int(10) NOT NULL DEFAULT '0', - `read_forum` tinyint(1) NOT NULL DEFAULT '1', - `post_replies` tinyint(1) NOT NULL DEFAULT '1', - `post_topics` tinyint(1) NOT NULL DEFAULT '1', - PRIMARY KEY (`group_id`,`forum_id`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; -CREATE TABLE `moparclassic`.`forums` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `forum_name` varchar(80) NOT NULL DEFAULT 'New forum', - `forum_desc` text, - `redirect_url` varchar(100) DEFAULT NULL, - `moderators` text, - `num_topics` mediumint(8) unsigned NOT NULL DEFAULT '0', - `num_posts` mediumint(8) unsigned NOT NULL DEFAULT '0', - `last_post` int(10) unsigned DEFAULT NULL, - `last_post_id` int(10) unsigned DEFAULT NULL, - `last_poster` varchar(200) DEFAULT NULL, - `sort_by` tinyint(1) NOT NULL DEFAULT '0', - `disp_position` int(10) NOT NULL DEFAULT '0', - `cat_id` int(10) unsigned NOT NULL DEFAULT '0', - PRIMARY KEY (`id`) -) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; +-- +-- Definition of table `moparclassic`.`gp_count` +-- + +DROP TABLE IF EXISTS `moparclassic`.`gp_count`; CREATE TABLE `moparclassic`.`gp_count` ( `unixtime` varchar(255) DEFAULT NULL, `amount` varchar(255) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; -CREATE TABLE `moparclassic`.`groups` ( - `g_id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `g_title` varchar(50) NOT NULL DEFAULT '', - `g_user_title` varchar(50) DEFAULT NULL, - `g_moderator` tinyint(1) NOT NULL DEFAULT '0', - `g_mod_edit_users` tinyint(1) NOT NULL DEFAULT '0', - `g_mod_rename_users` tinyint(1) NOT NULL DEFAULT '0', - `g_mod_change_passwords` tinyint(1) NOT NULL DEFAULT '0', - `g_mod_ban_users` tinyint(1) NOT NULL DEFAULT '0', - `g_read_board` tinyint(1) NOT NULL DEFAULT '1', - `g_view_users` tinyint(1) NOT NULL DEFAULT '1', - `g_post_replies` tinyint(1) NOT NULL DEFAULT '1', - `g_post_topics` tinyint(1) NOT NULL DEFAULT '1', - `g_edit_posts` tinyint(1) NOT NULL DEFAULT '1', - `g_delete_posts` tinyint(1) NOT NULL DEFAULT '1', - `g_delete_topics` tinyint(1) NOT NULL DEFAULT '1', - `g_set_title` tinyint(1) NOT NULL DEFAULT '1', - `g_search` tinyint(1) NOT NULL DEFAULT '1', - `g_search_users` tinyint(1) NOT NULL DEFAULT '1', - `g_send_email` tinyint(1) NOT NULL DEFAULT '1', - `g_post_flood` smallint(6) NOT NULL DEFAULT '30', - `g_search_flood` smallint(6) NOT NULL DEFAULT '30', - `g_email_flood` smallint(6) NOT NULL DEFAULT '60', - PRIMARY KEY (`g_id`) -) ENGINE=MyISAM AUTO_INCREMENT=5 DEFAULT CHARSET=utf8; -CREATE TABLE `moparclassic`.`invites` ( - `owner` varchar(255) NOT NULL DEFAULT '', - `code` varchar(255) NOT NULL DEFAULT '', - `time` int(10) unsigned NOT NULL DEFAULT '0', - `invites` varchar(255) NOT NULL DEFAULT '1', - `email` varchar(255) NOT NULL DEFAULT '' -) ENGINE=MyISAM DEFAULT CHARSET=latin1; -CREATE TABLE `moparclassic`.`irc_online` ( - `username` varchar(255) NOT NULL, - `rank` int(1) DEFAULT NULL, - PRIMARY KEY (`username`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1; -CREATE TABLE `moparclassic`.`irc_stats` ( - `username` varchar(255) NOT NULL, - `messages` int(10) DEFAULT NULL, - `modes` int(10) DEFAULT NULL, - `kicks` int(10) DEFAULT NULL, - `kicked` int(10) DEFAULT NULL, - `lastTimeSpoken` bigint(11) DEFAULT NULL, - `joins` int(10) DEFAULT NULL, - `parts` int(10) DEFAULT NULL, - `randomstring` text, - `moderatedchan` int(10) DEFAULT NULL, - PRIMARY KEY (`username`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1; +-- +-- Definition of table `moparclassic`.`items` +-- + +DROP TABLE IF EXISTS `moparclassic`.`items`; CREATE TABLE `moparclassic`.`items` ( `id` int(11) DEFAULT NULL, `name` varchar(255) DEFAULT NULL, @@ -157,41 +80,22 @@ CREATE TABLE `moparclassic`.`items` ( `stackable` varchar(255) DEFAULT NULL, `wieldable` varchar(255) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; -CREATE TABLE `moparclassic`.`logins` ( - `id` int(10) DEFAULT NULL, - `login_ip` varchar(15) DEFAULT NULL, - `time` int(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1; -CREATE TABLE `moparclassic`.`messages` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `owner` int(10) NOT NULL DEFAULT '0', - `subject` varchar(120) NOT NULL DEFAULT '', - `message` text, - `sender` varchar(120) NOT NULL DEFAULT '', - `sender_id` int(10) NOT NULL DEFAULT '0', - `posted` int(10) NOT NULL DEFAULT '0', - `sender_ip` varchar(120) NOT NULL DEFAULT '0.0.0.0', - `smileys` tinyint(1) NOT NULL DEFAULT '1', - `status` tinyint(1) NOT NULL DEFAULT '0', - `showed` tinyint(1) NOT NULL DEFAULT '0', - PRIMARY KEY (`id`), - KEY `messages_owner_idx` (`owner`) -) ENGINE=MyISAM AUTO_INCREMENT=23964 DEFAULT CHARSET=latin1; -CREATE TABLE `moparclassic`.`online` ( - `user_id` int(10) unsigned NOT NULL DEFAULT '1', - `ident` varchar(200) NOT NULL DEFAULT '', - `logged` int(10) unsigned NOT NULL DEFAULT '0', - `idle` tinyint(1) NOT NULL DEFAULT '0', - `last_post` int(10) unsigned DEFAULT NULL, - `last_search` int(10) unsigned DEFAULT NULL, - UNIQUE KEY `online_user_id_ident_idx` (`user_id`,`ident`(25)), - KEY `online_ident_idx` (`ident`(25)), - KEY `online_logged_idx` (`logged`) -) ENGINE=MEMORY DEFAULT CHARSET=utf8; + +-- +-- Definition of table `moparclassic`.`online_count` +-- + +DROP TABLE IF EXISTS `moparclassic`.`online_count`; CREATE TABLE `moparclassic`.`online_count` ( `unixtime` varchar(255) DEFAULT NULL, `online` int(20) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +-- +-- Definition of table `moparclassic`.`pk_bank` +-- + +DROP TABLE IF EXISTS `moparclassic`.`pk_bank`; CREATE TABLE `moparclassic`.`pk_bank` ( `user` varchar(255) DEFAULT NULL, `id` int(10) unsigned NOT NULL, @@ -202,6 +106,11 @@ CREATE TABLE `moparclassic`.`pk_bank` ( KEY `amount` (`amount`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; +-- +-- Definition of table `moparclassic`.`pk_banlog` +-- + +DROP TABLE IF EXISTS `moparclassic`.`pk_banlog`; CREATE TABLE `moparclassic`.`pk_banlog` ( `user` varchar(255) DEFAULT NULL, `staff` varchar(255) DEFAULT NULL, @@ -210,6 +119,12 @@ CREATE TABLE `moparclassic`.`pk_banlog` ( KEY `time` (`time`), KEY `user` (`user`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +-- +-- Definition of table `moparclassic`.`pk_curstats` +-- + +DROP TABLE IF EXISTS `moparclassic`.`pk_curstats`; CREATE TABLE `moparclassic`.`pk_curstats` ( `user` varchar(255) NOT NULL, `cur_attack` int(5) unsigned NOT NULL DEFAULT '1', @@ -235,6 +150,11 @@ CREATE TABLE `moparclassic`.`pk_curstats` ( KEY `user` (`user`) ) ENGINE=MyISAM AUTO_INCREMENT=350943 DEFAULT CHARSET=latin1; +-- +-- Definition of table `moparclassic`.`pk_experience` +-- + +DROP TABLE IF EXISTS `moparclassic`.`pk_experience`; CREATE TABLE `moparclassic`.`pk_experience` ( `user` varchar(255) NOT NULL, `exp_attack` int(10) unsigned NOT NULL DEFAULT '0', @@ -278,18 +198,35 @@ CREATE TABLE `moparclassic`.`pk_experience` ( KEY `user` (`user`) ) ENGINE=MyISAM AUTO_INCREMENT=350943 DEFAULT CHARSET=latin1; +-- +-- Definition of table `moparclassic`.`pk_friends` +-- + +DROP TABLE IF EXISTS `moparclassic`.`pk_friends`; CREATE TABLE `moparclassic`.`pk_friends` ( `user` varchar(255) NOT NULL, `friend` varchar(255) NOT NULL, KEY `user` (`user`), KEY `friend` (`friend`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +-- +-- Definition of table `moparclassic`.`pk_ignores` +-- + +DROP TABLE IF EXISTS `moparclassic`.`pk_ignores`; CREATE TABLE `moparclassic`.`pk_ignores` ( `user` varchar(255) NOT NULL, `ignore` varchar(255) NOT NULL, KEY `ignore` (`ignore`), KEY `user` (`user`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +-- +-- Definition of table `moparclassic`.`pk_invitems` +-- + +DROP TABLE IF EXISTS `moparclassic`.`pk_invitems`; CREATE TABLE `moparclassic`.`pk_invitems` ( `user` varchar(255) NOT NULL, `id` int(10) unsigned NOT NULL, @@ -299,17 +236,34 @@ CREATE TABLE `moparclassic`.`pk_invitems` ( KEY `user` (`user`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; +-- +-- Definition of table `moparclassic`.`pk_ipbans` +-- + +DROP TABLE IF EXISTS `moparclassic`.`pk_ipbans`; CREATE TABLE `moparclassic`.`pk_ipbans` ( `ip` varchar(15) NOT NULL, `time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`ip`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; + +-- +-- Definition of table `moparclassic`.`pk_kills` +-- + +DROP TABLE IF EXISTS `moparclassic`.`pk_kills`; CREATE TABLE `moparclassic`.`pk_kills` ( `user` varchar(255) NOT NULL, `type` tinyint(1) NOT NULL DEFAULT '0', `killed` varchar(45) NOT NULL, `time` int(10) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +-- +-- Definition of table `moparclassic`.`pk_logins` +-- + +DROP TABLE IF EXISTS `moparclassic`.`pk_logins`; CREATE TABLE `moparclassic`.`pk_logins` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `user` varchar(45) NOT NULL, @@ -317,8 +271,13 @@ CREATE TABLE `moparclassic`.`pk_logins` ( `ip` varchar(15) NOT NULL DEFAULT '0.0.0.0', PRIMARY KEY (`id`), KEY `ip` (`ip`) -) ENGINE=MyISAM AUTO_INCREMENT=4254489 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC; +) ENGINE=MyISAM AUTO_INCREMENT=4254616 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC; +-- +-- Definition of table `moparclassic`.`pk_market` +-- + +DROP TABLE IF EXISTS `moparclassic`.`pk_market`; CREATE TABLE `moparclassic`.`pk_market` ( `owner` int(10) NOT NULL, `item_id` int(10) NOT NULL, @@ -326,6 +285,12 @@ CREATE TABLE `moparclassic`.`pk_market` ( `selling_price` int(10) NOT NULL, PRIMARY KEY (`owner`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +-- +-- Definition of table `moparclassic`.`pk_mutelog` +-- + +DROP TABLE IF EXISTS `moparclassic`.`pk_mutelog`; CREATE TABLE `moparclassic`.`pk_mutelog` ( `user` varchar(255) NOT NULL, `staff` varchar(255) NOT NULL, @@ -333,6 +298,12 @@ CREATE TABLE `moparclassic`.`pk_mutelog` ( `report_id` int(11) NOT NULL, `duration` int(10) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +-- +-- Definition of table `moparclassic`.`pk_online` +-- + +DROP TABLE IF EXISTS `moparclassic`.`pk_online`; CREATE TABLE `moparclassic`.`pk_online` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `user` varchar(45) NOT NULL, @@ -342,6 +313,12 @@ CREATE TABLE `moparclassic`.`pk_online` ( `world` int(10) unsigned NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC COMMENT='InnoDB free: 9216 kB'; + +-- +-- Definition of table `moparclassic`.`pk_players` +-- + +DROP TABLE IF EXISTS `moparclassic`.`pk_players`; CREATE TABLE `moparclassic`.`pk_players` ( `user` varchar(255) NOT NULL, `username` varchar(255) NOT NULL DEFAULT '', @@ -393,6 +370,11 @@ CREATE TABLE `moparclassic`.`pk_players` ( KEY `user` (`user`) ) ENGINE=MyISAM AUTO_INCREMENT=350944 DEFAULT CHARSET=latin1 COMMENT='InnoDB free: 9216 kB'; +-- +-- Definition of table `moparclassic`.`pk_quests` +-- + +DROP TABLE IF EXISTS `moparclassic`.`pk_quests`; CREATE TABLE `moparclassic`.`pk_quests` ( `id` int(11) DEFAULT NULL, `stage` int(11) DEFAULT NULL, @@ -400,6 +382,11 @@ CREATE TABLE `moparclassic`.`pk_quests` ( KEY `user` (`user`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; +-- +-- Definition of table `moparclassic`.`pk_reports` +-- + +DROP TABLE IF EXISTS `moparclassic`.`pk_reports`; CREATE TABLE `moparclassic`.`pk_reports` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `from` varchar(255) NOT NULL, @@ -418,6 +405,12 @@ CREATE TABLE `moparclassic`.`pk_reports` ( `sendToMod` int(11) DEFAULT '0', PRIMARY KEY (`id`) ) ENGINE=MyISAM AUTO_INCREMENT=4340 DEFAULT CHARSET=latin1; + +-- +-- Definition of table `moparclassic`.`pk_reports_comments` +-- + +DROP TABLE IF EXISTS `moparclassic`.`pk_reports_comments`; CREATE TABLE `moparclassic`.`pk_reports_comments` ( `id` int(10) NOT NULL AUTO_INCREMENT, `report_id` int(10) NOT NULL, @@ -426,6 +419,12 @@ CREATE TABLE `moparclassic`.`pk_reports_comments` ( `text` text NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM AUTO_INCREMENT=4222 DEFAULT CHARSET=latin1; + +-- +-- Definition of table `moparclassic`.`pk_stat_reduction` +-- + +DROP TABLE IF EXISTS `moparclassic`.`pk_stat_reduction`; CREATE TABLE `moparclassic`.`pk_stat_reduction` ( `user` int(10) NOT NULL, `account` varchar(255) NOT NULL, @@ -434,6 +433,12 @@ CREATE TABLE `moparclassic`.`pk_stat_reduction` ( `voucher` varchar(255) DEFAULT NULL, `time` int(11) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +-- +-- Definition of table `moparclassic`.`pk_tradelog` +-- + +DROP TABLE IF EXISTS `moparclassic`.`pk_tradelog`; CREATE TABLE `moparclassic`.`pk_tradelog` ( `from` varchar(255) DEFAULT NULL, `to` varchar(255) DEFAULT NULL, @@ -448,6 +453,11 @@ CREATE TABLE `moparclassic`.`pk_tradelog` ( KEY `tradelog_time` (`time`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; +-- +-- Definition of table `moparclassic`.`pk_worlds` +-- + +DROP TABLE IF EXISTS `moparclassic`.`pk_worlds`; CREATE TABLE `moparclassic`.`pk_worlds` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `location` varchar(45) NOT NULL, @@ -455,182 +465,6 @@ CREATE TABLE `moparclassic`.`pk_worlds` ( `port` varchar(45) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC; -CREATE TABLE `moparclassic`.`posts` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `poster` varchar(200) NOT NULL DEFAULT '', - `poster_id` int(10) unsigned NOT NULL DEFAULT '1', - `poster_ip` varchar(39) DEFAULT NULL, - `poster_email` varchar(80) DEFAULT NULL, - `message` text, - `hide_smilies` tinyint(1) NOT NULL DEFAULT '0', - `posted` int(10) unsigned NOT NULL DEFAULT '0', - `edited` int(10) unsigned DEFAULT NULL, - `edited_by` varchar(200) DEFAULT NULL, - `topic_id` int(10) unsigned NOT NULL DEFAULT '0', - PRIMARY KEY (`id`), - KEY `posts_topic_id_idx` (`topic_id`), - KEY `posts_multi_idx` (`poster_id`,`topic_id`) -) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; - -CREATE TABLE `moparclassic`.`ranks` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `rank` varchar(50) NOT NULL DEFAULT '', - `min_posts` mediumint(8) unsigned NOT NULL DEFAULT '0', - PRIMARY KEY (`id`) -) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=utf8; - -CREATE TABLE `moparclassic`.`reports` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `post_id` int(10) unsigned NOT NULL DEFAULT '0', - `topic_id` int(10) unsigned NOT NULL DEFAULT '0', - `forum_id` int(10) unsigned NOT NULL DEFAULT '0', - `reported_by` int(10) unsigned NOT NULL DEFAULT '0', - `created` int(10) unsigned NOT NULL DEFAULT '0', - `message` text, - `zapped` int(10) unsigned DEFAULT NULL, - `zapped_by` int(10) unsigned DEFAULT NULL, - PRIMARY KEY (`id`), - KEY `reports_zapped_idx` (`zapped`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; -CREATE TABLE `moparclassic`.`reputation` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `user_id` int(10) unsigned NOT NULL DEFAULT '0', - `from_user_id` int(10) unsigned NOT NULL DEFAULT '0', - `time` int(10) unsigned NOT NULL DEFAULT '0', - `post_id` int(10) unsigned NOT NULL DEFAULT '0', - `reason` text NOT NULL, - `rep_plus` tinyint(1) unsigned NOT NULL DEFAULT '0', - `rep_minus` tinyint(1) unsigned NOT NULL DEFAULT '0', - `topics_id` int(10) unsigned NOT NULL DEFAULT '0', - PRIMARY KEY (`id`), - KEY `rep_post_id_idx` (`post_id`), - KEY `rep_multi_user_id_idx` (`topics_id`,`from_user_id`) -) ENGINE=MyISAM AUTO_INCREMENT=15940 DEFAULT CHARSET=latin1; -CREATE TABLE `moparclassic`.`search_cache` ( - `id` int(10) unsigned NOT NULL DEFAULT '0', - `ident` varchar(200) NOT NULL DEFAULT '', - `search_data` mediumtext, - PRIMARY KEY (`id`), - KEY `search_cache_ident_idx` (`ident`(8)) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; -CREATE TABLE `moparclassic`.`search_matches` ( - `post_id` int(10) unsigned NOT NULL DEFAULT '0', - `word_id` int(10) unsigned NOT NULL DEFAULT '0', - `subject_match` tinyint(1) NOT NULL DEFAULT '0', - KEY `search_matches_word_id_idx` (`word_id`), - KEY `search_matches_post_id_idx` (`post_id`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - -CREATE TABLE `moparclassic`.`search_words` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `word` varchar(20) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '', - PRIMARY KEY (`word`), - KEY `search_words_id_idx` (`id`) -) ENGINE=MyISAM AUTO_INCREMENT=16 DEFAULT CHARSET=utf8; - -CREATE TABLE `moparclassic`.`stats` ( - `date` int(10) unsigned NOT NULL DEFAULT '0', - `posts` varchar(255) NOT NULL DEFAULT '', - `users` varchar(255) NOT NULL DEFAULT '', - `players` varchar(255) NOT NULL DEFAULT '', - `active_users` varchar(255) NOT NULL DEFAULT '', - `active_players` varchar(255) NOT NULL DEFAULT '', - `topics` varchar(255) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1; -CREATE TABLE `moparclassic`.`stats_2` ( - `logins` int(5) DEFAULT NULL, - `unique_logins` int(5) DEFAULT NULL, - `updated` int(11) DEFAULT NULL, - `hits` int(5) DEFAULT NULL, - `unique_hits` int(5) DEFAULT NULL, - `alexa_rank` int(5) DEFAULT NULL, - `kills` int(5) DEFAULT NULL, - `total_kills` int(5) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1; -CREATE TABLE `moparclassic`.`subs` ( - `user_id` int(10) DEFAULT NULL, - `months` int(10) DEFAULT NULL, - `google_no` varchar(255) DEFAULT NULL, - `redeem` int(10) DEFAULT NULL, - `status` int(5) DEFAULT NULL, - `order_time` int(10) DEFAULT NULL, - `last_time` int(10) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1; -CREATE TABLE `moparclassic`.`subscriptions` ( - `user_id` int(10) unsigned NOT NULL DEFAULT '0', - `topic_id` int(10) unsigned NOT NULL DEFAULT '0', - `forum_id` int(10) unsigned NOT NULL DEFAULT '0', - PRIMARY KEY (`user_id`,`topic_id`,`forum_id`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; -CREATE TABLE `moparclassic`.`topics` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `poster` varchar(200) NOT NULL DEFAULT '', - `subject` varchar(255) NOT NULL DEFAULT '', - `posted` int(10) unsigned NOT NULL DEFAULT '0', - `first_post_id` int(10) unsigned NOT NULL DEFAULT '0', - `last_post` int(10) unsigned NOT NULL DEFAULT '0', - `last_post_id` int(10) unsigned NOT NULL DEFAULT '0', - `last_poster` varchar(200) DEFAULT NULL, - `num_views` mediumint(8) unsigned NOT NULL DEFAULT '0', - `num_replies` mediumint(8) unsigned NOT NULL DEFAULT '0', - `closed` tinyint(1) NOT NULL DEFAULT '0', - `sticky` tinyint(1) NOT NULL DEFAULT '0', - `moved_to` int(10) unsigned DEFAULT NULL, - `forum_id` int(10) unsigned NOT NULL DEFAULT '0', - PRIMARY KEY (`id`), - KEY `topics_forum_id_idx` (`forum_id`), - KEY `topics_moved_to_idx` (`moved_to`), - KEY `topics_last_post_idx` (`last_post`), - KEY `topics_first_post_id_idx` (`first_post_id`) -) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; - -CREATE TABLE `moparclassic`.`users` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `group_id` int(10) unsigned NOT NULL DEFAULT '3', - `username` varchar(200) NOT NULL DEFAULT '', - `password` varchar(40) NOT NULL DEFAULT '', - `email` varchar(80) NOT NULL DEFAULT '', - `title` varchar(50) DEFAULT NULL, - `realname` varchar(40) DEFAULT NULL, - `url` varchar(100) DEFAULT NULL, - `jabber` varchar(80) DEFAULT NULL, - `icq` varchar(12) DEFAULT NULL, - `msn` varchar(80) DEFAULT NULL, - `aim` varchar(30) DEFAULT NULL, - `yahoo` varchar(30) DEFAULT NULL, - `location` varchar(30) DEFAULT NULL, - `signature` text, - `disp_topics` tinyint(3) unsigned DEFAULT NULL, - `disp_posts` tinyint(3) unsigned DEFAULT NULL, - `email_setting` tinyint(1) NOT NULL DEFAULT '1', - `notify_with_post` tinyint(1) NOT NULL DEFAULT '0', - `auto_notify` tinyint(1) NOT NULL DEFAULT '0', - `show_smilies` tinyint(1) NOT NULL DEFAULT '1', - `show_img` tinyint(1) NOT NULL DEFAULT '1', - `show_img_sig` tinyint(1) NOT NULL DEFAULT '1', - `show_avatars` tinyint(1) NOT NULL DEFAULT '1', - `show_sig` tinyint(1) NOT NULL DEFAULT '1', - `timezone` float NOT NULL DEFAULT '0', - `dst` tinyint(1) NOT NULL DEFAULT '0', - `time_format` tinyint(1) NOT NULL DEFAULT '0', - `date_format` tinyint(1) NOT NULL DEFAULT '0', - `language` varchar(25) NOT NULL DEFAULT 'English', - `style` varchar(25) NOT NULL DEFAULT 'Air', - `num_posts` int(10) unsigned NOT NULL DEFAULT '0', - `last_post` int(10) unsigned DEFAULT NULL, - `last_search` int(10) unsigned DEFAULT NULL, - `last_email_sent` int(10) unsigned DEFAULT NULL, - `registered` int(10) unsigned NOT NULL DEFAULT '0', - `registration_ip` varchar(39) NOT NULL DEFAULT '0.0.0.0', - `last_visit` int(10) unsigned NOT NULL DEFAULT '0', - `admin_note` varchar(30) DEFAULT NULL, - `activate_string` varchar(80) DEFAULT NULL, - `activate_key` varchar(8) DEFAULT NULL, - `sub_expires` int(10) unsigned DEFAULT '0', - PRIMARY KEY (`id`), - UNIQUE KEY `users_username_idx` (`username`(25)), - KEY `users_registered_idx` (`registered`) -) ENGINE=MyISAM AUTO_INCREMENT=4 DEFAULT CHARSET=utf8; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; diff --git a/LoginServer/logs/err.log b/LoginServer/logs/err.log index d04e2a2..e69de29 100644 --- a/LoginServer/logs/err.log +++ b/LoginServer/logs/err.log @@ -1,96 +0,0 @@ -16:42:16 21-07-11: 98042 [SocketAcceptorIoProcessor-0.1] INFO org.moparscape.msc.gs.connection.RSCConnectionHandler - [/127.0.0.1:56013] Remote address in the blacklist; closing. - -16:42:16 21-07-11: 98042 [SocketAcceptorIoProcessor-0.1] INFO org.moparscape.msc.gs.connection.RSCConnectionHandler - [/127.0.0.1:56013] Remote address in the blacklist; closing. - -16:42:16 21-07-11: 98043 [SocketAcceptorIoProcessor-0.1] INFO org.moparscape.msc.gs.connection.RSCConnectionHandler - [/127.0.0.1:56013] Remote address in the blacklist; closing. - -16:42:18 21-07-11: 99678 [SocketAcceptorIoProcessor-0.2] INFO org.moparscape.msc.gs.connection.RSCConnectionHandler - [/127.0.0.1:56014] Remote address in the blacklist; closing. - -16:42:18 21-07-11: 99679 [SocketAcceptorIoProcessor-0.2] INFO org.moparscape.msc.gs.connection.RSCConnectionHandler - [/127.0.0.1:56014] Remote address in the blacklist; closing. - -16:44:24 21-07-11: 29594 [SocketAcceptorIoProcessor-0.1] INFO org.moparscape.msc.gs.connection.RSCConnectionHandler - [/127.0.0.1:38801] Remote address in the blacklist; closing. - -16:44:24 21-07-11: 29594 [SocketAcceptorIoProcessor-0.1] INFO org.moparscape.msc.gs.connection.RSCConnectionHandler - [/127.0.0.1:38801] Remote address in the blacklist; closing. - -16:44:24 21-07-11: 29595 [SocketAcceptorIoProcessor-0.1] INFO org.moparscape.msc.gs.connection.RSCConnectionHandler - [/127.0.0.1:38801] Remote address in the blacklist; closing. - -17:07:37 21-07-11: 1422061 [SocketAcceptorIoProcessor-0.2] INFO org.moparscape.msc.gs.connection.RSCConnectionHandler - [/127.0.0.1:44822] Remote address in the blacklist; closing. - -17:07:37 21-07-11: 1422065 [SocketAcceptorIoProcessor-0.2] INFO org.moparscape.msc.gs.connection.RSCConnectionHandler - [/127.0.0.1:44822] Remote address in the blacklist; closing. - -17:07:38 21-07-11: 1423046 [SocketAcceptorIoProcessor-0.3] INFO org.moparscape.msc.gs.connection.RSCConnectionHandler - [/127.0.0.1:44823] Remote address in the blacklist; closing. - -17:07:38 21-07-11: 1423046 [SocketAcceptorIoProcessor-0.3] INFO org.moparscape.msc.gs.connection.RSCConnectionHandler - [/127.0.0.1:44823] Remote address in the blacklist; closing. - -17:07:38 21-07-11: 1423047 [SocketAcceptorIoProcessor-0.3] INFO org.moparscape.msc.gs.connection.RSCConnectionHandler - [/127.0.0.1:44823] Remote address in the blacklist; closing. - -17:07:50 21-07-11: 1434937 [SocketAcceptorIoProcessor-0.4] INFO org.moparscape.msc.gs.connection.RSCConnectionHandler - [/127.0.0.1:44824] Remote address in the blacklist; closing. - -17:07:50 21-07-11: 1434938 [SocketAcceptorIoProcessor-0.4] INFO org.moparscape.msc.gs.connection.RSCConnectionHandler - [/127.0.0.1:44824] Remote address in the blacklist; closing. - -17:12:42 21-07-11: 23771 [SocketAcceptorIoProcessor-0.1] INFO org.moparscape.msc.gs.connection.RSCConnectionHandler - [/127.0.0.1:51126] Remote address in the blacklist; closing. - -17:12:42 21-07-11: 23771 [SocketAcceptorIoProcessor-0.1] INFO org.moparscape.msc.gs.connection.RSCConnectionHandler - [/127.0.0.1:51126] Remote address in the blacklist; closing. - -17:12:42 21-07-11: 23772 [SocketAcceptorIoProcessor-0.1] INFO org.moparscape.msc.gs.connection.RSCConnectionHandler - [/127.0.0.1:51126] Remote address in the blacklist; closing. - -17:16:06 21-07-11: 228206 [SocketAcceptorIoProcessor-0.2] INFO org.moparscape.msc.gs.connection.RSCConnectionHandler - [/127.0.0.1:57276] Remote address in the blacklist; closing. - -17:16:06 21-07-11: 228215 [SocketAcceptorIoProcessor-0.2] INFO org.moparscape.msc.gs.connection.RSCConnectionHandler - [/127.0.0.1:57276] Remote address in the blacklist; closing. - -17:18:43 21-07-11: 58789 [SocketAcceptorIoProcessor-0.1] INFO org.moparscape.msc.gs.connection.RSCConnectionHandler - [/127.0.0.1:57290] Remote address in the blacklist; closing. - -17:18:43 21-07-11: 58789 [SocketAcceptorIoProcessor-0.1] INFO org.moparscape.msc.gs.connection.RSCConnectionHandler - [/127.0.0.1:57290] Remote address in the blacklist; closing. - -17:18:43 21-07-11: 58790 [SocketAcceptorIoProcessor-0.1] INFO org.moparscape.msc.gs.connection.RSCConnectionHandler - [/127.0.0.1:57290] Remote address in the blacklist; closing. - -17:25:03 21-07-11: 31491 [SocketAcceptorIoProcessor-0.1] INFO org.moparscape.msc.gs.connection.RSCConnectionHandler - [/127.0.0.1:55779] Remote address in the blacklist; closing. - -17:25:03 21-07-11: 31491 [SocketAcceptorIoProcessor-0.1] INFO org.moparscape.msc.gs.connection.RSCConnectionHandler - [/127.0.0.1:55779] Remote address in the blacklist; closing. - -17:25:03 21-07-11: 31492 [SocketAcceptorIoProcessor-0.1] INFO org.moparscape.msc.gs.connection.RSCConnectionHandler - [/127.0.0.1:55779] Remote address in the blacklist; closing. - -17:28:41 21-07-11: 249783 [SocketAcceptorIoProcessor-0.3] INFO org.moparscape.msc.gs.connection.RSCConnectionHandler - [/127.0.0.1:55858] Remote address in the blacklist; closing. - -17:28:41 21-07-11: 249783 [SocketAcceptorIoProcessor-0.3] INFO org.moparscape.msc.gs.connection.RSCConnectionHandler - [/127.0.0.1:55858] Remote address in the blacklist; closing. - -17:28:41 21-07-11: 249784 [SocketAcceptorIoProcessor-0.3] INFO org.moparscape.msc.gs.connection.RSCConnectionHandler - [/127.0.0.1:55858] Remote address in the blacklist; closing. - -17:28:43 21-07-11: 251317 [SocketAcceptorIoProcessor-0.4] INFO org.moparscape.msc.gs.connection.RSCConnectionHandler - [/127.0.0.1:55859] Remote address in the blacklist; closing. - -17:28:43 21-07-11: 251318 [SocketAcceptorIoProcessor-0.4] INFO org.moparscape.msc.gs.connection.RSCConnectionHandler - [/127.0.0.1:55859] Remote address in the blacklist; closing. - -17:28:43 21-07-11: 252004 [SocketAcceptorIoProcessor-0.0] INFO org.moparscape.msc.gs.connection.RSCConnectionHandler - [/127.0.0.1:55860] Remote address in the blacklist; closing. - -17:28:43 21-07-11: 252005 [SocketAcceptorIoProcessor-0.0] INFO org.moparscape.msc.gs.connection.RSCConnectionHandler - [/127.0.0.1:55860] Remote address in the blacklist; closing. - -17:38:08 21-07-11: 328092 [SocketAcceptorIoProcessor-0.4] INFO org.moparscape.msc.gs.connection.RSCConnectionHandler - [/127.0.0.1:58598] Remote address in the blacklist; closing. - -17:38:08 21-07-11: 328092 [SocketAcceptorIoProcessor-0.4] INFO org.moparscape.msc.gs.connection.RSCConnectionHandler - [/127.0.0.1:58598] Remote address in the blacklist; closing. - -17:38:08 21-07-11: 328093 [SocketAcceptorIoProcessor-0.4] INFO org.moparscape.msc.gs.connection.RSCConnectionHandler - [/127.0.0.1:58598] Remote address in the blacklist; closing. - -17:46:48 21-07-11: 20397 [SocketAcceptorIoProcessor-0.4] INFO org.moparscape.msc.gs.connection.RSCConnectionHandler - [/127.0.0.1:56380] Remote address in the blacklist; closing. - -17:46:48 21-07-11: 20397 [SocketAcceptorIoProcessor-0.4] INFO org.moparscape.msc.gs.connection.RSCConnectionHandler - [/127.0.0.1:56380] Remote address in the blacklist; closing. - -17:46:48 21-07-11: 20398 [SocketAcceptorIoProcessor-0.4] INFO org.moparscape.msc.gs.connection.RSCConnectionHandler - [/127.0.0.1:56380] Remote address in the blacklist; closing. - -17:46:56 21-07-11: 27810 [SocketAcceptorIoProcessor-0.0] INFO org.moparscape.msc.gs.connection.RSCConnectionHandler - [/127.0.0.1:56381] Remote address in the blacklist; closing. - -17:46:56 21-07-11: 27811 [SocketAcceptorIoProcessor-0.0] INFO org.moparscape.msc.gs.connection.RSCConnectionHandler - [/127.0.0.1:56381] Remote address in the blacklist; closing. - -17:49:39 21-07-11: 191174 [SocketAcceptorIoProcessor-0.1] INFO org.moparscape.msc.gs.connection.RSCConnectionHandler - [/127.0.0.1:47775] Remote address in the blacklist; closing. - -17:49:39 21-07-11: 191176 [SocketAcceptorIoProcessor-0.1] INFO org.moparscape.msc.gs.connection.RSCConnectionHandler - [/127.0.0.1:47775] Remote address in the blacklist; closing. - -17:50:18 21-07-11: 230515 [SocketAcceptorIoProcessor-0.0] INFO org.moparscape.msc.gs.connection.RSCConnectionHandler - [/127.0.0.1:47785] Remote address in the blacklist; closing. - -17:50:18 21-07-11: 230516 [SocketAcceptorIoProcessor-0.0] INFO org.moparscape.msc.gs.connection.RSCConnectionHandler - [/127.0.0.1:47785] Remote address in the blacklist; closing. - -18:01:12 21-07-11: 75002 [SocketAcceptorIoProcessor-0.4] INFO org.moparscape.msc.gs.connection.RSCConnectionHandler - [/127.0.0.1:43808] Remote address in the blacklist; closing. - -18:01:12 21-07-11: 75002 [SocketAcceptorIoProcessor-0.4] INFO org.moparscape.msc.gs.connection.RSCConnectionHandler - [/127.0.0.1:43808] Remote address in the blacklist; closing. - -18:01:12 21-07-11: 75004 [SocketAcceptorIoProcessor-0.4] INFO org.moparscape.msc.gs.connection.RSCConnectionHandler - [/127.0.0.1:43808] Remote address in the blacklist; closing. - diff --git a/LoginServer/src/org/moparscape/msc/ls/model/PlayerSave.java b/LoginServer/src/org/moparscape/msc/ls/model/PlayerSave.java index 186c9ea..5005f2c 100644 --- a/LoginServer/src/org/moparscape/msc/ls/model/PlayerSave.java +++ b/LoginServer/src/org/moparscape/msc/ls/model/PlayerSave.java @@ -8,534 +8,592 @@ import java.util.HashMap; import org.moparscape.msc.ls.Server; import org.moparscape.msc.ls.util.DataConversions; - public class PlayerSave { - public static final String[] statArray = { "attack", "defense", "strength", - "hits", "ranged", "prayer", "magic", "cooking", "woodcut", "fletching", "fishing", - "firemaking", "crafting", "smithing", "mining", "herblaw", "agility", "thieving" }; - - public static PlayerSave loadPlayer(long user) { - PlayerSave save = new PlayerSave(user); - ResultSet result; - - try { - result = Server.db.getQuery("SELECT r.*, u.username AS owner_username, u.group_id as gid, u.sub_expires as subexp FROM `pk_players` AS r INNER JOIN `users` AS u ON u.id=r.owner WHERE `user`='" + save.getUser() + "'"); - if (!result.next()) { - return save; - } - - long eventcd = result.getLong("eventcd"); - @SuppressWarnings("unused") - int subexp = result.getInt("subexp"); - @SuppressWarnings("unused") - long now = System.currentTimeMillis() / 1000; - int sowner = result.getInt("owner"); - if (result.getInt("gid") == 8) { - save.setOwner(sowner, Integer.parseInt("5"), result.getLong("subexp")); - } else { - save.setOwner(sowner, result.getInt("group_id"), result.getLong("subexp")); - } - save.setMuted(result.getLong("muted")); - /* - * if(subexp - now < 1) { - * Server.db.updateQuery("UPDATE users SET group_id='4' WHERE `id`='" - * + sowner + "'"); save.setOwner(sowner, 0, - * result.getLong("subexp")); } - */ - - save.setLogin(result.getLong("login_date"), DataConversions.IPToLong(result.getString("login_ip"))); - save.setLocation(result.getInt("x"), result.getInt("y")); - - save.setFatigue(result.getInt("fatigue")); - save.setCombatStyle((byte) result.getInt("combatstyle")); - - save.setPrivacy(result.getInt("block_chat") == 1, result.getInt("block_private") == 1, result.getInt("block_trade") == 1, result.getInt("block_duel") == 1); - save.setSettings(result.getInt("cameraauto") == 1, result.getInt("onemouse") == 1, result.getInt("soundoff") == 1, result.getInt("showroof") == 1, result.getInt("autoscreenshot") == 1, result.getInt("combatwindow") == 1); - - save.setAppearance((byte) result.getInt("haircolour"), (byte) result.getInt("topcolour"), (byte) result.getInt("trousercolour"), (byte) result.getInt("skincolour"), (byte) result.getInt("headsprite"), (byte) result.getInt("bodysprite"), result.getInt("male") == 1, result.getInt("skulled")); - - save.setQuestPoints(result.getInt("quest_points")); - - - result = Server.db.getQuery("SELECT * FROM `pk_experience` WHERE `user`='" + save.getUser() + "'"); - if (!result.next()) { - return save; - } - for (int i = 0; i < 18; i++) { - save.setExp(i, result.getInt("exp_" + statArray[i])); - } - - result = Server.db.getQuery("SELECT * FROM `pk_curstats` WHERE `user`='" + save.getUser() + "'"); - if (!result.next()) { - return save; - } - for (int i = 0; i < 18; i++) { - save.setLvl(i, result.getInt("cur_" + statArray[i])); - } - - result = Server.db.getQuery("SELECT id,amount,wielded FROM `pk_invitems` WHERE `user`='" + save.getUser() + "' ORDER BY `slot` ASC"); - while (result.next()) { - save.addInvItem(result.getInt("id"), result.getInt("amount"), result.getInt("wielded") == 1); - } - - result = Server.db.getQuery("SELECT id,amount FROM `pk_bank` WHERE `user`='" + save.getUser() + "' ORDER BY `slot` ASC"); - while (result.next()) { - save.addBankItem(result.getInt("id"), result.getInt("amount")); - } - - result = Server.db.getQuery("SELECT friend FROM `pk_friends` WHERE `user`='" + save.getUser() + "'"); - while (result.next()) { - save.addFriend(result.getLong("friend")); - } - - result = Server.db.getQuery("SELECT `ignore` FROM `pk_ignores` WHERE `user`='" + save.getUser() + "'"); - while (result.next()) { - save.addIgnore(result.getLong("ignore")); - } - result = Server.db.getQuery("SELECT * FROM `pk_quests` WHERE `user`='" + save.getUser() + "'"); - while (result.next()) { - save.setQuestStage(result.getInt("id"), result.getInt("stage")); - } - save.setEventCD(eventcd); - - - } catch (SQLException e) { - Server.error("SQL Exception Loading " + DataConversions.hashToUsername(user) + ": " + e.getMessage()); - } - - return save; - } - private long eventcd = 0; - private long muted; - private ArrayList bankItems = new ArrayList(); - private boolean blockChat, blockPrivate, blockTrade, blockDuel; - private boolean cameraAuto, oneMouse, soundOff, showRoof, autoScreenshot, combatWindow; - private int combat, skillTotal; - private byte combatStyle; - private long[] exp = new long[18]; - private int fatigue; - private ArrayList friendList = new ArrayList(); - private byte hairColour, topColour, trouserColour, skinColour, headSprite, bodySprite; - - private ArrayList ignoreList = new ArrayList(); - private ArrayList invItems = new ArrayList(); - private long lastUpdate = 0; - private long loginDate, loginIP; - private int[] lvl = new int[18]; - private boolean male; - private int owner, group; - private int questPoints; - private HashMap questStage = new HashMap(); - private long skulled; - private long subExpires; - private long user; - - private int x, y; - - private PlayerSave(long user) { - this.user = user; - } - - public void addBankItem(int id, int amount) { - bankItems.add(new BankItem(id, amount)); - } - - public void addFriend(long friend) { - friendList.add(friend); - } - - public void addIgnore(long friend) { - ignoreList.add(friend); - } - - public void addInvItem(int id, int amount, boolean wielded) { - invItems.add(new InvItem(id, amount, wielded)); - } - - public boolean autoScreenshot() { - return autoScreenshot; - } - - public boolean blockChat() { - return blockChat; - } - - public boolean blockDuel() { - return blockDuel; - } - - public boolean blockPrivate() { - return blockPrivate; - } - - public boolean blockTrade() { - return blockTrade; - } - - public boolean cameraAuto() { - return cameraAuto; - } - - public void clearBankItems() { - bankItems.clear(); - } - - public void clearInvItems() { - invItems.clear(); - } - - public void clearQuestStages() { - questStage.clear(); - } - - public boolean combatWindow() { - return combatWindow; - } - - public int getBankCount() { - return bankItems.size(); - } - - public BankItem getBankItem(int i) { - return bankItems.get(i); - } - - public int getBodySprite() { - return bodySprite; - } - - public byte getCombatStyle() { - return combatStyle; - } - - public long getExp(int i) { - return exp[i]; - } - - public int getFatigue() { - return fatigue; - } - - public long getFriend(int i) { - return friendList.get(i); - } - - public int getFriendCount() { - return friendList.size(); - } - - public int getGroup() { - return group; - } - - public int getHairColour() { - return hairColour; - } - - public int getHeadSprite() { - return headSprite; - } - - public long getIgnore(int i) { - return ignoreList.get(i); - } - - public int getIgnoreCount() { - return ignoreList.size(); - } - - public int getInvCount() { - return invItems.size(); - } - - public InvItem getInvItem(int i) { - return invItems.get(i); - } - - public long getLastIP() { - return loginIP; - } - - public long getLastLogin() { - return loginDate; - } - - public long getLastUpdate() { - return lastUpdate; - } - - public int getOwner() { - return owner; - } - - public int getQuestPoints() { - return questPoints; - } - - public int getQuestStage(int id) { - return questStage.get(id); - } - - public HashMap getQuestStages() { - return questStage; - } - - public int getSkinColour() { - return skinColour; - } - - public long getSkullTime() { - return skulled; - } - - public int getStat(int i) { - return lvl[i]; - } - - public long getSubscriptionExpires() { - return subExpires; - } - - public int getTopColour() { - return topColour; - } - - public int getTrouserColour() { - return trouserColour; - } - - public long getUser() { - return user; - } - - public String getUsername() { - return DataConversions.hashToUsername(user); - } - - public int getX() { - return x; - } - - public int getY() { - return y; - } - - public boolean isMale() { - return male; - } - - public boolean oneMouse() { - return oneMouse; - } - - public void removeFriend(long friend) { - friendList.remove(friend); - } - - public void removeIgnore(long friend) { - ignoreList.remove(friend); - } - - public boolean save() { - try { - String query; - - Server.db.updateQuery("DELETE FROM `pk_bank` WHERE `user`='" + user + "'"); - if (bankItems.size() > 0) { - query = "INSERT INTO `pk_bank`(`user`, `id`, `amount`, `slot`) VALUES"; - int slot = 0; - for (BankItem item : bankItems) { - query += "('" + user + "', '" + item.getID() + "', '" + item.getAmount() + "', '" + (slot++) + "'),"; + public static final String[] statArray = { "attack", "defense", "strength", + "hits", "ranged", "prayer", "magic", "cooking", "woodcut", + "fletching", "fishing", "firemaking", "crafting", "smithing", + "mining", "herblaw", "agility", "thieving" }; + + public static PlayerSave loadPlayer(long user) { + PlayerSave save = new PlayerSave(user); + ResultSet result; + + try { + result = Server.db + .getQuery("SELECT * FROM `pk_players` WHERE `user`='" + + save.getUser() + "'"); + if (!result.next()) { + return save; + } + + long eventcd = result.getLong("eventcd"); + long subexp = result.getLong("sub_expires"); + @SuppressWarnings("unused") + long now = System.currentTimeMillis() / 1000; + int sowner = result.getInt("owner"); + save.setOwner(sowner, result.getInt("group_id"), subexp); + save.setMuted(result.getLong("muted")); + /* + * if(subexp - now < 1) { + * Server.db.updateQuery("UPDATE users SET group_id='4' WHERE `id`='" + * + sowner + "'"); save.setOwner(sowner, 0, + * result.getLong("subexp")); } + */ + + save.setLogin(result.getLong("login_date"), + DataConversions.IPToLong(result.getString("login_ip"))); + save.setLocation(result.getInt("x"), result.getInt("y")); + + save.setFatigue(result.getInt("fatigue")); + save.setCombatStyle((byte) result.getInt("combatstyle")); + + save.setPrivacy(result.getInt("block_chat") == 1, + result.getInt("block_private") == 1, + result.getInt("block_trade") == 1, + result.getInt("block_duel") == 1); + save.setSettings(result.getInt("cameraauto") == 1, + result.getInt("onemouse") == 1, + result.getInt("soundoff") == 1, + result.getInt("showroof") == 1, + result.getInt("autoscreenshot") == 1, + result.getInt("combatwindow") == 1); + + save.setAppearance((byte) result.getInt("haircolour"), + (byte) result.getInt("topcolour"), + (byte) result.getInt("trousercolour"), + (byte) result.getInt("skincolour"), + (byte) result.getInt("headsprite"), + (byte) result.getInt("bodysprite"), + result.getInt("male") == 1, result.getInt("skulled")); + + save.setQuestPoints(result.getInt("quest_points")); + + result = Server.db + .getQuery("SELECT * FROM `pk_experience` WHERE `user`='" + + save.getUser() + "'"); + if (!result.next()) { + return save; + } + for (int i = 0; i < 18; i++) { + save.setExp(i, result.getInt("exp_" + statArray[i])); + } + + result = Server.db + .getQuery("SELECT * FROM `pk_curstats` WHERE `user`='" + + save.getUser() + "'"); + if (!result.next()) { + return save; + } + for (int i = 0; i < 18; i++) { + save.setLvl(i, result.getInt("cur_" + statArray[i])); + } + + result = Server.db + .getQuery("SELECT id,amount,wielded FROM `pk_invitems` WHERE `user`='" + + save.getUser() + "' ORDER BY `slot` ASC"); + while (result.next()) { + save.addInvItem(result.getInt("id"), result.getInt("amount"), + result.getInt("wielded") == 1); + } + + result = Server.db + .getQuery("SELECT id,amount FROM `pk_bank` WHERE `user`='" + + save.getUser() + "' ORDER BY `slot` ASC"); + while (result.next()) { + save.addBankItem(result.getInt("id"), result.getInt("amount")); + } + + result = Server.db + .getQuery("SELECT friend FROM `pk_friends` WHERE `user`='" + + save.getUser() + "'"); + while (result.next()) { + save.addFriend(result.getLong("friend")); + } + + result = Server.db + .getQuery("SELECT `ignore` FROM `pk_ignores` WHERE `user`='" + + save.getUser() + "'"); + while (result.next()) { + save.addIgnore(result.getLong("ignore")); + } + result = Server.db + .getQuery("SELECT * FROM `pk_quests` WHERE `user`='" + + save.getUser() + "'"); + while (result.next()) { + save.setQuestStage(result.getInt("id"), result.getInt("stage")); + } + save.setEventCD(eventcd); + + } catch (SQLException e) { + Server.error("SQL Exception Loading " + + DataConversions.hashToUsername(user) + ": " + + e.getMessage()); } - Server.db.updateQuery(query.substring(0, query.length() - 1)); - } - Server.db.updateQuery("DELETE FROM `pk_invitems` WHERE `user`='" + user + "'"); - - ResultSet result = Server.db.getQuery("Select 1 FROM `pk_players` WHERE `user`='" + user + "' AND `owner`='" + owner + "'"); - if (!result.next()) - return false; - - Server.db.updateQuery("UPDATE `pk_players` SET `combat`=" + combat + ", skill_total=" + skillTotal + ", `x`=" + x + ", `y`='" + y + "', `fatigue`='" + fatigue + "', `haircolour`=" + hairColour + ", `topcolour`=" + topColour + ", `trousercolour`=" + trouserColour + ", `skincolour`=" + skinColour + ", `headsprite`=" + headSprite + ", `bodysprite`=" + bodySprite + ", `male`=" + (male ? 1 : 0) + ", `skulled`=" + skulled + ", `combatstyle`=" + combatStyle + ", `quest_points`=" + questPoints + " WHERE `user`='" + user + "'"); - - query = "UPDATE `pk_experience` SET "; - for (int i = 0; i < 18; i++) - query += "`exp_" + statArray[i] + "`=" + exp[i] + ","; - - Server.db.updateQuery(query.substring(0, query.length() - 1) + " WHERE `user`='" + user + "'"); - - query = "UPDATE `pk_curstats` SET "; - for (int i = 0; i < 18; i++) - query += "`cur_" + statArray[i] + "`=" + lvl[i] + ","; - - Server.db.updateQuery(query.substring(0, query.length() - 1) + " WHERE `user`='" + user + "'"); - - if (invItems.size() > 0) { - query = "INSERT INTO `pk_invitems`(`user`, `id`, `amount`, `wielded`, `slot`) VALUES"; - int slot = 0; - for (InvItem item : invItems) - query += "('" + user + "', '" + item.getID() + "', '" + item.getAmount() + "', '" + (item.isWielded() ? 1 : 0) + "', '" + (slot++) + "'),"; - - Server.db.updateQuery(query.substring(0, query.length() - 1)); - } - - Server.db.updateQuery("DELETE FROM `pk_quests` WHERE `user`='" + user + "'"); - query = "INSERT INTO `pk_quests` (`user`, `id`, `stage`) VALUES"; - java.util.Set keys = questStage.keySet(); - for (int id : keys) - query += "('" + user + "', '" + id + "', '" + questStage.get(id) + "'),"; - - Server.db.updateQuery(query.substring(0, query.length() - 1)); - - Server.db.updateQuery("UPDATE `pk_players` SET eventcd='" + getEventCD() + "' WHERE user='" + user + "'"); - - return true; - } catch (SQLException e) { - Server.error(e); - return false; + return save; } - } - public void setAppearance(byte hairColour, byte topColour, byte trouserColour, byte skinColour, byte headSprite, byte bodySprite, boolean male, long skulled) { - this.hairColour = hairColour; - this.topColour = topColour; - this.trouserColour = trouserColour; - this.skinColour = skinColour; - this.headSprite = headSprite; - this.bodySprite = bodySprite; - this.male = male; - this.skulled = skulled; - } + private long eventcd = 0; + private long muted; + private ArrayList bankItems = new ArrayList(); + private boolean blockChat, blockPrivate, blockTrade, blockDuel; + private boolean cameraAuto, oneMouse, soundOff, showRoof, autoScreenshot, + combatWindow; + private int combat, skillTotal; + private byte combatStyle; + private long[] exp = new long[18]; + private int fatigue; + private ArrayList friendList = new ArrayList(); + private byte hairColour, topColour, trouserColour, skinColour, headSprite, + bodySprite; - public void setCombatStyle(byte combatStyle) { - this.combatStyle = combatStyle; - } + private ArrayList ignoreList = new ArrayList(); + private ArrayList invItems = new ArrayList(); + private long lastUpdate = 0; + private long loginDate, loginIP; + private int[] lvl = new int[18]; + private boolean male; + private int owner, group; + private int questPoints; + private HashMap questStage = new HashMap(); + private long skulled; + private long subExpires; + private long user; - public void setExp(int stat, long exp) { - this.exp[stat] = exp; - } + private int x, y; - public void setFatigue(int fatigue) { - this.fatigue = fatigue; - } - - public void setEventCD(long eventcd) { - this.eventcd = eventcd; - } - - public long getEventCD() { - return eventcd; - } - - public void setGameSetting(int idx, boolean on) { - switch (idx) { - case 0: - cameraAuto = on; - break; - case 2: - oneMouse = on; - break; - case 3: - soundOff = on; - break; - case 4: - showRoof = on; - break; - case 5: - autoScreenshot = on; - break; - case 6: - combatWindow = on; - break; + private PlayerSave(long user) { + this.user = user; } - } - public void setLastUpdate(long lastUpdate) { - this.lastUpdate = lastUpdate; - } - - public void setLocation(int x, int y) { - this.x = x; - this.y = y; - } - - public void setLogin(long loginDate, long loginIP) { - this.loginDate = loginDate; - this.loginIP = loginIP; - } - - public void setLvl(int stat, int lvl) { - this.lvl[stat] = lvl; - } - - public void setOwner(int owner) { - this.owner = owner; - } - - public void setOwner(int owner, int group, long subExpires) { - this.owner = owner; - this.group = group; - this.subExpires = subExpires; - } - - public void setPrivacy(boolean blockChat, boolean blockPrivate, boolean blockTrade, boolean blockDuel) { - this.blockChat = blockChat; - this.blockPrivate = blockPrivate; - this.blockTrade = blockTrade; - this.blockDuel = blockDuel; - } - - public void setPrivacySetting(int idx, boolean on) { - switch (idx) { - case 0: - blockChat = on; - break; - case 1: - blockPrivate = on; - break; - case 2: - blockTrade = on; - break; - case 3: - blockDuel = on; - break; + public void addBankItem(int id, int amount) { + bankItems.add(new BankItem(id, amount)); } - } - public void setQuestPoints(int i) { - questPoints = i; - } + public void addFriend(long friend) { + friendList.add(friend); + } - public void setQuestStage(int index, int stage) { - questStage.put(index, stage); - } + public void addIgnore(long friend) { + ignoreList.add(friend); + } - public void setSettings(boolean cameraAuto, boolean oneMouse, boolean soundOff, boolean showRoof, boolean autoScreenshot, boolean combatWindow) { - this.cameraAuto = cameraAuto; - this.oneMouse = oneMouse; - this.soundOff = soundOff; - this.showRoof = showRoof; - this.autoScreenshot = autoScreenshot; - this.combatWindow = combatWindow; - } + public void addInvItem(int id, int amount, boolean wielded) { + invItems.add(new InvItem(id, amount, wielded)); + } - public void setStat(int stat, long exp, int lvl) { - this.exp[stat] = exp; - this.lvl[stat] = lvl; - } + public boolean autoScreenshot() { + return autoScreenshot; + } - public void setTotals(int combat, int skillTotal) { - this.combat = combat; - this.skillTotal = skillTotal; - } + public boolean blockChat() { + return blockChat; + } - public boolean showRoof() { - return showRoof; - } + public boolean blockDuel() { + return blockDuel; + } - public boolean soundOff() { - return soundOff; - } + public boolean blockPrivate() { + return blockPrivate; + } + + public boolean blockTrade() { + return blockTrade; + } + + public boolean cameraAuto() { + return cameraAuto; + } + + public void clearBankItems() { + bankItems.clear(); + } + + public void clearInvItems() { + invItems.clear(); + } + + public void clearQuestStages() { + questStage.clear(); + } + + public boolean combatWindow() { + return combatWindow; + } + + public int getBankCount() { + return bankItems.size(); + } + + public BankItem getBankItem(int i) { + return bankItems.get(i); + } + + public int getBodySprite() { + return bodySprite; + } + + public byte getCombatStyle() { + return combatStyle; + } + + public long getExp(int i) { + return exp[i]; + } + + public int getFatigue() { + return fatigue; + } + + public long getFriend(int i) { + return friendList.get(i); + } + + public int getFriendCount() { + return friendList.size(); + } + + public int getGroup() { + return group; + } + + public int getHairColour() { + return hairColour; + } + + public int getHeadSprite() { + return headSprite; + } + + public long getIgnore(int i) { + return ignoreList.get(i); + } + + public int getIgnoreCount() { + return ignoreList.size(); + } + + public int getInvCount() { + return invItems.size(); + } + + public InvItem getInvItem(int i) { + return invItems.get(i); + } + + public long getLastIP() { + return loginIP; + } + + public long getLastLogin() { + return loginDate; + } + + public long getLastUpdate() { + return lastUpdate; + } + + public int getOwner() { + return owner; + } + + public int getQuestPoints() { + return questPoints; + } + + public int getQuestStage(int id) { + return questStage.get(id); + } + + public HashMap getQuestStages() { + return questStage; + } + + public int getSkinColour() { + return skinColour; + } + + public long getSkullTime() { + return skulled; + } + + public int getStat(int i) { + return lvl[i]; + } + + public long getSubscriptionExpires() { + return subExpires; + } + + public int getTopColour() { + return topColour; + } + + public int getTrouserColour() { + return trouserColour; + } + + public long getUser() { + return user; + } + + public String getUsername() { + return DataConversions.hashToUsername(user); + } + + public int getX() { + return x; + } + + public int getY() { + return y; + } + + public boolean isMale() { + return male; + } + + public boolean oneMouse() { + return oneMouse; + } + + public void removeFriend(long friend) { + friendList.remove(friend); + } + + public void removeIgnore(long friend) { + ignoreList.remove(friend); + } + + public boolean save() { + try { + String query; + + Server.db.updateQuery("DELETE FROM `pk_bank` WHERE `user`='" + user + + "'"); + if (bankItems.size() > 0) { + query = "INSERT INTO `pk_bank`(`user`, `id`, `amount`, `slot`) VALUES"; + int slot = 0; + for (BankItem item : bankItems) { + query += "('" + user + "', '" + item.getID() + "', '" + + item.getAmount() + "', '" + (slot++) + "'),"; + } + Server.db.updateQuery(query.substring(0, query.length() - 1)); + } + + Server.db.updateQuery("DELETE FROM `pk_invitems` WHERE `user`='" + + user + "'"); + + ResultSet result = Server.db + .getQuery("Select 1 FROM `pk_players` WHERE `user`='" + + user + "' AND `owner`='" + owner + "'"); + if (!result.next()) + return false; + + Server.db.updateQuery("UPDATE `pk_players` SET `combat`=" + combat + + ", skill_total=" + skillTotal + ", `x`=" + x + ", `y`='" + + y + "', `fatigue`='" + fatigue + "', `haircolour`=" + + hairColour + ", `topcolour`=" + topColour + + ", `trousercolour`=" + trouserColour + ", `skincolour`=" + + skinColour + ", `headsprite`=" + headSprite + + ", `bodysprite`=" + bodySprite + ", `male`=" + + (male ? 1 : 0) + ", `skulled`=" + skulled + + ", `combatstyle`=" + combatStyle + ", `quest_points`=" + + questPoints + " WHERE `user`='" + user + "'"); + + query = "UPDATE `pk_experience` SET "; + for (int i = 0; i < 18; i++) + query += "`exp_" + statArray[i] + "`=" + exp[i] + ","; + + Server.db.updateQuery(query.substring(0, query.length() - 1) + + " WHERE `user`='" + user + "'"); + + query = "UPDATE `pk_curstats` SET "; + for (int i = 0; i < 18; i++) + query += "`cur_" + statArray[i] + "`=" + lvl[i] + ","; + + Server.db.updateQuery(query.substring(0, query.length() - 1) + + " WHERE `user`='" + user + "'"); + + if (invItems.size() > 0) { + query = "INSERT INTO `pk_invitems`(`user`, `id`, `amount`, `wielded`, `slot`) VALUES"; + int slot = 0; + for (InvItem item : invItems) + query += "('" + user + "', '" + item.getID() + "', '" + + item.getAmount() + "', '" + + (item.isWielded() ? 1 : 0) + "', '" + (slot++) + + "'),"; + + Server.db.updateQuery(query.substring(0, query.length() - 1)); + } + + Server.db.updateQuery("DELETE FROM `pk_quests` WHERE `user`='" + + user + "'"); + query = "INSERT INTO `pk_quests` (`user`, `id`, `stage`) VALUES"; + java.util.Set keys = questStage.keySet(); + for (int id : keys) + query += "('" + user + "', '" + id + "', '" + + questStage.get(id) + "'),"; + + Server.db.updateQuery(query.substring(0, query.length() - 1)); + + Server.db.updateQuery("UPDATE `pk_players` SET eventcd='" + + getEventCD() + "' WHERE user='" + user + "'"); + + return true; + } catch (SQLException e) { + e.printStackTrace(); + Server.error(e); + return false; + } + } + + public void setAppearance(byte hairColour, byte topColour, + byte trouserColour, byte skinColour, byte headSprite, + byte bodySprite, boolean male, long skulled) { + this.hairColour = hairColour; + this.topColour = topColour; + this.trouserColour = trouserColour; + this.skinColour = skinColour; + this.headSprite = headSprite; + this.bodySprite = bodySprite; + this.male = male; + this.skulled = skulled; + } + + public void setCombatStyle(byte combatStyle) { + this.combatStyle = combatStyle; + } + + public void setExp(int stat, long exp) { + this.exp[stat] = exp; + } + + public void setFatigue(int fatigue) { + this.fatigue = fatigue; + } + + public void setEventCD(long eventcd) { + this.eventcd = eventcd; + } + + public long getEventCD() { + return eventcd; + } + + public void setGameSetting(int idx, boolean on) { + switch (idx) { + case 0: + cameraAuto = on; + break; + case 2: + oneMouse = on; + break; + case 3: + soundOff = on; + break; + case 4: + showRoof = on; + break; + case 5: + autoScreenshot = on; + break; + case 6: + combatWindow = on; + break; + } + } + + public void setLastUpdate(long lastUpdate) { + this.lastUpdate = lastUpdate; + } + + public void setLocation(int x, int y) { + this.x = x; + this.y = y; + } + + public void setLogin(long loginDate, long loginIP) { + this.loginDate = loginDate; + this.loginIP = loginIP; + } + + public void setLvl(int stat, int lvl) { + this.lvl[stat] = lvl; + } + + public void setOwner(int owner) { + this.owner = owner; + } + + public void setOwner(int owner, int group, long subExpires) { + this.owner = owner; + this.group = group; + this.subExpires = subExpires; + } + + public void setPrivacy(boolean blockChat, boolean blockPrivate, + boolean blockTrade, boolean blockDuel) { + this.blockChat = blockChat; + this.blockPrivate = blockPrivate; + this.blockTrade = blockTrade; + this.blockDuel = blockDuel; + } + + public void setPrivacySetting(int idx, boolean on) { + switch (idx) { + case 0: + blockChat = on; + break; + case 1: + blockPrivate = on; + break; + case 2: + blockTrade = on; + break; + case 3: + blockDuel = on; + break; + } + } + + public void setQuestPoints(int i) { + questPoints = i; + } + + public void setQuestStage(int index, int stage) { + questStage.put(index, stage); + } + + public void setSettings(boolean cameraAuto, boolean oneMouse, + boolean soundOff, boolean showRoof, boolean autoScreenshot, + boolean combatWindow) { + this.cameraAuto = cameraAuto; + this.oneMouse = oneMouse; + this.soundOff = soundOff; + this.showRoof = showRoof; + this.autoScreenshot = autoScreenshot; + this.combatWindow = combatWindow; + } + + public void setStat(int stat, long exp, int lvl) { + this.exp[stat] = exp; + this.lvl[stat] = lvl; + } + + public void setTotals(int combat, int skillTotal) { + this.combat = combat; + this.skillTotal = skillTotal; + } + + public boolean showRoof() { + return showRoof; + } + + public boolean soundOff() { + return soundOff; + } public void setMuted(long muted) { this.muted = muted; diff --git a/LoginServer/src/org/moparscape/msc/ls/packethandler/loginserver/PlayerLoginHandler.java b/LoginServer/src/org/moparscape/msc/ls/packethandler/loginserver/PlayerLoginHandler.java index c51e0c7..ed60c6c 100644 --- a/LoginServer/src/org/moparscape/msc/ls/packethandler/loginserver/PlayerLoginHandler.java +++ b/LoginServer/src/org/moparscape/msc/ls/packethandler/loginserver/PlayerLoginHandler.java @@ -68,21 +68,21 @@ public class PlayerLoginHandler implements PacketHandler { byte returnVal = 0; try { - ResultSet result = Server.db.getQuery("SELECT r.pass, r.banned, r.owner, u.group_id, b.id AS b_id FROM `pk_players` AS r INNER JOIN `users` AS u ON u.id=r.owner LEFT JOIN `bans` AS b on (b.username LIKE u.username OR b.ip LIKE '" + ip + "') WHERE `user`='" + user + "'"); + ResultSet result = Server.db.getQuery("SELECT banned, owner, group_id FROM `pk_players` WHERE `user` = '" + user + "'"); if (!result.next()) { - return 2; + return 2; } if (!Auth.check_auth(DataConversions.hashToUsername(user), pass, new StringBuilder())) { - return 2; + return 2; } - if (result.getInt("banned") == 1 || result.getInt("b_id") != 0) { - System.out.println("Banned player: " + DataConversions.hashToUsername(user) + " trying to login."); - return 6; + if (result.getInt("banned") == 1) { + System.out.println("Banned player: " + DataConversions.hashToUsername(user) + " trying to login."); + return 6; } - if (result.getInt("group_id") == 1 || result.getInt("group_id") == 2) { - returnVal = 99; + if (result.getInt("group_id") >= 5) { + returnVal = 99; } int owner = result.getInt("owner");