ModernUO/Scripts/Items/Deeds/CommodityDeed.cs
daedalus 95de3595cd - You can't anymore place castles or keeps in Malas facet
(http://www.runuo.com/bugs/index.php?cmd=view&id=38)

- Unfilled commodity deeds now carry the etching "Unfilled"
(http://www.runuo.com/bugs/index.php?cmd=view&id=40)

- Empty scrolls can be deeded in a commodity deed
(http://www.uodemise.com/discussion/showthread.php?t=127485)

- Dying tubs, if locked down, can allow security level choices
(http://www.uodemise.com/discussion/showthread.php?t=128546)

- Changes in Energy Vortex skills: they'll have 120 wrestling (it was 100) and 100 tactics (it was 90)
(http://www.uodemise.com/discussion/showthread.php?t=122733)

- Wooden Footlockers now show the correct container gump
(http://www.uodemise.com/discussion/showthread.php?t=126452)

- Changes to Interior Decorator (still not includes the fix to turn paragon chests):
--> single item addons can be raised/lowered
--> the gump stays visible until target is cancelled
--> target won't be cancelled automatically when the decorator is used on a target
(http://www.uodemise.com/discussion/showthread.php?t=126668)

- Doom Lever Puzzle item list changed to generics
(http://www.uodemise.com/discussion/showthread.php?t=130396)

- Morphed forms will check now the current skill level: the morph effect is lost if skill level goes under the minimum required.
(http://www.uodemise.com/discussion/showthread.php?t=116542)

- Mage NPC vendors now buy necro scrolls; the price of scrolls got tweaked (= raised) to match OSI
(http://www.runuo.com/bugs/index.php?cmd=view&id=90)
(http://www.runuo.com/bugs/index.php?cmd=view&id=113)

- You can't anymore discord NPC vendors
(http://www.runuo.com/bugs/index.php?cmd=view&id=33)

- Removing a rune from runebook won't change the default rune set
(http://www.runuo.com/bugs/index.php?cmd=view&id=41)

- Various runebook security changes (see link for the list)
(http://www.runuo.com/bugs/index.php?cmd=view&id=39)

- You can't use the Sacrifice virtue while hidden
(http://www.runuo.com/bugs/index.php?cmd=view&id=42)

- Added the Deceit Brazier: doubleclicking it will summon a random "britannian" monster (check [props for delays)
(http://www.uodemise.com/discussion/showthread.php?t=123805)

- Casting spells will raise also the secondary skill associated (example: Necro and SpiritSpeak)
(http://www.runuo.com/bugs/index.php?cmd=view&id=43)

- Word of Death changes:
--> the "pitful damage" is much powerful now
--> you have to bring the target health below (5*arcanefocus)% to strike the powerful blast of 300 chaos damage
--> the damage is influenced by SDI
(http://www.runuo.com/bugs/index.php?cmd=view&id=36)

- Teleporters generated by [telgen got corrected for the Wrong dungeon
(http://www.runuo.com/bugs/index.php?cmd=view&id=34)
2009-11-09 19:29:19 +00:00

251 lines
No EOL
5.5 KiB
C#

using System;
using Server.Targeting;
using Server.Network;
namespace Server.Items
{
public interface ICommodity
{
string Description{ get; }
int DescriptionNumber{ get; }
}
public class CommodityDeed : Item
{
private Item m_Commodity;
[CommandProperty( AccessLevel.GameMaster )]
public Item Commodity
{
get
{
return m_Commodity;
}
}
public bool SetCommodity( Item item )
{
InvalidateProperties();
if ( m_Commodity == null && item is ICommodity )
{
m_Commodity = item;
m_Commodity.Internalize();
InvalidateProperties();
return true;
}
else
{
return false;
}
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
writer.Write( m_Commodity );
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
switch ( version )
{
case 0:
{
m_Commodity = reader.ReadItem();
break;
}
}
if ( m_Commodity != null && !( m_Commodity is ICommodity ) ) //Apparently, there may be items out there with this. Funky.
{
Timer.DelayCall( TimeSpan.Zero, this.Delete );
}
}
public CommodityDeed( Item commodity ) : base( 0x14F0 )
{
Weight = 1.0;
Hue = 0x47;
m_Commodity = commodity;
LootType = LootType.Blessed;
}
[Constructable]
public CommodityDeed() : this( null )
{
}
public CommodityDeed( Serial serial ) : base( serial )
{
}
public override void OnDelete()
{
if ( m_Commodity != null )
m_Commodity.Delete();
base.OnDelete();
}
public override int LabelNumber{ get{ return m_Commodity == null ? 1047016 : 1047017; } }
public override void GetProperties( ObjectPropertyList list )
{
base.GetProperties( list );
if ( m_Commodity != null && m_Commodity is ICommodity )
list.Add( 1060658, "#{0}\t{1}", ((ICommodity)m_Commodity).DescriptionNumber, m_Commodity.Amount ); // ~1_val~: ~2_val~
else
list.Add( 1060748 ); // unfilled
}
public override void OnSingleClick( Mobile from )
{
base.OnSingleClick( from );
if ( m_Commodity != null && m_Commodity is ICommodity )
from.Send( new UnicodeMessage( Serial, ItemID, MessageType.Label, 0x3B2, 3, "ENU", "", ((ICommodity)m_Commodity).Description ) );
}
public override void OnDoubleClick( Mobile from )
{
int number;
BankBox box = from.FindBankNoCreate();
CommodityDeedBox cox = CommodityDeedBox.Find( this );
// Veteran Rewards mods
if ( m_Commodity != null )
{
if ( box != null && IsChildOf( box ) )
{
number = 1047031; // The commodity has been redeemed.
box.DropItem( m_Commodity );
m_Commodity = null;
Delete();
}
else if ( cox != null )
{
if ( cox.IsSecure )
{
number = 1047031; // The commodity has been redeemed.
cox.DropItem( m_Commodity );
m_Commodity = null;
Delete();
}
else
number = 1080525; // The commodity deed box must be secured before you can use it.
}
else
{
if( Core.ML )
{
number = 1080526; // That must be in your bank box or commodity deed box to use it.
}
else
{
number = 1047024; // To claim the resources ....
}
}
}
else if ( cox != null && !cox.IsSecure )
{
number = 1080525; // The commodity deed box must be secured before you can use it.
}
else if ( ( box == null || !IsChildOf( box ) ) && cox == null )
{
if( Core.ML )
{
number = 1080526; // That must be in your bank box or commodity deed box to use it.
}
else
{
number = 1047026; // That must be in your bank box to use it.
}
}
else
{
number = 1047029; // Target the commodity to fill this deed with.
from.Target = new InternalTarget( this );
}
from.SendLocalizedMessage( number );
}
private class InternalTarget : Target
{
private CommodityDeed m_Deed;
public InternalTarget( CommodityDeed deed ) : base( 3, false, TargetFlags.None )
{
m_Deed = deed;
}
protected override void OnTarget( Mobile from, object targeted )
{
if ( m_Deed.Deleted )
return;
int number;
if ( m_Deed.Commodity != null )
{
number = 1047028; // The commodity deed has already been filled.
}
else if ( targeted is Item )
{
BankBox box = from.FindBankNoCreate();
CommodityDeedBox cox = CommodityDeedBox.Find( m_Deed );
// Veteran Rewards mods
if ( box != null && m_Deed.IsChildOf( box ) && ((Item)targeted).IsChildOf( box ) ||
cox != null && cox.IsSecure && ((Item)targeted).IsChildOf( cox ) )
{
if ( m_Deed.SetCommodity( (Item) targeted ) )
{
number = 1047030; // The commodity deed has been filled.
}
else
{
number = 1047027; // That is not a commodity the bankers will fill a commodity deed with.
}
}
else
{
if( Core.ML )
{
number = 1080526; // That must be in your bank box or commodity deed box to use it.
}
else
{
number = 1047026; // That must be in your bank box to use it.
}
}
}
else
{
number = 1047027; // That is not a commodity the bankers will fill a commodity deed with.
}
from.SendLocalizedMessage( number );
}
}
}
}