Fixes casting checks
This commit is contained in:
parent
7ea00fbf4f
commit
03dd5f1926
431 changed files with 5616 additions and 6250 deletions
|
|
@ -22,9 +22,9 @@ namespace Server.Engines.BulkOrders
|
|||
{
|
||||
Item item = null;
|
||||
|
||||
if ( obj is BOBLargeEntry )
|
||||
item = ((BOBLargeEntry)obj).Reconstruct();
|
||||
else if ( obj is BOBSmallEntry )
|
||||
if ( obj is BOBLargeEntry entry )
|
||||
item = entry.Reconstruct();
|
||||
else
|
||||
item = ((BOBSmallEntry)obj).Reconstruct();
|
||||
|
||||
return item;
|
||||
|
|
@ -32,17 +32,13 @@ namespace Server.Engines.BulkOrders
|
|||
|
||||
public bool CheckFilter( object obj )
|
||||
{
|
||||
if ( obj is BOBLargeEntry )
|
||||
if ( obj is BOBLargeEntry entry )
|
||||
{
|
||||
BOBLargeEntry e = (BOBLargeEntry)obj;
|
||||
|
||||
return CheckFilter( e.Material, e.AmountMax, true, e.RequireExceptional, e.DeedType, ( e.Entries.Length > 0 ? e.Entries[0].ItemType : null ) );
|
||||
return CheckFilter( entry.Material, entry.AmountMax, true, entry.RequireExceptional, entry.DeedType, ( entry.Entries.Length > 0 ? entry.Entries[0].ItemType : null ) );
|
||||
}
|
||||
else if ( obj is BOBSmallEntry )
|
||||
if ( obj is BOBSmallEntry smallEntry )
|
||||
{
|
||||
BOBSmallEntry e = (BOBSmallEntry)obj;
|
||||
|
||||
return CheckFilter( e.Material, e.AmountMax, false, e.RequireExceptional, e.DeedType, e.ItemType );
|
||||
return CheckFilter( smallEntry.Material, smallEntry.AmountMax, false, smallEntry.RequireExceptional, smallEntry.DeedType, smallEntry.ItemType );
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
@ -57,25 +53,25 @@ namespace Server.Engines.BulkOrders
|
|||
|
||||
if ( f.Quality == 1 && reqExc )
|
||||
return false;
|
||||
else if ( f.Quality == 2 && !reqExc )
|
||||
if ( f.Quality == 2 && !reqExc )
|
||||
return false;
|
||||
|
||||
if ( f.Quantity == 1 && amountMax != 10 )
|
||||
return false;
|
||||
else if ( f.Quantity == 2 && amountMax != 15 )
|
||||
if ( f.Quantity == 2 && amountMax != 15 )
|
||||
return false;
|
||||
else if ( f.Quantity == 3 && amountMax != 20 )
|
||||
if ( f.Quantity == 3 && amountMax != 20 )
|
||||
return false;
|
||||
|
||||
if ( f.Type == 1 && isLarge )
|
||||
return false;
|
||||
else if ( f.Type == 2 && !isLarge )
|
||||
if ( f.Type == 2 && !isLarge )
|
||||
return false;
|
||||
|
||||
switch ( f.Material )
|
||||
{
|
||||
default:
|
||||
case 0: return true;
|
||||
return true;
|
||||
case 1: return ( deedType == BODType.Smith );
|
||||
case 2: return ( deedType == BODType.Tailor );
|
||||
|
||||
|
|
@ -122,8 +118,8 @@ namespace Server.Engines.BulkOrders
|
|||
{
|
||||
int add;
|
||||
|
||||
if ( obj is BOBLargeEntry )
|
||||
add = ((BOBLargeEntry)obj).Entries.Length;
|
||||
if ( obj is BOBLargeEntry entry )
|
||||
add = entry.Entries.Length;
|
||||
else
|
||||
add = 1;
|
||||
|
||||
|
|
@ -156,8 +152,8 @@ namespace Server.Engines.BulkOrders
|
|||
obj = list[i];
|
||||
if (CheckFilter(obj))
|
||||
{
|
||||
if (obj is BOBLargeEntry)
|
||||
add = ((BOBLargeEntry)obj).Entries.Length;
|
||||
if (obj is BOBLargeEntry entry)
|
||||
add = entry.Entries.Length;
|
||||
else
|
||||
add = 1;
|
||||
count += add;
|
||||
|
|
@ -185,8 +181,8 @@ namespace Server.Engines.BulkOrders
|
|||
obj = list[i];
|
||||
if (CheckFilter(obj))
|
||||
{
|
||||
if (obj is BOBLargeEntry)
|
||||
count += ((BOBLargeEntry)obj).Entries.Length;
|
||||
if (obj is BOBLargeEntry entry)
|
||||
count += entry.Entries.Length;
|
||||
else
|
||||
count += 1;
|
||||
}
|
||||
|
|
@ -327,8 +323,8 @@ namespace Server.Engines.BulkOrders
|
|||
if (m_Book.IsChildOf(m_From.Backpack))
|
||||
{
|
||||
int sizeOfDroppedBod;
|
||||
if (obj is BOBLargeEntry)
|
||||
sizeOfDroppedBod = ((BOBLargeEntry)obj).Entries.Length;
|
||||
if (obj is BOBLargeEntry entry)
|
||||
sizeOfDroppedBod = entry.Entries.Length;
|
||||
else
|
||||
sizeOfDroppedBod = 1;
|
||||
|
||||
|
|
@ -336,13 +332,13 @@ namespace Server.Engines.BulkOrders
|
|||
m_From.SendLocalizedMessage(1045152); // The bulk order deed has been placed in your backpack.
|
||||
m_Book.Entries.Remove(obj);
|
||||
m_Book.InvalidateProperties();
|
||||
|
||||
|
||||
if ( m_Book.Entries.Count / 5 < m_Book.ItemCount )
|
||||
{
|
||||
m_Book.ItemCount--;
|
||||
m_Book.InvalidateItems();
|
||||
}
|
||||
|
||||
|
||||
if (m_Book.Entries.Count > 0)
|
||||
{
|
||||
m_Page = GetPageForIndex(index, sizeOfDroppedBod);
|
||||
|
|
@ -366,19 +362,18 @@ namespace Server.Engines.BulkOrders
|
|||
m_From.Prompt = new SetPricePrompt( m_Book, obj, m_Page, m_List );
|
||||
m_From.SendLocalizedMessage( 1062383 ); // Type in a price for the deed:
|
||||
}
|
||||
else if ( m_Book.RootParent is PlayerVendor )
|
||||
else if ( m_Book.RootParent is PlayerVendor pv )
|
||||
{
|
||||
PlayerVendor pv = (PlayerVendor)m_Book.RootParent;
|
||||
VendorItem vi = pv.GetVendorItem( m_Book );
|
||||
|
||||
if (vi != null && !vi.IsForSale)
|
||||
{
|
||||
int sizeOfDroppedBod;
|
||||
int price = 0;
|
||||
if (obj is BOBLargeEntry)
|
||||
if (obj is BOBLargeEntry entry)
|
||||
{
|
||||
price = ((BOBLargeEntry)obj).Price;
|
||||
sizeOfDroppedBod = ((BOBLargeEntry)obj).Entries.Length;
|
||||
price = entry.Price;
|
||||
sizeOfDroppedBod = entry.Entries.Length;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -443,34 +438,34 @@ namespace Server.Engines.BulkOrders
|
|||
if ( !m_Book.Entries.Contains( obj ) )
|
||||
continue;
|
||||
|
||||
if ( obj is BOBLargeEntry )
|
||||
((BOBLargeEntry)obj).Price = price;
|
||||
else if ( obj is BOBSmallEntry )
|
||||
if ( obj is BOBLargeEntry entry )
|
||||
entry.Price = price;
|
||||
else
|
||||
((BOBSmallEntry)obj).Price = price;
|
||||
}
|
||||
|
||||
from.SendMessage( "Deed prices set." );
|
||||
|
||||
if ( from is PlayerMobile )
|
||||
from.SendGump( new BOBGump( (PlayerMobile)from, m_Book, m_Page, m_List ) );
|
||||
if ( from is PlayerMobile mobile )
|
||||
mobile.SendGump( new BOBGump( mobile, m_Book, m_Page, m_List ) );
|
||||
}
|
||||
else if ( m_Object is BOBLargeEntry )
|
||||
else if ( m_Object is BOBLargeEntry entry )
|
||||
{
|
||||
((BOBLargeEntry)m_Object).Price = price;
|
||||
entry.Price = price;
|
||||
|
||||
from.SendLocalizedMessage( 1062384 ); // Deed price set.
|
||||
|
||||
if ( from is PlayerMobile )
|
||||
from.SendGump( new BOBGump( (PlayerMobile)from, m_Book, m_Page, m_List ) );
|
||||
if ( from is PlayerMobile mobile )
|
||||
mobile.SendGump( new BOBGump( mobile, m_Book, m_Page, m_List ) );
|
||||
}
|
||||
else if ( m_Object is BOBSmallEntry )
|
||||
else
|
||||
{
|
||||
((BOBSmallEntry)m_Object).Price = price;
|
||||
|
||||
from.SendLocalizedMessage( 1062384 ); // Deed price set.
|
||||
|
||||
if ( from is PlayerMobile )
|
||||
from.SendGump( new BOBGump( (PlayerMobile)from, m_Book, m_Page, m_List ) );
|
||||
if ( from is PlayerMobile mobile )
|
||||
mobile.SendGump( new BOBGump( mobile, m_Book, m_Page, m_List ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -553,9 +548,9 @@ namespace Server.Engines.BulkOrders
|
|||
|
||||
AddImageTiled( 24, 94 + (tableIndex * 32), canPrice ? 573 : 489, 2, 2624 );
|
||||
|
||||
if ( obj is BOBLargeEntry )
|
||||
tableIndex += ((BOBLargeEntry)obj).Entries.Length;
|
||||
else if ( obj is BOBSmallEntry )
|
||||
if ( obj is BOBLargeEntry entry )
|
||||
tableIndex += entry.Entries.Length;
|
||||
else
|
||||
++tableIndex;
|
||||
}
|
||||
|
||||
|
|
@ -628,81 +623,79 @@ namespace Server.Engines.BulkOrders
|
|||
if ( !CheckFilter( obj ) )
|
||||
continue;
|
||||
|
||||
if ( obj is BOBLargeEntry )
|
||||
if ( obj is BOBLargeEntry entry )
|
||||
{
|
||||
BOBLargeEntry e = (BOBLargeEntry)obj;
|
||||
|
||||
int y = 96 + (tableIndex * 32);
|
||||
|
||||
if ( canDrop )
|
||||
AddButton( 35, y + 2, 5602, 5606, 5 + (i * 2), GumpButtonType.Reply, 0 );
|
||||
|
||||
if ( canDrop || (canBuy && e.Price > 0) )
|
||||
if ( canDrop || (canBuy && entry.Price > 0) )
|
||||
{
|
||||
AddButton( 579, y + 2, 2117, 2118, 6 + (i * 2), GumpButtonType.Reply, 0 );
|
||||
AddLabel( 495, y, 1152, e.Price.ToString() );
|
||||
AddLabel( 495, y, 1152, entry.Price.ToString() );
|
||||
}
|
||||
|
||||
AddHtmlLocalized( 61, y, 50, 32, 1062225, LabelColor, false, false ); // Large
|
||||
|
||||
for ( int j = 0; j < e.Entries.Length; ++j )
|
||||
for ( int j = 0; j < entry.Entries.Length; ++j )
|
||||
{
|
||||
BOBLargeSubEntry sub = e.Entries[j];
|
||||
BOBLargeSubEntry sub = entry.Entries[j];
|
||||
|
||||
AddHtmlLocalized( 103, y, 130, 32, sub.Number, LabelColor, false, false );
|
||||
|
||||
if ( e.RequireExceptional )
|
||||
if ( entry.RequireExceptional )
|
||||
AddHtmlLocalized( 235, y, 80, 20, 1060636, LabelColor, false, false ); // exceptional
|
||||
else
|
||||
AddHtmlLocalized( 235, y, 80, 20, 1011542, LabelColor, false, false ); // normal
|
||||
|
||||
object name = GetMaterialName( e.Material, e.DeedType, sub.ItemType );
|
||||
object name = GetMaterialName( entry.Material, entry.DeedType, sub.ItemType );
|
||||
|
||||
if ( name is int )
|
||||
AddHtmlLocalized( 316, y, 100, 20, (int)name, LabelColor, false, false );
|
||||
else if ( name is string )
|
||||
AddLabel( 316, y, 1152, (string)name );
|
||||
if ( name is int intName )
|
||||
AddHtmlLocalized( 316, y, 100, 20, intName, LabelColor, false, false );
|
||||
else
|
||||
AddLabel( 316, y, 1152, name.ToString() );
|
||||
|
||||
AddLabel( 421, y, 1152, String.Format( "{0} / {1}", sub.AmountCur, e.AmountMax ) );
|
||||
AddLabel( 421, y, 1152, String.Format( "{0} / {1}", sub.AmountCur, entry.AmountMax ) );
|
||||
|
||||
++tableIndex;
|
||||
y += 32;
|
||||
}
|
||||
}
|
||||
else if ( obj is BOBSmallEntry )
|
||||
else
|
||||
{
|
||||
BOBSmallEntry e = (BOBSmallEntry)obj;
|
||||
BOBSmallEntry smallEntry = (BOBSmallEntry)obj;
|
||||
|
||||
int y = 96 + (tableIndex++ * 32);
|
||||
|
||||
if ( canDrop )
|
||||
AddButton( 35, y + 2, 5602, 5606, 5 + (i * 2), GumpButtonType.Reply, 0 );
|
||||
|
||||
if ( canDrop || (canBuy && e.Price > 0) )
|
||||
if ( canDrop || (canBuy && smallEntry.Price > 0) )
|
||||
{
|
||||
AddButton( 579, y + 2, 2117, 2118, 6 + (i * 2), GumpButtonType.Reply, 0 );
|
||||
AddLabel( 495, y, 1152, e.Price.ToString() );
|
||||
AddLabel( 495, y, 1152, smallEntry.Price.ToString() );
|
||||
}
|
||||
|
||||
AddHtmlLocalized( 61, y, 50, 32, 1062224, LabelColor, false, false ); // Small
|
||||
|
||||
AddHtmlLocalized( 103, y, 130, 32, e.Number, LabelColor, false, false );
|
||||
AddHtmlLocalized( 103, y, 130, 32, smallEntry.Number, LabelColor, false, false );
|
||||
|
||||
if ( e.RequireExceptional )
|
||||
if ( smallEntry.RequireExceptional )
|
||||
AddHtmlLocalized( 235, y, 80, 20, 1060636, LabelColor, false, false ); // exceptional
|
||||
else
|
||||
AddHtmlLocalized( 235, y, 80, 20, 1011542, LabelColor, false, false ); // normal
|
||||
|
||||
object name = GetMaterialName( e.Material, e.DeedType, e.ItemType );
|
||||
object name = GetMaterialName( smallEntry.Material, smallEntry.DeedType, smallEntry.ItemType );
|
||||
|
||||
if ( name is int )
|
||||
AddHtmlLocalized( 316, y, 100, 20, (int)name, LabelColor, false, false );
|
||||
else if ( name is string )
|
||||
AddLabel( 316, y, 1152, (string)name );
|
||||
if ( name is int intName )
|
||||
AddHtmlLocalized( 316, y, 100, 20, intName, LabelColor, false, false );
|
||||
else
|
||||
AddLabel( 316, y, 1152, name.ToString() );
|
||||
|
||||
AddLabel( 421, y, 1152, String.Format( "{0} / {1}", e.AmountCur, e.AmountMax ) );
|
||||
AddLabel( 421, y, 1152, String.Format( "{0} / {1}", smallEntry.AmountCur, smallEntry.AmountMax ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,9 +28,9 @@ namespace Server.Engines.BulkOrders
|
|||
|
||||
if ( vi != null && !vi.IsForSale )
|
||||
{
|
||||
if ( m_Object is BOBLargeEntry )
|
||||
price = ((BOBLargeEntry)m_Object).Price;
|
||||
else if ( m_Object is BOBSmallEntry )
|
||||
if ( m_Object is BOBLargeEntry entry )
|
||||
price = entry.Price;
|
||||
else
|
||||
price = ((BOBSmallEntry)m_Object).Price;
|
||||
}
|
||||
|
||||
|
|
@ -46,9 +46,9 @@ namespace Server.Engines.BulkOrders
|
|||
{
|
||||
Item item = null;
|
||||
|
||||
if ( m_Object is BOBLargeEntry )
|
||||
item = ((BOBLargeEntry)m_Object).Reconstruct();
|
||||
else if ( m_Object is BOBSmallEntry )
|
||||
if ( m_Object is BOBLargeEntry entry )
|
||||
item = entry.Reconstruct();
|
||||
else
|
||||
item = ((BOBSmallEntry)m_Object).Reconstruct();
|
||||
|
||||
if ( item == null )
|
||||
|
|
@ -75,7 +75,7 @@ namespace Server.Engines.BulkOrders
|
|||
pv.HoldGold += price;
|
||||
m_From.AddToBackpack( item );
|
||||
m_From.SendLocalizedMessage( 1045152 ); // The bulk order deed has been placed in your backpack.
|
||||
|
||||
|
||||
if ( m_Book.Entries.Count / 5 < m_Book.ItemCount )
|
||||
{
|
||||
m_Book.ItemCount--;
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ namespace Server.Engines.BulkOrders
|
|||
{
|
||||
get{ return m_Filter; }
|
||||
}
|
||||
|
||||
|
||||
public int ItemCount
|
||||
{
|
||||
get{ return m_ItemCount; }
|
||||
|
|
@ -67,8 +67,8 @@ namespace Server.Engines.BulkOrders
|
|||
from.LocalOverheadMessage( Network.MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that.
|
||||
else if ( m_Entries.Count == 0 )
|
||||
from.SendLocalizedMessage( 1062381 ); // The book is empty.
|
||||
else if ( from is PlayerMobile )
|
||||
from.SendGump( new BOBGump( (PlayerMobile)from, this ) );
|
||||
else if ( from is PlayerMobile mobile )
|
||||
mobile.SendGump( new BOBGump( mobile, this ) );
|
||||
}
|
||||
|
||||
public override void OnDoubleClickSecureTrade( Mobile from )
|
||||
|
|
@ -108,17 +108,17 @@ namespace Server.Engines.BulkOrders
|
|||
from.SendLocalizedMessage( 1062385 ); // You must have the book in your backpack to add deeds to it.
|
||||
return false;
|
||||
}
|
||||
else if ( !from.Backpack.CheckHold( from, dropped, true, true ) )
|
||||
if ( !from.Backpack.CheckHold( from, dropped, true, true ) )
|
||||
return false;
|
||||
else if ( m_Entries.Count < 500 )
|
||||
if ( m_Entries.Count < 500 )
|
||||
{
|
||||
if ( dropped is LargeBOD )
|
||||
m_Entries.Add( new BOBLargeEntry( (LargeBOD)dropped ) );
|
||||
else if ( dropped is SmallBOD ) // Sanity
|
||||
if ( dropped is LargeBOD bod )
|
||||
m_Entries.Add( new BOBLargeEntry( bod ) );
|
||||
else
|
||||
m_Entries.Add( new BOBSmallEntry( (SmallBOD)dropped ) );
|
||||
|
||||
|
||||
InvalidateProperties();
|
||||
|
||||
|
||||
if ( m_Entries.Count / 5 > m_ItemCount )
|
||||
{
|
||||
m_ItemCount++;
|
||||
|
|
@ -128,51 +128,45 @@ namespace Server.Engines.BulkOrders
|
|||
from.SendSound(0x42, GetWorldLocation());
|
||||
from.SendLocalizedMessage( 1062386 ); // Deed added to book.
|
||||
|
||||
if ( from is PlayerMobile )
|
||||
from.SendGump( new BOBGump( (PlayerMobile)from, this ) );
|
||||
if ( from is PlayerMobile pm )
|
||||
pm.SendGump( new BOBGump( pm, this ) );
|
||||
|
||||
dropped.Delete();
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage( 1062387 ); // The book is full of deeds.
|
||||
return false;
|
||||
}
|
||||
|
||||
from.SendLocalizedMessage( 1062387 ); // The book is full of deeds.
|
||||
return false;
|
||||
}
|
||||
|
||||
from.SendLocalizedMessage( 1062388 ); // That is not a bulk order deed.
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public override int GetTotal( TotalType type )
|
||||
{
|
||||
int total = base.GetTotal( type );
|
||||
|
||||
|
||||
if ( type == TotalType.Items )
|
||||
total = m_ItemCount;
|
||||
|
||||
return total;
|
||||
}
|
||||
|
||||
|
||||
public void InvalidateItems()
|
||||
{
|
||||
if ( RootParent is Mobile )
|
||||
if ( RootParent is Mobile m )
|
||||
{
|
||||
Mobile m = (Mobile) RootParent;
|
||||
|
||||
m.UpdateTotals();
|
||||
InvalidateContainers( Parent );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void InvalidateContainers( object parent )
|
||||
{
|
||||
if ( parent != null && parent is Container )
|
||||
if ( parent is Container c )
|
||||
{
|
||||
Container c = (Container)parent;
|
||||
|
||||
c.InvalidateProperties();
|
||||
InvalidateContainers( c.Parent );
|
||||
}
|
||||
|
|
@ -187,7 +181,7 @@ namespace Server.Engines.BulkOrders
|
|||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 2 ); // version
|
||||
|
||||
|
||||
writer.Write( (int) m_ItemCount );
|
||||
|
||||
writer.Write( (int) m_Level );
|
||||
|
|
@ -202,19 +196,15 @@ namespace Server.Engines.BulkOrders
|
|||
{
|
||||
object obj = m_Entries[i];
|
||||
|
||||
if ( obj is BOBLargeEntry )
|
||||
if ( obj is BOBLargeEntry entry )
|
||||
{
|
||||
writer.WriteEncodedInt( 0 );
|
||||
((BOBLargeEntry)obj).Serialize( writer );
|
||||
}
|
||||
else if ( obj is BOBSmallEntry )
|
||||
{
|
||||
writer.WriteEncodedInt( 1 );
|
||||
((BOBSmallEntry)obj).Serialize( writer );
|
||||
entry.Serialize( writer );
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.WriteEncodedInt( -1 );
|
||||
writer.WriteEncodedInt( 1 );
|
||||
((BOBSmallEntry)obj).Serialize( writer );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -341,4 +331,4 @@ namespace Server.Engines.BulkOrders
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -146,12 +146,10 @@ namespace Server.Engines.BulkOrders
|
|||
|
||||
public void EndCombine( Mobile from, object o )
|
||||
{
|
||||
if ( o is Item && ((Item)o).IsChildOf( from.Backpack ) )
|
||||
if ( o is Item item && item.IsChildOf( from.Backpack ) )
|
||||
{
|
||||
if ( o is SmallBOD )
|
||||
if ( item is SmallBOD small )
|
||||
{
|
||||
SmallBOD small = (SmallBOD)o;
|
||||
|
||||
LargeBulkEntry entry = null;
|
||||
|
||||
for ( int i = 0; entry == null && i < m_Entries.Length; ++i )
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ namespace Server.Engines.BulkOrders
|
|||
{
|
||||
LargeBulkEntry[] entries;
|
||||
bool useMaterials = true;
|
||||
|
||||
|
||||
int rand = Utility.Random( 8 );
|
||||
|
||||
switch ( rand )
|
||||
|
|
@ -53,8 +53,8 @@ namespace Server.Engines.BulkOrders
|
|||
case 6: entries = LargeBulkEntry.ConvertEntries( this, LargeBulkEntry.LargePolearms ); break;
|
||||
case 7: entries = LargeBulkEntry.ConvertEntries( this, LargeBulkEntry.LargeSwords ); break;
|
||||
}
|
||||
|
||||
if( rand > 2 && rand < 8 )
|
||||
|
||||
if ( rand > 2 && rand < 8 )
|
||||
useMaterials = false;
|
||||
|
||||
int hue = 0x44E;
|
||||
|
|
@ -137,4 +137,4 @@ namespace Server.Engines.BulkOrders
|
|||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -167,26 +167,24 @@ namespace Server.Engines.BulkOrders
|
|||
|
||||
public void EndCombine( Mobile from, object o )
|
||||
{
|
||||
if ( o is Item && ((Item)o).IsChildOf( from.Backpack ) )
|
||||
if ( o is Item item && item.IsChildOf( from.Backpack ) )
|
||||
{
|
||||
Type objectType = o.GetType();
|
||||
Type objectType = item.GetType();
|
||||
|
||||
if ( m_AmountCur >= m_AmountMax )
|
||||
{
|
||||
from.SendLocalizedMessage( 1045166 ); // The maximum amount of requested items have already been combined to this deed.
|
||||
}
|
||||
else if ( m_Type == null || (objectType != m_Type && !objectType.IsSubclassOf( m_Type )) || (!(o is BaseWeapon) && !(o is BaseArmor) && !(o is BaseClothing)) )
|
||||
else if ( m_Type == null || (objectType != m_Type && !objectType.IsSubclassOf( m_Type )) || (!(item is BaseWeapon) && !(item is BaseArmor) && !(item is BaseClothing)) )
|
||||
{
|
||||
from.SendLocalizedMessage( 1045169 ); // The item is not in the request.
|
||||
}
|
||||
else
|
||||
{
|
||||
BulkMaterialType material = BulkMaterialType.None;
|
||||
BaseArmor armor = item as BaseArmor;
|
||||
BaseClothing clothing = item as BaseClothing;
|
||||
|
||||
if ( o is BaseArmor )
|
||||
material = GetMaterial( ((BaseArmor)o).Resource );
|
||||
else if ( o is BaseClothing )
|
||||
material = GetMaterial( ((BaseClothing)o).Resource );
|
||||
BulkMaterialType material = GetMaterial( armor?.Resource ?? clothing?.Resource ?? CraftResource.None );
|
||||
|
||||
if ( m_Material >= BulkMaterialType.DullCopper && m_Material <= BulkMaterialType.Valorite && material != m_Material )
|
||||
{
|
||||
|
|
@ -198,14 +196,14 @@ namespace Server.Engines.BulkOrders
|
|||
}
|
||||
else
|
||||
{
|
||||
bool isExceptional = false;
|
||||
bool isExceptional;
|
||||
|
||||
if ( o is BaseWeapon )
|
||||
isExceptional = ( ((BaseWeapon)o).Quality == WeaponQuality.Exceptional );
|
||||
else if ( o is BaseArmor )
|
||||
isExceptional = ( ((BaseArmor)o).Quality == ArmorQuality.Exceptional );
|
||||
else if ( o is BaseClothing )
|
||||
isExceptional = ( ((BaseClothing)o).Quality == ClothingQuality.Exceptional );
|
||||
if ( item is BaseWeapon weapon )
|
||||
isExceptional = weapon.Quality == WeaponQuality.Exceptional;
|
||||
else if ( armor != null )
|
||||
isExceptional = armor.Quality == ArmorQuality.Exceptional;
|
||||
else
|
||||
isExceptional = clothing.Quality == ClothingQuality.Exceptional;
|
||||
|
||||
if ( m_RequireExceptional && !isExceptional )
|
||||
{
|
||||
|
|
@ -213,7 +211,7 @@ namespace Server.Engines.BulkOrders
|
|||
}
|
||||
else
|
||||
{
|
||||
((Item)o).Delete();
|
||||
item.Delete();
|
||||
++AmountCur;
|
||||
|
||||
from.SendLocalizedMessage( 1045170 ); // The item has been combined with the deed.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue