runuo/Scripts/Spells/First/CreateFood.cs
asayre 2ad37d54aa Lots of fixes, changes, rewrites of various things, including but not limited to:
Logging of staff crafting items,
Fixes for the OSI client changes
The potion stacking stuff
BaseWeapon fix, so that damage increase things don't multiply themselves.
admin gump fixes for Firewall
Various display tweaks for weight
SoS no longer spawn in Tokuno
Hiryu hues happified to OSI standards
staff now see alliance chat correctly
Play barkeeper text increased per OSI
Various other OSI skill requirement changes
Various unimplemented features of the SE moves
EventSink for when the client version is received from client.
Client validation moved out of the core.
Client version validation now has options to ignore/kick/warn/annoy.  Automagically tries to detect current client.
Reverted the delayeddamagecontext back to OSI standards.
Can no longer use bags of sending in jail.

MagerySpell implemented. Now only Magery spells have a circle, and various other properties of 'em.
TransformationSpellHelper now implemented.  Things moved around for this.
Spells now need a Timespan for the cast delay, instead of arbitrarily based on Circle.  Circle doesn't make sense for non-Magery spells!
Alot of the spellweaving spells added to OSI standards.
2007-05-26 03:12:41 +00:00

90 lines
No EOL
2.1 KiB
C#

using System;
using Server.Items;
namespace Server.Spells.First
{
public class CreateFoodSpell : MagerySpell
{
private static SpellInfo m_Info = new SpellInfo(
"Create Food", "In Mani Ylem",
224,
9011,
Reagent.Garlic,
Reagent.Ginseng,
Reagent.MandrakeRoot
);
public override SpellCircle Circle { get { return SpellCircle.First; } }
public CreateFoodSpell( Mobile caster, Item scroll ) : base( caster, scroll, m_Info )
{
}
private static FoodInfo[] m_Food = new FoodInfo[]
{
new FoodInfo( typeof( Grapes ), "a grape bunch" ),
new FoodInfo( typeof( Ham ), "a ham" ),
new FoodInfo( typeof( CheeseWedge ), "a wedge of cheese" ),
new FoodInfo( typeof( Muffins ), "muffins" ),
new FoodInfo( typeof( FishSteak ), "a fish steak" ),
new FoodInfo( typeof( Ribs ), "cut of ribs" ),
new FoodInfo( typeof( CookedBird ), "a cooked bird" ),
new FoodInfo( typeof( Sausage ), "sausage" ),
new FoodInfo( typeof( Apple ), "an apple" ),
new FoodInfo( typeof( Peach ), "a peach" )
};
public override void OnCast()
{
if ( CheckSequence() )
{
FoodInfo foodInfo = m_Food[Utility.Random( m_Food.Length )];
Item food = foodInfo.Create();
if ( food != null )
{
Caster.AddToBackpack( food );
// You magically create food in your backpack:
Caster.SendLocalizedMessage( 1042695, true, " " + foodInfo.Name );
Caster.FixedParticles( 0, 10, 5, 2003, EffectLayer.RightHand );
Caster.PlaySound( 0x1E2 );
}
}
FinishSequence();
}
}
public class FoodInfo
{
private Type m_Type;
private string m_Name;
public Type Type{ get{ return m_Type; } set{ m_Type = value; } }
public string Name{ get{ return m_Name; } set{ m_Name = value; } }
public FoodInfo( Type type, string name )
{
m_Type = type;
m_Name = name;
}
public Item Create()
{
Item item;
try
{
item = (Item)Activator.CreateInstance( m_Type );
}
catch
{
item = null;
}
return item;
}
}
}