private void CalculateEZTargetGroup(List<TargetGroup> groups, int maxPlayers, string name, out TargetGroup toAdd) { float duration = 20 * 60 * 1000, freq = 20 * 60, chance = 1f, numtrg = 10; Dictionary<bool, int> NBCounts = new Dictionary<bool, int>() { { false, 0 }, { true, 0 }, }; Dictionary<int, int> LvlCounts = new Dictionary<int, int>() { { (int)POSSIBLE_LEVELS.LVLP0, 0 }, { (int)POSSIBLE_LEVELS.LVLP1, 0 }, { (int)POSSIBLE_LEVELS.LVLP2, 0 }, { (int)POSSIBLE_LEVELS.LVLP3, 0 }, }; Dictionary<PLAYER_ROLES, int> ARCounts = new Dictionary<PLAYER_ROLES, int>() { { PLAYER_ROLES.MainTank, 0 }, { PLAYER_ROLES.OffTank, 0 }, { PLAYER_ROLES.TertiaryTank, 0 }, { PLAYER_ROLES.MeleeDPS, 0 }, { PLAYER_ROLES.RangedDPS, 0 }, { PLAYER_ROLES.RaidHealer, 0 }, { PLAYER_ROLES.MainTankHealer, 0 }, { PLAYER_ROLES.OffAndTertTankHealer, 0 }, }; // foreach (TargetGroup t in groups) { duration = Math.Min(duration, t.Duration); freq = Math.Min(freq, t.Frequency); chance = Math.Min(chance, t.Chance); numtrg = Math.Min(numtrg, t.NumTargs); NBCounts[t.NearBoss]++; LvlCounts[t.LevelOfTargets]++; for (int i = 0; i < (int)PLAYER_ROLES.RaidHealer; i++) { if (t.AffectsRole[(PLAYER_ROLES)i]) { ARCounts[(PLAYER_ROLES)i]++; } } } // bool snb = false; foreach(bool nb in NBCounts.Keys){ if (NBCounts[nb] > NBCounts[snb]) { snb = nb; } if (NBCounts[snb] == NBCounts[false]) { snb = false; } } int slvl = (int)POSSIBLE_LEVELS.LVLP3; foreach(int lvl in LvlCounts.Keys){ if (LvlCounts[lvl] > LvlCounts[slvl]) { slvl = lvl; } if (LvlCounts[slvl] == LvlCounts[(int)POSSIBLE_LEVELS.LVLP3]) { slvl = (int)POSSIBLE_LEVELS.LVLP3; } } toAdd = new TargetGroup { Name = name, Duration = duration, Frequency = freq, Chance = chance, NumTargs = numtrg, LevelOfTargets = slvl, NearBoss = snb, }; foreach (PLAYER_ROLES pr in ARCounts.Keys) { toAdd.AffectsRole[pr] = ((float)ARCounts[pr] / (float)groups.Count) > 0.25f; // at least 25% of the affected roles matched } }
private void CalculateAvgTargetGroup(List<TargetGroup> groups, float fightDur, int maxPlayers, string name, out TargetGroup toAdd) { float duration = 0, freq = 0, chance = 0, numtrg = 0, phaseUptime = 0; Dictionary<bool, int> NBCounts = new Dictionary<bool, int>() { { false, 0 }, { true, 0 }, }; Dictionary<int, int> LvlCounts = new Dictionary<int, int>() { { (int)POSSIBLE_LEVELS.LVLP0, 0 }, { (int)POSSIBLE_LEVELS.LVLP1, 0 }, { (int)POSSIBLE_LEVELS.LVLP2, 0 }, { (int)POSSIBLE_LEVELS.LVLP3, 0 }, }; Dictionary<PLAYER_ROLES, int> ARCounts = new Dictionary<PLAYER_ROLES, int>() { { PLAYER_ROLES.MainTank, 0 }, { PLAYER_ROLES.OffTank, 0 }, { PLAYER_ROLES.TertiaryTank, 0 }, { PLAYER_ROLES.MeleeDPS, 0 }, { PLAYER_ROLES.RangedDPS, 0 }, { PLAYER_ROLES.RaidHealer, 0 }, { PLAYER_ROLES.MainTankHealer, 0 }, { PLAYER_ROLES.OffAndTertTankHealer, 0 }, }; // foreach (TargetGroup t in groups) { duration += t.Duration; freq += t.Frequency; chance += t.Chance; numtrg += t.NumTargs; phaseUptime += t.FightUptimePercent; NBCounts[t.NearBoss]++; LvlCounts[t.LevelOfTargets]++; for (int i = 0; i < (int)PLAYER_ROLES.RaidHealer; i++) { if (t.AffectsRole[(PLAYER_ROLES)i]) { ARCounts[(PLAYER_ROLES)i]++; } } } // duration /= (float)groups.Count; freq /= (float)groups.Count; chance /= (float)groups.Count; numtrg /= (float)groups.Count; phaseUptime /= (float)groups.Count; // bool snb = false; foreach(bool nb in NBCounts.Keys){ if (NBCounts[nb] > NBCounts[snb]) { snb = nb; } if (NBCounts[snb] == NBCounts[false]) { snb = false; } } int slvl = (int)POSSIBLE_LEVELS.LVLP3; foreach(int lvl in LvlCounts.Keys){ if (LvlCounts[lvl] > LvlCounts[slvl]) { slvl = lvl; } if (LvlCounts[slvl] == LvlCounts[(int)POSSIBLE_LEVELS.LVLP3]) { slvl = (int)POSSIBLE_LEVELS.LVLP3; } } toAdd = new TargetGroup { Name = name, Duration = duration, Frequency = freq, Chance = chance, NumTargs = numtrg, LevelOfTargets = slvl, NearBoss = snb, FightDuration = fightDur, }; toAdd.PhaseTimes[1] = new float[] { 0f, fightDur * phaseUptime }; foreach (PLAYER_ROLES pr in ARCounts.Keys) { toAdd.AffectsRole[pr] = ((float)ARCounts[pr] / (float)groups.Count) > 0.25f; // at least 25% of the affected roles matched } }
public TargetGroup(TargetGroup i) { TargetGroup clone = (TargetGroup)i.MemberwiseClone(); Frequency = clone.Frequency; Duration = clone.Duration; Chance = clone.Chance; NumTargs = clone.NumTargs; NearBoss = clone.NearBoss; }