Go Back   RunUO - Ultima Online Emulation > RunUO > Script Support

Script Support Get support for modifying RunUO Scripts, or writing your own!

Reply
 
Thread Tools Display Modes
Old 01-01-2004, 05:52 PM   #1 (permalink)
Dream Sage
 
joshw's Avatar
 
Join Date: Jul 2003
Location: Great Northern Wisconsin
Posts: 841
Default Fletcher bods

OK I've got fletcher bods to work almost perfectly the only problem im having is in the material type if it comes up a special material is shows as a type of leather exsample is the bod is for Yew crossbows on gump is says barbved leather any ideas how i might get this to show correct material type? id post the scripts but there is quite alot of scripts i changed to get it to work so a clue would help me post which one to post for help
__________________
To walk among the few of understanding
Admin of Geia Adventures A dead Shard no longer in existsance
joshw is offline   Reply With Quote
Old 01-01-2004, 06:27 PM   #2 (permalink)
Account Terminated
 
Join Date: Sep 2002
Age: 26
Posts: 3,846
Send a message via ICQ to Phantom Send a message via AIM to Phantom Send a message via MSN to Phantom
Default Re: Fletcher bods

Quote:
Originally Posted by joshw
OK I've got fletcher bods to work almost perfectly the only problem im having is in the material type if it comes up a special material is shows as a type of leather exsample is the bod is for Yew crossbows on gump is says barbved leather any ideas how i might get this to show correct material type? id post the scripts but there is quite alot of scripts i changed to get it to work so a clue would help me post which one to post for help
We can't help without the scripts....

So i guess we can't help
Phantom is offline   Reply With Quote
Old 01-01-2004, 06:31 PM   #3 (permalink)
Dream Sage
 
joshw's Avatar
 
Join Date: Jul 2003
Location: Great Northern Wisconsin
Posts: 841
Default

I know but there are like 10 dif scripts i edited to get them to work so i don't want to clutter up sapce with all the scripts but here we go

smallfletchersbod.cs
[code:1]using System;
using System.Collections;
using Server;
using Server.Items;
using Server.Engines.Craft;
using Mat = Server.Engines.BulkOrders.BulkMaterialType;

