Compare commits

..

No commits in common. "1.4.0.5" and "1.3.5.3" have entirely different histories.

1065 changed files with 106741 additions and 261163 deletions

View file

@ -1,7 +1,7 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.Achievements.Achievement
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly: 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;

View file

@ -1,7 +1,7 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.Achievements.AchievementCategory
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly: 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

View file

@ -1,7 +1,7 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.Achievements.AchievementCondition
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly: 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;

View file

@ -1,7 +1,7 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.Achievements.AchievementManager
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly: 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;
@ -14,7 +14,6 @@ using System.Linq;
using System.Security.Cryptography;
using System.Text;
using Terraria.Social;
using Terraria.UI;
using Terraria.Utilities;
namespace Terraria.Achievements
@ -47,7 +46,7 @@ namespace Terraria.Achievements
}
}
public void Save() => FileUtilities.ProtectedInvoke((Action) (() => this.Save(this._savePath, this._isCloudSave)));
public void Save() => this.Save(this._savePath, this._isCloudSave);
private void Save(string path, bool cloud)
{
@ -73,8 +72,6 @@ namespace Terraria.Achievements
}
catch (Exception ex)
{
string savePath = this._savePath;
FancyErrorPrinter.ShowFileSavingFailError(ex, savePath);
}
}
}
@ -132,15 +129,6 @@ namespace Terraria.Achievements
this.Save();
}
public void ClearAll()
{
if (SocialAPI.Achievements != null)
return;
foreach (KeyValuePair<string, Achievement> achievement in this._achievements)
achievement.Value.ClearProgress();
this.Save();
}
private void AchievementCompleted(Achievement achievement)
{
this.Save();
@ -183,7 +171,6 @@ namespace Terraria.Achievements
private class StoredAchievement
{
[JsonProperty]
public Dictionary<string, JObject> Conditions;
}
}

View file

@ -1,7 +1,7 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.Achievements.AchievementTracker`1
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly: 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;

View file

@ -1,7 +1,7 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.Achievements.ConditionFloatTracker
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly: 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;

View file

@ -1,7 +1,7 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.Achievements.ConditionIntTracker
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly: 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;

View file

@ -1,7 +1,7 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.Achievements.ConditionsCompletedTracker
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly: 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;

View file

@ -1,7 +1,7 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.Achievements.IAchievementTracker
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly: 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

View file

@ -1,7 +1,7 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.Achievements.TrackerType
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly: 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

View file

@ -1,7 +1,7 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.Animation
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly: 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;
@ -61,20 +61,6 @@ namespace Terraria
this._frameData = new int[5]{ 1, 2, 2, 2, 1 };
this._frameMax = this._frameData.Length;
break;
case 3:
this._frameMax = 5;
this._frameCounterMax = 5;
this._frameData = new int[this._frameMax];
for (int index = 0; index < this._frameMax; ++index)
this._frameData[index] = index;
break;
case 4:
this._frameMax = 3;
this._frameCounterMax = 5;
this._frameData = new int[this._frameMax];
for (int index = 0; index < this._frameMax; ++index)
this._frameData[index] = 9 + index;
break;
}
}

View file

@ -8,10 +8,10 @@ using System.Security.Permissions;
[assembly: AssemblyProduct("Terraria")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyCompany("Re-Logic")]
[assembly: AssemblyCopyright("Copyright © 2020 Re-Logic")]
[assembly: AssemblyCopyright("Copyright © Re-Logic 2017")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("f571b16a-2c9b-44ab-b115-7c762c9e4e7e")]
[assembly: AssemblyFileVersion("1.4.0.5")]
[assembly: AssemblyVersion("1.4.0.5")]
[assembly: AssemblyFileVersion("1.3.5.3")]
[assembly: AssemblyVersion("1.3.5.3")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]

View file

@ -1,7 +1,7 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.Audio.ActiveSound
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly: 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;
@ -11,13 +11,15 @@ 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 { get; private set; }
public SoundEffectInstance Sound => this._sound;
public SoundStyle Style { get; private set; }
public SoundStyle Style => this._style;
public bool IsPlaying => this.Sound.State == SoundState.Playing;
@ -26,7 +28,7 @@ namespace Terraria.Audio
this.Position = position;
this.Volume = 1f;
this.IsGlobal = false;
this.Style = style;
this._style = style;
this.Play();
}
@ -35,44 +37,43 @@ namespace Terraria.Audio
this.Position = Vector2.Zero;
this.Volume = 1f;
this.IsGlobal = true;
this.Style = style;
this._style = style;
this.Play();
}
private void Play()
{
SoundEffectInstance instance = this.Style.GetRandomSound().CreateInstance();
instance.Pitch += this.Style.GetRandomPitch();
instance.Play();
SoundInstanceGarbageCollector.Track(instance);
this.Sound = instance;
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)
if (this._sound == null)
return;
this.Sound.Stop();
this._sound.Stop();
}
public void Pause()
{
if (this.Sound == null || this.Sound.State != SoundState.Playing)
if (this._sound == null || this._sound.State != SoundState.Playing)
return;
this.Sound.Pause();
this._sound.Pause();
}
public void Resume()
{
if (this.Sound == null || this.Sound.State != SoundState.Paused)
if (this._sound == null || this._sound.State != SoundState.Paused)
return;
this.Sound.Resume();
this._sound.Resume();
}
public void Update()
{
if (this.Sound == null)
if (this._sound == null)
return;
Vector2 vector2 = Main.screenPosition + new Vector2((float) (Main.screenWidth / 2), (float) (Main.screenHeight / 2));
float num1 = 1f;
@ -81,8 +82,8 @@ namespace Terraria.Audio
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)
float num2 = num1 * (this._style.Volume * this.Volume);
switch (this._style.Type)
{
case SoundType.Sound:
num2 *= Main.soundVolume;

View file

@ -1,7 +1,7 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.Audio.CustomSoundStyle
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly: 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;
@ -11,8 +11,8 @@ namespace Terraria.Audio
{
public class CustomSoundStyle : SoundStyle
{
private static readonly UnifiedRandom Random = new UnifiedRandom();
private readonly SoundEffect[] _soundEffects;
private static UnifiedRandom _random = new UnifiedRandom();
private SoundEffect[] _soundEffects;
public override bool IsTrackable => true;
@ -36,6 +36,6 @@ namespace Terraria.Audio
this._soundEffects = soundEffects;
}
public override SoundEffect GetRandomSound() => this._soundEffects[CustomSoundStyle.Random.Next(this._soundEffects.Length)];
public override SoundEffect GetRandomSound() => this._soundEffects[CustomSoundStyle._random.Next(this._soundEffects.Length)];
}
}

View file

@ -1,996 +0,0 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.Audio.LegacySoundPlayer
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using ReLogic.Content;
using ReLogic.Utilities;
using System;
using System.IO;
using Terraria.ID;
namespace Terraria.Audio
{
public class LegacySoundPlayer
{
private Asset<SoundEffect>[] _soundDrip = new Asset<SoundEffect>[3];
private SoundEffectInstance[] _soundInstanceDrip = new SoundEffectInstance[3];
private Asset<SoundEffect>[] _soundLiquid = new Asset<SoundEffect>[2];
private SoundEffectInstance[] _soundInstanceLiquid = new SoundEffectInstance[2];
private Asset<SoundEffect>[] _soundMech = new Asset<SoundEffect>[1];
private SoundEffectInstance[] _soundInstanceMech = new SoundEffectInstance[1];
private Asset<SoundEffect>[] _soundDig = new Asset<SoundEffect>[3];
private SoundEffectInstance[] _soundInstanceDig = new SoundEffectInstance[3];
private Asset<SoundEffect>[] _soundThunder = new Asset<SoundEffect>[7];
private SoundEffectInstance[] _soundInstanceThunder = new SoundEffectInstance[7];
private Asset<SoundEffect>[] _soundResearch = new Asset<SoundEffect>[4];
private SoundEffectInstance[] _soundInstanceResearch = new SoundEffectInstance[4];
private Asset<SoundEffect>[] _soundTink = new Asset<SoundEffect>[3];
private SoundEffectInstance[] _soundInstanceTink = new SoundEffectInstance[3];
private Asset<SoundEffect>[] _soundCoin = new Asset<SoundEffect>[5];
private SoundEffectInstance[] _soundInstanceCoin = new SoundEffectInstance[5];
private Asset<SoundEffect>[] _soundPlayerHit = new Asset<SoundEffect>[3];
private SoundEffectInstance[] _soundInstancePlayerHit = new SoundEffectInstance[3];
private Asset<SoundEffect>[] _soundFemaleHit = new Asset<SoundEffect>[3];
private SoundEffectInstance[] _soundInstanceFemaleHit = new SoundEffectInstance[3];
private Asset<SoundEffect> _soundPlayerKilled;
private SoundEffectInstance _soundInstancePlayerKilled;
private Asset<SoundEffect> _soundGrass;
private SoundEffectInstance _soundInstanceGrass;
private Asset<SoundEffect> _soundGrab;
private SoundEffectInstance _soundInstanceGrab;
private Asset<SoundEffect> _soundPixie;
private SoundEffectInstance _soundInstancePixie;
private Asset<SoundEffect>[] _soundItem = new Asset<SoundEffect>[(int) SoundID.ItemSoundCount];
private SoundEffectInstance[] _soundInstanceItem = new SoundEffectInstance[(int) SoundID.ItemSoundCount];
private Asset<SoundEffect>[] _soundNpcHit = new Asset<SoundEffect>[58];
private SoundEffectInstance[] _soundInstanceNpcHit = new SoundEffectInstance[58];
private Asset<SoundEffect>[] _soundNpcKilled = new Asset<SoundEffect>[(int) SoundID.NPCDeathCount];
private SoundEffectInstance[] _soundInstanceNpcKilled = new SoundEffectInstance[(int) SoundID.NPCDeathCount];
private SoundEffectInstance _soundInstanceMoonlordCry;
private Asset<SoundEffect> _soundDoorOpen;
private SoundEffectInstance _soundInstanceDoorOpen;
private Asset<SoundEffect> _soundDoorClosed;
private SoundEffectInstance _soundInstanceDoorClosed;
private Asset<SoundEffect> _soundMenuOpen;
private SoundEffectInstance _soundInstanceMenuOpen;
private Asset<SoundEffect> _soundMenuClose;
private SoundEffectInstance _soundInstanceMenuClose;
private Asset<SoundEffect> _soundMenuTick;
private SoundEffectInstance _soundInstanceMenuTick;
private Asset<SoundEffect> _soundShatter;
private SoundEffectInstance _soundInstanceShatter;
private Asset<SoundEffect> _soundCamera;
private SoundEffectInstance _soundInstanceCamera;
private Asset<SoundEffect>[] _soundZombie = new Asset<SoundEffect>[118];
private SoundEffectInstance[] _soundInstanceZombie = new SoundEffectInstance[118];
private Asset<SoundEffect>[] _soundRoar = new Asset<SoundEffect>[3];
private SoundEffectInstance[] _soundInstanceRoar = new SoundEffectInstance[3];
private Asset<SoundEffect>[] _soundSplash = new Asset<SoundEffect>[2];
private SoundEffectInstance[] _soundInstanceSplash = new SoundEffectInstance[2];
private Asset<SoundEffect> _soundDoubleJump;
private SoundEffectInstance _soundInstanceDoubleJump;
private Asset<SoundEffect> _soundRun;
private SoundEffectInstance _soundInstanceRun;
private Asset<SoundEffect> _soundCoins;
private SoundEffectInstance _soundInstanceCoins;
private Asset<SoundEffect> _soundUnlock;
private SoundEffectInstance _soundInstanceUnlock;
private Asset<SoundEffect> _soundChat;
private SoundEffectInstance _soundInstanceChat;
private Asset<SoundEffect> _soundMaxMana;
private SoundEffectInstance _soundInstanceMaxMana;
private Asset<SoundEffect> _soundDrown;
private SoundEffectInstance _soundInstanceDrown;
private Asset<SoundEffect>[] _trackableSounds;
private SoundEffectInstance[] _trackableSoundInstances;
private readonly IServiceProvider _services;
public LegacySoundPlayer(IServiceProvider services)
{
this._services = services;
this.LoadAll();
}
private void LoadAll()
{
this._soundMech[0] = this.Load("Sounds/Mech_0");
this._soundGrab = this.Load("Sounds/Grab");
this._soundPixie = this.Load("Sounds/Pixie");
this._soundDig[0] = this.Load("Sounds/Dig_0");
this._soundDig[1] = this.Load("Sounds/Dig_1");
this._soundDig[2] = this.Load("Sounds/Dig_2");
this._soundThunder[0] = this.Load("Sounds/Thunder_0");
this._soundThunder[1] = this.Load("Sounds/Thunder_1");
this._soundThunder[2] = this.Load("Sounds/Thunder_2");
this._soundThunder[3] = this.Load("Sounds/Thunder_3");
this._soundThunder[4] = this.Load("Sounds/Thunder_4");
this._soundThunder[5] = this.Load("Sounds/Thunder_5");
this._soundThunder[6] = this.Load("Sounds/Thunder_6");
this._soundResearch[0] = this.Load("Sounds/Research_0");
this._soundResearch[1] = this.Load("Sounds/Research_1");
this._soundResearch[2] = this.Load("Sounds/Research_2");
this._soundResearch[3] = this.Load("Sounds/Research_3");
this._soundTink[0] = this.Load("Sounds/Tink_0");
this._soundTink[1] = this.Load("Sounds/Tink_1");
this._soundTink[2] = this.Load("Sounds/Tink_2");
this._soundPlayerHit[0] = this.Load("Sounds/Player_Hit_0");
this._soundPlayerHit[1] = this.Load("Sounds/Player_Hit_1");
this._soundPlayerHit[2] = this.Load("Sounds/Player_Hit_2");
this._soundFemaleHit[0] = this.Load("Sounds/Female_Hit_0");
this._soundFemaleHit[1] = this.Load("Sounds/Female_Hit_1");
this._soundFemaleHit[2] = this.Load("Sounds/Female_Hit_2");
this._soundPlayerKilled = this.Load("Sounds/Player_Killed");
this._soundChat = this.Load("Sounds/Chat");
this._soundGrass = this.Load("Sounds/Grass");
this._soundDoorOpen = this.Load("Sounds/Door_Opened");
this._soundDoorClosed = this.Load("Sounds/Door_Closed");
this._soundMenuTick = this.Load("Sounds/Menu_Tick");
this._soundMenuOpen = this.Load("Sounds/Menu_Open");
this._soundMenuClose = this.Load("Sounds/Menu_Close");
this._soundShatter = this.Load("Sounds/Shatter");
this._soundCamera = this.Load("Sounds/Camera");
for (int index = 0; index < this._soundCoin.Length; ++index)
this._soundCoin[index] = this.Load("Sounds/Coin_" + (object) index);
for (int index = 0; index < this._soundDrip.Length; ++index)
this._soundDrip[index] = this.Load("Sounds/Drip_" + (object) index);
for (int index = 0; index < this._soundZombie.Length; ++index)
this._soundZombie[index] = this.Load("Sounds/Zombie_" + (object) index);
for (int index = 0; index < this._soundLiquid.Length; ++index)
this._soundLiquid[index] = this.Load("Sounds/Liquid_" + (object) index);
for (int index = 0; index < this._soundRoar.Length; ++index)
this._soundRoar[index] = this.Load("Sounds/Roar_" + (object) index);
this._soundSplash[0] = this.Load("Sounds/Splash_0");
this._soundSplash[1] = this.Load("Sounds/Splash_1");
this._soundDoubleJump = this.Load("Sounds/Double_Jump");
this._soundRun = this.Load("Sounds/Run");
this._soundCoins = this.Load("Sounds/Coins");
this._soundUnlock = this.Load("Sounds/Unlock");
this._soundMaxMana = this.Load("Sounds/MaxMana");
this._soundDrown = this.Load("Sounds/Drown");
for (int index = 1; index < this._soundItem.Length; ++index)
this._soundItem[index] = this.Load("Sounds/Item_" + (object) index);
for (int index = 1; index < this._soundNpcHit.Length; ++index)
this._soundNpcHit[index] = this.Load("Sounds/NPC_Hit_" + (object) index);
for (int index = 1; index < this._soundNpcKilled.Length; ++index)
this._soundNpcKilled[index] = this.Load("Sounds/NPC_Killed_" + (object) index);
this._trackableSounds = new Asset<SoundEffect>[SoundID.TrackableLegacySoundCount];
this._trackableSoundInstances = new SoundEffectInstance[this._trackableSounds.Length];
for (int id = 0; id < this._trackableSounds.Length; ++id)
this._trackableSounds[id] = this.Load("Sounds/Custom" + Path.DirectorySeparatorChar.ToString() + SoundID.GetTrackableLegacySoundPath(id));
}
public void CreateAllSoundInstances()
{
this._soundInstanceMech[0] = this._soundMech[0].Value.CreateInstance();
this._soundInstanceGrab = this._soundGrab.Value.CreateInstance();
this._soundInstancePixie = this._soundGrab.Value.CreateInstance();
this._soundInstanceDig[0] = this._soundDig[0].Value.CreateInstance();
this._soundInstanceDig[1] = this._soundDig[1].Value.CreateInstance();
this._soundInstanceDig[2] = this._soundDig[2].Value.CreateInstance();
this._soundInstanceTink[0] = this._soundTink[0].Value.CreateInstance();
this._soundInstanceTink[1] = this._soundTink[1].Value.CreateInstance();
this._soundInstanceTink[2] = this._soundTink[2].Value.CreateInstance();
this._soundInstancePlayerHit[0] = this._soundPlayerHit[0].Value.CreateInstance();
this._soundInstancePlayerHit[1] = this._soundPlayerHit[1].Value.CreateInstance();
this._soundInstancePlayerHit[2] = this._soundPlayerHit[2].Value.CreateInstance();
this._soundInstanceFemaleHit[0] = this._soundFemaleHit[0].Value.CreateInstance();
this._soundInstanceFemaleHit[1] = this._soundFemaleHit[1].Value.CreateInstance();
this._soundInstanceFemaleHit[2] = this._soundFemaleHit[2].Value.CreateInstance();
this._soundInstancePlayerKilled = this._soundPlayerKilled.Value.CreateInstance();
this._soundInstanceChat = this._soundChat.Value.CreateInstance();
this._soundInstanceGrass = this._soundGrass.Value.CreateInstance();
this._soundInstanceDoorOpen = this._soundDoorOpen.Value.CreateInstance();
this._soundInstanceDoorClosed = this._soundDoorClosed.Value.CreateInstance();
this._soundInstanceMenuTick = this._soundMenuTick.Value.CreateInstance();
this._soundInstanceMenuOpen = this._soundMenuOpen.Value.CreateInstance();
this._soundInstanceMenuClose = this._soundMenuClose.Value.CreateInstance();
this._soundInstanceShatter = this._soundShatter.Value.CreateInstance();
this._soundInstanceCamera = this._soundCamera.Value.CreateInstance();
for (int index = 0; index < this._soundThunder.Length; ++index)
this._soundInstanceThunder[index] = this._soundThunder[index].Value.CreateInstance();
for (int index = 0; index < this._soundResearch.Length; ++index)
this._soundInstanceResearch[index] = this._soundResearch[index].Value.CreateInstance();
for (int index = 0; index < this._soundCoin.Length; ++index)
this._soundInstanceCoin[index] = this._soundCoin[index].Value.CreateInstance();
for (int index = 0; index < this._soundDrip.Length; ++index)
this._soundInstanceDrip[index] = this._soundDrip[index].Value.CreateInstance();
for (int index = 0; index < this._soundZombie.Length; ++index)
this._soundInstanceZombie[index] = this._soundZombie[index].Value.CreateInstance();
for (int index = 0; index < this._soundLiquid.Length; ++index)
this._soundInstanceLiquid[index] = this._soundLiquid[index].Value.CreateInstance();
for (int index = 0; index < this._soundRoar.Length; ++index)
this._soundInstanceRoar[index] = this._soundRoar[index].Value.CreateInstance();
this._soundInstanceSplash[0] = this._soundRoar[0].Value.CreateInstance();
this._soundInstanceSplash[1] = this._soundSplash[1].Value.CreateInstance();
this._soundInstanceDoubleJump = this._soundRoar[0].Value.CreateInstance();
this._soundInstanceRun = this._soundRun.Value.CreateInstance();
this._soundInstanceCoins = this._soundCoins.Value.CreateInstance();
this._soundInstanceUnlock = this._soundUnlock.Value.CreateInstance();
this._soundInstanceMaxMana = this._soundMaxMana.Value.CreateInstance();
this._soundInstanceDrown = this._soundDrown.Value.CreateInstance();
for (int index = 1; index < this._soundItem.Length; ++index)
this._soundInstanceItem[index] = this._soundItem[index].Value.CreateInstance();
for (int index = 1; index < this._soundNpcHit.Length; ++index)
this._soundInstanceNpcHit[index] = this._soundNpcHit[index].Value.CreateInstance();
for (int index = 1; index < this._soundNpcKilled.Length; ++index)
this._soundInstanceNpcKilled[index] = this._soundNpcKilled[index].Value.CreateInstance();
for (int index = 0; index < this._trackableSounds.Length; ++index)
this._trackableSoundInstances[index] = this._trackableSounds[index].Value.CreateInstance();
this._soundInstanceMoonlordCry = this._soundNpcKilled[10].Value.CreateInstance();
}
private Asset<SoundEffect> Load(string assetName) => XnaExtensions.Get<IAssetRepository>(this._services).Request<SoundEffect>(assetName, (AssetRequestMode) 2);
public SoundEffectInstance PlaySound(
int type,
int x = -1,
int y = -1,
int Style = 1,
float volumeScale = 1f,
float pitchOffset = 0.0f)
{
int index1 = Style;
try
{
if (Main.dedServ || (double) Main.soundVolume == 0.0 && (type < 30 || type > 35))
return (SoundEffectInstance) null;
bool flag = false;
float num1 = 1f;
float num2 = 0.0f;
if (x == -1 || y == -1)
{
flag = true;
}
else
{
if (WorldGen.gen || Main.netMode == 2)
return (SoundEffectInstance) null;
Vector2 vector2 = new Vector2(Main.screenPosition.X + (float) Main.screenWidth * 0.5f, Main.screenPosition.Y + (float) Main.screenHeight * 0.5f);
double num3 = (double) Math.Abs((float) x - vector2.X);
float num4 = Math.Abs((float) y - vector2.Y);
float num5 = (float) Math.Sqrt(num3 * num3 + (double) num4 * (double) num4);
int num6 = 2500;
if ((double) num5 < (double) num6)
{
flag = true;
num2 = type != 43 ? (float) (((double) x - (double) vector2.X) / ((double) Main.screenWidth * 0.5)) : (float) (((double) x - (double) vector2.X) / 900.0);
num1 = (float) (1.0 - (double) num5 / (double) num6);
}
}
if ((double) num2 < -1.0)
num2 = -1f;
if ((double) num2 > 1.0)
num2 = 1f;
if ((double) num1 > 1.0)
num1 = 1f;
if ((double) num1 <= 0.0 && (type < 34 || type > 35 || type > 39))
return (SoundEffectInstance) null;
if (flag)
{
float num7;
if (type >= 30 && type <= 35 || type == 39)
{
num7 = num1 * (Main.ambientVolume * (Main.gameInactive ? 0.0f : 1f));
if (Main.gameMenu)
num7 = 0.0f;
}
else
num7 = num1 * Main.soundVolume;
if ((double) num7 > 1.0)
num7 = 1f;
if ((double) num7 <= 0.0 && (type < 30 || type > 35) && type != 39)
return (SoundEffectInstance) null;
SoundEffectInstance sound = (SoundEffectInstance) null;
if (type == 0)
{
int index2 = Main.rand.Next(3);
if (this._soundInstanceDig[index2] != null)
this._soundInstanceDig[index2].Stop();
this._soundInstanceDig[index2] = this._soundDig[index2].Value.CreateInstance();
this._soundInstanceDig[index2].Volume = num7;
this._soundInstanceDig[index2].Pan = num2;
this._soundInstanceDig[index2].Pitch = (float) Main.rand.Next(-10, 11) * 0.01f;
sound = this._soundInstanceDig[index2];
}
else if (type == 43)
{
int index3 = Main.rand.Next(this._soundThunder.Length);
for (int index4 = 0; index4 < this._soundThunder.Length && this._soundInstanceThunder[index3] != null && this._soundInstanceThunder[index3].State == SoundState.Playing; ++index4)
index3 = Main.rand.Next(this._soundThunder.Length);
if (this._soundInstanceThunder[index3] != null)
this._soundInstanceThunder[index3].Stop();
this._soundInstanceThunder[index3] = this._soundThunder[index3].Value.CreateInstance();
this._soundInstanceThunder[index3].Volume = num7;
this._soundInstanceThunder[index3].Pan = num2;
this._soundInstanceThunder[index3].Pitch = (float) Main.rand.Next(-10, 11) * 0.01f;
sound = this._soundInstanceThunder[index3];
}
else if (type == 63)
{
int index5 = Main.rand.Next(1, 4);
if (this._soundInstanceResearch[index5] != null)
this._soundInstanceResearch[index5].Stop();
this._soundInstanceResearch[index5] = this._soundResearch[index5].Value.CreateInstance();
this._soundInstanceResearch[index5].Volume = num7;
this._soundInstanceResearch[index5].Pan = num2;
sound = this._soundInstanceResearch[index5];
}
else if (type == 64)
{
if (this._soundInstanceResearch[0] != null)
this._soundInstanceResearch[0].Stop();
this._soundInstanceResearch[0] = this._soundResearch[0].Value.CreateInstance();
this._soundInstanceResearch[0].Volume = num7;
this._soundInstanceResearch[0].Pan = num2;
sound = this._soundInstanceResearch[0];
}
else if (type == 1)
{
int index6 = Main.rand.Next(3);
if (this._soundInstancePlayerHit[index6] != null)
this._soundInstancePlayerHit[index6].Stop();
this._soundInstancePlayerHit[index6] = this._soundPlayerHit[index6].Value.CreateInstance();
this._soundInstancePlayerHit[index6].Volume = num7;
this._soundInstancePlayerHit[index6].Pan = num2;
sound = this._soundInstancePlayerHit[index6];
}
else if (type == 2)
{
if (index1 == 129)
num7 *= 0.6f;
if (index1 == 123)
num7 *= 0.5f;
if (index1 == 124 || index1 == 125)
num7 *= 0.65f;
if (index1 == 116)
num7 *= 0.5f;
if (index1 == 1)
{
int num8 = Main.rand.Next(3);
if (num8 == 1)
index1 = 18;
if (num8 == 2)
index1 = 19;
}
else if (index1 == 55 || index1 == 53)
{
num7 *= 0.75f;
if (index1 == 55)
num7 *= 0.75f;
if (this._soundInstanceItem[index1] != null && this._soundInstanceItem[index1].State == SoundState.Playing)
return (SoundEffectInstance) null;
}
else if (index1 == 37)
num7 *= 0.5f;
else if (index1 == 52)
num7 *= 0.35f;
else if (index1 == 157)
num7 *= 0.7f;
else if (index1 == 158)
num7 *= 0.8f;
if (index1 == 159)
{
if (this._soundInstanceItem[index1] != null && this._soundInstanceItem[index1].State == SoundState.Playing)
return (SoundEffectInstance) null;
num7 *= 0.75f;
}
else if (index1 != 9 && index1 != 10 && index1 != 24 && index1 != 26 && index1 != 34 && index1 != 43 && index1 != 103 && index1 != 156 && index1 != 162 && this._soundInstanceItem[index1] != null)
this._soundInstanceItem[index1].Stop();
this._soundInstanceItem[index1] = this._soundItem[index1].Value.CreateInstance();
this._soundInstanceItem[index1].Volume = num7;
this._soundInstanceItem[index1].Pan = num2;
switch (index1)
{
case 53:
this._soundInstanceItem[index1].Pitch = (float) Main.rand.Next(-20, -11) * 0.02f;
break;
case 55:
this._soundInstanceItem[index1].Pitch = (float) -Main.rand.Next(-20, -11) * 0.02f;
break;
case 132:
this._soundInstanceItem[index1].Pitch = (float) Main.rand.Next(-20, 21) * (1f / 1000f);
break;
case 153:
this._soundInstanceItem[index1].Pitch = (float) Main.rand.Next(-50, 51) * (3f / 1000f);
break;
case 156:
this._soundInstanceItem[index1].Pitch = (float) Main.rand.Next(-50, 51) * (1f / 500f);
this._soundInstanceItem[index1].Volume *= 0.6f;
break;
default:
this._soundInstanceItem[index1].Pitch = (float) Main.rand.Next(-6, 7) * 0.01f;
break;
}
if (index1 == 26 || index1 == 35 || index1 == 47)
{
this._soundInstanceItem[index1].Volume = num7 * 0.75f;
this._soundInstanceItem[index1].Pitch = Main.musicPitch;
}
if (index1 == 169)
this._soundInstanceItem[index1].Pitch -= 0.8f;
sound = this._soundInstanceItem[index1];
}
else if (type == 3)
{
if (index1 >= 20 && index1 <= 54)
num7 *= 0.5f;
if (index1 == 57 && this._soundInstanceNpcHit[index1] != null && this._soundInstanceNpcHit[index1].State == SoundState.Playing)
return (SoundEffectInstance) null;
if (index1 == 57)
num7 *= 0.6f;
if (index1 == 55 || index1 == 56)
num7 *= 0.5f;
if (this._soundInstanceNpcHit[index1] != null)
this._soundInstanceNpcHit[index1].Stop();
this._soundInstanceNpcHit[index1] = this._soundNpcHit[index1].Value.CreateInstance();
this._soundInstanceNpcHit[index1].Volume = num7;
this._soundInstanceNpcHit[index1].Pan = num2;
this._soundInstanceNpcHit[index1].Pitch = (float) Main.rand.Next(-10, 11) * 0.01f;
sound = this._soundInstanceNpcHit[index1];
}
else if (type == 4)
{
if (index1 >= 23 && index1 <= 57)
num7 *= 0.5f;
if (index1 == 61)
num7 *= 0.6f;
if (index1 == 62)
num7 *= 0.6f;
if (index1 == 10 && this._soundInstanceNpcKilled[index1] != null && this._soundInstanceNpcKilled[index1].State == SoundState.Playing)
return (SoundEffectInstance) null;
this._soundInstanceNpcKilled[index1] = this._soundNpcKilled[index1].Value.CreateInstance();
this._soundInstanceNpcKilled[index1].Volume = num7;
this._soundInstanceNpcKilled[index1].Pan = num2;
this._soundInstanceNpcKilled[index1].Pitch = (float) Main.rand.Next(-10, 11) * 0.01f;
sound = this._soundInstanceNpcKilled[index1];
}
else if (type == 5)
{
if (this._soundInstancePlayerKilled != null)
this._soundInstancePlayerKilled.Stop();
this._soundInstancePlayerKilled = this._soundPlayerKilled.Value.CreateInstance();
this._soundInstancePlayerKilled.Volume = num7;
this._soundInstancePlayerKilled.Pan = num2;
sound = this._soundInstancePlayerKilled;
}
else if (type == 6)
{
if (this._soundInstanceGrass != null)
this._soundInstanceGrass.Stop();
this._soundInstanceGrass = this._soundGrass.Value.CreateInstance();
this._soundInstanceGrass.Volume = num7;
this._soundInstanceGrass.Pan = num2;
this._soundInstanceGrass.Pitch = (float) Main.rand.Next(-30, 31) * 0.01f;
sound = this._soundInstanceGrass;
}
else if (type == 7)
{
if (this._soundInstanceGrab != null)
this._soundInstanceGrab.Stop();
this._soundInstanceGrab = this._soundGrab.Value.CreateInstance();
this._soundInstanceGrab.Volume = num7;
this._soundInstanceGrab.Pan = num2;
this._soundInstanceGrab.Pitch = (float) Main.rand.Next(-10, 11) * 0.01f;
sound = this._soundInstanceGrab;
}
else if (type == 8)
{
if (this._soundInstanceDoorOpen != null)
this._soundInstanceDoorOpen.Stop();
this._soundInstanceDoorOpen = this._soundDoorOpen.Value.CreateInstance();
this._soundInstanceDoorOpen.Volume = num7;
this._soundInstanceDoorOpen.Pan = num2;
this._soundInstanceDoorOpen.Pitch = (float) Main.rand.Next(-20, 21) * 0.01f;
sound = this._soundInstanceDoorOpen;
}
else if (type == 9)
{
if (this._soundInstanceDoorClosed != null)
this._soundInstanceDoorClosed.Stop();
this._soundInstanceDoorClosed = this._soundDoorClosed.Value.CreateInstance();
this._soundInstanceDoorClosed.Volume = num7;
this._soundInstanceDoorClosed.Pan = num2;
this._soundInstanceDoorClosed.Pitch = (float) Main.rand.Next(-20, 21) * 0.01f;
sound = this._soundInstanceDoorClosed;
}
else if (type == 10)
{
if (this._soundInstanceMenuOpen != null)
this._soundInstanceMenuOpen.Stop();
this._soundInstanceMenuOpen = this._soundMenuOpen.Value.CreateInstance();
this._soundInstanceMenuOpen.Volume = num7;
this._soundInstanceMenuOpen.Pan = num2;
sound = this._soundInstanceMenuOpen;
}
else if (type == 11)
{
if (this._soundInstanceMenuClose != null)
this._soundInstanceMenuClose.Stop();
this._soundInstanceMenuClose = this._soundMenuClose.Value.CreateInstance();
this._soundInstanceMenuClose.Volume = num7;
this._soundInstanceMenuClose.Pan = num2;
sound = this._soundInstanceMenuClose;
}
else if (type == 12)
{
if (Main.hasFocus)
{
if (this._soundInstanceMenuTick != null)
this._soundInstanceMenuTick.Stop();
this._soundInstanceMenuTick = this._soundMenuTick.Value.CreateInstance();
this._soundInstanceMenuTick.Volume = num7;
this._soundInstanceMenuTick.Pan = num2;
sound = this._soundInstanceMenuTick;
}
}
else if (type == 13)
{
if (this._soundInstanceShatter != null)
this._soundInstanceShatter.Stop();
this._soundInstanceShatter = this._soundShatter.Value.CreateInstance();
this._soundInstanceShatter.Volume = num7;
this._soundInstanceShatter.Pan = num2;
sound = this._soundInstanceShatter;
}
else if (type == 14)
{
switch (Style)
{
case 489:
case 586:
int index7 = Main.rand.Next(21, 24);
this._soundInstanceZombie[index7] = this._soundZombie[index7].Value.CreateInstance();
this._soundInstanceZombie[index7].Volume = num7 * 0.4f;
this._soundInstanceZombie[index7].Pan = num2;
sound = this._soundInstanceZombie[index7];
break;
case 542:
int index8 = 7;
this._soundInstanceZombie[index8] = this._soundZombie[index8].Value.CreateInstance();
this._soundInstanceZombie[index8].Volume = num7 * 0.4f;
this._soundInstanceZombie[index8].Pan = num2;
sound = this._soundInstanceZombie[index8];
break;
default:
int index9 = Main.rand.Next(3);
this._soundInstanceZombie[index9] = this._soundZombie[index9].Value.CreateInstance();
this._soundInstanceZombie[index9].Volume = num7 * 0.4f;
this._soundInstanceZombie[index9].Pan = num2;
sound = this._soundInstanceZombie[index9];
break;
}
}
else if (type == 15)
{
float num9 = 1f;
if (index1 == 4)
{
index1 = 1;
num9 = 0.25f;
}
if (this._soundInstanceRoar[index1] == null || this._soundInstanceRoar[index1].State == SoundState.Stopped)
{
this._soundInstanceRoar[index1] = this._soundRoar[index1].Value.CreateInstance();
this._soundInstanceRoar[index1].Volume = num7 * num9;
this._soundInstanceRoar[index1].Pan = num2;
sound = this._soundInstanceRoar[index1];
}
}
else if (type == 16)
{
if (this._soundInstanceDoubleJump != null)
this._soundInstanceDoubleJump.Stop();
this._soundInstanceDoubleJump = this._soundDoubleJump.Value.CreateInstance();
this._soundInstanceDoubleJump.Volume = num7;
this._soundInstanceDoubleJump.Pan = num2;
this._soundInstanceDoubleJump.Pitch = (float) Main.rand.Next(-10, 11) * 0.01f;
sound = this._soundInstanceDoubleJump;
}
else if (type == 17)
{
if (this._soundInstanceRun != null)
this._soundInstanceRun.Stop();
this._soundInstanceRun = this._soundRun.Value.CreateInstance();
this._soundInstanceRun.Volume = num7;
this._soundInstanceRun.Pan = num2;
this._soundInstanceRun.Pitch = (float) Main.rand.Next(-10, 11) * 0.01f;
sound = this._soundInstanceRun;
}
else if (type == 18)
{
this._soundInstanceCoins = this._soundCoins.Value.CreateInstance();
this._soundInstanceCoins.Volume = num7;
this._soundInstanceCoins.Pan = num2;
sound = this._soundInstanceCoins;
}
else if (type == 19)
{
if (this._soundInstanceSplash[index1] == null || this._soundInstanceSplash[index1].State == SoundState.Stopped)
{
this._soundInstanceSplash[index1] = this._soundSplash[index1].Value.CreateInstance();
this._soundInstanceSplash[index1].Volume = num7;
this._soundInstanceSplash[index1].Pan = num2;
this._soundInstanceSplash[index1].Pitch = (float) Main.rand.Next(-10, 11) * 0.01f;
sound = this._soundInstanceSplash[index1];
}
}
else if (type == 20)
{
int index10 = Main.rand.Next(3);
if (this._soundInstanceFemaleHit[index10] != null)
this._soundInstanceFemaleHit[index10].Stop();
this._soundInstanceFemaleHit[index10] = this._soundFemaleHit[index10].Value.CreateInstance();
this._soundInstanceFemaleHit[index10].Volume = num7;
this._soundInstanceFemaleHit[index10].Pan = num2;
sound = this._soundInstanceFemaleHit[index10];
}
else if (type == 21)
{
int index11 = Main.rand.Next(3);
if (this._soundInstanceTink[index11] != null)
this._soundInstanceTink[index11].Stop();
this._soundInstanceTink[index11] = this._soundTink[index11].Value.CreateInstance();
this._soundInstanceTink[index11].Volume = num7;
this._soundInstanceTink[index11].Pan = num2;
sound = this._soundInstanceTink[index11];
}
else if (type == 22)
{
if (this._soundInstanceUnlock != null)
this._soundInstanceUnlock.Stop();
this._soundInstanceUnlock = this._soundUnlock.Value.CreateInstance();
this._soundInstanceUnlock.Volume = num7;
this._soundInstanceUnlock.Pan = num2;
sound = this._soundInstanceUnlock;
}
else if (type == 23)
{
if (this._soundInstanceDrown != null)
this._soundInstanceDrown.Stop();
this._soundInstanceDrown = this._soundDrown.Value.CreateInstance();
this._soundInstanceDrown.Volume = num7;
this._soundInstanceDrown.Pan = num2;
sound = this._soundInstanceDrown;
}
else if (type == 24)
{
this._soundInstanceChat = this._soundChat.Value.CreateInstance();
this._soundInstanceChat.Volume = num7;
this._soundInstanceChat.Pan = num2;
sound = this._soundInstanceChat;
}
else if (type == 25)
{
this._soundInstanceMaxMana = this._soundMaxMana.Value.CreateInstance();
this._soundInstanceMaxMana.Volume = num7;
this._soundInstanceMaxMana.Pan = num2;
sound = this._soundInstanceMaxMana;
}
else if (type == 26)
{
int index12 = Main.rand.Next(3, 5);
this._soundInstanceZombie[index12] = this._soundZombie[index12].Value.CreateInstance();
this._soundInstanceZombie[index12].Volume = num7 * 0.9f;
this._soundInstanceZombie[index12].Pan = num2;
this._soundInstanceZombie[index12].Pitch = (float) Main.rand.Next(-10, 11) * 0.01f;
sound = this._soundInstanceZombie[index12];
}
else if (type == 27)
{
if (this._soundInstancePixie != null && this._soundInstancePixie.State == SoundState.Playing)
{
this._soundInstancePixie.Volume = num7;
this._soundInstancePixie.Pan = num2;
this._soundInstancePixie.Pitch = (float) Main.rand.Next(-10, 11) * 0.01f;
return (SoundEffectInstance) null;
}
if (this._soundInstancePixie != null)
this._soundInstancePixie.Stop();
this._soundInstancePixie = this._soundPixie.Value.CreateInstance();
this._soundInstancePixie.Volume = num7;
this._soundInstancePixie.Pan = num2;
this._soundInstancePixie.Pitch = (float) Main.rand.Next(-10, 11) * 0.01f;
sound = this._soundInstancePixie;
}
else if (type == 28)
{
if (this._soundInstanceMech[index1] != null && this._soundInstanceMech[index1].State == SoundState.Playing)
return (SoundEffectInstance) null;
this._soundInstanceMech[index1] = this._soundMech[index1].Value.CreateInstance();
this._soundInstanceMech[index1].Volume = num7;
this._soundInstanceMech[index1].Pan = num2;
this._soundInstanceMech[index1].Pitch = (float) Main.rand.Next(-10, 11) * 0.01f;
sound = this._soundInstanceMech[index1];
}
else if (type == 29)
{
if (index1 >= 24 && index1 <= 87)
num7 *= 0.5f;
if (index1 >= 88 && index1 <= 91)
num7 *= 0.7f;
if (index1 >= 93 && index1 <= 99)
num7 *= 0.4f;
if (index1 == 92)
num7 *= 0.5f;
if (index1 == 103)
num7 *= 0.4f;
if (index1 == 104)
num7 *= 0.55f;
if (index1 == 100 || index1 == 101)
num7 *= 0.25f;
if (index1 == 102)
num7 *= 0.4f;
if (this._soundInstanceZombie[index1] != null && this._soundInstanceZombie[index1].State == SoundState.Playing)
return (SoundEffectInstance) null;
this._soundInstanceZombie[index1] = this._soundZombie[index1].Value.CreateInstance();
this._soundInstanceZombie[index1].Volume = num7;
this._soundInstanceZombie[index1].Pan = num2;
this._soundInstanceZombie[index1].Pitch = (float) Main.rand.Next(-10, 11) * 0.01f;
sound = this._soundInstanceZombie[index1];
}
else if (type == 44)
{
int index13 = Main.rand.Next(106, 109);
this._soundInstanceZombie[index13] = this._soundZombie[index13].Value.CreateInstance();
this._soundInstanceZombie[index13].Volume = num7 * 0.2f;
this._soundInstanceZombie[index13].Pan = num2;
this._soundInstanceZombie[index13].Pitch = (float) Main.rand.Next(-70, 1) * 0.01f;
sound = this._soundInstanceZombie[index13];
}
else if (type == 45)
{
int index14 = 109;
if (this._soundInstanceZombie[index14] != null && this._soundInstanceZombie[index14].State == SoundState.Playing)
return (SoundEffectInstance) null;
this._soundInstanceZombie[index14] = this._soundZombie[index14].Value.CreateInstance();
this._soundInstanceZombie[index14].Volume = num7 * 0.3f;
this._soundInstanceZombie[index14].Pan = num2;
this._soundInstanceZombie[index14].Pitch = (float) Main.rand.Next(-10, 11) * 0.01f;
sound = this._soundInstanceZombie[index14];
}
else if (type == 46)
{
if (this._soundInstanceZombie[110] != null && this._soundInstanceZombie[110].State == SoundState.Playing || this._soundInstanceZombie[111] != null && this._soundInstanceZombie[111].State == SoundState.Playing)
return (SoundEffectInstance) null;
int index15 = Main.rand.Next(110, 112);
if (Main.rand.Next(300) == 0)
index15 = Main.rand.Next(3) != 0 ? (Main.rand.Next(2) != 0 ? 112 : 113) : 114;
this._soundInstanceZombie[index15] = this._soundZombie[index15].Value.CreateInstance();
this._soundInstanceZombie[index15].Volume = num7 * 0.9f;
this._soundInstanceZombie[index15].Pan = num2;
this._soundInstanceZombie[index15].Pitch = (float) Main.rand.Next(-10, 11) * 0.01f;
sound = this._soundInstanceZombie[index15];
}
else if (type == 45)
{
int index16 = 109;
this._soundInstanceZombie[index16] = this._soundZombie[index16].Value.CreateInstance();
this._soundInstanceZombie[index16].Volume = num7 * 0.2f;
this._soundInstanceZombie[index16].Pan = num2;
this._soundInstanceZombie[index16].Pitch = (float) Main.rand.Next(-70, 1) * 0.01f;
sound = this._soundInstanceZombie[index16];
}
else if (type == 30)
{
int index17 = Main.rand.Next(10, 12);
if (Main.rand.Next(300) == 0)
{
index17 = 12;
if (this._soundInstanceZombie[index17] != null && this._soundInstanceZombie[index17].State == SoundState.Playing)
return (SoundEffectInstance) null;
}
this._soundInstanceZombie[index17] = this._soundZombie[index17].Value.CreateInstance();
this._soundInstanceZombie[index17].Volume = num7 * 0.75f;
this._soundInstanceZombie[index17].Pan = num2;
this._soundInstanceZombie[index17].Pitch = index17 == 12 ? (float) Main.rand.Next(-40, 21) * 0.01f : (float) Main.rand.Next(-70, 1) * 0.01f;
sound = this._soundInstanceZombie[index17];
}
else if (type == 31)
{
int index18 = 13;
this._soundInstanceZombie[index18] = this._soundZombie[index18].Value.CreateInstance();
this._soundInstanceZombie[index18].Volume = num7 * 0.35f;
this._soundInstanceZombie[index18].Pan = num2;
this._soundInstanceZombie[index18].Pitch = (float) Main.rand.Next(-40, 21) * 0.01f;
sound = this._soundInstanceZombie[index18];
}
else if (type == 32)
{
if (this._soundInstanceZombie[index1] != null && this._soundInstanceZombie[index1].State == SoundState.Playing)
return (SoundEffectInstance) null;
this._soundInstanceZombie[index1] = this._soundZombie[index1].Value.CreateInstance();
this._soundInstanceZombie[index1].Volume = num7 * 0.15f;
this._soundInstanceZombie[index1].Pan = num2;
this._soundInstanceZombie[index1].Pitch = (float) Main.rand.Next(-70, 26) * 0.01f;
sound = this._soundInstanceZombie[index1];
}
else if (type == 33)
{
int index19 = 15;
if (this._soundInstanceZombie[index19] != null && this._soundInstanceZombie[index19].State == SoundState.Playing)
return (SoundEffectInstance) null;
this._soundInstanceZombie[index19] = this._soundZombie[index19].Value.CreateInstance();
this._soundInstanceZombie[index19].Volume = num7 * 0.2f;
this._soundInstanceZombie[index19].Pan = num2;
this._soundInstanceZombie[index19].Pitch = (float) Main.rand.Next(-10, 31) * 0.01f;
sound = this._soundInstanceZombie[index19];
}
else if (type >= 47 && type <= 52)
{
int index20 = 133 + type - 47;
for (int index21 = 133; index21 <= 138; ++index21)
{
if (this._soundInstanceItem[index21] != null && this._soundInstanceItem[index21].State == SoundState.Playing)
this._soundInstanceItem[index21].Stop();
}
this._soundInstanceItem[index20] = this._soundItem[index20].Value.CreateInstance();
this._soundInstanceItem[index20].Volume = num7 * 0.45f;
this._soundInstanceItem[index20].Pan = num2;
sound = this._soundInstanceItem[index20];
}
else if (type >= 53 && type <= 62)
{
int index22 = 139 + type - 53;
if (this._soundInstanceItem[index22] != null && this._soundInstanceItem[index22].State == SoundState.Playing)
this._soundInstanceItem[index22].Stop();
this._soundInstanceItem[index22] = this._soundItem[index22].Value.CreateInstance();
this._soundInstanceItem[index22].Volume = num7 * 0.7f;
this._soundInstanceItem[index22].Pan = num2;
sound = this._soundInstanceItem[index22];
}
else
{
switch (type)
{
case 34:
float num10 = (float) index1 / 50f;
if ((double) num10 > 1.0)
num10 = 1f;
float num11 = num7 * num10 * 0.2f;
if ((double) num11 <= 0.0 || x == -1 || y == -1)
{
if (this._soundInstanceLiquid[0] != null && this._soundInstanceLiquid[0].State == SoundState.Playing)
{
this._soundInstanceLiquid[0].Stop();
break;
}
break;
}
if (this._soundInstanceLiquid[0] != null && this._soundInstanceLiquid[0].State == SoundState.Playing)
{
this._soundInstanceLiquid[0].Volume = num11;
this._soundInstanceLiquid[0].Pan = num2;
this._soundInstanceLiquid[0].Pitch = -0.2f;
break;
}
this._soundInstanceLiquid[0] = this._soundLiquid[0].Value.CreateInstance();
this._soundInstanceLiquid[0].Volume = num11;
this._soundInstanceLiquid[0].Pan = num2;
sound = this._soundInstanceLiquid[0];
break;
case 35:
float num12 = (float) index1 / 50f;
if ((double) num12 > 1.0)
num12 = 1f;
float num13 = num7 * num12 * 0.65f;
if ((double) num13 <= 0.0 || x == -1 || y == -1)
{
if (this._soundInstanceLiquid[1] != null && this._soundInstanceLiquid[1].State == SoundState.Playing)
{
this._soundInstanceLiquid[1].Stop();
break;
}
break;
}
if (this._soundInstanceLiquid[1] != null && this._soundInstanceLiquid[1].State == SoundState.Playing)
{
this._soundInstanceLiquid[1].Volume = num13;
this._soundInstanceLiquid[1].Pan = num2;
this._soundInstanceLiquid[1].Pitch = -0.0f;
break;
}
this._soundInstanceLiquid[1] = this._soundLiquid[1].Value.CreateInstance();
this._soundInstanceLiquid[1].Volume = num13;
this._soundInstanceLiquid[1].Pan = num2;
sound = this._soundInstanceLiquid[1];
break;
case 36:
int index23 = Style;
if (Style == -1)
index23 = 0;
this._soundInstanceRoar[index23] = this._soundRoar[index23].Value.CreateInstance();
this._soundInstanceRoar[index23].Volume = num7;
this._soundInstanceRoar[index23].Pan = num2;
if (Style == -1)
this._soundInstanceRoar[index23].Pitch += 0.6f;
sound = this._soundInstanceRoar[index23];
break;
case 37:
int index24 = Main.rand.Next(57, 59);
float num14 = num7 * ((float) Style * 0.05f);
this._soundInstanceItem[index24] = this._soundItem[index24].Value.CreateInstance();
this._soundInstanceItem[index24].Volume = num14;
this._soundInstanceItem[index24].Pan = num2;
this._soundInstanceItem[index24].Pitch = (float) Main.rand.Next(-40, 41) * 0.01f;
sound = this._soundInstanceItem[index24];
break;
case 38:
int index25 = Main.rand.Next(5);
this._soundInstanceCoin[index25] = this._soundCoin[index25].Value.CreateInstance();
this._soundInstanceCoin[index25].Volume = num7;
this._soundInstanceCoin[index25].Pan = num2;
this._soundInstanceCoin[index25].Pitch = (float) Main.rand.Next(-40, 41) * (1f / 500f);
sound = this._soundInstanceCoin[index25];
break;
case 39:
int index26 = Style;
this._soundInstanceDrip[index26] = this._soundDrip[index26].Value.CreateInstance();
this._soundInstanceDrip[index26].Volume = num7 * 0.5f;
this._soundInstanceDrip[index26].Pan = num2;
this._soundInstanceDrip[index26].Pitch = (float) Main.rand.Next(-30, 31) * 0.01f;
sound = this._soundInstanceDrip[index26];
break;
case 40:
if (this._soundInstanceCamera != null)
this._soundInstanceCamera.Stop();
this._soundInstanceCamera = this._soundCamera.Value.CreateInstance();
this._soundInstanceCamera.Volume = num7;
this._soundInstanceCamera.Pan = num2;
sound = this._soundInstanceCamera;
break;
case 41:
this._soundInstanceMoonlordCry = this._soundNpcKilled[10].Value.CreateInstance();
this._soundInstanceMoonlordCry.Volume = (float) (1.0 / (1.0 + (double) (new Vector2((float) x, (float) y) - Main.player[Main.myPlayer].position).Length()));
this._soundInstanceMoonlordCry.Pan = num2;
this._soundInstanceMoonlordCry.Pitch = (float) Main.rand.Next(-10, 11) * 0.01f;
sound = this._soundInstanceMoonlordCry;
break;
case 42:
sound = this._trackableSounds[index1].Value.CreateInstance();
sound.Volume = num7;
sound.Pan = num2;
this._trackableSoundInstances[index1] = sound;
break;
case 65:
if (this._soundInstanceZombie[115] != null && this._soundInstanceZombie[115].State == SoundState.Playing || this._soundInstanceZombie[116] != null && this._soundInstanceZombie[116].State == SoundState.Playing || this._soundInstanceZombie[117] != null && this._soundInstanceZombie[117].State == SoundState.Playing)
return (SoundEffectInstance) null;
int index27 = Main.rand.Next(115, 118);
this._soundInstanceZombie[index27] = this._soundZombie[index27].Value.CreateInstance();
this._soundInstanceZombie[index27].Volume = num7 * 0.5f;
this._soundInstanceZombie[index27].Pan = num2;
sound = this._soundInstanceZombie[index27];
break;
}
}
if (sound != null)
{
sound.Pitch += pitchOffset;
sound.Volume *= volumeScale;
sound.Play();
SoundInstanceGarbageCollector.Track(sound);
}
return sound;
}
}
catch
{
}
return (SoundEffectInstance) null;
}
public SoundEffect GetTrackableSoundByStyleId(int id) => this._trackableSounds[id].Value;
public void StopAmbientSounds()
{
for (int index = 0; index < this._soundInstanceLiquid.Length; ++index)
{
if (this._soundInstanceLiquid[index] != null)
this._soundInstanceLiquid[index].Stop();
}
}
}
}

View file

@ -1,7 +1,7 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.Audio.LegacySoundStyle
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly: 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;
@ -11,29 +11,33 @@ namespace Terraria.Audio
{
public class LegacySoundStyle : SoundStyle
{
private static readonly UnifiedRandom Random = new UnifiedRandom();
private readonly int _style;
public readonly int Variations;
public readonly int SoundId;
private static UnifiedRandom _random = new UnifiedRandom();
private int _style;
private int _styleVariations;
private int _soundId;
public int Style => this.Variations != 1 ? LegacySoundStyle.Random.Next(this._style, this._style + this.Variations) : this._style;
public int Style => this._styleVariations != 1 ? LegacySoundStyle._random.Next(this._style, this._style + this._styleVariations) : this._style;
public override bool IsTrackable => this.SoundId == 42;
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.Variations = 1;
this.SoundId = soundId;
this._styleVariations = 1;
this._soundId = soundId;
}
public LegacySoundStyle(int soundId, int style, int variations, SoundType type = SoundType.Sound)
: base(type)
{
this._style = style;
this.Variations = variations;
this.SoundId = soundId;
this._styleVariations = variations;
this._soundId = soundId;
}
private LegacySoundStyle(
@ -46,22 +50,22 @@ namespace Terraria.Audio
: base(volume, pitchVariance, type)
{
this._style = style;
this.Variations = variations;
this.SoundId = soundId;
this._styleVariations = variations;
this._soundId = soundId;
}
public LegacySoundStyle WithVolume(float volume) => new LegacySoundStyle(this.SoundId, this._style, this.Variations, this.Type, volume, this.PitchVariance);
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.Variations, this.Type, this.Volume, 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.Variations, SoundType.Music, this.Volume, this.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.Variations, SoundType.Ambient, 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.Variations, SoundType.Sound, 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.Variations;
public bool Includes(int soundId, int style) => this._soundId == soundId && style >= this._style && style < this._style + this._styleVariations;
public override SoundEffect GetRandomSound() => this.IsTrackable ? SoundEngine.GetTrackableSoundByStyleId(this.Style) : (SoundEffect) null;
public override SoundEffect GetRandomSound() => this.IsTrackable ? Main.trackableSounds[this.Style] : (SoundEffect) null;
}
}

View file

@ -1,287 +0,0 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.Audio.SoundEngine
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using ReLogic.Utilities;
using System;
using System.IO;
namespace Terraria.Audio
{
public static class SoundEngine
{
private static LegacySoundPlayer _legacyPlayer;
private static SoundPlayer _player;
private static bool _areSoundsPaused;
public static bool IsAudioSupported { get; private set; }
public static void Initialize() => SoundEngine.IsAudioSupported = SoundEngine.TestAudioSupport();
public static void Load(IServiceProvider services)
{
if (!SoundEngine.IsAudioSupported)
return;
SoundEngine._legacyPlayer = new LegacySoundPlayer(services);
SoundEngine._player = new SoundPlayer();
}
public static void Update()
{
if (!SoundEngine.IsAudioSupported)
return;
SoundInstanceGarbageCollector.Update();
bool flag = (!Main.hasFocus || Main.gamePaused) && Main.netMode == 0;
if (!SoundEngine._areSoundsPaused & flag)
SoundEngine._player.PauseAll();
else if (SoundEngine._areSoundsPaused && !flag)
SoundEngine._player.ResumeAll();
SoundEngine._areSoundsPaused = flag;
SoundEngine._player.Update();
}
public static void PlaySound(int type, Vector2 position, int style = 1) => SoundEngine.PlaySound(type, (int) position.X, (int) position.Y, style);
public static SoundEffectInstance PlaySound(
LegacySoundStyle type,
Vector2 position)
{
return SoundEngine.PlaySound(type, (int) position.X, (int) position.Y);
}
public static SoundEffectInstance PlaySound(
LegacySoundStyle type,
int x = -1,
int y = -1)
{
return type == null ? (SoundEffectInstance) null : SoundEngine.PlaySound(type.SoundId, x, y, type.Style, type.Volume, type.GetRandomPitch());
}
public static SoundEffectInstance PlaySound(
int type,
int x = -1,
int y = -1,
int Style = 1,
float volumeScale = 1f,
float pitchOffset = 0.0f)
{
return !SoundEngine.IsAudioSupported ? (SoundEffectInstance) null : SoundEngine._legacyPlayer.PlaySound(type, x, y, Style, volumeScale, pitchOffset);
}
public static ActiveSound GetActiveSound(SlotId id) => !SoundEngine.IsAudioSupported ? (ActiveSound) null : SoundEngine._player.GetActiveSound(id);
public static SlotId PlayTrackedSound(SoundStyle style, Vector2 position) => !SoundEngine.IsAudioSupported ? (SlotId) SlotId.Invalid : SoundEngine._player.Play(style, position);
public static SlotId PlayTrackedSound(SoundStyle style) => !SoundEngine.IsAudioSupported ? (SlotId) SlotId.Invalid : SoundEngine._player.Play(style);
public static void StopTrackedSounds()
{
if (!SoundEngine.IsAudioSupported)
return;
SoundEngine._player.StopAll();
}
public static SoundEffect GetTrackableSoundByStyleId(int id) => !SoundEngine.IsAudioSupported ? (SoundEffect) null : SoundEngine._legacyPlayer.GetTrackableSoundByStyleId(id);
public static void StopAmbientSounds()
{
if (!SoundEngine.IsAudioSupported || SoundEngine._legacyPlayer == null)
return;
SoundEngine._legacyPlayer.StopAmbientSounds();
}
public static ActiveSound FindActiveSound(SoundStyle style) => !SoundEngine.IsAudioSupported ? (ActiveSound) null : SoundEngine._player.FindActiveSound(style);
private static bool TestAudioSupport()
{
byte[] buffer = new byte[166]
{
(byte) 82,
(byte) 73,
(byte) 70,
(byte) 70,
(byte) 158,
(byte) 0,
(byte) 0,
(byte) 0,
(byte) 87,
(byte) 65,
(byte) 86,
(byte) 69,
(byte) 102,
(byte) 109,
(byte) 116,
(byte) 32,
(byte) 16,
(byte) 0,
(byte) 0,
(byte) 0,
(byte) 1,
(byte) 0,
(byte) 1,
(byte) 0,
(byte) 68,
(byte) 172,
(byte) 0,
(byte) 0,
(byte) 136,
(byte) 88,
(byte) 1,
(byte) 0,
(byte) 2,
(byte) 0,
(byte) 16,
(byte) 0,
(byte) 76,
(byte) 73,
(byte) 83,
(byte) 84,
(byte) 26,
(byte) 0,
(byte) 0,
(byte) 0,
(byte) 73,
(byte) 78,
(byte) 70,
(byte) 79,
(byte) 73,
(byte) 83,
(byte) 70,
(byte) 84,
(byte) 14,
(byte) 0,
(byte) 0,
(byte) 0,
(byte) 76,
(byte) 97,
(byte) 118,
(byte) 102,
(byte) 53,
(byte) 54,
(byte) 46,
(byte) 52,
(byte) 48,
(byte) 46,
(byte) 49,
(byte) 48,
(byte) 49,
(byte) 0,
(byte) 100,
(byte) 97,
(byte) 116,
(byte) 97,
(byte) 88,
(byte) 0,
(byte) 0,
(byte) 0,
(byte) 0,
(byte) 0,
(byte) 126,
(byte) 4,
(byte) 240,
(byte) 8,
(byte) 64,
(byte) 13,
(byte) 95,
(byte) 17,
(byte) 67,
(byte) 21,
(byte) 217,
(byte) 24,
(byte) 23,
(byte) 28,
(byte) 240,
(byte) 30,
(byte) 94,
(byte) 33,
(byte) 84,
(byte) 35,
(byte) 208,
(byte) 36,
(byte) 204,
(byte) 37,
(byte) 71,
(byte) 38,
(byte) 64,
(byte) 38,
(byte) 183,
(byte) 37,
(byte) 180,
(byte) 36,
(byte) 58,
(byte) 35,
(byte) 79,
(byte) 33,
(byte) 1,
(byte) 31,
(byte) 86,
(byte) 28,
(byte) 92,
(byte) 25,
(byte) 37,
(byte) 22,
(byte) 185,
(byte) 18,
(byte) 42,
(byte) 15,
(byte) 134,
(byte) 11,
(byte) 222,
(byte) 7,
(byte) 68,
(byte) 4,
(byte) 196,
(byte) 0,
(byte) 112,
(byte) 253,
(byte) 86,
(byte) 250,
(byte) 132,
(byte) 247,
(byte) 6,
(byte) 245,
(byte) 230,
(byte) 242,
(byte) 47,
(byte) 241,
(byte) 232,
(byte) 239,
(byte) 25,
(byte) 239,
(byte) 194,
(byte) 238,
(byte) 231,
(byte) 238,
(byte) 139,
(byte) 239,
(byte) 169,
(byte) 240,
(byte) 61,
(byte) 242,
(byte) 67,
(byte) 244,
(byte) 180,
(byte) 246
};
try
{
using (MemoryStream memoryStream = new MemoryStream(buffer))
SoundEffect.FromStream((Stream) memoryStream);
}
catch (NoAudioHardwareException ex)
{
Console.WriteLine("No audio hardware found. Disabling all audio.");
return false;
}
catch
{
return false;
}
return true;
}
}
}

View file

@ -1,38 +0,0 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.Audio.SoundInstanceGarbageCollector
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
using Microsoft.Xna.Framework.Audio;
using System.Collections.Generic;
namespace Terraria.Audio
{
public static class SoundInstanceGarbageCollector
{
private static readonly List<SoundEffectInstance> _activeSounds = new List<SoundEffectInstance>(128);
public static void Track(SoundEffectInstance sound)
{
}
public static void Update()
{
for (int index = 0; index < SoundInstanceGarbageCollector._activeSounds.Count; ++index)
{
if (SoundInstanceGarbageCollector._activeSounds[index] == null)
{
SoundInstanceGarbageCollector._activeSounds.RemoveAt(index);
--index;
}
else if (SoundInstanceGarbageCollector._activeSounds[index].State == SoundState.Stopped)
{
SoundInstanceGarbageCollector._activeSounds[index].Dispose();
SoundInstanceGarbageCollector._activeSounds.RemoveAt(index);
--index;
}
}
}
}
}

View file

@ -1,74 +0,0 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.Audio.SoundPlayer
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
using Microsoft.Xna.Framework;
using ReLogic.Utilities;
using System.Collections.Generic;
namespace Terraria.Audio
{
public class SoundPlayer
{
private readonly SlotVector<ActiveSound> _trackedSounds = new SlotVector<ActiveSound>(4096);
public SlotId Play(SoundStyle style, Vector2 position)
{
if (Main.dedServ || style == null || !style.IsTrackable)
return (SlotId) SlotId.Invalid;
return (double) Vector2.DistanceSquared(Main.screenPosition + new Vector2((float) (Main.screenWidth / 2), (float) (Main.screenHeight / 2)), position) > 100000000.0 ? (SlotId) SlotId.Invalid : this._trackedSounds.Add(new ActiveSound(style, position));
}
public SlotId Play(SoundStyle style) => Main.dedServ || style == null || !style.IsTrackable ? (SlotId) SlotId.Invalid : this._trackedSounds.Add(new ActiveSound(style));
public ActiveSound GetActiveSound(SlotId id) => !this._trackedSounds.Has(id) ? (ActiveSound) null : this._trackedSounds[id];
public void PauseAll()
{
foreach (SlotVector<ActiveSound>.ItemPair trackedSound in (IEnumerable<SlotVector<ActiveSound>.ItemPair>) this._trackedSounds)
((ActiveSound) trackedSound.Value).Pause();
}
public void ResumeAll()
{
foreach (SlotVector<ActiveSound>.ItemPair trackedSound in (IEnumerable<SlotVector<ActiveSound>.ItemPair>) this._trackedSounds)
((ActiveSound) trackedSound.Value).Resume();
}
public void StopAll()
{
foreach (SlotVector<ActiveSound>.ItemPair trackedSound in (IEnumerable<SlotVector<ActiveSound>.ItemPair>) this._trackedSounds)
((ActiveSound) trackedSound.Value).Stop();
this._trackedSounds.Clear();
}
public void Update()
{
foreach (SlotVector<ActiveSound>.ItemPair trackedSound in (IEnumerable<SlotVector<ActiveSound>.ItemPair>) this._trackedSounds)
{
try
{
((ActiveSound) trackedSound.Value).Update();
if (!((ActiveSound) trackedSound.Value).IsPlaying)
this._trackedSounds.Remove((SlotId) trackedSound.Id);
}
catch
{
this._trackedSounds.Remove((SlotId) trackedSound.Id);
}
}
}
public ActiveSound FindActiveSound(SoundStyle style)
{
foreach (SlotVector<ActiveSound>.ItemPair trackedSound in (IEnumerable<SlotVector<ActiveSound>.ItemPair>) this._trackedSounds)
{
if (((ActiveSound) trackedSound.Value).Style == style)
return (ActiveSound) trackedSound.Value;
}
return (ActiveSound) null;
}
}
}

View file

@ -1,7 +1,7 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.Audio.SoundStyle
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly: 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;

View file

@ -1,7 +1,7 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.Audio.SoundType
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly: 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

View file

@ -1,7 +1,7 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.BitsByte
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly: 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;
@ -146,5 +146,30 @@ namespace Terraria
while (bitsByte[7]);
return bitsByteList.ToArray();
}
public static void SortOfAUnitTest()
{
MemoryStream memoryStream = new MemoryStream();
BinaryWriter binaryWriter = new BinaryWriter((Stream) memoryStream);
BinaryReader reader = new BinaryReader((Stream) memoryStream);
bool[] flagArray = new bool[28];
flagArray[3] = true;
flagArray[14] = true;
BitsByte[] bitsByteArray1 = BitsByte.ComposeBitsBytesChain(false, flagArray);
foreach (BitsByte bitsByte in bitsByteArray1)
{
byte num = (byte) bitsByte;
binaryWriter.Write(num);
}
memoryStream.Position = 0L;
BitsByte[] bitsByteArray2 = BitsByte.DecomposeBitsBytesChain(reader);
string str1 = "";
string str2 = "";
foreach (BitsByte bitsByte in bitsByteArray1)
str1 = str1 + (object) (byte) bitsByte + ", ";
foreach (BitsByte bitsByte in bitsByteArray2)
str2 = str2 + (object) (byte) bitsByte + ", ";
Main.NewText("done");
}
}
}

View file

@ -1,7 +1,7 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.Chat.ChatCommandId
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly: 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;

View file

@ -1,7 +1,7 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.Chat.ChatCommandProcessor
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly: 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;
@ -15,9 +15,8 @@ namespace Terraria.Chat
{
public class ChatCommandProcessor : IChatProcessor
{
private readonly Dictionary<LocalizedText, ChatCommandId> _localizedCommands = new Dictionary<LocalizedText, ChatCommandId>();
private readonly Dictionary<ChatCommandId, IChatCommand> _commands = new Dictionary<ChatCommandId, IChatCommand>();
private readonly Dictionary<LocalizedText, NetworkText> _aliases = new Dictionary<LocalizedText, NetworkText>();
private 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()
@ -38,8 +37,6 @@ namespace Terraria.Chat
return this;
}
public void AddAlias(LocalizedText text, NetworkText result) => this._aliases[text] = result;
public ChatCommandProcessor AddDefaultCommand<T>() where T : IChatCommand, new()
{
this.AddCommand<T>();
@ -62,46 +59,29 @@ namespace Terraria.Chat
return !messageText.StartsWith(str) || messageText.Length == str.Length || messageText[str.Length] != ' ' ? "" : messageText.Substring(str.Length + 1);
}
public ChatMessage CreateOutgoingMessage(string text)
public bool ProcessOutgoingMessage(ChatMessage message)
{
ChatMessage message = new ChatMessage(text);
KeyValuePair<LocalizedText, ChatCommandId> keyValuePair1 = this._localizedCommands.FirstOrDefault<KeyValuePair<LocalizedText, ChatCommandId>>((Func<KeyValuePair<LocalizedText, ChatCommandId>, bool>) (pair => ChatCommandProcessor.HasLocalizedCommand(message, pair.Key)));
ChatCommandId chatCommandId = keyValuePair1.Value;
if (keyValuePair1.Key != null)
{
message.SetCommand(chatCommandId);
message.Text = ChatCommandProcessor.RemoveCommandPrefix(message.Text, keyValuePair1.Key);
this._commands[chatCommandId].ProcessOutgoingMessage(message);
}
else
{
bool flag = false;
for (KeyValuePair<LocalizedText, NetworkText> keyValuePair2 = this._aliases.FirstOrDefault<KeyValuePair<LocalizedText, NetworkText>>((Func<KeyValuePair<LocalizedText, NetworkText>, bool>) (pair => ChatCommandProcessor.HasLocalizedCommand(message, pair.Key))); keyValuePair2.Key != null; keyValuePair2 = this._aliases.FirstOrDefault<KeyValuePair<LocalizedText, NetworkText>>((Func<KeyValuePair<LocalizedText, NetworkText>, bool>) (pair => ChatCommandProcessor.HasLocalizedCommand(message, pair.Key))))
{
flag = true;
message = new ChatMessage(keyValuePair2.Value.ToString());
}
if (flag)
return this.CreateOutgoingMessage(message.Text);
}
return message;
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 void ProcessIncomingMessage(ChatMessage message, int clientId)
public bool ProcessReceivedMessage(ChatMessage message, int clientId)
{
IChatCommand chatCommand;
if (this._commands.TryGetValue(message.CommandId, out chatCommand))
{
chatCommand.ProcessIncomingMessage(message.Text, (byte) clientId);
message.Consume();
chatCommand.ProcessMessage(message.Text, (byte) clientId);
return true;
}
else
{
if (this._defaultCommand == null)
return;
this._defaultCommand.ProcessIncomingMessage(message.Text, (byte) clientId);
message.Consume();
}
return false;
this._defaultCommand.ProcessMessage(message.Text, (byte) clientId);
return true;
}
}
}

View file

@ -1,89 +0,0 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.Chat.ChatHelper
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
using Microsoft.Xna.Framework;
using System;
using System.Collections.Generic;
using Terraria.GameContent.NetModules;
using Terraria.GameContent.UI.Chat;
using Terraria.Localization;
using Terraria.Net;
namespace Terraria.Chat
{
public static class ChatHelper
{
private static List<Tuple<string, Color>> _cachedMessages = new List<Tuple<string, Color>>();
public static void DisplayMessageOnClient(NetworkText text, Color color, int playerId) => ChatHelper.DisplayMessage(text, color, byte.MaxValue);
public static void SendChatMessageToClient(NetworkText text, Color color, int playerId) => ChatHelper.SendChatMessageToClientAs(byte.MaxValue, text, color, playerId);
public static void SendChatMessageToClientAs(
byte messageAuthor,
NetworkText text,
Color color,
int playerId)
{
if (playerId != Main.myPlayer)
return;
ChatHelper.DisplayMessage(text, color, messageAuthor);
}
public static void BroadcastChatMessage(NetworkText text, Color color, int excludedPlayer = -1) => ChatHelper.BroadcastChatMessageAs(byte.MaxValue, text, color, excludedPlayer);
public static void BroadcastChatMessageAs(
byte messageAuthor,
NetworkText text,
Color color,
int excludedPlayer = -1)
{
if (excludedPlayer == Main.myPlayer)
return;
ChatHelper.DisplayMessage(text, color, messageAuthor);
}
public static bool OnlySendToPlayersWhoAreLoggedIn(int clientIndex) => Netplay.Clients[clientIndex].State == 10;
public static void SendChatMessageFromClient(ChatMessage message)
{
if (message.IsConsumed)
return;
NetPacket packet = NetTextModule.SerializeClientMessage(message);
NetManager.Instance.SendToServer(packet);
}
public static void DisplayMessage(NetworkText text, Color color, byte messageAuthor)
{
string str = text.ToString();
if (messageAuthor < byte.MaxValue)
{
Main.player[(int) messageAuthor].chatOverhead.NewMessage(str, Main.PlayerOverheadChatMessageDisplayTime);
Main.player[(int) messageAuthor].chatOverhead.color = color;
str = NameTagHandler.GenerateTag(Main.player[(int) messageAuthor].name) + " " + str;
}
if (ChatHelper.ShouldCacheMessage())
ChatHelper.CacheMessage(str, color);
else
Main.NewTextMultiline(str, c: color);
}
private static void CacheMessage(string message, Color color) => ChatHelper._cachedMessages.Add(new Tuple<string, Color>(message, color));
public static void ShowCachedMessages()
{
lock (ChatHelper._cachedMessages)
{
foreach (Tuple<string, Color> cachedMessage in ChatHelper._cachedMessages)
Main.NewTextMultiline(cachedMessage.Item1, c: cachedMessage.Item2);
}
}
public static void ClearDelayedMessagesCache() => ChatHelper._cachedMessages.Clear();
private static bool ShouldCacheMessage() => Main.netMode == 1 && Main.gameMenu;
}
}

View file

@ -1,29 +1,25 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.Chat.ChatMessage
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly: 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.IO;
using System.Text;
using Terraria.Chat.Commands;
namespace Terraria.Chat
{
public sealed class ChatMessage
public class ChatMessage
{
public ChatCommandId CommandId { get; private set; }
public string Text { get; set; }
public bool IsConsumed { get; private set; }
public ChatMessage(string message)
{
this.CommandId = ChatCommandId.FromType<SayChatCommand>();
this.Text = message;
this.IsConsumed = false;
}
private ChatMessage(string message, ChatCommandId commandId)
@ -34,18 +30,11 @@ namespace Terraria.Chat
public void Serialize(BinaryWriter writer)
{
if (this.IsConsumed)
throw new InvalidOperationException("Message has already been consumed.");
this.CommandId.Serialize(writer);
writer.Write(this.Text);
}
public int GetMaxSerializedSize()
{
if (this.IsConsumed)
throw new InvalidOperationException("Message has already been consumed.");
return 0 + this.CommandId.GetMaxSerializedSize() + (4 + Encoding.UTF8.GetByteCount(this.Text));
}
public int GetMaxSerializedSize() => 0 + this.CommandId.GetMaxSerializedSize() + (4 + Encoding.UTF8.GetByteCount(this.Text));
public static ChatMessage Deserialize(BinaryReader reader)
{
@ -53,20 +42,8 @@ namespace Terraria.Chat
return new ChatMessage(reader.ReadString(), commandId);
}
public void SetCommand(ChatCommandId commandId)
{
if (this.IsConsumed)
throw new InvalidOperationException("Message has already been consumed.");
this.CommandId = commandId;
}
public void SetCommand(ChatCommandId commandId) => this.CommandId = commandId;
public void SetCommand<T>() where T : IChatCommand
{
if (this.IsConsumed)
throw new InvalidOperationException("Message has already been consumed.");
this.CommandId = ChatCommandId.FromType<T>();
}
public void Consume() => this.IsConsumed = true;
public void SetCommand<T>() where T : IChatCommand => this.CommandId = ChatCommandId.FromType<T>();
}
}

View file

@ -1,14 +1,14 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.Chat.Commands.ChatCommandAttribute
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly: 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, Inherited = false)]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface, AllowMultiple = false, Inherited = false)]
public sealed class ChatCommandAttribute : Attribute
{
public readonly string Name;

View file

@ -1,73 +0,0 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.Chat.Commands.EmojiCommand
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
using System;
using System.Collections.Generic;
using Terraria.GameContent.UI;
using Terraria.Localization;
namespace Terraria.Chat.Commands
{
[ChatCommand("Emoji")]
public class EmojiCommand : IChatCommand
{
public const int PlayerEmojiDuration = 360;
private readonly Dictionary<LocalizedText, int> _byName = new Dictionary<LocalizedText, int>();
public EmojiCommand() => this.Initialize();
public void Initialize()
{
this._byName.Clear();
for (int id = 0; id < 145; ++id)
{
LocalizedText emojiName = Lang.GetEmojiName(id);
if (emojiName != LocalizedText.Empty)
this._byName[emojiName] = id;
}
}
public void ProcessIncomingMessage(string text, byte clientId)
{
}
public void ProcessOutgoingMessage(ChatMessage message)
{
int result = -1;
if (int.TryParse(message.Text, out result))
{
if (result < 0 || result >= 145)
return;
}
else
result = -1;
if (result == -1)
{
foreach (LocalizedText key in this._byName.Keys)
{
if (message.Text == key.Value)
{
result = this._byName[key];
break;
}
}
}
if (result != -1)
{
if (Main.netMode == 0)
{
EmoteBubble.NewBubble(result, new WorldUIAnchor((Entity) Main.LocalPlayer), 360);
EmoteBubble.CheckForNPCsToReactToEmoteBubble(result, Main.LocalPlayer);
}
else
NetMessage.SendData(120, number: Main.myPlayer, number2: ((float) result));
}
message.Consume();
}
public void PrintWarning(string text) => throw new Exception("This needs localized text!");
}
}

View file

@ -1,7 +1,7 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.Chat.Commands.EmoteCommand
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly: 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;
@ -14,16 +14,12 @@ namespace Terraria.Chat.Commands
{
private static readonly Color RESPONSE_COLOR = new Color(200, 100, 0);
public void ProcessIncomingMessage(string text, byte clientId)
public void ProcessMessage(string text, byte clientId)
{
if (!(text != ""))
return;
text = string.Format("*{0} {1}", (object) Main.player[(int) clientId].name, (object) text);
ChatHelper.BroadcastChatMessage(NetworkText.FromLiteral(text), EmoteCommand.RESPONSE_COLOR);
}
public void ProcessOutgoingMessage(ChatMessage message)
{
NetMessage.BroadcastChatMessage(NetworkText.FromLiteral(text), EmoteCommand.RESPONSE_COLOR);
}
}
}

View file

@ -1,57 +0,0 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.Chat.Commands.HelpCommand
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
using Microsoft.Xna.Framework;
using System.Collections.Generic;
using Terraria.Localization;
namespace Terraria.Chat.Commands
{
[ChatCommand("Help")]
public class HelpCommand : IChatCommand
{
private static readonly Color RESPONSE_COLOR = new Color((int) byte.MaxValue, 240, 20);
public void ProcessIncomingMessage(string text, byte clientId) => ChatHelper.SendChatMessageToClient(HelpCommand.ComposeMessage(HelpCommand.GetCommandAliasesByID()), HelpCommand.RESPONSE_COLOR, (int) clientId);
private static Dictionary<string, List<LocalizedText>> GetCommandAliasesByID()
{
LocalizedText[] all = Language.FindAll(Lang.CreateDialogFilter("ChatCommand.", Lang.CreateDialogSubstitutionObject()));
Dictionary<string, List<LocalizedText>> dictionary = new Dictionary<string, List<LocalizedText>>();
foreach (LocalizedText localizedText in all)
{
string key = localizedText.Key.Replace("ChatCommand.", "");
int length = key.IndexOf('_');
if (length != -1)
key = key.Substring(0, length);
List<LocalizedText> localizedTextList;
if (!dictionary.TryGetValue(key, out localizedTextList))
{
localizedTextList = new List<LocalizedText>();
dictionary[key] = localizedTextList;
}
localizedTextList.Add(localizedText);
}
return dictionary;
}
private static NetworkText ComposeMessage(
Dictionary<string, List<LocalizedText>> aliases)
{
string text = "";
for (int index = 0; index < aliases.Count; ++index)
text = text + "{" + (object) index + "}\n";
List<NetworkText> networkTextList = new List<NetworkText>();
foreach (KeyValuePair<string, List<LocalizedText>> alias in aliases)
networkTextList.Add(Language.GetText("ChatCommandDescription." + alias.Key).ToNetworkText());
return NetworkText.FromFormattable(text, (object[]) networkTextList.ToArray());
}
public void ProcessOutgoingMessage(ChatMessage message)
{
}
}
}

View file

@ -1,15 +1,13 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.Chat.Commands.IChatCommand
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly: 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 ProcessIncomingMessage(string text, byte clientId);
void ProcessOutgoingMessage(ChatMessage message);
void ProcessMessage(string text, byte clientId);
}
}

View file

@ -1,7 +1,7 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.Chat.Commands.ListPlayersCommand
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly: 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;
@ -17,10 +17,6 @@ namespace Terraria.Chat.Commands
{
private static readonly Color RESPONSE_COLOR = new Color((int) byte.MaxValue, 240, 20);
public void ProcessIncomingMessage(string text, byte clientId) => ChatHelper.SendChatMessageToClient(NetworkText.FromLiteral(string.Join(", ", ((IEnumerable<Player>) Main.player).Where<Player>((Func<Player, bool>) (player => player.active)).Select<Player, string>((Func<Player, string>) (player => player.name)))), ListPlayersCommand.RESPONSE_COLOR, (int) clientId);
public void ProcessOutgoingMessage(ChatMessage message)
{
}
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);
}
}

View file

@ -1,11 +1,13 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.Chat.Commands.PartyChatCommand
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly: 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
{
@ -14,7 +16,7 @@ namespace Terraria.Chat.Commands
{
private static readonly Color ERROR_COLOR = new Color((int) byte.MaxValue, 240, 20);
public void ProcessIncomingMessage(string text, byte clientId)
public void ProcessMessage(string text, byte clientId)
{
int team = Main.player[(int) clientId].team;
Color color = Main.teamColor[team];
@ -29,15 +31,18 @@ namespace Terraria.Chat.Commands
for (int playerId = 0; playerId < (int) byte.MaxValue; ++playerId)
{
if (Main.player[playerId].team == team)
ChatHelper.SendChatMessageToClientAs(clientId, NetworkText.FromLiteral(text), color, playerId);
}
}
}
public void ProcessOutgoingMessage(ChatMessage message)
{
NetPacket packet = NetTextModule.SerializeServerMessage(NetworkText.FromLiteral(text), color, clientId);
NetManager.Instance.SendToClient(packet, playerId);
}
}
}
}
private void SendNoTeamError(byte clientId) => ChatHelper.SendChatMessageToClient(Lang.mp[10].ToNetworkText(), PartyChatCommand.ERROR_COLOR, (int) clientId);
private void SendNoTeamError(byte clientId)
{
NetPacket packet = NetTextModule.SerializeServerMessage(Lang.mp[10].ToNetworkText(), PartyChatCommand.ERROR_COLOR);
NetManager.Instance.SendToClient(packet, (int) clientId);
}
}
}

View file

@ -1,31 +0,0 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.Chat.Commands.RockPaperScissorsCommand
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
using Terraria.GameContent.UI;
namespace Terraria.Chat.Commands
{
[ChatCommand("RPS")]
public class RockPaperScissorsCommand : IChatCommand
{
public void ProcessIncomingMessage(string text, byte clientId)
{
}
public void ProcessOutgoingMessage(ChatMessage message)
{
int num = Main.rand.NextFromList<int>(37, 38, 36);
if (Main.netMode == 0)
{
EmoteBubble.NewBubble(num, new WorldUIAnchor((Entity) Main.LocalPlayer), 360);
EmoteBubble.CheckForNPCsToReactToEmoteBubble(num, Main.LocalPlayer);
}
else
NetMessage.SendData(120, number: Main.myPlayer, number2: ((float) num));
message.Consume();
}
}
}

View file

@ -1,7 +1,7 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.Chat.Commands.RollCommand
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly: 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;
@ -14,14 +14,12 @@ namespace Terraria.Chat.Commands
{
private static readonly Color RESPONSE_COLOR = new Color((int) byte.MaxValue, 240, 20);
public void ProcessIncomingMessage(string text, byte clientId)
public string InternalName => "roll";
public void ProcessMessage(string text, byte clientId)
{
int num = Main.rand.Next(1, 101);
ChatHelper.BroadcastChatMessage(NetworkText.FromFormattable("*{0} {1} {2}", (object) Main.player[(int) clientId].name, (object) Lang.mp[9].ToNetworkText(), (object) num), RollCommand.RESPONSE_COLOR);
}
public void ProcessOutgoingMessage(ChatMessage message)
{
NetMessage.BroadcastChatMessage(NetworkText.FromFormattable("*{0} {1} {2}", (object) Main.player[(int) clientId].name, (object) Lang.mp[9].ToNetworkText(), (object) num), RollCommand.RESPONSE_COLOR);
}
}
}

View file

@ -1,20 +1,24 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.Chat.Commands.SayChatCommand
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly: 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 ProcessIncomingMessage(string text, byte clientId) => ChatHelper.BroadcastChatMessageAs(clientId, NetworkText.FromLiteral(text), Main.player[(int) clientId].ChatColor());
public void ProcessOutgoingMessage(ChatMessage message)
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);
}
}
}

View file

@ -1,15 +1,15 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.Chat.IChatProcessor
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly: 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
{
void ProcessIncomingMessage(ChatMessage message, int clientId);
bool ProcessReceivedMessage(ChatMessage message, int clientId);
ChatMessage CreateOutgoingMessage(string text);
bool ProcessOutgoingMessage(ChatMessage message);
}
}

2900
Chest.cs

File diff suppressed because it is too large Load diff

View file

@ -1,7 +1,7 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.Cinematics.CinematicManager
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly: 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;

View file

@ -1,13 +1,12 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.Cinematics.DD2Film
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly: 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.Audio;
using Terraria.GameContent.UI;
using Terraria.ID;
@ -134,7 +133,7 @@ namespace Terraria.Cinematics
}
}
private void OgreSwingSound(FrameEventData evt) => SoundEngine.PlaySound(SoundID.DD2_OgreAttack, this._ogre.Center);
private void OgreSwingSound(FrameEventData evt) => Main.PlaySound(SoundID.DD2_OgreAttack, this._ogre.Center);
private void DryadPortalKnock(FrameEventData evt)
{
@ -144,7 +143,7 @@ namespace Terraria.Cinematics
{
this._dryad.velocity.Y -= 7f;
this._dryad.velocity.X -= 8f;
SoundEngine.PlaySound(3, (int) this._dryad.Center.X, (int) this._dryad.Center.Y);
Main.PlaySound(3, (int) this._dryad.Center.X, (int) this._dryad.Center.Y);
}
if (evt.Frame >= 20)
{
@ -188,7 +187,7 @@ namespace Terraria.Cinematics
if (this._dryad == null || this._portal == null)
return;
if (evt.IsFirstFrame)
SoundEngine.PlaySound(SoundID.DD2_EtherianPortalDryadTouch, this._dryad.Center);
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;

View file

@ -1,7 +1,7 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.Cinematics.Film
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly: 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;

View file

@ -1,7 +1,7 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.Cinematics.FrameEvent
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly: 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

View file

@ -1,7 +1,7 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.Cinematics.FrameEventData
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly: 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

View file

@ -1,12 +1,11 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.Cloud
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly: 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.GameContent;
using Terraria.Utilities;
namespace Terraria
@ -29,9 +28,9 @@ namespace Terraria
public static void resetClouds()
{
if (Main.dedServ)
if (Main.dedServ || Main.cloudLimit < 10)
return;
Main.windSpeedCurrent = Main.windSpeedTarget;
Main.windSpeed = Main.windSpeedSet;
for (int index = 0; index < 200; ++index)
Main.cloud[index].active = false;
for (int index = 0; index < Main.numClouds; ++index)
@ -63,15 +62,15 @@ namespace Terraria
Main.cloud[index1].sSpeed = 0.0f;
Main.cloud[index1].scale = (float) Cloud.rand.Next(70, 131) * 0.01f;
Main.cloud[index1].rotation = (float) Cloud.rand.Next(-10, 11) * 0.01f;
Main.cloud[index1].width = (int) ((double) TextureAssets.Cloud[Main.cloud[index1].type].Width() * (double) Main.cloud[index1].scale);
Main.cloud[index1].height = (int) ((double) TextureAssets.Cloud[Main.cloud[index1].type].Height() * (double) Main.cloud[index1].scale);
Main.cloud[index1].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.windSpeedCurrent;
float num1 = Main.windSpeed;
if (!Main.gameMenu)
num1 = Main.windSpeedCurrent - Main.player[Main.myPlayer].velocity.X * 0.1f;
num1 = Main.windSpeed - Main.player[Main.myPlayer].velocity.X * 0.1f;
int num2 = 0;
int num3 = 0;
if ((double) num1 > 0.0)
@ -81,9 +80,9 @@ namespace Terraria
int num4 = 300;
float num5 = (float) WorldGen.genRand.Next(num2 - num4, Main.screenWidth + num3 + num4);
Main.cloud[index1].Alpha = 0.0f;
Main.cloud[index1].position.Y = (float) Cloud.rand.Next((int) ((double) -Main.screenHeight * 0.25), (int) ((double) Main.screenHeight * 0.150000005960464));
if (Main.rand.Next(3) == 0)
Main.cloud[index1].position.Y -= (float) Cloud.rand.Next((int) ((double) Main.screenHeight * 0.100000001490116));
Main.cloud[index1].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)
{
@ -93,14 +92,12 @@ namespace Terraria
if ((double) Main.cloud[index1].scale >= 1.0)
Main.cloud[index1].position.Y -= 150f;
}
else if ((double) Main.cloudBGActive <= 0.0 && (double) Main.cloudAlpha == 0.0 && (double) Main.cloud[index1].scale < 1.0 && (double) Main.cloud[index1].position.Y < (double) -Main.screenHeight * 0.150000005960464 && (double) Main.numClouds <= 80.0)
else if (((double) Main.cloudBGActive <= 0.0 && (double) Main.cloudAlpha == 0.0 && (double) Main.cloud[index1].scale < 1.0 && (double) Main.cloud[index1].position.Y < (double) -Main.screenHeight * 0.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 (Cloud.rand.Next(150) == 0)
Main.cloud[index1].type = Cloud.RollRareCloud();
if ((double) Main.cloud[index1].scale > 1.2)
Main.cloud[index1].position.Y += 100f;
if ((double) Main.cloud[index1].scale > 1.3)
@ -109,9 +106,9 @@ namespace Terraria
Main.cloud[index1].scale = 0.7f;
Main.cloud[index1].active = true;
Main.cloud[index1].position.X = num5;
if ((double) Main.cloud[index1].position.X > (double) (Main.screenWidth + 400))
if ((double) Main.cloud[index1].position.X > (double) (Main.screenWidth + 100))
Main.cloud[index1].Alpha = 1f;
if ((double) Main.cloud[index1].position.X + (double) TextureAssets.Cloud[Main.cloud[index1].type].Width() * (double) Main.cloud[index1].scale < -400.0)
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)
@ -125,44 +122,6 @@ namespace Terraria
}
}
private static int RollRareCloud()
{
int num = -1;
bool flag = false;
while (!flag)
{
num = Cloud.rand.Next(22, 37);
switch (num)
{
case 25:
case 26:
flag = NPC.downedBoss1;
continue;
case 28:
if (Main.rand.Next(10) == 0)
{
flag = true;
continue;
}
continue;
case 30:
case 35:
flag = Main.hardMode;
continue;
case 31:
flag = NPC.downedBoss3;
continue;
case 36:
flag = NPC.downedBoss2 && WorldGen.crimson;
continue;
default:
flag = true;
continue;
}
}
return num;
}
public Color cloudColor(Color bgColor)
{
float num = this.scale * this.Alpha;
@ -222,8 +181,12 @@ namespace Terraria
public void Update()
{
if (WorldGen.drunkWorldGenText && Main.gameMenu)
this.type = 28;
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)
@ -250,14 +213,10 @@ namespace Terraria
float num10 = num9 * num9;
num1 = num8 * num10;
}
this.position.X += Main.windSpeedCurrent * 9f * num1 * (float) Main.dayRate;
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 num11 = 600f;
if ((double) Main.bgAlphaFrontLayer[4] == 1.0 && (double) this.position.Y > 200.0)
{
this.kill = true;
this.Alpha -= 0.005f * (float) Main.dayRate;
}
float num = 600f;
if (!this.kill)
{
if ((double) this.Alpha < 1.0)
@ -273,7 +232,7 @@ namespace Terraria
if ((double) this.Alpha <= 0.0)
this.active = false;
}
if ((double) this.position.X + (double) TextureAssets.Cloud[this.type].Width() * (double) this.scale < -(double) num11 || (double) this.position.X > (double) Main.screenWidth + (double) num11)
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)
@ -285,8 +244,8 @@ namespace Terraria
if ((double) this.rotation < -0.02)
this.rotation = -0.02f;
this.rotation += this.rSpeed;
this.width = (int) ((double) TextureAssets.Cloud[this.type].Width() * (double) this.scale);
this.height = (int) ((double) TextureAssets.Cloud[this.type].Height() * (double) this.scale);
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;

View file

@ -1,26 +1,25 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.Collision
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// 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;
namespace Terraria
{
public class Collision
{
public static bool stair;
public static bool stairFall;
public static bool honey;
public static bool sloping;
public static bool stair = false;
public static bool stairFall = false;
public static bool honey = false;
public static bool sloping = false;
public static bool landMine = false;
public static bool up;
public static bool down;
public static bool up = false;
public static bool down = false;
public static float Epsilon = 2.718282f;
public static Vector2[] CheckLinevLine(Vector2 a1, Vector2 a2, Vector2 b1, Vector2 b2)
@ -306,10 +305,6 @@ namespace Terraria
return flag;
}
public static bool CanHit(Entity source, Entity target) => Collision.CanHit(source.position, source.width, source.height, target.position, target.width, target.height);
public static bool CanHit(Entity source, NPCAimedTarget target) => Collision.CanHit(source.position, source.width, source.height, target.Position, target.Width, target.Height);
public static bool CanHit(
Vector2 Position1,
int Width1,
@ -381,7 +376,7 @@ namespace Terraria
Vector2 Position2,
int Width2,
int Height2,
Utils.TileActionAttempt check)
Utils.PerLinePoint check)
{
int x = (int) (((double) Position1.X + (double) (Width1 / 2)) / 16.0);
int y = (int) (((double) Position1.Y + (double) (Height1 / 2)) / 16.0);
@ -884,7 +879,7 @@ namespace Terraria
public static bool HitWallSubstep(int x, int y)
{
if (Main.tile[x, y].wall == (ushort) 0)
if (Main.tile[x, y].wall == (byte) 0)
return false;
bool flag1 = false;
if (Main.wallHouse[(int) Main.tile[x, y].wall])
@ -895,7 +890,7 @@ namespace Terraria
{
for (int index2 = -1; index2 < 2; ++index2)
{
if ((index1 != 0 || index2 != 0) && Main.tile[x + index1, y + index2].wall == (ushort) 0)
if ((index1 != 0 || index2 != 0) && Main.tile[x + index1, y + index2].wall == (byte) 0)
flag1 = true;
}
}
@ -939,12 +934,7 @@ namespace Terraria
return true;
}
public static bool DrownCollision(
Vector2 Position,
int Width,
int Height,
float gravDir = -1f,
bool includeSlopes = false)
public static bool DrownCollision(Vector2 Position, int Width, int Height, float gravDir = -1f)
{
Vector2 vector2_1 = new Vector2(Position.X + (float) (Width / 2), Position.Y + (float) (Height / 2));
int num1 = 10;
@ -971,7 +961,7 @@ namespace Terraria
for (int index2 = num9; index2 < num10; ++index2)
{
Tile tile = Main.tile[index1, index2];
if (tile != null && tile.liquid > (byte) 0 && !tile.lava() && (index2 != num11 || !tile.active() || !Main.tileSolid[(int) tile.type] || Main.tileSolidTop[(int) tile.type] || includeSlopes && tile.blockType() != 0))
if (tile != null && tile.liquid > (byte) 0 && !tile.lava() && (index2 != num11 || !tile.active() || !Main.tileSolid[(int) tile.type] || Main.tileSolidTop[(int) tile.type]))
{
Vector2 vector2_2;
vector2_2.X = (float) (index1 * 16);
@ -988,96 +978,6 @@ namespace Terraria
return false;
}
public static bool IsWorldPointSolid(Vector2 pos)
{
Point tileCoordinates = pos.ToTileCoordinates();
if (!WorldGen.InWorld(tileCoordinates.X, tileCoordinates.Y, 1))
return false;
Tile tile = Main.tile[tileCoordinates.X, tileCoordinates.Y];
if (tile == null || !tile.active() || tile.inActive() || !Main.tileSolid[(int) tile.type])
return false;
int num1 = tile.blockType();
switch (num1)
{
case 0:
return (double) pos.X >= (double) (tileCoordinates.X * 16) && (double) pos.X <= (double) (tileCoordinates.X * 16 + 16) && (double) pos.Y >= (double) (tileCoordinates.Y * 16) && (double) pos.Y <= (double) (tileCoordinates.Y * 16 + 16);
case 1:
return (double) pos.X >= (double) (tileCoordinates.X * 16) && (double) pos.X <= (double) (tileCoordinates.X * 16 + 16) && (double) pos.Y >= (double) (tileCoordinates.Y * 16 + 8) && (double) pos.Y <= (double) (tileCoordinates.Y * 16 + 16);
case 2:
case 3:
case 4:
case 5:
if ((double) pos.X < (double) (tileCoordinates.X * 16) && (double) pos.X > (double) (tileCoordinates.X * 16 + 16) && (double) pos.Y < (double) (tileCoordinates.Y * 16) && (double) pos.Y > (double) (tileCoordinates.Y * 16 + 16))
return false;
float num2 = pos.X % 16f;
float num3 = pos.Y % 16f;
switch (num1)
{
case 2:
return (double) num3 >= (double) num2;
case 3:
return (double) num2 + (double) num3 >= 16.0;
case 4:
return (double) num2 + (double) num3 <= 16.0;
case 5:
return (double) num3 <= (double) num2;
}
break;
}
return false;
}
public static bool GetWaterLine(Point pt, out float waterLineHeight) => Collision.GetWaterLine(pt.X, pt.Y, out waterLineHeight);
public static bool GetWaterLine(int X, int Y, out float waterLineHeight)
{
waterLineHeight = 0.0f;
if (Main.tile[X, Y - 2] == null)
Main.tile[X, Y - 2] = new Tile();
if (Main.tile[X, Y - 1] == null)
Main.tile[X, Y - 1] = new Tile();
if (Main.tile[X, Y] == null)
Main.tile[X, Y] = new Tile();
if (Main.tile[X, Y + 1] == null)
Main.tile[X, Y + 1] = new Tile();
if (Main.tile[X, Y - 2].liquid > (byte) 0)
return false;
if (Main.tile[X, Y - 1].liquid > (byte) 0)
{
waterLineHeight = (float) (Y * 16);
waterLineHeight -= (float) ((int) Main.tile[X, Y - 1].liquid / 16);
return true;
}
if (Main.tile[X, Y].liquid > (byte) 0)
{
waterLineHeight = (float) ((Y + 1) * 16);
waterLineHeight -= (float) ((int) Main.tile[X, Y].liquid / 16);
return true;
}
if (Main.tile[X, Y + 1].liquid <= (byte) 0)
return false;
waterLineHeight = (float) ((Y + 2) * 16);
waterLineHeight -= (float) ((int) Main.tile[X, Y + 1].liquid / 16);
return true;
}
public static bool GetWaterLineIterate(Point pt, out float waterLineHeight) => Collision.GetWaterLineIterate(pt.X, pt.Y, out waterLineHeight);
public static bool GetWaterLineIterate(int X, int Y, out float waterLineHeight)
{
waterLineHeight = 0.0f;
while (Y > 0 && Framing.GetTileSafely(X, Y).liquid > (byte) 0)
--Y;
++Y;
if (Main.tile[X, Y] == null)
Main.tile[X, Y] = new Tile();
if (Main.tile[X, Y].liquid <= (byte) 0)
return false;
waterLineHeight = (float) (Y * 16);
waterLineHeight -= (float) ((int) Main.tile[X, Y - 1].liquid / 16);
return true;
}
public static bool WetCollision(Vector2 Position, int Width, int Height)
{
Collision.honey = false;
@ -1312,14 +1212,29 @@ namespace Terraria
if ((double) Position.X + (double) Width > (double) vector2_4.X && (double) Position.X < (double) vector2_4.X + 16.0 && (double) Position.Y + (double) Height > (double) vector2_4.Y && (double) Position.Y < (double) vector2_4.Y + (double) num9)
{
bool flag1 = true;
if (Main.tile[index1, index2].slope() > (byte) 0)
{
if (Main.tile[index1, index2].slope() > (byte) 2)
{
if (Main.tile[index1, index2].slope() == (byte) 3 && (double) vector2_1.Y + (double) Math.Abs(Velocity.X) + 1.0 >= (double) vector2_4.Y && (double) vector2_1.X >= (double) vector2_4.X)
flag1 = true;
if (Main.tile[index1, index2].slope() == (byte) 4 && (double) vector2_1.Y + (double) Math.Abs(Velocity.X) + 1.0 >= (double) vector2_4.Y && (double) vector2_1.X + (double) Width <= (double) vector2_4.X + 16.0)
flag1 = true;
}
else
{
if (Main.tile[index1, index2].slope() == (byte) 1 && (double) vector2_1.Y + (double) Height - (double) Math.Abs(Velocity.X) - 1.0 <= (double) vector2_4.Y + (double) num9 && (double) vector2_1.X >= (double) vector2_4.X)
flag1 = true;
if (Main.tile[index1, index2].slope() == (byte) 2 && (double) vector2_1.Y + (double) Height - (double) Math.Abs(Velocity.X) - 1.0 <= (double) vector2_4.Y + (double) num9 && (double) vector2_1.X + (double) Width <= (double) vector2_4.X + 16.0)
flag1 = true;
}
}
if (TileID.Sets.Platforms[(int) Main.tile[index1, index2].type])
{
if ((double) Velocity.Y < 0.0)
flag1 = false;
if ((double) Position.Y + (double) Height < (double) (index2 * 16) || (double) Position.Y + (double) Height - (1.0 + (double) Math.Abs(Velocity.X)) > (double) (index2 * 16 + 16))
flag1 = false;
if ((Main.tile[index1, index2].slope() == (byte) 1 && (double) Velocity.X >= 0.0 || Main.tile[index1, index2].slope() == (byte) 2 && (double) Velocity.X <= 0.0) && ((double) Position.Y + (double) Height) / 16.0 - 1.0 == (double) index2)
flag1 = false;
}
if (flag1)
{
@ -1633,9 +1548,9 @@ namespace Terraria
}
else if ((double) vector2_4.X + (double) Width <= (double) vector2_5.X && !Main.tileSolidTop[(int) Main.tile[index1, index2].type])
{
if (index1 >= 1 && Main.tile[index1 - 1, index2] == null)
if (Main.tile[index1 - 1, index2] == null)
Main.tile[index1 - 1, index2] = new Tile();
if (index1 < 1 || Main.tile[index1 - 1, index2].slope() != (byte) 2 && Main.tile[index1 - 1, index2].slope() != (byte) 4)
if (Main.tile[index1 - 1, index2].slope() != (byte) 2 && Main.tile[index1 - 1, index2].slope() != (byte) 4)
{
num5 = index1;
num6 = index2;
@ -2073,7 +1988,7 @@ label_19:
{
for (int j = num3; j < num4; ++j)
{
if (Main.tile[i, j] != null && Main.tile[i, j].slope() == (byte) 0 && !Main.tile[i, j].inActive() && Main.tile[i, j].active() && (Main.tile[i, j].type == (ushort) 32 || Main.tile[i, j].type == (ushort) 37 || Main.tile[i, j].type == (ushort) 48 || Main.tile[i, j].type == (ushort) 232 || Main.tile[i, j].type == (ushort) 53 || Main.tile[i, j].type == (ushort) 57 || Main.tile[i, j].type == (ushort) 58 || Main.tile[i, j].type == (ushort) 69 || Main.tile[i, j].type == (ushort) 76 || Main.tile[i, j].type == (ushort) 112 || Main.tile[i, j].type == (ushort) 116 || Main.tile[i, j].type == (ushort) 123 || Main.tile[i, j].type == (ushort) 224 || Main.tile[i, j].type == (ushort) 234 || Main.tile[i, j].type == (ushort) 352 || Main.tile[i, j].type == (ushort) 484))
if (Main.tile[i, j] != null && Main.tile[i, j].slope() == (byte) 0 && !Main.tile[i, j].inActive() && Main.tile[i, j].active() && (Main.tile[i, j].type == (ushort) 32 || Main.tile[i, j].type == (ushort) 37 || Main.tile[i, j].type == (ushort) 48 || Main.tile[i, j].type == (ushort) 232 || Main.tile[i, j].type == (ushort) 53 || Main.tile[i, j].type == (ushort) 57 || Main.tile[i, j].type == (ushort) 58 || Main.tile[i, j].type == (ushort) 69 || Main.tile[i, j].type == (ushort) 76 || Main.tile[i, j].type == (ushort) 112 || Main.tile[i, j].type == (ushort) 116 || Main.tile[i, j].type == (ushort) 123 || Main.tile[i, j].type == (ushort) 224 || Main.tile[i, j].type == (ushort) 234 || Main.tile[i, j].type == (ushort) 352))
{
Vector2 vector2_2;
vector2_2.X = (float) (i * 16);
@ -2131,11 +2046,9 @@ label_19:
if (!fireImmune && (type == 37 || type == 58 || type == 76))
num5 = 20;
if (type == 48)
num5 = 60;
num5 = 40;
if (type == 232)
num5 = 80;
if (type == 484)
num5 = 25;
num5 = 60;
return new Vector2((float) num11, (float) num5);
}
}
@ -2170,15 +2083,15 @@ label_19:
if (Main.tile[index, j] != null)
{
int type = (int) Main.tile[index, j].type;
if (Main.tile[index, j].active() && (type == 135 || type == 210 || type == 443 || type == 442))
if (Main.tile[index, j].active() && (type == 135 || type == 210 || type == 442))
{
Vector2 vector2;
vector2.X = (float) (index * 16);
vector2.Y = (float) (j * 16 + 12);
bool flag1 = false;
if (type == 442)
{
if (objType == 4)
{
if (type == 442)
{
float r1StartX = 0.0f;
float r1StartY = 0.0f;
@ -2222,23 +2135,19 @@ label_19:
}
if (!flag1 && (double) Position.X + (double) Width > (double) vector2.X && (double) Position.X < (double) vector2.X + 16.0 && (double) Position.Y + (double) Height > (double) vector2.Y && (double) Position.Y < (double) vector2.Y + 4.01)
{
if (type == 210)
switch (type)
{
case 210:
WorldGen.ExplodeMine(index, j);
else if ((double) oldPosition.X + (double) Width <= (double) vector2.X || (double) oldPosition.X >= (double) vector2.X + 16.0 || (double) oldPosition.Y + (double) Height <= (double) vector2.Y || (double) oldPosition.Y >= (double) vector2.Y + 16.01)
{
if (type == 443)
{
if (objType == 1)
{
Wiring.HitSwitch(index, j);
NetMessage.SendData(59, number: index, number2: ((float) j));
}
}
else
continue;
case 442:
continue;
default:
if ((double) oldPosition.X + (double) Width <= (double) vector2.X || (double) oldPosition.X >= (double) vector2.X + 16.0 || (double) oldPosition.Y + (double) Height <= (double) vector2.Y || (double) oldPosition.Y >= (double) vector2.Y + 16.01)
{
int num5 = (int) Main.tile[index, j].frameY / 18;
bool flag2 = true;
if ((num5 == 4 || num5 == 2 || num5 == 3 || num5 == 6 || num5 == 7) && objType != 1)
if ((num5 == 4 || num5 == 2 || num5 == 3 || num5 == 6) && objType != 1)
flag2 = false;
if (num5 == 5 && (objType == 1 || objType == 4))
flag2 = false;
@ -2246,15 +2155,11 @@ label_19:
{
Wiring.HitSwitch(index, j);
NetMessage.SendData(59, number: index, number2: ((float) j));
if (num5 == 7)
{
WorldGen.KillTile(index, j);
if (Main.netMode == 1)
NetMessage.SendData(17, number2: ((float) index), number3: ((float) j));
}
return true;
}
continue;
}
continue;
}
}
}
@ -2361,8 +2266,6 @@ label_19:
return Collision.SolidTiles(startX, endX, startY, endY);
}
public static bool SolidTiles(Vector2 position, int width, int height) => Collision.SolidTiles((int) ((double) position.X / 16.0), (int) (((double) position.X + (double) width) / 16.0), (int) ((double) position.Y / 16.0), (int) (((double) position.Y + (double) height) / 16.0));
public static bool SolidTiles(int startX, int endX, int startY, int endY)
{
if (startX < 0 || endX >= Main.maxTilesX || startY < 0 || endY >= Main.maxTilesY)
@ -2410,6 +2313,8 @@ label_19:
Main.tile[x, y] = new Tile();
if (Main.tile[x, y - 1] == null)
Main.tile[x, y - 1] = new Tile();
if (Main.tile[x, y].topSlope())
flag = true;
if (waterWalk && Main.tile[x, y].liquid > (byte) 0 && Main.tile[x, y - 1].liquid == (byte) 0)
{
int num7 = (int) Main.tile[x, y].liquid / 32 * 2 + 2;
@ -2485,20 +2390,19 @@ label_19:
bool flag5 = true;
bool flag6 = true;
bool flag7;
Tile tile2;
bool flag8;
if (gravDir == 1)
{
if (Main.tile[x, index1 - gravDir] == null || Main.tile[x, index1 - (num2 + 1) * gravDir] == null)
return;
Tile tile3 = Main.tile[x, index1 - gravDir];
Tile tile4 = Main.tile[x, index1 - (num2 + 1) * gravDir];
flag7 = flag4 && (!tile3.nactive() || !Main.tileSolid[(int) tile3.type] || Main.tileSolidTop[(int) tile3.type] || tile3.slope() == (byte) 1 && (double) position.X + (double) (width / 2) > (double) (x * 16) || tile3.slope() == (byte) 2 && (double) position.X + (double) (width / 2) < (double) (x * 16 + 16) || tile3.halfBrick() && (!tile4.nactive() || !Main.tileSolid[(int) tile4.type] || Main.tileSolidTop[(int) tile4.type]));
Tile tile5 = Main.tile[x, index1];
tile2 = Main.tile[x, index1 - 1];
Tile tile2 = Main.tile[x, index1 - gravDir];
Tile tile3 = Main.tile[x, index1 - (num2 + 1) * gravDir];
flag7 = flag4 && (!tile2.nactive() || !Main.tileSolid[(int) tile2.type] || Main.tileSolidTop[(int) tile2.type] || tile2.slope() == (byte) 1 && (double) position.X + (double) (width / 2) > (double) (x * 16) || tile2.slope() == (byte) 2 && (double) position.X + (double) (width / 2) < (double) (x * 16 + 16) || tile2.halfBrick() && (!tile3.nactive() || !Main.tileSolid[(int) tile3.type] || Main.tileSolidTop[(int) tile3.type]));
Tile tile4 = Main.tile[x, index1];
Tile tile5 = Main.tile[x, index1 - 1];
if (specialChecksMode == 1)
flag6 = tile5.type != (ushort) 16 && tile5.type != (ushort) 18 && tile5.type != (ushort) 14 && tile5.type != (ushort) 469 && tile5.type != (ushort) 134;
flag8 = ((!flag5 ? (false ? 1 : 0) : (!tile5.nactive() || tile5.topSlope() && (tile5.slope() != (byte) 1 || (double) position.X + (double) (width / 2) >= (double) (x * 16)) && (tile5.slope() != (byte) 2 || (double) position.X + (double) (width / 2) <= (double) (x * 16 + 16)) || tile5.topSlope() && (double) position.Y + (double) height <= (double) (index1 * 16) || (!Main.tileSolid[(int) tile5.type] || Main.tileSolidTop[(int) tile5.type]) && ((!holdsMatching || (!Main.tileSolidTop[(int) tile5.type] || tile5.frameY != (short) 0) && !TileID.Sets.Platforms[(int) tile5.type] ? 0 : (!Main.tileSolid[(int) tile2.type] ? 1 : (!tile2.nactive() ? 1 : 0))) & (flag6 ? 1 : 0)) == 0 ? (!tile2.halfBrick() ? (false ? 1 : 0) : (tile2.nactive() ? 1 : 0)) : (true ? 1 : 0))) & (!Main.tileSolidTop[(int) tile5.type] ? 1 : (!Main.tileSolidTop[(int) tile2.type] ? 1 : 0))) != 0;
flag6 = tile4.type != (ushort) 16 && tile4.type != (ushort) 18 && tile4.type != (ushort) 134;
flag8 = ((!flag5 ? (false ? 1 : 0) : (!tile4.nactive() || tile4.topSlope() && (tile4.slope() != (byte) 1 || (double) position.X + (double) (width / 2) >= (double) (x * 16)) && (tile4.slope() != (byte) 2 || (double) position.X + (double) (width / 2) <= (double) (x * 16 + 16)) || tile4.topSlope() && (double) position.Y + (double) height <= (double) (index1 * 16) || (!Main.tileSolid[(int) tile4.type] || Main.tileSolidTop[(int) tile4.type]) && ((!holdsMatching || (!Main.tileSolidTop[(int) tile4.type] || tile4.frameY != (short) 0) && !TileID.Sets.Platforms[(int) tile4.type] ? 0 : (!Main.tileSolid[(int) tile5.type] ? 1 : (!tile5.nactive() ? 1 : 0))) & (flag6 ? 1 : 0)) == 0 ? (!tile5.halfBrick() ? (false ? 1 : 0) : (tile5.nactive() ? 1 : 0)) : (true ? 1 : 0))) & (!Main.tileSolidTop[(int) tile4.type] ? 1 : (!Main.tileSolidTop[(int) tile5.type] ? 1 : 0))) != 0;
}
else
{
@ -2506,8 +2410,8 @@ label_19:
Tile tile7 = Main.tile[x, index1 - (num2 + 1) * gravDir];
flag7 = flag4 && (!tile6.nactive() || !Main.tileSolid[(int) tile6.type] || Main.tileSolidTop[(int) tile6.type] || tile6.slope() != (byte) 0 || tile6.halfBrick() && (!tile7.nactive() || !Main.tileSolid[(int) tile7.type] || Main.tileSolidTop[(int) tile7.type]));
Tile tile8 = Main.tile[x, index1];
tile2 = Main.tile[x, index1 + 1];
flag8 = flag5 && (tile8.nactive() && (Main.tileSolid[(int) tile8.type] && !Main.tileSolidTop[(int) tile8.type] || holdsMatching && Main.tileSolidTop[(int) tile8.type] && tile8.frameY == (short) 0 && (!Main.tileSolid[(int) tile2.type] || !tile2.nactive())) || tile2.halfBrick() && tile2.nactive());
Tile tile9 = Main.tile[x, index1 + 1];
flag8 = flag5 && (tile8.nactive() && (Main.tileSolid[(int) tile8.type] && !Main.tileSolidTop[(int) tile8.type] || holdsMatching && Main.tileSolidTop[(int) tile8.type] && tile8.frameY == (short) 0 && (!Main.tileSolid[(int) tile9.type] || !tile9.nactive())) || tile9.halfBrick() && tile9.nactive());
}
if ((double) (x * 16) >= (double) vector2.X + (double) width || (double) (x * 16 + 16) <= (double) vector2.X)
return;
@ -2534,7 +2438,7 @@ label_19:
}
else
{
if (!(flag8 & flag7 & flag1 & flag3) || Main.tile[x, index1].bottomSlope() || TileID.Sets.Platforms[(int) tile2.type])
if (!(flag8 & flag7 & flag1 & flag3) || Main.tile[x, index1].bottomSlope())
return;
float num5 = (float) (index1 * 16 + 16);
if ((double) num5 <= (double) vector2.Y)
@ -2636,12 +2540,12 @@ label_19:
++x2;
if (y2 % 16 == 0)
++y2;
int num3 = x2 / 16 - x1 / 16;
int num3 = x2 / 16 - x1 / 16 + 1;
int num4 = y2 / 16 - y1 / 16;
List<Point> pointList = new List<Point>();
int x3 = x1 / 16;
int y3 = y1 / 16;
for (int x4 = x3; x4 <= x3 + num3; ++x4)
for (int x4 = x3; x4 < x3 + num3; ++x4)
{
if (up)
pointList.Add(new Point(x4, y3));
@ -2660,19 +2564,17 @@ label_19:
public static void StepConveyorBelt(Entity entity, float gravDir)
{
Player player = (Player) null;
if (entity is Player)
{
player = (Player) entity;
Player player = (Player) entity;
if ((double) Math.Abs(player.gfxOffY) > 2.0 || player.grapCount > 0 || player.pulley)
return;
entity.height -= 5;
entity.position.Y += 5f;
}
int num1 = 0;
int num2 = 0;
bool flag = false;
int num3 = (int) entity.position.Y + entity.height;
int y = (int) entity.position.Y;
int height = entity.height;
entity.Hitbox.Inflate(2, 2);
Vector2 topLeft = entity.TopLeft;
Vector2 topRight = entity.TopRight;
@ -2681,14 +2583,12 @@ label_19:
List<Point> entityEdgeTiles = Collision.GetEntityEdgeTiles(entity, false, false);
Vector2 vector2_1 = new Vector2(0.0001f);
foreach (Point point in entityEdgeTiles)
{
if (WorldGen.InWorld(point.X, point.Y) && (player == null || !player.onTrack || point.Y >= num3))
{
Tile tile = Main.tile[point.X, point.Y];
if (tile != null && tile.active() && tile.nactive())
{
int num4 = TileID.Sets.ConveyorDirection[(int) tile.type];
if (num4 != 0)
int num3 = TileID.Sets.ConveyorDirection[(int) tile.type];
if (num3 != 0)
{
Vector2 lineStart1;
Vector2 lineStart2;
@ -2719,34 +2619,28 @@ label_19:
lineStart1.Y = lineEnd1.Y = (float) (point.Y * 16 + 16);
break;
}
int num5 = 0;
int num4 = 0;
if (!TileID.Sets.Platforms[(int) tile.type] && Collision.CheckAABBvLineCollision2(entity.position - vector2_1, entity.Size + vector2_1 * 2f, lineStart1, lineEnd1))
--num5;
--num4;
if (Collision.CheckAABBvLineCollision2(entity.position - vector2_1, entity.Size + vector2_1 * 2f, lineStart2, lineEnd2))
++num5;
if (num5 != 0)
++num4;
if (num4 != 0)
{
flag = true;
num1 += num4 * num5 * (int) gravDir;
num1 += num3 * num4 * (int) gravDir;
if (tile.leftSlope())
num2 += (int) gravDir * -num4;
num2 += (int) gravDir * -num3;
if (tile.rightSlope())
num2 -= (int) gravDir * -num4;
num2 -= (int) gravDir * -num3;
}
}
}
}
}
if (entity is Player)
{
entity.height += 5;
entity.position.Y -= 5f;
}
if (!flag || num1 == 0)
return;
int num6 = Math.Sign(num1);
int num7 = Math.Sign(num2);
Vector2 Velocity = Vector2.Normalize(new Vector2((float) num6 * gravDir, (float) num7)) * 2.5f;
int num5 = Math.Sign(num1);
int num6 = Math.Sign(num2);
Vector2 Velocity = Vector2.Normalize(new Vector2((float) num5 * gravDir, (float) num6)) * 2.5f;
Vector2 vector2_2 = Collision.TileCollision(entity.position, Velocity, entity.width, entity.height, gravDir: ((int) gravDir));
entity.position += vector2_2;
Velocity = new Vector2(0.0f, 2.5f * gravDir);
@ -2960,18 +2854,5 @@ label_19:
samples[index] = num2;
}
}
public static void AimingLaserScan(
Vector2 startPoint,
Vector2 endPoint,
float samplingWidth,
int samplesToTake,
out Vector2 vectorTowardsTarget,
out float[] samples)
{
samples = new float[samplesToTake];
vectorTowardsTarget = endPoint - startPoint;
Collision.LaserScan(startPoint, vectorTowardsTarget.SafeNormalize(Vector2.Zero), samplingWidth, vectorTowardsTarget.Length(), samples);
}
}
}

View file

@ -1,11 +1,10 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.CombatText
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly: 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;
namespace Terraria
{
@ -25,7 +24,7 @@ namespace Terraria
public Vector2 velocity;
public float alpha;
public int alphaDir = 1;
public string text = "";
public string text;
public float scale = 1f;
public float rotation;
public Color color;
@ -60,7 +59,7 @@ namespace Terraria
int index2 = 0;
if (dramatic)
index2 = 1;
Vector2 vector2 = FontAssets.CombatText[index2].Value.MeasureString(text);
Vector2 vector2 = Main.fontCombatText[index2].MeasureString(text);
Main.combatText[index1].alpha = 1f;
Main.combatText[index1].alphaDir = -1;
Main.combatText[index1].active = true;
@ -108,7 +107,7 @@ namespace Terraria
Main.combatText[index].active = false;
}
public static float TargetScale => 1f;
public static float TargetScale => Main.UIScale / (Main.GameViewMatrix.Zoom.X / Main.ForcedMinimumZoom);
public void Update()
{

View file

@ -1,7 +1,7 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.DataStructures.AnchorData
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly: 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;

View file

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

View file

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

View file

@ -1,7 +1,7 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.DataStructures.BufferPool
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly: 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;

View file

@ -1,7 +1,7 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.DataStructures.CachedBuffer
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly: 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;

View file

@ -1,7 +1,7 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.DataStructures.ColorSlidersSet
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly: 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;

View file

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

View file

@ -1,7 +1,7 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.DataStructures.DoubleStack`1
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly: 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;

View file

@ -1,7 +1,7 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.DataStructures.DrawAnimation
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly: 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;
@ -20,6 +20,6 @@ namespace Terraria.DataStructures
{
}
public virtual Rectangle GetFrame(Texture2D texture, int frameCounterOverride = -1) => texture.Frame();
public virtual Rectangle GetFrame(Texture2D texture) => texture.Frame();
}
}

View file

@ -1,7 +1,7 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.DataStructures.DrawAnimationVertical
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly: 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;
@ -11,61 +11,24 @@ namespace Terraria.DataStructures
{
public class DrawAnimationVertical : DrawAnimation
{
public bool PingPong;
public bool NotActuallyAnimating;
public DrawAnimationVertical(int ticksperframe, int frameCount, bool pingPong = false)
public DrawAnimationVertical(int ticksperframe, int frameCount)
{
this.Frame = 0;
this.FrameCounter = 0;
this.FrameCount = frameCount;
this.TicksPerFrame = ticksperframe;
this.PingPong = pingPong;
}
public override void Update()
{
if (this.NotActuallyAnimating)
return;
if (++this.FrameCounter < this.TicksPerFrame)
return;
this.FrameCounter = 0;
if (this.PingPong)
{
if (++this.Frame < this.FrameCount * 2 - 2)
return;
this.Frame = 0;
}
else
{
if (++this.Frame < this.FrameCount)
return;
this.Frame = 0;
}
}
public override Rectangle GetFrame(Texture2D texture, int frameCounterOverride = -1)
{
if (frameCounterOverride != -1)
{
int num1 = frameCounterOverride / this.TicksPerFrame;
int num2 = this.FrameCount;
if (this.PingPong)
num2 = num2 * 2 - 1;
int num3 = num2;
int frameY = num1 % num3;
if (this.PingPong && frameY >= this.FrameCount)
frameY = this.FrameCount * 2 - 2 - frameY;
Rectangle rectangle = texture.Frame(verticalFrames: this.FrameCount, frameY: frameY);
rectangle.Height -= 2;
return rectangle;
}
int frameY1 = this.Frame;
if (this.PingPong && this.Frame >= this.FrameCount)
frameY1 = this.FrameCount * 2 - 2 - this.Frame;
Rectangle rectangle1 = texture.Frame(verticalFrames: this.FrameCount, frameY: frameY1);
rectangle1.Height -= 2;
return rectangle1;
}
public override Rectangle GetFrame(Texture2D texture) => texture.Frame(verticalFrames: this.FrameCount, frameY: this.Frame);
}
}

View file

@ -1,7 +1,7 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.DataStructures.DrawData
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly: 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;

View file

@ -1,7 +1,7 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.DataStructures.DrillDebugDraw
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly: 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;

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,7 +1,7 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.DataStructures.MethodSequenceListItem
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly: 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;

View file

@ -1,7 +1,7 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.DataStructures.NPCAimedTarget
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly: 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;

View file

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

View file

@ -1,7 +1,7 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.DataStructures.PlacementHook
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly: 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;
@ -10,15 +10,15 @@ namespace Terraria.DataStructures
{
public struct PlacementHook
{
public Func<int, int, int, int, int, int, int> hook;
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, int>) null, 0, 0, false);
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, int> hook,
Func<int, int, int, int, int, int> hook,
int badReturn,
int badResponse,
bool processedCoordinates)

View file

@ -1,7 +1,7 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.DataStructures.PlayerDeathReason
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly: 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;
@ -11,47 +11,45 @@ namespace Terraria.DataStructures
{
public class PlayerDeathReason
{
private int _sourcePlayerIndex = -1;
private int _sourceNPCIndex = -1;
private int _sourceProjectileIndex = -1;
private int _sourceOtherIndex = -1;
private int _sourceProjectileType;
private int _sourceItemType;
private int _sourceItemPrefix;
private string _sourceCustomReason;
public int? SourceProjectileType => this._sourceProjectileIndex == -1 ? new int?() : new int?(this._sourceProjectileType);
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
SourceOtherIndex = 254
};
public static PlayerDeathReason LegacyDefault() => new PlayerDeathReason()
{
_sourceOtherIndex = (int) byte.MaxValue
SourceOtherIndex = (int) byte.MaxValue
};
public static PlayerDeathReason ByNPC(int index) => new PlayerDeathReason()
{
_sourceNPCIndex = index
SourceNPCIndex = index
};
public static PlayerDeathReason ByCustomReason(string reasonInEnglish) => new PlayerDeathReason()
{
_sourceCustomReason = reasonInEnglish
SourceCustomReason = reasonInEnglish
};
public static PlayerDeathReason ByPlayer(int index) => new PlayerDeathReason()
{
_sourcePlayerIndex = index,
_sourceItemType = Main.player[index].inventory[Main.player[index].selectedItem].type,
_sourceItemPrefix = (int) Main.player[index].inventory[Main.player[index].selectedItem].prefix
SourcePlayerIndex = index,
SourceItemType = Main.player[index].inventory[Main.player[index].selectedItem].type,
SourceItemPrefix = (int) Main.player[index].inventory[Main.player[index].selectedItem].prefix
};
public static PlayerDeathReason ByOther(int type) => new PlayerDeathReason()
{
_sourceOtherIndex = type
SourceOtherIndex = type
};
public static PlayerDeathReason ByProjectile(
@ -60,49 +58,49 @@ namespace Terraria.DataStructures
{
PlayerDeathReason playerDeathReason = new PlayerDeathReason()
{
_sourcePlayerIndex = playerIndex,
_sourceProjectileIndex = projectileIndex,
_sourceProjectileType = Main.projectile[projectileIndex].type
SourcePlayerIndex = playerIndex,
SourceProjectileIndex = projectileIndex,
SourceProjectileType = Main.projectile[projectileIndex].type
};
if (playerIndex >= 0 && playerIndex <= (int) byte.MaxValue)
{
playerDeathReason._sourceItemType = Main.player[playerIndex].inventory[Main.player[playerIndex].selectedItem].type;
playerDeathReason._sourceItemPrefix = (int) Main.player[playerIndex].inventory[Main.player[playerIndex].selectedItem].prefix;
playerDeathReason.SourceItemType = Main.player[playerIndex].inventory[Main.player[playerIndex].selectedItem].type;
playerDeathReason.SourceItemPrefix = (int) Main.player[playerIndex].inventory[Main.player[playerIndex].selectedItem].prefix;
}
return playerDeathReason;
}
public NetworkText GetDeathText(string deadPlayerName) => this._sourceCustomReason != null ? NetworkText.FromLiteral(this._sourceCustomReason) : Lang.CreateDeathMessage(deadPlayerName, this._sourcePlayerIndex, this._sourceNPCIndex, this._sourceProjectileIndex, this._sourceOtherIndex, this._sourceProjectileType, this._sourceItemType);
public NetworkText GetDeathText(string deadPlayerName) => this.SourceCustomReason != null ? NetworkText.FromLiteral(this.SourceCustomReason) : Lang.CreateDeathMessage(deadPlayerName, this.SourcePlayerIndex, this.SourceNPCIndex, this.SourceProjectileIndex, this.SourceOtherIndex, this.SourceProjectileType, this.SourceItemType);
public void WriteSelfTo(BinaryWriter writer)
{
BitsByte bitsByte = (BitsByte) (byte) 0;
bitsByte[0] = this._sourcePlayerIndex != -1;
bitsByte[1] = this._sourceNPCIndex != -1;
bitsByte[2] = this._sourceProjectileIndex != -1;
bitsByte[3] = this._sourceOtherIndex != -1;
bitsByte[4] = (uint) this._sourceProjectileType > 0U;
bitsByte[5] = (uint) this._sourceItemType > 0U;
bitsByte[6] = (uint) this._sourceItemPrefix > 0U;
bitsByte[7] = this._sourceCustomReason != null;
bitsByte[0] = this.SourcePlayerIndex != -1;
bitsByte[1] = this.SourceNPCIndex != -1;
bitsByte[2] = this.SourceProjectileIndex != -1;
bitsByte[3] = this.SourceOtherIndex != -1;
bitsByte[4] = (uint) this.SourceProjectileType > 0U;
bitsByte[5] = (uint) this.SourceItemType > 0U;
bitsByte[6] = (uint) this.SourceItemPrefix > 0U;
bitsByte[7] = this.SourceCustomReason != null;
writer.Write((byte) bitsByte);
if (bitsByte[0])
writer.Write((short) this._sourcePlayerIndex);
writer.Write((short) this.SourcePlayerIndex);
if (bitsByte[1])
writer.Write((short) this._sourceNPCIndex);
writer.Write((short) this.SourceNPCIndex);
if (bitsByte[2])
writer.Write((short) this._sourceProjectileIndex);
writer.Write((short) this.SourceProjectileIndex);
if (bitsByte[3])
writer.Write((byte) this._sourceOtherIndex);
writer.Write((byte) this.SourceOtherIndex);
if (bitsByte[4])
writer.Write((short) this._sourceProjectileType);
writer.Write((short) this.SourceProjectileType);
if (bitsByte[5])
writer.Write((short) this._sourceItemType);
writer.Write((short) this.SourceItemType);
if (bitsByte[6])
writer.Write((byte) this._sourceItemPrefix);
writer.Write((byte) this.SourceItemPrefix);
if (!bitsByte[7])
return;
writer.Write(this._sourceCustomReason);
writer.Write(this.SourceCustomReason);
}
public static PlayerDeathReason FromReader(BinaryReader reader)
@ -110,21 +108,21 @@ namespace Terraria.DataStructures
PlayerDeathReason playerDeathReason = new PlayerDeathReason();
BitsByte bitsByte = (BitsByte) reader.ReadByte();
if (bitsByte[0])
playerDeathReason._sourcePlayerIndex = (int) reader.ReadInt16();
playerDeathReason.SourcePlayerIndex = (int) reader.ReadInt16();
if (bitsByte[1])
playerDeathReason._sourceNPCIndex = (int) reader.ReadInt16();
playerDeathReason.SourceNPCIndex = (int) reader.ReadInt16();
if (bitsByte[2])
playerDeathReason._sourceProjectileIndex = (int) reader.ReadInt16();
playerDeathReason.SourceProjectileIndex = (int) reader.ReadInt16();
if (bitsByte[3])
playerDeathReason._sourceOtherIndex = (int) reader.ReadByte();
playerDeathReason.SourceOtherIndex = (int) reader.ReadByte();
if (bitsByte[4])
playerDeathReason._sourceProjectileType = (int) reader.ReadInt16();
playerDeathReason.SourceProjectileType = (int) reader.ReadInt16();
if (bitsByte[5])
playerDeathReason._sourceItemType = (int) reader.ReadInt16();
playerDeathReason.SourceItemType = (int) reader.ReadInt16();
if (bitsByte[6])
playerDeathReason._sourceItemPrefix = (int) reader.ReadByte();
playerDeathReason.SourceItemPrefix = (int) reader.ReadByte();
if (bitsByte[7])
playerDeathReason._sourceCustomReason = reader.ReadString();
playerDeathReason.SourceCustomReason = reader.ReadString();
return playerDeathReason;
}
}

