Esempio n. 1
0
 private static void StatusCheck()
 {
     while (IsEnabled)
     {
         if (Dict.Count > 0)
         {
             foreach (string _steamid in List)
             {
                 float    xf;
                 float    yf;
                 float    zf;
                 string[] _cords = JailPosition.Split(',');
                 float.TryParse(_cords[0], out xf);
                 float.TryParse(_cords[1], out yf);
                 float.TryParse(_cords[2], out zf);
                 int          x       = (int)xf;
                 int          y       = (int)yf;
                 int          z       = (int)zf;
                 ClientInfo   _cInfo  = ConnectionManager.Instance.GetClientInfoForPlayerId(_steamid);
                 EntityPlayer _player = GameManager.Instance.World.Players.dict[_cInfo.entityId];
                 if (_player.Spawned)
                 {
                     float _distance = _player.GetDistanceSq(new Vector3(xf, yf, zf));
                     int   _dis      = (int)_distance;
                     if (_dis > JailSize)
                     {
                         _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}{1}[-]", CustomCommands.ChatColor, _dis), "Server", false, "", false));
                         SdtdConsole.Instance.ExecuteSync(string.Format("tele {0} {1} {2} {3}", _cInfo.entityId, x, y, z), _cInfo);
                     }
                 }
             }
         }
         Thread.Sleep(1000);
     }
 }
        /// <summary>
        /// Do not make give this method the name canInteractWith because it clashes with Container
        /// </summary>
        public virtual bool IsUseableByPlayer(EntityPlayer par1EntityPlayer)
        {
            if (WorldObj.GetBlockTileEntity(XCoord, YCoord, ZCoord) != this)
            {
                return(false);
            }

            return(par1EntityPlayer.GetDistanceSq(XCoord + 0.5F, YCoord + 0.5F, ZCoord + 0.5F) <= 64);
        }
Esempio n. 3
0
        public override bool CanInteractWith(EntityPlayer par1EntityPlayer)
        {
            if (WorldObj.GetBlockId(PosX, PosY, PosZ) != Block.Workbench.BlockID)
            {
                return(false);
            }

            return(par1EntityPlayer.GetDistanceSq(PosX + 0.5F, PosY + 0.5F, PosZ + 0.5F) <= 64);
        }
 public static bool BattleLog(ClientInfo _cInfo)
 {
     try
     {
         EntityPlayer _player = PersistentOperations.GetEntityPlayer(_cInfo.playerId);
         if (_player != null)
         {
             List <EntityPlayer> _players = PersistentOperations.PlayerList();
             if (_players != null)
             {
                 for (int i = 0; i < _players.Count; i++)
                 {
                     EntityPlayer _player2 = _players[i];
                     if (_player2 != null && _player2 != _player)
                     {
                         EntityPlayer _damageTarget  = (EntityPlayer)_player.GetDamagedTarget();
                         EntityPlayer _attackTarget  = (EntityPlayer)_player.GetAttackTarget();
                         EntityPlayer _damageTarget2 = (EntityPlayer)_player2.GetDamagedTarget();
                         EntityPlayer _attackTarget2 = (EntityPlayer)_player2.GetAttackTarget();
                         if ((_damageTarget != null && _damageTarget == _player2 && !_damageTarget.IsFriendsWith(_player2)) ||
                             (_attackTarget != null && _attackTarget == _player2 && !_attackTarget.IsFriendsWith(_player2)) ||
                             (_damageTarget2 != null && _damageTarget2 == _player && !_damageTarget2.IsFriendsWith(_player)) ||
                             (_attackTarget2 != null && _attackTarget2 == _player && !_damageTarget2.IsFriendsWith(_player)))
                         {
                             float _distance = _player2.GetDistanceSq(_player);
                             if (_distance <= 80f)
                             {
                                 Timers.BattleLogTool(_cInfo.playerId);
                             }
                         }
                     }
                 }
             }
         }
         BattleLogger.Players.Remove(_cInfo.playerId);
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in API.BattleLog: {0}.", e.Message));
     }
     return(true);
 }