namespace Server.Engines.BulkOrders
{
[TypeAlias( "Scripts.Engines.BulkOrders.SmallFletcherBOD& quot; )]
public class SmallFletcherBOD : SmallBOD
{
public static double[] m_FletcherMaterialChances = new double[]
{
0.501953125, // None
0.250000000, // Pine
0.125000000, // Walnut
0.062500000, // Maple
0.031250000, // Mahogany
0.015625000, // Ash
0.007812500, // Cedar
0.003906250, // Sycamore
0.001953125, // Cherry
0.001853125 // Yew
};

public int High( Mat mat )
{
return 2 + (3 * (int)mat);
}

public int Low( Mat mat )
{
return 3 * (int)mat;
}

public bool Check( int yew )
{
int ours = ( AmountMax < 20 ? Low( Material ) : High( Material ) );

return ( ours == yew );
}

public bool Check( int min, int max )
{
int ours = ( AmountMax < 20 ? Low( Material ) : High( Material ) );

return ( ours >= min && ours <= max );
}

private bool Check( Mat yew )
{
return ( Material == yew );
}

private bool Check( Mat start, Mat end )
{
return ( Material >= start && Material <= end );
}

public override int ComputeFame()
{
int bonus = 0;

if ( RequireExceptional )
bonus += 20;

if ( Material >= BulkMaterialType.Pine && Material <= BulkMaterialType.Yew )
bonus += 20 * (1 + (int)(Material - BulkMaterialType.Pine));

return 10 + Utility.Random( bonus );
}

public override int ComputeGold()
{
int bonus = 0;

if ( RequireExceptional )
bonus += 500;

if ( Material >= BulkMaterialType.Pine && Material <= BulkMaterialType.Yew )
bonus += 500 * (1 + (int)(Material - BulkMaterialType.Pine));

return 750 + Utility.Random( bonus );
}

public override ArrayList ComputeRewards()
{
if ( Type == null )
return new ArrayList();

bool ps5 = true, ps10 = true, ps15 = false, ps20 = false;
bool rPine = true, rWalnut = true, rMaple = true, rMahogany = true;

if ( Type.IsSubclassOf( typeof( BaseWeapon ) ) )
{
if ( RequireExceptional )
{
rPine = true;
rWalnut = true;
rMaple = true;
rMahogany = true;
}

}
else
{
if ( RequireExceptional )
{
ps5 = Check( High( Mat.Mahogany ), Low( Mat.Ash ) );
ps10 = Check( High( Mat.Ash ), Low( Mat.Cedar ) );
ps15 = Check( High( Mat.Sycamore ), Low( Mat.Cherry ) );
ps20 = Check( High( Mat.Yew ) );
rPine = Check( High( Mat.Walnut ), Low( Mat.Ash ) );
rWalnut = Check( High( Mat.Maple ), Low( Mat.Ash ) );
rMaple = Check( High( Mat.Ash ), Low( Mat.Cedar ) );
rMahogany = Check( High( Mat.Cedar ), High( Mat.Cherry ) );

}
else
{
ps5 = Check( Mat.Cherry );
rPine = Check( Mat.Cedar, Mat.Cherry );
rWalnut = Check( Mat.Sycamore, Mat.Yew );
}
}

ArrayList list = new ArrayList();


if ( ps5 )
list.Add( new PowerScroll( SkillName.Fletching, 105 ) );

if ( ps10 )
list.Add( new PowerScroll( SkillName.Fletching, 110 ) );

if ( ps15 )
list.Add( new PowerScroll( SkillName.Fletching, 115 ) );

if ( ps20 )
list.Add( new PowerScroll( SkillName.Fletching, 120 ) );

if ( rPine )
list.Add( new RunicFletchersTools( CraftResource.Pine, Core.AOS ? 50 : 50 ) );

if ( rWalnut )
list.Add( new RunicFletchersTools( CraftResource.Walnut, Core.AOS ? 45 : 50 ) );

if ( rMaple )
list.Add( new RunicFletchersTools( CraftResource.Maple, Core.AOS ? 40 : 50 ) );

if ( rMahogany )
list.Add( new RunicFletchersTools( CraftResource.Mahogany, Core.AOS ? 35 : 50 ) );

return list;
}

public static SmallFletcherBOD CreateRandomFor( Mobile m )
{
SmallBulkEntry[] entries;
bool useMaterials;

if ( useMaterials = Utility.RandomBool() )
entries = SmallBulkEntry.BowFletchingWeapons;
else
entries = SmallBulkEntry.BowFletchingWeapons;

if ( entries.Length > 0 )
{
double theirSkill = m.Skills[SkillName.Fletching].Base;
int amountMax;

if ( theirSkill >= 70.1 )
amountMax = Utility.RandomList( 10, 15, 20, 20 );
else if ( theirSkill >= 50.1 )
amountMax = Utility.RandomList( 10, 15, 15, 20 );
else
amountMax = Utility.RandomList( 10, 10, 15, 20 );

BulkMaterialType material = BulkMaterialType.None;

if ( useMaterials && theirSkill >= 70.1 )
{
for ( int i = 0; i < 20; ++i )
{
BulkMaterialType check = GetRandomMaterial( BulkMaterialType.Pine, m_FletcherMaterialChances );
double skillReq = 0.0;

switch ( check )
{
case BulkMaterialType.Pine: skillReq = 65.0; break;
case BulkMaterialType.Walnut: skillReq = 70.0; break;
case BulkMaterialType.Maple: skillReq = 75.0; break;
case BulkMaterialType.Mahogany: skillReq = 80.0; break;
case BulkMaterialType.Ash: skillReq = 85.0; break;
case BulkMaterialType.Cedar: skillReq = 90.0; break;
case BulkMaterialType.Sycamore: skillReq = 95.0; break;
case BulkMaterialType.Cherry: skillReq = 100.0; break;
case BulkMaterialType.Yew: skillReq = 110.0; break;
}

if ( theirSkill >= skillReq )
{
material = check;
break;
}
}
}

double excChance = 0.0;

if ( theirSkill >= 70.1 )
excChance = (theirSkill + 80.0) / 200.0;

bool reqExceptional = ( excChance > Utility.RandomDouble() );

SmallBulkEntry entry = null;

CraftSystem system = DefBowFletching.CraftSystem;

for ( int i = 0; i < 150; ++i )
{
SmallBulkEntry check = entries[Utility.Random( entries.Length )];

CraftItem item = system.CraftItems.SearchFor( check.Type );

if ( item != null )
{
bool allRequiredSkills = true;
double chance = item.GetSuccessChance( m, null, system, false, ref allRequiredSkills );

if ( allRequiredSkills && chance >= 0.0 )
{
if ( reqExceptional )
chance = item.GetExceptionalChance( system, chance, m );

if ( chance > 0.0 )
{
entry = check;
break;
}
}
}
}

if ( entry != null )
return new SmallFletcherBOD( entry, material, amountMax, reqExceptional );
}

return null;
}

private SmallFletcherBOD( SmallBulkEntry entry, BulkMaterialType material, int amountMax, bool reqExceptional )
{
this.Hue = 2213;
this.AmountMax = amountMax;
this.Type = entry.Type;
this.Number = entry.Number;
this.Graphic = entry.Graphic;
this.RequireExceptional = reqExceptional;
this.Material = material;
}

[Constructable]
public SmallFletcherBOD()
{
SmallBulkEntry[] entries;
bool useMaterials;

if ( useMaterials = Utility.RandomBool() )
entries = SmallBulkEntry.BowFletchingWeapons;
else
entries = SmallBulkEntry.BowFletchingWeapons;

if ( entries.Length > 0 )
{
int hue = 2213;
int amountMax = Utility.RandomList( 10, 15, 20 );

BulkMaterialType material;

if ( useMaterials )
material = GetRandomMaterial( BulkMaterialType.Pine, m_FletcherMaterialChances );
else
material = BulkMaterialType.None;

bool reqExceptional = Utility.RandomBool() || (material == BulkMaterialType.None);

SmallBulkEntry entry = entries[Utility.Random( entries.Length )];

this.Hue = 2213;
this.AmountMax = amountMax;
this.Type = entry.Type;
this.Number = entry.Number;
this.Graphic = entry.Graphic;
this.RequireExceptional = reqExceptional;
this.Material = material;
}
}

public SmallFletcherBOD( int amountCur, int amountMax, Type type, int number, int graphic, bool reqExceptional, BulkMaterialType mat )
{
this.Hue = 2213;
this.AmountMax = amountMax;
this.AmountCur = amountCur;
this.Type = type;
this.Number = number;
this.Graphic = graphic;
this.RequireExceptional = reqExceptional;
this.Material = mat;
}

public SmallFletcherBOD( 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();
}
}
}[/code:1]
bulkmaterialtype.cs
[code:1]using System;
using Server;
using Server.Items;

namespace Server.Engines.BulkOrders
{
public enum BulkMaterialType
{
None,
DullCopper,
ShadowIron,
Copper,
Bronze,
Gold,
Agapite,
Verite,
Valorite,
Spined,
Horned,
Barbed,
Pine,
Walnut,
Maple,
Mahogany,
Ash,
Cedar,
Sycamore,
Cherry,
Yew
}

public enum BulkGenericType
{
Iron,
Cloth,
Leather,
Wood
}

public class BGTClassifier
{
public static BulkGenericType Classify( BODType deedType, Type itemType )
{
if ( deedType == BODType.Tailor )
{
if ( itemType == null || itemType.IsSubclassOf( typeof( BaseArmor ) ) || itemType.IsSubclassOf( typeof( BaseShoes ) ) )
return BulkGenericType.Leather;

return BulkGenericType.Cloth;
}
else if ( deedType == BODType.Fletcher )
{
if ( itemType == null || itemType.IsSubclassOf( typeof( BaseRanged ) ) )
return BulkGenericType.Wood;

return BulkGenericType.Wood;
}


return BulkGenericType.Iron;
}
}
}[/code:1]
smallbod.cs
[code:1]using System;
using System.Collections;
using Server;
using Server.Items;

namespace Server.Engines.BulkOrders
{
[TypeAlias( "Scripts.Engines.BulkOrders.SmallBOD" )]
public abstract class SmallBOD : Item
{
private int m_AmountCur, m_AmountMax;
private Type m_Type;
private int m_Number;
private int m_Graphic;
private bool m_RequireExceptional;
private BulkMaterialType m_Material;

[CommandProperty( AccessLevel.GameMaster )]
public int AmountCur{ get{ return m_AmountCur; } set{ m_AmountCur = value; InvalidateProperties(); } }

[CommandProperty( AccessLevel.GameMaster )]
public int AmountMax{ get{ return m_AmountMax; } set{ m_AmountMax = value; InvalidateProperties(); } }

[CommandProperty( AccessLevel.GameMaster )]
public Type Type{ get{ return m_Type; } set{ m_Type = value; } }

[CommandProperty( AccessLevel.GameMaster )]
public int Number{ get{ return m_Number; } set{ m_Number = value; InvalidateProperties(); } }

[CommandProperty( AccessLevel.GameMaster )]
public int Graphic{ get{ return m_Graphic; } set{ m_Graphic = value; } }

[CommandProperty( AccessLevel.GameMaster )]
public bool RequireExceptional{ get{ return m_RequireExceptional; } set{ m_RequireExceptional = value; InvalidateProperties(); } }

[CommandProperty( AccessLevel.GameMaster )]
public BulkMaterialType Material{ get{ return m_Material; } set{ m_Material = value; InvalidateProperties(); } }

[CommandProperty( AccessLevel.GameMaster )]
public bool Complete{ get{ return ( m_AmountCur == m_AmountMax ); } }

public override int LabelNumber{ get{ return 1045151; } } // a bulk order deed

[Constructable]
public SmallBOD( int hue, int amountMax, Type type, int number, int graphic, bool requireExeptional, BulkMaterialType material ) : base( Core.AOS ? 0x2258 : 0x14EF )
{
Weight = 1.0;
Hue = hue; // Blacksmith: 0x44E; Tailoring: 0x483; BowFletching: 2213
LootType = LootType.Blessed;

m_AmountMax = amountMax;
m_Type = type;
m_Number = number;
m_Graphic = graphic;
m_RequireExceptional = requireExeptional;
m_Material = material;
}

public SmallBOD() : base( Core.AOS ? 0x2258 : 0x14EF )
{
Weight = 1.0;
LootType = LootType.Blessed;
}

public static BulkMaterialType GetRandomMaterial( BulkMaterialType start, double[] chances )
{
double random = Utility.RandomDouble();

for ( int i = 0; i < chances.Length; ++i )
{
if ( random < chances[i] )
return ( i == 0 ? BulkMaterialType.None : start + (i - 1) );

random -= chances[i];
}

return BulkMaterialType.None;
}

public override void GetProperties( ObjectPropertyList list )
{
base.GetProperties( list );

list.Add( 1060654 ); // small bulk order

if ( m_RequireExceptional )
list.Add( 1045141 ); // All items must be exceptional.

if ( m_Material != BulkMaterialType.None )
list.Add( SmallBODGump.GetMaterialNumberFor( m_Material ) ); // All items must be made with x material.

list.Add( 1060656, m_AmountMax.ToString() ); // amount to make: ~1_yew~
list.Add( 1060658, "#{0}\t{1}", m_Number, m_AmountCur ); // ~1_yew~: ~2_yew~
}

public override void OnDoubleClick( Mobile from )
{
if ( IsChildOf( from.Backpack ) )
from.SendGump( new SmallBODGump( from, this ) );
else
from.SendLocalizedMessage( 1045156 ); // You must have the deed in your backpack to use it.
}

public void BeginCombine( Mobile from )
{
if ( m_AmountCur < m_AmountMax )
from.Target = new SmallBODTarget( this );
else
from.SendLocalizedMessage( 1045166 ); // The maximum amount of requested items have already been combined to this deed.
}

public abstract ArrayList ComputeRewards();
public abstract int ComputeGold();
public abstract int ComputeFame();

public virtual void GetRewards( out Item reward, out int gold, out int fame )
{
reward = null;
gold = ComputeGold();
fame = ComputeFame();

ArrayList rewards = ComputeRewards();

if ( rewards.Count > 0 )
{
reward = (Item)rewards[Utility.Random( rewards.Count )];

for ( int i = 0; i < rewards.Count; ++i )
{
if ( rewards[i] != reward )
((Item)rewards[i]).Delete();
}
}
}

public static BulkMaterialType GetMaterial( CraftResource resource )
{
switch ( resource )
{
case CraftResource.DullCopper: return BulkMaterialType.DullCopper;
case CraftResource.ShadowIron: return BulkMaterialType.ShadowIron;
case CraftResource.Copper: return BulkMaterialType.Copper;
case CraftResource.Bronze: return BulkMaterialType.Bronze;
case CraftResource.Gold: return BulkMaterialType.Gold;
case CraftResource.Agapite: return BulkMaterialType.Agapite;
case CraftResource.Verite: return BulkMaterialType.Verite;
case CraftResource.Valorite: return BulkMaterialType.Valorite;
case CraftResource.SpinedLeather: return BulkMaterialType.Spined;
case CraftResource.HornedLeather: return BulkMaterialType.Horned;
case CraftResource.BarbedLeather: return BulkMaterialType.Barbed;
case CraftResource.Pine: return BulkMaterialType.Pine;
case CraftResource.Walnut: return BulkMaterialType.Walnut;
case CraftResource.Maple: return BulkMaterialType.Maple;
case CraftResource.Mahogany: return BulkMaterialType.Mahogany;
case CraftResource.Ash: return BulkMaterialType.Ash;
case CraftResource.Cedar: return BulkMaterialType.Cedar;
case CraftResource.Sycamore: return BulkMaterialType.Sycamore;
case CraftResource.Cherry: return BulkMaterialType.Cherry;
case CraftResource.Yew: return BulkMaterialType.Yew;
}

return BulkMaterialType.None;
}

public void EndCombine( Mobile from, object o )
{
if ( o is Item && ((Item)o).IsChildOf( from.Backpack ) )
{
Type objectType = o.GetType();

if ( m_AmountCur >= m_AmountMax )
{
from.SendLocalizedMessage( 1045166 ); // The maximum amount of requested items have already been combined to this deed.
}
else if ( m_Type == null || (objectType != m_Type && !objectType.IsSubclassOf( m_Type )) || (!(o is BaseWeapon) && !(o is BaseArmor) && !(o is BaseClothing)) )
{
from.SendLocalizedMessage( 1045169 ); // The item is not in the request.
}
else
{
BulkMaterialType material = BulkMaterialType.None;

if ( o is BaseArmor )
material = GetMaterial( ((BaseArmor)o).Resource );
else if ( o is BaseShoes )
material = GetMaterial( ((BaseShoes)o).Resource );

if ( m_Material >= BulkMaterialType.DullCopper && m_Material <= BulkMaterialType.Valorite && material != m_Material )
{
from.SendLocalizedMessage( 1045168 ); // The item is not made from the requested ore.
}
else if ( m_Material >= BulkMaterialType.Spined && m_Material <= BulkMaterialType.Barbed && material != m_Material )
{
from.SendLocalizedMessage( 1049352 ); // The item is not made from the requested leather type.
}
else if ( m_Material >= BulkMaterialType.Pine && m_Material <= BulkMaterialType.Yew && material != m_Material )
{
from.SendLocalizedMessage( 1049352 ); // The item is not made from the requested wood type.
}
else
{
bool isExceptional = false;

if ( o is BaseWeapon )
isExceptional = ( ((BaseWeapon)o).Quality == WeaponQuality.Exceptional );
else if ( o is BaseArmor )
isExceptional = ( ((BaseArmor)o).Quality == ArmorQuality.Exceptional );
else if ( o is BaseClothing )
isExceptional = ( ((BaseClothing)o).Quality == ClothingQuality.Exceptional );

if ( m_RequireExceptional && !isExceptional )
{
from.SendLocalizedMessage( 1045167 ); // The item must be exceptional.
}
else
{
((Item)o).Delete();
++AmountCur;

from.SendLocalizedMessage( 1045170 ); // The item has been combined with the deed.

from.SendGump( new SmallBODGump( from, this ) );

if ( m_AmountCur < m_AmountMax )
BeginCombine( from );
}
}
}
}
else
{
from.SendLocalizedMessage( 1045158 ); // You must have the item in your backpack to target it.
}
}

public SmallBOD( Serial serial ) : base( serial )
{
}

public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );

writer.Write( (int) 0 ); // version

writer.Write( m_AmountCur );
writer.Write( m_AmountMax );
writer.Write( m_Type == null ? null : m_Type.FullName );
writer.Write( m_Number );
writer.Write( m_Graphic );
writer.Write( m_RequireExceptional );
writer.Write( (int) m_Material );
}

public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );

int version = reader.ReadInt();

switch ( version )
{
case 0:
{
m_AmountCur = reader.ReadInt();
m_AmountMax = reader.ReadInt();

string type = reader.ReadString();

if ( type != null )
m_Type = ScriptCompiler.FindTypeByFullName( type );

m_Number = reader.ReadInt();
m_Graphic = reader.ReadInt();
m_RequireExceptional = reader.ReadBool();
m_Material = (BulkMaterialType)reader.ReadInt();

break;
}
}

if ( Weight == 0.0 )
Weight = 1.0;

if ( Core.AOS && ItemID == 0x14EF )
ItemID = 0x2258;

if ( Parent == null && Map == Map.Internal && Location == Point3D.Zero )
Delete();
}
}
}[/code:1]
smallbodentry.cs
[code:1]using System;
using System.IO;
using System.Collections;
using Server;

namespace Server.Engines.BulkOrders
{
public class SmallBulkEntry
{
private Type m_Type;
private int m_Number;
private int m_Graphic;

public Type Type{ get{ return m_Type; } }
public int Number{ get{ return m_Number; } }
public int Graphic{ get{ return m_Graphic; } }

public SmallBulkEntry( Type type, int number, int graphic )
{
m_Type = type;
m_Number = number;
m_Graphic = graphic;
}

public static SmallBulkEntry[] BlacksmithWeapons
{
get{ return GetEntries( "Blacksmith", "weapons" ); }
}

public static SmallBulkEntry[] BlacksmithArmor
{
get{ return GetEntries( "Blacksmith", "armor" ); }
}

public static SmallBulkEntry[] TailorCloth
{
get{ return GetEntries( "Tailoring", "cloth" ); }
}

public static SmallBulkEntry[] TailorLeather
{
get{ return GetEntries( "Tailoring", "leather" ); }
}

public static SmallBulkEntry[] BowFletchingWeapons
{
get{ return GetEntries( "Fletcher", "bows" ); }
}

private static Hashtable m_Cache;

public static SmallBulkEntry[] GetEntries( string type, string name )
{
if ( m_Cache == null )
m_Cache = new Hashtable();

Hashtable table = (Hashtable)m_Cache[type];

if ( table == null )
m_Cache[type] = table = new Hashtable();

SmallBulkEntry[] entries = (SmallBulkEntry[])table[name];

if ( entries == null )
table[name] = entries = LoadEntries( type, name );

return entries;
}

public static SmallBulkEntry[] LoadEntries( string type, string name )
{
return LoadEntries( String.Format( "Data/Bulk Orders/{0}/{1}.cfg", type, name ) );
}

public static SmallBulkEntry[] LoadEntries( string path )
{
path = Path.Combine( Core.BaseDirectory, path );

ArrayList list = new ArrayList();

if ( File.Exists( path ) )
{
using ( StreamReader ip = new StreamReader( path ) )
{
string line;

while ( (line = ip.ReadLine()) != null )
{
if ( line.Length == 0 || line.StartsWith( "#" ) )
continue;

try
{
string[] split = line.Split( '\t' );

if ( split.Length >= 2 )
{
Type type = ScriptCompiler.FindTypeByName( split[0] );
int graphic = Utility.ToInt32( split[split.Length - 1] );

if ( type != null && graphic > 0 )
list.Add( new SmallBulkEntry( type, 1020000 + graphic, graphic ) );
}
}
catch
{
}
}
}
}

return (SmallBulkEntry[])list.ToArray( typeof( SmallBulkEntry ) );
}
}
}[/code:1]
I have all the right info and created the correct cfg files for the system don't think i need to post them
__________________
To walk among the few of understanding
Admin of Geia Adventures A dead Shard no longer in existsance
joshw is offline   Reply With Quote
Old 01-01-2004, 06:34 PM   #4 (permalink)
Account Terminated
 
Join Date: Sep 2002
Age: 26
Posts: 3,846
Send a message via ICQ to Phantom Send a message via AIM to Phantom Send a message via MSN to Phantom
Default

So where is the gump?

Thats where the error is
Phantom is offline   Reply With Quote
Old 01-01-2004, 06:37 PM   #5 (permalink)
Dream Sage
 
joshw's Avatar
 
Join Date: Jul 2003
Location: Great Northern Wisconsin
Posts: 841
Default

Ahhh ok one of them damn int to string deals lol god i hate them lol here it is
smallbodgump.cs
[code:1]using System;
using Server;
using Server.Gumps;
using Server.Network;

namespace Server.Engines.BulkOrders
{
public class SmallBODGump : Gump
{
private SmallBOD m_Deed;
private Mobile m_From;

public SmallBODGump( Mobile from, SmallBOD deed ) : base( 25, 25 )
{
m_From = from;
m_Deed = deed;

m_From.CloseGump( typeof( LargeBODGump ) );
m_From.CloseGump( typeof( SmallBODGump ) );

AddPage( 0 );

AddBackground( 50, 10, 455, 260, 5054 );
AddImageTiled( 58, 20, 438, 241, 2624 );
AddAlphaRegion( 58, 20, 438, 241 );

AddImage( 45, 5, 10460 );
AddImage( 480, 5, 10460 );
AddImage( 45, 245, 10460 );
AddImage( 480, 245, 10460 );

AddHtmlLocalized( 225, 25, 120, 20, 1045133, 0x7FFF, false, false ); // A bulk order

AddHtmlLocalized( 75, 48, 250, 20, 1045138, 0x7FFF, false, false ); // Amount to make:
AddLabel( 275, 48, 1152, deed.AmountMax.ToString() );

AddHtmlLocalized( 275, 76, 200, 20, 1045153, 0x7FFF, false, false ); // Amount finished:
AddHtmlLocalized( 75, 72, 120, 20, 1045136, 0x7FFF, false, false ); // Item requested:

AddItem( 410, 72, deed.Graphic );

AddHtmlLocalized( 75, 96, 210, 20, deed.Number, 0x7FFF, false, false );
AddLabel( 275, 96, 0x480, deed.AmountCur.ToString() );

if ( deed.RequireExceptional || deed.Material != BulkMaterialType.None )
AddHtmlLocalized( 75, 120, 200, 20, 1045140, 0x7FFF, false, false ); // Special requirements to meet:

if ( deed.RequireExceptional )
AddHtmlLocalized( 75, 144, 300, 20, 1045141, 0x7FFF, false, false ); // All items must be exceptional.

if ( deed.Material != BulkMaterialType.None )
AddHtmlLocalized( 75, deed.RequireExceptional ? 168 : 144, 300, 20, GetMaterialNumberFor( deed.Material ), 0x7FFF, false, false ); // All items must be made with x material.

AddButton( 125, 192, 4005, 4007, 2, GumpButtonType.Reply, 0 );
AddHtmlLocalized( 160, 192, 300, 20, 1045154, 0x7FFF, false, false ); // Combine this deed with the item requested.

AddButton( 125, 216, 4005, 4007, 1, GumpButtonType.Reply, 0 );
AddHtmlLocalized( 160, 216, 120, 20, 1011441, 0x7FFF, false, false ); // EXIT
}

public override void OnResponse( NetState sender, RelayInfo info )
{
if ( m_Deed.Deleted || !m_Deed.IsChildOf( m_From.Backpack ) )
return;

if ( info.ButtonID == 2 ) // Combine
{
m_From.SendGump( new SmallBODGump( m_From, m_Deed ) );
m_Deed.BeginCombine( m_From );
}
}

public static int GetMaterialNumberFor( BulkMaterialType material )
{
if ( material >= BulkMaterialType.DullCopper && material <= BulkMaterialType.Valorite )
return 1045142 + (int)(material - BulkMaterialType.DullCopper);
else if ( material >= BulkMaterialType.Spined && material <= BulkMaterialType.Barbed )
return 1049348 + (int)(material - BulkMaterialType.Spined);
else if ( material >= BulkMaterialType.Pine && material <= BulkMaterialType.Yew )
return 1049348 + (int)(material - BulkMaterialType.Pine);

return 0;
}
}
}[/code:1]
__________________
To walk among the few of understanding
Admin of Geia Adventures A dead Shard no longer in existsance
joshw is offline   Reply With Quote
Old 01-01-2004, 06:38 PM   #6 (permalink)
Account Terminated
 
Join Date: Sep 2002
Age: 26
Posts: 3,846
Send a message via ICQ to Phantom Send a message via AIM to Phantom Send a message via MSN to Phantom
Default

[code:1]else if ( material >= BulkMaterialType.Pine && material <= BulkMaterialType.Yew )
return 1049348 + (int)(material - BulkMaterialType.Pine); [/code:1]

Phantom is offline   Reply With Quote
Old 01-01-2004, 06:43 PM   #7 (permalink)
Dream Sage
 
joshw's Avatar
 
Join Date: Jul 2003
Location: Great Northern Wisconsin
Posts: 841
Default

ok if i do this im hoping it will work lol i doubt it int to string ive always had a problem with lol

[code:1]else if ( material >= BulkMaterialType.Pine && material <= BulkMaterialType.Yew )
return "all items must be made with pine" + (string)(material - BulkMaterialType.Pine);[/code:1]
__________________
To walk among the few of understanding
Admin of Geia Adventures A dead Shard no longer in existsance
joshw is offline   Reply With Quote
Old 01-01-2004, 06:46 PM   #8 (permalink)
Account Terminated
 
Join Date: Sep 2002
Age: 26
Posts: 3,846
Send a message via ICQ to Phantom Send a message via AIM to Phantom Send a message via MSN to Phantom
Default

Quote:
Originally Posted by joshw
ok if i do this im hoping it will work lol i doubt it int to string ive always had a problem with lol

[code:1]else if ( material >= BulkMaterialType.Pine && material <= BulkMaterialType.Yew )
return "all items must be made with pine" + (string)(material - BulkMaterialType.Pine);[/code:1]
Try changing the enum value to a string, right now its an int plus that code wouldn't even compile

<sigh> You don't debug scripts very well do ya.
Phantom is offline   Reply With Quote
Old 01-01-2004, 06:48 PM   #9 (permalink)
Dream Sage
 
joshw's Avatar
 
Join Date: Jul 2003
Location: Great Northern Wisconsin
Posts: 841
Default

Im not that great at it no but im learning lol and ythanks got me on the right track
__________________
To walk among the few of understanding
Admin of Geia Adventures A dead Shard no longer in existsance
joshw is offline   Reply With Quote
Old 01-01-2004, 09:28 PM   #10 (permalink)
Dream Sage
 
joshw's Avatar
 
Join Date: Jul 2003
Location: Great Northern Wisconsin
Posts: 841
Default

now when you say
Quote:
Phantom Posted: Thu Jan 01, 2004 9:46 pm Post subject:

--------------------------------------------------------------------------------

joshw wrote:
ok if i do this im hoping it will work lol i doubt it int to string ive always had a problem with lol

Code:
else if ( material >= BulkMaterialType.Pine && material <= BulkMaterialType.Yew )
return "all items must be made with pine" + (string)(material - BulkMaterialType.Pine);



Try changing the enum value to a string, right now its an int plus that code wouldn't even compile
do you mean in bulkmaterial.cs

[code:1]public enum BulkMaterialType
{
None,
DullCopper,
ShadowIron,
Copper,
Bronze,
Gold,
Agapite,
Verite,
Valorite,
Spined,
Horned,
Barbed,
Pine,
Walnut,
Maple,
Mahogany,
Ash,
Cedar,
Sycamore,
Cherry,
Yew
}[/code:1]
__________________
To walk among the few of understanding
Admin of Geia Adventures A dead Shard no longer in existsance
joshw is offline   Reply With Quote
Old 01-01-2004, 09:32 PM   #11 (permalink)
Account Terminated
 
Join Date: Sep 2002
Age: 26
Posts: 3,846
Send a message via ICQ to Phantom Send a message via AIM to Phantom Send a message via MSN to Phantom
Default

Yeah but I mean use ToString() to convert the numerical enum value to a string.

By default enums are read as an int, but the string unless you make them equal to a different int can be display as a text.
Phantom is offline   Reply With Quote
Old 01-02-2004, 04:40 AM   #12 (permalink)
Dream Sage
 
joshw's Avatar
 
Join Date: Jul 2003
Location: Great Northern Wisconsin
Posts: 841
Default

grrrrrrrrr this is driving me nuts is there any script that is some what thats shows what your suggesting so i can see as an exsample?
__________________
To walk among the few of understanding
Admin of Geia Adventures A dead Shard no longer in existsance
joshw is offline   Reply With Quote
Old 01-25-2004, 06:12 PM   #13 (permalink)
Dream Sage
 
joshw's Avatar
 
Join Date: Jul 2003
Location: Great Northern Wisconsin
Posts: 841
Default

ok I've been working on this forever and still can't get it to work i can get the material type to display on bod but in bothe the smallbod accept gump and the smallbod gump i can't seem to get it to show custom wood materials

smallbodgump.cs
[code:1]using System;
using Server;
using Server.Gumps;
using Server.Network;

namespace Server.Engines.BulkOrders
{
public class SmallBODGump : Gump
{
private SmallBOD m_Deed;
private Mobile m_From;

public SmallBODGump( Mobile from, SmallBOD deed ) : base( 25, 25 )
{
m_From = from;
m_Deed = deed;

m_From.CloseGump( typeof( LargeBODGump ) );
m_From.CloseGump( typeof( SmallBODGump ) );

AddPage( 0 );

AddBackground( 50, 10, 455, 260, 5054 );
AddImageTiled( 58, 20, 438, 241, 2624 );
AddAlphaRegion( 58, 20, 438, 241 );

AddImage( 45, 5, 10460 );
AddImage( 480, 5, 10460 );
AddImage( 45, 245, 10460 );
AddImage( 480, 245, 10460 );

AddHtmlLocalized( 225, 25, 120, 20, 1045133, 0x7FFF, false, false ); // A bulk order

AddHtmlLocalized( 75, 48, 250, 20, 1045138, 0x7FFF, false, false ); // Amount to make:
AddLabel( 275, 48, 1152, deed.AmountMax.ToString() );

AddHtmlLocalized( 275, 76, 200, 20, 1045153, 0x7FFF, false, false ); // Amount finished:
AddHtmlLocalized( 75, 72, 120, 20, 1045136, 0x7FFF, false, false ); // Item requested:

AddItem( 410, 72, deed.Graphic );

AddHtmlLocalized( 75, 96, 210, 20, deed.Number, 0x7FFF, false, false );
AddLabel( 275, 96, 0x480, deed.AmountCur.ToString() );

if ( deed.RequireExceptional || deed.Material != BulkMaterialType.None )
AddHtmlLocalized( 75, 120, 200, 20, 1045140, 0x7FFF, false, false ); // Special requirements to meet:

if ( deed.RequireExceptional )
AddHtmlLocalized( 75, 144, 300, 20, 1045141, 0x7FFF, false, false ); // All items must be exceptional.

if ( deed.Material != BulkMaterialType.None )
AddHtmlLocalized( 75, deed.RequireExceptional ? 168 : 144, 300, 20, GetMaterialNumberFor( deed.Material ), 0x7FFF, false, false ); // All items must be made with x material.
else switch ((int)deed.Material)
{
case 1: AddHtml( 75, 144, 300, 20, "All itens must be done with Pine", true, false ); break;
case 2: AddHtml( 75, 144, 300, 20, "All itens must be done with Walnut", true, false ); break;
case 3: AddHtml( 75, 144, 300, 20, "All itens must be done with Maple", true, false ); break;
case 4: AddHtml( 75, 144, 300, 20, "All itens must be done with Mahogany", true, false ); break;
case 5: AddHtml( 75, 144, 300, 20, "All itens must be done with Ash", true, false ); break;
case 6: AddHtml( 75, 144, 300, 20, "All itens must be done with Cedar", true, false ); break;
case 7: AddHtml( 75, 144, 300, 20, "All itens must be done with Sycamore", true, false ); break;
case 8: AddHtml( 75, 144, 300, 20, "All itens must be done with Cherry", true, false ); break;
case 9: AddHtml( 75, 144, 300, 20, "All itens must be done with Yew", true, false ); break;
}


AddButton( 125, 192, 4005, 4007, 2, GumpButtonType.Reply, 0 );
AddHtmlLocalized( 160, 192, 300, 20, 1045154, 0x7FFF, false, false ); // Combine this deed with the item requested.

AddButton( 125, 216, 4005, 4007, 1, GumpButtonType.Reply, 0 );
AddHtmlLocalized( 160, 216, 120, 20, 1011441, 0x7FFF, false, false ); // EXIT
}

public override void OnResponse( NetState sender, RelayInfo info )
{
if ( m_Deed.Deleted || !m_Deed.IsChildOf( m_From.Backpack ) )
return;

if ( info.ButtonID == 2 ) // Combine
{
m_From.SendGump( new SmallBODGump( m_From, m_Deed ) );
m_Deed.BeginCombine( m_From );
}
}

public static int GetMaterialNumberFor( BulkMaterialType material )
{
if ( material >= BulkMaterialType.DullCopper && material <= BulkMaterialType.Valorite )
return 1045142 + (int)(material - BulkMaterialType.DullCopper);
else if ( material >= BulkMaterialType.Spined && material <= BulkMaterialType.Barbed )
return 1049348 + (int)(material - BulkMaterialType.Spined);
else if ( material >= BulkMaterialType.Pine && material <= BulkMaterialType.Yew )
return 1049348 + (int)(material - BulkMaterialType.Pine);

return 0;
}
}
}[/code:1]

smallbodacceptgump.cs
[code:1]using System;
using Server;
using Server.Gumps;
using Server.Network;

namespace Server.Engines.BulkOrders
{
public class SmallBODAcceptGump : Gump
{
private SmallBOD m_Deed;
private Mobile m_From;

public SmallBODAcceptGump( Mobile from, SmallBOD deed ) : base( 50, 50 )
{
m_From = from;
m_Deed = deed;

m_From.CloseGump( typeof( LargeBODAcceptGump ) );
m_From.CloseGump( typeof( SmallBODAcceptGump ) );

AddPage( 0 );

AddBackground( 25, 10, 430, 264, 5054 );

AddImageTiled( 33, 20, 413, 245, 2624 );
AddAlphaRegion( 33, 20, 413, 245 );

AddImage( 20, 5, 10460 );
AddImage( 430, 5, 10460 );
AddImage( 20, 249, 10460 );
AddImage( 430, 249, 10460 );

AddHtmlLocalized( 190, 25, 120, 20, 1045133, 0x7FFF, false, false ); // A bulk order
AddHtmlLocalized( 40, 48, 350, 20, 1045135, 0x7FFF, false, false ); // Ah! Thanks for the goods! Would you help me out?

AddHtmlLocalized( 40, 72, 210, 20, 1045138, 0x7FFF, false, false ); // Amount to make:
AddLabel( 250, 72, 1152, deed.AmountMax.ToString() );

AddHtmlLocalized( 40, 96, 120, 20, 1045136, 0x7FFF, false, false ); // Item requested:
AddItem( 385, 96, deed.Graphic );
AddHtmlLocalized( 40, 120, 210, 20, deed.Number, 0xFFFFFF, false, false );

if ( deed.RequireExceptional || deed.Material != BulkMaterialType.None )
{
AddHtmlLocalized( 40, 144, 210, 20, 1045140, 0x7FFF, false, false ); // Special requirements to meet:

if ( deed.RequireExceptional )
AddHtmlLocalized( 40, 168, 350, 20, 1045141, 0x7FFF, false, false ); // All items must be exceptional.

if ( deed.Material != BulkMaterialType.None )
AddHtmlLocalized( 40, deed.RequireExceptional ? 192 : 168, 350, 20, GetMaterialNumberFor( deed.Material ), 0x7FFF, false, false ); // All items must be made with x material.
}

AddHtmlLocalized( 40, 216, 350, 20, 1045139, 0x7FFF, false, false ); // Do you want to accept this order?

AddButton( 100, 240, 4005, 4007, 1, GumpButtonType.Reply, 0 );
AddHtmlLocalized( 135, 240, 120, 20, 1006044, 0x7FFF, false, false ); // Ok

AddButton( 275, 240, 4005, 4007, 0, GumpButtonType.Reply, 0 );
AddHtmlLocalized( 310, 240, 120, 20, 1011012, 0x7FFF, false, false ); // CANCEL
}

public override void OnResponse( NetState sender, RelayInfo info )
{
if ( info.ButtonID == 1 ) // Ok
{
if ( m_From.PlaceInBackpack( m_Deed ) )
{
m_From.SendLocalizedMessage( 1045152 ); // The bulk order deed has been placed in your backpack.
}
else
{
m_From.SendLocalizedMessage( 1045150 ); // There is not enough room in your backpack for the deed.
m_Deed.Delete();
}
}
else
{
m_Deed.Delete();
}
}

public static int GetMaterialNumberFor( BulkMaterialType material )
{
if ( material >= BulkMaterialType.DullCopper && material <= BulkMaterialType.Valorite )
return 1045142 + (int)(material - BulkMaterialType.DullCopper);
else if ( material >= BulkMaterialType.Spined && material <= BulkMaterialType.Barbed )
return 1049348 + (int)(material - BulkMaterialType.Spined);

return 0;
}
}
}[/code:1]
__________________
To walk among the few of understanding
Admin of Geia Adventures A dead Shard no longer in existsance
joshw is offline   Reply With Quote
Old 02-11-2004, 03:22 AM   #14 (permalink)
Forum Expert
 
Join Date: Oct 2002
Location: Germany (american though)
Age: 33
Posts: 957
Default

try this

smallbodgump.cs

[code:1]using System;
using Server;
using Server.Gumps;
using Server.Network;

namespace Server.Engines.BulkOrders
{
public class SmallBODGump : Gump
{
private SmallBOD m_Deed;
private Mobile m_From;

public SmallBODGump( Mobile from, SmallBOD deed ) : base( 25, 25 )
{
m_From = from;
m_Deed = deed;

m_From.CloseGump( typeof( LargeBODGump ) );
m_From.CloseGump( typeof( SmallBODGump ) );

AddPage( 0 );

AddBackground( 50, 10, 455, 260, 5054 );
AddImageTiled( 58, 20, 438, 241, 2624 );
AddAlphaRegion( 58, 20, 438, 241 );

AddImage( 45, 5, 10460 );
AddImage( 480, 5, 10460 );
AddImage( 45, 245, 10460 );
AddImage( 480, 245, 10460 );

AddHtmlLocalized( 225, 25, 120, 20, 1045133, 0x7FFF, false, false ); // A bulk order

AddHtmlLocalized( 75, 48, 250, 20, 1045138, 0x7FFF, false, false ); // Amount to make:
AddLabel( 275, 48, 1152, deed.AmountMax.ToString() );

AddHtmlLocalized( 275, 76, 200, 20, 1045153, 0x7FFF, false, false ); // Amount finished:
AddHtmlLocalized( 75, 72, 120, 20, 1045136, 0x7FFF, false, false ); // Item requested:

AddItem( 410, 72, deed.Graphic );

AddHtmlLocalized( 75, 96, 210, 20, deed.Number, 0x7FFF, false, false );
AddLabel( 275, 96, 0x480, deed.AmountCur.ToString() );

if ( deed.RequireExceptional || deed.Material != BulkMaterialType.None )
AddHtmlLocalized( 75, 120, 200, 20, 1045140, 0x7FFF, false, false ); // Special requirements to meet:

if ( deed.RequireExceptional )
AddHtmlLocalized( 75, 144, 300, 20, 1045141, 0x7FFF, false, false ); // All items must be exceptional.

if ( deed.Material != BulkMaterialType.None )
if ( deed.Material != BulkMaterialType.None )
AddHtml( 75, deed.RequireExceptional ? 168 : 144, 300, 20, String.Format( "<basefont color=#FFFFFF>{0}</basefont>", getMaterialName(deed.Material) ), false, false );
//AddHtmlLocalized( 75, deed.RequireExceptional ? 168 : 144, 300, 20, GetMaterialNumberFor( deed.Material ), 0x7FFF, false, false ); // All items must be made with x material.


AddButton( 125, 192, 4005, 4007, 2, GumpButtonType.Reply, 0 );
AddHtmlLocalized( 160, 192, 300, 20, 1045154, 0x7FFF, false, false ); // Combine this deed with the item requested.

AddButton( 125, 216, 4005, 4007, 1, GumpButtonType.Reply, 0 );
AddHtmlLocalized( 160, 216, 120, 20, 1011441, 0x7FFF, false, false ); // EXIT
}

public static string getMaterialName( BulkMaterialType material )
{
if( material == BulkMaterialType.DullCopper )
return "All items must be made with dull copper ingots";
else if( material == BulkMaterialType.ShadowIron )
return "All items must be made with shadow iron ingots";
else if( material == BulkMaterialType.Copper )
return "All items must be made with copper ingots";
else if( material == BulkMaterialType.Bronze )
return "All items must be made with bronze ingots";
else if( material == BulkMaterialType.Gold )
return "All items must be made with gold ingots";
else if( material == BulkMaterialType.Agapite )
return "All items must be made with agapite ingots";
else if( material == BulkMaterialType.Verite )
return "All items must be made with verite ingots";
else if( material == BulkMaterialType.Valorite )
return "All items must be made with valorite ingots";
else if( material == BulkMaterialType.Spined)
return "All items must be made with spined leather";
else if( material == BulkMaterialType.Horned)
return "All items must be made with horned leather";
else if( material == BulkMaterialType.Barbed)
return "All items must be made with barbed leather";
return "default";
}

public override void OnResponse( NetState sender, RelayInfo info )
{
if ( m_Deed.Deleted || !m_Deed.IsChildOf( m_From.Backpack ) )
return;

if ( info.ButtonID == 2 ) // Combine
{
m_From.SendGump( new SmallBODGump( m_From, m_Deed ) );
m_Deed.BeginCombine( m_From );
}
}

public static int GetMaterialNumberFor( BulkMaterialType material )
{
if ( material >= BulkMaterialType.DullCopper && material <= BulkMaterialType.Valorite )
return 1045142 + (int)(material - BulkMaterialType.DullCopper);
else if ( material >= BulkMaterialType.Spined && material <= BulkMaterialType.Barbed )
return 1049348 + (int)(material - BulkMaterialType.Spined);

return 0;
}
}
}[/code:1]
also add this above the same type of routine shown above in SmallBOD.cs:

[code:1]public override void GetProperties( ObjectPropertyList list )
{
base.GetProperties( list );

list.Add( 1060654 ); // small bulk order

if ( m_RequireExceptional )
list.Add( 1045141 ); // All items must be exceptional.

if ( m_Material != BulkMaterialType.None )
//list.Add( SmallBODGump.GetMaterialNumberFor( m_Material ) ); // All items must be made with x material.
list.Add( getMaterialName(m_Material) ); // All items must be made with x material.

list.Add( 1060656, m_AmountMax.ToString() ); // amount to make: ~1_val~
list.Add( 1060658, "#{0}\t{1}", m_Number, m_AmountCur ); // ~1_val~: ~2_val~
}[/code:1]

also you might want to use this in the SmallBOD.cs:

[code:1] else if ( m_Material >= BulkMaterialType.Pine && m_Material <= BulkMaterialType.Yew && material != m_Material )
{
from.SendMessage( "The item is not made from the requested wood type. ");
} [/code:1]
Jarrod is offline   Reply With Quote
Old 02-11-2004, 04:03 AM   #15 (permalink)
Forum Expert
 
Join Date: Oct 2002
Location: Germany (american though)
Age: 33
Posts: 957
Default

i could use a little help in the bobgump.cs

i cant figure out how to get the Fletching Bods in where that case starts

[code:1]using System;
using System.Collections;
using Server;
using Server.Gumps;
using Server.Items;
using Server.Mobiles;
using Server.Prompts;

namespace Server.Engines.BulkOrders
{