From a35d707c78062c31eb8c558cc98d073a07c22099 Mon Sep 17 00:00:00 2001 From: Ziggeh Date: Sun, 6 Jul 2014 01:30:18 +0200 Subject: [PATCH 1/5] Added a service for opening browser windows --- src/main/NGECore.java | 4 ++ src/protocol/swg/LaunchBrowserMessage.java | 59 +++++++++++++++++++++ src/resources/common/Opcodes.java | 1 + src/services/BrowserService.java | 60 ++++++++++++++++++++++ 4 files changed, 124 insertions(+) create mode 100644 src/protocol/swg/LaunchBrowserMessage.java create mode 100644 src/services/BrowserService.java diff --git a/src/main/NGECore.java b/src/main/NGECore.java index 145ef6e7..799e84bd 100644 --- a/src/main/NGECore.java +++ b/src/main/NGECore.java @@ -65,6 +65,7 @@ import services.DevService; import services.EntertainmentService; import services.GroupService; import services.housing.HousingService; +import services.BrowserService; import services.InstanceService; import services.LoginService; import services.LootService; @@ -204,6 +205,7 @@ public class NGECore { public PlayerCityService playerCityService; public ReverseEngineeringService reverseEngineeringService; public PetService petService; + public BrowserService browserService; // Login Server public NetworkDispatch loginDispatch; @@ -531,6 +533,8 @@ public class NGECore { playerCityService.loadCities(); retroService.run(); + browserService = new BrowserService(this); + didServerCrash = false; System.out.println("Started Server."); cleanupCreatureODB(); diff --git a/src/protocol/swg/LaunchBrowserMessage.java b/src/protocol/swg/LaunchBrowserMessage.java new file mode 100644 index 00000000..7c3efb62 --- /dev/null +++ b/src/protocol/swg/LaunchBrowserMessage.java @@ -0,0 +1,59 @@ +/******************************************************************************* + * Copyright (c) 2013 + * + * This File is part of NGECore2. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine. + * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination. + ******************************************************************************/ +package protocol.swg; + +import java.nio.ByteOrder; +import java.util.Vector; + +import org.apache.mina.core.buffer.IoBuffer; + +import resources.common.Opcodes; +import services.sui.SUIWindowComponent; + +public class LaunchBrowserMessage extends SWGMessage{ + private String URL; + + public LaunchBrowserMessage(String URL) { + this.URL = URL; + } + + public void deserialize(IoBuffer data) { + + } + + public IoBuffer serialize() { + + IoBuffer result = IoBuffer.allocate(100).order(ByteOrder.LITTLE_ENDIAN); + result.setAutoExpand(true); + + result.putShort((short) 2); + result.putInt(Opcodes.LaunchBrowserMessage); + + result.put(getAsciiString(URL)); + + int size = result.position(); + result = IoBuffer.allocate(size).put(result.array(), 0, size); + + return result.flip(); + } + +} diff --git a/src/resources/common/Opcodes.java b/src/resources/common/Opcodes.java index c7bced7c..baf83745 100644 --- a/src/resources/common/Opcodes.java +++ b/src/resources/common/Opcodes.java @@ -90,5 +90,6 @@ public class Opcodes { public static final int CancelLiveAuctionMessage = CRC.StringtoCRC("CancelLiveAuctionMessage"); public static final int BidAuctionMessage = CRC.StringtoCRC("BidAuctionMessage"); public static final int RetrieveAuctionItemMessage = CRC.StringtoCRC("RetrieveAuctionItemMessage"); + public static final int LaunchBrowserMessage = CRC.StringtoCRC("LaunchBrowserMessage"); } diff --git a/src/services/BrowserService.java b/src/services/BrowserService.java new file mode 100644 index 00000000..bb0b156a --- /dev/null +++ b/src/services/BrowserService.java @@ -0,0 +1,60 @@ +/******************************************************************************* + * Copyright (c) 2013 + * + * This File is part of NGECore2. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine. + * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination. + ******************************************************************************/ +package services; + +import java.util.Map; + +import protocol.swg.LaunchBrowserMessage; +import resources.objects.creature.CreatureObject; +import main.NGECore; +import engine.resources.service.INetworkDispatch; +import engine.resources.service.INetworkRemoteEvent; + +public class BrowserService implements INetworkDispatch { + + private NGECore core; + + public BrowserService(NGECore core) { + this.core = core; + } + + public void sendBrowserWindow(CreatureObject creature, String URL) { + URL = URL.toLowerCase(); + + if( URL.contains("http://")) + URL.replace("http://", ""); + + LaunchBrowserMessage launchBrowserMessage = new LaunchBrowserMessage(URL); + creature.getClient().getSession().write(launchBrowserMessage.serialize()); + } + + @Override + public void insertOpcodes(Map arg0, Map arg1) { + + } + + @Override + public void shutdown() { + + } + +} From 9e9afd6c0bb6b23c91e9e4a1e903c970d620f9d4 Mon Sep 17 00:00:00 2001 From: Ziggeh Date: Sun, 6 Jul 2014 05:29:13 +0200 Subject: [PATCH 2/5] Added a description to the browser service --- src/services/BrowserService.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/services/BrowserService.java b/src/services/BrowserService.java index bb0b156a..45715167 100644 --- a/src/services/BrowserService.java +++ b/src/services/BrowserService.java @@ -36,7 +36,10 @@ public class BrowserService implements INetworkDispatch { public BrowserService(NGECore core) { this.core = core; } - + /* + * This method will minimise the game and open the default desktop browser of the CreatureObject with the given URL. + * This is not to be confused with the SWG in-game browser. + */ public void sendBrowserWindow(CreatureObject creature, String URL) { URL = URL.toLowerCase(); From 9ff88b59346ed950354991a9e6a3c5e46037257e Mon Sep 17 00:00:00 2001 From: Ziggeh Date: Sun, 6 Jul 2014 06:02:35 +0200 Subject: [PATCH 3/5] Changed the location of some packet opcodes --- src/protocol/swg/AttributeListMessage.java | 3 ++- src/protocol/swg/CmdStartScene.java | 4 +++- src/protocol/swg/CommPlayerMessage.java | 3 ++- src/protocol/swg/CreateCharacterSuccess.java | 4 +++- src/protocol/swg/ErrorMessage.java | 4 +++- src/protocol/swg/GuildResponseMessage.java | 4 ++-- src/protocol/swg/LaunchBrowserMessage.java | 4 ---- src/protocol/swg/LoginServerId.java | 4 +++- src/protocol/swg/LogoutMessage.java | 4 +++- src/protocol/swg/ObjControllerMessage.java | 4 +++- src/protocol/swg/PlayerMoneyResponse.java | 4 +++- src/resources/common/Opcodes.java | 9 +++++++++ src/services/BrowserService.java | 1 - 13 files changed, 36 insertions(+), 16 deletions(-) diff --git a/src/protocol/swg/AttributeListMessage.java b/src/protocol/swg/AttributeListMessage.java index 55721a52..85713582 100644 --- a/src/protocol/swg/AttributeListMessage.java +++ b/src/protocol/swg/AttributeListMessage.java @@ -26,6 +26,7 @@ import java.nio.ByteOrder; import org.apache.mina.core.buffer.IoBuffer; import org.apache.mina.core.buffer.SimpleBufferAllocator; +import resources.common.Opcodes; import engine.resources.objects.SWGObject; public class AttributeListMessage extends SWGMessage { @@ -50,7 +51,7 @@ public class AttributeListMessage extends SWGMessage { result.setAutoExpand(true); result.putShort((short) 5); - result.putInt(0xF3F12F2A); + result.putInt(Opcodes.AttributeListMessage); result.putLong(target.getObjectID()); result.putShort((short) 0); diff --git a/src/protocol/swg/CmdStartScene.java b/src/protocol/swg/CmdStartScene.java index 52d1eb36..918b0f4f 100644 --- a/src/protocol/swg/CmdStartScene.java +++ b/src/protocol/swg/CmdStartScene.java @@ -25,6 +25,8 @@ import java.nio.ByteOrder; import org.apache.mina.core.buffer.IoBuffer; +import resources.common.Opcodes; + public class CmdStartScene extends SWGMessage { private byte ignoreLayoutFiles; @@ -60,7 +62,7 @@ public class CmdStartScene extends SWGMessage { IoBuffer result = IoBuffer.allocate(47 + terrainFile.length() + sharedRaceTemplate.length()).order(ByteOrder.LITTLE_ENDIAN); result.putShort((short)9); - result.putInt(0x3AE6DFAE); + result.putInt(Opcodes.CmdStartScene); result.put((byte)ignoreLayoutFiles); result.putLong(characterId); result.put(getAsciiString(terrainFile)); diff --git a/src/protocol/swg/CommPlayerMessage.java b/src/protocol/swg/CommPlayerMessage.java index 9acde60c..3d0675f1 100644 --- a/src/protocol/swg/CommPlayerMessage.java +++ b/src/protocol/swg/CommPlayerMessage.java @@ -26,6 +26,7 @@ import java.nio.ByteOrder; import org.apache.mina.core.buffer.IoBuffer; import engine.resources.common.CRC; +import resources.common.Opcodes; import resources.common.OutOfBand; public class CommPlayerMessage extends SWGMessage { @@ -51,7 +52,7 @@ public class CommPlayerMessage extends SWGMessage { buffer.setAutoExpand(true); buffer.putShort((short) 2); - buffer.putInt(0x594AD258); + buffer.putInt(Opcodes.CommPlayerMessage); buffer.put((byte) 0); // aurebesh borders on comm, space version? Can cause crashes buffer.putLong(objectId); buffer.put(outOfBand.serialize().array()); diff --git a/src/protocol/swg/CreateCharacterSuccess.java b/src/protocol/swg/CreateCharacterSuccess.java index 36490295..61be583f 100644 --- a/src/protocol/swg/CreateCharacterSuccess.java +++ b/src/protocol/swg/CreateCharacterSuccess.java @@ -25,6 +25,8 @@ import java.nio.ByteOrder; import org.apache.mina.core.buffer.IoBuffer; +import resources.common.Opcodes; + public class CreateCharacterSuccess extends SWGMessage { @@ -45,7 +47,7 @@ public class CreateCharacterSuccess extends SWGMessage { IoBuffer result = IoBuffer.allocate(14).order(ByteOrder.LITTLE_ENDIAN); result.putShort((short) 2); - result.putInt(0x1DB575CC); + result.putInt(Opcodes.CreateCharacterSuccess); result.putLong(charId); result.flip(); return result; diff --git a/src/protocol/swg/ErrorMessage.java b/src/protocol/swg/ErrorMessage.java index 652e1b6f..507561b9 100644 --- a/src/protocol/swg/ErrorMessage.java +++ b/src/protocol/swg/ErrorMessage.java @@ -23,6 +23,8 @@ package protocol.swg; import org.apache.mina.core.buffer.IoBuffer; +import resources.common.Opcodes; + public class ErrorMessage extends SWGMessage { @@ -42,7 +44,7 @@ public class ErrorMessage extends SWGMessage { IoBuffer result = IoBuffer.allocate(11 + errorType.length() + errorMessage.length()); result.putShort((short)3); - result.putInt(0xB5ABF91A); + result.putInt(Opcodes.ErrorMessage); result.put(getAsciiString(errorType)); result.put(getAsciiString(errorMessage)); result.put((byte)0); diff --git a/src/protocol/swg/GuildResponseMessage.java b/src/protocol/swg/GuildResponseMessage.java index f98e6713..7b718121 100644 --- a/src/protocol/swg/GuildResponseMessage.java +++ b/src/protocol/swg/GuildResponseMessage.java @@ -22,8 +22,8 @@ package protocol.swg; import java.nio.ByteOrder; - import org.apache.mina.core.buffer.IoBuffer; +import resources.common.Opcodes; public class GuildResponseMessage extends SWGMessage { @@ -46,7 +46,7 @@ public class GuildResponseMessage extends SWGMessage { IoBuffer buffer = IoBuffer.allocate(18 + guildName.length()).order(ByteOrder.LITTLE_ENDIAN); buffer.putShort((short) 4); - buffer.putInt(0x32263F20); + buffer.putInt(Opcodes.GuildResponseMessage); buffer.putLong(player); buffer.put(getAsciiString(guildName)); diff --git a/src/protocol/swg/LaunchBrowserMessage.java b/src/protocol/swg/LaunchBrowserMessage.java index 7c3efb62..67266674 100644 --- a/src/protocol/swg/LaunchBrowserMessage.java +++ b/src/protocol/swg/LaunchBrowserMessage.java @@ -22,12 +22,8 @@ package protocol.swg; import java.nio.ByteOrder; -import java.util.Vector; - import org.apache.mina.core.buffer.IoBuffer; - import resources.common.Opcodes; -import services.sui.SUIWindowComponent; public class LaunchBrowserMessage extends SWGMessage{ private String URL; diff --git a/src/protocol/swg/LoginServerId.java b/src/protocol/swg/LoginServerId.java index ca01ae90..3203ba37 100644 --- a/src/protocol/swg/LoginServerId.java +++ b/src/protocol/swg/LoginServerId.java @@ -25,6 +25,8 @@ import java.nio.ByteOrder; import org.apache.mina.core.buffer.IoBuffer; +import resources.common.Opcodes; + public class LoginServerId extends SWGMessage { @@ -42,7 +44,7 @@ public class LoginServerId extends SWGMessage { IoBuffer buffer = IoBuffer.allocate(10).order(ByteOrder.LITTLE_ENDIAN); buffer.putShort((short)2); - buffer.putInt(0x58C07F21); + buffer.putInt(Opcodes.LoginServerId); buffer.putInt(loginServerID); buffer.flip(); diff --git a/src/protocol/swg/LogoutMessage.java b/src/protocol/swg/LogoutMessage.java index 3f835aa6..23803097 100644 --- a/src/protocol/swg/LogoutMessage.java +++ b/src/protocol/swg/LogoutMessage.java @@ -25,6 +25,8 @@ import java.nio.ByteOrder; import org.apache.mina.core.buffer.IoBuffer; +import resources.common.Opcodes; + public class LogoutMessage extends SWGMessage{ @@ -36,7 +38,7 @@ public class LogoutMessage extends SWGMessage{ IoBuffer result = IoBuffer.allocate(6).order(ByteOrder.LITTLE_ENDIAN); result.putShort((short) 2); - result.putInt(0x42FD19DD); + result.putInt(Opcodes.LogoutMessage); return result; } diff --git a/src/protocol/swg/ObjControllerMessage.java b/src/protocol/swg/ObjControllerMessage.java index cb1ff04b..ff025def 100644 --- a/src/protocol/swg/ObjControllerMessage.java +++ b/src/protocol/swg/ObjControllerMessage.java @@ -27,11 +27,13 @@ import org.apache.mina.core.buffer.IoBuffer; + import protocol.swg.objectControllerObjects.CommandEnqueue; import protocol.swg.objectControllerObjects.DataTransform; import protocol.swg.objectControllerObjects.DataTransformWithParent; import protocol.swg.objectControllerObjects.ObjControllerObject; import protocol.swg.objectControllerObjects.UnknownObjController; +import resources.common.Opcodes; public class ObjControllerMessage extends SWGMessage { @@ -97,7 +99,7 @@ public class ObjControllerMessage extends SWGMessage { IoBuffer buffer = IoBuffer.allocate(10).order(ByteOrder.LITTLE_ENDIAN); buffer.setAutoExpand(true); buffer.putShort((short)5); - buffer.putInt(0x80CE5E46); + buffer.putInt(Opcodes.ObjControllerMessage); buffer.putInt(update); buffer.put(objControllerObject.serialize()); //System.out.println("OBJMSG: " + StringUtilities.bytesToHex(buffer.flip().array())); diff --git a/src/protocol/swg/PlayerMoneyResponse.java b/src/protocol/swg/PlayerMoneyResponse.java index 0438dd02..be302d9f 100644 --- a/src/protocol/swg/PlayerMoneyResponse.java +++ b/src/protocol/swg/PlayerMoneyResponse.java @@ -25,6 +25,8 @@ import java.nio.ByteOrder; import org.apache.mina.core.buffer.IoBuffer; +import resources.common.Opcodes; + public class PlayerMoneyResponse extends SWGMessage { int cash; @@ -45,7 +47,7 @@ public class PlayerMoneyResponse extends SWGMessage { IoBuffer buffer = IoBuffer.allocate(14).order(ByteOrder.LITTLE_ENDIAN); buffer.putShort((short) 3); - buffer.putInt(0x367E737E); + buffer.putInt(Opcodes.PlayerMoneyResponse); buffer.putInt(bank); buffer.putInt(cash); diff --git a/src/resources/common/Opcodes.java b/src/resources/common/Opcodes.java index baf83745..245aa8a6 100644 --- a/src/resources/common/Opcodes.java +++ b/src/resources/common/Opcodes.java @@ -41,12 +41,14 @@ public class Opcodes { public static final int CommoditiesResourceTypeListRequest = 0xCB1AE82D; public static final int NewbieTutorialResponse = 0xCA88FBAD; public static final int CmdSceneReady = 0x43FD1C22; + public static final int CommPlayerMessage = 0x594AD258; public static final int ConnectPlayerMessage = 0x2E365218; public static final int ClientCreateCharacter = 0xB97F3074; public static final int ClientIdMsg = 0xD5899226; public static final int ClientRandomNameRequest = 0xD6D1B6D1; public static final int ClientVerifyAndLockNameRequest = 0x9eb04b9f; public static final int DeleteCharacterMessage = 0xE87AD031; + public static final int ErrorMessage = 0xB5ABF91A; public static final int GetMapLocationsMessage = 0x1A7AB839; public static final int IsVendorOwnerMessage = CRC.StringtoCRC("IsVendorOwnerMessage"); public static final int LagRequest = 0x31805EE0; @@ -91,5 +93,12 @@ public class Opcodes { public static final int BidAuctionMessage = CRC.StringtoCRC("BidAuctionMessage"); public static final int RetrieveAuctionItemMessage = CRC.StringtoCRC("RetrieveAuctionItemMessage"); public static final int LaunchBrowserMessage = CRC.StringtoCRC("LaunchBrowserMessage"); + public static final int LoginServerId = 0x58C07F21; + public static final int LogoutMessage = 0x42FD19DD; + public static final int AttributeListMessage = 0xF3F12F2A; + public static final int GuildResponseMessage = 0x32263F20; + public static final int CreateCharacterSuccess = 0x1DB575CC; + public static final int PlayerMoneyResponse = 0x367E737E; + public static final int CmdStartScene = 0x3AE6DFAE; } diff --git a/src/services/BrowserService.java b/src/services/BrowserService.java index 45715167..1d649bde 100644 --- a/src/services/BrowserService.java +++ b/src/services/BrowserService.java @@ -22,7 +22,6 @@ package services; import java.util.Map; - import protocol.swg.LaunchBrowserMessage; import resources.objects.creature.CreatureObject; import main.NGECore; From d56d5d147e5b715d5c8471da5b2e787ca6828ea4 Mon Sep 17 00:00:00 2001 From: tacef Date: Sun, 6 Jul 2014 07:52:54 +0200 Subject: [PATCH 4/5] Fixed Some Level Issues with NPC's Min and Maxlevel not required if setLevel() is used --- scripts/mobiles/tatooine/city_sewer_swamprat.py | 2 -- scripts/mobiles/tatooine/cupa.py | 2 -- scripts/mobiles/tatooine/death_kreetle.py | 2 -- scripts/mobiles/tatooine/desert_eopie.py | 2 -- scripts/mobiles/tatooine/desert_kreetle.py | 2 -- scripts/mobiles/tatooine/desert_razorback.py | 2 -- scripts/mobiles/tatooine/desert_squill.py | 2 -- scripts/mobiles/tatooine/dewback.py | 2 -- scripts/mobiles/tatooine/dimu_bantha.py | 2 -- scripts/mobiles/tatooine/dune_bantha.py | 2 -- scripts/mobiles/tatooine/dune_beetle.py | 2 -- scripts/mobiles/tatooine/dwarf_bantha.py | 2 -- scripts/mobiles/tatooine/error_prone_battle_droids.py | 2 -- scripts/mobiles/tatooine/lesser_dewback.py | 2 -- scripts/mobiles/tatooine/malignant_squill.py | 2 -- scripts/mobiles/tatooine/parry_stormtrooper_dewback.py | 2 -- scripts/mobiles/tatooine/razorclaw.py | 2 -- scripts/mobiles/tatooine/sickly_womprat.py | 1 - scripts/mobiles/tatooine/trandoshan_slaver.py | 2 -- scripts/mobiles/tatooine/tusken_raider_warrior.py | 2 -- scripts/mobiles/tatooine/valarian_shuttle_guard.py | 2 -- 21 files changed, 41 deletions(-) diff --git a/scripts/mobiles/tatooine/city_sewer_swamprat.py b/scripts/mobiles/tatooine/city_sewer_swamprat.py index 0a9d5d2c..ead488c8 100644 --- a/scripts/mobiles/tatooine/city_sewer_swamprat.py +++ b/scripts/mobiles/tatooine/city_sewer_swamprat.py @@ -12,8 +12,6 @@ def addTemplate(core): mobileTemplate.setCreatureName('city_sewer_swamprat') mobileTemplate.setLevel(3) - mobileTemplate.setMinLevel(3) - mobileTemplate.setMaxLevel(5) mobileTemplate.setDifficulty(Difficulty.NORMAL) mobileTemplate.setMinSpawnDistance(4) diff --git a/scripts/mobiles/tatooine/cupa.py b/scripts/mobiles/tatooine/cupa.py index eedcea77..ea30bd64 100644 --- a/scripts/mobiles/tatooine/cupa.py +++ b/scripts/mobiles/tatooine/cupa.py @@ -12,8 +12,6 @@ def addTemplate(core): mobileTemplate.setCreatureName('cu_pa') mobileTemplate.setLevel(10) - mobileTemplate.setMinLevel(10) - mobileTemplate.setMaxLevel(11) mobileTemplate.setDifficulty(Difficulty.NORMAL) mobileTemplate.setMinSpawnDistance(4) diff --git a/scripts/mobiles/tatooine/death_kreetle.py b/scripts/mobiles/tatooine/death_kreetle.py index 1448c725..96d31cfb 100644 --- a/scripts/mobiles/tatooine/death_kreetle.py +++ b/scripts/mobiles/tatooine/death_kreetle.py @@ -12,8 +12,6 @@ def addTemplate(core): mobileTemplate.setCreatureName('kreetle_death') mobileTemplate.setLevel(7) - mobileTemplate.setMinLevel(7) - mobileTemplate.setMaxLevel(8) mobileTemplate.setDifficulty(Difficulty.NORMAL) mobileTemplate.setMinSpawnDistance(4) diff --git a/scripts/mobiles/tatooine/desert_eopie.py b/scripts/mobiles/tatooine/desert_eopie.py index 311c3d5c..bb6603ef 100644 --- a/scripts/mobiles/tatooine/desert_eopie.py +++ b/scripts/mobiles/tatooine/desert_eopie.py @@ -12,8 +12,6 @@ def addTemplate(core): mobileTemplate.setCreatureName('desert_eopie') mobileTemplate.setLevel(16) - mobileTemplate.setMinLevel(16) - mobileTemplate.setMaxLevel(17) mobileTemplate.setDifficulty(Difficulty.NORMAL) mobileTemplate.setMinSpawnDistance(4) diff --git a/scripts/mobiles/tatooine/desert_kreetle.py b/scripts/mobiles/tatooine/desert_kreetle.py index 29fc2d12..6c2b1971 100644 --- a/scripts/mobiles/tatooine/desert_kreetle.py +++ b/scripts/mobiles/tatooine/desert_kreetle.py @@ -12,8 +12,6 @@ def addTemplate(core): mobileTemplate.setCreatureName('orphan_kreetle') mobileTemplate.setLevel(3) - mobileTemplate.setMinLevel(3) - mobileTemplate.setMaxLevel(5) mobileTemplate.setDifficulty(Difficulty.NORMAL) mobileTemplate.setMinSpawnDistance(4) diff --git a/scripts/mobiles/tatooine/desert_razorback.py b/scripts/mobiles/tatooine/desert_razorback.py index e2818a15..ebab48cd 100644 --- a/scripts/mobiles/tatooine/desert_razorback.py +++ b/scripts/mobiles/tatooine/desert_razorback.py @@ -12,8 +12,6 @@ def addTemplate(core): mobileTemplate.setCreatureName('desert_razorback') mobileTemplate.setLevel(23) - mobileTemplate.setMinLevel(23) - mobileTemplate.setMaxLevel(25) mobileTemplate.setDifficulty(Difficulty.NORMAL) mobileTemplate.setMinSpawnDistance(4) diff --git a/scripts/mobiles/tatooine/desert_squill.py b/scripts/mobiles/tatooine/desert_squill.py index 60ab5db2..1bd10a8a 100644 --- a/scripts/mobiles/tatooine/desert_squill.py +++ b/scripts/mobiles/tatooine/desert_squill.py @@ -12,8 +12,6 @@ def addTemplate(core): mobileTemplate.setCreatureName('desert_squill') mobileTemplate.setLevel(14) - mobileTemplate.setMinLevel(14) - mobileTemplate.setMaxLevel(15) mobileTemplate.setDifficulty(Difficulty.NORMAL) mobileTemplate.setMinSpawnDistance(4) diff --git a/scripts/mobiles/tatooine/dewback.py b/scripts/mobiles/tatooine/dewback.py index d286eb64..0d1bf28a 100644 --- a/scripts/mobiles/tatooine/dewback.py +++ b/scripts/mobiles/tatooine/dewback.py @@ -12,8 +12,6 @@ def addTemplate(core): mobileTemplate.setCreatureName('dewback') mobileTemplate.setLevel(17) - mobileTemplate.setMinLevel(17) - mobileTemplate.setMaxLevel(18) mobileTemplate.setDifficulty(Difficulty.NORMAL) mobileTemplate.setMinSpawnDistance(4) diff --git a/scripts/mobiles/tatooine/dimu_bantha.py b/scripts/mobiles/tatooine/dimu_bantha.py index f0f940d5..f929196a 100644 --- a/scripts/mobiles/tatooine/dimu_bantha.py +++ b/scripts/mobiles/tatooine/dimu_bantha.py @@ -12,8 +12,6 @@ def addTemplate(core): mobileTemplate.setCreatureName('dim_u_bantha') mobileTemplate.setLevel(3) - mobileTemplate.setMinLevel(3) - mobileTemplate.setMaxLevel(4) mobileTemplate.setDifficulty(Difficulty.NORMAL) mobileTemplate.setMinSpawnDistance(4) diff --git a/scripts/mobiles/tatooine/dune_bantha.py b/scripts/mobiles/tatooine/dune_bantha.py index 1d9e7a0c..f48c5135 100644 --- a/scripts/mobiles/tatooine/dune_bantha.py +++ b/scripts/mobiles/tatooine/dune_bantha.py @@ -12,8 +12,6 @@ def addTemplate(core): mobileTemplate.setCreatureName('dune_bantha') mobileTemplate.setLevel(20) - mobileTemplate.setMinLevel(20) - mobileTemplate.setMaxLevel(22) mobileTemplate.setDifficulty(Difficulty.NORMAL) mobileTemplate.setMinSpawnDistance(4) diff --git a/scripts/mobiles/tatooine/dune_beetle.py b/scripts/mobiles/tatooine/dune_beetle.py index f47f5f4b..cb40bc5e 100644 --- a/scripts/mobiles/tatooine/dune_beetle.py +++ b/scripts/mobiles/tatooine/dune_beetle.py @@ -12,8 +12,6 @@ def addTemplate(core): mobileTemplate.setCreatureName('dune_beetle') mobileTemplate.setLevel(9) - mobileTemplate.setMinLevel(9) - mobileTemplate.setMaxLevel(10) mobileTemplate.setDifficulty(Difficulty.NORMAL) mobileTemplate.setMinSpawnDistance(4) diff --git a/scripts/mobiles/tatooine/dwarf_bantha.py b/scripts/mobiles/tatooine/dwarf_bantha.py index 14a7274d..998034c8 100644 --- a/scripts/mobiles/tatooine/dwarf_bantha.py +++ b/scripts/mobiles/tatooine/dwarf_bantha.py @@ -12,8 +12,6 @@ def addTemplate(core): mobileTemplate.setCreatureName('dwarf_bantha') mobileTemplate.setLevel(10) - mobileTemplate.setMinLevel(10) - mobileTemplate.setMaxLevel(11) mobileTemplate.setDifficulty(Difficulty.NORMAL) mobileTemplate.setMinSpawnDistance(4) diff --git a/scripts/mobiles/tatooine/error_prone_battle_droids.py b/scripts/mobiles/tatooine/error_prone_battle_droids.py index 90dddbec..7dbf191b 100644 --- a/scripts/mobiles/tatooine/error_prone_battle_droids.py +++ b/scripts/mobiles/tatooine/error_prone_battle_droids.py @@ -12,8 +12,6 @@ def addTemplate(core): mobileTemplate.setCreatureName('tatooine_error_prone_droid') mobileTemplate.setLevel(6) - mobileTemplate.setMinLevel(6) - mobileTemplate.setMaxLevel(7) mobileTemplate.setDifficulty(Difficulty.NORMAL) mobileTemplate.setMinSpawnDistance(4) diff --git a/scripts/mobiles/tatooine/lesser_dewback.py b/scripts/mobiles/tatooine/lesser_dewback.py index 9a908d05..9ab38e1c 100644 --- a/scripts/mobiles/tatooine/lesser_dewback.py +++ b/scripts/mobiles/tatooine/lesser_dewback.py @@ -12,8 +12,6 @@ def addTemplate(core): mobileTemplate.setCreatureName('lesser_dewback') mobileTemplate.setLevel(4) - mobileTemplate.setMinLevel(3) - mobileTemplate.setMaxLevel(5) mobileTemplate.setDifficulty(Difficulty.NORMAL) mobileTemplate.setMinSpawnDistance(4) diff --git a/scripts/mobiles/tatooine/malignant_squill.py b/scripts/mobiles/tatooine/malignant_squill.py index 8475b234..0ae7da00 100644 --- a/scripts/mobiles/tatooine/malignant_squill.py +++ b/scripts/mobiles/tatooine/malignant_squill.py @@ -12,8 +12,6 @@ def addTemplate(core): mobileTemplate.setCreatureName('malignant_squill') mobileTemplate.setLevel(50) - mobileTemplate.setMinLevel(48) - mobileTemplate.setMaxLevel(52) mobileTemplate.setDifficulty(Difficulty.NORMAL) mobileTemplate.setMinSpawnDistance(4) diff --git a/scripts/mobiles/tatooine/parry_stormtrooper_dewback.py b/scripts/mobiles/tatooine/parry_stormtrooper_dewback.py index 9c09a3bb..5050524e 100644 --- a/scripts/mobiles/tatooine/parry_stormtrooper_dewback.py +++ b/scripts/mobiles/tatooine/parry_stormtrooper_dewback.py @@ -12,8 +12,6 @@ def addTemplate(core): mobileTemplate.setCreatureName('parry_stormtrooper_dewback') mobileTemplate.setLevel(17) - mobileTemplate.setMinLevel(16) - mobileTemplate.setMaxLevel(18) mobileTemplate.setDifficulty(Difficulty.NORMAL) mobileTemplate.setMinSpawnDistance(4) diff --git a/scripts/mobiles/tatooine/razorclaw.py b/scripts/mobiles/tatooine/razorclaw.py index 7fd5d1b5..7b25d2f5 100644 --- a/scripts/mobiles/tatooine/razorclaw.py +++ b/scripts/mobiles/tatooine/razorclaw.py @@ -12,8 +12,6 @@ def addTemplate(core): mobileTemplate.setCreatureName('elite_desert_razorback') mobileTemplate.setLevel(24) - mobileTemplate.setMinLevel(23) - mobileTemplate.setMaxLevel(25) mobileTemplate.setDifficulty(Difficulty.ELITE) mobileTemplate.setMinSpawnDistance(4) diff --git a/scripts/mobiles/tatooine/sickly_womprat.py b/scripts/mobiles/tatooine/sickly_womprat.py index b58d0a39..c083fc78 100644 --- a/scripts/mobiles/tatooine/sickly_womprat.py +++ b/scripts/mobiles/tatooine/sickly_womprat.py @@ -11,7 +11,6 @@ def addTemplate(core): mobileTemplate = MobileTemplate() mobileTemplate.setCreatureName('sickly_womprat') - mobileTemplate.setLevel(4) mobileTemplate.setMinLevel(4) mobileTemplate.setMaxLevel(13) mobileTemplate.setDifficulty(Difficulty.NORMAL) diff --git a/scripts/mobiles/tatooine/trandoshan_slaver.py b/scripts/mobiles/tatooine/trandoshan_slaver.py index 9138aad0..3abd3449 100644 --- a/scripts/mobiles/tatooine/trandoshan_slaver.py +++ b/scripts/mobiles/tatooine/trandoshan_slaver.py @@ -12,8 +12,6 @@ def addTemplate(core): mobileTemplate.setCreatureName('ep3_trandoshan_slaver') mobileTemplate.setLevel(4) - mobileTemplate.setMinLevel(1) - mobileTemplate.setMaxLevel(4) mobileTemplate.setDifficulty(Difficulty.NORMAL) mobileTemplate.setMinSpawnDistance(4) diff --git a/scripts/mobiles/tatooine/tusken_raider_warrior.py b/scripts/mobiles/tatooine/tusken_raider_warrior.py index c2047619..9816ddaa 100644 --- a/scripts/mobiles/tatooine/tusken_raider_warrior.py +++ b/scripts/mobiles/tatooine/tusken_raider_warrior.py @@ -12,8 +12,6 @@ def addTemplate(core): mobileTemplate.setCreatureName('tusken_raider_warrior') mobileTemplate.setLevel(6) - mobileTemplate.setMinLevel(6) - mobileTemplate.setMaxLevel(7) mobileTemplate.setDifficulty(Difficulty.NORMAL) mobileTemplate.setMinSpawnDistance(4) diff --git a/scripts/mobiles/tatooine/valarian_shuttle_guard.py b/scripts/mobiles/tatooine/valarian_shuttle_guard.py index bae307aa..858e2ae2 100644 --- a/scripts/mobiles/tatooine/valarian_shuttle_guard.py +++ b/scripts/mobiles/tatooine/valarian_shuttle_guard.py @@ -12,8 +12,6 @@ def addTemplate(core): mobileTemplate.setCreatureName('valarian_swooper_shuttle') mobileTemplate.setLevel(18) - mobileTemplate.setMinLevel(17) - mobileTemplate.setMaxLevel(22) mobileTemplate.setDifficulty(Difficulty.NORMAL) mobileTemplate.setMinSpawnDistance(4) From 2c45fbe6abe17e36b7119b53eb441fc0665faa2e Mon Sep 17 00:00:00 2001 From: Waverunner Date: Sun, 6 Jul 2014 13:14:12 -0400 Subject: [PATCH 5/5] Fixed waypoint not updating for Arakyds, Fixed waypoint not updating on first run of seekers, Added Identify Target --- scripts/radial/npc/bounty_seeker.py | 28 ++++++++++- .../objectives/BountyMissionObjective.java | 49 +++++++++++++++++-- 2 files changed, 71 insertions(+), 6 deletions(-) diff --git a/scripts/radial/npc/bounty_seeker.py b/scripts/radial/npc/bounty_seeker.py index f619a5bb..bcd07349 100644 --- a/scripts/radial/npc/bounty_seeker.py +++ b/scripts/radial/npc/bounty_seeker.py @@ -33,8 +33,8 @@ def handleSelection(core, owner, target, option): pos = SpawnPoint.getRandomPosition(owner.getPosition(), 1, 3, owner.getPlanetId()) ori = owner.getOrientation() seeker = core.staticService.spawnObject('object/creature/npc/droid/crafted/shared_probe_droid_advanced.iff', owner.getPlanet().getName(), 0, pos.x, pos.y, pos.z, ori.y, ori.w) - time.sleep(3) owner.sendSystemMessage('@mission/mission_generic:seeker_droid_standby', 0) + time.sleep(3) seeker.setPosture(8) time.sleep(6.5) core.objectService.destroyObject(seeker) @@ -42,5 +42,31 @@ def handleSelection(core, owner, target, option): return if option == 137 and target: + id = owner.getPlayerObject().getBountyMissionId() + if id is None or id == 0: + owner.sendSystemMessage('@mission/mission_generic:bounty_no_mission', 0) + return + + mission = core.objectService.getObject(id) + if mission is None: + owner.sendSystemMessage('@mission/mission_generic:bounty_no_mission', 0) + return + + if mission.getObjective().isSeekerActive(): + owner.sendSystemMessage('@mission/mission_generic:bounty_already_tracking', 0) + return + if target.getUses() == 0: + core.objectService.destroyObject(target) + else: + target.setUses(target.getUses() - 1) + pos = SpawnPoint.getRandomPosition(owner.getPosition(), 1, 3, owner.getPlanetId()) + ori = owner.getOrientation() + seeker = core.staticService.spawnObject('object/creature/npc/droid/crafted/shared_probe_droid_advanced.iff', owner.getPlanet().getName(), 0, pos.x, pos.y, pos.z, ori.y, ori.w) + owner.sendSystemMessage('@mission/mission_generic:seeker_droid_standby', 0) + time.sleep(3) + seeker.setPosture(8) + time.sleep(6.5) + core.objectService.destroyObject(seeker) + mission.getObjective().beginIdentifyTarget(core, owner) return return \ No newline at end of file diff --git a/src/resources/objectives/BountyMissionObjective.java b/src/resources/objectives/BountyMissionObjective.java index 35eb4837..5ed1b0c0 100644 --- a/src/resources/objectives/BountyMissionObjective.java +++ b/src/resources/objectives/BountyMissionObjective.java @@ -304,18 +304,18 @@ public class BountyMissionObjective extends MissionObjective { WaypointObject missionWp = mission.getWaypoint(); - if (missionWp.getPlanetCRC() != CRC.StringtoCRC(target.getPlanet().name)) { + if (missionWp == null || missionWp.getPlanetCRC() != CRC.StringtoCRC(target.getPlanet().name)) { WaypointObject waypoint = (WaypointObject) getMissionObject().getWaypoint(); waypoint.setActive(true); waypoint.setColor(WaypointObject.ORANGE); waypoint.setName(getMissionObject().getTargetName()); waypoint.setPlanetCRC(CRC.StringtoCRC(target.getPlanet().getName())); waypoint.setStringAttribute("", ""); - getMissionObject().setWaypoint(waypoint); + waypoint.setPosition(target.getWorldPosition()); + mission.setWaypoint(waypoint); } else { missionWp.setPosition(target.getWorldPosition()); mission.setWaypoint(missionWp); - getMissionObject().setWaypoint(missionWp); } actor.sendSystemMessage("@mission/mission_generic:target_location_updated_ground", DisplayType.Broadcast); actor.sendSystemMessage("@mission/mission_generic:target_continue_tracking", DisplayType.Broadcast); @@ -331,6 +331,46 @@ public class BountyMissionObjective extends MissionObjective { } } + public void beginIdentifyTarget(NGECore core, CreatureObject actor) { + if (seekerActive) + return; + + setSeekerActive(true); + setSeekerPlanet(actor.getPlanet().name); + + Executors.newSingleThreadScheduledExecutor().schedule(() -> { + MissionObject mission = getMissionObject(); + SWGObject target = core.objectService.getObject(markObjId); + + if (target == null) { + actor.sendSystemMessage("@mission/mission_generic:player_target_inactive", DisplayType.Broadcast); + return; + } else if (target.getPlanet().getName() != getSeekerPlanet()) { + actor.sendSystemMessage("@mission/mission_generic:target_not_on_planet", DisplayType.Broadcast); + return; + } + + WaypointObject missionWp = mission.getWaypoint(); + + if (missionWp == null || missionWp.getPlanetCRC() != CRC.StringtoCRC(target.getPlanet().name)) { + WaypointObject waypoint = (WaypointObject) getMissionObject().getWaypoint(); + waypoint.setActive(true); + waypoint.setColor(WaypointObject.ORANGE); + waypoint.setName(getMissionObject().getTargetName()); + waypoint.setPlanetCRC(CRC.StringtoCRC(target.getPlanet().getName())); + waypoint.setStringAttribute("", ""); + waypoint.setPosition(target.getWorldPosition()); + mission.setWaypoint(waypoint); + } else { + missionWp.setPosition(target.getWorldPosition()); + mission.setWaypoint(missionWp); + } + + actor.sendSystemMessage("Your target was identified as " + target.getCustomName() + ".", DisplayType.Broadcast); // Can't find this in the string files + actor.sendSystemMessage("@mission/mission_generic:target_location_updated_ground", DisplayType.Broadcast); + }, 60, TimeUnit.SECONDS); + } + public void beginArakydUpdate(final CreatureObject actor) { arakydActive = true; Executors.newScheduledThreadPool(1).schedule(() -> { @@ -350,8 +390,7 @@ public class BountyMissionObjective extends MissionObjective { waypoint.setName(getMissionObject().getTargetName()); waypoint.setPlanetCRC(CRC.StringtoCRC(target.getPlanet().getName())); waypoint.setStringAttribute("", ""); - - actor.getClient().getSession().write(getMissionObject().getBaseline3().set("waypoint", waypoint)); + getMissionObject().setWaypoint(waypoint); actor.sendSystemMessage("@mission/mission_generic:target_location_updated_ground", DisplayType.Broadcast); actor.sendSystemMessage("@mission/mission_generic:target_located_" + target.getPlanet().getName(), DisplayType.Broadcast);