Changed that.
Anyway, gonna be on holiday for the next week or so, so could a moderator please lock the thread? :)
Printable View
Thanks James for unlocking this! :D
Anyway, back from my holiday, will be updating soon. I'm planning a few core changes and I may scrap my characters system within the database.
Will you have Battleball and Snowstorm?
Got character creation done now I just need to do something to show all characters based on email without calling activerecord's query interface;
Quick question:PHP Code:#big nono
def self.show_characters(email)
return self.connection.execute("SELECT * FROM `habbo` WHERE `email` = '#{email}'").each
end
Should I have 1 user to many characters, or 1 user to one character?
1 user to different characters seems to be a better option imo.
If compared to Debbo, how else does this emulator stand out? I'm looking at making an old school, vps hosted, but scripting is a major concern on Debbo. Does Shark also stop scripting?
Modularising the server so you can switch out components, hopefully.
I'll post the db structure tomorrow as a few people already have it.
Here's the database if anyone wants it (it's an old 'stable' version).Code:
/*
Navicat MySQL Data Transfer
Source Server : Redstone
Source Server Version : 50516
Source Host : localhost:3306
Source Database : shark
Target Server Type : MYSQL
Target Server Version : 50516
File Encoding : 65001
Date: 2012-08-07 00:33:55
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for `ban`
-- ----------------------------
DROP TABLE IF EXISTS `ban`;
CREATE TABLE `ban` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`habbo_id` int(10) NOT NULL DEFAULT '0',
`reason` int(10) NOT NULL DEFAULT '0',
`given_by` int(10) NOT NULL DEFAULT '0',
`created_at` datetime DEFAULT NULL,
`expires_at` datetime DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `id` (`id`),
KEY `FK_ban_habbo` (`habbo_id`),
CONSTRAINT `FK_ban_habbo` FOREIGN KEY (`habbo_id`) REFERENCES `habbo` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='a table for bans\r\n';
-- ----------------------------
-- Records of ban
-- ----------------------------
-- ----------------------------
-- Table structure for `friend_request`
-- ----------------------------
DROP TABLE IF EXISTS `friend_request`;
CREATE TABLE `friend_request` (
`id` int(10) NOT NULL DEFAULT '0',
`habbo_id` int(10) NOT NULL DEFAULT '0',
`friend_id` int(10) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
UNIQUE KEY `id` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='handles requests\r\n';
-- ----------------------------
-- Records of friend_request
-- ----------------------------
-- ----------------------------
-- Table structure for `fuserank`
-- ----------------------------
DROP TABLE IF EXISTS `fuserank`;
CREATE TABLE `fuserank` (
`id` int(10) NOT NULL DEFAULT '1',
`name` varchar(20) NOT NULL DEFAULT '1',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='a table for fuserank stuff';
-- ----------------------------
-- Records of fuserank
-- ----------------------------
-- ----------------------------
-- Table structure for `habbo`
-- ----------------------------
DROP TABLE IF EXISTS `habbo`;
CREATE TABLE `habbo` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`username` varchar(50) NOT NULL,
`realname` varchar(256) NOT NULL,
`email` varchar(50) NOT NULL,
`sso_ticket` varchar(128) NOT NULL,
`sso_ip` varchar(128) NOT NULL,
`figure` varchar(256) DEFAULT '1150318001270012900121001',
`motto` varchar(256) DEFAULT 'Shark',
`fuserank` int(1) DEFAULT '1',
`gender` varchar(50) NOT NULL,
`credits` int(255) DEFAULT '100',
`activity_points` int(255) DEFAULT '100',
`last_online` datetime NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `id` (`id`),
UNIQUE KEY `username` (`username`),
UNIQUE KEY `sso_ticket` (`sso_ticket`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1 COMMENT='A table to store habbo data.\r\n';
-- ----------------------------
-- Records of habbo
-- ----------------------------
INSERT INTO `habbo` VALUES ('1', 'adil', '', 'adil@lolcats.net', 'adil', '', '1150318001270012900121001', 'I like cats', '1', 'M', '100', '100', '0000-00-00 00:00:00');
INSERT INTO `habbo` VALUES ('2', 'test', 'test', 'test@asdf.net', 'adil123', '', '1150318001270012900121001', 'Shark', '1', 'M', '100', '100', '0000-00-00 00:00:00');
-- ----------------------------
-- Table structure for `habbo_friend`
-- ----------------------------
DROP TABLE IF EXISTS `habbo_friend`;
CREATE TABLE `habbo_friend` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`habbo_id` int(10) NOT NULL,
`friend_id` int(10) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `id` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 COMMENT='friend table (id: 1 friend of id: 2)';
-- ----------------------------
-- Records of habbo_friend
-- ----------------------------
INSERT INTO `habbo_friend` VALUES ('1', '1', '2');
-- ----------------------------
-- Table structure for `habbo_user`
-- ----------------------------
DROP TABLE IF EXISTS `habbo_user`;
CREATE TABLE `habbo_user` (
`id` int(10) NOT NULL DEFAULT '0',
`user_id` int(10) DEFAULT NULL,
`habbo_id` int(10) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `id` (`id`),
UNIQUE KEY `user_id` (`user_id`),
KEY `FK_habbo_user_habbo` (`habbo_id`),
CONSTRAINT `FK_habbo_user_habbo` FOREIGN KEY (`habbo_id`) REFERENCES `habbo` (`id`),
CONSTRAINT `FK_habbo_user_users` FOREIGN KEY (`user_id`) REFERENCES `users` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='links habbo and users table\r\n';
-- ----------------------------
-- Records of habbo_user
-- ----------------------------
-- ----------------------------
-- Table structure for `users`
-- ----------------------------
DROP TABLE IF EXISTS `users`;
CREATE TABLE `users` (
`user_id` int(11) NOT NULL AUTO_INCREMENT,
`username` varchar(32) NOT NULL,
`email` varchar(50) NOT NULL,
`encrypted_password` varchar(256) NOT NULL,
`gender` enum('F','M') NOT NULL,
`sign_in_counts` int(11) NOT NULL,
`user_ip` varchar(24) NOT NULL,
`last_ip` varchar(24) NOT NULL,
`created_at` datetime NOT NULL,
`last_signed_in_at` datetime NOT NULL,
PRIMARY KEY (`user_id`),
UNIQUE KEY `user_id` (`user_id`),
UNIQUE KEY `username` (`username`),
UNIQUE KEY `email` (`email`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='Generic users table, this is not for in-game stuff, only for web stuff.\r\n';
-- ----------------------------
-- Records of users
-- ----------------------------
Very nice but as far as I am concerned the largest IP you can have will take up 15 spaces (including dots).
The longest e-mail you can have is 256 characters long.
Thanks Chris!
Knowing your coding this Adil, i know there will be great Java frameworks coded into this.