Terraria 1.4.0.5 Source Code
This commit is contained in:
commit
05205f009e
1059 changed files with 563450 additions and 0 deletions
18
Chat/Commands/ChatCommandAttribute.cs
Normal file
18
Chat/Commands/ChatCommandAttribute.cs
Normal file
|
@ -0,0 +1,18 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Chat.Commands.ChatCommandAttribute
|
||||
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
|
||||
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
|
||||
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
|
||||
|
||||
using System;
|
||||
|
||||
namespace Terraria.Chat.Commands
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface, Inherited = false)]
|
||||
public sealed class ChatCommandAttribute : Attribute
|
||||
{
|
||||
public readonly string Name;
|
||||
|
||||
public ChatCommandAttribute(string name) => this.Name = name;
|
||||
}
|
||||
}
|
73
Chat/Commands/EmojiCommand.cs
Normal file
73
Chat/Commands/EmojiCommand.cs
Normal file
|
@ -0,0 +1,73 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Chat.Commands.EmojiCommand
|
||||
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
|
||||
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
|
||||
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Terraria.GameContent.UI;
|
||||
using Terraria.Localization;
|
||||
|
||||
namespace Terraria.Chat.Commands
|
||||
{
|
||||
[ChatCommand("Emoji")]
|
||||
public class EmojiCommand : IChatCommand
|
||||
{
|
||||
public const int PlayerEmojiDuration = 360;
|
||||
private readonly Dictionary<LocalizedText, int> _byName = new Dictionary<LocalizedText, int>();
|
||||
|
||||
public EmojiCommand() => this.Initialize();
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
this._byName.Clear();
|
||||
for (int id = 0; id < 145; ++id)
|
||||
{
|
||||
LocalizedText emojiName = Lang.GetEmojiName(id);
|
||||
if (emojiName != LocalizedText.Empty)
|
||||
this._byName[emojiName] = id;
|
||||
}
|
||||
}
|
||||
|
||||
public void ProcessIncomingMessage(string text, byte clientId)
|
||||
{
|
||||
}
|
||||
|
||||
public void ProcessOutgoingMessage(ChatMessage message)
|
||||
{
|
||||
int result = -1;
|
||||
if (int.TryParse(message.Text, out result))
|
||||
{
|
||||
if (result < 0 || result >= 145)
|
||||
return;
|
||||
}
|
||||
else
|
||||
result = -1;
|
||||
if (result == -1)
|
||||
{
|
||||
foreach (LocalizedText key in this._byName.Keys)
|
||||
{
|
||||
if (message.Text == key.Value)
|
||||
{
|
||||
result = this._byName[key];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (result != -1)
|
||||
{
|
||||
if (Main.netMode == 0)
|
||||
{
|
||||
EmoteBubble.NewBubble(result, new WorldUIAnchor((Entity) Main.LocalPlayer), 360);
|
||||
EmoteBubble.CheckForNPCsToReactToEmoteBubble(result, Main.LocalPlayer);
|
||||
}
|
||||
else
|
||||
NetMessage.SendData(120, number: Main.myPlayer, number2: ((float) result));
|
||||
}
|
||||
message.Consume();
|
||||
}
|
||||
|
||||
public void PrintWarning(string text) => throw new Exception("This needs localized text!");
|
||||
}
|
||||
}
|
29
Chat/Commands/EmoteCommand.cs
Normal file
29
Chat/Commands/EmoteCommand.cs
Normal file
|
@ -0,0 +1,29 @@
|
|||
// 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 location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
|
||||
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria.Localization;
|
||||
|
||||
namespace Terraria.Chat.Commands
|
||||
{
|
||||
[ChatCommand("Emote")]
|
||||
public class EmoteCommand : IChatCommand
|
||||
{
|
||||
private static readonly Color RESPONSE_COLOR = new Color(200, 100, 0);
|
||||
|
||||
public void ProcessIncomingMessage(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)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
57
Chat/Commands/HelpCommand.cs
Normal file
57
Chat/Commands/HelpCommand.cs
Normal file
|
@ -0,0 +1,57 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Chat.Commands.HelpCommand
|
||||
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
|
||||
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
|
||||
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
|
||||
|
||||
using Microsoft.Xna.Framework;
|
||||
using System.Collections.Generic;
|
||||
using Terraria.Localization;
|
||||
|
||||
namespace Terraria.Chat.Commands
|
||||
{
|
||||
[ChatCommand("Help")]
|
||||
public class HelpCommand : IChatCommand
|
||||
{
|
||||
private static readonly Color RESPONSE_COLOR = new Color((int) byte.MaxValue, 240, 20);
|
||||
|
||||
public void ProcessIncomingMessage(string text, byte clientId) => ChatHelper.SendChatMessageToClient(HelpCommand.ComposeMessage(HelpCommand.GetCommandAliasesByID()), HelpCommand.RESPONSE_COLOR, (int) clientId);
|
||||
|
||||
private static Dictionary<string, List<LocalizedText>> GetCommandAliasesByID()
|
||||
{
|
||||
LocalizedText[] all = Language.FindAll(Lang.CreateDialogFilter("ChatCommand.", Lang.CreateDialogSubstitutionObject()));
|
||||
Dictionary<string, List<LocalizedText>> dictionary = new Dictionary<string, List<LocalizedText>>();
|
||||
foreach (LocalizedText localizedText in all)
|
||||
{
|
||||
string key = localizedText.Key.Replace("ChatCommand.", "");
|
||||
int length = key.IndexOf('_');
|
||||
if (length != -1)
|
||||
key = key.Substring(0, length);
|
||||
List<LocalizedText> localizedTextList;
|
||||
if (!dictionary.TryGetValue(key, out localizedTextList))
|
||||
{
|
||||
localizedTextList = new List<LocalizedText>();
|
||||
dictionary[key] = localizedTextList;
|
||||
}
|
||||
localizedTextList.Add(localizedText);
|
||||
}
|
||||
return dictionary;
|
||||
}
|
||||
|
||||
private static NetworkText ComposeMessage(
|
||||
Dictionary<string, List<LocalizedText>> aliases)
|
||||
{
|
||||
string text = "";
|
||||
for (int index = 0; index < aliases.Count; ++index)
|
||||
text = text + "{" + (object) index + "}\n";
|
||||
List<NetworkText> networkTextList = new List<NetworkText>();
|
||||
foreach (KeyValuePair<string, List<LocalizedText>> alias in aliases)
|
||||
networkTextList.Add(Language.GetText("ChatCommandDescription." + alias.Key).ToNetworkText());
|
||||
return NetworkText.FromFormattable(text, (object[]) networkTextList.ToArray());
|
||||
}
|
||||
|
||||
public void ProcessOutgoingMessage(ChatMessage message)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
15
Chat/Commands/IChatCommand.cs
Normal file
15
Chat/Commands/IChatCommand.cs
Normal file
|
@ -0,0 +1,15 @@
|
|||
// 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 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);
|
||||
}
|
||||
}
|
26
Chat/Commands/ListPlayersCommand.cs
Normal file
26
Chat/Commands/ListPlayersCommand.cs
Normal file
|
@ -0,0 +1,26 @@
|
|||
// 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 location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
|
||||
|
||||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Terraria.Localization;
|
||||
|
||||
namespace Terraria.Chat.Commands
|
||||
{
|
||||
[ChatCommand("Playing")]
|
||||
public class ListPlayersCommand : IChatCommand
|
||||
{
|
||||
private static readonly Color RESPONSE_COLOR = new Color((int) byte.MaxValue, 240, 20);
|
||||
|
||||
public void 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)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
43
Chat/Commands/PartyChatCommand.cs
Normal file
43
Chat/Commands/PartyChatCommand.cs
Normal file
|
@ -0,0 +1,43 @@
|
|||
// 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 location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
|
||||
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria.Localization;
|
||||
|
||||
namespace Terraria.Chat.Commands
|
||||
{
|
||||
[ChatCommand("Party")]
|
||||
public class PartyChatCommand : IChatCommand
|
||||
{
|
||||
private static readonly Color ERROR_COLOR = new Color((int) byte.MaxValue, 240, 20);
|
||||
|
||||
public void ProcessIncomingMessage(string text, byte clientId)
|
||||
{
|
||||
int team = Main.player[(int) clientId].team;
|
||||
Color color = Main.teamColor[team];
|
||||
if (team == 0)
|
||||
{
|
||||
this.SendNoTeamError(clientId);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (text == "")
|
||||
return;
|
||||
for (int playerId = 0; playerId < (int) byte.MaxValue; ++playerId)
|
||||
{
|
||||
if (Main.player[playerId].team == team)
|
||||
ChatHelper.SendChatMessageToClientAs(clientId, NetworkText.FromLiteral(text), color, playerId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void ProcessOutgoingMessage(ChatMessage message)
|
||||
{
|
||||
}
|
||||
|
||||
private void SendNoTeamError(byte clientId) => ChatHelper.SendChatMessageToClient(Lang.mp[10].ToNetworkText(), PartyChatCommand.ERROR_COLOR, (int) clientId);
|
||||
}
|
||||
}
|
31
Chat/Commands/RockPaperScissorsCommand.cs
Normal file
31
Chat/Commands/RockPaperScissorsCommand.cs
Normal file
|
@ -0,0 +1,31 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Chat.Commands.RockPaperScissorsCommand
|
||||
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
|
||||
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
|
||||
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
|
||||
|
||||
using Terraria.GameContent.UI;
|
||||
|
||||
namespace Terraria.Chat.Commands
|
||||
{
|
||||
[ChatCommand("RPS")]
|
||||
public class RockPaperScissorsCommand : IChatCommand
|
||||
{
|
||||
public void ProcessIncomingMessage(string text, byte clientId)
|
||||
{
|
||||
}
|
||||
|
||||
public void ProcessOutgoingMessage(ChatMessage message)
|
||||
{
|
||||
int num = Main.rand.NextFromList<int>(37, 38, 36);
|
||||
if (Main.netMode == 0)
|
||||
{
|
||||
EmoteBubble.NewBubble(num, new WorldUIAnchor((Entity) Main.LocalPlayer), 360);
|
||||
EmoteBubble.CheckForNPCsToReactToEmoteBubble(num, Main.LocalPlayer);
|
||||
}
|
||||
else
|
||||
NetMessage.SendData(120, number: Main.myPlayer, number2: ((float) num));
|
||||
message.Consume();
|
||||
}
|
||||
}
|
||||
}
|
27
Chat/Commands/RollCommand.cs
Normal file
27
Chat/Commands/RollCommand.cs
Normal file
|
@ -0,0 +1,27 @@
|
|||
// 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 location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
|
||||
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria.Localization;
|
||||
|
||||
namespace Terraria.Chat.Commands
|
||||
{
|
||||
[ChatCommand("Roll")]
|
||||
public class RollCommand : IChatCommand
|
||||
{
|
||||
private static readonly Color RESPONSE_COLOR = new Color((int) byte.MaxValue, 240, 20);
|
||||
|
||||
public void ProcessIncomingMessage(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)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
20
Chat/Commands/SayChatCommand.cs
Normal file
20
Chat/Commands/SayChatCommand.cs
Normal file
|
@ -0,0 +1,20 @@
|
|||
// 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 location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
|
||||
|
||||
using Terraria.Localization;
|
||||
|
||||
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)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue