This commit is contained in:
mark 2009-09-06 02:06:07 +00:00
parent 4ee6ca5951
commit 06e5c8b732
70 changed files with 2798 additions and 286 deletions

View file

@ -192,17 +192,17 @@ namespace Server.Engines.Craft
if ( context != null )
resIndex = ( m_CraftItem.UseSubRes2 ? context.LastResourceIndex2 : context.LastResourceIndex );
bool cropScroll = ( m_CraftItem.Ressources.Count > 1 )
&& m_CraftItem.Ressources.GetAt( m_CraftItem.Ressources.Count - 1 ).ItemType == typeofBlankScroll
bool cropScroll = ( m_CraftItem.Resources.Count > 1 )
&& m_CraftItem.Resources.GetAt( m_CraftItem.Resources.Count - 1 ).ItemType == typeofBlankScroll
&& typeofSpellScroll.IsAssignableFrom( m_CraftItem.ItemType );
for ( int i = 0; i < m_CraftItem.Ressources.Count - (cropScroll ? 1 : 0) && i < 4; i++ )
for ( int i = 0; i < m_CraftItem.Resources.Count - (cropScroll ? 1 : 0) && i < 4; i++ )
{
Type type;
string nameString;
int nameNumber;
CraftRes craftResource = m_CraftItem.Ressources.GetAt( i );
CraftRes craftResource = m_CraftItem.Resources.GetAt( i );
type = craftResource.ItemType;
nameString = craftResource.NameString;
@ -240,8 +240,8 @@ namespace Server.Engines.Craft
if ( m_CraftItem.NameNumber == 1041267 ) // runebook
{
AddHtmlLocalized( 170, 219 + (m_CraftItem.Ressources.Count * 20), 310, 18, 1044447, LabelColor, false, false );
AddLabel( 430, 219 + (m_CraftItem.Ressources.Count * 20), LabelHue, "1" );
AddHtmlLocalized( 170, 219 + (m_CraftItem.Resources.Count * 20), 310, 18, 1044447, LabelColor, false, false );
AddLabel( 430, 219 + (m_CraftItem.Resources.Count * 20), LabelHue, "1" );
}
if ( cropScroll )

View file

@ -226,7 +226,7 @@ namespace Server.Engines.Craft
get { return m_NameNumber; }
}
public CraftResCol Ressources
public CraftResCol Resources
{
get { return m_arCraftRes; }
}

View file

@ -36,7 +36,7 @@ namespace Server.Engines.Craft
CraftItem craftItem = craftSystem.CraftItems.SearchFor( item.GetType() );
if ( craftItem == null || craftItem.Ressources.Count == 0 )
if ( craftItem == null || craftItem.Resources.Count == 0 )
return EnhanceResult.BadItem;
bool allRequiredSkills = false;

View file

@ -336,7 +336,7 @@ namespace Server.Engines.Craft
toDelete = true;
}
}
else if ( (targeted is BaseClothing) )
else if ( targeted is BaseClothing )
{
BaseClothing clothing = (BaseClothing)targeted;
SkillName skill = m_CraftSystem.MainSkill;
@ -358,8 +358,8 @@ namespace Server.Engines.Craft
toWeaken = 3;
}
if (m_CraftSystem.CraftItems.SearchForSubclass(clothing.GetType()) == null && !IsSpecialClothing(clothing) && !((targeted is TribalMask) || (targeted is HornedTribalMask) || targeted.GetType().IsSubclassOf(typeof(HornedTribalMask)) || targeted.GetType().IsSubclassOf(typeof(TribalMask))))
{
if (m_CraftSystem.CraftItems.SearchForSubclass(clothing.GetType()) == null && !IsSpecialClothing(clothing) && !((targeted is TribalMask) || (targeted is HornedTribalMask)) )
{
number = (usingDeed) ? 1061136 : 1044277; // That item cannot be repaired. // You cannot repair that item with this type of repair contract.
}
else if ( !clothing.IsChildOf( from.Backpack ) )

View file

@ -5,6 +5,13 @@ using Server.Items;
namespace Server.Engines.Craft
{
public enum SmeltResult
{
Success,
Invalid,
NoSkill
}
public class Resmelt
{
public Resmelt()
@ -37,27 +44,44 @@ namespace Server.Engines.Craft
m_Tool = tool;
}
private bool Resmelt( Mobile from, Item item, CraftResource resource )
private SmeltResult Resmelt( Mobile from, Item item, CraftResource resource )
{
try
{
if ( CraftResources.GetType( resource ) != CraftResourceType.Metal )
return false;
return SmeltResult.Invalid;
CraftResourceInfo info = CraftResources.GetInfo( resource );
if ( info == null || info.ResourceTypes.Length == 0 )
return false;
return SmeltResult.Invalid;
CraftItem craftItem = m_CraftSystem.CraftItems.SearchFor( item.GetType() );
if ( craftItem == null || craftItem.Ressources.Count == 0 )
return false;
if ( craftItem == null || craftItem.Resources.Count == 0 )
return SmeltResult.Invalid;
CraftRes craftResource = craftItem.Ressources.GetAt( 0 );
CraftRes craftResource = craftItem.Resources.GetAt( 0 );
if ( craftResource.Amount < 2 )
return false; // Not enough metal to resmelt
return SmeltResult.Invalid; // Not enough metal to resmelt
double difficulty = 0.0;
switch ( resource )
{
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;
}
if ( difficulty > from.Skills[ SkillName.Mining ].Value )
return SmeltResult.NoSkill;
Type resourceType = info.ResourceTypes[0];
Item ingot = (Item)Activator.CreateInstance( resourceType );
@ -72,13 +96,13 @@ namespace Server.Engines.Craft
from.PlaySound( 0x2A );
from.PlaySound( 0x240 );
return true;
return SmeltResult.Success;
}
catch
{
}
return false;
return SmeltResult.Invalid;
}
protected override void OnTarget( Mobile from, object targeted )
@ -91,29 +115,35 @@ namespace Server.Engines.Craft
}
else
{
bool success = false;
SmeltResult result = SmeltResult.Invalid;
bool isStoreBought = false;
int message;
if ( targeted is BaseArmor )
{
success = Resmelt( from, (BaseArmor)targeted, ((BaseArmor)targeted).Resource );
result = Resmelt( from, (BaseArmor)targeted, ((BaseArmor)targeted).Resource );
isStoreBought = !((BaseArmor)targeted).PlayerConstructed;
}
else if ( targeted is BaseWeapon )
{
success = Resmelt( from, (BaseWeapon)targeted, ((BaseWeapon)targeted).Resource );
result = Resmelt( from, (BaseWeapon)targeted, ((BaseWeapon)targeted).Resource );
isStoreBought = !((BaseWeapon)targeted).PlayerConstructed;
}
else if ( targeted is DragonBardingDeed )
{
success = Resmelt( from, (DragonBardingDeed)targeted, ((DragonBardingDeed)targeted).Resource );
result = Resmelt( from, (DragonBardingDeed)targeted, ((DragonBardingDeed)targeted).Resource );
isStoreBought = false;
}
if ( success )
from.SendGump( new CraftGump( from, m_CraftSystem, m_Tool, isStoreBought ? 500418 : 1044270 ) ); // You melt the item down into ingots.
else
from.SendGump( new CraftGump( from, m_CraftSystem, m_Tool, 1044272 ) ); // You can't melt that down into ingots.
switch ( result )
{
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.
}
from.SendGump( new CraftGump( from, m_CraftSystem, m_Tool, message ) );
}
}
}