Ejemplo n.º 1
0
 public void RemoveAll()
 {
     Stat_J         = Stat_J.ToDictionary(e => e.Key, e => (byte)0);
     Commands       = Commands.ConvertAll(Item => Kernel_bin.Abilities.None);
     Abilities      = Abilities.ConvertAll(Item => Kernel_bin.Abilities.None);
     JunctionnedGFs = GFflags.None;
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Converts to GF value from GFflag using math.
 /// </summary>
 /// <param name="flag">must be only one or all flags set</param>
 /// <returns></returns>
 /// <remarks>assuming the values are always in the same order</remarks>
 public static GFs ConvertGFEnumLog(GFflags flag)
 {
     if (flag == (GFflags)0xFFFF)
     {
         return(GFs.All);
     }
     if ((flag & (flag - 1)) != 0)
     {
         throw new Exception("ConvertGFEnumLog :: must only have one flag set");
     }
     return(flag.Equals(GFflags.None) ? GFs.Blank : (GFs) checked ((byte)(Math.Log((double)flag, 2d))));
 }
Ejemplo n.º 3
0
 public void Read(BinaryReader br, Characters c)
 {
     ID         = c;
     _CurrentHP = br.ReadUInt16(); //0x00
     _HP        = br.ReadUInt16(); //0x02
     Experience = br.ReadUInt32(); //0x04
     ModelID    = br.ReadByte();   //0x08
     WeaponID   = br.ReadByte();   //0x09
     RawStats   = new Dictionary <Kernel_bin.Stat, byte>(6)
     {
         [Kernel_bin.Stat.STR]  = br.ReadByte(), //0x0A
         [Kernel_bin.Stat.VIT]  = br.ReadByte(), //0x0B
         [Kernel_bin.Stat.MAG]  = br.ReadByte(), //0x0C
         [Kernel_bin.Stat.SPR]  = br.ReadByte(), //0x0D
         [Kernel_bin.Stat.SPD]  = br.ReadByte(), //0x0E
         [Kernel_bin.Stat.LUCK] = br.ReadByte()  //0x0F
     };
     Magics = new Dictionary <byte, byte>(33);
     for (int i = 0; i < 32; i++)
     {
         byte key = br.ReadByte();
         byte val = br.ReadByte();
         if (key >= 0 && !Magics.ContainsKey(key))
         {
             Magics.Add(key, val);//0x10
         }
     }
     Commands = Array.ConvertAll(br.ReadBytes(3), Item => (Kernel_bin.Abilities)Item).ToList();         //0x50
     Paddingorunusedcommand = br.ReadByte();                                                            //0x53
     Abilities        = Array.ConvertAll(br.ReadBytes(4), Item => (Kernel_bin.Abilities)Item).ToList(); //0x54
     JunctionnedGFs   = (GFflags)br.ReadUInt16();                                                       //0x58
     Unknown1         = br.ReadByte();                                                                  //0x5A
     Alternativemodel = br.ReadByte();                                                                  //0x5B (Normal, SeeD, Soldier...)
     Stat_J           = new Dictionary <Kernel_bin.Stat, byte>(9);
     for (int i = 0; i < 19; i++)
     {
         Kernel_bin.Stat key = (Kernel_bin.Stat)i;
         byte            val = br.ReadByte();
         if (!Stat_J.ContainsKey(key))
         {
             Stat_J.Add(key, val);
         }
     }
     //JunctionHP = br.ReadByte();//0x5C
     //JunctionSTR = br.ReadByte();//0x5D
     //JunctionVIT = br.ReadByte();//0x5E
     //JunctionMAG = br.ReadByte();//0x5F
     //JunctionSPR = br.ReadByte();//0x60
     //JunctionSPD = br.ReadByte();//0x61
     //JunctionEVA = br.ReadByte();//0x62
     //JunctionHIT = br.ReadByte();//0x63
     //JunctionLCK = br.ReadByte();//0x64
     //Elem_Atk_J = br.ReadByte();//0x65
     //ST_Atk_J = br.ReadByte();//0x66
     //Elem_Def_J = br.ReadBytes(4).ToList() ;//0x67
     //ST_Def_J = br.ReadBytes(4).ToList();//0x6B
     Unknown2             = br.ReadByte();//0x6F (padding?)
     CompatibilitywithGFs = new Dictionary <GFs, ushort>(16);
     for (int i = 0; i < 16; i++)
     {
         CompatibilitywithGFs.Add((GFs)i, br.ReadUInt16()); //0x70
     }
     Numberofkills = br.ReadUInt16();                       //0x90
     NumberofKOs   = br.ReadUInt16();                       //0x92
     Exists        = br.ReadByte();                         //0x94
     Unknown3      = br.ReadByte();                         //0x95
     MentalStatus  = br.ReadByte();                         //0x96
     Unknown4      = br.ReadByte();                         //0x97
 }
Ejemplo n.º 4
0
 public void RemoveJunctionedGF(GFs gf) =>
 rawJunctionedGFs ^= Saves.ConvertGFEnum.FirstOrDefault(x => x.Value == gf).Key;
Ejemplo n.º 5
0
 public void Read(BinaryReader br, Characters c)
 {
     ID         = c;
     CurrentHP  = br.ReadUInt16(); //0x00
     _HP        = br.ReadUInt16(); //0x02
     Experience = br.ReadUInt32(); //0x04
     ModelID    = br.ReadByte();   //0x08
     WeaponID   = br.ReadByte();   //0x09
     _STR       = br.ReadByte();   //0x0A
     _VIT       = br.ReadByte();   //0x0B
     _MAG       = br.ReadByte();   //0x0C
     _SPR       = br.ReadByte();   //0x0D
     _SPD       = br.ReadByte();   //0x0E
     _LCK       = br.ReadByte();   //0x0F
     Magics     = new Dictionary <byte, byte>(33);
     for (int i = 0; i < 32; i++)
     {
         var key = br.ReadByte();
         var val = br.ReadByte();
         if (key >= 0 && !Magics.ContainsKey(key))
         {
             Magics.Add(key, val);//0x10
         }
     }
     Commands = Array.ConvertAll(br.ReadBytes(3), Item => (Kernel_bin.Abilities)Item);         //0x50
     Paddingorunusedcommand = br.ReadByte();                                                   //0x53
     Abilities        = Array.ConvertAll(br.ReadBytes(4), Item => (Kernel_bin.Abilities)Item); //0x54
     JunctionnedGFs   = (GFflags)br.ReadUInt16();                                              //0x58
     Unknown1         = br.ReadByte();                                                         //0x5A
     Alternativemodel = br.ReadByte();                                                         //0x5B (Normal, SeeD, Soldier...)
     JunctionStat     = new Dictionary <Kernel_bin.Stat, byte>(9);
     for (int i = 0; i < 9; i++)
     {
         var key = (Kernel_bin.Stat)i;
         var val = br.ReadByte();
         if (!JunctionStat.ContainsKey(key))
         {
             JunctionStat.Add(key, val);
         }
     }
     //JunctionHP = br.ReadByte();//0x5C
     //JunctionSTR = br.ReadByte();//0x5D
     //JunctionVIT = br.ReadByte();//0x5E
     //JunctionMAG = br.ReadByte();//0x5F
     //JunctionSPR = br.ReadByte();//0x60
     //JunctionSPD = br.ReadByte();//0x61
     //JunctionEVA = br.ReadByte();//0x62
     //JunctionHIT = br.ReadByte();//0x63
     //JunctionLCK = br.ReadByte();//0x64
     Junctionelementalattack  = br.ReadByte();   //0x65
     Junctionmentalattack     = br.ReadByte();   //0x66
     Junctionelementaldefense = br.ReadUInt32(); //0x67
     Junctionmentaldefense    = br.ReadUInt32(); //0x6B
     Unknown2             = br.ReadByte();       //0x6F (padding?)
     CompatibilitywithGFs = new Dictionary <GFs, ushort>(16);
     for (int i = 0; i < 16; i++)
     {
         CompatibilitywithGFs.Add((GFs)i, br.ReadUInt16()); //0x70
     }
     Numberofkills = br.ReadUInt16();                       //0x90
     NumberofKOs   = br.ReadUInt16();                       //0x92
     Exists        = br.ReadByte();                         //0x94
     Unknown3      = br.ReadByte();                         //0x95
     MentalStatus  = br.ReadByte();                         //0x96
     Unknown4      = br.ReadByte();                         //0x97
 }