mirror of
https://git.krews.org/morningstar/Arcturus-Community.git
synced 2024-11-26 16:30:52 +01:00
Customizable gift wrapping config & gift purchase validation
This commit is contained in:
parent
9e5a00b052
commit
a0c1973622
@ -21,3 +21,7 @@ UPDATE `emulator_texts` SET `value` = 'You\'ve reached the maximum amount of pet
|
||||
|
||||
-- Tradelock counter
|
||||
ALTER TABLE `users_settings` ADD `tradelock_amount` INT(11) NOT NULL DEFAULT '0' AFTER `helper_level`;
|
||||
|
||||
-- Gift wrapping configuration
|
||||
INSERT INTO `emulator_settings`(`key`, `value`) VALUES ('hotel.gifts.box_types', '0,1,2,3,4,5,6,8');
|
||||
INSERT INTO `emulator_settings`(`key`, `value`) VALUES ('hotel.gifts.ribbon_types', '0,1,2,3,4,5,6,7,8,9,10');
|
||||
|
@ -75,6 +75,11 @@ public class CatalogBuyItemAsGiftEvent extends MessageHandler {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!GiftConfigurationComposer.BOX_TYPES.contains(color) || !GiftConfigurationComposer.RIBBON_TYPES.contains(ribbonId)) {
|
||||
this.client.sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.SERVER_ERROR).compose());
|
||||
return;
|
||||
}
|
||||
|
||||
Integer iItemId = Emulator.getGameEnvironment().getCatalogManager().giftWrappers.get(spriteId);
|
||||
|
||||
if (iItemId == null)
|
||||
|
@ -5,9 +5,14 @@ import com.eu.habbo.messages.ServerMessage;
|
||||
import com.eu.habbo.messages.outgoing.MessageComposer;
|
||||
import com.eu.habbo.messages.outgoing.Outgoing;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class GiftConfigurationComposer extends MessageComposer {
|
||||
public static List<Integer> BOX_TYPES = Arrays.asList(0, 1, 2, 3, 4, 5, 6, 8);
|
||||
public static List<Integer> RIBBON_TYPES = Arrays.asList(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
|
||||
|
||||
@Override
|
||||
protected ServerMessage composeInternal() {
|
||||
this.response.init(Outgoing.GiftConfigurationComposer);
|
||||
@ -19,28 +24,15 @@ public class GiftConfigurationComposer extends MessageComposer {
|
||||
this.response.appendInt(i);
|
||||
}
|
||||
|
||||
this.response.appendInt(8);
|
||||
this.response.appendInt(0);
|
||||
this.response.appendInt(1);
|
||||
this.response.appendInt(2);
|
||||
this.response.appendInt(3);
|
||||
this.response.appendInt(4);
|
||||
this.response.appendInt(5);
|
||||
this.response.appendInt(6);
|
||||
this.response.appendInt(8);
|
||||
this.response.appendInt(BOX_TYPES.size());
|
||||
for (Integer type : BOX_TYPES) {
|
||||
this.response.appendInt(type);
|
||||
}
|
||||
|
||||
this.response.appendInt(11);
|
||||
this.response.appendInt(0);
|
||||
this.response.appendInt(1);
|
||||
this.response.appendInt(2);
|
||||
this.response.appendInt(3);
|
||||
this.response.appendInt(4);
|
||||
this.response.appendInt(5);
|
||||
this.response.appendInt(6);
|
||||
this.response.appendInt(7);
|
||||
this.response.appendInt(8);
|
||||
this.response.appendInt(9);
|
||||
this.response.appendInt(10);
|
||||
this.response.appendInt(RIBBON_TYPES.size());
|
||||
for (Integer type : RIBBON_TYPES) {
|
||||
this.response.appendInt(type);
|
||||
}
|
||||
|
||||
this.response.appendInt(Emulator.getGameEnvironment().getCatalogManager().giftFurnis.size());
|
||||
|
||||
|
@ -34,6 +34,7 @@ import com.eu.habbo.messages.incoming.hotelview.HotelViewRequestLTDAvailabilityE
|
||||
import com.eu.habbo.messages.incoming.rooms.promotions.BuyRoomPromotionEvent;
|
||||
import com.eu.habbo.messages.incoming.users.ChangeNameCheckUsernameEvent;
|
||||
import com.eu.habbo.messages.outgoing.catalog.DiscountComposer;
|
||||
import com.eu.habbo.messages.outgoing.catalog.GiftConfigurationComposer;
|
||||
import com.eu.habbo.messages.outgoing.navigator.NewNavigatorEventCategoriesComposer;
|
||||
import com.eu.habbo.plugin.events.emulator.EmulatorConfigUpdatedEvent;
|
||||
import com.eu.habbo.plugin.events.emulator.EmulatorLoadedEvent;
|
||||
@ -58,6 +59,7 @@ import java.net.URLClassLoader;
|
||||
import java.util.Arrays;
|
||||
import java.util.NoSuchElementException;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class PluginManager {
|
||||
|
||||
@ -154,6 +156,9 @@ public class PluginManager {
|
||||
BotManager.MAXIMUM_BOT_INVENTORY_SIZE = Emulator.getConfig().getInt("hotel.bots.max.inventory");
|
||||
PetManager.MAXIMUM_PET_INVENTORY_SIZE = Emulator.getConfig().getInt("hotel.pets.max.inventory");
|
||||
|
||||
GiftConfigurationComposer.BOX_TYPES = Arrays.stream(Emulator.getConfig().getValue("hotel.gifts.box_types").split(",")).mapToInt(Integer::parseInt).boxed().collect(Collectors.toList());
|
||||
GiftConfigurationComposer.RIBBON_TYPES = Arrays.stream(Emulator.getConfig().getValue("hotel.gifts.ribbon_types").split(",")).mapToInt(Integer::parseInt).boxed().collect(Collectors.toList());
|
||||
|
||||
NewNavigatorEventCategoriesComposer.CATEGORIES.clear();
|
||||
for (String category : Emulator.getConfig().getValue("navigator.eventcategories", "").split(";")) {
|
||||
try {
|
||||
|
Loading…
Reference in New Issue
Block a user