nwntools-cvs Mailing List for NWN Tools
Brought to you by:
pspeed
You can subscribe to this list here.
| 2004 |
Jan
(79) |
Feb
(126) |
Mar
(3) |
Apr
(7) |
May
|
Jun
|
Jul
(9) |
Aug
(12) |
Sep
(11) |
Oct
(48) |
Nov
(4) |
Dec
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2005 |
Jan
(3) |
Feb
(22) |
Mar
(11) |
Apr
(3) |
May
(9) |
Jun
(14) |
Jul
|
Aug
(6) |
Sep
|
Oct
(1) |
Nov
|
Dec
(42) |
| 2006 |
Jan
|
Feb
(2) |
Mar
|
Apr
|
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(2) |
Oct
|
Nov
|
Dec
|
|
From: <ps...@us...> - 2007-09-03 18:59:04
|
Update of /cvsroot/nwntools/dev/src/java/org/progeeks/nwn/io/gff In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv14636/src/java/org/progeeks/nwn/io/gff Modified Files: GffReader.java GffWriter.java Log Message: Making encoding explicit for platforms that have their own default encodings set. This was causing problems on Linux machines when foreign characters were used. Index: GffReader.java =================================================================== RCS file: /cvsroot/nwntools/dev/src/java/org/progeeks/nwn/io/gff/GffReader.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** GffReader.java 1 Jun 2005 12:18:58 -0000 1.14 --- GffReader.java 3 Sep 2007 18:58:57 -0000 1.15 *************** *** 48,51 **** --- 48,53 ---- public class GffReader { + private static String nwnEncoding = System.getProperty( "nwn.read.encoding", "windows-1252" ); + private BinaryDataInputStream in; private Header header; *************** *** 225,229 **** buff = new byte[len]; in.readFully( buff ); ! el = new StringElement( name, stub.type, new String(buff) ); break; case Element.TYPE_RESREF: --- 227,231 ---- buff = new byte[len]; in.readFully( buff ); ! el = new StringElement( name, stub.type, new String(buff, nwnEncoding) ); break; case Element.TYPE_RESREF: *************** *** 232,236 **** buff = new byte[len]; in.readFully( buff ); ! el = new StringElement( name, stub.type, new String(buff) ); break; case Element.TYPE_STRREF: --- 234,238 ---- buff = new byte[len]; in.readFully( buff ); ! el = new StringElement( name, stub.type, new String(buff, nwnEncoding) ); break; case Element.TYPE_STRREF: *************** *** 259,263 **** //System.out.print( (char)buff[j] ); //System.out.println(); ! ((LocalizedStringElement)el).addLocalString( l, new String( buff ) ); } --- 261,287 ---- //System.out.print( (char)buff[j] ); //System.out.println(); ! ((LocalizedStringElement)el).addLocalString( l, new String( buff, nwnEncoding ) ); ! ! /* ! System.out.println( "read local string:" + ((LocalizedStringElement)el).getLocalString( l ) ); ! System.out.println( "bytes:" ); ! for( int j = 0; j < buff.length; j++ ) ! System.out.print( "[" + (buff[j] & 0xff) + "(" + (char)buff[j] +")]" ); ! System.out.println(); ! Map charsets = java.nio.charset.Charset.availableCharsets(); ! for( Iterator it = charsets.keySet().iterator(); it.hasNext(); ) ! { ! String key = (String)it.next(); ! try ! { ! System.out.println( "trying:" + key + " = " + new String( buff, key ) ); ! } ! catch( Exception e ) ! { ! System.out.println( "Failed to encode with:" + key ); ! e.printStackTrace(); ! } ! } ! */ } Index: GffWriter.java =================================================================== RCS file: /cvsroot/nwntools/dev/src/java/org/progeeks/nwn/io/gff/GffWriter.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** GffWriter.java 21 Sep 2004 04:55:35 -0000 1.12 --- GffWriter.java 3 Sep 2007 18:58:57 -0000 1.13 *************** *** 48,51 **** --- 48,53 ---- public class GffWriter { + private static String nwnEncoding = System.getProperty( "nwn.write.encoding", "windows-1252" ); + public static final String GFF_VERSION = "V3.2"; *************** *** 403,407 **** case Element.TYPE_STRING: s = (String)((StringElement)el).getValue(); ! sb = s.getBytes(); out.writeInt( sb.length ); out.write( sb ); --- 405,409 ---- case Element.TYPE_STRING: s = (String)((StringElement)el).getValue(); ! sb = s.getBytes( nwnEncoding ); out.writeInt( sb.length ); out.write( sb ); *************** *** 409,413 **** case Element.TYPE_RESREF: s = (String)((StringElement)el).getValue(); ! sb = s.getBytes(); out.writeByte( sb.length ); out.write( sb, 0, Math.min( 256, sb.length ) ); --- 411,415 ---- case Element.TYPE_RESREF: s = (String)((StringElement)el).getValue(); ! sb = s.getBytes( nwnEncoding ); out.writeByte( sb.length ); out.write( sb, 0, Math.min( 256, sb.length ) ); *************** *** 433,437 **** String val = (String)e.getValue(); ! sb = val.getBytes(); //System.out.println( "Write: Strref element size:" + sb.length ); out.writeInt( sb.length ); --- 435,439 ---- String val = (String)e.getValue(); ! sb = val.getBytes( nwnEncoding ); //System.out.println( "Write: Strref element size:" + sb.length ); out.writeInt( sb.length ); |
|
From: <ps...@us...> - 2007-09-03 18:58:06
|
Update of /cvsroot/nwntools/dev/src/java/org/progeeks/nwn/io/xml In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv14221/src/java/org/progeeks/nwn/io/xml Modified Files: GffXmlWriter.java Log Message: Modified to work with latest meta-jb release. Index: GffXmlWriter.java =================================================================== RCS file: /cvsroot/nwntools/dev/src/java/org/progeeks/nwn/io/xml/GffXmlWriter.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** GffXmlWriter.java 1 Jun 2005 12:18:56 -0000 1.6 --- GffXmlWriter.java 3 Sep 2007 18:57:51 -0000 1.7 *************** *** 37,40 **** --- 37,41 ---- import org.progeeks.meta.xml.*; + import org.progeeks.util.xml.*; import org.progeeks.nwn.gff.*; |
|
From: <ps...@us...> - 2006-05-27 13:13:17
|
Update of /cvsroot/nwntools/dev/src/java/org/progeeks/nwn/io/xml In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv10126/src/java/org/progeeks/nwn/io/xml Modified Files: GffXmlReader.java Log Message: Better error message instead of swallowing all of the good stuff. Index: GffXmlReader.java =================================================================== RCS file: /cvsroot/nwntools/dev/src/java/org/progeeks/nwn/io/xml/GffXmlReader.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** GffXmlReader.java 1 Jun 2005 12:18:56 -0000 1.3 --- GffXmlReader.java 27 May 2006 13:13:07 -0000 1.4 *************** *** 108,113 **** catch( XmlException e ) { ! log.error( "Error reading XML", e ); ! throw new IOException( e.getMessage() ); } } --- 108,112 ---- catch( XmlException e ) { ! throw new RuntimeException( "Error reading XML", e ); } } |
|
From: <ps...@us...> - 2006-05-27 13:13:13
|
Update of /cvsroot/nwntools/dev/src/java/org/progeeks/nwn/ui In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv10011/src/java/org/progeeks/nwn/ui Modified Files: GlobalContext.java Log Message: Fixed to compile... the file it depended on has been removed and I'm not sure why the fix to this file was never checked in. Index: GlobalContext.java =================================================================== RCS file: /cvsroot/nwntools/dev/src/java/org/progeeks/nwn/ui/GlobalContext.java,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** GlobalContext.java 1 Jun 2005 12:18:55 -0000 1.23 --- GlobalContext.java 27 May 2006 13:12:46 -0000 1.24 *************** *** 38,41 **** --- 38,42 ---- import org.progeeks.cmd.swing.SwingCommandProcessor; + import org.progeeks.graph.xml.*; import org.progeeks.meta.*; import org.progeeks.meta.beans.*; |
|
From: <ps...@us...> - 2006-02-28 04:39:56
|
Update of /cvsroot/nwntools/dev/src/java/org/progeeks/nwn/io/xml In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22688/src/java/org/progeeks/nwn/io/xml Removed Files: GraphObjectHandler.java GraphXmlRenderer.java Log Message: These don't seem to be used anymore and in any case meta-jb has newer versions that should be better (and maintained). --- GraphObjectHandler.java DELETED --- --- GraphXmlRenderer.java DELETED --- |
|
From: <pww...@us...> - 2006-02-18 15:18:34
|
Update of /cvsroot/nwntools/dev/src/java/org/progeeks/nwn In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21117/src/java/org/progeeks/nwn Modified Files: ModPacker.java Log Message: Didn't know you had your own version of the BinaryDataOutputStream already. My recent addition to meta-jb made this reference ambiguous. Index: ModPacker.java =================================================================== RCS file: /cvsroot/nwntools/dev/src/java/org/progeeks/nwn/ModPacker.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** ModPacker.java 14 May 2005 19:54:01 -0000 1.11 --- ModPacker.java 18 Feb 2006 15:18:25 -0000 1.12 *************** *** 39,42 **** --- 39,43 ---- import org.progeeks.nwn.io.*; + import org.progeeks.nwn.io.BinaryDataOutputStream; import org.progeeks.nwn.io.itp.*; import org.progeeks.nwn.itp.*; |
|
From: <ps...@us...> - 2005-12-29 20:49:44
|
Update of /cvsroot/nwntools/dev/src/java/org/progeeks/nwn/status In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27448/src/java/org/progeeks/nwn/status Modified Files: HtmlGeneratingProcessor.java ServerState.java Log Message: Modified to output basic (very basic) HTML so that it is now sort of functional. Not pretty, but functional. Index: HtmlGeneratingProcessor.java =================================================================== RCS file: /cvsroot/nwntools/dev/src/java/org/progeeks/nwn/status/HtmlGeneratingProcessor.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** HtmlGeneratingProcessor.java 28 Dec 2005 22:38:28 -0000 1.7 --- HtmlGeneratingProcessor.java 29 Dec 2005 20:49:35 -0000 1.8 *************** *** 96,113 **** protected void writeServerState() throws IOException { - // Just for testing, just dump some stuff FileWriter fOut = new FileWriter( outputFile ); PrintWriter out = new PrintWriter( fOut ); try { ! out.println( "Server options:" + server.getServerOptions() ); ! out.println( "Module:" + server.getModuleName() ); ! out.println( "Online:" + server.isOnline() ); ! out.println( "Players:" ); for( Iterator i = server.getPlayers().iterator(); i.hasNext(); ) { Player p = (Player)i.next(); ! out.println( " " + p.getName() + " Online:" + p.isOnline() ); } } finally --- 96,146 ---- protected void writeServerState() throws IOException { FileWriter fOut = new FileWriter( outputFile ); PrintWriter out = new PrintWriter( fOut ); try { ! // Just generate some raw HTML. ! out.println( "<html><title>Server Status Page</title>" ); ! out.println( "<body>" ); ! if( server.isOnline() ) ! { ! out.println( "<h2>Module:" + server.getModuleName() + "</h2>" ); ! out.println( "Online since:" + server.getStartupTime() ); ! } ! else ! { ! out.println( "<h2>Server Offline</h2>" ); ! out.println( "Offline since:" + server.getShutdownTime() ); ! } ! ! out.println( "<h2>Online Players:</h2>" ); ! out.println( "<table border='1'>" ); for( Iterator i = server.getPlayers().iterator(); i.hasNext(); ) { Player p = (Player)i.next(); ! if( p.isOnline() ) ! { ! out.print( "<tr><td>" + p.getName() + "</td>" ); ! out.println( "</tr>" ); ! } ! } ! out.println( "</table>" ); ! ! out.println( "<h2>Offline Players:</h2>" ); ! out.println( "<table border='1'>" ); ! for( Iterator i = server.getPlayers().iterator(); i.hasNext(); ) ! { ! Player p = (Player)i.next(); ! if( !p.isOnline() ) ! { ! out.print( "<tr><td>" + p.getName() + "</td>" ); ! out.println( "</tr>" ); ! } } + out.println( "</table>" ); + + out.println( "Page last updated:" + new Date() ); + + out.println( "</body></html>" ); } finally Index: ServerState.java =================================================================== RCS file: /cvsroot/nwntools/dev/src/java/org/progeeks/nwn/status/ServerState.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ServerState.java 28 Dec 2005 22:38:28 -0000 1.4 --- ServerState.java 29 Dec 2005 20:49:35 -0000 1.5 *************** *** 83,86 **** --- 83,89 ---- private boolean + private Date startupTime; + private Date shutdownTime; + public ServerState() { *************** *** 97,100 **** --- 100,117 ---- } + public Date getStartupTime() + { + if( online ) + return( startupTime ); + return( null ); + } + + public Date getShutdownTime() + { + if( !online ) + return( shutdownTime ); + return( null ); + } + /** * Processes the parsed object to update the server state by *************** *** 131,134 **** --- 148,152 ---- options = new HashMap(); options.putAll( event ); + startupTime = event.getEventTime(); return( true ); } *************** *** 138,141 **** --- 156,160 ---- module = null; options = null; + shutdownTime = event.getEventTime(); return( true ); } |
|
From: <ps...@us...> - 2005-12-29 20:49:14
|
Update of /cvsroot/nwntools/dev/data In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27329/data Modified Files: sample-web-gen.xml Added Files: log-grammar.xml Log Message: Moved the grammar part of the configuration out to its own file. This makes it easier to include the standard log grammar in other configurations. --- NEW FILE: log-grammar.xml --- <!-- Included in the log processor configuration files as a standard grammar. This is the "grammar" used to parse the log file as we go. Currently, the generator will call the find() method to parse it which operates like Java's regex Pattern.find() and will therefore skip parts of the input that it doesn't understand. This is easier than trying to define a fully inclusive grammar or having to build .* in directly. --> <orPattern> <children> <xml.preload> <mapProduction xml.oid="mapProduction" /> <serverEventProduction xml.oid="eventProduction" /> <!-- A date that we can reference in other sequences. --> <!-- "[Sat Dec 24 01:54:42]" for example --> <sequence name="date" xml.oid="date.pattern" > <children> <!-- We could parse out the separate date components but it's easier to get Java to create a Date object for us from a full string. --> <regexPattern regex="\[" /> <regexPattern regex="(Sun|Mon|Tue|Wed|Thu|Fri|Sat) (Jan|Fed|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) \d+ \d{2}:\d{2}:\d{2}" > <productionFactory> <dateProduction /> </productionFactory> </regexPattern> <regexPattern regex="\] ?" /> </children> </sequence> <!-- date --> </xml.preload> <!-- Look for the lines we're interested in. --> <!-- Swallow the generic debug string things. --> <regexPattern regex="GENERIC SCRIPT DEBUG STRING.*" /> <!-- Pattern for player joining messages. --> <sequence2 name="playerJoined" > <productionFactory><xml.ref oid="eventProduction"/></productionFactory> <children> <xml.ref oid="date.pattern" /> <!-- We need the lookahead so that we skip spaces embedded in the player part. Sequence2 is smart but not that smart. It only looks ahead one pattern and since I wanted to add the " " swallowing I needed the look-ahead. --> <regexPattern name="player" regex=".*(?= \(\w+\))" /> <regexPattern regex=" " /> <regexPattern name="key" regex="\(\w+\)" /> <regexPattern regex=" Joined as Player " /> <regexPattern name="slot" regex="\d+" /> </children> </sequence2> <!-- Pattern for player left messages." --> <sequence2 name="playerLeft" > <productionFactory><xml.ref oid="eventProduction"/></productionFactory> <children> <xml.ref oid="date.pattern" /> <regexPattern name="player" regex=".*" /> <regexPattern regex=" Left as a Player \(\d+ players left\)" /> </children> </sequence2> <!-- Creature death message. --> <sequence2 name="pcDeath" > <productionFactory><xml.ref oid="eventProduction"/></productionFactory> <children> <xml.ref oid="date.pattern" /> <regexPattern name="playerCharacter" regex=".*" /> <regexPattern regex="\(PC\) Died" /> </children> </sequence2> <!-- Creature death message. --> <sequence2 name="creatureDeath" > <productionFactory><xml.ref oid="eventProduction"/></productionFactory> <children> <xml.ref oid="date.pattern" /> <regexPattern name="creature" regex=".*" /> <regexPattern regex=" Died" /> </children> </sequence2> <!-- Look for the server startup and shutdown information. --> <sequence name="shutdown" > <productionFactory><xml.ref oid="eventProduction"/></productionFactory> <children> <xml.ref oid="date.pattern" /> <regexPattern regex="Server Shutting Down" /> </children> </sequence> <sequence name="startup" > <productionFactory><xml.ref oid="eventProduction"/></productionFactory> <children> <xml.ref oid="date.pattern" /> <regexPattern regex="---- Server Options ----\r?\n" /> <repeatPattern > <childPattern> <orPattern> <children> <sequence> <children> <regexPattern regex="Max Players: " /> <regexPattern name="maxPlayers" regex="\d+" /> <regexPattern regex="\r?\n" /> </children> </sequence> <sequence name="allowedLevels" > <children> <regexPattern regex="Char Levels: \(" /> <regexPattern name="minimum" regex="\d+" /> <regexPattern regex="-" /> <regexPattern name="maximum" regex="\d+" /> <regexPattern regex="\)\r?\n" /> </children> </sequence> <sequence> <children> <regexPattern regex="Player Password: " /> <regexPattern name="hasPassword" regex=".*" /> <regexPattern regex="\r?\n" /> </children> </sequence> <sequence> <children> <regexPattern regex="DM Login Enabled: " /> <regexPattern name="dmLoginEnabled" regex=".*" /> <regexPattern regex="\r?\n" /> </children> </sequence> <sequence> <children> <regexPattern regex="Server Admin Login Enabled: " /> <regexPattern name="adminLoginEnabled" regex=".*" /> <regexPattern regex="\r?\n" /> </children> </sequence> <sequence> <children> <regexPattern regex="Post Game To Internet: " /> <regexPattern name="isPublic" regex=".*" /> <regexPattern regex="\r?\n" /> </children> </sequence> <sequence> <children> <regexPattern regex="Game Type: " /> <regexPattern name="gameType" regex=".*" /> <regexPattern regex="\r?\n" /> </children> </sequence> <sequence> <children> <regexPattern regex="Difficulty: " /> <regexPattern name="difficulty" regex="\d+" /> <regexPattern regex="\r?\n" /> </children> </sequence> <sequence> <children> <regexPattern regex="PVP Setting: " /> <regexPattern name="pvpSetting" regex=".*" /> <regexPattern regex="\r?\n" /> </children> </sequence> <sequence> <children> <regexPattern regex="Vault: " /> <regexPattern name="vaultType" regex=".*" /> <regexPattern regex="\r?\n" /> </children> </sequence> <sequence> <children> <regexPattern regex="Only One Party: " /> <regexPattern name="onlyOneParty" regex=".*" /> <regexPattern regex="\r?\n" /> </children> </sequence> <sequence> <children> <regexPattern regex="Enforce Legal Characters: " /> <regexPattern name="elc" regex=".*" /> <regexPattern regex="\r?\n" /> </children> </sequence> <sequence> <children> <regexPattern regex="Item Level Restrictions: " /> <regexPattern name="levelRestrictions" regex=".*" /> <regexPattern regex="\r?\n" /> </children> </sequence> <sequence> <children> <regexPattern regex="Player pausing: " /> <regexPattern name="playerPausing" regex=".*" /> <regexPattern regex="\r?\n" /> </children> </sequence> <sequence> <children> <regexPattern regex="Auto Save: " /> <regexPattern name="autosave" regex=".*" /> <regexPattern regex="\r?\n" /> </children> </sequence> <sequence> <children> <regexPattern name="charsInSavedGame" regex="Saving Characters in Saved Game" /> <regexPattern regex="\r?\n" /> </children> </sequence> <!-- Need the negative look-ahead so that we won't capture the End Server Options line by mistake. --> <regexPattern name="unknownOption" regex="(?!----).*\r?\n" /> </children> </orPattern> </childPattern> </repeatPattern> <regexPattern regex="---- End Server Options ----" /> </children> </sequence> <sequence name="moduleLoaded" > <productionFactory><xml.ref oid="eventProduction"/></productionFactory> <children> <xml.ref oid="date.pattern" /> <regexPattern regex="Loading Module: " /> <regexPattern name="module" regex=".*" /> </children> </sequence> </children> </orPattern> Index: sample-web-gen.xml =================================================================== RCS file: /cvsroot/nwntools/dev/data/sample-web-gen.xml,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** sample-web-gen.xml 28 Dec 2005 22:33:15 -0000 1.15 --- sample-web-gen.xml 29 Dec 2005 20:49:06 -0000 1.16 *************** *** 1,6 **** <!-- Basic configuration for the web status generator utility. --> - <logFileProcessor commitInterval="5000" readInterval="1000" > --- 1,8 ---- + <!DOCTYPE logFileProcessor [ + <!ENTITY logFileGrammar SYSTEM "file:data/log-grammar.xml"> + ]> <!-- Basic configuration for the web status generator utility. --> <logFileProcessor commitInterval="5000" readInterval="1000" > *************** *** 10,280 **** <logFile>testlog2.txt</logFile>--> ! <!-- We could include this from a separate XML file but ! it's easy enough to configure here. ! This is the "grammar" used to parse the log file as we ! go. Currently, the generator will call the find() method ! to parse it which operates like Java's regex Pattern.find() ! and will therefore skip parts of the input that it doesn't ! understand. This is easier than trying to define a fully ! inclusive grammar or having to build .* in directly. --> ! <rootPattern> ! <orPattern> ! <children> ! ! <xml.preload> ! <mapProduction xml.oid="mapProduction" /> ! <serverEventProduction xml.oid="eventProduction" /> ! ! <!-- A date that we can reference in other sequences. --> ! <!-- "[Sat Dec 24 01:54:42]" for example --> ! <sequence name="date" xml.oid="date.pattern" > ! ! <children> ! <!-- We could parse out the separate date components ! but it's easier to get Java to create a Date object ! for us from a full string. --> ! <regexPattern regex="\[" /> ! <regexPattern regex="(Sun|Mon|Tue|Wed|Thu|Fri|Sat) (Jan|Fed|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) \d+ \d{2}:\d{2}:\d{2}" > ! <productionFactory> ! <dateProduction /> ! </productionFactory> ! </regexPattern> ! <regexPattern regex="\] ?" /> ! </children> ! </sequence> <!-- date --> ! </xml.preload> ! ! <!-- Look for the lines we're interested in. --> ! ! <!-- Swallow the generic debug string things. --> ! <regexPattern regex="GENERIC SCRIPT DEBUG STRING.*" /> ! ! <!-- Pattern for player joining messages. --> ! <sequence2 name="playerJoined" > ! <productionFactory><xml.ref oid="eventProduction"/></productionFactory> ! <children> ! <xml.ref oid="date.pattern" /> ! ! <!-- We need the lookahead so that we skip spaces ! embedded in the player part. Sequence2 is smart ! but not that smart. It only looks ahead one pattern ! and since I wanted to add the " " swallowing I needed ! the look-ahead. --> ! <regexPattern name="player" regex=".*(?= \(\w+\))" /> ! <regexPattern regex=" " /> ! <regexPattern name="key" regex="\(\w+\)" /> ! <regexPattern regex=" Joined as Player " /> ! <regexPattern name="slot" regex="\d+" /> ! </children> ! </sequence2> ! ! <!-- Pattern for player left messages." --> ! <sequence2 name="playerLeft" > ! <productionFactory><xml.ref oid="eventProduction"/></productionFactory> ! <children> ! <xml.ref oid="date.pattern" /> ! ! <regexPattern name="player" regex=".*" /> ! <regexPattern regex=" Left as a Player \(\d+ players left\)" /> ! </children> ! </sequence2> ! ! <!-- Creature death message. --> ! <sequence2 name="pcDeath" > ! <productionFactory><xml.ref oid="eventProduction"/></productionFactory> ! <children> ! <xml.ref oid="date.pattern" /> ! ! <regexPattern name="playerCharacter" regex=".*" /> ! <regexPattern regex="\(PC\) Died" /> ! </children> ! </sequence2> ! ! <!-- Creature death message. --> ! <sequence2 name="creatureDeath" > ! <productionFactory><xml.ref oid="eventProduction"/></productionFactory> ! <children> ! <xml.ref oid="date.pattern" /> ! ! <regexPattern name="creature" regex=".*" /> ! <regexPattern regex=" Died" /> ! </children> ! </sequence2> ! ! ! <!-- Look for the server startup and shutdown information. --> ! <sequence name="shutdown" > ! <productionFactory><xml.ref oid="eventProduction"/></productionFactory> ! <children> ! <xml.ref oid="date.pattern" /> ! <regexPattern regex="Server Shutting Down" /> ! </children> ! </sequence> ! ! <sequence name="startup" > ! <productionFactory><xml.ref oid="eventProduction"/></productionFactory> ! <children> ! <xml.ref oid="date.pattern" /> ! <regexPattern regex="---- Server Options ----\r?\n" /> ! ! <repeatPattern > ! <childPattern> ! <orPattern> ! <children> ! <sequence> ! <children> ! <regexPattern regex="Max Players: " /> ! <regexPattern name="maxPlayers" regex="\d+" /> ! <regexPattern regex="\r?\n" /> ! </children> ! </sequence> ! ! <sequence name="allowedLevels" > ! <children> ! <regexPattern regex="Char Levels: \(" /> ! <regexPattern name="minimum" regex="\d+" /> ! <regexPattern regex="-" /> ! <regexPattern name="maximum" regex="\d+" /> ! <regexPattern regex="\)\r?\n" /> ! </children> ! </sequence> ! ! <sequence> ! <children> ! <regexPattern regex="Player Password: " /> ! <regexPattern name="hasPassword" regex=".*" /> ! <regexPattern regex="\r?\n" /> ! </children> ! </sequence> ! ! <sequence> ! <children> ! <regexPattern regex="DM Login Enabled: " /> ! <regexPattern name="dmLoginEnabled" regex=".*" /> ! <regexPattern regex="\r?\n" /> ! </children> ! </sequence> ! ! <sequence> ! <children> ! <regexPattern regex="Server Admin Login Enabled: " /> ! <regexPattern name="adminLoginEnabled" regex=".*" /> ! <regexPattern regex="\r?\n" /> ! </children> ! </sequence> ! ! <sequence> ! <children> ! <regexPattern regex="Post Game To Internet: " /> ! <regexPattern name="isPublic" regex=".*" /> ! <regexPattern regex="\r?\n" /> ! </children> ! </sequence> ! ! <sequence> ! <children> ! <regexPattern regex="Game Type: " /> ! <regexPattern name="gameType" regex=".*" /> ! <regexPattern regex="\r?\n" /> ! </children> ! </sequence> ! ! <sequence> ! <children> ! <regexPattern regex="Difficulty: " /> ! <regexPattern name="difficulty" regex="\d+" /> ! <regexPattern regex="\r?\n" /> ! </children> ! </sequence> ! ! <sequence> ! <children> ! <regexPattern regex="PVP Setting: " /> ! <regexPattern name="pvpSetting" regex=".*" /> ! <regexPattern regex="\r?\n" /> ! </children> ! </sequence> ! ! <sequence> ! <children> ! <regexPattern regex="Vault: " /> ! <regexPattern name="vaultType" regex=".*" /> ! <regexPattern regex="\r?\n" /> ! </children> ! </sequence> ! ! <sequence> ! <children> ! <regexPattern regex="Only One Party: " /> ! <regexPattern name="onlyOneParty" regex=".*" /> ! <regexPattern regex="\r?\n" /> ! </children> ! </sequence> ! ! <sequence> ! <children> ! <regexPattern regex="Enforce Legal Characters: " /> ! <regexPattern name="elc" regex=".*" /> ! <regexPattern regex="\r?\n" /> ! </children> ! </sequence> ! ! <sequence> ! <children> ! <regexPattern regex="Item Level Restrictions: " /> ! <regexPattern name="levelRestrictions" regex=".*" /> ! <regexPattern regex="\r?\n" /> ! </children> ! </sequence> ! ! <sequence> ! <children> ! <regexPattern regex="Player pausing: " /> ! <regexPattern name="playerPausing" regex=".*" /> ! <regexPattern regex="\r?\n" /> ! </children> ! </sequence> ! ! <sequence> ! <children> ! <regexPattern regex="Auto Save: " /> ! <regexPattern name="autosave" regex=".*" /> ! <regexPattern regex="\r?\n" /> ! </children> ! </sequence> ! ! <sequence> ! <children> ! <regexPattern name="charsInSavedGame" ! regex="Saving Characters in Saved Game" /> ! <regexPattern regex="\r?\n" /> ! </children> ! </sequence> ! ! <!-- Need the negative look-ahead so that we won't capture ! the End Server Options line by mistake. --> ! <regexPattern name="unknownOption" regex="(?!----).*\r?\n" /> ! </children> ! </orPattern> ! </childPattern> ! </repeatPattern> ! ! <regexPattern regex="---- End Server Options ----" /> ! </children> ! </sequence> ! ! <sequence name="moduleLoaded" > ! <productionFactory><xml.ref oid="eventProduction"/></productionFactory> ! <children> ! <xml.ref oid="date.pattern" /> ! ! <regexPattern regex="Loading Module: " /> ! <regexPattern name="module" regex=".*" /> ! </children> ! </sequence> ! ! </children> ! </orPattern> </rootPattern> --- 12,18 ---- <logFile>testlog2.txt</logFile>--> ! <!-- Grammar configuration included from a separate XML file. --> <rootPattern> ! &logFileGrammar; </rootPattern> |
|
From: <ps...@us...> - 2005-12-28 22:52:47
|
Update of /cvsroot/nwntools/dev In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18763 Modified Files: build.xml Log Message: Changes to allow conditional compilation of freemarker specific classes. Index: build.xml =================================================================== RCS file: /cvsroot/nwntools/dev/build.xml,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** build.xml 28 Feb 2005 11:32:04 -0000 1.11 --- build.xml 28 Dec 2005 22:52:39 -0000 1.12 *************** *** 65,68 **** --- 65,72 ---- <!-- Create the build directory structure used by compile --> <mkdir dir="${build.classes}"/> + + <!-- Some checks for conditional external libs. --> + <available classname="freemarker.template.Configuration" classpathref="build.classpath" + property="freemarker.present" /> </target> *************** *** 71,75 **** <javac srcdir="${src}/java" destdir="${build.classes}" deprecation="${javac.deprecation}" debug="${javac.debug}" optimize="${javac.optimize}" ! excludes="${javac.excludes}" classpathref="build.classpath" /> </target> --- 75,90 ---- <javac srcdir="${src}/java" destdir="${build.classes}" deprecation="${javac.deprecation}" debug="${javac.debug}" optimize="${javac.optimize}" ! excludes="${javac.excludes}" classpathref="build.classpath" > ! <exclude name="org/progeeks/nwn/status/fm/**" /> ! </javac> ! </target> ! ! <target name="compile.freemarker" depends="init" if="freemarker.present" > ! <!-- Compile the java code from ${src} into ${build} --> ! <javac srcdir="${src}/java" destdir="${build.classes}" deprecation="${javac.deprecation}" ! debug="${javac.debug}" optimize="${javac.optimize}" ! excludes="${javac.excludes}" classpathref="build.classpath" > ! <include name="org/progeeks/nwn/status/fm/**" /> ! </javac> </target> *************** *** 123,127 **** </target> ! <target name="build" depends="compile,rmic,java.resources"> </target> --- 138,142 ---- </target> ! <target name="build" depends="compile,compile.freemarker,rmic,java.resources"> </target> |
|
From: <ps...@us...> - 2005-12-28 22:38:36
|
Update of /cvsroot/nwntools/dev/src/java/org/progeeks/nwn/status In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15346/src/java/org/progeeks/nwn/status Modified Files: HtmlGeneratingProcessor.java ServerState.java Log Message: Moved more of the event processing into the ServerState object to make the processor less aware of such things. It will make it easier to write alternate processors that way. Index: HtmlGeneratingProcessor.java =================================================================== RCS file: /cvsroot/nwntools/dev/src/java/org/progeeks/nwn/status/HtmlGeneratingProcessor.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** HtmlGeneratingProcessor.java 28 Dec 2005 22:33:40 -0000 1.6 --- HtmlGeneratingProcessor.java 28 Dec 2005 22:38:28 -0000 1.7 *************** *** 36,40 **** import java.util.*; - import org.progeeks.parser.regex.NameValuePair; /** --- 36,39 ---- *************** *** 77,94 **** public boolean processObject( Object obj ) { ! if( obj == null ) ! return( false ); ! if( obj instanceof NameValuePair ) ! { ! // We'll go ahead and peel out the value if it's ! // just an event since it will already have the name ! // embedded ! Object val = ((NameValuePair)obj).getValue(); ! if( val instanceof ServerEvent ) ! return( server.processObject( (ServerEvent)val ) ); ! } ! //return( server.processObject( obj ) ); ! System.out.println( "Unknown event type:" + obj ); ! return( false ); } --- 76,80 ---- public boolean processObject( Object obj ) { ! return( server.processObject( obj ) ); } Index: ServerState.java =================================================================== RCS file: /cvsroot/nwntools/dev/src/java/org/progeeks/nwn/status/ServerState.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ServerState.java 28 Dec 2005 22:33:40 -0000 1.3 --- ServerState.java 28 Dec 2005 22:38:28 -0000 1.4 *************** *** 38,41 **** --- 38,42 ---- import org.progeeks.nwn.gff.*; import org.progeeks.nwn.io.gff.*; + import org.progeeks.parser.regex.NameValuePair; import org.progeeks.util.ExtensionFileFilter; *************** *** 97,103 **** /** ! * Processes the parsed object to update the server state. */ ! public boolean processObject( ServerEvent event ) { String name = event.getName(); --- 98,126 ---- /** ! * Processes the parsed object to update the server state by ! * converting it to a ServerEvent if possible and passing it ! * on to the processEvent() method. */ ! public boolean processObject( Object obj ) ! { ! if( obj == null ) ! return( false ); ! if( obj instanceof NameValuePair ) ! { ! // We'll go ahead and peel out the value if it's ! // just an event since it will already have the name ! // embedded ! Object val = ((NameValuePair)obj).getValue(); ! if( val instanceof ServerEvent ) ! return( processEvent( (ServerEvent)val ) ); ! } ! System.out.println( "Unknown event type:" + obj ); ! return( false ); ! } ! ! /** ! * Processes the parsed event to update the server state. ! */ ! public boolean processEvent( ServerEvent event ) { String name = event.getName(); |
|
From: <ps...@us...> - 2005-12-28 22:33:51
|
Update of /cvsroot/nwntools/dev/src/java/org/progeeks/nwn/status In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14353/src/java/org/progeeks/nwn/status Modified Files: HtmlGeneratingProcessor.java Player.java ServerState.java Log Message: More tracking of player state. This is almost getting to the point where HTML generation would actually be useful. Index: HtmlGeneratingProcessor.java =================================================================== RCS file: /cvsroot/nwntools/dev/src/java/org/progeeks/nwn/status/HtmlGeneratingProcessor.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** HtmlGeneratingProcessor.java 27 Dec 2005 23:14:31 -0000 1.5 --- HtmlGeneratingProcessor.java 28 Dec 2005 22:33:40 -0000 1.6 *************** *** 122,126 **** { Player p = (Player)i.next(); ! out.println( " " + p.getName() ); } } --- 122,126 ---- { Player p = (Player)i.next(); ! out.println( " " + p.getName() + " Online:" + p.isOnline() ); } } Index: Player.java =================================================================== RCS file: /cvsroot/nwntools/dev/src/java/org/progeeks/nwn/status/Player.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Player.java 27 Dec 2005 22:35:14 -0000 1.1 --- Player.java 28 Dec 2005 22:33:40 -0000 1.2 *************** *** 49,54 **** --- 49,59 ---- public class Player { + public static final String EVENT_JOINED = "playerJoined"; + public static final String EVENT_LEFT = "playerLeft"; + private String name; private File playerDirectory; + private boolean + private Map charMap = new HashMap(); public Player( File playerDirectory ) *************** *** 64,67 **** --- 69,102 ---- } + public boolean isOnline() + { + return( online ); + } + + public boolean processEvent( ServerEvent event ) + { + String name = event.getName(); + + if( EVENT_JOINED.equals( name ) ) + { + // Need to record the time too + + } + else if( EVENT_LEFT.equals( name ) ) + { + // Need to record the time too + + } + + System.out.println( "Player event:" + event ); + return( false ); + } + + public boolean hasCharacter( String charName ) + { + return( charMap.containsKey( charName ) ); + } + + /** * Reads the character file to determine name and other information. *************** *** 98,101 **** --- 133,140 ---- System.out.println( "Max hit points" + root.getInt( "MaxHitPoints" ) ); System.out.println( "XP:" + root.getInt( "Experience" ) ); + + String fullName = root.getString( "FirstName" ) + " " + root.getString( "LastName" ); + + charMap.put( fullName, character ); // for now } finally Index: ServerState.java =================================================================== RCS file: /cvsroot/nwntools/dev/src/java/org/progeeks/nwn/status/ServerState.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ServerState.java 27 Dec 2005 23:14:31 -0000 1.2 --- ServerState.java 28 Dec 2005 22:33:40 -0000 1.3 *************** *** 55,58 **** --- 55,66 ---- public static final String EVENT_LOAD_MODULE = "moduleLoaded"; + private static Set playerEvents = new HashSet(); + static + { + playerEvents.add( "pcDeath" ); + playerEvents.add( "playerJoined" ); + playerEvents.add( "playerLeft" ); + } + private File serverVault; *************** *** 114,117 **** --- 122,162 ---- return( true ); } + else if( playerEvents.contains( name ) ) + { + // Find the player + String playerName = (String)event.get( "player" ); + Player p = null; + if( playerName == null ) + { + // See if it's a character event + String charName = (String)event.get( "playerCharacter" ); + if( charName == null ) + { + System.out.println( "Bad player event:" + event ); + return( false ); + } + + // Try to find an online player with that character + p = findPlayerForChar( charName ); + if( p == null ) + { + System.out.println( "Bad character name:" + charName ); + return( false ); + } + } + else + { + // Look up the player + p = (Player)playerMap.get( playerName ); + } + if( p == null ) + { + System.out.println( "No player found for event:" + event ); + return( false ); + } + + return( p.processEvent( event ) ); + } + System.out.println( "event[" + event + "]" ); *************** *** 120,123 **** --- 165,181 ---- } + protected Player findPlayerForChar( String charName ) + { + for( Iterator i = getPlayers().iterator(); i.hasNext(); ) + { + Player p = (Player)i.next(); + if( !p.isOnline() ) + continue; + if( p.hasCharacter( charName ) ) + return( p ); + } + return( null ); + } + /** * Returns the collection of all players known to this server. |
|
From: <ps...@us...> - 2005-12-28 22:33:23
|
Update of /cvsroot/nwntools/dev/data In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14249/data Modified Files: sample-web-gen.xml Log Message: Fixed a missing space in the trailing pattern that was causing it to be captured by the previous pattern. Basically, all player names were having a space appended. Index: sample-web-gen.xml =================================================================== RCS file: /cvsroot/nwntools/dev/data/sample-web-gen.xml,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** sample-web-gen.xml 27 Dec 2005 22:58:58 -0000 1.14 --- sample-web-gen.xml 28 Dec 2005 22:33:15 -0000 1.15 *************** *** 77,81 **** <regexPattern name="player" regex=".*" /> ! <regexPattern regex="Left as a Player \(\d+ players left\)" /> </children> </sequence2> --- 77,81 ---- <regexPattern name="player" regex=".*" /> ! <regexPattern regex=" Left as a Player \(\d+ players left\)" /> </children> </sequence2> *************** *** 87,91 **** <xml.ref oid="date.pattern" /> ! <regexPattern name="creature" regex=".*" /> <regexPattern regex="\(PC\) Died" /> </children> --- 87,91 ---- <xml.ref oid="date.pattern" /> ! <regexPattern name="playerCharacter" regex=".*" /> <regexPattern regex="\(PC\) Died" /> </children> |
|
From: <ps...@us...> - 2005-12-27 23:14:42
|
Update of /cvsroot/nwntools/dev/src/java/org/progeeks/nwn/status In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32059/src/java/org/progeeks/nwn/status Modified Files: HtmlGeneratingProcessor.java ServerState.java Log Message: Starting to track real state. Server state is now tracked and dumped to a file. Next will be players but that will have to wait until later tonight. Then it's just a matter of writing real HTML. Index: HtmlGeneratingProcessor.java =================================================================== RCS file: /cvsroot/nwntools/dev/src/java/org/progeeks/nwn/status/HtmlGeneratingProcessor.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** HtmlGeneratingProcessor.java 27 Dec 2005 22:58:58 -0000 1.4 --- HtmlGeneratingProcessor.java 27 Dec 2005 23:14:31 -0000 1.5 *************** *** 86,92 **** Object val = ((NameValuePair)obj).getValue(); if( val instanceof ServerEvent ) ! return( server.processObject( val ) ); } ! return( server.processObject( obj ) ); } --- 86,94 ---- Object val = ((NameValuePair)obj).getValue(); if( val instanceof ServerEvent ) ! return( server.processObject( (ServerEvent)val ) ); } ! //return( server.processObject( obj ) ); ! System.out.println( "Unknown event type:" + obj ); ! return( false ); } *************** *** 96,101 **** public void commit() { } ! } --- 98,132 ---- public void commit() { + try + { + writeServerState(); + } + catch( IOException e ) + { + throw new RuntimeException( "Error writing server state to:" + outputFile, e ); + } } ! protected void writeServerState() throws IOException ! { ! // Just for testing, just dump some stuff ! FileWriter fOut = new FileWriter( outputFile ); ! PrintWriter out = new PrintWriter( fOut ); ! try ! { ! out.println( "Server options:" + server.getServerOptions() ); ! out.println( "Module:" + server.getModuleName() ); ! out.println( "Online:" + server.isOnline() ); ! out.println( "Players:" ); ! for( Iterator i = server.getPlayers().iterator(); i.hasNext(); ) ! { ! Player p = (Player)i.next(); ! out.println( " " + p.getName() ); ! } ! } ! finally ! { ! out.close(); ! } ! } } Index: ServerState.java =================================================================== RCS file: /cvsroot/nwntools/dev/src/java/org/progeeks/nwn/status/ServerState.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ServerState.java 27 Dec 2005 22:35:14 -0000 1.1 --- ServerState.java 27 Dec 2005 23:14:31 -0000 1.2 *************** *** 51,54 **** --- 51,58 ---- public class ServerState { + public static final String EVENT_STARTUP = "startup"; + public static final String EVENT_SHUTDOWN = "shutdown"; + public static final String EVENT_LOAD_MODULE = "moduleLoaded"; + private File serverVault; *************** *** 58,61 **** --- 62,77 ---- private Map playerMap = new HashMap(); + /** + * The current module being run. + */ + private String module; + + /** + * The current server options. + */ + private Map options; + + private boolean + public ServerState() { *************** *** 75,83 **** * Processes the parsed object to update the server state. */ ! public boolean processObject( Object obj ) { ! System.out.println( "event[" + obj + "]" ); ! return( true ); } --- 91,156 ---- * Processes the parsed object to update the server state. */ ! public boolean processObject( ServerEvent event ) { ! String name = event.getName(); ! if( EVENT_STARTUP.equals( name ) ) ! { ! ! options = new HashMap(); ! options.putAll( event ); ! return( true ); ! } ! else if( EVENT_SHUTDOWN.equals( name ) ) ! { ! ! module = null; ! options = null; ! return( true ); ! } ! else if( EVENT_LOAD_MODULE.equals( name ) ) ! { ! module = String.valueOf(event.get( "module" )); ! return( true ); ! } ! ! System.out.println( "event[" + event + "]" ); ! ! return( false ); ! } ! ! /** ! * Returns the collection of all players known to this server. ! */ ! public Collection getPlayers() ! { ! return( playerMap.values() ); ! } ! ! /** ! * Returns the name of the module being run currently or null ! * if the server is offline or does not have a module loaded. ! */ ! public String getModuleName() ! { ! return( module ); ! } ! ! /** ! * Returns a map containing all of the server options or null ! * if the server is currently offline. ! */ ! public Map getServerOptions() ! { ! return( options ); ! } ! ! /** ! * Returns true if the server is currently online according ! * to the latest log events. ! */ ! public boolean isOnline() ! { ! return( online ); } |
|
From: <ps...@us...> - 2005-12-27 22:59:07
|
Update of /cvsroot/nwntools/dev/data In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27214/data Modified Files: sample-web-gen.xml Log Message: Fleshing out a more well defined server event. This is necessary for the server to track things like last event time. Since the server may go down without getting logoff messages for the players then the only way to track valid on/off times is by also keeping track of when the last server event was received. Index: sample-web-gen.xml =================================================================== RCS file: /cvsroot/nwntools/dev/data/sample-web-gen.xml,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** sample-web-gen.xml 27 Dec 2005 22:35:14 -0000 1.13 --- sample-web-gen.xml 27 Dec 2005 22:58:58 -0000 1.14 *************** *** 25,28 **** --- 25,29 ---- <xml.preload> <mapProduction xml.oid="mapProduction" /> + <serverEventProduction xml.oid="eventProduction" /> <!-- A date that we can reference in other sequences. --> *************** *** 52,56 **** <!-- Pattern for player joining messages. --> <sequence2 name="playerJoined" > ! <productionFactory><xml.ref oid="mapProduction"/></productionFactory> <children> <xml.ref oid="date.pattern" /> --- 53,57 ---- <!-- Pattern for player joining messages. --> <sequence2 name="playerJoined" > ! <productionFactory><xml.ref oid="eventProduction"/></productionFactory> <children> <xml.ref oid="date.pattern" /> *************** *** 71,75 **** <!-- Pattern for player left messages." --> <sequence2 name="playerLeft" > ! <productionFactory><xml.ref oid="mapProduction"/></productionFactory> <children> <xml.ref oid="date.pattern" /> --- 72,76 ---- <!-- Pattern for player left messages." --> <sequence2 name="playerLeft" > ! <productionFactory><xml.ref oid="eventProduction"/></productionFactory> <children> <xml.ref oid="date.pattern" /> *************** *** 82,86 **** <!-- Creature death message. --> <sequence2 name="pcDeath" > ! <productionFactory><xml.ref oid="mapProduction"/></productionFactory> <children> <xml.ref oid="date.pattern" /> --- 83,87 ---- <!-- Creature death message. --> <sequence2 name="pcDeath" > ! <productionFactory><xml.ref oid="eventProduction"/></productionFactory> <children> <xml.ref oid="date.pattern" /> *************** *** 93,97 **** <!-- Creature death message. --> <sequence2 name="creatureDeath" > ! <productionFactory><xml.ref oid="mapProduction"/></productionFactory> <children> <xml.ref oid="date.pattern" /> --- 94,98 ---- <!-- Creature death message. --> <sequence2 name="creatureDeath" > ! <productionFactory><xml.ref oid="eventProduction"/></productionFactory> <children> <xml.ref oid="date.pattern" /> *************** *** 105,109 **** <!-- Look for the server startup and shutdown information. --> <sequence name="shutdown" > ! <productionFactory><xml.ref oid="mapProduction"/></productionFactory> <children> <xml.ref oid="date.pattern" /> --- 106,110 ---- <!-- Look for the server startup and shutdown information. --> <sequence name="shutdown" > ! <productionFactory><xml.ref oid="eventProduction"/></productionFactory> <children> <xml.ref oid="date.pattern" /> *************** *** 113,117 **** <sequence name="startup" > ! <productionFactory><xml.ref oid="mapProduction"/></productionFactory> <children> <xml.ref oid="date.pattern" /> --- 114,118 ---- <sequence name="startup" > ! <productionFactory><xml.ref oid="eventProduction"/></productionFactory> <children> <xml.ref oid="date.pattern" /> *************** *** 265,269 **** <sequence name="moduleLoaded" > ! <productionFactory><xml.ref oid="mapProduction"/></productionFactory> <children> <xml.ref oid="date.pattern" /> --- 266,270 ---- <sequence name="moduleLoaded" > ! <productionFactory><xml.ref oid="eventProduction"/></productionFactory> <children> <xml.ref oid="date.pattern" /> |
|
From: <ps...@us...> - 2005-12-27 22:59:07
|
Update of /cvsroot/nwntools/dev/src/java/org/progeeks/nwn/status In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27214/src/java/org/progeeks/nwn/status Modified Files: HtmlGeneratingProcessor.java Added Files: ServerEvent.java ServerEventProduction.java Log Message: Fleshing out a more well defined server event. This is necessary for the server to track things like last event time. Since the server may go down without getting logoff messages for the players then the only way to track valid on/off times is by also keeping track of when the last server event was received. --- NEW FILE: ServerEvent.java --- /* * $Id: ServerEvent.java,v 1.1 2005/12/27 22:58:58 pspeed Exp $ * * Copyright (c) 2005, Paul Speed * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1) Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2) Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3) Neither the names "Progeeks", "NWN Tools", nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ package org.progeeks.nwn.status; import java.util.*; /** * Represents a timestamped parsed event from the server. * * @version $Revision: 1.1 $ * @author Paul Speed */ public class ServerEvent extends HashMap { private String name; private Date time; public ServerEvent( String name, Map original ) { this.name = name; Object t = original.remove( "date" ); while( t instanceof List ) t = ((List)t).get(0); time = (Date)t; putAll( original ); } public String getName() { return( name ); } public Date getEventTime() { return( time ); } public String toString() { return( name + " @ " + time + " " + super.toString() ); } } --- NEW FILE: ServerEventProduction.java --- /* * $Id: ServerEventProduction.java,v 1.1 2005/12/27 22:58:58 pspeed Exp $ * * Copyright (c) 2005, Paul Speed * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1) Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2) Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3) Neither the names "Progeeks", "NWN Tools", nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ package org.progeeks.nwn.status; import java.util.*; import org.progeeks.parser.regex.*; /** * * @version $Revision: 1.1 $ * @author Paul Speed */ public class ServerEventProduction extends MapProduction { public Object createProduction( CompositeMatcher matcher, String name, Object value ) { if( value instanceof List ) { Map m = new HashMap(); applyList( m, (List)value ); value = new ServerEvent( name, m ); } return( super.createProduction( matcher, name, value ) ); } } Index: HtmlGeneratingProcessor.java =================================================================== RCS file: /cvsroot/nwntools/dev/src/java/org/progeeks/nwn/status/HtmlGeneratingProcessor.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** HtmlGeneratingProcessor.java 27 Dec 2005 22:35:14 -0000 1.3 --- HtmlGeneratingProcessor.java 27 Dec 2005 22:58:58 -0000 1.4 *************** *** 36,39 **** --- 36,41 ---- import java.util.*; + import org.progeeks.parser.regex.NameValuePair; + /** * Keeps track of NWN server state and writes it to HTML when *************** *** 75,78 **** --- 77,91 ---- public boolean processObject( Object obj ) { + if( obj == null ) + return( false ); + if( obj instanceof NameValuePair ) + { + // We'll go ahead and peel out the value if it's + // just an event since it will already have the name + // embedded + Object val = ((NameValuePair)obj).getValue(); + if( val instanceof ServerEvent ) + return( server.processObject( val ) ); + } return( server.processObject( obj ) ); } |
|
From: <ps...@us...> - 2005-12-27 22:35:27
|
Update of /cvsroot/nwntools/dev/src/java/org/progeeks/nwn/status In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23897/src/java/org/progeeks/nwn/status Modified Files: HtmlGeneratingProcessor.java Added Files: Player.java ServerState.java Log Message: Started breaking out responsibilities into separate model objects. --- NEW FILE: Player.java --- /* * $Id: Player.java,v 1.1 2005/12/27 22:35:14 pspeed Exp $ * * Copyright (c) 2005, Paul Speed * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1) Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2) Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3) Neither the names "Progeeks", "NWN Tools", nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ package org.progeeks.nwn.status; import java.io.*; import java.util.*; import org.progeeks.nwn.gff.*; import org.progeeks.nwn.io.gff.*; import org.progeeks.util.ExtensionFileFilter; /** * Tracks the characters and state information for a player. * * @version $Revision: 1.1 $ * @author Paul Speed */ public class Player { private String name; private File playerDirectory; public Player( File playerDirectory ) { this.name = playerDirectory.getName(); this.playerDirectory = playerDirectory; loadCharacters(); } public String getName() { return( name ); } /** * Reads the character file to determine name and other information. */ protected void readCharacter( File character ) throws IOException { FileInputStream in = new FileInputStream( character ); try { GffReader reader = new GffReader( in ); Struct root = reader.readRootStruct(); // For testing //GffReader.printElement( root, " " ); //System.out.println( root ); System.out.println( "First name:" + root.getString( "FirstName" ) ); System.out.println( "Last name:" + root.getString( "LastName" ) ); System.out.println( "Is DM:" + root.getInt( "IsDM" ) ); System.out.println( "Age:" + root.getInt( "Age" ) ); System.out.println( "Gender:" + root.getInt( "Gender" ) ); System.out.println( "Race:" + root.getInt( "Race" ) ); System.out.println( "Subrace:" + root.getString( "Subrace" ) ); System.out.println( "Deity:" + root.getString( "Deity" ) ); System.out.println( "Gold:" + root.getInt( "Gold" ) ); System.out.println( "AC:" + root.getInt( "ArmorClass" ) ); System.out.println( "Natural AC:" + root.getInt( "NaturalAC" ) ); System.out.println( "Str:" + root.getInt( "Str" ) ); System.out.println( "Dex:" + root.getInt( "Dex" ) ); System.out.println( "Int:" + root.getInt( "Int" ) ); System.out.println( "Wis:" + root.getInt( "Wis" ) ); System.out.println( "Con:" + root.getInt( "Con" ) ); System.out.println( "Cha:" + root.getInt( "Cha" ) ); System.out.println( "Hit points:" + root.getInt( "HitPoints" ) ); System.out.println( "Max hit points" + root.getInt( "MaxHitPoints" ) ); System.out.println( "XP:" + root.getInt( "Experience" ) ); } finally { in.close(); } } /** * Loads (or reloads) the player's list of active characters. */ protected void loadCharacters() { File[] chars = playerDirectory.listFiles( new ExtensionFileFilter( "bic" ) ); for( int i = 0; i < chars.length; i++ ) { System.out.println( " character:" + chars[i] ); try { readCharacter( chars[i] ); } catch( IOException e ) { System.out.println( "Error reading character file:" + chars[i] ); e.printStackTrace(); } } } } --- NEW FILE: ServerState.java --- /* * $Id: ServerState.java,v 1.1 2005/12/27 22:35:14 pspeed Exp $ * * Copyright (c) 2005, Paul Speed * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1) Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2) Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3) Neither the names "Progeeks", "NWN Tools", nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ package org.progeeks.nwn.status; import java.io.*; import java.util.*; import org.progeeks.nwn.gff.*; import org.progeeks.nwn.io.gff.*; import org.progeeks.util.ExtensionFileFilter; /** * Keeps the server information and processes new events * to adjust the state. * * @version $Revision: 1.1 $ * @author Paul Speed */ public class ServerState { private File serverVault; /** * Maps player names to a map of their character names and character files. */ private Map playerMap = new HashMap(); public ServerState() { } /** * Sets the location of the NWN server vault. */ public void setServerVault( File file ) { this.serverVault = file; loadPlayerData(); } /** * Processes the parsed object to update the server state. */ public boolean processObject( Object obj ) { System.out.println( "event[" + obj + "]" ); return( true ); } /** * Loads player data from the configured server vault directory. */ protected void loadPlayerData() { File[] players = serverVault.listFiles(); for( int i = 0; i < players.length; i++ ) { if( !players[i].isDirectory() ) continue; System.out.println( "Player:" + players[i] ); Player p = new Player( players[i] ); playerMap.put( p.getName(), p ); } //System.exit(0); } } Index: HtmlGeneratingProcessor.java =================================================================== RCS file: /cvsroot/nwntools/dev/src/java/org/progeeks/nwn/status/HtmlGeneratingProcessor.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** HtmlGeneratingProcessor.java 26 Dec 2005 23:21:36 -0000 1.2 --- HtmlGeneratingProcessor.java 27 Dec 2005 22:35:14 -0000 1.3 *************** *** 36,43 **** import java.util.*; - import org.progeeks.nwn.gff.*; - import org.progeeks.nwn.io.gff.*; - import org.progeeks.util.ExtensionFileFilter; - /** * Keeps track of NWN server state and writes it to HTML when --- 36,39 ---- *************** *** 50,59 **** { private File outputFile; - private File serverVault; ! /** ! * Maps player names to a map of their character names and character files. ! */ ! private Map players = new HashMap(); public HtmlGeneratingProcessor() --- 46,51 ---- { private File outputFile; ! private ServerState server; public HtmlGeneratingProcessor() *************** *** 70,80 **** /** ! * Sets the location of the NWN server vault. */ ! public void setServerVault( File file ) { ! this.serverVault = file; ! ! loadPlayerData(); } --- 62,71 ---- /** ! * Sets the server state object that will keep track of ! * the events that have been processed. */ ! public void setServerStateModel( ServerState state ) { ! this.server = state; } *************** *** 84,90 **** public boolean processObject( Object obj ) { ! System.out.println( "event[" + obj + "]" ); ! ! return( true ); } --- 75,79 ---- public boolean processObject( Object obj ) { ! return( server.processObject( obj ) ); } *************** *** 97,176 **** - /** - * Reads the character file to determine name and other information. - */ - protected void readCharacter( File character ) throws IOException - { - FileInputStream in = new FileInputStream( character ); - try - { - GffReader reader = new GffReader( in ); - Struct root = reader.readRootStruct(); - - // For testing - //GffReader.printElement( root, " " ); - //System.out.println( root ); - System.out.println( "First name:" + root.getString( "FirstName" ) ); - System.out.println( "Last name:" + root.getString( "LastName" ) ); - System.out.println( "Is DM:" + root.getInt( "IsDM" ) ); - System.out.println( "Age:" + root.getInt( "Age" ) ); - System.out.println( "Gender:" + root.getInt( "Gender" ) ); - System.out.println( "Race:" + root.getInt( "Race" ) ); - System.out.println( "Subrace:" + root.getString( "Subrace" ) ); - System.out.println( "Deity:" + root.getString( "Deity" ) ); - System.out.println( "Gold:" + root.getInt( "Gold" ) ); - System.out.println( "AC:" + root.getInt( "ArmorClass" ) ); - System.out.println( "Natural AC:" + root.getInt( "NaturalAC" ) ); - System.out.println( "Str:" + root.getInt( "Str" ) ); - System.out.println( "Dex:" + root.getInt( "Dex" ) ); - System.out.println( "Int:" + root.getInt( "Int" ) ); - System.out.println( "Wis:" + root.getInt( "Wis" ) ); - System.out.println( "Con:" + root.getInt( "Con" ) ); - System.out.println( "Cha:" + root.getInt( "Cha" ) ); - System.out.println( "Hit points:" + root.getInt( "HitPoints" ) ); - System.out.println( "Max hit points" + root.getInt( "MaxHitPoints" ) ); - System.out.println( "XP:" + root.getInt( "Experience" ) ); - } - finally - { - in.close(); - } - } - - /** - * Adds a new player and loads (or reloads) their list of active characters. - */ - protected void addPlayer( File player ) - { - System.out.println( "Player:" + player ); - File[] chars = player.listFiles( new ExtensionFileFilter( "bic" ) ); - for( int i = 0; i < chars.length; i++ ) - { - System.out.println( " character:" + chars[i] ); - try - { - readCharacter( chars[i] ); - } - catch( IOException e ) - { - System.out.println( "Error reading character file:" + chars[i] ); - e.printStackTrace(); - } - } - } - - /** - * Loads player data from the configured server vault directory. - */ - protected void loadPlayerData() - { - File[] players = serverVault.listFiles(); - for( int i = 0; i < players.length; i++ ) - { - if( !players[i].isDirectory() ) - continue; - addPlayer( players[i] ); - } - //System.exit(0); - } } --- 86,88 ---- |
|
From: <ps...@us...> - 2005-12-27 22:35:23
|
Update of /cvsroot/nwntools/dev/data In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23897/data Modified Files: sample-web-gen.xml Log Message: Started breaking out responsibilities into separate model objects. Index: sample-web-gen.xml =================================================================== RCS file: /cvsroot/nwntools/dev/data/sample-web-gen.xml,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** sample-web-gen.xml 27 Dec 2005 22:13:32 -0000 1.12 --- sample-web-gen.xml 27 Dec 2005 22:35:14 -0000 1.13 *************** *** 7,12 **** <logFile>/Games/NWNDedicatedServer/logs.0/nwserverlog1.txt</logFile> ! <!-- <logFile>nwserverlog1.txt</logFile> ! <logFile>testlog2.txt</logFile> --> <!-- We could include this from a separate XML file but --- 7,12 ---- <logFile>/Games/NWNDedicatedServer/logs.0/nwserverlog1.txt</logFile> ! <!--<logFile>nwserverlog1.txt</logFile> ! <logFile>testlog2.txt</logFile>--> <!-- We could include this from a separate XML file but *************** *** 282,287 **** <htmlGeneratingProcessor outputFile="temp.html" > ! <!-- Nested to make it easier to comment out and such. --> ! <serverVault>/Games/NWNDedicatedServer/servervault</serverVault> </htmlGeneratingProcessor> --- 282,291 ---- <htmlGeneratingProcessor outputFile="temp.html" > ! <serverStateModel> ! <serverState > ! <!-- Nested to make it easier to comment out and such. --> ! <serverVault>/Games/NWNDedicatedServer/servervault</serverVault> ! </serverState> ! </serverStateModel> </htmlGeneratingProcessor> |
|
From: <ps...@us...> - 2005-12-27 22:18:52
|
Update of /cvsroot/nwntools/dev/src/java/org/progeeks/nwn/status In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21195/src/java/org/progeeks/nwn/status Modified Files: LogFileProcessor.java Log Message: Modified to only print out the skipped text. This should be enough for most of the debugging that I do. Index: LogFileProcessor.java =================================================================== RCS file: /cvsroot/nwntools/dev/src/java/org/progeeks/nwn/status/LogFileProcessor.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** LogFileProcessor.java 27 Dec 2005 11:10:53 -0000 1.4 --- LogFileProcessor.java 27 Dec 2005 22:18:44 -0000 1.5 *************** *** 88,91 **** --- 88,96 ---- private EventProcessor eventProcessor; + /** + * Set to true for all processed text to be displayed. + */ + private boolean fullOutput = false; + public LogFileProcessor() { *************** *** 167,171 **** } ! System.out.println( "Processing[" + sb + "]" ); CompositeMatcher matcher = rootPattern.matcher( sb ); --- 172,177 ---- } ! if( fullOutput ) ! System.out.println( "Processing[" + sb + "]" ); CompositeMatcher matcher = rootPattern.matcher( sb ); *************** *** 175,178 **** --- 181,198 ---- while( matcher.find() ) { + if( !fullOutput ) + { + // Display the text the was skipped + int start = matcher.start(); + String skipped; + if( end == -1 ) + skipped = sb.substring( 0, start ); + else + skipped = sb.substring( end, start ); + skipped = skipped.trim(); + if( skipped.length() > 0 ) + System.out.println( "Skipped[" + skipped + "]" ); + } + Object value = matcher.getProduction(); |
|
From: <ps...@us...> - 2005-12-27 22:13:41
|
Update of /cvsroot/nwntools/dev/data In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20297/data Modified Files: sample-web-gen.xml Log Message: Added event for module load. Index: sample-web-gen.xml =================================================================== RCS file: /cvsroot/nwntools/dev/data/sample-web-gen.xml,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** sample-web-gen.xml 27 Dec 2005 12:03:22 -0000 1.11 --- sample-web-gen.xml 27 Dec 2005 22:13:32 -0000 1.12 *************** *** 7,12 **** <logFile>/Games/NWNDedicatedServer/logs.0/nwserverlog1.txt</logFile> ! <!--<logFile>nwserverlog1.txt</logFile> ! <logFile>testlog2.txt</logFile>--> <!-- We could include this from a separate XML file but --- 7,12 ---- <logFile>/Games/NWNDedicatedServer/logs.0/nwserverlog1.txt</logFile> ! <!-- <logFile>nwserverlog1.txt</logFile> ! <logFile>testlog2.txt</logFile> --> <!-- We could include this from a separate XML file but *************** *** 264,285 **** </sequence> ! <!-- ! Max Players: 20 ! Char Levels: (1-30) ! Player Password: YES ! DM Login Enabled: NO ! Server Admin Login Enabled: YES ! Post Game To Internet: NO ! Game Type: Action ! Difficulty: 3 ! PVP Setting: PARTY ! Vault: SERVER ! Only One Party: NO ! Enforce Legal Characters: NO ! Item Level Restrictions: NO ! Player pausing: DISABLED ! Auto Save: Enabled ! Saving Characters in Saved Game ! --> </children> --- 264,276 ---- </sequence> ! <sequence name="moduleLoaded" > ! <productionFactory><xml.ref oid="mapProduction"/></productionFactory> ! <children> ! <xml.ref oid="date.pattern" /> ! ! <regexPattern regex="Loading Module: " /> ! <regexPattern name="module" regex=".*" /> ! </children> ! </sequence> </children> |
|
From: <ps...@us...> - 2005-12-27 12:03:30
|
Update of /cvsroot/nwntools/dev/data In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6166/data Modified Files: sample-web-gen.xml Log Message: Updated the configuration to create maps for the various event objects. Index: sample-web-gen.xml =================================================================== RCS file: /cvsroot/nwntools/dev/data/sample-web-gen.xml,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** sample-web-gen.xml 27 Dec 2005 11:47:57 -0000 1.10 --- sample-web-gen.xml 27 Dec 2005 12:03:22 -0000 1.11 *************** *** 7,12 **** <logFile>/Games/NWNDedicatedServer/logs.0/nwserverlog1.txt</logFile> ! <!-- <logFile>nwserverlog1.txt</logFile> ! <logFile>testlog2.txt</logFile> --> <!-- We could include this from a separate XML file but --- 7,12 ---- <logFile>/Games/NWNDedicatedServer/logs.0/nwserverlog1.txt</logFile> ! <!--<logFile>nwserverlog1.txt</logFile> ! <logFile>testlog2.txt</logFile>--> <!-- We could include this from a separate XML file but *************** *** 24,27 **** --- 24,29 ---- <xml.preload> + <mapProduction xml.oid="mapProduction" /> + <!-- A date that we can reference in other sequences. --> <!-- "[Sat Dec 24 01:54:42]" for example --> *************** *** 50,53 **** --- 52,56 ---- <!-- Pattern for player joining messages. --> <sequence2 name="playerJoined" > + <productionFactory><xml.ref oid="mapProduction"/></productionFactory> <children> <xml.ref oid="date.pattern" /> *************** *** 68,71 **** --- 71,75 ---- <!-- Pattern for player left messages." --> <sequence2 name="playerLeft" > + <productionFactory><xml.ref oid="mapProduction"/></productionFactory> <children> <xml.ref oid="date.pattern" /> *************** *** 78,81 **** --- 82,86 ---- <!-- Creature death message. --> <sequence2 name="pcDeath" > + <productionFactory><xml.ref oid="mapProduction"/></productionFactory> <children> <xml.ref oid="date.pattern" /> *************** *** 88,91 **** --- 93,97 ---- <!-- Creature death message. --> <sequence2 name="creatureDeath" > + <productionFactory><xml.ref oid="mapProduction"/></productionFactory> <children> <xml.ref oid="date.pattern" /> *************** *** 99,102 **** --- 105,109 ---- <!-- Look for the server startup and shutdown information. --> <sequence name="shutdown" > + <productionFactory><xml.ref oid="mapProduction"/></productionFactory> <children> <xml.ref oid="date.pattern" /> *************** *** 106,109 **** --- 113,117 ---- <sequence name="startup" > + <productionFactory><xml.ref oid="mapProduction"/></productionFactory> <children> <xml.ref oid="date.pattern" /> |
|
From: <ps...@us...> - 2005-12-27 12:03:21
|
Update of /cvsroot/nwntools/dev/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6052/lib Modified Files: microparser.jar Log Message: MapProduction added. Index: microparser.jar =================================================================== RCS file: /cvsroot/nwntools/dev/lib/microparser.jar,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 Binary files /tmp/cvsmjcRyX and /tmp/cvs4Yhox1 differ |
|
From: <ps...@us...> - 2005-12-27 11:48:06
|
Update of /cvsroot/nwntools/dev/src/java/org/progeeks/nwn/status In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3223/src/java/org/progeeks/nwn/status Added Files: DateProduction.java Log Message: Added a custom production factory for creating Date objects. Modified the config to use it in the grammar. --- NEW FILE: DateProduction.java --- /* * $Id: DateProduction.java,v 1.1 2005/12/27 11:47:57 pspeed Exp $ * * Copyright (c) 2005, Paul Speed * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1) Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2) Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3) Neither the names "Progeeks", "NWN Tools", nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ package org.progeeks.nwn.status; import java.text.*; import java.util.*; import org.progeeks.parser.regex.*; /** * Generates a Date object for a set of parsed date components. * * @version $Revision: 1.1 $ * @author Paul Speed */ public class DateProduction extends NameValueProduction { private static int year = Calendar.getInstance().get( Calendar.YEAR ); private SimpleDateFormat format = new SimpleDateFormat( "EEE MMM d HH:mm:ss yyyy" ); private SimpleDateFormat dayFormat = new SimpleDateFormat( "EEE" ); public Object createProduction( CompositeMatcher m, String name, Object value ) { if( value != null ) { try { // Add our own year and then check the value to see if the // day is right. If not then subtract one and try again. A // kludge but the logs don't include a year... just a day of // the week. String time = (String)value; String day = time.substring( 0, 3 ); String test = ""; int y = year; Date result = null; while( !test.equals(day) ) { result = format.parse( time + " " + y ); // Check the format against our original test = dayFormat.format( result ); y = y - 1; } return( result ); } catch( ParseException e ) { e.printStackTrace(); } } return( super.createProduction( m, name, value ) ); } } |
|
From: <ps...@us...> - 2005-12-27 11:48:06
|
Update of /cvsroot/nwntools/dev/data In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3223/data Modified Files: sample-web-gen.xml Log Message: Added a custom production factory for creating Date objects. Modified the config to use it in the grammar. Index: sample-web-gen.xml =================================================================== RCS file: /cvsroot/nwntools/dev/data/sample-web-gen.xml,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** sample-web-gen.xml 27 Dec 2005 11:10:53 -0000 1.9 --- sample-web-gen.xml 27 Dec 2005 11:47:57 -0000 1.10 *************** *** 6,12 **** readInterval="1000" > ! <!--<logFile>/Games/NWNDedicatedServer/logs.0/nwserverlog1.txt</logFile>--> ! <logFile>nwserverlog1.txt</logFile> ! <!-- <logFile>testlog2.txt</logFile> --> <!-- We could include this from a separate XML file but --- 6,12 ---- readInterval="1000" > ! <logFile>/Games/NWNDedicatedServer/logs.0/nwserverlog1.txt</logFile> ! <!-- <logFile>nwserverlog1.txt</logFile> ! <logFile>testlog2.txt</logFile> --> <!-- We could include this from a separate XML file but *************** *** 27,43 **** <!-- "[Sat Dec 24 01:54:42]" for example --> <sequence name="date" xml.oid="date.pattern" > <children> <regexPattern regex="\[" /> ! <regexPattern name="dayOfWeek" regex="Sun|Mon|Tue|Wed|Thu|Fri|Sat" /> ! <regexPattern regex=" " /> ! <regexPattern name="month" regex="Jan|Fed|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec" /> ! <regexPattern regex=" " /> ! <regexPattern name="day" regex="\d+" /> ! <regexPattern regex=" " /> ! <regexPattern name="hour" regex="\d+" /> ! <regexPattern regex=":" /> ! <regexPattern name="minutes" regex="\d+" /> ! <regexPattern regex=":" /> ! <regexPattern name="seconds" regex="\d+" /> <regexPattern regex="\] ?" /> </children> --- 27,41 ---- <!-- "[Sat Dec 24 01:54:42]" for example --> <sequence name="date" xml.oid="date.pattern" > + <children> + <!-- We could parse out the separate date components + but it's easier to get Java to create a Date object + for us from a full string. --> <regexPattern regex="\[" /> ! <regexPattern regex="(Sun|Mon|Tue|Wed|Thu|Fri|Sat) (Jan|Fed|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) \d+ \d{2}:\d{2}:\d{2}" > ! <productionFactory> ! <dateProduction /> ! </productionFactory> ! </regexPattern> <regexPattern regex="\] ?" /> </children> |
|
From: <ps...@us...> - 2005-12-27 11:47:33
|
Update of /cvsroot/nwntools/dev/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3196/lib Modified Files: microparser.jar Log Message: Bugfix for custom productions in regex patterns. Index: microparser.jar =================================================================== RCS file: /cvsroot/nwntools/dev/lib/microparser.jar,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 Binary files /tmp/cvsd63ox7 and /tmp/cvsI5rs0X differ |
|
From: <ps...@us...> - 2005-12-27 11:11:04
|
Update of /cvsroot/nwntools/dev/data In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30745/data Modified Files: sample-web-gen.xml Log Message: Updates to deal with the new method signatures. New microparser now with production factories. Index: sample-web-gen.xml =================================================================== RCS file: /cvsroot/nwntools/dev/data/sample-web-gen.xml,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** sample-web-gen.xml 27 Dec 2005 09:44:34 -0000 1.8 --- sample-web-gen.xml 27 Dec 2005 11:10:53 -0000 1.9 *************** *** 6,12 **** readInterval="1000" > ! <logFile>/Games/NWNDedicatedServer/logs.0/nwserverlog1.txt</logFile> <logFile>nwserverlog1.txt</logFile> ! <!--<logFile>testlog2.txt</logFile>--> <!-- We could include this from a separate XML file but --- 6,12 ---- readInterval="1000" > ! <!--<logFile>/Games/NWNDedicatedServer/logs.0/nwserverlog1.txt</logFile>--> <logFile>nwserverlog1.txt</logFile> ! <!-- <logFile>testlog2.txt</logFile> --> <!-- We could include this from a separate XML file but *************** *** 47,50 **** --- 47,53 ---- <!-- Look for the lines we're interested in. --> + <!-- Swallow the generic debug string things. --> + <regexPattern regex="GENERIC SCRIPT DEBUG STRING.*" /> + <!-- Pattern for player joining messages. --> <sequence2 name="playerJoined" > |