Esempio n. 1
0
        private void LoadCharacter(int index, int offset)
        {
            string name = ProcessName(offset);

            if (name == "")
            {
                return;
            }

            // ToDo: Cards and Marks go here

            int      torches      = ConvertBCDToInt(RawFile[offset + 0x0F]);
            U3Health health       = (U3Health)RawFile[offset + 0x11];
            int      strength     = ConvertBCDToInt(RawFile[offset + 0x12]);
            int      agility      = ConvertBCDToInt(RawFile[offset + 0x13]);
            int      intelligence = ConvertBCDToInt(RawFile[offset + 0x14]);
            int      wisdom       = ConvertBCDToInt(RawFile[offset + 0x15]);

            U3Race  race        = (U3Race)RawFile[offset + 0x16];
            U3Class u3class     = (U3Class)RawFile[offset + 0x17];
            U3Sex   sex         = (U3Sex)RawFile[offset + 0x18];
            int     magicPoints = ConvertBCDToInt(RawFile[offset + 0x19]);

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

            int experience = ConvertBCDToInt(RawFile[offset + 0x1e]) * 100 + ConvertBCDToInt(RawFile[offset + 0x1f]);

            int food = ConvertBCDToInt(RawFile[offset + 0x20]) * 100 + ConvertBCDToInt(RawFile[offset + 0x21]);

            int gold = ConvertBCDToInt(RawFile[offset + 0x23]) * 100 + ConvertBCDToInt(RawFile[offset + 0x24]);

            int gems   = ConvertBCDToInt(RawFile[offset + 0x25]);
            int keys   = ConvertBCDToInt(RawFile[offset + 0x26]);
            int powder = ConvertBCDToInt(RawFile[offset + 0x27]);

            U3Armor   equippedArmor  = (U3Armor)RawFile[offset + 0x28];
            U3Weapons equippedWeapon = (U3Weapons)RawFile[offset + 0x30];

            int[] armor = new int[7];
            for (int i = 0; i < 7; ++i)
            {
                armor[i] = ConvertBCDToInt(RawFile[offset + 0x29 + i]);
            }

            int[] weapons = new int[15];
            for (int i = 0; i < 15; ++i)
            {
                weapons[i] = ConvertBCDToInt(RawFile[offset + 0x31 + i]);
            }

            Characters[index] = new Ultima3CharacterData(offset, name, torches, health, strength, agility, intelligence, wisdom, race, u3class, hitPoints, maxHitPoints, magicPoints, experience, food, gems, powder, keys, equippedArmor, equippedWeapon, armor, weapons, gold);
            m_numberOfCharactersInRoster++;
        }
Esempio n. 2
0
        public Ultima3Data(IFile file = null)
        {
            m_X     = new BoundedInt(0, 63);
            m_Y     = new BoundedInt(0, 63);
            m_moves = new BoundedInt(0, 99999999);

            Characters    = new Ultima3CharacterData[20];
            Characters[0] = new Ultima3CharacterData();
            m_numberOfCharactersInRoster = 0;

            RawFile = null;

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