Overwrite

Complete Overwrite of the Folder with the free shard. ServUO 57.3 has been added.
This commit is contained in:
Unstable Kitsune
2023-11-28 23:20:26 -05:00
parent 3cd54811de
commit b918192e4e
11608 changed files with 2644205 additions and 47 deletions

View 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();
}
}
}

View 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();
}
}
}

View 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();
}
}
}
}

View 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();
}
});
}
}
}
}

View 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);
}
}
}

View 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);
}
}
}

View 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();
}
}
}

View 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();
}
}
}

View 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();
}
}
}

View 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();
}
}
}

View 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();
}
}
}

View 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();
}
}
}

View 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();
}
}
}
}
}