Inheritance: Inventory
Exemplo n.º 1
0
        /// <summary>
        /// Loads character.
        /// </summary>
        /// <param name="data">
        /// Byte array containing character data.
        /// </param>
        public Character(byte[] data)
        {
            source = (byte[])data.Clone();

            Gender = (CharacterGender)data[1];
            Race = (CharacterRace)data[2];
            Class = (CharacterClass)data[3];
            Magic = (CharacterMagic)data[4];
            Level = data[5];
            Language = (CharacterLanguage)data[8];
            Appearance = data[9];
            Face = data[10];
            InventoryPicture = data[11];
            TrainingPoints = BitConverter.ToInt16(data, 22);
            Gold = BitConverter.ToInt16(data, 24)/10f;
            Rations = BitConverter.ToInt16(data, 26);
            Conditions = (CharacterConditions)BitConverter.ToInt16(data, 30);

            Strength = new CharacterAttribute(data, 42);
            Intelligence = new CharacterAttribute(data, 50);
            Dexterity = new CharacterAttribute(data, 58);
            Speed = new CharacterAttribute(data, 66);
            Stamina = new CharacterAttribute(data, 74);
            Luck = new CharacterAttribute(data, 82);
            MagicResistance = new CharacterAttribute(data, 90);
            MagicTallent = new CharacterAttribute(data, 98);
            Age = BitConverter.ToInt16(data, 106);
            CloseRangeCombat = new CharacterAttribute(data, 122);
            LongRangeCombat = new CharacterAttribute(data, 130);
            CriticalHit = new CharacterAttribute(data, 138);
            Lockpicking = new CharacterAttribute(data, 146);
            LifePoints = new CharacterAttribute(data, 202);
            SpellPoints = new CharacterAttribute(data, 208);

            Experience = BitConverter.ToInt32(data, 238);

            ClassSpells = new int[7];
            ClassSpells[0] = BitConverter.ToInt32(data, 242);
            ClassSpells[1] = BitConverter.ToInt32(data, 246);
            ClassSpells[2] = BitConverter.ToInt32(data, 250);
            ClassSpells[3] = BitConverter.ToInt32(data, 254);
            ClassSpells[4] = BitConverter.ToInt32(data, 258);
            ClassSpells[5] = BitConverter.ToInt32(data, 262);
            ClassSpells[6] = BitConverter.ToInt32(data, 266);

            StringBuilder name = new StringBuilder(16);
            int i = 274;
            while(data[i] != 0)
            {
                name.Append((char)data[i++]);
            }
            Name = name.ToString();

            Equipment = new Equipment(data, 742);
            Inventory = new Backpack(data, 796);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Creates new character.
 /// </summary>
 public Character()
 {
     source = new byte[940];
     ClassSpells = new int[7];
     Equipment = new Equipment();
 }