Compare commits
No commits in common. "1.3.5.3" and "1.4.0.5" have entirely different histories.
1065 changed files with 261733 additions and 107311 deletions
|
@ -1,138 +1,138 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Achievements.Achievement
|
||||
// Assembly: Terraria, Version=1.3.5.3, Culture=neutral, PublicKeyToken=null
|
||||
// MVID: 68659D26-2BE6-448F-8663-74FA559E6F08
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Achievements.AchievementCategory
|
||||
// Assembly: Terraria, Version=1.3.5.3, Culture=neutral, PublicKeyToken=null
|
||||
// MVID: 68659D26-2BE6-448F-8663-74FA559E6F08
|
||||
// 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,
|
||||
}
|
||||
}
|
||||
// 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,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,51 +1,51 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Achievements.AchievementCondition
|
||||
// Assembly: Terraria, Version=1.3.5.3, Culture=neutral, PublicKeyToken=null
|
||||
// MVID: 68659D26-2BE6-448F-8663-74FA559E6F08
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,177 +1,190 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Achievements.AchievementManager
|
||||
// Assembly: Terraria, Version=1.3.5.3, Culture=neutral, PublicKeyToken=null
|
||||
// MVID: 68659D26-2BE6-448F-8663-74FA559E6F08
|
||||
// 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.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() => 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)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
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
|
||||
{
|
||||
public Dictionary<string, JObject> Conditions;
|
||||
}
|
||||
}
|
||||
}
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,56 +1,56 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Achievements.AchievementTracker`1
|
||||
// Assembly: Terraria, Version=1.3.5.3, Culture=neutral, PublicKeyToken=null
|
||||
// MVID: 68659D26-2BE6-448F-8663-74FA559E6F08
|
||||
// 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
// 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,35 +1,35 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Achievements.ConditionFloatTracker
|
||||
// Assembly: Terraria, Version=1.3.5.3, Culture=neutral, PublicKeyToken=null
|
||||
// MVID: 68659D26-2BE6-448F-8663-74FA559E6F08
|
||||
// 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()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
// 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()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,35 +1,35 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Achievements.ConditionIntTracker
|
||||
// Assembly: Terraria, Version=1.3.5.3, Culture=neutral, PublicKeyToken=null
|
||||
// MVID: 68659D26-2BE6-448F-8663-74FA559E6F08
|
||||
// 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()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
// 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()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,34 +1,34 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Achievements.ConditionsCompletedTracker
|
||||
// Assembly: Terraria, Version=1.3.5.3, Culture=neutral, PublicKeyToken=null
|
||||
// MVID: 68659D26-2BE6-448F-8663-74FA559E6F08
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Achievements.IAchievementTracker
|
||||
// Assembly: Terraria, Version=1.3.5.3, Culture=neutral, PublicKeyToken=null
|
||||
// MVID: 68659D26-2BE6-448F-8663-74FA559E6F08
|
||||
// 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();
|
||||
}
|
||||
}
|
||||
// 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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Achievements.TrackerType
|
||||
// Assembly: Terraria, Version=1.3.5.3, Culture=neutral, PublicKeyToken=null
|
||||
// MVID: 68659D26-2BE6-448F-8663-74FA559E6F08
|
||||
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
|
||||
|
||||
namespace Terraria.Achievements
|
||||
{
|
||||
public enum TrackerType
|
||||
{
|
||||
Float,
|
||||
Int,
|
||||
}
|
||||
}
|
||||
// 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,
|
||||
}
|
||||
}
|
||||
|
|
18
Animation.cs
18
Animation.cs
|
@ -1,7 +1,7 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Animation
|
||||
// Assembly: Terraria, Version=1.3.5.3, Culture=neutral, PublicKeyToken=null
|
||||
// MVID: 68659D26-2BE6-448F-8663-74FA559E6F08
|
||||
// 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;
|
||||
|
@ -61,6 +61,20 @@ namespace Terraria
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -8,10 +8,10 @@ using System.Security.Permissions;
|
|||
[assembly: AssemblyProduct("Terraria")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyCompany("Re-Logic")]
|
||||
[assembly: AssemblyCopyright("Copyright © Re-Logic 2017")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2020 Re-Logic")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: ComVisible(false)]
|
||||
[assembly: Guid("f571b16a-2c9b-44ab-b115-7c762c9e4e7e")]
|
||||
[assembly: AssemblyFileVersion("1.3.5.3")]
|
||||
[assembly: AssemblyVersion("1.3.5.3")]
|
||||
[assembly: AssemblyFileVersion("1.4.0.5")]
|
||||
[assembly: AssemblyVersion("1.4.0.5")]
|
||||
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
|
||||
|
|
|
@ -1,101 +1,100 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Audio.ActiveSound
|
||||
// Assembly: Terraria, Version=1.3.5.3, Culture=neutral, PublicKeyToken=null
|
||||
// MVID: 68659D26-2BE6-448F-8663-74FA559E6F08
|
||||
// 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
|
||||
{
|
||||
private SoundEffectInstance _sound;
|
||||
public readonly bool IsGlobal;
|
||||
public Vector2 Position;
|
||||
public float Volume;
|
||||
private SoundStyle _style;
|
||||
|
||||
public SoundEffectInstance Sound => this._sound;
|
||||
|
||||
public SoundStyle Style => this._style;
|
||||
|
||||
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();
|
||||
Main.PlaySoundInstance(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);
|
||||
}
|
||||
}
|
||||
}
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,41 +1,41 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Audio.CustomSoundStyle
|
||||
// Assembly: Terraria, Version=1.3.5.3, Culture=neutral, PublicKeyToken=null
|
||||
// MVID: 68659D26-2BE6-448F-8663-74FA559E6F08
|
||||
// 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 UnifiedRandom _random = new UnifiedRandom();
|
||||
private 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)];
|
||||
}
|
||||
}
|
||||
// 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,71 +1,67 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Audio.LegacySoundStyle
|
||||
// Assembly: Terraria, Version=1.3.5.3, Culture=neutral, PublicKeyToken=null
|
||||
// MVID: 68659D26-2BE6-448F-8663-74FA559E6F08
|
||||
// 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 UnifiedRandom _random = new UnifiedRandom();
|
||||
private int _style;
|
||||
private int _styleVariations;
|
||||
private int _soundId;
|
||||
|
||||
public int Style => this._styleVariations != 1 ? LegacySoundStyle._random.Next(this._style, this._style + this._styleVariations) : this._style;
|
||||
|
||||
public int Variations => this._styleVariations;
|
||||
|
||||
public int SoundId => this._soundId;
|
||||
|
||||
public override bool IsTrackable => this._soundId == 42;
|
||||
|
||||
public LegacySoundStyle(int soundId, int style, SoundType type = SoundType.Sound)
|
||||
: base(type)
|
||||
{
|
||||
this._style = style;
|
||||
this._styleVariations = 1;
|
||||
this._soundId = soundId;
|
||||
}
|
||||
|
||||
public LegacySoundStyle(int soundId, int style, int variations, SoundType type = SoundType.Sound)
|
||||
: base(type)
|
||||
{
|
||||
this._style = style;
|
||||
this._styleVariations = 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._styleVariations = variations;
|
||||
this._soundId = soundId;
|
||||
}
|
||||
|
||||
public LegacySoundStyle WithVolume(float volume) => new LegacySoundStyle(this._soundId, this._style, this._styleVariations, this.Type, volume, this.PitchVariance);
|
||||
|
||||
public LegacySoundStyle WithPitchVariance(float pitchVariance) => new LegacySoundStyle(this._soundId, this._style, this._styleVariations, this.Type, this.Volume, pitchVariance);
|
||||
|
||||
public LegacySoundStyle AsMusic() => new LegacySoundStyle(this._soundId, this._style, this._styleVariations, SoundType.Music, this.Volume, this.PitchVariance);
|
||||
|
||||
public LegacySoundStyle AsAmbient() => new LegacySoundStyle(this._soundId, this._style, this._styleVariations, SoundType.Ambient, this.Volume, this.PitchVariance);
|
||||
|
||||
public LegacySoundStyle AsSound() => new LegacySoundStyle(this._soundId, this._style, this._styleVariations, SoundType.Sound, this.Volume, this.PitchVariance);
|
||||
|
||||
public bool Includes(int soundId, int style) => this._soundId == soundId && style >= this._style && style < this._style + this._styleVariations;
|
||||
|
||||
public override SoundEffect GetRandomSound() => this.IsTrackable ? Main.trackableSounds[this.Style] : (SoundEffect) null;
|
||||
}
|
||||
}
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,45 +1,45 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Audio.SoundStyle
|
||||
// Assembly: Terraria, Version=1.3.5.3, Culture=neutral, PublicKeyToken=null
|
||||
// MVID: 68659D26-2BE6-448F-8663-74FA559E6F08
|
||||
// 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();
|
||||
}
|
||||
}
|
||||
// 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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Audio.SoundType
|
||||
// Assembly: Terraria, Version=1.3.5.3, Culture=neutral, PublicKeyToken=null
|
||||
// MVID: 68659D26-2BE6-448F-8663-74FA559E6F08
|
||||
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
|
||||
|
||||
namespace Terraria.Audio
|
||||
{
|
||||
public enum SoundType
|
||||
{
|
||||
Sound,
|
||||
Ambient,
|
||||
Music,
|
||||
}
|
||||
}
|
||||
// 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,
|
||||
}
|
||||
}
|
||||
|
|
29
BitsByte.cs
29
BitsByte.cs
|
@ -1,7 +1,7 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.BitsByte
|
||||
// Assembly: Terraria, Version=1.3.5.3, Culture=neutral, PublicKeyToken=null
|
||||
// MVID: 68659D26-2BE6-448F-8663-74FA559E6F08
|
||||
// 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;
|
||||
|
@ -146,30 +146,5 @@ namespace Terraria
|
|||
while (bitsByte[7]);
|
||||
return bitsByteList.ToArray();
|
||||
}
|
||||
|
||||
public static void SortOfAUnitTest()
|
||||
{
|
||||
MemoryStream memoryStream = new MemoryStream();
|
||||
BinaryWriter binaryWriter = new BinaryWriter((Stream) memoryStream);
|
||||
BinaryReader reader = new BinaryReader((Stream) memoryStream);
|
||||
bool[] flagArray = new bool[28];
|
||||
flagArray[3] = true;
|
||||
flagArray[14] = true;
|
||||
BitsByte[] bitsByteArray1 = BitsByte.ComposeBitsBytesChain(false, flagArray);
|
||||
foreach (BitsByte bitsByte in bitsByteArray1)
|
||||
{
|
||||
byte num = (byte) bitsByte;
|
||||
binaryWriter.Write(num);
|
||||
}
|
||||
memoryStream.Position = 0L;
|
||||
BitsByte[] bitsByteArray2 = BitsByte.DecomposeBitsBytesChain(reader);
|
||||
string str1 = "";
|
||||
string str2 = "";
|
||||
foreach (BitsByte bitsByte in bitsByteArray1)
|
||||
str1 = str1 + (object) (byte) bitsByte + ", ";
|
||||
foreach (BitsByte bitsByte in bitsByteArray2)
|
||||
str2 = str2 + (object) (byte) bitsByte + ", ";
|
||||
Main.NewText("done");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Chat.ChatCommandId
|
||||
// Assembly: Terraria, Version=1.3.5.3, Culture=neutral, PublicKeyToken=null
|
||||
// MVID: 68659D26-2BE6-448F-8663-74FA559E6F08
|
||||
// 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;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Chat.ChatCommandProcessor
|
||||
// Assembly: Terraria, Version=1.3.5.3, Culture=neutral, PublicKeyToken=null
|
||||
// MVID: 68659D26-2BE6-448F-8663-74FA559E6F08
|
||||
// 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;
|
||||
|
@ -15,8 +15,9 @@ namespace Terraria.Chat
|
|||
{
|
||||
public class ChatCommandProcessor : IChatProcessor
|
||||
{
|
||||
private Dictionary<LocalizedText, ChatCommandId> _localizedCommands = new Dictionary<LocalizedText, ChatCommandId>();
|
||||
private Dictionary<ChatCommandId, IChatCommand> _commands = new Dictionary<ChatCommandId, IChatCommand>();
|
||||
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()
|
||||
|
@ -37,6 +38,8 @@ namespace Terraria.Chat
|
|||
return this;
|
||||
}
|
||||
|
||||
public void AddAlias(LocalizedText text, NetworkText result) => this._aliases[text] = result;
|
||||
|
||||
public ChatCommandProcessor AddDefaultCommand<T>() where T : IChatCommand, new()
|
||||
{
|
||||
this.AddCommand<T>();
|
||||
|
@ -59,29 +62,46 @@ namespace Terraria.Chat
|
|||
return !messageText.StartsWith(str) || messageText.Length == str.Length || messageText[str.Length] != ' ' ? "" : messageText.Substring(str.Length + 1);
|
||||
}
|
||||
|
||||
public bool ProcessOutgoingMessage(ChatMessage message)
|
||||
public ChatMessage CreateOutgoingMessage(string text)
|
||||
{
|
||||
KeyValuePair<LocalizedText, ChatCommandId> keyValuePair = this._localizedCommands.FirstOrDefault<KeyValuePair<LocalizedText, ChatCommandId>>((Func<KeyValuePair<LocalizedText, ChatCommandId>, bool>) (pair => ChatCommandProcessor.HasLocalizedCommand(message, pair.Key)));
|
||||
ChatCommandId commandId = keyValuePair.Value;
|
||||
if (keyValuePair.Key == null)
|
||||
return false;
|
||||
message.SetCommand(commandId);
|
||||
message.Text = ChatCommandProcessor.RemoveCommandPrefix(message.Text, keyValuePair.Key);
|
||||
return true;
|
||||
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 bool ProcessReceivedMessage(ChatMessage message, int clientId)
|
||||
public void ProcessIncomingMessage(ChatMessage message, int clientId)
|
||||
{
|
||||
IChatCommand chatCommand;
|
||||
if (this._commands.TryGetValue(message.CommandId, out chatCommand))
|
||||
{
|
||||
chatCommand.ProcessMessage(message.Text, (byte) clientId);
|
||||
return true;
|
||||
chatCommand.ProcessIncomingMessage(message.Text, (byte) clientId);
|
||||
message.Consume();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (this._defaultCommand == null)
|
||||
return;
|
||||
this._defaultCommand.ProcessIncomingMessage(message.Text, (byte) clientId);
|
||||
message.Consume();
|
||||
}
|
||||
if (this._defaultCommand == null)
|
||||
return false;
|
||||
this._defaultCommand.ProcessMessage(message.Text, (byte) clientId);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
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;
|
||||
}
|
||||
}
|
|
@ -1,25 +1,29 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Chat.ChatMessage
|
||||
// Assembly: Terraria, Version=1.3.5.3, Culture=neutral, PublicKeyToken=null
|
||||
// MVID: 68659D26-2BE6-448F-8663-74FA559E6F08
|
||||
// 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 class ChatMessage
|
||||
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)
|
||||
|
@ -30,11 +34,18 @@ namespace Terraria.Chat
|
|||
|
||||
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() => 0 + this.CommandId.GetMaxSerializedSize() + (4 + Encoding.UTF8.GetByteCount(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)
|
||||
{
|
||||
|
@ -42,8 +53,20 @@ namespace Terraria.Chat
|
|||
return new ChatMessage(reader.ReadString(), commandId);
|
||||
}
|
||||
|
||||
public void SetCommand(ChatCommandId commandId) => this.CommandId = 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 => this.CommandId = ChatCommandId.FromType<T>();
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Chat.Commands.ChatCommandAttribute
|
||||
// Assembly: Terraria, Version=1.3.5.3, Culture=neutral, PublicKeyToken=null
|
||||
// MVID: 68659D26-2BE6-448F-8663-74FA559E6F08
|
||||
// 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, AllowMultiple = false, Inherited = false)]
|
||||
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface, Inherited = false)]
|
||||
public sealed class ChatCommandAttribute : Attribute
|
||||
{
|
||||
public readonly string 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!");
|
||||
}
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Chat.Commands.EmoteCommand
|
||||
// Assembly: Terraria, Version=1.3.5.3, Culture=neutral, PublicKeyToken=null
|
||||
// MVID: 68659D26-2BE6-448F-8663-74FA559E6F08
|
||||
// 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;
|
||||
|
@ -14,12 +14,16 @@ namespace Terraria.Chat.Commands
|
|||
{
|
||||
private static readonly Color RESPONSE_COLOR = new Color(200, 100, 0);
|
||||
|
||||
public void ProcessMessage(string text, byte clientId)
|
||||
public void ProcessIncomingMessage(string text, byte clientId)
|
||||
{
|
||||
if (!(text != ""))
|
||||
return;
|
||||
text = string.Format("*{0} {1}", (object) Main.player[(int) clientId].name, (object) text);
|
||||
NetMessage.BroadcastChatMessage(NetworkText.FromLiteral(text), EmoteCommand.RESPONSE_COLOR);
|
||||
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)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,13 +1,15 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Chat.Commands.IChatCommand
|
||||
// Assembly: Terraria, Version=1.3.5.3, Culture=neutral, PublicKeyToken=null
|
||||
// MVID: 68659D26-2BE6-448F-8663-74FA559E6F08
|
||||
// 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 ProcessMessage(string text, byte clientId);
|
||||
void ProcessIncomingMessage(string text, byte clientId);
|
||||
|
||||
void ProcessOutgoingMessage(ChatMessage message);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Chat.Commands.ListPlayersCommand
|
||||
// Assembly: Terraria, Version=1.3.5.3, Culture=neutral, PublicKeyToken=null
|
||||
// MVID: 68659D26-2BE6-448F-8663-74FA559E6F08
|
||||
// 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;
|
||||
|
@ -17,6 +17,10 @@ namespace Terraria.Chat.Commands
|
|||
{
|
||||
private static readonly Color RESPONSE_COLOR = new Color((int) byte.MaxValue, 240, 20);
|
||||
|
||||
public void ProcessMessage(string text, byte clientId) => NetMessage.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 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)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,13 +1,11 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Chat.Commands.PartyChatCommand
|
||||
// Assembly: Terraria, Version=1.3.5.3, Culture=neutral, PublicKeyToken=null
|
||||
// MVID: 68659D26-2BE6-448F-8663-74FA559E6F08
|
||||
// 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.NetModules;
|
||||
using Terraria.Localization;
|
||||
using Terraria.Net;
|
||||
|
||||
namespace Terraria.Chat.Commands
|
||||
{
|
||||
|
@ -16,7 +14,7 @@ namespace Terraria.Chat.Commands
|
|||
{
|
||||
private static readonly Color ERROR_COLOR = new Color((int) byte.MaxValue, 240, 20);
|
||||
|
||||
public void ProcessMessage(string text, byte clientId)
|
||||
public void ProcessIncomingMessage(string text, byte clientId)
|
||||
{
|
||||
int team = Main.player[(int) clientId].team;
|
||||
Color color = Main.teamColor[team];
|
||||
|
@ -31,18 +29,15 @@ namespace Terraria.Chat.Commands
|
|||
for (int playerId = 0; playerId < (int) byte.MaxValue; ++playerId)
|
||||
{
|
||||
if (Main.player[playerId].team == team)
|
||||
{
|
||||
NetPacket packet = NetTextModule.SerializeServerMessage(NetworkText.FromLiteral(text), color, clientId);
|
||||
NetManager.Instance.SendToClient(packet, playerId);
|
||||
}
|
||||
ChatHelper.SendChatMessageToClientAs(clientId, NetworkText.FromLiteral(text), color, playerId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void SendNoTeamError(byte clientId)
|
||||
public void ProcessOutgoingMessage(ChatMessage message)
|
||||
{
|
||||
NetPacket packet = NetTextModule.SerializeServerMessage(Lang.mp[10].ToNetworkText(), PartyChatCommand.ERROR_COLOR);
|
||||
NetManager.Instance.SendToClient(packet, (int) clientId);
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Chat.Commands.RollCommand
|
||||
// Assembly: Terraria, Version=1.3.5.3, Culture=neutral, PublicKeyToken=null
|
||||
// MVID: 68659D26-2BE6-448F-8663-74FA559E6F08
|
||||
// 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;
|
||||
|
@ -14,12 +14,14 @@ namespace Terraria.Chat.Commands
|
|||
{
|
||||
private static readonly Color RESPONSE_COLOR = new Color((int) byte.MaxValue, 240, 20);
|
||||
|
||||
public string InternalName => "roll";
|
||||
|
||||
public void ProcessMessage(string text, byte clientId)
|
||||
public void ProcessIncomingMessage(string text, byte clientId)
|
||||
{
|
||||
int num = Main.rand.Next(1, 101);
|
||||
NetMessage.BroadcastChatMessage(NetworkText.FromFormattable("*{0} {1} {2}", (object) Main.player[(int) clientId].name, (object) Lang.mp[9].ToNetworkText(), (object) num), RollCommand.RESPONSE_COLOR);
|
||||
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)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,24 +1,20 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Chat.Commands.SayChatCommand
|
||||
// Assembly: Terraria, Version=1.3.5.3, Culture=neutral, PublicKeyToken=null
|
||||
// MVID: 68659D26-2BE6-448F-8663-74FA559E6F08
|
||||
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
|
||||
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
|
||||
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
|
||||
|
||||
using System;
|
||||
using Terraria.GameContent.NetModules;
|
||||
using Terraria.Localization;
|
||||
using Terraria.Net;
|
||||
|
||||
namespace Terraria.Chat.Commands
|
||||
{
|
||||
[ChatCommand("Say")]
|
||||
public class SayChatCommand : IChatCommand
|
||||
{
|
||||
public void ProcessMessage(string text, byte clientId)
|
||||
public void ProcessIncomingMessage(string text, byte clientId) => ChatHelper.BroadcastChatMessageAs(clientId, NetworkText.FromLiteral(text), Main.player[(int) clientId].ChatColor());
|
||||
|
||||
public void ProcessOutgoingMessage(ChatMessage message)
|
||||
{
|
||||
NetPacket packet = NetTextModule.SerializeServerMessage(NetworkText.FromLiteral(text), Main.player[(int) clientId].ChatColor(), clientId);
|
||||
NetManager.Instance.Broadcast(packet);
|
||||
Console.WriteLine("<{0}> {1}", (object) Main.player[(int) clientId].name, (object) text);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Chat.IChatProcessor
|
||||
// Assembly: Terraria, Version=1.3.5.3, Culture=neutral, PublicKeyToken=null
|
||||
// MVID: 68659D26-2BE6-448F-8663-74FA559E6F08
|
||||
// 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
|
||||
{
|
||||
bool ProcessReceivedMessage(ChatMessage message, int clientId);
|
||||
void ProcessIncomingMessage(ChatMessage message, int clientId);
|
||||
|
||||
bool ProcessOutgoingMessage(ChatMessage message);
|
||||
ChatMessage CreateOutgoingMessage(string text);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Cinematics.CinematicManager
|
||||
// Assembly: Terraria, Version=1.3.5.3, Culture=neutral, PublicKeyToken=null
|
||||
// MVID: 68659D26-2BE6-448F-8663-74FA559E6F08
|
||||
// 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;
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Cinematics.DD2Film
|
||||
// Assembly: Terraria, Version=1.3.5.3, Culture=neutral, PublicKeyToken=null
|
||||
// MVID: 68659D26-2BE6-448F-8663-74FA559E6F08
|
||||
// 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;
|
||||
|
||||
|
@ -133,7 +134,7 @@ namespace Terraria.Cinematics
|
|||
}
|
||||
}
|
||||
|
||||
private void OgreSwingSound(FrameEventData evt) => Main.PlaySound(SoundID.DD2_OgreAttack, this._ogre.Center);
|
||||
private void OgreSwingSound(FrameEventData evt) => SoundEngine.PlaySound(SoundID.DD2_OgreAttack, this._ogre.Center);
|
||||
|
||||
private void DryadPortalKnock(FrameEventData evt)
|
||||
{
|
||||
|
@ -143,7 +144,7 @@ namespace Terraria.Cinematics
|
|||
{
|
||||
this._dryad.velocity.Y -= 7f;
|
||||
this._dryad.velocity.X -= 8f;
|
||||
Main.PlaySound(3, (int) this._dryad.Center.X, (int) this._dryad.Center.Y);
|
||||
SoundEngine.PlaySound(3, (int) this._dryad.Center.X, (int) this._dryad.Center.Y);
|
||||
}
|
||||
if (evt.Frame >= 20)
|
||||
{
|
||||
|
@ -187,7 +188,7 @@ namespace Terraria.Cinematics
|
|||
if (this._dryad == null || this._portal == null)
|
||||
return;
|
||||
if (evt.IsFirstFrame)
|
||||
Main.PlaySound(SoundID.DD2_EtherianPortalDryadTouch, this._dryad.Center);
|
||||
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;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Cinematics.Film
|
||||
// Assembly: Terraria, Version=1.3.5.3, Culture=neutral, PublicKeyToken=null
|
||||
// MVID: 68659D26-2BE6-448F-8663-74FA559E6F08
|
||||
// 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;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Cinematics.FrameEvent
|
||||
// Assembly: Terraria, Version=1.3.5.3, Culture=neutral, PublicKeyToken=null
|
||||
// MVID: 68659D26-2BE6-448F-8663-74FA559E6F08
|
||||
// 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
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Cinematics.FrameEventData
|
||||
// Assembly: Terraria, Version=1.3.5.3, Culture=neutral, PublicKeyToken=null
|
||||
// MVID: 68659D26-2BE6-448F-8663-74FA559E6F08
|
||||
// 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
|
||||
|
|
137
Cloud.cs
137
Cloud.cs
|
@ -1,11 +1,12 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Cloud
|
||||
// Assembly: Terraria, Version=1.3.5.3, Culture=neutral, PublicKeyToken=null
|
||||
// MVID: 68659D26-2BE6-448F-8663-74FA559E6F08
|
||||
// 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
|
||||
|
@ -28,9 +29,9 @@ namespace Terraria
|
|||
|
||||
public static void resetClouds()
|
||||
{
|
||||
if (Main.dedServ || Main.cloudLimit < 10)
|
||||
if (Main.dedServ)
|
||||
return;
|
||||
Main.windSpeed = Main.windSpeedSet;
|
||||
Main.windSpeedCurrent = Main.windSpeedTarget;
|
||||
for (int index = 0; index < 200; ++index)
|
||||
Main.cloud[index].active = false;
|
||||
for (int index = 0; index < Main.numClouds; ++index)
|
||||
|
@ -62,15 +63,15 @@ namespace Terraria
|
|||
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) Main.cloudTexture[Main.cloud[index1].type].Width * (double) Main.cloud[index1].scale);
|
||||
Main.cloud[index1].height = (int) ((double) Main.cloudTexture[Main.cloud[index1].type].Height * (double) Main.cloud[index1].scale);
|
||||
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.windSpeed;
|
||||
float num1 = Main.windSpeedCurrent;
|
||||
if (!Main.gameMenu)
|
||||
num1 = Main.windSpeed - Main.player[Main.myPlayer].velocity.X * 0.1f;
|
||||
num1 = Main.windSpeedCurrent - Main.player[Main.myPlayer].velocity.X * 0.1f;
|
||||
int num2 = 0;
|
||||
int num3 = 0;
|
||||
if ((double) num1 > 0.0)
|
||||
|
@ -80,9 +81,9 @@ namespace Terraria
|
|||
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.25));
|
||||
Main.cloud[index1].position.Y -= (float) Cloud.rand.Next((int) ((double) Main.screenHeight * 0.150000005960464));
|
||||
Main.cloud[index1].position.Y -= (float) Cloud.rand.Next((int) ((double) Main.screenHeight * 0.150000005960464));
|
||||
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)
|
||||
{
|
||||
|
@ -92,12 +93,14 @@ namespace Terraria
|
|||
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.200000002980232 || (double) Main.cloud[index1].position.Y < (double) -Main.screenHeight * 0.200000002980232) && (double) Main.numClouds < 50.0)
|
||||
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)
|
||||
|
@ -106,9 +109,9 @@ namespace Terraria
|
|||
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 + 100))
|
||||
if ((double) Main.cloud[index1].position.X > (double) (Main.screenWidth + 400))
|
||||
Main.cloud[index1].Alpha = 1f;
|
||||
if ((double) Main.cloud[index1].position.X + (double) Main.cloudTexture[Main.cloud[index1].type].Width * (double) Main.cloud[index1].scale < -100.0)
|
||||
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)
|
||||
|
@ -122,6 +125,44 @@ namespace Terraria
|
|||
}
|
||||
}
|
||||
|
||||
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;
|
||||
|
@ -181,42 +222,42 @@ namespace Terraria
|
|||
|
||||
public void Update()
|
||||
{
|
||||
if (Main.gameMenu)
|
||||
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)
|
||||
{
|
||||
this.position.X += (float) ((double) Main.windSpeed * (double) this.scale * 3.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
|
||||
{
|
||||
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 += (float) ((double) Main.windSpeed * (double) num1 * 5.0) * (float) Main.dayRate;
|
||||
this.position.X -= (Main.screenPosition.X - Main.screenLastPosition.X) * num1;
|
||||
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;
|
||||
}
|
||||
float num = 600f;
|
||||
if (!this.kill)
|
||||
{
|
||||
if ((double) this.Alpha < 1.0)
|
||||
|
@ -232,7 +273,7 @@ namespace Terraria
|
|||
if ((double) this.Alpha <= 0.0)
|
||||
this.active = false;
|
||||
}
|
||||
if ((double) this.position.X + (double) Main.cloudTexture[this.type].Width * (double) this.scale < -(double) num || (double) this.position.X > (double) Main.screenWidth + (double) num)
|
||||
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)
|
||||
|
@ -244,8 +285,8 @@ namespace Terraria
|
|||
if ((double) this.rotation < -0.02)
|
||||
this.rotation = -0.02f;
|
||||
this.rotation += this.rSpeed;
|
||||
this.width = (int) ((double) Main.cloudTexture[this.type].Width * (double) this.scale);
|
||||
this.height = (int) ((double) Main.cloudTexture[this.type].Height * (double) this.scale);
|
||||
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;
|
||||
|
|
367
Collision.cs
367
Collision.cs
|
@ -1,25 +1,26 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Collision
|
||||
// Assembly: Terraria, Version=1.3.5.3, Culture=neutral, PublicKeyToken=null
|
||||
// MVID: 68659D26-2BE6-448F-8663-74FA559E6F08
|
||||
// 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.DataStructures;
|
||||
using Terraria.ID;
|
||||
|
||||
namespace Terraria
|
||||
{
|
||||
public class Collision
|
||||
{
|
||||
public static bool stair = false;
|
||||
public static bool stairFall = false;
|
||||
public static bool honey = false;
|
||||
public static bool sloping = false;
|
||||
public static bool stair;
|
||||
public static bool stairFall;
|
||||
public static bool honey;
|
||||
public static bool sloping;
|
||||
public static bool landMine = false;
|
||||
public static bool up = false;
|
||||
public static bool down = false;
|
||||
public static bool up;
|
||||
public static bool down;
|
||||
public static float Epsilon = 2.718282f;
|
||||
|
||||
public static Vector2[] CheckLinevLine(Vector2 a1, Vector2 a2, Vector2 b1, Vector2 b2)
|
||||
|
@ -305,6 +306,10 @@ namespace Terraria
|
|||
return flag;
|
||||
}
|
||||
|
||||
public static bool CanHit(Entity source, Entity target) => Collision.CanHit(source.position, source.width, source.height, target.position, target.width, target.height);
|
||||
|
||||
public static bool CanHit(Entity source, NPCAimedTarget target) => Collision.CanHit(source.position, source.width, source.height, target.Position, target.Width, target.Height);
|
||||
|
||||
public static bool CanHit(
|
||||
Vector2 Position1,
|
||||
int Width1,
|
||||
|
@ -376,7 +381,7 @@ namespace Terraria
|
|||
Vector2 Position2,
|
||||
int Width2,
|
||||
int Height2,
|
||||
Utils.PerLinePoint check)
|
||||
Utils.TileActionAttempt check)
|
||||
{
|
||||
int x = (int) (((double) Position1.X + (double) (Width1 / 2)) / 16.0);
|
||||
int y = (int) (((double) Position1.Y + (double) (Height1 / 2)) / 16.0);
|
||||
|
@ -879,7 +884,7 @@ namespace Terraria
|
|||
|
||||
public static bool HitWallSubstep(int x, int y)
|
||||
{
|
||||
if (Main.tile[x, y].wall == (byte) 0)
|
||||
if (Main.tile[x, y].wall == (ushort) 0)
|
||||
return false;
|
||||
bool flag1 = false;
|
||||
if (Main.wallHouse[(int) Main.tile[x, y].wall])
|
||||
|
@ -890,7 +895,7 @@ namespace Terraria
|
|||
{
|
||||
for (int index2 = -1; index2 < 2; ++index2)
|
||||
{
|
||||
if ((index1 != 0 || index2 != 0) && Main.tile[x + index1, y + index2].wall == (byte) 0)
|
||||
if ((index1 != 0 || index2 != 0) && Main.tile[x + index1, y + index2].wall == (ushort) 0)
|
||||
flag1 = true;
|
||||
}
|
||||
}
|
||||
|
@ -934,7 +939,12 @@ namespace Terraria
|
|||
return true;
|
||||
}
|
||||
|
||||
public static bool DrownCollision(Vector2 Position, int Width, int Height, float gravDir = -1f)
|
||||
public static bool DrownCollision(
|
||||
Vector2 Position,
|
||||
int Width,
|
||||
int Height,
|
||||
float gravDir = -1f,
|
||||
bool includeSlopes = false)
|
||||
{
|
||||
Vector2 vector2_1 = new Vector2(Position.X + (float) (Width / 2), Position.Y + (float) (Height / 2));
|
||||
int num1 = 10;
|
||||
|
@ -961,7 +971,7 @@ namespace Terraria
|
|||
for (int index2 = num9; index2 < num10; ++index2)
|
||||
{
|
||||
Tile tile = Main.tile[index1, index2];
|
||||
if (tile != null && tile.liquid > (byte) 0 && !tile.lava() && (index2 != num11 || !tile.active() || !Main.tileSolid[(int) tile.type] || Main.tileSolidTop[(int) tile.type]))
|
||||
if (tile != null && tile.liquid > (byte) 0 && !tile.lava() && (index2 != num11 || !tile.active() || !Main.tileSolid[(int) tile.type] || Main.tileSolidTop[(int) tile.type] || includeSlopes && tile.blockType() != 0))
|
||||
{
|
||||
Vector2 vector2_2;
|
||||
vector2_2.X = (float) (index1 * 16);
|
||||
|
@ -978,6 +988,96 @@ namespace Terraria
|
|||
return false;
|
||||
}
|
||||
|
||||
public static bool IsWorldPointSolid(Vector2 pos)
|
||||
{
|
||||
Point tileCoordinates = pos.ToTileCoordinates();
|
||||
if (!WorldGen.InWorld(tileCoordinates.X, tileCoordinates.Y, 1))
|
||||
return false;
|
||||
Tile tile = Main.tile[tileCoordinates.X, tileCoordinates.Y];
|
||||
if (tile == null || !tile.active() || tile.inActive() || !Main.tileSolid[(int) tile.type])
|
||||
return false;
|
||||
int num1 = tile.blockType();
|
||||
switch (num1)
|
||||
{
|
||||
case 0:
|
||||
return (double) pos.X >= (double) (tileCoordinates.X * 16) && (double) pos.X <= (double) (tileCoordinates.X * 16 + 16) && (double) pos.Y >= (double) (tileCoordinates.Y * 16) && (double) pos.Y <= (double) (tileCoordinates.Y * 16 + 16);
|
||||
case 1:
|
||||
return (double) pos.X >= (double) (tileCoordinates.X * 16) && (double) pos.X <= (double) (tileCoordinates.X * 16 + 16) && (double) pos.Y >= (double) (tileCoordinates.Y * 16 + 8) && (double) pos.Y <= (double) (tileCoordinates.Y * 16 + 16);
|
||||
case 2:
|
||||
case 3:
|
||||
case 4:
|
||||
case 5:
|
||||
if ((double) pos.X < (double) (tileCoordinates.X * 16) && (double) pos.X > (double) (tileCoordinates.X * 16 + 16) && (double) pos.Y < (double) (tileCoordinates.Y * 16) && (double) pos.Y > (double) (tileCoordinates.Y * 16 + 16))
|
||||
return false;
|
||||
float num2 = pos.X % 16f;
|
||||
float num3 = pos.Y % 16f;
|
||||
switch (num1)
|
||||
{
|
||||
case 2:
|
||||
return (double) num3 >= (double) num2;
|
||||
case 3:
|
||||
return (double) num2 + (double) num3 >= 16.0;
|
||||
case 4:
|
||||
return (double) num2 + (double) num3 <= 16.0;
|
||||
case 5:
|
||||
return (double) num3 <= (double) num2;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static bool GetWaterLine(Point pt, out float waterLineHeight) => Collision.GetWaterLine(pt.X, pt.Y, out waterLineHeight);
|
||||
|
||||
public static bool GetWaterLine(int X, int Y, out float waterLineHeight)
|
||||
{
|
||||
waterLineHeight = 0.0f;
|
||||
if (Main.tile[X, Y - 2] == null)
|
||||
Main.tile[X, Y - 2] = new Tile();
|
||||
if (Main.tile[X, Y - 1] == null)
|
||||
Main.tile[X, Y - 1] = new Tile();
|
||||
if (Main.tile[X, Y] == null)
|
||||
Main.tile[X, Y] = new Tile();
|
||||
if (Main.tile[X, Y + 1] == null)
|
||||
Main.tile[X, Y + 1] = new Tile();
|
||||
if (Main.tile[X, Y - 2].liquid > (byte) 0)
|
||||
return false;
|
||||
if (Main.tile[X, Y - 1].liquid > (byte) 0)
|
||||
{
|
||||
waterLineHeight = (float) (Y * 16);
|
||||
waterLineHeight -= (float) ((int) Main.tile[X, Y - 1].liquid / 16);
|
||||
return true;
|
||||
}
|
||||
if (Main.tile[X, Y].liquid > (byte) 0)
|
||||
{
|
||||
waterLineHeight = (float) ((Y + 1) * 16);
|
||||
waterLineHeight -= (float) ((int) Main.tile[X, Y].liquid / 16);
|
||||
return true;
|
||||
}
|
||||
if (Main.tile[X, Y + 1].liquid <= (byte) 0)
|
||||
return false;
|
||||
waterLineHeight = (float) ((Y + 2) * 16);
|
||||
waterLineHeight -= (float) ((int) Main.tile[X, Y + 1].liquid / 16);
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool GetWaterLineIterate(Point pt, out float waterLineHeight) => Collision.GetWaterLineIterate(pt.X, pt.Y, out waterLineHeight);
|
||||
|
||||
public static bool GetWaterLineIterate(int X, int Y, out float waterLineHeight)
|
||||
{
|
||||
waterLineHeight = 0.0f;
|
||||
while (Y > 0 && Framing.GetTileSafely(X, Y).liquid > (byte) 0)
|
||||
--Y;
|
||||
++Y;
|
||||
if (Main.tile[X, Y] == null)
|
||||
Main.tile[X, Y] = new Tile();
|
||||
if (Main.tile[X, Y].liquid <= (byte) 0)
|
||||
return false;
|
||||
waterLineHeight = (float) (Y * 16);
|
||||
waterLineHeight -= (float) ((int) Main.tile[X, Y - 1].liquid / 16);
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool WetCollision(Vector2 Position, int Width, int Height)
|
||||
{
|
||||
Collision.honey = false;
|
||||
|
@ -1212,29 +1312,14 @@ namespace Terraria
|
|||
if ((double) Position.X + (double) Width > (double) vector2_4.X && (double) Position.X < (double) vector2_4.X + 16.0 && (double) Position.Y + (double) Height > (double) vector2_4.Y && (double) Position.Y < (double) vector2_4.Y + (double) num9)
|
||||
{
|
||||
bool flag1 = true;
|
||||
if (Main.tile[index1, index2].slope() > (byte) 0)
|
||||
{
|
||||
if (Main.tile[index1, index2].slope() > (byte) 2)
|
||||
{
|
||||
if (Main.tile[index1, index2].slope() == (byte) 3 && (double) vector2_1.Y + (double) Math.Abs(Velocity.X) + 1.0 >= (double) vector2_4.Y && (double) vector2_1.X >= (double) vector2_4.X)
|
||||
flag1 = true;
|
||||
if (Main.tile[index1, index2].slope() == (byte) 4 && (double) vector2_1.Y + (double) Math.Abs(Velocity.X) + 1.0 >= (double) vector2_4.Y && (double) vector2_1.X + (double) Width <= (double) vector2_4.X + 16.0)
|
||||
flag1 = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Main.tile[index1, index2].slope() == (byte) 1 && (double) vector2_1.Y + (double) Height - (double) Math.Abs(Velocity.X) - 1.0 <= (double) vector2_4.Y + (double) num9 && (double) vector2_1.X >= (double) vector2_4.X)
|
||||
flag1 = true;
|
||||
if (Main.tile[index1, index2].slope() == (byte) 2 && (double) vector2_1.Y + (double) Height - (double) Math.Abs(Velocity.X) - 1.0 <= (double) vector2_4.Y + (double) num9 && (double) vector2_1.X + (double) Width <= (double) vector2_4.X + 16.0)
|
||||
flag1 = true;
|
||||
}
|
||||
}
|
||||
if (TileID.Sets.Platforms[(int) Main.tile[index1, index2].type])
|
||||
{
|
||||
if ((double) Velocity.Y < 0.0)
|
||||
flag1 = false;
|
||||
if ((double) Position.Y + (double) Height < (double) (index2 * 16) || (double) Position.Y + (double) Height - (1.0 + (double) Math.Abs(Velocity.X)) > (double) (index2 * 16 + 16))
|
||||
flag1 = false;
|
||||
if ((Main.tile[index1, index2].slope() == (byte) 1 && (double) Velocity.X >= 0.0 || Main.tile[index1, index2].slope() == (byte) 2 && (double) Velocity.X <= 0.0) && ((double) Position.Y + (double) Height) / 16.0 - 1.0 == (double) index2)
|
||||
flag1 = false;
|
||||
}
|
||||
if (flag1)
|
||||
{
|
||||
|
@ -1548,9 +1633,9 @@ namespace Terraria
|
|||
}
|
||||
else if ((double) vector2_4.X + (double) Width <= (double) vector2_5.X && !Main.tileSolidTop[(int) Main.tile[index1, index2].type])
|
||||
{
|
||||
if (Main.tile[index1 - 1, index2] == null)
|
||||
if (index1 >= 1 && Main.tile[index1 - 1, index2] == null)
|
||||
Main.tile[index1 - 1, index2] = new Tile();
|
||||
if (Main.tile[index1 - 1, index2].slope() != (byte) 2 && Main.tile[index1 - 1, index2].slope() != (byte) 4)
|
||||
if (index1 < 1 || Main.tile[index1 - 1, index2].slope() != (byte) 2 && Main.tile[index1 - 1, index2].slope() != (byte) 4)
|
||||
{
|
||||
num5 = index1;
|
||||
num6 = index2;
|
||||
|
@ -1988,7 +2073,7 @@ label_19:
|
|||
{
|
||||
for (int j = num3; j < num4; ++j)
|
||||
{
|
||||
if (Main.tile[i, j] != null && Main.tile[i, j].slope() == (byte) 0 && !Main.tile[i, j].inActive() && Main.tile[i, j].active() && (Main.tile[i, j].type == (ushort) 32 || Main.tile[i, j].type == (ushort) 37 || Main.tile[i, j].type == (ushort) 48 || Main.tile[i, j].type == (ushort) 232 || Main.tile[i, j].type == (ushort) 53 || Main.tile[i, j].type == (ushort) 57 || Main.tile[i, j].type == (ushort) 58 || Main.tile[i, j].type == (ushort) 69 || Main.tile[i, j].type == (ushort) 76 || Main.tile[i, j].type == (ushort) 112 || Main.tile[i, j].type == (ushort) 116 || Main.tile[i, j].type == (ushort) 123 || Main.tile[i, j].type == (ushort) 224 || Main.tile[i, j].type == (ushort) 234 || Main.tile[i, j].type == (ushort) 352))
|
||||
if (Main.tile[i, j] != null && Main.tile[i, j].slope() == (byte) 0 && !Main.tile[i, j].inActive() && Main.tile[i, j].active() && (Main.tile[i, j].type == (ushort) 32 || Main.tile[i, j].type == (ushort) 37 || Main.tile[i, j].type == (ushort) 48 || Main.tile[i, j].type == (ushort) 232 || Main.tile[i, j].type == (ushort) 53 || Main.tile[i, j].type == (ushort) 57 || Main.tile[i, j].type == (ushort) 58 || Main.tile[i, j].type == (ushort) 69 || Main.tile[i, j].type == (ushort) 76 || Main.tile[i, j].type == (ushort) 112 || Main.tile[i, j].type == (ushort) 116 || Main.tile[i, j].type == (ushort) 123 || Main.tile[i, j].type == (ushort) 224 || Main.tile[i, j].type == (ushort) 234 || Main.tile[i, j].type == (ushort) 352 || Main.tile[i, j].type == (ushort) 484))
|
||||
{
|
||||
Vector2 vector2_2;
|
||||
vector2_2.X = (float) (i * 16);
|
||||
|
@ -2046,9 +2131,11 @@ label_19:
|
|||
if (!fireImmune && (type == 37 || type == 58 || type == 76))
|
||||
num5 = 20;
|
||||
if (type == 48)
|
||||
num5 = 40;
|
||||
if (type == 232)
|
||||
num5 = 60;
|
||||
if (type == 232)
|
||||
num5 = 80;
|
||||
if (type == 484)
|
||||
num5 = 25;
|
||||
return new Vector2((float) num11, (float) num5);
|
||||
}
|
||||
}
|
||||
|
@ -2083,15 +2170,15 @@ label_19:
|
|||
if (Main.tile[index, j] != null)
|
||||
{
|
||||
int type = (int) Main.tile[index, j].type;
|
||||
if (Main.tile[index, j].active() && (type == 135 || type == 210 || type == 442))
|
||||
if (Main.tile[index, j].active() && (type == 135 || type == 210 || type == 443 || type == 442))
|
||||
{
|
||||
Vector2 vector2;
|
||||
vector2.X = (float) (index * 16);
|
||||
vector2.Y = (float) (j * 16 + 12);
|
||||
bool flag1 = false;
|
||||
if (objType == 4)
|
||||
if (type == 442)
|
||||
{
|
||||
if (type == 442)
|
||||
if (objType == 4)
|
||||
{
|
||||
float r1StartX = 0.0f;
|
||||
float r1StartY = 0.0f;
|
||||
|
@ -2135,31 +2222,39 @@ label_19:
|
|||
}
|
||||
if (!flag1 && (double) Position.X + (double) Width > (double) vector2.X && (double) Position.X < (double) vector2.X + 16.0 && (double) Position.Y + (double) Height > (double) vector2.Y && (double) Position.Y < (double) vector2.Y + 4.01)
|
||||
{
|
||||
switch (type)
|
||||
if (type == 210)
|
||||
WorldGen.ExplodeMine(index, j);
|
||||
else if ((double) oldPosition.X + (double) Width <= (double) vector2.X || (double) oldPosition.X >= (double) vector2.X + 16.0 || (double) oldPosition.Y + (double) Height <= (double) vector2.Y || (double) oldPosition.Y >= (double) vector2.Y + 16.01)
|
||||
{
|
||||
case 210:
|
||||
WorldGen.ExplodeMine(index, j);
|
||||
continue;
|
||||
case 442:
|
||||
continue;
|
||||
default:
|
||||
if ((double) oldPosition.X + (double) Width <= (double) vector2.X || (double) oldPosition.X >= (double) vector2.X + 16.0 || (double) oldPosition.Y + (double) Height <= (double) vector2.Y || (double) oldPosition.Y >= (double) vector2.Y + 16.01)
|
||||
if (type == 443)
|
||||
{
|
||||
if (objType == 1)
|
||||
{
|
||||
int num5 = (int) Main.tile[index, j].frameY / 18;
|
||||
bool flag2 = true;
|
||||
if ((num5 == 4 || num5 == 2 || num5 == 3 || num5 == 6) && objType != 1)
|
||||
flag2 = false;
|
||||
if (num5 == 5 && (objType == 1 || objType == 4))
|
||||
flag2 = false;
|
||||
if (flag2)
|
||||
{
|
||||
Wiring.HitSwitch(index, j);
|
||||
NetMessage.SendData(59, number: index, number2: ((float) j));
|
||||
return true;
|
||||
}
|
||||
continue;
|
||||
Wiring.HitSwitch(index, j);
|
||||
NetMessage.SendData(59, number: index, number2: ((float) j));
|
||||
}
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
int num5 = (int) Main.tile[index, j].frameY / 18;
|
||||
bool flag2 = true;
|
||||
if ((num5 == 4 || num5 == 2 || num5 == 3 || num5 == 6 || num5 == 7) && objType != 1)
|
||||
flag2 = false;
|
||||
if (num5 == 5 && (objType == 1 || objType == 4))
|
||||
flag2 = false;
|
||||
if (flag2)
|
||||
{
|
||||
Wiring.HitSwitch(index, j);
|
||||
NetMessage.SendData(59, number: index, number2: ((float) j));
|
||||
if (num5 == 7)
|
||||
{
|
||||
WorldGen.KillTile(index, j);
|
||||
if (Main.netMode == 1)
|
||||
NetMessage.SendData(17, number2: ((float) index), number3: ((float) j));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2266,6 +2361,8 @@ label_19:
|
|||
return Collision.SolidTiles(startX, endX, startY, endY);
|
||||
}
|
||||
|
||||
public static bool SolidTiles(Vector2 position, int width, int height) => Collision.SolidTiles((int) ((double) position.X / 16.0), (int) (((double) position.X + (double) width) / 16.0), (int) ((double) position.Y / 16.0), (int) (((double) position.Y + (double) height) / 16.0));
|
||||
|
||||
public static bool SolidTiles(int startX, int endX, int startY, int endY)
|
||||
{
|
||||
if (startX < 0 || endX >= Main.maxTilesX || startY < 0 || endY >= Main.maxTilesY)
|
||||
|
@ -2313,8 +2410,6 @@ label_19:
|
|||
Main.tile[x, y] = new Tile();
|
||||
if (Main.tile[x, y - 1] == null)
|
||||
Main.tile[x, y - 1] = new Tile();
|
||||
if (Main.tile[x, y].topSlope())
|
||||
flag = true;
|
||||
if (waterWalk && Main.tile[x, y].liquid > (byte) 0 && Main.tile[x, y - 1].liquid == (byte) 0)
|
||||
{
|
||||
int num7 = (int) Main.tile[x, y].liquid / 32 * 2 + 2;
|
||||
|
@ -2390,19 +2485,20 @@ label_19:
|
|||
bool flag5 = true;
|
||||
bool flag6 = true;
|
||||
bool flag7;
|
||||
Tile tile2;
|
||||
bool flag8;
|
||||
if (gravDir == 1)
|
||||
{
|
||||
if (Main.tile[x, index1 - gravDir] == null || Main.tile[x, index1 - (num2 + 1) * gravDir] == null)
|
||||
return;
|
||||
Tile tile2 = Main.tile[x, index1 - gravDir];
|
||||
Tile tile3 = Main.tile[x, index1 - (num2 + 1) * gravDir];
|
||||
flag7 = flag4 && (!tile2.nactive() || !Main.tileSolid[(int) tile2.type] || Main.tileSolidTop[(int) tile2.type] || tile2.slope() == (byte) 1 && (double) position.X + (double) (width / 2) > (double) (x * 16) || tile2.slope() == (byte) 2 && (double) position.X + (double) (width / 2) < (double) (x * 16 + 16) || tile2.halfBrick() && (!tile3.nactive() || !Main.tileSolid[(int) tile3.type] || Main.tileSolidTop[(int) tile3.type]));
|
||||
Tile tile4 = Main.tile[x, index1];
|
||||
Tile tile5 = Main.tile[x, index1 - 1];
|
||||
Tile tile3 = Main.tile[x, index1 - gravDir];
|
||||
Tile tile4 = Main.tile[x, index1 - (num2 + 1) * gravDir];
|
||||
flag7 = flag4 && (!tile3.nactive() || !Main.tileSolid[(int) tile3.type] || Main.tileSolidTop[(int) tile3.type] || tile3.slope() == (byte) 1 && (double) position.X + (double) (width / 2) > (double) (x * 16) || tile3.slope() == (byte) 2 && (double) position.X + (double) (width / 2) < (double) (x * 16 + 16) || tile3.halfBrick() && (!tile4.nactive() || !Main.tileSolid[(int) tile4.type] || Main.tileSolidTop[(int) tile4.type]));
|
||||
Tile tile5 = Main.tile[x, index1];
|
||||
tile2 = Main.tile[x, index1 - 1];
|
||||
if (specialChecksMode == 1)
|
||||
flag6 = tile4.type != (ushort) 16 && tile4.type != (ushort) 18 && tile4.type != (ushort) 134;
|
||||
flag8 = ((!flag5 ? (false ? 1 : 0) : (!tile4.nactive() || tile4.topSlope() && (tile4.slope() != (byte) 1 || (double) position.X + (double) (width / 2) >= (double) (x * 16)) && (tile4.slope() != (byte) 2 || (double) position.X + (double) (width / 2) <= (double) (x * 16 + 16)) || tile4.topSlope() && (double) position.Y + (double) height <= (double) (index1 * 16) || (!Main.tileSolid[(int) tile4.type] || Main.tileSolidTop[(int) tile4.type]) && ((!holdsMatching || (!Main.tileSolidTop[(int) tile4.type] || tile4.frameY != (short) 0) && !TileID.Sets.Platforms[(int) tile4.type] ? 0 : (!Main.tileSolid[(int) tile5.type] ? 1 : (!tile5.nactive() ? 1 : 0))) & (flag6 ? 1 : 0)) == 0 ? (!tile5.halfBrick() ? (false ? 1 : 0) : (tile5.nactive() ? 1 : 0)) : (true ? 1 : 0))) & (!Main.tileSolidTop[(int) tile4.type] ? 1 : (!Main.tileSolidTop[(int) tile5.type] ? 1 : 0))) != 0;
|
||||
flag6 = tile5.type != (ushort) 16 && tile5.type != (ushort) 18 && tile5.type != (ushort) 14 && tile5.type != (ushort) 469 && tile5.type != (ushort) 134;
|
||||
flag8 = ((!flag5 ? (false ? 1 : 0) : (!tile5.nactive() || tile5.topSlope() && (tile5.slope() != (byte) 1 || (double) position.X + (double) (width / 2) >= (double) (x * 16)) && (tile5.slope() != (byte) 2 || (double) position.X + (double) (width / 2) <= (double) (x * 16 + 16)) || tile5.topSlope() && (double) position.Y + (double) height <= (double) (index1 * 16) || (!Main.tileSolid[(int) tile5.type] || Main.tileSolidTop[(int) tile5.type]) && ((!holdsMatching || (!Main.tileSolidTop[(int) tile5.type] || tile5.frameY != (short) 0) && !TileID.Sets.Platforms[(int) tile5.type] ? 0 : (!Main.tileSolid[(int) tile2.type] ? 1 : (!tile2.nactive() ? 1 : 0))) & (flag6 ? 1 : 0)) == 0 ? (!tile2.halfBrick() ? (false ? 1 : 0) : (tile2.nactive() ? 1 : 0)) : (true ? 1 : 0))) & (!Main.tileSolidTop[(int) tile5.type] ? 1 : (!Main.tileSolidTop[(int) tile2.type] ? 1 : 0))) != 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2410,8 +2506,8 @@ label_19:
|
|||
Tile tile7 = Main.tile[x, index1 - (num2 + 1) * gravDir];
|
||||
flag7 = flag4 && (!tile6.nactive() || !Main.tileSolid[(int) tile6.type] || Main.tileSolidTop[(int) tile6.type] || tile6.slope() != (byte) 0 || tile6.halfBrick() && (!tile7.nactive() || !Main.tileSolid[(int) tile7.type] || Main.tileSolidTop[(int) tile7.type]));
|
||||
Tile tile8 = Main.tile[x, index1];
|
||||
Tile tile9 = Main.tile[x, index1 + 1];
|
||||
flag8 = flag5 && (tile8.nactive() && (Main.tileSolid[(int) tile8.type] && !Main.tileSolidTop[(int) tile8.type] || holdsMatching && Main.tileSolidTop[(int) tile8.type] && tile8.frameY == (short) 0 && (!Main.tileSolid[(int) tile9.type] || !tile9.nactive())) || tile9.halfBrick() && tile9.nactive());
|
||||
tile2 = Main.tile[x, index1 + 1];
|
||||
flag8 = flag5 && (tile8.nactive() && (Main.tileSolid[(int) tile8.type] && !Main.tileSolidTop[(int) tile8.type] || holdsMatching && Main.tileSolidTop[(int) tile8.type] && tile8.frameY == (short) 0 && (!Main.tileSolid[(int) tile2.type] || !tile2.nactive())) || tile2.halfBrick() && tile2.nactive());
|
||||
}
|
||||
if ((double) (x * 16) >= (double) vector2.X + (double) width || (double) (x * 16 + 16) <= (double) vector2.X)
|
||||
return;
|
||||
|
@ -2438,7 +2534,7 @@ label_19:
|
|||
}
|
||||
else
|
||||
{
|
||||
if (!(flag8 & flag7 & flag1 & flag3) || Main.tile[x, index1].bottomSlope())
|
||||
if (!(flag8 & flag7 & flag1 & flag3) || Main.tile[x, index1].bottomSlope() || TileID.Sets.Platforms[(int) tile2.type])
|
||||
return;
|
||||
float num5 = (float) (index1 * 16 + 16);
|
||||
if ((double) num5 <= (double) vector2.Y)
|
||||
|
@ -2540,12 +2636,12 @@ label_19:
|
|||
++x2;
|
||||
if (y2 % 16 == 0)
|
||||
++y2;
|
||||
int num3 = x2 / 16 - x1 / 16 + 1;
|
||||
int num3 = x2 / 16 - x1 / 16;
|
||||
int num4 = y2 / 16 - y1 / 16;
|
||||
List<Point> pointList = new List<Point>();
|
||||
int x3 = x1 / 16;
|
||||
int y3 = y1 / 16;
|
||||
for (int x4 = x3; x4 < x3 + num3; ++x4)
|
||||
for (int x4 = x3; x4 <= x3 + num3; ++x4)
|
||||
{
|
||||
if (up)
|
||||
pointList.Add(new Point(x4, y3));
|
||||
|
@ -2564,17 +2660,19 @@ label_19:
|
|||
|
||||
public static void StepConveyorBelt(Entity entity, float gravDir)
|
||||
{
|
||||
Player player = (Player) null;
|
||||
if (entity is Player)
|
||||
{
|
||||
Player player = (Player) entity;
|
||||
player = (Player) entity;
|
||||
if ((double) Math.Abs(player.gfxOffY) > 2.0 || player.grapCount > 0 || player.pulley)
|
||||
return;
|
||||
entity.height -= 5;
|
||||
entity.position.Y += 5f;
|
||||
}
|
||||
int num1 = 0;
|
||||
int num2 = 0;
|
||||
bool flag = false;
|
||||
int y = (int) entity.position.Y;
|
||||
int height = entity.height;
|
||||
int num3 = (int) entity.position.Y + entity.height;
|
||||
entity.Hitbox.Inflate(2, 2);
|
||||
Vector2 topLeft = entity.TopLeft;
|
||||
Vector2 topRight = entity.TopRight;
|
||||
|
@ -2584,63 +2682,71 @@ label_19:
|
|||
Vector2 vector2_1 = new Vector2(0.0001f);
|
||||
foreach (Point point in entityEdgeTiles)
|
||||
{
|
||||
Tile tile = Main.tile[point.X, point.Y];
|
||||
if (tile != null && tile.active() && tile.nactive())
|
||||
if (WorldGen.InWorld(point.X, point.Y) && (player == null || !player.onTrack || point.Y >= num3))
|
||||
{
|
||||
int num3 = TileID.Sets.ConveyorDirection[(int) tile.type];
|
||||
if (num3 != 0)
|
||||
Tile tile = Main.tile[point.X, point.Y];
|
||||
if (tile != null && tile.active() && tile.nactive())
|
||||
{
|
||||
Vector2 lineStart1;
|
||||
Vector2 lineStart2;
|
||||
lineStart1.X = lineStart2.X = (float) (point.X * 16);
|
||||
Vector2 lineEnd1;
|
||||
Vector2 lineEnd2;
|
||||
lineEnd1.X = lineEnd2.X = (float) (point.X * 16 + 16);
|
||||
switch (tile.slope())
|
||||
{
|
||||
case 1:
|
||||
lineStart2.Y = (float) (point.Y * 16);
|
||||
lineEnd2.Y = lineEnd1.Y = lineStart1.Y = (float) (point.Y * 16 + 16);
|
||||
break;
|
||||
case 2:
|
||||
lineEnd2.Y = (float) (point.Y * 16);
|
||||
lineStart2.Y = lineEnd1.Y = lineStart1.Y = (float) (point.Y * 16 + 16);
|
||||
break;
|
||||
case 3:
|
||||
lineEnd1.Y = lineStart2.Y = lineEnd2.Y = (float) (point.Y * 16);
|
||||
lineStart1.Y = (float) (point.Y * 16 + 16);
|
||||
break;
|
||||
case 4:
|
||||
lineStart1.Y = lineStart2.Y = lineEnd2.Y = (float) (point.Y * 16);
|
||||
lineEnd1.Y = (float) (point.Y * 16 + 16);
|
||||
break;
|
||||
default:
|
||||
lineStart2.Y = !tile.halfBrick() ? (lineEnd2.Y = (float) (point.Y * 16)) : (lineEnd2.Y = (float) (point.Y * 16 + 8));
|
||||
lineStart1.Y = lineEnd1.Y = (float) (point.Y * 16 + 16);
|
||||
break;
|
||||
}
|
||||
int num4 = 0;
|
||||
if (!TileID.Sets.Platforms[(int) tile.type] && Collision.CheckAABBvLineCollision2(entity.position - vector2_1, entity.Size + vector2_1 * 2f, lineStart1, lineEnd1))
|
||||
--num4;
|
||||
if (Collision.CheckAABBvLineCollision2(entity.position - vector2_1, entity.Size + vector2_1 * 2f, lineStart2, lineEnd2))
|
||||
++num4;
|
||||
int num4 = TileID.Sets.ConveyorDirection[(int) tile.type];
|
||||
if (num4 != 0)
|
||||
{
|
||||
flag = true;
|
||||
num1 += num3 * num4 * (int) gravDir;
|
||||
if (tile.leftSlope())
|
||||
num2 += (int) gravDir * -num3;
|
||||
if (tile.rightSlope())
|
||||
num2 -= (int) gravDir * -num3;
|
||||
Vector2 lineStart1;
|
||||
Vector2 lineStart2;
|
||||
lineStart1.X = lineStart2.X = (float) (point.X * 16);
|
||||
Vector2 lineEnd1;
|
||||
Vector2 lineEnd2;
|
||||
lineEnd1.X = lineEnd2.X = (float) (point.X * 16 + 16);
|
||||
switch (tile.slope())
|
||||
{
|
||||
case 1:
|
||||
lineStart2.Y = (float) (point.Y * 16);
|
||||
lineEnd2.Y = lineEnd1.Y = lineStart1.Y = (float) (point.Y * 16 + 16);
|
||||
break;
|
||||
case 2:
|
||||
lineEnd2.Y = (float) (point.Y * 16);
|
||||
lineStart2.Y = lineEnd1.Y = lineStart1.Y = (float) (point.Y * 16 + 16);
|
||||
break;
|
||||
case 3:
|
||||
lineEnd1.Y = lineStart2.Y = lineEnd2.Y = (float) (point.Y * 16);
|
||||
lineStart1.Y = (float) (point.Y * 16 + 16);
|
||||
break;
|
||||
case 4:
|
||||
lineStart1.Y = lineStart2.Y = lineEnd2.Y = (float) (point.Y * 16);
|
||||
lineEnd1.Y = (float) (point.Y * 16 + 16);
|
||||
break;
|
||||
default:
|
||||
lineStart2.Y = !tile.halfBrick() ? (lineEnd2.Y = (float) (point.Y * 16)) : (lineEnd2.Y = (float) (point.Y * 16 + 8));
|
||||
lineStart1.Y = lineEnd1.Y = (float) (point.Y * 16 + 16);
|
||||
break;
|
||||
}
|
||||
int num5 = 0;
|
||||
if (!TileID.Sets.Platforms[(int) tile.type] && Collision.CheckAABBvLineCollision2(entity.position - vector2_1, entity.Size + vector2_1 * 2f, lineStart1, lineEnd1))
|
||||
--num5;
|
||||
if (Collision.CheckAABBvLineCollision2(entity.position - vector2_1, entity.Size + vector2_1 * 2f, lineStart2, lineEnd2))
|
||||
++num5;
|
||||
if (num5 != 0)
|
||||
{
|
||||
flag = true;
|
||||
num1 += num4 * num5 * (int) gravDir;
|
||||
if (tile.leftSlope())
|
||||
num2 += (int) gravDir * -num4;
|
||||
if (tile.rightSlope())
|
||||
num2 -= (int) gravDir * -num4;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (entity is Player)
|
||||
{
|
||||
entity.height += 5;
|
||||
entity.position.Y -= 5f;
|
||||
}
|
||||
if (!flag || num1 == 0)
|
||||
return;
|
||||
int num5 = Math.Sign(num1);
|
||||
int num6 = Math.Sign(num2);
|
||||
Vector2 Velocity = Vector2.Normalize(new Vector2((float) num5 * gravDir, (float) num6)) * 2.5f;
|
||||
int num6 = Math.Sign(num1);
|
||||
int num7 = Math.Sign(num2);
|
||||
Vector2 Velocity = Vector2.Normalize(new Vector2((float) num6 * gravDir, (float) num7)) * 2.5f;
|
||||
Vector2 vector2_2 = Collision.TileCollision(entity.position, Velocity, entity.width, entity.height, gravDir: ((int) gravDir));
|
||||
entity.position += vector2_2;
|
||||
Velocity = new Vector2(0.0f, 2.5f * gravDir);
|
||||
|
@ -2854,5 +2960,18 @@ label_19:
|
|||
samples[index] = num2;
|
||||
}
|
||||
}
|
||||
|
||||
public static void AimingLaserScan(
|
||||
Vector2 startPoint,
|
||||
Vector2 endPoint,
|
||||
float samplingWidth,
|
||||
int samplesToTake,
|
||||
out Vector2 vectorTowardsTarget,
|
||||
out float[] samples)
|
||||
{
|
||||
samples = new float[samplesToTake];
|
||||
vectorTowardsTarget = endPoint - startPoint;
|
||||
Collision.LaserScan(startPoint, vectorTowardsTarget.SafeNormalize(Vector2.Zero), samplingWidth, vectorTowardsTarget.Length(), samples);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.CombatText
|
||||
// Assembly: Terraria, Version=1.3.5.3, Culture=neutral, PublicKeyToken=null
|
||||
// MVID: 68659D26-2BE6-448F-8663-74FA559E6F08
|
||||
// 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
|
||||
{
|
||||
|
@ -24,7 +25,7 @@ namespace Terraria
|
|||
public Vector2 velocity;
|
||||
public float alpha;
|
||||
public int alphaDir = 1;
|
||||
public string text;
|
||||
public string text = "";
|
||||
public float scale = 1f;
|
||||
public float rotation;
|
||||
public Color color;
|
||||
|
@ -59,7 +60,7 @@ namespace Terraria
|
|||
int index2 = 0;
|
||||
if (dramatic)
|
||||
index2 = 1;
|
||||
Vector2 vector2 = Main.fontCombatText[index2].MeasureString(text);
|
||||
Vector2 vector2 = FontAssets.CombatText[index2].Value.MeasureString(text);
|
||||
Main.combatText[index1].alpha = 1f;
|
||||
Main.combatText[index1].alphaDir = -1;
|
||||
Main.combatText[index1].active = true;
|
||||
|
@ -107,7 +108,7 @@ namespace Terraria
|
|||
Main.combatText[index].active = false;
|
||||
}
|
||||
|
||||
public static float TargetScale => Main.UIScale / (Main.GameViewMatrix.Zoom.X / Main.ForcedMinimumZoom);
|
||||
public static float TargetScale => 1f;
|
||||
|
||||
public void Update()
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.DataStructures.AnchorData
|
||||
// Assembly: Terraria, Version=1.3.5.3, Culture=neutral, PublicKeyToken=null
|
||||
// MVID: 68659D26-2BE6-448F-8663-74FA559E6F08
|
||||
// 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;
|
||||
|
|
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;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.DataStructures.BufferPool
|
||||
// Assembly: Terraria, Version=1.3.5.3, Culture=neutral, PublicKeyToken=null
|
||||
// MVID: 68659D26-2BE6-448F-8663-74FA559E6F08
|
||||
// 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;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.DataStructures.CachedBuffer
|
||||
// Assembly: Terraria, Version=1.3.5.3, Culture=neutral, PublicKeyToken=null
|
||||
// MVID: 68659D26-2BE6-448F-8663-74FA559E6F08
|
||||
// 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;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.DataStructures.ColorSlidersSet
|
||||
// Assembly: Terraria, Version=1.3.5.3, Culture=neutral, PublicKeyToken=null
|
||||
// MVID: 68659D26-2BE6-448F-8663-74FA559E6F08
|
||||
// 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;
|
||||
|
|
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,
|
||||
}
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.DataStructures.DoubleStack`1
|
||||
// Assembly: Terraria, Version=1.3.5.3, Culture=neutral, PublicKeyToken=null
|
||||
// MVID: 68659D26-2BE6-448F-8663-74FA559E6F08
|
||||
// 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;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.DataStructures.DrawAnimation
|
||||
// Assembly: Terraria, Version=1.3.5.3, Culture=neutral, PublicKeyToken=null
|
||||
// MVID: 68659D26-2BE6-448F-8663-74FA559E6F08
|
||||
// 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;
|
||||
|
@ -20,6 +20,6 @@ namespace Terraria.DataStructures
|
|||
{
|
||||
}
|
||||
|
||||
public virtual Rectangle GetFrame(Texture2D texture) => texture.Frame();
|
||||
public virtual Rectangle GetFrame(Texture2D texture, int frameCounterOverride = -1) => texture.Frame();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.DataStructures.DrawAnimationVertical
|
||||
// Assembly: Terraria, Version=1.3.5.3, Culture=neutral, PublicKeyToken=null
|
||||
// MVID: 68659D26-2BE6-448F-8663-74FA559E6F08
|
||||
// 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;
|
||||
|
@ -11,24 +11,61 @@ namespace Terraria.DataStructures
|
|||
{
|
||||
public class DrawAnimationVertical : DrawAnimation
|
||||
{
|
||||
public DrawAnimationVertical(int ticksperframe, int frameCount)
|
||||
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.Frame < this.FrameCount)
|
||||
return;
|
||||
this.Frame = 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) => texture.Frame(verticalFrames: this.FrameCount, frameY: this.Frame);
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.DataStructures.DrawData
|
||||
// Assembly: Terraria, Version=1.3.5.3, Culture=neutral, PublicKeyToken=null
|
||||
// MVID: 68659D26-2BE6-448F-8663-74FA559E6F08
|
||||
// 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;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.DataStructures.DrillDebugDraw
|
||||
// Assembly: Terraria, Version=1.3.5.3, Culture=neutral, PublicKeyToken=null
|
||||
// MVID: 68659D26-2BE6-448F-8663-74FA559E6F08
|
||||
// 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;
|
||||
|
|
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;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.DataStructures.MethodSequenceListItem
|
||||
// Assembly: Terraria, Version=1.3.5.3, Culture=neutral, PublicKeyToken=null
|
||||
// MVID: 68659D26-2BE6-448F-8663-74FA559E6F08
|
||||
// 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;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.DataStructures.NPCAimedTarget
|
||||
// Assembly: Terraria, Version=1.3.5.3, Culture=neutral, PublicKeyToken=null
|
||||
// MVID: 68659D26-2BE6-448F-8663-74FA559E6F08
|
||||
// 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;
|
||||
|
|
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;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.DataStructures.PlacementHook
|
||||
// Assembly: Terraria, Version=1.3.5.3, Culture=neutral, PublicKeyToken=null
|
||||
// MVID: 68659D26-2BE6-448F-8663-74FA559E6F08
|
||||
// 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;
|
||||
|
@ -10,15 +10,15 @@ namespace Terraria.DataStructures
|
|||
{
|
||||
public struct PlacementHook
|
||||
{
|
||||
public Func<int, int, int, int, int, int> hook;
|
||||
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>) null, 0, 0, false);
|
||||
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> hook,
|
||||
Func<int, int, int, int, int, int, int> hook,
|
||||
int badReturn,
|
||||
int badResponse,
|
||||
bool processedCoordinates)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.DataStructures.PlayerDeathReason
|
||||
// Assembly: Terraria, Version=1.3.5.3, Culture=neutral, PublicKeyToken=null
|
||||
// MVID: 68659D26-2BE6-448F-8663-74FA559E6F08
|
||||
// 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;
|
||||
|
@ -11,45 +11,47 @@ 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;
|
||||
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
|
||||
_sourceOtherIndex = 254
|
||||
};
|
||||
|
||||
public static PlayerDeathReason LegacyDefault() => new PlayerDeathReason()
|
||||
{
|
||||
SourceOtherIndex = (int) byte.MaxValue
|
||||
_sourceOtherIndex = (int) byte.MaxValue
|
||||
};
|
||||
|
||||
public static PlayerDeathReason ByNPC(int index) => new PlayerDeathReason()
|
||||
{
|
||||
SourceNPCIndex = index
|
||||
_sourceNPCIndex = index
|
||||
};
|
||||
|
||||
public static PlayerDeathReason ByCustomReason(string reasonInEnglish) => new PlayerDeathReason()
|
||||
{
|
||||
SourceCustomReason = reasonInEnglish
|
||||
_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
|
||||
_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
|
||||
_sourceOtherIndex = type
|
||||
};
|
||||
|
||||
public static PlayerDeathReason ByProjectile(
|
||||
|
@ -58,49 +60,49 @@ namespace Terraria.DataStructures
|
|||
{
|
||||
PlayerDeathReason playerDeathReason = new PlayerDeathReason()
|
||||
{
|
||||
SourcePlayerIndex = playerIndex,
|
||||
SourceProjectileIndex = projectileIndex,
|
||||
SourceProjectileType = Main.projectile[projectileIndex].type
|
||||
_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;
|
||||
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 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;
|
||||
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);
|
||||
writer.Write((short) this._sourcePlayerIndex);
|
||||
if (bitsByte[1])
|
||||
writer.Write((short) this.SourceNPCIndex);
|
||||
writer.Write((short) this._sourceNPCIndex);
|
||||
if (bitsByte[2])
|
||||
writer.Write((short) this.SourceProjectileIndex);
|
||||
writer.Write((short) this._sourceProjectileIndex);
|
||||
if (bitsByte[3])
|
||||
writer.Write((byte) this.SourceOtherIndex);
|
||||
writer.Write((byte) this._sourceOtherIndex);
|
||||
if (bitsByte[4])
|
||||
writer.Write((short) this.SourceProjectileType);
|
||||
writer.Write((short) this._sourceProjectileType);
|
||||
if (bitsByte[5])
|
||||
writer.Write((short) this.SourceItemType);
|
||||
writer.Write((short) this._sourceItemType);
|
||||
if (bitsByte[6])
|
||||
writer.Write((byte) this.SourceItemPrefix);
|
||||
writer.Write((byte) this._sourceItemPrefix);
|
||||
if (!bitsByte[7])
|
||||
return;
|
||||
writer.Write(this.SourceCustomReason);
|
||||
writer.Write(this._sourceCustomReason);
|
||||
}
|
||||
|
||||
public static PlayerDeathReason FromReader(BinaryReader reader)
|
||||
|
@ -108,21 +110,21 @@ namespace Terraria.DataStructures
|
|||
PlayerDeathReason playerDeathReason = new PlayerDeathReason();
|
||||
BitsByte bitsByte = (BitsByte) reader.ReadByte();
|
||||
if (bitsByte[0])
|
||||
playerDeathReason.SourcePlayerIndex = (int) reader.ReadInt16();
|
||||
playerDeathReason._sourcePlayerIndex = (int) reader.ReadInt16();
|
||||
if (bitsByte[1])
|
||||
playerDeathReason.SourceNPCIndex = (int) reader.ReadInt16();
|
||||
playerDeathReason._sourceNPCIndex = (int) reader.ReadInt16();
|
||||
if (bitsByte[2])
|
||||
playerDeathReason.SourceProjectileIndex = (int) reader.ReadInt16();
|
||||
playerDeathReason._sourceProjectileIndex = (int) reader.ReadInt16();
|
||||
if (bitsByte[3])
|
||||
playerDeathReason.SourceOtherIndex = (int) reader.ReadByte();
|
||||
playerDeathReason._sourceOtherIndex = (int) reader.ReadByte();
|
||||
if (bitsByte[4])
|
||||
playerDeathReason.SourceProjectileType = (int) reader.ReadInt16();
|
||||
playerDeathReason._sourceProjectileType = (int) reader.ReadInt16();
|
||||
if (bitsByte[5])
|
||||
playerDeathReason.SourceItemType = (int) reader.ReadInt16();
|
||||
playerDeathReason._sourceItemType = (int) reader.ReadInt16();
|
||||
if (bitsByte[6])
|
||||
playerDeathReason.SourceItemPrefix = (int) reader.ReadByte();
|
||||
playerDeathReason._sourceItemPrefix = (int) reader.ReadByte();
|
||||
if (bitsByte[7])
|
||||
playerDeathReason.SourceCustomReason = reader.ReadString();
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.DataStructures.Point16
|
||||
// Assembly: Terraria, Version=1.3.5.3, Culture=neutral, PublicKeyToken=null
|
||||
// MVID: 68659D26-2BE6-448F-8663-74FA559E6F08
|
||||
// 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;
|
||||
|
|
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;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.DataStructures.SoundPlaySet
|
||||
// Assembly: Terraria, Version=1.3.5.3, Culture=neutral, PublicKeyToken=null
|
||||
// MVID: 68659D26-2BE6-448F-8663-74FA559E6F08
|
||||
// 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
|
||||
|
|
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();
|
||||
}
|
||||
}
|
|
@ -1,22 +1,25 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.DataStructures.TileEntity
|
||||
// Assembly: Terraria, Version=1.3.5.3, Culture=neutral, PublicKeyToken=null
|
||||
// MVID: 68659D26-2BE6-448F-8663-74FA559E6F08
|
||||
// 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.GameContent.Tile_Entities;
|
||||
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 = 0;
|
||||
public static int TileEntitiesNextID;
|
||||
public int ID;
|
||||
public Point16 Position;
|
||||
public byte type;
|
||||
|
@ -27,8 +30,6 @@ namespace Terraria.DataStructures
|
|||
|
||||
public static event Action _UpdateEnd;
|
||||
|
||||
public static event Action<int, int, int> _NetPlaceEntity;
|
||||
|
||||
public static void Clear()
|
||||
{
|
||||
TileEntity.ByID.Clear();
|
||||
|
@ -52,16 +53,15 @@ namespace Terraria.DataStructures
|
|||
|
||||
public static void InitializeAll()
|
||||
{
|
||||
TETrainingDummy.Initialize();
|
||||
TEItemFrame.Initialize();
|
||||
TELogicSensor.Initialize();
|
||||
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)) || TileEntity._NetPlaceEntity == null)
|
||||
if (!WorldGen.InWorld(x, y) || TileEntity.ByPosition.ContainsKey(new Point16(x, y)))
|
||||
return;
|
||||
TileEntity._NetPlaceEntity(x, y, type);
|
||||
TileEntity.manager.NetPlaceEntity(type, x, y);
|
||||
}
|
||||
|
||||
public virtual void Update()
|
||||
|
@ -76,23 +76,11 @@ namespace Terraria.DataStructures
|
|||
|
||||
public static TileEntity Read(BinaryReader reader, bool networkSend = false)
|
||||
{
|
||||
TileEntity tileEntity = (TileEntity) null;
|
||||
byte num = reader.ReadByte();
|
||||
switch (num)
|
||||
{
|
||||
case 0:
|
||||
tileEntity = (TileEntity) new TETrainingDummy();
|
||||
break;
|
||||
case 1:
|
||||
tileEntity = (TileEntity) new TEItemFrame();
|
||||
break;
|
||||
case 2:
|
||||
tileEntity = (TileEntity) new TELogicSensor();
|
||||
break;
|
||||
}
|
||||
tileEntity.type = num;
|
||||
tileEntity.ReadInner(reader, networkSend);
|
||||
return tileEntity;
|
||||
TileEntity instance = TileEntity.manager.GenerateInstance((int) num);
|
||||
instance.type = num;
|
||||
instance.ReadInner(reader, networkSend);
|
||||
return instance;
|
||||
}
|
||||
|
||||
private void WriteInner(BinaryWriter writer, bool networkSend)
|
||||
|
@ -119,5 +107,113 @@ namespace Terraria.DataStructures
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.DataStructures.TileObjectPreviewData
|
||||
// Assembly: Terraria, Version=1.3.5.3, Culture=neutral, PublicKeyToken=null
|
||||
// MVID: 68659D26-2BE6-448F-8663-74FA559E6F08
|
||||
// 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;
|
||||
|
|
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);
|
||||
}
|
||||
}
|
|
@ -1,12 +1,14 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.DelegateMethods
|
||||
// Assembly: Terraria, Version=1.3.5.3, Culture=neutral, PublicKeyToken=null
|
||||
// MVID: 68659D26-2BE6-448F-8663-74FA559E6F08
|
||||
// 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
|
||||
|
@ -14,9 +16,10 @@ 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 = 0;
|
||||
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);
|
||||
|
@ -29,6 +32,118 @@ namespace Terraria
|
|||
|
||||
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)
|
||||
|
@ -56,6 +171,26 @@ namespace Terraria
|
|||
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)
|
||||
|
@ -216,6 +351,10 @@ namespace Terraria
|
|||
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);
|
||||
|
@ -232,6 +371,24 @@ namespace Terraria
|
|||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.DeprecatedClassLeftInForLoading
|
||||
// Assembly: Terraria, Version=1.3.5.3, Culture=neutral, PublicKeyToken=null
|
||||
// MVID: 68659D26-2BE6-448F-8663-74FA559E6F08
|
||||
// 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;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Entity
|
||||
// Assembly: Terraria, Version=1.3.5.3, Culture=neutral, PublicKeyToken=null
|
||||
// MVID: 68659D26-2BE6-448F-8663-74FA559E6F08
|
||||
// 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;
|
||||
|
@ -26,6 +26,8 @@ namespace Terraria
|
|||
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);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Enums.AnchorType
|
||||
// Assembly: Terraria, Version=1.3.5.3, Culture=neutral, PublicKeyToken=null
|
||||
// MVID: 68659D26-2BE6-448F-8663-74FA559E6F08
|
||||
// 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;
|
||||
|
|
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