Merge branch 'master' of git.assembla.com:terraria
This commit is contained in:
commit
e52a1d35b5
2 changed files with 32 additions and 17 deletions
|
|
@ -71,7 +71,7 @@ namespace TShockAPI
|
||||||
Tools.Broadcast(plStr + " was kicked by " + Tools.FindPlayer(ply));
|
Tools.Broadcast(plStr + " was kicked by " + Tools.FindPlayer(ply));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Tools.SendMessage(ply, "You can't ban another admin!", new float[] { 255f, 0f, 0f });
|
Tools.SendMessage(ply, "You can't kick another admin!", new float[] { 255f, 0f, 0f });
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Tools.SendMessage(ply, "Invalid player!", new float[] { 255f, 0f, 0f });
|
Tools.SendMessage(ply, "Invalid player!", new float[] { 255f, 0f, 0f });
|
||||||
|
|
@ -252,7 +252,7 @@ namespace TShockAPI
|
||||||
|
|
||||||
if (!int.TryParse(inputtype, out type))
|
if (!int.TryParse(inputtype, out type))
|
||||||
type = TShock.GetNPCID(inputtype);
|
type = TShock.GetNPCID(inputtype);
|
||||||
if (type >= 1 && type <= 43)
|
if (type >= 1 && type <= 45)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < amount; i++)
|
for (int i = 0; i < amount; i++)
|
||||||
npcid = NPC.NewNPC(x, y, type, 0);
|
npcid = NPC.NewNPC(x, y, type, 0);
|
||||||
|
|
@ -274,16 +274,22 @@ namespace TShockAPI
|
||||||
int type = 0;
|
int type = 0;
|
||||||
if (!int.TryParse(msgargs, out type))
|
if (!int.TryParse(msgargs, out type))
|
||||||
type = TShock.GetItemID(msgargs);
|
type = TShock.GetItemID(msgargs);
|
||||||
if (type >= 1 && type <= 235)
|
if (type >= 1 && type <= 238)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 40; i++)
|
for (int i = 0; i < 40; i++)
|
||||||
{
|
{
|
||||||
if (!Main.player[ply].inventory[i].active)
|
if (!Main.player[ply].inventory[i].active)
|
||||||
{
|
{
|
||||||
Main.player[ply].inventory[i].SetDefaults(type);
|
//Main.player[ply].inventory[i].SetDefaults(type);
|
||||||
Main.player[ply].inventory[i].stack = Main.player[ply].inventory[i].maxStack;
|
//Main.player[ply].inventory[i].stack = Main.player[ply].inventory[i].maxStack;
|
||||||
Tools.SendMessage(ply, "Got some " + Main.player[ply].inventory[i].name + ".");
|
int id = Terraria.Item.NewItem(0, 0, 0, 0, type, 1, true);
|
||||||
TShock.UpdateInventories();
|
Main.item[id].position.X = (float)args.PlayerX;
|
||||||
|
Main.item[id].position.Y = (float)args.PlayerY;
|
||||||
|
Main.item[id].stack = Main.item[id].maxStack;
|
||||||
|
//TShock.SendDataAll(21, -1, "", id);
|
||||||
|
NetMessage.SendData(21, -1, -1, "", id, 0f, 0f, 0f);
|
||||||
|
Tools.SendMessage(ply, "Got some " + Main.item[id].name + ".");
|
||||||
|
//TShock.UpdateInventories();
|
||||||
flag = true;
|
flag = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -311,7 +317,7 @@ namespace TShockAPI
|
||||||
int player = -1;
|
int player = -1;
|
||||||
if (!int.TryParse(msgargs[1], out type))
|
if (!int.TryParse(msgargs[1], out type))
|
||||||
type = TShock.GetItemID(msgargs[1]);
|
type = TShock.GetItemID(msgargs[1]);
|
||||||
if (type >= 1 && type <= 235)
|
if (type >= 1 && type <= 238)
|
||||||
{
|
{
|
||||||
player = Tools.FindPlayer(msgargs[2]);
|
player = Tools.FindPlayer(msgargs[2]);
|
||||||
if (player != -1)
|
if (player != -1)
|
||||||
|
|
@ -320,11 +326,17 @@ namespace TShockAPI
|
||||||
{
|
{
|
||||||
if (!Main.player[player].inventory[i].active)
|
if (!Main.player[player].inventory[i].active)
|
||||||
{
|
{
|
||||||
Main.player[player].inventory[i].SetDefaults(type);
|
//Main.player[player].inventory[i].SetDefaults(type);
|
||||||
Main.player[player].inventory[i].stack = Main.player[player].inventory[i].maxStack;
|
//Main.player[player].inventory[i].stack = Main.player[player].inventory[i].maxStack;
|
||||||
Tools.SendMessage(ply, string.Format("Gave {0} some {1}.", msgargs[2], Main.player[player].inventory[i].name));
|
int id = Terraria.Item.NewItem(0, 0, 0, 0, type, 1, true);
|
||||||
Tools.SendMessage(player, string.Format("{0} gave you some {1}.", Tools.FindPlayer(ply), Main.player[player].inventory[i].name));
|
Main.item[id].position.X = Main.player[player].position.X;
|
||||||
TShock.UpdateInventories();
|
Main.item[id].position.Y = Main.player[player].position.Y;
|
||||||
|
Main.item[id].stack = Main.item[id].maxStack;
|
||||||
|
//TShock.SendDataAll(21, -1, "", id);
|
||||||
|
NetMessage.SendData(21, -1, -1, "", id, 0f, 0f, 0f);
|
||||||
|
Tools.SendMessage(ply, string.Format("Gave {0} some {1}.", msgargs[2], Main.item[id].name));
|
||||||
|
Tools.SendMessage(player, string.Format("{0} gave you some {1}.", Tools.FindPlayer(ply), Main.item[id].name));
|
||||||
|
//TShock.UpdateInventories();
|
||||||
flag = true;
|
flag = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -173,11 +173,13 @@ namespace TShockAPI
|
||||||
if (e.MsgID == 0x0A) //SendSection
|
if (e.MsgID == 0x0A) //SendSection
|
||||||
{
|
{
|
||||||
Tools.Broadcast(string.Format("{0}({1}) attempted sending a section", Main.player[e.Msg.whoAmI].name, e.Msg.whoAmI));
|
Tools.Broadcast(string.Format("{0}({1}) attempted sending a section", Main.player[e.Msg.whoAmI].name, e.Msg.whoAmI));
|
||||||
|
Tools.Kick(e.Msg.whoAmI, "SendSection abuse.");
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
}
|
}
|
||||||
if (e.MsgID == 0x17) //Npc Data
|
if (e.MsgID == 0x17) //Npc Data
|
||||||
{
|
{
|
||||||
Tools.Broadcast(string.Format("{0}({1}) attempted spawning an NPC", Main.player[e.Msg.whoAmI].name, e.Msg.whoAmI));
|
Tools.Broadcast(string.Format("{0}({1}) attempted spawning an NPC", Main.player[e.Msg.whoAmI].name, e.Msg.whoAmI));
|
||||||
|
Tools.Kick(e.Msg.whoAmI, "Spawn NPC abuse");
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -265,6 +267,7 @@ namespace TShockAPI
|
||||||
{
|
{
|
||||||
FileTools.WriteGrief((int)i);
|
FileTools.WriteGrief((int)i);
|
||||||
Tools.Kick((int)i, "Kill tile abuse detected.");
|
Tools.Kick((int)i, "Kill tile abuse detected.");
|
||||||
|
Tools.Broadcast(Main.player[i].name + " was " + (ConfigurationManager.banTnt ? "banned" : "kicked") + " for kill tile abuse.");
|
||||||
}
|
}
|
||||||
tileThreshold[i] = 0;
|
tileThreshold[i] = 0;
|
||||||
}
|
}
|
||||||
|
|
@ -428,7 +431,7 @@ namespace TShockAPI
|
||||||
public static int GetNPCID(string name, bool exact = false)
|
public static int GetNPCID(string name, bool exact = false)
|
||||||
{
|
{
|
||||||
NPC npc = new NPC();
|
NPC npc = new NPC();
|
||||||
for (int i = 1; i <= 43; i++)
|
for (int i = 1; i <= 45; i++)
|
||||||
{
|
{
|
||||||
if (exact)
|
if (exact)
|
||||||
{
|
{
|
||||||
|
|
@ -453,7 +456,7 @@ namespace TShockAPI
|
||||||
{
|
{
|
||||||
Item item = new Item();
|
Item item = new Item();
|
||||||
name = name.ToLower();
|
name = name.ToLower();
|
||||||
for (int i = 1; i <= 235; i++)
|
for (int i = 1; i <= 238; i++)
|
||||||
{
|
{
|
||||||
item.SetDefaults(i);
|
item.SetDefaults(i);
|
||||||
if (item.name.ToLower().StartsWith(name))
|
if (item.name.ToLower().StartsWith(name))
|
||||||
|
|
@ -464,11 +467,11 @@ namespace TShockAPI
|
||||||
|
|
||||||
public static bool CheckInventory(int plr)
|
public static bool CheckInventory(int plr)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 44; i++)
|
/*for (int i = 0; i < 44; i++)
|
||||||
{
|
{
|
||||||
if (Main.player[plr].inventory[i].stack > Main.player[plr].inventory[i].maxStack)
|
if (Main.player[plr].inventory[i].stack > Main.player[plr].inventory[i].maxStack)
|
||||||
return true;
|
return true;
|
||||||
}
|
}*/
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue