/// <summary>
        /// Gets random first name for an NPC.
        /// Supports Breton, Redguard, Nord, Imperial, DarkElf, HighElf, WoodElf.
        /// All other types return empty string.
        /// </summary>
        public string FirstName(BankTypes type, Genders gender)
        {
            // Bank dictionary must be ready
            if (bankDict == null)
                return string.Empty;

            // Generate name by type
            NameBank nameBank = bankDict[type];
            string firstName = string.Empty;
            switch (type)
            {
                case BankTypes.Breton:                                                  // These banks all work the same
                case BankTypes.Nord:
                case BankTypes.Imperial:
                case BankTypes.DarkElf:
                case BankTypes.HighElf:
                case BankTypes.WoodElf:
                    firstName = GetRandomFirstName(nameBank, gender);
                    break;

                case BankTypes.Redguard:                                                // Redguards have just a single name
                    firstName = GetRandomRedguardName(nameBank, gender);
                    break;
            }

            return firstName;
        }
        //public Person()
        //{
        //}

        public Person(string _Firstname, string _Lastname, int _Age, Genders _gender)
        {
            FirstName = _Firstname;
            LastName = _Lastname;
            Age = _Age;
            gender = _gender;
        }
Exemple #3
0
 public Person(string _firstName, string _lastName, int _age, Genders _gender)
 {
     firstName = _firstName;
     lastName = _lastName;
     age = _age;
     gender = _gender;
 }
Exemple #4
0
 public Student(
     int id,
     string firstName,
     string lastName,
     string email,
     Genders gender,
     StudentTypes studentType,
     int examResult,
     int homeworkSent,
     int homeworkEvaluated,
     float teamworkScore,
     float attendances,
     float bonus)
 {
     this.Id = id;
     this.FirstName = firstName;
     this.LastName = lastName;
     this.Email = email;
     this.Gender = gender;
     this.StudentType = studentType;
     this.ExamResult = examResult;
     this.HomeworkSent = homeworkSent;
     this.HomeworkEvaluated = homeworkEvaluated;
     this.TeamworkScore = teamworkScore;
     this.Attendances = attendances;
     this.Bonus = bonus;
     this.Result = CalculateResult();
 }
Exemple #5
0
 public Dog(string name, int age, Genders gender)
     : base(name, age, gender)
 {
     this.Name = name;
     this.Age = age;
     this.Gender = gender;
 }
Exemple #6
0
 /// <summary>
 /// Overloaded Constructor, allows customization of the Character
 /// </summary>
 /// <param name="name">Character's Name</param>
 /// <param name="description">Character's Description</param>
 /// <param name="gender">Character's Gender</param>
 /// <param name="race">Character's Race</param>
 public Character(string name, string description, Genders gender, Races race)
 {
     _name = name;
     _description = description;
     _gender = gender;
     _race = race;
 }
Exemple #7
0
 /// <summary>
 /// Overloaded constructor, creates player based on inputs
 /// </summary>
 /// <param name="name">Player's name</param>
 /// <param name="description">Player's description</param>
 /// <param name="gender">Player's gender</param>
 /// <param name="race">Player's race</param>
 public Player(string name, string description, Genders gender, Races race)
     : base(name, description, gender, race)
 {
     _inventory = new List<Item>();
     _inventorySize = 12;
     _currentRoomNumber = 0;
 }
Exemple #8
0
 /// <summary>
 /// Default constructor, creates Mr. Smith.
 /// </summary>
 public Character()
 {
     _name = "Mr. Smith";
     _description = "He wears a suit, carries a briefcase, and talks kinda funny.";
     _gender = Genders.MALE;
     _race = Races.HUMAN;
 }
