New TeslaConsole.BattleTech namespace mirroring TeslaConsole.RedPlanet's mission layer: BTMission/BTFreeForAllMission (egg serializer; RP wire framing and ordinal bitmaps reused verbatim), BTParticipant/BTPlayer/BTCamera (BT participant fields: advancedDamage, experience, vehicleValue, patch, role), and the BTConfig/BTScenario/BTMap/BTVehicle/BTWeather/BTRole catalog loaded from BattleTech\BTConfig.xml (reconstructed from the Mac Console 4.10 ini BT tree). Free For All and No Return share one mission class - both send scenario=freeforall; the mode is the role assigned to each pilot. BTGoldenEggTests (7 tests, recovered-only) diff the generated egg field-by-field against two eggs captured from the original consoles (cavern.egg, TESTARN.EGG): order-independent per-section compare with font-rendered bitmap pixel rows excluded, ordinal art byte-exact vs TESTARN.EGG, EggFileMessage framing reassembly, role de-dup, No Return role semantics, and shipped-catalog contents. Invoker gains BTEggString/ BTEggFraming reflection cases. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
123 lines
3.2 KiB
C#
123 lines
3.2 KiB
C#
using System;
|
|
using System.Text;
|
|
|
|
namespace TeslaConsole.BattleTech;
|
|
|
|
/// <summary>
|
|
/// A BattleTech combatant (mech pilot). Mirrors <c>RPPlayer</c> but carries the
|
|
/// BT-only participant fields (advanced damage model, pilot experience, mech
|
|
/// value, faction emblem, camo, patch colour and role). Free For All and No
|
|
/// Return use the same player type and differ only by the assigned
|
|
/// <see cref="Role" />.
|
|
/// </summary>
|
|
[Serializable]
|
|
internal class BTPlayer : BTParticipant
|
|
{
|
|
private readonly string mName;
|
|
|
|
private readonly string mVehicleKey;
|
|
|
|
private readonly string mCamoKey;
|
|
|
|
private readonly string mPatchKey;
|
|
|
|
private readonly string mEmblemKey;
|
|
|
|
private readonly string mExperienceKey;
|
|
|
|
private readonly BTRole mRole;
|
|
|
|
private readonly bool mAdvancedDamage;
|
|
|
|
private readonly string mDropZoneKey;
|
|
|
|
private readonly int mVehicleValue;
|
|
|
|
public string Name => mName;
|
|
|
|
public string VehicleKey => mVehicleKey;
|
|
|
|
public string CamoKey => mCamoKey;
|
|
|
|
public string PatchKey => mPatchKey;
|
|
|
|
public string EmblemKey => mEmblemKey;
|
|
|
|
public string ExperienceKey => mExperienceKey;
|
|
|
|
public BTRole Role => mRole;
|
|
|
|
public bool AdvancedDamage => mAdvancedDamage;
|
|
|
|
public string DropZoneKey => mDropZoneKey;
|
|
|
|
public int VehicleValue => mVehicleValue;
|
|
|
|
public BTPlayer(string podHostAddress, string name, string vehicleKey, string camoKey, string patchKey, string emblemKey, string experienceKey, BTRole role, bool advancedDamage = true, string dropZoneKey = "one", int vehicleValue = 0)
|
|
: base(podHostAddress, HostType.GameMachineHostType)
|
|
{
|
|
if (podHostAddress == null)
|
|
{
|
|
throw new ArgumentNullException("podHostAddress");
|
|
}
|
|
if (name == null)
|
|
{
|
|
throw new ArgumentNullException("name");
|
|
}
|
|
if (vehicleKey == null)
|
|
{
|
|
throw new ArgumentNullException("vehicleKey");
|
|
}
|
|
if (camoKey == null)
|
|
{
|
|
throw new ArgumentNullException("camoKey");
|
|
}
|
|
if (patchKey == null)
|
|
{
|
|
throw new ArgumentNullException("patchKey");
|
|
}
|
|
if (emblemKey == null)
|
|
{
|
|
throw new ArgumentNullException("emblemKey");
|
|
}
|
|
if (experienceKey == null)
|
|
{
|
|
throw new ArgumentNullException("experienceKey");
|
|
}
|
|
if (role == null)
|
|
{
|
|
throw new ArgumentNullException("role");
|
|
}
|
|
if (dropZoneKey == null)
|
|
{
|
|
throw new ArgumentNullException("dropZoneKey");
|
|
}
|
|
mName = name;
|
|
mVehicleKey = vehicleKey;
|
|
mCamoKey = camoKey;
|
|
mPatchKey = patchKey;
|
|
mEmblemKey = emblemKey;
|
|
mExperienceKey = experienceKey;
|
|
mRole = role;
|
|
mAdvancedDamage = advancedDamage;
|
|
mDropZoneKey = dropZoneKey;
|
|
mVehicleValue = vehicleValue;
|
|
}
|
|
|
|
protected sealed override void AppendParticipantSpecificData(int index, StringBuilder sb)
|
|
{
|
|
sb.AppendFormat("advancedDamage={0}\n", mAdvancedDamage ? "1" : "0");
|
|
sb.Append("loadzones=1\n");
|
|
sb.AppendFormat("name={0}\n", mName);
|
|
sb.AppendFormat("bitmapindex={0}\n", index);
|
|
sb.AppendFormat("experience={0}\n", mExperienceKey);
|
|
sb.AppendFormat("vehicle={0}\n", mVehicleKey);
|
|
sb.AppendFormat("vehicleValue={0}\n", mVehicleValue);
|
|
sb.AppendFormat("badge={0}\n", mEmblemKey);
|
|
sb.AppendFormat("dropzone={0}\n", mDropZoneKey);
|
|
sb.AppendFormat("color={0}\n", mCamoKey);
|
|
sb.AppendFormat("patch={0}\n", mPatchKey);
|
|
sb.AppendFormat("role=Role::{0}\n", mRole.Key);
|
|
}
|
|
}
|