Creates random element extension (#196)
This commit is contained in:
parent
0926b5abaa
commit
4403d6c1c7
84 changed files with 226 additions and 330 deletions
|
|
@ -4798,7 +4798,7 @@ namespace Server
|
||||||
var sb = new StringBuilder(text.Length, text.Length);
|
var sb = new StringBuilder(text.Length, text.Length);
|
||||||
|
|
||||||
for (var i = 0; i < text.Length; ++i)
|
for (var i = 0; i < text.Length; ++i)
|
||||||
sb.Append(text[i] != ' ' ? GhostChars[Utility.Random(GhostChars.Length)] : ' ');
|
sb.Append(text[i] != ' ' ? GhostChars.RandomElement() : ' ');
|
||||||
|
|
||||||
text = sb.ToString();
|
text = sb.ToString();
|
||||||
context = m_GhostMutateContext;
|
context = m_GhostMutateContext;
|
||||||
|
|
|
||||||
|
|
@ -502,9 +502,9 @@ namespace Server
|
||||||
public static SkillName RandomSkill() =>
|
public static SkillName RandomSkill() =>
|
||||||
m_AllSkills[Random(m_AllSkills.Length - (Core.ML ? 0 : Core.SE ? 1 : Core.AOS ? 3 : 6))];
|
m_AllSkills[Random(m_AllSkills.Length - (Core.ML ? 0 : Core.SE ? 1 : Core.AOS ? 3 : 6))];
|
||||||
|
|
||||||
public static SkillName RandomCombatSkill() => m_CombatSkills[Random(m_CombatSkills.Length)];
|
public static SkillName RandomCombatSkill() => m_CombatSkills.RandomElement();
|
||||||
|
|
||||||
public static SkillName RandomCraftSkill() => m_CraftSkills[Random(m_CraftSkills.Length)];
|
public static SkillName RandomCraftSkill() => m_CraftSkills.RandomElement();
|
||||||
|
|
||||||
public static void FixPoints(ref Point3D top, ref Point3D bottom)
|
public static void FixPoints(ref Point3D top, ref Point3D bottom)
|
||||||
{
|
{
|
||||||
|
|
@ -862,10 +862,10 @@ namespace Server
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public static int RandomList(params int[] list) => RandomList<int>(list);
|
public static T RandomList<T>(params T[] list) => list.RandomElement();
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public static T RandomList<T>(IList<T> list) => list[Random(list.Count)];
|
public static T RandomElement<T>(this IList<T> list) => list.Count == 0 ? default : list[Random(list.Count)];
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public static bool RandomBool() => RandomSources.Source.NextBool();
|
public static bool RandomBool() => RandomSources.Source.NextBool();
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,7 @@ namespace Server.Engines.BulkOrders
|
||||||
|
|
||||||
List<RewardItem> rewards = ComputeRewards(false);
|
List<RewardItem> rewards = ComputeRewards(false);
|
||||||
|
|
||||||
reward = rewards.Count <= 0 ? null : rewards[Utility.Random(rewards.Count)].Construct();
|
reward = rewards.RandomElement()?.Construct();
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual List<RewardItem> ComputeRewards(bool full)
|
public virtual List<RewardItem> ComputeRewards(bool full)
|
||||||
|
|
|
||||||
|
|
@ -387,7 +387,7 @@ namespace Server.Engines.BulkOrders
|
||||||
{
|
{
|
||||||
return type switch
|
return type switch
|
||||||
{
|
{
|
||||||
1 => (Item)new LeatherGlovesOfMining(1),
|
1 => new LeatherGlovesOfMining(1),
|
||||||
3 => new StuddedGlovesOfMining(3),
|
3 => new StuddedGlovesOfMining(3),
|
||||||
5 => new RingmailGlovesOfMining(5),
|
5 => new RingmailGlovesOfMining(5),
|
||||||
_ => throw new InvalidOperationException()
|
_ => throw new InvalidOperationException()
|
||||||
|
|
@ -644,11 +644,7 @@ namespace Server.Engines.BulkOrders
|
||||||
private static Item CreateCloth(int type)
|
private static Item CreateCloth(int type)
|
||||||
{
|
{
|
||||||
if (type >= 0 && type < m_ClothHues.Length)
|
if (type >= 0 && type < m_ClothHues.Length)
|
||||||
{
|
return new UncutCloth(100) {Hue = m_ClothHues[type].RandomElement()};
|
||||||
UncutCloth cloth = new UncutCloth(100);
|
|
||||||
cloth.Hue = m_ClothHues[type][Utility.Random(m_ClothHues[type].Length)];
|
|
||||||
return cloth;
|
|
||||||
}
|
|
||||||
|
|
||||||
throw new InvalidOperationException();
|
throw new InvalidOperationException();
|
||||||
}
|
}
|
||||||
|
|
@ -660,40 +656,34 @@ namespace Server.Engines.BulkOrders
|
||||||
0x484, 0x497
|
0x484, 0x497
|
||||||
};
|
};
|
||||||
|
|
||||||
private static Item CreateSandals(int type) => new Sandals(m_SandalHues[Utility.Random(m_SandalHues.Length)]);
|
private static Item CreateSandals(int type) => new Sandals(m_SandalHues.RandomElement());
|
||||||
|
|
||||||
private static Item CreateStretchedHide(int type)
|
private static Item CreateStretchedHide(int type) =>
|
||||||
|
Utility.Random(4) switch
|
||||||
{
|
{
|
||||||
return Utility.Random(4) switch
|
1 => new SmallStretchedHideSouthDeed(),
|
||||||
{
|
|
||||||
1 => (Item)new SmallStretchedHideSouthDeed(),
|
|
||||||
2 => new MediumStretchedHideEastDeed(),
|
2 => new MediumStretchedHideEastDeed(),
|
||||||
3 => new MediumStretchedHideSouthDeed(),
|
3 => new MediumStretchedHideSouthDeed(),
|
||||||
_ => new SmallStretchedHideEastDeed()
|
_ => new SmallStretchedHideEastDeed()
|
||||||
};
|
};
|
||||||
}
|
|
||||||
|
|
||||||
private static Item CreateTapestry(int type)
|
private static Item CreateTapestry(int type) =>
|
||||||
|
Utility.Random(4) switch
|
||||||
{
|
{
|
||||||
return Utility.Random(4) switch
|
1 => new LightFlowerTapestrySouthDeed(),
|
||||||
{
|
|
||||||
1 => (Item)new LightFlowerTapestrySouthDeed(),
|
|
||||||
2 => new DarkFlowerTapestryEastDeed(),
|
2 => new DarkFlowerTapestryEastDeed(),
|
||||||
3 => new DarkFlowerTapestrySouthDeed(),
|
3 => new DarkFlowerTapestrySouthDeed(),
|
||||||
_ => new LightFlowerTapestryEastDeed()
|
_ => new LightFlowerTapestryEastDeed()
|
||||||
};
|
};
|
||||||
}
|
|
||||||
|
|
||||||
private static Item CreateBearRug(int type)
|
private static Item CreateBearRug(int type) =>
|
||||||
|
Utility.Random(4) switch
|
||||||
{
|
{
|
||||||
return Utility.Random(4) switch
|
1 => new BrownBearRugSouthDeed(),
|
||||||
{
|
|
||||||
1 => (Item)new BrownBearRugSouthDeed(),
|
|
||||||
2 => new PolarBearRugEastDeed(),
|
2 => new PolarBearRugEastDeed(),
|
||||||
3 => new PolarBearRugSouthDeed(),
|
3 => new PolarBearRugSouthDeed(),
|
||||||
_ => new BrownBearRugEastDeed()
|
_ => new BrownBearRugEastDeed()
|
||||||
};
|
};
|
||||||
}
|
|
||||||
|
|
||||||
private static Item CreateRunicKit(int type)
|
private static Item CreateRunicKit(int type)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ namespace Server.Engines.BulkOrders
|
||||||
|
|
||||||
bool reqExceptional = Utility.RandomBool() || material == BulkMaterialType.None;
|
bool reqExceptional = Utility.RandomBool() || material == BulkMaterialType.None;
|
||||||
|
|
||||||
SmallBulkEntry entry = entries[Utility.Random(entries.Length)];
|
SmallBulkEntry entry = entries.RandomElement();
|
||||||
|
|
||||||
Hue = hue;
|
Hue = hue;
|
||||||
AmountMax = amountMax;
|
AmountMax = amountMax;
|
||||||
|
|
@ -151,7 +151,7 @@ namespace Server.Engines.BulkOrders
|
||||||
if (validEntries.Count <= 0)
|
if (validEntries.Count <= 0)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
SmallBulkEntry entry = validEntries[Utility.Random(validEntries.Count)];
|
SmallBulkEntry entry = validEntries.RandomElement();
|
||||||
return new SmallSmithBOD(entry, material, amountMax, reqExceptional);
|
return new SmallSmithBOD(entry, material, amountMax, reqExceptional);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ namespace Server.Engines.BulkOrders
|
||||||
: BulkMaterialType.None;
|
: BulkMaterialType.None;
|
||||||
|
|
||||||
bool reqExceptional = Utility.RandomBool() || material == BulkMaterialType.None;
|
bool reqExceptional = Utility.RandomBool() || material == BulkMaterialType.None;
|
||||||
SmallBulkEntry entry = entries[Utility.Random(entries.Length)];
|
SmallBulkEntry entry = entries.RandomElement();
|
||||||
|
|
||||||
Hue = hue;
|
Hue = hue;
|
||||||
AmountMax = amountMax;
|
AmountMax = amountMax;
|
||||||
|
|
@ -147,7 +147,7 @@ namespace Server.Engines.BulkOrders
|
||||||
|
|
||||||
if (validEntries.Count > 0)
|
if (validEntries.Count > 0)
|
||||||
{
|
{
|
||||||
SmallBulkEntry entry = validEntries[Utility.Random(validEntries.Count)];
|
SmallBulkEntry entry = validEntries.RandomElement();
|
||||||
return new SmallTailorBOD(entry, material, amountMax, reqExceptional);
|
return new SmallTailorBOD(entry, material, amountMax, reqExceptional);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -682,7 +682,7 @@ namespace Server.Engines.CannedEvil
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return ActivatorUtil.CreateInstance(types[Utility.Random(types.Length)]) as Mobile;
|
return ActivatorUtil.CreateInstance(types.RandomElement()) as Mobile;
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -692,7 +692,7 @@ namespace Server.Engines.ConPVP
|
||||||
rn -= ae.Value;
|
rn -= ae.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
return arenas[Utility.Random(arenas.Count)].m_Arena;
|
return arenas.RandomElement().m_Arena;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Arena FindArena()
|
public static Arena FindArena()
|
||||||
|
|
|
||||||
|
|
@ -284,7 +284,7 @@ namespace Server.Engines.ConPVP
|
||||||
}
|
}
|
||||||
case TieType.Random:
|
case TieType.Random:
|
||||||
{
|
{
|
||||||
TourneyParticipant advanced = remaining[Utility.Random(remaining.Count)];
|
TourneyParticipant advanced = remaining.RandomElement();
|
||||||
|
|
||||||
for (int i = 0; i < remaining.Count; ++i)
|
for (int i = 0; i < remaining.Count; ++i)
|
||||||
if (remaining[i] != advanced)
|
if (remaining[i] != advanced)
|
||||||
|
|
|
||||||
|
|
@ -131,13 +131,13 @@ namespace Server.Engines.ConPVP
|
||||||
if (toAdvance.Count == 0)
|
if (toAdvance.Count == 0)
|
||||||
toAdvance = copy; // sanity
|
toAdvance = copy; // sanity
|
||||||
|
|
||||||
int idx = Utility.Random(toAdvance.Count);
|
var random = toAdvance.RandomElement();
|
||||||
|
|
||||||
toAdvance[idx].AddLog(
|
random.AddLog(
|
||||||
"Advanced automatically due to an odd number of challengers.");
|
"Advanced automatically due to an odd number of challengers.");
|
||||||
level.FreeAdvance = toAdvance[idx];
|
level.FreeAdvance = random;
|
||||||
++level.FreeAdvance.FreeAdvances;
|
++level.FreeAdvance.FreeAdvances;
|
||||||
copy.Remove(toAdvance[idx]);
|
copy.Remove(random);
|
||||||
}
|
}
|
||||||
|
|
||||||
while (copy.Count >= partsPerMatch)
|
while (copy.Count >= partsPerMatch)
|
||||||
|
|
|
||||||
|
|
@ -103,7 +103,7 @@ namespace Server.Engines.Craft
|
||||||
if (m_Recipes.Count == 0)
|
if (m_Recipes.Count == 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
return m_Recipes[Utility.Random(m_Recipes.Count)];
|
return m_Recipes.RandomElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int RandomRareRecipe()
|
public int RandomRareRecipe()
|
||||||
|
|
@ -111,7 +111,7 @@ namespace Server.Engines.Craft
|
||||||
if (m_RareRecipes.Count == 0)
|
if (m_RareRecipes.Count == 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
return m_RareRecipes[Utility.Random(m_RareRecipes.Count)];
|
return m_RareRecipes.RandomElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int AddCraft(Type typeItem, TextDefinition group, TextDefinition name, double minSkill, double maxSkill,
|
public int AddCraft(Type typeItem, TextDefinition group, TextDefinition name, double minSkill, double maxSkill,
|
||||||
|
|
|
||||||
|
|
@ -153,7 +153,7 @@ namespace Server.Factions
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (int i = 0; i < distrib; ++i)
|
for (int i = 0; i < distrib; ++i)
|
||||||
activePlayers[Utility.Random(activePlayers.Count)].KillPoints++;
|
activePlayers.RandomElement().KillPoints++;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void DistributePoints(int distrib)
|
public static void DistributePoints(int distrib)
|
||||||
|
|
@ -167,7 +167,7 @@ namespace Server.Factions
|
||||||
|
|
||||||
if (activePlayers.Count > 0)
|
if (activePlayers.Count > 0)
|
||||||
for (int i = 0; i < distrib; ++i)
|
for (int i = 0; i < distrib; ++i)
|
||||||
activePlayers[Utility.Random(activePlayers.Count)].KillPoints++;
|
activePlayers.RandomElement().KillPoints++;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void BeginHonorLeadership(Mobile from)
|
public void BeginHonorLeadership(Mobile from)
|
||||||
|
|
|
||||||
|
|
@ -224,12 +224,10 @@ namespace Server.Factions
|
||||||
|
|
||||||
while (Silver + flow < 0 && toDelete.Count > 0)
|
while (Silver + flow < 0 && toDelete.Count > 0)
|
||||||
{
|
{
|
||||||
int index = Utility.Random(toDelete.Count);
|
Mobile mob = toDelete.RandomElement();
|
||||||
Mobile mob = toDelete[index];
|
|
||||||
|
|
||||||
mob.Delete();
|
mob.Delete();
|
||||||
|
|
||||||
toDelete.RemoveAt(index);
|
toDelete.Remove(mob);
|
||||||
flow = NetCashFlow;
|
flow = NetCashFlow;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -267,8 +267,7 @@ namespace Server.Engines.Harvest
|
||||||
from.Region.GetResource(type);
|
from.Region.GetResource(type);
|
||||||
|
|
||||||
public virtual Type GetResourceType(Mobile from, Item tool, HarvestDefinition def, Map map, Point3D loc,
|
public virtual Type GetResourceType(Mobile from, Item tool, HarvestDefinition def, Map map, Point3D loc,
|
||||||
HarvestResource resource) =>
|
HarvestResource resource) => resource.Types.RandomElement();
|
||||||
resource.Types.Length > 0 ? resource.Types[Utility.Random(resource.Types.Length)] : null;
|
|
||||||
|
|
||||||
public virtual HarvestResource MutateResource(Mobile from, Item tool, HarvestDefinition def, Map map, Point3D loc,
|
public virtual HarvestResource MutateResource(Mobile from, Item tool, HarvestDefinition def, Map map, Point3D loc,
|
||||||
HarvestVein vein, HarvestResource primary, HarvestResource fallback)
|
HarvestVein vein, HarvestResource primary, HarvestResource fallback)
|
||||||
|
|
|
||||||
|
|
@ -146,7 +146,7 @@ namespace Server.Engines.Harvest
|
||||||
double chance = (skillValue - entry.m_MinSkill) / (entry.m_MaxSkill - entry.m_MinSkill);
|
double chance = (skillValue - entry.m_MinSkill) / (entry.m_MaxSkill - entry.m_MinSkill);
|
||||||
|
|
||||||
if (chance > Utility.RandomDouble())
|
if (chance > Utility.RandomDouble())
|
||||||
return entry.m_Types[Utility.Random(entry.m_Types.Length)];
|
return entry.m_Types.RandomElement();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -263,8 +263,7 @@ namespace Server.Menus.Questions
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int idx = Utility.Random(m_Destination.Locations.Length);
|
Point3D dest = m_Destination.Locations.RandomElement();
|
||||||
Point3D dest = m_Destination.Locations[idx];
|
|
||||||
|
|
||||||
Map destMap;
|
Map destMap;
|
||||||
if (m_Mobile.Map == Map.Trammel)
|
if (m_Mobile.Map == Map.Trammel)
|
||||||
|
|
|
||||||
|
|
@ -234,9 +234,9 @@ namespace Server.Items
|
||||||
|
|
||||||
for (int i = 0; i < Hints.Length; i++)
|
for (int i = 0; i < Hints.Length; i++)
|
||||||
{
|
{
|
||||||
int pos = Utility.Random(list.Count);
|
var random = list.RandomElement();
|
||||||
Hints[i] = list[pos];
|
Hints[i] = random;
|
||||||
list.RemoveAt(pos);
|
list.Remove(random);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ namespace Server.Engines.MLQuests.Items
|
||||||
|
|
||||||
protected void AddBaseLoot(params Type[][] lootSets)
|
protected void AddBaseLoot(params Type[][] lootSets)
|
||||||
{
|
{
|
||||||
Item loot = Loot.Construct(lootSets[Utility.Random(lootSets.Length)]);
|
Item loot = Loot.Construct(lootSets.RandomElement());
|
||||||
|
|
||||||
if (loot == null)
|
if (loot == null)
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -569,7 +569,7 @@ namespace Server.Engines.MLQuests
|
||||||
m_EligiblePool.Add(quest);
|
m_EligiblePool.Add(quest);
|
||||||
}
|
}
|
||||||
|
|
||||||
return m_EligiblePool.Count == 0 ? fallback : m_EligiblePool[Utility.Random(m_EligiblePool.Count)];
|
return m_EligiblePool.Count == 0 ? fallback : m_EligiblePool.RandomElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void TurnToFace(IQuestGiver quester, Mobile mob)
|
public static void TurnToFace(IQuestGiver quester, Mobile mob)
|
||||||
|
|
|
||||||
|
|
@ -127,13 +127,7 @@ namespace Server.Engines.Quests.Collector
|
||||||
|
|
||||||
public override bool ForceShowProperties => ObjectPropertyList.Enabled;
|
public override bool ForceShowProperties => ObjectPropertyList.Enabled;
|
||||||
|
|
||||||
public static string RandomName(Mobile from)
|
public static string RandomName(Mobile from) => m_Names.RandomElement() ?? from.Name;
|
||||||
{
|
|
||||||
int index = Utility.Random(m_Names.Length);
|
|
||||||
if (m_Names[index] == null)
|
|
||||||
return from.Name;
|
|
||||||
return m_Names[index];
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void AddNameProperty(ObjectPropertyList list)
|
public override void AddNameProperty(ObjectPropertyList list)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -98,9 +98,7 @@ namespace Server.Engines.Quests.Hag
|
||||||
ingredients[n++] = currIngredient;
|
ingredients[n++] = currIngredient;
|
||||||
}
|
}
|
||||||
|
|
||||||
int index = Utility.Random(ingredients.Length);
|
return ingredients.RandomElement();
|
||||||
|
|
||||||
return ingredients[index];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -31,12 +31,7 @@ namespace Server.Engines.Quests.Hag
|
||||||
|
|
||||||
public Corpse Corpse { get; private set; }
|
public Corpse Corpse { get; private set; }
|
||||||
|
|
||||||
private static Point3D RandomCorpseLocation()
|
private static Point3D RandomCorpseLocation() => m_CorpseLocations.RandomElement();
|
||||||
{
|
|
||||||
int index = Utility.Random(m_CorpseLocations.Length);
|
|
||||||
|
|
||||||
return m_CorpseLocations[index];
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void CheckProgress()
|
public override void CheckProgress()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -82,11 +82,6 @@ namespace Server.Engines.Quests.Hag
|
||||||
AddConversation(new AcceptConversation());
|
AddConversation(new AcceptConversation());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Point3D RandomZeefzorpulLocation()
|
public static Point3D RandomZeefzorpulLocation() => m_ZeefzorpulLocations.RandomElement();
|
||||||
{
|
|
||||||
int index = Utility.Random(m_ZeefzorpulLocations.Length);
|
|
||||||
|
|
||||||
return m_ZeefzorpulLocations[index];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -628,7 +628,7 @@ namespace Server.Items
|
||||||
private string m_UrnName;
|
private string m_UrnName;
|
||||||
|
|
||||||
[Constructible]
|
[Constructible]
|
||||||
public AncientUrn() : this(Names[Utility.Random(Names.Length)])
|
public AncientUrn() : this(Names.RandomElement())
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -725,7 +725,7 @@ namespace Server.Items
|
||||||
private string m_SwordsName;
|
private string m_SwordsName;
|
||||||
|
|
||||||
[Constructible]
|
[Constructible]
|
||||||
public HonorableSwords() : this(AncientUrn.Names[Utility.Random(AncientUrn.Names.Length)])
|
public HonorableSwords() : this(AncientUrn.Names.RandomElement())
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -869,7 +869,7 @@ namespace Server.Items
|
||||||
public FluteOfRenewal()
|
public FluteOfRenewal()
|
||||||
{
|
{
|
||||||
Slayer = SlayerGroup.Groups[Utility.Random(SlayerGroup.Groups.Length - 1)].Super
|
Slayer = SlayerGroup.Groups[Utility.Random(SlayerGroup.Groups.Length - 1)].Super
|
||||||
.Name; // -1 to exclude Fey slayer. Try to confrim no fey slayer on this on OSI
|
.Name; // -1 to exclude Fey slayer. Try to confirm no fey slayer on this on OSI
|
||||||
|
|
||||||
ReplenishesCharges = true;
|
ReplenishesCharges = true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -154,7 +154,7 @@ namespace Server.Misc
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
i = ActivatorUtil.CreateInstance(
|
i = ActivatorUtil.CreateInstance(
|
||||||
m_LesserArtifacts[(int)DropEra - 1][Utility.Random(m_LesserArtifacts[(int)DropEra - 1].Length)])
|
m_LesserArtifacts[(int)DropEra - 1].RandomElement())
|
||||||
as
|
as
|
||||||
Item;
|
Item;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -297,10 +297,10 @@ namespace Server.Engines.Events
|
||||||
{
|
{
|
||||||
return target.Map.MapID switch
|
return target.Map.MapID switch
|
||||||
{
|
{
|
||||||
2 => Ilshenar_Locations[Utility.Random(Ilshenar_Locations.Length)],
|
2 => Ilshenar_Locations.RandomElement(),
|
||||||
3 => Malas_Locations[Utility.Random(Malas_Locations.Length)],
|
3 => Malas_Locations.RandomElement(),
|
||||||
4 => Tokuno_Locations[Utility.Random(Tokuno_Locations.Length)],
|
4 => Tokuno_Locations.RandomElement(),
|
||||||
_ => Felucca_Locations[Utility.Random(Felucca_Locations.Length)]
|
_ => Felucca_Locations.RandomElement()
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@ namespace Server.Items
|
||||||
|
|
||||||
private void AssignRandomName()
|
private void AssignRandomName()
|
||||||
{
|
{
|
||||||
Name = $"{m_Staff[Utility.Random(m_Staff.Length)]}'s Jack-O-Lantern";
|
Name = $"{m_Staff.RandomElement()}'s Jack-O-Lantern";
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool OnDragLift(Mobile from)
|
public override bool OnDragLift(Mobile from)
|
||||||
|
|
|
||||||
|
|
@ -18,13 +18,11 @@ namespace Server.Items.Holiday
|
||||||
|
|
||||||
private string m_Staffer;
|
private string m_Staffer;
|
||||||
|
|
||||||
public BasePaintedMask(int itemid)
|
public BasePaintedMask(int itemid) : this(m_Staffers.RandomElement(), itemid)
|
||||||
: this(m_Staffers[Utility.Random(m_Staffers.Length)], itemid)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public BasePaintedMask(string staffer, int itemid)
|
public BasePaintedMask(string staffer, int itemid) : base(itemid + Utility.Random(2))
|
||||||
: base(itemid + Utility.Random(2))
|
|
||||||
{
|
{
|
||||||
m_Staffer = staffer;
|
m_Staffer = staffer;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -97,7 +97,7 @@ namespace Server.Engines.Events
|
||||||
{
|
{
|
||||||
Map map = Utility.RandomBool() ? Map.Trammel : Map.Felucca;
|
Map map = Utility.RandomBool() ? Map.Trammel : Map.Felucca;
|
||||||
|
|
||||||
Point3D home = GetRandomPointInRect(m_Cemetaries[Utility.Random(m_Cemetaries.Length)], map);
|
Point3D home = GetRandomPointInRect(m_Cemetaries.RandomElement(), map);
|
||||||
|
|
||||||
if (map.CanSpawnMobile(home))
|
if (map.CanSpawnMobile(home))
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -36,8 +36,8 @@ namespace Server.Events.Halloween
|
||||||
public static DateTime FinishHalloween => new DateTime(2012, 11, 15);
|
public static DateTime FinishHalloween => new DateTime(2012, 11, 15);
|
||||||
|
|
||||||
public static Item RandomGMBeggerItem =>
|
public static Item RandomGMBeggerItem =>
|
||||||
(Item)ActivatorUtil.CreateInstance(m_GMBeggarTreats[Utility.Random(m_GMBeggarTreats.Length)]);
|
(Item)ActivatorUtil.CreateInstance(m_GMBeggarTreats.RandomElement());
|
||||||
|
|
||||||
public static Item RandomTreat => (Item)ActivatorUtil.CreateInstance(m_Treats[Utility.Random(m_Treats.Length)]);
|
public static Item RandomTreat => (Item)ActivatorUtil.CreateInstance(m_Treats.RandomElement());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -538,11 +538,9 @@ namespace Server.Items
|
||||||
|
|
||||||
while (amount > 0 && toKill.Count > 0)
|
while (amount > 0 && toKill.Count > 0)
|
||||||
{
|
{
|
||||||
int kill = Utility.Random(toKill.Count);
|
var kill = toKill.RandomElement();
|
||||||
|
kill.Kill();
|
||||||
toKill[kill].Kill();
|
toKill.Remove(kill);
|
||||||
|
|
||||||
toKill.RemoveAt(kill);
|
|
||||||
|
|
||||||
amount -= 1;
|
amount -= 1;
|
||||||
LiveCreatures = Math.Max(LiveCreatures - 1, 0);
|
LiveCreatures = Math.Max(LiveCreatures - 1, 0);
|
||||||
|
|
@ -639,7 +637,7 @@ namespace Server.Items
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Utility.RandomDouble() < 0.05)
|
if (Utility.RandomDouble() < 0.05)
|
||||||
fish.Hue = FishHues[Utility.Random(FishHues.Length)];
|
fish.Hue = FishHues.RandomElement();
|
||||||
else if (Utility.RandomDouble() < 0.5)
|
else if (Utility.RandomDouble() < 0.5)
|
||||||
fish.Hue = Utility.RandomMinMax(0x100, 0x3E5);
|
fish.Hue = Utility.RandomMinMax(0x100, 0x3E5);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -287,7 +287,7 @@ namespace Server.Items
|
||||||
}
|
}
|
||||||
|
|
||||||
if (level == 6 && Core.AOS)
|
if (level == 6 && Core.AOS)
|
||||||
cont.DropItem((Item)ActivatorUtil.CreateInstance(Artifacts[Utility.Random(Artifacts.Length)]));
|
cont.DropItem((Item)ActivatorUtil.CreateInstance(Artifacts.RandomElement()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool CheckLocked(Mobile from)
|
public override bool CheckLocked(Mobile from)
|
||||||
|
|
|
||||||
|
|
@ -22,9 +22,8 @@ namespace Server.Engines.Mahjong
|
||||||
|
|
||||||
public MahjongTileType Next()
|
public MahjongTileType Next()
|
||||||
{
|
{
|
||||||
int random = Utility.Random(LeftTileTypes.Count);
|
MahjongTileType next = LeftTileTypes.RandomElement();
|
||||||
MahjongTileType next = LeftTileTypes[random];
|
LeftTileTypes.Remove(next);
|
||||||
LeftTileTypes.RemoveAt(random);
|
|
||||||
|
|
||||||
return next;
|
return next;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -163,10 +163,7 @@ namespace Server.Items
|
||||||
if (m_Locations == null)
|
if (m_Locations == null)
|
||||||
LoadLocations();
|
LoadLocations();
|
||||||
|
|
||||||
if (m_Locations.Length > 0)
|
return m_Locations?.RandomElement() ?? Point2D.Zero;
|
||||||
return m_Locations[Utility.Random(m_Locations.Length)];
|
|
||||||
|
|
||||||
return Point2D.Zero;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Point2D GetRandomHavenLocation()
|
public static Point2D GetRandomHavenLocation()
|
||||||
|
|
@ -174,10 +171,7 @@ namespace Server.Items
|
||||||
if (m_HavenLocations == null)
|
if (m_HavenLocations == null)
|
||||||
LoadLocations();
|
LoadLocations();
|
||||||
|
|
||||||
if (m_HavenLocations.Length > 0)
|
return m_HavenLocations?.RandomElement() ?? Point2D.Zero;
|
||||||
return m_HavenLocations[Utility.Random(m_HavenLocations.Length)];
|
|
||||||
|
|
||||||
return Point2D.Zero;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void LoadLocations()
|
private static void LoadLocations()
|
||||||
|
|
@ -225,8 +219,7 @@ namespace Server.Items
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
bc = (BaseCreature)ActivatorUtil.CreateInstance(
|
bc = (BaseCreature)ActivatorUtil.CreateInstance(m_SpawnTypes[level].RandomElement());
|
||||||
m_SpawnTypes[level][Utility.Random(m_SpawnTypes[level].Length)]);
|
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -153,7 +153,7 @@ namespace Server.Items
|
||||||
{
|
{
|
||||||
Map map = Map;
|
Map map = Map;
|
||||||
BaseCreature bc =
|
BaseCreature bc =
|
||||||
(BaseCreature)ActivatorUtil.CreateInstance(Creatures[Utility.Random(Creatures.Length)]);
|
(BaseCreature)ActivatorUtil.CreateInstance(Creatures.RandomElement());
|
||||||
|
|
||||||
Point3D spawnLoc = GetSpawnPosition();
|
Point3D spawnLoc = GetSpawnPosition();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ namespace Server.Items
|
||||||
{
|
{
|
||||||
if (m_TurnedOn && IsLockedDown && (!m.Hidden || m.AccessLevel == AccessLevel.Player) &&
|
if (m_TurnedOn && IsLockedDown && (!m.Hidden || m.AccessLevel == AccessLevel.Player) &&
|
||||||
Utility.InRange(m.Location, Location, 2) && !Utility.InRange(oldLocation, Location, 2))
|
Utility.InRange(m.Location, Location, 2) && !Utility.InRange(oldLocation, Location, 2))
|
||||||
Effects.PlaySound(Location, Map, Sounds[Utility.Random(Sounds.Length)]);
|
Effects.PlaySound(Location, Map, Sounds.RandomElement());
|
||||||
|
|
||||||
base.OnMovement(m, oldLocation);
|
base.OnMovement(m, oldLocation);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -82,8 +82,7 @@ namespace Server.Items
|
||||||
if (list.Count == 0)
|
if (list.Count == 0)
|
||||||
return Point3D.Zero;
|
return Point3D.Zero;
|
||||||
|
|
||||||
int idx = Utility.Random(list.Count);
|
return list.RandomElement();
|
||||||
return list[idx];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AddOffsetLocation(Mobile from, int offsetX, int offsetY, List<Point3D> list)
|
private void AddOffsetLocation(Mobile from, int offsetX, int offsetY, List<Point3D> list)
|
||||||
|
|
|
||||||
|
|
@ -187,7 +187,7 @@ namespace Server.Items
|
||||||
|
|
||||||
for (int i = 0; i < 50; ++i)
|
for (int i = 0; i < 50; ++i)
|
||||||
{
|
{
|
||||||
Rectangle2D reg = regions[Utility.Random(regions.Length)];
|
Rectangle2D reg = regions.RandomElement();
|
||||||
int x = Utility.Random(reg.X, reg.Width);
|
int x = Utility.Random(reg.X, reg.Width);
|
||||||
int y = Utility.Random(reg.Y, reg.Height);
|
int y = Utility.Random(reg.Y, reg.Height);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -204,7 +204,7 @@ namespace Server.Items
|
||||||
maxIntensity = 15;
|
maxIntensity = 15;
|
||||||
}
|
}
|
||||||
|
|
||||||
int propertyCount = propertyCounts[Utility.Random(propertyCounts.Length)];
|
int propertyCount = propertyCounts.RandomElement();
|
||||||
|
|
||||||
BaseRunicTool.ApplyAttributesTo(this, true, 0, propertyCount, minIntensity, maxIntensity);
|
BaseRunicTool.ApplyAttributesTo(this, true, 0, propertyCount, minIntensity, maxIntensity);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -439,8 +439,8 @@ namespace Server.Items
|
||||||
if (randomizeOrder)
|
if (randomizeOrder)
|
||||||
for (int i = 0; i < attrs.Length; i++)
|
for (int i = 0; i < attrs.Length; i++)
|
||||||
{
|
{
|
||||||
int rand = Utility.Random(attrs.Length);
|
|
||||||
AosElementAttribute temp = attrs[i];
|
AosElementAttribute temp = attrs[i];
|
||||||
|
int rand = Utility.Random(attrs.Length);
|
||||||
|
|
||||||
attrs[i] = attrs[rand];
|
attrs[i] = attrs[rand];
|
||||||
attrs[rand] = temp;
|
attrs[rand] = temp;
|
||||||
|
|
@ -501,7 +501,7 @@ namespace Server.Items
|
||||||
if (entries.Length == 0)
|
if (entries.Length == 0)
|
||||||
return SlayerName.None;
|
return SlayerName.None;
|
||||||
|
|
||||||
entry = entries[Utility.Random(entries.Length)];
|
entry = entries.RandomElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
return entry.Name;
|
return entry.Name;
|
||||||
|
|
|
||||||
|
|
@ -302,7 +302,7 @@ namespace Server.Items
|
||||||
_ => m_CommonTracks
|
_ => m_CommonTracks
|
||||||
};
|
};
|
||||||
|
|
||||||
return list[Utility.Random(list.Length)];
|
return list.RandomElement();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@
|
||||||
|
|
||||||
[Constructible]
|
[Constructible]
|
||||||
public HolidayBell()
|
public HolidayBell()
|
||||||
: this(m_StaffNames[Utility.Random(m_StaffNames.Length)])
|
: this(m_StaffNames.RandomElement())
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -49,7 +49,7 @@
|
||||||
m_Maker = maker;
|
m_Maker = maker;
|
||||||
|
|
||||||
LootType = LootType.Blessed;
|
LootType = LootType.Blessed;
|
||||||
Hue = m_Hues[Utility.Random(m_Hues.Length)];
|
Hue = m_Hues.RandomElement();
|
||||||
SoundID = 0x0F5 + Utility.Random(14);
|
SoundID = 0x0F5 + Utility.Random(14);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -136,7 +136,7 @@ namespace Server.Items
|
||||||
|
|
||||||
public override bool Eat(Mobile from)
|
public override bool Eat(Mobile from)
|
||||||
{
|
{
|
||||||
int message = m_Messages[Utility.Random(m_Messages.Length)];
|
int message = m_Messages.RandomElement();
|
||||||
|
|
||||||
if (message != 0)
|
if (message != 0)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -38,8 +38,8 @@
|
||||||
0x448
|
0x448
|
||||||
};
|
};
|
||||||
|
|
||||||
public static int RandomGiftBoxHue => m_NormalHues[Utility.Random(m_NormalHues.Length)];
|
public static int RandomGiftBoxHue => m_NormalHues.RandomElement();
|
||||||
public static int RandomNeonBoxHue => m_NeonHues[Utility.Random(m_NeonHues.Length)];
|
public static int RandomNeonBoxHue => m_NeonHues.RandomElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
[Flippable(0x46A5, 0x46A6)]
|
[Flippable(0x46A5, 0x46A6)]
|
||||||
|
|
|
||||||
|
|
@ -31,11 +31,12 @@ namespace Server.Items
|
||||||
|
|
||||||
public class BadCard : Item
|
public class BadCard : Item
|
||||||
{
|
{
|
||||||
|
private static readonly int[] m_CardHues = { 0x45, 0x27, 0x3d0 };
|
||||||
|
|
||||||
[Constructible]
|
[Constructible]
|
||||||
public BadCard() : base(0x14ef)
|
public BadCard() : base(0x14ef)
|
||||||
{
|
{
|
||||||
int[] m_CardHues = { 0x45, 0x27, 0x3d0 };
|
Hue = m_CardHues.RandomElement();
|
||||||
Hue = m_CardHues[Utility.Random(m_CardHues.Length)];
|
|
||||||
Stackable = false;
|
Stackable = false;
|
||||||
LootType = LootType.Blessed;
|
LootType = LootType.Blessed;
|
||||||
Movable = true;
|
Movable = true;
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
[Constructible]
|
[Constructible]
|
||||||
public SnowPileDeco()
|
public SnowPileDeco()
|
||||||
: this(m_Types[Utility.Random(m_Types.Length)])
|
: this(m_Types.RandomElement())
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -55,10 +55,8 @@ namespace Server.Items
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string GetRandomTitle()
|
|
||||||
{
|
|
||||||
// All hail OSI staff
|
// All hail OSI staff
|
||||||
string[] titles =
|
private static readonly string[] titles =
|
||||||
{
|
{
|
||||||
/* 1 */ "Backflash",
|
/* 1 */ "Backflash",
|
||||||
/* 2 */ "Carbon",
|
/* 2 */ "Carbon",
|
||||||
|
|
@ -115,11 +113,7 @@ namespace Server.Items
|
||||||
/* 53 */ "Zoer"
|
/* 53 */ "Zoer"
|
||||||
};
|
};
|
||||||
|
|
||||||
if (titles.Length > 0)
|
public static string GetRandomTitle() => titles.RandomElement();
|
||||||
return titles[Utility.Random(titles.Length)];
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void GetProperties(ObjectPropertyList list)
|
public override void GetProperties(ObjectPropertyList list)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -479,9 +479,7 @@ namespace Server.Items
|
||||||
|
|
||||||
if (m_Region != null && Entries.Count != 0)
|
if (m_Region != null && Entries.Count != 0)
|
||||||
{
|
{
|
||||||
int winner = Utility.Random(Entries.Count);
|
m_Winner = Entries.RandomElement().From;
|
||||||
|
|
||||||
m_Winner = Entries[winner].From;
|
|
||||||
|
|
||||||
if (m_Winner != null)
|
if (m_Winner != null)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -200,7 +200,7 @@ namespace Server.Items
|
||||||
int[] sounds = MonsterStatuetteInfo.GetInfo(m_Type).Sounds;
|
int[] sounds = MonsterStatuetteInfo.GetInfo(m_Type).Sounds;
|
||||||
|
|
||||||
if (sounds.Length > 0)
|
if (sounds.Length > 0)
|
||||||
Effects.PlaySound(Location, Map, sounds[Utility.Random(sounds.Length)]);
|
Effects.PlaySound(Location, Map, sounds.RandomElement());
|
||||||
}
|
}
|
||||||
|
|
||||||
base.OnMovement(m, oldLocation);
|
base.OnMovement(m, oldLocation);
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,7 @@ namespace Server.Items
|
||||||
|
|
||||||
organ = random switch
|
organ = random switch
|
||||||
{
|
{
|
||||||
0 => (PlagueBeastOrgan)new PlagueBeastRockOrgan(),
|
0 => new PlagueBeastRockOrgan(),
|
||||||
1 => new PlagueBeastMaidenOrgan(),
|
1 => new PlagueBeastMaidenOrgan(),
|
||||||
2 => new PlagueBeastRubbleOrgan(),
|
2 => new PlagueBeastRubbleOrgan(),
|
||||||
_ => new PlagueBeastRockOrgan()
|
_ => new PlagueBeastRockOrgan()
|
||||||
|
|
@ -99,10 +99,9 @@ namespace Server.Items
|
||||||
|
|
||||||
for (int i = 0; i < m_BrainHues.Length; i++)
|
for (int i = 0; i < m_BrainHues.Length; i++)
|
||||||
{
|
{
|
||||||
int random = Utility.Random(organs.Count);
|
organ = organs.RandomElement();
|
||||||
organ = organs[random];
|
|
||||||
organ.BrainHue = m_BrainHues[i];
|
organ.BrainHue = m_BrainHues[i];
|
||||||
organs.RemoveAt(random);
|
organs.Remove(organ);
|
||||||
}
|
}
|
||||||
|
|
||||||
organs.Clear();
|
organs.Clear();
|
||||||
|
|
|
||||||
|
|
@ -135,7 +135,7 @@ namespace Server.Items
|
||||||
min /= 5;
|
min /= 5;
|
||||||
max /= 5;
|
max /= 5;
|
||||||
|
|
||||||
return new PowerScroll(Skills[Utility.Random(Skills.Count)], 100 + Utility.RandomMinMax(min, max) * 5);
|
return new PowerScroll(Skills.RandomElement(), 100 + Utility.RandomMinMax(min, max) * 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static PowerScroll CreateRandomNoCraft(int min, int max)
|
public static PowerScroll CreateRandomNoCraft(int min, int max)
|
||||||
|
|
@ -147,7 +147,7 @@ namespace Server.Items
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
skillName = Skills[Utility.Random(Skills.Count)];
|
skillName = Skills.RandomElement();
|
||||||
} while (skillName == SkillName.Blacksmith || skillName == SkillName.Tailoring);
|
} while (skillName == SkillName.Blacksmith || skillName == SkillName.Tailoring);
|
||||||
|
|
||||||
return new PowerScroll(skillName, 100 + Utility.RandomMinMax(min, max) * 5);
|
return new PowerScroll(skillName, 100 + Utility.RandomMinMax(min, max) * 5);
|
||||||
|
|
|
||||||
|
|
@ -30,12 +30,8 @@ namespace Server.Items
|
||||||
public override string DefaultTitle =>
|
public override string DefaultTitle =>
|
||||||
$"<basefont color=#FFFFFF>Scroll of Transcendence ({Value} Skill):</basefont>";
|
$"<basefont color=#FFFFFF>Scroll of Transcendence ({Value} Skill):</basefont>";
|
||||||
|
|
||||||
public static ScrollofTranscendence CreateRandom(int min, int max)
|
public static ScrollofTranscendence CreateRandom(int min, int max) =>
|
||||||
{
|
new ScrollofTranscendence(Utility.RandomSkill(), Utility.RandomMinMax(min, max) * 0.1);
|
||||||
SkillName skill = (SkillName)Utility.Random(SkillInfo.Table.Length);
|
|
||||||
|
|
||||||
return new ScrollofTranscendence(skill, Utility.RandomMinMax(min, max) * 0.1);
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void GetProperties(ObjectPropertyList list)
|
public override void GetProperties(ObjectPropertyList list)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -955,7 +955,7 @@ namespace Server.Items
|
||||||
1023817 // clean bandage
|
1023817 // clean bandage
|
||||||
};
|
};
|
||||||
|
|
||||||
public static Type GetRandomSummonType() => m_Summons[Utility.Random(m_Summons.Length)];
|
public static Type GetRandomSummonType() => m_Summons.RandomElement();
|
||||||
|
|
||||||
public static TalismanAttribute GetRandomSummoner()
|
public static TalismanAttribute GetRandomSummoner()
|
||||||
{
|
{
|
||||||
|
|
@ -1049,7 +1049,7 @@ namespace Server.Items
|
||||||
SkillName.Tinkering
|
SkillName.Tinkering
|
||||||
};
|
};
|
||||||
|
|
||||||
public static SkillName GetRandomSkill() => m_Skills[Utility.Random(m_Skills.Length)];
|
public static SkillName GetRandomSkill() => m_Skills.RandomElement();
|
||||||
|
|
||||||
public static int GetRandomExceptional()
|
public static int GetRandomExceptional()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -17,8 +17,7 @@ namespace Server.Items
|
||||||
{
|
{
|
||||||
ItemID = 0x13B1;
|
ItemID = 0x13B1;
|
||||||
Hue = 0x48F;
|
Hue = 0x48F;
|
||||||
SkillBonuses.SetValues(0, m_PossibleBonusSkills[Utility.Random(m_PossibleBonusSkills.Length)],
|
SkillBonuses.SetValues(0, m_PossibleBonusSkills.RandomElement(), Utility.Random(4) == 0 ? 10.0 : 5.0);
|
||||||
Utility.Random(4) == 0 ? 10.0 : 5.0);
|
|
||||||
WeaponAttributes.SelfRepair = 5;
|
WeaponAttributes.SelfRepair = 5;
|
||||||
Attributes.WeaponSpeed = 50;
|
Attributes.WeaponSpeed = 50;
|
||||||
Attributes.WeaponDamage = 35;
|
Attributes.WeaponDamage = 35;
|
||||||
|
|
@ -49,8 +48,7 @@ namespace Server.Items
|
||||||
int version = reader.ReadInt();
|
int version = reader.ReadInt();
|
||||||
|
|
||||||
if (version < 1)
|
if (version < 1)
|
||||||
SkillBonuses.SetValues(0, m_PossibleBonusSkills[Utility.Random(m_PossibleBonusSkills.Length)],
|
SkillBonuses.SetValues(0, m_PossibleBonusSkills.RandomElement(), Utility.Random(4) == 0 ? 10.0 : 5.0);
|
||||||
Utility.Random(4) == 0 ? 10.0 : 5.0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -201,10 +201,7 @@ namespace Server.Items
|
||||||
{
|
{
|
||||||
int index = Utility.Random(1 + group.Entries.Length);
|
int index = Utility.Random(1 + group.Entries.Length);
|
||||||
|
|
||||||
if (index == 0)
|
return index == 0 ? group.Super.Name : group.Entries[index - 1].Name;
|
||||||
return group.Super.Name;
|
|
||||||
|
|
||||||
return group.Entries[index - 1].Name;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1102,7 +1102,7 @@ namespace Server.Misc
|
||||||
int[] hues = { 0x1A8, 0xEC, 0x99, 0x90, 0xB5, 0x336, 0x89 };
|
int[] hues = { 0x1A8, 0xEC, 0x99, 0x90, 0xB5, 0x336, 0x89 };
|
||||||
// TODO: Verify that's ALL the hues for that above.
|
// TODO: Verify that's ALL the hues for that above.
|
||||||
|
|
||||||
EquipItem(new TattsukeHakama(hues[Utility.Random(hues.Length)]));
|
EquipItem(new TattsukeHakama(hues.RandomElement()));
|
||||||
|
|
||||||
EquipItem(new HakamaShita(0x2C3));
|
EquipItem(new HakamaShita(0x2C3));
|
||||||
EquipItem(new NinjaTabi(0x2C3));
|
EquipItem(new NinjaTabi(0x2C3));
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ namespace Server.Items
|
||||||
[Constructible]
|
[Constructible]
|
||||||
public LightOfTheWinterSolstice(string dipper = null) : base(0x236E)
|
public LightOfTheWinterSolstice(string dipper = null) : base(0x236E)
|
||||||
{
|
{
|
||||||
Dipper = dipper ?? m_StaffNames[Utility.Random(m_StaffNames.Length)];
|
Dipper = dipper ?? m_StaffNames.RandomElement();
|
||||||
|
|
||||||
Weight = 1.0;
|
Weight = 1.0;
|
||||||
LootType = LootType.Blessed;
|
LootType = LootType.Blessed;
|
||||||
|
|
@ -81,7 +81,7 @@ namespace Server.Items
|
||||||
}
|
}
|
||||||
case 0:
|
case 0:
|
||||||
{
|
{
|
||||||
Dipper = m_StaffNames[Utility.Random(m_StaffNames.Length)];
|
Dipper = m_StaffNames.RandomElement();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -134,7 +134,7 @@ namespace Server.Guilds
|
||||||
|
|
||||||
public void CalculateAllianceLeader()
|
public void CalculateAllianceLeader()
|
||||||
{
|
{
|
||||||
m_Leader = m_Members.Count >= 2 ? m_Members[Utility.Random(m_Members.Count)] : null;
|
m_Leader = m_Members.Count >= 2 ? m_Members.RandomElement() : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void CheckLeader()
|
public void CheckLeader()
|
||||||
|
|
|
||||||
|
|
@ -300,7 +300,7 @@ namespace Server.Misc
|
||||||
|
|
||||||
public IHSFlags Flags { get; set; }
|
public IHSFlags Flags { get; set; }
|
||||||
|
|
||||||
public string GetRandomSyllable() => Syllables[Utility.Random(Syllables.Length)];
|
public string GetRandomSyllable() => Syllables.RandomElement();
|
||||||
|
|
||||||
public string ConstructWord(int syllableCount)
|
public string ConstructWord(int syllableCount)
|
||||||
{
|
{
|
||||||
|
|
@ -367,17 +367,14 @@ namespace Server.Misc
|
||||||
public void SayRandomTranslate(Mobile mob, params string[] sentancesInEnglish)
|
public void SayRandomTranslate(Mobile mob, params string[] sentancesInEnglish)
|
||||||
{
|
{
|
||||||
SaySentance(mob, Utility.RandomMinMax(2, 3));
|
SaySentance(mob, Utility.RandomMinMax(2, 3));
|
||||||
mob.Say(sentancesInEnglish[Utility.Random(sentancesInEnglish.Length)]);
|
mob.Say(sentancesInEnglish.RandomElement());
|
||||||
}
|
}
|
||||||
|
|
||||||
private string GetRandomResponseWord(List<string> keywordsFound)
|
private string GetRandomResponseWord(List<string> keywordsFound)
|
||||||
{
|
{
|
||||||
int random = Utility.Random(keywordsFound.Count + Responses.Length);
|
int random = Utility.Random(keywordsFound.Count + Responses.Length);
|
||||||
|
|
||||||
if (random < keywordsFound.Count)
|
return random < keywordsFound.Count ? keywordsFound[random] : Responses[random - keywordsFound.Count];
|
||||||
return keywordsFound[random];
|
|
||||||
|
|
||||||
return Responses[random - keywordsFound.Count];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool OnSpeech(Mobile mob, Mobile speaker, string text)
|
public bool OnSpeech(Mobile mob, Mobile speaker, string text)
|
||||||
|
|
@ -411,7 +408,7 @@ namespace Server.Misc
|
||||||
if (Utility.RandomBool())
|
if (Utility.RandomBool())
|
||||||
responseWord = GetRandomResponseWord(keywordsFound);
|
responseWord = GetRandomResponseWord(keywordsFound);
|
||||||
else
|
else
|
||||||
responseWord = keywordsFound[Utility.Random(keywordsFound.Count)];
|
responseWord = keywordsFound.RandomElement();
|
||||||
|
|
||||||
string secondResponseWord = GetRandomResponseWord(keywordsFound);
|
string secondResponseWord = GetRandomResponseWord(keywordsFound);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -539,13 +539,7 @@ namespace Server
|
||||||
|
|
||||||
public static Item RandomNecromancyReagent() => Construct(NecroRegTypes);
|
public static Item RandomNecromancyReagent() => Construct(NecroRegTypes);
|
||||||
|
|
||||||
public static Item RandomPossibleReagent()
|
public static Item RandomPossibleReagent() => Core.AOS ? Construct(RegTypes, NecroRegTypes) : Construct(RegTypes);
|
||||||
{
|
|
||||||
if (Core.AOS)
|
|
||||||
return Construct(RegTypes, NecroRegTypes);
|
|
||||||
|
|
||||||
return Construct(RegTypes);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Item RandomPotion() => Construct(PotionTypes);
|
public static Item RandomPotion() => Construct(PotionTypes);
|
||||||
|
|
||||||
|
|
@ -621,6 +615,8 @@ namespace Server
|
||||||
|
|
||||||
public static Item Construct(Type type)
|
public static Item Construct(Type type)
|
||||||
{
|
{
|
||||||
|
if (type == null) return null;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return ActivatorUtil.CreateInstance(type) as Item;
|
return ActivatorUtil.CreateInstance(type) as Item;
|
||||||
|
|
@ -631,13 +627,7 @@ namespace Server
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Item Construct(Type[] types)
|
public static Item Construct(Type[] types) => Construct(types.RandomElement());
|
||||||
{
|
|
||||||
if (types.Length > 0)
|
|
||||||
return Construct(types, Utility.Random(types.Length));
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Item Construct(Type[] types, int index)
|
public static Item Construct(Type[] types, int index)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ namespace Server
|
||||||
|
|
||||||
public static void GiveArtifactTo(Mobile m)
|
public static void GiveArtifactTo(Mobile m)
|
||||||
{
|
{
|
||||||
if (!(ActivatorUtil.CreateInstance(Artifacts[Utility.Random(Artifacts.Length)]) is Item item))
|
if (!(ActivatorUtil.CreateInstance(Artifacts.RandomElement()) is Item item))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (m.AddToBackpack(item))
|
if (m.AddToBackpack(item))
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ namespace Server
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string GetRandomName() => List.Length > 0 ? List[Utility.Random(List.Length)] : "";
|
public string GetRandomName() => List.RandomElement() ?? "";
|
||||||
|
|
||||||
public static NameList GetNameList(string type)
|
public static NameList GetNameList(string type)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -184,7 +184,7 @@ namespace Server.Misc
|
||||||
return m_SkinHues[0];
|
return m_SkinHues[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
public override int RandomSkinHue() => m_SkinHues[Utility.Random(m_SkinHues.Length)] | 0x8000;
|
public override int RandomSkinHue() => m_SkinHues.RandomElement() | 0x8000;
|
||||||
|
|
||||||
public override int ClipHairHue(int hue)
|
public override int ClipHairHue(int hue)
|
||||||
{
|
{
|
||||||
|
|
@ -195,7 +195,7 @@ namespace Server.Misc
|
||||||
return m_HairHues[0];
|
return m_HairHues[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
public override int RandomHairHue() => m_HairHues[Utility.Random(m_HairHues.Length)];
|
public override int RandomHairHue() => m_HairHues.RandomElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
private class Gargoyle : Race
|
private class Gargoyle : Race
|
||||||
|
|
@ -258,7 +258,7 @@ namespace Server.Misc
|
||||||
|
|
||||||
public override int ClipSkinHue(int hue) => hue;
|
public override int ClipSkinHue(int hue) => hue;
|
||||||
|
|
||||||
public override int RandomSkinHue() => m_BodyHues[Utility.Random(m_BodyHues.Length)] | 0x8000;
|
public override int RandomSkinHue() => m_BodyHues.RandomElement() | 0x8000;
|
||||||
|
|
||||||
public override int ClipHairHue(int hue)
|
public override int ClipHairHue(int hue)
|
||||||
{
|
{
|
||||||
|
|
@ -269,7 +269,7 @@ namespace Server.Misc
|
||||||
return m_HornHues[0];
|
return m_HornHues[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
public override int RandomHairHue() => m_HornHues[Utility.Random(m_HornHues.Length)];
|
public override int RandomHairHue() => m_HornHues.RandomElement();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2108,20 +2108,14 @@ namespace Server.Mobiles
|
||||||
|
|
||||||
public Spell GetAttackSpellRandom()
|
public Spell GetAttackSpellRandom()
|
||||||
{
|
{
|
||||||
if (m_SpellAttack.Count == 0)
|
Type type = m_SpellAttack.RandomElement();
|
||||||
return null;
|
return type == null ? null : ActivatorUtil.CreateInstance(type, this, null) as Spell;
|
||||||
|
|
||||||
Type type = m_SpellAttack[Utility.Random(m_SpellAttack.Count)];
|
|
||||||
return ActivatorUtil.CreateInstance(type, this, null) as Spell;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Spell GetDefenseSpellRandom()
|
public Spell GetDefenseSpellRandom()
|
||||||
{
|
{
|
||||||
if (m_SpellDefense.Count == 0)
|
Type type = m_SpellDefense.RandomElement();
|
||||||
return null;
|
return type == null ? null : ActivatorUtil.CreateInstance(type, this, null) as Spell;
|
||||||
|
|
||||||
Type type = m_SpellDefense[Utility.Random(m_SpellDefense.Count)];
|
|
||||||
return ActivatorUtil.CreateInstance(type, this, null) as Spell;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Spell GetSpellSpecific(Type type)
|
public Spell GetSpellSpecific(Type type)
|
||||||
|
|
@ -2853,7 +2847,7 @@ namespace Server.Mobiles
|
||||||
|
|
||||||
for (int i = 0; i < items.Count; ++i)
|
for (int i = 0; i < items.Count; ++i)
|
||||||
{
|
{
|
||||||
Item item = items[Utility.Random(items.Count)];
|
Item item = items.RandomElement();
|
||||||
|
|
||||||
Lift(item, item.Amount, out bool rejected, out LRReason _);
|
Lift(item, item.Amount, out bool rejected, out LRReason _);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -143,10 +143,7 @@ namespace Server.Mobiles
|
||||||
rights.RemoveAt(i);
|
rights.RemoveAt(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rights.Count > 0)
|
return rights.RandomElement()?.m_Mobile;
|
||||||
return rights[Utility.Random(rights.Count)].m_Mobile;
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void DistributeArtifact(BaseCreature creature)
|
public static void DistributeArtifact(BaseCreature creature)
|
||||||
|
|
|
||||||
|
|
@ -84,7 +84,7 @@ namespace Server.Mobiles
|
||||||
"{0}!! You will pay for that!"
|
"{0}!! You will pay for that!"
|
||||||
};
|
};
|
||||||
|
|
||||||
Say(true, string.Format(toSay[Utility.Random(toSay.Length)], from.Name));
|
Say(true, string.Format(toSay.RandomElement(), from.Name));
|
||||||
}
|
}
|
||||||
|
|
||||||
base.OnDamage(amount, from, willKill);
|
base.OnDamage(amount, from, willKill);
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,7 @@ namespace Server.Mobiles
|
||||||
if (to != null)
|
if (to != null)
|
||||||
QuestSystem.FocusTo(this, to);
|
QuestSystem.FocusTo(this, to);
|
||||||
|
|
||||||
Say(m_Vocabulary[Utility.Random(m_Vocabulary.Length)]);
|
Say(m_Vocabulary.RandomElement());
|
||||||
|
|
||||||
if (to != null && Utility.RandomBool())
|
if (to != null && Utility.RandomBool())
|
||||||
Timer.DelayCall(TimeSpan.FromSeconds(Utility.RandomMinMax(5, 8)), to.Talk);
|
Timer.DelayCall(TimeSpan.FromSeconds(Utility.RandomMinMax(5, 8)), to.Talk);
|
||||||
|
|
|
||||||
|
|
@ -79,9 +79,9 @@ namespace Server.Mobiles
|
||||||
|
|
||||||
while (spiritsOrVortexes.Count > 6)
|
while (spiritsOrVortexes.Count > 6)
|
||||||
{
|
{
|
||||||
int index = Utility.Random(spiritsOrVortexes.Count);
|
var random = spiritsOrVortexes.RandomElement();
|
||||||
Dispel(spiritsOrVortexes[index]);
|
Dispel(random);
|
||||||
spiritsOrVortexes.RemoveAt(index);
|
spiritsOrVortexes.Remove(random);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -86,9 +86,9 @@ namespace Server.Mobiles
|
||||||
|
|
||||||
while (spiritsOrVortexes.Count > 6)
|
while (spiritsOrVortexes.Count > 6)
|
||||||
{
|
{
|
||||||
int index = Utility.Random(spiritsOrVortexes.Count);
|
var random = spiritsOrVortexes.RandomElement();
|
||||||
Dispel(spiritsOrVortexes[index]);
|
Dispel(random);
|
||||||
spiritsOrVortexes.RemoveAt(index);
|
spiritsOrVortexes.Remove(random);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ namespace Server.Mobiles
|
||||||
[Constructible]
|
[Constructible]
|
||||||
public OphidianArchmage() : base(AIType.AI_Mage, FightMode.Closest, 10, 1, 0.2, 0.4)
|
public OphidianArchmage() : base(AIType.AI_Mage, FightMode.Closest, 10, 1, 0.2, 0.4)
|
||||||
{
|
{
|
||||||
Name = m_Names[Utility.Random(m_Names.Length)];
|
Name = m_Names.RandomElement();
|
||||||
Body = 85;
|
Body = 85;
|
||||||
BaseSoundID = 639;
|
BaseSoundID = 639;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ namespace Server.Mobiles
|
||||||
[Constructible]
|
[Constructible]
|
||||||
public OphidianMage() : base(AIType.AI_Mage, FightMode.Closest, 10, 1, 0.2, 0.4)
|
public OphidianMage() : base(AIType.AI_Mage, FightMode.Closest, 10, 1, 0.2, 0.4)
|
||||||
{
|
{
|
||||||
Name = m_Names[Utility.Random(m_Names.Length)];
|
Name = m_Names.RandomElement();
|
||||||
Body = 85;
|
Body = 85;
|
||||||
BaseSoundID = 639;
|
BaseSoundID = 639;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ namespace Server.Mobiles
|
||||||
[Constructible]
|
[Constructible]
|
||||||
public OphidianKnight() : base(AIType.AI_Melee, FightMode.Closest, 10, 1, 0.2, 0.4)
|
public OphidianKnight() : base(AIType.AI_Melee, FightMode.Closest, 10, 1, 0.2, 0.4)
|
||||||
{
|
{
|
||||||
Name = m_Names[Utility.Random(m_Names.Length)];
|
Name = m_Names.RandomElement();
|
||||||
Body = 86;
|
Body = 86;
|
||||||
BaseSoundID = 634;
|
BaseSoundID = 634;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ namespace Server.Mobiles
|
||||||
[Constructible]
|
[Constructible]
|
||||||
public OphidianWarrior() : base(AIType.AI_Melee, FightMode.Closest, 10, 1, 0.2, 0.4)
|
public OphidianWarrior() : base(AIType.AI_Melee, FightMode.Closest, 10, 1, 0.2, 0.4)
|
||||||
{
|
{
|
||||||
Name = m_Names[Utility.Random(m_Names.Length)];
|
Name = m_Names.RandomElement();
|
||||||
Body = 86;
|
Body = 86;
|
||||||
BaseSoundID = 634;
|
BaseSoundID = 634;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -59,15 +59,13 @@ namespace Server.Mobiles
|
||||||
if (list.Length == 0)
|
if (list.Length == 0)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
int random = Utility.Random(list.Length);
|
Type type = list.RandomElement();
|
||||||
|
|
||||||
Type type = list[random];
|
|
||||||
|
|
||||||
Item artifact = Loot.Construct(type);
|
Item artifact = Loot.Construct(type);
|
||||||
|
|
||||||
if (artifact is MonsterStatuette statuette && StatueTypes.Length > 0)
|
if (StatueTypes.Length > 0 && artifact is MonsterStatuette statuette)
|
||||||
{
|
{
|
||||||
statuette.Type = StatueTypes[Utility.Random(StatueTypes.Length)];
|
statuette.Type = StatueTypes.RandomElement();
|
||||||
statuette.LootType = LootType.Regular;
|
statuette.LootType = LootType.Regular;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -249,7 +247,7 @@ namespace Server.Mobiles
|
||||||
}
|
}
|
||||||
|
|
||||||
if (toGive.Count > 0)
|
if (toGive.Count > 0)
|
||||||
toGive[Utility.Random(toGive.Count)].AddToBackpack(new ChampionSkull(SkullType));
|
toGive.RandomElement().AddToBackpack(new ChampionSkull(SkullType));
|
||||||
else
|
else
|
||||||
c.DropItem(new ChampionSkull(SkullType));
|
c.DropItem(new ChampionSkull(SkullType));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -116,7 +116,7 @@ namespace Server.Mobiles
|
||||||
if (Instances.Count > 0)
|
if (Instances.Count > 0)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
SpawnEntry entry = m_Entries[Utility.Random(m_Entries.Length)];
|
SpawnEntry entry = m_Entries.RandomElement();
|
||||||
|
|
||||||
Harrower harrower = new Harrower();
|
Harrower harrower = new Harrower();
|
||||||
|
|
||||||
|
|
@ -454,17 +454,7 @@ namespace Server.Mobiles
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Item CreateArtifact(Type[] list)
|
public Item CreateArtifact(Type[] list) => Loot.Construct(list.RandomElement());
|
||||||
{
|
|
||||||
if (list.Length == 0)
|
|
||||||
return null;
|
|
||||||
|
|
||||||
int random = Utility.Random(list.Length);
|
|
||||||
|
|
||||||
Type type = list[random];
|
|
||||||
|
|
||||||
return Loot.Construct(type);
|
|
||||||
}
|
|
||||||
|
|
||||||
private class SpawnEntry
|
private class SpawnEntry
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -180,7 +180,7 @@ namespace Server.Mobiles
|
||||||
|
|
||||||
public static void GiveArtifactTo(Mobile m)
|
public static void GiveArtifactTo(Mobile m)
|
||||||
{
|
{
|
||||||
Item item = (Item)ActivatorUtil.CreateInstance(Artifacts[Utility.Random(Artifacts.Length)]);
|
Item item = (Item)ActivatorUtil.CreateInstance(Artifacts.RandomElement());
|
||||||
|
|
||||||
if (m.AddToBackpack(item))
|
if (m.AddToBackpack(item))
|
||||||
m.SendMessage("As a reward for slaying the mighty paragon, an artifact has been placed in your backpack.");
|
m.SendMessage("As a reward for slaying the mighty paragon, an artifact has been placed in your backpack.");
|
||||||
|
|
|
||||||
|
|
@ -586,7 +586,7 @@ namespace Server.Mobiles
|
||||||
|
|
||||||
while (picked == null)
|
while (picked == null)
|
||||||
{
|
{
|
||||||
picked = possible[Utility.Random(possible.Length)];
|
picked = possible.RandomElement();
|
||||||
EDI test = EDI.Find(picked);
|
EDI test = EDI.Find(picked);
|
||||||
|
|
||||||
if (test.Contains(Location))
|
if (test.Contains(Location))
|
||||||
|
|
|
||||||
|
|
@ -42,10 +42,7 @@ namespace Server.Mobiles
|
||||||
RemoveEntry(tce);
|
RemoveEntry(tce);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Entries == null || Entries.Count == 0)
|
return Entries.RandomElement();
|
||||||
return null;
|
|
||||||
|
|
||||||
return Entries[Utility.Random(Entries.Count)];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public TownCrierEntry AddEntry(string[] lines, TimeSpan duration)
|
public TownCrierEntry AddEntry(string[] lines, TimeSpan duration)
|
||||||
|
|
@ -372,10 +369,7 @@ namespace Server.Mobiles
|
||||||
|
|
||||||
TownCrierEntry entry = GlobalTownCrierEntryList.Instance.GetRandomEntry();
|
TownCrierEntry entry = GlobalTownCrierEntryList.Instance.GetRandomEntry();
|
||||||
|
|
||||||
if (entry == null || Utility.RandomBool())
|
return entry ?? (Utility.RandomBool() ? Entries.RandomElement() : null);
|
||||||
entry = Entries[Utility.Random(Entries.Count)];
|
|
||||||
|
|
||||||
return entry;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public TownCrierEntry AddEntry(string[] lines, TimeSpan duration)
|
public TownCrierEntry AddEntry(string[] lines, TimeSpan duration)
|
||||||
|
|
|
||||||
|
|
@ -324,10 +324,8 @@ namespace Server.SkillHandlers
|
||||||
|
|
||||||
if (pack?.Items.Count > 0)
|
if (pack?.Items.Count > 0)
|
||||||
{
|
{
|
||||||
int randomIndex = Utility.Random(pack.Items.Count);
|
|
||||||
|
|
||||||
root = mobile;
|
root = mobile;
|
||||||
stolen = TryStealItem(pack.Items[randomIndex], ref caught);
|
stolen = TryStealItem(pack.Items.RandomElement(), ref caught);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,7 @@ namespace Server.Misc
|
||||||
|
|
||||||
private static bool HasDisconnected(Mobile m) => m.NetState?.Connection == null;
|
private static bool HasDisconnected(Mobile m) => m.NetState?.Connection == null;
|
||||||
|
|
||||||
private static LocationInfo GetRandomDestination() => m_Destinations[Utility.Random(m_Destinations.Length)];
|
private static LocationInfo GetRandomDestination() => m_Destinations.RandomElement();
|
||||||
|
|
||||||
private class LocationInfo
|
private class LocationInfo
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ namespace Server.Spells.Bushido
|
||||||
if (!CheckMana(attacker, true))
|
if (!CheckMana(attacker, true))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Mobile target = targets[Utility.Random(targets.Count)];
|
Mobile target = targets.RandomElement();
|
||||||
|
|
||||||
double damageBonus = attacker.Skills.Bushido.Value / 100.0;
|
double damageBonus = attacker.Skills.Bushido.Value / 100.0;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,7 @@ namespace Server.Spells.Fifth
|
||||||
if (CheckSequence())
|
if (CheckSequence())
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
BaseCreature creature = (BaseCreature)ActivatorUtil.CreateInstance(m_Types[Utility.Random(m_Types.Length)]);
|
BaseCreature creature = (BaseCreature)ActivatorUtil.CreateInstance(m_Types.RandomElement());
|
||||||
|
|
||||||
// creature.ControlSlots = 2;
|
// creature.ControlSlots = 2;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ namespace Server.Spells.First
|
||||||
{
|
{
|
||||||
if (CheckSequence())
|
if (CheckSequence())
|
||||||
{
|
{
|
||||||
FoodInfo foodInfo = m_Food[Utility.Random(m_Food.Length)];
|
FoodInfo foodInfo = m_Food.RandomElement();
|
||||||
Item food = foodInfo.Create();
|
Item food = foodInfo.Create();
|
||||||
|
|
||||||
if (food != null)
|
if (food != null)
|
||||||
|
|
|
||||||
|
|
@ -277,7 +277,7 @@ namespace Server.Spells.Necromancy
|
||||||
|
|
||||||
Type[] animates = entry.m_ToSummon;
|
Type[] animates = entry.m_ToSummon;
|
||||||
|
|
||||||
toSummon = animates[Utility.Random(animates.Length)];
|
toSummon = animates.RandomElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (toSummon == null)
|
if (toSummon == null)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue