Another LinqPad Script to parse your character.ini files and add them to MQ2Posse via EQBC.
This one is a little more advanced than the others but pretty straight forward.
Make sure you add the correct eqFolder path
Also check the address/port (you can add local network IPs to send commands to other computers).
It's chunked, but can still add like 100-200chars in 10 seconds
Configure These
Ugh... can't post .linq files as attachments... Make sure you save the following to EQ-Posse.linq, then open with Linqpad & Run (F5 or click the Green Arrow)
This one is a little more advanced than the others but pretty straight forward.
Make sure you add the correct eqFolder path
Also check the address/port (you can add local network IPs to send commands to other computers).
It's chunked, but can still add like 100-200chars in 10 seconds

Configure These
Rich (BB code):
var eqFolder = @"C:\Users\Public\Daybreak Game Company\Installed Games\EverQuest\";
var generator = new PosseGenerator("127.0.0.1","2112","possebot");
generator.Start(eqFolder);
Ugh... can't post .linq files as attachments... Make sure you save the following to EQ-Posse.linq, then open with Linqpad & Run (F5 or click the Green Arrow)
Rich (BB code):
<Query Kind="Program">
<NuGetReference>ini-parser</NuGetReference>
<Namespace>IniParser</Namespace>
<Namespace>IniParser.Model</Namespace>
<Namespace>System.Net.Sockets</Namespace>
<Namespace>System.Collections.Concurrent</Namespace>
</Query>
void Main()
{
var eqFolder = @"C:\Users\Public\Daybreak Game Company\Installed Games\EverQuest\";
var generator = new PosseGenerator("127.0.0.1","2112","possebot");
generator.Start(eqFolder);
}
public class PosseGenerator
{
private EqbcClient Client { get; }
public string ClientName { get; set; }
public bool LoggedIn { get; set; }
public IniData Data { get; set; }
//Read from .ini
public List<EQCharacter> Characters { get; set; }
private FileIniDataParser Parser { get; set; }
//Toons Connected to EQBC
public List<string> CharacterList { get; set; }
public PosseGenerator(string address, string port, string clientName)
{
Client = new EqbcClient(address, Convert.ToInt32(port));
ClientName = clientName;
CharacterList = new List<string>();
Parser = new FileIniDataParser();
Characters = new List<EQCharacter>();
}
public void Start(string eqFolder)
{
Client.Login(ClientName);
LoadCharacters(eqFolder);
SendPosseStrings();
Client.AddCommand($"{EqbcConstants.CMD_MSGALL} //posse save");
Client.SendCommands();
Thread.Sleep(1000 * 10);
Console.WriteLine("DONE!");
}
public void LoadCharacters(string folder)
{
var di = new DirectoryInfo(folder);
var characterFiles = di.GetFiles("*_characters.ini", SearchOption.TopDirectoryOnly);
foreach (var cf in characterFiles)
{
var account = cf.Name.Replace("_characters.ini", string.Empty);
Data = Parser.ReadFile(cf.FullName);
foreach (var k in Data.Sections.First().Keys)
{
var detail = k.Value.Split(',');
var character = new EQCharacter();
character.Account = account;
character.Name = detail[0];
character.Server = detail[1];
Characters.Add(character);
}
}
}
public void SendPosseStrings()
{
int pageSize = 12;
int page = 1;
var totalPages = (Characters.Count / pageSize) + 1;
while (page <= totalPages)
{
var stringBuilder = new StringBuilder();
stringBuilder.Append($"{EqbcConstants.CMD_MSGALL} //multiline ;");
foreach (var c in Characters.Skip((page - 1) * pageSize).Take(pageSize))
{
stringBuilder.Append($" /posse add {c.Name};");
}
Client.AddCommand(stringBuilder.ToString());
stringBuilder.Clear();
page++;
}
}
}
public class EQCharacter
{
public string Account { get; set; }
public string Server { get; set; }
public string Name { get; set;}
}
public static class EqbcConstants
{
public static string CONNECT_START = "LOGIN";
public static string CONNECT_START2 = "=";
public static string CONNECT_END = ";";
public static string CONNECT_PWSEP = ":";
public static string SEND_LINE_TERM = "\n";
public static string CMD_DISCONNECT = "\tDISCONNECT\n";
public static string CMD_NAMES = "\tNAMES\n";
public static string CMD_PONG = "\tPONG\n";
public static string CMD_MSGALL = "\tMSGALL\n";
public static string CMD_TELL = "\tTELL\n";
public static string JOINED = "NBJOIN";
public static string PING = "PING";
public static string CHARLIST = "NBCLIENTLIST";
}
public class EqbcClient
{
public bool Connected
{
get { return Client.Connected; }
}
private TcpClient Client { get; set; }
private Stream ClientStream { get; set; }
private string Address { get; set; }
private int Port { get; set; }
private StreamReader InputStream { get; set; }
private StreamWriter OutputStream { get; set; }
public ConcurrentQueue<string> CommandList = new ConcurrentQueue<string>();
public EqbcClient(string address, int port)
{
Client = new TcpClient();
Address = address;
Port = port;
CommandList = new ConcurrentQueue<string>();
}
private bool Connect()
{
try
{
Client.Connect(Address, Port);
ClientStream = Client.GetStream();
InputStream = new StreamReader(ClientStream);
OutputStream = new StreamWriter(ClientStream);
}
catch
{
//Swallow on purpose
}
return Client.Connected;
}
public void Login(string ClientName)
{
if (Connect())
{
OutputStream.Write(EqbcConstants.CONNECT_START);
OutputStream.Write(EqbcConstants.CONNECT_START2);
OutputStream.Write(ClientName);
OutputStream.Write(EqbcConstants.CONNECT_END);
OutputStream.Flush();
var stopwatch = new Stopwatch();
stopwatch.Start();
while (true)
{
if (stopwatch.Elapsed.TotalSeconds >= 10)
{
stopwatch.Stop();
break;
}
var data = ReadLine();
if (data.IndexOf(EqbcConstants.JOINED) > -1)
{
stopwatch.Stop();
break;
}
}
}
}
public void AddCommand(string commandText)
{
CommandList.Enqueue(commandText + EqbcConstants.SEND_LINE_TERM);
}
public void SendCommands(int delay = 0)
{
var command = string.Empty;
try
{
if (CommandList.Count == 0)
{
return;
}
foreach (var c in CommandList)
{
if (CommandList.TryDequeue(out command))
{
OutputStream.Write(command);
OutputStream.Flush();
Thread.Sleep(1000 * delay);
}
}
}
catch (Exception ex)
{
}
finally
{
}
}
public string ReadLine()
{
return InputStream.ReadLine();
}
public void Dispose()
{
Client.Close();
}
}

