Пример #1
0
        public Character(string name, string gender, string professionId)
            : base(name)
        {
            Gender     = gender;
            Profession = ProfessionDAO.GetProfession(professionId);
            if (gender != Profession.DefaultGender)
            {
                Profession.SwapDescriptions();
            }

            BaseAttributes = new Attributes()
            {
                Base = Profession.StartingAttributes
            };
            BaseTalents = new Talents()
            {
                Base = Profession.StartingTalents
            };
            Health = new Health()
            {
                MaxHP   = (int)Profession.StartingVitals[Vitals.HP],
                HPRegen = (int)Profession.StartingVitals[Vitals.HPRegen]
            };
            Stamina = new Stamina()
            {
                MaxSP   = (int)Profession.StartingVitals[Vitals.SP],
                SPRegen = (int)Profession.StartingVitals[Vitals.SPRegen]
            };
            EquipmentSlots = new Dictionary <string, EquipmentItem>()
            {
                { Slot.Body, ItemDAO.GenerateNewEquipmentItem(Profession.StartingEquipment[Slot.Body]) },
                { Slot.MainHand, ItemDAO.GenerateNewEquipmentItem(Profession.StartingEquipment[Slot.MainHand]) },
                { Slot.OffHand, ItemDAO.GenerateNewEquipmentItem(Profession.StartingEquipment[Slot.OffHand]) },
                { Slot.Charm1, ItemDAO.GenerateNewEquipmentItem(Profession.StartingEquipment[Slot.Charm1]) },
                { Slot.Charm2, ItemDAO.GenerateNewEquipmentItem(Profession.StartingEquipment[Slot.Charm2]) }
            };
            foreach (var kvp in Profession.StartingInventory)
            {
                for (int i = 0; i < kvp.Value; i++)
                {
                    Inventory.AddItem(ItemDAO.GenerateNewItem(kvp.Key));
                }
            }
            // Fill vitals to max after equipment bonuses are set
            HP = MaxHP;
            SP = MaxSP;
        }