From 622d70f28f411a48820dbe76ee775b8d550acac5 Mon Sep 17 00:00:00 2001 From: Hendrik Brummermann Date: Sun, 10 Jul 2011 21:38:17 +0000 Subject: [PATCH 01/18] updated version number --- build.ant.properties | 2 +- runserver.bat | 2 +- runserver.sh | 2 +- src/games/stendhal/common/Debug.java | 2 +- src/games/stendhal/server/core/engine/GenerateINI.java | 2 +- stendhal.jnlp | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/build.ant.properties b/build.ant.properties index ee094baed9..5b8aeae585 100644 --- a/build.ant.properties +++ b/build.ant.properties @@ -73,7 +73,7 @@ version_server = http://arianne.sourceforge.net/stendhal.version # current version of stendhal version.old = 0.94 -version = 0.94.5 +version = 0.95 # javac options javac.deprecation = true diff --git a/runserver.bat b/runserver.bat index ad243446e5..f31c7a4af3 100644 --- a/runserver.bat +++ b/runserver.bat @@ -1,3 +1,3 @@ -set STENDHAL_VERSION=0.94.5 +set STENDHAL_VERSION=0.95 set LOCALCLASSPATH=.;data\script;data\conf;stendhal-server-%STENDHAL_VERSION%.jar;marauroa.jar;mysql-connector.jar;log4j.jar;commons-lang.jar;h2.jar java -Xmx400m -cp "%LOCALCLASSPATH%" games.stendhal.server.StendhalServer -c server.ini -l diff --git a/runserver.sh b/runserver.sh index 89d6d50a7d..f609dc1b3d 100644 --- a/runserver.sh +++ b/runserver.sh @@ -1,5 +1,5 @@ #!/bin/sh -STENDHAL_VERSION="0.94.5" +STENDHAL_VERSION="0.95" LOCALCLASSPATH=.:data/script/:data/conf/:stendhal-server-$STENDHAL_VERSION.jar:marauroa.jar:mysql-connector.jar:log4j.jar:commons-lang.jar:h2.jar diff --git a/src/games/stendhal/common/Debug.java b/src/games/stendhal/common/Debug.java index 2e5ea5e5af..762bb4e51b 100644 --- a/src/games/stendhal/common/Debug.java +++ b/src/games/stendhal/common/Debug.java @@ -26,7 +26,7 @@ public class Debug { /** version. */ // Note: This line is updated by build.xml using a regexp so be sure to adjust it in case you modify this line. - public static final String VERSION = "0.94.5"; + public static final String VERSION = "0.95"; public static final String PRE_RELEASE_VERSION = null; diff --git a/src/games/stendhal/server/core/engine/GenerateINI.java b/src/games/stendhal/server/core/engine/GenerateINI.java index a432b84472..0f7d0c2837 100644 --- a/src/games/stendhal/server/core/engine/GenerateINI.java +++ b/src/games/stendhal/server/core/engine/GenerateINI.java @@ -271,7 +271,7 @@ public class GenerateINI { out.println(); out.println("server_typeGame=" + gameName); out.println("server_name=" + gameName + " Marauroa server"); - out.println("server_version=0.94.5"); + out.println("server_version=0.95"); out.println("server_contact=https://sourceforge.net/tracker/?atid=514826&group_id=66537&func=browse"); out.println(); out.println("# Extensions configured on the server. Enable at will."); diff --git a/stendhal.jnlp b/stendhal.jnlp index a82b03fcee..60a43ab393 100644 --- a/stendhal.jnlp +++ b/stendhal.jnlp @@ -22,7 +22,7 @@ Some of these people are NPC, they will give you tasks to accomplish and hints t - + From 95b230f2e13de8e5b6ad1a241cd50cba0c5ce54c Mon Sep 17 00:00:00 2001 From: Hendrik Brummermann Date: Mon, 11 Jul 2011 19:20:20 +0000 Subject: [PATCH 02/18] backported fix by kiheru for: Use ~/.config/stendhal as the data directory on unix like systems, unless the user already has saved account data in ~/stendhal --- src/games/stendhal/client/stendhal.java | 38 ++++++++++++++++++- .../stendhal/client/update/Bootstrap.java | 25 ++++++++---- 2 files changed, 54 insertions(+), 9 deletions(-) diff --git a/src/games/stendhal/client/stendhal.java b/src/games/stendhal/client/stendhal.java index 99bc3cc12c..318ad021ea 100644 --- a/src/games/stendhal/client/stendhal.java +++ b/src/games/stendhal/client/stendhal.java @@ -25,6 +25,7 @@ import games.stendhal.common.Version; import games.stendhal.common.resource.ResourceManager; import java.awt.Dimension; +import java.io.File; import java.security.AccessControlException; import java.util.Locale; @@ -51,7 +52,7 @@ public class stendhal { /** * Directory for storing the persistent game data. */ - private static final String gameFolder; + private static String gameFolder; /** * Just a try to get Webstart working without additional rights. */ @@ -68,7 +69,7 @@ public class stendhal { /** We set the main game folder to the game name */ GAME_NAME = ClientGameConfiguration.get("GAME_NAME"); STENDHAL_FOLDER = separator + GAME_NAME.toLowerCase(Locale.ENGLISH) + separator; - gameFolder = System.getProperty("user.home") + STENDHAL_FOLDER; + initGameFolder(); /** setup the search locations for the resource manager */ RESOURCE_MANAGER.addScheme("sound" , "data/sounds"); @@ -88,6 +89,39 @@ public class stendhal { public static final int FPS_LIMIT = 25; + /** + * Initialize the client game directory. + *

