Formatting #2 (#59)

This commit is contained in:
Kamron Batman 2019-10-05 00:37:03 -07:00 committed by GitHub
parent 096d39609e
commit 8e9221bb5a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
400 changed files with 3688 additions and 5969 deletions

View file

@ -201,7 +201,7 @@ namespace Server.Engines.Craft
CraftContext context = m_CraftSystem.GetContext(m_From);
AddButton(220, 260, 4005, 4007, GetButtonID(6, 4));
AddHtmlLocalized(255, 263, 200, 18, context == null || !context.DoNotColor ? 1061591 : 1061590,
AddHtmlLocalized(255, 263, 200, 18, context?.DoNotColor != true ? 1061591 : 1061590,
LabelColor);
}
@ -557,18 +557,13 @@ namespace Server.Engines.Craft
if (context == null || !system.MarkOption)
break;
switch (context.MarkOption)
context.MarkOption = context.MarkOption switch
{
case CraftMarkOption.MarkItem:
context.MarkOption = CraftMarkOption.DoNotMark;
break;
case CraftMarkOption.DoNotMark:
context.MarkOption = CraftMarkOption.PromptForMark;
break;
case CraftMarkOption.PromptForMark:
context.MarkOption = CraftMarkOption.MarkItem;
break;
}
CraftMarkOption.MarkItem => CraftMarkOption.DoNotMark,
CraftMarkOption.DoNotMark => CraftMarkOption.PromptForMark,
CraftMarkOption.PromptForMark => CraftMarkOption.MarkItem,
_ => context.MarkOption
};
m_From.SendGump(new CraftGump(m_From, m_CraftSystem, m_Tool, null, m_Page));

View file

@ -111,15 +111,12 @@ namespace Server.Engines.Craft
private TextDefinition RequiredExpansionMessage(Expansion expansion)
{
switch (expansion)
return expansion switch
{
case Expansion.SE:
return 1063363; // * Requires the "Samurai Empire" expansion
case Expansion.ML:
return 1072651; // * Requires the "Mondain's Legacy" expansion
default:
return $"* Requires the \"{ExpansionInfo.GetInfo(expansion).Name}\" expansion";
}
Expansion.SE => (TextDefinition)1063363, // * Requires the "Samurai Empire" expansion
Expansion.ML => (TextDefinition)1072651, // * Requires the "Mondain's Legacy" expansion
_ => (TextDefinition)$"* Requires the \"{ExpansionInfo.GetInfo(expansion).Name}\" expansion"
};
}
public void DrawItem()

View file

@ -755,7 +755,7 @@ namespace Server.Engines.Craft
if (allRequiredSkills && chance >= 0.0)
{
if (Recipe == null || !(from is PlayerMobile) || ((PlayerMobile)from).HasRecipe(Recipe))
if (Recipe == null || (from as PlayerMobile)?.HasRecipe(Recipe) != false)
{
int badCraft = craftSystem.CanCraft(from, tool, ItemType);
@ -827,20 +827,15 @@ namespace Server.Engines.Craft
}
}
private object
RequiredExpansionMessage(
Expansion expansion) //Eventually convert to TextDefinition, but that requires that we convert all the gumps to ues it too. Not that it wouldn't be a bad idea.
//Eventually convert to TextDefinition, but that requires that we convert all the gumps to ues it too. Not that it wouldn't be a bad idea.
private object RequiredExpansionMessage(Expansion expansion)
{
switch (expansion)
return expansion switch
{
case Expansion.SE:
return 1063307; // The "Samurai Empire" expansion is required to attempt this item.
case Expansion.ML:
return 1072650; // The "Mondain's Legacy" expansion is required to attempt this item.
default:
return
$"The \"{ExpansionInfo.GetInfo(expansion).Name}\" expansion is required to attempt this item.";
}
Expansion.SE => (object)1063307, // The "Samurai Empire" expansion is required to attempt this item.
Expansion.ML => 1072650, // The "Mondain's Legacy" expansion is required to attempt this item.
_ => $"The \"{ExpansionInfo.GetInfo(expansion).Name}\" expansion is required to attempt this item."
};
}
public void CompleteCraft(int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes,

View file

@ -304,33 +304,18 @@ namespace Server.Engines.Craft
EnhanceResult res = Enhance.Invoke(from, m_CraftSystem, m_Tool, item, m_Resource, m_ResourceType,
ref message);
switch (res)
message = res switch
{
case EnhanceResult.NotInBackpack:
message = 1061005;
break; // The item must be in your backpack to enhance it.
case EnhanceResult.AlreadyEnhanced:
message = 1061012;
break; // This item is already enhanced with the properties of a special material.
case EnhanceResult.BadItem:
message = 1061011;
break; // You cannot enhance this type of item with the properties of the selected special material.
case EnhanceResult.BadResource:
message = 1061010;
break; // You must select a special material in order to enhance an item with its properties.
case EnhanceResult.Broken:
message = 1061080;
break; // You attempt to enhance the item, but fail catastrophically. The item is lost.
case EnhanceResult.Failure:
message = 1061082;
break; // You attempt to enhance the item, but fail. Some material is lost in the process.
case EnhanceResult.Success:
message = 1061008;
break; // You enhance the item with the properties of the special material.
case EnhanceResult.NoSkill:
message = 1044153;
break; // You don't have the required skills to attempt this item.
}
EnhanceResult.NotInBackpack => 1061005,
EnhanceResult.AlreadyEnhanced => 1061012,
EnhanceResult.BadItem => 1061011,
EnhanceResult.BadResource => 1061010,
EnhanceResult.Broken => 1061080,
EnhanceResult.Failure => 1061082,
EnhanceResult.Success => 1061008,
EnhanceResult.NoSkill => 1044153,
_ => message
};
from.SendGump(new CraftGump(from, m_CraftSystem, m_Tool, message));
}

View file

@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using Server.Commands;
using Server.Mobiles;
using Server.Targeting;

View file

@ -65,35 +65,18 @@ namespace Server.Engines.Craft
if (craftResource.Amount < 2)
return SmeltResult.Invalid; // Not enough metal to resmelt
double difficulty = 0.0;
switch (resource)
var difficulty = resource switch
{
case CraftResource.DullCopper:
difficulty = 65.0;
break;
case CraftResource.ShadowIron:
difficulty = 70.0;
break;
case CraftResource.Copper:
difficulty = 75.0;
break;
case CraftResource.Bronze:
difficulty = 80.0;
break;
case CraftResource.Gold:
difficulty = 85.0;
break;
case CraftResource.Agapite:
difficulty = 90.0;
break;
case CraftResource.Verite:
difficulty = 95.0;
break;
case CraftResource.Valorite:
difficulty = 99.0;
break;
}
CraftResource.DullCopper => 65.0,
CraftResource.ShadowIron => 70.0,
CraftResource.Copper => 75.0,
CraftResource.Bronze => 80.0,
CraftResource.Gold => 85.0,
CraftResource.Agapite => 90.0,
CraftResource.Verite => 95.0,
CraftResource.Valorite => 99.0,
_ => 0.0
};
if (difficulty > from.Skills.Mining.Value)
return SmeltResult.NoSkill;
@ -163,19 +146,13 @@ namespace Server.Engines.Craft
isStoreBought = false;
}
switch (result)
message = result switch
{
default:
case SmeltResult.Invalid:
message = 1044272;
break; // You can't melt that down into ingots.
case SmeltResult.NoSkill:
message = 1044269;
break; // You have no idea how to work this metal.
case SmeltResult.Success:
message = isStoreBought ? 500418 : 1044270;
break; // You melt the item down into ingots.
}
SmeltResult.Invalid => 1044272,
SmeltResult.NoSkill => 1044269,
SmeltResult.Success => (isStoreBought ? 500418 : 1044270),
_ => 1044272
};
from.SendGump(new CraftGump(from, m_CraftSystem, m_Tool, message));
}