Exemple #1
0
        public static void PlayerLogin(LoginClient client, uint id)
        {
            if (client.Account == null)
            {
                client.Close("Tried to login with a character without an account.");
                return;
            }
            DataObject[] chars = DataServer.Database.SelectObjects(typeof(DBCharacter), "Character_ID = '" + id + "'");
            if (chars.Length == 0)
            {
                client.Close("Failed to find character in database?");
                return;
            }
            DBCharacter c = (DBCharacter)chars[0];

            if (c.AccountID != client.Account.ObjectId)
            {
                client.Close("Tried to login another account's character.");
                return;
            }
            client.Character = c;
            if (c.WorldMapID == 0)
            {
                client.Close(c.Name + " is missing world map id.");
                return;
            }
            client.WorldConnection = (WorldConnection)m_worldMapServer[c.WorldMapID];
            if (client.WorldConnection == null)
            {
                client.Close("Missing worldserver for world map id " + c.WorldMapID);
                return;
            }
            m_loginCharacters[id] = client;
            client.OnEnterWorld();
        }
        public static void PlayerLogin(LoginClient client, uint id)
        {
            if (client.Account == null)
            {
                client.Close("Tried to login with a character without an account.");
                return;
            }
            DataObject[] chars = DataServer.Database.SelectObjects(typeof(DBCharacter), "Character_ID = '" + id + "'");
            if (chars.Length == 0)
            {
                client.Close("Failed to find character in database?");
                return;
            }
            DBCharacter c = (DBCharacter)chars[0];

            if (c.AccountID != client.Account.ObjectId)
            {
                client.Close("Tried to login another account's character.");
                return;
            }
            client.Character = c;
            if (client.Character.GuildID != 0)
            {
                DBGuild guild = (DBGuild)DataServer.Database.FindObjectByKey((typeof(DBGuild)), client.Character.GuildID);
                if (guild != null)
                {
                    client.Character.Guild     = guild;
                    client.Character.GuildName = guild.Name;
                }
                else
                {
                    client.Character.GuildID   = 0;
                    client.Character.GuildRank = 0;
                    client.Character.GuildName = " ";
                }
            }
            string[] RemoteIP = client.RemoteEndPoint.ToString().Split(':');
            client.Account.LastIP = RemoteIP[0];
            if (c.WorldMapID == 0)
            {
                client.Close(c.Name + " is missing world map id.");
                return;
            }
            client.WorldConnection = (WorldConnection)m_worldMapServer[c.WorldMapID];
            if (client.WorldConnection == null)
            {
                client.Close("Missing worldserver for world map id " + c.WorldMapID);
                return;
            }
            m_loginCharacters[id] = client;
            FriendIsOnline(client);
            client.OnEnterWorld();
//			client.WorldConnection.OnEnterWorld(client.Character, client.Account.AccessLvl);
        }