mirror of
https://github.com/mm201/pkmn-classic-framework.git
synced 2026-04-24 15:26:48 -05:00
Show trainer names for Generation V offers.
This commit is contained in:
parent
f405fae473
commit
342facd194
|
|
@ -74,7 +74,8 @@ namespace PkmnFoundations.GTS
|
|||
|
||||
protected String CreateTrainer5(object DataItem)
|
||||
{
|
||||
return "Trainer";
|
||||
GtsRecord5 record = (GtsRecord5)DataItem;
|
||||
return record.TrainerName.Text;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -412,7 +412,7 @@ namespace PkmnFoundations.Data
|
|||
{
|
||||
if (record.Data.Length != 220) throw new FormatException("pkm data must be 220 bytes.");
|
||||
if (record.Unknown0.Length != 16) throw new FormatException("pkm padding must be 16 bytes.");
|
||||
if (record.TrainerName.Length != 16) throw new FormatException("Trainer name must be 16 bytes.");
|
||||
if (record.TrainerName.RawData.Length != 16) throw new FormatException("Trainer name must be 16 bytes.");
|
||||
// note that IsTraded being true in the record is not an error condition
|
||||
// since it might have use later on. You should check for this in the upload handler.
|
||||
|
||||
|
|
@ -446,7 +446,7 @@ namespace PkmnFoundations.Data
|
|||
{
|
||||
if (record.Data.Length != 220) throw new FormatException("pkm data must be 220 bytes.");
|
||||
if (record.Unknown0.Length != 16) throw new FormatException("pkm padding must be 16 bytes.");
|
||||
if (record.TrainerName.Length != 16) throw new FormatException("Trainer name must be 16 bytes.");
|
||||
if (record.TrainerName.RawData.Length != 16) throw new FormatException("Trainer name must be 16 bytes.");
|
||||
// note that IsTraded being true in the record is not an error condition
|
||||
// since it might have use later on. You should check for this in the upload handler.
|
||||
|
||||
|
|
@ -655,7 +655,7 @@ namespace PkmnFoundations.Data
|
|||
|
||||
data = new byte[16];
|
||||
reader.GetBytes(16, 0, data, 0, 16);
|
||||
result.TrainerName = data;
|
||||
result.TrainerName = new EncodedString5(data);
|
||||
data = null;
|
||||
|
||||
result.TrainerCountry = reader.GetByte(17);
|
||||
|
|
|
|||
|
|
@ -58,6 +58,7 @@
|
|||
<Compile Include="Structures\GtsRecord4.cs" />
|
||||
<Compile Include="Support\AssertHelper.cs" />
|
||||
<Compile Include="Support\EncodedString4.cs" />
|
||||
<Compile Include="Support\EncodedString5.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ using System.Linq;
|
|||
using System.Text;
|
||||
using System.Runtime.Serialization;
|
||||
using System.IO;
|
||||
using PkmnFoundations.Support;
|
||||
|
||||
namespace PkmnFoundations.Structures
|
||||
{
|
||||
|
|
@ -75,7 +76,7 @@ namespace PkmnFoundations.Structures
|
|||
/// <summary>
|
||||
/// 16 bytes
|
||||
/// </summary>
|
||||
public byte[] TrainerName;
|
||||
public EncodedString5 TrainerName;
|
||||
|
||||
public byte TrainerCountry;
|
||||
public byte TrainerRegion;
|
||||
|
|
@ -93,7 +94,7 @@ namespace PkmnFoundations.Structures
|
|||
{
|
||||
// todo: enclose in properties and validate these when assigning.
|
||||
if (Data.Length != 0xDC) throw new FormatException("PKM length is incorrect");
|
||||
if (TrainerName.Length != 0x10) throw new FormatException("Trainer name length is incorrect");
|
||||
if (TrainerName.RawData.Length != 0x10) throw new FormatException("Trainer name length is incorrect");
|
||||
byte[] data = new byte[296];
|
||||
MemoryStream s = new MemoryStream(data);
|
||||
s.Write(Data, 0, 0xDC);
|
||||
|
|
@ -112,7 +113,7 @@ namespace PkmnFoundations.Structures
|
|||
s.Write(BitConverter.GetBytes(DateToTimestamp(TimeWithdrawn)), 0, 8);
|
||||
s.Write(BitConverter.GetBytes(PID), 0, 4);
|
||||
s.Write(BitConverter.GetBytes(TrainerOT), 0, 4);
|
||||
s.Write(TrainerName, 0, 0x10);
|
||||
s.Write(TrainerName.RawData, 0, 0x10);
|
||||
s.WriteByte(TrainerCountry);
|
||||
s.WriteByte(TrainerRegion);
|
||||
s.WriteByte(TrainerClass);
|
||||
|
|
@ -147,8 +148,7 @@ namespace PkmnFoundations.Structures
|
|||
TimeWithdrawn = TimestampToDate(BitConverter.ToUInt64(data, 0x100));
|
||||
PID = BitConverter.ToInt32(data, 0x108);
|
||||
TrainerOT = BitConverter.ToUInt32(data, 0x10C);
|
||||
TrainerName = new byte[0x10];
|
||||
Array.Copy(data, 0x110, TrainerName, 0, 0x10);
|
||||
TrainerName = new EncodedString5(data, 0x110, 0x10);
|
||||
TrainerCountry = data[0x120];
|
||||
TrainerRegion = data[0x121];
|
||||
TrainerClass = data[0x122];
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user