mirror of
https://git.krews.org/morningstar/Arcturus-Community.git
synced 2025-02-19 20:02:35 +01:00
merge dev
This commit is contained in:
commit
0ca39a0bbe
@ -126,3 +126,7 @@ INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('commands.description.cmd_
|
|||||||
-- Making items.wired_data column bigger since wired data is saved as JSON now
|
-- Making items.wired_data column bigger since wired data is saved as JSON now
|
||||||
ALTER TABLE `items` MODIFY COLUMN `wired_data` varchar(10000);
|
ALTER TABLE `items` MODIFY COLUMN `wired_data` varchar(10000);
|
||||||
|
|
||||||
|
-- Mute area sqls
|
||||||
|
INSERT INTO `emulator_settings`(`key`, `value`) VALUES ('room.chat.mutearea.allow_whisper', 'false');
|
||||||
|
|
||||||
|
|
||||||
|
@ -4,3 +4,6 @@ INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('wired.variable.roomname',
|
|||||||
INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('wired.variable.user_count', '%user_count%');
|
INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('wired.variable.user_count', '%user_count%');
|
||||||
INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('wired.variable.owner', '%owner%');
|
INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('wired.variable.owner', '%owner%');
|
||||||
INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('wired.variable.item_count', '%item_count%');
|
INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('wired.variable.item_count', '%item_count%');
|
||||||
|
|
||||||
|
-- Enable bubble alerts
|
||||||
|
INSERT INTO `emulator_settings` (`key`, `value`) VALUES ('bubblealerts.enabled', '1');
|
||||||
|
@ -662,7 +662,6 @@ public class CatalogManager {
|
|||||||
if (isVisiblePage && hasRightRank && clubRightsOkay) {
|
if (isVisiblePage && hasRightRank && clubRightsOkay) {
|
||||||
pages.add(object);
|
pages.add(object);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -13,7 +13,7 @@ public class UpdateNavigatorCommand extends Command {
|
|||||||
public boolean handle(GameClient gameClient, String[] params) throws Exception {
|
public boolean handle(GameClient gameClient, String[] params) throws Exception {
|
||||||
Emulator.getGameEnvironment().getNavigatorManager().loadNavigator();
|
Emulator.getGameEnvironment().getNavigatorManager().loadNavigator();
|
||||||
Emulator.getGameEnvironment().getRoomManager().loadRoomModels();
|
Emulator.getGameEnvironment().getRoomManager().loadRoomModels();
|
||||||
Emulator.getGameEnvironment().getRoomManager().loadPublicRooms();
|
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_update_navigator"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_update_navigator"), RoomChatMessageBubbles.ALERT);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -14,6 +14,7 @@ import com.eu.habbo.habbohotel.wired.WiredEffectType;
|
|||||||
import com.eu.habbo.habbohotel.wired.WiredHandler;
|
import com.eu.habbo.habbohotel.wired.WiredHandler;
|
||||||
import com.eu.habbo.habbohotel.wired.WiredTriggerType;
|
import com.eu.habbo.habbohotel.wired.WiredTriggerType;
|
||||||
import com.eu.habbo.messages.ServerMessage;
|
import com.eu.habbo.messages.ServerMessage;
|
||||||
|
import com.eu.habbo.threading.runnables.games.GameTimer;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
@ -63,7 +64,7 @@ public class InteractionGameTimer extends HabboItem implements Runnable {
|
|||||||
String[] data = set.getString("extra_data").split("\t");
|
String[] data = set.getString("extra_data").split("\t");
|
||||||
|
|
||||||
if (data.length >= 2) {
|
if (data.length >= 2) {
|
||||||
this.baseTime = Integer.valueOf(data[1]);
|
this.baseTime = Integer.parseInt(data[1]);
|
||||||
this.timeNow = this.baseTime;
|
this.timeNow = this.baseTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -149,33 +150,6 @@ public class InteractionGameTimer extends HabboItem implements Runnable {
|
|||||||
if (this.needsUpdate() || this.needsDelete()) {
|
if (this.needsUpdate() || this.needsDelete()) {
|
||||||
super.run();
|
super.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.getRoomId() == 0) {
|
|
||||||
this.threadActive = false;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Room room = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId());
|
|
||||||
|
|
||||||
if (room == null || !this.isRunning || this.isPaused) {
|
|
||||||
this.threadActive = false;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.timeNow--;
|
|
||||||
if (this.timeNow < 0) this.timeNow = 0;
|
|
||||||
|
|
||||||
if (this.timeNow > 0) {
|
|
||||||
this.threadActive = true;
|
|
||||||
Emulator.getThreading().run(this, 1000);
|
|
||||||
} else {
|
|
||||||
this.threadActive = false;
|
|
||||||
this.timeNow = 0;
|
|
||||||
this.endGame(room);
|
|
||||||
WiredHandler.handle(WiredTriggerType.GAME_ENDS, null, room, new Object[]{});
|
|
||||||
}
|
|
||||||
|
|
||||||
room.updateItem(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -248,7 +222,7 @@ public class InteractionGameTimer extends HabboItem implements Runnable {
|
|||||||
|
|
||||||
if (!this.threadActive) {
|
if (!this.threadActive) {
|
||||||
this.threadActive = true;
|
this.threadActive = true;
|
||||||
Emulator.getThreading().run(this, 1000);
|
Emulator.getThreading().run(new GameTimer(this), 1000);
|
||||||
}
|
}
|
||||||
} else if (client != null) {
|
} else if (client != null) {
|
||||||
if (!(room.hasRights(client.getHabbo()) || client.getHabbo().hasPermission(Permission.ACC_ANYROOMOWNER)))
|
if (!(room.hasRights(client.getHabbo()) || client.getHabbo().hasPermission(Permission.ACC_ANYROOMOWNER)))
|
||||||
@ -271,7 +245,7 @@ public class InteractionGameTimer extends HabboItem implements Runnable {
|
|||||||
|
|
||||||
if (!this.threadActive) {
|
if (!this.threadActive) {
|
||||||
this.threadActive = true;
|
this.threadActive = true;
|
||||||
Emulator.getThreading().run(this);
|
Emulator.getThreading().run(new GameTimer(this));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -285,7 +259,7 @@ public class InteractionGameTimer extends HabboItem implements Runnable {
|
|||||||
|
|
||||||
if (!this.threadActive) {
|
if (!this.threadActive) {
|
||||||
this.threadActive = true;
|
this.threadActive = true;
|
||||||
Emulator.getThreading().run(this, 1000);
|
Emulator.getThreading().run(new GameTimer(this), 1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -350,10 +324,30 @@ public class InteractionGameTimer extends HabboItem implements Runnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isRunning() {
|
public boolean isRunning() {
|
||||||
return isRunning;
|
return this.isRunning;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRunning(boolean running) {
|
public void setRunning(boolean running) {
|
||||||
isRunning = running;
|
this.isRunning = running;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setThreadActive(boolean threadActive) {
|
||||||
|
this.threadActive = threadActive;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isPaused() {
|
||||||
|
return this.isPaused;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void reduceTime() {
|
||||||
|
this.timeNow--;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getTimeNow() {
|
||||||
|
return this.timeNow;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTimeNow(int timeNow) {
|
||||||
|
this.timeNow = timeNow;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -54,7 +54,7 @@ public class ModToolManager {
|
|||||||
if (userId <= 0)
|
if (userId <= 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("SELECT users.*, users_settings.*, permissions.rank_name, permissions.id as rank_id FROM users INNER JOIN users_settings ON users.id = users_settings.user_id INNER JOIN permissions ON permissions.id = users.rank WHERE users.id = ? LIMIT 1")) {
|
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("SELECT users.*, users_settings.*, permissions.rank_name, permissions.acc_hide_mail AS hide_mail, permissions.id AS rank_id FROM users INNER JOIN users_settings ON users.id = users_settings.user_id INNER JOIN permissions ON permissions.id = users.rank WHERE users.id = ? LIMIT 1")) {
|
||||||
statement.setInt(1, userId);
|
statement.setInt(1, userId);
|
||||||
try (ResultSet set = statement.executeQuery()) {
|
try (ResultSet set = statement.executeQuery()) {
|
||||||
while (set.next()) {
|
while (set.next()) {
|
||||||
@ -428,6 +428,16 @@ public class ModToolManager {
|
|||||||
return bans;
|
return bans;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//if machine id is empty, downgrade ban type to IP ban
|
||||||
|
if( (type == ModToolBanType.MACHINE || type == ModToolBanType.SUPER) && (offlineInfo == null || offlineInfo.getMachineID().isEmpty())) {
|
||||||
|
type = ModToolBanType.IP;
|
||||||
|
}
|
||||||
|
|
||||||
|
//if ip address is empty, downgrade ban type to account ban
|
||||||
|
if( (type == ModToolBanType.IP || type == ModToolBanType.SUPER) && (offlineInfo == null || offlineInfo.getIpLogin().isEmpty())) {
|
||||||
|
type = ModToolBanType.ACCOUNT;
|
||||||
|
}
|
||||||
|
|
||||||
ModToolBan ban = new ModToolBan(targetUserId, offlineInfo != null ? offlineInfo.getIpLogin() : "offline", offlineInfo != null ? offlineInfo.getMachineID() : "offline", moderator.getHabboInfo().getId(), Emulator.getIntUnixTimestamp() + duration, reason, type, cfhTopic);
|
ModToolBan ban = new ModToolBan(targetUserId, offlineInfo != null ? offlineInfo.getIpLogin() : "offline", offlineInfo != null ? offlineInfo.getMachineID() : "offline", moderator.getHabboInfo().getId(), Emulator.getIntUnixTimestamp() + duration, reason, type, cfhTopic);
|
||||||
Emulator.getPluginManager().fireEvent(new SupportUserBannedEvent(moderator, target, ban));
|
Emulator.getPluginManager().fireEvent(new SupportUserBannedEvent(moderator, target, ban));
|
||||||
Emulator.getThreading().run(ban);
|
Emulator.getThreading().run(ban);
|
||||||
|
@ -1176,7 +1176,6 @@ public class RoomManager {
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
Habbo friend = Emulator.getGameEnvironment().getHabboManager().getHabbo(buddy.getId());
|
Habbo friend = Emulator.getGameEnvironment().getHabboManager().getHabbo(buddy.getId());
|
||||||
|
|
||||||
if (friend == null || friend.getHabboInfo().getCurrentRoom() == null)
|
if (friend == null || friend.getHabboInfo().getCurrentRoom() == null)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@ -1313,7 +1312,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.add(room);
|
if (room != null && !rooms.contains(room)) rooms.add(room);
|
||||||
|
|
||||||
if (rooms.size() >= limit) break;
|
if (rooms.size() >= limit) break;
|
||||||
}
|
}
|
||||||
|
@ -85,9 +85,11 @@ public class SubscriptionHabboClub extends Subscription {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((Emulator.getIntUnixTimestamp() - habbo.getHabboStats().hcMessageLastModified) < 60) {
|
if ((Emulator.getIntUnixTimestamp() - habbo.getHabboStats().hcMessageLastModified) < 60) {
|
||||||
Emulator.getThreading().run(() -> { habbo.getClient().sendResponse(new UserClubComposer(habbo)); habbo.getClient().sendResponse(new UserPermissionsComposer(habbo)); }, (Emulator.getIntUnixTimestamp() - habbo.getHabboStats().hcMessageLastModified));
|
Emulator.getThreading().run(() -> {
|
||||||
}
|
habbo.getClient().sendResponse(new UserClubComposer(habbo));
|
||||||
else {
|
habbo.getClient().sendResponse(new UserPermissionsComposer(habbo));
|
||||||
|
}, (Emulator.getIntUnixTimestamp() - habbo.getHabboStats().hcMessageLastModified));
|
||||||
|
} else {
|
||||||
habbo.getClient().sendResponse(new UserClubComposer(habbo, SubscriptionHabboClub.HABBO_CLUB, UserClubComposer.RESPONSE_TYPE_NORMAL));
|
habbo.getClient().sendResponse(new UserClubComposer(habbo, SubscriptionHabboClub.HABBO_CLUB, UserClubComposer.RESPONSE_TYPE_NORMAL));
|
||||||
habbo.getClient().sendResponse(new UserPermissionsComposer(habbo));
|
habbo.getClient().sendResponse(new UserPermissionsComposer(habbo));
|
||||||
}
|
}
|
||||||
@ -172,6 +174,7 @@ public class SubscriptionHabboClub extends Subscription {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Calculate's a users upcoming HC Pay day rewards
|
* Calculate's a users upcoming HC Pay day rewards
|
||||||
|
*
|
||||||
* @param habbo User to calculate for
|
* @param habbo User to calculate for
|
||||||
* @return ClubCenterDataComposer
|
* @return ClubCenterDataComposer
|
||||||
*/
|
*/
|
||||||
@ -272,8 +275,7 @@ public class SubscriptionHabboClub extends Subscription {
|
|||||||
}
|
}
|
||||||
stats.lastHCPayday = timestampNow;
|
stats.lastHCPayday = timestampNow;
|
||||||
Emulator.getThreading().run(stats);
|
Emulator.getThreading().run(stats);
|
||||||
}
|
} catch (Exception e) {
|
||||||
catch (Exception e) {
|
|
||||||
SubscriptionManager.LOGGER.error("Exception processing HC payday for user #" + set.getInt("user_id"), e);
|
SubscriptionManager.LOGGER.error("Exception processing HC payday for user #" + set.getInt("user_id"), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -297,8 +299,7 @@ public class SubscriptionHabboClub extends Subscription {
|
|||||||
stm2.execute();
|
stm2.execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
} catch (SQLException e) {
|
||||||
catch (SQLException e) {
|
|
||||||
SubscriptionManager.LOGGER.error("Caught SQL exception", e);
|
SubscriptionManager.LOGGER.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
isExecuting = false;
|
isExecuting = false;
|
||||||
@ -306,6 +307,7 @@ public class SubscriptionHabboClub extends Subscription {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a user logs in. Checks for any unclaimed HC Pay day rewards and issues rewards.
|
* Called when a user logs in. Checks for any unclaimed HC Pay day rewards and issues rewards.
|
||||||
|
*
|
||||||
* @param habbo User to process
|
* @param habbo User to process
|
||||||
*/
|
*/
|
||||||
public static void processUnclaimed(Habbo habbo) {
|
public static void processUnclaimed(Habbo habbo) {
|
||||||
@ -334,19 +336,25 @@ public class SubscriptionHabboClub extends Subscription {
|
|||||||
stm2.execute();
|
stm2.execute();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} catch (Exception e) {
|
||||||
catch (Exception e) {
|
|
||||||
SubscriptionManager.LOGGER.error("Exception processing HC payday for user #" + set.getInt("user_id"), e);
|
SubscriptionManager.LOGGER.error("Exception processing HC payday for user #" + set.getInt("user_id"), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
} catch (SQLException e) {
|
||||||
catch (SQLException e) {
|
|
||||||
SubscriptionManager.LOGGER.error("Caught SQL exception", e);
|
SubscriptionManager.LOGGER.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Seperated these because Beny shouldn't have tied them to Payday.
|
||||||
|
*/
|
||||||
|
public static void processClubBadge(Habbo habbo) {
|
||||||
|
progressAchievement(habbo.getHabboInfo());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Issues rewards to user.
|
* Issues rewards to user.
|
||||||
* @param habbo User to reward to
|
* @param habbo User to reward to
|
||||||
|
@ -336,7 +336,10 @@ public class CatalogBuyItemAsGiftEvent extends MessageHandler {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.client.getHabbo().getHabboInfo().getId() != userId) {
|
||||||
AchievementManager.progressAchievement(this.client.getHabbo(), Emulator.getGameEnvironment().getAchievementManager().getAchievement("GiftGiver"));
|
AchievementManager.progressAchievement(this.client.getHabbo(), Emulator.getGameEnvironment().getAchievementManager().getAchievement("GiftGiver"));
|
||||||
|
}
|
||||||
|
|
||||||
if (habbo != null) {
|
if (habbo != null) {
|
||||||
habbo.getClient().sendResponse(new AddHabboItemComposer(gift));
|
habbo.getClient().sendResponse(new AddHabboItemComposer(gift));
|
||||||
habbo.getClient().getHabbo().getInventory().getItemsComponent().addItem(gift);
|
habbo.getClient().getHabbo().getInventory().getItemsComponent().addItem(gift);
|
||||||
@ -351,7 +354,9 @@ public class CatalogBuyItemAsGiftEvent extends MessageHandler {
|
|||||||
habbo.getClient().sendResponse(new BubbleAlertComposer(BubbleAlertKeys.RECEIVED_BADGE.key, keys));
|
habbo.getClient().sendResponse(new BubbleAlertComposer(BubbleAlertKeys.RECEIVED_BADGE.key, keys));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.client.getHabbo().getHabboInfo().getId() != userId) {
|
||||||
AchievementManager.progressAchievement(userId, Emulator.getGameEnvironment().getAchievementManager().getAchievement("GiftReceiver"));
|
AchievementManager.progressAchievement(userId, Emulator.getGameEnvironment().getAchievementManager().getAchievement("GiftReceiver"));
|
||||||
|
}
|
||||||
|
|
||||||
if (!this.client.getHabbo().hasPermission(Permission.ACC_INFINITE_CREDITS)) {
|
if (!this.client.getHabbo().hasPermission(Permission.ACC_INFINITE_CREDITS)) {
|
||||||
if (totalCredits > 0) {
|
if (totalCredits > 0) {
|
||||||
|
@ -19,7 +19,7 @@ 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;
|
||||||
import com.eu.habbo.messages.outgoing.generic.alerts.MessagesForYouComposer;
|
import com.eu.habbo.messages.outgoing.generic.alerts.MessagesForYouComposer;
|
||||||
import com.eu.habbo.messages.outgoing.habboway.nux.NewUserIdentityComposer;
|
import com.eu.habbo.messages.outgoing.habboway.nux.NewUserIdentityComposer;
|
||||||
import com.eu.habbo.messages.outgoing.handshake.DebugConsoleComposer;
|
import com.eu.habbo.messages.outgoing.handshake.EnableNotificationsComposer;
|
||||||
import com.eu.habbo.messages.outgoing.handshake.SecureLoginOKComposer;
|
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;
|
||||||
@ -122,7 +122,7 @@ public class SecureLoginEvent extends MessageHandler {
|
|||||||
messages.add(new UserPermissionsComposer(this.client.getHabbo()).compose());
|
messages.add(new UserPermissionsComposer(this.client.getHabbo()).compose());
|
||||||
messages.add(new AvailabilityStatusMessageComposer(true, false, true).compose());
|
messages.add(new AvailabilityStatusMessageComposer(true, false, true).compose());
|
||||||
messages.add(new PingComposer().compose());
|
messages.add(new PingComposer().compose());
|
||||||
messages.add(new DebugConsoleComposer(Emulator.debugging).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 UnknownComposer5().compose());
|
||||||
@ -205,6 +205,8 @@ public class SecureLoginEvent extends MessageHandler {
|
|||||||
SubscriptionHabboClub.processUnclaimed(habbo);
|
SubscriptionHabboClub.processUnclaimed(habbo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SubscriptionHabboClub.processClubBadge(habbo);
|
||||||
|
|
||||||
Messenger.checkFriendSizeProgress(habbo);
|
Messenger.checkFriendSizeProgress(habbo);
|
||||||
|
|
||||||
if (!habbo.getHabboStats().hasGottenDefaultSavedSearches) {
|
if (!habbo.getHabboStats().hasGottenDefaultSavedSearches) {
|
||||||
|
@ -9,7 +9,7 @@ public class MannequinSaveNameEvent extends MessageHandler {
|
|||||||
@Override
|
@Override
|
||||||
public void handle() throws Exception {
|
public void handle() throws Exception {
|
||||||
Room room = this.client.getHabbo().getHabboInfo().getCurrentRoom();
|
Room room = this.client.getHabbo().getHabboInfo().getCurrentRoom();
|
||||||
if (room == null || this.client.getHabbo().getHabboInfo().getId() != room.getOwnerId())
|
if (room == null || !room.isOwner(this.client.getHabbo()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
HabboItem item = room.getHabboItem(this.packet.readInt());
|
HabboItem item = room.getHabboItem(this.packet.readInt());
|
||||||
|
@ -13,7 +13,7 @@ public class BreedMonsterplantsEvent extends MessageHandler {
|
|||||||
Pet petOne = this.client.getHabbo().getHabboInfo().getCurrentRoom().getPet(this.packet.readInt());
|
Pet petOne = this.client.getHabbo().getHabboInfo().getCurrentRoom().getPet(this.packet.readInt());
|
||||||
Pet petTwo = this.client.getHabbo().getHabboInfo().getCurrentRoom().getPet(this.packet.readInt());
|
Pet petTwo = this.client.getHabbo().getHabboInfo().getCurrentRoom().getPet(this.packet.readInt());
|
||||||
|
|
||||||
if (petOne == null || petTwo == null) {
|
if (petOne == null || petTwo == null || petOne == petTwo) {
|
||||||
//TODO Add error
|
//TODO Add error
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@ public class BuyRoomPromotionEvent extends MessageHandler {
|
|||||||
int itemId = this.packet.readInt();
|
int itemId = this.packet.readInt();
|
||||||
int roomId = this.packet.readInt();
|
int roomId = this.packet.readInt();
|
||||||
String title = this.packet.readString();
|
String title = this.packet.readString();
|
||||||
boolean unknown1 = this.packet.readBoolean();
|
boolean extendedPromotion = this.packet.readBoolean();
|
||||||
String description = this.packet.readString();
|
String description = this.packet.readString();
|
||||||
int categoryId = this.packet.readInt();
|
int categoryId = this.packet.readInt();
|
||||||
|
|
||||||
@ -30,7 +30,9 @@ public class BuyRoomPromotionEvent extends MessageHandler {
|
|||||||
|
|
||||||
CatalogPage page = Emulator.getGameEnvironment().getCatalogManager().getCatalogPage(pageId);
|
CatalogPage page = Emulator.getGameEnvironment().getCatalogManager().getCatalogPage(pageId);
|
||||||
|
|
||||||
if (page != null) {
|
if (page == null || !page.getLayout().equals("roomads"))
|
||||||
|
return;
|
||||||
|
|
||||||
CatalogItem item = page.getCatalogItem(itemId);
|
CatalogItem item = page.getCatalogItem(itemId);
|
||||||
if (item != null) {
|
if (item != null) {
|
||||||
if (this.client.getHabbo().getHabboInfo().canBuy(item)) {
|
if (this.client.getHabbo().getHabboInfo().canBuy(item)) {
|
||||||
@ -68,4 +70,3 @@ public class BuyRoomPromotionEvent extends MessageHandler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -21,7 +21,7 @@ public class TradeOfferMultipleItemsEvent extends MessageHandler {
|
|||||||
int count = this.packet.readInt();
|
int count = this.packet.readInt();
|
||||||
for (int i = 0; i < count; i++) {
|
for (int i = 0; i < count; i++) {
|
||||||
HabboItem item = this.client.getHabbo().getInventory().getItemsComponent().getHabboItem(this.packet.readInt());
|
HabboItem item = this.client.getHabbo().getInventory().getItemsComponent().getHabboItem(this.packet.readInt());
|
||||||
if (item != null) {
|
if (item != null && item.getBaseItem().allowTrade()) {
|
||||||
items.add(item);
|
items.add(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,9 @@ public class SaveWardrobeEvent extends MessageHandler {
|
|||||||
wardrobeItem.setNeedsUpdate(true);
|
wardrobeItem.setNeedsUpdate(true);
|
||||||
} else {
|
} else {
|
||||||
wardrobeItem = this.client.getHabbo().getInventory().getWardrobeComponent().createLook(this.client.getHabbo(), slotId, look);
|
wardrobeItem = this.client.getHabbo().getInventory().getWardrobeComponent().createLook(this.client.getHabbo(), slotId, look);
|
||||||
|
wardrobeItem.setGender(HabboGender.valueOf(gender));
|
||||||
wardrobeItem.setNeedsInsert(true);
|
wardrobeItem.setNeedsInsert(true);
|
||||||
|
this.client.getHabbo().getInventory().getWardrobeComponent().getLooks().put(slotId, wardrobeItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
UserSavedWardrobeEvent wardrobeEvent = new UserSavedWardrobeEvent(this.client.getHabbo(), wardrobeItem);
|
UserSavedWardrobeEvent wardrobeEvent = new UserSavedWardrobeEvent(this.client.getHabbo(), wardrobeItem);
|
||||||
|
@ -116,7 +116,7 @@ public class Outgoing {
|
|||||||
public final static int CatalogModeComposer = 3828; // PRODUCTION-201611291003-338511768
|
public final static int CatalogModeComposer = 3828; // PRODUCTION-201611291003-338511768
|
||||||
public final static int ChangeNameUpdateComposer = 118; // PRODUCTION-201611291003-338511768
|
public final static int ChangeNameUpdateComposer = 118; // PRODUCTION-201611291003-338511768
|
||||||
public final static int AddFloorItemComposer = 1534; // PRODUCTION-201611291003-338511768
|
public final static int AddFloorItemComposer = 1534; // PRODUCTION-201611291003-338511768
|
||||||
public final static int DebugConsoleComposer = 3284; // PRODUCTION-201611291003-338511768
|
public final static int EnableNotificationsComposer = 3284; // PRODUCTION-201611291003-338511768
|
||||||
public final static int HallOfFameComposer = 3005; // PRODUCTION-201611291003-338511768
|
public final static int HallOfFameComposer = 3005; // PRODUCTION-201611291003-338511768
|
||||||
public final static int WiredSavedComposer = 1155; // PRODUCTION-201611291003-338511768
|
public final static int WiredSavedComposer = 1155; // PRODUCTION-201611291003-338511768
|
||||||
public final static int RoomPaintComposer = 2454; // PRODUCTION-201611291003-338511768
|
public final static int RoomPaintComposer = 2454; // PRODUCTION-201611291003-338511768
|
||||||
|
@ -55,7 +55,7 @@ public class ClubGiftsComposer extends MessageComposer {
|
|||||||
|
|
||||||
this.response.appendInt(item.getId());
|
this.response.appendInt(item.getId());
|
||||||
this.response.appendBoolean(item.isClubOnly());
|
this.response.appendBoolean(item.isClubOnly());
|
||||||
this.response.appendInt(Math.max(daysRequired - daysAsHc, 0));
|
this.response.appendInt(daysRequired);
|
||||||
this.response.appendBoolean(daysRequired <= daysAsHc);
|
this.response.appendBoolean(daysRequired <= daysAsHc);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -1,20 +0,0 @@
|
|||||||
package com.eu.habbo.messages.outgoing.handshake;
|
|
||||||
|
|
||||||
import com.eu.habbo.messages.ServerMessage;
|
|
||||||
import com.eu.habbo.messages.outgoing.MessageComposer;
|
|
||||||
import com.eu.habbo.messages.outgoing.Outgoing;
|
|
||||||
|
|
||||||
public class DebugConsoleComposer extends MessageComposer {
|
|
||||||
private final boolean debugging;
|
|
||||||
|
|
||||||
public DebugConsoleComposer(boolean debugging) {
|
|
||||||
this.debugging = debugging;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected ServerMessage composeInternal() {
|
|
||||||
this.response.init(Outgoing.DebugConsoleComposer);
|
|
||||||
this.response.appendBoolean(this.debugging);
|
|
||||||
return this.response;
|
|
||||||
}
|
|
||||||
}
|
|
@ -0,0 +1,20 @@
|
|||||||
|
package com.eu.habbo.messages.outgoing.handshake;
|
||||||
|
|
||||||
|
import com.eu.habbo.messages.ServerMessage;
|
||||||
|
import com.eu.habbo.messages.outgoing.MessageComposer;
|
||||||
|
import com.eu.habbo.messages.outgoing.Outgoing;
|
||||||
|
|
||||||
|
public class EnableNotificationsComposer extends MessageComposer {
|
||||||
|
private final boolean enabled;
|
||||||
|
|
||||||
|
public EnableNotificationsComposer(boolean enabled) {
|
||||||
|
this.enabled = enabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected ServerMessage composeInternal() {
|
||||||
|
this.response.init(Outgoing.EnableNotificationsComposer);
|
||||||
|
this.response.appendBoolean(this.enabled);
|
||||||
|
return this.response;
|
||||||
|
}
|
||||||
|
}
|
@ -58,7 +58,7 @@ public class ModToolUserInfoComposer extends MessageComposer {
|
|||||||
this.response.appendString(""); //Last Purchase Timestamp
|
this.response.appendString(""); //Last Purchase Timestamp
|
||||||
this.response.appendInt(this.set.getInt("user_id")); //Personal Identification #
|
this.response.appendInt(this.set.getInt("user_id")); //Personal Identification #
|
||||||
this.response.appendInt(0); // Number of account bans
|
this.response.appendInt(0); // Number of account bans
|
||||||
this.response.appendString(this.set.getString("mail"));
|
this.response.appendString(this.set.getBoolean("hide_mail") ? "" : this.set.getString("mail"));
|
||||||
this.response.appendString("Rank (" + this.set.getInt("rank_id") + "): " + this.set.getString("rank_name")); //user_class_txt
|
this.response.appendString("Rank (" + this.set.getInt("rank_id") + "): " + this.set.getString("rank_name")); //user_class_txt
|
||||||
|
|
||||||
ModToolSanctions modToolSanctions = Emulator.getGameEnvironment().getModToolSanctions();
|
ModToolSanctions modToolSanctions = Emulator.getGameEnvironment().getModToolSanctions();
|
||||||
|
@ -32,9 +32,6 @@ public class GameServer extends Server {
|
|||||||
public void initChannel(SocketChannel ch) throws Exception {
|
public void initChannel(SocketChannel ch) throws Exception {
|
||||||
ch.pipeline().addLast("logger", new LoggingHandler());
|
ch.pipeline().addLast("logger", new LoggingHandler());
|
||||||
|
|
||||||
ch.pipeline().addLast("idleStateHandler", new IdleStateHandler(60, 30, 0));
|
|
||||||
ch.pipeline().addAfter("idleStateHandler", "idleEventHandler", new IdleTimeoutHandler());
|
|
||||||
|
|
||||||
// Decoders.
|
// Decoders.
|
||||||
ch.pipeline().addLast(new GamePolicyDecoder());
|
ch.pipeline().addLast(new GamePolicyDecoder());
|
||||||
ch.pipeline().addLast(new GameByteFrameDecoder());
|
ch.pipeline().addLast(new GameByteFrameDecoder());
|
||||||
@ -43,7 +40,7 @@ public class GameServer extends Server {
|
|||||||
if (PacketManager.DEBUG_SHOW_PACKETS) {
|
if (PacketManager.DEBUG_SHOW_PACKETS) {
|
||||||
ch.pipeline().addLast(new GameClientMessageLogger());
|
ch.pipeline().addLast(new GameClientMessageLogger());
|
||||||
}
|
}
|
||||||
|
ch.pipeline().addLast("idleEventHandler", new IdleTimeoutHandler(30, 60));
|
||||||
ch.pipeline().addLast(new GameMessageRateLimit());
|
ch.pipeline().addLast(new GameMessageRateLimit());
|
||||||
ch.pipeline().addLast(new GameMessageHandler());
|
ch.pipeline().addLast(new GameMessageHandler());
|
||||||
|
|
||||||
|
@ -1,29 +1,136 @@
|
|||||||
package com.eu.habbo.networking.gameserver.handlers;
|
package com.eu.habbo.networking.gameserver.handlers;
|
||||||
|
|
||||||
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
||||||
|
import com.eu.habbo.messages.ClientMessage;
|
||||||
|
import com.eu.habbo.messages.incoming.Incoming;
|
||||||
import com.eu.habbo.messages.outgoing.handshake.PingComposer;
|
import com.eu.habbo.messages.outgoing.handshake.PingComposer;
|
||||||
import com.eu.habbo.networking.gameserver.GameServerAttributes;
|
import com.eu.habbo.networking.gameserver.GameServerAttributes;
|
||||||
import io.netty.channel.ChannelDuplexHandler;
|
import io.netty.channel.ChannelDuplexHandler;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.handler.timeout.IdleState;
|
|
||||||
import io.netty.handler.timeout.IdleStateEvent;
|
import java.util.concurrent.ScheduledFuture;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
public class IdleTimeoutHandler extends ChannelDuplexHandler {
|
public class IdleTimeoutHandler extends ChannelDuplexHandler {
|
||||||
|
private static final long MIN_TIMEOUT_NANOS = TimeUnit.MILLISECONDS.toNanos(1);
|
||||||
|
|
||||||
|
private final long pingScheduleNanos;
|
||||||
|
private final long pongTimeoutNanos;
|
||||||
|
|
||||||
|
volatile ScheduledFuture<?> pingScheduleFuture;
|
||||||
|
volatile long lastPongTime;// in nanoseconds
|
||||||
|
|
||||||
|
private volatile int state; // 0 - none, 1 - initialized, 2 - destroyed
|
||||||
|
|
||||||
|
public IdleTimeoutHandler(int pingScheduleSeconds, int pongTimeoutSeconds) {
|
||||||
|
this.pingScheduleNanos = Math.max(MIN_TIMEOUT_NANOS, TimeUnit.SECONDS.toNanos(pingScheduleSeconds));
|
||||||
|
this.pongTimeoutNanos = Math.max(MIN_TIMEOUT_NANOS, TimeUnit.SECONDS.toNanos(pongTimeoutSeconds));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initialize(ChannelHandlerContext ctx) {
|
||||||
|
// Avoid the case where destroy() is called before scheduling timeouts.
|
||||||
|
// See: https://github.com/netty/netty/issues/143
|
||||||
|
switch (state) {
|
||||||
|
case 1:
|
||||||
|
case 2:
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
state = 1;
|
||||||
|
|
||||||
|
lastPongTime = System.nanoTime();
|
||||||
|
if (pingScheduleNanos > 0) {
|
||||||
|
pingScheduleFuture = ctx.executor().schedule(new PingScheduledTask(ctx), pingScheduleNanos, TimeUnit.NANOSECONDS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void destroy() {
|
||||||
|
state = 2;
|
||||||
|
|
||||||
|
if (pingScheduleFuture != null) {
|
||||||
|
pingScheduleFuture.cancel(false);
|
||||||
|
pingScheduleFuture = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {
|
public void handlerAdded(ChannelHandlerContext ctx) throws Exception {
|
||||||
if (evt instanceof IdleStateEvent) {
|
if (ctx.channel().isActive() && ctx.channel().isRegistered()) {
|
||||||
IdleStateEvent e = (IdleStateEvent) evt;
|
// channelActvie() event has been fired already, which means this.channelActive() will
|
||||||
if (e.state() == IdleState.READER_IDLE) {
|
// not be invoked. We have to initialize here instead.
|
||||||
ctx.close();
|
initialize(ctx);
|
||||||
} else if (e.state() == IdleState.WRITER_IDLE) {
|
} else {
|
||||||
|
// channelActive() event has not been fired yet. this.channelActive() will be invoked
|
||||||
|
// and initialization will occur there.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handlerRemoved(ChannelHandlerContext ctx) throws Exception {
|
||||||
|
destroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void channelRegistered(ChannelHandlerContext ctx) throws Exception {
|
||||||
|
// Initialize early if channel is active already.
|
||||||
|
if (ctx.channel().isActive()) {
|
||||||
|
initialize(ctx);
|
||||||
|
}
|
||||||
|
super.channelRegistered(ctx);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void channelActive(ChannelHandlerContext ctx) throws Exception {
|
||||||
|
// This method will be invoked only if this handler was added
|
||||||
|
// before channelActive() event is fired. If a user adds this handler
|
||||||
|
// after the channelActive() event, initialize() will be called by beforeAdd().
|
||||||
|
initialize(ctx);
|
||||||
|
super.channelActive(ctx);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
|
||||||
|
destroy();
|
||||||
|
super.channelInactive(ctx);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
|
||||||
|
// check if its a pong message
|
||||||
|
if(msg instanceof ClientMessage) {
|
||||||
|
ClientMessage packet = (ClientMessage) msg;
|
||||||
|
if(packet.getMessageId() == Incoming.PongEvent) {
|
||||||
|
this.lastPongTime = System.nanoTime();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
super.channelRead(ctx, msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
private final class PingScheduledTask implements Runnable {
|
||||||
|
private final ChannelHandlerContext ctx;
|
||||||
|
|
||||||
|
public PingScheduledTask(ChannelHandlerContext ctx) {
|
||||||
|
this.ctx = ctx;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
if (!ctx.channel().isOpen()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
long currentTime = System.nanoTime();
|
||||||
|
if(currentTime - lastPongTime > pongTimeoutNanos) {
|
||||||
|
ctx.close();// add a promise here ?
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
GameClient client = ctx.channel().attr(GameServerAttributes.CLIENT).get();
|
GameClient client = ctx.channel().attr(GameServerAttributes.CLIENT).get();
|
||||||
if (client != null) {
|
if (client != null) {
|
||||||
client.sendResponse(new PingComposer());
|
client.sendResponse(new PingComposer());
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} else {
|
|
||||||
super.userEventTriggered(ctx, evt);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
pingScheduleFuture = ctx.executor().schedule(this, pingScheduleNanos, TimeUnit.NANOSECONDS);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,46 @@
|
|||||||
|
package com.eu.habbo.threading.runnables.games;
|
||||||
|
|
||||||
|
import com.eu.habbo.Emulator;
|
||||||
|
import com.eu.habbo.habbohotel.items.interactions.games.InteractionGameTimer;
|
||||||
|
import com.eu.habbo.habbohotel.rooms.Room;
|
||||||
|
import com.eu.habbo.habbohotel.wired.WiredHandler;
|
||||||
|
import com.eu.habbo.habbohotel.wired.WiredTriggerType;
|
||||||
|
|
||||||
|
public class GameTimer implements Runnable {
|
||||||
|
|
||||||
|
private final InteractionGameTimer timer;
|
||||||
|
|
||||||
|
public GameTimer(InteractionGameTimer timer) {
|
||||||
|
this.timer = timer;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
if (timer.getRoomId() == 0) {
|
||||||
|
timer.setRunning(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Room room = Emulator.getGameEnvironment().getRoomManager().getRoom(timer.getRoomId());
|
||||||
|
|
||||||
|
if (room == null || !timer.isRunning() || timer.isPaused()) {
|
||||||
|
timer.setThreadActive(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
timer.reduceTime();
|
||||||
|
if (timer.getTimeNow() < 0) timer.setTimeNow(0);
|
||||||
|
|
||||||
|
if (timer.getTimeNow() > 0) {
|
||||||
|
timer.setThreadActive(true);
|
||||||
|
Emulator.getThreading().run(this, 1000);
|
||||||
|
} else {
|
||||||
|
timer.setThreadActive(false);
|
||||||
|
timer.setTimeNow(0);
|
||||||
|
timer.endGame(room);
|
||||||
|
WiredHandler.handle(WiredTriggerType.GAME_ENDS, null, room, new Object[]{});
|
||||||
|
}
|
||||||
|
|
||||||
|
room.updateItem(timer);
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user