Terraria 1.4.0.5 Source Code

This commit is contained in:
MikeyIsBaeYT 2021-10-26 12:45:26 -04:00
commit 05205f009e
1059 changed files with 563450 additions and 0 deletions

View file

@ -0,0 +1,33 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.DataStructures.AnchorData
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
using Terraria.Enums;
namespace Terraria.DataStructures
{
public struct AnchorData
{
public AnchorType type;
public int tileCount;
public int checkStart;
public static AnchorData Empty;
public AnchorData(AnchorType type, int count, int start)
{
this.type = type;
this.tileCount = count;
this.checkStart = start;
}
public static bool operator ==(AnchorData data1, AnchorData data2) => data1.type == data2.type && data1.tileCount == data2.tileCount && data1.checkStart == data2.checkStart;
public static bool operator !=(AnchorData data1, AnchorData data2) => data1.type != data2.type || data1.tileCount != data2.tileCount || data1.checkStart != data2.checkStart;
public override bool Equals(object obj) => obj is AnchorData anchorData && this.type == anchorData.type && this.tileCount == ((AnchorData) obj).tileCount && this.checkStart == ((AnchorData) obj).checkStart;
public override int GetHashCode() => (int) (ushort) this.type << 16 | (int) (byte) this.tileCount << 8 | (int) (byte) this.checkStart;
}
}

View file

@ -0,0 +1,72 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.DataStructures.AnchoredEntitiesCollection
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
using Microsoft.Xna.Framework;
using System.Collections.Generic;
namespace Terraria.DataStructures
{
public class AnchoredEntitiesCollection
{
private List<AnchoredEntitiesCollection.IndexPointPair> _anchoredNPCs;
private List<AnchoredEntitiesCollection.IndexPointPair> _anchoredPlayers;
public int AnchoredPlayersAmount => this._anchoredPlayers.Count;
public AnchoredEntitiesCollection()
{
this._anchoredNPCs = new List<AnchoredEntitiesCollection.IndexPointPair>();
this._anchoredPlayers = new List<AnchoredEntitiesCollection.IndexPointPair>();
}
public void ClearNPCAnchors() => this._anchoredNPCs.Clear();
public void ClearPlayerAnchors() => this._anchoredPlayers.Clear();
public void AddNPC(int npcIndex, Point coords) => this._anchoredNPCs.Add(new AnchoredEntitiesCollection.IndexPointPair()
{
index = npcIndex,
coords = coords
});
public int GetNextPlayerStackIndexInCoords(Point coords) => this.GetEntitiesInCoords(coords);
public void AddPlayerAndGetItsStackedIndexInCoords(
int playerIndex,
Point coords,
out int stackedIndexInCoords)
{
stackedIndexInCoords = this.GetEntitiesInCoords(coords);
this._anchoredPlayers.Add(new AnchoredEntitiesCollection.IndexPointPair()
{
index = playerIndex,
coords = coords
});
}
private int GetEntitiesInCoords(Point coords)
{
int num = 0;
for (int index = 0; index < this._anchoredNPCs.Count; ++index)
{
if (this._anchoredNPCs[index].coords == coords)
++num;
}
for (int index = 0; index < this._anchoredPlayers.Count; ++index)
{
if (this._anchoredPlayers[index].coords == coords)
++num;
}
return num;
}
private struct IndexPointPair
{
public int index;
public Point coords;
}
}
}

View file

@ -0,0 +1,49 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.DataStructures.BinaryWriterHelper
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
using System.IO;
namespace Terraria.DataStructures
{
public struct BinaryWriterHelper
{
private long _placeInWriter;
public void ReservePointToFillLengthLaterByFilling6Bytes(BinaryWriter writer)
{
this._placeInWriter = writer.BaseStream.Position;
writer.Write(0U);
writer.Write((ushort) 0);
}
public void FillReservedPoint(BinaryWriter writer, ushort dataId)
{
long position = writer.BaseStream.Position;
writer.BaseStream.Position = this._placeInWriter;
long num = position - this._placeInWriter - 4L;
writer.Write((int) num);
writer.Write(dataId);
writer.BaseStream.Position = position;
}
public void FillOnlyIfThereIsLengthOrRevertToSavedPosition(
BinaryWriter writer,
ushort dataId,
out bool wroteSomething)
{
wroteSomething = false;
long position = writer.BaseStream.Position;
writer.BaseStream.Position = this._placeInWriter;
long num = position - this._placeInWriter - 4L;
if (num == 0L)
return;
writer.Write((int) num);
writer.Write(dataId);
writer.BaseStream.Position = position;
wroteSomething = true;
}
}
}

View file

@ -0,0 +1,74 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.DataStructures.BufferPool
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
using System;
using System.Collections.Generic;
namespace Terraria.DataStructures
{
public static class BufferPool
{
private const int SMALL_BUFFER_SIZE = 32;
private const int MEDIUM_BUFFER_SIZE = 256;
private const int LARGE_BUFFER_SIZE = 16384;
private static object bufferLock = new object();
private static Queue<CachedBuffer> SmallBufferQueue = new Queue<CachedBuffer>();
private static Queue<CachedBuffer> MediumBufferQueue = new Queue<CachedBuffer>();
private static Queue<CachedBuffer> LargeBufferQueue = new Queue<CachedBuffer>();
public static CachedBuffer Request(int size)
{
lock (BufferPool.bufferLock)
{
if (size <= 32)
return BufferPool.SmallBufferQueue.Count == 0 ? new CachedBuffer(new byte[32]) : BufferPool.SmallBufferQueue.Dequeue().Activate();
if (size <= 256)
return BufferPool.MediumBufferQueue.Count == 0 ? new CachedBuffer(new byte[256]) : BufferPool.MediumBufferQueue.Dequeue().Activate();
if (size > 16384)
return new CachedBuffer(new byte[size]);
return BufferPool.LargeBufferQueue.Count == 0 ? new CachedBuffer(new byte[16384]) : BufferPool.LargeBufferQueue.Dequeue().Activate();
}
}
public static CachedBuffer Request(byte[] data, int offset, int size)
{
CachedBuffer cachedBuffer = BufferPool.Request(size);
Buffer.BlockCopy((Array) data, offset, (Array) cachedBuffer.Data, 0, size);
return cachedBuffer;
}
public static void Recycle(CachedBuffer buffer)
{
int length = buffer.Length;
lock (BufferPool.bufferLock)
{
if (length <= 32)
BufferPool.SmallBufferQueue.Enqueue(buffer);
else if (length <= 256)
{
BufferPool.MediumBufferQueue.Enqueue(buffer);
}
else
{
if (length > 16384)
return;
BufferPool.LargeBufferQueue.Enqueue(buffer);
}
}
}
public static void PrintBufferSizes()
{
lock (BufferPool.bufferLock)
{
Console.WriteLine("SmallBufferQueue.Count: " + (object) BufferPool.SmallBufferQueue.Count);
Console.WriteLine("MediumBufferQueue.Count: " + (object) BufferPool.MediumBufferQueue.Count);
Console.WriteLine("LargeBufferQueue.Count: " + (object) BufferPool.LargeBufferQueue.Count);
Console.WriteLine("");
}
}
}
}

View file

@ -0,0 +1,46 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.DataStructures.CachedBuffer
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
using System.IO;
namespace Terraria.DataStructures
{
public class CachedBuffer
{
public readonly byte[] Data;
public readonly BinaryWriter Writer;
public readonly BinaryReader Reader;
private readonly MemoryStream _memoryStream;
private bool _isActive = true;
public int Length => this.Data.Length;
public bool IsActive => this._isActive;
public CachedBuffer(byte[] data)
{
this.Data = data;
this._memoryStream = new MemoryStream(data);
this.Writer = new BinaryWriter((Stream) this._memoryStream);
this.Reader = new BinaryReader((Stream) this._memoryStream);
}
internal CachedBuffer Activate()
{
this._isActive = true;
this._memoryStream.Position = 0L;
return this;
}
public void Recycle()
{
if (!this._isActive)
return;
this._isActive = false;
BufferPool.Recycle(this);
}
}
}

View file

@ -0,0 +1,50 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.DataStructures.ColorSlidersSet
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
using Microsoft.Xna.Framework;
namespace Terraria.DataStructures
{
public class ColorSlidersSet
{
public float Hue;
public float Saturation;
public float Luminance;
public float Alpha = 1f;
public void SetHSL(Color color)
{
Vector3 hsl = Main.rgbToHsl(color);
this.Hue = hsl.X;
this.Saturation = hsl.Y;
this.Luminance = hsl.Z;
}
public void SetHSL(Vector3 vector)
{
this.Hue = vector.X;
this.Saturation = vector.Y;
this.Luminance = vector.Z;
}
public Color GetColor()
{
Color rgb = Main.hslToRgb(this.Hue, this.Saturation, this.Luminance);
rgb.A = (byte) ((double) this.Alpha * (double) byte.MaxValue);
return rgb;
}
public Vector3 GetHSLVector() => new Vector3(this.Hue, this.Saturation, this.Luminance);
public void ApplyToMainLegacyBars()
{
Main.hBar = this.Hue;
Main.sBar = this.Saturation;
Main.lBar = this.Luminance;
Main.aBar = this.Alpha;
}
}
}

View file

@ -0,0 +1,19 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.DataStructures.CompositePlayerDrawContext
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
namespace Terraria.DataStructures
{
public enum CompositePlayerDrawContext
{
BackShoulder,
BackArm,
Torso,
FrontArm,
FrontShoulder,
FrontArmAccessory,
BackArmAccessory,
}
}

View file

@ -0,0 +1,149 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.DataStructures.DoubleStack`1
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
using System;
namespace Terraria.DataStructures
{
public class DoubleStack<T1>
{
private T1[][] _segmentList;
private readonly int _segmentSize;
private int _segmentCount;
private readonly int _segmentShiftPosition;
private int _start;
private int _end;
private int _size;
private int _last;
public DoubleStack(int segmentSize = 1024, int initialSize = 0)
{
if (segmentSize < 16)
segmentSize = 16;
this._start = segmentSize / 2;
this._end = this._start;
this._size = 0;
this._segmentShiftPosition = segmentSize + this._start;
initialSize += this._start;
int length = initialSize / segmentSize + 1;
this._segmentList = new T1[length][];
for (int index = 0; index < length; ++index)
this._segmentList[index] = new T1[segmentSize];
this._segmentSize = segmentSize;
this._segmentCount = length;
this._last = this._segmentSize * this._segmentCount - 1;
}
public void PushFront(T1 front)
{
if (this._start == 0)
{
T1[][] objArray = new T1[this._segmentCount + 1][];
for (int index = 0; index < this._segmentCount; ++index)
objArray[index + 1] = this._segmentList[index];
objArray[0] = new T1[this._segmentSize];
this._segmentList = objArray;
++this._segmentCount;
this._start += this._segmentSize;
this._end += this._segmentSize;
this._last += this._segmentSize;
}
--this._start;
this._segmentList[this._start / this._segmentSize][this._start % this._segmentSize] = front;
++this._size;
}
public T1 PopFront()
{
if (this._size == 0)
throw new InvalidOperationException("The DoubleStack is empty.");
T1[] segment1 = this._segmentList[this._start / this._segmentSize];
int index1 = this._start % this._segmentSize;
T1 obj = segment1[index1];
segment1[index1] = default (T1);
++this._start;
--this._size;
if (this._start >= this._segmentShiftPosition)
{
T1[] segment2 = this._segmentList[0];
for (int index2 = 0; index2 < this._segmentCount - 1; ++index2)
this._segmentList[index2] = this._segmentList[index2 + 1];
this._segmentList[this._segmentCount - 1] = segment2;
this._start -= this._segmentSize;
this._end -= this._segmentSize;
}
if (this._size == 0)
{
this._start = this._segmentSize / 2;
this._end = this._start;
}
return obj;
}
public T1 PeekFront()
{
if (this._size == 0)
throw new InvalidOperationException("The DoubleStack is empty.");
return this._segmentList[this._start / this._segmentSize][this._start % this._segmentSize];
}
public void PushBack(T1 back)
{
if (this._end == this._last)
{
T1[][] objArray = new T1[this._segmentCount + 1][];
for (int index = 0; index < this._segmentCount; ++index)
objArray[index] = this._segmentList[index];
objArray[this._segmentCount] = new T1[this._segmentSize];
++this._segmentCount;
this._segmentList = objArray;
this._last += this._segmentSize;
}
this._segmentList[this._end / this._segmentSize][this._end % this._segmentSize] = back;
++this._end;
++this._size;
}
public T1 PopBack()
{
if (this._size == 0)
throw new InvalidOperationException("The DoubleStack is empty.");
T1[] segment = this._segmentList[this._end / this._segmentSize];
int index = this._end % this._segmentSize;
T1 obj = segment[index];
segment[index] = default (T1);
--this._end;
--this._size;
if (this._size == 0)
{
this._start = this._segmentSize / 2;
this._end = this._start;
}
return obj;
}
public T1 PeekBack()
{
if (this._size == 0)
throw new InvalidOperationException("The DoubleStack is empty.");
return this._segmentList[this._end / this._segmentSize][this._end % this._segmentSize];
}
public void Clear(bool quickClear = false)
{
if (!quickClear)
{
for (int index = 0; index < this._segmentCount; ++index)
Array.Clear((Array) this._segmentList[index], 0, this._segmentSize);
}
this._start = this._segmentSize / 2;
this._end = this._start;
this._size = 0;
}
public int Count => this._size;
}
}

View file

@ -0,0 +1,25 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.DataStructures.DrawAnimation
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
namespace Terraria.DataStructures
{
public class DrawAnimation
{
public int Frame;
public int FrameCount;
public int TicksPerFrame;
public int FrameCounter;
public virtual void Update()
{
}
public virtual Rectangle GetFrame(Texture2D texture, int frameCounterOverride = -1) => texture.Frame();
}
}

View file

@ -0,0 +1,71 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.DataStructures.DrawAnimationVertical
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
namespace Terraria.DataStructures
{
public class DrawAnimationVertical : DrawAnimation
{
public bool PingPong;
public bool NotActuallyAnimating;
public DrawAnimationVertical(int ticksperframe, int frameCount, bool pingPong = false)
{
this.Frame = 0;
this.FrameCounter = 0;
this.FrameCount = frameCount;
this.TicksPerFrame = ticksperframe;
this.PingPong = pingPong;
}
public override void Update()
{
if (this.NotActuallyAnimating)
return;
if (++this.FrameCounter < this.TicksPerFrame)
return;
this.FrameCounter = 0;
if (this.PingPong)
{
if (++this.Frame < this.FrameCount * 2 - 2)
return;
this.Frame = 0;
}
else
{
if (++this.Frame < this.FrameCount)
return;
this.Frame = 0;
}
}
public override Rectangle GetFrame(Texture2D texture, int frameCounterOverride = -1)
{
if (frameCounterOverride != -1)
{
int num1 = frameCounterOverride / this.TicksPerFrame;
int num2 = this.FrameCount;
if (this.PingPong)
num2 = num2 * 2 - 1;
int num3 = num2;
int frameY = num1 % num3;
if (this.PingPong && frameY >= this.FrameCount)
frameY = this.FrameCount * 2 - 2 - frameY;
Rectangle rectangle = texture.Frame(verticalFrames: this.FrameCount, frameY: frameY);
rectangle.Height -= 2;
return rectangle;
}
int frameY1 = this.Frame;
if (this.PingPong && this.Frame >= this.FrameCount)
frameY1 = this.FrameCount * 2 - 2 - this.Frame;
Rectangle rectangle1 = texture.Frame(verticalFrames: this.FrameCount, frameY: frameY1);
rectangle1.Height -= 2;
return rectangle1;
}
}
}

178
DataStructures/DrawData.cs Normal file
View file

@ -0,0 +1,178 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.DataStructures.DrawData
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
namespace Terraria.DataStructures
{
public struct DrawData
{
public Texture2D texture;
public Vector2 position;
public Rectangle destinationRectangle;
public Rectangle? sourceRect;
public Color color;
public float rotation;
public Vector2 origin;
public Vector2 scale;
public SpriteEffects effect;
public int shader;
public bool ignorePlayerRotation;
public readonly bool useDestinationRectangle;
public static Rectangle? nullRectangle;
public DrawData(Texture2D texture, Vector2 position, Color color)
{
this.texture = texture;
this.position = position;
this.color = color;
this.destinationRectangle = new Rectangle();
this.sourceRect = DrawData.nullRectangle;
this.rotation = 0.0f;
this.origin = Vector2.Zero;
this.scale = Vector2.One;
this.effect = SpriteEffects.None;
this.shader = 0;
this.ignorePlayerRotation = false;
this.useDestinationRectangle = false;
}
public DrawData(Texture2D texture, Vector2 position, Rectangle? sourceRect, Color color)
{
this.texture = texture;
this.position = position;
this.color = color;
this.destinationRectangle = new Rectangle();
this.sourceRect = sourceRect;
this.rotation = 0.0f;
this.origin = Vector2.Zero;
this.scale = Vector2.One;
this.effect = SpriteEffects.None;
this.shader = 0;
this.ignorePlayerRotation = false;
this.useDestinationRectangle = false;
}
public DrawData(
Texture2D texture,
Vector2 position,
Rectangle? sourceRect,
Color color,
float rotation,
Vector2 origin,
float scale,
SpriteEffects effect,
int inactiveLayerDepth)
{
this.texture = texture;
this.position = position;
this.sourceRect = sourceRect;
this.color = color;
this.rotation = rotation;
this.origin = origin;
this.scale = new Vector2(scale, scale);
this.effect = effect;
this.destinationRectangle = new Rectangle();
this.shader = 0;
this.ignorePlayerRotation = false;
this.useDestinationRectangle = false;
}
public DrawData(
Texture2D texture,
Vector2 position,
Rectangle? sourceRect,
Color color,
float rotation,
Vector2 origin,
Vector2 scale,
SpriteEffects effect,
int inactiveLayerDepth)
{
this.texture = texture;
this.position = position;
this.sourceRect = sourceRect;
this.color = color;
this.rotation = rotation;
this.origin = origin;
this.scale = scale;
this.effect = effect;
this.destinationRectangle = new Rectangle();
this.shader = 0;
this.ignorePlayerRotation = false;
this.useDestinationRectangle = false;
}
public DrawData(Texture2D texture, Rectangle destinationRectangle, Color color)
{
this.texture = texture;
this.destinationRectangle = destinationRectangle;
this.color = color;
this.position = Vector2.Zero;
this.sourceRect = DrawData.nullRectangle;
this.rotation = 0.0f;
this.origin = Vector2.Zero;
this.scale = Vector2.One;
this.effect = SpriteEffects.None;
this.shader = 0;
this.ignorePlayerRotation = false;
this.useDestinationRectangle = false;
}
public DrawData(
Texture2D texture,
Rectangle destinationRectangle,
Rectangle? sourceRect,
Color color)
{
this.texture = texture;
this.destinationRectangle = destinationRectangle;
this.color = color;
this.position = Vector2.Zero;
this.sourceRect = sourceRect;
this.rotation = 0.0f;
this.origin = Vector2.Zero;
this.scale = Vector2.One;
this.effect = SpriteEffects.None;
this.shader = 0;
this.ignorePlayerRotation = false;
this.useDestinationRectangle = false;
}
public DrawData(
Texture2D texture,
Rectangle destinationRectangle,
Rectangle? sourceRect,
Color color,
float rotation,
Vector2 origin,
SpriteEffects effect,
int inactiveLayerDepth)
{
this.texture = texture;
this.destinationRectangle = destinationRectangle;
this.sourceRect = sourceRect;
this.color = color;
this.rotation = rotation;
this.origin = origin;
this.effect = effect;
this.position = Vector2.Zero;
this.scale = Vector2.One;
this.shader = 0;
this.ignorePlayerRotation = false;
this.useDestinationRectangle = false;
}
public void Draw(SpriteBatch sb)
{
if (this.useDestinationRectangle)
sb.Draw(this.texture, this.destinationRectangle, this.sourceRect, this.color, this.rotation, this.origin, this.effect, 0.0f);
else
sb.Draw(this.texture, this.position, this.sourceRect, this.color, this.rotation, this.origin, this.scale, this.effect, 0.0f);
}
}
}

View file

@ -0,0 +1,22 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.DataStructures.DrillDebugDraw
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
using Microsoft.Xna.Framework;
namespace Terraria.DataStructures
{
public struct DrillDebugDraw
{
public Vector2 point;
public Color color;
public DrillDebugDraw(Vector2 p, Color c)
{
this.point = p;
this.color = c;
}
}
}

View file

@ -0,0 +1,32 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.DataStructures.EntityShadowInfo
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
using Microsoft.Xna.Framework;
namespace Terraria.DataStructures
{
public struct EntityShadowInfo
{
public Vector2 Position;
public float Rotation;
public Vector2 Origin;
public int Direction;
public int GravityDirection;
public int BodyFrameIndex;
public void CopyPlayer(Player player)
{
this.Position = player.position;
this.Rotation = player.fullRotation;
this.Origin = player.fullRotationOrigin;
this.Direction = player.direction;
this.GravityDirection = (int) player.gravDir;
this.BodyFrameIndex = player.bodyFrame.Y / player.bodyFrame.Height;
}
public Vector2 HeadgearOffset => Main.OffsetsPlayerHeadgear[this.BodyFrameIndex];
}
}

View file

@ -0,0 +1,81 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.DataStructures.EntryFilterer`2
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
using System.Collections.Generic;
using Terraria.Localization;
namespace Terraria.DataStructures
{
public class EntryFilterer<T, U>
where T : new()
where U : IEntryFilter<T>
{
public List<U> AvailableFilters;
public List<U> ActiveFilters;
public List<U> AlwaysActiveFilters;
private ISearchFilter<T> _searchFilter;
private ISearchFilter<T> _searchFilterFromConstructor;
public EntryFilterer()
{
this.AvailableFilters = new List<U>();
this.ActiveFilters = new List<U>();
this.AlwaysActiveFilters = new List<U>();
}
public void AddFilters(List<U> filters) => this.AvailableFilters.AddRange((IEnumerable<U>) filters);
public bool FitsFilter(T entry)
{
if (this._searchFilter != null && !this._searchFilter.FitsFilter(entry))
return false;
for (int index = 0; index < this.AlwaysActiveFilters.Count; ++index)
{
if (!this.AlwaysActiveFilters[index].FitsFilter(entry))
return false;
}
if (this.ActiveFilters.Count == 0)
return true;
for (int index = 0; index < this.ActiveFilters.Count; ++index)
{
if (this.ActiveFilters[index].FitsFilter(entry))
return true;
}
return false;
}
public void ToggleFilter(int filterIndex)
{
U availableFilter = this.AvailableFilters[filterIndex];
if (this.ActiveFilters.Contains(availableFilter))
this.ActiveFilters.Remove(availableFilter);
else
this.ActiveFilters.Add(availableFilter);
}
public bool IsFilterActive(int filterIndex) => this.AvailableFilters.IndexInRange<U>(filterIndex) && this.ActiveFilters.Contains(this.AvailableFilters[filterIndex]);
public void SetSearchFilterObject<Z>(Z searchFilter) where Z : ISearchFilter<T>, U => this._searchFilterFromConstructor = (ISearchFilter<T>) searchFilter;
public void SetSearchFilter(string searchFilter)
{
if (string.IsNullOrWhiteSpace(searchFilter))
{
this._searchFilter = (ISearchFilter<T>) null;
}
else
{
this._searchFilter = this._searchFilterFromConstructor;
this._searchFilter.SetSearch(searchFilter);
}
}
public string GetDisplayName() => Language.GetTextValueWith("BestiaryInfo.Filters", (object) new
{
Count = this.ActiveFilters.Count
});
}
}

View file

@ -0,0 +1,46 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.DataStructures.EntrySorter`2
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
using System.Collections.Generic;
using Terraria.Localization;
namespace Terraria.DataStructures
{
public class EntrySorter<TEntryType, TStepType> : IComparer<TEntryType>
where TEntryType : new()
where TStepType : IEntrySortStep<TEntryType>
{
public List<TStepType> Steps = new List<TStepType>();
private int _prioritizedStep;
public void AddSortSteps(List<TStepType> sortSteps) => this.Steps.AddRange((IEnumerable<TStepType>) sortSteps);
public int Compare(TEntryType x, TEntryType y)
{
int num = 0;
if (this._prioritizedStep != -1)
{
num = this.Steps[this._prioritizedStep].Compare(x, y);
if (num != 0)
return num;
}
for (int index = 0; index < this.Steps.Count; ++index)
{
if (index != this._prioritizedStep)
{
num = this.Steps[index].Compare(x, y);
if (num != 0)
return num;
}
}
return num;
}
public void SetPrioritizedStepIndex(int index) => this._prioritizedStep = index;
public string GetDisplayName() => Language.GetTextValue(this.Steps[this._prioritizedStep].GetDisplayNameKey());
}
}

View file

@ -0,0 +1,35 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.DataStructures.FishingAttempt
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
namespace Terraria.DataStructures
{
public struct FishingAttempt
{
public PlayerFishingConditions playerFishingConditions;
public int X;
public int Y;
public int bobberType;
public bool common;
public bool uncommon;
public bool rare;
public bool veryrare;
public bool legendary;
public bool crate;
public bool inLava;
public bool inHoney;
public int waterTilesCount;
public int waterNeededToFish;
public float waterQuality;
public int chumsInWater;
public int fishingLevel;
public bool CanFishInLava;
public float atmo;
public int questFish;
public int heightLevel;
public int rolledItemDrop;
public int rolledEnemySpawn;
}
}

View file

@ -0,0 +1,18 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.DataStructures.FlowerPacketInfo
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
using System.Collections.Generic;
namespace Terraria.DataStructures
{
public class FlowerPacketInfo
{
public List<int> stylesOnPurity = new List<int>();
public List<int> stylesOnCorruption = new List<int>();
public List<int> stylesOnCrimson = new List<int>();
public List<int> stylesOnHallow = new List<int>();
}
}

View file

@ -0,0 +1,82 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.DataStructures.GameModeData
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
namespace Terraria.DataStructures
{
public class GameModeData
{
public static readonly GameModeData NormalMode = new GameModeData()
{
Id = 0,
EnemyMaxLifeMultiplier = 1f,
EnemyDamageMultiplier = 1f,
DebuffTimeMultiplier = 1f,
KnockbackToEnemiesMultiplier = 1f,
TownNPCDamageMultiplier = 1f,
EnemyDefenseMultiplier = 1f,
EnemyMoneyDropMultiplier = 1f
};
public static readonly GameModeData ExpertMode = new GameModeData()
{
Id = 1,
IsExpertMode = true,
EnemyMaxLifeMultiplier = 2f,
EnemyDamageMultiplier = 2f,
DebuffTimeMultiplier = 2f,
KnockbackToEnemiesMultiplier = 0.9f,
TownNPCDamageMultiplier = 1.5f,
EnemyDefenseMultiplier = 1f,
EnemyMoneyDropMultiplier = 2.5f
};
public static readonly GameModeData MasterMode = new GameModeData()
{
Id = 2,
IsExpertMode = true,
IsMasterMode = true,
EnemyMaxLifeMultiplier = 3f,
EnemyDamageMultiplier = 3f,
DebuffTimeMultiplier = 2.5f,
KnockbackToEnemiesMultiplier = 0.8f,
TownNPCDamageMultiplier = 1.75f,
EnemyDefenseMultiplier = 1f,
EnemyMoneyDropMultiplier = 2.5f
};
public static readonly GameModeData CreativeMode = new GameModeData()
{
Id = 3,
IsJourneyMode = true,
EnemyMaxLifeMultiplier = 1f,
EnemyDamageMultiplier = 1f,
DebuffTimeMultiplier = 1f,
KnockbackToEnemiesMultiplier = 1f,
TownNPCDamageMultiplier = 2f,
EnemyDefenseMultiplier = 1f,
EnemyMoneyDropMultiplier = 1f
};
public int Id { get; private set; }
public bool IsExpertMode { get; private set; }
public bool IsMasterMode { get; private set; }
public bool IsJourneyMode { get; private set; }
public float EnemyMaxLifeMultiplier { get; private set; }
public float EnemyDamageMultiplier { get; private set; }
public float DebuffTimeMultiplier { get; private set; }
public float KnockbackToEnemiesMultiplier { get; private set; }
public float TownNPCDamageMultiplier { get; private set; }
public float EnemyDefenseMultiplier { get; private set; }
public float EnemyMoneyDropMultiplier { get; private set; }
}
}

View file

@ -0,0 +1,19 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.DataStructures.IEntryFilter`1
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
using Terraria.UI;
namespace Terraria.DataStructures
{
public interface IEntryFilter<T>
{
bool FitsFilter(T entry);
string GetDisplayNameKey();
UIElement GetImage();
}
}

View file

@ -0,0 +1,15 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.DataStructures.IEntrySortStep`1
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
using System.Collections.Generic;
namespace Terraria.DataStructures
{
public interface IEntrySortStep<T> : IComparer<T>
{
string GetDisplayNameKey();
}
}

View file

@ -0,0 +1,13 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.DataStructures.ISearchFilter`1
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
namespace Terraria.DataStructures
{
public interface ISearchFilter<T> : IEntryFilter<T>
{
void SetSearch(string searchText);
}
}

View file

@ -0,0 +1,29 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.DataStructures.ItemSyncPersistentStats
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
using Microsoft.Xna.Framework;
namespace Terraria.DataStructures
{
public struct ItemSyncPersistentStats
{
private Color color;
private int type;
public void CopyFrom(Item item)
{
this.type = item.type;
this.color = item.color;
}
public void PasteInto(Item item)
{
if (this.type != item.type)
return;
item.color = this.color;
}
}
}

View file

@ -0,0 +1,22 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.DataStructures.LineSegment
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
using Microsoft.Xna.Framework;
namespace Terraria.DataStructures
{
public struct LineSegment
{
public Vector2 Start;
public Vector2 End;
public LineSegment(Vector2 start, Vector2 end)
{
this.Start = start;
this.End = end;
}
}
}

View file

@ -0,0 +1,46 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.DataStructures.MethodSequenceListItem
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
using System;
using System.Collections.Generic;
namespace Terraria.DataStructures
{
public class MethodSequenceListItem
{
public string Name;
public MethodSequenceListItem Parent;
public Func<bool> Method;
public bool Skip;
public MethodSequenceListItem(string name, Func<bool> method, MethodSequenceListItem parent = null)
{
this.Name = name;
this.Method = method;
this.Parent = parent;
}
public bool ShouldAct(List<MethodSequenceListItem> sequence)
{
if (this.Skip || !sequence.Contains(this))
return false;
return this.Parent == null || this.Parent.ShouldAct(sequence);
}
public bool Act() => this.Method();
public static void ExecuteSequence(List<MethodSequenceListItem> sequence)
{
foreach (MethodSequenceListItem sequenceListItem in sequence)
{
if (sequenceListItem.ShouldAct(sequence) && !sequenceListItem.Act())
break;
}
}
public override string ToString() => "name: " + this.Name + " skip: " + this.Skip.ToString() + " parent: " + (object) this.Parent;
}
}

View file

@ -0,0 +1,56 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.DataStructures.NPCAimedTarget
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
using Microsoft.Xna.Framework;
using Terraria.Enums;
namespace Terraria.DataStructures
{
public struct NPCAimedTarget
{
public NPCTargetType Type;
public Rectangle Hitbox;
public int Width;
public int Height;
public Vector2 Position;
public Vector2 Velocity;
public bool Invalid => this.Type == NPCTargetType.None;
public Vector2 Center => this.Position + this.Size / 2f;
public Vector2 Size => new Vector2((float) this.Width, (float) this.Height);
public NPCAimedTarget(NPC npc)
{
this.Type = NPCTargetType.NPC;
this.Hitbox = npc.Hitbox;
this.Width = npc.width;
this.Height = npc.height;
this.Position = npc.position;
this.Velocity = npc.velocity;
}
public NPCAimedTarget(Player player, bool ignoreTank = true)
{
this.Type = NPCTargetType.Player;
this.Hitbox = player.Hitbox;
this.Width = player.width;
this.Height = player.height;
this.Position = player.position;
this.Velocity = player.velocity;
if (ignoreTank || player.tankPet <= -1)
return;
Projectile projectile = Main.projectile[player.tankPet];
this.Type = NPCTargetType.PlayerTankPet;
this.Hitbox = projectile.Hitbox;
this.Width = projectile.width;
this.Height = projectile.height;
this.Position = projectile.position;
this.Velocity = projectile.velocity;
}
}
}

View file

@ -0,0 +1,24 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.DataStructures.NPCStrengthHelper
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
namespace Terraria.DataStructures
{
public struct NPCStrengthHelper
{
private float _strength;
private GameModeData _gameModeData;
public bool IsExpertMode => (double) this._strength >= 2.0 || this._gameModeData.IsExpertMode;
public bool IsMasterMode => (double) this._strength >= 3.0 || this._gameModeData.IsMasterMode;
public NPCStrengthHelper(GameModeData data, float strength)
{
this._strength = strength;
this._gameModeData = data;
}
}
}

View file

@ -0,0 +1,40 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.DataStructures.PlacementHook
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
using System;
namespace Terraria.DataStructures
{
public struct PlacementHook
{
public Func<int, int, int, int, int, int, int> hook;
public int badReturn;
public int badResponse;
public bool processedCoordinates;
public static PlacementHook Empty = new PlacementHook((Func<int, int, int, int, int, int, int>) null, 0, 0, false);
public const int Response_AllInvalid = 0;
public PlacementHook(
Func<int, int, int, int, int, int, int> hook,
int badReturn,
int badResponse,
bool processedCoordinates)
{
this.hook = hook;
this.badResponse = badResponse;
this.badReturn = badReturn;
this.processedCoordinates = processedCoordinates;
}
public static bool operator ==(PlacementHook first, PlacementHook second) => first.hook == second.hook && first.badResponse == second.badResponse && first.badReturn == second.badReturn && first.processedCoordinates == second.processedCoordinates;
public static bool operator !=(PlacementHook first, PlacementHook second) => first.hook != second.hook || first.badResponse != second.badResponse || first.badReturn != second.badReturn || first.processedCoordinates != second.processedCoordinates;
public override bool Equals(object obj) => obj is PlacementHook placementHook && this == placementHook;
public override int GetHashCode() => base.GetHashCode();
}
}

View file

@ -0,0 +1,131 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.DataStructures.PlayerDeathReason
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
using System.IO;
using Terraria.Localization;
namespace Terraria.DataStructures
{
public class PlayerDeathReason
{
private int _sourcePlayerIndex = -1;
private int _sourceNPCIndex = -1;
private int _sourceProjectileIndex = -1;
private int _sourceOtherIndex = -1;
private int _sourceProjectileType;
private int _sourceItemType;
private int _sourceItemPrefix;
private string _sourceCustomReason;
public int? SourceProjectileType => this._sourceProjectileIndex == -1 ? new int?() : new int?(this._sourceProjectileType);
public static PlayerDeathReason LegacyEmpty() => new PlayerDeathReason()
{
_sourceOtherIndex = 254
};
public static PlayerDeathReason LegacyDefault() => new PlayerDeathReason()
{
_sourceOtherIndex = (int) byte.MaxValue
};
public static PlayerDeathReason ByNPC(int index) => new PlayerDeathReason()
{
_sourceNPCIndex = index
};
public static PlayerDeathReason ByCustomReason(string reasonInEnglish) => new PlayerDeathReason()
{
_sourceCustomReason = reasonInEnglish
};
public static PlayerDeathReason ByPlayer(int index) => new PlayerDeathReason()
{
_sourcePlayerIndex = index,
_sourceItemType = Main.player[index].inventory[Main.player[index].selectedItem].type,
_sourceItemPrefix = (int) Main.player[index].inventory[Main.player[index].selectedItem].prefix
};
public static PlayerDeathReason ByOther(int type) => new PlayerDeathReason()
{
_sourceOtherIndex = type
};
public static PlayerDeathReason ByProjectile(
int playerIndex,
int projectileIndex)
{
PlayerDeathReason playerDeathReason = new PlayerDeathReason()
{
_sourcePlayerIndex = playerIndex,
_sourceProjectileIndex = projectileIndex,
_sourceProjectileType = Main.projectile[projectileIndex].type
};
if (playerIndex >= 0 && playerIndex <= (int) byte.MaxValue)
{
playerDeathReason._sourceItemType = Main.player[playerIndex].inventory[Main.player[playerIndex].selectedItem].type;
playerDeathReason._sourceItemPrefix = (int) Main.player[playerIndex].inventory[Main.player[playerIndex].selectedItem].prefix;
}
return playerDeathReason;
}
public NetworkText GetDeathText(string deadPlayerName) => this._sourceCustomReason != null ? NetworkText.FromLiteral(this._sourceCustomReason) : Lang.CreateDeathMessage(deadPlayerName, this._sourcePlayerIndex, this._sourceNPCIndex, this._sourceProjectileIndex, this._sourceOtherIndex, this._sourceProjectileType, this._sourceItemType);
public void WriteSelfTo(BinaryWriter writer)
{
BitsByte bitsByte = (BitsByte) (byte) 0;
bitsByte[0] = this._sourcePlayerIndex != -1;
bitsByte[1] = this._sourceNPCIndex != -1;
bitsByte[2] = this._sourceProjectileIndex != -1;
bitsByte[3] = this._sourceOtherIndex != -1;
bitsByte[4] = (uint) this._sourceProjectileType > 0U;
bitsByte[5] = (uint) this._sourceItemType > 0U;
bitsByte[6] = (uint) this._sourceItemPrefix > 0U;
bitsByte[7] = this._sourceCustomReason != null;
writer.Write((byte) bitsByte);
if (bitsByte[0])
writer.Write((short) this._sourcePlayerIndex);
if (bitsByte[1])
writer.Write((short) this._sourceNPCIndex);
if (bitsByte[2])
writer.Write((short) this._sourceProjectileIndex);
if (bitsByte[3])
writer.Write((byte) this._sourceOtherIndex);
if (bitsByte[4])
writer.Write((short) this._sourceProjectileType);
if (bitsByte[5])
writer.Write((short) this._sourceItemType);
if (bitsByte[6])
writer.Write((byte) this._sourceItemPrefix);
if (!bitsByte[7])
return;
writer.Write(this._sourceCustomReason);
}
public static PlayerDeathReason FromReader(BinaryReader reader)
{
PlayerDeathReason playerDeathReason = new PlayerDeathReason();
BitsByte bitsByte = (BitsByte) reader.ReadByte();
if (bitsByte[0])
playerDeathReason._sourcePlayerIndex = (int) reader.ReadInt16();
if (bitsByte[1])
playerDeathReason._sourceNPCIndex = (int) reader.ReadInt16();
if (bitsByte[2])
playerDeathReason._sourceProjectileIndex = (int) reader.ReadInt16();
if (bitsByte[3])
playerDeathReason._sourceOtherIndex = (int) reader.ReadByte();
if (bitsByte[4])
playerDeathReason._sourceProjectileType = (int) reader.ReadInt16();
if (bitsByte[5])
playerDeathReason._sourceItemType = (int) reader.ReadInt16();
if (bitsByte[6])
playerDeathReason._sourceItemPrefix = (int) reader.ReadByte();
if (bitsByte[7])
playerDeathReason._sourceCustomReason = reader.ReadString();
return playerDeathReason;
}
}
}

View file

@ -0,0 +1,310 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.DataStructures.PlayerDrawHeadLayers
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using System.Collections.Generic;
using Terraria.GameContent;
using Terraria.Graphics;
using Terraria.ID;
namespace Terraria.DataStructures
{
public static class PlayerDrawHeadLayers
{
public static void DrawPlayer_0_(ref PlayerDrawHeadSet drawinfo)
{
}
public static void DrawPlayer_00_BackHelmet(ref PlayerDrawHeadSet drawinfo)
{
if (drawinfo.drawPlayer.head < 0 || drawinfo.drawPlayer.head >= 266)
return;
int index = ArmorIDs.Head.Sets.FrontToBackID[drawinfo.drawPlayer.head];
if (index < 0)
return;
Rectangle hairFrame = drawinfo.HairFrame;
PlayerDrawHeadLayers.QuickCDD(drawinfo.DrawData, drawinfo.cHead, TextureAssets.ArmorHead[index].Value, drawinfo.helmetOffset + new Vector2(drawinfo.Position.X - Main.screenPosition.X - (float) (drawinfo.bodyFrameMemory.Width / 2) + (float) (drawinfo.drawPlayer.width / 2), (float) ((double) drawinfo.Position.Y - (double) Main.screenPosition.Y + (double) drawinfo.drawPlayer.height - (double) drawinfo.bodyFrameMemory.Height + 4.0)) + drawinfo.drawPlayer.headPosition + drawinfo.headVect, new Rectangle?(hairFrame), drawinfo.colorArmorHead, drawinfo.drawPlayer.headRotation, drawinfo.headVect, drawinfo.scale, drawinfo.playerEffect, 0.0f);
}
public static void DrawPlayer_01_FaceSkin(ref PlayerDrawHeadSet drawinfo)
{
if (drawinfo.drawPlayer.head == 38 || drawinfo.drawPlayer.head == 135 || drawinfo.drawPlayer.isHatRackDoll)
return;
PlayerDrawHeadLayers.QuickCDD(drawinfo.DrawData, drawinfo.skinDyePacked, TextureAssets.Players[drawinfo.skinVar, 0].Value, new Vector2(drawinfo.Position.X - Main.screenPosition.X - (float) (drawinfo.bodyFrameMemory.Width / 2) + (float) (drawinfo.drawPlayer.width / 2), (float) ((double) drawinfo.Position.Y - (double) Main.screenPosition.Y + (double) drawinfo.drawPlayer.height - (double) drawinfo.bodyFrameMemory.Height + 4.0)) + drawinfo.drawPlayer.headPosition + drawinfo.headVect, new Rectangle?(drawinfo.bodyFrameMemory), drawinfo.colorHead, drawinfo.drawPlayer.headRotation, drawinfo.headVect, drawinfo.scale, drawinfo.playerEffect, 0.0f);
PlayerDrawHeadLayers.QuickCDD(drawinfo.DrawData, TextureAssets.Players[drawinfo.skinVar, 1].Value, new Vector2(drawinfo.Position.X - Main.screenPosition.X - (float) (drawinfo.bodyFrameMemory.Width / 2) + (float) (drawinfo.drawPlayer.width / 2), (float) ((double) drawinfo.Position.Y - (double) Main.screenPosition.Y + (double) drawinfo.drawPlayer.height - (double) drawinfo.bodyFrameMemory.Height + 4.0)) + drawinfo.drawPlayer.headPosition + drawinfo.headVect, new Rectangle?(drawinfo.bodyFrameMemory), drawinfo.colorEyeWhites, drawinfo.drawPlayer.headRotation, drawinfo.headVect, drawinfo.scale, drawinfo.playerEffect, 0.0f);
PlayerDrawHeadLayers.QuickCDD(drawinfo.DrawData, TextureAssets.Players[drawinfo.skinVar, 2].Value, new Vector2(drawinfo.Position.X - Main.screenPosition.X - (float) (drawinfo.bodyFrameMemory.Width / 2) + (float) (drawinfo.drawPlayer.width / 2), (float) ((double) drawinfo.Position.Y - (double) Main.screenPosition.Y + (double) drawinfo.drawPlayer.height - (double) drawinfo.bodyFrameMemory.Height + 4.0)) + drawinfo.drawPlayer.headPosition + drawinfo.headVect, new Rectangle?(drawinfo.bodyFrameMemory), drawinfo.colorEyes, drawinfo.drawPlayer.headRotation, drawinfo.headVect, drawinfo.scale, drawinfo.playerEffect, 0.0f);
if (!drawinfo.drawPlayer.yoraiz0rDarkness)
return;
PlayerDrawHeadLayers.QuickCDD(drawinfo.DrawData, drawinfo.skinDyePacked, TextureAssets.Extra[67].Value, new Vector2(drawinfo.Position.X - Main.screenPosition.X - (float) (drawinfo.bodyFrameMemory.Width / 2) + (float) (drawinfo.drawPlayer.width / 2), (float) ((double) drawinfo.Position.Y - (double) Main.screenPosition.Y + (double) drawinfo.drawPlayer.height - (double) drawinfo.bodyFrameMemory.Height + 4.0)) + drawinfo.drawPlayer.headPosition + drawinfo.headVect, new Rectangle?(drawinfo.bodyFrameMemory), drawinfo.colorHead, drawinfo.drawPlayer.headRotation, drawinfo.headVect, drawinfo.scale, drawinfo.playerEffect, 0.0f);
}
public static void DrawPlayer_02_DrawArmorWithFullHair(ref PlayerDrawHeadSet drawinfo)
{
if (!drawinfo.fullHair)
return;
PlayerDrawHeadLayers.QuickCDD(drawinfo.DrawData, drawinfo.cHead, TextureAssets.ArmorHead[drawinfo.drawPlayer.head].Value, drawinfo.helmetOffset + new Vector2(drawinfo.Position.X - Main.screenPosition.X - (float) (drawinfo.bodyFrameMemory.Width / 2) + (float) (drawinfo.drawPlayer.width / 2), (float) ((double) drawinfo.Position.Y - (double) Main.screenPosition.Y + (double) drawinfo.drawPlayer.height - (double) drawinfo.bodyFrameMemory.Height + 4.0)) + drawinfo.drawPlayer.headPosition + drawinfo.headVect, new Rectangle?(drawinfo.HairFrame), drawinfo.colorArmorHead, drawinfo.drawPlayer.headRotation, drawinfo.headVect, drawinfo.scale, drawinfo.playerEffect, 0.0f);
if (drawinfo.drawPlayer.invis || drawinfo.hideHair)
return;
Rectangle hairFrame = drawinfo.HairFrame;
hairFrame.Y -= 336;
if (hairFrame.Y < 0)
hairFrame.Y = 0;
PlayerDrawHeadLayers.QuickCDD(drawinfo.DrawData, drawinfo.hairShaderPacked, TextureAssets.PlayerHair[drawinfo.drawPlayer.hair].Value, new Vector2(drawinfo.Position.X - Main.screenPosition.X - (float) (drawinfo.bodyFrameMemory.Width / 2) + (float) (drawinfo.drawPlayer.width / 2), (float) ((double) drawinfo.Position.Y - (double) Main.screenPosition.Y + (double) drawinfo.drawPlayer.height - (double) drawinfo.bodyFrameMemory.Height + 4.0)) + drawinfo.drawPlayer.headPosition + drawinfo.headVect, new Rectangle?(hairFrame), drawinfo.colorHair, drawinfo.drawPlayer.headRotation, drawinfo.headVect, drawinfo.scale, drawinfo.playerEffect, 0.0f);
}
public static void DrawPlayer_03_HelmetHair(ref PlayerDrawHeadSet drawinfo)
{
if (drawinfo.hideHair || !drawinfo.hatHair)
return;
Rectangle hairFrame = drawinfo.HairFrame;
hairFrame.Y -= 336;
if (hairFrame.Y < 0)
hairFrame.Y = 0;
if (drawinfo.drawPlayer.invis)
return;
PlayerDrawHeadLayers.QuickCDD(drawinfo.DrawData, drawinfo.hairShaderPacked, TextureAssets.PlayerHairAlt[drawinfo.drawPlayer.hair].Value, new Vector2(drawinfo.Position.X - Main.screenPosition.X - (float) (drawinfo.bodyFrameMemory.Width / 2) + (float) (drawinfo.drawPlayer.width / 2), (float) ((double) drawinfo.Position.Y - (double) Main.screenPosition.Y + (double) drawinfo.drawPlayer.height - (double) drawinfo.bodyFrameMemory.Height + 4.0)) + drawinfo.drawPlayer.headPosition + drawinfo.headVect, new Rectangle?(hairFrame), drawinfo.colorHair, drawinfo.drawPlayer.headRotation, drawinfo.headVect, drawinfo.scale, drawinfo.playerEffect, 0.0f);
}
public static void DrawPlayer_04_RabbitOrder(ref PlayerDrawHeadSet drawinfo)
{
int verticalFrames = 27;
Texture2D texture2D = TextureAssets.ArmorHead[drawinfo.drawPlayer.head].Value;
Rectangle r = texture2D.Frame(verticalFrames: verticalFrames, frameY: drawinfo.drawPlayer.rabbitOrderFrame.DisplayFrame);
Vector2 origin = r.Size() / 2f;
int usedGravDir = 1;
Vector2 hatDrawPosition = PlayerDrawHeadLayers.DrawPlayer_04_GetHatDrawPosition(ref drawinfo, new Vector2(1f, -26f), usedGravDir);
int hatStacks = PlayerDrawHeadLayers.DrawPlayer_04_GetHatStacks(ref drawinfo, 4955);
float num1 = (float) Math.PI / 60f;
float num2 = (float) ((double) num1 * (double) drawinfo.drawPlayer.position.X % 6.28318548202515);
for (int index = hatStacks - 1; index >= 0; --index)
{
float x = (float) ((double) Vector2.UnitY.RotatedBy((double) num2 + (double) num1 * (double) index).X * ((double) index / 30.0) * 2.0) - (float) (index * 2 * drawinfo.drawPlayer.direction);
PlayerDrawHeadLayers.QuickCDD(drawinfo.DrawData, drawinfo.cHead, texture2D, hatDrawPosition + new Vector2(x, (float) (index * -14) * drawinfo.scale), new Rectangle?(r), drawinfo.colorArmorHead, drawinfo.drawPlayer.headRotation, origin, drawinfo.scale, drawinfo.playerEffect, 0.0f);
}
if (drawinfo.drawPlayer.invis || drawinfo.hideHair)
return;
Rectangle hairFrame = drawinfo.HairFrame;
hairFrame.Y -= 336;
if (hairFrame.Y < 0)
hairFrame.Y = 0;
PlayerDrawHeadLayers.QuickCDD(drawinfo.DrawData, drawinfo.hairShaderPacked, TextureAssets.PlayerHair[drawinfo.drawPlayer.hair].Value, new Vector2(drawinfo.Position.X - Main.screenPosition.X - (float) (drawinfo.bodyFrameMemory.Width / 2) + (float) (drawinfo.drawPlayer.width / 2), (float) ((double) drawinfo.Position.Y - (double) Main.screenPosition.Y + (double) drawinfo.drawPlayer.height - (double) drawinfo.bodyFrameMemory.Height + 4.0)) + drawinfo.drawPlayer.headPosition + drawinfo.headVect, new Rectangle?(hairFrame), drawinfo.colorHair, drawinfo.drawPlayer.headRotation, drawinfo.headVect, drawinfo.scale, drawinfo.playerEffect, 0.0f);
}
public static void DrawPlayer_04_BadgersHat(ref PlayerDrawHeadSet drawinfo)
{
int verticalFrames = 6;
Texture2D texture2D = TextureAssets.ArmorHead[drawinfo.drawPlayer.head].Value;
Rectangle r = texture2D.Frame(verticalFrames: verticalFrames, frameY: drawinfo.drawPlayer.rabbitOrderFrame.DisplayFrame);
Vector2 origin = r.Size() / 2f;
int usedGravDir = 1;
Vector2 hatDrawPosition = PlayerDrawHeadLayers.DrawPlayer_04_GetHatDrawPosition(ref drawinfo, new Vector2(0.0f, -9f), usedGravDir);
int hatStacks = PlayerDrawHeadLayers.DrawPlayer_04_GetHatStacks(ref drawinfo, 5004);
float num1 = (float) Math.PI / 60f;
float num2 = (float) ((double) num1 * (double) drawinfo.drawPlayer.position.X % 6.28318548202515);
int num3 = hatStacks * 4 + 2;
int num4 = 0;
bool flag = ((double) Main.GlobalTimeWrappedHourly + 180.0) % 3600.0 < 60.0;
for (int index = num3 - 1; index >= 0; --index)
{
int num5 = 0;
if (index == num3 - 1)
{
r.Y = 0;
num5 = 2;
}
else
r.Y = index != 0 ? r.Height * (num4++ % 4 + 1) : r.Height * 5;
if (!(r.Y == r.Height * 3 & flag))
{
float x = (float) ((double) Vector2.UnitY.RotatedBy((double) num2 + (double) num1 * (double) index).X * ((double) index / 10.0) * 4.0 - (double) index * 0.100000001490116 * (double) drawinfo.drawPlayer.direction);
PlayerDrawHeadLayers.QuickCDD(drawinfo.DrawData, drawinfo.cHead, texture2D, hatDrawPosition + new Vector2(x, (float) ((index * -4 + num5) * usedGravDir)) * drawinfo.scale, new Rectangle?(r), drawinfo.colorArmorHead, drawinfo.drawPlayer.headRotation, origin, drawinfo.scale, drawinfo.playerEffect, 0.0f);
}
}
}
private static Vector2 DrawPlayer_04_GetHatDrawPosition(
ref PlayerDrawHeadSet drawinfo,
Vector2 hatOffset,
int usedGravDir)
{
Vector2 vector2 = new Vector2((float) drawinfo.drawPlayer.direction, (float) usedGravDir);
return drawinfo.Position - Main.screenPosition + new Vector2((float) (-drawinfo.bodyFrameMemory.Width / 2 + drawinfo.drawPlayer.width / 2), (float) (drawinfo.drawPlayer.height - drawinfo.bodyFrameMemory.Height + 4)) + hatOffset * vector2 * drawinfo.scale + (drawinfo.drawPlayer.headPosition + drawinfo.headVect);
}
private static int DrawPlayer_04_GetHatStacks(ref PlayerDrawHeadSet drawinfo, int itemId)
{
int num = 0;
int index1 = 0;
if (drawinfo.drawPlayer.armor[index1] != null && drawinfo.drawPlayer.armor[index1].type == itemId && drawinfo.drawPlayer.armor[index1].stack > 0)
num += drawinfo.drawPlayer.armor[index1].stack;
int index2 = 10;
if (drawinfo.drawPlayer.armor[index2] != null && drawinfo.drawPlayer.armor[index2].type == itemId && drawinfo.drawPlayer.armor[index2].stack > 0)
num += drawinfo.drawPlayer.armor[index2].stack;
return num;
}
public static void DrawPlayer_04_JungleRose(ref PlayerDrawHeadSet drawinfo)
{
if (drawinfo.drawPlayer.head == 259)
{
PlayerDrawHeadLayers.DrawPlayer_04_RabbitOrder(ref drawinfo);
}
else
{
if (!drawinfo.helmetIsOverFullHair)
return;
if (!drawinfo.drawPlayer.invis && !drawinfo.hideHair)
{
Rectangle hairFrame = drawinfo.HairFrame;
hairFrame.Y -= 336;
if (hairFrame.Y < 0)
hairFrame.Y = 0;
PlayerDrawHeadLayers.QuickCDD(drawinfo.DrawData, drawinfo.hairShaderPacked, TextureAssets.PlayerHair[drawinfo.drawPlayer.hair].Value, new Vector2(drawinfo.Position.X - Main.screenPosition.X - (float) (drawinfo.bodyFrameMemory.Width / 2) + (float) (drawinfo.drawPlayer.width / 2), (float) ((double) drawinfo.Position.Y - (double) Main.screenPosition.Y + (double) drawinfo.drawPlayer.height - (double) drawinfo.bodyFrameMemory.Height + 4.0)) + drawinfo.drawPlayer.headPosition + drawinfo.headVect, new Rectangle?(hairFrame), drawinfo.colorHair, drawinfo.drawPlayer.headRotation, drawinfo.headVect, drawinfo.scale, drawinfo.playerEffect, 0.0f);
}
if (drawinfo.drawPlayer.head == 0)
return;
PlayerDrawHeadLayers.QuickCDD(drawinfo.DrawData, drawinfo.cHead, TextureAssets.ArmorHead[drawinfo.drawPlayer.head].Value, drawinfo.helmetOffset + new Vector2(drawinfo.Position.X - Main.screenPosition.X - (float) (drawinfo.bodyFrameMemory.Width / 2) + (float) (drawinfo.drawPlayer.width / 2), (float) ((double) drawinfo.Position.Y - (double) Main.screenPosition.Y + (double) drawinfo.drawPlayer.height - (double) drawinfo.bodyFrameMemory.Height + 4.0)) + drawinfo.drawPlayer.headPosition + drawinfo.headVect, new Rectangle?(drawinfo.bodyFrameMemory), drawinfo.colorArmorHead, drawinfo.drawPlayer.headRotation, drawinfo.headVect, drawinfo.scale, drawinfo.playerEffect, 0.0f);
}
}
public static void DrawPlayer_05_TallHats(ref PlayerDrawHeadSet drawinfo)
{
if (!drawinfo.helmetIsTall)
return;
Rectangle hairFrame = drawinfo.HairFrame;
if (drawinfo.drawPlayer.head == 158)
hairFrame.Height -= 2;
int num = 0;
if (hairFrame.Y == hairFrame.Height * 6)
hairFrame.Height -= 2;
else if (hairFrame.Y == hairFrame.Height * 7)
num = -2;
else if (hairFrame.Y == hairFrame.Height * 8)
num = -2;
else if (hairFrame.Y == hairFrame.Height * 9)
num = -2;
else if (hairFrame.Y == hairFrame.Height * 10)
num = -2;
else if (hairFrame.Y == hairFrame.Height * 13)
hairFrame.Height -= 2;
else if (hairFrame.Y == hairFrame.Height * 14)
num = -2;
else if (hairFrame.Y == hairFrame.Height * 15)
num = -2;
else if (hairFrame.Y == hairFrame.Height * 16)
num = -2;
hairFrame.Y += num;
PlayerDrawHeadLayers.QuickCDD(drawinfo.DrawData, drawinfo.cHead, TextureAssets.ArmorHead[drawinfo.drawPlayer.head].Value, drawinfo.helmetOffset + new Vector2(drawinfo.Position.X - Main.screenPosition.X - (float) (drawinfo.bodyFrameMemory.Width / 2) + (float) (drawinfo.drawPlayer.width / 2), (float) ((double) drawinfo.Position.Y - (double) Main.screenPosition.Y + (double) drawinfo.drawPlayer.height - (double) drawinfo.bodyFrameMemory.Height + 4.0) + (float) num) + drawinfo.drawPlayer.headPosition + drawinfo.headVect, new Rectangle?(hairFrame), drawinfo.colorArmorHead, drawinfo.drawPlayer.headRotation, drawinfo.headVect, drawinfo.scale, drawinfo.playerEffect, 0.0f);
}
public static void DrawPlayer_06_NormalHats(ref PlayerDrawHeadSet drawinfo)
{
if (drawinfo.drawPlayer.head == 265)
{
PlayerDrawHeadLayers.DrawPlayer_04_BadgersHat(ref drawinfo);
}
else
{
if (!drawinfo.helmetIsNormal)
return;
Rectangle hairFrame = drawinfo.HairFrame;
PlayerDrawHeadLayers.QuickCDD(drawinfo.DrawData, drawinfo.cHead, TextureAssets.ArmorHead[drawinfo.drawPlayer.head].Value, drawinfo.helmetOffset + new Vector2(drawinfo.Position.X - Main.screenPosition.X - (float) (drawinfo.bodyFrameMemory.Width / 2) + (float) (drawinfo.drawPlayer.width / 2), (float) ((double) drawinfo.Position.Y - (double) Main.screenPosition.Y + (double) drawinfo.drawPlayer.height - (double) drawinfo.bodyFrameMemory.Height + 4.0)) + drawinfo.drawPlayer.headPosition + drawinfo.headVect, new Rectangle?(hairFrame), drawinfo.colorArmorHead, drawinfo.drawPlayer.headRotation, drawinfo.headVect, drawinfo.scale, drawinfo.playerEffect, 0.0f);
}
}
public static void DrawPlayer_07_JustHair(ref PlayerDrawHeadSet drawinfo)
{
if (drawinfo.helmetIsNormal || drawinfo.helmetIsOverFullHair || drawinfo.helmetIsTall || drawinfo.hideHair)
return;
if (drawinfo.drawPlayer.face == (sbyte) 5)
PlayerDrawHeadLayers.QuickCDD(drawinfo.DrawData, drawinfo.cFace, TextureAssets.AccFace[(int) drawinfo.drawPlayer.face].Value, new Vector2((float) (int) ((double) drawinfo.Position.X - (double) Main.screenPosition.X - (double) (drawinfo.bodyFrameMemory.Width / 2) + (double) (drawinfo.drawPlayer.width / 2)), (float) ((double) drawinfo.Position.Y - (double) Main.screenPosition.Y + (double) drawinfo.drawPlayer.height - (double) drawinfo.bodyFrameMemory.Height + 4.0)) + drawinfo.drawPlayer.headPosition + drawinfo.headVect, new Rectangle?(drawinfo.bodyFrameMemory), drawinfo.colorArmorHead, drawinfo.drawPlayer.headRotation, drawinfo.headVect, drawinfo.scale, drawinfo.playerEffect, 0.0f);
Rectangle hairFrame = drawinfo.HairFrame;
hairFrame.Y -= 336;
if (hairFrame.Y < 0)
hairFrame.Y = 0;
PlayerDrawHeadLayers.QuickCDD(drawinfo.DrawData, drawinfo.hairShaderPacked, TextureAssets.PlayerHair[drawinfo.drawPlayer.hair].Value, new Vector2(drawinfo.Position.X - Main.screenPosition.X - (float) (drawinfo.bodyFrameMemory.Width / 2) + (float) (drawinfo.drawPlayer.width / 2), (float) ((double) drawinfo.Position.Y - (double) Main.screenPosition.Y + (double) drawinfo.drawPlayer.height - (double) drawinfo.bodyFrameMemory.Height + 4.0)) + drawinfo.drawPlayer.headPosition + drawinfo.headVect, new Rectangle?(hairFrame), drawinfo.colorHair, drawinfo.drawPlayer.headRotation, drawinfo.headVect, drawinfo.scale, drawinfo.playerEffect, 0.0f);
}
public static void DrawPlayer_08_FaceAcc(ref PlayerDrawHeadSet drawinfo)
{
if (drawinfo.drawPlayer.face > (sbyte) 0 && drawinfo.drawPlayer.face < (sbyte) 16 && drawinfo.drawPlayer.face != (sbyte) 5)
{
if (drawinfo.drawPlayer.face == (sbyte) 7)
{
Color color = new Color(200, 200, 200, 150);
PlayerDrawHeadLayers.QuickCDD(drawinfo.DrawData, drawinfo.cFace, TextureAssets.AccFace[(int) drawinfo.drawPlayer.face].Value, new Vector2((float) (int) ((double) drawinfo.Position.X - (double) Main.screenPosition.X - (double) (drawinfo.bodyFrameMemory.Width / 2) + (double) (drawinfo.drawPlayer.width / 2)), (float) ((double) drawinfo.Position.Y - (double) Main.screenPosition.Y + (double) drawinfo.drawPlayer.height - (double) drawinfo.bodyFrameMemory.Height + 4.0)) + drawinfo.drawPlayer.headPosition + drawinfo.headVect, new Rectangle?(drawinfo.bodyFrameMemory), new Color(200, 200, 200, 200), drawinfo.drawPlayer.headRotation, drawinfo.headVect, drawinfo.scale, drawinfo.playerEffect, 0.0f);
}
else
PlayerDrawHeadLayers.QuickCDD(drawinfo.DrawData, drawinfo.cFace, TextureAssets.AccFace[(int) drawinfo.drawPlayer.face].Value, new Vector2((float) (int) ((double) drawinfo.Position.X - (double) Main.screenPosition.X - (double) (drawinfo.bodyFrameMemory.Width / 2) + (double) (drawinfo.drawPlayer.width / 2)), (float) ((double) drawinfo.Position.Y - (double) Main.screenPosition.Y + (double) drawinfo.drawPlayer.height - (double) drawinfo.bodyFrameMemory.Height + 4.0)) + drawinfo.drawPlayer.headPosition + drawinfo.headVect, new Rectangle?(drawinfo.bodyFrameMemory), drawinfo.colorArmorHead, drawinfo.drawPlayer.headRotation, drawinfo.headVect, drawinfo.scale, drawinfo.playerEffect, 0.0f);
}
if (!drawinfo.drawUnicornHorn)
return;
PlayerDrawHeadLayers.QuickCDD(drawinfo.DrawData, drawinfo.cUnicornHorn, TextureAssets.Extra[143].Value, new Vector2(drawinfo.Position.X - Main.screenPosition.X - (float) (drawinfo.bodyFrameMemory.Width / 2) + (float) (drawinfo.drawPlayer.width / 2), (float) ((double) drawinfo.Position.Y - (double) Main.screenPosition.Y + (double) drawinfo.drawPlayer.height - (double) drawinfo.bodyFrameMemory.Height + 4.0)) + drawinfo.drawPlayer.headPosition + drawinfo.headVect, new Rectangle?(drawinfo.bodyFrameMemory), drawinfo.colorArmorHead, drawinfo.drawPlayer.headRotation, drawinfo.headVect, drawinfo.scale, drawinfo.playerEffect, 0.0f);
}
public static void DrawPlayer_RenderAllLayers(ref PlayerDrawHeadSet drawinfo)
{
List<DrawData> drawData = drawinfo.DrawData;
Effect pixelShader = Main.pixelShader;
Projectile[] projectile = Main.projectile;
SpriteBatch spriteBatch = Main.spriteBatch;
for (int index = 0; index < drawData.Count; ++index)
{
DrawData cdd = drawData[index];
if (!cdd.sourceRect.HasValue)
cdd.sourceRect = new Rectangle?(cdd.texture.Frame());
PlayerDrawHelper.SetShaderForData(drawinfo.drawPlayer, drawinfo.cHead, ref cdd);
if (cdd.texture != null)
cdd.Draw(spriteBatch);
}
pixelShader.CurrentTechnique.Passes[0].Apply();
}
public static void DrawPlayer_DrawSelectionRect(ref PlayerDrawHeadSet drawinfo)
{
Vector2 lowest;
Vector2 highest;
SpriteRenderTargetHelper.GetDrawBoundary(drawinfo.DrawData, out lowest, out highest);
Utils.DrawRect(Main.spriteBatch, lowest + Main.screenPosition, highest + Main.screenPosition, Color.White);
}
public static void QuickCDD(
List<DrawData> drawData,
Texture2D texture,
Vector2 position,
Rectangle? sourceRectangle,
Color color,
float rotation,
Vector2 origin,
float scale,
SpriteEffects effects,
float layerDepth)
{
drawData.Add(new DrawData(texture, position, sourceRectangle, color, rotation, origin, scale, effects, 0));
}
public static void QuickCDD(
List<DrawData> drawData,
int shaderTechnique,
Texture2D texture,
Vector2 position,
Rectangle? sourceRectangle,
Color color,
float rotation,
Vector2 origin,
float scale,
SpriteEffects effects,
float layerDepth)
{
drawData.Add(new DrawData(texture, position, sourceRectangle, color, rotation, origin, scale, effects, 0)
{
shader = shaderTechnique
});
}
}
}

View file

@ -0,0 +1,119 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.DataStructures.PlayerDrawHeadSet
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System.Collections.Generic;
using Terraria.ID;
namespace Terraria.DataStructures
{
public struct PlayerDrawHeadSet
{
public List<Terraria.DataStructures.DrawData> DrawData;
public List<int> Dust;
public List<int> Gore;
public Player drawPlayer;
public int cHead;
public int cFace;
public int cUnicornHorn;
public int skinVar;
public int hairShaderPacked;
public int skinDyePacked;
public float scale;
public Color colorEyeWhites;
public Color colorEyes;
public Color colorHair;
public Color colorHead;
public Color colorArmorHead;
public SpriteEffects playerEffect;
public Vector2 headVect;
public Rectangle bodyFrameMemory;
public bool fullHair;
public bool hatHair;
public bool hideHair;
public bool helmetIsTall;
public bool helmetIsOverFullHair;
public bool helmetIsNormal;
public bool drawUnicornHorn;
public Vector2 Position;
public Vector2 helmetOffset;
public Rectangle HairFrame
{
get
{
Rectangle bodyFrameMemory = this.bodyFrameMemory;
--bodyFrameMemory.Height;
return bodyFrameMemory;
}
}
public void BoringSetup(
Player drawPlayer2,
List<Terraria.DataStructures.DrawData> drawData,
List<int> dust,
List<int> gore,
float X,
float Y,
float Alpha,
float Scale)
{
this.DrawData = drawData;
this.Dust = dust;
this.Gore = gore;
this.drawPlayer = drawPlayer2;
this.Position = this.drawPlayer.position;
this.cHead = 0;
this.cFace = 0;
this.cUnicornHorn = 0;
this.drawUnicornHorn = false;
this.skinVar = this.drawPlayer.skinVariant;
this.hairShaderPacked = PlayerDrawHelper.PackShader((int) this.drawPlayer.hairDye, PlayerDrawHelper.ShaderConfiguration.HairShader);
if (this.drawPlayer.head == 0 && this.drawPlayer.hairDye == (byte) 0)
this.hairShaderPacked = PlayerDrawHelper.PackShader(1, PlayerDrawHelper.ShaderConfiguration.HairShader);
this.skinDyePacked = this.drawPlayer.skinDyePacked;
if (this.drawPlayer.face > (sbyte) 0 && this.drawPlayer.face < (sbyte) 16)
Main.instance.LoadAccFace((int) this.drawPlayer.face);
this.cHead = this.drawPlayer.cHead;
this.cFace = this.drawPlayer.cFace;
this.cUnicornHorn = this.drawPlayer.cUnicornHorn;
this.drawUnicornHorn = this.drawPlayer.hasUnicornHorn;
Main.instance.LoadHair(this.drawPlayer.hair);
this.scale = Scale;
this.colorEyeWhites = Main.quickAlpha(Color.White, Alpha);
this.colorEyes = Main.quickAlpha(this.drawPlayer.eyeColor, Alpha);
this.colorHair = Main.quickAlpha(this.drawPlayer.GetHairColor(false), Alpha);
this.colorHead = Main.quickAlpha(this.drawPlayer.skinColor, Alpha);
this.colorArmorHead = Main.quickAlpha(Color.White, Alpha);
this.playerEffect = SpriteEffects.None;
if (this.drawPlayer.direction < 0)
this.playerEffect = SpriteEffects.FlipHorizontally;
this.headVect = new Vector2((float) this.drawPlayer.legFrame.Width * 0.5f, (float) this.drawPlayer.legFrame.Height * 0.4f);
this.bodyFrameMemory = this.drawPlayer.bodyFrame;
this.bodyFrameMemory.Y = 0;
this.Position = Main.screenPosition;
this.Position.X += X;
this.Position.Y += Y;
this.Position.X -= 6f;
this.Position.Y -= 4f;
this.Position.Y -= (float) this.drawPlayer.HeightMapOffset;
if (this.drawPlayer.head > 0 && this.drawPlayer.head < 266)
{
Main.instance.LoadArmorHead(this.drawPlayer.head);
int i = ArmorIDs.Head.Sets.FrontToBackID[this.drawPlayer.head];
if (i >= 0)
Main.instance.LoadArmorHead(i);
}
if (this.drawPlayer.face > (sbyte) 0 && this.drawPlayer.face < (sbyte) 16)
Main.instance.LoadAccFace((int) this.drawPlayer.face);
this.helmetOffset = this.drawPlayer.GetHelmetDrawOffset();
this.drawPlayer.GetHairSettings(out this.fullHair, out this.hatHair, out this.hideHair, out bool _, out this.helmetIsOverFullHair);
this.helmetIsTall = this.drawPlayer.head == 14 || this.drawPlayer.head == 56 || this.drawPlayer.head == 158;
this.helmetIsNormal = !this.helmetIsTall && !this.helmetIsOverFullHair && this.drawPlayer.head > 0 && this.drawPlayer.head < 266 && this.drawPlayer.head != 28;
}
}
}

View file

@ -0,0 +1,72 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.DataStructures.PlayerDrawHelper
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
using Terraria.Graphics.Shaders;
namespace Terraria.DataStructures
{
public class PlayerDrawHelper
{
public static int PackShader(
int localShaderIndex,
PlayerDrawHelper.ShaderConfiguration shaderType)
{
return localShaderIndex + (int) shaderType * 1000;
}
public static void UnpackShader(
int packedShaderIndex,
out int localShaderIndex,
out PlayerDrawHelper.ShaderConfiguration shaderType)
{
shaderType = (PlayerDrawHelper.ShaderConfiguration) (packedShaderIndex / 1000);
localShaderIndex = packedShaderIndex % 1000;
}
public static void SetShaderForData(Player player, int cHead, ref DrawData cdd)
{
int localShaderIndex;
PlayerDrawHelper.ShaderConfiguration shaderType;
PlayerDrawHelper.UnpackShader(cdd.shader, out localShaderIndex, out shaderType);
switch (shaderType)
{
case PlayerDrawHelper.ShaderConfiguration.ArmorShader:
GameShaders.Hair.Apply((short) 0, player, new DrawData?(cdd));
GameShaders.Armor.Apply(localShaderIndex, (Entity) player, new DrawData?(cdd));
break;
case PlayerDrawHelper.ShaderConfiguration.HairShader:
if (player.head == 0)
{
GameShaders.Hair.Apply((short) 0, player, new DrawData?(cdd));
GameShaders.Armor.Apply(cHead, (Entity) player, new DrawData?(cdd));
break;
}
GameShaders.Armor.Apply(0, (Entity) player, new DrawData?(cdd));
GameShaders.Hair.Apply((short) localShaderIndex, player, new DrawData?(cdd));
break;
case PlayerDrawHelper.ShaderConfiguration.TileShader:
Main.tileShader.CurrentTechnique.Passes[localShaderIndex].Apply();
break;
case PlayerDrawHelper.ShaderConfiguration.TilePaintID:
if (localShaderIndex == 31)
{
GameShaders.Armor.Apply(0, (Entity) player, new DrawData?(cdd));
break;
}
Main.tileShader.CurrentTechnique.Passes[Main.ConvertPaintIdToTileShaderIndex(localShaderIndex, false, false)].Apply();
break;
}
}
public enum ShaderConfiguration
{
ArmorShader,
HairShader,
TileShader,
TilePaintID,
}
}
}

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,18 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.DataStructures.PlayerFishingConditions
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
namespace Terraria.DataStructures
{
public struct PlayerFishingConditions
{
public int PolePower;
public int PoleItemType;
public int BaitPower;
public int BaitItemType;
public float LevelMultipliers;
public int FinalFishingLevel;
}
}

View file

@ -0,0 +1,42 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.DataStructures.PlayerInteractionAnchor
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
namespace Terraria.DataStructures
{
public struct PlayerInteractionAnchor
{
public int interactEntityID;
public int X;
public int Y;
public PlayerInteractionAnchor(int entityID, int x = -1, int y = -1)
{
this.interactEntityID = entityID;
this.X = x;
this.Y = y;
}
public bool InUse => this.interactEntityID != -1;
public void Clear()
{
this.interactEntityID = -1;
this.X = -1;
this.Y = -1;
}
public void Set(int entityID, int x, int y)
{
this.interactEntityID = entityID;
this.X = x;
this.Y = y;
}
public bool IsInValidUseTileEntity() => this.InUse && TileEntity.ByID.ContainsKey(this.interactEntityID);
public TileEntity GetTileEntity() => !this.IsInValidUseTileEntity() ? (TileEntity) null : TileEntity.ByID[this.interactEntityID];
}
}

View file

@ -0,0 +1,66 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.DataStructures.PlayerMovementAccsCache
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
namespace Terraria.DataStructures
{
public struct PlayerMovementAccsCache
{
private bool _readyToPaste;
private bool _mountPreventedFlight;
private bool _mountPreventedExtraJumps;
private int rocketTime;
private float wingTime;
private int rocketDelay;
private int rocketDelay2;
private bool jumpAgainCloud;
private bool jumpAgainSandstorm;
private bool jumpAgainBlizzard;
private bool jumpAgainFart;
private bool jumpAgainSail;
private bool jumpAgainUnicorn;
public void CopyFrom(Player player)
{
if (this._readyToPaste)
return;
this._readyToPaste = true;
this._mountPreventedFlight = true;
this._mountPreventedExtraJumps = player.mount.BlockExtraJumps;
this.rocketTime = player.rocketTime;
this.rocketDelay = player.rocketDelay;
this.rocketDelay2 = player.rocketDelay2;
this.wingTime = player.wingTime;
this.jumpAgainCloud = player.canJumpAgain_Cloud;
this.jumpAgainSandstorm = player.canJumpAgain_Sandstorm;
this.jumpAgainBlizzard = player.canJumpAgain_Blizzard;
this.jumpAgainFart = player.canJumpAgain_Fart;
this.jumpAgainSail = player.canJumpAgain_Sail;
this.jumpAgainUnicorn = player.canJumpAgain_Unicorn;
}
public void PasteInto(Player player)
{
if (!this._readyToPaste)
return;
this._readyToPaste = false;
if (this._mountPreventedFlight)
{
player.rocketTime = this.rocketTime;
player.rocketDelay = this.rocketDelay;
player.rocketDelay2 = this.rocketDelay2;
player.wingTime = this.wingTime;
}
if (!this._mountPreventedExtraJumps)
return;
player.canJumpAgain_Cloud = this.jumpAgainCloud;
player.canJumpAgain_Sandstorm = this.jumpAgainSandstorm;
player.canJumpAgain_Blizzard = this.jumpAgainBlizzard;
player.canJumpAgain_Fart = this.jumpAgainFart;
player.canJumpAgain_Sail = this.jumpAgainSail;
player.canJumpAgain_Unicorn = this.jumpAgainUnicorn;
}
}
}

56
DataStructures/Point16.cs Normal file
View file

@ -0,0 +1,56 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.DataStructures.Point16
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
using Microsoft.Xna.Framework;
namespace Terraria.DataStructures
{
public struct Point16
{
public readonly short X;
public readonly short Y;
public static Point16 Zero = new Point16(0, 0);
public static Point16 NegativeOne = new Point16(-1, -1);
public Point16(Point point)
{
this.X = (short) point.X;
this.Y = (short) point.Y;
}
public Point16(int X, int Y)
{
this.X = (short) X;
this.Y = (short) Y;
}
public Point16(short X, short Y)
{
this.X = X;
this.Y = Y;
}
public static Point16 Max(int firstX, int firstY, int secondX, int secondY) => new Point16(firstX > secondX ? firstX : secondX, firstY > secondY ? firstY : secondY);
public Point16 Max(int compareX, int compareY) => new Point16((int) this.X > compareX ? (int) this.X : compareX, (int) this.Y > compareY ? (int) this.Y : compareY);
public Point16 Max(Point16 compareTo) => new Point16((int) this.X > (int) compareTo.X ? this.X : compareTo.X, (int) this.Y > (int) compareTo.Y ? this.Y : compareTo.Y);
public static bool operator ==(Point16 first, Point16 second) => (int) first.X == (int) second.X && (int) first.Y == (int) second.Y;
public static bool operator !=(Point16 first, Point16 second) => (int) first.X != (int) second.X || (int) first.Y != (int) second.Y;
public override bool Equals(object obj)
{
Point16 point16 = (Point16) obj;
return (int) this.X == (int) point16.X && (int) this.Y == (int) point16.Y;
}
public override int GetHashCode() => (int) this.X << 16 | (int) (ushort) this.Y;
public override string ToString() => string.Format("{{{0}, {1}}}", (object) this.X, (object) this.Y);
}
}

View file

@ -0,0 +1,34 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.DataStructures.PortableStoolUsage
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
namespace Terraria.DataStructures
{
public struct PortableStoolUsage
{
public bool HasAStool;
public bool IsInUse;
public int HeightBoost;
public int VisualYOffset;
public int MapYOffset;
public void Reset()
{
this.HasAStool = false;
this.IsInUse = false;
this.HeightBoost = 0;
this.VisualYOffset = 0;
this.MapYOffset = 0;
}
public void SetStats(int heightBoost, int visualYOffset, int mapYOffset)
{
this.HasAStool = true;
this.HeightBoost = heightBoost;
this.VisualYOffset = visualYOffset;
this.MapYOffset = mapYOffset;
}
}
}

View file

@ -0,0 +1,15 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.DataStructures.SoundPlaySet
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
namespace Terraria.DataStructures
{
public class SoundPlaySet
{
public int IntendedCooldown;
public int SoundType;
public int SoundStyle;
}
}

View file

@ -0,0 +1,68 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.DataStructures.SpriteFrame
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
namespace Terraria.DataStructures
{
public struct SpriteFrame
{
public int PaddingX;
public int PaddingY;
private byte _currentColumn;
private byte _currentRow;
public readonly byte ColumnCount;
public readonly byte RowCount;
public byte CurrentColumn
{
get => this._currentColumn;
set => this._currentColumn = value;
}
public byte CurrentRow
{
get => this._currentRow;
set => this._currentRow = value;
}
public SpriteFrame(byte columns, byte rows)
{
this.PaddingX = 2;
this.PaddingY = 2;
this._currentColumn = (byte) 0;
this._currentRow = (byte) 0;
this.ColumnCount = columns;
this.RowCount = rows;
}
public SpriteFrame(byte columns, byte rows, byte currentColumn, byte currentRow)
{
this.PaddingX = 2;
this.PaddingY = 2;
this._currentColumn = currentColumn;
this._currentRow = currentRow;
this.ColumnCount = columns;
this.RowCount = rows;
}
public SpriteFrame With(byte columnToUse, byte rowToUse)
{
SpriteFrame spriteFrame = this;
spriteFrame.CurrentColumn = columnToUse;
spriteFrame.CurrentRow = rowToUse;
return spriteFrame;
}
public Rectangle GetSourceRectangle(Texture2D texture)
{
int num1 = texture.Width / (int) this.ColumnCount;
int num2 = texture.Height / (int) this.RowCount;
return new Rectangle((int) this.CurrentColumn * num1, (int) this.CurrentRow * num2, num1 - (this.ColumnCount == (byte) 1 ? 0 : this.PaddingX), num2 - (this.RowCount == (byte) 1 ? 0 : this.PaddingY));
}
}
}

View file

@ -0,0 +1,24 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.DataStructures.TileDataType
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
using System;
namespace Terraria.DataStructures
{
[Flags]
public enum TileDataType
{
Tile = 1,
TilePaint = 2,
Wall = 4,
WallPaint = 8,
Liquid = 16, // 0x00000010
Wiring = 32, // 0x00000020
Actuator = 64, // 0x00000040
Slope = 128, // 0x00000080
All = Slope | Actuator | Wiring | Liquid | WallPaint | Wall | TilePaint | Tile, // 0x000000FF
}
}

View file

@ -0,0 +1,34 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.DataStructures.TileDrawInfo
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
namespace Terraria.DataStructures
{
public class TileDrawInfo
{
public Tile tileCache;
public ushort typeCache;
public short tileFrameX;
public short tileFrameY;
public Texture2D drawTexture;
public Color tileLight;
public int tileTop;
public int tileWidth;
public int tileHeight;
public int halfBrickHeight;
public int addFrY;
public int addFrX;
public SpriteEffects tileSpriteEffect;
public Texture2D glowTexture;
public Rectangle glowSourceRect;
public Color glowColor;
public Vector3[] colorSlices = new Vector3[9];
public Color finalColor;
public Color colorTint;
}
}

View file

@ -0,0 +1,63 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.DataStructures.TileDrawSorter
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
using System;
using System.Collections.Generic;
namespace Terraria.DataStructures
{
public class TileDrawSorter
{
public TileDrawSorter.TileTexPoint[] tilesToDraw;
private int _holderLength;
private int _currentCacheIndex;
private TileDrawSorter.CustomComparer _tileComparer = new TileDrawSorter.CustomComparer();
public TileDrawSorter()
{
this._currentCacheIndex = 0;
this._holderLength = 9000;
this.tilesToDraw = new TileDrawSorter.TileTexPoint[this._holderLength];
}
public void reset() => this._currentCacheIndex = 0;
public void Cache(int x, int y, int type)
{
int index = this._currentCacheIndex++;
this.tilesToDraw[index].X = x;
this.tilesToDraw[index].Y = y;
this.tilesToDraw[index].TileType = type;
if (this._currentCacheIndex != this._holderLength)
return;
this.IncreaseArraySize();
}
private void IncreaseArraySize()
{
this._holderLength *= 2;
Array.Resize<TileDrawSorter.TileTexPoint>(ref this.tilesToDraw, this._holderLength);
}
public void Sort() => Array.Sort<TileDrawSorter.TileTexPoint>(this.tilesToDraw, 0, this._currentCacheIndex, (IComparer<TileDrawSorter.TileTexPoint>) this._tileComparer);
public int GetAmountToDraw() => this._currentCacheIndex;
public struct TileTexPoint
{
public int X;
public int Y;
public int TileType;
public override string ToString() => string.Format("X:{0}, Y:{1}, Type:{2}", (object) this.X, (object) this.Y, (object) this.TileType);
}
public class CustomComparer : Comparer<TileDrawSorter.TileTexPoint>
{
public override int Compare(TileDrawSorter.TileTexPoint x, TileDrawSorter.TileTexPoint y) => x.TileType.CompareTo(y.TileType);
}
}
}

View file

@ -0,0 +1,51 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.DataStructures.TileEntitiesManager
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
using System.Collections.Generic;
using Terraria.GameContent.Tile_Entities;
namespace Terraria.DataStructures
{
public class TileEntitiesManager
{
private int _nextEntityID;
private Dictionary<int, TileEntity> _types = new Dictionary<int, TileEntity>();
private int AssignNewID() => this._nextEntityID++;
private bool InvalidEntityID(int id) => id < 0 || id >= this._nextEntityID;
public void RegisterAll()
{
this.Register((TileEntity) new TETrainingDummy());
this.Register((TileEntity) new TEItemFrame());
this.Register((TileEntity) new TELogicSensor());
this.Register((TileEntity) new TEDisplayDoll());
this.Register((TileEntity) new TEWeaponsRack());
this.Register((TileEntity) new TEHatRack());
this.Register((TileEntity) new TEFoodPlatter());
this.Register((TileEntity) new TETeleportationPylon());
}
public void Register(TileEntity entity)
{
int num = this.AssignNewID();
this._types[num] = entity;
entity.RegisterTileEntityID(num);
}
public bool CheckValidTile(int id, int x, int y) => !this.InvalidEntityID(id) && this._types[id].IsTileValidForEntity(x, y);
public void NetPlaceEntity(int id, int x, int y)
{
if (this.InvalidEntityID(id) || !this._types[id].IsTileValidForEntity(x, y))
return;
this._types[id].NetPlaceEntityAttempt(x, y);
}
public TileEntity GenerateInstance(int id) => this.InvalidEntityID(id) ? (TileEntity) null : this._types[id].GenerateInstance();
}
}

View file

@ -0,0 +1,219 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.DataStructures.TileEntity
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
using Microsoft.Xna.Framework.Graphics;
using System;
using System.Collections.Generic;
using System.IO;
using Terraria.Audio;
using Terraria.GameInput;
namespace Terraria.DataStructures
{
public abstract class TileEntity
{
public static TileEntitiesManager manager;
public const int MaxEntitiesPerChunk = 1000;
public static Dictionary<int, TileEntity> ByID = new Dictionary<int, TileEntity>();
public static Dictionary<Point16, TileEntity> ByPosition = new Dictionary<Point16, TileEntity>();
public static int TileEntitiesNextID;
public int ID;
public Point16 Position;
public byte type;
public static int AssignNewID() => TileEntity.TileEntitiesNextID++;
public static event Action _UpdateStart;
public static event Action _UpdateEnd;
public static void Clear()
{
TileEntity.ByID.Clear();
TileEntity.ByPosition.Clear();
TileEntity.TileEntitiesNextID = 0;
}
public static void UpdateStart()
{
if (TileEntity._UpdateStart == null)
return;
TileEntity._UpdateStart();
}
public static void UpdateEnd()
{
if (TileEntity._UpdateEnd == null)
return;
TileEntity._UpdateEnd();
}
public static void InitializeAll()
{
TileEntity.manager = new TileEntitiesManager();
TileEntity.manager.RegisterAll();
}
public static void PlaceEntityNet(int x, int y, int type)
{
if (!WorldGen.InWorld(x, y) || TileEntity.ByPosition.ContainsKey(new Point16(x, y)))
return;
TileEntity.manager.NetPlaceEntity(type, x, y);
}
public virtual void Update()
{
}
public static void Write(BinaryWriter writer, TileEntity ent, bool networkSend = false)
{
writer.Write(ent.type);
ent.WriteInner(writer, networkSend);
}
public static TileEntity Read(BinaryReader reader, bool networkSend = false)
{
byte num = reader.ReadByte();
TileEntity instance = TileEntity.manager.GenerateInstance((int) num);
instance.type = num;
instance.ReadInner(reader, networkSend);
return instance;
}
private void WriteInner(BinaryWriter writer, bool networkSend)
{
if (!networkSend)
writer.Write(this.ID);
writer.Write(this.Position.X);
writer.Write(this.Position.Y);
this.WriteExtraData(writer, networkSend);
}
private void ReadInner(BinaryReader reader, bool networkSend)
{
if (!networkSend)
this.ID = reader.ReadInt32();
this.Position = new Point16(reader.ReadInt16(), reader.ReadInt16());
this.ReadExtraData(reader, networkSend);
}
public virtual void WriteExtraData(BinaryWriter writer, bool networkSend)
{
}
public virtual void ReadExtraData(BinaryReader reader, bool networkSend)
{
}
public virtual void OnPlayerUpdate(Player player)
{
}
public static bool IsOccupied(int id, out int interactingPlayer)
{
interactingPlayer = -1;
for (int index = 0; index < (int) byte.MaxValue; ++index)
{
Player player = Main.player[index];
if (player.active && !player.dead && player.tileEntityAnchor.interactEntityID == id)
{
interactingPlayer = index;
return true;
}
}
return false;
}
public virtual void OnInventoryDraw(Player player, SpriteBatch spriteBatch)
{
}
public virtual string GetItemGamepadInstructions(int slot = 0) => "";
public virtual bool TryGetItemGamepadOverrideInstructions(
Item[] inv,
int context,
int slot,
out string instruction)
{
instruction = (string) null;
return false;
}
public virtual bool OverrideItemSlotHover(Item[] inv, int context = 0, int slot = 0) => false;
public virtual bool OverrideItemSlotLeftClick(Item[] inv, int context = 0, int slot = 0) => false;
public static void BasicOpenCloseInteraction(Player player, int x, int y, int id)
{
player.CloseSign();
if (Main.netMode != 1)
{
Main.stackSplit = 600;
player.GamepadEnableGrappleCooldown();
int interactingPlayer;
if (TileEntity.IsOccupied(id, out interactingPlayer))
{
if (interactingPlayer != player.whoAmI)
return;
Recipe.FindRecipes();
SoundEngine.PlaySound(11);
player.tileEntityAnchor.Clear();
}
else
TileEntity.SetInteractionAnchor(player, x, y, id);
}
else
{
Main.stackSplit = 600;
player.GamepadEnableGrappleCooldown();
int interactingPlayer;
if (TileEntity.IsOccupied(id, out interactingPlayer))
{
if (interactingPlayer != player.whoAmI)
return;
Recipe.FindRecipes();
SoundEngine.PlaySound(11);
player.tileEntityAnchor.Clear();
NetMessage.SendData(122, number: -1, number2: ((float) Main.myPlayer));
}
else
NetMessage.SendData(122, number: id, number2: ((float) Main.myPlayer));
}
}
public static void SetInteractionAnchor(Player player, int x, int y, int id)
{
player.chest = -1;
player.SetTalkNPC(-1);
if (player.whoAmI == Main.myPlayer)
{
Main.playerInventory = true;
Main.recBigList = false;
Main.CreativeMenu.CloseMenu();
if (PlayerInput.GrappleAndInteractAreShared)
PlayerInput.Triggers.JustPressed.Grapple = false;
if (player.tileEntityAnchor.interactEntityID != -1)
SoundEngine.PlaySound(12);
else
SoundEngine.PlaySound(10);
}
player.tileEntityAnchor.Set(id, x, y);
}
public virtual void RegisterTileEntityID(int assignedID)
{
}
public virtual void NetPlaceEntityAttempt(int x, int y)
{
}
public virtual bool IsTileValidForEntity(int x, int y) => false;
public virtual TileEntity GenerateInstance() => (TileEntity) null;
}
}

View file

@ -0,0 +1,175 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.DataStructures.TileObjectPreviewData
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
using System;
namespace Terraria.DataStructures
{
public class TileObjectPreviewData
{
private ushort _type;
private short _style;
private int _alternate;
private int _random;
private bool _active;
private Point16 _size;
private Point16 _coordinates;
private Point16 _objectStart;
private int[,] _data;
private Point16 _dataSize;
private float _percentValid;
public static TileObjectPreviewData placementCache;
public static TileObjectPreviewData randomCache;
public const int None = 0;
public const int ValidSpot = 1;
public const int InvalidSpot = 2;
public void Reset()
{
this._active = false;
this._size = Point16.Zero;
this._coordinates = Point16.Zero;
this._objectStart = Point16.Zero;
this._percentValid = 0.0f;
this._type = (ushort) 0;
this._style = (short) 0;
this._alternate = -1;
this._random = -1;
if (this._data == null)
return;
Array.Clear((Array) this._data, 0, (int) this._dataSize.X * (int) this._dataSize.Y);
}
public void CopyFrom(TileObjectPreviewData copy)
{
this._type = copy._type;
this._style = copy._style;
this._alternate = copy._alternate;
this._random = copy._random;
this._active = copy._active;
this._size = copy._size;
this._coordinates = copy._coordinates;
this._objectStart = copy._objectStart;
this._percentValid = copy._percentValid;
if (this._data == null)
{
this._data = new int[(int) copy._dataSize.X, (int) copy._dataSize.Y];
this._dataSize = copy._dataSize;
}
else
Array.Clear((Array) this._data, 0, this._data.Length);
if ((int) this._dataSize.X < (int) copy._dataSize.X || (int) this._dataSize.Y < (int) copy._dataSize.Y)
{
int X = (int) copy._dataSize.X > (int) this._dataSize.X ? (int) copy._dataSize.X : (int) this._dataSize.X;
int Y = (int) copy._dataSize.Y > (int) this._dataSize.Y ? (int) copy._dataSize.Y : (int) this._dataSize.Y;
this._data = new int[X, Y];
this._dataSize = new Point16(X, Y);
}
for (int index1 = 0; index1 < (int) copy._dataSize.X; ++index1)
{
for (int index2 = 0; index2 < (int) copy._dataSize.Y; ++index2)
this._data[index1, index2] = copy._data[index1, index2];
}
}
public bool Active
{
get => this._active;
set => this._active = value;
}
public ushort Type
{
get => this._type;
set => this._type = value;
}
public short Style
{
get => this._style;
set => this._style = value;
}
public int Alternate
{
get => this._alternate;
set => this._alternate = value;
}
public int Random
{
get => this._random;
set => this._random = value;
}
public Point16 Size
{
get => this._size;
set
{
if (value.X <= (short) 0 || value.Y <= (short) 0)
throw new FormatException("PlacementData.Size was set to a negative value.");
if ((int) value.X > (int) this._dataSize.X || (int) value.Y > (int) this._dataSize.Y)
{
int X = (int) value.X > (int) this._dataSize.X ? (int) value.X : (int) this._dataSize.X;
int Y = (int) value.Y > (int) this._dataSize.Y ? (int) value.Y : (int) this._dataSize.Y;
int[,] numArray = new int[X, Y];
if (this._data != null)
{
for (int index1 = 0; index1 < (int) this._dataSize.X; ++index1)
{
for (int index2 = 0; index2 < (int) this._dataSize.Y; ++index2)
numArray[index1, index2] = this._data[index1, index2];
}
}
this._data = numArray;
this._dataSize = new Point16(X, Y);
}
this._size = value;
}
}
public Point16 Coordinates
{
get => this._coordinates;
set => this._coordinates = value;
}
public Point16 ObjectStart
{
get => this._objectStart;
set => this._objectStart = value;
}
public void AllInvalid()
{
for (int index1 = 0; index1 < (int) this._size.X; ++index1)
{
for (int index2 = 0; index2 < (int) this._size.Y; ++index2)
{
if (this._data[index1, index2] != 0)
this._data[index1, index2] = 2;
}
}
}
public int this[int x, int y]
{
get
{
if (x < 0 || y < 0 || x >= (int) this._size.X || y >= (int) this._size.Y)
throw new IndexOutOfRangeException();
return this._data[x, y];
}
set
{
if (x < 0 || y < 0 || x >= (int) this._size.X || y >= (int) this._size.Y)
throw new IndexOutOfRangeException();
this._data[x, y] = value;
}
}
}
}

View file

@ -0,0 +1,15 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.DataStructures.WeaponDrawOrder
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
namespace Terraria.DataStructures
{
public enum WeaponDrawOrder
{
BehindBackArm,
BehindFrontArm,
OverFrontArm,
}
}

View file

@ -0,0 +1,37 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.DataStructures.WingStats
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
namespace Terraria.DataStructures
{
public struct WingStats
{
public static readonly WingStats Default;
public int FlyTime;
public float AccRunSpeedOverride;
public float AccRunAccelerationMult;
public bool HasDownHoverStats;
public float DownHoverSpeedOverride;
public float DownHoverAccelerationMult;
public WingStats(
int flyTime = 100,
float flySpeedOverride = -1f,
float accelerationMultiplier = 1f,
bool hasHoldDownHoverFeatures = false,
float hoverFlySpeedOverride = -1f,
float hoverAccelerationMultiplier = 1f)
{
this.FlyTime = flyTime;
this.AccRunSpeedOverride = flySpeedOverride;
this.AccRunAccelerationMult = accelerationMultiplier;
this.HasDownHoverStats = hasHoldDownHoverFeatures;
this.DownHoverSpeedOverride = hoverFlySpeedOverride;
this.DownHoverAccelerationMult = hoverAccelerationMultiplier;
}
public WingStats WithSpeedBoost(float multiplier) => new WingStats(this.FlyTime, this.AccRunSpeedOverride * multiplier, this.AccRunAccelerationMult, this.HasDownHoverStats, this.DownHoverSpeedOverride * multiplier, this.DownHoverAccelerationMult);
}
}