Merge pull request #17 from CodeForFame/master

Bug Fixes
This commit is contained in:
CodeForFame 2011-07-22 12:27:45 -07:00
commit c8312b5298
12 changed files with 863 additions and 917 deletions

View File

@ -1,7 +1,7 @@
-- MoparRSC DB Structure -- 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 */; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
@ -20,42 +20,24 @@
CREATE DATABASE IF NOT EXISTS moparclassic; CREATE DATABASE IF NOT EXISTS moparclassic;
USE 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, -- Definition of table `moparclassic`.`drops`
`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;
DROP TABLE IF EXISTS `moparclassic`.`drops`;
CREATE TABLE `moparclassic`.`drops` ( CREATE TABLE `moparclassic`.`drops` (
`id` int(11) DEFAULT NULL, `id` int(11) DEFAULT NULL,
`item` varchar(255) DEFAULT NULL, `item` varchar(255) DEFAULT NULL,
`amount` int(11) DEFAULT NULL, `amount` int(11) DEFAULT NULL,
`weight` int(11) DEFAULT NULL `weight` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1; ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Definition of table `moparclassic`.`dupe_data`
--
DROP TABLE IF EXISTS `moparclassic`.`dupe_data`;
CREATE TABLE `moparclassic`.`dupe_data` ( CREATE TABLE `moparclassic`.`dupe_data` (
`user` varchar(255) NOT NULL, `user` varchar(255) NOT NULL,
`userhash` varchar(255) NOT NULL, `userhash` varchar(255) NOT NULL,
@ -63,92 +45,33 @@ CREATE TABLE `moparclassic`.`dupe_data` (
`time` varchar(255) DEFAULT NULL `time` varchar(255) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1; ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Definition of table `moparclassic`.`error_reports`
--
DROP TABLE IF EXISTS `moparclassic`.`error_reports`;
CREATE TABLE `moparclassic`.`error_reports` ( CREATE TABLE `moparclassic`.`error_reports` (
`data` text, `data` text,
`email` varchar(255) DEFAULT NULL, `email` varchar(255) DEFAULT NULL,
`ip` varchar(255) DEFAULT NULL, `ip` varchar(255) DEFAULT NULL,
`unix` varchar(255) DEFAULT NULL `unix` varchar(255) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1; ) 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` ( CREATE TABLE `moparclassic`.`gp_count` (
`unixtime` varchar(255) DEFAULT NULL, `unixtime` varchar(255) DEFAULT NULL,
`amount` varchar(255) DEFAULT NULL `amount` varchar(255) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1; ) 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 '', -- Definition of table `moparclassic`.`items`
`code` varchar(255) NOT NULL DEFAULT '', --
`time` int(10) unsigned NOT NULL DEFAULT '0',
`invites` varchar(255) NOT NULL DEFAULT '1', DROP TABLE IF EXISTS `moparclassic`.`items`;
`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;
CREATE TABLE `moparclassic`.`items` ( CREATE TABLE `moparclassic`.`items` (
`id` int(11) DEFAULT NULL, `id` int(11) DEFAULT NULL,
`name` varchar(255) DEFAULT NULL, `name` varchar(255) DEFAULT NULL,
@ -157,41 +80,22 @@ CREATE TABLE `moparclassic`.`items` (
`stackable` varchar(255) DEFAULT NULL, `stackable` varchar(255) DEFAULT NULL,
`wieldable` varchar(255) DEFAULT NULL `wieldable` varchar(255) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1; ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
CREATE TABLE `moparclassic`.`logins` (
`id` int(10) DEFAULT NULL, --
`login_ip` varchar(15) DEFAULT NULL, -- Definition of table `moparclassic`.`online_count`
`time` int(10) DEFAULT NULL --
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
CREATE TABLE `moparclassic`.`messages` ( DROP TABLE IF EXISTS `moparclassic`.`online_count`;
`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;
CREATE TABLE `moparclassic`.`online_count` ( CREATE TABLE `moparclassic`.`online_count` (
`unixtime` varchar(255) DEFAULT NULL, `unixtime` varchar(255) DEFAULT NULL,
`online` int(20) DEFAULT NULL `online` int(20) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1; ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Definition of table `moparclassic`.`pk_bank`
--
DROP TABLE IF EXISTS `moparclassic`.`pk_bank`;
CREATE TABLE `moparclassic`.`pk_bank` ( CREATE TABLE `moparclassic`.`pk_bank` (
`user` varchar(255) DEFAULT NULL, `user` varchar(255) DEFAULT NULL,
`id` int(10) unsigned NOT NULL, `id` int(10) unsigned NOT NULL,
@ -202,6 +106,11 @@ CREATE TABLE `moparclassic`.`pk_bank` (
KEY `amount` (`amount`) KEY `amount` (`amount`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1; ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Definition of table `moparclassic`.`pk_banlog`
--
DROP TABLE IF EXISTS `moparclassic`.`pk_banlog`;
CREATE TABLE `moparclassic`.`pk_banlog` ( CREATE TABLE `moparclassic`.`pk_banlog` (
`user` varchar(255) DEFAULT NULL, `user` varchar(255) DEFAULT NULL,
`staff` varchar(255) DEFAULT NULL, `staff` varchar(255) DEFAULT NULL,
@ -210,6 +119,12 @@ CREATE TABLE `moparclassic`.`pk_banlog` (
KEY `time` (`time`), KEY `time` (`time`),
KEY `user` (`user`) KEY `user` (`user`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1; ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Definition of table `moparclassic`.`pk_curstats`
--
DROP TABLE IF EXISTS `moparclassic`.`pk_curstats`;
CREATE TABLE `moparclassic`.`pk_curstats` ( CREATE TABLE `moparclassic`.`pk_curstats` (
`user` varchar(255) NOT NULL, `user` varchar(255) NOT NULL,
`cur_attack` int(5) unsigned NOT NULL DEFAULT '1', `cur_attack` int(5) unsigned NOT NULL DEFAULT '1',
@ -235,6 +150,11 @@ CREATE TABLE `moparclassic`.`pk_curstats` (
KEY `user` (`user`) KEY `user` (`user`)
) ENGINE=MyISAM AUTO_INCREMENT=350943 DEFAULT CHARSET=latin1; ) 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` ( CREATE TABLE `moparclassic`.`pk_experience` (
`user` varchar(255) NOT NULL, `user` varchar(255) NOT NULL,
`exp_attack` int(10) unsigned NOT NULL DEFAULT '0', `exp_attack` int(10) unsigned NOT NULL DEFAULT '0',
@ -278,18 +198,35 @@ CREATE TABLE `moparclassic`.`pk_experience` (
KEY `user` (`user`) KEY `user` (`user`)
) ENGINE=MyISAM AUTO_INCREMENT=350943 DEFAULT CHARSET=latin1; ) 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` ( CREATE TABLE `moparclassic`.`pk_friends` (
`user` varchar(255) NOT NULL, `user` varchar(255) NOT NULL,
`friend` varchar(255) NOT NULL, `friend` varchar(255) NOT NULL,
KEY `user` (`user`), KEY `user` (`user`),
KEY `friend` (`friend`) KEY `friend` (`friend`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1; ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Definition of table `moparclassic`.`pk_ignores`
--
DROP TABLE IF EXISTS `moparclassic`.`pk_ignores`;
CREATE TABLE `moparclassic`.`pk_ignores` ( CREATE TABLE `moparclassic`.`pk_ignores` (
`user` varchar(255) NOT NULL, `user` varchar(255) NOT NULL,
`ignore` varchar(255) NOT NULL, `ignore` varchar(255) NOT NULL,
KEY `ignore` (`ignore`), KEY `ignore` (`ignore`),
KEY `user` (`user`) KEY `user` (`user`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1; ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Definition of table `moparclassic`.`pk_invitems`
--
DROP TABLE IF EXISTS `moparclassic`.`pk_invitems`;
CREATE TABLE `moparclassic`.`pk_invitems` ( CREATE TABLE `moparclassic`.`pk_invitems` (
`user` varchar(255) NOT NULL, `user` varchar(255) NOT NULL,
`id` int(10) unsigned NOT NULL, `id` int(10) unsigned NOT NULL,
@ -299,17 +236,34 @@ CREATE TABLE `moparclassic`.`pk_invitems` (
KEY `user` (`user`) KEY `user` (`user`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1; ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Definition of table `moparclassic`.`pk_ipbans`
--
DROP TABLE IF EXISTS `moparclassic`.`pk_ipbans`;
CREATE TABLE `moparclassic`.`pk_ipbans` ( CREATE TABLE `moparclassic`.`pk_ipbans` (
`ip` varchar(15) NOT NULL, `ip` varchar(15) NOT NULL,
`time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`ip`) PRIMARY KEY (`ip`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8; ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--
-- Definition of table `moparclassic`.`pk_kills`
--
DROP TABLE IF EXISTS `moparclassic`.`pk_kills`;
CREATE TABLE `moparclassic`.`pk_kills` ( CREATE TABLE `moparclassic`.`pk_kills` (
`user` varchar(255) NOT NULL, `user` varchar(255) NOT NULL,
`type` tinyint(1) NOT NULL DEFAULT '0', `type` tinyint(1) NOT NULL DEFAULT '0',
`killed` varchar(45) NOT NULL, `killed` varchar(45) NOT NULL,
`time` int(10) NOT NULL `time` int(10) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1; ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Definition of table `moparclassic`.`pk_logins`
--
DROP TABLE IF EXISTS `moparclassic`.`pk_logins`;
CREATE TABLE `moparclassic`.`pk_logins` ( CREATE TABLE `moparclassic`.`pk_logins` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT, `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`user` varchar(45) NOT NULL, `user` varchar(45) NOT NULL,
@ -317,8 +271,13 @@ CREATE TABLE `moparclassic`.`pk_logins` (
`ip` varchar(15) NOT NULL DEFAULT '0.0.0.0', `ip` varchar(15) NOT NULL DEFAULT '0.0.0.0',
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
KEY `ip` (`ip`) 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` ( CREATE TABLE `moparclassic`.`pk_market` (
`owner` int(10) NOT NULL, `owner` int(10) NOT NULL,
`item_id` 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, `selling_price` int(10) NOT NULL,
PRIMARY KEY (`owner`) PRIMARY KEY (`owner`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1; ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Definition of table `moparclassic`.`pk_mutelog`
--
DROP TABLE IF EXISTS `moparclassic`.`pk_mutelog`;
CREATE TABLE `moparclassic`.`pk_mutelog` ( CREATE TABLE `moparclassic`.`pk_mutelog` (
`user` varchar(255) NOT NULL, `user` varchar(255) NOT NULL,
`staff` varchar(255) NOT NULL, `staff` varchar(255) NOT NULL,
@ -333,6 +298,12 @@ CREATE TABLE `moparclassic`.`pk_mutelog` (
`report_id` int(11) NOT NULL, `report_id` int(11) NOT NULL,
`duration` int(10) NOT NULL `duration` int(10) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1; ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Definition of table `moparclassic`.`pk_online`
--
DROP TABLE IF EXISTS `moparclassic`.`pk_online`;
CREATE TABLE `moparclassic`.`pk_online` ( CREATE TABLE `moparclassic`.`pk_online` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT, `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`user` varchar(45) NOT NULL, `user` varchar(45) NOT NULL,
@ -342,6 +313,12 @@ CREATE TABLE `moparclassic`.`pk_online` (
`world` int(10) unsigned NOT NULL, `world` int(10) unsigned NOT NULL,
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC COMMENT='InnoDB free: 9216 kB'; ) 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` ( CREATE TABLE `moparclassic`.`pk_players` (
`user` varchar(255) NOT NULL, `user` varchar(255) NOT NULL,
`username` varchar(255) NOT NULL DEFAULT '', `username` varchar(255) NOT NULL DEFAULT '',
@ -393,6 +370,11 @@ CREATE TABLE `moparclassic`.`pk_players` (
KEY `user` (`user`) KEY `user` (`user`)
) ENGINE=MyISAM AUTO_INCREMENT=350944 DEFAULT CHARSET=latin1 COMMENT='InnoDB free: 9216 kB'; ) 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` ( CREATE TABLE `moparclassic`.`pk_quests` (
`id` int(11) DEFAULT NULL, `id` int(11) DEFAULT NULL,
`stage` int(11) DEFAULT NULL, `stage` int(11) DEFAULT NULL,
@ -400,6 +382,11 @@ CREATE TABLE `moparclassic`.`pk_quests` (
KEY `user` (`user`) KEY `user` (`user`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1; ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Definition of table `moparclassic`.`pk_reports`
--
DROP TABLE IF EXISTS `moparclassic`.`pk_reports`;
CREATE TABLE `moparclassic`.`pk_reports` ( CREATE TABLE `moparclassic`.`pk_reports` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT, `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`from` varchar(255) NOT NULL, `from` varchar(255) NOT NULL,
@ -418,6 +405,12 @@ CREATE TABLE `moparclassic`.`pk_reports` (
`sendToMod` int(11) DEFAULT '0', `sendToMod` int(11) DEFAULT '0',
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=4340 DEFAULT CHARSET=latin1; ) 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` ( CREATE TABLE `moparclassic`.`pk_reports_comments` (
`id` int(10) NOT NULL AUTO_INCREMENT, `id` int(10) NOT NULL AUTO_INCREMENT,
`report_id` int(10) NOT NULL, `report_id` int(10) NOT NULL,
@ -426,6 +419,12 @@ CREATE TABLE `moparclassic`.`pk_reports_comments` (
`text` text NOT NULL, `text` text NOT NULL,
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=4222 DEFAULT CHARSET=latin1; ) 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` ( CREATE TABLE `moparclassic`.`pk_stat_reduction` (
`user` int(10) NOT NULL, `user` int(10) NOT NULL,
`account` varchar(255) NOT NULL, `account` varchar(255) NOT NULL,
@ -434,6 +433,12 @@ CREATE TABLE `moparclassic`.`pk_stat_reduction` (
`voucher` varchar(255) DEFAULT NULL, `voucher` varchar(255) DEFAULT NULL,
`time` int(11) NOT NULL `time` int(11) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1; ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Definition of table `moparclassic`.`pk_tradelog`
--
DROP TABLE IF EXISTS `moparclassic`.`pk_tradelog`;
CREATE TABLE `moparclassic`.`pk_tradelog` ( CREATE TABLE `moparclassic`.`pk_tradelog` (
`from` varchar(255) DEFAULT NULL, `from` varchar(255) DEFAULT NULL,
`to` varchar(255) DEFAULT NULL, `to` varchar(255) DEFAULT NULL,
@ -448,6 +453,11 @@ CREATE TABLE `moparclassic`.`pk_tradelog` (
KEY `tradelog_time` (`time`) KEY `tradelog_time` (`time`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1; ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Definition of table `moparclassic`.`pk_worlds`
--
DROP TABLE IF EXISTS `moparclassic`.`pk_worlds`;
CREATE TABLE `moparclassic`.`pk_worlds` ( CREATE TABLE `moparclassic`.`pk_worlds` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT, `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`location` varchar(45) NOT NULL, `location` varchar(45) NOT NULL,
@ -455,182 +465,6 @@ CREATE TABLE `moparclassic`.`pk_worlds` (
`port` varchar(45) NOT NULL, `port` varchar(45) NOT NULL,
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC; ) 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 */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;

View File

@ -18,8 +18,26 @@
<entry key="members">false</entry> <entry key="members">false</entry>
<entry key="f2pwildy">true</entry> <entry key="f2pwildy">true</entry>
<entry key="expRate">4.0</entry> <entry key="expRate">4.0</entry>
<entry key="subExpRate">4.0</entry> <entry key="subExpRate">4.0</entry>
<!-- The minimum level required for the player to get the non-combat bonus
XP for being in the wilderness -->
<entry key="wild-non-combat-min-level">999</entry>
<!-- The following two are rates that are added to the player's XP rate -->
<entry key="wild-non-combat-bonus">0</entry>
<entry key="wild-combat-bonus">0</entry>
<!-- The amount of time (in ms) that a player must stand still in the wild
(without being in combat) before they can log out. The message will say they
must wait x seconds. -->
<entry key="wild-stand-still-time">10000</entry>
<!-- If true, a message will be sent to all online players when someone
reaches the max level for a skill -->
<entry key="max-level-congrats">false</entry>
<!-- Separate names by commas --> <!-- Separate names by commas -->
<entry key="pmods">None</entry> <entry key="pmods">None</entry>
@ -27,7 +45,7 @@
<entry key="admins">None</entry> <entry key="admins">None</entry>
<entry key="ip-ban-removal-delay">1800000</entry> <entry key="ip-ban-removal-delay">1800000</entry>
<entry key="os-level-blocking">true</entry> <entry key="os-level-blocking">false</entry>
<entry key="os-level-block-command">sudo route add -host ${ip} reject</entry> <entry key="os-level-block-command">sudo route add -host ${ip} reject</entry>
<entry key="os-level-unblock-command">sudo route del -host ${ip} reject</entry> <entry key="os-level-unblock-command">sudo route del -host ${ip} reject</entry>
<entry key="application-level-blocking">true</entry> <entry key="application-level-blocking">true</entry>
@ -44,8 +62,9 @@
This uses a LRUMap, and only has a limited number of entries, so only the This uses a LRUMap, and only has a limited number of entries, so only the
most active IPs will be stored at a time. --> most active IPs will be stored at a time. -->
<entry key="connection-throttle">5</entry> <entry key="connection-throttle">5</entry>
<!-- The amount of time (in ms) after a connection is closed that the count is kept.
This is used to throttle spam logging. -->
<entry key="connection-throttle-remove-delay">180000</entry>
<!-- Every 100 minutes --> <!-- Every 100 minutes -->
<entry key="garbage-collect-interval">6000000</entry> <entry key="garbage-collect-interval">6000000</entry>

View File

@ -28,17 +28,20 @@ public class Config {
public static boolean members, f2pWildy, APPLICATION_LEVEL_BLOCKING; public static boolean members, f2pWildy, APPLICATION_LEVEL_BLOCKING;
public static double expRate, subExpRate; public static double expRate, subExpRate, WILD_NON_COMBAT_BONUS,
WILD_COMBAT_BONUS;
public static String[] pmods, mods, admins; public static String[] pmods, mods, admins;
public static int IP_BAN_REMOVAL_DELAY; public static int IP_BAN_REMOVAL_DELAY, GARBAGE_COLLECT_INTERVAL,
public static int GARBAGE_COLLECT_INTERVAL; SAVE_INTERVAL;
public static int SAVE_INTERVAL;
public static String DATE_FORMAT, BLOCK_COMMAND, UNBLOCK_COMMAND, public static String DATE_FORMAT, BLOCK_COMMAND, UNBLOCK_COMMAND,
ALERT_CONFIG, COMMAND_CONFIG; ALERT_CONFIG, COMMAND_CONFIG;
public static int CONNECTION_THROTTLE_SIZE; public static int CONNECTION_THROTTLE_SIZE,
WILD_LEVEL_FOR_NON_COMBAT_BONUS, WILD_STAND_STILL_TIME,
DELAY_REMOVAL;
public static boolean OS_LEVEL_BLOCKING, APPLICATION_LEVEL_THROTTLE_ALERT, public static boolean OS_LEVEL_BLOCKING, APPLICATION_LEVEL_THROTTLE_ALERT,
OS_LEVEL_THROTTLE_ALERT, OS_LEVEL_UNBLOCK_FAILED_ALERT; OS_LEVEL_THROTTLE_ALERT, OS_LEVEL_UNBLOCK_FAILED_ALERT,
CONGRATS_FOR_MAX_LEVEL;
static { static {
loadEnv(); loadEnv();
@ -102,6 +105,8 @@ public class Config {
.getProperty("os-level-blocking-throttle-alert")); .getProperty("os-level-blocking-throttle-alert"));
OS_LEVEL_UNBLOCK_FAILED_ALERT = Boolean.parseBoolean(props OS_LEVEL_UNBLOCK_FAILED_ALERT = Boolean.parseBoolean(props
.getProperty("os-level-blocking-unblock-failed-alert")); .getProperty("os-level-blocking-unblock-failed-alert"));
DELAY_REMOVAL = Integer.parseInt(props
.getProperty("connection-throttle-remove-delay"));
GARBAGE_COLLECT_INTERVAL = Integer.parseInt(props GARBAGE_COLLECT_INTERVAL = Integer.parseInt(props
.getProperty("garbage-collect-interval")); .getProperty("garbage-collect-interval"));
@ -112,6 +117,17 @@ public class Config {
ALERT_CONFIG = props.getProperty("alert-config"); ALERT_CONFIG = props.getProperty("alert-config");
COMMAND_CONFIG = props.getProperty("command-config"); COMMAND_CONFIG = props.getProperty("command-config");
WILD_STAND_STILL_TIME = Integer.parseInt(props
.getProperty("wild-stand-still-time"));
WILD_LEVEL_FOR_NON_COMBAT_BONUS = Integer.parseInt(props
.getProperty("wild-non-combat-min-level"));
WILD_NON_COMBAT_BONUS = Double.parseDouble(props
.getProperty("wild-non-combat-bonus"));
WILD_COMBAT_BONUS = Double.parseDouble(props
.getProperty("wild-combat-bonus"));
CONGRATS_FOR_MAX_LEVEL = Boolean.parseBoolean(props
.getProperty("max-level-congrats"));
props.clear(); props.clear();
Constants.GameServer.MOTD = "@yel@Welcome to @whi@" Constants.GameServer.MOTD = "@yel@Welcome to @whi@"

View File

@ -79,6 +79,12 @@ public class Formulae {
private static Random r = new Random(); private static Random r = new Random();
public static final int[] runeIDs = { 31, 32, 33, 34, 35, 36, 37, 38, 40, public static final int[] runeIDs = { 31, 32, 33, 34, 35, 36, 37, 38, 40,
41, 42, 46, 619, 825 }; 41, 42, 46, 619, 825 };
/**
* Safe packets:<br>
* PlayerAppearanceUpdater<br>
* FollowRequest<br>
* InvUseOnItem<br>
*/
public static final int[] safePacketIDs = { 70, 123, 128, 255 }; public static final int[] safePacketIDs = { 70, 123, 128, 255 };
public static final String[] statArray = { "attack", "defense", "strength", public static final String[] statArray = { "attack", "defense", "strength",
"hits", "ranged", "prayer", "magic", "cooking", "woodcut", "hits", "ranged", "prayer", "magic", "cooking", "woodcut",

View File

@ -1,34 +0,0 @@
package org.moparscape.msc.gs;
import java.util.Map;
import org.apache.commons.collections.map.LRUMap;
/**
* A basic cache backed by a {@link LRUMap}.
*
* @author CodeForFame
*
*/
public class Cache<K, V> {
private Map<K, V> cache;
public Cache() {
this(100);
}
@SuppressWarnings("unchecked")
public Cache(int size) {
cache = new LRUMap(size);
}
public V get(K key) {
return cache.get(key);
}
public void put(K key, V value) {
cache.put(key, value);
}
}

View File

@ -7,25 +7,34 @@ import org.apache.mina.common.IoFilter;
import org.apache.mina.common.IoSession; import org.apache.mina.common.IoSession;
import org.apache.mina.filter.BlacklistFilter; import org.apache.mina.filter.BlacklistFilter;
import org.moparscape.msc.config.Config; import org.moparscape.msc.config.Config;
import org.moparscape.msc.gs.Instance;
import org.moparscape.msc.gs.event.SingleEvent;
import org.moparscape.msc.gs.util.Cache; import org.moparscape.msc.gs.util.Cache;
public class ConnectionFilter extends BlacklistFilter { public class ConnectionFilter extends BlacklistFilter {
private Cache<InetSocketAddress, Integer> connections = new Cache<InetSocketAddress, Integer>( private Cache<String, Integer> connections = new Cache<String, Integer>(
Config.CONNECTION_THROTTLE_SIZE); Config.CONNECTION_THROTTLE_SIZE);
public void sessionCreated(IoFilter.NextFilter nextFilter, IoSession session) { public void sessionCreated(IoFilter.NextFilter nextFilter, IoSession session) {
final SocketAddress sa = session.getRemoteAddress(); final SocketAddress sa = session.getRemoteAddress();
if (sa != null && sa instanceof InetSocketAddress) { if (sa != null && sa instanceof InetSocketAddress) {
final InetSocketAddress a = (InetSocketAddress) sa; final InetSocketAddress a = (InetSocketAddress) sa;
if (IPBanManager.isBlocked(a)) { final String host = a.getAddress().getHostAddress();
if (IPBanManager.isBlocked(host)) {
block(a.getAddress()); block(a.getAddress());
session.close();
return; return;
} }
final Integer val = connections.get(a); Integer val;
final Integer retVal = connections synchronized (connections) {
.put(a, val == null ? 1 : val + 1); val = connections.get(host);
if (retVal != null && retVal > Config.CONENCTION_THROTTLE_THRESHOLD) { connections.put(host, val == null ? 1 : val + 1);
}
if (val != null
&& val + 1 >= Config.CONENCTION_THROTTLE_THRESHOLD && !IPBanManager.isBlocked(host)) {
IPBanManager.block(host);
block(a.getAddress()); block(a.getAddress());
session.close();
return; return;
} }
} }
@ -37,14 +46,42 @@ public class ConnectionFilter extends BlacklistFilter {
final SocketAddress sa = session.getRemoteAddress(); final SocketAddress sa = session.getRemoteAddress();
if (sa != null && sa instanceof InetSocketAddress) { if (sa != null && sa instanceof InetSocketAddress) {
final InetSocketAddress a = (InetSocketAddress) sa; final InetSocketAddress a = (InetSocketAddress) sa;
final Integer val = connections.get(a); final Integer val;
final Integer retVal = connections synchronized (connections) {
.put(a, val == null ? 1 : val + 1); val = connections.get(a.getAddress().getHostAddress());
if (retVal != null
&& retVal - 1 <= Config.CONENCTION_THROTTLE_THRESHOLD) {
unblock(a.getAddress());
} }
if (val != null) {
if (Config.DELAY_REMOVAL > 0) {
Instance.getDelayedEventHandler().add(
new SingleEvent(null, Config.DELAY_REMOVAL) {
public void action() {
unblock(a);
}
});
} else {
unblock(a);
}
}
} }
super.sessionClosed(nextFilter, session); super.sessionClosed(nextFilter, session);
} }
private void unblock(InetSocketAddress a) {
final String host = a.getAddress().getHostAddress();
final Integer val;
synchronized (connections) {
val = connections.get(host);
if (val == 1) {
connections.remove(host);
} else {
connections.put(host, val - 1);
}
}
if (val != null && val - 1 < Config.CONENCTION_THROTTLE_THRESHOLD) {
if (IPBanManager.isBlocked(a))
IPBanManager.unblock(a);
unblock(a.getAddress());
}
}
} }

View File

@ -15,13 +15,12 @@ import org.moparscape.msc.gs.db.DataRequestHandler
object IPBanManager extends Blocker { object IPBanManager extends Blocker {
override def isBlocked(ip: String) = { override def isBlocked(ip: String): Boolean = {
var v = false if (Config.APPLICATION_LEVEL_BLOCKING && ApplicationLevelBlocking.isBlocked(ip))
if (Config.APPLICATION_LEVEL_BLOCKING) return true
v = ApplicationLevelBlocking.isBlocked(ip) if (Config.OS_LEVEL_BLOCKING && OSLevelBlocking.isBlocked(ip))
if (Config.OS_LEVEL_BLOCKING) return true
v = v || OSLevelBlocking.isBlocked(ip) return false
v
} }
def isBlocked(ip: SocketAddress): Boolean = { def isBlocked(ip: SocketAddress): Boolean = {
@ -113,7 +112,7 @@ private object ApplicationLevelBlocking extends Blocker {
private val events = Server.getServer().getEngine().getEventHandler() private val events = Server.getServer().getEngine().getEventHandler()
override def isBlocked(ip: String) = { override def isBlocked(ip: String) = {
blocked.contains(ip) blocked.contains(ip) || throttled.contains(ip)
} }
override def block(ip: String) = { override def block(ip: String) = {
@ -185,7 +184,7 @@ private object OSLevelBlocking extends Blocker {
private val events = Server.getServer().getEngine().getEventHandler() private val events = Server.getServer().getEngine().getEventHandler()
override def isBlocked(ip: String) = { override def isBlocked(ip: String) = {
blocked.contains(ip) blocked.contains(ip) || throttled.contains(ip)
} }
override def throttle(ip: String) { override def throttle(ip: String) {

View File

@ -13,7 +13,7 @@ import org.moparscape.msc.config.Config;
import org.moparscape.msc.gs.Instance; import org.moparscape.msc.gs.Instance;
import org.moparscape.msc.gs.connection.PacketQueue; import org.moparscape.msc.gs.connection.PacketQueue;
import org.moparscape.msc.gs.connection.RSCPacket; import org.moparscape.msc.gs.connection.RSCPacket;
import org.moparscape.msc.gs.connection.filter.OSLevelBlocking; import org.moparscape.msc.gs.connection.filter.IPBanManager;
import org.moparscape.msc.gs.event.DelayedEvent; import org.moparscape.msc.gs.event.DelayedEvent;
import org.moparscape.msc.gs.model.ActiveTile; import org.moparscape.msc.gs.model.ActiveTile;
import org.moparscape.msc.gs.model.Npc; import org.moparscape.msc.gs.model.Npc;
@ -228,7 +228,7 @@ public final class GameEngine extends Thread {
if (player.getUsername() == null && p.getID() != 32 if (player.getUsername() == null && p.getID() != 32
&& p.getID() != 77 && p.getID() != 0) { && p.getID() != 77 && p.getID() != 0) {
final String ip = player.getCurrentIP(); final String ip = player.getCurrentIP();
OSLevelBlocking.throttle(ip); IPBanManager.throttle(ip);
continue; continue;
} }
PacketHandler handler = packetHandlers.get(p.getID()); PacketHandler handler = packetHandlers.get(p.getID());

View File

@ -584,6 +584,12 @@ public final class Player extends Mob {
} }
} }
/**
* This method acts as a throttle for packets, and adds them to a list.<br>
* If the player sends more than 20 packets per second they're disconnected (60 packets per 3000ms)
*
* @param p - the packet to add...
*/
public void addPacket(RSCPacket p) { public void addPacket(RSCPacket p) {
long now = GameEngine.getTime(); long now = GameEngine.getTime();
if (now - lastCount > 3000) { if (now - lastCount > 3000) {
@ -591,7 +597,7 @@ public final class Player extends Mob {
packetCount = 0; packetCount = 0;
} }
if (!DataConversions.inArray(Formulae.safePacketIDs, p.getID()) if (!DataConversions.inArray(Formulae.safePacketIDs, p.getID())
&& packetCount++ >= 60) { && ++packetCount >= 60) {
destroy(false); destroy(false);
} }
if (lastPackets.size() >= 60) { if (lastPackets.size() >= 60) {
@ -653,14 +659,14 @@ public final class Player extends Mob {
public boolean canLogout() { public boolean canLogout() {
if (this != null && this.location != null if (this != null && this.location != null
&& this.location.inWilderness()) { && this.location.inWilderness()) {
if (GameEngine.getTime() - this.getLastMoved() < 10000) { if (GameEngine.getTime() - this.getLastMoved() < Config.WILD_STAND_STILL_TIME) {
getActionSender() getActionSender()
.sendMessage( .sendMessage(
"You must stand peacefully in one place for 10 seconds!"); "You must stand peacefully in one place for " + Config.WILD_STAND_STILL_TIME + " seconds!");
return false; return false;
} }
} }
return !isBusy() && GameEngine.getTime() - getCombatTimer() > 10000; return !isBusy() && GameEngine.getTime() - getCombatTimer() > Config.WILD_STAND_STILL_TIME;
} }
public boolean canReport() { public boolean canReport() {
@ -1564,7 +1570,6 @@ public final class Player extends Mob {
return wrongwords; return wrongwords;
} }
// incExp
public int ignoreCount() { public int ignoreCount() {
return ignoreList.size(); return ignoreList.size();
} }
@ -1600,13 +1605,8 @@ public final class Player extends Mob {
} }
} }
if (combat && i < 3 if (combat && i < 3
&& (combatStyleToIndex() != i && getCombatStyle() != 0)) { // fix && (combatStyleToIndex() != i && getCombatStyle() != 0)) {
// for // fix for accidental exp in other stats?
// accidental
// exp
// in
// other
// stats?
return; return;
} }
@ -1617,9 +1617,9 @@ public final class Player extends Mob {
if (getLocation().wildernessLevel() > 1) { if (getLocation().wildernessLevel() > 1) {
if (combat) if (combat)
exprate = exprate * 2; exprate += Config.WILD_COMBAT_BONUS;
if (getLocation().wildernessLevel() > 10 && !combat) if (getLocation().wildernessLevel() > Config.WILD_LEVEL_FOR_NON_COMBAT_BONUS && !combat)
exprate = exprate * 2; exprate += Config.WILD_NON_COMBAT_BONUS;
} }
exp[i] += amount * exprate; exp[i] += amount * exprate;
@ -1633,7 +1633,7 @@ public final class Player extends Mob {
incCurStat(i, advanced); incCurStat(i, advanced);
incMaxStat(i, advanced); incMaxStat(i, advanced);
int stat = this.getMaxStat(i); int stat = this.getMaxStat(i);
if (stat == 99) { if (stat == 99 && Config.CONGRATS_FOR_MAX_LEVEL) {
for (Player p : world.getPlayers()) { for (Player p : world.getPlayers()) {
if (p != null) { if (p != null) {
p.getActionSender() p.getActionSender()

View File

@ -11,17 +11,16 @@ import org.apache.commons.collections.map.LRUMap;
* *
*/ */
public class Cache<K, V> { public class Cache<K, V> {
private final Map<K, V> cache; private Map<K, V> cache;
public Cache() { public Cache() {
this(100); this(100);
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
// Commons and their failure to support generics... public Cache(int size) {
public Cache(int maxSize) { cache = new LRUMap(size);
cache = new LRUMap(maxSize);
} }
public V get(K key) { public V get(K key) {
@ -31,5 +30,17 @@ public class Cache<K, V> {
public V put(K key, V value) { public V put(K key, V value) {
return cache.put(key, value); return cache.put(key, value);
} }
public V remove(K key) {
return cache.remove(key);
}
public V remove(K key, V value) {
V v = cache.get(key);
if(v.equals(value)) {
return cache.remove(value);
}
return null;
}
} }

File diff suppressed because it is too large Load Diff

View File

@ -68,21 +68,21 @@ public class PlayerLoginHandler implements PacketHandler {
byte returnVal = 0; byte returnVal = 0;
try { 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()) { if (!result.next()) {
return 2; return 2;
} }
if (!Auth.check_auth(DataConversions.hashToUsername(user), pass, new StringBuilder())) { if (!Auth.check_auth(DataConversions.hashToUsername(user), pass, new StringBuilder())) {
return 2; return 2;
} }
if (result.getInt("banned") == 1 || result.getInt("b_id") != 0) { if (result.getInt("banned") == 1) {
System.out.println("Banned player: " + DataConversions.hashToUsername(user) + " trying to login."); System.out.println("Banned player: " + DataConversions.hashToUsername(user) + " trying to login.");
return 6; return 6;
} }
if (result.getInt("group_id") == 1 || result.getInt("group_id") == 2) { if (result.getInt("group_id") >= 5) {
returnVal = 99; returnVal = 99;
} }
int owner = result.getInt("owner"); int owner = result.getInt("owner");