Merge fail

This commit is contained in:
Deathmax 2012-01-20 14:35:59 +08:00
parent 733be6b84e
commit 672d360e9d
5 changed files with 25 additions and 20 deletions

View file

@ -1514,25 +1514,26 @@ namespace TShockAPI
var dmg = args.Data.ReadInt16();
var owner = args.Data.ReadInt8();
var type = args.Data.ReadInt8();
var index = TShock.Utils.SearchProjectile(ident);
owner = (byte)args.Player.Index;
var index = TShock.Utils.SearchProjectile(ident, owner);
if (OnNewProjectile(ident, pos, vel, knockback, dmg, owner, type, index))
return true;
if (index > Main.maxProjectiles || index < 0)
{
return true;
return false;
}
if (args.Player.Index != owner)
// Server now checks owner + ident, if owner is different, server will create new projectile.
/*if (args.Player.Index != owner)
{
args.Player.Disable("Owner and player ID does not match to update projectile");
args.Player.RemoveProjectile(ident, owner);
return true;
}
}*/
if (dmg > TShock.Config.MaxProjDamage)
if (dmg > TShock.Config.MaxProjDamage && !args.Player.Group.HasPermission(Permissions.ignoredamagecap))
{
args.Player.Disable(String.Format("Projectile damage is higher than {0}", TShock.Config.MaxProjDamage));
args.Player.RemoveProjectile(ident, owner);
@ -1577,22 +1578,23 @@ namespace TShockAPI
{
var ident = args.Data.ReadInt16();
var owner = args.Data.ReadInt8();
var index = TShock.Utils.SearchProjectile(ident);
owner = (byte)args.Player.Index;
var index = TShock.Utils.SearchProjectile(ident, owner);
if (index > Main.maxProjectiles || index < 0)
{
return true;
return false;
}
var type = Main.projectile[index].type;
if (args.Player.Index != Main.projectile[index].owner && type != 102 && type != 100 && !TShock.Config.IgnoreProjKill) // workaround for skeletron prime projectiles
// Players can no longer destroy projectiles that are not theirs as of 1.1.2
/*if (args.Player.Index != Main.projectile[index].owner && type != 102 && type != 100 && !TShock.Config.IgnoreProjKill) // workaround for skeletron prime projectiles
{
args.Player.Disable("Owner and player ID does not match to kill projectile");
args.Player.RemoveProjectile(ident, owner);
return true;
}
}*/
if (TShock.CheckIgnores(args.Player))
{
@ -2025,7 +2027,7 @@ namespace TShockAPI
if (TShock.Players[id] == null)
return true;
if (dmg > TShock.Config.MaxDamage)
if (dmg > TShock.Config.MaxDamage && !args.Player.Group.HasPermission(Permissions.ignoredamagecap))
{
args.Player.Disable(String.Format("Player damage exceeded {0}", TShock.Config.MaxDamage ) );
args.Player.SendData(PacketTypes.PlayerHp, "", id);
@ -2078,7 +2080,7 @@ namespace TShockAPI
if (Main.npc[id] == null)
return true;
if (dmg > TShock.Config.MaxDamage)
if (dmg > TShock.Config.MaxDamage && !args.Player.Group.HasPermission(Permissions.ignoredamagecap))
{
args.Player.Disable(String.Format("NPC damage exceeded {0}", TShock.Config.MaxDamage ) );
args.Player.SendData(PacketTypes.NpcUpdate, "", id);
@ -2093,7 +2095,7 @@ namespace TShockAPI
if (Main.npc[id].townNPC && !args.Player.Group.HasPermission(Permissions.movenpc))
{
args.Player.SendMessage( "What?", Color.Yellow);
args.Player.SendMessage( "You don't have permission to move the NPC", Color.Yellow);
args.Player.SendData(PacketTypes.NpcUpdate, "", id);
return true;
}

View file

@ -63,6 +63,9 @@ namespace TShockAPI
[Description("Prevents you from being kicked by hacked health detection")] public static readonly string
ignorestathackdetection;
[Description("Prevents your actions from being ignored if damage is too high")] public static readonly string
ignoredamagecap;
[Description("Specific log messages are sent to users with this permission")] public static readonly string logs;
[Description("Allows you to bypass the max slots for up to 5 slots above your max")] public static readonly string

View file

@ -48,5 +48,5 @@ using System.Runtime.InteropServices;
// Build Number
// MMdd of the build
[assembly: AssemblyVersion("3.4.5.0118")]
[assembly: AssemblyFileVersion("3.4.5.0118")]
[assembly: AssemblyVersion("3.4.5.0120")]
[assembly: AssemblyFileVersion("3.4.5.0120")]

View file

@ -1068,7 +1068,7 @@ namespace TShockAPI
return true;
}
if (proj.hostile)
if (Main.projHostile[type])
{
//player.SendMessage( proj.name, Color.Yellow);
return true;

View file

@ -624,14 +624,14 @@ namespace TShockAPI
return true;
}
public int SearchProjectile(short identity)
public int SearchProjectile(short identity, int owner)
{
for (int i = 0; i < Main.maxProjectiles; i++)
{
if (Main.projectile[i].identity == identity)
if (Main.projectile[i].identity == identity && Main.projectile[i].owner == owner)
return i;
}
return 1001;
return 1000;
}
public string SanitizeString(string str)