jayates
Member
Trying to put together a vendor who'll buy Pet Powerscrolls according to their values (based off the Powerscroll Exchange system). I got a wierd error though. Can someone help me with it? Here's the error:
+ CUSTOM/CustomCooking/Questgiver/Gordon.cs:
CS0161: Line 100: 'Server.Mobiles.Gordon.OnDragDrop(Server.Mobile, Server.Item)': not all code paths return a value
script:
+ CUSTOM/CustomCooking/Questgiver/Gordon.cs:
CS0161: Line 100: 'Server.Mobiles.Gordon.OnDragDrop(Server.Mobile, Server.Item)': not all code paths return a value
script:
C#:
using System;
using System.Collections;
using Server.Items;
using Server.Targeting;
using Server.ContextMenus;
using Server.Gumps;
using Server.Misc;
using Server.Network;
using Server.Spells;
using System.Collections.Generic;
namespace Server.Mobiles
{
[CorpseName( "gordon corpse" )]
public class Gordon : Mobile
{
public virtual bool IsInvulnerable{ get{ return true; } }
public static int i_PPSReward = 0;
[Constructable]
public Gordon()
{
Name = "Gordon";
Title = " ...Pet Powerscroll Exchanges";
BodyValue = 400;
HairItemID = 0x2045;
HairHue = 2227;
Hits = 10000;
Hue = 0;
Direction = Direction.East;
AddItem(new Backpack());
AddItem( new Tunic( Utility.RandomDyedHue() ) );
AddItem( new Boots() );
AddItem( new LongPants( Utility.RandomNeutralHue() ) );
AddItem(new CooksRobe() );
CantWalk = true;
Blessed = true;
}
public virtual int GetBootsHue()
{
return 1157;
}
public Gordon( Serial serial ) : base( serial )
{
}
public override void GetContextMenuEntries(Mobile from, List<ContextMenuEntry> list)
{
base.GetContextMenuEntries( from, list );
list.Add( new GordonEntry( from, this ) );
}
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();
}
public class GordonEntry : ContextMenuEntry
{
private Mobile m_Mobile;
private Mobile m_Giver;
public GordonEntry( Mobile from, Mobile giver ) : base( 6146, 3 )
{
m_Mobile = from;
m_Giver = giver;
}
public override void OnClick()
{
if( !( m_Mobile is PlayerMobile ) )
return;
PlayerMobile mobile = (PlayerMobile) m_Mobile;
{
if ( ! mobile.HasGump( typeof( GordonGump ) ) )
{
mobile.SendGump( new GordonGump( mobile ));
}
}
}
}
public override bool OnDragDrop( Mobile from, Item dropped )
{
Mobile m = from;
PlayerMobile mobile = m as PlayerMobile;
if ( mobile != null)
{
if ( dropped is PetPowerScroll )
{
PetPowerScroll deed = (PetPowerScroll)dropped;
i_PPSReward = 0; //default value
if ( deed.Value == 120.0 )
i_PPSReward = 400;
else if ( deed.Value == 115.0 )
i_PPSReward = 200;
else if ( deed.Value == 110.0 )
i_PPSReward = 100;
else if ( deed.Value == 105.0 )
i_PPSReward = 50;
}
else i_PPSReward = 0;
dropped.Delete();
if ( i_PPSReward > 0 )
{
from.AddToBackpack( new PSCredits(i_PPSReward) );
from.SendMessage( 1173, "You were rewarded {0} Powerscroll Credits for this scroll!", i_PPSReward );
}
else if (i_PPSReward == 0 ) from.SendMessage( 1173, "That wasn't a Pet Powerscroll... hopefully is wasn't anything of great value, cause I put it in the trash!" );
return true;
}
}
}
}