Terraria 1.4.0.5 Source Code
This commit is contained in:
commit
05205f009e
1059 changed files with 563450 additions and 0 deletions
138
Achievements/Achievement.cs
Normal file
138
Achievements/Achievement.cs
Normal file
|
@ -0,0 +1,138 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Achievements.Achievement
|
||||
// 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 Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System.Collections.Generic;
|
||||
using Terraria.Localization;
|
||||
using Terraria.Social;
|
||||
|
||||
namespace Terraria.Achievements
|
||||
{
|
||||
[JsonObject]
|
||||
public class Achievement
|
||||
{
|
||||
private static int _totalAchievements;
|
||||
public readonly string Name;
|
||||
public readonly LocalizedText FriendlyName;
|
||||
public readonly LocalizedText Description;
|
||||
public readonly int Id = Achievement._totalAchievements++;
|
||||
private AchievementCategory _category;
|
||||
private IAchievementTracker _tracker;
|
||||
[JsonProperty("Conditions")]
|
||||
private Dictionary<string, AchievementCondition> _conditions = new Dictionary<string, AchievementCondition>();
|
||||
private int _completedCount;
|
||||
|
||||
public AchievementCategory Category => this._category;
|
||||
|
||||
public event Achievement.AchievementCompleted OnCompleted;
|
||||
|
||||
public bool HasTracker => this._tracker != null;
|
||||
|
||||
public IAchievementTracker GetTracker() => this._tracker;
|
||||
|
||||
public bool IsCompleted => this._completedCount == this._conditions.Count;
|
||||
|
||||
public Achievement(string name)
|
||||
{
|
||||
this.Name = name;
|
||||
this.FriendlyName = Language.GetText("Achievements." + name + "_Name");
|
||||
this.Description = Language.GetText("Achievements." + name + "_Description");
|
||||
}
|
||||
|
||||
public void ClearProgress()
|
||||
{
|
||||
this._completedCount = 0;
|
||||
foreach (KeyValuePair<string, AchievementCondition> condition in this._conditions)
|
||||
condition.Value.Clear();
|
||||
if (this._tracker == null)
|
||||
return;
|
||||
this._tracker.Clear();
|
||||
}
|
||||
|
||||
public void Load(Dictionary<string, JObject> conditions)
|
||||
{
|
||||
foreach (KeyValuePair<string, JObject> condition in conditions)
|
||||
{
|
||||
AchievementCondition achievementCondition;
|
||||
if (this._conditions.TryGetValue(condition.Key, out achievementCondition))
|
||||
{
|
||||
achievementCondition.Load(condition.Value);
|
||||
if (achievementCondition.IsCompleted)
|
||||
++this._completedCount;
|
||||
}
|
||||
}
|
||||
if (this._tracker == null)
|
||||
return;
|
||||
this._tracker.Load();
|
||||
}
|
||||
|
||||
public void AddCondition(AchievementCondition condition)
|
||||
{
|
||||
this._conditions[condition.Name] = condition;
|
||||
condition.OnComplete += new AchievementCondition.AchievementUpdate(this.OnConditionComplete);
|
||||
}
|
||||
|
||||
private void OnConditionComplete(AchievementCondition condition)
|
||||
{
|
||||
++this._completedCount;
|
||||
if (this._completedCount != this._conditions.Count)
|
||||
return;
|
||||
if (this._tracker == null && SocialAPI.Achievements != null)
|
||||
SocialAPI.Achievements.CompleteAchievement(this.Name);
|
||||
if (this.OnCompleted == null)
|
||||
return;
|
||||
this.OnCompleted(this);
|
||||
}
|
||||
|
||||
private void UseTracker(IAchievementTracker tracker)
|
||||
{
|
||||
tracker.ReportAs("STAT_" + this.Name);
|
||||
this._tracker = tracker;
|
||||
}
|
||||
|
||||
public void UseTrackerFromCondition(string conditionName) => this.UseTracker(this.GetConditionTracker(conditionName));
|
||||
|
||||
public void UseConditionsCompletedTracker()
|
||||
{
|
||||
ConditionsCompletedTracker completedTracker = new ConditionsCompletedTracker();
|
||||
foreach (KeyValuePair<string, AchievementCondition> condition in this._conditions)
|
||||
completedTracker.AddCondition(condition.Value);
|
||||
this.UseTracker((IAchievementTracker) completedTracker);
|
||||
}
|
||||
|
||||
public void UseConditionsCompletedTracker(params string[] conditions)
|
||||
{
|
||||
ConditionsCompletedTracker completedTracker = new ConditionsCompletedTracker();
|
||||
for (int index = 0; index < conditions.Length; ++index)
|
||||
{
|
||||
string condition = conditions[index];
|
||||
completedTracker.AddCondition(this._conditions[condition]);
|
||||
}
|
||||
this.UseTracker((IAchievementTracker) completedTracker);
|
||||
}
|
||||
|
||||
public void ClearTracker() => this._tracker = (IAchievementTracker) null;
|
||||
|
||||
private IAchievementTracker GetConditionTracker(string name) => this._conditions[name].GetAchievementTracker();
|
||||
|
||||
public void AddConditions(params AchievementCondition[] conditions)
|
||||
{
|
||||
for (int index = 0; index < conditions.Length; ++index)
|
||||
this.AddCondition(conditions[index]);
|
||||
}
|
||||
|
||||
public AchievementCondition GetCondition(string conditionName)
|
||||
{
|
||||
AchievementCondition achievementCondition;
|
||||
return this._conditions.TryGetValue(conditionName, out achievementCondition) ? achievementCondition : (AchievementCondition) null;
|
||||
}
|
||||
|
||||
public void SetCategory(AchievementCategory category) => this._category = category;
|
||||
|
||||
public delegate void AchievementCompleted(Achievement achievement);
|
||||
}
|
||||
}
|
17
Achievements/AchievementCategory.cs
Normal file
17
Achievements/AchievementCategory.cs
Normal file
|
@ -0,0 +1,17 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Achievements.AchievementCategory
|
||||
// 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.Achievements
|
||||
{
|
||||
public enum AchievementCategory
|
||||
{
|
||||
None = -1, // 0xFFFFFFFF
|
||||
Slayer = 0,
|
||||
Collector = 1,
|
||||
Explorer = 2,
|
||||
Challenger = 3,
|
||||
}
|
||||
}
|
51
Achievements/AchievementCondition.cs
Normal file
51
Achievements/AchievementCondition.cs
Normal file
|
@ -0,0 +1,51 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Achievements.AchievementCondition
|
||||
// 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 Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace Terraria.Achievements
|
||||
{
|
||||
[JsonObject]
|
||||
public abstract class AchievementCondition
|
||||
{
|
||||
public readonly string Name;
|
||||
protected IAchievementTracker _tracker;
|
||||
[JsonProperty("Completed")]
|
||||
private bool _isCompleted;
|
||||
|
||||
public event AchievementCondition.AchievementUpdate OnComplete;
|
||||
|
||||
public bool IsCompleted => this._isCompleted;
|
||||
|
||||
protected AchievementCondition(string name) => this.Name = name;
|
||||
|
||||
public virtual void Load(JObject state) => this._isCompleted = JToken.op_Explicit(state["Completed"]);
|
||||
|
||||
public virtual void Clear() => this._isCompleted = false;
|
||||
|
||||
public virtual void Complete()
|
||||
{
|
||||
if (this._isCompleted)
|
||||
return;
|
||||
this._isCompleted = true;
|
||||
if (this.OnComplete == null)
|
||||
return;
|
||||
this.OnComplete(this);
|
||||
}
|
||||
|
||||
protected virtual IAchievementTracker CreateAchievementTracker() => (IAchievementTracker) null;
|
||||
|
||||
public IAchievementTracker GetAchievementTracker()
|
||||
{
|
||||
if (this._tracker == null)
|
||||
this._tracker = this.CreateAchievementTracker();
|
||||
return this._tracker;
|
||||
}
|
||||
|
||||
public delegate void AchievementUpdate(AchievementCondition condition);
|
||||
}
|
||||
}
|
190
Achievements/AchievementManager.cs
Normal file
190
Achievements/AchievementManager.cs
Normal file
|
@ -0,0 +1,190 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Achievements.AchievementManager
|
||||
// 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 Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Bson;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using Terraria.Social;
|
||||
using Terraria.UI;
|
||||
using Terraria.Utilities;
|
||||
|
||||
namespace Terraria.Achievements
|
||||
{
|
||||
public class AchievementManager
|
||||
{
|
||||
private string _savePath;
|
||||
private bool _isCloudSave;
|
||||
private Dictionary<string, Achievement> _achievements = new Dictionary<string, Achievement>();
|
||||
private readonly JsonSerializerSettings _serializerSettings = new JsonSerializerSettings();
|
||||
private byte[] _cryptoKey;
|
||||
private Dictionary<string, int> _achievementIconIndexes = new Dictionary<string, int>();
|
||||
private static object _ioLock = new object();
|
||||
|
||||
public event Achievement.AchievementCompleted OnAchievementCompleted;
|
||||
|
||||
public AchievementManager()
|
||||
{
|
||||
if (SocialAPI.Achievements != null)
|
||||
{
|
||||
this._savePath = SocialAPI.Achievements.GetSavePath();
|
||||
this._isCloudSave = true;
|
||||
this._cryptoKey = SocialAPI.Achievements.GetEncryptionKey();
|
||||
}
|
||||
else
|
||||
{
|
||||
this._savePath = Main.SavePath + Path.DirectorySeparatorChar.ToString() + "achievements.dat";
|
||||
this._isCloudSave = false;
|
||||
this._cryptoKey = Encoding.ASCII.GetBytes("RELOGIC-TERRARIA");
|
||||
}
|
||||
}
|
||||
|
||||
public void Save() => FileUtilities.ProtectedInvoke((Action) (() => this.Save(this._savePath, this._isCloudSave)));
|
||||
|
||||
private void Save(string path, bool cloud)
|
||||
{
|
||||
lock (AchievementManager._ioLock)
|
||||
{
|
||||
if (SocialAPI.Achievements != null)
|
||||
SocialAPI.Achievements.StoreStats();
|
||||
try
|
||||
{
|
||||
using (MemoryStream memoryStream = new MemoryStream())
|
||||
{
|
||||
using (CryptoStream cryptoStream = new CryptoStream((Stream) memoryStream, new RijndaelManaged().CreateEncryptor(this._cryptoKey, this._cryptoKey), CryptoStreamMode.Write))
|
||||
{
|
||||
using (BsonWriter bsonWriter = new BsonWriter((Stream) cryptoStream))
|
||||
{
|
||||
JsonSerializer.Create(this._serializerSettings).Serialize((JsonWriter) bsonWriter, (object) this._achievements);
|
||||
((JsonWriter) bsonWriter).Flush();
|
||||
cryptoStream.FlushFinalBlock();
|
||||
FileUtilities.WriteAllBytes(path, memoryStream.ToArray(), cloud);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
string savePath = this._savePath;
|
||||
FancyErrorPrinter.ShowFileSavingFailError(ex, savePath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public List<Achievement> CreateAchievementsList() => this._achievements.Values.ToList<Achievement>();
|
||||
|
||||
public void Load() => this.Load(this._savePath, this._isCloudSave);
|
||||
|
||||
private void Load(string path, bool cloud)
|
||||
{
|
||||
bool flag = false;
|
||||
lock (AchievementManager._ioLock)
|
||||
{
|
||||
if (!FileUtilities.Exists(path, cloud))
|
||||
return;
|
||||
byte[] buffer = FileUtilities.ReadAllBytes(path, cloud);
|
||||
Dictionary<string, AchievementManager.StoredAchievement> dictionary = (Dictionary<string, AchievementManager.StoredAchievement>) null;
|
||||
try
|
||||
{
|
||||
using (MemoryStream memoryStream = new MemoryStream(buffer))
|
||||
{
|
||||
using (CryptoStream cryptoStream = new CryptoStream((Stream) memoryStream, new RijndaelManaged().CreateDecryptor(this._cryptoKey, this._cryptoKey), CryptoStreamMode.Read))
|
||||
{
|
||||
using (BsonReader bsonReader = new BsonReader((Stream) cryptoStream))
|
||||
dictionary = JsonSerializer.Create(this._serializerSettings).Deserialize<Dictionary<string, AchievementManager.StoredAchievement>>((JsonReader) bsonReader);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
FileUtilities.Delete(path, cloud);
|
||||
return;
|
||||
}
|
||||
if (dictionary == null)
|
||||
return;
|
||||
foreach (KeyValuePair<string, AchievementManager.StoredAchievement> keyValuePair in dictionary)
|
||||
{
|
||||
if (this._achievements.ContainsKey(keyValuePair.Key))
|
||||
this._achievements[keyValuePair.Key].Load(keyValuePair.Value.Conditions);
|
||||
}
|
||||
if (SocialAPI.Achievements != null)
|
||||
{
|
||||
foreach (KeyValuePair<string, Achievement> achievement in this._achievements)
|
||||
{
|
||||
if (achievement.Value.IsCompleted && !SocialAPI.Achievements.IsAchievementCompleted(achievement.Key))
|
||||
{
|
||||
flag = true;
|
||||
achievement.Value.ClearProgress();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!flag)
|
||||
return;
|
||||
this.Save();
|
||||
}
|
||||
|
||||
public void ClearAll()
|
||||
{
|
||||
if (SocialAPI.Achievements != null)
|
||||
return;
|
||||
foreach (KeyValuePair<string, Achievement> achievement in this._achievements)
|
||||
achievement.Value.ClearProgress();
|
||||
this.Save();
|
||||
}
|
||||
|
||||
private void AchievementCompleted(Achievement achievement)
|
||||
{
|
||||
this.Save();
|
||||
if (this.OnAchievementCompleted == null)
|
||||
return;
|
||||
this.OnAchievementCompleted(achievement);
|
||||
}
|
||||
|
||||
public void Register(Achievement achievement)
|
||||
{
|
||||
this._achievements.Add(achievement.Name, achievement);
|
||||
achievement.OnCompleted += new Achievement.AchievementCompleted(this.AchievementCompleted);
|
||||
}
|
||||
|
||||
public void RegisterIconIndex(string achievementName, int iconIndex) => this._achievementIconIndexes.Add(achievementName, iconIndex);
|
||||
|
||||
public void RegisterAchievementCategory(string achievementName, AchievementCategory category) => this._achievements[achievementName].SetCategory(category);
|
||||
|
||||
public Achievement GetAchievement(string achievementName)
|
||||
{
|
||||
Achievement achievement;
|
||||
return this._achievements.TryGetValue(achievementName, out achievement) ? achievement : (Achievement) null;
|
||||
}
|
||||
|
||||
public T GetCondition<T>(string achievementName, string conditionName) where T : AchievementCondition => this.GetCondition(achievementName, conditionName) as T;
|
||||
|
||||
public AchievementCondition GetCondition(
|
||||
string achievementName,
|
||||
string conditionName)
|
||||
{
|
||||
Achievement achievement;
|
||||
return this._achievements.TryGetValue(achievementName, out achievement) ? achievement.GetCondition(conditionName) : (AchievementCondition) null;
|
||||
}
|
||||
|
||||
public int GetIconIndex(string achievementName)
|
||||
{
|
||||
int num;
|
||||
return this._achievementIconIndexes.TryGetValue(achievementName, out num) ? num : 0;
|
||||
}
|
||||
|
||||
private class StoredAchievement
|
||||
{
|
||||
[JsonProperty]
|
||||
public Dictionary<string, JObject> Conditions;
|
||||
}
|
||||
}
|
||||
}
|
56
Achievements/AchievementTracker`1.cs
Normal file
56
Achievements/AchievementTracker`1.cs
Normal file
|
@ -0,0 +1,56 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Achievements.AchievementTracker`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.Social;
|
||||
|
||||
namespace Terraria.Achievements
|
||||
{
|
||||
public abstract class AchievementTracker<T> : IAchievementTracker
|
||||
{
|
||||
protected T _value;
|
||||
protected T _maxValue;
|
||||
protected string _name;
|
||||
private TrackerType _type;
|
||||
|
||||
public T Value => this._value;
|
||||
|
||||
public T MaxValue => this._maxValue;
|
||||
|
||||
protected AchievementTracker(TrackerType type) => this._type = type;
|
||||
|
||||
void IAchievementTracker.ReportAs(string name) => this._name = name;
|
||||
|
||||
TrackerType IAchievementTracker.GetTrackerType() => this._type;
|
||||
|
||||
void IAchievementTracker.Clear() => this.SetValue(default (T));
|
||||
|
||||
public void SetValue(T newValue, bool reportUpdate = true)
|
||||
{
|
||||
if (newValue.Equals((object) this._value))
|
||||
return;
|
||||
this._value = newValue;
|
||||
if (!reportUpdate)
|
||||
return;
|
||||
this.ReportUpdate();
|
||||
if (!this._value.Equals((object) this._maxValue))
|
||||
return;
|
||||
this.OnComplete();
|
||||
}
|
||||
|
||||
public abstract void ReportUpdate();
|
||||
|
||||
protected abstract void Load();
|
||||
|
||||
void IAchievementTracker.Load() => this.Load();
|
||||
|
||||
protected void OnComplete()
|
||||
{
|
||||
if (SocialAPI.Achievements == null)
|
||||
return;
|
||||
SocialAPI.Achievements.StoreStats();
|
||||
}
|
||||
}
|
||||
}
|
35
Achievements/ConditionFloatTracker.cs
Normal file
35
Achievements/ConditionFloatTracker.cs
Normal file
|
@ -0,0 +1,35 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Achievements.ConditionFloatTracker
|
||||
// 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.Social;
|
||||
|
||||
namespace Terraria.Achievements
|
||||
{
|
||||
public class ConditionFloatTracker : AchievementTracker<float>
|
||||
{
|
||||
public ConditionFloatTracker(float maxValue)
|
||||
: base(TrackerType.Float)
|
||||
{
|
||||
this._maxValue = maxValue;
|
||||
}
|
||||
|
||||
public ConditionFloatTracker()
|
||||
: base(TrackerType.Float)
|
||||
{
|
||||
}
|
||||
|
||||
public override void ReportUpdate()
|
||||
{
|
||||
if (SocialAPI.Achievements == null || this._name == null)
|
||||
return;
|
||||
SocialAPI.Achievements.UpdateFloatStat(this._name, this._value);
|
||||
}
|
||||
|
||||
protected override void Load()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
35
Achievements/ConditionIntTracker.cs
Normal file
35
Achievements/ConditionIntTracker.cs
Normal file
|
@ -0,0 +1,35 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Achievements.ConditionIntTracker
|
||||
// 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.Social;
|
||||
|
||||
namespace Terraria.Achievements
|
||||
{
|
||||
public class ConditionIntTracker : AchievementTracker<int>
|
||||
{
|
||||
public ConditionIntTracker()
|
||||
: base(TrackerType.Int)
|
||||
{
|
||||
}
|
||||
|
||||
public ConditionIntTracker(int maxValue)
|
||||
: base(TrackerType.Int)
|
||||
{
|
||||
this._maxValue = maxValue;
|
||||
}
|
||||
|
||||
public override void ReportUpdate()
|
||||
{
|
||||
if (SocialAPI.Achievements == null || this._name == null)
|
||||
return;
|
||||
SocialAPI.Achievements.UpdateIntStat(this._name, this._value);
|
||||
}
|
||||
|
||||
protected override void Load()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
34
Achievements/ConditionsCompletedTracker.cs
Normal file
34
Achievements/ConditionsCompletedTracker.cs
Normal file
|
@ -0,0 +1,34 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Achievements.ConditionsCompletedTracker
|
||||
// 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.Achievements
|
||||
{
|
||||
public class ConditionsCompletedTracker : ConditionIntTracker
|
||||
{
|
||||
private List<AchievementCondition> _conditions = new List<AchievementCondition>();
|
||||
|
||||
public void AddCondition(AchievementCondition condition)
|
||||
{
|
||||
++this._maxValue;
|
||||
condition.OnComplete += new AchievementCondition.AchievementUpdate(this.OnConditionCompleted);
|
||||
this._conditions.Add(condition);
|
||||
}
|
||||
|
||||
private void OnConditionCompleted(AchievementCondition condition) => this.SetValue(Math.Min(this._value + 1, this._maxValue));
|
||||
|
||||
protected override void Load()
|
||||
{
|
||||
for (int index = 0; index < this._conditions.Count; ++index)
|
||||
{
|
||||
if (this._conditions[index].IsCompleted)
|
||||
++this._value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
19
Achievements/IAchievementTracker.cs
Normal file
19
Achievements/IAchievementTracker.cs
Normal file
|
@ -0,0 +1,19 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Achievements.IAchievementTracker
|
||||
// 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.Achievements
|
||||
{
|
||||
public interface IAchievementTracker
|
||||
{
|
||||
void ReportAs(string name);
|
||||
|
||||
TrackerType GetTrackerType();
|
||||
|
||||
void Load();
|
||||
|
||||
void Clear();
|
||||
}
|
||||
}
|
14
Achievements/TrackerType.cs
Normal file
14
Achievements/TrackerType.cs
Normal file
|
@ -0,0 +1,14 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Achievements.TrackerType
|
||||
// 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.Achievements
|
||||
{
|
||||
public enum TrackerType
|
||||
{
|
||||
Float,
|
||||
Int,
|
||||
}
|
||||
}
|
164
Animation.cs
Normal file
164
Animation.cs
Normal file
|
@ -0,0 +1,164 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Animation
|
||||
// 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.DataStructures;
|
||||
|
||||
namespace Terraria
|
||||
{
|
||||
public class Animation
|
||||
{
|
||||
private static List<Animation> _animations;
|
||||
private static Dictionary<Point16, Animation> _temporaryAnimations;
|
||||
private static List<Point16> _awaitingRemoval;
|
||||
private static List<Animation> _awaitingAddition;
|
||||
private bool _temporary;
|
||||
private Point16 _coordinates;
|
||||
private ushort _tileType;
|
||||
private int _frame;
|
||||
private int _frameMax;
|
||||
private int _frameCounter;
|
||||
private int _frameCounterMax;
|
||||
private int[] _frameData;
|
||||
|
||||
public static void Initialize()
|
||||
{
|
||||
Animation._animations = new List<Animation>();
|
||||
Animation._temporaryAnimations = new Dictionary<Point16, Animation>();
|
||||
Animation._awaitingRemoval = new List<Point16>();
|
||||
Animation._awaitingAddition = new List<Animation>();
|
||||
}
|
||||
|
||||
private void SetDefaults(int type)
|
||||
{
|
||||
this._tileType = (ushort) 0;
|
||||
this._frame = 0;
|
||||
this._frameMax = 0;
|
||||
this._frameCounter = 0;
|
||||
this._frameCounterMax = 0;
|
||||
this._temporary = false;
|
||||
switch (type)
|
||||
{
|
||||
case 0:
|
||||
this._frameMax = 5;
|
||||
this._frameCounterMax = 12;
|
||||
this._frameData = new int[this._frameMax];
|
||||
for (int index = 0; index < this._frameMax; ++index)
|
||||
this._frameData[index] = index + 1;
|
||||
break;
|
||||
case 1:
|
||||
this._frameMax = 5;
|
||||
this._frameCounterMax = 12;
|
||||
this._frameData = new int[this._frameMax];
|
||||
for (int index = 0; index < this._frameMax; ++index)
|
||||
this._frameData[index] = 5 - index;
|
||||
break;
|
||||
case 2:
|
||||
this._frameCounterMax = 6;
|
||||
this._frameData = new int[5]{ 1, 2, 2, 2, 1 };
|
||||
this._frameMax = this._frameData.Length;
|
||||
break;
|
||||
case 3:
|
||||
this._frameMax = 5;
|
||||
this._frameCounterMax = 5;
|
||||
this._frameData = new int[this._frameMax];
|
||||
for (int index = 0; index < this._frameMax; ++index)
|
||||
this._frameData[index] = index;
|
||||
break;
|
||||
case 4:
|
||||
this._frameMax = 3;
|
||||
this._frameCounterMax = 5;
|
||||
this._frameData = new int[this._frameMax];
|
||||
for (int index = 0; index < this._frameMax; ++index)
|
||||
this._frameData[index] = 9 + index;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public static void NewTemporaryAnimation(int type, ushort tileType, int x, int y)
|
||||
{
|
||||
Point16 point16 = new Point16(x, y);
|
||||
if (x < 0 || x >= Main.maxTilesX || y < 0 || y >= Main.maxTilesY)
|
||||
return;
|
||||
Animation animation = new Animation();
|
||||
animation.SetDefaults(type);
|
||||
animation._tileType = tileType;
|
||||
animation._coordinates = point16;
|
||||
animation._temporary = true;
|
||||
Animation._awaitingAddition.Add(animation);
|
||||
if (Main.netMode != 2)
|
||||
return;
|
||||
NetMessage.SendTemporaryAnimation(-1, type, (int) tileType, x, y);
|
||||
}
|
||||
|
||||
private static void RemoveTemporaryAnimation(short x, short y)
|
||||
{
|
||||
Point16 key = new Point16(x, y);
|
||||
if (!Animation._temporaryAnimations.ContainsKey(key))
|
||||
return;
|
||||
Animation._awaitingRemoval.Add(key);
|
||||
}
|
||||
|
||||
public static void UpdateAll()
|
||||
{
|
||||
for (int index = 0; index < Animation._animations.Count; ++index)
|
||||
Animation._animations[index].Update();
|
||||
if (Animation._awaitingAddition.Count > 0)
|
||||
{
|
||||
for (int index = 0; index < Animation._awaitingAddition.Count; ++index)
|
||||
{
|
||||
Animation animation = Animation._awaitingAddition[index];
|
||||
Animation._temporaryAnimations[animation._coordinates] = animation;
|
||||
}
|
||||
Animation._awaitingAddition.Clear();
|
||||
}
|
||||
foreach (KeyValuePair<Point16, Animation> temporaryAnimation in Animation._temporaryAnimations)
|
||||
temporaryAnimation.Value.Update();
|
||||
if (Animation._awaitingRemoval.Count <= 0)
|
||||
return;
|
||||
for (int index = 0; index < Animation._awaitingRemoval.Count; ++index)
|
||||
Animation._temporaryAnimations.Remove(Animation._awaitingRemoval[index]);
|
||||
Animation._awaitingRemoval.Clear();
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
if (this._temporary)
|
||||
{
|
||||
Tile tile = Main.tile[(int) this._coordinates.X, (int) this._coordinates.Y];
|
||||
if (tile != null && (int) tile.type != (int) this._tileType)
|
||||
{
|
||||
Animation.RemoveTemporaryAnimation(this._coordinates.X, this._coordinates.Y);
|
||||
return;
|
||||
}
|
||||
}
|
||||
++this._frameCounter;
|
||||
if (this._frameCounter < this._frameCounterMax)
|
||||
return;
|
||||
this._frameCounter = 0;
|
||||
++this._frame;
|
||||
if (this._frame < this._frameMax)
|
||||
return;
|
||||
this._frame = 0;
|
||||
if (!this._temporary)
|
||||
return;
|
||||
Animation.RemoveTemporaryAnimation(this._coordinates.X, this._coordinates.Y);
|
||||
}
|
||||
|
||||
public static bool GetTemporaryFrame(int x, int y, out int frameData)
|
||||
{
|
||||
Point16 key = new Point16(x, y);
|
||||
Animation animation;
|
||||
if (!Animation._temporaryAnimations.TryGetValue(key, out animation))
|
||||
{
|
||||
frameData = 0;
|
||||
return false;
|
||||
}
|
||||
frameData = animation._frameData[animation._frame];
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
17
AssemblyInfo.cs
Normal file
17
AssemblyInfo.cs
Normal file
|
@ -0,0 +1,17 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Security.Permissions;
|
||||
|
||||
[assembly: Extension]
|
||||
[assembly: AssemblyTitle("Terraria")]
|
||||
[assembly: AssemblyProduct("Terraria")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyCompany("Re-Logic")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2020 Re-Logic")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: ComVisible(false)]
|
||||
[assembly: Guid("f571b16a-2c9b-44ab-b115-7c762c9e4e7e")]
|
||||
[assembly: AssemblyFileVersion("1.4.0.5")]
|
||||
[assembly: AssemblyVersion("1.4.0.5")]
|
||||
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
|
100
Audio/ActiveSound.cs
Normal file
100
Audio/ActiveSound.cs
Normal file
|
@ -0,0 +1,100 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Audio.ActiveSound
|
||||
// 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.Audio;
|
||||
|
||||
namespace Terraria.Audio
|
||||
{
|
||||
public class ActiveSound
|
||||
{
|
||||
public readonly bool IsGlobal;
|
||||
public Vector2 Position;
|
||||
public float Volume;
|
||||
|
||||
public SoundEffectInstance Sound { get; private set; }
|
||||
|
||||
public SoundStyle Style { get; private set; }
|
||||
|
||||
public bool IsPlaying => this.Sound.State == SoundState.Playing;
|
||||
|
||||
public ActiveSound(SoundStyle style, Vector2 position)
|
||||
{
|
||||
this.Position = position;
|
||||
this.Volume = 1f;
|
||||
this.IsGlobal = false;
|
||||
this.Style = style;
|
||||
this.Play();
|
||||
}
|
||||
|
||||
public ActiveSound(SoundStyle style)
|
||||
{
|
||||
this.Position = Vector2.Zero;
|
||||
this.Volume = 1f;
|
||||
this.IsGlobal = true;
|
||||
this.Style = style;
|
||||
this.Play();
|
||||
}
|
||||
|
||||
private void Play()
|
||||
{
|
||||
SoundEffectInstance instance = this.Style.GetRandomSound().CreateInstance();
|
||||
instance.Pitch += this.Style.GetRandomPitch();
|
||||
instance.Play();
|
||||
SoundInstanceGarbageCollector.Track(instance);
|
||||
this.Sound = instance;
|
||||
this.Update();
|
||||
}
|
||||
|
||||
public void Stop()
|
||||
{
|
||||
if (this.Sound == null)
|
||||
return;
|
||||
this.Sound.Stop();
|
||||
}
|
||||
|
||||
public void Pause()
|
||||
{
|
||||
if (this.Sound == null || this.Sound.State != SoundState.Playing)
|
||||
return;
|
||||
this.Sound.Pause();
|
||||
}
|
||||
|
||||
public void Resume()
|
||||
{
|
||||
if (this.Sound == null || this.Sound.State != SoundState.Paused)
|
||||
return;
|
||||
this.Sound.Resume();
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
if (this.Sound == null)
|
||||
return;
|
||||
Vector2 vector2 = Main.screenPosition + new Vector2((float) (Main.screenWidth / 2), (float) (Main.screenHeight / 2));
|
||||
float num1 = 1f;
|
||||
if (!this.IsGlobal)
|
||||
{
|
||||
this.Sound.Pan = MathHelper.Clamp((float) (((double) this.Position.X - (double) vector2.X) / ((double) Main.screenWidth * 0.5)), -1f, 1f);
|
||||
num1 = (float) (1.0 - (double) Vector2.Distance(this.Position, vector2) / ((double) Main.screenWidth * 1.5));
|
||||
}
|
||||
float num2 = num1 * (this.Style.Volume * this.Volume);
|
||||
switch (this.Style.Type)
|
||||
{
|
||||
case SoundType.Sound:
|
||||
num2 *= Main.soundVolume;
|
||||
break;
|
||||
case SoundType.Ambient:
|
||||
num2 *= Main.ambientVolume;
|
||||
break;
|
||||
case SoundType.Music:
|
||||
num2 *= Main.musicVolume;
|
||||
break;
|
||||
}
|
||||
this.Sound.Volume = MathHelper.Clamp(num2, 0.0f, 1f);
|
||||
}
|
||||
}
|
||||
}
|
41
Audio/CustomSoundStyle.cs
Normal file
41
Audio/CustomSoundStyle.cs
Normal file
|
@ -0,0 +1,41 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Audio.CustomSoundStyle
|
||||
// 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.Audio;
|
||||
using Terraria.Utilities;
|
||||
|
||||
namespace Terraria.Audio
|
||||
{
|
||||
public class CustomSoundStyle : SoundStyle
|
||||
{
|
||||
private static readonly UnifiedRandom Random = new UnifiedRandom();
|
||||
private readonly SoundEffect[] _soundEffects;
|
||||
|
||||
public override bool IsTrackable => true;
|
||||
|
||||
public CustomSoundStyle(
|
||||
SoundEffect soundEffect,
|
||||
SoundType type = SoundType.Sound,
|
||||
float volume = 1f,
|
||||
float pitchVariance = 0.0f)
|
||||
: base(volume, pitchVariance, type)
|
||||
{
|
||||
this._soundEffects = new SoundEffect[1]{ soundEffect };
|
||||
}
|
||||
|
||||
public CustomSoundStyle(
|
||||
SoundEffect[] soundEffects,
|
||||
SoundType type = SoundType.Sound,
|
||||
float volume = 1f,
|
||||
float pitchVariance = 0.0f)
|
||||
: base(volume, pitchVariance, type)
|
||||
{
|
||||
this._soundEffects = soundEffects;
|
||||
}
|
||||
|
||||
public override SoundEffect GetRandomSound() => this._soundEffects[CustomSoundStyle.Random.Next(this._soundEffects.Length)];
|
||||
}
|
||||
}
|
996
Audio/LegacySoundPlayer.cs
Normal file
996
Audio/LegacySoundPlayer.cs
Normal file
|
@ -0,0 +1,996 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Audio.LegacySoundPlayer
|
||||
// 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.Audio;
|
||||
using ReLogic.Content;
|
||||
using ReLogic.Utilities;
|
||||
using System;
|
||||
using System.IO;
|
||||
using Terraria.ID;
|
||||
|
||||
namespace Terraria.Audio
|
||||
{
|
||||
public class LegacySoundPlayer
|
||||
{
|
||||
private Asset<SoundEffect>[] _soundDrip = new Asset<SoundEffect>[3];
|
||||
private SoundEffectInstance[] _soundInstanceDrip = new SoundEffectInstance[3];
|
||||
private Asset<SoundEffect>[] _soundLiquid = new Asset<SoundEffect>[2];
|
||||
private SoundEffectInstance[] _soundInstanceLiquid = new SoundEffectInstance[2];
|
||||
private Asset<SoundEffect>[] _soundMech = new Asset<SoundEffect>[1];
|
||||
private SoundEffectInstance[] _soundInstanceMech = new SoundEffectInstance[1];
|
||||
private Asset<SoundEffect>[] _soundDig = new Asset<SoundEffect>[3];
|
||||
private SoundEffectInstance[] _soundInstanceDig = new SoundEffectInstance[3];
|
||||
private Asset<SoundEffect>[] _soundThunder = new Asset<SoundEffect>[7];
|
||||
private SoundEffectInstance[] _soundInstanceThunder = new SoundEffectInstance[7];
|
||||
private Asset<SoundEffect>[] _soundResearch = new Asset<SoundEffect>[4];
|
||||
private SoundEffectInstance[] _soundInstanceResearch = new SoundEffectInstance[4];
|
||||
private Asset<SoundEffect>[] _soundTink = new Asset<SoundEffect>[3];
|
||||
private SoundEffectInstance[] _soundInstanceTink = new SoundEffectInstance[3];
|
||||
private Asset<SoundEffect>[] _soundCoin = new Asset<SoundEffect>[5];
|
||||
private SoundEffectInstance[] _soundInstanceCoin = new SoundEffectInstance[5];
|
||||
private Asset<SoundEffect>[] _soundPlayerHit = new Asset<SoundEffect>[3];
|
||||
private SoundEffectInstance[] _soundInstancePlayerHit = new SoundEffectInstance[3];
|
||||
private Asset<SoundEffect>[] _soundFemaleHit = new Asset<SoundEffect>[3];
|
||||
private SoundEffectInstance[] _soundInstanceFemaleHit = new SoundEffectInstance[3];
|
||||
private Asset<SoundEffect> _soundPlayerKilled;
|
||||
private SoundEffectInstance _soundInstancePlayerKilled;
|
||||
private Asset<SoundEffect> _soundGrass;
|
||||
private SoundEffectInstance _soundInstanceGrass;
|
||||
private Asset<SoundEffect> _soundGrab;
|
||||
private SoundEffectInstance _soundInstanceGrab;
|
||||
private Asset<SoundEffect> _soundPixie;
|
||||
private SoundEffectInstance _soundInstancePixie;
|
||||
private Asset<SoundEffect>[] _soundItem = new Asset<SoundEffect>[(int) SoundID.ItemSoundCount];
|
||||
private SoundEffectInstance[] _soundInstanceItem = new SoundEffectInstance[(int) SoundID.ItemSoundCount];
|
||||
private Asset<SoundEffect>[] _soundNpcHit = new Asset<SoundEffect>[58];
|
||||
private SoundEffectInstance[] _soundInstanceNpcHit = new SoundEffectInstance[58];
|
||||
private Asset<SoundEffect>[] _soundNpcKilled = new Asset<SoundEffect>[(int) SoundID.NPCDeathCount];
|
||||
private SoundEffectInstance[] _soundInstanceNpcKilled = new SoundEffectInstance[(int) SoundID.NPCDeathCount];
|
||||
private SoundEffectInstance _soundInstanceMoonlordCry;
|
||||
private Asset<SoundEffect> _soundDoorOpen;
|
||||
private SoundEffectInstance _soundInstanceDoorOpen;
|
||||
private Asset<SoundEffect> _soundDoorClosed;
|
||||
private SoundEffectInstance _soundInstanceDoorClosed;
|
||||
private Asset<SoundEffect> _soundMenuOpen;
|
||||
private SoundEffectInstance _soundInstanceMenuOpen;
|
||||
private Asset<SoundEffect> _soundMenuClose;
|
||||
private SoundEffectInstance _soundInstanceMenuClose;
|
||||
private Asset<SoundEffect> _soundMenuTick;
|
||||
private SoundEffectInstance _soundInstanceMenuTick;
|
||||
private Asset<SoundEffect> _soundShatter;
|
||||
private SoundEffectInstance _soundInstanceShatter;
|
||||
private Asset<SoundEffect> _soundCamera;
|
||||
private SoundEffectInstance _soundInstanceCamera;
|
||||
private Asset<SoundEffect>[] _soundZombie = new Asset<SoundEffect>[118];
|
||||
private SoundEffectInstance[] _soundInstanceZombie = new SoundEffectInstance[118];
|
||||
private Asset<SoundEffect>[] _soundRoar = new Asset<SoundEffect>[3];
|
||||
private SoundEffectInstance[] _soundInstanceRoar = new SoundEffectInstance[3];
|
||||
private Asset<SoundEffect>[] _soundSplash = new Asset<SoundEffect>[2];
|
||||
private SoundEffectInstance[] _soundInstanceSplash = new SoundEffectInstance[2];
|
||||
private Asset<SoundEffect> _soundDoubleJump;
|
||||
private SoundEffectInstance _soundInstanceDoubleJump;
|
||||
private Asset<SoundEffect> _soundRun;
|
||||
private SoundEffectInstance _soundInstanceRun;
|
||||
private Asset<SoundEffect> _soundCoins;
|
||||
private SoundEffectInstance _soundInstanceCoins;
|
||||
private Asset<SoundEffect> _soundUnlock;
|
||||
private SoundEffectInstance _soundInstanceUnlock;
|
||||
private Asset<SoundEffect> _soundChat;
|
||||
private SoundEffectInstance _soundInstanceChat;
|
||||
private Asset<SoundEffect> _soundMaxMana;
|
||||
private SoundEffectInstance _soundInstanceMaxMana;
|
||||
private Asset<SoundEffect> _soundDrown;
|
||||
private SoundEffectInstance _soundInstanceDrown;
|
||||
private Asset<SoundEffect>[] _trackableSounds;
|
||||
private SoundEffectInstance[] _trackableSoundInstances;
|
||||
private readonly IServiceProvider _services;
|
||||
|
||||
public LegacySoundPlayer(IServiceProvider services)
|
||||
{
|
||||
this._services = services;
|
||||
this.LoadAll();
|
||||
}
|
||||
|
||||
private void LoadAll()
|
||||
{
|
||||
this._soundMech[0] = this.Load("Sounds/Mech_0");
|
||||
this._soundGrab = this.Load("Sounds/Grab");
|
||||
this._soundPixie = this.Load("Sounds/Pixie");
|
||||
this._soundDig[0] = this.Load("Sounds/Dig_0");
|
||||
this._soundDig[1] = this.Load("Sounds/Dig_1");
|
||||
this._soundDig[2] = this.Load("Sounds/Dig_2");
|
||||
this._soundThunder[0] = this.Load("Sounds/Thunder_0");
|
||||
this._soundThunder[1] = this.Load("Sounds/Thunder_1");
|
||||
this._soundThunder[2] = this.Load("Sounds/Thunder_2");
|
||||
this._soundThunder[3] = this.Load("Sounds/Thunder_3");
|
||||
this._soundThunder[4] = this.Load("Sounds/Thunder_4");
|
||||
this._soundThunder[5] = this.Load("Sounds/Thunder_5");
|
||||
this._soundThunder[6] = this.Load("Sounds/Thunder_6");
|
||||
this._soundResearch[0] = this.Load("Sounds/Research_0");
|
||||
this._soundResearch[1] = this.Load("Sounds/Research_1");
|
||||
this._soundResearch[2] = this.Load("Sounds/Research_2");
|
||||
this._soundResearch[3] = this.Load("Sounds/Research_3");
|
||||
this._soundTink[0] = this.Load("Sounds/Tink_0");
|
||||
this._soundTink[1] = this.Load("Sounds/Tink_1");
|
||||
this._soundTink[2] = this.Load("Sounds/Tink_2");
|
||||
this._soundPlayerHit[0] = this.Load("Sounds/Player_Hit_0");
|
||||
this._soundPlayerHit[1] = this.Load("Sounds/Player_Hit_1");
|
||||
this._soundPlayerHit[2] = this.Load("Sounds/Player_Hit_2");
|
||||
this._soundFemaleHit[0] = this.Load("Sounds/Female_Hit_0");
|
||||
this._soundFemaleHit[1] = this.Load("Sounds/Female_Hit_1");
|
||||
this._soundFemaleHit[2] = this.Load("Sounds/Female_Hit_2");
|
||||
this._soundPlayerKilled = this.Load("Sounds/Player_Killed");
|
||||
this._soundChat = this.Load("Sounds/Chat");
|
||||
this._soundGrass = this.Load("Sounds/Grass");
|
||||
this._soundDoorOpen = this.Load("Sounds/Door_Opened");
|
||||
this._soundDoorClosed = this.Load("Sounds/Door_Closed");
|
||||
this._soundMenuTick = this.Load("Sounds/Menu_Tick");
|
||||
this._soundMenuOpen = this.Load("Sounds/Menu_Open");
|
||||
this._soundMenuClose = this.Load("Sounds/Menu_Close");
|
||||
this._soundShatter = this.Load("Sounds/Shatter");
|
||||
this._soundCamera = this.Load("Sounds/Camera");
|
||||
for (int index = 0; index < this._soundCoin.Length; ++index)
|
||||
this._soundCoin[index] = this.Load("Sounds/Coin_" + (object) index);
|
||||
for (int index = 0; index < this._soundDrip.Length; ++index)
|
||||
this._soundDrip[index] = this.Load("Sounds/Drip_" + (object) index);
|
||||
for (int index = 0; index < this._soundZombie.Length; ++index)
|
||||
this._soundZombie[index] = this.Load("Sounds/Zombie_" + (object) index);
|
||||
for (int index = 0; index < this._soundLiquid.Length; ++index)
|
||||
this._soundLiquid[index] = this.Load("Sounds/Liquid_" + (object) index);
|
||||
for (int index = 0; index < this._soundRoar.Length; ++index)
|
||||
this._soundRoar[index] = this.Load("Sounds/Roar_" + (object) index);
|
||||
this._soundSplash[0] = this.Load("Sounds/Splash_0");
|
||||
this._soundSplash[1] = this.Load("Sounds/Splash_1");
|
||||
this._soundDoubleJump = this.Load("Sounds/Double_Jump");
|
||||
this._soundRun = this.Load("Sounds/Run");
|
||||
this._soundCoins = this.Load("Sounds/Coins");
|
||||
this._soundUnlock = this.Load("Sounds/Unlock");
|
||||
this._soundMaxMana = this.Load("Sounds/MaxMana");
|
||||
this._soundDrown = this.Load("Sounds/Drown");
|
||||
for (int index = 1; index < this._soundItem.Length; ++index)
|
||||
this._soundItem[index] = this.Load("Sounds/Item_" + (object) index);
|
||||
for (int index = 1; index < this._soundNpcHit.Length; ++index)
|
||||
this._soundNpcHit[index] = this.Load("Sounds/NPC_Hit_" + (object) index);
|
||||
for (int index = 1; index < this._soundNpcKilled.Length; ++index)
|
||||
this._soundNpcKilled[index] = this.Load("Sounds/NPC_Killed_" + (object) index);
|
||||
this._trackableSounds = new Asset<SoundEffect>[SoundID.TrackableLegacySoundCount];
|
||||
this._trackableSoundInstances = new SoundEffectInstance[this._trackableSounds.Length];
|
||||
for (int id = 0; id < this._trackableSounds.Length; ++id)
|
||||
this._trackableSounds[id] = this.Load("Sounds/Custom" + Path.DirectorySeparatorChar.ToString() + SoundID.GetTrackableLegacySoundPath(id));
|
||||
}
|
||||
|
||||
public void CreateAllSoundInstances()
|
||||
{
|
||||
this._soundInstanceMech[0] = this._soundMech[0].Value.CreateInstance();
|
||||
this._soundInstanceGrab = this._soundGrab.Value.CreateInstance();
|
||||
this._soundInstancePixie = this._soundGrab.Value.CreateInstance();
|
||||
this._soundInstanceDig[0] = this._soundDig[0].Value.CreateInstance();
|
||||
this._soundInstanceDig[1] = this._soundDig[1].Value.CreateInstance();
|
||||
this._soundInstanceDig[2] = this._soundDig[2].Value.CreateInstance();
|
||||
this._soundInstanceTink[0] = this._soundTink[0].Value.CreateInstance();
|
||||
this._soundInstanceTink[1] = this._soundTink[1].Value.CreateInstance();
|
||||
this._soundInstanceTink[2] = this._soundTink[2].Value.CreateInstance();
|
||||
this._soundInstancePlayerHit[0] = this._soundPlayerHit[0].Value.CreateInstance();
|
||||
this._soundInstancePlayerHit[1] = this._soundPlayerHit[1].Value.CreateInstance();
|
||||
this._soundInstancePlayerHit[2] = this._soundPlayerHit[2].Value.CreateInstance();
|
||||
this._soundInstanceFemaleHit[0] = this._soundFemaleHit[0].Value.CreateInstance();
|
||||
this._soundInstanceFemaleHit[1] = this._soundFemaleHit[1].Value.CreateInstance();
|
||||
this._soundInstanceFemaleHit[2] = this._soundFemaleHit[2].Value.CreateInstance();
|
||||
this._soundInstancePlayerKilled = this._soundPlayerKilled.Value.CreateInstance();
|
||||
this._soundInstanceChat = this._soundChat.Value.CreateInstance();
|
||||
this._soundInstanceGrass = this._soundGrass.Value.CreateInstance();
|
||||
this._soundInstanceDoorOpen = this._soundDoorOpen.Value.CreateInstance();
|
||||
this._soundInstanceDoorClosed = this._soundDoorClosed.Value.CreateInstance();
|
||||
this._soundInstanceMenuTick = this._soundMenuTick.Value.CreateInstance();
|
||||
this._soundInstanceMenuOpen = this._soundMenuOpen.Value.CreateInstance();
|
||||
this._soundInstanceMenuClose = this._soundMenuClose.Value.CreateInstance();
|
||||
this._soundInstanceShatter = this._soundShatter.Value.CreateInstance();
|
||||
this._soundInstanceCamera = this._soundCamera.Value.CreateInstance();
|
||||
for (int index = 0; index < this._soundThunder.Length; ++index)
|
||||
this._soundInstanceThunder[index] = this._soundThunder[index].Value.CreateInstance();
|
||||
for (int index = 0; index < this._soundResearch.Length; ++index)
|
||||
this._soundInstanceResearch[index] = this._soundResearch[index].Value.CreateInstance();
|
||||
for (int index = 0; index < this._soundCoin.Length; ++index)
|
||||
this._soundInstanceCoin[index] = this._soundCoin[index].Value.CreateInstance();
|
||||
for (int index = 0; index < this._soundDrip.Length; ++index)
|
||||
this._soundInstanceDrip[index] = this._soundDrip[index].Value.CreateInstance();
|
||||
for (int index = 0; index < this._soundZombie.Length; ++index)
|
||||
this._soundInstanceZombie[index] = this._soundZombie[index].Value.CreateInstance();
|
||||
for (int index = 0; index < this._soundLiquid.Length; ++index)
|
||||
this._soundInstanceLiquid[index] = this._soundLiquid[index].Value.CreateInstance();
|
||||
for (int index = 0; index < this._soundRoar.Length; ++index)
|
||||
this._soundInstanceRoar[index] = this._soundRoar[index].Value.CreateInstance();
|
||||
this._soundInstanceSplash[0] = this._soundRoar[0].Value.CreateInstance();
|
||||
this._soundInstanceSplash[1] = this._soundSplash[1].Value.CreateInstance();
|
||||
this._soundInstanceDoubleJump = this._soundRoar[0].Value.CreateInstance();
|
||||
this._soundInstanceRun = this._soundRun.Value.CreateInstance();
|
||||
this._soundInstanceCoins = this._soundCoins.Value.CreateInstance();
|
||||
this._soundInstanceUnlock = this._soundUnlock.Value.CreateInstance();
|
||||
this._soundInstanceMaxMana = this._soundMaxMana.Value.CreateInstance();
|
||||
this._soundInstanceDrown = this._soundDrown.Value.CreateInstance();
|
||||
for (int index = 1; index < this._soundItem.Length; ++index)
|
||||
this._soundInstanceItem[index] = this._soundItem[index].Value.CreateInstance();
|
||||
for (int index = 1; index < this._soundNpcHit.Length; ++index)
|
||||
this._soundInstanceNpcHit[index] = this._soundNpcHit[index].Value.CreateInstance();
|
||||
for (int index = 1; index < this._soundNpcKilled.Length; ++index)
|
||||
this._soundInstanceNpcKilled[index] = this._soundNpcKilled[index].Value.CreateInstance();
|
||||
for (int index = 0; index < this._trackableSounds.Length; ++index)
|
||||
this._trackableSoundInstances[index] = this._trackableSounds[index].Value.CreateInstance();
|
||||
this._soundInstanceMoonlordCry = this._soundNpcKilled[10].Value.CreateInstance();
|
||||
}
|
||||
|
||||
private Asset<SoundEffect> Load(string assetName) => XnaExtensions.Get<IAssetRepository>(this._services).Request<SoundEffect>(assetName, (AssetRequestMode) 2);
|
||||
|
||||
public SoundEffectInstance PlaySound(
|
||||
int type,
|
||||
int x = -1,
|
||||
int y = -1,
|
||||
int Style = 1,
|
||||
float volumeScale = 1f,
|
||||
float pitchOffset = 0.0f)
|
||||
{
|
||||
int index1 = Style;
|
||||
try
|
||||
{
|
||||
if (Main.dedServ || (double) Main.soundVolume == 0.0 && (type < 30 || type > 35))
|
||||
return (SoundEffectInstance) null;
|
||||
bool flag = false;
|
||||
float num1 = 1f;
|
||||
float num2 = 0.0f;
|
||||
if (x == -1 || y == -1)
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (WorldGen.gen || Main.netMode == 2)
|
||||
return (SoundEffectInstance) null;
|
||||
Vector2 vector2 = new Vector2(Main.screenPosition.X + (float) Main.screenWidth * 0.5f, Main.screenPosition.Y + (float) Main.screenHeight * 0.5f);
|
||||
double num3 = (double) Math.Abs((float) x - vector2.X);
|
||||
float num4 = Math.Abs((float) y - vector2.Y);
|
||||
float num5 = (float) Math.Sqrt(num3 * num3 + (double) num4 * (double) num4);
|
||||
int num6 = 2500;
|
||||
if ((double) num5 < (double) num6)
|
||||
{
|
||||
flag = true;
|
||||
num2 = type != 43 ? (float) (((double) x - (double) vector2.X) / ((double) Main.screenWidth * 0.5)) : (float) (((double) x - (double) vector2.X) / 900.0);
|
||||
num1 = (float) (1.0 - (double) num5 / (double) num6);
|
||||
}
|
||||
}
|
||||
if ((double) num2 < -1.0)
|
||||
num2 = -1f;
|
||||
if ((double) num2 > 1.0)
|
||||
num2 = 1f;
|
||||
if ((double) num1 > 1.0)
|
||||
num1 = 1f;
|
||||
if ((double) num1 <= 0.0 && (type < 34 || type > 35 || type > 39))
|
||||
return (SoundEffectInstance) null;
|
||||
if (flag)
|
||||
{
|
||||
float num7;
|
||||
if (type >= 30 && type <= 35 || type == 39)
|
||||
{
|
||||
num7 = num1 * (Main.ambientVolume * (Main.gameInactive ? 0.0f : 1f));
|
||||
if (Main.gameMenu)
|
||||
num7 = 0.0f;
|
||||
}
|
||||
else
|
||||
num7 = num1 * Main.soundVolume;
|
||||
if ((double) num7 > 1.0)
|
||||
num7 = 1f;
|
||||
if ((double) num7 <= 0.0 && (type < 30 || type > 35) && type != 39)
|
||||
return (SoundEffectInstance) null;
|
||||
SoundEffectInstance sound = (SoundEffectInstance) null;
|
||||
if (type == 0)
|
||||
{
|
||||
int index2 = Main.rand.Next(3);
|
||||
if (this._soundInstanceDig[index2] != null)
|
||||
this._soundInstanceDig[index2].Stop();
|
||||
this._soundInstanceDig[index2] = this._soundDig[index2].Value.CreateInstance();
|
||||
this._soundInstanceDig[index2].Volume = num7;
|
||||
this._soundInstanceDig[index2].Pan = num2;
|
||||
this._soundInstanceDig[index2].Pitch = (float) Main.rand.Next(-10, 11) * 0.01f;
|
||||
sound = this._soundInstanceDig[index2];
|
||||
}
|
||||
else if (type == 43)
|
||||
{
|
||||
int index3 = Main.rand.Next(this._soundThunder.Length);
|
||||
for (int index4 = 0; index4 < this._soundThunder.Length && this._soundInstanceThunder[index3] != null && this._soundInstanceThunder[index3].State == SoundState.Playing; ++index4)
|
||||
index3 = Main.rand.Next(this._soundThunder.Length);
|
||||
if (this._soundInstanceThunder[index3] != null)
|
||||
this._soundInstanceThunder[index3].Stop();
|
||||
this._soundInstanceThunder[index3] = this._soundThunder[index3].Value.CreateInstance();
|
||||
this._soundInstanceThunder[index3].Volume = num7;
|
||||
this._soundInstanceThunder[index3].Pan = num2;
|
||||
this._soundInstanceThunder[index3].Pitch = (float) Main.rand.Next(-10, 11) * 0.01f;
|
||||
sound = this._soundInstanceThunder[index3];
|
||||
}
|
||||
else if (type == 63)
|
||||
{
|
||||
int index5 = Main.rand.Next(1, 4);
|
||||
if (this._soundInstanceResearch[index5] != null)
|
||||
this._soundInstanceResearch[index5].Stop();
|
||||
this._soundInstanceResearch[index5] = this._soundResearch[index5].Value.CreateInstance();
|
||||
this._soundInstanceResearch[index5].Volume = num7;
|
||||
this._soundInstanceResearch[index5].Pan = num2;
|
||||
sound = this._soundInstanceResearch[index5];
|
||||
}
|
||||
else if (type == 64)
|
||||
{
|
||||
if (this._soundInstanceResearch[0] != null)
|
||||
this._soundInstanceResearch[0].Stop();
|
||||
this._soundInstanceResearch[0] = this._soundResearch[0].Value.CreateInstance();
|
||||
this._soundInstanceResearch[0].Volume = num7;
|
||||
this._soundInstanceResearch[0].Pan = num2;
|
||||
sound = this._soundInstanceResearch[0];
|
||||
}
|
||||
else if (type == 1)
|
||||
{
|
||||
int index6 = Main.rand.Next(3);
|
||||
if (this._soundInstancePlayerHit[index6] != null)
|
||||
this._soundInstancePlayerHit[index6].Stop();
|
||||
this._soundInstancePlayerHit[index6] = this._soundPlayerHit[index6].Value.CreateInstance();
|
||||
this._soundInstancePlayerHit[index6].Volume = num7;
|
||||
this._soundInstancePlayerHit[index6].Pan = num2;
|
||||
sound = this._soundInstancePlayerHit[index6];
|
||||
}
|
||||
else if (type == 2)
|
||||
{
|
||||
if (index1 == 129)
|
||||
num7 *= 0.6f;
|
||||
if (index1 == 123)
|
||||
num7 *= 0.5f;
|
||||
if (index1 == 124 || index1 == 125)
|
||||
num7 *= 0.65f;
|
||||
if (index1 == 116)
|
||||
num7 *= 0.5f;
|
||||
if (index1 == 1)
|
||||
{
|
||||
int num8 = Main.rand.Next(3);
|
||||
if (num8 == 1)
|
||||
index1 = 18;
|
||||
if (num8 == 2)
|
||||
index1 = 19;
|
||||
}
|
||||
else if (index1 == 55 || index1 == 53)
|
||||
{
|
||||
num7 *= 0.75f;
|
||||
if (index1 == 55)
|
||||
num7 *= 0.75f;
|
||||
if (this._soundInstanceItem[index1] != null && this._soundInstanceItem[index1].State == SoundState.Playing)
|
||||
return (SoundEffectInstance) null;
|
||||
}
|
||||
else if (index1 == 37)
|
||||
num7 *= 0.5f;
|
||||
else if (index1 == 52)
|
||||
num7 *= 0.35f;
|
||||
else if (index1 == 157)
|
||||
num7 *= 0.7f;
|
||||
else if (index1 == 158)
|
||||
num7 *= 0.8f;
|
||||
if (index1 == 159)
|
||||
{
|
||||
if (this._soundInstanceItem[index1] != null && this._soundInstanceItem[index1].State == SoundState.Playing)
|
||||
return (SoundEffectInstance) null;
|
||||
num7 *= 0.75f;
|
||||
}
|
||||
else if (index1 != 9 && index1 != 10 && index1 != 24 && index1 != 26 && index1 != 34 && index1 != 43 && index1 != 103 && index1 != 156 && index1 != 162 && this._soundInstanceItem[index1] != null)
|
||||
this._soundInstanceItem[index1].Stop();
|
||||
this._soundInstanceItem[index1] = this._soundItem[index1].Value.CreateInstance();
|
||||
this._soundInstanceItem[index1].Volume = num7;
|
||||
this._soundInstanceItem[index1].Pan = num2;
|
||||
switch (index1)
|
||||
{
|
||||
case 53:
|
||||
this._soundInstanceItem[index1].Pitch = (float) Main.rand.Next(-20, -11) * 0.02f;
|
||||
break;
|
||||
case 55:
|
||||
this._soundInstanceItem[index1].Pitch = (float) -Main.rand.Next(-20, -11) * 0.02f;
|
||||
break;
|
||||
case 132:
|
||||
this._soundInstanceItem[index1].Pitch = (float) Main.rand.Next(-20, 21) * (1f / 1000f);
|
||||
break;
|
||||
case 153:
|
||||
this._soundInstanceItem[index1].Pitch = (float) Main.rand.Next(-50, 51) * (3f / 1000f);
|
||||
break;
|
||||
case 156:
|
||||
this._soundInstanceItem[index1].Pitch = (float) Main.rand.Next(-50, 51) * (1f / 500f);
|
||||
this._soundInstanceItem[index1].Volume *= 0.6f;
|
||||
break;
|
||||
default:
|
||||
this._soundInstanceItem[index1].Pitch = (float) Main.rand.Next(-6, 7) * 0.01f;
|
||||
break;
|
||||
}
|
||||
if (index1 == 26 || index1 == 35 || index1 == 47)
|
||||
{
|
||||
this._soundInstanceItem[index1].Volume = num7 * 0.75f;
|
||||
this._soundInstanceItem[index1].Pitch = Main.musicPitch;
|
||||
}
|
||||
if (index1 == 169)
|
||||
this._soundInstanceItem[index1].Pitch -= 0.8f;
|
||||
sound = this._soundInstanceItem[index1];
|
||||
}
|
||||
else if (type == 3)
|
||||
{
|
||||
if (index1 >= 20 && index1 <= 54)
|
||||
num7 *= 0.5f;
|
||||
if (index1 == 57 && this._soundInstanceNpcHit[index1] != null && this._soundInstanceNpcHit[index1].State == SoundState.Playing)
|
||||
return (SoundEffectInstance) null;
|
||||
if (index1 == 57)
|
||||
num7 *= 0.6f;
|
||||
if (index1 == 55 || index1 == 56)
|
||||
num7 *= 0.5f;
|
||||
if (this._soundInstanceNpcHit[index1] != null)
|
||||
this._soundInstanceNpcHit[index1].Stop();
|
||||
this._soundInstanceNpcHit[index1] = this._soundNpcHit[index1].Value.CreateInstance();
|
||||
this._soundInstanceNpcHit[index1].Volume = num7;
|
||||
this._soundInstanceNpcHit[index1].Pan = num2;
|
||||
this._soundInstanceNpcHit[index1].Pitch = (float) Main.rand.Next(-10, 11) * 0.01f;
|
||||
sound = this._soundInstanceNpcHit[index1];
|
||||
}
|
||||
else if (type == 4)
|
||||
{
|
||||
if (index1 >= 23 && index1 <= 57)
|
||||
num7 *= 0.5f;
|
||||
if (index1 == 61)
|
||||
num7 *= 0.6f;
|
||||
if (index1 == 62)
|
||||
num7 *= 0.6f;
|
||||
if (index1 == 10 && this._soundInstanceNpcKilled[index1] != null && this._soundInstanceNpcKilled[index1].State == SoundState.Playing)
|
||||
return (SoundEffectInstance) null;
|
||||
this._soundInstanceNpcKilled[index1] = this._soundNpcKilled[index1].Value.CreateInstance();
|
||||
this._soundInstanceNpcKilled[index1].Volume = num7;
|
||||
this._soundInstanceNpcKilled[index1].Pan = num2;
|
||||
this._soundInstanceNpcKilled[index1].Pitch = (float) Main.rand.Next(-10, 11) * 0.01f;
|
||||
sound = this._soundInstanceNpcKilled[index1];
|
||||
}
|
||||
else if (type == 5)
|
||||
{
|
||||
if (this._soundInstancePlayerKilled != null)
|
||||
this._soundInstancePlayerKilled.Stop();
|
||||
this._soundInstancePlayerKilled = this._soundPlayerKilled.Value.CreateInstance();
|
||||
this._soundInstancePlayerKilled.Volume = num7;
|
||||
this._soundInstancePlayerKilled.Pan = num2;
|
||||
sound = this._soundInstancePlayerKilled;
|
||||
}
|
||||
else if (type == 6)
|
||||
{
|
||||
if (this._soundInstanceGrass != null)
|
||||
this._soundInstanceGrass.Stop();
|
||||
this._soundInstanceGrass = this._soundGrass.Value.CreateInstance();
|
||||
this._soundInstanceGrass.Volume = num7;
|
||||
this._soundInstanceGrass.Pan = num2;
|
||||
this._soundInstanceGrass.Pitch = (float) Main.rand.Next(-30, 31) * 0.01f;
|
||||
sound = this._soundInstanceGrass;
|
||||
}
|
||||
else if (type == 7)
|
||||
{
|
||||
if (this._soundInstanceGrab != null)
|
||||
this._soundInstanceGrab.Stop();
|
||||
this._soundInstanceGrab = this._soundGrab.Value.CreateInstance();
|
||||
this._soundInstanceGrab.Volume = num7;
|
||||
this._soundInstanceGrab.Pan = num2;
|
||||
this._soundInstanceGrab.Pitch = (float) Main.rand.Next(-10, 11) * 0.01f;
|
||||
sound = this._soundInstanceGrab;
|
||||
}
|
||||
else if (type == 8)
|
||||
{
|
||||
if (this._soundInstanceDoorOpen != null)
|
||||
this._soundInstanceDoorOpen.Stop();
|
||||
this._soundInstanceDoorOpen = this._soundDoorOpen.Value.CreateInstance();
|
||||
this._soundInstanceDoorOpen.Volume = num7;
|
||||
this._soundInstanceDoorOpen.Pan = num2;
|
||||
this._soundInstanceDoorOpen.Pitch = (float) Main.rand.Next(-20, 21) * 0.01f;
|
||||
sound = this._soundInstanceDoorOpen;
|
||||
}
|
||||
else if (type == 9)
|
||||
{
|
||||
if (this._soundInstanceDoorClosed != null)
|
||||
this._soundInstanceDoorClosed.Stop();
|
||||
this._soundInstanceDoorClosed = this._soundDoorClosed.Value.CreateInstance();
|
||||
this._soundInstanceDoorClosed.Volume = num7;
|
||||
this._soundInstanceDoorClosed.Pan = num2;
|
||||
this._soundInstanceDoorClosed.Pitch = (float) Main.rand.Next(-20, 21) * 0.01f;
|
||||
sound = this._soundInstanceDoorClosed;
|
||||
}
|
||||
else if (type == 10)
|
||||
{
|
||||
if (this._soundInstanceMenuOpen != null)
|
||||
this._soundInstanceMenuOpen.Stop();
|
||||
this._soundInstanceMenuOpen = this._soundMenuOpen.Value.CreateInstance();
|
||||
this._soundInstanceMenuOpen.Volume = num7;
|
||||
this._soundInstanceMenuOpen.Pan = num2;
|
||||
sound = this._soundInstanceMenuOpen;
|
||||
}
|
||||
else if (type == 11)
|
||||
{
|
||||
if (this._soundInstanceMenuClose != null)
|
||||
this._soundInstanceMenuClose.Stop();
|
||||
this._soundInstanceMenuClose = this._soundMenuClose.Value.CreateInstance();
|
||||
this._soundInstanceMenuClose.Volume = num7;
|
||||
this._soundInstanceMenuClose.Pan = num2;
|
||||
sound = this._soundInstanceMenuClose;
|
||||
}
|
||||
else if (type == 12)
|
||||
{
|
||||
if (Main.hasFocus)
|
||||
{
|
||||
if (this._soundInstanceMenuTick != null)
|
||||
this._soundInstanceMenuTick.Stop();
|
||||
this._soundInstanceMenuTick = this._soundMenuTick.Value.CreateInstance();
|
||||
this._soundInstanceMenuTick.Volume = num7;
|
||||
this._soundInstanceMenuTick.Pan = num2;
|
||||
sound = this._soundInstanceMenuTick;
|
||||
}
|
||||
}
|
||||
else if (type == 13)
|
||||
{
|
||||
if (this._soundInstanceShatter != null)
|
||||
this._soundInstanceShatter.Stop();
|
||||
this._soundInstanceShatter = this._soundShatter.Value.CreateInstance();
|
||||
this._soundInstanceShatter.Volume = num7;
|
||||
this._soundInstanceShatter.Pan = num2;
|
||||
sound = this._soundInstanceShatter;
|
||||
}
|
||||
else if (type == 14)
|
||||
{
|
||||
switch (Style)
|
||||
{
|
||||
case 489:
|
||||
case 586:
|
||||
int index7 = Main.rand.Next(21, 24);
|
||||
this._soundInstanceZombie[index7] = this._soundZombie[index7].Value.CreateInstance();
|
||||
this._soundInstanceZombie[index7].Volume = num7 * 0.4f;
|
||||
this._soundInstanceZombie[index7].Pan = num2;
|
||||
sound = this._soundInstanceZombie[index7];
|
||||
break;
|
||||
case 542:
|
||||
int index8 = 7;
|
||||
this._soundInstanceZombie[index8] = this._soundZombie[index8].Value.CreateInstance();
|
||||
this._soundInstanceZombie[index8].Volume = num7 * 0.4f;
|
||||
this._soundInstanceZombie[index8].Pan = num2;
|
||||
sound = this._soundInstanceZombie[index8];
|
||||
break;
|
||||
default:
|
||||
int index9 = Main.rand.Next(3);
|
||||
this._soundInstanceZombie[index9] = this._soundZombie[index9].Value.CreateInstance();
|
||||
this._soundInstanceZombie[index9].Volume = num7 * 0.4f;
|
||||
this._soundInstanceZombie[index9].Pan = num2;
|
||||
sound = this._soundInstanceZombie[index9];
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (type == 15)
|
||||
{
|
||||
float num9 = 1f;
|
||||
if (index1 == 4)
|
||||
{
|
||||
index1 = 1;
|
||||
num9 = 0.25f;
|
||||
}
|
||||
if (this._soundInstanceRoar[index1] == null || this._soundInstanceRoar[index1].State == SoundState.Stopped)
|
||||
{
|
||||
this._soundInstanceRoar[index1] = this._soundRoar[index1].Value.CreateInstance();
|
||||
this._soundInstanceRoar[index1].Volume = num7 * num9;
|
||||
this._soundInstanceRoar[index1].Pan = num2;
|
||||
sound = this._soundInstanceRoar[index1];
|
||||
}
|
||||
}
|
||||
else if (type == 16)
|
||||
{
|
||||
if (this._soundInstanceDoubleJump != null)
|
||||
this._soundInstanceDoubleJump.Stop();
|
||||
this._soundInstanceDoubleJump = this._soundDoubleJump.Value.CreateInstance();
|
||||
this._soundInstanceDoubleJump.Volume = num7;
|
||||
this._soundInstanceDoubleJump.Pan = num2;
|
||||
this._soundInstanceDoubleJump.Pitch = (float) Main.rand.Next(-10, 11) * 0.01f;
|
||||
sound = this._soundInstanceDoubleJump;
|
||||
}
|
||||
else if (type == 17)
|
||||
{
|
||||
if (this._soundInstanceRun != null)
|
||||
this._soundInstanceRun.Stop();
|
||||
this._soundInstanceRun = this._soundRun.Value.CreateInstance();
|
||||
this._soundInstanceRun.Volume = num7;
|
||||
this._soundInstanceRun.Pan = num2;
|
||||
this._soundInstanceRun.Pitch = (float) Main.rand.Next(-10, 11) * 0.01f;
|
||||
sound = this._soundInstanceRun;
|
||||
}
|
||||
else if (type == 18)
|
||||
{
|
||||
this._soundInstanceCoins = this._soundCoins.Value.CreateInstance();
|
||||
this._soundInstanceCoins.Volume = num7;
|
||||
this._soundInstanceCoins.Pan = num2;
|
||||
sound = this._soundInstanceCoins;
|
||||
}
|
||||
else if (type == 19)
|
||||
{
|
||||
if (this._soundInstanceSplash[index1] == null || this._soundInstanceSplash[index1].State == SoundState.Stopped)
|
||||
{
|
||||
this._soundInstanceSplash[index1] = this._soundSplash[index1].Value.CreateInstance();
|
||||
this._soundInstanceSplash[index1].Volume = num7;
|
||||
this._soundInstanceSplash[index1].Pan = num2;
|
||||
this._soundInstanceSplash[index1].Pitch = (float) Main.rand.Next(-10, 11) * 0.01f;
|
||||
sound = this._soundInstanceSplash[index1];
|
||||
}
|
||||
}
|
||||
else if (type == 20)
|
||||
{
|
||||
int index10 = Main.rand.Next(3);
|
||||
if (this._soundInstanceFemaleHit[index10] != null)
|
||||
this._soundInstanceFemaleHit[index10].Stop();
|
||||
this._soundInstanceFemaleHit[index10] = this._soundFemaleHit[index10].Value.CreateInstance();
|
||||
this._soundInstanceFemaleHit[index10].Volume = num7;
|
||||
this._soundInstanceFemaleHit[index10].Pan = num2;
|
||||
sound = this._soundInstanceFemaleHit[index10];
|
||||
}
|
||||
else if (type == 21)
|
||||
{
|
||||
int index11 = Main.rand.Next(3);
|
||||
if (this._soundInstanceTink[index11] != null)
|
||||
this._soundInstanceTink[index11].Stop();
|
||||
this._soundInstanceTink[index11] = this._soundTink[index11].Value.CreateInstance();
|
||||
this._soundInstanceTink[index11].Volume = num7;
|
||||
this._soundInstanceTink[index11].Pan = num2;
|
||||
sound = this._soundInstanceTink[index11];
|
||||
}
|
||||
else if (type == 22)
|
||||
{
|
||||
if (this._soundInstanceUnlock != null)
|
||||
this._soundInstanceUnlock.Stop();
|
||||
this._soundInstanceUnlock = this._soundUnlock.Value.CreateInstance();
|
||||
this._soundInstanceUnlock.Volume = num7;
|
||||
this._soundInstanceUnlock.Pan = num2;
|
||||
sound = this._soundInstanceUnlock;
|
||||
}
|
||||
else if (type == 23)
|
||||
{
|
||||
if (this._soundInstanceDrown != null)
|
||||
this._soundInstanceDrown.Stop();
|
||||
this._soundInstanceDrown = this._soundDrown.Value.CreateInstance();
|
||||
this._soundInstanceDrown.Volume = num7;
|
||||
this._soundInstanceDrown.Pan = num2;
|
||||
sound = this._soundInstanceDrown;
|
||||
}
|
||||
else if (type == 24)
|
||||
{
|
||||
this._soundInstanceChat = this._soundChat.Value.CreateInstance();
|
||||
this._soundInstanceChat.Volume = num7;
|
||||
this._soundInstanceChat.Pan = num2;
|
||||
sound = this._soundInstanceChat;
|
||||
}
|
||||
else if (type == 25)
|
||||
{
|
||||
this._soundInstanceMaxMana = this._soundMaxMana.Value.CreateInstance();
|
||||
this._soundInstanceMaxMana.Volume = num7;
|
||||
this._soundInstanceMaxMana.Pan = num2;
|
||||
sound = this._soundInstanceMaxMana;
|
||||
}
|
||||
else if (type == 26)
|
||||
{
|
||||
int index12 = Main.rand.Next(3, 5);
|
||||
this._soundInstanceZombie[index12] = this._soundZombie[index12].Value.CreateInstance();
|
||||
this._soundInstanceZombie[index12].Volume = num7 * 0.9f;
|
||||
this._soundInstanceZombie[index12].Pan = num2;
|
||||
this._soundInstanceZombie[index12].Pitch = (float) Main.rand.Next(-10, 11) * 0.01f;
|
||||
sound = this._soundInstanceZombie[index12];
|
||||
}
|
||||
else if (type == 27)
|
||||
{
|
||||
if (this._soundInstancePixie != null && this._soundInstancePixie.State == SoundState.Playing)
|
||||
{
|
||||
this._soundInstancePixie.Volume = num7;
|
||||
this._soundInstancePixie.Pan = num2;
|
||||
this._soundInstancePixie.Pitch = (float) Main.rand.Next(-10, 11) * 0.01f;
|
||||
return (SoundEffectInstance) null;
|
||||
}
|
||||
if (this._soundInstancePixie != null)
|
||||
this._soundInstancePixie.Stop();
|
||||
this._soundInstancePixie = this._soundPixie.Value.CreateInstance();
|
||||
this._soundInstancePixie.Volume = num7;
|
||||
this._soundInstancePixie.Pan = num2;
|
||||
this._soundInstancePixie.Pitch = (float) Main.rand.Next(-10, 11) * 0.01f;
|
||||
sound = this._soundInstancePixie;
|
||||
}
|
||||
else if (type == 28)
|
||||
{
|
||||
if (this._soundInstanceMech[index1] != null && this._soundInstanceMech[index1].State == SoundState.Playing)
|
||||
return (SoundEffectInstance) null;
|
||||
this._soundInstanceMech[index1] = this._soundMech[index1].Value.CreateInstance();
|
||||
this._soundInstanceMech[index1].Volume = num7;
|
||||
this._soundInstanceMech[index1].Pan = num2;
|
||||
this._soundInstanceMech[index1].Pitch = (float) Main.rand.Next(-10, 11) * 0.01f;
|
||||
sound = this._soundInstanceMech[index1];
|
||||
}
|
||||
else if (type == 29)
|
||||
{
|
||||
if (index1 >= 24 && index1 <= 87)
|
||||
num7 *= 0.5f;
|
||||
if (index1 >= 88 && index1 <= 91)
|
||||
num7 *= 0.7f;
|
||||
if (index1 >= 93 && index1 <= 99)
|
||||
num7 *= 0.4f;
|
||||
if (index1 == 92)
|
||||
num7 *= 0.5f;
|
||||
if (index1 == 103)
|
||||
num7 *= 0.4f;
|
||||
if (index1 == 104)
|
||||
num7 *= 0.55f;
|
||||
if (index1 == 100 || index1 == 101)
|
||||
num7 *= 0.25f;
|
||||
if (index1 == 102)
|
||||
num7 *= 0.4f;
|
||||
if (this._soundInstanceZombie[index1] != null && this._soundInstanceZombie[index1].State == SoundState.Playing)
|
||||
return (SoundEffectInstance) null;
|
||||
this._soundInstanceZombie[index1] = this._soundZombie[index1].Value.CreateInstance();
|
||||
this._soundInstanceZombie[index1].Volume = num7;
|
||||
this._soundInstanceZombie[index1].Pan = num2;
|
||||
this._soundInstanceZombie[index1].Pitch = (float) Main.rand.Next(-10, 11) * 0.01f;
|
||||
sound = this._soundInstanceZombie[index1];
|
||||
}
|
||||
else if (type == 44)
|
||||
{
|
||||
int index13 = Main.rand.Next(106, 109);
|
||||
this._soundInstanceZombie[index13] = this._soundZombie[index13].Value.CreateInstance();
|
||||
this._soundInstanceZombie[index13].Volume = num7 * 0.2f;
|
||||
this._soundInstanceZombie[index13].Pan = num2;
|
||||
this._soundInstanceZombie[index13].Pitch = (float) Main.rand.Next(-70, 1) * 0.01f;
|
||||
sound = this._soundInstanceZombie[index13];
|
||||
}
|
||||
else if (type == 45)
|
||||
{
|
||||
int index14 = 109;
|
||||
if (this._soundInstanceZombie[index14] != null && this._soundInstanceZombie[index14].State == SoundState.Playing)
|
||||
return (SoundEffectInstance) null;
|
||||
this._soundInstanceZombie[index14] = this._soundZombie[index14].Value.CreateInstance();
|
||||
this._soundInstanceZombie[index14].Volume = num7 * 0.3f;
|
||||
this._soundInstanceZombie[index14].Pan = num2;
|
||||
this._soundInstanceZombie[index14].Pitch = (float) Main.rand.Next(-10, 11) * 0.01f;
|
||||
sound = this._soundInstanceZombie[index14];
|
||||
}
|
||||
else if (type == 46)
|
||||
{
|
||||
if (this._soundInstanceZombie[110] != null && this._soundInstanceZombie[110].State == SoundState.Playing || this._soundInstanceZombie[111] != null && this._soundInstanceZombie[111].State == SoundState.Playing)
|
||||
return (SoundEffectInstance) null;
|
||||
int index15 = Main.rand.Next(110, 112);
|
||||
if (Main.rand.Next(300) == 0)
|
||||
index15 = Main.rand.Next(3) != 0 ? (Main.rand.Next(2) != 0 ? 112 : 113) : 114;
|
||||
this._soundInstanceZombie[index15] = this._soundZombie[index15].Value.CreateInstance();
|
||||
this._soundInstanceZombie[index15].Volume = num7 * 0.9f;
|
||||
this._soundInstanceZombie[index15].Pan = num2;
|
||||
this._soundInstanceZombie[index15].Pitch = (float) Main.rand.Next(-10, 11) * 0.01f;
|
||||
sound = this._soundInstanceZombie[index15];
|
||||
}
|
||||
else if (type == 45)
|
||||
{
|
||||
int index16 = 109;
|
||||
this._soundInstanceZombie[index16] = this._soundZombie[index16].Value.CreateInstance();
|
||||
this._soundInstanceZombie[index16].Volume = num7 * 0.2f;
|
||||
this._soundInstanceZombie[index16].Pan = num2;
|
||||
this._soundInstanceZombie[index16].Pitch = (float) Main.rand.Next(-70, 1) * 0.01f;
|
||||
sound = this._soundInstanceZombie[index16];
|
||||
}
|
||||
else if (type == 30)
|
||||
{
|
||||
int index17 = Main.rand.Next(10, 12);
|
||||
if (Main.rand.Next(300) == 0)
|
||||
{
|
||||
index17 = 12;
|
||||
if (this._soundInstanceZombie[index17] != null && this._soundInstanceZombie[index17].State == SoundState.Playing)
|
||||
return (SoundEffectInstance) null;
|
||||
}
|
||||
this._soundInstanceZombie[index17] = this._soundZombie[index17].Value.CreateInstance();
|
||||
this._soundInstanceZombie[index17].Volume = num7 * 0.75f;
|
||||
this._soundInstanceZombie[index17].Pan = num2;
|
||||
this._soundInstanceZombie[index17].Pitch = index17 == 12 ? (float) Main.rand.Next(-40, 21) * 0.01f : (float) Main.rand.Next(-70, 1) * 0.01f;
|
||||
sound = this._soundInstanceZombie[index17];
|
||||
}
|
||||
else if (type == 31)
|
||||
{
|
||||
int index18 = 13;
|
||||
this._soundInstanceZombie[index18] = this._soundZombie[index18].Value.CreateInstance();
|
||||
this._soundInstanceZombie[index18].Volume = num7 * 0.35f;
|
||||
this._soundInstanceZombie[index18].Pan = num2;
|
||||
this._soundInstanceZombie[index18].Pitch = (float) Main.rand.Next(-40, 21) * 0.01f;
|
||||
sound = this._soundInstanceZombie[index18];
|
||||
}
|
||||
else if (type == 32)
|
||||
{
|
||||
if (this._soundInstanceZombie[index1] != null && this._soundInstanceZombie[index1].State == SoundState.Playing)
|
||||
return (SoundEffectInstance) null;
|
||||
this._soundInstanceZombie[index1] = this._soundZombie[index1].Value.CreateInstance();
|
||||
this._soundInstanceZombie[index1].Volume = num7 * 0.15f;
|
||||
this._soundInstanceZombie[index1].Pan = num2;
|
||||
this._soundInstanceZombie[index1].Pitch = (float) Main.rand.Next(-70, 26) * 0.01f;
|
||||
sound = this._soundInstanceZombie[index1];
|
||||
}
|
||||
else if (type == 33)
|
||||
{
|
||||
int index19 = 15;
|
||||
if (this._soundInstanceZombie[index19] != null && this._soundInstanceZombie[index19].State == SoundState.Playing)
|
||||
return (SoundEffectInstance) null;
|
||||
this._soundInstanceZombie[index19] = this._soundZombie[index19].Value.CreateInstance();
|
||||
this._soundInstanceZombie[index19].Volume = num7 * 0.2f;
|
||||
this._soundInstanceZombie[index19].Pan = num2;
|
||||
this._soundInstanceZombie[index19].Pitch = (float) Main.rand.Next(-10, 31) * 0.01f;
|
||||
sound = this._soundInstanceZombie[index19];
|
||||
}
|
||||
else if (type >= 47 && type <= 52)
|
||||
{
|
||||
int index20 = 133 + type - 47;
|
||||
for (int index21 = 133; index21 <= 138; ++index21)
|
||||
{
|
||||
if (this._soundInstanceItem[index21] != null && this._soundInstanceItem[index21].State == SoundState.Playing)
|
||||
this._soundInstanceItem[index21].Stop();
|
||||
}
|
||||
this._soundInstanceItem[index20] = this._soundItem[index20].Value.CreateInstance();
|
||||
this._soundInstanceItem[index20].Volume = num7 * 0.45f;
|
||||
this._soundInstanceItem[index20].Pan = num2;
|
||||
sound = this._soundInstanceItem[index20];
|
||||
}
|
||||
else if (type >= 53 && type <= 62)
|
||||
{
|
||||
int index22 = 139 + type - 53;
|
||||
if (this._soundInstanceItem[index22] != null && this._soundInstanceItem[index22].State == SoundState.Playing)
|
||||
this._soundInstanceItem[index22].Stop();
|
||||
this._soundInstanceItem[index22] = this._soundItem[index22].Value.CreateInstance();
|
||||
this._soundInstanceItem[index22].Volume = num7 * 0.7f;
|
||||
this._soundInstanceItem[index22].Pan = num2;
|
||||
sound = this._soundInstanceItem[index22];
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case 34:
|
||||
float num10 = (float) index1 / 50f;
|
||||
if ((double) num10 > 1.0)
|
||||
num10 = 1f;
|
||||
float num11 = num7 * num10 * 0.2f;
|
||||
if ((double) num11 <= 0.0 || x == -1 || y == -1)
|
||||
{
|
||||
if (this._soundInstanceLiquid[0] != null && this._soundInstanceLiquid[0].State == SoundState.Playing)
|
||||
{
|
||||
this._soundInstanceLiquid[0].Stop();
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (this._soundInstanceLiquid[0] != null && this._soundInstanceLiquid[0].State == SoundState.Playing)
|
||||
{
|
||||
this._soundInstanceLiquid[0].Volume = num11;
|
||||
this._soundInstanceLiquid[0].Pan = num2;
|
||||
this._soundInstanceLiquid[0].Pitch = -0.2f;
|
||||
break;
|
||||
}
|
||||
this._soundInstanceLiquid[0] = this._soundLiquid[0].Value.CreateInstance();
|
||||
this._soundInstanceLiquid[0].Volume = num11;
|
||||
this._soundInstanceLiquid[0].Pan = num2;
|
||||
sound = this._soundInstanceLiquid[0];
|
||||
break;
|
||||
case 35:
|
||||
float num12 = (float) index1 / 50f;
|
||||
if ((double) num12 > 1.0)
|
||||
num12 = 1f;
|
||||
float num13 = num7 * num12 * 0.65f;
|
||||
if ((double) num13 <= 0.0 || x == -1 || y == -1)
|
||||
{
|
||||
if (this._soundInstanceLiquid[1] != null && this._soundInstanceLiquid[1].State == SoundState.Playing)
|
||||
{
|
||||
this._soundInstanceLiquid[1].Stop();
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (this._soundInstanceLiquid[1] != null && this._soundInstanceLiquid[1].State == SoundState.Playing)
|
||||
{
|
||||
this._soundInstanceLiquid[1].Volume = num13;
|
||||
this._soundInstanceLiquid[1].Pan = num2;
|
||||
this._soundInstanceLiquid[1].Pitch = -0.0f;
|
||||
break;
|
||||
}
|
||||
this._soundInstanceLiquid[1] = this._soundLiquid[1].Value.CreateInstance();
|
||||
this._soundInstanceLiquid[1].Volume = num13;
|
||||
this._soundInstanceLiquid[1].Pan = num2;
|
||||
sound = this._soundInstanceLiquid[1];
|
||||
break;
|
||||
case 36:
|
||||
int index23 = Style;
|
||||
if (Style == -1)
|
||||
index23 = 0;
|
||||
this._soundInstanceRoar[index23] = this._soundRoar[index23].Value.CreateInstance();
|
||||
this._soundInstanceRoar[index23].Volume = num7;
|
||||
this._soundInstanceRoar[index23].Pan = num2;
|
||||
if (Style == -1)
|
||||
this._soundInstanceRoar[index23].Pitch += 0.6f;
|
||||
sound = this._soundInstanceRoar[index23];
|
||||
break;
|
||||
case 37:
|
||||
int index24 = Main.rand.Next(57, 59);
|
||||
float num14 = num7 * ((float) Style * 0.05f);
|
||||
this._soundInstanceItem[index24] = this._soundItem[index24].Value.CreateInstance();
|
||||
this._soundInstanceItem[index24].Volume = num14;
|
||||
this._soundInstanceItem[index24].Pan = num2;
|
||||
this._soundInstanceItem[index24].Pitch = (float) Main.rand.Next(-40, 41) * 0.01f;
|
||||
sound = this._soundInstanceItem[index24];
|
||||
break;
|
||||
case 38:
|
||||
int index25 = Main.rand.Next(5);
|
||||
this._soundInstanceCoin[index25] = this._soundCoin[index25].Value.CreateInstance();
|
||||
this._soundInstanceCoin[index25].Volume = num7;
|
||||
this._soundInstanceCoin[index25].Pan = num2;
|
||||
this._soundInstanceCoin[index25].Pitch = (float) Main.rand.Next(-40, 41) * (1f / 500f);
|
||||
sound = this._soundInstanceCoin[index25];
|
||||
break;
|
||||
case 39:
|
||||
int index26 = Style;
|
||||
this._soundInstanceDrip[index26] = this._soundDrip[index26].Value.CreateInstance();
|
||||
this._soundInstanceDrip[index26].Volume = num7 * 0.5f;
|
||||
this._soundInstanceDrip[index26].Pan = num2;
|
||||
this._soundInstanceDrip[index26].Pitch = (float) Main.rand.Next(-30, 31) * 0.01f;
|
||||
sound = this._soundInstanceDrip[index26];
|
||||
break;
|
||||
case 40:
|
||||
if (this._soundInstanceCamera != null)
|
||||
this._soundInstanceCamera.Stop();
|
||||
this._soundInstanceCamera = this._soundCamera.Value.CreateInstance();
|
||||
this._soundInstanceCamera.Volume = num7;
|
||||
this._soundInstanceCamera.Pan = num2;
|
||||
sound = this._soundInstanceCamera;
|
||||
break;
|
||||
case 41:
|
||||
this._soundInstanceMoonlordCry = this._soundNpcKilled[10].Value.CreateInstance();
|
||||
this._soundInstanceMoonlordCry.Volume = (float) (1.0 / (1.0 + (double) (new Vector2((float) x, (float) y) - Main.player[Main.myPlayer].position).Length()));
|
||||
this._soundInstanceMoonlordCry.Pan = num2;
|
||||
this._soundInstanceMoonlordCry.Pitch = (float) Main.rand.Next(-10, 11) * 0.01f;
|
||||
sound = this._soundInstanceMoonlordCry;
|
||||
break;
|
||||
case 42:
|
||||
sound = this._trackableSounds[index1].Value.CreateInstance();
|
||||
sound.Volume = num7;
|
||||
sound.Pan = num2;
|
||||
this._trackableSoundInstances[index1] = sound;
|
||||
break;
|
||||
case 65:
|
||||
if (this._soundInstanceZombie[115] != null && this._soundInstanceZombie[115].State == SoundState.Playing || this._soundInstanceZombie[116] != null && this._soundInstanceZombie[116].State == SoundState.Playing || this._soundInstanceZombie[117] != null && this._soundInstanceZombie[117].State == SoundState.Playing)
|
||||
return (SoundEffectInstance) null;
|
||||
int index27 = Main.rand.Next(115, 118);
|
||||
this._soundInstanceZombie[index27] = this._soundZombie[index27].Value.CreateInstance();
|
||||
this._soundInstanceZombie[index27].Volume = num7 * 0.5f;
|
||||
this._soundInstanceZombie[index27].Pan = num2;
|
||||
sound = this._soundInstanceZombie[index27];
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (sound != null)
|
||||
{
|
||||
sound.Pitch += pitchOffset;
|
||||
sound.Volume *= volumeScale;
|
||||
sound.Play();
|
||||
SoundInstanceGarbageCollector.Track(sound);
|
||||
}
|
||||
return sound;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
return (SoundEffectInstance) null;
|
||||
}
|
||||
|
||||
public SoundEffect GetTrackableSoundByStyleId(int id) => this._trackableSounds[id].Value;
|
||||
|
||||
public void StopAmbientSounds()
|
||||
{
|
||||
for (int index = 0; index < this._soundInstanceLiquid.Length; ++index)
|
||||
{
|
||||
if (this._soundInstanceLiquid[index] != null)
|
||||
this._soundInstanceLiquid[index].Stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
67
Audio/LegacySoundStyle.cs
Normal file
67
Audio/LegacySoundStyle.cs
Normal file
|
@ -0,0 +1,67 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Audio.LegacySoundStyle
|
||||
// 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.Audio;
|
||||
using Terraria.Utilities;
|
||||
|
||||
namespace Terraria.Audio
|
||||
{
|
||||
public class LegacySoundStyle : SoundStyle
|
||||
{
|
||||
private static readonly UnifiedRandom Random = new UnifiedRandom();
|
||||
private readonly int _style;
|
||||
public readonly int Variations;
|
||||
public readonly int SoundId;
|
||||
|
||||
public int Style => this.Variations != 1 ? LegacySoundStyle.Random.Next(this._style, this._style + this.Variations) : this._style;
|
||||
|
||||
public override bool IsTrackable => this.SoundId == 42;
|
||||
|
||||
public LegacySoundStyle(int soundId, int style, SoundType type = SoundType.Sound)
|
||||
: base(type)
|
||||
{
|
||||
this._style = style;
|
||||
this.Variations = 1;
|
||||
this.SoundId = soundId;
|
||||
}
|
||||
|
||||
public LegacySoundStyle(int soundId, int style, int variations, SoundType type = SoundType.Sound)
|
||||
: base(type)
|
||||
{
|
||||
this._style = style;
|
||||
this.Variations = variations;
|
||||
this.SoundId = soundId;
|
||||
}
|
||||
|
||||
private LegacySoundStyle(
|
||||
int soundId,
|
||||
int style,
|
||||
int variations,
|
||||
SoundType type,
|
||||
float volume,
|
||||
float pitchVariance)
|
||||
: base(volume, pitchVariance, type)
|
||||
{
|
||||
this._style = style;
|
||||
this.Variations = variations;
|
||||
this.SoundId = soundId;
|
||||
}
|
||||
|
||||
public LegacySoundStyle WithVolume(float volume) => new LegacySoundStyle(this.SoundId, this._style, this.Variations, this.Type, volume, this.PitchVariance);
|
||||
|
||||
public LegacySoundStyle WithPitchVariance(float pitchVariance) => new LegacySoundStyle(this.SoundId, this._style, this.Variations, this.Type, this.Volume, pitchVariance);
|
||||
|
||||
public LegacySoundStyle AsMusic() => new LegacySoundStyle(this.SoundId, this._style, this.Variations, SoundType.Music, this.Volume, this.PitchVariance);
|
||||
|
||||
public LegacySoundStyle AsAmbient() => new LegacySoundStyle(this.SoundId, this._style, this.Variations, SoundType.Ambient, this.Volume, this.PitchVariance);
|
||||
|
||||
public LegacySoundStyle AsSound() => new LegacySoundStyle(this.SoundId, this._style, this.Variations, SoundType.Sound, this.Volume, this.PitchVariance);
|
||||
|
||||
public bool Includes(int soundId, int style) => this.SoundId == soundId && style >= this._style && style < this._style + this.Variations;
|
||||
|
||||
public override SoundEffect GetRandomSound() => this.IsTrackable ? SoundEngine.GetTrackableSoundByStyleId(this.Style) : (SoundEffect) null;
|
||||
}
|
||||
}
|
287
Audio/SoundEngine.cs
Normal file
287
Audio/SoundEngine.cs
Normal file
|
@ -0,0 +1,287 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Audio.SoundEngine
|
||||
// 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.Audio;
|
||||
using ReLogic.Utilities;
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace Terraria.Audio
|
||||
{
|
||||
public static class SoundEngine
|
||||
{
|
||||
private static LegacySoundPlayer _legacyPlayer;
|
||||
private static SoundPlayer _player;
|
||||
private static bool _areSoundsPaused;
|
||||
|
||||
public static bool IsAudioSupported { get; private set; }
|
||||
|
||||
public static void Initialize() => SoundEngine.IsAudioSupported = SoundEngine.TestAudioSupport();
|
||||
|
||||
public static void Load(IServiceProvider services)
|
||||
{
|
||||
if (!SoundEngine.IsAudioSupported)
|
||||
return;
|
||||
SoundEngine._legacyPlayer = new LegacySoundPlayer(services);
|
||||
SoundEngine._player = new SoundPlayer();
|
||||
}
|
||||
|
||||
public static void Update()
|
||||
{
|
||||
if (!SoundEngine.IsAudioSupported)
|
||||
return;
|
||||
SoundInstanceGarbageCollector.Update();
|
||||
bool flag = (!Main.hasFocus || Main.gamePaused) && Main.netMode == 0;
|
||||
if (!SoundEngine._areSoundsPaused & flag)
|
||||
SoundEngine._player.PauseAll();
|
||||
else if (SoundEngine._areSoundsPaused && !flag)
|
||||
SoundEngine._player.ResumeAll();
|
||||
SoundEngine._areSoundsPaused = flag;
|
||||
SoundEngine._player.Update();
|
||||
}
|
||||
|
||||
public static void PlaySound(int type, Vector2 position, int style = 1) => SoundEngine.PlaySound(type, (int) position.X, (int) position.Y, style);
|
||||
|
||||
public static SoundEffectInstance PlaySound(
|
||||
LegacySoundStyle type,
|
||||
Vector2 position)
|
||||
{
|
||||
return SoundEngine.PlaySound(type, (int) position.X, (int) position.Y);
|
||||
}
|
||||
|
||||
public static SoundEffectInstance PlaySound(
|
||||
LegacySoundStyle type,
|
||||
int x = -1,
|
||||
int y = -1)
|
||||
{
|
||||
return type == null ? (SoundEffectInstance) null : SoundEngine.PlaySound(type.SoundId, x, y, type.Style, type.Volume, type.GetRandomPitch());
|
||||
}
|
||||
|
||||
public static SoundEffectInstance PlaySound(
|
||||
int type,
|
||||
int x = -1,
|
||||
int y = -1,
|
||||
int Style = 1,
|
||||
float volumeScale = 1f,
|
||||
float pitchOffset = 0.0f)
|
||||
{
|
||||
return !SoundEngine.IsAudioSupported ? (SoundEffectInstance) null : SoundEngine._legacyPlayer.PlaySound(type, x, y, Style, volumeScale, pitchOffset);
|
||||
}
|
||||
|
||||
public static ActiveSound GetActiveSound(SlotId id) => !SoundEngine.IsAudioSupported ? (ActiveSound) null : SoundEngine._player.GetActiveSound(id);
|
||||
|
||||
public static SlotId PlayTrackedSound(SoundStyle style, Vector2 position) => !SoundEngine.IsAudioSupported ? (SlotId) SlotId.Invalid : SoundEngine._player.Play(style, position);
|
||||
|
||||
public static SlotId PlayTrackedSound(SoundStyle style) => !SoundEngine.IsAudioSupported ? (SlotId) SlotId.Invalid : SoundEngine._player.Play(style);
|
||||
|
||||
public static void StopTrackedSounds()
|
||||
{
|
||||
if (!SoundEngine.IsAudioSupported)
|
||||
return;
|
||||
SoundEngine._player.StopAll();
|
||||
}
|
||||
|
||||
public static SoundEffect GetTrackableSoundByStyleId(int id) => !SoundEngine.IsAudioSupported ? (SoundEffect) null : SoundEngine._legacyPlayer.GetTrackableSoundByStyleId(id);
|
||||
|
||||
public static void StopAmbientSounds()
|
||||
{
|
||||
if (!SoundEngine.IsAudioSupported || SoundEngine._legacyPlayer == null)
|
||||
return;
|
||||
SoundEngine._legacyPlayer.StopAmbientSounds();
|
||||
}
|
||||
|
||||
public static ActiveSound FindActiveSound(SoundStyle style) => !SoundEngine.IsAudioSupported ? (ActiveSound) null : SoundEngine._player.FindActiveSound(style);
|
||||
|
||||
private static bool TestAudioSupport()
|
||||
{
|
||||
byte[] buffer = new byte[166]
|
||||
{
|
||||
(byte) 82,
|
||||
(byte) 73,
|
||||
(byte) 70,
|
||||
(byte) 70,
|
||||
(byte) 158,
|
||||
(byte) 0,
|
||||
(byte) 0,
|
||||
(byte) 0,
|
||||
(byte) 87,
|
||||
(byte) 65,
|
||||
(byte) 86,
|
||||
(byte) 69,
|
||||
(byte) 102,
|
||||
(byte) 109,
|
||||
(byte) 116,
|
||||
(byte) 32,
|
||||
(byte) 16,
|
||||
(byte) 0,
|
||||
(byte) 0,
|
||||
(byte) 0,
|
||||
(byte) 1,
|
||||
(byte) 0,
|
||||
(byte) 1,
|
||||
(byte) 0,
|
||||
(byte) 68,
|
||||
(byte) 172,
|
||||
(byte) 0,
|
||||
(byte) 0,
|
||||
(byte) 136,
|
||||
(byte) 88,
|
||||
(byte) 1,
|
||||
(byte) 0,
|
||||
(byte) 2,
|
||||
(byte) 0,
|
||||
(byte) 16,
|
||||
(byte) 0,
|
||||
(byte) 76,
|
||||
(byte) 73,
|
||||
(byte) 83,
|
||||
(byte) 84,
|
||||
(byte) 26,
|
||||
(byte) 0,
|
||||
(byte) 0,
|
||||
(byte) 0,
|
||||
(byte) 73,
|
||||
(byte) 78,
|
||||
(byte) 70,
|
||||
(byte) 79,
|
||||
(byte) 73,
|
||||
(byte) 83,
|
||||
(byte) 70,
|
||||
(byte) 84,
|
||||
(byte) 14,
|
||||
(byte) 0,
|
||||
(byte) 0,
|
||||
(byte) 0,
|
||||
(byte) 76,
|
||||
(byte) 97,
|
||||
(byte) 118,
|
||||
(byte) 102,
|
||||
(byte) 53,
|
||||
(byte) 54,
|
||||
(byte) 46,
|
||||
(byte) 52,
|
||||
(byte) 48,
|
||||
(byte) 46,
|
||||
(byte) 49,
|
||||
(byte) 48,
|
||||
(byte) 49,
|
||||
(byte) 0,
|
||||
(byte) 100,
|
||||
(byte) 97,
|
||||
(byte) 116,
|
||||
(byte) 97,
|
||||
(byte) 88,
|
||||
(byte) 0,
|
||||
(byte) 0,
|
||||
(byte) 0,
|
||||
(byte) 0,
|
||||
(byte) 0,
|
||||
(byte) 126,
|
||||
(byte) 4,
|
||||
(byte) 240,
|
||||
(byte) 8,
|
||||
(byte) 64,
|
||||
(byte) 13,
|
||||
(byte) 95,
|
||||
(byte) 17,
|
||||
(byte) 67,
|
||||
(byte) 21,
|
||||
(byte) 217,
|
||||
(byte) 24,
|
||||
(byte) 23,
|
||||
(byte) 28,
|
||||
(byte) 240,
|
||||
(byte) 30,
|
||||
(byte) 94,
|
||||
(byte) 33,
|
||||
(byte) 84,
|
||||
(byte) 35,
|
||||
(byte) 208,
|
||||
(byte) 36,
|
||||
(byte) 204,
|
||||
(byte) 37,
|
||||
(byte) 71,
|
||||
(byte) 38,
|
||||
(byte) 64,
|
||||
(byte) 38,
|
||||
(byte) 183,
|
||||
(byte) 37,
|
||||
(byte) 180,
|
||||
(byte) 36,
|
||||
(byte) 58,
|
||||
(byte) 35,
|
||||
(byte) 79,
|
||||
(byte) 33,
|
||||
(byte) 1,
|
||||
(byte) 31,
|
||||
(byte) 86,
|
||||
(byte) 28,
|
||||
(byte) 92,
|
||||
(byte) 25,
|
||||
(byte) 37,
|
||||
(byte) 22,
|
||||
(byte) 185,
|
||||
(byte) 18,
|
||||
(byte) 42,
|
||||
(byte) 15,
|
||||
(byte) 134,
|
||||
(byte) 11,
|
||||
(byte) 222,
|
||||
(byte) 7,
|
||||
(byte) 68,
|
||||
(byte) 4,
|
||||
(byte) 196,
|
||||
(byte) 0,
|
||||
(byte) 112,
|
||||
(byte) 253,
|
||||
(byte) 86,
|
||||
(byte) 250,
|
||||
(byte) 132,
|
||||
(byte) 247,
|
||||
(byte) 6,
|
||||
(byte) 245,
|
||||
(byte) 230,
|
||||
(byte) 242,
|
||||
(byte) 47,
|
||||
(byte) 241,
|
||||
(byte) 232,
|
||||
(byte) 239,
|
||||
(byte) 25,
|
||||
(byte) 239,
|
||||
(byte) 194,
|
||||
(byte) 238,
|
||||
(byte) 231,
|
||||
(byte) 238,
|
||||
(byte) 139,
|
||||
(byte) 239,
|
||||
(byte) 169,
|
||||
(byte) 240,
|
||||
(byte) 61,
|
||||
(byte) 242,
|
||||
(byte) 67,
|
||||
(byte) 244,
|
||||
(byte) 180,
|
||||
(byte) 246
|
||||
};
|
||||
try
|
||||
{
|
||||
using (MemoryStream memoryStream = new MemoryStream(buffer))
|
||||
SoundEffect.FromStream((Stream) memoryStream);
|
||||
}
|
||||
catch (NoAudioHardwareException ex)
|
||||
{
|
||||
Console.WriteLine("No audio hardware found. Disabling all audio.");
|
||||
return false;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
38
Audio/SoundInstanceGarbageCollector.cs
Normal file
38
Audio/SoundInstanceGarbageCollector.cs
Normal file
|
@ -0,0 +1,38 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Audio.SoundInstanceGarbageCollector
|
||||
// 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.Audio;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Terraria.Audio
|
||||
{
|
||||
public static class SoundInstanceGarbageCollector
|
||||
{
|
||||
private static readonly List<SoundEffectInstance> _activeSounds = new List<SoundEffectInstance>(128);
|
||||
|
||||
public static void Track(SoundEffectInstance sound)
|
||||
{
|
||||
}
|
||||
|
||||
public static void Update()
|
||||
{
|
||||
for (int index = 0; index < SoundInstanceGarbageCollector._activeSounds.Count; ++index)
|
||||
{
|
||||
if (SoundInstanceGarbageCollector._activeSounds[index] == null)
|
||||
{
|
||||
SoundInstanceGarbageCollector._activeSounds.RemoveAt(index);
|
||||
--index;
|
||||
}
|
||||
else if (SoundInstanceGarbageCollector._activeSounds[index].State == SoundState.Stopped)
|
||||
{
|
||||
SoundInstanceGarbageCollector._activeSounds[index].Dispose();
|
||||
SoundInstanceGarbageCollector._activeSounds.RemoveAt(index);
|
||||
--index;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
74
Audio/SoundPlayer.cs
Normal file
74
Audio/SoundPlayer.cs
Normal file
|
@ -0,0 +1,74 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Audio.SoundPlayer
|
||||
// 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 ReLogic.Utilities;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Terraria.Audio
|
||||
{
|
||||
public class SoundPlayer
|
||||
{
|
||||
private readonly SlotVector<ActiveSound> _trackedSounds = new SlotVector<ActiveSound>(4096);
|
||||
|
||||
public SlotId Play(SoundStyle style, Vector2 position)
|
||||
{
|
||||
if (Main.dedServ || style == null || !style.IsTrackable)
|
||||
return (SlotId) SlotId.Invalid;
|
||||
return (double) Vector2.DistanceSquared(Main.screenPosition + new Vector2((float) (Main.screenWidth / 2), (float) (Main.screenHeight / 2)), position) > 100000000.0 ? (SlotId) SlotId.Invalid : this._trackedSounds.Add(new ActiveSound(style, position));
|
||||
}
|
||||
|
||||
public SlotId Play(SoundStyle style) => Main.dedServ || style == null || !style.IsTrackable ? (SlotId) SlotId.Invalid : this._trackedSounds.Add(new ActiveSound(style));
|
||||
|
||||
public ActiveSound GetActiveSound(SlotId id) => !this._trackedSounds.Has(id) ? (ActiveSound) null : this._trackedSounds[id];
|
||||
|
||||
public void PauseAll()
|
||||
{
|
||||
foreach (SlotVector<ActiveSound>.ItemPair trackedSound in (IEnumerable<SlotVector<ActiveSound>.ItemPair>) this._trackedSounds)
|
||||
((ActiveSound) trackedSound.Value).Pause();
|
||||
}
|
||||
|
||||
public void ResumeAll()
|
||||
{
|
||||
foreach (SlotVector<ActiveSound>.ItemPair trackedSound in (IEnumerable<SlotVector<ActiveSound>.ItemPair>) this._trackedSounds)
|
||||
((ActiveSound) trackedSound.Value).Resume();
|
||||
}
|
||||
|
||||
public void StopAll()
|
||||
{
|
||||
foreach (SlotVector<ActiveSound>.ItemPair trackedSound in (IEnumerable<SlotVector<ActiveSound>.ItemPair>) this._trackedSounds)
|
||||
((ActiveSound) trackedSound.Value).Stop();
|
||||
this._trackedSounds.Clear();
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
foreach (SlotVector<ActiveSound>.ItemPair trackedSound in (IEnumerable<SlotVector<ActiveSound>.ItemPair>) this._trackedSounds)
|
||||
{
|
||||
try
|
||||
{
|
||||
((ActiveSound) trackedSound.Value).Update();
|
||||
if (!((ActiveSound) trackedSound.Value).IsPlaying)
|
||||
this._trackedSounds.Remove((SlotId) trackedSound.Id);
|
||||
}
|
||||
catch
|
||||
{
|
||||
this._trackedSounds.Remove((SlotId) trackedSound.Id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public ActiveSound FindActiveSound(SoundStyle style)
|
||||
{
|
||||
foreach (SlotVector<ActiveSound>.ItemPair trackedSound in (IEnumerable<SlotVector<ActiveSound>.ItemPair>) this._trackedSounds)
|
||||
{
|
||||
if (((ActiveSound) trackedSound.Value).Style == style)
|
||||
return (ActiveSound) trackedSound.Value;
|
||||
}
|
||||
return (ActiveSound) null;
|
||||
}
|
||||
}
|
||||
}
|
45
Audio/SoundStyle.cs
Normal file
45
Audio/SoundStyle.cs
Normal file
|
@ -0,0 +1,45 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Audio.SoundStyle
|
||||
// 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.Audio;
|
||||
using Terraria.Utilities;
|
||||
|
||||
namespace Terraria.Audio
|
||||
{
|
||||
public abstract class SoundStyle
|
||||
{
|
||||
private static UnifiedRandom _random = new UnifiedRandom();
|
||||
private float _volume;
|
||||
private float _pitchVariance;
|
||||
private SoundType _type;
|
||||
|
||||
public float Volume => this._volume;
|
||||
|
||||
public float PitchVariance => this._pitchVariance;
|
||||
|
||||
public SoundType Type => this._type;
|
||||
|
||||
public abstract bool IsTrackable { get; }
|
||||
|
||||
public SoundStyle(float volume, float pitchVariance, SoundType type = SoundType.Sound)
|
||||
{
|
||||
this._volume = volume;
|
||||
this._pitchVariance = pitchVariance;
|
||||
this._type = type;
|
||||
}
|
||||
|
||||
public SoundStyle(SoundType type = SoundType.Sound)
|
||||
{
|
||||
this._volume = 1f;
|
||||
this._pitchVariance = 0.0f;
|
||||
this._type = type;
|
||||
}
|
||||
|
||||
public float GetRandomPitch() => (float) ((double) SoundStyle._random.NextFloat() * (double) this.PitchVariance - (double) this.PitchVariance * 0.5);
|
||||
|
||||
public abstract SoundEffect GetRandomSound();
|
||||
}
|
||||
}
|
15
Audio/SoundType.cs
Normal file
15
Audio/SoundType.cs
Normal file
|
@ -0,0 +1,15 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Audio.SoundType
|
||||
// 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.Audio
|
||||
{
|
||||
public enum SoundType
|
||||
{
|
||||
Sound,
|
||||
Ambient,
|
||||
Music,
|
||||
}
|
||||
}
|
150
BitsByte.cs
Normal file
150
BitsByte.cs
Normal file
|
@ -0,0 +1,150 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.BitsByte
|
||||
// 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.IO;
|
||||
|
||||
namespace Terraria
|
||||
{
|
||||
public struct BitsByte
|
||||
{
|
||||
private static bool Null;
|
||||
private byte value;
|
||||
|
||||
public BitsByte(bool b1 = false, bool b2 = false, bool b3 = false, bool b4 = false, bool b5 = false, bool b6 = false, bool b7 = false, bool b8 = false)
|
||||
{
|
||||
this.value = (byte) 0;
|
||||
this[0] = b1;
|
||||
this[1] = b2;
|
||||
this[2] = b3;
|
||||
this[3] = b4;
|
||||
this[4] = b5;
|
||||
this[5] = b6;
|
||||
this[6] = b7;
|
||||
this[7] = b8;
|
||||
}
|
||||
|
||||
public void ClearAll() => this.value = (byte) 0;
|
||||
|
||||
public void SetAll() => this.value = byte.MaxValue;
|
||||
|
||||
public bool this[int key]
|
||||
{
|
||||
get => ((uint) this.value & (uint) (1 << key)) > 0U;
|
||||
set
|
||||
{
|
||||
if (value)
|
||||
this.value |= (byte) (1 << key);
|
||||
else
|
||||
this.value &= (byte) ~(1 << key);
|
||||
}
|
||||
}
|
||||
|
||||
public void Retrieve(ref bool b0) => this.Retrieve(ref b0, ref BitsByte.Null, ref BitsByte.Null, ref BitsByte.Null, ref BitsByte.Null, ref BitsByte.Null, ref BitsByte.Null, ref BitsByte.Null);
|
||||
|
||||
public void Retrieve(ref bool b0, ref bool b1) => this.Retrieve(ref b0, ref b1, ref BitsByte.Null, ref BitsByte.Null, ref BitsByte.Null, ref BitsByte.Null, ref BitsByte.Null, ref BitsByte.Null);
|
||||
|
||||
public void Retrieve(ref bool b0, ref bool b1, ref bool b2) => this.Retrieve(ref b0, ref b1, ref b2, ref BitsByte.Null, ref BitsByte.Null, ref BitsByte.Null, ref BitsByte.Null, ref BitsByte.Null);
|
||||
|
||||
public void Retrieve(ref bool b0, ref bool b1, ref bool b2, ref bool b3) => this.Retrieve(ref b0, ref b1, ref b2, ref b3, ref BitsByte.Null, ref BitsByte.Null, ref BitsByte.Null, ref BitsByte.Null);
|
||||
|
||||
public void Retrieve(ref bool b0, ref bool b1, ref bool b2, ref bool b3, ref bool b4) => this.Retrieve(ref b0, ref b1, ref b2, ref b3, ref b4, ref BitsByte.Null, ref BitsByte.Null, ref BitsByte.Null);
|
||||
|
||||
public void Retrieve(
|
||||
ref bool b0,
|
||||
ref bool b1,
|
||||
ref bool b2,
|
||||
ref bool b3,
|
||||
ref bool b4,
|
||||
ref bool b5)
|
||||
{
|
||||
this.Retrieve(ref b0, ref b1, ref b2, ref b3, ref b4, ref b5, ref BitsByte.Null, ref BitsByte.Null);
|
||||
}
|
||||
|
||||
public void Retrieve(
|
||||
ref bool b0,
|
||||
ref bool b1,
|
||||
ref bool b2,
|
||||
ref bool b3,
|
||||
ref bool b4,
|
||||
ref bool b5,
|
||||
ref bool b6)
|
||||
{
|
||||
this.Retrieve(ref b0, ref b1, ref b2, ref b3, ref b4, ref b5, ref b6, ref BitsByte.Null);
|
||||
}
|
||||
|
||||
public void Retrieve(
|
||||
ref bool b0,
|
||||
ref bool b1,
|
||||
ref bool b2,
|
||||
ref bool b3,
|
||||
ref bool b4,
|
||||
ref bool b5,
|
||||
ref bool b6,
|
||||
ref bool b7)
|
||||
{
|
||||
b0 = this[0];
|
||||
b1 = this[1];
|
||||
b2 = this[2];
|
||||
b3 = this[3];
|
||||
b4 = this[4];
|
||||
b5 = this[5];
|
||||
b6 = this[6];
|
||||
b7 = this[7];
|
||||
}
|
||||
|
||||
public static implicit operator byte(BitsByte bb) => bb.value;
|
||||
|
||||
public static implicit operator BitsByte(byte b) => new BitsByte()
|
||||
{
|
||||
value = b
|
||||
};
|
||||
|
||||
public static BitsByte[] ComposeBitsBytesChain(bool optimizeLength, params bool[] flags)
|
||||
{
|
||||
int length1 = flags.Length;
|
||||
int length2 = 0;
|
||||
for (; length1 > 0; length1 -= 7)
|
||||
++length2;
|
||||
BitsByte[] array = new BitsByte[length2];
|
||||
int key = 0;
|
||||
int index1 = 0;
|
||||
for (int index2 = 0; index2 < flags.Length; ++index2)
|
||||
{
|
||||
array[index1][key] = flags[index2];
|
||||
++key;
|
||||
if (key == 7 && index1 < length2 - 1)
|
||||
{
|
||||
array[index1][key] = true;
|
||||
key = 0;
|
||||
++index1;
|
||||
}
|
||||
}
|
||||
if (optimizeLength)
|
||||
{
|
||||
int index3;
|
||||
for (index3 = array.Length - 1; (byte) array[index3] == (byte) 0 && index3 > 0; --index3)
|
||||
array[index3 - 1][7] = false;
|
||||
Array.Resize<BitsByte>(ref array, index3 + 1);
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
public static BitsByte[] DecomposeBitsBytesChain(BinaryReader reader)
|
||||
{
|
||||
List<BitsByte> bitsByteList = new List<BitsByte>();
|
||||
BitsByte bitsByte;
|
||||
do
|
||||
{
|
||||
bitsByte = (BitsByte) reader.ReadByte();
|
||||
bitsByteList.Add(bitsByte);
|
||||
}
|
||||
while (bitsByte[7]);
|
||||
return bitsByteList.ToArray();
|
||||
}
|
||||
}
|
||||
}
|
32
Chat/ChatCommandId.cs
Normal file
32
Chat/ChatCommandId.cs
Normal file
|
@ -0,0 +1,32 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Chat.ChatCommandId
|
||||
// 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 ReLogic.Utilities;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using Terraria.Chat.Commands;
|
||||
|
||||
namespace Terraria.Chat
|
||||
{
|
||||
public struct ChatCommandId
|
||||
{
|
||||
private readonly string _name;
|
||||
|
||||
private ChatCommandId(string name) => this._name = name;
|
||||
|
||||
public static ChatCommandId FromType<T>() where T : IChatCommand
|
||||
{
|
||||
ChatCommandAttribute cacheableAttribute = AttributeUtilities.GetCacheableAttribute<T, ChatCommandAttribute>();
|
||||
return cacheableAttribute != null ? new ChatCommandId(cacheableAttribute.Name) : new ChatCommandId((string) null);
|
||||
}
|
||||
|
||||
public void Serialize(BinaryWriter writer) => writer.Write(this._name ?? "");
|
||||
|
||||
public static ChatCommandId Deserialize(BinaryReader reader) => new ChatCommandId(reader.ReadString());
|
||||
|
||||
public int GetMaxSerializedSize() => 4 + Encoding.UTF8.GetByteCount(this._name ?? "");
|
||||
}
|
||||
}
|
107
Chat/ChatCommandProcessor.cs
Normal file
107
Chat/ChatCommandProcessor.cs
Normal file
|
@ -0,0 +1,107 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Chat.ChatCommandProcessor
|
||||
// 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 ReLogic.Utilities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Terraria.Chat.Commands;
|
||||
using Terraria.Localization;
|
||||
|
||||
namespace Terraria.Chat
|
||||
{
|
||||
public class ChatCommandProcessor : IChatProcessor
|
||||
{
|
||||
private readonly Dictionary<LocalizedText, ChatCommandId> _localizedCommands = new Dictionary<LocalizedText, ChatCommandId>();
|
||||
private readonly Dictionary<ChatCommandId, IChatCommand> _commands = new Dictionary<ChatCommandId, IChatCommand>();
|
||||
private readonly Dictionary<LocalizedText, NetworkText> _aliases = new Dictionary<LocalizedText, NetworkText>();
|
||||
private IChatCommand _defaultCommand;
|
||||
|
||||
public ChatCommandProcessor AddCommand<T>() where T : IChatCommand, new()
|
||||
{
|
||||
string commandKey = "ChatCommand." + AttributeUtilities.GetCacheableAttribute<T, ChatCommandAttribute>().Name;
|
||||
ChatCommandId key1 = ChatCommandId.FromType<T>();
|
||||
this._commands[key1] = (IChatCommand) new T();
|
||||
if (Language.Exists(commandKey))
|
||||
{
|
||||
this._localizedCommands.Add(Language.GetText(commandKey), key1);
|
||||
}
|
||||
else
|
||||
{
|
||||
commandKey += "_";
|
||||
foreach (LocalizedText key2 in Language.FindAll((LanguageSearchFilter) ((key, text) => key.StartsWith(commandKey))))
|
||||
this._localizedCommands.Add(key2, key1);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public void AddAlias(LocalizedText text, NetworkText result) => this._aliases[text] = result;
|
||||
|
||||
public ChatCommandProcessor AddDefaultCommand<T>() where T : IChatCommand, new()
|
||||
{
|
||||
this.AddCommand<T>();
|
||||
this._defaultCommand = this._commands[ChatCommandId.FromType<T>()];
|
||||
return this;
|
||||
}
|
||||
|
||||
private static bool HasLocalizedCommand(ChatMessage message, LocalizedText command)
|
||||
{
|
||||
string lower = message.Text.ToLower();
|
||||
string str = command.Value;
|
||||
if (!lower.StartsWith(str))
|
||||
return false;
|
||||
return lower.Length == str.Length || lower[str.Length] == ' ';
|
||||
}
|
||||
|
||||
private static string RemoveCommandPrefix(string messageText, LocalizedText command)
|
||||
{
|
||||
string str = command.Value;
|
||||
return !messageText.StartsWith(str) || messageText.Length == str.Length || messageText[str.Length] != ' ' ? "" : messageText.Substring(str.Length + 1);
|
||||
}
|
||||
|
||||
public ChatMessage CreateOutgoingMessage(string text)
|
||||
{
|
||||
ChatMessage message = new ChatMessage(text);
|
||||
KeyValuePair<LocalizedText, ChatCommandId> keyValuePair1 = this._localizedCommands.FirstOrDefault<KeyValuePair<LocalizedText, ChatCommandId>>((Func<KeyValuePair<LocalizedText, ChatCommandId>, bool>) (pair => ChatCommandProcessor.HasLocalizedCommand(message, pair.Key)));
|
||||
ChatCommandId chatCommandId = keyValuePair1.Value;
|
||||
if (keyValuePair1.Key != null)
|
||||
{
|
||||
message.SetCommand(chatCommandId);
|
||||
message.Text = ChatCommandProcessor.RemoveCommandPrefix(message.Text, keyValuePair1.Key);
|
||||
this._commands[chatCommandId].ProcessOutgoingMessage(message);
|
||||
}
|
||||
else
|
||||
{
|
||||
bool flag = false;
|
||||
for (KeyValuePair<LocalizedText, NetworkText> keyValuePair2 = this._aliases.FirstOrDefault<KeyValuePair<LocalizedText, NetworkText>>((Func<KeyValuePair<LocalizedText, NetworkText>, bool>) (pair => ChatCommandProcessor.HasLocalizedCommand(message, pair.Key))); keyValuePair2.Key != null; keyValuePair2 = this._aliases.FirstOrDefault<KeyValuePair<LocalizedText, NetworkText>>((Func<KeyValuePair<LocalizedText, NetworkText>, bool>) (pair => ChatCommandProcessor.HasLocalizedCommand(message, pair.Key))))
|
||||
{
|
||||
flag = true;
|
||||
message = new ChatMessage(keyValuePair2.Value.ToString());
|
||||
}
|
||||
if (flag)
|
||||
return this.CreateOutgoingMessage(message.Text);
|
||||
}
|
||||
return message;
|
||||
}
|
||||
|
||||
public void ProcessIncomingMessage(ChatMessage message, int clientId)
|
||||
{
|
||||
IChatCommand chatCommand;
|
||||
if (this._commands.TryGetValue(message.CommandId, out chatCommand))
|
||||
{
|
||||
chatCommand.ProcessIncomingMessage(message.Text, (byte) clientId);
|
||||
message.Consume();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (this._defaultCommand == null)
|
||||
return;
|
||||
this._defaultCommand.ProcessIncomingMessage(message.Text, (byte) clientId);
|
||||
message.Consume();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
89
Chat/ChatHelper.cs
Normal file
89
Chat/ChatHelper.cs
Normal file
|
@ -0,0 +1,89 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Chat.ChatHelper
|
||||
// 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;
|
||||
using System.Collections.Generic;
|
||||
using Terraria.GameContent.NetModules;
|
||||
using Terraria.GameContent.UI.Chat;
|
||||
using Terraria.Localization;
|
||||
using Terraria.Net;
|
||||
|
||||
namespace Terraria.Chat
|
||||
{
|
||||
public static class ChatHelper
|
||||
{
|
||||
private static List<Tuple<string, Color>> _cachedMessages = new List<Tuple<string, Color>>();
|
||||
|
||||
public static void DisplayMessageOnClient(NetworkText text, Color color, int playerId) => ChatHelper.DisplayMessage(text, color, byte.MaxValue);
|
||||
|
||||
public static void SendChatMessageToClient(NetworkText text, Color color, int playerId) => ChatHelper.SendChatMessageToClientAs(byte.MaxValue, text, color, playerId);
|
||||
|
||||
public static void SendChatMessageToClientAs(
|
||||
byte messageAuthor,
|
||||
NetworkText text,
|
||||
Color color,
|
||||
int playerId)
|
||||
{
|
||||
if (playerId != Main.myPlayer)
|
||||
return;
|
||||
ChatHelper.DisplayMessage(text, color, messageAuthor);
|
||||
}
|
||||
|
||||
public static void BroadcastChatMessage(NetworkText text, Color color, int excludedPlayer = -1) => ChatHelper.BroadcastChatMessageAs(byte.MaxValue, text, color, excludedPlayer);
|
||||
|
||||
public static void BroadcastChatMessageAs(
|
||||
byte messageAuthor,
|
||||
NetworkText text,
|
||||
Color color,
|
||||
int excludedPlayer = -1)
|
||||
{
|
||||
if (excludedPlayer == Main.myPlayer)
|
||||
return;
|
||||
ChatHelper.DisplayMessage(text, color, messageAuthor);
|
||||
}
|
||||
|
||||
public static bool OnlySendToPlayersWhoAreLoggedIn(int clientIndex) => Netplay.Clients[clientIndex].State == 10;
|
||||
|
||||
public static void SendChatMessageFromClient(ChatMessage message)
|
||||
{
|
||||
if (message.IsConsumed)
|
||||
return;
|
||||
NetPacket packet = NetTextModule.SerializeClientMessage(message);
|
||||
NetManager.Instance.SendToServer(packet);
|
||||
}
|
||||
|
||||
public static void DisplayMessage(NetworkText text, Color color, byte messageAuthor)
|
||||
{
|
||||
string str = text.ToString();
|
||||
if (messageAuthor < byte.MaxValue)
|
||||
{
|
||||
Main.player[(int) messageAuthor].chatOverhead.NewMessage(str, Main.PlayerOverheadChatMessageDisplayTime);
|
||||
Main.player[(int) messageAuthor].chatOverhead.color = color;
|
||||
str = NameTagHandler.GenerateTag(Main.player[(int) messageAuthor].name) + " " + str;
|
||||
}
|
||||
if (ChatHelper.ShouldCacheMessage())
|
||||
ChatHelper.CacheMessage(str, color);
|
||||
else
|
||||
Main.NewTextMultiline(str, c: color);
|
||||
}
|
||||
|
||||
private static void CacheMessage(string message, Color color) => ChatHelper._cachedMessages.Add(new Tuple<string, Color>(message, color));
|
||||
|
||||
public static void ShowCachedMessages()
|
||||
{
|
||||
lock (ChatHelper._cachedMessages)
|
||||
{
|
||||
foreach (Tuple<string, Color> cachedMessage in ChatHelper._cachedMessages)
|
||||
Main.NewTextMultiline(cachedMessage.Item1, c: cachedMessage.Item2);
|
||||
}
|
||||
}
|
||||
|
||||
public static void ClearDelayedMessagesCache() => ChatHelper._cachedMessages.Clear();
|
||||
|
||||
private static bool ShouldCacheMessage() => Main.netMode == 1 && Main.gameMenu;
|
||||
}
|
||||
}
|
72
Chat/ChatMessage.cs
Normal file
72
Chat/ChatMessage.cs
Normal file
|
@ -0,0 +1,72 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Chat.ChatMessage
|
||||
// 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.IO;
|
||||
using System.Text;
|
||||
using Terraria.Chat.Commands;
|
||||
|
||||
namespace Terraria.Chat
|
||||
{
|
||||
public sealed class ChatMessage
|
||||
{
|
||||
public ChatCommandId CommandId { get; private set; }
|
||||
|
||||
public string Text { get; set; }
|
||||
|
||||
public bool IsConsumed { get; private set; }
|
||||
|
||||
public ChatMessage(string message)
|
||||
{
|
||||
this.CommandId = ChatCommandId.FromType<SayChatCommand>();
|
||||
this.Text = message;
|
||||
this.IsConsumed = false;
|
||||
}
|
||||
|
||||
private ChatMessage(string message, ChatCommandId commandId)
|
||||
{
|
||||
this.CommandId = commandId;
|
||||
this.Text = message;
|
||||
}
|
||||
|
||||
public void Serialize(BinaryWriter writer)
|
||||
{
|
||||
if (this.IsConsumed)
|
||||
throw new InvalidOperationException("Message has already been consumed.");
|
||||
this.CommandId.Serialize(writer);
|
||||
writer.Write(this.Text);
|
||||
}
|
||||
|
||||
public int GetMaxSerializedSize()
|
||||
{
|
||||
if (this.IsConsumed)
|
||||
throw new InvalidOperationException("Message has already been consumed.");
|
||||
return 0 + this.CommandId.GetMaxSerializedSize() + (4 + Encoding.UTF8.GetByteCount(this.Text));
|
||||
}
|
||||
|
||||
public static ChatMessage Deserialize(BinaryReader reader)
|
||||
{
|
||||
ChatCommandId commandId = ChatCommandId.Deserialize(reader);
|
||||
return new ChatMessage(reader.ReadString(), commandId);
|
||||
}
|
||||
|
||||
public void SetCommand(ChatCommandId commandId)
|
||||
{
|
||||
if (this.IsConsumed)
|
||||
throw new InvalidOperationException("Message has already been consumed.");
|
||||
this.CommandId = commandId;
|
||||
}
|
||||
|
||||
public void SetCommand<T>() where T : IChatCommand
|
||||
{
|
||||
if (this.IsConsumed)
|
||||
throw new InvalidOperationException("Message has already been consumed.");
|
||||
this.CommandId = ChatCommandId.FromType<T>();
|
||||
}
|
||||
|
||||
public void Consume() => this.IsConsumed = true;
|
||||
}
|
||||
}
|
18
Chat/Commands/ChatCommandAttribute.cs
Normal file
18
Chat/Commands/ChatCommandAttribute.cs
Normal file
|
@ -0,0 +1,18 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Chat.Commands.ChatCommandAttribute
|
||||
// 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.Chat.Commands
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface, Inherited = false)]
|
||||
public sealed class ChatCommandAttribute : Attribute
|
||||
{
|
||||
public readonly string Name;
|
||||
|
||||
public ChatCommandAttribute(string name) => this.Name = name;
|
||||
}
|
||||
}
|
73
Chat/Commands/EmojiCommand.cs
Normal file
73
Chat/Commands/EmojiCommand.cs
Normal file
|
@ -0,0 +1,73 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Chat.Commands.EmojiCommand
|
||||
// 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.GameContent.UI;
|
||||
using Terraria.Localization;
|
||||
|
||||
namespace Terraria.Chat.Commands
|
||||
{
|
||||
[ChatCommand("Emoji")]
|
||||
public class EmojiCommand : IChatCommand
|
||||
{
|
||||
public const int PlayerEmojiDuration = 360;
|
||||
private readonly Dictionary<LocalizedText, int> _byName = new Dictionary<LocalizedText, int>();
|
||||
|
||||
public EmojiCommand() => this.Initialize();
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
this._byName.Clear();
|
||||
for (int id = 0; id < 145; ++id)
|
||||
{
|
||||
LocalizedText emojiName = Lang.GetEmojiName(id);
|
||||
if (emojiName != LocalizedText.Empty)
|
||||
this._byName[emojiName] = id;
|
||||
}
|
||||
}
|
||||
|
||||
public void ProcessIncomingMessage(string text, byte clientId)
|
||||
{
|
||||
}
|
||||
|
||||
public void ProcessOutgoingMessage(ChatMessage message)
|
||||
{
|
||||
int result = -1;
|
||||
if (int.TryParse(message.Text, out result))
|
||||
{
|
||||
if (result < 0 || result >= 145)
|
||||
return;
|
||||
}
|
||||
else
|
||||
result = -1;
|
||||
if (result == -1)
|
||||
{
|
||||
foreach (LocalizedText key in this._byName.Keys)
|
||||
{
|
||||
if (message.Text == key.Value)
|
||||
{
|
||||
result = this._byName[key];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (result != -1)
|
||||
{
|
||||
if (Main.netMode == 0)
|
||||
{
|
||||
EmoteBubble.NewBubble(result, new WorldUIAnchor((Entity) Main.LocalPlayer), 360);
|
||||
EmoteBubble.CheckForNPCsToReactToEmoteBubble(result, Main.LocalPlayer);
|
||||
}
|
||||
else
|
||||
NetMessage.SendData(120, number: Main.myPlayer, number2: ((float) result));
|
||||
}
|
||||
message.Consume();
|
||||
}
|
||||
|
||||
public void PrintWarning(string text) => throw new Exception("This needs localized text!");
|
||||
}
|
||||
}
|
29
Chat/Commands/EmoteCommand.cs
Normal file
29
Chat/Commands/EmoteCommand.cs
Normal file
|
@ -0,0 +1,29 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Chat.Commands.EmoteCommand
|
||||
// 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.Localization;
|
||||
|
||||
namespace Terraria.Chat.Commands
|
||||
{
|
||||
[ChatCommand("Emote")]
|
||||
public class EmoteCommand : IChatCommand
|
||||
{
|
||||
private static readonly Color RESPONSE_COLOR = new Color(200, 100, 0);
|
||||
|
||||
public void ProcessIncomingMessage(string text, byte clientId)
|
||||
{
|
||||
if (!(text != ""))
|
||||
return;
|
||||
text = string.Format("*{0} {1}", (object) Main.player[(int) clientId].name, (object) text);
|
||||
ChatHelper.BroadcastChatMessage(NetworkText.FromLiteral(text), EmoteCommand.RESPONSE_COLOR);
|
||||
}
|
||||
|
||||
public void ProcessOutgoingMessage(ChatMessage message)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
57
Chat/Commands/HelpCommand.cs
Normal file
57
Chat/Commands/HelpCommand.cs
Normal file
|
@ -0,0 +1,57 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Chat.Commands.HelpCommand
|
||||
// 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;
|
||||
using Terraria.Localization;
|
||||
|
||||
namespace Terraria.Chat.Commands
|
||||
{
|
||||
[ChatCommand("Help")]
|
||||
public class HelpCommand : IChatCommand
|
||||
{
|
||||
private static readonly Color RESPONSE_COLOR = new Color((int) byte.MaxValue, 240, 20);
|
||||
|
||||
public void ProcessIncomingMessage(string text, byte clientId) => ChatHelper.SendChatMessageToClient(HelpCommand.ComposeMessage(HelpCommand.GetCommandAliasesByID()), HelpCommand.RESPONSE_COLOR, (int) clientId);
|
||||
|
||||
private static Dictionary<string, List<LocalizedText>> GetCommandAliasesByID()
|
||||
{
|
||||
LocalizedText[] all = Language.FindAll(Lang.CreateDialogFilter("ChatCommand.", Lang.CreateDialogSubstitutionObject()));
|
||||
Dictionary<string, List<LocalizedText>> dictionary = new Dictionary<string, List<LocalizedText>>();
|
||||
foreach (LocalizedText localizedText in all)
|
||||
{
|
||||
string key = localizedText.Key.Replace("ChatCommand.", "");
|
||||
int length = key.IndexOf('_');
|
||||
if (length != -1)
|
||||
key = key.Substring(0, length);
|
||||
List<LocalizedText> localizedTextList;
|
||||
if (!dictionary.TryGetValue(key, out localizedTextList))
|
||||
{
|
||||
localizedTextList = new List<LocalizedText>();
|
||||
dictionary[key] = localizedTextList;
|
||||
}
|
||||
localizedTextList.Add(localizedText);
|
||||
}
|
||||
return dictionary;
|
||||
}
|
||||
|
||||
private static NetworkText ComposeMessage(
|
||||
Dictionary<string, List<LocalizedText>> aliases)
|
||||
{
|
||||
string text = "";
|
||||
for (int index = 0; index < aliases.Count; ++index)
|
||||
text = text + "{" + (object) index + "}\n";
|
||||
List<NetworkText> networkTextList = new List<NetworkText>();
|
||||
foreach (KeyValuePair<string, List<LocalizedText>> alias in aliases)
|
||||
networkTextList.Add(Language.GetText("ChatCommandDescription." + alias.Key).ToNetworkText());
|
||||
return NetworkText.FromFormattable(text, (object[]) networkTextList.ToArray());
|
||||
}
|
||||
|
||||
public void ProcessOutgoingMessage(ChatMessage message)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
15
Chat/Commands/IChatCommand.cs
Normal file
15
Chat/Commands/IChatCommand.cs
Normal file
|
@ -0,0 +1,15 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Chat.Commands.IChatCommand
|
||||
// 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.Chat.Commands
|
||||
{
|
||||
public interface IChatCommand
|
||||
{
|
||||
void ProcessIncomingMessage(string text, byte clientId);
|
||||
|
||||
void ProcessOutgoingMessage(ChatMessage message);
|
||||
}
|
||||
}
|
26
Chat/Commands/ListPlayersCommand.cs
Normal file
26
Chat/Commands/ListPlayersCommand.cs
Normal file
|
@ -0,0 +1,26 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Chat.Commands.ListPlayersCommand
|
||||
// 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;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Terraria.Localization;
|
||||
|
||||
namespace Terraria.Chat.Commands
|
||||
{
|
||||
[ChatCommand("Playing")]
|
||||
public class ListPlayersCommand : IChatCommand
|
||||
{
|
||||
private static readonly Color RESPONSE_COLOR = new Color((int) byte.MaxValue, 240, 20);
|
||||
|
||||
public void ProcessIncomingMessage(string text, byte clientId) => ChatHelper.SendChatMessageToClient(NetworkText.FromLiteral(string.Join(", ", ((IEnumerable<Player>) Main.player).Where<Player>((Func<Player, bool>) (player => player.active)).Select<Player, string>((Func<Player, string>) (player => player.name)))), ListPlayersCommand.RESPONSE_COLOR, (int) clientId);
|
||||
|
||||
public void ProcessOutgoingMessage(ChatMessage message)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
43
Chat/Commands/PartyChatCommand.cs
Normal file
43
Chat/Commands/PartyChatCommand.cs
Normal file
|
@ -0,0 +1,43 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Chat.Commands.PartyChatCommand
|
||||
// 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.Localization;
|
||||
|
||||
namespace Terraria.Chat.Commands
|
||||
{
|
||||
[ChatCommand("Party")]
|
||||
public class PartyChatCommand : IChatCommand
|
||||
{
|
||||
private static readonly Color ERROR_COLOR = new Color((int) byte.MaxValue, 240, 20);
|
||||
|
||||
public void ProcessIncomingMessage(string text, byte clientId)
|
||||
{
|
||||
int team = Main.player[(int) clientId].team;
|
||||
Color color = Main.teamColor[team];
|
||||
if (team == 0)
|
||||
{
|
||||
this.SendNoTeamError(clientId);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (text == "")
|
||||
return;
|
||||
for (int playerId = 0; playerId < (int) byte.MaxValue; ++playerId)
|
||||
{
|
||||
if (Main.player[playerId].team == team)
|
||||
ChatHelper.SendChatMessageToClientAs(clientId, NetworkText.FromLiteral(text), color, playerId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void ProcessOutgoingMessage(ChatMessage message)
|
||||
{
|
||||
}
|
||||
|
||||
private void SendNoTeamError(byte clientId) => ChatHelper.SendChatMessageToClient(Lang.mp[10].ToNetworkText(), PartyChatCommand.ERROR_COLOR, (int) clientId);
|
||||
}
|
||||
}
|
31
Chat/Commands/RockPaperScissorsCommand.cs
Normal file
31
Chat/Commands/RockPaperScissorsCommand.cs
Normal file
|
@ -0,0 +1,31 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Chat.Commands.RockPaperScissorsCommand
|
||||
// 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.GameContent.UI;
|
||||
|
||||
namespace Terraria.Chat.Commands
|
||||
{
|
||||
[ChatCommand("RPS")]
|
||||
public class RockPaperScissorsCommand : IChatCommand
|
||||
{
|
||||
public void ProcessIncomingMessage(string text, byte clientId)
|
||||
{
|
||||
}
|
||||
|
||||
public void ProcessOutgoingMessage(ChatMessage message)
|
||||
{
|
||||
int num = Main.rand.NextFromList<int>(37, 38, 36);
|
||||
if (Main.netMode == 0)
|
||||
{
|
||||
EmoteBubble.NewBubble(num, new WorldUIAnchor((Entity) Main.LocalPlayer), 360);
|
||||
EmoteBubble.CheckForNPCsToReactToEmoteBubble(num, Main.LocalPlayer);
|
||||
}
|
||||
else
|
||||
NetMessage.SendData(120, number: Main.myPlayer, number2: ((float) num));
|
||||
message.Consume();
|
||||
}
|
||||
}
|
||||
}
|
27
Chat/Commands/RollCommand.cs
Normal file
27
Chat/Commands/RollCommand.cs
Normal file
|
@ -0,0 +1,27 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Chat.Commands.RollCommand
|
||||
// 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.Localization;
|
||||
|
||||
namespace Terraria.Chat.Commands
|
||||
{
|
||||
[ChatCommand("Roll")]
|
||||
public class RollCommand : IChatCommand
|
||||
{
|
||||
private static readonly Color RESPONSE_COLOR = new Color((int) byte.MaxValue, 240, 20);
|
||||
|
||||
public void ProcessIncomingMessage(string text, byte clientId)
|
||||
{
|
||||
int num = Main.rand.Next(1, 101);
|
||||
ChatHelper.BroadcastChatMessage(NetworkText.FromFormattable("*{0} {1} {2}", (object) Main.player[(int) clientId].name, (object) Lang.mp[9].ToNetworkText(), (object) num), RollCommand.RESPONSE_COLOR);
|
||||
}
|
||||
|
||||
public void ProcessOutgoingMessage(ChatMessage message)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
20
Chat/Commands/SayChatCommand.cs
Normal file
20
Chat/Commands/SayChatCommand.cs
Normal file
|
@ -0,0 +1,20 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Chat.Commands.SayChatCommand
|
||||
// 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.Localization;
|
||||
|
||||
namespace Terraria.Chat.Commands
|
||||
{
|
||||
[ChatCommand("Say")]
|
||||
public class SayChatCommand : IChatCommand
|
||||
{
|
||||
public void ProcessIncomingMessage(string text, byte clientId) => ChatHelper.BroadcastChatMessageAs(clientId, NetworkText.FromLiteral(text), Main.player[(int) clientId].ChatColor());
|
||||
|
||||
public void ProcessOutgoingMessage(ChatMessage message)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
15
Chat/IChatProcessor.cs
Normal file
15
Chat/IChatProcessor.cs
Normal file
|
@ -0,0 +1,15 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Chat.IChatProcessor
|
||||
// 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.Chat
|
||||
{
|
||||
public interface IChatProcessor
|
||||
{
|
||||
void ProcessIncomingMessage(ChatMessage message, int clientId);
|
||||
|
||||
ChatMessage CreateOutgoingMessage(string text);
|
||||
}
|
||||
}
|
35
Cinematics/CinematicManager.cs
Normal file
35
Cinematics/CinematicManager.cs
Normal file
|
@ -0,0 +1,35 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Cinematics.CinematicManager
|
||||
// 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.Cinematics
|
||||
{
|
||||
public class CinematicManager
|
||||
{
|
||||
public static CinematicManager Instance = new CinematicManager();
|
||||
private List<Film> _films = new List<Film>();
|
||||
|
||||
public void Update(GameTime gameTime)
|
||||
{
|
||||
if (this._films.Count <= 0)
|
||||
return;
|
||||
if (!this._films[0].IsActive)
|
||||
this._films[0].OnBegin();
|
||||
if (!Main.hasFocus || Main.gamePaused || this._films[0].OnUpdate(gameTime))
|
||||
return;
|
||||
this._films[0].OnEnd();
|
||||
this._films.RemoveAt(0);
|
||||
}
|
||||
|
||||
public void PlayFilm(Film film) => this._films.Add(film);
|
||||
|
||||
public void StopAll()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
360
Cinematics/DD2Film.cs
Normal file
360
Cinematics/DD2Film.cs
Normal file
|
@ -0,0 +1,360 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Cinematics.DD2Film
|
||||
// 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;
|
||||
using System.Collections.Generic;
|
||||
using Terraria.Audio;
|
||||
using Terraria.GameContent.UI;
|
||||
using Terraria.ID;
|
||||
|
||||
namespace Terraria.Cinematics
|
||||
{
|
||||
public class DD2Film : Film
|
||||
{
|
||||
private NPC _dryad;
|
||||
private NPC _ogre;
|
||||
private NPC _portal;
|
||||
private List<NPC> _army = new List<NPC>();
|
||||
private List<NPC> _critters = new List<NPC>();
|
||||
private Vector2 _startPoint;
|
||||
|
||||
public DD2Film()
|
||||
{
|
||||
this.AppendKeyFrames(new FrameEvent(this.CreateDryad), new FrameEvent(this.CreateCritters));
|
||||
this.AppendSequences(120, new FrameEvent(this.DryadStand), new FrameEvent(this.DryadLookRight));
|
||||
this.AppendSequences(100, new FrameEvent(this.DryadLookRight), new FrameEvent(this.DryadInteract));
|
||||
this.AddKeyFrame(this.AppendPoint - 20, new FrameEvent(this.CreatePortal));
|
||||
this.AppendSequences(30, new FrameEvent(this.DryadLookLeft), new FrameEvent(this.DryadStand));
|
||||
this.AppendSequences(40, new FrameEvent(this.DryadConfusedEmote), new FrameEvent(this.DryadStand), new FrameEvent(this.DryadLookLeft));
|
||||
this.AppendKeyFrame(new FrameEvent(this.CreateOgre));
|
||||
this.AddKeyFrame(this.AppendPoint + 60, new FrameEvent(this.SpawnJavalinThrower));
|
||||
this.AddKeyFrame(this.AppendPoint + 120, new FrameEvent(this.SpawnGoblin));
|
||||
this.AddKeyFrame(this.AppendPoint + 180, new FrameEvent(this.SpawnGoblin));
|
||||
this.AddKeyFrame(this.AppendPoint + 240, new FrameEvent(this.SpawnWitherBeast));
|
||||
this.AppendSequences(30, new FrameEvent(this.DryadStand), new FrameEvent(this.DryadLookLeft));
|
||||
this.AppendSequences(30, new FrameEvent(this.DryadLookRight), new FrameEvent(this.DryadWalk));
|
||||
this.AppendSequences(300, new FrameEvent(this.DryadAttack), new FrameEvent(this.DryadLookLeft));
|
||||
this.AppendKeyFrame(new FrameEvent(this.RemoveEnemyDamage));
|
||||
this.AppendSequences(60, new FrameEvent(this.DryadLookRight), new FrameEvent(this.DryadStand), new FrameEvent(this.DryadAlertEmote));
|
||||
this.AddSequences(this.AppendPoint - 90, 60, new FrameEvent(this.OgreLookLeft), new FrameEvent(this.OgreStand));
|
||||
this.AddKeyFrame(this.AppendPoint - 12, new FrameEvent(this.OgreSwingSound));
|
||||
this.AddSequences(this.AppendPoint - 30, 50, new FrameEvent(this.DryadPortalKnock), new FrameEvent(this.DryadStand));
|
||||
this.AppendKeyFrame(new FrameEvent(this.RestoreEnemyDamage));
|
||||
this.AppendSequences(40, new FrameEvent(this.DryadPortalFade), new FrameEvent(this.DryadStand));
|
||||
this.AppendSequence(180, new FrameEvent(this.DryadStand));
|
||||
this.AddSequence(0, this.AppendPoint, new FrameEvent(this.PerFrameSettings));
|
||||
}
|
||||
|
||||
private void PerFrameSettings(FrameEventData evt) => CombatText.clearAll();
|
||||
|
||||
private void CreateDryad(FrameEventData evt)
|
||||
{
|
||||
this._dryad = this.PlaceNPCOnGround(20, this._startPoint);
|
||||
this._dryad.knockBackResist = 0.0f;
|
||||
this._dryad.immortal = true;
|
||||
this._dryad.dontTakeDamage = true;
|
||||
this._dryad.takenDamageMultiplier = 0.0f;
|
||||
this._dryad.immune[(int) byte.MaxValue] = 100000;
|
||||
}
|
||||
|
||||
private void DryadInteract(FrameEventData evt)
|
||||
{
|
||||
if (this._dryad == null)
|
||||
return;
|
||||
this._dryad.ai[0] = 9f;
|
||||
if (evt.IsFirstFrame)
|
||||
this._dryad.ai[1] = (float) evt.Duration;
|
||||
this._dryad.localAI[0] = 0.0f;
|
||||
}
|
||||
|
||||
private void SpawnWitherBeast(FrameEventData evt)
|
||||
{
|
||||
int index = NPC.NewNPC((int) this._portal.Center.X, (int) this._portal.Bottom.Y, 568);
|
||||
NPC npc = Main.npc[index];
|
||||
npc.knockBackResist = 0.0f;
|
||||
npc.immortal = true;
|
||||
npc.dontTakeDamage = true;
|
||||
npc.takenDamageMultiplier = 0.0f;
|
||||
npc.immune[(int) byte.MaxValue] = 100000;
|
||||
npc.friendly = this._ogre.friendly;
|
||||
this._army.Add(npc);
|
||||
}
|
||||
|
||||
private void SpawnJavalinThrower(FrameEventData evt)
|
||||
{
|
||||
int index = NPC.NewNPC((int) this._portal.Center.X, (int) this._portal.Bottom.Y, 561);
|
||||
NPC npc = Main.npc[index];
|
||||
npc.knockBackResist = 0.0f;
|
||||
npc.immortal = true;
|
||||
npc.dontTakeDamage = true;
|
||||
npc.takenDamageMultiplier = 0.0f;
|
||||
npc.immune[(int) byte.MaxValue] = 100000;
|
||||
npc.friendly = this._ogre.friendly;
|
||||
this._army.Add(npc);
|
||||
}
|
||||
|
||||
private void SpawnGoblin(FrameEventData evt)
|
||||
{
|
||||
int index = NPC.NewNPC((int) this._portal.Center.X, (int) this._portal.Bottom.Y, 552);
|
||||
NPC npc = Main.npc[index];
|
||||
npc.knockBackResist = 0.0f;
|
||||
npc.immortal = true;
|
||||
npc.dontTakeDamage = true;
|
||||
npc.takenDamageMultiplier = 0.0f;
|
||||
npc.immune[(int) byte.MaxValue] = 100000;
|
||||
npc.friendly = this._ogre.friendly;
|
||||
this._army.Add(npc);
|
||||
}
|
||||
|
||||
private void CreateCritters(FrameEventData evt)
|
||||
{
|
||||
for (int index = 0; index < 5; ++index)
|
||||
{
|
||||
float num = (float) index / 5f;
|
||||
NPC npc = this.PlaceNPCOnGround((int) Utils.SelectRandom<short>(Main.rand, (short) 46, (short) 46, (short) 299, (short) 538), this._startPoint + new Vector2((float) (((double) num - 0.25) * 400.0 + (double) Main.rand.NextFloat() * 50.0 - 25.0), 0.0f));
|
||||
npc.ai[0] = 0.0f;
|
||||
npc.ai[1] = 600f;
|
||||
this._critters.Add(npc);
|
||||
}
|
||||
if (this._dryad == null)
|
||||
return;
|
||||
for (int index1 = 0; index1 < 10; ++index1)
|
||||
{
|
||||
double num = (double) index1 / 10.0;
|
||||
int index2 = NPC.NewNPC((int) this._dryad.position.X + Main.rand.Next(-1000, 800), (int) this._dryad.position.Y - Main.rand.Next(-50, 300), 356);
|
||||
NPC npc = Main.npc[index2];
|
||||
npc.ai[0] = (float) ((double) Main.rand.NextFloat() * 4.0 - 2.0);
|
||||
npc.ai[1] = (float) ((double) Main.rand.NextFloat() * 4.0 - 2.0);
|
||||
npc.velocity.X = (float) ((double) Main.rand.NextFloat() * 4.0 - 2.0);
|
||||
this._critters.Add(npc);
|
||||
}
|
||||
}
|
||||
|
||||
private void OgreSwingSound(FrameEventData evt) => SoundEngine.PlaySound(SoundID.DD2_OgreAttack, this._ogre.Center);
|
||||
|
||||
private void DryadPortalKnock(FrameEventData evt)
|
||||
{
|
||||
if (this._dryad != null)
|
||||
{
|
||||
if (evt.Frame == 20)
|
||||
{
|
||||
this._dryad.velocity.Y -= 7f;
|
||||
this._dryad.velocity.X -= 8f;
|
||||
SoundEngine.PlaySound(3, (int) this._dryad.Center.X, (int) this._dryad.Center.Y);
|
||||
}
|
||||
if (evt.Frame >= 20)
|
||||
{
|
||||
this._dryad.ai[0] = 1f;
|
||||
this._dryad.ai[1] = (float) evt.Remaining;
|
||||
this._dryad.rotation += 0.05f;
|
||||
}
|
||||
}
|
||||
if (this._ogre == null)
|
||||
return;
|
||||
if (evt.Frame > 40)
|
||||
{
|
||||
this._ogre.target = Main.myPlayer;
|
||||
this._ogre.direction = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
this._ogre.direction = -1;
|
||||
this._ogre.ai[1] = 0.0f;
|
||||
this._ogre.ai[0] = Math.Min(40f, this._ogre.ai[0]);
|
||||
this._ogre.target = 300 + this._dryad.whoAmI;
|
||||
}
|
||||
}
|
||||
|
||||
private void RemoveEnemyDamage(FrameEventData evt)
|
||||
{
|
||||
this._ogre.friendly = true;
|
||||
foreach (NPC npc in this._army)
|
||||
npc.friendly = true;
|
||||
}
|
||||
|
||||
private void RestoreEnemyDamage(FrameEventData evt)
|
||||
{
|
||||
this._ogre.friendly = false;
|
||||
foreach (NPC npc in this._army)
|
||||
npc.friendly = false;
|
||||
}
|
||||
|
||||
private void DryadPortalFade(FrameEventData evt)
|
||||
{
|
||||
if (this._dryad == null || this._portal == null)
|
||||
return;
|
||||
if (evt.IsFirstFrame)
|
||||
SoundEngine.PlaySound(SoundID.DD2_EtherianPortalDryadTouch, this._dryad.Center);
|
||||
float amount = Math.Max(0.0f, (float) (evt.Frame - 7) / (float) (evt.Duration - 7));
|
||||
this._dryad.color = new Color(Vector3.Lerp(Vector3.One, new Vector3(0.5f, 0.0f, 0.8f), amount));
|
||||
this._dryad.Opacity = 1f - amount;
|
||||
this._dryad.rotation += (float) (0.0500000007450581 * ((double) amount * 4.0 + 1.0));
|
||||
this._dryad.scale = 1f - amount;
|
||||
if ((double) this._dryad.position.X < (double) this._portal.Right.X)
|
||||
{
|
||||
this._dryad.velocity.X *= 0.95f;
|
||||
this._dryad.velocity.Y *= 0.55f;
|
||||
}
|
||||
int num1 = (int) (6.0 * (double) amount);
|
||||
float num2 = this._dryad.Size.Length() / 2f / 20f;
|
||||
for (int index = 0; index < num1; ++index)
|
||||
{
|
||||
if (Main.rand.Next(5) == 0)
|
||||
{
|
||||
Dust dust = Dust.NewDustDirect(this._dryad.position, this._dryad.width, this._dryad.height, 27, this._dryad.velocity.X * 1f, Alpha: 100);
|
||||
dust.scale = 0.55f;
|
||||
dust.fadeIn = 0.7f;
|
||||
dust.velocity *= 0.1f * num2;
|
||||
dust.velocity += this._dryad.velocity;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void CreatePortal(FrameEventData evt)
|
||||
{
|
||||
this._portal = this.PlaceNPCOnGround(549, this._startPoint + new Vector2(-240f, 0.0f));
|
||||
this._portal.immortal = true;
|
||||
}
|
||||
|
||||
private void DryadStand(FrameEventData evt)
|
||||
{
|
||||
if (this._dryad == null)
|
||||
return;
|
||||
this._dryad.ai[0] = 0.0f;
|
||||
this._dryad.ai[1] = (float) evt.Remaining;
|
||||
}
|
||||
|
||||
private void DryadLookRight(FrameEventData evt)
|
||||
{
|
||||
if (this._dryad == null)
|
||||
return;
|
||||
this._dryad.direction = 1;
|
||||
this._dryad.spriteDirection = 1;
|
||||
}
|
||||
|
||||
private void DryadLookLeft(FrameEventData evt)
|
||||
{
|
||||
if (this._dryad == null)
|
||||
return;
|
||||
this._dryad.direction = -1;
|
||||
this._dryad.spriteDirection = -1;
|
||||
}
|
||||
|
||||
private void DryadWalk(FrameEventData evt)
|
||||
{
|
||||
this._dryad.ai[0] = 1f;
|
||||
this._dryad.ai[1] = 2f;
|
||||
}
|
||||
|
||||
private void DryadConfusedEmote(FrameEventData evt)
|
||||
{
|
||||
if (this._dryad == null || !evt.IsFirstFrame)
|
||||
return;
|
||||
EmoteBubble.NewBubble(87, new WorldUIAnchor((Entity) this._dryad), evt.Duration);
|
||||
}
|
||||
|
||||
private void DryadAlertEmote(FrameEventData evt)
|
||||
{
|
||||
if (this._dryad == null || !evt.IsFirstFrame)
|
||||
return;
|
||||
EmoteBubble.NewBubble(3, new WorldUIAnchor((Entity) this._dryad), evt.Duration);
|
||||
}
|
||||
|
||||
private void CreateOgre(FrameEventData evt)
|
||||
{
|
||||
int index = NPC.NewNPC((int) this._portal.Center.X, (int) this._portal.Bottom.Y, 576);
|
||||
this._ogre = Main.npc[index];
|
||||
this._ogre.knockBackResist = 0.0f;
|
||||
this._ogre.immortal = true;
|
||||
this._ogre.dontTakeDamage = true;
|
||||
this._ogre.takenDamageMultiplier = 0.0f;
|
||||
this._ogre.immune[(int) byte.MaxValue] = 100000;
|
||||
}
|
||||
|
||||
private void OgreStand(FrameEventData evt)
|
||||
{
|
||||
if (this._ogre == null)
|
||||
return;
|
||||
this._ogre.ai[0] = 0.0f;
|
||||
this._ogre.ai[1] = 0.0f;
|
||||
this._ogre.velocity = Vector2.Zero;
|
||||
}
|
||||
|
||||
private void DryadAttack(FrameEventData evt)
|
||||
{
|
||||
if (this._dryad == null)
|
||||
return;
|
||||
this._dryad.ai[0] = 14f;
|
||||
this._dryad.ai[1] = (float) evt.Remaining;
|
||||
this._dryad.dryadWard = false;
|
||||
}
|
||||
|
||||
private void OgreLookRight(FrameEventData evt)
|
||||
{
|
||||
if (this._ogre == null)
|
||||
return;
|
||||
this._ogre.direction = 1;
|
||||
this._ogre.spriteDirection = 1;
|
||||
}
|
||||
|
||||
private void OgreLookLeft(FrameEventData evt)
|
||||
{
|
||||
if (this._ogre == null)
|
||||
return;
|
||||
this._ogre.direction = -1;
|
||||
this._ogre.spriteDirection = -1;
|
||||
}
|
||||
|
||||
public override void OnBegin()
|
||||
{
|
||||
Main.NewText("DD2Film: Begin");
|
||||
Main.dayTime = true;
|
||||
Main.time = 27000.0;
|
||||
this._startPoint = Main.screenPosition + new Vector2((float) Main.mouseX, (float) Main.mouseY - 32f);
|
||||
base.OnBegin();
|
||||
}
|
||||
|
||||
private NPC PlaceNPCOnGround(int type, Vector2 position)
|
||||
{
|
||||
int x = (int) position.X;
|
||||
int y = (int) position.Y;
|
||||
int i = x / 16;
|
||||
int j = y / 16;
|
||||
while (!WorldGen.SolidTile(i, j))
|
||||
++j;
|
||||
int Y = j * 16;
|
||||
int Start = 100;
|
||||
switch (type)
|
||||
{
|
||||
case 20:
|
||||
Start = 1;
|
||||
break;
|
||||
case 576:
|
||||
Start = 50;
|
||||
break;
|
||||
}
|
||||
int index = NPC.NewNPC(x, Y, type, Start);
|
||||
return Main.npc[index];
|
||||
}
|
||||
|
||||
public override void OnEnd()
|
||||
{
|
||||
if (this._dryad != null)
|
||||
this._dryad.active = false;
|
||||
if (this._portal != null)
|
||||
this._portal.active = false;
|
||||
if (this._ogre != null)
|
||||
this._ogre.active = false;
|
||||
foreach (Entity critter in this._critters)
|
||||
critter.active = false;
|
||||
foreach (Entity entity in this._army)
|
||||
entity.active = false;
|
||||
Main.NewText("DD2Film: End");
|
||||
base.OnEnd();
|
||||
}
|
||||
}
|
||||
}
|
120
Cinematics/Film.cs
Normal file
120
Cinematics/Film.cs
Normal file
|
@ -0,0 +1,120 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Cinematics.Film
|
||||
// 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;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Terraria.Cinematics
|
||||
{
|
||||
public class Film
|
||||
{
|
||||
private int _frame;
|
||||
private int _frameCount;
|
||||
private int _nextSequenceAppendTime;
|
||||
private bool _isActive;
|
||||
private List<Film.Sequence> _sequences = new List<Film.Sequence>();
|
||||
|
||||
public int Frame => this._frame;
|
||||
|
||||
public int FrameCount => this._frameCount;
|
||||
|
||||
public int AppendPoint => this._nextSequenceAppendTime;
|
||||
|
||||
public bool IsActive => this._isActive;
|
||||
|
||||
public void AddSequence(int start, int duration, FrameEvent frameEvent)
|
||||
{
|
||||
this._sequences.Add(new Film.Sequence(frameEvent, start, duration));
|
||||
this._nextSequenceAppendTime = Math.Max(this._nextSequenceAppendTime, start + duration);
|
||||
this._frameCount = Math.Max(this._frameCount, start + duration);
|
||||
}
|
||||
|
||||
public void AppendSequence(int duration, FrameEvent frameEvent) => this.AddSequence(this._nextSequenceAppendTime, duration, frameEvent);
|
||||
|
||||
public void AddSequences(int start, int duration, params FrameEvent[] frameEvents)
|
||||
{
|
||||
foreach (FrameEvent frameEvent in frameEvents)
|
||||
this.AddSequence(start, duration, frameEvent);
|
||||
}
|
||||
|
||||
public void AppendSequences(int duration, params FrameEvent[] frameEvents)
|
||||
{
|
||||
int sequenceAppendTime = this._nextSequenceAppendTime;
|
||||
foreach (FrameEvent frameEvent in frameEvents)
|
||||
{
|
||||
this._sequences.Add(new Film.Sequence(frameEvent, sequenceAppendTime, duration));
|
||||
this._nextSequenceAppendTime = Math.Max(this._nextSequenceAppendTime, sequenceAppendTime + duration);
|
||||
this._frameCount = Math.Max(this._frameCount, sequenceAppendTime + duration);
|
||||
}
|
||||
}
|
||||
|
||||
public void AppendEmptySequence(int duration) => this.AddSequence(this._nextSequenceAppendTime, duration, new FrameEvent(Film.EmptyFrameEvent));
|
||||
|
||||
public void AppendKeyFrame(FrameEvent frameEvent) => this.AddKeyFrame(this._nextSequenceAppendTime, frameEvent);
|
||||
|
||||
public void AppendKeyFrames(params FrameEvent[] frameEvents)
|
||||
{
|
||||
int sequenceAppendTime = this._nextSequenceAppendTime;
|
||||
foreach (FrameEvent frameEvent in frameEvents)
|
||||
this._sequences.Add(new Film.Sequence(frameEvent, sequenceAppendTime, 1));
|
||||
this._frameCount = Math.Max(this._frameCount, sequenceAppendTime + 1);
|
||||
}
|
||||
|
||||
public void AddKeyFrame(int frame, FrameEvent frameEvent)
|
||||
{
|
||||
this._sequences.Add(new Film.Sequence(frameEvent, frame, 1));
|
||||
this._frameCount = Math.Max(this._frameCount, frame + 1);
|
||||
}
|
||||
|
||||
public void AddKeyFrames(int frame, params FrameEvent[] frameEvents)
|
||||
{
|
||||
foreach (FrameEvent frameEvent in frameEvents)
|
||||
this.AddKeyFrame(frame, frameEvent);
|
||||
}
|
||||
|
||||
public bool OnUpdate(GameTime gameTime)
|
||||
{
|
||||
if (this._sequences.Count == 0)
|
||||
return false;
|
||||
foreach (Film.Sequence sequence in this._sequences)
|
||||
{
|
||||
int num = this._frame - sequence.Start;
|
||||
if (num >= 0 && num < sequence.Duration)
|
||||
sequence.Event(new FrameEventData(this._frame, sequence.Start, sequence.Duration));
|
||||
}
|
||||
return ++this._frame != this._frameCount;
|
||||
}
|
||||
|
||||
public virtual void OnBegin() => this._isActive = true;
|
||||
|
||||
public virtual void OnEnd() => this._isActive = false;
|
||||
|
||||
private static void EmptyFrameEvent(FrameEventData evt)
|
||||
{
|
||||
}
|
||||
|
||||
private class Sequence
|
||||
{
|
||||
private FrameEvent _frameEvent;
|
||||
private int _duration;
|
||||
private int _start;
|
||||
|
||||
public FrameEvent Event => this._frameEvent;
|
||||
|
||||
public int Duration => this._duration;
|
||||
|
||||
public int Start => this._start;
|
||||
|
||||
public Sequence(FrameEvent frameEvent, int start, int duration)
|
||||
{
|
||||
this._frameEvent = frameEvent;
|
||||
this._start = start;
|
||||
this._duration = duration;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
10
Cinematics/FrameEvent.cs
Normal file
10
Cinematics/FrameEvent.cs
Normal file
|
@ -0,0 +1,10 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Cinematics.FrameEvent
|
||||
// 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.Cinematics
|
||||
{
|
||||
public delegate void FrameEvent(FrameEventData evt);
|
||||
}
|
36
Cinematics/FrameEventData.cs
Normal file
36
Cinematics/FrameEventData.cs
Normal file
|
@ -0,0 +1,36 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Cinematics.FrameEventData
|
||||
// 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.Cinematics
|
||||
{
|
||||
public struct FrameEventData
|
||||
{
|
||||
private int _absoluteFrame;
|
||||
private int _start;
|
||||
private int _duration;
|
||||
|
||||
public int AbsoluteFrame => this._absoluteFrame;
|
||||
|
||||
public int Start => this._start;
|
||||
|
||||
public int Duration => this._duration;
|
||||
|
||||
public int Frame => this._absoluteFrame - this._start;
|
||||
|
||||
public bool IsFirstFrame => this._start == this._absoluteFrame;
|
||||
|
||||
public bool IsLastFrame => this.Remaining == 0;
|
||||
|
||||
public int Remaining => this._start + this._duration - this._absoluteFrame - 1;
|
||||
|
||||
public FrameEventData(int absoluteFrame, int start, int duration)
|
||||
{
|
||||
this._absoluteFrame = absoluteFrame;
|
||||
this._start = start;
|
||||
this._duration = duration;
|
||||
}
|
||||
}
|
||||
}
|
295
Cloud.cs
Normal file
295
Cloud.cs
Normal file
|
@ -0,0 +1,295 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Cloud
|
||||
// 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 Terraria.GameContent;
|
||||
using Terraria.Utilities;
|
||||
|
||||
namespace Terraria
|
||||
{
|
||||
public class Cloud
|
||||
{
|
||||
public Vector2 position;
|
||||
public float scale;
|
||||
public float rotation;
|
||||
public float rSpeed;
|
||||
public float sSpeed;
|
||||
public bool active;
|
||||
public SpriteEffects spriteDir;
|
||||
public int type;
|
||||
public int width;
|
||||
public int height;
|
||||
public float Alpha;
|
||||
public bool kill;
|
||||
private static UnifiedRandom rand = new UnifiedRandom();
|
||||
|
||||
public static void resetClouds()
|
||||
{
|
||||
if (Main.dedServ)
|
||||
return;
|
||||
Main.windSpeedCurrent = Main.windSpeedTarget;
|
||||
for (int index = 0; index < 200; ++index)
|
||||
Main.cloud[index].active = false;
|
||||
for (int index = 0; index < Main.numClouds; ++index)
|
||||
{
|
||||
Cloud.addCloud();
|
||||
Main.cloud[index].Alpha = 1f;
|
||||
}
|
||||
for (int index = 0; index < 200; ++index)
|
||||
Main.cloud[index].Alpha = 1f;
|
||||
}
|
||||
|
||||
public static void addCloud()
|
||||
{
|
||||
if (Main.netMode == 2)
|
||||
return;
|
||||
int index1 = -1;
|
||||
for (int index2 = 0; index2 < 200; ++index2)
|
||||
{
|
||||
if (!Main.cloud[index2].active)
|
||||
{
|
||||
index1 = index2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (index1 < 0)
|
||||
return;
|
||||
Main.cloud[index1].kill = false;
|
||||
Main.cloud[index1].rSpeed = 0.0f;
|
||||
Main.cloud[index1].sSpeed = 0.0f;
|
||||
Main.cloud[index1].scale = (float) Cloud.rand.Next(70, 131) * 0.01f;
|
||||
Main.cloud[index1].rotation = (float) Cloud.rand.Next(-10, 11) * 0.01f;
|
||||
Main.cloud[index1].width = (int) ((double) TextureAssets.Cloud[Main.cloud[index1].type].Width() * (double) Main.cloud[index1].scale);
|
||||
Main.cloud[index1].height = (int) ((double) TextureAssets.Cloud[Main.cloud[index1].type].Height() * (double) Main.cloud[index1].scale);
|
||||
Main.cloud[index1].Alpha = 0.0f;
|
||||
Main.cloud[index1].spriteDir = SpriteEffects.None;
|
||||
if (Cloud.rand.Next(2) == 0)
|
||||
Main.cloud[index1].spriteDir = SpriteEffects.FlipHorizontally;
|
||||
float num1 = Main.windSpeedCurrent;
|
||||
if (!Main.gameMenu)
|
||||
num1 = Main.windSpeedCurrent - Main.player[Main.myPlayer].velocity.X * 0.1f;
|
||||
int num2 = 0;
|
||||
int num3 = 0;
|
||||
if ((double) num1 > 0.0)
|
||||
num2 -= 200;
|
||||
if ((double) num1 < 0.0)
|
||||
num3 += 200;
|
||||
int num4 = 300;
|
||||
float num5 = (float) WorldGen.genRand.Next(num2 - num4, Main.screenWidth + num3 + num4);
|
||||
Main.cloud[index1].Alpha = 0.0f;
|
||||
Main.cloud[index1].position.Y = (float) Cloud.rand.Next((int) ((double) -Main.screenHeight * 0.25), (int) ((double) Main.screenHeight * 0.150000005960464));
|
||||
if (Main.rand.Next(3) == 0)
|
||||
Main.cloud[index1].position.Y -= (float) Cloud.rand.Next((int) ((double) Main.screenHeight * 0.100000001490116));
|
||||
Main.cloud[index1].type = Cloud.rand.Next(4);
|
||||
if ((double) Main.cloudAlpha > 0.0 && Cloud.rand.Next(4) != 0 || (double) Main.cloudBGActive >= 1.0 && Cloud.rand.Next(2) == 0)
|
||||
{
|
||||
Main.cloud[index1].type = Cloud.rand.Next(18, 22);
|
||||
if ((double) Main.cloud[index1].scale >= 1.15)
|
||||
Main.cloud[index1].position.Y -= 150f;
|
||||
if ((double) Main.cloud[index1].scale >= 1.0)
|
||||
Main.cloud[index1].position.Y -= 150f;
|
||||
}
|
||||
else if ((double) Main.cloudBGActive <= 0.0 && (double) Main.cloudAlpha == 0.0 && (double) Main.cloud[index1].scale < 1.0 && (double) Main.cloud[index1].position.Y < (double) -Main.screenHeight * 0.150000005960464 && (double) Main.numClouds <= 80.0)
|
||||
Main.cloud[index1].type = Cloud.rand.Next(9, 14);
|
||||
else if (((double) Main.cloud[index1].scale < 1.15 && (double) Main.cloud[index1].position.Y < (double) -Main.screenHeight * 0.300000011920929 || (double) Main.cloud[index1].scale < 0.85 && (double) Main.cloud[index1].position.Y < (double) Main.screenHeight * 0.150000005960464) && ((double) Main.numClouds > 70.0 || (double) Main.cloudBGActive >= 1.0))
|
||||
Main.cloud[index1].type = Cloud.rand.Next(4, 9);
|
||||
else if ((double) Main.cloud[index1].position.Y > (double) -Main.screenHeight * 0.150000005960464 && Cloud.rand.Next(2) == 0 && (double) Main.numClouds > 20.0)
|
||||
Main.cloud[index1].type = Cloud.rand.Next(14, 18);
|
||||
if (Cloud.rand.Next(150) == 0)
|
||||
Main.cloud[index1].type = Cloud.RollRareCloud();
|
||||
if ((double) Main.cloud[index1].scale > 1.2)
|
||||
Main.cloud[index1].position.Y += 100f;
|
||||
if ((double) Main.cloud[index1].scale > 1.3)
|
||||
Main.cloud[index1].scale = 1.3f;
|
||||
if ((double) Main.cloud[index1].scale < 0.7)
|
||||
Main.cloud[index1].scale = 0.7f;
|
||||
Main.cloud[index1].active = true;
|
||||
Main.cloud[index1].position.X = num5;
|
||||
if ((double) Main.cloud[index1].position.X > (double) (Main.screenWidth + 400))
|
||||
Main.cloud[index1].Alpha = 1f;
|
||||
if ((double) Main.cloud[index1].position.X + (double) TextureAssets.Cloud[Main.cloud[index1].type].Width() * (double) Main.cloud[index1].scale < -400.0)
|
||||
Main.cloud[index1].Alpha = 1f;
|
||||
Rectangle rectangle1 = new Rectangle((int) Main.cloud[index1].position.X, (int) Main.cloud[index1].position.Y, Main.cloud[index1].width, Main.cloud[index1].height);
|
||||
for (int index3 = 0; index3 < 200; ++index3)
|
||||
{
|
||||
if (index1 != index3 && Main.cloud[index3].active)
|
||||
{
|
||||
Rectangle rectangle2 = new Rectangle((int) Main.cloud[index3].position.X, (int) Main.cloud[index3].position.Y, Main.cloud[index3].width, Main.cloud[index3].height);
|
||||
if (rectangle1.Intersects(rectangle2))
|
||||
Main.cloud[index1].active = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static int RollRareCloud()
|
||||
{
|
||||
int num = -1;
|
||||
bool flag = false;
|
||||
while (!flag)
|
||||
{
|
||||
num = Cloud.rand.Next(22, 37);
|
||||
switch (num)
|
||||
{
|
||||
case 25:
|
||||
case 26:
|
||||
flag = NPC.downedBoss1;
|
||||
continue;
|
||||
case 28:
|
||||
if (Main.rand.Next(10) == 0)
|
||||
{
|
||||
flag = true;
|
||||
continue;
|
||||
}
|
||||
continue;
|
||||
case 30:
|
||||
case 35:
|
||||
flag = Main.hardMode;
|
||||
continue;
|
||||
case 31:
|
||||
flag = NPC.downedBoss3;
|
||||
continue;
|
||||
case 36:
|
||||
flag = NPC.downedBoss2 && WorldGen.crimson;
|
||||
continue;
|
||||
default:
|
||||
flag = true;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
public Color cloudColor(Color bgColor)
|
||||
{
|
||||
float num = this.scale * this.Alpha;
|
||||
if ((double) num > 1.0)
|
||||
num = 1f;
|
||||
return new Color((int) (byte) (float) (int) ((double) bgColor.R * (double) num), (int) (byte) (float) (int) ((double) bgColor.G * (double) num), (int) (byte) (float) (int) ((double) bgColor.B * (double) num), (int) (byte) (float) (int) ((double) bgColor.A * (double) num));
|
||||
}
|
||||
|
||||
public object Clone() => this.MemberwiseClone();
|
||||
|
||||
public static void UpdateClouds()
|
||||
{
|
||||
if (Main.netMode == 2)
|
||||
return;
|
||||
int maxValue = 0;
|
||||
for (int index = 0; index < 200; ++index)
|
||||
{
|
||||
if (Main.cloud[index].active)
|
||||
{
|
||||
Main.cloud[index].Update();
|
||||
if (!Main.cloud[index].kill)
|
||||
++maxValue;
|
||||
}
|
||||
}
|
||||
for (int index = 0; index < 200; ++index)
|
||||
{
|
||||
if (Main.cloud[index].active)
|
||||
{
|
||||
if (index > 1 && (!Main.cloud[index - 1].active || (double) Main.cloud[index - 1].scale > (double) Main.cloud[index].scale + 0.02))
|
||||
{
|
||||
Cloud cloud = (Cloud) Main.cloud[index - 1].Clone();
|
||||
Main.cloud[index - 1] = (Cloud) Main.cloud[index].Clone();
|
||||
Main.cloud[index] = cloud;
|
||||
}
|
||||
if (index < 199 && (!Main.cloud[index].active || (double) Main.cloud[index + 1].scale < (double) Main.cloud[index].scale - 0.02))
|
||||
{
|
||||
Cloud cloud = (Cloud) Main.cloud[index + 1].Clone();
|
||||
Main.cloud[index + 1] = (Cloud) Main.cloud[index].Clone();
|
||||
Main.cloud[index] = cloud;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (maxValue < Main.numClouds)
|
||||
{
|
||||
Cloud.addCloud();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (maxValue <= Main.numClouds)
|
||||
return;
|
||||
int index1 = Cloud.rand.Next(maxValue);
|
||||
for (int index2 = 0; Main.cloud[index1].kill && index2 < 100; index1 = Cloud.rand.Next(maxValue))
|
||||
++index2;
|
||||
Main.cloud[index1].kill = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
if (WorldGen.drunkWorldGenText && Main.gameMenu)
|
||||
this.type = 28;
|
||||
if ((double) this.scale == 1.0)
|
||||
this.scale -= 0.0001f;
|
||||
if ((double) this.scale == 1.15)
|
||||
this.scale -= 0.0001f;
|
||||
float num1;
|
||||
if ((double) this.scale < 1.0)
|
||||
{
|
||||
float num2 = 0.07f;
|
||||
float num3 = (float) (((double) (this.scale + 0.15f) + 1.0) / 2.0);
|
||||
float num4 = num3 * num3;
|
||||
num1 = num2 * num4;
|
||||
}
|
||||
else if ((double) this.scale <= 1.15)
|
||||
{
|
||||
float num5 = 0.19f;
|
||||
float num6 = this.scale - 0.075f;
|
||||
float num7 = num6 * num6;
|
||||
num1 = num5 * num7;
|
||||
}
|
||||
else
|
||||
{
|
||||
float num8 = 0.23f;
|
||||
float num9 = (float) ((double) this.scale - 0.150000005960464 - 0.0750000029802322);
|
||||
float num10 = num9 * num9;
|
||||
num1 = num8 * num10;
|
||||
}
|
||||
this.position.X += Main.windSpeedCurrent * 9f * num1 * (float) Main.dayRate;
|
||||
this.position.X -= (Main.screenPosition.X - Main.screenLastPosition.X) * num1;
|
||||
float num11 = 600f;
|
||||
if ((double) Main.bgAlphaFrontLayer[4] == 1.0 && (double) this.position.Y > 200.0)
|
||||
{
|
||||
this.kill = true;
|
||||
this.Alpha -= 0.005f * (float) Main.dayRate;
|
||||
}
|
||||
if (!this.kill)
|
||||
{
|
||||
if ((double) this.Alpha < 1.0)
|
||||
{
|
||||
this.Alpha += 1f / 1000f * (float) Main.dayRate;
|
||||
if ((double) this.Alpha > 1.0)
|
||||
this.Alpha = 1f;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.Alpha -= 1f / 1000f * (float) Main.dayRate;
|
||||
if ((double) this.Alpha <= 0.0)
|
||||
this.active = false;
|
||||
}
|
||||
if ((double) this.position.X + (double) TextureAssets.Cloud[this.type].Width() * (double) this.scale < -(double) num11 || (double) this.position.X > (double) Main.screenWidth + (double) num11)
|
||||
this.active = false;
|
||||
this.rSpeed += (float) Cloud.rand.Next(-10, 11) * 2E-05f;
|
||||
if ((double) this.rSpeed > 0.0002)
|
||||
this.rSpeed = 0.0002f;
|
||||
if ((double) this.rSpeed < -0.0002)
|
||||
this.rSpeed = -0.0002f;
|
||||
if ((double) this.rotation > 0.02)
|
||||
this.rotation = 0.02f;
|
||||
if ((double) this.rotation < -0.02)
|
||||
this.rotation = -0.02f;
|
||||
this.rotation += this.rSpeed;
|
||||
this.width = (int) ((double) TextureAssets.Cloud[this.type].Width() * (double) this.scale);
|
||||
this.height = (int) ((double) TextureAssets.Cloud[this.type].Height() * (double) this.scale);
|
||||
if (this.type < 9 || this.type > 13 || (double) Main.cloudAlpha <= 0.0 && (double) Main.cloudBGActive < 1.0)
|
||||
return;
|
||||
this.kill = true;
|
||||
}
|
||||
}
|
||||
}
|
2977
Collision.cs
Normal file
2977
Collision.cs
Normal file
File diff suppressed because it is too large
Load diff
186
CombatText.cs
Normal file
186
CombatText.cs
Normal file
|
@ -0,0 +1,186 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.CombatText
|
||||
// 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.GameContent;
|
||||
|
||||
namespace Terraria
|
||||
{
|
||||
public class CombatText
|
||||
{
|
||||
public static readonly Color DamagedFriendly = new Color((int) byte.MaxValue, 80, 90, (int) byte.MaxValue);
|
||||
public static readonly Color DamagedFriendlyCrit = new Color((int) byte.MaxValue, 100, 30, (int) byte.MaxValue);
|
||||
public static readonly Color DamagedHostile = new Color((int) byte.MaxValue, 160, 80, (int) byte.MaxValue);
|
||||
public static readonly Color DamagedHostileCrit = new Color((int) byte.MaxValue, 100, 30, (int) byte.MaxValue);
|
||||
public static readonly Color OthersDamagedHostile = CombatText.DamagedHostile * 0.4f;
|
||||
public static readonly Color OthersDamagedHostileCrit = CombatText.DamagedHostileCrit * 0.4f;
|
||||
public static readonly Color HealLife = new Color(100, (int) byte.MaxValue, 100, (int) byte.MaxValue);
|
||||
public static readonly Color HealMana = new Color(100, 100, (int) byte.MaxValue, (int) byte.MaxValue);
|
||||
public static readonly Color LifeRegen = new Color((int) byte.MaxValue, 60, 70, (int) byte.MaxValue);
|
||||
public static readonly Color LifeRegenNegative = new Color((int) byte.MaxValue, 140, 40, (int) byte.MaxValue);
|
||||
public Vector2 position;
|
||||
public Vector2 velocity;
|
||||
public float alpha;
|
||||
public int alphaDir = 1;
|
||||
public string text = "";
|
||||
public float scale = 1f;
|
||||
public float rotation;
|
||||
public Color color;
|
||||
public bool active;
|
||||
public int lifeTime;
|
||||
public bool crit;
|
||||
public bool dot;
|
||||
|
||||
public static int NewText(
|
||||
Rectangle location,
|
||||
Color color,
|
||||
int amount,
|
||||
bool dramatic = false,
|
||||
bool dot = false)
|
||||
{
|
||||
return CombatText.NewText(location, color, amount.ToString(), dramatic, dot);
|
||||
}
|
||||
|
||||
public static int NewText(
|
||||
Rectangle location,
|
||||
Color color,
|
||||
string text,
|
||||
bool dramatic = false,
|
||||
bool dot = false)
|
||||
{
|
||||
if (Main.netMode == 2)
|
||||
return 100;
|
||||
for (int index1 = 0; index1 < 100; ++index1)
|
||||
{
|
||||
if (!Main.combatText[index1].active)
|
||||
{
|
||||
int index2 = 0;
|
||||
if (dramatic)
|
||||
index2 = 1;
|
||||
Vector2 vector2 = FontAssets.CombatText[index2].Value.MeasureString(text);
|
||||
Main.combatText[index1].alpha = 1f;
|
||||
Main.combatText[index1].alphaDir = -1;
|
||||
Main.combatText[index1].active = true;
|
||||
Main.combatText[index1].scale = 0.0f;
|
||||
Main.combatText[index1].rotation = 0.0f;
|
||||
Main.combatText[index1].position.X = (float) ((double) location.X + (double) location.Width * 0.5 - (double) vector2.X * 0.5);
|
||||
Main.combatText[index1].position.Y = (float) ((double) location.Y + (double) location.Height * 0.25 - (double) vector2.Y * 0.5);
|
||||
Main.combatText[index1].position.X += (float) Main.rand.Next(-(int) ((double) location.Width * 0.5), (int) ((double) location.Width * 0.5) + 1);
|
||||
Main.combatText[index1].position.Y += (float) Main.rand.Next(-(int) ((double) location.Height * 0.5), (int) ((double) location.Height * 0.5) + 1);
|
||||
Main.combatText[index1].color = color;
|
||||
Main.combatText[index1].text = text;
|
||||
Main.combatText[index1].velocity.Y = -7f;
|
||||
if ((double) Main.player[Main.myPlayer].gravDir == -1.0)
|
||||
{
|
||||
Main.combatText[index1].velocity.Y *= -1f;
|
||||
Main.combatText[index1].position.Y = (float) ((double) location.Y + (double) location.Height * 0.75 + (double) vector2.Y * 0.5);
|
||||
}
|
||||
Main.combatText[index1].lifeTime = 60;
|
||||
Main.combatText[index1].crit = dramatic;
|
||||
Main.combatText[index1].dot = dot;
|
||||
if (dramatic)
|
||||
{
|
||||
Main.combatText[index1].text = text;
|
||||
Main.combatText[index1].lifeTime *= 2;
|
||||
Main.combatText[index1].velocity.Y *= 2f;
|
||||
Main.combatText[index1].velocity.X = (float) Main.rand.Next(-25, 26) * 0.05f;
|
||||
Main.combatText[index1].rotation = (float) (Main.combatText[index1].lifeTime / 2) * (1f / 500f);
|
||||
if ((double) Main.combatText[index1].velocity.X < 0.0)
|
||||
Main.combatText[index1].rotation *= -1f;
|
||||
}
|
||||
if (dot)
|
||||
{
|
||||
Main.combatText[index1].velocity.Y = -4f;
|
||||
Main.combatText[index1].lifeTime = 40;
|
||||
}
|
||||
return index1;
|
||||
}
|
||||
}
|
||||
return 100;
|
||||
}
|
||||
|
||||
public static void clearAll()
|
||||
{
|
||||
for (int index = 0; index < 100; ++index)
|
||||
Main.combatText[index].active = false;
|
||||
}
|
||||
|
||||
public static float TargetScale => 1f;
|
||||
|
||||
public void Update()
|
||||
{
|
||||
if (!this.active)
|
||||
return;
|
||||
float targetScale = CombatText.TargetScale;
|
||||
this.alpha += (float) this.alphaDir * 0.05f;
|
||||
if ((double) this.alpha <= 0.6)
|
||||
this.alphaDir = 1;
|
||||
if ((double) this.alpha >= 1.0)
|
||||
{
|
||||
this.alpha = 1f;
|
||||
this.alphaDir = -1;
|
||||
}
|
||||
if (this.dot)
|
||||
{
|
||||
this.velocity.Y += 0.15f;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.velocity.Y *= 0.92f;
|
||||
if (this.crit)
|
||||
this.velocity.Y *= 0.92f;
|
||||
}
|
||||
this.velocity.X *= 0.93f;
|
||||
this.position += this.velocity;
|
||||
--this.lifeTime;
|
||||
if (this.lifeTime <= 0)
|
||||
{
|
||||
this.scale -= 0.1f * targetScale;
|
||||
if ((double) this.scale < 0.1)
|
||||
this.active = false;
|
||||
this.lifeTime = 0;
|
||||
if (!this.crit)
|
||||
return;
|
||||
this.alphaDir = -1;
|
||||
this.scale += 0.07f * targetScale;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (this.crit)
|
||||
{
|
||||
if ((double) this.velocity.X < 0.0)
|
||||
this.rotation += 1f / 1000f;
|
||||
else
|
||||
this.rotation -= 1f / 1000f;
|
||||
}
|
||||
if (this.dot)
|
||||
{
|
||||
this.scale += 0.5f * targetScale;
|
||||
if ((double) this.scale <= 0.8 * (double) targetScale)
|
||||
return;
|
||||
this.scale = 0.8f * targetScale;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((double) this.scale < (double) targetScale)
|
||||
this.scale += 0.1f * targetScale;
|
||||
if ((double) this.scale <= (double) targetScale)
|
||||
return;
|
||||
this.scale = targetScale;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void UpdateCombatText()
|
||||
{
|
||||
for (int index = 0; index < 100; ++index)
|
||||
{
|
||||
if (Main.combatText[index].active)
|
||||
Main.combatText[index].Update();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
33
DataStructures/AnchorData.cs
Normal file
33
DataStructures/AnchorData.cs
Normal 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;
|
||||
}
|
||||
}
|
72
DataStructures/AnchoredEntitiesCollection.cs
Normal file
72
DataStructures/AnchoredEntitiesCollection.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
49
DataStructures/BinaryWriterHelper.cs
Normal file
49
DataStructures/BinaryWriterHelper.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
74
DataStructures/BufferPool.cs
Normal file
74
DataStructures/BufferPool.cs
Normal 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("");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
46
DataStructures/CachedBuffer.cs
Normal file
46
DataStructures/CachedBuffer.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
50
DataStructures/ColorSlidersSet.cs
Normal file
50
DataStructures/ColorSlidersSet.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
19
DataStructures/CompositePlayerDrawContext.cs
Normal file
19
DataStructures/CompositePlayerDrawContext.cs
Normal 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,
|
||||
}
|
||||
}
|
149
DataStructures/DoubleStack`1.cs
Normal file
149
DataStructures/DoubleStack`1.cs
Normal 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;
|
||||
}
|
||||
}
|
25
DataStructures/DrawAnimation.cs
Normal file
25
DataStructures/DrawAnimation.cs
Normal 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();
|
||||
}
|
||||
}
|
71
DataStructures/DrawAnimationVertical.cs
Normal file
71
DataStructures/DrawAnimationVertical.cs
Normal 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
178
DataStructures/DrawData.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
22
DataStructures/DrillDebugDraw.cs
Normal file
22
DataStructures/DrillDebugDraw.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
32
DataStructures/EntityShadowInfo.cs
Normal file
32
DataStructures/EntityShadowInfo.cs
Normal 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];
|
||||
}
|
||||
}
|
81
DataStructures/EntryFilterer`2.cs
Normal file
81
DataStructures/EntryFilterer`2.cs
Normal 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
|
||||
});
|
||||
}
|
||||
}
|
46
DataStructures/EntrySorter`2.cs
Normal file
46
DataStructures/EntrySorter`2.cs
Normal 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());
|
||||
}
|
||||
}
|
35
DataStructures/FishingAttempt.cs
Normal file
35
DataStructures/FishingAttempt.cs
Normal 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;
|
||||
}
|
||||
}
|
18
DataStructures/FlowerPacketInfo.cs
Normal file
18
DataStructures/FlowerPacketInfo.cs
Normal 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>();
|
||||
}
|
||||
}
|
82
DataStructures/GameModeData.cs
Normal file
82
DataStructures/GameModeData.cs
Normal 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; }
|
||||
}
|
||||
}
|
19
DataStructures/IEntryFilter`1.cs
Normal file
19
DataStructures/IEntryFilter`1.cs
Normal 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();
|
||||
}
|
||||
}
|
15
DataStructures/IEntrySortStep`1.cs
Normal file
15
DataStructures/IEntrySortStep`1.cs
Normal 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();
|
||||
}
|
||||
}
|
13
DataStructures/ISearchFilter`1.cs
Normal file
13
DataStructures/ISearchFilter`1.cs
Normal 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);
|
||||
}
|
||||
}
|
29
DataStructures/ItemSyncPersistentStats.cs
Normal file
29
DataStructures/ItemSyncPersistentStats.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
22
DataStructures/LineSegment.cs
Normal file
22
DataStructures/LineSegment.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
46
DataStructures/MethodSequenceListItem.cs
Normal file
46
DataStructures/MethodSequenceListItem.cs
Normal 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;
|
||||
}
|
||||
}
|
56
DataStructures/NPCAimedTarget.cs
Normal file
56
DataStructures/NPCAimedTarget.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
24
DataStructures/NPCStrengthHelper.cs
Normal file
24
DataStructures/NPCStrengthHelper.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
40
DataStructures/PlacementHook.cs
Normal file
40
DataStructures/PlacementHook.cs
Normal 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();
|
||||
}
|
||||
}
|
131
DataStructures/PlayerDeathReason.cs
Normal file
131
DataStructures/PlayerDeathReason.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
310
DataStructures/PlayerDrawHeadLayers.cs
Normal file
310
DataStructures/PlayerDrawHeadLayers.cs
Normal 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
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
119
DataStructures/PlayerDrawHeadSet.cs
Normal file
119
DataStructures/PlayerDrawHeadSet.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
72
DataStructures/PlayerDrawHelper.cs
Normal file
72
DataStructures/PlayerDrawHelper.cs
Normal 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,
|
||||
}
|
||||
}
|
||||
}
|
2753
DataStructures/PlayerDrawLayers.cs
Normal file
2753
DataStructures/PlayerDrawLayers.cs
Normal file
File diff suppressed because it is too large
Load diff
1554
DataStructures/PlayerDrawSet.cs
Normal file
1554
DataStructures/PlayerDrawSet.cs
Normal file
File diff suppressed because it is too large
Load diff
18
DataStructures/PlayerFishingConditions.cs
Normal file
18
DataStructures/PlayerFishingConditions.cs
Normal 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;
|
||||
}
|
||||
}
|
42
DataStructures/PlayerInteractionAnchor.cs
Normal file
42
DataStructures/PlayerInteractionAnchor.cs
Normal 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];
|
||||
}
|
||||
}
|
66
DataStructures/PlayerMovementAccsCache.cs
Normal file
66
DataStructures/PlayerMovementAccsCache.cs
Normal 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
56
DataStructures/Point16.cs
Normal 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);
|
||||
}
|
||||
}
|
34
DataStructures/PortableStoolUsage.cs
Normal file
34
DataStructures/PortableStoolUsage.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
15
DataStructures/SoundPlaySet.cs
Normal file
15
DataStructures/SoundPlaySet.cs
Normal 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;
|
||||
}
|
||||
}
|
68
DataStructures/SpriteFrame.cs
Normal file
68
DataStructures/SpriteFrame.cs
Normal 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));
|
||||
}
|
||||
}
|
||||
}
|
24
DataStructures/TileDataType.cs
Normal file
24
DataStructures/TileDataType.cs
Normal 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
|
||||
}
|
||||
}
|
34
DataStructures/TileDrawInfo.cs
Normal file
34
DataStructures/TileDrawInfo.cs
Normal 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;
|
||||
}
|
||||
}
|
63
DataStructures/TileDrawSorter.cs
Normal file
63
DataStructures/TileDrawSorter.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
51
DataStructures/TileEntitiesManager.cs
Normal file
51
DataStructures/TileEntitiesManager.cs
Normal 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();
|
||||
}
|
||||
}
|
219
DataStructures/TileEntity.cs
Normal file
219
DataStructures/TileEntity.cs
Normal 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;
|
||||
}
|
||||
}
|
175
DataStructures/TileObjectPreviewData.cs
Normal file
175
DataStructures/TileObjectPreviewData.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
15
DataStructures/WeaponDrawOrder.cs
Normal file
15
DataStructures/WeaponDrawOrder.cs
Normal 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,
|
||||
}
|
||||
}
|
37
DataStructures/WingStats.cs
Normal file
37
DataStructures/WingStats.cs
Normal 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);
|
||||
}
|
||||
}
|
394
DelegateMethods.cs
Normal file
394
DelegateMethods.cs
Normal file
|
@ -0,0 +1,394 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.DelegateMethods
|
||||
// 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.Audio;
|
||||
using Terraria.DataStructures;
|
||||
using Terraria.Enums;
|
||||
using Terraria.Graphics.Shaders;
|
||||
using Terraria.ID;
|
||||
|
||||
namespace Terraria
|
||||
{
|
||||
public static class DelegateMethods
|
||||
{
|
||||
public static Vector3 v3_1 = Vector3.Zero;
|
||||
public static Vector2 v2_1 = Vector2.Zero;
|
||||
public static float f_1 = 0.0f;
|
||||
public static Color c_1 = Color.Transparent;
|
||||
public static int i_1;
|
||||
public static TileCuttingContext tilecut_0 = TileCuttingContext.Unknown;
|
||||
|
||||
public static Color ColorLerp_BlackToWhite(float percent) => Color.Lerp(Color.Black, Color.White, percent);
|
||||
|
||||
public static Color ColorLerp_HSL_H(float percent) => Main.hslToRgb(percent, 1f, 0.5f);
|
||||
|
||||
public static Color ColorLerp_HSL_S(float percent) => Main.hslToRgb(DelegateMethods.v3_1.X, percent, DelegateMethods.v3_1.Z);
|
||||
|
||||
public static Color ColorLerp_HSL_L(float percent) => Main.hslToRgb(DelegateMethods.v3_1.X, DelegateMethods.v3_1.Y, (float) (0.150000005960464 + 0.850000023841858 * (double) percent));
|
||||
|
||||
public static Color ColorLerp_HSL_O(float percent) => Color.Lerp(Color.White, Main.hslToRgb(DelegateMethods.v3_1.X, DelegateMethods.v3_1.Y, DelegateMethods.v3_1.Z), percent);
|
||||
|
||||
public static bool SpreadDirt(int x, int y)
|
||||
{
|
||||
if ((double) Vector2.Distance(DelegateMethods.v2_1, new Vector2((float) x, (float) y)) > (double) DelegateMethods.f_1 || !WorldGen.PlaceTile(x, y, 0))
|
||||
return false;
|
||||
if (Main.netMode != 0)
|
||||
NetMessage.SendData(17, number: 1, number2: ((float) x), number3: ((float) y));
|
||||
Vector2 Position = new Vector2((float) (x * 16), (float) (y * 16));
|
||||
int Type = 0;
|
||||
for (int index = 0; index < 3; ++index)
|
||||
{
|
||||
Dust dust1 = Dust.NewDustDirect(Position, 16, 16, Type, Alpha: 100, newColor: Color.Transparent, Scale: 2.2f);
|
||||
dust1.noGravity = true;
|
||||
dust1.velocity.Y -= 1.2f;
|
||||
dust1.velocity *= 4f;
|
||||
Dust dust2 = Dust.NewDustDirect(Position, 16, 16, Type, Alpha: 100, newColor: Color.Transparent, Scale: 1.3f);
|
||||
dust2.velocity.Y -= 1.2f;
|
||||
dust2.velocity *= 2f;
|
||||
}
|
||||
int i = x;
|
||||
int j1 = y + 1;
|
||||
if (Main.tile[i, j1] != null && !TileID.Sets.Platforms[(int) Main.tile[i, j1].type] && (Main.tile[i, j1].topSlope() || Main.tile[i, j1].halfBrick()))
|
||||
{
|
||||
WorldGen.SlopeTile(i, j1);
|
||||
if (Main.netMode != 0)
|
||||
NetMessage.SendData(17, number: 14, number2: ((float) i), number3: ((float) j1));
|
||||
}
|
||||
int j2 = y - 1;
|
||||
if (Main.tile[i, j2] != null && !TileID.Sets.Platforms[(int) Main.tile[i, j2].type] && Main.tile[i, j2].bottomSlope())
|
||||
{
|
||||
WorldGen.SlopeTile(i, j2);
|
||||
if (Main.netMode != 0)
|
||||
NetMessage.SendData(17, number: 14, number2: ((float) i), number3: ((float) j2));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool SpreadWater(int x, int y)
|
||||
{
|
||||
if ((double) Vector2.Distance(DelegateMethods.v2_1, new Vector2((float) x, (float) y)) > (double) DelegateMethods.f_1 || !WorldGen.PlaceLiquid(x, y, (byte) 0, byte.MaxValue))
|
||||
return false;
|
||||
Vector2 Position = new Vector2((float) (x * 16), (float) (y * 16));
|
||||
int Type = Dust.dustWater();
|
||||
for (int index = 0; index < 3; ++index)
|
||||
{
|
||||
Dust dust1 = Dust.NewDustDirect(Position, 16, 16, Type, Alpha: 100, newColor: Color.Transparent, Scale: 2.2f);
|
||||
dust1.noGravity = true;
|
||||
dust1.velocity.Y -= 1.2f;
|
||||
dust1.velocity *= 7f;
|
||||
Dust dust2 = Dust.NewDustDirect(Position, 16, 16, Type, Alpha: 100, newColor: Color.Transparent, Scale: 1.3f);
|
||||
dust2.velocity.Y -= 1.2f;
|
||||
dust2.velocity *= 4f;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool SpreadHoney(int x, int y)
|
||||
{
|
||||
if ((double) Vector2.Distance(DelegateMethods.v2_1, new Vector2((float) x, (float) y)) > (double) DelegateMethods.f_1 || !WorldGen.PlaceLiquid(x, y, (byte) 2, byte.MaxValue))
|
||||
return false;
|
||||
Vector2 Position = new Vector2((float) (x * 16), (float) (y * 16));
|
||||
int Type = 152;
|
||||
for (int index = 0; index < 3; ++index)
|
||||
{
|
||||
Dust dust1 = Dust.NewDustDirect(Position, 16, 16, Type, Alpha: 100, newColor: Color.Transparent, Scale: 2.2f);
|
||||
dust1.velocity.Y -= 1.2f;
|
||||
dust1.velocity *= 7f;
|
||||
Dust dust2 = Dust.NewDustDirect(Position, 16, 16, Type, Alpha: 100, newColor: Color.Transparent, Scale: 1.3f);
|
||||
dust2.velocity.Y -= 1.2f;
|
||||
dust2.velocity *= 4f;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool SpreadLava(int x, int y)
|
||||
{
|
||||
if ((double) Vector2.Distance(DelegateMethods.v2_1, new Vector2((float) x, (float) y)) > (double) DelegateMethods.f_1 || !WorldGen.PlaceLiquid(x, y, (byte) 1, byte.MaxValue))
|
||||
return false;
|
||||
Vector2 Position = new Vector2((float) (x * 16), (float) (y * 16));
|
||||
int Type = 35;
|
||||
for (int index = 0; index < 3; ++index)
|
||||
{
|
||||
Dust.NewDustDirect(Position, 16, 16, Type, Alpha: 100, newColor: Color.Transparent, Scale: 1.2f).velocity *= 7f;
|
||||
Dust.NewDustDirect(Position, 16, 16, Type, Alpha: 100, newColor: Color.Transparent, Scale: 0.8f).velocity *= 4f;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool SpreadDry(int x, int y)
|
||||
{
|
||||
if ((double) Vector2.Distance(DelegateMethods.v2_1, new Vector2((float) x, (float) y)) > (double) DelegateMethods.f_1 || !WorldGen.EmptyLiquid(x, y))
|
||||
return false;
|
||||
Vector2 Position = new Vector2((float) (x * 16), (float) (y * 16));
|
||||
int Type = 31;
|
||||
for (int index = 0; index < 3; ++index)
|
||||
{
|
||||
Dust dust = Dust.NewDustDirect(Position, 16, 16, Type, Alpha: 100, newColor: Color.Transparent, Scale: 1.2f);
|
||||
dust.noGravity = true;
|
||||
dust.velocity *= 7f;
|
||||
Dust.NewDustDirect(Position, 16, 16, Type, Alpha: 100, newColor: Color.Transparent, Scale: 0.8f).velocity *= 4f;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool SpreadTest(int x, int y)
|
||||
{
|
||||
Tile tile = Main.tile[x, y];
|
||||
if (!WorldGen.SolidTile(x, y) && tile.wall == (ushort) 0)
|
||||
return true;
|
||||
tile.active();
|
||||
return false;
|
||||
}
|
||||
|
||||
public static bool TestDust(int x, int y)
|
||||
{
|
||||
if (x < 0 || x >= Main.maxTilesX || y < 0 || y >= Main.maxTilesY)
|
||||
return false;
|
||||
int index = Dust.NewDust(new Vector2((float) x, (float) y) * 16f + new Vector2(8f), 0, 0, 6);
|
||||
Main.dust[index].noGravity = true;
|
||||
Main.dust[index].noLight = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool CastLight(int x, int y)
|
||||
{
|
||||
if (x < 0 || x >= Main.maxTilesX || y < 0 || y >= Main.maxTilesY || Main.tile[x, y] == null)
|
||||
return false;
|
||||
Lighting.AddLight(x, y, DelegateMethods.v3_1.X, DelegateMethods.v3_1.Y, DelegateMethods.v3_1.Z);
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool CastLightOpen(int x, int y)
|
||||
{
|
||||
if (x < 0 || x >= Main.maxTilesX || y < 0 || y >= Main.maxTilesY || Main.tile[x, y] == null)
|
||||
return false;
|
||||
if (!Main.tile[x, y].active() || Main.tile[x, y].inActive() || Main.tileSolidTop[(int) Main.tile[x, y].type] || !Main.tileSolid[(int) Main.tile[x, y].type])
|
||||
Lighting.AddLight(x, y, DelegateMethods.v3_1.X, DelegateMethods.v3_1.Y, DelegateMethods.v3_1.Z);
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool CastLightOpen_StopForSolids_ScaleWithDistance(int x, int y)
|
||||
{
|
||||
if (x < 0 || x >= Main.maxTilesX || y < 0 || y >= Main.maxTilesY || Main.tile[x, y] == null || Main.tile[x, y].active() && !Main.tile[x, y].inActive() && !Main.tileSolidTop[(int) Main.tile[x, y].type] && Main.tileSolid[(int) Main.tile[x, y].type])
|
||||
return false;
|
||||
Vector3 v31 = DelegateMethods.v3_1;
|
||||
Vector2 vector2 = new Vector2((float) x, (float) y);
|
||||
float num = Vector2.Distance(DelegateMethods.v2_1, vector2);
|
||||
Vector3 vector3 = v31 * MathHelper.Lerp(0.65f, 1f, num / DelegateMethods.f_1);
|
||||
Lighting.AddLight(x, y, vector3.X, vector3.Y, vector3.Z);
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool EmitGolfCartDust_StopForSolids(int x, int y)
|
||||
{
|
||||
if (x < 0 || x >= Main.maxTilesX || y < 0 || y >= Main.maxTilesY || Main.tile[x, y] == null || Main.tile[x, y].active() && !Main.tile[x, y].inActive() && !Main.tileSolidTop[(int) Main.tile[x, y].type] && Main.tileSolid[(int) Main.tile[x, y].type])
|
||||
return false;
|
||||
Dust.NewDustPerfect(new Vector2((float) (x * 16 + 8), (float) (y * 16 + 8)), 260, new Vector2?(Vector2.UnitY * -0.2f));
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool NotDoorStand(int x, int y)
|
||||
{
|
||||
if (Main.tile[x, y] == null || !Main.tile[x, y].active() || Main.tile[x, y].type != (ushort) 11)
|
||||
return true;
|
||||
return Main.tile[x, y].frameX >= (short) 18 && Main.tile[x, y].frameX < (short) 54;
|
||||
}
|
||||
|
||||
public static bool CutTiles(int x, int y)
|
||||
{
|
||||
if (!WorldGen.InWorld(x, y, 1) || Main.tile[x, y] == null)
|
||||
return false;
|
||||
if (!Main.tileCut[(int) Main.tile[x, y].type] || !WorldGen.CanCutTile(x, y, DelegateMethods.tilecut_0))
|
||||
return true;
|
||||
WorldGen.KillTile(x, y);
|
||||
if (Main.netMode != 0)
|
||||
NetMessage.SendData(17, number2: ((float) x), number3: ((float) y));
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool SearchAvoidedByNPCs(int x, int y) => WorldGen.InWorld(x, y, 1) && Main.tile[x, y] != null && (!Main.tile[x, y].active() || !TileID.Sets.AvoidedByNPCs[(int) Main.tile[x, y].type]);
|
||||
|
||||
public static void RainbowLaserDraw(
|
||||
int stage,
|
||||
Vector2 currentPosition,
|
||||
float distanceLeft,
|
||||
Rectangle lastFrame,
|
||||
out float distCovered,
|
||||
out Rectangle frame,
|
||||
out Vector2 origin,
|
||||
out Color color)
|
||||
{
|
||||
color = DelegateMethods.c_1;
|
||||
switch (stage)
|
||||
{
|
||||
case 0:
|
||||
distCovered = 33f;
|
||||
frame = new Rectangle(0, 0, 26, 22);
|
||||
origin = frame.Size() / 2f;
|
||||
break;
|
||||
case 1:
|
||||
frame = new Rectangle(0, 25, 26, 28);
|
||||
distCovered = (float) frame.Height;
|
||||
origin = new Vector2((float) (frame.Width / 2), 0.0f);
|
||||
break;
|
||||
case 2:
|
||||
distCovered = 22f;
|
||||
frame = new Rectangle(0, 56, 26, 22);
|
||||
origin = new Vector2((float) (frame.Width / 2), 1f);
|
||||
break;
|
||||
default:
|
||||
distCovered = 9999f;
|
||||
frame = Rectangle.Empty;
|
||||
origin = Vector2.Zero;
|
||||
color = Color.Transparent;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public static void TurretLaserDraw(
|
||||
int stage,
|
||||
Vector2 currentPosition,
|
||||
float distanceLeft,
|
||||
Rectangle lastFrame,
|
||||
out float distCovered,
|
||||
out Rectangle frame,
|
||||
out Vector2 origin,
|
||||
out Color color)
|
||||
{
|
||||
color = DelegateMethods.c_1;
|
||||
switch (stage)
|
||||
{
|
||||
case 0:
|
||||
distCovered = 32f;
|
||||
frame = new Rectangle(0, 0, 22, 20);
|
||||
origin = frame.Size() / 2f;
|
||||
break;
|
||||
case 1:
|
||||
++DelegateMethods.i_1;
|
||||
int num = DelegateMethods.i_1 % 5;
|
||||
frame = new Rectangle(0, 22 * (num + 1), 22, 20);
|
||||
distCovered = (float) (frame.Height - 1);
|
||||
origin = new Vector2((float) (frame.Width / 2), 0.0f);
|
||||
break;
|
||||
case 2:
|
||||
frame = new Rectangle(0, 154, 22, 30);
|
||||
distCovered = (float) frame.Height;
|
||||
origin = new Vector2((float) (frame.Width / 2), 1f);
|
||||
break;
|
||||
default:
|
||||
distCovered = 9999f;
|
||||
frame = Rectangle.Empty;
|
||||
origin = Vector2.Zero;
|
||||
color = Color.Transparent;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public static void LightningLaserDraw(
|
||||
int stage,
|
||||
Vector2 currentPosition,
|
||||
float distanceLeft,
|
||||
Rectangle lastFrame,
|
||||
out float distCovered,
|
||||
out Rectangle frame,
|
||||
out Vector2 origin,
|
||||
out Color color)
|
||||
{
|
||||
color = DelegateMethods.c_1 * DelegateMethods.f_1;
|
||||
switch (stage)
|
||||
{
|
||||
case 0:
|
||||
distCovered = 0.0f;
|
||||
frame = new Rectangle(0, 0, 21, 8);
|
||||
origin = frame.Size() / 2f;
|
||||
break;
|
||||
case 1:
|
||||
frame = new Rectangle(0, 8, 21, 6);
|
||||
distCovered = (float) frame.Height;
|
||||
origin = new Vector2((float) (frame.Width / 2), 0.0f);
|
||||
break;
|
||||
case 2:
|
||||
distCovered = 8f;
|
||||
frame = new Rectangle(0, 14, 21, 8);
|
||||
origin = new Vector2((float) (frame.Width / 2), 2f);
|
||||
break;
|
||||
default:
|
||||
distCovered = 9999f;
|
||||
frame = Rectangle.Empty;
|
||||
origin = Vector2.Zero;
|
||||
color = Color.Transparent;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public static int CompareYReverse(Point a, Point b) => b.Y.CompareTo(a.Y);
|
||||
|
||||
public static int CompareDrawSorterByYScale(DrawData a, DrawData b) => a.scale.Y.CompareTo(b.scale.Y);
|
||||
|
||||
public static class Minecart
|
||||
{
|
||||
public static Vector2 rotationOrigin;
|
||||
public static float rotation;
|
||||
|
||||
public static void Sparks(Vector2 dustPosition)
|
||||
{
|
||||
dustPosition += new Vector2(Main.rand.Next(2) == 0 ? 13f : -13f, 0.0f).RotatedBy((double) DelegateMethods.Minecart.rotation);
|
||||
int index = Dust.NewDust(dustPosition, 1, 1, 213, (float) Main.rand.Next(-2, 3), (float) Main.rand.Next(-2, 3));
|
||||
Main.dust[index].noGravity = true;
|
||||
Main.dust[index].fadeIn = (float) ((double) Main.dust[index].scale + 1.0 + 0.00999999977648258 * (double) Main.rand.Next(0, 51));
|
||||
Main.dust[index].noGravity = true;
|
||||
Main.dust[index].velocity *= (float) Main.rand.Next(15, 51) * 0.01f;
|
||||
Main.dust[index].velocity.X *= (float) Main.rand.Next(25, 101) * 0.01f;
|
||||
Main.dust[index].velocity.Y -= (float) Main.rand.Next(15, 31) * 0.1f;
|
||||
Main.dust[index].position.Y -= 4f;
|
||||
if (Main.rand.Next(3) != 0)
|
||||
Main.dust[index].noGravity = false;
|
||||
else
|
||||
Main.dust[index].scale *= 0.6f;
|
||||
}
|
||||
|
||||
public static void LandingSound(Vector2 Position, int Width, int Height) => SoundEngine.PlaySound(SoundID.Item53, (int) Position.X + Width / 2, (int) Position.Y + Height / 2);
|
||||
|
||||
public static void BumperSound(Vector2 Position, int Width, int Height) => SoundEngine.PlaySound(SoundID.Item56, (int) Position.X + Width / 2, (int) Position.Y + Height / 2);
|
||||
|
||||
public static void SparksMech(Vector2 dustPosition)
|
||||
{
|
||||
dustPosition += new Vector2(Main.rand.Next(2) == 0 ? 13f : -13f, 0.0f).RotatedBy((double) DelegateMethods.Minecart.rotation);
|
||||
int index = Dust.NewDust(dustPosition, 1, 1, 260, (float) Main.rand.Next(-2, 3), (float) Main.rand.Next(-2, 3));
|
||||
Main.dust[index].noGravity = true;
|
||||
Main.dust[index].fadeIn = (float) ((double) Main.dust[index].scale + 0.5 + 0.00999999977648258 * (double) Main.rand.Next(0, 51));
|
||||
Main.dust[index].noGravity = true;
|
||||
Main.dust[index].velocity *= (float) Main.rand.Next(15, 51) * 0.01f;
|
||||
Main.dust[index].velocity.X *= (float) Main.rand.Next(25, 101) * 0.01f;
|
||||
Main.dust[index].velocity.Y -= (float) Main.rand.Next(15, 31) * 0.1f;
|
||||
Main.dust[index].position.Y -= 4f;
|
||||
if (Main.rand.Next(3) != 0)
|
||||
Main.dust[index].noGravity = false;
|
||||
else
|
||||
Main.dust[index].scale *= 0.6f;
|
||||
}
|
||||
|
||||
public static void SparksMeow(Vector2 dustPosition)
|
||||
{
|
||||
dustPosition += new Vector2(Main.rand.Next(2) == 0 ? 13f : -13f, 0.0f).RotatedBy((double) DelegateMethods.Minecart.rotation);
|
||||
int index = Dust.NewDust(dustPosition, 1, 1, 213, (float) Main.rand.Next(-2, 3), (float) Main.rand.Next(-2, 3));
|
||||
Main.dust[index].shader = GameShaders.Armor.GetShaderFromItemId(2870);
|
||||
Main.dust[index].noGravity = true;
|
||||
Main.dust[index].fadeIn = (float) ((double) Main.dust[index].scale + 1.0 + 0.00999999977648258 * (double) Main.rand.Next(0, 51));
|
||||
Main.dust[index].noGravity = true;
|
||||
Main.dust[index].velocity *= (float) Main.rand.Next(15, 51) * 0.01f;
|
||||
Main.dust[index].velocity.X *= (float) Main.rand.Next(25, 101) * 0.01f;
|
||||
Main.dust[index].velocity.Y -= (float) Main.rand.Next(15, 31) * 0.1f;
|
||||
Main.dust[index].position.Y -= 4f;
|
||||
if (Main.rand.Next(3) != 0)
|
||||
Main.dust[index].noGravity = false;
|
||||
else
|
||||
Main.dust[index].scale *= 0.6f;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
145
DeprecatedClassLeftInForLoading.cs
Normal file
145
DeprecatedClassLeftInForLoading.cs
Normal file
|
@ -0,0 +1,145 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.DeprecatedClassLeftInForLoading
|
||||
// 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
|
||||
{
|
||||
public class DeprecatedClassLeftInForLoading
|
||||
{
|
||||
public const int MaxDummies = 1000;
|
||||
public static DeprecatedClassLeftInForLoading[] dummies = new DeprecatedClassLeftInForLoading[1000];
|
||||
public short x;
|
||||
public short y;
|
||||
public int npc;
|
||||
public int whoAmI;
|
||||
|
||||
public static void UpdateDummies()
|
||||
{
|
||||
Dictionary<int, Rectangle> dictionary = new Dictionary<int, Rectangle>();
|
||||
bool flag1 = false;
|
||||
Rectangle rectangle = new Rectangle(0, 0, 32, 48);
|
||||
rectangle.Inflate(1600, 1600);
|
||||
int x = rectangle.X;
|
||||
int y = rectangle.Y;
|
||||
for (int index = 0; index < 1000; ++index)
|
||||
{
|
||||
if (DeprecatedClassLeftInForLoading.dummies[index] != null)
|
||||
{
|
||||
DeprecatedClassLeftInForLoading.dummies[index].whoAmI = index;
|
||||
if (DeprecatedClassLeftInForLoading.dummies[index].npc != -1)
|
||||
{
|
||||
if (!Main.npc[DeprecatedClassLeftInForLoading.dummies[index].npc].active || Main.npc[DeprecatedClassLeftInForLoading.dummies[index].npc].type != 488 || (double) Main.npc[DeprecatedClassLeftInForLoading.dummies[index].npc].ai[0] != (double) DeprecatedClassLeftInForLoading.dummies[index].x || (double) Main.npc[DeprecatedClassLeftInForLoading.dummies[index].npc].ai[1] != (double) DeprecatedClassLeftInForLoading.dummies[index].y)
|
||||
DeprecatedClassLeftInForLoading.dummies[index].Deactivate();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!flag1)
|
||||
{
|
||||
for (int key = 0; key < (int) byte.MaxValue; ++key)
|
||||
{
|
||||
if (Main.player[key].active)
|
||||
dictionary[key] = Main.player[key].getRect();
|
||||
}
|
||||
flag1 = true;
|
||||
}
|
||||
rectangle.X = (int) DeprecatedClassLeftInForLoading.dummies[index].x * 16 + x;
|
||||
rectangle.Y = (int) DeprecatedClassLeftInForLoading.dummies[index].y * 16 + y;
|
||||
bool flag2 = false;
|
||||
foreach (KeyValuePair<int, Rectangle> keyValuePair in dictionary)
|
||||
{
|
||||
if (keyValuePair.Value.Intersects(rectangle))
|
||||
{
|
||||
flag2 = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (flag2)
|
||||
DeprecatedClassLeftInForLoading.dummies[index].Activate();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public DeprecatedClassLeftInForLoading(int x, int y)
|
||||
{
|
||||
this.x = (short) x;
|
||||
this.y = (short) y;
|
||||
this.npc = -1;
|
||||
}
|
||||
|
||||
public static int Find(int x, int y)
|
||||
{
|
||||
for (int index = 0; index < 1000; ++index)
|
||||
{
|
||||
if (DeprecatedClassLeftInForLoading.dummies[index] != null && (int) DeprecatedClassLeftInForLoading.dummies[index].x == x && (int) DeprecatedClassLeftInForLoading.dummies[index].y == y)
|
||||
return index;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public static int Place(int x, int y)
|
||||
{
|
||||
int index1 = -1;
|
||||
for (int index2 = 0; index2 < 1000; ++index2)
|
||||
{
|
||||
if (DeprecatedClassLeftInForLoading.dummies[index2] == null)
|
||||
{
|
||||
index1 = index2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (index1 == -1)
|
||||
return index1;
|
||||
DeprecatedClassLeftInForLoading.dummies[index1] = new DeprecatedClassLeftInForLoading(x, y);
|
||||
return index1;
|
||||
}
|
||||
|
||||
public static void Kill(int x, int y)
|
||||
{
|
||||
for (int index = 0; index < 1000; ++index)
|
||||
{
|
||||
DeprecatedClassLeftInForLoading dummy = DeprecatedClassLeftInForLoading.dummies[index];
|
||||
if (dummy != null && (int) dummy.x == x && (int) dummy.y == y)
|
||||
DeprecatedClassLeftInForLoading.dummies[index] = (DeprecatedClassLeftInForLoading) null;
|
||||
}
|
||||
}
|
||||
|
||||
public static int Hook_AfterPlacement(int x, int y, int type = 21, int style = 0, int direction = 1)
|
||||
{
|
||||
if (Main.netMode != 1)
|
||||
return DeprecatedClassLeftInForLoading.Place(x - 1, y - 2);
|
||||
NetMessage.SendTileSquare(Main.myPlayer, x - 1, y - 1, 3);
|
||||
NetMessage.SendData(87, number: (x - 1), number2: ((float) (y - 2)));
|
||||
return -1;
|
||||
}
|
||||
|
||||
public void Activate()
|
||||
{
|
||||
int index = NPC.NewNPC((int) this.x * 16 + 16, (int) this.y * 16 + 48, 488, 100);
|
||||
Main.npc[index].ai[0] = (float) this.x;
|
||||
Main.npc[index].ai[1] = (float) this.y;
|
||||
Main.npc[index].netUpdate = true;
|
||||
this.npc = index;
|
||||
if (Main.netMode == 1)
|
||||
return;
|
||||
NetMessage.SendData(86, number: this.whoAmI, number2: ((float) this.x), number3: ((float) this.y));
|
||||
}
|
||||
|
||||
public void Deactivate()
|
||||
{
|
||||
if (this.npc != -1)
|
||||
Main.npc[this.npc].active = false;
|
||||
this.npc = -1;
|
||||
if (Main.netMode == 1)
|
||||
return;
|
||||
NetMessage.SendData(86, number: this.whoAmI, number2: ((float) this.x), number3: ((float) this.y));
|
||||
}
|
||||
|
||||
public override string ToString() => this.x.ToString() + "x " + (object) this.y + "y npc: " + (object) this.npc;
|
||||
}
|
||||
}
|
120
Entity.cs
Normal file
120
Entity.cs
Normal file
|
@ -0,0 +1,120 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Entity
|
||||
// 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;
|
||||
|
||||
namespace Terraria
|
||||
{
|
||||
public abstract class Entity
|
||||
{
|
||||
public int whoAmI;
|
||||
public bool active;
|
||||
public Vector2 position;
|
||||
public Vector2 velocity;
|
||||
public Vector2 oldPosition;
|
||||
public Vector2 oldVelocity;
|
||||
public int oldDirection;
|
||||
public int direction = 1;
|
||||
public int width;
|
||||
public int height;
|
||||
public bool wet;
|
||||
public bool honeyWet;
|
||||
public byte wetCount;
|
||||
public bool lavaWet;
|
||||
|
||||
public virtual Vector2 VisualPosition => this.position;
|
||||
|
||||
public float AngleTo(Vector2 Destination) => (float) Math.Atan2((double) Destination.Y - (double) this.Center.Y, (double) Destination.X - (double) this.Center.X);
|
||||
|
||||
public float AngleFrom(Vector2 Source) => (float) Math.Atan2((double) this.Center.Y - (double) Source.Y, (double) this.Center.X - (double) Source.X);
|
||||
|
||||
public float Distance(Vector2 Other) => Vector2.Distance(this.Center, Other);
|
||||
|
||||
public float DistanceSQ(Vector2 Other) => Vector2.DistanceSquared(this.Center, Other);
|
||||
|
||||
public Vector2 DirectionTo(Vector2 Destination) => Vector2.Normalize(Destination - this.Center);
|
||||
|
||||
public Vector2 DirectionFrom(Vector2 Source) => Vector2.Normalize(this.Center - Source);
|
||||
|
||||
public bool WithinRange(Vector2 Target, float MaxRange) => (double) Vector2.DistanceSquared(this.Center, Target) <= (double) MaxRange * (double) MaxRange;
|
||||
|
||||
public Vector2 Center
|
||||
{
|
||||
get => new Vector2(this.position.X + (float) (this.width / 2), this.position.Y + (float) (this.height / 2));
|
||||
set => this.position = new Vector2(value.X - (float) (this.width / 2), value.Y - (float) (this.height / 2));
|
||||
}
|
||||
|
||||
public Vector2 Left
|
||||
{
|
||||
get => new Vector2(this.position.X, this.position.Y + (float) (this.height / 2));
|
||||
set => this.position = new Vector2(value.X, value.Y - (float) (this.height / 2));
|
||||
}
|
||||
|
||||
public Vector2 Right
|
||||
{
|
||||
get => new Vector2(this.position.X + (float) this.width, this.position.Y + (float) (this.height / 2));
|
||||
set => this.position = new Vector2(value.X - (float) this.width, value.Y - (float) (this.height / 2));
|
||||
}
|
||||
|
||||
public Vector2 Top
|
||||
{
|
||||
get => new Vector2(this.position.X + (float) (this.width / 2), this.position.Y);
|
||||
set => this.position = new Vector2(value.X - (float) (this.width / 2), value.Y);
|
||||
}
|
||||
|
||||
public Vector2 TopLeft
|
||||
{
|
||||
get => this.position;
|
||||
set => this.position = value;
|
||||
}
|
||||
|
||||
public Vector2 TopRight
|
||||
{
|
||||
get => new Vector2(this.position.X + (float) this.width, this.position.Y);
|
||||
set => this.position = new Vector2(value.X - (float) this.width, value.Y);
|
||||
}
|
||||
|
||||
public Vector2 Bottom
|
||||
{
|
||||
get => new Vector2(this.position.X + (float) (this.width / 2), this.position.Y + (float) this.height);
|
||||
set => this.position = new Vector2(value.X - (float) (this.width / 2), value.Y - (float) this.height);
|
||||
}
|
||||
|
||||
public Vector2 BottomLeft
|
||||
{
|
||||
get => new Vector2(this.position.X, this.position.Y + (float) this.height);
|
||||
set => this.position = new Vector2(value.X, value.Y - (float) this.height);
|
||||
}
|
||||
|
||||
public Vector2 BottomRight
|
||||
{
|
||||
get => new Vector2(this.position.X + (float) this.width, this.position.Y + (float) this.height);
|
||||
set => this.position = new Vector2(value.X - (float) this.width, value.Y - (float) this.height);
|
||||
}
|
||||
|
||||
public Vector2 Size
|
||||
{
|
||||
get => new Vector2((float) this.width, (float) this.height);
|
||||
set
|
||||
{
|
||||
this.width = (int) value.X;
|
||||
this.height = (int) value.Y;
|
||||
}
|
||||
}
|
||||
|
||||
public Rectangle Hitbox
|
||||
{
|
||||
get => new Rectangle((int) this.position.X, (int) this.position.Y, this.width, this.height);
|
||||
set
|
||||
{
|
||||
this.position = new Vector2((float) value.X, (float) value.Y);
|
||||
this.width = value.Width;
|
||||
this.height = value.Height;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
24
Enums/AnchorType.cs
Normal file
24
Enums/AnchorType.cs
Normal file
|
@ -0,0 +1,24 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Enums.AnchorType
|
||||
// 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.Enums
|
||||
{
|
||||
[Flags]
|
||||
public enum AnchorType
|
||||
{
|
||||
None = 0,
|
||||
SolidTile = 1,
|
||||
SolidWithTop = 2,
|
||||
Table = 4,
|
||||
SolidSide = 8,
|
||||
Tree = 16, // 0x00000010
|
||||
AlternateTile = 32, // 0x00000020
|
||||
EmptyTile = 64, // 0x00000040
|
||||
SolidBottom = 128, // 0x00000080
|
||||
}
|
||||
}
|
26
Enums/ItemRarityColor.cs
Normal file
26
Enums/ItemRarityColor.cs
Normal file
|
@ -0,0 +1,26 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Enums.ItemRarityColor
|
||||
// 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.Enums
|
||||
{
|
||||
public enum ItemRarityColor
|
||||
{
|
||||
AmberMinus11 = -11, // 0xFFFFFFF5
|
||||
TrashMinus1 = -1, // 0xFFFFFFFF
|
||||
White0 = 0,
|
||||
Blue1 = 1,
|
||||
Green2 = 2,
|
||||
Orange3 = 3,
|
||||
LightRed4 = 4,
|
||||
Pink5 = 5,
|
||||
LightPurple6 = 6,
|
||||
Lime7 = 7,
|
||||
Yellow8 = 8,
|
||||
Cyan9 = 9,
|
||||
StrongRed10 = 10, // 0x0000000A
|
||||
Purple11 = 11, // 0x0000000B
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue