Terraria 1.4.0.5 Source Code
This commit is contained in:
commit
05205f009e
1059 changed files with 563450 additions and 0 deletions
17
GameInput/InputMode.cs
Normal file
17
GameInput/InputMode.cs
Normal file
|
@ -0,0 +1,17 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.GameInput.InputMode
|
||||
// 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.GameInput
|
||||
{
|
||||
public enum InputMode
|
||||
{
|
||||
Keyboard,
|
||||
KeyboardUI,
|
||||
Mouse,
|
||||
XBoxGamepad,
|
||||
XBoxGamepadUI,
|
||||
}
|
||||
}
|
80
GameInput/KeyConfiguration.cs
Normal file
80
GameInput/KeyConfiguration.cs
Normal file
|
@ -0,0 +1,80 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.GameInput.KeyConfiguration
|
||||
// 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 System.Linq;
|
||||
|
||||
namespace Terraria.GameInput
|
||||
{
|
||||
public class KeyConfiguration
|
||||
{
|
||||
public Dictionary<string, List<string>> KeyStatus = new Dictionary<string, List<string>>();
|
||||
|
||||
public bool DoGrappleAndInteractShareTheSameKey => this.KeyStatus["Grapple"].Count > 0 && this.KeyStatus["MouseRight"].Count > 0 && this.KeyStatus["MouseRight"].Contains(this.KeyStatus["Grapple"][0]);
|
||||
|
||||
public void SetupKeys()
|
||||
{
|
||||
this.KeyStatus.Clear();
|
||||
foreach (string knownTrigger in PlayerInput.KnownTriggers)
|
||||
this.KeyStatus.Add(knownTrigger, new List<string>());
|
||||
}
|
||||
|
||||
public void Processkey(TriggersSet set, string newKey)
|
||||
{
|
||||
foreach (KeyValuePair<string, List<string>> keyStatu in this.KeyStatus)
|
||||
{
|
||||
if (keyStatu.Value.Contains(newKey))
|
||||
set.KeyStatus[keyStatu.Key] = true;
|
||||
}
|
||||
if (!set.Up && !set.Down && !set.Left && !set.Right && !set.HotbarPlus && !set.HotbarMinus && (!Main.gameMenu && !Main.ingameOptionsWindow || !set.MenuUp && !set.MenuDown && !set.MenuLeft && !set.MenuRight))
|
||||
return;
|
||||
set.UsedMovementKey = true;
|
||||
}
|
||||
|
||||
public void CopyKeyState(TriggersSet oldSet, TriggersSet newSet, string newKey)
|
||||
{
|
||||
foreach (KeyValuePair<string, List<string>> keyStatu in this.KeyStatus)
|
||||
{
|
||||
if (keyStatu.Value.Contains(newKey))
|
||||
newSet.KeyStatus[keyStatu.Key] = oldSet.KeyStatus[keyStatu.Key];
|
||||
}
|
||||
}
|
||||
|
||||
public void ReadPreferences(Dictionary<string, List<string>> dict)
|
||||
{
|
||||
foreach (KeyValuePair<string, List<string>> keyValuePair in dict)
|
||||
{
|
||||
if (this.KeyStatus.ContainsKey(keyValuePair.Key))
|
||||
{
|
||||
this.KeyStatus[keyValuePair.Key].Clear();
|
||||
foreach (string str in keyValuePair.Value)
|
||||
this.KeyStatus[keyValuePair.Key].Add(str);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Dictionary<string, List<string>> WritePreferences()
|
||||
{
|
||||
Dictionary<string, List<string>> dictionary = new Dictionary<string, List<string>>();
|
||||
foreach (KeyValuePair<string, List<string>> keyStatu in this.KeyStatus)
|
||||
{
|
||||
if (keyStatu.Value.Count > 0)
|
||||
dictionary.Add(keyStatu.Key, keyStatu.Value.ToList<string>());
|
||||
}
|
||||
if (!dictionary.ContainsKey("MouseLeft") || dictionary["MouseLeft"].Count == 0)
|
||||
dictionary["MouseLeft"] = new List<string>()
|
||||
{
|
||||
"Mouse1"
|
||||
};
|
||||
if (!dictionary.ContainsKey("Inventory") || dictionary["Inventory"].Count == 0)
|
||||
dictionary["Inventory"] = new List<string>()
|
||||
{
|
||||
"Escape"
|
||||
};
|
||||
return dictionary;
|
||||
}
|
||||
}
|
||||
}
|
410
GameInput/LockOnHelper.cs
Normal file
410
GameInput/LockOnHelper.cs
Normal file
|
@ -0,0 +1,410 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.GameInput.LockOnHelper
|
||||
// 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.ID;
|
||||
|
||||
namespace Terraria.GameInput
|
||||
{
|
||||
public class LockOnHelper
|
||||
{
|
||||
private const float LOCKON_RANGE = 2000f;
|
||||
private const int LOCKON_HOLD_LIFETIME = 40;
|
||||
public static LockOnHelper.LockOnMode UseMode = LockOnHelper.LockOnMode.ThreeDS;
|
||||
private static bool _enabled;
|
||||
private static bool _canLockOn;
|
||||
private static List<int> _targets = new List<int>();
|
||||
private static int _pickedTarget;
|
||||
private static int _lifeTimeCounter;
|
||||
private static int _lifeTimeArrowDisplay;
|
||||
private static int _threeDSTarget = -1;
|
||||
private static int _targetClosestTarget = -1;
|
||||
public static bool ForceUsability = false;
|
||||
private static float[,] _drawProgress = new float[200, 2];
|
||||
|
||||
public static void CycleUseModes()
|
||||
{
|
||||
switch (LockOnHelper.UseMode)
|
||||
{
|
||||
case LockOnHelper.LockOnMode.FocusTarget:
|
||||
LockOnHelper.UseMode = LockOnHelper.LockOnMode.TargetClosest;
|
||||
break;
|
||||
case LockOnHelper.LockOnMode.TargetClosest:
|
||||
LockOnHelper.UseMode = LockOnHelper.LockOnMode.ThreeDS;
|
||||
break;
|
||||
case LockOnHelper.LockOnMode.ThreeDS:
|
||||
LockOnHelper.UseMode = LockOnHelper.LockOnMode.TargetClosest;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public static NPC AimedTarget => LockOnHelper._pickedTarget == -1 || LockOnHelper._targets.Count < 1 ? (NPC) null : Main.npc[LockOnHelper._targets[LockOnHelper._pickedTarget]];
|
||||
|
||||
public static Vector2 PredictedPosition
|
||||
{
|
||||
get
|
||||
{
|
||||
NPC aimedTarget = LockOnHelper.AimedTarget;
|
||||
if (aimedTarget == null)
|
||||
return Vector2.Zero;
|
||||
Vector2 vec = aimedTarget.Center;
|
||||
int index1;
|
||||
Vector2 pos;
|
||||
if (NPC.GetNPCLocation(LockOnHelper._targets[LockOnHelper._pickedTarget], true, false, out index1, out pos))
|
||||
vec = pos + Main.npc[index1].Distance(Main.player[Main.myPlayer].Center) / 2000f * Main.npc[index1].velocity * 45f;
|
||||
Player player = Main.player[Main.myPlayer];
|
||||
for (int index2 = ItemID.Sets.LockOnAimAbove[player.inventory[player.selectedItem].type]; index2 > 0 && (double) vec.Y > 100.0; --index2)
|
||||
{
|
||||
Point tileCoordinates = vec.ToTileCoordinates();
|
||||
tileCoordinates.Y -= 4;
|
||||
if (WorldGen.InWorld(tileCoordinates.X, tileCoordinates.Y, 10) && !WorldGen.SolidTile(tileCoordinates.X, tileCoordinates.Y))
|
||||
vec.Y -= 16f;
|
||||
else
|
||||
break;
|
||||
}
|
||||
float? nullable = ItemID.Sets.LockOnAimCompensation[player.inventory[player.selectedItem].type];
|
||||
if (nullable.HasValue)
|
||||
{
|
||||
vec.Y -= (float) (aimedTarget.height / 2);
|
||||
Vector2 v = vec - player.Center;
|
||||
Vector2 vector2 = v.SafeNormalize(Vector2.Zero);
|
||||
--vector2.Y;
|
||||
float num = (float) Math.Pow((double) v.Length() / 700.0, 2.0) * 700f;
|
||||
vec.Y += (float) ((double) vector2.Y * (double) num * (double) nullable.Value * 1.0);
|
||||
vec.X += (float) (-(double) vector2.X * (double) num * (double) nullable.Value * 1.0);
|
||||
}
|
||||
return vec;
|
||||
}
|
||||
}
|
||||
|
||||
public static void Update()
|
||||
{
|
||||
LockOnHelper._canLockOn = false;
|
||||
if (!LockOnHelper.CanUseLockonSystem())
|
||||
{
|
||||
LockOnHelper.SetActive(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (--LockOnHelper._lifeTimeArrowDisplay < 0)
|
||||
LockOnHelper._lifeTimeArrowDisplay = 0;
|
||||
LockOnHelper.FindMostViableTarget(LockOnHelper.LockOnMode.ThreeDS, ref LockOnHelper._threeDSTarget);
|
||||
LockOnHelper.FindMostViableTarget(LockOnHelper.LockOnMode.TargetClosest, ref LockOnHelper._targetClosestTarget);
|
||||
if (PlayerInput.Triggers.JustPressed.LockOn && !PlayerInput.WritingText)
|
||||
{
|
||||
LockOnHelper._lifeTimeCounter = 40;
|
||||
LockOnHelper._lifeTimeArrowDisplay = 30;
|
||||
LockOnHelper.HandlePressing();
|
||||
}
|
||||
if (!LockOnHelper._enabled)
|
||||
return;
|
||||
if (LockOnHelper.UseMode == LockOnHelper.LockOnMode.FocusTarget && PlayerInput.Triggers.Current.LockOn)
|
||||
{
|
||||
if (LockOnHelper._lifeTimeCounter <= 0)
|
||||
{
|
||||
LockOnHelper.SetActive(false);
|
||||
return;
|
||||
}
|
||||
--LockOnHelper._lifeTimeCounter;
|
||||
}
|
||||
NPC aimedTarget = LockOnHelper.AimedTarget;
|
||||
if (!LockOnHelper.ValidTarget(aimedTarget))
|
||||
LockOnHelper.SetActive(false);
|
||||
if (LockOnHelper.UseMode == LockOnHelper.LockOnMode.TargetClosest)
|
||||
{
|
||||
LockOnHelper.SetActive(false);
|
||||
LockOnHelper.SetActive(LockOnHelper.CanEnable());
|
||||
}
|
||||
if (!LockOnHelper._enabled)
|
||||
return;
|
||||
Player p = Main.player[Main.myPlayer];
|
||||
Vector2 predictedPosition = LockOnHelper.PredictedPosition;
|
||||
bool flag = false;
|
||||
if (LockOnHelper.ShouldLockOn(p) && (ItemID.Sets.LockOnIgnoresCollision[p.inventory[p.selectedItem].type] || Collision.CanHit(p.Center, 0, 0, predictedPosition, 0, 0) || Collision.CanHitLine(p.Center, 0, 0, predictedPosition, 0, 0) || Collision.CanHit(p.Center, 0, 0, aimedTarget.Center, 0, 0) || Collision.CanHitLine(p.Center, 0, 0, aimedTarget.Center, 0, 0)))
|
||||
flag = true;
|
||||
if (!flag)
|
||||
return;
|
||||
LockOnHelper._canLockOn = true;
|
||||
}
|
||||
}
|
||||
|
||||
public static bool CanUseLockonSystem() => LockOnHelper.ForceUsability || PlayerInput.UsingGamepad;
|
||||
|
||||
public static void SetUP()
|
||||
{
|
||||
if (!LockOnHelper._canLockOn)
|
||||
return;
|
||||
NPC aimedTarget = LockOnHelper.AimedTarget;
|
||||
LockOnHelper.SetLockPosition(Main.ReverseGravitySupport(LockOnHelper.PredictedPosition - Main.screenPosition));
|
||||
}
|
||||
|
||||
public static void SetDOWN()
|
||||
{
|
||||
if (!LockOnHelper._canLockOn)
|
||||
return;
|
||||
LockOnHelper.ResetLockPosition();
|
||||
}
|
||||
|
||||
private static bool ShouldLockOn(Player p) => p.inventory[p.selectedItem].type != 496;
|
||||
|
||||
public static void Toggle(bool forceOff = false)
|
||||
{
|
||||
LockOnHelper._lifeTimeCounter = 40;
|
||||
LockOnHelper._lifeTimeArrowDisplay = 30;
|
||||
LockOnHelper.HandlePressing();
|
||||
if (!forceOff)
|
||||
return;
|
||||
LockOnHelper._enabled = false;
|
||||
}
|
||||
|
||||
public static bool Enabled => LockOnHelper._enabled;
|
||||
|
||||
private static void FindMostViableTarget(LockOnHelper.LockOnMode context, ref int targetVar)
|
||||
{
|
||||
targetVar = -1;
|
||||
if (LockOnHelper.UseMode != context || !LockOnHelper.CanUseLockonSystem())
|
||||
return;
|
||||
List<int> t1_1 = new List<int>();
|
||||
int t1_2 = -1;
|
||||
Utils.Swap<List<int>>(ref t1_1, ref LockOnHelper._targets);
|
||||
Utils.Swap<int>(ref t1_2, ref LockOnHelper._pickedTarget);
|
||||
LockOnHelper.RefreshTargets(Main.MouseWorld, 2000f);
|
||||
LockOnHelper.GetClosestTarget(Main.MouseWorld);
|
||||
Utils.Swap<List<int>>(ref t1_1, ref LockOnHelper._targets);
|
||||
Utils.Swap<int>(ref t1_2, ref LockOnHelper._pickedTarget);
|
||||
if (t1_2 >= 0)
|
||||
targetVar = t1_1[t1_2];
|
||||
t1_1.Clear();
|
||||
}
|
||||
|
||||
private static void HandlePressing()
|
||||
{
|
||||
switch (LockOnHelper.UseMode)
|
||||
{
|
||||
case LockOnHelper.LockOnMode.TargetClosest:
|
||||
LockOnHelper.SetActive(!LockOnHelper._enabled);
|
||||
break;
|
||||
case LockOnHelper.LockOnMode.ThreeDS:
|
||||
if (!LockOnHelper._enabled)
|
||||
{
|
||||
LockOnHelper.SetActive(true);
|
||||
break;
|
||||
}
|
||||
LockOnHelper.CycleTargetThreeDS();
|
||||
break;
|
||||
default:
|
||||
if (!LockOnHelper._enabled)
|
||||
{
|
||||
LockOnHelper.SetActive(true);
|
||||
break;
|
||||
}
|
||||
LockOnHelper.CycleTargetFocus();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private static void CycleTargetFocus()
|
||||
{
|
||||
int target = LockOnHelper._targets[LockOnHelper._pickedTarget];
|
||||
LockOnHelper.RefreshTargets(Main.MouseWorld, 2000f);
|
||||
if (LockOnHelper._targets.Count < 1 || LockOnHelper._targets.Count == 1 && target == LockOnHelper._targets[0])
|
||||
{
|
||||
LockOnHelper.SetActive(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
LockOnHelper._pickedTarget = 0;
|
||||
for (int index = 0; index < LockOnHelper._targets.Count; ++index)
|
||||
{
|
||||
if (LockOnHelper._targets[index] > target)
|
||||
{
|
||||
LockOnHelper._pickedTarget = index;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void CycleTargetThreeDS()
|
||||
{
|
||||
int target = LockOnHelper._targets[LockOnHelper._pickedTarget];
|
||||
LockOnHelper.RefreshTargets(Main.MouseWorld, 2000f);
|
||||
LockOnHelper.GetClosestTarget(Main.MouseWorld);
|
||||
if (LockOnHelper._targets.Count >= 1 && (LockOnHelper._targets.Count != 1 || target != LockOnHelper._targets[0]) && target != LockOnHelper._targets[LockOnHelper._pickedTarget])
|
||||
return;
|
||||
LockOnHelper.SetActive(false);
|
||||
}
|
||||
|
||||
private static bool CanEnable() => !Main.player[Main.myPlayer].dead;
|
||||
|
||||
private static void SetActive(bool on)
|
||||
{
|
||||
if (on)
|
||||
{
|
||||
if (!LockOnHelper.CanEnable())
|
||||
return;
|
||||
LockOnHelper.RefreshTargets(Main.MouseWorld, 2000f);
|
||||
LockOnHelper.GetClosestTarget(Main.MouseWorld);
|
||||
if (LockOnHelper._pickedTarget < 0)
|
||||
return;
|
||||
LockOnHelper._enabled = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
LockOnHelper._enabled = false;
|
||||
LockOnHelper._targets.Clear();
|
||||
LockOnHelper._lifeTimeCounter = 0;
|
||||
LockOnHelper._threeDSTarget = -1;
|
||||
LockOnHelper._targetClosestTarget = -1;
|
||||
}
|
||||
}
|
||||
|
||||
private static void RefreshTargets(Vector2 position, float radius)
|
||||
{
|
||||
LockOnHelper._targets.Clear();
|
||||
Rectangle rectangle = Utils.CenteredRectangle(Main.player[Main.myPlayer].Center, new Vector2(1920f, 1200f));
|
||||
Vector2 center = Main.player[Main.myPlayer].Center;
|
||||
Main.player[Main.myPlayer].DirectionTo(Main.MouseWorld);
|
||||
for (int index = 0; index < Main.npc.Length; ++index)
|
||||
{
|
||||
NPC n = Main.npc[index];
|
||||
if (LockOnHelper.ValidTarget(n) && (double) n.Distance(position) <= (double) radius && rectangle.Intersects(n.Hitbox) && (double) Lighting.GetSubLight(n.Center).Length() / 3.0 >= 0.0299999993294477)
|
||||
LockOnHelper._targets.Add(index);
|
||||
}
|
||||
}
|
||||
|
||||
private static void GetClosestTarget(Vector2 position)
|
||||
{
|
||||
LockOnHelper._pickedTarget = -1;
|
||||
float num1 = -1f;
|
||||
if (LockOnHelper.UseMode == LockOnHelper.LockOnMode.ThreeDS)
|
||||
{
|
||||
Vector2 center = Main.player[Main.myPlayer].Center;
|
||||
Vector2 vector2 = Main.player[Main.myPlayer].DirectionTo(Main.MouseWorld);
|
||||
for (int index = 0; index < LockOnHelper._targets.Count; ++index)
|
||||
{
|
||||
int target = LockOnHelper._targets[index];
|
||||
NPC n = Main.npc[target];
|
||||
float num2 = Vector2.Dot(n.DirectionFrom(center), vector2);
|
||||
if (LockOnHelper.ValidTarget(n) && (LockOnHelper._pickedTarget == -1 || (double) num2 > (double) num1))
|
||||
{
|
||||
LockOnHelper._pickedTarget = index;
|
||||
num1 = num2;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int index = 0; index < LockOnHelper._targets.Count; ++index)
|
||||
{
|
||||
int target = LockOnHelper._targets[index];
|
||||
NPC n = Main.npc[target];
|
||||
if (LockOnHelper.ValidTarget(n) && (LockOnHelper._pickedTarget == -1 || (double) n.Distance(position) < (double) num1))
|
||||
{
|
||||
LockOnHelper._pickedTarget = index;
|
||||
num1 = n.Distance(position);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static bool ValidTarget(NPC n) => n != null && n.active && !n.dontTakeDamage && !n.friendly && !n.isLikeATownNPC && n.life >= 1 && !n.immortal && (n.aiStyle != 25 || (double) n.ai[0] != 0.0);
|
||||
|
||||
private static void SetLockPosition(Vector2 position)
|
||||
{
|
||||
PlayerInput.LockOnCachePosition();
|
||||
Main.mouseX = PlayerInput.MouseX = (int) position.X;
|
||||
Main.mouseY = PlayerInput.MouseY = (int) position.Y;
|
||||
}
|
||||
|
||||
private static void ResetLockPosition()
|
||||
{
|
||||
PlayerInput.LockOnUnCachePosition();
|
||||
Main.mouseX = PlayerInput.MouseX;
|
||||
Main.mouseY = PlayerInput.MouseY;
|
||||
}
|
||||
|
||||
public static void Draw(SpriteBatch spriteBatch)
|
||||
{
|
||||
if (Main.gameMenu)
|
||||
return;
|
||||
Texture2D texture = TextureAssets.LockOnCursor.Value;
|
||||
Rectangle r1 = new Rectangle(0, 0, texture.Width, 12);
|
||||
Rectangle r2 = new Rectangle(0, 16, texture.Width, 12);
|
||||
Color color1 = Main.OurFavoriteColor.MultiplyRGBA(new Color(0.75f, 0.75f, 0.75f, 1f));
|
||||
color1.A = (byte) 220;
|
||||
Color favoriteColor = Main.OurFavoriteColor;
|
||||
favoriteColor.A = (byte) 220;
|
||||
float num1 = (float) (0.939999997615814 + Math.Sin((double) Main.GlobalTimeWrappedHourly * 6.28318548202515) * 0.0599999986588955);
|
||||
favoriteColor *= num1;
|
||||
Color t1 = color1 * num1;
|
||||
Utils.Swap<Color>(ref t1, ref favoriteColor);
|
||||
Color color2 = t1.MultiplyRGBA(new Color(0.8f, 0.8f, 0.8f, 0.8f));
|
||||
Color color3 = t1.MultiplyRGBA(new Color(0.8f, 0.8f, 0.8f, 0.8f));
|
||||
float gravDir = Main.player[Main.myPlayer].gravDir;
|
||||
float num2 = 1f;
|
||||
float num3 = 0.1f;
|
||||
float num4 = 0.8f;
|
||||
float num5 = 1f;
|
||||
float num6 = 10f;
|
||||
float num7 = 10f;
|
||||
bool flag = false;
|
||||
for (int i = 0; i < LockOnHelper._drawProgress.GetLength(0); ++i)
|
||||
{
|
||||
int num8 = 0;
|
||||
if (LockOnHelper._pickedTarget != -1 && LockOnHelper._targets.Count > 0 && i == LockOnHelper._targets[LockOnHelper._pickedTarget])
|
||||
num8 = 2;
|
||||
else if (flag && LockOnHelper._targets.Contains(i) || LockOnHelper.UseMode == LockOnHelper.LockOnMode.ThreeDS && LockOnHelper._threeDSTarget == i || LockOnHelper.UseMode == LockOnHelper.LockOnMode.TargetClosest && LockOnHelper._targetClosestTarget == i)
|
||||
num8 = 1;
|
||||
LockOnHelper._drawProgress[i, 0] = MathHelper.Clamp(LockOnHelper._drawProgress[i, 0] + (num8 == 1 ? num3 : -num3), 0.0f, 1f);
|
||||
LockOnHelper._drawProgress[i, 1] = MathHelper.Clamp(LockOnHelper._drawProgress[i, 1] + (num8 == 2 ? num3 : -num3), 0.0f, 1f);
|
||||
float num9 = LockOnHelper._drawProgress[i, 0];
|
||||
if ((double) num9 > 0.0)
|
||||
{
|
||||
float num10 = (float) (1.0 - (double) num9 * (double) num9);
|
||||
Vector2 position = Main.ReverseGravitySupport(Main.npc[i].Top + new Vector2(0.0f, (float) (-(double) num7 - (double) num10 * (double) num6)) * gravDir - Main.screenPosition, (float) Main.npc[i].height);
|
||||
spriteBatch.Draw(texture, position, new Rectangle?(r1), color2 * num9, 0.0f, r1.Size() / 2f, new Vector2(0.58f, 1f) * num2 * num4 * (1f + num9) / 2f, SpriteEffects.None, 0.0f);
|
||||
spriteBatch.Draw(texture, position, new Rectangle?(r2), color3 * num9 * num9, 0.0f, r2.Size() / 2f, new Vector2(0.58f, 1f) * num2 * num4 * (1f + num9) / 2f, SpriteEffects.None, 0.0f);
|
||||
}
|
||||
float num11 = LockOnHelper._drawProgress[i, 1];
|
||||
if ((double) num11 > 0.0)
|
||||
{
|
||||
int num12 = Main.npc[i].width;
|
||||
if (Main.npc[i].height > num12)
|
||||
num12 = Main.npc[i].height;
|
||||
int num13 = num12 + 20;
|
||||
if ((double) num13 < 70.0)
|
||||
num5 *= (float) num13 / 70f;
|
||||
float num14 = 3f;
|
||||
Vector2 vector2_1 = Main.npc[i].Center;
|
||||
Vector2 pos;
|
||||
if (LockOnHelper._targets.Count >= 0 && LockOnHelper._pickedTarget >= 0 && LockOnHelper._pickedTarget < LockOnHelper._targets.Count && i == LockOnHelper._targets[LockOnHelper._pickedTarget] && NPC.GetNPCLocation(i, true, false, out int _, out pos))
|
||||
vector2_1 = pos;
|
||||
for (int index = 0; (double) index < (double) num14; ++index)
|
||||
{
|
||||
float num15 = (float) (6.28318548202515 / (double) num14 * (double) index + (double) Main.GlobalTimeWrappedHourly * 6.28318548202515 * 0.25);
|
||||
Vector2 vector2_2 = new Vector2(0.0f, (float) (num13 / 2)).RotatedBy((double) num15);
|
||||
Vector2 position = Main.ReverseGravitySupport(vector2_1 + vector2_2 - Main.screenPosition);
|
||||
float rotation = (float) ((double) num15 * ((double) gravDir == 1.0 ? 1.0 : -1.0) + 3.14159274101257 * ((double) gravDir == 1.0 ? 1.0 : 0.0));
|
||||
spriteBatch.Draw(texture, position, new Rectangle?(r1), t1 * num11, rotation, r1.Size() / 2f, new Vector2(0.58f, 1f) * num2 * num5 * (1f + num11) / 2f, SpriteEffects.None, 0.0f);
|
||||
spriteBatch.Draw(texture, position, new Rectangle?(r2), favoriteColor * num11 * num11, rotation, r2.Size() / 2f, new Vector2(0.58f, 1f) * num2 * num5 * (1f + num11) / 2f, SpriteEffects.None, 0.0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public enum LockOnMode
|
||||
{
|
||||
FocusTarget,
|
||||
TargetClosest,
|
||||
ThreeDS,
|
||||
}
|
||||
}
|
||||
}
|
2026
GameInput/PlayerInput.cs
Normal file
2026
GameInput/PlayerInput.cs
Normal file
File diff suppressed because it is too large
Load diff
320
GameInput/PlayerInputProfile.cs
Normal file
320
GameInput/PlayerInputProfile.cs
Normal file
|
@ -0,0 +1,320 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.GameInput.PlayerInputProfile
|
||||
// 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.Input;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Terraria.GameInput
|
||||
{
|
||||
public class PlayerInputProfile
|
||||
{
|
||||
public Dictionary<InputMode, KeyConfiguration> InputModes = new Dictionary<InputMode, KeyConfiguration>()
|
||||
{
|
||||
{
|
||||
InputMode.Keyboard,
|
||||
new KeyConfiguration()
|
||||
},
|
||||
{
|
||||
InputMode.KeyboardUI,
|
||||
new KeyConfiguration()
|
||||
},
|
||||
{
|
||||
InputMode.XBoxGamepad,
|
||||
new KeyConfiguration()
|
||||
},
|
||||
{
|
||||
InputMode.XBoxGamepadUI,
|
||||
new KeyConfiguration()
|
||||
}
|
||||
};
|
||||
public string Name = "";
|
||||
public bool AllowEditting = true;
|
||||
public int HotbarRadialHoldTimeRequired = 16;
|
||||
public float TriggersDeadzone = 0.3f;
|
||||
public float InterfaceDeadzoneX = 0.2f;
|
||||
public float LeftThumbstickDeadzoneX = 0.25f;
|
||||
public float LeftThumbstickDeadzoneY = 0.4f;
|
||||
public float RightThumbstickDeadzoneX;
|
||||
public float RightThumbstickDeadzoneY;
|
||||
public bool LeftThumbstickInvertX;
|
||||
public bool LeftThumbstickInvertY;
|
||||
public bool RightThumbstickInvertX;
|
||||
public bool RightThumbstickInvertY;
|
||||
public int InventoryMoveCD = 6;
|
||||
|
||||
public string ShowName => this.Name;
|
||||
|
||||
public bool HotbarAllowsRadial => this.HotbarRadialHoldTimeRequired != -1;
|
||||
|
||||
public PlayerInputProfile(string name) => this.Name = name;
|
||||
|
||||
public void Initialize(PresetProfiles style)
|
||||
{
|
||||
foreach (KeyValuePair<InputMode, KeyConfiguration> inputMode in this.InputModes)
|
||||
{
|
||||
inputMode.Value.SetupKeys();
|
||||
PlayerInput.Reset(inputMode.Value, style, inputMode.Key);
|
||||
}
|
||||
}
|
||||
|
||||
public bool Load(Dictionary<string, object> dict)
|
||||
{
|
||||
int num = 0;
|
||||
object obj;
|
||||
if (dict.TryGetValue("Last Launched Version", out obj))
|
||||
num = (int) (long) obj;
|
||||
if (dict.TryGetValue("Mouse And Keyboard", out obj))
|
||||
this.InputModes[InputMode.Keyboard].ReadPreferences(JsonConvert.DeserializeObject<Dictionary<string, List<string>>>(((object) (JObject) obj).ToString()));
|
||||
if (dict.TryGetValue("Gamepad", out obj))
|
||||
this.InputModes[InputMode.XBoxGamepad].ReadPreferences(JsonConvert.DeserializeObject<Dictionary<string, List<string>>>(((object) (JObject) obj).ToString()));
|
||||
if (dict.TryGetValue("Mouse And Keyboard UI", out obj))
|
||||
this.InputModes[InputMode.KeyboardUI].ReadPreferences(JsonConvert.DeserializeObject<Dictionary<string, List<string>>>(((object) (JObject) obj).ToString()));
|
||||
if (dict.TryGetValue("Gamepad UI", out obj))
|
||||
this.InputModes[InputMode.XBoxGamepadUI].ReadPreferences(JsonConvert.DeserializeObject<Dictionary<string, List<string>>>(((object) (JObject) obj).ToString()));
|
||||
if (num < 190)
|
||||
{
|
||||
this.InputModes[InputMode.Keyboard].KeyStatus["ViewZoomIn"] = new List<string>();
|
||||
this.InputModes[InputMode.Keyboard].KeyStatus["ViewZoomIn"].AddRange((IEnumerable<string>) PlayerInput.OriginalProfiles["Redigit's Pick"].InputModes[InputMode.Keyboard].KeyStatus["ViewZoomIn"]);
|
||||
this.InputModes[InputMode.Keyboard].KeyStatus["ViewZoomOut"] = new List<string>();
|
||||
this.InputModes[InputMode.Keyboard].KeyStatus["ViewZoomOut"].AddRange((IEnumerable<string>) PlayerInput.OriginalProfiles["Redigit's Pick"].InputModes[InputMode.Keyboard].KeyStatus["ViewZoomOut"]);
|
||||
}
|
||||
if (num < 218)
|
||||
{
|
||||
this.InputModes[InputMode.Keyboard].KeyStatus["ToggleCreativeMenu"] = new List<string>();
|
||||
this.InputModes[InputMode.Keyboard].KeyStatus["ToggleCreativeMenu"].AddRange((IEnumerable<string>) PlayerInput.OriginalProfiles["Redigit's Pick"].InputModes[InputMode.Keyboard].KeyStatus["ToggleCreativeMenu"]);
|
||||
}
|
||||
if (num < 227)
|
||||
{
|
||||
List<string> keyStatu = this.InputModes[InputMode.KeyboardUI].KeyStatus["MouseLeft"];
|
||||
string str = "Mouse1";
|
||||
if (!keyStatu.Contains(str))
|
||||
keyStatu.Add(str);
|
||||
}
|
||||
if (dict.TryGetValue("Settings", out obj))
|
||||
{
|
||||
Dictionary<string, object> dictionary = JsonConvert.DeserializeObject<Dictionary<string, object>>(((object) (JObject) obj).ToString());
|
||||
if (dictionary.TryGetValue("Edittable", out obj))
|
||||
this.AllowEditting = (bool) obj;
|
||||
if (dictionary.TryGetValue("Gamepad - HotbarRadialHoldTime", out obj))
|
||||
this.HotbarRadialHoldTimeRequired = (int) (long) obj;
|
||||
if (dictionary.TryGetValue("Gamepad - LeftThumbstickDeadzoneX", out obj))
|
||||
this.LeftThumbstickDeadzoneX = (float) (double) obj;
|
||||
if (dictionary.TryGetValue("Gamepad - LeftThumbstickDeadzoneY", out obj))
|
||||
this.LeftThumbstickDeadzoneY = (float) (double) obj;
|
||||
if (dictionary.TryGetValue("Gamepad - RightThumbstickDeadzoneX", out obj))
|
||||
this.RightThumbstickDeadzoneX = (float) (double) obj;
|
||||
if (dictionary.TryGetValue("Gamepad - RightThumbstickDeadzoneY", out obj))
|
||||
this.RightThumbstickDeadzoneY = (float) (double) obj;
|
||||
if (dictionary.TryGetValue("Gamepad - LeftThumbstickInvertX", out obj))
|
||||
this.LeftThumbstickInvertX = (bool) obj;
|
||||
if (dictionary.TryGetValue("Gamepad - LeftThumbstickInvertY", out obj))
|
||||
this.LeftThumbstickInvertY = (bool) obj;
|
||||
if (dictionary.TryGetValue("Gamepad - RightThumbstickInvertX", out obj))
|
||||
this.RightThumbstickInvertX = (bool) obj;
|
||||
if (dictionary.TryGetValue("Gamepad - RightThumbstickInvertY", out obj))
|
||||
this.RightThumbstickInvertY = (bool) obj;
|
||||
if (dictionary.TryGetValue("Gamepad - TriggersDeadzone", out obj))
|
||||
this.TriggersDeadzone = (float) (double) obj;
|
||||
if (dictionary.TryGetValue("Gamepad - InterfaceDeadzoneX", out obj))
|
||||
this.InterfaceDeadzoneX = (float) (double) obj;
|
||||
if (dictionary.TryGetValue("Gamepad - InventoryMoveCD", out obj))
|
||||
this.InventoryMoveCD = (int) (long) obj;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public Dictionary<string, object> Save()
|
||||
{
|
||||
Dictionary<string, object> dictionary1 = new Dictionary<string, object>();
|
||||
Dictionary<string, object> dictionary2 = new Dictionary<string, object>();
|
||||
dictionary1.Add("Last Launched Version", (object) 230);
|
||||
dictionary2.Add("Edittable", (object) this.AllowEditting);
|
||||
dictionary2.Add("Gamepad - HotbarRadialHoldTime", (object) this.HotbarRadialHoldTimeRequired);
|
||||
dictionary2.Add("Gamepad - LeftThumbstickDeadzoneX", (object) this.LeftThumbstickDeadzoneX);
|
||||
dictionary2.Add("Gamepad - LeftThumbstickDeadzoneY", (object) this.LeftThumbstickDeadzoneY);
|
||||
dictionary2.Add("Gamepad - RightThumbstickDeadzoneX", (object) this.RightThumbstickDeadzoneX);
|
||||
dictionary2.Add("Gamepad - RightThumbstickDeadzoneY", (object) this.RightThumbstickDeadzoneY);
|
||||
dictionary2.Add("Gamepad - LeftThumbstickInvertX", (object) this.LeftThumbstickInvertX);
|
||||
dictionary2.Add("Gamepad - LeftThumbstickInvertY", (object) this.LeftThumbstickInvertY);
|
||||
dictionary2.Add("Gamepad - RightThumbstickInvertX", (object) this.RightThumbstickInvertX);
|
||||
dictionary2.Add("Gamepad - RightThumbstickInvertY", (object) this.RightThumbstickInvertY);
|
||||
dictionary2.Add("Gamepad - TriggersDeadzone", (object) this.TriggersDeadzone);
|
||||
dictionary2.Add("Gamepad - InterfaceDeadzoneX", (object) this.InterfaceDeadzoneX);
|
||||
dictionary2.Add("Gamepad - InventoryMoveCD", (object) this.InventoryMoveCD);
|
||||
dictionary1.Add("Settings", (object) dictionary2);
|
||||
dictionary1.Add("Mouse And Keyboard", (object) this.InputModes[InputMode.Keyboard].WritePreferences());
|
||||
dictionary1.Add("Gamepad", (object) this.InputModes[InputMode.XBoxGamepad].WritePreferences());
|
||||
dictionary1.Add("Mouse And Keyboard UI", (object) this.InputModes[InputMode.KeyboardUI].WritePreferences());
|
||||
dictionary1.Add("Gamepad UI", (object) this.InputModes[InputMode.XBoxGamepadUI].WritePreferences());
|
||||
return dictionary1;
|
||||
}
|
||||
|
||||
public void ConditionalAddProfile(
|
||||
Dictionary<string, object> dicttouse,
|
||||
string k,
|
||||
InputMode nm,
|
||||
Dictionary<string, List<string>> dict)
|
||||
{
|
||||
if (PlayerInput.OriginalProfiles.ContainsKey(this.Name))
|
||||
{
|
||||
foreach (KeyValuePair<string, List<string>> writePreference in PlayerInput.OriginalProfiles[this.Name].InputModes[nm].WritePreferences())
|
||||
{
|
||||
bool flag = true;
|
||||
List<string> stringList;
|
||||
if (dict.TryGetValue(writePreference.Key, out stringList))
|
||||
{
|
||||
if (stringList.Count != writePreference.Value.Count)
|
||||
flag = false;
|
||||
if (!flag)
|
||||
{
|
||||
for (int index = 0; index < stringList.Count; ++index)
|
||||
{
|
||||
if (stringList[index] != writePreference.Value[index])
|
||||
{
|
||||
flag = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
flag = false;
|
||||
if (flag)
|
||||
dict.Remove(writePreference.Key);
|
||||
}
|
||||
}
|
||||
if (dict.Count <= 0)
|
||||
return;
|
||||
dicttouse.Add(k, (object) dict);
|
||||
}
|
||||
|
||||
public void ConditionalAdd(
|
||||
Dictionary<string, object> dicttouse,
|
||||
string a,
|
||||
object b,
|
||||
Func<PlayerInputProfile, bool> check)
|
||||
{
|
||||
if (PlayerInput.OriginalProfiles.ContainsKey(this.Name) && check(PlayerInput.OriginalProfiles[this.Name]))
|
||||
return;
|
||||
dicttouse.Add(a, b);
|
||||
}
|
||||
|
||||
public void CopyGameplaySettingsFrom(PlayerInputProfile profile, InputMode mode)
|
||||
{
|
||||
string[] keysToCopy = new string[19]
|
||||
{
|
||||
"MouseLeft",
|
||||
"MouseRight",
|
||||
"Up",
|
||||
"Down",
|
||||
"Left",
|
||||
"Right",
|
||||
"Jump",
|
||||
"Grapple",
|
||||
"SmartSelect",
|
||||
"SmartCursor",
|
||||
"QuickMount",
|
||||
"QuickHeal",
|
||||
"QuickMana",
|
||||
"QuickBuff",
|
||||
"Throw",
|
||||
"Inventory",
|
||||
"ViewZoomIn",
|
||||
"ViewZoomOut",
|
||||
"ToggleCreativeMenu"
|
||||
};
|
||||
this.CopyKeysFrom(profile, mode, keysToCopy);
|
||||
}
|
||||
|
||||
public void CopyHotbarSettingsFrom(PlayerInputProfile profile, InputMode mode)
|
||||
{
|
||||
string[] keysToCopy = new string[12]
|
||||
{
|
||||
"HotbarMinus",
|
||||
"HotbarPlus",
|
||||
"Hotbar1",
|
||||
"Hotbar2",
|
||||
"Hotbar3",
|
||||
"Hotbar4",
|
||||
"Hotbar5",
|
||||
"Hotbar6",
|
||||
"Hotbar7",
|
||||
"Hotbar8",
|
||||
"Hotbar9",
|
||||
"Hotbar10"
|
||||
};
|
||||
this.CopyKeysFrom(profile, mode, keysToCopy);
|
||||
}
|
||||
|
||||
public void CopyMapSettingsFrom(PlayerInputProfile profile, InputMode mode)
|
||||
{
|
||||
string[] keysToCopy = new string[6]
|
||||
{
|
||||
"MapZoomIn",
|
||||
"MapZoomOut",
|
||||
"MapAlphaUp",
|
||||
"MapAlphaDown",
|
||||
"MapFull",
|
||||
"MapStyle"
|
||||
};
|
||||
this.CopyKeysFrom(profile, mode, keysToCopy);
|
||||
}
|
||||
|
||||
public void CopyGamepadSettingsFrom(PlayerInputProfile profile, InputMode mode)
|
||||
{
|
||||
string[] keysToCopy = new string[10]
|
||||
{
|
||||
"RadialHotbar",
|
||||
"RadialQuickbar",
|
||||
"DpadSnap1",
|
||||
"DpadSnap2",
|
||||
"DpadSnap3",
|
||||
"DpadSnap4",
|
||||
"DpadRadial1",
|
||||
"DpadRadial2",
|
||||
"DpadRadial3",
|
||||
"DpadRadial4"
|
||||
};
|
||||
this.CopyKeysFrom(profile, InputMode.XBoxGamepad, keysToCopy);
|
||||
this.CopyKeysFrom(profile, InputMode.XBoxGamepadUI, keysToCopy);
|
||||
}
|
||||
|
||||
public void CopyGamepadAdvancedSettingsFrom(PlayerInputProfile profile, InputMode mode)
|
||||
{
|
||||
this.TriggersDeadzone = profile.TriggersDeadzone;
|
||||
this.InterfaceDeadzoneX = profile.InterfaceDeadzoneX;
|
||||
this.LeftThumbstickDeadzoneX = profile.LeftThumbstickDeadzoneX;
|
||||
this.LeftThumbstickDeadzoneY = profile.LeftThumbstickDeadzoneY;
|
||||
this.RightThumbstickDeadzoneX = profile.RightThumbstickDeadzoneX;
|
||||
this.RightThumbstickDeadzoneY = profile.RightThumbstickDeadzoneY;
|
||||
this.LeftThumbstickInvertX = profile.LeftThumbstickInvertX;
|
||||
this.LeftThumbstickInvertY = profile.LeftThumbstickInvertY;
|
||||
this.RightThumbstickInvertX = profile.RightThumbstickInvertX;
|
||||
this.RightThumbstickInvertY = profile.RightThumbstickInvertY;
|
||||
this.InventoryMoveCD = profile.InventoryMoveCD;
|
||||
}
|
||||
|
||||
private void CopyKeysFrom(PlayerInputProfile profile, InputMode mode, string[] keysToCopy)
|
||||
{
|
||||
for (int index = 0; index < keysToCopy.Length; ++index)
|
||||
{
|
||||
List<string> stringList;
|
||||
if (profile.InputModes[mode].KeyStatus.TryGetValue(keysToCopy[index], out stringList))
|
||||
{
|
||||
this.InputModes[mode].KeyStatus[keysToCopy[index]].Clear();
|
||||
this.InputModes[mode].KeyStatus[keysToCopy[index]].AddRange((IEnumerable<string>) stringList);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool UsingDpadHotbar() => this.InputModes[InputMode.XBoxGamepad].KeyStatus["DpadRadial1"].Contains(Buttons.DPadUp.ToString()) && this.InputModes[InputMode.XBoxGamepad].KeyStatus["DpadRadial2"].Contains(Buttons.DPadRight.ToString()) && this.InputModes[InputMode.XBoxGamepad].KeyStatus["DpadRadial3"].Contains(Buttons.DPadDown.ToString()) && this.InputModes[InputMode.XBoxGamepad].KeyStatus["DpadRadial4"].Contains(Buttons.DPadLeft.ToString()) && this.InputModes[InputMode.XBoxGamepadUI].KeyStatus["DpadRadial1"].Contains(Buttons.DPadUp.ToString()) && this.InputModes[InputMode.XBoxGamepadUI].KeyStatus["DpadRadial2"].Contains(Buttons.DPadRight.ToString()) && this.InputModes[InputMode.XBoxGamepadUI].KeyStatus["DpadRadial3"].Contains(Buttons.DPadDown.ToString()) && this.InputModes[InputMode.XBoxGamepadUI].KeyStatus["DpadRadial4"].Contains(Buttons.DPadLeft.ToString());
|
||||
|
||||
public bool UsingDpadMovekeys() => this.InputModes[InputMode.XBoxGamepad].KeyStatus["DpadSnap1"].Contains(Buttons.DPadUp.ToString()) && this.InputModes[InputMode.XBoxGamepad].KeyStatus["DpadSnap2"].Contains(Buttons.DPadRight.ToString()) && this.InputModes[InputMode.XBoxGamepad].KeyStatus["DpadSnap3"].Contains(Buttons.DPadDown.ToString()) && this.InputModes[InputMode.XBoxGamepad].KeyStatus["DpadSnap4"].Contains(Buttons.DPadLeft.ToString()) && this.InputModes[InputMode.XBoxGamepadUI].KeyStatus["DpadSnap1"].Contains(Buttons.DPadUp.ToString()) && this.InputModes[InputMode.XBoxGamepadUI].KeyStatus["DpadSnap2"].Contains(Buttons.DPadRight.ToString()) && this.InputModes[InputMode.XBoxGamepadUI].KeyStatus["DpadSnap3"].Contains(Buttons.DPadDown.ToString()) && this.InputModes[InputMode.XBoxGamepadUI].KeyStatus["DpadSnap4"].Contains(Buttons.DPadLeft.ToString());
|
||||
}
|
||||
}
|
17
GameInput/PresetProfiles.cs
Normal file
17
GameInput/PresetProfiles.cs
Normal file
|
@ -0,0 +1,17 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.GameInput.PresetProfiles
|
||||
// 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.GameInput
|
||||
{
|
||||
public enum PresetProfiles
|
||||
{
|
||||
None,
|
||||
Redigit,
|
||||
Yoraiz0r,
|
||||
ConsolePS,
|
||||
ConsoleXBox,
|
||||
}
|
||||
}
|
51
GameInput/SmartSelectGamepadPointer.cs
Normal file
51
GameInput/SmartSelectGamepadPointer.cs
Normal file
|
@ -0,0 +1,51 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.GameInput.SmartSelectGamepadPointer
|
||||
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
|
||||
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
|
||||
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
|
||||
|
||||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
|
||||
namespace Terraria.GameInput
|
||||
{
|
||||
public class SmartSelectGamepadPointer
|
||||
{
|
||||
private Vector2 _size;
|
||||
private Vector2 _center;
|
||||
private Vector2 _distUniform = new Vector2(80f, 64f);
|
||||
|
||||
public bool ShouldBeUsed() => PlayerInput.UsingGamepad && Main.LocalPlayer.controlTorch && Main.SmartCursorEnabled;
|
||||
|
||||
public void SmartSelectLookup_GetTargetTile(Player player, out int tX, out int tY)
|
||||
{
|
||||
tX = (int) (((double) Main.mouseX + (double) Main.screenPosition.X) / 16.0);
|
||||
tY = (int) (((double) Main.mouseY + (double) Main.screenPosition.Y) / 16.0);
|
||||
if ((double) player.gravDir == -1.0)
|
||||
tY = (int) (((double) Main.screenPosition.Y + (double) Main.screenHeight - (double) Main.mouseY) / 16.0);
|
||||
if (!this.ShouldBeUsed())
|
||||
return;
|
||||
Point point = this.GetPointerPosition().ToPoint();
|
||||
tX = (int) (((double) point.X + (double) Main.screenPosition.X) / 16.0);
|
||||
tY = (int) (((double) point.Y + (double) Main.screenPosition.Y) / 16.0);
|
||||
if ((double) player.gravDir != -1.0)
|
||||
return;
|
||||
tY = (int) (((double) Main.screenPosition.Y + (double) Main.screenHeight - (double) point.Y) / 16.0);
|
||||
}
|
||||
|
||||
public void UpdateSize(Vector2 size) => this._size = size;
|
||||
|
||||
public void UpdateCenter(Vector2 center) => this._center = center;
|
||||
|
||||
public Vector2 GetPointerPosition()
|
||||
{
|
||||
Vector2 vector2 = (new Vector2((float) Main.mouseX, (float) Main.mouseY) - this._center) / this._size;
|
||||
float num = Math.Abs(vector2.X);
|
||||
if ((double) num < (double) Math.Abs(vector2.Y))
|
||||
num = Math.Abs(vector2.Y);
|
||||
if ((double) num > 1.0)
|
||||
vector2 /= num;
|
||||
return vector2 * Main.GameViewMatrix.Zoom.X * this._distUniform + this._center;
|
||||
}
|
||||
}
|
||||
}
|
64
GameInput/TriggerNames.cs
Normal file
64
GameInput/TriggerNames.cs
Normal file
|
@ -0,0 +1,64 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.GameInput.TriggerNames
|
||||
// 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.GameInput
|
||||
{
|
||||
public class TriggerNames
|
||||
{
|
||||
public const string MouseLeft = "MouseLeft";
|
||||
public const string MouseRight = "MouseRight";
|
||||
public const string Up = "Up";
|
||||
public const string Down = "Down";
|
||||
public const string Left = "Left";
|
||||
public const string Right = "Right";
|
||||
public const string Jump = "Jump";
|
||||
public const string Throw = "Throw";
|
||||
public const string Inventory = "Inventory";
|
||||
public const string Grapple = "Grapple";
|
||||
public const string SmartSelect = "SmartSelect";
|
||||
public const string SmartCursor = "SmartCursor";
|
||||
public const string QuickMount = "QuickMount";
|
||||
public const string QuickHeal = "QuickHeal";
|
||||
public const string QuickMana = "QuickMana";
|
||||
public const string QuickBuff = "QuickBuff";
|
||||
public const string MapZoomIn = "MapZoomIn";
|
||||
public const string MapZoomOut = "MapZoomOut";
|
||||
public const string MapAlphaUp = "MapAlphaUp";
|
||||
public const string MapAlphaDown = "MapAlphaDown";
|
||||
public const string MapFull = "MapFull";
|
||||
public const string MapStyle = "MapStyle";
|
||||
public const string Hotbar1 = "Hotbar1";
|
||||
public const string Hotbar2 = "Hotbar2";
|
||||
public const string Hotbar3 = "Hotbar3";
|
||||
public const string Hotbar4 = "Hotbar4";
|
||||
public const string Hotbar5 = "Hotbar5";
|
||||
public const string Hotbar6 = "Hotbar6";
|
||||
public const string Hotbar7 = "Hotbar7";
|
||||
public const string Hotbar8 = "Hotbar8";
|
||||
public const string Hotbar9 = "Hotbar9";
|
||||
public const string Hotbar10 = "Hotbar10";
|
||||
public const string HotbarMinus = "HotbarMinus";
|
||||
public const string HotbarPlus = "HotbarPlus";
|
||||
public const string DpadRadial1 = "DpadRadial1";
|
||||
public const string DpadRadial2 = "DpadRadial2";
|
||||
public const string DpadRadial3 = "DpadRadial3";
|
||||
public const string DpadRadial4 = "DpadRadial4";
|
||||
public const string DpadMouseSnap1 = "DpadSnap1";
|
||||
public const string DpadMouseSnap2 = "DpadSnap2";
|
||||
public const string DpadMouseSnap3 = "DpadSnap3";
|
||||
public const string DpadMouseSnap4 = "DpadSnap4";
|
||||
public const string MenuUp = "MenuUp";
|
||||
public const string MenuDown = "MenuDown";
|
||||
public const string MenuLeft = "MenuLeft";
|
||||
public const string MenuRight = "MenuRight";
|
||||
public const string RadialHotbar = "RadialHotbar";
|
||||
public const string RadialQuickbar = "RadialQuickbar";
|
||||
public const string LockOn = "LockOn";
|
||||
public const string ViewZoomIn = "ViewZoomIn";
|
||||
public const string ViewZoomOut = "ViewZoomOut";
|
||||
public const string ToggleCreativeMenu = "ToggleCreativeMenu";
|
||||
}
|
||||
}
|
45
GameInput/TriggersPack.cs
Normal file
45
GameInput/TriggersPack.cs
Normal file
|
@ -0,0 +1,45 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.GameInput.TriggersPack
|
||||
// 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.Linq;
|
||||
|
||||
namespace Terraria.GameInput
|
||||
{
|
||||
public class TriggersPack
|
||||
{
|
||||
public TriggersSet Current = new TriggersSet();
|
||||
public TriggersSet Old = new TriggersSet();
|
||||
public TriggersSet JustPressed = new TriggersSet();
|
||||
public TriggersSet JustReleased = new TriggersSet();
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
this.Current.SetupKeys();
|
||||
this.Old.SetupKeys();
|
||||
this.JustPressed.SetupKeys();
|
||||
this.JustReleased.SetupKeys();
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
this.Old = this.Current.Clone();
|
||||
this.Current.Reset();
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
this.CompareDiffs(this.JustPressed, this.Old, this.Current);
|
||||
this.CompareDiffs(this.JustReleased, this.Current, this.Old);
|
||||
}
|
||||
|
||||
public void CompareDiffs(TriggersSet Bearer, TriggersSet oldset, TriggersSet newset)
|
||||
{
|
||||
Bearer.Reset();
|
||||
foreach (string key in Bearer.KeyStatus.Keys.ToList<string>())
|
||||
Bearer.KeyStatus[key] = newset.KeyStatus[key] && !oldset.KeyStatus[key];
|
||||
}
|
||||
}
|
||||
}
|
443
GameInput/TriggersSet.cs
Normal file
443
GameInput/TriggersSet.cs
Normal file
|
@ -0,0 +1,443 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.GameInput.TriggersSet
|
||||
// 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 System.Linq;
|
||||
|
||||
namespace Terraria.GameInput
|
||||
{
|
||||
public class TriggersSet
|
||||
{
|
||||
public Dictionary<string, bool> KeyStatus = new Dictionary<string, bool>();
|
||||
public bool UsedMovementKey = true;
|
||||
public int HotbarScrollCD;
|
||||
public int HotbarHoldTime;
|
||||
|
||||
public bool MouseLeft
|
||||
{
|
||||
get => this.KeyStatus[nameof (MouseLeft)];
|
||||
set => this.KeyStatus[nameof (MouseLeft)] = value;
|
||||
}
|
||||
|
||||
public bool MouseRight
|
||||
{
|
||||
get => this.KeyStatus[nameof (MouseRight)];
|
||||
set => this.KeyStatus[nameof (MouseRight)] = value;
|
||||
}
|
||||
|
||||
public bool Up
|
||||
{
|
||||
get => this.KeyStatus[nameof (Up)];
|
||||
set => this.KeyStatus[nameof (Up)] = value;
|
||||
}
|
||||
|
||||
public bool Down
|
||||
{
|
||||
get => this.KeyStatus[nameof (Down)];
|
||||
set => this.KeyStatus[nameof (Down)] = value;
|
||||
}
|
||||
|
||||
public bool Left
|
||||
{
|
||||
get => this.KeyStatus[nameof (Left)];
|
||||
set => this.KeyStatus[nameof (Left)] = value;
|
||||
}
|
||||
|
||||
public bool Right
|
||||
{
|
||||
get => this.KeyStatus[nameof (Right)];
|
||||
set => this.KeyStatus[nameof (Right)] = value;
|
||||
}
|
||||
|
||||
public bool Jump
|
||||
{
|
||||
get => this.KeyStatus[nameof (Jump)];
|
||||
set => this.KeyStatus[nameof (Jump)] = value;
|
||||
}
|
||||
|
||||
public bool Throw
|
||||
{
|
||||
get => this.KeyStatus[nameof (Throw)];
|
||||
set => this.KeyStatus[nameof (Throw)] = value;
|
||||
}
|
||||
|
||||
public bool Inventory
|
||||
{
|
||||
get => this.KeyStatus[nameof (Inventory)];
|
||||
set => this.KeyStatus[nameof (Inventory)] = value;
|
||||
}
|
||||
|
||||
public bool Grapple
|
||||
{
|
||||
get => this.KeyStatus[nameof (Grapple)];
|
||||
set => this.KeyStatus[nameof (Grapple)] = value;
|
||||
}
|
||||
|
||||
public bool SmartSelect
|
||||
{
|
||||
get => this.KeyStatus[nameof (SmartSelect)];
|
||||
set => this.KeyStatus[nameof (SmartSelect)] = value;
|
||||
}
|
||||
|
||||
public bool SmartCursor
|
||||
{
|
||||
get => this.KeyStatus[nameof (SmartCursor)];
|
||||
set => this.KeyStatus[nameof (SmartCursor)] = value;
|
||||
}
|
||||
|
||||
public bool QuickMount
|
||||
{
|
||||
get => this.KeyStatus[nameof (QuickMount)];
|
||||
set => this.KeyStatus[nameof (QuickMount)] = value;
|
||||
}
|
||||
|
||||
public bool QuickHeal
|
||||
{
|
||||
get => this.KeyStatus[nameof (QuickHeal)];
|
||||
set => this.KeyStatus[nameof (QuickHeal)] = value;
|
||||
}
|
||||
|
||||
public bool QuickMana
|
||||
{
|
||||
get => this.KeyStatus[nameof (QuickMana)];
|
||||
set => this.KeyStatus[nameof (QuickMana)] = value;
|
||||
}
|
||||
|
||||
public bool QuickBuff
|
||||
{
|
||||
get => this.KeyStatus[nameof (QuickBuff)];
|
||||
set => this.KeyStatus[nameof (QuickBuff)] = value;
|
||||
}
|
||||
|
||||
public bool MapZoomIn
|
||||
{
|
||||
get => this.KeyStatus[nameof (MapZoomIn)];
|
||||
set => this.KeyStatus[nameof (MapZoomIn)] = value;
|
||||
}
|
||||
|
||||
public bool MapZoomOut
|
||||
{
|
||||
get => this.KeyStatus[nameof (MapZoomOut)];
|
||||
set => this.KeyStatus[nameof (MapZoomOut)] = value;
|
||||
}
|
||||
|
||||
public bool MapAlphaUp
|
||||
{
|
||||
get => this.KeyStatus[nameof (MapAlphaUp)];
|
||||
set => this.KeyStatus[nameof (MapAlphaUp)] = value;
|
||||
}
|
||||
|
||||
public bool MapAlphaDown
|
||||
{
|
||||
get => this.KeyStatus[nameof (MapAlphaDown)];
|
||||
set => this.KeyStatus[nameof (MapAlphaDown)] = value;
|
||||
}
|
||||
|
||||
public bool MapFull
|
||||
{
|
||||
get => this.KeyStatus[nameof (MapFull)];
|
||||
set => this.KeyStatus[nameof (MapFull)] = value;
|
||||
}
|
||||
|
||||
public bool MapStyle
|
||||
{
|
||||
get => this.KeyStatus[nameof (MapStyle)];
|
||||
set => this.KeyStatus[nameof (MapStyle)] = value;
|
||||
}
|
||||
|
||||
public bool Hotbar1
|
||||
{
|
||||
get => this.KeyStatus[nameof (Hotbar1)];
|
||||
set => this.KeyStatus[nameof (Hotbar1)] = value;
|
||||
}
|
||||
|
||||
public bool Hotbar2
|
||||
{
|
||||
get => this.KeyStatus[nameof (Hotbar2)];
|
||||
set => this.KeyStatus[nameof (Hotbar2)] = value;
|
||||
}
|
||||
|
||||
public bool Hotbar3
|
||||
{
|
||||
get => this.KeyStatus[nameof (Hotbar3)];
|
||||
set => this.KeyStatus[nameof (Hotbar3)] = value;
|
||||
}
|
||||
|
||||
public bool Hotbar4
|
||||
{
|
||||
get => this.KeyStatus[nameof (Hotbar4)];
|
||||
set => this.KeyStatus[nameof (Hotbar4)] = value;
|
||||
}
|
||||
|
||||
public bool Hotbar5
|
||||
{
|
||||
get => this.KeyStatus[nameof (Hotbar5)];
|
||||
set => this.KeyStatus[nameof (Hotbar5)] = value;
|
||||
}
|
||||
|
||||
public bool Hotbar6
|
||||
{
|
||||
get => this.KeyStatus[nameof (Hotbar6)];
|
||||
set => this.KeyStatus[nameof (Hotbar6)] = value;
|
||||
}
|
||||
|
||||
public bool Hotbar7
|
||||
{
|
||||
get => this.KeyStatus[nameof (Hotbar7)];
|
||||
set => this.KeyStatus[nameof (Hotbar7)] = value;
|
||||
}
|
||||
|
||||
public bool Hotbar8
|
||||
{
|
||||
get => this.KeyStatus[nameof (Hotbar8)];
|
||||
set => this.KeyStatus[nameof (Hotbar8)] = value;
|
||||
}
|
||||
|
||||
public bool Hotbar9
|
||||
{
|
||||
get => this.KeyStatus[nameof (Hotbar9)];
|
||||
set => this.KeyStatus[nameof (Hotbar9)] = value;
|
||||
}
|
||||
|
||||
public bool Hotbar10
|
||||
{
|
||||
get => this.KeyStatus[nameof (Hotbar10)];
|
||||
set => this.KeyStatus[nameof (Hotbar10)] = value;
|
||||
}
|
||||
|
||||
public bool HotbarMinus
|
||||
{
|
||||
get => this.KeyStatus[nameof (HotbarMinus)];
|
||||
set => this.KeyStatus[nameof (HotbarMinus)] = value;
|
||||
}
|
||||
|
||||
public bool HotbarPlus
|
||||
{
|
||||
get => this.KeyStatus[nameof (HotbarPlus)];
|
||||
set => this.KeyStatus[nameof (HotbarPlus)] = value;
|
||||
}
|
||||
|
||||
public bool DpadRadial1
|
||||
{
|
||||
get => this.KeyStatus[nameof (DpadRadial1)];
|
||||
set => this.KeyStatus[nameof (DpadRadial1)] = value;
|
||||
}
|
||||
|
||||
public bool DpadRadial2
|
||||
{
|
||||
get => this.KeyStatus[nameof (DpadRadial2)];
|
||||
set => this.KeyStatus[nameof (DpadRadial2)] = value;
|
||||
}
|
||||
|
||||
public bool DpadRadial3
|
||||
{
|
||||
get => this.KeyStatus[nameof (DpadRadial3)];
|
||||
set => this.KeyStatus[nameof (DpadRadial3)] = value;
|
||||
}
|
||||
|
||||
public bool DpadRadial4
|
||||
{
|
||||
get => this.KeyStatus[nameof (DpadRadial4)];
|
||||
set => this.KeyStatus[nameof (DpadRadial4)] = value;
|
||||
}
|
||||
|
||||
public bool RadialHotbar
|
||||
{
|
||||
get => this.KeyStatus[nameof (RadialHotbar)];
|
||||
set => this.KeyStatus[nameof (RadialHotbar)] = value;
|
||||
}
|
||||
|
||||
public bool RadialQuickbar
|
||||
{
|
||||
get => this.KeyStatus[nameof (RadialQuickbar)];
|
||||
set => this.KeyStatus[nameof (RadialQuickbar)] = value;
|
||||
}
|
||||
|
||||
public bool DpadMouseSnap1
|
||||
{
|
||||
get => this.KeyStatus["DpadSnap1"];
|
||||
set => this.KeyStatus["DpadSnap1"] = value;
|
||||
}
|
||||
|
||||
public bool DpadMouseSnap2
|
||||
{
|
||||
get => this.KeyStatus["DpadSnap2"];
|
||||
set => this.KeyStatus["DpadSnap2"] = value;
|
||||
}
|
||||
|
||||
public bool DpadMouseSnap3
|
||||
{
|
||||
get => this.KeyStatus["DpadSnap3"];
|
||||
set => this.KeyStatus["DpadSnap3"] = value;
|
||||
}
|
||||
|
||||
public bool DpadMouseSnap4
|
||||
{
|
||||
get => this.KeyStatus["DpadSnap4"];
|
||||
set => this.KeyStatus["DpadSnap4"] = value;
|
||||
}
|
||||
|
||||
public bool MenuUp
|
||||
{
|
||||
get => this.KeyStatus[nameof (MenuUp)];
|
||||
set => this.KeyStatus[nameof (MenuUp)] = value;
|
||||
}
|
||||
|
||||
public bool MenuDown
|
||||
{
|
||||
get => this.KeyStatus[nameof (MenuDown)];
|
||||
set => this.KeyStatus[nameof (MenuDown)] = value;
|
||||
}
|
||||
|
||||
public bool MenuLeft
|
||||
{
|
||||
get => this.KeyStatus[nameof (MenuLeft)];
|
||||
set => this.KeyStatus[nameof (MenuLeft)] = value;
|
||||
}
|
||||
|
||||
public bool MenuRight
|
||||
{
|
||||
get => this.KeyStatus[nameof (MenuRight)];
|
||||
set => this.KeyStatus[nameof (MenuRight)] = value;
|
||||
}
|
||||
|
||||
public bool LockOn
|
||||
{
|
||||
get => this.KeyStatus[nameof (LockOn)];
|
||||
set => this.KeyStatus[nameof (LockOn)] = value;
|
||||
}
|
||||
|
||||
public bool ViewZoomIn
|
||||
{
|
||||
get => this.KeyStatus[nameof (ViewZoomIn)];
|
||||
set => this.KeyStatus[nameof (ViewZoomIn)] = value;
|
||||
}
|
||||
|
||||
public bool ViewZoomOut
|
||||
{
|
||||
get => this.KeyStatus[nameof (ViewZoomOut)];
|
||||
set => this.KeyStatus[nameof (ViewZoomOut)] = value;
|
||||
}
|
||||
|
||||
public bool OpenCreativePowersMenu
|
||||
{
|
||||
get => this.KeyStatus["ToggleCreativeMenu"];
|
||||
set => this.KeyStatus["ToggleCreativeMenu"] = value;
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
foreach (string key in this.KeyStatus.Keys.ToArray<string>())
|
||||
this.KeyStatus[key] = false;
|
||||
}
|
||||
|
||||
public TriggersSet Clone()
|
||||
{
|
||||
TriggersSet triggersSet = new TriggersSet();
|
||||
foreach (string key in this.KeyStatus.Keys)
|
||||
triggersSet.KeyStatus.Add(key, this.KeyStatus[key]);
|
||||
triggersSet.UsedMovementKey = this.UsedMovementKey;
|
||||
triggersSet.HotbarScrollCD = this.HotbarScrollCD;
|
||||
triggersSet.HotbarHoldTime = this.HotbarHoldTime;
|
||||
return triggersSet;
|
||||
}
|
||||
|
||||
public void SetupKeys()
|
||||
{
|
||||
this.KeyStatus.Clear();
|
||||
foreach (string knownTrigger in PlayerInput.KnownTriggers)
|
||||
this.KeyStatus.Add(knownTrigger, false);
|
||||
}
|
||||
|
||||
public Vector2 DirectionsRaw => new Vector2((float) (this.Right.ToInt() - this.Left.ToInt()), (float) (this.Down.ToInt() - this.Up.ToInt()));
|
||||
|
||||
public Vector2 GetNavigatorDirections()
|
||||
{
|
||||
bool flag1 = Main.gameMenu || Main.ingameOptionsWindow || Main.editChest || Main.editSign || (Main.playerInventory || Main.LocalPlayer.talkNPC != -1) && PlayerInput.CurrentProfile.UsingDpadMovekeys();
|
||||
bool flag2 = this.Up || flag1 && this.MenuUp;
|
||||
int num = this.Right ? 1 : (!flag1 ? 0 : (this.MenuRight ? 1 : 0));
|
||||
bool flag3 = this.Down || flag1 && this.MenuDown;
|
||||
bool flag4 = this.Left || flag1 && this.MenuLeft;
|
||||
return new Vector2((float) ((num != 0).ToInt() - flag4.ToInt()), (float) (flag3.ToInt() - flag2.ToInt()));
|
||||
}
|
||||
|
||||
public void CopyInto(Player p)
|
||||
{
|
||||
if (PlayerInput.CurrentInputMode != InputMode.XBoxGamepadUI && !PlayerInput.CursorIsBusy)
|
||||
{
|
||||
p.controlUp = this.Up;
|
||||
p.controlDown = this.Down;
|
||||
p.controlLeft = this.Left;
|
||||
p.controlRight = this.Right;
|
||||
p.controlJump = this.Jump;
|
||||
p.controlHook = this.Grapple;
|
||||
p.controlTorch = this.SmartSelect;
|
||||
p.controlSmart = this.SmartCursor;
|
||||
p.controlMount = this.QuickMount;
|
||||
p.controlQuickHeal = this.QuickHeal;
|
||||
p.controlQuickMana = this.QuickMana;
|
||||
p.controlCreativeMenu = this.OpenCreativePowersMenu;
|
||||
if (this.QuickBuff)
|
||||
p.QuickBuff();
|
||||
}
|
||||
p.controlInv = this.Inventory;
|
||||
p.controlThrow = this.Throw;
|
||||
p.mapZoomIn = this.MapZoomIn;
|
||||
p.mapZoomOut = this.MapZoomOut;
|
||||
p.mapAlphaUp = this.MapAlphaUp;
|
||||
p.mapAlphaDown = this.MapAlphaDown;
|
||||
p.mapFullScreen = this.MapFull;
|
||||
p.mapStyle = this.MapStyle;
|
||||
if (this.MouseLeft)
|
||||
{
|
||||
if (!Main.blockMouse && !p.mouseInterface)
|
||||
p.controlUseItem = true;
|
||||
}
|
||||
else
|
||||
Main.blockMouse = false;
|
||||
if (!this.MouseRight && !Main.playerInventory)
|
||||
PlayerInput.LockGamepadTileUseButton = false;
|
||||
if (this.MouseRight && !p.mouseInterface && !Main.blockMouse && !this.ShouldLockTileUsage() && !PlayerInput.InBuildingMode)
|
||||
p.controlUseTile = true;
|
||||
if (PlayerInput.InBuildingMode && this.MouseRight)
|
||||
p.controlInv = true;
|
||||
bool flag = PlayerInput.Triggers.Current.HotbarPlus || PlayerInput.Triggers.Current.HotbarMinus;
|
||||
if (flag)
|
||||
++this.HotbarHoldTime;
|
||||
else
|
||||
this.HotbarHoldTime = 0;
|
||||
if (this.HotbarScrollCD <= 0 || this.HotbarScrollCD == 1 & flag && PlayerInput.CurrentProfile.HotbarRadialHoldTimeRequired > 0)
|
||||
return;
|
||||
--this.HotbarScrollCD;
|
||||
}
|
||||
|
||||
public void CopyIntoDuringChat(Player p)
|
||||
{
|
||||
if (this.MouseLeft)
|
||||
{
|
||||
if (!Main.blockMouse && !p.mouseInterface)
|
||||
p.controlUseItem = true;
|
||||
}
|
||||
else
|
||||
Main.blockMouse = false;
|
||||
if (!this.MouseRight && !Main.playerInventory)
|
||||
PlayerInput.LockGamepadTileUseButton = false;
|
||||
if (this.MouseRight && !p.mouseInterface && !Main.blockMouse && !this.ShouldLockTileUsage() && !PlayerInput.InBuildingMode)
|
||||
p.controlUseTile = true;
|
||||
bool flag = PlayerInput.Triggers.Current.HotbarPlus || PlayerInput.Triggers.Current.HotbarMinus;
|
||||
if (flag)
|
||||
++this.HotbarHoldTime;
|
||||
else
|
||||
this.HotbarHoldTime = 0;
|
||||
if (this.HotbarScrollCD <= 0 || this.HotbarScrollCD == 1 & flag && PlayerInput.CurrentProfile.HotbarRadialHoldTimeRequired > 0)
|
||||
return;
|
||||
--this.HotbarScrollCD;
|
||||
}
|
||||
|
||||
private bool ShouldLockTileUsage() => PlayerInput.LockGamepadTileUseButton && PlayerInput.UsingGamepad;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue