コード例 #1
0
ファイル: Character.cs プロジェクト: Wi150nZ/lioneditor
        /// <summary>
        /// Builds an actual character from its binary data
        /// </summary>
        /// <param name="charData"></param>
        private void BuildCharacter(byte[] charData)
        {
            spriteSet = SpriteSet.AllSprites[charData[0]];
            isPresent = (charData[1] != 0xFF);

            if (!Class.ClassDictionary.TryGetValue(charData[2], out job))
            {
                job = Class.ClassDictionary[0x4A];
            }
            unknownOffset03 = charData[3];
            gender = (Gender)(charData[4] & 0xE0);
            unknownOffset05 = charData[5];
            zodiacSign = (Zodiac)(charData[6] & 0xF0);

            if (gender == Gender.Monster)
            {
                secondaryAction = SecondaryAction.ActionDictionary[0x00];
                supportAbility = Ability.AbilityList[0];
                reactAbility = Ability.AbilityList[0];
                movementAbility = Ability.AbilityList[0];
                head = Item.ItemList[0];
                body = Item.ItemList[0];
                accessory = Item.ItemList[0];
                rightHand = Item.ItemList[0];
                rightShield = Item.ItemList[0];
                leftHand = Item.ItemList[0];
                leftShield = Item.ItemList[0];
            }
            else
            {
                secondaryAction = SecondaryAction.ActionDictionary[charData[7]];
                reactAbility = Ability.GetAbilityFromOffset(TwoBytesToUShort(charData[8], charData[9]));
                supportAbility = Ability.GetAbilityFromOffset(TwoBytesToUShort(charData[10], charData[11]));
                movementAbility = Ability.GetAbilityFromOffset(TwoBytesToUShort(charData[12], charData[13]));
                head = Item.GetItemAtOffset(TwoBytesToUShort(charData[14], charData[15]));
                body = Item.GetItemAtOffset(TwoBytesToUShort(charData[16], charData[17]));
                accessory = Item.GetItemAtOffset(TwoBytesToUShort(charData[18], charData[19]));
                rightHand = Item.GetItemAtOffset(TwoBytesToUShort(charData[20], charData[21]));
                rightShield = Item.GetItemAtOffset(TwoBytesToUShort(charData[22], charData[23]));
                leftHand = Item.GetItemAtOffset(TwoBytesToUShort(charData[24], charData[25]));
                leftShield = Item.GetItemAtOffset(TwoBytesToUShort(charData[26], charData[27]));
            }

            experience = charData[28];
            level = charData[29];
            bravery = charData[30];
            faith = charData[31];

            rawHP = ThreeBytesToUInt(charData[32], charData[33], charData[34]);
            rawMP = ThreeBytesToUInt(charData[35], charData[36], charData[37]);
            rawSP = ThreeBytesToUInt(charData[38], charData[39], charData[40]);
            rawPA = ThreeBytesToUInt(charData[41], charData[42], charData[43]);
            rawMA = ThreeBytesToUInt(charData[44], charData[45], charData[46]);

            byte[] jaBytes = new byte[173];

            Savegame.CopyArray(charData, jaBytes, 0x4BB - 0x48C, 173);
            jobsAndAbilities = new JobsAndAbilities(jaBytes);

            for (int i = 0; i < 15; i++)
            {
                rawName[i] = charData[0xDC + i];
            }

            for (int k = 0; k < 21; k++)
            {
                afterName[k] = charData[0xEB + k];
            }
        }
コード例 #2
0
ファイル: Class.cs プロジェクト: Wi150nZ/lioneditor
        private static void LoadClasses()
        {
            XmlDocument doc = new XmlDocument();
            doc.LoadXml( Resources.Classes );

            XmlNodeList classes = doc.SelectNodes( "//Class" );
            classDict = new Dictionary<byte, Class>( classes.Count );
            classList = new List<Class>( classes.Count );

            foreach( XmlNode node in classes )
            {
                Class newClass = new Class( node );
                classDict.Add( newClass.Byte, newClass );
                classList.Add( newClass );
            }
        }
コード例 #3
0
ファイル: Character.cs プロジェクト: Wi150nZ/lioneditor
        /// <summary>
        /// Builds a character with "default" stats
        /// </summary>
        private void BuildDummyCharacter()
        {
            accessory = Item.GetItemAtOffset(0);
            body = Item.GetItemAtOffset(0);
            bravery = 0;
            experience = 0;
            faith = 0;

            gender = ((rng.Next() % 2) == 0) ? Gender.Male : Gender.Female;
            Name = string.Empty;

            head = Item.GetItemAtOffset(0);
            isPresent = false;
            job = Class.ClassDictionary[0x00];

            jobLevels = new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
            jobsUnlocked = new byte[] { 0x00, 0x00, 0x00 };
            jp = new ushort[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
            totalJP = new ushort[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };

            jobsAndAbilities = new JobsAndAbilities(new byte[173]);

            leftHand = Item.GetItemAtOffset(0);
            leftShield = Item.GetItemAtOffset(0);
            level = 0;
            movementAbility = Ability.GetAbilityFromOffset(0);
            rawHP = Job.GetRawHPFromActualHP(0);
            rawMA = Job.GetRawMAFromActualMA(0);
            rawMP = Job.GetRawMPFromActualMP(0);
            rawPA = Job.GetRawPAFromActualPA(0);
            rawSP = Job.GetRawSPFromActualSP(0);
            reactAbility = Ability.GetAbilityFromOffset(0);
            rightHand = Item.GetItemAtOffset(0);
            rightShield = Item.GetItemAtOffset(0);
            secondaryAction = SecondaryAction.ActionDictionary[0x00];
            for (int i = 0; i < 22; i++)
            {
                for (int j = 0; j < 3; j++)
                {
                    skillsUnlocked[i, j] = 0x00;
                }
            }

            spriteSet = SpriteSet.AllSprites[0x00];
            supportAbility = Ability.GetAbilityFromOffset(0);
            unknownOffset03 = 0x00;
            unknownOffset05 = 0x00;
            zodiacSign = (Zodiac)0;
            OnProposition = false;
            Kills = 0;

            isDummy = true;
        }