Пример #1
0
 public bool PayXPLevels(Player who, short levels)
 {
     Experience exp = new Experience(this);
     Experience exw = new Experience(who);
     if (exp.LevelExp >= levels)
     {
         exw.Add(levels);
         exp.Remove(levels);
         return true;
     }
     return false;
 }
Пример #2
0
        /// <summary>
        /// Start this instance.
        /// </summary>
        public void Start()
        {
            try
            {
                pos = new double[3] { 0, 72, 0 };
                //oldpos = new double[3] { 0, 0, 0 };
                rot = new float[2] { 0,0 };
                Stance = 72;

                e = new Entity(this, Server.mainlevel);

                ip = socket.RemoteEndPoint.ToString().Split(':')[0];

                inventory = new Inventory(this);
                experience = new Experience(this);
                players.Add(this);
                //Event --------------------
                if (PlayerConnect != null)
                    PlayerConnect(this);
                //Event --------------------
                socket.BeginReceive(tempbuffer, 0, tempbuffer.Length, SocketFlags.None, new AsyncCallback(Receive), this);
            }
            catch (Exception e)
            {
                Logger.Log(e.Message);
                Logger.Log(e.StackTrace);
            }
        }