feat: Replaces params array with params ReadOnlySpan (#2125)
This commit is contained in:
parent
90059c5e74
commit
279b10dd0f
15 changed files with 36 additions and 35 deletions
|
|
@ -360,10 +360,10 @@ namespace Server.Misc
|
|||
return sentence.ToString();
|
||||
}
|
||||
|
||||
public void SayRandomTranslate(Mobile mob, params string[] sentancesInEnglish)
|
||||
public void SayRandomTranslate(Mobile mob, params ReadOnlySpan<string> sentencesInEnglish)
|
||||
{
|
||||
SaySentance(mob, Utility.RandomMinMax(2, 3));
|
||||
mob.Say(sentancesInEnglish.RandomElement());
|
||||
mob.Say(sentencesInEnglish.RandomElement());
|
||||
}
|
||||
|
||||
private string GetRandomResponseWord(List<string> keywordsFound)
|
||||
|
|
|
|||
|
|
@ -766,15 +766,15 @@ namespace Server
|
|||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static Item Construct(params Type[] types) => Construct<Item>(types.RandomElement());
|
||||
public static Item Construct(params ReadOnlySpan<Type> types) => Construct<Item>(types.RandomElement());
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static T Construct<T>(params Type[] types) where T : Item => Construct<T>(types.RandomElement());
|
||||
public static T Construct<T>(params ReadOnlySpan<Type> types) where T : Item => Construct<T>(types.RandomElement());
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static Item Construct(Type[] types, int index) => Construct<Item>(types, index);
|
||||
public static Item Construct(ReadOnlySpan<Type> types, int index) => Construct<Item>(types, index);
|
||||
|
||||
public static T Construct<T>(Type[] types, int index) where T : Item
|
||||
public static T Construct<T>(ReadOnlySpan<Type> types, int index) where T : Item
|
||||
{
|
||||
if (index >= 0 && index < types.Length)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -15,14 +15,14 @@ namespace Server.Misc
|
|||
private int m_Stage;
|
||||
|
||||
public Weather(
|
||||
Map facet, Rectangle2D[] area, int temperature, int chanceOfPercipitation, int chanceOfExtremeTemperature,
|
||||
Map facet, Rectangle2D[] area, int temperature, int chanceOfPrecipitation, int chanceOfExtremeTemperature,
|
||||
TimeSpan interval
|
||||
)
|
||||
{
|
||||
Facet = facet;
|
||||
Area = area;
|
||||
Temperature = temperature;
|
||||
ChanceOfPercipitation = chanceOfPercipitation;
|
||||
ChanceOfPrecipitation = chanceOfPrecipitation;
|
||||
ChanceOfExtremeTemperature = chanceOfExtremeTemperature;
|
||||
|
||||
var list = GetWeatherList(facet);
|
||||
|
|
@ -42,7 +42,7 @@ namespace Server.Misc
|
|||
|
||||
public int Temperature { get; set; }
|
||||
|
||||
public int ChanceOfPercipitation { get; set; }
|
||||
public int ChanceOfPrecipitation { get; set; }
|
||||
|
||||
public int ChanceOfExtremeTemperature { get; set; }
|
||||
|
||||
|
|
@ -298,7 +298,7 @@ namespace Server.Misc
|
|||
{
|
||||
if (m_Stage == 0)
|
||||
{
|
||||
m_Active = ChanceOfPercipitation > Utility.Random(100);
|
||||
m_Active = ChanceOfPrecipitation > Utility.Random(100);
|
||||
m_ExtremeTemperature = ChanceOfExtremeTemperature > Utility.Random(100);
|
||||
|
||||
if (MoveSpeed > 0)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue