예제 #1
0
        private void LoadCharacter(int index)
        {
            int offset = SaveFileStartOffset + (index * CharacterRecordSize);

            string   name   = ProcessName(offset);
            U4Sex    sex    = (U4Sex)RawFile[offset + 0x10];
            U4Class  job    = (U4Class)RawFile[offset + 0x11];
            U4Health health = (U4Health)RawFile[offset + 0x12];

            int strength     = ConvertBCDToInt(RawFile[offset + 0x13]);
            int dexterity    = ConvertBCDToInt(RawFile[offset + 0x14]);
            int intelligence = ConvertBCDToInt(RawFile[offset + 0x15]);

            int magicPoints = ConvertBCDToInt(RawFile[offset + 0x16]);

            int maxHitPoints = ConvertBCDToInt(RawFile[offset + 0x1a]) * 100 + ConvertBCDToInt(RawFile[offset + 0x1b]);
            int hitPoints    = ConvertBCDToInt(RawFile[offset + 0x18]) * 100 + ConvertBCDToInt(RawFile[offset + 0x19]);

            int experience = ConvertBCDToInt(RawFile[offset + 0x1c]) * 100 + ConvertBCDToInt(RawFile[offset + 0x1d]);

            U4Weapons weapon = (U4Weapons)RawFile[offset + 0x1e];
            U4Armor   armor  = (U4Armor)RawFile[offset + 0x1f];

            Characters[index] = new Ultima4CharacterData(name, sex, job, health, hitPoints, maxHitPoints, experience, strength, dexterity, intelligence, magicPoints, weapon, armor);
        }
예제 #2
0
        public Ultima4Data(IFile file = null)
        {
            Characters    = new Ultima4CharacterData[8];
            Characters[0] = new Ultima4CharacterData();
            m_numberOfCharactersInParty = 0;

            Spells   = new BoundedIntArray(26, 0, 99);
            Reagents = new BoundedIntArray(8, 0, 99);
            Armor    = new BoundedIntArray(8, 0, 99);
            Weapons  = new BoundedIntArray(16, 0, 99);

            m_food     = new BoundedInt(0, 9999);
            m_gold     = new BoundedInt(0, 9999);
            m_torches  = new BoundedInt(0, 99);
            m_gems     = new BoundedInt(0, 99);
            m_keys     = new BoundedInt(0, 99);
            m_sextants = new BoundedInt(0, 99);

            Skull = false;
            Horn  = false;
            Wheel = false;

            Candle = false;
            Book   = false;
            Bell   = false;

            KeyOfLove    = false;
            KeyOfTruth   = false;
            KeyOfCourage = false;

            m_moves  = new BoundedInt(0, 99999999);
            Location = new U4Location();

            Stones  = new bool[8];
            Runes   = new bool[8];
            Virtues = new BoundedIntArray(8, 0, 99);

            CurrentTransportation = U4Transportation.Foot;

            RawFile = null;

            if (file == null)
            {
                File = new File();
            }
            else
            {
                File = file;
            }
        }