Arcturus 1.9.0 Sourcecode.

This commit is contained in:
capheus 2018-07-06 13:30:00 +00:00
commit b4fc005c18
1645 changed files with 116832 additions and 0 deletions

14
.gitignore vendored Normal file
View File

@ -0,0 +1,14 @@
*.iml
.idea/
target/**
TODO.txt
packet.pkt
plugins/**
src/main/resources/
src/test/
logging/
target/
config.ini
*.txt
logging/**
logging/

45
README.md Normal file
View File

@ -0,0 +1,45 @@
# **Arcturus Emulator is released under the [GNU General Public License v3](https://www.gnu.org/licenses/gpl-3.0.txt). Modifications are allowed but must disclosed. Changes in the about menu are forbidden as they are part of the license.** #
# Arcturus Emulator #
## **To Get The Camera To Work Visit http://arcturus.wf and register.** ##
## **TUTORIAL FOR PLUGINS http://arcturus.wf/thread-2415.html** ##
# **DO NOT EDIT THE SOURCE. USE THE PLUGIN API.** #
## Current Stable Version: 1.9.0 ##
Arcturus Emulator is a Habbo emulator written in Java aiming to be an exact clone of the offical server.
Targeting PRODUCTION-201611291003-338511768
Download SWF: http://arcturus.wf/mirrors/asmd_PRODUCTION-201611291003-338511768.swf
# **Compiled version (Including Database): http://arcturus.wf/mirrors/ArcturusEmulator_1.9.0.zip** #
Latest Compiled Version: http://arcturus.wf:8080
Older Files: http://arcturus.wf/mirrors/
Icons: http://arcturus.wf/mirrors/icons.zip
JavaDoc: http://arcturus.wf/doc/
SCRIPTS for developers: http://arcturus.wf/mirrors/PRODUCTION-201611291003-338511768_scripts.txt
### Contributing ###
Anyone is allowed to contribute to the project. Reporting bugs and issues goes via the issue tracker.
You can request features in the issue tracker.
### Plugins ###
An example plugin can be found here: https://bitbucket.org/Wesley12312/pluginexample
Here is a list of cool plugins you can download:
* Kickwars: https://bitbucket.org/Wesley12312/kickwars-plugin
* Bubble Alerts: https://bitbucket.org/Wesley12312/arcturus-bubble-alerts-plugin
* Essentials: https://bitbucket.org/Wesley12312/arcturus-essentials-plugin
If you want the link to your plugin repository to be added, create an issue.
### Contact ###
* http://arcturus.wf/ | Main forums.

39
examples/RCON.php Normal file
View File

@ -0,0 +1,39 @@
<?php
error_reporting(E_ALL);
$service_port = 3001;
$address = "127.0.0.1";
$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
if ($socket === false) {
echo "socket_create() failed: reason: " . socket_strerror(socket_last_error()) . "\n";
} else {
echo "OK.\n";
}
echo "Attempting to connect to '$address' on port '$service_port'...";
$result = socket_connect($socket, $address, $service_port);
if ($result === false) {
echo "socket_connect() failed.\nReason: ($result) " . socket_strerror(socket_last_error($socket)) . "\n";
} else {
echo "OK.\n";
}
$in =
'{
"key": "hotelalert",
"data": {
"message":"This is an hotel alert!",
"username": "The General"
}
}';
if(socket_write($socket, $in, strlen($in)) === false)
{
echo socket_strerror( socket_last_error($socket) );
}
$out = socket_read($socket, 2048);
echo "Response:" . $out;
?>

166
pom.xml Normal file
View File

@ -0,0 +1,166 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.eu.habbo</groupId>
<artifactId>Habbo</artifactId>
<version>1.10.0</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.4.1</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<mainClass>com.eu.habbo.Emulator</mainClass>
</manifest>
</archive>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>central</id>
<url>http://repo1.maven.org/maven2/</url>
</repository>
</repositories>
<dependencies>
<!-- Netty -->
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-all</artifactId>
<version>4.1.15.Final</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-codec-http</artifactId>
<version>4.1.15.Final</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-codec-http2</artifactId>
<version>4.1.15.Final</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-handler</artifactId>
<version>4.1.15.Final</version>
<scope>compile</scope>
</dependency>
<!-- GSON -->
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.3.1</version>
</dependency>
<!-- MySQL Connector -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.37</version>
<scope>runtime</scope>
</dependency>
<!-- Trove -->
<dependency>
<groupId>net.sf.trove4j</groupId>
<artifactId>trove4j</artifactId>
<version>3.0.3</version>
<scope>compile</scope>
</dependency>
<!-- HikariCP -->
<dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
<version>2.6.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.4</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-math</artifactId>
<version>2.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.8.3</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.32</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.21</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.21</version>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>2.5</version>
</dependency>
</dependencies>
</project>

4
sql-updates.sql Normal file
View File

@ -0,0 +1,4 @@
ALTER TABLE `achievements`
CHANGE COLUMN `pixels` `reward_amount` int(11) NOT NULL DEFAULT 100 AFTER `level`,
ADD COLUMN `reward_currency` int(11) NOT NULL DEFAULT 0 AFTER `level`;

View File

@ -0,0 +1,27 @@
#DATABASE UPDATE: 1.0.10 -> 1.1.0
INSERT INTO `emulator_texts` (`key`, `value`) VALUES
('commands.error.cmd_unmute.not_specified', 'No user specified to unmute!'),
('commands.error.cmd_unmute.not_found', '%user% is not online!'),
('commands.succes.cmd_unmute', '%user% has been unmuted!'),
('commands.keys.cmd_unmute', 'unmute'),
('commands.description.cmd_unmute', ':unmute <username>');
ALTER TABLE `permissions` ADD `cmd_unmute` ENUM( '0', '1' ) NOT NULL DEFAULT '0' AFTER `cmd_unload`;
ALTER TABLE `bans` ADD `timestamp` INT NOT NULL AFTER `user_staff_id`;
ALTER TABLE `permissions` ADD `cmd_give_rank` ENUM( '0', '1' ) NOT NULL DEFAULT '0' AFTER `cmd_gift`;
INSERT INTO`emulator_texts` (`key`, `value`) VALUES
('commands.keys.cmd_give_rank', 'giverank;setrank;give_rank;set_rank'),
('commands.description.cmd_give_rank', ':giverank <username> <rank>'),
('commands.error.cmd_give_rank.not_found', 'Rank %id% was not found!'),
('commands.succes.cmd_give_rank.updated', '%username% has been given the rank %id%'),
('commands.error.cmd_give_rank.higher', 'You cannot rank %username% to a higher rank than you are!'),
('commands.error.cmd_give_rank.user_offline', '%username% is not online!'),
('commands.error.cmd_give_rank.missing_rank', 'Missing rank. Usage: '),
('commands.error.cmd_give_rank.missing_username', 'Missing username. Usage: '),
('commands.generic.cmd_give_rank.new_rank', 'Your rank has been updated. Your rank is now %id%');
#END DATABASE UPDATE: 1.0.10 -> 1.1.0

View File

@ -0,0 +1,79 @@
#DATABASE UPDATE: 1.0.0 -> 1.0.1
#IF YOU GET ERRORS ON THIS PROCEDURE, JUST DROP THE acc_kickwars COLUMN FROM THE permissions TABLE!!
drop procedure if exists drop_acc_kickwars;
delimiter ';;'
create procedure drop_acc_kickwars() begin
if exists (select * from information_schema.columns where table_name = 'permissions' and column_name = 'acc_kickwars') then
alter table permissions drop column `acc_kickwars`;
end if;
end;;
delimiter ';'
call drop_acc_kickwars();
drop procedure if exists drop_acc_kickwars;
INSERT INTO `emulator_settings` (`key`, `value`) VALUES ('hotel.navigator.camera', '1');
ALTER TABLE `navigator_flatcats` ADD `max_user_count` INT( 11 ) NOT NULL DEFAULT '100';
ALTER TABLE `navigator_flatcats` ADD `public` ENUM( '0', '1' ) NOT NULL DEFAULT '0';
DELETE FROM `navigator_flatcats`;
ALTER TABLE `navigator_flatcats` AUTO_INCREMENT = 1;
INSERT INTO `navigator_flatcats` (`id`, `min_rank`, `caption`, `can_trade`, `max_user_count`, `public`) VALUES
(NULL, '1', '${navigator.flatcategory.global.BC}', '0', '100', '0'),
(NULL, '1', '${navigator.flatcategory.global.BUILDING}', '0', '100', '0'),
(NULL, '1', '${navigator.flatcategory.global.CHAT}', '0', '100', '0'),
(NULL, '1', '${navigator.flatcategory.global.FANSITE}', '0', '100', '0'),
(NULL, '1', '${navigator.flatcategory.global.GAMES}', '0', '100', '0'),
(NULL, '1', '${navigator.flatcategory.global.HELP}', '0', '100', '0'),
(NULL, '1', '${navigator.flatcategory.global.LIFE}', '0', '100', '0'),
(NULL, '7', '${navigator.flatcategory.global.OFFICIAL}', '0', '100', '1'),
(NULL, '1', '${navigator.flatcategory.global.PARTY}', '0', '100', '0'),
(NULL, '1', '${navigator.flatcategory.global.PERSONAL}', '0', '100', '0'),
(NULL, '1', '${navigator.flatcategory.global.REVIEWS}', '0', '100', '0'),
(NULL, '1', '${navigator.flatcategory.global.TRADING}', '1', '100', '0');
CREATE TABLE `navigator_publiccats` (
`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`name` VARCHAR( 32 ) NOT NULL DEFAULT 'Staff Picks',
`visible` ENUM( '0', '1' ) NOT NULL DEFAULT '1'
) ENGINE = MYISAM ;
INSERT INTO `navigator_publiccats` (`id`, `name`) VALUES
('1', 'Staff Picks'),
('2', 'Official Games'),
('3', 'Official Fansites'),
('4', 'BAW: Builders at Work'),
('5', 'Room Bundles'),
('6', 'Safety');
DROP TABLE `navigator_publics`;
CREATE TABLE `navigator_publics` (
`public_cat_id` INT NOT NULL ,
`room_id` INT NOT NULL,
`visible` ENUM( '0', '1' ) NOT NULL DEFAULT '1'
) ENGINE = MYISAM ;
CREATE TABLE `navigator_filter` (
`field` VARCHAR( 32 ) NOT NULL ,
`compare` ENUM( 'equals', 'equals_ignore_case', 'contains' ) NOT NULL
) ENGINE = MYISAM ;
INSERT INTO `navigator_filter` (`field`, `compare`) VALUES
('ownerName', 'equals'),
('description', 'contains'),
('name', 'contains'),
('tags', 'equals');
INSERT INTO `emulator_texts` (`key`, `value`) VALUES
('commands.keys.cmd_update_hotel_view', 'update_view;update_hotel_view;update_hotelview'),
('commands.description.cmd_update_hotel_view', ':update_hotel_view'),
('commands.succes.cmd_update_hotel_view', 'Hotelview reloaded!');
ALTER TABLE `permissions` ADD `cmd_update_hotel_view` ENUM( '0', '1' ) NOT NULL DEFAULT '0' AFTER `cmd_update_guildparts`;
#END DATABASE UPDATE 1.0.0 -> 1.0.1

View File

@ -0,0 +1,22 @@
#DATABASE UPDATE: 1.0.1 -> 1.0.2
CREATE TABLE `users_clothing` (
`user_id` INT NOT NULL ,
`clothing_id` INT NOT NULL ,
UNIQUE (
`user_id` ,
`clothing_id`
)
) ENGINE = MYISAM ;
#FILLING PERMISSIONS TABLE TILL RANK 7.
INSERT INTO permissions (id, rank_name) VALUES (1, 'rank_1');
INSERT INTO permissions (id, rank_name) VALUES (2, 'rank_2');
INSERT INTO permissions (id, rank_name) VALUES (3, 'rank_3');
INSERT INTO permissions (id, rank_name) VALUES (4, 'rank_4');
INSERT INTO permissions (id, rank_name) VALUES (5, 'rank_5');
INSERT INTO permissions (id, rank_name) VALUES (6, 'rank_6');
INSERT INTO permissions (id, rank_name) VALUES (7, 'rank_7');
#END DATABASE UPDATE: 1.0.1 -> 1.0.2

View File

@ -0,0 +1,9 @@
#DATABASE UPDATE: 1.0.2 -> 1.0.3
INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('commands.succes.cmd_bundle', 'Roombundle succesfully created with page id %id%');
ALTER TABLE `users_settings` CHANGE `can_trade` `can_trade` ENUM( '0', '1' ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT '1';
UPDATE `users_settings` SET `can_trade` = '1';
ALTER TABLE `rooms` ADD `trade_mode` INT NOT NULL DEFAULT '2';
ALTER TABLE `permissions` ADD `acc_trade_anywhere` ENUM( '0', '1' ) NOT NULL DEFAULT '0';
#END DATABASE UPDATE: 1.0.2 -> 1.0.3

View File

@ -0,0 +1,12 @@
#DATABASE UPDATE: 1.0.3 -> 1.0.4
ALTER TABLE `navigator_publiccats` ADD `image` ENUM( '0', '1' ) NOT NULL DEFAULT '0' AFTER `name`;
ALTER IGNORE TABLE pet_breeds
ADD UNIQUE INDEX idx_name (race, color_one, color_two, has_color_one, has_color_two);
#Removing favourite guilds for deleted guilds:
UPDATE users_settings SET guild_id = 0 WHERE guild_id NOT IN (SELECT id FROM guilds) and guild_id > 0;
UPDATE achievements SET category = 'explore' WHERE name LIKE 'CameraPhotoCount';
#END DATABASE UPDATE: 1.0.3 -> 1.0.4

View File

@ -0,0 +1,54 @@
#DATABASE UPDATE: 1.0.4 -> 1.0.5
INSERT INTO emulator_settings (`key`, `value`) VALUES
('camera.enabled', '1'),
('camera.price.credits', '100'),
('camera.price.points', '100'),
('camera.price.points.publish', '1000'),
('camera.item_id', '23425'),
('camera.extradata', '{"t":%timestamp%, "u":"%id%", "s":%room_id%, "w":"%url%"}'),
('hotel.navigator.search.maxresults', '35'),
('hotel.rooms.max.favorite', '30');
INSERT INTO `emulator_texts` (`key`, `value`) VALUES
('commands.error.cmd_kick.unkickable', '%username% is unkickable!'),
('camera.disabled', 'Sorry! Camera is disabled :(');
DROP TABLE navigator_filter;
CREATE TABLE IF NOT EXISTS `navigator_filter` (
`key` varchar(11) NOT NULL,
`field` varchar(32) NOT NULL,
`compare` enum('equals','equals_ignore_case','contains') NOT NULL,
`database_query` varchar(256) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
INSERT INTO `navigator_filter` (`key`, `field`, `compare`, `database_query`) VALUES
('owner', 'getOwnerName', 'equals_ignore_case', 'SELECT * FROM rooms WHERE owner_name LIKE ?'),
('anything', 'filterAnything', 'contains', 'SELECT rooms.* FROM rooms INNER JOIN guilds ON rooms.guild_id = guilds.id = WHERE CONCAT(rooms.owner_name, rooms.name, rooms.description, rooms.tags, guilds.name, guilds.description) LIKE ?'),
('roomname', 'getName', 'equals_ignore_case', 'SELECT * FROM rooms WHERE name LIKE ?'),
('tag', 'getTags', 'equals', 'SELECT * FROM rooms WHERE tags LIKE ?'),
('group', 'getGuildName', 'contains', 'SELECT rooms.* FROM guilds INNER JOIN rooms ON guilds.room_id = rooms.id WHERE CONCAT(guilds.name, guilds.description) LIKE ?'),
('desc', 'getDescription', 'contains', 'SELECT * FROM rooms WHERE description LIKE ?'),
('promo', 'getPromotionDesc', 'contains', 'SELECT rooms.* FROM rooms INNER JOIN room_promotions ON rooms.id = room_promotions.id WHERE room_promotions.end_timestamp >= UNIX_TIMESTAMP() AND CONCAT (room_promotions.title, room_promotions.description) LIKE ?');
ALTER TABLE `rooms` ADD `users` INT NOT NULL DEFAULT '0' AFTER `state`;
CREATE TABLE `users_favorite_rooms` (
`user_id` INT NOT NULL ,
`room_id` INT NOT NULL ,
UNIQUE (
`user_id` ,
`room_id`
)
) ENGINE = MYISAM ;
ALTER TABLE `catalog_pages` CHANGE `page_headline` `page_headline` TEXT CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT '';
ALTER TABLE `catalog_pages` CHANGE `page_teaser` `page_teaser` TEXT CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT '';
ALTER TABLE `catalog_pages` CHANGE `page_special` `page_special` TEXT CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT '';
ALTER TABLE `catalog_pages` CHANGE `page_text1` `page_text1` TEXT CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT '';
ALTER TABLE `catalog_pages` CHANGE `page_text2` `page_text2` TEXT CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT '';
ALTER TABLE `catalog_pages` CHANGE `page_text_details` `page_text_details` TEXT CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT '';
ALTER TABLE `catalog_pages` CHANGE `page_text_teaser` `page_text_teaser` TEXT CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT '';
#END DATABASE UPDATE: 1.0.4 -> 1.0.5

View File

@ -0,0 +1,12 @@
#DATABASE UPDATE: 1.0.5 -> 1.0.6
INSERT INTO `emulator_settings` (`key`, `value`) VALUES
('catalog.guild.price', '10');
ALTER TABLE `permissions` ADD `cmd_update_navigator` ENUM( '0', '1' ) NOT NULL DEFAULT '0' AFTER `cmd_update_items`;
INSERT INTO `emulator_texts` (`key`, `value`) VALUES
('commands.keys.cmd_update_navigator', 'update_navigator;update_nav'),
('commands.succes.cmd_update_navigator', 'Navigator succesfully reloaded!');
#END DATABASE UPDATE: 1.0.5 -> 1.0.6

View File

@ -0,0 +1,6 @@
#DATABASE UPDATE: 1.0.6 -> 1.0.7
ALTER TABLE `permissions` ADD `acc_update_notifications` ENUM( '0', '1' ) NOT NULL DEFAULT '0';
DELETE FROM emulator_settings WHERE `key` LIKE 'emulator.version';
#END DATABASE UPDATE: 1.0.5 -> 1.0.6

View File

@ -0,0 +1,176 @@
#DATABASE UPDATE: 1.0.7 -> 1.0.8
DROP TABLE `crafting_recipes`;
CREATE TABLE IF NOT EXISTS `crafting_altars_recipes` (
`altar_id` int(11) NOT NULL,
`recipe_id` int(11) NOT NULL,
UNIQUE KEY `altar_id` (`altar_id`,`recipe_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
INSERT INTO `crafting_altars_recipes` (`altar_id`, `recipe_id`) VALUES
(22319, 1),
(22319, 2),
(22319, 3),
(22319, 4),
(22319, 5),
(22319, 6),
(22319, 7),
(22319, 8),
(22319, 9),
(22319, 10),
(22319, 11),
(22319, 12),
(22319, 13),
(22319, 14),
(22319, 15),
(22319, 16),
(22319, 17),
(22319, 18),
(22319, 19),
(22319, 20),
(22319, 21),
(22319, 22),
(22319, 23),
(22319, 24);
CREATE TABLE IF NOT EXISTS `crafting_recipes` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`product_name` varchar(32) NOT NULL COMMENT 'WARNING! This field must match a entry in your productdata or crafting WILL NOT WORK!',
`reward` int(11) NOT NULL,
`enabled` enum('0','1') NOT NULL DEFAULT '1',
`achievement` varchar(255) NOT NULL DEFAULT '',
`secret` enum('0','1') NOT NULL DEFAULT '1',
`limited` enum('0','1') NOT NULL DEFAULT '0',
`remaining` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
UNIQUE KEY `id` (`id`),
UNIQUE KEY `name` (`product_name`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=25 ;
INSERT INTO `crafting_recipes` (`id`, `product_name`, `reward`, `enabled`, `achievement`, `secret`, `limited`, `remaining`) VALUES
(1, 'clothing_firehelm', 22273, '1', '', '0', '0', 0),
(2, 'clothing_airhelm', 22271, '1', '', '0', '0', 0),
(3, 'clothing_waterhelm', 22267, '1', '', '0', '0', 0),
(4, 'clothing_earthhelm', 22277, '1', '', '0', '0', 0),
(5, 'hween_c15_purecrystal2', 22294, '1', '', '1', '0', 0),
(6, 'hween_c15_purecrystal3', 22304, '1', '', '1', '0', 0),
(7, 'hween_c15_evilcrystal2', 22293, '1', '', '1', '0', 0),
(8, 'hween_c15_evilcrystal3', 22296, '1', '', '1', '0', 0),
(9, 'gothic_c15_chandelier', 22161, '1', '', '1', '0', 0),
(10, 'hween12_guillotine', 18669, '1', '', '1', '0', 0),
(11, 'hween14_mariachi', 20110, '1', '', '1', '0', 0),
(12, 'hween14_doll3', 20134, '1', '', '1', '0', 0),
(13, 'hween14_doll4', 20135, '1', '', '1', '0', 0),
(14, 'clothing_wavy2', 20217, '1', '', '1', '0', 0),
(15, 'guitar_skull', 22953, '1', '', '1', '0', 0),
(16, 'fxbox_fx152', 20253, '1', '', '1', '0', 0),
(17, 'LT_skull', 17136, '1', '', '1', '0', 0),
(18, 'hween14_skelepieces', 20109, '1', '', '1', '0', 0),
(19, 'hween13_bldtrail', 19231, '1', '', '1', '0', 0),
(20, 'penguin_glow', 16940, '1', '', '1', '0', 0),
(21, 'skullcandle', 15722, '1', '', '1', '0', 0),
(22, 'fxbox_fx125', 20255, '1', '', '1', '0', 0),
(23, 'deadduck', 15723, '1', '', '1', '0', 0),
(24, 'qt_xm10_iceduck', 17670, '1', '', '1', '0', 0);
CREATE TABLE IF NOT EXISTS `crafting_recipes_ingredients` (
`recipe_id` int(11) NOT NULL,
`item_id` int(11) NOT NULL,
`amount` int(11) NOT NULL DEFAULT '1'
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
INSERT INTO `crafting_recipes_ingredients` (`recipe_id`, `item_id`, `amount`) VALUES
(6, 22294, 3),
(5, 22335, 3),
(7, 22301, 3),
(8, 22293, 3),
(2, 22294, 4),
(2, 22304, 4),
(4, 22335, 4),
(4, 22294, 4),
(1, 22304, 4),
(3, 22294, 8),
(9, 17136, 6),
(9, 22293, 1),
(9, 17237, 1),
(9, 17177, 2),
(10, 18248, 2),
(10, 19231, 1),
(10, 18231, 4),
(10, 22296, 1),
(11, 20109, 3),
(11, 22294, 1),
(11, 18022, 1),
(11, 17136, 1),
(12, 20109, 3),
(12, 22294, 1),
(12, 18933, 1),
(13, 20109, 3),
(13, 22294, 1),
(13, 15696, 1),
(14, 22294, 1),
(14, 19800, 1),
(14, 20084, 2),
(15, 18933, 1),
(15, 22335, 1),
(15, 17191, 1),
(16, 18669, 1),
(16, 22296, 1),
(16, 20122, 1),
(17, 15724, 2),
(17, 22335, 1),
(18, 22335, 1),
(18, 15723, 3),
(19, 15723, 2),
(19, 22335, 1),
(20, 22293, 1),
(20, 16893, 1),
(20, 16924, 1),
(21, 17136, 1),
(21, 17181, 1),
(22, 18207, 1),
(22, 22293, 1),
(23, 15696, 1),
(24, 15696, 1),
(23, 22301, 1),
(24, 22335, 1);
UPDATE achievements SET category = 'explore' WHERE name LIKE 'CameraPhotoCount';
CREATE TABLE `room_mutes` (
`room_id` INT NOT NULL ,
`user_id` INT NOT NULL ,
`ends` INT NOT NULL
) ENGINE = MYISAM ;
CREATE TABLE `catalog_items_limited` (
`catalog_item_id` INT NOT NULL ,
`number` INT NOT NULL ,
`user_id` INT NOT NULL DEFAULT '0',
`timestamp` INT NOT NULL DEFAULT '0',
`item_id` INT NOT NULL DEFAULT '0',
UNIQUE (
`catalog_item_id` ,
`number`
)
) ENGINE = MYISAM ;
ALTER TABLE `items_crackable` CHANGE `prizes` `prizes` VARCHAR( 255 ) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COMMENT 'Used in the format of item_id:chance;item_id_2:chance. item_id must be id in the items_base table. Default value for chance is 100.';
INSERT INTO `emulator_settings` (`key`, `value`) VALUES ('hotel.trading.enabled', '1');
INSERT INTO `emulator_settings` (`key`, `value`) VALUES ('hotel.catalog.recycler.enabled', '1');
INSERT INTO `emulator_settings` (`key`, `value`) VALUES ('debug.show.errors', '1');
INSERT INTO `emulator_settings` (`key`, `value`) VALUES ('hotel.wired.furni.selection.count', '5');
UPDATE `emulator_settings` SET `key` = 'hotel.catalog.discounts.amount' WHERE `emulator_settings`.`key` = 'hotel.catalogue.discounts.amount';
DELETE FROM emulator_settings WHERE `key` LIKE 'emulator.log%';
CREATE TABLE IF NOT EXISTS `users_recipes` (
`user_id` int(11) NOT NULL,
`recipe` int(11) NOT NULL,
UNIQUE KEY `user_id` (`user_id`,`recipe`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
#END DATABASE UPDATE: 1.0.7 -> 1.0.8

View File

@ -0,0 +1,134 @@
#DATABASE UPDATE: 1.0.8 -> 1.0.9
INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('commands.description.cmd_plugins', ':plugins');
INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('commands.description.cmd_massbadge', ':massbadge <badge>');
INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('commands.description.cmd_update_bots', ':update_bots');
INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('commands.description.cmd_update_navigator', ':update_navigator');
ALTER TABLE `bans` ADD `type` ENUM( 'account', 'ip', 'machine', 'super' ) NOT NULL DEFAULT 'account';
ALTER TABLE `bans` ADD `ip` VARCHAR( 50 ) NOT NULL DEFAULT '' AFTER `user_id`;
ALTER TABLE `bans` ADD `machine_id` VARCHAR( 255 ) NOT NULL AFTER `ip`;
ALTER TABLE `bans` CHANGE `type` `type` ENUM( 'account', 'ip', 'machine', 'super' ) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT 'account' COMMENT 'Account is the entry in the users table banned.
IP is any client that connects with that IP.
Machine is the computer that logged in.
Super is all of the above.';
ALTER TABLE `permissions` ADD `cmd_ip_ban` ENUM( '0', '1' ) NOT NULL DEFAULT '0' AFTER `cmd_ha`;
ALTER TABLE `permissions` ADD `cmd_machine_ban` ENUM( '0', '1' ) NOT NULL DEFAULT '0' AFTER `cmd_ip_ban`;
ALTER TABLE `permissions` ADD `cmd_super_ban` ENUM( '0', '1' ) NOT NULL DEFAULT '0' AFTER `cmd_summonrank`;
INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('commands.keys.cmd_ip_ban', 'ipban;banip;ip_ban;ban_ip'), ('commands.description.cmd_ip_ban', ':ipban <username> [reason]');
INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('commands.keys.cmd_machine_ban', 'machineban;banmachine;banmac;macban'), ('commands.description.cmd_machine_ban', ':machineban <username> [reason]');
INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('commands.keys.cmd_super_ban', 'superban;megaban'), ('commands.description.cmd_super_ban', ':superban <username> [reason]');
INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('commands.succes.cmd_machine_ban', '%count% accounts have been MAC banned!');
INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('commands.succes.cmd_ip_ban', '%count% accounts have been IP banned!');
INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('commands.succes.cmd_super_ban', '%count% accounts have been Super banned!');
INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('commands.error.cmd_ip_ban.ban_self', 'You cannot IP Ban yourself!');
INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('commands.error.cmd_machine_ban.ban_self', 'You cannot issue yourself a MAC Ban!');
INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('commands.error.cmd_super_ban.ban_self', 'You cannot superban yourself!');
ALTER TABLE `items` CHANGE `extra_data` `extra_data` VARCHAR(1024) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT '';
INSERT INTO `emulator_settings` (`key`, `value`) VALUES ('runtime.threads', '8');
INSERT INTO `emulator_settings` (`key`, `value`) VALUES ('io.bossgroup.threads', '1');
INSERT INTO `emulator_settings` (`key`, `value`) VALUES ('io.workergroup.threads', '5');
INSERT INTO `emulator_settings` (`key`, `value`) VALUES ('hotel.teleport.locked.allowed', '1');
ALTER TABLE `users` CHANGE `ip_register` `ip_register` VARCHAR( 45 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,
CHANGE `ip_current` `ip_current` VARCHAR( 45 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;
ALTER TABLE `items` CHANGE `z` `z` DOUBLE( 10, 5 ) NOT NULL DEFAULT '0.0';
ALTER TABLE `catalog_pages` ADD `includes` VARCHAR( 32 ) NOT NULL DEFAULT '' COMMENT 'Example usage: 1;2;3
This will include page 1, 2 and 3 in the current page.
Note that permissions are only used for the current entry.';
INSERT INTO `emulator_settings` (`key`, `value`) VALUES ('pathfinder.step.maximum.height', '1.1');
INSERT INTO `emulator_settings` (`key`, `value`) VALUES ('pathfinder.step.allow.falling', '1');
ALTER TABLE `guilds`
ADD `forum` ENUM( '0', '1' ) NOT NULL DEFAULT '0',
ADD `read_forum` ENUM( 'EVERYONE', 'MEMBERS', 'ADMINS' ) NOT NULL DEFAULT 'EVERYONE',
ADD `post_messages` ENUM( 'EVERYONE', 'MEMBERS', 'ADMINS', 'OWNER' ) NOT NULL DEFAULT 'EVERYONE',
ADD `post_threads` ENUM( 'EVERYONE', 'MEMBERS', 'ADMINS', 'OWNER' ) NOT NULL DEFAULT 'EVERYONE',
ADD `mod_forum` ENUM( 'ADMINS', 'OWNER' ) NOT NULL DEFAULT 'ADMINS';
CREATE TABLE `guilds_forums` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`guild_id` int(11) NOT NULL,
`user_id` int(11) NOT NULL,
`subject` mediumtext NOT NULL,
`message` longtext NOT NULL,
`state` enum('OPEN','CLOSED','HIDDEN_BY_ADMIN','HIDDEN_BY_STAFF') NOT NULL DEFAULT 'OPEN',
`admin_id` int(11) NOT NULL DEFAULT '0',
`pinned` enum('0','1') NOT NULL DEFAULT '0',
`locked` enum('0','1') NOT NULL DEFAULT '0',
`timestamp` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=latin1;
CREATE TABLE `guilds_forums_comments` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`thread_id` int(11) NOT NULL,
`user_id` int(11) NOT NULL,
`timestamp` int(11) NOT NULL,
`message` longtext NOT NULL,
`state` enum('OPEN','CLOSED','HIDDEN_BY_ADMIN','HIDDEN_BY_STAFF') NOT NULL DEFAULT 'OPEN',
`admin_id` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=latin1;
INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('commands.succes.cmd_alert.cmd_connect_camera', 'Camera reconnected!');
INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('commands.keys.cmd_connect_camera', 'connectcamera;connect_camera;cameraconnect');
ALTER TABLE `permissions` ADD `cmd_connect_camera` ENUM( '0', '1' ) NOT NULL DEFAULT '0' AFTER `cmd_commands`;
INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('commands.error.cmd_disconnect.higher_rank', 'The Habbo you wanted to disconnect is more important than you are.');
ALTER TABLE `catalog_pages` CHANGE `page_layout` `page_layout` ENUM(
'default_3x3', 'club_buy', 'club_gift', 'frontpage', 'spaces', 'recycler', 'recycler_info',
'recycler_prizes', 'trophies', 'marketplace', 'marketplace_own_items', 'pets',
'spaces_new', 'soundmachine', 'guilds', 'guild_furni', 'info_duckets', 'info_rentables',
'info_pets', 'roomads', 'single_bundle', 'sold_ltd_items', 'badge_display', 'bots', 'pets2',
'pets3', 'room_bundle', 'recent_purchases', 'pets2', 'pets3', 'default_3x3_color_grouping',
'guild_forum', 'vip_buy', 'loyalty_info', 'loyalty_vip_buy', 'collectibles' ) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT 'default_3x3';
INSERT INTO `emulator_settings` (`key`, `value`) VALUES ('hotel.rooms.handitem.time', '100');
ALTER TABLE `permissions` ADD `cmd_diagonal` ENUM( '0', '1' ) NOT NULL DEFAULT '1' AFTER `cmd_danceall`;
INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('commands.keys.cmd_diagonal', 'diagonal;disablediagonal;diagonally'), ('commands.description.cmd_diagonal', ':diagonal');
ALTER TABLE `rooms` ADD `move_diagonally` ENUM( '0', '1' ) NOT NULL DEFAULT '1';
INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('commands.succes.cmd_diagonal.disabled', 'You can no longer walk diagonally!'), ('commands.succes.cmd_diagonal.disabled', 'You can now walk diagonally!');
CREATE TABLE `youtube_items` (
`id` INT NOT NULL ,
`video` VARCHAR( 128 ) NOT NULL ,
`title` VARCHAR( 128 ) NOT NULL ,
`description` VARCHAR( 128 ) NOT NULL ,
`start_time` INT( 5 ) NOT NULL DEFAULT '0',
`end_time` INT( 5 ) NOT NULL DEFAULT '0'
) ENGINE = MYISAM ;
CREATE TABLE `youtube_playlists` (
`item_id` INT NOT NULL ,
`video_id` INT NOT NULL ,
`order` INT NOT NULL ,
UNIQUE (
`item_id` ,
`video_id` ,
`order`
)
) ENGINE = MYISAM ;
ALTER TABLE `youtube_items` ADD PRIMARY KEY ( `id` );
ALTER TABLE `youtube_items` CHANGE `id` `id` INT( 11 ) NOT NULL AUTO_INCREMENT;
INSERT INTO `emulator_settings` (
`key` ,
`value`
)
VALUES (
'imager.url.youtube', 'imager.php?url=http://img.youtube.com/vi/%video%/default.jpg'
);
ALTER TABLE `permissions` ADD `room_effect` INT NOT NULL DEFAULT '0' AFTER `rank_name`;
#END DATABASE UPDATE: 1.0.8 -> 1.0.9

View File

@ -0,0 +1,92 @@
#DATABASE UPDATE: 1.0.9 -> 1.0.10
ALTER TABLE `polls_questions` ADD `parent_id` INT( 11 ) NOT NULL DEFAULT '0' AFTER `id`;
ALTER TABLE `polls_questions` CHANGE `question_number` `order` INT( 11 ) NOT NULL;
ALTER TABLE `permissions` ADD `cmd_word_quiz` ENUM( '0', '1' ) NOT NULL DEFAULT '0' AFTER `cmd_userinfo`;
INSERT INTO `emulator_texts` (`key`, `value`) VALUES
('commands.keys.cmd_word_quiz', 'wordquiz;quiz'),
('commands.description.cmd_word_quiz', ':wordquiz <question>');
INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('scripter.warning.marketplace.forbidden', '%username% tried to sell an %itemname% for %credits% which is not allowed to be sold on the marketplace!');
ALTER TABLE `permissions`
ADD `acc_helper_use_guide_tool` ENUM('0','1') NOT NULL DEFAULT '0',
ADD `acc_helper_give_guide_tours` ENUM('0','1') NOT NULL DEFAULT '0',
ADD `acc_helper_judge_chat_reviews` ENUM('0','1') NOT NULL DEFAULT '0';
ALTER TABLE `achievements_talents` ADD `reward_badges` VARCHAR( 100 ) NOT NULL DEFAULT '';
ALTER TABLE `pet_actions` ADD `pet_name` VARCHAR( 32 ) NOT NULL AFTER `pet_type`;
CREATE TABLE `pet_breeding` (
`pet_id` INT( 2 ) NOT NULL ,
`offspring_id` INT( 2 ) NOT NULL
) ENGINE = MYISAM ;
CREATE TABLE `pet_breeding_races` (
`pet_type` INT( 2 ) NOT NULL ,
`rarity_level` INT( 2 ) NOT NULL ,
`breed` INT( 2 ) NOT NULL
) ENGINE = MYISAM ;
ALTER TABLE `users_settings` ADD `talent_track_citizenship_level` INT( 2 ) NOT NULL DEFAULT '0',
ADD `talent_track_helpers_level` INT( 2 ) NOT NULL DEFAULT '0';
INSERT INTO `emulator_settings` (`key`, `value`) VALUES ('hotel.navigator.popular.amount', '35');
INSERT INTO `emulator_settings` (`key`, `value`) VALUES ('hotel.navigator.popular.listtype', '1');
INSERT INTO `emulator_settings` (`key`, `value`) VALUES ('inventory.max.items', '7500');
INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('inventory.full', 'You''ve reached the inventory limit. Move furniture out of your inventory before buying more!');
ALTER TABLE `navigator_flatcats` ADD `list_type` INT NOT NULL DEFAULT '0' COMMENT 'Display mode in the navigator. 0 for list, 1 for thumbnails.';
INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('commands.error.cmd_setmax.invalid_number', 'Invalid number. Specify a number between 0 and 9999'), ('commands.error.cmd_setmax.forgot_number', 'No number specified. Dork.');
INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('commands.keys.cmd_setmax', 'setmax;set_max'), ('commands.description.cmd_setmax', ':setmax <amount>'), ('commands.description.cmd_staffalert', ':sA <message>');
ALTER TABLE `permissions` ADD `cmd_setmax` ENUM( '0', '1' ) NOT NULL DEFAULT '0' AFTER `cmd_say_all`;
ALTER TABLE `catalog_pages` ADD `room_id` INT( 11 ) NOT NULL DEFAULT '0';
ALTER TABLE `permissions` ADD `cmd_take_badge` ENUM( '0', '1' ) NOT NULL DEFAULT '0' AFTER `cmd_superpull`;
INSERT INTO `emulator_texts` (`key`, `value`) VALUES
('commands.description.cmd_take_badge', ':takebadge <username> <badge>'),
('commands.keys.cmd_take_badge', 'takebadge;take_badge;remove_badge;removebadge'),
('commands.error.cmd_take_badge.forgot_badge', 'No badge specified!'),
('commands.error.cmd_take_badge.forgot_username', 'No username specified!'),
('commands.error.cmd_take_badge.no_badge', '%username% does not have %badge%!'),
('commands.succes.cmd_take_badge', 'Badge has been taken!');
ALTER TABLE `permissions`
ADD `acc_floorplan_editor` ENUM( '0', '1' ) NOT NULL DEFAULT '0',
ADD `acc_camera` ENUM( '0', '1' ) NOT NULL DEFAULT '0';
INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('camera.permission', 'You don''t have permission to use the camera!');
INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('floorplan.permission', 'You don''t have permission to use the floorplan editor!');
ALTER TABLE `room_wordfilter` CHANGE `word` `word` VARCHAR( 25 ) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL;
INSERT INTO `emulator_texts` (`key`, `value`) VALUES
('commands.keys.cmd_update_polls', 'update_polls;reload_polls'),
('commands.description.cmd_update_polls', ':update_polls'),
('commands.keys.cmd_set_poll', 'setpoll;set_poll'),
('commands.description.cmd_set_poll', ':setpoll <id>'),
('commands.succes.cmd_set_poll', 'Room poll has been updated!'),
('commands.error.cmd_set_poll.invalid_number', 'Please specify a valid number. Use 0 to remove the poll.'),
('commands.error.cmd_set_poll.missing_arg', 'Missing poll id. Use 0 to remove the poll from this room.'),
('commands.keys.cmd_roomcredits', 'roomcredits;room_credits;roomcoins;room_coins'),
('commands.description.cmd_roomcredits', ':roomcredits <amount>'),
('commands.keys.cmd_roompixels', 'roompixels;room_pixels;roomduckets;room_duckets'),
('commands.description.cmd_roompixels', ':roompixels <amount>'),
('commands.keys.cmd_roompoints', 'roompoints;room_points'),
('commands.description.cmd_roompoints', ':roompoints <amount>'),
('commands.keys.cmd_roomgift', 'roomgift;room_gift'),
('commands.description.cmd_roomgift', ':roomgift <item_id> [message]'),
('commands.succes.cmd_update_polls', 'Room polls have been reloaded!'),
('commands.error.cmd_set_poll.not_found', 'Poll %id% not found!');
ALTER TABLE `permissions` ADD `cmd_set_poll` ENUM( '0', '1' ) NOT NULL DEFAULT '0' AFTER `cmd_setmax`;
ALTER TABLE `permissions` ADD `cmd_update_polls` ENUM( '0', '1' ) NOT NULL DEFAULT '0' AFTER `cmd_update_plugins`;
ALTER TABLE `permissions` ADD `cmd_roomcredits` ENUM( '0', '1' ) NOT NULL DEFAULT '0' AFTER `cmd_redeem`;
ALTER TABLE `permissions` ADD `cmd_roompixels` ENUM( '0', '1' ) NOT NULL DEFAULT '0' AFTER `cmd_roomitem` , ADD `cmd_roompoints` ENUM( '0', '1' ) NOT NULL DEFAULT '0' AFTER `cmd_roompixels`;
ALTER TABLE `permissions` ADD `cmd_roomgift` ENUM( '0', '1' ) NOT NULL DEFAULT '0' AFTER `cmd_roomeffect`;
#END DATABASE UPDATE: 1.0.9 -> 1.0.10

View File

@ -0,0 +1,21 @@
#DATABASE UPDATE: 1.1.0 -> 1.2.0
INSERT INTO `emulator_texts` (`key`, `value`) VALUES
('commands.keys.cmd_roommute', 'roommute;room_mute'),
('commands.description.cmd_roommute', ':roommute'),
('commands.succes.cmd_roommute.unmuted', 'The room has been unmuted!'),
('commands.succes.cmd_roommute.muted', 'The room has been muted!'),
('commands.keys.cmd_lay', 'lay'),
('commands.description.cmd_lay', ':lay');
#This is your backup table. Just incase you mess things up.
CREATE TABLE catalog_pages_1_1_0 SELECT * FROM catalog_pages;
ALTER TABLE `catalog_pages` CHANGE `page_layout` `page_layout` ENUM('default_3x3','club_buy','club_gift','frontpage','spaces','recycler','recycler_info','recycler_prizes','trophies','plasto','marketplace','marketplace_own_items','pets','spaces_new','soundmachine','guilds','guild_furni','info_duckets','info_rentables','info_pets','roomads','single_bundle','sold_ltd_items','badge_display','bots','pets2','pets3','productpage1','room_bundle','recent_purchases','default_3x3_color_grouping','guild_forum','vip_buy','info_loyalty','loyalty_vip_buy','collectibles','frontpage_featured') CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT 'default_3x3';
INSERT INTO `catalog_pages` (`id`, `parent_id`, `caption_save`, `caption`, `icon_color`, `icon_image`, `visible`, `enabled`, `min_rank`, `club_only`, `order_num`, `page_layout`, `page_headline`, `page_teaser`, `page_special`, `page_text1`, `page_text2`, `page_text_details`, `page_text_teaser`, `vip_only`, `includes`, `room_id`) VALUES (NULL, '-1', 'furni', 'Furni', '1', '1', '1', '0', '1', '0', '1', 'default_3x3', '', '', '', '', '', '', '', '0', '', '0');
UPDATE catalog_pages, (SELECT id FROM catalog_pages ORDER BY id DESC LIMIT 1) new_id SET parent_id = new_id.id WHERE parent_id = -1;
UPDATE catalog_pages SET parent_id = -1, page_layout = 'frontpage_featured' WHERE caption LIKE 'frontpage';
UPDATE catalog_pages SET parent_id = -1 ORDER BY id DESC LIMIT 1;
#END DATABASE UPDATE: 1.1.0 -> 1.2.0

View File

@ -0,0 +1,58 @@
#DATABASE UPDATE: 1.2.0 -> 1.3.0
INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('camera.wait', 'Please wait %seconds% seconds before making another picture.');
ALTER TABLE `rooms` CHANGE `name` `name` VARCHAR( 50 ) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '';
ALTER TABLE `rooms` CHANGE `description` `description` VARCHAR( 512 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '';
ALTER TABLE `rooms` CHANGE `password` `password` VARCHAR( 20 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '';
UPDATE `items_base` SET `interaction_type` = 'switch' WHERE `item_name` LIKE 'wf_floor_switch%';
INSERT INTO `emulator_settings` (`key`, `value`) VALUES ('hotel.bot.chat.minimum.interval', '5');
DELETE FROM `emulator_settings` WHERE `key` LIKE 'hotel.home.room';
INSERT INTO `emulator_settings` (`key`, `value`) VALUES ('hotel.home.room', '0');
ALTER TABLE `users` CHANGE `ip_current` `ip_current` VARCHAR( 45 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT 'Have your CMS update this IP. If you do not do this IP banning won''t work!';
INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('loggedin.elsewhere', 'You have been disconnected as you logged in from somewhere else.');
CREATE TABLE `catalog_featured_pages` (
`slot_id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`image` VARCHAR( 64 ) NOT NULL DEFAULT '',
`caption` VARCHAR( 128 ) NOT NULL DEFAULT '',
`type` ENUM( 'page_name', 'page_id', 'product_name' ) NOT NULL DEFAULT 'page_name',
`expire_timestamp` INT NOT NULL DEFAULT '-1',
`page_name` VARCHAR( 16 ) NOT NULL DEFAULT '',
`page_id` INT NOT NULL DEFAULT '0',
`product_name` VARCHAR( 32 ) NOT NULL DEFAULT ''
) ENGINE = MYISAM ;
INSERT INTO `catalog_featured_pages` (`slot_id`, `image`, `caption`, `type`, `expire_timestamp`, `page_name`, `page_id`, `product_name`) VALUES
('1', 'catalogue/feature_cata_vert_oly16bundle4.png', 'New Olympic 2016 bundle!', 'page_name', '-1', 'olympic_2016', '0', ''),
('2', 'catalogue/feature_cata_hort_habbergerbundle.png', 'Get your own Habbo FASTFOOD restaurant!', 'page_name', '-1', 'fastfood', '0', ''),
('3', 'catalogue/feature_cata_hort_olympic16.png', 'HabboLympix are here!', 'page_name', '-1', 'habbo_lympix', '0', ''),
('4', 'catalogue/feature_cata_hort_HC_b.png', 'Obtain Habbo Club Today!', 'page_name', '-1', 'habbo_club', '0', '');
ALTER TABLE `users_settings` ADD `ignore_bots` ENUM( '0', '1' ) NOT NULL DEFAULT '0',
ADD `ignore_pets` ENUM( '0', '1' ) NOT NULL DEFAULT '0';
INSERT INTO `emulator_texts` (`key`, `value`) VALUES
('commands.keys.cmd_mute_pets', 'mutepets;ignorepets;mute_pets;ignore_pets'),
('commands.succes.cmd_mute_pets.ignored', 'You''re now ignoring pets.'),
('commands.succes.cmd_mute_pets.unignored', 'You''re no longer ignoring pets.'),
('commands.keys.cmd_mute_bots', 'mutebots;ignorebots;mute_bots;ignore_bots'),
('commands.succes.cmd_mute_bots.ignored', 'You are now ignoring bots.'),
('commands.succes.cmd_mute_bots.unignored', 'You are no longer ignoring bots.');
INSERT INTO `emulator_settings` (`key`, `value`) VALUES ('hotel.daily.respect', '3'), ('hotel.daily.respect.pets', '3'), ('hotel.refill.daily', '86400');
CREATE TABLE `commandlogs` (
`user_id` INT NOT NULL ,
`timestamp` INT NOT NULL ,
`command` VARCHAR( 32 ) NOT NULL DEFAULT '',
`params` VARCHAR( 100 ) NOT NULL DEFAULT '',
`succes` ENUM( 'no', 'yes' ) NOT NULL DEFAULT 'yes',
INDEX ( `user_id` )
) ENGINE = MYISAM ;
ALTER TABLE `permissions` ADD `log_commands` ENUM( '0', '1' ) NOT NULL DEFAULT '0' AFTER `room_effect`;
#END DATABASE UPDATE: 1.2.0 -> 1.3.0

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,107 @@
#DATABASE UPDATE: 1.4.0 -> 1.5.0
INSERT INTO `emulator_settings` (`key`, `value`) VALUES ('hotel.bot.butler.servedistance', '5');
UPDATE items_base SET interaction_type = 'fx_box' WHERE item_name LIKE 'fxbox_fx%';
ALTER TABLE `rooms` CHANGE `paper_floor` `paper_floor` VARCHAR(5) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '0';
ALTER TABLE `rooms` CHANGE `paper_wall` `paper_wall` VARCHAR(5) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '0';
ALTER TABLE `rooms` CHANGE `paper_landscape` `paper_landscape` VARCHAR(5) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '0';
ALTER TABLE `permissions` ADD `cmd_transform` ENUM( '0', '1', '2' ) NOT NULL DEFAULT '0' AFTER `cmd_trash`;
ALTER IGNORE TABLE `pet_actions` ADD PRIMARY KEY ( `pet_type` );
ALTER TABLE `pet_actions` CHANGE `pet_type` `pet_type` INT( 2 ) NOT NULL AUTO_INCREMENT;
ALTER TABLE `pet_actions` AUTO_INCREMENT=0;
SET SESSION sql_mode='NO_AUTO_VALUE_ON_ZERO';
INSERT IGNORE INTO `pet_actions` (`pet_type`) VALUES (0), (1), (2), (3), (4), (5), (6), (7), (8), (9), (10), (11), (12), (13), (14), (15), (16), (17), (18), (19), (20), (21), (22), (23), (24), (25), (26), (27), (28), (29), (30), (31), (32), (33), (34), (35);
UPDATE `pet_actions` SET `pet_name` = 'Dog' WHERE `pet_actions`.`pet_type` = 0;
UPDATE `pet_actions` SET `pet_name` = 'Cat' WHERE `pet_actions`.`pet_type` = 1;
UPDATE `pet_actions` SET `pet_name` = 'Crocodile' WHERE `pet_actions`.`pet_type` = 2;
UPDATE `pet_actions` SET `pet_name` = 'Terrier' WHERE `pet_actions`.`pet_type` = 3;
UPDATE `pet_actions` SET `pet_name` = 'Bear' WHERE `pet_actions`.`pet_type` = 4;
UPDATE `pet_actions` SET `pet_name` = 'Pig' WHERE `pet_actions`.`pet_type` = 5;
UPDATE `pet_actions` SET `pet_name` = 'Lion' WHERE `pet_actions`.`pet_type` = 6;
UPDATE `pet_actions` SET `pet_name` = 'Rhino' WHERE `pet_actions`.`pet_type` = 7;
UPDATE `pet_actions` SET `pet_name` = 'Spider' WHERE `pet_actions`.`pet_type` = 8;
UPDATE `pet_actions` SET `pet_name` = 'Turtle' WHERE `pet_actions`.`pet_type` = 9;
UPDATE `pet_actions` SET `pet_name` = 'Chicken' WHERE `pet_actions`.`pet_type` = 10;
UPDATE `pet_actions` SET `pet_name` = 'Frog' WHERE `pet_actions`.`pet_type` = 11;
UPDATE `pet_actions` SET `pet_name` = 'Dragon' WHERE `pet_actions`.`pet_type` = 12;
UPDATE `pet_actions` SET `pet_name` = '' WHERE `pet_actions`.`pet_type` = 13;
UPDATE `pet_actions` SET `pet_name` = 'Monkey' WHERE `pet_actions`.`pet_type` = 14;
UPDATE `pet_actions` SET `pet_name` = 'Horse' WHERE `pet_actions`.`pet_type` = 15;
UPDATE `pet_actions` SET `pet_name` = 'Monsterplant' WHERE `pet_actions`.`pet_type` = 16;
UPDATE `pet_actions` SET `pet_name` = 'Bunny' WHERE `pet_actions`.`pet_type` = 17;
UPDATE `pet_actions` SET `pet_name` = 'Evil Bunny' WHERE `pet_actions`.`pet_type` = 18;
UPDATE `pet_actions` SET `pet_name` = 'Bored Bunny' WHERE `pet_actions`.`pet_type` = 19;
UPDATE `pet_actions` SET `pet_name` = 'Love Bunny' WHERE `pet_actions`.`pet_type` = 20;
UPDATE `pet_actions` SET `pet_name` = 'Wise Pidgeon' WHERE `pet_actions`.`pet_type` = 21;
UPDATE `pet_actions` SET `pet_name` = 'Cunning Pidgeon' WHERE `pet_actions`.`pet_type` = 22;
UPDATE `pet_actions` SET `pet_name` = 'Evil Monkey' WHERE `pet_actions`.`pet_type` = 23;
UPDATE `pet_actions` SET `pet_name` = 'Baby Bear' WHERE `pet_actions`.`pet_type` = 24;
UPDATE `pet_actions` SET `pet_name` = 'Baby Terrier' WHERE `pet_actions`.`pet_type` = 25;
UPDATE `pet_actions` SET `pet_name` = 'Gnome' WHERE `pet_actions`.`pet_type` = 26;
UPDATE `pet_actions` SET `pet_name` = 'Leprechaun' WHERE `pet_actions`.`pet_type` = 27;
UPDATE `pet_actions` SET `pet_name` = 'Baby Cat' WHERE `pet_actions`.`pet_type` = 28;
UPDATE `pet_actions` SET `pet_name` = 'Baby Dog' WHERE `pet_actions`.`pet_type` = 29;
UPDATE `pet_actions` SET `pet_name` = 'Baby Pig' WHERE `pet_actions`.`pet_type` = 30;
UPDATE `pet_actions` SET `pet_name` = 'Haloompa' WHERE `pet_actions`.`pet_type` = 31;
UPDATE `pet_actions` SET `pet_name` = 'Fools' WHERE `pet_actions`.`pet_type` = 32;
UPDATE `pet_actions` SET `pet_name` = 'Pterodactyl' WHERE `pet_actions`.`pet_type` = 33;
UPDATE `pet_actions` SET `pet_name` = 'Velociraptor' WHERE `pet_actions`.`pet_type` = 34;
UPDATE `pet_actions` SET `pet_name` = 'Cow' WHERE `pet_actions`.`pet_type` = 35;
INSERT INTO `pet_breeds` (`race`, `color_one`, `color_two`, `has_color_one`, `has_color_two`) VALUES ('26', '0', '0', '0', '0'), ('27', '0', '0', '0', '0');
ALTER IGNORE TABLE `emulator_texts` ADD PRIMARY KEY(`key`);
INSERT IGNORE INTO `emulator_texts` (`key`, `value`) VALUES
('commands.generic.cmd_transform.title', 'The following pets are available:'),
('commands.generic.cmd_transform.line', '%name%'),
('commands.description.cmd_transform', ':transform <name> <race> <color>'),
('commands.keys.cmd_transform', 'transform;becomepet'),
('commands.description.cmd_connect_camera', ':connectcamera'),
('commands.description.cmd_roompoints', ':roompoints <amount>'),
('commands.description.cmd_setmax', ':setmax <amount>'),
('commands.description.cmd_staffalert', ':sa <message>');
ALTER TABLE `permissions` CHANGE `cmd_bots` `cmd_bots` ENUM( '0', '1', '2' ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '1';
ALTER TABLE `permissions` CHANGE `cmd_control` `cmd_control` ENUM( '0', '1', '2' ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '0';
ALTER TABLE `permissions` CHANGE `cmd_coords` `cmd_coords` ENUM( '0', '1', '2' ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '2';
ALTER TABLE `permissions` CHANGE `cmd_danceall` `cmd_danceall` ENUM( '0', '1', '2' ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '0';
ALTER TABLE `permissions` CHANGE `cmd_diagonal` `cmd_diagonal` ENUM( '0', '1', '2' ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '1';
ALTER TABLE `permissions` CHANGE `cmd_ejectall` `cmd_ejectall` ENUM( '0', '1', '2' ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '2';
ALTER TABLE `permissions` CHANGE `cmd_enable` `cmd_enable` ENUM( '0', '1', '2' ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '1';
ALTER TABLE `permissions` CHANGE `cmd_fastwalk` `cmd_fastwalk` ENUM( '0', '1', '2' ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '0';
ALTER TABLE `permissions` CHANGE `cmd_freeze_bots` `cmd_freeze_bots` ENUM( '0', '1', '2' ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '1';
ALTER TABLE `permissions` CHANGE `cmd_hand_item` `cmd_hand_item` ENUM( '0', '1', '2' ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '1';
ALTER TABLE `permissions` CHANGE `cmd_kickall` `cmd_kickall` ENUM( '0', '1', '2' ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '2';
ALTER TABLE `permissions` CHANGE `cmd_moonwalk` `cmd_moonwalk` ENUM( '0', '1', '2' ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '0';
ALTER TABLE `permissions` CHANGE `cmd_multi` `cmd_multi` ENUM( '0', '1', '2' ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '0';
ALTER TABLE `permissions` CHANGE `cmd_pet_info` `cmd_pet_info` ENUM( '0', '1', '2' ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '2';
ALTER TABLE `permissions` CHANGE `cmd_pull` `cmd_pull` ENUM( '0', '1', '2' ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '0';
ALTER TABLE `permissions` CHANGE `cmd_push` `cmd_push` ENUM('0','1','2') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '0';
ALTER TABLE `permissions` CHANGE `cmd_roomalert` `cmd_roomalert` ENUM('0','1','2') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '0';
ALTER TABLE `permissions` CHANGE `cmd_roomeffect` `cmd_roomeffect` ENUM('0','1','2') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '0';
ALTER TABLE `permissions` CHANGE `cmd_roomitem` `cmd_roomitem` ENUM('0','1','2') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '0';
ALTER TABLE `permissions` CHANGE `cmd_say` `cmd_say` ENUM('0','1','2') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '0';
ALTER TABLE `permissions` CHANGE `cmd_say_all` `cmd_say_all` ENUM('0','1','2') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '0';
ALTER TABLE `permissions` CHANGE `cmd_setmax` `cmd_setmax` ENUM('0','1','2') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '0';
ALTER TABLE `permissions` CHANGE `cmd_setspeed` `cmd_setspeed` ENUM('0','1','2') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '1';
ALTER TABLE `permissions` CHANGE `cmd_shout` `cmd_shout` ENUM('0','1','2') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '0';
ALTER TABLE `permissions` CHANGE `cmd_shout_all` `cmd_shout_all` ENUM('0','1','2') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '0';
ALTER TABLE `permissions` CHANGE `cmd_sitdown` `cmd_sitdown` ENUM('0','1','2') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '0';
ALTER TABLE `permissions` CHANGE `cmd_superpull` `cmd_superpull` ENUM('0','1','2') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '0';
ALTER TABLE `permissions` CHANGE `cmd_teleport` `cmd_teleport` ENUM('0','1','2') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '0';
ALTER TABLE `permissions` CHANGE `cmd_unload` `cmd_unload` ENUM('0','1','2') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '0';
ALTER TABLE `permissions` ADD `cmd_wordquiz` ENUM('0','1','2') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '0';
ALTER TABLE `permissions` CHANGE `acc_unlimited_bots` `acc_unlimited_bots` ENUM( '0', '1', '2' ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '0' COMMENT 'Overrides the bot restriction to the inventory and room.';
ALTER TABLE `permissions` CHANGE `acc_unlimited_pets` `acc_unlimited_pets` ENUM( '0', '1', '2' ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '0' COMMENT 'Overrides the pet restriction to the inventory and room.';
DROP TABLE support_chatlogs;
INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('generic.gift.received.anonymous', 'You''ve received a gift!'), ('generic.gift.received', '%username% gave you a gift!');
ALTER TABLE `emulator_settings` CHANGE `value` `value` VARCHAR( 300 ) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL;
#When changing the query make sure the look, username, id and hof_points are available.
INSERT INTO `emulator_settings` (`key`,`value`) VALUES ('hotelview.halloffame.query', 'SELECT users.look, users.username, users.id, users_settings.hof_points FROM users_settings INNER JOIN users ON users_settings.user_id = users.id WHERE hof_points > 0 ORDER BY hof_points DESC, users.id ASC LIMIT 10');
#END DATABASE UPDATE: 1.4.0 -> 1.5.0

View File

@ -0,0 +1,26 @@
#DATABASE UPDATE: 1.5.0 -> 1.6.0
ALTER TABLE `users` ADD `machine_id` VARCHAR( 64 ) NOT NULL DEFAULT '' AFTER `ip_current`;
INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('generic.user.not_found', '%user% not found.');
INSERT INTO `emulator_settings` (`key`, `value`) VALUES ('hotel.name', 'Habbo Hotel'), ('hotel.player.name', 'Habbo');
UPDATE `emulator_texts` SET `key` = 'commands.succes.cmd_ban.ban_issued' WHERE `emulator_texts`.`key` = 'commands.succes.cmd_about.ban_issued';
INSERT INTO `emulator_settings` (`key`, `value`) VALUES ('catalog.page.vipgifts', '0');
CREATE TABLE `users_achievements_queue` (
`user_id` INT NOT NULL ,
`achievement_id` INT NOT NULL ,
`amount` INT NOT NULL
) ENGINE = MYISAM ;
ALTER TABLE users_achievements_queue ADD UNIQUE `unique_index` (`user_id`, `achievement_id`);
INSERT INTO `emulator_settings` (`key`, `value`) VALUES ('hotel.rollers.speed.maximum', '100');
ALTER TABLE `vouchers` ADD `catalog_item_id` INT NOT NULL DEFAULT '0';
ALTER TABLE `permissions` ADD `cmd_reload_room` ENUM( '0', '1', '2' ) NOT NULL DEFAULT '2' AFTER `cmd_redeem`;
INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('commands.keys.cmd_reload_room', 'reload_room;reload;reloadroom'), ('commands.description.cmd_reload_room', ':reload_room');
ALTER TABLE `bots` ADD `effect` INT( 3 ) NOT NULL DEFAULT '0';
UPDATE `emulator_texts` SET `key` = 'commands.error.cmd_ban.forgot_user' WHERE `emulator_texts`.`key` = 'commands.error.cmd_ban.forgot_message';
#END DATABASE UPDATE: 1.5.0 -> 1.6.0

View File

@ -0,0 +1,22 @@
#DATABASE UPDATE: 1.6.0 -> 1.7.0
INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('scripter.warning.packet.closedice', '%username% tried to change furniture state on non dice using the close dice packet on item %id% %itemname%');
INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('commands.succes.cmd_update_guildparts', 'Succes! Guild badgeparts and guild badge imager has been reloaded!');
INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('ban.info.user_id', 'User ID: '), ('ban.info.type', 'Ban Type: '), ('ban.info.reason', 'Reason: '), ('ban.info.staff_id', 'Staff ID: '), ('ban.info.date_issued', 'Date: '), ('ban.info.date_expire', 'Expire Date: '), ('ban.info.ip', 'IP: '), ('ban.info.machine', 'Machine: ');
INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('command.cmd_userinfo.user_id', 'ID'), ('command.cmd_userinfo.user_name', 'Username'), ('command.cmd_userinfo.motto', 'Motto'), ('command.cmd_userinfo.rank', 'Rank'), ('command.cmd_userinfo.online', 'Online'), ('command.cmd_userinfo.email', 'Email'), ('command.cmd_userinfo.ip_register', 'Register IP'), ('command.cmd_userinfo.ip_current', 'Current IP'), ('command.cmd_userinfo.banned', 'Banned'), ('command.cmd_userinfo.currencies', 'Currencies'), ('command.cmd_userinfo.achievement_score', 'Score'), ('command.cmd_userinfo.credits', 'Credits'), ('command.cmd_userinfo.current_activity', 'Current Activity'), ('command.cmd_userinfo.room', 'Room'), ('command.cmd_userinfo.respect_left', 'Respect Left'), ('command.cmd_userinfo.pet_respect_left', 'Pet Respect Left'), ('command.cmd_userinfo.allow_trade', 'Allow Trade'), ('command.cmd_userinfo.allow_follow', 'Allow Follow'), ('command.cmd_userinfo.allow_friend_request', 'Allow Friend Request'), ('command.cmd_userinfo.total_bans', 'Total bans'), ('command.cmd_userinfo.ban_info', 'Recent Ban Info'), ('command.cmd_userinfo.userinfo', 'Userinfo');
ALTER TABLE `users_wardrobe` CHANGE `look` `look` VARCHAR( 256 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;
UPDATE `items_base` SET `interaction_type` = 'football_goal_blue', stack_height = '0.01' WHERE item_name LIKE 'fball_goal_b';
UPDATE `items_base` SET `interaction_type` = 'football_goal_green', stack_height = '0.01' WHERE item_name LIKE 'fball_goal_g';
UPDATE `items_base` SET `interaction_type` = 'football_goal_red', stack_height = '0.01' WHERE item_name LIKE 'fball_goal_r';
UPDATE `items_base` SET `interaction_type` = 'football_goal_yellow', stack_height = '0.01' WHERE item_name LIKE 'fball_goal_y';
UPDATE `items_base` SET `interaction_type` = 'football_counter_blue' WHERE item_name LIKE 'fball_score_b';
UPDATE `items_base` SET `interaction_type` = 'football_counter_green' WHERE item_name LIKE 'fball_score_g';
UPDATE `items_base` SET `interaction_type` = 'football_counter_red' WHERE item_name LIKE 'fball_score_r';
UPDATE `items_base` SET `interaction_type` = 'football_counter_yellow' WHERE item_name LIKE 'fball_score_y';
UPDATE `items_base` SET `interaction_type` = 'football_gate' WHERE item_name LIKE 'fball_gate';
ALTER TABLE `achievements` CHANGE `pixels` `reward_amount` INT( 11 ) NOT NULL DEFAULT '100';
ALTER TABLE `achievements` ADD `reward_type` INT( 2 ) NOT NULL DEFAULT '0' AFTER `reward_amount`;
#END DATABASE UPDATE: 1.6.0 -> 1.7.0

View File

@ -0,0 +1,100 @@
#DATABASE UPDATE: 1.7.0 -> 1.8.0
INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('commands.error.cmd_pet_info.pet_not_found', '"Please provide a petname!"');
ALTER TABLE `bans` ADD `cfh_topic` INT( 4 ) NOT NULL DEFAULT '-1';
ALTER TABLE `rooms` CHANGE `paper_floor` `paper_floor` VARCHAR( 5 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '0.0';
ALTER TABLE `rooms` CHANGE `paper_wall` `paper_wall` VARCHAR( 5 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '0.0';
ALTER TABLE `rooms` CHANGE `paper_landscape` `paper_landscape` VARCHAR( 5 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '0.0';
UPDATE rooms SET paper_floor = '0.0' WHERE paper_floor = '0';
UPDATE rooms SET paper_wall = '0.0' WHERE paper_wall = '0';
UPDATE rooms SET paper_landscape = '0.0' WHERE paper_landscape = '0';
UPDATE items_base SET interaction_type = item_name WHERE item_name LIKE 'wf_xtra_%';
UPDATE items_base SET interaction_type = item_name WHERE item_name LIKE 'wf_act_move_furni_to';
UPDATE items_base SET allow_walk = '0' WHERE interaction_type LIKE 'gate';
#Thanks Beny
DROP TABLE IF EXISTS `support_cfh_categories`;
CREATE TABLE `support_cfh_categories` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name_internal` varchar(255) DEFAULT NULL,
`name_external` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1;
INSERT INTO `support_cfh_categories` VALUES ('1', 'cyber', 'Cyber sex');
INSERT INTO `support_cfh_categories` VALUES ('2', 'scamming', 'Scamming');
INSERT INTO `support_cfh_categories` VALUES ('3', 'badwords', 'Inappropriate words');
INSERT INTO `support_cfh_categories` VALUES ('4', 'badbehavior', 'Bad behavior');
INSERT INTO `support_cfh_categories` VALUES ('5', 'account', 'Account Issues');
INSERT INTO `support_cfh_categories` VALUES ('6', 'hacking', 'Hacking');
DROP TABLE IF EXISTS `support_cfh_topics`;
CREATE TABLE `support_cfh_topics` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`category_id` int(11) DEFAULT NULL,
`name_internal` varchar(255) DEFAULT NULL,
`name_external` varchar(255) DEFAULT NULL,
`action` enum('mods','auto_ignore','auto_reply') DEFAULT 'mods',
`auto_reply` text DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=33 DEFAULT CHARSET=latin1;
INSERT INTO `support_cfh_topics` VALUES ('1', '1', 'cyber.sextalk', 'Sexual talk', 'auto_ignore', 'Thank you for reporting someone for sexual talk. We have put this user on ignore for you. This means that you can no longer see what they are saying. To turn ignore off for this person you need to click on them and press \'Listen\'. We will take a look at this.');
INSERT INTO `support_cfh_topics` VALUES ('2', '1', 'cyber.asking', 'Asking for cyber sex', 'auto_ignore', 'Thank you for reporting someone for sexual talk. We have put this user on ignore for you. This means that you can no longer see what they are saying. To turn ignore off for this person you need to click on them and press \'Listen\'. We will take a look at this.');
INSERT INTO `support_cfh_topics` VALUES ('3', '1', 'cyber.offering', 'Offering cyber sex', 'auto_ignore', 'Thank you for reporting someone for sexual talk. We have put this user on ignore for you. This means that you can no longer see what they are saying. To turn ignore off for this person you need to click on them and press \'Listen\'. We will take a look at this.');
INSERT INTO `support_cfh_topics` VALUES ('4', '1', 'cyber.porn', 'Sending porn', 'mods', null);
INSERT INTO `support_cfh_topics` VALUES ('5', '2', 'scamming.scamsite', 'Promoting scam sites', 'mods', null);
INSERT INTO `support_cfh_topics` VALUES ('6', '2', 'scamming.sellingirl', 'Selling virtual items for real money', 'mods', null);
INSERT INTO `support_cfh_topics` VALUES ('7', '2', 'scamming.stealingfurni', 'Stealing furni or coins', 'mods', null);
INSERT INTO `support_cfh_topics` VALUES ('8', '2', 'scamming.account', 'Stealing account information', 'mods', null);
INSERT INTO `support_cfh_topics` VALUES ('9', '2', 'scamming.casino', 'Casino scamming', 'auto_reply', 'Habbo does not get involved with the casino community due to cases being complex and hard to track. Players gamble at their own risk. When the fun stops, stop.');
INSERT INTO `support_cfh_topics` VALUES ('10', '3', 'badwords.roomname', 'Room name', 'mods', null);
INSERT INTO `support_cfh_topics` VALUES ('11', '3', 'badwords.roomdesc', 'Room description', 'mods', null);
INSERT INTO `support_cfh_topics` VALUES ('12', '3', 'badwords.username', 'Username', 'mods', null);
INSERT INTO `support_cfh_topics` VALUES ('13', '3', 'badwords.motto', 'Moto', 'mods', null);
INSERT INTO `support_cfh_topics` VALUES ('14', '3', 'badwords.grouporevent', 'Group or event name', 'mods', null);
INSERT INTO `support_cfh_topics` VALUES ('15', '4', 'badbehavior.trolling', 'Trolling', 'auto_reply', 'Thanks for your report. Please call a moderator to the room by following these steps.\r\n1. Under the Help window click on \'Get immediate help\'.\r\n2. Then click on \'Chat to a Moderator\'.\r\n3. Let them know that somebody is trolling in the room.\r\n4. A moderator will open a chat session with you to resolve the problem.');
INSERT INTO `support_cfh_topics` VALUES ('16', '4', 'badbehavior.blocking', 'Blocking', 'auto_reply', 'Thanks for your report. Please call a moderator to the room by following these steps.\r\n1. Under the Help window click on \'Get immediate help\'.\r\n2. Then click on \'Chat to a Moderator\'.\r\n3. Let them know that somebody is blocking in the room.\r\n4. A moderator will open a chat session with you to resolve the problem.');
INSERT INTO `support_cfh_topics` VALUES ('17', '4', 'badbehavior.flooding', 'Flooding', 'auto_reply', 'Thanks for your report. Please call a moderator to the room by following these steps.\r\n1. Under the Help window click on \'Get immediate help\'.\r\n2. Then click on \'Chat to a Moderator\'.\r\n3. Let them know that somebody is flooding the room.\r\n4. A moderator will open a chat session with you to resolve the problem.');
INSERT INTO `support_cfh_topics` VALUES ('18', '4', 'badbehavior.young', 'Too young for Habbo', 'mods', null);
INSERT INTO `support_cfh_topics` VALUES ('19', '4', 'badbehavior.staffimpersonation', 'Staff impersonation', 'mods', null);
INSERT INTO `support_cfh_topics` VALUES ('20', '4', 'badbehavior.offensive', 'Offensive language', 'auto_ignore', 'We have put this user on ignore for you. This means that you can no longer see what they are saying. To turn ignore off for this person you need to click on them and press \'Listen\'');
INSERT INTO `support_cfh_topics` VALUES ('21', '4', 'badbehavior.hate', 'Hate speech', 'auto_ignore', 'We have put this user on ignore for you. This means that you can no longer see what they are saying. To turn ignore off for this person you need to click on them and press \'Listen\'');
INSERT INTO `support_cfh_topics` VALUES ('22', '4', 'badbehavior.violence', 'Violence', 'auto_ignore', 'We have put this user on ignore for you. This means that you can no longer see what they are saying. To turn ignore off for this person you need to click on them and press \'Listen\'');
INSERT INTO `support_cfh_topics` VALUES ('23', '5', 'account.username', 'Change username', 'auto_reply', 'It is currently not possible to change your username in Habbo. When that feature becomes available you\'ll be sure to know! :)');
INSERT INTO `support_cfh_topics` VALUES ('24', '5', 'accunt.payment', 'Payment issues', 'auto_reply', 'Thanks for your report. Unfortunately Game Moderators cannot help with payment issues. Please report your payment issue to us at the help desk on the website where our team of specialists will get back to you.');
INSERT INTO `support_cfh_topics` VALUES ('25', '5', 'account.earn', 'Earn gems', 'auto_reply', 'Thanks for your report. Unfortunately Game Moderators cannot help with payment issues. Please report your payment issue to us at the help desk on the website where our team of specialists will get back to you.');
INSERT INTO `support_cfh_topics` VALUES ('26', '5', 'account.other', 'Something else', 'auto_reply', 'Please use the helpdesk on the website for help with this matter.');
INSERT INTO `support_cfh_topics` VALUES ('27', '6', 'hacking.game', 'Threat to hack Habbo', 'auto_reply', 'We work very hard to ensure that Habbo is safe for all that play. This involves using only the best security technology. We would like to thank you for reporting this to us, but we don\'t think this person is capable of hacking Habbo :)');
INSERT INTO `support_cfh_topics` VALUES ('28', '6', 'hacking.player', 'Threat to hack a player', 'auto_reply', 'There is no way that another Habbo can hack you without knowing your Habbo password or Habbo email address. Please make sure that you are using a secure password which is not easy to remember. We recommend passwords which include letters and numbers such as fl0w3rs. If you wanted to be even more secure you could include a special letter, such as fl0w3r$.\r\n\r\nTo change your Habbo password go to your profile on the website.');
INSERT INTO `support_cfh_topics` VALUES ('29', '6', 'hacking.furni', 'Scripted furniture', 'mods', null);
INSERT INTO `support_cfh_topics` VALUES ('30', '6', 'hacking.room', 'Scripted room', 'mods', null);
INSERT INTO `support_cfh_topics` VALUES ('31', '6', 'hacking.character', 'Scripted character', 'mods', null);
INSERT INTO `support_cfh_topics` VALUES ('32', '6', 'hacking.other', 'Other hacking', 'mods', null);
ALTER TABLE `camera_web` ADD `room_id` INT( 11 ) NOT NULL DEFAULT '0' AFTER `user_id`;
ALTER TABLE `commandlogs` CHANGE `command` `command` VARCHAR( 256 ) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT '';
UPDATE emulator_settings SET `value` = '0' WHERE `key` LIKE 'debug.show.%';
DELETE FROM emulator_errors;
DELETE FROM gift_wrappers;
INSERT INTO gift_wrappers (sprite_id, item_id) SELECT sprite_id, id FROM items_base WHERE item_name LIKE 'present_gen%';
UPDATE gift_wrappers SET type = 'gift';
INSERT INTO gift_wrappers (sprite_id, item_id) SELECT sprite_id, id FROM items_base WHERE item_name LIKE 'present_wrap%';
INSERT INTO `emulator_settings` (`key`, `value`) VALUES
('seasonal.currency.ducket', '0'),
('seasonal.currency.pixel', '0'),
('seasonal.currency.diamond', '5'),
('seasonal.currency.shell', '4'),
('seasonal.currency.names', 'ducket;pixel;shell;diamond');
ALTER TABLE `permissions` ADD `cmd_hal` ENUM( '0', '1' ) NOT NULL DEFAULT '0' AFTER `cmd_ha`;
INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('commands.description.cmd_hal', ':hal <url> <message>'), ('commands.keys.cmd_hal', 'hal;halink');
ALTER TABLE `permissions` ADD `acc_enable_others` ENUM( '0', '1' ) NOT NULL DEFAULT '0' AFTER `acc_empty_others`;
ALTER TABLE `rooms` CHANGE `chat_mode` `chat_mode` INT( 11 ) NOT NULL DEFAULT '0';
UPDATE `emulator_settings` SET `value` = '0' WHERE `emulator_settings`.`key` = 'debug.show.packets';
UPDATE `emulator_settings` SET `value` = '0' WHERE `emulator_settings`.`key` = 'debug.show.packets.undefined';
#END DATABASE UPDATE: 1.7.0 -> 1.8.0

View File

@ -0,0 +1,139 @@
#DATABASE UPDATE: 1.8.0 -> 1.9.0
ALTER TABLE `permissions` ADD `cmd_empty_bots` ENUM( '0', '1' ) NOT NULL DEFAULT '1' AFTER `cmd_empty`;
ALTER TABLE `permissions` ADD `cmd_empty_pets` ENUM( '0', '1' ) NOT NULL DEFAULT '1' AFTER `cmd_empty_bots`;
INSERT INTO `emulator_texts` (`key`, `value`) VALUES
('commands.succes.cmd_empty_bots.cleared', 'Bots inventory cleared!'),
('commands.succes.cmd_empty_bots.verify', 'This will remove all bots from your inventory. Type :emptybots %generic.yes% to continue!'),
('commands.keys.cmd_empty_bots', 'emptybots;empty_bots;deletebots'),
('commands.description.cmd_empty_bots', ':emptybots'),
('commands.succes.cmd_empty_pets.cleared', 'Pets inventory cleared!'),
('commands.succes.cmd_empty_pets.verify', 'This will remove all pets from your inventory. Type :emptypets %generic.yes% to continue!'),
('commands.keys.cmd_empty_pets', 'emptypets;empty_pets;deletepets'),
('commands.description.cmd_empty_pets', ':emptypets');
CREATE TABLE `users_effects` (
`user_id` INT NOT NULL,
`effect` INT(5) NOT NULL,
`duration` INT NOT NULL DEFAULT '86400',
`activation_timestamp` INT NOT NULL DEFAULT '-1',
`total` INT(2) NOT NULL DEFAULT '1',
UNIQUE(user_id, effect)
) ENGINE = MyISAM;
ALTER TABLE `users_settings` CHANGE `talent_track_citizenship_level` `talent_track_citizenship_level` INT( 2 ) NOT NULL DEFAULT '-1',
CHANGE `talent_track_helpers_level` `talent_track_helpers_level` INT( 2 ) NOT NULL DEFAULT '-1';
UPDATE users_settings SET talent_track_citizenship_level = -1;
UPDATE users_settings SET talent_track_helpers_level = -1;
INSERT INTO `emulator_settings` (`key`, `value`) VALUES ('hotel.room.tags.staff', 'staff;official;habbo');
ALTER TABLE `permissions` ADD `acc_room_staff_tags` ENUM( '0', '1' ) NOT NULL DEFAULT '0';
CREATE TABLE `catalog_club_offers` (
`id` INT NOT NULL DEFAULT NULL AUTO_INCREMENT PRIMARY KEY ,
`enabled` ENUM( '0', '1' ) NOT NULL DEFAULT '1',
`name` VARCHAR( 35 ) NOT NULL ,
`days` INT( 7 ) NOT NULL ,
`credits` INT( 5 ) NOT NULL DEFAULT '10',
`points` INT( 5 ) NOT NULL DEFAULT '0',
`points_type` INT( 3 ) NOT NULL DEFAULT '0',
`type` ENUM( 'HC', 'VIP' ) NOT NULL DEFAULT 'HC',
`deal` ENUM( '0', '1' ) NOT NULL DEFAULT '0'
) ENGINE = MYISAM ;
INSERT INTO `catalog_club_offers` (`id`, `enabled`, `name`, `days`, `credits`, `points`, `points_type`, `type`, `deal`) VALUES
(NULL, '1', 'HABBO_CLUB_7_DAY', '7', '5', '0', '0', 'VIP', '0'),
(NULL, '1', 'HABBO_CLUB_1_MONTH', '31', '20', '0', '0', 'VIP', '0');
UPDATE catalog_pages SET page_layout = 'vip_buy' WHERE page_layout = 'club_buy';
ALTER TABLE `support_cfh_topics` ADD `ignore_target` ENUM( '0', '1' ) NOT NULL DEFAULT '0' AFTER `action`;
ALTER TABLE `users_settings` ADD `nux` ENUM( '0', '1' ) NOT NULL DEFAULT '0';
INSERT INTO `emulator_texts` (`key`, `value`) VALUES
('nux.step.1', 'This is the reception button, it will take you to the hotelview.'),
('nux.step.2', 'This is the navigator button, from here you can visit other rooms.'),
('nux.step.3', 'To talk, just enter your message here.'),
('nux.step.4', 'The chat history window lets you read back your previous conversations.'),
('nux.step.5', 'If you want to change your looks, you can use the wardrobe.'),
('nux.step.6', 'In the catalog you can purchase furniture to decorate your own room.'),
('nux.step.7', 'Furniture can be bought with a combination of credits...'),
('nux.step.8', '...duckets,'), ('nux.step.9', 'or diamonds.'),
('nux.step.10', 'All your friends are located down here.'),
('nux.step.11', 'Lets have some fun and start exploring the hotel!');
ALTER TABLE `commandlogs` CHANGE `params` `params` VARCHAR( 256 ) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT '';
INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('alert.superwired.invalid', 'Invalid superwired configuration. Make sure to NOT use <b>;</b> in the product field!');
INSERT INTO `emulator_settings` (`key`, `value`) VALUES ('hotel.navigator.popular.category.maxresults', '10');
ALTER TABLE `navigator_flatcats` ADD `caption_save` VARCHAR( 32 ) NOT NULL DEFAULT 'caption_save' AFTER `min_rank`;
CREATE TABLE `users_navigator_settings` (
`user_id` INT NOT NULL ,
`caption` VARCHAR( 128 ) NOT NULL ,
`list_type` ENUM( 'list', 'thumbnails' ) NOT NULL DEFAULT 'list',
`display` ENUM( 'visible', 'collapsed' ) NOT NULL DEFAULT 'visible'
) ENGINE = MYISAM ;
UPDATE `navigator_flatcats` SET `caption_save` = 'caption_save_building' WHERE `navigator_flatcats`.`id` =2;
UPDATE `navigator_flatcats` SET `caption_save` = 'caption_save_chat' WHERE `navigator_flatcats`.`id` =3;
UPDATE `navigator_flatcats` SET `caption_save` = 'caption_save_fansite' WHERE `navigator_flatcats`.`id` =4;
UPDATE `navigator_flatcats` SET `caption_save` = 'caption_save_games' WHERE `navigator_flatcats`.`id` =5;
UPDATE `navigator_flatcats` SET `caption_save` = 'caption_save_help' WHERE `navigator_flatcats`.`id` =6;
UPDATE `navigator_flatcats` SET `caption_save` = 'caption_save_life' WHERE `navigator_flatcats`.`id` =7;
UPDATE `navigator_flatcats` SET `caption_save` = 'caption_save_official' WHERE `navigator_flatcats`.`id` =8;
UPDATE `navigator_flatcats` SET `caption_save` = 'caption_save_party' WHERE `navigator_flatcats`.`id` =9;
UPDATE `navigator_flatcats` SET `caption_save` = 'caption_save_personal' WHERE `navigator_flatcats`.`id` =10;
UPDATE `navigator_flatcats` SET `caption_save` = 'caption_save_reviews' WHERE `navigator_flatcats`.`id` =11;
UPDATE `navigator_flatcats` SET `caption_save` = 'caption_save_trading' WHERE `navigator_flatcats`.`id` =12;
ALTER TABLE `permissions` ADD `cmd_allow_trading` ENUM( '0', '1' ) NOT NULL DEFAULT '0' AFTER `cmd_alert`;
INSERT INTO `emulator_texts` (`key`, `value`) VALUES
('commands.description.cmd_allow_trading', ":blocktrading - Enables / Disables the tradelock for a user."),
('commands.keys.cmd_allow_trading', 'tradelock;blocktrading;disabletrade'),
('commands.error.cmd_allow_trading.forgot_username', 'Please specify the user to enable / disable trading for.'),
('commands.error.cmd_allow_trading.forgot_trade', 'Please specify if you want to enable trading for %username%.'),
('commands.succes.cmd_allow_trading.enabled', 'Trading has been enabled for %username%!'),
('commands.succes.cmd_allow_trading.disabled', 'Trading has been disabled for %username%!'),
('commands.error.cmd_allow_trading.user_not_found', 'Target Habbo does not exist.'),
('commands.error.cmd_allow_trading.incorrect_setting', 'Please use %enabled% to enable trading. Use %disabled% to disable trading.');
ALTER TABLE `rooms` CHANGE `allow_walkthrough` `allow_walkthrough` ENUM( '0', '1' ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '1';
INSERT INTO `emulator_settings` (`key`, `value`) VALUES ('debug.show.users', '1');
#This is work in progress.
CREATE TABLE IF NOT EXISTS `nux_gifts` (
`id` int(3) NOT NULL AUTO_INCREMENT,
`type` enum('item','room') NOT NULL DEFAULT 'item',
`value` varchar(32) NOT NULL COMMENT 'If type item then items.item_name. If type room then room id to copy.',
`image` varchar(256) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=0 ;
INSERT INTO `nux_gifts` (`id`, `type`, `value`, `image`) VALUES
(1, 'item', 'rare_daffodil_rug', 'notifications/rare_daffodil_rug.png'),
(2, 'item', 'rare_moonrug', 'notifications/rare_moonrug.png'),
(3, 'item', 'sandrug', 'notifications/sandrug.png');
INSERT INTO `emulator_settings` (`key`, `value`) VALUES ('room.chat.delay', '0');
INSERT INTO `emulator_settings` (`key`, `value`) VALUES ('room.chat.prefix.format', '[<font color="%color%">%prefix%</font>] ');
ALTER TABLE `permissions` ADD `cmd_roommute` ENUM( '0', '1' ) NOT NULL DEFAULT '0' AFTER `cmd_roomitem`;
INSERT INTO `emulator_settings` (`key`, `value`) VALUES ('camera.use.https', '1');
ALTER TABLE `permissions` ADD `prefix` VARCHAR( 5 ) NOT NULL AFTER `log_commands` ,
ADD `prefix_color` VARCHAR( 7 ) NOT NULL AFTER `prefix`;
INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('commands.error.cmd_give_rank.higher.other', '%username% has an higher rank than you and thus cannot change it!');
INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('commands.error.cmd_unmute.not_muted', '%user% is not muted.');
ALTER TABLE `navigator_filter` ADD PRIMARY KEY ( `key` );
ALTER TABLE `navigator_filter` CHANGE `database_query` `database_query` VARCHAR( 1024 ) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL;
UPDATE `navigator_filter` SET `compare` = 'contains' WHERE `navigator_filter`.`key` = 'roomname';
UPDATE `navigator_filter` SET `database_query` = 'SELECT * FROM rooms WHERE name COLLATE UTF8_GENERAL_CI LIKE ? ', `compare` = 'contains' WHERE `navigator_filter`.`key` = 'roomname';
UPDATE `navigator_filter` SET `database_query` = 'SELECT rooms.*, CONCAT_WS(rooms.owner_name, rooms.name, rooms.description, rooms.tags, guilds.name, guilds.description) as whole FROM rooms LEFT JOIN guilds ON rooms.guild_id = guilds.id HAVING whole LIKE ? ' WHERE `navigator_filter`.`key` = 'anything';
ALTER TABLE `users_settings` ADD `mute_end_timestamp` INT( 11 ) NOT NULL DEFAULT '0' AFTER `nux`;
ALTER TABLE `wordfilter` ADD `mute` INT( 3 ) NOT NULL DEFAULT '0' COMMENT 'Time user gets muted for mentioning this word.' AFTER `report`;
#END DATABASE UPDATE: 1.7.0 -> 1.8.0

View File

@ -0,0 +1,63 @@
ALTER TABLE `support_tickets` ADD `category` INT( 3 ) NOT NULL DEFAULT '0' AFTER `issue`;
INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('supporttools.not_ticket_owner', 'You are not the moderator currently handling the ticket.');
ALTER TABLE `support_cfh_topics` ADD `default_sanction` INT( 3 ) NOT NULL DEFAULT '0' AFTER `auto_reply`;
INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('commands.success.cmd_setmax', 'Success! Maximum users in this room changed to %value%.');
CREATE TABLE `calendar_rewards` (
`id` INT( 11 ) NOT NULL AUTO_INCREMENT ,
`name` VARCHAR( 128 ) NOT NULL ,
`custom_image` VARCHAR( 128 ) NOT NULL ,
`credits` INT( 11 ) NOT NULL DEFAULT '0',
`points` INT( 11 ) NOT NULL DEFAULT '0',
`points_type` INT( 3 ) NOT NULL DEFAULT '0',
`badge` VARCHAR( 25 ) NOT NULL DEFAULT '',
`catalog_item_id` INT( 11 ) NOT NULL DEFAULT '0',
PRIMARY KEY ( `id` )
) ENGINE = MYISAM ;
CREATE TABLE `calendar_rewards_claimed` (
`user_id` INT NOT NULL ,
`reward_id` INT NOT NULL ,
`timestamp` INT NOT NULL
) ENGINE = MYISAM ;
ALTER TABLE `permissions` ADD `cmd_changename` ENUM( '0', '1' ) NOT NULL DEFAULT '0' AFTER `cmd_bundle`;
INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('commands.description.cmd_changename', ':changename'), ('commands.keys.cmd_changename', 'changename;flagme;change_name;namechange');
ALTER TABLE `users_settings` ADD `allow_name_change` ENUM( '0', '1' ) NOT NULL DEFAULT '0';
CREATE TABLE `namechange_log` (
`user_id` INT( 11 ) NOT NULL ,
`old_name` VARCHAR( 32 ) NOT NULL ,
`new_name` VARCHAR( 32 ) NOT NULL ,
`timestamp` INT( 11 ) NOT NULL
) ENGINE = MYISAM ;
INSERT INTO `emulator_settings` (`key`, `value`) VALUES
('basejump.url', 'http://localhost/game/BaseJump.swf'),
('basejump.assets.url', 'http://localhost/gamecenter/gamecenter_basejump/BasicAssets.swf');
DROP INDEX `user_id` ON users_recipes;
ALTER TABLE `users_recipes` ADD UNIQUE KEY ( `user_id`, `recipe` );
DELETE FROM emulator_settings WHERE `key` LIKE 'hotel.max.bots.inventory';
UPDATE `emulator_settings` SET `key` = 'hotel.inventory.max.items' WHERE `emulator_settings`.`key` = 'inventory.max.items';
INSERT INTO `emulator_texts` (`key` , `value` ) VALUES
('commands.error.cmd_credits.user_not_found', 'Could net send %amount% credits to %user%. %user% does not exist.');
INSERT INTO `emulator_settings` (`key`, `value`) VALUES ('hotel.marketplace.currency', '0');
INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('commands.error.cmd_pull.invalid', 'You cannot pull %username% to there.');
INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('commands.error.cmd_push.invalid', 'You cannot push %username% to there.');
ALTER TABLE `marketplace_items` ADD `sold_timestamp` INT( 11 ) NOT NULL DEFAULT '0' AFTER `timestamp`;
UPDATE permissions SET acc_debug = '0';
ALTER TABLE `permissions` ADD `level` INT( 2 ) NOT NULL DEFAULT '1' AFTER `rank_name`;
UPDATE permissions SET `level` = `id`;
INSERT INTO `emulator_settings` (`key`, `value`) VALUES ('networking.tcp.proxy', '0');
CREATE TABLE `room_trax_playlist` (
`room_id` INT NOT NULL ,
`item_id` INT NOT NULL ,
INDEX ( `room_id` )
) ENGINE = INNODB ;
ALTER TABLE `rooms` ADD `jukebox_active` ENUM( '0', '1' ) NOT NULL DEFAULT '0';

View File

@ -0,0 +1,499 @@
package com.eu.habbo;
import com.eu.habbo.core.*;
import com.eu.habbo.core.consolecommands.ConsoleCommand;
import com.eu.habbo.database.Database;
import com.eu.habbo.habbohotel.GameEnvironment;
import com.eu.habbo.habbohotel.messenger.MessengerBuddy;
import com.eu.habbo.networking.camera.CameraClient;
import com.eu.habbo.networking.gameserver.GameServer;
import com.eu.habbo.networking.rconserver.RCONServer;
import com.eu.habbo.plugin.PluginManager;
import com.eu.habbo.plugin.events.emulator.EmulatorConfigUpdatedEvent;
import com.eu.habbo.plugin.events.emulator.EmulatorLoadedEvent;
import com.eu.habbo.plugin.events.emulator.EmulatorStartShutdownEvent;
import com.eu.habbo.plugin.events.emulator.EmulatorStoppedEvent;
import com.eu.habbo.threading.ThreadPooling;
import com.eu.habbo.threading.runnables.CameraClientAutoReconnect;
import com.eu.habbo.util.imager.badges.BadgeImager;
import io.netty.util.internal.logging.InternalLoggerFactory;
import io.netty.util.internal.logging.Slf4JLoggerFactory;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Random;
import java.util.regex.Pattern;
public final class Emulator
{
/**
* Major version of the emulator.
*/
public final static int MAJOR = 1;
/**
* Minor version of the emulator.
*/
public final static int MINOR = 10;
/**
* Stable build version of the emulator.
*/
public final static int BUILD = 0;
/**
* Version as string.
*/
public static final String version = "Version: " + MAJOR + "." + MINOR + "." + BUILD;
/**
* Public chat, used for staffchat for now.
*/
public static MessengerBuddy publicChatBuddy;
/**
* The emulator is fully loaded and ready to handle players.
*/
public static boolean isReady = false;
/**
* The emulator is shutting down.
*/
public static boolean isShuttingDown = false;
/**
* The emulator has fully shutdown.
*/
public static boolean stopped = false;
/**
* The emulator is in debugging mode.
*/
public static boolean debugging = false;
private static int timeStarted = 0;
private static Runtime runtime;
private static ConfigurationManager config;
private static TextsManager texts;
private static GameServer gameServer;
private static RCONServer rconServer;
private static CameraClient cameraClient;
private static Database database;
private static Logging logging;
private static ThreadPooling threading;
private static GameEnvironment gameEnvironment;
private static PluginManager pluginManager;
private static Random random;
private static BadgeImager badgeImager;
static
{
Thread hook = new Thread(new Runnable()
{
public synchronized void run()
{
Emulator.dispose();
}
});
hook.setPriority(10);
Runtime.getRuntime().addShutdownHook(hook);
}
/**
* Entry point for Arcturus Emulator.
* @param args Unused
* @throws Exception Failed to start the emulator.
*/
public static void main(String[] args) throws Exception
{
try
{
Emulator.stopped = false;
ConsoleCommand.load();
Emulator.logging = new Logging();
Emulator.getLogging().logStart("\r" + Emulator.logo);
random = new Random();
publicChatBuddy = new MessengerBuddy(-1, "Staff Chat", "", (short) 0, 0);
long startTime = System.nanoTime();
Emulator.runtime = Runtime.getRuntime();
Emulator.config = new ConfigurationManager("config.ini");
if (Emulator.getConfig().getValue("username").isEmpty())
{
Emulator.getLogging().logErrorLine("Please make sure you enter your forum login details!");
Thread.sleep(2000);
}
Emulator.database = new Database(Emulator.getConfig());
Emulator.config.loaded = true;
Emulator.config.loadFromDatabase();
Emulator.threading = new ThreadPooling(Emulator.getConfig().getInt("runtime.threads"));
Emulator.getDatabase().getDataSource().setMaximumPoolSize(Emulator.getConfig().getInt("runtime.threads") * 2);
Emulator.getDatabase().getDataSource().setMinimumIdle(10);
Emulator.pluginManager = new PluginManager();
Emulator.pluginManager.reload();
Emulator.getPluginManager().fireEvent(new EmulatorConfigUpdatedEvent());
Emulator.texts = new TextsManager();
new CleanerThread();
Emulator.gameServer = new GameServer(getConfig().getValue("game.host", "127.0.0.1"), getConfig().getInt("game.port", 30000));
Emulator.rconServer = new RCONServer(getConfig().getValue("rcon.host", "127.0.0.1"), getConfig().getInt("rcon.port", 30001));
Emulator.gameEnvironment = new GameEnvironment();
Emulator.gameEnvironment.load();
Emulator.gameServer.initialise();
Emulator.gameServer.connect();
Emulator.rconServer.initialise();
Emulator.rconServer.connect();
Emulator.badgeImager = new BadgeImager();
if (Emulator.getConfig().getBoolean("camera.enabled"))
{
Emulator.getThreading().run(new CameraClientAutoReconnect());
}
Emulator.getLogging().logStart("Habbo Hotel Emulator has succesfully loaded.");
Emulator.getLogging().logStart("You're running: " + Emulator.version);
Emulator.getLogging().logStart("System launched in: " + (System.nanoTime() - startTime) / 1e6 + "ms. Using: " + (Runtime.getRuntime().availableProcessors() * 2) + " threads!");
Emulator.getLogging().logStart("Memory: " + (runtime.totalMemory() - runtime.freeMemory()) / (1024 * 1024) + "/" + (runtime.freeMemory()) / (1024 * 1024) + "MB");
Emulator.debugging = Emulator.getConfig().getBoolean("debug.mode");
if (debugging)
{
Emulator.getLogging().logDebugLine("Debugging Enabled!");
}
Emulator.getPluginManager().fireEvent(new EmulatorLoadedEvent());
Emulator.isReady = true;
Emulator.timeStarted = getIntUnixTimestamp();
if (Emulator.getConfig().getInt("runtime.threads") < (Runtime.getRuntime().availableProcessors() * 2))
{
Emulator.getLogging().logStart("Emulator settings runtime.threads (" + Emulator.getConfig().getInt("runtime.threads") + ") can be increased to " + (Runtime.getRuntime().availableProcessors() * 2) + " to possibly increase performance.");
}
if (Emulator.getConfig().getValue("username").isEmpty())
{
Emulator.getLogging().logErrorLine("No account has been found in config.ini Please create an account on Arcturus.wf and edit the config.ini in order to maximize usage of Arcturus! http://arcturus.wf");
}
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
while (!isShuttingDown && isReady)
{
try
{
String line = reader.readLine();
if (line != null)
{
ConsoleCommand.handle(line);
}
}
catch (Exception e)
{
Emulator.getLogging().logErrorLine(e);
}
}
}
catch (Exception e)
{
e.printStackTrace();
}
}
/**
* Shutsdown the emulator.
*/
private static void dispose()
{
Emulator.isShuttingDown = true;
Emulator.isReady = false;
Emulator.getLogging().logShutdownLine("Stopping Arcturus Emulator " + version + "...");
try
{
if (Emulator.getPluginManager() != null)
Emulator.getPluginManager().fireEvent(new EmulatorStartShutdownEvent());
}
catch (Exception e) {}
try
{
if (Emulator.cameraClient != null)
Emulator.cameraClient.disconnect();
}
catch (Exception e) {}
try
{
if (Emulator.rconServer != null)
Emulator.rconServer.stop();
}
catch (Exception e) {}
try
{
if (Emulator.gameEnvironment != null)
Emulator.gameEnvironment.dispose();
}
catch (Exception e) {}
try
{
if (Emulator.getPluginManager() != null)
Emulator.getPluginManager().fireEvent(new EmulatorStoppedEvent());
}
catch (Exception e) {}
try
{
if (Emulator.pluginManager != null)
Emulator.pluginManager.dispose();
}
catch (Exception e) {}
Emulator.getLogging().saveLogs();
try
{
if (Emulator.config != null)
{
Emulator.config.saveToDatabase();
}
}
catch (Exception e) {}
try
{
if (Emulator.gameServer != null)
Emulator.gameServer.stop();
}
catch (Exception e) {}
Emulator.getLogging().logShutdownLine("Stopped Arcturus Emulator " + version + "...");
if (Emulator.database != null)
{
Emulator.getDatabase().dispose();
}
Emulator.stopped = true;
try
{
if (Emulator.threading != null)
Emulator.threading.shutDown();
}
catch (Exception e) {}
}
/**
* @return The ConfigurationManager
*/
public static ConfigurationManager getConfig()
{
return config;
}
/**
* @return The TextsManager
*/
public static TextsManager getTexts()
{
return texts;
}
/**
* @return The Database
*/
public static Database getDatabase()
{
return database;
}
/**
* @return Current Runtime
*/
public static Runtime getRuntime()
{
return runtime;
}
/**
* @return The GameServer
*/
public static GameServer getGameServer()
{
return gameServer;
}
/**
* @return The RCONServer
*/
public static RCONServer getRconServer()
{
return rconServer;
}
/**
* @return Logging module
*/
public static Logging getLogging()
{
return logging;
}
/**
* @return The ThreadPooling
*/
public static ThreadPooling getThreading()
{
return threading;
}
/**
* @return The GameEnvironment
*/
public static GameEnvironment getGameEnvironment()
{
return gameEnvironment;
}
/**
*
* @return The PluginManager
*/
public static PluginManager getPluginManager()
{
return pluginManager;
}
public static Random getRandom()
{
return random;
}
public static BadgeImager getBadgeImager()
{
return badgeImager;
}
public static CameraClient getCameraClient()
{
return cameraClient;
}
public static synchronized void setCameraClient(CameraClient client)
{
cameraClient = client;
}
public static int getTimeStarted()
{
return timeStarted;
}
public static void prepareShutdown()
{
System.exit(0);
}
/**
* Converts a date to an unix timestamp
* @param date The date to convert
* @return Return unix timestamp in seconds.
*/
private static String dateToUnixTimestamp(Date date)
{
String res = "";
Date aux = stringToDate("1970-01-01 00:00:00");
Timestamp aux1 = dateToTimeStamp(aux);
Timestamp aux2 = dateToTimeStamp(date);
long difference = aux2.getTime() - aux1.getTime();
long seconds = difference / 1000L;
return res + seconds;
}
/**
* Converts a String to a Date object
* @param date The String to parse
* @return The Date of the string.
*/
private static Date stringToDate(String date)
{
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date res = null;
try
{
res = format.parse(date);
}
catch (Exception e)
{
Emulator.getLogging().logErrorLine(e);
}
return res;
}
public static Timestamp dateToTimeStamp(Date date)
{
return new Timestamp(date.getTime());
}
public static Date getDate()
{
return new Date(System.currentTimeMillis());
}
public static String getUnixTimestamp()
{
return dateToUnixTimestamp(getDate());
}
public static int getIntUnixTimestamp()
{
return (int) (System.currentTimeMillis() / 1000);
}
public static boolean isNumeric(String string)
throws IllegalArgumentException
{
boolean isnumeric = false;
if ((string != null) && (!string.equals("")))
{
isnumeric = true;
char[] chars = string.toCharArray();
for (char aChar : chars)
{
isnumeric = Character.isDigit(aChar);
if (!isnumeric)
{
break;
}
}
}
return isnumeric;
}
public int getUserCount()
{
return gameEnvironment.getHabboManager().getOnlineCount();
}
public int getRoomCount()
{
return gameEnvironment.getRoomManager().getActiveRooms().size();
}
private static final String logo =
" _ ______ _ _ _ \n" +
" /\\ | | | ____| | | | | | |\n" +
" / \\ _ __ ___| |_ _ _ _ __ _ _ ___ | |__ _ __ ___ _ _| | __ _| |_ ___ _ __| |\n" +
" / /\\ \\ | '__/ __| __| | | | '__| | | / __| | __| | '_ ` _ \\| | | | |/ _` | __/ _ \\| '__| |\n" +
" / ____ \\| | | (__| |_| |_| | | | |_| \\__ \\ | |____| | | | | | |_| | | (_| | || (_) | | |_|\n" +
" /_/ \\_\\_| \\___|\\__|\\__,_|_| \\__,_|___/ |______|_| |_| |_|\\__,_|_|\\__,_|\\__\\___/|_| (_)\n" +
" \n" +
" ";
}

