Elitist Jerks
Register
Blogs
Forums


Go Back   Elitist Jerks » User Interface and AddOns

Reply
 
LinkBack Thread Tools
Old 10/28/07, 10:46 PM   #1
 pewsey
hey there good lookin'
 
pewsey's Avatar
 
Dwarf Shaman
 
Dragonblight
Parsing CT_Raidtracker LUA save file

I'm ideally looking for a Java library to parse the CT_Raidtracker produced LUA "save file" format for raids/loot.

I'm willing to take absolutely any form of Perl, LUA, PHP in a discrete form that I can run that will parse the LUA and turn it into XML. My only real requirement is that I do not want to have WoW running to do this, and I should be able to point the executable at the CT_RT.lua save file to make it work.

I've Googled, I've downloaded the older versions of the converters in C++ but found they didn't work.

I'm loathe to pull apart CT_Raidtracker so I can run the method from the command line (which is my fallback position) and I'm really hoping that somebody already has done this.

Does anybody have some pointers, a library, or standalone application that I can run to do this ?

Pewsey has heard about tact and discretion, but tends to regard them much as children view vegetables.
There are only two kinds of MMOs: the ones people complain about and the ones nobody plays. (inspired by Bjarne Stroustrup)

Australia Offline
Reply With Quote
Old 11/01/07, 10:56 AM   #2
Kru
Glass Joe
 
Night Elf Warrior
 
Medivh
There's a perl program called RTDE (raid tracker data extractor) that my guild was using for a while as part of its attendance tracking system. It doesn't produce XML but it does make comma delimited files with join times, leave times, and loot, which are a lot easier to work with than the LUA itself.

I can't find it on the internet anymore, but I do still have a copy of it. I also have a few other perl files that further parsed the join/leave time files and produced raid summary files with a breakdown of how long everyone was in the raid, and a monthly file that gave overall attendance percentages.

I don't have the code hosted anywhere, but I'm happy to email it to you if you like.

Offline
Reply With Quote
Old 11/01/07, 11:05 AM   #3
Gere
Von Kaiser
 
Worgen Druid
 
Shandris
Quick question, how do you get CTRA to spit out the LUA file? I use CTRA for tracking as well but I usually update our DKP manually from work the next day so having an export that I can mail to myself at work would be perfect.

Offline
Reply With Quote
Old 11/01/07, 11:11 AM   #4
Kru
Glass Joe
 
Night Elf Warrior
 
Medivh
It's used to maintain the CTRA data between sessions so it's automatically saved out.

It should be buried in your WTF folder somewhere (no wow installation at work to verify the exact location).

Offline
Reply With Quote
Old 11/01/07, 1:18 PM   #5
Malrix
Von Kaiser
 
Malrix's Avatar
 
Human Paladin
 
Draka
What's wrong with the in game export? Or rather, how would the desired output differ from what is generated by the in game export from CT_Raidtracker?

Offline
Reply With Quote
Old 11/02/07, 2:54 AM   #6
 pewsey
hey there good lookin'
 
pewsey's Avatar
 
Dwarf Shaman
 
Dragonblight
Kru - if you could mail that to me to jon@eaves.org I'd be thrilled.

Malrix - when you have 6+ months of raid data in the lua file, I don't want to do it by hand, and I want something to automatically generate it from the lua file.

This is something that can be done offline, when wow is shut down, and I'm on the train travelling to work.

Ideally what I want is the in-game export format produced by another system, but what Kru has will hopefully give me what I need.

Pewsey has heard about tact and discretion, but tends to regard them much as children view vegetables.
There are only two kinds of MMOs: the ones people complain about and the ones nobody plays. (inspired by Bjarne Stroustrup)

Australia Offline
Reply With Quote
Old 11/02/07, 9:08 AM   #7
notrachel
Von Kaiser
 
Dwarf Priest
 
Shadowsong (EU)
I might be able to help as I have some software I wrote to do our DKP and it can parse these files. It doesn't do an XML export but it would be easy enough to knock something up since I have most of the code. If you send me the .lua file (compressed) to matthew at oddpost dot com and let me know roughly what you want in the XML, I'll can see what I can do. Hopefully you used the same CTRA version as me (there are several formats now).

In case anyone is remotely interested, some pics of my software:

CTRA parsed into events
Null events are ignored
Processed into a raid
Individual loot event
Raider history in raw events
Final HTML output

Offline
Reply With Quote
Old 11/04/07, 6:35 PM   #8
 pewsey
hey there good lookin'
 
pewsey's Avatar
 
