Overwrite
Complete Overwrite of the Folder with the free shard. ServUO 57.3 has been added.
This commit is contained in:
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