public static void CreateCharacter(IConnection connection, PlayerData playerData)
        {
            if (connection.Account.Players.Count >= 8 || PlayerService.CheckName(playerData.Name, 1) != CheckNameResult.Ok || !PlayerService.CheckNameForUse(playerData.Name, 1))
            {
                FeedbackService.SendCreateCharacterResult(connection, false);
                return;
            }
                Player player = PlayerService.CreateCharacter(connection, playerData);
                StorageService.AddStartItemsToPlayer(player);
                FeedbackService.SendCreateCharacterResult(connection, true);

                Cache.UsedNames.Add(playerData.Name.ToLower());
        }
Exemple #2
0
        public static void CreateCharacter(IConnection connection, PlayerData playerData)
        {
            if (connection.Account.Players.Count >= 5)
            {
                FeedbackService.SendCreateCharacterResult(connection, false);
            }

            Player player = PlayerService.CreateCharacter(connection, playerData);
            StorageService.AddStartItemsToPlayer(player);
            SkillsLearnService.AddStartPlayerAbility(player);

            FeedbackService.SendCreateCharacterResult(connection, true);
        }
Exemple #3
0
 public override void Read()
 {
     PlayerData = new PlayerData();
     PlayerData.Name = Encoding.Default.GetString(ReadB(15)).Replace("\0", "");
     ReadC(); // UNK
     PlayerData.Class = (PlayerClass)ReadC();
     PlayerData.HairStyle = ReadC();
     PlayerData.HairColor = ReadC();
     PlayerData.Face = ReadC();
     PlayerData.Voice = ReadC();
     ReadC(); // UNK
     PlayerData.Gender = (Gender)ReadC();
     ReadC(); // UNK
     ReadD(); // UNK
 }
Exemple #4
0
        public override void Release()
        {
            ObservedCreature = null;

            Inventory.Release();
            Inventory = null;

            PlayerData = null;

            try
            {
                Visible.Stop();
                Visible.Release();
            }
            // ReSharper disable EmptyGeneralCatchClause
            catch
            // ReSharper restore EmptyGeneralCatchClause
            {
                //Already stoped
            }
            Visible = null;

            Skills = null;

            Quests = null;

            if (CurrentDialog != null)
                CurrentDialog.Release();

            if (Pet != null)
                Pet.Release();
            Pet = null;

            MarkedCreatures = null;

            TeleportLoadMapEvent = null;

            try
            {
                SystemWindowsTimer.Stop();
                SystemWindowsTimer.Dispose();
            }
                // ReSharper disable EmptyGeneralCatchClause
            catch
                // ReSharper restore EmptyGeneralCatchClause
            {
            }
            SystemWindowsTimer = null;

            BlockersInChat = null;

            Friends = null;

            base.Release();
        }
Exemple #5
0
        public Player CreateCharacter(IConnection connection, PlayerData playerData)
        {
            Player player = new Player
            {
                PlayerData = playerData,
                Account = connection.Account,
                Position = new WorldPosition
                {
                    MapId = 101,
                    X = 300.0F,
                    Y = 1865.0F,
                    Z = 15.0F,
                },
            };

            player.ServerId = Properties.Settings.Default.SERVER_ID;
            player.GameStats = Global.Global.StatsService.InitStats(player);

            player.PlayerId = DataBasePlayer.SavePlayer(player, true);
            connection.Account.Players.Add(player);
            return player;
        }
Exemple #6
0
 public Player()
 {
     PlayerData = new PlayerData();
     Position = new WorldPosition();
 }
        public Player CreateCharacter(IConnection connection, PlayerData playerData)
        {
            Player player = new Player
                                {
                                    PlayerData = playerData,
                                    AccountName = connection.Account.Name,
                                    Position = new WorldPosition
                                                   {
                                                       MapId = 13,
                                                       X = 93492.0F,
                                                       Y = -88216.0F,
                                                       Z = -4523.0F,
                                                       Heading = unchecked((short) 0x8000),
                                                   },
                                };

            player.Id = DAOManager.playerDAO.SaveNewPlayer(player);
            connection.Account.Players.Add(player);

            return player;
        }
        public Player CreateCharacter(IConnection connection, PlayerData playerData)
        {
            Player player = new Player
            {
                PlayerData = playerData,
                AccountName = connection.Account.AccountName,
                Position = new WorldPosition
                {
                    MapId = 13,
                    X = 93492.0F,
                    Y = -88216.0F,
                    Z = -4523.0F,
                    Heading = unchecked((short)0x8000),
                },
            };

            player.PlayerId = DAOManager.playerDAO.SaveNewPlayer(player);

            DAOManager.inventoryDAO.SaveStorage(player, player.Inventory);
            DAOManager.playerDAO.UpdatePlayer(player);
            DAOManager.questDAO.AddQuests(player);
            DAOManager.skillDAO.SaveSkills(player);

            connection.Account.Players.Add(player);
            return player;
        }