Esempio n. 1
0
 public static void SetSpeedup(int ind, bool X = false, int suX = 0, bool Y = false, int suY = 0)
 {
     if (db.HasMega[ind][0] || db.HasMega[ind][1])
     {
         int speedUp_Val = BitConverter.ToInt32(savedata, SpeedUpX.Ofset(ind));
         if (db.HasMega[ind][0])
         {
             speedUp_Val &= ~(0x7F << SpeedUpX.Shift(ind));
             speedUp_Val |= (X ? suX : 0) << SpeedUpX.Shift(ind);
         }
         if (db.HasMega[ind][1])
         {   //Y shifts are relative to X ofsets.
             speedUp_Val &= ~(0x7F << ((SpeedUpY.Ofset(ind) - SpeedUpX.Ofset(ind)) * 8 + SpeedUpY.Shift(ind)));
             speedUp_Val |= (Y ? suY : 0) << ((SpeedUpY.Ofset(ind) - SpeedUpX.Ofset(ind)) * 8 + SpeedUpY.Shift(ind));
         }
         Array.Copy(BitConverter.GetBytes(speedUp_Val), 0, savedata, SpeedUpX.Ofset(ind), 4);
     }
 }
Esempio n. 2
0
        public static monItem GetMon(int ind)
        {
            bool caught = true;

            foreach (int array in Caught.Ofset(ind))
            {
                if (((savedata[array] >> Caught.Shift(ind)) & 1) != 1)
                {
                    caught = false;
                }
            }
            int lev = Math.Max((BitConverter.ToUInt16(savedata, Level1.Ofset(ind)) >> Level1.Shift(ind)) & 0xF, (BitConverter.ToUInt16(savedata, Level2.Ofset(ind)) >> Level2.Shift(ind)) & 0x3F);

            lev = (lev == 0) ? 1 : lev;
            int   rml      = (BitConverter.ToUInt16(savedata, Lollipop.Ofset(ind)) >> Lollipop.Shift(ind)) & 0x3F;
            int   exp      = (BitConverter.ToInt32(savedata, Experience.Ofset(ind)) >> Experience.Shift(ind)) & 0xFFFFFF;
            short stone    = (short)((savedata[Mega.Ofset(ind)] >> Mega.Shift(ind)) & 3); //0 = 00, 1 = X0, 2 = 0Y, 3 = XY
            short speedUpX = (short)(db.HasMega[ind][0] ? (BitConverter.ToInt16(savedata, SpeedUpX.Ofset(ind)) >> SpeedUpX.Shift(ind)) & 0x7F : 0);
            short speedUpY = (short)(db.HasMega[ind][1] ? (BitConverter.ToInt32(savedata, SpeedUpY.Ofset(ind)) >> SpeedUpY.Shift(ind)) & 0x7F : 0);
            short selSkill = (short)((BitConverter.ToInt16(savedata, CurrentSkill.Ofset(ind)) >> CurrentSkill.Shift(ind)) & 0x7);

            int[] skillLvl = new int[5], skillExp = new int[5];
            for (int i = 0; i < db.Rest[ind].Item2; i++)
            {
                int sLv = (BitConverter.ToInt16(savedata, SkillLevel.Ofset(ind, i)) >> SkillLevel.Shift(ind)) & 0x7;
                skillLvl[i] = (sLv < 2) ? 1 : sLv;
                skillExp[i] = savedata[SkillExp.Ofset(ind, i)];
            }

            return(new monItem {
                Caught = caught, Level = lev, Lollipops = rml, Exp = exp, Stone = stone, SpeedUpX = speedUpX, SpeedUpY = speedUpY, CurrentSkill = selSkill, SkillLevel = skillLvl, SkillExp = skillExp
            });
        }