View File

@ -0,0 +1,225 @@
package com.eu.habbo.core;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.messages.incoming.friends.SearchUserEvent;
import com.eu.habbo.messages.incoming.navigator.SearchRoomsEvent;
import com.eu.habbo.threading.runnables.AchievementUpdater;
import com.eu.habbo.util.callback.HTTPPostStatus;
import com.eu.habbo.util.callback.HTTPVersionCheck;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.Statement;
public class CleanerThread implements Runnable {
/**
* Delay between each execution of checking to clean up in MS.
*/
public static final int DELAY = 10000;
/**
* Amount of seconds the Hall Of Fame has to be reloaded.
*/
public static final int RELOAD_HALL_OF_FAME = 1800;
/**
* Amount of seconds the News List has to be reloaded.
*/
public static final int RELOAD_NEWS_LIST = 3600;
/**
* Amount of seconds inactive rooms have to be cleared.
*/
public static final int REMOVE_INACTIVE_ROOMS = 120;
/**
* Amount of seconds inactive guilds have to be cleared.
*/
public static final int REMOVE_INACTIVE_GUILDS = 60;
/**
* Amount of seconds inactive tours have to be cleared.
*/
public static final int REMOVE_INACTIVE_TOURS = 600;
/**
* Amount of seconds error logs have to be saved to the database.
*/
public static final int SAVE_ERROR_LOGS = 30;
/**
*
*/
private static final int CALLBACK_TIME = 60*15;
/**
* Last time the Hall Of Fame was reloaded.
*/
private static int LAST_HOF_RELOAD = Emulator.getIntUnixTimestamp();
/**
* Last time the news list was reloaded.
*/
private static int LAST_NL_RELOAD = Emulator.getIntUnixTimestamp();
/**
* Last time inactive rooms have been cleared.
*/
private static int LAST_INACTIVE_ROOMS_CLEARED = Emulator.getIntUnixTimestamp();
/**
* Last time inactive guilds have been cleared.
*/
private static int LAST_INACTIVE_GUILDS_CLEARED = Emulator.getIntUnixTimestamp();
/**
* Last time inactive tours have been cleared.
*/
private static int LAST_INACTIVE_TOURS_CLEARED = Emulator.getIntUnixTimestamp();
/**
* Last time error logs were saved to the database.
*/
private static int LAST_ERROR_LOGS_SAVED = Emulator.getIntUnixTimestamp();
/**
* Last time dailys where refilled.
*/
private static int LAST_DAILY_REFILL = Emulator.getIntUnixTimestamp();
private static int LAST_CALLBACK = Emulator.getIntUnixTimestamp();
public CleanerThread()
{
databaseCleanup();
Emulator.getThreading().run(this, DELAY);
Emulator.getThreading().run(new AchievementUpdater());
Emulator.getThreading().run(new HTTPVersionCheck(), 10000);
}
@Override
public void run()
{
Emulator.getThreading().run(this, DELAY);
int time = Emulator.getIntUnixTimestamp();
if (time - LAST_HOF_RELOAD > RELOAD_HALL_OF_FAME)
{
Emulator.getGameEnvironment().getHotelViewManager().getHallOfFame().reload();
LAST_HOF_RELOAD = time;
}
if (time - LAST_NL_RELOAD > RELOAD_NEWS_LIST)
{
Emulator.getGameEnvironment().getHotelViewManager().getNewsList().reload();
LAST_NL_RELOAD = time;
}
if (time - LAST_INACTIVE_ROOMS_CLEARED > REMOVE_INACTIVE_ROOMS)
{
Emulator.getGameEnvironment().getRoomManager().clearInactiveRooms();
LAST_INACTIVE_ROOMS_CLEARED = time;
}
if (time - LAST_INACTIVE_GUILDS_CLEARED > REMOVE_INACTIVE_GUILDS)
{
Emulator.getGameEnvironment().getGuildManager().clearInactiveGuilds();
Emulator.getGameEnvironment().getGuildForumManager().clearInactiveForums();
LAST_INACTIVE_GUILDS_CLEARED = time;
}
if (time - LAST_INACTIVE_TOURS_CLEARED > REMOVE_INACTIVE_TOURS)
{
Emulator.getGameEnvironment().getGuideManager().cleanup();
LAST_INACTIVE_TOURS_CLEARED = time;
}
if (time - LAST_ERROR_LOGS_SAVED > SAVE_ERROR_LOGS)
{
Emulator.getLogging().saveLogs();
LAST_ERROR_LOGS_SAVED = time;
}
if (time - LAST_CALLBACK > CALLBACK_TIME)
{
Emulator.getThreading().run(new HTTPPostStatus());
LAST_CALLBACK = time;
}
if (time - LAST_DAILY_REFILL > Emulator.getConfig().getInt("hotel.refill.daily"))
{
refillDailyRespects();
LAST_DAILY_REFILL = time;
}
SearchRoomsEvent.cachedResults.clear();
SearchUserEvent.cachedResults.clear();
}
/**
* Cleans up the database before emulator launch to guarantee system integrity.
*/
void databaseCleanup()
{
refillDailyRespects();
int time = Emulator.getIntUnixTimestamp();
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection())
{
try (Statement statement = connection.createStatement())
{
statement.execute("UPDATE users SET online = '0' WHERE online = '1'");
statement.execute("UPDATE rooms SET users = '0' WHERE users > 0");
statement.execute("DELETE FROM room_mutes WHERE ends < " + time);
statement.execute("DELETE FROM room_bans WHERE ends < " + time);
statement.execute("DELETE users_favorite_rooms FROM users_favorite_rooms LEFT JOIN rooms ON room_id = rooms.id WHERE rooms.id IS NULL");
}
try (PreparedStatement statement = connection.prepareStatement("UPDATE users_effects SET total = total - 1 WHERE activation_timestamp < ? AND activation_timestamp != 0"))
{
statement.setInt(1, Emulator.getIntUnixTimestamp() - 86400);
statement.execute();
}
try (Statement statement = connection.createStatement())
{
statement.execute("DELETE FROM users_effects WHERE total <= 0");
}
}
catch (SQLException e)
{
Emulator.getLogging().logSQLException(e);
}
Emulator.getLogging().logStart("Database -> Cleaned!");
}
public void refillDailyRespects()
{
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("UPDATE users_settings SET daily_respect_points = ?, daily_pet_respect_points = ?"))
{
statement.setInt(1, Emulator.getConfig().getInt("hotel.daily.respect"));
statement.setInt(2, Emulator.getConfig().getInt("hotel.daily.respect.pets"));
statement.executeUpdate();
}
catch (SQLException e)
{
Emulator.getLogging().logSQLException(e);
}
if (Emulator.isReady)
{
for (Habbo habbo : Emulator.getGameEnvironment().getHabboManager().getOnlineHabbos().values())
{
habbo.getHabboStats().petRespectPointsToGive = Emulator.getConfig().getInt("hotel.daily.respect");
habbo.getHabboStats().respectPointsToGive = Emulator.getConfig().getInt("hotel.daily.respect.pets");
}
}
}
}

View File

@ -0,0 +1,38 @@
package com.eu.habbo.core;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.commands.Command;
import java.sql.PreparedStatement;
import java.sql.SQLException;
public class CommandLog implements Loggable
{
public static String insertQuery = "INSERT INTO commandlogs (`user_id`, `timestamp`, `command`, `params`, `succes`) VALUES (?, ?, ?, ?, ?)";
private final int userId;
private final int timestamp = Emulator.getIntUnixTimestamp();
private final Command command;
private final String params;
private final boolean succes;
public CommandLog(int userId, Command command, String params, boolean succes)
{
this.userId = userId;
this.command = command;
this.params = params;
this.succes = succes;
}
@Override
public void log(PreparedStatement statement) throws SQLException
{
statement.setInt(1, this.userId);
statement.setInt(2, this.timestamp);
statement.setString(3, this.command.getClass().getSimpleName());
statement.setString(4, this.params);
statement.setString(5, this.succes ? "yes" : "no");
statement.addBatch();
}
}

View File

@ -0,0 +1,282 @@
package com.eu.habbo.core;
import com.eu.habbo.Emulator;
import com.eu.habbo.plugin.PluginManager;
import com.eu.habbo.plugin.events.emulator.EmulatorConfigUpdatedEvent;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.sql.*;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
public class ConfigurationManager
{
/**
* Flag for when the ConfigurationManager has fully loaded.
*/
public boolean loaded = false;
/**
* Flag for when the ConfigurationManager is still loading.
* The configurationmanager is loaded in two parts,
* first the config.ini is read.
* After that the rest of the configuration is read from the database.
*/
public boolean isLoading = false;
/**
* Our configurations stored in this object.
*/
private final Properties properties;
public ConfigurationManager(String path) throws Exception
{
this.properties = new Properties();
this.reload();
}
/**
* Reloads the settings from the config file.
* @throws Exception
*/
public void reload() throws Exception
{
this.isLoading = true;
this.properties.clear();
InputStream input = null;
try {
File f = new File("config.ini");
input = new FileInputStream(f);
this.properties.load(input);
} catch (IOException ex) {
Emulator.getLogging().logErrorLine("[CRITICAL] FAILED TO LOAD CONFIG.INI FILE!");
} finally {
if (input != null) {
try {
input.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
if(loaded)
{
this.loadFromDatabase();
}
this.isLoading = false;
Emulator.getLogging().logStart("Configuration Manager -> Loaded!");
if (Emulator.getPluginManager() != null)
{
Emulator.getPluginManager().fireEvent(new EmulatorConfigUpdatedEvent());
}
}
/**
* Loads the settings from the database.
*/
public void loadFromDatabase()
{
Emulator.getLogging().logStart("Loading configuration from database...");
long millis = System.currentTimeMillis();
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); Statement statement = connection.createStatement())
{
if (statement.execute("SELECT * FROM emulator_settings"))
{
try (ResultSet set = statement.getResultSet())
{
while (set.next())
{
this.properties.put(set.getString("key"), set.getString("value"));
}
}
}
}
catch (SQLException e)
{
Emulator.getLogging().logSQLException(e);
}
Emulator.getLogging().logStart("Configuration -> loaded! (" + (System.currentTimeMillis() - millis) + " MS)");
}
public void saveToDatabase()
{
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("UPDATE emulator_settings SET `value` = ? WHERE `key` = ? LIMIT 1"))
{
for (Map.Entry<Object, Object> entry : this.properties.entrySet())
{
statement.setString(1, entry.getValue().toString());
statement.setString(2, entry.getKey().toString());
statement.executeUpdate();
}
}
catch (SQLException e)
{
Emulator.getLogging().logSQLException(e);
}
}
/**
* Gets the string value for a specific key.
* @param key The key to find the value for.
* @return The string value for the key. Returns an empty string if not found.
*/
public String getValue(String key)
{
return getValue(key, "");
}
/**
* Gets the string value for a specific key.
* @param key The key to find the value for.
* @param defaultValue The value that will be returned when the key is not found.
* @return The string value for the key. Returns defaultValue when not found.
*/
public String getValue(String key, String defaultValue)
{
if (this.isLoading)
return defaultValue;
if (!this.properties.containsKey(key)) {
Emulator.getLogging().logErrorLine("[CONFIG] Key not found: " + key);
}
return this.properties.getProperty(key, defaultValue);
}
/**
* Gets the boolean value for a specific key.
* @param key The key to find the value for.
* @return The boolean value for the key. Returns false if not found.
*/
public boolean getBoolean(String key)
{
return getBoolean(key, false);
}
/**
* Gets the boolean value for a specific key.
* @param key The key to find the value for.
* @param defaultValue The value that will be returned when the key is not found.
* @return The boolean value for the key. Returns defaultValue when not found.
*/
public boolean getBoolean(String key, boolean defaultValue)
{
if (this.isLoading)
return defaultValue;
try
{
return (getValue(key, "0").equals("1")) || (getValue(key, "false").equals("true"));
}
catch (Exception e)
{
Emulator.getLogging().logErrorLine("Failed to parse key " + key + " with value " + getValue(key) + " to type boolean.");
}
return defaultValue;
}
/**
* Gets the int value for a specific key.
* @param key The key to find the value for.
* @return The int value for the key. Returns 0 if not found.
*/
public int getInt(String key)
{
return getInt(key, 0);
}
/**
* Gets the int value for a specific key.
* @param key The key to find the value for.
* @param defaultValue The value that will be returned when the key is not found.
* @return The int value for the key. Returns defaultValue when not found.
*/
public int getInt(String key, Integer defaultValue)
{
if (this.isLoading)
return defaultValue;
try
{
return Integer.parseInt(getValue(key, defaultValue.toString()));
} catch (Exception e)
{
Emulator.getLogging().logErrorLine("Failed to parse key " + key + " with value " + getValue(key) + " to type integer.");
}
return defaultValue;
}
/**
* Gets the double value for a specific key.
* @param key The key to find the value for.
* @return The double value for the key. Returns 0 if not found.
*/
public double getDouble(String key)
{
return getDouble(key, 0.0);
}
/**
* Gets the double value for a specific key.
* @param key The key to find the value for.
* @param defaultValue The value that will be returned when the key is not found.
* @return The double value for the key. Returns defaultValue when not found.
*/
public double getDouble(String key, Double defaultValue)
{
if (this.isLoading)
return defaultValue;
try
{
return Double.parseDouble(getValue(key, defaultValue.toString()));
}
catch (Exception e)
{
Emulator.getLogging().logErrorLine("Failed to parse key " + key + " with value " + getValue(key) + " to type double.");
}
return defaultValue;
}
/**
* Updates the give key.
* @param key The key to update.
* @param value The new value.
*/
public void update(String key, String value)
{
this.properties.setProperty(key, value);
}
public void register(String key, String value)
{
if (this.properties.getProperty(key, null) != null)
return;
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("INSERT INTO emulator_settings VALUES (?, ?)"))
{
statement.setString(1, key);
statement.setString(2, value);
statement.execute();
}
catch (SQLException e)
{
Emulator.getLogging().logSQLException(e);
}
this.update(key, value);
}
}

View File

@ -0,0 +1,81 @@
package com.eu.habbo.core;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.users.Habbo;
import java.util.Map;
public class CreditsScheduler extends Scheduler
{
/**
* Defines if users that are not in a room should be excluded from receiving credits.
*/
public static boolean IGNORE_HOTEL_VIEW;
/**
* Defines if users idling in rooms should be excluded from receiving credits.
*/
public static boolean IGNORE_IDLED;
/**
* The amount of credits that will be given.
*/
public static int CREDITS;
public CreditsScheduler()
{
super(Emulator.getConfig().getInt("hotel.auto.credits.interval"));
if(Emulator.getConfig().getBoolean("hotel.auto.credits.enabled"))
{
IGNORE_HOTEL_VIEW = Emulator.getConfig().getBoolean("hotel.auto.credits.ignore.hotelview");
IGNORE_IDLED = Emulator.getConfig().getBoolean("hotel.auto.credits.ignore.idled");
CREDITS = Emulator.getConfig().getInt("hotel.auto.credits.amount");
}
else
{
this.disposed = true;
}
}
@Override
public void run()
{
super.run();
Habbo habbo;
for(Map.Entry<Integer, Habbo> map : Emulator.getGameEnvironment().getHabboManager().getOnlineHabbos().entrySet())
{
habbo = map.getValue();
try
{
if (habbo != null)
{
if (habbo.getHabboInfo().getCurrentRoom() == null && IGNORE_HOTEL_VIEW)
continue;
if (habbo.getRoomUnit().isIdle() && IGNORE_IDLED)
continue;
habbo.giveCredits(CREDITS);
}
}
catch (Exception e)
{
Emulator.getLogging().logErrorLine(e);
}
}
}
public boolean isDisposed()
{
return disposed;
}
public void setDisposed(boolean disposed)
{
this.disposed = disposed;
}
}

View File

@ -0,0 +1,7 @@
package com.eu.habbo.core;
public interface Disposable
{
public void dispose();
public boolean disposed();
}

View File

@ -0,0 +1,27 @@
package com.eu.habbo.core;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomChatMessage;
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
import com.eu.habbo.messages.outgoing.rooms.users.RoomUserRemoveComposer;
import com.eu.habbo.messages.outgoing.rooms.users.RoomUserWhisperComposer;
import com.eu.habbo.plugin.EventHandler;
import com.eu.habbo.plugin.events.users.UserSavedMottoEvent;
public class Easter
{
@EventHandler
public static void onUserChangeMotto(UserSavedMottoEvent event)
{
if(event.newMotto.equalsIgnoreCase("crickey!"))
{
event.habbo.getClient().sendResponse(new RoomUserWhisperComposer(new RoomChatMessage(event.newMotto, event.habbo, event.habbo, RoomChatMessageBubbles.ALERT)));
Room room = event.habbo.getHabboInfo().getCurrentRoom();
room.sendComposer(new RoomUserRemoveComposer(event.habbo.getRoomUnit()).compose());
room.sendComposer(new RoomUserPetComposer(2, 1, "FFFFFF", event.habbo).compose());
}
}
}

View File

@ -0,0 +1,56 @@
package com.eu.habbo.core;
import com.eu.habbo.Emulator;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.sql.PreparedStatement;
import java.sql.SQLException;
/**
* Created on 12-11-2015 19:16.
*/
public class ErrorLog implements Loggable
{
public final static String insertQuery = "INSERT INTO emulator_errors (timestamp, type, stacktrace) VALUES (?, ?, ?)";
public final int timeStamp;
public final String type;
public final String stackTrace;
public ErrorLog(String type, Throwable e)
{
this.timeStamp = Emulator.getIntUnixTimestamp();
this.type = type;
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
e.printStackTrace(pw);
this.stackTrace = sw.toString();
try
{
pw.close();
sw.close();
} catch (IOException e1)
{
Emulator.getLogging().logErrorLine(e1);
}
}
public ErrorLog(String type, String message)
{
this.timeStamp = Emulator.getIntUnixTimestamp();
this.type = type;
this.stackTrace = message;
}
@Override
public void log(PreparedStatement statement) throws SQLException
{
statement.setInt(1, this.timeStamp);
statement.setString(2, this.type);
statement.setString(3, this.stackTrace);
statement.addBatch();
}
}

View File

@ -0,0 +1,9 @@
package com.eu.habbo.core;
import java.sql.PreparedStatement;
import java.sql.SQLException;
public interface Loggable
{
void log(PreparedStatement statement) throws SQLException;
}

View File

@ -0,0 +1,444 @@
package com.eu.habbo.core;
import com.eu.habbo.Emulator;
import com.eu.habbo.util.callback.HTTPPostError;
import gnu.trove.set.hash.THashSet;
import sun.rmi.runtime.Log;
import java.io.*;
import java.nio.file.Files;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
public class Logging
{
/**
* File that packetlogs will be sved to.
*/
private static File packets;
/**
* File that undefined packetlogs will be saved to.
*/
private static File packetsUndefined;
/**
* File that packets that were improperly handled will be saved to.
*/
private static File errorsPackets;
/**
* File that SQL errors will be saved to.
*/
private static File errorsSQL;
/**
* File that runtime errors will be saved to.
*/
private static File errorsRuntime;
/**
* File that debug logs will be saved to.
*/
private static File debugFile;
private static PrintWriter packetsWriter;
private static PrintWriter packetsUndefinedWriter;
private static PrintWriter errorsPacketsWriter;
private static PrintWriter errorsSQLWriter;
private static PrintWriter errorsRuntimeWriter;
private static PrintWriter debugFileWriter;
/**
* Bright text.
*/
public static final String ANSI_BRIGHT = "\u001B[1m";
/**
* Italicized text.
*/
public static final String ANSI_ITALICS = "\u001B[3m";
/**
* Underlined text.
*/
public static final String ANSI_UNDERLINE = "\u001B[4m";
/**
* Resets all text effects to normal console font.
*/
public static final String ANSI_RESET = "\u001B[0m";
public static final String ANSI_BLACK = "\u001B[30m";
public static final String ANSI_RED = "\u001B[31m";
public static final String ANSI_GREEN = "\u001B[32m";
public static final String ANSI_YELLOW = "\u001B[33m";
public static final String ANSI_BLUE = "\u001B[34m";
public static final String ANSI_PURPLE = "\u001B[35m";
public static final String ANSI_CYAN = "\u001B[36m";
public static final String ANSI_WHITE = "\u001B[37m";
/**
* Error logging cache layer.
* Used for bulk inserting into the database.
*/
private final THashSet<Loggable> errorLogs = new THashSet<Loggable>();
/**
* Command log cache layer.
* Used for bulk inserting into the database.
*/
private final THashSet<Loggable> commandLogs = new THashSet<Loggable>();
public Logging()
{
packets = new File("logging//packets//defined.txt");
packetsUndefined = new File("logging//packets//packets.txt");
errorsPackets = new File("logging//errors//packets.txt");
errorsSQL = new File("logging//errors//sql.txt");
errorsRuntime = new File("logging//errors//runtime.txt");
debugFile = new File("logging//debug.txt");
try
{
if (!packets.exists())
{
if (!packets.getParentFile().exists())
{
packets.getParentFile().mkdirs();
}
packets.createNewFile();
}
if (!packetsUndefined.exists())
{
if (!packetsUndefined.getParentFile().exists())
{
packetsUndefined.getParentFile().mkdirs();
}
packetsUndefined.createNewFile();
}
if (!errorsPackets.exists())
{
if (!errorsPackets.getParentFile().exists())
{
errorsPackets.getParentFile().mkdirs();
}
errorsPackets.createNewFile();
}
if (!errorsSQL.exists())
{
if (!errorsSQL.getParentFile().exists())
{
errorsSQL.getParentFile().mkdirs();
}
errorsSQL.createNewFile();
}
if (!errorsRuntime.exists())
{
if (!errorsRuntime.getParentFile().exists())
{
errorsRuntime.getParentFile().mkdirs();
}
errorsRuntime.createNewFile();
}
if (!debugFile.exists())
{
if (!debugFile.getParentFile().exists())
{
debugFile.getParentFile().mkdirs();
}
debugFile.createNewFile();
}
}
catch(Exception e)
{
e.printStackTrace();
}
try
{
packetsWriter = new PrintWriter(new FileWriter(packets, true));
packetsUndefinedWriter = new PrintWriter(new FileWriter(packetsUndefined, true));
errorsPacketsWriter = new PrintWriter(new FileWriter(errorsPackets, true));
errorsSQLWriter = new PrintWriter(new FileWriter(errorsSQL, true));
errorsRuntimeWriter = new PrintWriter(new FileWriter(errorsRuntime, true));
debugFileWriter = new PrintWriter(new FileWriter(debugFile, true));
}
catch (IOException e)
{
System.out.println("[CRITICAL] FAILED TO LOAD LOGGING COMPONENT!");
}
}
/**
* Prints a starting message to the console.
* @param line The message to print.
*/
public void logStart(Object line)
{
System.out.println("[" + Logging.ANSI_BRIGHT + Logging.ANSI_GREEN + "LOADING" + Logging.ANSI_RESET + "] " + line.toString());
}
/**
* Prints a shutdown message to the console.
* @param line The message to print.
*/
public void logShutdownLine(Object line)
{
if(Emulator.getConfig().getBoolean("logging.debug"))
{
write(debugFileWriter, line.toString());
}
System.out.println("[" + Logging.ANSI_BRIGHT + Logging.ANSI_GREEN + "SHUTDOWN" + Logging.ANSI_RESET + "] " + line.toString());
}
public void logUserLine(Object line)
{
if(Emulator.getConfig().getBoolean("logging.debug"))
{
write(debugFileWriter, line.toString());
}
if (Emulator.getConfig().getBoolean("debug.show.users"))
{
System.out.println("[USER] " + line.toString());
}
}
public synchronized void logDebugLine(Object line)
{
if (line instanceof Throwable)
{
logErrorLine(line);
return;
}
if (Emulator.getConfig().getBoolean("debug.mode")) {
System.out.println("[DEBUG] " + line.toString());
}
if(Emulator.getConfig().getBoolean("logging.debug"))
{
write(debugFileWriter, line.toString());
}
}
public synchronized void logPacketLine(Object line)
{
if (Emulator.getConfig().getBoolean("debug.show.packets")) {
System.out.println("[" + Logging.ANSI_BLUE + "PACKET" + Logging.ANSI_RESET + "]" + line.toString());
}
if(Emulator.getConfig().getBoolean("logging.packets"))
{
write(packetsWriter, line.toString());
}
}
public synchronized void logUndefinedPacketLine(Object line)
{
if (Emulator.getConfig().getBoolean("debug.show.packets.undefined"))
{
System.out.println("[PACKET] [UNDEFINED] " + line.toString());
}
if (Emulator.getConfig().getBoolean("logging.packets.undefined"))
{
write(packetsUndefinedWriter, line.toString());
}
}
public synchronized void logErrorLine(Object line)
{
if (Emulator.isReady && Emulator.getConfig().getBoolean("debug.show.errors"))
{
System.err.println("[ERROR] " + line.toString());
}
if (Emulator.getConfig().loaded && Emulator.getConfig().getBoolean("logging.errors.runtime"))
{
write(errorsRuntimeWriter, line);
}
if(line instanceof Throwable)
{
((Throwable) line).printStackTrace();
if (line instanceof SQLException)
{
this.logSQLException((SQLException) line);
return;
}
Emulator.getThreading().run(new HTTPPostError((Throwable) line));
this.errorLogs.add(new ErrorLog("Exception", (Throwable) line));
return;
}
this.errorLogs.add(new ErrorLog("Emulator", line.toString()));
}
public void logSQLException(SQLException e)
{
if(Emulator.getConfig().getBoolean("logging.errors.sql"))
{
e.printStackTrace();
write(errorsSQLWriter, e);
Emulator.getThreading().run(new HTTPPostError(e));
}
}
public void logPacketError(Object e)
{
if(Emulator.getConfig().getBoolean("logging.errors.packets"))
{
if(e instanceof Throwable)
((Exception) e).printStackTrace();
write(errorsPacketsWriter, e);
}
if(e instanceof Throwable)
{
((Throwable) e).printStackTrace();
if (e instanceof SQLException)
{
this.logSQLException((SQLException) e);
return;
}
Emulator.getThreading().run(new HTTPPostError((Throwable) e));
}
}
public void handleException(Exception e)
{
e.printStackTrace();
}
private synchronized void write(PrintWriter printWriter, Object message)
{
if(printWriter != null && message != null)
{
if(message instanceof Throwable)
{
((Exception) message).printStackTrace(printWriter);
}
else
{
printWriter.write("MSG: " + message.toString() + "\r\n");
}
printWriter.flush();
}
}
public void addLog(Loggable log)
{
if (log instanceof ErrorLog)
{
synchronized (this.errorLogs)
{
this.errorLogs.add(log);
}
}
else if (log instanceof CommandLog)
{
synchronized (this.commandLogs)
{
this.commandLogs.add(log);
}
}
}
public void saveLogs()
{
if (Emulator.getDatabase() != null && Emulator.getDatabase().getDataSource() != null)
{
if (!this.errorLogs.isEmpty() || !this.commandLogs.isEmpty())
{
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection())
{
if (!this.errorLogs.isEmpty())
{
synchronized (this.errorLogs)
{
try (PreparedStatement statement = connection.prepareStatement(ErrorLog.insertQuery))
{
for (Loggable log : this.errorLogs)
{
log.log(statement);
}
statement.executeBatch();
}
this.errorLogs.clear();
}
}
if (!this.commandLogs.isEmpty())
{
synchronized (this.commandLogs)
{
try (PreparedStatement statement = connection.prepareStatement(CommandLog.insertQuery))
{
for (Loggable log : this.commandLogs)
{
log.log(statement);
}
statement.executeBatch();
}
this.commandLogs.clear();
}
}
}
catch (SQLException e)
{
Emulator.getLogging().logSQLException(e);
}
}
}
}
public static PrintWriter getPacketsWriter()
{
return packetsWriter;
}
public static PrintWriter getPacketsUndefinedWriter()
{
return packetsUndefinedWriter;
}
public static PrintWriter getErrorsPacketsWriter()
{
return errorsPacketsWriter;
}
public static PrintWriter getErrorsSQLWriter()
{
return errorsSQLWriter;
}
public static PrintWriter getErrorsRuntimeWriter()
{
return errorsRuntimeWriter;
}
public static PrintWriter getDebugFileWriter()
{
return debugFileWriter;
}
}

