diff --git a/build.ant.properties b/build.ant.properties index a13135aa8d..a4b246dac1 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.85 -version = 0.85.5 +version = 0.86 # javac options javac.deprecation = true diff --git a/build.xml b/build.xml index f486ad65bf..02ca648a62 100644 --- a/build.xml +++ b/build.xml @@ -503,11 +503,6 @@ - - - - - diff --git a/data/conf/achievements/achievements.xml b/data/conf/achievements/achievements.xml deleted file mode 100644 index 5b00cf741f..0000000000 --- a/data/conf/achievements/achievements.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/data/conf/items/cloaks.xml b/data/conf/items/cloaks.xml index e89686fb39..48de0261b9 100644 --- a/data/conf/items/cloaks.xml +++ b/data/conf/items/cloaks.xml @@ -317,17 +317,4 @@ - - - You see a rift cloak. Almost useless in the battle, but saves your life when you enter a magical rift. - - - - - - - - - - \ No newline at end of file diff --git a/data/conf/items/documents.xml b/data/conf/items/documents.xml index 4f32d59ac9..96f5eeb26b 100644 --- a/data/conf/items/documents.xml +++ b/data/conf/items/documents.xml @@ -108,35 +108,4 @@ - - - You see a rolled up scroll. - - - - - - - - - - - - - - - - You see a scroll, circled by ice crystals. You can feel its cold aura. - - - - - - - - - - - - \ No newline at end of file diff --git a/data/conf/zones/semos.xml b/data/conf/zones/semos.xml index 39cad9d728..478d8451dd 100644 --- a/data/conf/zones/semos.xml +++ b/data/conf/zones/semos.xml @@ -38,11 +38,11 @@ - water-3 + water-2 1 1 11 - 80 + 40 @@ -221,6 +221,14 @@ + + + come_to_rest + 13 + 100 + + + mystical_aura @@ -229,14 +237,6 @@ - - - come_to_rest - 13 - 100 - - - woodpecker-1 @@ -251,6 +251,14 @@ + + + + the_magical_tower + 120 + + + @@ -263,6 +271,14 @@ + + + + the_magical_tower + 120 + + + true @@ -270,6 +286,22 @@ + + + 3 + 2 + You step onto a sparkling corner of the hexagram, this must be what Zekiel the guardian was talking about. + + + + + + 2 + 3 + This looks like a creature matching the theme of Malleus ... perhaps this is the one to select. + + + @@ -286,8 +318,8 @@ new QuestInStateCondition("zekiels_practical_test","first_step") - Zekiel the guardian: "You have chosen the correct one of Malleus. Now use the candle at the shimmering spot of the hexagram." - new MultipleActions([new IncreaseXPAction(100), new EquipItemAction("candle"), new SetQuestAction("zekiels_practical_test", "second_step")]) + Zekiel the guardian: 'You have chosen the correct one of Malleus. Now use the candle at the shimmering spot of the hexagram.' + new MultipleActions([new SendPrivateMessageAction("Zekiel the guardian: 'You have chosen the correct one of Malleus. Now use the candle at the shimmering spot of the hexagram.'"), new EquipItemAction("candle"), new SetQuestAction("zekiels_practical_test", "second_step")]) @@ -314,6 +346,14 @@ + + + + the_magical_tower + 120 + + + true @@ -345,8 +385,8 @@ new QuestInStateCondition("zekiels_practical_test","second_step") - Zekiel the guardian: "You have chosen the correct one of Jaer. Now use the candle at the next shimmering spot of the hexagram." - new MultipleActions([new IncreaseXPAction(100), new EquipItemAction("candle"), new SetQuestAction("zekiels_practical_test", "third_step")]) + Zekiel the guardian: 'You have chosen the correct one of Jaer. Now use the candle at the next shimmering spot of the hexagram.' + new MultipleActions([new SendPrivateMessageAction("Zekiel the guardian: 'You have chosen the correct one of Jaer. Now use the candle at the next shimmering spot of the hexagram.'"), new EquipItemAction("candle"), new SetQuestAction("zekiels_practical_test", "third_step")]) @@ -369,6 +409,14 @@ + + + + the_magical_tower + 120 + + + true @@ -404,8 +452,8 @@ new QuestInStateCondition("zekiels_practical_test","third_step") - Zekiel the guardian: "You have chosen the correct one of Ravashack. You have almost done the half of the test. Search the next shimmering spot of the hexagram." - new MultipleActions([new IncreaseXPAction(100), new EquipItemAction("candle"), new SetQuestAction("zekiels_practical_test", "fourth_step")]) + Zekiel the guardian: 'You have chosen the correct one of Ravashack. You have almost done the half of the test. Search the next shimmering spot of the hexagram.' + new MultipleActions([new SendPrivateMessageAction("Zekiel the guardian: 'You have chosen the correct one of Ravashack. You have almost done the half of the test. Search the next shimmering spot of the hexagram.'"), new EquipItemAction("candle"), new SetQuestAction("zekiels_practical_test", "fourth_step")]) @@ -424,6 +472,14 @@ + + + + the_magical_tower + 120 + + + true @@ -451,8 +507,8 @@ new QuestInStateCondition("zekiels_practical_test","fourth_step") - Zekiel the guardian: "You have chosen the correct one of Cassandra. One triangle is ready. Use the candle at shimmering spot of the other triangle." - new MultipleActions([new IncreaseXPAction(100), new EquipItemAction("candle"), new SetQuestAction("zekiels_practical_test", "fifth_step")]) + Zekiel the guardian: 'You have chosen the correct one of Cassandra. One triangle is ready. Use the candle at the shimmering spot of the other triangle.' + new MultipleActions([new SendPrivateMessageAction("Zekiel the guardian: 'You have chosen the correct one of Cassandra. One triangle is ready. Use the candle at the shimmering spot of the other triangle.'"), new EquipItemAction("candle"), new SetQuestAction("zekiels_practical_test", "fifth_step")]) @@ -479,6 +535,14 @@ + + + + the_magical_tower + 120 + + + true @@ -514,8 +578,8 @@ new QuestInStateCondition("zekiels_practical_test","fifth_step") - Zekiel the guardian: "You have chosen the correct one of Silvanus. The next shimmering spot awaits you and the last step of the test too." - new MultipleActions([new IncreaseXPAction(100), new EquipItemAction("candle"), new SetQuestAction("zekiels_practical_test", "sixth_step")]) + Zekiel the guardian: 'You have chosen the correct one of Silvanus. The next shimmering spot awaits you and the last step of the test too.' + new MultipleActions([new SendPrivateMessageAction("Zekiel the guardian: 'You have chosen the correct one of Silvanus. The next shimmering spot awaits you and the last step of the test too.'"), new EquipItemAction("candle"), new SetQuestAction("zekiels_practical_test", "sixth_step")]) @@ -534,6 +598,14 @@ + + + + the_magical_tower + 120 + + + true @@ -557,8 +629,8 @@ new QuestInStateCondition("zekiels_practical_test","sixth_step") - Zekiel the guardian: "You have chosen the correct one of Elana. Complete the hexagram and I will wait for you at the next stage. Please talk to me there to finish the quest." - new MultipleActions([new IncreaseXPAction(100), new EquipItemAction("candle"), new SetQuestAction("zekiels_practical_test", "last_step")]) + Zekiel the guardian: 'You have chosen the correct one of Elana. Complete the hexagram and I will wait for you at the next stage. Please talk to me there to finish the quest.' + new MultipleActions([new SendPrivateMessageAction("Zekiel the guardian: 'You have chosen the correct one of Elana. Complete the hexagram and I will wait for you at the next stage. Please talk to me there to finish the quest.'"), new EquipItemAction("candle"), new SetQuestAction("zekiels_practical_test", "last_step")]) @@ -588,6 +660,14 @@ + + + + the_magical_tower + 120 + + + @@ -604,6 +684,14 @@ + + + + mystical_aura + 120 + + + @@ -654,6 +742,14 @@ + + + + mystical_aura + 120 + + + diff --git a/libs/marauroa.jar b/libs/marauroa.jar index 6154185ed3..074d4d6bae 100644 Binary files a/libs/marauroa.jar and b/libs/marauroa.jar differ diff --git a/release.xml b/release.xml index 7bca09d992..57dbc3d75c 100644 --- a/release.xml +++ b/release.xml @@ -75,6 +75,14 @@ + + + + + + + + @@ -90,11 +98,6 @@ - - - - - diff --git a/runserver.bat b/runserver.bat index 601ec20b83..09766ada2c 100644 --- a/runserver.bat +++ b/runserver.bat @@ -1,3 +1,3 @@ -set STENDHAL_VERSION=0.85.5 +set STENDHAL_VERSION=0.86 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%" marauroa.server.marauroad -c server.ini -l diff --git a/runserver.sh b/runserver.sh index edd48e6ba8..927812616c 100644 --- a/runserver.sh +++ b/runserver.sh @@ -1,5 +1,5 @@ #!/bin/sh -STENDHAL_VERSION="0.85.5" +STENDHAL_VERSION="0.86" 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/client/StendhalClient.java b/src/games/stendhal/client/StendhalClient.java index 92ab0d0f3a..6cee94e55c 100644 --- a/src/games/stendhal/client/StendhalClient.java +++ b/src/games/stendhal/client/StendhalClient.java @@ -467,6 +467,15 @@ public class StendhalClient extends ClientFramework { */ idx = directions.indexOf(dir); if (idx != -1) { + /* + * Already highest priority? Don't send to server. + */ + + if (idx == (directions.size() - 1)) { + logger.debug("Ignoring same direction: " + dir); + return; + } + /* * Move to end */ diff --git a/src/games/stendhal/client/UserController.java b/src/games/stendhal/client/UserController.java index 0bc9090212..c5349811ff 100644 --- a/src/games/stendhal/client/UserController.java +++ b/src/games/stendhal/client/UserController.java @@ -2,6 +2,7 @@ package games.stendhal.client; import games.stendhal.client.gui.bag.BagPanelControler; import games.stendhal.client.gui.buddies.BuddyPanelControler; +import games.stendhal.client.gui.stats.KarmaIndicator; import games.stendhal.client.gui.stats.StatsPanelController; import java.beans.PropertyChangeListener; @@ -23,7 +24,8 @@ public class UserController implements ObjectChangeListener { pcs.addPropertyChangeListener("!buddy", BuddyPanelControler.get()); pcs.addPropertyChangeListener("buddies", BuddyPanelControler.getMapBasedBuddyPropertyChangeListener()); pcs.addPropertyChangeListener("bag", BagPanelControler.get()); - + pcs.addPropertyChangeListener("features", KarmaIndicator.get()); + StatsPanelController stats = StatsPanelController.get(); stats.registerListeners(pcs); } diff --git a/src/games/stendhal/client/gui/stats/KarmaIndicator.java b/src/games/stendhal/client/gui/stats/KarmaIndicator.java index b74945fa63..3cbc572ac5 100644 --- a/src/games/stendhal/client/gui/stats/KarmaIndicator.java +++ b/src/games/stendhal/client/gui/stats/KarmaIndicator.java @@ -1,7 +1,5 @@ package games.stendhal.client.gui.stats; -import games.stendhal.client.StendhalClient; -import games.stendhal.client.listener.FeatureChangeListener; import games.stendhal.client.sprite.Sprite; import games.stendhal.client.sprite.SpriteStore; @@ -9,6 +7,9 @@ import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; import java.awt.Insets; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import java.util.Map; import javax.swing.JComponent; import javax.swing.SwingUtilities; @@ -16,9 +17,11 @@ import javax.swing.SwingUtilities; /** * A bar indicator component for karma. */ -public class KarmaIndicator extends JComponent implements FeatureChangeListener { +public class KarmaIndicator extends JComponent implements PropertyChangeListener { private static final long serialVersionUID = 3462088641737184898L; + private static KarmaIndicator instance; + /** * Scaling factor for interpreting karma to bar length. Smaller means * smaller change in karma bar for a karma change. @@ -34,15 +37,24 @@ public class KarmaIndicator extends JComponent implements FeatureChangeListener * Create a new karma indicator. */ public KarmaIndicator() { + instance = this; setVisible(false); final SpriteStore store = SpriteStore.get(); image = store.getSprite(IMAGE_FILE_NAME); // We don't draw the background setOpaque(false); - StendhalClient.get().addFeatureChangeListener(this); } - + + /** + * gets the instance + * + * @return KarmaIndicator + */ + public static KarmaIndicator get() { + return instance; + } + /** * Set the karma value. * @@ -90,11 +102,15 @@ public class KarmaIndicator extends JComponent implements FeatureChangeListener image.draw(g, insets.left, insets.top); } - /** - * disables the karma indicator. - */ - public void featureDisabled(String name) { - if (name.equals("karma_indicator")) { + + public void propertyChange(PropertyChangeEvent evt) { + if (evt == null) { + return; + } + + // disable + Map oldMap = (Map) evt.getOldValue(); + if ((oldMap != null) && oldMap.containsKey("karma_indicator")) { // Feature changes are triggered from outside the EDT. SwingUtilities.invokeLater(new Runnable() { public void run() { @@ -102,13 +118,10 @@ public class KarmaIndicator extends JComponent implements FeatureChangeListener } }); } - } - /** - * enables the karma indicator. - */ - public void featureEnabled(String name, String value) { - if (name.equals("karma_indicator")) { + // enable + Map newMap = (Map) evt.getNewValue(); + if ((newMap != null) && newMap.containsKey("karma_indicator")) { // Feature changes are triggered from outside the EDT. SwingUtilities.invokeLater(new Runnable() { public void run() { diff --git a/src/games/stendhal/client/update/Version.java b/src/games/stendhal/client/update/Version.java index d3141ab25c..91188f8288 100644 --- a/src/games/stendhal/client/update/Version.java +++ b/src/games/stendhal/client/update/Version.java @@ -10,7 +10,7 @@ package games.stendhal.client.update; public class Version { /** Version Number. */ - public static final String VERSION = "0.85.5"; + public static final String VERSION = "0.86"; /** * Extract the specified number of parts from a version-string. diff --git a/src/games/stendhal/common/Debug.java b/src/games/stendhal/common/Debug.java index e41a211ae6..ca900aadc0 100644 --- a/src/games/stendhal/common/Debug.java +++ b/src/games/stendhal/common/Debug.java @@ -25,7 +25,7 @@ public interface Debug { /** server version. */ // Note: This line is updated by build.xml using a regexp so be sure to adjust it in case you modify this line. - String VERSION = "0.85.5"; + String VERSION = "0.86"; /** diff --git a/src/games/stendhal/server/core/engine/GenerateINI.java b/src/games/stendhal/server/core/engine/GenerateINI.java index 7e38c36801..4c39361bc3 100644 --- a/src/games/stendhal/server/core/engine/GenerateINI.java +++ b/src/games/stendhal/server/core/engine/GenerateINI.java @@ -234,7 +234,7 @@ public class GenerateINI { out.println(); out.println("server_typeGame=" + gameName); out.println("server_name=" + gameName + " Marauroa server"); - out.println("server_version=0.85.5"); + out.println("server_version=0.86"); 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/src/games/stendhal/server/core/engine/SingletonRepository.java b/src/games/stendhal/server/core/engine/SingletonRepository.java index 9f801ca29b..5eaf5f3d80 100644 --- a/src/games/stendhal/server/core/engine/SingletonRepository.java +++ b/src/games/stendhal/server/core/engine/SingletonRepository.java @@ -2,7 +2,6 @@ package games.stendhal.server.core.engine; import games.stendhal.server.core.events.LoginNotifier; import games.stendhal.server.core.events.TurnNotifier; -import games.stendhal.server.core.events.achievements.AchievementNotifier; import games.stendhal.server.core.rp.StendhalQuestSystem; import games.stendhal.server.core.rp.guilds.GuildList; import games.stendhal.server.core.rp.guilds.GuildPermissionList; @@ -147,13 +146,6 @@ public class SingletonRepository { return AthorFerry.get(); } - /** - * @return the AchievementNotifier instance - */ - public static AchievementNotifier getAchievementNotifier() { - return AchievementNotifier.get(); - } - /** * @return the actual EntityManager instance */ diff --git a/src/games/stendhal/server/core/engine/StendhalPlayerDatabase.java b/src/games/stendhal/server/core/engine/StendhalPlayerDatabase.java index f4acefeacf..966b98f199 100644 --- a/src/games/stendhal/server/core/engine/StendhalPlayerDatabase.java +++ b/src/games/stendhal/server/core/engine/StendhalPlayerDatabase.java @@ -1,6 +1,5 @@ package games.stendhal.server.core.engine; -import games.stendhal.server.core.engine.db.AchievementDAO; import games.stendhal.server.core.engine.db.CidDAO; import games.stendhal.server.core.engine.db.PostmanDAO; import games.stendhal.server.core.engine.db.StendhalBuddyDAO; @@ -59,6 +58,5 @@ public class StendhalPlayerDatabase { DAORegister.get().register(StendhalKillLogDAO.class, new StendhalKillLogDAO ()); DAORegister.get().register(StendhalNPCDAO.class, new StendhalNPCDAO()); DAORegister.get().register(StendhalWebsiteDAO.class, new StendhalWebsiteDAO()); - DAORegister.get().register(AchievementDAO.class, new AchievementDAO()); } } diff --git a/src/games/stendhal/server/core/engine/StendhalRPWorld.java b/src/games/stendhal/server/core/engine/StendhalRPWorld.java index 4557623aac..8cfdfc5471 100644 --- a/src/games/stendhal/server/core/engine/StendhalRPWorld.java +++ b/src/games/stendhal/server/core/engine/StendhalRPWorld.java @@ -141,7 +141,6 @@ public class StendhalRPWorld extends RPWorld { loader.load(); validatePortals(); - SingletonRepository.getAchievementNotifier().initialize(); SingletonRepository.getGagManager(); SingletonRepository.getJail(); } catch (final Exception e) { diff --git a/src/games/stendhal/server/core/engine/db/AchievementDAO.java b/src/games/stendhal/server/core/engine/db/AchievementDAO.java deleted file mode 100644 index 63f9ed9d9b..0000000000 --- a/src/games/stendhal/server/core/engine/db/AchievementDAO.java +++ /dev/null @@ -1,97 +0,0 @@ -package games.stendhal.server.core.engine.db; - -import games.stendhal.server.core.events.achievements.Category; - -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -import marauroa.server.db.DBTransaction; -/** - * DAO to handle achievements for the stendhal website - * @author madmetzger - * - */ -public class AchievementDAO { - - /** - * logs a reached achievement into the database - * - * @param achievementId - * @param playerName - * @param transaction - * @throws SQLException - */ - public void saveReachedAchievement(Integer achievementId, String playerName, DBTransaction transaction) throws SQLException { - String query = "INSERT INTO reached_achievement " + - "(charname, achievement_id) VALUES" + - "('[charname]','[achievement_id]');"; - Map parameters = new HashMap(); - parameters.put("charname", playerName); - parameters.put("achievement_id", achievementId); - transaction.execute(query, parameters); - } - - /** - * creates a new achievement - * - * @param identifier - * @param title - * @param category - * @param transaction - * @return - * @throws SQLException - */ - public int saveAchievement(String identifier, String title, Category category, DBTransaction transaction) throws SQLException { - int achievementId = 0; - String query = "INSERT INTO achievement " + - "(identifier, title, category) VALUES " + - "('[identifier]','[title]','[category]')"; - Map parameters = new HashMap(); - parameters.put("identifier", identifier); - parameters.put("title", title); - parameters.put("category", category.toString()); - transaction.execute(query, parameters); - achievementId = transaction.getLastInsertId("achievement", "id"); - return achievementId; - } - - /** - * loads a map from achievement identifier to database serial - * @param transaction - * @return map with key identifier string and value database id - * @throws SQLException - */ - public Map loadIdentifierIdPairs(DBTransaction transaction) throws SQLException { - Map map = new HashMap(); - String query = "SELECT identifier, id FROM achievement;"; - ResultSet set = transaction.query(query, new HashMap()); - while (set.next()) { - String identifier = set.getString("identifier"); - Integer id = set.getInt("id"); - map.put(identifier, id); - }; - return map; - } - - /** - * @param playerName - * @return set identifiers of achievements reached by playerName - * @throws SQLException - */ - public Set loadAllReachedAchievementsOfPlayer(String playerName, DBTransaction transaction) throws SQLException { - Map params = new HashMap(); - params.put("playername", playerName); - String query = "SELECT identifier FROM achievement a JOIN reached_achievement ra ON ra.achievement_id = a.id WHERE ra.charname = '[playername]';"; - ResultSet resultSet = transaction.query(query, params); - Set identifiers = new HashSet(); - while(resultSet.next()) { - identifiers.add(resultSet.getString(1)); - } - return identifiers; - } - -} diff --git a/src/games/stendhal/server/core/engine/dbcommand/ReadAchievementIdentifierToIdMap.java b/src/games/stendhal/server/core/engine/dbcommand/ReadAchievementIdentifierToIdMap.java deleted file mode 100644 index 658407783b..0000000000 --- a/src/games/stendhal/server/core/engine/dbcommand/ReadAchievementIdentifierToIdMap.java +++ /dev/null @@ -1,38 +0,0 @@ -package games.stendhal.server.core.engine.dbcommand; - -import games.stendhal.server.core.engine.db.AchievementDAO; - -import java.io.IOException; -import java.sql.SQLException; -import java.util.Map; - -import marauroa.server.db.DBTransaction; -import marauroa.server.db.command.AbstractDBCommand; -import marauroa.server.game.db.DAORegister; -/** - * reads all achievement identifiers and the corresponding ids from the database - * - * @author madmetzger - */ -public class ReadAchievementIdentifierToIdMap extends AbstractDBCommand { - - private Map identifierToIdMap; - - @Override - public void execute(DBTransaction transaction) throws SQLException, - IOException { - setIdentifierToIdMap(DAORegister.get().get(AchievementDAO.class).loadIdentifierIdPairs(transaction)); - } - - private void setIdentifierToIdMap(Map identifierToIdMap) { - this.identifierToIdMap = identifierToIdMap; - } - - /** - * @return map from identifier for achievement to its database id - */ - public Map getIdentifierToIdMap() { - return identifierToIdMap; - } - -} diff --git a/src/games/stendhal/server/core/engine/dbcommand/ReadAchievementsForPlayerCommand.java b/src/games/stendhal/server/core/engine/dbcommand/ReadAchievementsForPlayerCommand.java deleted file mode 100644 index ba9796b92e..0000000000 --- a/src/games/stendhal/server/core/engine/dbcommand/ReadAchievementsForPlayerCommand.java +++ /dev/null @@ -1,41 +0,0 @@ -package games.stendhal.server.core.engine.dbcommand; - -import games.stendhal.server.core.engine.db.AchievementDAO; -import games.stendhal.server.entity.player.Player; - -import java.io.IOException; -import java.sql.SQLException; -import java.util.HashSet; -import java.util.Set; - -import marauroa.server.db.DBTransaction; -import marauroa.server.db.command.AbstractDBCommand; -import marauroa.server.game.db.DAORegister; - -public class ReadAchievementsForPlayerCommand extends AbstractDBCommand { - - private Set identifiers = new HashSet(); - private final Player player; - - /** - * @param player the player whose achievements should be read - */ - public ReadAchievementsForPlayerCommand(Player player) { - this.player = player; - } - - @Override - public void execute(DBTransaction transaction) throws SQLException, - IOException { - identifiers = DAORegister.get().get(AchievementDAO.class).loadAllReachedAchievementsOfPlayer(getPlayer().getName(), transaction); - } - - public Set getIdentifiers() { - return identifiers; - } - - public Player getPlayer() { - return player; - } - -} diff --git a/src/games/stendhal/server/core/engine/dbcommand/WriteAchievementCommand.java b/src/games/stendhal/server/core/engine/dbcommand/WriteAchievementCommand.java deleted file mode 100644 index 6137016daa..0000000000 --- a/src/games/stendhal/server/core/engine/dbcommand/WriteAchievementCommand.java +++ /dev/null @@ -1,43 +0,0 @@ -package games.stendhal.server.core.engine.dbcommand; - -import games.stendhal.server.core.engine.db.AchievementDAO; -import games.stendhal.server.core.events.achievements.Achievement; - -import java.io.IOException; -import java.sql.SQLException; - -import marauroa.server.db.DBTransaction; -import marauroa.server.db.command.AbstractDBCommand; -import marauroa.server.game.db.DAORegister; - -public class WriteAchievementCommand extends AbstractDBCommand { - - private final Achievement achievement; - - private Integer savedId; - - /** - * @param achievement - */ - /** - * @param achievement - */ - public WriteAchievementCommand(Achievement achievement) { - super(); - this.achievement = achievement; - } - - @Override - public void execute(DBTransaction transaction) throws SQLException, - IOException { - savedId = DAORegister.get().get(AchievementDAO.class).saveAchievement(achievement.getIdentifier(), achievement.getTitle(), achievement.getCategory(), transaction); - } - - /** - * @return the savedId - */ - public Integer getSavedId() { - return savedId; - } - -} diff --git a/src/games/stendhal/server/core/engine/dbcommand/WriteReachedAchievementCommand.java b/src/games/stendhal/server/core/engine/dbcommand/WriteReachedAchievementCommand.java deleted file mode 100644 index 17e974a714..0000000000 --- a/src/games/stendhal/server/core/engine/dbcommand/WriteReachedAchievementCommand.java +++ /dev/null @@ -1,39 +0,0 @@ -package games.stendhal.server.core.engine.dbcommand; - -import games.stendhal.server.core.engine.db.AchievementDAO; -import games.stendhal.server.core.events.achievements.Category; - -import java.io.IOException; -import java.sql.SQLException; - -import marauroa.server.db.DBTransaction; -import marauroa.server.db.command.AbstractDBCommand; -import marauroa.server.game.db.DAORegister; -/** - * command to log a reached achievement to the database - * - * @author madmetzger - */ -public class WriteReachedAchievementCommand extends AbstractDBCommand { - - private final Integer id; - private final String playerName; - - /** - * create a new command - * @param id database id of the achievement - * @param playerName name of player who has reached it - */ - public WriteReachedAchievementCommand(Integer id, String title, Category category, String playerName) { - this.id = id; - this.playerName = playerName; - } - - @Override - public void execute(DBTransaction transaction) throws SQLException, - IOException { - AchievementDAO dao = DAORegister.get().get(AchievementDAO.class); - dao.saveReachedAchievement(id, playerName, transaction); - } - -} diff --git a/src/games/stendhal/server/core/events/achievements/Achievement.java b/src/games/stendhal/server/core/events/achievements/Achievement.java deleted file mode 100644 index 988ee0e658..0000000000 --- a/src/games/stendhal/server/core/events/achievements/Achievement.java +++ /dev/null @@ -1,83 +0,0 @@ -package games.stendhal.server.core.events.achievements; - -import games.stendhal.server.entity.npc.ChatCondition; -import games.stendhal.server.entity.player.Player; -/** - * An Achievement a player can reach while playing the game. - * Achievements are given for example for doing a certain number of quests or killing a number of special creatures - * - * @author madmetzger - */ -public class Achievement { - - private final String identifier; - - private final String title; - - private final Category category; - - private final String description; - - private final ChatCondition condition; - - - /** - * create a new achievement - * - * @param identifier - * @param title - * @param category - * @param condition - */ - public Achievement(String identifier, String title, Category category, String description, ChatCondition condition) { - this.identifier = identifier; - this.title = title; - this.category = category; - this.condition = condition; - this.description = description; - } - - /** - * @return the category of this achievement - */ - public Category getCategory() { - return category; - } - - /** - * @return the identifying string - */ - public String getIdentifier() { - return identifier; - } - - /** - * @return the title a player gets awarded for this achievement - */ - public String getTitle() { - return title; - } - - /** - * @return the description of what to do to get this achievement - */ - public String getDescription() { - return description; - } - - /** - * Check if a player has fullfilled this achievement - * @param p the player to check - * @return true iff this achievement's condtion evalutates to true - */ - public boolean isFulfilled(Player p) { - boolean fullfilled = condition.fire(p, null, null); - return fullfilled; - } - - @Override - public String toString() { - return "Achievement"; - } - -} diff --git a/src/games/stendhal/server/core/events/achievements/AchievementNotifier.java b/src/games/stendhal/server/core/events/achievements/AchievementNotifier.java deleted file mode 100644 index 663bb3b84c..0000000000 --- a/src/games/stendhal/server/core/events/achievements/AchievementNotifier.java +++ /dev/null @@ -1,260 +0,0 @@ -package games.stendhal.server.core.events.achievements; - -import games.stendhal.server.core.engine.GameEvent; -import games.stendhal.server.core.engine.SingletonRepository; -import games.stendhal.server.core.engine.dbcommand.ReadAchievementIdentifierToIdMap; -import games.stendhal.server.core.engine.dbcommand.WriteAchievementCommand; -import games.stendhal.server.core.engine.dbcommand.WriteReachedAchievementCommand; -import games.stendhal.server.entity.npc.condition.LevelGreaterThanCondition; -import games.stendhal.server.entity.npc.condition.PlayerHasKilledNumberOfCreaturesCondition; -import games.stendhal.server.entity.player.Player; -import games.stendhal.server.entity.player.ReadAchievementsOnLogin; - -import java.util.Collection; -import java.util.HashMap; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import marauroa.server.db.command.DBCommandQueue; -import marauroa.server.db.command.ResultHandle; -/** - * Checks for reached achievements and marks them as reached for a player if he has fullfilled them - * - * @author madmetzger - */ -public class AchievementNotifier { - - private static AchievementNotifier instance; - - private Map> achievements; - - private Map identifiersToIds; - - private ResultHandle handle = new ResultHandle(); - - private AchievementNotifier() { - achievements = new HashMap>(); - identifiersToIds = new HashMap(); - } - - /** - * singleton accessor method - * - * @return the AchievementNotifier - */ - public static AchievementNotifier get() { - if(instance == null) { - instance = new AchievementNotifier(); - } - return instance; - } - - /** - * initializes the achievements that are available and registers the login listener - * new added achievements are added to the achievements table - */ - public void initialize() { - Map allAchievements = createAchievements(); - for(Achievement a : allAchievements.values()) { - if(!achievements.containsKey(a.getCategory())) { - achievements.put(a.getCategory(), new LinkedList()); - } - achievements.get(a.getCategory()).add(a); - } - Set allIdentifiersInDatabase = collectAllIdentifiersFromDatabase(); - for(String identifier : allIdentifiersInDatabase) { - allAchievements.remove(identifier); - } - for (Achievement a : allAchievements.values()) { - WriteAchievementCommand command = new WriteAchievementCommand(a); - DBCommandQueue.get().enqueueAndAwaitResult(command, handle); - Integer id = command.getSavedId(); - identifiersToIds.put(a.getIdentifier(), id); - } - SingletonRepository.getLoginNotifier().addListener(new ReadAchievementsOnLogin()); - } - - /** - * collects all identifiers from the database - * - * @return a set of all identifier strings - */ - private Set collectAllIdentifiersFromDatabase() { - DBCommandQueue.get().enqueueAndAwaitResult(new ReadAchievementIdentifierToIdMap(), handle); - ReadAchievementIdentifierToIdMap command = waitForResult(); - Map mapFromDB = command.getIdentifierToIdMap(); - identifiersToIds.putAll(mapFromDB); - return mapFromDB.keySet(); - } - - /** - * waits for the result of an issued ReadAchievementIdentifierToIdMap command - * - * @return the completed command - */ - private ReadAchievementIdentifierToIdMap waitForResult() { - ReadAchievementIdentifierToIdMap command = DBCommandQueue.get().getOneResult(ReadAchievementIdentifierToIdMap.class, handle); - while(command == null) { - command = DBCommandQueue.get().getOneResult(ReadAchievementIdentifierToIdMap.class, handle); - } - return command; - } - - /** - * checks all for level change relevant achievements for a player - * - * @param player - */ - public void onLevelChange(Player player) { - getAndCheckAchievementsInCategory(player, Category.EXPERIENCE); - } - - - /** - * checks all achievements for a player that should be checked when a player kills sth - * - * @param player - */ - public void onKill(Player player) { - getAndCheckAchievementsInCategory(player, Category.FIGHTING); - } - - /** - * check all achievements for a player that are relevant on finishing a quest - * - * @param player - */ - public void onFinishQuest(Player player) { - getAndCheckAchievementsInCategory(player, Category.QUEST); - } - - /** - * retrieve all achievements for a category and check if player has reached each of the found achievements - * - * @param player - * @param category - */ - private void getAndCheckAchievementsInCategory(Player player, Category category) { - if(achievements.containsKey(category)) { - List toCheck = achievements.get(category); - checkAchievements(player, toCheck); - } - } - - /** - * checks for each achievement if the player has reached it. in case of reaching - * an achievement it starts logging and notifying about reaching - * - * @param player - * @param toCheck - */ - private void checkAchievements(Player player, - List toCheck) { - for (Achievement achievement : toCheck) { - if(achievement.isFulfilled(player) && !player.hasReachedAchievement(achievement.getIdentifier())) { - notifyPlayerAboutReachedAchievement(player, achievement); - logReachingOfAnAchievement(player, achievement); - } - } - } - - /** - * logs reached achievement to gameEvents table and reached_achievment table - * - * @param player - * @param achievement - */ - private void logReachingOfAnAchievement(Player player, Achievement achievement) { - String identifier = achievement.getIdentifier(); - String title = achievement.getTitle(); - Category category = achievement.getCategory(); - String playerName = player.getName(); - DBCommandQueue.get().enqueue(new WriteReachedAchievementCommand(identifiersToIds.get(identifier), title, category, playerName)); - player.addReachedAchievement(achievement.getIdentifier()); - new GameEvent(playerName, "reach-achievement", category.toString(), title, identifier).raise(); - } - - /** - * notifies the player about reaching an achievement - * - * @param player - * @param achievement - */ - private void notifyPlayerAboutReachedAchievement(Player player, - Achievement achievement) { - //TODO: use postman here? - //player.sendPrivateText("Congratulations! You have reached the "+achievement.getTitle()+" achievement!"); - } - - /** - * creates all available achievements - * - * @return map with key identifier and value the identified achievement - */ - private Map createAchievements() { - Map achievementMap = new HashMap(); - for(Achievement a : createExperienceAchievements()) { - achievementMap.put(a.getIdentifier(), a); - } - for(Achievement a : createFightingAchievements()) { - achievementMap.put(a.getIdentifier(), a); - } - for(Achievement a : createQuestAchievements()) { - achievementMap.put(a.getIdentifier(), a); - } - return achievementMap; - } - - /** - * creates a collection of all available fighting achievements - * - * @return - */ - private Collection createFightingAchievements() { - List fightingAchievements = new LinkedList(); - Achievement killRats = new Achievement("fight.general.rats", "Rat hunter", - Category.FIGHTING, "Kill 15 rats", - new PlayerHasKilledNumberOfCreaturesCondition("rat", 15)); - Achievement exterminator = new Achievement("fight.general.exterminator", "Exterminator", - Category.FIGHTING, "Kill 10 rats of each kind", - new PlayerHasKilledNumberOfCreaturesCondition(10, "rat", "caverat", "venomrat", "zombie rat", "venom rat", "giantrat", "ratman", "ratwoman", "archrat")); - fightingAchievements.add(killRats); - fightingAchievements.add(exterminator); - return fightingAchievements; - } - - /** - * creates a collection of all experience related achievements - * - * @return - */ - private Collection createExperienceAchievements() { - List xpAchievements = new LinkedList(); - Achievement newbie = new Achievement("xp.lvl.10", "Greenhorn", - Category.EXPERIENCE, "Reach level 10", - new LevelGreaterThanCondition(9)); - Achievement newbie50 = new Achievement("xp.lvl.50", "Apprentice", - Category.EXPERIENCE, "Reach level 50", - new LevelGreaterThanCondition(49)); - Achievement newbie100 = new Achievement("xp.lvl.100", "Apprentice", - Category.EXPERIENCE, "Reach level 100", - new LevelGreaterThanCondition(99)); - xpAchievements.add(newbie); - xpAchievements.add(newbie50); - xpAchievements.add(newbie100); - return xpAchievements; - } - - /** - * creates a collection of all available quest achievements - * - * @return - */ - private Collection createQuestAchievements() { - List questAchievements = new LinkedList(); - return questAchievements; - } - -} diff --git a/src/games/stendhal/server/core/events/achievements/Category.java b/src/games/stendhal/server/core/events/achievements/Category.java deleted file mode 100644 index 4af819472a..0000000000 --- a/src/games/stendhal/server/core/events/achievements/Category.java +++ /dev/null @@ -1,12 +0,0 @@ -/** - * - */ -package games.stendhal.server.core.events.achievements; -/** - * categories of achievements - * - * @author madmetzger - */ -public enum Category { - EXPERIENCE, FIGHTING, QUEST -} \ No newline at end of file diff --git a/src/games/stendhal/server/entity/RPEntity.java b/src/games/stendhal/server/entity/RPEntity.java index 7c4fe39f6e..fac632187a 100644 --- a/src/games/stendhal/server/entity/RPEntity.java +++ b/src/games/stendhal/server/entity/RPEntity.java @@ -1134,7 +1134,6 @@ public abstract class RPEntity extends GuidedEntity { } killer.addXP(reward); - SingletonRepository.getAchievementNotifier().onKill(killer); // For some quests etc., it is required that the player kills a // certain creature without the help of others. // Find out if the player killed this RPEntity on his own, but diff --git a/src/games/stendhal/server/entity/mapstuff/area/MessagingArea.java b/src/games/stendhal/server/entity/mapstuff/area/MessagingArea.java index d1b6d7691a..2c85f0a331 100644 --- a/src/games/stendhal/server/entity/mapstuff/area/MessagingArea.java +++ b/src/games/stendhal/server/entity/mapstuff/area/MessagingArea.java @@ -39,7 +39,9 @@ public class MessagingArea extends AreaEntity implements MovementListener { public void onEntered(final ActiveEntity entity, final StendhalRPZone zone, final int newX, final int newY) { if ((enterMessage != null) && (entity instanceof Player)) { - ((Player) entity).sendPrivateText(NotificationType.SCENE_SETTING, enterMessage); + // needs to be delayed to avoid the message appearing before server + // welcome on login + new DelayedPlayerTextSender((Player) entity, enterMessage, NotificationType.SCENE_SETTING, 1); } } diff --git a/src/games/stendhal/server/entity/npc/action/CheckForReachedQuestAchievements.java b/src/games/stendhal/server/entity/npc/action/CheckForReachedQuestAchievements.java deleted file mode 100644 index 558b73e3e9..0000000000 --- a/src/games/stendhal/server/entity/npc/action/CheckForReachedQuestAchievements.java +++ /dev/null @@ -1,15 +0,0 @@ -package games.stendhal.server.entity.npc.action; - -import games.stendhal.server.core.engine.SingletonRepository; -import games.stendhal.server.entity.npc.ChatAction; -import games.stendhal.server.entity.npc.EventRaiser; -import games.stendhal.server.entity.npc.parser.Sentence; -import games.stendhal.server.entity.player.Player; - -public class CheckForReachedQuestAchievements implements ChatAction { - - public void fire(Player player, Sentence sentence, EventRaiser npc) { - SingletonRepository.getAchievementNotifier().onFinishQuest(player); - } - -} diff --git a/src/games/stendhal/server/entity/npc/action/SendPrivateMessageAction.java b/src/games/stendhal/server/entity/npc/action/SendPrivateMessageAction.java new file mode 100644 index 0000000000..289bed4ac1 --- /dev/null +++ b/src/games/stendhal/server/entity/npc/action/SendPrivateMessageAction.java @@ -0,0 +1,64 @@ +package games.stendhal.server.entity.npc.action; + +import games.stendhal.common.NotificationType; +import games.stendhal.server.entity.npc.ChatAction; +import games.stendhal.server.entity.npc.EventRaiser; +import games.stendhal.server.entity.npc.parser.Sentence; +import games.stendhal.server.entity.player.Player; + +import org.apache.commons.lang.builder.EqualsBuilder; +import org.apache.commons.lang.builder.HashCodeBuilder; + +/** + * Sends the message as a private text + * Optional notification type when used with NPCs + */ +public class SendPrivateMessageAction implements ChatAction { + + private final String text; + private final NotificationType type; + + /** + * Creates a new SendPrivateMessageAction. + * + * @param text text to send + */ + public SendPrivateMessageAction(String text) { + this.text = text; + this.type = NotificationType.PRIVMSG; + } + + /** + * Creates a new SendPrivateMessageAction - does NOT work with portals + * + * @param text text to send + * + * @param type type of message + */ + public SendPrivateMessageAction(final NotificationType type, final String text) { + this.text = text; + this.type = type; + } + + public void fire(final Player player, final Sentence sentence, final EventRaiser raiser) { + player.sendPrivateText(type, text); + } + + @Override + public String toString() { + // would need to send the type toString also to include the type here + return "Send Private Message: " + text; + } + + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public boolean equals(final Object obj) { + return EqualsBuilder.reflectionEquals(this, obj, false, + SendPrivateMessageAction.class); + } +} diff --git a/src/games/stendhal/server/entity/npc/action/StartRecordingRandomItemCollectionAction.java b/src/games/stendhal/server/entity/npc/action/StartRecordingRandomItemCollectionAction.java index 5107809472..1a7f71fb35 100755 --- a/src/games/stendhal/server/entity/npc/action/StartRecordingRandomItemCollectionAction.java +++ b/src/games/stendhal/server/entity/npc/action/StartRecordingRandomItemCollectionAction.java @@ -68,7 +68,7 @@ public class StartRecordingRandomItemCollectionAction implements ChatAction { final int quantity = items.get(itemname); Map substitutes = new HashMap(); - substitutes.put("item", Grammar.quantityplnoun(quantity, itemname)); + substitutes.put("item", Grammar.quantityplnoun(quantity, itemname, "a")); substitutes.put("#item", Grammar.quantityplnounWithHash(quantity, itemname)); substitutes.put("the item", "the " + Grammar.plnoun(quantity, itemname)); diff --git a/src/games/stendhal/server/entity/player/Player.java b/src/games/stendhal/server/entity/player/Player.java index 49e572430c..c9ccd6a591 100644 --- a/src/games/stendhal/server/entity/player/Player.java +++ b/src/games/stendhal/server/entity/player/Player.java @@ -12,6 +12,12 @@ ***************************************************************************/ package games.stendhal.server.entity.player; +import static games.stendhal.common.constants.Actions.ADMINLEVEL; +import static games.stendhal.common.constants.Actions.AWAY; +import static games.stendhal.common.constants.Actions.GHOSTMODE; +import static games.stendhal.common.constants.Actions.GRUMPY; +import static games.stendhal.common.constants.Actions.INVISIBLE; +import static games.stendhal.common.constants.Actions.TELECLICKMODE; import games.stendhal.common.Constants; import games.stendhal.common.Direction; import games.stendhal.common.FeatureList; @@ -23,7 +29,6 @@ import games.stendhal.common.constants.Nature; import games.stendhal.server.core.engine.SingletonRepository; import games.stendhal.server.core.engine.StendhalRPZone; import games.stendhal.server.core.events.TutorialNotifier; -import games.stendhal.server.core.events.achievements.AchievementNotifier; import games.stendhal.server.core.rp.StendhalRPAction; import games.stendhal.server.entity.Entity; import games.stendhal.server.entity.Outfit; @@ -42,7 +47,6 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; -import java.util.HashSet; import java.util.LinkedList; import java.util.List; import java.util.Random; @@ -54,13 +58,6 @@ import marauroa.common.game.SyntaxException; import org.apache.log4j.Logger; -import static games.stendhal.common.constants.Actions.ADMINLEVEL; -import static games.stendhal.common.constants.Actions.AWAY; -import static games.stendhal.common.constants.Actions.GHOSTMODE; -import static games.stendhal.common.constants.Actions.GRUMPY; -import static games.stendhal.common.constants.Actions.INVISIBLE; -import static games.stendhal.common.constants.Actions.TELECLICKMODE; - public class Player extends RPEntity { private static final String LAST_PLAYER_KILL_TIME = "last_player_kill_time"; @@ -135,11 +132,6 @@ public class Player extends RPEntity { private String lastPrivateChatterName; private final PlayerChatBucket chatBucket; - - /** - * all identifiers of reached achievements, filled on login of player - */ - private Set reachedAchievements = new HashSet(); public static void generateRPClass() { try { @@ -2060,22 +2052,4 @@ public class Player extends RPEntity { remove("buddies", name); } - @Override - public void setLevel(int level) { - super.setLevel(level); - AchievementNotifier.get().onLevelChange(this); - } - - public void addReachedAchievement(String identifier) { - getAchievements().add(identifier); - } - - private Set getAchievements() { - return reachedAchievements; - } - - public boolean hasReachedAchievement(String identifier) { - return getAchievements().contains(identifier); - } - } diff --git a/src/games/stendhal/server/entity/player/ReadAchievementsOnLogin.java b/src/games/stendhal/server/entity/player/ReadAchievementsOnLogin.java deleted file mode 100644 index f4becc51e4..0000000000 --- a/src/games/stendhal/server/entity/player/ReadAchievementsOnLogin.java +++ /dev/null @@ -1,37 +0,0 @@ -package games.stendhal.server.entity.player; - -import games.stendhal.server.core.engine.dbcommand.ReadAchievementsForPlayerCommand; -import games.stendhal.server.core.events.LoginListener; -import games.stendhal.server.core.events.TurnListener; -import games.stendhal.server.core.events.TurnNotifier; - -import java.util.Set; - -import marauroa.server.db.command.DBCommand; -import marauroa.server.db.command.DBCommandQueue; -import marauroa.server.db.command.ResultHandle; - -public class ReadAchievementsOnLogin implements LoginListener, TurnListener { - - private ResultHandle handle = new ResultHandle(); - - public void onLoggedIn(Player player) { - DBCommand command = new ReadAchievementsForPlayerCommand(player); - DBCommandQueue.get().enqueueAndAwaitResult(command, handle); - TurnNotifier.get().notifyInTurns(1, this); - } - - public void onTurnReached(int currentTurn) { - ReadAchievementsForPlayerCommand command = DBCommandQueue.get().getOneResult(ReadAchievementsForPlayerCommand.class, handle); - if (command == null) { - TurnNotifier.get().notifyInTurns(0, this); - return; - } - Player p = command.getPlayer(); - Set identifiers = command.getIdentifiers(); - for (String identifier : identifiers) { - p.addReachedAchievement(identifier); - } - } - -} diff --git a/src/games/stendhal/server/entity/player/UpdateConverter.java b/src/games/stendhal/server/entity/player/UpdateConverter.java index 4f9438bfb9..58aefd5d30 100644 --- a/src/games/stendhal/server/entity/player/UpdateConverter.java +++ b/src/games/stendhal/server/entity/player/UpdateConverter.java @@ -279,8 +279,10 @@ public abstract class UpdateConverter { } //port to 0.86: port keymap to feature map, karama_indicator as feature - if (KeyedSlotUtil.getKeyedSlot(object, "!features", "keyring") != null) { - object.put("features", "keyring", ""); + if (object.hasSlot("!features")) { + if (KeyedSlotUtil.getKeyedSlot(object, "!features", "keyring") != null) { + object.put("features", "keyring", ""); + } } if (KeyedSlotUtil.getKeyedSlot(object, "!quests", "learn_karma") != null) { object.put("features", "karma_indicator", ""); diff --git a/src/games/stendhal/server/maps/ados/abandonedkeep/DwarfBuyerGuyNPC.java b/src/games/stendhal/server/maps/ados/abandonedkeep/DwarfBuyerGuyNPC.java index 41436821f1..f8698c82d3 100644 --- a/src/games/stendhal/server/maps/ados/abandonedkeep/DwarfBuyerGuyNPC.java +++ b/src/games/stendhal/server/maps/ados/abandonedkeep/DwarfBuyerGuyNPC.java @@ -37,7 +37,7 @@ public class DwarfBuyerGuyNPC extends SpeakerNPCFactory { offerings.put("magical needle", 1000); offerings.put("snowglobe", 150); offerings.put("silk gland", 500); - new BuyerAdder().add(dwarfguy, new BuyerBehaviour(offerings), true); + new BuyerAdder().add(dwarfguy, new BuyerBehaviour(offerings), false); } } diff --git a/src/games/stendhal/server/maps/kirdneh/city/KirdnehFishyMarketNPC.java b/src/games/stendhal/server/maps/kirdneh/city/KirdnehFishyMarketNPC.java index a93d1113af..9cbb0dd98e 100644 --- a/src/games/stendhal/server/maps/kirdneh/city/KirdnehFishyMarketNPC.java +++ b/src/games/stendhal/server/maps/kirdneh/city/KirdnehFishyMarketNPC.java @@ -54,7 +54,7 @@ public class KirdnehFishyMarketNPC implements ZoneConfigurator { addReply("aye", "Well, shiver me timbers! Check out that blackboard o'er thar fer me prices an' what i be buyin"); addReply("no", "You lily-livered scallywag! Why ye be wastin me time?"); addHelp("An' just what do ya think a buccanneer such as meself could possibly help ye with?"); - new BuyerAdder().add(this, new BuyerBehaviour(shops.get("buyfishes")), true); + new BuyerAdder().add(this, new BuyerBehaviour(shops.get("buyfishes")), false); addOffer("Check out that thar blackboard fer how many dubloons I be givin."); addQuest("Ye don't ha'e the guts ta do whut I need done."); addGoodbye("Arrgh, avast an' be gone with ye!"); diff --git a/src/games/stendhal/server/maps/nalwor/assassinhq/ChiefFalatheenDishwasherNPC.java b/src/games/stendhal/server/maps/nalwor/assassinhq/ChiefFalatheenDishwasherNPC.java index bafaca6575..e91eca3996 100644 --- a/src/games/stendhal/server/maps/nalwor/assassinhq/ChiefFalatheenDishwasherNPC.java +++ b/src/games/stendhal/server/maps/nalwor/assassinhq/ChiefFalatheenDishwasherNPC.java @@ -22,7 +22,7 @@ public class ChiefFalatheenDishwasherNPC extends SpeakerNPCFactory { dishwasher.addQuest("You could try to help me #escape from these hoodlums. Well... maybe not."); dishwasher.addGoodbye("Don't forget where I am now. Come back and see me some time. I do get lonely."); dishwasher.addReply("escape", "Yes! I want to pursue my dream. Mother Helena offered me a most wonderful job. She needs a dishwasher. Lots of complaining customers!!!"); - new BuyerAdder().add(dishwasher, new BuyerBehaviour(shops.get("buyveggiesandherbs")), true); + new BuyerAdder().add(dishwasher, new BuyerBehaviour(shops.get("buyveggiesandherbs")), false); } } diff --git a/src/games/stendhal/server/maps/nalwor/basement/ArcheryDealerNPC.java b/src/games/stendhal/server/maps/nalwor/basement/ArcheryDealerNPC.java index 1cd95cfffe..583db85f2d 100644 --- a/src/games/stendhal/server/maps/nalwor/basement/ArcheryDealerNPC.java +++ b/src/games/stendhal/server/maps/nalwor/basement/ArcheryDealerNPC.java @@ -33,7 +33,7 @@ public class ArcheryDealerNPC extends SpeakerNPCFactory { offerings.put("composite bow", 350); offerings.put("hunter crossbow", 800); offerings.put("mithril bow", 2000); - new BuyerAdder().add(magearcher, new BuyerBehaviour(offerings), true); + new BuyerAdder().add(magearcher, new BuyerBehaviour(offerings), false); } } diff --git a/src/games/stendhal/server/maps/semos/wizardstower/BlueIceSorceressNPC.java b/src/games/stendhal/server/maps/semos/wizardstower/BlueIceSorceressNPC.java index d872fa42b5..6106754bf1 100644 --- a/src/games/stendhal/server/maps/semos/wizardstower/BlueIceSorceressNPC.java +++ b/src/games/stendhal/server/maps/semos/wizardstower/BlueIceSorceressNPC.java @@ -4,16 +4,8 @@ import games.stendhal.server.core.config.ZoneConfigurator; import games.stendhal.server.core.engine.StendhalRPZone; import games.stendhal.server.core.pathfinder.FixedPath; import games.stendhal.server.core.pathfinder.Node; -import games.stendhal.server.entity.npc.ConversationStates; import games.stendhal.server.entity.npc.SpeakerNPC; -import games.stendhal.server.entity.npc.action.DropItemAction; -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.condition.NotCondition; -import games.stendhal.server.entity.npc.condition.PlayerHasItemWithHimCondition; -import java.util.Arrays; import java.util.LinkedList; import java.util.List; import java.util.Map; @@ -64,31 +56,40 @@ public class BlueIceSorceressNPC implements ZoneConfigurator { @Override protected void createDialog() { addGreeting("Hello dear!"); - addHelp("I can conjure an #ice #scroll for you. It is able to protect you from dangerous heat, depends on how you use it."); + + //addHelp("I can conjure an #ice #scroll for you. It can't help you in the battle. But it can protect you from natural heat on certain dangerous terrains. You will know when you need it."); + addHelp("Excuse me, I am very busy establishing the sorceresses part at the wizards circle."); + addJob("I am Cassandra, the sorceress of water and ice. I represent #Frostshade at the wizards circle."); - addOffer("I can conjure an #ice #scroll for you. It is able to protect you from dangerous heat, depends on how you use it."); + + //addOffer("I can conjure an #ice #scroll for you. It can't help you in the battle. But it can protect you from natural heat on certain dangerous terrains. You will know when you need it."); + addOffer("Excuse me, I am very busy establishing the sorceresses part at the wizards circle."); + addReply("Frostshade", "Frostshade is the school of the magic of water and ice. It lies deep in the northern glaciers."); - addReply("scroll", "Zekiel is the storekeeper of the tower, I am sure he can help you."); + addReply("blank scroll", "Zekiel is the storekeeper of the tower, I am sure he can help you."); addQuest("The magic in this world has just begun and I am very busy to establish the sorceresses of #Frostshade at the wizards circle. I will tell you in time, when I have a quest for you."); addGoodbye("Bye!"); - addReply(Arrays.asList("ice scroll", "ice scrolls"), - "I need a #scroll for that. If you bring me one, I will #enchant it for you."); - add( - ConversationStates.ATTENDING, - Arrays.asList("enchant"), - new PlayerHasItemWithHimCondition("scroll"), - ConversationStates.ATTENDING, - "I enchanted your scroll to an ice scroll. May it cool off your feets on your travels.", - new MultipleActions( - new DropItemAction("scroll", 1), - new EquipItemAction("ice scroll", 1, true), - new IncreaseXPAction(250))); - add( - ConversationStates.ATTENDING, - Arrays.asList("enchant"), - new NotCondition(new PlayerHasItemWithHimCondition("scroll")), - ConversationStates.ATTENDING, - "You don't have a #scroll that I could enchant.", null); + +/** addReply(Arrays.asList("ice scroll", "ice scrolls"), +* "I need a #blank #scroll for that. If you bring me one, I will #enchant it for you."); +* add( +* ConversationStates.ATTENDING, +* Arrays.asList("enchant"), +* new PlayerHasItemWithHimCondition("blank scroll"), +* ConversationStates.ATTENDING, +* "I enchanted your blank scroll to an ice scroll. May it cool off your feets on your travels.", +* new MultipleActions( +* new DropItemAction("blank scroll", 1), +* new EquipItemAction("ice scroll", 1, true), +* new IncreaseXPAction(250))); +* add( +* ConversationStates.ATTENDING, +* Arrays.asList("enchant"), +* new NotCondition(new PlayerHasItemWithHimCondition("blank scroll")), +* ConversationStates.ATTENDING, +* "You don't have a #blank #scroll that I could enchant.", null); +*/ + } //remaining behaviour defined in maps.quests.SorceressCassandraPlainQuest }; diff --git a/src/games/stendhal/server/maps/semos/wizardstower/WizardsGuardStatueSpireNPC.java b/src/games/stendhal/server/maps/semos/wizardstower/WizardsGuardStatueSpireNPC.java index 2dc41143aa..5b8e3c5830 100644 --- a/src/games/stendhal/server/maps/semos/wizardstower/WizardsGuardStatueSpireNPC.java +++ b/src/games/stendhal/server/maps/semos/wizardstower/WizardsGuardStatueSpireNPC.java @@ -2,16 +2,7 @@ package games.stendhal.server.maps.semos.wizardstower; import games.stendhal.server.core.config.ZoneConfigurator; import games.stendhal.server.core.engine.StendhalRPZone; -import games.stendhal.server.entity.npc.ConversationPhrases; -import games.stendhal.server.entity.npc.ConversationStates; import games.stendhal.server.entity.npc.SpeakerNPC; -import games.stendhal.server.entity.npc.action.DropItemAction; -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.condition.AndCondition; -import games.stendhal.server.entity.npc.condition.NotCondition; -import games.stendhal.server.entity.npc.condition.PlayerHasItemWithHimCondition; import java.util.Arrays; import java.util.Map; @@ -42,10 +33,15 @@ public class WizardsGuardStatueSpireNPC implements ZoneConfigurator { addHelp("You are stood in the #store. You can enter the spire by the teleporter in front of me. The one behind me teleports you back to the tower entrance."); addJob("I am the guardian and #storekeeper of the #wizards tower."); addGoodbye("So long!"); + addOffer("I can create #special items with the materials from the store. Just tell me what you want, but for most items I will need extra ingredients."); addReply(Arrays.asList("store", "storekeeper"), - "I can create #special items with the materials from the store. Just tell me what you want, but for the most items I will need extra ingredients."); + "I can create #special items with the materials from the store. Just tell me what you want, but for most items I will need extra ingredients."); + +// addReply("special", +// "For example I can create a #rift #cloak. I could read in your mind, adventurer. But it is not allowed to me here. So you have to tell me which special item you want and I will tell you, if I can help you."); addReply("special", - "For example I can create a #rift #cloak. I could read in your mind, adventurer. But it is not allowed to me here. So you have to tell me which special item you want and I will tell you, if I can help you."); + "I am sorry, now is not the time. Try again in some weeks, and I may be ready to help you."); + addReply(Arrays.asList("wizard", "wizards"), "Seven wizards form the wizards circle. These are #Erastus, #Elana, #Ravashack, #Jaer, #Cassandra, #Silvanus and #Malleus"); addReply("erastus", "Erastus is the archmage of the wizards circle. He is the grandmaster of all magics and the wisest person that is known. He is the only one without a part in the practical test."); @@ -56,11 +52,11 @@ public class WizardsGuardStatueSpireNPC implements ZoneConfigurator { addReply("silvanus", "Silvanus is a sage druid and perhaps the eldest of all elves. He is a friend of all animals, trees, fairy creatures and ents. His domain is Earth and Nature."); addReply("malleus", "Malleus is the powerful archetype of a magician and the master of destructive magics. His domain is Fire and he rambled the plains of demons for ages, to understand their ambitions."); - // behavior on special item SCROLL +/** // behavior on special item BLANK SCROLL add(ConversationStates.ATTENDING, - Arrays.asList("scroll", "scrolls"), + Arrays.asList("blank scroll", "scrolls"), ConversationStates.INFORMATION_1, - "I will create a magic scroll for you, but I need eight pieces of wood for that. The scroll will be empty and can be enchanted by wizards. Do you want a magic scroll?", + "I will create a blank scroll for you, but I need eight pieces of wood for that. The blank scroll can be enchanted by wizards. Do you want a blank scroll?", null); add(ConversationStates.INFORMATION_1, ConversationPhrases.YES_MESSAGES, @@ -72,16 +68,16 @@ public class WizardsGuardStatueSpireNPC implements ZoneConfigurator { ConversationPhrases.YES_MESSAGES, new PlayerHasItemWithHimCondition("wood", 8), ConversationStates.ATTENDING, - "There is your magic scroll.", + "There is your blank scroll.", new MultipleActions( new DropItemAction("wood", 8), - new EquipItemAction("scroll", 1, true), + new EquipItemAction("blank scroll", 1, true), new IncreaseXPAction(250))); add(ConversationStates.INFORMATION_1, ConversationPhrases.NO_MESSAGES, null, ConversationStates.ATTENDING, - "Well, maybe later. Just tell me when you want a magic scroll.", + "Well, maybe later. Just tell me when you want a blank scroll.", null); //behavior on special item RIFT CLOAK @@ -124,6 +120,7 @@ public class WizardsGuardStatueSpireNPC implements ZoneConfigurator { ConversationStates.ATTENDING, "Don't forget that you can't enter a magical rift without a rift cloak.", null); +*/ //behavior on special item XARUHWAIYZ PHIAL } //remaining behavior defined in maps.quests.ZekielsPracticalTestQuest diff --git a/src/games/stendhal/server/script/DumpPostmanTable.java b/src/games/stendhal/server/script/DumpPostmanTable.java index c80dcb5d0f..697a0f6fbe 100644 --- a/src/games/stendhal/server/script/DumpPostmanTable.java +++ b/src/games/stendhal/server/script/DumpPostmanTable.java @@ -1,6 +1,10 @@ package games.stendhal.server.script; import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.PrintStream; + import games.stendhal.server.core.scripting.ScriptImpl; import games.stendhal.server.entity.player.Player; @@ -36,27 +40,34 @@ public class DumpPostmanTable extends ScriptImpl { } catch (final Exception e) { admin.sendPrivateText("Could not find postman file"); } - - final Iterator< ? > itr = messages.keySet().iterator(); - while (itr.hasNext()) { - final String key = itr.next().toString(); - String target = key.substring(0,key.indexOf("!")); - String source = key.substring(key.indexOf("!") + 1); - String message = messages.getProperty(key); - - // messages got grouped together, but the line breaks will confuse the csv file: replace new lines with spaces. - message = message.replace("\n", " "); - // replace any double quotes in there with two single quotes so we don't confuse mysql on import - message = message.replace("\"", "''"); - // replace any escape characters - message = message.replace("\\", "\\\\"); - // well, why not clean it now. - message = message.trim(); - System.out.println("\"" + source + "\",\"" + target + "\",\"" + message + "\""); - itr.remove(); + PrintStream out; + try { + out = new PrintStream(new FileOutputStream("postmantable.csv")); + final Iterator< ? > itr = messages.keySet().iterator(); + while (itr.hasNext()) { + final String key = itr.next().toString(); + String target = key.substring(0,key.indexOf("!")); + String source = key.substring(key.indexOf("!") + 1); + String message = messages.getProperty(key); + + // messages got grouped together, but the line breaks will confuse the csv file: replace new lines with spaces. + message = message.replace("\n", " "); + // replace any double quotes in there with two single quotes so we don't confuse mysql on import + message = message.replace("\"", "''"); + // replace any escape characters + message = message.replace("\\", "\\\\"); + // well, why not clean it now. + message = message.trim(); + out.println("\"" + source + "\",\"" + target + "\",\"" + message + "\""); + itr.remove(); + } + out.close(); + } catch (FileNotFoundException e) { + admin.sendPrivateText("Could not find postmantable.csv to print to"); } + } } diff --git a/src/games/stendhal/server/stendhal_init.sql b/src/games/stendhal/server/stendhal_init.sql index ddf15a2520..7ea5b97c96 100644 --- a/src/games/stendhal/server/stendhal_init.sql +++ b/src/games/stendhal/server/stendhal_init.sql @@ -162,24 +162,3 @@ CREATE TABLE IF NOT EXISTS buddy ( ); /* CREATE INDEX i_buddy_charname ON buddy (charname); */ - -CREATE TABLE IF NOT EXISTS achievement ( - id INTEGER AUTO_INCREMENT NOT NULL, - identifier VARCHAR(64), - title VARCHAR(64), - category VARCHAR(64), - description VARCHAR(64), - PRIMARY KEY(id) -); -/* CREATE UNIQUE INDEX i_achievement_identifier ON achievement(identifier);*/ - -CREATE TABLE IF NOT EXISTS reached_achievement ( - id INTEGER AUTO_INCREMENT NOT NULL, - charname VARCHAR(32), - timedate TIMESTAMP default CURRENT_TIMESTAMP, - achievement_id INTEGER, - PRIMARY KEY(id) -); - - -/* CREATE INDEX i_reached_achievement_charname ON reached_achievement(charname);*/ \ No newline at end of file diff --git a/stendhal.jnlp b/stendhal.jnlp index 1d30f73c96..218b3685fc 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 - + diff --git a/tiled/tileset/ground/hexagramm.png b/tiled/tileset/ground/hexagramm.png index 662b00310b..00adb2145d 100644 Binary files a/tiled/tileset/ground/hexagramm.png and b/tiled/tileset/ground/hexagramm.png differ