Lokorin Site Admin
Joined: 03 Apr 2006 Posts: 697
|
Posted: Thu Jun 07, 2007 8:02 am Post subject: Re: Loot Patterns |
|
|
| SuprSurfr wrote: |
I would like to know if the following would be possible.
...
Maybe a pre-processor of some kind?
and if so where would i find such a beast |
Aye, I'm afraid that a preprocessor is the only way to do that (either using the interface integrated into the parser, or running the log through a custom one before sending it to the parser).
I have attached an example preprocessor to give something to start with if you want to use the built in interface. The readme contains information about how to use it and the file "preprocessor.groovy" contains the actual code (written in groovy, which is similar to Java). What you want to do is replace the code in the preprocess method. The code currently opens the log, opens a temporary log file (to dump the result in) and then runs through the log (the while loop) looking for certain lines and writing the important data to the temporary log (resultStream.println(...)). In the end the temporary log is returned, in essence replacing the log that was sent in.
What you basically want to do is to read each line and then do the following checks:
- Does it match your current loot pattern? In that case save the item name and looter in some variable.
- Does it match the pattern for the loot command you posted? In that case modify the line so that the item name is inserted.
After that has been checked you write the line to the result stream. After that has been done the temporary file (saved as "tmp.txt" in the work directory) should be the same as the log you sent in, except that lines such as
have been replaced with something like the following.
| Code: |
| *Loot Bubba - Silver Katana of Power - 100 |
You then change the loot pattern to match the latter (it's the default if I recall correctly). After that's done you just have to parse logs as normal and the preprocessing will be done automatically in the background.
Anyone used with Java should probably be able to do that. If you're not, and can't find anyone who is, then you can always ask the forum (but don't expect a speedy response).
| Description: |
|
 Download |
| Filename: |
ventrilo-preprocessor.zip |
| Filesize: |
8.81 KB |
| Downloaded: |
144 Time(s) |
|
|