コード例 #1
0
 public void SpamUpdate()
 {
     if (!Netplay.spamCheck)
     {
         this.SpamProjectile  = 0f;
         this.SpamDeleteBlock = 0f;
         this.SpamAddBlock    = 0f;
         this.SpamWater       = 0f;
         this.SpamItemFrame   = 0f;
         return;
     }
     if (this.SpamProjectile > this.SpamProjectileMax)
     {
         NetMessage.BootPlayer(this.Id, "Cheating attempt detected: Projectile spam");
     }
     if (this.SpamAddBlock > this.SpamAddBlockMax)
     {
         NetMessage.BootPlayer(this.Id, "Cheating attempt detected: Add tile spam");
     }
     if (this.SpamDeleteBlock > this.SpamDeleteBlockMax)
     {
         NetMessage.BootPlayer(this.Id, "Cheating attempt detected: Remove tile spam");
     }
     if (this.SpamWater > this.SpamWaterMax)
     {
         NetMessage.BootPlayer(this.Id, "Cheating attempt detected: Liquid spam");
     }
     if (this.SpamItemFrame > this.SpamItemFrameMax)
     {
         NetMessage.BootPlayer(this.Id, "Cheating attempt detected: Item frame spam");
     }
     SpamProjectile -= 0.4f;
     if (this.SpamProjectile < 0f)
     {
         this.SpamProjectile = 0f;
     }
     SpamAddBlock -= 0.3f;
     if (this.SpamAddBlock < 0f)
     {
         this.SpamAddBlock = 0f;
     }
     SpamDeleteBlock -= 5f;
     if (this.SpamDeleteBlock < 0f)
     {
         this.SpamDeleteBlock = 0f;
     }
     SpamWater -= 0.2f;
     if (this.SpamWater < 0f)
     {
         this.SpamWater = 0f;
     }
     SpamItemFrame -= 0.05f;
     if (this.SpamItemFrame < 0f)
     {
         this.SpamItemFrame = 0f;
     }
 }
コード例 #2
0
 public void SpamUpdate()
 {
     if (!Netplay.spamCheck)
     {
         this.SpamProjectile  = 0.0f;
         this.SpamDeleteBlock = 0.0f;
         this.SpamAddBlock    = 0.0f;
         this.SpamWater       = 0.0f;
     }
     else
     {
         if ((double)this.SpamProjectile > (double)this.SpamProjectileMax)
         {
             NetMessage.BootPlayer(this.Id, NetworkText.FromKey("Net.CheatingProjectileSpam"));
         }
         if ((double)this.SpamAddBlock > (double)this.SpamAddBlockMax)
         {
             NetMessage.BootPlayer(this.Id, NetworkText.FromKey("Net.CheatingTileSpam"));
         }
         if ((double)this.SpamDeleteBlock > (double)this.SpamDeleteBlockMax)
         {
             NetMessage.BootPlayer(this.Id, NetworkText.FromKey("Net.CheatingTileRemovalSpam"));
         }
         if ((double)this.SpamWater > (double)this.SpamWaterMax)
         {
             NetMessage.BootPlayer(this.Id, NetworkText.FromKey("Net.CheatingLiquidSpam"));
         }
         this.SpamProjectile -= 0.4f;
         if ((double)this.SpamProjectile < 0.0)
         {
             this.SpamProjectile = 0.0f;
         }
         this.SpamAddBlock -= 0.3f;
         if ((double)this.SpamAddBlock < 0.0)
         {
             this.SpamAddBlock = 0.0f;
         }
         this.SpamDeleteBlock -= 5f;
         if ((double)this.SpamDeleteBlock < 0.0)
         {
             this.SpamDeleteBlock = 0.0f;
         }
         this.SpamWater -= 0.2f;
         if ((double)this.SpamWater >= 0.0)
         {
             return;
         }
         this.SpamWater = 0.0f;
     }
 }
コード例 #3
0
ファイル: RemoteClient.cs プロジェクト: saniainf/EDTerraria
 public void SpamUpdate()
 {
     if (!Netplay.spamCheck)
     {
         this.SpamProjectile  = 0.0f;
         this.SpamDeleteBlock = 0.0f;
         this.SpamAddBlock    = 0.0f;
         this.SpamWater       = 0.0f;
     }
     else
     {
         if ((double)this.SpamProjectile > (double)this.SpamProjectileMax)
         {
             NetMessage.BootPlayer(this.Id, "Cheating attempt detected: Projectile spam");
         }
         if ((double)this.SpamAddBlock > (double)this.SpamAddBlockMax)
         {
             NetMessage.BootPlayer(this.Id, "Cheating attempt detected: Add tile spam");
         }
         if ((double)this.SpamDeleteBlock > (double)this.SpamDeleteBlockMax)
         {
             NetMessage.BootPlayer(this.Id, "Cheating attempt detected: Remove tile spam");
         }
         if ((double)this.SpamWater > (double)this.SpamWaterMax)
         {
             NetMessage.BootPlayer(this.Id, "Cheating attempt detected: Liquid spam");
         }
         this.SpamProjectile -= 0.4f;
         if ((double)this.SpamProjectile < 0.0)
         {
             this.SpamProjectile = 0.0f;
         }
         this.SpamAddBlock -= 0.3f;
         if ((double)this.SpamAddBlock < 0.0)
         {
             this.SpamAddBlock = 0.0f;
         }
         this.SpamDeleteBlock -= 5f;
         if ((double)this.SpamDeleteBlock < 0.0)
         {
             this.SpamDeleteBlock = 0.0f;
         }
         this.SpamWater -= 0.2f;
         if ((double)this.SpamWater >= 0.0)
         {
             return;
         }
         this.SpamWater = 0.0f;
     }
 }
コード例 #4
0
ファイル: ServerSock.cs プロジェクト: menfeng/terraria
 public void SpamUpdate()
 {
     if (!Netplay.spamCheck)
     {
         this.spamProjectile = 0f;
         this.spamDelBlock   = 0f;
         this.spamAddBlock   = 0f;
         this.spamWater      = 0f;
     }
     else
     {
         if (this.spamProjectile > this.spamProjectileMax)
         {
             NetMessage.BootPlayer(this.whoAmI, "Cheating attempt detected: Projectile spam");
         }
         if (this.spamAddBlock > this.spamAddBlockMax)
         {
             NetMessage.BootPlayer(this.whoAmI, "Cheating attempt detected: Add tile spam");
         }
         if (this.spamDelBlock > this.spamDelBlockMax)
         {
             NetMessage.BootPlayer(this.whoAmI, "Cheating attempt detected: Remove tile spam");
         }
         if (this.spamWater > this.spamWaterMax)
         {
             NetMessage.BootPlayer(this.whoAmI, "Cheating attempt detected: Liquid spam");
         }
         this.spamProjectile -= 0.4f;
         if (this.spamProjectile < 0f)
         {
             this.spamProjectile = 0f;
         }
         this.spamAddBlock -= 0.3f;
         if (this.spamAddBlock < 0f)
         {
             this.spamAddBlock = 0f;
         }
         this.spamDelBlock -= 5f;
         if (this.spamDelBlock < 0f)
         {
             this.spamDelBlock = 0f;
         }
         this.spamWater -= 0.2f;
         if (this.spamWater < 0f)
         {
             this.spamWater = 0f;
         }
     }
 }
コード例 #5
0
ファイル: RemoteClient.cs プロジェクト: windlex/mylualib
 // Token: 0x0600013E RID: 318 RVA: 0x00029940 File Offset: 0x00027B40
 public void SpamUpdate()
 {
     if (!Netplay.spamCheck)
     {
         this.SpamProjectile  = 0f;
         this.SpamDeleteBlock = 0f;
         this.SpamAddBlock    = 0f;
         this.SpamWater       = 0f;
         return;
     }
     if (this.SpamProjectile > this.SpamProjectileMax)
     {
         NetMessage.BootPlayer(this.Id, NetworkText.FromKey("Net.CheatingProjectileSpam", new object[0]));
     }
     if (this.SpamAddBlock > this.SpamAddBlockMax)
     {
         NetMessage.BootPlayer(this.Id, NetworkText.FromKey("Net.CheatingTileSpam", new object[0]));
     }
     if (this.SpamDeleteBlock > this.SpamDeleteBlockMax)
     {
         NetMessage.BootPlayer(this.Id, NetworkText.FromKey("Net.CheatingTileRemovalSpam", new object[0]));
     }
     if (this.SpamWater > this.SpamWaterMax)
     {
         NetMessage.BootPlayer(this.Id, NetworkText.FromKey("Net.CheatingLiquidSpam", new object[0]));
     }
     this.SpamProjectile -= 0.4f;
     if (this.SpamProjectile < 0f)
     {
         this.SpamProjectile = 0f;
     }
     this.SpamAddBlock -= 0.3f;
     if (this.SpamAddBlock < 0f)
     {
         this.SpamAddBlock = 0f;
     }
     this.SpamDeleteBlock -= 5f;
     if (this.SpamDeleteBlock < 0f)
     {
         this.SpamDeleteBlock = 0f;
     }
     this.SpamWater -= 0.2f;
     if (this.SpamWater < 0f)
     {
         this.SpamWater = 0f;
     }
 }
コード例 #6
0
        public override void Process(int whoAmI, byte[] readBuffer, int length, int num)
        {
            int x = BitConverter.ToInt32(readBuffer, num);

            num += 4;
            int y = BitConverter.ToInt32(readBuffer, num);

            num += 4;
            byte liquid   = readBuffer[num++];
            byte lavaFlag = readBuffer[num]++;

            var player = Main.players[whoAmI];

            if (NetPlay.spamCheck) // dead code...
            {
                int centerX          = (int)(player.Position.X + (float)(player.Width / 2));
                int centerY          = (int)(player.Position.Y + (float)(player.Height / 2));
                int disperseDistance = 10;
                int left             = centerX - disperseDistance;
                int right            = centerX + disperseDistance;
                int top    = centerY - disperseDistance;
                int bottom = centerY + disperseDistance;
                if (centerX < left || centerX > right || centerY < top || centerY > bottom)
                {
                    NetMessage.BootPlayer(whoAmI, "Cheating attempt detected: Liquid spam");
                    return;
                }
            }

            var ctx = new HookContext
            {
                Connection = player.Connection,
                Player     = player,
                Sender     = player,
            };

            var args = new HookArgs.LiquidFlowReceived
            {
                X      = x, Y = y,
                Amount = liquid,
                Lava   = lavaFlag == 1,
            };

            HookPoints.LiquidFlowReceived.Invoke(ref ctx, ref args);

            if (ctx.CheckForKick())
            {
                return;
            }

            if (ctx.Result == HookResult.IGNORE)
            {
                return;
            }

            if (ctx.Result == HookResult.RECTIFY)
            {
                var msg = NetMessage.PrepareThreadInstance();
                msg.FlowLiquid(x, y);
                msg.Send(whoAmI);
                return;
            }

            TileRef tile = Main.tile.At(x, y);
            {
                tile.SetLiquid(liquid);
                tile.SetLava(lavaFlag == 1);

                WorldModify.SquareTileFrame(null, null, x, y, true);
            }
        }
コード例 #7
0
        public bool Read(int bufferId, int start, int length)
        {
            var buffer = NetMessage.buffer[bufferId];
            var player = Main.player[bufferId];

            int  x          = (int)buffer.reader.ReadInt16();
            int  y          = (int)buffer.reader.ReadInt16();
            byte liquid     = buffer.reader.ReadByte();
            byte liquidType = buffer.reader.ReadByte();

            if (Main.netMode == 2 && Netplay.spamCheck)
            {
                int centerX = (int)(Main.player[bufferId].position.X + (float)(Main.player[bufferId].width / 2));
                int centerY = (int)(Main.player[bufferId].position.Y + (float)(Main.player[bufferId].height / 2));
                int range   = 10;
                int minX    = centerX - range;
                int maxX    = centerX + range;
                int minY    = centerY - range;
                int maxY    = centerY + range;
                if (x < minX || x > maxX || y < minY || y > maxY)
                {
                    NetMessage.BootPlayer(bufferId, "Cheating attempt detected: Liquid spam");
                    return(true);
                }
            }

            var ctx = new HookContext
            {
                Connection = player.Connection.Socket,
                Player     = player,
                Sender     = player
            };

            var args = new TDSMHookArgs.LiquidFlowReceived
            {
                X      = x,
                Y      = y,
                Amount = liquid,
                Lava   = liquidType == 1
            };

            TDSMHookPoints.LiquidFlowReceived.Invoke(ref ctx, ref args);

            if (ctx.CheckForKick())
            {
                return(true);
            }

            if (ctx.Result == HookResult.IGNORE)
            {
                return(true);
            }

            if (ctx.Result == HookResult.RECTIFY)
            {
                //                var msg = NewNetMessage.PrepareThreadInstance();
                //                msg.FlowLiquid(x, y);
                //                msg.Send(whoAmI);
                Terraria.NetMessage.SendData((int)Packet.FLOW_LIQUID, bufferId, -1, String.Empty, x, y);
                return(true);
            }

            if (Main.tile[x, y] == null)
            {
                Main.tile[x, y] = new OTA.Memory.MemTile();
            }
            lock (Main.tile[x, y])
            {
                Main.tile[x, y].liquid = liquid;
                Main.tile[x, y].liquidType((int)liquidType);
                if (Main.netMode == 2)
                {
                    WorldGen.SquareTileFrame(x, y, true);
                }
            }

            return(true);
        }