Terraria 1.3.5.3 Source Code
This commit is contained in:
commit
4b21dac4b6
503 changed files with 409032 additions and 0 deletions
45
GameContent/UI/Chat/AchievementTagHandler.cs
Normal file
45
GameContent/UI/Chat/AchievementTagHandler.cs
Normal file
|
@ -0,0 +1,45 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.GameContent.UI.Chat.AchievementTagHandler
|
||||
// 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.Achievements;
|
||||
using Terraria.UI;
|
||||
using Terraria.UI.Chat;
|
||||
|
||||
namespace Terraria.GameContent.UI.Chat
|
||||
{
|
||||
public class AchievementTagHandler : ITagHandler
|
||||
{
|
||||
TextSnippet ITagHandler.Parse(
|
||||
string text,
|
||||
Color baseColor,
|
||||
string options)
|
||||
{
|
||||
Achievement achievement = Main.Achievements.GetAchievement(text);
|
||||
return achievement == null ? new TextSnippet(text) : (TextSnippet) new AchievementTagHandler.AchievementSnippet(achievement);
|
||||
}
|
||||
|
||||
public static string GenerateTag(Achievement achievement) => "[a:" + achievement.Name + "]";
|
||||
|
||||
private class AchievementSnippet : TextSnippet
|
||||
{
|
||||
private Achievement _achievement;
|
||||
|
||||
public AchievementSnippet(Achievement achievement)
|
||||
: base(achievement.FriendlyName.Value, Color.LightBlue)
|
||||
{
|
||||
this.CheckForHover = true;
|
||||
this._achievement = achievement;
|
||||
}
|
||||
|
||||
public override void OnClick()
|
||||
{
|
||||
IngameOptions.Close();
|
||||
IngameFancyUI.OpenAchievementsAndGoto(this._achievement);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
29
GameContent/UI/Chat/ColorTagHandler.cs
Normal file
29
GameContent/UI/Chat/ColorTagHandler.cs
Normal file
|
@ -0,0 +1,29 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.GameContent.UI.Chat.ColorTagHandler
|
||||
// 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.Globalization;
|
||||
using Terraria.UI.Chat;
|
||||
|
||||
namespace Terraria.GameContent.UI.Chat
|
||||
{
|
||||
public class ColorTagHandler : ITagHandler
|
||||
{
|
||||
TextSnippet ITagHandler.Parse(
|
||||
string text,
|
||||
Color baseColor,
|
||||
string options)
|
||||
{
|
||||
TextSnippet textSnippet = new TextSnippet(text);
|
||||
int result;
|
||||
if (!int.TryParse(options, NumberStyles.AllowHexSpecifier, (IFormatProvider) CultureInfo.InvariantCulture, out result))
|
||||
return textSnippet;
|
||||
textSnippet.Color = new Color(result >> 16 & (int) byte.MaxValue, result >> 8 & (int) byte.MaxValue, result & (int) byte.MaxValue);
|
||||
return textSnippet;
|
||||
}
|
||||
}
|
||||
}
|
181
GameContent/UI/Chat/GlyphTagHandler.cs
Normal file
181
GameContent/UI/Chat/GlyphTagHandler.cs
Normal file
|
@ -0,0 +1,181 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.GameContent.UI.Chat.GlyphTagHandler
|
||||
// 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 Microsoft.Xna.Framework.Input;
|
||||
using ReLogic.Graphics;
|
||||
using System.Collections.Generic;
|
||||
using Terraria.UI.Chat;
|
||||
|
||||
namespace Terraria.GameContent.UI.Chat
|
||||
{
|
||||
public class GlyphTagHandler : ITagHandler
|
||||
{
|
||||
private const int GlyphsPerLine = 25;
|
||||
private const int MaxGlyphs = 26;
|
||||
public static float GlyphsScale = 1f;
|
||||
private static Dictionary<string, int> GlyphIndexes = new Dictionary<string, int>()
|
||||
{
|
||||
{
|
||||
Buttons.A.ToString(),
|
||||
0
|
||||
},
|
||||
{
|
||||
Buttons.B.ToString(),
|
||||
1
|
||||
},
|
||||
{
|
||||
Buttons.Back.ToString(),
|
||||
4
|
||||
},
|
||||
{
|
||||
Buttons.DPadDown.ToString(),
|
||||
15
|
||||
},
|
||||
{
|
||||
Buttons.DPadLeft.ToString(),
|
||||
14
|
||||
},
|
||||
{
|
||||
Buttons.DPadRight.ToString(),
|
||||
13
|
||||
},
|
||||
{
|
||||
Buttons.DPadUp.ToString(),
|
||||
16
|
||||
},
|
||||
{
|
||||
Buttons.LeftShoulder.ToString(),
|
||||
6
|
||||
},
|
||||
{
|
||||
Buttons.LeftStick.ToString(),
|
||||
10
|
||||
},
|
||||
{
|
||||
Buttons.LeftThumbstickDown.ToString(),
|
||||
20
|
||||
},
|
||||
{
|
||||
Buttons.LeftThumbstickLeft.ToString(),
|
||||
17
|
||||
},
|
||||
{
|
||||
Buttons.LeftThumbstickRight.ToString(),
|
||||
18
|
||||
},
|
||||
{
|
||||
Buttons.LeftThumbstickUp.ToString(),
|
||||
19
|
||||
},
|
||||
{
|
||||
Buttons.LeftTrigger.ToString(),
|
||||
8
|
||||
},
|
||||
{
|
||||
Buttons.RightShoulder.ToString(),
|
||||
7
|
||||
},
|
||||
{
|
||||
Buttons.RightStick.ToString(),
|
||||
11
|
||||
},
|
||||
{
|
||||
Buttons.RightThumbstickDown.ToString(),
|
||||
24
|
||||
},
|
||||
{
|
||||
Buttons.RightThumbstickLeft.ToString(),
|
||||
21
|
||||
},
|
||||
{
|
||||
Buttons.RightThumbstickRight.ToString(),
|
||||
22
|
||||
},
|
||||
{
|
||||
Buttons.RightThumbstickUp.ToString(),
|
||||
23
|
||||
},
|
||||
{
|
||||
Buttons.RightTrigger.ToString(),
|
||||
9
|
||||
},
|
||||
{
|
||||
Buttons.Start.ToString(),
|
||||
5
|
||||
},
|
||||
{
|
||||
Buttons.X.ToString(),
|
||||
2
|
||||
},
|
||||
{
|
||||
Buttons.Y.ToString(),
|
||||
3
|
||||
},
|
||||
{
|
||||
"LR",
|
||||
25
|
||||
}
|
||||
};
|
||||
|
||||
TextSnippet ITagHandler.Parse(
|
||||
string text,
|
||||
Color baseColor,
|
||||
string options)
|
||||
{
|
||||
int result;
|
||||
if (!int.TryParse(text, out result) || result >= 26)
|
||||
return new TextSnippet(text);
|
||||
GlyphTagHandler.GlyphSnippet glyphSnippet = new GlyphTagHandler.GlyphSnippet(result);
|
||||
glyphSnippet.DeleteWhole = true;
|
||||
glyphSnippet.Text = "[g:" + (object) result + "]";
|
||||
return (TextSnippet) glyphSnippet;
|
||||
}
|
||||
|
||||
public static string GenerateTag(int index) => "[g" + ":" + (object) index + "]";
|
||||
|
||||
public static string GenerateTag(string keyname)
|
||||
{
|
||||
int index;
|
||||
return GlyphTagHandler.GlyphIndexes.TryGetValue(keyname, out index) ? GlyphTagHandler.GenerateTag(index) : keyname;
|
||||
}
|
||||
|
||||
private class GlyphSnippet : TextSnippet
|
||||
{
|
||||
private int _glyphIndex;
|
||||
|
||||
public GlyphSnippet(int index)
|
||||
: base()
|
||||
{
|
||||
this._glyphIndex = index;
|
||||
this.Color = Color.White;
|
||||
}
|
||||
|
||||
public override bool UniqueDraw(
|
||||
bool justCheckingString,
|
||||
out Vector2 size,
|
||||
SpriteBatch spriteBatch,
|
||||
Vector2 position = default (Vector2),
|
||||
Color color = default (Color),
|
||||
float scale = 1f)
|
||||
{
|
||||
if (!justCheckingString && color != Color.Black)
|
||||
{
|
||||
int frameX = this._glyphIndex;
|
||||
if (this._glyphIndex == 25)
|
||||
frameX = (double) Main.GlobalTime % 0.600000023841858 < 0.300000011920929 ? 17 : 18;
|
||||
Texture2D texture2D = Main.textGlyphTexture[0];
|
||||
spriteBatch.Draw(texture2D, position, new Rectangle?(texture2D.Frame(25, frameX: frameX, frameY: (frameX / 25))), color, 0.0f, Vector2.Zero, GlyphTagHandler.GlyphsScale, SpriteEffects.None, 0.0f);
|
||||
}
|
||||
size = new Vector2(26f) * GlyphTagHandler.GlyphsScale;
|
||||
return true;
|
||||
}
|
||||
|
||||
public override float GetStringLength(DynamicSpriteFont font) => 26f * GlyphTagHandler.GlyphsScale;
|
||||
}
|
||||
}
|
||||
}
|
133
GameContent/UI/Chat/ItemTagHandler.cs
Normal file
133
GameContent/UI/Chat/ItemTagHandler.cs
Normal file
|
@ -0,0 +1,133 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.GameContent.UI.Chat.ItemTagHandler
|
||||
// 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 ReLogic.Graphics;
|
||||
using Terraria.UI;
|
||||
using Terraria.UI.Chat;
|
||||
|
||||
namespace Terraria.GameContent.UI.Chat
|
||||
{
|
||||
public class ItemTagHandler : ITagHandler
|
||||
{
|
||||
TextSnippet ITagHandler.Parse(
|
||||
string text,
|
||||
Color baseColor,
|
||||
string options)
|
||||
{
|
||||
Item obj = new Item();
|
||||
int result1;
|
||||
if (int.TryParse(text, out result1))
|
||||
obj.netDefaults(result1);
|
||||
if (obj.type <= 0)
|
||||
return new TextSnippet(text);
|
||||
obj.stack = 1;
|
||||
if (options != null)
|
||||
{
|
||||
string[] strArray = options.Split(',');
|
||||
for (int index = 0; index < strArray.Length; ++index)
|
||||
{
|
||||
if (strArray[index].Length != 0)
|
||||
{
|
||||
switch (strArray[index][0])
|
||||
{
|
||||
case 'p':
|
||||
int result2;
|
||||
if (int.TryParse(strArray[index].Substring(1), out result2))
|
||||
{
|
||||
obj.Prefix((int) (byte) Utils.Clamp<int>(result2, 0, 84));
|
||||
continue;
|
||||
}
|
||||
continue;
|
||||
case 's':
|
||||
case 'x':
|
||||
int result3;
|
||||
if (int.TryParse(strArray[index].Substring(1), out result3))
|
||||
{
|
||||
obj.stack = Utils.Clamp<int>(result3, 1, obj.maxStack);
|
||||
continue;
|
||||
}
|
||||
continue;
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
string str = "";
|
||||
if (obj.stack > 1)
|
||||
str = " (" + (object) obj.stack + ")";
|
||||
ItemTagHandler.ItemSnippet itemSnippet = new ItemTagHandler.ItemSnippet(obj);
|
||||
itemSnippet.Text = "[" + obj.AffixName() + str + "]";
|
||||
itemSnippet.CheckForHover = true;
|
||||
itemSnippet.DeleteWhole = true;
|
||||
return (TextSnippet) itemSnippet;
|
||||
}
|
||||
|
||||
public static string GenerateTag(Item I)
|
||||
{
|
||||
string str = "[i";
|
||||
if (I.prefix != (byte) 0)
|
||||
str = str + "/p" + (object) I.prefix;
|
||||
if (I.stack != 1)
|
||||
str = str + "/s" + (object) I.stack;
|
||||
return str + ":" + (object) I.netID + "]";
|
||||
}
|
||||
|
||||
private class ItemSnippet : TextSnippet
|
||||
{
|
||||
private Item _item;
|
||||
|
||||
public ItemSnippet(Item item)
|
||||
: base()
|
||||
{
|
||||
this._item = item;
|
||||
this.Color = ItemRarity.GetColor(item.rare);
|
||||
}
|
||||
|
||||
public override void OnHover()
|
||||
{
|
||||
Main.HoverItem = this._item.Clone();
|
||||
Main.instance.MouseText(this._item.Name, this._item.rare);
|
||||
}
|
||||
|
||||
public override bool UniqueDraw(
|
||||
bool justCheckingString,
|
||||
out Vector2 size,
|
||||
SpriteBatch spriteBatch,
|
||||
Vector2 position = default (Vector2),
|
||||
Color color = default (Color),
|
||||
float scale = 1f)
|
||||
{
|
||||
float num1 = 1f;
|
||||
float num2 = 1f;
|
||||
if (Main.netMode != 2 && !Main.dedServ)
|
||||
{
|
||||
Texture2D texture2D = Main.itemTexture[this._item.type];
|
||||
Rectangle rectangle = Main.itemAnimations[this._item.type] == null ? texture2D.Frame() : Main.itemAnimations[this._item.type].GetFrame(texture2D);
|
||||
if (rectangle.Height > 32)
|
||||
num2 = 32f / (float) rectangle.Height;
|
||||
}
|
||||
float num3 = num2 * scale;
|
||||
float num4 = num1 * num3;
|
||||
if ((double) num4 > 0.75)
|
||||
num4 = 0.75f;
|
||||
if (!justCheckingString && color != Color.Black)
|
||||
{
|
||||
double inventoryScale = (double) Main.inventoryScale;
|
||||
Main.inventoryScale = scale * num4;
|
||||
ItemSlot.Draw(spriteBatch, ref this._item, 14, position - new Vector2(10f) * scale * num4, Color.White);
|
||||
Main.inventoryScale = (float) inventoryScale;
|
||||
}
|
||||
size = new Vector2(32f) * scale * num4;
|
||||
return true;
|
||||
}
|
||||
|
||||
public override float GetStringLength(DynamicSpriteFont font) => (float) (32.0 * (double) this.Scale * 0.649999976158142);
|
||||
}
|
||||
}
|
||||
}
|
24
GameContent/UI/Chat/NameTagHandler.cs
Normal file
24
GameContent/UI/Chat/NameTagHandler.cs
Normal file
|
@ -0,0 +1,24 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.GameContent.UI.Chat.NameTagHandler
|
||||
// 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.UI.Chat;
|
||||
|
||||
namespace Terraria.GameContent.UI.Chat
|
||||
{
|
||||
public class NameTagHandler : ITagHandler
|
||||
{
|
||||
TextSnippet ITagHandler.Parse(
|
||||
string text,
|
||||
Color baseColor,
|
||||
string options)
|
||||
{
|
||||
return new TextSnippet("<" + text.Replace("\\[", "[").Replace("\\]", "]") + ">", baseColor);
|
||||
}
|
||||
|
||||
public static string GenerateTag(string name) => "[n:" + name.Replace("[", "\\[").Replace("]", "\\]") + "]";
|
||||
}
|
||||
}
|
37
GameContent/UI/Chat/PlainTagHandler.cs
Normal file
37
GameContent/UI/Chat/PlainTagHandler.cs
Normal file
|
@ -0,0 +1,37 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.GameContent.UI.Chat.PlainTagHandler
|
||||
// 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.UI.Chat;
|
||||
|
||||
namespace Terraria.GameContent.UI.Chat
|
||||
{
|
||||
public class PlainTagHandler : ITagHandler
|
||||
{
|
||||
TextSnippet ITagHandler.Parse(
|
||||
string text,
|
||||
Color baseColor,
|
||||
string options)
|
||||
{
|
||||
return (TextSnippet) new PlainTagHandler.PlainSnippet(text);
|
||||
}
|
||||
|
||||
public class PlainSnippet : TextSnippet
|
||||
{
|
||||
public PlainSnippet(string text = "")
|
||||
: base(text)
|
||||
{
|
||||
}
|
||||
|
||||
public PlainSnippet(string text, Color color, float scale = 1f)
|
||||
: base(text, color, scale)
|
||||
{
|
||||
}
|
||||
|
||||
public override Color GetVisibleColor() => this.Color;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue