mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2025-12-14 18:40:18 -07:00
Added new framework for handling special ground items
This commit is contained in:
parent
25142860b2
commit
217ac01c88
4 changed files with 71 additions and 13 deletions
|
|
@ -0,0 +1,15 @@
|
||||||
|
package org.crandor.game.interaction;
|
||||||
|
|
||||||
|
import org.crandor.game.node.entity.player.Player;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stub class for special ground item interactions
|
||||||
|
* @author ceik
|
||||||
|
*/
|
||||||
|
public class SpecialGroundInteraction {
|
||||||
|
public void handle(Player player, Option option){
|
||||||
|
}
|
||||||
|
public void configure(){
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,32 @@
|
||||||
|
package org.crandor.game.interaction;
|
||||||
|
|
||||||
|
import org.crandor.game.node.item.GroundItem;
|
||||||
|
import org.crandor.game.node.item.GroundItemManager;
|
||||||
|
import org.crandor.game.world.map.Location;
|
||||||
|
import plugin.interaction.city.falador.WineOfZamorakInteraction;
|
||||||
|
import plugin.interaction.city.portsarim.AhabBeerInteraction;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handles interactions for special ground items
|
||||||
|
* @author ceik
|
||||||
|
*/
|
||||||
|
public enum SpecialGroundItems {
|
||||||
|
//Ahab's beer
|
||||||
|
AHAB_BEER(1917,new Location(3049,3257,0), new AhabBeerInteraction()),
|
||||||
|
WINE_OF_ZAMORAK(245, Location.create(2931, 3515, 0), new WineOfZamorakInteraction());
|
||||||
|
|
||||||
|
private int itemid;
|
||||||
|
private Location location;
|
||||||
|
private SpecialGroundInteraction inter;
|
||||||
|
|
||||||
|
SpecialGroundItems(int itemId, Location location, SpecialGroundInteraction inter){
|
||||||
|
this.itemid = itemId;
|
||||||
|
this.location = location;
|
||||||
|
this.inter = inter;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SpecialGroundInteraction getInteraction() { return inter;}
|
||||||
|
public int getItemid() {return itemid;}
|
||||||
|
public Location getLocation() {return location;}
|
||||||
|
public GroundItem asGroundItem(){return GroundItemManager.get(itemid,location,null);}
|
||||||
|
}
|
||||||
|
|
@ -83,19 +83,6 @@ public final class FaladorNodePlugin extends OptionHandler {
|
||||||
case 2290:
|
case 2290:
|
||||||
player.getDialogueInterpreter().open(id, node);
|
player.getDialogueInterpreter().open(id, node);
|
||||||
return true;
|
return true;
|
||||||
case 245:
|
|
||||||
if (node.getLocation().equals(new Location(2931, 3515, 0))) {
|
|
||||||
final List<NPC> npcs = RegionManager.getLocalNpcs(player);
|
|
||||||
for (NPC n : npcs) {
|
|
||||||
if (n.getId() == 188) {
|
|
||||||
n.sendChat("Hands off zamorak's wine!");
|
|
||||||
n.getProperties().getCombatPulse().attack(player);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return PickupHandler.take(player, (GroundItem) node);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 5020:
|
case 5020:
|
||||||
player.getDialogueInterpreter().sendDialogue("You must visit Keldagrim before you are allowed to ride mine carts.");
|
player.getDialogueInterpreter().sendDialogue("You must visit Keldagrim before you are allowed to ride mine carts.");
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
package plugin.interaction.city.falador;
|
||||||
|
|
||||||
|
import org.crandor.game.interaction.Option;
|
||||||
|
import org.crandor.game.interaction.SpecialGroundInteraction;
|
||||||
|
import org.crandor.game.interaction.SpecialGroundItems;
|
||||||
|
import org.crandor.game.node.entity.npc.NPC;
|
||||||
|
import org.crandor.game.node.entity.player.Player;
|
||||||
|
import org.crandor.game.world.map.RegionManager;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class WineOfZamorakInteraction extends SpecialGroundInteraction {
|
||||||
|
@Override
|
||||||
|
public void handle(Player player, Option option){
|
||||||
|
player.faceLocation(SpecialGroundItems.WINE_OF_ZAMORAK.getLocation());
|
||||||
|
final List<NPC> npcs = RegionManager.getLocalNpcs(player);
|
||||||
|
for (NPC n : npcs) {
|
||||||
|
if (n.getId() == 188) {
|
||||||
|
n.sendChat("Hands off zamorak's wine!");
|
||||||
|
n.getProperties().getCombatPulse().attack(player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue