mirror of
https://git.krews.org/morningstar/Arcturus-Community.git
synced 2024-11-26 08:20:51 +01:00
Merge branch 'dev' into 'master'
3.5.0 Closes #980 and #824 See merge request morningstar/Arcturus-Community!554
This commit is contained in:
commit
1449ee1741
121
README.md
121
README.md
@ -1,30 +1,78 @@
|
|||||||
# Arcturus Morningstar #
|
# Arcturus Morningstar #
|
||||||
|
|
||||||
## What is Arcturus Morningstar? ##
|
Arcturus Morningstar is as a fork of Arcturus Emulator by TheGeneral. Arcturus Morningstar is released under the [GNU General Public License v3](https://www.gnu.org/licenses/gpl-3.0.txt) and is developed for free by talented developers at Krews.org and is compatible with the following client revision/community projects:
|
||||||
Arcturus Morningstar is the community project for the Arcturus Emulator by TheGeneral.
|
|
||||||
|
|
||||||
The community project was made because the Arcturus Emulator has been abandoned by TheGeneral with lack of updates, an intent to monetize the project, and make the project private.
|
|
||||||
|
|
||||||
TheGeneral's own words were "dont like it then dont use it". We did not like what he was doing, so we made our own version.
|
| Flash | Community Clients |
|
||||||
|
| ------------- | ------------- |
|
||||||
|
| [PRODUCTION-201611291003-338511768](https://git.krews.org/morningstar/apollyon/uploads/dc669a26613bf2356e48eb653734ab29/patched-habbo.swf) | [Nitro (Recommended)*](https://git.krews.org/nitro) |
|
||||||
|
|
||||||
## License ##
|
###### *Note to use Nitro you will need to use the following [plugin](https://git.krews.org/nitro/ms-websockets/-/releases) with Arcturus Morningstar #######
|
||||||
Arcturus Morningstar is released under the [GNU General Public License v3](https://www.gnu.org/licenses/gpl-3.0.txt).
|
|
||||||
|
|
||||||
## Versions ##
|
|
||||||
[![image](https://img.shields.io/badge/VERSION-3.0.0-success.svg?style=for-the-badge&logo=appveyor)](#)
|
|
||||||
[![image](https://img.shields.io/badge/STATUS-STABLE-blue.svg?style=for-the-badge&logo=appveyor)](#)
|
|
||||||
[![image](https://img.shields.io/discord/557240155040251905?style=for-the-badge&logo=discord&color=7289DA&label=DISCORD&logoColor=fff)](https://discord.gg/BzfFsTp)
|
|
||||||
|
|
||||||
Compiled Download: https://git.krews.org/morningstar/Arcturus-Community/-/releases
|
|
||||||
|
|
||||||
Client build: **PRODUCTION-201611291003-338511768**
|
|
||||||
|
|
||||||
## Reporting problems ##
|
|
||||||
You can report problems via the Issue Tracker at https://git.krews.org/morningstar/Arcturus-Community/issues
|
|
||||||
When making an bug report or a feature request use the template we provide so that it can be categorized correctly and we have more information to replicate a bug or implement a feature correctly.
|
|
||||||
|
|
||||||
## Credits ##
|
[![image](https://img.shields.io/discord/557240155040251905?style=for-the-badge&logo=discord&color=7289DA&label=KREWS&logoColor=fff)](https://discord.gg/BzfFsTp)
|
||||||
- TheGeneral
|
|
||||||
|
## Download ##
|
||||||
|
[![image](https://img.shields.io/badge/STABLE%20RELEASES-3.0.0-success.svg?style=for-the-badge&logo=appveyor)](https://git.krews.org/morningstar/Arcturus-Community/-/releases)
|
||||||
|
|
||||||
|
[![image](https://img.shields.io/badge/DEVELOPER%20BUILDS-3.1.0-red.svg?style=for-the-badge&logo=appveyor)](https://git.krews.org/morningstar/Arcturus-Community/-/jobs) *
|
||||||
|
|
||||||
|
[![image](https://img.shields.io/badge/RECOMMENDED%20PLUGINS-blue.svg?style=for-the-badge&logo=)](https://git.krews.org/official-plugins)
|
||||||
|
|
||||||
|
###### * Note to use these builds you will need to run any database updates from [here](https://git.krews.org/morningstar/Arcturus-Community/-/tree/dev/sqlupdates) #######
|
||||||
|
|
||||||
|
|
||||||
|
### Branches ###
|
||||||
|
There are two main branches in use on the Arcturus Morningstar git. Below the pros an
|
||||||
|
|
||||||
|
| master | Tested on a production hotel and is stable for every day use with no known serious exploits. |
|
||||||
|
| ------------- | ------------- |
|
||||||
|
|
||||||
|
| dev | The most up-to-date, but features may not work as intended. |
|
||||||
|
| ------------- | ------------- |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
There is no set timeframe on when new versions will be released or when the stable branch will be updated
|
||||||
|
|
||||||
|
|
||||||
|
## Can I Help!? ##
|
||||||
|
#### Reporting Bugs: ####
|
||||||
|
You can report problems via the [Issue Tracker](https://git.krews.org/morningstar/Arcturus-Community/issues)*
|
||||||
|
###### * When making an bug report or a feature request use the template we provide so that it can be categorized correctly and we have more information to replicate a bug or implement a feature correctly. ######
|
||||||
|
#### Can I contribute code to this project? ####
|
||||||
|
Of Course! if you have fixed a bug from the git please feel free to do a [merge request](https://git.krews.org/morningstar/Arcturus-Community/issues)*
|
||||||
|
###### * Anyone is allowed to fork the project and make pull requests, we make no guarantee that pull requests will be approved into the project. Please Do NOT push code which does not replicate behaviour on habbo.com, instead make the behaviour configurable or as a plugin. ######
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Plugin System ##
|
||||||
|
The robust Plugin System included in the original Arcturus release is also included in Arcturus Morningstar, if you're interested in making your own plugins, feel free to ask around on our discord and we'll point you in the right direction!
|
||||||
|
|
||||||
|
A lot of the community aren't used to modifying things in this way, so we've written a few pros:
|
||||||
|
1. Other people will see that plugins are the normal way of adding custom features
|
||||||
|
2. Plugins can be added and removed at the hotel owner's choice, it makes customizing the hotel easier
|
||||||
|
3. Developers will be able to read plugin source code to learn how to make their own plugins, without the need to look in complicated source code
|
||||||
|
|
||||||
|
## Making money ##
|
||||||
|
We have no problem with developers making money through the sale of custom features, plugins or maintenance work.
|
||||||
|
|
||||||
|
Sale of a special edition of a *source code* will not be permitted. You may use your own private edition of a source code, but we will not help you if you have any problems with it.
|
||||||
|
|
||||||
|
If we ever are to make paid features or plugins, we will not prevent or discourage developers from creating alternative options for users.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Credits ###
|
||||||
|
|
||||||
|
- TheGeneral (Arcturus Emulator)
|
||||||
- Beny
|
- Beny
|
||||||
- Alejandro
|
- Alejandro
|
||||||
- Capheus
|
- Capheus
|
||||||
@ -53,46 +101,13 @@ When making an bug report or a feature request use the template we provide so th
|
|||||||
- MartenM
|
- MartenM
|
||||||
- Ridge
|
- Ridge
|
||||||
- SenpaiDipper
|
- SenpaiDipper
|
||||||
- Snaiker
|
|
||||||
- Thijmen
|
- Thijmen
|
||||||
|
- Brenoepic
|
||||||
|
- Stankman
|
||||||
|
- Laynester
|
||||||
|
|
||||||
|
|
||||||
## Discord ##
|
|
||||||
Join us on Discord at https://discord.gg/BzfFsTp
|
|
||||||
|
|
||||||
## Contributing ##
|
|
||||||
Anyone is allowed to fork the project and make pull requests. We make no guarantee that pull requests will be approved into the project.
|
|
||||||
|
|
||||||
## Branches ##
|
|
||||||
There will be 2 branches of the Arcturus Morningstar emulator:
|
|
||||||
|
|
||||||
`master` - The master branch will be the stable branch. Everything here has been tested on a live hotel and contains no known problems.
|
|
||||||
|
|
||||||
`dev` - The dev branch will be the unstable branch. This one is the most up to date, but things may not work as intended.
|
|
||||||
|
|
||||||
There is no set timeframe on when new versions will be released or when the stable branch will be updated.
|
|
||||||
|
|
||||||
## Custom features ##
|
|
||||||
Do not implement custom features into the source.
|
|
||||||
A custom feature will be defined as a feature or ability which is not possible in Habbo.com
|
|
||||||
Use plugins for custom features, and if a plugin is not possible, you should adapt the source to enable plugins to do that.
|
|
||||||
|
|
||||||
## Why always make things as plugins? ##
|
|
||||||
Why always make things as plugins?
|
|
||||||
1. Other people will see that plugins are the normal way of adding custom features
|
|
||||||
2. Plugins can be added and removed at the hotel owner's choice, it makes customizing the hotel easier
|
|
||||||
3. Developers will be able to read plugin source code to learn how to make their own plugins, without the need to look in complicated source code
|
|
||||||
|
|
||||||
## Making money ##
|
|
||||||
We have no problem with developers making money through the sale of custom features, plugins or maintenance work.
|
|
||||||
|
|
||||||
Sale of a special edition of a *source code* will not be permitted. You may use your own private edition of a source code, but we will not help you if you have any problems with it.
|
|
||||||
|
|
||||||
If we ever are to make paid features or plugins, we will not prevent or discourage developers from creating alternative options for users.
|
|
||||||
|
|
||||||
|
|
||||||
## Plugins - Official Plugins ##
|
|
||||||
You can find official plugins to add custom features to Arcturus Morningstar at the following URL:
|
|
||||||
|
|
||||||
[View the respository here.](https://git.krews.org/official-plugins)
|
|
||||||
|
|
||||||
|
208
featurelist.md
Normal file
208
featurelist.md
Normal file
@ -0,0 +1,208 @@
|
|||||||
|
|
||||||
|
|
||||||
|
The following file contains the current feature list for Arcturus Morningstar as of the 4.x Beta Branch.
|
||||||
|
We hope this file will provide an easy place to find functions in Arcturus Morningstar for new developers, as well as give people the chance to see exactly what Arcturus Morningstar can do!
|
||||||
|
|
||||||
|
If you wish to contribute to this list, features are laid out in the following format:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## ✍️ Example Header:
|
||||||
|
|
||||||
|
##### Example Feature Header- ✔️ (completed) ⭕ (incomplete/ not implemented)
|
||||||
|
|
||||||
|
> [`ExampleLinkToRelatedClasses`](https://google.com)
|
||||||
|
>
|
||||||
|
> ###### Example Sub Feature Header - ✔️
|
||||||
|
>
|
||||||
|
> > [`ExampleLinkToRelatedSubClasses`](https://google.com)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## 🖥️ Connection / User:
|
||||||
|
|
||||||
|
##### Login via SSO Ticket ✔️
|
||||||
|
|
||||||
|
> [`SecureLoginEvent`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/messages/incoming/handshake/SecureLoginEvent.java)
|
||||||
|
> [`HabboManager.loadHabbo()`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/HabboManager.java#L104)
|
||||||
|
|
||||||
|
##### Support RSA Encryption ✔️
|
||||||
|
|
||||||
|
> [`HabboRSACrypto`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/crypto/HabboRSACrypto.java)
|
||||||
|
> [`HabboRC4`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/crypto/HabboRC4.java)
|
||||||
|
> [`HabboDiffieHellman`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/crypto/HabboDiffieHellman.java)
|
||||||
|
> [`CompleteDiffieHandshakeEvent`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/messages/incoming/handshake/CompleteDiffieHandshakeEvent.java)
|
||||||
|
> [`InitDiffieHandshakeEvent`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/messages/incoming/handshake/InitDiffieHandshakeEvent.java)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## 🧸 RCON:
|
||||||
|
|
||||||
|
##### RCON ✔️
|
||||||
|
|
||||||
|
> [`RCONMessage`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/master/src/main/java/com/eu/habbo/messages/rcon/RCONMessage.java)
|
||||||
|
>
|
||||||
|
> ###### RCON Messages - ✔️
|
||||||
|
>
|
||||||
|
> > [`AlertUser`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/master/src/main/java/com/eu/habbo/messages/rcon/AlertUser.java))
|
||||||
|
> > [`ChangeRoomOwner`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/master/src/main/java/com/eu/habbo/messages/rcon/ChangeRoomOwner.java)
|
||||||
|
> > [`CreateModToolTicket`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/master/src/main/java/com/eu/habbo/messages/rcon/CreateModToolTicket.java)
|
||||||
|
> > [`DisconnectUser`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/master/src/main/java/com/eu/habbo/messages/rcon/DisconnectUser.java)
|
||||||
|
> > [`ExecuteCommand`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/master/src/main/java/com/eu/habbo/messages/rcon/ExecuteCommand.java)
|
||||||
|
> > [`ForwardUser`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/master/src/main/java/com/eu/habbo/messages/rcon/ForwardUser.java)
|
||||||
|
> > // todo finish this
|
||||||
|
|
||||||
|
#####
|
||||||
|
|
||||||
|
## 💠 Subscriptions:
|
||||||
|
|
||||||
|
###### Subscriptions Manager ✔️
|
||||||
|
|
||||||
|
> > [`Subscription`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/subscriptions/Subscription.java)
|
||||||
|
> > [`SubscriptionManager`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/subscriptions/SubscriptionManager.java)
|
||||||
|
> > [`SubscriptionScheduler`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/subscriptions/SubscriptionScheduler.java)
|
||||||
|
> > [`UserSubscriptionCreatedEvent`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/plugin/events/users/subscriptions/UserSubscriptionCreatedEvent.java)
|
||||||
|
> > [`UserSubscriptionExpiredEvent`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/plugin/events/users/subscriptions/UserSubscriptionExpiredEvent.java)
|
||||||
|
> > [`UserSubscriptionExtendedEvent`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/master/src/main/java/com/eu/habbo/messages/rcon/RCONMessage.java)
|
||||||
|
> >
|
||||||
|
> > ##### Habbo Club - ✔️
|
||||||
|
> >
|
||||||
|
> > > [`SubscriptionHabboClub`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/subscriptions/SubscriptionHabboClub.java)
|
||||||
|
> > > [`RequestUserClubEvent`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/messages/incoming/users/RequestUserClubEvent.java)
|
||||||
|
> > > [`RequestClubDataEvent`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/messages/incoming/catalog/RequestClubDataEvent.java)
|
||||||
|
> > > [`ClubDataComposer`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/messages/outgoing/catalog/ClubDataComposer.java)
|
||||||
|
> > > [`HabboStats.hasActiveClub()`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/HabboStats.java#L555)
|
||||||
|
> > >
|
||||||
|
> > > ###### HC Catalogue - ✔️
|
||||||
|
> > >
|
||||||
|
> > > > [`ClubBuyLayout`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/catalog/layouts/ClubBuyLayout.java)
|
||||||
|
> > > > [`ClubOffer`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/catalog/ClubOffer.java)
|
||||||
|
> > > > [`ClubGiftsLayout`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/catalog/layouts/ClubGiftsLayout.java)
|
||||||
|
> > > > [`ClubGiftsComposer`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/messages/outgoing/catalog/ClubGiftsComposer.java)
|
||||||
|
> > > > [`ClubCenterDataComposer`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/messages/outgoing/catalog/ClubCenterDataComposer.java)
|
||||||
|
> > > > [`ClubGiftReceivedComposer`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/messages/outgoing/users/ClubGiftReceivedComposer.java)
|
||||||
|
> > >
|
||||||
|
> > > ###### HC Payday - ✔️
|
||||||
|
> > >
|
||||||
|
> > > > [`SecureLoginEvent`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/messages/incoming/handshake/SecureLoginEvent.java#L202)
|
||||||
|
> > > > [`SubscriptionScheduler`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/subscriptions/SubscriptionScheduler.java)
|
||||||
|
> > > > [`SubscriptionHabboClub.calculatePayDay()`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/subscriptions/SubscriptionHabboClub.java#L184)
|
||||||
|
> > > > [`SubscriptionHabboClub.executePayDay()`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/subscriptions/SubscriptionHabboClub.java#L257)
|
||||||
|
> > > > [`SubscriptionHabboClub.processUnclaimed()`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/subscriptions/SubscriptionHabboClub.java#L316)
|
||||||
|
> > > > [`SubscriptionHabboClub.claimPayDay()`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/subscriptions/SubscriptionHabboClub.java#L368)
|
||||||
|
> > > > [`SubscriptionHabboClub.progressAchievement()`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/subscriptions/SubscriptionHabboClub.java#L419)
|
||||||
|
> > >
|
||||||
|
> > > ###### HC Checks on clothing - ✔️
|
||||||
|
> > >
|
||||||
|
> > > > [`ClothingValidationManager`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/clothingvalidation/ClothingValidationManager.java)
|
||||||
|
> > > > [`ClothingValidationManager.validateLook()`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/clothingvalidation/ClothingValidationManager.java#L61)
|
||||||
|
> > >
|
||||||
|
> > > ###### HC dances - ✔️
|
||||||
|
> > >
|
||||||
|
> > > > [`RoomUserDanceEvent`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/messages/incoming/rooms/users/RoomUserDanceEvent.java)
|
||||||
|
> > > > [`RoomUserDanceComposer`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUserDanceComposer.java)
|
||||||
|
> > > > [`RoomUnit.getDanceType()`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/rooms/RoomUnit.java#L456)
|
||||||
|
> > > > [`RoomUnit.setDanceType()`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/rooms/RoomUnit.java#L460)
|
||||||
|
> >
|
||||||
|
> > Builders Club - ⭕
|
||||||
|
> >
|
||||||
|
> > > [`SubscriptionScheduler`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/subscriptions/SubscriptionScheduler.java)
|
||||||
|
> > > [`BuildersClubExpiredComposer`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/messages/outgoing/unknown/BuildersClubExpiredComposer.java)
|
||||||
|
> > >
|
||||||
|
> > > ###### Builders Club Catalogue - ⭕
|
||||||
|
> > >
|
||||||
|
> > > > [`BuildersClubAddonsLayout`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/catalog/layouts/BuildersClubAddonsLayout.java)
|
||||||
|
> > > > [`BuildersClubLoyaltyLayout`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/catalog/layouts/BuildersClubLoyaltyLayout.java))
|
||||||
|
> > > > [`BuildersClubFrontPageLayout`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/catalog/layouts/BuildersClubFrontPageLayout.java)
|
||||||
|
> >
|
||||||
|
> >
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## 🤹 Entities:
|
||||||
|
|
||||||
|
##### Habbo ✔️
|
||||||
|
|
||||||
|
> [`Habbo`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/Habbo.java)
|
||||||
|
> [`Habbo.getClient()`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/Habbo.java#L110)
|
||||||
|
> [`Habbo.isOnline()`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/Habbo.java#L64)
|
||||||
|
> [`Habbo.getHabboInfo()`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/Habbo.java#L90)
|
||||||
|
> [`Habbo.getHabboStats()`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/Habbo.java#L94)
|
||||||
|
> [`Habbo.getRoomUnit()`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/Habbo.java#L102)
|
||||||
|
> [`HabboManager`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/HabboManager.java)
|
||||||
|
> [`HabboManager.getOfflineHabboInfo()`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/HabboManager.java#L47)
|
||||||
|
> [`HabboManager.getCloneAccounts()`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/HabboManager.java#L203)
|
||||||
|
> [`HabboManager.setRank()`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/HabboManager.java#L243)
|
||||||
|
> [`HabboInfo`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/HabboManager.java)
|
||||||
|
|
||||||
|
> ###### Clothing - ✔️
|
||||||
|
>
|
||||||
|
>
|
||||||
|
> > [`UserClothesComposer`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/messages/outgoing/users/UserClothesComposer.java)
|
||||||
|
> > [`HabboInventory.getWardrobeComponent()`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/HabboInventory.java#L67)
|
||||||
|
> > [`HabboInventory.setWardrobeComponent()`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/HabboInventory.java#L71)
|
||||||
|
>
|
||||||
|
> ###### Inventory - ✔️
|
||||||
|
>
|
||||||
|
>
|
||||||
|
> > [`HabboInventory`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/HabboInventory.java)
|
||||||
|
> > [`Habbo.getInventory()`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/Habbo.java#L98)
|
||||||
|
> > [`ItemsComponent.addItem()`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/inventory/ItemsComponent.java#L67)
|
||||||
|
> > [`ItemsComponent.addItems()`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/inventory/ItemsComponent.java#L82)
|
||||||
|
> > [`ItemsComponent.getHabboItem()`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/inventory/ItemsComponent.java#L99)
|
||||||
|
> > [`ItemsComponent.getAndRemoveHabboItem()`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/inventory/ItemsComponent.java#L103)
|
||||||
|
> > [`ItemsComponent.removeHabboItem()`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/inventory/ItemsComponent.java#L126)
|
||||||
|
> > [`ItemsComponent.getItemsAsValueCollection()`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/inventory/ItemsComponent.java#L141)
|
||||||
|
> > [`InventoryItemsComposer`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/HabboInfo.java#L265)
|
||||||
|
> > [`InventoryBotsComposer`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/messages/outgoing/inventory/InventoryBotsComposer.java)
|
||||||
|
> > [`InventoryPetsComposer`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/messages/outgoing/inventory/InventoryPetsComposer.java)
|
||||||
|
> > [`InventoryAchievementsComposer`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/messages/outgoing/inventory/InventoryAchievementsComposer.java)
|
||||||
|
> > [`InventoryRefreshComposer`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/messages/outgoing/inventory/InventoryRefreshComposer.java)
|
||||||
|
> > [`InventoryItemsAddedEvent`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/plugin/events/inventory/InventoryItemsAddedEvent.java)
|
||||||
|
> > [`InventoryItemEvent`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/plugin/events/inventory/InventoryItemEvent.java)
|
||||||
|
>
|
||||||
|
> ###### Motto - ✔️
|
||||||
|
>
|
||||||
|
>
|
||||||
|
> > [`HabboInfo.setMotto()`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/HabboInfo.java#L269)
|
||||||
|
> > [`HabboInfo.getMotto()`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/HabboInfo.java#L265)
|
||||||
|
>
|
||||||
|
> ###### Badges - ✔️
|
||||||
|
>
|
||||||
|
>
|
||||||
|
> > [`BadgesComponent`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/inventory/BadgesComponent.java)
|
||||||
|
> > [`BadgesComponent.loadBadges()`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/inventory/BadgesComponent.java#L28)
|
||||||
|
> > [`BadgesComponent.getBadgesOfflineHabbo()`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/inventory/BadgesComponent.java#L75)
|
||||||
|
> > [`BadgesComponent.createBadge()`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/inventory/BadgesComponent.java#L90)
|
||||||
|
> > [`BadgesComponent.deleteBadge()`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/inventory/BadgesComponent.java#L113)
|
||||||
|
> > [`BadgesComponent.getWearingBadges()`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/inventory/BadgesComponent.java#L123)
|
||||||
|
> > [`BadgesComponent.hasBadge()`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/inventory/BadgesComponent.java#L147)
|
||||||
|
> > [`BadgesComponent.getBadge()`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/inventory/BadgesComponent.java#L151)
|
||||||
|
> > [`BadgesComponent.removeBadge()`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/inventory/BadgesComponent.java#L167)
|
||||||
|
>
|
||||||
|
> ##### Load Currency and Seasonal Currency - ✔️
|
||||||
|
>
|
||||||
|
> > [`RequestUserCreditsEvent`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/messages/incoming/users/RequestUserCreditsEvent.java)
|
||||||
|
> > [`UserCurrencyComposer`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/messages/outgoing/users/UserCurrencyComposer.java)
|
||||||
|
> > [`UserCreditsComposer`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/messages/outgoing/users/UserCreditsComposer.java)
|
||||||
|
> > [`Habbo.getHabboInfo()`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/Habbo.java#L90)
|
||||||
|
|
||||||
|
> Save/Load Achievements
|
||||||
|
>
|
||||||
|
> Save/Load Friends
|
||||||
|
>
|
||||||
|
> Save/Load Own Rooms
|
||||||
|
>
|
||||||
|
> Save/Load Guilds
|
||||||
|
>
|
||||||
|
> Save/Load Currencies
|
||||||
|
>
|
||||||
|
> Save/Load Inventory
|
||||||
|
>
|
||||||
|
> Save/Load Friendships - Love/Hate/Like
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
-
|
4
pom.xml
4
pom.xml
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<groupId>com.eu.habbo</groupId>
|
<groupId>com.eu.habbo</groupId>
|
||||||
<artifactId>Habbo</artifactId>
|
<artifactId>Habbo</artifactId>
|
||||||
<version>3.0.0</version>
|
<version>3.5.0</version>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
@ -106,7 +106,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>mysql</groupId>
|
<groupId>mysql</groupId>
|
||||||
<artifactId>mysql-connector-java</artifactId>
|
<artifactId>mysql-connector-java</artifactId>
|
||||||
<version>5.1.49</version>
|
<version>8.0.22</version>
|
||||||
<scope>runtime</scope>
|
<scope>runtime</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
96
sqlupdates/3_0_0 to 3_5_0.sql
Normal file
96
sqlupdates/3_0_0 to 3_5_0.sql
Normal file
@ -0,0 +1,96 @@
|
|||||||
|
INSERT INTO `emulator_settings`(`key`, `value`) VALUES ('wired.place.under', '0');
|
||||||
|
INSERT INTO `emulator_settings`(`key`, `value`) VALUES ('wired.custom.enabled', '0');
|
||||||
|
|
||||||
|
INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('commands.error.cmd_stalk.forgot_username', 'Specify the username of the Habbo you want to follow!');
|
||||||
|
|
||||||
|
-- Enable or Disable TTY in console (Default is enabled)
|
||||||
|
INSERT INTO `emulator_settings` (`key`, `value`) VALUES ('console.mode', '1');
|
||||||
|
|
||||||
|
-- Youtube Api v3 key to YoutubeManager
|
||||||
|
INSERT INTO `emulator_settings` (`key`, `value`) VALUES ('youtube.apikey', '');
|
||||||
|
|
||||||
|
INSERT INTO `emulator_settings` (`key`, `value`) VALUES ('hotel.gifts.length.max', '300');
|
||||||
|
|
||||||
|
INSERT INTO `emulator_settings` (`key`, `value`) VALUES ('hotel.trophies.length.max', '300');
|
||||||
|
|
||||||
|
-- Add friendship categories table
|
||||||
|
CREATE TABLE `messenger_categories` (
|
||||||
|
`id` int NOT NULL AUTO_INCREMENT,
|
||||||
|
`name` varchar(25) NOT NULL,
|
||||||
|
`user_id` int NOT NULL,
|
||||||
|
UNIQUE KEY `identifier` (`id`)
|
||||||
|
);
|
||||||
|
|
||||||
|
-- Set an ID (int) from category list items
|
||||||
|
ALTER TABLE messenger_friendships ADD category int NOT NULL DEFAULT '0' AFTER friends_since;
|
||||||
|
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- Table structure for calendar_campaigns
|
||||||
|
-- ----------------------------
|
||||||
|
DROP TABLE IF EXISTS `calendar_campaigns`;
|
||||||
|
CREATE TABLE `calendar_campaigns` (
|
||||||
|
`id` int NOT NULL AUTO_INCREMENT,
|
||||||
|
`name` varchar(255) NOT NULL DEFAULT '',
|
||||||
|
`image` varchar(255) NOT NULL DEFAULT '',
|
||||||
|
`start_timestamp` int NOT NULL DEFAULT '0',
|
||||||
|
`total_days` int NOT NULL DEFAULT '30',
|
||||||
|
`lock_expired` enum('1','0') NOT NULL DEFAULT '1',
|
||||||
|
`enabled` enum('1','0') NOT NULL DEFAULT '1',
|
||||||
|
UNIQUE KEY `id` (`id`)
|
||||||
|
);
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- Table structure for calendar_rewards
|
||||||
|
-- ----------------------------
|
||||||
|
DROP TABLE IF EXISTS `calendar_rewards`;
|
||||||
|
CREATE TABLE `calendar_rewards` (
|
||||||
|
`id` int NOT NULL AUTO_INCREMENT,
|
||||||
|
`campaign_id` int NOT NULL DEFAULT '0',
|
||||||
|
`product_name` varchar(128) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT '',
|
||||||
|
`custom_image` varchar(128) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT '',
|
||||||
|
`credits` int NOT NULL DEFAULT '0',
|
||||||
|
`pixels` int NOT NULL DEFAULT '0',
|
||||||
|
`points` int NOT NULL DEFAULT '0',
|
||||||
|
`points_type` int NOT NULL DEFAULT '0',
|
||||||
|
`badge` varchar(25) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT '',
|
||||||
|
`item_id` int NOT NULL DEFAULT '0',
|
||||||
|
`subscription_type` varchar(128) CHARACTER SET latin1 COLLATE latin1_swedish_ci DEFAULT '',
|
||||||
|
`subscription_days` int NOT NULL DEFAULT '0',
|
||||||
|
PRIMARY KEY (`id`) USING BTREE
|
||||||
|
);
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- Table structure for calendar_rewards_claimed
|
||||||
|
-- ----------------------------
|
||||||
|
DROP TABLE IF EXISTS `calendar_rewards_claimed`;
|
||||||
|
CREATE TABLE `calendar_rewards_claimed` (
|
||||||
|
`user_id` int NOT NULL,
|
||||||
|
`campaign_id` int NOT NULL DEFAULT '0',
|
||||||
|
`day` int NOT NULL,
|
||||||
|
`reward_id` int NOT NULL,
|
||||||
|
`timestamp` int NOT NULL
|
||||||
|
);
|
||||||
|
|
||||||
|
INSERT INTO `emulator_settings` (`key`, `value`) VALUES ('hotel.calendar.default', 'test');
|
||||||
|
INSERT INTO `emulator_settings` (`key`, `value`) VALUES ('hotel.calendar.pixels.hc_modifier', '2.0');
|
||||||
|
|
||||||
|
-- Calendar force open
|
||||||
|
ALTER TABLE `permissions` ADD COLUMN `acc_calendar_force` enum('0','1') NULL DEFAULT '0';
|
||||||
|
|
||||||
|
-- UpdateCalendar command.
|
||||||
|
ALTER TABLE `permissions` ADD `cmd_update_calendar` ENUM('0', '1') NOT NULL DEFAULT '0';
|
||||||
|
INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('commands.description.cmd_update_calendar', ':update_calendar'), ('commands.keys.cmd_update_calendar', 'update_calendar');
|
||||||
|
INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('commands.success.cmd_update_calendar', 'Calendar updated successfully!');
|
||||||
|
|
||||||
|
-- add moodlight configuration
|
||||||
|
INSERT INTO `emulator_settings` (`key`, `value`) VALUES ('moodlight.color_check.enabled', '1');
|
||||||
|
|
||||||
|
-- Mannequin name
|
||||||
|
INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('hotel.mannequin.name.default', 'My look');
|
||||||
|
|
||||||
|
-- RCON: Change Username
|
||||||
|
INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('rcon.alert.user.change_username', 'You can change your username. Click on yourself to change it.');
|
||||||
|
|
||||||
|
-- Custom Stacking Setting
|
||||||
|
INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('custom.stacking.enabled', '0');
|
@ -32,11 +32,11 @@ import java.util.regex.Pattern;
|
|||||||
public final class Emulator {
|
public final class Emulator {
|
||||||
|
|
||||||
private static final Logger LOGGER = LoggerFactory.getLogger(Emulator.class);
|
private static final Logger LOGGER = LoggerFactory.getLogger(Emulator.class);
|
||||||
private static final String OS_NAME = System.getProperty("os.name");
|
private static final String OS_NAME = (System.getProperty("os.name") != null ? System.getProperty("os.name") : "Unknown");
|
||||||
private static final String CLASS_PATH = System.getProperty("java.class.path");
|
private static final String CLASS_PATH = (System.getProperty("java.class.path") != null ? System.getProperty("java.class.path") : "Unknown");
|
||||||
|
|
||||||
public final static int MAJOR = 3;
|
public final static int MAJOR = 3;
|
||||||
public final static int MINOR = 0;
|
public final static int MINOR = 5;
|
||||||
public final static int BUILD = 0;
|
public final static int BUILD = 0;
|
||||||
public final static String PREVIEW = "";
|
public final static String PREVIEW = "";
|
||||||
|
|
||||||
@ -115,12 +115,11 @@ public final class Emulator {
|
|||||||
System.out.println("Warning, this is a beta build, this means that there may be unintended consequences so make sure you take regular backups while using this build. If you notice any issues you should make an issue on the Krews Git.");
|
System.out.println("Warning, this is a beta build, this means that there may be unintended consequences so make sure you take regular backups while using this build. If you notice any issues you should make an issue on the Krews Git.");
|
||||||
promptEnterKey();
|
promptEnterKey();
|
||||||
}
|
}
|
||||||
|
LOGGER.info("eek. Has it really been a year?");
|
||||||
LOGGER.info("This project is for educational purposes only. This Emulator is an open-source fork of Arcturus created by TheGeneral.");
|
LOGGER.info("This project is for educational purposes only. This Emulator is an open-source fork of Arcturus created by TheGeneral.");
|
||||||
LOGGER.info("Version: {}", version);
|
LOGGER.info("Version: {}", version);
|
||||||
LOGGER.info("Build: {}", build);
|
LOGGER.info("Build: {}", build);
|
||||||
LOGGER.info("Remember to sign up your hotel to join our toplist beta at https://bit.ly/2NN0rxq");
|
LOGGER.info("Follow our development at https://git.krews.org/morningstar/Arcturus-Community");
|
||||||
LOGGER.info("Join our discord at https://discord.gg/syuqgN");
|
|
||||||
|
|
||||||
long startTime = System.nanoTime();
|
long startTime = System.nanoTime();
|
||||||
|
|
||||||
@ -170,15 +169,17 @@ public final class Emulator {
|
|||||||
Emulator.timeStarted = getIntUnixTimestamp();
|
Emulator.timeStarted = getIntUnixTimestamp();
|
||||||
|
|
||||||
if (Emulator.getConfig().getInt("runtime.threads") < (Runtime.getRuntime().availableProcessors() * 2)) {
|
if (Emulator.getConfig().getInt("runtime.threads") < (Runtime.getRuntime().availableProcessors() * 2)) {
|
||||||
LOGGER.warn("Emulator settings runtime.threads ({}) can be increased to {} to possibly increase performance.",
|
LOGGER.warn("Emulator settings runtime.threads ({}) can be increased to ({}) to possibly increase performance.",
|
||||||
Emulator.getConfig().getInt("runtime.threads"),
|
Emulator.getConfig().getInt("runtime.threads"),
|
||||||
Runtime.getRuntime().availableProcessors() * 2);
|
Runtime.getRuntime().availableProcessors() * 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Emulator.getThreading().run(() -> {
|
Emulator.getThreading().run(() -> {
|
||||||
}, 1500);
|
}, 1500);
|
||||||
|
|
||||||
|
// Check if console mode is true or false, default is true
|
||||||
|
if (Emulator.getConfig().getBoolean("console.mode", true)) {
|
||||||
|
|
||||||
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
|
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
|
||||||
|
|
||||||
while (!isShuttingDown && isReady) {
|
while (!isShuttingDown && isReady) {
|
||||||
@ -195,6 +196,8 @@ public final class Emulator {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@ import com.eu.habbo.habbohotel.guilds.forums.ForumThread;
|
|||||||
import com.eu.habbo.habbohotel.users.Habbo;
|
import com.eu.habbo.habbohotel.users.Habbo;
|
||||||
import com.eu.habbo.messages.incoming.friends.SearchUserEvent;
|
import com.eu.habbo.messages.incoming.friends.SearchUserEvent;
|
||||||
import com.eu.habbo.messages.incoming.navigator.SearchRoomsEvent;
|
import com.eu.habbo.messages.incoming.navigator.SearchRoomsEvent;
|
||||||
|
import com.eu.habbo.messages.outgoing.users.UserDataComposer;
|
||||||
import com.eu.habbo.threading.runnables.AchievementUpdater;
|
import com.eu.habbo.threading.runnables.AchievementUpdater;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@ -146,6 +147,7 @@ public class CleanerThread implements Runnable {
|
|||||||
for (Habbo habbo : Emulator.getGameEnvironment().getHabboManager().getOnlineHabbos().values()) {
|
for (Habbo habbo : Emulator.getGameEnvironment().getHabboManager().getOnlineHabbos().values()) {
|
||||||
habbo.getHabboStats().respectPointsToGive = Emulator.getConfig().getInt("hotel.daily.respect");
|
habbo.getHabboStats().respectPointsToGive = Emulator.getConfig().getInt("hotel.daily.respect");
|
||||||
habbo.getHabboStats().petRespectPointsToGive = Emulator.getConfig().getInt("hotel.daily.respect.pets");
|
habbo.getHabboStats().petRespectPointsToGive = Emulator.getConfig().getInt("hotel.daily.respect.pets");
|
||||||
|
habbo.getClient().sendResponse(new UserDataComposer(habbo));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ import com.eu.habbo.Emulator;
|
|||||||
import com.eu.habbo.core.*;
|
import com.eu.habbo.core.*;
|
||||||
import com.eu.habbo.habbohotel.achievements.AchievementManager;
|
import com.eu.habbo.habbohotel.achievements.AchievementManager;
|
||||||
import com.eu.habbo.habbohotel.bots.BotManager;
|
import com.eu.habbo.habbohotel.bots.BotManager;
|
||||||
|
import com.eu.habbo.habbohotel.campaign.calendar.CalendarManager;
|
||||||
import com.eu.habbo.habbohotel.catalog.CatalogManager;
|
import com.eu.habbo.habbohotel.catalog.CatalogManager;
|
||||||
import com.eu.habbo.habbohotel.commands.CommandHandler;
|
import com.eu.habbo.habbohotel.commands.CommandHandler;
|
||||||
import com.eu.habbo.habbohotel.crafting.CraftingManager;
|
import com.eu.habbo.habbohotel.crafting.CraftingManager;
|
||||||
@ -54,6 +55,7 @@ public class GameEnvironment {
|
|||||||
private CraftingManager craftingManager;
|
private CraftingManager craftingManager;
|
||||||
private PollManager pollManager;
|
private PollManager pollManager;
|
||||||
private SubscriptionManager subscriptionManager;
|
private SubscriptionManager subscriptionManager;
|
||||||
|
private CalendarManager calendarManager;
|
||||||
|
|
||||||
public void load() throws Exception {
|
public void load() throws Exception {
|
||||||
LOGGER.info("GameEnvironment -> Loading...");
|
LOGGER.info("GameEnvironment -> Loading...");
|
||||||
@ -78,6 +80,7 @@ public class GameEnvironment {
|
|||||||
this.wordFilter = new WordFilter();
|
this.wordFilter = new WordFilter();
|
||||||
this.craftingManager = new CraftingManager();
|
this.craftingManager = new CraftingManager();
|
||||||
this.pollManager = new PollManager();
|
this.pollManager = new PollManager();
|
||||||
|
this.calendarManager = new CalendarManager();
|
||||||
|
|
||||||
this.roomManager.loadPublicRooms();
|
this.roomManager.loadPublicRooms();
|
||||||
this.navigatorManager.loadNavigator();
|
this.navigatorManager.loadNavigator();
|
||||||
@ -114,6 +117,7 @@ public class GameEnvironment {
|
|||||||
this.itemManager.dispose();
|
this.itemManager.dispose();
|
||||||
this.hotelViewManager.dispose();
|
this.hotelViewManager.dispose();
|
||||||
this.subscriptionManager.dispose();
|
this.subscriptionManager.dispose();
|
||||||
|
this.calendarManager.dispose();
|
||||||
LOGGER.info("GameEnvironment -> Disposed!");
|
LOGGER.info("GameEnvironment -> Disposed!");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -206,4 +210,6 @@ public class GameEnvironment {
|
|||||||
public SubscriptionManager getSubscriptionManager() {
|
public SubscriptionManager getSubscriptionManager() {
|
||||||
return this.subscriptionManager;
|
return this.subscriptionManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public CalendarManager getCalendarManager() { return this.calendarManager; }
|
||||||
}
|
}
|
||||||
|
@ -146,12 +146,17 @@ public class AchievementManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String newBadgCode = "ACH_" + achievement.name + newLevel.level;
|
||||||
|
|
||||||
if (badge != null) {
|
if (badge != null) {
|
||||||
badge.setCode("ACH_" + achievement.name + newLevel.level);
|
badge.setCode(newBadgCode);
|
||||||
badge.needsInsert(false);
|
badge.needsInsert(false);
|
||||||
badge.needsUpdate(true);
|
badge.needsUpdate(true);
|
||||||
} else {
|
} else {
|
||||||
badge = new HabboBadge(0, "ACH_" + achievement.name + newLevel.level, 0, habbo);
|
if (habbo.getInventory().getBadgesComponent().hasBadge(newBadgCode))
|
||||||
|
return;
|
||||||
|
|
||||||
|
badge = new HabboBadge(0, newBadgCode, 0, habbo);
|
||||||
habbo.getClient().sendResponse(new AddUserBadgeComposer(badge));
|
habbo.getClient().sendResponse(new AddUserBadgeComposer(badge));
|
||||||
badge.needsInsert(true);
|
badge.needsInsert(true);
|
||||||
badge.needsUpdate(true);
|
badge.needsUpdate(true);
|
||||||
@ -359,6 +364,7 @@ public class AchievementManager {
|
|||||||
if (level.badges != null && level.badges.length > 0) {
|
if (level.badges != null && level.badges.length > 0) {
|
||||||
for (String badge : level.badges) {
|
for (String badge : level.badges) {
|
||||||
if (!badge.isEmpty()) {
|
if (!badge.isEmpty()) {
|
||||||
|
if (!habbo.getInventory().getBadgesComponent().hasBadge(badge)) {
|
||||||
HabboBadge b = new HabboBadge(0, badge, 0, habbo);
|
HabboBadge b = new HabboBadge(0, badge, 0, habbo);
|
||||||
Emulator.getThreading().run(b);
|
Emulator.getThreading().run(b);
|
||||||
habbo.getInventory().getBadgesComponent().addBadge(b);
|
habbo.getInventory().getBadgesComponent().addBadge(b);
|
||||||
@ -366,6 +372,7 @@ public class AchievementManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (level.perks != null && level.perks.length > 0) {
|
if (level.perks != null && level.perks.length > 0) {
|
||||||
for (String perk : level.perks) {
|
for (String perk : level.perks) {
|
||||||
|
@ -127,7 +127,7 @@ public class BotManager {
|
|||||||
roomUnit.setRotation(RoomUserRotation.SOUTH);
|
roomUnit.setRotation(RoomUserRotation.SOUTH);
|
||||||
roomUnit.setLocation(location);
|
roomUnit.setLocation(location);
|
||||||
|
|
||||||
double stackHeight = room.getStackHeight(location.x, location.y, false);
|
double stackHeight = location.getStackHeight();
|
||||||
roomUnit.setPreviousLocationZ(stackHeight);
|
roomUnit.setPreviousLocationZ(stackHeight);
|
||||||
roomUnit.setZ(stackHeight);
|
roomUnit.setZ(stackHeight);
|
||||||
|
|
||||||
|
@ -0,0 +1,64 @@
|
|||||||
|
package com.eu.habbo.habbohotel.campaign.calendar;
|
||||||
|
|
||||||
|
import gnu.trove.map.hash.THashMap;
|
||||||
|
|
||||||
|
import java.sql.ResultSet;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
import java.sql.Timestamp;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class CalendarCampaign {
|
||||||
|
private int id;
|
||||||
|
private final String name;
|
||||||
|
private final String image;
|
||||||
|
private Map<Integer , CalendarRewardObject> rewards = new THashMap<>();
|
||||||
|
private final Integer start_timestamp;
|
||||||
|
private final int total_days;
|
||||||
|
private final boolean lock_expired;
|
||||||
|
|
||||||
|
public CalendarCampaign(ResultSet set) throws SQLException {
|
||||||
|
this.id = set.getInt("id");
|
||||||
|
this.name = set.getString("name");
|
||||||
|
this.image = set.getString("image");
|
||||||
|
this.start_timestamp = set.getInt("start_timestamp");
|
||||||
|
this.total_days = set.getInt("total_days");
|
||||||
|
this.lock_expired = set.getInt("lock_expired") == 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CalendarCampaign(int id, String name, String image, Integer start_timestamp, int total_days, boolean lock_expired) {
|
||||||
|
this.id = id;
|
||||||
|
this.name = name;
|
||||||
|
this.image = image;
|
||||||
|
this.start_timestamp = start_timestamp;
|
||||||
|
this.total_days = total_days;
|
||||||
|
this.lock_expired = lock_expired;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getId() {
|
||||||
|
return this.id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return this.name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getImage() {
|
||||||
|
return this.image;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getStartTimestamp() {
|
||||||
|
return this.start_timestamp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getTotalDays() { return this.total_days; }
|
||||||
|
|
||||||
|
public boolean getLockExpired() { return this.lock_expired; }
|
||||||
|
|
||||||
|
public Map<Integer, CalendarRewardObject> getRewards() { return rewards; }
|
||||||
|
|
||||||
|
public void setId(int id) { this.id = id; }
|
||||||
|
|
||||||
|
public void setRewards(Map<Integer, CalendarRewardObject> rewards) { this.rewards = rewards; }
|
||||||
|
|
||||||
|
public void addReward(CalendarRewardObject reward) { this.rewards.put(reward.getId(), reward); }
|
||||||
|
}
|
@ -0,0 +1,154 @@
|
|||||||
|
package com.eu.habbo.habbohotel.campaign.calendar;
|
||||||
|
|
||||||
|
import com.eu.habbo.Emulator;
|
||||||
|
import com.eu.habbo.habbohotel.users.Habbo;
|
||||||
|
import com.eu.habbo.messages.outgoing.events.calendar.AdventCalendarProductComposer;
|
||||||
|
import com.eu.habbo.plugin.events.users.calendar.UserClaimRewardEvent;
|
||||||
|
import gnu.trove.map.hash.THashMap;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import java.sql.*;
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
import static java.time.temporal.ChronoUnit.DAYS;
|
||||||
|
|
||||||
|
|
||||||
|
public class CalendarManager {
|
||||||
|
private static final Logger LOGGER = LoggerFactory.getLogger(CalendarCampaign.class);
|
||||||
|
|
||||||
|
final private static Map<Integer, CalendarCampaign> calendarCampaigns = new THashMap<>();
|
||||||
|
public static double HC_MODIFIER;
|
||||||
|
|
||||||
|
public CalendarManager() {
|
||||||
|
long millis = System.currentTimeMillis();
|
||||||
|
this.reload();
|
||||||
|
LOGGER.info("Calendar Manager -> Loaded! ({} MS)", (System.currentTimeMillis() - millis));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void dispose(){
|
||||||
|
calendarCampaigns.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean reload() {
|
||||||
|
this.dispose();
|
||||||
|
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("SELECT * FROM calendar_campaigns WHERE enabled = 1")) {
|
||||||
|
try (ResultSet set = statement.executeQuery()) {
|
||||||
|
while (set.next()) {
|
||||||
|
calendarCampaigns.put(set.getInt("id"), new CalendarCampaign(set));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (SQLException e) {
|
||||||
|
LOGGER.error("Caught SQL exception", e);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("SELECT * FROM calendar_rewards")) {
|
||||||
|
try (ResultSet set = statement.executeQuery()) {
|
||||||
|
while (set.next()) {
|
||||||
|
CalendarCampaign campaign = calendarCampaigns.get(set.getInt("campaign_id"));
|
||||||
|
if(campaign != null){
|
||||||
|
campaign.addReward(new CalendarRewardObject(set));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (SQLException e) {
|
||||||
|
LOGGER.error("Caught SQL exception", e);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
HC_MODIFIER = Emulator.getConfig().getDouble("hotel.calendar.pixels.hc_modifier", 2.0);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addCampaign(CalendarCampaign campaign) {
|
||||||
|
|
||||||
|
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("INSERT INTO calendar_campaigns ( name, image, start_timestamp, total_days, lock_expired) VALUES (?, ?, ?, ? , ?)", Statement.RETURN_GENERATED_KEYS)) {
|
||||||
|
statement.setString(1, campaign.getName());
|
||||||
|
statement.setString(2, campaign.getImage());
|
||||||
|
statement.setInt(3, campaign.getStartTimestamp());
|
||||||
|
statement.setInt(4, campaign.getTotalDays());
|
||||||
|
statement.setBoolean(5, campaign.getLockExpired());
|
||||||
|
int affectedRows = statement.executeUpdate();
|
||||||
|
|
||||||
|
if (affectedRows == 0) {
|
||||||
|
throw new SQLException("Creating calendar campaign failed, no rows affected.");
|
||||||
|
}
|
||||||
|
|
||||||
|
try (ResultSet generatedKeys = statement.getGeneratedKeys()) {
|
||||||
|
if (generatedKeys.next()) {
|
||||||
|
campaign.setId(generatedKeys.getInt(1));
|
||||||
|
} else {
|
||||||
|
throw new SQLException("Creating calendar campaign failed, no ID found.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (SQLException e) {
|
||||||
|
LOGGER.error("Caught SQL exception", e);
|
||||||
|
}
|
||||||
|
|
||||||
|
calendarCampaigns.put(campaign.getId(), campaign);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean deleteCampaign(CalendarCampaign campaign) {
|
||||||
|
calendarCampaigns.remove(campaign.getId());
|
||||||
|
|
||||||
|
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("DELETE FROM calendar_campaigns WHERE id = ? LIMIT 1")) {
|
||||||
|
statement.setInt(1, campaign.getId());
|
||||||
|
return statement.execute();
|
||||||
|
} catch (SQLException e) {
|
||||||
|
LOGGER.error("Caught SQL exception", e);
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CalendarCampaign getCalendarCampaign(String campaignName) {
|
||||||
|
return calendarCampaigns.values().stream().filter(cc -> Objects.equals(cc.getName(), campaignName)).findFirst().orElse(null);
|
||||||
|
}
|
||||||
|
public Map<Integer, CalendarCampaign> getCalendarCampaigns() {
|
||||||
|
return calendarCampaigns;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void claimCalendarReward(Habbo habbo, String campaignName, int day, boolean force) {
|
||||||
|
CalendarCampaign campaign = calendarCampaigns.values().stream().filter(cc -> Objects.equals(cc.getName(), campaignName)).findFirst().orElse(null);
|
||||||
|
if(campaign == null) return;
|
||||||
|
if (habbo.getHabboStats().calendarRewardsClaimed.stream().noneMatch(claimed -> claimed.getCampaignId() == campaign.getId() && claimed.getDay() == day)) {
|
||||||
|
|
||||||
|
Set<Integer> keys = campaign.getRewards().keySet();
|
||||||
|
Map<Integer, Integer> rewards = new THashMap<>();
|
||||||
|
if(keys.isEmpty()) return;
|
||||||
|
keys.forEach(key -> rewards.put(rewards.size() + 1, key));
|
||||||
|
int rand = Emulator.getRandom().nextInt(rewards.size() - 1 + 1) + 1;
|
||||||
|
int random = rewards.get(rand);
|
||||||
|
CalendarRewardObject object = campaign.getRewards().get(random);
|
||||||
|
if (object == null) return;
|
||||||
|
int daysBetween = (int) DAYS.between(new Timestamp(campaign.getStartTimestamp() * 1000L).toInstant(), new Date().toInstant());
|
||||||
|
if(daysBetween >= 0 && daysBetween <= campaign.getTotalDays()) {
|
||||||
|
int diff = (daysBetween - day);
|
||||||
|
if ((((diff <= 2 || !campaign.getLockExpired()) && diff >= 0) || (force && habbo.hasPermission("acc_calendar_force")))) {
|
||||||
|
|
||||||
|
if (Emulator.getPluginManager().fireEvent(new UserClaimRewardEvent(habbo, campaign, day, object, force)).isCancelled()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
habbo.getHabboStats().calendarRewardsClaimed.add(new CalendarRewardClaimed(habbo.getHabboInfo().getId(), campaign.getId(), day, object.getId(), new Timestamp(System.currentTimeMillis())));
|
||||||
|
habbo.getClient().sendResponse(new AdventCalendarProductComposer(true, object, habbo));
|
||||||
|
object.give(habbo);
|
||||||
|
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("INSERT INTO calendar_rewards_claimed (user_id, campaign_id, day, reward_id, timestamp) VALUES (?, ?, ?, ?, ?)")) {
|
||||||
|
statement.setInt(1, habbo.getHabboInfo().getId());
|
||||||
|
statement.setInt(2, campaign.getId());
|
||||||
|
statement.setInt(3, day);
|
||||||
|
statement.setInt(4, object.getId());
|
||||||
|
statement.setInt(5, Emulator.getIntUnixTimestamp());
|
||||||
|
statement.execute();
|
||||||
|
} catch (SQLException e) {
|
||||||
|
LOGGER.error("Caught SQL exception", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,50 @@
|
|||||||
|
package com.eu.habbo.habbohotel.campaign.calendar;
|
||||||
|
|
||||||
|
import java.sql.ResultSet;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
import java.sql.Timestamp;
|
||||||
|
|
||||||
|
public class CalendarRewardClaimed {
|
||||||
|
private final int user_id;
|
||||||
|
private final int campaign;
|
||||||
|
private final int day;
|
||||||
|
private final int reward_id;
|
||||||
|
private final Timestamp timestamp;
|
||||||
|
|
||||||
|
public CalendarRewardClaimed(ResultSet set) throws SQLException {
|
||||||
|
this.user_id = set.getInt("user_id");
|
||||||
|
this.campaign = set.getInt("campaign_id");
|
||||||
|
this.day = set.getInt("day");
|
||||||
|
this.reward_id = set.getInt("reward_id");
|
||||||
|
this.timestamp = new Timestamp(set.getInt("timestamp") * 1000L);
|
||||||
|
}
|
||||||
|
|
||||||
|
public CalendarRewardClaimed(int user_id, int campaign, int day, int reward_id, Timestamp timestamp) {
|
||||||
|
this.user_id = user_id;
|
||||||
|
this.campaign = campaign;
|
||||||
|
this.day = day;
|
||||||
|
this.reward_id = reward_id;
|
||||||
|
this.timestamp = timestamp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getUserId() {
|
||||||
|
return this.user_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCampaignId() {
|
||||||
|
return this.campaign;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getDay() {
|
||||||
|
return this.day;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getRewardId() {
|
||||||
|
return this.reward_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Timestamp getTimestamp() {
|
||||||
|
return this.timestamp;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,32 +1,47 @@
|
|||||||
package com.eu.habbo.habbohotel.catalog;
|
package com.eu.habbo.habbohotel.campaign.calendar;
|
||||||
|
|
||||||
import com.eu.habbo.Emulator;
|
import com.eu.habbo.Emulator;
|
||||||
import com.eu.habbo.habbohotel.items.Item;
|
import com.eu.habbo.habbohotel.items.Item;
|
||||||
|
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
|
||||||
import com.eu.habbo.habbohotel.users.Habbo;
|
import com.eu.habbo.habbohotel.users.Habbo;
|
||||||
import com.eu.habbo.habbohotel.users.HabboItem;
|
import com.eu.habbo.habbohotel.users.HabboItem;
|
||||||
|
import com.eu.habbo.habbohotel.users.subscriptions.Subscription;
|
||||||
|
import com.eu.habbo.habbohotel.users.subscriptions.SubscriptionHabboClub;
|
||||||
import com.eu.habbo.messages.outgoing.inventory.AddHabboItemComposer;
|
import com.eu.habbo.messages.outgoing.inventory.AddHabboItemComposer;
|
||||||
import com.eu.habbo.messages.outgoing.inventory.InventoryRefreshComposer;
|
import com.eu.habbo.messages.outgoing.inventory.InventoryRefreshComposer;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
|
||||||
public class CalendarRewardObject {
|
public class CalendarRewardObject {
|
||||||
|
private static final Logger LOGGER = LoggerFactory.getLogger(CalendarRewardObject.class);
|
||||||
|
|
||||||
private final int id;
|
private final int id;
|
||||||
|
private final String productName;
|
||||||
private final String customImage;
|
private final String customImage;
|
||||||
private final int credits;
|
private final int credits;
|
||||||
|
private final int pixels;
|
||||||
private final int points;
|
private final int points;
|
||||||
private final int pointsType;
|
private final int pointsType;
|
||||||
private final String badge;
|
private final String badge;
|
||||||
private final int itemId;
|
private final int itemId;
|
||||||
|
private final String subscription_type;
|
||||||
|
private final int subscription_days;
|
||||||
|
|
||||||
public CalendarRewardObject(ResultSet set) throws SQLException {
|
public CalendarRewardObject(ResultSet set) throws SQLException {
|
||||||
this.id = set.getInt("id");
|
this.id = set.getInt("id");
|
||||||
|
this.productName = set.getString("product_name");
|
||||||
this.customImage = set.getString("custom_image");
|
this.customImage = set.getString("custom_image");
|
||||||
this.credits = set.getInt("credits");
|
this.credits = set.getInt("credits");
|
||||||
|
this.pixels = set.getInt("pixels");
|
||||||
this.points = set.getInt("points");
|
this.points = set.getInt("points");
|
||||||
this.pointsType = set.getInt("points_type");
|
this.pointsType = set.getInt("points_type");
|
||||||
this.badge = set.getString("badge");
|
this.badge = set.getString("badge");
|
||||||
this.itemId = set.getInt("item_id");
|
this.itemId = set.getInt("item_id");
|
||||||
|
this.subscription_type = set.getString("subscription_type");
|
||||||
|
this.subscription_days = set.getInt("subscription_days");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void give(Habbo habbo) {
|
public void give(Habbo habbo) {
|
||||||
@ -34,6 +49,10 @@ public class CalendarRewardObject {
|
|||||||
habbo.giveCredits(this.credits);
|
habbo.giveCredits(this.credits);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.pixels > 0) {
|
||||||
|
habbo.givePixels((int)(this.pixels * (habbo.getHabboStats().hasActiveClub() ? CalendarManager.HC_MODIFIER : 1.0)));
|
||||||
|
}
|
||||||
|
|
||||||
if (this.points > 0) {
|
if (this.points > 0) {
|
||||||
habbo.givePoints(this.pointsType, this.points);
|
habbo.givePoints(this.pointsType, this.points);
|
||||||
}
|
}
|
||||||
@ -42,6 +61,14 @@ public class CalendarRewardObject {
|
|||||||
habbo.addBadge(this.badge);
|
habbo.addBadge(this.badge);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(this.subscription_type != null && !this.subscription_type.isEmpty()) {
|
||||||
|
if ("HABBO_CLUB".equals(this.subscription_type)) {
|
||||||
|
habbo.getHabboStats().createSubscription(SubscriptionHabboClub.HABBO_CLUB, this.subscription_days * 86400);
|
||||||
|
} else {
|
||||||
|
habbo.getHabboStats().createSubscription(this.subscription_type, this.subscription_days * 86400);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (this.itemId > 0) {
|
if (this.itemId > 0) {
|
||||||
Item item = getItem();
|
Item item = getItem();
|
||||||
|
|
||||||
@ -71,6 +98,9 @@ public class CalendarRewardObject {
|
|||||||
return this.credits;
|
return this.credits;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getPixels() {
|
||||||
|
return this.pixels;
|
||||||
|
}
|
||||||
public int getPoints() {
|
public int getPoints() {
|
||||||
return this.points;
|
return this.points;
|
||||||
}
|
}
|
||||||
@ -79,6 +109,18 @@ public class CalendarRewardObject {
|
|||||||
return this.pointsType;
|
return this.pointsType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getProductName() {
|
||||||
|
return productName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSubscriptionType() {
|
||||||
|
return subscription_type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getSubscriptionDays() {
|
||||||
|
return subscription_days;
|
||||||
|
}
|
||||||
|
|
||||||
public String getBadge() {
|
public String getBadge() {
|
||||||
return this.badge;
|
return this.badge;
|
||||||
}
|
}
|
||||||
@ -86,4 +128,5 @@ public class CalendarRewardObject {
|
|||||||
public Item getItem() {
|
public Item getItem() {
|
||||||
return Emulator.getGameEnvironment().getItemManager().getItem(this.itemId);
|
return Emulator.getGameEnvironment().getItemManager().getItem(this.itemId);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.catalog;
|
|||||||
import com.eu.habbo.Emulator;
|
import com.eu.habbo.Emulator;
|
||||||
import com.eu.habbo.habbohotel.achievements.AchievementManager;
|
import com.eu.habbo.habbohotel.achievements.AchievementManager;
|
||||||
import com.eu.habbo.habbohotel.bots.Bot;
|
import com.eu.habbo.habbohotel.bots.Bot;
|
||||||
|
import com.eu.habbo.habbohotel.campaign.calendar.CalendarRewardObject;
|
||||||
import com.eu.habbo.habbohotel.catalog.layouts.*;
|
import com.eu.habbo.habbohotel.catalog.layouts.*;
|
||||||
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
||||||
import com.eu.habbo.habbohotel.guilds.Guild;
|
import com.eu.habbo.habbohotel.guilds.Guild;
|
||||||
@ -167,6 +168,15 @@ public class CatalogManager {
|
|||||||
case builders_club_loyalty:
|
case builders_club_loyalty:
|
||||||
this.put(layout.name().toLowerCase(), BuildersClubLoyaltyLayout.class);
|
this.put(layout.name().toLowerCase(), BuildersClubLoyaltyLayout.class);
|
||||||
break;
|
break;
|
||||||
|
case monkey:
|
||||||
|
this.put(layout.name().toLowerCase(), InfoMonkeyLayout.class);
|
||||||
|
break;
|
||||||
|
case niko:
|
||||||
|
this.put(layout.name().toLowerCase(), InfoNikoLayout.class);
|
||||||
|
break;
|
||||||
|
case mad_money:
|
||||||
|
this.put(layout.name().toLowerCase(), MadMoneyLayout.class);
|
||||||
|
break;
|
||||||
case default_3x3:
|
case default_3x3:
|
||||||
default:
|
default:
|
||||||
this.put("default_3x3", Default_3x3Layout.class);
|
this.put("default_3x3", Default_3x3Layout.class);
|
||||||
@ -190,7 +200,6 @@ public class CatalogManager {
|
|||||||
public final TIntIntHashMap offerDefs;
|
public final TIntIntHashMap offerDefs;
|
||||||
public final Item ecotronItem;
|
public final Item ecotronItem;
|
||||||
public final THashMap<Integer, CatalogLimitedConfiguration> limitedNumbers;
|
public final THashMap<Integer, CatalogLimitedConfiguration> limitedNumbers;
|
||||||
public final THashMap<Integer, CalendarRewardObject> calendarRewards;
|
|
||||||
private final List<Voucher> vouchers;
|
private final List<Voucher> vouchers;
|
||||||
|
|
||||||
public CatalogManager() {
|
public CatalogManager() {
|
||||||
@ -207,7 +216,6 @@ public class CatalogManager {
|
|||||||
this.offerDefs = new TIntIntHashMap();
|
this.offerDefs = new TIntIntHashMap();
|
||||||
this.vouchers = new ArrayList<>();
|
this.vouchers = new ArrayList<>();
|
||||||
this.limitedNumbers = new THashMap<>();
|
this.limitedNumbers = new THashMap<>();
|
||||||
this.calendarRewards = new THashMap<>();
|
|
||||||
|
|
||||||
this.initialize();
|
this.initialize();
|
||||||
|
|
||||||
@ -230,7 +238,6 @@ public class CatalogManager {
|
|||||||
this.loadClothing();
|
this.loadClothing();
|
||||||
this.loadRecycler();
|
this.loadRecycler();
|
||||||
this.loadGiftWrappers();
|
this.loadGiftWrappers();
|
||||||
this.loadCalendarRewards();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private synchronized void loadLimitedNumbers() {
|
private synchronized void loadLimitedNumbers() {
|
||||||
@ -482,23 +489,6 @@ public class CatalogManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadCalendarRewards() {
|
|
||||||
synchronized (this.calendarRewards) {
|
|
||||||
this.calendarRewards.clear();
|
|
||||||
|
|
||||||
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("SELECT * FROM calendar_rewards")) {
|
|
||||||
try (ResultSet set = statement.executeQuery()) {
|
|
||||||
while (set.next()) {
|
|
||||||
this.calendarRewards.put(set.getInt("id"), new CalendarRewardObject(set));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (SQLException e) {
|
|
||||||
LOGGER.error("Caught SQL exception", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private void loadClothing() {
|
private void loadClothing() {
|
||||||
synchronized (this.clothing) {
|
synchronized (this.clothing) {
|
||||||
this.clothing.clear();
|
this.clothing.clear();
|
||||||
@ -523,7 +513,6 @@ public class CatalogManager {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public Voucher getVoucher(String code) {
|
public Voucher getVoucher(String code) {
|
||||||
synchronized (this.vouchers) {
|
synchronized (this.vouchers) {
|
||||||
for (Voucher voucher : this.vouchers) {
|
for (Voucher voucher : this.vouchers) {
|
||||||
@ -535,22 +524,20 @@ public class CatalogManager {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void redeemVoucher(GameClient client, String voucherCode) {
|
public void redeemVoucher(GameClient client, String voucherCode) {
|
||||||
Voucher voucher = Emulator.getGameEnvironment().getCatalogManager().getVoucher(voucherCode);
|
Habbo habbo = client.getHabbo();
|
||||||
|
if (habbo == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
Voucher voucher = Emulator.getGameEnvironment().getCatalogManager().getVoucher(voucherCode);
|
||||||
if (voucher == null) {
|
if (voucher == null) {
|
||||||
client.sendResponse(new RedeemVoucherErrorComposer(RedeemVoucherErrorComposer.INVALID_CODE));
|
client.sendResponse(new RedeemVoucherErrorComposer(RedeemVoucherErrorComposer.INVALID_CODE));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Habbo habbo = client.getHabbo();
|
|
||||||
if (habbo == null) return;
|
|
||||||
|
|
||||||
if (voucher.isExhausted()) {
|
if (voucher.isExhausted()) {
|
||||||
if (!Emulator.getGameEnvironment().getCatalogManager().deleteVoucher(voucher)) {
|
client.sendResponse(new RedeemVoucherErrorComposer(Emulator.getGameEnvironment().getCatalogManager().deleteVoucher(voucher) ? RedeemVoucherErrorComposer.INVALID_CODE : RedeemVoucherErrorComposer.TECHNICAL_ERROR));
|
||||||
client.sendResponse(new RedeemVoucherErrorComposer(RedeemVoucherErrorComposer.TECHNICAL_ERROR));
|
return;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (voucher.hasUserExhausted(habbo.getHabboInfo().getId())) {
|
if (voucher.hasUserExhausted(habbo.getHabboInfo().getId())) {
|
||||||
@ -560,12 +547,6 @@ public class CatalogManager {
|
|||||||
|
|
||||||
voucher.addHistoryEntry(habbo.getHabboInfo().getId());
|
voucher.addHistoryEntry(habbo.getHabboInfo().getId());
|
||||||
|
|
||||||
if (voucher.isExhausted()) {
|
|
||||||
if (!Emulator.getGameEnvironment().getCatalogManager().deleteVoucher(voucher)) {
|
|
||||||
client.sendResponse(new RedeemVoucherErrorComposer(RedeemVoucherErrorComposer.TECHNICAL_ERROR));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (voucher.points > 0) {
|
if (voucher.points > 0) {
|
||||||
client.getHabbo().getHabboInfo().addCurrencyAmount(voucher.pointsType, voucher.points);
|
client.getHabbo().getHabboInfo().addCurrencyAmount(voucher.pointsType, voucher.points);
|
||||||
client.sendResponse(new UserPointsComposer(client.getHabbo().getHabboInfo().getCurrencyAmount(voucher.pointsType), voucher.points, voucher.pointsType));
|
client.sendResponse(new UserPointsComposer(client.getHabbo().getHabboInfo().getCurrencyAmount(voucher.pointsType), voucher.points, voucher.pointsType));
|
||||||
@ -578,7 +559,6 @@ public class CatalogManager {
|
|||||||
|
|
||||||
if (voucher.catalogItemId > 0) {
|
if (voucher.catalogItemId > 0) {
|
||||||
CatalogItem item = this.getCatalogItem(voucher.catalogItemId);
|
CatalogItem item = this.getCatalogItem(voucher.catalogItemId);
|
||||||
|
|
||||||
if (item != null) {
|
if (item != null) {
|
||||||
this.purchaseItem(null, item, client.getHabbo(), 1, "", true);
|
this.purchaseItem(null, item, client.getHabbo(), 1, "", true);
|
||||||
}
|
}
|
||||||
@ -587,7 +567,6 @@ public class CatalogManager {
|
|||||||
client.sendResponse(new RedeemVoucherOKComposer());
|
client.sendResponse(new RedeemVoucherOKComposer());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public boolean deleteVoucher(Voucher voucher) {
|
public boolean deleteVoucher(Voucher voucher) {
|
||||||
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("DELETE FROM vouchers WHERE code = ?")) {
|
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("DELETE FROM vouchers WHERE code = ?")) {
|
||||||
statement.setString(1, voucher.code);
|
statement.setString(1, voucher.code);
|
||||||
@ -1013,6 +992,10 @@ public class CatalogManager {
|
|||||||
extradata = "UMAD";
|
extradata = "UMAD";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (extradata.length() > Emulator.getConfig().getInt("hotel.trophies.length.max", 300)) {
|
||||||
|
extradata = extradata.substring(0, Emulator.getConfig().getInt("hotel.trophies.length.max", 300));
|
||||||
|
}
|
||||||
|
|
||||||
extradata = habbo.getClient().getHabbo().getHabboInfo().getUsername() + (char) 9 + Calendar.getInstance().get(Calendar.DAY_OF_MONTH) + "-" + (Calendar.getInstance().get(Calendar.MONTH) + 1) + "-" + Calendar.getInstance().get(Calendar.YEAR) + (char) 9 + Emulator.getGameEnvironment().getWordFilter().filter(extradata.replace(((char) 9) + "", ""), habbo);
|
extradata = habbo.getClient().getHabbo().getHabboInfo().getUsername() + (char) 9 + Calendar.getInstance().get(Calendar.DAY_OF_MONTH) + "-" + (Calendar.getInstance().get(Calendar.MONTH) + 1) + "-" + Calendar.getInstance().get(Calendar.YEAR) + (char) 9 + Emulator.getGameEnvironment().getWordFilter().filter(extradata.replace(((char) 9) + "", ""), habbo);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1079,13 +1062,10 @@ public class CatalogManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (badgeFound) {
|
if (badgeFound && item.getBaseItems().size() == 1) {
|
||||||
habbo.getClient().sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.ALREADY_HAVE_BADGE));
|
habbo.getClient().sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.ALREADY_HAVE_BADGE));
|
||||||
|
|
||||||
if (item.getBaseItems().size() == 1) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
UserCatalogItemPurchasedEvent purchasedEvent = new UserCatalogItemPurchasedEvent(habbo, item, itemsList, totalCredits, totalPoints, badges);
|
UserCatalogItemPurchasedEvent purchasedEvent = new UserCatalogItemPurchasedEvent(habbo, item, itemsList, totalCredits, totalPoints, badges);
|
||||||
Emulator.getPluginManager().fireEvent(purchasedEvent);
|
Emulator.getPluginManager().fireEvent(purchasedEvent);
|
||||||
@ -1181,28 +1161,6 @@ public class CatalogManager {
|
|||||||
return offers;
|
return offers;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void claimCalendarReward(Habbo habbo, int day, boolean force) {
|
|
||||||
if (!habbo.getHabboStats().calendarRewardsClaimed.contains(day)) {
|
|
||||||
CalendarRewardObject object = this.calendarRewards.get((day+1));
|
|
||||||
int actualDay = (int) Math.floor((Emulator.getIntUnixTimestamp() - Emulator.getConfig().getInt("hotel.calendar.starttimestamp")) / 86400);
|
|
||||||
int diff = (actualDay - day);
|
|
||||||
if (((diff <= 2 && diff >= 0) || force) && object != null) {
|
|
||||||
habbo.getHabboStats().calendarRewardsClaimed.add(day);
|
|
||||||
habbo.getClient().sendResponse(new AdventCalendarProductComposer(true, object));
|
|
||||||
object.give(habbo);
|
|
||||||
|
|
||||||
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("INSERT INTO calendar_rewards_claimed (user_id, reward_id, timestamp) VALUES (?, ?, ?)")) {
|
|
||||||
statement.setInt(1, habbo.getHabboInfo().getId());
|
|
||||||
statement.setInt(2, day);
|
|
||||||
statement.setInt(3, Emulator.getIntUnixTimestamp());
|
|
||||||
statement.execute();
|
|
||||||
} catch (SQLException e) {
|
|
||||||
LOGGER.error("Caught SQL exception", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public TargetOffer getTargetOffer(int offerId) {
|
public TargetOffer getTargetOffer(int offerId) {
|
||||||
return this.targetOffers.get(offerId);
|
return this.targetOffers.get(offerId);
|
||||||
}
|
}
|
||||||
|
@ -3,114 +3,45 @@ package com.eu.habbo.habbohotel.catalog;
|
|||||||
public enum CatalogPageLayouts {
|
public enum CatalogPageLayouts {
|
||||||
|
|
||||||
default_3x3,
|
default_3x3,
|
||||||
|
|
||||||
|
|
||||||
guild_furni,
|
guild_furni,
|
||||||
|
|
||||||
|
|
||||||
guilds,
|
guilds,
|
||||||
|
|
||||||
|
|
||||||
guild_forum,
|
guild_forum,
|
||||||
|
|
||||||
|
|
||||||
info_duckets,
|
info_duckets,
|
||||||
|
|
||||||
|
|
||||||
info_rentables,
|
info_rentables,
|
||||||
|
|
||||||
|
|
||||||
info_loyalty,
|
info_loyalty,
|
||||||
|
|
||||||
|
|
||||||
loyalty_vip_buy,
|
loyalty_vip_buy,
|
||||||
|
|
||||||
|
|
||||||
bots,
|
bots,
|
||||||
|
|
||||||
|
|
||||||
pets,
|
pets,
|
||||||
|
|
||||||
|
|
||||||
pets2,
|
pets2,
|
||||||
|
|
||||||
|
|
||||||
pets3,
|
pets3,
|
||||||
|
|
||||||
|
|
||||||
club_gift,
|
club_gift,
|
||||||
|
|
||||||
|
|
||||||
frontpage,
|
frontpage,
|
||||||
|
|
||||||
|
|
||||||
badge_display,
|
badge_display,
|
||||||
|
|
||||||
|
|
||||||
spaces_new,
|
spaces_new,
|
||||||
|
|
||||||
|
|
||||||
soundmachine,
|
soundmachine,
|
||||||
|
|
||||||
|
|
||||||
info_pets,
|
info_pets,
|
||||||
|
|
||||||
|
|
||||||
club_buy,
|
club_buy,
|
||||||
|
|
||||||
|
|
||||||
roomads,
|
roomads,
|
||||||
|
|
||||||
|
|
||||||
trophies,
|
trophies,
|
||||||
|
|
||||||
|
|
||||||
single_bundle,
|
single_bundle,
|
||||||
|
|
||||||
|
|
||||||
marketplace,
|
marketplace,
|
||||||
|
|
||||||
|
|
||||||
marketplace_own_items,
|
marketplace_own_items,
|
||||||
|
|
||||||
|
|
||||||
recycler,
|
recycler,
|
||||||
|
|
||||||
|
|
||||||
recycler_info,
|
recycler_info,
|
||||||
|
|
||||||
|
|
||||||
recycler_prizes,
|
recycler_prizes,
|
||||||
|
|
||||||
|
|
||||||
sold_ltd_items,
|
sold_ltd_items,
|
||||||
|
|
||||||
|
|
||||||
plasto,
|
plasto,
|
||||||
|
|
||||||
|
|
||||||
default_3x3_color_grouping,
|
default_3x3_color_grouping,
|
||||||
|
|
||||||
|
|
||||||
recent_purchases,
|
recent_purchases,
|
||||||
|
|
||||||
|
|
||||||
room_bundle,
|
room_bundle,
|
||||||
|
|
||||||
|
|
||||||
petcustomization,
|
petcustomization,
|
||||||
|
|
||||||
|
|
||||||
root,
|
root,
|
||||||
|
|
||||||
|
|
||||||
vip_buy,
|
vip_buy,
|
||||||
|
|
||||||
frontpage_featured,
|
frontpage_featured,
|
||||||
|
|
||||||
builders_club_addons,
|
builders_club_addons,
|
||||||
|
|
||||||
builders_club_frontpage,
|
builders_club_frontpage,
|
||||||
|
builders_club_loyalty,
|
||||||
builders_club_loyalty
|
monkey,
|
||||||
|
niko,
|
||||||
|
mad_money
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,8 @@ public class Voucher {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void loadHistory() {
|
private void loadHistory() {
|
||||||
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("SELECT * FROM voucher_history")) {
|
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("SELECT * FROM voucher_history WHERE voucher_id = ?")) {
|
||||||
|
statement.setInt(1, this.id);
|
||||||
try (ResultSet set = statement.executeQuery()) {
|
try (ResultSet set = statement.executeQuery()) {
|
||||||
while (set.next()) {
|
while (set.next()) {
|
||||||
this.history.add(new VoucherHistoryEntry(set));
|
this.history.add(new VoucherHistoryEntry(set));
|
||||||
|
@ -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 InfoMonkeyLayout extends CatalogPage {
|
||||||
|
|
||||||
|
public InfoMonkeyLayout(ResultSet set) throws SQLException {
|
||||||
|
super(set);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void serialize(ServerMessage message) {
|
||||||
|
message.appendString("monkey");
|
||||||
|
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());
|
||||||
|
}
|
||||||
|
}
|
@ -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 InfoNikoLayout extends CatalogPage {
|
||||||
|
|
||||||
|
public InfoNikoLayout(ResultSet set) throws SQLException {
|
||||||
|
super(set);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void serialize(ServerMessage message) {
|
||||||
|
message.appendString("monkey");
|
||||||
|
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());
|
||||||
|
}
|
||||||
|
}
|
@ -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 MadMoneyLayout extends CatalogPage {
|
||||||
|
|
||||||
|
public MadMoneyLayout(ResultSet set) throws SQLException {
|
||||||
|
super(set);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void serialize(ServerMessage message) {
|
||||||
|
message.appendString("mad_money");
|
||||||
|
message.appendInt(2);
|
||||||
|
message.appendString(super.getHeaderImage());
|
||||||
|
message.appendString(super.getTeaserImage());
|
||||||
|
message.appendInt(2);
|
||||||
|
message.appendString(super.getTextOne());
|
||||||
|
message.appendString(super.getTextTwo());
|
||||||
|
// message.appendString("MH");
|
||||||
|
message.appendInt(0);
|
||||||
|
}
|
||||||
|
}
|
@ -67,7 +67,7 @@ public class MarketPlace {
|
|||||||
if (offer != null && habbo.getInventory().getMarketplaceItems().contains(offer)) {
|
if (offer != null && habbo.getInventory().getMarketplaceItems().contains(offer)) {
|
||||||
RequestOffersEvent.cachedResults.clear();
|
RequestOffersEvent.cachedResults.clear();
|
||||||
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection()) {
|
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection()) {
|
||||||
try (PreparedStatement ownerCheck = connection.prepareStatement("SELECT user_id FROM marketplace_items WHERE id = ?")) {
|
try (PreparedStatement ownerCheck = connection.prepareStatement("SELECT user_id FROM marketplace_items WHERE id = ?", ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY)) {
|
||||||
ownerCheck.setInt(1, offer.getOfferId());
|
ownerCheck.setInt(1, offer.getOfferId());
|
||||||
try (ResultSet ownerSet = ownerCheck.executeQuery()) {
|
try (ResultSet ownerSet = ownerCheck.executeQuery()) {
|
||||||
ownerSet.last();
|
ownerSet.last();
|
||||||
@ -122,7 +122,7 @@ public class MarketPlace {
|
|||||||
query += " AND CEIL(price + (price / 100)) <= " + maxPrice;
|
query += " AND CEIL(price + (price / 100)) <= " + maxPrice;
|
||||||
}
|
}
|
||||||
if (search.length() > 0) {
|
if (search.length() > 0) {
|
||||||
query += " AND bi.public_name LIKE ? OR ci.catalog_name LIKE ?";
|
query += " AND ( bi.public_name LIKE ? OR ci.catalog_name LIKE ? ) ";
|
||||||
}
|
}
|
||||||
|
|
||||||
query += " GROUP BY base_item_id, ltd_data";
|
query += " GROUP BY base_item_id, ltd_data";
|
||||||
@ -177,7 +177,7 @@ public class MarketPlace {
|
|||||||
|
|
||||||
|
|
||||||
public static void serializeItemInfo(int itemId, ServerMessage message) {
|
public static void serializeItemInfo(int itemId, ServerMessage message) {
|
||||||
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("SELECT avg(marketplace_items.price) as price, COUNT(*) as sold, (datediff(NOW(), DATE(from_unixtime(marketplace_items.timestamp)))) as day FROM marketplace_items INNER JOIN items ON items.id = marketplace_items.item_id INNER JOIN items_base ON items.item_id = items_base.id WHERE items.limited_data = '0:0' AND marketplace_items.state = 2 AND items_base.sprite_id = ? AND DATE(from_unixtime(marketplace_items.timestamp)) >= NOW() - INTERVAL 30 DAY GROUP BY DATE(from_unixtime(marketplace_items.timestamp))")) {
|
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("SELECT avg(marketplace_items.price) as price, COUNT(*) as sold, (datediff(NOW(), DATE(from_unixtime(marketplace_items.timestamp)))) as day FROM marketplace_items INNER JOIN items ON items.id = marketplace_items.item_id INNER JOIN items_base ON items.item_id = items_base.id WHERE items.limited_data = '0:0' AND marketplace_items.state = 2 AND items_base.sprite_id = ? AND DATE(from_unixtime(marketplace_items.timestamp)) >= NOW() - INTERVAL 30 DAY GROUP BY DATE(from_unixtime(marketplace_items.timestamp))", ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY)) {
|
||||||
statement.setInt(1, itemId);
|
statement.setInt(1, itemId);
|
||||||
|
|
||||||
message.appendInt(avarageLastXDays(itemId, 7));
|
message.appendInt(avarageLastXDays(itemId, 7));
|
||||||
@ -206,7 +206,7 @@ public class MarketPlace {
|
|||||||
|
|
||||||
public static int itemsOnSale(int baseItemId) {
|
public static int itemsOnSale(int baseItemId) {
|
||||||
int number = 0;
|
int number = 0;
|
||||||
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("SELECT COUNT(*) as number, AVG(price) as avg FROM marketplace_items INNER JOIN items ON marketplace_items.item_id = items.id INNER JOIN items_base ON items.item_id = items_base.id WHERE state = 1 AND timestamp >= ? AND items_base.sprite_id = ?")) {
|
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("SELECT COUNT(*) as number, AVG(price) as avg FROM marketplace_items INNER JOIN items ON marketplace_items.item_id = items.id INNER JOIN items_base ON items.item_id = items_base.id WHERE state = 1 AND timestamp >= ? AND items_base.sprite_id = ?", ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY)) {
|
||||||
statement.setInt(1, Emulator.getIntUnixTimestamp() - 172800);
|
statement.setInt(1, Emulator.getIntUnixTimestamp() - 172800);
|
||||||
statement.setInt(2, baseItemId);
|
statement.setInt(2, baseItemId);
|
||||||
try (ResultSet set = statement.executeQuery()) {
|
try (ResultSet set = statement.executeQuery()) {
|
||||||
@ -223,7 +223,7 @@ public class MarketPlace {
|
|||||||
|
|
||||||
private static int avarageLastXDays(int baseItemId, int days) {
|
private static int avarageLastXDays(int baseItemId, int days) {
|
||||||
int avg = 0;
|
int avg = 0;
|
||||||
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("SELECT AVG(price) as avg FROM marketplace_items INNER JOIN items ON marketplace_items.item_id = items.id INNER JOIN items_base ON items.item_id = items_base.id WHERE state = 2 AND DATE(from_unixtime(timestamp)) >= NOW() - INTERVAL ? DAY AND items_base.sprite_id = ?")) {
|
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("SELECT AVG(price) as avg FROM marketplace_items INNER JOIN items ON marketplace_items.item_id = items.id INNER JOIN items_base ON items.item_id = items_base.id WHERE state = 2 AND DATE(from_unixtime(timestamp)) >= NOW() - INTERVAL ? DAY AND items_base.sprite_id = ?", ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY)) {
|
||||||
statement.setInt(1, days);
|
statement.setInt(1, days);
|
||||||
statement.setInt(2, baseItemId);
|
statement.setInt(2, baseItemId);
|
||||||
|
|
||||||
@ -246,7 +246,7 @@ public class MarketPlace {
|
|||||||
statement.setInt(1, offerId);
|
statement.setInt(1, offerId);
|
||||||
try (ResultSet set = statement.executeQuery()) {
|
try (ResultSet set = statement.executeQuery()) {
|
||||||
if (set.next()) {
|
if (set.next()) {
|
||||||
try (PreparedStatement itemStatement = connection.prepareStatement("SELECT * FROM items WHERE id = ? LIMIT 1")) {
|
try (PreparedStatement itemStatement = connection.prepareStatement("SELECT * FROM items WHERE id = ? LIMIT 1", ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY)) {
|
||||||
itemStatement.setInt(1, set.getInt("item_id"));
|
itemStatement.setInt(1, set.getInt("item_id"));
|
||||||
try (ResultSet itemSet = itemStatement.executeQuery()) {
|
try (ResultSet itemSet = itemStatement.executeQuery()) {
|
||||||
itemSet.first();
|
itemSet.first();
|
||||||
@ -315,7 +315,7 @@ public class MarketPlace {
|
|||||||
"FROM items_base\n" +
|
"FROM items_base\n" +
|
||||||
"WHERE items_base.id = ? LIMIT 1)\n" +
|
"WHERE items_base.id = ? LIMIT 1)\n" +
|
||||||
"ORDER BY price ASC\n" +
|
"ORDER BY price ASC\n" +
|
||||||
"LIMIT 1")) {
|
"LIMIT 1", ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY)) {
|
||||||
statement.setInt(1, baseItemId);
|
statement.setInt(1, baseItemId);
|
||||||
try (ResultSet countSet = statement.executeQuery()) {
|
try (ResultSet countSet = statement.executeQuery()) {
|
||||||
countSet.last();
|
countSet.last();
|
||||||
|
@ -1,10 +1,17 @@
|
|||||||
package com.eu.habbo.habbohotel.commands;
|
package com.eu.habbo.habbohotel.commands;
|
||||||
|
|
||||||
import com.eu.habbo.Emulator;
|
import com.eu.habbo.Emulator;
|
||||||
|
import com.eu.habbo.habbohotel.campaign.calendar.CalendarCampaign;
|
||||||
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
||||||
import com.eu.habbo.messages.outgoing.events.calendar.AdventCalendarDataComposer;
|
import com.eu.habbo.messages.outgoing.events.calendar.AdventCalendarDataComposer;
|
||||||
import com.eu.habbo.messages.outgoing.habboway.nux.NuxAlertComposer;
|
import com.eu.habbo.messages.outgoing.habboway.nux.NuxAlertComposer;
|
||||||
|
|
||||||
|
import java.sql.Timestamp;
|
||||||
|
import java.time.Duration;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
import static java.time.temporal.ChronoUnit.DAYS;
|
||||||
|
|
||||||
public class CalendarCommand extends Command {
|
public class CalendarCommand extends Command {
|
||||||
public CalendarCommand() {
|
public CalendarCommand() {
|
||||||
super("cmd_calendar", Emulator.getTexts().getValue("commands.keys.cmd_calendar").split(";"));
|
super("cmd_calendar", Emulator.getTexts().getValue("commands.keys.cmd_calendar").split(";"));
|
||||||
@ -13,8 +20,17 @@ public class CalendarCommand extends Command {
|
|||||||
@Override
|
@Override
|
||||||
public boolean handle(GameClient gameClient, String[] params) throws Exception {
|
public boolean handle(GameClient gameClient, String[] params) throws Exception {
|
||||||
if (Emulator.getConfig().getBoolean("hotel.calendar.enabled")) {
|
if (Emulator.getConfig().getBoolean("hotel.calendar.enabled")) {
|
||||||
gameClient.sendResponse(new AdventCalendarDataComposer("xmas11", Emulator.getGameEnvironment().getCatalogManager().calendarRewards.size(), (int) Math.floor((Emulator.getIntUnixTimestamp() - Emulator.getConfig().getInt("hotel.calendar.starttimestamp")) / 86400), gameClient.getHabbo().getHabboStats().calendarRewardsClaimed, true));
|
String campaignName = Emulator.getConfig().getValue("hotel.calendar.default");
|
||||||
gameClient.sendResponse(new NuxAlertComposer("openView/calendar"));
|
|
||||||
|
if(params.length > 1 && gameClient.getHabbo().hasPermission("cmd_calendar_staff")) {
|
||||||
|
campaignName = params[1];
|
||||||
|
}
|
||||||
|
CalendarCampaign campaign = Emulator.getGameEnvironment().getCalendarManager().getCalendarCampaign(campaignName);
|
||||||
|
if(campaign == null) return false;
|
||||||
|
int daysBetween = (int) DAYS.between(new Timestamp(campaign.getStartTimestamp() * 1000L).toInstant(), new Date().toInstant());
|
||||||
|
if(daysBetween >= 0) {
|
||||||
|
gameClient.sendResponse(new AdventCalendarDataComposer(campaign.getName(), campaign.getImage(), campaign.getTotalDays(), daysBetween, gameClient.getHabbo().getHabboStats().calendarRewardsClaimed, campaign.getLockExpired()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -275,6 +275,7 @@ public class CommandHandler {
|
|||||||
addCommand(new UnmuteCommand());
|
addCommand(new UnmuteCommand());
|
||||||
addCommand(new UpdateAchievements());
|
addCommand(new UpdateAchievements());
|
||||||
addCommand(new UpdateBotsCommand());
|
addCommand(new UpdateBotsCommand());
|
||||||
|
addCommand(new UpdateCalendarCommand());
|
||||||
addCommand(new UpdateCatalogCommand());
|
addCommand(new UpdateCatalogCommand());
|
||||||
addCommand(new UpdateConfigCommand());
|
addCommand(new UpdateConfigCommand());
|
||||||
addCommand(new UpdateGuildPartsCommand());
|
addCommand(new UpdateGuildPartsCommand());
|
||||||
|
@ -44,6 +44,7 @@ public class EmptyInventoryCommand extends Command {
|
|||||||
habbo.getClient().sendResponse(new InventoryRefreshComposer());
|
habbo.getClient().sendResponse(new InventoryRefreshComposer());
|
||||||
habbo.getClient().sendResponse(new InventoryItemsComposer(0, 1, gameClient.getHabbo().getInventory().getItemsComponent().getItems()));
|
habbo.getClient().sendResponse(new InventoryItemsComposer(0, 1, gameClient.getHabbo().getInventory().getItemsComponent().getItems()));
|
||||||
|
|
||||||
|
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_empty.cleared").replace("%username%", habbo.getHabboInfo().getUsername()), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_empty.cleared").replace("%username%", habbo.getHabboInfo().getUsername()), RoomChatMessageBubbles.ALERT);
|
||||||
} else {
|
} else {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_empty"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_empty"), RoomChatMessageBubbles.ALERT);
|
||||||
|
@ -51,6 +51,15 @@ public class RedeemCommand extends Command {
|
|||||||
pointsType = Integer.valueOf(item.getBaseItem().getName().split("_")[1]);
|
pointsType = Integer.valueOf(item.getBaseItem().getName().split("_")[1]);
|
||||||
pointsAmount = Integer.valueOf(item.getBaseItem().getName().split("_")[2]);
|
pointsAmount = Integer.valueOf(item.getBaseItem().getName().split("_")[2]);
|
||||||
|
|
||||||
|
points.adjustOrPutValue(pointsType, pointsAmount, pointsAmount);
|
||||||
|
}
|
||||||
|
else if (item.getBaseItem().getName().startsWith("CF_diamond_")) {
|
||||||
|
int pointsType;
|
||||||
|
int pointsAmount;
|
||||||
|
|
||||||
|
pointsType = 5;
|
||||||
|
pointsAmount = Integer.valueOf(item.getBaseItem().getName().split("_")[2]);
|
||||||
|
|
||||||
points.adjustOrPutValue(pointsType, pointsAmount, pointsAmount);
|
points.adjustOrPutValue(pointsType, pointsAmount, pointsAmount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package com.eu.habbo.habbohotel.commands;
|
|||||||
|
|
||||||
import com.eu.habbo.Emulator;
|
import com.eu.habbo.Emulator;
|
||||||
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
||||||
|
import com.eu.habbo.habbohotel.permissions.Permission;
|
||||||
import com.eu.habbo.habbohotel.rooms.Room;
|
import com.eu.habbo.habbohotel.rooms.Room;
|
||||||
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
|
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
|
||||||
import com.eu.habbo.habbohotel.users.Habbo;
|
import com.eu.habbo.habbohotel.users.Habbo;
|
||||||
@ -30,9 +31,11 @@ public class SoftKickCommand extends Command {
|
|||||||
final Room room = gameClient.getHabbo().getHabboInfo().getCurrentRoom();
|
final Room room = gameClient.getHabbo().getHabboInfo().getCurrentRoom();
|
||||||
|
|
||||||
if (room != null) {
|
if (room != null) {
|
||||||
|
if (!(habbo.hasPermission(Permission.ACC_UNKICKABLE) || habbo.hasPermission(Permission.ACC_SUPPORTTOOL) || room.isOwner(habbo))) {
|
||||||
room.kickHabbo(habbo, false);
|
room.kickHabbo(habbo, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,7 @@ public class StalkCommand extends Command {
|
|||||||
//gameClient.sendResponse(new ForwardToRoomComposer(habbo.getHabboInfo().getCurrentRoom().getId()));
|
//gameClient.sendResponse(new ForwardToRoomComposer(habbo.getHabboInfo().getCurrentRoom().getId()));
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_summon.forgot_username"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_stalk.forgot_username"), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,11 +2,10 @@ package com.eu.habbo.habbohotel.commands;
|
|||||||
|
|
||||||
import com.eu.habbo.Emulator;
|
import com.eu.habbo.Emulator;
|
||||||
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
||||||
|
import com.eu.habbo.habbohotel.rooms.Room;
|
||||||
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
|
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
|
||||||
import com.eu.habbo.habbohotel.rooms.RoomTile;
|
|
||||||
import com.eu.habbo.habbohotel.users.Habbo;
|
import com.eu.habbo.habbohotel.users.Habbo;
|
||||||
import com.eu.habbo.messages.outgoing.rooms.ForwardToRoomComposer;
|
import com.eu.habbo.messages.outgoing.rooms.ForwardToRoomComposer;
|
||||||
import com.eu.habbo.messages.outgoing.rooms.HideDoorbellComposer;
|
|
||||||
|
|
||||||
public class SummonCommand extends Command {
|
public class SummonCommand extends Command {
|
||||||
public SummonCommand() {
|
public SummonCommand() {
|
||||||
@ -36,22 +35,21 @@ public class SummonCommand extends Command {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.generic.cmd_summon.summoning").replace("%user%", params[1]), RoomChatMessageBubbles.ALERT);
|
Room room = habbo.getHabboInfo().getCurrentRoom();
|
||||||
|
if (room != null) {
|
||||||
|
Emulator.getGameEnvironment().getRoomManager().logExit(habbo);
|
||||||
|
|
||||||
Emulator.getGameEnvironment().getRoomManager().leaveRoom(habbo, habbo.getHabboInfo().getCurrentRoom());
|
room.removeHabbo(habbo, true);
|
||||||
|
|
||||||
|
habbo.getHabboInfo().setCurrentRoom(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
Emulator.getGameEnvironment().getRoomManager().enterRoom(habbo, gameClient.getHabbo().getHabboInfo().getCurrentRoom().getId(), "", true);
|
||||||
|
|
||||||
habbo.getClient().sendResponse(new ForwardToRoomComposer(gameClient.getHabbo().getHabboInfo().getCurrentRoom().getId()));
|
habbo.getClient().sendResponse(new ForwardToRoomComposer(gameClient.getHabbo().getHabboInfo().getCurrentRoom().getId()));
|
||||||
Emulator.getGameEnvironment().getRoomManager().enterRoom(habbo, gameClient.getHabbo().getHabboInfo().getCurrentRoom().getId(), "", true);
|
|
||||||
habbo.getClient().sendResponse(new HideDoorbellComposer(""));
|
|
||||||
|
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_summon.summoned").replace("%user%", params[1]), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_summon.summoned").replace("%user%", params[1]), RoomChatMessageBubbles.ALERT);
|
||||||
|
|
||||||
RoomTile t = gameClient.getHabbo().getHabboInfo().getCurrentRoom().getLayout().getTileInFront(gameClient.getHabbo().getRoomUnit().getCurrentLocation(), gameClient.getHabbo().getRoomUnit().getBodyRotation().getValue());
|
|
||||||
|
|
||||||
if (t != null && gameClient.getHabbo().getHabboInfo().getCurrentRoom().tileWalkable(t)) {
|
|
||||||
habbo.getRoomUnit().setGoalLocation(t);
|
|
||||||
}
|
|
||||||
|
|
||||||
habbo.alert(Emulator.getTexts().getValue("commands.generic.cmd_summon.been_summoned").replace("%user%", gameClient.getHabbo().getHabboInfo().getUsername()));
|
habbo.alert(Emulator.getTexts().getValue("commands.generic.cmd_summon.been_summoned").replace("%user%", gameClient.getHabbo().getHabboInfo().getUsername()));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -2,6 +2,7 @@ package com.eu.habbo.habbohotel.commands;
|
|||||||
|
|
||||||
import com.eu.habbo.Emulator;
|
import com.eu.habbo.Emulator;
|
||||||
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
||||||
|
import com.eu.habbo.habbohotel.rooms.Room;
|
||||||
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
|
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
|
||||||
import com.eu.habbo.habbohotel.users.Habbo;
|
import com.eu.habbo.habbohotel.users.Habbo;
|
||||||
import com.eu.habbo.messages.outgoing.rooms.ForwardToRoomComposer;
|
import com.eu.habbo.messages.outgoing.rooms.ForwardToRoomComposer;
|
||||||
@ -19,7 +20,7 @@ public class SummonRankCommand extends Command {
|
|||||||
|
|
||||||
if (params.length >= 2) {
|
if (params.length >= 2) {
|
||||||
try {
|
try {
|
||||||
minRank = Integer.valueOf(params[1]);
|
minRank = Integer.parseInt(params[1]);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.generic.cmd_summonrank.error"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.generic.cmd_summonrank.error"), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
@ -33,9 +34,19 @@ public class SummonRankCommand extends Command {
|
|||||||
if (set.getValue().getHabboInfo().getCurrentRoom() == gameClient.getHabbo().getHabboInfo().getCurrentRoom())
|
if (set.getValue().getHabboInfo().getCurrentRoom() == gameClient.getHabbo().getHabboInfo().getCurrentRoom())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
Emulator.getGameEnvironment().getRoomManager().leaveRoom(set.getValue(), set.getValue().getHabboInfo().getCurrentRoom());
|
Room room = set.getValue().getHabboInfo().getCurrentRoom();
|
||||||
set.getValue().getClient().sendResponse(new ForwardToRoomComposer(gameClient.getHabbo().getHabboInfo().getCurrentRoom().getId()));
|
if (room != null) {
|
||||||
|
Emulator.getGameEnvironment().getRoomManager().logExit(set.getValue());
|
||||||
|
|
||||||
|
room.removeHabbo(set.getValue(), true);
|
||||||
|
|
||||||
|
set.getValue().getHabboInfo().setCurrentRoom(null);
|
||||||
|
}
|
||||||
|
|
||||||
Emulator.getGameEnvironment().getRoomManager().enterRoom(set.getValue(), gameClient.getHabbo().getHabboInfo().getCurrentRoom().getId(), "", true);
|
Emulator.getGameEnvironment().getRoomManager().enterRoom(set.getValue(), gameClient.getHabbo().getHabboInfo().getCurrentRoom().getId(), "", true);
|
||||||
|
|
||||||
|
set.getValue().getClient().sendResponse(new ForwardToRoomComposer(gameClient.getHabbo().getHabboInfo().getCurrentRoom().getId()));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,8 @@ import com.eu.habbo.habbohotel.gameclients.GameClient;
|
|||||||
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
|
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
|
||||||
import com.eu.habbo.habbohotel.users.Habbo;
|
import com.eu.habbo.habbohotel.users.Habbo;
|
||||||
import com.eu.habbo.habbohotel.users.HabboBadge;
|
import com.eu.habbo.habbohotel.users.HabboBadge;
|
||||||
|
import com.eu.habbo.habbohotel.users.HabboInfo;
|
||||||
|
import com.eu.habbo.habbohotel.users.HabboManager;
|
||||||
import com.eu.habbo.habbohotel.users.inventory.BadgesComponent;
|
import com.eu.habbo.habbohotel.users.inventory.BadgesComponent;
|
||||||
import com.eu.habbo.messages.outgoing.inventory.InventoryBadgesComposer;
|
import com.eu.habbo.messages.outgoing.inventory.InventoryBadgesComposer;
|
||||||
import com.eu.habbo.messages.outgoing.users.UserBadgesComposer;
|
import com.eu.habbo.messages.outgoing.users.UserBadgesComposer;
|
||||||
@ -44,9 +46,21 @@ public class TakeBadgeCommand extends Command {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int userId = 0;
|
||||||
|
|
||||||
|
if (habbo != null)
|
||||||
|
userId = habbo.getHabboInfo().getId();
|
||||||
|
else {
|
||||||
|
HabboInfo habboInfo = HabboManager.getOfflineHabboInfo(username);
|
||||||
|
if (habboInfo != null)
|
||||||
|
userId = habboInfo.getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (userId > 0) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_take_badge"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_take_badge"), RoomChatMessageBubbles.ALERT);
|
||||||
|
|
||||||
BadgesComponent.deleteBadge(username, badge);
|
BadgesComponent.deleteBadge(userId, badge);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -0,0 +1,21 @@
|
|||||||
|
package com.eu.habbo.habbohotel.commands;
|
||||||
|
|
||||||
|
import com.eu.habbo.Emulator;
|
||||||
|
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
||||||
|
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
|
||||||
|
import com.eu.habbo.messages.outgoing.catalog.*;
|
||||||
|
import com.eu.habbo.messages.outgoing.catalog.marketplace.MarketplaceConfigComposer;
|
||||||
|
|
||||||
|
public class UpdateCalendarCommand extends Command {
|
||||||
|
|
||||||
|
public UpdateCalendarCommand() {
|
||||||
|
super("cmd_update_calendar", Emulator.getTexts().getValue("commands.keys.cmd_update_calendar").split(";"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean handle(GameClient gameClient, String[] params) {
|
||||||
|
Emulator.getGameEnvironment().getCalendarManager().reload();
|
||||||
|
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.success.cmd_update_calendar"), RoomChatMessageBubbles.ALERT);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
@ -203,9 +203,10 @@ public class BattleBanzaiGame extends Game {
|
|||||||
item.setExtradata((6 + winningTeam.teamColor.type) + "");
|
item.setExtradata((6 + winningTeam.teamColor.type) + "");
|
||||||
this.room.updateItemState(item);
|
this.room.updateItemState(item);
|
||||||
}
|
}
|
||||||
|
synchronized (this.lockedTiles) {
|
||||||
Emulator.getThreading().run(new BattleBanzaiTilesFlicker(this.lockedTiles.get(winningTeam.teamColor), winningTeam.teamColor, this.room));
|
Emulator.getThreading().run(new BattleBanzaiTilesFlicker(this.lockedTiles.get(winningTeam.teamColor), winningTeam.teamColor, this.room));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
super.onEnd();
|
super.onEnd();
|
||||||
}
|
}
|
||||||
@ -222,8 +223,10 @@ public class BattleBanzaiGame extends Game {
|
|||||||
this.room.updateItem(tile);
|
this.room.updateItem(tile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
synchronized (this.lockedTiles) {
|
||||||
this.lockedTiles.clear();
|
this.lockedTiles.clear();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private synchronized void resetMap() {
|
private synchronized void resetMap() {
|
||||||
@ -249,6 +252,7 @@ public class BattleBanzaiGame extends Game {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void tileLocked(GameTeamColors teamColor, HabboItem item, Habbo habbo, boolean doNotCheckFill) {
|
public void tileLocked(GameTeamColors teamColor, HabboItem item, Habbo habbo, boolean doNotCheckFill) {
|
||||||
|
synchronized (this.lockedTiles) {
|
||||||
if (item instanceof InteractionBattleBanzaiTile) {
|
if (item instanceof InteractionBattleBanzaiTile) {
|
||||||
if (!this.lockedTiles.containsKey(teamColor)) {
|
if (!this.lockedTiles.containsKey(teamColor)) {
|
||||||
this.lockedTiles.put(teamColor, new THashSet<>());
|
this.lockedTiles.put(teamColor, new THashSet<>());
|
||||||
@ -296,6 +300,7 @@ public class BattleBanzaiGame extends Game {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private List<RoomTile> floodFill(int x, int y, THashSet<HabboItem> lockedTiles, List<RoomTile> stack, GameTeamColors color) {
|
private List<RoomTile> floodFill(int x, int y, THashSet<HabboItem> lockedTiles, List<RoomTile> stack, GameTeamColors color) {
|
||||||
if (this.isOutOfBounds(x, y) || this.isForeignLockedTile(x, y, color)) return null;
|
if (this.isOutOfBounds(x, y) || this.isForeignLockedTile(x, y, color)) return null;
|
||||||
|
@ -3,8 +3,8 @@ package com.eu.habbo.habbohotel.guilds.forums;
|
|||||||
public enum ForumThreadState {
|
public enum ForumThreadState {
|
||||||
OPEN(0),
|
OPEN(0),
|
||||||
CLOSED(1),
|
CLOSED(1),
|
||||||
HIDDEN_BY_ADMIN(10),
|
HIDDEN_BY_STAFF_MEMBER(10),
|
||||||
HIDDEN_BY_STAFF(20);
|
HIDDEN_BY_GUILD_ADMIN(20);
|
||||||
|
|
||||||
private int stateId;
|
private int stateId;
|
||||||
|
|
||||||
|
@ -161,6 +161,7 @@ public class ItemManager {
|
|||||||
this.interactionsList.add(new ItemInteraction("viking_cotie", InteractionVikingCotie.class));
|
this.interactionsList.add(new ItemInteraction("viking_cotie", InteractionVikingCotie.class));
|
||||||
this.interactionsList.add(new ItemInteraction("tile_fxprovider_nfs", InteractionTileEffectProvider.class));
|
this.interactionsList.add(new ItemInteraction("tile_fxprovider_nfs", InteractionTileEffectProvider.class));
|
||||||
this.interactionsList.add(new ItemInteraction("mutearea", InteractionMuteArea.class));
|
this.interactionsList.add(new ItemInteraction("mutearea", InteractionMuteArea.class));
|
||||||
|
this.interactionsList.add(new ItemInteraction("buildarea", InteractionBuildArea.class));
|
||||||
this.interactionsList.add(new ItemInteraction("information_terminal", InteractionInformationTerminal.class));
|
this.interactionsList.add(new ItemInteraction("information_terminal", InteractionInformationTerminal.class));
|
||||||
this.interactionsList.add(new ItemInteraction("external_image", InteractionExternalImage.class));
|
this.interactionsList.add(new ItemInteraction("external_image", InteractionExternalImage.class));
|
||||||
this.interactionsList.add(new ItemInteraction("youtube", InteractionYoutubeTV.class));
|
this.interactionsList.add(new ItemInteraction("youtube", InteractionYoutubeTV.class));
|
||||||
@ -179,6 +180,7 @@ public class ItemManager {
|
|||||||
this.interactionsList.add(new ItemInteraction("handitem_tile", InteractionHanditemTile.class));
|
this.interactionsList.add(new ItemInteraction("handitem_tile", InteractionHanditemTile.class));
|
||||||
this.interactionsList.add(new ItemInteraction("effect_giver", InteractionEffectGiver.class));
|
this.interactionsList.add(new ItemInteraction("effect_giver", InteractionEffectGiver.class));
|
||||||
this.interactionsList.add(new ItemInteraction("effect_vendingmachine", InteractionEffectVendingMachine.class));
|
this.interactionsList.add(new ItemInteraction("effect_vendingmachine", InteractionEffectVendingMachine.class));
|
||||||
|
this.interactionsList.add(new ItemInteraction("effect_vendingmachine_no_sides", InteractionEffectVendingMachineNoSides.class));
|
||||||
this.interactionsList.add(new ItemInteraction("crackable_monster", InteractionMonsterCrackable.class));
|
this.interactionsList.add(new ItemInteraction("crackable_monster", InteractionMonsterCrackable.class));
|
||||||
this.interactionsList.add(new ItemInteraction("snowboard_slope", InteractionSnowboardSlope.class));
|
this.interactionsList.add(new ItemInteraction("snowboard_slope", InteractionSnowboardSlope.class));
|
||||||
this.interactionsList.add(new ItemInteraction("pressureplate_group", InteractionGroupPressurePlate.class));
|
this.interactionsList.add(new ItemInteraction("pressureplate_group", InteractionGroupPressurePlate.class));
|
||||||
|
@ -11,10 +11,12 @@ import org.slf4j.LoggerFactory;
|
|||||||
|
|
||||||
import javax.net.ssl.HttpsURLConnection;
|
import javax.net.ssl.HttpsURLConnection;
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.sql.*;
|
import java.sql.*;
|
||||||
|
import java.time.Duration;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.concurrent.ExecutorService;
|
import java.util.concurrent.ExecutorService;
|
||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
@ -23,7 +25,7 @@ import java.util.concurrent.TimeUnit;
|
|||||||
public class YoutubeManager {
|
public class YoutubeManager {
|
||||||
private static final Logger LOGGER = LoggerFactory.getLogger(YoutubeManager.class);
|
private static final Logger LOGGER = LoggerFactory.getLogger(YoutubeManager.class);
|
||||||
|
|
||||||
public class YoutubeVideo {
|
public static class YoutubeVideo {
|
||||||
private final String id;
|
private final String id;
|
||||||
private final int duration;
|
private final int duration;
|
||||||
|
|
||||||
@ -41,7 +43,7 @@ public class YoutubeManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class YoutubePlaylist {
|
public static class YoutubePlaylist {
|
||||||
private final String id;
|
private final String id;
|
||||||
private final String name;
|
private final String name;
|
||||||
private final String description;
|
private final String description;
|
||||||
@ -71,8 +73,9 @@ public class YoutubeManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private THashMap<Integer, ArrayList<YoutubePlaylist>> playlists = new THashMap<>();
|
private final THashMap<Integer, ArrayList<YoutubePlaylist>> playlists = new THashMap<>();
|
||||||
private THashMap<String, YoutubePlaylist> playlistCache = new THashMap<>();
|
private final THashMap<String, YoutubePlaylist> playlistCache = new THashMap<>();
|
||||||
|
private final String apiKey = Emulator.getConfig().getValue("youtube.apikey");
|
||||||
|
|
||||||
public void load() {
|
public void load() {
|
||||||
this.playlists.clear();
|
this.playlists.clear();
|
||||||
@ -94,11 +97,15 @@ public class YoutubeManager {
|
|||||||
youtubeDataLoaderPool.submit(() -> {
|
youtubeDataLoaderPool.submit(() -> {
|
||||||
ArrayList<YoutubePlaylist> playlists = this.playlists.getOrDefault(itemId, new ArrayList<>());
|
ArrayList<YoutubePlaylist> playlists = this.playlists.getOrDefault(itemId, new ArrayList<>());
|
||||||
|
|
||||||
YoutubePlaylist playlist = this.getPlaylistDataById(playlistId);
|
YoutubePlaylist playlist;
|
||||||
|
|
||||||
|
try {
|
||||||
|
playlist = this.getPlaylistDataById(playlistId);
|
||||||
if (playlist != null) {
|
if (playlist != null) {
|
||||||
playlists.add(playlist);
|
playlists.add(playlist);
|
||||||
} else {
|
}
|
||||||
LOGGER.error("Failed to load YouTube playlist: " + playlistId);
|
} catch (IOException e) {
|
||||||
|
LOGGER.error("Failed to load YouTube playlist {} ERROR: {}", playlistId, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.playlists.put(itemId, playlists);
|
this.playlists.put(itemId, playlists);
|
||||||
@ -120,56 +127,102 @@ public class YoutubeManager {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public YoutubePlaylist getPlaylistDataById(String playlistId) {
|
public YoutubePlaylist getPlaylistDataById(String playlistId) throws IOException {
|
||||||
if (this.playlistCache.containsKey(playlistId)) return this.playlistCache.get(playlistId);
|
if (this.playlistCache.containsKey(playlistId)) return this.playlistCache.get(playlistId);
|
||||||
|
if(apiKey.isEmpty()) return null;
|
||||||
|
|
||||||
try {
|
|
||||||
URL myUrl = new URL("https://www.youtube.com/playlist?list=" + playlistId);
|
|
||||||
|
|
||||||
HttpsURLConnection conn = (HttpsURLConnection) myUrl.openConnection();
|
|
||||||
conn.setRequestProperty("accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3");
|
|
||||||
conn.setRequestProperty("accept-language", "en-GB,en-US;q=0.9,en;q=0.8");
|
|
||||||
conn.setRequestProperty("user-agent", "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3731.0 Safari/537.36");
|
|
||||||
|
|
||||||
InputStream is = conn.getInputStream();
|
|
||||||
InputStreamReader isr = new InputStreamReader(is);
|
|
||||||
YoutubePlaylist playlist;
|
YoutubePlaylist playlist;
|
||||||
try (BufferedReader br = new BufferedReader(isr)) {
|
URL playlistInfo = new URL("https://youtube.googleapis.com/youtube/v3/playlists?part=snippet&id=" + playlistId + "&maxResults=1&key=" + apiKey);
|
||||||
playlist = null;
|
HttpsURLConnection playlistCon = (HttpsURLConnection) playlistInfo.openConnection();
|
||||||
String inputLine;
|
if (playlistCon.getResponseCode() != 200) {
|
||||||
while ((inputLine = br.readLine()) != null) {
|
InputStream errorInputStream = playlistCon.getErrorStream();
|
||||||
if (inputLine.contains("window[\"ytInitialData\"]")) {
|
InputStreamReader playlistISR = new InputStreamReader(errorInputStream);
|
||||||
JsonObject obj = new JsonParser().parse(inputLine.substring(inputLine.indexOf("{")).replace(";", "")).getAsJsonObject();
|
BufferedReader playlistBR = new BufferedReader(playlistISR);
|
||||||
|
JsonObject errorObj = JsonParser.parseReader(playlistBR).getAsJsonObject();
|
||||||
|
String message = errorObj.get("error").getAsJsonObject().get("message").getAsString();
|
||||||
|
LOGGER.error("Failed to load YouTube playlist {} ERROR: {}", playlistId, message);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
InputStream playlistInputStream = playlistCon.getInputStream();
|
||||||
|
InputStreamReader playlistISR = new InputStreamReader(playlistInputStream);
|
||||||
|
BufferedReader playlistBR = new BufferedReader(playlistISR);
|
||||||
|
|
||||||
JsonObject meta = obj.get("microformat").getAsJsonObject().get("microformatDataRenderer").getAsJsonObject();
|
JsonObject playlistData = JsonParser.parseReader(playlistBR).getAsJsonObject();
|
||||||
String name = meta.get("title").getAsString();
|
|
||||||
String description = meta.get("description").getAsString();
|
JsonArray playlists = playlistData.get("items").getAsJsonArray();
|
||||||
|
if (playlists.size() == 0) {
|
||||||
|
LOGGER.error("Playlist {} not found!", playlistId);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
JsonObject playlistItem = playlists.get(0).getAsJsonObject().get("snippet").getAsJsonObject();
|
||||||
|
|
||||||
|
String name = playlistItem.get("title").getAsString();
|
||||||
|
String description = playlistItem.get("description").getAsString();
|
||||||
|
|
||||||
ArrayList < YoutubeVideo > videos = new ArrayList < > ();
|
ArrayList < YoutubeVideo > videos = new ArrayList < > ();
|
||||||
|
String nextPageToken = "";
|
||||||
|
do {
|
||||||
|
ArrayList < String > videoIds = new ArrayList < > ();
|
||||||
|
URL playlistItems;
|
||||||
|
|
||||||
JsonArray rawVideos = obj.get("contents").getAsJsonObject().get("twoColumnBrowseResultsRenderer").getAsJsonObject().get("tabs").getAsJsonArray().get(0).getAsJsonObject().get("tabRenderer").getAsJsonObject().get("content").getAsJsonObject().get("sectionListRenderer").getAsJsonObject().get("contents").getAsJsonArray().get(0).getAsJsonObject().get("itemSectionRenderer").getAsJsonObject().get("contents").getAsJsonArray().get(0).getAsJsonObject().get("playlistVideoListRenderer").getAsJsonObject().get("contents").getAsJsonArray();
|
if (nextPageToken.isEmpty()) {
|
||||||
|
playlistItems = new URL("https://youtube.googleapis.com/youtube/v3/playlistItems?part=snippet%2Cstatus&playlistId=" + playlistId + "&maxResults=50&key=" + apiKey);
|
||||||
for (JsonElement rawVideo : rawVideos) {
|
} else {
|
||||||
JsonObject videoData = rawVideo.getAsJsonObject().get("playlistVideoRenderer").getAsJsonObject();
|
playlistItems = new URL("https://youtube.googleapis.com/youtube/v3/playlistItems?part=snippet%2Cstatus&playlistId=" + playlistId + "&pageToken=" + nextPageToken + "&maxResults=50&key=" + apiKey);
|
||||||
if (!videoData.has("lengthSeconds")) continue; // removed videos
|
|
||||||
videos.add(new YoutubeVideo(videoData.get("videoId").getAsString(), Integer.valueOf(videoData.get("lengthSeconds").getAsString())));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HttpsURLConnection con = (HttpsURLConnection) playlistItems.openConnection();
|
||||||
|
|
||||||
|
InputStream is = con.getInputStream();
|
||||||
|
InputStreamReader isr = new InputStreamReader(is);
|
||||||
|
BufferedReader br = new BufferedReader(isr);
|
||||||
|
JsonObject object = JsonParser.parseReader(br).getAsJsonObject();
|
||||||
|
|
||||||
|
JsonArray rawV = object.get("items").getAsJsonArray();
|
||||||
|
for (JsonElement rawVideo: rawV) {
|
||||||
|
JsonObject videoData = rawVideo.getAsJsonObject().get("snippet").getAsJsonObject();
|
||||||
|
JsonObject videoStatus = rawVideo.getAsJsonObject().get("status").getAsJsonObject();
|
||||||
|
if (!videoStatus.get("privacyStatus").getAsString().equals("public"))
|
||||||
|
continue; // removed videos
|
||||||
|
videoIds.add(videoData.get("resourceId").getAsJsonObject().get("videoId").getAsString());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!videoIds.isEmpty()) {
|
||||||
|
URL VideoItems;
|
||||||
|
|
||||||
|
String commaSeparatedVideos = String.join(",", videoIds);
|
||||||
|
|
||||||
|
VideoItems = new URL("https://youtube.googleapis.com/youtube/v3/videos?part=contentDetails&id=" + commaSeparatedVideos + "&maxResults=50&key=" + apiKey);
|
||||||
|
HttpsURLConnection con1 = (HttpsURLConnection) VideoItems.openConnection();
|
||||||
|
InputStream is1 = con1.getInputStream();
|
||||||
|
InputStreamReader isr1 = new InputStreamReader(is1);
|
||||||
|
BufferedReader br1 = new BufferedReader(isr1);
|
||||||
|
JsonObject object1 = JsonParser.parseReader(br1).getAsJsonObject();
|
||||||
|
JsonArray Vds = object1.get("items").getAsJsonArray();
|
||||||
|
for (JsonElement rawVideo: Vds) {
|
||||||
|
JsonObject contentDetails = rawVideo.getAsJsonObject().get("contentDetails").getAsJsonObject();
|
||||||
|
int duration = (int) Duration.parse(contentDetails.get("duration").getAsString()).getSeconds();
|
||||||
|
if (duration < 1) continue;
|
||||||
|
videos.add(new YoutubeVideo(rawVideo.getAsJsonObject().get("id").getAsString(), duration));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (object.has("nextPageToken")) {
|
||||||
|
nextPageToken = object.get("nextPageToken").getAsString();
|
||||||
|
} else {
|
||||||
|
nextPageToken = null;
|
||||||
|
}
|
||||||
|
} while (nextPageToken != null);
|
||||||
|
|
||||||
|
if (videos.isEmpty()) {
|
||||||
|
LOGGER.warn("Playlist {} has no videos!", playlistId);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
playlist = new YoutubePlaylist(playlistId, name, description, videos);
|
playlist = new YoutubePlaylist(playlistId, name, description, videos);
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
this.playlistCache.put(playlistId, playlist);
|
this.playlistCache.put(playlistId, playlist);
|
||||||
|
|
||||||
return playlist;
|
return playlist;
|
||||||
} catch (java.io.IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<YoutubePlaylist> getPlaylistsForItemId(int itemId) {
|
public ArrayList<YoutubePlaylist> getPlaylistsForItemId(int itemId) {
|
||||||
|
@ -0,0 +1,253 @@
|
|||||||
|
package com.eu.habbo.habbohotel.items.interactions;
|
||||||
|
|
||||||
|
import com.eu.habbo.Emulator;
|
||||||
|
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
||||||
|
import com.eu.habbo.habbohotel.items.Item;
|
||||||
|
import com.eu.habbo.habbohotel.rooms.Room;
|
||||||
|
import com.eu.habbo.habbohotel.rooms.RoomTile;
|
||||||
|
import com.eu.habbo.habbohotel.rooms.RoomTileState;
|
||||||
|
import com.eu.habbo.habbohotel.users.Habbo;
|
||||||
|
import com.eu.habbo.habbohotel.users.HabboInfo;
|
||||||
|
import com.eu.habbo.habbohotel.users.HabboItem;
|
||||||
|
import com.eu.habbo.habbohotel.users.HabboManager;
|
||||||
|
import com.eu.habbo.messages.outgoing.rooms.items.RemoveFloorItemComposer;
|
||||||
|
import com.eu.habbo.messages.outgoing.rooms.items.RoomFloorItemsComposer;
|
||||||
|
import gnu.trove.TCollections;
|
||||||
|
import gnu.trove.map.TIntObjectMap;
|
||||||
|
import gnu.trove.map.hash.THashMap;
|
||||||
|
import gnu.trove.map.hash.TIntObjectHashMap;
|
||||||
|
import gnu.trove.set.hash.THashSet;
|
||||||
|
|
||||||
|
import java.sql.ResultSet;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
public class InteractionBuildArea extends InteractionCustomValues {
|
||||||
|
public static THashMap<String, String> defaultValues = new THashMap<String, String>() {
|
||||||
|
{
|
||||||
|
this.put("tilesLeft", "0");
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
this.put("tilesRight", "0");
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
this.put("tilesFront", "0");
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
this.put("tilesBack", "0");
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
this.put("builders", "");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
private THashSet<RoomTile> tiles;
|
||||||
|
|
||||||
|
public InteractionBuildArea(ResultSet set, Item baseItem) throws SQLException {
|
||||||
|
super(set, baseItem, defaultValues);
|
||||||
|
tiles = new THashSet<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public InteractionBuildArea(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) {
|
||||||
|
super(id, userId, item, extradata, limitedStack, limitedSells, defaultValues);
|
||||||
|
tiles = new THashSet<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPlace(Room room) {
|
||||||
|
super.onPlace(room);
|
||||||
|
this.regenAffectedTiles(room);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPickUp(Room room) {
|
||||||
|
super.onPickUp(room);
|
||||||
|
|
||||||
|
ArrayList<String> builderNames = new ArrayList<>(Arrays.asList(this.values.get("builders").split(";")));
|
||||||
|
THashSet<Integer> canBuild = new THashSet<>();
|
||||||
|
|
||||||
|
for (String builderName : builderNames) {
|
||||||
|
Habbo builder = Emulator.getGameEnvironment().getHabboManager().getHabbo(builderName);
|
||||||
|
HabboInfo builderInfo;
|
||||||
|
if (builder != null) {
|
||||||
|
builderInfo = builder.getHabboInfo();
|
||||||
|
} else {
|
||||||
|
builderInfo = HabboManager.getOfflineHabboInfo(builderName);
|
||||||
|
}
|
||||||
|
if (builderInfo != null) {
|
||||||
|
canBuild.add(builderInfo.getId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!canBuild.isEmpty()) {
|
||||||
|
for (RoomTile tile : this.tiles) {
|
||||||
|
THashSet<HabboItem> tileItems = room.getItemsAt(tile);
|
||||||
|
for (HabboItem tileItem : tileItems) {
|
||||||
|
if (canBuild.contains(tileItem.getUserId()) && tileItem != this) {
|
||||||
|
room.pickUpItem(tileItem, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.tiles.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onMove(Room room, RoomTile oldLocation, RoomTile newLocation) {
|
||||||
|
super.onMove(room, oldLocation, newLocation);
|
||||||
|
|
||||||
|
ArrayList<String> builderNames = new ArrayList<>(Arrays.asList(this.values.get("builders").split(";")));
|
||||||
|
THashSet<Integer> canBuild = new THashSet<>();
|
||||||
|
|
||||||
|
for (String builderName : builderNames) {
|
||||||
|
Habbo builder = Emulator.getGameEnvironment().getHabboManager().getHabbo(builderName);
|
||||||
|
HabboInfo builderInfo;
|
||||||
|
if (builder != null) {
|
||||||
|
builderInfo = builder.getHabboInfo();
|
||||||
|
} else {
|
||||||
|
builderInfo = HabboManager.getOfflineHabboInfo(builderName);
|
||||||
|
}
|
||||||
|
if (builderInfo != null) {
|
||||||
|
canBuild.add(builderInfo.getId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
THashSet<RoomTile> oldTiles = this.tiles;
|
||||||
|
THashSet<RoomTile> newTiles = new THashSet<>();
|
||||||
|
|
||||||
|
int minX = Math.max(0, newLocation.x - Integer.parseInt(this.values.get("tilesBack")));
|
||||||
|
int minY = Math.max(0, newLocation.y - Integer.parseInt(this.values.get("tilesRight")));
|
||||||
|
int maxX = Math.min(room.getLayout().getMapSizeX(), newLocation.x + Integer.parseInt(this.values.get("tilesFront")));
|
||||||
|
int maxY = Math.min(room.getLayout().getMapSizeY(), newLocation.y + Integer.parseInt(this.values.get("tilesLeft")));
|
||||||
|
|
||||||
|
for (int x = minX; x <= maxX; x++) {
|
||||||
|
for (int y = minY; y <= maxY; y++) {
|
||||||
|
RoomTile tile = room.getLayout().getTile((short) x, (short) y);
|
||||||
|
if (tile != null && tile.state != RoomTileState.INVALID)
|
||||||
|
newTiles.add(tile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!canBuild.isEmpty()) {
|
||||||
|
for (RoomTile tile : oldTiles) {
|
||||||
|
THashSet<HabboItem> tileItems = room.getItemsAt(tile);
|
||||||
|
if(newTiles.contains(tile)) continue;
|
||||||
|
for (HabboItem tileItem : tileItems) {
|
||||||
|
if (canBuild.contains(tileItem.getUserId()) && tileItem != this) {
|
||||||
|
room.pickUpItem(tileItem, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.regenAffectedTiles(room);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean inSquare(RoomTile location) {
|
||||||
|
Room room = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId());
|
||||||
|
|
||||||
|
if (room != null && this.tiles.size() == 0) {
|
||||||
|
regenAffectedTiles(room);
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.tiles.contains(location);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void regenAffectedTiles(Room room) {
|
||||||
|
int minX = Math.max(0, this.getX() - Integer.parseInt(this.values.get("tilesBack")));
|
||||||
|
int minY = Math.max(0, this.getY() - Integer.parseInt(this.values.get("tilesRight")));
|
||||||
|
int maxX = Math.min(room.getLayout().getMapSizeX(), this.getX() + Integer.parseInt(this.values.get("tilesFront")));
|
||||||
|
int maxY = Math.min(room.getLayout().getMapSizeY(), this.getY() + Integer.parseInt(this.values.get("tilesLeft")));
|
||||||
|
|
||||||
|
this.tiles.clear();
|
||||||
|
|
||||||
|
for (int x = minX; x <= maxX; x++) {
|
||||||
|
for (int y = minY; y <= maxY; y++) {
|
||||||
|
RoomTile tile = room.getLayout().getTile((short) x, (short) y);
|
||||||
|
if (tile != null && tile.state != RoomTileState.INVALID)
|
||||||
|
this.tiles.add(tile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCustomValuesSaved(Room room, GameClient client, THashMap<String, String> oldValues) {
|
||||||
|
regenAffectedTiles(room);
|
||||||
|
ArrayList<String> builderNames = new ArrayList<>(Arrays.asList(this.values.get("builders").split(";")));
|
||||||
|
THashSet<Integer> canBuild = new THashSet<>();
|
||||||
|
|
||||||
|
for (String builderName : builderNames) {
|
||||||
|
Habbo builder = Emulator.getGameEnvironment().getHabboManager().getHabbo(builderName);
|
||||||
|
HabboInfo builderInfo;
|
||||||
|
if (builder != null) {
|
||||||
|
builderInfo = builder.getHabboInfo();
|
||||||
|
} else {
|
||||||
|
builderInfo = HabboManager.getOfflineHabboInfo(builderName);
|
||||||
|
}
|
||||||
|
if (builderInfo != null) {
|
||||||
|
canBuild.add(builderInfo.getId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
THashSet<RoomTile> oldTiles = new THashSet<>();
|
||||||
|
|
||||||
|
int minX = Math.max(0, this.getX() - Integer.parseInt(oldValues.get("tilesBack")));
|
||||||
|
int minY = Math.max(0, this.getY() - Integer.parseInt(oldValues.get("tilesRight")));
|
||||||
|
int maxX = Math.min(room.getLayout().getMapSizeX(), this.getX() + Integer.parseInt(oldValues.get("tilesFront")));
|
||||||
|
int maxY = Math.min(room.getLayout().getMapSizeY(), this.getY() + Integer.parseInt(oldValues.get("tilesLeft")));
|
||||||
|
|
||||||
|
for (int x = minX; x <= maxX; x++) {
|
||||||
|
for (int y = minY; y <= maxY; y++) {
|
||||||
|
RoomTile tile = room.getLayout().getTile((short) x, (short) y);
|
||||||
|
if (tile != null && tile.state != RoomTileState.INVALID && !this.tiles.contains(tile))
|
||||||
|
oldTiles.add(tile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!canBuild.isEmpty()) {
|
||||||
|
for (RoomTile tile : oldTiles) {
|
||||||
|
THashSet<HabboItem> tileItems = room.getItemsAt(tile);
|
||||||
|
for (HabboItem tileItem : tileItems) {
|
||||||
|
if (canBuild.contains(tileItem.getUserId()) && tileItem != this) {
|
||||||
|
room.pickUpItem(tileItem, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// show the effect
|
||||||
|
Item effectItem = Emulator.getGameEnvironment().getItemManager().getItem("mutearea_sign2");
|
||||||
|
|
||||||
|
if(effectItem != null) {
|
||||||
|
TIntObjectMap<String> ownerNames = TCollections.synchronizedMap(new TIntObjectHashMap<>(0));
|
||||||
|
ownerNames.put(-1, "System");
|
||||||
|
THashSet<HabboItem> items = new THashSet<>();
|
||||||
|
|
||||||
|
int id = 0;
|
||||||
|
for(RoomTile tile : this.tiles) {
|
||||||
|
id--;
|
||||||
|
HabboItem item = new InteractionDefault(id, -1, effectItem, "1", 0, 0);
|
||||||
|
item.setX(tile.x);
|
||||||
|
item.setY(tile.y);
|
||||||
|
item.setZ(tile.relativeHeight());
|
||||||
|
items.add(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
client.sendResponse(new RoomFloorItemsComposer(ownerNames, items));
|
||||||
|
Emulator.getThreading().run(() -> {
|
||||||
|
for(HabboItem item : items) {
|
||||||
|
client.sendResponse(new RemoveFloorItemComposer(item, true));
|
||||||
|
}
|
||||||
|
}, 3000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isBuilder(String Username){
|
||||||
|
return Arrays.asList(this.values.get("builders").split(";")).contains(Username);
|
||||||
|
}
|
||||||
|
}
|
@ -49,7 +49,7 @@ public class InteractionColorWheel extends HabboItem {
|
|||||||
if (!room.hasRights(client.getHabbo()))
|
if (!room.hasRights(client.getHabbo()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (this.rollTaks == null) {
|
if (this.rollTaks == null && !this.getExtradata().equalsIgnoreCase("-1")) {
|
||||||
this.setExtradata("-1");
|
this.setExtradata("-1");
|
||||||
room.sendComposer(new WallItemUpdateComposer(this).compose());
|
room.sendComposer(new WallItemUpdateComposer(this).compose());
|
||||||
Emulator.getThreading().run(this);
|
Emulator.getThreading().run(this);
|
||||||
|
@ -101,6 +101,11 @@ public class InteractionCrackable extends HabboItem {
|
|||||||
if (rewardData.requiredEffect > 0 && habbo.getRoomUnit().getEffectId() != rewardData.requiredEffect)
|
if (rewardData.requiredEffect > 0 && habbo.getRoomUnit().getEffectId() != rewardData.requiredEffect)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if(this.ticks < 1)
|
||||||
|
{
|
||||||
|
// If there are no ticks (for example because the room has been reloaded), check the current extradata of the item and update the ticks.
|
||||||
|
this.ticks = Integer.parseInt(this.getExtradata());
|
||||||
|
}
|
||||||
this.ticks++;
|
this.ticks++;
|
||||||
this.setExtradata("" + (this.ticks));
|
this.setExtradata("" + (this.ticks));
|
||||||
this.needsUpdate(true);
|
this.needsUpdate(true);
|
||||||
|
@ -80,7 +80,7 @@ public abstract class InteractionCustomValues extends HabboItem {
|
|||||||
super.serializeExtradata(serverMessage);
|
super.serializeExtradata(serverMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onCustomValuesSaved(Room room, GameClient client) {
|
public void onCustomValuesSaved(Room room, GameClient client, THashMap<String, String> oldValues) {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,43 @@
|
|||||||
|
package com.eu.habbo.habbohotel.items.interactions;
|
||||||
|
|
||||||
|
import com.eu.habbo.habbohotel.items.Item;
|
||||||
|
import com.eu.habbo.habbohotel.rooms.Room;
|
||||||
|
import com.eu.habbo.habbohotel.rooms.RoomTile;
|
||||||
|
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||||
|
import gnu.trove.set.hash.THashSet;
|
||||||
|
|
||||||
|
import java.sql.ResultSet;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
|
||||||
|
public class InteractionEffectVendingMachineNoSides extends InteractionVendingMachine {
|
||||||
|
public InteractionEffectVendingMachineNoSides(ResultSet set, Item baseItem) throws SQLException {
|
||||||
|
super(set, baseItem);
|
||||||
|
this.setExtradata("0");
|
||||||
|
}
|
||||||
|
|
||||||
|
public InteractionEffectVendingMachineNoSides(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) {
|
||||||
|
super(id, userId, item, extradata, limitedStack, limitedSells);
|
||||||
|
this.setExtradata("0");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void giveVendingMachineItem(Room room, RoomUnit unit) {
|
||||||
|
room.giveEffect(unit, this.getBaseItem().getRandomVendingItem(), 30);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public THashSet<RoomTile> getActivatorTiles(Room room) {
|
||||||
|
|
||||||
|
THashSet<RoomTile> tiles = new THashSet<RoomTile>();
|
||||||
|
for(int x = -1; x <= 1; x++) {
|
||||||
|
for(int y = -1; y <= 1; y++) {
|
||||||
|
RoomTile tile = room.getLayout().getTile((short)(this.getX() + x), (short)(this.getY() + y));
|
||||||
|
if(tile != null) {
|
||||||
|
tiles.add(tile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return tiles;
|
||||||
|
}
|
||||||
|
}
|
@ -17,7 +17,6 @@ import gnu.trove.map.hash.THashMap;
|
|||||||
import gnu.trove.map.hash.TIntObjectHashMap;
|
import gnu.trove.map.hash.TIntObjectHashMap;
|
||||||
import gnu.trove.set.hash.THashSet;
|
import gnu.trove.set.hash.THashSet;
|
||||||
|
|
||||||
import java.awt.*;
|
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
|
||||||
@ -125,8 +124,8 @@ public class InteractionMuteArea extends InteractionCustomValues {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCustomValuesSaved(Room room, GameClient client) {
|
public void onCustomValuesSaved(Room room, GameClient client, THashMap<String, String> oldValues) {
|
||||||
super.onCustomValuesSaved(room, client);
|
super.onCustomValuesSaved(room, client, oldValues);
|
||||||
|
|
||||||
this.regenAffectedTiles(room);
|
this.regenAffectedTiles(room);
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ public class InteractionPressurePlate extends InteractionDefault {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(GameClient client, Room room, Object[] objects) throws Exception {
|
public void onClick(GameClient client, Room room, Object[] objects) throws Exception {
|
||||||
super.onClick(client, room, objects);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -66,6 +66,11 @@ public class InteractionPressurePlate extends InteractionDefault {
|
|||||||
updateState(room);
|
updateState(room);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPickUp(Room room) {
|
||||||
|
this.setExtradata("0");
|
||||||
|
}
|
||||||
|
|
||||||
public void updateState(Room room) {
|
public void updateState(Room room) {
|
||||||
boolean occupied = false;
|
boolean occupied = false;
|
||||||
|
|
||||||
|
@ -22,13 +22,12 @@ public class InteractionTrap extends InteractionDefault {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onWalkOn(RoomUnit roomUnit, Room room, Object[] objects) throws Exception {
|
public void onWalkOn(RoomUnit roomUnit, Room room, Object[] objects) throws Exception {
|
||||||
|
if (!this.getExtradata().equals("0")) {
|
||||||
|
Habbo habbo = room.getHabbo(roomUnit);
|
||||||
|
int effect = habbo.getClient().getHabbo().getRoomUnit().getEffectId();
|
||||||
|
roomUnit.stopWalking();
|
||||||
super.onWalkOn(roomUnit, room, objects);
|
super.onWalkOn(roomUnit, room, objects);
|
||||||
|
|
||||||
if (!this.getExtradata().equals("1"))
|
|
||||||
return;
|
|
||||||
|
|
||||||
int delay = Emulator.getConfig().getInt("hotel.item.trap." + this.getBaseItem().getName());
|
int delay = Emulator.getConfig().getInt("hotel.item.trap." + this.getBaseItem().getName());
|
||||||
|
|
||||||
if (delay == 0) {
|
if (delay == 0) {
|
||||||
Emulator.getConfig().register("hotel.item.trap." + this.getBaseItem().getName(), "3000");
|
Emulator.getConfig().register("hotel.item.trap." + this.getBaseItem().getName(), "3000");
|
||||||
delay = 3000;
|
delay = 3000;
|
||||||
@ -37,7 +36,6 @@ public class InteractionTrap extends InteractionDefault {
|
|||||||
if (roomUnit != null) {
|
if (roomUnit != null) {
|
||||||
if (this.getBaseItem().getEffectF() > 0 || this.getBaseItem().getEffectM() > 0) {
|
if (this.getBaseItem().getEffectF() > 0 || this.getBaseItem().getEffectM() > 0) {
|
||||||
if (roomUnit.getRoomUnitType().equals(RoomUnitType.USER)) {
|
if (roomUnit.getRoomUnitType().equals(RoomUnitType.USER)) {
|
||||||
Habbo habbo = room.getHabbo(roomUnit);
|
|
||||||
|
|
||||||
if (habbo != null) {
|
if (habbo != null) {
|
||||||
if (habbo.getHabboInfo().getGender().equals(HabboGender.M) && this.getBaseItem().getEffectM() > 0 && habbo.getRoomUnit().getEffectId() != this.getBaseItem().getEffectM()) {
|
if (habbo.getHabboInfo().getGender().equals(HabboGender.M) && this.getBaseItem().getEffectM() > 0 && habbo.getRoomUnit().getEffectId() != this.getBaseItem().getEffectM()) {
|
||||||
@ -55,12 +53,14 @@ public class InteractionTrap extends InteractionDefault {
|
|||||||
Emulator.getThreading().run(() -> {
|
Emulator.getThreading().run(() -> {
|
||||||
room.giveEffect(roomUnit, 0, -1);
|
room.giveEffect(roomUnit, 0, -1);
|
||||||
roomUnit.setCanWalk(true);
|
roomUnit.setCanWalk(true);
|
||||||
|
room.giveEffect(roomUnit, effect, -1);
|
||||||
}, delay);
|
}, delay);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onWalkOff(RoomUnit roomUnit, Room room, Object[] objects) throws Exception {
|
public void onWalkOff(RoomUnit roomUnit, Room room, Object[] objects) throws Exception {
|
||||||
|
@ -4,9 +4,9 @@ import com.eu.habbo.Emulator;
|
|||||||
import com.eu.habbo.habbohotel.items.Item;
|
import com.eu.habbo.habbohotel.items.Item;
|
||||||
import com.eu.habbo.habbohotel.rooms.Room;
|
import com.eu.habbo.habbohotel.rooms.Room;
|
||||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||||
import com.eu.habbo.habbohotel.users.HabboItem;
|
|
||||||
import com.eu.habbo.messages.ServerMessage;
|
import com.eu.habbo.messages.ServerMessage;
|
||||||
import com.eu.habbo.messages.outgoing.rooms.items.ItemStateComposer;
|
import com.eu.habbo.messages.outgoing.rooms.items.ItemStateComposer;
|
||||||
|
import gnu.trove.map.hash.TLongLongHashMap;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
@ -18,6 +18,7 @@ import java.sql.SQLException;
|
|||||||
public abstract class InteractionWired extends InteractionDefault {
|
public abstract class InteractionWired extends InteractionDefault {
|
||||||
private static final Logger LOGGER = LoggerFactory.getLogger(InteractionWired.class);
|
private static final Logger LOGGER = LoggerFactory.getLogger(InteractionWired.class);
|
||||||
private long cooldown;
|
private long cooldown;
|
||||||
|
private TLongLongHashMap userExecutionCache = new TLongLongHashMap(3);
|
||||||
|
|
||||||
InteractionWired(ResultSet set, Item baseItem) throws SQLException {
|
InteractionWired(ResultSet set, Item baseItem) throws SQLException {
|
||||||
super(set, baseItem);
|
super(set, baseItem);
|
||||||
@ -69,10 +70,16 @@ public abstract class InteractionWired extends InteractionDefault {
|
|||||||
public abstract void onPickUp();
|
public abstract void onPickUp();
|
||||||
|
|
||||||
public void activateBox(Room room) {
|
public void activateBox(Room room) {
|
||||||
this.setExtradata(this.getExtradata().equals("1") ? "0" : "1");
|
this.activateBox(room, (RoomUnit)null, 0L);
|
||||||
room.sendComposer(new ItemStateComposer(this).compose());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void activateBox(Room room, RoomUnit roomUnit, long millis) {
|
||||||
|
this.setExtradata(this.getExtradata().equals("1") ? "0" : "1");
|
||||||
|
room.sendComposer(new ItemStateComposer(this).compose());
|
||||||
|
if (roomUnit != null) {
|
||||||
|
this.addUserExecutionCache(roomUnit.getId(), millis);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected long requiredCooldown() {
|
protected long requiredCooldown() {
|
||||||
return 50L;
|
return 50L;
|
||||||
@ -96,4 +103,27 @@ public abstract class InteractionWired extends InteractionDefault {
|
|||||||
public boolean isUsable() {
|
public boolean isUsable() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean userCanExecute(int roomUnitId, long timestamp) {
|
||||||
|
if (roomUnitId == -1) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
if (this.userExecutionCache.containsKey((long)roomUnitId)) {
|
||||||
|
long lastTimestamp = this.userExecutionCache.get((long)roomUnitId);
|
||||||
|
if (timestamp - lastTimestamp < 100L) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void clearUserExecutionCache() {
|
||||||
|
this.userExecutionCache.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addUserExecutionCache(int roomUnitId, long timestamp) {
|
||||||
|
this.userExecutionCache.put((long)roomUnitId, timestamp);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -110,9 +110,15 @@ public class InteractionWiredHighscore extends HabboItem {
|
|||||||
serverMessage.appendInt(this.clearType.type);
|
serverMessage.appendInt(this.clearType.type);
|
||||||
|
|
||||||
if (this.data != null) {
|
if (this.data != null) {
|
||||||
serverMessage.appendInt(this.data.size());
|
int size = this.data.size();
|
||||||
|
if(size > 50) {
|
||||||
|
size = 50;
|
||||||
|
}
|
||||||
|
serverMessage.appendInt(size);
|
||||||
|
|
||||||
|
int count = 0;
|
||||||
for (WiredHighscoreRow row : this.data) {
|
for (WiredHighscoreRow row : this.data) {
|
||||||
|
if(count < 50) {
|
||||||
serverMessage.appendInt(row.getValue());
|
serverMessage.appendInt(row.getValue());
|
||||||
|
|
||||||
serverMessage.appendInt(row.getUsers().size());
|
serverMessage.appendInt(row.getUsers().size());
|
||||||
@ -120,6 +126,8 @@ public class InteractionWiredHighscore extends HabboItem {
|
|||||||
serverMessage.appendString(username);
|
serverMessage.appendString(username);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
count++;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
serverMessage.appendInt(0);
|
serverMessage.appendInt(0);
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,7 @@ import com.eu.habbo.habbohotel.users.HabboItem;
|
|||||||
import com.eu.habbo.messages.outgoing.rooms.items.ItemStateComposer;
|
import com.eu.habbo.messages.outgoing.rooms.items.ItemStateComposer;
|
||||||
import com.eu.habbo.util.pathfinding.Rotation;
|
import com.eu.habbo.util.pathfinding.Rotation;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
|
||||||
@ -151,7 +152,44 @@ public class InteractionFootball extends InteractionPushable {
|
|||||||
public boolean validMove(Room room, RoomTile from, RoomTile to) {
|
public boolean validMove(Room room, RoomTile from, RoomTile to) {
|
||||||
if (to == null || to.state == RoomTileState.INVALID) return false;
|
if (to == null || to.state == RoomTileState.INVALID) return false;
|
||||||
HabboItem topItem = room.getTopItemAt(to.x, to.y, this);
|
HabboItem topItem = room.getTopItemAt(to.x, to.y, this);
|
||||||
return (topItem == null || topItem.getBaseItem().allowStack());
|
|
||||||
|
// Move is valid if there isnt any furni yet
|
||||||
|
if (topItem == null) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If any furni on tile is not stackable, move is invalid (tested on 22-03-2022)
|
||||||
|
if (room.getItemsAt(to).stream().anyMatch(x -> !x.getBaseItem().allowStack())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ball can only go up by 1.65 according to Habbo (tested using stack tile on 22-03-2022)
|
||||||
|
BigDecimal topItemHeight = BigDecimal.valueOf(topItem.getZ() + topItem.getBaseItem().getHeight());
|
||||||
|
BigDecimal ballHeight = BigDecimal.valueOf(this.getZ());
|
||||||
|
|
||||||
|
if (topItemHeight.subtract(ballHeight).compareTo(new BigDecimal(1.65)) > 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If top item is a football goal, the move is only valid if ball is coming from the front side
|
||||||
|
// Ball shouldn't come from the back or from the sides (tested on 22-03-2022)
|
||||||
|
if (topItem instanceof InteractionFootballGoal) {
|
||||||
|
int ballDirection = Rotation.Calculate(from.x, from.y, to.x, to.y);
|
||||||
|
int goalRotation = topItem.getRotation();
|
||||||
|
|
||||||
|
switch (goalRotation) {
|
||||||
|
case 0:
|
||||||
|
return ballDirection > 2 && ballDirection < 6;
|
||||||
|
case 2:
|
||||||
|
return ballDirection > 4;
|
||||||
|
case 4:
|
||||||
|
return ballDirection > 6 || ballDirection < 2;
|
||||||
|
case 6:
|
||||||
|
return ballDirection > 0 && ballDirection < 4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return topItem.getBaseItem().allowStack();
|
||||||
}
|
}
|
||||||
|
|
||||||
//Events
|
//Events
|
||||||
|
@ -46,28 +46,8 @@ public class WiredConditionTriggerOnFurni extends InteractionWiredCondition {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected boolean triggerOnFurni(RoomUnit roomUnit, Room room) {
|
protected boolean triggerOnFurni(RoomUnit roomUnit, Room room) {
|
||||||
/*
|
|
||||||
* 1. If a Habbo IS NOT walking we only have to check if the Habbo is on one of the selected tiles.
|
|
||||||
* 2. If a Habbo IS walking we have to check if the next tile in the walking path is one of the selected items
|
|
||||||
* */
|
|
||||||
if (!roomUnit.isWalking()) {
|
|
||||||
THashSet<HabboItem> itemsAtUser = room.getItemsAt(roomUnit.getCurrentLocation());
|
THashSet<HabboItem> itemsAtUser = room.getItemsAt(roomUnit.getCurrentLocation());
|
||||||
return this.items.stream().anyMatch(itemsAtUser::contains);
|
return this.items.stream().anyMatch(itemsAtUser::contains);
|
||||||
} else {
|
|
||||||
RoomTile firstTileInPath = room.getLayout()
|
|
||||||
.findPath(roomUnit.getCurrentLocation(), roomUnit.getGoal(), roomUnit.getGoal(), roomUnit)
|
|
||||||
.peek();
|
|
||||||
|
|
||||||
if (firstTileInPath == null)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return this.items
|
|
||||||
.stream()
|
|
||||||
.anyMatch(conditionItem -> conditionItem
|
|
||||||
.getOccupyingTiles(room.getLayout())
|
|
||||||
.contains(firstTileInPath)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -52,15 +52,19 @@ public class WiredEffectGiveScore extends InteractionWiredEffect {
|
|||||||
if (game == null)
|
if (game == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
TObjectIntIterator<Map.Entry<Integer, Integer>> iterator = this.data.iterator();
|
int gameStartTime = game.getStartTime();
|
||||||
|
|
||||||
for (int i = this.data.size(); i-- > 0; ) {
|
TObjectIntMap<Map.Entry<Integer, Integer>> dataClone = new TObjectIntHashMap<>(this.data);
|
||||||
|
|
||||||
|
TObjectIntIterator<Map.Entry<Integer, Integer>> iterator = dataClone.iterator();
|
||||||
|
|
||||||
|
for (int i = dataClone.size(); i-- > 0; ) {
|
||||||
iterator.advance();
|
iterator.advance();
|
||||||
|
|
||||||
Map.Entry<Integer, Integer> map = iterator.key();
|
Map.Entry<Integer, Integer> map = iterator.key();
|
||||||
|
|
||||||
if (map.getValue() == habbo.getHabboInfo().getId()) {
|
if (map.getValue() == habbo.getHabboInfo().getId()) {
|
||||||
if (map.getKey() == game.getStartTime()) {
|
if (map.getKey() == gameStartTime) {
|
||||||
if (iterator.value() < this.count) {
|
if (iterator.value() < this.count) {
|
||||||
iterator.setValue(iterator.value() + 1);
|
iterator.setValue(iterator.value() + 1);
|
||||||
|
|
||||||
@ -74,7 +78,13 @@ public class WiredEffectGiveScore extends InteractionWiredEffect {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.data.put(new AbstractMap.SimpleEntry<>(game.getStartTime(), habbo.getHabboInfo().getId()), 1);
|
try {
|
||||||
|
this.data.put(new AbstractMap.SimpleEntry<>(gameStartTime, habbo.getHabboInfo().getId()), 1);
|
||||||
|
}
|
||||||
|
catch(IllegalArgumentException e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (habbo.getHabboInfo().getGamePlayer() != null) {
|
if (habbo.getHabboInfo().getGamePlayer() != null) {
|
||||||
habbo.getHabboInfo().getGamePlayer().addScore(this.score, true);
|
habbo.getHabboInfo().getGamePlayer().addScore(this.score, true);
|
||||||
|
@ -65,6 +65,11 @@ public class Messenger {
|
|||||||
return users;
|
return users;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated
|
||||||
|
* This method is no longer used and is only kept to avoid breaking any plugins
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
public static boolean canFriendRequest(Habbo habbo, String friend) {
|
public static boolean canFriendRequest(Habbo habbo, String friend) {
|
||||||
Habbo user = Emulator.getGameEnvironment().getHabboManager().getHabbo(friend);
|
Habbo user = Emulator.getGameEnvironment().getHabboManager().getHabbo(friend);
|
||||||
HabboInfo habboInfo;
|
HabboInfo habboInfo;
|
||||||
@ -297,7 +302,7 @@ public class Messenger {
|
|||||||
buddy.setLook(owner.getHabboInfo().getLook());
|
buddy.setLook(owner.getHabboInfo().getLook());
|
||||||
buddy.setGender(owner.getHabboInfo().getGender());
|
buddy.setGender(owner.getHabboInfo().getGender());
|
||||||
buddy.setUsername(owner.getHabboInfo().getUsername());
|
buddy.setUsername(owner.getHabboInfo().getUsername());
|
||||||
habbo.getClient().sendResponse(new UpdateFriendComposer(buddy));
|
habbo.getClient().sendResponse(new UpdateFriendComposer(habbo, buddy, 0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -363,12 +368,12 @@ public class Messenger {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
habboTo.getClient().sendResponse(new UpdateFriendComposer(to));
|
habboTo.getClient().sendResponse(new UpdateFriendComposer(habboTo, to, 1));
|
||||||
habboFrom.getClient().sendResponse(new UpdateFriendComposer(from));
|
habboFrom.getClient().sendResponse(new UpdateFriendComposer(habboFrom, from, 1));
|
||||||
} else if (habboTo != null) {
|
} else if (habboTo != null) {
|
||||||
habboTo.getClient().sendResponse(new UpdateFriendComposer(this.loadFriend(habboTo, userFrom)));
|
habboTo.getClient().sendResponse(new UpdateFriendComposer(habboTo, this.loadFriend(habboTo, userFrom), 1));
|
||||||
} else if (habboFrom != null) {
|
} else if (habboFrom != null) {
|
||||||
habboFrom.getClient().sendResponse(new UpdateFriendComposer(this.loadFriend(habboFrom, userTo)));
|
habboFrom.getClient().sendResponse(new UpdateFriendComposer(habboFrom, this.loadFriend(habboFrom, userTo), 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,6 +25,7 @@ public class MessengerBuddy implements Runnable, ISerialize {
|
|||||||
private String look = "";
|
private String look = "";
|
||||||
private String motto = "";
|
private String motto = "";
|
||||||
private short relation;
|
private short relation;
|
||||||
|
private int categoryId = 0;
|
||||||
private boolean inRoom;
|
private boolean inRoom;
|
||||||
private int userOne = 0;
|
private int userOne = 0;
|
||||||
|
|
||||||
@ -33,10 +34,11 @@ public class MessengerBuddy implements Runnable, ISerialize {
|
|||||||
this.id = set.getInt("id");
|
this.id = set.getInt("id");
|
||||||
this.username = set.getString("username");
|
this.username = set.getString("username");
|
||||||
this.gender = HabboGender.valueOf(set.getString("gender"));
|
this.gender = HabboGender.valueOf(set.getString("gender"));
|
||||||
this.online = Integer.valueOf(set.getString("online"));
|
this.online = set.getInt("online");
|
||||||
this.motto = set.getString("motto");
|
this.motto = set.getString("motto");
|
||||||
this.look = set.getString("look");
|
this.look = set.getString("look");
|
||||||
this.relation = (short) set.getInt("relation");
|
this.relation = (short) set.getInt("relation");
|
||||||
|
this.categoryId = set.getInt("category");
|
||||||
this.userOne = set.getInt("user_one_id");
|
this.userOne = set.getInt("user_one_id");
|
||||||
this.inRoom = false;
|
this.inRoom = false;
|
||||||
if (this.online == 1) {
|
if (this.online == 1) {
|
||||||
@ -58,6 +60,7 @@ public class MessengerBuddy implements Runnable, ISerialize {
|
|||||||
this.look = set.getString("look");
|
this.look = set.getString("look");
|
||||||
this.relation = 0;
|
this.relation = 0;
|
||||||
this.userOne = 0;
|
this.userOne = 0;
|
||||||
|
this.online = set.getInt("online");
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
LOGGER.error("Caught SQL exception", e);
|
LOGGER.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
@ -135,6 +138,8 @@ public class MessengerBuddy implements Runnable, ISerialize {
|
|||||||
Emulator.getThreading().run(this);
|
Emulator.getThreading().run(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getCategoryId() { return this.categoryId; }
|
||||||
|
|
||||||
public boolean inRoom() {
|
public boolean inRoom() {
|
||||||
return this.inRoom;
|
return this.inRoom;
|
||||||
}
|
}
|
||||||
@ -180,7 +185,7 @@ public class MessengerBuddy implements Runnable, ISerialize {
|
|||||||
message.appendBoolean(this.online == 1);
|
message.appendBoolean(this.online == 1);
|
||||||
message.appendBoolean(this.inRoom); //IN ROOM
|
message.appendBoolean(this.inRoom); //IN ROOM
|
||||||
message.appendString(this.look);
|
message.appendString(this.look);
|
||||||
message.appendInt(0); // Friends category ID
|
message.appendInt(this.categoryId); // Friends category ID
|
||||||
message.appendString(this.motto);
|
message.appendString(this.motto);
|
||||||
message.appendString(""); //Last seen as DATETIMESTRING
|
message.appendString(""); //Last seen as DATETIMESTRING
|
||||||
message.appendString(""); // Realname or Facebookame as String
|
message.appendString(""); // Realname or Facebookame as String
|
||||||
|
@ -0,0 +1,31 @@
|
|||||||
|
package com.eu.habbo.habbohotel.messenger;
|
||||||
|
|
||||||
|
public class MessengerCategory {
|
||||||
|
private int user_id;
|
||||||
|
private String name;
|
||||||
|
private int id;
|
||||||
|
|
||||||
|
public MessengerCategory(String name, int user_id, int id) {
|
||||||
|
this.name = name;
|
||||||
|
this.user_id = user_id;
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getUserId() {
|
||||||
|
return user_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
public void setId(int id) { this.id = id; }
|
||||||
|
}
|
||||||
|
|
@ -52,7 +52,7 @@ public class ModToolIssue implements ISerialize {
|
|||||||
int photoItemId = set.getInt("photo_item_id");
|
int photoItemId = set.getInt("photo_item_id");
|
||||||
|
|
||||||
if (photoItemId != -1) {
|
if (photoItemId != -1) {
|
||||||
this.photoItem = Emulator.getGameEnvironment().getItemManager().loadHabboItem(photoItemId);;
|
this.photoItem = Emulator.getGameEnvironment().getItemManager().loadHabboItem(photoItemId);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.modId <= 0) {
|
if (this.modId <= 0) {
|
||||||
|
@ -184,8 +184,6 @@ public class ModToolManager {
|
|||||||
|
|
||||||
public void quickTicket(Habbo reported, String reason, String message) {
|
public void quickTicket(Habbo reported, String reason, String message) {
|
||||||
ModToolIssue issue = new ModToolIssue(0, reason, reported.getHabboInfo().getId(), reported.getHabboInfo().getUsername(), 0, message, ModToolTicketType.AUTOMATIC);
|
ModToolIssue issue = new ModToolIssue(0, reason, reported.getHabboInfo().getId(), reported.getHabboInfo().getUsername(), 0, message, ModToolTicketType.AUTOMATIC);
|
||||||
if (Emulator.getPluginManager().fireEvent(new SupportTicketEvent(null, issue)).isCancelled())
|
|
||||||
return;
|
|
||||||
|
|
||||||
Emulator.getGameEnvironment().getModToolManager().addTicket(issue);
|
Emulator.getGameEnvironment().getModToolManager().addTicket(issue);
|
||||||
Emulator.getGameEnvironment().getModToolManager().updateTicketToMods(issue);
|
Emulator.getGameEnvironment().getModToolManager().updateTicketToMods(issue);
|
||||||
|
@ -79,7 +79,7 @@ public class WordFilter {
|
|||||||
return DIACRITICS_AND_FRIENDS.matcher(Normalizer.normalize(StringUtils.stripAccents(message), Normalizer.Form.NFKD)
|
return DIACRITICS_AND_FRIENDS.matcher(Normalizer.normalize(StringUtils.stripAccents(message), Normalizer.Form.NFKD)
|
||||||
.replaceAll("[,.;:'\"]", " ").replace("I", "l")
|
.replaceAll("[,.;:'\"]", " ").replace("I", "l")
|
||||||
.replaceAll("[^\\p{ASCII}*$]", "").replaceAll("\\p{M}", " ")
|
.replaceAll("[^\\p{ASCII}*$]", "").replaceAll("\\p{M}", " ")
|
||||||
.replaceAll("^\\p{M}*$]", "").replaceAll("[1|]", "i")
|
.replaceAll("[^\\p{M}*$]", "").replaceAll("[1|]", "i")
|
||||||
.replace("2", "z").replace("3", "e")
|
.replace("2", "z").replace("3", "e")
|
||||||
.replace("4", "a").replace("5", "s")
|
.replace("4", "a").replace("5", "s")
|
||||||
.replace("8", "b").replace("0", "o")
|
.replace("8", "b").replace("0", "o")
|
||||||
|
@ -46,7 +46,7 @@ public class NavigatorManager {
|
|||||||
synchronized (this.publicCategories) {
|
synchronized (this.publicCategories) {
|
||||||
this.publicCategories.clear();
|
this.publicCategories.clear();
|
||||||
|
|
||||||
try (Statement statement = connection.createStatement(); ResultSet set = statement.executeQuery("SELECT * FROM navigator_publiccats WHERE visible = '1'")) {
|
try (Statement statement = connection.createStatement(); ResultSet set = statement.executeQuery("SELECT * FROM navigator_publiccats WHERE visible = '1' ORDER BY order_num DESC")) {
|
||||||
while (set.next()) {
|
while (set.next()) {
|
||||||
this.publicCategories.put(set.getInt("id"), new NavigatorPublicCategory(set));
|
this.publicCategories.put(set.getInt("id"), new NavigatorPublicCategory(set));
|
||||||
}
|
}
|
||||||
@ -80,7 +80,7 @@ public class NavigatorManager {
|
|||||||
Class clazz = Room.class;
|
Class clazz = Room.class;
|
||||||
|
|
||||||
if (set.getString("field").contains(".")) {
|
if (set.getString("field").contains(".")) {
|
||||||
for (String s : (set.getString("field")).split(".")) {
|
for (String s : (set.getString("field")).split("\\.")) {
|
||||||
try {
|
try {
|
||||||
field = clazz.getDeclaredMethod(s);
|
field = clazz.getDeclaredMethod(s);
|
||||||
clazz = field.getReturnType();
|
clazz = field.getReturnType();
|
||||||
|
@ -25,7 +25,7 @@ public class NavigatorPublicFilter extends NavigatorFilter {
|
|||||||
|
|
||||||
for (NavigatorPublicCategory category : Emulator.getGameEnvironment().getNavigatorManager().publicCategories.values()) {
|
for (NavigatorPublicCategory category : Emulator.getGameEnvironment().getNavigatorManager().publicCategories.values()) {
|
||||||
if (!category.rooms.isEmpty()) {
|
if (!category.rooms.isEmpty()) {
|
||||||
resultLists.add(new SearchResultList(i, "", category.name, SearchAction.NONE, habbo.getHabboStats().navigatorWindowSettings.getListModeForCategory(category.name, category.image), habbo.getHabboStats().navigatorWindowSettings.getDisplayModeForCategory(category.name), category.rooms, true, showInvisible, DisplayOrder.ACTIVITY, category.order));
|
resultLists.add(new SearchResultList(i, "", category.name, SearchAction.NONE, habbo.getHabboStats().navigatorWindowSettings.getListModeForCategory(category.name, category.image), habbo.getHabboStats().navigatorWindowSettings.getDisplayModeForCategory(category.name), category.rooms, true, showInvisible, DisplayOrder.ORDER_NUM, category.order));
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1672,7 +1672,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
} else {
|
} else {
|
||||||
if (!unit.hasStatus(RoomUnitStatus.LAY)) {
|
if (!unit.hasStatus(RoomUnitStatus.LAY)) {
|
||||||
unit.setStatus(RoomUnitStatus.LAY, Item.getCurrentHeight(topItem) * 1.0D + "");
|
unit.setStatus(RoomUnitStatus.LAY, Item.getCurrentHeight(topItem) * 1.0D + "");
|
||||||
unit.setRotation(RoomUserRotation.values()[topItem.getRotation()]);
|
unit.setRotation(RoomUserRotation.values()[topItem.getRotation() % 4]);
|
||||||
|
|
||||||
if (topItem.getRotation() == 0 || topItem.getRotation() == 4) {
|
if (topItem.getRotation() == 0 || topItem.getRotation() == 4) {
|
||||||
unit.setLocation(this.layout.getTile(unit.getX(), topItem.getY()));
|
unit.setLocation(this.layout.getTile(unit.getX(), topItem.getY()));
|
||||||
@ -2407,6 +2407,8 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
this.roomSpecialTypes.addUndefined(item);
|
this.roomSpecialTypes.addUndefined(item);
|
||||||
} else if (item instanceof InteractionMuteArea) {
|
} else if (item instanceof InteractionMuteArea) {
|
||||||
this.roomSpecialTypes.addUndefined(item);
|
this.roomSpecialTypes.addUndefined(item);
|
||||||
|
} else if (item instanceof InteractionBuildArea) {
|
||||||
|
this.roomSpecialTypes.addUndefined(item);
|
||||||
} else if (item instanceof InteractionTagPole) {
|
} else if (item instanceof InteractionTagPole) {
|
||||||
this.roomSpecialTypes.addUndefined(item);
|
this.roomSpecialTypes.addUndefined(item);
|
||||||
} else if (item instanceof InteractionTagField) {
|
} else if (item instanceof InteractionTagField) {
|
||||||
@ -2671,6 +2673,10 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
habbo.getRoomUnit().getCurrentLocation().removeUnit(habbo.getRoomUnit());
|
habbo.getRoomUnit().getCurrentLocation().removeUnit(habbo.getRoomUnit());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
synchronized (this.roomUnitLock) {
|
||||||
|
this.currentHabbos.remove(habbo.getHabboInfo().getId());
|
||||||
|
}
|
||||||
|
|
||||||
if (sendRemovePacket && habbo.getRoomUnit() != null && !habbo.getRoomUnit().isTeleporting) {
|
if (sendRemovePacket && habbo.getRoomUnit() != null && !habbo.getRoomUnit().isTeleporting) {
|
||||||
this.sendComposer(new RoomUserRemoveComposer(habbo.getRoomUnit()).compose());
|
this.sendComposer(new RoomUserRemoveComposer(habbo.getRoomUnit()).compose());
|
||||||
}
|
}
|
||||||
@ -2687,10 +2693,6 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
synchronized (this.roomUnitLock) {
|
|
||||||
this.currentHabbos.remove(habbo.getHabboInfo().getId());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (habbo.getHabboInfo().getCurrentGame() != null) {
|
if (habbo.getHabboInfo().getCurrentGame() != null) {
|
||||||
if (this.getGame(habbo.getHabboInfo().getCurrentGame()) != null) {
|
if (this.getGame(habbo.getHabboInfo().getCurrentGame()) != null) {
|
||||||
this.getGame(habbo.getHabboInfo().getCurrentGame()).removeHabbo(habbo);
|
this.getGame(habbo.getHabboInfo().getCurrentGame()).removeHabbo(habbo);
|
||||||
@ -3820,10 +3822,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
|
|
||||||
public void sendComposer(ServerMessage message) {
|
public void sendComposer(ServerMessage message) {
|
||||||
for (Habbo habbo : this.getHabbos()) {
|
for (Habbo habbo : this.getHabbos()) {
|
||||||
if (habbo.getClient() == null) {
|
if (habbo.getClient() == null) continue;
|
||||||
this.removeHabbo(habbo, true);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
habbo.getClient().sendResponse(message);
|
habbo.getClient().sendResponse(message);
|
||||||
}
|
}
|
||||||
@ -3977,6 +3976,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (habbo != null) {
|
if (habbo != null) {
|
||||||
|
this.ejectUserFurni(habbo.getHabboInfo().getId());
|
||||||
habbo.getRoomUnit().setRightsLevel(RoomRightLevels.NONE);
|
habbo.getRoomUnit().setRightsLevel(RoomRightLevels.NONE);
|
||||||
habbo.getRoomUnit().removeStatus(RoomUnitStatus.FLAT_CONTROL);
|
habbo.getRoomUnit().removeStatus(RoomUnitStatus.FLAT_CONTROL);
|
||||||
this.refreshRightsForHabbo(habbo);
|
this.refreshRightsForHabbo(habbo);
|
||||||
@ -3984,6 +3984,10 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void removeAllRights() {
|
public void removeAllRights() {
|
||||||
|
for (int userId : rights.toArray()) {
|
||||||
|
this.ejectUserFurni(userId);
|
||||||
|
}
|
||||||
|
|
||||||
this.rights.clear();
|
this.rights.clear();
|
||||||
|
|
||||||
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("DELETE FROM room_rights WHERE room_id = ?")) {
|
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("DELETE FROM room_rights WHERE room_id = ?")) {
|
||||||
@ -4120,17 +4124,25 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void giveEffect(RoomUnit roomUnit, int effectId, int duration) {
|
public void giveEffect(RoomUnit roomUnit, int effectId, int duration) {
|
||||||
|
if(roomUnit == null) return;
|
||||||
|
|
||||||
|
Habbo habbo = roomUnit.getRoom().getHabbo(roomUnit);
|
||||||
|
|
||||||
|
if(habbo == null) return;
|
||||||
|
|
||||||
|
if (!habbo.getHabboInfo().isInGame()) {
|
||||||
if (duration == -1 || duration == Integer.MAX_VALUE) {
|
if (duration == -1 || duration == Integer.MAX_VALUE) {
|
||||||
duration = Integer.MAX_VALUE;
|
duration = Integer.MAX_VALUE;
|
||||||
} else {
|
} else {
|
||||||
duration += Emulator.getIntUnixTimestamp();
|
duration += Emulator.getIntUnixTimestamp();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.allowEffects && roomUnit != null) {
|
if (this.allowEffects) {
|
||||||
roomUnit.setEffectId(effectId, duration);
|
roomUnit.setEffectId(effectId, duration);
|
||||||
this.sendComposer(new RoomUserEffectComposer(roomUnit).compose());
|
this.sendComposer(new RoomUserEffectComposer(roomUnit).compose());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void giveHandItem(Habbo habbo, int handItem) {
|
public void giveHandItem(Habbo habbo, int handItem) {
|
||||||
this.giveHandItem(habbo.getRoomUnit(), handItem);
|
this.giveHandItem(habbo.getRoomUnit(), handItem);
|
||||||
@ -4468,6 +4480,10 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
return FurnitureMovementError.MAX_ITEMS;
|
return FurnitureMovementError.MAX_ITEMS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (tile == null || tile.state == RoomTileState.INVALID) {
|
||||||
|
return FurnitureMovementError.INVALID_MOVE;
|
||||||
|
}
|
||||||
|
|
||||||
rotation %= 8;
|
rotation %= 8;
|
||||||
if (this.hasRights(habbo) || this.getGuildRightLevel(habbo).isEqualOrGreaterThan(RoomRightLevels.GUILD_RIGHTS) || habbo.hasPermission(Permission.ACC_MOVEROTATE)) {
|
if (this.hasRights(habbo) || this.getGuildRightLevel(habbo).isEqualOrGreaterThan(RoomRightLevels.GUILD_RIGHTS) || habbo.hasPermission(Permission.ACC_MOVEROTATE)) {
|
||||||
return FurnitureMovementError.NONE;
|
return FurnitureMovementError.NONE;
|
||||||
@ -4485,6 +4501,12 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (HabboItem area : this.getRoomSpecialTypes().getItemsOfType(InteractionBuildArea.class)) {
|
||||||
|
if (((InteractionBuildArea) area).inSquare(tile) && ((InteractionBuildArea) area).isBuilder(habbo.getHabboInfo().getUsername())) {
|
||||||
|
return FurnitureMovementError.NONE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return FurnitureMovementError.NO_RIGHTS;
|
return FurnitureMovementError.NO_RIGHTS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4501,10 +4523,12 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
THashSet<RoomTile> occupiedTiles = this.layout.getTilesAt(tile, item.getBaseItem().getWidth(), item.getBaseItem().getLength(), rotation);
|
THashSet<RoomTile> occupiedTiles = this.layout.getTilesAt(tile, item.getBaseItem().getWidth(), item.getBaseItem().getLength(), rotation);
|
||||||
for (RoomTile t : occupiedTiles) {
|
for (RoomTile t : occupiedTiles) {
|
||||||
if(t.state == RoomTileState.INVALID) return FurnitureMovementError.INVALID_MOVE;
|
if(t.state == RoomTileState.INVALID) return FurnitureMovementError.INVALID_MOVE;
|
||||||
|
if(!Emulator.getConfig().getBoolean("wired.place.under", false) || (Emulator.getConfig().getBoolean("wired.place.under", false) && !item.isWalkable() && !item.getBaseItem().allowSit() && !item.getBaseItem().allowLay())) {
|
||||||
if (checkForUnits && this.hasHabbosAt(t.x, t.y)) return FurnitureMovementError.TILE_HAS_HABBOS;
|
if (checkForUnits && this.hasHabbosAt(t.x, t.y)) return FurnitureMovementError.TILE_HAS_HABBOS;
|
||||||
if (checkForUnits && this.hasBotsAt(t.x, t.y)) return FurnitureMovementError.TILE_HAS_BOTS;
|
if (checkForUnits && this.hasBotsAt(t.x, t.y)) return FurnitureMovementError.TILE_HAS_BOTS;
|
||||||
if (checkForUnits && this.hasPetsAt(t.x, t.y)) return FurnitureMovementError.TILE_HAS_PETS;
|
if (checkForUnits && this.hasPetsAt(t.x, t.y)) return FurnitureMovementError.TILE_HAS_PETS;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
List<Pair<RoomTile, THashSet<HabboItem>>> tileFurniList = new ArrayList<>();
|
List<Pair<RoomTile, THashSet<HabboItem>>> tileFurniList = new ArrayList<>();
|
||||||
for (RoomTile t : occupiedTiles) {
|
for (RoomTile t : occupiedTiles) {
|
||||||
@ -4610,10 +4634,14 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public FurnitureMovementError moveFurniTo(HabboItem item, RoomTile tile, int rotation, Habbo actor) {
|
public FurnitureMovementError moveFurniTo(HabboItem item, RoomTile tile, int rotation, Habbo actor) {
|
||||||
return moveFurniTo(item, tile, rotation, actor, true);
|
return moveFurniTo(item, tile, rotation, actor, true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public FurnitureMovementError moveFurniTo(HabboItem item, RoomTile tile, int rotation, Habbo actor, boolean sendUpdates) {
|
public FurnitureMovementError moveFurniTo(HabboItem item, RoomTile tile, int rotation, Habbo actor, boolean sendUpdates) {
|
||||||
|
return moveFurniTo(item, tile, rotation, actor, sendUpdates, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public FurnitureMovementError moveFurniTo(HabboItem item, RoomTile tile, int rotation, Habbo actor, boolean sendUpdates, boolean checkForUnits) {
|
||||||
RoomTile oldLocation = this.layout.getTile(item.getX(), item.getY());
|
RoomTile oldLocation = this.layout.getTile(item.getX(), item.getY());
|
||||||
|
|
||||||
boolean pluginHelper = false;
|
boolean pluginHelper = false;
|
||||||
@ -4631,6 +4659,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
|
|
||||||
//Check if can be placed at new position
|
//Check if can be placed at new position
|
||||||
THashSet<RoomTile> occupiedTiles = this.layout.getTilesAt(tile, item.getBaseItem().getWidth(), item.getBaseItem().getLength(), rotation);
|
THashSet<RoomTile> occupiedTiles = this.layout.getTilesAt(tile, item.getBaseItem().getWidth(), item.getBaseItem().getLength(), rotation);
|
||||||
|
THashSet<RoomTile> newOccupiedTiles = this.layout.getTilesAt(tile, item.getBaseItem().getWidth(), item.getBaseItem().getLength(), rotation);
|
||||||
|
|
||||||
HabboItem topItem = this.getTopItemAt(occupiedTiles, null);
|
HabboItem topItem = this.getTopItemAt(occupiedTiles, null);
|
||||||
|
|
||||||
@ -4640,11 +4669,16 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
HabboItem tileTopItem = this.getTopItemAt(t.x, t.y);
|
HabboItem tileTopItem = this.getTopItemAt(t.x, t.y);
|
||||||
if (!magicTile && ((tileTopItem != null && tileTopItem != item ? (t.state.equals(RoomTileState.INVALID) || !t.getAllowStack() || !tileTopItem.getBaseItem().allowStack()) : this.calculateTileState(t, item).equals(RoomTileState.INVALID))))
|
if (!magicTile && ((tileTopItem != null && tileTopItem != item ? (t.state.equals(RoomTileState.INVALID) || !t.getAllowStack() || !tileTopItem.getBaseItem().allowStack()) : this.calculateTileState(t, item).equals(RoomTileState.INVALID))))
|
||||||
return FurnitureMovementError.CANT_STACK;
|
return FurnitureMovementError.CANT_STACK;
|
||||||
|
|
||||||
|
if(!Emulator.getConfig().getBoolean("wired.place.under", false) || (Emulator.getConfig().getBoolean("wired.place.under", false) && !item.isWalkable() && !item.getBaseItem().allowSit() && !item.getBaseItem().allowLay())) {
|
||||||
|
if (checkForUnits) {
|
||||||
if (!magicTile && this.hasHabbosAt(t.x, t.y)) return FurnitureMovementError.TILE_HAS_HABBOS;
|
if (!magicTile && this.hasHabbosAt(t.x, t.y)) return FurnitureMovementError.TILE_HAS_HABBOS;
|
||||||
if (!magicTile && this.hasBotsAt(t.x, t.y)) return FurnitureMovementError.TILE_HAS_BOTS;
|
if (!magicTile && this.hasBotsAt(t.x, t.y)) return FurnitureMovementError.TILE_HAS_BOTS;
|
||||||
if (!magicTile && this.hasPetsAt(t.x, t.y)) return FurnitureMovementError.TILE_HAS_PETS;
|
if (!magicTile && this.hasPetsAt(t.x, t.y)) return FurnitureMovementError.TILE_HAS_PETS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
List<Pair<RoomTile, THashSet<HabboItem>>> tileFurniList = new ArrayList<>();
|
List<Pair<RoomTile, THashSet<HabboItem>>> tileFurniList = new ArrayList<>();
|
||||||
for (RoomTile t : occupiedTiles) {
|
for (RoomTile t : occupiedTiles) {
|
||||||
@ -4698,6 +4732,9 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(height > MAXIMUM_FURNI_HEIGHT) return FurnitureMovementError.CANT_STACK;
|
||||||
|
if(height < this.getLayout().getHeightAtSquare(tile.x, tile.y)) return FurnitureMovementError.CANT_STACK; //prevent furni going under the floor
|
||||||
|
|
||||||
if (Emulator.getPluginManager().isRegistered(FurnitureBuildheightEvent.class, true)) {
|
if (Emulator.getPluginManager().isRegistered(FurnitureBuildheightEvent.class, true)) {
|
||||||
FurnitureBuildheightEvent event = Emulator.getPluginManager().fireEvent(new FurnitureBuildheightEvent(item, actor, 0.00, height));
|
FurnitureBuildheightEvent event = Emulator.getPluginManager().fireEvent(new FurnitureBuildheightEvent(item, actor, 0.00, height));
|
||||||
if (event.hasChangedHeight()) {
|
if (event.hasChangedHeight()) {
|
||||||
@ -4705,9 +4742,6 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(height > MAXIMUM_FURNI_HEIGHT) return FurnitureMovementError.CANT_STACK;
|
|
||||||
if(height < this.getLayout().getHeightAtSquare(tile.x, tile.y)) return FurnitureMovementError.CANT_STACK; //prevent furni going under the floor
|
|
||||||
|
|
||||||
item.setX(tile.x);
|
item.setX(tile.x);
|
||||||
item.setY(tile.y);
|
item.setY(tile.y);
|
||||||
item.setZ(height);
|
item.setZ(height);
|
||||||
@ -4746,6 +4780,18 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
);
|
);
|
||||||
this.updateBotsAt(t.x, t.y);
|
this.updateBotsAt(t.x, t.y);
|
||||||
}
|
}
|
||||||
|
if(Emulator.getConfig().getBoolean("wired.place.under", false)) {
|
||||||
|
for(RoomTile t : newOccupiedTiles) {
|
||||||
|
for(Habbo h : this.getHabbosAt(t.x, t.y)) {
|
||||||
|
try {
|
||||||
|
item.onWalkOn(h.getRoomUnit(), this, null);
|
||||||
|
}
|
||||||
|
catch(Exception e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return FurnitureMovementError.NONE;
|
return FurnitureMovementError.NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,6 +56,7 @@ public class RoomChatMessage implements Runnable, ISerialize, DatabaseLoggable {
|
|||||||
for (Integer i : RoomChatMessage.BANNED_BUBBLES) {
|
for (Integer i : RoomChatMessage.BANNED_BUBBLES) {
|
||||||
if (i == this.bubble.getType()) {
|
if (i == this.bubble.getType()) {
|
||||||
this.bubble = RoomChatMessageBubbles.NORMAL;
|
this.bubble = RoomChatMessageBubbles.NORMAL;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -42,11 +42,13 @@ import com.eu.habbo.messages.outgoing.rooms.promotions.RoomPromotionMessageCompo
|
|||||||
import com.eu.habbo.messages.outgoing.rooms.users.*;
|
import com.eu.habbo.messages.outgoing.rooms.users.*;
|
||||||
import com.eu.habbo.messages.outgoing.users.MutedWhisperComposer;
|
import com.eu.habbo.messages.outgoing.users.MutedWhisperComposer;
|
||||||
import com.eu.habbo.plugin.events.navigator.NavigatorRoomCreatedEvent;
|
import com.eu.habbo.plugin.events.navigator.NavigatorRoomCreatedEvent;
|
||||||
|
import com.eu.habbo.plugin.events.rooms.RoomFloorItemsLoadEvent;
|
||||||
import com.eu.habbo.plugin.events.rooms.RoomUncachedEvent;
|
import com.eu.habbo.plugin.events.rooms.RoomUncachedEvent;
|
||||||
import com.eu.habbo.plugin.events.rooms.UserVoteRoomEvent;
|
import com.eu.habbo.plugin.events.rooms.UserVoteRoomEvent;
|
||||||
import com.eu.habbo.plugin.events.users.HabboAddedToRoomEvent;
|
import com.eu.habbo.plugin.events.users.HabboAddedToRoomEvent;
|
||||||
import com.eu.habbo.plugin.events.users.UserEnterRoomEvent;
|
import com.eu.habbo.plugin.events.users.UserEnterRoomEvent;
|
||||||
import com.eu.habbo.plugin.events.users.UserExitRoomEvent;
|
import com.eu.habbo.plugin.events.users.UserExitRoomEvent;
|
||||||
|
import com.eu.habbo.plugin.events.users.UsernameTalkEvent;
|
||||||
import gnu.trove.iterator.TIntObjectIterator;
|
import gnu.trove.iterator.TIntObjectIterator;
|
||||||
import gnu.trove.map.hash.THashMap;
|
import gnu.trove.map.hash.THashMap;
|
||||||
import gnu.trove.procedure.TIntProcedure;
|
import gnu.trove.procedure.TIntProcedure;
|
||||||
@ -788,7 +790,16 @@ public class RoomManager {
|
|||||||
{
|
{
|
||||||
final THashSet<HabboItem> floorItems = new THashSet<>();
|
final THashSet<HabboItem> floorItems = new THashSet<>();
|
||||||
|
|
||||||
room.getFloorItems().forEach(new TObjectProcedure<HabboItem>() {
|
THashSet<HabboItem> allFloorItems = new THashSet<>(room.getFloorItems());
|
||||||
|
|
||||||
|
if (Emulator.getPluginManager().isRegistered(RoomFloorItemsLoadEvent.class, true)) {
|
||||||
|
RoomFloorItemsLoadEvent roomFloorItemsLoadEvent = Emulator.getPluginManager().fireEvent(new RoomFloorItemsLoadEvent(habbo, allFloorItems));
|
||||||
|
if (roomFloorItemsLoadEvent.hasChangedFloorItems()) {
|
||||||
|
allFloorItems = roomFloorItemsLoadEvent.getFloorItems();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
allFloorItems.forEach(new TObjectProcedure<HabboItem>() {
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(HabboItem object) {
|
public boolean execute(HabboItem object) {
|
||||||
if (room.isHideWired() && object instanceof InteractionWired)
|
if (room.isHideWired() && object instanceof InteractionWired)
|
||||||
@ -1312,7 +1323,7 @@ public class RoomManager {
|
|||||||
if (friend == null || friend.getHabboInfo() == null) continue;
|
if (friend == null || friend.getHabboInfo() == null) continue;
|
||||||
|
|
||||||
Room room = friend.getHabboInfo().getCurrentRoom();
|
Room room = friend.getHabboInfo().getCurrentRoom();
|
||||||
if (room != null && !rooms.contains(room)) rooms.add(room);
|
if (room != null && !rooms.contains(room) && room.hasRights(habbo)) rooms.add(room);
|
||||||
|
|
||||||
if (rooms.size() >= limit) break;
|
if (rooms.size() >= limit) break;
|
||||||
}
|
}
|
||||||
|
@ -380,7 +380,7 @@ public class Habbo implements Runnable {
|
|||||||
|
|
||||||
|
|
||||||
public boolean addBadge(String code) {
|
public boolean addBadge(String code) {
|
||||||
if (this.habboInventory.getBadgesComponent().getBadge(code) == null) {
|
if (!this.habboInventory.getBadgesComponent().hasBadge(code)) {
|
||||||
HabboBadge badge = BadgesComponent.createBadge(code, this);
|
HabboBadge badge = BadgesComponent.createBadge(code, this);
|
||||||
this.habboInventory.getBadgesComponent().addBadge(badge);
|
this.habboInventory.getBadgesComponent().addBadge(badge);
|
||||||
this.client.sendResponse(new AddUserBadgeComposer(badge));
|
this.client.sendResponse(new AddUserBadgeComposer(badge));
|
||||||
|
@ -4,6 +4,7 @@ import com.eu.habbo.Emulator;
|
|||||||
import com.eu.habbo.habbohotel.catalog.CatalogItem;
|
import com.eu.habbo.habbohotel.catalog.CatalogItem;
|
||||||
import com.eu.habbo.habbohotel.games.Game;
|
import com.eu.habbo.habbohotel.games.Game;
|
||||||
import com.eu.habbo.habbohotel.games.GamePlayer;
|
import com.eu.habbo.habbohotel.games.GamePlayer;
|
||||||
|
import com.eu.habbo.habbohotel.messenger.MessengerCategory;
|
||||||
import com.eu.habbo.habbohotel.navigation.NavigatorSavedSearch;
|
import com.eu.habbo.habbohotel.navigation.NavigatorSavedSearch;
|
||||||
import com.eu.habbo.habbohotel.permissions.Rank;
|
import com.eu.habbo.habbohotel.permissions.Rank;
|
||||||
import com.eu.habbo.habbohotel.pets.PetTasks;
|
import com.eu.habbo.habbohotel.pets.PetTasks;
|
||||||
@ -55,6 +56,7 @@ public class HabboInfo implements Runnable {
|
|||||||
private int webPublishTimestamp;
|
private int webPublishTimestamp;
|
||||||
private String machineID;
|
private String machineID;
|
||||||
private List<NavigatorSavedSearch> savedSearches = new ArrayList<>();
|
private List<NavigatorSavedSearch> savedSearches = new ArrayList<>();
|
||||||
|
private List<MessengerCategory> messengerCategories = new ArrayList<>();
|
||||||
|
|
||||||
public HabboInfo(ResultSet set) {
|
public HabboInfo(ResultSet set) {
|
||||||
try {
|
try {
|
||||||
@ -88,6 +90,7 @@ public class HabboInfo implements Runnable {
|
|||||||
|
|
||||||
this.loadCurrencies();
|
this.loadCurrencies();
|
||||||
this.loadSavedSearches();
|
this.loadSavedSearches();
|
||||||
|
this.loadMessengerCategories();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadCurrencies() {
|
private void loadCurrencies() {
|
||||||
@ -179,6 +182,56 @@ public class HabboInfo implements Runnable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void loadMessengerCategories() {
|
||||||
|
this.messengerCategories = new ArrayList<>();
|
||||||
|
|
||||||
|
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("SELECT * FROM messenger_categories WHERE user_id = ?")) {
|
||||||
|
statement.setInt(1, this.id);
|
||||||
|
try (ResultSet set = statement.executeQuery()) {
|
||||||
|
while (set.next()) {
|
||||||
|
this.messengerCategories.add(new MessengerCategory(set.getString("name"), set.getInt("user_id"), set.getInt("id")));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (SQLException e) {
|
||||||
|
LOGGER.error("Caught SQL exception", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addMessengerCategory(MessengerCategory category) {
|
||||||
|
this.messengerCategories.add(category);
|
||||||
|
|
||||||
|
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("INSERT INTO messenger_categories (name, user_id) VALUES (?, ?)", Statement.RETURN_GENERATED_KEYS)) {
|
||||||
|
statement.setString(1, category.getName());
|
||||||
|
statement.setInt(2, this.id);
|
||||||
|
int affectedRows = statement.executeUpdate();
|
||||||
|
|
||||||
|
if (affectedRows == 0) {
|
||||||
|
throw new SQLException("Creating messenger category failed, no rows affected.");
|
||||||
|
}
|
||||||
|
|
||||||
|
try (ResultSet generatedKeys = statement.getGeneratedKeys()) {
|
||||||
|
if (generatedKeys.next()) {
|
||||||
|
category.setId(generatedKeys.getInt(1));
|
||||||
|
} else {
|
||||||
|
throw new SQLException("Creating messenger category failed, no ID found.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (SQLException e) {
|
||||||
|
LOGGER.error("Caught SQL exception", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void deleteMessengerCategory(MessengerCategory category) {
|
||||||
|
this.messengerCategories.remove(category);
|
||||||
|
|
||||||
|
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("DELETE FROM messenger_categories WHERE id = ?")) {
|
||||||
|
statement.setInt(1, category.getId());
|
||||||
|
statement.execute();
|
||||||
|
} catch (SQLException e) {
|
||||||
|
LOGGER.error("Caught SQL exception", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public int getCurrencyAmount(int type) {
|
public int getCurrencyAmount(int type) {
|
||||||
return this.currencies.get(type);
|
return this.currencies.get(type);
|
||||||
}
|
}
|
||||||
@ -478,6 +531,8 @@ public class HabboInfo implements Runnable {
|
|||||||
return this.savedSearches;
|
return this.savedSearches;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<MessengerCategory> getMessengerCategories() { return this.messengerCategories; }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
this.saveCurrencies();
|
this.saveCurrencies();
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.eu.habbo.habbohotel.users;
|
package com.eu.habbo.habbohotel.users;
|
||||||
|
|
||||||
import com.eu.habbo.Emulator;
|
import com.eu.habbo.Emulator;
|
||||||
|
import com.eu.habbo.habbohotel.campaign.calendar.CalendarRewardClaimed;
|
||||||
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
||||||
import com.eu.habbo.habbohotel.achievements.Achievement;
|
import com.eu.habbo.habbohotel.achievements.Achievement;
|
||||||
import com.eu.habbo.habbohotel.achievements.AchievementManager;
|
import com.eu.habbo.habbohotel.achievements.AchievementManager;
|
||||||
@ -33,7 +34,7 @@ public class HabboStats implements Runnable {
|
|||||||
public final TIntArrayList secretRecipes;
|
public final TIntArrayList secretRecipes;
|
||||||
public final HabboNavigatorWindowSettings navigatorWindowSettings;
|
public final HabboNavigatorWindowSettings navigatorWindowSettings;
|
||||||
public final THashMap<String, Object> cache;
|
public final THashMap<String, Object> cache;
|
||||||
public final TIntArrayList calendarRewardsClaimed;
|
public final ArrayList<CalendarRewardClaimed> calendarRewardsClaimed;
|
||||||
public final TIntObjectMap<HabboOfferPurchase> offerCache = new TIntObjectHashMap<>();
|
public final TIntObjectMap<HabboOfferPurchase> offerCache = new TIntObjectHashMap<>();
|
||||||
private final AtomicInteger lastOnlineTime = new AtomicInteger(Emulator.getIntUnixTimestamp());
|
private final AtomicInteger lastOnlineTime = new AtomicInteger(Emulator.getIntUnixTimestamp());
|
||||||
private final THashMap<Achievement, Integer> achievementProgress;
|
private final THashMap<Achievement, Integer> achievementProgress;
|
||||||
@ -109,7 +110,7 @@ public class HabboStats implements Runnable {
|
|||||||
this.ignoredUsers = new TIntArrayList(0);
|
this.ignoredUsers = new TIntArrayList(0);
|
||||||
this.roomsVists = new TIntArrayList(0);
|
this.roomsVists = new TIntArrayList(0);
|
||||||
this.secretRecipes = new TIntArrayList(0);
|
this.secretRecipes = new TIntArrayList(0);
|
||||||
this.calendarRewardsClaimed = new TIntArrayList(0);
|
this.calendarRewardsClaimed = new ArrayList<>();
|
||||||
|
|
||||||
this.habboInfo = habboInfo;
|
this.habboInfo = habboInfo;
|
||||||
|
|
||||||
@ -206,7 +207,7 @@ public class HabboStats implements Runnable {
|
|||||||
calendarRewardsStatement.setInt(1, this.habboInfo.getId());
|
calendarRewardsStatement.setInt(1, this.habboInfo.getId());
|
||||||
try (ResultSet rewardSet = calendarRewardsStatement.executeQuery()) {
|
try (ResultSet rewardSet = calendarRewardsStatement.executeQuery()) {
|
||||||
while (rewardSet.next()) {
|
while (rewardSet.next()) {
|
||||||
this.calendarRewardsClaimed.add(rewardSet.getInt("reward_id"));
|
this.calendarRewardsClaimed.add(new CalendarRewardClaimed(rewardSet));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -268,7 +269,7 @@ public class HabboStats implements Runnable {
|
|||||||
try (PreparedStatement statement = connection.prepareStatement("SELECT * FROM users_settings WHERE user_id = ? LIMIT 1")) {
|
try (PreparedStatement statement = connection.prepareStatement("SELECT * FROM users_settings WHERE user_id = ? LIMIT 1")) {
|
||||||
statement.setInt(1, habboInfo.getId());
|
statement.setInt(1, habboInfo.getId());
|
||||||
try (ResultSet set = statement.executeQuery()) {
|
try (ResultSet set = statement.executeQuery()) {
|
||||||
set.first();
|
set.next();
|
||||||
if (set.getRow() != 0) {
|
if (set.getRow() != 0) {
|
||||||
stats = new HabboStats(set, habboInfo);
|
stats = new HabboStats(set, habboInfo);
|
||||||
} else {
|
} else {
|
||||||
|
@ -46,7 +46,7 @@ public class BadgesComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (delete) {
|
if (delete) {
|
||||||
deleteBadge(habbo.getHabboInfo().getUsername(), badge.getCode());
|
deleteBadge(habbo.getHabboInfo().getId(), badge.getCode());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -94,22 +94,6 @@ public class BadgesComponent {
|
|||||||
return badge;
|
return badge;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
public static void deleteBadge(String username, HabboBadge badge) {
|
|
||||||
deleteBadge(username, badge.getCode());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
public static void deleteBadge(String username, String badge) {
|
|
||||||
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("DELETE users_badges FROM users_badges INNER JOIN users ON users_badges.user_id = users.id WHERE users.username LIKE ? AND badge_code LIKE ?")) {
|
|
||||||
statement.setString(1, username);
|
|
||||||
statement.setString(2, badge);
|
|
||||||
statement.execute();
|
|
||||||
} catch (SQLException e) {
|
|
||||||
LOGGER.error("Caught SQL exception", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void deleteBadge(int userId, String badge) {
|
public static void deleteBadge(int userId, String badge) {
|
||||||
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("DELETE users_badges FROM users_badges WHERE user_id = ? AND badge_code LIKE ?")) {
|
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("DELETE users_badges FROM users_badges WHERE user_id = ? AND badge_code LIKE ?")) {
|
||||||
statement.setInt(1, userId);
|
statement.setInt(1, userId);
|
||||||
|
@ -15,6 +15,8 @@ import com.eu.habbo.messages.outgoing.generic.PickMonthlyClubGiftNotificationCom
|
|||||||
import com.eu.habbo.messages.outgoing.rooms.users.RoomUserDataComposer;
|
import com.eu.habbo.messages.outgoing.rooms.users.RoomUserDataComposer;
|
||||||
import com.eu.habbo.messages.outgoing.users.*;
|
import com.eu.habbo.messages.outgoing.users.*;
|
||||||
import gnu.trove.map.hash.THashMap;
|
import gnu.trove.map.hash.THashMap;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
@ -29,6 +31,7 @@ import java.util.TreeMap;
|
|||||||
* @author Beny
|
* @author Beny
|
||||||
*/
|
*/
|
||||||
public class SubscriptionHabboClub extends Subscription {
|
public class SubscriptionHabboClub extends Subscription {
|
||||||
|
private static final Logger LOGGER = LoggerFactory.getLogger(SubscriptionHabboClub.class);
|
||||||
|
|
||||||
public static boolean HC_PAYDAY_ENABLED = false;
|
public static boolean HC_PAYDAY_ENABLED = false;
|
||||||
public static int HC_PAYDAY_NEXT_DATE = Integer.MAX_VALUE; // yyyy-MM-dd HH:mm:ss
|
public static int HC_PAYDAY_NEXT_DATE = Integer.MAX_VALUE; // yyyy-MM-dd HH:mm:ss
|
||||||
@ -393,9 +396,18 @@ public class SubscriptionHabboClub extends Subscription {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
pointCurrency = -1;
|
||||||
|
try {
|
||||||
pointCurrency = Integer.parseInt(currency);
|
pointCurrency = Integer.parseInt(currency);
|
||||||
|
}
|
||||||
|
catch (NumberFormatException ex) {
|
||||||
|
LOGGER.error("Couldn't convert the type point currency {} on HC PayDay. The number must be a integer and positive.", pointCurrency);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pointCurrency >= 0) {
|
||||||
habbo.getClient().getHabbo().getHabboInfo().addCurrencyAmount(pointCurrency, amount);
|
habbo.getClient().getHabbo().getHabboInfo().addCurrencyAmount(pointCurrency, amount);
|
||||||
habbo.getClient().sendResponse(new UserPointsComposer(habbo.getClient().getHabbo().getHabboInfo().getCurrencyAmount(pointCurrency), amount, pointCurrency));
|
habbo.getClient().sendResponse(new UserPointsComposer(habbo.getClient().getHabbo().getHabboInfo().getCurrencyAmount(pointCurrency), amount, pointCurrency));
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -160,8 +160,9 @@ public class WiredHandler {
|
|||||||
|
|
||||||
public static boolean handle(InteractionWiredTrigger trigger, final RoomUnit roomUnit, final Room room, final Object[] stuff, final THashSet<InteractionWiredEffect> effectsToExecute) {
|
public static boolean handle(InteractionWiredTrigger trigger, final RoomUnit roomUnit, final Room room, final Object[] stuff, final THashSet<InteractionWiredEffect> effectsToExecute) {
|
||||||
long millis = System.currentTimeMillis();
|
long millis = System.currentTimeMillis();
|
||||||
if (Emulator.isReady && trigger.canExecute(millis) && trigger.execute(roomUnit, room, stuff)) {
|
int roomUnitId = roomUnit != null ? roomUnit.getId() : -1;
|
||||||
trigger.activateBox(room);
|
if (Emulator.isReady && ((Emulator.getConfig().getBoolean("wired.custom.enabled", false) && (trigger.canExecute(millis) || roomUnitId > -1) && trigger.userCanExecute(roomUnitId, millis)) || (!Emulator.getConfig().getBoolean("wired.custom.enabled", false) && trigger.canExecute(millis))) && trigger.execute(roomUnit, room, stuff)) {
|
||||||
|
trigger.activateBox(room, roomUnit, millis);
|
||||||
|
|
||||||
THashSet<InteractionWiredCondition> conditions = room.getRoomSpecialTypes().getConditions(trigger.getX(), trigger.getY());
|
THashSet<InteractionWiredCondition> conditions = room.getRoomSpecialTypes().getConditions(trigger.getX(), trigger.getY());
|
||||||
THashSet<InteractionWiredEffect> effects = room.getRoomSpecialTypes().getEffects(trigger.getX(), trigger.getY());
|
THashSet<InteractionWiredEffect> effects = room.getRoomSpecialTypes().getEffects(trigger.getX(), trigger.getY());
|
||||||
@ -193,7 +194,7 @@ public class WiredHandler {
|
|||||||
THashSet<InteractionWiredExtra> extras = room.getRoomSpecialTypes().getExtras(trigger.getX(), trigger.getY());
|
THashSet<InteractionWiredExtra> extras = room.getRoomSpecialTypes().getExtras(trigger.getX(), trigger.getY());
|
||||||
|
|
||||||
for (InteractionWiredExtra extra : extras) {
|
for (InteractionWiredExtra extra : extras) {
|
||||||
extra.activateBox(room);
|
extra.activateBox(room, roomUnit, millis);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<InteractionWiredEffect> effectList = new ArrayList<>(effects);
|
List<InteractionWiredEffect> effectList = new ArrayList<>(effects);
|
||||||
@ -229,7 +230,7 @@ public class WiredHandler {
|
|||||||
|
|
||||||
private static boolean triggerEffect(InteractionWiredEffect effect, RoomUnit roomUnit, Room room, Object[] stuff, long millis) {
|
private static boolean triggerEffect(InteractionWiredEffect effect, RoomUnit roomUnit, Room room, Object[] stuff, long millis) {
|
||||||
boolean executed = false;
|
boolean executed = false;
|
||||||
if (effect != null && effect.canExecute(millis)) {
|
if (effect != null && (effect.canExecute(millis) || (roomUnit != null && effect.requiresTriggeringUser() && Emulator.getConfig().getBoolean("wired.custom.enabled", false) && effect.userCanExecute(roomUnit.getId(), millis)))) {
|
||||||
executed = true;
|
executed = true;
|
||||||
if (!effect.requiresTriggeringUser() || (roomUnit != null && effect.requiresTriggeringUser())) {
|
if (!effect.requiresTriggeringUser() || (roomUnit != null && effect.requiresTriggeringUser())) {
|
||||||
Emulator.getThreading().run(() -> {
|
Emulator.getThreading().run(() -> {
|
||||||
@ -241,7 +242,7 @@ public class WiredHandler {
|
|||||||
LOGGER.error("Caught exception", e);
|
LOGGER.error("Caught exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
effect.activateBox(room);
|
effect.activateBox(room, roomUnit, millis);
|
||||||
}
|
}
|
||||||
}, effect.getDelay() * 500);
|
}, effect.getDelay() * 500);
|
||||||
}
|
}
|
||||||
@ -306,6 +307,9 @@ public class WiredHandler {
|
|||||||
if (rewardReceived.value.isEmpty())
|
if (rewardReceived.value.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (habbo.getInventory().getBadgesComponent().hasBadge(rewardReceived.value))
|
||||||
|
return;
|
||||||
|
|
||||||
HabboBadge badge = new HabboBadge(0, rewardReceived.value, 0, habbo);
|
HabboBadge badge = new HabboBadge(0, rewardReceived.value, 0, habbo);
|
||||||
Emulator.getThreading().run(badge);
|
Emulator.getThreading().run(badge);
|
||||||
habbo.getInventory().getBadgesComponent().addBadge(badge);
|
habbo.getInventory().getBadgesComponent().addBadge(badge);
|
||||||
@ -373,7 +377,7 @@ public class WiredHandler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("SELECT COUNT(*) as row_count, wired_rewards_given.* FROM wired_rewards_given WHERE user_id = ? AND wired_item = ? ORDER BY timestamp DESC LIMIT ?")) {
|
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("SELECT COUNT(*) as row_count, wired_rewards_given.* FROM wired_rewards_given WHERE user_id = ? AND wired_item = ? ORDER BY timestamp DESC LIMIT ?", ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY)) {
|
||||||
statement.setInt(1, habbo.getHabboInfo().getId());
|
statement.setInt(1, habbo.getHabboInfo().getId());
|
||||||
statement.setInt(2, wiredBox.getId());
|
statement.setInt(2, wiredBox.getId());
|
||||||
statement.setInt(3, wiredBox.rewardItems.size());
|
statement.setInt(3, wiredBox.rewardItems.size());
|
||||||
|
@ -23,7 +23,10 @@ public class WiredHighscoreManager {
|
|||||||
|
|
||||||
private final HashMap<Integer, List<WiredHighscoreDataEntry>> data = new HashMap<>();
|
private final HashMap<Integer, List<WiredHighscoreDataEntry>> data = new HashMap<>();
|
||||||
|
|
||||||
private final static DayOfWeek firstDayOfWeek = WeekFields.of(new Locale(System.getProperty("user.language"), System.getProperty("user.country"))).getFirstDayOfWeek();
|
private final static String locale = (System.getProperty("user.language") != null ? System.getProperty("user.language") : "en");
|
||||||
|
private final static String country = (System.getProperty("user.country") != null ? System.getProperty("user.country") : "US");
|
||||||
|
|
||||||
|
private final static DayOfWeek firstDayOfWeek = WeekFields.of(new Locale(locale, country)).getFirstDayOfWeek();
|
||||||
private final static DayOfWeek lastDayOfWeek = DayOfWeek.of(((firstDayOfWeek.getValue() + 5) % DayOfWeek.values().length) + 1);
|
private final static DayOfWeek lastDayOfWeek = DayOfWeek.of(((firstDayOfWeek.getValue() + 5) % DayOfWeek.values().length) + 1);
|
||||||
private final static ZoneId zoneId = ZoneId.systemDefault();
|
private final static ZoneId zoneId = ZoneId.systemDefault();
|
||||||
|
|
||||||
|
@ -80,6 +80,10 @@ public class CatalogBuyItemAsGiftEvent extends MessageHandler {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (message.length() > Emulator.getConfig().getInt("hotel.gifts.length.max", 300)) {
|
||||||
|
message = message.substring(0, Emulator.getConfig().getInt("hotel.gifts.length.max", 300));
|
||||||
|
}
|
||||||
|
|
||||||
Integer iItemId = Emulator.getGameEnvironment().getCatalogManager().giftWrappers.get(spriteId);
|
Integer iItemId = Emulator.getGameEnvironment().getCatalogManager().giftWrappers.get(spriteId);
|
||||||
|
|
||||||
if (iItemId == null)
|
if (iItemId == null)
|
||||||
@ -164,15 +168,20 @@ public class CatalogBuyItemAsGiftEvent extends MessageHandler {
|
|||||||
item.sellRare();
|
item.sellRare();
|
||||||
}
|
}
|
||||||
|
|
||||||
int totalCredits = 0;
|
int totalCredits = item.getCredits();
|
||||||
int totalPoints = 0;
|
int totalPoints = item.getPoints();
|
||||||
|
|
||||||
|
if(totalCredits > this.client.getHabbo().getHabboInfo().getCredits() || totalPoints > this.client.getHabbo().getHabboInfo().getCurrencyAmount(item.getPointsType())) {
|
||||||
|
this.client.sendResponse(new AlertPurchaseUnavailableComposer(AlertPurchaseUnavailableComposer.ILLEGAL));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
CatalogLimitedConfiguration limitedConfiguration;
|
CatalogLimitedConfiguration limitedConfiguration;
|
||||||
int limitedStack = 0;
|
int limitedStack = 0;
|
||||||
int limitedNumber = 0;
|
int limitedNumber = 0;
|
||||||
if (item.isLimited()) {
|
if (item.isLimited()) {
|
||||||
count = 1;
|
count = 1;
|
||||||
if (Emulator.getGameEnvironment().getCatalogManager().getLimitedConfig(item).available() == 0) {
|
if (Emulator.getGameEnvironment().getCatalogManager().getLimitedConfig(item).available() == 0 && habbo != null) {
|
||||||
habbo.getClient().sendResponse(new AlertLimitedSoldOutComposer());
|
habbo.getClient().sendResponse(new AlertLimitedSoldOutComposer());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -220,23 +229,11 @@ public class CatalogBuyItemAsGiftEvent extends MessageHandler {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < count; i++) {
|
|
||||||
if (item.getCredits() <= this.client.getHabbo().getHabboInfo().getCredits() - totalCredits) {
|
|
||||||
if (
|
|
||||||
item.getPoints() <= this.client.getHabbo().getHabboInfo().getCurrencyAmount(item.getPointsType()) - totalPoints)
|
|
||||||
//item.getPointsType() == 0 && item.getPoints() <= this.client.getHabbo().getHabboInfo().getPixels() - totalPoints ||
|
|
||||||
|
|
||||||
{
|
|
||||||
if (((i + 1) % 6 != 0 && CatalogItem.haveOffer(item)) || !CatalogItem.haveOffer(item)) {
|
|
||||||
totalCredits += item.getCredits();
|
|
||||||
totalPoints += item.getPoints();
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int j = 0; j < item.getAmount(); j++) {
|
|
||||||
if (item.getAmount() > 1 || item.getBaseItems().size() > 1) {
|
if (item.getAmount() > 1 || item.getBaseItems().size() > 1) {
|
||||||
this.client.sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.SERVER_ERROR).compose());
|
this.client.sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.SERVER_ERROR).compose());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Item baseItem : item.getBaseItems()) {
|
for (Item baseItem : item.getBaseItems()) {
|
||||||
if (item.getItemAmount(baseItem.getId()) > 1) {
|
if (item.getItemAmount(baseItem.getId()) > 1) {
|
||||||
this.client.sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.SERVER_ERROR).compose());
|
this.client.sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.SERVER_ERROR).compose());
|
||||||
@ -269,7 +266,7 @@ public class CatalogBuyItemAsGiftEvent extends MessageHandler {
|
|||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
if (baseItem.getInteractionType().getType() == InteractionTrophy.class || baseItem.getInteractionType().getType() == InteractionBadgeDisplay.class) {
|
if (baseItem.getInteractionType().getType() == InteractionTrophy.class || baseItem.getInteractionType().getType() == InteractionBadgeDisplay.class) {
|
||||||
if (baseItem.getInteractionType().getType() == InteractionBadgeDisplay.class && !habbo.getClient().getHabbo().getInventory().getBadgesComponent().hasBadge(extraData)) {
|
if (baseItem.getInteractionType().getType() == InteractionBadgeDisplay.class && habbo != null && !habbo.getClient().getHabbo().getInventory().getBadgesComponent().hasBadge(extraData)) {
|
||||||
ScripterManager.scripterDetected(habbo.getClient(), Emulator.getTexts().getValue("scripter.warning.catalog.badge_display").replace("%username%", habbo.getClient().getHabbo().getHabboInfo().getUsername()).replace("%badge%", extraData));
|
ScripterManager.scripterDetected(habbo.getClient(), Emulator.getTexts().getValue("scripter.warning.catalog.badge_display").replace("%username%", habbo.getClient().getHabbo().getHabboInfo().getUsername()).replace("%badge%", extraData));
|
||||||
extraData = "UMAD";
|
extraData = "UMAD";
|
||||||
}
|
}
|
||||||
@ -316,10 +313,6 @@ public class CatalogBuyItemAsGiftEvent extends MessageHandler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
StringBuilder giftData = new StringBuilder(itemsList.size() + "\t");
|
StringBuilder giftData = new StringBuilder(itemsList.size() + "\t");
|
||||||
|
|
||||||
|
@ -11,14 +11,14 @@ public class RequestCatalogPageEvent extends MessageHandler {
|
|||||||
@Override
|
@Override
|
||||||
public void handle() throws Exception {
|
public void handle() throws Exception {
|
||||||
int catalogPageId = this.packet.readInt();
|
int catalogPageId = this.packet.readInt();
|
||||||
int unknown = this.packet.readInt();
|
int offerId = this.packet.readInt();
|
||||||
String mode = this.packet.readString();
|
String mode = this.packet.readString();
|
||||||
|
|
||||||
CatalogPage page = Emulator.getGameEnvironment().getCatalogManager().catalogPages.get(catalogPageId);
|
CatalogPage page = Emulator.getGameEnvironment().getCatalogManager().catalogPages.get(catalogPageId);
|
||||||
|
|
||||||
if (catalogPageId > 0 && page != null) {
|
if (catalogPageId > 0 && page != null) {
|
||||||
if (page.getRank() <= this.client.getHabbo().getHabboInfo().getRank().getId() && page.isEnabled()) {
|
if (page.getRank() <= this.client.getHabbo().getHabboInfo().getRank().getId() && page.isEnabled()) {
|
||||||
this.client.sendResponse(new CatalogPageComposer(page, this.client.getHabbo(), mode));
|
this.client.sendResponse(new CatalogPageComposer(page, this.client.getHabbo(), offerId, mode));
|
||||||
} else {
|
} else {
|
||||||
if (!page.isVisible()) {
|
if (!page.isVisible()) {
|
||||||
ScripterManager.scripterDetected(this.client, Emulator.getTexts().getValue("scripter.warning.catalog.page").replace("%username%", this.client.getHabbo().getHabboInfo().getUsername()).replace("%pagename%", page.getCaption()));
|
ScripterManager.scripterDetected(this.client, Emulator.getTexts().getValue("scripter.warning.catalog.page").replace("%username%", this.client.getHabbo().getHabboInfo().getUsername()).replace("%pagename%", page.getCaption()));
|
||||||
|
@ -3,9 +3,7 @@ package com.eu.habbo.messages.incoming.catalog.recycler;
|
|||||||
import com.eu.habbo.Emulator;
|
import com.eu.habbo.Emulator;
|
||||||
import com.eu.habbo.habbohotel.items.interactions.InteractionGift;
|
import com.eu.habbo.habbohotel.items.interactions.InteractionGift;
|
||||||
import com.eu.habbo.habbohotel.permissions.Permission;
|
import com.eu.habbo.habbohotel.permissions.Permission;
|
||||||
import com.eu.habbo.habbohotel.rooms.Room;
|
import com.eu.habbo.habbohotel.rooms.*;
|
||||||
import com.eu.habbo.habbohotel.rooms.RoomChatMessage;
|
|
||||||
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
|
|
||||||
import com.eu.habbo.habbohotel.users.HabboItem;
|
import com.eu.habbo.habbohotel.users.HabboItem;
|
||||||
import com.eu.habbo.messages.incoming.MessageHandler;
|
import com.eu.habbo.messages.incoming.MessageHandler;
|
||||||
import com.eu.habbo.messages.outgoing.inventory.AddHabboItemComposer;
|
import com.eu.habbo.messages.outgoing.inventory.AddHabboItemComposer;
|
||||||
@ -58,7 +56,15 @@ public class OpenRecycleBoxEvent extends MessageHandler {
|
|||||||
|
|
||||||
if (item.getRoomId() == 0) {
|
if (item.getRoomId() == 0) {
|
||||||
room.updateTile(room.getLayout().getTile(item.getX(), item.getY()));
|
room.updateTile(room.getLayout().getTile(item.getX(), item.getY()));
|
||||||
room.sendComposer(new UpdateStackHeightComposer(item.getX(), item.getY(), room.getStackHeight(item.getX(), item.getY(), true)).compose());
|
RoomLayout roomLayout = room.getLayout();
|
||||||
|
short z = (short)room.getStackHeight(item.getX(), item.getY(), true);
|
||||||
|
if(roomLayout != null) {
|
||||||
|
RoomTile roomTile = roomLayout.getTile(item.getX(), item.getY());
|
||||||
|
if(roomTile != null) {
|
||||||
|
z = roomTile.z;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
room.sendComposer(new UpdateStackHeightComposer(item.getX(), item.getY(), z, room.getStackHeight(item.getX(), item.getY(), true)).compose());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -54,17 +54,16 @@ public class CraftingCraftItemEvent extends MessageHandler {
|
|||||||
|
|
||||||
if (!recipe.getAchievement().isEmpty()) {
|
if (!recipe.getAchievement().isEmpty()) {
|
||||||
AchievementManager.progressAchievement(this.client.getHabbo(), Emulator.getGameEnvironment().getAchievementManager().getAchievement(recipe.getAchievement()));
|
AchievementManager.progressAchievement(this.client.getHabbo(), Emulator.getGameEnvironment().getAchievementManager().getAchievement(recipe.getAchievement()));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.client.sendResponse(new CraftingResultComposer(recipe));
|
this.client.sendResponse(new CraftingResultComposer(recipe));
|
||||||
this.client.getHabbo().getInventory().getItemsComponent().addItem(rewardItem);
|
this.client.getHabbo().getInventory().getItemsComponent().addItem(rewardItem);
|
||||||
this.client.sendResponse(new AddHabboItemComposer(rewardItem));
|
this.client.sendResponse(new AddHabboItemComposer(rewardItem));
|
||||||
toRemove.forEachValue(new TObjectProcedure<HabboItem>() {
|
AchievementManager.progressAchievement(this.client.getHabbo(), Emulator.getGameEnvironment().getAchievementManager().getAchievement("Atcg"));
|
||||||
@Override
|
toRemove.forEachValue(object -> {
|
||||||
public boolean execute(HabboItem object) {
|
|
||||||
CraftingCraftItemEvent.this.client.sendResponse(new RemoveHabboItemComposer(object.getGiftAdjustedId()));
|
CraftingCraftItemEvent.this.client.sendResponse(new RemoveHabboItemComposer(object.getGiftAdjustedId()));
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
});
|
});
|
||||||
this.client.sendResponse(new InventoryRefreshComposer());
|
this.client.sendResponse(new InventoryRefreshComposer());
|
||||||
|
|
||||||
|
@ -6,9 +6,9 @@ import com.eu.habbo.messages.incoming.MessageHandler;
|
|||||||
public class AdventCalendarForceOpenEvent extends MessageHandler {
|
public class AdventCalendarForceOpenEvent extends MessageHandler {
|
||||||
@Override
|
@Override
|
||||||
public void handle() throws Exception {
|
public void handle() throws Exception {
|
||||||
String campaign = this.packet.readString();
|
String campaignName = this.packet.readString();
|
||||||
int day = this.packet.readInt();
|
int day = this.packet.readInt();
|
||||||
|
|
||||||
Emulator.getGameEnvironment().getCatalogManager().claimCalendarReward(this.client.getHabbo(), day, true);
|
Emulator.getGameEnvironment().getCalendarManager().claimCalendarReward(this.client.getHabbo(), campaignName, day, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -6,9 +6,9 @@ import com.eu.habbo.messages.incoming.MessageHandler;
|
|||||||
public class AdventCalendarOpenDayEvent extends MessageHandler {
|
public class AdventCalendarOpenDayEvent extends MessageHandler {
|
||||||
@Override
|
@Override
|
||||||
public void handle() throws Exception {
|
public void handle() throws Exception {
|
||||||
String campaign = this.packet.readString();
|
String campaignName = this.packet.readString();
|
||||||
int day = this.packet.readInt();
|
int day = this.packet.readInt();
|
||||||
|
|
||||||
Emulator.getGameEnvironment().getCatalogManager().claimCalendarReward(this.client.getHabbo(), day, false);
|
Emulator.getGameEnvironment().getCalendarManager().claimCalendarReward(this.client.getHabbo(), campaignName, day, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -2,9 +2,7 @@ package com.eu.habbo.messages.incoming.floorplaneditor;
|
|||||||
|
|
||||||
import com.eu.habbo.Emulator;
|
import com.eu.habbo.Emulator;
|
||||||
import com.eu.habbo.habbohotel.permissions.Permission;
|
import com.eu.habbo.habbohotel.permissions.Permission;
|
||||||
import com.eu.habbo.habbohotel.rooms.CustomRoomLayout;
|
import com.eu.habbo.habbohotel.rooms.*;
|
||||||
import com.eu.habbo.habbohotel.rooms.Room;
|
|
||||||
import com.eu.habbo.habbohotel.rooms.RoomLayout;
|
|
||||||
import com.eu.habbo.habbohotel.users.Habbo;
|
import com.eu.habbo.habbohotel.users.Habbo;
|
||||||
import com.eu.habbo.messages.ServerMessage;
|
import com.eu.habbo.messages.ServerMessage;
|
||||||
import com.eu.habbo.messages.incoming.MessageHandler;
|
import com.eu.habbo.messages.incoming.MessageHandler;
|
||||||
@ -12,6 +10,7 @@ import com.eu.habbo.messages.outgoing.generic.alerts.BubbleAlertComposer;
|
|||||||
import com.eu.habbo.messages.outgoing.generic.alerts.BubbleAlertKeys;
|
import com.eu.habbo.messages.outgoing.generic.alerts.BubbleAlertKeys;
|
||||||
import com.eu.habbo.messages.outgoing.generic.alerts.GenericAlertComposer;
|
import com.eu.habbo.messages.outgoing.generic.alerts.GenericAlertComposer;
|
||||||
import com.eu.habbo.messages.outgoing.rooms.ForwardToRoomComposer;
|
import com.eu.habbo.messages.outgoing.rooms.ForwardToRoomComposer;
|
||||||
|
import gnu.trove.set.hash.THashSet;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@ -85,7 +84,6 @@ public class FloorPlanEditorSaveEvent extends MessageHandler {
|
|||||||
if (wallSize < -2 || wallSize > 1) {
|
if (wallSize < -2 || wallSize > 1) {
|
||||||
errors.add("${notification.floorplan_editor.error.message.invalid_wall_thickness}");
|
errors.add("${notification.floorplan_editor.error.message.invalid_wall_thickness}");
|
||||||
}
|
}
|
||||||
|
|
||||||
int floorSize = this.packet.readInt();
|
int floorSize = this.packet.readInt();
|
||||||
if (floorSize < -2 || floorSize > 1) {
|
if (floorSize < -2 || floorSize > 1) {
|
||||||
errors.add("${notification.floorplan_editor.error.message.invalid_floor_thickness}");
|
errors.add("${notification.floorplan_editor.error.message.invalid_floor_thickness}");
|
||||||
@ -99,16 +97,44 @@ public class FloorPlanEditorSaveEvent extends MessageHandler {
|
|||||||
errors.add("${notification.floorplan_editor.error.message.invalid_walls_fixed_height}");
|
errors.add("${notification.floorplan_editor.error.message.invalid_walls_fixed_height}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
THashSet<RoomTile> locked_tileList = room.getLockedTiles();
|
||||||
|
THashSet<RoomTile> new_tileList = new THashSet<>();
|
||||||
blockingRoomItemScan:
|
blockingRoomItemScan:
|
||||||
for (int y = 0; y < mapRows.length; y++) {
|
for (int y = 0; y < mapRows.length; y++) {
|
||||||
for (int x = 0; x < firstRowSize; x++) {
|
for (int x = 0; x < firstRowSize; x++) {
|
||||||
if (mapRows[y].charAt(x) == "x".charAt(0) && room.getTopItemAt(x, y) != null) {
|
|
||||||
|
RoomTile tile = room.getLayout().getTile((short) x, (short) y);
|
||||||
|
new_tileList.add(tile);
|
||||||
|
String square = String.valueOf(mapRows[y].charAt(x));
|
||||||
|
short height;
|
||||||
|
|
||||||
|
if (square.equalsIgnoreCase("x") && room.getTopItemAt(x, y) != null) {
|
||||||
|
errors.add("${notification.floorplan_editor.error.message.change_blocked_by_room_item}");
|
||||||
|
break blockingRoomItemScan;
|
||||||
|
} else {
|
||||||
|
if (square.isEmpty()) {
|
||||||
|
height = 0;
|
||||||
|
} else if (Emulator.isNumeric(square)) {
|
||||||
|
height = Short.parseShort(square);
|
||||||
|
} else {
|
||||||
|
height = (short) (10 + "ABCDEFGHIJKLMNOPQRSTUVWXYZ".indexOf(square.toUpperCase()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tile != null && tile.state != RoomTileState.INVALID && height != tile.z && room.getTopItemAt(x, y) != null) {
|
||||||
errors.add("${notification.floorplan_editor.error.message.change_blocked_by_room_item}");
|
errors.add("${notification.floorplan_editor.error.message.change_blocked_by_room_item}");
|
||||||
break blockingRoomItemScan;
|
break blockingRoomItemScan;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
locked_tileList.removeAll(new_tileList);
|
||||||
|
if (!locked_tileList.isEmpty()) {
|
||||||
|
errors.add("${notification.floorplan_editor.error.message.change_blocked_by_room_item}");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (errors.length() > 0) {
|
if (errors.length() > 0) {
|
||||||
this.client.sendResponse(new BubbleAlertComposer(BubbleAlertKeys.FLOORPLAN_EDITOR_ERROR.key, errors.toString()));
|
this.client.sendResponse(new BubbleAlertComposer(BubbleAlertKeys.FLOORPLAN_EDITOR_ERROR.key, errors.toString()));
|
||||||
return;
|
return;
|
||||||
|
@ -3,11 +3,22 @@ package com.eu.habbo.messages.incoming.friends;
|
|||||||
import com.eu.habbo.Emulator;
|
import com.eu.habbo.Emulator;
|
||||||
import com.eu.habbo.habbohotel.messenger.Messenger;
|
import com.eu.habbo.habbohotel.messenger.Messenger;
|
||||||
import com.eu.habbo.habbohotel.users.Habbo;
|
import com.eu.habbo.habbohotel.users.Habbo;
|
||||||
|
import com.eu.habbo.habbohotel.users.HabboInfo;
|
||||||
import com.eu.habbo.messages.incoming.MessageHandler;
|
import com.eu.habbo.messages.incoming.MessageHandler;
|
||||||
import com.eu.habbo.messages.outgoing.friends.FriendRequestErrorComposer;
|
import com.eu.habbo.messages.outgoing.friends.FriendRequestErrorComposer;
|
||||||
import com.eu.habbo.plugin.PluginManager;
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import java.sql.Connection;
|
||||||
|
import java.sql.PreparedStatement;
|
||||||
|
import java.sql.ResultSet;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
|
||||||
|
import static com.eu.habbo.habbohotel.users.HabboManager.getOfflineHabboInfo;
|
||||||
|
|
||||||
public class AcceptFriendRequestEvent extends MessageHandler {
|
public class AcceptFriendRequestEvent extends MessageHandler {
|
||||||
|
private static final Logger LOGGER = LoggerFactory.getLogger(AcceptFriendRequestEvent.class);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handle() throws Exception {
|
public void handle() throws Exception {
|
||||||
int count = this.packet.readInt();
|
int count = this.packet.readInt();
|
||||||
@ -26,6 +37,28 @@ public class AcceptFriendRequestEvent extends MessageHandler {
|
|||||||
|
|
||||||
Habbo target = Emulator.getGameEnvironment().getHabboManager().getHabbo(userId);
|
Habbo target = Emulator.getGameEnvironment().getHabboManager().getHabbo(userId);
|
||||||
|
|
||||||
|
if(target == null) {
|
||||||
|
HabboInfo habboInfo = getOfflineHabboInfo(userId);
|
||||||
|
|
||||||
|
if(habboInfo == null) {
|
||||||
|
this.client.sendResponse(new FriendRequestErrorComposer(FriendRequestErrorComposer.TARGET_NOT_FOUND));
|
||||||
|
this.client.getHabbo().getMessenger().deleteFriendRequests(userId, this.client.getHabbo().getHabboInfo().getId());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("SELECT users.*, users_settings.block_friendrequests FROM users INNER JOIN users_settings ON users.id = users_settings.user_id WHERE username = ? LIMIT 1")) {
|
||||||
|
statement.setString(1, habboInfo.getUsername());
|
||||||
|
try (ResultSet set = statement.executeQuery()) {
|
||||||
|
while (set.next()) {
|
||||||
|
target = new Habbo(set);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (SQLException e) {
|
||||||
|
LOGGER.error("Caught SQL exception", e);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(target == null) {
|
if(target == null) {
|
||||||
this.client.sendResponse(new FriendRequestErrorComposer(FriendRequestErrorComposer.TARGET_NOT_FOUND));
|
this.client.sendResponse(new FriendRequestErrorComposer(FriendRequestErrorComposer.TARGET_NOT_FOUND));
|
||||||
this.client.getHabbo().getMessenger().deleteFriendRequests(userId, this.client.getHabbo().getHabboInfo().getId());
|
this.client.getHabbo().getMessenger().deleteFriendRequests(userId, this.client.getHabbo().getHabboInfo().getId());
|
||||||
|
@ -16,7 +16,7 @@ public class ChangeRelationEvent extends MessageHandler {
|
|||||||
UserRelationShipEvent event = new UserRelationShipEvent(this.client.getHabbo(), buddy, relationId);
|
UserRelationShipEvent event = new UserRelationShipEvent(this.client.getHabbo(), buddy, relationId);
|
||||||
if (!event.isCancelled()) {
|
if (!event.isCancelled()) {
|
||||||
buddy.setRelation(event.relationShip);
|
buddy.setRelation(event.relationShip);
|
||||||
this.client.sendResponse(new UpdateFriendComposer(buddy));
|
this.client.sendResponse(new UpdateFriendComposer(this.client.getHabbo(), buddy, 0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,70 +23,70 @@ public class FriendRequestEvent extends MessageHandler {
|
|||||||
@Override
|
@Override
|
||||||
public void handle() throws Exception {
|
public void handle() throws Exception {
|
||||||
String username = this.packet.readString();
|
String username = this.packet.readString();
|
||||||
Habbo habbo = Emulator.getGameServer().getGameClientManager().getHabbo(username);
|
|
||||||
|
|
||||||
if (habbo.getHabboInfo().getId() == this.client.getHabbo().getHabboInfo().getId()) {
|
if (this.client == null || username == null || username.isEmpty())
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
if (Emulator.getPluginManager().fireEvent(new UserRequestFriendshipEvent(this.client.getHabbo(), username, habbo)).isCancelled()) {
|
// TargetHabbo can be null if the Habbo is not online or when the Habbo doesn't exist
|
||||||
this.client.sendResponse(new FriendRequestErrorComposer(2));
|
Habbo targetHabbo = Emulator.getGameServer().getGameClientManager().getHabbo(username);
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
int id = 0;
|
// If the Habbo is null, we try to get the Habbo from the database.
|
||||||
boolean allowFriendRequests = true;
|
// If the Habbo is still null, the Habbo doesn't exist.
|
||||||
|
if (targetHabbo == null) {
|
||||||
FriendRequest friendRequest = this.client.getHabbo().getMessenger().findFriendRequest(username);
|
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("SELECT users.*, users_settings.block_friendrequests FROM users INNER JOIN users_settings ON users.id = users_settings.user_id WHERE username = ? LIMIT 1")) {
|
||||||
if (friendRequest != null) {
|
|
||||||
this.client.getHabbo().getMessenger().acceptFriendRequest(friendRequest.getId(), this.client.getHabbo().getHabboInfo().getId());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!Messenger.canFriendRequest(this.client.getHabbo(), username)) {
|
|
||||||
this.client.sendResponse(new FriendRequestErrorComposer(FriendRequestErrorComposer.TARGET_NOT_FOUND));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (habbo == null) {
|
|
||||||
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("SELECT users_settings.block_friendrequests, users.id FROM users INNER JOIN users_settings ON users.id = users_settings.user_id WHERE username = ? LIMIT 1")) {
|
|
||||||
statement.setString(1, username);
|
statement.setString(1, username);
|
||||||
try (ResultSet set = statement.executeQuery()) {
|
try (ResultSet set = statement.executeQuery()) {
|
||||||
while (set.next()) {
|
while (set.next()) {
|
||||||
id = set.getInt("id");
|
targetHabbo = new Habbo(set);
|
||||||
allowFriendRequests = set.getString("block_friendrequests").equalsIgnoreCase("0");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
LOGGER.error("Caught SQL exception", e);
|
LOGGER.error("Caught SQL exception", e);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
id = habbo.getHabboInfo().getId();
|
|
||||||
allowFriendRequests = !habbo.getHabboStats().blockFriendRequests;
|
|
||||||
if (allowFriendRequests)
|
|
||||||
habbo.getClient().sendResponse(new FriendRequestComposer(this.client.getHabbo()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (id != 0) {
|
if (targetHabbo == null) {
|
||||||
if (!allowFriendRequests) {
|
this.client.sendResponse(new FriendRequestErrorComposer(FriendRequestErrorComposer.TARGET_NOT_FOUND));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int targetId = targetHabbo.getHabboInfo().getId();
|
||||||
|
boolean targetBlocksFriendRequests = targetHabbo.getHabboStats().blockFriendRequests;
|
||||||
|
|
||||||
|
// Making friends with yourself would be very pathetic, we try to avoid that
|
||||||
|
if (targetId == this.client.getHabbo().getHabboInfo().getId())
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Target Habbo exists
|
||||||
|
// Check if Habbo is accepting friend requests
|
||||||
|
if (targetBlocksFriendRequests) {
|
||||||
this.client.sendResponse(new FriendRequestErrorComposer(FriendRequestErrorComposer.TARGET_NOT_ACCEPTING_REQUESTS));
|
this.client.sendResponse(new FriendRequestErrorComposer(FriendRequestErrorComposer.TARGET_NOT_ACCEPTING_REQUESTS));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// You can only have x friends
|
||||||
if (this.client.getHabbo().getMessenger().getFriends().values().size() >= this.client.getHabbo().getHabboStats().maxFriends && !this.client.getHabbo().hasPermission("acc_infinite_friends")) {
|
if (this.client.getHabbo().getMessenger().getFriends().values().size() >= this.client.getHabbo().getHabboStats().maxFriends && !this.client.getHabbo().hasPermission("acc_infinite_friends")) {
|
||||||
this.client.sendResponse(new FriendRequestErrorComposer(FriendRequestErrorComposer.FRIEND_LIST_OWN_FULL));
|
this.client.sendResponse(new FriendRequestErrorComposer(FriendRequestErrorComposer.FRIEND_LIST_OWN_FULL));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (habbo.getMessenger().getFriends().values().size() >= habbo.getHabboStats().maxFriends && !habbo.hasPermission("acc_infinite_friends")) {
|
// Check if targets friendlist is full
|
||||||
|
if (targetHabbo.getMessenger().getFriends().values().size() >= targetHabbo.getHabboStats().maxFriends && !targetHabbo.hasPermission("acc_infinite_friends")) {
|
||||||
this.client.sendResponse(new FriendRequestErrorComposer(FriendRequestErrorComposer.FRIEND_LIST_TARGET_FULL));
|
this.client.sendResponse(new FriendRequestErrorComposer(FriendRequestErrorComposer.FRIEND_LIST_TARGET_FULL));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Messenger.makeFriendRequest(this.client.getHabbo().getHabboInfo().getId(), id);
|
// Allow plugins to cancel the request
|
||||||
} else {
|
if (Emulator.getPluginManager().fireEvent(new UserRequestFriendshipEvent(this.client.getHabbo(), username, targetHabbo)).isCancelled()) {
|
||||||
this.client.sendResponse(new FriendRequestErrorComposer(FriendRequestErrorComposer.TARGET_NOT_FOUND));
|
this.client.sendResponse(new FriendRequestErrorComposer(2));
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(targetHabbo.isOnline()) {
|
||||||
|
targetHabbo.getClient().sendResponse(new FriendRequestComposer(this.client.getHabbo()));
|
||||||
|
}
|
||||||
|
|
||||||
|
Messenger.makeFriendRequest(this.client.getHabbo().getHabboInfo().getId(), targetId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,12 +20,11 @@ public class GuildAcceptMembershipEvent extends MessageHandler {
|
|||||||
int userId = this.packet.readInt();
|
int userId = this.packet.readInt();
|
||||||
|
|
||||||
Guild guild = Emulator.getGameEnvironment().getGuildManager().getGuild(guildId);
|
Guild guild = Emulator.getGameEnvironment().getGuildManager().getGuild(guildId);
|
||||||
|
|
||||||
if (guild == null || (guild.getOwnerId() != this.client.getHabbo().getHabboInfo().getId() && !Emulator.getGameEnvironment().getGuildManager().getOnlyAdmins(guild).containsKey(this.client.getHabbo().getHabboInfo().getId()) && !this.client.getHabbo().hasPermission(Permission.ACC_GUILD_ADMIN)))
|
|
||||||
return;
|
|
||||||
|
|
||||||
Habbo habbo = Emulator.getGameEnvironment().getHabboManager().getHabbo(userId);
|
Habbo habbo = Emulator.getGameEnvironment().getHabboManager().getHabbo(userId);
|
||||||
|
|
||||||
|
if (guild != null) {
|
||||||
|
GuildMember groupMember = Emulator.getGameEnvironment().getGuildManager().getGuildMember(guild, this.client.getHabbo());
|
||||||
|
if (userId == this.client.getHabbo().getHabboInfo().getId() || guild.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || groupMember.getRank().equals(GuildRank.ADMIN) || groupMember.getRank().equals(GuildRank.OWNER) || this.client.getHabbo().hasPermission(Permission.ACC_GUILD_ADMIN)) {
|
||||||
if (habbo != null) {
|
if (habbo != null) {
|
||||||
if (habbo.getHabboStats().hasGuild(guild.getId())) {
|
if (habbo.getHabboStats().hasGuild(guild.getId())) {
|
||||||
this.client.sendResponse(new GuildAcceptMemberErrorComposer(guild.getId(), GuildAcceptMemberErrorComposer.ALREADY_ACCEPTED));
|
this.client.sendResponse(new GuildAcceptMemberErrorComposer(guild.getId(), GuildAcceptMemberErrorComposer.ALREADY_ACCEPTED));
|
||||||
@ -60,3 +59,5 @@ public class GuildAcceptMembershipEvent extends MessageHandler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -17,11 +17,6 @@ public class GuildChangeSettingsEvent extends MessageHandler {
|
|||||||
|
|
||||||
if (guild != null) {
|
if (guild != null) {
|
||||||
if (guild.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || this.client.getHabbo().hasPermission(Permission.ACC_GUILD_ADMIN)) {
|
if (guild.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || this.client.getHabbo().hasPermission(Permission.ACC_GUILD_ADMIN)) {
|
||||||
Room room = Emulator.getGameEnvironment().getRoomManager().getRoom(guild.getRoomId());
|
|
||||||
|
|
||||||
if (room == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
GuildChangedSettingsEvent settingsEvent = new GuildChangedSettingsEvent(guild, this.packet.readInt(), this.packet.readInt() == 0);
|
GuildChangedSettingsEvent settingsEvent = new GuildChangedSettingsEvent(guild, this.packet.readInt(), this.packet.readInt() == 0);
|
||||||
Emulator.getPluginManager().fireEvent(settingsEvent);
|
Emulator.getPluginManager().fireEvent(settingsEvent);
|
||||||
|
|
||||||
@ -31,7 +26,10 @@ public class GuildChangeSettingsEvent extends MessageHandler {
|
|||||||
guild.setState(GuildState.valueOf(settingsEvent.state));
|
guild.setState(GuildState.valueOf(settingsEvent.state));
|
||||||
guild.setRights(settingsEvent.rights);
|
guild.setRights(settingsEvent.rights);
|
||||||
|
|
||||||
|
Room room = Emulator.getGameEnvironment().getRoomManager().getRoom(guild.getRoomId());
|
||||||
|
if(room != null) {
|
||||||
room.refreshGuild(guild);
|
room.refreshGuild(guild);
|
||||||
|
}
|
||||||
|
|
||||||
guild.needsUpdate = true;
|
guild.needsUpdate = true;
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ public class GuildConfirmRemoveMemberEvent extends MessageHandler {
|
|||||||
|
|
||||||
if (guild != null) {
|
if (guild != null) {
|
||||||
GuildMember member = Emulator.getGameEnvironment().getGuildManager().getGuildMember(guild, this.client.getHabbo());
|
GuildMember member = Emulator.getGameEnvironment().getGuildManager().getGuildMember(guild, this.client.getHabbo());
|
||||||
if (userId == this.client.getHabbo().getHabboInfo().getId() || guild.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || (member != null && member.getRank().equals(GuildRank.OWNER)) || this.client.getHabbo().hasPermission(Permission.ACC_GUILD_ADMIN)) {
|
if (userId == this.client.getHabbo().getHabboInfo().getId() || guild.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || (member != null && member.getRank().equals(GuildRank.OWNER) || member.getRank().equals(GuildRank.ADMIN)) || this.client.getHabbo().hasPermission(Permission.ACC_GUILD_ADMIN)) {
|
||||||
Room room = Emulator.getGameEnvironment().getRoomManager().loadRoom(guild.getRoomId());
|
Room room = Emulator.getGameEnvironment().getRoomManager().loadRoom(guild.getRoomId());
|
||||||
int count = 0;
|
int count = 0;
|
||||||
if (room != null) {
|
if (room != null) {
|
||||||
|
@ -23,7 +23,7 @@ public class GuildDeclineMembershipEvent extends MessageHandler {
|
|||||||
|
|
||||||
if (guild != null) {
|
if (guild != null) {
|
||||||
GuildMember member = Emulator.getGameEnvironment().getGuildManager().getGuildMember(guild, this.client.getHabbo());
|
GuildMember member = Emulator.getGameEnvironment().getGuildManager().getGuildMember(guild, this.client.getHabbo());
|
||||||
if (userId == this.client.getHabbo().getHabboInfo().getId() || guild.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || member.getRank().equals(GuildRank.OWNER) || this.client.getHabbo().hasPermission(Permission.ACC_GUILD_ADMIN)) {
|
if (userId == this.client.getHabbo().getHabboInfo().getId() || guild.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || member.getRank().equals(GuildRank.ADMIN)|| member.getRank().equals(GuildRank.OWNER) || this.client.getHabbo().hasPermission(Permission.ACC_GUILD_ADMIN)) {
|
||||||
guild.decreaseRequestCount();
|
guild.decreaseRequestCount();
|
||||||
Emulator.getGameEnvironment().getGuildManager().removeMember(guild, userId);
|
Emulator.getGameEnvironment().getGuildManager().removeMember(guild, userId);
|
||||||
this.client.sendResponse(new GuildMembersComposer(guild, Emulator.getGameEnvironment().getGuildManager().getGuildMembers(guild, 0, 0, ""), this.client.getHabbo(), 0, 0, "", true, Emulator.getGameEnvironment().getGuildManager().getGuildMembersCount(guild, 0, 0, "")));
|
this.client.sendResponse(new GuildMembersComposer(guild, Emulator.getGameEnvironment().getGuildManager().getGuildMembers(guild, 0, 0, ""), this.client.getHabbo(), 0, 0, "", true, Emulator.getGameEnvironment().getGuildManager().getGuildMembersCount(guild, 0, 0, "")));
|
||||||
|
@ -24,7 +24,7 @@ public class GuildRemoveMemberEvent extends MessageHandler {
|
|||||||
|
|
||||||
if (guild != null) {
|
if (guild != null) {
|
||||||
GuildMember member = Emulator.getGameEnvironment().getGuildManager().getGuildMember(guild, this.client.getHabbo());
|
GuildMember member = Emulator.getGameEnvironment().getGuildManager().getGuildMember(guild, this.client.getHabbo());
|
||||||
if (userId == this.client.getHabbo().getHabboInfo().getId() || guild.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || member.getRank().equals(GuildRank.OWNER) || this.client.getHabbo().hasPermission(Permission.ACC_GUILD_ADMIN)) {
|
if (userId == this.client.getHabbo().getHabboInfo().getId() || guild.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || member.getRank().equals(GuildRank.OWNER) || member.getRank().equals(GuildRank.ADMIN) || this.client.getHabbo().hasPermission(Permission.ACC_GUILD_ADMIN)) {
|
||||||
Habbo habbo = Emulator.getGameEnvironment().getHabboManager().getHabbo(userId);
|
Habbo habbo = Emulator.getGameEnvironment().getHabboManager().getHabbo(userId);
|
||||||
GuildRemovedMemberEvent removedMemberEvent = new GuildRemovedMemberEvent(guild, userId, habbo);
|
GuildRemovedMemberEvent removedMemberEvent = new GuildRemovedMemberEvent(guild, userId, habbo);
|
||||||
Emulator.getPluginManager().fireEvent(removedMemberEvent);
|
Emulator.getPluginManager().fireEvent(removedMemberEvent);
|
||||||
|
@ -37,7 +37,7 @@ public class GuildForumModerateMessageEvent extends MessageHandler {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean isStaff = this.client.getHabbo().hasPermission(Permission.ACC_MODTOOL_TICKET_Q);
|
boolean hasStaffPermissions = this.client.getHabbo().hasPermission(Permission.ACC_MODTOOL_TICKET_Q);
|
||||||
|
|
||||||
GuildMember member = Emulator.getGameEnvironment().getGuildManager().getGuildMember(guildId, this.client.getHabbo().getHabboInfo().getId());
|
GuildMember member = Emulator.getGameEnvironment().getGuildManager().getGuildMember(guildId, this.client.getHabbo().getHabboInfo().getId());
|
||||||
if (member == null) {
|
if (member == null) {
|
||||||
@ -45,14 +45,14 @@ public class GuildForumModerateMessageEvent extends MessageHandler {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean isAdmin = (guild.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || member.getRank().type < GuildRank.MEMBER.type);
|
boolean isGuildAdministrator = (guild.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || member.getRank().equals(GuildRank.ADMIN));
|
||||||
|
|
||||||
if (!isAdmin && !isStaff) {
|
if (!isGuildAdministrator && !hasStaffPermissions) {
|
||||||
this.client.sendResponse(new ConnectionErrorComposer(403));
|
this.client.sendResponse(new ConnectionErrorComposer(403));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state == ForumThreadState.HIDDEN_BY_STAFF.getStateId() && !isStaff) {
|
if (state == ForumThreadState.HIDDEN_BY_GUILD_ADMIN.getStateId() && !hasStaffPermissions) {
|
||||||
this.client.sendResponse(new ConnectionErrorComposer(403));
|
this.client.sendResponse(new ConnectionErrorComposer(403));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,8 @@ public class GuildForumModerateThreadEvent extends MessageHandler {
|
|||||||
int guildId = packet.readInt();
|
int guildId = packet.readInt();
|
||||||
int threadId = packet.readInt();
|
int threadId = packet.readInt();
|
||||||
int state = packet.readInt();
|
int state = packet.readInt();
|
||||||
|
// STATE 20 - HIDDEN_BY_GUILD_ADMIN = HIDDEN BY GUILD ADMINS/ HOTEL MODERATORS
|
||||||
|
// STATE 1 = VISIBLE THREAD
|
||||||
|
|
||||||
Guild guild = Emulator.getGameEnvironment().getGuildManager().getGuild(guildId);
|
Guild guild = Emulator.getGameEnvironment().getGuildManager().getGuild(guildId);
|
||||||
ForumThread thread = ForumThread.getById(threadId);
|
ForumThread thread = ForumThread.getById(threadId);
|
||||||
@ -30,29 +32,21 @@ public class GuildForumModerateThreadEvent extends MessageHandler {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean isStaff = this.client.getHabbo().hasPermission(Permission.ACC_MODTOOL_TICKET_Q);
|
|
||||||
|
|
||||||
GuildMember member = Emulator.getGameEnvironment().getGuildManager().getGuildMember(guildId, this.client.getHabbo().getHabboInfo().getId());
|
GuildMember member = Emulator.getGameEnvironment().getGuildManager().getGuildMember(guildId, this.client.getHabbo().getHabboInfo().getId());
|
||||||
|
boolean hasStaffPerms = this.client.getHabbo().hasPermission(Permission.ACC_MODTOOL_TICKET_Q); // check for if they have staff perm
|
||||||
|
boolean isGuildAdmin = (guild.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || member.getRank().equals(GuildRank.ADMIN));
|
||||||
|
|
||||||
|
|
||||||
if (member == null) {
|
if (member == null) {
|
||||||
this.client.sendResponse(new ConnectionErrorComposer(401));
|
this.client.sendResponse(new ConnectionErrorComposer(401));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (!isGuildAdmin && !hasStaffPerms) {
|
||||||
boolean isAdmin = (guild.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || member.getRank().type < GuildRank.MEMBER.type);
|
|
||||||
|
|
||||||
if (!isAdmin && !isStaff) {
|
|
||||||
this.client.sendResponse(new ConnectionErrorComposer(403));
|
this.client.sendResponse(new ConnectionErrorComposer(403));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state == ForumThreadState.HIDDEN_BY_STAFF.getStateId() && !isStaff) {
|
thread.setState(ForumThreadState.fromValue(state)); // sets state as defined in the packet
|
||||||
this.client.sendResponse(new ConnectionErrorComposer(403));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
thread.setState(ForumThreadState.fromValue(state));
|
|
||||||
thread.setAdminId(this.client.getHabbo().getHabboInfo().getId());
|
|
||||||
|
|
||||||
thread.run();
|
thread.run();
|
||||||
|
|
||||||
switch (state) {
|
switch (state) {
|
||||||
|
@ -2,14 +2,21 @@ package com.eu.habbo.messages.incoming.guilds.forums;
|
|||||||
|
|
||||||
import com.eu.habbo.Emulator;
|
import com.eu.habbo.Emulator;
|
||||||
import com.eu.habbo.habbohotel.guilds.Guild;
|
import com.eu.habbo.habbohotel.guilds.Guild;
|
||||||
|
import com.eu.habbo.habbohotel.guilds.GuildMember;
|
||||||
|
import com.eu.habbo.habbohotel.guilds.GuildRank;
|
||||||
|
import com.eu.habbo.habbohotel.guilds.GuildState;
|
||||||
import com.eu.habbo.habbohotel.guilds.forums.ForumThread;
|
import com.eu.habbo.habbohotel.guilds.forums.ForumThread;
|
||||||
import com.eu.habbo.habbohotel.guilds.forums.ForumThreadState;
|
import com.eu.habbo.habbohotel.guilds.forums.ForumThreadState;
|
||||||
|
import com.eu.habbo.habbohotel.permissions.Permission;
|
||||||
import com.eu.habbo.messages.incoming.MessageHandler;
|
import com.eu.habbo.messages.incoming.MessageHandler;
|
||||||
import com.eu.habbo.messages.outgoing.generic.alerts.BubbleAlertComposer;
|
import com.eu.habbo.messages.outgoing.generic.alerts.BubbleAlertComposer;
|
||||||
|
import com.eu.habbo.messages.outgoing.generic.alerts.BubbleAlertKeys;
|
||||||
import com.eu.habbo.messages.outgoing.guilds.forums.GuildForumCommentsComposer;
|
import com.eu.habbo.messages.outgoing.guilds.forums.GuildForumCommentsComposer;
|
||||||
import com.eu.habbo.messages.outgoing.guilds.forums.GuildForumDataComposer;
|
import com.eu.habbo.messages.outgoing.guilds.forums.GuildForumDataComposer;
|
||||||
import com.eu.habbo.messages.outgoing.handshake.ConnectionErrorComposer;
|
import com.eu.habbo.messages.outgoing.handshake.ConnectionErrorComposer;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public class GuildForumThreadsMessagesEvent extends MessageHandler {
|
public class GuildForumThreadsMessagesEvent extends MessageHandler {
|
||||||
@Override
|
@Override
|
||||||
public void handle() throws Exception {
|
public void handle() throws Exception {
|
||||||
@ -18,20 +25,23 @@ public class GuildForumThreadsMessagesEvent extends MessageHandler {
|
|||||||
int index = packet.readInt(); // 40
|
int index = packet.readInt(); // 40
|
||||||
int limit = packet.readInt(); // 20
|
int limit = packet.readInt(); // 20
|
||||||
|
|
||||||
|
|
||||||
Guild guild = Emulator.getGameEnvironment().getGuildManager().getGuild(guildId);
|
Guild guild = Emulator.getGameEnvironment().getGuildManager().getGuild(guildId);
|
||||||
ForumThread thread = ForumThread.getById(threadId);
|
ForumThread thread = ForumThread.getById(threadId);
|
||||||
|
boolean hasStaffPermissions = this.client.getHabbo().hasPermission(Permission.ACC_MODTOOL_TICKET_Q);
|
||||||
if (guild == null || thread == null) {
|
if (guild == null || thread == null) {
|
||||||
this.client.sendResponse(new ConnectionErrorComposer(404));
|
this.client.sendResponse(new ConnectionErrorComposer(404));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
GuildMember member = Emulator.getGameEnvironment().getGuildManager().getGuildMember(guildId, this.client.getHabbo().getHabboInfo().getId());
|
||||||
|
boolean isGuildAdministrator = (guild.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || member.getRank().equals(GuildRank.ADMIN));
|
||||||
|
|
||||||
if ((thread.getState() == ForumThreadState.HIDDEN_BY_ADMIN || thread.getState() == ForumThreadState.HIDDEN_BY_STAFF) && guild.getOwnerId() != this.client.getHabbo().getHabboInfo().getId()) {
|
if (thread.getState() != ForumThreadState.HIDDEN_BY_GUILD_ADMIN || hasStaffPermissions || isGuildAdministrator) {
|
||||||
this.client.sendResponse(new BubbleAlertComposer("oldforums.error.access_denied"));
|
|
||||||
} else {
|
|
||||||
this.client.sendResponse(new GuildForumCommentsComposer(guildId, threadId, index, thread.getComments(limit, index)));
|
this.client.sendResponse(new GuildForumCommentsComposer(guildId, threadId, index, thread.getComments(limit, index)));
|
||||||
}
|
|
||||||
|
|
||||||
this.client.sendResponse(new GuildForumDataComposer(guild, this.client.getHabbo()));
|
this.client.sendResponse(new GuildForumDataComposer(guild, this.client.getHabbo()));
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
this.client.sendResponse(new BubbleAlertComposer(BubbleAlertKeys.FORUMS_ACCESS_DENIED.key).compose());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
@ -6,6 +6,7 @@ import com.eu.habbo.habbohotel.modtool.ModToolSanctionItem;
|
|||||||
import com.eu.habbo.habbohotel.modtool.ModToolSanctions;
|
import com.eu.habbo.habbohotel.modtool.ModToolSanctions;
|
||||||
import com.eu.habbo.habbohotel.navigation.NavigatorSavedSearch;
|
import com.eu.habbo.habbohotel.navigation.NavigatorSavedSearch;
|
||||||
import com.eu.habbo.habbohotel.permissions.Permission;
|
import com.eu.habbo.habbohotel.permissions.Permission;
|
||||||
|
import com.eu.habbo.habbohotel.rooms.RoomManager;
|
||||||
import com.eu.habbo.habbohotel.users.Habbo;
|
import com.eu.habbo.habbohotel.users.Habbo;
|
||||||
import com.eu.habbo.habbohotel.users.HabboManager;
|
import com.eu.habbo.habbohotel.users.HabboManager;
|
||||||
import com.eu.habbo.habbohotel.users.clothingvalidation.ClothingValidationManager;
|
import com.eu.habbo.habbohotel.users.clothingvalidation.ClothingValidationManager;
|
||||||
@ -13,7 +14,6 @@ import com.eu.habbo.habbohotel.users.subscriptions.SubscriptionHabboClub;
|
|||||||
import com.eu.habbo.messages.NoAuthMessage;
|
import com.eu.habbo.messages.NoAuthMessage;
|
||||||
import com.eu.habbo.messages.ServerMessage;
|
import com.eu.habbo.messages.ServerMessage;
|
||||||
import com.eu.habbo.messages.incoming.MessageHandler;
|
import com.eu.habbo.messages.incoming.MessageHandler;
|
||||||
import com.eu.habbo.messages.outgoing.achievements.AchievementListComposer;
|
|
||||||
import com.eu.habbo.messages.outgoing.gamecenter.GameCenterAccountInfoComposer;
|
import com.eu.habbo.messages.outgoing.gamecenter.GameCenterAccountInfoComposer;
|
||||||
import com.eu.habbo.messages.outgoing.gamecenter.GameCenterGameListComposer;
|
import com.eu.habbo.messages.outgoing.gamecenter.GameCenterGameListComposer;
|
||||||
import com.eu.habbo.messages.outgoing.generic.alerts.GenericAlertComposer;
|
import com.eu.habbo.messages.outgoing.generic.alerts.GenericAlertComposer;
|
||||||
@ -24,13 +24,13 @@ import com.eu.habbo.messages.outgoing.handshake.SecureLoginOKComposer;
|
|||||||
import com.eu.habbo.messages.outgoing.handshake.AvailabilityStatusMessageComposer;
|
import com.eu.habbo.messages.outgoing.handshake.AvailabilityStatusMessageComposer;
|
||||||
import com.eu.habbo.messages.outgoing.handshake.PingComposer;
|
import com.eu.habbo.messages.outgoing.handshake.PingComposer;
|
||||||
import com.eu.habbo.messages.outgoing.inventory.InventoryAchievementsComposer;
|
import com.eu.habbo.messages.outgoing.inventory.InventoryAchievementsComposer;
|
||||||
import com.eu.habbo.messages.outgoing.inventory.InventoryRefreshComposer;
|
|
||||||
import com.eu.habbo.messages.outgoing.inventory.UserEffectsListComposer;
|
import com.eu.habbo.messages.outgoing.inventory.UserEffectsListComposer;
|
||||||
import com.eu.habbo.messages.outgoing.modtool.CfhTopicsMessageComposer;
|
import com.eu.habbo.messages.outgoing.modtool.CfhTopicsMessageComposer;
|
||||||
import com.eu.habbo.messages.outgoing.modtool.ModToolComposer;
|
import com.eu.habbo.messages.outgoing.modtool.ModToolComposer;
|
||||||
import com.eu.habbo.messages.outgoing.modtool.ModToolSanctionInfoComposer;
|
import com.eu.habbo.messages.outgoing.modtool.ModToolSanctionInfoComposer;
|
||||||
import com.eu.habbo.messages.outgoing.navigator.*;
|
import com.eu.habbo.messages.outgoing.navigator.*;
|
||||||
import com.eu.habbo.messages.outgoing.unknown.BuildersClubExpiredComposer;
|
import com.eu.habbo.messages.outgoing.unknown.BuildersClubExpiredComposer;
|
||||||
|
import com.eu.habbo.messages.outgoing.mysterybox.MysteryBoxKeysComposer;
|
||||||
import com.eu.habbo.messages.outgoing.users.*;
|
import com.eu.habbo.messages.outgoing.users.*;
|
||||||
import com.eu.habbo.plugin.events.emulator.SSOAuthenticationEvent;
|
import com.eu.habbo.plugin.events.emulator.SSOAuthenticationEvent;
|
||||||
import com.eu.habbo.plugin.events.users.UserLoginEvent;
|
import com.eu.habbo.plugin.events.users.UserLoginEvent;
|
||||||
@ -73,7 +73,7 @@ public class SecureLoginEvent extends MessageHandler {
|
|||||||
|
|
||||||
if (sso.isEmpty()) {
|
if (sso.isEmpty()) {
|
||||||
Emulator.getGameServer().getGameClientManager().disposeClient(this.client);
|
Emulator.getGameServer().getGameClientManager().disposeClient(this.client);
|
||||||
LOGGER.warn("Client is trying to connect without SSO ticket! Closed connection...");
|
LOGGER.debug("Client is trying to connect without SSO ticket! Closed connection...");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -115,7 +115,15 @@ public class SecureLoginEvent extends MessageHandler {
|
|||||||
ArrayList<ServerMessage> messages = new ArrayList<>();
|
ArrayList<ServerMessage> messages = new ArrayList<>();
|
||||||
|
|
||||||
messages.add(new SecureLoginOKComposer().compose());
|
messages.add(new SecureLoginOKComposer().compose());
|
||||||
messages.add(new UserHomeRoomComposer(this.client.getHabbo().getHabboInfo().getHomeRoom(), 0).compose());
|
|
||||||
|
int roomIdToEnter = 0;
|
||||||
|
|
||||||
|
if (!this.client.getHabbo().getHabboStats().nux || Emulator.getConfig().getBoolean("retro.style.homeroom") && this.client.getHabbo().getHabboInfo().getHomeRoom() != 0)
|
||||||
|
roomIdToEnter = this.client.getHabbo().getHabboInfo().getHomeRoom();
|
||||||
|
else if (!this.client.getHabbo().getHabboStats().nux || Emulator.getConfig().getBoolean("retro.style.homeroom") && RoomManager.HOME_ROOM_ID > 0)
|
||||||
|
roomIdToEnter = RoomManager.HOME_ROOM_ID;
|
||||||
|
|
||||||
|
messages.add(new UserHomeRoomComposer(this.client.getHabbo().getHabboInfo().getHomeRoom(), roomIdToEnter).compose());
|
||||||
messages.add(new UserEffectsListComposer(habbo, this.client.getHabbo().getInventory().getEffectsComponent().effects.values()).compose());
|
messages.add(new UserEffectsListComposer(habbo, this.client.getHabbo().getInventory().getEffectsComponent().effects.values()).compose());
|
||||||
messages.add(new UserClothesComposer(this.client.getHabbo()).compose());
|
messages.add(new UserClothesComposer(this.client.getHabbo()).compose());
|
||||||
messages.add(new NewUserIdentityComposer(habbo).compose());
|
messages.add(new NewUserIdentityComposer(habbo).compose());
|
||||||
@ -125,7 +133,7 @@ public class SecureLoginEvent extends MessageHandler {
|
|||||||
messages.add(new EnableNotificationsComposer(Emulator.getConfig().getBoolean("bubblealerts.enabled", true)).compose());
|
messages.add(new EnableNotificationsComposer(Emulator.getConfig().getBoolean("bubblealerts.enabled", true)).compose());
|
||||||
messages.add(new UserAchievementScoreComposer(this.client.getHabbo()).compose());
|
messages.add(new UserAchievementScoreComposer(this.client.getHabbo()).compose());
|
||||||
messages.add(new IsFirstLoginOfDayComposer(true).compose());
|
messages.add(new IsFirstLoginOfDayComposer(true).compose());
|
||||||
messages.add(new UnknownComposer5().compose());
|
messages.add(new MysteryBoxKeysComposer().compose());
|
||||||
messages.add(new BuildersClubExpiredComposer().compose());
|
messages.add(new BuildersClubExpiredComposer().compose());
|
||||||
messages.add(new CfhTopicsMessageComposer().compose());
|
messages.add(new CfhTopicsMessageComposer().compose());
|
||||||
messages.add(new FavoriteRoomsCountComposer(this.client.getHabbo()).compose());
|
messages.add(new FavoriteRoomsCountComposer(this.client.getHabbo()).compose());
|
||||||
@ -133,8 +141,6 @@ public class SecureLoginEvent extends MessageHandler {
|
|||||||
messages.add(new GameCenterAccountInfoComposer(3, 100).compose());
|
messages.add(new GameCenterAccountInfoComposer(3, 100).compose());
|
||||||
messages.add(new GameCenterAccountInfoComposer(0, 100).compose());
|
messages.add(new GameCenterAccountInfoComposer(0, 100).compose());
|
||||||
|
|
||||||
//messages.add(new MessengerInitComposer(this.client.getHabbo()).compose());
|
|
||||||
//messages.add(new FriendsComposer(this.client.getHabbo()).compose());
|
|
||||||
messages.add(new UserClubComposer(this.client.getHabbo(), SubscriptionHabboClub.HABBO_CLUB, UserClubComposer.RESPONSE_TYPE_LOGIN).compose());
|
messages.add(new UserClubComposer(this.client.getHabbo(), SubscriptionHabboClub.HABBO_CLUB, UserClubComposer.RESPONSE_TYPE_LOGIN).compose());
|
||||||
|
|
||||||
if (this.client.getHabbo().hasPermission(Permission.ACC_SUPPORTTOOL)) {
|
if (this.client.getHabbo().hasPermission(Permission.ACC_SUPPORTTOOL)) {
|
||||||
@ -144,16 +150,8 @@ public class SecureLoginEvent extends MessageHandler {
|
|||||||
this.client.sendResponses(messages);
|
this.client.sendResponses(messages);
|
||||||
|
|
||||||
//Hardcoded
|
//Hardcoded
|
||||||
this.client.sendResponse(new NewNavigatorSettingsComposer(this.client.getHabbo().getHabboStats().navigatorWindowSettings));
|
|
||||||
this.client.sendResponse(new NewNavigatorMetaDataComposer());
|
|
||||||
this.client.sendResponse(new NewNavigatorLiftedRoomsComposer());
|
|
||||||
this.client.sendResponse(new NewNavigatorCollapsedCategoriesComposer());
|
|
||||||
this.client.sendResponse(new NewNavigatorSavedSearchesComposer(this.client.getHabbo().getHabboInfo().getSavedSearches()));
|
|
||||||
this.client.sendResponse(new NewNavigatorEventCategoriesComposer());
|
|
||||||
this.client.sendResponse(new InventoryRefreshComposer());
|
|
||||||
//this.client.sendResponse(new ForumsTestComposer());
|
//this.client.sendResponse(new ForumsTestComposer());
|
||||||
this.client.sendResponse(new InventoryAchievementsComposer());
|
this.client.sendResponse(new InventoryAchievementsComposer());
|
||||||
this.client.sendResponse(new AchievementListComposer(this.client.getHabbo()));
|
|
||||||
|
|
||||||
ModToolSanctions modToolSanctions = Emulator.getGameEnvironment().getModToolSanctions();
|
ModToolSanctions modToolSanctions = Emulator.getGameEnvironment().getModToolSanctions();
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@ package com.eu.habbo.messages.incoming.handshake;
|
|||||||
|
|
||||||
import com.eu.habbo.Emulator;
|
import com.eu.habbo.Emulator;
|
||||||
import com.eu.habbo.habbohotel.achievements.AchievementManager;
|
import com.eu.habbo.habbohotel.achievements.AchievementManager;
|
||||||
|
import com.eu.habbo.habbohotel.campaign.calendar.CalendarCampaign;
|
||||||
import com.eu.habbo.habbohotel.catalog.TargetOffer;
|
import com.eu.habbo.habbohotel.catalog.TargetOffer;
|
||||||
import com.eu.habbo.messages.incoming.MessageHandler;
|
import com.eu.habbo.messages.incoming.MessageHandler;
|
||||||
import com.eu.habbo.messages.outgoing.catalog.TargetedOfferComposer;
|
import com.eu.habbo.messages.outgoing.catalog.TargetedOfferComposer;
|
||||||
@ -11,9 +12,14 @@ import com.eu.habbo.messages.outgoing.habboway.nux.NuxAlertComposer;
|
|||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
|
import java.sql.Timestamp;
|
||||||
|
import java.time.Duration;
|
||||||
import java.time.temporal.ChronoUnit;
|
import java.time.temporal.ChronoUnit;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
import static java.time.temporal.ChronoUnit.DAYS;
|
||||||
|
|
||||||
public class UsernameEvent extends MessageHandler {
|
public class UsernameEvent extends MessageHandler {
|
||||||
@Override
|
@Override
|
||||||
@ -24,7 +30,7 @@ public class UsernameEvent extends MessageHandler {
|
|||||||
calendar = true;
|
calendar = true;
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
long daysBetween = ChronoUnit.DAYS.between(new Date((long) this.client.getHabbo().getHabboInfo().getLastOnline() * 1000L).toInstant(), new Date().toInstant());
|
long daysBetween = DAYS.between(new Date((long) this.client.getHabbo().getHabboInfo().getLastOnline() * 1000L).toInstant(), new Date().toInstant());
|
||||||
|
|
||||||
|
|
||||||
Date lastLogin = new Date(this.client.getHabbo().getHabboInfo().getLastOnline());
|
Date lastLogin = new Date(this.client.getHabbo().getHabboInfo().getLastOnline());
|
||||||
@ -82,11 +88,16 @@ public class UsernameEvent extends MessageHandler {
|
|||||||
deleteStatement.execute();
|
deleteStatement.execute();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Emulator.getConfig().getBoolean("hotel.calendar.enabled")) {
|
if (Emulator.getConfig().getBoolean("hotel.calendar.enabled")) {
|
||||||
this.client.sendResponse(new AdventCalendarDataComposer("xmas15", Emulator.getGameEnvironment().getCatalogManager().calendarRewards.size(), (int) Math.floor((Emulator.getIntUnixTimestamp() - Emulator.getConfig().getInt("hotel.calendar.starttimestamp")) / 86400), this.client.getHabbo().getHabboStats().calendarRewardsClaimed, true));
|
CalendarCampaign campaign = Emulator.getGameEnvironment().getCalendarManager().getCalendarCampaign(Emulator.getConfig().getValue("hotel.calendar.default"));
|
||||||
|
if(campaign != null){
|
||||||
|
long daysBetween = DAYS.between(new Timestamp(campaign.getStartTimestamp() * 1000L).toInstant(), new Date().toInstant());
|
||||||
|
if(daysBetween >= 0) {
|
||||||
|
this.client.sendResponse(new AdventCalendarDataComposer(campaign.getName(), campaign.getImage(), campaign.getTotalDays(), (int) daysBetween, this.client.getHabbo().getHabboStats().calendarRewardsClaimed, campaign.getLockExpired()));
|
||||||
this.client.sendResponse(new NuxAlertComposer("openView/calendar"));
|
this.client.sendResponse(new NuxAlertComposer("openView/calendar"));
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
if (TargetOffer.ACTIVE_TARGET_OFFER_ID > 0) {
|
if (TargetOffer.ACTIVE_TARGET_OFFER_ID > 0) {
|
||||||
TargetOffer offer = Emulator.getGameEnvironment().getCatalogManager().getTargetOffer(TargetOffer.ACTIVE_TARGET_OFFER_ID);
|
TargetOffer offer = Emulator.getGameEnvironment().getCatalogManager().getTargetOffer(TargetOffer.ACTIVE_TARGET_OFFER_ID);
|
||||||
|
@ -3,6 +3,7 @@ package com.eu.habbo.messages.incoming.hotelview;
|
|||||||
import com.eu.habbo.Emulator;
|
import com.eu.habbo.Emulator;
|
||||||
import com.eu.habbo.habbohotel.rooms.Room;
|
import com.eu.habbo.habbohotel.rooms.Room;
|
||||||
import com.eu.habbo.messages.incoming.MessageHandler;
|
import com.eu.habbo.messages.incoming.MessageHandler;
|
||||||
|
import com.eu.habbo.messages.outgoing.hotelview.HotelViewComposer;
|
||||||
|
|
||||||
public class HotelViewEvent extends MessageHandler {
|
public class HotelViewEvent extends MessageHandler {
|
||||||
@Override
|
@Override
|
||||||
@ -21,6 +22,7 @@ public class HotelViewEvent extends MessageHandler {
|
|||||||
} else {
|
} else {
|
||||||
this.client.getHabbo().getHabboInfo().setRoomQueueId(0);
|
this.client.getHabbo().getHabboInfo().setRoomQueueId(0);
|
||||||
}
|
}
|
||||||
|
this.client.sendResponse(new HotelViewComposer());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.client.getHabbo().getRoomUnit() != null) {
|
if (this.client.getHabbo().getRoomUnit() != null) {
|
||||||
|
@ -17,20 +17,30 @@ public class RequestInventoryItemsEvent extends MessageHandler {
|
|||||||
@Override
|
@Override
|
||||||
public void handle() throws Exception {
|
public void handle() throws Exception {
|
||||||
int totalItems = this.client.getHabbo().getInventory().getItemsComponent().getItems().size();
|
int totalItems = this.client.getHabbo().getInventory().getItemsComponent().getItems().size();
|
||||||
int pages = (int) Math.ceil((double) totalItems / 1000.0);
|
|
||||||
|
|
||||||
if (pages == 0) {
|
if (totalItems == 0) {
|
||||||
pages = 1;
|
this.client.sendResponse(new InventoryItemsComposer(0, 1, new TIntObjectHashMap<>()));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int totalFragments = (int) Math.ceil((double) totalItems / 1000.0);
|
||||||
|
|
||||||
|
if (totalFragments == 0) {
|
||||||
|
totalFragments = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
synchronized (this.client.getHabbo().getInventory().getItemsComponent().getItems()) {
|
synchronized (this.client.getHabbo().getInventory().getItemsComponent().getItems()) {
|
||||||
TIntObjectMap<HabboItem> items = new TIntObjectHashMap<>();
|
TIntObjectMap<HabboItem> items = new TIntObjectHashMap<>();
|
||||||
|
|
||||||
TIntObjectIterator<HabboItem> iterator = this.client.getHabbo().getInventory().getItemsComponent().getItems().iterator();
|
TIntObjectIterator<HabboItem> iterator = this.client.getHabbo().getInventory().getItemsComponent().getItems().iterator();
|
||||||
|
|
||||||
int count = 0;
|
int count = 0;
|
||||||
int page = 0;
|
int fragmentNumber = 0;
|
||||||
|
|
||||||
for (int i = this.client.getHabbo().getInventory().getItemsComponent().getItems().size(); i-- > 0; ) {
|
for (int i = this.client.getHabbo().getInventory().getItemsComponent().getItems().size(); i-- > 0; ) {
|
||||||
|
|
||||||
if (count == 0) {
|
if (count == 0) {
|
||||||
page++;
|
fragmentNumber++;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -43,13 +53,13 @@ public class RequestInventoryItemsEvent extends MessageHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (count == 1000) {
|
if (count == 1000) {
|
||||||
this.client.sendResponse(new InventoryItemsComposer(page, pages, items));
|
this.client.sendResponse(new InventoryItemsComposer(fragmentNumber, totalFragments, items));
|
||||||
count = 0;
|
count = 0;
|
||||||
items.clear();
|
items.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.client.sendResponse(new InventoryItemsComposer(page, pages, items));
|
if(count > 0 && items.size() > 0) this.client.sendResponse(new InventoryItemsComposer(fragmentNumber, totalFragments, items));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@ public class RequestCanCreateRoomEvent extends MessageHandler {
|
|||||||
@Override
|
@Override
|
||||||
public void handle() throws Exception {
|
public void handle() throws Exception {
|
||||||
int count = Emulator.getGameEnvironment().getRoomManager().getRoomsForHabbo(this.client.getHabbo()).size();
|
int count = Emulator.getGameEnvironment().getRoomManager().getRoomsForHabbo(this.client.getHabbo()).size();
|
||||||
int max = this.client.getHabbo().getHabboStats().maxRooms;
|
int max = this.client.getHabbo().getHabboStats().hasActiveClub() ? RoomManager.MAXIMUM_ROOMS_HC : RoomManager.MAXIMUM_ROOMS_USER;
|
||||||
this.client.sendResponse(new CanCreateRoomComposer(count, max));
|
this.client.sendResponse(new CanCreateRoomComposer(count, max));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,7 @@ public class RequestCreateRoomEvent extends MessageHandler {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
int count = Emulator.getGameEnvironment().getRoomManager().getRoomsForHabbo(this.client.getHabbo()).size();
|
int count = Emulator.getGameEnvironment().getRoomManager().getRoomsForHabbo(this.client.getHabbo()).size();
|
||||||
int max = this.client.getHabbo().getHabboStats().maxRooms;
|
int max = this.client.getHabbo().getHabboStats().hasActiveClub() ? RoomManager.MAXIMUM_ROOMS_HC : RoomManager.MAXIMUM_ROOMS_USER;
|
||||||
|
|
||||||
if (count >= max) {
|
if (count >= max) {
|
||||||
this.client.sendResponse(new CanCreateRoomComposer(count, max));
|
this.client.sendResponse(new CanCreateRoomComposer(count, max));
|
||||||
|
@ -12,6 +12,5 @@ public class RequestNewNavigatorDataEvent extends MessageHandler {
|
|||||||
this.client.sendResponse(new NewNavigatorCollapsedCategoriesComposer());
|
this.client.sendResponse(new NewNavigatorCollapsedCategoriesComposer());
|
||||||
this.client.sendResponse(new NewNavigatorSavedSearchesComposer(this.client.getHabbo().getHabboInfo().getSavedSearches()));
|
this.client.sendResponse(new NewNavigatorSavedSearchesComposer(this.client.getHabbo().getHabboInfo().getSavedSearches()));
|
||||||
this.client.sendResponse(new NewNavigatorEventCategoriesComposer());
|
this.client.sendResponse(new NewNavigatorEventCategoriesComposer());
|
||||||
this.client.sendResponse(new NewNavigatorSettingsComposer(this.client.getHabbo().getHabboStats().navigatorWindowSettings));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,12 +21,15 @@ public class AnswerPollEvent extends MessageHandler {
|
|||||||
int pollId = this.packet.readInt();
|
int pollId = this.packet.readInt();
|
||||||
int questionId = this.packet.readInt();
|
int questionId = this.packet.readInt();
|
||||||
int count = this.packet.readInt();
|
int count = this.packet.readInt();
|
||||||
|
String answers = this.packet.readString();
|
||||||
|
|
||||||
StringBuilder answer = new StringBuilder();
|
StringBuilder answer = new StringBuilder();
|
||||||
for (int i = 0; i < count; i++) {
|
for (int i = 0; i < count; i++) {
|
||||||
answer.append(":").append(this.packet.readString());
|
answer.append(":").append(answers);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(answer.length() <= 0) return;
|
||||||
|
|
||||||
if (pollId == 0 && questionId <= 0) {
|
if (pollId == 0 && questionId <= 0) {
|
||||||
this.client.getHabbo().getHabboInfo().getCurrentRoom().handleWordQuiz(this.client.getHabbo(), answer.toString());
|
this.client.getHabbo().getHabboInfo().getCurrentRoom().handleWordQuiz(this.client.getHabbo(), answer.toString());
|
||||||
return;
|
return;
|
||||||
@ -49,7 +52,7 @@ public class AnswerPollEvent extends MessageHandler {
|
|||||||
|
|
||||||
if (poll.lastQuestionId == questionId) {
|
if (poll.lastQuestionId == questionId) {
|
||||||
if (poll.badgeReward.length() > 0) {
|
if (poll.badgeReward.length() > 0) {
|
||||||
if (this.client.getHabbo().getInventory().getBadgesComponent().getBadge(poll.badgeReward) == null) {
|
if (!this.client.getHabbo().getInventory().getBadgesComponent().hasBadge(poll.badgeReward)) {
|
||||||
HabboBadge badge = new HabboBadge(0, poll.badgeReward, 0, this.client.getHabbo());
|
HabboBadge badge = new HabboBadge(0, poll.badgeReward, 0, this.client.getHabbo());
|
||||||
Emulator.getThreading().run(badge);
|
Emulator.getThreading().run(badge);
|
||||||
this.client.getHabbo().getInventory().getBadgesComponent().addBadge(badge);
|
this.client.getHabbo().getInventory().getBadgesComponent().addBadge(badge);
|
||||||
|
@ -12,9 +12,6 @@ public class RequestRoomLoadEvent extends MessageHandler {
|
|||||||
String password = this.packet.readString();
|
String password = this.packet.readString();
|
||||||
|
|
||||||
if (this.client.getHabbo().getHabboInfo().getLoadingRoom() == 0 && this.client.getHabbo().getHabboStats().roomEnterTimestamp + 1000 < System.currentTimeMillis()) {
|
if (this.client.getHabbo().getHabboInfo().getLoadingRoom() == 0 && this.client.getHabbo().getHabboStats().roomEnterTimestamp + 1000 < System.currentTimeMillis()) {
|
||||||
if (this.client.getHabbo().getRoomUnit() != null && this.client.getHabbo().getRoomUnit().isTeleporting) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Room room = this.client.getHabbo().getHabboInfo().getCurrentRoom();
|
Room room = this.client.getHabbo().getHabboInfo().getCurrentRoom();
|
||||||
if (room != null) {
|
if (room != null) {
|
||||||
@ -24,6 +21,11 @@ public class RequestRoomLoadEvent extends MessageHandler {
|
|||||||
|
|
||||||
this.client.getHabbo().getHabboInfo().setCurrentRoom(null);
|
this.client.getHabbo().getHabboInfo().setCurrentRoom(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.client.getHabbo().getRoomUnit() != null && this.client.getHabbo().getRoomUnit().isTeleporting) {
|
||||||
|
this.client.getHabbo().getRoomUnit().isTeleporting = false;
|
||||||
|
}
|
||||||
|
|
||||||
Emulator.getGameEnvironment().getRoomManager().enterRoom(this.client.getHabbo(), roomId, password);
|
Emulator.getGameEnvironment().getRoomManager().enterRoom(this.client.getHabbo(), roomId, password);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@ public class SetHomeRoomEvent extends MessageHandler {
|
|||||||
|
|
||||||
if (roomId != this.client.getHabbo().getHabboInfo().getHomeRoom()) {
|
if (roomId != this.client.getHabbo().getHabboInfo().getHomeRoom()) {
|
||||||
this.client.getHabbo().getHabboInfo().setHomeRoom(roomId);
|
this.client.getHabbo().getHabboInfo().setHomeRoom(roomId);
|
||||||
this.client.sendResponse(new UserHomeRoomComposer(this.client.getHabbo().getHabboInfo().getHomeRoom(), this.client.getHabbo().getHabboInfo().getHomeRoom()));
|
this.client.sendResponse(new UserHomeRoomComposer(this.client.getHabbo().getHabboInfo().getHomeRoom(), 0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -152,7 +152,11 @@ public class BotSaveSettingsEvent extends MessageHandler {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 9:
|
case 9:
|
||||||
bot.setMotto(this.packet.readString());
|
String motto = this.packet.readString();
|
||||||
|
|
||||||
|
if(motto.length() > Emulator.getConfig().getInt("motto.max_length", 38)) break;
|
||||||
|
|
||||||
|
bot.setMotto(motto);
|
||||||
bot.needsUpdate(true);
|
bot.needsUpdate(true);
|
||||||
room.sendComposer(new RoomUsersComposer(bot).compose());
|
room.sendComposer(new RoomUsersComposer(bot).compose());
|
||||||
break;
|
break;
|
||||||
|
@ -6,6 +6,9 @@ import com.eu.habbo.habbohotel.items.interactions.InteractionRoomAds;
|
|||||||
import com.eu.habbo.habbohotel.rooms.Room;
|
import com.eu.habbo.habbohotel.rooms.Room;
|
||||||
import com.eu.habbo.habbohotel.users.HabboItem;
|
import com.eu.habbo.habbohotel.users.HabboItem;
|
||||||
import com.eu.habbo.messages.incoming.MessageHandler;
|
import com.eu.habbo.messages.incoming.MessageHandler;
|
||||||
|
import gnu.trove.map.hash.THashMap;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
public class AdvertisingSaveEvent extends MessageHandler {
|
public class AdvertisingSaveEvent extends MessageHandler {
|
||||||
@Override
|
@Override
|
||||||
@ -26,6 +29,7 @@ public class AdvertisingSaveEvent extends MessageHandler {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (item instanceof InteractionCustomValues) {
|
if (item instanceof InteractionCustomValues) {
|
||||||
|
THashMap<String, String> oldValues = new THashMap<>(((InteractionCustomValues) item).values);
|
||||||
int count = this.packet.readInt();
|
int count = this.packet.readInt();
|
||||||
for (int i = 0; i < count / 2; i++) {
|
for (int i = 0; i < count / 2; i++) {
|
||||||
String key = this.packet.readString();
|
String key = this.packet.readString();
|
||||||
@ -42,7 +46,7 @@ public class AdvertisingSaveEvent extends MessageHandler {
|
|||||||
item.needsUpdate(true);
|
item.needsUpdate(true);
|
||||||
Emulator.getThreading().run(item);
|
Emulator.getThreading().run(item);
|
||||||
room.updateItem(item);
|
room.updateItem(item);
|
||||||
((InteractionCustomValues) item).onCustomValuesSaved(room, this.client);
|
((InteractionCustomValues) item).onCustomValuesSaved(room, this.client, oldValues);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,11 @@ public class MannequinSaveNameEvent extends MessageHandler {
|
|||||||
|
|
||||||
String[] data = item.getExtradata().split(":");
|
String[] data = item.getExtradata().split(":");
|
||||||
String name = this.packet.readString();
|
String name = this.packet.readString();
|
||||||
|
|
||||||
|
if (name.length() < 3 || name.length() > 15) {
|
||||||
|
name = Emulator.getTexts().getValue("hotel.mannequin.name.default", "My look");
|
||||||
|
}
|
||||||
|
|
||||||
if (data.length == 3) {
|
if (data.length == 3) {
|
||||||
item.setExtradata(this.client.getHabbo().getHabboInfo().getGender().name().toUpperCase() + ":" + data[1] + ":" + name);
|
item.setExtradata(this.client.getHabbo().getHabboInfo().getGender().name().toUpperCase() + ":" + data[1] + ":" + name);
|
||||||
} else {
|
} else {
|
||||||
|
@ -30,7 +30,7 @@ public class MoodLightSaveSettingsEvent extends MessageHandler {
|
|||||||
int brightness = this.packet.readInt();
|
int brightness = this.packet.readInt();
|
||||||
boolean apply = this.packet.readBoolean();
|
boolean apply = this.packet.readBoolean();
|
||||||
|
|
||||||
if (!MOODLIGHT_AVAILABLE_COLORS.contains(color)) {
|
if (Emulator.getConfig().getBoolean("moodlight.color_check.enabled", true) && !MOODLIGHT_AVAILABLE_COLORS.contains(color)) {
|
||||||
ScripterManager.scripterDetected(this.client, "User tried to set a moodlight to a non-whitelisted color: " + color);
|
ScripterManager.scripterDetected(this.client, "User tried to set a moodlight to a non-whitelisted color: " + color);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -39,12 +39,12 @@ public class PostItSaveDataEvent extends MessageHandler {
|
|||||||
if (!(item instanceof InteractionPostIt))
|
if (!(item instanceof InteractionPostIt))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!color.equalsIgnoreCase(PostItColor.YELLOW.hexColor) && !room.hasRights(this.client.getHabbo()) && item.getUserId() != this.client.getHabbo().getHabboInfo().getId()) {
|
if (!color.equalsIgnoreCase(PostItColor.YELLOW.hexColor) && !room.hasRights(this.client.getHabbo())) {
|
||||||
if (!text.startsWith(item.getExtradata().replace(item.getExtradata().split(" ")[0], ""))) {
|
if (!text.startsWith(item.getExtradata().replace(item.getExtradata().split(" ")[0], ""))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!room.hasRights(this.client.getHabbo()) && item.getUserId() != this.client.getHabbo().getHabboInfo().getId())
|
if (!room.hasRights(this.client.getHabbo()))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ public class RedeemClothingEvent extends MessageHandler {
|
|||||||
RoomTile tile = this.client.getHabbo().getHabboInfo().getCurrentRoom().getLayout().getTile(item.getX(), item.getY());
|
RoomTile tile = this.client.getHabbo().getHabboInfo().getCurrentRoom().getLayout().getTile(item.getX(), item.getY());
|
||||||
this.client.getHabbo().getHabboInfo().getCurrentRoom().removeHabboItem(item);
|
this.client.getHabbo().getHabboInfo().getCurrentRoom().removeHabboItem(item);
|
||||||
this.client.getHabbo().getHabboInfo().getCurrentRoom().updateTile(tile);
|
this.client.getHabbo().getHabboInfo().getCurrentRoom().updateTile(tile);
|
||||||
this.client.getHabbo().getHabboInfo().getCurrentRoom().sendComposer(new UpdateStackHeightComposer(tile.x, tile.y, tile.relativeHeight()).compose());
|
this.client.getHabbo().getHabboInfo().getCurrentRoom().sendComposer(new UpdateStackHeightComposer(tile.x, tile.y, tile.z, tile.relativeHeight()).compose());
|
||||||
this.client.getHabbo().getHabboInfo().getCurrentRoom().sendComposer(new RemoveFloorItemComposer(item, true).compose());
|
this.client.getHabbo().getHabboInfo().getCurrentRoom().sendComposer(new RemoveFloorItemComposer(item, true).compose());
|
||||||
Emulator.getThreading().run(new QueryDeleteHabboItem(item.getId()));
|
Emulator.getThreading().run(new QueryDeleteHabboItem(item.getId()));
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ public class RedeemItemEvent extends MessageHandler {
|
|||||||
RoomTile t = room.getLayout().getTile(item.getX(), item.getY());
|
RoomTile t = room.getLayout().getTile(item.getX(), item.getY());
|
||||||
t.setStackHeight(room.getStackHeight(item.getX(), item.getY(), false));
|
t.setStackHeight(room.getStackHeight(item.getX(), item.getY(), false));
|
||||||
room.updateTile(t);
|
room.updateTile(t);
|
||||||
room.sendComposer(new UpdateStackHeightComposer(item.getX(), item.getY(), t.relativeHeight()).compose());
|
room.sendComposer(new UpdateStackHeightComposer(item.getX(), item.getY(), t.z, t.relativeHeight()).compose());
|
||||||
Emulator.getThreading().run(new QueryDeleteHabboItem(item.getId()));
|
Emulator.getThreading().run(new QueryDeleteHabboItem(item.getId()));
|
||||||
|
|
||||||
switch (furniRedeemEvent.currencyID) {
|
switch (furniRedeemEvent.currencyID) {
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user