public Character(
            SerializableCharacter serializableCharacter,
            ITalentsManager manager,
            IRacesManager racesManager = null,
            IClassManager classManager = null
            )
            : this(serializableCharacter.Name, manager)
        {
            if (racesManager == null)
                racesManager = RacesManager.Instance;
            if (classManager == null)
                classManager = ClassManager.Instance;

            if (serializableCharacter.Talents != null)
            {
                foreach (var item in serializableCharacter.Talents)
                {
                    try
                    {
                        Talent talent = GetTalent(item.id);

                        if (item.bonus)
                        {
                            talent.Increment(item.level - 1);
                        }
                        else
                        {
                            talent.Increment(item.level);
                        }
                        talent.HaveBonus = item.bonus;
                        talent.SpeLevel = item.speLevel;
                    }
                    catch
                    {
                        continue;
                    }
                }
            }
            _aspectBonus = serializableCharacter.AspectBonus;
            _aspectMalus = serializableCharacter.AspectMalus;
            _race = racesManager.GetRace(serializableCharacter.Race);
            if (serializableCharacter.Classe != null && !serializableCharacter.Classe.Equals(""))
                classeChar = classManager.getFormName(serializableCharacter.Classe);
            else
                classeChar = null;
            ExperienceAvailable = serializableCharacter.Experience;
            Inventaire = serializableCharacter.Inventaire;
            if (_race != null)
                _bonusAspect = _race.AspectBonus;
            penPoid = serializableCharacter.penPoid;
            inventory = serializableCharacter.Inventory ?? new Inventory();
            RecomputePA();
        }
Пример #2
0
 private void OnCharacterChanged(Character caller)
 {
     inventory = caller.Inventory;
     inventory.TrinketChanged += () => OnPropertyChanged(null);
     OnPropertyChanged(null);
 }