Code Cleanup & Fixes Warnings (#74)

This commit is contained in:
Kamron Batman 2020-01-18 14:56:45 -08:00 • committed by GitHub
parent e11d1f3ad9
commit 57b14ad690
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
143 changed files with 2960 additions and 3427 deletions

View file

@ -154,9 +154,8 @@ namespace Server.Engines.Craft
if (context != null)
resIndex = m_CraftItem.UseSubRes2 ? context.LastResourceIndex2 : context.LastResourceIndex;
bool allRequiredSkills = true;
double chance = m_CraftItem.GetSuccessChance(m_From, resIndex > -1 ? res.GetAt(resIndex).ItemType : null,
m_CraftSystem, false, ref allRequiredSkills);
m_CraftSystem, false, out _);
double excepChance = m_CraftItem.GetExceptionalChance(m_CraftSystem, chance, m_From);
if (chance < 0.0)

View file

@ -682,12 +682,12 @@ namespace Server.Engines.Craft
public bool CheckSkills(Mobile from, Type typeRes, CraftSystem craftSystem, ref int quality,
ref bool allRequiredSkills) =>
CheckSkills(from, typeRes, craftSystem, ref quality, ref allRequiredSkills, true);
CheckSkills(from, typeRes, craftSystem, ref quality, out allRequiredSkills, true);
public bool CheckSkills(Mobile from, Type typeRes, CraftSystem craftSystem, ref int quality,
ref bool allRequiredSkills, bool gainSkills)
out bool allRequiredSkills, bool gainSkills)
{
double chance = GetSuccessChance(from, typeRes, craftSystem, gainSkills, ref allRequiredSkills);
double chance = GetSuccessChance(from, typeRes, craftSystem, gainSkills, out allRequiredSkills);
if (GetExceptionalChance(craftSystem, chance, from) > Utility.RandomDouble())
quality = 2;
@ -696,7 +696,7 @@ namespace Server.Engines.Craft
}
public double GetSuccessChance(Mobile from, Type typeRes, CraftSystem craftSystem, bool gainSkills,
ref bool allRequiredSkills)
out bool allRequiredSkills)
{
double minMainSkill = 0.0;
double maxMainSkill = 0.0;
@ -750,8 +750,8 @@ namespace Server.Engines.Craft
if (RequiredExpansion == Expansion.None ||
from.NetState?.SupportsExpansion(RequiredExpansion) == true)
{
bool allRequiredSkills = true;
double chance = GetSuccessChance(from, typeRes, craftSystem, false, ref allRequiredSkills);
bool allRequiredSkills;
double chance = GetSuccessChance(from, typeRes, craftSystem, false, out allRequiredSkills);
if (allRequiredSkills && chance >= 0.0)
{
@ -1100,7 +1100,7 @@ namespace Server.Engines.Craft
int quality = 1;
bool allRequiredSkills = true;
m_CraftItem.CheckSkills(m_From, m_TypeRes, m_CraftSystem, ref quality, ref allRequiredSkills, false);
m_CraftItem.CheckSkills(m_From, m_TypeRes, m_CraftSystem, ref quality, out allRequiredSkills, false);
CraftContext context = m_CraftSystem.GetContext(m_From);

View file

@ -51,8 +51,7 @@ namespace Server.Engines.Craft
if (craftItem == null || craftItem.Resources.Count == 0)
return EnhanceResult.BadItem;
bool allRequiredSkills = false;
if (craftItem.GetSuccessChance(from, resType, craftSystem, false, ref allRequiredSkills) <= 0.0)
if (craftItem.GetSuccessChance(from, resType, craftSystem, false, out _) <= 0.0)
return EnhanceResult.NoSkill;
CraftResourceInfo info = CraftResources.GetInfo(resource);
@ -322,4 +321,4 @@ namespace Server.Engines.Craft
}
}
}
}
}

View file

@ -149,18 +149,18 @@ namespace Server.Engines.Craft
public override void InitCraftList()
{
/*
Synthax for a SIMPLE craft item
Syntax for a SIMPLE craft item
AddCraft( ObjectType, Group, MinSkill, MaxSkill, ResourceType, Amount, Message )
ObjectType : The type of the object you want to add to the build list.
Group : The group in wich the object will be showed in the craft menu.
MinSkill : The minimum of skill value
MaxSkill : The maximum of skill value
Group : The group in which the object will be showed in the craft menu.
MinSkill : The minimum of skill value
MaxSkill : The maximum of skill value
ResourceType : The type of the resource the mobile need to create the item
Amount : The amount of the ResourceType it need to create the item
Message : String or Int for Localized. The message that will be sent to the mobile, if the specified resource is missing.
Amount : The amount of the ResourceType it need to create the item
Message : String or Int for Localized. The message that will be sent to the mobile, if the specified resource is missing.
Synthax for a COMPLEXE craft item. A complexe item is an item that need either more than
Syntax for a COMPLEX craft item. A complex item is an item that need either more than
only one skill, or more than only one resource.
Coming soon....
@ -183,7 +183,7 @@ namespace Server.Engines.Craft
#endregion
int index = -1;
int index;
#region Platemail