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,29 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.Social.Base.AchievementsSocialModule
// 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.Social.Base
{
public abstract class AchievementsSocialModule : ISocialModule
{
public abstract void Initialize();
public abstract void Shutdown();
public abstract byte[] GetEncryptionKey();
public abstract string GetSavePath();
public abstract void UpdateIntStat(string name, int value);
public abstract void UpdateFloatStat(string name, float value);
public abstract void CompleteAchievement(string name);
public abstract bool IsAchievementCompleted(string name);
public abstract void StoreStats();
}
}

View file

@ -0,0 +1,48 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.Social.Base.CloudSocialModule
// 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;
using Terraria.IO;
namespace Terraria.Social.Base
{
public abstract class CloudSocialModule : ISocialModule
{
public bool EnabledByDefault;
public virtual void Initialize()
{
Main.Configuration.OnLoad += (Action<Preferences>) (preferences => this.EnabledByDefault = preferences.Get<bool>("CloudSavingDefault", false));
Main.Configuration.OnSave += (Action<Preferences>) (preferences => preferences.Put("CloudSavingDefault", (object) this.EnabledByDefault));
}
public abstract void Shutdown();
public abstract IEnumerable<string> GetFiles();
public abstract bool Write(string path, byte[] data, int length);
public abstract void Read(string path, byte[] buffer, int length);
public abstract bool HasFile(string path);
public abstract int GetFileSize(string path);
public abstract bool Delete(string path);
public byte[] Read(string path)
{
byte[] buffer = new byte[this.GetFileSize(path)];
this.Read(path, buffer, buffer.Length);
return buffer;
}
public void Read(string path, byte[] buffer) => this.Read(path, buffer, buffer.Length);
public bool Write(string path, byte[] data) => this.Write(path, data, data.Length);
}
}

View file

@ -0,0 +1,19 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.Social.Base.FriendsSocialModule
// 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.Social.Base
{
public abstract class FriendsSocialModule : ISocialModule
{
public abstract string GetUsername();
public abstract void OpenJoinInterface();
public abstract void Initialize();
public abstract void Shutdown();
}
}

View file

@ -0,0 +1,45 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.Social.Base.NetSocialModule
// 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.Diagnostics;
using Terraria.Net;
using Terraria.Net.Sockets;
namespace Terraria.Social.Base
{
public abstract class NetSocialModule : ISocialModule
{
public abstract void Initialize();
public abstract void Shutdown();
public abstract void Close(RemoteAddress address);
public abstract bool IsConnected(RemoteAddress address);
public abstract void Connect(RemoteAddress address);
public abstract bool Send(RemoteAddress address, byte[] data, int length);
public abstract int Receive(RemoteAddress address, byte[] data, int offset, int length);
public abstract bool IsDataAvailable(RemoteAddress address);
public abstract void LaunchLocalServer(Process process, ServerMode mode);
public abstract bool CanInvite();
public abstract void OpenInviteInterface();
public abstract void CancelJoin();
public abstract bool StartListening(SocketConnectionAccepted callback);
public abstract void StopListening();
public abstract ulong GetLobbyId();
}
}

View file

@ -0,0 +1,26 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.Social.Base.OverlaySocialModule
// 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.Social.Base
{
public abstract class OverlaySocialModule : ISocialModule
{
public abstract void Initialize();
public abstract void Shutdown();
public abstract bool IsGamepadTextInputActive();
public abstract bool ShowGamepadTextInput(
string description,
uint maxLength,
bool multiLine = false,
string existingText = "",
bool password = false);
public abstract string GetGamepadText();
}
}

View file

@ -0,0 +1,41 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.Social.Base.RichPresenceState
// 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 Terraria.GameContent.UI.States;
namespace Terraria.Social.Base
{
public class RichPresenceState : IEquatable<RichPresenceState>
{
public RichPresenceState.GameModeState GameMode;
public bool Equals(RichPresenceState other) => this.GameMode == other.GameMode;
public static RichPresenceState GetCurrentState()
{
RichPresenceState richPresenceState = new RichPresenceState();
if (Main.gameMenu)
{
int num = Main.MenuUI.CurrentState is UICharacterCreation ? 1 : 0;
bool flag = Main.MenuUI.CurrentState is UIWorldCreation;
richPresenceState.GameMode = num == 0 ? (!flag ? RichPresenceState.GameModeState.InMainMenu : RichPresenceState.GameModeState.CreatingWorld) : RichPresenceState.GameModeState.CreatingPlayer;
}
else
richPresenceState.GameMode = Main.netMode != 0 ? RichPresenceState.GameModeState.PlayingMulti : RichPresenceState.GameModeState.PlayingSingle;
return richPresenceState;
}
public enum GameModeState
{
InMainMenu,
CreatingPlayer,
CreatingWorld,
PlayingSingle,
PlayingMulti,
}
}
}

View file

@ -0,0 +1,10 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.Social.Base.ServerJoinRequestEvent
// 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.Social.Base
{
public delegate void ServerJoinRequestEvent(UserJoinToServerRequest request);
}

View file

@ -0,0 +1,68 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.Social.Base.ServerJoinRequestsManager
// 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;
using System.Collections.ObjectModel;
namespace Terraria.Social.Base
{
public class ServerJoinRequestsManager
{
private readonly List<UserJoinToServerRequest> _requests;
public readonly ReadOnlyCollection<UserJoinToServerRequest> CurrentRequests;
public event ServerJoinRequestEvent OnRequestAdded;
public event ServerJoinRequestEvent OnRequestRemoved;
public ServerJoinRequestsManager()
{
this._requests = new List<UserJoinToServerRequest>();
this.CurrentRequests = new ReadOnlyCollection<UserJoinToServerRequest>((IList<UserJoinToServerRequest>) this._requests);
}
public void Update()
{
for (int index = this._requests.Count - 1; index >= 0; --index)
{
if (!this._requests[index].IsValid())
this.RemoveRequestAtIndex(index);
}
}
public void Add(UserJoinToServerRequest request)
{
for (int index = this._requests.Count - 1; index >= 0; --index)
{
if (this._requests[index].Equals((object) request))
this.RemoveRequestAtIndex(index);
}
this._requests.Add(request);
request.OnAccepted += (Action) (() => this.RemoveRequest(request));
request.OnRejected += (Action) (() => this.RemoveRequest(request));
if (this.OnRequestAdded == null)
return;
this.OnRequestAdded(request);
}
private void RemoveRequestAtIndex(int i)
{
UserJoinToServerRequest request = this._requests[i];
this._requests.RemoveAt(i);
if (this.OnRequestRemoved == null)
return;
this.OnRequestRemoved(request);
}
private void RemoveRequest(UserJoinToServerRequest request)
{
if (!this._requests.Remove(request) || this.OnRequestRemoved == null)
return;
this.OnRequestRemoved(request);
}
}
}

View file

@ -0,0 +1,45 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.Social.Base.UserJoinToServerRequest
// 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.Social.Base
{
public abstract class UserJoinToServerRequest
{
internal string UserDisplayName { get; private set; }
internal string UserFullIdentifier { get; private set; }
public event Action OnAccepted;
public event Action OnRejected;
public UserJoinToServerRequest(string userDisplayName, string fullIdentifier)
{
this.UserDisplayName = userDisplayName;
this.UserFullIdentifier = fullIdentifier;
}
public void Accept()
{
if (this.OnAccepted == null)
return;
this.OnAccepted();
}
public void Reject()
{
if (this.OnRejected == null)
return;
this.OnRejected();
}
public abstract bool IsValid();
public abstract string GetUserWrapperText();
}
}