├── Terraria
├── Microsoft.Xna.Framework.RuntimeProfile
├── Terraria.res
└── compile.bat
├── TerrariaPatcher
├── ildasm.exe
├── patch.exe
├── IlDasmrc.dll
├── app.config
├── Properties
│ ├── AssemblyInfo.cs
│ └── Resources.Designer.cs
└── TerrariaPatcher.csproj
├── TerrariaServer
├── TerrariaServer.res
└── compile.bat
├── TexturePlugin
├── ICSharpCode.SharpZipLib.dll
├── Properties
│ └── AssemblyInfo.cs
├── TexturePlugin.cs
├── TextureForm.cs
├── TextureForm.Designer.cs
├── TexturePlugin.csproj
└── TextureForm.resx
├── TerrariaAPI
├── Hooks
│ ├── Classes
│ │ ├── MethodHookAttribute.cs
│ │ └── SetDefaults.cs
│ ├── PlayerHooks.cs
│ ├── ItemHooks.cs
│ ├── DrawHooks.cs
│ ├── NpcHooks.cs
│ ├── ClientHooks.cs
│ ├── GameHooks.cs
│ └── NetHooks.cs
├── TerrariaConsole.cs
├── PluginContainer.cs
├── Properties
│ └── AssemblyInfo.cs
├── PacketTypes.cs
└── TerrariaPlugin.cs
├── .gitignore
├── XNAHelpers
├── FastDateTime.cs
├── GameTimer.cs
├── Properties
│ └── AssemblyInfo.cs
├── Extensions.cs
├── SettingsHelper.cs
├── FrameRateCounter.cs
├── MathHelpers.cs
├── SteamExtensions.cs
├── Logger.cs
├── XNAHelpers.csproj
└── InputManager.cs
├── MinimapPlugin
├── MinimapForm.cs
├── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ └── Resources.resx
├── MinimapSettings.cs
├── MinimapForm.Designer.cs
├── Enums.cs
├── WorldRenderer.cs
└── MinimapPlugin.csproj
├── ItemPlugin
├── ItemType.cs
├── Properties
│ └── AssemblyInfo.cs
├── ItemPlugin.cs
├── ItemHelper.cs
├── ItemManager.cs
├── ItemForm.cs
├── ItemPlugin.csproj
└── ItemForm.resx
├── TeleportPlugin
├── TeleportLocationForm.cs
├── TeleportLocation.cs
├── ChatCommand.cs
├── Properties
│ └── AssemblyInfo.cs
├── TeleportForm.cs
├── TeleportLocationForm.Designer.cs
├── TeleportForm.resx
└── TeleportPlugin.csproj
├── README.txt
├── TempPlugin
├── Properties
│ └── AssemblyInfo.cs
└── TempPlugin.csproj
├── TrainerPlugin
├── Properties
│ └── AssemblyInfo.cs
├── TrainerForm.cs
├── TrainerForm.Designer.cs
├── TrainerPlugin.csproj
└── TrainerForm.resx
├── ResolutionPlugin
├── Properties
│ └── AssemblyInfo.cs
├── ResolutionPlugin.cs
└── ResolutionPlugin.csproj
└── ScreenShotPlugin
├── Properties
└── AssemblyInfo.cs
├── BitmapDataEx.cs
└── ScreenShotPlugin.csproj
/Terraria/Microsoft.Xna.Framework.RuntimeProfile:
--------------------------------------------------------------------------------
1 | Windows.v4.0.Reach
2 |
--------------------------------------------------------------------------------
/Terraria/Terraria.res:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bladecoding/Terraria-API/HEAD/Terraria/Terraria.res
--------------------------------------------------------------------------------
/TerrariaPatcher/ildasm.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bladecoding/Terraria-API/HEAD/TerrariaPatcher/ildasm.exe
--------------------------------------------------------------------------------
/TerrariaPatcher/patch.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bladecoding/Terraria-API/HEAD/TerrariaPatcher/patch.exe
--------------------------------------------------------------------------------
/TerrariaPatcher/IlDasmrc.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bladecoding/Terraria-API/HEAD/TerrariaPatcher/IlDasmrc.dll
--------------------------------------------------------------------------------
/TerrariaServer/TerrariaServer.res:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bladecoding/Terraria-API/HEAD/TerrariaServer/TerrariaServer.res
--------------------------------------------------------------------------------
/TexturePlugin/ICSharpCode.SharpZipLib.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bladecoding/Terraria-API/HEAD/TexturePlugin/ICSharpCode.SharpZipLib.dll
--------------------------------------------------------------------------------
/Terraria/compile.bat:
--------------------------------------------------------------------------------
1 | del Terraria.exe
2 | "C:\Windows\Microsoft.NET\Framework\v4.0.30319\ilasm.exe" Terraria.il /quiet /output=Terraria.exe /res=Terraria.res
--------------------------------------------------------------------------------
/TerrariaPatcher/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/TerrariaServer/compile.bat:
--------------------------------------------------------------------------------
1 | del TerrariaServer.exe
2 | "C:\Windows\Microsoft.NET\Framework\v4.0.30319\ilasm.exe" TerrariaServer.il /quiet /output=TerrariaServer.exe /res=TerrariaServer.res
--------------------------------------------------------------------------------
/TerrariaAPI/Hooks/Classes/MethodHookAttribute.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace TerrariaAPI.Hooks.Classes
4 | {
5 | [AttributeUsage(AttributeTargets.Method, AllowMultiple = true)]
6 | internal class MethodHookAttribute : Attribute
7 | {
8 | }
9 | }
--------------------------------------------------------------------------------
/TerrariaAPI/TerrariaConsole.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.Xna.Framework;
2 | using TerrariaAPI.Hooks;
3 | using XNAHelpers;
4 |
5 | namespace TerrariaAPI
6 | {
7 | public class TerrariaConsole : XNAConsole
8 | {
9 | public TerrariaConsole(Game game)
10 | : base(game)
11 | {
12 | GameHooks.GetKeyState += (args) => args.Handled = Visible;
13 | }
14 | }
15 | }
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 |
2 | #ignore thumbnails created by windows
3 | Thumbs.db
4 | #Ignore files build by Visual Studio
5 | *.obj
6 | *.exe
7 | *.pdb
8 | *.user
9 | *.aps
10 | *.pch
11 | *.vspscc
12 | *_i.c
13 | *_p.c
14 | *.ncb
15 | *.suo
16 | *.tlb
17 | *.tlh
18 | *.bak
19 | *.cache
20 | *.ilk
21 | *.log
22 | [Bb]in
23 | [Dd]ebug*/
24 | *.lib
25 | *.sbr
26 | obj/
27 | [Rr]elease*/
28 | _ReSharper*/
29 | [Tt]est[Rr]esult*
--------------------------------------------------------------------------------
/TerrariaAPI/Hooks/PlayerHooks.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Terraria;
3 |
4 | namespace TerrariaAPI.Hooks
5 | {
6 | public static class PlayerHooks
7 | {
8 | ///
9 | /// Called right before controls are handled
10 | ///
11 | public static event Action UpdatePhysics;
12 |
13 | public static void OnUpdatePhysics(Player player)
14 | {
15 | if (UpdatePhysics != null)
16 | UpdatePhysics(player);
17 | }
18 | }
19 | }
--------------------------------------------------------------------------------
/XNAHelpers/FastDateTime.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace XNAHelpers
4 | {
5 | public static class FastDateTime
6 | {
7 | public static TimeSpan LocalUtcOffset { get; private set; }
8 |
9 | public static DateTime Now
10 | {
11 | get { return ToLocalTime(DateTime.UtcNow); }
12 | }
13 |
14 | static FastDateTime()
15 | {
16 | LocalUtcOffset = TimeZone.CurrentTimeZone.GetUtcOffset(DateTime.Now);
17 | }
18 |
19 | public static DateTime ToLocalTime(DateTime dateTime)
20 | {
21 | return dateTime + LocalUtcOffset;
22 | }
23 | }
24 | }
--------------------------------------------------------------------------------
/MinimapPlugin/MinimapForm.cs:
--------------------------------------------------------------------------------
1 | using System.Windows.Forms;
2 |
3 | namespace MinimapPlugin
4 | {
5 | public partial class MinimapForm : Form
6 | {
7 | private MinimapSettings settings;
8 |
9 | public MinimapForm(MinimapSettings minimapSettings)
10 | {
11 | InitializeComponent();
12 | settings = minimapSettings;
13 | pgSettings.SelectedObject = settings;
14 | }
15 |
16 | private void pgSettings_PropertyValueChanged(object s, PropertyValueChangedEventArgs e)
17 | {
18 | settings = pgSettings.SelectedObject as MinimapSettings;
19 | }
20 | }
21 | }
--------------------------------------------------------------------------------
/TerrariaAPI/Hooks/Classes/SetDefaults.cs:
--------------------------------------------------------------------------------
1 | using System.ComponentModel;
2 |
3 | namespace TerrariaAPI.Hooks
4 | {
5 | ///
6 | ///
7 | ///
8 | /// Class Type (NPC, Item)
9 | /// Fnfo Type (String, Int)
10 | public class SetDefaultsEventArgs : HandledEventArgs
11 | {
12 | public T Object { get; set; }
13 | public F Info { get; set; }
14 | }
15 |
16 | ///
17 | ///
18 | ///
19 | /// Class Type (NPC, Item)
20 | /// Fnfo Type (String, Int)
21 | public delegate void SetDefaultsD(SetDefaultsEventArgs e);
22 | }
--------------------------------------------------------------------------------
/ItemPlugin/ItemType.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.Xna.Framework;
2 | using Terraria;
3 |
4 | namespace ItemPlugin
5 | {
6 | public class ItemType
7 | {
8 | public int ID { get; private set; }
9 | public string Name { get; private set; }
10 | public Color Color { get; private set; }
11 |
12 | public ItemType(int id, string name, Color color)
13 | {
14 | ID = id;
15 | Name = name;
16 | Color = color;
17 | }
18 |
19 | public ItemEx CreateItem()
20 | {
21 | Item item = ItemHelper.CreateItem(Name);
22 | return new ItemEx(item);
23 | }
24 |
25 | public override string ToString()
26 | {
27 | return Name;
28 | }
29 | }
30 | }
--------------------------------------------------------------------------------
/TeleportPlugin/TeleportLocationForm.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows.Forms;
3 |
4 | namespace TeleportPlugin
5 | {
6 | public partial class TeleportLocationForm : Form
7 | {
8 | public string LocationName { get; private set; }
9 |
10 | public TeleportLocationForm()
11 | {
12 | InitializeComponent();
13 | }
14 |
15 | private void btnOK_Click(object sender, EventArgs e)
16 | {
17 | Close(true);
18 | }
19 |
20 | private void btnCancel_Click(object sender, EventArgs e)
21 | {
22 | Close(false);
23 | }
24 |
25 | private void Close(bool status)
26 | {
27 | DialogResult = status ? DialogResult.OK : DialogResult.Cancel;
28 | LocationName = txtLocationName.Text;
29 | Close();
30 | }
31 | }
32 | }
--------------------------------------------------------------------------------
/TeleportPlugin/TeleportLocation.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.Xna.Framework;
2 | using Terraria;
3 |
4 | namespace TeleportPlugin
5 | {
6 | public class TeleportLocation
7 | {
8 | public string WorldName { get; set; }
9 | public int WorldID { get; set; }
10 | public string Name { get; set; }
11 | public Vector2 Position { get; set; }
12 |
13 | public TeleportLocation()
14 | {
15 | }
16 |
17 | public TeleportLocation(string locationName)
18 | : this(locationName, Main.player[Main.myPlayer].position)
19 | {
20 | }
21 |
22 | public TeleportLocation(string locationName, Vector2 position)
23 | {
24 | WorldName = Main.worldName;
25 | WorldID = Main.worldID;
26 | Name = locationName;
27 | Position = position;
28 | }
29 |
30 | public override string ToString()
31 | {
32 | return Name;
33 | }
34 | }
35 | }
--------------------------------------------------------------------------------
/XNAHelpers/GameTimer.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Microsoft.Xna.Framework;
3 |
4 | namespace XNAHelpers
5 | {
6 | public class GameTimer
7 | {
8 | public float Interval { get; set; }
9 |
10 | public TimeSpan ElapsedTime { get; private set; }
11 |
12 | public float ElapsedSeconds
13 | {
14 | get { return (float)ElapsedTime.TotalSeconds; }
15 | }
16 |
17 | public GameTimer(float interval)
18 | {
19 | Interval = interval;
20 | Reset();
21 | }
22 |
23 | public bool Update(GameTime gameTime)
24 | {
25 | ElapsedTime += gameTime.ElapsedGameTime;
26 |
27 | if (ElapsedSeconds >= Interval)
28 | {
29 | Reset();
30 | return true;
31 | }
32 |
33 | return false;
34 | }
35 |
36 | public void Reset()
37 | {
38 | ElapsedTime = TimeSpan.Zero;
39 | }
40 | }
41 | }
--------------------------------------------------------------------------------
/README.txt:
--------------------------------------------------------------------------------
1 | If you are compiling TerrariaAPI please do the following first.
2 | -Set the environment variable %TERRARIA_BIN% to Terraria's install directory. (IE C:\Program Files (x86)\Steam\steamapps\common\terraria\)
3 | -Run Terraria/compile.bat to compile Terraria.
4 |
5 |
6 | CHANGES:
7 | V1.3
8 | -Enabled property added. Not currently used but best to make your plugins support it soon.
9 | -APIVersion is now a class attribute. This will prevent any crashes due to having an outdated plugin.
10 | -Order property added. Plugins are sorted by order before being initialized.
11 | -Name/Version/Description/Author made virtual meaning you don't have to overide them.
12 |
13 |
14 | Plugins keybinds:
15 | F1 = Teleport to last player
16 | F2 = Teleport to last location
17 | F3 = Teleport to cursor position
18 | F4 = Open teleport form
19 | F5 = Show/Hide minimap
20 | F6 = Show minimap settings form
21 | F7 = Show trainer form
22 | F8 = Show texture loader form
23 | F9 = Show item editor form
--------------------------------------------------------------------------------
/TerrariaAPI/PluginContainer.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace TerrariaAPI
4 | {
5 | public class PluginContainer : IDisposable
6 | {
7 | public TerrariaPlugin Plugin { get; protected set; }
8 |
9 | public bool Initialized { get; protected set; }
10 |
11 | public bool Dll { get; set; }
12 |
13 | public PluginContainer(TerrariaPlugin plugin)
14 | : this(plugin, true)
15 | {
16 | }
17 |
18 | public PluginContainer(TerrariaPlugin plugin, bool dll)
19 | {
20 | Plugin = plugin;
21 | Initialized = false;
22 | Dll = dll;
23 | }
24 |
25 | public void Initialize()
26 | {
27 | Plugin.Initialize();
28 | Initialized = true;
29 | }
30 |
31 | public void DeInitialize()
32 | {
33 | Plugin.DeInitialize();
34 | Initialized = false;
35 | }
36 |
37 | public void Dispose()
38 | {
39 | Plugin.Dispose();
40 | }
41 | }
42 | }
--------------------------------------------------------------------------------
/TeleportPlugin/ChatCommand.cs:
--------------------------------------------------------------------------------
1 | namespace TeleportPlugin
2 | {
3 | internal class ChatCommand
4 | {
5 | public string Command { get; set; }
6 | public string Parameter { get; set; }
7 |
8 | public ChatCommand(string command, string parameter)
9 | {
10 | Command = command;
11 | Parameter = parameter;
12 | }
13 |
14 | public static ChatCommand Parse(string text)
15 | {
16 | if (!string.IsNullOrWhiteSpace(text) && text.Length > 1 && text.StartsWith("/"))
17 | {
18 | string command, parameter = "";
19 |
20 | text = text.Remove(0, 1);
21 |
22 | int spaceIndex = text.IndexOf(' ');
23 |
24 | if (spaceIndex == -1)
25 | {
26 | command = text.Trim();
27 | }
28 | else
29 | {
30 | command = text.Substring(0, spaceIndex).Trim();
31 | parameter = text.Substring(spaceIndex).Trim();
32 | }
33 |
34 | return new ChatCommand(command, parameter);
35 | }
36 |
37 | return null;
38 | }
39 | }
40 | }
--------------------------------------------------------------------------------
/TerrariaAPI/Hooks/ItemHooks.cs:
--------------------------------------------------------------------------------
1 | using Terraria;
2 |
3 | namespace TerrariaAPI.Hooks
4 | {
5 | public static class ItemHooks
6 | {
7 | public static event SetDefaultsD- SetDefaultsInt;
8 | public static event SetDefaultsD
- SetDefaultsString;
9 |
10 | public static void OnSetDefaultsInt(ref int itemtype, Item item)
11 | {
12 | if (SetDefaultsInt == null)
13 | return;
14 |
15 | var args = new SetDefaultsEventArgs
- ()
16 | {
17 | Object = item,
18 | Info = itemtype,
19 | };
20 |
21 | SetDefaultsInt(args);
22 |
23 | itemtype = args.Info;
24 | }
25 |
26 | public static void OnSetDefaultsString(ref string itemname, Item item)
27 | {
28 | if (SetDefaultsString == null)
29 | return;
30 | var args = new SetDefaultsEventArgs
- ()
31 | {
32 | Object = item,
33 | Info = itemname,
34 | };
35 |
36 | SetDefaultsString(args);
37 |
38 | itemname = args.Info;
39 | }
40 | }
41 | }
--------------------------------------------------------------------------------
/ItemPlugin/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 |
4 | // General Information about an assembly is controlled through the following
5 | // set of attributes. Change these attribute values to modify the information
6 | // associated with an assembly.
7 | [assembly: AssemblyTitle("ItemPlugin")]
8 | [assembly: AssemblyDescription("")]
9 | [assembly: AssemblyConfiguration("")]
10 | [assembly: AssemblyCompany("Microsoft")]
11 | [assembly: AssemblyProduct("ItemPlugin")]
12 | [assembly: AssemblyCopyright("Copyright © Microsoft 2011")]
13 | [assembly: AssemblyTrademark("")]
14 | [assembly: AssemblyCulture("")]
15 |
16 | // Setting ComVisible to false makes the types in this assembly not visible
17 | // to COM components. If you need to access a type in this assembly from
18 | // COM, set the ComVisible attribute to true on that type.
19 | [assembly: ComVisible(false)]
20 |
21 | // The following GUID is for the ID of the typelib if this project is exposed to COM
22 | [assembly: Guid("86b0a388-38f3-4e12-8e6b-e717ef8b220e")]
23 |
24 | // Version information for an assembly consists of the following four values:
25 | //
26 | // Major Version
27 | // Minor Version
28 | // Build Number
29 | // Revision
30 | //
31 | // You can specify all the values or you can default the Build and Revision Numbers
32 | // by using the '*' as shown below:
33 | // [assembly: AssemblyVersion("1.0.*")]
34 | [assembly: AssemblyVersion("1.0.0.0")]
35 | [assembly: AssemblyFileVersion("1.0.0.0")]
--------------------------------------------------------------------------------
/TeleportPlugin/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 |
4 | // General Information about an assembly is controlled through the following
5 | // set of attributes. Change these attribute values to modify the information
6 | // associated with an assembly.
7 | [assembly: AssemblyTitle("TeleportPlugin")]
8 | [assembly: AssemblyDescription("")]
9 | [assembly: AssemblyConfiguration("")]
10 | [assembly: AssemblyCompany("Microsoft")]
11 | [assembly: AssemblyProduct("TeleportPlugin")]
12 | [assembly: AssemblyCopyright("Copyright © Microsoft 2011")]
13 | [assembly: AssemblyTrademark("")]
14 | [assembly: AssemblyCulture("")]
15 |
16 | // Setting ComVisible to false makes the types in this assembly not visible
17 | // to COM components. If you need to access a type in this assembly from
18 | // COM, set the ComVisible attribute to true on that type.
19 | [assembly: ComVisible(false)]
20 |
21 | // The following GUID is for the ID of the typelib if this project is exposed to COM
22 | [assembly: Guid("8059e5f5-11de-4dd3-a9dc-07baea778e59")]
23 |
24 | // Version information for an assembly consists of the following four values:
25 | //
26 | // Major Version
27 | // Minor Version
28 | // Build Number
29 | // Revision
30 | //
31 | // You can specify all the values or you can default the Build and Revision Numbers
32 | // by using the '*' as shown below:
33 | // [assembly: AssemblyVersion("1.0.*")]
34 | [assembly: AssemblyVersion("1.0.0.0")]
35 | [assembly: AssemblyFileVersion("1.0.0.0")]
--------------------------------------------------------------------------------
/TempPlugin/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 |
4 | // General Information about an assembly is controlled through the following
5 | // set of attributes. Change these attribute values to modify the information
6 | // associated with an assembly.
7 | [assembly: AssemblyTitle("TempPlugin")]
8 | [assembly: AssemblyDescription("")]
9 | [assembly: AssemblyConfiguration("")]
10 | [assembly: AssemblyCompany("Microsoft")]
11 | [assembly: AssemblyProduct("TempPlugin")]
12 | [assembly: AssemblyCopyright("Copyright © Microsoft 2011")]
13 | [assembly: AssemblyTrademark("")]
14 | [assembly: AssemblyCulture("")]
15 |
16 | // Setting ComVisible to false makes the types in this assembly not visible
17 | // to COM components. If you need to access a type in this assembly from
18 | // COM, set the ComVisible attribute to true on that type.
19 | [assembly: ComVisible(false)]
20 |
21 | // The following GUID is for the ID of the typelib if this project is exposed to COM
22 | [assembly: Guid("86b0a388-38f3-4e12-8e6b-e717ef8b220e")]
23 |
24 | // Version information for an assembly consists of the following four values:
25 | //
26 | // Major Version
27 | // Minor Version
28 | // Build Number
29 | // Revision
30 | //
31 | // You can specify all the values or you can default the Build and Revision Numbers
32 | // by using the '*' as shown below:
33 | // [assembly: AssemblyVersion("1.0.*")]
34 | [assembly: AssemblyVersion("1.0.0.0")]
35 | [assembly: AssemblyFileVersion("1.0.0.0")]
--------------------------------------------------------------------------------
/TerrariaAPI/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 |
4 | // General Information about an assembly is controlled through the following
5 | // set of attributes. Change these attribute values to modify the information
6 | // associated with an assembly.
7 | [assembly: AssemblyTitle("TerrariaAPI")]
8 | [assembly: AssemblyDescription("")]
9 | [assembly: AssemblyConfiguration("")]
10 | [assembly: AssemblyCompany("Microsoft")]
11 | [assembly: AssemblyProduct("TerrariaAPI")]
12 | [assembly: AssemblyCopyright("Copyright © Microsoft 2011")]
13 | [assembly: AssemblyTrademark("")]
14 | [assembly: AssemblyCulture("")]
15 |
16 | // Setting ComVisible to false makes the types in this assembly not visible
17 | // to COM components. If you need to access a type in this assembly from
18 | // COM, set the ComVisible attribute to true on that type.
19 | [assembly: ComVisible(false)]
20 |
21 | // The following GUID is for the ID of the typelib if this project is exposed to COM
22 | [assembly: Guid("3980081e-96ca-4396-83c6-0d28326bc9ee")]
23 |
24 | // Version information for an assembly consists of the following four values:
25 | //
26 | // Major Version
27 | // Minor Version
28 | // Build Number
29 | // Revision
30 | //
31 | // You can specify all the values or you can default the Build and Revision Numbers
32 | // by using the '*' as shown below:
33 | // [assembly: AssemblyVersion("1.0.*")]
34 | [assembly: AssemblyVersion("1.0.0.0")]
35 | [assembly: AssemblyFileVersion("1.0.0.0")]
--------------------------------------------------------------------------------
/MinimapPlugin/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 |
4 | // General Information about an assembly is controlled through the following
5 | // set of attributes. Change these attribute values to modify the information
6 | // associated with an assembly.
7 | [assembly: AssemblyTitle("MinimapPlugin")]
8 | [assembly: AssemblyDescription("")]
9 | [assembly: AssemblyConfiguration("")]
10 | [assembly: AssemblyCompany("Microsoft")]
11 | [assembly: AssemblyProduct("MinimapPlugin")]
12 | [assembly: AssemblyCopyright("Copyright © Microsoft 2011")]
13 | [assembly: AssemblyTrademark("")]
14 | [assembly: AssemblyCulture("")]
15 |
16 | // Setting ComVisible to false makes the types in this assembly not visible
17 | // to COM components. If you need to access a type in this assembly from
18 | // COM, set the ComVisible attribute to true on that type.
19 | [assembly: ComVisible(false)]
20 |
21 | // The following GUID is for the ID of the typelib if this project is exposed to COM
22 | [assembly: Guid("bd56d683-2dd5-47c2-8b23-0c1d084648b4")]
23 |
24 | // Version information for an assembly consists of the following four values:
25 | //
26 | // Major Version
27 | // Minor Version
28 | // Build Number
29 | // Revision
30 | //
31 | // You can specify all the values or you can default the Build and Revision Numbers
32 | // by using the '*' as shown below:
33 | // [assembly: AssemblyVersion("1.0.*")]
34 | [assembly: AssemblyVersion("1.0.0.0")]
35 | [assembly: AssemblyFileVersion("1.0.0.0")]
--------------------------------------------------------------------------------
/TexturePlugin/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 |
4 | // General Information about an assembly is controlled through the following
5 | // set of attributes. Change these attribute values to modify the information
6 | // associated with an assembly.
7 | [assembly: AssemblyTitle("TexturePlugin")]
8 | [assembly: AssemblyDescription("")]
9 | [assembly: AssemblyConfiguration("")]
10 | [assembly: AssemblyCompany("Microsoft")]
11 | [assembly: AssemblyProduct("TexturePlugin")]
12 | [assembly: AssemblyCopyright("Copyright © Microsoft 2011")]
13 | [assembly: AssemblyTrademark("")]
14 | [assembly: AssemblyCulture("")]
15 |
16 | // Setting ComVisible to false makes the types in this assembly not visible
17 | // to COM components. If you need to access a type in this assembly from
18 | // COM, set the ComVisible attribute to true on that type.
19 | [assembly: ComVisible(false)]
20 |
21 | // The following GUID is for the ID of the typelib if this project is exposed to COM
22 | [assembly: Guid("47df3f23-fc1f-4532-bc01-39f4a9e332f6")]
23 |
24 | // Version information for an assembly consists of the following four values:
25 | //
26 | // Major Version
27 | // Minor Version
28 | // Build Number
29 | // Revision
30 | //
31 | // You can specify all the values or you can default the Build and Revision Numbers
32 | // by using the '*' as shown below:
33 | // [assembly: AssemblyVersion("1.0.*")]
34 | [assembly: AssemblyVersion("1.0.0.0")]
35 | [assembly: AssemblyFileVersion("1.0.0.0")]
--------------------------------------------------------------------------------
/TrainerPlugin/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 |
4 | // General Information about an assembly is controlled through the following
5 | // set of attributes. Change these attribute values to modify the information
6 | // associated with an assembly.
7 | [assembly: AssemblyTitle("TrainerPlugin")]
8 | [assembly: AssemblyDescription("")]
9 | [assembly: AssemblyConfiguration("")]
10 | [assembly: AssemblyCompany("Microsoft")]
11 | [assembly: AssemblyProduct("TrainerPlugin")]
12 | [assembly: AssemblyCopyright("Copyright © Microsoft 2011")]
13 | [assembly: AssemblyTrademark("")]
14 | [assembly: AssemblyCulture("")]
15 |
16 | // Setting ComVisible to false makes the types in this assembly not visible
17 | // to COM components. If you need to access a type in this assembly from
18 | // COM, set the ComVisible attribute to true on that type.
19 | [assembly: ComVisible(false)]
20 |
21 | // The following GUID is for the ID of the typelib if this project is exposed to COM
22 | [assembly: Guid("88075bfb-9b4a-47a7-9f02-4ffc36bcf67e")]
23 |
24 | // Version information for an assembly consists of the following four values:
25 | //
26 | // Major Version
27 | // Minor Version
28 | // Build Number
29 | // Revision
30 | //
31 | // You can specify all the values or you can default the Build and Revision Numbers
32 | // by using the '*' as shown below:
33 | // [assembly: AssemblyVersion("1.0.*")]
34 | [assembly: AssemblyVersion("1.0.0.0")]
35 | [assembly: AssemblyFileVersion("1.0.0.0")]
--------------------------------------------------------------------------------
/TerrariaPatcher/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 |
4 | // General Information about an assembly is controlled through the following
5 | // set of attributes. Change these attribute values to modify the information
6 | // associated with an assembly.
7 | [assembly: AssemblyTitle("TerrariaPatcher")]
8 | [assembly: AssemblyDescription("")]
9 | [assembly: AssemblyConfiguration("")]
10 | [assembly: AssemblyCompany("Microsoft")]
11 | [assembly: AssemblyProduct("TerrariaPatcher")]
12 | [assembly: AssemblyCopyright("Copyright © Microsoft 2011")]
13 | [assembly: AssemblyTrademark("")]
14 | [assembly: AssemblyCulture("")]
15 |
16 | // Setting ComVisible to false makes the types in this assembly not visible
17 | // to COM components. If you need to access a type in this assembly from
18 | // COM, set the ComVisible attribute to true on that type.
19 | [assembly: ComVisible(false)]
20 |
21 | // The following GUID is for the ID of the typelib if this project is exposed to COM
22 | [assembly: Guid("936d1bca-f9fb-43f8-9d68-e4f89ba43caf")]
23 |
24 | // Version information for an assembly consists of the following four values:
25 | //
26 | // Major Version
27 | // Minor Version
28 | // Build Number
29 | // Revision
30 | //
31 | // You can specify all the values or you can default the Build and Revision Numbers
32 | // by using the '*' as shown below:
33 | // [assembly: AssemblyVersion("1.0.*")]
34 | [assembly: AssemblyVersion("1.0.0.0")]
35 | [assembly: AssemblyFileVersion("1.0.0.0")]
--------------------------------------------------------------------------------
/ResolutionPlugin/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 |
4 | // General Information about an assembly is controlled through the following
5 | // set of attributes. Change these attribute values to modify the information
6 | // associated with an assembly.
7 | [assembly: AssemblyTitle("ResolutionPlugin")]
8 | [assembly: AssemblyDescription("")]
9 | [assembly: AssemblyConfiguration("")]
10 | [assembly: AssemblyCompany("Microsoft")]
11 | [assembly: AssemblyProduct("ResolutionPlugin")]
12 | [assembly: AssemblyCopyright("Copyright © Microsoft 2011")]
13 | [assembly: AssemblyTrademark("")]
14 | [assembly: AssemblyCulture("")]
15 |
16 | // Setting ComVisible to false makes the types in this assembly not visible
17 | // to COM components. If you need to access a type in this assembly from
18 | // COM, set the ComVisible attribute to true on that type.
19 | [assembly: ComVisible(false)]
20 |
21 | // The following GUID is for the ID of the typelib if this project is exposed to COM
22 | [assembly: Guid("3fa5dabb-ec7f-46d8-8498-6fc00a67d263")]
23 |
24 | // Version information for an assembly consists of the following four values:
25 | //
26 | // Major Version
27 | // Minor Version
28 | // Build Number
29 | // Revision
30 | //
31 | // You can specify all the values or you can default the Build and Revision Numbers
32 | // by using the '*' as shown below:
33 | // [assembly: AssemblyVersion("1.0.*")]
34 | [assembly: AssemblyVersion("1.0.0.0")]
35 | [assembly: AssemblyFileVersion("1.0.0.0")]
--------------------------------------------------------------------------------
/ScreenShotPlugin/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 |
4 | // General Information about an assembly is controlled through the following
5 | // set of attributes. Change these attribute values to modify the information
6 | // associated with an assembly.
7 | [assembly: AssemblyTitle("ScreenShotPlugin")]
8 | [assembly: AssemblyDescription("")]
9 | [assembly: AssemblyConfiguration("")]
10 | [assembly: AssemblyCompany("Microsoft")]
11 | [assembly: AssemblyProduct("ScreenShotPlugin")]
12 | [assembly: AssemblyCopyright("Copyright © Microsoft 2011")]
13 | [assembly: AssemblyTrademark("")]
14 | [assembly: AssemblyCulture("")]
15 |
16 | // Setting ComVisible to false makes the types in this assembly not visible
17 | // to COM components. If you need to access a type in this assembly from
18 | // COM, set the ComVisible attribute to true on that type.
19 | [assembly: ComVisible(false)]
20 |
21 | // The following GUID is for the ID of the typelib if this project is exposed to COM
22 | [assembly: Guid("1ce03ccc-60bf-4490-bec0-0f741de18d08")]
23 |
24 | // Version information for an assembly consists of the following four values:
25 | //
26 | // Major Version
27 | // Minor Version
28 | // Build Number
29 | // Revision
30 | //
31 | // You can specify all the values or you can default the Build and Revision Numbers
32 | // by using the '*' as shown below:
33 | // [assembly: AssemblyVersion("1.0.*")]
34 | [assembly: AssemblyVersion("1.0.0.0")]
35 | [assembly: AssemblyFileVersion("1.0.0.0")]
--------------------------------------------------------------------------------
/XNAHelpers/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("XNAHelpers")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("Microsoft")]
12 | [assembly: AssemblyProduct("XNAHelpers")]
13 | [assembly: AssemblyCopyright("Copyright © Microsoft 2011")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("f6903b4a-d154-4c76-8958-d7903cc1c1cc")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/TrainerPlugin/TrainerForm.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Reflection;
3 | using System.Windows.Forms;
4 |
5 | namespace TrainerPlugin
6 | {
7 | public partial class TrainerForm : Form
8 | {
9 | private TrainerSettings settings;
10 |
11 | public TrainerForm(TrainerSettings trainerSettings)
12 | {
13 | InitializeComponent();
14 | settings = trainerSettings;
15 | pgTrainer.SelectedObject = settings;
16 | }
17 |
18 | private void TrainerForm_Shown(object sender, EventArgs e)
19 | {
20 | MoveSplitterTo(pgTrainer, 200);
21 | }
22 |
23 | private void MoveSplitterTo(PropertyGrid pg, int x)
24 | {
25 | try
26 | {
27 | FieldInfo field = typeof(PropertyGrid).GetField("gridView", BindingFlags.NonPublic | BindingFlags.Instance);
28 | field.FieldType.GetMethod("MoveSplitterTo", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(field.GetValue(pg), new object[] { x });
29 | pgTrainer.Refresh();
30 | }
31 | catch (Exception e)
32 | {
33 | Console.WriteLine(e.ToString());
34 | }
35 | }
36 |
37 | private void pgTrainer_PropertyValueChanged(object s, PropertyValueChangedEventArgs e)
38 | {
39 | settings = (TrainerSettings)pgTrainer.SelectedObject;
40 | }
41 |
42 | private void TrainerForm_FormClosing(object sender, FormClosingEventArgs e)
43 | {
44 | e.Cancel = true;
45 | Visible = false;
46 | }
47 | }
48 | }
--------------------------------------------------------------------------------
/TerrariaAPI/Hooks/DrawHooks.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.ComponentModel;
3 | using Microsoft.Xna.Framework;
4 | using Microsoft.Xna.Framework.Graphics;
5 | using Terraria;
6 |
7 | namespace TerrariaAPI.Hooks
8 | {
9 | public static class DrawHooks
10 | {
11 | ///
12 | /// Called right before SpriteBatch.End
13 | ///
14 | public static event Action EndDraw;
15 |
16 | public static void OnEndDraw(SpriteBatch batch)
17 | {
18 | if (EndDraw != null)
19 | EndDraw(batch);
20 | }
21 |
22 | ///
23 | /// Called right after SpriteBatch.End
24 | ///
25 | public static event Action DrawEnd;
26 |
27 | public static void OnDrawEnd(GameTime batch)
28 | {
29 | if (DrawEnd != null)
30 | DrawEnd(batch);
31 | }
32 |
33 | ///
34 | /// Called after RealDraw ScreenPosition set
35 | ///
36 | public static event Action RealDrawAfterScreenPosition;
37 |
38 | public static void OnRealDrawAfterScreenPosition()
39 | {
40 | if (RealDrawAfterScreenPosition != null)
41 | RealDrawAfterScreenPosition();
42 | }
43 |
44 | ///
45 | /// Called right before DrawInterface
46 | ///
47 | public static event Action DrawInterface;
48 |
49 | public static bool OnDrawInterface(SpriteBatch batch)
50 | {
51 | if (DrawInterface == null)
52 | return false;
53 | var args = new HandledEventArgs();
54 | DrawInterface(batch, args);
55 | return args.Handled;
56 | }
57 | }
58 | }
--------------------------------------------------------------------------------
/XNAHelpers/Extensions.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Microsoft.Xna.Framework;
3 |
4 | namespace XNAHelpers
5 | {
6 | public static class Extensions
7 | {
8 | public static float NextFloat(this Random rand)
9 | {
10 | return (float)rand.NextDouble();
11 | }
12 |
13 | public static float NextFloat(this Random rand, float max)
14 | {
15 | return rand.NextFloat() * max;
16 | }
17 |
18 | public static float NextFloat(this Random rand, float min, float max)
19 | {
20 | return min + rand.NextFloat() * (max - min);
21 | }
22 |
23 | public static Color NextColor(this Random rand)
24 | {
25 | return new Color(rand.Next(0, 256), rand.Next(0, 256), rand.Next(0, 256));
26 | }
27 |
28 | public static Color NextColor(this Random rand, Color min, Color max)
29 | {
30 | float random = rand.NextFloat();
31 | int r = (int)(min.R + (max.R - min.R) * random);
32 | int g = (int)(min.G + (max.G - min.G) * random);
33 | int b = (int)(min.B + (max.B - min.B) * random);
34 | return new Color(r, g, b);
35 | }
36 |
37 | public static float NextAngle(this Random rand)
38 | {
39 | return rand.NextFloat(MathHelpers.TwoPI);
40 | }
41 |
42 | public static int ToAbgr(this Color color)
43 | {
44 | return (color.A << 24) | (color.B << 16) | (color.G << 8) | color.R;
45 | }
46 |
47 | public static int ToAbgr(this int color)
48 | {
49 | return ((color >> 24) & 0xff) << 24 | (color & 0xff) << 16 | ((color >> 8) & 0xff) << 8 | ((color >> 16) & 0xff);
50 | }
51 |
52 | public static int ToAbgr(this uint color)
53 | {
54 | return ((int)color).ToAbgr();
55 | }
56 | }
57 | }
--------------------------------------------------------------------------------
/MinimapPlugin/MinimapSettings.cs:
--------------------------------------------------------------------------------
1 | using System.ComponentModel;
2 |
3 | namespace MinimapPlugin
4 | {
5 | public class MinimapSettings
6 | {
7 | [DefaultValue(true)]
8 | public bool ShowMinimap { get; set; }
9 | [DefaultValue(200)]
10 | public int MinimapWidth { get; set; }
11 | [DefaultValue(150)]
12 | public int MinimapHeight { get; set; }
13 | [DefaultValue(1.0f)]
14 | public float MinimapZoom { get; set; }
15 | [DefaultValue(0)]
16 | public int PositionOffsetX { get; set; }
17 | [DefaultValue(0)]
18 | public int PositionOffsetY { get; set; }
19 | [DefaultValue(MinimapPosition.RightBottom)]
20 | public MinimapPosition MinimapPosition { get; set; }
21 | [DefaultValue(10)]
22 | public int MinimapPositionOffset { get; set; }
23 | [DefaultValue(1.0f)]
24 | public float MinimapTransparency { get; set; }
25 | [DefaultValue(true)]
26 | public bool ShowWall { get; set; }
27 | [DefaultValue(true), Description("ShowWall must be true for this option to work.")]
28 | public bool ShowSky { get; set; }
29 | [DefaultValue(true)]
30 | public bool ShowBorder { get; set; }
31 | [DefaultValue(true)]
32 | public bool ShowCrosshair { get; set; }
33 |
34 | public MinimapSettings()
35 | {
36 | ShowMinimap = true;
37 | MinimapWidth = 200;
38 | MinimapHeight = 150;
39 | MinimapZoom = 1.0f;
40 | PositionOffsetX = 0;
41 | PositionOffsetY = 0;
42 | MinimapPosition = MinimapPosition.RightBottom;
43 | MinimapPositionOffset = 10;
44 | MinimapTransparency = 1.0f;
45 | ShowWall = true;
46 | ShowSky = true;
47 | ShowBorder = true;
48 | ShowCrosshair = true;
49 | }
50 | }
51 | }
--------------------------------------------------------------------------------
/ScreenShotPlugin/BitmapDataEx.cs:
--------------------------------------------------------------------------------
1 | using System.Drawing;
2 | using System.Drawing.Imaging;
3 |
4 | public static class BitmapDataExt
5 | {
6 | public unsafe static void SetPixelInt(this BitmapData bd, uint pos, uint c)
7 | {
8 | if (pos < 0 || pos >= (bd.Width * bd.Height))
9 | return;
10 |
11 | *((uint*)bd.Scan0.ToPointer() + pos) = c;
12 | }
13 |
14 | public static void SetPixelInt(this BitmapData bd, uint x, uint y, uint c)
15 | {
16 | bd.SetPixelInt((uint)((y * bd.Width) + x), c);
17 | }
18 |
19 | public static void SetPixel(this BitmapData bd, uint x, uint y, Color c)
20 | {
21 | bd.SetPixelInt(x, y, (uint)c.ToArgb());
22 | }
23 |
24 | public static void SetPixelInt(this BitmapData bd, int x, int y, int c)
25 | {
26 | bd.SetPixelInt((uint)x, (uint)y, (uint)c);
27 | }
28 |
29 | public static void SetPixel(this BitmapData bd, int x, int y, Color c)
30 | {
31 | bd.SetPixel((uint)x, (uint)y, c);
32 | }
33 |
34 | public unsafe static uint GetPixelInt(this BitmapData bd, uint pos)
35 | {
36 | if (pos < 0 || pos >= (bd.Width * bd.Height))
37 | return 0x00000000;
38 | return *((uint*)bd.Scan0.ToPointer() + pos);
39 | }
40 |
41 | public static uint GetPixelInt(this BitmapData bd, uint x, uint y)
42 | {
43 | return bd.GetPixelInt((uint)((y * bd.Width) + x));
44 | }
45 |
46 | public static Color GetPixel(this BitmapData bd, uint x, uint y)
47 | {
48 | return Color.FromArgb((int)bd.GetPixelInt(x, y));
49 | }
50 |
51 | public static int GetPixelInt(this BitmapData bd, int x, int y)
52 | {
53 | return (int)bd.GetPixelInt((uint)x, (uint)y);
54 | }
55 |
56 | public static Color GetPixel(this BitmapData bd, int x, int y)
57 | {
58 | return bd.GetPixel((uint)x, (uint)y);
59 | }
60 | }
--------------------------------------------------------------------------------
/XNAHelpers/SettingsHelper.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 | using System.Xml.Serialization;
4 |
5 | namespace XNAHelpers
6 | {
7 | public static class SettingsHelper
8 | {
9 | public static bool Save(T obj, string path)
10 | {
11 | try
12 | {
13 | lock (obj)
14 | {
15 | if (!string.IsNullOrEmpty(path))
16 | {
17 | string directoryName = Path.GetDirectoryName(path);
18 |
19 | if (!string.IsNullOrEmpty(directoryName) && !Directory.Exists(directoryName))
20 | {
21 | Directory.CreateDirectory(directoryName);
22 | }
23 |
24 | using (FileStream fs = new FileStream(path, FileMode.Create, FileAccess.Write, FileShare.Read))
25 | {
26 | new XmlSerializer(typeof(T)).Serialize(fs, obj);
27 | return true;
28 | }
29 | }
30 | }
31 | }
32 | catch (Exception e)
33 | {
34 | Console.WriteLine(e.ToString());
35 | }
36 |
37 | return false;
38 | }
39 |
40 | public static T Load(string path) where T : new()
41 | {
42 | try
43 | {
44 | if (!string.IsNullOrEmpty(path) && File.Exists(path))
45 | {
46 | using (FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read))
47 | {
48 | return (T)new XmlSerializer(typeof(T)).Deserialize(fs);
49 | }
50 | }
51 | }
52 | catch (Exception e)
53 | {
54 | Console.WriteLine(e.ToString());
55 | }
56 |
57 | return new T();
58 | }
59 | }
60 | }
--------------------------------------------------------------------------------
/ItemPlugin/ItemPlugin.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Microsoft.Xna.Framework;
3 | using Microsoft.Xna.Framework.Content;
4 | using Microsoft.Xna.Framework.Input;
5 | using Terraria;
6 | using TerrariaAPI;
7 | using TerrariaAPI.Hooks;
8 | using XNAHelpers;
9 |
10 | namespace ItemPlugin
11 | {
12 | ///
13 | /// F9 = Show item editor form
14 | ///
15 | [APIVersion(1, 7)]
16 | public class ItemPlugin : TerrariaPlugin
17 | {
18 | public override string Name
19 | {
20 | get { return "Item Editor"; }
21 | }
22 |
23 | public override Version Version
24 | {
25 | get { return new Version(1, 0); }
26 | }
27 |
28 | public override string Author
29 | {
30 | get { return "Jaex"; }
31 | }
32 |
33 | public override string Description
34 | {
35 | get { return "Give/Edit items"; }
36 | }
37 |
38 | private ItemForm itemForm;
39 |
40 | public ItemPlugin(Main game)
41 | : base(game)
42 | {
43 | }
44 |
45 | public override void Initialize()
46 | {
47 | GameHooks.LoadContent += GameHooks_LoadContent;
48 | GameHooks.Update += GameHooks_Update;
49 | }
50 |
51 | public override void DeInitialize()
52 | {
53 | GameHooks.LoadContent -= GameHooks_LoadContent;
54 | GameHooks.Update -= GameHooks_Update;
55 | }
56 |
57 | private void GameHooks_LoadContent(ContentManager obj)
58 | {
59 | itemForm = new ItemForm();
60 | }
61 |
62 | private void GameHooks_Update(GameTime gameTime)
63 | {
64 | if (Game.IsActive)
65 | {
66 | if (InputManager.IsKeyPressed(Keys.F9) && itemForm != null)
67 | {
68 | itemForm.Visible = !itemForm.Visible;
69 | }
70 | }
71 | }
72 | }
73 | }
--------------------------------------------------------------------------------
/TexturePlugin/TexturePlugin.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Microsoft.Xna.Framework;
3 | using Terraria;
4 | using TerrariaAPI;
5 | using TerrariaAPI.Hooks;
6 | using XNAHelpers;
7 | using Keys = Microsoft.Xna.Framework.Input.Keys;
8 |
9 | namespace TexturePlugin
10 | {
11 | [APIVersion(1, 7)]
12 | public class TexturePlugin : TerrariaPlugin
13 | {
14 | public override string Name
15 | {
16 | get { return "Texture Loader"; }
17 | }
18 |
19 | public override Version Version
20 | {
21 | get { return new Version(1, 0); }
22 | }
23 |
24 | public override string Author
25 | {
26 | get { return "High"; }
27 | }
28 |
29 | public override string Description
30 | {
31 | get { return "Allows you to reload textures from png files"; }
32 | }
33 |
34 | private TextureForm textureform;
35 |
36 | public TexturePlugin(Main game)
37 | : base(game)
38 | {
39 | }
40 |
41 | public override void Initialize()
42 | {
43 | GameHooks.Update += TerrariaHooks_Update;
44 | }
45 |
46 | public override void DeInitialize()
47 | {
48 | GameHooks.Update -= TerrariaHooks_Update;
49 | }
50 |
51 | public override void Dispose()
52 | {
53 | if (textureform != null)
54 | textureform.Dispose();
55 |
56 | base.Dispose();
57 | }
58 |
59 | private void TerrariaHooks_Update(GameTime gameTime)
60 | {
61 | if (Game.IsActive)
62 | {
63 | if (InputManager.IsKeyPressed(Keys.F8))
64 | {
65 | if (textureform == null || textureform.IsDisposed)
66 | {
67 | textureform = new TextureForm(Game.GraphicsDevice);
68 | }
69 |
70 | textureform.Show();
71 | textureform.BringToFront();
72 | }
73 | }
74 | }
75 | }
76 | }
--------------------------------------------------------------------------------
/TerrariaAPI/PacketTypes.cs:
--------------------------------------------------------------------------------
1 | namespace TerrariaAPI
2 | {
3 | // Terraria Protocol: https://spreadsheets.google.com/spreadsheet/ccc?key=0AtMbaBHfhV44dE4zYnVad05lVXFwbjczdk03QnNCWHc
4 | // Terraria Content: https://spreadsheets.google.com/spreadsheet/ccc?key=0AtMbaBHfhV44dF9DN192dnUxZFA1d0dmSVpQTFpkQnc
5 |
6 | public enum PacketTypes
7 | {
8 | ConnectRequest = 1,
9 | Disconnect = 2,
10 | ContinueConnecting = 3,
11 | PlayerInfo = 4,
12 | PlayerSlot = 5,
13 | ContinueConnecting2 = 6,
14 | WorldInfo = 7,
15 | TileGetSection = 8,
16 | Status = 9,
17 | TileSendSection = 10,
18 | TileFrameSection = 11,
19 | PlayerSpawn = 12,
20 | PlayerUpdate = 13,
21 | PlayerActive = 14,
22 | SyncPlayers = 15,
23 | PlayerHp = 16,
24 | Tile = 17,
25 | TimeSet = 18,
26 | DoorUse = 19,
27 | TileSendSquare = 20,
28 | ItemDrop = 21,
29 | ItemOwner = 22,
30 | NpcUpdate = 23,
31 | NpcItemStrike = 24,
32 | ChatText = 25,
33 | PlayerDamage = 26,
34 | ProjectileNew = 27,
35 | NpcStrike = 28,
36 | ProjectileDestroy = 29,
37 | TogglePvp = 30,
38 | ChestGetContents = 31,
39 | ChestItem = 32,
40 | ChestOpen = 33,
41 | TileKill = 34,
42 | EffectHeal = 35,
43 | Zones = 36,
44 | PasswordRequired = 37,
45 | PasswordSend = 38,
46 | ItemUnknown = 39,
47 | NpcTalk = 40,
48 | PlayerAnimation = 41,
49 | PlayerMana = 42,
50 | EffectMana = 43,
51 | PlayerKillMe = 44,
52 | PlayerTeam = 45,
53 | SignRead = 46,
54 | SignNew = 47,
55 | LiquidSet = 48,
56 | PlayerSpawnSelf = 49,
57 | PlayerBuff = 50,
58 | NpcSpecial = 51,
59 | ChestUnlock = 52,
60 | NpcAddBuff = 53,
61 | NpcUpdateBuff = 54,
62 | PlayerAddBuff = 55,
63 | }
64 |
65 | public enum TileCommand
66 | {
67 | KillTile = 0,
68 | PlaceTile = 1,
69 | KillWall = 2,
70 | PlaceWall = 3,
71 | KillTileNoItem = 4
72 | }
73 | }
--------------------------------------------------------------------------------
/XNAHelpers/FrameRateCounter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Microsoft.Xna.Framework;
3 | using Microsoft.Xna.Framework.Graphics;
4 |
5 | namespace XNAHelpers
6 | {
7 | public class FrameRateCounter : DrawableGameComponent
8 | {
9 | public int CurrentFrameRate { get; private set; }
10 | public Vector2 Position { get; set; }
11 | public Color Color { get; set; }
12 | public Vector2 ShadowPosition { get; set; }
13 | public Color ShadowColor { get; set; }
14 |
15 | private SpriteBatch spriteBatch;
16 | private SpriteFont spriteFont;
17 | private int frameCounter = 0;
18 | private TimeSpan elapsedTime = TimeSpan.Zero;
19 | private readonly TimeSpan oneSecond = TimeSpan.FromSeconds(1);
20 |
21 | public FrameRateCounter(Game game, Vector2 position, Color color, Color shadowColor)
22 | : base(game)
23 | {
24 | Position = position;
25 | ShadowPosition = new Vector2(Position.X + 1, Position.Y + 1);
26 | Color = color;
27 | ShadowColor = shadowColor;
28 | }
29 |
30 | public void LoadFont(SpriteFont font)
31 | {
32 | spriteFont = font;
33 | }
34 |
35 | protected override void LoadContent()
36 | {
37 | spriteBatch = new SpriteBatch(GraphicsDevice);
38 | }
39 |
40 | public override void Update(GameTime gameTime)
41 | {
42 | elapsedTime += gameTime.ElapsedGameTime;
43 |
44 | if (elapsedTime > oneSecond)
45 | {
46 | elapsedTime -= oneSecond;
47 | CurrentFrameRate = frameCounter;
48 | frameCounter = 0;
49 | }
50 | }
51 |
52 | public override void Draw(GameTime gameTime)
53 | {
54 | frameCounter++;
55 |
56 | if (spriteFont != null)
57 | {
58 | string text = "FPS: " + CurrentFrameRate;
59 |
60 | spriteBatch.Begin();
61 | spriteBatch.DrawString(spriteFont, text, ShadowPosition, ShadowColor);
62 | spriteBatch.DrawString(spriteFont, text, Position, Color);
63 | spriteBatch.End();
64 | }
65 | }
66 | }
67 | }
--------------------------------------------------------------------------------
/TerrariaAPI/TerrariaPlugin.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Terraria;
3 |
4 | namespace TerrariaAPI
5 | {
6 | public abstract class TerrariaPlugin : IDisposable
7 | {
8 | public virtual string Name
9 | {
10 | get { return "None"; }
11 | }
12 | public virtual Version Version
13 | {
14 | get { return new Version(1, 0); }
15 | }
16 | public virtual string Author
17 | {
18 | get { return "None"; }
19 | }
20 | public virtual string Description
21 | {
22 | get { return "None"; }
23 | }
24 |
25 | public bool Enabled { get; set; }
26 |
27 | ///
28 | /// Order of when the plugin will be initialized.
29 | /// 0 = First
30 | /// 1 = Second
31 | /// ...
32 | ///
33 | public int Order { get; set; }
34 |
35 | ///
36 | /// Terraria.Main instance
37 | ///
38 | protected Main Game { get; private set; }
39 |
40 | protected TerrariaPlugin(Main game)
41 | {
42 | Order = 1;
43 | Game = game;
44 | }
45 |
46 | public virtual void Dispose()
47 | {
48 | }
49 |
50 | ///
51 | /// Called when the plugin is initialized
52 | ///
53 | public abstract void Initialize();
54 |
55 | ///
56 | /// Called when the plugin is DeInitialized
57 | ///
58 | public abstract void DeInitialize();
59 | }
60 |
61 | ///
62 | /// Version(Major, Minor) of the API the plugin was built for.
63 | /// If major/minor do not match then the plugin will not load.
64 | /// This is to prevent exceptionless crashes when the hooks change.
65 | ///
66 | [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)]
67 | public class APIVersionAttribute : Attribute
68 | {
69 | public Version ApiVersion;
70 |
71 | public APIVersionAttribute(Version version)
72 | {
73 | ApiVersion = version;
74 | }
75 |
76 | public APIVersionAttribute(int major, int minor)
77 | : this(new Version(major, minor))
78 | {
79 | }
80 | }
81 | }
--------------------------------------------------------------------------------
/TerrariaAPI/Hooks/NpcHooks.cs:
--------------------------------------------------------------------------------
1 | using System.ComponentModel;
2 | using Terraria;
3 |
4 | namespace TerrariaAPI.Hooks
5 | {
6 | public static class NpcHooks
7 | {
8 | public static event SetDefaultsD SetDefaultsInt;
9 | public static event SetDefaultsD SetDefaultsString;
10 |
11 | public static void OnSetDefaultsInt(ref int npctype, NPC npc)
12 | {
13 | if (SetDefaultsInt == null)
14 | return;
15 |
16 | var args = new SetDefaultsEventArgs()
17 | {
18 | Object = npc,
19 | Info = npctype,
20 | };
21 |
22 | SetDefaultsInt(args);
23 |
24 | npctype = args.Info;
25 | }
26 |
27 | public static void OnSetDefaultsString(ref string npcname, NPC npc)
28 | {
29 | if (SetDefaultsString == null)
30 | return;
31 | var args = new SetDefaultsEventArgs()
32 | {
33 | Object = npc,
34 | Info = npcname,
35 | };
36 |
37 | SetDefaultsString(args);
38 |
39 | npcname = args.Info;
40 | }
41 |
42 | public delegate void StrikeNpcD(NpcStrikeEventArgs e);
43 | public static event StrikeNpcD StrikeNpc;
44 |
45 | public static bool OnStrikeNpc(NPC npc, ref int damage, ref float knockback, ref int hitdirection, ref double retdamage)
46 | {
47 | if (StrikeNpc == null)
48 | return false;
49 |
50 | var args = new NpcStrikeEventArgs()
51 | {
52 | Npc = npc,
53 | Damage = damage,
54 | KnockBack = knockback,
55 | HitDirection = hitdirection,
56 | ReturnDamage = 0,
57 | };
58 |
59 | StrikeNpc(args);
60 |
61 | retdamage = args.ReturnDamage;
62 | damage = args.Damage;
63 | knockback = args.KnockBack;
64 | hitdirection = args.HitDirection;
65 |
66 | return args.Handled;
67 | }
68 | }
69 |
70 | public class NpcStrikeEventArgs : HandledEventArgs
71 | {
72 | public NPC Npc { get; set; }
73 |
74 | public int Damage { get; set; }
75 |
76 | public float KnockBack { get; set; }
77 |
78 | public int HitDirection { get; set; }
79 |
80 | public double ReturnDamage { get; set; }
81 | }
82 | }
--------------------------------------------------------------------------------
/MinimapPlugin/MinimapForm.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace MinimapPlugin
2 | {
3 | partial class MinimapForm
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.pgSettings = new System.Windows.Forms.PropertyGrid();
32 | this.SuspendLayout();
33 | //
34 | // pgSettings
35 | //
36 | this.pgSettings.Dock = System.Windows.Forms.DockStyle.Fill;
37 | this.pgSettings.Location = new System.Drawing.Point(0, 0);
38 | this.pgSettings.Name = "pgSettings";
39 | this.pgSettings.PropertySort = System.Windows.Forms.PropertySort.NoSort;
40 | this.pgSettings.Size = new System.Drawing.Size(335, 309);
41 | this.pgSettings.TabIndex = 0;
42 | this.pgSettings.ToolbarVisible = false;
43 | this.pgSettings.PropertyValueChanged += new System.Windows.Forms.PropertyValueChangedEventHandler(this.pgSettings_PropertyValueChanged);
44 | //
45 | // MinimapForm
46 | //
47 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
48 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
49 | this.ClientSize = new System.Drawing.Size(335, 309);
50 | this.Controls.Add(this.pgSettings);
51 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
52 | this.Name = "MinimapForm";
53 | this.Text = "Terraria minimap settings";
54 | this.TopMost = true;
55 | this.ResumeLayout(false);
56 |
57 | }
58 |
59 | #endregion
60 |
61 | private System.Windows.Forms.PropertyGrid pgSettings;
62 | }
63 | }
--------------------------------------------------------------------------------
/TerrariaAPI/Hooks/ClientHooks.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.ComponentModel;
3 | using System.Text;
4 | using Microsoft.Xna.Framework;
5 | using Terraria;
6 |
7 | namespace TerrariaAPI.Hooks
8 | {
9 | public static class ClientHooks
10 | {
11 | static ClientHooks()
12 | {
13 | NetHooks.GetData += NetHooks_GetData;
14 | NetHooks.SendData += NetHooks_SendData;
15 | }
16 |
17 | private static void NetHooks_GetData(GetDataEventArgs e)
18 | {
19 | if (Main.netMode != 2 && e.MsgID == PacketTypes.ChatText && e.Length > 3)
20 | {
21 | byte playerID = e.Msg.readBuffer[e.Index];
22 | Color color = new Color(e.Msg.readBuffer[e.Index + 1] << 16, e.Msg.readBuffer[e.Index + 2] << 8, e.Msg.readBuffer[e.Index + 3]);
23 | string message = Encoding.ASCII.GetString(e.Msg.readBuffer, e.Index + 4, e.Length - 5);
24 | OnChatReceived(playerID, color, message);
25 | }
26 | }
27 |
28 | public delegate void ChatReceivedEventHandler(byte playerID, Color color, string message);
29 | public static event ChatReceivedEventHandler ChatReceived;
30 |
31 | public static void OnChatReceived(byte playerID, Color color, string message)
32 | {
33 | #if CLIENT
34 | // 255 = Server
35 | if (playerID == 255)
36 | {
37 | Console.WriteLine(" {0}", message);
38 | }
39 | else if (Main.player[playerID].active)
40 | {
41 | Console.WriteLine("<{0}> {1}", Main.player[playerID].name, message);
42 | }
43 | #endif
44 |
45 | if (ChatReceived != null)
46 | {
47 | ChatReceived(playerID, color, message);
48 | }
49 | }
50 |
51 | private static void NetHooks_SendData(SendDataEventArgs e)
52 | {
53 | if (Main.netMode != 2 && e.MsgID == PacketTypes.ChatText)
54 | {
55 | string msg = e.text;
56 | e.Handled = OnChat(ref msg);
57 | e.text = msg;
58 | }
59 | }
60 |
61 | public delegate void OnChatD(ref string msg, HandledEventArgs e);
62 | public static event OnChatD Chat;
63 |
64 | public static bool OnChat(ref string msg)
65 | {
66 | if (Chat != null)
67 | {
68 | HandledEventArgs args = new HandledEventArgs();
69 | Chat(ref msg, args);
70 | return args.Handled;
71 | }
72 |
73 | return false;
74 | }
75 | }
76 | }
--------------------------------------------------------------------------------
/XNAHelpers/MathHelpers.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Microsoft.Xna.Framework;
3 |
4 | namespace XNAHelpers
5 | {
6 | public static class MathHelpers
7 | {
8 | public const float RadianPI = 57.29578f; // 180.0 / Math.PI
9 | public const float DegreePI = 0.01745329f; // Math.PI / 180.0
10 | public const float TwoPI = 6.28319f; // Math.PI * 2
11 |
12 | public static Random Random = new Random();
13 |
14 | public static float RadianToDegree(float radian)
15 | {
16 | return radian * RadianPI;
17 | }
18 |
19 | public static float DegreeToRadian(float degree)
20 | {
21 | return degree * DegreePI;
22 | }
23 |
24 | public static Vector2 RadianToVector2(float radian)
25 | {
26 | return new Vector2((float)Math.Cos(radian), (float)Math.Sin(radian));
27 | }
28 |
29 | public static Vector2 RadianToVector2(float radian, float length)
30 | {
31 | return RadianToVector2(radian) * length;
32 | }
33 |
34 | public static Vector2 DegreeToVector2(float degree)
35 | {
36 | return RadianToVector2(DegreeToRadian(degree));
37 | }
38 |
39 | public static Vector2 DegreeToVector22(float degree)
40 | {
41 | return RadianToVector2(DegreeToRadian(degree));
42 | }
43 |
44 | public static Vector2 DegreeToVector2(float degree, float length)
45 | {
46 | return RadianToVector2(DegreeToRadian(degree), length);
47 | }
48 |
49 | public static float Vector2ToRadian(Vector2 direction)
50 | {
51 | return (float)Math.Atan2(direction.Y, direction.X);
52 | }
53 |
54 | public static float Vector2ToDegree(Vector2 direction)
55 | {
56 | return RadianToDegree(Vector2ToRadian(direction));
57 | }
58 |
59 | public static float LookAtRadian(Vector2 fromPosition, Vector2 toPosition)
60 | {
61 | return (float)Math.Atan2(toPosition.Y - fromPosition.Y, toPosition.X - fromPosition.X);
62 | }
63 |
64 | public static Vector2 LookAtVector2(Vector2 fromPosition, Vector2 toPosition)
65 | {
66 | return RadianToVector2(LookAtRadian(fromPosition, toPosition));
67 | }
68 |
69 | public static float TwoVector2Distance(Vector2 fromPosition, Vector2 toPosition)
70 | {
71 | return (float)Math.Sqrt(Math.Pow(toPosition.X - fromPosition.X, 2) + Math.Pow(toPosition.Y - fromPosition.Y, 2));
72 | }
73 |
74 | public static float Lerp(float value1, float value2, float amount)
75 | {
76 | return value1 + (value2 - value1) * amount;
77 | }
78 |
79 | public static Vector2 RandomPointOnCircle(Vector2 pos, float radius)
80 | {
81 | return pos + RadianToVector2(Random.NextAngle(), radius);
82 | }
83 | }
84 | }
--------------------------------------------------------------------------------
/MinimapPlugin/Enums.cs:
--------------------------------------------------------------------------------
1 | namespace MinimapPlugin
2 | {
3 | public enum MinimapPosition
4 | {
5 | LeftBottom,
6 | RightBottom
7 | }
8 |
9 | public enum TileType
10 | {
11 | Dirt = 0,
12 | Stone,
13 | Grass,
14 | Plants,
15 | Torches,
16 | Trees,
17 | Iron,
18 | Copper,
19 | Gold,
20 | Silver,
21 | Door1,
22 | Door2,
23 | Heart,
24 | Bottles,
25 | Table,
26 | Chair,
27 | Anvil,
28 | Furnance,
29 | CraftingTable,
30 | WoodenPlatform,
31 | PlantsDecorative,
32 | Chest,
33 | CorruptionStone1,
34 | CorruptionGrass,
35 | CorruptionPlants,
36 | CorruptionStone2,
37 | Altar,
38 | Sunflower,
39 | Pot,
40 | PiggyBank,
41 | BlockWood,
42 | ShadowOrb,
43 | CorruptionVines,
44 | Candle,
45 | ChandlerCopper,
46 | ChandlerSilver,
47 | ChandlerGold,
48 | Meterorite,
49 | BlockStone,
50 | BlockRedStone,
51 | Clay,
52 | BlockBlueStone,
53 | LightGlobe,
54 | BlockGreenStone,
55 | BlockPinkStone,
56 | BlockGold,
57 | BlockSilver,
58 | BlockCopper,
59 | Spikes,
60 | CandleBlue,
61 | Books,
62 | Web,
63 | Vines,
64 | Sand,
65 | Glass,
66 | Signs,
67 | Obsidian,
68 | Ash,
69 | Hellstone,
70 | Mud,
71 | UndergroundJungleGrass,
72 | UndergroundJunglePlants,
73 | UndergroundJungleVines,
74 | Sapphire,
75 | Ruby,
76 | Emerald,
77 | Topaz,
78 | Amethyst,
79 | Diamond,
80 | UndergroundJungleThorns,
81 | UndergroundMushroomGrass,
82 | UndergroundMushroomPlants,
83 | UndergroundMushroomTrees,
84 | Plants2,
85 | Plants3,
86 | BlockObsidian,
87 | BlockHellstone,
88 | UnderworldFurnance,
89 | DecorativePot,
90 | Bed,
91 | Cactus,
92 | Coral,
93 | HerbSprout,
94 | HerbStalk,
95 | Herb,
96 | Tombstone,
97 | Unknown = 86
98 | }
99 |
100 | public enum WallType
101 | {
102 | Sky = TerrariaColors.WallOffset,
103 | WallStone,
104 | WallDirt,
105 | WallCorruption,
106 | WallWood,
107 | WallBrick,
108 | WallRed,
109 | WallBlue,
110 | WallGreen,
111 | WallPink,
112 | WallGold,
113 | WallSilver,
114 | WallCopper,
115 | WallHellstone,
116 | WallUnknown
117 | }
118 |
119 | public enum LiquidType
120 | {
121 | Water = TerrariaColors.LiquidOffset,
122 | Lava
123 | }
124 | }
--------------------------------------------------------------------------------
/MinimapPlugin/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.1
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace MinimapPlugin.Properties {
12 | using System;
13 |
14 |
15 | ///
16 | /// A strongly-typed resource class, for looking up localized strings, etc.
17 | ///
18 | // This class was auto-generated by the StronglyTypedResourceBuilder
19 | // class via a tool like ResGen or Visual Studio.
20 | // To add or remove a member, edit your .ResX file then rerun ResGen
21 | // with the /str option, or rebuild your VS project.
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources {
26 |
27 | private static global::System.Resources.ResourceManager resourceMan;
28 |
29 | private static global::System.Globalization.CultureInfo resourceCulture;
30 |
31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
32 | internal Resources() {
33 | }
34 |
35 | ///
36 | /// Returns the cached ResourceManager instance used by this class.
37 | ///
38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
39 | internal static global::System.Resources.ResourceManager ResourceManager {
40 | get {
41 | if (object.ReferenceEquals(resourceMan, null)) {
42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("MinimapPlugin.Properties.Resources", typeof(Resources).Assembly);
43 | resourceMan = temp;
44 | }
45 | return resourceMan;
46 | }
47 | }
48 |
49 | ///
50 | /// Overrides the current thread's CurrentUICulture property for all
51 | /// resource lookups using this strongly typed resource class.
52 | ///
53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
54 | internal static global::System.Globalization.CultureInfo Culture {
55 | get {
56 | return resourceCulture;
57 | }
58 | set {
59 | resourceCulture = value;
60 | }
61 | }
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/TrainerPlugin/TrainerForm.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace TrainerPlugin
2 | {
3 | partial class TrainerForm
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.pgTrainer = new System.Windows.Forms.PropertyGrid();
32 | this.SuspendLayout();
33 | //
34 | // pgTrainer
35 | //
36 | this.pgTrainer.CommandsActiveLinkColor = System.Drawing.SystemColors.ActiveCaption;
37 | this.pgTrainer.CommandsDisabledLinkColor = System.Drawing.SystemColors.ControlDark;
38 | this.pgTrainer.CommandsLinkColor = System.Drawing.SystemColors.ActiveCaption;
39 | this.pgTrainer.Dock = System.Windows.Forms.DockStyle.Fill;
40 | this.pgTrainer.Location = new System.Drawing.Point(0, 0);
41 | this.pgTrainer.Name = "pgTrainer";
42 | this.pgTrainer.PropertySort = System.Windows.Forms.PropertySort.Categorized;
43 | this.pgTrainer.Size = new System.Drawing.Size(309, 562);
44 | this.pgTrainer.TabIndex = 0;
45 | this.pgTrainer.ToolbarVisible = false;
46 | this.pgTrainer.PropertyValueChanged += new System.Windows.Forms.PropertyValueChangedEventHandler(this.pgTrainer_PropertyValueChanged);
47 | //
48 | // TrainerForm
49 | //
50 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
51 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
52 | this.ClientSize = new System.Drawing.Size(309, 562);
53 | this.Controls.Add(this.pgTrainer);
54 | this.MaximizeBox = false;
55 | this.Name = "TrainerForm";
56 | this.ShowIcon = false;
57 | this.Text = "Terraria Trainer";
58 | this.TopMost = true;
59 | this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.TrainerForm_FormClosing);
60 | this.Shown += new System.EventHandler(this.TrainerForm_Shown);
61 | this.ResumeLayout(false);
62 |
63 | }
64 |
65 | #endregion
66 |
67 | private System.Windows.Forms.PropertyGrid pgTrainer;
68 |
69 | }
70 | }
--------------------------------------------------------------------------------
/ResolutionPlugin/ResolutionPlugin.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Drawing;
3 | using System.Linq;
4 | using System.Text.RegularExpressions;
5 | using System.Windows.Forms;
6 | using Terraria;
7 | using TerrariaAPI;
8 | using TerrariaAPI.Hooks;
9 |
10 | namespace ResolutionPlugin
11 | {
12 | ///
13 | /// Commands: fs, fullscreen, auto, w, width, x, h, height, y, skip, skipintro, fps
14 | ///
15 | [APIVersion(1, 7)]
16 | public class ResolutionPlugin : TerrariaPlugin
17 | {
18 | public override string Name
19 | {
20 | get { return "Resolution"; }
21 | }
22 |
23 | public override Version Version
24 | {
25 | get { return new Version(2, 0); }
26 | }
27 |
28 | public override string Author
29 | {
30 | get { return "High / Jaex"; }
31 | }
32 |
33 | public override string Description
34 | {
35 | get { return "Lets you set Terraria's resolution"; }
36 | }
37 |
38 | public ResolutionPlugin(Main game)
39 | : base(game)
40 | {
41 | }
42 |
43 | public override void Initialize()
44 | {
45 | GameHooks.Initialize += GameHooks_OnPreInitialize;
46 | }
47 |
48 | public override void DeInitialize()
49 | {
50 | GameHooks.Initialize -= GameHooks_OnPreInitialize;
51 | }
52 |
53 | private void GameHooks_OnPreInitialize()
54 | {
55 | string cmd = Environment.CommandLine;
56 |
57 | if (CheckCommand(cmd, "fs", "fullscreen"))
58 | {
59 | Game.graphics.IsFullScreen = true;
60 | }
61 |
62 | if (CheckCommand(cmd, "auto"))
63 | {
64 | Size screenSize = SystemInformation.VirtualScreen.Size;
65 | Main.screenWidth = screenSize.Width;
66 | Main.screenHeight = screenSize.Height;
67 | }
68 | else
69 | {
70 | Match w = Regex.Match(cmd, @"-(?:w|width|x)\s*(\d+)", RegexOptions.Compiled | RegexOptions.CultureInvariant | RegexOptions.IgnoreCase);
71 | Match h = Regex.Match(cmd, @"-(?:h|height|y)\s*(\d+)", RegexOptions.Compiled | RegexOptions.CultureInvariant | RegexOptions.IgnoreCase);
72 |
73 | int width, height;
74 |
75 | if (w.Success && h.Success && int.TryParse(w.Groups[1].Value, out width) && int.TryParse(h.Groups[1].Value, out height))
76 | {
77 | Main.screenWidth = width;
78 | Main.screenHeight = height;
79 | }
80 | }
81 |
82 | if (CheckCommand(cmd, "skip", "skipintro"))
83 | {
84 | Main.showSplash = false;
85 | }
86 |
87 | if (CheckCommand(cmd, "fps"))
88 | {
89 | Main.showFrameRate = true;
90 | }
91 | }
92 |
93 | private bool CheckCommand(string text, params string[] command)
94 | {
95 | return command.Any(x => text.IndexOf("-" + x, StringComparison.InvariantCultureIgnoreCase) >= 0);
96 | }
97 | }
98 | }
--------------------------------------------------------------------------------
/TerrariaAPI/Hooks/GameHooks.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.ComponentModel;
3 | using Microsoft.Xna.Framework;
4 | using Microsoft.Xna.Framework.Content;
5 | using Terraria;
6 |
7 | namespace TerrariaAPI.Hooks
8 | {
9 | public static class GameHooks
10 | {
11 | public static bool IsWorldRunning { get; private set; }
12 |
13 | private static bool oldGameMenu = true;
14 |
15 | static GameHooks()
16 | {
17 | GameHooks.Update += GameHooks_Update;
18 | }
19 |
20 | public static event Action Update;
21 | public static event Action PostUpdate;
22 |
23 | public static void OnUpdate(bool pre, GameTime time)
24 | {
25 | if (pre)
26 | {
27 | if (Update != null)
28 | Update(time);
29 | }
30 | else
31 | {
32 | if (PostUpdate != null)
33 | PostUpdate(time);
34 | }
35 | }
36 |
37 | public static event Action LoadContent;
38 |
39 | public static void OnLoadContent(ContentManager manager)
40 | {
41 | if (LoadContent != null)
42 | LoadContent(manager);
43 | }
44 |
45 | public static event Action Initialize;
46 | public static event Action PostInitialize;
47 |
48 | public static void OnInitialize(bool pre)
49 | {
50 | if (pre)
51 | {
52 | if (Initialize != null)
53 | Initialize();
54 | }
55 | else
56 | {
57 | if (PostInitialize != null)
58 | PostInitialize();
59 | }
60 | }
61 |
62 | private static void GameHooks_Update(GameTime obj)
63 | {
64 | // Ugly workaround but it works
65 | if (oldGameMenu != Main.gameMenu)
66 | {
67 | oldGameMenu = Main.gameMenu;
68 |
69 | if (Main.gameMenu)
70 | {
71 | OnWorldDisconnect();
72 | }
73 | else
74 | {
75 | OnWorldConnect();
76 | }
77 |
78 | IsWorldRunning = !Main.gameMenu;
79 | }
80 | }
81 |
82 | public static event Action WorldConnect;
83 |
84 | public static void OnWorldConnect()
85 | {
86 | if (WorldConnect != null)
87 | WorldConnect();
88 | }
89 |
90 | public static event Action WorldDisconnect;
91 |
92 | public static void OnWorldDisconnect()
93 | {
94 | if (WorldDisconnect != null)
95 | WorldDisconnect();
96 | }
97 |
98 | public static event Action GetKeyState;
99 |
100 | public static bool OnGetKeyState()
101 | {
102 | if (GetKeyState == null)
103 | return false;
104 |
105 | var args = new HandledEventArgs();
106 | GetKeyState(args);
107 | return args.Handled;
108 | }
109 | }
110 | }
--------------------------------------------------------------------------------
/ItemPlugin/ItemHelper.cs:
--------------------------------------------------------------------------------
1 | using Terraria;
2 | using TerrariaAPI;
3 |
4 | namespace ItemPlugin
5 | {
6 | public static class ItemHelper
7 | {
8 | private static Player me
9 | {
10 | get { return Main.player[Main.myPlayer]; }
11 | }
12 |
13 | public static Item CreateItem(string itemName, int stack = 0)
14 | {
15 | Item item = new Item();
16 | item.RealSetDefaults(itemName);
17 | if (stack > 0) item.stack = stack;
18 | return item;
19 | }
20 |
21 | public static Item GiveItem(string itemName, int stack = 0)
22 | {
23 | Item item = ItemHelper.CreateItem(itemName, stack);
24 | return me.GetItem(Main.myPlayer, item);
25 | }
26 |
27 | public static bool RemoveItem(Item item)
28 | {
29 | if (item != null && item.active)
30 | {
31 | item.active = false;
32 |
33 | for (int i = 0; i < me.inventory.Length; i++)
34 | {
35 | if (me.inventory[i] == item)
36 | {
37 | me.inventory[i] = new Item();
38 | Main.PlaySound(7, (int)me.position.X, (int)me.position.Y, 1);
39 | return true;
40 | }
41 | }
42 | }
43 |
44 | return false;
45 | }
46 |
47 | public static Item ThrowItem(string itemName, int stack = 0)
48 | {
49 | Item item = CreateItem(itemName, stack);
50 | item.position.X = me.position.X + me.width / 2f - item.width / 2f;
51 | item.position.Y = me.position.Y + me.height / 2f - item.height / 2f;
52 | item.wet = Collision.WetCollision(item.position, item.width, item.height);
53 | item.velocity.Y = -2f;
54 | item.velocity.X = 4f * me.direction + me.velocity.X;
55 | item.spawnTime = 0;
56 |
57 | if (Main.netMode == 0)
58 | {
59 | item.owner = Main.myPlayer;
60 | item.noGrabDelay = 100;
61 | }
62 |
63 | int num = 200;
64 | Main.item[num] = new Item();
65 |
66 | if (Main.netMode != 1)
67 | {
68 | for (int i = 0; i < 200; i++)
69 | {
70 | if (!Main.item[i].active)
71 | {
72 | num = i;
73 | break;
74 | }
75 | }
76 | }
77 |
78 | if (num == 200 && Main.netMode != 1)
79 | {
80 | int num2 = 0;
81 |
82 | for (int j = 0; j < 200; j++)
83 | {
84 | if (Main.item[j].spawnTime > num2)
85 | {
86 | num2 = Main.item[j].spawnTime;
87 | num = j;
88 | }
89 | }
90 | }
91 |
92 | Main.item[num] = item;
93 |
94 | if (Main.netMode == 1)
95 | {
96 | NetMessage.SendData((int)PacketTypes.ItemDrop, -1, -1, "", num, 0f, 0f, 0f);
97 | }
98 |
99 | return item;
100 | }
101 | }
102 | }
--------------------------------------------------------------------------------
/ItemPlugin/ItemManager.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Drawing;
3 | using System.Windows.Forms;
4 | using Microsoft.Xna.Framework.Graphics;
5 | using Terraria;
6 | using XNAHelpers;
7 | using Color = Microsoft.Xna.Framework.Color;
8 |
9 | namespace ItemPlugin
10 | {
11 | public class ItemManager
12 | {
13 | public List Items { get; private set; }
14 |
15 | private ListView lv;
16 | private ImageList il;
17 | private int itemCount;
18 |
19 | public ItemManager(ListView listView)
20 | {
21 | lv = listView;
22 | il = new ImageList();
23 | il.ImageSize = new Size(32, 32);
24 | il.ColorDepth = ColorDepth.Depth32Bit;
25 | lv.SmallImageList = il;
26 |
27 | itemCount = Main.itemTexture.Length;
28 | Items = new List();
29 |
30 | Prepare();
31 | }
32 |
33 | private void Prepare()
34 | {
35 | AddItem("Copper Pickaxe");
36 | AddItem("Copper Broadsword");
37 | AddItem("Copper Shortsword");
38 | AddItem("Copper Axe");
39 | AddItem("Copper Hammer");
40 | AddItem("Copper Bow");
41 |
42 | for (int type = 0; type < itemCount; type++)
43 | {
44 | AddItem(type);
45 | }
46 |
47 | AddItem("Silver Pickaxe");
48 | AddItem("Silver Broadsword");
49 | AddItem("Silver Shortsword");
50 | AddItem("Silver Axe");
51 | AddItem("Silver Hammer");
52 | AddItem("Silver Bow");
53 | AddItem("Gold Pickaxe");
54 | AddItem("Gold Broadsword");
55 | AddItem("Gold Shortsword");
56 | AddItem("Gold Axe");
57 | AddItem("Gold Hammer");
58 | AddItem("Gold Bow");
59 | }
60 |
61 | private void AddItem(int type)
62 | {
63 | Item item = new Item();
64 | item.RealSetDefaults(type, true);
65 | AddItem(item);
66 | }
67 |
68 | private void AddItem(string name)
69 | {
70 | Item item = new Item();
71 | item.RealSetDefaults(name);
72 | AddItem(item);
73 | }
74 |
75 | private void AddItem(Item item)
76 | {
77 | if (!string.IsNullOrEmpty(item.name))
78 | {
79 | ItemType itemType = new ItemType(item.type, item.name, item.color);
80 | Items.Add(itemType);
81 | LoadIcon(itemType);
82 | }
83 | }
84 |
85 | private void LoadIcon(ItemType itemType)
86 | {
87 | if (itemType != null && !string.IsNullOrEmpty(itemType.Name))
88 | {
89 | Image img;
90 | Texture2D texture = Main.itemTexture[itemType.ID];
91 | img = DrawingHelper.TextureToImage(texture);
92 |
93 | if (itemType.Color != default(Color))
94 | {
95 | img = DrawingHelper.ColorizeImage(img, itemType.Color);
96 | }
97 |
98 | img = DrawingHelper.ResizeImage(img, 32, 32);
99 | il.Images.Add(itemType.Name, img);
100 | }
101 | }
102 | }
103 | }
--------------------------------------------------------------------------------
/TempPlugin/TempPlugin.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Debug
5 | AnyCPU
6 | 8.0.30703
7 | 2.0
8 | {C37B846D-6B4E-4819-8C2F-A39DBEB3FCC7}
9 | Library
10 | Properties
11 | TempPlugin
12 | TempPlugin
13 | v4.0
14 | 512
15 |
16 |
17 | true
18 | full
19 | false
20 | bin\debug\
21 | DEBUG;TRACE
22 | prompt
23 | 4
24 |
25 |
26 | pdbonly
27 | true
28 | bin\Release\
29 | TRACE
30 | prompt
31 | 4
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 | ..\Terraria\Terraria.exe
48 | False
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 | {6D26750B-AAAA-48E8-9457-917F9F6F8D94}
57 | TerrariaAPI
58 | False
59 |
60 |
61 |
62 |
69 |
--------------------------------------------------------------------------------
/TexturePlugin/TextureForm.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Threading;
5 | using System.Windows.Forms;
6 | using Microsoft.Xna.Framework.Graphics;
7 |
8 | namespace TexturePlugin
9 | {
10 | partial class TextureForm : Form
11 | {
12 | static readonly string ImgPath = "textures";
13 | GraphicsDevice Device;
14 |
15 | public TextureForm(GraphicsDevice device)
16 | {
17 | Device = device;
18 | InitializeComponent();
19 | }
20 |
21 | Thread loadthread = null;
22 |
23 | private void loadfunc(object obj)
24 | {
25 | var prov = (IFileProvider)obj;
26 | SetText("Loading images");
27 | var texts = ContentLoader.GetTextures(Device, prov);
28 | SetText("Replacing textures");
29 | ContentLoader.Load(texts);
30 | SetText("Done");
31 | loadthread = null;
32 | }
33 |
34 | private void LoadBtn_Click(object sender, EventArgs e)
35 | {
36 | if (loadthread != null)
37 | return;
38 |
39 | var name = (string)TextureList.SelectedItem;
40 | IFileProvider prov;
41 | if (Directory.Exists(Path.Combine(ImgPath, name)))
42 | {
43 | prov = new DirProvider(new DirectoryInfo(Path.Combine(ImgPath, name)));
44 | }
45 | else if (File.Exists(Path.Combine(ImgPath, name + ".zip")))
46 | {
47 | prov = new ZipProvider(new FileStream(Path.Combine(ImgPath, name + ".zip"), FileMode.Open, FileAccess.Read));
48 | }
49 | else
50 | {
51 | SetText("Not found");
52 | return;
53 | }
54 |
55 | loadthread = new Thread(loadfunc);
56 | loadthread.Start(prov);
57 | }
58 |
59 | private void SetText(string text)
60 | {
61 | if (this.InvokeRequired)
62 | this.Invoke(new Action(SetText), text);
63 | else
64 | this.Text = text;
65 | }
66 |
67 | private void RefreshBtn_Click(object sender, EventArgs e)
68 | {
69 | TextureList.Items.Clear();
70 |
71 | if (!Directory.Exists(ImgPath))
72 | {
73 | Directory.CreateDirectory(ImgPath);
74 | return;
75 | }
76 |
77 | var di = new DirectoryInfo(ImgPath);
78 | var texts = new List();
79 | foreach (var d in di.GetDirectories())
80 | {
81 | if (!texts.Contains(d.Name))
82 | texts.Add(d.Name);
83 | }
84 | foreach (var f in di.GetFiles("*.zip"))
85 | {
86 | var name = Path.GetFileNameWithoutExtension(f.Name);
87 | if (!texts.Contains(name))
88 | texts.Add(name);
89 | }
90 |
91 | foreach (var s in texts)
92 | TextureList.Items.Add(s);
93 | }
94 |
95 | private void TextureForm_FormClosing(object sender, FormClosingEventArgs e)
96 | {
97 | e.Cancel = true;
98 | this.Visible = false;
99 | }
100 | }
101 | }
--------------------------------------------------------------------------------
/TerrariaPatcher/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.225
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace TerrariaPatcher.Properties {
12 | using System;
13 |
14 |
15 | ///
16 | /// A strongly-typed resource class, for looking up localized strings, etc.
17 | ///
18 | // This class was auto-generated by the StronglyTypedResourceBuilder
19 | // class via a tool like ResGen or Visual Studio.
20 | // To add or remove a member, edit your .ResX file then rerun ResGen
21 | // with the /str option, or rebuild your VS project.
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources {
26 |
27 | private static global::System.Resources.ResourceManager resourceMan;
28 |
29 | private static global::System.Globalization.CultureInfo resourceCulture;
30 |
31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
32 | internal Resources() {
33 | }
34 |
35 | ///
36 | /// Returns the cached ResourceManager instance used by this class.
37 | ///
38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
39 | internal static global::System.Resources.ResourceManager ResourceManager {
40 | get {
41 | if (object.ReferenceEquals(resourceMan, null)) {
42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("TerrariaPatcher.Properties.Resources", typeof(Resources).Assembly);
43 | resourceMan = temp;
44 | }
45 | return resourceMan;
46 | }
47 | }
48 |
49 | ///
50 | /// Overrides the current thread's CurrentUICulture property for all
51 | /// resource lookups using this strongly typed resource class.
52 | ///
53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
54 | internal static global::System.Globalization.CultureInfo Culture {
55 | get {
56 | return resourceCulture;
57 | }
58 | set {
59 | resourceCulture = value;
60 | }
61 | }
62 |
63 | internal static byte[] ildasm {
64 | get {
65 | object obj = ResourceManager.GetObject("ildasm", resourceCulture);
66 | return ((byte[])(obj));
67 | }
68 | }
69 |
70 | internal static byte[] IlDasmrc {
71 | get {
72 | object obj = ResourceManager.GetObject("IlDasmrc", resourceCulture);
73 | return ((byte[])(obj));
74 | }
75 | }
76 |
77 | internal static byte[] patch {
78 | get {
79 | object obj = ResourceManager.GetObject("patch", resourceCulture);
80 | return ((byte[])(obj));
81 | }
82 | }
83 | }
84 | }
85 |
--------------------------------------------------------------------------------
/TeleportPlugin/TeleportForm.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows.Forms;
3 |
4 | namespace TeleportPlugin
5 | {
6 | public partial class TeleportForm : Form
7 | {
8 | private TeleportHelper helper;
9 |
10 | public TeleportForm(TeleportHelper teleportHelper)
11 | {
12 | helper = teleportHelper;
13 | InitializeComponent();
14 |
15 | UpdateAll();
16 | }
17 |
18 | public void UpdateAll()
19 | {
20 | UpdateInfoText();
21 | UpdateLocationList();
22 | UpdatePlayerList();
23 | }
24 |
25 | public void UpdateInfoText()
26 | {
27 | if (helper.ShowInfoText)
28 | {
29 | btnShowInfo.Text = "Hide position/depth/players";
30 | }
31 | else
32 | {
33 | btnShowInfo.Text = "Show position/depth/players";
34 | }
35 | }
36 |
37 | public void UpdateLocationList()
38 | {
39 | lvLocations.Items.Clear();
40 |
41 | foreach (TeleportLocation location in helper.GetCurrentWorldLocations())
42 | {
43 | ListViewItem lvi = new ListViewItem(location.Name);
44 | lvi.Tag = location;
45 | lvLocations.Items.Add(lvi);
46 | }
47 | }
48 |
49 | public void UpdatePlayerList()
50 | {
51 | lvPlayers.Items.Clear();
52 |
53 | foreach (string playerName in helper.GetPlayerList())
54 | {
55 | lvPlayers.Items.Add(playerName);
56 | }
57 | }
58 |
59 | private void btnShowInfo_Click(object sender, EventArgs e)
60 | {
61 | helper.ShowInfoText = !helper.ShowInfoText;
62 | UpdateInfoText();
63 | }
64 |
65 | private void btnTeleportHome_Click(object sender, EventArgs e)
66 | {
67 | helper.TeleportToHome();
68 | }
69 |
70 | private void btnTeleportLocation_Click(object sender, EventArgs e)
71 | {
72 | if (lvLocations.SelectedItems.Count > 0)
73 | {
74 | TeleportLocation location = lvLocations.SelectedItems[0].Tag as TeleportLocation;
75 | helper.TeleportToLocation(location);
76 | }
77 | }
78 |
79 | private void btnAddLocation_Click(object sender, EventArgs e)
80 | {
81 | using (TeleportLocationForm locationForm = new TeleportLocationForm())
82 | {
83 | if (locationForm.ShowDialog() == DialogResult.OK && !string.IsNullOrEmpty(locationForm.LocationName))
84 | {
85 | helper.AddCurrentLocation(locationForm.LocationName);
86 | UpdateLocationList();
87 | }
88 | }
89 | }
90 |
91 | private void btnRemoveLocation_Click(object sender, EventArgs e)
92 | {
93 | if (lvLocations.SelectedItems.Count > 0)
94 | {
95 | TeleportLocation location = lvLocations.SelectedItems[0].Tag as TeleportLocation;
96 | lvLocations.Items.Remove(lvLocations.SelectedItems[0]);
97 | helper.Locations.Remove(location);
98 | }
99 | }
100 |
101 | private void btnTeleportPlayer_Click(object sender, EventArgs e)
102 | {
103 | if (lvPlayers.SelectedItems.Count > 0)
104 | {
105 | string name = lvPlayers.SelectedItems[0].Text;
106 | helper.TeleportToPlayer(name);
107 | }
108 | }
109 |
110 | private void btnRefresh_Click(object sender, EventArgs e)
111 | {
112 | UpdatePlayerList();
113 | }
114 | }
115 | }
--------------------------------------------------------------------------------
/XNAHelpers/SteamExtensions.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 | using System.Runtime.InteropServices;
4 |
5 | namespace XNAHelpers
6 | {
7 | public static class StreamExtensions
8 | {
9 | private const int DefaultBufferSize = 4096;
10 |
11 | public static void CopyStreamTo(this Stream fromStream, Stream toStream, int bufferSize = DefaultBufferSize)
12 | {
13 | fromStream.Position = 0;
14 |
15 | byte[] buffer = new byte[bufferSize];
16 | int bytesRead;
17 |
18 | while ((bytesRead = fromStream.Read(buffer, 0, buffer.Length)) > 0)
19 | {
20 | toStream.Write(buffer, 0, bytesRead);
21 | }
22 | }
23 |
24 | public static int CopyStreamTo(this Stream fromStream, Stream toStream, int offset, int length, int bufferSize = DefaultBufferSize)
25 | {
26 | fromStream.Position = offset;
27 |
28 | byte[] buffer = new byte[bufferSize];
29 | int bytesRead;
30 |
31 | int totalBytesRead = 0;
32 | int positionLimit = length - bufferSize;
33 | int readLength = bufferSize;
34 |
35 | do
36 | {
37 | if (totalBytesRead > positionLimit)
38 | {
39 | readLength = length - totalBytesRead;
40 | }
41 |
42 | bytesRead = fromStream.Read(buffer, 0, readLength);
43 | toStream.Write(buffer, 0, bytesRead);
44 | totalBytesRead += bytesRead;
45 | }
46 | while (bytesRead > 0 && totalBytesRead < length);
47 |
48 | return totalBytesRead;
49 | }
50 |
51 | public static bool WriteToFile(this Stream stream, string filePath)
52 | {
53 | if (stream.Length > 0 && !string.IsNullOrEmpty(filePath))
54 | {
55 | string directoryName = Path.GetDirectoryName(filePath);
56 |
57 | if (!string.IsNullOrEmpty(directoryName) && !Directory.Exists(directoryName))
58 | {
59 | Directory.CreateDirectory(directoryName);
60 | }
61 |
62 | using (FileStream fileStream = new FileStream(filePath, FileMode.Create, FileAccess.Write, FileShare.Read))
63 | {
64 | stream.CopyStreamTo(fileStream);
65 | }
66 |
67 | return true;
68 | }
69 |
70 | return false;
71 | }
72 |
73 | public static byte[] GetBytes(this Stream stream)
74 | {
75 | using (MemoryStream ms = new MemoryStream())
76 | {
77 | stream.CopyStreamTo(ms);
78 | return ms.ToArray();
79 | }
80 | }
81 |
82 | public static byte[] GetBytes(this Stream stream, int offset, int length)
83 | {
84 | using (MemoryStream ms = new MemoryStream())
85 | {
86 | stream.CopyStreamTo(ms, offset, length);
87 | return ms.ToArray();
88 | }
89 | }
90 |
91 | public static T Read(this Stream stream)
92 | {
93 | byte[] buffer = new byte[Marshal.SizeOf(typeof(T))];
94 | int bytes = stream.Read(buffer, 0, buffer.Length);
95 | if (bytes == 0) throw new InvalidOperationException("End-of-file reached");
96 | if (bytes != buffer.Length) throw new ArgumentException("File contains bad data");
97 | T retval;
98 | GCHandle hdl = GCHandle.Alloc(buffer, GCHandleType.Pinned);
99 |
100 | try
101 | {
102 | retval = (T)Marshal.PtrToStructure(hdl.AddrOfPinnedObject(), typeof(T));
103 | }
104 | finally
105 | {
106 | hdl.Free();
107 | }
108 |
109 | return retval;
110 | }
111 | }
112 | }
--------------------------------------------------------------------------------
/TerrariaAPI/Hooks/NetHooks.cs:
--------------------------------------------------------------------------------
1 | using System.ComponentModel;
2 | using Terraria;
3 |
4 | namespace TerrariaAPI.Hooks
5 | {
6 | public class SendDataEventArgs : HandledEventArgs
7 | {
8 | public PacketTypes MsgID { get; set; }
9 | public int remoteClient { get; set; }
10 | public int ignoreClient { get; set; }
11 | public string text { get; set; }
12 | public int number { get; set; }
13 | public float number2 { get; set; }
14 | public float number3 { get; set; }
15 | public float number4 { get; set; }
16 | }
17 |
18 | public class GetDataEventArgs : HandledEventArgs
19 | {
20 | public PacketTypes MsgID { get; set; }
21 | public messageBuffer Msg { get; set; }
22 | public int Index { get; set; }
23 | public int Length { get; set; }
24 | }
25 |
26 | public static class NetHooks
27 | {
28 | public delegate void SendDataD(SendDataEventArgs e);
29 | public static event SendDataD SendData;
30 |
31 | public static bool OnSendData(ref int msgType, ref int remoteClient, ref int ignoreClient, ref string text, ref int number, ref float number2, ref float number3, ref float number4)
32 | {
33 | if (SendData == null)
34 | return false;
35 |
36 | var args = new SendDataEventArgs()
37 | {
38 | MsgID = (PacketTypes)msgType,
39 | remoteClient = remoteClient,
40 | ignoreClient = ignoreClient,
41 | text = text,
42 | number = number,
43 | number2 = number2,
44 | number3 = number3,
45 | number4 = number4,
46 | };
47 |
48 | SendData(args);
49 |
50 | msgType = (int)args.MsgID;
51 | remoteClient = args.remoteClient;
52 | ignoreClient = args.ignoreClient;
53 | text = args.text;
54 | number = args.number;
55 | number2 = args.number2;
56 | number3 = args.number3;
57 | number4 = args.number4;
58 |
59 | return args.Handled;
60 | }
61 |
62 | public delegate void GetDataD(GetDataEventArgs e);
63 | public static event GetDataD GetData;
64 |
65 | public static bool OnGetData(ref byte msgid, messageBuffer msg, ref int idx, ref int length)
66 | {
67 | if (GetData == null)
68 | return false;
69 |
70 | var args = new GetDataEventArgs()
71 | {
72 | MsgID = (PacketTypes)msgid,
73 | Msg = msg,
74 | Index = idx,
75 | Length = length
76 | };
77 |
78 | GetData(args);
79 |
80 | msgid = (byte)args.MsgID;
81 | idx = args.Index;
82 | length = args.Length;
83 |
84 | return args.Handled;
85 | }
86 |
87 | public delegate void GreetPlayerD(int who, HandledEventArgs e);
88 | public static event GreetPlayerD GreetPlayer;
89 |
90 | public static bool OnGreetPlayer(int who)
91 | {
92 | if (GreetPlayer == null)
93 | return false;
94 |
95 | var args = new HandledEventArgs();
96 | GreetPlayer(who, args);
97 | return args.Handled;
98 | }
99 |
100 | public delegate void SendBytesD(ServerSock socket, byte[] buffer, int offset, int count, HandledEventArgs e);
101 | ///
102 | /// Called before bytes are sent to a client. Handled stops bytes from being sent
103 | ///
104 | public static event SendBytesD SendBytes;
105 | public static bool OnSendBytes(ServerSock socket, byte[] buffer, int offset, int count)
106 | {
107 | if (SendBytes == null)
108 | return false;
109 |
110 | var args = new HandledEventArgs();
111 | SendBytes(socket, buffer, offset, count, args);
112 | return args.Handled;
113 | }
114 |
115 | }
116 | }
--------------------------------------------------------------------------------
/TexturePlugin/TextureForm.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace TexturePlugin
2 | {
3 | partial class TextureForm
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.TextureList = new System.Windows.Forms.ListBox();
32 | this.RefreshBtn = new System.Windows.Forms.Button();
33 | this.LoadBtn = new System.Windows.Forms.Button();
34 | this.SuspendLayout();
35 | //
36 | // TextureList
37 | //
38 | this.TextureList.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
39 | | System.Windows.Forms.AnchorStyles.Left)
40 | | System.Windows.Forms.AnchorStyles.Right)));
41 | this.TextureList.FormattingEnabled = true;
42 | this.TextureList.Location = new System.Drawing.Point(12, 12);
43 | this.TextureList.Name = "TextureList";
44 | this.TextureList.Size = new System.Drawing.Size(441, 303);
45 | this.TextureList.TabIndex = 0;
46 | //
47 | // RefreshBtn
48 | //
49 | this.RefreshBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
50 | this.RefreshBtn.Location = new System.Drawing.Point(459, 12);
51 | this.RefreshBtn.Name = "RefreshBtn";
52 | this.RefreshBtn.Size = new System.Drawing.Size(75, 23);
53 | this.RefreshBtn.TabIndex = 1;
54 | this.RefreshBtn.Text = "Refresh";
55 | this.RefreshBtn.UseVisualStyleBackColor = true;
56 | this.RefreshBtn.Click += new System.EventHandler(this.RefreshBtn_Click);
57 | //
58 | // LoadBtn
59 | //
60 | this.LoadBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
61 | this.LoadBtn.Location = new System.Drawing.Point(459, 41);
62 | this.LoadBtn.Name = "LoadBtn";
63 | this.LoadBtn.Size = new System.Drawing.Size(75, 23);
64 | this.LoadBtn.TabIndex = 2;
65 | this.LoadBtn.Text = "Load";
66 | this.LoadBtn.UseVisualStyleBackColor = true;
67 | this.LoadBtn.Click += new System.EventHandler(this.LoadBtn_Click);
68 | //
69 | // TextureForm
70 | //
71 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
72 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
73 | this.ClientSize = new System.Drawing.Size(546, 326);
74 | this.Controls.Add(this.LoadBtn);
75 | this.Controls.Add(this.RefreshBtn);
76 | this.Controls.Add(this.TextureList);
77 | this.Name = "TextureForm";
78 | this.Text = "TextureForm";
79 | this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.TextureForm_FormClosing);
80 | this.ResumeLayout(false);
81 |
82 | }
83 |
84 | #endregion
85 |
86 | private System.Windows.Forms.ListBox TextureList;
87 | private System.Windows.Forms.Button RefreshBtn;
88 | private System.Windows.Forms.Button LoadBtn;
89 | }
90 | }
--------------------------------------------------------------------------------
/TeleportPlugin/TeleportLocationForm.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace TeleportPlugin
2 | {
3 | partial class TeleportLocationForm
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.lblLocationName = new System.Windows.Forms.Label();
32 | this.txtLocationName = new System.Windows.Forms.TextBox();
33 | this.btnOK = new System.Windows.Forms.Button();
34 | this.btnCancel = new System.Windows.Forms.Button();
35 | this.SuspendLayout();
36 | //
37 | // lblLocationName
38 | //
39 | this.lblLocationName.AutoSize = true;
40 | this.lblLocationName.Location = new System.Drawing.Point(8, 8);
41 | this.lblLocationName.Name = "lblLocationName";
42 | this.lblLocationName.Size = new System.Drawing.Size(80, 13);
43 | this.lblLocationName.TabIndex = 0;
44 | this.lblLocationName.Text = "Location name:";
45 | //
46 | // txtLocationName
47 | //
48 | this.txtLocationName.Location = new System.Drawing.Point(8, 24);
49 | this.txtLocationName.Name = "txtLocationName";
50 | this.txtLocationName.Size = new System.Drawing.Size(240, 20);
51 | this.txtLocationName.TabIndex = 1;
52 | //
53 | // btnOK
54 | //
55 | this.btnOK.Location = new System.Drawing.Point(96, 48);
56 | this.btnOK.Name = "btnOK";
57 | this.btnOK.Size = new System.Drawing.Size(75, 23);
58 | this.btnOK.TabIndex = 2;
59 | this.btnOK.Text = "OK";
60 | this.btnOK.UseVisualStyleBackColor = true;
61 | this.btnOK.Click += new System.EventHandler(this.btnOK_Click);
62 | //
63 | // btnCancel
64 | //
65 | this.btnCancel.Location = new System.Drawing.Point(176, 48);
66 | this.btnCancel.Name = "btnCancel";
67 | this.btnCancel.Size = new System.Drawing.Size(75, 23);
68 | this.btnCancel.TabIndex = 3;
69 | this.btnCancel.Text = "Cancel";
70 | this.btnCancel.UseVisualStyleBackColor = true;
71 | this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
72 | //
73 | // TeleportLocationForm
74 | //
75 | this.AcceptButton = this.btnOK;
76 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
77 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
78 | this.ClientSize = new System.Drawing.Size(259, 81);
79 | this.Controls.Add(this.btnCancel);
80 | this.Controls.Add(this.btnOK);
81 | this.Controls.Add(this.txtLocationName);
82 | this.Controls.Add(this.lblLocationName);
83 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
84 | this.Name = "TeleportLocationForm";
85 | this.Text = "Choose location name";
86 | this.TopMost = true;
87 | this.ResumeLayout(false);
88 | this.PerformLayout();
89 |
90 | }
91 |
92 | #endregion
93 |
94 | private System.Windows.Forms.Label lblLocationName;
95 | private System.Windows.Forms.TextBox txtLocationName;
96 | private System.Windows.Forms.Button btnOK;
97 | private System.Windows.Forms.Button btnCancel;
98 | }
99 | }
--------------------------------------------------------------------------------
/XNAHelpers/Logger.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 | using System.IO;
4 | using System.Text;
5 |
6 | namespace XNAHelpers
7 | {
8 | public class Logger
9 | {
10 | public delegate void MessageAddedEventHandler(string message);
11 | public event MessageAddedEventHandler MessageAdded;
12 |
13 | public StringBuilder Messages { get; private set; }
14 |
15 | /// {0} = DateTime, {1} = Message
16 | public string MessageFormat { get; set; }
17 |
18 | /// {0} = Message, {1} = Exception
19 | public string ExceptionFormat { get; set; }
20 |
21 | /// {0} = Message, {1} = Elapsed miliseconds
22 | public string TimerMessageFormat { get; set; }
23 |
24 | private readonly object thisLock = new object();
25 |
26 | private int saveIndex;
27 |
28 | public Logger()
29 | {
30 | Messages = new StringBuilder(1024);
31 | MessageFormat = "{0:yyyy-MM-dd HH:mm:ss.fff} - {1}";
32 | ExceptionFormat = "{0}:\r\n{1}";
33 | TimerMessageFormat = "{0} - {1}ms";
34 | }
35 |
36 | public void WriteLine(string message = null)
37 | {
38 | lock (thisLock)
39 | {
40 | if (!string.IsNullOrEmpty(message))
41 | {
42 | message = string.Format(MessageFormat, FastDateTime.Now, message);
43 | }
44 |
45 | Messages.AppendLine(message);
46 | Debug.WriteLine(message);
47 | OnMessageAdded(message);
48 | }
49 | }
50 |
51 | public void WriteLine(string format, params object[] args)
52 | {
53 | WriteLine(string.Format(format, args));
54 | }
55 |
56 | public void WriteException(Exception exception, string message = "Exception")
57 | {
58 | WriteLine(string.Format(ExceptionFormat, message, exception));
59 | }
60 |
61 | public LoggerTimer StartTimer(string startMessage = null)
62 | {
63 | if (!string.IsNullOrEmpty(startMessage))
64 | {
65 | WriteLine(startMessage);
66 | }
67 |
68 | return new LoggerTimer(this, TimerMessageFormat);
69 | }
70 |
71 | public void SaveLog(string filepath)
72 | {
73 | lock (thisLock)
74 | {
75 | string messages = GetNewMessages();
76 |
77 | if (!string.IsNullOrEmpty(filepath) && !string.IsNullOrEmpty(messages))
78 | {
79 | string directory = Path.GetDirectoryName(filepath);
80 |
81 | if (!string.IsNullOrEmpty(directory) && !Directory.Exists(directory))
82 | {
83 | Directory.CreateDirectory(directory);
84 | }
85 |
86 | File.AppendAllText(filepath, messages, Encoding.UTF8);
87 |
88 | saveIndex = Messages.Length;
89 | }
90 | }
91 | }
92 |
93 | private string GetNewMessages()
94 | {
95 | if (Messages != null && Messages.Length > 0)
96 | {
97 | return Messages.ToString(saveIndex, Messages.Length - saveIndex);
98 | }
99 |
100 | return null;
101 | }
102 |
103 | protected void OnMessageAdded(string message)
104 | {
105 | if (MessageAdded != null)
106 | {
107 | MessageAdded(message);
108 | }
109 | }
110 |
111 | public override string ToString()
112 | {
113 | return Messages.ToString().Trim();
114 | }
115 | }
116 |
117 | public class LoggerTimer
118 | {
119 | private Logger logger;
120 | private string format;
121 | private Stopwatch timer;
122 |
123 | public LoggerTimer(Logger logger, string format)
124 | {
125 | this.logger = logger;
126 | this.format = format;
127 | timer = Stopwatch.StartNew();
128 | }
129 |
130 | public void WriteLineTime(string message = "Timer")
131 | {
132 | logger.WriteLine(format, message, timer.ElapsedMilliseconds);
133 | }
134 | }
135 | }
--------------------------------------------------------------------------------
/TerrariaPatcher/TerrariaPatcher.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Debug
5 | AnyCPU
6 | 8.0.30703
7 | 2.0
8 | {1A70473B-D3E9-48FE-B7B3-953E6112B993}
9 | Exe
10 | Properties
11 | TerrariaPatcher
12 | TerrariaPatcher
13 | TerrariaPatcher
14 | TerrariaServerPatcher
15 | TerrariaServerPatcher
16 | v4.0
17 |
18 |
19 | 512
20 |
21 |
22 | AnyCPU
23 | true
24 | full
25 | false
26 | bin\Debug\
27 | TRACE;DEBUG;CLIENT
28 | prompt
29 | 4
30 |
31 |
32 | AnyCPU
33 | pdbonly
34 | true
35 | bin\Release\
36 | TRACE;CLIENT
37 | prompt
38 | 4
39 |
40 |
41 | true
42 | bin\DebugServer\
43 | TRACE;DEBUG;SERVER
44 | full
45 | AnyCPU
46 | prompt
47 |
48 |
49 | bin\ReleaseServer\
50 | TRACE;SERVER
51 | true
52 | pdbonly
53 | AnyCPU
54 | prompt
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 | True
70 | True
71 | Resources.resx
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 | ResXFileCodeGenerator
80 | Resources.Designer.cs
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
103 |
--------------------------------------------------------------------------------
/ItemPlugin/ItemForm.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Windows.Forms;
5 | using Terraria;
6 |
7 | namespace ItemPlugin
8 | {
9 | public partial class ItemForm : Form
10 | {
11 | public bool SortItemsByName { get; set; }
12 | public string ItemsFilter { get; set; }
13 |
14 | private Player me
15 | {
16 | get { return Main.player[Main.myPlayer]; }
17 | }
18 |
19 | private ItemManager itemManager;
20 |
21 | public ItemForm()
22 | {
23 | InitializeComponent();
24 |
25 | SortItemsByName = true;
26 | ItemsFilter = string.Empty;
27 | itemManager = new ItemManager(lvItems);
28 | LoadItems();
29 | }
30 |
31 | private void LoadItems()
32 | {
33 | IEnumerable itemsList;
34 |
35 | if (SortItemsByName)
36 | {
37 | itemsList = itemManager.Items.OrderBy(x => x.Name);
38 | }
39 | else
40 | {
41 | itemsList = itemManager.Items.OrderBy(x => x.ID);
42 | }
43 |
44 | if (!string.IsNullOrWhiteSpace(ItemsFilter))
45 | {
46 | itemsList = itemsList.Where(x => x.Name.IndexOf(ItemsFilter, StringComparison.InvariantCultureIgnoreCase) >= 0);
47 | }
48 |
49 | lvItems.Items.Clear();
50 |
51 | foreach (ItemType item in itemsList)
52 | {
53 | lvItems.Items.Add(" " + item.Name, item.Name).Tag = item;
54 | }
55 | }
56 |
57 | private void lvItems_SelectedIndexChanged(object sender, EventArgs e)
58 | {
59 | if (lvItems.SelectedItems.Count > 0)
60 | {
61 | ItemType type = lvItems.SelectedItems[0].Tag as ItemType;
62 | ItemEx item = type.CreateItem();
63 | pgItem.SelectedObject = item;
64 | nudStack.Minimum = 1;
65 | nudStack.Maximum = Math.Max(1, item.MaxStack);
66 | nudStack.Value = Math.Max(1, item.MaxStack);
67 | btnGiveItem.Enabled = btnGiveOne.Enabled = btnThrowOne.Enabled = btnGiveN.Enabled = btnThrowN.Enabled = true;
68 | btnRemoveItem.Enabled = false;
69 | }
70 | }
71 |
72 | private void cbSortByName_CheckedChanged(object sender, EventArgs e)
73 | {
74 | SortItemsByName = cbSortByName.Checked;
75 | LoadItems();
76 | }
77 |
78 | private void txtFilter_TextChanged(object sender, EventArgs e)
79 | {
80 | ItemsFilter = txtFilter.Text;
81 | LoadItems();
82 | }
83 |
84 | private void btnGive_Click(object sender, EventArgs e)
85 | {
86 | ItemEx item = pgItem.SelectedObject as ItemEx;
87 |
88 | if (item != null && item.Active)
89 | {
90 | me.GetItem(Main.myPlayer, item.Item);
91 | }
92 |
93 | btnGiveItem.Enabled = false;
94 | btnRemoveItem.Enabled = true;
95 | }
96 |
97 | private void btnRemoveItem_Click(object sender, EventArgs e)
98 | {
99 | ItemEx item = pgItem.SelectedObject as ItemEx;
100 |
101 | if (item != null)
102 | {
103 | ItemHelper.RemoveItem(item.Item);
104 | }
105 |
106 | btnRemoveItem.Enabled = false;
107 | }
108 |
109 | private void ItemForm_FormClosing(object sender, FormClosingEventArgs e)
110 | {
111 | e.Cancel = true;
112 | Visible = false;
113 | }
114 |
115 | private void btnGiveOne_Click(object sender, EventArgs e)
116 | {
117 | if (lvItems.SelectedItems.Count > 0)
118 | {
119 | ItemType type = lvItems.SelectedItems[0].Tag as ItemType;
120 | ItemHelper.GiveItem(type.Name, 1);
121 | }
122 | }
123 |
124 | private void btnThrowOne_Click(object sender, EventArgs e)
125 | {
126 | if (lvItems.SelectedItems.Count > 0)
127 | {
128 | ItemType type = lvItems.SelectedItems[0].Tag as ItemType;
129 | ItemHelper.ThrowItem(type.Name, 1);
130 | }
131 | }
132 |
133 | private void btnGiveN_Click(object sender, EventArgs e)
134 | {
135 | if (lvItems.SelectedItems.Count > 0)
136 | {
137 | ItemType type = lvItems.SelectedItems[0].Tag as ItemType;
138 | ItemHelper.GiveItem(type.Name, (int)nudStack.Value);
139 | }
140 | }
141 |
142 | private void btnThrowN_Click(object sender, EventArgs e)
143 | {
144 | if (lvItems.SelectedItems.Count > 0)
145 | {
146 | ItemType type = lvItems.SelectedItems[0].Tag as ItemType;
147 | ItemHelper.ThrowItem(type.Name, (int)nudStack.Value);
148 | }
149 | }
150 | }
151 | }
--------------------------------------------------------------------------------
/XNAHelpers/XNAHelpers.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Debug
5 | AnyCPU
6 | 8.0.30703
7 | 2.0
8 | {BE066E72-276F-45AC-A755-FD6911F0F1A5}
9 | Library
10 | Properties
11 | XNAHelpers
12 | XNAHelpers
13 | v4.0
14 | 512
15 | publish\
16 | true
17 | Disk
18 | false
19 | Foreground
20 | 7
21 | Days
22 | false
23 | false
24 | true
25 | 0
26 | 1.0.0.%2a
27 | false
28 | false
29 | true
30 |
31 |
32 | true
33 | full
34 | false
35 | bin\Debug\
36 | DEBUG;TRACE
37 | prompt
38 | 4
39 | true
40 |
41 |
42 | pdbonly
43 | true
44 | bin\Release\
45 | TRACE
46 | prompt
47 | 4
48 | true
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 | False
81 | Microsoft .NET Framework 4 %28x86 and x64%29
82 | true
83 |
84 |
85 | False
86 | .NET Framework 3.5 SP1 Client Profile
87 | false
88 |
89 |
90 | False
91 | .NET Framework 3.5 SP1
92 | false
93 |
94 |
95 | False
96 | Windows Installer 3.1
97 | true
98 |
99 |
100 |
101 |
108 |
--------------------------------------------------------------------------------
/ScreenShotPlugin/ScreenShotPlugin.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Debug
5 | AnyCPU
6 | 8.0.30703
7 | 2.0
8 | {9A249AF8-A605-402D-8962-51280F9340BE}
9 | Library
10 | Properties
11 | ScreenShotPlugin
12 | ScreenShotPlugin
13 | v4.0
14 | 512
15 | publish\
16 | true
17 | Disk
18 | false
19 | Foreground
20 | 7
21 | Days
22 | false
23 | false
24 | true
25 | 0
26 | 1.0.0.%2a
27 | false
28 | false
29 | true
30 |
31 |
32 | true
33 | full
34 | false
35 | $(TERRARIA_BIN)Plugins
36 | DEBUG;TRACE
37 | prompt
38 | 4
39 | true
40 |
41 |
42 | pdbonly
43 | true
44 | $(TERRARIA_BIN)Plugins
45 | TRACE
46 | prompt
47 | 4
48 | true
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 | ..\Terraria\Terraria.exe
64 | False
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 | {6D26750B-AAAA-48E8-9457-917F9F6F8D94}
75 | TerrariaAPI
76 | False
77 |
78 |
79 |
80 |
81 | False
82 | Microsoft .NET Framework 4 %28x86 and x64%29
83 | true
84 |
85 |
86 | False
87 | .NET Framework 3.5 SP1 Client Profile
88 | false
89 |
90 |
91 | False
92 | .NET Framework 3.5 SP1
93 | false
94 |
95 |
96 | False
97 | Windows Installer 3.1
98 | true
99 |
100 |
101 |
102 |
109 |
--------------------------------------------------------------------------------
/ResolutionPlugin/ResolutionPlugin.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Debug
5 | AnyCPU
6 | 8.0.30703
7 | 2.0
8 | {7B080F28-5162-4628-9D9E-E0CD1650516F}
9 | Library
10 | Properties
11 | ResolutionPlugin
12 | ResolutionPlugin
13 | v4.0
14 | 512
15 | publish\
16 | true
17 | Disk
18 | false
19 | Foreground
20 | 7
21 | Days
22 | false
23 | false
24 | true
25 | 0
26 | 1.0.0.%2a
27 | false
28 | false
29 | true
30 |
31 |
32 | true
33 | full
34 | false
35 | $(TERRARIA_BIN)Plugins
36 | DEBUG;TRACE
37 | prompt
38 | 4
39 |
40 |
41 | pdbonly
42 | true
43 | $(TERRARIA_BIN)Plugins
44 | TRACE
45 | prompt
46 | 4
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 | ..\Terraria\Terraria.exe
63 | False
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 | {6D26750B-AAAA-48E8-9457-917F9F6F8D94}
73 | TerrariaAPI
74 | False
75 |
76 |
77 | {BE066E72-276F-45AC-A755-FD6911F0F1A5}
78 | XNAHelpers
79 | False
80 |
81 |
82 |
83 |
84 | False
85 | Microsoft .NET Framework 4 %28x86 and x64%29
86 | true
87 |
88 |
89 | False
90 | .NET Framework 3.5 SP1 Client Profile
91 | false
92 |
93 |
94 | False
95 | .NET Framework 3.5 SP1
96 | false
97 |
98 |
99 | False
100 | Windows Installer 3.1
101 | true
102 |
103 |
104 |
105 |
112 |
--------------------------------------------------------------------------------
/MinimapPlugin/WorldRenderer.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.Xna.Framework;
2 | using Terraria;
3 | using XNAHelpers;
4 |
5 | namespace MinimapPlugin
6 | {
7 | public class WorldRenderer
8 | {
9 | public Tile[,] Tiles { get; private set; }
10 | public int MaxX { get; private set; }
11 | public int MaxY { get; private set; }
12 | public int SurfaceY { get; private set; }
13 | public int RockLayerY { get; private set; }
14 | public int HellLayerY { get; private set; }
15 | public int[] Colors { get; private set; }
16 |
17 | public WorldRenderer(Tile[,] tiles, int worldWidth, int worldHeight, double worldSurface, double rockLayer)
18 | {
19 | Tiles = tiles;
20 | MaxX = worldWidth;
21 | MaxY = worldHeight;
22 | SurfaceY = (int)worldSurface;
23 | RockLayerY = (int)rockLayer + (600 / 16);
24 | HellLayerY = MaxY - 195;
25 | Colors = TerrariaColors.GetColors();
26 | }
27 |
28 | public int[] GenerateMinimap(int tileX, int tileY, int width, int height, float zoom = 1.0f, bool drawWall = true, bool drawSky = true,
29 | bool showBorder = true, bool showCrosshair = true)
30 | {
31 | int left = tileX - (int)((width * zoom) / 2);
32 | int top = tileY - (int)((height * zoom) / 2);
33 |
34 | int[] tiles = new int[width * height];
35 |
36 | int posX, posY, tileType;
37 |
38 | Tile tile;
39 |
40 | for (int y = 0; y < height; y++)
41 | {
42 | posY = top + (int)(y * zoom);
43 |
44 | if (posY < 0 || posY >= MaxY)
45 | continue;
46 |
47 | for (int x = 0; x < width; x++)
48 | {
49 | posX = left + (int)(x * zoom);
50 |
51 | if (posX < 0 || posX > MaxX)
52 | continue;
53 |
54 | tile = Tiles[posX, posY];
55 |
56 | if (tile != null)
57 | {
58 | if (tile.liquid > 0)
59 | {
60 | tileType = tile.lava() ? (int)LiquidType.Lava : (int)LiquidType.Water;
61 | }
62 | else if (tile.active())
63 | {
64 | tileType = tile.type;
65 | }
66 | else if (drawWall)
67 | {
68 | if (tile.wall > 0)
69 | {
70 | tileType = TerrariaColors.WallOffset + tile.wall;
71 | }
72 | else if (posY > HellLayerY)
73 | {
74 | tileType = (int)WallType.WallHellstone;
75 | }
76 | else if (posY > RockLayerY)
77 | {
78 | tileType = (int)WallType.WallStone;
79 | }
80 | else if (posY > SurfaceY)
81 | {
82 | tileType = (int)WallType.WallDirt;
83 | }
84 | else if (drawSky)
85 | {
86 | tileType = (int)WallType.Sky;
87 | }
88 | else
89 | {
90 | tileType = TerrariaColors.WallOffset - 1;
91 | }
92 | }
93 | else
94 | {
95 | tileType = TerrariaColors.WallOffset - 1;
96 | }
97 |
98 | tiles[x + y * width] = Colors[tileType];
99 | }
100 | }
101 | }
102 |
103 | int borderColor = Color.White.ToAbgr();
104 |
105 | if (showBorder)
106 | {
107 | int right = width - 1;
108 | int bottom = (height - 1) * width;
109 |
110 | for (int x = 0; x < width; x++)
111 | {
112 | tiles[x] = borderColor; // Top line
113 | tiles[x + bottom] = borderColor; // Bottom line
114 | }
115 |
116 | for (int y = 0; y < height; y++)
117 | {
118 | tiles[y * width] = borderColor; // Left line
119 | tiles[right + (y * width)] = borderColor; // Right line
120 | }
121 | }
122 |
123 | if (showCrosshair)
124 | {
125 | int middleX = (width - 1) / 2;
126 | int middleY = (height - 1) / 2;
127 |
128 | for (int x = 0; x < width; x++)
129 | {
130 | tiles[x + (middleY * width)] = borderColor; // Horizontal line
131 | }
132 |
133 | for (int y = 0; y < height; y++)
134 | {
135 | tiles[middleX + (y * width)] = borderColor; // Vertical line
136 | }
137 | }
138 |
139 | return tiles;
140 | }
141 | }
142 | }
--------------------------------------------------------------------------------
/ItemPlugin/ItemPlugin.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Debug
5 | AnyCPU
6 | 8.0.30703
7 | 2.0
8 | {69D8CFAE-B25E-4DBA-B9CA-8A699DA1DBE2}
9 | Library
10 | Properties
11 | ItemPlugin
12 | ItemPlugin
13 | v4.0
14 | 512
15 | publish\
16 | true
17 | Disk
18 | false
19 | Foreground
20 | 7
21 | Days
22 | false
23 | false
24 | true
25 | 0
26 | 1.0.0.%2a
27 | false
28 | false
29 | true
30 |
31 |
32 | true
33 | full
34 | false
35 | $(TERRARIA_BIN)Plugins
36 | DEBUG;TRACE
37 | prompt
38 | 4
39 |
40 |
41 | pdbonly
42 | true
43 | $(TERRARIA_BIN)Plugins
44 | TRACE
45 | prompt
46 | 4
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 | ..\Terraria\Terraria.exe
63 | False
64 |
65 |
66 |
67 |
68 |
69 | Form
70 |
71 |
72 | ItemForm.cs
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 | {6D26750B-AAAA-48E8-9457-917F9F6F8D94}
83 | TerrariaAPI
84 | False
85 |
86 |
87 | {BE066E72-276F-45AC-A755-FD6911F0F1A5}
88 | XNAHelpers
89 | False
90 |
91 |
92 |
93 |
94 | ItemForm.cs
95 |
96 |
97 |
98 |
99 | False
100 | Microsoft .NET Framework 4 %28x86 and x64%29
101 | true
102 |
103 |
104 | False
105 | .NET Framework 3.5 SP1 Client Profile
106 | false
107 |
108 |
109 | False
110 | .NET Framework 3.5 SP1
111 | false
112 |
113 |
114 | False
115 | Windows Installer 3.1
116 | true
117 |
118 |
119 |
120 |
127 |
--------------------------------------------------------------------------------
/TexturePlugin/TexturePlugin.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Debug
5 | AnyCPU
6 | 8.0.30703
7 | 2.0
8 | {E51EDBDC-B8D0-4D5B-B7F1-62BC0B44D170}
9 | Library
10 | Properties
11 | TexturePlugin
12 | TexturePlugin
13 | v4.0
14 | 512
15 | publish\
16 | true
17 | Disk
18 | false
19 | Foreground
20 | 7
21 | Days
22 | false
23 | false
24 | true
25 | 0
26 | 1.0.0.%2a
27 | false
28 | false
29 | true
30 |
31 |
32 | true
33 | full
34 | false
35 | $(TERRARIA_BIN)Plugins
36 | DEBUG;TRACE
37 | prompt
38 | 4
39 |
40 |
41 | pdbonly
42 | true
43 | bin\Release\
44 | TRACE
45 | prompt
46 | 4
47 |
48 |
49 |
50 | .\ICSharpCode.SharpZipLib.dll
51 | False
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 | ..\Terraria\Terraria.exe
67 | False
68 |
69 |
70 |
71 |
72 |
73 | Form
74 |
75 |
76 | TextureForm.cs
77 |
78 |
79 |
80 |
81 |
82 |
83 | {6D26750B-AAAA-48E8-9457-917F9F6F8D94}
84 | TerrariaAPI
85 | False
86 |
87 |
88 | {BE066E72-276F-45AC-A755-FD6911F0F1A5}
89 | XNAHelpers
90 | False
91 |
92 |
93 |
94 |
95 | TextureForm.cs
96 |
97 |
98 |
99 |
100 | False
101 | Microsoft .NET Framework 4 %28x86 and x64%29
102 | true
103 |
104 |
105 | False
106 | .NET Framework 3.5 SP1 Client Profile
107 | false
108 |
109 |
110 | False
111 | .NET Framework 3.5 SP1
112 | false
113 |
114 |
115 | False
116 | Windows Installer 3.1
117 | true
118 |
119 |
120 |
121 |
128 |
--------------------------------------------------------------------------------
/ItemPlugin/ItemForm.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/TeleportPlugin/TeleportForm.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/TrainerPlugin/TrainerPlugin.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Debug
5 | AnyCPU
6 | 8.0.30703
7 | 2.0
8 | {18349425-0A3A-4D5D-BF11-38DF09818332}
9 | Library
10 | Properties
11 | TrainerPlugin
12 | TrainerPlugin
13 | v4.0
14 | 512
15 | publish\
16 | true
17 | Disk
18 | false
19 | Foreground
20 | 7
21 | Days
22 | false
23 | false
24 | true
25 | 0
26 | 1.0.0.%2a
27 | false
28 | false
29 | true
30 |
31 |
32 | true
33 | full
34 | false
35 | $(TERRARIA_BIN)Plugins
36 | DEBUG;TRACE
37 | prompt
38 | 4
39 |
40 |
41 | pdbonly
42 | true
43 | $(TERRARIA_BIN)Plugins
44 | TRACE
45 | prompt
46 | 4
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 | False
63 | .exe
64 | ..\Terraria\Terraria.exe
65 | False
66 |
67 |
68 |
69 |
70 | Form
71 |
72 |
73 | TrainerForm.cs
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 | TrainerForm.cs
83 |
84 |
85 |
86 |
87 | {6D26750B-AAAA-48E8-9457-917F9F6F8D94}
88 | TerrariaAPI
89 | False
90 |
91 |
92 | {BE066E72-276F-45AC-A755-FD6911F0F1A5}
93 | XNAHelpers
94 | False
95 |
96 |
97 |
98 |
99 | False
100 | Microsoft .NET Framework 4 %28x86 and x64%29
101 | true
102 |
103 |
104 | False
105 | .NET Framework 3.5 SP1 Client Profile
106 | false
107 |
108 |
109 | False
110 | .NET Framework 3.5 SP1
111 | false
112 |
113 |
114 | False
115 | Windows Installer 3.1
116 | true
117 |
118 |
119 |
120 |
127 |
--------------------------------------------------------------------------------
/TexturePlugin/TextureForm.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/TrainerPlugin/TrainerForm.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/MinimapPlugin/Properties/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/TeleportPlugin/TeleportPlugin.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Debug
5 | AnyCPU
6 | 8.0.30703
7 | 2.0
8 | {AB0D33F2-8A78-4D20-9BB3-C231392093F0}
9 | Library
10 | Properties
11 | TeleportPlugin
12 | TeleportPlugin
13 | v4.0
14 | 512
15 | publish\
16 | true
17 | Disk
18 | false
19 | Foreground
20 | 7
21 | Days
22 | false
23 | false
24 | true
25 | 0
26 | 1.0.0.%2a
27 | false
28 | false
29 | true
30 |
31 |
32 | true
33 | full
34 | false
35 | $(TERRARIA_BIN)Plugins
36 | DEBUG;TRACE
37 | prompt
38 | 4
39 |
40 |
41 | pdbonly
42 | true
43 | $(TERRARIA_BIN)Plugins
44 | TRACE
45 | prompt
46 | 4
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 | ..\Terraria\Terraria.exe
63 | False
64 |
65 |
66 |
67 |
68 |
69 | Form
70 |
71 |
72 | TeleportForm.cs
73 |
74 |
75 |
76 |
77 | Form
78 |
79 |
80 | TeleportLocationForm.cs
81 |
82 |
83 |
84 |
85 |
86 |
87 | {6D26750B-AAAA-48E8-9457-917F9F6F8D94}
88 | TerrariaAPI
89 | False
90 |
91 |
92 | {BE066E72-276F-45AC-A755-FD6911F0F1A5}
93 | XNAHelpers
94 | False
95 |
96 |
97 |
98 |
99 | TeleportForm.cs
100 |
101 |
102 |
103 |
104 | False
105 | Microsoft .NET Framework 4 %28x86 and x64%29
106 | true
107 |
108 |
109 | False
110 | .NET Framework 3.5 SP1 Client Profile
111 | false
112 |
113 |
114 | False
115 | .NET Framework 3.5 SP1
116 | false
117 |
118 |
119 | False
120 | Windows Installer 3.1
121 | true
122 |
123 |
124 |
125 |
132 |
--------------------------------------------------------------------------------
/MinimapPlugin/MinimapPlugin.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Debug
5 | AnyCPU
6 | 8.0.30703
7 | 2.0
8 | {CF4C6FC7-078E-40BA-8939-011C079E5F8C}
9 | Library
10 | Properties
11 | MinimapPlugin
12 | MinimapPlugin
13 | v4.0
14 | 512
15 | publish\
16 | true
17 | Disk
18 | false
19 | Foreground
20 | 7
21 | Days
22 | false
23 | false
24 | true
25 | 0
26 | 1.0.0.%2a
27 | false
28 | false
29 | true
30 |
31 |
32 | true
33 | full
34 | false
35 | $(TERRARIA_BIN)Plugins
36 | DEBUG;TRACE
37 | prompt
38 | 4
39 | true
40 |
41 |
42 | pdbonly
43 | true
44 | $(TERRARIA_BIN)Plugins
45 | TRACE
46 | prompt
47 | 4
48 | true
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 | ..\Terraria\Terraria.exe
65 | False
66 |
67 |
68 |
69 |
70 |
71 |
72 | Form
73 |
74 |
75 | MinimapForm.cs
76 |
77 |
78 |
79 |
80 |
81 | True
82 | True
83 | Resources.resx
84 |
85 |
86 |
87 |
88 |
89 | {6D26750B-AAAA-48E8-9457-917F9F6F8D94}
90 | TerrariaAPI
91 | False
92 |
93 |
94 | {BE066E72-276F-45AC-A755-FD6911F0F1A5}
95 | XNAHelpers
96 | False
97 |
98 |
99 |
100 |
101 | ResXFileCodeGenerator
102 | Resources.Designer.cs
103 |
104 |
105 |
106 |
107 | False
108 | Microsoft .NET Framework 4 %28x86 and x64%29
109 | true
110 |
111 |
112 | False
113 | .NET Framework 3.5 SP1 Client Profile
114 | false
115 |
116 |
117 | False
118 | .NET Framework 3.5 SP1
119 | false
120 |
121 |
122 | False
123 | Windows Installer 3.1
124 | true
125 |
126 |
127 |
128 |
135 |
--------------------------------------------------------------------------------
/XNAHelpers/InputManager.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using Microsoft.Xna.Framework;
3 | using Microsoft.Xna.Framework.Input;
4 |
5 | namespace XNAHelpers
6 | {
7 | public enum MouseButtons { Left, Right, Middle, X1, X2 }
8 |
9 | public static class InputManager
10 | {
11 | private static KeyboardState currentKeyboardState, previousKeyboardState;
12 | private static MouseState currentMouseState, previousMouseState;
13 | private static int keyboardDelay, mouseDelay;
14 |
15 | static InputManager()
16 | {
17 | currentKeyboardState = new KeyboardState();
18 | previousKeyboardState = new KeyboardState();
19 | currentMouseState = new MouseState();
20 | previousMouseState = new MouseState();
21 | }
22 |
23 | public static void Update(GameTime gameTime)
24 | {
25 | previousKeyboardState = currentKeyboardState;
26 | currentKeyboardState = Keyboard.GetState();
27 | previousMouseState = currentMouseState;
28 | currentMouseState = Mouse.GetState();
29 |
30 | int elapsed = (int)gameTime.ElapsedGameTime.TotalMilliseconds;
31 |
32 | if (keyboardDelay > 0)
33 | {
34 | keyboardDelay -= elapsed;
35 | }
36 |
37 | if (mouseDelay > 0)
38 | {
39 | mouseDelay -= elapsed;
40 | }
41 | }
42 |
43 | #region Keyboard
44 |
45 | public static bool IsAltKeyDown
46 | {
47 | get { return IsKeyDown(Keys.LeftAlt) || IsKeyDown(Keys.RightAlt); }
48 | }
49 |
50 | public static bool IsControlKeyDown
51 | {
52 | get { return IsKeyDown(Keys.LeftControl) || IsKeyDown(Keys.RightControl); }
53 | }
54 |
55 | public static bool IsShiftKeyDown
56 | {
57 | get { return IsKeyDown(Keys.LeftShift) || IsKeyDown(Keys.RightShift); }
58 | }
59 |
60 | public static bool IsKeyDown(Keys key)
61 | {
62 | return currentKeyboardState.IsKeyDown(key);
63 | }
64 |
65 | public static bool IsKeyDown(Keys key, int delay)
66 | {
67 | if (keyboardDelay <= 0 && currentKeyboardState.IsKeyDown(key))
68 | {
69 | keyboardDelay = delay;
70 | return true;
71 | }
72 |
73 | return false;
74 | }
75 |
76 | public static bool IsKeyUp(Keys key)
77 | {
78 | return currentKeyboardState.IsKeyUp(key);
79 | }
80 |
81 | public static bool IsKeyPressed(Keys key)
82 | {
83 | return currentKeyboardState.IsKeyDown(key) && previousKeyboardState.IsKeyUp(key);
84 | }
85 |
86 | public static bool IsKeyReleased(Keys key)
87 | {
88 | return currentKeyboardState.IsKeyUp(key) && previousKeyboardState.IsKeyDown(key);
89 | }
90 |
91 | public static Keys[] GetKeysDown()
92 | {
93 | return currentKeyboardState.GetPressedKeys();
94 | }
95 |
96 | public static Keys[] GetKeysPressed()
97 | {
98 | List keys = new List();
99 |
100 | foreach (Keys key in currentKeyboardState.GetPressedKeys())
101 | {
102 | if (previousKeyboardState.IsKeyUp(key))
103 | {
104 | keys.Add(key);
105 | }
106 | }
107 |
108 | return keys.ToArray();
109 | }
110 |
111 | #endregion Keyboard
112 |
113 | #region Mouse
114 |
115 | public static Vector2 MousePosition
116 | {
117 | get { return new Vector2(currentMouseState.X, currentMouseState.Y); }
118 | }
119 |
120 | public static Vector2 MouseVelocity
121 | {
122 | get { return new Vector2(currentMouseState.X - previousMouseState.X, currentMouseState.Y - previousMouseState.Y); }
123 | }
124 |
125 | public static float MouseScrollWheelPosition
126 | {
127 | get { return currentMouseState.ScrollWheelValue; }
128 | }
129 |
130 | public static float MouseScrollWheelVelocity
131 | {
132 | get { return currentMouseState.ScrollWheelValue - previousMouseState.ScrollWheelValue; }
133 | }
134 |
135 | public static bool IsMouseButtonDown(MouseButtons button)
136 | {
137 | return GetMouseButtonState(currentMouseState, button) == ButtonState.Pressed;
138 | }
139 |
140 | public static bool IsMouseButtonDown(MouseButtons button, int delay)
141 | {
142 | if (mouseDelay <= 0 && GetMouseButtonState(currentMouseState, button) == ButtonState.Pressed)
143 | {
144 | mouseDelay = delay;
145 | return true;
146 | }
147 |
148 | return false;
149 | }
150 |
151 | public static bool IsMouseButtonUp(MouseButtons button)
152 | {
153 | return GetMouseButtonState(currentMouseState, button) == ButtonState.Released;
154 | }
155 |
156 | public static bool IsMouseButtonPressed(MouseButtons button)
157 | {
158 | return GetMouseButtonState(currentMouseState, button) == ButtonState.Pressed && GetMouseButtonState(previousMouseState, button) == ButtonState.Released;
159 | }
160 |
161 | public static bool IsMouseButtonReleased(MouseButtons button)
162 | {
163 | return GetMouseButtonState(currentMouseState, button) == ButtonState.Released && GetMouseButtonState(previousMouseState, button) == ButtonState.Pressed;
164 | }
165 |
166 | private static ButtonState GetMouseButtonState(MouseState mouseState, MouseButtons button)
167 | {
168 | switch (button)
169 | {
170 | default:
171 | case MouseButtons.Left:
172 | return mouseState.LeftButton;
173 | case MouseButtons.Right:
174 | return mouseState.RightButton;
175 | case MouseButtons.Middle:
176 | return mouseState.MiddleButton;
177 | case MouseButtons.X1:
178 | return mouseState.XButton1;
179 | case MouseButtons.X2:
180 | return mouseState.XButton2;
181 | }
182 | }
183 |
184 | #endregion Mouse
185 | }
186 | }
--------------------------------------------------------------------------------