Exemple #9
0
        public Character()
        {
            _class = CharacterEnums.CharacterClass.Explorer;
            _race = CharacterEnums.CharacterRace.Human;
            _gender = CharacterEnums.Genders.Female;
            _skinColor = CharacterEnums.SkinColors.Fair;
            _skinType = CharacterEnums.SkinType.Flesh;
            _hairColor = CharacterEnums.HairColors.Black;
            _eyeColor = CharacterEnums.EyeColors.Brown;
            _build = CharacterEnums.BodyBuild.Medium;

            _koCount = new Tuple<int, DateTime>(0, DateTime.Now);
            _actionState = CharacterActionState.None;
            _stanceState = CharacterStanceState.Standing;

            _primaryLanguage = CharacterEnums.Languages.Common;
            KnownLanguages = new HashSet<Languages>();
            KnownLanguages.Add(_primaryLanguage);

            FirstName = "";
            LastName = "";
            Description = "";
            Age = 17;   //Do we want an age? And are we going to advance it every in game year?  We'll need a birthdate for this.
            Weight = 180; //pounds or kilos?
            Height = 70;  //inches or centimeters?
            Location = "A1";
            InCombat = false;
            LastCombatTime = DateTime.MinValue.ToUniversalTime();
            IsNPC = false;
            Leveled = false;
            MainHand = "WIELD_RIGHT";
            NextLevelExperience = 300;
            Level = 1;
            Experience = 0;
            PointsToSpend = 0;

            Inventory = new Inventory();
            Equipment = new Equipment();
            Bonuses = new StatBonuses();

            Inventory.playerID = this.ID;
            Equipment.playerID = this.ID;

            Attributes = new Dictionary<string, Attribute>();

            Attributes.Add("Hitpoints", new Attribute(150, "Hitpoints", 150, 0.1, 1));
            Attributes.Add("Dexterity", new Attribute(10, "Dexterity", 5, 0, 1));
            Attributes.Add("Strength", new Attribute(10, "Strength", 5, 0, 1));
            Attributes.Add("Intelligence", new Attribute(10, "Intelligence", 5, 0, 1));
            Attributes.Add("Endurance", new Attribute(10, "Endurance", 5, 0, 1));
            Attributes.Add("Charisma", new Attribute(10, "Charisma", 5, 0, 1));

            SubAttributes = new Dictionary<string, double>();

            SubAttributes.Add("Agility", 1);
            SubAttributes.Add("Toughness", 1);
            SubAttributes.Add("Cunning", 1);
            SubAttributes.Add("Wisdom", 1);
            SubAttributes.Add("Leadership", 1);
        }
Exemple #10
0
 /// <summary>
 /// Constructor for Staff, assumes friendly and tells people their name
 /// </summary>
 /// <param name="name">Staffs name</param>
 /// <param name="gender">Staff gender</param>
 /// <param name="race">Staffs race</param>
 public Staff(string name, Genders gender, Races race)
     : base(name, gender, race)
 {
     AppearsFriendly = true;
     InitialGreeting = string.Format("Why hello there, my name is {0}", this.Name);
     _inventory = new List<Item>();
 }
Exemple #11
0
 /// <summary>
 /// Constructor for Guards, assumes unfriendly and tells people to move along
 /// </summary>
 /// <param name="name">Guards name</param>
 /// <param name="gender">Guards gender</param>
 /// <param name="race">Guards race</param>
 public Guard(string name, Genders gender, Races race)
     : base(name, gender, race)
 {
     AppearsFriendly = false;
     InitialGreeting = "You should not be here!";
     _inventory = new List<Item>();
 }
 public PersonalRecord(string firstName, string lastname, Genders gender, string favoriteColor, DateTime dateOfBirth)
 {
     FirstName = firstName;
     LastName = lastname;
     Gender = gender;
     FavoriteColor = favoriteColor;
     DateOfBirth = dateOfBirth;
 }
Exemple #13
0
 /// <summary>
 /// Overloaded person constructor
 /// </summary>
 /// <param name="name"></param>
 /// <param name="gender"></param>
 /// <param name="race"></param>
 public Person(string name,Genders gender, Races race)
 {
     _name = name;
     _gender = gender;
     _race = race;
     _currentRoom = new int[2];
     _isAlive = true;
 }
Exemple #14
0
 /// <summary>
 /// Default person constructor
 /// </summary>
 public Person()
 {
     _name = "Mr. Smith";
     _gender = Genders.Male;
     _race = Races.Human;
     _currentRoom = new int[2];
     _isAlive = true;
 }
Exemple #15
0
 public Actor(String name, Races race, Genders gender)
 {
     stats = new StatsDatum();
     equipment = new Equipment();
     skills = new List<Skill>();
     statusEffects = new List<StatusEffect>();
     this.name = name;
     this.race = race;
     this.gender = gender;
 }
 public static String Gender(Genders gender)
 {
     switch (gender)
     {
         case Genders.Male:
             return "♂";
         case Genders.Female:
             return "♀";
         default:
             return "";
     }
 }
        public ManagerGameSave()
        {
            Random random		= new Random((int)DateTime.Now.Ticks);
            this.trainerName	= "TRIGSPC";
            this.trainerGender	= (Genders)random.Next(2);
            this.trainerID		= (ushort)random.Next(ushort.MaxValue);
            this.secretID		= (ushort)random.Next(ushort.MaxValue);
            this.playTime		= new TimeSpan();
            this.lastSaveTime	= DateTime.Now;

            this.pokedexSeen	= new bool[386];
            this.pokedexOwned	= new bool[386];

            this.money			= 0;
            this.coins			= 0;
            this.battlePoints	= 0;
            this.pokeCoupons	= 0;
            this.volcanicAsh	= 0;

            this.pokePCs = new List<ManagerPokePC>();
            this.pokePCs.Add(new ManagerPokePC(this, "Row 1"));
            this.inventory = new Inventory(this);
            this.mailbox = new Mailbox(this, 0);

            this.inventory.AddItemInventory();
            this.inventory.Items.AddPocket(ItemTypes.Items, 0, 0, false, false);
            this.inventory.Items.AddPocket(ItemTypes.InBattle, 0, 0, false, false);
            this.inventory.Items.AddPocket(ItemTypes.Valuables, 0, 0, false, false);
            this.inventory.Items.AddPocket(ItemTypes.Hold, 0, 0, false, false);
            this.inventory.Items.AddPocket(ItemTypes.Misc, 0, 0, false, false);
            this.inventory.Items.AddPocket(ItemTypes.PokeBalls, 0, 0, false, false);
            this.inventory.Items.AddPocket(ItemTypes.TMCase, 0, 0, false, true);
            this.inventory.Items.AddPocket(ItemTypes.Berries, 0, 0, false, true);
            this.inventory.Items.AddPocket(ItemTypes.KeyItems, 0, 0, false, false);
            this.inventory.Items.AddPocket(ItemTypes.CologneCase, 0, 0, false, true);
            this.inventory.Items.AddPocket(ItemTypes.DiscCase, 0, 0, false, true);

            this.inventory.AddDecorationInventory();
            this.inventory.Decorations.AddPocket(DecorationTypes.Desk, 0, 0);
            this.inventory.Decorations.AddPocket(DecorationTypes.Chair, 0, 0);
            this.inventory.Decorations.AddPocket(DecorationTypes.Plant, 0, 0);
            this.inventory.Decorations.AddPocket(DecorationTypes.Ornament, 0, 0);
            this.inventory.Decorations.AddPocket(DecorationTypes.Mat, 0, 0);
            this.inventory.Decorations.AddPocket(DecorationTypes.Poster, 0, 0);
            this.inventory.Decorations.AddPocket(DecorationTypes.Doll, 0, 0);
            this.inventory.Decorations.AddPocket(DecorationTypes.Cushion, 0, 0);

            this.inventory.AddPokeblockCase(0);

            loaded = true;
        }
Exemple #18
0
        public StatusInfoPacket(PacketReader reader)
            : base(0x11, "StatusInfo")
        {
            Serial = reader.ReadInt32();
            PlayerName = reader.ReadString(30);
            CurrentHealth = reader.ReadInt16();
            MaxHealth = reader.ReadInt16();
            NameChangeFlag = reader.ReadByte() != 0x00; // 0x1 = allowed, 0 = not allowed
            StatusTypeFlag = reader.ReadByte();
            if (StatusTypeFlag > 0)
            {
                Sex = (Genders)reader.ReadByte(); // 0=male, 1=female
                Strength = reader.ReadInt16();
                Dexterity = reader.ReadInt16();
                Intelligence = reader.ReadInt16();
                CurrentStamina = reader.ReadInt16();
                MaxStamina = reader.ReadInt16();
                CurrentMana = reader.ReadInt16();
                MaxMana = reader.ReadInt16();
                GoldInInventory = reader.ReadInt32();
                ArmorRating = reader.ReadInt16();
                Weight = reader.ReadInt16();

                if (StatusTypeFlag >= 5)
                {
                    MaxWeight = reader.ReadInt16();
                    Race = (Races)reader.ReadByte();
                }

                if (StatusTypeFlag >= 3)
                {
                    StatCap = reader.ReadInt16();
                    Followers = reader.ReadByte();
                    MaxFollowers = reader.ReadByte();
                }

                if (StatusTypeFlag >= 4)
                {
                    ResistFire = reader.ReadInt16();
                    ResistCold = reader.ReadInt16();
                    ResistPoison = reader.ReadInt16();
                    ResistEnergy = reader.ReadInt16();
                    Luck = reader.ReadInt16();
                    DmgMin = reader.ReadInt16();
                    DmgMax = reader.ReadInt16();
                    TithingPoints = reader.ReadInt16();
                }
            }
        }
Exemple #19
0
 public Person(String personName, DateTime? dateOfBorn, DateTime? dateOfDeath,
   Genders gender,  String notes,int id=-1,string pathToPhoto = null,int genLayer=0)
 {
     NameOfPerson = personName;
       DateOfBorn = dateOfBorn;
       DateOfDeath = dateOfDeath;
       Gender = gender;
       GenLayer = genLayer;
       Note = notes;
       PathToPhoto = pathToPhoto;
       if (id == -1)
       ID = (NameOfPerson + dateOfBorn.ToString() + gender.ToString() + Note.ToString()).GetHashCode();
       else
       ID = id;
 }
Exemple #20
0
 public Villager(Game g, Genders gender, string name)
     : base(g)
 {
     _faith = new HistorizedValue<double, Villager>(this, "_faith", 20);
     _happiness = new HistorizedValue<double, Villager>(this, "_happiness", 20);
     _health = new HistorizedValue<Healths, Villager>(this, "_health", 20);
     _statusInFamily = new HistorizedValue<Status, Villager>(this, "_statusInFamily", 20);
     g.VillagerAdded();
     _faith.Current = 100;
     _happiness.Current = 80;
     _lifeExpectancy = 85 * 12;
     _gender = gender;
     _statusInFamily.Current = Status.SINGLE;
     _name = name;
     Game.Villages[0].VillagerAdded();
     Game.Villages[0].JobsList.Farmer.AddPerson(this);
 }
        public MobileStatusCompactPacket(PacketReader reader)
            : base(0x11, "StatusInfo")
        {
            m_serial = reader.ReadInt32();
            m_playerName = reader.ReadString(30);
            m_currentHealth = reader.ReadInt16();
            m_maxHealth = reader.ReadInt16();
            m_nameChangeFlag = reader.ReadByte(); // 0x1 = allowed, 0 = not allowed
            m_statusTypeFlag = reader.ReadByte();
            sex = (Genders)reader.ReadByte(); // 0=male, 1=female
            m_strength = reader.ReadInt16();
            m_dexterity = reader.ReadInt16();
            m_intelligence = reader.ReadInt16();
            m_currentStamina = reader.ReadInt16();
            m_maxStamina = reader.ReadInt16();
            m_currentMana = reader.ReadInt16();
            m_maxMana = reader.ReadInt16();
            m_goldInInventory = reader.ReadInt32();
            m_armorRating = reader.ReadInt16();
            m_weight = reader.ReadInt16();

            if (m_statusTypeFlag >= 5)
            {
                m_maxWeight = reader.ReadInt16();
                m_race = (Races)reader.ReadByte();
            }

            if (m_statusTypeFlag >= 3)
            {
                m_statCap = reader.ReadInt16();
                m_followers = reader.ReadByte();
                m_maxFollowers = reader.ReadByte();
            }

            if (m_statusTypeFlag >= 4)
            {
                m_resistFire = reader.ReadInt16();
                m_resistCold = reader.ReadInt16();
                m_resistPoison = reader.ReadInt16();
                m_resistEnergy = reader.ReadInt16();
                m_luck = reader.ReadInt16();
                m_dmgMin = reader.ReadInt16();
                m_dmgMax = reader.ReadInt16();
                m_tithingPoints = reader.ReadInt16();
            }
        }
