Merge branch 'master' of git.assembla.com:terraria into api
Conflicts: .gitignore
This commit is contained in:
commit
3ccdba9f51
4 changed files with 70 additions and 9 deletions
7
.gitignore
vendored
7
.gitignore
vendored
|
|
@ -6,6 +6,8 @@
|
||||||
*.exe
|
*.exe
|
||||||
*.o
|
*.o
|
||||||
*.so
|
*.so
|
||||||
|
/bin/*
|
||||||
|
/obj/*
|
||||||
|
|
||||||
# Packages #
|
# Packages #
|
||||||
############
|
############
|
||||||
|
|
@ -32,8 +34,6 @@
|
||||||
ehthumbs.db
|
ehthumbs.db
|
||||||
Icon?
|
Icon?
|
||||||
Thumbs.db
|
Thumbs.db
|
||||||
/bin
|
|
||||||
/obj
|
|
||||||
|
|
||||||
|
|
||||||
# Visual Studio shit Motherfucka #
|
# Visual Studio shit Motherfucka #
|
||||||
|
|
@ -43,4 +43,5 @@ Thumbs.db
|
||||||
*.opensdf
|
*.opensdf
|
||||||
*.cache
|
*.cache
|
||||||
*.txt
|
*.txt
|
||||||
*.pdb
|
*.pdb
|
||||||
|
*.csproj.user
|
||||||
|
|
|
||||||
|
|
@ -63,6 +63,16 @@ namespace TShockAPI
|
||||||
ServerHooks.OnChat += new Action<int, string, HandledEventArgs>(OnChat);
|
ServerHooks.OnChat += new Action<int, string, HandledEventArgs>(OnChat);
|
||||||
ServerHooks.OnJoin += new Action<int, AllowEventArgs>(OnJoin);
|
ServerHooks.OnJoin += new Action<int, AllowEventArgs>(OnJoin);
|
||||||
NetHooks.OnGreetPlayer += new NetHooks.GreetPlayerD(OnGreetPlayer);
|
NetHooks.OnGreetPlayer += new NetHooks.GreetPlayerD(OnGreetPlayer);
|
||||||
|
NetHooks.OnPreGetData += new NetHooks.GetDataD(OnPreGetData);
|
||||||
|
}
|
||||||
|
|
||||||
|
void OnPreGetData(byte id, messageBuffer msg, int idx, int length, HandledEventArgs e)
|
||||||
|
{
|
||||||
|
if (id == 0x1e && permaPvp)
|
||||||
|
{
|
||||||
|
e.Handled = true;
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -330,15 +340,15 @@ namespace TShockAPI
|
||||||
|
|
||||||
public static void HandleCheater(int ply)
|
public static void HandleCheater(int ply)
|
||||||
{
|
{
|
||||||
string cheater = ShankShock.FindPlayer(ply);
|
string cheater = FindPlayer(ply);
|
||||||
string ip = ShankShock.GetRealIP(Convert.ToString(Netplay.serverSock[ply].tcpClient.Client.RemoteEndPoint));
|
string ip = GetRealIP(Convert.ToString(Netplay.serverSock[ply].tcpClient.Client.RemoteEndPoint));
|
||||||
|
|
||||||
_writecheater(ply);
|
WriteCheater(ply);
|
||||||
if (!kickCheater) { return; }
|
if (!kickCheater) { return; }
|
||||||
Netplay.serverSock[ply].kill = true;
|
Netplay.serverSock[ply].kill = true;
|
||||||
Netplay.serverSock[ply].Reset();
|
Netplay.serverSock[ply].Reset();
|
||||||
NetMessage.syncPlayers();
|
NetMessage.syncPlayers();
|
||||||
ShankShock.Broadcast(cheater + " was " + (banCheater ? "banned " : "kicked ") + "for cheating.");
|
Broadcast(cheater + " was " + (banCheater ? "banned " : "kicked ") + "for cheating.");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -441,7 +451,7 @@ namespace TShockAPI
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
_writeError(e.Message);
|
WriteError(e.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -449,5 +459,50 @@ namespace TShockAPI
|
||||||
}
|
}
|
||||||
tr.Close();
|
tr.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static T Clamp<T>(T value, T max, T min)
|
||||||
|
where T : System.IComparable<T>
|
||||||
|
{
|
||||||
|
T result = value;
|
||||||
|
if (value.CompareTo(max) > 0)
|
||||||
|
result = max;
|
||||||
|
if (value.CompareTo(min) < 0)
|
||||||
|
result = min;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void WriteCheater(int ply)
|
||||||
|
{
|
||||||
|
string ip = GetRealIP(Convert.ToString(Netplay.serverSock[ply].tcpClient.Client.RemoteEndPoint));
|
||||||
|
string cheaters = "";
|
||||||
|
TextReader tr = new StreamReader(saveDir + "cheaters.txt");
|
||||||
|
cheaters = tr.ReadToEnd();
|
||||||
|
tr.Close();
|
||||||
|
if (cheaters.Contains(Main.player[ply].name) && cheaters.Contains(ip)) { return; }
|
||||||
|
TextWriter sw = new StreamWriter(saveDir + "cheaters.txt", true);
|
||||||
|
sw.WriteLine("[" + Main.player[ply].name + "] " + "[" + ip + "]");
|
||||||
|
sw.Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string GetPlayers()
|
||||||
|
{
|
||||||
|
string str = "";
|
||||||
|
for (int i = 0; i < 8; i++)
|
||||||
|
{
|
||||||
|
if (Main.player[i].active)
|
||||||
|
{
|
||||||
|
if (str == "")
|
||||||
|
{
|
||||||
|
str = str + Main.player[i].name;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
str = str + ", " + Main.player[i].name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
<SchemaVersion>2.0</SchemaVersion>
|
<SchemaVersion>2.0</SchemaVersion>
|
||||||
<ProjectGuid>{1528EA3F-A6D2-49F6-BF75-7A842CF4D97B}</ProjectGuid>
|
<ProjectGuid>{1528EA3F-A6D2-49F6-BF75-7A842CF4D97B}</ProjectGuid>
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
<AssemblyName>Terraria</AssemblyName>
|
<AssemblyName>TShock</AssemblyName>
|
||||||
<OutputType>WinExe</OutputType>
|
<OutputType>WinExe</OutputType>
|
||||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
@ -29,6 +29,9 @@
|
||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
<PropertyGroup>
|
||||||
|
<ApplicationIcon>lbolt.ico</ApplicationIcon>
|
||||||
|
</PropertyGroup>
|
||||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="Microsoft.Xna.Framework.Game" />
|
<Reference Include="Microsoft.Xna.Framework.Game" />
|
||||||
|
|
@ -65,8 +68,10 @@
|
||||||
<Compile Include="Terraria\NetMessage.cs" />
|
<Compile Include="Terraria\NetMessage.cs" />
|
||||||
<Compile Include="Terraria\Dust.cs" />
|
<Compile Include="Terraria\Dust.cs" />
|
||||||
<Compile Include="Terraria\Player.cs" />
|
<Compile Include="Terraria\Player.cs" />
|
||||||
|
<Reference Include="System.Drawing" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Content Include="lbolt.ico" />
|
||||||
<Content Include="Terraria\Game.ico" />
|
<Content Include="Terraria\Game.ico" />
|
||||||
<Content Include="Terraria\GameThumbnail.png" />
|
<Content Include="Terraria\GameThumbnail.png" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
|
||||||
BIN
Terraria/lbolt.ico
Normal file
BIN
Terraria/lbolt.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
Loading…
Add table
Add a link
Reference in a new issue