Halloween Event 2021
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package core.game.interaction.item.toys;
|
||||
|
||||
import api.ContentAPI;
|
||||
import core.game.component.Component;
|
||||
import core.game.component.ComponentDefinition;
|
||||
import core.game.component.ComponentPlugin;
|
||||
@@ -24,7 +25,7 @@ import java.util.Objects;
|
||||
public class DiangoReclaimInterface extends ComponentPlugin {
|
||||
private static final int COMPONENT_ID = 468;
|
||||
public static final List<Item> ITEMS = new ArrayList<>(20);
|
||||
public static final Item[] HOLIDAY_ITEMS = {YoyoPlugin.YOYO, ReindeerHatPlugin.ReindeerHat, BasketofEggsEvent.RUBBER_CHICKEN,ZombieHeadPlugin.ZOMBIE_HEAD, new Item(6857), new Item(6856), new Item(6858), new Item(6859), new Item(6860), new Item(6861), new Item(6862), new Item(6863), new Item(9920), new Item(9921),new Item(9922), new Item(9923), new Item(9924), new Item(9925), new Item(11019), new Item(11020), new Item(11021), new Item(11022), new Item(11789), new Item(11949), new Item(12634), new Item(14076), new Item(14077), new Item(14081),new Item(14595), new Item(14602), new Item(14603), new Item(14605)};
|
||||
public static final Item[] HOLIDAY_ITEMS = {YoyoPlugin.YOYO, ReindeerHatPlugin.ReindeerHat, BasketofEggsEvent.RUBBER_CHICKEN,ZombieHeadPlugin.ZOMBIE_HEAD, new Item(6857), new Item(6856), new Item(6858), new Item(6859), new Item(6860), new Item(6861), new Item(6862), new Item(6863), new Item(9920), new Item(9921),new Item(9922), new Item(9923), new Item(9924), new Item(9925), new Item(11019), new Item(11020), new Item(11021), new Item(11022), new Item(11789), new Item(11949), new Item(12634), new Item(14076), new Item(14077), new Item(14081),new Item(14595), new Item(14602), new Item(14603), new Item(14605), new Item(14654)};
|
||||
|
||||
//initialize the plugin, add lists of items to the ITEMS list...
|
||||
@Override
|
||||
@@ -43,7 +44,12 @@ public class DiangoReclaimInterface extends ComponentPlugin {
|
||||
}
|
||||
|
||||
//filter out items the player already has in their bank, inventory, or equipped
|
||||
Item[] reclaimables = ITEMS.stream().filter(Objects::nonNull).filter(item -> !player.getEquipment().containsItem(item) && !player.getInventory().containsItem(item) && !player.getBank().containsItem(item)).toArray(Item[]::new);
|
||||
Item[] reclaimables = ITEMS.stream().filter(Objects::nonNull)
|
||||
.filter(item -> !player.getEquipment().containsItem(item) && !player.getInventory().containsItem(item) && !player.getBank().containsItem(item)
|
||||
&& (item.getId() != 14654
|
||||
|| (!(ContentAPI.inInventory(player, 14655, 1) || ContentAPI.inEquipment(player, 14656, 1)) && player.getAttribute("sotr:purchased",false))
|
||||
))
|
||||
.toArray(Item[]::new);
|
||||
|
||||
//only send items if there are some to send
|
||||
if(reclaimables.length > 0) {
|
||||
|
||||
@@ -26,7 +26,10 @@ import rs09.game.interaction.InteractionListener;
|
||||
import rs09.game.interaction.InteractionListeners;
|
||||
import rs09.game.world.repository.Repository;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.function.IntPredicate;
|
||||
|
||||
/**
|
||||
* Handles the incoming interaction packets.
|
||||
@@ -34,6 +37,8 @@ import java.util.List;
|
||||
*/
|
||||
public final class InteractionPacket implements IncomingPacket {
|
||||
|
||||
static int[] hweenNPCs = new int[] {307, 375, 743, 744, 755, 2634, 2690, 2691, 2692, 530, 531, 556, 557, 558, 559, 583, 585, 1860, 3299, 3671, 922, 970};
|
||||
|
||||
@Override
|
||||
public void decode(Player player, int opcode, IoBuffer buffer) {
|
||||
if (player == null) {
|
||||
@@ -176,8 +181,13 @@ public final class InteractionPacket implements IncomingPacket {
|
||||
return;
|
||||
}
|
||||
NPC shown = npc.getShownNPC(player);
|
||||
final Option option = shown.getInteraction().get(optionIndex);
|
||||
Option option = shown.getInteraction().get(optionIndex);
|
||||
if (option == null) {
|
||||
if (Arrays.stream(hweenNPCs).anyMatch(i -> i == shown.getId())) {
|
||||
option = new Option("trick-or-treat", -1);
|
||||
}
|
||||
}
|
||||
if(option == null) {
|
||||
PacketRepository.send(ClearMinimapFlag.class, new PlayerContext(player));
|
||||
Interaction.handleInvalidInteraction(player, npc, Option.NULL);
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user