jayates
Member
- ServUO Version
- Publish 57
- Ultima Expansion
- Time Of Legends
I have this item that turns 10 fish into Fish Lard. Only, thing is I want it to "require" 50 tokens to use it. I added a bit of code that excepts the tokens (OnDoubleClick), although if not present in backpack it'll still operate. Can someone please help me fix the code?
C#:
namespace Server.Items
{
public class FishOilProcessorX : Item
{
public override string DefaultName { get { return "an Unhygienix... covered in fish oil"; }}
[Constructable]
public FishOilProcessorX() : base(11001) //music box
{
Movable = false;
Hue = 2231;
}
public override void OnSingleClick( Mobile from )
{
base.OnSingleClick( from );
LabelTo( from, "This Unhygienix requires 1 stack of 10 fish to produce a block of Fish Lard!" );
}
public override void GetProperties( ObjectPropertyList list )
{
base.GetProperties( list );
list.Add( "This Unhygienix requires 1 stack of 10 fish to produce a block of Fish Lard!" );
}
public FishOilProcessorX(Serial serial) : base(serial)
{ }
private int CheckGrouping(Item a, Item b)
{
return b.Hue.CompareTo(a.Hue);
}
public override void OnDoubleClick(Mobile p)
{
////added code////
/*Container pack = p.Backpack;
Item[] items = pack.FindItemsByType( typeof( Daat99Tokens ) );
if( p.Backpack.ConsumeTotal( typeof( Daat99Tokens ), 50 ) )
if (items != null && items.Length > 0)
{
foreach (Item item in items)
item.Consume();
}*/
//// added code end////
var success = false;
////ShoreFish////
if ((success = p.Backpack.ConsumeTotalGrouped(typeof(Fish), 10, true, null, CheckGrouping)))
{
p.AddToBackpack(new FlaskOfFishOil());
}
else if ((success = p.Backpack.ConsumeTotalGrouped(typeof(PumpkinSeedSunfish), 10, true, null, CheckGrouping)))
{
p.AddToBackpack(new FlaskOfFishOil());
}
else if ((success = p.Backpack.ConsumeTotalGrouped(typeof(BrookTrout), 10, true, null, CheckGrouping)))
{
p.AddToBackpack(new FlaskOfFishOil());
}
else if ((success = p.Backpack.ConsumeTotalGrouped(typeof(RedbellyBream), 10, true, null, CheckGrouping)))
{
p.AddToBackpack(new FlaskOfFishOil());
}
else if ((success = p.Backpack.ConsumeTotalGrouped(typeof(GreenCatfish), 10, true, null, CheckGrouping)))
{
p.AddToBackpack(new FlaskOfFishOil());
}
else if ((success = p.Backpack.ConsumeTotalGrouped(typeof(YellowPerch), 10, true, null, CheckGrouping)))
{
p.AddToBackpack(new FlaskOfFishOil());
}
else if ((success = p.Backpack.ConsumeTotalGrouped(typeof(RainbowTrout), 10, true, null, CheckGrouping)))
{
p.AddToBackpack(new FlaskOfFishOil());
}
else if ((success = p.Backpack.ConsumeTotalGrouped(typeof(SmallmouthBass), 10, true, null, CheckGrouping)))
{
p.AddToBackpack(new FlaskOfFishOil());
}
else if ((success = p.Backpack.ConsumeTotalGrouped(typeof(Walleye), 10, true, null, CheckGrouping)))
{
p.AddToBackpack(new FlaskOfFishOil());
}
else if ((success = p.Backpack.ConsumeTotalGrouped(typeof(PikeFish), 10, true, null, CheckGrouping)))
{
p.AddToBackpack(new FlaskOfFishOil());
}
else if ((success = p.Backpack.ConsumeTotalGrouped(typeof(BluegillSunfish), 10, true, null, CheckGrouping)))
{
p.AddToBackpack(new FlaskOfFishOil());
}
else if ((success = p.Backpack.ConsumeTotalGrouped(typeof(UncommonShiner), 10, true, null, CheckGrouping)))
{
p.AddToBackpack(new FlaskOfFishOil());
}
else if ((success = p.Backpack.ConsumeTotalGrouped(typeof(KokaneeSalmon), 10, true, null, CheckGrouping)))
{
p.AddToBackpack(new FlaskOfFishOil());
}
////DeepWaterFish////
else if ((success = p.Backpack.ConsumeTotalGrouped(typeof(Haddock), 10, true, null, CheckGrouping)))
{
p.AddToBackpack(new FlaskOfFishOil());
}
else if ((success = p.Backpack.ConsumeTotalGrouped(typeof(Tarpon), 10, true, null, CheckGrouping)))
{
p.AddToBackpack(new FlaskOfFishOil());
}
else if ((success = p.Backpack.ConsumeTotalGrouped(typeof(Cobia), 10, true, null, CheckGrouping)))
{
p.AddToBackpack(new FlaskOfFishOil());
}
else if ((success = p.Backpack.ConsumeTotalGrouped(typeof(Shad), 10, true, null, CheckGrouping)))
{
p.AddToBackpack(new FlaskOfFishOil());
}
else if ((success = p.Backpack.ConsumeTotalGrouped(typeof(BlueFish), 10, true, null, CheckGrouping)))
{
p.AddToBackpack(new FlaskOfFishOil());
}
else if ((success = p.Backpack.ConsumeTotalGrouped(typeof(Bonefish), 10, true, null, CheckGrouping)))
{
p.AddToBackpack(new FlaskOfFishOil());
}
else if ((success = p.Backpack.ConsumeTotalGrouped(typeof(CapeCod), 10, true, null, CheckGrouping)))
{
p.AddToBackpack(new FlaskOfFishOil());
}
else if ((success = p.Backpack.ConsumeTotalGrouped(typeof(RedSnook), 10, true, null, CheckGrouping)))
{
p.AddToBackpack(new FlaskOfFishOil());
}
else if ((success = p.Backpack.ConsumeTotalGrouped(typeof(MahiMahi), 10, true, null, CheckGrouping)))
{
p.AddToBackpack(new FlaskOfFishOil());
}
else if ((success = p.Backpack.ConsumeTotalGrouped(typeof(YellowfinTuna), 10, true, null, CheckGrouping)))
{
p.AddToBackpack(new FlaskOfFishOil());
}
else if ((success = p.Backpack.ConsumeTotalGrouped(typeof(RedGrouper), 10, true, null, CheckGrouping)))
{
p.AddToBackpack(new FlaskOfFishOil());
}
else if ((success = p.Backpack.ConsumeTotalGrouped(typeof(RedDrum), 10, true, null, CheckGrouping)))
{
p.AddToBackpack(new FlaskOfFishOil());
}
else if ((success = p.Backpack.ConsumeTotalGrouped(typeof(BlackSeabass), 10, true, null, CheckGrouping)))
{
p.AddToBackpack(new FlaskOfFishOil());
}
else if ((success = p.Backpack.ConsumeTotalGrouped(typeof(GraySnapper), 10, true, null, CheckGrouping)))
{
p.AddToBackpack(new FlaskOfFishOil());
}
else if ((success = p.Backpack.ConsumeTotalGrouped(typeof(Amberjack), 10, true, null, CheckGrouping)))
{
p.AddToBackpack(new FlaskOfFishOil());
}
else if ((success = p.Backpack.ConsumeTotalGrouped(typeof(Bonito), 10, true, null, CheckGrouping)))
{
p.AddToBackpack(new FlaskOfFishOil());
}
else if ((success = p.Backpack.ConsumeTotalGrouped(typeof(CaptainSnook), 10, true, null, CheckGrouping)))
{
p.AddToBackpack(new FlaskOfFishOil());
}
else if ((success = p.Backpack.ConsumeTotalGrouped(typeof(BlueGrouper), 10, true, null, CheckGrouping)))
{
p.AddToBackpack(new FlaskOfFishOil());
}
////DungeonFish////
else if ((success = p.Backpack.ConsumeTotalGrouped(typeof(DungeonChub), 10, true, null, CheckGrouping)))
{
p.AddToBackpack(new FlaskOfFishOil());
}
else if ((success = p.Backpack.ConsumeTotalGrouped(typeof(CutThroatTrout), 10, true, null, CheckGrouping)))
{
p.AddToBackpack(new FlaskOfFishOil());
}
else if ((success = p.Backpack.ConsumeTotalGrouped(typeof(OrcBass), 10, true, null, CheckGrouping)))
{
p.AddToBackpack(new FlaskOfFishOil());
}
else if ((success = p.Backpack.ConsumeTotalGrouped(typeof(InfernalTuna), 10, true, null, CheckGrouping)))
{
p.AddToBackpack(new FlaskOfFishOil());
}
else if ((success = p.Backpack.ConsumeTotalGrouped(typeof(DemonTrout), 10, true, null, CheckGrouping)))
{
p.AddToBackpack(new FlaskOfFishOil());
}
else if ((success = p.Backpack.ConsumeTotalGrouped(typeof(GrimCisco), 10, true, null, CheckGrouping)))
{
p.AddToBackpack(new FlaskOfFishOil());
}
else if ((success = p.Backpack.ConsumeTotalGrouped(typeof(DarkFish), 10, true, null, CheckGrouping)))
{
p.AddToBackpack(new FlaskOfFishOil());
}
else if ((success = p.Backpack.ConsumeTotalGrouped(typeof(TormentedPike), 10, true, null, CheckGrouping)))
{
p.AddToBackpack(new FlaskOfFishOil());
}
else if ((success = p.Backpack.ConsumeTotalGrouped(typeof(SnaggletoothBass), 10, true, null, CheckGrouping)))
{
p.AddToBackpack(new FlaskOfFishOil());
}
else if ((success = p.Backpack.ConsumeTotalGrouped(typeof(DrakeFish), 10, true, null, CheckGrouping)))
{
p.AddToBackpack(new FlaskOfFishOil());
}
else if ((success = p.Backpack.ConsumeTotalGrouped(typeof(CragSnapper), 10, true, null, CheckGrouping)))
{
p.AddToBackpack(new FlaskOfFishOil());
}
else if ((success = p.Backpack.ConsumeTotalGrouped(typeof(LurkerFish), 10, true, null, CheckGrouping)))
{
p.AddToBackpack(new FlaskOfFishOil());
}
if (success)
{
p.SendMessage( 89, "The machine squeezed your stack of fish into a itty, bitty block of Fish Lard!" );
p.Say ("Wow... a few gold coins fell out! Those fish must have swallowed em'!");
p.AddToBackpack( new FlaskOfFishOil()); // ( Utility.Random( 1, 2 )));
p.AddToBackpack( new Gold( Utility.Random( 100, 200 )));
//Delete();
}
else
{
p.SendMessage("The Unhygienix requires 10 Fish to produce a block of Fish Lard!");
}
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write(0);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
}
}
}