public static void SetStage(int ind, int type, LvlState state = LvlState.Locked) { short stage = (short)(BitConverter.ToInt16(savedata, Completed.Ofset(ind, type)) & (~(0x7 << Completed.Shift(ind, type))) | ((short)(state) << Completed.Shift(ind, type))); Array.Copy(BitConverter.GetBytes(stage), 0, savedata, Completed.Ofset(ind, type), 2); PatchScore(ind, type); }
} //"Base" function, returns a fully customized img public static Bitmap GetStageImage(int stgInd, int stgType) { //byte[] stagesData = new byte[][] { db.StagesMainBin, db.StagesExpertBin, db.StagesEventBin }[stgType]; //LvlState state = GetStage(stgInd, stgType).State; //int rank = GetStage(stgInd, stgType).Rank; //bool uX = false; //if (stgType == 0) //{ // stgInd++; // if (stgInd >= BitConverter.ToInt32(stagesData, 0)) // { // stgInd -= (BitConverter.ToInt32(stagesData, 0) - 1); //UX stages // uX = true; // } //} LvlState state = GetStage(stgInd, stgType).State; int rank = GetStage(stgInd, stgType).Rank; int monInd = db.Stages[stgType][stgInd].Pokemon; return(GetStageImage(monInd, db.Stages[stgType][stgInd].IsUX, (db.Mons[monInd].IsMega && stgType == 0), GetMon(monInd).Caught, (state == LvlState.Locked && stgType == 0), (state == LvlState.Unlocked && stgType == 0), (state == LvlState.Defeated), rank)); } //Returns an img corresponding to a certain stage