public static void CheckPrimerDrop(BaseCreature killed) { List <DamageStore> rights = killed.GetLootingRights(); rights.ForEach(ds => { if (ds.m_HasRight) { Mobile m = ds.m_Mobile; if (Utility.RandomDouble() < 0.10) { SkillMasteryPrimer primer = GetRandom(); if (primer != null) { if (m.Backpack == null || !m.Backpack.TryDropItem(m, primer, false)) { m.BankBox.DropItem(primer); } } m.SendLocalizedMessage(1156209); // You have received a mastery primer! } } }); }
public static SkillMasteryPrimer GetRandom() { SkillName skill = MasteryInfo.Skills[Utility.RandomMinMax(3, 18)]; int volume = 1; double random = Utility.RandomDouble(); if (0.2 >= random) { volume = 3; } else if (0.5 >= random) { volume = 2; } SkillMasteryPrimer primer = new SkillMasteryPrimer(skill, volume); return(primer); }
public static SkillMasteryPrimer GetRandom(Volume volume = Volume.Three, Volume exclude = Volume.One) { List <MasteryInfo> available = new List <MasteryInfo>(); foreach (MasteryInfo info in MasteryInfo.Infos.Where(i => i.Volume <= volume && i.Volume != exclude && i.SpellID > 705)) { available.Add(info); } if (available.Count == 0) { return(null); } MasteryInfo random = available[Utility.Random(available.Count)]; SkillMasteryPrimer primer = new SkillMasteryPrimer(random.SpellID, random.MasterySkill); available.Clear(); available.TrimExcess(); return(primer); }