public bool IsSubset(JobGroup group) { return((Id & group.Id) == Id); }
public bool IsOnlySubsetOf(JobGroup group) { return((Id & ~group.Id) == 0); }
private static string _checkFor(string output, int hexValue, int parentId, int child1Id, int child2Id, JobGroup group, int gender) { int familyId = parentId | child1Id | child2Id; if (group.IsOnlySubsetOf(JobGroup.Renewal)) { // Remove first class, it's not supposed to be there... hexValue &= ~parentId; } if ((hexValue & familyId) == familyId) { string toAdd = Job.Get(familyId).Name + ", "; if (output.EndsWith(" Class, ")) { return(output + toAdd); } if (!output.Contains(" Class, ")) { if (_insertAfter(ref output, toAdd, "Novice, ", group)) { return(output); } if (_insertAfter(ref output, toAdd, "Female Only, ", group)) { return(output); } if (_insertAfter(ref output, toAdd, "Male Only, ", group)) { return(output); } return(_getUpper(group) + toAdd + output); } int lastIndex = output.LastIndexOf(" Class, ", StringComparison.Ordinal); return(output.Insert(lastIndex + " Class, ".Length, toAdd)); } if ((hexValue & child1Id) == child1Id && (hexValue & child2Id) == child2Id && group.IsBetween(JobGroup.PreRenewal, JobGroup.Renewal) && Job.Get(child1Id | child2Id) != null) { string toAdd = Job.Get(child1Id | child2Id).Name + ", "; if (output.EndsWith(" Class, ")) { return(output + toAdd.Replace("3rd ", "")); } if (!output.Contains(" Class, ")) { if (_insertAfter(ref output, toAdd, "Novice, ", group)) { return(output); } if (_insertAfter(ref output, toAdd, "Female Only, ", group)) { return(output); } if (_insertAfter(ref output, toAdd, "Male Only, ", group)) { return(output); } return(_getUpper(group) + toAdd + output); } toAdd = toAdd.Replace("3rd ", ""); int lastIndex = output.LastIndexOf(" Class, ", StringComparison.Ordinal); return(output.Insert(lastIndex + " Class, ".Length, toAdd)); } if ((hexValue & child1Id) == child1Id && (hexValue & child2Id) == child2Id) { return(output + Job.Get(child1Id, group).GetName(gender) + ", " + Job.Get(child2Id, group).GetName(gender) + ", "); } if ((hexValue & child1Id) == child1Id && (hexValue & parentId) == parentId) { return(output + Job.Get(parentId, group).GetName(gender) + ", " + Job.Get(child1Id, group).GetName(gender) + ", "); } if ((hexValue & child2Id) == child2Id && (hexValue & parentId) == parentId) { return(output + Job.Get(parentId, group).GetName(gender) + ", " + Job.Get(child2Id, group).GetName(gender) + ", "); } if ((hexValue & child1Id) == child1Id) { return(output + Job.Get(child1Id, group).GetName(gender) + ", "); } if ((hexValue & child2Id) == child2Id) { return(output + Job.Get(child2Id, group).GetName(gender) + ", "); } if ((hexValue & parentId) == parentId) { return(output + Job.Get(parentId, group).GetName(gender) + ", "); } return(output); }
private JobGroup(JobGroup jobGroup) { Id = jobGroup.Id; }
private static bool _insertAfter(ref string output, string toAdd, string contains, JobGroup group) { if (output.Contains(contains)) { output = output.Insert(contains.Length + output.IndexOf(contains, StringComparison.Ordinal), _getUpper(group) + toAdd); return(true); } return(false); }
private static IEnumerable <Job> _restrict(int id, int jobId, JobGroup group) { List <Job> jobs = AllJobs.Where(p => p.Id == jobId && (id & p.Id) == p.Id && (p.Upper & group.Id) == p.Upper).ToList(); return(jobs); }
public bool IsBetween(JobGroup g1, JobGroup g2) { return(IsOnlySubsetOf(g2) && !IsOnlySubsetOf(g1)); }
public static Job Get(long id, JobGroup group, int equipLevel = 0) { Job job; if (equipLevel >= 100) { group = JobGroup.Get(group.Id & ~JobGroup.PreRenewal.Id); } if (_returnIf(id, group.Id, out job)) { return(job); } if (group.IsOnlySubsetOf(JobGroup.Baby)) { if (group.IsOnlySubsetOf(JobGroup.Baby3)) { if (_returnIf(id, JobGroup.Baby3.Id, out job)) { return(job); } } if (_returnIf(id, JobGroup.Baby2.Id, out job)) { return(job); } } if (group.Is(JobGroup.Renewal)) { if (_returnIf(id, JobGroup.Normal3.Id, out job)) { return(job); } } if (group.Is(JobGroup.Trans3)) { if (_returnIf(id, JobGroup.Trans3.Id, out job)) { return(job); } } if (group.Is(JobGroup.TransM)) { if (_returnIf(id, JobGroup.Trans2.Id, out job)) { return(job); } } if (group.Is(JobGroup.Trans2)) { if (_returnIf(id, JobGroup.Trans2.Id, out job)) { return(job); } } if (group.Is(JobGroup.Trans)) { if (_returnIf(id, JobGroup.Trans2.Id, out job)) { return(job); } } if (group.IsBetween(JobGroup.PreRenewal, JobGroup.Renewal)) { if (_returnIf(id, JobGroup.Normal3.Id, out job)) { return(job); } } if (_returnIf(id, JobGroup.Normal2.Id, out job)) { return(job); } return(Get(id)); }
public bool Is(JobGroup group) { return(Id == group.Id); }