diff --git a/L2J_DataPack_BETA/dist/game/data/html/observation/31031-1.htm b/L2J_DataPack_BETA/dist/game/data/html/observation/31031-1.htm index 290be57f63b07001ec6915939e7262ae67a86250..d65d3774e8e675b0a44caa98456bd1762e075a7e 100644 --- a/L2J_DataPack_BETA/dist/game/data/html/observation/31031-1.htm +++ b/L2J_DataPack_BETA/dist/game/data/html/observation/31031-1.htm @@ -1,4 +1,4 @@ <html><body>&$650;<br><br> -<a action="bypass -h npc_%objectId%_observeSiege 500 -18347 114000 -2360">&$620; - 500 &$469;</a><br1> -<a action="bypass -h npc_%objectId%_observeSiege 500 -18347 113255 -2447">&$621; - 500 &$469;</a> +<a action="bypass -h npc_%objectId%_observeSiege 0">&$620; - 500 &$469;</a><br1> +<a action="bypass -h npc_%objectId%_observeSiege 1">&$621; - 500 &$469;</a> </body></html> \ No newline at end of file diff --git a/L2J_DataPack_BETA/dist/game/data/html/observation/31031-10.htm b/L2J_DataPack_BETA/dist/game/data/html/observation/31031-10.htm index e8b1a82b6a7675c9025d4888520b0081bfafd2c3..0cb9cefdb10f68b2433f50d85d980edc629af879 100644 --- a/L2J_DataPack_BETA/dist/game/data/html/observation/31031-10.htm +++ b/L2J_DataPack_BETA/dist/game/data/html/observation/31031-10.htm @@ -1,5 +1,5 @@ <html><body>&$650;<br><br> -<a action="bypass -h npc_%objectId%_observe 80 148416 46724 -3000">&$634; - 80 &$469;</a><br1> -<a action="bypass -h npc_%objectId%_observe 80 149500 46724 -3000">&$635; - 80 &$469;</a><br1> -<a action="bypass -h npc_%objectId%_observe 80 150511 46724 -3000">&$636; - 80 &$469;</a> +<a action="bypass -h npc_%objectId%_observe 18">&$634; - 80 &$469;</a><br1> +<a action="bypass -h npc_%objectId%_observe 19">&$635; - 80 &$469;</a><br1> +<a action="bypass -h npc_%objectId%_observe 20">&$636; - 80 &$469;</a> </body></html> \ No newline at end of file diff --git a/L2J_DataPack_BETA/dist/game/data/html/observation/31031-2.htm b/L2J_DataPack_BETA/dist/game/data/html/observation/31031-2.htm index 93b72569cc6103e89a96c4a07ae429cd8ba23175..8ad719689825a8cab3c99e75902115be5451479f 100644 --- a/L2J_DataPack_BETA/dist/game/data/html/observation/31031-2.htm +++ b/L2J_DataPack_BETA/dist/game/data/html/observation/31031-2.htm @@ -1,4 +1,4 @@ <html><body>&$650;<br><br> -<a action="bypass -h npc_%objectId%_observeSiege 500 22321 155785 -2604">&$622; - 500 &$469;</a><br1> -<a action="bypass -h npc_%objectId%_observeSiege 500 22321 156492 -2627">&$623; - 500 &$469;</a> +<a action="bypass -h npc_%objectId%_observeSiege 2">&$622; - 500 &$469;</a><br1> +<a action="bypass -h npc_%objectId%_observeSiege 3">&$623; - 500 &$469;</a> </body></html> \ No newline at end of file diff --git a/L2J_DataPack_BETA/dist/game/data/html/observation/31031-3.htm b/L2J_DataPack_BETA/dist/game/data/html/observation/31031-3.htm index 29f55d0e1aed3171550e0a0c95b20ff82c3b5821..7693c297314ec3f93e9837aff36fceecacc988af 100644 --- a/L2J_DataPack_BETA/dist/game/data/html/observation/31031-3.htm +++ b/L2J_DataPack_BETA/dist/game/data/html/observation/31031-3.htm @@ -1,4 +1,4 @@ <html><body>&$650;<br><br> -<a action="bypass -h npc_%objectId%_observeSiege 500 112000 144864 -2445">&$624; - 500 &$469;</a><br1> -<a action="bypass -h npc_%objectId%_observeSiege 500 112657 144864 -2525">&$625; - 500 &$469;</a> +<a action="bypass -h npc_%objectId%_observeSiege 4">&$624; - 500 &$469;</a><br1> +<a action="bypass -h npc_%objectId%_observeSiege 5">&$625; - 500 &$469;</a> </body></html> \ No newline at end of file diff --git a/L2J_DataPack_BETA/dist/game/data/html/observation/31031-4.htm b/L2J_DataPack_BETA/dist/game/data/html/observation/31031-4.htm index bcfd56f2548b11ed000cb480dd780989c03362fd..fce6056d2793009914a6795f8e12b46cc32118ec 100644 --- a/L2J_DataPack_BETA/dist/game/data/html/observation/31031-4.htm +++ b/L2J_DataPack_BETA/dist/game/data/html/observation/31031-4.htm @@ -1,4 +1,4 @@ <html><body>&$650;<br><br> -<a action="bypass -h npc_%objectId%_observeSiege 500 116260 244600 -775">&$626; - 500 &$469;</a><br1> -<a action="bypass -h npc_%objectId%_observeSiege 500 116260 245264 -721">&$627; - 500 &$469;</a> +<a action="bypass -h npc_%objectId%_observeSiege 6">&$626; - 500 &$469;</a><br1> +<a action="bypass -h npc_%objectId%_observeSiege 7">&$627; - 500 &$469;</a> </body></html> \ No newline at end of file diff --git a/L2J_DataPack_BETA/dist/game/data/html/observation/31031-5.htm b/L2J_DataPack_BETA/dist/game/data/html/observation/31031-5.htm index 56f623fbbf1e851343196374eea6b61e2f630a75..428446f40ecb48de2065a8dcebec812f01cfd128 100644 --- a/L2J_DataPack_BETA/dist/game/data/html/observation/31031-5.htm +++ b/L2J_DataPack_BETA/dist/game/data/html/observation/31031-5.htm @@ -1,4 +1,4 @@ <html><body>&$650;<br><br> -<a action="bypass -h npc_%objectId%_observeSiege 500 78100 36950 -2242">&$628; - 500 &$469;</a><br1> -<a action="bypass -h npc_%objectId%_observeSiege 500 78744 36950 -2244">&$629; - 500 &$469;</a> +<a action="bypass -h npc_%objectId%_observeSiege 8">&$628; - 500 &$469;</a><br1> +<a action="bypass -h npc_%objectId%_observeSiege 9">&$629; - 500 &$469;</a> </body></html> \ No newline at end of file diff --git a/L2J_DataPack_BETA/dist/game/data/html/observation/31031-6.htm b/L2J_DataPack_BETA/dist/game/data/html/observation/31031-6.htm index 548ca215c3d58fe50a88fd20b7ca3290afdc6ad8..af609fbc8660cf736b9f044fccf242949ce33ab0 100644 --- a/L2J_DataPack_BETA/dist/game/data/html/observation/31031-6.htm +++ b/L2J_DataPack_BETA/dist/game/data/html/observation/31031-6.htm @@ -1,4 +1,4 @@ <html><body>&$650;<br><br> -<a action="bypass -h npc_%objectId%_observeSiege 500 147457 9601 -233">&$630; - 500 &$469;</a><br1> -<a action="bypass -h npc_%objectId%_observeSiege 500 147457 8720 -252">&$631; - 500 &$469;</a> +<a action="bypass -h npc_%objectId%_observeSiege 10">&$630; - 500 &$469;</a><br1> +<a action="bypass -h npc_%objectId%_observeSiege 11">&$631; - 500 &$469;</a> </body></html> \ No newline at end of file diff --git a/L2J_DataPack_BETA/dist/game/data/html/observation/31031-7.htm b/L2J_DataPack_BETA/dist/game/data/html/observation/31031-7.htm index 5cafc274a013b5f7b95d5e7ada152e8714798082..dff9606f7f1b6b72fb921c6d6eac68b273f25f59 100644 --- a/L2J_DataPack_BETA/dist/game/data/html/observation/31031-7.htm +++ b/L2J_DataPack_BETA/dist/game/data/html/observation/31031-7.htm @@ -1,4 +1,4 @@ <html><body>&$650;<br><br> -<a action="bypass -h npc_%objectId%_observeSiege 500 147542 -43543 -1328">&$1244; - 500 &$469;</a><br1> -<a action="bypass -h npc_%objectId%_observeSiege 500 147465 -45259 -1328">&$1245; - 500 &$469;</a> +<a action="bypass -h npc_%objectId%_observeSiege 12">&$1244; - 500 &$469;</a><br1> +<a action="bypass -h npc_%objectId%_observeSiege 13">&$1245; - 500 &$469;</a> </body></html> \ No newline at end of file diff --git a/L2J_DataPack_BETA/dist/game/data/html/observation/31031-8.htm b/L2J_DataPack_BETA/dist/game/data/html/observation/31031-8.htm index 11c8faaa57f65a564b27736918909f9c03767ed4..573bbc6f0cd1e42d3e405ff32d6ce132dfdfd803 100644 --- a/L2J_DataPack_BETA/dist/game/data/html/observation/31031-8.htm +++ b/L2J_DataPack_BETA/dist/game/data/html/observation/31031-8.htm @@ -1,4 +1,4 @@ <html><body>&$650;<br><br> -<a action="bypass -h npc_%objectId%_observeSiege 500 20598 -49113 -300">&$1421; - 500 &$469;</a><br1> -<a action="bypass -h npc_%objectId%_observeSiege 500 18702 -49150 -600">&$1422; - 500 &$469;</a> +<a action="bypass -h npc_%objectId%_observeSiege 14">&$1421; - 500 &$469;</a><br1> +<a action="bypass -h npc_%objectId%_observeSiege 15">&$1422; - 500 &$469;</a> </body></html> \ No newline at end of file diff --git a/L2J_DataPack_BETA/dist/game/data/html/observation/31031-9.htm b/L2J_DataPack_BETA/dist/game/data/html/observation/31031-9.htm index a7b0ea7f86a03041c523def88d0af701bea4b364..7215d5ed50862fe371ee268e1833391186aef39b 100644 --- a/L2J_DataPack_BETA/dist/game/data/html/observation/31031-9.htm +++ b/L2J_DataPack_BETA/dist/game/data/html/observation/31031-9.htm @@ -1,4 +1,4 @@ <html><body>&$650;<br><br> -<a action="bypass -h npc_%objectId%_observeSiege 500 77541 -147447 353">&$1424; - 500 &$469;</a><br1> -<a action="bypass -h npc_%objectId%_observeSiege 500 77541 -149245 353">&$1425; - 500 &$469;</a> +<a action="bypass -h npc_%objectId%_observeSiege 16">&$1424; - 500 &$469;</a><br1> +<a action="bypass -h npc_%objectId%_observeSiege 17">&$1425; - 500 &$469;</a> </body></html> \ No newline at end of file diff --git a/L2J_DataPack_BETA/dist/game/data/html/observation/31031-Oracle-1.htm b/L2J_DataPack_BETA/dist/game/data/html/observation/31031-Oracle-1.htm index bdaf978e34a43f2aa2f1c950fad0cdc398a73b22..adc78f2836122afdc9ecca3445d6fef2bdc237c7 100644 --- a/L2J_DataPack_BETA/dist/game/data/html/observation/31031-Oracle-1.htm +++ b/L2J_DataPack_BETA/dist/game/data/html/observation/31031-Oracle-1.htm @@ -1,7 +1,7 @@ <html><body>&$650;<br><br> -<a action="bypass -h npc_%objectId%_observeOracle 500 -80210 87400 -4800">Level 31 and Below - 500 Adena</a><br1> -<a action="bypass -h npc_%objectId%_observeOracle 500 -77200 88500 -4800">Level 42 and Below - 500 Adena</a><br1> -<a action="bypass -h npc_%objectId%_observeOracle 500 -75320 87135 -4800">Level 53 and Below - 500 Adena</a><br1> -<a action="bypass -h npc_%objectId%_observeOracle 500 -76840 85770 -4800">Level 64 and Below - 500 Adena</a><br1> -<a action="bypass -h npc_%objectId%_observeOracle 500 -79950 85165 -4800">No Level Limit - 500 Adena</a> +<a action="bypass -h npc_%objectId%_observeOracle 21">Level 31 and Below - 500 Adena</a><br1> +<a action="bypass -h npc_%objectId%_observeOracle 22">Level 42 and Below - 500 Adena</a><br1> +<a action="bypass -h npc_%objectId%_observeOracle 23">Level 53 and Below - 500 Adena</a><br1> +<a action="bypass -h npc_%objectId%_observeOracle 24">Level 64 and Below - 500 Adena</a><br1> +<a action="bypass -h npc_%objectId%_observeOracle 25">No Level Limit - 500 Adena</a> </body></html> \ No newline at end of file diff --git a/L2J_DataPack_BETA/dist/game/data/html/observation/31031-Oracle-2.htm b/L2J_DataPack_BETA/dist/game/data/html/observation/31031-Oracle-2.htm index 05b257ef2e4e7e6e8ea49eac9580e969dcdc1fe0..9d74df88c189eabca1178f9347d36e93c7b6561d 100644 --- a/L2J_DataPack_BETA/dist/game/data/html/observation/31031-Oracle-2.htm +++ b/L2J_DataPack_BETA/dist/game/data/html/observation/31031-Oracle-2.htm @@ -1,7 +1,7 @@ <html><body>&$650;<br><br> -<a action="bypass -h npc_%objectId%_observeOracle 500 -79185 112725 -4300">Level 31 and Below - 500 Adena</a><br1> -<a action="bypass -h npc_%objectId%_observeOracle 500 -76175 113330 -4300">Level 42 and Below - 500 Adena</a><br1> -<a action="bypass -h npc_%objectId%_observeOracle 500 -74305 111965 -4300">Level 53 and Below - 500 Adena</a><br1> -<a action="bypass -h npc_%objectId%_observeOracle 500 -75915 110600 -4300">Level 64 and Below - 500 Adena</a><br1> -<a action="bypass -h npc_%objectId%_observeOracle 500 -78930 110005 -4300">No Level Limit - 500 Adena</a> +<a action="bypass -h npc_%objectId%_observeOracle 26">Level 31 and Below - 500 Adena</a><br1> +<a action="bypass -h npc_%objectId%_observeOracle 27">Level 42 and Below - 500 Adena</a><br1> +<a action="bypass -h npc_%objectId%_observeOracle 28">Level 53 and Below - 500 Adena</a><br1> +<a action="bypass -h npc_%objectId%_observeOracle 29">Level 64 and Below - 500 Adena</a><br1> +<a action="bypass -h npc_%objectId%_observeOracle 30">No Level Limit - 500 Adena</a> </body></html> \ No newline at end of file diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/handlers/bypasshandlers/Observation.java b/L2J_DataPack_BETA/dist/game/data/scripts/handlers/bypasshandlers/Observation.java index 345aa0c3004166a9ec4cee1f6100ee7e244c1c52..61c48dcdc9bf4600fd82ff9015fd67b30f426157 100644 --- a/L2J_DataPack_BETA/dist/game/data/scripts/handlers/bypasshandlers/Observation.java +++ b/L2J_DataPack_BETA/dist/game/data/scripts/handlers/bypasshandlers/Observation.java @@ -18,7 +18,6 @@ */ package handlers.bypasshandlers; -import java.util.StringTokenizer; import java.util.logging.Level; import com.l2jserver.gameserver.handler.IBypassHandler; @@ -26,6 +25,7 @@ import com.l2jserver.gameserver.instancemanager.SiegeManager; import com.l2jserver.gameserver.model.Location; import com.l2jserver.gameserver.model.actor.L2Character; import com.l2jserver.gameserver.model.actor.L2Npc; +import com.l2jserver.gameserver.model.actor.instance.L2ObservationInstance; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; import com.l2jserver.gameserver.network.SystemMessageId; import com.l2jserver.gameserver.network.serverpackets.ActionFailed; @@ -40,25 +40,102 @@ public class Observation implements IBypassHandler "observe" }; + private static final int[][] LOCATIONS = new int[][] + { + //@formatter:off + // Gludio + {-18347, 114000, -2360, 500}, + {-18347, 113255, -2447, 500}, + // Dion + {22321, 155785, -2604, 500}, + {22321, 156492, -2627, 500}, + // Giran + {112000, 144864, -2445, 500}, + {112657, 144864, -2525, 500}, + // Innadril + {116260, 244600, -775, 500}, + {116260, 245264, -721, 500}, + // Oren + {78100, 36950, -2242, 500}, + {78744, 36950, -2244, 500}, + // Aden + {147457, 9601, -233, 500}, + {147457, 8720, -252, 500}, + // Goddard + {147542, -43543, -1328, 500}, + {147465, -45259, -1328, 500}, + // Rune + {20598, -49113, -300, 500}, + {18702, -49150, -600, 500}, + // Schuttgart + {77541, -147447, 353, 500}, + {77541, -149245, 353, 500}, + // Coliseum + {148416, 46724, -3000, 80}, + {149500, 46724, -3000, 80}, + {150511, 46724, -3000, 80}, + // Dusk + {-77200, 88500, -4800, 500}, + {-75320, 87135, -4800, 500}, + {-76840, 85770, -4800, 500}, + {-76840, 85770, -4800, 500}, + {-79950, 85165, -4800, 500}, + // Dawn + {-79185, 112725, -4300, 500}, + {-76175, 113330, -4300, 500}, + {-74305, 111965, -4300, 500}, + {-75915, 110600, -4300, 500}, + {-78930, 110005, -4300, 500} + //@formatter:on + }; + @Override public boolean useBypass(String command, L2PcInstance activeChar, L2Character target) { - if (!target.isNpc()) + if (!(target instanceof L2ObservationInstance)) { return false; } + if (activeChar.hasSummon()) + { + activeChar.sendPacket(SystemMessageId.NO_OBSERVE_WITH_PET); + return false; + } + if (activeChar.isOnEvent()) + { + activeChar.sendMessage("Cannot use while current Event"); + return false; + } + + String _command = command.split(" ")[0].toLowerCase(); + final int param; try { - if (command.toLowerCase().startsWith(COMMANDS[0])) // siege + param = Integer.parseInt(command.split(" ")[1]); + } + catch (NumberFormatException nfe) + { + _log.log(Level.WARNING, "Exception in " + getClass().getSimpleName(), nfe); + return false; + } + + if ((param < 0) || (param > (LOCATIONS.length - 1))) + { + return false; + } + final int[] locCost = LOCATIONS[param]; + + Location loc = new Location(locCost[0], locCost[1], locCost[2]); + final long cost = locCost[3]; + + switch (_command) + { + case "observesiege": { - String val = command.substring(13); - StringTokenizer st = new StringTokenizer(val); - st.nextToken(); // Bypass cost - - if (SiegeManager.getInstance().getSiege(Integer.parseInt(st.nextToken()), Integer.parseInt(st.nextToken()), Integer.parseInt(st.nextToken())) != null) + if (SiegeManager.getInstance().getSiege(loc) != null) { - doObserve(activeChar, (L2Npc) target, val); + doObserve(activeChar, (L2Npc) target, loc, cost); } else { @@ -66,41 +143,26 @@ public class Observation implements IBypassHandler } return true; } - else if (command.toLowerCase().startsWith(COMMANDS[1])) // oracle + case "observeoracle": // Oracle Dusk/Dawn { - String val = command.substring(13); - StringTokenizer st = new StringTokenizer(val); - st.nextToken(); // Bypass cost - doObserve(activeChar, (L2Npc) target, val); + doObserve(activeChar, (L2Npc) target, loc, cost); return true; } - else if (command.toLowerCase().startsWith(COMMANDS[2])) // observe + case "observe": // Observe { - doObserve(activeChar, (L2Npc) target, command.substring(8)); + doObserve(activeChar, (L2Npc) target, loc, cost); return true; } - - return false; - } - catch (Exception e) - { - _log.log(Level.WARNING, "Exception in " + getClass().getSimpleName(), e); } return false; } - private static final void doObserve(L2PcInstance player, L2Npc npc, String val) + private static final void doObserve(final L2PcInstance player, final L2Npc npc, final Location pos, final long cost) { - StringTokenizer st = new StringTokenizer(val); - long cost = Long.parseLong(st.nextToken()); - int x = Integer.parseInt(st.nextToken()); - int y = Integer.parseInt(st.nextToken()); - int z = Integer.parseInt(st.nextToken()); - if (player.reduceAdena("Broadcast", cost, npc, true)) { // enter mode - player.enterObserverMode(new Location(x, y, z)); + player.enterObserverMode(pos); player.sendPacket(new ItemList(player, false)); } player.sendPacket(ActionFailed.STATIC_PACKET);