Full Version : Fishing Rod
xmlspawner >>Scripting Support >>Fishing Rod
<< Prev | Next >>
Rhosyn- 07-18-2006
Hello
I have a total new fishing system that was on 1.0, it works fine on 2.0 but not my fishing rod and its really confused me, the move over has not been easy so the mind is in semi meltdown.
I just can't figure how to alter it for 2.0 *touches wood everything else seems fine*

CODE
////Rhosyn The Midnight Runners///// using System; using System.Collections; using Server.Targeting; using Server.Items;
using Server.Engines.Harvest;
using System.Collections.Generic;
using Server.ContextMenus;
namespace Server.Items
{
public class BlueFishingPole : BaseBFP
{
public SkillMod m_SkillMod;
[Constructable]
public BlueFishingPole() : base( 0x0DC0 )
{
Layer = Layer.OneHanded;
Weight = 8.0;
Hue = 297;
Name = "Blue Fishing Pole";
}
[Constructable]
public BlueFishingPole( int uses ) : base( uses, 0x0DC0 )
{
Layer = Layer.OneHanded;
Weight = 8.0;
Hue = 297;
Name = "Blue Fishing Pole";
}
public override bool OnEquip( Mobile m )
{
base.OnEquip( m );
m_SkillMod = new DefaultSkillMod( SkillName.Fishing, true, 15 );
m.AddSkillMod(m_SkillMod );
return true;
}
public override void OnRemoved( object parent )
{
base.OnRemoved( parent );
if ( m_SkillMod != null )
m_SkillMod.Remove();
m_SkillMod = null;
}
public override void OnDoubleClick( Mobile from )
{
Fishing.System.BeginHarvesting( from, this );
}
public override void GetContextMenuEntries( Mobile from, List<ContextMenuEntry> list )
{
base.GetContextMenuEntries( from, list );
BaseHarvestTool.AddContextMenuEntries( from, this, list, Fishing.System );
}
public BlueFishingPole( Serial serial ) : base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
}
public abstract class BaseBFP : Item, IUsesRemaining
{
private int m_UsesRemaining;
[CommandProperty( AccessLevel.GameMaster )]
public int UsesRemaining
{
get { return m_UsesRemaining; }
set { m_UsesRemaining = value; InvalidateProperties(); }
}
public bool ShowUsesRemaining{ get{ return true; } set{} }
public BaseBFP( int itemID ) : this( 20, itemID )
{
}
public BaseBFP( int uses, int itemID ) : base( itemID )
{
m_UsesRemaining = uses;
}
public BaseBFP( Serial serial ) : base( serial )
{
}
public override void GetProperties( ObjectPropertyList list )
{
base.GetProperties( list );
list.Add( 1060584, m_UsesRemaining.ToString() ); // uses remaining: ~1_val~
}
public virtual void DisplayDurabilityTo( Mobile m )
{
LabelToAffix( m, 1017323, AffixType.Append, ": " + m_UsesRemaining.ToString() ); // Durability
}
public static bool CheckAccessible( Item tool, Mobile m )
{
return ( tool.IsChildOf( m ) || tool.Parent == m );
}
public static bool CheckTool( Item tool, Mobile m )
{
Item check = m.FindItemOnLayer( Layer.OneHanded );
if ( check is BaseTool && check != tool )
return false;
check = m.FindItemOnLayer( Layer.TwoHanded );
if ( check is BaseBFP && check != tool )
return false;
return true;
}
public override void OnSingleClick( Mobile from )
{
DisplayDurabilityTo( from );
base.OnSingleClick( from );
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
writer.Write( (int) m_UsesRemaining );
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
switch ( version )
{
case 0:
{
m_UsesRemaining = reader.ReadInt();
break;
}
}
}
}
}

Some help would be lovely and thank you
ArteGordon- 07-19-2006
what is the problem with it?
Rhosyn- 07-19-2006
I am getting this error:
RunUO - [www.runuo.com] Version 2.0, Build 2357.32527
Core: Running on .NET Framework Version 2.0.50727
Scripts: Compiling C# scripts...failed (1 errors, 0 warnings)
Errors:
+ Custom/Fishing Craft/Fish Crafting/Rods/BlueFishingPole.cs:
CS0103: Line 118: The name 'AffixType' does not exist in the current context
It worked great on 1.0 and I am getting to grips with 2.0 lots of changes, I have oooodles of problems with my quests as well so I might be on a lot
ArteGordon- 07-19-2006
you just need to add this to the beginning of your script.
using Server.Network;
Rhosyn- 07-20-2006
Worked a treat thank you so much.