Terraria 1.3.5.3 Source Code
This commit is contained in:
commit
4b21dac4b6
503 changed files with 409032 additions and 0 deletions
138
Achievements/Achievement.cs
Normal file
138
Achievements/Achievement.cs
Normal file
|
@ -0,0 +1,138 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Achievements.Achievement
|
||||
// Assembly: Terraria, Version=1.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);
|
||||
}
|
||||
}
|
17
Achievements/AchievementCategory.cs
Normal file
17
Achievements/AchievementCategory.cs
Normal file
|
@ -0,0 +1,17 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Achievements.AchievementCategory
|
||||
// Assembly: Terraria, Version=1.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,
|
||||
}
|
||||
}
|
51
Achievements/AchievementCondition.cs
Normal file
51
Achievements/AchievementCondition.cs
Normal file
|
@ -0,0 +1,51 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Achievements.AchievementCondition
|
||||
// Assembly: Terraria, Version=1.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);
|
||||
}
|
||||
}
|
177
Achievements/AchievementManager.cs
Normal file
177
Achievements/AchievementManager.cs
Normal file
|
@ -0,0 +1,177 @@
|
|||
// 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;
|
||||
}
|
||||
}
|
||||
}
|
56
Achievements/AchievementTracker`1.cs
Normal file
56
Achievements/AchievementTracker`1.cs
Normal file
|
@ -0,0 +1,56 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Achievements.AchievementTracker`1
|
||||
// Assembly: Terraria, Version=1.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();
|
||||
}
|
||||
}
|
||||
}
|
35
Achievements/ConditionFloatTracker.cs
Normal file
35
Achievements/ConditionFloatTracker.cs
Normal file
|
@ -0,0 +1,35 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Achievements.ConditionFloatTracker
|
||||
// Assembly: Terraria, Version=1.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()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
35
Achievements/ConditionIntTracker.cs
Normal file
35
Achievements/ConditionIntTracker.cs
Normal file
|
@ -0,0 +1,35 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Achievements.ConditionIntTracker
|
||||
// Assembly: Terraria, Version=1.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()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
34
Achievements/ConditionsCompletedTracker.cs
Normal file
34
Achievements/ConditionsCompletedTracker.cs
Normal file
|
@ -0,0 +1,34 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Achievements.ConditionsCompletedTracker
|
||||
// Assembly: Terraria, Version=1.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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
19
Achievements/IAchievementTracker.cs
Normal file
19
Achievements/IAchievementTracker.cs
Normal file
|
@ -0,0 +1,19 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Achievements.IAchievementTracker
|
||||
// Assembly: Terraria, Version=1.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();
|
||||
}
|
||||
}
|
14
Achievements/TrackerType.cs
Normal file
14
Achievements/TrackerType.cs
Normal file
|
@ -0,0 +1,14 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Achievements.TrackerType
|
||||
// Assembly: Terraria, Version=1.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,
|
||||
}
|
||||
}
|
150
Animation.cs
Normal file
150
Animation.cs
Normal file
|
@ -0,0 +1,150 @@
|
|||
// 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 location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
|
||||
|
||||
using System.Collections.Generic;
|
||||
using Terraria.DataStructures;
|
||||
|
||||
namespace Terraria
|
||||
{
|
||||
public class Animation
|
||||
{
|
||||
private static List<Animation> _animations;
|
||||
private static Dictionary<Point16, Animation> _temporaryAnimations;
|
||||
private static List<Point16> _awaitingRemoval;
|
||||
private static List<Animation> _awaitingAddition;
|
||||
private bool _temporary;
|
||||
private Point16 _coordinates;
|
||||
private ushort _tileType;
|
||||
private int _frame;
|
||||
private int _frameMax;
|
||||
private int _frameCounter;
|
||||
private int _frameCounterMax;
|
||||
private int[] _frameData;
|
||||
|
||||
public static void Initialize()
|
||||
{
|
||||
Animation._animations = new List<Animation>();
|
||||
Animation._temporaryAnimations = new Dictionary<Point16, Animation>();
|
||||
Animation._awaitingRemoval = new List<Point16>();
|
||||
Animation._awaitingAddition = new List<Animation>();
|
||||
}
|
||||
|
||||
private void SetDefaults(int type)
|
||||
{
|
||||
this._tileType = (ushort) 0;
|
||||
this._frame = 0;
|
||||
this._frameMax = 0;
|
||||
this._frameCounter = 0;
|
||||
this._frameCounterMax = 0;
|
||||
this._temporary = false;
|
||||
switch (type)
|
||||
{
|
||||
case 0:
|
||||
this._frameMax = 5;
|
||||
this._frameCounterMax = 12;
|
||||
this._frameData = new int[this._frameMax];
|
||||
for (int index = 0; index < this._frameMax; ++index)
|
||||
this._frameData[index] = index + 1;
|
||||
break;
|
||||
case 1:
|
||||
this._frameMax = 5;
|
||||
this._frameCounterMax = 12;
|
||||
this._frameData = new int[this._frameMax];
|
||||
for (int index = 0; index < this._frameMax; ++index)
|
||||
this._frameData[index] = 5 - index;
|
||||
break;
|
||||
case 2:
|
||||
this._frameCounterMax = 6;
|
||||
this._frameData = new int[5]{ 1, 2, 2, 2, 1 };
|
||||
this._frameMax = this._frameData.Length;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public static void NewTemporaryAnimation(int type, ushort tileType, int x, int y)
|
||||
{
|
||||
Point16 point16 = new Point16(x, y);
|
||||
if (x < 0 || x >= Main.maxTilesX || y < 0 || y >= Main.maxTilesY)
|
||||
return;
|
||||
Animation animation = new Animation();
|
||||
animation.SetDefaults(type);
|
||||
animation._tileType = tileType;
|
||||
animation._coordinates = point16;
|
||||
animation._temporary = true;
|
||||
Animation._awaitingAddition.Add(animation);
|
||||
if (Main.netMode != 2)
|
||||
return;
|
||||
NetMessage.SendTemporaryAnimation(-1, type, (int) tileType, x, y);
|
||||
}
|
||||
|
||||
private static void RemoveTemporaryAnimation(short x, short y)
|
||||
{
|
||||
Point16 key = new Point16(x, y);
|
||||
if (!Animation._temporaryAnimations.ContainsKey(key))
|
||||
return;
|
||||
Animation._awaitingRemoval.Add(key);
|
||||
}
|
||||
|
||||
public static void UpdateAll()
|
||||
{
|
||||
for (int index = 0; index < Animation._animations.Count; ++index)
|
||||
Animation._animations[index].Update();
|
||||
if (Animation._awaitingAddition.Count > 0)
|
||||
{
|
||||
for (int index = 0; index < Animation._awaitingAddition.Count; ++index)
|
||||
{
|
||||
Animation animation = Animation._awaitingAddition[index];
|
||||
Animation._temporaryAnimations[animation._coordinates] = animation;
|
||||
}
|
||||
Animation._awaitingAddition.Clear();
|
||||
}
|
||||
foreach (KeyValuePair<Point16, Animation> temporaryAnimation in Animation._temporaryAnimations)
|
||||
temporaryAnimation.Value.Update();
|
||||
if (Animation._awaitingRemoval.Count <= 0)
|
||||
return;
|
||||
for (int index = 0; index < Animation._awaitingRemoval.Count; ++index)
|
||||
Animation._temporaryAnimations.Remove(Animation._awaitingRemoval[index]);
|
||||
Animation._awaitingRemoval.Clear();
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
if (this._temporary)
|
||||
{
|
||||
Tile tile = Main.tile[(int) this._coordinates.X, (int) this._coordinates.Y];
|
||||
if (tile != null && (int) tile.type != (int) this._tileType)
|
||||
{
|
||||
Animation.RemoveTemporaryAnimation(this._coordinates.X, this._coordinates.Y);
|
||||
return;
|
||||
}
|
||||
}
|
||||
++this._frameCounter;
|
||||
if (this._frameCounter < this._frameCounterMax)
|
||||
return;
|
||||
this._frameCounter = 0;
|
||||
++this._frame;
|
||||
if (this._frame < this._frameMax)
|
||||
return;
|
||||
this._frame = 0;
|
||||
if (!this._temporary)
|
||||
return;
|
||||
Animation.RemoveTemporaryAnimation(this._coordinates.X, this._coordinates.Y);
|
||||
}
|
||||
|
||||
public static bool GetTemporaryFrame(int x, int y, out int frameData)
|
||||
{
|
||||
Point16 key = new Point16(x, y);
|
||||
Animation animation;
|
||||
if (!Animation._temporaryAnimations.TryGetValue(key, out animation))
|
||||
{
|
||||
frameData = 0;
|
||||
return false;
|
||||
}
|
||||
frameData = animation._frameData[animation._frame];
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
17
AssemblyInfo.cs
Normal file
17
AssemblyInfo.cs
Normal file
|
@ -0,0 +1,17 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Security.Permissions;
|
||||
|
||||
[assembly: Extension]
|
||||
[assembly: AssemblyTitle("Terraria")]
|
||||
[assembly: AssemblyProduct("Terraria")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyCompany("Re-Logic")]
|
||||
[assembly: AssemblyCopyright("Copyright © Re-Logic 2017")]
|
||||
[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: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
|
101
Audio/ActiveSound.cs
Normal file
101
Audio/ActiveSound.cs
Normal file
|
@ -0,0 +1,101 @@
|
|||
// 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);
|
||||
}
|
||||
}
|
||||
}
|
41
Audio/CustomSoundStyle.cs
Normal file
41
Audio/CustomSoundStyle.cs
Normal file
|
@ -0,0 +1,41 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Audio.CustomSoundStyle
|
||||
// Assembly: Terraria, Version=1.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)];
|
||||
}
|
||||
}
|
71
Audio/LegacySoundStyle.cs
Normal file
71
Audio/LegacySoundStyle.cs
Normal file
|
@ -0,0 +1,71 @@
|
|||
// 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;
|
||||
}
|
||||
}
|
45
Audio/SoundStyle.cs
Normal file
45
Audio/SoundStyle.cs
Normal file
|
@ -0,0 +1,45 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Audio.SoundStyle
|
||||
// Assembly: Terraria, Version=1.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();
|
||||
}
|
||||
}
|
15
Audio/SoundType.cs
Normal file
15
Audio/SoundType.cs
Normal file
|
@ -0,0 +1,15 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Audio.SoundType
|
||||
// Assembly: Terraria, Version=1.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,
|
||||
}
|
||||
}
|
175
BitsByte.cs
Normal file
175
BitsByte.cs
Normal file
|
@ -0,0 +1,175 @@
|
|||
// 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 location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
||||
namespace Terraria
|
||||
{
|
||||
public struct BitsByte
|
||||
{
|
||||
private static bool Null;
|
||||
private byte value;
|
||||
|
||||
public BitsByte(bool b1 = false, bool b2 = false, bool b3 = false, bool b4 = false, bool b5 = false, bool b6 = false, bool b7 = false, bool b8 = false)
|
||||
{
|
||||
this.value = (byte) 0;
|
||||
this[0] = b1;
|
||||
this[1] = b2;
|
||||
this[2] = b3;
|
||||
this[3] = b4;
|
||||
this[4] = b5;
|
||||
this[5] = b6;
|
||||
this[6] = b7;
|
||||
this[7] = b8;
|
||||
}
|
||||
|
||||
public void ClearAll() => this.value = (byte) 0;
|
||||
|
||||
public void SetAll() => this.value = byte.MaxValue;
|
||||
|
||||
public bool this[int key]
|
||||
{
|
||||
get => ((uint) this.value & (uint) (1 << key)) > 0U;
|
||||
set
|
||||
{
|
||||
if (value)
|
||||
this.value |= (byte) (1 << key);
|
||||
else
|
||||
this.value &= (byte) ~(1 << key);
|
||||
}
|
||||
}
|
||||
|
||||
public void Retrieve(ref bool b0) => this.Retrieve(ref b0, ref BitsByte.Null, ref BitsByte.Null, ref BitsByte.Null, ref BitsByte.Null, ref BitsByte.Null, ref BitsByte.Null, ref BitsByte.Null);
|
||||
|
||||
public void Retrieve(ref bool b0, ref bool b1) => this.Retrieve(ref b0, ref b1, ref BitsByte.Null, ref BitsByte.Null, ref BitsByte.Null, ref BitsByte.Null, ref BitsByte.Null, ref BitsByte.Null);
|
||||
|
||||
public void Retrieve(ref bool b0, ref bool b1, ref bool b2) => this.Retrieve(ref b0, ref b1, ref b2, ref BitsByte.Null, ref BitsByte.Null, ref BitsByte.Null, ref BitsByte.Null, ref BitsByte.Null);
|
||||
|
||||
public void Retrieve(ref bool b0, ref bool b1, ref bool b2, ref bool b3) => this.Retrieve(ref b0, ref b1, ref b2, ref b3, ref BitsByte.Null, ref BitsByte.Null, ref BitsByte.Null, ref BitsByte.Null);
|
||||
|
||||
public void Retrieve(ref bool b0, ref bool b1, ref bool b2, ref bool b3, ref bool b4) => this.Retrieve(ref b0, ref b1, ref b2, ref b3, ref b4, ref BitsByte.Null, ref BitsByte.Null, ref BitsByte.Null);
|
||||
|
||||
public void Retrieve(
|
||||
ref bool b0,
|
||||
ref bool b1,
|
||||
ref bool b2,
|
||||
ref bool b3,
|
||||
ref bool b4,
|
||||
ref bool b5)
|
||||
{
|
||||
this.Retrieve(ref b0, ref b1, ref b2, ref b3, ref b4, ref b5, ref BitsByte.Null, ref BitsByte.Null);
|
||||
}
|
||||
|
||||
public void Retrieve(
|
||||
ref bool b0,
|
||||
ref bool b1,
|
||||
ref bool b2,
|
||||
ref bool b3,
|
||||
ref bool b4,
|
||||
ref bool b5,
|
||||
ref bool b6)
|
||||
{
|
||||
this.Retrieve(ref b0, ref b1, ref b2, ref b3, ref b4, ref b5, ref b6, ref BitsByte.Null);
|
||||
}
|
||||
|
||||
public void Retrieve(
|
||||
ref bool b0,
|
||||
ref bool b1,
|
||||
ref bool b2,
|
||||
ref bool b3,
|
||||
ref bool b4,
|
||||
ref bool b5,
|
||||
ref bool b6,
|
||||
ref bool b7)
|
||||
{
|
||||
b0 = this[0];
|
||||
b1 = this[1];
|
||||
b2 = this[2];
|
||||
b3 = this[3];
|
||||
b4 = this[4];
|
||||
b5 = this[5];
|
||||
b6 = this[6];
|
||||
b7 = this[7];
|
||||
}
|
||||
|
||||
public static implicit operator byte(BitsByte bb) => bb.value;
|
||||
|
||||
public static implicit operator BitsByte(byte b) => new BitsByte()
|
||||
{
|
||||
value = b
|
||||
};
|
||||
|
||||
public static BitsByte[] ComposeBitsBytesChain(bool optimizeLength, params bool[] flags)
|
||||
{
|
||||
int length1 = flags.Length;
|
||||
int length2 = 0;
|
||||
for (; length1 > 0; length1 -= 7)
|
||||
++length2;
|
||||
BitsByte[] array = new BitsByte[length2];
|
||||
int key = 0;
|
||||
int index1 = 0;
|
||||
for (int index2 = 0; index2 < flags.Length; ++index2)
|
||||
{
|
||||
array[index1][key] = flags[index2];
|
||||
++key;
|
||||
if (key == 7 && index1 < length2 - 1)
|
||||
{
|
||||
array[index1][key] = true;
|
||||
key = 0;
|
||||
++index1;
|
||||
}
|
||||
}
|
||||
if (optimizeLength)
|
||||
{
|
||||
int index3;
|
||||
for (index3 = array.Length - 1; (byte) array[index3] == (byte) 0 && index3 > 0; --index3)
|
||||
array[index3 - 1][7] = false;
|
||||
Array.Resize<BitsByte>(ref array, index3 + 1);
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
public static BitsByte[] DecomposeBitsBytesChain(BinaryReader reader)
|
||||
{
|
||||
List<BitsByte> bitsByteList = new List<BitsByte>();
|
||||
BitsByte bitsByte;
|
||||
do
|
||||
{
|
||||
bitsByte = (BitsByte) reader.ReadByte();
|
||||
bitsByteList.Add(bitsByte);
|
||||
}
|
||||
while (bitsByte[7]);
|
||||
return bitsByteList.ToArray();
|
||||
}
|
||||
|
||||
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");
|
||||
}
|
||||
}
|
||||
}
|
32
Chat/ChatCommandId.cs
Normal file
32
Chat/ChatCommandId.cs
Normal file
|
@ -0,0 +1,32 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Chat.ChatCommandId
|
||||
// Assembly: Terraria, Version=1.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 ReLogic.Utilities;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using Terraria.Chat.Commands;
|
||||
|
||||
namespace Terraria.Chat
|
||||
{
|
||||
public struct ChatCommandId
|
||||
{
|
||||
private readonly string _name;
|
||||
|
||||
private ChatCommandId(string name) => this._name = name;
|
||||
|
||||
public static ChatCommandId FromType<T>() where T : IChatCommand
|
||||
{
|
||||
ChatCommandAttribute cacheableAttribute = AttributeUtilities.GetCacheableAttribute<T, ChatCommandAttribute>();
|
||||
return cacheableAttribute != null ? new ChatCommandId(cacheableAttribute.Name) : new ChatCommandId((string) null);
|
||||
}
|
||||
|
||||
public void Serialize(BinaryWriter writer) => writer.Write(this._name ?? "");
|
||||
|
||||
public static ChatCommandId Deserialize(BinaryReader reader) => new ChatCommandId(reader.ReadString());
|
||||
|
||||
public int GetMaxSerializedSize() => 4 + Encoding.UTF8.GetByteCount(this._name ?? "");
|
||||
}
|
||||
}
|
87
Chat/ChatCommandProcessor.cs
Normal file
87
Chat/ChatCommandProcessor.cs
Normal file
|
@ -0,0 +1,87 @@
|
|||
// 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 location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
|
||||
|
||||
using ReLogic.Utilities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Terraria.Chat.Commands;
|
||||
using Terraria.Localization;
|
||||
|
||||
namespace Terraria.Chat
|
||||
{
|
||||
public class ChatCommandProcessor : IChatProcessor
|
||||
{
|
||||
private Dictionary<LocalizedText, ChatCommandId> _localizedCommands = new Dictionary<LocalizedText, ChatCommandId>();
|
||||
private Dictionary<ChatCommandId, IChatCommand> _commands = new Dictionary<ChatCommandId, IChatCommand>();
|
||||
private IChatCommand _defaultCommand;
|
||||
|
||||
public ChatCommandProcessor AddCommand<T>() where T : IChatCommand, new()
|
||||
{
|
||||
string commandKey = "ChatCommand." + AttributeUtilities.GetCacheableAttribute<T, ChatCommandAttribute>().Name;
|
||||
ChatCommandId key1 = ChatCommandId.FromType<T>();
|
||||
this._commands[key1] = (IChatCommand) new T();
|
||||
if (Language.Exists(commandKey))
|
||||
{
|
||||
this._localizedCommands.Add(Language.GetText(commandKey), key1);
|
||||
}
|
||||
else
|
||||
{
|
||||
commandKey += "_";
|
||||
foreach (LocalizedText key2 in Language.FindAll((LanguageSearchFilter) ((key, text) => key.StartsWith(commandKey))))
|
||||
this._localizedCommands.Add(key2, key1);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public ChatCommandProcessor AddDefaultCommand<T>() where T : IChatCommand, new()
|
||||
{
|
||||
this.AddCommand<T>();
|
||||
this._defaultCommand = this._commands[ChatCommandId.FromType<T>()];
|
||||
return this;
|
||||
}
|
||||
|
||||
private static bool HasLocalizedCommand(ChatMessage message, LocalizedText command)
|
||||
{
|
||||
string lower = message.Text.ToLower();
|
||||
string str = command.Value;
|
||||
if (!lower.StartsWith(str))
|
||||
return false;
|
||||
return lower.Length == str.Length || lower[str.Length] == ' ';
|
||||
}
|
||||
|
||||
private static string RemoveCommandPrefix(string messageText, LocalizedText command)
|
||||
{
|
||||
string str = command.Value;
|
||||
return !messageText.StartsWith(str) || messageText.Length == str.Length || messageText[str.Length] != ' ' ? "" : messageText.Substring(str.Length + 1);
|
||||
}
|
||||
|
||||
public bool ProcessOutgoingMessage(ChatMessage message)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
public bool ProcessReceivedMessage(ChatMessage message, int clientId)
|
||||
{
|
||||
IChatCommand chatCommand;
|
||||
if (this._commands.TryGetValue(message.CommandId, out chatCommand))
|
||||
{
|
||||
chatCommand.ProcessMessage(message.Text, (byte) clientId);
|
||||
return true;
|
||||
}
|
||||
if (this._defaultCommand == null)
|
||||
return false;
|
||||
this._defaultCommand.ProcessMessage(message.Text, (byte) clientId);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
49
Chat/ChatMessage.cs
Normal file
49
Chat/ChatMessage.cs
Normal file
|
@ -0,0 +1,49 @@
|
|||
// 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 location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
|
||||
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using Terraria.Chat.Commands;
|
||||
|
||||
namespace Terraria.Chat
|
||||
{
|
||||
public class ChatMessage
|
||||
{
|
||||
public ChatCommandId CommandId { get; private set; }
|
||||
|
||||
public string Text { get; set; }
|
||||
|
||||
public ChatMessage(string message)
|
||||
{
|
||||
this.CommandId = ChatCommandId.FromType<SayChatCommand>();
|
||||
this.Text = message;
|
||||
}
|
||||
|
||||
private ChatMessage(string message, ChatCommandId commandId)
|
||||
{
|
||||
this.CommandId = commandId;
|
||||
this.Text = message;
|
||||
}
|
||||
|
||||
public void Serialize(BinaryWriter writer)
|
||||
{
|
||||
this.CommandId.Serialize(writer);
|
||||
writer.Write(this.Text);
|
||||
}
|
||||
|
||||
public int GetMaxSerializedSize() => 0 + this.CommandId.GetMaxSerializedSize() + (4 + Encoding.UTF8.GetByteCount(this.Text));
|
||||
|
||||
public static ChatMessage Deserialize(BinaryReader reader)
|
||||
{
|
||||
ChatCommandId commandId = ChatCommandId.Deserialize(reader);
|
||||
return new ChatMessage(reader.ReadString(), commandId);
|
||||
}
|
||||
|
||||
public void SetCommand(ChatCommandId commandId) => this.CommandId = commandId;
|
||||
|
||||
public void SetCommand<T>() where T : IChatCommand => this.CommandId = ChatCommandId.FromType<T>();
|
||||
}
|
||||
}
|
18
Chat/Commands/ChatCommandAttribute.cs
Normal file
18
Chat/Commands/ChatCommandAttribute.cs
Normal file
|
@ -0,0 +1,18 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Chat.Commands.ChatCommandAttribute
|
||||
// Assembly: Terraria, Version=1.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;
|
||||
|
||||
namespace Terraria.Chat.Commands
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface, AllowMultiple = false, Inherited = false)]
|
||||
public sealed class ChatCommandAttribute : Attribute
|
||||
{
|
||||
public readonly string Name;
|
||||
|
||||
public ChatCommandAttribute(string name) => this.Name = name;
|
||||
}
|
||||
}
|
25
Chat/Commands/EmoteCommand.cs
Normal file
25
Chat/Commands/EmoteCommand.cs
Normal file
|
@ -0,0 +1,25 @@
|
|||
// 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 location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
|
||||
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria.Localization;
|
||||
|
||||
namespace Terraria.Chat.Commands
|
||||
{
|
||||
[ChatCommand("Emote")]
|
||||
public class EmoteCommand : IChatCommand
|
||||
{
|
||||
private static readonly Color RESPONSE_COLOR = new Color(200, 100, 0);
|
||||
|
||||
public void ProcessMessage(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);
|
||||
}
|
||||
}
|
||||
}
|
13
Chat/Commands/IChatCommand.cs
Normal file
13
Chat/Commands/IChatCommand.cs
Normal file
|
@ -0,0 +1,13 @@
|
|||
// 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 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);
|
||||
}
|
||||
}
|
22
Chat/Commands/ListPlayersCommand.cs
Normal file
22
Chat/Commands/ListPlayersCommand.cs
Normal file
|
@ -0,0 +1,22 @@
|
|||
// 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 location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
|
||||
|
||||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Terraria.Localization;
|
||||
|
||||
namespace Terraria.Chat.Commands
|
||||
{
|
||||
[ChatCommand("Playing")]
|
||||
public class ListPlayersCommand : IChatCommand
|
||||
{
|
||||
private static readonly Color RESPONSE_COLOR = new Color((int) byte.MaxValue, 240, 20);
|
||||
|
||||
public void 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);
|
||||
}
|
||||
}
|
48
Chat/Commands/PartyChatCommand.cs
Normal file
48
Chat/Commands/PartyChatCommand.cs
Normal file
|
@ -0,0 +1,48 @@
|
|||
// 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 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
|
||||
{
|
||||
[ChatCommand("Party")]
|
||||
public class PartyChatCommand : IChatCommand
|
||||
{
|
||||
private static readonly Color ERROR_COLOR = new Color((int) byte.MaxValue, 240, 20);
|
||||
|
||||
public void ProcessMessage(string text, byte clientId)
|
||||
{
|
||||
int team = Main.player[(int) clientId].team;
|
||||
Color color = Main.teamColor[team];
|
||||
if (team == 0)
|
||||
{
|
||||
this.SendNoTeamError(clientId);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (text == "")
|
||||
return;
|
||||
for (int playerId = 0; playerId < (int) byte.MaxValue; ++playerId)
|
||||
{
|
||||
if (Main.player[playerId].team == team)
|
||||
{
|
||||
NetPacket packet = NetTextModule.SerializeServerMessage(NetworkText.FromLiteral(text), color, clientId);
|
||||
NetManager.Instance.SendToClient(packet, playerId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void SendNoTeamError(byte clientId)
|
||||
{
|
||||
NetPacket packet = NetTextModule.SerializeServerMessage(Lang.mp[10].ToNetworkText(), PartyChatCommand.ERROR_COLOR);
|
||||
NetManager.Instance.SendToClient(packet, (int) clientId);
|
||||
}
|
||||
}
|
||||
}
|
25
Chat/Commands/RollCommand.cs
Normal file
25
Chat/Commands/RollCommand.cs
Normal file
|
@ -0,0 +1,25 @@
|
|||
// 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 location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
|
||||
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria.Localization;
|
||||
|
||||
namespace Terraria.Chat.Commands
|
||||
{
|
||||
[ChatCommand("Roll")]
|
||||
public class RollCommand : IChatCommand
|
||||
{
|
||||
private static readonly Color RESPONSE_COLOR = new Color((int) byte.MaxValue, 240, 20);
|
||||
|
||||
public string InternalName => "roll";
|
||||
|
||||
public void ProcessMessage(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);
|
||||
}
|
||||
}
|
||||
}
|
24
Chat/Commands/SayChatCommand.cs
Normal file
24
Chat/Commands/SayChatCommand.cs
Normal file
|
@ -0,0 +1,24 @@
|
|||
// 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 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)
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
15
Chat/IChatProcessor.cs
Normal file
15
Chat/IChatProcessor.cs
Normal file
|
@ -0,0 +1,15 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Chat.IChatProcessor
|
||||
// Assembly: Terraria, Version=1.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.Chat
|
||||
{
|
||||
public interface IChatProcessor
|
||||
{
|
||||
bool ProcessReceivedMessage(ChatMessage message, int clientId);
|
||||
|
||||
bool ProcessOutgoingMessage(ChatMessage message);
|
||||
}
|
||||
}
|
35
Cinematics/CinematicManager.cs
Normal file
35
Cinematics/CinematicManager.cs
Normal file
|
@ -0,0 +1,35 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Cinematics.CinematicManager
|
||||
// Assembly: Terraria, Version=1.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 System.Collections.Generic;
|
||||
|
||||
namespace Terraria.Cinematics
|
||||
{
|
||||
public class CinematicManager
|
||||
{
|
||||
public static CinematicManager Instance = new CinematicManager();
|
||||
private List<Film> _films = new List<Film>();
|
||||
|
||||
public void Update(GameTime gameTime)
|
||||
{
|
||||
if (this._films.Count <= 0)
|
||||
return;
|
||||
if (!this._films[0].IsActive)
|
||||
this._films[0].OnBegin();
|
||||
if (!Main.hasFocus || Main.gamePaused || this._films[0].OnUpdate(gameTime))
|
||||
return;
|
||||
this._films[0].OnEnd();
|
||||
this._films.RemoveAt(0);
|
||||
}
|
||||
|
||||
public void PlayFilm(Film film) => this._films.Add(film);
|
||||
|
||||
public void StopAll()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
359
Cinematics/DD2Film.cs
Normal file
359
Cinematics/DD2Film.cs
Normal file
|
@ -0,0 +1,359 @@
|
|||
// 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 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.UI;
|
||||
using Terraria.ID;
|
||||
|
||||
namespace Terraria.Cinematics
|
||||
{
|
||||
public class DD2Film : Film
|
||||
{
|
||||
private NPC _dryad;
|
||||
private NPC _ogre;
|
||||
private NPC _portal;
|
||||
private List<NPC> _army = new List<NPC>();
|
||||
private List<NPC> _critters = new List<NPC>();
|
||||
private Vector2 _startPoint;
|
||||
|
||||
public DD2Film()
|
||||
{
|
||||
this.AppendKeyFrames(new FrameEvent(this.CreateDryad), new FrameEvent(this.CreateCritters));
|
||||
this.AppendSequences(120, new FrameEvent(this.DryadStand), new FrameEvent(this.DryadLookRight));
|
||||
this.AppendSequences(100, new FrameEvent(this.DryadLookRight), new FrameEvent(this.DryadInteract));
|
||||
this.AddKeyFrame(this.AppendPoint - 20, new FrameEvent(this.CreatePortal));
|
||||
this.AppendSequences(30, new FrameEvent(this.DryadLookLeft), new FrameEvent(this.DryadStand));
|
||||
this.AppendSequences(40, new FrameEvent(this.DryadConfusedEmote), new FrameEvent(this.DryadStand), new FrameEvent(this.DryadLookLeft));
|
||||
this.AppendKeyFrame(new FrameEvent(this.CreateOgre));
|
||||
this.AddKeyFrame(this.AppendPoint + 60, new FrameEvent(this.SpawnJavalinThrower));
|
||||
this.AddKeyFrame(this.AppendPoint + 120, new FrameEvent(this.SpawnGoblin));
|
||||
this.AddKeyFrame(this.AppendPoint + 180, new FrameEvent(this.SpawnGoblin));
|
||||
this.AddKeyFrame(this.AppendPoint + 240, new FrameEvent(this.SpawnWitherBeast));
|
||||
this.AppendSequences(30, new FrameEvent(this.DryadStand), new FrameEvent(this.DryadLookLeft));
|
||||
this.AppendSequences(30, new FrameEvent(this.DryadLookRight), new FrameEvent(this.DryadWalk));
|
||||
this.AppendSequences(300, new FrameEvent(this.DryadAttack), new FrameEvent(this.DryadLookLeft));
|
||||
this.AppendKeyFrame(new FrameEvent(this.RemoveEnemyDamage));
|
||||
this.AppendSequences(60, new FrameEvent(this.DryadLookRight), new FrameEvent(this.DryadStand), new FrameEvent(this.DryadAlertEmote));
|
||||
this.AddSequences(this.AppendPoint - 90, 60, new FrameEvent(this.OgreLookLeft), new FrameEvent(this.OgreStand));
|
||||
this.AddKeyFrame(this.AppendPoint - 12, new FrameEvent(this.OgreSwingSound));
|
||||
this.AddSequences(this.AppendPoint - 30, 50, new FrameEvent(this.DryadPortalKnock), new FrameEvent(this.DryadStand));
|
||||
this.AppendKeyFrame(new FrameEvent(this.RestoreEnemyDamage));
|
||||
this.AppendSequences(40, new FrameEvent(this.DryadPortalFade), new FrameEvent(this.DryadStand));
|
||||
this.AppendSequence(180, new FrameEvent(this.DryadStand));
|
||||
this.AddSequence(0, this.AppendPoint, new FrameEvent(this.PerFrameSettings));
|
||||
}
|
||||
|
||||
private void PerFrameSettings(FrameEventData evt) => CombatText.clearAll();
|
||||
|
||||
private void CreateDryad(FrameEventData evt)
|
||||
{
|
||||
this._dryad = this.PlaceNPCOnGround(20, this._startPoint);
|
||||
this._dryad.knockBackResist = 0.0f;
|
||||
this._dryad.immortal = true;
|
||||
this._dryad.dontTakeDamage = true;
|
||||
this._dryad.takenDamageMultiplier = 0.0f;
|
||||
this._dryad.immune[(int) byte.MaxValue] = 100000;
|
||||
}
|
||||
|
||||
private void DryadInteract(FrameEventData evt)
|
||||
{
|
||||
if (this._dryad == null)
|
||||
return;
|
||||
this._dryad.ai[0] = 9f;
|
||||
if (evt.IsFirstFrame)
|
||||
this._dryad.ai[1] = (float) evt.Duration;
|
||||
this._dryad.localAI[0] = 0.0f;
|
||||
}
|
||||
|
||||
private void SpawnWitherBeast(FrameEventData evt)
|
||||
{
|
||||
int index = NPC.NewNPC((int) this._portal.Center.X, (int) this._portal.Bottom.Y, 568);
|
||||
NPC npc = Main.npc[index];
|
||||
npc.knockBackResist = 0.0f;
|
||||
npc.immortal = true;
|
||||
npc.dontTakeDamage = true;
|
||||
npc.takenDamageMultiplier = 0.0f;
|
||||
npc.immune[(int) byte.MaxValue] = 100000;
|
||||
npc.friendly = this._ogre.friendly;
|
||||
this._army.Add(npc);
|
||||
}
|
||||
|
||||
private void SpawnJavalinThrower(FrameEventData evt)
|
||||
{
|
||||
int index = NPC.NewNPC((int) this._portal.Center.X, (int) this._portal.Bottom.Y, 561);
|
||||
NPC npc = Main.npc[index];
|
||||
npc.knockBackResist = 0.0f;
|
||||
npc.immortal = true;
|
||||
npc.dontTakeDamage = true;
|
||||
npc.takenDamageMultiplier = 0.0f;
|
||||
npc.immune[(int) byte.MaxValue] = 100000;
|
||||
npc.friendly = this._ogre.friendly;
|
||||
this._army.Add(npc);
|
||||
}
|
||||
|
||||
private void SpawnGoblin(FrameEventData evt)
|
||||
{
|
||||
int index = NPC.NewNPC((int) this._portal.Center.X, (int) this._portal.Bottom.Y, 552);
|
||||
NPC npc = Main.npc[index];
|
||||
npc.knockBackResist = 0.0f;
|
||||
npc.immortal = true;
|
||||
npc.dontTakeDamage = true;
|
||||
npc.takenDamageMultiplier = 0.0f;
|
||||
npc.immune[(int) byte.MaxValue] = 100000;
|
||||
npc.friendly = this._ogre.friendly;
|
||||
this._army.Add(npc);
|
||||
}
|
||||
|
||||
private void CreateCritters(FrameEventData evt)
|
||||
{
|
||||
for (int index = 0; index < 5; ++index)
|
||||
{
|
||||
float num = (float) index / 5f;
|
||||
NPC npc = this.PlaceNPCOnGround((int) Utils.SelectRandom<short>(Main.rand, (short) 46, (short) 46, (short) 299, (short) 538), this._startPoint + new Vector2((float) (((double) num - 0.25) * 400.0 + (double) Main.rand.NextFloat() * 50.0 - 25.0), 0.0f));
|
||||
npc.ai[0] = 0.0f;
|
||||
npc.ai[1] = 600f;
|
||||
this._critters.Add(npc);
|
||||
}
|
||||
if (this._dryad == null)
|
||||
return;
|
||||
for (int index1 = 0; index1 < 10; ++index1)
|
||||
{
|
||||
double num = (double) index1 / 10.0;
|
||||
int index2 = NPC.NewNPC((int) this._dryad.position.X + Main.rand.Next(-1000, 800), (int) this._dryad.position.Y - Main.rand.Next(-50, 300), 356);
|
||||
NPC npc = Main.npc[index2];
|
||||
npc.ai[0] = (float) ((double) Main.rand.NextFloat() * 4.0 - 2.0);
|
||||
npc.ai[1] = (float) ((double) Main.rand.NextFloat() * 4.0 - 2.0);
|
||||
npc.velocity.X = (float) ((double) Main.rand.NextFloat() * 4.0 - 2.0);
|
||||
this._critters.Add(npc);
|
||||
}
|
||||
}
|
||||
|
||||
private void OgreSwingSound(FrameEventData evt) => Main.PlaySound(SoundID.DD2_OgreAttack, this._ogre.Center);
|
||||
|
||||
private void DryadPortalKnock(FrameEventData evt)
|
||||
{
|
||||
if (this._dryad != null)
|
||||
{
|
||||
if (evt.Frame == 20)
|
||||
{
|
||||
this._dryad.velocity.Y -= 7f;
|
||||
this._dryad.velocity.X -= 8f;
|
||||
Main.PlaySound(3, (int) this._dryad.Center.X, (int) this._dryad.Center.Y);
|
||||
}
|
||||
if (evt.Frame >= 20)
|
||||
{
|
||||
this._dryad.ai[0] = 1f;
|
||||
this._dryad.ai[1] = (float) evt.Remaining;
|
||||
this._dryad.rotation += 0.05f;
|
||||
}
|
||||
}
|
||||
if (this._ogre == null)
|
||||
return;
|
||||
if (evt.Frame > 40)
|
||||
{
|
||||
this._ogre.target = Main.myPlayer;
|
||||
this._ogre.direction = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
this._ogre.direction = -1;
|
||||
this._ogre.ai[1] = 0.0f;
|
||||
this._ogre.ai[0] = Math.Min(40f, this._ogre.ai[0]);
|
||||
this._ogre.target = 300 + this._dryad.whoAmI;
|
||||
}
|
||||
}
|
||||
|
||||
private void RemoveEnemyDamage(FrameEventData evt)
|
||||
{
|
||||
this._ogre.friendly = true;
|
||||
foreach (NPC npc in this._army)
|
||||
npc.friendly = true;
|
||||
}
|
||||
|
||||
private void RestoreEnemyDamage(FrameEventData evt)
|
||||
{
|
||||
this._ogre.friendly = false;
|
||||
foreach (NPC npc in this._army)
|
||||
npc.friendly = false;
|
||||
}
|
||||
|
||||
private void DryadPortalFade(FrameEventData evt)
|
||||
{
|
||||
if (this._dryad == null || this._portal == null)
|
||||
return;
|
||||
if (evt.IsFirstFrame)
|
||||
Main.PlaySound(SoundID.DD2_EtherianPortalDryadTouch, this._dryad.Center);
|
||||
float amount = Math.Max(0.0f, (float) (evt.Frame - 7) / (float) (evt.Duration - 7));
|
||||
this._dryad.color = new Color(Vector3.Lerp(Vector3.One, new Vector3(0.5f, 0.0f, 0.8f), amount));
|
||||
this._dryad.Opacity = 1f - amount;
|
||||
this._dryad.rotation += (float) (0.0500000007450581 * ((double) amount * 4.0 + 1.0));
|
||||
this._dryad.scale = 1f - amount;
|
||||
if ((double) this._dryad.position.X < (double) this._portal.Right.X)
|
||||
{
|
||||
this._dryad.velocity.X *= 0.95f;
|
||||
this._dryad.velocity.Y *= 0.55f;
|
||||
}
|
||||
int num1 = (int) (6.0 * (double) amount);
|
||||
float num2 = this._dryad.Size.Length() / 2f / 20f;
|
||||
for (int index = 0; index < num1; ++index)
|
||||
{
|
||||
if (Main.rand.Next(5) == 0)
|
||||
{
|
||||
Dust dust = Dust.NewDustDirect(this._dryad.position, this._dryad.width, this._dryad.height, 27, this._dryad.velocity.X * 1f, Alpha: 100);
|
||||
dust.scale = 0.55f;
|
||||
dust.fadeIn = 0.7f;
|
||||
dust.velocity *= 0.1f * num2;
|
||||
dust.velocity += this._dryad.velocity;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void CreatePortal(FrameEventData evt)
|
||||
{
|
||||
this._portal = this.PlaceNPCOnGround(549, this._startPoint + new Vector2(-240f, 0.0f));
|
||||
this._portal.immortal = true;
|
||||
}
|
||||
|
||||
private void DryadStand(FrameEventData evt)
|
||||
{
|
||||
if (this._dryad == null)
|
||||
return;
|
||||
this._dryad.ai[0] = 0.0f;
|
||||
this._dryad.ai[1] = (float) evt.Remaining;
|
||||
}
|
||||
|
||||
private void DryadLookRight(FrameEventData evt)
|
||||
{
|
||||
if (this._dryad == null)
|
||||
return;
|
||||
this._dryad.direction = 1;
|
||||
this._dryad.spriteDirection = 1;
|
||||
}
|
||||
|
||||
private void DryadLookLeft(FrameEventData evt)
|
||||
{
|
||||
if (this._dryad == null)
|
||||
return;
|
||||
this._dryad.direction = -1;
|
||||
this._dryad.spriteDirection = -1;
|
||||
}
|
||||
|
||||
private void DryadWalk(FrameEventData evt)
|
||||
{
|
||||
this._dryad.ai[0] = 1f;
|
||||
this._dryad.ai[1] = 2f;
|
||||
}
|
||||
|
||||
private void DryadConfusedEmote(FrameEventData evt)
|
||||
{
|
||||
if (this._dryad == null || !evt.IsFirstFrame)
|
||||
return;
|
||||
EmoteBubble.NewBubble(87, new WorldUIAnchor((Entity) this._dryad), evt.Duration);
|
||||
}
|
||||
|
||||
private void DryadAlertEmote(FrameEventData evt)
|
||||
{
|
||||
if (this._dryad == null || !evt.IsFirstFrame)
|
||||
return;
|
||||
EmoteBubble.NewBubble(3, new WorldUIAnchor((Entity) this._dryad), evt.Duration);
|
||||
}
|
||||
|
||||
private void CreateOgre(FrameEventData evt)
|
||||
{
|
||||
int index = NPC.NewNPC((int) this._portal.Center.X, (int) this._portal.Bottom.Y, 576);
|
||||
this._ogre = Main.npc[index];
|
||||
this._ogre.knockBackResist = 0.0f;
|
||||
this._ogre.immortal = true;
|
||||
this._ogre.dontTakeDamage = true;
|
||||
this._ogre.takenDamageMultiplier = 0.0f;
|
||||
this._ogre.immune[(int) byte.MaxValue] = 100000;
|
||||
}
|
||||
|
||||
private void OgreStand(FrameEventData evt)
|
||||
{
|
||||
if (this._ogre == null)
|
||||
return;
|
||||
this._ogre.ai[0] = 0.0f;
|
||||
this._ogre.ai[1] = 0.0f;
|
||||
this._ogre.velocity = Vector2.Zero;
|
||||
}
|
||||
|
||||
private void DryadAttack(FrameEventData evt)
|
||||
{
|
||||
if (this._dryad == null)
|
||||
return;
|
||||
this._dryad.ai[0] = 14f;
|
||||
this._dryad.ai[1] = (float) evt.Remaining;
|
||||
this._dryad.dryadWard = false;
|
||||
}
|
||||
|
||||
private void OgreLookRight(FrameEventData evt)
|
||||
{
|
||||
if (this._ogre == null)
|
||||
return;
|
||||
this._ogre.direction = 1;
|
||||
this._ogre.spriteDirection = 1;
|
||||
}
|
||||
|
||||
private void OgreLookLeft(FrameEventData evt)
|
||||
{
|
||||
if (this._ogre == null)
|
||||
return;
|
||||
this._ogre.direction = -1;
|
||||
this._ogre.spriteDirection = -1;
|
||||
}
|
||||
|
||||
public override void OnBegin()
|
||||
{
|
||||
Main.NewText("DD2Film: Begin");
|
||||
Main.dayTime = true;
|
||||
Main.time = 27000.0;
|
||||
this._startPoint = Main.screenPosition + new Vector2((float) Main.mouseX, (float) Main.mouseY - 32f);
|
||||
base.OnBegin();
|
||||
}
|
||||
|
||||
private NPC PlaceNPCOnGround(int type, Vector2 position)
|
||||
{
|
||||
int x = (int) position.X;
|
||||
int y = (int) position.Y;
|
||||
int i = x / 16;
|
||||
int j = y / 16;
|
||||
while (!WorldGen.SolidTile(i, j))
|
||||
++j;
|
||||
int Y = j * 16;
|
||||
int Start = 100;
|
||||
switch (type)
|
||||
{
|
||||
case 20:
|
||||
Start = 1;
|
||||
break;
|
||||
case 576:
|
||||
Start = 50;
|
||||
break;
|
||||
}
|
||||
int index = NPC.NewNPC(x, Y, type, Start);
|
||||
return Main.npc[index];
|
||||
}
|
||||
|
||||
public override void OnEnd()
|
||||
{
|
||||
if (this._dryad != null)
|
||||
this._dryad.active = false;
|
||||
if (this._portal != null)
|
||||
this._portal.active = false;
|
||||
if (this._ogre != null)
|
||||
this._ogre.active = false;
|
||||
foreach (Entity critter in this._critters)
|
||||
critter.active = false;
|
||||
foreach (Entity entity in this._army)
|
||||
entity.active = false;
|
||||
Main.NewText("DD2Film: End");
|
||||
base.OnEnd();
|
||||
}
|
||||
}
|
||||
}
|
120
Cinematics/Film.cs
Normal file
120
Cinematics/Film.cs
Normal file
|
@ -0,0 +1,120 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Cinematics.Film
|
||||
// Assembly: Terraria, Version=1.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 System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Terraria.Cinematics
|
||||
{
|
||||
public class Film
|
||||
{
|
||||
private int _frame;
|
||||
private int _frameCount;
|
||||
private int _nextSequenceAppendTime;
|
||||
private bool _isActive;
|
||||
private List<Film.Sequence> _sequences = new List<Film.Sequence>();
|
||||
|
||||
public int Frame => this._frame;
|
||||
|
||||
public int FrameCount => this._frameCount;
|
||||
|
||||
public int AppendPoint => this._nextSequenceAppendTime;
|
||||
|
||||
public bool IsActive => this._isActive;
|
||||
|
||||
public void AddSequence(int start, int duration, FrameEvent frameEvent)
|
||||
{
|
||||
this._sequences.Add(new Film.Sequence(frameEvent, start, duration));
|
||||
this._nextSequenceAppendTime = Math.Max(this._nextSequenceAppendTime, start + duration);
|
||||
this._frameCount = Math.Max(this._frameCount, start + duration);
|
||||
}
|
||||
|
||||
public void AppendSequence(int duration, FrameEvent frameEvent) => this.AddSequence(this._nextSequenceAppendTime, duration, frameEvent);
|
||||
|
||||
public void AddSequences(int start, int duration, params FrameEvent[] frameEvents)
|
||||
{
|
||||
foreach (FrameEvent frameEvent in frameEvents)
|
||||
this.AddSequence(start, duration, frameEvent);
|
||||
}
|
||||
|
||||
public void AppendSequences(int duration, params FrameEvent[] frameEvents)
|
||||
{
|
||||
int sequenceAppendTime = this._nextSequenceAppendTime;
|
||||
foreach (FrameEvent frameEvent in frameEvents)
|
||||
{
|
||||
this._sequences.Add(new Film.Sequence(frameEvent, sequenceAppendTime, duration));
|
||||
this._nextSequenceAppendTime = Math.Max(this._nextSequenceAppendTime, sequenceAppendTime + duration);
|
||||
this._frameCount = Math.Max(this._frameCount, sequenceAppendTime + duration);
|
||||
}
|
||||
}
|
||||
|
||||
public void AppendEmptySequence(int duration) => this.AddSequence(this._nextSequenceAppendTime, duration, new FrameEvent(Film.EmptyFrameEvent));
|
||||
|
||||
public void AppendKeyFrame(FrameEvent frameEvent) => this.AddKeyFrame(this._nextSequenceAppendTime, frameEvent);
|
||||
|
||||
public void AppendKeyFrames(params FrameEvent[] frameEvents)
|
||||
{
|
||||
int sequenceAppendTime = this._nextSequenceAppendTime;
|
||||
foreach (FrameEvent frameEvent in frameEvents)
|
||||
this._sequences.Add(new Film.Sequence(frameEvent, sequenceAppendTime, 1));
|
||||
this._frameCount = Math.Max(this._frameCount, sequenceAppendTime + 1);
|
||||
}
|
||||
|
||||
public void AddKeyFrame(int frame, FrameEvent frameEvent)
|
||||
{
|
||||
this._sequences.Add(new Film.Sequence(frameEvent, frame, 1));
|
||||
this._frameCount = Math.Max(this._frameCount, frame + 1);
|
||||
}
|
||||
|
||||
public void AddKeyFrames(int frame, params FrameEvent[] frameEvents)
|
||||
{
|
||||
foreach (FrameEvent frameEvent in frameEvents)
|
||||
this.AddKeyFrame(frame, frameEvent);
|
||||
}
|
||||
|
||||
public bool OnUpdate(GameTime gameTime)
|
||||
{
|
||||
if (this._sequences.Count == 0)
|
||||
return false;
|
||||
foreach (Film.Sequence sequence in this._sequences)
|
||||
{
|
||||
int num = this._frame - sequence.Start;
|
||||
if (num >= 0 && num < sequence.Duration)
|
||||
sequence.Event(new FrameEventData(this._frame, sequence.Start, sequence.Duration));
|
||||
}
|
||||
return ++this._frame != this._frameCount;
|
||||
}
|
||||
|
||||
public virtual void OnBegin() => this._isActive = true;
|
||||
|
||||
public virtual void OnEnd() => this._isActive = false;
|
||||
|
||||
private static void EmptyFrameEvent(FrameEventData evt)
|
||||
{
|
||||
}
|
||||
|
||||
private class Sequence
|
||||
{
|
||||
private FrameEvent _frameEvent;
|
||||
private int _duration;
|
||||
private int _start;
|
||||
|
||||
public FrameEvent Event => this._frameEvent;
|
||||
|
||||
public int Duration => this._duration;
|
||||
|
||||
public int Start => this._start;
|
||||
|
||||
public Sequence(FrameEvent frameEvent, int start, int duration)
|
||||
{
|
||||
this._frameEvent = frameEvent;
|
||||
this._start = start;
|
||||
this._duration = duration;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
10
Cinematics/FrameEvent.cs
Normal file
10
Cinematics/FrameEvent.cs
Normal file
|
@ -0,0 +1,10 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Cinematics.FrameEvent
|
||||
// Assembly: Terraria, Version=1.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.Cinematics
|
||||
{
|
||||
public delegate void FrameEvent(FrameEventData evt);
|
||||
}
|
36
Cinematics/FrameEventData.cs
Normal file
36
Cinematics/FrameEventData.cs
Normal file
|
@ -0,0 +1,36 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Cinematics.FrameEventData
|
||||
// Assembly: Terraria, Version=1.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.Cinematics
|
||||
{
|
||||
public struct FrameEventData
|
||||
{
|
||||
private int _absoluteFrame;
|
||||
private int _start;
|
||||
private int _duration;
|
||||
|
||||
public int AbsoluteFrame => this._absoluteFrame;
|
||||
|
||||
public int Start => this._start;
|
||||
|
||||
public int Duration => this._duration;
|
||||
|
||||
public int Frame => this._absoluteFrame - this._start;
|
||||
|
||||
public bool IsFirstFrame => this._start == this._absoluteFrame;
|
||||
|
||||
public bool IsLastFrame => this.Remaining == 0;
|
||||
|
||||
public int Remaining => this._start + this._duration - this._absoluteFrame - 1;
|
||||
|
||||
public FrameEventData(int absoluteFrame, int start, int duration)
|
||||
{
|
||||
this._absoluteFrame = absoluteFrame;
|
||||
this._start = start;
|
||||
this._duration = duration;
|
||||
}
|
||||
}
|
||||
}
|
254
Cloud.cs
Normal file
254
Cloud.cs
Normal file
|
@ -0,0 +1,254 @@
|
|||
// 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 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.Utilities;
|
||||
|
||||
namespace Terraria
|
||||
{
|
||||
public class Cloud
|
||||
{
|
||||
public Vector2 position;
|
||||
public float scale;
|
||||
public float rotation;
|
||||
public float rSpeed;
|
||||
public float sSpeed;
|
||||
public bool active;
|
||||
public SpriteEffects spriteDir;
|
||||
public int type;
|
||||
public int width;
|
||||
public int height;
|
||||
public float Alpha;
|
||||
public bool kill;
|
||||
private static UnifiedRandom rand = new UnifiedRandom();
|
||||
|
||||
public static void resetClouds()
|
||||
{
|
||||
if (Main.dedServ || Main.cloudLimit < 10)
|
||||
return;
|
||||
Main.windSpeed = Main.windSpeedSet;
|
||||
for (int index = 0; index < 200; ++index)
|
||||
Main.cloud[index].active = false;
|
||||
for (int index = 0; index < Main.numClouds; ++index)
|
||||
{
|
||||
Cloud.addCloud();
|
||||
Main.cloud[index].Alpha = 1f;
|
||||
}
|
||||
for (int index = 0; index < 200; ++index)
|
||||
Main.cloud[index].Alpha = 1f;
|
||||
}
|
||||
|
||||
public static void addCloud()
|
||||
{
|
||||
if (Main.netMode == 2)
|
||||
return;
|
||||
int index1 = -1;
|
||||
for (int index2 = 0; index2 < 200; ++index2)
|
||||
{
|
||||
if (!Main.cloud[index2].active)
|
||||
{
|
||||
index1 = index2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (index1 < 0)
|
||||
return;
|
||||
Main.cloud[index1].kill = false;
|
||||
Main.cloud[index1].rSpeed = 0.0f;
|
||||
Main.cloud[index1].sSpeed = 0.0f;
|
||||
Main.cloud[index1].scale = (float) Cloud.rand.Next(70, 131) * 0.01f;
|
||||
Main.cloud[index1].rotation = (float) Cloud.rand.Next(-10, 11) * 0.01f;
|
||||
Main.cloud[index1].width = (int) ((double) 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].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;
|
||||
if (!Main.gameMenu)
|
||||
num1 = Main.windSpeed - Main.player[Main.myPlayer].velocity.X * 0.1f;
|
||||
int num2 = 0;
|
||||
int num3 = 0;
|
||||
if ((double) num1 > 0.0)
|
||||
num2 -= 200;
|
||||
if ((double) num1 < 0.0)
|
||||
num3 += 200;
|
||||
int num4 = 300;
|
||||
float num5 = (float) WorldGen.genRand.Next(num2 - num4, Main.screenWidth + num3 + num4);
|
||||
Main.cloud[index1].Alpha = 0.0f;
|
||||
Main.cloud[index1].position.Y = (float) Cloud.rand.Next((int) ((double) -Main.screenHeight * 0.25), (int) ((double) Main.screenHeight * 0.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].type = Cloud.rand.Next(4);
|
||||
if ((double) Main.cloudAlpha > 0.0 && Cloud.rand.Next(4) != 0 || (double) Main.cloudBGActive >= 1.0 && Cloud.rand.Next(2) == 0)
|
||||
{
|
||||
Main.cloud[index1].type = Cloud.rand.Next(18, 22);
|
||||
if ((double) Main.cloud[index1].scale >= 1.15)
|
||||
Main.cloud[index1].position.Y -= 150f;
|
||||
if ((double) Main.cloud[index1].scale >= 1.0)
|
||||
Main.cloud[index1].position.Y -= 150f;
|
||||
}
|
||||
else if (((double) Main.cloudBGActive <= 0.0 && (double) Main.cloudAlpha == 0.0 && (double) Main.cloud[index1].scale < 1.0 && (double) Main.cloud[index1].position.Y < (double) -Main.screenHeight * 0.200000002980232 || (double) Main.cloud[index1].position.Y < (double) -Main.screenHeight * 0.200000002980232) && (double) Main.numClouds < 50.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 ((double) Main.cloud[index1].scale > 1.2)
|
||||
Main.cloud[index1].position.Y += 100f;
|
||||
if ((double) Main.cloud[index1].scale > 1.3)
|
||||
Main.cloud[index1].scale = 1.3f;
|
||||
if ((double) Main.cloud[index1].scale < 0.7)
|
||||
Main.cloud[index1].scale = 0.7f;
|
||||
Main.cloud[index1].active = true;
|
||||
Main.cloud[index1].position.X = num5;
|
||||
if ((double) Main.cloud[index1].position.X > (double) (Main.screenWidth + 100))
|
||||
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)
|
||||
Main.cloud[index1].Alpha = 1f;
|
||||
Rectangle rectangle1 = new Rectangle((int) Main.cloud[index1].position.X, (int) Main.cloud[index1].position.Y, Main.cloud[index1].width, Main.cloud[index1].height);
|
||||
for (int index3 = 0; index3 < 200; ++index3)
|
||||
{
|
||||
if (index1 != index3 && Main.cloud[index3].active)
|
||||
{
|
||||
Rectangle rectangle2 = new Rectangle((int) Main.cloud[index3].position.X, (int) Main.cloud[index3].position.Y, Main.cloud[index3].width, Main.cloud[index3].height);
|
||||
if (rectangle1.Intersects(rectangle2))
|
||||
Main.cloud[index1].active = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Color cloudColor(Color bgColor)
|
||||
{
|
||||
float num = this.scale * this.Alpha;
|
||||
if ((double) num > 1.0)
|
||||
num = 1f;
|
||||
return new Color((int) (byte) (float) (int) ((double) bgColor.R * (double) num), (int) (byte) (float) (int) ((double) bgColor.G * (double) num), (int) (byte) (float) (int) ((double) bgColor.B * (double) num), (int) (byte) (float) (int) ((double) bgColor.A * (double) num));
|
||||
}
|
||||
|
||||
public object Clone() => this.MemberwiseClone();
|
||||
|
||||
public static void UpdateClouds()
|
||||
{
|
||||
if (Main.netMode == 2)
|
||||
return;
|
||||
int maxValue = 0;
|
||||
for (int index = 0; index < 200; ++index)
|
||||
{
|
||||
if (Main.cloud[index].active)
|
||||
{
|
||||
Main.cloud[index].Update();
|
||||
if (!Main.cloud[index].kill)
|
||||
++maxValue;
|
||||
}
|
||||
}
|
||||
for (int index = 0; index < 200; ++index)
|
||||
{
|
||||
if (Main.cloud[index].active)
|
||||
{
|
||||
if (index > 1 && (!Main.cloud[index - 1].active || (double) Main.cloud[index - 1].scale > (double) Main.cloud[index].scale + 0.02))
|
||||
{
|
||||
Cloud cloud = (Cloud) Main.cloud[index - 1].Clone();
|
||||
Main.cloud[index - 1] = (Cloud) Main.cloud[index].Clone();
|
||||
Main.cloud[index] = cloud;
|
||||
}
|
||||
if (index < 199 && (!Main.cloud[index].active || (double) Main.cloud[index + 1].scale < (double) Main.cloud[index].scale - 0.02))
|
||||
{
|
||||
Cloud cloud = (Cloud) Main.cloud[index + 1].Clone();
|
||||
Main.cloud[index + 1] = (Cloud) Main.cloud[index].Clone();
|
||||
Main.cloud[index] = cloud;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (maxValue < Main.numClouds)
|
||||
{
|
||||
Cloud.addCloud();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (maxValue <= Main.numClouds)
|
||||
return;
|
||||
int index1 = Cloud.rand.Next(maxValue);
|
||||
for (int index2 = 0; Main.cloud[index1].kill && index2 < 100; index1 = Cloud.rand.Next(maxValue))
|
||||
++index2;
|
||||
Main.cloud[index1].kill = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
if (Main.gameMenu)
|
||||
{
|
||||
this.position.X += (float) ((double) Main.windSpeed * (double) this.scale * 3.0);
|
||||
}
|
||||
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 num = 600f;
|
||||
if (!this.kill)
|
||||
{
|
||||
if ((double) this.Alpha < 1.0)
|
||||
{
|
||||
this.Alpha += 1f / 1000f * (float) Main.dayRate;
|
||||
if ((double) this.Alpha > 1.0)
|
||||
this.Alpha = 1f;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.Alpha -= 1f / 1000f * (float) Main.dayRate;
|
||||
if ((double) this.Alpha <= 0.0)
|
||||
this.active = false;
|
||||
}
|
||||
if ((double) this.position.X + (double) Main.cloudTexture[this.type].Width * (double) this.scale < -(double) num || (double) this.position.X > (double) Main.screenWidth + (double) num)
|
||||
this.active = false;
|
||||
this.rSpeed += (float) Cloud.rand.Next(-10, 11) * 2E-05f;
|
||||
if ((double) this.rSpeed > 0.0002)
|
||||
this.rSpeed = 0.0002f;
|
||||
if ((double) this.rSpeed < -0.0002)
|
||||
this.rSpeed = -0.0002f;
|
||||
if ((double) this.rotation > 0.02)
|
||||
this.rotation = 0.02f;
|
||||
if ((double) this.rotation < -0.02)
|
||||
this.rotation = -0.02f;
|
||||
this.rotation += this.rSpeed;
|
||||
this.width = (int) ((double) Main.cloudTexture[this.type].Width * (double) this.scale);
|
||||
this.height = (int) ((double) Main.cloudTexture[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;
|
||||
}
|
||||
}
|
||||
}
|
2858
Collision.cs
Normal file
2858
Collision.cs
Normal file
File diff suppressed because it is too large
Load diff
185
CombatText.cs
Normal file
185
CombatText.cs
Normal file
|
@ -0,0 +1,185 @@
|
|||
// 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 location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
|
||||
|
||||
using Microsoft.Xna.Framework;
|
||||
|
||||
namespace Terraria
|
||||
{
|
||||
public class CombatText
|
||||
{
|
||||
public static readonly Color DamagedFriendly = new Color((int) byte.MaxValue, 80, 90, (int) byte.MaxValue);
|
||||
public static readonly Color DamagedFriendlyCrit = new Color((int) byte.MaxValue, 100, 30, (int) byte.MaxValue);
|
||||
public static readonly Color DamagedHostile = new Color((int) byte.MaxValue, 160, 80, (int) byte.MaxValue);
|
||||
public static readonly Color DamagedHostileCrit = new Color((int) byte.MaxValue, 100, 30, (int) byte.MaxValue);
|
||||
public static readonly Color OthersDamagedHostile = CombatText.DamagedHostile * 0.4f;
|
||||
public static readonly Color OthersDamagedHostileCrit = CombatText.DamagedHostileCrit * 0.4f;
|
||||
public static readonly Color HealLife = new Color(100, (int) byte.MaxValue, 100, (int) byte.MaxValue);
|
||||
public static readonly Color HealMana = new Color(100, 100, (int) byte.MaxValue, (int) byte.MaxValue);
|
||||
public static readonly Color LifeRegen = new Color((int) byte.MaxValue, 60, 70, (int) byte.MaxValue);
|
||||
public static readonly Color LifeRegenNegative = new Color((int) byte.MaxValue, 140, 40, (int) byte.MaxValue);
|
||||
public Vector2 position;
|
||||
public Vector2 velocity;
|
||||
public float alpha;
|
||||
public int alphaDir = 1;
|
||||
public string text;
|
||||
public float scale = 1f;
|
||||
public float rotation;
|
||||
public Color color;
|
||||
public bool active;
|
||||
public int lifeTime;
|
||||
public bool crit;
|
||||
public bool dot;
|
||||
|
||||
public static int NewText(
|
||||
Rectangle location,
|
||||
Color color,
|
||||
int amount,
|
||||
bool dramatic = false,
|
||||
bool dot = false)
|
||||
{
|
||||
return CombatText.NewText(location, color, amount.ToString(), dramatic, dot);
|
||||
}
|
||||
|
||||
public static int NewText(
|
||||
Rectangle location,
|
||||
Color color,
|
||||
string text,
|
||||
bool dramatic = false,
|
||||
bool dot = false)
|
||||
{
|
||||
if (Main.netMode == 2)
|
||||
return 100;
|
||||
for (int index1 = 0; index1 < 100; ++index1)
|
||||
{
|
||||
if (!Main.combatText[index1].active)
|
||||
{
|
||||
int index2 = 0;
|
||||
if (dramatic)
|
||||
index2 = 1;
|
||||
Vector2 vector2 = Main.fontCombatText[index2].MeasureString(text);
|
||||
Main.combatText[index1].alpha = 1f;
|
||||
Main.combatText[index1].alphaDir = -1;
|
||||
Main.combatText[index1].active = true;
|
||||
Main.combatText[index1].scale = 0.0f;
|
||||
Main.combatText[index1].rotation = 0.0f;
|
||||
Main.combatText[index1].position.X = (float) ((double) location.X + (double) location.Width * 0.5 - (double) vector2.X * 0.5);
|
||||
Main.combatText[index1].position.Y = (float) ((double) location.Y + (double) location.Height * 0.25 - (double) vector2.Y * 0.5);
|
||||
Main.combatText[index1].position.X += (float) Main.rand.Next(-(int) ((double) location.Width * 0.5), (int) ((double) location.Width * 0.5) + 1);
|
||||
Main.combatText[index1].position.Y += (float) Main.rand.Next(-(int) ((double) location.Height * 0.5), (int) ((double) location.Height * 0.5) + 1);
|
||||
Main.combatText[index1].color = color;
|
||||
Main.combatText[index1].text = text;
|
||||
Main.combatText[index1].velocity.Y = -7f;
|
||||
if ((double) Main.player[Main.myPlayer].gravDir == -1.0)
|
||||
{
|
||||
Main.combatText[index1].velocity.Y *= -1f;
|
||||
Main.combatText[index1].position.Y = (float) ((double) location.Y + (double) location.Height * 0.75 + (double) vector2.Y * 0.5);
|
||||
}
|
||||
Main.combatText[index1].lifeTime = 60;
|
||||
Main.combatText[index1].crit = dramatic;
|
||||
Main.combatText[index1].dot = dot;
|
||||
if (dramatic)
|
||||
{
|
||||
Main.combatText[index1].text = text;
|
||||
Main.combatText[index1].lifeTime *= 2;
|
||||
Main.combatText[index1].velocity.Y *= 2f;
|
||||
Main.combatText[index1].velocity.X = (float) Main.rand.Next(-25, 26) * 0.05f;
|
||||
Main.combatText[index1].rotation = (float) (Main.combatText[index1].lifeTime / 2) * (1f / 500f);
|
||||
if ((double) Main.combatText[index1].velocity.X < 0.0)
|
||||
Main.combatText[index1].rotation *= -1f;
|
||||
}
|
||||
if (dot)
|
||||
{
|
||||
Main.combatText[index1].velocity.Y = -4f;
|
||||
Main.combatText[index1].lifeTime = 40;
|
||||
}
|
||||
return index1;
|
||||
}
|
||||
}
|
||||
return 100;
|
||||
}
|
||||
|
||||
public static void clearAll()
|
||||
{
|
||||
for (int index = 0; index < 100; ++index)
|
||||
Main.combatText[index].active = false;
|
||||
}
|
||||
|
||||
public static float TargetScale => Main.UIScale / (Main.GameViewMatrix.Zoom.X / Main.ForcedMinimumZoom);
|
||||
|
||||
public void Update()
|
||||
{
|
||||
if (!this.active)
|
||||
return;
|
||||
float targetScale = CombatText.TargetScale;
|
||||
this.alpha += (float) this.alphaDir * 0.05f;
|
||||
if ((double) this.alpha <= 0.6)
|
||||
this.alphaDir = 1;
|
||||
if ((double) this.alpha >= 1.0)
|
||||
{
|
||||
this.alpha = 1f;
|
||||
this.alphaDir = -1;
|
||||
}
|
||||
if (this.dot)
|
||||
{
|
||||
this.velocity.Y += 0.15f;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.velocity.Y *= 0.92f;
|
||||
if (this.crit)
|
||||
this.velocity.Y *= 0.92f;
|
||||
}
|
||||
this.velocity.X *= 0.93f;
|
||||
this.position += this.velocity;
|
||||
--this.lifeTime;
|
||||
if (this.lifeTime <= 0)
|
||||
{
|
||||
this.scale -= 0.1f * targetScale;
|
||||
if ((double) this.scale < 0.1)
|
||||
this.active = false;
|
||||
this.lifeTime = 0;
|
||||
if (!this.crit)
|
||||
return;
|
||||
this.alphaDir = -1;
|
||||
this.scale += 0.07f * targetScale;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (this.crit)
|
||||
{
|
||||
if ((double) this.velocity.X < 0.0)
|
||||
this.rotation += 1f / 1000f;
|
||||
else
|
||||
this.rotation -= 1f / 1000f;
|
||||
}
|
||||
if (this.dot)
|
||||
{
|
||||
this.scale += 0.5f * targetScale;
|
||||
if ((double) this.scale <= 0.8 * (double) targetScale)
|
||||
return;
|
||||
this.scale = 0.8f * targetScale;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((double) this.scale < (double) targetScale)
|
||||
this.scale += 0.1f * targetScale;
|
||||
if ((double) this.scale <= (double) targetScale)
|
||||
return;
|
||||
this.scale = targetScale;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void UpdateCombatText()
|
||||
{
|
||||
for (int index = 0; index < 100; ++index)
|
||||
{
|
||||
if (Main.combatText[index].active)
|
||||
Main.combatText[index].Update();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
33
DataStructures/AnchorData.cs
Normal file
33
DataStructures/AnchorData.cs
Normal file
|
@ -0,0 +1,33 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.DataStructures.AnchorData
|
||||
// Assembly: Terraria, Version=1.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.Enums;
|
||||
|
||||
namespace Terraria.DataStructures
|
||||
{
|
||||
public struct AnchorData
|
||||
{
|
||||
public AnchorType type;
|
||||
public int tileCount;
|
||||
public int checkStart;
|
||||
public static AnchorData Empty;
|
||||
|
||||
public AnchorData(AnchorType type, int count, int start)
|
||||
{
|
||||
this.type = type;
|
||||
this.tileCount = count;
|
||||
this.checkStart = start;
|
||||
}
|
||||
|
||||
public static bool operator ==(AnchorData data1, AnchorData data2) => data1.type == data2.type && data1.tileCount == data2.tileCount && data1.checkStart == data2.checkStart;
|
||||
|
||||
public static bool operator !=(AnchorData data1, AnchorData data2) => data1.type != data2.type || data1.tileCount != data2.tileCount || data1.checkStart != data2.checkStart;
|
||||
|
||||
public override bool Equals(object obj) => obj is AnchorData anchorData && this.type == anchorData.type && this.tileCount == ((AnchorData) obj).tileCount && this.checkStart == ((AnchorData) obj).checkStart;
|
||||
|
||||
public override int GetHashCode() => (int) (ushort) this.type << 16 | (int) (byte) this.tileCount << 8 | (int) (byte) this.checkStart;
|
||||
}
|
||||
}
|
74
DataStructures/BufferPool.cs
Normal file
74
DataStructures/BufferPool.cs
Normal file
|
@ -0,0 +1,74 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.DataStructures.BufferPool
|
||||
// Assembly: Terraria, Version=1.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.DataStructures
|
||||
{
|
||||
public static class BufferPool
|
||||
{
|
||||
private const int SMALL_BUFFER_SIZE = 32;
|
||||
private const int MEDIUM_BUFFER_SIZE = 256;
|
||||
private const int LARGE_BUFFER_SIZE = 16384;
|
||||
private static object bufferLock = new object();
|
||||
private static Queue<CachedBuffer> SmallBufferQueue = new Queue<CachedBuffer>();
|
||||
private static Queue<CachedBuffer> MediumBufferQueue = new Queue<CachedBuffer>();
|
||||
private static Queue<CachedBuffer> LargeBufferQueue = new Queue<CachedBuffer>();
|
||||
|
||||
public static CachedBuffer Request(int size)
|
||||
{
|
||||
lock (BufferPool.bufferLock)
|
||||
{
|
||||
if (size <= 32)
|
||||
return BufferPool.SmallBufferQueue.Count == 0 ? new CachedBuffer(new byte[32]) : BufferPool.SmallBufferQueue.Dequeue().Activate();
|
||||
if (size <= 256)
|
||||
return BufferPool.MediumBufferQueue.Count == 0 ? new CachedBuffer(new byte[256]) : BufferPool.MediumBufferQueue.Dequeue().Activate();
|
||||
if (size > 16384)
|
||||
return new CachedBuffer(new byte[size]);
|
||||
return BufferPool.LargeBufferQueue.Count == 0 ? new CachedBuffer(new byte[16384]) : BufferPool.LargeBufferQueue.Dequeue().Activate();
|
||||
}
|
||||
}
|
||||
|
||||
public static CachedBuffer Request(byte[] data, int offset, int size)
|
||||
{
|
||||
CachedBuffer cachedBuffer = BufferPool.Request(size);
|
||||
Buffer.BlockCopy((Array) data, offset, (Array) cachedBuffer.Data, 0, size);
|
||||
return cachedBuffer;
|
||||
}
|
||||
|
||||
public static void Recycle(CachedBuffer buffer)
|
||||
{
|
||||
int length = buffer.Length;
|
||||
lock (BufferPool.bufferLock)
|
||||
{
|
||||
if (length <= 32)
|
||||
BufferPool.SmallBufferQueue.Enqueue(buffer);
|
||||
else if (length <= 256)
|
||||
{
|
||||
BufferPool.MediumBufferQueue.Enqueue(buffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (length > 16384)
|
||||
return;
|
||||
BufferPool.LargeBufferQueue.Enqueue(buffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void PrintBufferSizes()
|
||||
{
|
||||
lock (BufferPool.bufferLock)
|
||||
{
|
||||
Console.WriteLine("SmallBufferQueue.Count: " + (object) BufferPool.SmallBufferQueue.Count);
|
||||
Console.WriteLine("MediumBufferQueue.Count: " + (object) BufferPool.MediumBufferQueue.Count);
|
||||
Console.WriteLine("LargeBufferQueue.Count: " + (object) BufferPool.LargeBufferQueue.Count);
|
||||
Console.WriteLine("");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
46
DataStructures/CachedBuffer.cs
Normal file
46
DataStructures/CachedBuffer.cs
Normal file
|
@ -0,0 +1,46 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.DataStructures.CachedBuffer
|
||||
// Assembly: Terraria, Version=1.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.IO;
|
||||
|
||||
namespace Terraria.DataStructures
|
||||
{
|
||||
public class CachedBuffer
|
||||
{
|
||||
public readonly byte[] Data;
|
||||
public readonly BinaryWriter Writer;
|
||||
public readonly BinaryReader Reader;
|
||||
private readonly MemoryStream _memoryStream;
|
||||
private bool _isActive = true;
|
||||
|
||||
public int Length => this.Data.Length;
|
||||
|
||||
public bool IsActive => this._isActive;
|
||||
|
||||
public CachedBuffer(byte[] data)
|
||||
{
|
||||
this.Data = data;
|
||||
this._memoryStream = new MemoryStream(data);
|
||||
this.Writer = new BinaryWriter((Stream) this._memoryStream);
|
||||
this.Reader = new BinaryReader((Stream) this._memoryStream);
|
||||
}
|
||||
|
||||
internal CachedBuffer Activate()
|
||||
{
|
||||
this._isActive = true;
|
||||
this._memoryStream.Position = 0L;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void Recycle()
|
||||
{
|
||||
if (!this._isActive)
|
||||
return;
|
||||
this._isActive = false;
|
||||
BufferPool.Recycle(this);
|
||||
}
|
||||
}
|
||||
}
|
50
DataStructures/ColorSlidersSet.cs
Normal file
50
DataStructures/ColorSlidersSet.cs
Normal file
|
@ -0,0 +1,50 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.DataStructures.ColorSlidersSet
|
||||
// Assembly: Terraria, Version=1.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;
|
||||
|
||||
namespace Terraria.DataStructures
|
||||
{
|
||||
public class ColorSlidersSet
|
||||
{
|
||||
public float Hue;
|
||||
public float Saturation;
|
||||
public float Luminance;
|
||||
public float Alpha = 1f;
|
||||
|
||||
public void SetHSL(Color color)
|
||||
{
|
||||
Vector3 hsl = Main.rgbToHsl(color);
|
||||
this.Hue = hsl.X;
|
||||
this.Saturation = hsl.Y;
|
||||
this.Luminance = hsl.Z;
|
||||
}
|
||||
|
||||
public void SetHSL(Vector3 vector)
|
||||
{
|
||||
this.Hue = vector.X;
|
||||
this.Saturation = vector.Y;
|
||||
this.Luminance = vector.Z;
|
||||
}
|
||||
|
||||
public Color GetColor()
|
||||
{
|
||||
Color rgb = Main.hslToRgb(this.Hue, this.Saturation, this.Luminance);
|
||||
rgb.A = (byte) ((double) this.Alpha * (double) byte.MaxValue);
|
||||
return rgb;
|
||||
}
|
||||
|
||||
public Vector3 GetHSLVector() => new Vector3(this.Hue, this.Saturation, this.Luminance);
|
||||
|
||||
public void ApplyToMainLegacyBars()
|
||||
{
|
||||
Main.hBar = this.Hue;
|
||||
Main.sBar = this.Saturation;
|
||||
Main.lBar = this.Luminance;
|
||||
Main.aBar = this.Alpha;
|
||||
}
|
||||
}
|
||||
}
|
149
DataStructures/DoubleStack`1.cs
Normal file
149
DataStructures/DoubleStack`1.cs
Normal file
|
@ -0,0 +1,149 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.DataStructures.DoubleStack`1
|
||||
// Assembly: Terraria, Version=1.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;
|
||||
|
||||
namespace Terraria.DataStructures
|
||||
{
|
||||
public class DoubleStack<T1>
|
||||
{
|
||||
private T1[][] _segmentList;
|
||||
private readonly int _segmentSize;
|
||||
private int _segmentCount;
|
||||
private readonly int _segmentShiftPosition;
|
||||
private int _start;
|
||||
private int _end;
|
||||
private int _size;
|
||||
private int _last;
|
||||
|
||||
public DoubleStack(int segmentSize = 1024, int initialSize = 0)
|
||||
{
|
||||
if (segmentSize < 16)
|
||||
segmentSize = 16;
|
||||
this._start = segmentSize / 2;
|
||||
this._end = this._start;
|
||||
this._size = 0;
|
||||
this._segmentShiftPosition = segmentSize + this._start;
|
||||
initialSize += this._start;
|
||||
int length = initialSize / segmentSize + 1;
|
||||
this._segmentList = new T1[length][];
|
||||
for (int index = 0; index < length; ++index)
|
||||
this._segmentList[index] = new T1[segmentSize];
|
||||
this._segmentSize = segmentSize;
|
||||
this._segmentCount = length;
|
||||
this._last = this._segmentSize * this._segmentCount - 1;
|
||||
}
|
||||
|
||||
public void PushFront(T1 front)
|
||||
{
|
||||
if (this._start == 0)
|
||||
{
|
||||
T1[][] objArray = new T1[this._segmentCount + 1][];
|
||||
for (int index = 0; index < this._segmentCount; ++index)
|
||||
objArray[index + 1] = this._segmentList[index];
|
||||
objArray[0] = new T1[this._segmentSize];
|
||||
this._segmentList = objArray;
|
||||
++this._segmentCount;
|
||||
this._start += this._segmentSize;
|
||||
this._end += this._segmentSize;
|
||||
this._last += this._segmentSize;
|
||||
}
|
||||
--this._start;
|
||||
this._segmentList[this._start / this._segmentSize][this._start % this._segmentSize] = front;
|
||||
++this._size;
|
||||
}
|
||||
|
||||
public T1 PopFront()
|
||||
{
|
||||
if (this._size == 0)
|
||||
throw new InvalidOperationException("The DoubleStack is empty.");
|
||||
T1[] segment1 = this._segmentList[this._start / this._segmentSize];
|
||||
int index1 = this._start % this._segmentSize;
|
||||
T1 obj = segment1[index1];
|
||||
segment1[index1] = default (T1);
|
||||
++this._start;
|
||||
--this._size;
|
||||
if (this._start >= this._segmentShiftPosition)
|
||||
{
|
||||
T1[] segment2 = this._segmentList[0];
|
||||
for (int index2 = 0; index2 < this._segmentCount - 1; ++index2)
|
||||
this._segmentList[index2] = this._segmentList[index2 + 1];
|
||||
this._segmentList[this._segmentCount - 1] = segment2;
|
||||
this._start -= this._segmentSize;
|
||||
this._end -= this._segmentSize;
|
||||
}
|
||||
if (this._size == 0)
|
||||
{
|
||||
this._start = this._segmentSize / 2;
|
||||
this._end = this._start;
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
public T1 PeekFront()
|
||||
{
|
||||
if (this._size == 0)
|
||||
throw new InvalidOperationException("The DoubleStack is empty.");
|
||||
return this._segmentList[this._start / this._segmentSize][this._start % this._segmentSize];
|
||||
}
|
||||
|
||||
public void PushBack(T1 back)
|
||||
{
|
||||
if (this._end == this._last)
|
||||
{
|
||||
T1[][] objArray = new T1[this._segmentCount + 1][];
|
||||
for (int index = 0; index < this._segmentCount; ++index)
|
||||
objArray[index] = this._segmentList[index];
|
||||
objArray[this._segmentCount] = new T1[this._segmentSize];
|
||||
++this._segmentCount;
|
||||
this._segmentList = objArray;
|
||||
this._last += this._segmentSize;
|
||||
}
|
||||
this._segmentList[this._end / this._segmentSize][this._end % this._segmentSize] = back;
|
||||
++this._end;
|
||||
++this._size;
|
||||
}
|
||||
|
||||
public T1 PopBack()
|
||||
{
|
||||
if (this._size == 0)
|
||||
throw new InvalidOperationException("The DoubleStack is empty.");
|
||||
T1[] segment = this._segmentList[this._end / this._segmentSize];
|
||||
int index = this._end % this._segmentSize;
|
||||
T1 obj = segment[index];
|
||||
segment[index] = default (T1);
|
||||
--this._end;
|
||||
--this._size;
|
||||
if (this._size == 0)
|
||||
{
|
||||
this._start = this._segmentSize / 2;
|
||||
this._end = this._start;
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
public T1 PeekBack()
|
||||
{
|
||||
if (this._size == 0)
|
||||
throw new InvalidOperationException("The DoubleStack is empty.");
|
||||
return this._segmentList[this._end / this._segmentSize][this._end % this._segmentSize];
|
||||
}
|
||||
|
||||
public void Clear(bool quickClear = false)
|
||||
{
|
||||
if (!quickClear)
|
||||
{
|
||||
for (int index = 0; index < this._segmentCount; ++index)
|
||||
Array.Clear((Array) this._segmentList[index], 0, this._segmentSize);
|
||||
}
|
||||
this._start = this._segmentSize / 2;
|
||||
this._end = this._start;
|
||||
this._size = 0;
|
||||
}
|
||||
|
||||
public int Count => this._size;
|
||||
}
|
||||
}
|
25
DataStructures/DrawAnimation.cs
Normal file
25
DataStructures/DrawAnimation.cs
Normal file
|
@ -0,0 +1,25 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.DataStructures.DrawAnimation
|
||||
// Assembly: Terraria, Version=1.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.Graphics;
|
||||
|
||||
namespace Terraria.DataStructures
|
||||
{
|
||||
public class DrawAnimation
|
||||
{
|
||||
public int Frame;
|
||||
public int FrameCount;
|
||||
public int TicksPerFrame;
|
||||
public int FrameCounter;
|
||||
|
||||
public virtual void Update()
|
||||
{
|
||||
}
|
||||
|
||||
public virtual Rectangle GetFrame(Texture2D texture) => texture.Frame();
|
||||
}
|
||||
}
|
34
DataStructures/DrawAnimationVertical.cs
Normal file
34
DataStructures/DrawAnimationVertical.cs
Normal file
|
@ -0,0 +1,34 @@
|
|||
// 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 location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
|
||||
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
|
||||
namespace Terraria.DataStructures
|
||||
{
|
||||
public class DrawAnimationVertical : DrawAnimation
|
||||
{
|
||||
public DrawAnimationVertical(int ticksperframe, int frameCount)
|
||||
{
|
||||
this.Frame = 0;
|
||||
this.FrameCounter = 0;
|
||||
this.FrameCount = frameCount;
|
||||
this.TicksPerFrame = ticksperframe;
|
||||
}
|
||||
|
||||
public override void Update()
|
||||
{
|
||||
if (++this.FrameCounter < this.TicksPerFrame)
|
||||
return;
|
||||
this.FrameCounter = 0;
|
||||
if (++this.Frame < this.FrameCount)
|
||||
return;
|
||||
this.Frame = 0;
|
||||
}
|
||||
|
||||
public override Rectangle GetFrame(Texture2D texture) => texture.Frame(verticalFrames: this.FrameCount, frameY: this.Frame);
|
||||
}
|
||||
}
|
178
DataStructures/DrawData.cs
Normal file
178
DataStructures/DrawData.cs
Normal file
|
@ -0,0 +1,178 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.DataStructures.DrawData
|
||||
// Assembly: Terraria, Version=1.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.Graphics;
|
||||
|
||||
namespace Terraria.DataStructures
|
||||
{
|
||||
public struct DrawData
|
||||
{
|
||||
public Texture2D texture;
|
||||
public Vector2 position;
|
||||
public Rectangle destinationRectangle;
|
||||
public Rectangle? sourceRect;
|
||||
public Color color;
|
||||
public float rotation;
|
||||
public Vector2 origin;
|
||||
public Vector2 scale;
|
||||
public SpriteEffects effect;
|
||||
public int shader;
|
||||
public bool ignorePlayerRotation;
|
||||
public readonly bool useDestinationRectangle;
|
||||
public static Rectangle? nullRectangle;
|
||||
|
||||
public DrawData(Texture2D texture, Vector2 position, Color color)
|
||||
{
|
||||
this.texture = texture;
|
||||
this.position = position;
|
||||
this.color = color;
|
||||
this.destinationRectangle = new Rectangle();
|
||||
this.sourceRect = DrawData.nullRectangle;
|
||||
this.rotation = 0.0f;
|
||||
this.origin = Vector2.Zero;
|
||||
this.scale = Vector2.One;
|
||||
this.effect = SpriteEffects.None;
|
||||
this.shader = 0;
|
||||
this.ignorePlayerRotation = false;
|
||||
this.useDestinationRectangle = false;
|
||||
}
|
||||
|
||||
public DrawData(Texture2D texture, Vector2 position, Rectangle? sourceRect, Color color)
|
||||
{
|
||||
this.texture = texture;
|
||||
this.position = position;
|
||||
this.color = color;
|
||||
this.destinationRectangle = new Rectangle();
|
||||
this.sourceRect = sourceRect;
|
||||
this.rotation = 0.0f;
|
||||
this.origin = Vector2.Zero;
|
||||
this.scale = Vector2.One;
|
||||
this.effect = SpriteEffects.None;
|
||||
this.shader = 0;
|
||||
this.ignorePlayerRotation = false;
|
||||
this.useDestinationRectangle = false;
|
||||
}
|
||||
|
||||
public DrawData(
|
||||
Texture2D texture,
|
||||
Vector2 position,
|
||||
Rectangle? sourceRect,
|
||||
Color color,
|
||||
float rotation,
|
||||
Vector2 origin,
|
||||
float scale,
|
||||
SpriteEffects effect,
|
||||
int inactiveLayerDepth)
|
||||
{
|
||||
this.texture = texture;
|
||||
this.position = position;
|
||||
this.sourceRect = sourceRect;
|
||||
this.color = color;
|
||||
this.rotation = rotation;
|
||||
this.origin = origin;
|
||||
this.scale = new Vector2(scale, scale);
|
||||
this.effect = effect;
|
||||
this.destinationRectangle = new Rectangle();
|
||||
this.shader = 0;
|
||||
this.ignorePlayerRotation = false;
|
||||
this.useDestinationRectangle = false;
|
||||
}
|
||||
|
||||
public DrawData(
|
||||
Texture2D texture,
|
||||
Vector2 position,
|
||||
Rectangle? sourceRect,
|
||||
Color color,
|
||||
float rotation,
|
||||
Vector2 origin,
|
||||
Vector2 scale,
|
||||
SpriteEffects effect,
|
||||
int inactiveLayerDepth)
|
||||
{
|
||||
this.texture = texture;
|
||||
this.position = position;
|
||||
this.sourceRect = sourceRect;
|
||||
this.color = color;
|
||||
this.rotation = rotation;
|
||||
this.origin = origin;
|
||||
this.scale = scale;
|
||||
this.effect = effect;
|
||||
this.destinationRectangle = new Rectangle();
|
||||
this.shader = 0;
|
||||
this.ignorePlayerRotation = false;
|
||||
this.useDestinationRectangle = false;
|
||||
}
|
||||
|
||||
public DrawData(Texture2D texture, Rectangle destinationRectangle, Color color)
|
||||
{
|
||||
this.texture = texture;
|
||||
this.destinationRectangle = destinationRectangle;
|
||||
this.color = color;
|
||||
this.position = Vector2.Zero;
|
||||
this.sourceRect = DrawData.nullRectangle;
|
||||
this.rotation = 0.0f;
|
||||
this.origin = Vector2.Zero;
|
||||
this.scale = Vector2.One;
|
||||
this.effect = SpriteEffects.None;
|
||||
this.shader = 0;
|
||||
this.ignorePlayerRotation = false;
|
||||
this.useDestinationRectangle = false;
|
||||
}
|
||||
|
||||
public DrawData(
|
||||
Texture2D texture,
|
||||
Rectangle destinationRectangle,
|
||||
Rectangle? sourceRect,
|
||||
Color color)
|
||||
{
|
||||
this.texture = texture;
|
||||
this.destinationRectangle = destinationRectangle;
|
||||
this.color = color;
|
||||
this.position = Vector2.Zero;
|
||||
this.sourceRect = sourceRect;
|
||||
this.rotation = 0.0f;
|
||||
this.origin = Vector2.Zero;
|
||||
this.scale = Vector2.One;
|
||||
this.effect = SpriteEffects.None;
|
||||
this.shader = 0;
|
||||
this.ignorePlayerRotation = false;
|
||||
this.useDestinationRectangle = false;
|
||||
}
|
||||
|
||||
public DrawData(
|
||||
Texture2D texture,
|
||||
Rectangle destinationRectangle,
|
||||
Rectangle? sourceRect,
|
||||
Color color,
|
||||
float rotation,
|
||||
Vector2 origin,
|
||||
SpriteEffects effect,
|
||||
int inactiveLayerDepth)
|
||||
{
|
||||
this.texture = texture;
|
||||
this.destinationRectangle = destinationRectangle;
|
||||
this.sourceRect = sourceRect;
|
||||
this.color = color;
|
||||
this.rotation = rotation;
|
||||
this.origin = origin;
|
||||
this.effect = effect;
|
||||
this.position = Vector2.Zero;
|
||||
this.scale = Vector2.One;
|
||||
this.shader = 0;
|
||||
this.ignorePlayerRotation = false;
|
||||
this.useDestinationRectangle = false;
|
||||
}
|
||||
|
||||
public void Draw(SpriteBatch sb)
|
||||
{
|
||||
if (this.useDestinationRectangle)
|
||||
sb.Draw(this.texture, this.destinationRectangle, this.sourceRect, this.color, this.rotation, this.origin, this.effect, 0.0f);
|
||||
else
|
||||
sb.Draw(this.texture, this.position, this.sourceRect, this.color, this.rotation, this.origin, this.scale, this.effect, 0.0f);
|
||||
}
|
||||
}
|
||||
}
|
22
DataStructures/DrillDebugDraw.cs
Normal file
22
DataStructures/DrillDebugDraw.cs
Normal file
|
@ -0,0 +1,22 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.DataStructures.DrillDebugDraw
|
||||
// Assembly: Terraria, Version=1.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;
|
||||
|
||||
namespace Terraria.DataStructures
|
||||
{
|
||||
public struct DrillDebugDraw
|
||||
{
|
||||
public Vector2 point;
|
||||
public Color color;
|
||||
|
||||
public DrillDebugDraw(Vector2 p, Color c)
|
||||
{
|
||||
this.point = p;
|
||||
this.color = c;
|
||||
}
|
||||
}
|
||||
}
|
46
DataStructures/MethodSequenceListItem.cs
Normal file
46
DataStructures/MethodSequenceListItem.cs
Normal file
|
@ -0,0 +1,46 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.DataStructures.MethodSequenceListItem
|
||||
// Assembly: Terraria, Version=1.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.DataStructures
|
||||
{
|
||||
public class MethodSequenceListItem
|
||||
{
|
||||
public string Name;
|
||||
public MethodSequenceListItem Parent;
|
||||
public Func<bool> Method;
|
||||
public bool Skip;
|
||||
|
||||
public MethodSequenceListItem(string name, Func<bool> method, MethodSequenceListItem parent = null)
|
||||
{
|
||||
this.Name = name;
|
||||
this.Method = method;
|
||||
this.Parent = parent;
|
||||
}
|
||||
|
||||
public bool ShouldAct(List<MethodSequenceListItem> sequence)
|
||||
{
|
||||
if (this.Skip || !sequence.Contains(this))
|
||||
return false;
|
||||
return this.Parent == null || this.Parent.ShouldAct(sequence);
|
||||
}
|
||||
|
||||
public bool Act() => this.Method();
|
||||
|
||||
public static void ExecuteSequence(List<MethodSequenceListItem> sequence)
|
||||
{
|
||||
foreach (MethodSequenceListItem sequenceListItem in sequence)
|
||||
{
|
||||
if (sequenceListItem.ShouldAct(sequence) && !sequenceListItem.Act())
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public override string ToString() => "name: " + this.Name + " skip: " + this.Skip.ToString() + " parent: " + (object) this.Parent;
|
||||
}
|
||||
}
|
56
DataStructures/NPCAimedTarget.cs
Normal file
56
DataStructures/NPCAimedTarget.cs
Normal file
|
@ -0,0 +1,56 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.DataStructures.NPCAimedTarget
|
||||
// Assembly: Terraria, Version=1.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 Terraria.Enums;
|
||||
|
||||
namespace Terraria.DataStructures
|
||||
{
|
||||
public struct NPCAimedTarget
|
||||
{
|
||||
public NPCTargetType Type;
|
||||
public Rectangle Hitbox;
|
||||
public int Width;
|
||||
public int Height;
|
||||
public Vector2 Position;
|
||||
public Vector2 Velocity;
|
||||
|
||||
public bool Invalid => this.Type == NPCTargetType.None;
|
||||
|
||||
public Vector2 Center => this.Position + this.Size / 2f;
|
||||
|
||||
public Vector2 Size => new Vector2((float) this.Width, (float) this.Height);
|
||||
|
||||
public NPCAimedTarget(NPC npc)
|
||||
{
|
||||
this.Type = NPCTargetType.NPC;
|
||||
this.Hitbox = npc.Hitbox;
|
||||
this.Width = npc.width;
|
||||
this.Height = npc.height;
|
||||
this.Position = npc.position;
|
||||
this.Velocity = npc.velocity;
|
||||
}
|
||||
|
||||
public NPCAimedTarget(Player player, bool ignoreTank = true)
|
||||
{
|
||||
this.Type = NPCTargetType.Player;
|
||||
this.Hitbox = player.Hitbox;
|
||||
this.Width = player.width;
|
||||
this.Height = player.height;
|
||||
this.Position = player.position;
|
||||
this.Velocity = player.velocity;
|
||||
if (ignoreTank || player.tankPet <= -1)
|
||||
return;
|
||||
Projectile projectile = Main.projectile[player.tankPet];
|
||||
this.Type = NPCTargetType.PlayerTankPet;
|
||||
this.Hitbox = projectile.Hitbox;
|
||||
this.Width = projectile.width;
|
||||
this.Height = projectile.height;
|
||||
this.Position = projectile.position;
|
||||
this.Velocity = projectile.velocity;
|
||||
}
|
||||
}
|
||||
}
|
40
DataStructures/PlacementHook.cs
Normal file
40
DataStructures/PlacementHook.cs
Normal file
|
@ -0,0 +1,40 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.DataStructures.PlacementHook
|
||||
// Assembly: Terraria, Version=1.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;
|
||||
|
||||
namespace Terraria.DataStructures
|
||||
{
|
||||
public struct PlacementHook
|
||||
{
|
||||
public Func<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 const int Response_AllInvalid = 0;
|
||||
|
||||
public PlacementHook(
|
||||
Func<int, int, int, int, int, int> hook,
|
||||
int badReturn,
|
||||
int badResponse,
|
||||
bool processedCoordinates)
|
||||
{
|
||||
this.hook = hook;
|
||||
this.badResponse = badResponse;
|
||||
this.badReturn = badReturn;
|
||||
this.processedCoordinates = processedCoordinates;
|
||||
}
|
||||
|
||||
public static bool operator ==(PlacementHook first, PlacementHook second) => first.hook == second.hook && first.badResponse == second.badResponse && first.badReturn == second.badReturn && first.processedCoordinates == second.processedCoordinates;
|
||||
|
||||
public static bool operator !=(PlacementHook first, PlacementHook second) => first.hook != second.hook || first.badResponse != second.badResponse || first.badReturn != second.badReturn || first.processedCoordinates != second.processedCoordinates;
|
||||
|
||||
public override bool Equals(object obj) => obj is PlacementHook placementHook && this == placementHook;
|
||||
|
||||
public override int GetHashCode() => base.GetHashCode();
|
||||
}
|
||||
}
|
129
DataStructures/PlayerDeathReason.cs
Normal file
129
DataStructures/PlayerDeathReason.cs
Normal file
|
@ -0,0 +1,129 @@
|
|||
// 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 location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
|
||||
|
||||
using System.IO;
|
||||
using Terraria.Localization;
|
||||
|
||||
namespace Terraria.DataStructures
|
||||
{
|
||||
public class PlayerDeathReason
|
||||
{
|
||||
private int SourcePlayerIndex = -1;
|
||||
private int SourceNPCIndex = -1;
|
||||
private int SourceProjectileIndex = -1;
|
||||
private int SourceOtherIndex = -1;
|
||||
private int SourceProjectileType;
|
||||
private int SourceItemType;
|
||||
private int SourceItemPrefix;
|
||||
private string SourceCustomReason;
|
||||
|
||||
public static PlayerDeathReason LegacyEmpty() => new PlayerDeathReason()
|
||||
{
|
||||
SourceOtherIndex = 254
|
||||
};
|
||||
|
||||
public static PlayerDeathReason LegacyDefault() => new PlayerDeathReason()
|
||||
{
|
||||
SourceOtherIndex = (int) byte.MaxValue
|
||||
};
|
||||
|
||||
public static PlayerDeathReason ByNPC(int index) => new PlayerDeathReason()
|
||||
{
|
||||
SourceNPCIndex = index
|
||||
};
|
||||
|
||||
public static PlayerDeathReason ByCustomReason(string reasonInEnglish) => new PlayerDeathReason()
|
||||
{
|
||||
SourceCustomReason = reasonInEnglish
|
||||
};
|
||||
|
||||
public static PlayerDeathReason ByPlayer(int index) => new PlayerDeathReason()
|
||||
{
|
||||
SourcePlayerIndex = index,
|
||||
SourceItemType = Main.player[index].inventory[Main.player[index].selectedItem].type,
|
||||
SourceItemPrefix = (int) Main.player[index].inventory[Main.player[index].selectedItem].prefix
|
||||
};
|
||||
|
||||
public static PlayerDeathReason ByOther(int type) => new PlayerDeathReason()
|
||||
{
|
||||
SourceOtherIndex = type
|
||||
};
|
||||
|
||||
public static PlayerDeathReason ByProjectile(
|
||||
int playerIndex,
|
||||
int projectileIndex)
|
||||
{
|
||||
PlayerDeathReason playerDeathReason = new PlayerDeathReason()
|
||||
{
|
||||
SourcePlayerIndex = playerIndex,
|
||||
SourceProjectileIndex = projectileIndex,
|
||||
SourceProjectileType = Main.projectile[projectileIndex].type
|
||||
};
|
||||
if (playerIndex >= 0 && playerIndex <= (int) byte.MaxValue)
|
||||
{
|
||||
playerDeathReason.SourceItemType = Main.player[playerIndex].inventory[Main.player[playerIndex].selectedItem].type;
|
||||
playerDeathReason.SourceItemPrefix = (int) Main.player[playerIndex].inventory[Main.player[playerIndex].selectedItem].prefix;
|
||||
}
|
||||
return playerDeathReason;
|
||||
}
|
||||
|
||||
public NetworkText GetDeathText(string deadPlayerName) => this.SourceCustomReason != null ? NetworkText.FromLiteral(this.SourceCustomReason) : Lang.CreateDeathMessage(deadPlayerName, this.SourcePlayerIndex, this.SourceNPCIndex, this.SourceProjectileIndex, this.SourceOtherIndex, this.SourceProjectileType, this.SourceItemType);
|
||||
|
||||
public void WriteSelfTo(BinaryWriter writer)
|
||||
{
|
||||
BitsByte bitsByte = (BitsByte) (byte) 0;
|
||||
bitsByte[0] = this.SourcePlayerIndex != -1;
|
||||
bitsByte[1] = this.SourceNPCIndex != -1;
|
||||
bitsByte[2] = this.SourceProjectileIndex != -1;
|
||||
bitsByte[3] = this.SourceOtherIndex != -1;
|
||||
bitsByte[4] = (uint) this.SourceProjectileType > 0U;
|
||||
bitsByte[5] = (uint) this.SourceItemType > 0U;
|
||||
bitsByte[6] = (uint) this.SourceItemPrefix > 0U;
|
||||
bitsByte[7] = this.SourceCustomReason != null;
|
||||
writer.Write((byte) bitsByte);
|
||||
if (bitsByte[0])
|
||||
writer.Write((short) this.SourcePlayerIndex);
|
||||
if (bitsByte[1])
|
||||
writer.Write((short) this.SourceNPCIndex);
|
||||
if (bitsByte[2])
|
||||
writer.Write((short) this.SourceProjectileIndex);
|
||||
if (bitsByte[3])
|
||||
writer.Write((byte) this.SourceOtherIndex);
|
||||
if (bitsByte[4])
|
||||
writer.Write((short) this.SourceProjectileType);
|
||||
if (bitsByte[5])
|
||||
writer.Write((short) this.SourceItemType);
|
||||
if (bitsByte[6])
|
||||
writer.Write((byte) this.SourceItemPrefix);
|
||||
if (!bitsByte[7])
|
||||
return;
|
||||
writer.Write(this.SourceCustomReason);
|
||||
}
|
||||
|
||||
public static PlayerDeathReason FromReader(BinaryReader reader)
|
||||
{
|
||||
PlayerDeathReason playerDeathReason = new PlayerDeathReason();
|
||||
BitsByte bitsByte = (BitsByte) reader.ReadByte();
|
||||
if (bitsByte[0])
|
||||
playerDeathReason.SourcePlayerIndex = (int) reader.ReadInt16();
|
||||
if (bitsByte[1])
|
||||
playerDeathReason.SourceNPCIndex = (int) reader.ReadInt16();
|
||||
if (bitsByte[2])
|
||||
playerDeathReason.SourceProjectileIndex = (int) reader.ReadInt16();
|
||||
if (bitsByte[3])
|
||||
playerDeathReason.SourceOtherIndex = (int) reader.ReadByte();
|
||||
if (bitsByte[4])
|
||||
playerDeathReason.SourceProjectileType = (int) reader.ReadInt16();
|
||||
if (bitsByte[5])
|
||||
playerDeathReason.SourceItemType = (int) reader.ReadInt16();
|
||||
if (bitsByte[6])
|
||||
playerDeathReason.SourceItemPrefix = (int) reader.ReadByte();
|
||||
if (bitsByte[7])
|
||||
playerDeathReason.SourceCustomReason = reader.ReadString();
|
||||
return playerDeathReason;
|
||||
}
|
||||
}
|
||||
}
|
56
DataStructures/Point16.cs
Normal file
56
DataStructures/Point16.cs
Normal file
|
@ -0,0 +1,56 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.DataStructures.Point16
|
||||
// Assembly: Terraria, Version=1.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;
|
||||
|
||||
namespace Terraria.DataStructures
|
||||
{
|
||||
public struct Point16
|
||||
{
|
||||
public readonly short X;
|
||||
public readonly short Y;
|
||||
public static Point16 Zero = new Point16(0, 0);
|
||||
public static Point16 NegativeOne = new Point16(-1, -1);
|
||||
|
||||
public Point16(Point point)
|
||||
{
|
||||
this.X = (short) point.X;
|
||||
this.Y = (short) point.Y;
|
||||
}
|
||||
|
||||
public Point16(int X, int Y)
|
||||
{
|
||||
this.X = (short) X;
|
||||
this.Y = (short) Y;
|
||||
}
|
||||
|
||||
public Point16(short X, short Y)
|
||||
{
|
||||
this.X = X;
|
||||
this.Y = Y;
|
||||
}
|
||||
|
||||
public static Point16 Max(int firstX, int firstY, int secondX, int secondY) => new Point16(firstX > secondX ? firstX : secondX, firstY > secondY ? firstY : secondY);
|
||||
|
||||
public Point16 Max(int compareX, int compareY) => new Point16((int) this.X > compareX ? (int) this.X : compareX, (int) this.Y > compareY ? (int) this.Y : compareY);
|
||||
|
||||
public Point16 Max(Point16 compareTo) => new Point16((int) this.X > (int) compareTo.X ? this.X : compareTo.X, (int) this.Y > (int) compareTo.Y ? this.Y : compareTo.Y);
|
||||
|
||||
public static bool operator ==(Point16 first, Point16 second) => (int) first.X == (int) second.X && (int) first.Y == (int) second.Y;
|
||||
|
||||
public static bool operator !=(Point16 first, Point16 second) => (int) first.X != (int) second.X || (int) first.Y != (int) second.Y;
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
Point16 point16 = (Point16) obj;
|
||||
return (int) this.X == (int) point16.X && (int) this.Y == (int) point16.Y;
|
||||
}
|
||||
|
||||
public override int GetHashCode() => (int) this.X << 16 | (int) (ushort) this.Y;
|
||||
|
||||
public override string ToString() => string.Format("{{{0}, {1}}}", (object) this.X, (object) this.Y);
|
||||
}
|
||||
}
|
15
DataStructures/SoundPlaySet.cs
Normal file
15
DataStructures/SoundPlaySet.cs
Normal file
|
@ -0,0 +1,15 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.DataStructures.SoundPlaySet
|
||||
// Assembly: Terraria, Version=1.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.DataStructures
|
||||
{
|
||||
public class SoundPlaySet
|
||||
{
|
||||
public int IntendedCooldown;
|
||||
public int SoundType;
|
||||
public int SoundStyle;
|
||||
}
|
||||
}
|
123
DataStructures/TileEntity.cs
Normal file
123
DataStructures/TileEntity.cs
Normal file
|
@ -0,0 +1,123 @@
|
|||
// 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 location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using Terraria.GameContent.Tile_Entities;
|
||||
|
||||
namespace Terraria.DataStructures
|
||||
{
|
||||
public abstract class TileEntity
|
||||
{
|
||||
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 int ID;
|
||||
public Point16 Position;
|
||||
public byte type;
|
||||
|
||||
public static int AssignNewID() => TileEntity.TileEntitiesNextID++;
|
||||
|
||||
public static event Action _UpdateStart;
|
||||
|
||||
public static event Action _UpdateEnd;
|
||||
|
||||
public static event Action<int, int, int> _NetPlaceEntity;
|
||||
|
||||
public static void Clear()
|
||||
{
|
||||
TileEntity.ByID.Clear();
|
||||
TileEntity.ByPosition.Clear();
|
||||
TileEntity.TileEntitiesNextID = 0;
|
||||
}
|
||||
|
||||
public static void UpdateStart()
|
||||
{
|
||||
if (TileEntity._UpdateStart == null)
|
||||
return;
|
||||
TileEntity._UpdateStart();
|
||||
}
|
||||
|
||||
public static void UpdateEnd()
|
||||
{
|
||||
if (TileEntity._UpdateEnd == null)
|
||||
return;
|
||||
TileEntity._UpdateEnd();
|
||||
}
|
||||
|
||||
public static void InitializeAll()
|
||||
{
|
||||
TETrainingDummy.Initialize();
|
||||
TEItemFrame.Initialize();
|
||||
TELogicSensor.Initialize();
|
||||
}
|
||||
|
||||
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)
|
||||
return;
|
||||
TileEntity._NetPlaceEntity(x, y, type);
|
||||
}
|
||||
|
||||
public virtual void Update()
|
||||
{
|
||||
}
|
||||
|
||||
public static void Write(BinaryWriter writer, TileEntity ent, bool networkSend = false)
|
||||
{
|
||||
writer.Write(ent.type);
|
||||
ent.WriteInner(writer, networkSend);
|
||||
}
|
||||
|
||||
public static TileEntity Read(BinaryReader reader, bool networkSend = false)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
private void WriteInner(BinaryWriter writer, bool networkSend)
|
||||
{
|
||||
if (!networkSend)
|
||||
writer.Write(this.ID);
|
||||
writer.Write(this.Position.X);
|
||||
writer.Write(this.Position.Y);
|
||||
this.WriteExtraData(writer, networkSend);
|
||||
}
|
||||
|
||||
private void ReadInner(BinaryReader reader, bool networkSend)
|
||||
{
|
||||
if (!networkSend)
|
||||
this.ID = reader.ReadInt32();
|
||||
this.Position = new Point16(reader.ReadInt16(), reader.ReadInt16());
|
||||
this.ReadExtraData(reader, networkSend);
|
||||
}
|
||||
|
||||
public virtual void WriteExtraData(BinaryWriter writer, bool networkSend)
|
||||
{
|
||||
}
|
||||
|
||||
public virtual void ReadExtraData(BinaryReader reader, bool networkSend)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
175
DataStructures/TileObjectPreviewData.cs
Normal file
175
DataStructures/TileObjectPreviewData.cs
Normal file
|
@ -0,0 +1,175 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.DataStructures.TileObjectPreviewData
|
||||
// Assembly: Terraria, Version=1.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;
|
||||
|
||||
namespace Terraria.DataStructures
|
||||
{
|
||||
public class TileObjectPreviewData
|
||||
{
|
||||
private ushort _type;
|
||||
private short _style;
|
||||
private int _alternate;
|
||||
private int _random;
|
||||
private bool _active;
|
||||
private Point16 _size;
|
||||
private Point16 _coordinates;
|
||||
private Point16 _objectStart;
|
||||
private int[,] _data;
|
||||
private Point16 _dataSize;
|
||||
private float _percentValid;
|
||||
public static TileObjectPreviewData placementCache;
|
||||
public static TileObjectPreviewData randomCache;
|
||||
public const int None = 0;
|
||||
public const int ValidSpot = 1;
|
||||
public const int InvalidSpot = 2;
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
this._active = false;
|
||||
this._size = Point16.Zero;
|
||||
this._coordinates = Point16.Zero;
|
||||
this._objectStart = Point16.Zero;
|
||||
this._percentValid = 0.0f;
|
||||
this._type = (ushort) 0;
|
||||
this._style = (short) 0;
|
||||
this._alternate = -1;
|
||||
this._random = -1;
|
||||
if (this._data == null)
|
||||
return;
|
||||
Array.Clear((Array) this._data, 0, (int) this._dataSize.X * (int) this._dataSize.Y);
|
||||
}
|
||||
|
||||
public void CopyFrom(TileObjectPreviewData copy)
|
||||
{
|
||||
this._type = copy._type;
|
||||
this._style = copy._style;
|
||||
this._alternate = copy._alternate;
|
||||
this._random = copy._random;
|
||||
this._active = copy._active;
|
||||
this._size = copy._size;
|
||||
this._coordinates = copy._coordinates;
|
||||
this._objectStart = copy._objectStart;
|
||||
this._percentValid = copy._percentValid;
|
||||
if (this._data == null)
|
||||
{
|
||||
this._data = new int[(int) copy._dataSize.X, (int) copy._dataSize.Y];
|
||||
this._dataSize = copy._dataSize;
|
||||
}
|
||||
else
|
||||
Array.Clear((Array) this._data, 0, this._data.Length);
|
||||
if ((int) this._dataSize.X < (int) copy._dataSize.X || (int) this._dataSize.Y < (int) copy._dataSize.Y)
|
||||
{
|
||||
int X = (int) copy._dataSize.X > (int) this._dataSize.X ? (int) copy._dataSize.X : (int) this._dataSize.X;
|
||||
int Y = (int) copy._dataSize.Y > (int) this._dataSize.Y ? (int) copy._dataSize.Y : (int) this._dataSize.Y;
|
||||
this._data = new int[X, Y];
|
||||
this._dataSize = new Point16(X, Y);
|
||||
}
|
||||
for (int index1 = 0; index1 < (int) copy._dataSize.X; ++index1)
|
||||
{
|
||||
for (int index2 = 0; index2 < (int) copy._dataSize.Y; ++index2)
|
||||
this._data[index1, index2] = copy._data[index1, index2];
|
||||
}
|
||||
}
|
||||
|
||||
public bool Active
|
||||
{
|
||||
get => this._active;
|
||||
set => this._active = value;
|
||||
}
|
||||
|
||||
public ushort Type
|
||||
{
|
||||
get => this._type;
|
||||
set => this._type = value;
|
||||
}
|
||||
|
||||
public short Style
|
||||
{
|
||||
get => this._style;
|
||||
set => this._style = value;
|
||||
}
|
||||
|
||||
public int Alternate
|
||||
{
|
||||
get => this._alternate;
|
||||
set => this._alternate = value;
|
||||
}
|
||||
|
||||
public int Random
|
||||
{
|
||||
get => this._random;
|
||||
set => this._random = value;
|
||||
}
|
||||
|
||||
public Point16 Size
|
||||
{
|
||||
get => this._size;
|
||||
set
|
||||
{
|
||||
if (value.X <= (short) 0 || value.Y <= (short) 0)
|
||||
throw new FormatException("PlacementData.Size was set to a negative value.");
|
||||
if ((int) value.X > (int) this._dataSize.X || (int) value.Y > (int) this._dataSize.Y)
|
||||
{
|
||||
int X = (int) value.X > (int) this._dataSize.X ? (int) value.X : (int) this._dataSize.X;
|
||||
int Y = (int) value.Y > (int) this._dataSize.Y ? (int) value.Y : (int) this._dataSize.Y;
|
||||
int[,] numArray = new int[X, Y];
|
||||
if (this._data != null)
|
||||
{
|
||||
for (int index1 = 0; index1 < (int) this._dataSize.X; ++index1)
|
||||
{
|
||||
for (int index2 = 0; index2 < (int) this._dataSize.Y; ++index2)
|
||||
numArray[index1, index2] = this._data[index1, index2];
|
||||
}
|
||||
}
|
||||
this._data = numArray;
|
||||
this._dataSize = new Point16(X, Y);
|
||||
}
|
||||
this._size = value;
|
||||
}
|
||||
}
|
||||
|
||||
public Point16 Coordinates
|
||||
{
|
||||
get => this._coordinates;
|
||||
set => this._coordinates = value;
|
||||
}
|
||||
|
||||
public Point16 ObjectStart
|
||||
{
|
||||
get => this._objectStart;
|
||||
set => this._objectStart = value;
|
||||
}
|
||||
|
||||
public void AllInvalid()
|
||||
{
|
||||
for (int index1 = 0; index1 < (int) this._size.X; ++index1)
|
||||
{
|
||||
for (int index2 = 0; index2 < (int) this._size.Y; ++index2)
|
||||
{
|
||||
if (this._data[index1, index2] != 0)
|
||||
this._data[index1, index2] = 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int this[int x, int y]
|
||||
{
|
||||
get
|
||||
{
|
||||
if (x < 0 || y < 0 || x >= (int) this._size.X || y >= (int) this._size.Y)
|
||||
throw new IndexOutOfRangeException();
|
||||
return this._data[x, y];
|
||||
}
|
||||
set
|
||||
{
|
||||
if (x < 0 || y < 0 || x >= (int) this._size.X || y >= (int) this._size.Y)
|
||||
throw new IndexOutOfRangeException();
|
||||
this._data[x, y] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
237
DelegateMethods.cs
Normal file
237
DelegateMethods.cs
Normal file
|
@ -0,0 +1,237 @@
|
|||
// 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 location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
|
||||
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria.DataStructures;
|
||||
using Terraria.Enums;
|
||||
using Terraria.ID;
|
||||
|
||||
namespace Terraria
|
||||
{
|
||||
public static class DelegateMethods
|
||||
{
|
||||
public static Vector3 v3_1 = Vector3.Zero;
|
||||
public static float f_1 = 0.0f;
|
||||
public static Color c_1 = Color.Transparent;
|
||||
public static int i_1 = 0;
|
||||
public static TileCuttingContext tilecut_0 = TileCuttingContext.Unknown;
|
||||
|
||||
public static Color ColorLerp_BlackToWhite(float percent) => Color.Lerp(Color.Black, Color.White, percent);
|
||||
|
||||
public static Color ColorLerp_HSL_H(float percent) => Main.hslToRgb(percent, 1f, 0.5f);
|
||||
|
||||
public static Color ColorLerp_HSL_S(float percent) => Main.hslToRgb(DelegateMethods.v3_1.X, percent, DelegateMethods.v3_1.Z);
|
||||
|
||||
public static Color ColorLerp_HSL_L(float percent) => Main.hslToRgb(DelegateMethods.v3_1.X, DelegateMethods.v3_1.Y, (float) (0.150000005960464 + 0.850000023841858 * (double) percent));
|
||||
|
||||
public static Color ColorLerp_HSL_O(float percent) => Color.Lerp(Color.White, Main.hslToRgb(DelegateMethods.v3_1.X, DelegateMethods.v3_1.Y, DelegateMethods.v3_1.Z), percent);
|
||||
|
||||
public static bool TestDust(int x, int y)
|
||||
{
|
||||
if (x < 0 || x >= Main.maxTilesX || y < 0 || y >= Main.maxTilesY)
|
||||
return false;
|
||||
int index = Dust.NewDust(new Vector2((float) x, (float) y) * 16f + new Vector2(8f), 0, 0, 6);
|
||||
Main.dust[index].noGravity = true;
|
||||
Main.dust[index].noLight = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool CastLight(int x, int y)
|
||||
{
|
||||
if (x < 0 || x >= Main.maxTilesX || y < 0 || y >= Main.maxTilesY || Main.tile[x, y] == null)
|
||||
return false;
|
||||
Lighting.AddLight(x, y, DelegateMethods.v3_1.X, DelegateMethods.v3_1.Y, DelegateMethods.v3_1.Z);
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool CastLightOpen(int x, int y)
|
||||
{
|
||||
if (x < 0 || x >= Main.maxTilesX || y < 0 || y >= Main.maxTilesY || Main.tile[x, y] == null)
|
||||
return false;
|
||||
if (!Main.tile[x, y].active() || Main.tile[x, y].inActive() || Main.tileSolidTop[(int) Main.tile[x, y].type] || !Main.tileSolid[(int) Main.tile[x, y].type])
|
||||
Lighting.AddLight(x, y, DelegateMethods.v3_1.X, DelegateMethods.v3_1.Y, DelegateMethods.v3_1.Z);
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool NotDoorStand(int x, int y)
|
||||
{
|
||||
if (Main.tile[x, y] == null || !Main.tile[x, y].active() || Main.tile[x, y].type != (ushort) 11)
|
||||
return true;
|
||||
return Main.tile[x, y].frameX >= (short) 18 && Main.tile[x, y].frameX < (short) 54;
|
||||
}
|
||||
|
||||
public static bool CutTiles(int x, int y)
|
||||
{
|
||||
if (!WorldGen.InWorld(x, y, 1) || Main.tile[x, y] == null)
|
||||
return false;
|
||||
if (!Main.tileCut[(int) Main.tile[x, y].type] || !WorldGen.CanCutTile(x, y, DelegateMethods.tilecut_0))
|
||||
return true;
|
||||
WorldGen.KillTile(x, y);
|
||||
if (Main.netMode != 0)
|
||||
NetMessage.SendData(17, number2: ((float) x), number3: ((float) y));
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool SearchAvoidedByNPCs(int x, int y) => WorldGen.InWorld(x, y, 1) && Main.tile[x, y] != null && (!Main.tile[x, y].active() || !TileID.Sets.AvoidedByNPCs[(int) Main.tile[x, y].type]);
|
||||
|
||||
public static void RainbowLaserDraw(
|
||||
int stage,
|
||||
Vector2 currentPosition,
|
||||
float distanceLeft,
|
||||
Rectangle lastFrame,
|
||||
out float distCovered,
|
||||
out Rectangle frame,
|
||||
out Vector2 origin,
|
||||
out Color color)
|
||||
{
|
||||
color = DelegateMethods.c_1;
|
||||
switch (stage)
|
||||
{
|
||||
case 0:
|
||||
distCovered = 33f;
|
||||
frame = new Rectangle(0, 0, 26, 22);
|
||||
origin = frame.Size() / 2f;
|
||||
break;
|
||||
case 1:
|
||||
frame = new Rectangle(0, 25, 26, 28);
|
||||
distCovered = (float) frame.Height;
|
||||
origin = new Vector2((float) (frame.Width / 2), 0.0f);
|
||||
break;
|
||||
case 2:
|
||||
distCovered = 22f;
|
||||
frame = new Rectangle(0, 56, 26, 22);
|
||||
origin = new Vector2((float) (frame.Width / 2), 1f);
|
||||
break;
|
||||
default:
|
||||
distCovered = 9999f;
|
||||
frame = Rectangle.Empty;
|
||||
origin = Vector2.Zero;
|
||||
color = Color.Transparent;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public static void TurretLaserDraw(
|
||||
int stage,
|
||||
Vector2 currentPosition,
|
||||
float distanceLeft,
|
||||
Rectangle lastFrame,
|
||||
out float distCovered,
|
||||
out Rectangle frame,
|
||||
out Vector2 origin,
|
||||
out Color color)
|
||||
{
|
||||
color = DelegateMethods.c_1;
|
||||
switch (stage)
|
||||
{
|
||||
case 0:
|
||||
distCovered = 32f;
|
||||
frame = new Rectangle(0, 0, 22, 20);
|
||||
origin = frame.Size() / 2f;
|
||||
break;
|
||||
case 1:
|
||||
++DelegateMethods.i_1;
|
||||
int num = DelegateMethods.i_1 % 5;
|
||||
frame = new Rectangle(0, 22 * (num + 1), 22, 20);
|
||||
distCovered = (float) (frame.Height - 1);
|
||||
origin = new Vector2((float) (frame.Width / 2), 0.0f);
|
||||
break;
|
||||
case 2:
|
||||
frame = new Rectangle(0, 154, 22, 30);
|
||||
distCovered = (float) frame.Height;
|
||||
origin = new Vector2((float) (frame.Width / 2), 1f);
|
||||
break;
|
||||
default:
|
||||
distCovered = 9999f;
|
||||
frame = Rectangle.Empty;
|
||||
origin = Vector2.Zero;
|
||||
color = Color.Transparent;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public static void LightningLaserDraw(
|
||||
int stage,
|
||||
Vector2 currentPosition,
|
||||
float distanceLeft,
|
||||
Rectangle lastFrame,
|
||||
out float distCovered,
|
||||
out Rectangle frame,
|
||||
out Vector2 origin,
|
||||
out Color color)
|
||||
{
|
||||
color = DelegateMethods.c_1 * DelegateMethods.f_1;
|
||||
switch (stage)
|
||||
{
|
||||
case 0:
|
||||
distCovered = 0.0f;
|
||||
frame = new Rectangle(0, 0, 21, 8);
|
||||
origin = frame.Size() / 2f;
|
||||
break;
|
||||
case 1:
|
||||
frame = new Rectangle(0, 8, 21, 6);
|
||||
distCovered = (float) frame.Height;
|
||||
origin = new Vector2((float) (frame.Width / 2), 0.0f);
|
||||
break;
|
||||
case 2:
|
||||
distCovered = 8f;
|
||||
frame = new Rectangle(0, 14, 21, 8);
|
||||
origin = new Vector2((float) (frame.Width / 2), 2f);
|
||||
break;
|
||||
default:
|
||||
distCovered = 9999f;
|
||||
frame = Rectangle.Empty;
|
||||
origin = Vector2.Zero;
|
||||
color = Color.Transparent;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public static int CompareYReverse(Point a, Point b) => b.Y.CompareTo(a.Y);
|
||||
|
||||
public static int CompareDrawSorterByYScale(DrawData a, DrawData b) => a.scale.Y.CompareTo(b.scale.Y);
|
||||
|
||||
public static class Minecart
|
||||
{
|
||||
public static Vector2 rotationOrigin;
|
||||
public static float rotation;
|
||||
|
||||
public static void Sparks(Vector2 dustPosition)
|
||||
{
|
||||
dustPosition += new Vector2(Main.rand.Next(2) == 0 ? 13f : -13f, 0.0f).RotatedBy((double) DelegateMethods.Minecart.rotation);
|
||||
int index = Dust.NewDust(dustPosition, 1, 1, 213, (float) Main.rand.Next(-2, 3), (float) Main.rand.Next(-2, 3));
|
||||
Main.dust[index].noGravity = true;
|
||||
Main.dust[index].fadeIn = (float) ((double) Main.dust[index].scale + 1.0 + 0.00999999977648258 * (double) Main.rand.Next(0, 51));
|
||||
Main.dust[index].noGravity = true;
|
||||
Main.dust[index].velocity *= (float) Main.rand.Next(15, 51) * 0.01f;
|
||||
Main.dust[index].velocity.X *= (float) Main.rand.Next(25, 101) * 0.01f;
|
||||
Main.dust[index].velocity.Y -= (float) Main.rand.Next(15, 31) * 0.1f;
|
||||
Main.dust[index].position.Y -= 4f;
|
||||
if (Main.rand.Next(3) != 0)
|
||||
Main.dust[index].noGravity = false;
|
||||
else
|
||||
Main.dust[index].scale *= 0.6f;
|
||||
}
|
||||
|
||||
public static void SparksMech(Vector2 dustPosition)
|
||||
{
|
||||
dustPosition += new Vector2(Main.rand.Next(2) == 0 ? 13f : -13f, 0.0f).RotatedBy((double) DelegateMethods.Minecart.rotation);
|
||||
int index = Dust.NewDust(dustPosition, 1, 1, 260, (float) Main.rand.Next(-2, 3), (float) Main.rand.Next(-2, 3));
|
||||
Main.dust[index].noGravity = true;
|
||||
Main.dust[index].fadeIn = (float) ((double) Main.dust[index].scale + 0.5 + 0.00999999977648258 * (double) Main.rand.Next(0, 51));
|
||||
Main.dust[index].noGravity = true;
|
||||
Main.dust[index].velocity *= (float) Main.rand.Next(15, 51) * 0.01f;
|
||||
Main.dust[index].velocity.X *= (float) Main.rand.Next(25, 101) * 0.01f;
|
||||
Main.dust[index].velocity.Y -= (float) Main.rand.Next(15, 31) * 0.1f;
|
||||
Main.dust[index].position.Y -= 4f;
|
||||
if (Main.rand.Next(3) != 0)
|
||||
Main.dust[index].noGravity = false;
|
||||
else
|
||||
Main.dust[index].scale *= 0.6f;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
145
DeprecatedClassLeftInForLoading.cs
Normal file
145
DeprecatedClassLeftInForLoading.cs
Normal file
|
@ -0,0 +1,145 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.DeprecatedClassLeftInForLoading
|
||||
// Assembly: Terraria, Version=1.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 System.Collections.Generic;
|
||||
|
||||
namespace Terraria
|
||||
{
|
||||
public class DeprecatedClassLeftInForLoading
|
||||
{
|
||||
public const int MaxDummies = 1000;
|
||||
public static DeprecatedClassLeftInForLoading[] dummies = new DeprecatedClassLeftInForLoading[1000];
|
||||
public short x;
|
||||
public short y;
|
||||
public int npc;
|
||||
public int whoAmI;
|
||||
|
||||
public static void UpdateDummies()
|
||||
{
|
||||
Dictionary<int, Rectangle> dictionary = new Dictionary<int, Rectangle>();
|
||||
bool flag1 = false;
|
||||
Rectangle rectangle = new Rectangle(0, 0, 32, 48);
|
||||
rectangle.Inflate(1600, 1600);
|
||||
int x = rectangle.X;
|
||||
int y = rectangle.Y;
|
||||
for (int index = 0; index < 1000; ++index)
|
||||
{
|
||||
if (DeprecatedClassLeftInForLoading.dummies[index] != null)
|
||||
{
|
||||
DeprecatedClassLeftInForLoading.dummies[index].whoAmI = index;
|
||||
if (DeprecatedClassLeftInForLoading.dummies[index].npc != -1)
|
||||
{
|
||||
if (!Main.npc[DeprecatedClassLeftInForLoading.dummies[index].npc].active || Main.npc[DeprecatedClassLeftInForLoading.dummies[index].npc].type != 488 || (double) Main.npc[DeprecatedClassLeftInForLoading.dummies[index].npc].ai[0] != (double) DeprecatedClassLeftInForLoading.dummies[index].x || (double) Main.npc[DeprecatedClassLeftInForLoading.dummies[index].npc].ai[1] != (double) DeprecatedClassLeftInForLoading.dummies[index].y)
|
||||
DeprecatedClassLeftInForLoading.dummies[index].Deactivate();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!flag1)
|
||||
{
|
||||
for (int key = 0; key < (int) byte.MaxValue; ++key)
|
||||
{
|
||||
if (Main.player[key].active)
|
||||
dictionary[key] = Main.player[key].getRect();
|
||||
}
|
||||
flag1 = true;
|
||||
}
|
||||
rectangle.X = (int) DeprecatedClassLeftInForLoading.dummies[index].x * 16 + x;
|
||||
rectangle.Y = (int) DeprecatedClassLeftInForLoading.dummies[index].y * 16 + y;
|
||||
bool flag2 = false;
|
||||
foreach (KeyValuePair<int, Rectangle> keyValuePair in dictionary)
|
||||
{
|
||||
if (keyValuePair.Value.Intersects(rectangle))
|
||||
{
|
||||
flag2 = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (flag2)
|
||||
DeprecatedClassLeftInForLoading.dummies[index].Activate();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public DeprecatedClassLeftInForLoading(int x, int y)
|
||||
{
|
||||
this.x = (short) x;
|
||||
this.y = (short) y;
|
||||
this.npc = -1;
|
||||
}
|
||||
|
||||
public static int Find(int x, int y)
|
||||
{
|
||||
for (int index = 0; index < 1000; ++index)
|
||||
{
|
||||
if (DeprecatedClassLeftInForLoading.dummies[index] != null && (int) DeprecatedClassLeftInForLoading.dummies[index].x == x && (int) DeprecatedClassLeftInForLoading.dummies[index].y == y)
|
||||
return index;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public static int Place(int x, int y)
|
||||
{
|
||||
int index1 = -1;
|
||||
for (int index2 = 0; index2 < 1000; ++index2)
|
||||
{
|
||||
if (DeprecatedClassLeftInForLoading.dummies[index2] == null)
|
||||
{
|
||||
index1 = index2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (index1 == -1)
|
||||
return index1;
|
||||
DeprecatedClassLeftInForLoading.dummies[index1] = new DeprecatedClassLeftInForLoading(x, y);
|
||||
return index1;
|
||||
}
|
||||
|
||||
public static void Kill(int x, int y)
|
||||
{
|
||||
for (int index = 0; index < 1000; ++index)
|
||||
{
|
||||
DeprecatedClassLeftInForLoading dummy = DeprecatedClassLeftInForLoading.dummies[index];
|
||||
if (dummy != null && (int) dummy.x == x && (int) dummy.y == y)
|
||||
DeprecatedClassLeftInForLoading.dummies[index] = (DeprecatedClassLeftInForLoading) null;
|
||||
}
|
||||
}
|
||||
|
||||
public static int Hook_AfterPlacement(int x, int y, int type = 21, int style = 0, int direction = 1)
|
||||
{
|
||||
if (Main.netMode != 1)
|
||||
return DeprecatedClassLeftInForLoading.Place(x - 1, y - 2);
|
||||
NetMessage.SendTileSquare(Main.myPlayer, x - 1, y - 1, 3);
|
||||
NetMessage.SendData(87, number: (x - 1), number2: ((float) (y - 2)));
|
||||
return -1;
|
||||
}
|
||||
|
||||
public void Activate()
|
||||
{
|
||||
int index = NPC.NewNPC((int) this.x * 16 + 16, (int) this.y * 16 + 48, 488, 100);
|
||||
Main.npc[index].ai[0] = (float) this.x;
|
||||
Main.npc[index].ai[1] = (float) this.y;
|
||||
Main.npc[index].netUpdate = true;
|
||||
this.npc = index;
|
||||
if (Main.netMode == 1)
|
||||
return;
|
||||
NetMessage.SendData(86, number: this.whoAmI, number2: ((float) this.x), number3: ((float) this.y));
|
||||
}
|
||||
|
||||
public void Deactivate()
|
||||
{
|
||||
if (this.npc != -1)
|
||||
Main.npc[this.npc].active = false;
|
||||
this.npc = -1;
|
||||
if (Main.netMode == 1)
|
||||
return;
|
||||
NetMessage.SendData(86, number: this.whoAmI, number2: ((float) this.x), number3: ((float) this.y));
|
||||
}
|
||||
|
||||
public override string ToString() => this.x.ToString() + "x " + (object) this.y + "y npc: " + (object) this.npc;
|
||||
}
|
||||
}
|
118
Entity.cs
Normal file
118
Entity.cs
Normal file
|
@ -0,0 +1,118 @@
|
|||
// 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 location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
|
||||
|
||||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
|
||||
namespace Terraria
|
||||
{
|
||||
public abstract class Entity
|
||||
{
|
||||
public int whoAmI;
|
||||
public bool active;
|
||||
public Vector2 position;
|
||||
public Vector2 velocity;
|
||||
public Vector2 oldPosition;
|
||||
public Vector2 oldVelocity;
|
||||
public int oldDirection;
|
||||
public int direction = 1;
|
||||
public int width;
|
||||
public int height;
|
||||
public bool wet;
|
||||
public bool honeyWet;
|
||||
public byte wetCount;
|
||||
public bool lavaWet;
|
||||
|
||||
public float AngleTo(Vector2 Destination) => (float) Math.Atan2((double) Destination.Y - (double) this.Center.Y, (double) Destination.X - (double) this.Center.X);
|
||||
|
||||
public float AngleFrom(Vector2 Source) => (float) Math.Atan2((double) this.Center.Y - (double) Source.Y, (double) this.Center.X - (double) Source.X);
|
||||
|
||||
public float Distance(Vector2 Other) => Vector2.Distance(this.Center, Other);
|
||||
|
||||
public float DistanceSQ(Vector2 Other) => Vector2.DistanceSquared(this.Center, Other);
|
||||
|
||||
public Vector2 DirectionTo(Vector2 Destination) => Vector2.Normalize(Destination - this.Center);
|
||||
|
||||
public Vector2 DirectionFrom(Vector2 Source) => Vector2.Normalize(this.Center - Source);
|
||||
|
||||
public bool WithinRange(Vector2 Target, float MaxRange) => (double) Vector2.DistanceSquared(this.Center, Target) <= (double) MaxRange * (double) MaxRange;
|
||||
|
||||
public Vector2 Center
|
||||
{
|
||||
get => new Vector2(this.position.X + (float) (this.width / 2), this.position.Y + (float) (this.height / 2));
|
||||
set => this.position = new Vector2(value.X - (float) (this.width / 2), value.Y - (float) (this.height / 2));
|
||||
}
|
||||
|
||||
public Vector2 Left
|
||||
{
|
||||
get => new Vector2(this.position.X, this.position.Y + (float) (this.height / 2));
|
||||
set => this.position = new Vector2(value.X, value.Y - (float) (this.height / 2));
|
||||
}
|
||||
|
||||
public Vector2 Right
|
||||
{
|
||||
get => new Vector2(this.position.X + (float) this.width, this.position.Y + (float) (this.height / 2));
|
||||
set => this.position = new Vector2(value.X - (float) this.width, value.Y - (float) (this.height / 2));
|
||||
}
|
||||
|
||||
public Vector2 Top
|
||||
{
|
||||
get => new Vector2(this.position.X + (float) (this.width / 2), this.position.Y);
|
||||
set => this.position = new Vector2(value.X - (float) (this.width / 2), value.Y);
|
||||
}
|
||||
|
||||
public Vector2 TopLeft
|
||||
{
|
||||
get => this.position;
|
||||
set => this.position = value;
|
||||
}
|
||||
|
||||
public Vector2 TopRight
|
||||
{
|
||||
get => new Vector2(this.position.X + (float) this.width, this.position.Y);
|
||||
set => this.position = new Vector2(value.X - (float) this.width, value.Y);
|
||||
}
|
||||
|
||||
public Vector2 Bottom
|
||||
{
|
||||
get => new Vector2(this.position.X + (float) (this.width / 2), this.position.Y + (float) this.height);
|
||||
set => this.position = new Vector2(value.X - (float) (this.width / 2), value.Y - (float) this.height);
|
||||
}
|
||||
|
||||
public Vector2 BottomLeft
|
||||
{
|
||||
get => new Vector2(this.position.X, this.position.Y + (float) this.height);
|
||||
set => this.position = new Vector2(value.X, value.Y - (float) this.height);
|
||||
}
|
||||
|
||||
public Vector2 BottomRight
|
||||
{
|
||||
get => new Vector2(this.position.X + (float) this.width, this.position.Y + (float) this.height);
|
||||
set => this.position = new Vector2(value.X - (float) this.width, value.Y - (float) this.height);
|
||||
}
|
||||
|
||||
public Vector2 Size
|
||||
{
|
||||
get => new Vector2((float) this.width, (float) this.height);
|
||||
set
|
||||
{
|
||||
this.width = (int) value.X;
|
||||
this.height = (int) value.Y;
|
||||
}
|
||||
}
|
||||
|
||||
public Rectangle Hitbox
|
||||
{
|
||||
get => new Rectangle((int) this.position.X, (int) this.position.Y, this.width, this.height);
|
||||
set
|
||||
{
|
||||
this.position = new Vector2((float) value.X, (float) value.Y);
|
||||
this.width = value.Width;
|
||||
this.height = value.Height;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
24
Enums/AnchorType.cs
Normal file
24
Enums/AnchorType.cs
Normal file
|
@ -0,0 +1,24 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Enums.AnchorType
|
||||
// Assembly: Terraria, Version=1.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;
|
||||
|
||||
namespace Terraria.Enums
|
||||
{
|
||||
[Flags]
|
||||
public enum AnchorType
|
||||
{
|
||||
None = 0,
|
||||
SolidTile = 1,
|
||||
SolidWithTop = 2,
|
||||
Table = 4,
|
||||
SolidSide = 8,
|
||||
Tree = 16, // 0x00000010
|
||||
AlternateTile = 32, // 0x00000020
|
||||
EmptyTile = 64, // 0x00000040
|
||||
SolidBottom = 128, // 0x00000080
|
||||
}
|
||||
}
|
16
Enums/LiquidPlacement.cs
Normal file
16
Enums/LiquidPlacement.cs
Normal file
|
@ -0,0 +1,16 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Enums.LiquidPlacement
|
||||
// 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.Enums
|
||||
{
|
||||
public enum LiquidPlacement
|
||||
{
|
||||
Allowed,
|
||||
NotAllowed,
|
||||
OnlyInLiquid,
|
||||
OnlyInFullLiquid,
|
||||
}
|
||||
}
|
16
Enums/NPCTargetType.cs
Normal file
16
Enums/NPCTargetType.cs
Normal file
|
@ -0,0 +1,16 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Enums.NPCTargetType
|
||||
// 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.Enums
|
||||
{
|
||||
public enum NPCTargetType
|
||||
{
|
||||
None,
|
||||
Player,
|
||||
NPC,
|
||||
PlayerTankPet,
|
||||
}
|
||||
}
|
16
Enums/TileCuttingContext.cs
Normal file
16
Enums/TileCuttingContext.cs
Normal file
|
@ -0,0 +1,16 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Enums.TileCuttingContext
|
||||
// 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.Enums
|
||||
{
|
||||
public enum TileCuttingContext
|
||||
{
|
||||
Unknown,
|
||||
AttackMelee,
|
||||
AttackProjectile,
|
||||
TilePlacement,
|
||||
}
|
||||
}
|
363
Enums/TileIDEnum.cs
Normal file
363
Enums/TileIDEnum.cs
Normal file
|
@ -0,0 +1,363 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Enums.TileIDEnum
|
||||
// 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.Enums
|
||||
{
|
||||
public enum TileIDEnum
|
||||
{
|
||||
Dirt,
|
||||
Stone,
|
||||
Grass,
|
||||
Plants,
|
||||
Torches,
|
||||
Trees,
|
||||
Iron,
|
||||
Copper,
|
||||
Gold,
|
||||
Silver,
|
||||
ClosedDoor,
|
||||
OpenDoor,
|
||||
Heart,
|
||||
Bottles,
|
||||
Tables,
|
||||
Chairs,
|
||||
Anvils,
|
||||
Furnaces,
|
||||
WorkBenches,
|
||||
Platforms,
|
||||
Saplings,
|
||||
Containers,
|
||||
Demonite,
|
||||
CorruptGrass,
|
||||
CorruptPlants,
|
||||
Ebonstone,
|
||||
DemonAltar,
|
||||
Sunflower,
|
||||
Pots,
|
||||
PiggyBank,
|
||||
WoodBlock,
|
||||
ShadowOrbs,
|
||||
CorruptThorns,
|
||||
Candles,
|
||||
Chandeliers,
|
||||
Jackolanterns,
|
||||
Presents,
|
||||
Meteorite,
|
||||
GrayBrick,
|
||||
RedBrick,
|
||||
ClayBlock,
|
||||
BlueDungeonBrick,
|
||||
HangingLanterns,
|
||||
GreenDungeonBrick,
|
||||
PinkDungeonBrick,
|
||||
GoldBrick,
|
||||
SilverBrick,
|
||||
CopperBrick,
|
||||
Spikes,
|
||||
WaterCandle,
|
||||
Books,
|
||||
Cobweb,
|
||||
Vines,
|
||||
Sand,
|
||||
Glass,
|
||||
Signs,
|
||||
Obsidian,
|
||||
Ash,
|
||||
Hellstone,
|
||||
Mud,
|
||||
JungleGrass,
|
||||
JunglePlants,
|
||||
JungleVines,
|
||||
Sapphire,
|
||||
Ruby,
|
||||
Emerald,
|
||||
Topaz,
|
||||
Amethyst,
|
||||
Diamond,
|
||||
JungleThorns,
|
||||
MushroomGrass,
|
||||
MushroomPlants,
|
||||
MushroomTrees,
|
||||
Plants2,
|
||||
JunglePlants2,
|
||||
ObsidianBrick,
|
||||
HellstoneBrick,
|
||||
Hellforge,
|
||||
ClayPot,
|
||||
Beds,
|
||||
Cactus,
|
||||
Coral,
|
||||
ImmatureHerbs,
|
||||
MatureHerbs,
|
||||
BloomingHerbs,
|
||||
Tombstones,
|
||||
Loom,
|
||||
Pianos,
|
||||
Dressers,
|
||||
Benches,
|
||||
Bathtubs,
|
||||
Banners,
|
||||
Lampposts,
|
||||
Lamps,
|
||||
Kegs,
|
||||
ChineseLanterns,
|
||||
CookingPots,
|
||||
Safes,
|
||||
SkullLanterns,
|
||||
TrashCan,
|
||||
Candelabras,
|
||||
Bookcases,
|
||||
Thrones,
|
||||
Bowls,
|
||||
GrandfatherClocks,
|
||||
Statues,
|
||||
Sawmill,
|
||||
Cobalt,
|
||||
Mythril,
|
||||
HallowedGrass,
|
||||
HallowedPlants,
|
||||
Adamantite,
|
||||
Ebonsand,
|
||||
HallowedPlants2,
|
||||
TinkerersWorkbench,
|
||||
HallowedVines,
|
||||
Pearlsand,
|
||||
Pearlstone,
|
||||
PearlstoneBrick,
|
||||
IridescentBrick,
|
||||
Mudstone,
|
||||
CobaltBrick,
|
||||
MythrilBrick,
|
||||
Silt,
|
||||
WoodenPlank,
|
||||
CrystalBall,
|
||||
DiscoBall,
|
||||
MagicalIceBlock,
|
||||
Mannequin,
|
||||
Crystals,
|
||||
ActiveStoneBlock,
|
||||
InactiveStoneBlock,
|
||||
Lever,
|
||||
AdamantiteForge,
|
||||
MythrilAnvil,
|
||||
PressurePlates,
|
||||
Switches,
|
||||
Traps,
|
||||
Boulder,
|
||||
MusicBoxes,
|
||||
DemoniteBrick,
|
||||
Explosives,
|
||||
InletPump,
|
||||
OutletPump,
|
||||
Timers,
|
||||
CandyCaneBlock,
|
||||
GreenCandyCaneBlock,
|
||||
SnowBlock,
|
||||
SnowBrick,
|
||||
HolidayLights,
|
||||
AdamantiteBeam,
|
||||
SandstoneBrick,
|
||||
EbonstoneBrick,
|
||||
RedStucco,
|
||||
YellowStucco,
|
||||
GreenStucco,
|
||||
GrayStucco,
|
||||
Ebonwood,
|
||||
RichMahogany,
|
||||
Pearlwood,
|
||||
RainbowBrick,
|
||||
IceBlock,
|
||||
BreakableIce,
|
||||
CorruptIce,
|
||||
HallowedIce,
|
||||
Stalagtite,
|
||||
Tin,
|
||||
Lead,
|
||||
Tungsten,
|
||||
Platinum,
|
||||
PineTree,
|
||||
ChristmasTree,
|
||||
Sinks,
|
||||
PlatinumCandelabra,
|
||||
PlatinumCandle,
|
||||
TinBrick,
|
||||
TungstenBrick,
|
||||
PlatinumBrick,
|
||||
ExposedGems,
|
||||
GreenMoss,
|
||||
BrownMoss,
|
||||
RedMoss,
|
||||
BlueMoss,
|
||||
PurpleMoss,
|
||||
LongMoss,
|
||||
SmallPiles,
|
||||
LargePiles,
|
||||
LargePiles2,
|
||||
CactusBlock,
|
||||
Cloud,
|
||||
MushroomBlock,
|
||||
LivingWood,
|
||||
LeafBlock,
|
||||
SlimeBlock,
|
||||
BoneBlock,
|
||||
FleshBlock,
|
||||
RainCloud,
|
||||
FrozenSlimeBlock,
|
||||
Asphalt,
|
||||
FleshGrass,
|
||||
RedIce,
|
||||
FleshWeeds,
|
||||
Sunplate,
|
||||
Crimstone,
|
||||
Crimtane,
|
||||
CrimsonVines,
|
||||
IceBrick,
|
||||
WaterFountain,
|
||||
Shadewood,
|
||||
Cannon,
|
||||
LandMine,
|
||||
Chlorophyte,
|
||||
SnowballLauncher,
|
||||
Rope,
|
||||
Chain,
|
||||
Campfire,
|
||||
Firework,
|
||||
Blendomatic,
|
||||
MeatGrinder,
|
||||
Extractinator,
|
||||
Solidifier,
|
||||
Palladium,
|
||||
Orichalcum,
|
||||
Titanium,
|
||||
Slush,
|
||||
Hive,
|
||||
LihzahrdBrick,
|
||||
DyePlants,
|
||||
DyeVat,
|
||||
HoneyBlock,
|
||||
CrispyHoneyBlock,
|
||||
Larva,
|
||||
WoodenSpikes,
|
||||
PlantDetritus,
|
||||
Crimsand,
|
||||
Teleporter,
|
||||
LifeFruit,
|
||||
LihzahrdAltar,
|
||||
PlanteraBulb,
|
||||
MetalBars,
|
||||
Painting3X3,
|
||||
Painting4X3,
|
||||
Painting6X4,
|
||||
ImbuingStation,
|
||||
BubbleMachine,
|
||||
Painting2X3,
|
||||
Painting3X2,
|
||||
Autohammer,
|
||||
PalladiumColumn,
|
||||
BubblegumBlock,
|
||||
Titanstone,
|
||||
PumpkinBlock,
|
||||
HayBlock,
|
||||
SpookyWood,
|
||||
Pumpkins,
|
||||
AmethystGemsparkOff,
|
||||
TopazGemsparkOff,
|
||||
SapphireGemsparkOff,
|
||||
EmeraldGemsparkOff,
|
||||
RubyGemsparkOff,
|
||||
DiamondGemsparkOff,
|
||||
AmberGemsparkOff,
|
||||
AmethystGemspark,
|
||||
TopazGemspark,
|
||||
SapphireGemspark,
|
||||
EmeraldGemspark,
|
||||
RubyGemspark,
|
||||
DiamondGemspark,
|
||||
AmberGemspark,
|
||||
Womannequin,
|
||||
FireflyinaBottle,
|
||||
LightningBuginaBottle,
|
||||
Cog,
|
||||
StoneSlab,
|
||||
SandStoneSlab,
|
||||
BunnyCage,
|
||||
SquirrelCage,
|
||||
MallardDuckCage,
|
||||
DuckCage,
|
||||
BirdCage,
|
||||
BlueJay,
|
||||
CardinalCage,
|
||||
FishBowl,
|
||||
HeavyWorkBench,
|
||||
CopperPlating,
|
||||
SnailCage,
|
||||
GlowingSnailCage,
|
||||
AmmoBox,
|
||||
MonarchButterflyJar,
|
||||
PurpleEmperorButterflyJar,
|
||||
RedAdmiralButterflyJar,
|
||||
UlyssesButterflyJar,
|
||||
SulphurButterflyJar,
|
||||
TreeNymphButterflyJar,
|
||||
ZebraSwallowtailButterflyJar,
|
||||
JuliaButterflyJar,
|
||||
ScorpionCage,
|
||||
BlackScorpionCage,
|
||||
FrogCage,
|
||||
MouseCage,
|
||||
BoneWelder,
|
||||
FleshCloningVat,
|
||||
GlassKiln,
|
||||
LihzahrdFurnace,
|
||||
LivingLoom,
|
||||
SkyMill,
|
||||
IceMachine,
|
||||
SteampunkBoiler,
|
||||
HoneyDispenser,
|
||||
PenguinCage,
|
||||
WormCage,
|
||||
DynastyWood,
|
||||
RedDynastyShingles,
|
||||
BlueDynastyShingles,
|
||||
MinecartTrack,
|
||||
Coralstone,
|
||||
BlueJellyfishBowl,
|
||||
GreenJellyfishBowl,
|
||||
PinkJellyfishBowl,
|
||||
ShipInABottle,
|
||||
SeaweedPlanter,
|
||||
BorealWood,
|
||||
PalmWood,
|
||||
PalmTree,
|
||||
BeachPiles,
|
||||
TinPlating,
|
||||
Waterfall,
|
||||
Lavafall,
|
||||
Confetti,
|
||||
ConfettiBlack,
|
||||
CopperCoinPile,
|
||||
SilverCoinPile,
|
||||
GoldCoinPile,
|
||||
PlatinumCoinPile,
|
||||
WeaponsRack,
|
||||
FireworksBox,
|
||||
LivingFire,
|
||||
AlphabetStatues,
|
||||
FireworkFountain,
|
||||
GrasshopperCage,
|
||||
LivingCursedFire,
|
||||
LivingDemonFire,
|
||||
LivingFrostFire,
|
||||
LivingIchor,
|
||||
LivingUltrabrightFire,
|
||||
Honeyfall,
|
||||
ChlorophyteBrick,
|
||||
CrimtaneBrick,
|
||||
ShroomitePlating,
|
||||
MushroomStatue,
|
||||
Count,
|
||||
}
|
||||
}
|
15
Enums/TileObjectDirection.cs
Normal file
15
Enums/TileObjectDirection.cs
Normal file
|
@ -0,0 +1,15 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Enums.TileObjectDirection
|
||||
// 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.Enums
|
||||
{
|
||||
public enum TileObjectDirection
|
||||
{
|
||||
None,
|
||||
PlaceLeft,
|
||||
PlaceRight,
|
||||
}
|
||||
}
|
17
Enums/TileScanGroup.cs
Normal file
17
Enums/TileScanGroup.cs
Normal file
|
@ -0,0 +1,17 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Enums.TileScanGroup
|
||||
// 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.Enums
|
||||
{
|
||||
public enum TileScanGroup
|
||||
{
|
||||
None,
|
||||
Corruption,
|
||||
Crimson,
|
||||
Hallow,
|
||||
TotalGoodEvil,
|
||||
}
|
||||
}
|
18
Enums/TownNPCRoomCheckFailureReason.cs
Normal file
18
Enums/TownNPCRoomCheckFailureReason.cs
Normal file
|
@ -0,0 +1,18 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Enums.TownNPCRoomCheckFailureReason
|
||||
// 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.Enums
|
||||
{
|
||||
public enum TownNPCRoomCheckFailureReason
|
||||
{
|
||||
None,
|
||||
TooCloseToWorldEdge,
|
||||
RoomIsTooBig,
|
||||
RoomIsTooSmall,
|
||||
HoleInWallIsTooBig,
|
||||
RoomCheckStartedInASolidTile,
|
||||
}
|
||||
}
|
16
Enums/TownNPCSpawnResult.cs
Normal file
16
Enums/TownNPCSpawnResult.cs
Normal file
|
@ -0,0 +1,16 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Enums.TownNPCSpawnResult
|
||||
// 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.Enums
|
||||
{
|
||||
public enum TownNPCSpawnResult
|
||||
{
|
||||
Blocked,
|
||||
Successful,
|
||||
RelocatedHomeless,
|
||||
BlockedInfiHousing,
|
||||
}
|
||||
}
|
65
Extensions/EnumerationExtensions.cs
Normal file
65
Extensions/EnumerationExtensions.cs
Normal file
|
@ -0,0 +1,65 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Extensions.EnumerationExtensions
|
||||
// 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;
|
||||
|
||||
namespace Extensions
|
||||
{
|
||||
public static class EnumerationExtensions
|
||||
{
|
||||
public static T Include<T>(this Enum value, T append)
|
||||
{
|
||||
Type type = value.GetType();
|
||||
object obj1 = (object) value;
|
||||
EnumerationExtensions._Value obj2 = new EnumerationExtensions._Value((object) append, type);
|
||||
if ((ValueType) obj2.Signed is long)
|
||||
obj1 = (object) (Convert.ToInt64((object) value) | obj2.Signed.Value);
|
||||
else if ((ValueType) obj2.Unsigned is ulong)
|
||||
obj1 = (object) (ulong) ((long) Convert.ToUInt64((object) value) | (long) obj2.Unsigned.Value);
|
||||
return (T) Enum.Parse(type, obj1.ToString());
|
||||
}
|
||||
|
||||
public static T Remove<T>(this Enum value, T remove)
|
||||
{
|
||||
Type type = value.GetType();
|
||||
object obj1 = (object) value;
|
||||
EnumerationExtensions._Value obj2 = new EnumerationExtensions._Value((object) remove, type);
|
||||
if ((ValueType) obj2.Signed is long)
|
||||
obj1 = (object) (Convert.ToInt64((object) value) & ~obj2.Signed.Value);
|
||||
else if ((ValueType) obj2.Unsigned is ulong)
|
||||
obj1 = (object) (ulong) ((long) Convert.ToUInt64((object) value) & ~(long) obj2.Unsigned.Value);
|
||||
return (T) Enum.Parse(type, obj1.ToString());
|
||||
}
|
||||
|
||||
public static bool Has<T>(this Enum value, T check)
|
||||
{
|
||||
Type type = value.GetType();
|
||||
EnumerationExtensions._Value obj = new EnumerationExtensions._Value((object) check, type);
|
||||
if ((ValueType) obj.Signed is long)
|
||||
return (Convert.ToInt64((object) value) & obj.Signed.Value) == obj.Signed.Value;
|
||||
return (ValueType) obj.Unsigned is ulong && ((long) Convert.ToUInt64((object) value) & (long) obj.Unsigned.Value) == (long) obj.Unsigned.Value;
|
||||
}
|
||||
|
||||
public static bool Missing<T>(this Enum obj, T value) => !obj.Has<T>(value);
|
||||
|
||||
private class _Value
|
||||
{
|
||||
private static Type _UInt64 = typeof (ulong);
|
||||
private static Type _UInt32 = typeof (long);
|
||||
public long? Signed;
|
||||
public ulong? Unsigned;
|
||||
|
||||
public _Value(object value, Type type)
|
||||
{
|
||||
Type type1 = type.IsEnum ? Enum.GetUnderlyingType(type) : throw new ArgumentException("Value provided is not an enumerated type!");
|
||||
if (type1.Equals(EnumerationExtensions._Value._UInt32) || type1.Equals(EnumerationExtensions._Value._UInt64))
|
||||
this.Unsigned = new ulong?(Convert.ToUInt64(value));
|
||||
else
|
||||
this.Signed = new long?(Convert.ToInt64(value));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
44
FrameSkipTest.cs
Normal file
44
FrameSkipTest.cs
Normal file
|
@ -0,0 +1,44 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.FrameSkipTest
|
||||
// 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 ReLogic.Utilities;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
|
||||
namespace Terraria
|
||||
{
|
||||
public class FrameSkipTest
|
||||
{
|
||||
private static int LastRecordedSecondNumber;
|
||||
private static float CallsThisSecond = 0.0f;
|
||||
private static float DeltasThisSecond = 0.0f;
|
||||
private static List<float> DeltaSamples = new List<float>();
|
||||
private const int SamplesCount = 5;
|
||||
private static MultiTimer serverFramerateTest = new MultiTimer(60);
|
||||
|
||||
public static void Update(GameTime gameTime) => Thread.Sleep((int) MathHelper.Clamp((float) ((1.0 / 60.0 - gameTime.ElapsedGameTime.TotalSeconds) * 1000.0 + 1.0), 0.0f, 1000f));
|
||||
|
||||
public static void CheckReset(GameTime gameTime)
|
||||
{
|
||||
if (FrameSkipTest.LastRecordedSecondNumber == gameTime.TotalGameTime.Seconds)
|
||||
return;
|
||||
FrameSkipTest.DeltaSamples.Add(FrameSkipTest.DeltasThisSecond / FrameSkipTest.CallsThisSecond);
|
||||
if (FrameSkipTest.DeltaSamples.Count > 5)
|
||||
FrameSkipTest.DeltaSamples.RemoveAt(0);
|
||||
FrameSkipTest.CallsThisSecond = 0.0f;
|
||||
FrameSkipTest.DeltasThisSecond = 0.0f;
|
||||
FrameSkipTest.LastRecordedSecondNumber = gameTime.TotalGameTime.Seconds;
|
||||
}
|
||||
|
||||
public static void UpdateServerTest()
|
||||
{
|
||||
FrameSkipTest.serverFramerateTest.Record("frame time");
|
||||
FrameSkipTest.serverFramerateTest.StopAndPrint();
|
||||
FrameSkipTest.serverFramerateTest.Start();
|
||||
}
|
||||
}
|
||||
}
|
376
Framing.cs
Normal file
376
Framing.cs
Normal file
|
@ -0,0 +1,376 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Framing
|
||||
// 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 Terraria.DataStructures;
|
||||
using Terraria.ID;
|
||||
|
||||
namespace Terraria
|
||||
{
|
||||
public class Framing
|
||||
{
|
||||
private static Point16[][] selfFrame8WayLookup;
|
||||
private static Point16[][] wallFrameLookup;
|
||||
private static Point16 frameSize8Way;
|
||||
private static Point16 wallFrameSize;
|
||||
private static Framing.BlockStyle[] blockStyleLookup;
|
||||
private static int[][] phlebasTileFrameNumberLookup;
|
||||
private static int[][] lazureTileFrameNumberLookup;
|
||||
private static int[][] centerWallFrameLookup;
|
||||
|
||||
public static void Initialize()
|
||||
{
|
||||
Framing.selfFrame8WayLookup = new Point16[256][];
|
||||
Framing.frameSize8Way = new Point16(18, 18);
|
||||
Framing.Add8WayLookup(0, (short) 9, (short) 3, (short) 10, (short) 3, (short) 11, (short) 3);
|
||||
Framing.Add8WayLookup(1, (short) 6, (short) 3, (short) 7, (short) 3, (short) 8, (short) 3);
|
||||
Framing.Add8WayLookup(2, (short) 12, (short) 0, (short) 12, (short) 1, (short) 12, (short) 2);
|
||||
Framing.Add8WayLookup(3, (short) 15, (short) 2);
|
||||
Framing.Add8WayLookup(4, (short) 9, (short) 0, (short) 9, (short) 1, (short) 9, (short) 2);
|
||||
Framing.Add8WayLookup(5, (short) 13, (short) 2);
|
||||
Framing.Add8WayLookup(6, (short) 6, (short) 4, (short) 7, (short) 4, (short) 8, (short) 4);
|
||||
Framing.Add8WayLookup(7, (short) 14, (short) 2);
|
||||
Framing.Add8WayLookup(8, (short) 6, (short) 0, (short) 7, (short) 0, (short) 8, (short) 0);
|
||||
Framing.Add8WayLookup(9, (short) 5, (short) 0, (short) 5, (short) 1, (short) 5, (short) 2);
|
||||
Framing.Add8WayLookup(10, (short) 15, (short) 0);
|
||||
Framing.Add8WayLookup(11, (short) 15, (short) 1);
|
||||
Framing.Add8WayLookup(12, (short) 13, (short) 0);
|
||||
Framing.Add8WayLookup(13, (short) 13, (short) 1);
|
||||
Framing.Add8WayLookup(14, (short) 14, (short) 0);
|
||||
Framing.Add8WayLookup(15, (short) 14, (short) 1);
|
||||
Framing.Add8WayLookup(19, (short) 1, (short) 4, (short) 3, (short) 4, (short) 5, (short) 4);
|
||||
Framing.Add8WayLookup(23, (short) 16, (short) 3);
|
||||
Framing.Add8WayLookup(27, (short) 17, (short) 0);
|
||||
Framing.Add8WayLookup(31, (short) 13, (short) 4);
|
||||
Framing.Add8WayLookup(37, (short) 0, (short) 4, (short) 2, (short) 4, (short) 4, (short) 4);
|
||||
Framing.Add8WayLookup(39, (short) 17, (short) 3);
|
||||
Framing.Add8WayLookup(45, (short) 16, (short) 0);
|
||||
Framing.Add8WayLookup(47, (short) 12, (short) 4);
|
||||
Framing.Add8WayLookup(55, (short) 1, (short) 2, (short) 2, (short) 2, (short) 3, (short) 2);
|
||||
Framing.Add8WayLookup(63, (short) 6, (short) 2, (short) 7, (short) 2, (short) 8, (short) 2);
|
||||
Framing.Add8WayLookup(74, (short) 1, (short) 3, (short) 3, (short) 3, (short) 5, (short) 3);
|
||||
Framing.Add8WayLookup(75, (short) 17, (short) 1);
|
||||
Framing.Add8WayLookup(78, (short) 16, (short) 2);
|
||||
Framing.Add8WayLookup(79, (short) 13, (short) 3);
|
||||
Framing.Add8WayLookup(91, (short) 4, (short) 0, (short) 4, (short) 1, (short) 4, (short) 2);
|
||||
Framing.Add8WayLookup(95, (short) 11, (short) 0, (short) 11, (short) 1, (short) 11, (short) 2);
|
||||
Framing.Add8WayLookup(111, (short) 17, (short) 4);
|
||||
Framing.Add8WayLookup((int) sbyte.MaxValue, (short) 14, (short) 3);
|
||||
Framing.Add8WayLookup(140, (short) 0, (short) 3, (short) 2, (short) 3, (short) 4, (short) 3);
|
||||
Framing.Add8WayLookup(141, (short) 16, (short) 1);
|
||||
Framing.Add8WayLookup(142, (short) 17, (short) 2);
|
||||
Framing.Add8WayLookup(143, (short) 12, (short) 3);
|
||||
Framing.Add8WayLookup(159, (short) 16, (short) 4);
|
||||
Framing.Add8WayLookup(173, (short) 0, (short) 0, (short) 0, (short) 1, (short) 0, (short) 2);
|
||||
Framing.Add8WayLookup(175, (short) 10, (short) 0, (short) 10, (short) 1, (short) 10, (short) 2);
|
||||
Framing.Add8WayLookup(191, (short) 15, (short) 3);
|
||||
Framing.Add8WayLookup(206, (short) 1, (short) 0, (short) 2, (short) 0, (short) 3, (short) 0);
|
||||
Framing.Add8WayLookup(207, (short) 6, (short) 1, (short) 7, (short) 1, (short) 8, (short) 1);
|
||||
Framing.Add8WayLookup(223, (short) 14, (short) 4);
|
||||
Framing.Add8WayLookup(239, (short) 15, (short) 4);
|
||||
Framing.Add8WayLookup((int) byte.MaxValue, (short) 1, (short) 1, (short) 2, (short) 1, (short) 3, (short) 1);
|
||||
Framing.blockStyleLookup = new Framing.BlockStyle[6];
|
||||
Framing.blockStyleLookup[0] = new Framing.BlockStyle(true, true, true, true);
|
||||
Framing.blockStyleLookup[1] = new Framing.BlockStyle(false, true, true, true);
|
||||
Framing.blockStyleLookup[2] = new Framing.BlockStyle(false, true, true, false);
|
||||
Framing.blockStyleLookup[3] = new Framing.BlockStyle(false, true, false, true);
|
||||
Framing.blockStyleLookup[4] = new Framing.BlockStyle(true, false, true, false);
|
||||
Framing.blockStyleLookup[5] = new Framing.BlockStyle(true, false, false, true);
|
||||
Framing.phlebasTileFrameNumberLookup = new int[4][]
|
||||
{
|
||||
new int[3]{ 2, 4, 2 },
|
||||
new int[3]{ 1, 3, 1 },
|
||||
new int[3]{ 2, 2, 4 },
|
||||
new int[3]{ 1, 1, 3 }
|
||||
};
|
||||
Framing.lazureTileFrameNumberLookup = new int[2][]
|
||||
{
|
||||
new int[2]{ 1, 3 },
|
||||
new int[2]{ 2, 4 }
|
||||
};
|
||||
Framing.centerWallFrameLookup = new int[3][]
|
||||
{
|
||||
new int[3]{ 2, 0, 0 },
|
||||
new int[3]{ 0, 1, 4 },
|
||||
new int[3]{ 0, 3, 0 }
|
||||
};
|
||||
Framing.wallFrameLookup = new Point16[20][];
|
||||
Framing.wallFrameSize = new Point16(36, 36);
|
||||
Framing.AddWallFrameLookup(0, (short) 9, (short) 3, (short) 10, (short) 3, (short) 11, (short) 3, (short) 6, (short) 6);
|
||||
Framing.AddWallFrameLookup(1, (short) 6, (short) 3, (short) 7, (short) 3, (short) 8, (short) 3, (short) 4, (short) 6);
|
||||
Framing.AddWallFrameLookup(2, (short) 12, (short) 0, (short) 12, (short) 1, (short) 12, (short) 2, (short) 12, (short) 5);
|
||||
Framing.AddWallFrameLookup(3, (short) 1, (short) 4, (short) 3, (short) 4, (short) 5, (short) 4, (short) 3, (short) 6);
|
||||
Framing.AddWallFrameLookup(4, (short) 9, (short) 0, (short) 9, (short) 1, (short) 9, (short) 2, (short) 9, (short) 5);
|
||||
Framing.AddWallFrameLookup(5, (short) 0, (short) 4, (short) 2, (short) 4, (short) 4, (short) 4, (short) 2, (short) 6);
|
||||
Framing.AddWallFrameLookup(6, (short) 6, (short) 4, (short) 7, (short) 4, (short) 8, (short) 4, (short) 5, (short) 6);
|
||||
Framing.AddWallFrameLookup(7, (short) 1, (short) 2, (short) 2, (short) 2, (short) 3, (short) 2, (short) 3, (short) 5);
|
||||
Framing.AddWallFrameLookup(8, (short) 6, (short) 0, (short) 7, (short) 0, (short) 8, (short) 0, (short) 6, (short) 5);
|
||||
Framing.AddWallFrameLookup(9, (short) 5, (short) 0, (short) 5, (short) 1, (short) 5, (short) 2, (short) 5, (short) 5);
|
||||
Framing.AddWallFrameLookup(10, (short) 1, (short) 3, (short) 3, (short) 3, (short) 5, (short) 3, (short) 1, (short) 6);
|
||||
Framing.AddWallFrameLookup(11, (short) 4, (short) 0, (short) 4, (short) 1, (short) 4, (short) 2, (short) 4, (short) 5);
|
||||
Framing.AddWallFrameLookup(12, (short) 0, (short) 3, (short) 2, (short) 3, (short) 4, (short) 3, (short) 0, (short) 6);
|
||||
Framing.AddWallFrameLookup(13, (short) 0, (short) 0, (short) 0, (short) 1, (short) 0, (short) 2, (short) 0, (short) 5);
|
||||
Framing.AddWallFrameLookup(14, (short) 1, (short) 0, (short) 2, (short) 0, (short) 3, (short) 0, (short) 1, (short) 6);
|
||||
Framing.AddWallFrameLookup(15, (short) 1, (short) 1, (short) 2, (short) 1, (short) 3, (short) 1, (short) 2, (short) 5);
|
||||
Framing.AddWallFrameLookup(16, (short) 6, (short) 1, (short) 7, (short) 1, (short) 8, (short) 1, (short) 7, (short) 5);
|
||||
Framing.AddWallFrameLookup(17, (short) 6, (short) 2, (short) 7, (short) 2, (short) 8, (short) 2, (short) 8, (short) 5);
|
||||
Framing.AddWallFrameLookup(18, (short) 10, (short) 0, (short) 10, (short) 1, (short) 10, (short) 2, (short) 10, (short) 5);
|
||||
Framing.AddWallFrameLookup(19, (short) 11, (short) 0, (short) 11, (short) 1, (short) 11, (short) 2, (short) 11, (short) 5);
|
||||
}
|
||||
|
||||
private static Framing.BlockStyle FindBlockStyle(Tile blockTile) => Framing.blockStyleLookup[blockTile.blockType()];
|
||||
|
||||
public static void Add8WayLookup(
|
||||
int lookup,
|
||||
short point1X,
|
||||
short point1Y,
|
||||
short point2X,
|
||||
short point2Y,
|
||||
short point3X,
|
||||
short point3Y)
|
||||
{
|
||||
Point16[] point16Array = new Point16[3]
|
||||
{
|
||||
new Point16((int) point1X * (int) Framing.frameSize8Way.X, (int) point1Y * (int) Framing.frameSize8Way.Y),
|
||||
new Point16((int) point2X * (int) Framing.frameSize8Way.X, (int) point2Y * (int) Framing.frameSize8Way.Y),
|
||||
new Point16((int) point3X * (int) Framing.frameSize8Way.X, (int) point3Y * (int) Framing.frameSize8Way.Y)
|
||||
};
|
||||
Framing.selfFrame8WayLookup[lookup] = point16Array;
|
||||
}
|
||||
|
||||
public static void Add8WayLookup(int lookup, short x, short y)
|
||||
{
|
||||
Point16[] point16Array = new Point16[3]
|
||||
{
|
||||
new Point16((int) x * (int) Framing.frameSize8Way.X, (int) y * (int) Framing.frameSize8Way.Y),
|
||||
new Point16((int) x * (int) Framing.frameSize8Way.X, (int) y * (int) Framing.frameSize8Way.Y),
|
||||
new Point16((int) x * (int) Framing.frameSize8Way.X, (int) y * (int) Framing.frameSize8Way.Y)
|
||||
};
|
||||
Framing.selfFrame8WayLookup[lookup] = point16Array;
|
||||
}
|
||||
|
||||
public static void AddWallFrameLookup(
|
||||
int lookup,
|
||||
short point1X,
|
||||
short point1Y,
|
||||
short point2X,
|
||||
short point2Y,
|
||||
short point3X,
|
||||
short point3Y,
|
||||
short point4X,
|
||||
short point4Y)
|
||||
{
|
||||
Point16[] point16Array = new Point16[4]
|
||||
{
|
||||
new Point16((int) point1X * (int) Framing.wallFrameSize.X, (int) point1Y * (int) Framing.wallFrameSize.Y),
|
||||
new Point16((int) point2X * (int) Framing.wallFrameSize.X, (int) point2Y * (int) Framing.wallFrameSize.Y),
|
||||
new Point16((int) point3X * (int) Framing.wallFrameSize.X, (int) point3Y * (int) Framing.wallFrameSize.Y),
|
||||
new Point16((int) point4X * (int) Framing.wallFrameSize.X, (int) point4Y * (int) Framing.wallFrameSize.Y)
|
||||
};
|
||||
Framing.wallFrameLookup[lookup] = point16Array;
|
||||
}
|
||||
|
||||
public static void SelfFrame4Way()
|
||||
{
|
||||
}
|
||||
|
||||
public static void SelfFrame8Way(int i, int j, Tile centerTile, bool resetFrame)
|
||||
{
|
||||
if (!centerTile.active())
|
||||
return;
|
||||
ushort gemsparkFramingType = TileID.Sets.GemsparkFramingTypes[(int) centerTile.type];
|
||||
Framing.BlockStyle blockStyle1 = Framing.FindBlockStyle(centerTile);
|
||||
int index = 0;
|
||||
Framing.BlockStyle blockStyle2 = new Framing.BlockStyle();
|
||||
if (blockStyle1.top)
|
||||
{
|
||||
Tile tileSafely = Framing.GetTileSafely(i, j - 1);
|
||||
if (tileSafely.active() && (int) TileID.Sets.GemsparkFramingTypes[(int) tileSafely.type] == (int) gemsparkFramingType)
|
||||
{
|
||||
blockStyle2 = Framing.FindBlockStyle(tileSafely);
|
||||
if (blockStyle2.bottom)
|
||||
index |= 1;
|
||||
else
|
||||
blockStyle2.Clear();
|
||||
}
|
||||
}
|
||||
Framing.BlockStyle blockStyle3 = new Framing.BlockStyle();
|
||||
if (blockStyle1.left)
|
||||
{
|
||||
Tile tileSafely = Framing.GetTileSafely(i - 1, j);
|
||||
if (tileSafely.active() && (int) TileID.Sets.GemsparkFramingTypes[(int) tileSafely.type] == (int) gemsparkFramingType)
|
||||
{
|
||||
blockStyle3 = Framing.FindBlockStyle(tileSafely);
|
||||
if (blockStyle3.right)
|
||||
index |= 2;
|
||||
else
|
||||
blockStyle3.Clear();
|
||||
}
|
||||
}
|
||||
Framing.BlockStyle blockStyle4 = new Framing.BlockStyle();
|
||||
if (blockStyle1.right)
|
||||
{
|
||||
Tile tileSafely = Framing.GetTileSafely(i + 1, j);
|
||||
if (tileSafely.active() && (int) TileID.Sets.GemsparkFramingTypes[(int) tileSafely.type] == (int) gemsparkFramingType)
|
||||
{
|
||||
blockStyle4 = Framing.FindBlockStyle(tileSafely);
|
||||
if (blockStyle4.left)
|
||||
index |= 4;
|
||||
else
|
||||
blockStyle4.Clear();
|
||||
}
|
||||
}
|
||||
Framing.BlockStyle blockStyle5 = new Framing.BlockStyle();
|
||||
if (blockStyle1.bottom)
|
||||
{
|
||||
Tile tileSafely = Framing.GetTileSafely(i, j + 1);
|
||||
if (tileSafely.active() && (int) TileID.Sets.GemsparkFramingTypes[(int) tileSafely.type] == (int) gemsparkFramingType)
|
||||
{
|
||||
blockStyle5 = Framing.FindBlockStyle(tileSafely);
|
||||
if (blockStyle5.top)
|
||||
index |= 8;
|
||||
else
|
||||
blockStyle5.Clear();
|
||||
}
|
||||
}
|
||||
if (blockStyle2.left && blockStyle3.top)
|
||||
{
|
||||
Tile tileSafely = Framing.GetTileSafely(i - 1, j - 1);
|
||||
if (tileSafely.active() && (int) TileID.Sets.GemsparkFramingTypes[(int) tileSafely.type] == (int) gemsparkFramingType)
|
||||
{
|
||||
Framing.BlockStyle blockStyle6 = Framing.FindBlockStyle(tileSafely);
|
||||
if (blockStyle6.right && blockStyle6.bottom)
|
||||
index |= 16;
|
||||
}
|
||||
}
|
||||
if (blockStyle2.right && blockStyle4.top)
|
||||
{
|
||||
Tile tileSafely = Framing.GetTileSafely(i + 1, j - 1);
|
||||
if (tileSafely.active() && (int) TileID.Sets.GemsparkFramingTypes[(int) tileSafely.type] == (int) gemsparkFramingType)
|
||||
{
|
||||
Framing.BlockStyle blockStyle7 = Framing.FindBlockStyle(tileSafely);
|
||||
if (blockStyle7.left && blockStyle7.bottom)
|
||||
index |= 32;
|
||||
}
|
||||
}
|
||||
if (blockStyle5.left && blockStyle3.bottom)
|
||||
{
|
||||
Tile tileSafely = Framing.GetTileSafely(i - 1, j + 1);
|
||||
if (tileSafely.active() && (int) TileID.Sets.GemsparkFramingTypes[(int) tileSafely.type] == (int) gemsparkFramingType)
|
||||
{
|
||||
Framing.BlockStyle blockStyle8 = Framing.FindBlockStyle(tileSafely);
|
||||
if (blockStyle8.right && blockStyle8.top)
|
||||
index |= 64;
|
||||
}
|
||||
}
|
||||
if (blockStyle5.right && blockStyle4.bottom)
|
||||
{
|
||||
Tile tileSafely = Framing.GetTileSafely(i + 1, j + 1);
|
||||
if (tileSafely.active() && (int) TileID.Sets.GemsparkFramingTypes[(int) tileSafely.type] == (int) gemsparkFramingType)
|
||||
{
|
||||
Framing.BlockStyle blockStyle9 = Framing.FindBlockStyle(tileSafely);
|
||||
if (blockStyle9.left && blockStyle9.top)
|
||||
index |= 128;
|
||||
}
|
||||
}
|
||||
if (resetFrame)
|
||||
centerTile.frameNumber((byte) WorldGen.genRand.Next(0, 3));
|
||||
Point16 point16 = Framing.selfFrame8WayLookup[index][(int) centerTile.frameNumber()];
|
||||
centerTile.frameX = point16.X;
|
||||
centerTile.frameY = point16.Y;
|
||||
}
|
||||
|
||||
public static void WallFrame(int i, int j, bool resetFrame = false)
|
||||
{
|
||||
if (i <= 0 || j <= 0 || i >= Main.maxTilesX - 1 || j >= Main.maxTilesY - 1 || Main.tile[i, j] == null)
|
||||
return;
|
||||
WorldGen.UpdateMapTile(i, j);
|
||||
Tile tile1 = Main.tile[i, j];
|
||||
if (tile1.wall == (byte) 0)
|
||||
{
|
||||
tile1.wallColor((byte) 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
int index1 = 0;
|
||||
Tile tile2 = Main.tile[i, j - 1];
|
||||
if (tile2 != null && (tile2.wall > (byte) 0 || tile2.active() && tile2.type == (ushort) 54))
|
||||
index1 = 1;
|
||||
Tile tile3 = Main.tile[i - 1, j];
|
||||
if (tile3 != null && (tile3.wall > (byte) 0 || tile3.active() && tile3.type == (ushort) 54))
|
||||
index1 |= 2;
|
||||
Tile tile4 = Main.tile[i + 1, j];
|
||||
if (tile4 != null && (tile4.wall > (byte) 0 || tile4.active() && tile4.type == (ushort) 54))
|
||||
index1 |= 4;
|
||||
Tile tile5 = Main.tile[i, j + 1];
|
||||
if (tile5 != null && (tile5.wall > (byte) 0 || tile5.active() && tile5.type == (ushort) 54))
|
||||
index1 |= 8;
|
||||
int index2;
|
||||
if (Main.wallLargeFrames[(int) tile1.wall] == (byte) 1)
|
||||
{
|
||||
index2 = Framing.phlebasTileFrameNumberLookup[j % 4][i % 3] - 1;
|
||||
tile1.wallFrameNumber((byte) index2);
|
||||
}
|
||||
else if (Main.wallLargeFrames[(int) tile1.wall] == (byte) 2)
|
||||
{
|
||||
index2 = Framing.lazureTileFrameNumberLookup[i % 2][j % 2] - 1;
|
||||
tile1.wallFrameNumber((byte) index2);
|
||||
}
|
||||
else if (resetFrame)
|
||||
{
|
||||
index2 = WorldGen.genRand.Next(0, 3);
|
||||
tile1.wallFrameNumber((byte) index2);
|
||||
}
|
||||
else
|
||||
index2 = (int) tile1.wallFrameNumber();
|
||||
if (index1 == 15)
|
||||
index1 += Framing.centerWallFrameLookup[i % 3][j % 3];
|
||||
Point16 point16 = Framing.wallFrameLookup[index1][index2];
|
||||
tile1.wallFrameX((int) point16.X);
|
||||
tile1.wallFrameY((int) point16.Y);
|
||||
}
|
||||
}
|
||||
|
||||
public static Tile GetTileSafely(Vector2 position)
|
||||
{
|
||||
position /= 16f;
|
||||
return Framing.GetTileSafely((int) position.X, (int) position.Y);
|
||||
}
|
||||
|
||||
public static Tile GetTileSafely(Point pt) => Framing.GetTileSafely(pt.X, pt.Y);
|
||||
|
||||
public static Tile GetTileSafely(Point16 pt) => Framing.GetTileSafely((int) pt.X, (int) pt.Y);
|
||||
|
||||
public static Tile GetTileSafely(int i, int j)
|
||||
{
|
||||
Tile tile = Main.tile[i, j];
|
||||
if (tile == null)
|
||||
{
|
||||
tile = new Tile();
|
||||
Main.tile[i, j] = tile;
|
||||
}
|
||||
return tile;
|
||||
}
|
||||
|
||||
private struct BlockStyle
|
||||
{
|
||||
public bool top;
|
||||
public bool bottom;
|
||||
public bool left;
|
||||
public bool right;
|
||||
|
||||
public BlockStyle(bool up, bool down, bool left, bool right)
|
||||
{
|
||||
this.top = up;
|
||||
this.bottom = down;
|
||||
this.left = left;
|
||||
this.right = right;
|
||||
}
|
||||
|
||||
public void Clear() => this.top = this.bottom = this.left = this.right = false;
|
||||
}
|
||||
}
|
||||
}
|
311
GameContent/Achievements/AchievementsHelper.cs
Normal file
311
GameContent/Achievements/AchievementsHelper.cs
Normal file
|
@ -0,0 +1,311 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.GameContent.Achievements.AchievementsHelper
|
||||
// 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;
|
||||
|
||||
namespace Terraria.GameContent.Achievements
|
||||
{
|
||||
public class AchievementsHelper
|
||||
{
|
||||
private static bool _isMining;
|
||||
private static bool mayhemOK;
|
||||
private static bool mayhem1down;
|
||||
private static bool mayhem2down;
|
||||
private static bool mayhem3down;
|
||||
|
||||
public static event AchievementsHelper.ItemPickupEvent OnItemPickup;
|
||||
|
||||
public static event AchievementsHelper.ItemCraftEvent OnItemCraft;
|
||||
|
||||
public static event AchievementsHelper.TileDestroyedEvent OnTileDestroyed;
|
||||
|
||||
public static event AchievementsHelper.NPCKilledEvent OnNPCKilled;
|
||||
|
||||
public static event AchievementsHelper.ProgressionEventEvent OnProgressionEvent;
|
||||
|
||||
public static bool CurrentlyMining
|
||||
{
|
||||
get => AchievementsHelper._isMining;
|
||||
set => AchievementsHelper._isMining = value;
|
||||
}
|
||||
|
||||
public static void NotifyTileDestroyed(Player player, ushort tile)
|
||||
{
|
||||
if (Main.gameMenu || !AchievementsHelper._isMining || AchievementsHelper.OnTileDestroyed == null)
|
||||
return;
|
||||
AchievementsHelper.OnTileDestroyed(player, tile);
|
||||
}
|
||||
|
||||
public static void NotifyItemPickup(Player player, Item item)
|
||||
{
|
||||
if (AchievementsHelper.OnItemPickup == null)
|
||||
return;
|
||||
AchievementsHelper.OnItemPickup(player, (short) item.netID, item.stack);
|
||||
}
|
||||
|
||||
public static void NotifyItemPickup(Player player, Item item, int customStack)
|
||||
{
|
||||
if (AchievementsHelper.OnItemPickup == null)
|
||||
return;
|
||||
AchievementsHelper.OnItemPickup(player, (short) item.netID, customStack);
|
||||
}
|
||||
|
||||
public static void NotifyItemCraft(Recipe recipe)
|
||||
{
|
||||
if (AchievementsHelper.OnItemCraft == null)
|
||||
return;
|
||||
AchievementsHelper.OnItemCraft((short) recipe.createItem.netID, recipe.createItem.stack);
|
||||
}
|
||||
|
||||
public static void Initialize() => Player.Hooks.OnEnterWorld += new Action<Player>(AchievementsHelper.OnPlayerEnteredWorld);
|
||||
|
||||
private static void OnPlayerEnteredWorld(Player player)
|
||||
{
|
||||
if (AchievementsHelper.OnItemPickup != null)
|
||||
{
|
||||
for (int index = 0; index < 58; ++index)
|
||||
AchievementsHelper.OnItemPickup(player, (short) player.inventory[index].type, player.inventory[index].stack);
|
||||
for (int index = 0; index < player.armor.Length; ++index)
|
||||
AchievementsHelper.OnItemPickup(player, (short) player.armor[index].type, player.armor[index].stack);
|
||||
for (int index = 0; index < player.dye.Length; ++index)
|
||||
AchievementsHelper.OnItemPickup(player, (short) player.dye[index].type, player.dye[index].stack);
|
||||
for (int index = 0; index < player.miscEquips.Length; ++index)
|
||||
AchievementsHelper.OnItemPickup(player, (short) player.miscEquips[index].type, player.miscEquips[index].stack);
|
||||
for (int index = 0; index < player.miscDyes.Length; ++index)
|
||||
AchievementsHelper.OnItemPickup(player, (short) player.miscDyes[index].type, player.miscDyes[index].stack);
|
||||
for (int index = 0; index < player.bank.item.Length; ++index)
|
||||
AchievementsHelper.OnItemPickup(player, (short) player.bank.item[index].type, player.bank.item[index].stack);
|
||||
for (int index = 0; index < player.bank2.item.Length; ++index)
|
||||
AchievementsHelper.OnItemPickup(player, (short) player.bank2.item[index].type, player.bank2.item[index].stack);
|
||||
for (int index = 0; index < player.bank3.item.Length; ++index)
|
||||
AchievementsHelper.OnItemPickup(player, (short) player.bank3.item[index].type, player.bank3.item[index].stack);
|
||||
}
|
||||
if (player.statManaMax > 20)
|
||||
Main.Achievements.GetCondition("STAR_POWER", "Use").Complete();
|
||||
if (player.statLifeMax == 500 && player.statManaMax == 200)
|
||||
Main.Achievements.GetCondition("TOPPED_OFF", "Use").Complete();
|
||||
if (player.miscEquips[4].type > 0)
|
||||
Main.Achievements.GetCondition("HOLD_ON_TIGHT", "Equip").Complete();
|
||||
if (player.miscEquips[3].type > 0)
|
||||
Main.Achievements.GetCondition("THE_CAVALRY", "Equip").Complete();
|
||||
for (int index = 0; index < player.armor.Length; ++index)
|
||||
{
|
||||
if (player.armor[index].wingSlot > (sbyte) 0)
|
||||
{
|
||||
Main.Achievements.GetCondition("HEAD_IN_THE_CLOUDS", "Equip").Complete();
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (player.armor[0].stack > 0 && player.armor[1].stack > 0 && player.armor[2].stack > 0)
|
||||
Main.Achievements.GetCondition("MATCHING_ATTIRE", "Equip").Complete();
|
||||
if (player.armor[10].stack > 0 && player.armor[11].stack > 0 && player.armor[12].stack > 0)
|
||||
Main.Achievements.GetCondition("FASHION_STATEMENT", "Equip").Complete();
|
||||
bool flag = true;
|
||||
for (int index = 0; index < player.extraAccessorySlots + 3 + 5; ++index)
|
||||
{
|
||||
if (player.dye[index].type < 1 || player.dye[index].stack < 1)
|
||||
flag = false;
|
||||
}
|
||||
if (!flag)
|
||||
return;
|
||||
Main.Achievements.GetCondition("DYE_HARD", "Equip").Complete();
|
||||
}
|
||||
|
||||
public static void NotifyNPCKilled(NPC npc)
|
||||
{
|
||||
if (Main.netMode == 0)
|
||||
{
|
||||
if (!npc.playerInteraction[Main.myPlayer])
|
||||
return;
|
||||
AchievementsHelper.NotifyNPCKilledDirect(Main.player[Main.myPlayer], npc.netID);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int remoteClient = 0; remoteClient < (int) byte.MaxValue; ++remoteClient)
|
||||
{
|
||||
if (npc.playerInteraction[remoteClient])
|
||||
NetMessage.SendData(97, remoteClient, number: npc.netID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void NotifyNPCKilledDirect(Player player, int npcNetID)
|
||||
{
|
||||
if (AchievementsHelper.OnNPCKilled == null)
|
||||
return;
|
||||
AchievementsHelper.OnNPCKilled(player, (short) npcNetID);
|
||||
}
|
||||
|
||||
public static void NotifyProgressionEvent(int eventID)
|
||||
{
|
||||
if (Main.netMode == 2)
|
||||
{
|
||||
NetMessage.SendData(98, number: eventID);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (AchievementsHelper.OnProgressionEvent == null)
|
||||
return;
|
||||
AchievementsHelper.OnProgressionEvent(eventID);
|
||||
}
|
||||
}
|
||||
|
||||
public static void HandleOnEquip(Player player, Item item, int context)
|
||||
{
|
||||
if (context == 16)
|
||||
Main.Achievements.GetCondition("HOLD_ON_TIGHT", "Equip").Complete();
|
||||
if (context == 17)
|
||||
Main.Achievements.GetCondition("THE_CAVALRY", "Equip").Complete();
|
||||
if ((context == 10 || context == 11) && item.wingSlot > (sbyte) 0)
|
||||
Main.Achievements.GetCondition("HEAD_IN_THE_CLOUDS", "Equip").Complete();
|
||||
if (context == 8 && player.armor[0].stack > 0 && player.armor[1].stack > 0 && player.armor[2].stack > 0)
|
||||
Main.Achievements.GetCondition("MATCHING_ATTIRE", "Equip").Complete();
|
||||
if (context == 9 && player.armor[10].stack > 0 && player.armor[11].stack > 0 && player.armor[12].stack > 0)
|
||||
Main.Achievements.GetCondition("FASHION_STATEMENT", "Equip").Complete();
|
||||
if (context != 12)
|
||||
return;
|
||||
for (int index = 0; index < player.extraAccessorySlots + 3 + 5; ++index)
|
||||
{
|
||||
if (player.dye[index].type < 1 || player.dye[index].stack < 1)
|
||||
return;
|
||||
}
|
||||
for (int index = 0; index < player.miscDyes.Length; ++index)
|
||||
{
|
||||
if (player.miscDyes[index].type < 1 || player.miscDyes[index].stack < 1)
|
||||
return;
|
||||
}
|
||||
Main.Achievements.GetCondition("DYE_HARD", "Equip").Complete();
|
||||
}
|
||||
|
||||
public static void HandleSpecialEvent(Player player, int eventID)
|
||||
{
|
||||
if (player.whoAmI != Main.myPlayer)
|
||||
return;
|
||||
switch (eventID)
|
||||
{
|
||||
case 1:
|
||||
Main.Achievements.GetCondition("STAR_POWER", "Use").Complete();
|
||||
if (player.statLifeMax != 500 || player.statManaMax != 200)
|
||||
break;
|
||||
Main.Achievements.GetCondition("TOPPED_OFF", "Use").Complete();
|
||||
break;
|
||||
case 2:
|
||||
Main.Achievements.GetCondition("GET_A_LIFE", "Use").Complete();
|
||||
if (player.statLifeMax != 500 || player.statManaMax != 200)
|
||||
break;
|
||||
Main.Achievements.GetCondition("TOPPED_OFF", "Use").Complete();
|
||||
break;
|
||||
case 3:
|
||||
Main.Achievements.GetCondition("NOT_THE_BEES", "Use").Complete();
|
||||
break;
|
||||
case 4:
|
||||
Main.Achievements.GetCondition("WATCH_YOUR_STEP", "Hit").Complete();
|
||||
break;
|
||||
case 5:
|
||||
Main.Achievements.GetCondition("RAINBOWS_AND_UNICORNS", "Use").Complete();
|
||||
break;
|
||||
case 6:
|
||||
Main.Achievements.GetCondition("YOU_AND_WHAT_ARMY", "Spawn").Complete();
|
||||
break;
|
||||
case 7:
|
||||
Main.Achievements.GetCondition("THROWING_LINES", "Use").Complete();
|
||||
break;
|
||||
case 8:
|
||||
Main.Achievements.GetCondition("LUCKY_BREAK", "Hit").Complete();
|
||||
break;
|
||||
case 9:
|
||||
Main.Achievements.GetCondition("VEHICULAR_MANSLAUGHTER", "Hit").Complete();
|
||||
break;
|
||||
case 10:
|
||||
Main.Achievements.GetCondition("ROCK_BOTTOM", "Reach").Complete();
|
||||
break;
|
||||
case 11:
|
||||
Main.Achievements.GetCondition("INTO_ORBIT", "Reach").Complete();
|
||||
break;
|
||||
case 12:
|
||||
Main.Achievements.GetCondition("WHERES_MY_HONEY", "Reach").Complete();
|
||||
break;
|
||||
case 13:
|
||||
Main.Achievements.GetCondition("JEEPERS_CREEPERS", "Reach").Complete();
|
||||
break;
|
||||
case 14:
|
||||
Main.Achievements.GetCondition("ITS_GETTING_HOT_IN_HERE", "Reach").Complete();
|
||||
break;
|
||||
case 15:
|
||||
Main.Achievements.GetCondition("FUNKYTOWN", "Reach").Complete();
|
||||
break;
|
||||
case 16:
|
||||
Main.Achievements.GetCondition("I_AM_LOOT", "Peek").Complete();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public static void HandleNurseService(int coinsSpent) => ((CustomFloatCondition) Main.Achievements.GetCondition("FREQUENT_FLYER", "Pay")).Value += (float) coinsSpent;
|
||||
|
||||
public static void HandleAnglerService()
|
||||
{
|
||||
Main.Achievements.GetCondition("SERVANT_IN_TRAINING", "Finish").Complete();
|
||||
++((CustomIntCondition) Main.Achievements.GetCondition("GOOD_LITTLE_SLAVE", "Finish")).Value;
|
||||
++((CustomIntCondition) Main.Achievements.GetCondition("TROUT_MONKEY", "Finish")).Value;
|
||||
++((CustomIntCondition) Main.Achievements.GetCondition("FAST_AND_FISHIOUS", "Finish")).Value;
|
||||
++((CustomIntCondition) Main.Achievements.GetCondition("SUPREME_HELPER_MINION", "Finish")).Value;
|
||||
}
|
||||
|
||||
public static void HandleRunning(float pixelsMoved) => ((CustomFloatCondition) Main.Achievements.GetCondition("MARATHON_MEDALIST", "Move")).Value += pixelsMoved;
|
||||
|
||||
public static void HandleMining() => ++((CustomIntCondition) Main.Achievements.GetCondition("BULLDOZER", "Pick")).Value;
|
||||
|
||||
public static void CheckMechaMayhem(int justKilled = -1)
|
||||
{
|
||||
if (!AchievementsHelper.mayhemOK)
|
||||
{
|
||||
if (!NPC.AnyNPCs((int) sbyte.MaxValue) || !NPC.AnyNPCs(134) || !NPC.AnyNPCs(126) || !NPC.AnyNPCs(125))
|
||||
return;
|
||||
AchievementsHelper.mayhemOK = true;
|
||||
AchievementsHelper.mayhem1down = false;
|
||||
AchievementsHelper.mayhem2down = false;
|
||||
AchievementsHelper.mayhem3down = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (justKilled == 125 || justKilled == 126)
|
||||
AchievementsHelper.mayhem1down = true;
|
||||
else if (!NPC.AnyNPCs(125) && !NPC.AnyNPCs(126) && !AchievementsHelper.mayhem1down)
|
||||
{
|
||||
AchievementsHelper.mayhemOK = false;
|
||||
return;
|
||||
}
|
||||
if (justKilled == 134)
|
||||
AchievementsHelper.mayhem2down = true;
|
||||
else if (!NPC.AnyNPCs(134) && !AchievementsHelper.mayhem2down)
|
||||
{
|
||||
AchievementsHelper.mayhemOK = false;
|
||||
return;
|
||||
}
|
||||
if (justKilled == (int) sbyte.MaxValue)
|
||||
AchievementsHelper.mayhem3down = true;
|
||||
else if (!NPC.AnyNPCs((int) sbyte.MaxValue) && !AchievementsHelper.mayhem3down)
|
||||
{
|
||||
AchievementsHelper.mayhemOK = false;
|
||||
return;
|
||||
}
|
||||
if (!AchievementsHelper.mayhem1down || !AchievementsHelper.mayhem2down || !AchievementsHelper.mayhem3down)
|
||||
return;
|
||||
AchievementsHelper.NotifyProgressionEvent(21);
|
||||
}
|
||||
}
|
||||
|
||||
public delegate void ItemPickupEvent(Player player, short itemId, int count);
|
||||
|
||||
public delegate void ItemCraftEvent(short itemId, int count);
|
||||
|
||||
public delegate void TileDestroyedEvent(Player player, ushort tileId);
|
||||
|
||||
public delegate void NPCKilledEvent(Player player, short npcId);
|
||||
|
||||
public delegate void ProgressionEventEvent(int eventID);
|
||||
}
|
||||
}
|
20
GameContent/Achievements/CustomFlagCondition.cs
Normal file
20
GameContent/Achievements/CustomFlagCondition.cs
Normal file
|
@ -0,0 +1,20 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.GameContent.Achievements.CustomFlagCondition
|
||||
// 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.Achievements;
|
||||
|
||||
namespace Terraria.GameContent.Achievements
|
||||
{
|
||||
public class CustomFlagCondition : AchievementCondition
|
||||
{
|
||||
private CustomFlagCondition(string name)
|
||||
: base(name)
|
||||
{
|
||||
}
|
||||
|
||||
public static AchievementCondition Create(string name) => (AchievementCondition) new CustomFlagCondition(name);
|
||||
}
|
||||
}
|
60
GameContent/Achievements/CustomFloatCondition.cs
Normal file
60
GameContent/Achievements/CustomFloatCondition.cs
Normal file
|
@ -0,0 +1,60 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.GameContent.Achievements.CustomFloatCondition
|
||||
// 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 Terraria.Achievements;
|
||||
|
||||
namespace Terraria.GameContent.Achievements
|
||||
{
|
||||
public class CustomFloatCondition : AchievementCondition
|
||||
{
|
||||
[JsonProperty("Value")]
|
||||
private float _value;
|
||||
private float _maxValue;
|
||||
|
||||
public float Value
|
||||
{
|
||||
get => this._value;
|
||||
set
|
||||
{
|
||||
float newValue = Utils.Clamp<float>(value, 0.0f, this._maxValue);
|
||||
if (this._tracker != null)
|
||||
((AchievementTracker<float>) this._tracker).SetValue(newValue);
|
||||
this._value = newValue;
|
||||
if ((double) this._value != (double) this._maxValue)
|
||||
return;
|
||||
this.Complete();
|
||||
}
|
||||
}
|
||||
|
||||
private CustomFloatCondition(string name, float maxValue)
|
||||
: base(name)
|
||||
{
|
||||
this._maxValue = maxValue;
|
||||
this._value = 0.0f;
|
||||
}
|
||||
|
||||
public override void Clear()
|
||||
{
|
||||
this._value = 0.0f;
|
||||
base.Clear();
|
||||
}
|
||||
|
||||
public override void Load(JObject state)
|
||||
{
|
||||
base.Load(state);
|
||||
this._value = JToken.op_Explicit(state["Value"]);
|
||||
if (this._tracker == null)
|
||||
return;
|
||||
((AchievementTracker<float>) this._tracker).SetValue(this._value, false);
|
||||
}
|
||||
|
||||
protected override IAchievementTracker CreateAchievementTracker() => (IAchievementTracker) new ConditionFloatTracker(this._maxValue);
|
||||
|
||||
public static AchievementCondition Create(string name, float maxValue) => (AchievementCondition) new CustomFloatCondition(name, maxValue);
|
||||
}
|
||||
}
|
60
GameContent/Achievements/CustomIntCondition.cs
Normal file
60
GameContent/Achievements/CustomIntCondition.cs
Normal file
|
@ -0,0 +1,60 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.GameContent.Achievements.CustomIntCondition
|
||||
// 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 Terraria.Achievements;
|
||||
|
||||
namespace Terraria.GameContent.Achievements
|
||||
{
|
||||
public class CustomIntCondition : AchievementCondition
|
||||
{
|
||||
[JsonProperty("Value")]
|
||||
private int _value;
|
||||
private int _maxValue;
|
||||
|
||||
public int Value
|
||||
{
|
||||
get => this._value;
|
||||
set
|
||||
{
|
||||
int newValue = Utils.Clamp<int>(value, 0, this._maxValue);
|
||||
if (this._tracker != null)
|
||||
((AchievementTracker<int>) this._tracker).SetValue(newValue);
|
||||
this._value = newValue;
|
||||
if (this._value != this._maxValue)
|
||||
return;
|
||||
this.Complete();
|
||||
}
|
||||
}
|
||||
|
||||
private CustomIntCondition(string name, int maxValue)
|
||||
: base(name)
|
||||
{
|
||||
this._maxValue = maxValue;
|
||||
this._value = 0;
|
||||
}
|
||||
|
||||
public override void Clear()
|
||||
{
|
||||
this._value = 0;
|
||||
base.Clear();
|
||||
}
|
||||
|
||||
public override void Load(JObject state)
|
||||
{
|
||||
base.Load(state);
|
||||
this._value = JToken.op_Explicit(state["Value"]);
|
||||
if (this._tracker == null)
|
||||
return;
|
||||
((AchievementTracker<int>) this._tracker).SetValue(this._value, false);
|
||||
}
|
||||
|
||||
protected override IAchievementTracker CreateAchievementTracker() => (IAchievementTracker) new ConditionIntTracker(this._maxValue);
|
||||
|
||||
public static AchievementCondition Create(string name, int maxValue) => (AchievementCondition) new CustomIntCondition(name, maxValue);
|
||||
}
|
||||
}
|
68
GameContent/Achievements/ItemCraftCondition.cs
Normal file
68
GameContent/Achievements/ItemCraftCondition.cs
Normal file
|
@ -0,0 +1,68 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.GameContent.Achievements.ItemCraftCondition
|
||||
// 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.Collections.Generic;
|
||||
using Terraria.Achievements;
|
||||
|
||||
namespace Terraria.GameContent.Achievements
|
||||
{
|
||||
public class ItemCraftCondition : AchievementCondition
|
||||
{
|
||||
private const string Identifier = "ITEM_PICKUP";
|
||||
private static Dictionary<short, List<ItemCraftCondition>> _listeners = new Dictionary<short, List<ItemCraftCondition>>();
|
||||
private static bool _isListenerHooked = false;
|
||||
private short[] _itemIds;
|
||||
|
||||
private ItemCraftCondition(short itemId)
|
||||
: base("ITEM_PICKUP_" + (object) itemId)
|
||||
{
|
||||
this._itemIds = new short[1]{ itemId };
|
||||
ItemCraftCondition.ListenForCraft(this);
|
||||
}
|
||||
|
||||
private ItemCraftCondition(short[] itemIds)
|
||||
: base("ITEM_PICKUP_" + (object) itemIds[0])
|
||||
{
|
||||
this._itemIds = itemIds;
|
||||
ItemCraftCondition.ListenForCraft(this);
|
||||
}
|
||||
|
||||
private static void ListenForCraft(ItemCraftCondition condition)
|
||||
{
|
||||
if (!ItemCraftCondition._isListenerHooked)
|
||||
{
|
||||
AchievementsHelper.OnItemCraft += new AchievementsHelper.ItemCraftEvent(ItemCraftCondition.ItemCraftListener);
|
||||
ItemCraftCondition._isListenerHooked = true;
|
||||
}
|
||||
for (int index = 0; index < condition._itemIds.Length; ++index)
|
||||
{
|
||||
if (!ItemCraftCondition._listeners.ContainsKey(condition._itemIds[index]))
|
||||
ItemCraftCondition._listeners[condition._itemIds[index]] = new List<ItemCraftCondition>();
|
||||
ItemCraftCondition._listeners[condition._itemIds[index]].Add(condition);
|
||||
}
|
||||
}
|
||||
|
||||
private static void ItemCraftListener(short itemId, int count)
|
||||
{
|
||||
if (!ItemCraftCondition._listeners.ContainsKey(itemId))
|
||||
return;
|
||||
foreach (AchievementCondition achievementCondition in ItemCraftCondition._listeners[itemId])
|
||||
achievementCondition.Complete();
|
||||
}
|
||||
|
||||
public static AchievementCondition Create(params short[] items) => (AchievementCondition) new ItemCraftCondition(items);
|
||||
|
||||
public static AchievementCondition Create(short item) => (AchievementCondition) new ItemCraftCondition(item);
|
||||
|
||||
public static AchievementCondition[] CreateMany(params short[] items)
|
||||
{
|
||||
AchievementCondition[] achievementConditionArray = new AchievementCondition[items.Length];
|
||||
for (int index = 0; index < items.Length; ++index)
|
||||
achievementConditionArray[index] = (AchievementCondition) new ItemCraftCondition(items[index]);
|
||||
return achievementConditionArray;
|
||||
}
|
||||
}
|
||||
}
|
68
GameContent/Achievements/ItemPickupCondition.cs
Normal file
68
GameContent/Achievements/ItemPickupCondition.cs
Normal file
|
@ -0,0 +1,68 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.GameContent.Achievements.ItemPickupCondition
|
||||
// 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.Collections.Generic;
|
||||
using Terraria.Achievements;
|
||||
|
||||
namespace Terraria.GameContent.Achievements
|
||||
{
|
||||
public class ItemPickupCondition : AchievementCondition
|
||||
{
|
||||
private const string Identifier = "ITEM_PICKUP";
|
||||
private static Dictionary<short, List<ItemPickupCondition>> _listeners = new Dictionary<short, List<ItemPickupCondition>>();
|
||||
private static bool _isListenerHooked = false;
|
||||
private short[] _itemIds;
|
||||
|
||||
private ItemPickupCondition(short itemId)
|
||||
: base("ITEM_PICKUP_" + (object) itemId)
|
||||
{
|
||||
this._itemIds = new short[1]{ itemId };
|
||||
ItemPickupCondition.ListenForPickup(this);
|
||||
}
|
||||
|
||||
private ItemPickupCondition(short[] itemIds)
|
||||
: base("ITEM_PICKUP_" + (object) itemIds[0])
|
||||
{
|
||||
this._itemIds = itemIds;
|
||||
ItemPickupCondition.ListenForPickup(this);
|
||||
}
|
||||
|
||||
private static void ListenForPickup(ItemPickupCondition condition)
|
||||
{
|
||||
if (!ItemPickupCondition._isListenerHooked)
|
||||
{
|
||||
AchievementsHelper.OnItemPickup += new AchievementsHelper.ItemPickupEvent(ItemPickupCondition.ItemPickupListener);
|
||||
ItemPickupCondition._isListenerHooked = true;
|
||||
}
|
||||
for (int index = 0; index < condition._itemIds.Length; ++index)
|
||||
{
|
||||
if (!ItemPickupCondition._listeners.ContainsKey(condition._itemIds[index]))
|
||||
ItemPickupCondition._listeners[condition._itemIds[index]] = new List<ItemPickupCondition>();
|
||||
ItemPickupCondition._listeners[condition._itemIds[index]].Add(condition);
|
||||
}
|
||||
}
|
||||
|
||||
private static void ItemPickupListener(Player player, short itemId, int count)
|
||||
{
|
||||
if (player.whoAmI != Main.myPlayer || !ItemPickupCondition._listeners.ContainsKey(itemId))
|
||||
return;
|
||||
foreach (AchievementCondition achievementCondition in ItemPickupCondition._listeners[itemId])
|
||||
achievementCondition.Complete();
|
||||
}
|
||||
|
||||
public static AchievementCondition Create(params short[] items) => (AchievementCondition) new ItemPickupCondition(items);
|
||||
|
||||
public static AchievementCondition Create(short item) => (AchievementCondition) new ItemPickupCondition(item);
|
||||
|
||||
public static AchievementCondition[] CreateMany(params short[] items)
|
||||
{
|
||||
AchievementCondition[] achievementConditionArray = new AchievementCondition[items.Length];
|
||||
for (int index = 0; index < items.Length; ++index)
|
||||
achievementConditionArray[index] = (AchievementCondition) new ItemPickupCondition(items[index]);
|
||||
return achievementConditionArray;
|
||||
}
|
||||
}
|
||||
}
|
68
GameContent/Achievements/NPCKilledCondition.cs
Normal file
68
GameContent/Achievements/NPCKilledCondition.cs
Normal file
|
@ -0,0 +1,68 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.GameContent.Achievements.NPCKilledCondition
|
||||
// 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.Collections.Generic;
|
||||
using Terraria.Achievements;
|
||||
|
||||
namespace Terraria.GameContent.Achievements
|
||||
{
|
||||
public class NPCKilledCondition : AchievementCondition
|
||||
{
|
||||
private const string Identifier = "NPC_KILLED";
|
||||
private static Dictionary<short, List<NPCKilledCondition>> _listeners = new Dictionary<short, List<NPCKilledCondition>>();
|
||||
private static bool _isListenerHooked = false;
|
||||
private short[] _npcIds;
|
||||
|
||||
private NPCKilledCondition(short npcId)
|
||||
: base("NPC_KILLED_" + (object) npcId)
|
||||
{
|
||||
this._npcIds = new short[1]{ npcId };
|
||||
NPCKilledCondition.ListenForPickup(this);
|
||||
}
|
||||
|
||||
private NPCKilledCondition(short[] npcIds)
|
||||
: base("NPC_KILLED_" + (object) npcIds[0])
|
||||
{
|
||||
this._npcIds = npcIds;
|
||||
NPCKilledCondition.ListenForPickup(this);
|
||||
}
|
||||
|
||||
private static void ListenForPickup(NPCKilledCondition condition)
|
||||
{
|
||||
if (!NPCKilledCondition._isListenerHooked)
|
||||
{
|
||||
AchievementsHelper.OnNPCKilled += new AchievementsHelper.NPCKilledEvent(NPCKilledCondition.NPCKilledListener);
|
||||
NPCKilledCondition._isListenerHooked = true;
|
||||
}
|
||||
for (int index = 0; index < condition._npcIds.Length; ++index)
|
||||
{
|
||||
if (!NPCKilledCondition._listeners.ContainsKey(condition._npcIds[index]))
|
||||
NPCKilledCondition._listeners[condition._npcIds[index]] = new List<NPCKilledCondition>();
|
||||
NPCKilledCondition._listeners[condition._npcIds[index]].Add(condition);
|
||||
}
|
||||
}
|
||||
|
||||
private static void NPCKilledListener(Player player, short npcId)
|
||||
{
|
||||
if (player.whoAmI != Main.myPlayer || !NPCKilledCondition._listeners.ContainsKey(npcId))
|
||||
return;
|
||||
foreach (AchievementCondition achievementCondition in NPCKilledCondition._listeners[npcId])
|
||||
achievementCondition.Complete();
|
||||
}
|
||||
|
||||
public static AchievementCondition Create(params short[] npcIds) => (AchievementCondition) new NPCKilledCondition(npcIds);
|
||||
|
||||
public static AchievementCondition Create(short npcId) => (AchievementCondition) new NPCKilledCondition(npcId);
|
||||
|
||||
public static AchievementCondition[] CreateMany(params short[] npcs)
|
||||
{
|
||||
AchievementCondition[] achievementConditionArray = new AchievementCondition[npcs.Length];
|
||||
for (int index = 0; index < npcs.Length; ++index)
|
||||
achievementConditionArray[index] = (AchievementCondition) new NPCKilledCondition(npcs[index]);
|
||||
return achievementConditionArray;
|
||||
}
|
||||
}
|
||||
}
|
69
GameContent/Achievements/ProgressionEventCondition.cs
Normal file
69
GameContent/Achievements/ProgressionEventCondition.cs
Normal file
|
@ -0,0 +1,69 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.GameContent.Achievements.ProgressionEventCondition
|
||||
// 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.Collections.Generic;
|
||||
using Terraria.Achievements;
|
||||
|
||||
namespace Terraria.GameContent.Achievements
|
||||
{
|
||||
public class ProgressionEventCondition : AchievementCondition
|
||||
{
|
||||
private const string Identifier = "PROGRESSION_EVENT";
|
||||
private static Dictionary<int, List<ProgressionEventCondition>> _listeners = new Dictionary<int, List<ProgressionEventCondition>>();
|
||||
private static bool _isListenerHooked = false;
|
||||
private int[] _eventIDs;
|
||||
|
||||
private ProgressionEventCondition(int eventID)
|
||||
: base("PROGRESSION_EVENT_" + (object) eventID)
|
||||
{
|
||||
this._eventIDs = new int[1]{ eventID };
|
||||
ProgressionEventCondition.ListenForPickup(this);
|
||||
}
|
||||
|
||||
private ProgressionEventCondition(int[] eventIDs)
|
||||
: base("PROGRESSION_EVENT_" + (object) eventIDs[0])
|
||||
{
|
||||
this._eventIDs = eventIDs;
|
||||
ProgressionEventCondition.ListenForPickup(this);
|
||||
}
|
||||
|
||||
private static void ListenForPickup(ProgressionEventCondition condition)
|
||||
{
|
||||
if (!ProgressionEventCondition._isListenerHooked)
|
||||
{
|
||||
AchievementsHelper.OnProgressionEvent += new AchievementsHelper.ProgressionEventEvent(ProgressionEventCondition.ProgressionEventListener);
|
||||
ProgressionEventCondition._isListenerHooked = true;
|
||||
}
|
||||
for (int index = 0; index < condition._eventIDs.Length; ++index)
|
||||
{
|
||||
if (!ProgressionEventCondition._listeners.ContainsKey(condition._eventIDs[index]))
|
||||
ProgressionEventCondition._listeners[condition._eventIDs[index]] = new List<ProgressionEventCondition>();
|
||||
ProgressionEventCondition._listeners[condition._eventIDs[index]].Add(condition);
|
||||
}
|
||||
}
|
||||
|
||||
private static void ProgressionEventListener(int eventID)
|
||||
{
|
||||
if (!ProgressionEventCondition._listeners.ContainsKey(eventID))
|
||||
return;
|
||||
foreach (AchievementCondition achievementCondition in ProgressionEventCondition._listeners[eventID])
|
||||
achievementCondition.Complete();
|
||||
}
|
||||
|
||||
public static ProgressionEventCondition Create(params int[] eventIDs) => new ProgressionEventCondition(eventIDs);
|
||||
|
||||
public static ProgressionEventCondition Create(int eventID) => new ProgressionEventCondition(eventID);
|
||||
|
||||
public static ProgressionEventCondition[] CreateMany(
|
||||
params int[] eventIDs)
|
||||
{
|
||||
ProgressionEventCondition[] progressionEventConditionArray = new ProgressionEventCondition[eventIDs.Length];
|
||||
for (int index = 0; index < eventIDs.Length; ++index)
|
||||
progressionEventConditionArray[index] = new ProgressionEventCondition(eventIDs[index]);
|
||||
return progressionEventConditionArray;
|
||||
}
|
||||
}
|
||||
}
|
51
GameContent/Achievements/TileDestroyedCondition.cs
Normal file
51
GameContent/Achievements/TileDestroyedCondition.cs
Normal file
|
@ -0,0 +1,51 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.GameContent.Achievements.TileDestroyedCondition
|
||||
// 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.Collections.Generic;
|
||||
using Terraria.Achievements;
|
||||
|
||||
namespace Terraria.GameContent.Achievements
|
||||
{
|
||||
public class TileDestroyedCondition : AchievementCondition
|
||||
{
|
||||
private const string Identifier = "TILE_DESTROYED";
|
||||
private static Dictionary<ushort, List<TileDestroyedCondition>> _listeners = new Dictionary<ushort, List<TileDestroyedCondition>>();
|
||||
private static bool _isListenerHooked = false;
|
||||
private ushort[] _tileIds;
|
||||
|
||||
private TileDestroyedCondition(ushort[] tileIds)
|
||||
: base("TILE_DESTROYED_" + (object) tileIds[0])
|
||||
{
|
||||
this._tileIds = tileIds;
|
||||
TileDestroyedCondition.ListenForDestruction(this);
|
||||
}
|
||||
|
||||
private static void ListenForDestruction(TileDestroyedCondition condition)
|
||||
{
|
||||
if (!TileDestroyedCondition._isListenerHooked)
|
||||
{
|
||||
AchievementsHelper.OnTileDestroyed += new AchievementsHelper.TileDestroyedEvent(TileDestroyedCondition.TileDestroyedListener);
|
||||
TileDestroyedCondition._isListenerHooked = true;
|
||||
}
|
||||
for (int index = 0; index < condition._tileIds.Length; ++index)
|
||||
{
|
||||
if (!TileDestroyedCondition._listeners.ContainsKey(condition._tileIds[index]))
|
||||
TileDestroyedCondition._listeners[condition._tileIds[index]] = new List<TileDestroyedCondition>();
|
||||
TileDestroyedCondition._listeners[condition._tileIds[index]].Add(condition);
|
||||
}
|
||||
}
|
||||
|
||||
private static void TileDestroyedListener(Player player, ushort tileId)
|
||||
{
|
||||
if (player.whoAmI != Main.myPlayer || !TileDestroyedCondition._listeners.ContainsKey(tileId))
|
||||
return;
|
||||
foreach (AchievementCondition achievementCondition in TileDestroyedCondition._listeners[tileId])
|
||||
achievementCondition.Complete();
|
||||
}
|
||||
|
||||
public static AchievementCondition Create(params ushort[] tileIds) => (AchievementCondition) new TileDestroyedCondition(tileIds);
|
||||
}
|
||||
}
|
67
GameContent/Biomes/CampsiteBiome.cs
Normal file
67
GameContent/Biomes/CampsiteBiome.cs
Normal file
|
@ -0,0 +1,67 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.GameContent.Biomes.CampsiteBiome
|
||||
// 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 Terraria.World.Generation;
|
||||
|
||||
namespace Terraria.GameContent.Biomes
|
||||
{
|
||||
public class CampsiteBiome : MicroBiome
|
||||
{
|
||||
public override bool Place(Point origin, StructureMap structures)
|
||||
{
|
||||
Ref<int> count1 = new Ref<int>(0);
|
||||
Ref<int> count2 = new Ref<int>(0);
|
||||
WorldUtils.Gen(origin, (GenShape) new Shapes.Circle(10), Actions.Chain((GenAction) new Actions.Scanner(count2), (GenAction) new Modifiers.IsSolid(), (GenAction) new Actions.Scanner(count1)));
|
||||
if (count1.Value < count2.Value - 5)
|
||||
return false;
|
||||
int radius = GenBase._random.Next(6, 10);
|
||||
int num1 = GenBase._random.Next(5);
|
||||
if (!structures.CanPlace(new Microsoft.Xna.Framework.Rectangle(origin.X - radius, origin.Y - radius, radius * 2, radius * 2)))
|
||||
return false;
|
||||
ShapeData data = new ShapeData();
|
||||
WorldUtils.Gen(origin, (GenShape) new Shapes.Slime(radius), Actions.Chain(new Modifiers.Blotches(num1, num1, num1, 1).Output(data), (GenAction) new Modifiers.Offset(0, -2), (GenAction) new Modifiers.OnlyTiles(new ushort[1]
|
||||
{
|
||||
(ushort) 53
|
||||
}), (GenAction) new Actions.SetTile((ushort) 397, true), (GenAction) new Modifiers.OnlyWalls(new byte[1]), (GenAction) new Actions.PlaceWall((byte) 16)));
|
||||
WorldUtils.Gen(origin, (GenShape) new ModShapes.All(data), Actions.Chain((GenAction) new Actions.ClearTile(), (GenAction) new Actions.SetLiquid(value: (byte) 0), (GenAction) new Actions.SetFrames(true), (GenAction) new Modifiers.OnlyWalls(new byte[1]), (GenAction) new Actions.PlaceWall((byte) 16)));
|
||||
Point result;
|
||||
if (!WorldUtils.Find(origin, Searches.Chain((GenSearch) new Searches.Down(10), (GenCondition) new Conditions.IsSolid()), out result))
|
||||
return false;
|
||||
int j = result.Y - 1;
|
||||
bool flag = GenBase._random.Next() % 2 == 0;
|
||||
if (GenBase._random.Next() % 10 != 0)
|
||||
{
|
||||
int num2 = GenBase._random.Next(1, 4);
|
||||
int num3 = flag ? 4 : -(radius >> 1);
|
||||
for (int index1 = 0; index1 < num2; ++index1)
|
||||
{
|
||||
int num4 = GenBase._random.Next(1, 3);
|
||||
for (int index2 = 0; index2 < num4; ++index2)
|
||||
WorldGen.PlaceTile(origin.X + num3 - index1, j - index2, 331);
|
||||
}
|
||||
}
|
||||
int num5 = (radius - 3) * (flag ? -1 : 1);
|
||||
if (GenBase._random.Next() % 10 != 0)
|
||||
WorldGen.PlaceTile(origin.X + num5, j, 186);
|
||||
if (GenBase._random.Next() % 10 != 0)
|
||||
{
|
||||
WorldGen.PlaceTile(origin.X, j, 215, true);
|
||||
if (GenBase._tiles[origin.X, j].active() && GenBase._tiles[origin.X, j].type == (ushort) 215)
|
||||
{
|
||||
GenBase._tiles[origin.X, j].frameY += (short) 36;
|
||||
GenBase._tiles[origin.X - 1, j].frameY += (short) 36;
|
||||
GenBase._tiles[origin.X + 1, j].frameY += (short) 36;
|
||||
GenBase._tiles[origin.X, j - 1].frameY += (short) 36;
|
||||
GenBase._tiles[origin.X - 1, j - 1].frameY += (short) 36;
|
||||
GenBase._tiles[origin.X + 1, j - 1].frameY += (short) 36;
|
||||
}
|
||||
}
|
||||
structures.AddStructure(new Microsoft.Xna.Framework.Rectangle(origin.X - radius, origin.Y - radius, radius * 2, radius * 2), 4);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
699
GameContent/Biomes/CaveHouseBiome.cs
Normal file
699
GameContent/Biomes/CaveHouseBiome.cs
Normal file
|
@ -0,0 +1,699 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.GameContent.Biomes.CaveHouseBiome
|
||||
// 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 System;
|
||||
using System.Collections.Generic;
|
||||
using Terraria.GameContent.Generation;
|
||||
using Terraria.ID;
|
||||
using Terraria.World.Generation;
|
||||
|
||||
namespace Terraria.GameContent.Biomes
|
||||
{
|
||||
public class CaveHouseBiome : MicroBiome
|
||||
{
|
||||
private const int VERTICAL_EXIT_WIDTH = 3;
|
||||
private static readonly bool[] _blacklistedTiles = TileID.Sets.Factory.CreateBoolSet(true, 225, 41, 43, 44, 226, 203, 112, 25, 151);
|
||||
private int _sharpenerCount;
|
||||
private int _extractinatorCount;
|
||||
|
||||
private Microsoft.Xna.Framework.Rectangle GetRoom(Point origin)
|
||||
{
|
||||
Point result1;
|
||||
bool flag1 = WorldUtils.Find(origin, Searches.Chain((GenSearch) new Searches.Left(25), (GenCondition) new Conditions.IsSolid()), out result1);
|
||||
Point result2;
|
||||
int num1 = WorldUtils.Find(origin, Searches.Chain((GenSearch) new Searches.Right(25), (GenCondition) new Conditions.IsSolid()), out result2) ? 1 : 0;
|
||||
if (!flag1)
|
||||
result1 = new Point(origin.X - 25, origin.Y);
|
||||
if (num1 == 0)
|
||||
result2 = new Point(origin.X + 25, origin.Y);
|
||||
Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(origin.X, origin.Y, 0, 0);
|
||||
if (origin.X - result1.X > result2.X - origin.X)
|
||||
{
|
||||
rectangle.X = result1.X;
|
||||
rectangle.Width = Utils.Clamp<int>(result2.X - result1.X, 15, 30);
|
||||
}
|
||||
else
|
||||
{
|
||||
rectangle.Width = Utils.Clamp<int>(result2.X - result1.X, 15, 30);
|
||||
rectangle.X = result2.X - rectangle.Width;
|
||||
}
|
||||
Point result3;
|
||||
bool flag2 = WorldUtils.Find(result1, Searches.Chain((GenSearch) new Searches.Up(10), (GenCondition) new Conditions.IsSolid()), out result3);
|
||||
Point result4;
|
||||
int num2 = WorldUtils.Find(result2, Searches.Chain((GenSearch) new Searches.Up(10), (GenCondition) new Conditions.IsSolid()), out result4) ? 1 : 0;
|
||||
if (!flag2)
|
||||
result3 = new Point(origin.X, origin.Y - 10);
|
||||
if (num2 == 0)
|
||||
result4 = new Point(origin.X, origin.Y - 10);
|
||||
rectangle.Height = Utils.Clamp<int>(Math.Max(origin.Y - result3.Y, origin.Y - result4.Y), 8, 12);
|
||||
rectangle.Y -= rectangle.Height;
|
||||
return rectangle;
|
||||
}
|
||||
|
||||
private float RoomSolidPrecentage(Microsoft.Xna.Framework.Rectangle room)
|
||||
{
|
||||
float num = (float) (room.Width * room.Height);
|
||||
Ref<int> count = new Ref<int>(0);
|
||||
WorldUtils.Gen(new Point(room.X, room.Y), (GenShape) new Shapes.Rectangle(room.Width, room.Height), Actions.Chain((GenAction) new Modifiers.IsSolid(), (GenAction) new Actions.Count(count)));
|
||||
return (float) count.Value / num;
|
||||
}
|
||||
|
||||
private bool FindVerticalExit(Microsoft.Xna.Framework.Rectangle wall, bool isUp, out int exitX)
|
||||
{
|
||||
Point result;
|
||||
int num = WorldUtils.Find(new Point(wall.X + wall.Width - 3, wall.Y + (isUp ? -5 : 0)), Searches.Chain((GenSearch) new Searches.Left(wall.Width - 3), new Conditions.IsSolid().Not().AreaOr(3, 5)), out result) ? 1 : 0;
|
||||
exitX = result.X;
|
||||
return num != 0;
|
||||
}
|
||||
|
||||
private bool FindSideExit(Microsoft.Xna.Framework.Rectangle wall, bool isLeft, out int exitY)
|
||||
{
|
||||
Point result;
|
||||
int num = WorldUtils.Find(new Point(wall.X + (isLeft ? -4 : 0), wall.Y + wall.Height - 3), Searches.Chain((GenSearch) new Searches.Up(wall.Height - 3), new Conditions.IsSolid().Not().AreaOr(4, 3)), out result) ? 1 : 0;
|
||||
exitY = result.Y;
|
||||
return num != 0;
|
||||
}
|
||||
|
||||
private int SortBiomeResults(
|
||||
Tuple<CaveHouseBiome.BuildData, int> item1,
|
||||
Tuple<CaveHouseBiome.BuildData, int> item2)
|
||||
{
|
||||
return item2.Item2.CompareTo(item1.Item2);
|
||||
}
|
||||
|
||||
public override bool Place(Point origin, StructureMap structures)
|
||||
{
|
||||
Point result1;
|
||||
if (!WorldUtils.Find(origin, Searches.Chain((GenSearch) new Searches.Down(200), (GenCondition) new Conditions.IsSolid()), out result1) || result1 == origin)
|
||||
return false;
|
||||
Microsoft.Xna.Framework.Rectangle room1 = this.GetRoom(result1);
|
||||
Microsoft.Xna.Framework.Rectangle room2 = this.GetRoom(new Point(room1.Center.X, room1.Y + 1));
|
||||
Microsoft.Xna.Framework.Rectangle room3 = this.GetRoom(new Point(room1.Center.X, room1.Y + room1.Height + 10));
|
||||
room3.Y = room1.Y + room1.Height - 1;
|
||||
float num1 = this.RoomSolidPrecentage(room2);
|
||||
float num2 = this.RoomSolidPrecentage(room3);
|
||||
room1.Y += 3;
|
||||
room2.Y += 3;
|
||||
room3.Y += 3;
|
||||
List<Microsoft.Xna.Framework.Rectangle> rectangleList1 = new List<Microsoft.Xna.Framework.Rectangle>();
|
||||
if ((double) GenBase._random.NextFloat() > (double) num1 + 0.200000002980232)
|
||||
rectangleList1.Add(room2);
|
||||
else
|
||||
room2 = room1;
|
||||
rectangleList1.Add(room1);
|
||||
if ((double) GenBase._random.NextFloat() > (double) num2 + 0.200000002980232)
|
||||
rectangleList1.Add(room3);
|
||||
else
|
||||
room3 = room1;
|
||||
foreach (Microsoft.Xna.Framework.Rectangle rectangle in rectangleList1)
|
||||
{
|
||||
if (rectangle.Y + rectangle.Height > Main.maxTilesY - 220)
|
||||
return false;
|
||||
}
|
||||
Dictionary<ushort, int> resultsOutput = new Dictionary<ushort, int>();
|
||||
foreach (Microsoft.Xna.Framework.Rectangle rectangle in rectangleList1)
|
||||
WorldUtils.Gen(new Point(rectangle.X - 10, rectangle.Y - 10), (GenShape) new Shapes.Rectangle(rectangle.Width + 20, rectangle.Height + 20), (GenAction) new Actions.TileScanner(new ushort[12]
|
||||
{
|
||||
(ushort) 0,
|
||||
(ushort) 59,
|
||||
(ushort) 147,
|
||||
(ushort) 1,
|
||||
(ushort) 161,
|
||||
(ushort) 53,
|
||||
(ushort) 396,
|
||||
(ushort) 397,
|
||||
(ushort) 368,
|
||||
(ushort) 367,
|
||||
(ushort) 60,
|
||||
(ushort) 70
|
||||
}).Output(resultsOutput));
|
||||
List<Tuple<CaveHouseBiome.BuildData, int>> tupleList1 = new List<Tuple<CaveHouseBiome.BuildData, int>>();
|
||||
tupleList1.Add(Tuple.Create<CaveHouseBiome.BuildData, int>(CaveHouseBiome.BuildData.Default, resultsOutput[(ushort) 0] + resultsOutput[(ushort) 1]));
|
||||
tupleList1.Add(Tuple.Create<CaveHouseBiome.BuildData, int>(CaveHouseBiome.BuildData.Jungle, resultsOutput[(ushort) 59] + resultsOutput[(ushort) 60] * 10));
|
||||
tupleList1.Add(Tuple.Create<CaveHouseBiome.BuildData, int>(CaveHouseBiome.BuildData.Mushroom, resultsOutput[(ushort) 59] + resultsOutput[(ushort) 70] * 10));
|
||||
tupleList1.Add(Tuple.Create<CaveHouseBiome.BuildData, int>(CaveHouseBiome.BuildData.Snow, resultsOutput[(ushort) 147] + resultsOutput[(ushort) 161]));
|
||||
tupleList1.Add(Tuple.Create<CaveHouseBiome.BuildData, int>(CaveHouseBiome.BuildData.Desert, resultsOutput[(ushort) 397] + resultsOutput[(ushort) 396] + resultsOutput[(ushort) 53]));
|
||||
tupleList1.Add(Tuple.Create<CaveHouseBiome.BuildData, int>(CaveHouseBiome.BuildData.Granite, resultsOutput[(ushort) 368]));
|
||||
tupleList1.Add(Tuple.Create<CaveHouseBiome.BuildData, int>(CaveHouseBiome.BuildData.Marble, resultsOutput[(ushort) 367]));
|
||||
tupleList1.Sort(new Comparison<Tuple<CaveHouseBiome.BuildData, int>>(this.SortBiomeResults));
|
||||
CaveHouseBiome.BuildData buildData = tupleList1[0].Item1;
|
||||
foreach (Microsoft.Xna.Framework.Rectangle area in rectangleList1)
|
||||
{
|
||||
if (buildData != CaveHouseBiome.BuildData.Granite)
|
||||
{
|
||||
if (WorldUtils.Find(new Point(area.X - 2, area.Y - 2), Searches.Chain(new Searches.Rectangle(area.Width + 4, area.Height + 4).RequireAll(false), (GenCondition) new Conditions.HasLava()), out Point _))
|
||||
return false;
|
||||
}
|
||||
if (!structures.CanPlace(area, CaveHouseBiome._blacklistedTiles, 5))
|
||||
return false;
|
||||
}
|
||||
int val1_1 = room1.X;
|
||||
int val1_2 = room1.X + room1.Width - 1;
|
||||
List<Microsoft.Xna.Framework.Rectangle> rectangleList2 = new List<Microsoft.Xna.Framework.Rectangle>();
|
||||
foreach (Microsoft.Xna.Framework.Rectangle rectangle in rectangleList1)
|
||||
{
|
||||
val1_1 = Math.Min(val1_1, rectangle.X);
|
||||
val1_2 = Math.Max(val1_2, rectangle.X + rectangle.Width - 1);
|
||||
}
|
||||
int num3 = 6;
|
||||
while (num3 > 4 && (val1_2 - val1_1) % num3 != 0)
|
||||
--num3;
|
||||
for (int x = val1_1; x <= val1_2; x += num3)
|
||||
{
|
||||
for (int index1 = 0; index1 < rectangleList1.Count; ++index1)
|
||||
{
|
||||
Microsoft.Xna.Framework.Rectangle rectangle = rectangleList1[index1];
|
||||
if (x >= rectangle.X && x < rectangle.X + rectangle.Width)
|
||||
{
|
||||
int y = rectangle.Y + rectangle.Height;
|
||||
int num4 = 50;
|
||||
for (int index2 = index1 + 1; index2 < rectangleList1.Count; ++index2)
|
||||
{
|
||||
if (x >= rectangleList1[index2].X && x < rectangleList1[index2].X + rectangleList1[index2].Width)
|
||||
num4 = Math.Min(num4, rectangleList1[index2].Y - y);
|
||||
}
|
||||
if (num4 > 0)
|
||||
{
|
||||
Point result2;
|
||||
bool flag = WorldUtils.Find(new Point(x, y), Searches.Chain((GenSearch) new Searches.Down(num4), (GenCondition) new Conditions.IsSolid()), out result2);
|
||||
if (num4 < 50)
|
||||
{
|
||||
flag = true;
|
||||
result2 = new Point(x, y + num4);
|
||||
}
|
||||
if (flag)
|
||||
rectangleList2.Add(new Microsoft.Xna.Framework.Rectangle(x, y, 1, result2.Y - y));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
List<Point> pointList1 = new List<Point>();
|
||||
foreach (Microsoft.Xna.Framework.Rectangle rectangle in rectangleList1)
|
||||
{
|
||||
int exitY;
|
||||
if (this.FindSideExit(new Microsoft.Xna.Framework.Rectangle(rectangle.X + rectangle.Width, rectangle.Y + 1, 1, rectangle.Height - 2), false, out exitY))
|
||||
pointList1.Add(new Point(rectangle.X + rectangle.Width - 1, exitY));
|
||||
if (this.FindSideExit(new Microsoft.Xna.Framework.Rectangle(rectangle.X, rectangle.Y + 1, 1, rectangle.Height - 2), true, out exitY))
|
||||
pointList1.Add(new Point(rectangle.X, exitY));
|
||||
}
|
||||
List<Tuple<Point, Point>> tupleList2 = new List<Tuple<Point, Point>>();
|
||||
for (int index = 1; index < rectangleList1.Count; ++index)
|
||||
{
|
||||
Microsoft.Xna.Framework.Rectangle rectangle1 = rectangleList1[index];
|
||||
Microsoft.Xna.Framework.Rectangle rectangle2 = rectangleList1[index - 1];
|
||||
if (rectangle2.X - rectangle1.X > rectangle1.X + rectangle1.Width - (rectangle2.X + rectangle2.Width))
|
||||
tupleList2.Add(new Tuple<Point, Point>(new Point(rectangle1.X + rectangle1.Width - 1, rectangle1.Y + 1), new Point(rectangle1.X + rectangle1.Width - rectangle1.Height + 1, rectangle1.Y + rectangle1.Height - 1)));
|
||||
else
|
||||
tupleList2.Add(new Tuple<Point, Point>(new Point(rectangle1.X, rectangle1.Y + 1), new Point(rectangle1.X + rectangle1.Height - 1, rectangle1.Y + rectangle1.Height - 1)));
|
||||
}
|
||||
List<Point> pointList2 = new List<Point>();
|
||||
int exitX;
|
||||
if (this.FindVerticalExit(new Microsoft.Xna.Framework.Rectangle(room2.X + 2, room2.Y, room2.Width - 4, 1), true, out exitX))
|
||||
pointList2.Add(new Point(exitX, room2.Y));
|
||||
if (this.FindVerticalExit(new Microsoft.Xna.Framework.Rectangle(room3.X + 2, room3.Y + room3.Height - 1, room3.Width - 4, 1), false, out exitX))
|
||||
pointList2.Add(new Point(exitX, room3.Y + room3.Height - 1));
|
||||
foreach (Microsoft.Xna.Framework.Rectangle area in rectangleList1)
|
||||
{
|
||||
WorldUtils.Gen(new Point(area.X, area.Y), (GenShape) new Shapes.Rectangle(area.Width, area.Height), Actions.Chain((GenAction) new Actions.SetTile(buildData.Tile), (GenAction) new Actions.SetFrames(true)));
|
||||
WorldUtils.Gen(new Point(area.X + 1, area.Y + 1), (GenShape) new Shapes.Rectangle(area.Width - 2, area.Height - 2), Actions.Chain((GenAction) new Actions.ClearTile(true), (GenAction) new Actions.PlaceWall(buildData.Wall)));
|
||||
structures.AddStructure(area, 8);
|
||||
}
|
||||
foreach (Tuple<Point, Point> tuple in tupleList2)
|
||||
{
|
||||
Point origin1 = tuple.Item1;
|
||||
Point point = tuple.Item2;
|
||||
int num5 = point.X > origin1.X ? 1 : -1;
|
||||
ShapeData data = new ShapeData();
|
||||
for (int y = 0; y < point.Y - origin1.Y; ++y)
|
||||
data.Add(num5 * (y + 1), y);
|
||||
WorldUtils.Gen(origin1, (GenShape) new ModShapes.All(data), Actions.Chain((GenAction) new Actions.PlaceTile((ushort) 19, buildData.PlatformStyle), (GenAction) new Actions.SetSlope(num5 == 1 ? 1 : 2), (GenAction) new Actions.SetFrames(true)));
|
||||
WorldUtils.Gen(new Point(origin1.X + (num5 == 1 ? 1 : -4), origin1.Y - 1), (GenShape) new Shapes.Rectangle(4, 1), Actions.Chain((GenAction) new Actions.Clear(), (GenAction) new Actions.PlaceWall(buildData.Wall), (GenAction) new Actions.PlaceTile((ushort) 19, buildData.PlatformStyle), (GenAction) new Actions.SetFrames(true)));
|
||||
}
|
||||
foreach (Point origin2 in pointList1)
|
||||
{
|
||||
WorldUtils.Gen(origin2, (GenShape) new Shapes.Rectangle(1, 3), (GenAction) new Actions.ClearTile(true));
|
||||
WorldGen.PlaceTile(origin2.X, origin2.Y, 10, true, true, style: buildData.DoorStyle);
|
||||
}
|
||||
foreach (Point origin3 in pointList2)
|
||||
{
|
||||
Shapes.Rectangle rectangle = new Shapes.Rectangle(3, 1);
|
||||
GenAction action = Actions.Chain((GenAction) new Actions.ClearMetadata(), (GenAction) new Actions.PlaceTile((ushort) 19, buildData.PlatformStyle), (GenAction) new Actions.SetFrames(true));
|
||||
WorldUtils.Gen(origin3, (GenShape) rectangle, action);
|
||||
}
|
||||
foreach (Microsoft.Xna.Framework.Rectangle rectangle in rectangleList2)
|
||||
{
|
||||
if (rectangle.Height > 1 && GenBase._tiles[rectangle.X, rectangle.Y - 1].type != (ushort) 19)
|
||||
{
|
||||
WorldUtils.Gen(new Point(rectangle.X, rectangle.Y), (GenShape) new Shapes.Rectangle(rectangle.Width, rectangle.Height), Actions.Chain((GenAction) new Actions.SetTile((ushort) 124), (GenAction) new Actions.SetFrames(true)));
|
||||
Tile tile = GenBase._tiles[rectangle.X, rectangle.Y + rectangle.Height];
|
||||
tile.slope((byte) 0);
|
||||
tile.halfBrick(false);
|
||||
}
|
||||
}
|
||||
Point[] pointArray = new Point[7]
|
||||
{
|
||||
new Point(14, buildData.TableStyle),
|
||||
new Point(16, 0),
|
||||
new Point(18, buildData.WorkbenchStyle),
|
||||
new Point(86, 0),
|
||||
new Point(87, buildData.PianoStyle),
|
||||
new Point(94, 0),
|
||||
new Point(101, buildData.BookcaseStyle)
|
||||
};
|
||||
foreach (Microsoft.Xna.Framework.Rectangle rectangle in rectangleList1)
|
||||
{
|
||||
int num6 = rectangle.Width / 8;
|
||||
int num7 = rectangle.Width / (num6 + 1);
|
||||
int num8 = GenBase._random.Next(2);
|
||||
for (int index3 = 0; index3 < num6; ++index3)
|
||||
{
|
||||
int num9 = (index3 + 1) * num7 + rectangle.X;
|
||||
switch (index3 + num8 % 2)
|
||||
{
|
||||
case 0:
|
||||
int num10 = rectangle.Y + Math.Min(rectangle.Height / 2, rectangle.Height - 5);
|
||||
Vector2 vector2 = WorldGen.randHousePicture();
|
||||
int x = (int) vector2.X;
|
||||
int y = (int) vector2.Y;
|
||||
if (!WorldGen.nearPicture(num9, num10))
|
||||
{
|
||||
WorldGen.PlaceTile(num9, num10, x, true, style: y);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
int j = rectangle.Y + 1;
|
||||
WorldGen.PlaceTile(num9, j, 34, true, style: GenBase._random.Next(6));
|
||||
for (int index4 = -1; index4 < 2; ++index4)
|
||||
{
|
||||
for (int index5 = 0; index5 < 3; ++index5)
|
||||
GenBase._tiles[index4 + num9, index5 + j].frameX += (short) 54;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
int num11 = rectangle.Width / 8 + 3;
|
||||
WorldGen.SetupStatueList();
|
||||
for (; num11 > 0; --num11)
|
||||
{
|
||||
int num12 = GenBase._random.Next(rectangle.Width - 3) + 1 + rectangle.X;
|
||||
int num13 = rectangle.Y + rectangle.Height - 2;
|
||||
switch (GenBase._random.Next(4))
|
||||
{
|
||||
case 0:
|
||||
WorldGen.PlaceSmallPile(num12, num13, GenBase._random.Next(31, 34), 1);
|
||||
break;
|
||||
case 1:
|
||||
WorldGen.PlaceTile(num12, num13, 186, true, style: GenBase._random.Next(22, 26));
|
||||
break;
|
||||
case 2:
|
||||
int index = GenBase._random.Next(2, WorldGen.statueList.Length);
|
||||
WorldGen.PlaceTile(num12, num13, (int) WorldGen.statueList[index].X, true, style: ((int) WorldGen.statueList[index].Y));
|
||||
if (WorldGen.StatuesWithTraps.Contains(index))
|
||||
{
|
||||
WorldGen.PlaceStatueTrap(num12, num13);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
Point point = Utils.SelectRandom<Point>(GenBase._random, pointArray);
|
||||
WorldGen.PlaceTile(num12, num13, point.X, true, style: point.Y);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach (Microsoft.Xna.Framework.Rectangle room4 in rectangleList1)
|
||||
buildData.ProcessRoom(room4);
|
||||
bool flag1 = false;
|
||||
foreach (Microsoft.Xna.Framework.Rectangle rectangle in rectangleList1)
|
||||
{
|
||||
int j = rectangle.Height - 1 + rectangle.Y;
|
||||
int Style = j > (int) Main.worldSurface ? buildData.ChestStyle : 0;
|
||||
int num14 = 0;
|
||||
while (num14 < 10 && !(flag1 = WorldGen.AddBuriedChest(GenBase._random.Next(2, rectangle.Width - 2) + rectangle.X, j, Style: Style)))
|
||||
++num14;
|
||||
if (!flag1)
|
||||
{
|
||||
int i = rectangle.X + 2;
|
||||
while (i <= rectangle.X + rectangle.Width - 2 && !(flag1 = WorldGen.AddBuriedChest(i, j, Style: Style)))
|
||||
++i;
|
||||
if (flag1)
|
||||
break;
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
if (!flag1)
|
||||
{
|
||||
foreach (Microsoft.Xna.Framework.Rectangle rectangle in rectangleList1)
|
||||
{
|
||||
int j = rectangle.Y - 1;
|
||||
int Style = j > (int) Main.worldSurface ? buildData.ChestStyle : 0;
|
||||
int num15 = 0;
|
||||
while (num15 < 10 && !(flag1 = WorldGen.AddBuriedChest(GenBase._random.Next(2, rectangle.Width - 2) + rectangle.X, j, Style: Style)))
|
||||
++num15;
|
||||
if (!flag1)
|
||||
{
|
||||
int i = rectangle.X + 2;
|
||||
while (i <= rectangle.X + rectangle.Width - 2 && !(flag1 = WorldGen.AddBuriedChest(i, j, Style: Style)))
|
||||
++i;
|
||||
if (flag1)
|
||||
break;
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!flag1)
|
||||
{
|
||||
for (int index = 0; index < 1000; ++index)
|
||||
{
|
||||
int i = GenBase._random.Next(rectangleList1[0].X - 30, rectangleList1[0].X + 30);
|
||||
int num16 = GenBase._random.Next(rectangleList1[0].Y - 30, rectangleList1[0].Y + 30);
|
||||
int num17 = num16 > (int) Main.worldSurface ? buildData.ChestStyle : 0;
|
||||
int j = num16;
|
||||
int Style = num17;
|
||||
if (WorldGen.AddBuriedChest(i, j, Style: Style))
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (buildData == CaveHouseBiome.BuildData.Jungle && this._sharpenerCount < GenBase._random.Next(2, 5))
|
||||
{
|
||||
bool flag2 = false;
|
||||
foreach (Microsoft.Xna.Framework.Rectangle rectangle in rectangleList1)
|
||||
{
|
||||
int j = rectangle.Height - 2 + rectangle.Y;
|
||||
for (int index = 0; index < 10; ++index)
|
||||
{
|
||||
int i = GenBase._random.Next(2, rectangle.Width - 2) + rectangle.X;
|
||||
WorldGen.PlaceTile(i, j, 377, true, true);
|
||||
if (flag2 = GenBase._tiles[i, j].active() && GenBase._tiles[i, j].type == (ushort) 377)
|
||||
break;
|
||||
}
|
||||
if (!flag2)
|
||||
{
|
||||
int i = rectangle.X + 2;
|
||||
while (i <= rectangle.X + rectangle.Width - 2 && !(flag2 = WorldGen.PlaceTile(i, j, 377, true, true)))
|
||||
++i;
|
||||
if (flag2)
|
||||
break;
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
if (flag2)
|
||||
++this._sharpenerCount;
|
||||
}
|
||||
if (buildData == CaveHouseBiome.BuildData.Desert && this._extractinatorCount < GenBase._random.Next(2, 5))
|
||||
{
|
||||
bool flag3 = false;
|
||||
foreach (Microsoft.Xna.Framework.Rectangle rectangle in rectangleList1)
|
||||
{
|
||||
int j = rectangle.Height - 2 + rectangle.Y;
|
||||
for (int index = 0; index < 10; ++index)
|
||||
{
|
||||
int i = GenBase._random.Next(2, rectangle.Width - 2) + rectangle.X;
|
||||
WorldGen.PlaceTile(i, j, 219, true, true);
|
||||
if (flag3 = GenBase._tiles[i, j].active() && GenBase._tiles[i, j].type == (ushort) 219)
|
||||
break;
|
||||
}
|
||||
if (!flag3)
|
||||
{
|
||||
int i = rectangle.X + 2;
|
||||
while (i <= rectangle.X + rectangle.Width - 2 && !(flag3 = WorldGen.PlaceTile(i, j, 219, true, true)))
|
||||
++i;
|
||||
if (flag3)
|
||||
break;
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
if (flag3)
|
||||
++this._extractinatorCount;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void Reset()
|
||||
{
|
||||
this._sharpenerCount = 0;
|
||||
this._extractinatorCount = 0;
|
||||
}
|
||||
|
||||
internal static void AgeDefaultRoom(Microsoft.Xna.Framework.Rectangle room)
|
||||
{
|
||||
for (int index = 0; index < room.Width * room.Height / 16; ++index)
|
||||
WorldUtils.Gen(new Point(GenBase._random.Next(1, room.Width - 1) + room.X, GenBase._random.Next(1, room.Height - 1) + room.Y), (GenShape) new Shapes.Rectangle(2, 2), Actions.Chain((GenAction) new Modifiers.Dither(), (GenAction) new Modifiers.Blotches(chance: 2.0), (GenAction) new Modifiers.IsEmpty(), (GenAction) new Actions.SetTile((ushort) 51, true)));
|
||||
WorldUtils.Gen(new Point(room.X, room.Y), (GenShape) new Shapes.Rectangle(room.Width, room.Height), Actions.Chain((GenAction) new Modifiers.Dither(0.850000023841858), (GenAction) new Modifiers.Blotches(), (GenAction) new Modifiers.OnlyWalls(new byte[1]
|
||||
{
|
||||
CaveHouseBiome.BuildData.Default.Wall
|
||||
}), (double) room.Y > Main.worldSurface ? (GenAction) new Actions.ClearWall(true) : (GenAction) new Actions.PlaceWall((byte) 2)));
|
||||
WorldUtils.Gen(new Point(room.X, room.Y), (GenShape) new Shapes.Rectangle(room.Width, room.Height), Actions.Chain((GenAction) new Modifiers.Dither(0.949999988079071), (GenAction) new Modifiers.OnlyTiles(new ushort[3]
|
||||
{
|
||||
(ushort) 30,
|
||||
(ushort) 321,
|
||||
(ushort) 158
|
||||
}), (GenAction) new Actions.ClearTile(true)));
|
||||
}
|
||||
|
||||
internal static void AgeSnowRoom(Microsoft.Xna.Framework.Rectangle room)
|
||||
{
|
||||
WorldUtils.Gen(new Point(room.X, room.Y), (GenShape) new Shapes.Rectangle(room.Width, room.Height), Actions.Chain((GenAction) new Modifiers.Dither(0.600000023841858), (GenAction) new Modifiers.Blotches(chance: 0.600000023841858), (GenAction) new Modifiers.OnlyTiles(new ushort[1]
|
||||
{
|
||||
CaveHouseBiome.BuildData.Snow.Tile
|
||||
}), (GenAction) new Actions.SetTile((ushort) 161, true), (GenAction) new Modifiers.Dither(0.8), (GenAction) new Actions.SetTile((ushort) 147, true)));
|
||||
WorldUtils.Gen(new Point(room.X + 1, room.Y), (GenShape) new Shapes.Rectangle(room.Width - 2, 1), Actions.Chain((GenAction) new Modifiers.Dither(), (GenAction) new Modifiers.OnlyTiles(new ushort[1]
|
||||
{
|
||||
(ushort) 161
|
||||
}), (GenAction) new Modifiers.Offset(0, 1), (GenAction) new ActionStalagtite()));
|
||||
WorldUtils.Gen(new Point(room.X + 1, room.Y + room.Height - 1), (GenShape) new Shapes.Rectangle(room.Width - 2, 1), Actions.Chain((GenAction) new Modifiers.Dither(), (GenAction) new Modifiers.OnlyTiles(new ushort[1]
|
||||
{
|
||||
(ushort) 161
|
||||
}), (GenAction) new Modifiers.Offset(0, 1), (GenAction) new ActionStalagtite()));
|
||||
WorldUtils.Gen(new Point(room.X, room.Y), (GenShape) new Shapes.Rectangle(room.Width, room.Height), Actions.Chain((GenAction) new Modifiers.Dither(0.850000023841858), (GenAction) new Modifiers.Blotches(chance: 0.8), (double) room.Y > Main.worldSurface ? (GenAction) new Actions.ClearWall(true) : (GenAction) new Actions.PlaceWall((byte) 40)));
|
||||
}
|
||||
|
||||
internal static void AgeDesertRoom(Microsoft.Xna.Framework.Rectangle room)
|
||||
{
|
||||
WorldUtils.Gen(new Point(room.X, room.Y), (GenShape) new Shapes.Rectangle(room.Width, room.Height), Actions.Chain((GenAction) new Modifiers.Dither(0.800000011920929), (GenAction) new Modifiers.Blotches(chance: 0.200000002980232), (GenAction) new Modifiers.OnlyTiles(new ushort[1]
|
||||
{
|
||||
CaveHouseBiome.BuildData.Desert.Tile
|
||||
}), (GenAction) new Actions.SetTile((ushort) 396, true), (GenAction) new Modifiers.Dither(), (GenAction) new Actions.SetTile((ushort) 397, true)));
|
||||
WorldUtils.Gen(new Point(room.X + 1, room.Y), (GenShape) new Shapes.Rectangle(room.Width - 2, 1), Actions.Chain((GenAction) new Modifiers.Dither(), (GenAction) new Modifiers.OnlyTiles(new ushort[2]
|
||||
{
|
||||
(ushort) 397,
|
||||
(ushort) 396
|
||||
}), (GenAction) new Modifiers.Offset(0, 1), (GenAction) new ActionStalagtite()));
|
||||
WorldUtils.Gen(new Point(room.X + 1, room.Y + room.Height - 1), (GenShape) new Shapes.Rectangle(room.Width - 2, 1), Actions.Chain((GenAction) new Modifiers.Dither(), (GenAction) new Modifiers.OnlyTiles(new ushort[2]
|
||||
{
|
||||
(ushort) 397,
|
||||
(ushort) 396
|
||||
}), (GenAction) new Modifiers.Offset(0, 1), (GenAction) new ActionStalagtite()));
|
||||
WorldUtils.Gen(new Point(room.X, room.Y), (GenShape) new Shapes.Rectangle(room.Width, room.Height), Actions.Chain((GenAction) new Modifiers.Dither(0.800000011920929), (GenAction) new Modifiers.Blotches(), (GenAction) new Modifiers.OnlyWalls(new byte[1]
|
||||
{
|
||||
CaveHouseBiome.BuildData.Desert.Wall
|
||||
}), (GenAction) new Actions.PlaceWall((byte) 216)));
|
||||
}
|
||||
|
||||
internal static void AgeGraniteRoom(Microsoft.Xna.Framework.Rectangle room)
|
||||
{
|
||||
WorldUtils.Gen(new Point(room.X, room.Y), (GenShape) new Shapes.Rectangle(room.Width, room.Height), Actions.Chain((GenAction) new Modifiers.Dither(0.600000023841858), (GenAction) new Modifiers.Blotches(chance: 0.600000023841858), (GenAction) new Modifiers.OnlyTiles(new ushort[1]
|
||||
{
|
||||
CaveHouseBiome.BuildData.Granite.Tile
|
||||
}), (GenAction) new Actions.SetTile((ushort) 368, true)));
|
||||
WorldUtils.Gen(new Point(room.X + 1, room.Y), (GenShape) new Shapes.Rectangle(room.Width - 2, 1), Actions.Chain((GenAction) new Modifiers.Dither(0.800000011920929), (GenAction) new Modifiers.OnlyTiles(new ushort[1]
|
||||
{
|
||||
(ushort) 368
|
||||
}), (GenAction) new Modifiers.Offset(0, 1), (GenAction) new ActionStalagtite()));
|
||||
WorldUtils.Gen(new Point(room.X + 1, room.Y + room.Height - 1), (GenShape) new Shapes.Rectangle(room.Width - 2, 1), Actions.Chain((GenAction) new Modifiers.Dither(0.800000011920929), (GenAction) new Modifiers.OnlyTiles(new ushort[1]
|
||||
{
|
||||
(ushort) 368
|
||||
}), (GenAction) new Modifiers.Offset(0, 1), (GenAction) new ActionStalagtite()));
|
||||
WorldUtils.Gen(new Point(room.X, room.Y), (GenShape) new Shapes.Rectangle(room.Width, room.Height), Actions.Chain((GenAction) new Modifiers.Dither(0.850000023841858), (GenAction) new Modifiers.Blotches(), (GenAction) new Actions.PlaceWall((byte) 180)));
|
||||
}
|
||||
|
||||
internal static void AgeMarbleRoom(Microsoft.Xna.Framework.Rectangle room)
|
||||
{
|
||||
WorldUtils.Gen(new Point(room.X, room.Y), (GenShape) new Shapes.Rectangle(room.Width, room.Height), Actions.Chain((GenAction) new Modifiers.Dither(0.600000023841858), (GenAction) new Modifiers.Blotches(chance: 0.600000023841858), (GenAction) new Modifiers.OnlyTiles(new ushort[1]
|
||||
{
|
||||
CaveHouseBiome.BuildData.Marble.Tile
|
||||
}), (GenAction) new Actions.SetTile((ushort) 367, true)));
|
||||
WorldUtils.Gen(new Point(room.X + 1, room.Y), (GenShape) new Shapes.Rectangle(room.Width - 2, 1), Actions.Chain((GenAction) new Modifiers.Dither(0.800000011920929), (GenAction) new Modifiers.OnlyTiles(new ushort[1]
|
||||
{
|
||||
(ushort) 367
|
||||
}), (GenAction) new Modifiers.Offset(0, 1), (GenAction) new ActionStalagtite()));
|
||||
WorldUtils.Gen(new Point(room.X + 1, room.Y + room.Height - 1), (GenShape) new Shapes.Rectangle(room.Width - 2, 1), Actions.Chain((GenAction) new Modifiers.Dither(0.800000011920929), (GenAction) new Modifiers.OnlyTiles(new ushort[1]
|
||||
{
|
||||
(ushort) 367
|
||||
}), (GenAction) new Modifiers.Offset(0, 1), (GenAction) new ActionStalagtite()));
|
||||
WorldUtils.Gen(new Point(room.X, room.Y), (GenShape) new Shapes.Rectangle(room.Width, room.Height), Actions.Chain((GenAction) new Modifiers.Dither(0.850000023841858), (GenAction) new Modifiers.Blotches(), (GenAction) new Actions.PlaceWall((byte) 178)));
|
||||
}
|
||||
|
||||
internal static void AgeMushroomRoom(Microsoft.Xna.Framework.Rectangle room)
|
||||
{
|
||||
WorldUtils.Gen(new Point(room.X, room.Y), (GenShape) new Shapes.Rectangle(room.Width, room.Height), Actions.Chain((GenAction) new Modifiers.Dither(0.699999988079071), (GenAction) new Modifiers.Blotches(chance: 0.5), (GenAction) new Modifiers.OnlyTiles(new ushort[1]
|
||||
{
|
||||
CaveHouseBiome.BuildData.Mushroom.Tile
|
||||
}), (GenAction) new Actions.SetTile((ushort) 70, true)));
|
||||
WorldUtils.Gen(new Point(room.X + 1, room.Y), (GenShape) new Shapes.Rectangle(room.Width - 2, 1), Actions.Chain((GenAction) new Modifiers.Dither(0.600000023841858), (GenAction) new Modifiers.OnlyTiles(new ushort[1]
|
||||
{
|
||||
(ushort) 70
|
||||
}), (GenAction) new Modifiers.Offset(0, -1), (GenAction) new Actions.SetTile((ushort) 71)));
|
||||
WorldUtils.Gen(new Point(room.X + 1, room.Y + room.Height - 1), (GenShape) new Shapes.Rectangle(room.Width - 2, 1), Actions.Chain((GenAction) new Modifiers.Dither(0.600000023841858), (GenAction) new Modifiers.OnlyTiles(new ushort[1]
|
||||
{
|
||||
(ushort) 70
|
||||
}), (GenAction) new Modifiers.Offset(0, -1), (GenAction) new Actions.SetTile((ushort) 71)));
|
||||
WorldUtils.Gen(new Point(room.X, room.Y), (GenShape) new Shapes.Rectangle(room.Width, room.Height), Actions.Chain((GenAction) new Modifiers.Dither(0.850000023841858), (GenAction) new Modifiers.Blotches(), (GenAction) new Actions.ClearWall()));
|
||||
}
|
||||
|
||||
internal static void AgeJungleRoom(Microsoft.Xna.Framework.Rectangle room)
|
||||
{
|
||||
WorldUtils.Gen(new Point(room.X, room.Y), (GenShape) new Shapes.Rectangle(room.Width, room.Height), Actions.Chain((GenAction) new Modifiers.Dither(0.600000023841858), (GenAction) new Modifiers.Blotches(chance: 0.600000023841858), (GenAction) new Modifiers.OnlyTiles(new ushort[1]
|
||||
{
|
||||
CaveHouseBiome.BuildData.Jungle.Tile
|
||||
}), (GenAction) new Actions.SetTile((ushort) 60, true), (GenAction) new Modifiers.Dither(0.800000011920929), (GenAction) new Actions.SetTile((ushort) 59, true)));
|
||||
WorldUtils.Gen(new Point(room.X + 1, room.Y), (GenShape) new Shapes.Rectangle(room.Width - 2, 1), Actions.Chain((GenAction) new Modifiers.Dither(), (GenAction) new Modifiers.OnlyTiles(new ushort[1]
|
||||
{
|
||||
(ushort) 60
|
||||
}), (GenAction) new Modifiers.Offset(0, 1), (GenAction) new ActionVines(3, room.Height, 62)));
|
||||
WorldUtils.Gen(new Point(room.X + 1, room.Y + room.Height - 1), (GenShape) new Shapes.Rectangle(room.Width - 2, 1), Actions.Chain((GenAction) new Modifiers.Dither(), (GenAction) new Modifiers.OnlyTiles(new ushort[1]
|
||||
{
|
||||
(ushort) 60
|
||||
}), (GenAction) new Modifiers.Offset(0, 1), (GenAction) new ActionVines(3, room.Height, 62)));
|
||||
WorldUtils.Gen(new Point(room.X, room.Y), (GenShape) new Shapes.Rectangle(room.Width, room.Height), Actions.Chain((GenAction) new Modifiers.Dither(0.850000023841858), (GenAction) new Modifiers.Blotches(), (GenAction) new Actions.PlaceWall((byte) 64)));
|
||||
}
|
||||
|
||||
private class BuildData
|
||||
{
|
||||
public static CaveHouseBiome.BuildData Snow = CaveHouseBiome.BuildData.CreateSnowData();
|
||||
public static CaveHouseBiome.BuildData Jungle = CaveHouseBiome.BuildData.CreateJungleData();
|
||||
public static CaveHouseBiome.BuildData Default = CaveHouseBiome.BuildData.CreateDefaultData();
|
||||
public static CaveHouseBiome.BuildData Granite = CaveHouseBiome.BuildData.CreateGraniteData();
|
||||
public static CaveHouseBiome.BuildData Marble = CaveHouseBiome.BuildData.CreateMarbleData();
|
||||
public static CaveHouseBiome.BuildData Mushroom = CaveHouseBiome.BuildData.CreateMushroomData();
|
||||
public static CaveHouseBiome.BuildData Desert = CaveHouseBiome.BuildData.CreateDesertData();
|
||||
public ushort Tile;
|
||||
public byte Wall;
|
||||
public int PlatformStyle;
|
||||
public int DoorStyle;
|
||||
public int TableStyle;
|
||||
public int WorkbenchStyle;
|
||||
public int PianoStyle;
|
||||
public int BookcaseStyle;
|
||||
public int ChairStyle;
|
||||
public int ChestStyle;
|
||||
public CaveHouseBiome.BuildData.ProcessRoomMethod ProcessRoom;
|
||||
|
||||
public static CaveHouseBiome.BuildData CreateSnowData() => new CaveHouseBiome.BuildData()
|
||||
{
|
||||
Tile = 321,
|
||||
Wall = 149,
|
||||
DoorStyle = 30,
|
||||
PlatformStyle = 19,
|
||||
TableStyle = 28,
|
||||
WorkbenchStyle = 23,
|
||||
PianoStyle = 23,
|
||||
BookcaseStyle = 25,
|
||||
ChairStyle = 30,
|
||||
ChestStyle = 11,
|
||||
ProcessRoom = new CaveHouseBiome.BuildData.ProcessRoomMethod(CaveHouseBiome.AgeSnowRoom)
|
||||
};
|
||||
|
||||
public static CaveHouseBiome.BuildData CreateDesertData() => new CaveHouseBiome.BuildData()
|
||||
{
|
||||
Tile = 396,
|
||||
Wall = 187,
|
||||
PlatformStyle = 0,
|
||||
DoorStyle = 0,
|
||||
TableStyle = 0,
|
||||
WorkbenchStyle = 0,
|
||||
PianoStyle = 0,
|
||||
BookcaseStyle = 0,
|
||||
ChairStyle = 0,
|
||||
ChestStyle = 1,
|
||||
ProcessRoom = new CaveHouseBiome.BuildData.ProcessRoomMethod(CaveHouseBiome.AgeDesertRoom)
|
||||
};
|
||||
|
||||
public static CaveHouseBiome.BuildData CreateJungleData() => new CaveHouseBiome.BuildData()
|
||||
{
|
||||
Tile = 158,
|
||||
Wall = 42,
|
||||
PlatformStyle = 2,
|
||||
DoorStyle = 2,
|
||||
TableStyle = 2,
|
||||
WorkbenchStyle = 2,
|
||||
PianoStyle = 2,
|
||||
BookcaseStyle = 12,
|
||||
ChairStyle = 3,
|
||||
ChestStyle = 8,
|
||||
ProcessRoom = new CaveHouseBiome.BuildData.ProcessRoomMethod(CaveHouseBiome.AgeJungleRoom)
|
||||
};
|
||||
|
||||
public static CaveHouseBiome.BuildData CreateGraniteData() => new CaveHouseBiome.BuildData()
|
||||
{
|
||||
Tile = 369,
|
||||
Wall = 181,
|
||||
PlatformStyle = 28,
|
||||
DoorStyle = 34,
|
||||
TableStyle = 33,
|
||||
WorkbenchStyle = 29,
|
||||
PianoStyle = 28,
|
||||
BookcaseStyle = 30,
|
||||
ChairStyle = 34,
|
||||
ChestStyle = 50,
|
||||
ProcessRoom = new CaveHouseBiome.BuildData.ProcessRoomMethod(CaveHouseBiome.AgeGraniteRoom)
|
||||
};
|
||||
|
||||
public static CaveHouseBiome.BuildData CreateMarbleData() => new CaveHouseBiome.BuildData()
|
||||
{
|
||||
Tile = 357,
|
||||
Wall = 179,
|
||||
PlatformStyle = 29,
|
||||
DoorStyle = 35,
|
||||
TableStyle = 34,
|
||||
WorkbenchStyle = 30,
|
||||
PianoStyle = 29,
|
||||
BookcaseStyle = 31,
|
||||
ChairStyle = 35,
|
||||
ChestStyle = 51,
|
||||
ProcessRoom = new CaveHouseBiome.BuildData.ProcessRoomMethod(CaveHouseBiome.AgeMarbleRoom)
|
||||
};
|
||||
|
||||
public static CaveHouseBiome.BuildData CreateMushroomData() => new CaveHouseBiome.BuildData()
|
||||
{
|
||||
Tile = 190,
|
||||
Wall = 74,
|
||||
PlatformStyle = 18,
|
||||
DoorStyle = 6,
|
||||
TableStyle = 27,
|
||||
WorkbenchStyle = 7,
|
||||
PianoStyle = 22,
|
||||
BookcaseStyle = 24,
|
||||
ChairStyle = 9,
|
||||
ChestStyle = 32,
|
||||
ProcessRoom = new CaveHouseBiome.BuildData.ProcessRoomMethod(CaveHouseBiome.AgeMushroomRoom)
|
||||
};
|
||||
|
||||
public static CaveHouseBiome.BuildData CreateDefaultData() => new CaveHouseBiome.BuildData()
|
||||
{
|
||||
Tile = 30,
|
||||
Wall = 27,
|
||||
PlatformStyle = 0,
|
||||
DoorStyle = 0,
|
||||
TableStyle = 0,
|
||||
WorkbenchStyle = 0,
|
||||
PianoStyle = 0,
|
||||
BookcaseStyle = 0,
|
||||
ChairStyle = 0,
|
||||
ChestStyle = 1,
|
||||
ProcessRoom = new CaveHouseBiome.BuildData.ProcessRoomMethod(CaveHouseBiome.AgeDefaultRoom)
|
||||
};
|
||||
|
||||
public delegate void ProcessRoomMethod(Microsoft.Xna.Framework.Rectangle room);
|
||||
}
|
||||
}
|
||||
}
|
55
GameContent/Biomes/CorruptionPitBiome.cs
Normal file
55
GameContent/Biomes/CorruptionPitBiome.cs
Normal file
|
@ -0,0 +1,55 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.GameContent.Biomes.CorruptionPitBiome
|
||||
// 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 Terraria.ID;
|
||||
using Terraria.World.Generation;
|
||||
|
||||
namespace Terraria.GameContent.Biomes
|
||||
{
|
||||
public class CorruptionPitBiome : MicroBiome
|
||||
{
|
||||
public static bool[] ValidTiles = TileID.Sets.Factory.CreateBoolSet(true, 21, 31, 26);
|
||||
|
||||
public override bool Place(Point origin, StructureMap structures)
|
||||
{
|
||||
if (WorldGen.SolidTile(origin.X, origin.Y) && GenBase._tiles[origin.X, origin.Y].wall == (byte) 3)
|
||||
return false;
|
||||
if (!WorldUtils.Find(origin, Searches.Chain((GenSearch) new Searches.Down(100), (GenCondition) new Conditions.IsSolid()), out origin))
|
||||
return false;
|
||||
if (!WorldUtils.Find(new Point(origin.X - 4, origin.Y), Searches.Chain((GenSearch) new Searches.Down(5), new Conditions.IsTile(new ushort[1]
|
||||
{
|
||||
(ushort) 25
|
||||
}).AreaAnd(8, 1)), out Point _))
|
||||
return false;
|
||||
ShapeData data1 = new ShapeData();
|
||||
ShapeData shapeData1 = new ShapeData();
|
||||
ShapeData shapeData2 = new ShapeData();
|
||||
for (int index = 0; index < 6; ++index)
|
||||
WorldUtils.Gen(origin, (GenShape) new Shapes.Circle(GenBase._random.Next(10, 12) + index), Actions.Chain((GenAction) new Modifiers.Offset(0, 5 * index + 5), new Modifiers.Blotches(3).Output(data1)));
|
||||
for (int index = 0; index < 6; ++index)
|
||||
WorldUtils.Gen(origin, (GenShape) new Shapes.Circle(GenBase._random.Next(5, 7) + index), Actions.Chain((GenAction) new Modifiers.Offset(0, 2 * index + 18), new Modifiers.Blotches(3).Output(shapeData1)));
|
||||
for (int index = 0; index < 6; ++index)
|
||||
WorldUtils.Gen(origin, (GenShape) new Shapes.Circle(GenBase._random.Next(4, 6) + index / 2), Actions.Chain((GenAction) new Modifiers.Offset(0, (int) (7.5 * (double) index) - 10), new Modifiers.Blotches(3).Output(shapeData2)));
|
||||
ShapeData data2 = new ShapeData(shapeData1);
|
||||
shapeData1.Subtract(shapeData2, origin, origin);
|
||||
data2.Subtract(shapeData1, origin, origin);
|
||||
Microsoft.Xna.Framework.Rectangle bounds = ShapeData.GetBounds(origin, data1, shapeData2);
|
||||
if (!structures.CanPlace(bounds, CorruptionPitBiome.ValidTiles, 2))
|
||||
return false;
|
||||
WorldUtils.Gen(origin, (GenShape) new ModShapes.All(data1), Actions.Chain((GenAction) new Actions.SetTile((ushort) 25, true), (GenAction) new Actions.PlaceWall((byte) 3)));
|
||||
WorldUtils.Gen(origin, (GenShape) new ModShapes.All(shapeData1), (GenAction) new Actions.SetTile((ushort) 0, true));
|
||||
WorldUtils.Gen(origin, (GenShape) new ModShapes.All(shapeData2), (GenAction) new Actions.ClearTile(true));
|
||||
WorldUtils.Gen(origin, (GenShape) new ModShapes.All(shapeData1), Actions.Chain((GenAction) new Modifiers.IsTouchingAir(true), (GenAction) new Modifiers.NotTouching(false, new ushort[1]
|
||||
{
|
||||
(ushort) 25
|
||||
}), (GenAction) new Actions.SetTile((ushort) 23, true)));
|
||||
WorldUtils.Gen(origin, (GenShape) new ModShapes.All(data2), (GenAction) new Actions.PlaceWall((byte) 69));
|
||||
structures.AddStructure(bounds, 2);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
460
GameContent/Biomes/DesertBiome.cs
Normal file
460
GameContent/Biomes/DesertBiome.cs
Normal file
|
@ -0,0 +1,460 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.GameContent.Biomes.DesertBiome
|
||||
// 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 System;
|
||||
using System.Collections.Generic;
|
||||
using Terraria.World.Generation;
|
||||
|
||||
namespace Terraria.GameContent.Biomes
|
||||
{
|
||||
public class DesertBiome : MicroBiome
|
||||
{
|
||||
private void PlaceSand(DesertBiome.ClusterGroup clusters, Point start, Vector2 scale)
|
||||
{
|
||||
int num1 = (int) ((double) scale.X * (double) clusters.Width);
|
||||
int num2 = (int) ((double) scale.Y * (double) clusters.Height);
|
||||
int num3 = 5;
|
||||
int val1 = start.Y + (num2 >> 1);
|
||||
float num4 = 0.0f;
|
||||
short[] numArray = new short[num1 + num3 * 2];
|
||||
for (int index = -num3; index < num1 + num3; ++index)
|
||||
{
|
||||
for (int y = 150; y < val1; ++y)
|
||||
{
|
||||
if (WorldGen.SolidOrSlopedTile(index + start.X, y))
|
||||
{
|
||||
num4 += (float) (y - 1);
|
||||
numArray[index + num3] = (short) (y - 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
float num5 = num4 / (float) (num1 + num3 * 2);
|
||||
int num6 = 0;
|
||||
for (int index1 = -num3; index1 < num1 + num3; ++index1)
|
||||
{
|
||||
float num7 = MathHelper.Clamp((float) ((double) Math.Abs((float) (index1 + num3) / (float) (num1 + num3 * 2)) * 2.0 - 1.0), -1f, 1f);
|
||||
if (index1 % 3 == 0)
|
||||
num6 = Utils.Clamp<int>(num6 + GenBase._random.Next(-1, 2), -10, 10);
|
||||
float num8 = (float) Math.Sqrt(1.0 - (double) num7 * (double) num7 * (double) num7 * (double) num7);
|
||||
int val2_1 = val1 - (int) ((double) num8 * (double) ((float) val1 - num5)) + num6;
|
||||
int val2_2 = val1 - (int) ((double) ((float) val1 - num5) * ((double) num8 - 0.150000005960464 / Math.Sqrt(Math.Max(0.01, (double) Math.Abs(8f * num7) - 0.1)) + 0.25));
|
||||
int num9 = Math.Min(val1, val2_2);
|
||||
if ((double) Math.Abs(num7) < 0.800000011920929)
|
||||
{
|
||||
float num10 = Utils.SmoothStep(0.5f, 0.8f, Math.Abs(num7));
|
||||
float num11 = num10 * num10 * num10;
|
||||
int num12 = Math.Min(10 + (int) ((double) num5 - (double) num11 * 20.0) + num6, val2_1);
|
||||
int num13 = 50;
|
||||
for (int index2 = num13; (double) index2 < (double) num5; ++index2)
|
||||
{
|
||||
int index3 = index1 + start.X;
|
||||
if (GenBase._tiles[index3, index2].active() && (GenBase._tiles[index3, index2].type == (ushort) 189 || GenBase._tiles[index3, index2].type == (ushort) 196))
|
||||
num13 = index2 + 5;
|
||||
}
|
||||
for (int index4 = num13; index4 < num12; ++index4)
|
||||
{
|
||||
int index5 = index1 + start.X;
|
||||
int index6 = index4;
|
||||
GenBase._tiles[index5, index6].active(false);
|
||||
GenBase._tiles[index5, index6].wall = (byte) 0;
|
||||
}
|
||||
numArray[index1 + num3] = (short) num12;
|
||||
}
|
||||
for (int index7 = val1 - 1; index7 >= val2_1; --index7)
|
||||
{
|
||||
int i = index1 + start.X;
|
||||
int j = index7;
|
||||
Tile tile1 = GenBase._tiles[i, j];
|
||||
tile1.liquid = (byte) 0;
|
||||
Tile tile2 = GenBase._tiles[i, j + 1];
|
||||
Tile tile3 = GenBase._tiles[i, j + 2];
|
||||
tile1.type = !WorldGen.SolidTile(tile2) || !WorldGen.SolidTile(tile3) ? (ushort) 397 : (ushort) 53;
|
||||
if (index7 > val2_1 + 5)
|
||||
tile1.wall = (byte) 187;
|
||||
tile1.active(true);
|
||||
if (tile1.wall != (byte) 187)
|
||||
tile1.wall = (byte) 0;
|
||||
if (index7 < num9)
|
||||
{
|
||||
if (index7 > val2_1 + 5)
|
||||
tile1.wall = (byte) 187;
|
||||
tile1.active(false);
|
||||
}
|
||||
WorldGen.SquareWallFrame(i, j);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void PlaceClusters(DesertBiome.ClusterGroup clusters, Point start, Vector2 scale)
|
||||
{
|
||||
int num1 = (int) ((double) scale.X * (double) clusters.Width);
|
||||
int num2 = (int) ((double) scale.Y * (double) clusters.Height);
|
||||
Vector2 vector2_1 = new Vector2((float) num1, (float) num2);
|
||||
Vector2 vector2_2 = new Vector2((float) clusters.Width, (float) clusters.Height);
|
||||
for (int index1 = -20; index1 < num1 + 20; ++index1)
|
||||
{
|
||||
for (int index2 = -20; index2 < num2 + 20; ++index2)
|
||||
{
|
||||
float num3 = 0.0f;
|
||||
int num4 = -1;
|
||||
float num5 = 0.0f;
|
||||
int x = index1 + start.X;
|
||||
int y = index2 + start.Y;
|
||||
Vector2 vector2_3 = new Vector2((float) index1, (float) index2) / vector2_1 * vector2_2;
|
||||
float num6 = (new Vector2((float) index1, (float) index2) / vector2_1 * 2f - Vector2.One).Length();
|
||||
for (int index3 = 0; index3 < clusters.Count; ++index3)
|
||||
{
|
||||
DesertBiome.Cluster cluster = clusters[index3];
|
||||
if ((double) Math.Abs(cluster[0].Position.X - vector2_3.X) <= 10.0 && (double) Math.Abs(cluster[0].Position.Y - vector2_3.Y) <= 10.0)
|
||||
{
|
||||
float num7 = 0.0f;
|
||||
foreach (DesertBiome.Hub hub in (List<DesertBiome.Hub>) cluster)
|
||||
num7 += 1f / Vector2.DistanceSquared(hub.Position, vector2_3);
|
||||
if ((double) num7 > (double) num3)
|
||||
{
|
||||
if ((double) num3 > (double) num5)
|
||||
num5 = num3;
|
||||
num3 = num7;
|
||||
num4 = index3;
|
||||
}
|
||||
else if ((double) num7 > (double) num5)
|
||||
num5 = num7;
|
||||
}
|
||||
}
|
||||
float num8 = num3 + num5;
|
||||
Tile tile = GenBase._tiles[x, y];
|
||||
bool flag = (double) num6 >= 0.800000011920929;
|
||||
if ((double) num8 > 3.5)
|
||||
{
|
||||
tile.ClearEverything();
|
||||
tile.wall = (byte) 187;
|
||||
tile.liquid = (byte) 0;
|
||||
if (num4 % 15 == 2)
|
||||
{
|
||||
tile.ResetToType((ushort) 404);
|
||||
tile.wall = (byte) 187;
|
||||
tile.active(true);
|
||||
}
|
||||
Tile.SmoothSlope(x, y);
|
||||
}
|
||||
else if ((double) num8 > 1.79999995231628)
|
||||
{
|
||||
tile.wall = (byte) 187;
|
||||
if (!flag || tile.active())
|
||||
{
|
||||
tile.ResetToType((ushort) 396);
|
||||
tile.wall = (byte) 187;
|
||||
tile.active(true);
|
||||
Tile.SmoothSlope(x, y);
|
||||
}
|
||||
tile.liquid = (byte) 0;
|
||||
}
|
||||
else if ((double) num8 > 0.699999988079071 || !flag)
|
||||
{
|
||||
if (!flag || tile.active())
|
||||
{
|
||||
tile.ResetToType((ushort) 397);
|
||||
tile.active(true);
|
||||
Tile.SmoothSlope(x, y);
|
||||
}
|
||||
tile.liquid = (byte) 0;
|
||||
tile.wall = (byte) 216;
|
||||
}
|
||||
else if ((double) num8 > 0.25)
|
||||
{
|
||||
float num9 = (float) (((double) num8 - 0.25) / 0.449999988079071);
|
||||
if ((double) GenBase._random.NextFloat() < (double) num9)
|
||||
{
|
||||
if (tile.active())
|
||||
{
|
||||
tile.ResetToType((ushort) 397);
|
||||
tile.active(true);
|
||||
Tile.SmoothSlope(x, y);
|
||||
tile.wall = (byte) 216;
|
||||
}
|
||||
tile.liquid = (byte) 0;
|
||||
tile.wall = (byte) 187;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void AddTileVariance(DesertBiome.ClusterGroup clusters, Point start, Vector2 scale)
|
||||
{
|
||||
int num1 = (int) ((double) scale.X * (double) clusters.Width);
|
||||
int num2 = (int) ((double) scale.Y * (double) clusters.Height);
|
||||
for (int index1 = -20; index1 < num1 + 20; ++index1)
|
||||
{
|
||||
for (int index2 = -20; index2 < num2 + 20; ++index2)
|
||||
{
|
||||
int index3 = index1 + start.X;
|
||||
int index4 = index2 + start.Y;
|
||||
Tile tile1 = GenBase._tiles[index3, index4];
|
||||
Tile tile2 = GenBase._tiles[index3, index4 + 1];
|
||||
Tile tile3 = GenBase._tiles[index3, index4 + 2];
|
||||
if (tile1.type == (ushort) 53 && (!WorldGen.SolidTile(tile2) || !WorldGen.SolidTile(tile3)))
|
||||
tile1.type = (ushort) 397;
|
||||
}
|
||||
}
|
||||
for (int index5 = -20; index5 < num1 + 20; ++index5)
|
||||
{
|
||||
for (int index6 = -20; index6 < num2 + 20; ++index6)
|
||||
{
|
||||
int i = index5 + start.X;
|
||||
int index7 = index6 + start.Y;
|
||||
Tile tile = GenBase._tiles[i, index7];
|
||||
if (tile.active() && tile.type == (ushort) 396)
|
||||
{
|
||||
bool flag1 = true;
|
||||
for (int index8 = -1; index8 >= -3; --index8)
|
||||
{
|
||||
if (GenBase._tiles[i, index7 + index8].active())
|
||||
{
|
||||
flag1 = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
bool flag2 = true;
|
||||
for (int index9 = 1; index9 <= 3; ++index9)
|
||||
{
|
||||
if (GenBase._tiles[i, index7 + index9].active())
|
||||
{
|
||||
flag2 = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (flag1 ^ flag2 && GenBase._random.Next(5) == 0)
|
||||
WorldGen.PlaceTile(i, index7 + (flag1 ? -1 : 1), 165, true, true);
|
||||
else if (flag1 && GenBase._random.Next(5) == 0)
|
||||
WorldGen.PlaceTile(i, index7 - 1, 187, true, true, style: (29 + GenBase._random.Next(6)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private bool FindStart(
|
||||
Point origin,
|
||||
Vector2 scale,
|
||||
int xHubCount,
|
||||
int yHubCount,
|
||||
out Point start)
|
||||
{
|
||||
start = new Point(0, 0);
|
||||
int width = (int) ((double) scale.X * (double) xHubCount);
|
||||
int height = (int) ((double) scale.Y * (double) yHubCount);
|
||||
origin.X -= width >> 1;
|
||||
int y = 220;
|
||||
label_10:
|
||||
for (int index = -20; index < width + 20; ++index)
|
||||
{
|
||||
for (int j = 220; j < Main.maxTilesY; ++j)
|
||||
{
|
||||
if (WorldGen.SolidTile(index + origin.X, j))
|
||||
{
|
||||
switch (GenBase._tiles[index + origin.X, j].type)
|
||||
{
|
||||
case 59:
|
||||
case 60:
|
||||
return false;
|
||||
default:
|
||||
if (j > y)
|
||||
{
|
||||
y = j;
|
||||
goto label_10;
|
||||
}
|
||||
else
|
||||
goto label_10;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
WorldGen.UndergroundDesertLocation = new Microsoft.Xna.Framework.Rectangle(origin.X, y, width, height);
|
||||
start = new Point(origin.X, y);
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool Place(Point origin, StructureMap structures)
|
||||
{
|
||||
float num1 = (float) Main.maxTilesX / 4200f;
|
||||
int num2 = (int) (80.0 * (double) num1);
|
||||
int num3 = (int) (((double) GenBase._random.NextFloat() + 1.0) * 80.0 * (double) num1);
|
||||
Vector2 scale = new Vector2(4f, 2f);
|
||||
Point start;
|
||||
if (!this.FindStart(origin, scale, num2, num3, out start))
|
||||
return false;
|
||||
DesertBiome.ClusterGroup clusters = new DesertBiome.ClusterGroup();
|
||||
clusters.Generate(num2, num3);
|
||||
this.PlaceSand(clusters, start, scale);
|
||||
this.PlaceClusters(clusters, start, scale);
|
||||
this.AddTileVariance(clusters, start, scale);
|
||||
int num4 = (int) ((double) scale.X * (double) clusters.Width);
|
||||
int num5 = (int) ((double) scale.Y * (double) clusters.Height);
|
||||
for (int index1 = -20; index1 < num4 + 20; ++index1)
|
||||
{
|
||||
for (int index2 = -20; index2 < num5 + 20; ++index2)
|
||||
{
|
||||
if (index1 + start.X > 0 && index1 + start.X < Main.maxTilesX - 1 && index2 + start.Y > 0 && index2 + start.Y < Main.maxTilesY - 1)
|
||||
{
|
||||
WorldGen.SquareWallFrame(index1 + start.X, index2 + start.Y);
|
||||
WorldUtils.TileFrame(index1 + start.X, index2 + start.Y, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private struct Hub
|
||||
{
|
||||
public Vector2 Position;
|
||||
|
||||
public Hub(Vector2 position) => this.Position = position;
|
||||
|
||||
public Hub(float x, float y) => this.Position = new Vector2(x, y);
|
||||
}
|
||||
|
||||
private class Cluster : List<DesertBiome.Hub>
|
||||
{
|
||||
}
|
||||
|
||||
private class ClusterGroup : List<DesertBiome.Cluster>
|
||||
{
|
||||
public int Width;
|
||||
public int Height;
|
||||
|
||||
private void SearchForCluster(
|
||||
bool[,] hubMap,
|
||||
List<Point> pointCluster,
|
||||
int x,
|
||||
int y,
|
||||
int level = 2)
|
||||
{
|
||||
pointCluster.Add(new Point(x, y));
|
||||
hubMap[x, y] = false;
|
||||
--level;
|
||||
if (level == -1)
|
||||
return;
|
||||
if (x > 0 && hubMap[x - 1, y])
|
||||
this.SearchForCluster(hubMap, pointCluster, x - 1, y, level);
|
||||
if (x < hubMap.GetLength(0) - 1 && hubMap[x + 1, y])
|
||||
this.SearchForCluster(hubMap, pointCluster, x + 1, y, level);
|
||||
if (y > 0 && hubMap[x, y - 1])
|
||||
this.SearchForCluster(hubMap, pointCluster, x, y - 1, level);
|
||||
if (y >= hubMap.GetLength(1) - 1 || !hubMap[x, y + 1])
|
||||
return;
|
||||
this.SearchForCluster(hubMap, pointCluster, x, y + 1, level);
|
||||
}
|
||||
|
||||
private void AttemptClaim(
|
||||
int x,
|
||||
int y,
|
||||
int[,] clusterIndexMap,
|
||||
List<List<Point>> pointClusters,
|
||||
int index)
|
||||
{
|
||||
int clusterIndex = clusterIndexMap[x, y];
|
||||
if (clusterIndex == -1 || clusterIndex == index)
|
||||
return;
|
||||
int num = WorldGen.genRand.Next(2) == 0 ? -1 : index;
|
||||
foreach (Point point in pointClusters[clusterIndex])
|
||||
clusterIndexMap[point.X, point.Y] = num;
|
||||
}
|
||||
|
||||
public void Generate(int width, int height)
|
||||
{
|
||||
this.Width = width;
|
||||
this.Height = height;
|
||||
this.Clear();
|
||||
bool[,] hubMap = new bool[width, height];
|
||||
int num1 = (width >> 1) - 1;
|
||||
int y1 = (height >> 1) - 1;
|
||||
int num2 = (num1 + 1) * (num1 + 1);
|
||||
Point point1 = new Point(num1, y1);
|
||||
for (int index1 = point1.Y - y1; index1 <= point1.Y + y1; ++index1)
|
||||
{
|
||||
float num3 = (float) num1 / (float) y1 * (float) (index1 - point1.Y);
|
||||
int num4 = Math.Min(num1, (int) Math.Sqrt((double) num2 - (double) num3 * (double) num3));
|
||||
for (int index2 = point1.X - num4; index2 <= point1.X + num4; ++index2)
|
||||
hubMap[index2, index1] = WorldGen.genRand.Next(2) == 0;
|
||||
}
|
||||
List<List<Point>> pointClusters = new List<List<Point>>();
|
||||
for (int x = 0; x < hubMap.GetLength(0); ++x)
|
||||
{
|
||||
for (int y2 = 0; y2 < hubMap.GetLength(1); ++y2)
|
||||
{
|
||||
if (hubMap[x, y2] && WorldGen.genRand.Next(2) == 0)
|
||||
{
|
||||
List<Point> pointCluster = new List<Point>();
|
||||
this.SearchForCluster(hubMap, pointCluster, x, y2);
|
||||
if (pointCluster.Count > 2)
|
||||
pointClusters.Add(pointCluster);
|
||||
}
|
||||
}
|
||||
}
|
||||
int[,] clusterIndexMap = new int[hubMap.GetLength(0), hubMap.GetLength(1)];
|
||||
for (int index3 = 0; index3 < clusterIndexMap.GetLength(0); ++index3)
|
||||
{
|
||||
for (int index4 = 0; index4 < clusterIndexMap.GetLength(1); ++index4)
|
||||
clusterIndexMap[index3, index4] = -1;
|
||||
}
|
||||
for (int index = 0; index < pointClusters.Count; ++index)
|
||||
{
|
||||
foreach (Point point2 in pointClusters[index])
|
||||
clusterIndexMap[point2.X, point2.Y] = index;
|
||||
}
|
||||
for (int index5 = 0; index5 < pointClusters.Count; ++index5)
|
||||
{
|
||||
foreach (Point point3 in pointClusters[index5])
|
||||
{
|
||||
int x = point3.X;
|
||||
int y3 = point3.Y;
|
||||
if (clusterIndexMap[x, y3] != -1)
|
||||
{
|
||||
int index6 = clusterIndexMap[x, y3];
|
||||
if (x > 0)
|
||||
this.AttemptClaim(x - 1, y3, clusterIndexMap, pointClusters, index6);
|
||||
if (x < clusterIndexMap.GetLength(0) - 1)
|
||||
this.AttemptClaim(x + 1, y3, clusterIndexMap, pointClusters, index6);
|
||||
if (y3 > 0)
|
||||
this.AttemptClaim(x, y3 - 1, clusterIndexMap, pointClusters, index6);
|
||||
if (y3 < clusterIndexMap.GetLength(1) - 1)
|
||||
this.AttemptClaim(x, y3 + 1, clusterIndexMap, pointClusters, index6);
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
}
|
||||
foreach (List<Point> pointList in pointClusters)
|
||||
pointList.Clear();
|
||||
for (int x = 0; x < clusterIndexMap.GetLength(0); ++x)
|
||||
{
|
||||
for (int y4 = 0; y4 < clusterIndexMap.GetLength(1); ++y4)
|
||||
{
|
||||
if (clusterIndexMap[x, y4] != -1)
|
||||
pointClusters[clusterIndexMap[x, y4]].Add(new Point(x, y4));
|
||||
}
|
||||
}
|
||||
foreach (List<Point> pointList in pointClusters)
|
||||
{
|
||||
if (pointList.Count < 4)
|
||||
pointList.Clear();
|
||||
}
|
||||
foreach (List<Point> pointList in pointClusters)
|
||||
{
|
||||
DesertBiome.Cluster cluster = new DesertBiome.Cluster();
|
||||
if (pointList.Count > 0)
|
||||
{
|
||||
foreach (Point point4 in pointList)
|
||||
cluster.Add(new DesertBiome.Hub((float) point4.X + (float) (((double) WorldGen.genRand.NextFloat() - 0.5) * 0.5), (float) point4.Y + (float) (((double) WorldGen.genRand.NextFloat() - 0.5) * 0.5)));
|
||||
this.Add(cluster);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
68
GameContent/Biomes/EnchantedSwordBiome.cs
Normal file
68
GameContent/Biomes/EnchantedSwordBiome.cs
Normal file
|
@ -0,0 +1,68 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.GameContent.Biomes.EnchantedSwordBiome
|
||||
// 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 System.Collections.Generic;
|
||||
using Terraria.GameContent.Generation;
|
||||
using Terraria.World.Generation;
|
||||
|
||||
namespace Terraria.GameContent.Biomes
|
||||
{
|
||||
public class EnchantedSwordBiome : MicroBiome
|
||||
{
|
||||
public override bool Place(Point origin, StructureMap structures)
|
||||
{
|
||||
Dictionary<ushort, int> resultsOutput = new Dictionary<ushort, int>();
|
||||
WorldUtils.Gen(new Point(origin.X - 25, origin.Y - 25), (GenShape) new Shapes.Rectangle(50, 50), (GenAction) new Actions.TileScanner(new ushort[2]
|
||||
{
|
||||
(ushort) 0,
|
||||
(ushort) 1
|
||||
}).Output(resultsOutput));
|
||||
if (resultsOutput[(ushort) 0] + resultsOutput[(ushort) 1] < 1250)
|
||||
return false;
|
||||
Point result;
|
||||
bool flag = WorldUtils.Find(origin, Searches.Chain((GenSearch) new Searches.Up(1000), new Conditions.IsSolid().AreaOr(1, 50).Not()), out result);
|
||||
if (WorldUtils.Find(origin, Searches.Chain((GenSearch) new Searches.Up(origin.Y - result.Y), (GenCondition) new Conditions.IsTile(new ushort[1]
|
||||
{
|
||||
(ushort) 53
|
||||
})), out Point _) || !flag)
|
||||
return false;
|
||||
result.Y += 50;
|
||||
ShapeData data1 = new ShapeData();
|
||||
ShapeData shapeData = new ShapeData();
|
||||
Point point1 = new Point(origin.X, origin.Y + 20);
|
||||
Point point2 = new Point(origin.X, origin.Y + 30);
|
||||
float xScale = (float) (0.800000011920929 + (double) GenBase._random.NextFloat() * 0.5);
|
||||
if (!structures.CanPlace(new Microsoft.Xna.Framework.Rectangle(point1.X - (int) (20.0 * (double) xScale), point1.Y - 20, (int) (40.0 * (double) xScale), 40)) || !structures.CanPlace(new Microsoft.Xna.Framework.Rectangle(origin.X, result.Y + 10, 1, origin.Y - result.Y - 9), 2))
|
||||
return false;
|
||||
WorldUtils.Gen(point1, (GenShape) new Shapes.Slime(20, xScale, 1f), Actions.Chain((GenAction) new Modifiers.Blotches(chance: 0.4), new Actions.ClearTile(true).Output(data1)));
|
||||
WorldUtils.Gen(point2, (GenShape) new Shapes.Mound(14, 14), Actions.Chain((GenAction) new Modifiers.Blotches(2, 1, 0.8), (GenAction) new Actions.SetTile((ushort) 0), new Actions.SetFrames(true).Output(shapeData)));
|
||||
data1.Subtract(shapeData, point1, point2);
|
||||
WorldUtils.Gen(point1, (GenShape) new ModShapes.InnerOutline(data1), Actions.Chain((GenAction) new Actions.SetTile((ushort) 2), (GenAction) new Actions.SetFrames(true)));
|
||||
WorldUtils.Gen(point1, (GenShape) new ModShapes.All(data1), Actions.Chain((GenAction) new Modifiers.RectangleMask(-40, 40, 0, 40), (GenAction) new Modifiers.IsEmpty(), (GenAction) new Actions.SetLiquid()));
|
||||
WorldUtils.Gen(point1, (GenShape) new ModShapes.All(data1), Actions.Chain((GenAction) new Actions.PlaceWall((byte) 68), (GenAction) new Modifiers.OnlyTiles(new ushort[1]
|
||||
{
|
||||
(ushort) 2
|
||||
}), (GenAction) new Modifiers.Offset(0, 1), (GenAction) new ActionVines(3, 5)));
|
||||
ShapeData data2 = new ShapeData();
|
||||
WorldUtils.Gen(new Point(origin.X, result.Y + 10), (GenShape) new Shapes.Rectangle(1, origin.Y - result.Y - 9), Actions.Chain((GenAction) new Modifiers.Blotches(chance: 0.2), new Actions.ClearTile().Output(data2), (GenAction) new Modifiers.Expand(1), (GenAction) new Modifiers.OnlyTiles(new ushort[1]
|
||||
{
|
||||
(ushort) 53
|
||||
}), new Actions.SetTile((ushort) 397).Output(data2)));
|
||||
WorldUtils.Gen(new Point(origin.X, result.Y + 10), (GenShape) new ModShapes.All(data2), (GenAction) new Actions.SetFrames(true));
|
||||
if (GenBase._random.Next(3) == 0)
|
||||
WorldGen.PlaceTile(point2.X, point2.Y - 15, 187, true, style: 17);
|
||||
else
|
||||
WorldGen.PlaceTile(point2.X, point2.Y - 15, 186, true, style: 15);
|
||||
WorldUtils.Gen(point2, (GenShape) new ModShapes.All(shapeData), Actions.Chain((GenAction) new Modifiers.Offset(0, -1), (GenAction) new Modifiers.OnlyTiles(new ushort[1]
|
||||
{
|
||||
(ushort) 2
|
||||
}), (GenAction) new Modifiers.Offset(0, -1), (GenAction) new ActionGrass()));
|
||||
structures.AddStructure(new Microsoft.Xna.Framework.Rectangle(point1.X - (int) (20.0 * (double) xScale), point1.Y - 20, (int) (40.0 * (double) xScale), 40), 4);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
228
GameContent/Biomes/GraniteBiome.cs
Normal file
228
GameContent/Biomes/GraniteBiome.cs
Normal file
|
@ -0,0 +1,228 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.GameContent.Biomes.GraniteBiome
|
||||
// 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 System;
|
||||
using System.Collections.Generic;
|
||||
using Terraria.DataStructures;
|
||||
using Terraria.ID;
|
||||
using Terraria.World.Generation;
|
||||
|
||||
namespace Terraria.GameContent.Biomes
|
||||
{
|
||||
public class GraniteBiome : MicroBiome
|
||||
{
|
||||
private const int MAX_MAGMA_ITERATIONS = 300;
|
||||
private static GraniteBiome.Magma[,] _sourceMagmaMap = new GraniteBiome.Magma[200, 200];
|
||||
private static GraniteBiome.Magma[,] _targetMagmaMap = new GraniteBiome.Magma[200, 200];
|
||||
|
||||
public override bool Place(Point origin, StructureMap structures)
|
||||
{
|
||||
if (GenBase._tiles[origin.X, origin.Y].active())
|
||||
return false;
|
||||
int length1 = GraniteBiome._sourceMagmaMap.GetLength(0);
|
||||
int length2 = GraniteBiome._sourceMagmaMap.GetLength(1);
|
||||
int index1 = length1 / 2;
|
||||
int index2 = length2 / 2;
|
||||
origin.X -= index1;
|
||||
origin.Y -= index2;
|
||||
for (int index3 = 0; index3 < length1; ++index3)
|
||||
{
|
||||
for (int index4 = 0; index4 < length2; ++index4)
|
||||
{
|
||||
int i = index3 + origin.X;
|
||||
int j = index4 + origin.Y;
|
||||
GraniteBiome._sourceMagmaMap[index3, index4] = GraniteBiome.Magma.CreateEmpty(WorldGen.SolidTile(i, j) ? 4f : 1f);
|
||||
GraniteBiome._targetMagmaMap[index3, index4] = GraniteBiome._sourceMagmaMap[index3, index4];
|
||||
}
|
||||
}
|
||||
int max1 = index1;
|
||||
int min1 = index1;
|
||||
int max2 = index2;
|
||||
int min2 = index2;
|
||||
for (int index5 = 0; index5 < 300; ++index5)
|
||||
{
|
||||
for (int index6 = max1; index6 <= min1; ++index6)
|
||||
{
|
||||
for (int index7 = max2; index7 <= min2; ++index7)
|
||||
{
|
||||
GraniteBiome.Magma sourceMagma1 = GraniteBiome._sourceMagmaMap[index6, index7];
|
||||
if (sourceMagma1.IsActive)
|
||||
{
|
||||
float num1 = 0.0f;
|
||||
Vector2 zero = Vector2.Zero;
|
||||
for (int index8 = -1; index8 <= 1; ++index8)
|
||||
{
|
||||
for (int index9 = -1; index9 <= 1; ++index9)
|
||||
{
|
||||
if (index8 != 0 || index9 != 0)
|
||||
{
|
||||
Vector2 vector2 = new Vector2((float) index8, (float) index9);
|
||||
vector2.Normalize();
|
||||
GraniteBiome.Magma sourceMagma2 = GraniteBiome._sourceMagmaMap[index6 + index8, index7 + index9];
|
||||
if ((double) sourceMagma1.Pressure > 0.00999999977648258 && !sourceMagma2.IsActive)
|
||||
{
|
||||
if (index8 == -1)
|
||||
max1 = Utils.Clamp<int>(index6 + index8, 1, max1);
|
||||
else
|
||||
min1 = Utils.Clamp<int>(index6 + index8, min1, length1 - 2);
|
||||
if (index9 == -1)
|
||||
max2 = Utils.Clamp<int>(index7 + index9, 1, max2);
|
||||
else
|
||||
min2 = Utils.Clamp<int>(index7 + index9, min2, length2 - 2);
|
||||
GraniteBiome._targetMagmaMap[index6 + index8, index7 + index9] = sourceMagma2.ToFlow();
|
||||
}
|
||||
float pressure = sourceMagma2.Pressure;
|
||||
num1 += pressure;
|
||||
zero += pressure * vector2;
|
||||
}
|
||||
}
|
||||
}
|
||||
float num2 = num1 / 8f;
|
||||
if ((double) num2 > (double) sourceMagma1.Resistance)
|
||||
{
|
||||
float num3 = zero.Length() / 8f;
|
||||
float pressure = Math.Max(0.0f, (float) ((double) Math.Max(num2 - num3 - sourceMagma1.Pressure, 0.0f) + (double) num3 + (double) sourceMagma1.Pressure * 0.875) - sourceMagma1.Resistance);
|
||||
GraniteBiome._targetMagmaMap[index6, index7] = GraniteBiome.Magma.CreateFlow(pressure, Math.Max(0.0f, sourceMagma1.Resistance - pressure * 0.02f));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (index5 < 2)
|
||||
GraniteBiome._targetMagmaMap[index1, index2] = GraniteBiome.Magma.CreateFlow(25f);
|
||||
Utils.Swap<GraniteBiome.Magma[,]>(ref GraniteBiome._sourceMagmaMap, ref GraniteBiome._targetMagmaMap);
|
||||
}
|
||||
bool flag1 = origin.Y + index2 > WorldGen.lavaLine - 30;
|
||||
bool flag2 = false;
|
||||
for (int index10 = -50; index10 < 50 && !flag2; ++index10)
|
||||
{
|
||||
for (int index11 = -50; index11 < 50 && !flag2; ++index11)
|
||||
{
|
||||
if (GenBase._tiles[origin.X + index1 + index10, origin.Y + index2 + index11].active())
|
||||
{
|
||||
switch (GenBase._tiles[origin.X + index1 + index10, origin.Y + index2 + index11].type)
|
||||
{
|
||||
case 147:
|
||||
case 161:
|
||||
case 162:
|
||||
case 163:
|
||||
case 200:
|
||||
flag1 = false;
|
||||
flag2 = true;
|
||||
continue;
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int index12 = max1; index12 <= min1; ++index12)
|
||||
{
|
||||
for (int index13 = max2; index13 <= min2; ++index13)
|
||||
{
|
||||
GraniteBiome.Magma sourceMagma = GraniteBiome._sourceMagmaMap[index12, index13];
|
||||
if (sourceMagma.IsActive)
|
||||
{
|
||||
Tile tile = GenBase._tiles[origin.X + index12, origin.Y + index13];
|
||||
if ((double) Math.Max(1f - Math.Max(0.0f, (float) (Math.Sin((double) (origin.Y + index13) * 0.400000005960464) * 0.699999988079071 + 1.20000004768372) * (float) (0.200000002980232 + 0.5 / Math.Sqrt((double) Math.Max(0.0f, sourceMagma.Pressure - sourceMagma.Resistance)))), sourceMagma.Pressure / 15f) > 0.349999994039536 + (WorldGen.SolidTile(origin.X + index12, origin.Y + index13) ? 0.0 : 0.5))
|
||||
{
|
||||
if (TileID.Sets.Ore[(int) tile.type])
|
||||
tile.ResetToType(tile.type);
|
||||
else
|
||||
tile.ResetToType((ushort) 368);
|
||||
tile.wall = (byte) 180;
|
||||
}
|
||||
else if ((double) sourceMagma.Resistance < 0.00999999977648258)
|
||||
{
|
||||
WorldUtils.ClearTile(origin.X + index12, origin.Y + index13);
|
||||
tile.wall = (byte) 180;
|
||||
}
|
||||
if (tile.liquid > (byte) 0 & flag1)
|
||||
tile.liquidType(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
List<Point16> point16List = new List<Point16>();
|
||||
for (int index14 = max1; index14 <= min1; ++index14)
|
||||
{
|
||||
for (int index15 = max2; index15 <= min2; ++index15)
|
||||
{
|
||||
if (GraniteBiome._sourceMagmaMap[index14, index15].IsActive)
|
||||
{
|
||||
int num4 = 0;
|
||||
int num5 = index14 + origin.X;
|
||||
int num6 = index15 + origin.Y;
|
||||
if (WorldGen.SolidTile(num5, num6))
|
||||
{
|
||||
for (int index16 = -1; index16 <= 1; ++index16)
|
||||
{
|
||||
for (int index17 = -1; index17 <= 1; ++index17)
|
||||
{
|
||||
if (WorldGen.SolidTile(num5 + index16, num6 + index17))
|
||||
++num4;
|
||||
}
|
||||
}
|
||||
if (num4 < 3)
|
||||
point16List.Add(new Point16(num5, num6));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach (Point16 point16 in point16List)
|
||||
{
|
||||
int x = (int) point16.X;
|
||||
int y = (int) point16.Y;
|
||||
WorldUtils.ClearTile(x, y, true);
|
||||
GenBase._tiles[x, y].wall = (byte) 180;
|
||||
}
|
||||
point16List.Clear();
|
||||
for (int index18 = max1; index18 <= min1; ++index18)
|
||||
{
|
||||
for (int index19 = max2; index19 <= min2; ++index19)
|
||||
{
|
||||
GraniteBiome.Magma sourceMagma = GraniteBiome._sourceMagmaMap[index18, index19];
|
||||
int index20 = index18 + origin.X;
|
||||
int index21 = index19 + origin.Y;
|
||||
if (sourceMagma.IsActive)
|
||||
{
|
||||
WorldUtils.TileFrame(index20, index21);
|
||||
WorldGen.SquareWallFrame(index20, index21);
|
||||
if (GenBase._random.Next(8) == 0 && GenBase._tiles[index20, index21].active())
|
||||
{
|
||||
if (!GenBase._tiles[index20, index21 + 1].active())
|
||||
WorldGen.PlaceTight(index20, index21 + 1);
|
||||
if (!GenBase._tiles[index20, index21 - 1].active())
|
||||
WorldGen.PlaceTight(index20, index21 - 1);
|
||||
}
|
||||
if (GenBase._random.Next(2) == 0)
|
||||
Tile.SmoothSlope(index20, index21);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private struct Magma
|
||||
{
|
||||
public readonly float Pressure;
|
||||
public readonly float Resistance;
|
||||
public readonly bool IsActive;
|
||||
|
||||
private Magma(float pressure, float resistance, bool active)
|
||||
{
|
||||
this.Pressure = pressure;
|
||||
this.Resistance = resistance;
|
||||
this.IsActive = active;
|
||||
}
|
||||
|
||||
public GraniteBiome.Magma ToFlow() => new GraniteBiome.Magma(this.Pressure, this.Resistance, true);
|
||||
|
||||
public static GraniteBiome.Magma CreateFlow(float pressure, float resistance = 0.0f) => new GraniteBiome.Magma(pressure, resistance, true);
|
||||
|
||||
public static GraniteBiome.Magma CreateEmpty(float resistance = 0.0f) => new GraniteBiome.Magma(0.0f, resistance, false);
|
||||
}
|
||||
}
|
||||
}
|
161
GameContent/Biomes/HiveBiome.cs
Normal file
161
GameContent/Biomes/HiveBiome.cs
Normal file
|
@ -0,0 +1,161 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.GameContent.Biomes.HiveBiome
|
||||
// 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 System;
|
||||
using Terraria.World.Generation;
|
||||
|
||||
namespace Terraria.GameContent.Biomes
|
||||
{
|
||||
public class HiveBiome : MicroBiome
|
||||
{
|
||||
public override bool Place(Point origin, StructureMap structures)
|
||||
{
|
||||
Ref<int> count1 = new Ref<int>(0);
|
||||
Ref<int> count2 = new Ref<int>(0);
|
||||
Ref<int> count3 = new Ref<int>(0);
|
||||
Ref<int> count4 = new Ref<int>(0);
|
||||
WorldUtils.Gen(origin, (GenShape) new Shapes.Circle(15), Actions.Chain((GenAction) new Actions.Scanner(count3), (GenAction) new Modifiers.IsSolid(), (GenAction) new Actions.Scanner(count1), (GenAction) new Modifiers.OnlyTiles(new ushort[2]
|
||||
{
|
||||
(ushort) 60,
|
||||
(ushort) 59
|
||||
}), (GenAction) new Actions.Scanner(count2), (GenAction) new Modifiers.OnlyTiles(new ushort[1]
|
||||
{
|
||||
(ushort) 60
|
||||
}), (GenAction) new Actions.Scanner(count4)));
|
||||
if ((double) count2.Value / (double) count1.Value < 0.75 || count4.Value < 2 || !structures.CanPlace(new Microsoft.Xna.Framework.Rectangle(origin.X - 50, origin.Y - 50, 100, 100)))
|
||||
return false;
|
||||
int x1 = origin.X;
|
||||
int y1 = origin.Y;
|
||||
int num1 = 150;
|
||||
for (int index1 = x1 - num1; index1 < x1 + num1; index1 += 10)
|
||||
{
|
||||
if (index1 > 0 && index1 <= Main.maxTilesX - 1)
|
||||
{
|
||||
for (int index2 = y1 - num1; index2 < y1 + num1; index2 += 10)
|
||||
{
|
||||
if (index2 > 0 && index2 <= Main.maxTilesY - 1 && (Main.tile[index1, index2].active() && Main.tile[index1, index2].type == (ushort) 226 || Main.tile[index1, index2].wall == (byte) 87 || Main.tile[index1, index2].wall == (byte) 3 || Main.tile[index1, index2].wall == (byte) 83))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
int x2 = origin.X;
|
||||
int y2 = origin.Y;
|
||||
int index3 = 0;
|
||||
int[] numArray1 = new int[10];
|
||||
int[] numArray2 = new int[10];
|
||||
Vector2 vector2_1 = new Vector2((float) x2, (float) y2);
|
||||
Vector2 vector2_2 = vector2_1;
|
||||
int num2 = WorldGen.genRand.Next(2, 5);
|
||||
for (int index4 = 0; index4 < num2; ++index4)
|
||||
{
|
||||
int num3 = WorldGen.genRand.Next(2, 5);
|
||||
for (int index5 = 0; index5 < num3; ++index5)
|
||||
vector2_2 = WorldGen.Hive((int) vector2_1.X, (int) vector2_1.Y);
|
||||
vector2_1 = vector2_2;
|
||||
numArray1[index3] = (int) vector2_1.X;
|
||||
numArray2[index3] = (int) vector2_1.Y;
|
||||
++index3;
|
||||
}
|
||||
for (int index6 = 0; index6 < index3; ++index6)
|
||||
{
|
||||
int index7 = numArray1[index6];
|
||||
int index8 = numArray2[index6];
|
||||
bool flag = false;
|
||||
int num4 = 1;
|
||||
if (WorldGen.genRand.Next(2) == 0)
|
||||
num4 = -1;
|
||||
while (index7 > 10 && index7 < Main.maxTilesX - 10 && index8 > 10 && index8 < Main.maxTilesY - 10 && (!Main.tile[index7, index8].active() || !Main.tile[index7, index8 + 1].active() || !Main.tile[index7 + 1, index8].active() || !Main.tile[index7 + 1, index8 + 1].active()))
|
||||
{
|
||||
index7 += num4;
|
||||
if (Math.Abs(index7 - numArray1[index6]) > 50)
|
||||
{
|
||||
flag = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!flag)
|
||||
{
|
||||
int i = index7 + num4;
|
||||
for (int index9 = i - 1; index9 <= i + 2; ++index9)
|
||||
{
|
||||
for (int index10 = index8 - 1; index10 <= index8 + 2; ++index10)
|
||||
{
|
||||
if (index9 < 10 || index9 > Main.maxTilesX - 10)
|
||||
flag = true;
|
||||
else if (Main.tile[index9, index10].active() && Main.tile[index9, index10].type != (ushort) 225)
|
||||
{
|
||||
flag = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!flag)
|
||||
{
|
||||
for (int index11 = i - 1; index11 <= i + 2; ++index11)
|
||||
{
|
||||
for (int index12 = index8 - 1; index12 <= index8 + 2; ++index12)
|
||||
{
|
||||
if (index11 >= i && index11 <= i + 1 && index12 >= index8 && index12 <= index8 + 1)
|
||||
{
|
||||
Main.tile[index11, index12].active(false);
|
||||
Main.tile[index11, index12].liquid = byte.MaxValue;
|
||||
Main.tile[index11, index12].honey(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
Main.tile[index11, index12].active(true);
|
||||
Main.tile[index11, index12].type = (ushort) 225;
|
||||
}
|
||||
}
|
||||
}
|
||||
int num5 = num4 * -1;
|
||||
int j = index8 + 1;
|
||||
int num6 = 0;
|
||||
while ((num6 < 4 || WorldGen.SolidTile(i, j)) && i > 10 && i < Main.maxTilesX - 10)
|
||||
{
|
||||
++num6;
|
||||
i += num5;
|
||||
if (WorldGen.SolidTile(i, j))
|
||||
{
|
||||
WorldGen.PoundTile(i, j);
|
||||
if (!Main.tile[i, j + 1].active())
|
||||
{
|
||||
Main.tile[i, j + 1].active(true);
|
||||
Main.tile[i, j + 1].type = (ushort) 225;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
WorldGen.larvaX[WorldGen.numLarva] = Utils.Clamp<int>((int) vector2_1.X, 5, Main.maxTilesX - 5);
|
||||
WorldGen.larvaY[WorldGen.numLarva] = Utils.Clamp<int>((int) vector2_1.Y, 5, Main.maxTilesY - 5);
|
||||
++WorldGen.numLarva;
|
||||
int x3 = (int) vector2_1.X;
|
||||
int y3 = (int) vector2_1.Y;
|
||||
for (int index13 = x3 - 1; index13 <= x3 + 1 && index13 > 0 && index13 < Main.maxTilesX; ++index13)
|
||||
{
|
||||
for (int index14 = y3 - 2; index14 <= y3 + 1 && index14 > 0 && index14 < Main.maxTilesY; ++index14)
|
||||
{
|
||||
if (index14 != y3 + 1)
|
||||
{
|
||||
Main.tile[index13, index14].active(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
Main.tile[index13, index14].active(true);
|
||||
Main.tile[index13, index14].type = (ushort) 225;
|
||||
Main.tile[index13, index14].slope((byte) 0);
|
||||
Main.tile[index13, index14].halfBrick(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
structures.AddStructure(new Microsoft.Xna.Framework.Rectangle(origin.X - 50, origin.Y - 50, 100, 100), 5);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
34
GameContent/Biomes/HoneyPatchBiome.cs
Normal file
34
GameContent/Biomes/HoneyPatchBiome.cs
Normal file
|
@ -0,0 +1,34 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.GameContent.Biomes.HoneyPatchBiome
|
||||
// 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 Terraria.World.Generation;
|
||||
|
||||
namespace Terraria.GameContent.Biomes
|
||||
{
|
||||
public class HoneyPatchBiome : MicroBiome
|
||||
{
|
||||
public override bool Place(Point origin, StructureMap structures)
|
||||
{
|
||||
if (GenBase._tiles[origin.X, origin.Y].active() && WorldGen.SolidTile(origin.X, origin.Y))
|
||||
return false;
|
||||
Point result;
|
||||
if (!WorldUtils.Find(origin, Searches.Chain((GenSearch) new Searches.Down(80), (GenCondition) new Conditions.IsSolid()), out result))
|
||||
return false;
|
||||
result.Y += 2;
|
||||
Ref<int> count = new Ref<int>(0);
|
||||
WorldUtils.Gen(result, (GenShape) new Shapes.Circle(8), Actions.Chain((GenAction) new Modifiers.IsSolid(), (GenAction) new Actions.Scanner(count)));
|
||||
if (count.Value < 20 || !structures.CanPlace(new Microsoft.Xna.Framework.Rectangle(result.X - 8, result.Y - 8, 16, 16)))
|
||||
return false;
|
||||
WorldUtils.Gen(result, (GenShape) new Shapes.Circle(8), Actions.Chain((GenAction) new Modifiers.RadialDither(0.0f, 10f), (GenAction) new Modifiers.IsSolid(), (GenAction) new Actions.SetTile((ushort) 229, true)));
|
||||
ShapeData data = new ShapeData();
|
||||
WorldUtils.Gen(result, (GenShape) new Shapes.Circle(4, 3), Actions.Chain((GenAction) new Modifiers.Blotches(), (GenAction) new Modifiers.IsSolid(), (GenAction) new Actions.ClearTile(true), new Modifiers.RectangleMask(-6, 6, 0, 3).Output(data), (GenAction) new Actions.SetLiquid(2)));
|
||||
WorldUtils.Gen(new Point(result.X, result.Y + 1), (GenShape) new ModShapes.InnerOutline(data), Actions.Chain((GenAction) new Modifiers.IsEmpty(), (GenAction) new Modifiers.RectangleMask(-6, 6, 1, 3), (GenAction) new Actions.SetTile((ushort) 59, true)));
|
||||
structures.AddStructure(new Microsoft.Xna.Framework.Rectangle(result.X - 8, result.Y - 8, 16, 16));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
92
GameContent/Biomes/MahoganyTreeBiome.cs
Normal file
92
GameContent/Biomes/MahoganyTreeBiome.cs
Normal file
|
@ -0,0 +1,92 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.GameContent.Biomes.MahoganyTreeBiome
|
||||
// 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 System;
|
||||
using System.Collections.Generic;
|
||||
using Terraria.GameContent.Generation;
|
||||
using Terraria.World.Generation;
|
||||
|
||||
namespace Terraria.GameContent.Biomes
|
||||
{
|
||||
public class MahoganyTreeBiome : MicroBiome
|
||||
{
|
||||
public override bool Place(Point origin, StructureMap structures)
|
||||
{
|
||||
Point result1;
|
||||
if (!WorldUtils.Find(new Point(origin.X - 3, origin.Y), Searches.Chain((GenSearch) new Searches.Down(200), new Conditions.IsSolid().AreaAnd(6, 1)), out result1))
|
||||
return false;
|
||||
Point result2;
|
||||
if (!WorldUtils.Find(new Point(result1.X, result1.Y - 5), Searches.Chain((GenSearch) new Searches.Up(120), new Conditions.IsSolid().AreaOr(6, 1)), out result2) || result1.Y - 5 - result2.Y > 60 || result1.Y - result2.Y < 30 || !structures.CanPlace(new Microsoft.Xna.Framework.Rectangle(result1.X - 30, result1.Y - 60, 60, 90)))
|
||||
return false;
|
||||
Dictionary<ushort, int> resultsOutput = new Dictionary<ushort, int>();
|
||||
WorldUtils.Gen(new Point(result1.X - 25, result1.Y - 25), (GenShape) new Shapes.Rectangle(50, 50), (GenAction) new Actions.TileScanner(new ushort[4]
|
||||
{
|
||||
(ushort) 0,
|
||||
(ushort) 59,
|
||||
(ushort) 147,
|
||||
(ushort) 1
|
||||
}).Output(resultsOutput));
|
||||
int num1 = resultsOutput[(ushort) 0] + resultsOutput[(ushort) 1];
|
||||
int num2 = resultsOutput[(ushort) 59];
|
||||
if (resultsOutput[(ushort) 147] > num2 || num1 > num2 || num2 < 50)
|
||||
return false;
|
||||
int num3 = (result1.Y - result2.Y - 9) / 5;
|
||||
int num4 = num3 * 5;
|
||||
int num5 = 0;
|
||||
double num6 = GenBase._random.NextDouble() + 1.0;
|
||||
double num7 = GenBase._random.NextDouble() + 2.0;
|
||||
if (GenBase._random.Next(2) == 0)
|
||||
num7 = -num7;
|
||||
for (int index = 0; index < num3; ++index)
|
||||
{
|
||||
int num8 = (int) (Math.Sin((double) (index + 1) / 12.0 * num6 * 3.14159274101257) * num7);
|
||||
int num9 = num8 < num5 ? num8 - num5 : 0;
|
||||
WorldUtils.Gen(new Point(result1.X + num5 + num9, result1.Y - (index + 1) * 5), (GenShape) new Shapes.Rectangle(6 + Math.Abs(num8 - num5), 7), Actions.Chain((GenAction) new Actions.RemoveWall(), (GenAction) new Actions.SetTile((ushort) 383), (GenAction) new Actions.SetFrames()));
|
||||
WorldUtils.Gen(new Point(result1.X + num5 + num9 + 2, result1.Y - (index + 1) * 5), (GenShape) new Shapes.Rectangle(2 + Math.Abs(num8 - num5), 5), Actions.Chain((GenAction) new Actions.ClearTile(true), (GenAction) new Actions.PlaceWall((byte) 78)));
|
||||
WorldUtils.Gen(new Point(result1.X + num5 + 2, result1.Y - index * 5), (GenShape) new Shapes.Rectangle(2, 2), Actions.Chain((GenAction) new Actions.ClearTile(true), (GenAction) new Actions.PlaceWall((byte) 78)));
|
||||
num5 = num8;
|
||||
}
|
||||
int num10 = 6;
|
||||
if (num7 < 0.0)
|
||||
num10 = 0;
|
||||
List<Point> endpoints = new List<Point>();
|
||||
for (int index = 0; index < 2; ++index)
|
||||
{
|
||||
double num11 = ((double) index + 1.0) / 3.0;
|
||||
int num12 = num10 + (int) (Math.Sin((double) num3 * num11 / 12.0 * num6 * 3.14159274101257) * num7);
|
||||
double angle = GenBase._random.NextDouble() * 0.785398185253143 - 0.785398185253143 - 0.200000002980232;
|
||||
if (num10 == 0)
|
||||
angle -= 1.57079637050629;
|
||||
WorldUtils.Gen(new Point(result1.X + num12, result1.Y - (int) ((double) (num3 * 5) * num11)), (GenShape) new ShapeBranch(angle, (double) GenBase._random.Next(12, 16)).OutputEndpoints(endpoints), Actions.Chain((GenAction) new Actions.SetTile((ushort) 383), (GenAction) new Actions.SetFrames(true)));
|
||||
num10 = 6 - num10;
|
||||
}
|
||||
int num13 = (int) (Math.Sin((double) num3 / 12.0 * num6 * 3.14159274101257) * num7);
|
||||
WorldUtils.Gen(new Point(result1.X + 6 + num13, result1.Y - num4), (GenShape) new ShapeBranch(-0.685398185253143, (double) GenBase._random.Next(16, 22)).OutputEndpoints(endpoints), Actions.Chain((GenAction) new Actions.SetTile((ushort) 383), (GenAction) new Actions.SetFrames(true)));
|
||||
WorldUtils.Gen(new Point(result1.X + num13, result1.Y - num4), (GenShape) new ShapeBranch(-2.45619449615479, (double) GenBase._random.Next(16, 22)).OutputEndpoints(endpoints), Actions.Chain((GenAction) new Actions.SetTile((ushort) 383), (GenAction) new Actions.SetFrames(true)));
|
||||
foreach (Point origin1 in endpoints)
|
||||
{
|
||||
Shapes.Circle circle = new Shapes.Circle(4);
|
||||
GenAction action = Actions.Chain((GenAction) new Modifiers.Blotches(4, 2, 0.3), (GenAction) new Modifiers.SkipTiles(new ushort[1]
|
||||
{
|
||||
(ushort) 383
|
||||
}), (GenAction) new Modifiers.SkipWalls(new byte[1]
|
||||
{
|
||||
(byte) 78
|
||||
}), (GenAction) new Actions.SetTile((ushort) 384), (GenAction) new Actions.SetFrames(true));
|
||||
WorldUtils.Gen(origin1, (GenShape) circle, action);
|
||||
}
|
||||
for (int index = 0; index < 4; ++index)
|
||||
{
|
||||
float angle = (float) ((double) index / 3.0 * 2.0 + 0.570749998092651);
|
||||
WorldUtils.Gen(result1, (GenShape) new ShapeRoot(angle, (float) GenBase._random.Next(40, 60)), (GenAction) new Actions.SetTile((ushort) 383, true));
|
||||
}
|
||||
WorldGen.AddBuriedChest(result1.X + 3, result1.Y - 1, GenBase._random.Next(4) == 0 ? 0 : WorldGen.GetNextJungleChestItem(), Style: 10);
|
||||
structures.AddStructure(new Microsoft.Xna.Framework.Rectangle(result1.X - 30, result1.Y - 30, 60, 60));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
193
GameContent/Biomes/MarbleBiome.cs
Normal file
193
GameContent/Biomes/MarbleBiome.cs
Normal file
|
@ -0,0 +1,193 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.GameContent.Biomes.MarbleBiome
|
||||
// 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 System;
|
||||
using Terraria.ID;
|
||||
using Terraria.World.Generation;
|
||||
|
||||
namespace Terraria.GameContent.Biomes
|
||||
{
|
||||
public class MarbleBiome : MicroBiome
|
||||
{
|
||||
private const int SCALE = 3;
|
||||
private MarbleBiome.Slab[,] _slabs;
|
||||
|
||||
private void SmoothSlope(int x, int y)
|
||||
{
|
||||
MarbleBiome.Slab slab = this._slabs[x, y];
|
||||
if (!slab.IsSolid)
|
||||
return;
|
||||
int num = this._slabs[x, y - 1].IsSolid ? 1 : 0;
|
||||
bool isSolid1 = this._slabs[x, y + 1].IsSolid;
|
||||
bool isSolid2 = this._slabs[x - 1, y].IsSolid;
|
||||
bool isSolid3 = this._slabs[x + 1, y].IsSolid;
|
||||
switch ((num != 0 ? 1 : 0) << 3 | (isSolid1 ? 1 : 0) << 2 | (isSolid2 ? 1 : 0) << 1 | (isSolid3 ? 1 : 0))
|
||||
{
|
||||
case 4:
|
||||
this._slabs[x, y] = slab.WithState(new MarbleBiome.SlabState(MarbleBiome.SlabStates.HalfBrick));
|
||||
break;
|
||||
case 5:
|
||||
this._slabs[x, y] = slab.WithState(new MarbleBiome.SlabState(MarbleBiome.SlabStates.BottomRightFilled));
|
||||
break;
|
||||
case 6:
|
||||
this._slabs[x, y] = slab.WithState(new MarbleBiome.SlabState(MarbleBiome.SlabStates.BottomLeftFilled));
|
||||
break;
|
||||
case 9:
|
||||
this._slabs[x, y] = slab.WithState(new MarbleBiome.SlabState(MarbleBiome.SlabStates.TopRightFilled));
|
||||
break;
|
||||
case 10:
|
||||
this._slabs[x, y] = slab.WithState(new MarbleBiome.SlabState(MarbleBiome.SlabStates.TopLeftFilled));
|
||||
break;
|
||||
default:
|
||||
this._slabs[x, y] = slab.WithState(new MarbleBiome.SlabState(MarbleBiome.SlabStates.Solid));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void PlaceSlab(MarbleBiome.Slab slab, int originX, int originY, int scale)
|
||||
{
|
||||
for (int x = 0; x < scale; ++x)
|
||||
{
|
||||
for (int y = 0; y < scale; ++y)
|
||||
{
|
||||
Tile tile = GenBase._tiles[originX + x, originY + y];
|
||||
if (TileID.Sets.Ore[(int) tile.type])
|
||||
tile.ResetToType(tile.type);
|
||||
else
|
||||
tile.ResetToType((ushort) 367);
|
||||
bool active = slab.State(x, y, scale);
|
||||
tile.active(active);
|
||||
if (slab.HasWall)
|
||||
tile.wall = (byte) 178;
|
||||
WorldUtils.TileFrame(originX + x, originY + y, true);
|
||||
WorldGen.SquareWallFrame(originX + x, originY + y);
|
||||
Tile.SmoothSlope(originX + x, originY + y);
|
||||
if (WorldGen.SolidTile(originX + x, originY + y - 1) && GenBase._random.Next(4) == 0)
|
||||
WorldGen.PlaceTight(originX + x, originY + y);
|
||||
if (WorldGen.SolidTile(originX + x, originY + y) && GenBase._random.Next(4) == 0)
|
||||
WorldGen.PlaceTight(originX + x, originY + y - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private bool IsGroupSolid(int x, int y, int scale)
|
||||
{
|
||||
int num = 0;
|
||||
for (int index1 = 0; index1 < scale; ++index1)
|
||||
{
|
||||
for (int index2 = 0; index2 < scale; ++index2)
|
||||
{
|
||||
if (WorldGen.SolidOrSlopedTile(x + index1, y + index2))
|
||||
++num;
|
||||
}
|
||||
}
|
||||
return num > scale / 4 * 3;
|
||||
}
|
||||
|
||||
public override bool Place(Point origin, StructureMap structures)
|
||||
{
|
||||
if (this._slabs == null)
|
||||
this._slabs = new MarbleBiome.Slab[56, 26];
|
||||
int num1 = GenBase._random.Next(80, 150) / 3;
|
||||
int num2 = GenBase._random.Next(40, 60) / 3;
|
||||
int num3 = (num2 * 3 - GenBase._random.Next(20, 30)) / 3;
|
||||
origin.X -= num1 * 3 / 2;
|
||||
origin.Y -= num2 * 3 / 2;
|
||||
for (int index1 = -1; index1 < num1 + 1; ++index1)
|
||||
{
|
||||
float num4 = (float) ((double) (index1 - num1 / 2) / (double) num1 + 0.5);
|
||||
int num5 = (int) ((0.5 - (double) Math.Abs(num4 - 0.5f)) * 5.0) - 2;
|
||||
for (int index2 = -1; index2 < num2 + 1; ++index2)
|
||||
{
|
||||
bool hasWall = true;
|
||||
bool flag1 = false;
|
||||
bool flag2 = this.IsGroupSolid(index1 * 3 + origin.X, index2 * 3 + origin.Y, 3);
|
||||
int num6 = Math.Abs(index2 - num2 / 2) - num3 / 4 + num5;
|
||||
if (num6 > 3)
|
||||
{
|
||||
flag1 = flag2;
|
||||
hasWall = false;
|
||||
}
|
||||
else if (num6 > 0)
|
||||
{
|
||||
flag1 = index2 - num2 / 2 > 0 | flag2;
|
||||
hasWall = index2 - num2 / 2 < 0 || num6 <= 2;
|
||||
}
|
||||
else if (num6 == 0)
|
||||
flag1 = GenBase._random.Next(2) == 0 && index2 - num2 / 2 > 0 | flag2;
|
||||
if ((double) Math.Abs(num4 - 0.5f) > 0.349999994039536 + (double) GenBase._random.NextFloat() * 0.100000001490116 && !flag2)
|
||||
{
|
||||
hasWall = false;
|
||||
flag1 = false;
|
||||
}
|
||||
this._slabs[index1 + 1, index2 + 1] = MarbleBiome.Slab.Create(flag1 ? new MarbleBiome.SlabState(MarbleBiome.SlabStates.Solid) : new MarbleBiome.SlabState(MarbleBiome.SlabStates.Empty), hasWall);
|
||||
}
|
||||
}
|
||||
for (int index3 = 0; index3 < num1; ++index3)
|
||||
{
|
||||
for (int index4 = 0; index4 < num2; ++index4)
|
||||
this.SmoothSlope(index3 + 1, index4 + 1);
|
||||
}
|
||||
int num7 = num1 / 2;
|
||||
int val1 = num2 / 2;
|
||||
int num8 = (val1 + 1) * (val1 + 1);
|
||||
float num9 = (float) ((double) GenBase._random.NextFloat() * 2.0 - 1.0);
|
||||
float num10 = (float) ((double) GenBase._random.NextFloat() * 2.0 - 1.0);
|
||||
float num11 = (float) ((double) GenBase._random.NextFloat() * 2.0 - 1.0);
|
||||
float num12 = 0.0f;
|
||||
for (int index5 = 0; index5 <= num1; ++index5)
|
||||
{
|
||||
float num13 = (float) val1 / (float) num7 * (float) (index5 - num7);
|
||||
int num14 = Math.Min(val1, (int) Math.Sqrt((double) Math.Max(0.0f, (float) num8 - num13 * num13)));
|
||||
if (index5 < num1 / 2)
|
||||
num12 += MathHelper.Lerp(num9, num10, (float) index5 / (float) (num1 / 2));
|
||||
else
|
||||
num12 += MathHelper.Lerp(num10, num11, (float) ((double) index5 / (double) (num1 / 2) - 1.0));
|
||||
for (int index6 = val1 - num14; index6 <= val1 + num14; ++index6)
|
||||
this.PlaceSlab(this._slabs[index5 + 1, index6 + 1], index5 * 3 + origin.X, index6 * 3 + origin.Y + (int) num12, 3);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private delegate bool SlabState(int x, int y, int scale);
|
||||
|
||||
private class SlabStates
|
||||
{
|
||||
public static bool Empty(int x, int y, int scale) => false;
|
||||
|
||||
public static bool Solid(int x, int y, int scale) => true;
|
||||
|
||||
public static bool HalfBrick(int x, int y, int scale) => y >= scale / 2;
|
||||
|
||||
public static bool BottomRightFilled(int x, int y, int scale) => x >= scale - y;
|
||||
|
||||
public static bool BottomLeftFilled(int x, int y, int scale) => x < y;
|
||||
|
||||
public static bool TopRightFilled(int x, int y, int scale) => x > y;
|
||||
|
||||
public static bool TopLeftFilled(int x, int y, int scale) => x < scale - y;
|
||||
}
|
||||
|
||||
private struct Slab
|
||||
{
|
||||
public readonly MarbleBiome.SlabState State;
|
||||
public readonly bool HasWall;
|
||||
|
||||
public bool IsSolid => this.State != new MarbleBiome.SlabState(MarbleBiome.SlabStates.Empty);
|
||||
|
||||
private Slab(MarbleBiome.SlabState state, bool hasWall)
|
||||
{
|
||||
this.State = state;
|
||||
this.HasWall = hasWall;
|
||||
}
|
||||
|
||||
public MarbleBiome.Slab WithState(MarbleBiome.SlabState state) => new MarbleBiome.Slab(state, this.HasWall);
|
||||
|
||||
public static MarbleBiome.Slab Create(MarbleBiome.SlabState state, bool hasWall) => new MarbleBiome.Slab(state, hasWall);
|
||||
}
|
||||
}
|
||||
}
|
68
GameContent/Biomes/MiningExplosivesBiome.cs
Normal file
68
GameContent/Biomes/MiningExplosivesBiome.cs
Normal file
|
@ -0,0 +1,68 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.GameContent.Biomes.MiningExplosivesBiome
|
||||
// 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 Terraria.GameContent.Generation;
|
||||
using Terraria.World.Generation;
|
||||
|
||||
namespace Terraria.GameContent.Biomes
|
||||
{
|
||||
public class MiningExplosivesBiome : MicroBiome
|
||||
{
|
||||
public override bool Place(Point origin, StructureMap structures)
|
||||
{
|
||||
if (WorldGen.SolidTile(origin.X, origin.Y))
|
||||
return false;
|
||||
ushort type = Utils.SelectRandom<ushort>(GenBase._random, WorldGen.goldBar == 19 ? (ushort) 8 : (ushort) 169, WorldGen.silverBar == 21 ? (ushort) 9 : (ushort) 168, WorldGen.ironBar == 22 ? (ushort) 6 : (ushort) 167, WorldGen.copperBar == 20 ? (ushort) 7 : (ushort) 166);
|
||||
double num1 = GenBase._random.NextDouble() * 2.0 - 1.0;
|
||||
if (!WorldUtils.Find(origin, Searches.Chain(num1 > 0.0 ? (GenSearch) new Searches.Right(40) : (GenSearch) new Searches.Left(40), (GenCondition) new Conditions.IsSolid()), out origin))
|
||||
return false;
|
||||
if (!WorldUtils.Find(origin, Searches.Chain((GenSearch) new Searches.Down(80), (GenCondition) new Conditions.IsSolid()), out origin))
|
||||
return false;
|
||||
ShapeData shapeData = new ShapeData();
|
||||
Ref<int> count1 = new Ref<int>(0);
|
||||
Ref<int> count2 = new Ref<int>(0);
|
||||
WorldUtils.Gen(origin, new ShapeRunner(10f, 20, new Vector2((float) num1, 1f)).Output(shapeData), Actions.Chain((GenAction) new Modifiers.Blotches(), (GenAction) new Actions.Scanner(count1), (GenAction) new Modifiers.IsSolid(), (GenAction) new Actions.Scanner(count2)));
|
||||
if (count2.Value < count1.Value / 2)
|
||||
return false;
|
||||
Microsoft.Xna.Framework.Rectangle area = new Microsoft.Xna.Framework.Rectangle(origin.X - 15, origin.Y - 10, 30, 20);
|
||||
if (!structures.CanPlace(area))
|
||||
return false;
|
||||
WorldUtils.Gen(origin, (GenShape) new ModShapes.All(shapeData), (GenAction) new Actions.SetTile(type, true));
|
||||
WorldUtils.Gen(new Point(origin.X - (int) (num1 * -5.0), origin.Y - 5), (GenShape) new Shapes.Circle(5), Actions.Chain((GenAction) new Modifiers.Blotches(), (GenAction) new Actions.ClearTile(true)));
|
||||
Point result1;
|
||||
int num2 = 1 & (WorldUtils.Find(new Point(origin.X - (num1 > 0.0 ? 3 : -3), origin.Y - 3), Searches.Chain((GenSearch) new Searches.Down(10), (GenCondition) new Conditions.IsSolid()), out result1) ? 1 : 0);
|
||||
int num3 = GenBase._random.Next(4) == 0 ? 3 : 7;
|
||||
Point result2;
|
||||
int num4 = WorldUtils.Find(new Point(origin.X - (num1 > 0.0 ? -num3 : num3), origin.Y - 3), Searches.Chain((GenSearch) new Searches.Down(10), (GenCondition) new Conditions.IsSolid()), out result2) ? 1 : 0;
|
||||
if ((num2 & num4) == 0)
|
||||
return false;
|
||||
--result1.Y;
|
||||
--result2.Y;
|
||||
Tile tile1 = GenBase._tiles[result1.X, result1.Y + 1];
|
||||
tile1.slope((byte) 0);
|
||||
tile1.halfBrick(false);
|
||||
for (int index = -1; index <= 1; ++index)
|
||||
{
|
||||
WorldUtils.ClearTile(result2.X + index, result2.Y);
|
||||
Tile tile2 = GenBase._tiles[result2.X + index, result2.Y + 1];
|
||||
if (!WorldGen.SolidOrSlopedTile(tile2))
|
||||
{
|
||||
tile2.ResetToType((ushort) 1);
|
||||
tile2.active(true);
|
||||
}
|
||||
tile2.slope((byte) 0);
|
||||
tile2.halfBrick(false);
|
||||
WorldUtils.TileFrame(result2.X + index, result2.Y + 1, true);
|
||||
}
|
||||
WorldGen.PlaceTile(result1.X, result1.Y, 141);
|
||||
WorldGen.PlaceTile(result2.X, result2.Y, 411, true, true);
|
||||
WorldUtils.WireLine(result1, result2);
|
||||
structures.AddStructure(area, 5);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
48
GameContent/Biomes/ThinIceBiome.cs
Normal file
48
GameContent/Biomes/ThinIceBiome.cs
Normal file
|
@ -0,0 +1,48 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.GameContent.Biomes.ThinIceBiome
|
||||
// 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 System.Collections.Generic;
|
||||
using Terraria.World.Generation;
|
||||
|
||||
namespace Terraria.GameContent.Biomes
|
||||
{
|
||||
public class ThinIceBiome : MicroBiome
|
||||
{
|
||||
public override bool Place(Point origin, StructureMap structures)
|
||||
{
|
||||
Dictionary<ushort, int> resultsOutput = new Dictionary<ushort, int>();
|
||||
WorldUtils.Gen(new Point(origin.X - 25, origin.Y - 25), (GenShape) new Shapes.Rectangle(50, 50), (GenAction) new Actions.TileScanner(new ushort[4]
|
||||
{
|
||||
(ushort) 0,
|
||||
(ushort) 59,
|
||||
(ushort) 147,
|
||||
(ushort) 1
|
||||
}).Output(resultsOutput));
|
||||
int num1 = resultsOutput[(ushort) 0] + resultsOutput[(ushort) 1];
|
||||
int num2 = resultsOutput[(ushort) 59];
|
||||
int num3 = resultsOutput[(ushort) 147];
|
||||
if (num3 <= num2 || num3 <= num1)
|
||||
return false;
|
||||
int num4 = 0;
|
||||
for (int radius = GenBase._random.Next(10, 15); radius > 5; --radius)
|
||||
{
|
||||
int num5 = GenBase._random.Next(-5, 5);
|
||||
WorldUtils.Gen(new Point(origin.X + num5, origin.Y + num4), (GenShape) new Shapes.Circle(radius), Actions.Chain((GenAction) new Modifiers.Blotches(4), (GenAction) new Modifiers.OnlyTiles(new ushort[5]
|
||||
{
|
||||
(ushort) 147,
|
||||
(ushort) 161,
|
||||
(ushort) 224,
|
||||
(ushort) 0,
|
||||
(ushort) 1
|
||||
}), (GenAction) new Actions.SetTile((ushort) 162, true)));
|
||||
WorldUtils.Gen(new Point(origin.X + num5, origin.Y + num4), (GenShape) new Shapes.Circle(radius), Actions.Chain((GenAction) new Modifiers.Blotches(4), (GenAction) new Modifiers.HasLiquid(), (GenAction) new Actions.SetTile((ushort) 162, true), (GenAction) new Actions.SetLiquid(value: (byte) 0)));
|
||||
num4 += radius - 2;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
23
GameContent/ChildSafety.cs
Normal file
23
GameContent/ChildSafety.cs
Normal file
|
@ -0,0 +1,23 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.GameContent.ChildSafety
|
||||
// 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.ID;
|
||||
|
||||
namespace Terraria.GameContent
|
||||
{
|
||||
public class ChildSafety
|
||||
{
|
||||
private static SetFactory factoryDust = new SetFactory(275);
|
||||
private static SetFactory factoryGore = new SetFactory(1087);
|
||||
private static readonly bool[] SafeGore = ChildSafety.factoryGore.CreateBoolSet(11, 12, 13, 16, 17, 42, 53, 44, 51, 52, 53, 54, 55, 56, 57, 61, 62, 63, 67, 68, 69, 99, 106, 120, 130, 131, 147, 148, 149, 150, 156, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 213, 217, 218, 219, 220, 221, 222, 257, 265, 266, 267, 268, 269, 276, 277, 278, 279, 280, 281, 282, 314, 321, 322, 326, 331, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 375, 376, 377, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 435, 436, 437, 521, 522, 523, 525, 526, 527, 542, 570, 571, 572, 580, 581, 582, 603, 604, 605, 606, 610, 611, 612, 613, 614, 615, 616, 617, 618, 639, 704, 705, 706, 707, 708, 709, 710, 711, 712, 713, 714, 715, 716, 717, 718, 719, 720, 721, 734, 728, 729, 730, 731, 732, 733, 825, 826, 827, 848, 849, 850, 851, 853, 854, 855, 856, 857, 858, 859, 860, 861, 862, 892, 893, 898, 899, 907, 908, 909, 910, 911, 912, 913, 914, 915, 916, 917, 918, 919, 920, 921, 922, 923, 924, 925, 926);
|
||||
private static readonly bool[] SafeDust = ChildSafety.factoryDust.CreateBoolSet(true, 5, 227, 273);
|
||||
public static bool Disabled = true;
|
||||
|
||||
public static bool DangerousGore(int id) => !ChildSafety.SafeGore[id];
|
||||
|
||||
public static bool DangerousDust(int id) => !ChildSafety.SafeDust[id];
|
||||
}
|
||||
}
|
39
GameContent/Dyes/LegacyHairShaderData.cs
Normal file
39
GameContent/Dyes/LegacyHairShaderData.cs
Normal file
|
@ -0,0 +1,39 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.GameContent.Dyes.LegacyHairShaderData
|
||||
// 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.Graphics;
|
||||
using Terraria.Graphics.Shaders;
|
||||
|
||||
namespace Terraria.GameContent.Dyes
|
||||
{
|
||||
public class LegacyHairShaderData : HairShaderData
|
||||
{
|
||||
private LegacyHairShaderData.ColorProcessingMethod _colorProcessor;
|
||||
|
||||
public LegacyHairShaderData()
|
||||
: base((Ref<Effect>) null, (string) null)
|
||||
{
|
||||
this._shaderDisabled = true;
|
||||
}
|
||||
|
||||
public override Color GetColor(Player player, Color lightColor)
|
||||
{
|
||||
bool lighting = true;
|
||||
Color color = this._colorProcessor(player, player.hairColor, ref lighting);
|
||||
return lighting ? new Color(color.ToVector4() * lightColor.ToVector4()) : color;
|
||||
}
|
||||
|
||||
public LegacyHairShaderData UseLegacyMethod(
|
||||
LegacyHairShaderData.ColorProcessingMethod colorProcessor)
|
||||
{
|
||||
this._colorProcessor = colorProcessor;
|
||||
return this;
|
||||
}
|
||||
|
||||
public delegate Color ColorProcessingMethod(Player player, Color color, ref bool lighting);
|
||||
}
|
||||
}
|
67
GameContent/Dyes/ReflectiveArmorShaderData.cs
Normal file
67
GameContent/Dyes/ReflectiveArmorShaderData.cs
Normal file
|
@ -0,0 +1,67 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.GameContent.Dyes.ReflectiveArmorShaderData
|
||||
// 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.Graphics;
|
||||
using Terraria.DataStructures;
|
||||
using Terraria.Graphics.Shaders;
|
||||
|
||||
namespace Terraria.GameContent.Dyes
|
||||
{
|
||||
public class ReflectiveArmorShaderData : ArmorShaderData
|
||||
{
|
||||
public ReflectiveArmorShaderData(Ref<Effect> shader, string passName)
|
||||
: base(shader, passName)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Apply(Entity entity, DrawData? drawData)
|
||||
{
|
||||
if (entity == null)
|
||||
{
|
||||
this.Shader.Parameters["uLightSource"].SetValue(Vector3.Zero);
|
||||
}
|
||||
else
|
||||
{
|
||||
float num1 = 0.0f;
|
||||
if (drawData.HasValue)
|
||||
num1 = drawData.Value.rotation;
|
||||
Vector2 position = entity.position;
|
||||
float width = (float) entity.width;
|
||||
float height = (float) entity.height;
|
||||
Vector2 vector2_1 = new Vector2(width, height) * 0.1f;
|
||||
Vector2 vector2_2 = position + vector2_1;
|
||||
float x = width * 0.8f;
|
||||
float y = height * 0.8f;
|
||||
Vector3 subLight1 = Lighting.GetSubLight(vector2_2 + new Vector2(x * 0.5f, 0.0f));
|
||||
Vector3 subLight2 = Lighting.GetSubLight(vector2_2 + new Vector2(0.0f, y * 0.5f));
|
||||
Vector3 subLight3 = Lighting.GetSubLight(vector2_2 + new Vector2(x, y * 0.5f));
|
||||
Vector3 subLight4 = Lighting.GetSubLight(vector2_2 + new Vector2(x * 0.5f, y));
|
||||
float num2 = subLight1.X + subLight1.Y + subLight1.Z;
|
||||
float num3 = subLight2.X + subLight2.Y + subLight2.Z;
|
||||
float num4 = subLight3.X + subLight3.Y + subLight3.Z;
|
||||
float num5 = subLight4.X + subLight4.Y + subLight4.Z;
|
||||
Vector2 spinningpoint = new Vector2(num4 - num3, num5 - num2);
|
||||
if ((double) spinningpoint.Length() > 1.0)
|
||||
{
|
||||
float num6 = 1f;
|
||||
spinningpoint /= num6;
|
||||
}
|
||||
if (entity.direction == -1)
|
||||
spinningpoint.X *= -1f;
|
||||
spinningpoint = spinningpoint.RotatedBy(-(double) num1);
|
||||
Vector3 vector3 = new Vector3(spinningpoint, (float) (1.0 - ((double) spinningpoint.X * (double) spinningpoint.X + (double) spinningpoint.Y * (double) spinningpoint.Y)));
|
||||
vector3.X *= 2f;
|
||||
vector3.Y -= 0.15f;
|
||||
vector3.Y *= 2f;
|
||||
vector3.Normalize();
|
||||
vector3.Z *= 0.6f;
|
||||
this.Shader.Parameters["uLightSource"].SetValue(vector3);
|
||||
}
|
||||
base.Apply(entity, drawData);
|
||||
}
|
||||
}
|
||||
}
|
49
GameContent/Dyes/TeamArmorShaderData.cs
Normal file
49
GameContent/Dyes/TeamArmorShaderData.cs
Normal file
|
@ -0,0 +1,49 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.GameContent.Dyes.TeamArmorShaderData
|
||||
// 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.Graphics;
|
||||
using Terraria.DataStructures;
|
||||
using Terraria.Graphics.Shaders;
|
||||
|
||||
namespace Terraria.GameContent.Dyes
|
||||
{
|
||||
public class TeamArmorShaderData : ArmorShaderData
|
||||
{
|
||||
private static bool isInitialized;
|
||||
private static ArmorShaderData[] dustShaderData;
|
||||
|
||||
public TeamArmorShaderData(Ref<Effect> shader, string passName)
|
||||
: base(shader, passName)
|
||||
{
|
||||
if (TeamArmorShaderData.isInitialized)
|
||||
return;
|
||||
TeamArmorShaderData.isInitialized = true;
|
||||
TeamArmorShaderData.dustShaderData = new ArmorShaderData[Main.teamColor.Length];
|
||||
for (int index = 1; index < Main.teamColor.Length; ++index)
|
||||
TeamArmorShaderData.dustShaderData[index] = new ArmorShaderData(shader, passName).UseColor(Main.teamColor[index]);
|
||||
TeamArmorShaderData.dustShaderData[0] = new ArmorShaderData(shader, "Default");
|
||||
}
|
||||
|
||||
public override void Apply(Entity entity, DrawData? drawData)
|
||||
{
|
||||
if (!(entity is Player player) || player.team == 0)
|
||||
{
|
||||
TeamArmorShaderData.dustShaderData[0].Apply((Entity) player, drawData);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.UseColor(Main.teamColor[player.team]);
|
||||
base.Apply((Entity) player, drawData);
|
||||
}
|
||||
}
|
||||
|
||||
public override ArmorShaderData GetSecondaryShader(Entity entity)
|
||||
{
|
||||
Player player = entity as Player;
|
||||
return TeamArmorShaderData.dustShaderData[player.team];
|
||||
}
|
||||
}
|
||||
}
|
149
GameContent/Events/BirthdayParty.cs
Normal file
149
GameContent/Events/BirthdayParty.cs
Normal file
|
@ -0,0 +1,149 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.GameContent.Events.BirthdayParty
|
||||
// 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 System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Terraria.Graphics.Effects;
|
||||
using Terraria.Localization;
|
||||
|
||||
namespace Terraria.GameContent.Events
|
||||
{
|
||||
public class BirthdayParty
|
||||
{
|
||||
public static bool ManualParty = false;
|
||||
public static bool GenuineParty = false;
|
||||
public static int PartyDaysOnCooldown = 0;
|
||||
public static List<int> CelebratingNPCs = new List<int>();
|
||||
private static bool _wasCelebrating = false;
|
||||
|
||||
public static bool PartyIsUp => BirthdayParty.GenuineParty || BirthdayParty.ManualParty;
|
||||
|
||||
public static void CheckMorning() => BirthdayParty.NaturalAttempt();
|
||||
|
||||
public static void CheckNight()
|
||||
{
|
||||
bool flag = false;
|
||||
if (BirthdayParty.GenuineParty)
|
||||
{
|
||||
flag = true;
|
||||
BirthdayParty.GenuineParty = false;
|
||||
BirthdayParty.CelebratingNPCs.Clear();
|
||||
}
|
||||
if (BirthdayParty.ManualParty)
|
||||
{
|
||||
flag = true;
|
||||
BirthdayParty.ManualParty = false;
|
||||
}
|
||||
if (!flag)
|
||||
return;
|
||||
Color color = new Color((int) byte.MaxValue, 0, 160);
|
||||
WorldGen.BroadcastText(NetworkText.FromKey(Lang.misc[99].Key), color);
|
||||
}
|
||||
|
||||
private static void NaturalAttempt()
|
||||
{
|
||||
if (Main.netMode == 1)
|
||||
return;
|
||||
if (BirthdayParty.PartyDaysOnCooldown > 0)
|
||||
{
|
||||
--BirthdayParty.PartyDaysOnCooldown;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Main.rand.Next(10) != 0)
|
||||
return;
|
||||
List<NPC> source = new List<NPC>();
|
||||
for (int index = 0; index < 200; ++index)
|
||||
{
|
||||
NPC npc = Main.npc[index];
|
||||
if (npc.active && npc.townNPC && npc.type != 37 && npc.type != 453 && npc.aiStyle != 0)
|
||||
source.Add(npc);
|
||||
}
|
||||
if (source.Count < 5)
|
||||
return;
|
||||
BirthdayParty.GenuineParty = true;
|
||||
BirthdayParty.PartyDaysOnCooldown = Main.rand.Next(5, 11);
|
||||
BirthdayParty.CelebratingNPCs.Clear();
|
||||
List<int> intList = new List<int>();
|
||||
int num = 1;
|
||||
if (Main.rand.Next(5) == 0 && source.Count > 12)
|
||||
num = 3;
|
||||
else if (Main.rand.Next(3) == 0)
|
||||
num = 2;
|
||||
List<NPC> list = source.OrderBy<NPC, int>((Func<NPC, int>) (i => Main.rand.Next())).ToList<NPC>();
|
||||
for (int index = 0; index < num; ++index)
|
||||
intList.Add(index);
|
||||
for (int index = 0; index < intList.Count; ++index)
|
||||
BirthdayParty.CelebratingNPCs.Add(list[intList[index]].whoAmI);
|
||||
Color color = new Color((int) byte.MaxValue, 0, 160);
|
||||
if (BirthdayParty.CelebratingNPCs.Count == 3)
|
||||
WorldGen.BroadcastText(NetworkText.FromKey("Game.BirthdayParty_3", (object) Main.npc[BirthdayParty.CelebratingNPCs[0]].GetGivenOrTypeNetName(), (object) Main.npc[BirthdayParty.CelebratingNPCs[1]].GetGivenOrTypeNetName(), (object) Main.npc[BirthdayParty.CelebratingNPCs[2]].GetGivenOrTypeNetName()), color);
|
||||
else if (BirthdayParty.CelebratingNPCs.Count == 2)
|
||||
WorldGen.BroadcastText(NetworkText.FromKey("Game.BirthdayParty_2", (object) Main.npc[BirthdayParty.CelebratingNPCs[0]].GetGivenOrTypeNetName(), (object) Main.npc[BirthdayParty.CelebratingNPCs[1]].GetGivenOrTypeNetName()), color);
|
||||
else
|
||||
WorldGen.BroadcastText(NetworkText.FromKey("Game.BirthdayParty_1", (object) Main.npc[BirthdayParty.CelebratingNPCs[0]].GetGivenOrTypeNetName()), color);
|
||||
}
|
||||
}
|
||||
|
||||
public static void ToggleManualParty()
|
||||
{
|
||||
int num1 = BirthdayParty.PartyIsUp ? 1 : 0;
|
||||
if (Main.netMode != 1)
|
||||
BirthdayParty.ManualParty = !BirthdayParty.ManualParty;
|
||||
else
|
||||
NetMessage.SendData(111);
|
||||
int num2 = BirthdayParty.PartyIsUp ? 1 : 0;
|
||||
if (num1 == num2 || Main.netMode != 2)
|
||||
return;
|
||||
NetMessage.SendData(7);
|
||||
}
|
||||
|
||||
public static void WorldClear()
|
||||
{
|
||||
BirthdayParty.ManualParty = false;
|
||||
BirthdayParty.GenuineParty = false;
|
||||
BirthdayParty.PartyDaysOnCooldown = 0;
|
||||
BirthdayParty.CelebratingNPCs.Clear();
|
||||
BirthdayParty._wasCelebrating = false;
|
||||
}
|
||||
|
||||
public static void UpdateTime()
|
||||
{
|
||||
if (BirthdayParty._wasCelebrating != BirthdayParty.PartyIsUp)
|
||||
{
|
||||
if (Main.netMode != 2)
|
||||
{
|
||||
if (BirthdayParty.PartyIsUp)
|
||||
SkyManager.Instance.Activate("Party", new Vector2());
|
||||
else
|
||||
SkyManager.Instance.Deactivate("Party");
|
||||
}
|
||||
if (Main.netMode != 1 && BirthdayParty.CelebratingNPCs.Count > 0)
|
||||
{
|
||||
for (int index = 0; index < BirthdayParty.CelebratingNPCs.Count; ++index)
|
||||
{
|
||||
NPC npc = Main.npc[BirthdayParty.CelebratingNPCs[index]];
|
||||
if (!npc.active || !npc.townNPC || npc.type == 37 || npc.type == 453 || npc.aiStyle == 0)
|
||||
BirthdayParty.CelebratingNPCs.RemoveAt(index);
|
||||
}
|
||||
if (BirthdayParty.CelebratingNPCs.Count == 0)
|
||||
{
|
||||
BirthdayParty.GenuineParty = false;
|
||||
if (!BirthdayParty.ManualParty)
|
||||
{
|
||||
Color color = new Color((int) byte.MaxValue, 0, 160);
|
||||
WorldGen.BroadcastText(NetworkText.FromKey(Lang.misc[99].Key), color);
|
||||
NetMessage.SendData(7);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
BirthdayParty._wasCelebrating = BirthdayParty.PartyIsUp;
|
||||
}
|
||||
}
|
||||
}
|
90
GameContent/Events/CultistRitual.cs
Normal file
90
GameContent/Events/CultistRitual.cs
Normal file
|
@ -0,0 +1,90 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.GameContent.Events.CultistRitual
|
||||
// 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;
|
||||
|
||||
namespace Terraria.GameContent.Events
|
||||
{
|
||||
public class CultistRitual
|
||||
{
|
||||
public const int delayStart = 86400;
|
||||
public const int respawnDelay = 43200;
|
||||
private const int timePerCultist = 3600;
|
||||
private const int recheckStart = 600;
|
||||
public static int delay;
|
||||
public static int recheck;
|
||||
|
||||
public static void UpdateTime()
|
||||
{
|
||||
if (Main.netMode == 1)
|
||||
return;
|
||||
CultistRitual.delay -= Main.dayRate;
|
||||
if (CultistRitual.delay < 0)
|
||||
CultistRitual.delay = 0;
|
||||
CultistRitual.recheck -= Main.dayRate;
|
||||
if (CultistRitual.recheck < 0)
|
||||
CultistRitual.recheck = 0;
|
||||
if (CultistRitual.delay != 0 || CultistRitual.recheck != 0)
|
||||
return;
|
||||
CultistRitual.recheck = 600;
|
||||
if (NPC.AnyDanger())
|
||||
CultistRitual.recheck *= 6;
|
||||
else
|
||||
CultistRitual.TrySpawning(Main.dungeonX, Main.dungeonY);
|
||||
}
|
||||
|
||||
public static void CultistSlain() => CultistRitual.delay -= 3600;
|
||||
|
||||
public static void TabletDestroyed() => CultistRitual.delay = 43200;
|
||||
|
||||
public static void TrySpawning(int x, int y)
|
||||
{
|
||||
if (WorldGen.PlayerLOS(x - 6, y) || WorldGen.PlayerLOS(x + 6, y) || !CultistRitual.CheckRitual(x, y))
|
||||
return;
|
||||
NPC.NewNPC(x * 16 + 8, (y - 4) * 16 - 8, 437);
|
||||
}
|
||||
|
||||
private static bool CheckRitual(int x, int y)
|
||||
{
|
||||
if (CultistRitual.delay != 0 || !Main.hardMode || !NPC.downedGolemBoss || !NPC.downedBoss3 || y < 7 || WorldGen.SolidTile(Main.tile[x, y - 7]) || NPC.AnyNPCs(437))
|
||||
return false;
|
||||
Vector2 Center = new Vector2((float) (x * 16 + 8), (float) (y * 16 - 64 - 8 - 27));
|
||||
Point[] pointArray = (Point[]) null;
|
||||
ref Point[] local = ref pointArray;
|
||||
return CultistRitual.CheckFloor(Center, out local);
|
||||
}
|
||||
|
||||
public static bool CheckFloor(Vector2 Center, out Point[] spawnPoints)
|
||||
{
|
||||
Point[] pointArray = new Point[4];
|
||||
int num1 = 0;
|
||||
Point tileCoordinates = Center.ToTileCoordinates();
|
||||
for (int index1 = -5; index1 <= 5; index1 += 2)
|
||||
{
|
||||
if (index1 != -1 && index1 != 1)
|
||||
{
|
||||
for (int index2 = -5; index2 < 12; ++index2)
|
||||
{
|
||||
int num2 = tileCoordinates.X + index1 * 2;
|
||||
int num3 = tileCoordinates.Y + index2;
|
||||
if (WorldGen.SolidTile(num2, num3) && !Collision.SolidTiles(num2 - 1, num2 + 1, num3 - 3, num3 - 1))
|
||||
{
|
||||
pointArray[num1++] = new Point(num2, num3);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (num1 != 4)
|
||||
{
|
||||
spawnPoints = (Point[]) null;
|
||||
return false;
|
||||
}
|
||||
spawnPoints = pointArray;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
1684
GameContent/Events/DD2Event.cs
Normal file
1684
GameContent/Events/DD2Event.cs
Normal file
File diff suppressed because it is too large
Load diff
220
GameContent/Events/MoonlordDeathDrama.cs
Normal file
220
GameContent/Events/MoonlordDeathDrama.cs
Normal file
|
@ -0,0 +1,220 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.GameContent.Events.MoonlordDeathDrama
|
||||
// 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.Graphics;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Terraria.Graphics;
|
||||
using Terraria.Utilities;
|
||||
|
||||
namespace Terraria.GameContent.Events
|
||||
{
|
||||
public class MoonlordDeathDrama
|
||||
{
|
||||
private static List<MoonlordDeathDrama.MoonlordPiece> _pieces = new List<MoonlordDeathDrama.MoonlordPiece>();
|
||||
private static List<MoonlordDeathDrama.MoonlordExplosion> _explosions = new List<MoonlordDeathDrama.MoonlordExplosion>();
|
||||
private static List<Vector2> _lightSources = new List<Vector2>();
|
||||
private static float whitening = 0.0f;
|
||||
private static float requestedLight = 0.0f;
|
||||
|
||||
public static void Update()
|
||||
{
|
||||
for (int index = 0; index < MoonlordDeathDrama._pieces.Count; ++index)
|
||||
{
|
||||
MoonlordDeathDrama.MoonlordPiece piece = MoonlordDeathDrama._pieces[index];
|
||||
piece.Update();
|
||||
if (piece.Dead)
|
||||
{
|
||||
MoonlordDeathDrama._pieces.Remove(piece);
|
||||
--index;
|
||||
}
|
||||
}
|
||||
for (int index = 0; index < MoonlordDeathDrama._explosions.Count; ++index)
|
||||
{
|
||||
MoonlordDeathDrama.MoonlordExplosion explosion = MoonlordDeathDrama._explosions[index];
|
||||
explosion.Update();
|
||||
if (explosion.Dead)
|
||||
{
|
||||
MoonlordDeathDrama._explosions.Remove(explosion);
|
||||
--index;
|
||||
}
|
||||
}
|
||||
bool flag = false;
|
||||
for (int index = 0; index < MoonlordDeathDrama._lightSources.Count; ++index)
|
||||
{
|
||||
if ((double) Main.player[Main.myPlayer].Distance(MoonlordDeathDrama._lightSources[index]) < 2000.0)
|
||||
{
|
||||
flag = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
MoonlordDeathDrama._lightSources.Clear();
|
||||
if (!flag)
|
||||
MoonlordDeathDrama.requestedLight = 0.0f;
|
||||
if ((double) MoonlordDeathDrama.requestedLight != (double) MoonlordDeathDrama.whitening)
|
||||
{
|
||||
if ((double) Math.Abs(MoonlordDeathDrama.requestedLight - MoonlordDeathDrama.whitening) < 0.0199999995529652)
|
||||
MoonlordDeathDrama.whitening = MoonlordDeathDrama.requestedLight;
|
||||
else
|
||||
MoonlordDeathDrama.whitening += (float) Math.Sign(MoonlordDeathDrama.requestedLight - MoonlordDeathDrama.whitening) * 0.02f;
|
||||
}
|
||||
MoonlordDeathDrama.requestedLight = 0.0f;
|
||||
}
|
||||
|
||||
public static void DrawPieces(SpriteBatch spriteBatch)
|
||||
{
|
||||
Rectangle playerScreen = Utils.CenteredRectangle(Main.screenPosition + new Vector2((float) Main.screenWidth, (float) Main.screenHeight) * 0.5f, new Vector2((float) (Main.screenWidth + 1000), (float) (Main.screenHeight + 1000)));
|
||||
for (int index = 0; index < MoonlordDeathDrama._pieces.Count; ++index)
|
||||
{
|
||||
if (MoonlordDeathDrama._pieces[index].InDrawRange(playerScreen))
|
||||
MoonlordDeathDrama._pieces[index].Draw(spriteBatch);
|
||||
}
|
||||
}
|
||||
|
||||
public static void DrawExplosions(SpriteBatch spriteBatch)
|
||||
{
|
||||
Rectangle playerScreen = Utils.CenteredRectangle(Main.screenPosition + new Vector2((float) Main.screenWidth, (float) Main.screenHeight) * 0.5f, new Vector2((float) (Main.screenWidth + 1000), (float) (Main.screenHeight + 1000)));
|
||||
for (int index = 0; index < MoonlordDeathDrama._explosions.Count; ++index)
|
||||
{
|
||||
if (MoonlordDeathDrama._explosions[index].InDrawRange(playerScreen))
|
||||
MoonlordDeathDrama._explosions[index].Draw(spriteBatch);
|
||||
}
|
||||
}
|
||||
|
||||
public static void DrawWhite(SpriteBatch spriteBatch)
|
||||
{
|
||||
if ((double) MoonlordDeathDrama.whitening == 0.0)
|
||||
return;
|
||||
Color color = Color.White * MoonlordDeathDrama.whitening;
|
||||
spriteBatch.Draw(Main.magicPixel, new Rectangle(-2, -2, Main.screenWidth + 4, Main.screenHeight + 4), new Rectangle?(new Rectangle(0, 0, 1, 1)), color);
|
||||
}
|
||||
|
||||
public static void ThrowPieces(Vector2 MoonlordCoreCenter, int DramaSeed)
|
||||
{
|
||||
UnifiedRandom r = new UnifiedRandom(DramaSeed);
|
||||
Vector2 vector2_1 = Vector2.UnitY.RotatedBy((double) r.NextFloat() * 1.57079637050629 - 0.785398185253143 + 3.14159274101257);
|
||||
MoonlordDeathDrama._pieces.Add(new MoonlordDeathDrama.MoonlordPiece(TextureManager.Load("Images/Misc/MoonExplosion/Spine"), new Vector2(64f, 150f), MoonlordCoreCenter + new Vector2(0.0f, 50f), vector2_1 * 6f, 0.0f, (float) ((double) r.NextFloat() * 0.100000001490116 - 0.0500000007450581)));
|
||||
Vector2 vector2_2 = Vector2.UnitY.RotatedBy((double) r.NextFloat() * 1.57079637050629 - 0.785398185253143 + 3.14159274101257);
|
||||
MoonlordDeathDrama._pieces.Add(new MoonlordDeathDrama.MoonlordPiece(TextureManager.Load("Images/Misc/MoonExplosion/Shoulder"), new Vector2(40f, 120f), MoonlordCoreCenter + new Vector2(50f, -120f), vector2_2 * 10f, 0.0f, (float) ((double) r.NextFloat() * 0.100000001490116 - 0.0500000007450581)));
|
||||
Vector2 vector2_3 = Vector2.UnitY.RotatedBy((double) r.NextFloat() * 1.57079637050629 - 0.785398185253143 + 3.14159274101257);
|
||||
MoonlordDeathDrama._pieces.Add(new MoonlordDeathDrama.MoonlordPiece(TextureManager.Load("Images/Misc/MoonExplosion/Torso"), new Vector2(192f, 252f), MoonlordCoreCenter, vector2_3 * 8f, 0.0f, (float) ((double) r.NextFloat() * 0.100000001490116 - 0.0500000007450581)));
|
||||
Vector2 vector2_4 = Vector2.UnitY.RotatedBy((double) r.NextFloat() * 1.57079637050629 - 0.785398185253143 + 3.14159274101257);
|
||||
MoonlordDeathDrama._pieces.Add(new MoonlordDeathDrama.MoonlordPiece(TextureManager.Load("Images/Misc/MoonExplosion/Head"), new Vector2(138f, 185f), MoonlordCoreCenter - new Vector2(0.0f, 200f), vector2_4 * 12f, 0.0f, (float) ((double) r.NextFloat() * 0.100000001490116 - 0.0500000007450581)));
|
||||
}
|
||||
|
||||
public static void AddExplosion(Vector2 spot) => MoonlordDeathDrama._explosions.Add(new MoonlordDeathDrama.MoonlordExplosion(TextureManager.Load("Images/Misc/MoonExplosion/Explosion"), spot, Main.rand.Next(2, 4)));
|
||||
|
||||
public static void RequestLight(float light, Vector2 spot)
|
||||
{
|
||||
MoonlordDeathDrama._lightSources.Add(spot);
|
||||
if ((double) light > 1.0)
|
||||
light = 1f;
|
||||
if ((double) MoonlordDeathDrama.requestedLight >= (double) light)
|
||||
return;
|
||||
MoonlordDeathDrama.requestedLight = light;
|
||||
}
|
||||
|
||||
public class MoonlordPiece
|
||||
{
|
||||
private Texture2D _texture;
|
||||
private Vector2 _position;
|
||||
private Vector2 _velocity;
|
||||
private Vector2 _origin;
|
||||
private float _rotation;
|
||||
private float _rotationVelocity;
|
||||
|
||||
public MoonlordPiece(
|
||||
Texture2D pieceTexture,
|
||||
Vector2 textureOrigin,
|
||||
Vector2 centerPos,
|
||||
Vector2 velocity,
|
||||
float rot,
|
||||
float angularVelocity)
|
||||
{
|
||||
this._texture = pieceTexture;
|
||||
this._origin = textureOrigin;
|
||||
this._position = centerPos;
|
||||
this._velocity = velocity;
|
||||
this._rotation = rot;
|
||||
this._rotationVelocity = angularVelocity;
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
this._velocity.Y += 0.3f;
|
||||
this._rotation += this._rotationVelocity;
|
||||
this._rotationVelocity *= 0.99f;
|
||||
this._position += this._velocity;
|
||||
}
|
||||
|
||||
public void Draw(SpriteBatch sp)
|
||||
{
|
||||
Color light = this.GetLight();
|
||||
sp.Draw(this._texture, this._position - Main.screenPosition, new Rectangle?(), light, this._rotation, this._origin, 1f, SpriteEffects.None, 0.0f);
|
||||
}
|
||||
|
||||
public bool Dead => (double) this._position.Y > (double) (Main.maxTilesY * 16) - 480.0 || (double) this._position.X < 480.0 || (double) this._position.X >= (double) (Main.maxTilesX * 16) - 480.0;
|
||||
|
||||
public bool InDrawRange(Rectangle playerScreen) => playerScreen.Contains(this._position.ToPoint());
|
||||
|
||||
public Color GetLight()
|
||||
{
|
||||
Vector3 zero = Vector3.Zero;
|
||||
float num1 = 0.0f;
|
||||
int num2 = 5;
|
||||
Point tileCoordinates = this._position.ToTileCoordinates();
|
||||
for (int x = tileCoordinates.X - num2; x <= tileCoordinates.X + num2; ++x)
|
||||
{
|
||||
for (int y = tileCoordinates.Y - num2; y <= tileCoordinates.Y + num2; ++y)
|
||||
{
|
||||
zero += Lighting.GetColor(x, y).ToVector3();
|
||||
++num1;
|
||||
}
|
||||
}
|
||||
return (double) num1 == 0.0 ? Color.White : new Color(zero / num1);
|
||||
}
|
||||
}
|
||||
|
||||
public class MoonlordExplosion
|
||||
{
|
||||
private Texture2D _texture;
|
||||
private Vector2 _position;
|
||||
private Vector2 _origin;
|
||||
private Rectangle _frame;
|
||||
private int _frameCounter;
|
||||
private int _frameSpeed;
|
||||
|
||||
public MoonlordExplosion(Texture2D pieceTexture, Vector2 centerPos, int frameSpeed)
|
||||
{
|
||||
this._texture = pieceTexture;
|
||||
this._position = centerPos;
|
||||
this._frameSpeed = frameSpeed;
|
||||
this._frameCounter = 0;
|
||||
this._frame = this._texture.Frame(verticalFrames: 7);
|
||||
this._origin = this._frame.Size() / 2f;
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
++this._frameCounter;
|
||||
this._frame = this._texture.Frame(verticalFrames: 7, frameY: (this._frameCounter / this._frameSpeed));
|
||||
}
|
||||
|
||||
public void Draw(SpriteBatch sp)
|
||||
{
|
||||
Color light = this.GetLight();
|
||||
sp.Draw(this._texture, this._position - Main.screenPosition, new Rectangle?(this._frame), light, 0.0f, this._origin, 1f, SpriteEffects.None, 0.0f);
|
||||
}
|
||||
|
||||
public bool Dead => (double) this._position.Y > (double) (Main.maxTilesY * 16) - 480.0 || (double) this._position.X < 480.0 || (double) this._position.X >= (double) (Main.maxTilesX * 16) - 480.0 || this._frameCounter >= this._frameSpeed * 7;
|
||||
|
||||
public bool InDrawRange(Rectangle playerScreen) => playerScreen.Contains(this._position.ToPoint());
|
||||
|
||||
public Color GetLight() => new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) sbyte.MaxValue);
|
||||
}
|
||||
}
|
||||
}
|
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