* Fixes a bug with the main loop. Removes unnecessary optimizations for RDRand. * WIP - Rewriting packets. * Cleanup and updates README * Converts more packets * Fixes header * Converts Effects packets. * Forgot the send command * Adds the start of containers packets. * Adds message packets with caching * Extends the send methods * Starts to add Acquire methods * Converted the packets * Cleanup * Cleanup * Adds more packets * Adds more packets * Fixes clearing arrays from pool. Adds Mobile Incoming * Converts more packets. * Moves more packets * Moves more packets * Test compression * Merges * Migrating to an idiomatic syntax that also supports compression, and proxying. * Optimize the stack alloc. Changes attributes * Converted container packets * Visual Studio doesn't auto save files. I am still getting used to subpar IDEs. * Adds static packet caching. Will profile later. Converts more packets * Fixes packets and changes how compression is configured * WIP - Adds basics for Gumps. Not finished though. * Fix file * Fixes formatting * Changed SpanWriter to be more idiomatic. * Fixes Span vs RawSpan and missing stackallocs * Converts over some more gumps * WIP - Deletes 32bit support. * Drops RDRand32 support. * Fixes gump compilation * Converting gump components * Removes old huffman compression function * Revert signature for backwards compatibility * WIP - Converting more gump components * Creates ArraySet for the strings. Updates AppendTo to reference that. * Converts the maining gump components * Cleans up gump components * Cleans up directives * Cleans up ArraySet and moves it. Adds null-coalescing-assignment * Cleanup, Target Packets, and C# 8 changes. * Removed OPL Packet * World packets * Fixing packet uses * Cleans up code. Fixes packet uses in various places. * More cleanup for packets * Code cleanup * Converts more packet uses and cleans up more code * More code cleanup * Finishes fixing the packets in Item * Updates secure trade packets * Updates core and gets it to compile. * Moved packets to scripts. Fixed account handler use of packets * Code cleanup * Updates chat packets * Code cleanuo * Adds party packets, but need to implement them. * Party packets WIP * Finishes party packets * Rearrange movement namespaces and classes * Finishes plant packets * Code Formatting * Fixes moving effects * Code cleanup, eliminates equipinfo * Adds more packets. Fixes bugs with various packets. * Finishes mahjon packets * Fixes mahjong packet * Code cleanup * Finishes mahjong packets * Adds Map packets * Add multifacet maps and charts * Cleans up some packets with UTF8 * Optimizes packets * Cleans up more packets. Moves the MessageHelper * Removes assistant support. Removes extended protocol. Incorporates MapUO packets as normal packets. * Updates protocol extensions packet receiver * Fixes a few bugs. Fixes a few more packets. * Code cleanup and fixing more packets * Fixes packet effects * Cleaned up more code * Buff Icon cleanup * Removed unused constructors * Code Cleanup. Adds BoatHS Packets * Moves house files. Updates house foundation packets. * Deployment cleanup * Fixes: * Code cleanup * More code cleanup * More code cleanup * Cleaned up BaseHouse * Enforces styling * Converts foreach to linq where possible. * Dont need that * Goals/Readme updates * Removes 32bit support at the highest level. Turns on HRT by default. * Code cleanup. Fixes extended features packet. * Fixes various bugs * Code cleanup * Code cleanup * Code cleanup. Fixes gump X/Y assignment. * Code cleanup using |= operator * More code cleanup * Cleanup * Fixes spacing issues. Thanks Visual Studio. You suck. * Compiler error * Fixes NPE from RunUO 2.7 * Renames ScriptCompiler to AssemblyHandler. Fixes packets. Updates README * Fixes more packets. Stupid trailing nulls. * Fixes various bugs. * Fixes for gumps * Fixes more gump stuff. Going to split it out later since it is getting insane * Recoded the gump writing * WIP * *Added output path of scripts project to dev branch *Activated debugging in code
705 lines
16 KiB
C#
705 lines
16 KiB
C#
using System;
|
|
using Server.Targeting;
|
|
|
|
namespace Server.Items
|
|
{
|
|
public abstract class CookableFood : Item
|
|
{
|
|
[CommandProperty(AccessLevel.GameMaster)]
|
|
public int CookingLevel{ get; set; }
|
|
|
|
public CookableFood(int itemID, int cookingLevel) : base(itemID) => CookingLevel = cookingLevel;
|
|
|
|
public CookableFood(Serial serial) : base(serial)
|
|
{
|
|
}
|
|
|
|
public abstract Food Cook();
|
|
|
|
public override void Serialize(GenericWriter writer)
|
|
{
|
|
base.Serialize(writer);
|
|
|
|
writer.Write(1); // version
|
|
// Version 1
|
|
writer.Write(CookingLevel);
|
|
}
|
|
|
|
public override void Deserialize(GenericReader reader)
|
|
{
|
|
base.Deserialize(reader);
|
|
|
|
int version = reader.ReadInt();
|
|
|
|
switch (version)
|
|
{
|
|
case 1:
|
|
{
|
|
CookingLevel = reader.ReadInt();
|
|
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
#if false
|
|
public override void OnDoubleClick( Mobile from )
|
|
{
|
|
if ( !Movable )
|
|
return;
|
|
|
|
from.Target = new InternalTarget( this );
|
|
}
|
|
#endif
|
|
|
|
public static bool IsHeatSource(object targeted)
|
|
{
|
|
int itemID;
|
|
|
|
if (targeted is Item item)
|
|
itemID = item.ItemID;
|
|
else if (targeted is StaticTarget target)
|
|
itemID = target.ItemID;
|
|
else
|
|
return false;
|
|
|
|
return itemID == 0xFAC ||
|
|
itemID >= 0xDE3 && itemID <= 0xDE9 ||
|
|
itemID >= 0x461 && itemID <= 0x48E ||
|
|
itemID >= 0x92B && itemID <= 0x96C ||
|
|
itemID >= 0x184A && itemID <= 0x184C ||
|
|
itemID >= 0x184E && itemID <= 0x1850 ||
|
|
itemID >= 0x398C && itemID <= 0x399F;
|
|
}
|
|
|
|
private class InternalTarget : Target
|
|
{
|
|
private CookableFood m_Item;
|
|
|
|
public InternalTarget(CookableFood item) : base(1, false, TargetFlags.None) => m_Item = item;
|
|
|
|
protected override void OnTarget(Mobile from, object targeted)
|
|
{
|
|
if (m_Item.Deleted) return;
|
|
|
|
if (IsHeatSource(targeted))
|
|
{
|
|
if (from.BeginAction<CookableFood>())
|
|
{
|
|
from.PlaySound(0x225);
|
|
|
|
m_Item.Consume();
|
|
|
|
InternalTimer t = new InternalTimer(from, targeted as IPoint3D, from.Map, m_Item);
|
|
t.Start();
|
|
}
|
|
else
|
|
from.SendLocalizedMessage(500119); // You must wait to perform another action
|
|
}
|
|
}
|
|
|
|
private class InternalTimer : Timer
|
|
{
|
|
private CookableFood m_CookableFood;
|
|
private Mobile m_From;
|
|
private Map m_Map;
|
|
private IPoint3D m_Point;
|
|
|
|
public InternalTimer(Mobile from, IPoint3D p, Map map, CookableFood cookableFood) : base(
|
|
TimeSpan.FromSeconds(5.0))
|
|
{
|
|
m_From = from;
|
|
m_Point = p;
|
|
m_Map = map;
|
|
m_CookableFood = cookableFood;
|
|
}
|
|
|
|
protected override void OnTick()
|
|
{
|
|
m_From.EndAction<CookableFood>();
|
|
|
|
if (m_From.Map != m_Map || m_Point != null && m_From.GetDistanceToSqrt(m_Point) > 3)
|
|
{
|
|
m_From.SendLocalizedMessage(500686); // You burn the food to a crisp! It's ruined.
|
|
return;
|
|
}
|
|
|
|
if (m_From.CheckSkill(SkillName.Cooking, m_CookableFood.CookingLevel, 100))
|
|
{
|
|
Food cookedFood = m_CookableFood.Cook();
|
|
|
|
if (m_From.AddToBackpack(cookedFood))
|
|
m_From.PlaySound(0x57);
|
|
}
|
|
else
|
|
m_From.SendLocalizedMessage(500686); // You burn the food to a crisp! It's ruined.
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// ********** RawRibs **********
|
|
public class RawRibs : CookableFood
|
|
{
|
|
[Constructible]
|
|
public RawRibs(int amount = 1) : base(0x9F1, 10)
|
|
{
|
|
Weight = 1.0;
|
|
Stackable = true;
|
|
Amount = amount;
|
|
}
|
|
|
|
public RawRibs(Serial serial) : base(serial)
|
|
{
|
|
}
|
|
|
|
public override void Serialize(GenericWriter writer)
|
|
{
|
|
base.Serialize(writer);
|
|
|
|
writer.Write(0); // version
|
|
}
|
|
|
|
public override void Deserialize(GenericReader reader)
|
|
{
|
|
base.Deserialize(reader);
|
|
|
|
int version = reader.ReadInt();
|
|
}
|
|
|
|
public override Food Cook() => new Ribs();
|
|
}
|
|
|
|
|
|
// ********** RawLambLeg **********
|
|
public class RawLambLeg : CookableFood
|
|
{
|
|
[Constructible]
|
|
public RawLambLeg(int amount = 1) : base(0x1609, 10)
|
|
{
|
|
Stackable = true;
|
|
Amount = amount;
|
|
}
|
|
|
|
public RawLambLeg(Serial serial) : base(serial)
|
|
{
|
|
}
|
|
|
|
public override void Serialize(GenericWriter writer)
|
|
{
|
|
base.Serialize(writer);
|
|
|
|
writer.Write(1); // version
|
|
}
|
|
|
|
public override void Deserialize(GenericReader reader)
|
|
{
|
|
base.Deserialize(reader);
|
|
|
|
int version = reader.ReadInt();
|
|
|
|
if (version == 0 && Weight == 1)
|
|
Weight = -1;
|
|
}
|
|
|
|
public override Food Cook() => new LambLeg();
|
|
}
|
|
|
|
// ********** RawChickenLeg **********
|
|
public class RawChickenLeg : CookableFood
|
|
{
|
|
[Constructible]
|
|
public RawChickenLeg() : base(0x1607, 10)
|
|
{
|
|
Weight = 1.0;
|
|
Stackable = true;
|
|
}
|
|
|
|
public RawChickenLeg(Serial serial) : base(serial)
|
|
{
|
|
}
|
|
|
|
public override void Serialize(GenericWriter writer)
|
|
{
|
|
base.Serialize(writer);
|
|
|
|
writer.Write(0); // version
|
|
}
|
|
|
|
public override void Deserialize(GenericReader reader)
|
|
{
|
|
base.Deserialize(reader);
|
|
|
|
int version = reader.ReadInt();
|
|
}
|
|
|
|
public override Food Cook() => new ChickenLeg();
|
|
}
|
|
|
|
|
|
// ********** RawBird **********
|
|
public class RawBird : CookableFood
|
|
{
|
|
[Constructible]
|
|
public RawBird(int amount = 1) : base(0x9B9, 10)
|
|
{
|
|
Weight = 1.0;
|
|
Stackable = true;
|
|
Amount = amount;
|
|
}
|
|
|
|
public RawBird(Serial serial) : base(serial)
|
|
{
|
|
}
|
|
|
|
public override void Serialize(GenericWriter writer)
|
|
{
|
|
base.Serialize(writer);
|
|
|
|
writer.Write(0); // version
|
|
}
|
|
|
|
public override void Deserialize(GenericReader reader)
|
|
{
|
|
base.Deserialize(reader);
|
|
|
|
int version = reader.ReadInt();
|
|
}
|
|
|
|
public override Food Cook() => new CookedBird();
|
|
}
|
|
|
|
|
|
// ********** UnbakedPeachCobbler **********
|
|
public class UnbakedPeachCobbler : CookableFood
|
|
{
|
|
[Constructible]
|
|
public UnbakedPeachCobbler() : base(0x1042, 25) => Weight = 1.0;
|
|
|
|
public UnbakedPeachCobbler(Serial serial) : base(serial)
|
|
{
|
|
}
|
|
|
|
public override int LabelNumber => 1041335; // unbaked peach cobbler
|
|
|
|
public override void Serialize(GenericWriter writer)
|
|
{
|
|
base.Serialize(writer);
|
|
|
|
writer.Write(0); // version
|
|
}
|
|
|
|
public override void Deserialize(GenericReader reader)
|
|
{
|
|
base.Deserialize(reader);
|
|
|
|
int version = reader.ReadInt();
|
|
}
|
|
|
|
public override Food Cook() => new PeachCobbler();
|
|
}
|
|
|
|
// ********** UnbakedFruitPie **********
|
|
public class UnbakedFruitPie : CookableFood
|
|
{
|
|
[Constructible]
|
|
public UnbakedFruitPie() : base(0x1042, 25) => Weight = 1.0;
|
|
|
|
public UnbakedFruitPie(Serial serial) : base(serial)
|
|
{
|
|
}
|
|
|
|
public override int LabelNumber => 1041334; // unbaked fruit pie
|
|
|
|
public override void Serialize(GenericWriter writer)
|
|
{
|
|
base.Serialize(writer);
|
|
|
|
writer.Write(0); // version
|
|
}
|
|
|
|
public override void Deserialize(GenericReader reader)
|
|
{
|
|
base.Deserialize(reader);
|
|
|
|
int version = reader.ReadInt();
|
|
}
|
|
|
|
public override Food Cook() => new FruitPie();
|
|
}
|
|
|
|
// ********** UnbakedMeatPie **********
|
|
public class UnbakedMeatPie : CookableFood
|
|
{
|
|
[Constructible]
|
|
public UnbakedMeatPie() : base(0x1042, 25) => Weight = 1.0;
|
|
|
|
public UnbakedMeatPie(Serial serial) : base(serial)
|
|
{
|
|
}
|
|
|
|
public override int LabelNumber => 1041338; // unbaked meat pie
|
|
|
|
public override void Serialize(GenericWriter writer)
|
|
{
|
|
base.Serialize(writer);
|
|
|
|
writer.Write(0); // version
|
|
}
|
|
|
|
public override void Deserialize(GenericReader reader)
|
|
{
|
|
base.Deserialize(reader);
|
|
|
|
int version = reader.ReadInt();
|
|
}
|
|
|
|
public override Food Cook() => new MeatPie();
|
|
}
|
|
|
|
// ********** UnbakedPumpkinPie **********
|
|
public class UnbakedPumpkinPie : CookableFood
|
|
{
|
|
[Constructible]
|
|
public UnbakedPumpkinPie() : base(0x1042, 25) => Weight = 1.0;
|
|
|
|
public UnbakedPumpkinPie(Serial serial) : base(serial)
|
|
{
|
|
}
|
|
|
|
public override int LabelNumber => 1041342; // unbaked pumpkin pie
|
|
|
|
public override void Serialize(GenericWriter writer)
|
|
{
|
|
base.Serialize(writer);
|
|
|
|
writer.Write(0); // version
|
|
}
|
|
|
|
public override void Deserialize(GenericReader reader)
|
|
{
|
|
base.Deserialize(reader);
|
|
|
|
int version = reader.ReadInt();
|
|
}
|
|
|
|
public override Food Cook() => new PumpkinPie();
|
|
}
|
|
|
|
// ********** UnbakedApplePie **********
|
|
public class UnbakedApplePie : CookableFood
|
|
{
|
|
[Constructible]
|
|
public UnbakedApplePie() : base(0x1042, 25) => Weight = 1.0;
|
|
|
|
public UnbakedApplePie(Serial serial) : base(serial)
|
|
{
|
|
}
|
|
|
|
public override int LabelNumber => 1041336; // unbaked apple pie
|
|
|
|
public override void Serialize(GenericWriter writer)
|
|
{
|
|
base.Serialize(writer);
|
|
|
|
writer.Write(0); // version
|
|
}
|
|
|
|
public override void Deserialize(GenericReader reader)
|
|
{
|
|
base.Deserialize(reader);
|
|
|
|
int version = reader.ReadInt();
|
|
}
|
|
|
|
public override Food Cook() => new ApplePie();
|
|
}
|
|
|
|
// ********** UncookedCheesePizza **********
|
|
[TypeAlias("Server.Items.UncookedPizza")]
|
|
public class UncookedCheesePizza : CookableFood
|
|
{
|
|
[Constructible]
|
|
public UncookedCheesePizza() : base(0x1083, 20) => Weight = 1.0;
|
|
|
|
public UncookedCheesePizza(Serial serial) : base(serial)
|
|
{
|
|
}
|
|
|
|
public override int LabelNumber => 1041341; // uncooked cheese pizza
|
|
|
|
public override void Serialize(GenericWriter writer)
|
|
{
|
|
base.Serialize(writer);
|
|
|
|
writer.Write(0); // version
|
|
}
|
|
|
|
public override void Deserialize(GenericReader reader)
|
|
{
|
|
base.Deserialize(reader);
|
|
|
|
int version = reader.ReadInt();
|
|
|
|
if (ItemID == 0x1040)
|
|
ItemID = 0x1083;
|
|
|
|
if (Hue == 51)
|
|
Hue = 0;
|
|
}
|
|
|
|
public override Food Cook() => new CheesePizza();
|
|
}
|
|
|
|
// ********** UncookedSausagePizza **********
|
|
public class UncookedSausagePizza : CookableFood
|
|
{
|
|
[Constructible]
|
|
public UncookedSausagePizza() : base(0x1083, 20) => Weight = 1.0;
|
|
|
|
public UncookedSausagePizza(Serial serial) : base(serial)
|
|
{
|
|
}
|
|
|
|
public override int LabelNumber => 1041337; // uncooked sausage pizza
|
|
|
|
public override void Serialize(GenericWriter writer)
|
|
{
|
|
base.Serialize(writer);
|
|
|
|
writer.Write(0); // version
|
|
}
|
|
|
|
public override void Deserialize(GenericReader reader)
|
|
{
|
|
base.Deserialize(reader);
|
|
|
|
int version = reader.ReadInt();
|
|
}
|
|
|
|
public override Food Cook() => new SausagePizza();
|
|
}
|
|
|
|
// ********** UnbakedQuiche **********
|
|
public class UnbakedQuiche : CookableFood
|
|
{
|
|
[Constructible]
|
|
public UnbakedQuiche() : base(0x1042, 25) => Weight = 1.0;
|
|
|
|
public UnbakedQuiche(Serial serial) : base(serial)
|
|
{
|
|
}
|
|
|
|
public override int LabelNumber => 1041339; // unbaked quiche
|
|
|
|
public override void Serialize(GenericWriter writer)
|
|
{
|
|
base.Serialize(writer);
|
|
|
|
writer.Write(0); // version
|
|
}
|
|
|
|
public override void Deserialize(GenericReader reader)
|
|
{
|
|
base.Deserialize(reader);
|
|
|
|
int version = reader.ReadInt();
|
|
}
|
|
|
|
public override Food Cook() => new Quiche();
|
|
}
|
|
|
|
// ********** Eggs **********
|
|
public class Eggs : CookableFood
|
|
{
|
|
[Constructible]
|
|
public Eggs(int amount = 1) : base(0x9B5, 15)
|
|
{
|
|
Weight = 1.0;
|
|
Stackable = true;
|
|
Amount = amount;
|
|
}
|
|
|
|
public Eggs(Serial serial) : base(serial)
|
|
{
|
|
}
|
|
|
|
public override void Serialize(GenericWriter writer)
|
|
{
|
|
base.Serialize(writer);
|
|
|
|
writer.Write(1); // version
|
|
}
|
|
|
|
public override void Deserialize(GenericReader reader)
|
|
{
|
|
base.Deserialize(reader);
|
|
|
|
int version = reader.ReadInt();
|
|
|
|
if (version < 1)
|
|
{
|
|
Stackable = true;
|
|
|
|
if (Weight == 0.5)
|
|
Weight = 1.0;
|
|
}
|
|
}
|
|
|
|
public override Food Cook() => new FriedEggs();
|
|
}
|
|
|
|
// ********** BrightlyColoredEggs **********
|
|
public class BrightlyColoredEggs : CookableFood
|
|
{
|
|
[Constructible]
|
|
public BrightlyColoredEggs() : base(0x9B5, 15)
|
|
{
|
|
Weight = 0.5;
|
|
Hue = 3 + Utility.Random(20) * 5;
|
|
}
|
|
|
|
public BrightlyColoredEggs(Serial serial) : base(serial)
|
|
{
|
|
}
|
|
|
|
public override string DefaultName => "brightly colored eggs";
|
|
|
|
public override void Serialize(GenericWriter writer)
|
|
{
|
|
base.Serialize(writer);
|
|
|
|
writer.Write(0); // version
|
|
}
|
|
|
|
public override void Deserialize(GenericReader reader)
|
|
{
|
|
base.Deserialize(reader);
|
|
|
|
int version = reader.ReadInt();
|
|
}
|
|
|
|
public override Food Cook() => new FriedEggs();
|
|
}
|
|
|
|
// ********** EasterEggs **********
|
|
public class EasterEggs : CookableFood
|
|
{
|
|
[Constructible]
|
|
public EasterEggs() : base(0x9B5, 15)
|
|
{
|
|
Weight = 0.5;
|
|
Hue = 3 + Utility.Random(20) * 5;
|
|
}
|
|
|
|
public EasterEggs(Serial serial) : base(serial)
|
|
{
|
|
}
|
|
|
|
public override int LabelNumber => 1016105; // Easter Eggs
|
|
|
|
public override void Serialize(GenericWriter writer)
|
|
{
|
|
base.Serialize(writer);
|
|
|
|
writer.Write(0); // version
|
|
}
|
|
|
|
public override void Deserialize(GenericReader reader)
|
|
{
|
|
base.Deserialize(reader);
|
|
|
|
int version = reader.ReadInt();
|
|
}
|
|
|
|
public override Food Cook() => new FriedEggs();
|
|
}
|
|
|
|
// ********** CookieMix **********
|
|
public class CookieMix : CookableFood
|
|
{
|
|
[Constructible]
|
|
public CookieMix() : base(0x103F, 20) => Weight = 1.0;
|
|
|
|
public CookieMix(Serial serial) : base(serial)
|
|
{
|
|
}
|
|
|
|
public override void Serialize(GenericWriter writer)
|
|
{
|
|
base.Serialize(writer);
|
|
|
|
writer.Write(0); // version
|
|
}
|
|
|
|
public override void Deserialize(GenericReader reader)
|
|
{
|
|
base.Deserialize(reader);
|
|
|
|
int version = reader.ReadInt();
|
|
}
|
|
|
|
public override Food Cook() => new Cookies();
|
|
}
|
|
|
|
// ********** CakeMix **********
|
|
public class CakeMix : CookableFood
|
|
{
|
|
[Constructible]
|
|
public CakeMix() : base(0x103F, 40) => Weight = 1.0;
|
|
|
|
public CakeMix(Serial serial) : base(serial)
|
|
{
|
|
}
|
|
|
|
public override int LabelNumber => 1041002; // cake mix
|
|
|
|
public override void Serialize(GenericWriter writer)
|
|
{
|
|
base.Serialize(writer);
|
|
|
|
writer.Write(0); // version
|
|
}
|
|
|
|
public override void Deserialize(GenericReader reader)
|
|
{
|
|
base.Deserialize(reader);
|
|
|
|
int version = reader.ReadInt();
|
|
}
|
|
|
|
public override Food Cook() => new Cake();
|
|
}
|
|
|
|
public class RawFishSteak : CookableFood
|
|
{
|
|
[Constructible]
|
|
public RawFishSteak(int amount = 1) : base(0x097A, 10)
|
|
{
|
|
Stackable = true;
|
|
Amount = amount;
|
|
}
|
|
|
|
public RawFishSteak(Serial serial) : base(serial)
|
|
{
|
|
}
|
|
|
|
public override double DefaultWeight => 0.1;
|
|
|
|
public override Food Cook() => new FishSteak();
|
|
|
|
public override void Serialize(GenericWriter writer)
|
|
{
|
|
base.Serialize(writer);
|
|
|
|
writer.Write(0); // version
|
|
}
|
|
|
|
public override void Deserialize(GenericReader reader)
|
|
{
|
|
base.Deserialize(reader);
|
|
|
|
int version = reader.ReadInt();
|
|
}
|
|
}
|
|
}
|