From: Martin F. <mar...@us...> - 2008-03-01 21:58:04
|
Update of /cvsroot/arianne/stendhal/src/games/stendhal/server/maps/semos/city In directory sc8-pr-cvs11.sourceforge.net:/tmp/cvs-serv21632/src/games/stendhal/server/maps/semos/city Modified Files: SignLessorNPC.java Log Message: make better use of ConversationParser Index: SignLessorNPC.java =================================================================== RCS file: /cvsroot/arianne/stendhal/src/games/stendhal/server/maps/semos/city/SignLessorNPC.java,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** SignLessorNPC.java 27 Feb 2008 17:18:19 -0000 1.18 --- SignLessorNPC.java 1 Mar 2008 21:58:08 -0000 1.19 *************** *** 33,36 **** --- 33,37 ---- public class SignLessorNPC extends SpeakerNPCFactory { protected String text; + // 1 min at 300 ms/turn private static final int ONE_MINUTE = 180; *************** *** 70,77 **** @Override public void fire(Player player, Sentence sentence, SpeakerNPC npc) { ! String temp = sentence.getOriginalText().trim(); ! text = temp.substring(5).trim(); ! String reply = "A sign costs " + MONEY + " money for 24 hours. Do you want to rent one?"; if (rentedSignList.getByName(player.getName()) != null) { reply = reply + " Please note that I will replace the sign you already rented."; --- 71,78 ---- @Override public void fire(Player player, Sentence sentence, SpeakerNPC npc) { ! text = sentence.getOriginalText().trim().substring(5).trim(); ! String reply = "A sign costs " + MONEY + " money for 24 hours. Do you want to rent one?"; + if (rentedSignList.getByName(player.getName()) != null) { reply = reply + " Please note that I will replace the sign you already rented."; *************** *** 98,110 **** ConversationStates.IDLE, null, new SpeakerNPC.ChatAction() { - @Override public void fire(Player player, Sentence sentence, SpeakerNPC npc) { - if (text.length() > 1000) { text = text.substring(1000); } ! ! // do not accept all uper case if (StringUtils.countLowerCase(text) < StringUtils.countUpperCase(text) * 2) { text = text.toLowerCase(); --- 99,109 ---- ConversationStates.IDLE, null, new SpeakerNPC.ChatAction() { @Override public void fire(Player player, Sentence sentence, SpeakerNPC npc) { if (text.length() > 1000) { text = text.substring(1000); } ! ! // do not accept all upper case if (StringUtils.countLowerCase(text) < StringUtils.countUpperCase(text) * 2) { text = text.toLowerCase(); *************** *** 121,125 **** npc.say("OK, let me put your sign up."); ! // inform irc using postman Player postman = SingletonRepository.getRuleProcessor().getPlayer("postman"); if (postman != null) { --- 120,124 ---- npc.say("OK, let me put your sign up."); ! // inform IRC using postman Player postman = SingletonRepository.getRuleProcessor().getPlayer("postman"); if (postman != null) { *************** *** 159,172 **** ConversationStates.ATTENDING, null, new SpeakerNPC.ChatAction() { - @Override public void fire(Player player, Sentence sentence, SpeakerNPC npc) { ! String original = sentence.getOriginalText().trim(); ! int pos = original.indexOf(" "); ! if (pos < 0) { npc.say("Syntax: delete <nameofplayer>"); return; } ! String playerName = original.substring(pos + 1).trim(); rentedSignList.removeByName(playerName); String message = player.getName() + " deleted sign from " + playerName; --- 158,168 ---- ConversationStates.ATTENDING, null, new SpeakerNPC.ChatAction() { @Override public void fire(Player player, Sentence sentence, SpeakerNPC npc) { ! if (sentence.getExpressions().size() < 2) { npc.say("Syntax: delete <nameofplayer>"); return; } ! String playerName = sentence.getExpressionStringAfterVerb(); rentedSignList.removeByName(playerName); String message = player.getName() + " deleted sign from " + playerName; |