+ * NOTE: IF YOU CHANGE THIS, CHANGE ALSO CORRESPONDING CODE IN + * Bootstrap.java + */ + private static void initGameFolder() { + String defaultFolder = System.getProperty("user.home") + STENDHAL_FOLDER; + /* + * Add any previously unrecognized unix like systems here. These will + * try to use ~/.config/stendhal if the user does not have saved data + * in ~/stendhal. + * + * OS X is counted in here too, but should it? + * + * List taken from: + * http://mindprod.com/jgloss/properties.html#OSNAME + */ + String unixLikes = "AIX|Digital Unix|FreeBSD|HP UX|Irix|Linux|Mac OS X|Solaris"; + String system = System.getProperty("os.name"); + if (system.matches(unixLikes)) { + // Check first if the user has important data in the default folder. + File f = new File(defaultFolder + "user.dat"); + if (!f.exists()) { + gameFolder = System.getProperty("user.home") + separator + + ".config" + separator + STENDHAL_FOLDER; + return; + } + } + // Everyone else should use the default top level directory in $HOME + gameFolder = defaultFolder; + } + public static void setDoLogin() { doLogin = true; } diff --git a/src/games/stendhal/client/update/Bootstrap.java b/src/games/stendhal/client/update/Bootstrap.java index 85958b7d3e..3968123c91 100644 --- a/src/games/stendhal/client/update/Bootstrap.java +++ b/src/games/stendhal/client/update/Bootstrap.java @@ -1,5 +1,7 @@ package games.stendhal.client.update; +import static java.io.File.separator; + import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; @@ -24,8 +26,6 @@ import javax.swing.JOptionPane; * @author hendrik */ public class Bootstrap { - - private String pathSep; private String jarFolder; private Properties bootProp; private Properties bootPropOrg; @@ -54,13 +54,23 @@ public class Bootstrap { */ void init() { // discover folder for .jar-files - pathSep = System.getProperty("file.separator"); - + // Copied from stendhal.java; don't change this to anything different + // from than what's there final String stendhal = ClientGameConfiguration.get("GAME_NAME").toLowerCase(); System.out.println("GAME: " + stendhal); + String topFolder = System.getProperty("user.home") + separator + stendhal + separator; + String unixLikes = "AIX|Digital Unix|FreeBSD|HP UX|Irix|Linux|Mac OS X|Solaris"; + String system = System.getProperty("os.name"); + if (system.matches(unixLikes)) { + // Check first if the user has important data in the default folder. + File f = new File(topFolder + "user.dat"); + if (!f.exists()) { + topFolder = System.getProperty("user.home") + separator + + ".config" + separator + stendhal + separator; + } + } - jarFolder = System.getProperty("user.home") + pathSep + stendhal - + pathSep + "jar" + pathSep; + jarFolder = topFolder + "jar"; final File folder = new File(jarFolder); if (!folder.exists()) { folder.mkdirs(); @@ -70,7 +80,8 @@ public class Bootstrap { /** * Sets a dynamic classpath up and returns a Class reference loaded from it. - * + * + * @param includeUpdates * @return ClassLoader object * @throws Exception * if an unexpected error occurs From e90b090cc65ebfa5358c3cddbc8663b8699f3a64 Mon Sep 17 00:00:00 2001 From: Hendrik Brummermann Date: Mon, 11 Jul 2011 19:23:37 +0000 Subject: [PATCH 03/18] update changelog --- doc/CHANGES.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/CHANGES.txt b/doc/CHANGES.txt index 9bdd778509..0135d838e9 100644 --- a/doc/CHANGES.txt +++ b/doc/CHANGES.txt @@ -9,6 +9,7 @@ read http://stendhalgame.org/wiki/Automatic_Software_Updater ****************** - rewrote the updater so that it will not break onces a year anymore because the certificate expires +- on Unix/Linux the home folder now defaults to $HOME/.config/stendhal for new installs - improved the best player score for low level players: http://stendhalgame.org/wiki/Fixing_RP_Score_2011 * Marauroa* From 2ccfb5c7ddd3ead25e3596a39dea146919ee7c29 Mon Sep 17 00:00:00 2001 From: Kimmo Rundelin Date: Tue, 12 Jul 2011 08:45:53 +0000 Subject: [PATCH 04/18] Added missing directory separator --- src/games/stendhal/client/update/Bootstrap.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/games/stendhal/client/update/Bootstrap.java b/src/games/stendhal/client/update/Bootstrap.java index 3968123c91..26c7fc75df 100644 --- a/src/games/stendhal/client/update/Bootstrap.java +++ b/src/games/stendhal/client/update/Bootstrap.java @@ -70,7 +70,7 @@ public class Bootstrap { } } - jarFolder = topFolder + "jar"; + jarFolder = topFolder + "jar" + separator; final File folder = new File(jarFolder); if (!folder.exists()) { folder.mkdirs(); From 52383dd85c5ef89a37cba872634b51b6e4fa2eaf Mon Sep 17 00:00:00 2001 From: Hendrik Brummermann Date: Tue, 12 Jul 2011 20:21:10 +0000 Subject: [PATCH 05/18] SignatureVerifier can now handle hexadecimal strings with an uneven number of digits --- .../stendhal/client/update/SignatureVerifier.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/games/stendhal/client/update/SignatureVerifier.java b/src/games/stendhal/client/update/SignatureVerifier.java index 0078a4ba75..c499c37936 100644 --- a/src/games/stendhal/client/update/SignatureVerifier.java +++ b/src/games/stendhal/client/update/SignatureVerifier.java @@ -103,8 +103,17 @@ public class SignatureVerifier { } // http://stackoverflow.com/questions/140131/convert-a-string-representation-of-a-hex-dump-to-a-byte-array-using-java/140861#140861 - private static byte[] hexStringToByteArray(String s) { + static byte[] hexStringToByteArray(String hexString) { + String s = hexString; + + // handle uneven number of hex digits int len = s.length(); + if (len % 2 == 1) { + s = "0" + s; + len++; + } + + // decode byte[] data = new byte[len / 2]; for (int i = 0; i < len; i += 2) { data[i / 2] = (byte) ((Character.digit(s.charAt(i), 16) << 4) + Character From 422885d34be6fe5dcc6fb252909c4356c6f90219 Mon Sep 17 00:00:00 2001 From: Hendrik Brummermann Date: Tue, 12 Jul 2011 20:25:24 +0000 Subject: [PATCH 06/18] backported quests improvements by bluelads4 --- .../maps/quests/CleanAthorsUnderground.java | 47 +++++++++++++------ .../server/maps/quests/KillMonks.java | 14 +++--- 2 files changed, 40 insertions(+), 21 deletions(-) diff --git a/src/games/stendhal/server/maps/quests/CleanAthorsUnderground.java b/src/games/stendhal/server/maps/quests/CleanAthorsUnderground.java index c17c0159a7..7765e3f8e8 100644 --- a/src/games/stendhal/server/maps/quests/CleanAthorsUnderground.java +++ b/src/games/stendhal/server/maps/quests/CleanAthorsUnderground.java @@ -21,6 +21,7 @@ import games.stendhal.server.entity.npc.action.EquipItemAction; import games.stendhal.server.entity.npc.action.IncreaseKarmaAction; import games.stendhal.server.entity.npc.action.IncreaseXPAction; import games.stendhal.server.entity.npc.action.MultipleActions; +import games.stendhal.server.entity.npc.action.SayTimeRemainingAction; import games.stendhal.server.entity.npc.action.SetQuestAction; import games.stendhal.server.entity.npc.action.SetQuestToTimeStampAction; import games.stendhal.server.entity.npc.action.StartRecordingKillsAction; @@ -34,6 +35,7 @@ import games.stendhal.server.entity.npc.condition.TimePassedCondition; import games.stendhal.server.entity.player.Player; import java.util.ArrayList; +import java.util.Arrays; import java.util.LinkedList; import java.util.List; import java.util.Map; @@ -86,24 +88,41 @@ public class CleanAthorsUnderground extends AbstractQuest { ConversationPhrases.QUEST_MESSAGES, new QuestNotStartedCondition(QUEST_SLOT), ConversationStates.QUEST_OFFERED, - "My wife Jane and me are on vacation here on Athor island. Unfortunetly we can't explore the whole island cause some ugly creatures step in our way each time. Can you help us by killing some of them to turn our vacation into a good one?", + "My wife Jane and me are on vacation here on Athor island. #Unfortunately we can't explore the whole island cause some ugly #creatures step in our way each time. Can you help us by killing some of them to turn our vacation into a good one?", null); + npc.add( + ConversationStates.QUEST_OFFERED, + Arrays.asList("Unfortunately"), + null, + ConversationStates.QUEST_OFFERED, + "Yes, unfortunately. We wanted to have a great time here but all we did so far was sunbathing at the beach.", + null); + + npc.add( + ConversationStates.QUEST_OFFERED, + Arrays.asList("creatures"), + null, + ConversationStates.QUEST_OFFERED, + "We just want to visit the first part of the dungeon, it seems to be very interesting. Some of these ugly things jump around there, even some mummies!", + null); + + npc.add(ConversationStates.ATTENDING, + ConversationPhrases.QUEST_MESSAGES, + new AndCondition(new NotCondition(new TimePassedCondition(QUEST_SLOT, 1, WEEK_IN_MINUTES)), new QuestStateStartsWithCondition(QUEST_SLOT, "killed")), + ConversationStates.ATTENDING, + null, + new SayTimeRemainingAction(QUEST_SLOT, 1, WEEK_IN_MINUTES, "These #creatures didn't return so far and we could see some lovely places all over. Please return in")); + + npc.add(ConversationStates.ATTENDING, ConversationPhrases.QUEST_MESSAGES, new AndCondition(new QuestStateStartsWithCondition(QUEST_SLOT,"killed"), new TimePassedCondition(QUEST_SLOT, 1, WEEK_IN_MINUTES)), ConversationStates.QUEST_OFFERED, - "Those creatures returned after the last time you helped us. May you help us again please?", + "Those #creatures returned after the last time you helped us. May you help us again please?", null); - npc.add(ConversationStates.ATTENDING, - ConversationPhrases.QUEST_MESSAGES, - new AndCondition(new QuestStateStartsWithCondition(QUEST_SLOT,"killed"), - new NotCondition(new TimePassedCondition(QUEST_SLOT, 1, WEEK_IN_MINUTES))), - ConversationStates.ATTENDING, - "These creatures didn't return so far and we could see some lovely places all over.", - null); final Map> toKill = new TreeMap>(); @@ -165,7 +184,7 @@ public class CleanAthorsUnderground extends AbstractQuest { new QuestInStateCondition(QUEST_SLOT, 0, "start"), new KilledForQuestCondition(QUEST_SLOT, 1)), ConversationStates.ATTENDING, - "Brilliant! You killed some of these ugly creatures as I see! Hopefully they'll not return that fast or we will still not have the chance to explore some places." + "Please take these greater potions as a reward for your help.", + "Brilliant! You killed some of these ugly creatures as I see! Hopefully they'll not return that fast or we will still not have the chance to explore some places." + "Please take these greater potions as a reward for your help.", new MultipleActions(actions)); npc.add(ConversationStates.ATTENDING, @@ -174,7 +193,7 @@ public class CleanAthorsUnderground extends AbstractQuest { new QuestInStateCondition(QUEST_SLOT, 0, "start"), new NotCondition(new KilledForQuestCondition(QUEST_SLOT, 1))), ConversationStates.ATTENDING, - "Please free these lovely places on Athor from ugly creatures!", + "Please free these lovely places on Athor from ugly #creatures!", null); } @@ -197,11 +216,11 @@ public class CleanAthorsUnderground extends AbstractQuest { return res; } if (!isCompleted(player)) { - res.add("I must kill one of each creature of Athor underground for helping John and Jane having a nice vacation!"); + res.add("I must kill one of each creature of the Athor underground for helping John and Jane having a nice vacation!"); } else if(isRepeatable(player)){ - res.add("It's a long time ago that I visited John and asked if he was able to explore some places on Athor. Maybe he needs my help again."); + res.add("It's a long time ago that I visited John and Jane on Athor island. Maybe he needs my help again now."); } else { - res.add("I've killed some creatures and John and Jane can finally enjoy their vacation!"); + res.add("I've killed some creatures and John and Jane can finally enjoy their vacation! They will not need my help again during the next days."); } return res; } diff --git a/src/games/stendhal/server/maps/quests/KillMonks.java b/src/games/stendhal/server/maps/quests/KillMonks.java index 3663aaffa8..250f5507d2 100644 --- a/src/games/stendhal/server/maps/quests/KillMonks.java +++ b/src/games/stendhal/server/maps/quests/KillMonks.java @@ -20,6 +20,7 @@ import games.stendhal.server.entity.npc.SpeakerNPC; import games.stendhal.server.entity.npc.action.EquipItemAction; import games.stendhal.server.entity.npc.action.IncreaseXPAction; import games.stendhal.server.entity.npc.action.MultipleActions; +import games.stendhal.server.entity.npc.action.SayTimeRemainingAction; import games.stendhal.server.entity.npc.action.SetQuestAction; import games.stendhal.server.entity.npc.action.SetQuestToTimeStampAction; import games.stendhal.server.entity.npc.action.StartRecordingKillsAction; @@ -95,7 +96,7 @@ public class KillMonks extends AbstractQuest { ConversationPhrases.QUEST_MESSAGES, new QuestNotStartedCondition(QUEST_SLOT), ConversationStates.QUEST_OFFERED, - "My lovely wife died when she went to Wofol for getting us some freshmade pizza by Kroip. Some monks stepped into her way and she had no chance. Now I want revenge! May you help me?", + "My lovely wife died when she went to Wofol for ordering some freshmade pizza by Kroip. Some monks stepped into her way and she had no chance. Now I want revenge! May you help me?", null); npc.add(ConversationStates.ATTENDING, @@ -107,12 +108,11 @@ public class KillMonks extends AbstractQuest { null); npc.add(ConversationStates.ATTENDING, - ConversationPhrases.QUEST_MESSAGES, - new AndCondition(new QuestStateStartsWithCondition(QUEST_SLOT,"killed"), - new NotCondition(new TimePassedCondition(QUEST_SLOT, 1, WEEK_IN_MINUTES*2))), + ConversationPhrases.QUEST_MESSAGES, + new AndCondition(new NotCondition(new TimePassedCondition(QUEST_SLOT, 1, WEEK_IN_MINUTES*2)), new QuestStateStartsWithCondition(QUEST_SLOT, "killed")), ConversationStates.ATTENDING, - "These monks learned their lesson for now but I could need your help again in some days.", - null); + null, + new SayTimeRemainingAction(QUEST_SLOT, 1, WEEK_IN_MINUTES*2, "These monks learned their lesson for now but I could need your help again in")); final List actions = new LinkedList(); @@ -193,7 +193,7 @@ public class KillMonks extends AbstractQuest { if (!isCompleted(player)) { res.add("I must kill 25 monks and 25 darkmonks to help Andy reaching his goal of taking revenge."); } else if(isRepeatable(player)){ - res.add("Now, after more than two weeks, I should take a look after Andy again. Maybe he needs my help"); + res.add("Now, after more than two weeks, I should take a look after Andy again. Maybe he needs my help!"); } else { res.add("I've killed some monks and Andy finally can sleep a bit better!"); } From b8dbda8db21c55b01eca58d710f58d24815dfa09 Mon Sep 17 00:00:00 2001 From: Hendrik Brummermann Date: Tue, 12 Jul 2011 20:49:18 +0000 Subject: [PATCH 07/18] compare signature in jar.properties to signature in update.properties before deciding to skip a download --- src/games/stendhal/client/update/UpdateManager.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/games/stendhal/client/update/UpdateManager.java b/src/games/stendhal/client/update/UpdateManager.java index ce4b43c37f..0f93108fc8 100644 --- a/src/games/stendhal/client/update/UpdateManager.java +++ b/src/games/stendhal/client/update/UpdateManager.java @@ -194,8 +194,11 @@ public class UpdateManager { final long sizeIs = new File(jarFolder + file).length(); if (sizeShould == sizeIs) { String signature = updateProp.getProperty("file-signature." + file); - if (SignatureVerifier.get().checkSignature(jarFolder + file, signature)) { - itr.remove(); + String signatureJarProp = bootProp.getProperty("file-signature." + file); + if (signature.equals(signatureJarProp)) { + if (SignatureVerifier.get().checkSignature(jarFolder + file, signature)) { + itr.remove(); + } } } } catch (final RuntimeException e) { @@ -313,11 +316,11 @@ public class UpdateManager { final int shouldSize = Integer.parseInt(updateProp.getProperty("file-size." + file, "")); String signature = updateProp.getProperty("file-signature." + file); if ((fileObj.length() != shouldSize) || !SignatureVerifier.get().checkSignature(jarFolder + file, signature)) { - UpdateGUIDialogs.messageBox("Sorry, an error occurred while downloading the update.\r\nFile size of " + UpdateGUIDialogs.messageBox("Sorry, an error occurred while downloading the update.\r\nThe signature of " + file - + "or signature does not match.\r\nWe got file size " + + " does not match.\r\nWe got " + fileObj.length() - + ". It should be " + + " bytes of " + shouldSize); updateProgressBar.dispose(); return false; From c7b76e0ad875ea632faa89e601aa3264a8cbcb31 Mon Sep 17 00:00:00 2001 From: Hendrik Brummermann Date: Tue, 12 Jul 2011 20:51:09 +0000 Subject: [PATCH 08/18] reverted last fix and implemented it different: Just overwrite the signature in jar.properties if the actual file matches the signature in update.properties --- src/games/stendhal/client/update/UpdateManager.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/games/stendhal/client/update/UpdateManager.java b/src/games/stendhal/client/update/UpdateManager.java index 0f93108fc8..4142597eb2 100644 --- a/src/games/stendhal/client/update/UpdateManager.java +++ b/src/games/stendhal/client/update/UpdateManager.java @@ -194,11 +194,9 @@ public class UpdateManager { final long sizeIs = new File(jarFolder + file).length(); if (sizeShould == sizeIs) { String signature = updateProp.getProperty("file-signature." + file); - String signatureJarProp = bootProp.getProperty("file-signature." + file); - if (signature.equals(signatureJarProp)) { - if (SignatureVerifier.get().checkSignature(jarFolder + file, signature)) { - itr.remove(); - } + if (SignatureVerifier.get().checkSignature(jarFolder + file, signature)) { + bootProp.put("file-signature.", signature); + itr.remove(); } } } catch (final RuntimeException e) { From 13fe9b87da0975fbd8d9838905bf0e5161aa9de6 Mon Sep 17 00:00:00 2001 From: Hendrik Brummermann Date: Tue, 12 Jul 2011 20:59:15 +0000 Subject: [PATCH 09/18] treat ClassNotFoundException similar to LinkageError in the sense that it triggers the inconsistent update handling --- src/games/stendhal/client/update/Bootstrap.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/games/stendhal/client/update/Bootstrap.java b/src/games/stendhal/client/update/Bootstrap.java index 26c7fc75df..9c5c398b4c 100644 --- a/src/games/stendhal/client/update/Bootstrap.java +++ b/src/games/stendhal/client/update/Bootstrap.java @@ -275,9 +275,9 @@ public class Bootstrap { final int res = JOptionPane.showConfirmDialog( null, - new SelectableLabel(" Sorry an error occurred because of inconsistent code signing.\r\n" - + " Delete update files so that they are downloaded again after you restart " + ClientGameConfiguration.get("GAME_NAME") + "?\r\n" - + " Note: This exception can occur if you include signed jars into a self build client."), + new SelectableLabel("Sorry an error occurred because of inconsistent code signing.\r\n" + + "Delete update files so that they are downloaded again after you restart " + ClientGameConfiguration.get("GAME_NAME") + "?\r\n" + + "Note: This exception can occur if you include signed jars into a self build client."), ClientGameConfiguration.get("GAME_NAME"), JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); if (res == JOptionPane.YES_OPTION) { @@ -324,7 +324,7 @@ public class Bootstrap { if (e instanceof OutOfMemoryError) { JOptionPane.showMessageDialog(null, "Sorry, an OutOfMemoryError occurred. Please restart " + ClientGameConfiguration.get("GAME_NAME") + "."); - } else if (e instanceof LinkageError || e instanceof SecurityException) { + } else if (e instanceof LinkageError || e instanceof SecurityException || e instanceof ClassNotFoundException) { final int res = JOptionPane.showConfirmDialog( null, new SelectableLabel(message From 5a9facaf69439961a556496efa20781dfdf5566f Mon Sep 17 00:00:00 2001 From: Hendrik Brummermann Date: Tue, 12 Jul 2011 21:02:13 +0000 Subject: [PATCH 10/18] added line break to inconsistent update state --- src/games/stendhal/client/update/Bootstrap.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/games/stendhal/client/update/Bootstrap.java b/src/games/stendhal/client/update/Bootstrap.java index 9c5c398b4c..c3a9633576 100644 --- a/src/games/stendhal/client/update/Bootstrap.java +++ b/src/games/stendhal/client/update/Bootstrap.java @@ -328,7 +328,7 @@ public class Bootstrap { final int res = JOptionPane.showConfirmDialog( null, new SelectableLabel(message - + " Sorry an error occurred because of an inconsistent update state. Delete update files so that they are downloaded again after you restart " + ClientGameConfiguration.get("GAME_NAME") +"?"), + + " Sorry an error occurred because of an inconsistent update state.\r\nDelete update files so that they are downloaded again after you restart " + ClientGameConfiguration.get("GAME_NAME") +"?"), ClientGameConfiguration.get("GAME_NAME"), JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); if (res == JOptionPane.YES_OPTION) { From 7431a1e0ec1b660693ad866c520f7f1ff063528a Mon Sep 17 00:00:00 2001 From: Hendrik Brummermann Date: Tue, 12 Jul 2011 21:19:30 +0000 Subject: [PATCH 11/18] fixed missing filename in signatures entries in jar.properties for known files --- src/games/stendhal/client/update/UpdateManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/games/stendhal/client/update/UpdateManager.java b/src/games/stendhal/client/update/UpdateManager.java index 4142597eb2..ffc2e57f22 100644 --- a/src/games/stendhal/client/update/UpdateManager.java +++ b/src/games/stendhal/client/update/UpdateManager.java @@ -195,7 +195,7 @@ public class UpdateManager { if (sizeShould == sizeIs) { String signature = updateProp.getProperty("file-signature." + file); if (SignatureVerifier.get().checkSignature(jarFolder + file, signature)) { - bootProp.put("file-signature.", signature); + bootProp.put("file-signature." + file, signature); itr.remove(); } } From d298b176c82ef2bd57df2dffae227860a9767375 Mon Sep 17 00:00:00 2001 From: Hendrik Brummermann Date: Wed, 13 Jul 2011 18:10:26 +0000 Subject: [PATCH 12/18] backported fix to ignore all files on invalid signature (fixes #3365690) --- .../stendhal/client/update/Bootstrap.java | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/src/games/stendhal/client/update/Bootstrap.java b/src/games/stendhal/client/update/Bootstrap.java index c3a9633576..57aac9aa4c 100644 --- a/src/games/stendhal/client/update/Bootstrap.java +++ b/src/games/stendhal/client/update/Bootstrap.java @@ -65,7 +65,7 @@ public class Bootstrap { // Check first if the user has important data in the default folder. File f = new File(topFolder + "user.dat"); if (!f.exists()) { - topFolder = System.getProperty("user.home") + separator + topFolder = System.getProperty("user.home") + separator + ".config" + separator + stendhal + separator; } } @@ -80,13 +80,14 @@ public class Bootstrap { /** * Sets a dynamic classpath up and returns a Class reference loaded from it. - * + * * @param includeUpdates + * @param firstPhase true, if this is the first phase before the updater is executed * @return ClassLoader object * @throws Exception * if an unexpected error occurs */ - ClassLoader createClassloader(boolean includeUpdates) throws Exception { + ClassLoader createClassloader(boolean includeUpdates, boolean firstPhase) throws Exception { final List jarFiles = new LinkedList(); if (includeUpdates) { // load jar.properties @@ -105,6 +106,12 @@ public class Bootstrap { final String filename = st.nextToken(); if (SignatureVerifier.get().checkSignature(jarFolder + filename, bootProp.getProperty("file-signature." + filename))) { jarFiles.add(new File(jarFolder + filename).toURI().toURL()); + } else { + if (firstPhase) { + // if the signature of one file is not valid, ignore all files and do a fresh download + ClassLoader loader = new URLClassLoader(new URL[0], this.getClass().getClassLoader()); + return loader; + } } } System.out.println("our classpath: " + jarNameString); @@ -162,7 +169,7 @@ public class Bootstrap { private void handleUpdate() { // invoke update handling first try { - final ClassLoader classLoader = createClassloader(true); + final ClassLoader classLoader = createClassloader(true, true); // is this the initial download (or do we already have the // program downloaded)? boolean initialDownload = false; @@ -214,7 +221,7 @@ public class Bootstrap { // .jar-files may have been added try { - final ClassLoader classLoader = createClassloader(true); + final ClassLoader classLoader = createClassloader(true, false); final Class< ? > clazz = classLoader.loadClass(className); final Method method = clazz.getMethod("main", args.getClass()); method.invoke(null, (Object) args); @@ -292,7 +299,7 @@ public class Bootstrap { // self build client, do not try to update it System.err.println("Self build client, starting without update .jar-files"); try { - final ClassLoader classLoader = createClassloader(false); + final ClassLoader classLoader = createClassloader(false, false); final Class< ? > clazz = classLoader.loadClass(className); final Method method = clazz.getMethod("main", args.getClass()); method.invoke(null, (Object) args); @@ -327,7 +334,7 @@ public class Bootstrap { } else if (e instanceof LinkageError || e instanceof SecurityException || e instanceof ClassNotFoundException) { final int res = JOptionPane.showConfirmDialog( null, - new SelectableLabel(message + new SelectableLabel(message + " Sorry an error occurred because of an inconsistent update state.\r\nDelete update files so that they are downloaded again after you restart " + ClientGameConfiguration.get("GAME_NAME") +"?"), ClientGameConfiguration.get("GAME_NAME"), JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); From e2436944c89024fc2e58d7387b4970618c1a525f Mon Sep 17 00:00:00 2001 From: Hendrik Brummermann Date: Wed, 13 Jul 2011 18:35:23 +0000 Subject: [PATCH 13/18] don't add entries to the start of the classpath if they are already there. --- src/games/stendhal/client/update/UpdateManager.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/games/stendhal/client/update/UpdateManager.java b/src/games/stendhal/client/update/UpdateManager.java index ffc2e57f22..afcb0b2d63 100644 --- a/src/games/stendhal/client/update/UpdateManager.java +++ b/src/games/stendhal/client/update/UpdateManager.java @@ -394,8 +394,9 @@ public class UpdateManager { sb.append(file + ","); } - sb.append(bootProp.getProperty("load-0.95", "")); - - bootProp.put("load-0.95", sb.toString()); + if (!bootProp.getProperty("load-0.95", "").startsWith(sb.toString())) { + sb.append(bootProp.getProperty("load-0.95", "")); + bootProp.put("load-0.95", sb.toString()); + } } } From 4b1f34ef408adc45939e6f926f6f154de7be6f02 Mon Sep 17 00:00:00 2001 From: Hendrik Brummermann Date: Wed, 13 Jul 2011 19:50:06 +0000 Subject: [PATCH 14/18] fixed compiler warning, added license template --- .../stendhal/client/update/Bootstrap.java | 18 ++++++++++---- .../update/ClientGameConfiguration.java | 11 +++++++++ .../stendhal/client/update/ClientRunner.java | 23 +++++++++--------- .../stendhal/client/update/HttpClient.java | 11 +++++++++ .../client/update/SelectableLabel.java | 24 +++++++++++++++---- .../client/update/SignatureVerifier.java | 1 - src/games/stendhal/client/update/Starter.java | 12 ++++++++++ .../client/update/UpdateGUIDialogs.java | 11 +++++++++ .../stendhal/client/update/UpdateManager.java | 1 - .../client/update/UpdateProgressBar.java | 3 +-- .../UpdateProgressBarHyperLinkListener.java | 11 ++++----- .../UpdateProgressBarMetaRefreshSupport.java | 3 +-- .../UpdateProgressBarWindowListener.java | 23 +++++++++--------- .../stendhal/client/update/VersionState.java | 11 +++++++++ .../stendhal/client/update/package-info.java | 11 +++++++++ .../client/update/HttpClientTest.java | 6 ++--- 16 files changed, 132 insertions(+), 48 deletions(-) diff --git a/src/games/stendhal/client/update/Bootstrap.java b/src/games/stendhal/client/update/Bootstrap.java index 57aac9aa4c..f610ba62c8 100644 --- a/src/games/stendhal/client/update/Bootstrap.java +++ b/src/games/stendhal/client/update/Bootstrap.java @@ -1,3 +1,14 @@ +/*************************************************************************** + * (C) Copyright 2003-2011 - Stendhal * + *************************************************************************** + *************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ package games.stendhal.client.update; import static java.io.File.separator; @@ -81,7 +92,7 @@ public class Bootstrap { /** * Sets a dynamic classpath up and returns a Class reference loaded from it. * - * @param includeUpdates + * @param includeUpdates should updates from jar.properties be included * @param firstPhase true, if this is the first phase before the updater is executed * @return ClassLoader object * @throws Exception @@ -315,9 +326,8 @@ public class Bootstrap { /** * Handles exceptions during program invocation. * - * @param message - * @param t - * exception + * @param message error message + * @param t exception */ void unexpectedErrorHandling(String message, final Throwable t) { // unwrap chained exceptions diff --git a/src/games/stendhal/client/update/ClientGameConfiguration.java b/src/games/stendhal/client/update/ClientGameConfiguration.java index 981f07a2cc..68da55826b 100644 --- a/src/games/stendhal/client/update/ClientGameConfiguration.java +++ b/src/games/stendhal/client/update/ClientGameConfiguration.java @@ -1,3 +1,14 @@ +/*************************************************************************** + * (C) Copyright 2003-2011 - Stendhal * + *************************************************************************** + *************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ package games.stendhal.client.update; import java.io.FileNotFoundException; diff --git a/src/games/stendhal/client/update/ClientRunner.java b/src/games/stendhal/client/update/ClientRunner.java index 6006735c48..c48c8da590 100644 --- a/src/games/stendhal/client/update/ClientRunner.java +++ b/src/games/stendhal/client/update/ClientRunner.java @@ -1,15 +1,14 @@ -//***************************************************************************** -//***************************************************************************** -// -// Important note -// -// Please note that this file is compiled using Java 1.2 in the build-script -// in order to display a dialogbox to the user in case an old version of java -// is used. As we compile it with Java 1.2 no new features may be used in this -// class. -// -//***************************************************************************** -//***************************************************************************** +/*************************************************************************** + * (C) Copyright 2003-2011 - Stendhal * + *************************************************************************** + *************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ package games.stendhal.client.update; import java.lang.reflect.Method; diff --git a/src/games/stendhal/client/update/HttpClient.java b/src/games/stendhal/client/update/HttpClient.java index 320957c94a..a672e163e5 100644 --- a/src/games/stendhal/client/update/HttpClient.java +++ b/src/games/stendhal/client/update/HttpClient.java @@ -1,3 +1,14 @@ +/*************************************************************************** + * (C) Copyright 2003-2011 - Stendhal * + *************************************************************************** + *************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ package games.stendhal.client.update; import java.io.BufferedOutputStream; diff --git a/src/games/stendhal/client/update/SelectableLabel.java b/src/games/stendhal/client/update/SelectableLabel.java index 2696c33896..dc5d88ad13 100644 --- a/src/games/stendhal/client/update/SelectableLabel.java +++ b/src/games/stendhal/client/update/SelectableLabel.java @@ -1,3 +1,14 @@ +/*************************************************************************** + * (C) Copyright 2003-2011 - Stendhal * + *************************************************************************** + *************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ package games.stendhal.client.update; import javax.swing.JLabel; @@ -11,16 +22,19 @@ import javax.swing.JTextArea; class SelectableLabel extends JTextArea { private static final long serialVersionUID = -834949100383673798L; + /** + * creates a new SelectableLabel + * + * @param text text to display + */ SelectableLabel(String text) { super(text); setEditable(false); setBorder(null); setOpaque(false); - /* - * Get the font directly from JLabel, in case the user is - * using a theme where it does not come from an UIManager - * property. - */ + // Get the font directly from JLabel, in case the user is + // using a theme where it does not come from an UIManager + // property. JLabel tmp = new JLabel(); setFont(tmp.getFont()); } diff --git a/src/games/stendhal/client/update/SignatureVerifier.java b/src/games/stendhal/client/update/SignatureVerifier.java index c499c37936..a5b24123a5 100644 --- a/src/games/stendhal/client/update/SignatureVerifier.java +++ b/src/games/stendhal/client/update/SignatureVerifier.java @@ -1,4 +1,3 @@ -/* $Id$ */ /*************************************************************************** * (C) Copyright 2011 - Faiumoni e. V. * *************************************************************************** diff --git a/src/games/stendhal/client/update/Starter.java b/src/games/stendhal/client/update/Starter.java index 5f386368a8..2c8f300cd7 100644 --- a/src/games/stendhal/client/update/Starter.java +++ b/src/games/stendhal/client/update/Starter.java @@ -10,6 +10,18 @@ // //***************************************************************************** //***************************************************************************** + +/*************************************************************************** + * (C) Copyright 2003-2011 - Stendhal * + *************************************************************************** + *************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ package games.stendhal.client.update; import javax.swing.JOptionPane; diff --git a/src/games/stendhal/client/update/UpdateGUIDialogs.java b/src/games/stendhal/client/update/UpdateGUIDialogs.java index dba5cb4fe8..c3dac510db 100644 --- a/src/games/stendhal/client/update/UpdateGUIDialogs.java +++ b/src/games/stendhal/client/update/UpdateGUIDialogs.java @@ -1,3 +1,14 @@ +/*************************************************************************** + * (C) Copyright 2003-2011 - Stendhal * + *************************************************************************** + *************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ package games.stendhal.client.update; import java.text.NumberFormat; diff --git a/src/games/stendhal/client/update/UpdateManager.java b/src/games/stendhal/client/update/UpdateManager.java index afcb0b2d63..e9580ed086 100644 --- a/src/games/stendhal/client/update/UpdateManager.java +++ b/src/games/stendhal/client/update/UpdateManager.java @@ -1,4 +1,3 @@ -/* $Id$ */ /*************************************************************************** * (C) Copyright 2003-2011 - Stendhal * *************************************************************************** diff --git a/src/games/stendhal/client/update/UpdateProgressBar.java b/src/games/stendhal/client/update/UpdateProgressBar.java index 2e91a7f8b1..4abccb458a 100644 --- a/src/games/stendhal/client/update/UpdateProgressBar.java +++ b/src/games/stendhal/client/update/UpdateProgressBar.java @@ -1,6 +1,5 @@ -/* $Id$ */ /*************************************************************************** - * (C) Copyright 2003-2010 - Stendhal * + * (C) Copyright 2003-2011 - Stendhal * *************************************************************************** *************************************************************************** * * diff --git a/src/games/stendhal/client/update/UpdateProgressBarHyperLinkListener.java b/src/games/stendhal/client/update/UpdateProgressBarHyperLinkListener.java index 419c02f639..1dc0031a2c 100644 --- a/src/games/stendhal/client/update/UpdateProgressBarHyperLinkListener.java +++ b/src/games/stendhal/client/update/UpdateProgressBarHyperLinkListener.java @@ -1,6 +1,5 @@ -/* $Id$ */ /*************************************************************************** - * (C) Copyright 2003-2010 - Stendhal * + * (C) Copyright 2003-2011 - Stendhal * *************************************************************************** *************************************************************************** * * @@ -43,10 +42,10 @@ public class UpdateProgressBarHyperLinkListener implements HyperlinkListener { } } - static final String[] browsers = { "google-chrome", "chromium-browser", "firefox", "opera", + private static final String[] BROWSER = { "google-chrome", "chromium-browser", "firefox", "opera", "konqueror", "epiphany", "seamonkey", "galeon", "kazehakase", "mozilla" }; - static final String errMsg = "Error attempting to launch web browser:\n "; + private static final String ERROR_MESSAGE = "Error attempting to launch web browser:\n "; /** * Opens the specified web page in the user's default browser @@ -76,7 +75,7 @@ public class UpdateProgressBarHyperLinkListener implements HyperlinkListener { "rundll32 url.dll,FileProtocolHandler " + url); else { // assume Unix or Linux boolean found = false; - for (String browser : browsers) + for (String browser : BROWSER) if (!found) { found = Runtime.getRuntime().exec( new String[] { "which", browser }) @@ -87,7 +86,7 @@ public class UpdateProgressBarHyperLinkListener implements HyperlinkListener { } } } catch (Exception e) { - System.err.println(errMsg + url); + System.err.println(ERROR_MESSAGE + url); System.err.println(e); } } diff --git a/src/games/stendhal/client/update/UpdateProgressBarMetaRefreshSupport.java b/src/games/stendhal/client/update/UpdateProgressBarMetaRefreshSupport.java index 1c0523abb3..6324322bff 100644 --- a/src/games/stendhal/client/update/UpdateProgressBarMetaRefreshSupport.java +++ b/src/games/stendhal/client/update/UpdateProgressBarMetaRefreshSupport.java @@ -1,6 +1,5 @@ -/* $Id$ */ /*************************************************************************** - * (C) Copyright 2003-2010 - Stendhal * + * (C) Copyright 2003-2011 - Stendhal * *************************************************************************** *************************************************************************** * * diff --git a/src/games/stendhal/client/update/UpdateProgressBarWindowListener.java b/src/games/stendhal/client/update/UpdateProgressBarWindowListener.java index 8843698197..f54f836ce8 100644 --- a/src/games/stendhal/client/update/UpdateProgressBarWindowListener.java +++ b/src/games/stendhal/client/update/UpdateProgressBarWindowListener.java @@ -1,15 +1,14 @@ - /* $Id$ */ - /*************************************************************************** - * (C) Copyright 2003-2010 - Stendhal * - *************************************************************************** - *************************************************************************** - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - ***************************************************************************/ +/*************************************************************************** + * (C) Copyright 2003-2011 - Stendhal * + *************************************************************************** + *************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ package games.stendhal.client.update; import java.awt.event.WindowEvent; diff --git a/src/games/stendhal/client/update/VersionState.java b/src/games/stendhal/client/update/VersionState.java index 70e16aa25f..70994583fa 100644 --- a/src/games/stendhal/client/update/VersionState.java +++ b/src/games/stendhal/client/update/VersionState.java @@ -1,3 +1,14 @@ +/*************************************************************************** + * (C) Copyright 2003-2011 - Stendhal * + *************************************************************************** + *************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ package games.stendhal.client.update; /** diff --git a/src/games/stendhal/client/update/package-info.java b/src/games/stendhal/client/update/package-info.java index 888c0742e9..09e109a8b5 100644 --- a/src/games/stendhal/client/update/package-info.java +++ b/src/games/stendhal/client/update/package-info.java @@ -8,3 +8,14 @@ */ package games.stendhal.client.update; +/*************************************************************************** + * (C) Copyright 2003-2011 - Stendhal * + *************************************************************************** + *************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ diff --git a/tests/games/stendhal/client/update/HttpClientTest.java b/tests/games/stendhal/client/update/HttpClientTest.java index b8c8c85bee..ccb276cb6b 100644 --- a/tests/games/stendhal/client/update/HttpClientTest.java +++ b/tests/games/stendhal/client/update/HttpClientTest.java @@ -1,6 +1,5 @@ -/* $Id$ */ /*************************************************************************** - * (C) Copyright 2003-2010 - Stendhal * + * (C) Copyright 2003-2011 - Stendhal * *************************************************************************** *************************************************************************** * * @@ -71,7 +70,8 @@ public class HttpClientTest { /** * Tests for fetchFile - * @throws IOException + * + * @throws IOException in case of an input/output error */ @Test public void testFetchFile() throws IOException { From a3610ac841982a06ad8b515d0847100773a2448f Mon Sep 17 00:00:00 2001 From: Hendrik Brummermann Date: Thu, 14 Jul 2011 13:17:58 +0000 Subject: [PATCH 15/18] backported fix by kymara to re-word the world changes --- doc/CHANGES.txt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/doc/CHANGES.txt b/doc/CHANGES.txt index 0135d838e9..c90b2816ec 100644 --- a/doc/CHANGES.txt +++ b/doc/CHANGES.txt @@ -22,9 +22,10 @@ read http://stendhalgame.org/wiki/Automatic_Software_Updater when the full client had twice the size of the soundless client. *world* -- John and his wife Jane on Athor island need some help for saving their vacation -- Harold pays your earnings instantly on start of dialogue -- Andy who walks around on Ados cementary, could need some help by players +- John and Jane on Athor island have a disrupted holiday +- Andy, at Ados cemetery, seeks revenge +- Harold pays owed earnings instantly on start of dialogue + *fixes* From bed8a38452232d6295742f684f03340ce79fb118 Mon Sep 17 00:00:00 2001 From: Hendrik Brummermann Date: Thu, 14 Jul 2011 13:19:01 +0000 Subject: [PATCH 16/18] backported quest improvements by kymara --- .../maps/quests/CleanAthorsUnderground.java | 14 +++--- .../server/maps/quests/KillMonks.java | 50 ++++++++++++++----- 2 files changed, 44 insertions(+), 20 deletions(-) diff --git a/src/games/stendhal/server/maps/quests/CleanAthorsUnderground.java b/src/games/stendhal/server/maps/quests/CleanAthorsUnderground.java index 7765e3f8e8..f1ffba40d9 100644 --- a/src/games/stendhal/server/maps/quests/CleanAthorsUnderground.java +++ b/src/games/stendhal/server/maps/quests/CleanAthorsUnderground.java @@ -88,7 +88,7 @@ public class CleanAthorsUnderground extends AbstractQuest { ConversationPhrases.QUEST_MESSAGES, new QuestNotStartedCondition(QUEST_SLOT), ConversationStates.QUEST_OFFERED, - "My wife Jane and me are on vacation here on Athor island. #Unfortunately we can't explore the whole island cause some ugly #creatures step in our way each time. Can you help us by killing some of them to turn our vacation into a good one?", + "My wife Jane and me are on vacation here on Athor island. #Unfortunately we can't explore the whole island because some ugly #creatures step in our way each time. Can you help us by killing some of them to turn our vacation into a good one?", null); npc.add( @@ -96,7 +96,7 @@ public class CleanAthorsUnderground extends AbstractQuest { Arrays.asList("Unfortunately"), null, ConversationStates.QUEST_OFFERED, - "Yes, unfortunately. We wanted to have a great time here but all we did so far was sunbathing at the beach.", + "Yes, unfortunately. We wanted to have a great time here but all we did so far was sunbathe at the beach.", null); npc.add( @@ -154,7 +154,7 @@ public class CleanAthorsUnderground extends AbstractQuest { ConversationPhrases.NO_MESSAGES, null, ConversationStates.ATTENDING, - "Oh nevermind. We'll go on sunbathing then. Not that we aren't tired of it...", + "Oh never mind. We'll go on sunbathing then. Not that we aren't tired of it...", new SetQuestAction(QUEST_SLOT, "rejected")); } @@ -184,7 +184,7 @@ public class CleanAthorsUnderground extends AbstractQuest { new QuestInStateCondition(QUEST_SLOT, 0, "start"), new KilledForQuestCondition(QUEST_SLOT, 1)), ConversationStates.ATTENDING, - "Brilliant! You killed some of these ugly creatures as I see! Hopefully they'll not return that fast or we will still not have the chance to explore some places." + "Please take these greater potions as a reward for your help.", + "Brilliant! You killed some of these ugly creatures as I see! Hopefully they'll not return that fast or we will still not have the chance to explore some places." + " Please take these greater potions as a reward for your help.", new MultipleActions(actions)); npc.add(ConversationStates.ATTENDING, @@ -202,7 +202,7 @@ public class CleanAthorsUnderground extends AbstractQuest { super.addToWorld(); fillQuestInfo( "Clean Athors underground", - "John and his wife Jane want to explore Athor underground on their vacation but unfortunetely they can't.", + "John and his wife Jane want to explore Athor underground on their vacation but unfortunately they can't.", false); step_1(); step_2(); @@ -216,9 +216,9 @@ public class CleanAthorsUnderground extends AbstractQuest { return res; } if (!isCompleted(player)) { - res.add("I must kill one of each creature of the Athor underground for helping John and Jane having a nice vacation!"); + res.add("I must kill one of each creature of the Athor underground to help John and Jane have a nice vacation!"); } else if(isRepeatable(player)){ - res.add("It's a long time ago that I visited John and Jane on Athor island. Maybe he needs my help again now."); + res.add("It's a long time ago that I visited John and Jane on Athor island. Maybe they need my help again now."); } else { res.add("I've killed some creatures and John and Jane can finally enjoy their vacation! They will not need my help again during the next days."); } diff --git a/src/games/stendhal/server/maps/quests/KillMonks.java b/src/games/stendhal/server/maps/quests/KillMonks.java index 250f5507d2..d7c5c947a5 100644 --- a/src/games/stendhal/server/maps/quests/KillMonks.java +++ b/src/games/stendhal/server/maps/quests/KillMonks.java @@ -13,12 +13,18 @@ package games.stendhal.server.maps.quests; import games.stendhal.common.MathHelper; +import games.stendhal.common.Rand; +import games.stendhal.common.grammar.Grammar; +import games.stendhal.common.parser.Sentence; +import games.stendhal.server.core.engine.SingletonRepository; +import games.stendhal.server.entity.item.StackableItem; import games.stendhal.server.entity.npc.ChatAction; import games.stendhal.server.entity.npc.ConversationPhrases; import games.stendhal.server.entity.npc.ConversationStates; +import games.stendhal.server.entity.npc.EventRaiser; import games.stendhal.server.entity.npc.SpeakerNPC; -import games.stendhal.server.entity.npc.action.EquipItemAction; import games.stendhal.server.entity.npc.action.IncreaseXPAction; +import games.stendhal.server.entity.npc.action.IncrementQuestAction; import games.stendhal.server.entity.npc.action.MultipleActions; import games.stendhal.server.entity.npc.action.SayTimeRemainingAction; import games.stendhal.server.entity.npc.action.SetQuestAction; @@ -56,7 +62,7 @@ import marauroa.common.Pair; * * REWARD:

    *
  • 15000 XP - *
  • 5 soup + *
  • 1-5 soup *
  • some karma *
* @@ -96,7 +102,7 @@ public class KillMonks extends AbstractQuest { ConversationPhrases.QUEST_MESSAGES, new QuestNotStartedCondition(QUEST_SLOT), ConversationStates.QUEST_OFFERED, - "My lovely wife died when she went to Wofol for ordering some freshmade pizza by Kroip. Some monks stepped into her way and she had no chance. Now I want revenge! May you help me?", + "My lovely wife was killed when she went to Wo'fol to order some freshmade pizza by Kroip. Some monks stepped into her way and she had no chance. Now I want revenge! May you help me?", null); npc.add(ConversationStates.ATTENDING, @@ -116,7 +122,7 @@ public class KillMonks extends AbstractQuest { final List actions = new LinkedList(); - actions.add(new SetQuestAction(QUEST_SLOT, "start")); + actions.add(new SetQuestAction(QUEST_SLOT, 0, "start")); actions.add(new StartRecordingKillsAction(QUEST_SLOT, 1, creaturestokill)); @@ -124,7 +130,7 @@ public class KillMonks extends AbstractQuest { ConversationPhrases.YES_MESSAGES, null, ConversationStates.ATTENDING, - "Thank you! Also in the name of my beloved wife! Please kill 25 monks and 25 darkmonks.", + "Thank you! Please kill 25 monks and 25 darkmonks in the name of my beloved wife.", new MultipleActions(actions)); npc.add(ConversationStates.QUEST_OFFERED, @@ -132,7 +138,7 @@ public class KillMonks extends AbstractQuest { null, ConversationStates.ATTENDING, "That is a pity... Maybe you'll change your mind soon and help a sad man then.", - new SetQuestAction(QUEST_SLOT, "rejected")); + new SetQuestAction(QUEST_SLOT, 0, "rejected")); } private void step_2() { @@ -142,13 +148,26 @@ public class KillMonks extends AbstractQuest { private void step_3() { final SpeakerNPC npc = npcs.get("Andy"); - + + ChatAction addRandomNumberOfItemsAction = new ChatAction() { + public void fire(final Player player, final Sentence sentence, final EventRaiser npc) { + //add random number of soups + final StackableItem soup = (StackableItem) SingletonRepository.getEntityManager() + .getItem("soup"); + int amount; + // between 1 and 5 soup + amount = Rand.rand(4) + 1; + soup.setQuantity(amount); + player.equipOrPutOnGround(soup); + } + }; final List actions = new LinkedList(); - actions.add(new EquipItemAction("soup", 5)); + actions.add(addRandomNumberOfItemsAction); actions.add(new IncreaseXPAction(15000)); - actions.add(new SetQuestAction(QUEST_SLOT, "killed;1")); + actions.add(new SetQuestAction(QUEST_SLOT, 0, "killed")); actions.add(new SetQuestToTimeStampAction(QUEST_SLOT, 1)); + actions.add(new IncrementQuestAction(QUEST_SLOT,2,1)); LinkedList triggers = new LinkedList(); triggers.addAll(ConversationPhrases.FINISH_MESSAGES); @@ -159,7 +178,7 @@ public class KillMonks extends AbstractQuest { new QuestInStateCondition(QUEST_SLOT, 0, "start"), new KilledForQuestCondition(QUEST_SLOT, 1)), ConversationStates.ATTENDING, - "Thank you so much! Now I can sleep a bit better.", + "Thank you so much! Now I can sleep a bit better. Please take some soup.", new MultipleActions(actions)); npc.add(ConversationStates.ATTENDING, @@ -177,7 +196,7 @@ public class KillMonks extends AbstractQuest { super.addToWorld(); fillQuestInfo( "Kill Monks", - "Andy lost his wife by monks, now he wants revenge on them.", + "Andy's wife was killed by monks, now he wants revenge on them.", false); step_1(); step_2(); @@ -191,12 +210,17 @@ public class KillMonks extends AbstractQuest { return res; } if (!isCompleted(player)) { - res.add("I must kill 25 monks and 25 darkmonks to help Andy reaching his goal of taking revenge."); + res.add("I must kill 25 monks and 25 darkmonks to get revenge for Andy's wife."); } else if(isRepeatable(player)){ - res.add("Now, after more than two weeks, I should take a look after Andy again. Maybe he needs my help!"); + res.add("Now, after more than two weeks, I should check on Andy again. Maybe he needs my help!"); } else { res.add("I've killed some monks and Andy finally can sleep a bit better!"); } + int repetitions = player.getNumberOfRepetitions(getSlotName(), 2); + if (repetitions > 0) { + res.add("I have taken revenge for Andy " + + Grammar.quantityplnoun(repetitions, "time") + " now."); + } return res; } From f59d828108ed01fa3b2fceaee67d78cd7f0270a1 Mon Sep 17 00:00:00 2001 From: Hendrik Brummermann Date: Thu, 14 Jul 2011 13:19:51 +0000 Subject: [PATCH 17/18] remove broken .jar files from load-parameter in jar.properties --- src/games/stendhal/client/update/Bootstrap.java | 5 +++-- .../stendhal/client/update/UpdateManager.java | 17 +++++++++-------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/games/stendhal/client/update/Bootstrap.java b/src/games/stendhal/client/update/Bootstrap.java index f610ba62c8..021594ff2a 100644 --- a/src/games/stendhal/client/update/Bootstrap.java +++ b/src/games/stendhal/client/update/Bootstrap.java @@ -120,6 +120,7 @@ public class Bootstrap { } else { if (firstPhase) { // if the signature of one file is not valid, ignore all files and do a fresh download + clearUpdateFiles(); ClassLoader loader = new URLClassLoader(new URL[0], this.getClass().getClassLoader()); return loader; } @@ -202,8 +203,8 @@ public class Bootstrap { // start update handling final Class< ? > clazz = classLoader.loadClass("games.stendhal.client.update.UpdateManager"); - final Method method = clazz.getMethod("process", String.class, Properties.class, Boolean.class); - method.invoke(clazz.newInstance(), jarFolder, bootProp, initialDownload); + final Method method = clazz.getMethod("process", String.class, Properties.class, Boolean.class, ClassLoader.class); + method.invoke(clazz.newInstance(), jarFolder, bootProp, initialDownload, classLoader); } catch (final SecurityException e) { throw e; } catch (final Exception e) { diff --git a/src/games/stendhal/client/update/UpdateManager.java b/src/games/stendhal/client/update/UpdateManager.java index e9580ed086..91a0b0806d 100644 --- a/src/games/stendhal/client/update/UpdateManager.java +++ b/src/games/stendhal/client/update/UpdateManager.java @@ -31,6 +31,7 @@ public class UpdateManager { private Properties bootProp; private String serverFolder; private Properties updateProp; + private ClassLoader classLoader; private UpdateProgressBar updateProgressBar; private String fromVersion; private String toVersion; @@ -59,14 +60,12 @@ public class UpdateManager { /** * Processes the update. * - * @param jarFolder - * folder where the .jar files are stored - * @param bootProp - * boot properties - * @param initialDownload - * true, if only the small starter.jar is available + * @param jarFolder folder where the .jar files are stored + * @param bootProp boot properties + * @param initialDownload true, if only the small starter.jar is available + * @param classLoader with update files */ - public void process(final String jarFolder, final Properties bootProp, final Boolean initialDownload) { + public void process(final String jarFolder, final Properties bootProp, final Boolean initialDownload, ClassLoader classLoader) { if (!Boolean.parseBoolean(ClientGameConfiguration.get("UPDATE_ENABLE_AUTO_UPDATE"))) { System.out.println("Automatic Update disabled"); @@ -74,6 +73,7 @@ public class UpdateManager { } this.jarFolder = jarFolder; this.bootProp = bootProp; + this.classLoader = classLoader; init(initialDownload.booleanValue()); if (updateProp == null) { if (initialDownload.booleanValue()) { @@ -98,6 +98,7 @@ public class UpdateManager { versionState = VersionState.INITIAL_DOWNLOAD; } + System.out.println("Update state: " + versionState + " initialDownload: " + initialDownload + " fromVersion: " + fromVersion); switch (versionState) { case CURRENT: System.out.println("Current Version"); @@ -157,7 +158,7 @@ public class UpdateManager { */ private String getVersion() { try { - Class clazz = Class.forName("games.stendhal.common.Version"); + Class clazz = classLoader.loadClass("games.stendhal.common.Version"); return (String) clazz.getField("VERSION").get(null); } catch (ClassNotFoundException e) { // ignore From c0d45674b536eb46743e0b48e1bd9d021e018f67 Mon Sep 17 00:00:00 2001 From: Hendrik Brummermann Date: Fri, 29 Jul 2011 23:53:50 +0000 Subject: [PATCH 18/18] fixed missing storage of signature for download from prefered location (fixes #3382547) --- src/games/stendhal/client/update/UpdateManager.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/games/stendhal/client/update/UpdateManager.java b/src/games/stendhal/client/update/UpdateManager.java index 91a0b0806d..3db72cb0b5 100644 --- a/src/games/stendhal/client/update/UpdateManager.java +++ b/src/games/stendhal/client/update/UpdateManager.java @@ -372,6 +372,7 @@ public class UpdateManager { System.out.println("signature verification failed"); return false; } + bootProp.put("file-signature." + file, updateProp.getProperty("file-signature." + file)); } catch (final NumberFormatException e) { e.printStackTrace(System.err); return false;