• You've discovered RedGuides, an EverQuest multi-boxing and scripting community 🧙‍♀️⚙️. We want you to play several EQ characters at once, come join us and say hello! 👋

  • A TLP without truebox has thawed (Very Vanilla ready)
    Frostreaver

Bazaar Log Parser

Joined
Feb 24, 2005
RedCents
2,154¢
Another LinqPad Script to parse your bazaar logs.


There are no outside dependencies with this one, so I just pasted the code.
Copy and paste this into Linqpad and select Language: C# Program
Hit F5 and get a pretty little dump of your Bazaar transactions.

This was quick and dirty, I only deal with platnium in my trader... so obvious bug would happen if you have 1p7g5s56c type transactions.

Rich (BB code):
void Main()
{
	var itemsSold = new List<BazaarSell>();
	
	//Path to your EverQuest Log Folder, make sure you have the trailing \
	var logFolder = @"C:\Users\Public\Daybreak Game Company\Installed Games\EverQuest\Logs\";
	
	var logFiles = Directory.GetFiles(logFolder,"bzrlog*");
	
	var months = new Dictionary<string,int>();
	months.Add("Jan",1);
	months.Add("Feb",2);
	months.Add("Mar",3);
	months.Add("Apr",4);
	months.Add("May",5);
	months.Add("Jun",6);
	months.Add("Jul",7);
	months.Add("Aug",8);
	months.Add("Sep",9);
	months.Add("Oct",10);
	months.Add("Nov",11);
	months.Add("Dec",12);
	

	foreach(var l in logFiles)
	{
		var server = l.Substring(l.IndexOf("_")+1,l.LastIndexOf("_") - l.IndexOf("_")-1);
		
		var trader = l.Replace(logFolder,string.Empty)
			.Replace(server,string.Empty)
			.Replace(".txt",string.Empty)
			.Replace("_",string.Empty)
			.Replace("bzrlog",string.Empty);
			
		var data = File.ReadAllLines(l);
		
		foreach(var line in data)
		{
			if(!line.Contains("purchased")) continue;
			if(line.Contains("purchased by buyers.")) continue;
			
			var date = line.Substring(0,line.LastIndexOf("]"))
				.Replace("[","");
			
			var buyer = line.Replace("[",string.Empty)
				.Replace("]",string.Empty)
				.Replace(date,string.Empty)
				.TrimStart();
			buyer = buyer.Substring(0,buyer.IndexOf(" purchased")).Trim();
			

			
			var quantity = line.Substring(line.IndexOf("purchased "))
				.Replace("purchased ",string.Empty);
			quantity = quantity.Substring(0,quantity.IndexOf(" ")).Trim();
			
			var item = line.Replace(date,string.Empty);

			item = item.Substring(item.IndexOf(quantity+" "))
				.Replace(quantity + " ",string.Empty);
			item = item.Substring(0,item.IndexOf(" for (")).Trim();
			
			var amount = line.Substring(line.LastIndexOf("("))
				.Replace("(",string.Empty)
				.Replace(")",string.Empty)
				.Replace(".",string.Empty)
				.Replace("p",string.Empty);
			
			var dateparts = date.Split(' ');
			var timeParts =dateparts[3].Split(':');
			
			
			var monthString = dateparts[1];
			var dayString = Convert.ToInt32(dateparts[2]);
			var yearString = Convert.ToInt32(dateparts[4]);
			var hourString = Convert.ToInt32(timeParts[0]);
			var minuteString = Convert.ToInt32(timeParts[1]);
			var secondString = Convert.ToInt32(timeParts[2]);
			
			var monthValue = months[monthString];
			
			var realDate = new DateTime(yearString,monthValue,dayString,hourString,minuteString,secondString);
	
			
			var sell = new BazaarSell();
			sell.Server = server;
			sell.Timestamp = date;
			sell.Trader = trader;
			sell.Buyer = buyer;
			sell.Quanity = Convert.ToInt32(quantity);
			sell.Item = item;
			sell.Amount = Convert.ToDouble(amount);
			sell.Date = realDate;
			
			itemsSold.Add(sell);
	
			
		}
		
		
	}
	
	itemsSold
	.OrderByDescending(x=>x.Date)
	.Dump();
	
}

public class BazaarSell
{
	
	public string Server {get;set;}
	public string Trader {get;set;}
	public string Buyer {get;set;}
	public int Quanity {get;set;}
	public string Item {get;set;}
	public double Amount {get;set;}
	public DateTime Date {get;set;}
	public string Timestamp {get;set;}
}


// Define other methods and classes here

Sample Output: (Trader/Buyer/Item/Server removed for SECURITY)
0FTid16.png
 
Last edited:
First of all, Thank You Tone!

Not sure what to do about this error I'm getting with this while using LINQPad 5 or 4
BLP Error.JPG

And yes, I did replace "C:\Users\Public\Daybreak Game Company\Installed Games\EverQuest\Logs" with my EQ directory and kept the trailing backslash as well.

Thanks,
~TheFiddler~
 
I was able to take a little more time on this...

Isolated the bzrlog files I wanted to check into a separate folder and redirected this C# Prog to that folder. Ran the prog again and it worked just fine. Only picked up a fraction of what I have sold in the last few years. I'm expecting this is because when I'm in Offline Mode the reports of what I sold only go to the regular Character Log file as some spam text when logging on.

Thank you again Tone. It's great to see the mechanics of how this works (going thru the code).

~TheFiddler~
 
Yea, if only they logged offline trades for you at login ... into your bazaar log :P

- - - Updated - - -

I wrote this super quick just to get the job done... figured I'd share.
There are multiple ways to do string manipulation... this is one of many :P
 
Bazaar Log Parser

Users who are viewing this thread

Back
Top
Cart