Adding an update check system.
This commit is contained in:
parent
5dc0cf584c
commit
0dc7e3db06
3 changed files with 31 additions and 1 deletions
BIN
Terraria.suo
BIN
Terraria.suo
Binary file not shown.
|
|
@ -70,6 +70,7 @@
|
|||
ShankShock.handleCheater(plr);
|
||||
}
|
||||
ShankShock.showmotd(plr);
|
||||
ShankShock.showUpdateMinder(plr);
|
||||
if (ShankShock.permaPvp)
|
||||
{
|
||||
Main.player[plr].hostile = true;
|
||||
|
|
|
|||
|
|
@ -3,11 +3,15 @@ using System.Collections.Generic;
|
|||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
|
||||
namespace Terraria
|
||||
{
|
||||
class ShankShock
|
||||
{
|
||||
private static string version = "1";
|
||||
private static bool shownVersion = false;
|
||||
|
||||
public static bool enableGuide = true;
|
||||
public static int invasionMultiplier = 1;
|
||||
public static int defaultMaxSpawns = 4;
|
||||
|
|
@ -31,8 +35,33 @@ namespace Terraria
|
|||
EYE=1,
|
||||
SKELETRON=2
|
||||
}
|
||||
public ShankShock()
|
||||
|
||||
public static void showUpdateMinder(int ply)
|
||||
{
|
||||
if (!shownVersion)
|
||||
{
|
||||
if (isAdmin(findPlayer(ply)))
|
||||
{
|
||||
WebClient client = new WebClient();
|
||||
client.Headers.Add("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.0.3705;)");
|
||||
try
|
||||
{
|
||||
string updateVersion = client.DownloadString("http://shankshock.com/tshock.txt");
|
||||
string[] changes = updateVersion.Split(',');
|
||||
float[] color = { 255, 255, 0 };
|
||||
if (updateVersion != version)
|
||||
{
|
||||
sendMessage(ply, "This server is out of date. Version " + updateVersion + " is out.", color);
|
||||
sendMessage(ply, changes[1], color);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_writeError(e.Message);
|
||||
}
|
||||
shownVersion = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void incrementKills()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue