Overwrite
Complete Overwrite of the Folder with the free shard. ServUO 57.3 has been added.
This commit is contained in:
@@ -0,0 +1,73 @@
|
||||
using Server;
|
||||
using System;
|
||||
using Server.Items;
|
||||
|
||||
namespace Server.Engines.Distillation
|
||||
{
|
||||
public class CraftDefinition
|
||||
{
|
||||
private Group m_Group;
|
||||
private Liquor m_Liquor;
|
||||
private Type[] m_Ingredients;
|
||||
private int[] m_Amounts;
|
||||
private int[] m_Labels;
|
||||
private TimeSpan m_MaturationDuration;
|
||||
|
||||
public Group Group { get { return m_Group; } }
|
||||
public Liquor Liquor { get { return m_Liquor; } }
|
||||
public Type[] Ingredients { get { return m_Ingredients; } }
|
||||
public int[] Amounts { get { return m_Amounts; } }
|
||||
public int[] Labels { get { return m_Labels; } }
|
||||
public TimeSpan MaturationDuration { get { return m_MaturationDuration; } }
|
||||
|
||||
public CraftDefinition(Group group, Liquor liquor, Type[] ingredients, int[] amounts, TimeSpan matureperiod)
|
||||
{
|
||||
m_Group = group;
|
||||
m_Liquor = liquor;
|
||||
m_Ingredients = ingredients;
|
||||
m_Amounts = amounts;
|
||||
m_MaturationDuration = matureperiod;
|
||||
|
||||
m_Labels = new int[m_Ingredients.Length];
|
||||
|
||||
for(int i = 0; i < m_Ingredients.Length; i++)
|
||||
{
|
||||
Type type = m_Ingredients[i];
|
||||
|
||||
if(type == typeof(Yeast))
|
||||
m_Labels[i] = 1150453;
|
||||
else if (type == typeof(WheatWort))
|
||||
m_Labels[i] = 1150275;
|
||||
else if (type == typeof(PewterBowlOfCorn))
|
||||
m_Labels[i] = 1025631;
|
||||
else if (type == typeof(PewterBowlOfPotatos))
|
||||
m_Labels[i] = 1025634;
|
||||
else if (type == typeof(TribalBerry))
|
||||
m_Labels[i] = 1040001;
|
||||
else if (type == typeof(HoneydewMelon))
|
||||
m_Labels[i] = 1023189;
|
||||
else if (type == typeof(JarHoney))
|
||||
m_Labels[i] = 1022540;
|
||||
else if (type == typeof(Pitcher))
|
||||
{
|
||||
if(m_Liquor == Liquor.Brandy)
|
||||
m_Labels[i] = 1028091; // pitcher of wine
|
||||
else
|
||||
m_Labels[i] = 1024088; // pitcher of water
|
||||
}
|
||||
else if (type == typeof(Dates))
|
||||
m_Labels[i] = 1025927;
|
||||
else
|
||||
{
|
||||
Item item = Loot.Construct(type);
|
||||
if(item != null)
|
||||
{
|
||||
m_Labels[i] = item.LabelNumber;
|
||||
item.Delete();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
using Server;
|
||||
using System;
|
||||
using Server.Items;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
||||
namespace Server.Engines.Distillation
|
||||
{
|
||||
public class DistillationContext
|
||||
{
|
||||
private Group m_LastGroup;
|
||||
private Liquor m_LastLiquor;
|
||||
private Yeast[] m_SelectedYeast = new Yeast[4];
|
||||
private bool m_MakeStrong;
|
||||
private bool m_Mark;
|
||||
private string m_Label;
|
||||
|
||||
public Group LastGroup { get { return m_LastGroup; } set { m_LastGroup = value; } }
|
||||
public Liquor LastLiquor { get { return m_LastLiquor; } set { m_LastLiquor = value; } }
|
||||
public Yeast[] SelectedYeast { get { return m_SelectedYeast; } }
|
||||
public bool MakeStrong { get { return m_MakeStrong; } set { m_MakeStrong = value; } }
|
||||
public bool Mark { get { return m_Mark; } set { m_Mark = value; } }
|
||||
public string Label { get { return m_Label; } set { m_Label = value; } }
|
||||
|
||||
public DistillationContext()
|
||||
{
|
||||
m_LastGroup = Group.WheatBased;
|
||||
m_LastLiquor = Liquor.None;
|
||||
m_MakeStrong = false;
|
||||
m_Mark = true;
|
||||
m_Label = null;
|
||||
}
|
||||
|
||||
public bool YeastInUse(Yeast yeast)
|
||||
{
|
||||
foreach(Yeast y in m_SelectedYeast)
|
||||
{
|
||||
if(y != null && y == yeast)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void ClearYeasts()
|
||||
{
|
||||
for(int i = 0; i < m_SelectedYeast.Length; i++)
|
||||
{
|
||||
m_SelectedYeast[i] = null;
|
||||
}
|
||||
}
|
||||
|
||||
public DistillationContext(GenericReader reader)
|
||||
{
|
||||
int version = reader.ReadInt();
|
||||
|
||||
m_LastGroup = (Group)reader.ReadInt();
|
||||
m_LastLiquor = (Liquor)reader.ReadInt();
|
||||
m_MakeStrong = reader.ReadBool();
|
||||
m_Mark = reader.ReadBool();
|
||||
m_Label = reader.ReadString();
|
||||
}
|
||||
|
||||
public void Serialize(GenericWriter writer)
|
||||
{
|
||||
writer.Write((int)0);
|
||||
|
||||
writer.Write((int)m_LastGroup);
|
||||
writer.Write((int)m_LastLiquor);
|
||||
writer.Write(m_MakeStrong);
|
||||
writer.Write(m_Mark);
|
||||
writer.Write(m_Label);
|
||||
}
|
||||
|
||||
#region Serialize/Deserialize Persistence
|
||||
private static string FilePath = Path.Combine("Saves", "CraftContext", "DistillationContexts.bin");
|
||||
|
||||
public static void Configure()
|
||||
{
|
||||
EventSink.WorldSave += OnSave;
|
||||
EventSink.WorldLoad += OnLoad;
|
||||
}
|
||||
|
||||
public static void OnSave(WorldSaveEventArgs e)
|
||||
{
|
||||
Persistence.Serialize(
|
||||
FilePath,
|
||||
writer =>
|
||||
{
|
||||
writer.Write(0); // version
|
||||
|
||||
writer.Write(DistillationSystem.Contexts.Count);
|
||||
|
||||
foreach (KeyValuePair<Mobile, DistillationContext> kvp in DistillationSystem.Contexts)
|
||||
{
|
||||
writer.Write(kvp.Key);
|
||||
kvp.Value.Serialize(writer);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static void OnLoad()
|
||||
{
|
||||
Persistence.Deserialize(
|
||||
FilePath,
|
||||
reader =>
|
||||
{
|
||||
int version = reader.ReadInt();
|
||||
|
||||
int count = reader.ReadInt();
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
Mobile m = reader.ReadMobile();
|
||||
DistillationContext context = new DistillationContext(reader);
|
||||
|
||||
if (m != null)
|
||||
DistillationSystem.Contexts[m] = context;
|
||||
}
|
||||
});
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
497
Scripts/Services/New Magincia/Distillation/DistillationGump.cs
Normal file
497
Scripts/Services/New Magincia/Distillation/DistillationGump.cs
Normal file
@@ -0,0 +1,497 @@
|
||||
using Server;
|
||||
using System;
|
||||
using Server.Items;
|
||||
using Server.Mobiles;
|
||||
using Server.Gumps;
|
||||
using Server.Prompts;
|
||||
using Server.Targeting;
|
||||
using Server.Network;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Server.Engines.Distillation
|
||||
{
|
||||
public class DistillationGump : Gump
|
||||
{
|
||||
private const int LabelHue = 0x480;
|
||||
private const int LabelColor = 0x7FFF;
|
||||
private const int FontColor = 0xFFFFFF;
|
||||
|
||||
private DistillationContext m_Context;
|
||||
private CraftDefinition m_Def;
|
||||
|
||||
public DistillationGump(Mobile from) : base(35, 35)
|
||||
{
|
||||
from.CloseGump(typeof(DistillationGump));
|
||||
|
||||
m_Context = DistillationSystem.GetContext(from);
|
||||
|
||||
Group group = m_Context.LastGroup;
|
||||
Liquor liquor = m_Context.LastLiquor;
|
||||
|
||||
if (liquor == Liquor.None)
|
||||
liquor = DistillationSystem.GetFirstLiquor(group);
|
||||
|
||||
m_Def = DistillationSystem.GetDefinition(liquor, group);
|
||||
|
||||
if (m_Def == null)
|
||||
return;
|
||||
|
||||
if (m_Def.Liquor != liquor)
|
||||
liquor = m_Def.Liquor;
|
||||
|
||||
AddBackground(0, 0, 500, 500, 5054);
|
||||
AddImageTiled(10, 10, 480, 30, 2624);
|
||||
AddImageTiled(10, 50, 230, 120, 2624);
|
||||
AddImageTiled(10, 180, 230, 200, 2624);
|
||||
AddImageTiled(250, 50, 240, 200, 2624);
|
||||
AddImageTiled(250, 260, 240, 120, 2624);
|
||||
AddImageTiled(10, 390, 480, 60, 2624);
|
||||
AddImageTiled(10, 460, 480, 30, 2624);
|
||||
AddAlphaRegion(10, 10, 480, 480);
|
||||
|
||||
AddHtmlLocalized(10, 16, 510, 20, 1150682, LabelColor, false, false); // <center>DISTILLERY MENU</center>
|
||||
|
||||
AddHtmlLocalized(10, 55, 230, 20, 1150683, LabelColor, false, false); // <center>Select the group</center>
|
||||
|
||||
AddButton(15, 80, 4005, 4007, 1, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(55, 80, 200, 20, DistillationSystem.GetLabel(Group.WheatBased), LabelColor, false, false); // WHEAT BASED
|
||||
|
||||
AddButton(15, 106, 4005, 4007, 2, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(55, 106, 200, 20, DistillationSystem.GetLabel(Group.WaterBased), LabelColor, false, false); // WATER BASED
|
||||
|
||||
AddButton(15, 132, 4005, 4007, 3, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(55, 132, 200, 20, DistillationSystem.GetLabel(Group.Other), LabelColor, false, false); // OTHER
|
||||
|
||||
AddHtmlLocalized(10, 184, 230, 20, 1150684, LabelColor, false, false); // <center>Select the liquor type</center>
|
||||
|
||||
int y = 210;
|
||||
for (int i = 0; i < DistillationSystem.CraftDefs.Count; i++)
|
||||
{
|
||||
CraftDefinition def = DistillationSystem.CraftDefs[i];
|
||||
|
||||
if (def.Group == group)
|
||||
{
|
||||
AddButton(15, y, 4005, 4007, 1000 + i, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(55, y, 200, 20, DistillationSystem.GetLabel(def.Liquor, false), LabelColor, false, false);
|
||||
y += 26;
|
||||
}
|
||||
}
|
||||
|
||||
AddHtmlLocalized(250, 54, 240, 20, 1150735, String.Format("#{0}", DistillationSystem.GetLabel(liquor, false)), LabelColor, false, false); // <center>Ingredients of ~1_NAME~</center>
|
||||
|
||||
y = 80;
|
||||
for (int i = 0; i < m_Def.Ingredients.Length; i++)
|
||||
{
|
||||
Type type = m_Def.Ingredients[i];
|
||||
int amt = m_Def.Amounts[i];
|
||||
bool strong = m_Context.MakeStrong;
|
||||
|
||||
if (i == 0 && type == typeof(Yeast))
|
||||
{
|
||||
for (int j = 0; j < amt; j++)
|
||||
{
|
||||
Yeast yeast = m_Context.SelectedYeast[j];
|
||||
|
||||
AddHtmlLocalized(295, y, 200, 20, yeast == null ? 1150778 : 1150779, "#1150453", LabelColor, false, false); // Yeast: ~1_VAL~
|
||||
AddButton(255, y, 4005, 4007, 2000 + j, GumpButtonType.Reply, 0);
|
||||
y += 26;
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
int total = strong ? amt * 2 : amt;
|
||||
int amount = DistillationTarget.GetAmount(from, type, liquor);
|
||||
if (amount > total)
|
||||
amount = total;
|
||||
AddHtmlLocalized(295, y, 200, 20, 1150733, String.Format("#{0}\t{1}", m_Def.Labels[i], String.Format("{0}/{1}", amount.ToString(), total.ToString())), LabelColor, false, false); // ~1_NAME~ : ~2_NUMBER~
|
||||
}
|
||||
|
||||
y += 26;
|
||||
}
|
||||
|
||||
AddHtmlLocalized(250, 264, 240, 20, 1150770, LabelColor, false, false); // <center>Distillery Options</center>
|
||||
|
||||
AddButton(255, 290, 4005, 4007, 4, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(295, 290, 200, 20, m_Context.MakeStrong ? 1150730 : 1150729, LabelColor, false, false); // Double Distillation - Standard Distillation
|
||||
|
||||
AddButton(255, 316, 4005, 4007, 5, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(295, 320, 200, 20, m_Context.Mark ? 1150731 : 1150732, LabelColor, false, false); // Mark Distiller Name - Do Not Mark
|
||||
|
||||
AddButton(15, 395, 4005, 4007, 6, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(55, 395, 200, 20, 1150733, String.Format("Label\t{0}", m_Context.Label == null ? "None" : m_Context.Label), LabelColor, false, false); // ~1_NAME~ : ~2_NUMBER~
|
||||
|
||||
AddButton(15, 465, 4005, 4007, 7, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(55, 465, 200, 20, 1150771, LabelColor, false, false); // Execute Distillation
|
||||
|
||||
AddButton(455, 465, 4017, 4019, 0, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(400, 465, 100, 20, 1060675, LabelColor, false, false); // CLOSE
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState state, RelayInfo info)
|
||||
{
|
||||
Mobile from = state.Mobile;
|
||||
|
||||
switch (info.ButtonID)
|
||||
{
|
||||
case 0: return;
|
||||
case 1: // Select Wheat Based
|
||||
m_Context.LastGroup = Group.WheatBased;
|
||||
break;
|
||||
case 2: // Select Water Based
|
||||
m_Context.LastGroup = Group.WaterBased;
|
||||
break;
|
||||
case 3: // Select Other
|
||||
m_Context.LastGroup = Group.Other;
|
||||
break;
|
||||
case 4: // Distillation Strength
|
||||
if (m_Context.MakeStrong)
|
||||
m_Context.MakeStrong = false;
|
||||
else
|
||||
m_Context.MakeStrong = true;
|
||||
break;
|
||||
case 5: // Mark Option
|
||||
if (m_Context.Mark)
|
||||
m_Context.Mark = false;
|
||||
else
|
||||
m_Context.Mark = true;
|
||||
break;
|
||||
case 6: // Label
|
||||
from.Prompt = new LabelPrompt(m_Context);
|
||||
from.SendLocalizedMessage(1150734); // Please enter the text with which you wish to label the liquor that you will distill. You many enter up to 15 characters. Leave the text area blank to remove any existing text.
|
||||
return;
|
||||
case 7: // Execute Distillation
|
||||
from.Target = new DistillationTarget(from, m_Context, m_Def);
|
||||
from.SendLocalizedMessage(1150810); // Target an empty liquor barrel in your backpack. If you don't have one already, you can use the Carpentry skill to make one.
|
||||
return;
|
||||
default:
|
||||
{
|
||||
if (info.ButtonID < 2000) // Select Liquor Type
|
||||
{
|
||||
int sel = info.ButtonID - 1000;
|
||||
if (sel >= 0 && sel < DistillationSystem.CraftDefs.Count)
|
||||
{
|
||||
CraftDefinition def = DistillationSystem.CraftDefs[sel];
|
||||
m_Context.LastLiquor = def.Liquor;
|
||||
}
|
||||
}
|
||||
else // Select Yeast
|
||||
{
|
||||
int sel = info.ButtonID - 2000;
|
||||
|
||||
if(m_Def.Ingredients[0] == typeof(Yeast) && m_Def.Amounts.Length > 0)
|
||||
{
|
||||
int amt = m_Def.Amounts[0];
|
||||
|
||||
if (sel >= 0 && sel < amt)
|
||||
{
|
||||
from.Target = new YeastSelectionTarget(m_Context, sel);
|
||||
from.SendLocalizedMessage(1150437); // Target the yeast in your backpack that you wish to toggle distillation item status on. Hit <ESC> to cancel.
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
from.SendGump(new DistillationGump(from));
|
||||
}
|
||||
|
||||
private class LabelPrompt : Prompt
|
||||
{
|
||||
private DistillationContext m_Context;
|
||||
|
||||
public LabelPrompt(DistillationContext context)
|
||||
{
|
||||
m_Context = context;
|
||||
}
|
||||
|
||||
public override void OnResponse(Mobile from, string text)
|
||||
{
|
||||
if (text == null || text.Length == 0)
|
||||
m_Context.Label = null;
|
||||
else if (text != null)
|
||||
{
|
||||
text = text.Trim();
|
||||
if (text.Length > 15 || !Server.Guilds.BaseGuildGump.CheckProfanity(text))
|
||||
from.SendMessage("That label is unacceptable. Please try again.");
|
||||
else
|
||||
m_Context.Label = text;
|
||||
}
|
||||
|
||||
from.SendGump(new DistillationGump(from));
|
||||
}
|
||||
|
||||
public override void OnCancel(Mobile from)
|
||||
{
|
||||
from.SendGump(new DistillationGump(from));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public class DistillationTarget : Target
|
||||
{
|
||||
private DistillationContext m_Context;
|
||||
private CraftDefinition m_Def;
|
||||
|
||||
public DistillationTarget(Mobile from, DistillationContext context, CraftDefinition def)
|
||||
: base(-1, false, TargetFlags.None)
|
||||
{
|
||||
m_Context = context;
|
||||
m_Def = def;
|
||||
BeginTimeout(from, TimeSpan.FromSeconds(30));
|
||||
}
|
||||
|
||||
protected override void OnTarget(Mobile from, object targeted)
|
||||
{
|
||||
if (targeted is LiquorBarrel)
|
||||
{
|
||||
LiquorBarrel barrel = targeted as LiquorBarrel;
|
||||
|
||||
if (barrel.IsChildOf(from.Backpack))
|
||||
{
|
||||
if (barrel.IsMature)
|
||||
from.SendLocalizedMessage(1150811); // This liquor barrel already contains liquor.
|
||||
else if (!barrel.IsEmpty)
|
||||
from.SendLocalizedMessage(1150802); // You realize that the liquor is on the process of maturation so you leave it alone.
|
||||
else
|
||||
{
|
||||
double perc = m_Context.MakeStrong ? 2 : 1;
|
||||
|
||||
if (HasTotal(from, perc) && barrel != null)
|
||||
{
|
||||
double cooking = from.Skills[SkillName.Cooking].Value;
|
||||
double alchemy = from.Skills[SkillName.Alchemy].Value / 2;
|
||||
int resist = 0;
|
||||
|
||||
for (int i = 0; i < m_Context.SelectedYeast.Length; i++)
|
||||
{
|
||||
Yeast yeast = m_Context.SelectedYeast[i];
|
||||
|
||||
if (yeast != null)
|
||||
resist += yeast.BacterialResistance;
|
||||
}
|
||||
|
||||
int chance = (int)((cooking + alchemy + (resist * 12)) / 2.5);
|
||||
|
||||
if (chance > Utility.Random(100))
|
||||
{
|
||||
ConsumeTotal(from, perc);
|
||||
m_Context.ClearYeasts();
|
||||
from.SendLocalizedMessage(1150772); // You succeed at your distillation attempt.
|
||||
|
||||
Mobile marker = m_Context.Mark ? from : null;
|
||||
from.PlaySound(0x2D6);
|
||||
|
||||
barrel.BeginDistillation(m_Def.Liquor, m_Def.MaturationDuration, m_Context.Label, m_Context.MakeStrong, marker);
|
||||
}
|
||||
else
|
||||
{
|
||||
from.PlaySound(0x2D6);
|
||||
ConsumeTotal(from, perc / 2);
|
||||
from.SendLocalizedMessage(1150745); // You have failed your distillation attempt and ingredients have been lost.
|
||||
}
|
||||
}
|
||||
else
|
||||
from.SendLocalizedMessage(1150747); // You don't have enough ingredients.
|
||||
}
|
||||
}
|
||||
else
|
||||
from.SendLocalizedMessage(1054107); // This item must be in your backpack.
|
||||
}
|
||||
else
|
||||
from.SendMessage("That is not a liquor barrel.");
|
||||
|
||||
DistillationSystem.SendDelayedGump(from);
|
||||
}
|
||||
|
||||
protected override void OnTargetCancel(Mobile from, TargetCancelType cancelType)
|
||||
{
|
||||
if (cancelType == TargetCancelType.Timeout)
|
||||
from.SendLocalizedMessage(1150859); // You have waited too long to make your selection, your distillation attempt has timed out.
|
||||
|
||||
from.SendGump(new DistillationGump(from));
|
||||
}
|
||||
|
||||
public static int GetAmount(Mobile from, Type type, Liquor liquor)
|
||||
{
|
||||
if (from == null || from.Backpack == null)
|
||||
return 0;
|
||||
|
||||
Container pack = from.Backpack;
|
||||
|
||||
if (type == typeof(Pitcher))
|
||||
{
|
||||
int amount = 0;
|
||||
BeverageType bType = liquor == Liquor.Brandy ? BeverageType.Wine : BeverageType.Water;
|
||||
|
||||
Item[] items = pack.FindItemsByType(type);
|
||||
|
||||
foreach (Item item in items)
|
||||
{
|
||||
Pitcher Pitcher = item as Pitcher;
|
||||
|
||||
if (Pitcher != null && Pitcher.Content == bType && Pitcher.Quantity >= Pitcher.MaxQuantity)
|
||||
amount++;
|
||||
}
|
||||
|
||||
return amount;
|
||||
}
|
||||
else if (type == typeof(PewterBowlOfCorn))
|
||||
{
|
||||
return pack.GetAmount(type) + pack.GetAmount(typeof(WoodenBowlOfCorn));
|
||||
}
|
||||
|
||||
return pack.GetAmount(type);
|
||||
}
|
||||
|
||||
private bool HasTotal(Mobile from, double percentage)
|
||||
{
|
||||
for (int i = 0; i < m_Def.Ingredients.Length; i++)
|
||||
{
|
||||
Type type = m_Def.Ingredients[i];
|
||||
int toConsume = m_Def.Amounts[i];
|
||||
|
||||
if (i == 0 && type == typeof(Yeast))
|
||||
{
|
||||
for (int j = 0; j < toConsume; j++)
|
||||
{
|
||||
Yeast yeast = m_Context.SelectedYeast[j];
|
||||
|
||||
if (yeast == null || !yeast.IsChildOf(from.Backpack))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
toConsume = (int)((double)toConsume * percentage);
|
||||
|
||||
if (GetAmount(from, type, m_Def.Liquor) < toConsume)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private void ConsumeTotal(Mobile from, double percentage)
|
||||
{
|
||||
if (from == null || from.Backpack == null)
|
||||
return;
|
||||
|
||||
Container pack = from.Backpack;
|
||||
|
||||
for (int i = 0; i < m_Def.Ingredients.Length; i++)
|
||||
{
|
||||
Type type = m_Def.Ingredients[i];
|
||||
int toConsume = m_Def.Amounts[i];
|
||||
|
||||
if (i == 0 && type == typeof(Yeast))
|
||||
{
|
||||
for (int j = 0; j < toConsume; j++)
|
||||
{
|
||||
Yeast yeast = m_Context.SelectedYeast[j];
|
||||
|
||||
if (yeast != null)
|
||||
yeast.Consume();
|
||||
}
|
||||
}
|
||||
else if (type == typeof(Pitcher))
|
||||
{
|
||||
toConsume = (int)((double)toConsume * percentage);
|
||||
BeverageType bType = m_Def.Liquor == Liquor.Brandy ? BeverageType.Wine : BeverageType.Water;
|
||||
|
||||
Item[] items = pack.FindItemsByType(type);
|
||||
|
||||
foreach (Item item in items)
|
||||
{
|
||||
Pitcher Pitcher = item as Pitcher;
|
||||
|
||||
if (Pitcher != null && Pitcher.Content == bType && Pitcher.Quantity >= Pitcher.MaxQuantity)
|
||||
{
|
||||
Pitcher.Quantity = 0;
|
||||
toConsume--;
|
||||
}
|
||||
|
||||
if (toConsume <= 0)
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (type == typeof(PewterBowlOfCorn))
|
||||
{
|
||||
toConsume = (int)((double)toConsume * percentage);
|
||||
|
||||
int totalPewter = pack.GetAmount(type);
|
||||
int totalWooden = pack.GetAmount(typeof(WoodenBowlOfCorn));
|
||||
|
||||
if (totalPewter >= toConsume)
|
||||
pack.ConsumeTotal(type, toConsume);
|
||||
else
|
||||
{
|
||||
pack.ConsumeTotal(type, totalPewter);
|
||||
toConsume -= totalPewter;
|
||||
pack.ConsumeTotal(typeof(WoodenBowlOfCorn), toConsume);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
toConsume = (int)((double)toConsume * percentage);
|
||||
pack.ConsumeTotal(type, toConsume);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class YeastSelectionTarget : Target
|
||||
{
|
||||
private int m_Index;
|
||||
private DistillationContext m_Context;
|
||||
|
||||
public YeastSelectionTarget(DistillationContext context, int index)
|
||||
: base(-1, false, TargetFlags.None)
|
||||
{
|
||||
m_Index = index;
|
||||
m_Context = context;
|
||||
}
|
||||
|
||||
protected override void OnTarget(Mobile from, object targeted)
|
||||
{
|
||||
if (targeted is Yeast)
|
||||
{
|
||||
Yeast yeast = targeted as Yeast;
|
||||
|
||||
if (yeast.IsChildOf(from.Backpack))
|
||||
{
|
||||
if (!m_Context.YeastInUse(yeast))
|
||||
{
|
||||
m_Context.SelectedYeast[m_Index] = yeast;
|
||||
from.SendLocalizedMessage(1150740); // You have chosen the yeast.
|
||||
}
|
||||
else
|
||||
from.SendLocalizedMessage(1150742); // You have already chosen other yeast.
|
||||
}
|
||||
else
|
||||
from.SendLocalizedMessage(1054107); // This item must be in your backpack.
|
||||
}
|
||||
else
|
||||
from.SendLocalizedMessage(1150741); // That is not yeast.
|
||||
|
||||
from.SendGump(new DistillationGump(from));
|
||||
}
|
||||
|
||||
protected override void OnTargetCancel(Mobile from, TargetCancelType cancelType)
|
||||
{
|
||||
if (m_Context.SelectedYeast[m_Index] != null)
|
||||
{
|
||||
m_Context.SelectedYeast[m_Index] = null;
|
||||
from.SendLocalizedMessage(1150743); // You no longer choose this yeast.
|
||||
}
|
||||
|
||||
from.SendGump(new DistillationGump(from));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
138
Scripts/Services/New Magincia/Distillation/DistillationSystem.cs
Normal file
138
Scripts/Services/New Magincia/Distillation/DistillationSystem.cs
Normal file
@@ -0,0 +1,138 @@
|
||||
using Server;
|
||||
using System;
|
||||
using Server.Items;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Server.Engines.Distillation
|
||||
{
|
||||
public enum Group
|
||||
{
|
||||
WheatBased,
|
||||
WaterBased,
|
||||
Other
|
||||
}
|
||||
|
||||
public enum Liquor
|
||||
{
|
||||
None,
|
||||
Whiskey,
|
||||
Bourbon,
|
||||
Spirytus,
|
||||
Cassis,
|
||||
MelonLiquor,
|
||||
Mist,
|
||||
Akvavit,
|
||||
Arak,
|
||||
CornWhiskey,
|
||||
Brandy
|
||||
}
|
||||
|
||||
public class DistillationSystem
|
||||
{
|
||||
public static readonly TimeSpan MaturationPeriod = TimeSpan.FromHours(48);
|
||||
|
||||
private static List<CraftDefinition> m_CraftDefs = new List<CraftDefinition>();
|
||||
public static List<CraftDefinition> CraftDefs { get { return m_CraftDefs; } }
|
||||
|
||||
private static Dictionary<Mobile, DistillationContext> m_Contexts = new Dictionary<Mobile, DistillationContext>();
|
||||
public static Dictionary<Mobile, DistillationContext> Contexts { get { return m_Contexts; } }
|
||||
|
||||
public static void Initialize()
|
||||
{
|
||||
// Wheat Based
|
||||
m_CraftDefs.Add(new CraftDefinition(Group.WheatBased, Liquor.Whiskey, new Type[] { typeof(Yeast), typeof(WheatWort) }, new int[] { 3, 1 }, MaturationPeriod ) );
|
||||
m_CraftDefs.Add(new CraftDefinition(Group.WheatBased, Liquor.Bourbon, new Type[] { typeof(Yeast), typeof(WheatWort), typeof(PewterBowlOfCorn) }, new int[] { 3, 3, 1 }, MaturationPeriod ) );
|
||||
m_CraftDefs.Add(new CraftDefinition(Group.WheatBased, Liquor.Spirytus, new Type[] { typeof(Yeast), typeof(WheatWort), typeof(PewterBowlOfPotatos) }, new int[] { 3, 1, 1 }, TimeSpan.MinValue ) );
|
||||
m_CraftDefs.Add(new CraftDefinition(Group.WheatBased, Liquor.Cassis, new Type[] { typeof(Yeast), typeof(WheatWort), typeof(PewterBowlOfPotatos), typeof(TribalBerry) }, new int[] { 3, 3, 3, 1 }, MaturationPeriod ) );
|
||||
m_CraftDefs.Add(new CraftDefinition(Group.WheatBased, Liquor.MelonLiquor, new Type[] { typeof(Yeast), typeof(WheatWort), typeof(PewterBowlOfPotatos), typeof(HoneydewMelon) }, new int[] { 3, 3, 3, 1 }, MaturationPeriod ) );
|
||||
m_CraftDefs.Add(new CraftDefinition(Group.WheatBased, Liquor.Mist, new Type[] { typeof(Yeast), typeof(WheatWort), typeof(JarHoney) }, new int[] { 3, 3, 1 }, MaturationPeriod ) );
|
||||
|
||||
// Water Based
|
||||
m_CraftDefs.Add(new CraftDefinition(Group.WaterBased, Liquor.Akvavit, new Type[] { typeof(Yeast), typeof(Pitcher), typeof(PewterBowlOfPotatos) }, new int[] { 1, 3, 1 }, TimeSpan.MinValue ) );
|
||||
m_CraftDefs.Add(new CraftDefinition(Group.WaterBased, Liquor.Arak, new Type[] { typeof(Yeast), typeof(Pitcher), typeof(Dates) }, new int[] { 1, 3, 1 }, MaturationPeriod ) );
|
||||
m_CraftDefs.Add(new CraftDefinition(Group.WaterBased, Liquor.CornWhiskey, new Type[] { typeof(Yeast), typeof(Pitcher), typeof(PewterBowlOfCorn) }, new int[] { 1, 3, 1 }, MaturationPeriod ) );
|
||||
|
||||
// Other
|
||||
m_CraftDefs.Add(new CraftDefinition(Group.Other, Liquor.Brandy, new Type[] { typeof(Pitcher) }, new int[] { 4 }, MaturationPeriod ) );
|
||||
}
|
||||
|
||||
public static void AddContext(Mobile from, DistillationContext context)
|
||||
{
|
||||
if(from != null)
|
||||
m_Contexts[from] = context;
|
||||
}
|
||||
|
||||
public static DistillationContext GetContext(Mobile from)
|
||||
{
|
||||
if(from == null)
|
||||
return null;
|
||||
|
||||
if(!m_Contexts.ContainsKey(from))
|
||||
m_Contexts[from] = new DistillationContext();
|
||||
|
||||
return m_Contexts[from];
|
||||
}
|
||||
|
||||
public static int GetLabel(Liquor liquor, bool strong)
|
||||
{
|
||||
if(strong)
|
||||
return 1150718 + (int)liquor;
|
||||
|
||||
return 1150442 + (int)liquor;
|
||||
}
|
||||
|
||||
public static int GetLabel(Group group)
|
||||
{
|
||||
if(group == Group.Other)
|
||||
return 1077435;
|
||||
|
||||
return 1150736 + (int)group;
|
||||
}
|
||||
|
||||
public static Liquor GetFirstLiquor(Group group)
|
||||
{
|
||||
foreach(CraftDefinition def in m_CraftDefs)
|
||||
{
|
||||
if(def.Group == group)
|
||||
return def.Liquor;
|
||||
}
|
||||
|
||||
return Liquor.Whiskey;
|
||||
}
|
||||
|
||||
public static CraftDefinition GetFirstDefForGroup(Group group)
|
||||
{
|
||||
foreach (CraftDefinition def in m_CraftDefs)
|
||||
{
|
||||
if (def.Group == group)
|
||||
return def;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static CraftDefinition GetDefinition(Liquor liquor, Group group)
|
||||
{
|
||||
foreach(CraftDefinition def in m_CraftDefs)
|
||||
{
|
||||
if(def.Liquor == liquor && def.Group == group)
|
||||
return def;
|
||||
}
|
||||
|
||||
return GetFirstDefForGroup(group);
|
||||
}
|
||||
|
||||
public static void SendDelayedGump(Mobile from)
|
||||
{
|
||||
Timer.DelayCall(TimeSpan.FromSeconds(1.5), new TimerStateCallback(SendGump), from);
|
||||
}
|
||||
|
||||
public static void SendGump(object o)
|
||||
{
|
||||
Mobile from = o as Mobile;
|
||||
|
||||
if(from != null)
|
||||
from.SendGump(new DistillationGump(from));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
using Server;
|
||||
using System;
|
||||
using Server.Items;
|
||||
|
||||
namespace Server.Engines.Distillation
|
||||
{
|
||||
public class BottleOfLiquor : BeverageBottle
|
||||
{
|
||||
private Liquor m_Liquor;
|
||||
private string m_Label;
|
||||
private bool m_IsStrong;
|
||||
private Mobile m_Distiller;
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public Liquor Liquor { get { return m_Liquor; } set { m_Liquor = value; InvalidateProperties(); } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public string Label { get { return m_Label; } set { m_Label = value; InvalidateProperties(); } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public bool IsStrong { get { return m_IsStrong; } set { m_IsStrong = value; InvalidateProperties(); } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public Mobile Distiller { get { return m_Distiller; } set { m_Distiller = value; InvalidateProperties(); } }
|
||||
|
||||
public override bool ShowQuantity { get { return false; } }
|
||||
|
||||
[Constructable]
|
||||
public BottleOfLiquor() : this(Liquor.Whiskey, null, false, null)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public BottleOfLiquor(Liquor liquor, string label, bool isstrong, Mobile distiller) : base(BeverageType.Liquor)
|
||||
{
|
||||
Quantity = MaxQuantity;
|
||||
m_Liquor = liquor;
|
||||
m_Label = label;
|
||||
m_IsStrong = isstrong;
|
||||
m_Distiller = distiller;
|
||||
}
|
||||
|
||||
public override void AddNameProperty(ObjectPropertyList list)
|
||||
{
|
||||
if(m_Label != null && m_Label.Length > 0)
|
||||
list.Add(1049519, m_Label); // a bottle of ~1_DRINK_NAME~
|
||||
else
|
||||
list.Add(1049519, String.Format("#{0}", DistillationSystem.GetLabel(m_Liquor, m_IsStrong))); // a bottle of ~1_DRINK_NAME~
|
||||
}
|
||||
|
||||
public override void GetProperties(ObjectPropertyList list)
|
||||
{
|
||||
base.GetProperties(list);
|
||||
|
||||
if(m_Liquor != Liquor.None)
|
||||
list.Add(1150454, String.Format("#{0}", DistillationSystem.GetLabel(m_Liquor, m_IsStrong))); // Liquor Type: ~1_TYPE~
|
||||
|
||||
if (m_Distiller != null)
|
||||
list.Add(1150679, m_Distiller.Name); // Distiller: ~1_NAME~
|
||||
|
||||
list.Add( GetQuantityDescription() );
|
||||
}
|
||||
|
||||
public BottleOfLiquor(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write((int)1);
|
||||
|
||||
writer.Write(m_IsStrong);
|
||||
|
||||
writer.Write((int)m_Liquor);
|
||||
writer.Write(m_Label);
|
||||
writer.Write(m_Distiller);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch (version)
|
||||
{
|
||||
case 1:
|
||||
m_IsStrong = reader.ReadBool();
|
||||
goto case 0;
|
||||
case 0:
|
||||
m_Liquor = (Liquor)reader.ReadInt();
|
||||
m_Label = reader.ReadString();
|
||||
m_Distiller = reader.ReadMobile();
|
||||
|
||||
m_IsStrong = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
214
Scripts/Services/New Magincia/Distillation/Items/LiquorBarrel.cs
Normal file
214
Scripts/Services/New Magincia/Distillation/Items/LiquorBarrel.cs
Normal file
@@ -0,0 +1,214 @@
|
||||
using Server;
|
||||
using System;
|
||||
using Server.Engines.Distillation;
|
||||
using Server.Mobiles;
|
||||
using Server.Engines.Craft;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class LiquorBarrel : Item, ICraftable
|
||||
{
|
||||
private Liquor m_Liquor;
|
||||
private DateTime m_MaturationBegin;
|
||||
private TimeSpan m_MaturationDuration;
|
||||
private string m_Label;
|
||||
private bool m_IsStrong;
|
||||
private int m_UsesRemaining;
|
||||
private bool m_Exceptional;
|
||||
private Mobile m_Crafter;
|
||||
private Mobile m_Distiller;
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public Liquor Liquor { get { return m_Liquor; } set { BeginDistillation(value); InvalidateProperties(); } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public DateTime MaturationBegin { get { return m_MaturationBegin; } set { m_MaturationBegin = value; InvalidateProperties(); } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public TimeSpan MutrationDuration { get { return m_MaturationDuration; } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public string Label { get { return m_Label; } set { m_Label = value; InvalidateProperties(); } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public bool IsStrong { get { return m_IsStrong; } set { m_IsStrong = value; InvalidateProperties(); } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int UsesRemaining { get { return m_UsesRemaining; } set { m_UsesRemaining = value; InvalidateProperties(); } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public bool Exceptional { get { return m_Exceptional; } set { m_Exceptional = value; InvalidateProperties(); } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public Mobile Crafter { get { return m_Crafter; } set { m_Crafter = value; InvalidateProperties(); } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public Mobile Distiller { get { return m_Distiller; } set { m_Distiller = value; InvalidateProperties(); } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public virtual bool IsMature { get { return m_Liquor != Liquor.None && (m_MaturationDuration == TimeSpan.MinValue || m_MaturationBegin + m_MaturationDuration < DateTime.UtcNow); } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public bool IsEmpty { get { return m_Liquor == Liquor.None; } }
|
||||
|
||||
public override int LabelNumber { get { return m_UsesRemaining == 0 || m_Liquor == Liquor.None ? 1150816 : 1150807; } } // liquor barrel
|
||||
|
||||
public override double DefaultWeight { get { return 5.0; } }
|
||||
|
||||
[Constructable]
|
||||
public LiquorBarrel()
|
||||
: base(4014)
|
||||
{
|
||||
m_Liquor = Liquor.None;
|
||||
m_UsesRemaining = 0;
|
||||
}
|
||||
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
if (IsChildOf(from.Backpack) && m_UsesRemaining > 0)
|
||||
{
|
||||
if (IsMature)
|
||||
{
|
||||
BottleOfLiquor bottle = new BottleOfLiquor(m_Liquor, m_Label, m_IsStrong, m_Distiller);
|
||||
|
||||
if (from.Backpack == null || !from.Backpack.TryDropItem(from, bottle, false))
|
||||
{
|
||||
bottle.Delete();
|
||||
from.SendLocalizedMessage(500720); // You don't have enough room in your backpack!
|
||||
}
|
||||
else
|
||||
{
|
||||
from.PlaySound(0x240);
|
||||
from.SendMessage("You pour the liquior into a bottle and place it in your backpack.");
|
||||
m_UsesRemaining--;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage(1150806); // You need to wait until the liquor in the barrel has matured.
|
||||
|
||||
if (DateTime.UtcNow < m_MaturationBegin + m_MaturationDuration)
|
||||
{
|
||||
TimeSpan remaining = (m_MaturationBegin + m_MaturationDuration) - DateTime.UtcNow;
|
||||
if (remaining.TotalDays > 0)
|
||||
from.SendLocalizedMessage(1150814, String.Format("{0}\t{1}", remaining.Days.ToString(), remaining.Hours.ToString()));
|
||||
else
|
||||
from.SendLocalizedMessage(1150813, remaining.TotalHours.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void GetProperties(ObjectPropertyList list)
|
||||
{
|
||||
base.GetProperties(list);
|
||||
|
||||
if (m_Crafter != null)
|
||||
list.Add(1050043, m_Crafter.Name); // Crafted By: ~1_Name~
|
||||
|
||||
if (m_Exceptional)
|
||||
list.Add(1018303); // Exceptional
|
||||
|
||||
if (!IsEmpty)
|
||||
{
|
||||
if (IsMature)
|
||||
list.Add(1060584, m_UsesRemaining.ToString()); // uses remaining: ~1_val~
|
||||
|
||||
list.Add(1150805, m_MaturationBegin.ToShortDateString()); // start date: ~1_NAME~
|
||||
|
||||
int cliloc = IsMature ? 1150804 : 1150812; // maturing: ~1_NAME~ / // matured: ~1_NAME~
|
||||
|
||||
if (m_Label == null)
|
||||
list.Add(cliloc, String.Format("#{0}", DistillationSystem.GetLabel(m_Liquor, m_IsStrong)));
|
||||
else
|
||||
list.Add(cliloc, m_Label);
|
||||
|
||||
list.Add(1150454, String.Format("#{0}", DistillationSystem.GetLabel(m_Liquor, m_IsStrong))); // Liquor Type: ~1_TYPE~
|
||||
|
||||
if (m_Distiller != null)
|
||||
list.Add(1150679, m_Distiller.Name); // Distiller: ~1_NAME~
|
||||
}
|
||||
}
|
||||
|
||||
public void BeginDistillation(Liquor liquor)
|
||||
{
|
||||
TimeSpan ts;
|
||||
|
||||
if (liquor == Liquor.Spirytus || liquor == Liquor.Akvavit)
|
||||
ts = TimeSpan.MinValue;
|
||||
else
|
||||
ts = DistillationSystem.MaturationPeriod;
|
||||
|
||||
BeginDistillation(liquor, ts, m_Label, m_IsStrong, m_Distiller);
|
||||
}
|
||||
|
||||
public void BeginDistillation(Liquor liquor, TimeSpan duration, string label, bool isStrong, Mobile distiller)
|
||||
{
|
||||
m_Liquor = liquor;
|
||||
m_MaturationDuration = duration;
|
||||
m_Label = label;
|
||||
m_IsStrong = isStrong;
|
||||
m_Distiller = distiller;
|
||||
m_MaturationBegin = DateTime.UtcNow;
|
||||
m_UsesRemaining = m_Exceptional ? 20 : 10;
|
||||
|
||||
InvalidateProperties();
|
||||
}
|
||||
|
||||
public virtual int OnCraft(int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, ITool tool, CraftItem craftItem, int resHue)
|
||||
{
|
||||
if (quality >= 2)
|
||||
{
|
||||
m_Exceptional = true;
|
||||
|
||||
if (makersMark)
|
||||
m_Crafter = from;
|
||||
}
|
||||
|
||||
if (typeRes == null)
|
||||
typeRes = craftItem.Resources.GetAt(0).ItemType;
|
||||
|
||||
CraftResource resource = CraftResources.GetFromType(typeRes);
|
||||
Hue = CraftResources.GetHue(resource);
|
||||
|
||||
return quality;
|
||||
}
|
||||
|
||||
public LiquorBarrel(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write((int)0);
|
||||
|
||||
writer.Write((int)m_Liquor);
|
||||
writer.Write(m_MaturationBegin);
|
||||
writer.Write(m_MaturationDuration);
|
||||
writer.Write(m_Label);
|
||||
writer.Write(m_IsStrong);
|
||||
writer.Write(m_UsesRemaining);
|
||||
writer.Write(m_Exceptional);
|
||||
writer.Write(m_Crafter);
|
||||
writer.Write(m_Distiller);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int version = reader.ReadInt();
|
||||
|
||||
m_Liquor = (Liquor)reader.ReadInt();
|
||||
m_MaturationBegin = reader.ReadDateTime();
|
||||
m_MaturationDuration = reader.ReadTimeSpan();
|
||||
m_Label = reader.ReadString();
|
||||
m_IsStrong = reader.ReadBool();
|
||||
m_UsesRemaining = reader.ReadInt();
|
||||
m_Exceptional = reader.ReadBool();
|
||||
m_Crafter = reader.ReadMobile();
|
||||
m_Distiller = reader.ReadMobile();
|
||||
}
|
||||
}
|
||||
}
|
||||
33
Scripts/Services/New Magincia/Distillation/Items/MetalKeg.cs
Normal file
33
Scripts/Services/New Magincia/Distillation/Items/MetalKeg.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using Server;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class MetalKeg : Keg
|
||||
{
|
||||
public override int LabelNumber { get { return 1150675; } }
|
||||
|
||||
[Constructable]
|
||||
public MetalKeg()
|
||||
{
|
||||
}
|
||||
|
||||
public MetalKeg( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
using Server;
|
||||
using System;
|
||||
using Server.Engines.Distillation;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class WheatWort : Item
|
||||
{
|
||||
public override int LabelNumber { get { return 1150275; } } // wheat wort
|
||||
|
||||
[Constructable]
|
||||
public WheatWort() : this(1)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public WheatWort(int num)
|
||||
: base(0x1848)
|
||||
{
|
||||
Stackable = true;
|
||||
Amount = num;
|
||||
Hue = 1281;
|
||||
}
|
||||
|
||||
public WheatWort(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write((int)1);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int version = reader.ReadInt();
|
||||
|
||||
if (version == 0)
|
||||
ItemID = 0x1848;
|
||||
}
|
||||
}
|
||||
}
|
||||
92
Scripts/Services/New Magincia/Distillation/Items/Yeast.cs
Normal file
92
Scripts/Services/New Magincia/Distillation/Items/Yeast.cs
Normal file
@@ -0,0 +1,92 @@
|
||||
using Server;
|
||||
using System;
|
||||
using Server.Engines.Distillation;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class Yeast : Item
|
||||
{
|
||||
private int m_BacterialResistance;
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int BacterialResistance
|
||||
{
|
||||
get { return m_BacterialResistance; }
|
||||
set
|
||||
{
|
||||
m_BacterialResistance = value;
|
||||
|
||||
if(m_BacterialResistance < 1) m_BacterialResistance = 1;
|
||||
if(m_BacterialResistance > 5) m_BacterialResistance = 5;
|
||||
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
|
||||
public override int LabelNumber { get { return 1150453; } } // yeast
|
||||
|
||||
[Constructable]
|
||||
public Yeast() : base(3624)
|
||||
{
|
||||
Hue = 2418;
|
||||
int ran = Utility.Random(100);
|
||||
|
||||
if(ran <= 5)
|
||||
m_BacterialResistance = 5;
|
||||
else if (ran <= 10)
|
||||
m_BacterialResistance = 4;
|
||||
else if (ran <= 20)
|
||||
m_BacterialResistance = 3;
|
||||
else if (ran <= 40)
|
||||
m_BacterialResistance = 2;
|
||||
else
|
||||
m_BacterialResistance = 1;
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public Yeast(int resistance) : base(3624)
|
||||
{
|
||||
BacterialResistance = resistance;
|
||||
}
|
||||
|
||||
public override void GetProperties(ObjectPropertyList list)
|
||||
{
|
||||
base.GetProperties(list);
|
||||
|
||||
list.Add(1150455, GetResistanceLabel()); // Bacterial Resistance: ~1_VAL~
|
||||
}
|
||||
|
||||
private string GetResistanceLabel()
|
||||
{
|
||||
switch(m_BacterialResistance)
|
||||
{
|
||||
default:
|
||||
case 5: return "++";
|
||||
case 4: return "+";
|
||||
case 3: return "+-";
|
||||
case 2: return "-";
|
||||
case 1: return "--";
|
||||
}
|
||||
}
|
||||
|
||||
public Yeast(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write((int)0);
|
||||
|
||||
writer.Write(m_BacterialResistance);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int version = reader.ReadInt();
|
||||
|
||||
m_BacterialResistance = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user