Dwarf Shaman
 
Dragonblight
Originally Posted by notrachel View Post
I might be able to help as I have some software I wrote to do our DKP and it can parse these files. It doesn't do an XML export but it would be easy enough to knock something up since I have most of the code. If you send me the .lua file (compressed) to matthew at oddpost dot com and let me know roughly what you want in the XML, I'll can see what I can do. Hopefully you used the same CTRA version as me (there are several formats now).

In case anyone is remotely interested, some pics of my software:

CTRA parsed into events
Null events are ignored
Processed into a raid
Individual loot event
Raider history in raw events
Final HTML output
That's utterly awesome. I'll send you the LUA.

Pewsey has heard about tact and discretion, but tends to regard them much as children view vegetables.
There are only two kinds of MMOs: the ones people complain about and the ones nobody plays. (inspired by Bjarne Stroustrup)

Australia Offline
Reply With Quote
Old 11/12/07, 5:31 PM   #9
Unaz
Piston Honda
 
Orc Shaman
 
Mug'thol
I wrote a SavedVariable parser a while ago for a project of mine (and after trying to write a recursive decent parser that took over an hour to parse some files :/ ), unfortunately I lost the version that had my commented/whitespaced out regular expression, but this should still work (perl):

It takes a string of raw lua dumped from the SV file and returns a multi level hash of all the variables
use Regexp::Common qw /delimited balanced/;
sub parseLuaBlock
{
	my $lua = shift;
	$lua =~ s/\s*--.+?$//mg; # Strip comments

	my %varhash;
	my @refstack;
	my $pos;

	my $arpos = 0;
	my %arindex;
	$arindex{$arpos} = 1;


	push(@refstack, \%varhash);
	
	use re 'eval';
	while(1)
	{
		if( $lua =~ /\G\s*(?:($RE{balanced}{-parens=>'[]'}|[-+a-z0-9_.]+)\s*=\s*($RE{delimited}{-delim=>'"'}{-esc=>'\\'}|[-+a-z0-9_.]+|\{)|(}|{|$RE{delimited}{-delim=>'"'}{-esc=>'\\'}|[-+a-z0-9_.]+)),?/isg)
		{
			$pos = pos;
			
			my $lhs = (defined($1)) ? $1 : "";
			my $rhs = (defined($2)) ? $2 : "";
			my $bracket = (defined($3)) ? $3 : "";

			if($rhs eq '{')
			{
				$arpos++;
				$arindex{$arpos} = 1;
			}

			if($bracket eq '}' && $arpos > 0)
			{
				$arpos--;
			} elsif($bracket eq '}')
			{
				$arindex{$arpos} = 1;
			}

			if($bracket =~ /['"]/)
			{
				$lhs = "[$arindex{$arpos}]";
				$arindex{$arpos}++;
				$rhs = $bracket;
				$bracket = '';
			}
			
			if($bracket eq '{')
			{
				$lhs = "[$arindex{$arpos}]";
				$arindex{$arpos}++;
				$arpos++;
				$arindex{$arpos} = 1;
				$rhs = $bracket;
				$bracket = '';
			}

			if($lhs =~ s/^\[(.+)\]$/$1/s)
			{
				$lhs =~ s/\\([\cM\cJ]+|[\\\[\]"])/$1/sg if $lhs =~ s/^"(.*)"$/$1/s;
			}

			$rhs =~ s/^"(true|false|(?:\d*\.)?\d+)"$/'$1'/s;
			$rhs =~ s/\\([\cM\cJ]+|[\\"])/$1/sg if $rhs =~ s/^"(.*)"$/$1/s;
			
			if($bracket eq '}')
			{
				die "Malformed config file, more closed then open brackets!" if $#refstack <= 0;
				pop(@refstack);
			} elsif( $rhs eq '{' )
			{
				push(@refstack, \%{$refstack[$#refstack]{$lhs}});				
			} else {
				$refstack[$#refstack]{$lhs} = $rhs;
			}
		} else {
			last;
		}

		pos($pos);
	}

	return %varhash;
}
I was fairly proud of myself at the time for it, and am pretty sure it can handle most things that the SV files will throw at it.

Last edited by Unaz : 11/12/07 at 5:44 PM. Reason: Replaced a subroutine with a die

Offline
Reply With Quote
Reply

Go Back   Elitist Jerks » User Interface and AddOns

Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Addon File organistion bellator User Interface and AddOns 13 08/03/07 1:30 PM
a mod to save some potions... Bladesong Public Discussion 15 03/01/07 12:01 PM