View file

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

View file

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

View file

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

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

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

View file

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

View file

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

View file

@ -1,7 +1,7 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.DataStructures.Point16
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly: 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;

View file

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

View file

@ -1,7 +1,7 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.DataStructures.SoundPlaySet
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly: 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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,25 +1,22 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.DataStructures.TileEntity
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly: 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 System;
using System.Collections.Generic;
using System.IO;
using Terraria.Audio;
using Terraria.GameInput;
using Terraria.GameContent.Tile_Entities;
namespace Terraria.DataStructures
{
public abstract class TileEntity
{
public static TileEntitiesManager manager;
public const int MaxEntitiesPerChunk = 1000;
public static Dictionary<int, TileEntity> ByID = new Dictionary<int, TileEntity>();
public static Dictionary<Point16, TileEntity> ByPosition = new Dictionary<Point16, TileEntity>();
public static int TileEntitiesNextID;
public static int TileEntitiesNextID = 0;
public int ID;
public Point16 Position;
public byte type;
@ -30,6 +27,8 @@ namespace Terraria.DataStructures
public static event Action _UpdateEnd;
public static event Action<int, int, int> _NetPlaceEntity;
public static void Clear()
{
TileEntity.ByID.Clear();
@ -53,15 +52,16 @@ namespace Terraria.DataStructures
public static void InitializeAll()
{
TileEntity.manager = new TileEntitiesManager();
TileEntity.manager.RegisterAll();
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)))
if (!WorldGen.InWorld(x, y) || TileEntity.ByPosition.ContainsKey(new Point16(x, y)) || TileEntity._NetPlaceEntity == null)
return;
TileEntity.manager.NetPlaceEntity(type, x, y);
TileEntity._NetPlaceEntity(x, y, type);
}
public virtual void Update()
@ -76,11 +76,23 @@ namespace Terraria.DataStructures
public static TileEntity Read(BinaryReader reader, bool networkSend = false)
{
TileEntity tileEntity = (TileEntity) null;
byte num = reader.ReadByte();
TileEntity instance = TileEntity.manager.GenerateInstance((int) num);
instance.type = num;
instance.ReadInner(reader, networkSend);
return instance;
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)
@ -107,113 +119,5 @@ namespace Terraria.DataStructures
public virtual void ReadExtraData(BinaryReader reader, bool networkSend)
{
}
public virtual void OnPlayerUpdate(Player player)
{
}
public static bool IsOccupied(int id, out int interactingPlayer)
{
interactingPlayer = -1;
for (int index = 0; index < (int) byte.MaxValue; ++index)
{
Player player = Main.player[index];
if (player.active && !player.dead && player.tileEntityAnchor.interactEntityID == id)
{
interactingPlayer = index;
return true;
}
}
return false;
}
public virtual void OnInventoryDraw(Player player, SpriteBatch spriteBatch)
{
}
public virtual string GetItemGamepadInstructions(int slot = 0) => "";
public virtual bool TryGetItemGamepadOverrideInstructions(
Item[] inv,
int context,
int slot,
out string instruction)
{
instruction = (string) null;
return false;
}
public virtual bool OverrideItemSlotHover(Item[] inv, int context = 0, int slot = 0) => false;
public virtual bool OverrideItemSlotLeftClick(Item[] inv, int context = 0, int slot = 0) => false;
public static void BasicOpenCloseInteraction(Player player, int x, int y, int id)
{
player.CloseSign();
if (Main.netMode != 1)
{
Main.stackSplit = 600;
player.GamepadEnableGrappleCooldown();
int interactingPlayer;
if (TileEntity.IsOccupied(id, out interactingPlayer))
{
if (interactingPlayer != player.whoAmI)
return;
Recipe.FindRecipes();
SoundEngine.PlaySound(11);
player.tileEntityAnchor.Clear();
}
else
TileEntity.SetInteractionAnchor(player, x, y, id);
}
else
{
Main.stackSplit = 600;
player.GamepadEnableGrappleCooldown();
int interactingPlayer;
if (TileEntity.IsOccupied(id, out interactingPlayer))
{
if (interactingPlayer != player.whoAmI)
return;
Recipe.FindRecipes();
SoundEngine.PlaySound(11);
player.tileEntityAnchor.Clear();
NetMessage.SendData(122, number: -1, number2: ((float) Main.myPlayer));
}
else
NetMessage.SendData(122, number: id, number2: ((float) Main.myPlayer));
}
}
public static void SetInteractionAnchor(Player player, int x, int y, int id)
{
player.chest = -1;
player.SetTalkNPC(-1);
if (player.whoAmI == Main.myPlayer)
{
Main.playerInventory = true;
Main.recBigList = false;
Main.CreativeMenu.CloseMenu();
if (PlayerInput.GrappleAndInteractAreShared)
PlayerInput.Triggers.JustPressed.Grapple = false;
if (player.tileEntityAnchor.interactEntityID != -1)
SoundEngine.PlaySound(12);
else
SoundEngine.PlaySound(10);
}
player.tileEntityAnchor.Set(id, x, y);
}
public virtual void RegisterTileEntityID(int assignedID)
{
}
public virtual void NetPlaceEntityAttempt(int x, int y)
{
}
public virtual bool IsTileValidForEntity(int x, int y) => false;
public virtual TileEntity GenerateInstance() => (TileEntity) null;
}
}