View File

@ -0,0 +1,111 @@
package com.eu.habbo.core;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.users.Habbo;
import java.util.Map;
public class PixelScheduler extends Scheduler
{
/**
* Defines if users that are not in a room should be excluded from receiving pixels.
*/
public static boolean IGNORE_HOTEL_VIEW;
/**
* Defines if users idling in rooms should be excluded from receiving pixels.
*/
public static boolean IGNORE_IDLED;
/**
* The amount of pixels to give.
*/
private static int PIXELS;
public PixelScheduler()
{
super(Emulator.getConfig().getInt("hotel.auto.pixels.interval"));
if(Emulator.getConfig().getBoolean("hotel.auto.pixels.enabled"))
{
IGNORE_HOTEL_VIEW = Emulator.getConfig().getBoolean("hotel.auto.pixels.ignore.hotelview");
IGNORE_IDLED = Emulator.getConfig().getBoolean("hotel.auto.pixels.ignore.idled");
PIXELS = Emulator.getConfig().getInt("hotel.auto.pixels.amount");
}
else
{
this.disposed = true;
}
}
@Override
public void run()
{
super.run();
Habbo habbo = null;
for(Map.Entry<Integer, Habbo> map : Emulator.getGameEnvironment().getHabboManager().getOnlineHabbos().entrySet())
{
habbo = map.getValue();
try
{
if (habbo != null)
{
if (habbo.getHabboInfo().getCurrentRoom() == null && IGNORE_HOTEL_VIEW)
continue;
if (habbo.getRoomUnit().isIdle() && IGNORE_IDLED)
continue;
habbo.givePixels(PIXELS);
}
}
catch (Exception e)
{
Emulator.getLogging().logErrorLine(e);
}
}
}
public static boolean isIgnoreHotelView()
{
return IGNORE_HOTEL_VIEW;
}
public static void setIgnoreHotelView(boolean ignoreHotelView)
{
IGNORE_HOTEL_VIEW = ignoreHotelView;
}
public static boolean isIgnoreIdled()
{
return IGNORE_IDLED;
}
public static void setIgnoreIdled(boolean ignoreIdled)
{
IGNORE_IDLED = ignoreIdled;
}
public static int getPIXELS()
{
return PIXELS;
}
public static void setPIXELS(int PIXELS)
{
PixelScheduler.PIXELS = PIXELS;
}
public boolean isDisposed()
{
return disposed;
}
public void setDisposed(boolean disposed)
{
this.disposed = disposed;
}
}

View File

@ -0,0 +1,111 @@
package com.eu.habbo.core;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.users.Habbo;
import java.util.Map;
public class PointsScheduler extends Scheduler
{
/**
* Defines if users that are not in a room should be excluded from receiving points.
*/
public static boolean IGNORE_HOTEL_VIEW;
/**
* Defines if users idling in rooms should be excluded from receiving points.
*/
public static boolean IGNORE_IDLED;
/**
* The amount of points to give.
*/
private static int POINTS;
public PointsScheduler()
{
super(Emulator.getConfig().getInt("hotel.auto.points.interval"));
if(Emulator.getConfig().getBoolean("hotel.auto.points.enabled"))
{
IGNORE_HOTEL_VIEW = Emulator.getConfig().getBoolean("hotel.auto.points.ignore.hotelview");
IGNORE_IDLED = Emulator.getConfig().getBoolean("hotel.auto.points.ignore.idled");
POINTS = Emulator.getConfig().getInt("hotel.auto.points.amount");
}
else
{
this.disposed = true;
}
}
@Override
public void run()
{
super.run();
Habbo habbo = null;
for(Map.Entry<Integer, Habbo> map : Emulator.getGameEnvironment().getHabboManager().getOnlineHabbos().entrySet())
{
habbo = map.getValue();
try
{
if (habbo != null)
{
if (habbo.getHabboInfo().getCurrentRoom() == null && IGNORE_HOTEL_VIEW)
continue;
if (habbo.getRoomUnit().isIdle() && IGNORE_IDLED)
continue;
habbo.givePoints(POINTS);
}
}
catch (Exception e)
{
Emulator.getLogging().logErrorLine(e);
}
}
}
public static boolean isIgnoreHotelView()
{
return IGNORE_HOTEL_VIEW;
}
public static void setIgnoreHotelView(boolean ignoreHotelView)
{
IGNORE_HOTEL_VIEW = ignoreHotelView;
}
public static boolean isIgnoreIdled()
{
return IGNORE_IDLED;
}
public static void setIgnoreIdled(boolean ignoreIdled)
{
IGNORE_IDLED = ignoreIdled;
}
public static int getPOINTS()
{
return POINTS;
}
public static void setPOINTS(int POINTS)
{
PointsScheduler.POINTS = POINTS;
}
public boolean isDisposed()
{
return disposed;
}
public void setDisposed(boolean disposed)
{
this.disposed = disposed;
}
}

View File

@ -0,0 +1,52 @@
package com.eu.habbo.core;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.outgoing.MessageComposer;
import com.eu.habbo.messages.outgoing.Outgoing;
public class RoomUserPetComposer extends MessageComposer
{
private final int petType;
private final int race;
private final String color;
private final Habbo habbo;
public RoomUserPetComposer(int petType, int race, String color, Habbo habbo)
{
this.petType = petType;
this.race = race;
this.color = color;
this.habbo = habbo;
}
@Override
public ServerMessage compose()
{
this.response.init(Outgoing.RoomUsersComposer);
this.response.appendInt(1);
this.response.appendInt(this.habbo.getHabboInfo().getId());
this.response.appendString(this.habbo.getHabboInfo().getUsername());
this.response.appendString("");
this.response.appendString(this.petType + " " + this.race + " " + this.color + " 2 2 -1 0 3 -1 0");
this.response.appendInt(habbo.getRoomUnit().getId());
this.response.appendInt32(habbo.getRoomUnit().getX());
this.response.appendInt32(habbo.getRoomUnit().getY());
this.response.appendString(habbo.getRoomUnit().getZ() + "");
this.response.appendInt(habbo.getRoomUnit().getBodyRotation().getValue());
this.response.appendInt(2);
this.response.appendInt(this.petType);
this.response.appendInt(this.habbo.getHabboInfo().getId());
this.response.appendString(this.habbo.getHabboInfo().getUsername());
this.response.appendInt(1);
this.response.appendBoolean(false);
this.response.appendBoolean(true);
this.response.appendBoolean(true); //Can toggle breeding permissions.
this.response.appendBoolean(true);
this.response.appendBoolean(true); //Can treat?
this.response.appendBoolean(true); //Can breed
this.response.appendInt(0);
this.response.appendString("");
return this.response;
}
}

View File

@ -0,0 +1,43 @@
package com.eu.habbo.core;
import com.eu.habbo.Emulator;
public class Scheduler implements Runnable
{
protected boolean disposed;
protected int interval;
public Scheduler(int interval)
{
this.interval = interval;
}
public boolean isDisposed()
{
return this.disposed;
}
public void setDisposed(boolean disposed)
{
this.disposed = disposed;
}
public int getInterval()
{
return this.interval;
}
public void setInterval(int interval)
{
this.interval = interval;
}
@Override
public void run()
{
if (this.disposed)
return;
Emulator.getThreading().run(this, this.interval * 1000);
}
}

View File

@ -0,0 +1,172 @@
package com.eu.habbo.core;
import com.eu.habbo.Emulator;
import java.sql.*;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
public class TextsManager
{
/**
* All emulator texts are stored in this object.
*/
private final Properties texts;
public TextsManager()
{
long millis = System.currentTimeMillis();
this.texts = new Properties();
try
{
this.reload();
Emulator.getLogging().logStart("Texts Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)");
}
catch (Exception e)
{
e.printStackTrace();
}
}
/**
* Reloads all texts from the database.
* @throws Exception
*/
public void reload() throws Exception
{
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); Statement statement = connection.createStatement(); ResultSet set = statement.executeQuery("SELECT * FROM emulator_texts"))
{
while(set.next())
{
if(this.texts.containsKey(set.getString("key")))
{
this.texts.setProperty(set.getString("key"), set.getString("value"));
}
else
{
this.texts.put(set.getString("key"), set.getString("value"));
}
}
}
catch (SQLException e)
{
Emulator.getLogging().logSQLException(e);
}
}
/**
* Gets the string value for a specific key.
* @param key The key to find the value for.
* @return The string value for the key. Returns an empty string if not found.
*/
public String getValue(String key)
{
return getValue(key, "");
}
/**
* Gets the string value for a specific key.
* @param key The key to find the value for.
* @param defaultValue The value that will be returned when the key is not found.
* @return The string value for the key. Returns defaultValue when not found.
*/
public String getValue(String key, String defaultValue)
{
if (!this.texts.containsKey(key)) {
Emulator.getLogging().logErrorLine("[TEXTS] Text key not found: " + key);
}
return this.texts.getProperty(key, defaultValue);
}
/**
* Gets the boolean value for a specific key.
* @param key The key to find the value for.
* @return The boolean value for the key. Returns false if not found.
*/
public boolean getBoolean(String key)
{
return getBoolean(key, false);
}
/**
* Gets the boolean value for a specific key.
* @param key The key to find the value for.
* @param defaultValue The value that will be returned when the key is not found.
* @return The boolean value for the key. Returns defaultValue when not found.
*/
public boolean getBoolean(String key, Boolean defaultValue)
{
try
{
return (getValue(key, "0").equals("1")) || (getValue(key, "false").equals("true"));
}
catch (Exception e)
{
Emulator.getLogging().logErrorLine(e);
}
return defaultValue;
}
/**
* Gets the int value for a specific key.
* @param key The key to find the value for.
* @return The int value for the key. Returns 0 if not found.
*/
public int getInt(String key)
{
return getInt(key, 0);
}
/**
* Gets the int value for a specific key.
* @param key The key to find the value for.
* @param defaultValue The value that will be returned when the key is not found.
* @return The int value for the key. Returns defaultValue when not found.
*/
public int getInt(String key, Integer defaultValue)
{
try
{
return Integer.parseInt(getValue(key, defaultValue.toString()));
}
catch (Exception e)
{
Emulator.getLogging().logErrorLine(e);
}
return defaultValue;
}
/**
* Updates the give key.
* @param key The key to update.
* @param value The new value.
*/
public void update(String key, String value)
{
this.texts.setProperty(key, value);
}
public void register(String key, String value)
{
if (this.texts.getProperty(key, null) != null)
return;
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("INSERT INTO emulator_texts VALUES (?, ?)"))
{
statement.setString(1, key);
statement.setString(2, value);
statement.execute();
}
catch (SQLException e)
{
Emulator.getLogging().logSQLException(e);
}
this.update(key, value);
}
}

View File

@ -0,0 +1,110 @@
package com.eu.habbo.core.consolecommands;
import gnu.trove.map.hash.THashMap;
import gnu.trove.set.hash.THashSet;
public abstract class ConsoleCommand
{
/**
* Holds all console commands.
*/
public static THashMap<String, ConsoleCommand> commands = new THashMap<String, ConsoleCommand>();
/**
* The key of the command. First word.
*/
public final String key;
/**
* Usage of the command (Arguments).
*/
public final String usage;
/**
* Constructs a new ConsoleCommand.
* @param key The key of the command. First word.
* @param usage Usage of the command (Arguments).
*/
public ConsoleCommand(String key, String usage)
{
this.key = key;
this.usage = usage;
}
/**
* Loads all default ConsoleCommands.
*/
public static void load()
{
addCommand(new ConsoleShutdownCommand());
addCommand(new ConsoleInfoCommand());
addCommand(new ConsoleTestCommand());
addCommand(new ConsoleReconnectCameraCommand());
}
/**
* Handles a command
* @param args The arguments entered in the console including the key at index 0.
* @throws Exception
*/
public abstract void handle(String[] args) throws Exception;
/**
* Add a new consolecommand.
* @param command The consolecommand to add.
*/
public static void addCommand(ConsoleCommand command)
{
commands.put(command.key, command);
}
/**
* Searches for the consolecommand using a given key.
* @param key The key to find the associated ConsoleCommand for.
* @return The ConsoleCommand associated with the key. return null if not found.
*/
public static ConsoleCommand findCommand(String key)
{
return commands.get(key);
}
/**
* Handles a line entered in the console.
* @param line The line entered in the console.
* @return True if the command was succesfully handled. Otherwise false.
*/
public static boolean handle(String line)
{
String[] message = line.split(" ");
if (message.length > 0)
{
ConsoleCommand command = ConsoleCommand.findCommand(message[0]);
if (command != null)
{
try
{
command.handle(message);
return true;
}
catch (Exception e)
{
e.printStackTrace();
}
}
else
{
System.out.println("Unknown Console Command " + message[0]);
System.out.println("Commands Available (" + commands.size() + "): ");
for (ConsoleCommand c : commands.values())
{
System.out.println(c.key + " " + c.usage);
}
}
}
return false;
}
}

View File

@ -0,0 +1,37 @@
package com.eu.habbo.core.consolecommands;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.catalog.CatalogManager;
import java.util.concurrent.TimeUnit;
public class ConsoleInfoCommand extends ConsoleCommand
{
public ConsoleInfoCommand()
{
super("info", "");
}
@Override
public void handle(String[] args) throws Exception
{
int seconds = Emulator.getIntUnixTimestamp() - Emulator.getTimeStarted();
int day = (int) TimeUnit.SECONDS.toDays(seconds);
long hours = TimeUnit.SECONDS.toHours(seconds) - (day *24);
long minute = TimeUnit.SECONDS.toMinutes(seconds) - (TimeUnit.SECONDS.toHours(seconds)* 60);
long second = TimeUnit.SECONDS.toSeconds(seconds) - (TimeUnit.SECONDS.toMinutes(seconds) *60);
System.out.println("Emulator version: " + Emulator.version);
System.out.println("Hotel Statistics");
System.out.println("- Users: " + Emulator.getGameEnvironment().getHabboManager().getOnlineCount());
System.out.println("- Rooms: " + Emulator.getGameEnvironment().getRoomManager().getActiveRooms().size());
System.out.println("- Shop: " + Emulator.getGameEnvironment().getCatalogManager().catalogPages.size() + " pages and " + CatalogManager.catalogItemAmount + " items.");
System.out.println("- Furni: " + Emulator.getGameEnvironment().getItemManager().getItems().size() + " items.");
System.out.println("");
System.out.println("Server Statistics");
System.out.println("- Uptime: " + day + (day > 1 ? " days, " : " day, ") + hours + (hours > 1 ? " hours, " : " hour, ") + minute + (minute > 1 ? " minutes, " : " minute, ") + second + (second > 1 ? " seconds!" : " second!"));
System.out.println("- RAM Usage: " + (Emulator.getRuntime().totalMemory() - Emulator.getRuntime().freeMemory()) / (1024 * 1024) + "/" + (Emulator.getRuntime().freeMemory()) / (1024 * 1024) + "MB");
System.out.println("- CPU Cores: " + Emulator.getRuntime().availableProcessors());
System.out.println("- Total Memory: " + Emulator.getRuntime().maxMemory() / (1024 * 1024) + "MB");
}
}

View File

@ -0,0 +1,18 @@
package com.eu.habbo.core.consolecommands;
import com.eu.habbo.networking.camera.CameraClient;
public class ConsoleReconnectCameraCommand extends ConsoleCommand
{
public ConsoleReconnectCameraCommand()
{
super("camera", "");
}
@Override
public void handle(String[] args) throws Exception
{
System.out.println("Connecting to the camera...");
CameraClient.attemptReconnect = true;
}
}

View File

@ -0,0 +1,17 @@
package com.eu.habbo.core.consolecommands;
import com.eu.habbo.habbohotel.commands.ShutdownCommand;
public class ConsoleShutdownCommand extends ConsoleCommand
{
public ConsoleShutdownCommand()
{
super("stop", "");
}
@Override
public void handle(String[] args) throws Exception
{
new ShutdownCommand().handle(null, args);
}
}

View File

@ -0,0 +1,19 @@
package com.eu.habbo.core.consolecommands;
public class ConsoleTestCommand extends ConsoleCommand
{
public ConsoleTestCommand()
{
super("test", "test");
}
@Override
public void handle(String[] args) throws Exception
{
System.out.println("This is a test command for live debugging.");
}
}

View File

@ -0,0 +1,80 @@
package com.eu.habbo.database;
import com.eu.habbo.Emulator;
import com.eu.habbo.core.ConfigurationManager;
import com.zaxxer.hikari.HikariDataSource;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.Statement;
public class Database
{
/**
* Database datasource.
*/
private HikariDataSource dataSource;
/**
* Database connection pool.
*/
private DatabasePool databasePool;
public Database(ConfigurationManager config)
{
long millis = System.currentTimeMillis();
boolean SQLException = false;
try
{
this.databasePool = new DatabasePool();
if (!this.databasePool.getStoragePooling(config))
{
Emulator.getLogging().logStart("Failed to connect to the database. Shutting down...");
SQLException = true;
return;
}
this.dataSource = this.databasePool.getDatabase();
}
catch (Exception e)
{
SQLException = true;
e.printStackTrace();
Emulator.getLogging().logStart("Failed to connect to your database.");
Emulator.getLogging().logStart(e.getMessage());
}
finally
{
if (SQLException)
Emulator.prepareShutdown();
}
Emulator.getLogging().logStart("Database -> Connected! (" + (System.currentTimeMillis() - millis) + " MS)");
}
/**
* Disposes the database and closes all connections to the database.
*/
public void dispose()
{
if (this.databasePool != null)
{
this.databasePool.getDatabase().close();
}
this.dataSource.close();
}
public HikariDataSource getDataSource()
{
return this.dataSource;
}
public DatabasePool getDatabasePool()
{
return this.databasePool;
}
}

View File

@ -0,0 +1,61 @@
package com.eu.habbo.database;
import com.eu.habbo.Emulator;
import com.eu.habbo.core.ConfigurationManager;
import com.eu.habbo.core.Logging;
import com.zaxxer.hikari.HikariConfig;
import com.zaxxer.hikari.HikariDataSource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.PrintWriter;
class DatabasePool
{
private final Logger log = LoggerFactory.getLogger(DatabasePool.class);
private HikariDataSource database;
public boolean getStoragePooling(ConfigurationManager config)
{
try
{
HikariConfig databaseConfiguration = new HikariConfig();
databaseConfiguration.setMaximumPoolSize(config.getInt("db.pool.maxsize", 50));
databaseConfiguration.setMinimumIdle(config.getInt("db.pool.minsize", 10));
databaseConfiguration.setJdbcUrl("jdbc:mysql://" + config.getValue("db.hostname", "localhost") + ":" + config.getValue("db.port", "3306") + "/" + config.getValue("db.database", "habbo") + config.getValue("db.params"));
databaseConfiguration.addDataSourceProperty("serverName", config.getValue("db.hostname", "localhost"));
databaseConfiguration.addDataSourceProperty("port", config.getValue("db.port", "3306"));
databaseConfiguration.addDataSourceProperty("databaseName", config.getValue("db.database", "habbo"));
databaseConfiguration.addDataSourceProperty("user", config.getValue("db.username"));
databaseConfiguration.addDataSourceProperty("password", config.getValue("db.password"));
databaseConfiguration.addDataSourceProperty("dataSource.logger", "com.mysql.jdbc.log.StandardLogger");
databaseConfiguration.addDataSourceProperty("dataSource.logSlowQueries", "true");
databaseConfiguration.addDataSourceProperty("dataSource.dumpQueriesOnException", "true");
databaseConfiguration.addDataSourceProperty("prepStmtCacheSize", "500");
databaseConfiguration.addDataSourceProperty("prepStmtCacheSqlLimit", "2048");
databaseConfiguration.addDataSourceProperty("dataSource.logWriter", Logging.getErrorsSQLWriter());
databaseConfiguration.addDataSourceProperty("cachePrepStmts", "true");
databaseConfiguration.addDataSourceProperty("useServerPrepStmts", "true");
databaseConfiguration.addDataSourceProperty("rewriteBatchedStatements", "true");
databaseConfiguration.addDataSourceProperty("useUnicode","true");
databaseConfiguration.setAutoCommit(true);
databaseConfiguration.setConnectionTimeout(300000L);
databaseConfiguration.setValidationTimeout(5000L);
databaseConfiguration.setLeakDetectionThreshold(20000L);
databaseConfiguration.setMaxLifetime(1800000L);
databaseConfiguration.setIdleTimeout(600000L);
//databaseConfiguration.setDriverClassName("com.mysql.jdbc.jdbc2.optional.MysqlDataSource");
this.database = new HikariDataSource(databaseConfiguration);
}
catch (Exception e)
{
return false;
}
return true;
}
public HikariDataSource getDatabase()
{
return this.database;
}
}

View File

@ -0,0 +1,193 @@
package com.eu.habbo.habbohotel;
import com.eu.habbo.Emulator;
import com.eu.habbo.core.CreditsScheduler;
import com.eu.habbo.core.PixelScheduler;
import com.eu.habbo.core.PointsScheduler;
import com.eu.habbo.habbohotel.achievements.AchievementManager;
import com.eu.habbo.habbohotel.bots.BotManager;
import com.eu.habbo.habbohotel.catalog.CatalogManager;
import com.eu.habbo.habbohotel.commands.CommandHandler;
import com.eu.habbo.habbohotel.crafting.CraftingManager;
import com.eu.habbo.habbohotel.guides.GuideManager;
import com.eu.habbo.habbohotel.guilds.GuildManager;
import com.eu.habbo.habbohotel.guilds.forums.GuildForumManager;
import com.eu.habbo.habbohotel.hotelview.HotelViewManager;
import com.eu.habbo.habbohotel.items.ItemManager;
import com.eu.habbo.habbohotel.modtool.ModToolManager;
import com.eu.habbo.habbohotel.modtool.WordFilter;
import com.eu.habbo.habbohotel.navigation.NavigatorManager;
import com.eu.habbo.habbohotel.permissions.PermissionsManager;
import com.eu.habbo.habbohotel.pets.PetManager;
import com.eu.habbo.habbohotel.polls.PollManager;
import com.eu.habbo.habbohotel.rooms.RoomManager;
import com.eu.habbo.habbohotel.users.HabboManager;
public class GameEnvironment
{
private HabboManager habboManager;
private NavigatorManager navigatorManager;
private GuildManager guildManager;
private GuildForumManager guildForumManager;
private ItemManager itemManager;
private CatalogManager catalogManager;
private HotelViewManager hotelViewManager;
private RoomManager roomManager;
private CommandHandler commandHandler;
private PermissionsManager permissionsManager;
private BotManager botManager;
private ModToolManager modToolManager;
private PetManager petManager;
private AchievementManager achievementManager;
private GuideManager guideManager;
private WordFilter wordFilter;
private CraftingManager craftingManager;
private PollManager pollManager;
public CreditsScheduler creditsScheduler;
public PixelScheduler pixelScheduler;
public PointsScheduler pointsScheduler;
public void load()
{
Emulator.getLogging().logStart("GameEnvironment -> Loading...");
this.permissionsManager = new PermissionsManager();
this.habboManager = new HabboManager();
this.hotelViewManager = new HotelViewManager();
this.itemManager = new ItemManager();
this.itemManager.load();
this.botManager = new BotManager();
this.petManager = new PetManager();
this.guildManager = new GuildManager();
this.guildForumManager = new GuildForumManager();
this.catalogManager = new CatalogManager();
this.roomManager = new RoomManager();
this.navigatorManager = new NavigatorManager();
this.commandHandler = new CommandHandler();
this.modToolManager = new ModToolManager();
this.achievementManager = new AchievementManager();
this.achievementManager.reload();
this.guideManager = new GuideManager();
this.wordFilter = new WordFilter();
this.craftingManager = new CraftingManager();
this.pollManager = new PollManager();
this.roomManager.loadPublicRooms();
this.creditsScheduler = new CreditsScheduler();
Emulator.getThreading().run(this.creditsScheduler);
this.pixelScheduler = new PixelScheduler();
Emulator.getThreading().run(this.pixelScheduler);
this.pointsScheduler = new PointsScheduler();
Emulator.getThreading().run(this.pointsScheduler);
Emulator.getLogging().logStart("GameEnvironment -> Loaded!");
}
public void dispose()
{
this.pointsScheduler.setDisposed(true);
this.pixelScheduler.setDisposed(true);
this.creditsScheduler.setDisposed(true);
this.craftingManager.dispose();
this.habboManager.dispose();
this.commandHandler.dispose();
this.guildManager.dispose();
this.catalogManager.dispose();
this.roomManager.dispose();
this.itemManager.dispose();
this.hotelViewManager.dispose();
Emulator.getLogging().logShutdownLine("GameEnvironment -> Disposed!");
}
public HabboManager getHabboManager()
{
return this.habboManager;
}
public NavigatorManager getNavigatorManager()
{
return this.navigatorManager;
}
public GuildManager getGuildManager()
{
return this.guildManager;
}
public GuildForumManager getGuildForumManager()
{
return this.guildForumManager;
}
public ItemManager getItemManager()
{
return this.itemManager;
}
public CatalogManager getCatalogManager()
{
return this.catalogManager;
}
public HotelViewManager getHotelViewManager()
{
return this.hotelViewManager;
}
public RoomManager getRoomManager()
{
return this.roomManager;
}
public CommandHandler getCommandHandler()
{
return this.commandHandler;
}
public PermissionsManager getPermissionsManager()
{
return this.permissionsManager;
}
public BotManager getBotManager()
{
return this.botManager;
}
public ModToolManager getModToolManager()
{
return this.modToolManager;
}
public PetManager getPetManager()
{
return this.petManager;
}
public AchievementManager getAchievementManager()
{
return this.achievementManager;
}
public GuideManager getGuideManager()
{
return this.guideManager;
}
public WordFilter getWordFilter()
{
return this.wordFilter;
}
public CraftingManager getCraftingManager()
{
return this.craftingManager;
}
public PollManager getPollManager()
{
return this.pollManager;
}
}

View File

@ -0,0 +1,108 @@
package com.eu.habbo.habbohotel.achievements;
import gnu.trove.map.hash.THashMap;
import java.sql.ResultSet;
import java.sql.SQLException;
public class Achievement
{
/**
* Id of the Achievement.
*/
public final int id;
/**
* Name of the Achievement;
*/
public final String name;
/**
* Category of the achievement.
*/
public final AchievementCategories category;
/**
* The levels this achievement has.
*/
public final THashMap<Integer, AchievementLevel> levels;
/**
* Creates an new achievement.
* @param set The ResultSet it should fetch the data from.
* @throws SQLException
*/
public Achievement(ResultSet set) throws SQLException
{
levels = new THashMap<Integer, AchievementLevel>();
id = set.getInt("id");
this.name = set.getString("name");
this.category = AchievementCategories.valueOf(set.getString("category").toUpperCase());
this.addLevel(new AchievementLevel(set));
}
/**
* Adds an new AchievementLevel to the Achievement.
* @param level The AchievementLevel to be added.
*/
public void addLevel(AchievementLevel level)
{
synchronized (this.levels)
{
this.levels.put(level.level, level);
}
}
/**
* Calculates the AchievementLevel for the given progress.
* @param progress The amount of progress.
* @return The AchievementLevel that matches the amount of progress.
*/
public AchievementLevel getLevelForProgress(int progress)
{
AchievementLevel l = null;
for(AchievementLevel level : this.levels.values())
{
if (l == null && level.level == 1)
{
l = level;
}
if (progress >= level.progress)
{
if (l != null)
{
if (l.level > level.level)
{
continue;
}
}
l = level;
}
}
return l;
}
/**
* Calculates the next level compared to the current level.
* @param currentLevel The current level to calculate the next level for.
* @return The next level. Return null if there is no next level.
*/
public AchievementLevel getNextLevel(int currentLevel)
{
AchievementLevel l = null;
for(AchievementLevel level : this.levels.values())
{
if(level.level == (currentLevel + 1))
return level;
}
return null;
}
}

View File

@ -0,0 +1,64 @@
package com.eu.habbo.habbohotel.achievements;
public enum AchievementCategories
{
/**
* Achievements like looks that kill, email registered etc.
*/
IDENTITY,
/**
* Achievements like room raider.
*/
EXPLORE,
/**
* Related to playing music, created music and so on.
*/
MUSIC,
/**
* Achievements like giving respect, hanging out in other peoples room etc.
*/
SOCIAL,
/**
* Games! Banzai! Freeze!
*/
GAMES,
/**
* Stacking, builder, everthing related to furntiure.
*/
ROOM_BUILDER,
/**
* Cat scratch fever.
*/
PETS,
/**
* Could be used for achievements related to floorplan editor. Not sure.
*/
TOOLS,
/**
* Whatever floats your boat goes in here.
*/
OTHER,
/**
* Please referain from using.
*/
TEST,
/**
* Achievements that you don't want to showup in the achievements window.
*/
INVISIBLE,
/**
* Events, anything you want to add.
*/
EVENTS
}

View File

@ -0,0 +1,41 @@
package com.eu.habbo.habbohotel.achievements;
import java.sql.ResultSet;
import java.sql.SQLException;
public class AchievementLevel
{
/**
* level of the achievement.
*/
public final int level;
/**
* Amount of currency to give upon achieving this level.
*/
public final int rewardAmount;
/**
* Currency type to give upon achieving this level.
*/
public final int rewardType;
/**
* Amount of achievement points to add upon achieving this level.
*/
public final int points;
/**
* Amount of progress needed to achieve this level.
*/
public final int progress;
public AchievementLevel(ResultSet set) throws SQLException
{
this.level = set.getInt("level");
this.rewardAmount = set.getInt("reward_amount");
this.rewardType = set.getInt("reward_type");
this.points = set.getInt("points");
this.progress = set.getInt("progress_needed");
}
}

View File

@ -0,0 +1,478 @@
package com.eu.habbo.habbohotel.achievements;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboBadge;
import com.eu.habbo.habbohotel.users.HabboItem;
import com.eu.habbo.messages.outgoing.achievements.AchievementProgressComposer;
import com.eu.habbo.messages.outgoing.achievements.AchievementUnlockedComposer;
import com.eu.habbo.messages.outgoing.achievements.talenttrack.TalentLevelUpdateComposer;
import com.eu.habbo.messages.outgoing.inventory.AddHabboItemComposer;
import com.eu.habbo.messages.outgoing.rooms.users.RoomUserDataComposer;
import com.eu.habbo.messages.outgoing.users.AddUserBadgeComposer;
import com.eu.habbo.messages.outgoing.users.UserBadgesComposer;
import com.eu.habbo.plugin.Event;
import com.eu.habbo.plugin.events.users.achievements.UserAchievementLeveledEvent;
import com.eu.habbo.plugin.events.users.achievements.UserAchievementProgressEvent;
import gnu.trove.map.hash.THashMap;
import gnu.trove.procedure.TObjectIntProcedure;
import java.sql.*;
import java.util.LinkedHashMap;
import java.util.Map;
public class AchievementManager
{
/**
* All the achievements in the hotel are stored in this map where:
* String = name of the achievement (Without ACH_ & Roman number.
* Achievement = Instance of the Achievement class.
*/
private final THashMap<String, Achievement> achievements;
private final THashMap<TalentTrackType, LinkedHashMap<Integer, TalentTrackLevel>> talentTrackLevels;
/**
* The AchievementManager, shit happens here.
*/
public AchievementManager()
{
this.achievements = new THashMap<>();
this.talentTrackLevels = new THashMap<>();
}
/**
* Reloads the achievement manager.
*/
public void reload()
{
long millis = System.currentTimeMillis();
synchronized (this.achievements)
{
this.achievements.clear();
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection())
{
try (Statement statement = connection.createStatement(); ResultSet set = statement.executeQuery("SELECT * FROM achievements"))
{
while (set.next())
{
if (!this.achievements.containsKey(set.getString("name")))
{
this.achievements.put(set.getString("name"), new Achievement(set));
}
else
{
this.achievements.get(set.getString("name")).addLevel(new AchievementLevel(set));
}
}
}
catch (SQLException e)
{
Emulator.getLogging().logSQLException(e);
}
catch (Exception e)
{
Emulator.getLogging().logErrorLine(e);
}
synchronized (this.talentTrackLevels)
{
this.talentTrackLevels.clear();
try (Statement statement = connection.createStatement(); ResultSet set = statement.executeQuery("SELECT * FROM achievements_talents ORDER BY level ASC"))
{
while (set.next())
{
TalentTrackLevel level = new TalentTrackLevel(set);
if (!this.talentTrackLevels.containsKey(level.type))
{
this.talentTrackLevels.put(level.type, new LinkedHashMap<Integer, TalentTrackLevel>());
}
this.talentTrackLevels.get(level.type).put(level.level, level);
}
}
}
}
catch (SQLException e)
{
Emulator.getLogging().logSQLException(e);
Emulator.getLogging().logErrorLine("Achievement Manager -> Failed to load!");
return;
}
}
Emulator.getLogging().logStart("Achievement Manager -> Loaded! ("+(System.currentTimeMillis() - millis)+" MS)");
}
/**
* Find an achievement by name.
* @param name The achievement to find.
* @return The achievement
*/
public Achievement getAchievement(String name)
{
return this.achievements.get(name);
}
/**
* Find an achievement by id
* @param id The achievement id to find.
* @return The achievement
*/
public Achievement getAchievement(int id)
{
synchronized (this.achievements)
{
for (Map.Entry<String, Achievement> set : this.achievements.entrySet())
{
if (set.getValue().id == id)
{
return set.getValue();
}
}
}
return null;
}
public THashMap<String, Achievement> getAchievements()
{
return this.achievements;
}
public static void progressAchievement(int habboId, Achievement achievement)
{
progressAchievement(habboId, achievement, 1);
}
public static void progressAchievement(int habboId, Achievement achievement, int amount)
{
if (achievement != null)
{
Habbo habbo = Emulator.getGameEnvironment().getHabboManager().getHabbo(habboId);
if (habbo != null)
{
progressAchievement(habbo, achievement, amount);
}
else
{
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection();
PreparedStatement statement = connection.prepareStatement("" +
"INSERT INTO users_achievements_queue (user_id, achievement_id, amount) VALUES (?, ?, ?) " +
"ON DUPLICATE KEY UPDATE amount = amount + ?"))
{
statement.setInt(1, habboId);
statement.setInt(2, achievement.id);
statement.setInt(3, amount);
statement.setInt(4, amount);
statement.execute();
}
catch (SQLException e)
{
Emulator.getLogging().logSQLException(e);
}
}
}
}
/**
* Progresses an Habbo's achievement by 1.
* @param habbo The Habbo whose achievement should be progressed.
* @param achievement The Achievement to be progressed.
*/
public static void progressAchievement(Habbo habbo, Achievement achievement)
{
progressAchievement(habbo, achievement, 1);
}
/**
* Progresses an Habbo's achievement by an given amount.
* @param habbo The Habbo whose achievement should be progressed.
* @param achievement The Achievement to be progressed.
* @param amount The amount that should be progressed.
*/
public static void progressAchievement(Habbo habbo, Achievement achievement, int amount)
{
if (achievement == null)
return;
if (habbo == null)
return;
if (!habbo.isOnline())
return;
int currentProgress = habbo.getHabboStats().getAchievementProgress(achievement);
if(currentProgress == -1)
{
currentProgress = 0;
createUserEntry(habbo, achievement);
habbo.getHabboStats().setProgress(achievement, 0);
}
if(Emulator.getPluginManager().isRegistered(UserAchievementProgressEvent.class, true))
{
Event userAchievementProgressedEvent = new UserAchievementProgressEvent(habbo, achievement, amount);
Emulator.getPluginManager().fireEvent(userAchievementProgressedEvent);
if(userAchievementProgressedEvent.isCancelled())
return;
}
AchievementLevel oldLevel = achievement.getLevelForProgress(currentProgress);
if(oldLevel == null)
return;
if(oldLevel.level == achievement.levels.size() && currentProgress == oldLevel.progress) //Maximum achievement gotten.
return;
habbo.getHabboStats().setProgress(achievement, currentProgress + amount);
AchievementLevel newLevel = achievement.getLevelForProgress(currentProgress + amount);
if(oldLevel.level == newLevel.level && newLevel.level < achievement.levels.size())
{
habbo.getClient().sendResponse(new AchievementProgressComposer(habbo, achievement));
}
else
{
if(Emulator.getPluginManager().isRegistered(UserAchievementLeveledEvent.class, true))
{
Event userAchievementLeveledEvent = new UserAchievementLeveledEvent(habbo, achievement, oldLevel, newLevel);
Emulator.getPluginManager().fireEvent(userAchievementLeveledEvent);
if(userAchievementLeveledEvent.isCancelled())
return;
}
habbo.getClient().sendResponse(new AchievementProgressComposer(habbo, achievement));
habbo.getClient().sendResponse(new AchievementUnlockedComposer(habbo, achievement));
//Exception could possibly arise when the user disconnects while being in tour.
//The achievement is then progressed but the user is already disposed so fetching
//the badge would result in an nullpointer exception. This is normal behaviour.
HabboBadge badge = null;
try
{
badge = habbo.getInventory().getBadgesComponent().getBadge(("ACH_" + achievement.name + oldLevel.level).toLowerCase());
}
catch (Exception e)
{
return;
}
if (badge != null)
{
badge.setCode("ACH_" + achievement.name + newLevel.level);
badge.needsInsert(false);
badge.needsUpdate(true);
} else
{
badge = new HabboBadge(0, "ACH_" + achievement.name + newLevel.level, 0, habbo);
habbo.getClient().sendResponse(new AddUserBadgeComposer(badge));
badge.needsInsert(true);
badge.needsUpdate(true);
habbo.getInventory().getBadgesComponent().addBadge(badge);
}
Emulator.getThreading().run(badge);
if(badge.getSlot() > 0)
{
if(habbo.getHabboInfo().getCurrentRoom() != null)
{
habbo.getHabboInfo().getCurrentRoom().sendComposer(new UserBadgesComposer(habbo.getInventory().getBadgesComponent().getWearingBadges(), habbo.getHabboInfo().getId()).compose());
}
}
habbo.getHabboStats().addAchievementScore(newLevel.points);
if (habbo.getHabboInfo().getCurrentRoom() != null)
{
habbo.getHabboInfo().getCurrentRoom().sendComposer(new RoomUserDataComposer(habbo).compose());
}
for (TalentTrackType type : TalentTrackType.values())
{
if (Emulator.getGameEnvironment().getAchievementManager().talentTrackLevels.containsKey(type))
{
for (Map.Entry<Integer, TalentTrackLevel> entry : Emulator.getGameEnvironment().getAchievementManager().talentTrackLevels.get(type).entrySet())
{
if (entry.getValue().achievements.containsKey(achievement))
{
Emulator.getGameEnvironment().getAchievementManager().handleTalentTrackAchievement(habbo, type, achievement);
}
}
}
}
}
}
/**
* Checks wether the given Habbo has achieved a certain Achievement.
* @param habbo The Habbo to check.
* @param achievement The Achievement to check.
* @return True when the given Habbo has achieved the Achievement.
*/
public static boolean hasAchieved(Habbo habbo, Achievement achievement)
{
int currentProgress = habbo.getHabboStats().getAchievementProgress(achievement);
if(currentProgress == -1)
{
return false;
}
AchievementLevel level = achievement.getLevelForProgress(currentProgress);
if(level == null)
return false;
AchievementLevel nextLevel = achievement.levels.get(level.level + 1);
if (nextLevel == null && currentProgress >= level.progress)
{
return true;
}
return false;
}
/**
* Creates an new Achievement entry in the database.
* @param habbo The Habbo the achievement should be saved for.
* @param achievement The Achievement that should be inserted.
*/
public static void createUserEntry(Habbo habbo, Achievement achievement)
{
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("INSERT INTO users_achievements (user_id, achievement_name, progress) VALUES (?, ?, ?)"))
{
statement.setInt(1, habbo.getHabboInfo().getId());
statement.setString(2, achievement.name);
statement.setInt(3, 1);
statement.execute();
}
catch (SQLException e)
{
Emulator.getLogging().logSQLException(e);
}
}
/**
* Saves all the Achievements for the given Habbo to the database.
* @param habbo The Habbo whose Achievements should be saved.
*/
public static void saveAchievements(Habbo habbo)
{
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("UPDATE users_achievements SET progress = ? WHERE achievement_name = ? AND user_id = ? LIMIT 1"))
{
statement.setInt(3, habbo.getHabboInfo().getId());
for(Map.Entry<Achievement, Integer> map : habbo.getHabboStats().getAchievementProgress().entrySet())
{
statement.setInt(1, map.getValue());
statement.setString(2, map.getKey().name);
statement.addBatch();
}
statement.executeBatch();
}
catch (SQLException e)
{
Emulator.getLogging().logSQLException(e);
}
}
public LinkedHashMap<Integer, TalentTrackLevel> getTalenTrackLevels(TalentTrackType type)
{
return this.talentTrackLevels.get(type);
}
public TalentTrackLevel calculateTalenTrackLevel(Habbo habbo, TalentTrackType type)
{
TalentTrackLevel level = null;
for (Map.Entry<Integer, TalentTrackLevel> entry : this.talentTrackLevels.get(type).entrySet())
{
final boolean[] allCompleted = {true};
entry.getValue().achievements.forEachEntry(new TObjectIntProcedure<Achievement>()
{
@Override
public boolean execute(Achievement a, int b)
{
if (habbo.getHabboStats().getAchievementProgress(a) < b)
{
allCompleted[0] = false;
}
return allCompleted[0];
}
});
if (allCompleted[0])
{
if (level == null || level.level < entry.getValue().level)
{
level = entry.getValue();
}
}
else
{
break;
}
}
return level;
}
public void handleTalentTrackAchievement(Habbo habbo, TalentTrackType type, Achievement achievement)
{
TalentTrackLevel currentLevel = this.calculateTalenTrackLevel(habbo, type);
if (currentLevel.level > habbo.getHabboStats().talentTrackLevel(type))
{
for (int i = habbo.getHabboStats().talentTrackLevel(type); i <= currentLevel.level; i++)
{
TalentTrackLevel level = this.getTalentTrackLevel(type, i);
if (level != null)
{
for (Item item : level.items)
{
HabboItem rewardItem = Emulator.getGameEnvironment().getItemManager().createItem(habbo.getHabboInfo().getId(), item, 0, 0, "");
habbo.getInventory().getItemsComponent().addItem(rewardItem);
habbo.getClient().sendResponse(new AddHabboItemComposer(rewardItem));
}
for (String badge : level.badges)
{
if (!badge.isEmpty())
{
HabboBadge b = new HabboBadge(0, badge, 0, habbo);
Emulator.getThreading().run(b);
habbo.getInventory().getBadgesComponent().addBadge(b);
habbo.getClient().sendResponse(new AddUserBadgeComposer(b));
}
}
habbo.getClient().sendResponse(new TalentLevelUpdateComposer(type, level));
}
}
}
habbo.getHabboStats().setTalentLevel(type, currentLevel.level);
}
public TalentTrackLevel getTalentTrackLevel(TalentTrackType type, int level)
{
return this.talentTrackLevels.get(type).get(level);
}
}

View File

@ -0,0 +1,92 @@
package com.eu.habbo.habbohotel.achievements;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.items.Item;
import gnu.trove.map.TIntIntMap;
import gnu.trove.map.TObjectIntMap;
import gnu.trove.map.hash.TIntIntHashMap;
import gnu.trove.map.hash.TObjectIntHashMap;
import gnu.trove.set.hash.THashSet;
import java.sql.ResultSet;
import java.sql.SQLException;
public class TalentTrackLevel
{
/**
* Type of this talen track level.
*/
public TalentTrackType type;
/**
* The level of this TalenTrackLevel.
*/
public int level;
/**
* Achievements required to achieve this level.
*/
public TObjectIntMap<Achievement> achievements;
/**
* Items that will be rewarded upon achieving this level.
*/
public THashSet<Item> items;
/**
* Perks unlocked upon achieving this level.
*/
public String[] perks;
/**
* Badges received upon achieving this level.
*/
public String[] badges;
public TalentTrackLevel(ResultSet set) throws SQLException
{
this.type = TalentTrackType.valueOf(set.getString("type").toUpperCase());
this.level = set.getInt("level");
this.achievements = new TObjectIntHashMap<Achievement>();
this.items = new THashSet<Item>();
String[] achievements = set.getString("achievement_ids").split(",");
String[] achievementLevels = set.getString("achievement_levels").split(",");
if (achievementLevels.length == achievements.length)
{
for (int i = 0; i < achievements.length; i++)
{
if (achievements[i].isEmpty() || achievementLevels[i].isEmpty())
continue;
Achievement achievement = Emulator.getGameEnvironment().getAchievementManager().getAchievement(Integer.valueOf(achievements[i]));
if (achievement != null)
{
this.achievements.put(achievement, Integer.valueOf(achievementLevels[i]));
}
else
{
Emulator.getLogging().logErrorLine("Could not find achievement with ID " + achievements[i] + " for talenttrack level " + this.level + " of type " + this.type);
}
}
}
for (String s : set.getString("reward_furni").split(","))
{
Item item = Emulator.getGameEnvironment().getItemManager().getItem(Integer.valueOf(s));
if (item != null)
{
items.add(item);
}
else
{
Emulator.getLogging().logStart("Incorrect reward furni (ID: " + s + ") for talent track level " + this.level);
}
}
this.perks = set.getString("reward_perks").split(",");
this.badges = set.getString("reward_badges").split(",");
}
}

View File

@ -0,0 +1,14 @@
package com.eu.habbo.habbohotel.achievements;
public enum TalentTrackType
{
/**
* Talent track for citizenship.
*/
CITIZENSHIP,
/**
* Talent track for helpers and guardians.
*/
HELPER
}

View File

@ -0,0 +1,713 @@
package com.eu.habbo.habbohotel.bots;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.rooms.*;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboGender;
import com.eu.habbo.habbohotel.wired.WiredHandler;
import com.eu.habbo.habbohotel.wired.WiredTriggerType;
import com.eu.habbo.messages.outgoing.rooms.users.*;
import com.eu.habbo.plugin.events.bots.BotChatEvent;
import com.eu.habbo.plugin.events.bots.BotShoutEvent;
import com.eu.habbo.plugin.events.bots.BotTalkEvent;
import com.eu.habbo.plugin.events.bots.BotWhisperEvent;
import com.eu.habbo.threading.runnables.BotFollowHabbo;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Arrays;
public class Bot implements Runnable
{
/**
* Bot id.
*/
private int id;
/**
* Bot name.
*/
private String name;
/**
* Bot motto.
*/
private String motto;
/**
* Bot look.
*/
private String figure;
/**
* Bot gender.
*/
private HabboGender gender;
/**
* Bot owner id.
*/
private int ownerId;
/**
* Bot owner name.
*/
private String ownerName;
/**
* Current room the bot is in.
*/
private Room room;
/**
* Current roomUnit that is linked to this bot.
*/
private RoomUnit roomUnit;
/**
* Should auto talk.
*/
private boolean chatAuto;
/**
* Should talk random.
*/
private boolean chatRandom;
/**
* Delay between each sentence.
*/
private short chatDelay;
/**
* Next timestamp the bot can talk.
*/
private int chatTimeOut;
/**
* All chatlines the bot has.
*/
private final ArrayList<String> chatLines;
/**
* Last chatline the bot spoke.
*/
private short lastChatIndex;
/**
* Type of this bot. Used to define custom behaviour.
* See API docs on how to use this.
*/
private String type;
/**
* Enable effect id.
*/
private int effect;
/**
* Wether the bot has to be saved to the database.
*/
private boolean needsUpdate;
/**
* Which roomunit is this bot following.
*/
private int followingHabboId;
public Bot(int id, String name, String motto, String figure, HabboGender gender, int ownerId, String ownerName)
{
this.id = id;
this.name = name;
this.motto = motto;
this.figure = figure;
this.gender = gender;
this.ownerId = ownerId;
this.ownerName = ownerName;
this.chatAuto = false;
this.chatRandom = false;
this.chatDelay = 1000;
this.chatLines = new ArrayList<String>();
this.type = "generic_bot";
this.room = null;
}
public Bot(ResultSet set) throws SQLException
{
this.id = set.getInt("id");
this.name = set.getString("name");
this.motto = set.getString("motto");
this.figure = set.getString("figure");
this.gender = HabboGender.valueOf(set.getString("gender"));
this.ownerId = set.getInt("user_id");
this.ownerName = set.getString("owner_name");
this.chatAuto = set.getString("chat_auto").equals("1");
this.chatRandom = set.getString("chat_random").equals("1");
this.chatDelay = set.getShort("chat_delay");
this.chatLines = new ArrayList<String>(Arrays.asList(set.getString("chat_lines").split("\r")));
this.type = set.getString("type");
this.effect = set.getInt("effect");
this.room = null;
this.roomUnit = null;
this.chatTimeOut = Emulator.getIntUnixTimestamp() + this.chatDelay;
this.needsUpdate = false;
this.lastChatIndex = 0;
}
public Bot(Bot bot)
{
this.name = bot.getName();
this.motto = bot.getMotto();
this.figure = bot.getFigure();
this.gender = bot.getGender();
this.ownerId = bot.getOwnerId();
this.ownerName = bot.getOwnerName();
this.chatAuto = true;
this.chatRandom = false;
this.chatDelay = 10;
this.chatTimeOut = Emulator.getIntUnixTimestamp() + this.chatDelay;
this.chatLines = new ArrayList<String>(Arrays.asList(new String[] {"Default Message :D"}));
this.type = bot.getType();
this.effect = bot.getEffect();
this.room = null;
this.roomUnit = null;
this.lastChatIndex = 0;
this.needsUpdate = false;
}
/**
* Sets wheter the bot has to be updated in the database.
* @param needsUpdate Should the bot be updated in the database.
*/
public void needsUpdate(boolean needsUpdate)
{
this.needsUpdate = needsUpdate;
}
/**
* @return Wether the bot has to be updated in the database.
*/
public boolean needsUpdate()
{
return this.needsUpdate;
}
@Override
public void run()
{
if(this.needsUpdate)
{
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("UPDATE bots SET name = ?, motto = ?, figure = ?, gender = ?, user_id = ?, room_id = ?, x = ?, y = ?, z = ?, rot = ?, dance = ?, freeroam = ?, chat_lines = ?, chat_auto = ?, chat_random = ?, chat_delay = ? WHERE id = ?"))
{
statement.setString(1, this.name);
statement.setString(2, this.motto);
statement.setString(3, this.figure);
statement.setString(4, this.gender.toString());
statement.setInt(5, this.ownerId);
statement.setInt(6, this.room == null ? 0 : this.room.getId());
statement.setInt(7, this.roomUnit == null ? 0 : this.roomUnit.getX());
statement.setInt(8, this.roomUnit == null ? 0 : this.roomUnit.getY());
statement.setDouble(9, this.roomUnit == null ? 0 : this.roomUnit.getZ());
statement.setInt(10, this.roomUnit == null ? 0 : this.roomUnit.getBodyRotation().getValue());
statement.setInt(11, this.roomUnit == null ? 0 : this.roomUnit.getDanceType().getType());
statement.setString(12, this.roomUnit == null ? "0" : this.roomUnit.canWalk() ? "1" : "0");
String text = "";
for(String s : this.chatLines)
{
text += s + "\r";
}
statement.setString(13, text);
statement.setString(14, this.chatAuto ? "1" : "0");
statement.setString(15, this.chatRandom ? "1" : "0");
statement.setInt(16, this.chatDelay);
statement.setInt(17, this.id);
statement.execute();
this.needsUpdate = false;
}
catch(SQLException e)
{
Emulator.getLogging().logSQLException(e);
}
}
}
/**
* Cycles through the bot checking if the bot should perform a certain action:
*
* -> Look for a new tile to walk to.
* -> Speak
*
* Override to implement custom behaviour. Make sure to call super.cycle() first.
*/
public void cycle(boolean canWalk)
{
if(this.roomUnit != null)
{
if(canWalk && this.getRoomUnit().canWalk())
{
if (!this.roomUnit.isWalking())
{
if (this.roomUnit.getWalkTimeOut() < Emulator.getIntUnixTimestamp() && this.followingHabboId == 0)
{
this.roomUnit.setGoalLocation(this.room.getRandomWalkableTile());
int timeOut = Emulator.getRandom().nextInt(20) * 2;
this.roomUnit.setWalkTimeOut((timeOut < 10 ? 5 : timeOut) + Emulator.getIntUnixTimestamp());
}
} else
{
for (RoomTile t : this.room.getLayout().getTilesAround(this.room.getLayout().getTile(this.getRoomUnit().getX(), this.getRoomUnit().getY())))
{
WiredHandler.handle(WiredTriggerType.BOT_REACHED_STF, this.roomUnit, this.room, room.getItemsAt(t).toArray());
}
}
}
if(!this.chatLines.isEmpty() && this.chatTimeOut <= Emulator.getIntUnixTimestamp() && this.chatAuto)
{
if(this.room != null)
{
this.lastChatIndex = (this.chatRandom ? (short)Emulator.getRandom().nextInt(this.chatLines.size()) : (this.lastChatIndex == (this.chatLines.size() - 1) ? 0 : this.lastChatIndex++));
this.talk(this.chatLines.get(this.lastChatIndex)
.replace("%owner%", this.room.getOwnerName())
.replace("%item_count%", this.room.itemCount() + "")
.replace("%name%", this.name)
.replace("%roomname%", this.room.getName())
.replace("%user_count%", this.room.getUserCount() + ""));
this.chatTimeOut = Emulator.getIntUnixTimestamp() + this.chatDelay;
}
}
}
}
/**
* Have the bot say something in the room it currently is in.
* @param message The message the bot has to say.
*/
public void talk(String message)
{
if(this.room != null)
{
BotChatEvent event = new BotTalkEvent(this, message);
if(Emulator.getPluginManager().fireEvent(event).isCancelled())
return;
this.room.botChat(new RoomUserTalkComposer(new RoomChatMessage(event.message, this.roomUnit, RoomChatMessageBubbles.BOT)).compose());
}
}
/**
* Have the bot shout something in the room it currently is in.
* @param message The message the bot has to shout.
*/
public void shout(String message)
{
if(this.room != null)
{
BotChatEvent event = new BotShoutEvent(this, message);
if(Emulator.getPluginManager().fireEvent(event).isCancelled())
return;
this.room.botChat(new RoomUserShoutComposer(new RoomChatMessage(event.message, this.roomUnit, RoomChatMessageBubbles.BOT)).compose());
}
}
/**
* Have the bot whisper something to a habbo.
* @param message The message the bot has to whisper.
* @param habbo The Habbo it should whisper to.
*/
public void whisper(String message, Habbo habbo)
{
if(this.room != null && habbo != null)
{
BotWhisperEvent event = new BotWhisperEvent(this, message, habbo);
if(Emulator.getPluginManager().fireEvent(event).isCancelled())
return;
event.target.getClient().sendResponse(new RoomUserWhisperComposer(new RoomChatMessage(event.message, this.roomUnit, RoomChatMessageBubbles.BOT)));
}
}
/**
* This event is triggered whenever a Habbo places a bot.
* @param habbo The Habbo who placed this bot.
* @param room The room this bot was placed in.
*/
public void onPlace(Habbo habbo, Room room)
{
}
/**
* This event is triggered whenever a Habbo picks a bot.
* @param habbo The Habbo who picked up this bot.
* @param room The Room this bot was placed in.
*/
public void onPickUp(Habbo habbo, Room room)
{
}
/**
* This event is triggered whenever a Habbo talks or shouts in a room.
* @param message The message that has been said.
*/
public void onUserSay(final RoomChatMessage message)
{
}
/**
* @return The id of the bot.
*/
public int getId()
{
return this.id;
}
/**
* Sets the id of the bot.
* @param id The new id of the bot.
*/
public void setId(int id)
{
this.id = id;
}
/**
* @return The name of the bot
*/
public String getName()
{
return this.name;
}
/**
* Sets the name of the bot.
* @param name The new name of the bot.
*/
public void setName(String name)
{
this.name = name;
this.needsUpdate = true;
//if(this.room != null)
//this.room.sendComposer(new ChangeNameUpdatedComposer(this.getRoomUnit(), this.getName()).compose());
}
/**
* @return The motto of the bot.
*/
public String getMotto()
{
return this.motto;
}
/**
* Sets a new motto for the bot.
* @param motto The new motto for the bot.
*/
public void setMotto(String motto)
{
this.motto = motto;
this.needsUpdate = true;
}
/**
* @return The figure of the bot.
*/
public String getFigure()
{
return this.figure;
}
/**
* Sets a new figure of the bot and updates it in the room.
* @param figure The new figure of the bot.
*/
public void setFigure(String figure)
{
this.figure = figure;
this.needsUpdate = true;
if(this.room != null)
this.room.sendComposer(new RoomUsersComposer(this).compose());
}
/**
* @return The gender of the bot.
*/
public HabboGender getGender()
{
return this.gender;
}
/**
* Sets a new Gender of the bot and updates it in the room.
* @param gender The new gender of the bot.
*/
public void setGender(HabboGender gender)
{
this.gender = gender;
this.needsUpdate = true;
if(this.room != null)
this.room.sendComposer(new RoomUsersComposer(this).compose());
}
/**
* @return The owner id of the bot.
*/
public int getOwnerId()
{
return this.ownerId;
}
/**
* @param ownerId The new owner id of the bot.
*/
public void setOwnerId(int ownerId)
{
this.ownerId = ownerId;
this.needsUpdate = true;
if(this.room != null)
this.room.sendComposer(new RoomUsersComposer(this).compose());
}
/**
* @return The owner name of the bot.
*/
public String getOwnerName()
{
return this.ownerName;
}
/**
* @param ownerName The new owner name of the bot.
*/
public void setOwnerName(String ownerName)
{
this.ownerName = ownerName;
this.needsUpdate = true;
if(this.room != null)
this.room.sendComposer(new RoomUsersComposer(this).compose());
}
/**
* @return The room this bot is in. Returns NULL when in inventory.
*/
public Room getRoom()
{
return this.room;
}
/**
* @param room The room this bot is in.
*/
public void setRoom(Room room)
{
this.room = room;
}
/**
* @return The RoomUnit of the bot.
*/
public RoomUnit getRoomUnit()
{
return this.roomUnit;
}
/**
* @param roomUnit The RoomUnit of the bot.
*/
public void setRoomUnit(RoomUnit roomUnit)
{
this.roomUnit = roomUnit;
}
/**
* @return Wether the bot has auto chat enabled.
*/
public boolean isChatAuto()
{
return this.chatAuto;
}
/**
* @param chatAuto Sets wheter the bot has auto chat enabled.
*/
public void setChatAuto(boolean chatAuto)
{
this.chatAuto = chatAuto;
this.needsUpdate = true;
}
/**
* @return Wheter the chatter is randomly selected.
*/
public boolean isChatRandom()
{
return this.chatRandom;
}
/**
* @param chatRandom Sets wheter the chatter is randomly selected.
*/
public void setChatRandom(boolean chatRandom)
{
this.chatRandom = chatRandom;
this.needsUpdate = true;
}
/**
* @return The minimum interval between two messages spoken by the bot.
*/
public int getChatDelay()
{
return this.chatDelay;
}
/**
* @param chatDelay Sets the minimum interval between two messages spoken by the bot.
*/
public void setChatDelay(short chatDelay)
{
this.chatDelay = chatDelay;
this.needsUpdate = true;
}
/**
* Removes all chatlines from the bot.
*/
public void clearChat()
{
synchronized (this.chatLines)
{
this.chatLines.clear();
this.needsUpdate = true;
}
}
/**
* @return The bot type.
*/
public String getType()
{
return this.type;
}
/**
* @return The current enable effect.
*/
public int getEffect()
{
return this.effect;
}
/**
* Sets the effect for a bot and also updates it to the room.
* @param effect The effect to give to the bot.
*/
public void setEffect(int effect)
{
this.effect = effect;
this.needsUpdate = true;
if (this.roomUnit != null)
{
this.roomUnit.setEffectId(this.effect);
if (this.room != null)
{
this.room.sendComposer(new RoomUserEffectComposer(this.roomUnit).compose());
}
}
}
/**
* Adds new chatlines to the bot. Does not erase existing chatlines.
* @param chatLines The chatlines to add.
*/
public void addChatLines(ArrayList<String> chatLines)
{
synchronized (this.chatLines)
{
this.chatLines.addAll(chatLines);
this.needsUpdate = true;
}
}
/**
* Adds a new chatline to the bot. Does not erase existing chatlines.
* @param chatLine The chatline to add.
*/
public void addChatLine(String chatLine)
{
synchronized (this.chatLines)
{
this.chatLines.add(chatLine);
this.needsUpdate = true;
}
}
/**
* @return The chatlines this bot can speak.
*/
public ArrayList<String> getChatLines()
{
return this.chatLines;
}
/**
* @return The HabboInfo.id of the Habbo it is following.
*/
public int getFollowingHabboId()
{
return this.followingHabboId;
}
/**
* Starts following a specific Habbo. Action may get interrupted when:
* <li>The bot is triggered with WiredEffectBotFollowHabbo.</li>
* <li>The bot is triggered with WiredEffectBotGiveHandItem.</li>
* <li>The bots in the room are frozen</li>
*
* @param habbo The Habbo to follow.
*/
public void startFollowingHabbo(Habbo habbo)
{
this.followingHabboId = habbo.getHabboInfo().getId();
Emulator.getThreading().run(new BotFollowHabbo(this, habbo, habbo.getHabboInfo().getCurrentRoom()));
}
public void stopFollowingHabbo()
{
this.followingHabboId = 0;
}
/**
* Used to load in custom data.
* Implement this method whenever you want data to be loaded from the database
* upon the loading of the BotManager. This is to guarantee database integrity.
* This method must be implemented. Failing to do so will result into a runtime error.
*/
public static void initialise()
{
}
/**
* Called upon Emulator shutdown.
*/
public static void dispose()
{
}
}

View File

@ -0,0 +1,320 @@
package com.eu.habbo.habbohotel.bots;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.rooms.*;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.messages.outgoing.generic.alerts.BotErrorComposer;
import com.eu.habbo.messages.outgoing.generic.alerts.BubbleAlertComposer;
import com.eu.habbo.messages.outgoing.generic.alerts.BubbleAlertKeys;
import com.eu.habbo.messages.outgoing.inventory.AddBotComposer;
import com.eu.habbo.messages.outgoing.inventory.RemoveBotComposer;
import com.eu.habbo.messages.outgoing.rooms.users.RoomUsersComposer;
import com.eu.habbo.plugin.events.bots.BotPickUpEvent;
import com.eu.habbo.plugin.events.bots.BotPlacedEvent;
import gnu.trove.map.hash.THashMap;
import java.lang.reflect.Method;
import java.sql.*;
import java.util.Map;
public class BotManager
{
//Configuration. Loaded from database & updated accordingly.
public static int MINIMUM_CHAT_SPEED = 7;
final private static THashMap<String, Class<? extends Bot>> botDefenitions = new THashMap<String, Class<? extends Bot>>();
/**
* Loads up the BotManager. Do NOT initialise this class yourself.
*
* Extend from the Bot class and implement 'public static void initialise()' to load data as you see fit.
*/
public BotManager()
{
long millis = System.currentTimeMillis();
botDefenitions.put("generic", Bot.class);
botDefenitions.put("bartender", ButlerBot.class);
botDefenitions.put("visitor_log", VisitorBot.class);
this.reload();
Emulator.getLogging().logStart("Bot Manager -> Loaded! ("+(System.currentTimeMillis() - millis)+" MS)");
}
/**
* Reloads the bot manager
* @return Returns true if the BotManager has been succesfully reloaded.
*/
public boolean reload()
{
for(Map.Entry<String, Class<? extends Bot>> set : botDefenitions.entrySet())
{
try
{
Method m = set.getValue().getMethod("initialise");
m.setAccessible(true);
m.invoke(null);
}
catch (NoSuchMethodException e)
{
Emulator.getLogging().logStart("Bot Manager -> Failed to execute initialise method upon bot type '" + set.getKey() + "'. No Such Method!");
return false;
}
catch (Exception e)
{
Emulator.getLogging().logStart("Bot Manager -> Failed to execute initialise method upon bot type '" + set.getKey() + "'. Error: " + e.getMessage());
return false;
}
}
return true;
}
/**
* Creates a new Bot and inserts it into the database.
* @param data A key-value set of details of the bot (name, motto, figure, gender)
* @param type The type of the bot that must be initialised.
* @return The initialised bot. Returns NULL upon Exception;
*/
public Bot createBot(THashMap<String, String> data, String type)
{
Bot bot = null;
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("INSERT INTO bots (user_id, room_id, name, motto, figure, gender, type) VALUES (0, 0, ?, ?, ?, ?, ?)", Statement.RETURN_GENERATED_KEYS))
{
statement.setString(1, data.get("name"));
statement.setString(2, data.get("motto"));
statement.setString(3, data.get("figure"));
statement.setString(4, data.get("gender").toUpperCase());
statement.setString(5, type);
statement.execute();
try (ResultSet set = statement.getGeneratedKeys())
{
if (set.next())
{
try (PreparedStatement stmt = connection.prepareStatement("SELECT users.username AS owner_name, bots.* FROM bots LEFT JOIN users ON bots.user_id = users.id WHERE bots.id = ? LIMIT 1"))
{
stmt.setInt(1, set.getInt(1));
try (ResultSet resultSet = stmt.executeQuery())
{
if (resultSet.next())
{
bot = this.loadBot(resultSet);
}
}
}
catch (SQLException e)
{
Emulator.getLogging().logSQLException(e);
}
}
}
}
catch(SQLException e)
{
Emulator.getLogging().logSQLException(e);
}
return bot;
}
/**
* Places a bot at the given location in the given room.
* @param bot The Bot that is being placed.
* @param habbo The Habbo that owns the Bot.
* @param room The Room this Bot is being placed in.
* @param location The given location of the Bot.
*/
public void placeBot(Bot bot, Habbo habbo, Room room, RoomTile location)
{
BotPlacedEvent event = new BotPlacedEvent(bot, location, habbo);
Emulator.getPluginManager().fireEvent(event);
if(event.isCancelled())
return;
if(room != null && bot != null && habbo != null)
{
if (room.getOwnerId() == habbo.getHabboInfo().getId() || habbo.hasPermission("acc_anyroomowner") || habbo.hasPermission("acc_placefurni"))
{
if (room.getCurrentBots().size() >= Room.MAXIMUM_BOTS && !habbo.hasPermission("acc_unlimited_bots"))
{
habbo.getClient().sendResponse(new BotErrorComposer(BotErrorComposer.ROOM_ERROR_MAX_BOTS));
return;
}
if (!room.tileWalkable(location.x, location.y))
return;
RoomUnit roomUnit = new RoomUnit();
roomUnit.setRotation(RoomUserRotation.SOUTH);
roomUnit.setLocation(location);
roomUnit.setZ(room.getStackHeight(location.x, location.y, false));
roomUnit.setPathFinderRoom(room);
roomUnit.setRoomUnitType(RoomUnitType.BOT);
roomUnit.setCanWalk(room.isAllowBotsWalk());
bot.setRoomUnit(roomUnit);
bot.setRoom(room);
bot.needsUpdate(true);
room.addBot(bot);
Emulator.getThreading().run(bot);
room.sendComposer(new RoomUsersComposer(bot).compose());
habbo.getInventory().getBotsComponent().removeBot(bot);
habbo.getClient().sendResponse(new RemoveBotComposer(bot));
bot.onPlace(habbo, room);
bot.cycle(false);
}
else
{
habbo.getClient().sendResponse(new BubbleAlertComposer(BubbleAlertKeys.FURNI_PLACE_EMENT_ERROR.key, "cant_set_not_owner"));
}
}
}
/**
* Removes a bot from the room.
* Note the owner is being set to the Habbo.
* @param botId The id of the Bot that is being picked up.
* @param habbo The Habbo who picks it.
*/
public void pickUpBot(int botId, Habbo habbo)
{
if(habbo.getHabboInfo().getCurrentRoom() != null)
{
this.pickUpBot(habbo.getHabboInfo().getCurrentRoom().getBot(Math.abs(botId)), habbo);
}
}
/**
* Removes a bot from the room.
* Note the owner is being set to the Habbo.
* @param bot The Bot that is being picked up.
* @param habbo The Habbo who picks it.
*/
public void pickUpBot(Bot bot, Habbo habbo)
{
if(bot != null && habbo != null)
{
BotPickUpEvent pickedUpEvent = new BotPickUpEvent(bot, habbo);
Emulator.getPluginManager().fireEvent(pickedUpEvent);
if(pickedUpEvent.isCancelled())
return;
if (bot.getOwnerId() == habbo.getHabboInfo().getId() || habbo.hasPermission("acc_anyroomowner"))
{
if (!habbo.hasPermission("acc_unlimited_bots") && habbo.getInventory().getBotsComponent().getBots().size() >= 15)
return;
bot.onPickUp(habbo, habbo.getHabboInfo().getCurrentRoom());
habbo.getHabboInfo().getCurrentRoom().removeBot(bot);
bot.stopFollowingHabbo();
bot.setOwnerId(habbo.getHabboInfo().getId());
bot.setOwnerName(habbo.getHabboInfo().getUsername());
bot.needsUpdate(true);
Emulator.getThreading().run(bot);
habbo.getInventory().getBotsComponent().addBot(bot);
habbo.getClient().sendResponse(new AddBotComposer(bot));
}
}
}
/**
* Loads a bot from the given ResultSet.
* @param set The set this bot must be initialised from.
* @return The initialised bot. Returns NULL upon SQLException being thrown.
*/
public Bot loadBot(ResultSet set)
{
try
{
String type = set.getString("type");
Class<? extends Bot> botClazz = botDefenitions.get(type);
if(botClazz != null)
return botClazz.getDeclaredConstructor(ResultSet.class).newInstance(set);
else
Emulator.getLogging().logErrorLine("Unknown Bot Type: " + type);
}
catch (SQLException e)
{
Emulator.getLogging().logSQLException(e);
}
catch (Exception e)
{
Emulator.getLogging().logErrorLine(e);
}
return null;
}
/**
* Deletes a bot from the database.
* @param bot The bot to delete.
* @return true if the bot has been deleted.
*/
public boolean deleteBot(Bot bot)
{
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("DELETE FROM bots WHERE id = ? LIMIT 1"))
{
statement.setInt(1, bot.getId());
return statement.execute();
}
catch (SQLException e)
{
Emulator.getLogging().logSQLException(e);
}
return false;
}
/**
* Add a new bot type in order to implement custom behaviour.
*
* Make sure to extend the Bot class and make the constructor match Bot(ResultSet)
* @param type The name of the bot type.
* @param botClazz The class that needs to be initialised.
* @throws Exception If the bot type already exists.
* If the bot class has no constructor matchin Bot(ResultSet)
*/
public static void addBotDefinition(String type, Class<? extends Bot> botClazz) throws Exception
{
if(botClazz.getDeclaredConstructor(ResultSet.class) == null)
{
throw new Exception("Missing Bot(ResultSet) constructor!");
}
else
{
botClazz.getDeclaredConstructor(ResultSet.class).setAccessible(true);
botDefenitions.put(type, botClazz);
}
}
/**
* Called upon Emulator shutdown.
* Implement 'public static void dispose()' to pass on this event
* to your custom bot class.
*/
public void dispose()
{
for(Map.Entry<String, Class<? extends Bot>> set : botDefenitions.entrySet())
{
try
{
Method m = set.getValue().getMethod("dispose");
m.setAccessible(true);
m.invoke(null);
}
catch (NoSuchMethodException e)
{
Emulator.getLogging().logStart("Bot Manager -> Failed to execute dispose method upon bot type '" + set.getKey() + "'. No Such Method!");
}
catch (Exception e)
{
Emulator.getLogging().logStart("Bot Manager -> Failed to execute dispose method upon bot type '" + set.getKey() + "'. Error: " + e.getMessage());
}
}
}
}

View File

@ -0,0 +1,118 @@
package com.eu.habbo.habbohotel.bots;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.rooms.RoomChatMessage;
import com.eu.habbo.plugin.events.bots.BotServerItemEvent;
import com.eu.habbo.threading.runnables.RoomUnitGiveHanditem;
import com.eu.habbo.threading.runnables.RoomUnitWalkToRoomUnit;
import gnu.trove.map.hash.THashMap;
import gnu.trove.set.hash.THashSet;
import java.sql.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
public class ButlerBot extends Bot
{
public static THashMap<THashSet<String>, Integer> serveItems = new THashMap<THashSet<String>, Integer>();
/**
* This class is a bot that will hand out handitems upon triggering with the correct keys.
* @param set
* @throws SQLException
*/
public ButlerBot(ResultSet set) throws SQLException
{
super(set);
}
public ButlerBot(Bot bot)
{
super(bot);
}
public static void initialise()
{
if(serveItems == null)
serveItems = new THashMap<THashSet<String>, Integer>();
serveItems.clear();
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); Statement statement = connection.createStatement(); ResultSet set = statement.executeQuery("SELECT * FROM bot_serves"))
{
while (set.next())
{
String[] keys = set.getString("keys").split(";");
THashSet<String> ks = new THashSet<String>();
for(String key : keys)
{
ks.add(key);
}
serveItems.put(ks, set.getInt("item"));
}
}
catch (SQLException e)
{
Emulator.getLogging().logSQLException(e);
}
}
public static void dispose()
{
serveItems.clear();
}
@Override
public void onUserSay(final RoomChatMessage message)
{
if(this.getRoomUnit().isWalking())
return;
if (this.getRoomUnit().getCurrentLocation().distance(message.getHabbo().getRoomUnit().getCurrentLocation()) <= Emulator.getConfig().getInt("hotel.bot.butler.servedistance"))
if(message.getUnfilteredMessage() != null)
{
for(Map.Entry<THashSet<String>, Integer> set : serveItems.entrySet())
{
for(String s : set.getKey())
{
if(message.getUnfilteredMessage().toLowerCase().contains(s))
{
BotServerItemEvent serveEvent = new BotServerItemEvent(this, message.getHabbo(), set.getValue());
if (Emulator.getPluginManager().fireEvent(serveEvent).isCancelled())
{
return;
}
if (this.getRoomUnit().canWalk())
{
final String key = s;
final Bot b = this;
List<Runnable> tasks = new ArrayList<Runnable>();
tasks.add(new RoomUnitGiveHanditem(serveEvent.habbo.getRoomUnit(), serveEvent.habbo.getHabboInfo().getCurrentRoom(), serveEvent.itemId));
tasks.add(new RoomUnitGiveHanditem(this.getRoomUnit(), serveEvent.habbo.getHabboInfo().getCurrentRoom(), 0));
tasks.add(new Runnable()
{
@Override
public void run()
{
b.talk(Emulator.getTexts().getValue("bots.butler.given").replace("%key%", key).replace("%username%", serveEvent.habbo.getHabboInfo().getUsername()));
}
});
Emulator.getThreading().run(new RoomUnitGiveHanditem(this.getRoomUnit(), serveEvent.habbo.getHabboInfo().getCurrentRoom(), serveEvent.itemId));
Emulator.getThreading().run(new RoomUnitWalkToRoomUnit(this.getRoomUnit(), serveEvent.habbo.getRoomUnit(), serveEvent.habbo.getHabboInfo().getCurrentRoom(), tasks, null));
}
else
{
this.getRoom().giveHandItem(serveEvent.habbo, serveEvent.itemId);
this.talk(Emulator.getTexts().getValue("bots.butler.given").replace("%key%", s).replace("%username%", serveEvent.habbo.getHabboInfo().getUsername()));
}
return;
}
}
}
}
}
}

View File

@ -0,0 +1,84 @@
package com.eu.habbo.habbohotel.bots;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.modtool.ModToolRoomVisit;
import com.eu.habbo.habbohotel.rooms.RoomChatMessage;
import com.eu.habbo.habbohotel.users.Habbo;
import gnu.trove.set.hash.THashSet;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.text.SimpleDateFormat;
import java.util.Date;
public class VisitorBot extends Bot
{
private static SimpleDateFormat formatDate;
private boolean showedLog = false;
private THashSet<ModToolRoomVisit> visits = new THashSet<ModToolRoomVisit>();
public VisitorBot(ResultSet set) throws SQLException
{
super(set);
}
public VisitorBot(Bot bot)
{
super(bot);
}
@Override
public void onUserSay(final RoomChatMessage message)
{
if(!this.showedLog)
{
if(message.getMessage().equalsIgnoreCase(Emulator.getTexts().getValue("generic.yes")))
{
this.showedLog = true;
String visitMessage = Emulator.getTexts().getValue("bots.visitor.list").replace("%count%", this.visits.size() + "");
String list = "";
for(ModToolRoomVisit visit : this.visits)
{
list += "\r";
list += visit.roomName + " ";
list += Emulator.getTexts().getValue("generic.time.at") + " ";
list += formatDate.format(new Date((visit.timestamp * 1000L)));
}
visitMessage = visitMessage.replace("%list%", list);
this.talk(visitMessage);
this.visits.clear();
}
}
}
public void onUserEnter(Habbo habbo)
{
if(!this.showedLog)
{
if(habbo.getHabboInfo().getCurrentRoom() != null)
{
this.visits = Emulator.getGameEnvironment().getModToolManager().getVisitsForRoom(habbo.getHabboInfo().getCurrentRoom(), 10, true, habbo.getHabboInfo().getLastOnline(), Emulator.getIntUnixTimestamp());
if(this.visits.isEmpty())
{
this.talk(Emulator.getTexts().getValue("bots.visitor.no_visits"));
}
else
{
this.talk(Emulator.getTexts().getValue("bots.visitor.visits").replace("%count%", this.visits.size() + "").replace("%positive%", Emulator.getTexts().getValue("generic.yes")));
}
}
}
}
public static void initialise()
{
formatDate = new SimpleDateFormat(Emulator.getConfig().getValue("bots.visitor.dateformat"));
}
}

View File

@ -0,0 +1,99 @@
package com.eu.habbo.habbohotel.catalog;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.users.Habbo;
import java.sql.ResultSet;
import java.sql.SQLException;
public class CalendarRewardObject
{
private final int id;
private final String name;
private final String customImage;
private final int credits;
private final int points;
private final int pointsType;
private final String badge;
private final int catalogItemId;
public CalendarRewardObject(ResultSet set) throws SQLException
{
this.id = set.getInt("id");
this.name = set.getString("name");
this.customImage = set.getString("custom_image");
this.credits = set.getInt("credits");
this.points = set.getInt("points");
this.pointsType = set.getInt("points_type");
this.badge = set.getString("badge");
this.catalogItemId = set.getInt("catalog_item_id");
}
public void give(Habbo habbo)
{
if (this.credits > 0)
{
habbo.giveCredits(this.credits);
}
if (this.points > 0)
{
habbo.givePoints(this.pointsType, this.points);
}
if (!this.badge.isEmpty())
{
habbo.addBadge(this.badge);
}
if (this.catalogItemId > 0)
{
CatalogItem item = this.getCatalogItem();
if (item != null)
{
Emulator.getGameEnvironment().getCatalogManager().purchaseItem(null, item, habbo, 1, "", true);
}
}
}
public int getId()
{
return this.id;
}
public String getName()
{
return this.name;
}
public String getCustomImage()
{
return this.customImage;
}
public int getCredits()
{
return this.credits;
}
public int getPoints()
{
return this.points;
}
public int getPointsType()
{
return this.pointsType;
}
public String getBadge()
{
return this.badge;
}
public CatalogItem getCatalogItem()
{
return Emulator.getGameEnvironment().getCatalogManager().getCatalogItem(this.catalogItemId);
}
}

View File

@ -0,0 +1,61 @@
package com.eu.habbo.habbohotel.catalog;
import com.eu.habbo.Emulator;
import com.eu.habbo.messages.ISerialize;
import com.eu.habbo.messages.ServerMessage;
public class CatalogFeaturedPage implements ISerialize
{
public enum Type
{
PAGE_NAME(0),
PAGE_ID(1),
PRODUCT_NAME(2);
public final int type;
Type(int type)
{
this.type = type;
}
}
private final int slotId;
private final String caption;
private final String image;
private final Type type;
private final int expireTimestamp;
private final String pageName;
private final int pageId;
private final String productName;
public CatalogFeaturedPage(int slotId, String caption, String image, Type type, int expireTimestamp, String pageName, int pageId, String productName)
{
this.slotId = slotId;
this.caption = caption;
this.image = image;
this.type = type;
this.expireTimestamp = expireTimestamp;
this.pageName = pageName;
this.pageId = pageId;
this.productName = productName;
}
@Override
public void serialize(ServerMessage message)
{
message.appendInt(this.slotId);
message.appendString(this.caption);
message.appendString(this.image);
message.appendInt(this.type.type);
switch (this.type)
{
case PAGE_NAME:
message.appendString(this.pageName); break;
case PAGE_ID:
message.appendInt(this.pageId); break;
case PRODUCT_NAME:
message.appendString(this.productName); break;
}
message.appendInt(Emulator.getIntUnixTimestamp() - this.expireTimestamp);
}
}

View File

@ -0,0 +1,547 @@
package com.eu.habbo.habbohotel.catalog;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.items.FurnitureType;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.messages.ISerialize;
import com.eu.habbo.messages.ServerMessage;
import gnu.trove.set.hash.THashSet;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.HashMap;
public class CatalogItem implements ISerialize, Runnable, Comparable<CatalogItem>
{
/**
* Unique identifier.
*/
protected int id;
/**
* Page where this item will be displayed.
*/
protected int pageId;
/**
* String representation of the items that are displayed.
*/
protected String itemId;
/**
* Catalog item name.
*/
protected String name;
/**
* The amount of credits this item can be purchased for.
*/
protected int credits;
/**
* The amount of points this item can be purchased for.
*/
protected int points;
/**
* The seasonal currency that is used in order to buy this item.
* Defaults to pixels at 0.
*/
protected short pointsType;
/**
* The amount of times this item will be given when purchased.
*/
protected int amount;
/**
* If this item can be gifted.
*/
protected boolean allowGift = false;
/**
* The total limited stack of this catalog item.
*/
protected int limitedStack;
/**
* The amount of items that have been sold in this limited stack.
*/
protected int limitedSells;
/**
* Extradata can be used to hold more data or set default data for the items bought.
*/
protected String extradata;
/**
* Determines if this item can only be bought by people that have Habbo Club.
*/
protected boolean clubOnly;
/**
* Determines if multiple purchases and thus discount is available.
*/
protected boolean haveOffer;
/**
* The search offer id linked to this catalog item.
*/
protected int offerId;
/**
* Flag to mark this item requiring an update to the database.
*/
protected boolean needsUpdate;
/**
* Contains the amount of items in the bundle.
*/
protected HashMap<Integer, Integer> bundle;
public CatalogItem(ResultSet set) throws SQLException
{
this.load(set);
this.needsUpdate = false;
}
/**
* Updaes the CatalogItem with the given resultset.
* @param set The ResultSet to update the CatalogItem with.
* @throws SQLException
*/
public void update(ResultSet set) throws SQLException
{
this.load(set);
}
private void load(ResultSet set) throws SQLException
{
this.id = set.getInt("id");
this.pageId = set.getInt("page_id");
this.itemId = set.getString("item_Ids");
this.name = set.getString("catalog_name");
this.credits = set.getInt("cost_credits");
this.points = set.getInt("cost_points");
this.pointsType = set.getShort("points_type");
this.amount = set.getInt("amount");
this.limitedStack = set.getInt("limited_stack");
this.limitedSells = set.getInt("limited_sells");
this.extradata = set.getString("extradata");
this.clubOnly = set.getBoolean("club_only");
this.haveOffer = set.getBoolean("have_offer");
this.offerId = set.getInt("offer_id");
this.bundle = new HashMap<>();
this.loadBundle();
}
/**
* @return Unique identifier.
*/
public int getId()
{
return this.id;
}
/**
* @return Page where this item will be displayed.
*/
public int getPageId()
{
return this.pageId;
}
/**
* @param pageId Thenew page id to set for the item of where it will be displayed.
*/
public void setPageId(int pageId)
{
this.pageId = pageId;
}
/**
* @return String representation of the items that are displayed.
*/
public String getItemId()
{
return this.itemId;
}
/**
* @param itemId String representation of the items that are displayed.
*/
public void setItemId(String itemId)
{
this.itemId = itemId;
}
/**
* @return Catalog item name.
*/
public String getName()
{
return this.name;
}
/**
* @return The amount of credits this item can be purchased for.
*/
public int getCredits()
{
return this.credits;
}
/**
* @return The amount of points this item can be purchased for.
*/
public int getPoints()
{
return this.points;
}
/**
* @return The seasonal currency that is used in order to buy this item.
* Defaults to pixels at 0.
*/
public int getPointsType()
{
return this.pointsType;
}
/**
* @return The amount of times this item will be given when purchased.
*/
public int getAmount()
{
return this.amount;
}
/**
* @return The total limited stack of this catalog item.
*/
public int getLimitedStack()
{
return this.limitedStack;
}
/**
* @return The amount of items that have been sold in this limited stack.
*/
public int getLimitedSells()
{
CatalogLimitedConfiguration ltdConfig = Emulator.getGameEnvironment().getCatalogManager().getLimitedConfig(this);
if (ltdConfig != null)
{
return this.limitedStack - ltdConfig.available();
}
return this.limitedStack;
}
/**
* @return Extradata can be used to hold more data or set default data for the items bought.
*/
public String getExtradata()
{
return this.extradata;
}
/**
* @return Determines if this item can only be bought by people that have Habbo Club.
*/
public boolean isClubOnly()
{
return this.clubOnly;
}
/**
* @return Determines if multiple purchases and thus discount is available.
*/
public boolean isHaveOffer()
{
return this.haveOffer;
}
/**
* @return The search offer id linked to this catalog item.
*/
public int getOfferId()
{
return this.offerId;
}
/**
* @return Returns True if this item has a limited stack.
*/
public boolean isLimited()
{
return this.limitedStack > 0;
}
/**
* Sell a limited item.
*/
public synchronized void sellRare()
{
this.limitedSells++;
this.needsUpdate = true;
if(this.limitedSells == this.limitedStack)
{
Emulator.getGameEnvironment().getCatalogManager().moveCatalogItem(this, Emulator.getConfig().getInt("catalog.ltd.page.soldout"));
}
Emulator.getThreading().run(this);
}
/**
* @return Return all BaseItems being sold.
*/
public THashSet<Item> getBaseItems()
{
THashSet<Item> items = new THashSet<>();
if(!this.itemId.isEmpty())
{
String[] itemIds = this.itemId.split(";");
for (String itemId : itemIds)
{
if (itemId.isEmpty())
continue;
if (itemId.contains(":"))
{
itemId = itemId.split(":")[0];
}
int identifier = Integer.parseInt(itemId);
if (identifier > 0)
{
Item item = Emulator.getGameEnvironment().getItemManager().getItem(identifier);
if (item != null)
items.add(item);
}
}
}
return items;
}
/**
* @return The amount of items being sold.
*/
public int getItemAmount(int id)
{
if(this.bundle.containsKey(id))
return this.bundle.get(id);
else
return this.amount;
}
/**
* @return The bundle items.
*/
public HashMap<Integer, Integer> getBundle()
{
return this.bundle;
}
/**
* Loads the items in a bundle.
*/
public void loadBundle()
{
int intItemId;
if(this.itemId.contains(";"))
{
try
{
String[] itemIds = this.itemId.split(";");
for (String itemId : itemIds)
{
if (itemId.contains(":"))
{
String[] data = itemId.split(":");
if (data.length > 1 && Integer.parseInt(data[0]) > 0 && Integer.parseInt(data[1]) > 0)
{
this.bundle.put(Integer.parseInt(data[0]), Integer.parseInt(data[1]));
}
} else
{
if (!itemId.isEmpty())
{
intItemId = (Integer.parseInt(itemId));
this.bundle.put(intItemId, 1);
}
}
}
} catch (Exception e)
{
Emulator.getLogging().logDebugLine("Failed to load " + itemId);
e.printStackTrace();
}
}
else
{
try
{
Item item = Emulator.getGameEnvironment().getItemManager().getItem(Integer.valueOf(this.itemId));
if (item != null)
{
this.allowGift = item.allowGift();
}
}
catch (Exception e)
{}
}
}
@Override
public void serialize(ServerMessage message)
{
message.appendInt(this.getId());
message.appendString(this.getName());
message.appendBoolean(false);
message.appendInt(this.getCredits());
message.appendInt(this.getPoints());
message.appendInt(this.getPointsType());
message.appendBoolean(this.allowGift); //Can gift
THashSet<Item> items = this.getBaseItems();
message.appendInt(items.size());
for(Item item : items)
{
message.appendString(item.getType().code.toLowerCase());
if(item.getType() == FurnitureType.BADGE)
{
message.appendString(item.getName());
}
else
{
message.appendInt(item.getSpriteId());
if(this.getName().contains("wallpaper_single") || this.getName().contains("floor_single") || this.getName().contains("landscape_single"))
{
message.appendString(this.getName().split("_")[2]);
}
else if(item.getName().contains("bot") && item.getType() == FurnitureType.ROBOT)
{
boolean lookFound = false;
for (String s : this.getExtradata().split(";"))
{
if (s.startsWith("figure:"))
{
lookFound = true;
message.appendString(s.replace("figure:", ""));
break;
}
}
if (!lookFound)
{
message.appendString(this.getExtradata());
}
}
else if(item.getType() == FurnitureType.ROBOT)
{
message.appendString(this.getExtradata());
}
else if(item.getName().equalsIgnoreCase("poster"))
{
message.appendString(this.getExtradata());
}
else if(this.getName().startsWith("SONG "))
{
message.appendString(this.getExtradata());
}
else
{
message.appendString("");
}
message.appendInt(this.getItemAmount(item.getId()));
message.appendBoolean(this.isLimited());
if(this.isLimited())
{
message.appendInt(this.getLimitedStack());
message.appendInt(this.getLimitedStack() - this.getLimitedSells());
}
}
}
message.appendInt32(this.clubOnly);
message.appendBoolean(haveOffer(this));
message.appendBoolean(false); //unknown
message.appendString(this.name + ".png");
}
@Override
public void run()
{
if(this.needsUpdate)
{
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("UPDATE catalog_items SET limited_sells = ?, page_id = ? WHERE id = ?"))
{
statement.setInt(1, this.getLimitedSells());
statement.setInt(2, this.pageId);
statement.setInt(3, this.getId());
statement.execute();
}
catch(SQLException e)
{
Emulator.getLogging().logSQLException(e);
}
this.needsUpdate = false;
}
}
@SuppressWarnings("NullableProblems")
@Override
public int compareTo(CatalogItem catalogItem) {
return this.getId() - catalogItem.getId();
}
/**
* Does additional checks to see if an item has offers enabled.
* @param item The item to check
* @return True if the item has offers enabled.
*/
private static boolean haveOffer(CatalogItem item)
{
if(!item.haveOffer)
return false;
for(Item i : item.getBaseItems())
{
if(i.getName().toLowerCase().startsWith("cf_") || i.getName().toLowerCase().startsWith("cfc_") || i.getName().toLowerCase().startsWith("rentable_bot"))
return false;
}
if(item.getName().toLowerCase().startsWith("cf_") || item.getName().toLowerCase().startsWith("cfc_"))
return false;
if(item.isLimited())
return false;
if(item.getName().toLowerCase().startsWith("rentable_bot_"))
return false;
if(item.getAmount() != 1)
return false;
return item.bundle.size() <= 1;
}
}

View File

@ -0,0 +1,113 @@
package com.eu.habbo.habbohotel.catalog;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboItem;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.Collections;
import java.util.LinkedList;
public class CatalogLimitedConfiguration implements Runnable
{
private final int itemId;
private int totalSet;
private final LinkedList<Integer> limitedNumbers;
public CatalogLimitedConfiguration(int itemId, LinkedList<Integer> availableNumbers, int totalSet)
{
this.itemId = itemId;
this.totalSet = totalSet;
this.limitedNumbers = availableNumbers;
Collections.shuffle(this.limitedNumbers);
}
public int getNumber()
{
synchronized (this.limitedNumbers)
{
int num = this.limitedNumbers.pop();
return num;
}
}
public void limitedSold(int catalogItemId, Habbo habbo, HabboItem item)
{
synchronized (this.limitedNumbers)
{
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("UPDATE catalog_items_limited SET user_id = ?, timestamp = ?, item_id = ? WHERE catalog_item_id = ? AND number = ? AND user_id = 0 LIMIT 1"))
{
statement.setInt(1, habbo.getHabboInfo().getId());
statement.setInt(2, Emulator.getIntUnixTimestamp());
statement.setInt(3, item.getId());
statement.setInt(4, catalogItemId);
statement.setInt(5, item.getLimitedSells());
statement.execute();
}
catch (SQLException e)
{
Emulator.getLogging().logSQLException(e);
}
}
}
public void generateNumbers(int starting, int amount)
{
synchronized (this.limitedNumbers)
{
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("INSERT INTO catalog_items_limited (catalog_item_id, number) VALUES (?, ?)"))
{
statement.setInt(1, this.itemId);
for (int i = starting; i <= amount; i++)
{
statement.setInt(2, i);
statement.addBatch();
this.limitedNumbers.push(i);
}
statement.executeBatch();
}
catch (SQLException e)
{
Emulator.getLogging().logSQLException(e);
}
this.totalSet += amount;
Collections.shuffle(this.limitedNumbers);
}
}
public int available()
{
return this.limitedNumbers.size();
}
public int getTotalSet()
{
return this.totalSet;
}
public void setTotalSet(int totalSet)
{
this.totalSet = totalSet;
}
@Override
public void run()
{
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("UPDATE catalog_items SET limited_stack = ?, limited_sells = ? WHERE id = ?"))
{
statement.setInt(1, this.totalSet);
statement.setInt(2, this.totalSet - this.available());
statement.setInt(3, this.itemId);
statement.execute();
}
catch (SQLException e)
{
Emulator.getLogging().logSQLException(e);
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,237 @@
package com.eu.habbo.habbohotel.catalog;
import com.eu.habbo.Emulator;
import com.eu.habbo.messages.ISerialize;
import com.eu.habbo.messages.ServerMessage;
import gnu.trove.TCollections;
import gnu.trove.list.array.TIntArrayList;
import gnu.trove.map.TIntObjectMap;
import gnu.trove.map.hash.THashMap;
import gnu.trove.map.hash.TIntObjectHashMap;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Collections;
public abstract class CatalogPage implements Comparable<CatalogPage>, ISerialize
{
protected int id;
protected int parentId;
protected int rank;
protected String caption;
protected String pageName;
protected int iconColor;
protected int iconImage;
protected int orderNum;
protected boolean visible;
protected boolean enabled;
protected boolean clubOnly;
protected String layout;
protected String headerImage;
protected String teaserImage;
protected String specialImage;
protected String textOne;
protected String textTwo;
protected String textDetails;
protected String textTeaser;
protected TIntArrayList offerIds = new TIntArrayList();
protected THashMap<Integer, CatalogPage> childPages = new THashMap<Integer, CatalogPage>();;
private TIntObjectMap<CatalogItem> catalogItems = TCollections.synchronizedMap(new TIntObjectHashMap<CatalogItem>());
private ArrayList<Integer> included = new ArrayList<Integer>();
public CatalogPage(ResultSet set) throws SQLException
{
if (set == null)
return;
this.id = set.getInt("id");
this.parentId = set.getInt("parent_id");
this.rank = set.getInt("min_rank");
this.caption = set.getString("caption");
this.pageName = set.getString("caption_save");
this.iconColor = set.getInt("icon_color");
this.iconImage = set.getInt("icon_image");
this.orderNum = set.getInt("order_num");
this.visible = set.getBoolean("visible");
this.enabled = set.getBoolean("enabled");
this.clubOnly = set.getBoolean("club_only");
this.layout = set.getString("page_layout");
this.headerImage = set.getString("page_headline");
this.teaserImage = set.getString("page_teaser");
this.specialImage = set.getString("page_special");
this.textOne = set.getString("page_text1");
this.textTwo = set.getString("page_text2");
this.textDetails = set.getString("page_text_details");
this.textTeaser = set.getString("page_text_teaser");
if (!set.getString("includes").isEmpty())
{
for (String id : set.getString("includes").split(";"))
{
try
{
this.included.add(Integer.valueOf(id));
}
catch (Exception e)
{
Emulator.getLogging().logErrorLine(e);
}
}
}
}
public int getId()
{
return this.id;
}
public int getParentId()
{
return this.parentId;
}
public int getRank()
{
return this.rank;
}
public void setRank(int rank)
{
this.rank = rank;
}
public String getCaption()
{
return this.caption;
}
public String getPageName()
{
return this.pageName;
}
public int getIconColor()
{
return this.iconColor;
}
public int getIconImage()
{
return this.iconImage;
}
public int getOrderNum()
{
return this.orderNum;
}
public boolean isVisible()
{
return this.visible;
}
public boolean isEnabled()
{
return this.enabled;
}
public boolean isClubOnly()
{
return this.clubOnly;
}
public String getLayout()
{
return this.layout;
}
public String getHeaderImage()
{
return this.headerImage;
}
public String getTeaserImage()
{
return this.teaserImage;
}
public String getSpecialImage()
{
return this.specialImage;
}
public String getTextOne()
{
return this.textOne;
}
public String getTextTwo()
{
return this.textTwo;
}
public String getTextDetails()
{
return this.textDetails;
}
public String getTextTeaser()
{
return this.textTeaser;
}
public TIntArrayList getOfferIds()
{
return this.offerIds;
}
public void addOfferId(int offerId)
{
this.offerIds.add(offerId);
}
public void addItem(CatalogItem item)
{
this.catalogItems.put(item.getId(), item);
}
public TIntObjectMap<CatalogItem> getCatalogItems()
{
return this.catalogItems;
}
public CatalogItem getCatalogItem(int id)
{
return this.catalogItems.get(id);
}
public ArrayList<Integer> getIncluded()
{
return this.included;
}
public THashMap<Integer, CatalogPage> getChildPages()
{
return this.childPages;
}
public void addChildPage(CatalogPage page)
{
this.childPages.put(page.getId(), page);
if (page.getRank() < this.getRank())
{
page.setRank(this.getRank());
}
}
@SuppressWarnings("NullableProblems")
@Override
public int compareTo(CatalogPage page) {
return this.getOrderNum() - page.getOrderNum();
}
@Override
public abstract void serialize(ServerMessage message);
}

View File

@ -0,0 +1,187 @@
package com.eu.habbo.habbohotel.catalog;
public enum CatalogPageLayouts
{
/**
* Default page, used most of the time.
*/
default_3x3,
/**
* The page that you can buy Guild furniture from.
*/
guild_furni,
/**
* The page that allows you to buy a Guild.
*/
guilds,
/**
* The page that allows you to buy a forum for your Guild.
*/
guild_forum,
/**
* The page with information about duckets.
*/
info_duckets,
/**
* The page with information about rentables.
*/
info_rentables,
/**
* The page with information about loyalty programme.
*/
info_loyalty,
/**
* The page you can buy VIP with loyalty points.
*/
loyalty_vip_buy,
/**
* The page where you can buy bots from.
*/
bots,
/**
* Pets
*/
pets,
/**
* Petss
*/
pets2,
/**
* Petsss
*/
pets3,
/**
* The page where you can claim club gifts.
*/
club_gift,
/**
* The front page. Without it, there is nothing. /s
*/
frontpage,
/**
* The page where you can buy those fancy badge displays.
*/
badge_display,
/**
* The new spaces layout.
*/
spaces_new,
/**
* Trax
*/
soundmachine,
/**
* Info about pets.
*/
info_pets,
/**
* The page where you can buy Habbo Club from.
*/
club_buy,
/**
* Roomads are being sold here.
*/
roomads,
/**
* Trophies page.
*/
trophies,
/**
* Single bundle for single people.
*/
single_bundle,
/**
* The Marketplace.
*/
marketplace,
/**
* Lists your own Marketplace items.
*/
marketplace_own_items,
/**
* The Recycler (Or ecotron)
*/
recycler,
/**
* Info, for the people that don't know how to drag 'n drop.
*/
recycler_info,
/**
* All the rewards you can get from the Recycler (Or ecotron)
*/
recycler_prizes,
/**
* The page where all the sold out LTDs go.
*/
sold_ltd_items,
/**
* This is gone in the newer PRODUCTION versions, unfortunately.
*/
plasto,
/**
* Color grouping using the default page.
*/
default_3x3_color_grouping,
/**
* Page where your recent purchases reside.
*/
recent_purchases,
/**
* Room Bundles
*/
room_bundle,
/**
* Pet Customization like pet color dyes
*/
petcustomization,
/**
* Root page. Do not use!
*/
root,
/**
* The page where you can buy Habbo VIP from.
*/
vip_buy,
frontpage_featured,
builders_club_addons,
builders_club_frontpage,
builders_club_loyalty
}

View File

@ -0,0 +1,14 @@
package com.eu.habbo.habbohotel.catalog;
public enum CatalogPageType
{
/**
* NORMAL Catalog
*/
NORMAL,
/**
* BUILDER Catalog (Not implemented yet!)
*/
BUILDER
}

View File

@ -0,0 +1,35 @@
package com.eu.habbo.habbohotel.catalog;
import java.sql.ResultSet;
import java.sql.SQLException;
public class ClothItem
{
/**
* Identifier.
*/
public int id;
/**
* Name
*/
public String name;
/**
* Set
*/
public int[] setId;
public ClothItem(ResultSet set) throws SQLException
{
this.id = set.getInt("id");
this.name = set.getString("name");
String[] parts = set.getString("setid").split(",");
this.setId = new int[parts.length];
for (int i = 0; i < this.setId.length; i++)
{
this.setId[i] = Integer.valueOf(parts[i]);
}
}
}

View File

@ -0,0 +1,99 @@
package com.eu.habbo.habbohotel.catalog;
import java.sql.ResultSet;
import java.sql.SQLException;
public class ClubOffer
{
/**
* Id of the offer.
*/
private final int id;
/**
* Name of the offer
*/
private final String name;
/**
* Total days
*/
private final int days;
/**
* Price in credits.
*/
private final int credits;
/**
* Price in points.
*/
private final int points;
/**
* Points type.
*/
private final int pointsType;
/**
* Is VIP (Legacy)
*/
private final boolean vip;
/**
* If the ClubOffer is an extension deal.
*/
private final boolean deal;
public ClubOffer(ResultSet set) throws SQLException
{
this.id = set.getInt("id");
this.name = set.getString("name");
this.days = set.getInt("days");
this.credits = set.getInt("credits");
this.points = set.getInt("points");
this.pointsType = set.getInt("points_type");
this.vip = set.getString("type").equalsIgnoreCase("vip");
this.deal = set.getString("deal").equals("1");
}
public int getId()
{
return this.id;
}
public String getName()
{
return this.name;
}
public int getDays()
{
return this.days;
}
public int getCredits()
{
return this.credits;
}
public int getPoints()
{
return this.points;
}
public int getPointsType()
{
return this.pointsType;
}
public boolean isVip()
{
return this.vip;
}
public boolean isDeal()
{
return this.deal;
}
}

View File

@ -0,0 +1,71 @@
package com.eu.habbo.habbohotel.catalog;
import com.eu.habbo.messages.ISerialize;
import com.eu.habbo.messages.ServerMessage;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;
public class TargetOffer implements ISerialize
{
private final int unknownInt1;
private final int id;
private final String identifier;
private final String unknownString1;
private final int priceInCredits;
private final int priceInActivityPoints;
private final int activityPointsType;
private final int purchaseLimit;
private final int expirationTime;
private final String title;
private final String description;
private final String imageUrl;
private final String unknownString2;
private final int type;
private final List<String> unknownStringList;
public TargetOffer(int unknownInt1, int id, String identifier, String unknownString1, int priceInCredits, int priceInActivityPoints, int activityPointsType, int purchaseLimit, int expirationTime, String title, String description, String imageUrl, String unknownString2, int type, List<String> unknownStringList)
{
this.unknownInt1 = unknownInt1;
this.id = id;
this.identifier = identifier;
this.unknownString1 = unknownString1;
this.priceInCredits = priceInCredits;
this.priceInActivityPoints = priceInActivityPoints;
this.activityPointsType = activityPointsType;
this.purchaseLimit = purchaseLimit;
this.expirationTime = expirationTime;
this.title = title;
this.description = description;
this.imageUrl = imageUrl;
this.unknownString2 = unknownString2;
this.type = type;
this.unknownStringList = unknownStringList;
}
@Override
public void serialize(ServerMessage message)
{
message.appendInt(this.unknownInt1);
message.appendInt(this.id);
message.appendString(this.identifier);
message.appendString(this.unknownString1);
message.appendInt(this.priceInCredits);
message.appendInt(this.priceInActivityPoints);
message.appendInt(this.activityPointsType);
message.appendInt(this.purchaseLimit);
message.appendInt(this.expirationTime);
message.appendString(this.title);
message.appendString(this.description);
message.appendString(this.imageUrl);
message.appendString(this.unknownString2);
message.appendInt(this.type);
message.appendInt(this.unknownStringList.size());
for (String s : this.unknownStringList)
{
message.appendString(s);
}
}
}

View File

@ -0,0 +1,52 @@
package com.eu.habbo.habbohotel.catalog;
import java.sql.ResultSet;
import java.sql.SQLException;
public class Voucher
{
/**
* Voucher ID
*/
private final int id;
/**
* Code
*/
public final String code;
/**
* Reward credits.
*/
public final int credits;
/**
* Reward points.
*/
public final int points;
/**
* Points type
*/
public final int pointsType;
/**
* Item from the catalog.
*/
public final int catalogItemId;
/**
* Constructs a new Voucher.
* @param set The ResultSet to read the data from.
* @throws SQLException
*/
public Voucher(ResultSet set) throws SQLException
{
this.id = set.getInt("id");
this.code = set.getString("code");
this.credits = set.getInt("credits");
this.points = set.getInt("points");
this.pointsType = set.getInt("points_type");
this.catalogItemId = set.getInt("catalog_item_id");
}
}

View File

@ -0,0 +1,31 @@
package com.eu.habbo.habbohotel.catalog.layouts;
import com.eu.habbo.habbohotel.catalog.CatalogPage;
import com.eu.habbo.messages.ServerMessage;
import java.sql.ResultSet;
import java.sql.SQLException;
/**
* Class for the interactive badge display catalog page.
*/
public class BadgeDisplayLayout extends CatalogPage
{
public BadgeDisplayLayout(ResultSet set) throws SQLException
{
super(set);
}
@Override
public void serialize(ServerMessage message) {
message.appendString("badge_display");
message.appendInt(3);
message.appendString(super.getHeaderImage());
message.appendString(super.getTeaserImage());
message.appendString(super.getSpecialImage());
message.appendInt(3);
message.appendString(super.getTextOne());
message.appendString(super.getTextDetails());
message.appendString(super.getTextTeaser());
}
}

View File

@ -0,0 +1,31 @@
package com.eu.habbo.habbohotel.catalog.layouts;
import com.eu.habbo.habbohotel.catalog.CatalogPage;
import com.eu.habbo.messages.ServerMessage;
import java.sql.ResultSet;
import java.sql.SQLException;
/**
* Class for the bots page.
*/
public class BotsLayout extends CatalogPage
{
public BotsLayout(ResultSet set) throws SQLException
{
super(set);
}
@Override
public void serialize(ServerMessage message)
{
message.appendString("bots");
message.appendInt(2);
message.appendString(super.getHeaderImage());
message.appendString(super.getTeaserImage());
message.appendInt(3);
message.appendString(super.getTextOne());
message.appendString(super.getTextDetails());
message.appendString(super.getTextTwo());
}
}

View File

@ -0,0 +1,32 @@
package com.eu.habbo.habbohotel.catalog.layouts;
import com.eu.habbo.habbohotel.catalog.CatalogPage;
import com.eu.habbo.messages.ServerMessage;
import java.sql.ResultSet;
import java.sql.SQLException;
/**
* Class for the page where additional buildersclub addons can be bought.
*/
public class BuildersClubAddonsLayout extends CatalogPage
{
public BuildersClubAddonsLayout(ResultSet set) throws SQLException
{
super(set);
}
@Override
public void serialize(ServerMessage message)
{
message.appendString("builders_club_addons");
message.appendInt(3);
message.appendString(super.getHeaderImage());
message.appendString(super.getTeaserImage());
message.appendString(super.getSpecialImage());
message.appendInt(3);
message.appendString(super.getTextOne());
message.appendString(super.getTextDetails());
message.appendString(super.getTextTeaser());
}
}

View File

@ -0,0 +1,32 @@
package com.eu.habbo.habbohotel.catalog.layouts;
import com.eu.habbo.habbohotel.catalog.CatalogPage;
import com.eu.habbo.messages.ServerMessage;
import java.sql.ResultSet;
import java.sql.SQLException;
/**
* Class for the frontpage of the buildersclub.
*/
public class BuildersClubFrontPageLayout extends CatalogPage
{
public BuildersClubFrontPageLayout(ResultSet set) throws SQLException
{
super(set);
}
@Override
public void serialize(ServerMessage message)
{
message.appendString("builders_club_frontpage");
message.appendInt(3);
message.appendString(super.getHeaderImage());
message.appendString(super.getTeaserImage());
message.appendString(super.getSpecialImage());
message.appendInt(3);
message.appendString(super.getTextOne());
message.appendString(super.getTextDetails());
message.appendString(super.getTextTeaser());
}
}

View File

@ -0,0 +1,32 @@
package com.eu.habbo.habbohotel.catalog.layouts;
import com.eu.habbo.habbohotel.catalog.CatalogPage;
import com.eu.habbo.messages.ServerMessage;
import java.sql.ResultSet;
import java.sql.SQLException;
/**
* Class for the buildersclub rewards page.
*/
public class BuildersClubLoyaltyLayout extends CatalogPage
{
public BuildersClubLoyaltyLayout(ResultSet set) throws SQLException
{
super(set);
}
@Override
public void serialize(ServerMessage message)
{
message.appendString("builders_club_loyalty");
message.appendInt(3);
message.appendString(super.getHeaderImage());
message.appendString(super.getTeaserImage());
message.appendString(super.getSpecialImage());
message.appendInt(3);
message.appendString(super.getTextOne());
message.appendString(super.getTextDetails());
message.appendString(super.getTextTeaser());
}
}

View File

@ -0,0 +1,32 @@
package com.eu.habbo.habbohotel.catalog.layouts;
import com.eu.habbo.habbohotel.catalog.CatalogPage;
import com.eu.habbo.messages.ServerMessage;
import java.sql.ResultSet;
import java.sql.SQLException;
public class CatalogRootLayout extends CatalogPage
{
public CatalogRootLayout(ResultSet set) throws SQLException
{
super(null);
this.id = -1;
this.parentId = -2;
this.rank = 0;
this.caption = "root";
this.pageName = "root";
this.iconColor = 0;
this.iconImage = 0;
this.orderNum = -10;
this.visible = true;
this.enabled = true;
}
@Override
public void serialize(ServerMessage message)
{
}
}

View File

@ -0,0 +1,25 @@
package com.eu.habbo.habbohotel.catalog.layouts;
import com.eu.habbo.habbohotel.catalog.CatalogPage;
import com.eu.habbo.messages.ServerMessage;
import java.sql.ResultSet;
import java.sql.SQLException;
public class ClubBuyLayout extends CatalogPage
{
public ClubBuyLayout(ResultSet set) throws SQLException
{
super(set);
}
@Override
public void serialize(ServerMessage message)
{
message.appendString("club_buy");
message.appendInt(2);
message.appendString(super.getHeaderImage());
message.appendString(super.getTeaserImage());
message.appendInt(0);
}
}

View File

@ -0,0 +1,25 @@
package com.eu.habbo.habbohotel.catalog.layouts;
import com.eu.habbo.habbohotel.catalog.CatalogPage;
import com.eu.habbo.messages.ServerMessage;
import java.sql.ResultSet;
import java.sql.SQLException;
public class ClubGiftsLayout extends CatalogPage
{
public ClubGiftsLayout(ResultSet set) throws SQLException
{
super(set);
}
@Override
public void serialize(ServerMessage message)
{
message.appendString("club_gifts");
message.appendInt(1);
message.appendString(super.getHeaderImage());
message.appendInt(1);
message.appendString(super.getTextOne());
}
}

View File

@ -0,0 +1,28 @@
package com.eu.habbo.habbohotel.catalog.layouts;
import com.eu.habbo.habbohotel.catalog.CatalogPage;
import com.eu.habbo.messages.ServerMessage;
import java.sql.ResultSet;
import java.sql.SQLException;
public class ColorGroupingLayout extends CatalogPage
{
public ColorGroupingLayout(ResultSet set) throws SQLException
{
super(set);
}
@Override
public void serialize(ServerMessage message) {
message.appendString("default_3x3_color_grouping");
message.appendInt(3);
message.appendString(super.getHeaderImage());
message.appendString(super.getTeaserImage());
message.appendString(super.getSpecialImage());
message.appendInt(3);
message.appendString(super.getTextOne());
message.appendString(super.getTextDetails());
message.appendString(super.getTextTeaser());
}
}

View File

@ -0,0 +1,29 @@
package com.eu.habbo.habbohotel.catalog.layouts;
import com.eu.habbo.habbohotel.catalog.CatalogPage;
import com.eu.habbo.messages.ServerMessage;
import java.sql.ResultSet;
import java.sql.SQLException;
public class Default_3x3Layout extends CatalogPage {
public Default_3x3Layout(ResultSet set) throws SQLException
{
super(set);
}
@Override
public void serialize(ServerMessage message)
{
message.appendString("default_3x3");
message.appendInt(3);
message.appendString(super.getHeaderImage());
message.appendString(super.getTeaserImage());
message.appendString(super.getSpecialImage());
message.appendInt(3);
message.appendString(super.getTextOne());
message.appendString(super.getTextDetails());
message.appendString(super.getTextTeaser());
}
}

View File

@ -0,0 +1,82 @@
package com.eu.habbo.habbohotel.catalog.layouts;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.catalog.CatalogFeaturedPage;
import com.eu.habbo.habbohotel.catalog.CatalogPage;
import com.eu.habbo.messages.ServerMessage;
import java.sql.ResultSet;
import java.sql.SQLException;
public class FrontPageFeaturedLayout extends CatalogPage
{
public FrontPageFeaturedLayout(ResultSet set) throws SQLException
{
super(set);
}
@Override
public void serialize(ServerMessage message)
{
message.appendString("frontpage_featured");
String[] teaserImages = super.getTeaserImage().split(";");
String[] specialImages = super.getSpecialImage().split(";");
message.appendInt(1 + teaserImages.length + specialImages.length);
message.appendString(super.getHeaderImage());
for (String s : teaserImages)
{
message.appendString(s);
}
for (String s : specialImages)
{
message.appendString(s);
}
message.appendInt(3);
message.appendString(super.getTextOne());
message.appendString(super.getTextDetails());
message.appendString(super.getTextTeaser());
}
public void serializeExtra(ServerMessage message)
{
message.appendInt(Emulator.getGameEnvironment().getCatalogManager().getCatalogFeaturedPages().size()); // count
for (CatalogFeaturedPage page : Emulator.getGameEnvironment().getCatalogManager().getCatalogFeaturedPages().valueCollection())
{
page.serialize(message);
}
message.appendInt(1); //Position
message.appendString("NUOVO: Affare Stanza di Rilassamento"); // Text
message.appendString("catalogue/feature_cata_vert_oly16bundle4.png"); // Image
message.appendInt(0); //Type
//0 : String //Page Name
//1 : Int //Page ID
//2 : String //Productdata
message.appendString(""); // page link?
message.appendInt(-1); // page id?
message.appendInt(2);
message.appendString("Il RITORNO di Habburgers! (TUTTI furni nuovi)");
message.appendString("catalogue/feature_cata_hort_habbergerbundle.png");
message.appendInt(0);
message.appendString("");
message.appendInt(-1);
message.appendInt(3);
message.appendString("Habbolympics");
message.appendString("catalogue/feature_cata_hort_olympic16.png");
message.appendInt(0);
message.appendString("");
message.appendInt(-1);
message.appendInt(4);
message.appendString("Diventa un Membro HC");
message.appendString("catalogue/feature_cata_hort_HC_b.png");
message.appendInt(0);
message.appendString("habbo_club");
message.appendInt(-1);
}
}

View File

@ -0,0 +1,27 @@
package com.eu.habbo.habbohotel.catalog.layouts;
import com.eu.habbo.habbohotel.catalog.CatalogPage;
import com.eu.habbo.messages.ServerMessage;
import java.sql.ResultSet;
import java.sql.SQLException;
public class FrontpageLayout extends CatalogPage {
public FrontpageLayout(ResultSet set) throws SQLException
{
super(set);
}
@Override
public void serialize(ServerMessage message) {
message.appendString("frontpage4");
message.appendInt(2);
message.appendString(super.getHeaderImage());
message.appendString(super.getTeaserImage());
message.appendInt(3);
message.appendString(super.getTextOne());
message.appendString(super.getTextTwo());
message.appendString(super.getTextTeaser());
}
}

View File

@ -0,0 +1,28 @@
package com.eu.habbo.habbohotel.catalog.layouts;
import com.eu.habbo.habbohotel.catalog.CatalogPage;
import com.eu.habbo.messages.ServerMessage;
import java.sql.ResultSet;
import java.sql.SQLException;
public class GuildForumLayout extends CatalogPage
{
public GuildForumLayout(ResultSet set) throws SQLException
{
super(set);
}
@Override
public void serialize(ServerMessage message)
{
message.appendString("guild_forum");
message.appendInt(2);
message.appendString(super.getHeaderImage());
message.appendString(super.getTeaserImage());
message.appendInt(3);
message.appendString(super.getTextOne());
message.appendString(super.getTextDetails());
message.appendString(super.getTextTeaser());
}
}

View File

@ -0,0 +1,28 @@
package com.eu.habbo.habbohotel.catalog.layouts;
import com.eu.habbo.habbohotel.catalog.CatalogPage;
import com.eu.habbo.messages.ServerMessage;
import java.sql.ResultSet;
import java.sql.SQLException;
public class GuildFrontpageLayout extends CatalogPage
{
public GuildFrontpageLayout(ResultSet set) throws SQLException
{
super(set);
}
@Override
public void serialize(ServerMessage message)
{
message.appendString("guild_frontpage");
message.appendInt(2);
message.appendString(super.getHeaderImage());
message.appendString(super.getTeaserImage());
message.appendInt(3);
message.appendString(super.getTextOne());
message.appendString(super.getTextDetails());
message.appendString(super.getTextTeaser());
}
}

View File

@ -0,0 +1,28 @@
package com.eu.habbo.habbohotel.catalog.layouts;
import com.eu.habbo.habbohotel.catalog.CatalogPage;
import com.eu.habbo.messages.ServerMessage;
import java.sql.ResultSet;
import java.sql.SQLException;
public class GuildFurnitureLayout extends CatalogPage
{
public GuildFurnitureLayout(ResultSet set) throws SQLException
{
super(set);
}
@Override
public void serialize(ServerMessage message)
{
message.appendString("guild_custom_furni");
message.appendInt(2);
message.appendString(super.getHeaderImage());
message.appendString(super.getTeaserImage());
message.appendInt(3);
message.appendString(super.getTextOne());
message.appendString(super.getTextDetails());
message.appendString(super.getTextTeaser());
}
}

View File

@ -0,0 +1,26 @@
package com.eu.habbo.habbohotel.catalog.layouts;
import com.eu.habbo.habbohotel.catalog.CatalogPage;
import com.eu.habbo.messages.ServerMessage;
import java.sql.ResultSet;
import java.sql.SQLException;
public class InfoDucketsLayout extends CatalogPage
{
public InfoDucketsLayout(ResultSet set) throws SQLException
{
super(set);
}
@Override
public void serialize(ServerMessage message)
{
message.appendString("info_duckets");
message.appendInt(1);
message.appendString(getHeaderImage());
message.appendInt(1);
message.appendString(getTextOne());
message.appendInt(0);
}
}

View File

@ -0,0 +1,26 @@
package com.eu.habbo.habbohotel.catalog.layouts;
import com.eu.habbo.habbohotel.catalog.CatalogPage;
import com.eu.habbo.messages.ServerMessage;
import java.sql.ResultSet;
import java.sql.SQLException;
public class InfoLoyaltyLayout extends CatalogPage
{
public InfoLoyaltyLayout(ResultSet set) throws SQLException
{
super(set);
}
@Override
public void serialize(ServerMessage message)
{
message.appendString("info_loyalty");
message.appendInt(1);
message.appendString(getHeaderImage());
message.appendInt(1);
message.appendString(getTextOne());
message.appendInt(0);
}
}

View File

@ -0,0 +1,29 @@
package com.eu.habbo.habbohotel.catalog.layouts;
import com.eu.habbo.habbohotel.catalog.CatalogPage;
import com.eu.habbo.messages.ServerMessage;
import java.sql.ResultSet;
import java.sql.SQLException;
public class InfoPetsLayout extends CatalogPage
{
public InfoPetsLayout(ResultSet set) throws SQLException
{
super(set);
}
@Override
public void serialize(ServerMessage message)
{
message.appendString("info_pets");
message.appendInt(2);
message.appendString(getHeaderImage());
message.appendString(getTeaserImage());
message.appendInt(3);
message.appendString(getTextOne());
message.appendString("");
message.appendString(getTextTeaser());
message.appendInt(0);
}
}

View File

@ -0,0 +1,29 @@
package com.eu.habbo.habbohotel.catalog.layouts;
import com.eu.habbo.habbohotel.catalog.CatalogPage;
import com.eu.habbo.messages.ServerMessage;
import java.sql.ResultSet;
import java.sql.SQLException;
public class InfoRentablesLayout extends CatalogPage
{
public InfoRentablesLayout(ResultSet set) throws SQLException
{
super(set);
}
@Override
public void serialize(ServerMessage message)
{
String[] data = getTextOne().split("\\|\\|");
message.appendString("info_rentables");
message.appendInt(1);
message.appendString(getHeaderImage());
message.appendInt(data.length);
for (String d : data) {
message.appendString(d);
}
message.appendInt(0);
}
}

View File

@ -0,0 +1,29 @@
package com.eu.habbo.habbohotel.catalog.layouts;
import com.eu.habbo.habbohotel.catalog.CatalogPage;
import com.eu.habbo.messages.ServerMessage;
import java.sql.ResultSet;
import java.sql.SQLException;
public class LoyaltyVipBuyLayout extends CatalogPage
{
public LoyaltyVipBuyLayout(ResultSet set) throws SQLException
{
super(set);
}
@Override
public void serialize(ServerMessage message)
{
message.appendString("loyalty_vip_buy");
message.appendInt(3);
message.appendString(super.getHeaderImage());
message.appendString(super.getTeaserImage());
message.appendString(super.getSpecialImage());
message.appendInt(3);
message.appendString(super.getTextOne());
message.appendString(super.getTextDetails());
message.appendString(super.getTextTeaser());
}
}

View File

@ -0,0 +1,23 @@
package com.eu.habbo.habbohotel.catalog.layouts;
import com.eu.habbo.habbohotel.catalog.CatalogPage;
import com.eu.habbo.messages.ServerMessage;
import java.sql.ResultSet;
import java.sql.SQLException;
public class MarketplaceLayout extends CatalogPage
{
public MarketplaceLayout(ResultSet set) throws SQLException
{
super(set);
}
@Override
public void serialize(ServerMessage message)
{
message.appendString("marketplace");
message.appendInt(0);
message.appendInt(0);
}
}

View File

@ -0,0 +1,24 @@
package com.eu.habbo.habbohotel.catalog.layouts;
import com.eu.habbo.habbohotel.catalog.CatalogPage;
import com.eu.habbo.messages.ServerMessage;
import java.sql.ResultSet;
import java.sql.SQLException;
public class MarketplaceOwnItems extends CatalogPage
{
public MarketplaceOwnItems(ResultSet set) throws SQLException
{
super(set);
}
@Override
public void serialize(ServerMessage message)
{
message.appendString("marketplace_own_items");
message.appendInt(0);
message.appendInt(0);
}
}

View File

@ -0,0 +1,29 @@
package com.eu.habbo.habbohotel.catalog.layouts;
import com.eu.habbo.habbohotel.catalog.CatalogPage;
import com.eu.habbo.messages.ServerMessage;
import java.sql.ResultSet;
import java.sql.SQLException;
public class PetCustomizationLayout extends CatalogPage
{
public PetCustomizationLayout(ResultSet set) throws SQLException
{
super(set);
}
@Override
public void serialize(ServerMessage message)
{
message.appendString("petcustomization");
message.appendInt(3);
message.appendString(super.getHeaderImage());
message.appendString(super.getTeaserImage());
message.appendString(super.getSpecialImage());
message.appendInt(3);
message.appendString(super.getTextOne());
message.appendString(super.getTextDetails());
message.appendString(super.getTextTeaser());
}
}

View File

@ -0,0 +1,29 @@
package com.eu.habbo.habbohotel.catalog.layouts;
import com.eu.habbo.habbohotel.catalog.CatalogPage;
import com.eu.habbo.messages.ServerMessage;
import java.sql.ResultSet;
import java.sql.SQLException;
public class Pets2Layout extends CatalogPage
{
public Pets2Layout(ResultSet set) throws SQLException
{
super(set);
}
@Override
public void serialize(ServerMessage message)
{
message.appendString("pets2");
message.appendInt(2);
message.appendString(super.getHeaderImage());
message.appendString(super.getTeaserImage());
message.appendInt(4);
message.appendString(super.getTextOne());
message.appendString(super.getTextTwo());
message.appendString(super.getTextDetails());
message.appendString(super.getTextTeaser());
}
}

View File

@ -0,0 +1,29 @@
package com.eu.habbo.habbohotel.catalog.layouts;
import com.eu.habbo.habbohotel.catalog.CatalogPage;
import com.eu.habbo.messages.ServerMessage;
import java.sql.ResultSet;
import java.sql.SQLException;
public class Pets3Layout extends CatalogPage
{
public Pets3Layout(ResultSet set) throws SQLException
{
super(set);
}
@Override
public void serialize(ServerMessage message)
{
message.appendString("pets3");
message.appendInt(2);
message.appendString(super.getHeaderImage());
message.appendString(super.getTeaserImage());
message.appendInt(4);
message.appendString(super.getTextOne());
message.appendString(super.getTextTwo());
message.appendString(super.getTextDetails());
message.appendString(super.getTextTeaser());
}
}

View File

@ -0,0 +1,29 @@
package com.eu.habbo.habbohotel.catalog.layouts;
import com.eu.habbo.habbohotel.catalog.CatalogPage;
import com.eu.habbo.messages.ServerMessage;
import java.sql.ResultSet;
import java.sql.SQLException;
public class PetsLayout extends CatalogPage
{
public PetsLayout(ResultSet set) throws SQLException
{
super(set);
}
@Override
public void serialize(ServerMessage message)
{
message.appendString("pets");
message.appendInt(2);
message.appendString(super.getHeaderImage());
message.appendString(super.getTeaserImage());
message.appendInt(4);
message.appendString(super.getTextOne());
message.appendString(super.getTextTwo());
message.appendString(super.getTextDetails());
message.appendString(super.getTextTeaser());
}
}

View File

@ -0,0 +1,29 @@
package com.eu.habbo.habbohotel.catalog.layouts;
import com.eu.habbo.habbohotel.catalog.CatalogPage;
import com.eu.habbo.messages.ServerMessage;
import java.sql.ResultSet;
import java.sql.SQLException;
public class ProductPage1Layout extends CatalogPage
{
public ProductPage1Layout(ResultSet set) throws SQLException
{
super(set);
}
@Override
public void serialize(ServerMessage message)
{
message.appendString("productpage1");
message.appendInt(2);
message.appendString(super.getHeaderImage());
message.appendString(super.getTeaserImage());
message.appendInt(4);
message.appendString(super.getTextOne());
message.appendString(super.getTextTwo());
message.appendString(super.getTextDetails());
message.appendString(super.getTextTeaser());
}
}

View File

@ -0,0 +1,28 @@
package com.eu.habbo.habbohotel.catalog.layouts;
import com.eu.habbo.habbohotel.catalog.CatalogPage;
import com.eu.habbo.messages.ServerMessage;
import java.sql.ResultSet;
import java.sql.SQLException;
public class RecentPurchasesLayout extends CatalogPage
{
public RecentPurchasesLayout(ResultSet set) throws SQLException
{
super(set);
}
@Override
public void serialize(ServerMessage message) {
message.appendString("default_3x3");
message.appendInt(3);
message.appendString(super.getHeaderImage());
message.appendString(super.getTeaserImage());
message.appendString(super.getSpecialImage());
message.appendInt(3);
message.appendString(super.getTextOne());
message.appendString(super.getTextDetails());
message.appendString(super.getTextTeaser());
}
}

View File

@ -0,0 +1,29 @@
package com.eu.habbo.habbohotel.catalog.layouts;
import com.eu.habbo.habbohotel.catalog.CatalogPage;
import com.eu.habbo.messages.ServerMessage;
import java.sql.ResultSet;
import java.sql.SQLException;
public class RecyclerInfoLayout extends CatalogPage
{
public RecyclerInfoLayout(ResultSet set) throws SQLException
{
super(set);
}
@Override
public void serialize(ServerMessage message)
{
message.appendString("recycler_info");
message.appendInt(3);
message.appendString(super.getHeaderImage());
message.appendString(super.getTeaserImage());
message.appendString(super.getSpecialImage());
message.appendInt(3);
message.appendString(super.getTextOne());
message.appendString(super.getTextDetails());
message.appendString(super.getTextTeaser());
}
}

View File

@ -0,0 +1,28 @@
package com.eu.habbo.habbohotel.catalog.layouts;
import com.eu.habbo.habbohotel.catalog.CatalogPage;
import com.eu.habbo.messages.ServerMessage;
import java.sql.ResultSet;
import java.sql.SQLException;
public class RecyclerLayout extends CatalogPage
{
public RecyclerLayout(ResultSet set) throws SQLException
{
super(set);
}
@Override
public void serialize(ServerMessage message)
{
message.appendString("recycler");
message.appendInt(2);
message.appendString(super.getHeaderImage());
message.appendString(super.getTeaserImage());
message.appendInt(1);
message.appendString(super.getTextOne());
message.appendInt(-1);
message.appendBoolean(false);
}
}

Some files were not shown because too many files have changed in this diff Show More