GetLife() 공개 메소드

public GetLife ( string name ) : Life2DZone
name string
리턴 Life2DZone
예제 #1
0
 private void LifeCreateCallback(Player player, Vector3I[] marks, object state)
 {
     try {
         lock (_world.SyncRoot) {
             if (!CheckWorldPermissions(player))
             {
                 return;
             }
             if (null == _world.Map)
             {
                 return;
             }
             if (null != _world.GetLife(_name))     //check it again, since smone could create it in between
             {
                 player.Message("&WLife with such name exists already, choose another");
                 return;
             }
             Life2DZone life = new Life2DZone(_name, _world.Map, marks, player, (player.Info.Rank.NextRankUp ?? player.Info.Rank).Name);
             if (_world.TryAddLife(life))
             {
                 player.Message("&yLife was created. Named " + _name);
             }
             else
             {
                 player.Message("&WCoulnd't create life for some reason unknown.");   //really unknown: we are under a lock so nobody could create a life with the same name in between
             }
         }
     } catch (Exception e) {
         player.Message("&WCreate life error: " + e.Message);
     }
 }
예제 #2
0
        private bool CheckAndGetLifeZone(Player p, Command cmd)
        {
            _life  = null;
            _world = null;
            _name  = cmd.Next();
            if (String.IsNullOrWhiteSpace(_name))
            {
                p.Message("&WLife name is missing or empty");
                return(false);
            }

            _world = p.World;
            if (null == _world)
            {
                p.Message("&WYou are in limbo state. Prepare for eternal torment.");
                return(false);
            }

            lock (_world.SyncRoot)
            {
                if (null == _world.Map)
                {
                    return(false);
                }
                _life = _world.GetLife(_name);
                return(true);
            }
        }
예제 #3
0
        private bool CheckAndGetLifeZone(Player p, Command cmd)
        {
            _life = null;
            _world = null;
            _name = cmd.Next();
            if (String.IsNullOrWhiteSpace(_name))
            {
                p.Message("&WLife name is missing or empty");
                return false;
            }

            _world = p.World;
            if (null == _world)
            {
                p.Message("&WYou are in limbo state. Prepare for eternal torment.");
                return false;
            }

            lock (_world.SyncRoot)
            {
                if (null == _world.Map)
                    return false;
                _life = _world.GetLife(_name);
                return true;
            }
        }