Formatting FIxes (#58)
This commit is contained in:
parent
57fb9fb525
commit
096d39609e
1318 changed files with 11633 additions and 22129 deletions
|
|
@ -6,10 +6,7 @@ namespace Server.Engines.BulkOrders
|
|||
{
|
||||
private BaseBOD m_Deed;
|
||||
|
||||
public BODTarget(BaseBOD deed) : base(18, false, TargetFlags.None)
|
||||
{
|
||||
m_Deed = deed;
|
||||
}
|
||||
public BODTarget(BaseBOD deed) : base(18, false, TargetFlags.None) => m_Deed = deed;
|
||||
|
||||
protected override void OnTarget(Mobile from, object targeted)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -8,61 +8,61 @@ using Server.Items;
|
|||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
public class BulkOrderBook : Item, ISecurable
|
||||
{
|
||||
private string m_BookName;
|
||||
public class BulkOrderBook : Item, ISecurable
|
||||
{
|
||||
private string m_BookName;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public string BookName
|
||||
{
|
||||
get => m_BookName;
|
||||
set{ m_BookName = value; InvalidateProperties(); }
|
||||
}
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public string BookName
|
||||
{
|
||||
get => m_BookName;
|
||||
set{ m_BookName = value; InvalidateProperties(); }
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public SecureLevel Level { get; set; }
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public SecureLevel Level { get; set; }
|
||||
|
||||
public List<IBOBEntry> Entries { get; private set; }
|
||||
public List<IBOBEntry> Entries { get; private set; }
|
||||
|
||||
public BOBFilter Filter { get; private set; }
|
||||
public BOBFilter Filter { get; private set; }
|
||||
|
||||
public int ItemCount { get; set; }
|
||||
public int ItemCount { get; set; }
|
||||
|
||||
[Constructible]
|
||||
public BulkOrderBook() : base( 0x2259 )
|
||||
{
|
||||
Weight = 1.0;
|
||||
LootType = LootType.Blessed;
|
||||
[Constructible]
|
||||
public BulkOrderBook() : base( 0x2259 )
|
||||
{
|
||||
Weight = 1.0;
|
||||
LootType = LootType.Blessed;
|
||||
|
||||
Entries = new List<IBOBEntry>();
|
||||
Filter = new BOBFilter();
|
||||
Entries = new List<IBOBEntry>();
|
||||
Filter = new BOBFilter();
|
||||
|
||||
Level = SecureLevel.CoOwners;
|
||||
}
|
||||
Level = SecureLevel.CoOwners;
|
||||
}
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
if ( !from.InRange( GetWorldLocation(), 2 ) )
|
||||
from.LocalOverheadMessage( Network.MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that.
|
||||
else if ( Entries.Count == 0 )
|
||||
from.SendLocalizedMessage( 1062381 ); // The book is empty.
|
||||
else if ( from is PlayerMobile mobile )
|
||||
mobile.SendGump( new BOBGump( mobile, this ) );
|
||||
}
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
if ( !from.InRange( GetWorldLocation(), 2 ) )
|
||||
from.LocalOverheadMessage( Network.MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that.
|
||||
else if ( Entries.Count == 0 )
|
||||
from.SendLocalizedMessage( 1062381 ); // The book is empty.
|
||||
else if ( from is PlayerMobile mobile )
|
||||
mobile.SendGump( new BOBGump( mobile, this ) );
|
||||
}
|
||||
|
||||
public override void OnDoubleClickSecureTrade( Mobile from )
|
||||
{
|
||||
if ( !from.InRange( GetWorldLocation(), 2 ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 500446 ); // That is too far away.
|
||||
}
|
||||
else if ( Entries.Count == 0 )
|
||||
{
|
||||
from.SendLocalizedMessage( 1062381 ); // The book is empty.
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendGump( new BOBGump( (PlayerMobile)from, this ) );
|
||||
public override void OnDoubleClickSecureTrade( Mobile from )
|
||||
{
|
||||
if ( !from.InRange( GetWorldLocation(), 2 ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 500446 ); // That is too far away.
|
||||
}
|
||||
else if ( Entries.Count == 0 )
|
||||
{
|
||||
from.SendLocalizedMessage( 1062381 ); // The book is empty.
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendGump( new BOBGump( (PlayerMobile)from, this ) );
|
||||
|
||||
SecureTrade trade = GetSecureTradeCont()?.Trade;
|
||||
|
||||
|
|
@ -70,239 +70,236 @@ namespace Server.Engines.BulkOrders
|
|||
trade.To.Mobile.SendGump( new BOBGump( (PlayerMobile)trade.To.Mobile, this ) );
|
||||
else if (trade?.To.Mobile == from )
|
||||
trade.From.Mobile.SendGump( new BOBGump( (PlayerMobile)trade.From.Mobile, this ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override bool OnDragDrop( Mobile from, Item dropped )
|
||||
{
|
||||
if ( dropped is BaseBOD )
|
||||
{
|
||||
if ( !IsChildOf( from.Backpack ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 1062385 ); // You must have the book in your backpack to add deeds to it.
|
||||
return false;
|
||||
}
|
||||
if ( !from.Backpack.CheckHold( from, dropped, true, true ) )
|
||||
return false;
|
||||
if ( Entries.Count < 500 )
|
||||
{
|
||||
if ( dropped is LargeBOD bod )
|
||||
Entries.Add( new BOBLargeEntry( bod ) );
|
||||
else
|
||||
Entries.Add( new BOBSmallEntry( (SmallBOD)dropped ) );
|
||||
public override bool OnDragDrop( Mobile from, Item dropped )
|
||||
{
|
||||
if ( dropped is BaseBOD )
|
||||
{
|
||||
if ( !IsChildOf( from.Backpack ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 1062385 ); // You must have the book in your backpack to add deeds to it.
|
||||
return false;
|
||||
}
|
||||
if ( !from.Backpack.CheckHold( from, dropped, true, true ) )
|
||||
return false;
|
||||
if ( Entries.Count < 500 )
|
||||
{
|
||||
if ( dropped is LargeBOD bod )
|
||||
Entries.Add( new BOBLargeEntry( bod ) );
|
||||
else
|
||||
Entries.Add( new BOBSmallEntry( (SmallBOD)dropped ) );
|
||||
|
||||
InvalidateProperties();
|
||||
InvalidateProperties();
|
||||
|
||||
if ( Entries.Count / 5 > ItemCount )
|
||||
{
|
||||
ItemCount++;
|
||||
InvalidateItems();
|
||||
}
|
||||
if ( Entries.Count / 5 > ItemCount )
|
||||
{
|
||||
ItemCount++;
|
||||
InvalidateItems();
|
||||
}
|
||||
|
||||
from.SendSound(0x42, GetWorldLocation());
|
||||
from.SendLocalizedMessage( 1062386 ); // Deed added to book.
|
||||
from.SendSound(0x42, GetWorldLocation());
|
||||
from.SendLocalizedMessage( 1062386 ); // Deed added to book.
|
||||
|
||||
if ( from is PlayerMobile pm )
|
||||
pm.SendGump( new BOBGump( pm, this ) );
|
||||
if ( from is PlayerMobile pm )
|
||||
pm.SendGump( new BOBGump( pm, this ) );
|
||||
|
||||
dropped.Delete();
|
||||
dropped.Delete();
|
||||
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
from.SendLocalizedMessage( 1062388 ); // That is not a bulk order deed.
|
||||
return false;
|
||||
}
|
||||
|
||||
public override int GetTotal( TotalType type )
|
||||
{
|
||||
int total = base.GetTotal( type );
|
||||
public override int GetTotal( TotalType type )
|
||||
{
|
||||
int total = base.GetTotal( type );
|
||||
|
||||
if ( type == TotalType.Items )
|
||||
total = ItemCount;
|
||||
if ( type == TotalType.Items )
|
||||
total = ItemCount;
|
||||
|
||||
return total;
|
||||
}
|
||||
return total;
|
||||
}
|
||||
|
||||
public void InvalidateItems()
|
||||
{
|
||||
if ( RootParent is Mobile m )
|
||||
{
|
||||
m.UpdateTotals();
|
||||
InvalidateContainers( Parent );
|
||||
}
|
||||
}
|
||||
public void InvalidateItems()
|
||||
{
|
||||
if ( RootParent is Mobile m )
|
||||
{
|
||||
m.UpdateTotals();
|
||||
InvalidateContainers( Parent );
|
||||
}
|
||||
}
|
||||
|
||||
public void InvalidateContainers(IEntity parent)
|
||||
{
|
||||
if ( parent is Container c )
|
||||
{
|
||||
c.InvalidateProperties();
|
||||
InvalidateContainers( c.Parent );
|
||||
}
|
||||
}
|
||||
public void InvalidateContainers(IEntity parent)
|
||||
{
|
||||
if ( parent is Container c )
|
||||
{
|
||||
c.InvalidateProperties();
|
||||
InvalidateContainers( c.Parent );
|
||||
}
|
||||
}
|
||||
|
||||
public BulkOrderBook( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
public BulkOrderBook( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( 2 ); // version
|
||||
writer.Write( 2 ); // version
|
||||
|
||||
writer.Write( ItemCount );
|
||||
writer.Write( ItemCount );
|
||||
|
||||
writer.Write( (int) Level );
|
||||
writer.Write( (int) Level );
|
||||
|
||||
writer.Write( m_BookName );
|
||||
writer.Write( m_BookName );
|
||||
|
||||
Filter.Serialize( writer );
|
||||
Filter.Serialize( writer );
|
||||
|
||||
writer.WriteEncodedInt( Entries.Count );
|
||||
writer.WriteEncodedInt( Entries.Count );
|
||||
|
||||
for ( int i = 0; i < Entries.Count; ++i )
|
||||
{
|
||||
object obj = Entries[i];
|
||||
for ( int i = 0; i < Entries.Count; ++i )
|
||||
{
|
||||
object obj = Entries[i];
|
||||
|
||||
if ( obj is BOBLargeEntry entry )
|
||||
{
|
||||
writer.WriteEncodedInt( 0 );
|
||||
entry.Serialize( writer );
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.WriteEncodedInt( 1 );
|
||||
((BOBSmallEntry)obj).Serialize( writer );
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( obj is BOBLargeEntry entry )
|
||||
{
|
||||
writer.WriteEncodedInt( 0 );
|
||||
entry.Serialize( writer );
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.WriteEncodedInt( 1 );
|
||||
((BOBSmallEntry)obj).Serialize( writer );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 2:
|
||||
{
|
||||
ItemCount = reader.ReadInt();
|
||||
goto case 1;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
Level = (SecureLevel)reader.ReadInt();
|
||||
goto case 0;
|
||||
}
|
||||
case 0:
|
||||
{
|
||||
m_BookName = reader.ReadString();
|
||||
switch ( version )
|
||||
{
|
||||
case 2:
|
||||
{
|
||||
ItemCount = reader.ReadInt();
|
||||
goto case 1;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
Level = (SecureLevel)reader.ReadInt();
|
||||
goto case 0;
|
||||
}
|
||||
case 0:
|
||||
{
|
||||
m_BookName = reader.ReadString();
|
||||
|
||||
Filter = new BOBFilter( reader );
|
||||
Filter = new BOBFilter( reader );
|
||||
|
||||
int count = reader.ReadEncodedInt();
|
||||
int count = reader.ReadEncodedInt();
|
||||
|
||||
Entries = new List<IBOBEntry>( count );
|
||||
Entries = new List<IBOBEntry>( count );
|
||||
|
||||
for ( int i = 0; i < count; ++i )
|
||||
{
|
||||
int v = reader.ReadEncodedInt();
|
||||
for ( int i = 0; i < count; ++i )
|
||||
{
|
||||
int v = reader.ReadEncodedInt();
|
||||
|
||||
switch ( v )
|
||||
{
|
||||
case 0: Entries.Add( new BOBLargeEntry( reader ) ); break;
|
||||
case 1: Entries.Add( new BOBSmallEntry( reader ) ); break;
|
||||
}
|
||||
}
|
||||
switch ( v )
|
||||
{
|
||||
case 0: Entries.Add( new BOBLargeEntry( reader ) ); break;
|
||||
case 1: Entries.Add( new BOBSmallEntry( reader ) ); break;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void GetProperties( ObjectPropertyList list )
|
||||
{
|
||||
base.GetProperties( list );
|
||||
public override void GetProperties( ObjectPropertyList list )
|
||||
{
|
||||
base.GetProperties( list );
|
||||
|
||||
list.Add( 1062344, Entries.Count.ToString() ); // Deeds in book: ~1_val~
|
||||
list.Add( 1062344, Entries.Count.ToString() ); // Deeds in book: ~1_val~
|
||||
|
||||
if ( !string.IsNullOrEmpty(m_BookName) )
|
||||
list.Add( 1062481, m_BookName ); // Book Name: ~1_val~
|
||||
}
|
||||
if ( !string.IsNullOrEmpty(m_BookName) )
|
||||
list.Add( 1062481, m_BookName ); // Book Name: ~1_val~
|
||||
}
|
||||
|
||||
public override void OnSingleClick(Mobile from)
|
||||
{
|
||||
base.OnSingleClick(from);
|
||||
public override void OnSingleClick(Mobile from)
|
||||
{
|
||||
base.OnSingleClick(from);
|
||||
|
||||
LabelTo(from, 1062344, Entries.Count.ToString()); // Deeds in book: ~1_val~
|
||||
LabelTo(from, 1062344, Entries.Count.ToString()); // Deeds in book: ~1_val~
|
||||
|
||||
if (!string.IsNullOrEmpty(m_BookName))
|
||||
LabelTo(from, 1062481, m_BookName);
|
||||
}
|
||||
if (!string.IsNullOrEmpty(m_BookName))
|
||||
LabelTo(from, 1062481, m_BookName);
|
||||
}
|
||||
|
||||
public override void GetContextMenuEntries( Mobile from, List<ContextMenuEntry> list )
|
||||
{
|
||||
base.GetContextMenuEntries( from, list );
|
||||
public override void GetContextMenuEntries( Mobile from, List<ContextMenuEntry> list )
|
||||
{
|
||||
base.GetContextMenuEntries( from, list );
|
||||
|
||||
if ( from.CheckAlive() && IsChildOf( from.Backpack ) )
|
||||
list.Add( new NameBookEntry( from, this ) );
|
||||
if ( from.CheckAlive() && IsChildOf( from.Backpack ) )
|
||||
list.Add( new NameBookEntry( from, this ) );
|
||||
|
||||
SetSecureLevelEntry.AddTo( from, this, list );
|
||||
}
|
||||
SetSecureLevelEntry.AddTo( from, this, list );
|
||||
}
|
||||
|
||||
private class NameBookEntry : ContextMenuEntry
|
||||
{
|
||||
private Mobile m_From;
|
||||
private BulkOrderBook m_Book;
|
||||
private class NameBookEntry : ContextMenuEntry
|
||||
{
|
||||
private Mobile m_From;
|
||||
private BulkOrderBook m_Book;
|
||||
|
||||
public NameBookEntry( Mobile from, BulkOrderBook book ) : base( 6216 )
|
||||
{
|
||||
m_From = from;
|
||||
m_Book = book;
|
||||
}
|
||||
public NameBookEntry( Mobile from, BulkOrderBook book ) : base( 6216 )
|
||||
{
|
||||
m_From = from;
|
||||
m_Book = book;
|
||||
}
|
||||
|
||||
public override void OnClick()
|
||||
{
|
||||
if ( m_From.CheckAlive() && m_Book.IsChildOf( m_From.Backpack ) )
|
||||
{
|
||||
m_From.Prompt = new NameBookPrompt( m_Book );
|
||||
m_From.SendLocalizedMessage( 1062479 ); // Type in the new name of the book:
|
||||
}
|
||||
}
|
||||
}
|
||||
public override void OnClick()
|
||||
{
|
||||
if ( m_From.CheckAlive() && m_Book.IsChildOf( m_From.Backpack ) )
|
||||
{
|
||||
m_From.Prompt = new NameBookPrompt( m_Book );
|
||||
m_From.SendLocalizedMessage( 1062479 ); // Type in the new name of the book:
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class NameBookPrompt : Prompt
|
||||
{
|
||||
private BulkOrderBook m_Book;
|
||||
private class NameBookPrompt : Prompt
|
||||
{
|
||||
private BulkOrderBook m_Book;
|
||||
|
||||
public NameBookPrompt( BulkOrderBook book )
|
||||
{
|
||||
m_Book = book;
|
||||
}
|
||||
public NameBookPrompt( BulkOrderBook book ) => m_Book = book;
|
||||
|
||||
public override void OnResponse( Mobile from, string text )
|
||||
{
|
||||
if ( text.Length > 40 )
|
||||
text = text.Substring( 0, 40 );
|
||||
public override void OnResponse( Mobile from, string text )
|
||||
{
|
||||
if ( text.Length > 40 )
|
||||
text = text.Substring( 0, 40 );
|
||||
|
||||
if ( from.CheckAlive() && m_Book.IsChildOf( from.Backpack ) )
|
||||
{
|
||||
m_Book.BookName = Utility.FixHtml( text.Trim() );
|
||||
if ( from.CheckAlive() && m_Book.IsChildOf( from.Backpack ) )
|
||||
{
|
||||
m_Book.BookName = Utility.FixHtml( text.Trim() );
|
||||
|
||||
from.SendLocalizedMessage( 1062480 ); // The bulk order book's name has been changed.
|
||||
}
|
||||
}
|
||||
from.SendLocalizedMessage( 1062480 ); // The bulk order book's name has been changed.
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnCancel( Mobile from )
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
public override void OnCancel( Mobile from )
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,10 +28,8 @@ namespace Server.Engines.BulkOrders
|
|||
public override int LabelNumber => 1045151; // a bulk order deed
|
||||
|
||||
public LargeBOD(int hue, int amountMax, bool requireExeptional, BulkMaterialType material, LargeBulkEntry[] entries) :
|
||||
base(hue, amountMax, requireExeptional, material)
|
||||
{
|
||||
m_Entries = entries;
|
||||
}
|
||||
base(hue, amountMax, requireExeptional, material) =>
|
||||
m_Entries = entries;
|
||||
|
||||
public LargeBOD()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -3,118 +3,118 @@ using System.Collections.Generic;
|
|||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
public class LargeBulkEntry
|
||||
{
|
||||
private int m_Amount;
|
||||
public class LargeBulkEntry
|
||||
{
|
||||
private int m_Amount;
|
||||
|
||||
public LargeBOD Owner { get; set; }
|
||||
public LargeBOD Owner { get; set; }
|
||||
|
||||
public int Amount
|
||||
public int Amount
|
||||
{
|
||||
get => m_Amount;
|
||||
set{ m_Amount = value; Owner?.InvalidateProperties(); }
|
||||
set{ m_Amount = value; Owner?.InvalidateProperties(); }
|
||||
}
|
||||
public SmallBulkEntry Details { get; }
|
||||
public SmallBulkEntry Details { get; }
|
||||
|
||||
public static SmallBulkEntry[] LargeRing => GetEntries( "Blacksmith", "largering" );
|
||||
public static SmallBulkEntry[] LargeRing => GetEntries( "Blacksmith", "largering" );
|
||||
|
||||
public static SmallBulkEntry[] LargePlate => GetEntries( "Blacksmith", "largeplate" );
|
||||
public static SmallBulkEntry[] LargePlate => GetEntries( "Blacksmith", "largeplate" );
|
||||
|
||||
public static SmallBulkEntry[] LargeChain => GetEntries( "Blacksmith", "largechain" );
|
||||
public static SmallBulkEntry[] LargeChain => GetEntries( "Blacksmith", "largechain" );
|
||||
|
||||
public static SmallBulkEntry[] LargeAxes => GetEntries( "Blacksmith", "largeaxes" );
|
||||
public static SmallBulkEntry[] LargeAxes => GetEntries( "Blacksmith", "largeaxes" );
|
||||
|
||||
public static SmallBulkEntry[] LargeFencing => GetEntries( "Blacksmith", "largefencing" );
|
||||
public static SmallBulkEntry[] LargeFencing => GetEntries( "Blacksmith", "largefencing" );
|
||||
|
||||
public static SmallBulkEntry[] LargeMaces => GetEntries( "Blacksmith", "largemaces" );
|
||||
public static SmallBulkEntry[] LargeMaces => GetEntries( "Blacksmith", "largemaces" );
|
||||
|
||||
public static SmallBulkEntry[] LargePolearms => GetEntries( "Blacksmith", "largepolearms" );
|
||||
public static SmallBulkEntry[] LargePolearms => GetEntries( "Blacksmith", "largepolearms" );
|
||||
|
||||
public static SmallBulkEntry[] LargeSwords => GetEntries( "Blacksmith", "largeswords" );
|
||||
public static SmallBulkEntry[] LargeSwords => GetEntries( "Blacksmith", "largeswords" );
|
||||
|
||||
|
||||
public static SmallBulkEntry[] BoneSet => GetEntries( "Tailoring", "boneset" );
|
||||
public static SmallBulkEntry[] BoneSet => GetEntries( "Tailoring", "boneset" );
|
||||
|
||||
public static SmallBulkEntry[] Farmer => GetEntries( "Tailoring", "farmer" );
|
||||
public static SmallBulkEntry[] Farmer => GetEntries( "Tailoring", "farmer" );
|
||||
|
||||
public static SmallBulkEntry[] FemaleLeatherSet => GetEntries( "Tailoring", "femaleleatherset" );
|
||||
public static SmallBulkEntry[] FemaleLeatherSet => GetEntries( "Tailoring", "femaleleatherset" );
|
||||
|
||||
public static SmallBulkEntry[] FisherGirl => GetEntries( "Tailoring", "fishergirl" );
|
||||
public static SmallBulkEntry[] FisherGirl => GetEntries( "Tailoring", "fishergirl" );
|
||||
|
||||
public static SmallBulkEntry[] Gypsy => GetEntries( "Tailoring", "gypsy" );
|
||||
public static SmallBulkEntry[] Gypsy => GetEntries( "Tailoring", "gypsy" );
|
||||
|
||||
public static SmallBulkEntry[] HatSet => GetEntries( "Tailoring", "hatset" );
|
||||
public static SmallBulkEntry[] HatSet => GetEntries( "Tailoring", "hatset" );
|
||||
|
||||
public static SmallBulkEntry[] Jester => GetEntries( "Tailoring", "jester" );
|
||||
public static SmallBulkEntry[] Jester => GetEntries( "Tailoring", "jester" );
|
||||
|
||||
public static SmallBulkEntry[] Lady => GetEntries( "Tailoring", "lady" );
|
||||
public static SmallBulkEntry[] Lady => GetEntries( "Tailoring", "lady" );
|
||||
|
||||
public static SmallBulkEntry[] MaleLeatherSet => GetEntries( "Tailoring", "maleleatherset" );
|
||||
public static SmallBulkEntry[] MaleLeatherSet => GetEntries( "Tailoring", "maleleatherset" );
|
||||
|
||||
public static SmallBulkEntry[] Pirate => GetEntries( "Tailoring", "pirate" );
|
||||
public static SmallBulkEntry[] Pirate => GetEntries( "Tailoring", "pirate" );
|
||||
|
||||
public static SmallBulkEntry[] ShoeSet => GetEntries( "Tailoring", "shoeset" );
|
||||
public static SmallBulkEntry[] ShoeSet => GetEntries( "Tailoring", "shoeset" );
|
||||
|
||||
public static SmallBulkEntry[] StuddedSet => GetEntries( "Tailoring", "studdedset" );
|
||||
public static SmallBulkEntry[] StuddedSet => GetEntries( "Tailoring", "studdedset" );
|
||||
|
||||
public static SmallBulkEntry[] TownCrier => GetEntries( "Tailoring", "towncrier" );
|
||||
public static SmallBulkEntry[] TownCrier => GetEntries( "Tailoring", "towncrier" );
|
||||
|
||||
public static SmallBulkEntry[] Wizard => GetEntries( "Tailoring", "wizard" );
|
||||
public static SmallBulkEntry[] Wizard => GetEntries( "Tailoring", "wizard" );
|
||||
|
||||
|
||||
private static Dictionary<string,Dictionary<string,SmallBulkEntry[]>> m_Cache;
|
||||
private static Dictionary<string,Dictionary<string,SmallBulkEntry[]>> m_Cache;
|
||||
|
||||
public static SmallBulkEntry[] GetEntries( string type, string name )
|
||||
{
|
||||
if (m_Cache == null)
|
||||
m_Cache = new Dictionary<string, Dictionary<string, SmallBulkEntry[]>>();
|
||||
public static SmallBulkEntry[] GetEntries( string type, string name )
|
||||
{
|
||||
if (m_Cache == null)
|
||||
m_Cache = new Dictionary<string, Dictionary<string, SmallBulkEntry[]>>();
|
||||
|
||||
if (!m_Cache.TryGetValue( type, out Dictionary<string, SmallBulkEntry[]> table ))
|
||||
m_Cache[type] = table = new Dictionary<string, SmallBulkEntry[]>();
|
||||
if (!m_Cache.TryGetValue( type, out Dictionary<string, SmallBulkEntry[]> table ))
|
||||
m_Cache[type] = table = new Dictionary<string, SmallBulkEntry[]>();
|
||||
|
||||
if (!table.TryGetValue( name, out SmallBulkEntry[] entries ))
|
||||
table[name] = entries = SmallBulkEntry.LoadEntries(type, name);
|
||||
if (!table.TryGetValue( name, out SmallBulkEntry[] entries ))
|
||||
table[name] = entries = SmallBulkEntry.LoadEntries(type, name);
|
||||
|
||||
return entries;
|
||||
}
|
||||
return entries;
|
||||
}
|
||||
|
||||
public static LargeBulkEntry[] ConvertEntries( LargeBOD owner, SmallBulkEntry[] small )
|
||||
{
|
||||
LargeBulkEntry[] large = new LargeBulkEntry[small.Length];
|
||||
public static LargeBulkEntry[] ConvertEntries( LargeBOD owner, SmallBulkEntry[] small )
|
||||
{
|
||||
LargeBulkEntry[] large = new LargeBulkEntry[small.Length];
|
||||
|
||||
for ( int i = 0; i < small.Length; ++i )
|
||||
large[i] = new LargeBulkEntry( owner, small[i] );
|
||||
for ( int i = 0; i < small.Length; ++i )
|
||||
large[i] = new LargeBulkEntry( owner, small[i] );
|
||||
|
||||
return large;
|
||||
}
|
||||
return large;
|
||||
}
|
||||
|
||||
public LargeBulkEntry( LargeBOD owner, SmallBulkEntry details )
|
||||
{
|
||||
Owner = owner;
|
||||
Details = details;
|
||||
}
|
||||
public LargeBulkEntry( LargeBOD owner, SmallBulkEntry details )
|
||||
{
|
||||
Owner = owner;
|
||||
Details = details;
|
||||
}
|
||||
|
||||
public LargeBulkEntry( LargeBOD owner, GenericReader reader )
|
||||
{
|
||||
Owner = owner;
|
||||
m_Amount = reader.ReadInt();
|
||||
public LargeBulkEntry( LargeBOD owner, GenericReader reader )
|
||||
{
|
||||
Owner = owner;
|
||||
m_Amount = reader.ReadInt();
|
||||
|
||||
Type realType = null;
|
||||
Type realType = null;
|
||||
|
||||
string type = reader.ReadString();
|
||||
string type = reader.ReadString();
|
||||
|
||||
if ( type != null )
|
||||
realType = AssemblyHandler.FindTypeByFullName( type );
|
||||
if ( type != null )
|
||||
realType = AssemblyHandler.FindTypeByFullName( type );
|
||||
|
||||
Details = new SmallBulkEntry( realType, reader.ReadInt(), reader.ReadInt() );
|
||||
}
|
||||
Details = new SmallBulkEntry( realType, reader.ReadInt(), reader.ReadInt() );
|
||||
}
|
||||
|
||||
public void Serialize( GenericWriter writer )
|
||||
{
|
||||
writer.Write( m_Amount );
|
||||
writer.Write( Details.Type == null ? null : Details.Type.FullName );
|
||||
writer.Write( Details.Number );
|
||||
writer.Write( Details.Graphic );
|
||||
}
|
||||
}
|
||||
public void Serialize( GenericWriter writer )
|
||||
{
|
||||
writer.Write( m_Amount );
|
||||
writer.Write( Details.Type == null ? null : Details.Type.FullName );
|
||||
writer.Write( Details.Number );
|
||||
writer.Write( Details.Graphic );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -91,15 +91,9 @@ namespace Server.Engines.BulkOrders
|
|||
{
|
||||
}
|
||||
|
||||
public override int ComputeFame()
|
||||
{
|
||||
return TailorRewardCalculator.Instance.ComputeFame(this);
|
||||
}
|
||||
public override int ComputeFame() => TailorRewardCalculator.Instance.ComputeFame(this);
|
||||
|
||||
public override int ComputeGold()
|
||||
{
|
||||
return TailorRewardCalculator.Instance.ComputeGold(this);
|
||||
}
|
||||
public override int ComputeGold() => TailorRewardCalculator.Instance.ComputeGold(this);
|
||||
|
||||
public override RewardGroup GetRewardGroup() =>
|
||||
TailorRewardCalculator.Instance.LookupRewards(TailorRewardCalculator.Instance.ComputePoints(this));
|
||||
|
|
|
|||
|
|
@ -116,27 +116,17 @@ namespace Server.Engines.BulkOrders
|
|||
return points * points;
|
||||
}
|
||||
|
||||
public virtual int ComputePoints(SmallBOD bod)
|
||||
{
|
||||
return ComputePoints(bod.AmountMax, bod.RequireExceptional, bod.Material, 1, bod.Type);
|
||||
}
|
||||
public virtual int ComputePoints(SmallBOD bod) => ComputePoints(bod.AmountMax, bod.RequireExceptional, bod.Material, 1, bod.Type);
|
||||
|
||||
public virtual int ComputePoints(LargeBOD bod)
|
||||
{
|
||||
return ComputePoints(bod.AmountMax, bod.RequireExceptional, bod.Material, bod.Entries.Length,
|
||||
public virtual int ComputePoints(LargeBOD bod) =>
|
||||
ComputePoints(bod.AmountMax, bod.RequireExceptional, bod.Material, bod.Entries.Length,
|
||||
bod.Entries[0].Details.Type);
|
||||
}
|
||||
|
||||
public virtual int ComputeGold(SmallBOD bod)
|
||||
{
|
||||
return ComputeGold(bod.AmountMax, bod.RequireExceptional, bod.Material, 1, bod.Type);
|
||||
}
|
||||
public virtual int ComputeGold(SmallBOD bod) => ComputeGold(bod.AmountMax, bod.RequireExceptional, bod.Material, 1, bod.Type);
|
||||
|
||||
public virtual int ComputeGold(LargeBOD bod)
|
||||
{
|
||||
return ComputeGold(bod.AmountMax, bod.RequireExceptional, bod.Material, bod.Entries.Length,
|
||||
public virtual int ComputeGold(LargeBOD bod) =>
|
||||
ComputeGold(bod.AmountMax, bod.RequireExceptional, bod.Material, bod.Entries.Length,
|
||||
bod.Entries[0].Details.Type);
|
||||
}
|
||||
|
||||
public virtual RewardGroup LookupRewards(int points)
|
||||
{
|
||||
|
|
@ -385,15 +375,9 @@ namespace Server.Engines.BulkOrders
|
|||
|
||||
#region Constructors
|
||||
|
||||
private static Item CreateSturdyShovel(int type)
|
||||
{
|
||||
return new SturdyShovel();
|
||||
}
|
||||
private static Item CreateSturdyShovel(int type) => new SturdyShovel();
|
||||
|
||||
private static Item CreateSturdyPickaxe(int type)
|
||||
{
|
||||
return new SturdyPickaxe();
|
||||
}
|
||||
private static Item CreateSturdyPickaxe(int type) => new SturdyPickaxe();
|
||||
|
||||
private static Item CreateMiningGloves(int type)
|
||||
{
|
||||
|
|
@ -410,20 +394,11 @@ namespace Server.Engines.BulkOrders
|
|||
}
|
||||
}
|
||||
|
||||
private static Item CreateGargoylesPickaxe(int type)
|
||||
{
|
||||
return new GargoylesPickaxe();
|
||||
}
|
||||
private static Item CreateGargoylesPickaxe(int type) => new GargoylesPickaxe();
|
||||
|
||||
private static Item CreateProspectorsTool(int type)
|
||||
{
|
||||
return new ProspectorsTool();
|
||||
}
|
||||
private static Item CreateProspectorsTool(int type) => new ProspectorsTool();
|
||||
|
||||
private static Item CreatePowderOfTemperament(int type)
|
||||
{
|
||||
return new PowderOfTemperament();
|
||||
}
|
||||
private static Item CreatePowderOfTemperament(int type) => new PowderOfTemperament();
|
||||
|
||||
private static Item CreateRunicHammer(int type)
|
||||
{
|
||||
|
|
@ -441,13 +416,7 @@ namespace Server.Engines.BulkOrders
|
|||
throw new InvalidOperationException();
|
||||
}
|
||||
|
||||
private static Item CreateColoredAnvil(int type)
|
||||
{
|
||||
// Generate an anvil deed, not an actual anvil.
|
||||
//return new ColoredAnvilDeed();
|
||||
|
||||
return new ColoredAnvil();
|
||||
}
|
||||
private static Item CreateColoredAnvil(int type) => new ColoredAnvil();
|
||||
|
||||
private static Item CreateAncientHammer(int type)
|
||||
{
|
||||
|
|
@ -678,10 +647,7 @@ namespace Server.Engines.BulkOrders
|
|||
0x484, 0x497
|
||||
};
|
||||
|
||||
private static Item CreateSandals(int type)
|
||||
{
|
||||
return new Sandals(m_SandalHues[Utility.Random(m_SandalHues.Length)]);
|
||||
}
|
||||
private static Item CreateSandals(int type) => new Sandals(m_SandalHues[Utility.Random(m_SandalHues.Length)]);
|
||||
|
||||
private static Item CreateStretchedHide(int type)
|
||||
{
|
||||
|
|
@ -735,10 +701,7 @@ namespace Server.Engines.BulkOrders
|
|||
throw new InvalidOperationException();
|
||||
}
|
||||
|
||||
private static Item CreateCBD(int type)
|
||||
{
|
||||
return new ClothingBlessDeed();
|
||||
}
|
||||
private static Item CreateCBD(int type) => new ClothingBlessDeed();
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,89 +4,84 @@ using System.IO;
|
|||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
public class SmallBulkEntry
|
||||
{
|
||||
public Type Type { get; }
|
||||
public class SmallBulkEntry
|
||||
{
|
||||
public Type Type { get; }
|
||||
|
||||
public int Number { get; }
|
||||
public int Number { get; }
|
||||
|
||||
public int Graphic { get; }
|
||||
public int Graphic { get; }
|
||||
|
||||
public SmallBulkEntry( Type type, int number, int graphic )
|
||||
{
|
||||
Type = type;
|
||||
Number = number;
|
||||
Graphic = graphic;
|
||||
}
|
||||
public SmallBulkEntry( Type type, int number, int graphic )
|
||||
{
|
||||
Type = type;
|
||||
Number = number;
|
||||
Graphic = graphic;
|
||||
}
|
||||
|
||||
public static SmallBulkEntry[] BlacksmithWeapons => GetEntries( "Blacksmith", "weapons" );
|
||||
public static SmallBulkEntry[] BlacksmithWeapons => GetEntries( "Blacksmith", "weapons" );
|
||||
|
||||
public static SmallBulkEntry[] BlacksmithArmor => GetEntries( "Blacksmith", "armor" );
|
||||
public static SmallBulkEntry[] BlacksmithArmor => GetEntries( "Blacksmith", "armor" );
|
||||
|
||||
public static SmallBulkEntry[] TailorCloth => GetEntries( "Tailoring", "cloth" );
|
||||
public static SmallBulkEntry[] TailorCloth => GetEntries( "Tailoring", "cloth" );
|
||||
|
||||
public static SmallBulkEntry[] TailorLeather => GetEntries( "Tailoring", "leather" );
|
||||
public static SmallBulkEntry[] TailorLeather => GetEntries( "Tailoring", "leather" );
|
||||
|
||||
private static Dictionary<string, Dictionary<string, SmallBulkEntry[]>> m_Cache;
|
||||
private static Dictionary<string, Dictionary<string, SmallBulkEntry[]>> m_Cache;
|
||||
|
||||
public static SmallBulkEntry[] GetEntries( string type, string name )
|
||||
{
|
||||
if ( m_Cache == null )
|
||||
m_Cache = new Dictionary<string, Dictionary<string, SmallBulkEntry[]>>();
|
||||
public static SmallBulkEntry[] GetEntries( string type, string name )
|
||||
{
|
||||
if ( m_Cache == null )
|
||||
m_Cache = new Dictionary<string, Dictionary<string, SmallBulkEntry[]>>();
|
||||
|
||||
if (!m_Cache.TryGetValue( type, out Dictionary<string, SmallBulkEntry[]> table ))
|
||||
m_Cache[type] = table = new Dictionary<string, SmallBulkEntry[]>();
|
||||
if (!m_Cache.TryGetValue( type, out Dictionary<string, SmallBulkEntry[]> table ))
|
||||
m_Cache[type] = table = new Dictionary<string, SmallBulkEntry[]>();
|
||||
|
||||
if (!table.TryGetValue( name, out SmallBulkEntry[] entries ))
|
||||
table[name] = entries = LoadEntries(type, name);
|
||||
if (!table.TryGetValue( name, out SmallBulkEntry[] entries ))
|
||||
table[name] = entries = LoadEntries(type, name);
|
||||
|
||||
return entries;
|
||||
}
|
||||
return entries;
|
||||
}
|
||||
|
||||
public static SmallBulkEntry[] LoadEntries( string type, string name )
|
||||
{
|
||||
return LoadEntries($"Data/Bulk Orders/{type}/{name}.cfg");
|
||||
}
|
||||
public static SmallBulkEntry[] LoadEntries( string type, string name ) => LoadEntries($"Data/Bulk Orders/{type}/{name}.cfg");
|
||||
|
||||
public static SmallBulkEntry[] LoadEntries( string path )
|
||||
{
|
||||
path = Path.Combine( Core.BaseDirectory, path );
|
||||
public static SmallBulkEntry[] LoadEntries( string path )
|
||||
{
|
||||
path = Path.Combine( Core.BaseDirectory, path );
|
||||
|
||||
List<SmallBulkEntry> list = new List<SmallBulkEntry>();
|
||||
List<SmallBulkEntry> list = new List<SmallBulkEntry>();
|
||||
|
||||
if ( File.Exists( path ) )
|
||||
{
|
||||
using ( StreamReader ip = new StreamReader( path ) )
|
||||
{
|
||||
string line;
|
||||
if ( File.Exists( path ) )
|
||||
{
|
||||
using StreamReader ip = new StreamReader( path );
|
||||
string line;
|
||||
|
||||
while ( (line = ip.ReadLine()) != null )
|
||||
{
|
||||
if ( line.Length == 0 || line.StartsWith( "#" ) )
|
||||
continue;
|
||||
while ( (line = ip.ReadLine()) != null )
|
||||
{
|
||||
if ( line.Length == 0 || line.StartsWith( "#" ) )
|
||||
continue;
|
||||
|
||||
try
|
||||
{
|
||||
string[] split = line.Split( '\t' );
|
||||
try
|
||||
{
|
||||
string[] split = line.Split( '\t' );
|
||||
|
||||
if ( split.Length >= 2 )
|
||||
{
|
||||
Type type = AssemblyHandler.FindTypeByName( split[0] );
|
||||
int graphic = Utility.ToInt32( split[split.Length - 1] );
|
||||
|
||||
if ( type != null && graphic > 0 )
|
||||
list.Add( new SmallBulkEntry( type, graphic < 0x4000 ? 1020000 + graphic : 1078872 + graphic, graphic ) );
|
||||
}
|
||||
}
|
||||
catch
|
||||
if ( split.Length >= 2 )
|
||||
{
|
||||
// ignored
|
||||
Type type = AssemblyHandler.FindTypeByName( split[0] );
|
||||
int graphic = Utility.ToInt32( split[split.Length - 1] );
|
||||
|
||||
if ( type != null && graphic > 0 )
|
||||
list.Add( new SmallBulkEntry( type, graphic < 0x4000 ? 1020000 + graphic : 1078872 + graphic, graphic ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
// ignored
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return list.ToArray();
|
||||
}
|
||||
}
|
||||
return list.ToArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue