Exemplo n.º 1
0
        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);
            }
        }
Exemplo n.º 2
0
 public void ExecuteOnSpecialisationChangedCommand(int slot)
 {
     if (RaidSlots[slot] == null)
     {
         RaidSlots[slot] = new RaidSlot();
     }
     RaidSlots[slot].SpecialisationId = selectedSpecialisation.SID;
 }
Exemplo n.º 3
0
 public void ExecuteOnProfessionChangedCommand(int slot)
 {
     if (RaidSlots[slot] == null)
     {
         RaidSlots[slot] = new RaidSlot();
     }
     RaidSlots[slot].ProfessionId = selectedProfession.PID;
 }
Exemplo n.º 4
0
 public void ExecuteOnRoleChangedCommand(int slot)
 {
     if (RaidSlots[slot] == null)
     {
         RaidSlots[slot] = new RaidSlot();
     }
     RaidSlots[slot].RoleId = selectedRole.RID;
 }
Exemplo n.º 5
0
        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));
        }