Esempio n. 1
0
        private void Login(CMSG_LOGIN cpkt)
        {
            if (cpkt.Cmd != 0x0501)
            {
                Trace.TraceError("Attempt to hack login protocol");
                WorldConnectionError();
                return;
            }

            try
            {
                Character tempCharacter = new Character(this, cpkt.CharacterId, cpkt.SessionId);
                if (Singleton.Database.TransLoad(tempCharacter) &&
                    Singleton.Zones.TryGetZone((uint)tempCharacter.map, out tempCharacter._currentzone))
                {
                    Singleton.Database.PostLoad(tempCharacter);
                    this.character = tempCharacter;
                    this.SendStart();
                    LifeCycle.Subscribe(this.character);
                    this.character.GmLevel = cpkt.GmLevel;
                    this.character.gender  = cpkt.Gender;
                }
                else
                {
                    WorldConnectionError();
                    LifeCycle.Unsubscribe(this.character);
                }
            }
            catch (Exception e)
            {
                //WRITE OUT ANY ERRORS
                Trace.TraceWarning(e.ToString());
                WorldConnectionError();
                LifeCycle.Unsubscribe(this.character);
            }
        }