View file

@ -1,7 +1,7 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.DataStructures.TileObjectPreviewData
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly: 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;

View file

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

View file

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

View file

@ -1,14 +1,12 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.DelegateMethods
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly: 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.Audio;
using Terraria.DataStructures;
using Terraria.Enums;
using Terraria.Graphics.Shaders;
using Terraria.ID;
namespace Terraria
@ -16,10 +14,9 @@ namespace Terraria
public static class DelegateMethods
{
public static Vector3 v3_1 = Vector3.Zero;
public static Vector2 v2_1 = Vector2.Zero;
public static float f_1 = 0.0f;
public static Color c_1 = Color.Transparent;
public static int i_1;
public static 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);
@ -32,118 +29,6 @@ namespace Terraria
public static Color ColorLerp_HSL_O(float percent) => Color.Lerp(Color.White, Main.hslToRgb(DelegateMethods.v3_1.X, DelegateMethods.v3_1.Y, DelegateMethods.v3_1.Z), percent);
public static bool SpreadDirt(int x, int y)
{
if ((double) Vector2.Distance(DelegateMethods.v2_1, new Vector2((float) x, (float) y)) > (double) DelegateMethods.f_1 || !WorldGen.PlaceTile(x, y, 0))
return false;
if (Main.netMode != 0)
NetMessage.SendData(17, number: 1, number2: ((float) x), number3: ((float) y));
Vector2 Position = new Vector2((float) (x * 16), (float) (y * 16));
int Type = 0;
for (int index = 0; index < 3; ++index)
{
Dust dust1 = Dust.NewDustDirect(Position, 16, 16, Type, Alpha: 100, newColor: Color.Transparent, Scale: 2.2f);
dust1.noGravity = true;
dust1.velocity.Y -= 1.2f;
dust1.velocity *= 4f;
Dust dust2 = Dust.NewDustDirect(Position, 16, 16, Type, Alpha: 100, newColor: Color.Transparent, Scale: 1.3f);
dust2.velocity.Y -= 1.2f;
dust2.velocity *= 2f;
}
int i = x;
int j1 = y + 1;
if (Main.tile[i, j1] != null && !TileID.Sets.Platforms[(int) Main.tile[i, j1].type] && (Main.tile[i, j1].topSlope() || Main.tile[i, j1].halfBrick()))
{
WorldGen.SlopeTile(i, j1);
if (Main.netMode != 0)
NetMessage.SendData(17, number: 14, number2: ((float) i), number3: ((float) j1));
}
int j2 = y - 1;
if (Main.tile[i, j2] != null && !TileID.Sets.Platforms[(int) Main.tile[i, j2].type] && Main.tile[i, j2].bottomSlope())
{
WorldGen.SlopeTile(i, j2);
if (Main.netMode != 0)
NetMessage.SendData(17, number: 14, number2: ((float) i), number3: ((float) j2));
}
return true;
}
public static bool SpreadWater(int x, int y)
{
if ((double) Vector2.Distance(DelegateMethods.v2_1, new Vector2((float) x, (float) y)) > (double) DelegateMethods.f_1 || !WorldGen.PlaceLiquid(x, y, (byte) 0, byte.MaxValue))
return false;
Vector2 Position = new Vector2((float) (x * 16), (float) (y * 16));
int Type = Dust.dustWater();
for (int index = 0; index < 3; ++index)
{
Dust dust1 = Dust.NewDustDirect(Position, 16, 16, Type, Alpha: 100, newColor: Color.Transparent, Scale: 2.2f);
dust1.noGravity = true;
dust1.velocity.Y -= 1.2f;
dust1.velocity *= 7f;
Dust dust2 = Dust.NewDustDirect(Position, 16, 16, Type, Alpha: 100, newColor: Color.Transparent, Scale: 1.3f);
dust2.velocity.Y -= 1.2f;
dust2.velocity *= 4f;
}
return true;
}
public static bool SpreadHoney(int x, int y)
{
if ((double) Vector2.Distance(DelegateMethods.v2_1, new Vector2((float) x, (float) y)) > (double) DelegateMethods.f_1 || !WorldGen.PlaceLiquid(x, y, (byte) 2, byte.MaxValue))
return false;
Vector2 Position = new Vector2((float) (x * 16), (float) (y * 16));
int Type = 152;
for (int index = 0; index < 3; ++index)
{
Dust dust1 = Dust.NewDustDirect(Position, 16, 16, Type, Alpha: 100, newColor: Color.Transparent, Scale: 2.2f);
dust1.velocity.Y -= 1.2f;
dust1.velocity *= 7f;
Dust dust2 = Dust.NewDustDirect(Position, 16, 16, Type, Alpha: 100, newColor: Color.Transparent, Scale: 1.3f);
dust2.velocity.Y -= 1.2f;
dust2.velocity *= 4f;
}
return true;
}
public static bool SpreadLava(int x, int y)
{
if ((double) Vector2.Distance(DelegateMethods.v2_1, new Vector2((float) x, (float) y)) > (double) DelegateMethods.f_1 || !WorldGen.PlaceLiquid(x, y, (byte) 1, byte.MaxValue))
return false;
Vector2 Position = new Vector2((float) (x * 16), (float) (y * 16));
int Type = 35;
for (int index = 0; index < 3; ++index)
{
Dust.NewDustDirect(Position, 16, 16, Type, Alpha: 100, newColor: Color.Transparent, Scale: 1.2f).velocity *= 7f;
Dust.NewDustDirect(Position, 16, 16, Type, Alpha: 100, newColor: Color.Transparent, Scale: 0.8f).velocity *= 4f;
}
return true;
}
public static bool SpreadDry(int x, int y)
{
if ((double) Vector2.Distance(DelegateMethods.v2_1, new Vector2((float) x, (float) y)) > (double) DelegateMethods.f_1 || !WorldGen.EmptyLiquid(x, y))
return false;
Vector2 Position = new Vector2((float) (x * 16), (float) (y * 16));
int Type = 31;
for (int index = 0; index < 3; ++index)
{
Dust dust = Dust.NewDustDirect(Position, 16, 16, Type, Alpha: 100, newColor: Color.Transparent, Scale: 1.2f);
dust.noGravity = true;
dust.velocity *= 7f;
Dust.NewDustDirect(Position, 16, 16, Type, Alpha: 100, newColor: Color.Transparent, Scale: 0.8f).velocity *= 4f;
}
return true;
}
public static bool SpreadTest(int x, int y)
{
Tile tile = Main.tile[x, y];
if (!WorldGen.SolidTile(x, y) && tile.wall == (ushort) 0)
return true;
tile.active();
return false;
}
public static bool TestDust(int x, int y)
{
if (x < 0 || x >= Main.maxTilesX || y < 0 || y >= Main.maxTilesY)
@ -171,26 +56,6 @@ namespace Terraria
return true;
}
public static bool CastLightOpen_StopForSolids_ScaleWithDistance(int x, int y)
{
if (x < 0 || x >= Main.maxTilesX || y < 0 || y >= Main.maxTilesY || Main.tile[x, y] == null || Main.tile[x, y].active() && !Main.tile[x, y].inActive() && !Main.tileSolidTop[(int) Main.tile[x, y].type] && Main.tileSolid[(int) Main.tile[x, y].type])
return false;
Vector3 v31 = DelegateMethods.v3_1;
Vector2 vector2 = new Vector2((float) x, (float) y);
float num = Vector2.Distance(DelegateMethods.v2_1, vector2);
Vector3 vector3 = v31 * MathHelper.Lerp(0.65f, 1f, num / DelegateMethods.f_1);
Lighting.AddLight(x, y, vector3.X, vector3.Y, vector3.Z);
return true;
}
public static bool EmitGolfCartDust_StopForSolids(int x, int y)
{
if (x < 0 || x >= Main.maxTilesX || y < 0 || y >= Main.maxTilesY || Main.tile[x, y] == null || Main.tile[x, y].active() && !Main.tile[x, y].inActive() && !Main.tileSolidTop[(int) Main.tile[x, y].type] && Main.tileSolid[(int) Main.tile[x, y].type])
return false;
Dust.NewDustPerfect(new Vector2((float) (x * 16 + 8), (float) (y * 16 + 8)), 260, new Vector2?(Vector2.UnitY * -0.2f));
return true;
}
public static bool NotDoorStand(int x, int y)
{
if (Main.tile[x, y] == null || !Main.tile[x, y].active() || Main.tile[x, y].type != (ushort) 11)
@ -351,10 +216,6 @@ namespace Terraria
Main.dust[index].scale *= 0.6f;
}
public static void LandingSound(Vector2 Position, int Width, int Height) => SoundEngine.PlaySound(SoundID.Item53, (int) Position.X + Width / 2, (int) Position.Y + Height / 2);
public static void BumperSound(Vector2 Position, int Width, int Height) => SoundEngine.PlaySound(SoundID.Item56, (int) Position.X + Width / 2, (int) Position.Y + Height / 2);
public static void SparksMech(Vector2 dustPosition)
{
dustPosition += new Vector2(Main.rand.Next(2) == 0 ? 13f : -13f, 0.0f).RotatedBy((double) DelegateMethods.Minecart.rotation);
@ -371,24 +232,6 @@ namespace Terraria
else
Main.dust[index].scale *= 0.6f;
}
public static void SparksMeow(Vector2 dustPosition)
{
dustPosition += new Vector2(Main.rand.Next(2) == 0 ? 13f : -13f, 0.0f).RotatedBy((double) DelegateMethods.Minecart.rotation);
int index = Dust.NewDust(dustPosition, 1, 1, 213, (float) Main.rand.Next(-2, 3), (float) Main.rand.Next(-2, 3));
Main.dust[index].shader = GameShaders.Armor.GetShaderFromItemId(2870);
Main.dust[index].noGravity = true;
Main.dust[index].fadeIn = (float) ((double) Main.dust[index].scale + 1.0 + 0.00999999977648258 * (double) Main.rand.Next(0, 51));
Main.dust[index].noGravity = true;
Main.dust[index].velocity *= (float) Main.rand.Next(15, 51) * 0.01f;
Main.dust[index].velocity.X *= (float) Main.rand.Next(25, 101) * 0.01f;
Main.dust[index].velocity.Y -= (float) Main.rand.Next(15, 31) * 0.1f;
Main.dust[index].position.Y -= 4f;
if (Main.rand.Next(3) != 0)
Main.dust[index].noGravity = false;
else
Main.dust[index].scale *= 0.6f;
}
}
}
}

View file

@ -1,7 +1,7 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.DeprecatedClassLeftInForLoading
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly: 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;

793
Dust.cs

File diff suppressed because it is too large Load diff

View file

@ -1,7 +1,7 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.Entity
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly: 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;
@ -26,8 +26,6 @@ namespace Terraria
public byte wetCount;
public bool lavaWet;
public virtual Vector2 VisualPosition => this.position;
public float AngleTo(Vector2 Destination) => (float) Math.Atan2((double) Destination.Y - (double) this.Center.Y, (double) Destination.X - (double) this.Center.X);
public float AngleFrom(Vector2 Source) => (float) Math.Atan2((double) this.Center.Y - (double) Source.Y, (double) this.Center.X - (double) Source.X);

View file

@ -1,7 +1,7 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.Enums.AnchorType
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly: 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;

View file

@ -1,26 +0,0 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.Enums.ItemRarityColor
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
namespace Terraria.Enums
{
public enum ItemRarityColor
{
AmberMinus11 = -11, // 0xFFFFFFF5
TrashMinus1 = -1, // 0xFFFFFFFF
White0 = 0,
Blue1 = 1,
Green2 = 2,
Orange3 = 3,
LightRed4 = 4,
Pink5 = 5,
LightPurple6 = 6,
Lime7 = 7,
Yellow8 = 8,
Cyan9 = 9,
StrongRed10 = 10, // 0x0000000A
Purple11 = 11, // 0x0000000B
}
}

Some files were not shown because too many files have changed in this diff Show more