From 09a643b411f720502b703e469b458a5fcd2ec5e9 Mon Sep 17 00:00:00 2001 From: ceik Date: Wed, 18 Mar 2020 22:15:27 -0500 Subject: [PATCH 1/3] Added the 8th room and reworked the coords checking into mapzones --- .../game/content/eco/ge/GEAutoStock.java | 4 ++ .../activity/pyramidplunder/PlunderZones.java | 70 +++++++++++++++++++ .../pyramidplunder/PyramidPlunderOptions.java | 32 ++++----- Server/src/plugin/dialogue/GEAutoStock.java | 4 ++ 4 files changed, 94 insertions(+), 16 deletions(-) create mode 100644 Server/src/org/crandor/game/content/eco/ge/GEAutoStock.java create mode 100644 Server/src/plugin/activity/pyramidplunder/PlunderZones.java create mode 100644 Server/src/plugin/dialogue/GEAutoStock.java diff --git a/Server/src/org/crandor/game/content/eco/ge/GEAutoStock.java b/Server/src/org/crandor/game/content/eco/ge/GEAutoStock.java new file mode 100644 index 000000000..454603140 --- /dev/null +++ b/Server/src/org/crandor/game/content/eco/ge/GEAutoStock.java @@ -0,0 +1,4 @@ +package org.crandor.game.content.eco.ge; + +public class GEAutoStock { +} diff --git a/Server/src/plugin/activity/pyramidplunder/PlunderZones.java b/Server/src/plugin/activity/pyramidplunder/PlunderZones.java new file mode 100644 index 000000000..bda7a1549 --- /dev/null +++ b/Server/src/plugin/activity/pyramidplunder/PlunderZones.java @@ -0,0 +1,70 @@ +package plugin.activity.pyramidplunder; +import org.crandor.game.node.entity.Entity; +import org.crandor.game.node.entity.player.Player; +import org.crandor.game.world.map.zone.MapZone; +import org.crandor.game.world.map.zone.ZoneBorders; +import org.crandor.game.world.map.zone.ZoneBuilder; +import org.crandor.plugin.InitializablePlugin; +import org.crandor.plugin.Plugin; + +/** + * Defines the zones for the pyramid plunder rooms + * @author ceik + */ + +@InitializablePlugin +public class PlunderZones implements Plugin { + PlunderZone[] ROOMS = { + new PlunderZone("PR1", 1,1923, 4464, 1932, 4474), + new PlunderZone("PR2", 2,1925, 4449, 1941, 4458), + new PlunderZone("PR3", 3,1941, 4421, 1954, 4432), + new PlunderZone("PR4", 4,1949, 4464, 1959, 4477), + new PlunderZone("PR5", 5,1968, 4420, 1978, 4436), + new PlunderZone("PR6", 6,1969, 4452, 1980, 4473), + new PlunderZone("PR7", 7,1923, 4424, 1931, 4439), + new PlunderZone("PR8", 8, 1950, 4442, 1969, 4455) + }; + + @Override + public Plugin newInstance(Object arg) throws Throwable { + for(PlunderZone ROOM : ROOMS){ + ZoneBuilder.configure(ROOM); + } + return this; + } + @Override + public Object fireEvent(String identifier, Object... args) { + return null; + } + + public class PlunderZone extends MapZone { + int swx, swy, nex, ney; + String name; + int roomnum; + + public PlunderZone(String name, int roomnum, int swx, int swy, int nex, int ney) { + super(name, true); + this.name = name; + this.swx = swx; + this.swy = swy; + this.nex = nex; + this.ney = ney; + this.roomnum = roomnum; + } + + @Override + public void configure() { + ZoneBorders borders = new ZoneBorders(swx, swy, nex, ney,0); + register(borders); + } + + @Override + public boolean enter(Entity e){ + if(e instanceof Player) { + e.asPlayer().getPacketDispatch().sendMessage("Room: " + (roomnum) + " Level required: " + (21 + ((roomnum - 1) * 10))); + e.asPlayer().getPlunderObjectManager().resetObjectsFor(e.asPlayer()); + } + return true; + } + } +} \ No newline at end of file diff --git a/Server/src/plugin/activity/pyramidplunder/PyramidPlunderOptions.java b/Server/src/plugin/activity/pyramidplunder/PyramidPlunderOptions.java index bedad924c..d43808d24 100644 --- a/Server/src/plugin/activity/pyramidplunder/PyramidPlunderOptions.java +++ b/Server/src/plugin/activity/pyramidplunder/PyramidPlunderOptions.java @@ -11,6 +11,7 @@ import org.crandor.game.node.item.Item; import org.crandor.game.node.object.ObjectBuilder; import org.crandor.game.world.GameWorld; import org.crandor.game.world.map.Location; +import org.crandor.game.world.map.zone.ZoneMonitor; import org.crandor.game.world.update.flag.context.Animation; import org.crandor.plugin.InitializablePlugin; import org.crandor.plugin.Plugin; @@ -70,50 +71,53 @@ public final class PyramidPlunderOptions extends OptionHandler { public boolean handle(Player player, Node node, String option) { PlunderObjectManager manager = player.getPlunderObjectManager(); int NPCDeathTime = GameWorld.getTicks() + (1000 / 6); - Location room_entrance[] = {new Location(1927,4477), new Location(1927,4453), new Location(1943,4421), new Location(1954,4477), new Location(1974,4420), new Location(1977,4471), new Location(1927, 4424)}; - int currentX = player.getLocation().getX(); - int currentY = player.getLocation().getY(); + Location room_entrance[] = {new Location(1927,4477), new Location(1927,4453), new Location(1943,4421), new Location(1954,4477), new Location(1974,4420), new Location(1977,4471), new Location(1927, 4424), new Location(1965,4444)}; int level = player.getSkills().getLevel(Skills.THIEVING); int room = 0; int spearX = 0; int spearY = 0; double droom = 0.0; - if(currentX >= 1923 && currentX <= 1932 && currentY <= 4477 && currentY >= 4464 ){ + ZoneMonitor zmon = player.getZoneMonitor(); + if(zmon.isInZone("PR1")){ room = 1; reqLevel = 21; spearX = 0; spearY = -2; - - } else if(currentX >= 1925 && currentX <= 1941 && currentY <= 4458 && currentY >= 4449 ){ + } else if(zmon.isInZone("PR2")){ room = 2; reqLevel = 31; spearX = 2; spearY = 0; - } else if(currentX >= 1941 && currentX <= 1954 && currentY >=4421 && currentY <= 4432 ){ + } else if(zmon.isInZone("PR3")){ room = 3; reqLevel = 41; spearX = 0; spearY = 2; - } else if(currentX >= 1949 && currentX <= 1959 && currentY <= 4477 && currentY >= 4464){ + } else if(zmon.isInZone("PR4")){ room = 4; reqLevel = 51; spearX = 0; spearY = -2; - } else if(currentX >= 1968 && currentX <= 1978 && currentY <= 4436 && currentY >= 4420){ + } else if(zmon.isInZone("PR5")){ room = 5; reqLevel = 61; spearX = 0; spearY = 2; - } else if(currentX >= 1970 && currentX <= 1979 && currentY <= 4471 && currentY >= 4424){ + } else if(zmon.isInZone("PR6")){ room = 6; reqLevel = 71; spearX = 0; spearY = -2; - } else if(currentX >= 1923 && currentX <= 1931 && currentY <= 4439 && currentY >= 4424){ - room = 8; + } else if(zmon.isInZone("PR7")){ + room = 7; reqLevel = 81; spearX = 0; spearY = 2; + } else if(zmon.isInZone("PR8")){ + room = 8; + reqLevel = 91; + spearX = -2; + spearY = 0; } PlunderObject object = new PlunderObject(node.asObject().getId(),node.asObject().getLocation(),player); droom = (double) room; @@ -301,16 +305,12 @@ public final class PyramidPlunderOptions extends OptionHandler { if (doesOpen) { player.getPacketDispatch().sendMessage("The door opens!"); player.getProperties().setTeleportLocation(room_entrance[room]); - player.getPacketDispatch().sendMessage("Room: " + (room + 1) + " Level required: " + (reqLevel + 10)); - player.getPlunderObjectManager().resetObjectsFor(player); } else { player.getPacketDispatch().sendMessage("You fail to unlock the door."); } } else if(room == 8) { ClimbActionHandler.climb(player, ClimbActionHandler.CLIMB_UP, Location.create(3288, 2801, 0)); - player.getPlunderObjectManager().resetObjectsFor(player); } - manager.resetObjectsFor(player); break; } return true; diff --git a/Server/src/plugin/dialogue/GEAutoStock.java b/Server/src/plugin/dialogue/GEAutoStock.java new file mode 100644 index 000000000..6fe2d3afc --- /dev/null +++ b/Server/src/plugin/dialogue/GEAutoStock.java @@ -0,0 +1,4 @@ +package plugin.dialogue; + +public class GEAutoStock { +} From c4ad1c4e4ab7c4afd5027864b7260c94a2e3eb51 Mon Sep 17 00:00:00 2001 From: ceik Date: Wed, 18 Mar 2020 22:16:54 -0500 Subject: [PATCH 2/3] Added the 8th room and reworked the coords checking into mapzones --- Server/src/plugin/dialogue/GEAutoStock.java | 4 ---- 1 file changed, 4 deletions(-) delete mode 100644 Server/src/plugin/dialogue/GEAutoStock.java diff --git a/Server/src/plugin/dialogue/GEAutoStock.java b/Server/src/plugin/dialogue/GEAutoStock.java deleted file mode 100644 index 6fe2d3afc..000000000 --- a/Server/src/plugin/dialogue/GEAutoStock.java +++ /dev/null @@ -1,4 +0,0 @@ -package plugin.dialogue; - -public class GEAutoStock { -} From 561ecc2a0ada9594c5cd89a234296e583e48ef40 Mon Sep 17 00:00:00 2001 From: ceik Date: Wed, 18 Mar 2020 23:15:55 -0500 Subject: [PATCH 3/3] Player now gets sent to the entrance to PP on logout --- Server/src/plugin/activity/pyramidplunder/PlunderZones.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Server/src/plugin/activity/pyramidplunder/PlunderZones.java b/Server/src/plugin/activity/pyramidplunder/PlunderZones.java index bda7a1549..568f97a3c 100644 --- a/Server/src/plugin/activity/pyramidplunder/PlunderZones.java +++ b/Server/src/plugin/activity/pyramidplunder/PlunderZones.java @@ -1,6 +1,9 @@ package plugin.activity.pyramidplunder; import org.crandor.game.node.entity.Entity; import org.crandor.game.node.entity.player.Player; +import org.crandor.game.system.task.LocationLogoutTask; +import org.crandor.game.system.task.LogoutTask; +import org.crandor.game.world.map.Location; import org.crandor.game.world.map.zone.MapZone; import org.crandor.game.world.map.zone.ZoneBorders; import org.crandor.game.world.map.zone.ZoneBuilder; @@ -63,6 +66,7 @@ public class PlunderZones implements Plugin { if(e instanceof Player) { e.asPlayer().getPacketDispatch().sendMessage("Room: " + (roomnum) + " Level required: " + (21 + ((roomnum - 1) * 10))); e.asPlayer().getPlunderObjectManager().resetObjectsFor(e.asPlayer()); + e.asPlayer().addExtension(LogoutTask.class, new LocationLogoutTask(12, Location.create(3288, 2801, 0))); } return true; }