Ejemplo n.º 1
0
        public DAL.Party GameToDAO(CharacterClassLibrary.Party party)
        {
            var list = new List <DAL.Player>();

            foreach (var player in party.Players)
            {
                var DAOPlayer = new DAL.Player();
                DAOPlayer.Name       = player.Name;
                DAOPlayer.Health     = player.Health;
                DAOPlayer.Strength   = player.Strength;
                DAOPlayer.SpellPower = player.SpellPower;
                DAOPlayer.Crit       = player.Crit;
                DAOPlayer.Armor      = player.Armor;
                DAOPlayer.Level      = player.Level;
                DAOPlayer.Xp         = player.Xp;
                DAOPlayer.Items      = convertItems(player.Items);
                DAOPlayer.ItemTypes  = convertItemTypes(player.ItemTypes);
                DAOPlayer.ClassName  = Convert.ToInt32(player.ClassName);
                list.Add(DAOPlayer);
            }
            var DALParty = new DAL.Party(list);

            DALParty.Money = party.Money;
            DALParty.Map   = party.Map;
            DALParty.Side  = party.Side;
            return(DALParty);
        }
Ejemplo n.º 2
0
        private CharacterClassLibrary.Player generatePlayer(DAL.Player DAOPlayer)
        {
            var playerClass = (ClassName)Enum.Parse(typeof(ClassName), DAOPlayer.ClassName.ToString());
            var player      = CharacterClassLibrary.Player.Create(playerClass);

            player.Name       = DAOPlayer.Name;
            player.Health     = DAOPlayer.Health;
            player.MaxHealth  = player.Health;
            player.Strength   = DAOPlayer.Strength;
            player.SpellPower = DAOPlayer.SpellPower;
            player.Crit       = DAOPlayer.Crit;
            player.Armor      = DAOPlayer.Armor;
            player.Level      = DAOPlayer.Level;
            player.Xp         = DAOPlayer.Xp;
            player.Items      = convertItems(DAOPlayer.Items);
            return(player);
        }