merge take 2
This commit is contained in:
parent
da882cc9db
commit
ab4d714a97
1 changed files with 68 additions and 93 deletions
|
|
@ -1,23 +1,16 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Terraria;
|
using Terraria;
|
||||||
using TerrariaAPI;
|
using TerrariaAPI;
|
||||||
using TerrariaAPI.Hooks;
|
using TerrariaAPI.Hooks;
|
||||||
using Microsoft.Xna.Framework;
|
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
|
||||||
using System.Net;
|
|
||||||
using TShockAPI;
|
|
||||||
|
|
||||||
namespace TShockAPI
|
namespace TShockAPI
|
||||||
{
|
{
|
||||||
public class TShock : TerrariaPlugin
|
public class TShock : TerrariaPlugin
|
||||||
{
|
{
|
||||||
private uint[] tileThreshold = new uint[Main.maxPlayers];
|
uint[] tileThreshold = new uint[Main.maxPlayers];
|
||||||
|
|
||||||
public static string saveDir = "./tshock/";
|
public static string saveDir = "./tshock/";
|
||||||
|
|
||||||
|
|
@ -52,7 +45,6 @@ namespace TShockAPI
|
||||||
get { return "The administration modification of the future."; }
|
get { return "The administration modification of the future."; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public TShock(Main game) : base (game)
|
|
||||||
public TShock(Main game)
|
public TShock(Main game)
|
||||||
: base(game)
|
: base(game)
|
||||||
{
|
{
|
||||||
|
|
@ -89,7 +81,6 @@ namespace TShockAPI
|
||||||
* */
|
* */
|
||||||
|
|
||||||
void NpcHooks_OnStrikeNpc(NpcStrikeEventArgs e)
|
void NpcHooks_OnStrikeNpc(NpcStrikeEventArgs e)
|
||||||
private void NpcHooks_OnStrikeNpc(NpcStrikeEventArgs e)
|
|
||||||
{
|
{
|
||||||
if (ConfigurationManager.infiniteInvasion)
|
if (ConfigurationManager.infiniteInvasion)
|
||||||
{
|
{
|
||||||
|
|
@ -102,7 +93,6 @@ namespace TShockAPI
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnPreGetData(byte id, messageBuffer msg, int idx, int length, HandledEventArgs e)
|
void OnPreGetData(byte id, messageBuffer msg, int idx, int length, HandledEventArgs e)
|
||||||
private void OnPreGetData(byte id, messageBuffer msg, int idx, int length, HandledEventArgs e)
|
|
||||||
{
|
{
|
||||||
if (Main.netMode != 2) { return; }
|
if (Main.netMode != 2) { return; }
|
||||||
if (id == 0x1e && ConfigurationManager.permaPvp)
|
if (id == 0x1e && ConfigurationManager.permaPvp)
|
||||||
|
|
@ -112,7 +102,6 @@ namespace TShockAPI
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetData(GetDataEventArgs e)
|
void GetData(GetDataEventArgs e)
|
||||||
private void GetData(GetDataEventArgs e)
|
|
||||||
{
|
{
|
||||||
if (Main.netMode != 2) { return; }
|
if (Main.netMode != 2) { return; }
|
||||||
if (e.MsgID == 17)
|
if (e.MsgID == 17)
|
||||||
|
|
@ -141,7 +130,6 @@ namespace TShockAPI
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnGreetPlayer(int who, HandledEventArgs e)
|
void OnGreetPlayer(int who, HandledEventArgs e)
|
||||||
private void OnGreetPlayer(int who, HandledEventArgs e)
|
|
||||||
{
|
{
|
||||||
if (Main.netMode != 2) { return; }
|
if (Main.netMode != 2) { return; }
|
||||||
int plr = who; //legacy support
|
int plr = who; //legacy support
|
||||||
|
|
@ -164,11 +152,8 @@ namespace TShockAPI
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnChat(int ply, string msg, HandledEventArgs handler)
|
void OnChat(int ply, string msg, HandledEventArgs handler)
|
||||||
private void OnChat(int ply, string msg, HandledEventArgs handler)
|
|
||||||
{
|
{
|
||||||
if (Main.netMode != 2) { return; }
|
if (Main.netMode != 2) { return; }
|
||||||
int x = (int) Main.player[ply].position.X;
|
|
||||||
int y = (int) Main.player[ply].position.Y;
|
|
||||||
int x = (int)Main.player[ply].position.X;
|
int x = (int)Main.player[ply].position.X;
|
||||||
int y = (int)Main.player[ply].position.Y;
|
int y = (int)Main.player[ply].position.Y;
|
||||||
|
|
||||||
|
|
@ -299,26 +284,26 @@ namespace TShockAPI
|
||||||
{
|
{
|
||||||
string player = msg.Remove(0, 3).Trim();
|
string player = msg.Remove(0, 3).Trim();
|
||||||
if (!(Tools.FindPlayer(player) == -1) && !(player == ""))
|
if (!(Tools.FindPlayer(player) == -1) && !(player == ""))
|
||||||
if (Tools.FindPlayer(player) != -1 && player != "")
|
if (Tools.FindPlayer(player) != -1 && player != "")
|
||||||
{
|
{
|
||||||
Teleport(ply, Main.player[Tools.FindPlayer(player)].position.X, Main.player[Tools.FindPlayer(player)].position.Y);
|
Teleport(ply, Main.player[Tools.FindPlayer(player)].position.X, Main.player[Tools.FindPlayer(player)].position.Y);
|
||||||
Tools.SendMessage(ply, "Teleported to " + player);
|
Tools.SendMessage(ply, "Teleported to " + player);
|
||||||
handler.Handled = true;
|
handler.Handled = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (msg.Length > 7 && msg.Substring(0, 7) == "/tphere")
|
if (msg.Length > 7 && msg.Substring(0, 7) == "/tphere")
|
||||||
{
|
{
|
||||||
string player = msg.Remove(0, 7).Trim();
|
string player = msg.Remove(0, 7).Trim();
|
||||||
if (!(Tools.FindPlayer(player) == -1) && !(player == ""))
|
if (!(Tools.FindPlayer(player) == -1) && !(player == ""))
|
||||||
if (Tools.FindPlayer(player) != -1 && player != "")
|
if (Tools.FindPlayer(player) != -1 && player != "")
|
||||||
{
|
{
|
||||||
Teleport(Tools.FindPlayer(player), Main.player[ply].position.X, Main.player[ply].position.Y);
|
Teleport(Tools.FindPlayer(player), Main.player[ply].position.X, Main.player[ply].position.Y);
|
||||||
Tools.SendMessage(Tools.FindPlayer(player), "You were teleported to " + Tools.FindPlayer(ply) + ".");
|
Tools.SendMessage(Tools.FindPlayer(player), "You were teleported to " + Tools.FindPlayer(ply) + ".");
|
||||||
Tools.SendMessage(ply, "You brought " + player + " here.");
|
Tools.SendMessage(ply, "You brought " + player + " here.");
|
||||||
handler.Handled = true;
|
handler.Handled = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (msg.Length > 9 && msg.Substring(0,9) == "/spawnmob")
|
if (msg.Length > 9 && msg.Substring(0, 9) == "/spawnmob")
|
||||||
{
|
{
|
||||||
string args = msg.Remove(0, 9).Trim();
|
string args = msg.Remove(0, 9).Trim();
|
||||||
int type = 0;
|
int type = 0;
|
||||||
|
|
@ -344,9 +329,7 @@ namespace TShockAPI
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void OnJoin(int ply, AllowEventArgs handler)
|
void OnJoin(int ply, AllowEventArgs handler)
|
||||||
private void OnJoin(int ply, AllowEventArgs handler)
|
|
||||||
{
|
{
|
||||||
if (Main.netMode != 2) { return; }
|
if (Main.netMode != 2) { return; }
|
||||||
string ip = Tools.GetRealIP((Convert.ToString(Netplay.serverSock[ply].tcpClient.Client.RemoteEndPoint)));
|
string ip = Tools.GetRealIP((Convert.ToString(Netplay.serverSock[ply].tcpClient.Client.RemoteEndPoint)));
|
||||||
|
|
@ -361,24 +344,19 @@ namespace TShockAPI
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnLoadContent(Microsoft.Xna.Framework.Content.ContentManager obj)
|
void OnLoadContent(Microsoft.Xna.Framework.Content.ContentManager obj)
|
||||||
private void OnLoadContent(Microsoft.Xna.Framework.Content.ContentManager obj)
|
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnPreInit()
|
void OnPreInit()
|
||||||
private void OnPreInit()
|
|
||||||
{
|
{
|
||||||
FileTools.SetupConfig();
|
FileTools.SetupConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnPostInit()
|
void OnPostInit()
|
||||||
private void OnPostInit()
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnUpdate(GameTime time)
|
void OnUpdate(GameTime time)
|
||||||
private void OnUpdate(GameTime time)
|
|
||||||
{
|
{
|
||||||
if (Main.netMode != 2) { return; }
|
if (Main.netMode != 2) { return; }
|
||||||
for (uint i = 0; i < Main.maxPlayers; i++)
|
for (uint i = 0; i < Main.maxPlayers; i++)
|
||||||
|
|
@ -435,7 +413,6 @@ namespace TShockAPI
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static void Teleport(int ply, int x, int y)
|
public static void Teleport(int ply, int x, int y)
|
||||||
{
|
{
|
||||||
Main.player[ply].velocity = new Vector2(0, 0);
|
Main.player[ply].velocity = new Vector2(0, 0);
|
||||||
|
|
@ -445,7 +422,6 @@ namespace TShockAPI
|
||||||
NetMessage.SendData(0x0d, -1, -1, "", ply);
|
NetMessage.SendData(0x0d, -1, -1, "", ply);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static void Teleport(int ply, float x, float y)
|
public static void Teleport(int ply, float x, float y)
|
||||||
{
|
{
|
||||||
Main.player[ply].position.X = x;
|
Main.player[ply].position.X = x;
|
||||||
|
|
@ -511,7 +487,6 @@ namespace TShockAPI
|
||||||
Tools.Broadcast(ConfigurationManager.killCount + " copies of Call of Duty smashed.");
|
Tools.Broadcast(ConfigurationManager.killCount + " copies of Call of Duty smashed.");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue