-SSC now saves player hair, hair color, hair dye, cloth colors and accessory visibility.
-Fixed hair changes now showing up to other players ingame.
This commit is contained in:
parent
2a62bf84df
commit
39a81cfa66
5 changed files with 132 additions and 5 deletions
|
|
@ -975,5 +975,47 @@ namespace TShockAPI
|
|||
yield return new Point(regionArea.Right, regionArea.Top + y);
|
||||
}
|
||||
}
|
||||
|
||||
public int? EncodeColor(Color? color)
|
||||
{
|
||||
if (color == null)
|
||||
return null;
|
||||
|
||||
return BitConverter.ToInt32(new[] { color.Value.R, color.Value.G, color.Value.B, color.Value.A }, 0);
|
||||
}
|
||||
|
||||
public Color? DecodeColor(int? encodedColor)
|
||||
{
|
||||
if (encodedColor == null)
|
||||
return null;
|
||||
|
||||
byte[] data = BitConverter.GetBytes(encodedColor.Value);
|
||||
return new Color(data[0], data[1], data[2], data[3]);
|
||||
}
|
||||
|
||||
public byte? EncodeBitsByte(BitsByte? bitsByte)
|
||||
{
|
||||
if (bitsByte == null)
|
||||
return null;
|
||||
|
||||
byte result = 0;
|
||||
for (int i = 0; i < 8; i++)
|
||||
if (bitsByte.Value[i])
|
||||
result |= (byte)(1 << i);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public BitsByte? DecodeBitsByte(int? encodedBitsByte)
|
||||
{
|
||||
if (encodedBitsByte == null)
|
||||
return null;
|
||||
|
||||
BitsByte result = new BitsByte();
|
||||
for (int i = 0; i < 8; i++)
|
||||
result[i] = (encodedBitsByte & 1 << i) != 0;
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue