public EventUnit(IList <byte> bytes, EventUnit defaults, PatcherLib.Datatypes.Context context) { List <Item> eventItems = Item.GetEventItems(context); Ability[] eventAbilities = AllAbilities.GetEventAbilities(context); SpriteSet = SpriteSet.GetSpriteSets(context)[bytes[0]]; Default = defaults; PatcherLib.Utilities.Utilities.CopyByteToBooleans(bytes[1], ref Male, ref Female, ref Monster, ref JoinAfterEvent, ref LoadFormation, ref ZodiacMonster, ref Blank2, ref SaveFormation); SpecialName = SpecialName.GetSpecialNames(context)[bytes[2]]; Level = bytes[3]; Month = (Month)bytes[4]; Day = bytes[5]; Bravery = bytes[6]; Faith = bytes[7]; PrerequisiteJob = (PreRequisiteJob)bytes[8]; PrerequisiteJobLevel = bytes[9]; Job = AllJobs.GetDummyJobs(context)[bytes[10]]; SecondaryAction = SkillSet.GetEventSkillSets(context)[bytes[11]]; Reaction = eventAbilities[PatcherLib.Utilities.Utilities.BytesToUShort(bytes[12], bytes[13])]; Support = eventAbilities[PatcherLib.Utilities.Utilities.BytesToUShort(bytes[14], bytes[15])]; Movement = eventAbilities[PatcherLib.Utilities.Utilities.BytesToUShort(bytes[16], bytes[17])]; Head = eventItems[bytes[18]]; Body = eventItems[bytes[19]]; Accessory = eventItems[bytes[20]]; RightHand = eventItems[bytes[21]]; LeftHand = eventItems[bytes[22]]; Palette = bytes[23]; bool dummy = false; PatcherLib.Utilities.Utilities.CopyByteToBooleans(bytes[24], ref AlwaysPresent, ref RandomlyPresent, ref dummy, ref dummy, ref Control, ref Immortal, ref Blank6, ref Blank7); TeamColor = (TeamColor)((bytes[24] & 0x30) >> 4); X = bytes[25]; Y = bytes[26]; FacingDirection = (Facing)(bytes[27] & 0x7F); UpperLevel = (bytes[27] & 0x80) == 0x80; Experience = bytes[28]; SkillSet = SkillSet.GetEventSkillSets(context)[bytes[29]]; WarTrophy = eventItems[bytes[30]]; BonusMoney = bytes[31]; UnitID = bytes[32]; TargetX = bytes[33]; TargetY = bytes[34]; //Unknown8 = bytes[35]; PatcherLib.Utilities.Utilities.CopyByteToBooleans(bytes[35], ref Blank8, ref FocusUnit, ref StayNearXY, ref Aggressive, ref Defensive, ref Blank9, ref Blank10, ref Blank11); Target = bytes[36]; Unknown10 = bytes[37]; //Unknown11 = bytes[38]; PatcherLib.Utilities.Utilities.CopyByteToBooleans(bytes[38], ref Blank12, ref Blank13, ref Blank14, ref Blank15, ref Blank16, ref SaveCT, ref Blank17, ref Blank18); Unknown12 = bytes[39]; }
static SpriteSet() { IList <string> pspSpriteNames = PSPResources.Lists.SpriteSets; IList <string> psxSpriteNames = PSXResources.Lists.SpriteSets; for (int i = 0; i < 256; i++) { pspSpriteSets[i] = new SpriteSet((byte)i, pspSpriteNames[i]); psxSpriteSets[i] = new SpriteSet((byte)i, psxSpriteNames[i]); } }
static SpriteSet() { IList<string> pspSpriteNames = PSPResources.Lists.SpriteSets; IList<string> psxSpriteNames = PSXResources.Lists.SpriteSets; for( int i = 0; i < 256; i++ ) { pspSpriteSets[i] = new SpriteSet( (byte)i, pspSpriteNames[i] ); psxSpriteSets[i] = new SpriteSet( (byte)i, psxSpriteNames[i] ); } }
public byte[] ToByteArray() { List <byte> result = new List <byte>(40); result.Add(SpriteSet.ToByte()); result.Add(PatcherLib.Utilities.Utilities.ByteFromBooleans(Male, Female, Monster, JoinAfterEvent, LoadFormation, ZodiacMonster, Blank2, SaveFormation)); result.Add(SpecialName.ToByte()); result.Add(Level); result.Add((byte)Month); result.Add(Day); result.Add(Bravery); result.Add(Faith); result.Add((byte)PrerequisiteJob); result.Add(PrerequisiteJobLevel); result.Add(Job.Value); result.Add(SecondaryAction.Value); result.AddRange(Reaction.Offset.ToBytes()); result.AddRange(Support.Offset.ToBytes()); result.AddRange(Movement.Offset.ToBytes()); result.Add((byte)(Head.Offset & 0xFF)); result.Add((byte)(Body.Offset & 0xFF)); result.Add((byte)(Accessory.Offset & 0xFF)); result.Add((byte)(RightHand.Offset & 0xFF)); result.Add((byte)(LeftHand.Offset & 0xFF)); result.Add(Palette); result.Add(PatcherLib.Utilities.Utilities.ByteFromBooleans(AlwaysPresent, RandomlyPresent, (((int)TeamColor) & 0x02) == 2, (((int)TeamColor) & 0x01) == 1, Control, Immortal, Blank6, Blank7)); result.Add(X); result.Add(Y); result.Add((byte)(((byte)FacingDirection & 0x7F) | (UpperLevel ? 0x80 : 0x00))); result.Add(Experience); result.Add(SkillSet.Value); result.Add((byte)(WarTrophy.Offset & 0xFF)); result.Add(BonusMoney); result.Add(UnitID); result.Add(TargetX); result.Add(TargetY); //result.Add( Unknown8 ); result.Add(PatcherLib.Utilities.Utilities.ByteFromBooleans(Blank8, FocusUnit, StayNearXY, Aggressive, Defensive, Blank9, Blank10, Blank11)); result.Add(Target); result.Add(Unknown10); //result.Add( Unknown11 ); result.Add(PatcherLib.Utilities.Utilities.ByteFromBooleans(Blank12, Blank13, Blank14, Blank15, Blank16, SaveCT, Blank17, Blank18)); result.Add(Unknown12); return(result.ToArray()); }
static SpriteSet() { string[] pspSpriteNames = PatcherLib.Utilities.Utilities.GetStringsFromNumberedXmlNodes( PSPResources.SpriteSets, "/Sprites/Sprite[@byte='{0:X2}']/@name", 256); string[] psxSpriteNames = PatcherLib.Utilities.Utilities.GetStringsFromNumberedXmlNodes( PSXResources.SpriteSets, "/Sprites/Sprite[@byte='{0:X2}']/@name", 256); for (int i = 0; i < 256; i++) { pspSpriteSets[i] = new SpriteSet((byte)i, pspSpriteNames[i]); psxSpriteSets[i] = new SpriteSet((byte)i, psxSpriteNames[i]); } }
static SpriteSet() { string[] pspSpriteNames = PatcherLib.Utilities.Utilities.GetStringsFromNumberedXmlNodes( PSPResources.SpriteSets, "/Sprites/Sprite[@byte='{0:X2}']/@name", 256 ); string[] psxSpriteNames = PatcherLib.Utilities.Utilities.GetStringsFromNumberedXmlNodes( PSXResources.SpriteSets, "/Sprites/Sprite[@byte='{0:X2}']/@name", 256 ); for( int i = 0; i < 256; i++ ) { pspSpriteSets[i] = new SpriteSet( (byte)i, pspSpriteNames[i] ); psxSpriteSets[i] = new SpriteSet( (byte)i, psxSpriteNames[i] ); } }