|
||
|
|||||||
| Custom Script Release Archive This is a pre-script database archive of what our users had released. |
|
|
Thread Tools | Display Modes |
|
|
#1 (permalink) |
|
Forum Expert
Join Date: Feb 2004
Age: 27
Posts: 1,834
|
If anyone sees anything, that is not OSI style report it, give me proof and I will correct it (or remove the OSI style in the title, hehe).
This will work, if you merge correctly with daat's ores too - I commented, where the changes are. Basically it randomizes the oresize, which you find and depending on the ore's size you get ingots from smelting. Big pile 2, smell piles 1 and mini pile 1/2. I have commented out the part for "combine ore", since I am not sure, how it is supposed to work, but at least it shouldn't crash your shard, hehe. Code:
using System;
using Server.Items;
using Server.Network;
using Server.Targeting;
using Server.Engines.Craft;
using Server.Engines.Harvest;
// Combine Ore Start
using Server.Mobiles;
// Combine Ore End
namespace Server.Items
{
public abstract class BaseOre : Item, ICommodity
{
private CraftResource m_Resource;
[CommandProperty( AccessLevel.GameMaster )]
public CraftResource Resource
{
get{ return m_Resource; }
set{ m_Resource = value; InvalidateProperties(); }
}
string ICommodity.Description
{
get
{
return String.Format( "{0} {1} ore", Amount, CraftResources.GetName( m_Resource ).ToLower() );
}
}
public abstract BaseIngot GetIngot();
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 1 ); // version
writer.Write( (int) m_Resource );
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
switch ( version )
{
case 1:
{
m_Resource = (CraftResource)reader.ReadInt();
break;
}
case 0:
{
OreInfo info;
switch ( reader.ReadInt() )
{
case 0: info = OreInfo.Iron; break;
case 1: info = OreInfo.DullCopper; break;
case 2: info = OreInfo.ShadowIron; break;
case 3: info = OreInfo.Copper; break;
case 4: info = OreInfo.Bronze; break;
case 5: info = OreInfo.Gold; break;
case 6: info = OreInfo.Agapite; break;
case 7: info = OreInfo.Verite; break;
case 8: info = OreInfo.Valorite; break;
default: info = null; break;
}
m_Resource = CraftResources.GetFromOreInfo( info );
break;
}
}
}
public BaseOre( CraftResource resource ) : this( resource, 1 )
{
}
// Sized Ore changed next line - Need some input, if I should change Mining, to have skill influence orepilesize.
public BaseOre( CraftResource resource, int amount ) : base( Utility.RandomList(0x19B7, 0x19B8, 0x19B9, 0x19BA) )
{
Stackable = true;
// Sized Ore removed next line
// Weight = 12.0;
// Sized Ore Start
Weight = 7.0;
if ( ItemID == 0x19B7 )
Weight = 2.0;
else if ( ItemID == 0x19B9 )
Weight = 12.0;
// Sized Ore End
Amount = amount;
Hue = CraftResources.GetHue( resource );
m_Resource = resource;
}
public BaseOre( Serial serial ) : base( serial )
{
}
public override void AddNameProperty( ObjectPropertyList list )
{
if ( Amount > 1 )
list.Add( 1050039, "{0}\t#{1}", Amount, 1026583 ); // ~1_NUMBER~ ~2_ITEMNAME~
else
list.Add( 1026583 ); // ore
}
public override void GetProperties( ObjectPropertyList list )
{
base.GetProperties( list );
if ( !CraftResources.IsStandard( m_Resource ) )
{
int num = CraftResources.GetLocalizationNumber( m_Resource );
if ( num > 0 )
list.Add( num );
else
list.Add( CraftResources.GetName( m_Resource ) );
}
}
public override int LabelNumber
{
get
{
if ( m_Resource >= CraftResource.DullCopper && m_Resource <= CraftResource.Valorite )
return 1042845 + (int)(m_Resource - CraftResource.DullCopper);
return 1042853; // iron ore;
}
}
public override void OnDoubleClick( Mobile from )
{
if ( !Movable )
return;
if ( from.InRange( this.GetWorldLocation(), 2 ) )
{
from.SendLocalizedMessage( 501971 ); // Select the forge on which to smelt the ore, or another pile of ore with which to combine it.
from.Target = new InternalTarget( this );
}
else
{
from.SendLocalizedMessage( 501976 ); // The ore is too far away.
}
}
private class InternalTarget : Target
{
private BaseOre m_Ore;
public InternalTarget( BaseOre ore ) : base ( 2, false, TargetFlags.None )
{
m_Ore = ore;
}
private bool IsForge( object obj )
{
if ( obj.GetType().IsDefined( typeof( ForgeAttribute ), false ) )
return true;
int itemID = 0;
if ( obj is Item )
itemID = ((Item)obj).ItemID;
else if ( obj is StaticTarget )
itemID = ((StaticTarget)obj).ItemID & 0x3FFF;
return ( itemID == 4017 || (itemID >= 6522 && itemID <= 6569) );
}
protected override void OnTarget( Mobile from, object targeted )
{
if ( m_Ore.Deleted )
return;
if ( !from.InRange( m_Ore.GetWorldLocation(), 2 ) )
{
from.SendLocalizedMessage( 501976 ); // The ore is too far away.
return;
}
// Combine Ore Start
if ( targeted is BaseOre )
{
BaseOre ore = (BaseOre)targeted;
if ( !ore.Movable )
return;
object root = ore.RootParent;
if ( root is BaseCreature ? !(((BaseCreature)root).Controled && ((BaseCreature)root).ControlMaster == from) : !(root == from || !( root is Mobile )) )
return;
else if ( m_Ore == ore )
{
from.SendLocalizedMessage( 501972 ); // Select another pile or ore with which to combine this.
from.Target = new InternalTarget( ore );
return;
}
else if ( ore.Resource != m_Ore.Resource )
{
from.SendLocalizedMessage( 501979 ); // You cannot combine ores of different metals.
return;
}
int worth = ore.Amount;
if ( ore.ItemID == 0x19B9 )
worth *= 2;
else if ( ore.ItemID == 0x19B7 )
worth /= 2;
int w = m_Ore.Amount;
double extraWeight = w * 7;
if ( m_Ore.ItemID == 0x19B9 )
{
extraWeight = w * 12;
w *= 2;
}
else if ( m_Ore.ItemID == 0x19B7 )
{
extraWeight = w * 3;
w /= 2;
}
worth += w;
if ( m_Ore.IsChildOf( from.Backpack ) )
extraWeight -= m_Ore.Weight;
if ( (ore.ItemID == 0x19B9 && worth > 120000) || (( ore.ItemID == 0x19B8 || ore.ItemID == 0x19BA ) && worth > 60000) || (ore.ItemID == 0x19B7 && worth > 30000))
{
from.SendLocalizedMessage( 1062844 ); // There is too much ore to combine.
return;
}
else if ( root is Mobile && (extraWeight + ((Mobile)root).Backpack.TotalWeight) > ((Mobile)root).Backpack.MaxWeight )
{
from.SendLocalizedMessage( 501978 ); // The weight is too great to combine in a container.
return;
}
else if ( ore.ItemID == 0x19B9 )
{
ore.Amount = worth / 2;
m_Ore.Delete();
}
else if ( ore.ItemID == 0x19B7 )
{
ore.Amount = worth * 2;
m_Ore.Delete();
}
else
{
ore.Amount = worth;
m_Ore.Delete();
}
return;
}
// Combine Ore End
if ( IsForge( targeted ) )
{
double difficulty;
switch ( m_Ore.Resource )
{
default: difficulty = 50.0; break;
case CraftResource.DullCopper: difficulty = 65.0; break;
case CraftResource.ShadowIron: difficulty = 70.0; break;
case CraftResource.Copper: difficulty = 75.0; break;
case CraftResource.Bronze: difficulty = 80.0; break;
case CraftResource.Gold: difficulty = 85.0; break;
case CraftResource.Agapite: difficulty = 90.0; break;
case CraftResource.Verite: difficulty = 95.0; break;
case CraftResource.Valorite: difficulty = 99.0; break;
}
double minSkill = difficulty - 25.0;
double maxSkill = difficulty + 25.0;
if ( difficulty > 50.0 && difficulty > from.Skills[SkillName.Mining].Value )
{
from.SendLocalizedMessage( 501986 ); // You have no idea how to smelt this strange ore!
return;
}
if ( from.CheckTargetSkill( SkillName.Mining, targeted, minSkill, maxSkill ) )
{
int toConsume = m_Ore.Amount;
// Sized Ore Start
if ( m_Ore.ItemID == 0x19B7 && (toConsume / 2 == 0 || toConsume != (toConsume / 2) * 2) ) // I predict here, that unpair int halfed returns 0.
--toConsume;
// Sized Ore End
if ( toConsume <= 0 )
{
from.SendLocalizedMessage( 501987 ); // There is not enough metal-bearing ore in this pile to make an ingot.
}
else
{
// Sized Ore changed next line
if ( toConsume > 30000 && m_Ore.ItemID == 0x19B9 )
toConsume = 30000;
BaseIngot ingot = m_Ore.GetIngot();
// Sized Ore removed next line
// ingot.Amount = toConsume * 2;
// Sized Ore Start
int amount = toConsume;
if ( m_Ore.ItemID == 0x19B7 )
amount /= 2;
else if ( m_Ore.ItemID == 0x19B9 )
amount *= 2;
ingot.Amount = amount;
// Sized Ore End
m_Ore.Consume( toConsume );
from.AddToBackpack( ingot );
//from.PlaySound( 0x57 );
from.SendLocalizedMessage( 501988 ); // You smelt the ore removing the impurities and put the metal in your backpack.
}
}
else if ( m_Ore.Amount < 2 )
{
from.SendLocalizedMessage( 501989 ); // You burn away the impurities but are left with no useable metal.
m_Ore.Delete();
}
else
{
from.SendLocalizedMessage( 501990 ); // You burn away the impurities but are left with less useable metal.
m_Ore.Amount /= 2;
}
}
}
}
}
public class IronOre : BaseOre
{
[Constructable]
public IronOre() : this( 1 )
{
}
[Constructable]
public IronOre( int amount ) : base( CraftResource.Iron, amount )
{
}
public IronOre( 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 override Item Dupe( int amount )
{
return base.Dupe( new IronOre( amount ), amount );
}
public override BaseIngot GetIngot()
{
return new IronIngot();
}
}
public class DullCopperOre : BaseOre
{
[Constructable]
public DullCopperOre() : this( 1 )
{
}
[Constructable]
public DullCopperOre( int amount ) : base( CraftResource.DullCopper, amount )
{
}
public DullCopperOre( 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 override Item Dupe( int amount )
{
return base.Dupe( new DullCopperOre( amount ), amount );
}
public override BaseIngot GetIngot()
{
return new DullCopperIngot();
}
}
public class ShadowIronOre : BaseOre
{
[Constructable]
public ShadowIronOre() : this( 1 )
{
}
[Constructable]
public ShadowIronOre( int amount ) : base( CraftResource.ShadowIron, amount )
{
}
public ShadowIronOre( 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 override Item Dupe( int amount )
{
return base.Dupe( new ShadowIronOre( amount ), amount );
}
public override BaseIngot GetIngot()
{
return new ShadowIronIngot();
}
}
public class CopperOre : BaseOre
{
[Constructable]
public CopperOre() : this( 1 )
{
}
[Constructable]
public CopperOre( int amount ) : base( CraftResource.Copper, amount )
{
}
public CopperOre( 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 override Item Dupe( int amount )
{
return base.Dupe( new CopperOre( amount ), amount );
}
public override BaseIngot GetIngot()
{
return new CopperIngot();
}
}
public class BronzeOre : BaseOre
{
[Constructable]
public BronzeOre() : this( 1 )
{
}
[Constructable]
public BronzeOre( int amount ) : base( CraftResource.Bronze, amount )
{
}
public BronzeOre( 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 override Item Dupe( int amount )
{
return base.Dupe( new BronzeOre( amount ), amount );
}
public override BaseIngot GetIngot()
{
return new BronzeIngot();
}
}
public class GoldOre : BaseOre
{
[Constructable]
public GoldOre() : this( 1 )
{
}
[Constructable]
public GoldOre( int amount ) : base( CraftResource.Gold, amount )
{
}
public GoldOre( 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 override Item Dupe( int amount )
{
return base.Dupe( new GoldOre( amount ), amount );
}
public override BaseIngot GetIngot()
{
return new GoldIngot();
}
}
public class AgapiteOre : BaseOre
{
[Constructable]
public AgapiteOre() : this( 1 )
{
}
[Constructable]
public AgapiteOre( int amount ) : base( CraftResource.Agapite, amount )
{
}
public AgapiteOre( 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 override Item Dupe( int amount )
{
return base.Dupe( new AgapiteOre( amount ), amount );
}
public override BaseIngot GetIngot()
{
return new AgapiteIngot();
}
}
public class VeriteOre : BaseOre
{
[Constructable]
public VeriteOre() : this( 1 )
{
}
[Constructable]
public VeriteOre( int amount ) : base( CraftResource.Verite, amount )
{
}
public VeriteOre( 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 override Item Dupe( int amount )
{
return base.Dupe( new VeriteOre( amount ), amount );
}
public override BaseIngot GetIngot()
{
return new VeriteIngot();
}
}
public class ValoriteOre : BaseOre
{
[Constructable]
public ValoriteOre() : this( 1 )
{
}
[Constructable]
public ValoriteOre( int amount ) : base( CraftResource.Valorite, amount )
{
}
public ValoriteOre( 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 override Item Dupe( int amount )
{
return base.Dupe( new ValoriteOre( amount ), amount );
}
public override BaseIngot GetIngot()
{
return new ValoriteIngot();
}
}
}
|
|
|
|
|
#3 (permalink) |
|
Forum Expert
Join Date: Feb 2004
Age: 27
Posts: 1,834
|
I hope so... The resources gathered from ore is correct according to stratics, but they might be wrong of corse... well if you discover something, that is not exact I am gonna change it. At least there are different sizes now. :/
|
|
|
|
|
#5 (permalink) |
|
Forum Expert
Join Date: Feb 2004
Age: 27
Posts: 1,834
|
Thank you! I will update that.
![]() Done - Saved me some code, hehe. If you have some more info for me, please let me know. I know it's not done yet, since there is a localized about the container being too full to combine ores in it. Maybe it's even only that it works like Drag and Drop onto... Would save some more code, if it only was like that, hehe. |
|
|
|
|
#6 (permalink) |
|
Forum Expert
Join Date: Feb 2004
Age: 27
Posts: 1,834
|
Sorry for bumping and double posting, but I wanted to mention, that I simplyfied the code with a little help from a friend, who scripted this piece too and the changes to combine ore were stolen from him. :P
I'm thinking about making mining skill influence the size of ore you mine. So you get higher chance on big ore piles with more mining., but that would require some extra lines in Mining.cs. Any opinions or someone, who would use that? lol I think I'll do it anyways and post instructions on how to change the mining.cs. Update: I will upload the commented Ore.cs and Harvestsystem.cs in a zip. You can decide then, which you want to use and if you want different chances for the sizes, depending on mining skill. |
|
|
|
|
#7 (permalink) |
|
Forum Novice
|
I do remember you could d-click a pile of ore to get the target... if you targeted another pile of ore (same kind) you could combine it with another pile, wether it was same graphic or not. I dont remember if the d-clicked pile changed to the targeted pile graphic, or if the targeted pile changed to the d-clicked pile graphic.. but you could combine them that way, even if they were different graphic, so long as they were same ore type.
|
|
|
|
|
#8 (permalink) |
|
Forum Expert
Join Date: Feb 2004
Age: 27
Posts: 1,834
|
Ok thanks for replying. The problem is, that I have no way to verify info, that is given to me. But hey, who cares about buged/flawed/weak OSI features... so I have made it like I would have scripted combine ores.
I put it only in the code tags one, not in the zip. |
|
|
|
|
#9 (permalink) |
|
Forum Novice
|
The way the ore system worked you could combine the big pile you could combie with the little piles but the bigger piles contained more ore so when they were combine 1 biger pile would equal like 8 small piles and two small piles would equal like 1 ingot
|
|
|
|
|
#10 (permalink) | |
|
Forum Expert
Join Date: Feb 2004
Age: 27
Posts: 1,834
|
Quote:
P.S. line 256 from the [code]-tags now is correct and says: newore.MoveToWorld( loc, map ); loc instead. ore.Location, when ore already was Deleted. :/ |
|
|
|
|
|
#11 (permalink) |
|
Newbie
Join Date: Jul 2004
Location: Montana USA
Age: 42
Posts: 73
|
I just currently left OSI, and the way ore works there is,
2 small piles = 1 medium pile = 1 ingot 2 medium piles = 1 large pile = 2 ingots Anytime you combine ore on OSI, If you use 2 of the same size, they stay that size, But if you use a large on a small, you get small ore, 4 small for each large, 2 small for each medium.... I hope this helps... I personally hated OSI's system, because you can actually get 0 large pile of ore if you fail on a smelt on a single pile of ore, it always cuts the pile in half, so If you have a single pile, it cant cut it in half, and the pile wont go to the small, it stays large, and goes to 0... wasting some... ![]() But, you did good on this, thanks for contributing.. ![]() |
|
|
|
|
#12 (permalink) | |
|
Forum Expert
Join Date: Feb 2004
Age: 27
Posts: 1,834
|
Quote:
On to bigger projects. >:] |
|
|
|
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|