This commit is contained in:
Remco 2020-12-28 22:09:02 +01:00
commit bfeeae82b7
12 changed files with 85 additions and 10 deletions

View File

@ -104,6 +104,8 @@ INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('subscriptions.hc.payday.m
-- OPTIONAL HC MIGRATION
-- INSERT INTO users_subscriptions SELECT NULL, user_id, 'HABBO_CLUB' as `subscription_type`, UNIX_TIMESTAMP() AS `timestamp_start`, (club_expire_timestamp - UNIX_TIMESTAMP()) AS `duration`, 1 AS `active` FROM users_settings WHERE club_expire_timestamp > UNIX_TIMESTAMP();
INSERT INTO `emulator_settings` (`key`, `value`) VALUES ('hotel.rooms.deco_hosting', '1');
INSERT INTO `emulator_settings` (`key`, `value`) VALUES ('easter_eggs.enabled', '1');
ALTER TABLE `bots`

View File

@ -3,7 +3,10 @@ package com.eu.habbo.habbohotel.commands;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.catalog.CatalogManager;
import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.users.HabboManager;
import com.eu.habbo.messages.outgoing.generic.alerts.MessagesForYouComposer;
import java.util.Collections;
import java.util.concurrent.TimeUnit;
@ -11,9 +14,12 @@ public class AboutCommand extends Command {
public AboutCommand() {
super(null, new String[]{"about", "info", "online", "server"});
}
public static String credits = "Arcturus Morningstar is an opensource project based on Arcturus By TheGeneral \n" +
"The Following people have all contributed to this emulator:\n" +
" TheGeneral\n Beny\n Alejandro\n Capheus\n Skeletor\n Harmonic\n Mike\n Remco\n zGrav \n Quadral \n Harmony\n Swirny\n ArpyAge\n Mikkel\n Rodolfo\n Kitt Mustang\n Snaiker\n nttzx\n necmi\n Dome\n Jose Flores\n Cam\n Oliver\n Narzo\n Tenshie\n MartenM\n Ridge\n SenpaiDipper";
@Override
public boolean handle(GameClient gameClient, String[] params) {
Emulator.getRuntime().gc();
int seconds = Emulator.getIntUnixTimestamp() - Emulator.getTimeStarted();
@ -42,9 +48,8 @@ public class AboutCommand extends Command {
"<b>Thanks for using Arcturus. Report issues on the forums. http://arcturus.wf \r\r" +
" - The General";
gameClient.getHabbo().alert(message);
gameClient.sendResponse(new MessagesForYouComposer(Collections.singletonList(credits)));
return true;
}
}

View File

@ -578,6 +578,7 @@ public class Pet implements ISerialize, Runnable {
this.addHappyness(10);
this.addExperience(10);
this.addRespect();
this.needsUpdate = true;
if (habbo != null) {
habbo.getHabboStats().petRespectPointsToGive--;

View File

@ -1,6 +1,7 @@
package com.eu.habbo.habbohotel.rooms;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.achievements.AchievementManager;
import com.eu.habbo.habbohotel.bots.Bot;
import com.eu.habbo.habbohotel.bots.VisitorBot;
import com.eu.habbo.habbohotel.commands.CommandHandler;
@ -1221,6 +1222,19 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
}
}
if (Emulator.getConfig().getBoolean("hotel.rooms.deco_hosting")) {
//Check if the user isn't the owner id
if (this.ownerId != habbo.getHabboInfo().getId()) {
//Check if the time already have 1 minute (120 / 2 = 60s)
if (habbo.getRoomUnit().getTimeInRoom() >= 120) {
AchievementManager.progressAchievement(this.ownerId, Emulator.getGameEnvironment().getAchievementManager().getAchievement("RoomDecoHosting"));
habbo.getRoomUnit().resetTimeInRoom();
} else {
habbo.getRoomUnit().increaseTimeInRoom();
}
}
}
if (habbo.getHabboStats().mutedBubbleTracker && habbo.getHabboStats().allowTalk()) {
habbo.getHabboStats().mutedBubbleTracker = false;
this.sendComposer(new RoomUserIgnoredComposer(habbo, RoomUserIgnoredComposer.UNIGNORED).compose());

View File

@ -672,7 +672,7 @@ public class RoomManager {
habbo.getClient().sendResponse(new RoomPromotionMessageComposer(null, null));
}
if (room.getOwnerId() != habbo.getHabboInfo().getId()) {
if (room.getOwnerId() != habbo.getHabboInfo().getId() && !habbo.getHabboStats().visitedRoom(room.getId())) {
AchievementManager.progressAchievement(habbo, Emulator.getGameEnvironment().getAchievementManager().getAchievement("RoomEntry"));
}
}
@ -916,6 +916,9 @@ public class RoomManager {
statement.setInt(2, habbo.getHabboInfo().getId());
statement.setInt(3, (int) (habbo.getHabboStats().roomEnterTimestamp));
statement.execute();
if (!habbo.getHabboStats().visitedRoom(room.getId()))
habbo.getHabboStats().addVisitRoom(room.getId());
} catch (SQLException e) {
LOGGER.error("Caught SQL exception", e);
}

View File

@ -73,6 +73,7 @@ public class RoomUnit {
private int effectId;
private int effectEndTimestamp;
private ScheduledFuture moveBlockingTask;
private int timeInRoom;
private int idleTimer;
private Room room;
@ -93,6 +94,7 @@ public class RoomUnit {
this.effectId = 0;
this.isKicked = false;
this.overridableTiles = new THashSet<>();
this.timeInRoom = 0;
}
public void clearWalking() {
@ -639,6 +641,18 @@ public class RoomUnit {
this.walkTimeOut = walkTimeOut;
}
public void increaseTimeInRoom() {
this.timeInRoom++;
}
public int getTimeInRoom() {
return this.timeInRoom;
}
public void resetTimeInRoom() {
this.timeInRoom = 0;
}
public void increaseIdleTimer() {
this.idleTimer++;
}

View File

@ -41,6 +41,7 @@ public class HabboStats implements Runnable {
private final THashMap<Integer, CatalogItem> recentPurchases;
private final TIntArrayList favoriteRooms;
private final TIntArrayList ignoredUsers;
private TIntArrayList roomsVists;
public int achievementScore;
public int respectPointsReceived;
public int respectPointsGiven;
@ -106,6 +107,7 @@ public class HabboStats implements Runnable {
this.recentPurchases = new THashMap<>(0);
this.favoriteRooms = new TIntArrayList(0);
this.ignoredUsers = new TIntArrayList(0);
this.roomsVists = new TIntArrayList(0);
this.secretRecipes = new TIntArrayList(0);
this.calendarRewardsClaimed = new TIntArrayList(0);
@ -236,6 +238,15 @@ public class HabboStats implements Runnable {
}
}
}
try (PreparedStatement loadRoomsVisit = set.getStatement().getConnection().prepareStatement("SELECT DISTINCT room_id FROM room_enter_log WHERE user_id = ?")) {
loadRoomsVisit.setInt(1, this.habboInfo.getId());
try (ResultSet roomSet = loadRoomsVisit.executeQuery()) {
while (roomSet.next()) {
this.roomsVists.add(roomSet.getInt("room_id"));
}
}
}
}
private static HabboStats createNewStats(HabboInfo habboInfo) {
@ -622,6 +633,10 @@ public class HabboStats implements Runnable {
return this.favoriteRooms.contains(roomId);
}
public boolean visitedRoom(int roomId) { return this.roomsVists.contains(roomId); }
public void addVisitRoom(int roomId) { this.roomsVists.add(roomId); }
public TIntArrayList getFavoriteRooms() {
return this.favoriteRooms;
}

View File

@ -2,11 +2,15 @@ package com.eu.habbo.messages.incoming.guilds;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.guilds.Guild;
import com.eu.habbo.habbohotel.guilds.GuildMember;
import com.eu.habbo.habbohotel.permissions.Permission;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.messages.incoming.MessageHandler;
import com.eu.habbo.messages.outgoing.guilds.GuildFavoriteRoomUserUpdateComposer;
import com.eu.habbo.messages.outgoing.guilds.RemoveGuildFromRoomComposer;
import com.eu.habbo.messages.outgoing.rooms.RoomDataComposer;
import com.eu.habbo.plugin.events.guilds.GuildDeletedEvent;
import gnu.trove.set.hash.THashSet;
public class GuildDeleteEvent extends MessageHandler {
@Override
@ -18,6 +22,15 @@ public class GuildDeleteEvent extends MessageHandler {
if (guild != null) {
if (guild.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || this.client.getHabbo().hasPermission(Permission.ACC_GUILD_ADMIN)) //TODO Add staff permission override.
{
THashSet<GuildMember> members = Emulator.getGameEnvironment().getGuildManager().getGuildMembers(guild.getId());
for (GuildMember member : members) {
Habbo habbo = Emulator.getGameServer().getGameClientManager().getHabbo(member.getUserId());
if (habbo != null)
if (habbo.getHabboInfo().getCurrentRoom() != null && habbo.getRoomUnit() != null)
habbo.getHabboInfo().getCurrentRoom().sendComposer(new GuildFavoriteRoomUserUpdateComposer(habbo.getRoomUnit(), null).compose());
}
Emulator.getGameEnvironment().getGuildManager().deleteGuild(guild);
Emulator.getPluginManager().fireEvent(new GuildDeletedEvent(guild, this.client.getHabbo()));
Emulator.getGameEnvironment().getRoomManager().getRoom(guild.getRoomId()).sendComposer(new RemoveGuildFromRoomComposer(guildId).compose());

View File

@ -22,7 +22,7 @@ public class GuildRemoveFavoriteEvent extends MessageHandler {
this.client.getHabbo().getHabboStats().guild = 0;
if (this.client.getHabbo().getHabboInfo().getCurrentRoom() != null && guild != null) {
this.client.getHabbo().getHabboInfo().getCurrentRoom().sendComposer(new GuildFavoriteRoomUserUpdateComposer(this.client.getHabbo().getRoomUnit(), guild).compose());
this.client.getHabbo().getHabboInfo().getCurrentRoom().sendComposer(new GuildFavoriteRoomUserUpdateComposer(this.client.getHabbo().getRoomUnit(), null).compose());
}
this.client.sendResponse(new UserProfileComposer(this.client.getHabbo(), this.client));

View File

@ -8,6 +8,7 @@ import com.eu.habbo.habbohotel.permissions.Permission;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.messages.incoming.MessageHandler;
import com.eu.habbo.messages.outgoing.guilds.GuildFavoriteRoomUserUpdateComposer;
import com.eu.habbo.messages.outgoing.guilds.GuildInfoComposer;
import com.eu.habbo.messages.outgoing.guilds.GuildRefreshMembersListComposer;
import com.eu.habbo.plugin.events.guilds.GuildRemovedMemberEvent;
@ -44,8 +45,11 @@ public class GuildRemoveMemberEvent extends MessageHandler {
if (habbo.getHabboStats().guild == guildId)
habbo.getHabboStats().guild = 0;
if (room != null && habbo.getHabboInfo().getCurrentRoom() == room) {
room.refreshRightsForHabbo(habbo);
if (room != null) {
if (habbo.getHabboInfo().getCurrentRoom() != null && habbo.getRoomUnit() != null)
habbo.getHabboInfo().getCurrentRoom().sendComposer(new GuildFavoriteRoomUserUpdateComposer(habbo.getRoomUnit(), null).compose());
if (habbo.getHabboInfo().getCurrentRoom() == room)
room.refreshRightsForHabbo(habbo);
}
habbo.getClient().sendResponse(new GuildInfoComposer(guild, habbo.getClient(), false, null));

View File

@ -1,5 +1,6 @@
package com.eu.habbo.messages.incoming.rooms.pets;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.pets.MonsterplantPet;
import com.eu.habbo.habbohotel.pets.Pet;
import com.eu.habbo.messages.incoming.MessageHandler;
@ -22,6 +23,9 @@ public class ScratchPetEvent extends MessageHandler {
if (this.client.getHabbo().getHabboStats().petRespectPointsToGive > 0 || pet instanceof MonsterplantPet) {
pet.scratched(this.client.getHabbo());
// Update the stats to the database.
Emulator.getThreading().run(pet);
}
}
}

View File

@ -19,9 +19,9 @@ public class GuildFavoriteRoomUserUpdateComposer extends MessageComposer {
protected ServerMessage composeInternal() {
this.response.init(Outgoing.GuildFavoriteRoomUserUpdateComposer);
this.response.appendInt(this.roomUnit.getId());
this.response.appendInt(this.guild.getId());
this.response.appendInt(this.guild.getState().state);
this.response.appendString(this.guild.getName());
this.response.appendInt(this.guild != null ? this.guild.getId() : 0);
this.response.appendInt(this.guild != null ? this.guild.getState().state : 3);
this.response.appendString(this.guild != null ? this.guild.getName() : "");
return this.response;
}
}