public int Compare(Good a, int myLevel) { if (!BuildOption.Instance.Props.itemBuyLimit) { return(CompareBySeasonAndName(a)); } int levelComparitor = GetLevelComparitor(); int levelComparitor2 = a.GetLevelComparitor(); if (levelComparitor <= myLevel && levelComparitor2 > myLevel) { return(-1); } if (levelComparitor > myLevel && levelComparitor2 <= myLevel) { return(1); } int num = 1; if (levelComparitor <= myLevel && levelComparitor2 <= myLevel) { num = -1; } if (levelComparitor == levelComparitor2) { return(CompareBySeasonAndName(a)); } return(levelComparitor.CompareTo(levelComparitor2) * num); }