Overwrite
Complete Overwrite of the Folder with the free shard. ServUO 57.3 has been added.
This commit is contained in:
110
Scripts/Services/BulkOrders/Books/BOBFilter.cs
Normal file
110
Scripts/Services/BulkOrders/Books/BOBFilter.cs
Normal file
@@ -0,0 +1,110 @@
|
||||
using System;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
public class BOBFilter
|
||||
{
|
||||
private int m_Type;
|
||||
private int m_Quality;
|
||||
private int m_Material;
|
||||
private int m_Quantity;
|
||||
|
||||
public BOBFilter()
|
||||
{
|
||||
}
|
||||
|
||||
public BOBFilter(GenericReader reader)
|
||||
{
|
||||
int version = reader.ReadEncodedInt();
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
this.m_Type = reader.ReadEncodedInt();
|
||||
this.m_Quality = reader.ReadEncodedInt();
|
||||
this.m_Material = reader.ReadEncodedInt();
|
||||
this.m_Quantity = reader.ReadEncodedInt();
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsDefault
|
||||
{
|
||||
get
|
||||
{
|
||||
return (this.m_Type == 0 && this.m_Quality == 0 && this.m_Material == 0 && this.m_Quantity == 0);
|
||||
}
|
||||
}
|
||||
public int Type
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.m_Type;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.m_Type = value;
|
||||
}
|
||||
}
|
||||
public int Quality
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.m_Quality;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.m_Quality = value;
|
||||
}
|
||||
}
|
||||
public int Material
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.m_Material;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.m_Material = value;
|
||||
}
|
||||
}
|
||||
public int Quantity
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.m_Quantity;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.m_Quantity = value;
|
||||
}
|
||||
}
|
||||
public void Clear()
|
||||
{
|
||||
this.m_Type = 0;
|
||||
this.m_Quality = 0;
|
||||
this.m_Material = 0;
|
||||
this.m_Quantity = 0;
|
||||
}
|
||||
|
||||
public void Serialize(GenericWriter writer)
|
||||
{
|
||||
if (this.IsDefault)
|
||||
{
|
||||
writer.WriteEncodedInt(0); // version
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.WriteEncodedInt(1); // version
|
||||
|
||||
writer.WriteEncodedInt(this.m_Type);
|
||||
writer.WriteEncodedInt(this.m_Quality);
|
||||
writer.WriteEncodedInt(this.m_Material);
|
||||
writer.WriteEncodedInt(this.m_Quantity);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
316
Scripts/Services/BulkOrders/Books/BOBFilterGump.cs
Normal file
316
Scripts/Services/BulkOrders/Books/BOBFilterGump.cs
Normal file
@@ -0,0 +1,316 @@
|
||||
using System;
|
||||
using Server.Gumps;
|
||||
using Server.Mobiles;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
public class BOBFilterGump : Gump
|
||||
{
|
||||
private static int[,] m_MaterialFilters = new int[,]
|
||||
{
|
||||
{ 1044067, 1 }, // Blacksmithy
|
||||
{ 1062226, 3 }, // Iron
|
||||
{ 1018332, 4 }, // Dull Copper
|
||||
{ 1018333, 5 }, // Shadow Iron
|
||||
{ 1018334, 6 }, // Copper
|
||||
{ 1018335, 7 }, // Bronze
|
||||
|
||||
{ 0, 0 }, // --Blank--
|
||||
{ 1018336, 8 }, // Golden
|
||||
{ 1018337, 9 }, // Agapite
|
||||
{ 1018338, 10 }, // Verite
|
||||
{ 1018339, 11 }, // Valorite
|
||||
{ 0, 0 }, // --Blank--
|
||||
|
||||
{ 1044094, 2 }, // Tailoring
|
||||
{ 1044286, 12 }, // Cloth
|
||||
{ 1062235, 13 }, // Leather
|
||||
{ 1062236, 14 }, // Spined
|
||||
{ 1062237, 15 }, // Horned
|
||||
{ 1062238, 16 } // Barbed
|
||||
};
|
||||
|
||||
private static readonly int[,] m_MaterialFiltersNew = new int[,]
|
||||
{
|
||||
{ 1044067, 1 }, // Blacksmithy
|
||||
{ 1062226, 9 }, // Iron
|
||||
{ 1018332, 10 }, // Dull Copper
|
||||
{ 1018333, 11 }, // Shadow Iron
|
||||
{ 1018334, 12 }, // Copper
|
||||
{ 1018335, 13 }, // Bronze
|
||||
|
||||
{ 0, 0 }, // --Blank--
|
||||
{ 1018336, 14 }, // Golden
|
||||
{ 1018337, 15 }, // Agapite
|
||||
{ 1018338, 16 }, // Verite
|
||||
{ 1018339, 17 }, // Valorite
|
||||
{ 0, 0 }, // --Blank--
|
||||
|
||||
{ 1044094, 2 }, // Tailoring
|
||||
{ 1044286, 18 }, // Cloth
|
||||
{ 1062235, 19 }, // Leather
|
||||
{ 1062236, 20 }, // Spined
|
||||
{ 1062237, 21 }, // Horned
|
||||
{ 1062238, 22 }, // Barbed
|
||||
|
||||
{ 1044097, 3 }, // Tinkering
|
||||
{ 1062226, 23 }, // Iron
|
||||
{ 1018332, 24 }, // Dull Copper
|
||||
{ 1018333, 25 }, // Shadow Iron
|
||||
{ 1018334, 26 }, // Copper
|
||||
{ 1018335, 27 }, // Bronze
|
||||
|
||||
{ 0, 0 }, // --Blank--
|
||||
{ 1018336, 28 }, // Golden
|
||||
{ 1018337, 29 }, // Agapite
|
||||
{ 1018338, 30 }, // Verite
|
||||
{ 1018339, 31 }, // Valorite
|
||||
{ 0, 0 }, // --Blank--
|
||||
|
||||
{ 1044071, 4 }, // Carpentry
|
||||
{ 1079435, 32 }, // Wood
|
||||
{ 1071428, 33 }, // Oak
|
||||
{ 1071429, 34 }, // Ash
|
||||
{ 1071430, 35 }, // Yew
|
||||
{ 0, 0 }, // --Blank--
|
||||
|
||||
{ 0, 0 }, // --Blank--
|
||||
{ 1071431, 36 }, // Bloodwood
|
||||
{ 1071432, 37 }, // Heartwood
|
||||
{ 1071433, 38 }, // Frostwood
|
||||
{ 0, 0 }, // --Blank--
|
||||
{ 0, 0 }, // --Blank--
|
||||
|
||||
{ 1044068, 5 }, // Fletching
|
||||
{ 1079435, 39 }, // Wood
|
||||
{ 1071428, 40 }, // Oak
|
||||
{ 1071429, 41 }, // Ash
|
||||
{ 1071430, 42 }, // Yew
|
||||
{ 0, 0 }, // --Blank--
|
||||
|
||||
{ 0, 0 }, // --Blank--
|
||||
{ 1071431, 43 }, // Bloodwood
|
||||
{ 1071432, 44 }, // Heartwood
|
||||
{ 1071433, 45 }, // Frostwood
|
||||
{ 0, 0 }, // --Blank--
|
||||
{ 0, 0 }, // --Blank--
|
||||
|
||||
{ 1044060, 6 }, // Alchemy
|
||||
{ 0, 0 }, // --Blank--
|
||||
{ 0, 0 }, // --Blank--
|
||||
{ 0, 0 }, // --Blank--
|
||||
{ 0, 0 }, // --Blank--
|
||||
{ 0, 0 }, // --Blank--
|
||||
|
||||
{ 1044083, 7 }, // Inscription
|
||||
{ 0, 0 }, // --Blank--
|
||||
{ 0, 0 }, // --Blank--
|
||||
{ 0, 0 }, // --Blank--
|
||||
{ 0, 0 }, // --Blank--
|
||||
{ 0, 0 }, // --Blank--
|
||||
|
||||
{ 1044073, 8 }, // Cooking
|
||||
{ 0, 0 }, // --Blank--
|
||||
{ 0, 0 }, // --Blank--
|
||||
{ 0, 0 }, // --Blank--
|
||||
{ 0, 0 }, // --Blank--
|
||||
{ 0, 0 }, // --Blank--
|
||||
};
|
||||
|
||||
private static readonly int[,] m_TypeFilters = new int[,]
|
||||
{
|
||||
{ 1062229, 0 }, // All
|
||||
{ 1062224, 1 }, // Small
|
||||
{ 1062225, 2 }// Large
|
||||
};
|
||||
|
||||
private static readonly int[,] m_QualityFilters = new int[,]
|
||||
{
|
||||
{ 1062229, 0 }, // All
|
||||
{ 1011542, 1 }, // Normal
|
||||
{ 1060636, 2 }// Exceptional
|
||||
};
|
||||
|
||||
private static readonly int[,] m_AmountFilters = new int[,]
|
||||
{
|
||||
{ 1062229, 0 }, // All
|
||||
{ 1049706, 1 }, // 10
|
||||
{ 1016007, 2 }, // 15
|
||||
{ 1062239, 3 }// 20
|
||||
};
|
||||
|
||||
private static readonly int[][,] m_Filters = new int[][,]
|
||||
{
|
||||
m_TypeFilters,
|
||||
m_QualityFilters,
|
||||
m_MaterialFilters,
|
||||
m_AmountFilters
|
||||
};
|
||||
|
||||
private static readonly int[][,] m_FiltersNew = new int[][,]
|
||||
{
|
||||
m_TypeFilters,
|
||||
m_QualityFilters,
|
||||
m_MaterialFiltersNew,
|
||||
m_AmountFilters
|
||||
};
|
||||
|
||||
private static readonly int[] m_XOffsets_Type = new int[] { 0, 75, 170 };
|
||||
private static readonly int[] m_XOffsets_Quality = new int[] { 0, 75, 170 };
|
||||
private static readonly int[] m_XOffsets_Amount = new int[] { 0, 75, 180, 275 };
|
||||
private static readonly int[] m_XOffsets_Material = new int[] { 0, 108, 212, 307, 392, 487 };
|
||||
private static readonly int[] m_XWidths_Small = new int[] { 50, 50, 70, 50 };
|
||||
private static readonly int[] m_XWidths_Large = new int[] { 80, 60, 60, 60, 60, 60 };
|
||||
|
||||
private const int LabelColor = 0x7FFF;
|
||||
private readonly PlayerMobile m_From;
|
||||
private readonly BulkOrderBook m_Book;
|
||||
|
||||
public BOBFilterGump(PlayerMobile from, BulkOrderBook book)
|
||||
: base(12, 24)
|
||||
{
|
||||
from.CloseGump(typeof(BOBGump));
|
||||
from.CloseGump(typeof(BOBFilterGump));
|
||||
|
||||
m_From = from;
|
||||
m_Book = book;
|
||||
|
||||
BOBFilter f = (from.UseOwnFilter ? from.BOBFilter : book.Filter);
|
||||
|
||||
AddPage(0);
|
||||
|
||||
AddBackground(10, 10, 600, 695, 5054);
|
||||
|
||||
AddImageTiled(18, 20, 583, 676, 2624);
|
||||
AddAlphaRegion(18, 20, 583, 676);
|
||||
|
||||
AddImage(5, 5, 10460);
|
||||
AddImage(585, 5, 10460);
|
||||
AddImage(5, 690, 10460);
|
||||
AddImage(585, 690, 10460);
|
||||
|
||||
AddHtmlLocalized(270, 32, 200, 32, 1062223, LabelColor, false, false); // Filter Preference
|
||||
|
||||
AddHtmlLocalized(26, 64, 120, 32, 1062228, LabelColor, false, false); // Bulk Order Type
|
||||
AddFilterList(25, 96, m_XOffsets_Type, 40, m_TypeFilters, m_XWidths_Small, f.Type, 0);
|
||||
|
||||
AddHtmlLocalized(320, 64, 50, 32, 1062215, LabelColor, false, false); // Quality
|
||||
AddFilterList(320, 96, m_XOffsets_Quality, 40, m_QualityFilters, m_XWidths_Small, f.Quality, 1);
|
||||
|
||||
AddHtmlLocalized(26, 130, 120, 32, 1062232, LabelColor, false, false); // Material Type
|
||||
AddFilterList(25, 162, m_XOffsets_Material, 35, BulkOrderSystem.NewSystemEnabled ? m_MaterialFiltersNew : m_MaterialFilters, m_XWidths_Large, f.Material, 2);
|
||||
|
||||
AddHtmlLocalized(26, 608, 120, 32, 1062217, LabelColor, false, false); // Amount
|
||||
AddFilterList(25, 640, m_XOffsets_Amount, 40, m_AmountFilters, m_XWidths_Small, f.Quantity, 3);
|
||||
|
||||
AddHtmlLocalized(75, 670, 120, 32, 1062477, (from.UseOwnFilter ? LabelColor : 16927), false, false); // Set Book Filter
|
||||
AddButton(40, 670, 4005, 4007, 1, GumpButtonType.Reply, 0);
|
||||
|
||||
AddHtmlLocalized(235, 670, 120, 32, 1062478, (from.UseOwnFilter ? 16927 : LabelColor), false, false); // Set Your Filter
|
||||
AddButton(200, 670, 4005, 4007, 2, GumpButtonType.Reply, 0);
|
||||
|
||||
AddHtmlLocalized(405, 670, 120, 32, 1062231, LabelColor, false, false); // Clear Filter
|
||||
AddButton(370, 670, 4005, 4007, 3, GumpButtonType.Reply, 0);
|
||||
|
||||
AddHtmlLocalized(540, 670, 50, 32, 1011046, LabelColor, false, false); // APPLY
|
||||
AddButton(505, 670, 4017, 4018, 0, GumpButtonType.Reply, 0);
|
||||
}
|
||||
|
||||
public override void OnResponse(Server.Network.NetState sender, RelayInfo info)
|
||||
{
|
||||
BOBFilter f = (m_From.UseOwnFilter ? m_From.BOBFilter : m_Book.Filter);
|
||||
|
||||
int index = info.ButtonID;
|
||||
|
||||
switch ( index )
|
||||
{
|
||||
case 0: // Apply
|
||||
{
|
||||
m_From.SendGump(new BOBGump(m_From, m_Book));
|
||||
|
||||
break;
|
||||
}
|
||||
case 1: // Set Book Filter
|
||||
{
|
||||
m_From.UseOwnFilter = false;
|
||||
m_From.SendGump(new BOBFilterGump(m_From, m_Book));
|
||||
|
||||
break;
|
||||
}
|
||||
case 2: // Set Your Filter
|
||||
{
|
||||
m_From.UseOwnFilter = true;
|
||||
m_From.SendGump(new BOBFilterGump(m_From, m_Book));
|
||||
|
||||
break;
|
||||
}
|
||||
case 3: // Clear Filter
|
||||
{
|
||||
f.Clear();
|
||||
m_From.SendGump(new BOBFilterGump(m_From, m_Book));
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
index -= 4;
|
||||
|
||||
int type = index % 4;
|
||||
index /= 4;
|
||||
|
||||
int[][,] filter = BulkOrderSystem.NewSystemEnabled ? m_FiltersNew : m_Filters;
|
||||
|
||||
if (type >= 0 && type < filter.Length)
|
||||
{
|
||||
int[,] filters = filter[type];
|
||||
|
||||
if (index >= 0 && index < filters.GetLength(0))
|
||||
{
|
||||
if (filters[index, 0] == 0)
|
||||
break;
|
||||
|
||||
switch ( type )
|
||||
{
|
||||
case 0:
|
||||
f.Type = filters[index, 1];
|
||||
break;
|
||||
case 1:
|
||||
f.Quality = filters[index, 1];
|
||||
break;
|
||||
case 2:
|
||||
f.Material = filters[index, 1];
|
||||
break;
|
||||
case 3:
|
||||
f.Quantity = filters[index, 1];
|
||||
break;
|
||||
}
|
||||
|
||||
m_From.SendGump(new BOBFilterGump(m_From, m_Book));
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void AddFilterList(int x, int y, int[] xOffsets, int yOffset, int[,] filters, int[] xWidths, int filterValue, int filterIndex)
|
||||
{
|
||||
for (int i = 0; i < filters.GetLength(0); ++i)
|
||||
{
|
||||
int number = filters[i, 0];
|
||||
|
||||
if (number == 0)
|
||||
continue;
|
||||
|
||||
bool isSelected = (filters[i, 1] == filterValue);
|
||||
|
||||
if (!isSelected && (i % xOffsets.Length) == 0)
|
||||
isSelected = (filterValue == 0);
|
||||
|
||||
AddHtmlLocalized(x + 35 + xOffsets[i % xOffsets.Length], y + ((i / xOffsets.Length) * yOffset), xWidths[i % xOffsets.Length], 32, number, isSelected ? 16927 : LabelColor, false, false);
|
||||
AddButton(x + xOffsets[i % xOffsets.Length], y + ((i / xOffsets.Length) * yOffset), 4005, 4007, 4 + filterIndex + (i * 4), GumpButtonType.Reply, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
848
Scripts/Services/BulkOrders/Books/BOBGump.cs
Normal file
848
Scripts/Services/BulkOrders/Books/BOBGump.cs
Normal file
@@ -0,0 +1,848 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using Server.Gumps;
|
||||
using Server.Items;
|
||||
using Server.Mobiles;
|
||||
using Server.Prompts;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
public class BOBGump : Gump
|
||||
{
|
||||
private const int LabelColor = 0x7FFF;
|
||||
private readonly PlayerMobile m_From;
|
||||
private readonly BulkOrderBook m_Book;
|
||||
private readonly ArrayList m_List;
|
||||
private int m_Page;
|
||||
public BOBGump(PlayerMobile from, BulkOrderBook book)
|
||||
: this(from, book, 0, null)
|
||||
{
|
||||
}
|
||||
|
||||
public BOBGump(PlayerMobile from, BulkOrderBook book, int page, ArrayList list)
|
||||
: base(12, 24)
|
||||
{
|
||||
from.CloseGump(typeof(BOBGump));
|
||||
from.CloseGump(typeof(BOBFilterGump));
|
||||
|
||||
m_From = from;
|
||||
m_Book = book;
|
||||
m_Page = page;
|
||||
|
||||
if (list == null)
|
||||
{
|
||||
list = new ArrayList(book.Entries.Count);
|
||||
|
||||
for (int i = 0; i < book.Entries.Count; ++i)
|
||||
{
|
||||
object obj = book.Entries[i];
|
||||
|
||||
if (CheckFilter(obj))
|
||||
list.Add(obj);
|
||||
}
|
||||
}
|
||||
|
||||
m_List = list;
|
||||
|
||||
int index = GetIndexForPage(page);
|
||||
int count = GetCountForIndex(index);
|
||||
|
||||
int tableIndex = 0;
|
||||
|
||||
PlayerVendor pv = book.RootParent as PlayerVendor;
|
||||
|
||||
bool canDrop = book.IsChildOf(from.Backpack);
|
||||
bool canBuy = (pv != null);
|
||||
bool canPrice = (canDrop || canBuy);
|
||||
|
||||
if (canBuy)
|
||||
{
|
||||
VendorItem vi = pv.GetVendorItem(book);
|
||||
|
||||
canBuy = (vi != null && !vi.IsForSale);
|
||||
}
|
||||
|
||||
int width = 600;
|
||||
|
||||
if (!canPrice)
|
||||
width = 516;
|
||||
|
||||
X = (624 - width) / 2;
|
||||
|
||||
AddPage(0);
|
||||
|
||||
AddBackground(10, 10, width, 439, 5054);
|
||||
AddImageTiled(18, 20, width - 17, 420, 2624);
|
||||
|
||||
if (canPrice)
|
||||
{
|
||||
AddImageTiled(573, 64, 24, 352, 200);
|
||||
AddImageTiled(493, 64, 78, 352, 1416);
|
||||
}
|
||||
|
||||
if (canDrop)
|
||||
AddImageTiled(24, 64, 32, 352, 1416);
|
||||
|
||||
AddImageTiled(58, 64, 36, 352, 200);
|
||||
AddImageTiled(96, 64, 133, 352, 1416);
|
||||
AddImageTiled(231, 64, 80, 352, 200);
|
||||
AddImageTiled(313, 64, 100, 352, 1416);
|
||||
AddImageTiled(415, 64, 76, 352, 200);
|
||||
|
||||
for (int i = index; i < (index + count) && i >= 0 && i < list.Count; ++i)
|
||||
{
|
||||
object obj = list[i];
|
||||
|
||||
if (!CheckFilter(obj))
|
||||
continue;
|
||||
|
||||
AddImageTiled(24, 94 + (tableIndex * 32), canPrice ? 573 : 489, 2, 2624);
|
||||
|
||||
if (obj is BOBLargeEntry)
|
||||
tableIndex += ((BOBLargeEntry)obj).Entries.Length;
|
||||
else if (obj is BOBSmallEntry)
|
||||
++tableIndex;
|
||||
}
|
||||
|
||||
AddAlphaRegion(18, 20, width - 17, 420);
|
||||
AddImage(5, 5, 10460);
|
||||
AddImage(width - 15, 5, 10460);
|
||||
AddImage(5, 424, 10460);
|
||||
AddImage(width - 15, 424, 10460);
|
||||
|
||||
AddHtmlLocalized(canPrice ? 266 : 224, 32, 200, 32, 1062220, LabelColor, false, false); // Bulk Order Book
|
||||
AddHtmlLocalized(63, 64, 70, 32, 1062213, LabelColor, false, false); // Type
|
||||
AddHtmlLocalized(147, 64, 70, 32, 1062214, LabelColor, false, false); // Item
|
||||
AddHtmlLocalized(246, 64, 70, 32, 1062215, LabelColor, false, false); // Quality
|
||||
AddHtmlLocalized(336, 64, 70, 32, 1062216, LabelColor, false, false); // Material
|
||||
AddHtmlLocalized(429, 64, 70, 32, 1062217, LabelColor, false, false); // Amount
|
||||
|
||||
AddButton(35, 32, 4005, 4007, 1, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(70, 32, 200, 32, 1062476, LabelColor, false, false); // Set Filter
|
||||
|
||||
BOBFilter f = (from.UseOwnFilter ? from.BOBFilter : book.Filter);
|
||||
|
||||
if (f.IsDefault)
|
||||
AddHtmlLocalized(canPrice ? 470 : 386, 32, 120, 32, 1062475, 16927, false, false); // Using No Filter
|
||||
else if (from.UseOwnFilter)
|
||||
AddHtmlLocalized(canPrice ? 470 : 386, 32, 120, 32, 1062451, 16927, false, false); // Using Your Filter
|
||||
else
|
||||
AddHtmlLocalized(canPrice ? 470 : 386, 32, 120, 32, 1062230, 16927, false, false); // Using Book Filter
|
||||
|
||||
AddButton(375, 416, 4017, 4018, 0, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(410, 416, 120, 20, 1011441, LabelColor, false, false); // EXIT
|
||||
|
||||
if (canDrop)
|
||||
AddHtmlLocalized(26, 64, 50, 32, 1062212, LabelColor, false, false); // Drop
|
||||
|
||||
if (canPrice)
|
||||
{
|
||||
AddHtmlLocalized(516, 64, 200, 32, 1062218, LabelColor, false, false); // Price
|
||||
|
||||
if (canBuy)
|
||||
{
|
||||
AddHtmlLocalized(576, 64, 200, 32, 1062219, LabelColor, false, false); // Buy
|
||||
}
|
||||
else
|
||||
{
|
||||
AddHtmlLocalized(576, 64, 200, 32, 1062227, LabelColor, false, false); // Set
|
||||
|
||||
AddButton(450, 416, 4005, 4007, 4, GumpButtonType.Reply, 0);
|
||||
AddHtml(485, 416, 120, 20, "<BASEFONT COLOR=#FFFFFF>Price all</FONT>", false, false);
|
||||
}
|
||||
}
|
||||
|
||||
tableIndex = 0;
|
||||
|
||||
if (page > 0)
|
||||
{
|
||||
AddButton(75, 416, 4014, 4016, 2, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(110, 416, 150, 20, 1011067, LabelColor, false, false); // Previous page
|
||||
}
|
||||
|
||||
if (GetIndexForPage(page + 1) < list.Count)
|
||||
{
|
||||
AddButton(225, 416, 4005, 4007, 3, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(260, 416, 150, 20, 1011066, LabelColor, false, false); // Next page
|
||||
}
|
||||
|
||||
for (int i = index; i < (index + count) && i >= 0 && i < list.Count; ++i)
|
||||
{
|
||||
object obj = list[i];
|
||||
|
||||
if (!CheckFilter(obj))
|
||||
continue;
|
||||
|
||||
if (obj is BOBLargeEntry)
|
||||
{
|
||||
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))
|
||||
{
|
||||
AddButton(579, y + 2, 2117, 2118, 6 + (i * 2), GumpButtonType.Reply, 0);
|
||||
AddLabel(495, y, 1152, e.Price.ToString());
|
||||
}
|
||||
|
||||
AddHtmlLocalized(61, y, 50, 32, 1062225, LabelColor, false, false); // Large
|
||||
|
||||
for (int j = 0; j < e.Entries.Length; ++j)
|
||||
{
|
||||
BOBLargeSubEntry sub = e.Entries[j];
|
||||
|
||||
AddHtmlLocalized(103, y, 130, 32, sub.Number, LabelColor, false, false);
|
||||
|
||||
if (e.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);
|
||||
|
||||
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);
|
||||
|
||||
AddLabel(421, y, 1152, String.Format("{0} / {1}", sub.AmountCur, e.AmountMax));
|
||||
|
||||
++tableIndex;
|
||||
y += 32;
|
||||
}
|
||||
}
|
||||
else if (obj is BOBSmallEntry)
|
||||
{
|
||||
BOBSmallEntry e = (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))
|
||||
{
|
||||
AddButton(579, y + 2, 2117, 2118, 6 + (i * 2), GumpButtonType.Reply, 0);
|
||||
AddLabel(495, y, 1152, e.Price.ToString());
|
||||
}
|
||||
|
||||
AddHtmlLocalized(61, y, 50, 32, 1062224, LabelColor, false, false); // Small
|
||||
|
||||
AddHtmlLocalized(103, y, 130, 32, e.Number, LabelColor, false, false);
|
||||
|
||||
if (e.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);
|
||||
|
||||
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);
|
||||
|
||||
AddLabel(421, y, 1152, String.Format("{0} / {1}", e.AmountCur, e.AmountMax));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Item Reconstruct(object obj)
|
||||
{
|
||||
Item item = null;
|
||||
|
||||
if (obj is BOBLargeEntry)
|
||||
item = ((BOBLargeEntry)obj).Reconstruct();
|
||||
else if (obj is BOBSmallEntry)
|
||||
item = ((BOBSmallEntry)obj).Reconstruct();
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
public bool CheckFilter(object obj)
|
||||
{
|
||||
if (obj is BOBLargeEntry)
|
||||
{
|
||||
BOBLargeEntry e = (BOBLargeEntry)obj;
|
||||
|
||||
return CheckFilter(e.Material, e.AmountMax, true, e.RequireExceptional, e.DeedType, (e.Entries.Length > 0 ? e.Entries[0].ItemType : null));
|
||||
}
|
||||
else if (obj is BOBSmallEntry)
|
||||
{
|
||||
BOBSmallEntry e = (BOBSmallEntry)obj;
|
||||
|
||||
return CheckFilter(e.Material, e.AmountMax, false, e.RequireExceptional, e.DeedType, e.ItemType);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool CheckFilter(BulkMaterialType mat, int amountMax, bool isLarge, bool reqExc, BODType deedType, Type itemType)
|
||||
{
|
||||
BOBFilter f = (m_From.UseOwnFilter ? m_From.BOBFilter : m_Book.Filter);
|
||||
|
||||
if (f.IsDefault)
|
||||
return true;
|
||||
|
||||
if (f.Quality == 1 && reqExc)
|
||||
return false;
|
||||
else if (f.Quality == 2 && !reqExc)
|
||||
return false;
|
||||
|
||||
if (f.Quantity == 1 && amountMax != 10)
|
||||
return false;
|
||||
else if (f.Quantity == 2 && amountMax != 15)
|
||||
return false;
|
||||
else if (f.Quantity == 3 && amountMax != 20)
|
||||
return false;
|
||||
|
||||
if (f.Type == 1 && isLarge)
|
||||
return false;
|
||||
else if (f.Type == 2 && !isLarge)
|
||||
return false;
|
||||
|
||||
if (BulkOrderSystem.NewSystemEnabled)
|
||||
{
|
||||
switch (f.Material)
|
||||
{
|
||||
default:
|
||||
case 0:
|
||||
return true;
|
||||
case 1:
|
||||
return deedType == BODType.Smith;
|
||||
case 2:
|
||||
return deedType == BODType.Tailor;
|
||||
case 3:
|
||||
return deedType == BODType.Tinkering;
|
||||
case 4:
|
||||
return deedType == BODType.Carpentry;
|
||||
case 5:
|
||||
return deedType == BODType.Fletching;
|
||||
case 6:
|
||||
return deedType == BODType.Alchemy;
|
||||
case 7:
|
||||
return deedType == BODType.Inscription;
|
||||
case 8:
|
||||
return deedType == BODType.Cooking;
|
||||
case 9:
|
||||
return (mat == BulkMaterialType.None && deedType == BODType.Smith);
|
||||
case 10:
|
||||
return (mat == BulkMaterialType.DullCopper && deedType == BODType.Smith);
|
||||
case 11:
|
||||
return (mat == BulkMaterialType.ShadowIron && deedType == BODType.Smith);
|
||||
case 12:
|
||||
return (mat == BulkMaterialType.Copper && deedType == BODType.Smith);
|
||||
case 13:
|
||||
return (mat == BulkMaterialType.Bronze && deedType == BODType.Smith);
|
||||
case 14:
|
||||
return (mat == BulkMaterialType.Gold && deedType == BODType.Smith);
|
||||
case 15:
|
||||
return (mat == BulkMaterialType.Agapite && deedType == BODType.Smith);
|
||||
case 16:
|
||||
return (mat == BulkMaterialType.Verite && deedType == BODType.Smith);
|
||||
case 17:
|
||||
return (mat == BulkMaterialType.Valorite && deedType == BODType.Smith);
|
||||
|
||||
case 18:
|
||||
return (mat == BulkMaterialType.None && BGTClassifier.Classify(deedType, itemType) == BulkGenericType.Cloth);
|
||||
case 19:
|
||||
return (mat == BulkMaterialType.None && BGTClassifier.Classify(deedType, itemType) == BulkGenericType.Leather);
|
||||
case 20:
|
||||
return (mat == BulkMaterialType.Spined && BGTClassifier.Classify(deedType, itemType) == BulkGenericType.Leather);
|
||||
case 21:
|
||||
return (mat == BulkMaterialType.Horned && BGTClassifier.Classify(deedType, itemType) == BulkGenericType.Leather);
|
||||
case 22:
|
||||
return (mat == BulkMaterialType.Barbed && BGTClassifier.Classify(deedType, itemType) == BulkGenericType.Leather);
|
||||
|
||||
case 23: // Tinkering
|
||||
return (mat == BulkMaterialType.None && deedType == BODType.Tinkering);
|
||||
case 24:
|
||||
return (mat == BulkMaterialType.DullCopper && deedType == BODType.Tinkering);
|
||||
case 25:
|
||||
return (mat == BulkMaterialType.ShadowIron && deedType == BODType.Tinkering);
|
||||
case 26:
|
||||
return (mat == BulkMaterialType.Copper && deedType == BODType.Tinkering);
|
||||
case 27:
|
||||
return (mat == BulkMaterialType.Bronze && deedType == BODType.Tinkering);
|
||||
case 28:
|
||||
return (mat == BulkMaterialType.Gold && deedType == BODType.Tinkering);
|
||||
case 29:
|
||||
return (mat == BulkMaterialType.Agapite && deedType == BODType.Tinkering);
|
||||
case 30:
|
||||
return (mat == BulkMaterialType.Verite && deedType == BODType.Tinkering);
|
||||
case 31:
|
||||
return (mat == BulkMaterialType.Valorite && deedType == BODType.Tinkering);
|
||||
|
||||
case 32: // Carpentry
|
||||
return (mat == BulkMaterialType.None && deedType == BODType.Carpentry);
|
||||
case 33:
|
||||
return (mat == BulkMaterialType.OakWood && deedType == BODType.Carpentry);
|
||||
case 34:
|
||||
return (mat == BulkMaterialType.AshWood && deedType == BODType.Carpentry);
|
||||
case 35:
|
||||
return (mat == BulkMaterialType.YewWood && deedType == BODType.Carpentry);
|
||||
case 36:
|
||||
return (mat == BulkMaterialType.Bloodwood && deedType == BODType.Carpentry);
|
||||
case 37:
|
||||
return (mat == BulkMaterialType.Heartwood && deedType == BODType.Carpentry);
|
||||
case 38:
|
||||
return (mat == BulkMaterialType.Frostwood && deedType == BODType.Carpentry);
|
||||
|
||||
case 39: // Fletching
|
||||
return (mat == BulkMaterialType.None && deedType == BODType.Fletching);
|
||||
case 40:
|
||||
return (mat == BulkMaterialType.OakWood && deedType == BODType.Fletching);
|
||||
case 41:
|
||||
return (mat == BulkMaterialType.AshWood && deedType == BODType.Fletching);
|
||||
case 42:
|
||||
return (mat == BulkMaterialType.YewWood && deedType == BODType.Fletching);
|
||||
case 43:
|
||||
return (mat == BulkMaterialType.Bloodwood && deedType == BODType.Fletching);
|
||||
case 44:
|
||||
return (mat == BulkMaterialType.Heartwood && deedType == BODType.Fletching);
|
||||
case 45:
|
||||
return (mat == BulkMaterialType.Frostwood && deedType == BODType.Fletching);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (f.Material)
|
||||
{
|
||||
default:
|
||||
case 0: return true;
|
||||
case 1: return (deedType == BODType.Smith);
|
||||
case 2: return (deedType == BODType.Tailor);
|
||||
|
||||
case 3: return (mat == BulkMaterialType.None && BGTClassifier.Classify(deedType, itemType) == BulkGenericType.Iron);
|
||||
case 4: return (mat == BulkMaterialType.DullCopper);
|
||||
case 5: return (mat == BulkMaterialType.ShadowIron);
|
||||
case 6: return (mat == BulkMaterialType.Copper);
|
||||
case 7: return (mat == BulkMaterialType.Bronze);
|
||||
case 8: return (mat == BulkMaterialType.Gold);
|
||||
case 9: return (mat == BulkMaterialType.Agapite);
|
||||
case 10: return (mat == BulkMaterialType.Verite);
|
||||
case 11: return (mat == BulkMaterialType.Valorite);
|
||||
|
||||
case 12: return (mat == BulkMaterialType.None && BGTClassifier.Classify(deedType, itemType) == BulkGenericType.Cloth);
|
||||
case 13: return (mat == BulkMaterialType.None && BGTClassifier.Classify(deedType, itemType) == BulkGenericType.Leather);
|
||||
case 14: return (mat == BulkMaterialType.Spined);
|
||||
case 15: return (mat == BulkMaterialType.Horned);
|
||||
case 16: return (mat == BulkMaterialType.Barbed);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int GetIndexForPage(int page)
|
||||
{
|
||||
int index = 0;
|
||||
|
||||
while (page-- > 0)
|
||||
index += GetCountForIndex(index);
|
||||
|
||||
return index;
|
||||
}
|
||||
|
||||
public int GetCountForIndex(int index)
|
||||
{
|
||||
int slots = 0;
|
||||
int count = 0;
|
||||
|
||||
ArrayList list = m_List;
|
||||
|
||||
for (int i = index; i >= 0 && i < list.Count; ++i)
|
||||
{
|
||||
object obj = list[i];
|
||||
|
||||
if (CheckFilter(obj))
|
||||
{
|
||||
int add;
|
||||
|
||||
if (obj is BOBLargeEntry)
|
||||
add = ((BOBLargeEntry)obj).Entries.Length;
|
||||
else
|
||||
add = 1;
|
||||
|
||||
if ((slots + add) > 10)
|
||||
break;
|
||||
|
||||
slots += add;
|
||||
}
|
||||
|
||||
++count;
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
public int GetPageForIndex(int index, int sizeDropped)
|
||||
{
|
||||
if (index <= 0)
|
||||
return 0;
|
||||
|
||||
int count = 0;
|
||||
int add = 0;
|
||||
int page = 0;
|
||||
ArrayList list = m_List;
|
||||
int i;
|
||||
object obj;
|
||||
|
||||
for (i = 0; (i < index) && (i < list.Count); i++)
|
||||
{
|
||||
obj = list[i];
|
||||
if (CheckFilter(obj))
|
||||
{
|
||||
if (obj is BOBLargeEntry)
|
||||
add = ((BOBLargeEntry)obj).Entries.Length;
|
||||
else
|
||||
add = 1;
|
||||
count += add;
|
||||
if (count > 10)
|
||||
{
|
||||
page++;
|
||||
count = add;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* now we are on the page of the bod preceeding the dropped one.
|
||||
* next step: checking whether we have to remain where we are.
|
||||
* The counter i needs to be incremented as the bod to this very moment
|
||||
* has not yet been removed from m_List */
|
||||
i++;
|
||||
|
||||
/* if, for instance, a big bod of size 6 has been removed, smaller bods
|
||||
* might fall back into this page. Depending on their sizes, the page eeds
|
||||
* to be adjusted accordingly. This is done now.
|
||||
*/
|
||||
if (count + sizeDropped > 10)
|
||||
{
|
||||
while ((i < list.Count) && (count <= 10))
|
||||
{
|
||||
obj = list[i];
|
||||
if (CheckFilter(obj))
|
||||
{
|
||||
if (obj is BOBLargeEntry)
|
||||
count += ((BOBLargeEntry)obj).Entries.Length;
|
||||
else
|
||||
count += 1;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
if (count > 10)
|
||||
page++;
|
||||
}
|
||||
return page;
|
||||
}
|
||||
|
||||
public object GetMaterialName(BulkMaterialType mat, BODType type, Type itemType)
|
||||
{
|
||||
switch ( type )
|
||||
{
|
||||
case BODType.Tinkering:
|
||||
case BODType.Smith:
|
||||
{
|
||||
if (type == BODType.Tinkering && mat == BulkMaterialType.None && BGTClassifier.Classify(type, itemType) == BulkGenericType.Wood)
|
||||
{
|
||||
return 1079435;
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (mat)
|
||||
{
|
||||
case BulkMaterialType.None:
|
||||
return 1062226;
|
||||
case BulkMaterialType.DullCopper:
|
||||
return 1018332;
|
||||
case BulkMaterialType.ShadowIron:
|
||||
return 1018333;
|
||||
case BulkMaterialType.Copper:
|
||||
return 1018334;
|
||||
case BulkMaterialType.Bronze:
|
||||
return 1018335;
|
||||
case BulkMaterialType.Gold:
|
||||
return 1018336;
|
||||
case BulkMaterialType.Agapite:
|
||||
return 1018337;
|
||||
case BulkMaterialType.Verite:
|
||||
return 1018338;
|
||||
case BulkMaterialType.Valorite:
|
||||
return 1018339;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case BODType.Tailor:
|
||||
{
|
||||
switch ( mat )
|
||||
{
|
||||
case BulkMaterialType.None:
|
||||
{
|
||||
if (itemType.IsSubclassOf(typeof(BaseArmor)) || itemType.IsSubclassOf(typeof(BaseShoes)))
|
||||
return 1062235;
|
||||
|
||||
return 1044286;
|
||||
}
|
||||
case BulkMaterialType.Spined:
|
||||
return 1062236;
|
||||
case BulkMaterialType.Horned:
|
||||
return 1062237;
|
||||
case BulkMaterialType.Barbed:
|
||||
return 1062238;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case BODType.Carpentry:
|
||||
case BODType.Fletching:
|
||||
{
|
||||
if (mat == BulkMaterialType.None)
|
||||
return 1079435;
|
||||
|
||||
switch (mat)
|
||||
{
|
||||
default:
|
||||
case BulkMaterialType.OakWood: return 1071428;
|
||||
case BulkMaterialType.AshWood: return 1071429;
|
||||
case BulkMaterialType.YewWood: return 1071430;
|
||||
case BulkMaterialType.Heartwood: return 1071432;
|
||||
case BulkMaterialType.Bloodwood: return 1071431;
|
||||
case BulkMaterialType.Frostwood: return 1071433;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
public override void OnResponse(Server.Network.NetState sender, RelayInfo info)
|
||||
{
|
||||
int index = info.ButtonID;
|
||||
|
||||
switch ( index )
|
||||
{
|
||||
case 0: // EXIT
|
||||
{
|
||||
break;
|
||||
}
|
||||
case 1: // Set Filter
|
||||
{
|
||||
m_From.SendGump(new BOBFilterGump(m_From, m_Book));
|
||||
|
||||
break;
|
||||
}
|
||||
case 2: // Previous page
|
||||
{
|
||||
if (m_Page > 0)
|
||||
m_From.SendGump(new BOBGump(m_From, m_Book, m_Page - 1, m_List));
|
||||
|
||||
return;
|
||||
}
|
||||
case 3: // Next page
|
||||
{
|
||||
if (GetIndexForPage(m_Page + 1) < m_List.Count)
|
||||
m_From.SendGump(new BOBGump(m_From, m_Book, m_Page + 1, m_List));
|
||||
|
||||
break;
|
||||
}
|
||||
case 4: // Price all
|
||||
{
|
||||
if (m_Book.IsChildOf(m_From.Backpack))
|
||||
{
|
||||
m_From.Prompt = new SetPricePrompt(m_Book, null, m_Page, m_List);
|
||||
m_From.SendMessage("Type in a price for all deeds in the book:");
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
bool canDrop = m_Book.IsChildOf(m_From.Backpack);
|
||||
bool canPrice = canDrop || (m_Book.RootParent is PlayerVendor);
|
||||
|
||||
index -= 5;
|
||||
|
||||
int type = index % 2;
|
||||
index /= 2;
|
||||
|
||||
if (index < 0 || index >= m_List.Count)
|
||||
break;
|
||||
|
||||
object obj = m_List[index];
|
||||
|
||||
if (!m_Book.Entries.Contains(obj))
|
||||
{
|
||||
m_From.SendLocalizedMessage(1062382); // The deed selected is not available.
|
||||
break;
|
||||
}
|
||||
|
||||
if (type == 0) // Drop
|
||||
{
|
||||
if (m_Book.IsChildOf(m_From.Backpack))
|
||||
{
|
||||
Item item = Reconstruct(obj);
|
||||
|
||||
if (item != null)
|
||||
{
|
||||
Container pack = m_From.Backpack;
|
||||
if ((pack == null) || ((pack != null) && (!pack.CheckHold(m_From, item, true, true, 0, item.PileWeight + item.TotalWeight))))
|
||||
{
|
||||
m_From.SendLocalizedMessage(503204); // You do not have room in your backpack for this
|
||||
m_From.SendGump(new BOBGump(m_From, m_Book, m_Page, null));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_Book.IsChildOf(m_From.Backpack))
|
||||
{
|
||||
int sizeOfDroppedBod;
|
||||
if (obj is BOBLargeEntry)
|
||||
sizeOfDroppedBod = ((BOBLargeEntry)obj).Entries.Length;
|
||||
else
|
||||
sizeOfDroppedBod = 1;
|
||||
|
||||
m_From.AddToBackpack(item);
|
||||
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);
|
||||
m_From.SendGump(new BOBGump(m_From, m_Book, m_Page, null));
|
||||
}
|
||||
else
|
||||
m_From.SendLocalizedMessage(1062381); // The book is empty.
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_From.SendMessage("Internal error. The bulk order deed could not be reconstructed.");
|
||||
}
|
||||
}
|
||||
}
|
||||
else // Set Price | Buy
|
||||
{
|
||||
if (m_Book.IsChildOf(m_From.Backpack))
|
||||
{
|
||||
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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
price = ((BOBLargeEntry)obj).Price;
|
||||
sizeOfDroppedBod = ((BOBLargeEntry)obj).Entries.Length;
|
||||
}
|
||||
else
|
||||
{
|
||||
price = ((BOBSmallEntry)obj).Price;
|
||||
sizeOfDroppedBod = 1;
|
||||
}
|
||||
if (price == 0)
|
||||
m_From.SendLocalizedMessage(1062382); // The deed selected is not available.
|
||||
else
|
||||
{
|
||||
if (m_Book.Entries.Count > 0)
|
||||
{
|
||||
m_Page = GetPageForIndex(index, sizeOfDroppedBod);
|
||||
m_From.SendGump(new BODBuyGump(m_From, m_Book, obj, m_Page, price));
|
||||
}
|
||||
else
|
||||
m_From.SendLocalizedMessage(1062381); // The book is emptz
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class SetPricePrompt : Prompt
|
||||
{
|
||||
public override int MessageCliloc { get { return 1062383; } }
|
||||
private readonly BulkOrderBook m_Book;
|
||||
private readonly object m_Object;
|
||||
private readonly int m_Page;
|
||||
private readonly ArrayList m_List;
|
||||
public SetPricePrompt(BulkOrderBook book, object obj, int page, ArrayList list)
|
||||
{
|
||||
m_Book = book;
|
||||
m_Object = obj;
|
||||
m_Page = page;
|
||||
m_List = list;
|
||||
}
|
||||
|
||||
public override void OnResponse(Mobile from, string text)
|
||||
{
|
||||
if (m_Object != null && !m_Book.Entries.Contains(m_Object))
|
||||
{
|
||||
from.SendLocalizedMessage(1062382); // The deed selected is not available.
|
||||
return;
|
||||
}
|
||||
|
||||
int price = Utility.ToInt32(text);
|
||||
|
||||
if (price < 0 || price > 250000000)
|
||||
{
|
||||
from.SendLocalizedMessage(1062390); // The price you requested is outrageous!
|
||||
}
|
||||
else if (m_Object == null)
|
||||
{
|
||||
for (int i = 0; i < m_List.Count; ++i)
|
||||
{
|
||||
object obj = m_List[i];
|
||||
|
||||
if (!m_Book.Entries.Contains(obj))
|
||||
continue;
|
||||
|
||||
if (obj is BOBLargeEntry)
|
||||
((BOBLargeEntry)obj).Price = price;
|
||||
else if (obj is BOBSmallEntry)
|
||||
((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));
|
||||
}
|
||||
else if (m_Object is BOBLargeEntry)
|
||||
{
|
||||
((BOBLargeEntry)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));
|
||||
}
|
||||
else if (m_Object is BOBSmallEntry)
|
||||
{
|
||||
((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));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
179
Scripts/Services/BulkOrders/Books/BOBLargeEntry.cs
Normal file
179
Scripts/Services/BulkOrders/Books/BOBLargeEntry.cs
Normal file
@@ -0,0 +1,179 @@
|
||||
using System;
|
||||
using Server.Items;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
public class BOBLargeEntry
|
||||
{
|
||||
private readonly bool m_RequireExceptional;
|
||||
private readonly BODType m_DeedType;
|
||||
private readonly BulkMaterialType m_Material;
|
||||
private readonly int m_AmountMax;
|
||||
private readonly BOBLargeSubEntry[] m_Entries;
|
||||
private int m_Price;
|
||||
|
||||
private GemType m_GemType;
|
||||
|
||||
public BOBLargeEntry(LargeBOD bod)
|
||||
{
|
||||
m_RequireExceptional = bod.RequireExceptional;
|
||||
|
||||
m_DeedType = bod.BODType;
|
||||
|
||||
m_Material = bod.Material;
|
||||
m_AmountMax = bod.AmountMax;
|
||||
|
||||
m_Entries = new BOBLargeSubEntry[bod.Entries.Length];
|
||||
|
||||
for (int i = 0; i < m_Entries.Length; ++i)
|
||||
m_Entries[i] = new BOBLargeSubEntry(bod.Entries[i]);
|
||||
|
||||
if (bod is LargeTinkerBOD)
|
||||
{
|
||||
m_GemType = ((LargeTinkerBOD)bod).GemType;
|
||||
}
|
||||
}
|
||||
|
||||
public BOBLargeEntry(GenericReader reader)
|
||||
{
|
||||
int version = reader.ReadEncodedInt();
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
m_GemType = (GemType)reader.ReadInt();
|
||||
goto case 0;
|
||||
}
|
||||
case 0:
|
||||
{
|
||||
m_RequireExceptional = reader.ReadBool();
|
||||
|
||||
m_DeedType = (BODType)reader.ReadEncodedInt();
|
||||
|
||||
m_Material = (BulkMaterialType)reader.ReadEncodedInt();
|
||||
m_AmountMax = reader.ReadEncodedInt();
|
||||
m_Price = reader.ReadEncodedInt();
|
||||
|
||||
m_Entries = new BOBLargeSubEntry[reader.ReadEncodedInt()];
|
||||
|
||||
for (int i = 0; i < m_Entries.Length; ++i)
|
||||
m_Entries[i] = new BOBLargeSubEntry(reader);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool RequireExceptional
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_RequireExceptional;
|
||||
}
|
||||
}
|
||||
public BODType DeedType
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_DeedType;
|
||||
}
|
||||
}
|
||||
public BulkMaterialType Material
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Material;
|
||||
}
|
||||
}
|
||||
public int AmountMax
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_AmountMax;
|
||||
}
|
||||
}
|
||||
public int Price
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Price;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_Price = value;
|
||||
}
|
||||
}
|
||||
public GemType GemType
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_GemType;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_GemType = value;
|
||||
}
|
||||
}
|
||||
public BOBLargeSubEntry[] Entries
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Entries;
|
||||
}
|
||||
}
|
||||
public Item Reconstruct()
|
||||
{
|
||||
LargeBOD bod = null;
|
||||
|
||||
switch (m_DeedType)
|
||||
{
|
||||
case BODType.Smith: bod = new LargeSmithBOD(m_AmountMax, m_RequireExceptional, m_Material, ReconstructEntries()); break;
|
||||
case BODType.Tailor: bod = new LargeTailorBOD(m_AmountMax, m_RequireExceptional, m_Material, ReconstructEntries()); break;
|
||||
case BODType.Inscription: bod = new LargeInscriptionBOD(m_AmountMax, m_RequireExceptional, m_Material, ReconstructEntries()); break;
|
||||
case BODType.Alchemy: bod = new LargeAlchemyBOD(m_AmountMax, m_RequireExceptional, m_Material, ReconstructEntries()); break;
|
||||
case BODType.Carpentry: bod = new LargeCarpentryBOD(m_AmountMax, m_RequireExceptional, m_Material, ReconstructEntries()); break;
|
||||
case BODType.Fletching: bod = new LargeFletchingBOD(m_AmountMax, m_RequireExceptional, m_Material, ReconstructEntries()); break;
|
||||
case BODType.Tinkering: bod = new LargeTinkerBOD(m_AmountMax, m_RequireExceptional, m_Material, ReconstructEntries(), m_GemType); break;
|
||||
case BODType.Cooking: bod = new LargeCookingBOD(m_AmountMax, m_RequireExceptional, m_Material, ReconstructEntries()); break;
|
||||
}
|
||||
|
||||
for (int i = 0; bod != null && i < bod.Entries.Length; ++i)
|
||||
bod.Entries[i].Owner = bod;
|
||||
|
||||
return bod;
|
||||
}
|
||||
|
||||
public void Serialize(GenericWriter writer)
|
||||
{
|
||||
writer.WriteEncodedInt(1); // version
|
||||
|
||||
writer.Write((int)m_GemType);
|
||||
|
||||
writer.Write((bool)m_RequireExceptional);
|
||||
|
||||
writer.WriteEncodedInt((int)m_DeedType);
|
||||
writer.WriteEncodedInt((int)m_Material);
|
||||
writer.WriteEncodedInt((int)m_AmountMax);
|
||||
writer.WriteEncodedInt((int)m_Price);
|
||||
|
||||
writer.WriteEncodedInt((int)m_Entries.Length);
|
||||
|
||||
for (int i = 0; i < m_Entries.Length; ++i)
|
||||
m_Entries[i].Serialize(writer);
|
||||
}
|
||||
|
||||
private LargeBulkEntry[] ReconstructEntries()
|
||||
{
|
||||
LargeBulkEntry[] entries = new LargeBulkEntry[m_Entries.Length];
|
||||
|
||||
for (int i = 0; i < m_Entries.Length; ++i)
|
||||
{
|
||||
entries[i] = new LargeBulkEntry(null, new SmallBulkEntry(m_Entries[i].ItemType, m_Entries[i].Number, m_Entries[i].Graphic, m_Entries[i].Hue));
|
||||
entries[i].Amount = m_Entries[i].AmountCur;
|
||||
}
|
||||
|
||||
return entries;
|
||||
}
|
||||
}
|
||||
}
|
||||
97
Scripts/Services/BulkOrders/Books/BOBLargeSubEntry.cs
Normal file
97
Scripts/Services/BulkOrders/Books/BOBLargeSubEntry.cs
Normal file
@@ -0,0 +1,97 @@
|
||||
using System;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
public class BOBLargeSubEntry
|
||||
{
|
||||
private readonly Type m_ItemType;
|
||||
private readonly int m_AmountCur;
|
||||
private readonly int m_Number;
|
||||
private readonly int m_Graphic;
|
||||
private readonly int m_Hue;
|
||||
|
||||
public BOBLargeSubEntry(LargeBulkEntry lbe)
|
||||
{
|
||||
m_ItemType = lbe.Details.Type;
|
||||
m_AmountCur = lbe.Amount;
|
||||
m_Number = lbe.Details.Number;
|
||||
m_Graphic = lbe.Details.Graphic;
|
||||
m_Hue = lbe.Details.Hue;
|
||||
}
|
||||
|
||||
public BOBLargeSubEntry(GenericReader reader)
|
||||
{
|
||||
int version = reader.ReadEncodedInt();
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
m_Hue = reader.ReadEncodedInt();
|
||||
goto case 0;
|
||||
}
|
||||
case 0:
|
||||
{
|
||||
string type = reader.ReadString();
|
||||
|
||||
if (type != null)
|
||||
m_ItemType = ScriptCompiler.FindTypeByFullName(type);
|
||||
|
||||
m_AmountCur = reader.ReadEncodedInt();
|
||||
m_Number = reader.ReadEncodedInt();
|
||||
m_Graphic = reader.ReadEncodedInt();
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Type ItemType
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_ItemType;
|
||||
}
|
||||
}
|
||||
public int AmountCur
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_AmountCur;
|
||||
}
|
||||
}
|
||||
public int Number
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Number;
|
||||
}
|
||||
}
|
||||
public int Graphic
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Graphic;
|
||||
}
|
||||
}
|
||||
public int Hue
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Hue;
|
||||
}
|
||||
}
|
||||
public void Serialize(GenericWriter writer)
|
||||
{
|
||||
writer.WriteEncodedInt(1); // version
|
||||
|
||||
writer.WriteEncodedInt((int)m_Hue);
|
||||
|
||||
writer.Write(m_ItemType == null ? null : m_ItemType.FullName);
|
||||
|
||||
writer.WriteEncodedInt((int)m_AmountCur);
|
||||
writer.WriteEncodedInt((int)m_Number);
|
||||
writer.WriteEncodedInt((int)m_Graphic);
|
||||
}
|
||||
}
|
||||
}
|
||||
201
Scripts/Services/BulkOrders/Books/BOBSmallEntry.cs
Normal file
201
Scripts/Services/BulkOrders/Books/BOBSmallEntry.cs
Normal file
@@ -0,0 +1,201 @@
|
||||
using System;
|
||||
using Server.Items;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
public class BOBSmallEntry
|
||||
{
|
||||
private readonly Type m_ItemType;
|
||||
private readonly bool m_RequireExceptional;
|
||||
private readonly BODType m_DeedType;
|
||||
private readonly BulkMaterialType m_Material;
|
||||
private readonly int m_AmountCur;
|
||||
private readonly int m_AmountMax;
|
||||
private readonly int m_Number;
|
||||
private readonly int m_Graphic;
|
||||
private readonly int m_Hue;
|
||||
private readonly GemType m_GemType;
|
||||
|
||||
private int m_Price;
|
||||
|
||||
public BOBSmallEntry(SmallBOD bod)
|
||||
{
|
||||
m_ItemType = bod.Type;
|
||||
m_RequireExceptional = bod.RequireExceptional;
|
||||
|
||||
m_DeedType = bod.BODType;
|
||||
|
||||
m_Material = bod.Material;
|
||||
m_AmountCur = bod.AmountCur;
|
||||
m_AmountMax = bod.AmountMax;
|
||||
m_Number = bod.Number;
|
||||
m_Graphic = bod.Graphic;
|
||||
m_Hue = bod.GraphicHue;
|
||||
|
||||
if (bod is SmallTinkerBOD)
|
||||
{
|
||||
m_GemType = ((SmallTinkerBOD)bod).GemType;
|
||||
}
|
||||
}
|
||||
|
||||
public BOBSmallEntry(GenericReader reader)
|
||||
{
|
||||
int version = reader.ReadEncodedInt();
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 2:
|
||||
{
|
||||
m_GemType = (GemType)reader.ReadInt();
|
||||
goto case 1;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
m_Hue = reader.ReadInt();
|
||||
goto case 0;
|
||||
}
|
||||
case 0:
|
||||
{
|
||||
string type = reader.ReadString();
|
||||
|
||||
if (type != null)
|
||||
m_ItemType = ScriptCompiler.FindTypeByFullName(type);
|
||||
|
||||
m_RequireExceptional = reader.ReadBool();
|
||||
|
||||
m_DeedType = (BODType)reader.ReadEncodedInt();
|
||||
|
||||
m_Material = (BulkMaterialType)reader.ReadEncodedInt();
|
||||
m_AmountCur = reader.ReadEncodedInt();
|
||||
m_AmountMax = reader.ReadEncodedInt();
|
||||
m_Number = reader.ReadEncodedInt();
|
||||
m_Graphic = reader.ReadEncodedInt();
|
||||
m_Price = reader.ReadEncodedInt();
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Type ItemType
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_ItemType;
|
||||
}
|
||||
}
|
||||
public bool RequireExceptional
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_RequireExceptional;
|
||||
}
|
||||
}
|
||||
public BODType DeedType
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_DeedType;
|
||||
}
|
||||
}
|
||||
public BulkMaterialType Material
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Material;
|
||||
}
|
||||
}
|
||||
public int AmountCur
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_AmountCur;
|
||||
}
|
||||
}
|
||||
public int AmountMax
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_AmountMax;
|
||||
}
|
||||
}
|
||||
public int Number
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Number;
|
||||
}
|
||||
}
|
||||
public int Graphic
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Graphic;
|
||||
}
|
||||
}
|
||||
public int Hue
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Hue;
|
||||
}
|
||||
}
|
||||
public GemType GemType
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_GemType;
|
||||
}
|
||||
}
|
||||
public int Price
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Price;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_Price = value;
|
||||
}
|
||||
}
|
||||
public Item Reconstruct()
|
||||
{
|
||||
SmallBOD bod = null;
|
||||
|
||||
switch (m_DeedType)
|
||||
{
|
||||
case BODType.Smith: bod = new SmallSmithBOD(m_AmountCur, m_AmountMax, m_ItemType, m_Number, m_Graphic, m_RequireExceptional, m_Material, m_Hue); break;
|
||||
case BODType.Tailor: bod = new SmallTailorBOD(m_AmountCur, m_AmountMax, m_ItemType, m_Number, m_Graphic, m_RequireExceptional, m_Material, m_Hue); break;
|
||||
case BODType.Inscription: bod = new SmallInscriptionBOD(m_AmountCur, m_AmountMax, m_ItemType, m_Number, m_Graphic, m_RequireExceptional, m_Material, m_Hue); break;
|
||||
case BODType.Alchemy: bod = new SmallAlchemyBOD(m_AmountCur, m_AmountMax, m_ItemType, m_Number, m_Graphic, m_RequireExceptional, m_Material, m_Hue); break;
|
||||
case BODType.Carpentry: bod = new SmallCarpentryBOD(m_AmountCur, m_AmountMax, m_ItemType, m_Number, m_Graphic, m_RequireExceptional, m_Material, m_Hue); break;
|
||||
case BODType.Fletching: bod = new SmallFletchingBOD(m_AmountCur, m_AmountMax, m_ItemType, m_Number, m_Graphic, m_RequireExceptional, m_Material, m_Hue); break;
|
||||
case BODType.Tinkering: bod = new SmallTinkerBOD(m_AmountCur, m_AmountMax, m_ItemType, m_Number, m_Graphic, m_RequireExceptional, m_Material, m_Hue, m_GemType); break;
|
||||
case BODType.Cooking: bod = new SmallCookingBOD(m_AmountCur, m_AmountMax, m_ItemType, m_Number, m_Graphic, m_RequireExceptional, m_Material, m_Hue); break;
|
||||
}
|
||||
|
||||
return bod;
|
||||
}
|
||||
|
||||
public void Serialize(GenericWriter writer)
|
||||
{
|
||||
writer.WriteEncodedInt(2); // version
|
||||
|
||||
writer.Write((int)m_GemType);
|
||||
|
||||
writer.Write(m_Hue);
|
||||
|
||||
writer.Write(m_ItemType == null ? null : m_ItemType.FullName);
|
||||
|
||||
writer.Write((bool)m_RequireExceptional);
|
||||
|
||||
writer.WriteEncodedInt((int)m_DeedType);
|
||||
writer.WriteEncodedInt((int)m_Material);
|
||||
writer.WriteEncodedInt((int)m_AmountCur);
|
||||
writer.WriteEncodedInt((int)m_AmountMax);
|
||||
writer.WriteEncodedInt((int)m_Number);
|
||||
writer.WriteEncodedInt((int)m_Graphic);
|
||||
writer.WriteEncodedInt((int)m_Price);
|
||||
}
|
||||
}
|
||||
}
|
||||
137
Scripts/Services/BulkOrders/Books/BODBuyGump.cs
Normal file
137
Scripts/Services/BulkOrders/Books/BODBuyGump.cs
Normal file
@@ -0,0 +1,137 @@
|
||||
using System;
|
||||
using Server.Gumps;
|
||||
using Server.Items;
|
||||
using Server.Mobiles;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
public class BODBuyGump : Gump
|
||||
{
|
||||
private readonly PlayerMobile m_From;
|
||||
private readonly BulkOrderBook m_Book;
|
||||
private readonly object m_Object;
|
||||
private readonly int m_Price;
|
||||
private readonly int m_Page;
|
||||
public BODBuyGump(PlayerMobile from, BulkOrderBook book, object obj, int page, int price)
|
||||
: base(100, 200)
|
||||
{
|
||||
this.m_From = from;
|
||||
this.m_Book = book;
|
||||
this.m_Object = obj;
|
||||
this.m_Price = price;
|
||||
this.m_Page = page;
|
||||
|
||||
this.AddPage(0);
|
||||
|
||||
this.AddBackground(100, 10, 300, 150, 5054);
|
||||
|
||||
this.AddHtmlLocalized(125, 20, 250, 24, 1019070, false, false); // You have agreed to purchase:
|
||||
this.AddHtmlLocalized(125, 45, 250, 24, 1045151, false, false); // a bulk order deed
|
||||
|
||||
this.AddHtmlLocalized(125, 70, 250, 24, 1019071, false, false); // for the amount of:
|
||||
this.AddLabel(125, 95, 0, price.ToString());
|
||||
|
||||
this.AddButton(250, 130, 4005, 4007, 1, GumpButtonType.Reply, 0);
|
||||
this.AddHtmlLocalized(282, 130, 100, 24, 1011012, false, false); // CANCEL
|
||||
|
||||
this.AddButton(120, 130, 4005, 4007, 2, GumpButtonType.Reply, 0);
|
||||
this.AddHtmlLocalized(152, 130, 100, 24, 1011036, false, false); // OKAY
|
||||
}
|
||||
|
||||
public override void OnResponse(Server.Network.NetState sender, RelayInfo info)
|
||||
{
|
||||
if (info.ButtonID == 2)
|
||||
{
|
||||
PlayerVendor pv = this.m_Book.RootParent as PlayerVendor;
|
||||
|
||||
if (this.m_Book.Entries.Contains(this.m_Object) && pv != null)
|
||||
{
|
||||
int price = 0;
|
||||
|
||||
VendorItem vi = pv.GetVendorItem(this.m_Book);
|
||||
|
||||
if (vi != null && !vi.IsForSale)
|
||||
{
|
||||
if (this.m_Object is BOBLargeEntry)
|
||||
price = ((BOBLargeEntry)this.m_Object).Price;
|
||||
else if (this.m_Object is BOBSmallEntry)
|
||||
price = ((BOBSmallEntry)this.m_Object).Price;
|
||||
}
|
||||
|
||||
if (price != this.m_Price)
|
||||
{
|
||||
pv.SayTo(this.m_From, "The price has been been changed. If you like, you may offer to purchase the item again.");
|
||||
}
|
||||
else if (price == 0)
|
||||
{
|
||||
pv.SayTo(this.m_From, 1062382); // The deed selected is not available.
|
||||
}
|
||||
else
|
||||
{
|
||||
Item item = null;
|
||||
|
||||
if (this.m_Object is BOBLargeEntry)
|
||||
item = ((BOBLargeEntry)this.m_Object).Reconstruct();
|
||||
else if (this.m_Object is BOBSmallEntry)
|
||||
item = ((BOBSmallEntry)this.m_Object).Reconstruct();
|
||||
|
||||
if (item == null)
|
||||
{
|
||||
this.m_From.SendMessage("Internal error. The bulk order deed could not be reconstructed.");
|
||||
}
|
||||
else
|
||||
{
|
||||
pv.Say(this.m_From.Name);
|
||||
|
||||
Container pack = this.m_From.Backpack;
|
||||
|
||||
if ((pack == null) || ((pack != null) && (!pack.CheckHold(this.m_From, item, true, true, 0, item.PileWeight + item.TotalWeight))))
|
||||
{
|
||||
pv.SayTo(this.m_From, 503204); // You do not have room in your backpack for this
|
||||
this.m_From.SendGump(new BOBGump(this.m_From, this.m_Book, this.m_Page, null));
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((pack != null && pack.ConsumeTotal(typeof(Gold), price)) || Banker.Withdraw(this.m_From, price))
|
||||
{
|
||||
this.m_Book.Entries.Remove(this.m_Object);
|
||||
this.m_Book.InvalidateProperties();
|
||||
pv.HoldGold += price;
|
||||
this.m_From.AddToBackpack(item);
|
||||
this.m_From.SendLocalizedMessage(1045152); // The bulk order deed has been placed in your backpack.
|
||||
|
||||
if (this.m_Book.Entries.Count / 5 < this.m_Book.ItemCount)
|
||||
{
|
||||
this.m_Book.ItemCount--;
|
||||
this.m_Book.InvalidateItems();
|
||||
}
|
||||
|
||||
if (this.m_Book.Entries.Count > 0)
|
||||
this.m_From.SendGump(new BOBGump(this.m_From, this.m_Book, this.m_Page, null));
|
||||
else
|
||||
this.m_From.SendLocalizedMessage(1062381); // The book is empty.
|
||||
}
|
||||
else
|
||||
{
|
||||
pv.SayTo(this.m_From, 503205); // You cannot afford this item.
|
||||
item.Delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (pv == null)
|
||||
this.m_From.SendLocalizedMessage(1062382); // The deed selected is not available.
|
||||
else
|
||||
pv.SayTo(this.m_From, 1062382); // The deed selected is not available.
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.m_From.SendLocalizedMessage(503207); // Cancelled purchase.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
16
Scripts/Services/BulkOrders/Books/BODType.cs
Normal file
16
Scripts/Services/BulkOrders/Books/BODType.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using System;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
public enum BODType
|
||||
{
|
||||
Smith,
|
||||
Tailor,
|
||||
Alchemy,
|
||||
Inscription,
|
||||
Tinkering,
|
||||
Fletching,
|
||||
Carpentry,
|
||||
Cooking
|
||||
}
|
||||
}
|
||||
358
Scripts/Services/BulkOrders/Books/BulkOrderBook.cs
Normal file
358
Scripts/Services/BulkOrders/Books/BulkOrderBook.cs
Normal file
@@ -0,0 +1,358 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Server.ContextMenus;
|
||||
using Server.Gumps;
|
||||
using Server.Items;
|
||||
using Server.Mobiles;
|
||||
using Server.Multis;
|
||||
using Server.Prompts;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
public class BulkOrderBook : Item, ISecurable
|
||||
{
|
||||
private ArrayList m_Entries;
|
||||
private BOBFilter m_Filter;
|
||||
private string m_BookName;
|
||||
private SecureLevel m_Level;
|
||||
private int m_ItemCount;
|
||||
[Constructable]
|
||||
public BulkOrderBook()
|
||||
: base(0x2259)
|
||||
{
|
||||
this.Weight = 1.0;
|
||||
this.LootType = LootType.Blessed;
|
||||
|
||||
this.m_Entries = new ArrayList();
|
||||
this.m_Filter = new BOBFilter();
|
||||
|
||||
this.m_Level = SecureLevel.CoOwners;
|
||||
}
|
||||
|
||||
public BulkOrderBook(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public string BookName
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.m_BookName;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.m_BookName = value;
|
||||
this.InvalidateProperties();
|
||||
}
|
||||
}
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public SecureLevel Level
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.m_Level;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.m_Level = value;
|
||||
}
|
||||
}
|
||||
public ArrayList Entries
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.m_Entries;
|
||||
}
|
||||
}
|
||||
public BOBFilter Filter
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.m_Filter;
|
||||
}
|
||||
}
|
||||
public int ItemCount
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.m_ItemCount;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.m_ItemCount = value;
|
||||
}
|
||||
}
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
if (!from.InRange(this.GetWorldLocation(), 2))
|
||||
from.LocalOverheadMessage(Network.MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
|
||||
else if (this.m_Entries.Count == 0)
|
||||
from.SendLocalizedMessage(1062381); // The book is empty.
|
||||
else if (from is PlayerMobile)
|
||||
from.SendGump(new BOBGump((PlayerMobile)from, this));
|
||||
}
|
||||
|
||||
public override void OnDoubleClickSecureTrade(Mobile from)
|
||||
{
|
||||
if (!from.InRange(this.GetWorldLocation(), 2))
|
||||
{
|
||||
from.SendLocalizedMessage(500446); // That is too far away.
|
||||
}
|
||||
else if (this.m_Entries.Count == 0)
|
||||
{
|
||||
from.SendLocalizedMessage(1062381); // The book is empty.
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendGump(new BOBGump((PlayerMobile)from, this));
|
||||
|
||||
SecureTradeContainer cont = this.GetSecureTradeCont();
|
||||
|
||||
if (cont != null)
|
||||
{
|
||||
SecureTrade trade = cont.Trade;
|
||||
|
||||
if (trade != null && trade.From.Mobile == from)
|
||||
trade.To.Mobile.SendGump(new BOBGump((PlayerMobile)(trade.To.Mobile), this));
|
||||
else if (trade != null && 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 LargeBOD || dropped is SmallBOD)
|
||||
{
|
||||
if (!this.IsChildOf(from.Backpack))
|
||||
{
|
||||
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))
|
||||
return false;
|
||||
else if (this.m_Entries.Count < 500)
|
||||
{
|
||||
if (dropped is LargeBOD)
|
||||
this.m_Entries.Add(new BOBLargeEntry((LargeBOD)dropped));
|
||||
else if (dropped is SmallBOD) // Sanity
|
||||
this.m_Entries.Add(new BOBSmallEntry((SmallBOD)dropped));
|
||||
|
||||
this.InvalidateProperties();
|
||||
|
||||
if (this.m_Entries.Count / 5 > this.m_ItemCount)
|
||||
{
|
||||
this.m_ItemCount++;
|
||||
this.InvalidateItems();
|
||||
}
|
||||
|
||||
from.SendSound(0x42, this.GetWorldLocation());
|
||||
from.SendLocalizedMessage(1062386); // Deed added to book.
|
||||
|
||||
if (from is PlayerMobile)
|
||||
from.SendGump(new BOBGump((PlayerMobile)from, this));
|
||||
|
||||
dropped.Delete();
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
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 = this.m_ItemCount;
|
||||
|
||||
return total;
|
||||
}
|
||||
|
||||
public void InvalidateItems()
|
||||
{
|
||||
if (this.RootParent is Mobile)
|
||||
{
|
||||
Mobile m = (Mobile)this.RootParent;
|
||||
|
||||
m.UpdateTotals();
|
||||
this.InvalidateContainers(this.Parent);
|
||||
}
|
||||
}
|
||||
|
||||
public void InvalidateContainers(object parent)
|
||||
{
|
||||
if (parent != null && parent is Container)
|
||||
{
|
||||
Container c = (Container)parent;
|
||||
|
||||
c.InvalidateProperties();
|
||||
this.InvalidateContainers(c.Parent);
|
||||
}
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write((int)2); // version
|
||||
|
||||
writer.Write((int)this.m_ItemCount);
|
||||
|
||||
writer.Write((int)this.m_Level);
|
||||
|
||||
writer.Write(this.m_BookName);
|
||||
|
||||
this.m_Filter.Serialize(writer);
|
||||
|
||||
writer.WriteEncodedInt((int)this.m_Entries.Count);
|
||||
|
||||
for (int i = 0; i < this.m_Entries.Count; ++i)
|
||||
{
|
||||
object obj = this.m_Entries[i];
|
||||
|
||||
if (obj is BOBLargeEntry)
|
||||
{
|
||||
writer.WriteEncodedInt(0);
|
||||
((BOBLargeEntry)obj).Serialize(writer);
|
||||
}
|
||||
else if (obj is BOBSmallEntry)
|
||||
{
|
||||
writer.WriteEncodedInt(1);
|
||||
((BOBSmallEntry)obj).Serialize(writer);
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.WriteEncodedInt(-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 2:
|
||||
{
|
||||
this.m_ItemCount = reader.ReadInt();
|
||||
goto case 1;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
this.m_Level = (SecureLevel)reader.ReadInt();
|
||||
goto case 0;
|
||||
}
|
||||
case 0:
|
||||
{
|
||||
this.m_BookName = reader.ReadString();
|
||||
|
||||
this.m_Filter = new BOBFilter(reader);
|
||||
|
||||
int count = reader.ReadEncodedInt();
|
||||
|
||||
this.m_Entries = new ArrayList(count);
|
||||
|
||||
for (int i = 0; i < count; ++i)
|
||||
{
|
||||
int v = reader.ReadEncodedInt();
|
||||
|
||||
switch ( v )
|
||||
{
|
||||
case 0:
|
||||
this.m_Entries.Add(new BOBLargeEntry(reader));
|
||||
break;
|
||||
case 1:
|
||||
this.m_Entries.Add(new BOBSmallEntry(reader));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void GetProperties(ObjectPropertyList list)
|
||||
{
|
||||
base.GetProperties(list);
|
||||
|
||||
list.Add(1062344, this.m_Entries.Count.ToString()); // Deeds in book: ~1_val~
|
||||
|
||||
if (this.m_BookName != null && this.m_BookName.Length > 0)
|
||||
list.Add(1062481, this.m_BookName); // Book Name: ~1_val~
|
||||
}
|
||||
|
||||
public override void GetContextMenuEntries(Mobile from, List<ContextMenuEntry> list)
|
||||
{
|
||||
base.GetContextMenuEntries(from, list);
|
||||
|
||||
if (from.CheckAlive() && this.IsChildOf(from.Backpack))
|
||||
list.Add(new NameBookEntry(from, this));
|
||||
|
||||
SetSecureLevelEntry.AddTo(from, this, list);
|
||||
}
|
||||
|
||||
private class NameBookEntry : ContextMenuEntry
|
||||
{
|
||||
private readonly Mobile m_From;
|
||||
private readonly BulkOrderBook m_Book;
|
||||
public NameBookEntry(Mobile from, BulkOrderBook book)
|
||||
: base(6216)
|
||||
{
|
||||
this.m_From = from;
|
||||
this.m_Book = book;
|
||||
}
|
||||
|
||||
public override void OnClick()
|
||||
{
|
||||
if (this.m_From.CheckAlive() && this.m_Book.IsChildOf(this.m_From.Backpack))
|
||||
{
|
||||
this.m_From.Prompt = new NameBookPrompt(this.m_Book);
|
||||
this.m_From.SendLocalizedMessage(1062479); // Type in the new name of the book:
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class NameBookPrompt : Prompt
|
||||
{
|
||||
public override int MessageCliloc { get { return 1062479; } }
|
||||
private readonly BulkOrderBook m_Book;
|
||||
public NameBookPrompt(BulkOrderBook book)
|
||||
{
|
||||
this.m_Book = book;
|
||||
}
|
||||
|
||||
public override void OnResponse(Mobile from, string text)
|
||||
{
|
||||
if (text.Length > 40)
|
||||
text = text.Substring(0, 40);
|
||||
|
||||
if (from.CheckAlive() && this.m_Book.IsChildOf(from.Backpack))
|
||||
{
|
||||
this.m_Book.BookName = Utility.FixHtml(text.Trim());
|
||||
|
||||
from.SendLocalizedMessage(1062480); // The bulk order book's name has been changed.
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnCancel(Mobile from)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
71
Scripts/Services/BulkOrders/BulkMaterialType.cs
Normal file
71
Scripts/Services/BulkOrders/BulkMaterialType.cs
Normal file
@@ -0,0 +1,71 @@
|
||||
using System;
|
||||
using Server.Items;
|
||||
using Server.Engines.Craft;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
public enum BulkMaterialType
|
||||
{
|
||||
None,
|
||||
DullCopper,
|
||||
ShadowIron,
|
||||
Copper,
|
||||
Bronze,
|
||||
Gold,
|
||||
Agapite,
|
||||
Verite,
|
||||
Valorite,
|
||||
Spined,
|
||||
Horned,
|
||||
Barbed,
|
||||
OakWood,
|
||||
AshWood,
|
||||
YewWood,
|
||||
Heartwood,
|
||||
Bloodwood,
|
||||
Frostwood
|
||||
}
|
||||
|
||||
public enum BulkGenericType
|
||||
{
|
||||
Iron,
|
||||
Cloth,
|
||||
Leather,
|
||||
Wood
|
||||
}
|
||||
|
||||
public class BGTClassifier
|
||||
{
|
||||
public static BulkGenericType Classify(BODType deedType, Type itemType)
|
||||
{
|
||||
if (deedType == BODType.Tailor)
|
||||
{
|
||||
if (itemType == null || itemType.IsSubclassOf(typeof(BaseArmor)) || itemType.IsSubclassOf(typeof(BaseShoes)))
|
||||
return BulkGenericType.Leather;
|
||||
|
||||
return BulkGenericType.Cloth;
|
||||
}
|
||||
else if (deedType == BODType.Tinkering && itemType != null)
|
||||
{
|
||||
if(itemType == typeof(Clock) || itemType.IsSubclassOf(typeof(Clock)))
|
||||
return BulkGenericType.Wood;
|
||||
|
||||
CraftItem item = DefTinkering.CraftSystem.CraftItems.SearchFor(itemType);
|
||||
|
||||
if (item != null)
|
||||
{
|
||||
Type typeRes = item.Resources.GetAt(0).ItemType;
|
||||
|
||||
if (typeRes == typeof(Board) || typeRes == typeof(Log))
|
||||
return BulkGenericType.Wood;
|
||||
}
|
||||
}
|
||||
else if (deedType == BODType.Fletching || deedType == BODType.Carpentry)
|
||||
{
|
||||
return BulkGenericType.Wood;
|
||||
}
|
||||
|
||||
return BulkGenericType.Iron;
|
||||
}
|
||||
}
|
||||
}
|
||||
944
Scripts/Services/BulkOrders/BulkOrderSystem.cs
Normal file
944
Scripts/Services/BulkOrders/BulkOrderSystem.cs
Normal file
@@ -0,0 +1,944 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using Server;
|
||||
using Server.Mobiles;
|
||||
using Server.Items;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
public enum PointsMode
|
||||
{
|
||||
Enabled,
|
||||
Disabled,
|
||||
Automatic
|
||||
}
|
||||
|
||||
public interface IBOD
|
||||
{
|
||||
int AmountMax { get; set; }
|
||||
bool RequireExceptional { get; set; }
|
||||
bool Complete { get; }
|
||||
BulkMaterialType Material { get; set; }
|
||||
BODType BODType { get; }
|
||||
}
|
||||
|
||||
public class BulkOrderSystem
|
||||
{
|
||||
// Logic (EA says 3 cached): 2 cached, 1 in the pipe if the last bod > 6 hours = 3
|
||||
public static readonly int MaxCachedDeeds = 2;
|
||||
public static readonly int Delay = 6;
|
||||
|
||||
public static bool NewSystemEnabled = Core.TOL;
|
||||
public static BulkOrderSystem Instance { get; set; }
|
||||
|
||||
public Dictionary<PlayerMobile, BODContext> BODPlayerData { get; set; }
|
||||
|
||||
public BulkOrderSystem()
|
||||
{
|
||||
BODPlayerData = new Dictionary<PlayerMobile, BODContext>();
|
||||
}
|
||||
|
||||
static BulkOrderSystem()
|
||||
{
|
||||
Instance = new BulkOrderSystem();
|
||||
}
|
||||
|
||||
public void Serialize(GenericWriter writer)
|
||||
{
|
||||
writer.Write(0);
|
||||
|
||||
writer.Write(BODPlayerData.Count);
|
||||
foreach (KeyValuePair<PlayerMobile, BODContext> kvp in BODPlayerData)
|
||||
{
|
||||
writer.Write(kvp.Key);
|
||||
kvp.Value.Serialize(writer);
|
||||
}
|
||||
}
|
||||
|
||||
public void Deserialize(GenericReader reader)
|
||||
{
|
||||
int version = reader.ReadInt();
|
||||
|
||||
int count = reader.ReadInt();
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
PlayerMobile player = reader.ReadMobile() as PlayerMobile;
|
||||
BODContext context = new BODContext(reader);
|
||||
|
||||
if (player != null)
|
||||
BODPlayerData[player] = context;
|
||||
}
|
||||
}
|
||||
|
||||
public static BODContext GetContext(Mobile m, bool create = true)
|
||||
{
|
||||
BODContext context = null;
|
||||
|
||||
if (m is PlayerMobile)
|
||||
{
|
||||
PlayerMobile pm = m as PlayerMobile;
|
||||
|
||||
if (Instance.BODPlayerData.ContainsKey(pm))
|
||||
{
|
||||
context = Instance.BODPlayerData[pm];
|
||||
}
|
||||
else if (create)
|
||||
{
|
||||
Instance.BODPlayerData[pm] = context = new BODContext();
|
||||
}
|
||||
}
|
||||
|
||||
return context;
|
||||
}
|
||||
|
||||
public static double GetPoints(Mobile m, BODType type)
|
||||
{
|
||||
BODContext context = GetContext(m);
|
||||
|
||||
if (context != null)
|
||||
{
|
||||
if (context.Entries.ContainsKey(type))
|
||||
{
|
||||
return context.Entries[type].BankedPoints;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static void SetPoints(Mobile m, BODType type, double points)
|
||||
{
|
||||
if (points < 0)
|
||||
points = 0.0;
|
||||
|
||||
BODContext context = GetContext(m);
|
||||
|
||||
if (context != null)
|
||||
{
|
||||
if (context.Entries.ContainsKey(type))
|
||||
{
|
||||
context.Entries[type].BankedPoints += points;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void DeductPoints(Mobile m, BODType type, double points)
|
||||
{
|
||||
if (points < 0)
|
||||
points = 0.0;
|
||||
|
||||
BODContext context = GetContext(m);
|
||||
|
||||
if (context != null)
|
||||
{
|
||||
if (context.Entries.ContainsKey(type))
|
||||
{
|
||||
context.Entries[type].BankedPoints -= points;
|
||||
|
||||
if (context.Entries[type].BankedPoints < 0.0)
|
||||
context.Entries[type].BankedPoints = 0.0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static double GetBODSkill(Mobile m, SkillName skill)
|
||||
{
|
||||
return Math.Max(m.Skills[skill].Base, m.GetRacialSkillBonus(skill));
|
||||
}
|
||||
|
||||
public static List<CollectionItem> GetRewardCollection(BODType type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
default:
|
||||
case BODType.Smith: return SmithRewardCalculator.Instance.RewardCollection;
|
||||
case BODType.Tailor: return TailorRewardCalculator.Instance.RewardCollection;
|
||||
case BODType.Alchemy: return AlchemyRewardCalculator.Instance.RewardCollection;
|
||||
case BODType.Inscription: return InscriptionRewardCalculator.Instance.RewardCollection;
|
||||
case BODType.Tinkering: return TinkeringRewardCalculator.Instance.RewardCollection;
|
||||
case BODType.Fletching: return FletchingRewardCalculator.Instance.RewardCollection;
|
||||
case BODType.Carpentry: return CarpentryRewardCalculator.Instance.RewardCollection;
|
||||
case BODType.Cooking: return CookingRewardCalculator.Instance.RewardCollection;
|
||||
}
|
||||
}
|
||||
|
||||
public static bool CanGetBulkOrder(Mobile m, BODType type)
|
||||
{
|
||||
BODContext context = GetContext(m);
|
||||
|
||||
if (context != null && context.Entries.ContainsKey(type))
|
||||
{
|
||||
var entry = context.Entries[type];
|
||||
|
||||
if (entry != null)
|
||||
{
|
||||
entry.CheckCache();
|
||||
|
||||
if (entry.LastBulkOrder + TimeSpan.FromHours(Delay) < DateTime.UtcNow)
|
||||
{
|
||||
entry.LastBulkOrder = DateTime.UtcNow;
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (entry.CachedDeeds > 0)
|
||||
{
|
||||
entry.CachedDeeds--;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static TimeSpan GetNextBulkOrder(BODType type, PlayerMobile pm)
|
||||
{
|
||||
BODContext context = GetContext(pm);
|
||||
|
||||
if (context != null)
|
||||
{
|
||||
if (NewSystemEnabled)
|
||||
{
|
||||
DateTime last = context.Entries[type].LastBulkOrder;
|
||||
|
||||
return (last + TimeSpan.FromHours(Delay)) - DateTime.UtcNow;
|
||||
}
|
||||
else if (context.Entries.ContainsKey(type))
|
||||
{
|
||||
DateTime dt = context.Entries[type].NextBulkOrder;
|
||||
|
||||
if (dt < DateTime.UtcNow)
|
||||
return TimeSpan.Zero;
|
||||
|
||||
return DateTime.UtcNow - dt;
|
||||
}
|
||||
}
|
||||
|
||||
return TimeSpan.MaxValue;
|
||||
}
|
||||
|
||||
public static void SetNextBulkOrder(BODType type, PlayerMobile pm, TimeSpan ts)
|
||||
{
|
||||
BODContext context = GetContext(pm);
|
||||
|
||||
if (context != null)
|
||||
{
|
||||
if (NewSystemEnabled)
|
||||
{
|
||||
if (context.Entries.ContainsKey(type))
|
||||
{
|
||||
if (context.Entries[type].LastBulkOrder < DateTime.UtcNow - TimeSpan.FromHours(Delay * MaxCachedDeeds))
|
||||
context.Entries[type].LastBulkOrder = DateTime.UtcNow - TimeSpan.FromHours(Delay * MaxCachedDeeds);
|
||||
else
|
||||
context.Entries[type].LastBulkOrder = (context.Entries[type].LastBulkOrder + ts) - TimeSpan.FromHours(Delay);
|
||||
}
|
||||
}
|
||||
else if (context.Entries.ContainsKey(type))
|
||||
{
|
||||
context.Entries[type].NextBulkOrder = DateTime.UtcNow + ts;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static Item CreateBulkOrder(Mobile m, BODType type, bool fromContextMenu)
|
||||
{
|
||||
PlayerMobile pm = m as PlayerMobile;
|
||||
|
||||
if (pm == null)
|
||||
return null;
|
||||
|
||||
if (pm.AccessLevel > AccessLevel.Player || fromContextMenu || 0.2 > Utility.RandomDouble())
|
||||
{
|
||||
SkillName sk = GetSkillForBOD(type);
|
||||
double theirSkill = pm.Skills[sk].Base;
|
||||
bool doLarge = theirSkill >= 70.1 && ((theirSkill - 40.0) / 300.0) > Utility.RandomDouble();
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case BODType.Smith:
|
||||
if (doLarge) return new LargeSmithBOD();
|
||||
else return SmallSmithBOD.CreateRandomFor(pm);
|
||||
case BODType.Tailor: if (doLarge) return new LargeTailorBOD();
|
||||
else return SmallTailorBOD.CreateRandomFor(pm);
|
||||
case BODType.Alchemy:
|
||||
if (doLarge) return new LargeAlchemyBOD();
|
||||
else return SmallAlchemyBOD.CreateRandomFor(pm);
|
||||
case BODType.Inscription:
|
||||
if (doLarge) return new LargeInscriptionBOD();
|
||||
else return SmallInscriptionBOD.CreateRandomFor(pm);
|
||||
case BODType.Tinkering:
|
||||
if (doLarge) return new LargeTinkerBOD();
|
||||
else return SmallTinkerBOD.CreateRandomFor(pm);
|
||||
case BODType.Cooking:
|
||||
if (doLarge) return new LargeCookingBOD();
|
||||
else return SmallCookingBOD.CreateRandomFor(pm);
|
||||
case BODType.Fletching:
|
||||
if (doLarge) return new LargeFletchingBOD();
|
||||
else return SmallFletchingBOD.CreateRandomFor(pm);
|
||||
case BODType.Carpentry:
|
||||
if (doLarge) return new LargeCarpentryBOD();
|
||||
else return SmallCarpentryBOD.CreateRandomFor(pm);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static SkillName GetSkillForBOD(BODType type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
default:
|
||||
case BODType.Smith: return SkillName.Blacksmith;
|
||||
case BODType.Tailor: return SkillName.Tailoring;
|
||||
case BODType.Alchemy: return SkillName.Alchemy;
|
||||
case BODType.Inscription: return SkillName.Inscribe;
|
||||
case BODType.Tinkering: return SkillName.Tinkering;
|
||||
case BODType.Cooking: return SkillName.Cooking;
|
||||
case BODType.Fletching: return SkillName.Fletching;
|
||||
case BODType.Carpentry: return SkillName.Carpentry;
|
||||
}
|
||||
}
|
||||
|
||||
public static int GetBodHue(BODType type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
default:
|
||||
case BODType.Smith: return 0x44E;
|
||||
case BODType.Tailor: return 0x483;
|
||||
case BODType.Alchemy: return 2505;
|
||||
case BODType.Inscription: return 2598;
|
||||
case BODType.Tinkering: return 1109;
|
||||
case BODType.Cooking: return 1169;
|
||||
case BODType.Fletching: return 1425;
|
||||
case BODType.Carpentry: return 1512;
|
||||
}
|
||||
}
|
||||
|
||||
public static BOBFilter GetBOBFilter(PlayerMobile pm)
|
||||
{
|
||||
return GetContext(pm).BOBFilter;
|
||||
}
|
||||
|
||||
public static void SetBOBFilter(PlayerMobile pm, BOBFilter filter)
|
||||
{
|
||||
BODContext context = GetContext(pm);
|
||||
context.BOBFilter = filter;
|
||||
}
|
||||
|
||||
public static int ComputePoints(SmallBOD bod)
|
||||
{
|
||||
switch (bod.BODType)
|
||||
{
|
||||
default:
|
||||
case BODType.Smith: return SmithRewardCalculator.Instance.ComputePoints(bod);
|
||||
case BODType.Tailor: return TailorRewardCalculator.Instance.ComputePoints(bod);
|
||||
case BODType.Alchemy: return AlchemyRewardCalculator.Instance.ComputePoints(bod);
|
||||
case BODType.Inscription: return InscriptionRewardCalculator.Instance.ComputePoints(bod);
|
||||
case BODType.Tinkering: return TinkeringRewardCalculator.Instance.ComputePoints(bod);
|
||||
case BODType.Cooking: return CookingRewardCalculator.Instance.ComputePoints(bod);
|
||||
case BODType.Fletching: return FletchingRewardCalculator.Instance.ComputePoints(bod);
|
||||
case BODType.Carpentry: return CarpentryRewardCalculator.Instance.ComputePoints(bod);
|
||||
}
|
||||
}
|
||||
|
||||
public static int ComputePoints(LargeBOD bod)
|
||||
{
|
||||
switch (bod.BODType)
|
||||
{
|
||||
default:
|
||||
case BODType.Smith: return SmithRewardCalculator.Instance.ComputePoints(bod);
|
||||
case BODType.Tailor: return TailorRewardCalculator.Instance.ComputePoints(bod);
|
||||
case BODType.Alchemy: return AlchemyRewardCalculator.Instance.ComputePoints(bod);
|
||||
case BODType.Inscription: return InscriptionRewardCalculator.Instance.ComputePoints(bod);
|
||||
case BODType.Tinkering: return TinkeringRewardCalculator.Instance.ComputePoints(bod);
|
||||
case BODType.Cooking: return CookingRewardCalculator.Instance.ComputePoints(bod);
|
||||
case BODType.Fletching: return FletchingRewardCalculator.Instance.ComputePoints(bod);
|
||||
case BODType.Carpentry: return CarpentryRewardCalculator.Instance.ComputePoints(bod);
|
||||
}
|
||||
}
|
||||
|
||||
public static bool ComputeGold(Type type, int quantity, out int gold)
|
||||
{
|
||||
if (GenericBuyInfo.BuyPrices.ContainsKey(type))
|
||||
{
|
||||
gold = (quantity * GenericBuyInfo.BuyPrices[type]) / 2;
|
||||
return true;
|
||||
}
|
||||
|
||||
gold = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void ComputePoints(SmallBOD bod, out int points, out double banked)
|
||||
{
|
||||
points = 0;
|
||||
banked = 0.0;
|
||||
|
||||
switch (bod.BODType)
|
||||
{
|
||||
default:
|
||||
case BODType.Smith: points = SmithRewardCalculator.Instance.ComputePoints(bod); break;
|
||||
case BODType.Tailor: points = TailorRewardCalculator.Instance.ComputePoints(bod); break;
|
||||
case BODType.Alchemy: points = AlchemyRewardCalculator.Instance.ComputePoints(bod); break;
|
||||
case BODType.Inscription: points = InscriptionRewardCalculator.Instance.ComputePoints(bod); break;
|
||||
case BODType.Tinkering: points = TinkeringRewardCalculator.Instance.ComputePoints(bod); break;
|
||||
case BODType.Cooking: points = CookingRewardCalculator.Instance.ComputePoints(bod); break;
|
||||
case BODType.Fletching: points = FletchingRewardCalculator.Instance.ComputePoints(bod); break;
|
||||
case BODType.Carpentry: points = CarpentryRewardCalculator.Instance.ComputePoints(bod); break;
|
||||
}
|
||||
|
||||
banked = (double)points * 0.02;
|
||||
}
|
||||
|
||||
public static void ComputePoints(LargeBOD bod, out int points, out double banked)
|
||||
{
|
||||
points = 0;
|
||||
banked = 0.0;
|
||||
|
||||
switch (bod.BODType)
|
||||
{
|
||||
default:
|
||||
case BODType.Smith: points = SmithRewardCalculator.Instance.ComputePoints(bod); break;
|
||||
case BODType.Tailor: points = TailorRewardCalculator.Instance.ComputePoints(bod); break;
|
||||
case BODType.Alchemy: points = AlchemyRewardCalculator.Instance.ComputePoints(bod); break;
|
||||
case BODType.Inscription: points = InscriptionRewardCalculator.Instance.ComputePoints(bod); break;
|
||||
case BODType.Tinkering: points = TinkeringRewardCalculator.Instance.ComputePoints(bod); break;
|
||||
case BODType.Cooking: points = CookingRewardCalculator.Instance.ComputePoints(bod); break;
|
||||
case BODType.Fletching: points = FletchingRewardCalculator.Instance.ComputePoints(bod); break;
|
||||
case BODType.Carpentry: points = CarpentryRewardCalculator.Instance.ComputePoints(bod); break;
|
||||
}
|
||||
|
||||
banked = (double)points * .2;
|
||||
}
|
||||
|
||||
public static void AddToPending(Mobile m, BODType type, int points)
|
||||
{
|
||||
BODContext context = GetContext(m);
|
||||
|
||||
if (context != null)
|
||||
{
|
||||
context.AddPending(type, points);
|
||||
}
|
||||
}
|
||||
|
||||
public static void RemovePending(Mobile m, BODType type)
|
||||
{
|
||||
BODContext context = GetContext(m);
|
||||
|
||||
if (context != null)
|
||||
{
|
||||
context.RemovePending(type);
|
||||
}
|
||||
}
|
||||
|
||||
public static bool CanClaimRewards(Mobile m)
|
||||
{
|
||||
BODContext context = GetContext(m);
|
||||
|
||||
if (context != null)
|
||||
{
|
||||
return context.CanClaimRewards();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool CanExchangeBOD(Mobile from, BaseVendor vendor, IBOD bod, int cost)
|
||||
{
|
||||
if (bod.BODType != vendor.BODType)
|
||||
{
|
||||
vendor.SayTo(from, 1152298, 0x3B2); // I don't deal in those goods.
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((bod is SmallBOD && ((SmallBOD)bod).AmountCur > 0) ||
|
||||
(bod is LargeBOD && ((LargeBOD)bod).Entries != null &&
|
||||
((LargeBOD)bod).Entries.FirstOrDefault(e => e.Amount > 0) != null))
|
||||
{
|
||||
vendor.SayTo(from, 1152299, 0x3B2); // I am sorry to say I cannot work with a deed that is even partially filled.
|
||||
return false;
|
||||
}
|
||||
|
||||
if (bod.AmountMax == 20 && (!CanBeExceptional(bod) || bod.RequireExceptional) &&
|
||||
(!CanUseMaterial(bod) ||
|
||||
(bod.Material == BulkMaterialType.Valorite ||
|
||||
bod.Material == BulkMaterialType.Frostwood ||
|
||||
bod.Material == BulkMaterialType.Barbed)))
|
||||
{
|
||||
vendor.SayTo(from, 1152291, 0x3B2); // I won't be able to replace that bulk order with a better one.
|
||||
return false;
|
||||
}
|
||||
|
||||
if (cost > -1 && !Banker.Withdraw(from, cost, true))
|
||||
{
|
||||
vendor.SayTo(from, 1152302, 0x3B2); // I am afraid your bank box does not contain the funds needed to complete this transaction.
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static Type GetTypeFromBOD(IBOD bod)
|
||||
{
|
||||
Type t = null;
|
||||
|
||||
if (bod is SmallBOD)
|
||||
{
|
||||
t = ((SmallBOD)bod).Type;
|
||||
}
|
||||
else if (bod is LargeBOD && ((LargeBOD)bod).Entries != null && ((LargeBOD)bod).Entries.Length > 0)
|
||||
{
|
||||
t = ((LargeBOD)bod).Entries[0].Details.Type;
|
||||
}
|
||||
|
||||
return t;
|
||||
}
|
||||
|
||||
public static bool CanBeExceptional(IBOD bod)
|
||||
{
|
||||
switch (bod.BODType)
|
||||
{
|
||||
default: return true;
|
||||
case BODType.Alchemy:
|
||||
case BODType.Inscription: return false;
|
||||
case BODType.Tinkering:
|
||||
case BODType.Cooking:
|
||||
case BODType.Fletching:
|
||||
return !IsInExceptionalExcludeList(bod);
|
||||
}
|
||||
}
|
||||
|
||||
private static bool IsInExceptionalExcludeList(IBOD bod)
|
||||
{
|
||||
Type t = GetTypeFromBOD(bod);
|
||||
|
||||
if (t == null)
|
||||
return false;
|
||||
|
||||
return _ExceptionalExcluded.FirstOrDefault(type => type == t) != null;
|
||||
}
|
||||
|
||||
public static bool CanUseMaterial(IBOD bod)
|
||||
{
|
||||
switch (bod.BODType)
|
||||
{
|
||||
default: return true;
|
||||
case BODType.Alchemy:
|
||||
case BODType.Inscription:
|
||||
case BODType.Cooking: return false;
|
||||
case BODType.Tinkering:
|
||||
case BODType.Fletching: return !IsInExceptionalExcludeList(bod);
|
||||
case BODType.Tailor: return BGTClassifier.Classify(BODType.Tailor, GetTypeFromBOD(bod)) == BulkGenericType.Leather;
|
||||
}
|
||||
}
|
||||
|
||||
private static Type[] _ExceptionalExcluded =
|
||||
{
|
||||
typeof(Arrow), typeof(Bolt), typeof(Kindling), typeof(Shaft),
|
||||
|
||||
typeof(EnchantedApple), typeof(TribalPaint), typeof(GrapesOfWrath),
|
||||
typeof(EggBomb), typeof(CookedBird), typeof(FishSteak), typeof(FriedEggs),
|
||||
typeof(LambLeg), typeof(Ribs),
|
||||
|
||||
typeof(Gears), typeof(Axle), typeof(Springs), typeof(AxleGears), typeof(ClockParts),
|
||||
typeof(Clock), typeof(PotionKeg), typeof(ClockFrame), typeof(MetalContainerEngraver)
|
||||
};
|
||||
|
||||
public static void MutateBOD(IBOD bod)
|
||||
{
|
||||
List<int> picker = new List<int>();
|
||||
|
||||
if (!bod.RequireExceptional && CanBeExceptional(bod))
|
||||
{
|
||||
picker.Add(0);
|
||||
}
|
||||
|
||||
if (bod.AmountMax < 20)
|
||||
{
|
||||
picker.Add(1);
|
||||
}
|
||||
|
||||
if (CanUseMaterial(bod) && bod.Material != BulkMaterialType.Frostwood && bod.Material != BulkMaterialType.Barbed && bod.Material != BulkMaterialType.Valorite)
|
||||
{
|
||||
picker.Add(2);
|
||||
}
|
||||
|
||||
if (picker.Count == 0)
|
||||
return;
|
||||
|
||||
switch (picker[Utility.Random(picker.Count)])
|
||||
{
|
||||
case 0: bod.RequireExceptional = true; break;
|
||||
case 1: bod.AmountMax += 5; break;
|
||||
case 2:
|
||||
if (bod.Material == BulkMaterialType.None)
|
||||
{
|
||||
BulkGenericType type = BGTClassifier.Classify(bod.BODType, null);
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case BulkGenericType.Iron: bod.Material = BulkMaterialType.DullCopper; break;
|
||||
case BulkGenericType.Cloth: break;
|
||||
case BulkGenericType.Leather: bod.Material = BulkMaterialType.Spined; break;
|
||||
case BulkGenericType.Wood: bod.Material = BulkMaterialType.OakWood; break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
bod.Material++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
picker.Clear();
|
||||
}
|
||||
|
||||
public static int GetBribe(IBOD bod)
|
||||
{
|
||||
int worth = 0;
|
||||
|
||||
if (bod.RequireExceptional)
|
||||
{
|
||||
worth += 400;
|
||||
}
|
||||
|
||||
switch (bod.Material)
|
||||
{
|
||||
case BulkMaterialType.DullCopper: worth += 25; break;
|
||||
case BulkMaterialType.ShadowIron: worth += 50; break;
|
||||
case BulkMaterialType.Copper: worth += 100; break;
|
||||
case BulkMaterialType.Bronze: worth += 200; break;
|
||||
case BulkMaterialType.Gold: worth += 300; break;
|
||||
case BulkMaterialType.Agapite: worth += 400; break;
|
||||
case BulkMaterialType.Verite: worth += 500; break;
|
||||
case BulkMaterialType.Valorite: worth += 600; break;
|
||||
case BulkMaterialType.Spined: worth += 100; break;
|
||||
case BulkMaterialType.Horned: worth += 250; break;
|
||||
case BulkMaterialType.Barbed: worth += 500; break;
|
||||
case BulkMaterialType.OakWood: worth += 100; break;
|
||||
case BulkMaterialType.AshWood: worth += 200; break;
|
||||
case BulkMaterialType.YewWood: worth += 300; break;
|
||||
case BulkMaterialType.Heartwood: worth += 400; break;
|
||||
case BulkMaterialType.Bloodwood: worth += 500; break;
|
||||
case BulkMaterialType.Frostwood: worth += 600; break;
|
||||
}
|
||||
|
||||
switch (bod.AmountMax)
|
||||
{
|
||||
default:
|
||||
case 10:
|
||||
case 15: worth += 100; break;
|
||||
case 20: worth += 250; break;
|
||||
}
|
||||
|
||||
if (bod is LargeBOD && ((LargeBOD)bod).Entries != null)
|
||||
{
|
||||
worth *= Math.Min(4, ((LargeBOD)bod).Entries.Length);
|
||||
}
|
||||
|
||||
return worth;
|
||||
}
|
||||
|
||||
public static void OnTick()
|
||||
{
|
||||
foreach (var kvp in Instance.BODPlayerData)
|
||||
{
|
||||
kvp.Value.CheckCache();
|
||||
}
|
||||
}
|
||||
|
||||
public static void OnLogin(LoginEventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
public static string FilePath = Path.Combine("Saves/CraftContext", "BODs.bin");
|
||||
|
||||
public static void Configure()
|
||||
{
|
||||
EventSink.WorldSave += OnSave;
|
||||
EventSink.WorldLoad += OnLoad;
|
||||
}
|
||||
|
||||
public static void Initialize()
|
||||
{
|
||||
if (NewSystemEnabled)
|
||||
{
|
||||
Timer.DelayCall(TimeSpan.FromMinutes(1), TimeSpan.FromMinutes(1), OnTick);
|
||||
}
|
||||
}
|
||||
|
||||
public static void OnSave(WorldSaveEventArgs e)
|
||||
{
|
||||
Persistence.Serialize(
|
||||
FilePath,
|
||||
writer =>
|
||||
{
|
||||
writer.Write(0);
|
||||
|
||||
Instance.Serialize(writer);
|
||||
});
|
||||
}
|
||||
|
||||
public static void OnLoad()
|
||||
{
|
||||
Persistence.Deserialize(
|
||||
FilePath,
|
||||
reader =>
|
||||
{
|
||||
int version = reader.ReadInt();
|
||||
|
||||
Instance.Deserialize(reader);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public class BODContext
|
||||
{
|
||||
public Dictionary<BODType, BODEntry> Entries { get; set; }
|
||||
|
||||
public BOBFilter BOBFilter { get; set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public PointsMode PointsMode { get; set; }
|
||||
|
||||
public BODContext()
|
||||
{
|
||||
BOBFilter = new BOBFilter();
|
||||
|
||||
ConfigEntries();
|
||||
}
|
||||
|
||||
public void AddPending(BODType type, int points)
|
||||
{
|
||||
if (Entries.ContainsKey(type))
|
||||
{
|
||||
Entries[type].PendingRewardPoints = points;
|
||||
}
|
||||
}
|
||||
|
||||
public void RemovePending(BODType type)
|
||||
{
|
||||
if (Entries.ContainsKey(type))
|
||||
{
|
||||
Entries[type].PendingRewardPoints = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public int GetPendingRewardFor(BODType type)
|
||||
{
|
||||
if (Entries.ContainsKey(type))
|
||||
{
|
||||
return Entries[type].PendingRewardPoints;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public bool CanClaimRewards()
|
||||
{
|
||||
foreach (var kvp in Entries)
|
||||
{
|
||||
if (kvp.Value.PendingRewardPoints > 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public BODContext(GenericReader reader)
|
||||
{
|
||||
int version = reader.ReadInt();
|
||||
ConfigEntries();
|
||||
|
||||
this.PointsMode = (PointsMode)reader.ReadInt();
|
||||
BOBFilter = new BOBFilter(reader);
|
||||
|
||||
int count = reader.ReadInt();
|
||||
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
BODType type = (BODType)reader.ReadInt();
|
||||
BODEntry entry = new BODEntry(reader);
|
||||
|
||||
if (Entries.ContainsKey(type))
|
||||
Entries[type] = entry;
|
||||
}
|
||||
}
|
||||
|
||||
public void Serialize(GenericWriter writer)
|
||||
{
|
||||
writer.Write(0);
|
||||
|
||||
writer.Write((int)this.PointsMode);
|
||||
BOBFilter.Serialize(writer);
|
||||
|
||||
// Lets do this dynamically incase we add new bods in the future
|
||||
writer.Write(Entries.Count);
|
||||
foreach (KeyValuePair<BODType, BODEntry> kvp in Entries)
|
||||
{
|
||||
writer.Write((int)kvp.Key);
|
||||
kvp.Value.Serialize(writer);
|
||||
}
|
||||
}
|
||||
|
||||
private void ConfigEntries()
|
||||
{
|
||||
Entries = new Dictionary<BODType, BODEntry>();
|
||||
|
||||
Entries[BODType.Smith] = new BODEntry();
|
||||
Entries[BODType.Tailor] = new BODEntry();
|
||||
Entries[BODType.Tinkering] = new BODEntry();
|
||||
Entries[BODType.Carpentry] = new BODEntry();
|
||||
Entries[BODType.Fletching] = new BODEntry();
|
||||
Entries[BODType.Cooking] = new BODEntry();
|
||||
Entries[BODType.Alchemy] = new BODEntry();
|
||||
Entries[BODType.Inscription] = new BODEntry();
|
||||
}
|
||||
|
||||
public void CheckCache()
|
||||
{
|
||||
foreach (var kvp in Entries)
|
||||
{
|
||||
kvp.Value.CheckCache();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[PropertyObject]
|
||||
public class BODEntry
|
||||
{
|
||||
private int _CachedDeeds;
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int CachedDeeds
|
||||
{
|
||||
get { return _CachedDeeds; }
|
||||
set
|
||||
{
|
||||
int old = _CachedDeeds;
|
||||
|
||||
_CachedDeeds = Math.Max(0, Math.Min(BulkOrderSystem.MaxCachedDeeds, value));
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public DateTime LastBulkOrder { get; set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public double BankedPoints { get; set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int PendingRewardPoints { get; set; }
|
||||
|
||||
// Legacy System
|
||||
private DateTime _NextBulkOrder;
|
||||
|
||||
public DateTime NextBulkOrder
|
||||
{
|
||||
get
|
||||
{
|
||||
return _NextBulkOrder;
|
||||
}
|
||||
set
|
||||
{
|
||||
_NextBulkOrder = value;
|
||||
}
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return "...";
|
||||
}
|
||||
|
||||
public BODEntry()
|
||||
{
|
||||
_CachedDeeds = BulkOrderSystem.MaxCachedDeeds;
|
||||
}
|
||||
|
||||
public void CheckCache()
|
||||
{
|
||||
if (_CachedDeeds >= BulkOrderSystem.MaxCachedDeeds)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (LastBulkOrder == DateTime.MinValue)
|
||||
{
|
||||
CachedDeeds = BulkOrderSystem.MaxCachedDeeds;
|
||||
LastBulkOrder = DateTime.UtcNow - TimeSpan.FromHours(BulkOrderSystem.Delay);
|
||||
}
|
||||
else if (LastBulkOrder + TimeSpan.FromHours(BulkOrderSystem.Delay) < DateTime.UtcNow)
|
||||
{
|
||||
CachedDeeds++;
|
||||
LastBulkOrder = LastBulkOrder + TimeSpan.FromHours(BulkOrderSystem.Delay);
|
||||
}
|
||||
}
|
||||
|
||||
public BODEntry(GenericReader reader)
|
||||
{
|
||||
int version = reader.ReadInt();
|
||||
|
||||
if (reader.ReadInt() == 0)
|
||||
{
|
||||
switch (version)
|
||||
{
|
||||
case 1:
|
||||
case 0:
|
||||
_CachedDeeds = reader.ReadInt();
|
||||
LastBulkOrder = reader.ReadDateTime();
|
||||
BankedPoints = reader.ReadDouble();
|
||||
PendingRewardPoints = reader.ReadInt();
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_NextBulkOrder = reader.ReadDateTime();
|
||||
}
|
||||
|
||||
if (version == 0 && _CachedDeeds > BulkOrderSystem.MaxCachedDeeds)
|
||||
{
|
||||
_CachedDeeds = BulkOrderSystem.MaxCachedDeeds;
|
||||
}
|
||||
}
|
||||
|
||||
public void Serialize(GenericWriter writer)
|
||||
{
|
||||
writer.Write(1);
|
||||
|
||||
if (BulkOrderSystem.NewSystemEnabled)
|
||||
{
|
||||
writer.Write(0);
|
||||
writer.Write(_CachedDeeds);
|
||||
writer.Write(LastBulkOrder);
|
||||
writer.Write(BankedPoints);
|
||||
writer.Write(PendingRewardPoints);
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.Write(1);
|
||||
writer.Write(_NextBulkOrder);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class PendingBribe
|
||||
{
|
||||
public IBOD BOD { get; set; }
|
||||
public int Amount { get; set; }
|
||||
|
||||
public PendingBribe(IBOD bod, int amount)
|
||||
{
|
||||
BOD = bod;
|
||||
Amount = amount;
|
||||
}
|
||||
}
|
||||
}
|
||||
47
Scripts/Services/BulkOrders/Items/BODRewardTitleDeed.cs
Normal file
47
Scripts/Services/BulkOrders/Items/BODRewardTitleDeed.cs
Normal file
@@ -0,0 +1,47 @@
|
||||
using System;
|
||||
using Server.Mobiles;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class BODRewardTitleDeed : BaseRewardTitleDeed
|
||||
{
|
||||
public override int LabelNumber { get { return 1155604; } } // A Deed for a Reward Title
|
||||
public override TextDefinition Title { get { return _Title; } }
|
||||
|
||||
private TextDefinition _Title;
|
||||
|
||||
[Constructable]
|
||||
public BODRewardTitleDeed(int title)
|
||||
{
|
||||
_Title = new TextDefinition(1157181 + title);
|
||||
}
|
||||
|
||||
public override void GetProperties(ObjectPropertyList list)
|
||||
{
|
||||
base.GetProperties(list);
|
||||
|
||||
list.Add(1114057, Title.ToString()); // ~1_NOTHING~
|
||||
}
|
||||
|
||||
public BODRewardTitleDeed(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write((int)0);
|
||||
|
||||
TextDefinition.Serialize(writer, _Title);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int v = reader.ReadInt();
|
||||
|
||||
_Title = TextDefinition.Deserialize(reader);
|
||||
}
|
||||
}
|
||||
}
|
||||
45
Scripts/Services/BulkOrders/Items/DrSpectorsLenses.cs
Normal file
45
Scripts/Services/BulkOrders/Items/DrSpectorsLenses.cs
Normal file
@@ -0,0 +1,45 @@
|
||||
using System;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class DrSpectorsLenses : Glasses
|
||||
{
|
||||
public override int LabelNumber { get { return 1156991; } } // Dr. Spector's lenses
|
||||
public override bool IsArtifact { get { return true; } }
|
||||
|
||||
[Constructable]
|
||||
public DrSpectorsLenses()
|
||||
{
|
||||
Attributes.BonusInt = 8;
|
||||
Attributes.RegenMana = 4;
|
||||
Attributes.SpellDamage = 12;
|
||||
Attributes.LowerManaCost = 8;
|
||||
Attributes.LowerRegCost = 10;
|
||||
}
|
||||
|
||||
public override int BasePhysicalResistance { get { return 5; } }
|
||||
public override int BaseFireResistance { get { return 10; } }
|
||||
public override int BaseColdResistance { get { return 14; } }
|
||||
public override int BasePoisonResistance { get { return 20; } }
|
||||
public override int BaseEnergyResistance { get { return 20; } }
|
||||
public override int InitMinHits { get { return 255; } }
|
||||
public override int InitMaxHits { get { return 255; } }
|
||||
|
||||
public DrSpectorsLenses(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write((int)0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
456
Scripts/Services/BulkOrders/Items/FementationBarrel.cs
Normal file
456
Scripts/Services/BulkOrders/Items/FementationBarrel.cs
Normal file
@@ -0,0 +1,456 @@
|
||||
using System;
|
||||
using Server.Mobiles;
|
||||
using Server.ContextMenus;
|
||||
using System.Collections.Generic;
|
||||
using Server.Gumps;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public enum FruitType
|
||||
{
|
||||
None,
|
||||
Grape,
|
||||
Apple,
|
||||
Peach,
|
||||
Pear,
|
||||
Plum
|
||||
}
|
||||
|
||||
[FlipableAttribute(0x9E36, 0x9E37)]
|
||||
public class FermentationBarrel : Item
|
||||
{
|
||||
private static readonly int MinFruit = 20;
|
||||
private static readonly int MaxFruit = 80;
|
||||
|
||||
private FruitType _FruitType;
|
||||
private int _Fruit;
|
||||
private int _BacterialResistance;
|
||||
|
||||
private bool _Fermenting;
|
||||
private DateTime _FermentingEnds;
|
||||
|
||||
private bool _Fermented;
|
||||
private bool _BadBatch;
|
||||
private int _BottlesRemaining;
|
||||
public string _Vintage;
|
||||
|
||||
public Mobile _Maker;
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public FruitType FruitType { get { return _FruitType; } set { _FruitType = value; InvalidateProperties(); } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int Fruit { get { return _Fruit; } set { _Fruit = value; InvalidateProperties(); } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int BacterialResistance { get { return _BacterialResistance; } set { _BacterialResistance = value; InvalidateProperties(); } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public bool Fermenting { get { return _Fermenting; } set { _Fermenting = value; InvalidateProperties(); } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public DateTime FermentingEnds { get { return _FermentingEnds; } set { _FermentingEnds = value; InvalidateProperties(); } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public bool Fermented { get { return _Fermented; } set { _Fermented = value; InvalidateProperties(); } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public bool BadBatch { get { return _BadBatch; } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int BottlesRemaining { get { return _BottlesRemaining; } set { _BottlesRemaining = value; InvalidateProperties(); } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public string Vintage { get { return _Vintage; } set { _Vintage = value; InvalidateProperties(); } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public Mobile Maker { get { return _Maker; } set { _Maker = value; } }
|
||||
|
||||
public bool HasYeast { get { return _BacterialResistance > 0; } }
|
||||
|
||||
public override int LabelNumber { get { return 1124526; } } // Fermentation Barrel
|
||||
|
||||
public override double DefaultWeight
|
||||
{
|
||||
get
|
||||
{
|
||||
if (BottlesRemaining <= 0)
|
||||
return 1.0;
|
||||
|
||||
return (double)BottlesRemaining;
|
||||
}
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public FermentationBarrel()
|
||||
: base(0x9E36)
|
||||
{
|
||||
}
|
||||
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
if (from.InRange(this.GetWorldLocation(), 2))
|
||||
{
|
||||
if (_Fermenting && _FermentingEnds < DateTime.UtcNow)
|
||||
{
|
||||
_Fermented = true;
|
||||
|
||||
int skill = (int)((from.Skills[SkillName.Cooking].Value + from.Skills[SkillName.Alchemy].Value) / 2);
|
||||
|
||||
skill *= _BacterialResistance / 4;
|
||||
|
||||
_BadBatch = skill < Utility.Random(225);
|
||||
|
||||
if (!_BadBatch)
|
||||
{
|
||||
BottlesRemaining = _Fruit / 4;
|
||||
}
|
||||
}
|
||||
|
||||
if (_Fermented)
|
||||
{
|
||||
if (_BadBatch)
|
||||
{
|
||||
from.PrivateOverheadMessage(Server.Network.MessageType.Regular, 1154, 1157258, from.NetState); // *You gently taste the fermentation...it's spoiled! You should probably empty the barrel*
|
||||
}
|
||||
else if (_BottlesRemaining > 0)
|
||||
{
|
||||
BottleOfWine bottle = new BottleOfWine(_FruitType, _Vintage, _Maker);
|
||||
|
||||
if (from.Backpack != null && from.Backpack.TryDropItem(from, bottle, false))
|
||||
{
|
||||
from.PlaySound(0x240);
|
||||
from.SendMessage("You pour the wine into a bottle and place it in your backpack.");
|
||||
|
||||
BottlesRemaining--;
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage(500720); // You don't have enough room in your backpack!
|
||||
bottle.Delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override bool OnDragDrop(Mobile from, Item dropped)
|
||||
{
|
||||
if (_Fermented)
|
||||
{
|
||||
from.SendLocalizedMessage(1157245); // The fermentation barrel is not empty. Empty it first to add fruit and yeast.
|
||||
}
|
||||
else if (_Fermenting)
|
||||
{
|
||||
from.SendLocalizedMessage(1157244); // You may not add anything to the fermentation barrel after fermentation has begun.
|
||||
}
|
||||
else if (dropped is Yeast)
|
||||
{
|
||||
if (HasYeast)
|
||||
{
|
||||
from.SendLocalizedMessage(1157256); // You have already added yeast to the barrel.
|
||||
}
|
||||
else
|
||||
{
|
||||
BacterialResistance = ((Yeast)dropped).BacterialResistance;
|
||||
dropped.Delete();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
FruitType type = GetFruitType(dropped.GetType());
|
||||
|
||||
if (_FruitType != FruitType.None && _FruitType != type)
|
||||
{
|
||||
from.SendLocalizedMessage(1157243); // You may only put one type of fruit in the fermentation barrel at one time. Empty the barrel first.
|
||||
}
|
||||
else if (type != FruitType.None)
|
||||
{
|
||||
if (_FruitType == FruitType.None)
|
||||
_FruitType = type;
|
||||
|
||||
if (_Fruit + dropped.Amount <= MaxFruit)
|
||||
{
|
||||
Fruit += dropped.Amount;
|
||||
dropped.Delete();
|
||||
}
|
||||
else
|
||||
{
|
||||
dropped.Amount -= MaxFruit - _Fruit;
|
||||
Fruit = MaxFruit;
|
||||
}
|
||||
}
|
||||
else if (!(dropped is Yeast))
|
||||
{
|
||||
from.SendLocalizedMessage(1157246); // You may only put fruit and yeast in the fermentation barrel.
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void GetProperties(ObjectPropertyList list)
|
||||
{
|
||||
base.GetProperties(list);
|
||||
|
||||
if (_Vintage != null)
|
||||
{
|
||||
list.Add(1157254, _Vintage); // <BASEFONT COLOR=#0099cc>~1_VAL~<BASEFONT COLOR=#FFFFFF>
|
||||
}
|
||||
|
||||
if (_FruitType != FruitType.None)
|
||||
{
|
||||
list.Add(1157248 + (int)_FruitType);
|
||||
}
|
||||
|
||||
if (_Fermented)
|
||||
{
|
||||
list.Add(1157259, _BottlesRemaining.ToString()); // Bottles Remaining: ~1_VAL~
|
||||
}
|
||||
}
|
||||
|
||||
public override void GetContextMenuEntries(Mobile from, List<ContextMenuEntry> entries)
|
||||
{
|
||||
base.GetContextMenuEntries(from, entries);
|
||||
|
||||
entries.Add(new SimpleContextMenuEntry(from, 1157231, m => // Begin Fermentation
|
||||
{
|
||||
if (_Fermenting)
|
||||
{
|
||||
m.SendLocalizedMessage(1157237); // The fermentation process has already begun.
|
||||
}
|
||||
else if (!HasYeast || _Fruit < MinFruit)
|
||||
{
|
||||
m.SendLocalizedMessage(1157255); // You do not have enough fruit or yeast to begin fermentation.
|
||||
}
|
||||
else
|
||||
{
|
||||
m.SendGump(new ConfirmCallbackGump(m as PlayerMobile, 1157234, 1157240, null, confirm: StartFermentation, close: CancelFermentation)); // Are you sure you wish to start the fermentation process?
|
||||
}
|
||||
}, 3, !_Fermented && (HasYeast || _Fruit > 0)));
|
||||
|
||||
entries.Add(new SimpleContextMenuEntry(from, 1157232, m => // Empty Barrel
|
||||
{
|
||||
m.SendGump(new ConfirmCallbackGump(m as PlayerMobile, 1157234, 1157235, null, confirm: DoEmpty)); // Are you sure you wish to end the fermentation process? All progress and materials will be lost!
|
||||
}, 3, HasYeast || _Fruit > 0));
|
||||
|
||||
entries.Add(new SimpleContextMenuEntry(from, 1157233, m => // Rename Vintage
|
||||
{
|
||||
if (_Fermenting)
|
||||
{
|
||||
m.SendLocalizedMessage(1157238); // You may not rename the vintage once the fermentation process has begun.
|
||||
}
|
||||
else
|
||||
{
|
||||
m.SendLocalizedMessage(1157242); // What do you wish to call this vintage?
|
||||
m.BeginPrompt((mob, text) =>
|
||||
{
|
||||
if (text != null)
|
||||
{
|
||||
text = text.Trim();
|
||||
text = Utility.FixHtml(text);
|
||||
|
||||
if (text.Length > 15 || !Server.Guilds.BaseGuildGump.CheckProfanity(text))
|
||||
{
|
||||
mob.SendMessage("That label is unacceptable. Please try again.");
|
||||
}
|
||||
else
|
||||
{
|
||||
Vintage = text;
|
||||
}
|
||||
}
|
||||
}, null);
|
||||
}
|
||||
}, 3, !_Fermented));
|
||||
}
|
||||
|
||||
private void StartFermentation(Mobile m, object state)
|
||||
{
|
||||
m.SendLocalizedMessage(1157239); // The fermentation process has begun.
|
||||
|
||||
_Fermenting = true;
|
||||
|
||||
_FermentingEnds = DateTime.UtcNow + TimeSpan.FromHours(24);
|
||||
}
|
||||
|
||||
private void CancelFermentation(Mobile m, object state)
|
||||
{
|
||||
m.SendLocalizedMessage(1157241); // The fermentation process has not been started.
|
||||
}
|
||||
|
||||
private void DoEmpty(Mobile m, object state)
|
||||
{
|
||||
m.SendLocalizedMessage(1157236); // You empty the contents of the barrel.
|
||||
|
||||
Reset();
|
||||
}
|
||||
|
||||
private void Reset()
|
||||
{
|
||||
_FruitType = FruitType.None;
|
||||
_Fruit = 0;
|
||||
_BacterialResistance = 0;
|
||||
|
||||
_Fermenting = false;
|
||||
_FermentingEnds = DateTime.MinValue;
|
||||
|
||||
_Fermented = false;
|
||||
_BottlesRemaining = 0;
|
||||
_Vintage = null;
|
||||
|
||||
_Maker = null;
|
||||
|
||||
InvalidateProperties();
|
||||
}
|
||||
|
||||
private FruitType GetFruitType(Type t)
|
||||
{
|
||||
for(int i = 0; i < _FruitTypes.Length; i++)
|
||||
{
|
||||
foreach (var type in _FruitTypes[i])
|
||||
{
|
||||
if (type == t)
|
||||
return (FruitType)i + 1;
|
||||
}
|
||||
}
|
||||
|
||||
return FruitType.None;
|
||||
}
|
||||
|
||||
private Type[][] _FruitTypes =
|
||||
{
|
||||
new Type[] { typeof(GrapeBunch), typeof(Grapes) },
|
||||
new Type[] { typeof(Apple) },
|
||||
new Type[] { typeof(Peach) },
|
||||
new Type[] { typeof(Pear) },
|
||||
new Type[] { typeof(Plum) }
|
||||
};
|
||||
|
||||
public FermentationBarrel(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write((int)0); // version
|
||||
|
||||
writer.Write((int)_FruitType);
|
||||
writer.Write(_Fruit);
|
||||
writer.Write(_BacterialResistance);
|
||||
|
||||
writer.Write(_Fermenting);
|
||||
writer.Write(_FermentingEnds);
|
||||
|
||||
writer.Write(_Fermented);
|
||||
writer.Write(_BadBatch);
|
||||
writer.Write(_BottlesRemaining);
|
||||
writer.Write(_Vintage);
|
||||
|
||||
writer.Write(_Maker);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
_FruitType = (FruitType)reader.ReadInt();
|
||||
_Fruit = reader.ReadInt();
|
||||
_BacterialResistance = reader.ReadInt();
|
||||
|
||||
_Fermenting = reader.ReadBool();
|
||||
_FermentingEnds = reader.ReadDateTime();
|
||||
|
||||
_Fermented = reader.ReadBool();
|
||||
_BadBatch = reader.ReadBool();
|
||||
_BottlesRemaining = reader.ReadInt();
|
||||
_Vintage = reader.ReadString();
|
||||
|
||||
_Maker = reader.ReadMobile();
|
||||
}
|
||||
}
|
||||
|
||||
public class BottleOfWine : BeverageBottle
|
||||
{
|
||||
private FruitType _FruitType;
|
||||
private string _Vintage;
|
||||
private Mobile _Maker;
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public FruitType FruitType { get { return _FruitType; } set { _FruitType = value; InvalidateProperties(); } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public string Vintage { get { return _Vintage; } set { _Vintage = value; InvalidateProperties(); } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public Mobile Maker { get { return _Maker; } set { _Maker = value; InvalidateProperties(); } }
|
||||
|
||||
[Constructable]
|
||||
public BottleOfWine()
|
||||
: this(FruitType.Grape, null, null)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public BottleOfWine(FruitType type, string vintage, Mobile maker)
|
||||
: base(BeverageType.Wine)
|
||||
{
|
||||
Quantity = MaxQuantity;
|
||||
|
||||
_FruitType = type;
|
||||
_Vintage = vintage;
|
||||
_Maker = maker;
|
||||
}
|
||||
|
||||
public override void AddNameProperty(ObjectPropertyList list)
|
||||
{
|
||||
list.Add(1049519, String.Format("#{0}", (1157248 + (int)_FruitType).ToString())); // a bottle of ~1_DRINK_NAME~
|
||||
}
|
||||
|
||||
public override void GetProperties(ObjectPropertyList list)
|
||||
{
|
||||
base.GetProperties(list);
|
||||
|
||||
if (_Vintage != null)
|
||||
{
|
||||
list.Add(1157254, _Vintage); // <BASEFONT COLOR=#0099cc>~1_VAL~<BASEFONT COLOR=#FFFFFF>
|
||||
}
|
||||
|
||||
if (_Maker != null)
|
||||
{
|
||||
list.Add(1150679, _Maker.Name); // Distiller: ~1_NAME~
|
||||
}
|
||||
|
||||
list.Add(GetQuantityDescription());
|
||||
}
|
||||
|
||||
public BottleOfWine(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write((int)0);
|
||||
|
||||
writer.Write((int)_FruitType);
|
||||
writer.Write(_Vintage);
|
||||
writer.Write(_Maker);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int version = reader.ReadInt();
|
||||
|
||||
_FruitType = (FruitType)reader.ReadInt();
|
||||
_Vintage = reader.ReadString();
|
||||
_Maker = reader.ReadMobile();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
using System;
|
||||
using Server.Mobiles;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class GuaranteedSpellbookImprovementTalisman : BaseTalisman
|
||||
{
|
||||
[Constructable]
|
||||
public GuaranteedSpellbookImprovementTalisman()
|
||||
: this(10)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public GuaranteedSpellbookImprovementTalisman(int charges)
|
||||
: base(0x9E28)
|
||||
{
|
||||
Charges = charges;
|
||||
|
||||
Skill = TalismanSkill.Inscription;
|
||||
SuccessBonus = BaseTalisman.GetRandomSuccessful();
|
||||
ExceptionalBonus = BaseTalisman.GetRandomExceptional();
|
||||
}
|
||||
|
||||
public override void GetProperties(ObjectPropertyList list)
|
||||
{
|
||||
base.GetProperties(list);
|
||||
|
||||
if (Charges > 0)
|
||||
list.Add(1049116, Charges.ToString()); // [ Charges: ~1_CHARGES~ ]
|
||||
|
||||
list.Add(1157212); // Crafting Failure Protection
|
||||
}
|
||||
|
||||
public GuaranteedSpellbookImprovementTalisman(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write((int)0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
80
Scripts/Services/BulkOrders/Items/KotlBlackRod.cs
Normal file
80
Scripts/Services/BulkOrders/Items/KotlBlackRod.cs
Normal file
@@ -0,0 +1,80 @@
|
||||
using System;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class KotlBlackRod : QuarterStaff
|
||||
{
|
||||
public override int LabelNumber { get { return 1156990; } } // kotl black rod
|
||||
public override bool IsArtifact { get { return true; } }
|
||||
|
||||
[Constructable]
|
||||
public KotlBlackRod()
|
||||
{
|
||||
Hue = 1150;
|
||||
|
||||
WeaponAttributes.MageWeapon = 30;
|
||||
Attributes.SpellChanneling = 1;
|
||||
Attributes.CastSpeed = 2;
|
||||
Attributes.LowerManaCost = 5;
|
||||
Attributes.LowerRegCost = 10;
|
||||
}
|
||||
|
||||
public override int InitMinHits { get { return 255; } }
|
||||
public override int InitMaxHits { get { return 255; } }
|
||||
|
||||
public KotlBlackRod(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write((int)0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
|
||||
public class GargishKotlBlackRod : GargishGnarledStaff
|
||||
{
|
||||
public override int LabelNumber { get { return 1156994; } } // gargish kotl black rod
|
||||
public override bool IsArtifact { get { return true; } }
|
||||
|
||||
[Constructable]
|
||||
public GargishKotlBlackRod()
|
||||
{
|
||||
Hue = 1150;
|
||||
|
||||
WeaponAttributes.MageWeapon = 30;
|
||||
Attributes.SpellChanneling = 1;
|
||||
Attributes.CastSpeed = 2;
|
||||
Attributes.LowerManaCost = 5;
|
||||
Attributes.LowerRegCost = 10;
|
||||
}
|
||||
|
||||
public override int InitMinHits { get { return 255; } }
|
||||
public override int InitMaxHits { get { return 255; } }
|
||||
|
||||
public GargishKotlBlackRod(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write((int)0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
54
Scripts/Services/BulkOrders/Items/MasterChefsApron.cs
Normal file
54
Scripts/Services/BulkOrders/Items/MasterChefsApron.cs
Normal file
@@ -0,0 +1,54 @@
|
||||
using System;
|
||||
using Server.Mobiles;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class MasterChefsApron : FullApron
|
||||
{
|
||||
private int _Bonus;
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int Bonus { get { return _Bonus; } set { _Bonus = value; InvalidateProperties(); } }
|
||||
|
||||
public override int LabelNumber { get { return 1157228; } } // Master Chef's Apron
|
||||
|
||||
[Constructable]
|
||||
public MasterChefsApron()
|
||||
{
|
||||
Hue = 1990;
|
||||
|
||||
while(_Bonus == 0)
|
||||
_Bonus = BaseTalisman.GetRandomExceptional();
|
||||
}
|
||||
|
||||
public override void GetProperties(ObjectPropertyList list)
|
||||
{
|
||||
base.GetProperties(list);
|
||||
|
||||
list.Add(1072395, "#{0}\t{1}", AosSkillBonuses.GetLabel(SkillName.Cooking), _Bonus); // ~1_NAME~ Exceptional Bonus: ~2_val~%
|
||||
}
|
||||
|
||||
public MasterChefsApron(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write((int)0); // version
|
||||
|
||||
writer.Write(_Bonus);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
_Bonus = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
82
Scripts/Services/BulkOrders/Items/MasterCraftsmanTalisman.cs
Normal file
82
Scripts/Services/BulkOrders/Items/MasterCraftsmanTalisman.cs
Normal file
@@ -0,0 +1,82 @@
|
||||
using System;
|
||||
using Server.Mobiles;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class MasterCraftsmanTalisman : BaseTalisman
|
||||
{
|
||||
public override bool IsArtifact { get { return true; } }
|
||||
|
||||
private int _Type;
|
||||
public virtual int Type { get { return _Type; } }
|
||||
|
||||
[Constructable]
|
||||
public MasterCraftsmanTalisman(int charges, int itemID, TalismanSkill skill)
|
||||
: base(itemID)
|
||||
{
|
||||
Skill = skill;
|
||||
|
||||
SuccessBonus = GetRandomSuccessful();
|
||||
ExceptionalBonus = BaseTalisman.GetRandomExceptional();
|
||||
Blessed = GetRandomBlessed();
|
||||
|
||||
_Type = charges;
|
||||
Charges = charges;
|
||||
}
|
||||
|
||||
public override void GetProperties(ObjectPropertyList list)
|
||||
{
|
||||
base.GetProperties(list);
|
||||
|
||||
list.Add(1157213); // Crafting Failure Protection
|
||||
|
||||
if (Charges > 0)
|
||||
list.Add(1049116, Charges.ToString()); // [ Charges: ~1_CHARGES~ ]
|
||||
}
|
||||
|
||||
public MasterCraftsmanTalisman(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override int LabelNumber
|
||||
{
|
||||
get
|
||||
{
|
||||
return 1157217;
|
||||
}
|
||||
}// MasterCraftsmanTalisman
|
||||
public override bool ForceShowName
|
||||
{
|
||||
get
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write((int)1); // version
|
||||
|
||||
writer.Write(_Type);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch (version)
|
||||
{
|
||||
case 1:
|
||||
_Type = reader.ReadInt();
|
||||
break;
|
||||
case 0:
|
||||
_Type = 10;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
74
Scripts/Services/BulkOrders/Items/PlumTreeAddon.cs
Normal file
74
Scripts/Services/BulkOrders/Items/PlumTreeAddon.cs
Normal file
@@ -0,0 +1,74 @@
|
||||
using System;
|
||||
using Server.Mobiles;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class PlumTreeAddon : BaseFruitTreeAddon
|
||||
{
|
||||
public override BaseAddonDeed Deed { get { return new PlumTreeAddonDeed(); } }
|
||||
|
||||
[Constructable]
|
||||
public PlumTreeAddon()
|
||||
{
|
||||
AddComponent(new LocalizedAddonComponent(0x9E38, 1029965), 0, 0, 0);
|
||||
AddComponent(new LocalizedAddonComponent(0x9E39, 1029965), 0, 0, 0);
|
||||
}
|
||||
|
||||
public override Item Fruit
|
||||
{
|
||||
get
|
||||
{
|
||||
return new Plum();
|
||||
}
|
||||
}
|
||||
|
||||
public PlumTreeAddon(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write((int)0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
|
||||
public class PlumTreeAddonDeed : BaseAddonDeed
|
||||
{
|
||||
public override int LabelNumber { get { return 1157312; } } // Plum Tree
|
||||
public override BaseAddon Addon { get { return new PlumTreeAddon(); } }
|
||||
|
||||
[Constructable]
|
||||
public PlumTreeAddonDeed()
|
||||
{
|
||||
}
|
||||
|
||||
public PlumTreeAddonDeed(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write((int)0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
155
Scripts/Services/BulkOrders/Items/PowderOfFortKeg.cs
Normal file
155
Scripts/Services/BulkOrders/Items/PowderOfFortKeg.cs
Normal file
@@ -0,0 +1,155 @@
|
||||
using System;
|
||||
using Server.Mobiles;
|
||||
using Server.Items;
|
||||
using Server.Engines.Harvest;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class PowderOfFortKeg : Item
|
||||
{
|
||||
private int _Charges;
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int Charges { get { return _Charges; } set { _Charges = value; InvalidateProperties(); } }
|
||||
|
||||
public override int LabelNumber { get { return 1157221; } } // A specially lined keg for powder of fortification.
|
||||
|
||||
[Constructable]
|
||||
public PowderOfFortKeg()
|
||||
: this(0)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public PowderOfFortKeg(int uses)
|
||||
: base(0x1940)
|
||||
{
|
||||
_Charges = uses;
|
||||
|
||||
Hue = 2419;
|
||||
this.Weight = 15.0;
|
||||
}
|
||||
|
||||
public override bool OnDragDrop(Mobile m, Item dropped)
|
||||
{
|
||||
if (dropped is PowderOfTemperament)
|
||||
{
|
||||
var powder = dropped as PowderOfTemperament;
|
||||
|
||||
if (_Charges < 250)
|
||||
{
|
||||
if (powder.UsesRemaining + _Charges > 250)
|
||||
{
|
||||
int add = 250 - _Charges;
|
||||
|
||||
powder.UsesRemaining -= add;
|
||||
|
||||
Charges = 250;
|
||||
}
|
||||
else
|
||||
{
|
||||
Charges += powder.UsesRemaining;
|
||||
powder.Delete();
|
||||
}
|
||||
|
||||
m.PlaySound(0x247);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
if (from.Backpack != null && IsChildOf(from.Backpack) && Charges > 0)
|
||||
{
|
||||
PowderOfTemperament powder = from.Backpack.FindItemByType(typeof(PowderOfTemperament)) as PowderOfTemperament;
|
||||
|
||||
if (powder != null)
|
||||
{
|
||||
powder.UsesRemaining++;
|
||||
Charges--;
|
||||
}
|
||||
else
|
||||
{
|
||||
powder = new PowderOfTemperament(1);
|
||||
|
||||
if (!from.Backpack.TryDropItem(from, powder, false))
|
||||
{
|
||||
from.SendLocalizedMessage(1080016); // That container cannot hold more weight.
|
||||
powder.Delete();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
Charges--;
|
||||
}
|
||||
|
||||
from.PlaySound(0x247);
|
||||
}
|
||||
}
|
||||
|
||||
public override void GetProperties(ObjectPropertyList list)
|
||||
{
|
||||
base.GetProperties(list);
|
||||
|
||||
list.Add(1060584, _Charges.ToString());
|
||||
|
||||
int perc = (int)(((double)_Charges / 250) * 100);
|
||||
int number = 0;
|
||||
|
||||
if (perc <= 0)
|
||||
number = 502246; // The keg is empty.
|
||||
else if (perc < 5)
|
||||
number = 502248; // The keg is nearly empty.
|
||||
else if (perc < 20)
|
||||
number = 502249; // The keg is not very full.
|
||||
else if (perc < 30)
|
||||
number = 502250; // The keg is about one quarter full.
|
||||
else if (perc < 40)
|
||||
number = 502251; // The keg is about one third full.
|
||||
else if (perc < 47)
|
||||
number = 502252; // The keg is almost half full.
|
||||
else if (perc < 54)
|
||||
number = 502254; // The keg is approximately half full.
|
||||
else if (perc < 70)
|
||||
number = 502253; // The keg is more than half full.
|
||||
else if (perc < 80)
|
||||
number = 502255; // The keg is about three quarters full.
|
||||
else if (perc < 90)
|
||||
number = 502256; // The keg is very full.
|
||||
else if (perc < 100)
|
||||
number = 502257; // The liquid is almost to the top of the keg.
|
||||
else
|
||||
number = 502258; // The keg is completely full.
|
||||
|
||||
list.Add(number);
|
||||
}
|
||||
|
||||
public PowderOfFortKeg(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write((int)1); // version
|
||||
|
||||
writer.Write(_Charges);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
_Charges = reader.ReadInt();
|
||||
|
||||
if (version == 0)
|
||||
ItemID = 0x1940;
|
||||
}
|
||||
}
|
||||
}
|
||||
51
Scripts/Services/BulkOrders/Items/RockHammer.cs
Normal file
51
Scripts/Services/BulkOrders/Items/RockHammer.cs
Normal file
@@ -0,0 +1,51 @@
|
||||
using System;
|
||||
using Server.Mobiles;
|
||||
using Server.Engines.Harvest;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
[FlipableAttribute(0x9E7E, 0x9E7F)]
|
||||
public class RockHammer : BaseHarvestTool
|
||||
{
|
||||
public override int LabelNumber { get { return 1124598; } }
|
||||
|
||||
[Constructable]
|
||||
public RockHammer()
|
||||
: this(500)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public RockHammer(int uses)
|
||||
: base(uses, 0x9E7E)
|
||||
{
|
||||
this.Weight = 5.0;
|
||||
}
|
||||
|
||||
public RockHammer(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override HarvestSystem HarvestSystem
|
||||
{
|
||||
get
|
||||
{
|
||||
return Mining.System;
|
||||
}
|
||||
}
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write((int)0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
268
Scripts/Services/BulkOrders/Items/SpecialNaturalDye.cs
Normal file
268
Scripts/Services/BulkOrders/Items/SpecialNaturalDye.cs
Normal file
@@ -0,0 +1,268 @@
|
||||
using System;
|
||||
using Server.Engines.Plants;
|
||||
using Server.Multis;
|
||||
using Server.Targeting;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public enum DyeType
|
||||
{
|
||||
None,
|
||||
WindAzul,
|
||||
DullRuby,
|
||||
PoppieWhite,
|
||||
ZentoOrchid,
|
||||
UmbranViolet
|
||||
}
|
||||
|
||||
public class SpecialNaturalDye : Item
|
||||
{
|
||||
private DyeType m_DyeType;
|
||||
private int m_UsesRemaining;
|
||||
private bool m_BooksOnly;
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public DyeType DyeType
|
||||
{
|
||||
get { return m_DyeType; }
|
||||
set
|
||||
{
|
||||
DyeType old = m_DyeType;
|
||||
m_DyeType = value;
|
||||
|
||||
if (m_DyeType != old)
|
||||
ValidateHue();
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int UsesRemaining
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.m_UsesRemaining;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.m_UsesRemaining = value;
|
||||
this.InvalidateProperties();
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public bool BooksOnly
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.m_BooksOnly;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.m_BooksOnly = value;
|
||||
this.InvalidateProperties();
|
||||
}
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public SpecialNaturalDye(DyeType type)
|
||||
: this(type, false)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public SpecialNaturalDye(DyeType type, bool booksonly)
|
||||
: base(0x182B)
|
||||
{
|
||||
Weight = 1.0;
|
||||
DyeType = type;
|
||||
UsesRemaining = 5;
|
||||
|
||||
BooksOnly = booksonly;
|
||||
}
|
||||
|
||||
public void ValidateHue()
|
||||
{
|
||||
if (HueInfo.ContainsKey(this.DyeType))
|
||||
{
|
||||
Hue = HueInfo[this.DyeType].Item1;
|
||||
}
|
||||
}
|
||||
|
||||
public SpecialNaturalDye(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override int LabelNumber
|
||||
{
|
||||
get
|
||||
{
|
||||
return 1112136;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool ForceShowProperties
|
||||
{
|
||||
get
|
||||
{
|
||||
return ObjectPropertyList.Enabled;
|
||||
}
|
||||
}
|
||||
|
||||
public override void GetProperties(ObjectPropertyList list)
|
||||
{
|
||||
base.GetProperties(list);
|
||||
|
||||
list.Add(1060584, this.m_UsesRemaining.ToString()); // uses remaining: ~1_val~
|
||||
|
||||
if (m_BooksOnly)
|
||||
list.Add(1157205); // Spellbook Only Dye
|
||||
}
|
||||
|
||||
public override void AddNameProperty(ObjectPropertyList list)
|
||||
{
|
||||
if (this.DyeType == DyeType.None)
|
||||
{
|
||||
base.AddNameProperty(list);
|
||||
}
|
||||
else if (this.Amount > 1)
|
||||
{
|
||||
list.Add(1113276, "{0}\t{1}", this.Amount, String.Format("#{0}", HueInfo[this.DyeType].Item2)); // ~1_AMOUNT~ ~2_COLOR~ natural dyes
|
||||
}
|
||||
else
|
||||
{
|
||||
list.Add(1112137, String.Format("#{0}", HueInfo[this.DyeType].Item2)); // ~1_COLOR~ natural dye
|
||||
}
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write((int)0); // version
|
||||
|
||||
writer.Write((int)this.m_DyeType);
|
||||
writer.Write((int)this.m_UsesRemaining);
|
||||
writer.Write(m_BooksOnly);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
this.m_DyeType = (DyeType)reader.ReadInt();
|
||||
this.m_UsesRemaining = reader.ReadInt();
|
||||
this.m_BooksOnly = reader.ReadBool();
|
||||
}
|
||||
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
from.SendLocalizedMessage(1112139); // Select the item you wish to dye.
|
||||
from.Target = new InternalTarget(this);
|
||||
}
|
||||
|
||||
private class InternalTarget : Target
|
||||
{
|
||||
private readonly SpecialNaturalDye m_Item;
|
||||
|
||||
public InternalTarget(SpecialNaturalDye item)
|
||||
: base(1, false, TargetFlags.None)
|
||||
{
|
||||
this.m_Item = item;
|
||||
}
|
||||
|
||||
protected override void OnTarget(Mobile from, object targeted)
|
||||
{
|
||||
if (this.m_Item.Deleted)
|
||||
return;
|
||||
|
||||
Item item = targeted as Item;
|
||||
bool valid = false;
|
||||
|
||||
if (item != null)
|
||||
{
|
||||
if (m_Item.BooksOnly && !(item is Spellbook))
|
||||
{
|
||||
valid = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
valid = (item is IDyable ||
|
||||
item is BaseBook || item is BaseClothing ||
|
||||
item is BaseJewel || item is BaseStatuette ||
|
||||
item is BaseWeapon || item is Runebook ||
|
||||
item is BaseTalisman || item is Spellbook ||
|
||||
item.IsArtifact || BasePigmentsOfTokuno.IsValidItem(item));
|
||||
|
||||
if (!valid && item is BaseArmor)
|
||||
{
|
||||
CraftResourceType restype = CraftResources.GetType(((BaseArmor)item).Resource);
|
||||
if ((CraftResourceType.Leather == restype || CraftResourceType.Metal == restype) &&
|
||||
ArmorMaterialType.Bone != ((BaseArmor)item).MaterialType)
|
||||
{
|
||||
valid = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!valid && FurnitureAttribute.Check(item))
|
||||
{
|
||||
if (!from.InRange(this.m_Item.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1))
|
||||
{
|
||||
from.SendLocalizedMessage(500446); // That is too far away.
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
BaseHouse house = BaseHouse.FindHouseAt(item);
|
||||
|
||||
if (house == null || (!house.IsLockedDown(item) && !house.IsSecure(item)))
|
||||
{
|
||||
from.SendLocalizedMessage(501022); // Furniture must be locked down to paint it.
|
||||
return;
|
||||
}
|
||||
else if (!house.IsCoOwner(from))
|
||||
{
|
||||
from.SendLocalizedMessage(501023); // You must be the owner to use this item.
|
||||
return;
|
||||
}
|
||||
else
|
||||
valid = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (valid)
|
||||
{
|
||||
item.Hue = m_Item.Hue;
|
||||
from.PlaySound(0x23E);
|
||||
|
||||
if (--this.m_Item.UsesRemaining > 0)
|
||||
this.m_Item.InvalidateProperties();
|
||||
else
|
||||
this.m_Item.Delete();
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
from.SendLocalizedMessage(1042083); // You cannot dye that.
|
||||
}
|
||||
}
|
||||
|
||||
public static Dictionary<DyeType, Tuple<int, int>> HueInfo;
|
||||
|
||||
public static void Configure()
|
||||
{
|
||||
HueInfo = new Dictionary<DyeType, Tuple<int, int>>();
|
||||
|
||||
HueInfo[DyeType.WindAzul] = new Tuple<int, int>(2741, 1157277);
|
||||
HueInfo[DyeType.DullRuby] = new Tuple<int, int>(2731, 1157267);
|
||||
HueInfo[DyeType.PoppieWhite] = new Tuple<int, int>(2735, 1157271);
|
||||
HueInfo[DyeType.ZentoOrchid] = new Tuple<int, int>(2732, 1157268);
|
||||
HueInfo[DyeType.UmbranViolet] = new Tuple<int, int>(2740, 1157276);
|
||||
}
|
||||
}
|
||||
}
|
||||
115
Scripts/Services/BulkOrders/LargeBODs/LargeAlchemyBOD.cs
Normal file
115
Scripts/Services/BulkOrders/LargeBODs/LargeAlchemyBOD.cs
Normal file
@@ -0,0 +1,115 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
public class LargeAlchemyBOD : LargeBOD
|
||||
{
|
||||
public override BODType BODType { get { return BODType.Alchemy; } }
|
||||
|
||||
[Constructable]
|
||||
public LargeAlchemyBOD()
|
||||
{
|
||||
LargeBulkEntry[] entries;
|
||||
|
||||
switch ( Utility.Random(5) )
|
||||
{
|
||||
default:
|
||||
case 0:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.LargeExplosive);
|
||||
break;
|
||||
case 1:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.LargeGreater);
|
||||
break;
|
||||
case 2:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.LargeLesser);
|
||||
break;
|
||||
case 3:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.LargeRegular);
|
||||
break;
|
||||
case 4:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.LargeToxic);
|
||||
break;
|
||||
}
|
||||
|
||||
int amountMax = Utility.RandomList(10, 15, 20, 20);
|
||||
|
||||
this.Hue = 2505;
|
||||
this.AmountMax = amountMax;
|
||||
this.Entries = entries;
|
||||
}
|
||||
|
||||
public LargeAlchemyBOD(int amountMax, bool reqExceptional, BulkMaterialType mat, LargeBulkEntry[] entries)
|
||||
{
|
||||
this.Hue = 2505;
|
||||
this.AmountMax = amountMax;
|
||||
this.Entries = entries;
|
||||
this.RequireExceptional = reqExceptional;
|
||||
this.Material = mat;
|
||||
}
|
||||
|
||||
public LargeAlchemyBOD(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override int ComputeFame()
|
||||
{
|
||||
return AlchemyRewardCalculator.Instance.ComputeFame(this);
|
||||
}
|
||||
|
||||
public override int ComputeGold()
|
||||
{
|
||||
return AlchemyRewardCalculator.Instance.ComputeGold(this);
|
||||
}
|
||||
|
||||
public override List<Item> ComputeRewards(bool full)
|
||||
{
|
||||
List<Item> list = new List<Item>();
|
||||
|
||||
RewardGroup rewardGroup = AlchemyRewardCalculator.Instance.LookupRewards(AlchemyRewardCalculator.Instance.ComputePoints(this));
|
||||
|
||||
if (rewardGroup != null)
|
||||
{
|
||||
if (full)
|
||||
{
|
||||
for (int i = 0; i < rewardGroup.Items.Length; ++i)
|
||||
{
|
||||
Item item = rewardGroup.Items[i].Construct();
|
||||
|
||||
if (item != null)
|
||||
list.Add(item);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
RewardItem rewardItem = rewardGroup.AcquireItem();
|
||||
|
||||
if (rewardItem != null)
|
||||
{
|
||||
Item item = rewardItem.Construct();
|
||||
|
||||
if (item != null)
|
||||
list.Add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write((int)0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
335
Scripts/Services/BulkOrders/LargeBODs/LargeBOD.cs
Normal file
335
Scripts/Services/BulkOrders/LargeBODs/LargeBOD.cs
Normal file
@@ -0,0 +1,335 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Server.Mobiles;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
[TypeAlias("Scripts.Engines.BulkOrders.LargeBOD")]
|
||||
public abstract class LargeBOD : Item, IBOD
|
||||
{
|
||||
public abstract BODType BODType { get; }
|
||||
|
||||
private int m_AmountMax;
|
||||
private bool m_RequireExceptional;
|
||||
private BulkMaterialType m_Material;
|
||||
private LargeBulkEntry[] m_Entries;
|
||||
|
||||
public LargeBOD(int hue, int amountMax, bool requireExeptional, BulkMaterialType material, LargeBulkEntry[] entries)
|
||||
: base(Core.AOS ? 0x2258 : 0x14EF)
|
||||
{
|
||||
Weight = 1.0;
|
||||
Hue = hue; // Blacksmith: 0x44E; Tailoring: 0x483
|
||||
LootType = LootType.Blessed;
|
||||
|
||||
m_AmountMax = amountMax;
|
||||
m_RequireExceptional = requireExeptional;
|
||||
m_Material = material;
|
||||
m_Entries = entries;
|
||||
}
|
||||
|
||||
public LargeBOD()
|
||||
: base(Core.AOS ? 0x2258 : 0x14EF)
|
||||
{
|
||||
Weight = 1.0;
|
||||
LootType = LootType.Blessed;
|
||||
}
|
||||
|
||||
public LargeBOD(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int AmountMax
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_AmountMax;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_AmountMax = value;
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public bool RequireExceptional
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_RequireExceptional;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_RequireExceptional = value;
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public BulkMaterialType Material
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Material;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_Material = value;
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
public LargeBulkEntry[] Entries
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Entries;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_Entries = value;
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public bool Complete
|
||||
{
|
||||
get
|
||||
{
|
||||
for (int i = 0; i < m_Entries.Length; ++i)
|
||||
{
|
||||
if (m_Entries[i].Amount < m_AmountMax)
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value)
|
||||
{
|
||||
for (int i = 0; i < m_Entries.Length; ++i)
|
||||
{
|
||||
m_Entries[i].Amount = m_AmountMax;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public override int LabelNumber
|
||||
{
|
||||
get
|
||||
{
|
||||
return 1045151;
|
||||
}
|
||||
}// a bulk order deed
|
||||
public static BulkMaterialType GetRandomMaterial(BulkMaterialType start, double[] chances)
|
||||
{
|
||||
double random = Utility.RandomDouble();
|
||||
|
||||
for (int i = 0; i < chances.Length; ++i)
|
||||
{
|
||||
if (random < chances[i])
|
||||
return (i == 0 ? BulkMaterialType.None : start + (i - 1));
|
||||
|
||||
random -= chances[i];
|
||||
}
|
||||
|
||||
return BulkMaterialType.None;
|
||||
}
|
||||
|
||||
public abstract List<Item> ComputeRewards(bool full);
|
||||
|
||||
public abstract int ComputeGold();
|
||||
|
||||
public abstract int ComputeFame();
|
||||
|
||||
public virtual void GetRewards(out Item reward, out int gold, out int fame)
|
||||
{
|
||||
reward = null;
|
||||
gold = ComputeGold();
|
||||
fame = ComputeFame();
|
||||
|
||||
if (!BulkOrderSystem.NewSystemEnabled)
|
||||
{
|
||||
List<Item> rewards = ComputeRewards(false);
|
||||
|
||||
if (rewards.Count > 0)
|
||||
{
|
||||
reward = rewards[Utility.Random(rewards.Count)];
|
||||
|
||||
for (int i = 0; i < rewards.Count; ++i)
|
||||
{
|
||||
if (rewards[i] != reward)
|
||||
rewards[i].Delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void GetProperties(ObjectPropertyList list)
|
||||
{
|
||||
base.GetProperties(list);
|
||||
|
||||
list.Add(1060655); // large bulk order
|
||||
|
||||
if (m_RequireExceptional)
|
||||
list.Add(1045141); // All items must be exceptional.
|
||||
|
||||
if (m_Material != BulkMaterialType.None)
|
||||
list.Add(SmallBODGump.GetMaterialNumberFor(m_Material)); // All items must be made with x material.
|
||||
|
||||
list.Add(1060656, m_AmountMax.ToString()); // amount to make: ~1_val~
|
||||
|
||||
for (int i = 0; i < m_Entries.Length; ++i)
|
||||
list.Add(1060658 + i, "#{0}\t{1}", m_Entries[i].Details.Number, m_Entries[i].Amount); // ~1_val~: ~2_val~
|
||||
}
|
||||
|
||||
public override void OnDoubleClickNotAccessible(Mobile from)
|
||||
{
|
||||
OnDoubleClick(from);
|
||||
}
|
||||
|
||||
public override void OnDoubleClickSecureTrade(Mobile from)
|
||||
{
|
||||
OnDoubleClick(from);
|
||||
}
|
||||
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
if (IsChildOf(from.Backpack) || InSecureTrade || RootParent is PlayerVendor)
|
||||
{
|
||||
EventSink.InvokeBODUsed(new BODUsedEventArgs(from, this));
|
||||
from.SendGump(new LargeBODGump(from, this));
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage(1045156); // You must have the deed in your backpack to use it.
|
||||
}
|
||||
}
|
||||
|
||||
public void BeginCombine(Mobile from)
|
||||
{
|
||||
if (!Complete)
|
||||
from.Target = new LargeBODTarget(this);
|
||||
else
|
||||
from.SendLocalizedMessage(1045166); // The maximum amount of requested items have already been combined to this deed.
|
||||
}
|
||||
|
||||
public void EndCombine(Mobile from, object o)
|
||||
{
|
||||
if (o is Item && ((Item)o).IsChildOf(from.Backpack))
|
||||
{
|
||||
if (o is SmallBOD)
|
||||
{
|
||||
SmallBOD small = (SmallBOD)o;
|
||||
|
||||
LargeBulkEntry entry = null;
|
||||
|
||||
for (int i = 0; entry == null && i < m_Entries.Length; ++i)
|
||||
{
|
||||
if (CheckType(small, m_Entries[i].Details.Type))
|
||||
entry = m_Entries[i];
|
||||
}
|
||||
|
||||
if (entry == null)
|
||||
{
|
||||
from.SendLocalizedMessage(1045160); // That is not a bulk order for this large request.
|
||||
}
|
||||
else if (m_RequireExceptional && !small.RequireExceptional)
|
||||
{
|
||||
from.SendLocalizedMessage(1045161); // Both orders must be of exceptional quality.
|
||||
}
|
||||
else if (small.Material != m_Material && m_Material != BulkMaterialType.None)
|
||||
{
|
||||
from.SendLocalizedMessage(1157311); // Both orders must use the same resource type.
|
||||
}
|
||||
else if (m_AmountMax != small.AmountMax)
|
||||
{
|
||||
from.SendLocalizedMessage(1045163); // The two orders have different requested amounts and cannot be combined.
|
||||
}
|
||||
else if (small.AmountCur < small.AmountMax)
|
||||
{
|
||||
from.SendLocalizedMessage(1045164); // The order to combine with is not completed.
|
||||
}
|
||||
else if (entry.Amount >= m_AmountMax)
|
||||
{
|
||||
from.SendLocalizedMessage(1045166); // The maximum amount of requested items have already been combined to this deed.
|
||||
}
|
||||
else
|
||||
{
|
||||
entry.Amount += small.AmountCur;
|
||||
small.Delete();
|
||||
|
||||
from.SendLocalizedMessage(1045165); // The orders have been combined.
|
||||
|
||||
from.SendGump(new LargeBODGump(from, this));
|
||||
|
||||
if (!Complete)
|
||||
BeginCombine(from);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage(1045159); // That is not a bulk order.
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage(1045158); // You must have the item in your backpack to target it.
|
||||
}
|
||||
}
|
||||
|
||||
public virtual bool CheckType(SmallBOD small, Type type)
|
||||
{
|
||||
return small.CheckType(type);
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write((int)1); // version
|
||||
|
||||
writer.Write(m_AmountMax);
|
||||
writer.Write(m_RequireExceptional);
|
||||
writer.Write((int)m_Material);
|
||||
|
||||
writer.Write((int)m_Entries.Length);
|
||||
|
||||
for (int i = 0; i < m_Entries.Length; ++i)
|
||||
m_Entries[i].Serialize(writer);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 1:
|
||||
case 0:
|
||||
{
|
||||
m_AmountMax = reader.ReadInt();
|
||||
m_RequireExceptional = reader.ReadBool();
|
||||
m_Material = (BulkMaterialType)reader.ReadInt();
|
||||
|
||||
m_Entries = new LargeBulkEntry[reader.ReadInt()];
|
||||
|
||||
for (int i = 0; i < m_Entries.Length; ++i)
|
||||
m_Entries[i] = new LargeBulkEntry(this, reader, version);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (Weight == 0.0)
|
||||
Weight = 1.0;
|
||||
|
||||
if (Core.AOS && ItemID == 0x14EF)
|
||||
ItemID = 0x2258;
|
||||
|
||||
if (Parent == null && Map == Map.Internal && Location == Point3D.Zero)
|
||||
Delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
106
Scripts/Services/BulkOrders/LargeBODs/LargeBODAcceptGump.cs
Normal file
106
Scripts/Services/BulkOrders/LargeBODs/LargeBODAcceptGump.cs
Normal file
@@ -0,0 +1,106 @@
|
||||
using System;
|
||||
using Server.Gumps;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
public class LargeBODAcceptGump : Gump
|
||||
{
|
||||
private readonly LargeBOD m_Deed;
|
||||
private readonly Mobile m_From;
|
||||
public LargeBODAcceptGump(Mobile from, LargeBOD deed)
|
||||
: base(50, 50)
|
||||
{
|
||||
m_From = from;
|
||||
m_Deed = deed;
|
||||
|
||||
m_From.CloseGump(typeof(LargeBODAcceptGump));
|
||||
m_From.CloseGump(typeof(SmallBODAcceptGump));
|
||||
|
||||
LargeBulkEntry[] entries = deed.Entries;
|
||||
|
||||
AddPage(0);
|
||||
|
||||
AddBackground(25, 10, 430, 240 + (entries.Length * 24), 5054);
|
||||
|
||||
AddImageTiled(33, 20, 413, 221 + (entries.Length * 24), 2624);
|
||||
AddAlphaRegion(33, 20, 413, 221 + (entries.Length * 24));
|
||||
|
||||
AddImage(20, 5, 10460);
|
||||
AddImage(430, 5, 10460);
|
||||
AddImage(20, 225 + (entries.Length * 24), 10460);
|
||||
AddImage(430, 225 + (entries.Length * 24), 10460);
|
||||
|
||||
AddHtmlLocalized(180, 25, 120, 20, 1045134, 0x7FFF, false, false); // A large bulk order
|
||||
|
||||
AddHtmlLocalized(40, 48, 350, 20, 1045135, 0x7FFF, false, false); // Ah! Thanks for the goods! Would you help me out?
|
||||
|
||||
AddHtmlLocalized(40, 72, 210, 20, 1045138, 0x7FFF, false, false); // Amount to make:
|
||||
AddLabel(250, 72, 1152, deed.AmountMax.ToString());
|
||||
|
||||
AddHtmlLocalized(40, 96, 120, 20, 1045137, 0x7FFF, false, false); // Items requested:
|
||||
|
||||
int y = 120;
|
||||
|
||||
for (int i = 0; i < entries.Length; ++i, y += 24)
|
||||
AddHtmlLocalized(40, y, 210, 20, entries[i].Details.Number, 0x7FFF, false, false);
|
||||
|
||||
if (deed.RequireExceptional || deed.Material != BulkMaterialType.None)
|
||||
{
|
||||
AddHtmlLocalized(40, y, 210, 20, 1045140, 0x7FFF, false, false); // Special requirements to meet:
|
||||
y += 24;
|
||||
|
||||
if (deed.RequireExceptional)
|
||||
{
|
||||
AddHtmlLocalized(40, y, 350, 20, 1045141, 0x7FFF, false, false); // All items must be exceptional.
|
||||
y += 24;
|
||||
}
|
||||
|
||||
if (deed.Material != BulkMaterialType.None)
|
||||
{
|
||||
AddHtmlLocalized(40, y, 350, 20, SmallBODGump.GetMaterialNumberFor(deed.Material), 0x7FFF, false, false); // All items must be made with x material.
|
||||
y += 24;
|
||||
}
|
||||
}
|
||||
|
||||
AddHtmlLocalized(40, 192 + (entries.Length * 24), 350, 20, 1045139, 0x7FFF, false, false); // Do you want to accept this order?
|
||||
|
||||
AddButton(100, 216 + (entries.Length * 24), 4005, 4007, 1, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(135, 216 + (entries.Length * 24), 120, 20, 1006044, 0x7FFF, false, false); // Ok
|
||||
|
||||
AddButton(275, 216 + (entries.Length * 24), 4005, 4007, 0, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(310, 216 + (entries.Length * 24), 120, 20, 1011012, 0x7FFF, false, false); // CANCEL
|
||||
}
|
||||
|
||||
public override void OnServerClose(NetState owner)
|
||||
{
|
||||
Timer.DelayCall(() =>
|
||||
{
|
||||
if (m_Deed.Map == null || m_Deed.Map == Map.Internal)
|
||||
{
|
||||
m_Deed.Delete();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
{
|
||||
if (info.ButtonID == 1) // Ok
|
||||
{
|
||||
if (m_From.PlaceInBackpack(m_Deed))
|
||||
{
|
||||
m_From.SendLocalizedMessage(1045152); // The bulk order deed has been placed in your backpack.
|
||||
}
|
||||
else
|
||||
{
|
||||
m_From.SendLocalizedMessage(1045150); // There is not enough room in your backpack for the deed.
|
||||
m_Deed.Delete();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Deed.Delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
173
Scripts/Services/BulkOrders/LargeBODs/LargeBODGump.cs
Normal file
173
Scripts/Services/BulkOrders/LargeBODs/LargeBODGump.cs
Normal file
@@ -0,0 +1,173 @@
|
||||
using System;
|
||||
using Server.Gumps;
|
||||
using Server.Network;
|
||||
using Server.Mobiles;
|
||||
using Server.Items;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
public class LargeBODGump : Gump
|
||||
{
|
||||
private readonly LargeBOD m_Deed;
|
||||
private readonly Mobile m_From;
|
||||
public LargeBODGump(Mobile from, LargeBOD deed)
|
||||
: base(25, 25)
|
||||
{
|
||||
m_From = from;
|
||||
m_Deed = deed;
|
||||
|
||||
m_From.CloseGump(typeof(LargeBODGump));
|
||||
m_From.CloseGump(typeof(SmallBODGump));
|
||||
|
||||
LargeBulkEntry[] entries = deed.Entries;
|
||||
|
||||
AddPage(0);
|
||||
|
||||
int height = 0;
|
||||
|
||||
if (BulkOrderSystem.NewSystemEnabled)
|
||||
{
|
||||
if (deed.RequireExceptional || deed.Material != BulkMaterialType.None)
|
||||
height += 24;
|
||||
|
||||
if (deed.RequireExceptional)
|
||||
height += 24;
|
||||
|
||||
if (deed.Material != BulkMaterialType.None)
|
||||
height += 24;
|
||||
}
|
||||
|
||||
AddBackground(50, 10, 455, 218 + height + (entries.Length * 24), 5054);
|
||||
|
||||
AddImageTiled(58, 20, 438, 200 + height + (entries.Length * 24), 2624);
|
||||
AddAlphaRegion(58, 20, 438, 200 + height + (entries.Length * 24));
|
||||
|
||||
AddImage(45, 5, 10460);
|
||||
AddImage(480, 5, 10460);
|
||||
AddImage(45, 203 + height + (entries.Length * 24), 10460);
|
||||
AddImage(480, 203 + height + (entries.Length * 24), 10460);
|
||||
|
||||
AddHtmlLocalized(225, 25, 120, 20, 1045134, 0x7FFF, false, false); // A large bulk order
|
||||
|
||||
AddHtmlLocalized(75, 48, 250, 20, 1045138, 0x7FFF, false, false); // Amount to make:
|
||||
AddLabel(275, 48, 1152, deed.AmountMax.ToString());
|
||||
|
||||
AddHtmlLocalized(75, 72, 120, 20, 1045137, 0x7FFF, false, false); // Items requested:
|
||||
AddHtmlLocalized(275, 76, 200, 20, 1045153, 0x7FFF, false, false); // Amount finished:
|
||||
|
||||
int y = 96;
|
||||
|
||||
for (int i = 0; i < entries.Length; ++i)
|
||||
{
|
||||
LargeBulkEntry entry = entries[i];
|
||||
SmallBulkEntry details = entry.Details;
|
||||
|
||||
AddHtmlLocalized(75, y, 210, 20, details.Number, 0x7FFF, false, false);
|
||||
AddLabel(275, y, 0x480, entry.Amount.ToString());
|
||||
|
||||
y += 24;
|
||||
}
|
||||
|
||||
if (deed.RequireExceptional || deed.Material != BulkMaterialType.None)
|
||||
{
|
||||
AddHtmlLocalized(75, y, 200, 20, 1045140, 0x7FFF, false, false); // Special requirements to meet:
|
||||
y += 24;
|
||||
}
|
||||
|
||||
if (deed.RequireExceptional)
|
||||
{
|
||||
AddHtmlLocalized(75, y, 300, 20, 1045141, 0x7FFF, false, false); // All items must be exceptional.
|
||||
y += 24;
|
||||
}
|
||||
|
||||
if (deed.Material != BulkMaterialType.None)
|
||||
{
|
||||
AddHtmlLocalized(75, y, 300, 20, SmallBODGump.GetMaterialNumberFor(deed.Material), 0x7FFF, false, false); // All items must be made with x material.
|
||||
y += 24;
|
||||
}
|
||||
|
||||
if (BulkOrderSystem.NewSystemEnabled)
|
||||
{
|
||||
BODContext c = BulkOrderSystem.GetContext((PlayerMobile)from);
|
||||
|
||||
int points = 0;
|
||||
double banked = 0.0;
|
||||
|
||||
BulkOrderSystem.ComputePoints(deed, out points, out banked);
|
||||
|
||||
AddHtmlLocalized(75, y, 300, 20, 1157301, String.Format("{0}\t{1}", points, banked.ToString("0.000000")), 0x7FFF, false, false); // Worth ~1_POINTS~ turn in points and ~2_POINTS~ bank points.
|
||||
y += 24;
|
||||
|
||||
AddButton(125, y, 4005, 4007, 3, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(160, y, 300, 20, c.PointsMode == PointsMode.Enabled ? 1157302 : c.PointsMode == PointsMode.Disabled ? 1157303 : 1157309, 0x7FFF, false, false); // Banking Points Enabled/Disabled/Automatic
|
||||
y += 24;
|
||||
|
||||
AddButton(125, y, 4005, 4007, 2, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(160, y, 300, 20, 1045154, 0x7FFF, false, false); // Combine this deed with the item requested.
|
||||
y += 24;
|
||||
|
||||
AddButton(125, y, 4005, 4007, 4, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(160, y, 300, 20, 1157304, 0x7FFF, false, false); // Combine this deed with contained items.
|
||||
y += 24;
|
||||
|
||||
AddButton(125, y, 4005, 4007, 1, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(160, y, 120, 20, 1011441, 0x7FFF, false, false); // EXIT
|
||||
}
|
||||
else
|
||||
{
|
||||
AddButton(125, 168 + (entries.Length * 24), 4005, 4007, 2, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(160, 168 + (entries.Length * 24), 300, 20, 1045155, 0x7FFF, false, false); // Combine this deed with another deed.
|
||||
|
||||
AddButton(125, 192 + (entries.Length * 24), 4005, 4007, 1, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(160, 192 + (entries.Length * 24), 120, 20, 1011441, 0x7FFF, false, false); // EXIT
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
{
|
||||
if (m_Deed.Deleted || !m_Deed.IsChildOf(m_From.Backpack))
|
||||
return;
|
||||
|
||||
if (info.ButtonID == 2) // Combine
|
||||
{
|
||||
m_From.SendGump(new LargeBODGump(m_From, m_Deed));
|
||||
m_Deed.BeginCombine(m_From);
|
||||
}
|
||||
else if (info.ButtonID == 3) // bank button
|
||||
{
|
||||
BODContext c = BulkOrderSystem.GetContext(m_From);
|
||||
|
||||
if (c != null)
|
||||
{
|
||||
switch (c.PointsMode)
|
||||
{
|
||||
case PointsMode.Enabled: c.PointsMode = PointsMode.Disabled; break;
|
||||
case PointsMode.Disabled: c.PointsMode = PointsMode.Automatic; break;
|
||||
case PointsMode.Automatic: c.PointsMode = PointsMode.Enabled; break;
|
||||
}
|
||||
}
|
||||
|
||||
m_From.SendGump(new LargeBODGump(m_From, m_Deed));
|
||||
}
|
||||
else if (info.ButtonID == 4) // combine from container
|
||||
{
|
||||
m_From.BeginTarget(-1, false, Server.Targeting.TargetFlags.None, (m, targeted) =>
|
||||
{
|
||||
if (!m_Deed.Deleted && targeted is Container)
|
||||
{
|
||||
List<SmallBOD> list = ((Container)targeted).Items.OfType<SmallBOD>().ToList();
|
||||
|
||||
foreach (SmallBOD item in list)
|
||||
{
|
||||
m_Deed.EndCombine(m_From, item);
|
||||
}
|
||||
|
||||
list.Clear();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
23
Scripts/Services/BulkOrders/LargeBODs/LargeBODTarget.cs
Normal file
23
Scripts/Services/BulkOrders/LargeBODs/LargeBODTarget.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using Server.Targeting;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
public class LargeBODTarget : Target
|
||||
{
|
||||
private readonly LargeBOD m_Deed;
|
||||
public LargeBODTarget(LargeBOD deed)
|
||||
: base(18, false, TargetFlags.None)
|
||||
{
|
||||
this.m_Deed = deed;
|
||||
}
|
||||
|
||||
protected override void OnTarget(Mobile from, object targeted)
|
||||
{
|
||||
if (this.m_Deed.Deleted || !this.m_Deed.IsChildOf(from.Backpack))
|
||||
return;
|
||||
|
||||
this.m_Deed.EndCombine(from, targeted);
|
||||
}
|
||||
}
|
||||
}
|
||||
527
Scripts/Services/BulkOrders/LargeBODs/LargeBulkEntry.cs
Normal file
527
Scripts/Services/BulkOrders/LargeBODs/LargeBulkEntry.cs
Normal file
@@ -0,0 +1,527 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
public class LargeBulkEntry
|
||||
{
|
||||
private static Hashtable m_Cache;
|
||||
private readonly SmallBulkEntry m_Details;
|
||||
private LargeBOD m_Owner;
|
||||
private int m_Amount;
|
||||
|
||||
public LargeBulkEntry(LargeBOD owner, SmallBulkEntry details)
|
||||
{
|
||||
this.m_Owner = owner;
|
||||
this.m_Details = details;
|
||||
}
|
||||
|
||||
public static SmallBulkEntry[] LargeRing
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Blacksmith", "largering");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] LargePlate
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Blacksmith", "largeplate");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] LargeChain
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Blacksmith", "largechain");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] LargeAxes
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Blacksmith", "largeaxes");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] LargeFencing
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Blacksmith", "largefencing");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] LargeMaces
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Blacksmith", "largemaces");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] LargePolearms
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Blacksmith", "largepolearms");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] LargeSwords
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Blacksmith", "largeswords");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] BoneSet
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Tailoring", "boneset");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] Farmer
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Tailoring", "farmer");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] FemaleLeatherSet
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Tailoring", "femaleleatherset");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] FisherGirl
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Tailoring", "fishergirl");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] Gypsy
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Tailoring", "gypsy");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] HatSet
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Tailoring", "hatset");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] Jester
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Tailoring", "jester");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] Lady
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Tailoring", "lady");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] MaleLeatherSet
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Tailoring", "maleleatherset");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] Pirate
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Tailoring", "pirate");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] ShoeSet
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Tailoring", "shoeset");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] StuddedSet
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Tailoring", "studdedset");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] TownCrier
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Tailoring", "towncrier");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] Wizard
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Tailoring", "wizard");
|
||||
}
|
||||
}
|
||||
#region Publics 95 BODs
|
||||
public static SmallBulkEntry[] LargeCircle1
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Inscription", "LargeCircle1");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] LargeCircle1and2
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Inscription", "LargeCircle1and2");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] LargeNecromancy1
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Inscription", "LargeNecromancy1");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] LargeNecromancy2
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Inscription", "LargeNecromancy2");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] LargeNecromancy3
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Inscription", "LargeNecromancy3");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] LargeCircle4
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Inscription", "LargeCircle4");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] LargeCircle5
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Inscription", "LargeCircle5");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] LargeCircle7
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Inscription", "LargeCircle7");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] LargeCircle8
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Inscription", "LargeCircle8");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] LargeBooks
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Inscription", "LargeBooks");
|
||||
}
|
||||
}
|
||||
|
||||
public static SmallBulkEntry[] LargeWeapons
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Carpentry", "LargeWeapons");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] LargeWoodFurniture
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Carpentry", "LargeWoodFurniture");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] LargeCabinets
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Carpentry", "LargeCabinets");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] LargeArmoire
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Carpentry", "LargeArmoire");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] LargeInstruments
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Carpentry", "LargeInstruments");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] LargeChests
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Carpentry", "LargeChests");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] LargeElvenWeapons
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Carpentry", "LargeElvenWeapons");
|
||||
}
|
||||
}
|
||||
|
||||
public static SmallBulkEntry[] LargeAmmunition
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Fletching", "LargeAmmunition");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] LargeHumanBows1
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Fletching", "LargeHumanBows1");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] LargeHumanBows2
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Fletching", "LargeHumanBows2");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] LargeElvenBows1
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Fletching", "LargeElvenBows1");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] LargeElvenBows2
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Fletching", "LargeElvenBows2");
|
||||
}
|
||||
}
|
||||
|
||||
public static SmallBulkEntry[] LargeExplosive
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Alchemy", "largeexplosive");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] LargeGreater
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Alchemy", "largegreater");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] LargeLesser
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Alchemy", "largelesser");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] LargeRegular
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Alchemy", "largeregular");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] LargeToxic
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Alchemy", "largetoxic");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] LargeKeyGlobe
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Tinkering", "LargeKeyGlobe");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] LargeTools
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Tinkering", "LargeTools");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] LargeJewelry
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Tinkering", "LargeJewelry");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] LargeDining
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Tinkering", "LargeDining");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] LargeBarbeque
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Cooking", "LargeBarbeque");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] LargeDough
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Cooking", "LargeDough");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] LargeFruits
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Cooking", "LargeFruits");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] LargeMiso
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Cooking", "LargeMiso");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] LargeSushi
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Cooking", "LargeSushi");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] LargeSweets
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Cooking", "LargeSweets");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] LargeUnbakedPies
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Cooking", "LargeUnbakedPies");
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
public LargeBOD Owner
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.m_Owner;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.m_Owner = value;
|
||||
}
|
||||
}
|
||||
public int Amount
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.m_Amount;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.m_Amount = value;
|
||||
if (this.m_Owner != null)
|
||||
this.m_Owner.InvalidateProperties();
|
||||
}
|
||||
}
|
||||
public SmallBulkEntry Details
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.m_Details;
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] GetEntries(string type, string name)
|
||||
{
|
||||
if (m_Cache == null)
|
||||
m_Cache = new Hashtable();
|
||||
|
||||
Hashtable table = (Hashtable)m_Cache[type];
|
||||
|
||||
if (table == null)
|
||||
m_Cache[type] = table = new Hashtable();
|
||||
|
||||
SmallBulkEntry[] entries = (SmallBulkEntry[])table[name];
|
||||
|
||||
if (entries == null)
|
||||
table[name] = entries = SmallBulkEntry.LoadEntries(type, name);
|
||||
|
||||
return entries;
|
||||
}
|
||||
|
||||
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]);
|
||||
|
||||
return large;
|
||||
}
|
||||
|
||||
public LargeBulkEntry(LargeBOD owner, GenericReader reader, int version)
|
||||
{
|
||||
this.m_Owner = owner;
|
||||
this.m_Amount = reader.ReadInt();
|
||||
|
||||
Type realType = null;
|
||||
|
||||
string type = reader.ReadString();
|
||||
|
||||
if (type != null)
|
||||
realType = ScriptCompiler.FindTypeByFullName(type);
|
||||
|
||||
this.m_Details = new SmallBulkEntry(realType, reader.ReadInt(), reader.ReadInt(), version == 0 ? 0 : reader.ReadInt());
|
||||
}
|
||||
|
||||
public void Serialize(GenericWriter writer)
|
||||
{
|
||||
writer.Write(this.m_Amount);
|
||||
writer.Write(this.m_Details.Type == null ? null : this.m_Details.Type.FullName);
|
||||
writer.Write(this.m_Details.Number);
|
||||
writer.Write(this.m_Details.Graphic);
|
||||
writer.Write(this.m_Details.Hue);
|
||||
}
|
||||
}
|
||||
}
|
||||
144
Scripts/Services/BulkOrders/LargeBODs/LargeCarpentryBOD.cs
Normal file
144
Scripts/Services/BulkOrders/LargeBODs/LargeCarpentryBOD.cs
Normal file
@@ -0,0 +1,144 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
public class LargeCarpentryBOD : LargeBOD
|
||||
{
|
||||
public override BODType BODType { get { return BODType.Carpentry; } }
|
||||
|
||||
public static double[] m_CarpentryingMaterialChances = new double[]
|
||||
{
|
||||
0.513718750, // None
|
||||
0.292968750, // Oak
|
||||
0.117187500, // Ash
|
||||
0.046875000, // Yew
|
||||
0.018750000, // Heartwood
|
||||
0.007500000, // Bloodwood
|
||||
0.003000000 // Frostwood
|
||||
};
|
||||
|
||||
[Constructable]
|
||||
public LargeCarpentryBOD()
|
||||
{
|
||||
LargeBulkEntry[] entries;
|
||||
bool useMaterials = true;
|
||||
|
||||
switch (Utility.Random(7))
|
||||
{
|
||||
default:
|
||||
case 0:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.LargeArmoire);
|
||||
break;
|
||||
case 1:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.LargeCabinets);
|
||||
break;
|
||||
case 2:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.LargeChests);
|
||||
break;
|
||||
case 3:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.LargeElvenWeapons);
|
||||
break;
|
||||
case 4:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.LargeInstruments);
|
||||
break;
|
||||
case 5:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.LargeWeapons);
|
||||
break;
|
||||
case 6:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.LargeWoodFurniture);
|
||||
break;
|
||||
}
|
||||
|
||||
int hue = 1512;
|
||||
int amountMax = Utility.RandomList(10, 15, 20, 20);
|
||||
bool reqExceptional = (0.825 > Utility.RandomDouble());
|
||||
|
||||
BulkMaterialType material;
|
||||
|
||||
if (useMaterials)
|
||||
material = GetRandomMaterial(BulkMaterialType.OakWood, m_CarpentryingMaterialChances);
|
||||
else
|
||||
material = BulkMaterialType.None;
|
||||
|
||||
this.Hue = hue;
|
||||
this.AmountMax = amountMax;
|
||||
this.Entries = entries;
|
||||
this.RequireExceptional = reqExceptional;
|
||||
this.Material = material;
|
||||
}
|
||||
|
||||
public LargeCarpentryBOD(int amountMax, bool reqExceptional, BulkMaterialType mat, LargeBulkEntry[] entries)
|
||||
{
|
||||
this.Hue = 1512;
|
||||
this.AmountMax = amountMax;
|
||||
this.Entries = entries;
|
||||
this.RequireExceptional = reqExceptional;
|
||||
this.Material = mat;
|
||||
}
|
||||
|
||||
public LargeCarpentryBOD(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override int ComputeFame()
|
||||
{
|
||||
return CarpentryRewardCalculator.Instance.ComputeFame(this);
|
||||
}
|
||||
|
||||
public override int ComputeGold()
|
||||
{
|
||||
return CarpentryRewardCalculator.Instance.ComputeGold(this);
|
||||
}
|
||||
|
||||
public override List<Item> ComputeRewards(bool full)
|
||||
{
|
||||
List<Item> list = new List<Item>();
|
||||
|
||||
RewardGroup rewardGroup = CarpentryRewardCalculator.Instance.LookupRewards(CarpentryRewardCalculator.Instance.ComputePoints(this));
|
||||
|
||||
if (rewardGroup != null)
|
||||
{
|
||||
if (full)
|
||||
{
|
||||
for (int i = 0; i < rewardGroup.Items.Length; ++i)
|
||||
{
|
||||
Item item = rewardGroup.Items[i].Construct();
|
||||
|
||||
if (item != null)
|
||||
list.Add(item);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
RewardItem rewardItem = rewardGroup.AcquireItem();
|
||||
|
||||
if (rewardItem != null)
|
||||
{
|
||||
Item item = rewardItem.Construct();
|
||||
|
||||
if (item != null)
|
||||
list.Add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write((int)0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
123
Scripts/Services/BulkOrders/LargeBODs/LargeCookingBOD.cs
Normal file
123
Scripts/Services/BulkOrders/LargeBODs/LargeCookingBOD.cs
Normal file
@@ -0,0 +1,123 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
public class LargeCookingBOD : LargeBOD
|
||||
{
|
||||
public override BODType BODType { get { return BODType.Cooking; } }
|
||||
|
||||
[Constructable]
|
||||
public LargeCookingBOD()
|
||||
{
|
||||
LargeBulkEntry[] entries;
|
||||
bool nonexceptional = false;
|
||||
|
||||
switch (Utility.Random(7))
|
||||
{
|
||||
default:
|
||||
case 0:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.LargeBarbeque);
|
||||
nonexceptional = true;
|
||||
break;
|
||||
case 1:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.LargeDough);
|
||||
break;
|
||||
case 2:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.LargeFruits);
|
||||
nonexceptional = true;
|
||||
break;
|
||||
case 3:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.LargeMiso);
|
||||
break;
|
||||
case 4:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.LargeSushi);
|
||||
break;
|
||||
case 5:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.LargeSweets);
|
||||
break;
|
||||
case 6:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.LargeUnbakedPies);
|
||||
break;
|
||||
}
|
||||
|
||||
this.Hue = 1169;
|
||||
this.AmountMax = Utility.RandomList(10, 15, 20, 20);
|
||||
this.Entries = entries;
|
||||
this.RequireExceptional = !nonexceptional && 0.825 > Utility.RandomDouble();
|
||||
}
|
||||
|
||||
public LargeCookingBOD(int amountMax, bool reqExceptional, BulkMaterialType mat, LargeBulkEntry[] entries)
|
||||
{
|
||||
this.Hue = 1169;
|
||||
this.AmountMax = amountMax;
|
||||
this.Entries = entries;
|
||||
this.RequireExceptional = reqExceptional;
|
||||
this.Material = mat;
|
||||
}
|
||||
|
||||
public LargeCookingBOD(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override int ComputeFame()
|
||||
{
|
||||
return CookingRewardCalculator.Instance.ComputeFame(this);
|
||||
}
|
||||
|
||||
public override int ComputeGold()
|
||||
{
|
||||
return CookingRewardCalculator.Instance.ComputeGold(this);
|
||||
}
|
||||
|
||||
public override List<Item> ComputeRewards(bool full)
|
||||
{
|
||||
List<Item> list = new List<Item>();
|
||||
|
||||
RewardGroup rewardGroup = CookingRewardCalculator.Instance.LookupRewards(CookingRewardCalculator.Instance.ComputePoints(this));
|
||||
|
||||
if (rewardGroup != null)
|
||||
{
|
||||
if (full)
|
||||
{
|
||||
for (int i = 0; i < rewardGroup.Items.Length; ++i)
|
||||
{
|
||||
Item item = rewardGroup.Items[i].Construct();
|
||||
|
||||
if (item != null)
|
||||
list.Add(item);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
RewardItem rewardItem = rewardGroup.AcquireItem();
|
||||
|
||||
if (rewardItem != null)
|
||||
{
|
||||
Item item = rewardItem.Construct();
|
||||
|
||||
if (item != null)
|
||||
list.Add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write((int)0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
139
Scripts/Services/BulkOrders/LargeBODs/LargeFletchingBOD.cs
Normal file
139
Scripts/Services/BulkOrders/LargeBODs/LargeFletchingBOD.cs
Normal file
@@ -0,0 +1,139 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
public class LargeFletchingBOD : LargeBOD
|
||||
{
|
||||
public override BODType BODType { get { return BODType.Fletching; } }
|
||||
|
||||
public static double[] m_FletchingingMaterialChances = new double[]
|
||||
{
|
||||
0.513718750, // None
|
||||
0.292968750, // Oak
|
||||
0.117187500, // Ash
|
||||
0.046875000, // Yew
|
||||
0.018750000, // Heartwood
|
||||
0.007500000, // Bloodwood
|
||||
0.003000000 // Frostwood
|
||||
};
|
||||
|
||||
[Constructable]
|
||||
public LargeFletchingBOD()
|
||||
{
|
||||
LargeBulkEntry[] entries;
|
||||
bool useMaterials = true;
|
||||
|
||||
switch (Utility.Random(5))
|
||||
{
|
||||
default:
|
||||
case 0:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.LargeHumanBows1);
|
||||
break;
|
||||
case 1:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.LargeHumanBows2);
|
||||
break;
|
||||
case 2:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.LargeAmmunition);
|
||||
useMaterials = false;
|
||||
break;
|
||||
case 3:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.LargeElvenBows1);
|
||||
break;
|
||||
case 4:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.LargeElvenBows2);
|
||||
break;
|
||||
}
|
||||
|
||||
int hue = 1425;
|
||||
int amountMax = Utility.RandomList(10, 15, 20, 20);
|
||||
bool reqExceptional = useMaterials && 0.825 > Utility.RandomDouble();
|
||||
|
||||
BulkMaterialType material;
|
||||
|
||||
if (useMaterials)
|
||||
material = GetRandomMaterial(BulkMaterialType.OakWood, m_FletchingingMaterialChances);
|
||||
else
|
||||
material = BulkMaterialType.None;
|
||||
|
||||
this.Hue = hue;
|
||||
this.AmountMax = amountMax;
|
||||
this.Entries = entries;
|
||||
this.RequireExceptional = reqExceptional;
|
||||
this.Material = material;
|
||||
}
|
||||
|
||||
public LargeFletchingBOD(int amountMax, bool reqExceptional, BulkMaterialType mat, LargeBulkEntry[] entries)
|
||||
{
|
||||
this.Hue = 1425;
|
||||
this.AmountMax = amountMax;
|
||||
this.Entries = entries;
|
||||
this.RequireExceptional = reqExceptional;
|
||||
this.Material = mat;
|
||||
}
|
||||
|
||||
public LargeFletchingBOD(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override int ComputeFame()
|
||||
{
|
||||
return FletchingRewardCalculator.Instance.ComputeFame(this);
|
||||
}
|
||||
|
||||
public override int ComputeGold()
|
||||
{
|
||||
return FletchingRewardCalculator.Instance.ComputeGold(this);
|
||||
}
|
||||
|
||||
public override List<Item> ComputeRewards(bool full)
|
||||
{
|
||||
List<Item> list = new List<Item>();
|
||||
|
||||
RewardGroup rewardGroup = FletchingRewardCalculator.Instance.LookupRewards(FletchingRewardCalculator.Instance.ComputePoints(this));
|
||||
|
||||
if (rewardGroup != null)
|
||||
{
|
||||
if (full)
|
||||
{
|
||||
for (int i = 0; i < rewardGroup.Items.Length; ++i)
|
||||
{
|
||||
Item item = rewardGroup.Items[i].Construct();
|
||||
|
||||
if (item != null)
|
||||
list.Add(item);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
RewardItem rewardItem = rewardGroup.AcquireItem();
|
||||
|
||||
if (rewardItem != null)
|
||||
{
|
||||
Item item = rewardItem.Construct();
|
||||
|
||||
if (item != null)
|
||||
list.Add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write((int)0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
130
Scripts/Services/BulkOrders/LargeBODs/LargeInscriptionBOD.cs
Normal file
130
Scripts/Services/BulkOrders/LargeBODs/LargeInscriptionBOD.cs
Normal file
@@ -0,0 +1,130 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
public class LargeInscriptionBOD : LargeBOD
|
||||
{
|
||||
public override BODType BODType { get { return BODType.Inscription; } }
|
||||
|
||||
[Constructable]
|
||||
public LargeInscriptionBOD()
|
||||
{
|
||||
LargeBulkEntry[] entries;
|
||||
|
||||
switch (Utility.Random(10))
|
||||
{
|
||||
default:
|
||||
case 0:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.LargeBooks);
|
||||
break;
|
||||
case 1:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.LargeCircle1);
|
||||
break;
|
||||
case 2:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.LargeCircle1and2);
|
||||
break;
|
||||
case 3:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.LargeCircle4);
|
||||
break;
|
||||
case 4:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.LargeCircle5);
|
||||
break;
|
||||
case 5:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.LargeCircle7);
|
||||
break;
|
||||
case 6:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.LargeCircle8);
|
||||
break;
|
||||
case 7:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.LargeNecromancy1);
|
||||
break;
|
||||
case 8:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.LargeNecromancy2);
|
||||
break;
|
||||
case 9:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.LargeNecromancy3);
|
||||
break;
|
||||
}
|
||||
|
||||
int amountMax = Utility.RandomList(10, 15, 20, 20);
|
||||
|
||||
this.Hue = 2598;
|
||||
this.AmountMax = amountMax;
|
||||
this.Entries = entries;
|
||||
}
|
||||
|
||||
public LargeInscriptionBOD(int amountMax, bool reqExceptional, BulkMaterialType mat, LargeBulkEntry[] entries)
|
||||
{
|
||||
this.Hue = 2598;
|
||||
this.AmountMax = amountMax;
|
||||
this.Entries = entries;
|
||||
this.RequireExceptional = reqExceptional;
|
||||
this.Material = mat;
|
||||
}
|
||||
|
||||
public LargeInscriptionBOD(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override int ComputeFame()
|
||||
{
|
||||
return InscriptionRewardCalculator.Instance.ComputeFame(this);
|
||||
}
|
||||
|
||||
public override int ComputeGold()
|
||||
{
|
||||
return InscriptionRewardCalculator.Instance.ComputeGold(this);
|
||||
}
|
||||
|
||||
public override List<Item> ComputeRewards(bool full)
|
||||
{
|
||||
List<Item> list = new List<Item>();
|
||||
|
||||
RewardGroup rewardGroup = InscriptionRewardCalculator.Instance.LookupRewards(InscriptionRewardCalculator.Instance.ComputePoints(this));
|
||||
|
||||
if (rewardGroup != null)
|
||||
{
|
||||
if (full)
|
||||
{
|
||||
for (int i = 0; i < rewardGroup.Items.Length; ++i)
|
||||
{
|
||||
Item item = rewardGroup.Items[i].Construct();
|
||||
|
||||
if (item != null)
|
||||
list.Add(item);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
RewardItem rewardItem = rewardGroup.AcquireItem();
|
||||
|
||||
if (rewardItem != null)
|
||||
{
|
||||
Item item = rewardItem.Construct();
|
||||
|
||||
if (item != null)
|
||||
list.Add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write((int)0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
154
Scripts/Services/BulkOrders/LargeBODs/LargeSmithBOD.cs
Normal file
154
Scripts/Services/BulkOrders/LargeBODs/LargeSmithBOD.cs
Normal file
@@ -0,0 +1,154 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
[TypeAlias("Scripts.Engines.BulkOrders.LargeSmithBOD")]
|
||||
public class LargeSmithBOD : LargeBOD
|
||||
{
|
||||
public override BODType BODType { get { return BODType.Smith; } }
|
||||
|
||||
public static double[] m_BlacksmithMaterialChances = new double[]
|
||||
{
|
||||
0.501953125, // None
|
||||
0.250000000, // Dull Copper
|
||||
0.125000000, // Shadow Iron
|
||||
0.062500000, // Copper
|
||||
0.031250000, // Bronze
|
||||
0.015625000, // Gold
|
||||
0.007812500, // Agapite
|
||||
0.003906250, // Verite
|
||||
0.001953125 // Valorite
|
||||
};
|
||||
[Constructable]
|
||||
public LargeSmithBOD()
|
||||
{
|
||||
LargeBulkEntry[] entries;
|
||||
bool useMaterials = true;
|
||||
|
||||
int rand = Utility.Random(8);
|
||||
|
||||
switch ( rand )
|
||||
{
|
||||
default:
|
||||
case 0:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.LargeRing);
|
||||
break;
|
||||
case 1:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.LargePlate);
|
||||
break;
|
||||
case 2:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.LargeChain);
|
||||
break;
|
||||
case 3:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.LargeAxes);
|
||||
break;
|
||||
case 4:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.LargeFencing);
|
||||
break;
|
||||
case 5:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.LargeMaces);
|
||||
break;
|
||||
case 6:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.LargePolearms);
|
||||
break;
|
||||
case 7:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.LargeSwords);
|
||||
break;
|
||||
}
|
||||
|
||||
if (rand > 2 && rand < 8)
|
||||
useMaterials = false;
|
||||
|
||||
int hue = 0x44E;
|
||||
int amountMax = Utility.RandomList(10, 15, 20, 20);
|
||||
bool reqExceptional = (0.825 > Utility.RandomDouble());
|
||||
|
||||
BulkMaterialType material;
|
||||
|
||||
if (useMaterials)
|
||||
material = GetRandomMaterial(BulkMaterialType.DullCopper, m_BlacksmithMaterialChances);
|
||||
else
|
||||
material = BulkMaterialType.None;
|
||||
|
||||
this.Hue = hue;
|
||||
this.AmountMax = amountMax;
|
||||
this.Entries = entries;
|
||||
this.RequireExceptional = reqExceptional;
|
||||
this.Material = material;
|
||||
}
|
||||
|
||||
public LargeSmithBOD(int amountMax, bool reqExceptional, BulkMaterialType mat, LargeBulkEntry[] entries)
|
||||
{
|
||||
this.Hue = 0x44E;
|
||||
this.AmountMax = amountMax;
|
||||
this.Entries = entries;
|
||||
this.RequireExceptional = reqExceptional;
|
||||
this.Material = mat;
|
||||
}
|
||||
|
||||
public LargeSmithBOD(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override int ComputeFame()
|
||||
{
|
||||
return SmithRewardCalculator.Instance.ComputeFame(this);
|
||||
}
|
||||
|
||||
public override int ComputeGold()
|
||||
{
|
||||
return SmithRewardCalculator.Instance.ComputeGold(this);
|
||||
}
|
||||
|
||||
public override List<Item> ComputeRewards(bool full)
|
||||
{
|
||||
List<Item> list = new List<Item>();
|
||||
|
||||
RewardGroup rewardGroup = SmithRewardCalculator.Instance.LookupRewards(SmithRewardCalculator.Instance.ComputePoints(this));
|
||||
|
||||
if (rewardGroup != null)
|
||||
{
|
||||
if (full)
|
||||
{
|
||||
for (int i = 0; i < rewardGroup.Items.Length; ++i)
|
||||
{
|
||||
Item item = rewardGroup.Items[i].Construct();
|
||||
|
||||
if (item != null)
|
||||
list.Add(item);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
RewardItem rewardItem = rewardGroup.AcquireItem();
|
||||
|
||||
if (rewardItem != null)
|
||||
{
|
||||
Item item = rewardItem.Construct();
|
||||
|
||||
if (item != null)
|
||||
list.Add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write((int)0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
166
Scripts/Services/BulkOrders/LargeBODs/LargeTailorBOD.cs
Normal file
166
Scripts/Services/BulkOrders/LargeBODs/LargeTailorBOD.cs
Normal file
@@ -0,0 +1,166 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
public class LargeTailorBOD : LargeBOD
|
||||
{
|
||||
public override BODType BODType { get { return BODType.Tailor; } }
|
||||
|
||||
public static double[] m_TailoringMaterialChances = new double[]
|
||||
{
|
||||
0.857421875, // None
|
||||
0.125000000, // Spined
|
||||
0.015625000, // Horned
|
||||
0.001953125 // Barbed
|
||||
};
|
||||
[Constructable]
|
||||
public LargeTailorBOD()
|
||||
{
|
||||
LargeBulkEntry[] entries;
|
||||
bool useMaterials = false;
|
||||
|
||||
switch ( Utility.Random(14) )
|
||||
{
|
||||
default:
|
||||
case 0:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.Farmer);
|
||||
break;
|
||||
case 1:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.FemaleLeatherSet);
|
||||
useMaterials = true;
|
||||
break;
|
||||
case 2:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.FisherGirl);
|
||||
break;
|
||||
case 3:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.Gypsy);
|
||||
break;
|
||||
case 4:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.HatSet);
|
||||
break;
|
||||
case 5:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.Jester);
|
||||
break;
|
||||
case 6:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.Lady);
|
||||
break;
|
||||
case 7:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.MaleLeatherSet);
|
||||
useMaterials = true;
|
||||
break;
|
||||
case 8:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.Pirate);
|
||||
break;
|
||||
case 9:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.ShoeSet);
|
||||
useMaterials = Core.ML;
|
||||
break;
|
||||
case 10:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.StuddedSet);
|
||||
useMaterials = true;
|
||||
break;
|
||||
case 11:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.TownCrier);
|
||||
break;
|
||||
case 12:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.Wizard);
|
||||
break;
|
||||
case 13:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.BoneSet);
|
||||
useMaterials = true;
|
||||
break;
|
||||
}
|
||||
|
||||
int hue = 0x483;
|
||||
int amountMax = Utility.RandomList(10, 15, 20, 20);
|
||||
bool reqExceptional = (0.825 > Utility.RandomDouble());
|
||||
|
||||
BulkMaterialType material;
|
||||
|
||||
if (useMaterials)
|
||||
material = GetRandomMaterial(BulkMaterialType.Spined, m_TailoringMaterialChances);
|
||||
else
|
||||
material = BulkMaterialType.None;
|
||||
|
||||
this.Hue = hue;
|
||||
this.AmountMax = amountMax;
|
||||
this.Entries = entries;
|
||||
this.RequireExceptional = reqExceptional;
|
||||
this.Material = material;
|
||||
}
|
||||
|
||||
public LargeTailorBOD(int amountMax, bool reqExceptional, BulkMaterialType mat, LargeBulkEntry[] entries)
|
||||
{
|
||||
this.Hue = 0x483;
|
||||
this.AmountMax = amountMax;
|
||||
this.Entries = entries;
|
||||
this.RequireExceptional = reqExceptional;
|
||||
this.Material = mat;
|
||||
}
|
||||
|
||||
public LargeTailorBOD(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override int ComputeFame()
|
||||
{
|
||||
return TailorRewardCalculator.Instance.ComputeFame(this);
|
||||
}
|
||||
|
||||
public override int ComputeGold()
|
||||
{
|
||||
return TailorRewardCalculator.Instance.ComputeGold(this);
|
||||
}
|
||||
|
||||
public override List<Item> ComputeRewards(bool full)
|
||||
{
|
||||
List<Item> list = new List<Item>();
|
||||
|
||||
RewardGroup rewardGroup = TailorRewardCalculator.Instance.LookupRewards(TailorRewardCalculator.Instance.ComputePoints(this));
|
||||
|
||||
if (rewardGroup != null)
|
||||
{
|
||||
if (full)
|
||||
{
|
||||
for (int i = 0; i < rewardGroup.Items.Length; ++i)
|
||||
{
|
||||
Item item = rewardGroup.Items[i].Construct();
|
||||
|
||||
if (item != null)
|
||||
list.Add(item);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
RewardItem rewardItem = rewardGroup.AcquireItem();
|
||||
|
||||
if (rewardItem != null)
|
||||
{
|
||||
Item item = rewardItem.Construct();
|
||||
|
||||
if (item != null)
|
||||
list.Add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write((int)0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
235
Scripts/Services/BulkOrders/LargeBODs/LargeTinkerBOD.cs
Normal file
235
Scripts/Services/BulkOrders/LargeBODs/LargeTinkerBOD.cs
Normal file
@@ -0,0 +1,235 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Server.Items;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
public class LargeTinkerBOD : LargeBOD
|
||||
{
|
||||
public override BODType BODType { get { return BODType.Tinkering; } }
|
||||
|
||||
private GemType _GemType;
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public GemType GemType
|
||||
{
|
||||
get { return _GemType; }
|
||||
set
|
||||
{
|
||||
if (Entries.Length > 0 && Entries[0].Details != null && Entries[0].Details.Type != null && Entries[0].Details.Type.IsSubclassOf(typeof(BaseJewel)))
|
||||
{
|
||||
_GemType = value;
|
||||
AssignGemNumbers();
|
||||
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static double[] m_BlackTinkerMaterialChances = new double[]
|
||||
{
|
||||
0.501953125, // None
|
||||
0.250000000, // Dull Copper
|
||||
0.125000000, // Shadow Iron
|
||||
0.062500000, // Copper
|
||||
0.031250000, // Bronze
|
||||
0.015625000, // Gold
|
||||
0.007812500, // Agapite
|
||||
0.003906250, // Verite
|
||||
0.001953125 // Valorite
|
||||
};
|
||||
|
||||
[Constructable]
|
||||
public LargeTinkerBOD()
|
||||
{
|
||||
LargeBulkEntry[] entries;
|
||||
bool useMaterials = true;
|
||||
bool jewelry = false;
|
||||
|
||||
int rand = Utility.Random(4);
|
||||
|
||||
switch ( rand )
|
||||
{
|
||||
default:
|
||||
case 0:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.LargeDining);
|
||||
break;
|
||||
case 1:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.LargeJewelry);
|
||||
useMaterials = false;
|
||||
jewelry = true;
|
||||
break;
|
||||
case 2:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.LargeKeyGlobe);
|
||||
break;
|
||||
case 3:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.LargeTools);
|
||||
useMaterials = false;
|
||||
break;
|
||||
}
|
||||
|
||||
int amountMax = Utility.RandomList(10, 15, 20, 20);
|
||||
bool reqExceptional = (0.825 > Utility.RandomDouble());
|
||||
|
||||
BulkMaterialType material;
|
||||
|
||||
if (useMaterials)
|
||||
material = GetRandomMaterial(BulkMaterialType.DullCopper, m_BlackTinkerMaterialChances);
|
||||
else
|
||||
material = BulkMaterialType.None;
|
||||
|
||||
Hue = 1109;
|
||||
AmountMax = amountMax;
|
||||
Entries = entries;
|
||||
RequireExceptional = reqExceptional;
|
||||
Material = material;
|
||||
|
||||
if (jewelry)
|
||||
{
|
||||
AssignGemType();
|
||||
}
|
||||
}
|
||||
|
||||
public LargeTinkerBOD(int amountMax, bool reqExceptional, BulkMaterialType mat, LargeBulkEntry[] entries, GemType gemType)
|
||||
{
|
||||
Hue = 1109;
|
||||
AmountMax = amountMax;
|
||||
Entries = entries;
|
||||
RequireExceptional = reqExceptional;
|
||||
Material = mat;
|
||||
_GemType = gemType;
|
||||
}
|
||||
|
||||
public override bool CheckType(SmallBOD small, Type type)
|
||||
{
|
||||
if (_GemType != GemType.None && (!(small is SmallTinkerBOD) || ((SmallTinkerBOD)small).GemType != _GemType))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return base.CheckType(small, type);
|
||||
}
|
||||
|
||||
public LargeTinkerBOD(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override int ComputeFame()
|
||||
{
|
||||
return TinkeringRewardCalculator.Instance.ComputeFame(this);
|
||||
}
|
||||
|
||||
public override int ComputeGold()
|
||||
{
|
||||
return TinkeringRewardCalculator.Instance.ComputeGold(this);
|
||||
}
|
||||
|
||||
public override List<Item> ComputeRewards(bool full)
|
||||
{
|
||||
List<Item> list = new List<Item>();
|
||||
|
||||
RewardGroup rewardGroup = TinkeringRewardCalculator.Instance.LookupRewards(TinkeringRewardCalculator.Instance.ComputePoints(this));
|
||||
|
||||
if (rewardGroup != null)
|
||||
{
|
||||
if (full)
|
||||
{
|
||||
for (int i = 0; i < rewardGroup.Items.Length; ++i)
|
||||
{
|
||||
Item item = rewardGroup.Items[i].Construct();
|
||||
|
||||
if (item != null)
|
||||
list.Add(item);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
RewardItem rewardItem = rewardGroup.AcquireItem();
|
||||
|
||||
if (rewardItem != null)
|
||||
{
|
||||
Item item = rewardItem.Construct();
|
||||
|
||||
if (item != null)
|
||||
list.Add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
public void AssignGemType()
|
||||
{
|
||||
_GemType = (GemType)Utility.RandomMinMax(1, 9);
|
||||
AssignGemNumbers();
|
||||
}
|
||||
|
||||
public void AssignGemNumbers()
|
||||
{
|
||||
foreach (var entry in Entries)
|
||||
{
|
||||
Type jewelType = entry.Details.Type;
|
||||
|
||||
int offset = (int)GemType - 1;
|
||||
int loc = 0;
|
||||
|
||||
if (jewelType == typeof(GoldRing) || jewelType == typeof(SilverRing))
|
||||
{
|
||||
loc = 1044176;
|
||||
}
|
||||
else if (jewelType == typeof(GoldBracelet) || jewelType == typeof(SilverBracelet))
|
||||
{
|
||||
loc = 1044221;
|
||||
}
|
||||
else
|
||||
{
|
||||
loc = 1044203;
|
||||
}
|
||||
|
||||
entry.Details.Number = loc + offset;
|
||||
}
|
||||
|
||||
//this.Number = loc + (int)gemType - 1;
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write((int)1); // version
|
||||
|
||||
writer.Write((int)_GemType);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch (version)
|
||||
{
|
||||
case 1:
|
||||
_GemType = (GemType)reader.ReadInt();
|
||||
break;
|
||||
}
|
||||
|
||||
if (version < 1 && Entries != null && Entries.Length > 0 && Entries[0].Details != null)
|
||||
{
|
||||
Type t = Entries[0].Details.Type;
|
||||
|
||||
if (SmallTinkerBOD.CannotAssignMaterial(t) && Material != BulkMaterialType.None)
|
||||
{
|
||||
Material = BulkMaterialType.None;
|
||||
}
|
||||
|
||||
if (t.IsSubclassOf(typeof(BaseJewel)))
|
||||
{
|
||||
AssignGemType();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
51
Scripts/Services/BulkOrders/Rewards/ConfirmBankPointsGump.cs
Normal file
51
Scripts/Services/BulkOrders/Rewards/ConfirmBankPointsGump.cs
Normal file
@@ -0,0 +1,51 @@
|
||||
using System;
|
||||
using Server.Gumps;
|
||||
using Server.Mobiles;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
public class ConfirmBankPointsGump : ConfirmCallbackGump
|
||||
{
|
||||
public int Points { get; set; }
|
||||
public double Banked { get; set; }
|
||||
|
||||
public Mobile Owner { get; set; }
|
||||
public BODType BODType { get; set; }
|
||||
|
||||
public ConfirmBankPointsGump(PlayerMobile user, Mobile owner, BODType type, int points, double banked)
|
||||
: base(user, 1157076, 1157077, new object[] { points, banked, type, owner }, String.Format("{0}\t{1}", banked.ToString("0.000000"), points.ToString()), OnSave, OnClaim)
|
||||
{
|
||||
Closable = false;
|
||||
user.CloseGump(typeof(ConfirmBankPointsGump));
|
||||
|
||||
Points = points;
|
||||
Banked = banked;
|
||||
this.BODType = type;
|
||||
|
||||
Owner = owner;
|
||||
|
||||
Rectangle2D rec = ItemBounds.Table[0x2258];
|
||||
|
||||
AddItem(115 + rec.Width / 2 - rec.X, 110 + rec.Height / 2 - rec.Y, 0x2258, BulkOrderSystem.GetBodHue(this.BODType));
|
||||
}
|
||||
|
||||
private static void OnSave(Mobile m, object state)
|
||||
{
|
||||
object[] ohs = (object[])state;
|
||||
|
||||
BulkOrderSystem.SetPoints(m, (BODType)ohs[2], (double)ohs[1]);
|
||||
BulkOrderSystem.RemovePending(m, (BODType)ohs[2]);
|
||||
|
||||
if (m is PlayerMobile)
|
||||
m.SendGump(new RewardsGump((Mobile)ohs[3], (PlayerMobile)m, (BODType)ohs[2]));
|
||||
}
|
||||
|
||||
private static void OnClaim(Mobile m, object state)
|
||||
{
|
||||
object[] ohs = (object[])state;
|
||||
|
||||
if (m is PlayerMobile)
|
||||
m.SendGump(new RewardsGump((Mobile)ohs[3], (PlayerMobile)m, (BODType)ohs[2], (int)ohs[0]));
|
||||
}
|
||||
}
|
||||
}
|
||||
1949
Scripts/Services/BulkOrders/Rewards/Rewards.cs
Normal file
1949
Scripts/Services/BulkOrders/Rewards/Rewards.cs
Normal file
File diff suppressed because it is too large
Load Diff
80
Scripts/Services/BulkOrders/Rewards/RewardsGump.cs
Normal file
80
Scripts/Services/BulkOrders/Rewards/RewardsGump.cs
Normal file
@@ -0,0 +1,80 @@
|
||||
using System;
|
||||
using Server.Engines.BulkOrders;
|
||||
using Server.Gumps;
|
||||
using Server.Mobiles;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
public class RewardsGump : BaseRewardGump
|
||||
{
|
||||
public BODType BODType { get; private set; }
|
||||
|
||||
public bool UsingBanked { get; set; }
|
||||
|
||||
public RewardsGump(Mobile owner, PlayerMobile user, BODType type, int points = 0)
|
||||
: base(owner, user, BulkOrderSystem.GetRewardCollection(type), 1157082, points == 0 ? BulkOrderSystem.GetPoints(user, type) : points)
|
||||
{
|
||||
BODType = type;
|
||||
UsingBanked = points == 0;
|
||||
|
||||
var entry = new GumpLabel(230, 65, 0x64, GetPoints(user).ToString("0.000000"));
|
||||
entry.Parent = this;
|
||||
|
||||
Entries.Insert(10, entry);
|
||||
}
|
||||
|
||||
public override int GetYOffset(int id)
|
||||
{
|
||||
if (id == 0x182B)
|
||||
{
|
||||
return 34;
|
||||
}
|
||||
|
||||
return 15;
|
||||
}
|
||||
|
||||
protected override void AddPoints()
|
||||
{
|
||||
}
|
||||
|
||||
public override double GetPoints(Mobile m)
|
||||
{
|
||||
if (Points > 0)
|
||||
return Points;
|
||||
|
||||
return BulkOrderSystem.GetPoints(m, this.BODType);
|
||||
}
|
||||
|
||||
public override void OnConfirmed(CollectionItem citem, int index)
|
||||
{
|
||||
BODCollectionItem item = citem as BODCollectionItem;
|
||||
|
||||
if (item != null && GetPoints(User) >= item.Points && item.Constructor != null)
|
||||
{
|
||||
Item i = item.Constructor(item.RewardType);
|
||||
|
||||
if (User.Backpack == null || !User.Backpack.TryDropItem(User, i, false))
|
||||
{
|
||||
User.SendLocalizedMessage(1074361); // The reward could not be given. Make sure you have room in your pack.
|
||||
i.Delete();
|
||||
|
||||
User.SendGump(new RewardsGump(Owner, User, this.BODType, (int)Points));
|
||||
}
|
||||
else
|
||||
{
|
||||
User.SendLocalizedMessage(1073621); // Your reward has been placed in your backpack.
|
||||
User.PlaySound(0x5A7);
|
||||
|
||||
if (UsingBanked)
|
||||
{
|
||||
BulkOrderSystem.DeductPoints(User, this.BODType, item.Points);
|
||||
}
|
||||
else
|
||||
{
|
||||
BulkOrderSystem.RemovePending(User, this.BODType);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
177
Scripts/Services/BulkOrders/SmallBODs/SmallAlchemyBOD.cs
Normal file
177
Scripts/Services/BulkOrders/SmallBODs/SmallAlchemyBOD.cs
Normal file
@@ -0,0 +1,177 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Server.Engines.Craft;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
// carp 1512
|
||||
// bow 1425
|
||||
// cook 1169
|
||||
// scribe 2598
|
||||
// tink 1109
|
||||
public class SmallAlchemyBOD : SmallBOD
|
||||
{
|
||||
public override BODType BODType { get { return BODType.Alchemy; } }
|
||||
|
||||
[Constructable]
|
||||
public SmallAlchemyBOD()
|
||||
{
|
||||
SmallBulkEntry[] entries = SmallBulkEntry.AlchemySmalls;
|
||||
|
||||
if (entries.Length > 0)
|
||||
{
|
||||
int amountMax = Utility.RandomList(10, 15, 20);
|
||||
|
||||
BulkMaterialType material;
|
||||
material = BulkMaterialType.None;
|
||||
|
||||
SmallBulkEntry entry = entries[Utility.Random(entries.Length)];
|
||||
|
||||
this.Hue = 2505;
|
||||
this.AmountMax = amountMax;
|
||||
this.Type = entry.Type;
|
||||
this.Number = entry.Number;
|
||||
this.Graphic = entry.Graphic;
|
||||
this.Material = material;
|
||||
this.GraphicHue = entry.Hue;
|
||||
}
|
||||
}
|
||||
|
||||
public SmallAlchemyBOD(int amountCur, int amountMax, Type type, int number, int graphic, bool reqExceptional, BulkMaterialType mat, int hue)
|
||||
{
|
||||
this.Hue = 2505;
|
||||
this.AmountMax = amountMax;
|
||||
this.AmountCur = amountCur;
|
||||
this.Type = type;
|
||||
this.Number = number;
|
||||
this.Graphic = graphic;
|
||||
this.RequireExceptional = reqExceptional;
|
||||
this.Material = mat;
|
||||
this.GraphicHue = hue;
|
||||
}
|
||||
|
||||
public SmallAlchemyBOD(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
private SmallAlchemyBOD(SmallBulkEntry entry, int amountMax)
|
||||
{
|
||||
this.Hue = 2505;
|
||||
this.AmountMax = amountMax;
|
||||
this.Type = entry.Type;
|
||||
this.Number = entry.Number;
|
||||
this.Graphic = entry.Graphic;
|
||||
this.GraphicHue = entry.Hue;
|
||||
}
|
||||
|
||||
public static SmallAlchemyBOD CreateRandomFor(Mobile m)
|
||||
{
|
||||
SmallBulkEntry[] entries;
|
||||
|
||||
double theirSkill = BulkOrderSystem.GetBODSkill(m, SkillName.Alchemy);
|
||||
|
||||
entries = SmallBulkEntry.AlchemySmalls;
|
||||
|
||||
if (entries.Length > 0)
|
||||
{
|
||||
int amountMax;
|
||||
|
||||
if (theirSkill >= 70.1)
|
||||
amountMax = Utility.RandomList(10, 15, 20, 20);
|
||||
else if (theirSkill >= 50.1)
|
||||
amountMax = Utility.RandomList(10, 15, 15, 20);
|
||||
else
|
||||
amountMax = Utility.RandomList(10, 10, 15, 20);
|
||||
|
||||
CraftSystem system = DefAlchemy.CraftSystem;
|
||||
|
||||
List<SmallBulkEntry> validEntries = new List<SmallBulkEntry>();
|
||||
|
||||
for (int i = 0; i < entries.Length; ++i)
|
||||
{
|
||||
CraftItem item = system.CraftItems.SearchFor(entries[i].Type);
|
||||
|
||||
if (item != null)
|
||||
{
|
||||
bool allRequiredSkills = true;
|
||||
double chance = item.GetSuccessChance(m, null, system, false, ref allRequiredSkills);
|
||||
|
||||
if (allRequiredSkills && chance >= 0.0)
|
||||
{
|
||||
if (chance > 0.0)
|
||||
validEntries.Add(entries[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (validEntries.Count > 0)
|
||||
{
|
||||
SmallBulkEntry entry = validEntries[Utility.Random(validEntries.Count)];
|
||||
return new SmallAlchemyBOD(entry, amountMax);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public override int ComputeFame()
|
||||
{
|
||||
return AlchemyRewardCalculator.Instance.ComputeFame(this);
|
||||
}
|
||||
|
||||
public override int ComputeGold()
|
||||
{
|
||||
return AlchemyRewardCalculator.Instance.ComputeGold(this);
|
||||
}
|
||||
|
||||
public override List<Item> ComputeRewards(bool full)
|
||||
{
|
||||
List<Item> list = new List<Item>();
|
||||
|
||||
RewardGroup rewardGroup = AlchemyRewardCalculator.Instance.LookupRewards(AlchemyRewardCalculator.Instance.ComputePoints(this));
|
||||
|
||||
if (rewardGroup != null)
|
||||
{
|
||||
if (full)
|
||||
{
|
||||
for (int i = 0; i < rewardGroup.Items.Length; ++i)
|
||||
{
|
||||
Item item = rewardGroup.Items[i].Construct();
|
||||
|
||||
if (item != null)
|
||||
list.Add(item);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
RewardItem rewardItem = rewardGroup.AcquireItem();
|
||||
|
||||
if (rewardItem != null)
|
||||
{
|
||||
Item item = rewardItem.Construct();
|
||||
|
||||
if (item != null)
|
||||
list.Add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write((int)0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
501
Scripts/Services/BulkOrders/SmallBODs/SmallBOD.cs
Normal file
501
Scripts/Services/BulkOrders/SmallBODs/SmallBOD.cs
Normal file
@@ -0,0 +1,501 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Server.Items;
|
||||
using Server.Mobiles;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
[TypeAlias("Scripts.Engines.BulkOrders.SmallBOD")]
|
||||
public abstract class SmallBOD : Item, IBOD
|
||||
{
|
||||
public abstract BODType BODType { get; }
|
||||
|
||||
private int m_AmountCur, m_AmountMax;
|
||||
private Type m_Type;
|
||||
private int m_Number;
|
||||
private int m_Graphic;
|
||||
private int m_GraphicHue;
|
||||
private bool m_RequireExceptional;
|
||||
private BulkMaterialType m_Material;
|
||||
|
||||
[Constructable]
|
||||
public SmallBOD(int hue, int amountMax, Type type, int number, int graphic, bool requireExeptional, BulkMaterialType material, int graphichue = 0)
|
||||
: base(Core.AOS ? 0x2258 : 0x14EF)
|
||||
{
|
||||
Weight = 1.0;
|
||||
Hue = hue; // Blacksmith: 0x44E; Tailoring: 0x483
|
||||
LootType = LootType.Blessed;
|
||||
|
||||
m_AmountMax = amountMax;
|
||||
m_Type = type;
|
||||
m_Number = number;
|
||||
m_Graphic = graphic;
|
||||
m_GraphicHue = graphichue;
|
||||
m_RequireExceptional = requireExeptional;
|
||||
m_Material = material;
|
||||
}
|
||||
|
||||
public SmallBOD()
|
||||
: base(Core.AOS ? 0x2258 : 0x14EF)
|
||||
{
|
||||
Weight = 1.0;
|
||||
LootType = LootType.Blessed;
|
||||
}
|
||||
|
||||
public SmallBOD(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int AmountCur
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_AmountCur;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_AmountCur = value;
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int AmountMax
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_AmountMax;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_AmountMax = value;
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public virtual Type Type
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Type;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_Type = value;
|
||||
}
|
||||
}
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int Number
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Number;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_Number = value;
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int Graphic
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Graphic;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_Graphic = value;
|
||||
}
|
||||
}
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int GraphicHue
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_GraphicHue;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_GraphicHue = value;
|
||||
}
|
||||
}
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public bool RequireExceptional
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_RequireExceptional;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_RequireExceptional = value;
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public BulkMaterialType Material
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Material;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_Material = value;
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public bool Complete
|
||||
{
|
||||
get
|
||||
{
|
||||
return (m_AmountCur == m_AmountMax);
|
||||
}
|
||||
}
|
||||
public override int LabelNumber
|
||||
{
|
||||
get
|
||||
{
|
||||
return 1045151;
|
||||
}
|
||||
}// a bulk order deed
|
||||
public static BulkMaterialType GetRandomMaterial(BulkMaterialType start, double[] chances)
|
||||
{
|
||||
double random = Utility.RandomDouble();
|
||||
|
||||
for (int i = 0; i < chances.Length; ++i)
|
||||
{
|
||||
if (random < chances[i])
|
||||
return (i == 0 ? BulkMaterialType.None : start + (i - 1));
|
||||
|
||||
random -= chances[i];
|
||||
}
|
||||
|
||||
return BulkMaterialType.None;
|
||||
}
|
||||
|
||||
public static BulkMaterialType GetMaterial(CraftResource resource)
|
||||
{
|
||||
switch ( resource )
|
||||
{
|
||||
case CraftResource.DullCopper:
|
||||
return BulkMaterialType.DullCopper;
|
||||
case CraftResource.ShadowIron:
|
||||
return BulkMaterialType.ShadowIron;
|
||||
case CraftResource.Copper:
|
||||
return BulkMaterialType.Copper;
|
||||
case CraftResource.Bronze:
|
||||
return BulkMaterialType.Bronze;
|
||||
case CraftResource.Gold:
|
||||
return BulkMaterialType.Gold;
|
||||
case CraftResource.Agapite:
|
||||
return BulkMaterialType.Agapite;
|
||||
case CraftResource.Verite:
|
||||
return BulkMaterialType.Verite;
|
||||
case CraftResource.Valorite:
|
||||
return BulkMaterialType.Valorite;
|
||||
case CraftResource.SpinedLeather:
|
||||
return BulkMaterialType.Spined;
|
||||
case CraftResource.HornedLeather:
|
||||
return BulkMaterialType.Horned;
|
||||
case CraftResource.BarbedLeather:
|
||||
return BulkMaterialType.Barbed;
|
||||
case CraftResource.OakWood:
|
||||
return BulkMaterialType.OakWood;
|
||||
case CraftResource.YewWood:
|
||||
return BulkMaterialType.YewWood;
|
||||
case CraftResource.AshWood:
|
||||
return BulkMaterialType.AshWood;
|
||||
case CraftResource.Heartwood:
|
||||
return BulkMaterialType.Heartwood;
|
||||
case CraftResource.Bloodwood:
|
||||
return BulkMaterialType.Bloodwood;
|
||||
case CraftResource.Frostwood:
|
||||
return BulkMaterialType.Frostwood;
|
||||
}
|
||||
|
||||
return BulkMaterialType.None;
|
||||
}
|
||||
|
||||
public override void GetProperties(ObjectPropertyList list)
|
||||
{
|
||||
base.GetProperties(list);
|
||||
|
||||
list.Add(1060654); // small bulk order
|
||||
|
||||
if (m_RequireExceptional)
|
||||
list.Add(1045141); // All items must be exceptional.
|
||||
|
||||
if (m_Material != BulkMaterialType.None)
|
||||
list.Add(SmallBODGump.GetMaterialNumberFor(m_Material)); // All items must be made with x material.
|
||||
|
||||
list.Add(1060656, m_AmountMax.ToString()); // amount to make: ~1_val~
|
||||
list.Add(1060658, "#{0}\t{1}", m_Number, m_AmountCur); // ~1_val~: ~2_val~
|
||||
}
|
||||
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
if (IsChildOf(from.Backpack) || InSecureTrade || RootParent is PlayerVendor)
|
||||
{
|
||||
EventSink.InvokeBODUsed(new BODUsedEventArgs(from, this));
|
||||
from.SendGump(new SmallBODGump(from, this));
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage(1045156); // You must have the deed in your backpack to use it.
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnDoubleClickNotAccessible(Mobile from)
|
||||
{
|
||||
OnDoubleClick(from);
|
||||
}
|
||||
|
||||
public override void OnDoubleClickSecureTrade(Mobile from)
|
||||
{
|
||||
OnDoubleClick(from);
|
||||
}
|
||||
|
||||
public void BeginCombine(Mobile from)
|
||||
{
|
||||
if (m_AmountCur < m_AmountMax)
|
||||
from.Target = new SmallBODTarget(this);
|
||||
else
|
||||
from.SendLocalizedMessage(1045166); // The maximum amount of requested items have already been combined to this deed.
|
||||
}
|
||||
|
||||
public abstract List<Item> ComputeRewards(bool full);
|
||||
|
||||
public abstract int ComputeGold();
|
||||
|
||||
public abstract int ComputeFame();
|
||||
|
||||
public virtual void GetRewards(out Item reward, out int gold, out int fame)
|
||||
{
|
||||
reward = null;
|
||||
gold = ComputeGold();
|
||||
fame = ComputeFame();
|
||||
|
||||
if (!BulkOrderSystem.NewSystemEnabled)
|
||||
{
|
||||
List<Item> rewards = ComputeRewards(false);
|
||||
|
||||
if (rewards.Count > 0)
|
||||
{
|
||||
reward = rewards[Utility.Random(rewards.Count)];
|
||||
|
||||
for (int i = 0; i < rewards.Count; ++i)
|
||||
{
|
||||
if (rewards[i] != reward)
|
||||
rewards[i].Delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public virtual bool CheckType(Item item)
|
||||
{
|
||||
return CheckType(item.GetType());
|
||||
}
|
||||
|
||||
public virtual bool CheckType(Type itemType)
|
||||
{
|
||||
return m_Type != null && (itemType == m_Type || itemType.IsSubclassOf(m_Type));
|
||||
}
|
||||
|
||||
public void EndCombine(Mobile from, object o)
|
||||
{
|
||||
if (o is Item && ((Item)o).IsChildOf(from.Backpack))
|
||||
{
|
||||
Type objectType = o.GetType();
|
||||
Item item = o as Item;
|
||||
|
||||
if (m_AmountCur >= m_AmountMax)
|
||||
{
|
||||
from.SendLocalizedMessage(1045166); // The maximum amount of requested items have already been combined to this deed.
|
||||
}
|
||||
else if (!CheckType((Item)o))
|
||||
{
|
||||
from.SendLocalizedMessage(1045169); // The item is not in the request.
|
||||
}
|
||||
else
|
||||
{
|
||||
BulkMaterialType material = BulkMaterialType.None;
|
||||
|
||||
if (o is IResource)
|
||||
material = GetMaterial(((IResource)o).Resource);
|
||||
|
||||
if (material != m_Material && m_Material != BulkMaterialType.None)
|
||||
{
|
||||
from.SendLocalizedMessage(1157310); // The item is not made from the requested resource.
|
||||
}
|
||||
else
|
||||
{
|
||||
bool isExceptional = false;
|
||||
|
||||
if (o is IQuality)
|
||||
isExceptional = (((IQuality)o).Quality == ItemQuality.Exceptional);
|
||||
|
||||
if (m_RequireExceptional && !isExceptional)
|
||||
{
|
||||
from.SendLocalizedMessage(1045167); // The item must be exceptional.
|
||||
}
|
||||
else
|
||||
{
|
||||
if (item.Amount > 1)
|
||||
{
|
||||
if (AmountCur + item.Amount > AmountMax)
|
||||
{
|
||||
from.SendLocalizedMessage(1157222); // You have provided more than which has been requested by this deed.
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
AmountCur += item.Amount;
|
||||
item.Delete();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
item.Delete();
|
||||
++AmountCur;
|
||||
}
|
||||
|
||||
from.SendLocalizedMessage(1045170); // The item has been combined with the deed.
|
||||
|
||||
from.SendGump(new SmallBODGump(from, this));
|
||||
|
||||
if (m_AmountCur < m_AmountMax)
|
||||
BeginCombine(from);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage(1045158); // You must have the item in your backpack to target it.
|
||||
}
|
||||
}
|
||||
|
||||
public static double GetRequiredSkill(BulkMaterialType type)
|
||||
{
|
||||
double skillReq = 0.0;
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case BulkMaterialType.DullCopper:
|
||||
skillReq = 65.0;
|
||||
break;
|
||||
case BulkMaterialType.ShadowIron:
|
||||
skillReq = 70.0;
|
||||
break;
|
||||
case BulkMaterialType.Copper:
|
||||
skillReq = 75.0;
|
||||
break;
|
||||
case BulkMaterialType.Bronze:
|
||||
skillReq = 80.0;
|
||||
break;
|
||||
case BulkMaterialType.Gold:
|
||||
skillReq = 85.0;
|
||||
break;
|
||||
case BulkMaterialType.Agapite:
|
||||
skillReq = 90.0;
|
||||
break;
|
||||
case BulkMaterialType.Verite:
|
||||
skillReq = 95.0;
|
||||
break;
|
||||
case BulkMaterialType.Valorite:
|
||||
skillReq = 100.0;
|
||||
break;
|
||||
case BulkMaterialType.Spined:
|
||||
skillReq = 65.0;
|
||||
break;
|
||||
case BulkMaterialType.Horned:
|
||||
skillReq = 80.0;
|
||||
break;
|
||||
case BulkMaterialType.Barbed:
|
||||
skillReq = 99.0;
|
||||
break;
|
||||
case BulkMaterialType.OakWood:
|
||||
skillReq = 65.0;
|
||||
break;
|
||||
case BulkMaterialType.AshWood:
|
||||
skillReq = 75.0;
|
||||
break;
|
||||
case BulkMaterialType.YewWood:
|
||||
skillReq = 85.0;
|
||||
break;
|
||||
case BulkMaterialType.Heartwood:
|
||||
case BulkMaterialType.Bloodwood:
|
||||
case BulkMaterialType.Frostwood:
|
||||
skillReq = 95.0;
|
||||
break;
|
||||
}
|
||||
|
||||
return skillReq;
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write((int)1); // version
|
||||
|
||||
writer.Write(m_GraphicHue);
|
||||
|
||||
writer.Write(m_AmountCur);
|
||||
writer.Write(m_AmountMax);
|
||||
writer.Write(m_Type == null ? null : m_Type.FullName);
|
||||
writer.Write(m_Number);
|
||||
writer.Write(m_Graphic);
|
||||
writer.Write(m_RequireExceptional);
|
||||
writer.Write((int)m_Material);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
m_GraphicHue = reader.ReadInt();
|
||||
goto case 0;
|
||||
}
|
||||
case 0:
|
||||
{
|
||||
m_AmountCur = reader.ReadInt();
|
||||
m_AmountMax = reader.ReadInt();
|
||||
|
||||
string type = reader.ReadString();
|
||||
|
||||
if (type != null)
|
||||
m_Type = ScriptCompiler.FindTypeByFullName(type);
|
||||
|
||||
m_Number = reader.ReadInt();
|
||||
m_Graphic = reader.ReadInt();
|
||||
m_RequireExceptional = reader.ReadBool();
|
||||
m_Material = (BulkMaterialType)reader.ReadInt();
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (Weight == 0.0)
|
||||
Weight = 1.0;
|
||||
|
||||
if (Core.AOS && ItemID == 0x14EF)
|
||||
ItemID = 0x2258;
|
||||
|
||||
if (Parent == null && Map == Map.Internal && Location == Point3D.Zero)
|
||||
Delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
93
Scripts/Services/BulkOrders/SmallBODs/SmallBODAcceptGump.cs
Normal file
93
Scripts/Services/BulkOrders/SmallBODs/SmallBODAcceptGump.cs
Normal file
@@ -0,0 +1,93 @@
|
||||
using System;
|
||||
using Server.Gumps;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
public class SmallBODAcceptGump : Gump
|
||||
{
|
||||
private readonly SmallBOD m_Deed;
|
||||
private readonly Mobile m_From;
|
||||
public SmallBODAcceptGump(Mobile from, SmallBOD deed)
|
||||
: base(50, 50)
|
||||
{
|
||||
m_From = from;
|
||||
m_Deed = deed;
|
||||
|
||||
m_From.CloseGump(typeof(LargeBODAcceptGump));
|
||||
m_From.CloseGump(typeof(SmallBODAcceptGump));
|
||||
|
||||
AddPage(0);
|
||||
|
||||
AddBackground(25, 10, 430, 264, 5054);
|
||||
|
||||
AddImageTiled(33, 20, 413, 245, 2624);
|
||||
AddAlphaRegion(33, 20, 413, 245);
|
||||
|
||||
AddImage(20, 5, 10460);
|
||||
AddImage(430, 5, 10460);
|
||||
AddImage(20, 249, 10460);
|
||||
AddImage(430, 249, 10460);
|
||||
|
||||
AddHtmlLocalized(190, 25, 120, 20, 1045133, 0x7FFF, false, false); // A bulk order
|
||||
AddHtmlLocalized(40, 48, 350, 20, 1045135, 0x7FFF, false, false); // Ah! Thanks for the goods! Would you help me out?
|
||||
|
||||
AddHtmlLocalized(40, 72, 210, 20, 1045138, 0x7FFF, false, false); // Amount to make:
|
||||
AddLabel(250, 72, 1152, deed.AmountMax.ToString());
|
||||
|
||||
AddHtmlLocalized(40, 96, 120, 20, 1045136, 0x7FFF, false, false); // Item requested:
|
||||
AddItem(385, 96, deed.Graphic, deed.GraphicHue);
|
||||
AddHtmlLocalized(40, 120, 210, 20, deed.Number, 0xFFFFFF, false, false);
|
||||
|
||||
if (deed.RequireExceptional || deed.Material != BulkMaterialType.None)
|
||||
{
|
||||
AddHtmlLocalized(40, 144, 210, 20, 1045140, 0x7FFF, false, false); // Special requirements to meet:
|
||||
|
||||
if (deed.RequireExceptional)
|
||||
AddHtmlLocalized(40, 168, 350, 20, 1045141, 0x7FFF, false, false); // All items must be exceptional.
|
||||
|
||||
if (deed.Material != BulkMaterialType.None)
|
||||
AddHtmlLocalized(40, deed.RequireExceptional ? 192 : 168, 350, 20, SmallBODGump.GetMaterialNumberFor(deed.Material), 0x7FFF, false, false); // All items must be made with x material.
|
||||
}
|
||||
|
||||
AddHtmlLocalized(40, 216, 350, 20, 1045139, 0x7FFF, false, false); // Do you want to accept this order?
|
||||
|
||||
AddButton(100, 240, 4005, 4007, 1, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(135, 240, 120, 20, 1006044, 0x7FFF, false, false); // Ok
|
||||
|
||||
AddButton(275, 240, 4005, 4007, 0, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(310, 240, 120, 20, 1011012, 0x7FFF, false, false); // CANCEL
|
||||
}
|
||||
|
||||
public override void OnServerClose(NetState owner)
|
||||
{
|
||||
Timer.DelayCall(() =>
|
||||
{
|
||||
if (m_Deed.Map == null || m_Deed.Map == Map.Internal)
|
||||
{
|
||||
m_Deed.Delete();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
{
|
||||
if (info.ButtonID == 1) // Ok
|
||||
{
|
||||
if (m_From.PlaceInBackpack(m_Deed))
|
||||
{
|
||||
m_From.SendLocalizedMessage(1045152); // The bulk order deed has been placed in your backpack.
|
||||
}
|
||||
else
|
||||
{
|
||||
m_From.SendLocalizedMessage(1045150); // There is not enough room in your backpack for the deed.
|
||||
m_Deed.Delete();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Deed.Delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
187
Scripts/Services/BulkOrders/SmallBODs/SmallBODGump.cs
Normal file
187
Scripts/Services/BulkOrders/SmallBODs/SmallBODGump.cs
Normal file
@@ -0,0 +1,187 @@
|
||||
using System;
|
||||
using Server.Gumps;
|
||||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
using System.Collections.Generic;
|
||||
using Server.Items;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
public class SmallBODGump : Gump
|
||||
{
|
||||
private readonly SmallBOD m_Deed;
|
||||
private readonly Mobile m_From;
|
||||
|
||||
public SmallBODGump(Mobile from, SmallBOD deed)
|
||||
: base(25, 25)
|
||||
{
|
||||
this.m_From = from;
|
||||
this.m_Deed = deed;
|
||||
|
||||
this.m_From.CloseGump(typeof(LargeBODGump));
|
||||
this.m_From.CloseGump(typeof(SmallBODGump));
|
||||
|
||||
this.AddPage(0);
|
||||
|
||||
int height = 0;
|
||||
|
||||
if (BulkOrderSystem.NewSystemEnabled)
|
||||
{
|
||||
if (deed.RequireExceptional || deed.Material != BulkMaterialType.None)
|
||||
height += 24;
|
||||
|
||||
if (deed.RequireExceptional)
|
||||
height += 24;
|
||||
|
||||
if (deed.Material != BulkMaterialType.None)
|
||||
height += 24;
|
||||
}
|
||||
|
||||
this.AddBackground(50, 10, 455, 245 + height, 5054);
|
||||
this.AddImageTiled(58, 20, 438, 226 + height, 2624);
|
||||
this.AddAlphaRegion(58, 20, 438, 226 + height);
|
||||
|
||||
this.AddImage(45, 5, 10460);
|
||||
this.AddImage(480, 5, 10460);
|
||||
this.AddImage(45, 230 + height, 10460);
|
||||
this.AddImage(480, 230 + height, 10460);
|
||||
|
||||
this.AddHtmlLocalized(225, 25, 120, 20, 1045133, 0x7FFF, false, false); // A bulk order
|
||||
|
||||
this.AddHtmlLocalized(75, 48, 250, 20, 1045138, 0x7FFF, false, false); // Amount to make:
|
||||
this.AddLabel(275, 48, 1152, deed.AmountMax.ToString());
|
||||
|
||||
this.AddHtmlLocalized(275, 76, 200, 20, 1045153, 0x7FFF, false, false); // Amount finished:
|
||||
this.AddHtmlLocalized(75, 72, 120, 20, 1045136, 0x7FFF, false, false); // Item requested:
|
||||
|
||||
this.AddItem(410, 72, deed.Graphic, deed.GraphicHue);
|
||||
|
||||
this.AddHtmlLocalized(75, 96, 210, 20, deed.Number, 0x7FFF, false, false);
|
||||
this.AddLabel(275, 96, 0x480, deed.AmountCur.ToString());
|
||||
|
||||
int y = 120;
|
||||
|
||||
if (deed.RequireExceptional || deed.Material != BulkMaterialType.None)
|
||||
{
|
||||
this.AddHtmlLocalized(75, y, 200, 20, 1045140, 0x7FFF, false, false); // Special requirements to meet:
|
||||
y += 24;
|
||||
}
|
||||
|
||||
if (deed.RequireExceptional)
|
||||
{
|
||||
this.AddHtmlLocalized(75, y, 300, 20, 1045141, 0x7FFF, false, false); // All items must be exceptional.
|
||||
y += 24;
|
||||
}
|
||||
|
||||
if (deed.Material != BulkMaterialType.None)
|
||||
{
|
||||
this.AddHtmlLocalized(75, y, 300, 20, GetMaterialNumberFor(deed.Material), 0x7FFF, false, false); // All items must be made with x material.
|
||||
y += 24;
|
||||
}
|
||||
|
||||
if (from is PlayerMobile && BulkOrderSystem.NewSystemEnabled)
|
||||
{
|
||||
BODContext c = BulkOrderSystem.GetContext((PlayerMobile)from);
|
||||
|
||||
int points = 0;
|
||||
double banked = 0.0;
|
||||
|
||||
BulkOrderSystem.ComputePoints(deed, out points, out banked);
|
||||
|
||||
AddHtmlLocalized(75, y, 300, 20, 1157301, String.Format("{0}\t{1}", points, banked.ToString("0.000000")), 0x7FFF, false, false); // Worth ~1_POINTS~ turn in points and ~2_POINTS~ bank points.
|
||||
y += 24;
|
||||
|
||||
AddButton(125, y, 4005, 4007, 3, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(160, y, 300, 20, c.PointsMode == PointsMode.Enabled ? 1157302 : c.PointsMode == PointsMode.Disabled ? 1157303 : 1157309, 0x7FFF, false, false); // Banking Points Enabled/Disabled/Automatic
|
||||
y += 24;
|
||||
|
||||
AddButton(125, y, 4005, 4007, 2, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(160, y, 300, 20, 1045154, 0x7FFF, false, false); // Combine this deed with the item requested.
|
||||
y += 24;
|
||||
|
||||
this.AddButton(125, y, 4005, 4007, 4, GumpButtonType.Reply, 0);
|
||||
this.AddHtmlLocalized(160, y, 300, 20, 1157304, 0x7FFF, false, false); // Combine this deed with contained items.
|
||||
y += 24;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.AddButton(125, y, 4005, 4007, 2, GumpButtonType.Reply, 0);
|
||||
this.AddHtmlLocalized(160, y, 300, 20, 1045154, 0x7FFF, false, false); // Combine this deed with the item requested.
|
||||
y += 24;
|
||||
}
|
||||
|
||||
this.AddButton(125, y, 4005, 4007, 1, GumpButtonType.Reply, 0);
|
||||
this.AddHtmlLocalized(160, y, 120, 20, 1011441, 0x7FFF, false, false); // EXIT
|
||||
}
|
||||
|
||||
public static int GetMaterialNumberFor(BulkMaterialType material)
|
||||
{
|
||||
if (material >= BulkMaterialType.DullCopper && material <= BulkMaterialType.Valorite)
|
||||
return 1045142 + (int)(material - BulkMaterialType.DullCopper);
|
||||
else if (material >= BulkMaterialType.Spined && material <= BulkMaterialType.Barbed)
|
||||
return 1049348 + (int)(material - BulkMaterialType.Spined);
|
||||
else if (material >= BulkMaterialType.OakWood && material <= BulkMaterialType.Frostwood)
|
||||
{
|
||||
switch (material)
|
||||
{
|
||||
case BulkMaterialType.OakWood: return 1071428;
|
||||
case BulkMaterialType.AshWood: return 1071429;
|
||||
case BulkMaterialType.YewWood: return 1071430;
|
||||
case BulkMaterialType.Heartwood: return 1071432;
|
||||
case BulkMaterialType.Bloodwood: return 1071431;
|
||||
case BulkMaterialType.Frostwood: return 1071433;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
{
|
||||
if (this.m_Deed.Deleted || !this.m_Deed.IsChildOf(this.m_From.Backpack))
|
||||
return;
|
||||
|
||||
switch (info.ButtonID)
|
||||
{
|
||||
case 2: // Combine
|
||||
{
|
||||
this.m_From.SendGump(new SmallBODGump(this.m_From, this.m_Deed));
|
||||
this.m_Deed.BeginCombine(this.m_From);
|
||||
break;
|
||||
}
|
||||
case 3: // points mode
|
||||
{
|
||||
BODContext c = BulkOrderSystem.GetContext(m_From);
|
||||
|
||||
if (c != null)
|
||||
{
|
||||
switch (c.PointsMode)
|
||||
{
|
||||
case PointsMode.Enabled: c.PointsMode = PointsMode.Disabled; break;
|
||||
case PointsMode.Disabled: c.PointsMode = PointsMode.Automatic; break;
|
||||
case PointsMode.Automatic: c.PointsMode = PointsMode.Enabled; break;
|
||||
}
|
||||
}
|
||||
|
||||
m_From.SendGump(new SmallBODGump(this.m_From, this.m_Deed));
|
||||
break;
|
||||
}
|
||||
case 4: // combine from container
|
||||
{
|
||||
m_From.BeginTarget(-1, false, Server.Targeting.TargetFlags.None, (m, targeted) =>
|
||||
{
|
||||
if (!m_Deed.Deleted && targeted is Container)
|
||||
{
|
||||
List<Item> list = new List<Item>(((Container)targeted).Items);
|
||||
|
||||
foreach (Item item in list)
|
||||
{
|
||||
m_Deed.EndCombine(m_From, item);
|
||||
}
|
||||
}
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
23
Scripts/Services/BulkOrders/SmallBODs/SmallBODTarget.cs
Normal file
23
Scripts/Services/BulkOrders/SmallBODs/SmallBODTarget.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using Server.Targeting;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
public class SmallBODTarget : Target
|
||||
{
|
||||
private readonly SmallBOD m_Deed;
|
||||
public SmallBODTarget(SmallBOD deed)
|
||||
: base(18, false, TargetFlags.None)
|
||||
{
|
||||
this.m_Deed = deed;
|
||||
}
|
||||
|
||||
protected override void OnTarget(Mobile from, object targeted)
|
||||
{
|
||||
if (this.m_Deed.Deleted || !this.m_Deed.IsChildOf(from.Backpack))
|
||||
return;
|
||||
|
||||
this.m_Deed.EndCombine(from, targeted);
|
||||
}
|
||||
}
|
||||
}
|
||||
252
Scripts/Services/BulkOrders/SmallBODs/SmallBulkEntry.cs
Normal file
252
Scripts/Services/BulkOrders/SmallBODs/SmallBulkEntry.cs
Normal file
@@ -0,0 +1,252 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
public class SmallBulkEntry
|
||||
{
|
||||
private static Hashtable m_Cache;
|
||||
private Type m_Type;
|
||||
private int m_Number;
|
||||
private int m_Graphic;
|
||||
private int m_Hue;
|
||||
|
||||
public SmallBulkEntry(Type type, int number, int graphic, int hue)
|
||||
{
|
||||
m_Type = type;
|
||||
m_Number = number;
|
||||
m_Graphic = graphic;
|
||||
m_Hue = hue;
|
||||
}
|
||||
|
||||
public static SmallBulkEntry[] BlacksmithWeapons
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Blacksmith", "weapons");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] BlacksmithArmor
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Blacksmith", "armor");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] TailorCloth
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Tailoring", "cloth");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] TailorLeather
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Tailoring", "leather");
|
||||
}
|
||||
}
|
||||
#region Publish 95 BODs
|
||||
public static SmallBulkEntry[] TinkeringSmalls
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Tinkering", "smalls");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] TinkeringSmallsRegular
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Tinkering", "smallsregular");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] CarpentrySmalls
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Carpentry", "smalls");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] InscriptionSmalls
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Inscription", "smalls");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] CookingSmalls
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Cooking", "smalls");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] CookingSmallsRegular
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Cooking", "smallsregular");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] FletchingSmalls
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Fletching", "smalls");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] FletchingSmallsRegular
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Fletching", "smallsregular");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] AlchemySmalls
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Alchemy", "smalls");
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
public Type Type
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Type;
|
||||
}
|
||||
}
|
||||
public int Number
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Number;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_Number = value;
|
||||
}
|
||||
}
|
||||
public int Graphic
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Graphic;
|
||||
}
|
||||
}
|
||||
public int Hue
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Hue;
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] GetEntries(string type, string name)
|
||||
{
|
||||
if (m_Cache == null)
|
||||
m_Cache = new Hashtable();
|
||||
|
||||
Hashtable table = (Hashtable)m_Cache[type];
|
||||
|
||||
if (table == null)
|
||||
m_Cache[type] = table = new Hashtable();
|
||||
|
||||
SmallBulkEntry[] entries = (SmallBulkEntry[])table[name];
|
||||
|
||||
if (entries == null)
|
||||
table[name] = entries = LoadEntries(type, name);
|
||||
|
||||
return entries;
|
||||
}
|
||||
|
||||
public static SmallBulkEntry[] LoadEntries(string type, string name)
|
||||
{
|
||||
return LoadEntries(String.Format("Data/Bulk Orders/{0}/{1}.cfg", type, name));
|
||||
}
|
||||
|
||||
public static SmallBulkEntry[] LoadEntries(string path)
|
||||
{
|
||||
path = Path.Combine(Core.BaseDirectory, path);
|
||||
|
||||
List<SmallBulkEntry> list = new List<SmallBulkEntry>();
|
||||
|
||||
if (File.Exists(path))
|
||||
{
|
||||
using (StreamReader ip = new StreamReader(path))
|
||||
{
|
||||
string line;
|
||||
|
||||
while ((line = ip.ReadLine()) != null)
|
||||
{
|
||||
/* arg 1 - Type
|
||||
* arg 2 - ItemID
|
||||
* arg 3 - Cliloc
|
||||
* arg 4 - hue
|
||||
*/
|
||||
|
||||
if (line.Length == 0 || line.StartsWith("#"))
|
||||
continue;
|
||||
|
||||
try
|
||||
{
|
||||
string[] split = line.Split(',');
|
||||
|
||||
if (split.Length <= 2)
|
||||
{
|
||||
Type type = ScriptCompiler.FindTypeByName(split[0]);
|
||||
int graphic = Utility.ToInt32(split[1]);
|
||||
|
||||
if (type != null && graphic > 0)
|
||||
{
|
||||
list.Add(new SmallBulkEntry(type, graphic < 0x4000 ? 1020000 + graphic : 1078872 + graphic, graphic, 0));
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("Error Loading BOD Entry at {2}, [Type: {0}], [graphic: {1}]", split[0], graphic.ToString(), path);
|
||||
}
|
||||
}
|
||||
else if (split.Length >= 3)
|
||||
{
|
||||
int name, hue;
|
||||
|
||||
Type type = ScriptCompiler.FindTypeByName(split[0]);
|
||||
int graphic = Utility.ToInt32(split[1]);
|
||||
|
||||
name = Utility.ToInt32(split[2]);
|
||||
|
||||
if (split.Length >= 4)
|
||||
{
|
||||
hue = Utility.ToInt32(split[3]);
|
||||
}
|
||||
else
|
||||
{
|
||||
hue = 0;
|
||||
}
|
||||
|
||||
if (type != null && graphic > 0)
|
||||
{
|
||||
list.Add(new SmallBulkEntry(type, name, graphic, hue));
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("Error Loading BOD Entry at {2}, [Type: {0}], [graphic: {1}]", split[0], graphic.ToString(), path);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
Console.WriteLine(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return list.ToArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
190
Scripts/Services/BulkOrders/SmallBODs/SmallCarpentryBOD.cs
Normal file
190
Scripts/Services/BulkOrders/SmallBODs/SmallCarpentryBOD.cs
Normal file
@@ -0,0 +1,190 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Server.Engines.Craft;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
public class SmallCarpentryBOD : SmallBOD
|
||||
{
|
||||
public static double[] m_CarpentryMaterialChances = new double[]
|
||||
{
|
||||
0.513718750, // None
|
||||
0.292968750, // Oak
|
||||
0.117187500, // Ash
|
||||
0.046875000, // Yew
|
||||
0.018750000, // Heartwood
|
||||
0.007500000, // Bloodwood
|
||||
0.003000000 // Frostwood
|
||||
};
|
||||
|
||||
public override BODType BODType { get { return BODType.Carpentry; } }
|
||||
|
||||
[Constructable]
|
||||
public SmallCarpentryBOD()
|
||||
{
|
||||
SmallBulkEntry[] entries;
|
||||
bool useMaterials = Utility.RandomBool();
|
||||
|
||||
entries = SmallBulkEntry.CarpentrySmalls;
|
||||
|
||||
if (entries.Length > 0)
|
||||
{
|
||||
int amountMax = Utility.RandomList(10, 15, 20);
|
||||
|
||||
BulkMaterialType material = BulkMaterialType.None;
|
||||
|
||||
if(useMaterials)
|
||||
material = GetRandomMaterial(BulkMaterialType.OakWood, m_CarpentryMaterialChances);
|
||||
|
||||
bool reqExceptional = Utility.RandomBool() || (material == BulkMaterialType.None);
|
||||
|
||||
SmallBulkEntry entry = entries[Utility.Random(entries.Length)];
|
||||
|
||||
this.Hue = 1512;
|
||||
this.AmountMax = amountMax;
|
||||
this.Type = entry.Type;
|
||||
this.Number = entry.Number;
|
||||
this.Graphic = entry.Graphic;
|
||||
this.RequireExceptional = reqExceptional;
|
||||
this.Material = material;
|
||||
this.GraphicHue = entry.Hue;
|
||||
}
|
||||
}
|
||||
|
||||
public SmallCarpentryBOD(int amountCur, int amountMax, Type type, int number, int graphic, bool reqExceptional, BulkMaterialType mat, int hue)
|
||||
{
|
||||
this.Hue = 1512;
|
||||
this.AmountMax = amountMax;
|
||||
this.AmountCur = amountCur;
|
||||
this.Type = type;
|
||||
this.Number = number;
|
||||
this.Graphic = graphic;
|
||||
this.RequireExceptional = reqExceptional;
|
||||
this.Material = mat;
|
||||
this.GraphicHue = hue;
|
||||
}
|
||||
|
||||
public SmallCarpentryBOD(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
private SmallCarpentryBOD(SmallBulkEntry entry, BulkMaterialType material, int amountMax, bool reqExceptional)
|
||||
{
|
||||
this.Hue = 1512;
|
||||
this.AmountMax = amountMax;
|
||||
this.Type = entry.Type;
|
||||
this.Number = entry.Number;
|
||||
this.Graphic = entry.Graphic;
|
||||
this.RequireExceptional = reqExceptional;
|
||||
this.Material = material;
|
||||
}
|
||||
|
||||
public static SmallCarpentryBOD CreateRandomFor(Mobile m)
|
||||
{
|
||||
SmallBulkEntry[] entries;
|
||||
bool useMaterials = Utility.RandomBool();
|
||||
|
||||
double theirSkill = BulkOrderSystem.GetBODSkill(m, SkillName.Carpentry);
|
||||
|
||||
entries = SmallBulkEntry.CarpentrySmalls;
|
||||
|
||||
if (entries.Length > 0)
|
||||
{
|
||||
int amountMax;
|
||||
|
||||
if (theirSkill >= 70.1)
|
||||
amountMax = Utility.RandomList(10, 15, 20, 20);
|
||||
else if (theirSkill >= 50.1)
|
||||
amountMax = Utility.RandomList(10, 15, 15, 20);
|
||||
else
|
||||
amountMax = Utility.RandomList(10, 10, 15, 20);
|
||||
|
||||
BulkMaterialType material = BulkMaterialType.None;
|
||||
|
||||
if (useMaterials && theirSkill >= 70.1)
|
||||
{
|
||||
for (int i = 0; i < 20; ++i)
|
||||
{
|
||||
BulkMaterialType check = GetRandomMaterial(BulkMaterialType.OakWood, m_CarpentryMaterialChances);
|
||||
double skillReq = GetRequiredSkill(check);
|
||||
|
||||
if (theirSkill >= skillReq)
|
||||
{
|
||||
material = check;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
double excChance = 0.0;
|
||||
|
||||
if (theirSkill >= 70.1)
|
||||
excChance = (theirSkill + 80.0) / 200.0;
|
||||
|
||||
bool reqExceptional = (excChance > Utility.RandomDouble());
|
||||
|
||||
CraftSystem system = DefCarpentry.CraftSystem;
|
||||
|
||||
List<SmallBulkEntry> validEntries = new List<SmallBulkEntry>();
|
||||
|
||||
for (int i = 0; i < entries.Length; ++i)
|
||||
{
|
||||
CraftItem item = system.CraftItems.SearchFor(entries[i].Type);
|
||||
|
||||
if (item != null)
|
||||
{
|
||||
bool allRequiredSkills = true;
|
||||
double chance = item.GetSuccessChance(m, null, system, false, ref allRequiredSkills);
|
||||
|
||||
if (allRequiredSkills && chance >= 0.0)
|
||||
{
|
||||
if (reqExceptional)
|
||||
chance = item.GetExceptionalChance(system, chance, m);
|
||||
|
||||
if (chance > 0.0)
|
||||
validEntries.Add(entries[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (validEntries.Count > 0)
|
||||
{
|
||||
SmallBulkEntry entry = validEntries[Utility.Random(validEntries.Count)];
|
||||
return new SmallCarpentryBOD(entry, material, amountMax, reqExceptional);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public override int ComputeFame()
|
||||
{
|
||||
return CarpentryRewardCalculator.Instance.ComputeFame(this);
|
||||
}
|
||||
|
||||
public override int ComputeGold()
|
||||
{
|
||||
return CarpentryRewardCalculator.Instance.ComputeGold(this);
|
||||
}
|
||||
|
||||
public override List<Item> ComputeRewards(bool full)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write((int)0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
211
Scripts/Services/BulkOrders/SmallBODs/SmallCookingBOD.cs
Normal file
211
Scripts/Services/BulkOrders/SmallBODs/SmallCookingBOD.cs
Normal file
@@ -0,0 +1,211 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Server.Engines.Craft;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
public class SmallCookingBOD : SmallBOD
|
||||
{
|
||||
public override BODType BODType { get { return BODType.Cooking; } }
|
||||
|
||||
[Constructable]
|
||||
public SmallCookingBOD()
|
||||
{
|
||||
SmallBulkEntry[] entries;
|
||||
bool nonexceptional = false;
|
||||
|
||||
if (0.20 > Utility.RandomDouble())
|
||||
{
|
||||
nonexceptional = true;
|
||||
entries = SmallBulkEntry.CookingSmallsRegular;
|
||||
}
|
||||
else
|
||||
{
|
||||
entries = SmallBulkEntry.CookingSmalls;
|
||||
}
|
||||
|
||||
if (entries.Length > 0)
|
||||
{
|
||||
int amountMax = Utility.RandomList(10, 15, 20);
|
||||
|
||||
BulkMaterialType material;
|
||||
material = BulkMaterialType.None;
|
||||
|
||||
SmallBulkEntry entry = entries[Utility.Random(entries.Length)];
|
||||
|
||||
Hue = 1169;
|
||||
AmountMax = amountMax;
|
||||
Type = entry.Type;
|
||||
Number = entry.Number;
|
||||
Graphic = entry.Graphic;
|
||||
Material = material;
|
||||
RequireExceptional = !nonexceptional && Utility.RandomBool();
|
||||
GraphicHue = entry.Hue;
|
||||
}
|
||||
}
|
||||
|
||||
public SmallCookingBOD(int amountCur, int amountMax, Type type, int number, int graphic, bool reqExceptional, BulkMaterialType mat, int hue)
|
||||
{
|
||||
Hue = 1169;
|
||||
AmountMax = amountMax;
|
||||
AmountCur = amountCur;
|
||||
Type = type;
|
||||
Number = number;
|
||||
Graphic = graphic;
|
||||
RequireExceptional = reqExceptional;
|
||||
Material = mat;
|
||||
GraphicHue = hue;
|
||||
}
|
||||
|
||||
public SmallCookingBOD(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
private SmallCookingBOD(SmallBulkEntry entry, int amountMax)
|
||||
{
|
||||
Hue = 1169;
|
||||
AmountMax = amountMax;
|
||||
Type = entry.Type;
|
||||
Number = entry.Number;
|
||||
Graphic = entry.Graphic;
|
||||
GraphicHue = entry.Hue;
|
||||
}
|
||||
|
||||
private SmallCookingBOD(SmallBulkEntry entry, int amountMax, bool reqExceptional)
|
||||
{
|
||||
Hue = 1169;
|
||||
AmountMax = amountMax;
|
||||
Type = entry.Type;
|
||||
Number = entry.Number;
|
||||
Graphic = entry.Graphic;
|
||||
GraphicHue = entry.Hue;
|
||||
RequireExceptional = reqExceptional;
|
||||
}
|
||||
|
||||
public static SmallCookingBOD CreateRandomFor(Mobile m)
|
||||
{
|
||||
SmallBulkEntry[] entries;
|
||||
|
||||
double theirSkill = BulkOrderSystem.GetBODSkill(m, SkillName.Cooking);
|
||||
bool nonexceptional = false;
|
||||
|
||||
if (0.20 > Utility.RandomDouble())
|
||||
{
|
||||
nonexceptional = true;
|
||||
entries = SmallBulkEntry.CookingSmallsRegular;
|
||||
}
|
||||
else
|
||||
{
|
||||
entries = SmallBulkEntry.CookingSmalls;
|
||||
}
|
||||
|
||||
if (entries.Length > 0)
|
||||
{
|
||||
int amountMax;
|
||||
|
||||
if (theirSkill >= 70.1)
|
||||
amountMax = Utility.RandomList(10, 15, 20, 20);
|
||||
else if (theirSkill >= 50.1)
|
||||
amountMax = Utility.RandomList(10, 15, 15, 20);
|
||||
else
|
||||
amountMax = Utility.RandomList(10, 10, 15, 20);
|
||||
|
||||
double excChance = 0.0;
|
||||
|
||||
if (theirSkill >= 70.1)
|
||||
excChance = (theirSkill + 80.0) / 200.0;
|
||||
|
||||
bool reqExceptional = !nonexceptional && excChance > Utility.RandomDouble();
|
||||
|
||||
CraftSystem system = DefCooking.CraftSystem;
|
||||
|
||||
List<SmallBulkEntry> validEntries = new List<SmallBulkEntry>();
|
||||
|
||||
for (int i = 0; i < entries.Length; ++i)
|
||||
{
|
||||
CraftItem item = system.CraftItems.SearchFor(entries[i].Type);
|
||||
|
||||
if (item != null)
|
||||
{
|
||||
bool allRequiredSkills = true;
|
||||
double chance = item.GetSuccessChance(m, null, system, false, ref allRequiredSkills);
|
||||
|
||||
if (allRequiredSkills && chance >= 0.0)
|
||||
{
|
||||
if (chance > 0.0)
|
||||
validEntries.Add(entries[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (validEntries.Count > 0)
|
||||
{
|
||||
SmallBulkEntry entry = validEntries[Utility.Random(validEntries.Count)];
|
||||
return new SmallCookingBOD(entry, amountMax, reqExceptional);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public override int ComputeFame()
|
||||
{
|
||||
return CookingRewardCalculator.Instance.ComputeFame(this);
|
||||
}
|
||||
|
||||
public override int ComputeGold()
|
||||
{
|
||||
return CookingRewardCalculator.Instance.ComputeGold(this);
|
||||
}
|
||||
|
||||
public override List<Item> ComputeRewards(bool full)
|
||||
{
|
||||
List<Item> list = new List<Item>();
|
||||
|
||||
RewardGroup rewardGroup = CookingRewardCalculator.Instance.LookupRewards(CookingRewardCalculator.Instance.ComputePoints(this));
|
||||
|
||||
if (rewardGroup != null)
|
||||
{
|
||||
if (full)
|
||||
{
|
||||
for (int i = 0; i < rewardGroup.Items.Length; ++i)
|
||||
{
|
||||
Item item = rewardGroup.Items[i].Construct();
|
||||
|
||||
if (item != null)
|
||||
list.Add(item);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
RewardItem rewardItem = rewardGroup.AcquireItem();
|
||||
|
||||
if (rewardItem != null)
|
||||
{
|
||||
Item item = rewardItem.Construct();
|
||||
|
||||
if (item != null)
|
||||
list.Add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write((int)0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
242
Scripts/Services/BulkOrders/SmallBODs/SmallFletchingBOD.cs
Normal file
242
Scripts/Services/BulkOrders/SmallBODs/SmallFletchingBOD.cs
Normal file
@@ -0,0 +1,242 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Server.Engines.Craft;
|
||||
using Server.Items;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
public class SmallFletchingBOD : SmallBOD
|
||||
{
|
||||
public static double[] m_FletchingMaterialChances = new double[]
|
||||
{
|
||||
0.513718750, // None
|
||||
0.292968750, // Oak
|
||||
0.117187500, // Ash
|
||||
0.046875000, // Yew
|
||||
0.018750000, // Heartwood
|
||||
0.007500000, // Bloodwood
|
||||
0.003000000 // Frostwood
|
||||
};
|
||||
|
||||
public override BODType BODType { get { return BODType.Fletching; } }
|
||||
|
||||
[Constructable]
|
||||
public SmallFletchingBOD()
|
||||
{
|
||||
SmallBulkEntry[] entries;
|
||||
bool useMaterials = false;
|
||||
|
||||
if (0.20 > Utility.RandomDouble())
|
||||
{
|
||||
entries = SmallBulkEntry.FletchingSmallsRegular;
|
||||
}
|
||||
else
|
||||
{
|
||||
useMaterials = true;
|
||||
entries = SmallBulkEntry.FletchingSmalls;
|
||||
}
|
||||
|
||||
if (entries.Length > 0)
|
||||
{
|
||||
SmallBulkEntry entry = entries[Utility.Random(entries.Length)];
|
||||
|
||||
int amountMax = Utility.RandomList(10, 15, 20);
|
||||
|
||||
BulkMaterialType material;
|
||||
|
||||
if (useMaterials)
|
||||
material = GetRandomMaterial(BulkMaterialType.OakWood, m_FletchingMaterialChances);
|
||||
else
|
||||
material = BulkMaterialType.None;
|
||||
|
||||
bool reqExceptional = false;
|
||||
|
||||
if(useMaterials)
|
||||
reqExceptional = Utility.RandomBool() || (material == BulkMaterialType.None);
|
||||
|
||||
this.Hue = 1425;
|
||||
this.AmountMax = amountMax;
|
||||
this.Type = entry.Type;
|
||||
this.Number = entry.Number;
|
||||
this.Graphic = entry.Graphic;
|
||||
this.RequireExceptional = reqExceptional;
|
||||
this.Material = material;
|
||||
this.GraphicHue = entry.Hue;
|
||||
}
|
||||
}
|
||||
|
||||
public SmallFletchingBOD(int amountCur, int amountMax, Type type, int number, int graphic, bool reqExceptional, BulkMaterialType mat, int hue)
|
||||
{
|
||||
this.Hue = 1425;
|
||||
this.AmountMax = amountMax;
|
||||
this.AmountCur = amountCur;
|
||||
this.Type = type;
|
||||
this.Number = number;
|
||||
this.Graphic = graphic;
|
||||
this.RequireExceptional = reqExceptional;
|
||||
this.Material = mat;
|
||||
this.GraphicHue = hue;
|
||||
}
|
||||
|
||||
public SmallFletchingBOD(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
private SmallFletchingBOD(SmallBulkEntry entry, BulkMaterialType material, int amountMax, bool reqExceptional)
|
||||
{
|
||||
this.Hue = 1425;
|
||||
this.AmountMax = amountMax;
|
||||
this.Type = entry.Type;
|
||||
this.Number = entry.Number;
|
||||
this.Graphic = entry.Graphic;
|
||||
this.RequireExceptional = reqExceptional;
|
||||
this.Material = material;
|
||||
}
|
||||
|
||||
public static SmallFletchingBOD CreateRandomFor(Mobile m)
|
||||
{
|
||||
SmallBulkEntry[] entries;
|
||||
|
||||
double theirSkill = BulkOrderSystem.GetBODSkill(m, SkillName.Fletching);
|
||||
bool useMaterials = false;
|
||||
|
||||
if (theirSkill < 30.0 || .20 > Utility.RandomDouble())
|
||||
{
|
||||
entries = SmallBulkEntry.FletchingSmallsRegular;
|
||||
}
|
||||
else
|
||||
{
|
||||
useMaterials = true;
|
||||
entries = SmallBulkEntry.FletchingSmalls;
|
||||
}
|
||||
|
||||
if (entries.Length > 0)
|
||||
{
|
||||
int amountMax;
|
||||
|
||||
if (theirSkill >= 70.1)
|
||||
amountMax = Utility.RandomList(10, 15, 20, 20);
|
||||
else if (theirSkill >= 50.1)
|
||||
amountMax = Utility.RandomList(10, 15, 15, 20);
|
||||
else
|
||||
amountMax = Utility.RandomList(10, 10, 15, 20);
|
||||
|
||||
BulkMaterialType material = BulkMaterialType.None;
|
||||
|
||||
if (useMaterials && theirSkill >= 70.1)
|
||||
{
|
||||
for (int i = 0; i < 20; ++i)
|
||||
{
|
||||
BulkMaterialType check = GetRandomMaterial(BulkMaterialType.OakWood, m_FletchingMaterialChances);
|
||||
double skillReq = GetRequiredSkill(check);
|
||||
|
||||
if (theirSkill >= skillReq)
|
||||
{
|
||||
material = check;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
double excChance = 0.0;
|
||||
|
||||
if (theirSkill >= 70.1)
|
||||
excChance = (theirSkill + 80.0) / 200.0;
|
||||
|
||||
bool reqExceptional = useMaterials && excChance > Utility.RandomDouble();
|
||||
|
||||
CraftSystem system = DefBowFletching.CraftSystem;
|
||||
|
||||
List<SmallBulkEntry> validEntries = new List<SmallBulkEntry>();
|
||||
|
||||
for (int i = 0; i < entries.Length; ++i)
|
||||
{
|
||||
CraftItem item = system.CraftItems.SearchFor(entries[i].Type);
|
||||
|
||||
if (item != null)
|
||||
{
|
||||
bool allRequiredSkills = true;
|
||||
double chance = item.GetSuccessChance(m, null, system, false, ref allRequiredSkills);
|
||||
|
||||
if (allRequiredSkills && chance >= 0.0)
|
||||
{
|
||||
if (reqExceptional)
|
||||
chance = item.GetExceptionalChance(system, chance, m);
|
||||
|
||||
if (chance > 0.0)
|
||||
validEntries.Add(entries[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (validEntries.Count > 0)
|
||||
{
|
||||
SmallBulkEntry entry = validEntries[Utility.Random(validEntries.Count)];
|
||||
return new SmallFletchingBOD(entry, material, amountMax, reqExceptional);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public override int ComputeFame()
|
||||
{
|
||||
return FletchingRewardCalculator.Instance.ComputeFame(this);
|
||||
}
|
||||
|
||||
public override int ComputeGold()
|
||||
{
|
||||
return FletchingRewardCalculator.Instance.ComputeGold(this);
|
||||
}
|
||||
|
||||
public override List<Item> ComputeRewards(bool full)
|
||||
{
|
||||
List<Item> list = new List<Item>();
|
||||
|
||||
RewardGroup rewardGroup = FletchingRewardCalculator.Instance.LookupRewards(FletchingRewardCalculator.Instance.ComputePoints(this));
|
||||
|
||||
if (rewardGroup != null)
|
||||
{
|
||||
if (full)
|
||||
{
|
||||
for (int i = 0; i < rewardGroup.Items.Length; ++i)
|
||||
{
|
||||
Item item = rewardGroup.Items[i].Construct();
|
||||
|
||||
if (item != null)
|
||||
list.Add(item);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
RewardItem rewardItem = rewardGroup.AcquireItem();
|
||||
|
||||
if (rewardItem != null)
|
||||
{
|
||||
Item item = rewardItem.Construct();
|
||||
|
||||
if (item != null)
|
||||
list.Add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write((int)0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
172
Scripts/Services/BulkOrders/SmallBODs/SmallInscriptionBOD.cs
Normal file
172
Scripts/Services/BulkOrders/SmallBODs/SmallInscriptionBOD.cs
Normal file
@@ -0,0 +1,172 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Server.Engines.Craft;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
public class SmallInscriptionBOD : SmallBOD
|
||||
{
|
||||
public override BODType BODType { get { return BODType.Inscription; } }
|
||||
|
||||
[Constructable]
|
||||
public SmallInscriptionBOD()
|
||||
{
|
||||
SmallBulkEntry[] entries = SmallBulkEntry.InscriptionSmalls;
|
||||
|
||||
if (entries.Length > 0)
|
||||
{
|
||||
int amountMax = Utility.RandomList(10, 15, 20);
|
||||
|
||||
BulkMaterialType material;
|
||||
material = BulkMaterialType.None;
|
||||
|
||||
SmallBulkEntry entry = entries[Utility.Random(entries.Length)];
|
||||
|
||||
this.Hue = 2598;
|
||||
this.AmountMax = amountMax;
|
||||
this.Type = entry.Type;
|
||||
this.Number = entry.Number;
|
||||
this.Graphic = entry.Graphic;
|
||||
this.Material = material;
|
||||
this.GraphicHue = entry.Hue;
|
||||
}
|
||||
}
|
||||
|
||||
public SmallInscriptionBOD(int amountCur, int amountMax, Type type, int number, int graphic, bool reqExceptional, BulkMaterialType mat, int hue)
|
||||
{
|
||||
this.Hue = 2598;
|
||||
this.AmountMax = amountMax;
|
||||
this.AmountCur = amountCur;
|
||||
this.Type = type;
|
||||
this.Number = number;
|
||||
this.Graphic = graphic;
|
||||
this.RequireExceptional = reqExceptional;
|
||||
this.Material = mat;
|
||||
this.GraphicHue = hue;
|
||||
}
|
||||
|
||||
public SmallInscriptionBOD(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
private SmallInscriptionBOD(SmallBulkEntry entry, int amountMax)
|
||||
{
|
||||
this.Hue = 2598;
|
||||
this.AmountMax = amountMax;
|
||||
this.Type = entry.Type;
|
||||
this.Number = entry.Number;
|
||||
this.Graphic = entry.Graphic;
|
||||
this.GraphicHue = entry.Hue;
|
||||
}
|
||||
|
||||
public static SmallInscriptionBOD CreateRandomFor(Mobile m)
|
||||
{
|
||||
SmallBulkEntry[] entries;
|
||||
|
||||
double theirSkill = BulkOrderSystem.GetBODSkill(m, SkillName.Inscribe);
|
||||
|
||||
entries = SmallBulkEntry.InscriptionSmalls;
|
||||
|
||||
if (entries.Length > 0)
|
||||
{
|
||||
int amountMax;
|
||||
|
||||
if (theirSkill >= 70.1)
|
||||
amountMax = Utility.RandomList(10, 15, 20, 20);
|
||||
else if (theirSkill >= 50.1)
|
||||
amountMax = Utility.RandomList(10, 15, 15, 20);
|
||||
else
|
||||
amountMax = Utility.RandomList(10, 10, 15, 20);
|
||||
|
||||
CraftSystem system = DefInscription.CraftSystem;
|
||||
|
||||
List<SmallBulkEntry> validEntries = new List<SmallBulkEntry>();
|
||||
|
||||
for (int i = 0; i < entries.Length; ++i)
|
||||
{
|
||||
CraftItem item = system.CraftItems.SearchFor(entries[i].Type);
|
||||
|
||||
if (item != null)
|
||||
{
|
||||
bool allRequiredSkills = true;
|
||||
double chance = item.GetSuccessChance(m, null, system, false, ref allRequiredSkills);
|
||||
|
||||
if (allRequiredSkills && chance >= 0.0)
|
||||
{
|
||||
if (chance > 0.0)
|
||||
validEntries.Add(entries[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (validEntries.Count > 0)
|
||||
{
|
||||
SmallBulkEntry entry = validEntries[Utility.Random(validEntries.Count)];
|
||||
return new SmallInscriptionBOD(entry, amountMax);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public override int ComputeFame()
|
||||
{
|
||||
return InscriptionRewardCalculator.Instance.ComputeFame(this);
|
||||
}
|
||||
|
||||
public override int ComputeGold()
|
||||
{
|
||||
return InscriptionRewardCalculator.Instance.ComputeGold(this);
|
||||
}
|
||||
|
||||
public override List<Item> ComputeRewards(bool full)
|
||||
{
|
||||
List<Item> list = new List<Item>();
|
||||
|
||||
RewardGroup rewardGroup = InscriptionRewardCalculator.Instance.LookupRewards(InscriptionRewardCalculator.Instance.ComputePoints(this));
|
||||
|
||||
if (rewardGroup != null)
|
||||
{
|
||||
if (full)
|
||||
{
|
||||
for (int i = 0; i < rewardGroup.Items.Length; ++i)
|
||||
{
|
||||
Item item = rewardGroup.Items[i].Construct();
|
||||
|
||||
if (item != null)
|
||||
list.Add(item);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
RewardItem rewardItem = rewardGroup.AcquireItem();
|
||||
|
||||
if (rewardItem != null)
|
||||
{
|
||||
Item item = rewardItem.Construct();
|
||||
|
||||
if (item != null)
|
||||
list.Add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write((int)0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
230
Scripts/Services/BulkOrders/SmallBODs/SmallSmithBOD.cs
Normal file
230
Scripts/Services/BulkOrders/SmallBODs/SmallSmithBOD.cs
Normal file
@@ -0,0 +1,230 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Server.Engines.Craft;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
[TypeAlias("Scripts.Engines.BulkOrders.SmallSmithBOD")]
|
||||
public class SmallSmithBOD : SmallBOD
|
||||
{
|
||||
public override BODType BODType { get { return BODType.Smith; } }
|
||||
|
||||
public static double[] m_BlacksmithMaterialChances = new double[]
|
||||
{
|
||||
0.501953125, // None
|
||||
0.250000000, // Dull Copper
|
||||
0.125000000, // Shadow Iron
|
||||
0.062500000, // Copper
|
||||
0.031250000, // Bronze
|
||||
0.015625000, // Gold
|
||||
0.007812500, // Agapite
|
||||
0.003906250, // Verite
|
||||
0.001953125 // Valorite
|
||||
};
|
||||
[Constructable]
|
||||
public SmallSmithBOD()
|
||||
{
|
||||
SmallBulkEntry[] entries;
|
||||
bool useMaterials;
|
||||
|
||||
if (useMaterials = Utility.RandomBool())
|
||||
entries = SmallBulkEntry.BlacksmithArmor;
|
||||
else
|
||||
entries = SmallBulkEntry.BlacksmithWeapons;
|
||||
|
||||
if (entries.Length > 0)
|
||||
{
|
||||
int hue = 0x44E;
|
||||
int amountMax = Utility.RandomList(10, 15, 20);
|
||||
|
||||
BulkMaterialType material;
|
||||
|
||||
if (useMaterials)
|
||||
material = GetRandomMaterial(BulkMaterialType.DullCopper, m_BlacksmithMaterialChances);
|
||||
else
|
||||
material = BulkMaterialType.None;
|
||||
|
||||
bool reqExceptional = Utility.RandomBool() || (material == BulkMaterialType.None);
|
||||
|
||||
SmallBulkEntry entry = entries[Utility.Random(entries.Length)];
|
||||
|
||||
Hue = hue;
|
||||
AmountMax = amountMax;
|
||||
Type = entry.Type;
|
||||
Number = entry.Number;
|
||||
Graphic = entry.Graphic;
|
||||
RequireExceptional = reqExceptional;
|
||||
Material = material;
|
||||
GraphicHue = entry.Hue;
|
||||
}
|
||||
}
|
||||
|
||||
public SmallSmithBOD(int amountCur, int amountMax, Type type, int number, int graphic, bool reqExceptional, BulkMaterialType mat, int hue)
|
||||
{
|
||||
Hue = 0x44E;
|
||||
AmountMax = amountMax;
|
||||
AmountCur = amountCur;
|
||||
Type = type;
|
||||
Number = number;
|
||||
Graphic = graphic;
|
||||
RequireExceptional = reqExceptional;
|
||||
Material = mat;
|
||||
GraphicHue = hue;
|
||||
}
|
||||
|
||||
public SmallSmithBOD(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
private SmallSmithBOD(SmallBulkEntry entry, BulkMaterialType material, int amountMax, bool reqExceptional)
|
||||
{
|
||||
Hue = 0x44E;
|
||||
AmountMax = amountMax;
|
||||
Type = entry.Type;
|
||||
Number = entry.Number;
|
||||
Graphic = entry.Graphic;
|
||||
RequireExceptional = reqExceptional;
|
||||
Material = material;
|
||||
}
|
||||
|
||||
public static SmallSmithBOD CreateRandomFor(Mobile m)
|
||||
{
|
||||
SmallBulkEntry[] entries;
|
||||
bool useMaterials;
|
||||
|
||||
if (useMaterials = Utility.RandomBool())
|
||||
entries = SmallBulkEntry.BlacksmithArmor;
|
||||
else
|
||||
entries = SmallBulkEntry.BlacksmithWeapons;
|
||||
|
||||
if (entries.Length > 0)
|
||||
{
|
||||
double theirSkill = BulkOrderSystem.GetBODSkill(m, SkillName.Blacksmith);
|
||||
int amountMax;
|
||||
|
||||
if (theirSkill >= 70.1)
|
||||
amountMax = Utility.RandomList(10, 15, 20, 20);
|
||||
else if (theirSkill >= 50.1)
|
||||
amountMax = Utility.RandomList(10, 15, 15, 20);
|
||||
else
|
||||
amountMax = Utility.RandomList(10, 10, 15, 20);
|
||||
|
||||
BulkMaterialType material = BulkMaterialType.None;
|
||||
|
||||
if (useMaterials && theirSkill >= 70.1)
|
||||
{
|
||||
for (int i = 0; i < 20; ++i)
|
||||
{
|
||||
BulkMaterialType check = GetRandomMaterial(BulkMaterialType.DullCopper, m_BlacksmithMaterialChances);
|
||||
double skillReq = GetRequiredSkill(check);
|
||||
|
||||
if (theirSkill >= skillReq)
|
||||
{
|
||||
material = check;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
double excChance = 0.0;
|
||||
|
||||
if (theirSkill >= 70.1)
|
||||
excChance = (theirSkill + 80.0) / 200.0;
|
||||
|
||||
bool reqExceptional = (excChance > Utility.RandomDouble());
|
||||
|
||||
CraftSystem system = DefBlacksmithy.CraftSystem;
|
||||
|
||||
List<SmallBulkEntry> validEntries = new List<SmallBulkEntry>();
|
||||
|
||||
for (int i = 0; i < entries.Length; ++i)
|
||||
{
|
||||
CraftItem item = system.CraftItems.SearchFor(entries[i].Type);
|
||||
|
||||
if (item != null)
|
||||
{
|
||||
bool allRequiredSkills = true;
|
||||
double chance = item.GetSuccessChance(m, null, system, false, ref allRequiredSkills);
|
||||
|
||||
if (allRequiredSkills && chance >= 0.0)
|
||||
{
|
||||
if (reqExceptional)
|
||||
chance = item.GetExceptionalChance(system, chance, m);
|
||||
|
||||
if (chance > 0.0)
|
||||
validEntries.Add(entries[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (validEntries.Count > 0)
|
||||
{
|
||||
SmallBulkEntry entry = validEntries[Utility.Random(validEntries.Count)];
|
||||
return new SmallSmithBOD(entry, material, amountMax, reqExceptional);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public override int ComputeFame()
|
||||
{
|
||||
return SmithRewardCalculator.Instance.ComputeFame(this);
|
||||
}
|
||||
|
||||
public override int ComputeGold()
|
||||
{
|
||||
return SmithRewardCalculator.Instance.ComputeGold(this);
|
||||
}
|
||||
|
||||
public override List<Item> ComputeRewards(bool full)
|
||||
{
|
||||
List<Item> list = new List<Item>();
|
||||
|
||||
RewardGroup rewardGroup = SmithRewardCalculator.Instance.LookupRewards(SmithRewardCalculator.Instance.ComputePoints(this));
|
||||
|
||||
if (rewardGroup != null)
|
||||
{
|
||||
if (full)
|
||||
{
|
||||
for (int i = 0; i < rewardGroup.Items.Length; ++i)
|
||||
{
|
||||
Item item = rewardGroup.Items[i].Construct();
|
||||
|
||||
if (item != null)
|
||||
list.Add(item);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
RewardItem rewardItem = rewardGroup.AcquireItem();
|
||||
|
||||
if (rewardItem != null)
|
||||
{
|
||||
Item item = rewardItem.Construct();
|
||||
|
||||
if (item != null)
|
||||
list.Add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write((int)0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
224
Scripts/Services/BulkOrders/SmallBODs/SmallTailorBOD.cs
Normal file
224
Scripts/Services/BulkOrders/SmallBODs/SmallTailorBOD.cs
Normal file
@@ -0,0 +1,224 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Server.Engines.Craft;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
public class SmallTailorBOD : SmallBOD
|
||||
{
|
||||
public override BODType BODType { get { return BODType.Tailor; } }
|
||||
|
||||
public static double[] m_TailoringMaterialChances = new double[]
|
||||
{
|
||||
0.857421875, // None
|
||||
0.125000000, // Spined
|
||||
0.015625000, // Horned
|
||||
0.001953125 // Barbed
|
||||
};
|
||||
[Constructable]
|
||||
public SmallTailorBOD()
|
||||
{
|
||||
SmallBulkEntry[] entries;
|
||||
bool useMaterials;
|
||||
|
||||
if (useMaterials = Utility.RandomBool())
|
||||
entries = SmallBulkEntry.TailorLeather;
|
||||
else
|
||||
entries = SmallBulkEntry.TailorCloth;
|
||||
|
||||
if (entries.Length > 0)
|
||||
{
|
||||
int hue = 0x483;
|
||||
int amountMax = Utility.RandomList(10, 15, 20);
|
||||
|
||||
BulkMaterialType material;
|
||||
|
||||
if (useMaterials)
|
||||
material = GetRandomMaterial(BulkMaterialType.Spined, m_TailoringMaterialChances);
|
||||
else
|
||||
material = BulkMaterialType.None;
|
||||
|
||||
bool reqExceptional = Utility.RandomBool() || (material == BulkMaterialType.None);
|
||||
|
||||
SmallBulkEntry entry = entries[Utility.Random(entries.Length)];
|
||||
|
||||
this.Hue = hue;
|
||||
this.AmountMax = amountMax;
|
||||
this.Type = entry.Type;
|
||||
this.Number = entry.Number;
|
||||
this.Graphic = entry.Graphic;
|
||||
this.RequireExceptional = reqExceptional;
|
||||
this.Material = material;
|
||||
this.GraphicHue = entry.Hue;
|
||||
}
|
||||
}
|
||||
|
||||
public SmallTailorBOD(int amountCur, int amountMax, Type type, int number, int graphic, bool reqExceptional, BulkMaterialType mat, int hue)
|
||||
{
|
||||
this.Hue = 0x483;
|
||||
this.AmountMax = amountMax;
|
||||
this.AmountCur = amountCur;
|
||||
this.Type = type;
|
||||
this.Number = number;
|
||||
this.Graphic = graphic;
|
||||
this.RequireExceptional = reqExceptional;
|
||||
this.Material = mat;
|
||||
this.GraphicHue = hue;
|
||||
}
|
||||
|
||||
public SmallTailorBOD(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
private SmallTailorBOD(SmallBulkEntry entry, BulkMaterialType material, int amountMax, bool reqExceptional)
|
||||
{
|
||||
this.Hue = 0x483;
|
||||
this.AmountMax = amountMax;
|
||||
this.Type = entry.Type;
|
||||
this.Number = entry.Number;
|
||||
this.Graphic = entry.Graphic;
|
||||
this.RequireExceptional = reqExceptional;
|
||||
this.Material = material;
|
||||
}
|
||||
|
||||
public static SmallTailorBOD CreateRandomFor(Mobile m)
|
||||
{
|
||||
SmallBulkEntry[] entries;
|
||||
bool useMaterials = Utility.RandomBool();
|
||||
|
||||
double theirSkill = BulkOrderSystem.GetBODSkill(m, SkillName.Tailoring);
|
||||
if (useMaterials && theirSkill >= 6.2) // Ugly, but the easiest leather BOD is Leather Cap which requires at least 6.2 skill.
|
||||
entries = SmallBulkEntry.TailorLeather;
|
||||
else
|
||||
entries = SmallBulkEntry.TailorCloth;
|
||||
|
||||
if (entries.Length > 0)
|
||||
{
|
||||
int amountMax;
|
||||
|
||||
if (theirSkill >= 70.1)
|
||||
amountMax = Utility.RandomList(10, 15, 20, 20);
|
||||
else if (theirSkill >= 50.1)
|
||||
amountMax = Utility.RandomList(10, 15, 15, 20);
|
||||
else
|
||||
amountMax = Utility.RandomList(10, 10, 15, 20);
|
||||
|
||||
BulkMaterialType material = BulkMaterialType.None;
|
||||
|
||||
if (useMaterials && theirSkill >= 70.1)
|
||||
{
|
||||
for (int i = 0; i < 20; ++i)
|
||||
{
|
||||
BulkMaterialType check = GetRandomMaterial(BulkMaterialType.Spined, m_TailoringMaterialChances);
|
||||
double skillReq = GetRequiredSkill(check);
|
||||
|
||||
if (theirSkill >= skillReq)
|
||||
{
|
||||
material = check;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
double excChance = 0.0;
|
||||
|
||||
if (theirSkill >= 70.1)
|
||||
excChance = (theirSkill + 80.0) / 200.0;
|
||||
|
||||
bool reqExceptional = (excChance > Utility.RandomDouble());
|
||||
|
||||
CraftSystem system = DefTailoring.CraftSystem;
|
||||
|
||||
List<SmallBulkEntry> validEntries = new List<SmallBulkEntry>();
|
||||
|
||||
for (int i = 0; i < entries.Length; ++i)
|
||||
{
|
||||
CraftItem item = system.CraftItems.SearchFor(entries[i].Type);
|
||||
|
||||
if (item != null)
|
||||
{
|
||||
bool allRequiredSkills = true;
|
||||
double chance = item.GetSuccessChance(m, null, system, false, ref allRequiredSkills);
|
||||
|
||||
if (allRequiredSkills && chance >= 0.0)
|
||||
{
|
||||
if (reqExceptional)
|
||||
chance = item.GetExceptionalChance(system, chance, m);
|
||||
|
||||
if (chance > 0.0)
|
||||
validEntries.Add(entries[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (validEntries.Count > 0)
|
||||
{
|
||||
SmallBulkEntry entry = validEntries[Utility.Random(validEntries.Count)];
|
||||
return new SmallTailorBOD(entry, material, amountMax, reqExceptional);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public override int ComputeFame()
|
||||
{
|
||||
return TailorRewardCalculator.Instance.ComputeFame(this);
|
||||
}
|
||||
|
||||
public override int ComputeGold()
|
||||
{
|
||||
return TailorRewardCalculator.Instance.ComputeGold(this);
|
||||
}
|
||||
|
||||
public override List<Item> ComputeRewards(bool full)
|
||||
{
|
||||
List<Item> list = new List<Item>();
|
||||
|
||||
RewardGroup rewardGroup = TailorRewardCalculator.Instance.LookupRewards(TailorRewardCalculator.Instance.ComputePoints(this));
|
||||
|
||||
if (rewardGroup != null)
|
||||
{
|
||||
if (full)
|
||||
{
|
||||
for (int i = 0; i < rewardGroup.Items.Length; ++i)
|
||||
{
|
||||
Item item = rewardGroup.Items[i].Construct();
|
||||
|
||||
if (item != null)
|
||||
list.Add(item);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
RewardItem rewardItem = rewardGroup.AcquireItem();
|
||||
|
||||
if (rewardItem != null)
|
||||
{
|
||||
Item item = rewardItem.Construct();
|
||||
|
||||
if (item != null)
|
||||
list.Add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write((int)0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
410
Scripts/Services/BulkOrders/SmallBODs/SmallTinkerBOD.cs
Normal file
410
Scripts/Services/BulkOrders/SmallBODs/SmallTinkerBOD.cs
Normal file
@@ -0,0 +1,410 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Server.Engines.Craft;
|
||||
using Server.Items;
|
||||
using System.Linq;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
public class SmallTinkerBOD : SmallBOD
|
||||
{
|
||||
public override BODType BODType { get { return BODType.Tinkering; } }
|
||||
|
||||
private GemType _GemType;
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public GemType GemType
|
||||
{
|
||||
get { return _GemType; }
|
||||
set
|
||||
{
|
||||
if (this.Type != null && this.Type.IsSubclassOf(typeof(BaseJewel)))
|
||||
{
|
||||
_GemType = value;
|
||||
AssignGemNumber(this.Type);
|
||||
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static double[] m_TinkerMaterialChances = new double[]
|
||||
{
|
||||
0.501953125, // None
|
||||
0.250000000, // Dull Copper
|
||||
0.125000000, // Shadow Iron
|
||||
0.062500000, // Copper
|
||||
0.031250000, // Bronze
|
||||
0.015625000, // Gold
|
||||
0.007812500, // Agapite
|
||||
0.003906250, // Verite
|
||||
0.001953125 // Valorite
|
||||
};
|
||||
|
||||
[Constructable]
|
||||
public SmallTinkerBOD()
|
||||
{
|
||||
SmallBulkEntry[] entries;
|
||||
bool useMaterials;
|
||||
|
||||
if (useMaterials = 0.75 > Utility.RandomDouble())
|
||||
entries = SmallBulkEntry.TinkeringSmalls;
|
||||
else
|
||||
entries = SmallBulkEntry.TinkeringSmallsRegular;
|
||||
|
||||
if (entries.Length > 0)
|
||||
{
|
||||
int amountMax = Utility.RandomList(10, 15, 20);
|
||||
|
||||
BulkMaterialType material;
|
||||
|
||||
if (useMaterials)
|
||||
material = GetRandomMaterial(BulkMaterialType.DullCopper, m_TinkerMaterialChances);
|
||||
else
|
||||
material = BulkMaterialType.None;
|
||||
|
||||
bool reqExceptional = useMaterials ? Utility.RandomBool() : false;
|
||||
|
||||
SmallBulkEntry entry = entries[Utility.Random(entries.Length)];
|
||||
|
||||
if (material != BulkMaterialType.None && CannotAssignMaterial(entry.Type))
|
||||
{
|
||||
material = BulkMaterialType.None;
|
||||
}
|
||||
|
||||
Hue = 1109;
|
||||
AmountMax = amountMax;
|
||||
Type = entry.Type;
|
||||
Number = entry.Number;
|
||||
Graphic = entry.Graphic;
|
||||
RequireExceptional = reqExceptional;
|
||||
Material = material;
|
||||
GraphicHue = entry.Hue;
|
||||
|
||||
if (entry.Type.IsSubclassOf(typeof(BaseJewel)))
|
||||
{
|
||||
AssignGemType(entry.Type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public SmallTinkerBOD(int amountCur, int amountMax, Type type, int number, int graphic, bool reqExceptional, BulkMaterialType mat, int hue, GemType gemType)
|
||||
{
|
||||
Hue = 1109;
|
||||
AmountMax = amountMax;
|
||||
AmountCur = amountCur;
|
||||
Type = type;
|
||||
Number = number;
|
||||
Graphic = graphic;
|
||||
RequireExceptional = reqExceptional;
|
||||
Material = mat;
|
||||
GraphicHue = hue;
|
||||
GemType = gemType;
|
||||
}
|
||||
|
||||
public SmallTinkerBOD(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
private SmallTinkerBOD(SmallBulkEntry entry, BulkMaterialType material, int amountMax, bool reqExceptional)
|
||||
{
|
||||
Hue = 1109;
|
||||
AmountMax = amountMax;
|
||||
Type = entry.Type;
|
||||
Number = entry.Number;
|
||||
Graphic = entry.Graphic;
|
||||
RequireExceptional = reqExceptional;
|
||||
Material = material;
|
||||
}
|
||||
|
||||
public static SmallTinkerBOD CreateRandomFor(Mobile m)
|
||||
{
|
||||
SmallBulkEntry[] entries;
|
||||
bool useMaterials;
|
||||
|
||||
if (useMaterials = 0.75 > Utility.RandomDouble())
|
||||
entries = SmallBulkEntry.TinkeringSmalls;
|
||||
else
|
||||
entries = SmallBulkEntry.TinkeringSmallsRegular;
|
||||
|
||||
if (entries.Length > 0)
|
||||
{
|
||||
double theirSkill = BulkOrderSystem.GetBODSkill(m, SkillName.Tinkering);
|
||||
int amountMax;
|
||||
|
||||
if (theirSkill >= 70.1)
|
||||
amountMax = Utility.RandomList(10, 15, 20, 20);
|
||||
else if (theirSkill >= 50.1)
|
||||
amountMax = Utility.RandomList(10, 15, 15, 20);
|
||||
else
|
||||
amountMax = Utility.RandomList(10, 10, 15, 20);
|
||||
|
||||
BulkMaterialType material = BulkMaterialType.None;
|
||||
|
||||
if (useMaterials && theirSkill >= 70.1)
|
||||
{
|
||||
for (int i = 0; i < 20; ++i)
|
||||
{
|
||||
BulkMaterialType check = GetRandomMaterial(BulkMaterialType.DullCopper, m_TinkerMaterialChances);
|
||||
double skillReq = GetRequiredSkill(check);
|
||||
|
||||
if (theirSkill >= skillReq)
|
||||
{
|
||||
material = check;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
double excChance = 0.0;
|
||||
|
||||
if (useMaterials && theirSkill >= 70.1)
|
||||
excChance = (theirSkill + 80.0) / 200.0;
|
||||
|
||||
bool reqExceptional = (excChance > Utility.RandomDouble());
|
||||
|
||||
CraftSystem system = DefTinkering.CraftSystem;
|
||||
|
||||
List<SmallBulkEntry> validEntries = new List<SmallBulkEntry>();
|
||||
|
||||
for (int i = 0; i < entries.Length; ++i)
|
||||
{
|
||||
CraftItem item = system.CraftItems.SearchFor(entries[i].Type);
|
||||
|
||||
if (item != null)
|
||||
{
|
||||
bool allRequiredSkills = true;
|
||||
double chance = item.GetSuccessChance(m, null, system, false, ref allRequiredSkills);
|
||||
|
||||
if (allRequiredSkills && chance >= 0.0)
|
||||
{
|
||||
if (reqExceptional)
|
||||
chance = item.GetExceptionalChance(system, chance, m);
|
||||
|
||||
if (chance > 0.0)
|
||||
validEntries.Add(entries[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (validEntries.Count > 0)
|
||||
{
|
||||
SmallBulkEntry entry = validEntries[Utility.Random(validEntries.Count)];
|
||||
|
||||
if (material != BulkMaterialType.None && CannotAssignMaterial(entry.Type))
|
||||
{
|
||||
material = BulkMaterialType.None;
|
||||
}
|
||||
|
||||
var bod = new SmallTinkerBOD(entry, material, amountMax, reqExceptional);
|
||||
|
||||
if (entry.Type.IsSubclassOf(typeof(BaseJewel)))
|
||||
{
|
||||
bod.AssignGemType(entry.Type);
|
||||
}
|
||||
|
||||
return bod;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static bool CannotAssignMaterial(Type t)
|
||||
{
|
||||
return _NonMaterials.Any(x => x == t || t.IsSubclassOf(x));
|
||||
}
|
||||
|
||||
private static Type[] _NonMaterials =
|
||||
{
|
||||
typeof(BaseTool), typeof(SmithyHammer), typeof(BaseJewel)
|
||||
};
|
||||
|
||||
public override bool CheckType(Type type)
|
||||
{
|
||||
bool check = base.CheckType(type);
|
||||
|
||||
if (!check)
|
||||
{
|
||||
check = CheckTinkerType(type, Type);
|
||||
}
|
||||
|
||||
return check;
|
||||
}
|
||||
|
||||
public override bool CheckType(Item item)
|
||||
{
|
||||
if (_GemType != GemType.None && (!(item is BaseJewel) || ((BaseJewel)item).GemType != _GemType))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool check = base.CheckType(item);
|
||||
|
||||
if (!check)
|
||||
{
|
||||
check = CheckTinkerType(item.GetType(), Type);
|
||||
}
|
||||
|
||||
return check;
|
||||
}
|
||||
|
||||
/* Tinkering needs conditional check for combining:
|
||||
* SpoonLeft/SpoonRight, ForkLeft/ForkRight, KnifeLeft/KnifeRight, ClockRight/ClockLeft
|
||||
*/
|
||||
private static Type[][] _TinkerTypeTable =
|
||||
{
|
||||
new Type[] { typeof(Spoon), typeof(SpoonRight), typeof(SpoonLeft) },
|
||||
new Type[] { typeof(Fork), typeof(ForkRight), typeof(ForkLeft) },
|
||||
new Type[] { typeof(Knife), typeof(KnifeRight), typeof(KnifeLeft) },
|
||||
new Type[] { typeof(Clock), typeof(ClockRight), typeof(ClockLeft) },
|
||||
new Type[] { typeof(GoldRing), typeof(SilverRing) },
|
||||
new Type[] { typeof(GoldBracelet), typeof(SilverBracelet) },
|
||||
new Type[] { typeof(GoldEarrings), typeof(SilverEarrings) },
|
||||
new Type[] { typeof(SmithHammer), typeof(SmithyHammer) }
|
||||
};
|
||||
|
||||
public static bool CheckTinkerType(Type actual, Type lookingfor)
|
||||
{
|
||||
foreach (Type[] types in _TinkerTypeTable)
|
||||
{
|
||||
foreach (Type t in types)
|
||||
{
|
||||
if (t == lookingfor) // found the list, lets see if the actual is here
|
||||
{
|
||||
foreach (Type t2 in types)
|
||||
{
|
||||
if (t2 == actual)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*if (types[0] == lookingfor)
|
||||
{
|
||||
foreach (Type t in types)
|
||||
{
|
||||
if (actual == t)
|
||||
return true;
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public override int ComputeFame()
|
||||
{
|
||||
return TinkeringRewardCalculator.Instance.ComputeFame(this);
|
||||
}
|
||||
|
||||
public override int ComputeGold()
|
||||
{
|
||||
return TinkeringRewardCalculator.Instance.ComputeGold(this);
|
||||
}
|
||||
|
||||
public override List<Item> ComputeRewards(bool full)
|
||||
{
|
||||
List<Item> list = new List<Item>();
|
||||
|
||||
RewardGroup rewardGroup = TinkeringRewardCalculator.Instance.LookupRewards(TinkeringRewardCalculator.Instance.ComputePoints(this));
|
||||
|
||||
if (rewardGroup != null)
|
||||
{
|
||||
if (full)
|
||||
{
|
||||
for (int i = 0; i < rewardGroup.Items.Length; ++i)
|
||||
{
|
||||
Item item = rewardGroup.Items[i].Construct();
|
||||
|
||||
if (item != null)
|
||||
list.Add(item);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
RewardItem rewardItem = rewardGroup.AcquireItem();
|
||||
|
||||
if (rewardItem != null)
|
||||
{
|
||||
Item item = rewardItem.Construct();
|
||||
|
||||
if (item != null)
|
||||
list.Add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
public void AssignGemType(Type jewelType)
|
||||
{
|
||||
_GemType = (GemType)Utility.RandomMinMax(1, 9);
|
||||
|
||||
AssignGemNumber(jewelType);
|
||||
}
|
||||
|
||||
public void AssignGemNumber(Type jewelType)
|
||||
{
|
||||
int offset = (int)GemType - 1;
|
||||
int loc = 0;
|
||||
|
||||
if (jewelType == typeof(GoldRing) || jewelType == typeof(SilverRing))
|
||||
{
|
||||
loc = 1044176;
|
||||
}
|
||||
else if (jewelType == typeof(GoldBracelet) || jewelType == typeof(SilverBracelet))
|
||||
{
|
||||
loc = 1044221;
|
||||
}
|
||||
else
|
||||
{
|
||||
loc = 1044203;
|
||||
}
|
||||
|
||||
this.Number = loc + offset;
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write((int)2); // version
|
||||
|
||||
writer.Write((int)GemType);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch (version)
|
||||
{
|
||||
case 2:
|
||||
GemType = (GemType)reader.ReadInt();
|
||||
break;
|
||||
case 1:
|
||||
break;
|
||||
}
|
||||
|
||||
if (version < 2)
|
||||
{
|
||||
if (CannotAssignMaterial(Type) && Material != BulkMaterialType.None)
|
||||
{
|
||||
Material = BulkMaterialType.None;
|
||||
}
|
||||
|
||||
if (this.Type.IsSubclassOf(typeof(BaseJewel)))
|
||||
{
|
||||
AssignGemType(this.Type);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user