Exemple #22
0
        public Character(Vector2 position, string name, Genders gender = Genders.Male, Stats stats = null) : base(name, true, position, "ball")
        {
            this.gender = gender;

            CharStats = stats;

            if(CharStats == null)
            {
                CharStats = new Stats(1, 1, 1, 1);
            }

            Health = MaxHealth;

            armorRenderer = new Renderer(this);
            hairRenderer = new Renderer(this);

            Inventory = new Inventory(this);
        }
        public CreateCharacterPacket(string name, Genders sex, Races race,
            byte str, byte dex, byte intel, byte skill1, byte skill1Value,
            byte skill2, byte skill2Value, byte skill3, byte skill3Value, short skinColor,
            short hairStyle, short hairColor, short facialHairStyle, short facialHairColor,
            short locationIndex, short slotNumber, int clientIp, short shirtColor, short pantsColor)
            : base(0x00, "Create Character", 104)
        {
            str = (byte)MathHelper.Clamp(str, 10, 60);
            dex = (byte)MathHelper.Clamp(dex, 10, 60);
            intel = (byte)MathHelper.Clamp(intel, 10, 60);

            if (str + dex + intel != 80)
                throw new Exception("Unable to create character with a combined stat total not equal to 80.");

            Stream.Write(0xedededed);
            Stream.Write(0xffffffff);
            Stream.Write((byte)0);
            Stream.WriteAsciiFixed(name, 30);
            Stream.WriteAsciiFixed("", 30);
            Stream.Write((byte)((int)sex + (int)race));
            Stream.Write((byte)str);
            Stream.Write((byte)dex);
            Stream.Write((byte)intel);

            Stream.Write((byte)skill1);
            Stream.Write((byte)skill1Value);
            Stream.Write((byte)skill2);
            Stream.Write((byte)skill2Value);
            Stream.Write((byte)skill3);
            Stream.Write((byte)skill3Value);

            Stream.Write((short)skinColor);
            Stream.Write((short)hairStyle);
            Stream.Write((short)hairColor);
            Stream.Write((short)facialHairStyle);
            Stream.Write((short)facialHairColor);
            Stream.Write((short)locationIndex);
            Stream.Write((short)slotNumber);
            Stream.Write((short)0);

            Stream.Write(clientIp);
            Stream.Write((short)shirtColor);
            Stream.Write((short)pantsColor);
        }
Exemple #24
0
        internal Villager(Game g, Family parentFamily, string name)
            : base(g)
        {
            _faith = new HistorizedValue<double, Villager>(this, "_faith", 20);
            _happiness = new HistorizedValue<double, Villager>(this, "_happiness", 20);
            _health = new HistorizedValue<Healths, Villager>(this, "_health", 20);
            _statusInFamily = new HistorizedValue<Status, Villager>(this, "_statusInFamily", 20);
            _statusInFamily.Current = Status.SINGLE;

            g.VillagerAdded();
            parentFamily.OwnerVillage.VillagerAdded();
            Debug.Assert(g != null);
            if (Game.Rand.Next(101) < 2)
                _faith.Current = 13;
            else
                _faith.Current = parentFamily.FaithAverage();
            if (_faith.Current <= 15)
                _health.Current = Healths.HERETIC;
            switch (Game.Rand.Next(2))
            {
                case 0: _gender = Genders.MALE;
                    if (parentFamily.Father != null)
                        if (parentFamily.Father.Job != null)
                            parentFamily.Father.Job.AddPerson(this);
                    g.AddSingleMan(this); break;
                case 1: _gender = Genders.FEMALE;
                    if (parentFamily.Mother != null)
                        if (parentFamily.Mother.Job != null)
                            parentFamily.Mother.Job.AddPerson(this);
                    Engage(this, parentFamily); break;
            }
            if (parentFamily.OwnerVillage.Meeting != null)
            {
                if (parentFamily.OwnerVillage.Meeting.Family == parentFamily)
                {
                    MeetingStarted();
                }
            }
            _happiness.Current = parentFamily.HappinessAverage();
            _age = 0;
            _lifeExpectancy = 85 * 12;
            _name = name;
        }
        public Cat(string name, Genders gender, int age)
            : base(name, gender, age)
        {

        }
Exemple #26
0
 public Animal(string name, int age, Genders gender)
 {
     this.Name = name;
     this.Age = age;
     this.Gender = gender;
 }
Exemple #27
0
 /// <summary>
 /// Overloaded Guard Constructor
 /// </summary>
 /// <param name="name">Guard's Name</param>
 /// <param name="description">Guard's Description</param>
 /// <param name="gender">Guard's Gender</param>
 /// <param name="race">Guard's Race</param>
 public Guard(string name, string description, Genders gender, Races race)
     : base(name, description, gender, race)
 {
     _currentRoomNumber = 0;
     _greeting = "Move along!";
 }
 // Set some default values for testing during development
 void SetDefaultValues()
 {
     race = GetRaceTemplate(Races.Breton);
     gender = Genders.Male;
     career = DaggerfallEntity.GetClassCareerTemplate(ClassCareers.Mage);
     name = "Nameless";
     reflexes = PlayerReflexes.Average;
     workingSkills.SetDefaults();
     workingStats.SetFromCareer(career);
     faceIndex = 0;
 }
 void MaleButton_OnMouseClick(BaseScreenComponent sender, Vector2 position)
 {
     SelectedGender = Genders.Male;
     CloseWindow();
 }
Exemple #30
0
 public Dog(string name, int age, Genders gender)
     : base(name, age, gender)
 {
 }
Exemple #31
0
        /// <summary>
        /// Creates random magic item in same manner as classic.
        /// </summary>
        /// <returns>DaggerfallUnityItem</returns>
        public static DaggerfallUnityItem CreateRandomMagicItem(int playerLevel, Genders gender, Races race)
        {
            byte[] itemGroups0 = { 2, 3, 6, 10, 12, 14, 25 };
            byte[] itemGroups1 = { 2, 3, 6, 12, 25 };

            DaggerfallUnityItem newItem = null;

            // Get the list of magic item templates read from MAGIC.DEF
            MagicItemsFile           magicItemsFile = new MagicItemsFile(Path.Combine(DaggerfallUnity.Instance.Arena2Path, "MAGIC.DEF"));
            List <MagicItemTemplate> magicItems     = magicItemsFile.MagicItemsList;

            // Get the number of non-artifact magic item templates in MAGIC.DEF
            int numberOfRegularMagicItems = 0;

            foreach (MagicItemTemplate magicItem in magicItems)
            {
                if (magicItem.type == MagicItemTypes.RegularMagicItem)
                {
                    numberOfRegularMagicItems++;
                }
            }

            // Choose a random one of the non-artifact magic item templates
            int chosenItem = UnityEngine.Random.Range(0, numberOfRegularMagicItems);

            // Get the chosen template
            foreach (MagicItemTemplate magicItem in magicItems)
            {
                if (magicItem.type == MagicItemTypes.RegularMagicItem)
                {
                    // Proceed when the template is found
                    if (chosenItem == 0)
                    {
                        // Get the item group. The possible groups are determined by the 33rd byte (magicItem.group) of the MAGIC.DEF template being used.
                        ItemGroups group = 0;
                        if (magicItem.group == 0)
                        {
                            group = (ItemGroups)itemGroups0[UnityEngine.Random.Range(0, 7)];
                        }
                        else if (magicItem.group == 1)
                        {
                            group = (ItemGroups)itemGroups1[UnityEngine.Random.Range(0, 5)];
                        }
                        else if (magicItem.group == 2)
                        {
                            group = ItemGroups.Weapons;
                        }

                        // Create the base item
                        if (group == ItemGroups.Weapons)
                        {
                            newItem = CreateRandomWeapon(playerLevel);

                            // No arrows as enchanted items
                            while (newItem.GroupIndex == 18)
                            {
                                newItem = CreateRandomWeapon(playerLevel);
                            }
                        }
                        else if (group == ItemGroups.Armor)
                        {
                            newItem = CreateRandomArmor(playerLevel, gender, race);
                        }
                        else if (group == ItemGroups.MensClothing || group == ItemGroups.WomensClothing)
                        {
                            newItem = CreateRandomClothing(gender, race);
                        }
                        else if (group == ItemGroups.ReligiousItems)
                        {
                            newItem = CreateRandomReligiousItem();
                        }
                        else if (group == ItemGroups.Gems)
                        {
                            newItem = CreateRandomGem();
                        }
                        else // Only other possibility is jewellery
                        {
                            newItem = CreateRandomJewellery();
                        }

                        // Replace the regular item name with the magic item name
                        newItem.shortName = magicItem.name;

                        // Add the enchantments
                        newItem.legacyMagic = new DaggerfallEnchantment[magicItem.enchantments.Length];
                        for (int i = 0; i < magicItem.enchantments.Length; ++i)
                        {
                            newItem.legacyMagic[i] = magicItem.enchantments[i];
                        }

                        // Set the condition/magic uses
                        newItem.maxCondition     = magicItem.uses;
                        newItem.currentCondition = magicItem.uses;

                        // Set the value of the item. This is determined by the enchantment point cost/spell-casting cost
                        // of the enchantments on the item.
                        int value = 0;
                        for (int i = 0; i < magicItem.enchantments.Length; ++i)
                        {
                            if (magicItem.enchantments[i].type != EnchantmentTypes.None &&
                                magicItem.enchantments[i].type < EnchantmentTypes.ItemDeteriorates)
                            {
                                switch (magicItem.enchantments[i].type)
                                {
                                // Enchantments that cast a spell. The parameter is the spell index in SPELLS.STD.
                                case EnchantmentTypes.CastWhenUsed:
                                case EnchantmentTypes.CastWhenHeld:
                                case EnchantmentTypes.CastWhenStrikes:
                                    value += Formulas.FormulaHelper.GetSpellEnchantPtCost(magicItem.enchantments[i].param);
                                    break;

                                // Enchantments that provide an effect that has no parameters
                                case EnchantmentTypes.RepairsObjects:
                                case EnchantmentTypes.AbsorbsSpells:
                                case EnchantmentTypes.EnhancesSkill:
                                case EnchantmentTypes.FeatherWeight:
                                case EnchantmentTypes.StrengthensArmor:
                                    value += enchantmentPointCostsForNonParamTypes[(int)magicItem.enchantments[i].type];
                                    break;

                                // Bound soul
                                case EnchantmentTypes.SoulBound:
                                    MobileEnemy mobileEnemy = GameObjectHelper.EnemyDict[magicItem.enchantments[i].param];
                                    value += mobileEnemy.SoulPts;     // TODO: Not sure about this. Should be negative? Needs to be tested.
                                    break;

                                default:
                                    // Enchantments that provide a non-spell effect with a parameter (when effect applies, what enemies are affected, etc.)
                                    value += enchantmentPtsForItemPowerArrays[(int)magicItem.enchantments[i].type][magicItem.enchantments[i].param];
                                    break;
                                }
                            }
                        }

                        newItem.value = value;

                        break;
                    }

                    chosenItem--;
                }
            }

            if (newItem == null)
            {
                throw new Exception("CreateRandomMagicItem() failed to create an item.");
            }

            return(newItem);
        }