public int FindHighestPreferenceId(RaidSlot slot, PlayerEntry[] playerEntries) { int HighestPreferenceEntryId = 0; bool found = false; for (int i = 0; i < playerEntries.Length; i++) { if (FitsToSlot(playerEntries[i], slot)) { if (playerEntries[HighestPreferenceEntryId].Preference <= playerEntries[i].Preference) { HighestPreferenceEntryId = playerEntries[i].Id; found = true; } } } if (found) { return(HighestPreferenceEntryId); } else { return(-1); } }
public void ExecuteOnSpecialisationChangedCommand(int slot) { if (RaidSlots[slot] == null) { RaidSlots[slot] = new RaidSlot(); } RaidSlots[slot].SpecialisationId = selectedSpecialisation.SID; }
public void ExecuteOnProfessionChangedCommand(int slot) { if (RaidSlots[slot] == null) { RaidSlots[slot] = new RaidSlot(); } RaidSlots[slot].ProfessionId = selectedProfession.PID; }
public void ExecuteOnRoleChangedCommand(int slot) { if (RaidSlots[slot] == null) { RaidSlots[slot] = new RaidSlot(); } RaidSlots[slot].RoleId = selectedRole.RID; }
public bool FitsToSlot(PlayerEntry entry, RaidSlot slot) { if (entry.SpecialisationId == slot.SpecialisationId || slot.SpecialisationId == 0) { if (entry.ProfessionId == slot.ProfessionId || slot.ProfessionId == 0) { if (entry.RoleId == slot.RoleId || slot.RoleId == 0) { return(true); } } } return(false); }
public void EntryFitsToSlot(int EntryProfessionId, int EntrySpecialisationId, int EntryRoleId, int SlotProfessionId, int SlotSpecialisationId, int SlotRoleId) { PlayerEntry playerEntry = new PlayerEntry() { ProfessionId = EntryProfessionId, SpecialisationId = EntrySpecialisationId, RoleId = EntryRoleId }; RaidSlot slot = new RaidSlot() { ProfessionId = SlotProfessionId, SpecialisationId = SlotSpecialisationId, RoleId = SlotRoleId }; Assert.True(preferenceCalculationClass.FitsToSlot(playerEntry, slot)); }