Yaks now have their unique usewith interaction
This commit is contained in:
@@ -112,6 +112,8 @@ public abstract class MapZone implements Zone {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean handleUseWith(Player player, Item used, Node with){return false;}
|
||||
|
||||
/**
|
||||
* Handles an reward button.
|
||||
* @param player The player.
|
||||
|
||||
@@ -7,6 +7,7 @@ import core.game.node.entity.combat.CombatStyle;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.entity.player.link.music.MusicZone;
|
||||
import core.game.node.entity.player.link.request.RequestType;
|
||||
import core.game.node.item.Item;
|
||||
import core.game.world.map.Location;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -149,6 +150,18 @@ public final class ZoneMonitor {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a zone handles a useWith interaction
|
||||
*/
|
||||
public boolean useWith(Item used, Node with){
|
||||
for (RegionZone z : zones) {
|
||||
if (z.getZone().handleUseWith(entity.asPlayer(), used,with)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the player handled the reward button using a map zone.
|
||||
* @param interfaceId The interface id.
|
||||
|
||||
@@ -72,6 +72,9 @@ public class ItemActionPacket implements IncomingPacket {
|
||||
if(InteractionListeners.run(item,npc,2,player)){
|
||||
return;
|
||||
}
|
||||
if(player.getZoneMonitor().useWith(used,npc)){
|
||||
return;
|
||||
}
|
||||
event = new NodeUsageEvent(player, interfaceId, item, npc);
|
||||
try {
|
||||
UseWithHandler.run(event);
|
||||
@@ -97,6 +100,9 @@ public class ItemActionPacket implements IncomingPacket {
|
||||
if(PluginInteractionManager.handle(player,event)){
|
||||
return;
|
||||
}
|
||||
if(player.getZoneMonitor().useWith(used,player)){
|
||||
return;
|
||||
}
|
||||
event = new NodeUsageEvent(player, interfaceId, item, target);
|
||||
try {
|
||||
UseWithHandler.run(event);
|
||||
@@ -131,6 +137,9 @@ public class ItemActionPacket implements IncomingPacket {
|
||||
if(InteractionListeners.run(used,with,0,player)){
|
||||
return;
|
||||
}
|
||||
if(player.getZoneMonitor().useWith(used,with)){
|
||||
return;
|
||||
}
|
||||
if (usedItemId < usedWithItemId) {
|
||||
item = used;
|
||||
used = with;
|
||||
@@ -182,6 +191,9 @@ public class ItemActionPacket implements IncomingPacket {
|
||||
if(InteractionListeners.run(used,object,1,player)){
|
||||
return;
|
||||
}
|
||||
if(player.getZoneMonitor().useWith(used,object)){
|
||||
return;
|
||||
}
|
||||
event = new NodeUsageEvent(player, 0, used, object);
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user