Exemple #1
0
        public void AddStartItemsToPlayer(Player player)
        {
            AddItem(player, player.Inventory, new StorageItem {
                ItemId = 1000000902, Amount = 1, State = ItemState.NEW
            });

            switch (player.PlayerData.Class)
            {
            case PlayerClass.Blademan:
                AddItem(player, player.Inventory, new StorageItem {
                    ItemId = 100200001, Amount = 1, State = ItemState.NEW
                });
                break;

            case PlayerClass.Swordman:
                AddItem(player, player.Inventory, new StorageItem {
                    ItemId = 200200001, Amount = 1, State = ItemState.NEW
                });
                break;

            case PlayerClass.Spearman:
                AddItem(player, player.Inventory, new StorageItem {
                    ItemId = 300200001, Amount = 1, State = ItemState.NEW
                });
                break;

            case PlayerClass.Bowman:
                AddItem(player, player.Inventory, new StorageItem {
                    ItemId = 400200001, Amount = 1, State = ItemState.NEW
                });
                break;

            case PlayerClass.Medic:
                AddItem(player, player.Inventory, new StorageItem {
                    ItemId = 500200001, Amount = 1, State = ItemState.NEW
                });
                break;

            case PlayerClass.Ninja:
                AddItem(player, player.Inventory, new StorageItem {
                    ItemId = 600200001, Amount = 1, State = ItemState.NEW
                });
                break;

            case PlayerClass.Busker:
                AddItem(player, player.Inventory, new StorageItem {
                    ItemId = 700200001, Amount = 1, State = ItemState.NEW
                });
                break;

            case PlayerClass.Hanbi:
                AddItem(player, player.Inventory, new StorageItem {
                    ItemId = 100204001, Amount = 1, State = ItemState.NEW
                });
                break;
            }
            DataBaseStorage.SavePlayerStorage(player.PlayerId, player.Inventory);
        }
Exemple #2
0
        private IConnectionData GetMsSqlConnectionData(XDocument configFile)
        {
            var provider = new ServerProvider()
            {
                Name = configFile.Element("DataProvider").Element("Provider").Value
            };
            var database = new DataBaseStorage()
            {
                Name = configFile.Element("DataProvider").Element("DataBase").Value
            };
            var credentials = new MsSqlLoginPasswordCredentials()
            {
                Login = configFile.Element("DataProvider").Element("Login").Value, Password = configFile.Element("DataProvider").Element("Password").Value
            };

            return(new MsSqlConnectionData(provider, database, credentials));
        }
Exemple #3
0
        public void Authorized(IConnection connection, string accountName, string password)
        {
            connection.Account            = DataBaseAccount.GetAccountByName(accountName);
            connection.Account.Connection = connection;
            connection.Account.Players    = DataBasePlayer.GetPlayers(connection.Account, Properties.Settings.Default.SERVER_ID);
            connection.Account.SessionID  = (int)IdFactory.GetNext();

            for (int i = 0; i < connection.Account.Players.Count; i++)
            {
                connection.Account.Players[i].Inventory          = DataBaseStorage.GetPlayerStorage(connection.Account.Players[i].PlayerId, StorageType.Inventory);
                connection.Account.Players[i].Abilities          = DataBaseAbility.GetPlayerAbility(connection.Account.Players[i].PlayerId, SkillType.Basic);
                connection.Account.Players[i].AscensionAbilities = DataBaseAbility.GetPlayerAbility(connection.Account.Players[i].PlayerId, SkillType.Ascension);
                connection.Account.Players[i].Skills             = DataBaseSkill.GetPlayerSkill(connection.Account.Players[i].PlayerId, SkillType.Basic);
                connection.Account.Players[i].PassiveSkills      = DataBaseSkill.GetPlayerSkill(connection.Account.Players[i].PlayerId, SkillType.Passive);
                connection.Account.Players[i].AscensionSkills    = DataBaseSkill.GetPlayerSkill(connection.Account.Players[i].PlayerId, SkillType.Ascension);
                connection.Account.Players[i].Quests             = DataBaseQuest.GetPlayerQuest(connection.Account.Players[i].PlayerId);
            }

            DataBaseAccount.SaveLastIP(connection.Account.id, (connection as OuterNetworkConnection).IpAddress);
            Global.Global.FeedbackService.OnAuthorized(connection);
        }
Exemple #4
0
        public void PlayerEndGame(Player player)
        {
            if (player.Ai != null)
            {
                player.Ai.Release();
                player.Ai = null;
            }

            AccountService.IdFactory.Release(player.Account.SessionID);

            DataBasePlayer.SavePlayer(player);
            DataBaseStorage.SavePlayerStorage(player.PlayerId, player.Inventory);
            DataBaseAbility.SavePlayerAbility(player, SkillType.Basic);
            DataBaseAbility.SavePlayerAbility(player, SkillType.Ascension);

            DataBaseSkill.SavePlayerSkill(player, SkillType.Basic);
            DataBaseSkill.SavePlayerSkill(player, SkillType.Ascension);
            DataBaseSkill.SavePlayerSkill(player, SkillType.Passive);

            DataBaseQuest.SavePlayerQuest(player);

            PlayersOnline.Remove(player);
        }