mirror of
https://git.krews.org/morningstar/Arcturus-Community.git
synced 2025-01-18 23:46:28 +01:00
Merge remote-tracking branch 'origin/dev' into dev222
This commit is contained in:
commit
41a1d2ceaa
4
.gitignore
vendored
4
.gitignore
vendored
@ -13,4 +13,6 @@ config.ini
|
||||
*.txt
|
||||
*.jar
|
||||
*.log
|
||||
*.zip
|
||||
*.zip
|
||||
.DS_Store
|
||||
|
||||
|
@ -1,10 +1,15 @@
|
||||
image: maven:latest
|
||||
|
||||
stages:
|
||||
- build
|
||||
- deploy
|
||||
|
||||
cache:
|
||||
paths:
|
||||
- target/
|
||||
|
||||
build:
|
||||
stage: build
|
||||
script:
|
||||
- mvn package
|
||||
only:
|
||||
@ -12,4 +17,33 @@ build:
|
||||
- master
|
||||
artifacts:
|
||||
paths:
|
||||
- target/Habbo-*.jar
|
||||
- target/Habbo-*.jar
|
||||
|
||||
|
||||
.notify_builder: ¬ify_builder
|
||||
stage: deploy
|
||||
trigger:
|
||||
project: project-dobby/builder
|
||||
strategy: depend
|
||||
|
||||
|
||||
notify_deploy_release:
|
||||
<<: *notify_builder
|
||||
variables:
|
||||
UPSTREAM_DECISION: "tag"
|
||||
UPSTREAM_COMMIT_SHA: $CI_COMMIT_SHA
|
||||
UPSTREAM_PROJECT: $CI_PROJECT_PATH
|
||||
UPSTREAM_BRANCH: $CI_COMMIT_TAG
|
||||
only:
|
||||
- tags
|
||||
|
||||
notify_deploy_dev:
|
||||
<<: *notify_builder
|
||||
variables:
|
||||
UPSTREAM_DECISION: "dev"
|
||||
UPSTREAM_COMMIT_SHA: $CI_COMMIT_SHA
|
||||
UPSTREAM_PROJECT: $CI_PROJECT_PATH
|
||||
UPSTREAM_BRANCH: "dev"
|
||||
only:
|
||||
- dev
|
||||
|
@ -1 +1,3 @@
|
||||
INSERT INTO `emulator_settings`(`key`, `value`) VALUES ('hotel.room.stickies.max', '200');
|
||||
|
||||
ALTER TABLE `users_settings` ADD COLUMN `last_purchase_timestamp` int(11) NOT NULL DEFAULT UNIX_TIMESTAMP();
|
@ -1124,6 +1124,8 @@ public class CatalogManager {
|
||||
habbo.getClient().sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.SERVER_ERROR));
|
||||
}
|
||||
} finally {
|
||||
habbo.getHabboStats().lastPurchaseTimestamp = Emulator.getIntUnixTimestamp();
|
||||
habbo.getHabboStats().run();
|
||||
habbo.getHabboStats().isPurchasingFurniture = false;
|
||||
}
|
||||
}
|
||||
|
@ -30,6 +30,18 @@ public class InteractionMonsterPlantSeed extends HabboItem {
|
||||
}
|
||||
}
|
||||
|
||||
public static int randomGoldenRarityLevel() {
|
||||
int number = Emulator.getRandom().nextInt(66);
|
||||
int count = 0;
|
||||
for (int i = 8; i < 11; i++) {
|
||||
count += 11 - i;
|
||||
if (number <= count) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return 10;
|
||||
}
|
||||
|
||||
public static int randomRarityLevel() {
|
||||
int number = Emulator.getRandom().nextInt(66);
|
||||
int count = 0;
|
||||
|
@ -26,32 +26,32 @@ public class MonsterplantPet extends Pet implements IPetLook {
|
||||
public static final Map<Integer, Pair<String, Integer>> bodyRarity = new LinkedHashMap<Integer, Pair<String, Integer>>() {
|
||||
{
|
||||
this.put(1, new Pair<>("Blungon", 0));
|
||||
this.put(5, new Pair<>("Squarg", 0));
|
||||
this.put(2, new Pair<>("Wailzor", 1));
|
||||
this.put(3, new Pair<>("Stumpy", 1));
|
||||
this.put(4, new Pair<>("Sunspike", 2));
|
||||
this.put(9, new Pair<>("Weggylum", 2));
|
||||
this.put(5, new Pair<>("Squarg", 0));
|
||||
this.put(6, new Pair<>("Shroomer", 3));
|
||||
this.put(7, new Pair<>("Zuchinu", 3));
|
||||
this.put(8, new Pair<>("Abysswirl", 5));
|
||||
this.put(9, new Pair<>("Weggylum", 2));
|
||||
this.put(10, new Pair<>("Wystique", 4));
|
||||
this.put(11, new Pair<>("Hairbullis", 4));
|
||||
this.put(8, new Pair<>("Abysswirl", 5));
|
||||
this.put(12, new Pair<>("Snozzle", 5)); //Rarity???
|
||||
}
|
||||
};
|
||||
public static final Map<Integer, Pair<String, Integer>> colorRarity = new LinkedHashMap<Integer, Pair<String, Integer>>() {
|
||||
{
|
||||
this.put(0, new Pair<>("Aenueus", 0));
|
||||
this.put(9, new Pair<>("Fulvus", 0));
|
||||
this.put(1, new Pair<>("Griseus", 1));
|
||||
this.put(3, new Pair<>("Viridulus", 1));
|
||||
this.put(2, new Pair<>("Phoenicus", 2));
|
||||
this.put(3, new Pair<>("Viridulus", 1));
|
||||
this.put(4, new Pair<>("Cyaneus", 5));
|
||||
this.put(5, new Pair<>("Incarnatus", 2));
|
||||
this.put(8, new Pair<>("Amethyst", 3));
|
||||
this.put(10, new Pair<>("Cinereus", 3));
|
||||
this.put(6, new Pair<>("Azureus", 4));
|
||||
this.put(7, new Pair<>("Atamasc", 4));
|
||||
this.put(4, new Pair<>("Cyaneus", 5));
|
||||
this.put(8, new Pair<>("Amethyst", 3));
|
||||
this.put(9, new Pair<>("Fulvus", 0));
|
||||
this.put(10, new Pair<>("Cinereus", 3));
|
||||
}
|
||||
};
|
||||
public static final ArrayList<Pair<String, Integer>> indexedBody = new ArrayList<>(MonsterplantPet.bodyRarity.values());
|
||||
|
@ -19,6 +19,7 @@ import gnu.trove.map.hash.TIntObjectHashMap;
|
||||
import gnu.trove.procedure.TIntObjectProcedure;
|
||||
import gnu.trove.set.hash.THashSet;
|
||||
import org.apache.commons.math3.distribution.NormalDistribution;
|
||||
import org.apache.commons.math3.util.Pair;
|
||||
|
||||
import java.sql.*;
|
||||
import java.util.ArrayList;
|
||||
@ -101,13 +102,15 @@ public class PetManager {
|
||||
return 100 * level;
|
||||
}
|
||||
|
||||
public static int randomBody(int minimumRarity) {
|
||||
int randomRarity = random(Math.max(minimumRarity - 1, 0), MonsterplantPet.bodyRarity.size(), 2.0);
|
||||
public static int randomBody(int minimumRarity, boolean isRare) {
|
||||
int randomRarity = isRare ? random(Math.max(minimumRarity - 1, 0), (MonsterplantPet.bodyRarity.size() - minimumRarity) + (minimumRarity - 1), 2.0) : random(Math.max(minimumRarity - 1, 0), MonsterplantPet.bodyRarity.size(), 2.0);
|
||||
|
||||
return MonsterplantPet.bodyRarity.get(MonsterplantPet.bodyRarity.keySet().toArray()[randomRarity]).getValue();
|
||||
}
|
||||
|
||||
public static int randomColor(int minimumRarity) {
|
||||
int randomRarity = random(Math.max(minimumRarity - 1, 0), MonsterplantPet.colorRarity.size(), 2.0);
|
||||
public static int randomColor(int minimumRarity, boolean isRare) {
|
||||
int randomRarity = isRare ? random(Math.max(minimumRarity - 1, 0), (MonsterplantPet.colorRarity.size() - minimumRarity) + (minimumRarity - 1), 2.0) : random(Math.max(minimumRarity - 1, 0), MonsterplantPet.colorRarity.size(), 2.0);
|
||||
|
||||
return MonsterplantPet.colorRarity.get(MonsterplantPet.colorRarity.keySet().toArray()[randomRarity]).getValue();
|
||||
}
|
||||
|
||||
@ -426,8 +429,8 @@ public class PetManager {
|
||||
public MonsterplantPet createMonsterplant(Room room, Habbo habbo, boolean rare, RoomTile t, int minimumRarity) {
|
||||
MonsterplantPet pet = new MonsterplantPet(
|
||||
habbo.getHabboInfo().getId(), //Owner ID
|
||||
randomBody(rare ? 4 : minimumRarity),
|
||||
randomColor(rare ? 4 : minimumRarity),
|
||||
randomBody(minimumRarity, rare),
|
||||
randomColor(minimumRarity, rare),
|
||||
Emulator.getRandom().nextInt(12) + 1,
|
||||
Emulator.getRandom().nextInt(11),
|
||||
Emulator.getRandom().nextInt(12) + 1,
|
||||
|
@ -4497,9 +4497,9 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
||||
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))))
|
||||
return FurnitureMovementError.CANT_STACK;
|
||||
if (this.hasHabbosAt(t.x, t.y)) return FurnitureMovementError.TILE_HAS_HABBOS;
|
||||
if (this.hasBotsAt(t.x, t.y)) return FurnitureMovementError.TILE_HAS_BOTS;
|
||||
if (this.hasPetsAt(t.x, t.y)) return FurnitureMovementError.TILE_HAS_PETS;
|
||||
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.hasPetsAt(t.x, t.y)) return FurnitureMovementError.TILE_HAS_PETS;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -78,7 +78,7 @@ public class HabboStats implements Runnable {
|
||||
public int forumPostsCount;
|
||||
public THashMap<Integer, List<Integer>> ltdPurchaseLog = new THashMap<>(0);
|
||||
public long lastTradeTimestamp = Emulator.getIntUnixTimestamp();
|
||||
public long lastPurchaseTimestamp = Emulator.getIntUnixTimestamp();
|
||||
public int lastPurchaseTimestamp;
|
||||
public long lastGiftTimestamp = Emulator.getIntUnixTimestamp();
|
||||
public int uiFlags;
|
||||
public boolean hasGottenDefaultSavedSearches;
|
||||
@ -135,6 +135,8 @@ public class HabboStats implements Runnable {
|
||||
this.forumPostsCount = set.getInt("forums_post_count");
|
||||
this.uiFlags = set.getInt("ui_flags");
|
||||
this.hasGottenDefaultSavedSearches = set.getInt("has_gotten_default_saved_searches") == 1;
|
||||
this.lastPurchaseTimestamp = set.getInt("last_purchase_timestamp");
|
||||
|
||||
this.nuxReward = this.nux;
|
||||
|
||||
try (PreparedStatement statement = set.getStatement().getConnection().prepareStatement("SELECT * FROM user_window_settings WHERE user_id = ? LIMIT 1")) {
|
||||
@ -294,7 +296,7 @@ public class HabboStats implements Runnable {
|
||||
@Override
|
||||
public void run() {
|
||||
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection()) {
|
||||
try (PreparedStatement statement = connection.prepareStatement("UPDATE users_settings SET achievement_score = ?, respects_received = ?, respects_given = ?, daily_respect_points = ?, block_following = ?, block_friendrequests = ?, online_time = online_time + ?, guild_id = ?, daily_pet_respect_points = ?, club_expire_timestamp = ?, login_streak = ?, rent_space_id = ?, rent_space_endtime = ?, volume_system = ?, volume_furni = ?, volume_trax = ?, block_roominvites = ?, old_chat = ?, block_camera_follow = ?, chat_color = ?, hof_points = ?, block_alerts = ?, talent_track_citizenship_level = ?, talent_track_helpers_level = ?, ignore_bots = ?, ignore_pets = ?, nux = ?, mute_end_timestamp = ?, allow_name_change = ?, perk_trade = ?, can_trade = ?, `forums_post_count` = ?, ui_flags = ?, has_gotten_default_saved_searches = ? WHERE user_id = ? LIMIT 1")) {
|
||||
try (PreparedStatement statement = connection.prepareStatement("UPDATE users_settings SET achievement_score = ?, respects_received = ?, respects_given = ?, daily_respect_points = ?, block_following = ?, block_friendrequests = ?, online_time = online_time + ?, guild_id = ?, daily_pet_respect_points = ?, club_expire_timestamp = ?, login_streak = ?, rent_space_id = ?, rent_space_endtime = ?, volume_system = ?, volume_furni = ?, volume_trax = ?, block_roominvites = ?, old_chat = ?, block_camera_follow = ?, chat_color = ?, hof_points = ?, block_alerts = ?, talent_track_citizenship_level = ?, talent_track_helpers_level = ?, ignore_bots = ?, ignore_pets = ?, nux = ?, mute_end_timestamp = ?, allow_name_change = ?, perk_trade = ?, can_trade = ?, `forums_post_count` = ?, ui_flags = ?, has_gotten_default_saved_searches = ?, last_purchase_timestamp = ? WHERE user_id = ? LIMIT 1")) {
|
||||
statement.setInt(1, this.achievementScore);
|
||||
statement.setInt(2, this.respectPointsReceived);
|
||||
statement.setInt(3, this.respectPointsGiven);
|
||||
@ -329,8 +331,10 @@ public class HabboStats implements Runnable {
|
||||
statement.setInt(32, this.forumPostsCount);
|
||||
statement.setInt(33, this.uiFlags);
|
||||
statement.setInt(34, this.hasGottenDefaultSavedSearches ? 1 : 0);
|
||||
statement.setInt(35, this.lastPurchaseTimestamp);
|
||||
|
||||
statement.setInt(35, this.habboInfo.getId());
|
||||
statement.setInt(36, this.habboInfo.getId());
|
||||
|
||||
statement.executeUpdate();
|
||||
}
|
||||
|
||||
|
@ -177,6 +177,8 @@ public class CatalogBuyItemEvent extends MessageHandler {
|
||||
|
||||
this.client.sendResponse(new PurchaseOKComposer(null));
|
||||
this.client.sendResponse(new InventoryRefreshComposer());
|
||||
|
||||
this.client.getHabbo().getHabboStats().lastPurchaseTimestamp = Emulator.getIntUnixTimestamp();
|
||||
this.client.getHabbo().getHabboStats().run();
|
||||
}
|
||||
return;
|
||||
|
@ -81,14 +81,19 @@ public class ToggleFloorItemEvent extends MessageHandler {
|
||||
if (item instanceof InteractionMonsterPlantSeed) {
|
||||
Emulator.getThreading().run(new QueryDeleteHabboItem(item.getId()));
|
||||
int rarity = 0;
|
||||
if (item.getExtradata().isEmpty()) rarity = InteractionMonsterPlantSeed.randomRarityLevel();
|
||||
|
||||
boolean isRare = item.getBaseItem().getName().contains("rare");
|
||||
|
||||
if ((!item.getExtradata().isEmpty() && Integer.valueOf(item.getExtradata()) - 1 < 0) || item.getExtradata().isEmpty()) {
|
||||
rarity = isRare ? InteractionMonsterPlantSeed.randomGoldenRarityLevel() : InteractionMonsterPlantSeed.randomRarityLevel();
|
||||
}
|
||||
else {
|
||||
try {
|
||||
rarity = Integer.valueOf(item.getExtradata()) - 1;
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
MonsterplantPet pet = Emulator.getGameEnvironment().getPetManager().createMonsterplant(room, this.client.getHabbo(), item.getBaseItem().getName().contains("rare"), room.getLayout().getTile(item.getX(), item.getY()), rarity);
|
||||
MonsterplantPet pet = Emulator.getGameEnvironment().getPetManager().createMonsterplant(room, this.client.getHabbo(), isRare, room.getLayout().getTile(item.getX(), item.getY()), rarity);
|
||||
room.sendComposer(new RemoveFloorItemComposer(item, true).compose());
|
||||
room.removeHabboItem(item);
|
||||
room.updateTile(room.getLayout().getTile(item.getX(), item.getY()));
|
||||
|
@ -39,9 +39,9 @@ public class RequestUserDataEvent extends MessageHandler {
|
||||
messages.add(new UserDataComposer(this.client.getHabbo()).compose());
|
||||
messages.add(new UserPerksComposer(this.client.getHabbo()).compose());
|
||||
|
||||
if (this.client.getHabbo().getHabboInfo().getHomeRoom() != 0)
|
||||
if (!this.client.getHabbo().getHabboStats().nux && this.client.getHabbo().getHabboInfo().getHomeRoom() != 0)
|
||||
messages.add(new ForwardToRoomComposer(this.client.getHabbo().getHabboInfo().getHomeRoom()).compose());
|
||||
else if (RoomManager.HOME_ROOM_ID > 0)
|
||||
else if (!this.client.getHabbo().getHabboStats().nux && RoomManager.HOME_ROOM_ID > 0)
|
||||
messages.add(new ForwardToRoomComposer(RoomManager.HOME_ROOM_ID).compose());
|
||||
|
||||
messages.add(new MeMenuSettingsComposer(this.client.getHabbo()).compose());
|
||||
|
@ -11,6 +11,7 @@ import io.netty.channel.ChannelHandlerContext;
|
||||
public class ChannelReadHandler implements Runnable {
|
||||
private final ChannelHandlerContext ctx;
|
||||
private final Object msg;
|
||||
//private int _header;
|
||||
|
||||
public ChannelReadHandler(ChannelHandlerContext ctx, Object msg) {
|
||||
this.ctx = ctx;
|
||||
@ -18,29 +19,52 @@ public class ChannelReadHandler implements Runnable {
|
||||
}
|
||||
|
||||
public void run() {
|
||||
ByteBuf m = (ByteBuf) this.msg;
|
||||
int length = m.readInt();
|
||||
short header = m.readShort();
|
||||
GameClient client = this.ctx.channel().attr(GameClientManager.CLIENT).get();
|
||||
try {
|
||||
ByteBuf m = (ByteBuf) this.msg;
|
||||
int length = m.readInt();
|
||||
short header = m.readShort();
|
||||
//_header = header;
|
||||
GameClient client = this.ctx.channel().attr(GameClientManager.CLIENT).get();
|
||||
|
||||
if (client != null) {
|
||||
int count = 0;
|
||||
int timestamp = Emulator.getIntUnixTimestamp();
|
||||
if (timestamp - client.lastPacketCounterCleared > 1) {
|
||||
client.incomingPacketCounter.clear();
|
||||
client.lastPacketCounterCleared = timestamp;
|
||||
} else {
|
||||
count = client.incomingPacketCounter.getOrDefault(header, 0);
|
||||
if (m.readableBytes() + 2 < length) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (count <= 10) {
|
||||
count++;
|
||||
client.incomingPacketCounter.put((int) header, count);
|
||||
ByteBuf body = Unpooled.wrappedBuffer(m.readBytes(m.readableBytes()));
|
||||
Emulator.getGameServer().getPacketManager().handlePacket(client, new ClientMessage(header, body));
|
||||
body.release();
|
||||
if (client != null) {
|
||||
int count = 0;
|
||||
int timestamp = Emulator.getIntUnixTimestamp();
|
||||
if (timestamp - client.lastPacketCounterCleared > 1) {
|
||||
client.incomingPacketCounter.clear();
|
||||
client.lastPacketCounterCleared = timestamp;
|
||||
} else {
|
||||
if (m.readableBytes() + 2 < length) {
|
||||
m.resetReaderIndex();
|
||||
client.incomingPacketCounter.put((int) header, 0);
|
||||
count = 0;
|
||||
return;
|
||||
} else {
|
||||
count = client.incomingPacketCounter.getOrDefault(header, 0);
|
||||
}
|
||||
}
|
||||
|
||||
if (count <= 10) {
|
||||
count++;
|
||||
if (m.readableBytes() + 2 < length) {
|
||||
m.resetReaderIndex();
|
||||
client.incomingPacketCounter.put((int) header, 0);
|
||||
count = 0;
|
||||
return;
|
||||
}
|
||||
client.incomingPacketCounter.put((int) header, count);
|
||||
ByteBuf body = Unpooled.wrappedBuffer(m.readBytes(m.readableBytes()));
|
||||
Emulator.getGameServer().getPacketManager().handlePacket(client, new ClientMessage(header, body));
|
||||
body.release();
|
||||
}
|
||||
}
|
||||
|
||||
m.release();
|
||||
} catch (Exception e) {
|
||||
//System.out.println("Potential packet overflow occurring, careful! header: " + _header + e.getMessage());
|
||||
}
|
||||
m.release();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user