#W# Source and Scripts added. Added Scripts/Settings.cs to expose some basic tweak able settings.

This commit is contained in:
WarrentyExpired 2026-08-06 11:06:05 -04:00
parent b51c58f514
commit 3045c83799
3512 changed files with 627673 additions and 0 deletions

View file

@ -0,0 +1,329 @@
using System;
using System.Collections.Generic;
using Server;
using Server.Gumps;
using Server.Mobiles;
using Server.Network;
using Server.ContextMenus;
using Server.Engines.VeteranRewards;
namespace Server.Items
{
public class AnkhOfSacrificeComponent : AddonComponent
{
public override bool ForceShowProperties{ get{ return ObjectPropertyList.Enabled; } }
public override int LabelNumber{ get{ return 1027772; } } // Ankh of Sacrifice
public AnkhOfSacrificeComponent( int itemID ) : base( itemID )
{
}
public AnkhOfSacrificeComponent( Serial serial ) : base( serial )
{
}
public override void GetContextMenuEntries( Mobile from, List<ContextMenuEntry> list )
{
base.GetContextMenuEntries( from, list );
if ( from is PlayerMobile )
list.Add( new LockKarmaEntry( (PlayerMobile)from, Addon as AnkhOfSacrificeAddon ) );
list.Add( new ResurrectEntry( from, Addon as AnkhOfSacrificeAddon ) );
}
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 static void Resurrect( PlayerMobile m, AnkhOfSacrificeAddon ankh )
{
if ( m == null )
{
}
else if ( !m.InRange( ankh.GetWorldLocation(), 2 ) )
{
m.SendLocalizedMessage( 500446 ); // That is too far away.
}
else if ( m.Alive )
{
m.SendLocalizedMessage( 1060197 ); // You are not dead, and thus cannot be resurrected!
}
else if ( m.AnkhNextUse > DateTime.UtcNow )
{
TimeSpan delay = m.AnkhNextUse - DateTime.UtcNow;
if ( delay.TotalMinutes > 0 )
m.SendLocalizedMessage( 1079265, Math.Round( delay.TotalMinutes ).ToString() ); // You must wait ~1_minutes~ minutes before you can use this item.
else
m.SendLocalizedMessage( 1079263, Math.Round( delay.TotalSeconds ).ToString() ); // You must wait ~1_seconds~ seconds before you can use this item.
}
else
{
m.CloseGump( typeof( AnkhResurrectGump ) );
m.SendGump( new AnkhResurrectGump( m, ResurrectMessage.VirtueShrine ) );
}
}
private class ResurrectEntry : ContextMenuEntry
{
private Mobile m_Mobile;
private AnkhOfSacrificeAddon m_Ankh;
public ResurrectEntry( Mobile mobile, AnkhOfSacrificeAddon ankh ) : base( 6195, 2 )
{
m_Mobile = mobile;
m_Ankh = ankh;
}
public override void OnClick()
{
if ( m_Ankh == null || m_Ankh.Deleted )
return;
Resurrect( m_Mobile as PlayerMobile, m_Ankh );
}
}
private class LockKarmaEntry : ContextMenuEntry
{
private PlayerMobile m_Mobile;
private AnkhOfSacrificeAddon m_Ankh;
public LockKarmaEntry( PlayerMobile mobile, AnkhOfSacrificeAddon ankh ) : base( mobile.KarmaLocked ? 6197 : 6196, 2 )
{
m_Mobile = mobile;
m_Ankh = ankh;
}
public override void OnClick()
{
if ( !m_Mobile.InRange( m_Ankh.GetWorldLocation(), 2 ) )
m_Mobile.SendLocalizedMessage( 500446 ); // That is too far away.
else
{
m_Mobile.KarmaLocked = !m_Mobile.KarmaLocked;
if ( m_Mobile.KarmaLocked )
m_Mobile.SendLocalizedMessage( 1060192 ); // Your karma has been locked. Your karma can no longer be raised.
else
m_Mobile.SendLocalizedMessage( 1060191 ); // Your karma has been unlocked. Your karma can be raised again.
}
}
}
private class AnkhResurrectGump : ResurrectGump
{
public AnkhResurrectGump( Mobile owner, ResurrectMessage msg ) : base( owner, owner, msg, false )
{
}
public override void OnResponse( NetState state, RelayInfo info )
{
Mobile from = state.Mobile;
if( info.ButtonID == 1 || info.ButtonID == 2 )
{
if( from.Map == null || !from.Map.CanFit( from.Location, 16, false, false ) )
{
from.SendLocalizedMessage( 502391 ); // Thou can not be resurrected there!
return;
}
if ( from is PlayerMobile )
{
((PlayerMobile) from).AnkhNextUse = DateTime.UtcNow + TimeSpan.FromHours( 1 );
}
base.OnResponse( state, info );
}
}
}
}
public class AnkhOfSacrificeAddon : BaseAddon, IRewardItem
{
public override bool HandlesOnMovement{ get{ return true; } }
public override BaseAddonDeed Deed
{
get
{
AnkhOfSacrificeDeed deed = new AnkhOfSacrificeDeed();
deed.IsRewardItem = m_IsRewardItem;
return deed;
}
}
private bool m_IsRewardItem;
[CommandProperty( AccessLevel.GameMaster )]
public bool IsRewardItem
{
get{ return m_IsRewardItem; }
set{ m_IsRewardItem = value; InvalidateProperties(); }
}
[Constructable]
public AnkhOfSacrificeAddon( bool east ) : base()
{
if ( east )
{
AddComponent( new AnkhOfSacrificeComponent( 0x1D98 ), 0, 0, 0 );
AddComponent( new AnkhOfSacrificeComponent( 0x1D97 ), 0, 1, 0 );
AddComponent( new AnkhOfSacrificeComponent( 0x1CD6 ), 1, 0, 0 );
AddComponent( new AnkhOfSacrificeComponent( 0x1CD4 ), 1, 1, 0 );
AddComponent( new AnkhOfSacrificeComponent( 0x1CD0 ), 2, 0, 0 );
AddComponent( new AnkhOfSacrificeComponent( 0x1CCE ), 2, 1, 0 );
}
else
{
AddComponent( new AnkhOfSacrificeComponent( 0x1E5D ), 0, 0, 0 );
AddComponent( new AnkhOfSacrificeComponent( 0x1E5C ), 1, 0, 0 );
AddComponent( new AnkhOfSacrificeComponent( 0x1CD2 ), 0, 1, 0 );
AddComponent( new AnkhOfSacrificeComponent( 0x1CD8 ), 1, 1, 0 );
AddComponent( new AnkhOfSacrificeComponent( 0x1CCD ), 0, 2, 0 );
AddComponent( new AnkhOfSacrificeComponent( 0x1CCE ), 1, 2, 0 );
}
}
public AnkhOfSacrificeAddon( Serial serial ) : base( serial )
{
}
public override void OnMovement( Mobile m, Point3D oldLocation )
{
if ( !m.Alive && Utility.InRange( Location, m.Location, 1 ) && !Utility.InRange( Location, oldLocation, 1 ) )
AnkhOfSacrificeComponent.Resurrect( m as PlayerMobile, this );
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.WriteEncodedInt( 0 ); // version
writer.Write( (bool) m_IsRewardItem );
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadEncodedInt();
m_IsRewardItem = reader.ReadBool();
}
}
public class AnkhOfSacrificeDeed : BaseAddonDeed, IRewardItem, IRewardOption
{
public override int LabelNumber{ get{ return 1080397; } } // Deed For An Ankh Of Sacrifice
public override BaseAddon Addon
{
get
{
AnkhOfSacrificeAddon addon = new AnkhOfSacrificeAddon( m_East );
addon.IsRewardItem = m_IsRewardItem;
return addon;
}
}
private bool m_East;
private bool m_IsRewardItem;
[CommandProperty( AccessLevel.GameMaster )]
public bool IsRewardItem
{
get{ return m_IsRewardItem; }
set{ m_IsRewardItem = value; InvalidateProperties(); }
}
[Constructable]
public AnkhOfSacrificeDeed() : this( false )
{
}
[Constructable]
public AnkhOfSacrificeDeed( bool isRewardItem ) : base()
{
LootType = LootType.Blessed;
m_IsRewardItem = isRewardItem;
}
public AnkhOfSacrificeDeed( Serial serial ) : base( serial )
{
}
public override void OnDoubleClick( Mobile from )
{
if ( m_IsRewardItem && !RewardSystem.CheckIsUsableBy( from, this, null ) )
return;
if ( IsChildOf( from.Backpack ) )
{
from.CloseGump( typeof( RewardOptionGump ) );
from.SendGump( new RewardOptionGump( this ) );
}
else
from.SendLocalizedMessage( 1062334 ); // This item must be in your backpack to be used.
}
public override void GetProperties( ObjectPropertyList list )
{
base.GetProperties( list );
if ( m_IsRewardItem )
list.Add( 1080457 ); // 10th Year Veteran Reward
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.WriteEncodedInt( 0 ); // version
writer.Write( (bool) m_IsRewardItem );
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadEncodedInt();
m_IsRewardItem = reader.ReadBool();
}
public void GetOptions( RewardOptionList list )
{
list.Add( 1, 1080398 ); // Ankh of Sacrifice South
list.Add( 2, 1080399 ); // Ankh of Sacrifice East
}
public void OnOptionSelected( Mobile from, int option )
{
switch ( option )
{
case 1: m_East = false; break;
case 2: m_East = true; break;
}
if ( !Deleted )
base.OnDoubleClick( from );
}
}
}

View file

@ -0,0 +1,386 @@
using System;
using Server;
using Server.Gumps;
using Server.Multis;
using Server.Network;
using Server.Targeting;
using Server.Engines.VeteranRewards;
namespace Server.Items
{
public class Banner : Item, IAddon, IDyable, IRewardItem
{
public override bool ForceShowProperties{ get{ return ObjectPropertyList.Enabled; } }
public Item Deed
{
get
{
BannerDeed deed = new BannerDeed();
deed.IsRewardItem = m_IsRewardItem;
return deed;
}
}
private bool m_IsRewardItem;
[CommandProperty( AccessLevel.GameMaster )]
public bool IsRewardItem
{
get{ return m_IsRewardItem; }
set{ m_IsRewardItem = value; InvalidateProperties(); }
}
public bool FacingSouth
{
get{ return ( ItemID & 0x1 ) == 0; }
}
[Constructable]
public Banner( int itemID ) : base( itemID )
{
LootType = LootType.Blessed;
Movable = false;
}
public Banner( Serial serial ) : base( serial )
{
}
public override void GetProperties( ObjectPropertyList list )
{
base.GetProperties( list );
if ( Core.ML && m_IsRewardItem )
list.Add( 1076218 ); // 2nd Year Veteran Reward
}
public override void OnDoubleClick( Mobile from )
{
if ( from.InRange( Location, 2 ) )
{
BaseHouse house = BaseHouse.FindHouseAt( this );
if ( house != null && house.IsOwner( from ) )
{
from.CloseGump( typeof( RewardDemolitionGump ) );
from.SendGump( new RewardDemolitionGump( this, 1018318 ) ); // Do you wish to re-deed this banner?
}
else
from.SendLocalizedMessage( 1018330 ); // You can only re-deed a banner if you placed it or you are the owner of the house.
}
else
from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that.
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.WriteEncodedInt( 0 ); // version
writer.Write( (bool) m_IsRewardItem );
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadEncodedInt();
m_IsRewardItem = reader.ReadBool();
}
public bool Dye( Mobile from, DyeTub sender )
{
if ( Deleted )
return false;
Hue = sender.DyedHue;
return true;
}
public bool CouldFit( IPoint3D p, Map map )
{
if ( map == null || !map.CanFit( p.X, p.Y, p.Z, ItemData.Height ) )
return false;
if ( FacingSouth )
return BaseAddon.IsWall( p.X, p.Y - 1, p.Z, map ); // north wall
else
return BaseAddon.IsWall( p.X - 1, p.Y, p.Z, map ); // west wall
}
}
public class BannerDeed : Item, IRewardItem
{
public override int LabelNumber{ get{ return 1041007; } } // a banner deed
private bool m_IsRewardItem;
[CommandProperty( AccessLevel.GameMaster )]
public bool IsRewardItem
{
get{ return m_IsRewardItem; }
set{ m_IsRewardItem = value; InvalidateProperties(); }
}
[Constructable]
public BannerDeed() : base( 0x14F0 )
{
LootType = LootType.Blessed;
Weight = 1.0;
}
public BannerDeed( Serial serial ) : base( serial )
{
}
public override void GetProperties( ObjectPropertyList list )
{
base.GetProperties( list );
if ( m_IsRewardItem )
list.Add( 1076218 ); // 2nd Year Veteran Reward
}
public override void OnDoubleClick( Mobile from )
{
if ( m_IsRewardItem && !RewardSystem.CheckIsUsableBy( from, this, null ) )
return;
if ( IsChildOf( from.Backpack ) )
{
BaseHouse house = BaseHouse.FindHouseAt( from );
if ( house != null && house.IsOwner( from ) )
{
from.CloseGump( typeof( InternalGump ) );
from.SendGump( new InternalGump( this ) );
}
else
from.SendLocalizedMessage( 502092 ); // You must be in your house to do this.
}
else
from.SendLocalizedMessage( 1042038 ); // You must have the object in your backpack to use it.
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.WriteEncodedInt( 0 ); // version
writer.Write( (bool) m_IsRewardItem );
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadEncodedInt();
m_IsRewardItem = reader.ReadBool();
}
private class InternalGump : Gump
{
public const int Start = 0x15AE;
public const int End = 0x15F4;
private BannerDeed m_Banner;
public InternalGump( BannerDeed banner ) : base( 100, 200 )
{
m_Banner = banner;
Closable = true;
Disposable = true;
Dragable = true;
Resizable = false;
AddPage( 0 );
AddBackground( 25, 0, 520, 230, 0xA28 );
AddLabel( 70, 12, 0x3E3, "Choose a Banner:" );
int itemID = Start;
for ( int i = 1; i <= 4; i++ )
{
AddPage( i );
for ( int j = 0; j < 8; j++, itemID += 2 )
{
AddItem( 50 + 60 * j, 70, itemID );
AddButton( 50 + 60 * j, 50, 0x845, 0x846, itemID, GumpButtonType.Reply, 0 );
}
if ( i > 1 )
AddButton( 75, 198, 0x8AF, 0x8AF, 0, GumpButtonType.Page, i - 1 );
if ( i < 4 )
AddButton( 475, 198, 0x8B0, 0x8B0, 0, GumpButtonType.Page, i + 1 );
}
}
public override void OnResponse( NetState sender, RelayInfo info )
{
if ( m_Banner == null | m_Banner.Deleted )
return;
Mobile m = sender.Mobile;
if ( info.ButtonID >= Start && info.ButtonID <= End )
{
if ( ( info.ButtonID & 0x1 ) == 0 )
{
m.SendLocalizedMessage( 1042037 ); // Where would you like to place this banner?
m.Target = new InternalTarget( m_Banner, info.ButtonID );
}
}
}
}
private class InternalTarget : Target
{
private BannerDeed m_Banner;
private int m_ItemID;
public InternalTarget( BannerDeed banner, int itemID ) : base( -1, true, TargetFlags.None )
{
m_Banner = banner;
m_ItemID = itemID;
}
protected override void OnTarget( Mobile from, object targeted )
{
if ( m_Banner == null || m_Banner.Deleted )
return;
if ( m_Banner.IsChildOf( from.Backpack ) )
{
BaseHouse house = BaseHouse.FindHouseAt( from );
if ( house != null && house.IsOwner( from ) )
{
IPoint3D p = targeted as IPoint3D;
Map map = from.Map;
if ( p == null || map == null )
return;
Point3D p3d = new Point3D( p );
ItemData id = TileData.ItemTable[ m_ItemID & TileData.MaxItemValue ];
if ( map.CanFit( p3d, id.Height ) )
{
house = BaseHouse.FindHouseAt( p3d, map, id.Height );
if ( house != null && house.IsOwner( from ) )
{
bool north = BaseAddon.IsWall( p3d.X, p3d.Y - 1, p3d.Z, map );
bool west = BaseAddon.IsWall( p3d.X - 1, p3d.Y, p3d.Z, map );
if ( north && west )
{
from.CloseGump( typeof( FacingGump ) );
from.SendGump( new FacingGump( m_Banner, m_ItemID, p3d, house ) );
}
else if ( north || west )
{
Banner banner = null;
if ( north )
banner = new Banner( m_ItemID );
else if ( west )
banner = new Banner( m_ItemID + 1 );
house.Addons.Add( banner );
banner.IsRewardItem = m_Banner.IsRewardItem;
banner.MoveToWorld( p3d, map );
m_Banner.Delete();
}
else
from.SendLocalizedMessage( 1042039 ); // The banner must be placed next to a wall.
}
else
from.SendLocalizedMessage( 1042036 ); // That location is not in your house.
}
else
from.SendLocalizedMessage( 500269 ); // You cannot build that there.
}
else
from.SendLocalizedMessage( 502092 ); // You must be in your house to do this.
}
else
from.SendLocalizedMessage( 1042038 ); // You must have the object in your backpack to use it.
}
private class FacingGump : Gump
{
private BannerDeed m_Banner;
private int m_ItemID;
private Point3D m_Location;
private BaseHouse m_House;
private enum Buttons
{
Cancel,
East,
South
}
public FacingGump( BannerDeed banner, int itemID, Point3D location, BaseHouse house ) : base( 150, 50 )
{
m_Banner = banner;
m_ItemID = itemID;
m_Location = location;
m_House = house;
Closable = true;
Disposable = true;
Dragable = true;
Resizable = false;
AddPage( 0 );
AddBackground( 0, 0, 300, 150, 0xA28 );
AddItem( 90, 30, itemID + 1 );
AddItem( 180, 30, itemID );
AddButton( 50, 35, 0x868, 0x869, (int) Buttons.East, GumpButtonType.Reply, 0 );
AddButton( 145, 35, 0x868, 0x869, (int) Buttons.South, GumpButtonType.Reply, 0 );
}
public override void OnResponse( NetState sender, RelayInfo info )
{
if ( m_Banner == null || m_Banner.Deleted || m_House == null )
return;
Banner banner = null;
if ( info.ButtonID == (int) Buttons.East )
banner = new Banner( m_ItemID + 1 );
if ( info.ButtonID == (int) Buttons.South )
banner = new Banner( m_ItemID );
if ( banner != null )
{
m_House.Addons.Add( banner );
banner.IsRewardItem = m_Banner.IsRewardItem;
banner.MoveToWorld( m_Location, sender.Mobile.Map );
m_Banner.Delete();
}
}
}
}
}
}

View file

@ -0,0 +1,194 @@
using System;
using Server;
using Server.Gumps;
using Server.Network;
using Server.Engines.VeteranRewards;
namespace Server.Items
{
public class BloodyPentagramComponent : AddonComponent
{
public override bool DisplayWeight{ get{ return false; } }
public override int LabelNumber{ get{ return 1080279; } } // Bloody Pentagram
public BloodyPentagramComponent( int itemID ) : base( itemID )
{
}
public BloodyPentagramComponent( Serial serial ) : base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.WriteEncodedInt( 0 ); // version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadEncodedInt();
}
}
public class BloodyPentagramAddon : BaseAddon, IRewardItem
{
public override BaseAddonDeed Deed
{
get
{
BloodyPentagramDeed deed = new BloodyPentagramDeed();
deed.IsRewardItem = m_IsRewardItem;
return deed;
}
}
private bool m_IsRewardItem;
[CommandProperty( AccessLevel.GameMaster )]
public bool IsRewardItem
{
get{ return m_IsRewardItem; }
set{ m_IsRewardItem = value; InvalidateProperties(); }
}
[Constructable]
public BloodyPentagramAddon() : base()
{
AddComponent( new BloodyPentagramComponent( 0x1CF9 ), 0, 1, 0 );
AddComponent( new BloodyPentagramComponent( 0x1CF8 ), 0, 2, 0 );
AddComponent( new BloodyPentagramComponent( 0x1CF7 ), 0, 3, 0 );
AddComponent( new BloodyPentagramComponent( 0x1CF6 ), 0, 4, 0 );
AddComponent( new BloodyPentagramComponent( 0x1CF5 ), 0, 5, 0 );
AddComponent( new BloodyPentagramComponent( 0x1CFB ), 1, 0, 0 );
AddComponent( new BloodyPentagramComponent( 0x1CFA ), 1, 1, 0 );
AddComponent( new BloodyPentagramComponent( 0x1D09 ), 1, 2, 0 );
AddComponent( new BloodyPentagramComponent( 0x1D08 ), 1, 3, 0 );
AddComponent( new BloodyPentagramComponent( 0x1D07 ), 1, 4, 0 );
AddComponent( new BloodyPentagramComponent( 0x1CF4 ), 1, 5, 0 );
AddComponent( new BloodyPentagramComponent( 0x1CFC ), 2, 0, 0 );
AddComponent( new BloodyPentagramComponent( 0x1D0A ), 2, 1, 0 );
AddComponent( new BloodyPentagramComponent( 0x1D11 ), 2, 2, 0 );
AddComponent( new BloodyPentagramComponent( 0x1D10 ), 2, 3, 0 );
AddComponent( new BloodyPentagramComponent( 0x1D06 ), 2, 4, 0 );
AddComponent( new BloodyPentagramComponent( 0x1CF3 ), 2, 5, 0 );
AddComponent( new BloodyPentagramComponent( 0x1CFD ), 3, 0, 0 );
AddComponent( new BloodyPentagramComponent( 0x1D0B ), 3, 1, 0 );
AddComponent( new BloodyPentagramComponent( 0x1D12 ), 3, 2, 0 );
AddComponent( new BloodyPentagramComponent( 0x1D0F ), 3, 3, 0 );
AddComponent( new BloodyPentagramComponent( 0x1D05 ), 3, 4, 0 );
AddComponent( new BloodyPentagramComponent( 0x1CF2 ), 3, 5, 0 );
AddComponent( new BloodyPentagramComponent( 0x1CFE ), 4, 0, 0 );
AddComponent( new BloodyPentagramComponent( 0x1D0C ), 4, 1, 0 );
AddComponent( new BloodyPentagramComponent( 0x1D0D ), 4, 2, 0 );
AddComponent( new BloodyPentagramComponent( 0x1D0E ), 4, 3, 0 );
AddComponent( new BloodyPentagramComponent( 0x1D04 ), 4, 4, 0 );
AddComponent( new BloodyPentagramComponent( 0x1CF1 ), 4, 5, 0 );
AddComponent( new BloodyPentagramComponent( 0x1CFF ), 5, 0, 0 );
AddComponent( new BloodyPentagramComponent( 0x1D00 ), 5, 1, 0 );
AddComponent( new BloodyPentagramComponent( 0x1D01 ), 5, 2, 0 );
AddComponent( new BloodyPentagramComponent( 0x1D02 ), 5, 3, 0 );
AddComponent( new BloodyPentagramComponent( 0x1D03 ), 5, 4, 0 );
}
public BloodyPentagramAddon( Serial serial ) : base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.WriteEncodedInt( 0 ); // version
writer.Write( (bool) m_IsRewardItem );
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadEncodedInt();
m_IsRewardItem = reader.ReadBool();
}
}
public class BloodyPentagramDeed : BaseAddonDeed, IRewardItem
{
public override int LabelNumber{ get{ return 1080384; } } // Bloody Pentagram
public override BaseAddon Addon
{
get
{
BloodyPentagramAddon addon = new BloodyPentagramAddon();
addon.IsRewardItem = m_IsRewardItem;
return addon;
}
}
private bool m_IsRewardItem;
[CommandProperty( AccessLevel.GameMaster )]
public bool IsRewardItem
{
get{ return m_IsRewardItem; }
set{ m_IsRewardItem = value; InvalidateProperties(); }
}
[Constructable]
public BloodyPentagramDeed() : base()
{
LootType = LootType.Blessed;
}
public BloodyPentagramDeed( Serial serial ) : base( serial )
{
}
public override void OnDoubleClick( Mobile from )
{
if ( m_IsRewardItem && !RewardSystem.CheckIsUsableBy( from, this, null ) )
return;
base.OnDoubleClick( from );
}
public override void GetProperties( ObjectPropertyList list )
{
base.GetProperties( list );
if ( m_IsRewardItem )
list.Add( 1076221 ); // 5th Year Veteran Reward
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.WriteEncodedInt( 0 ); // version
writer.Write( (bool) m_IsRewardItem );
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadEncodedInt();
m_IsRewardItem = reader.ReadBool();
}
}
}

View file

@ -0,0 +1,244 @@
using System;
using Server;
using Server.Gumps;
using Server.Multis;
using Server.Network;
using Server.Engines.VeteranRewards;
namespace Server.Items
{
public class RewardBrazier : Item, IRewardItem
{
public override bool ForceShowProperties{ get{ return ObjectPropertyList.Enabled; } }
private bool m_IsRewardItem;
[CommandProperty( AccessLevel.GameMaster )]
public bool IsRewardItem
{
get{ return m_IsRewardItem; }
set{ m_IsRewardItem = value; InvalidateProperties(); }
}
private Item m_Fire;
public override void OnDelete()
{
TurnOff();
base.OnDelete();
}
private static int[] m_Art = new int[]
{
0x19AA, 0x19BB
};
[Constructable]
public RewardBrazier() : this( Utility.RandomList( m_Art ) )
{
}
[Constructable]
public RewardBrazier( int itemID ) : base( itemID )
{
LootType = LootType.Blessed;
Weight = 10.0;
}
public RewardBrazier( Serial serial ) : base( serial )
{
}
public void TurnOff()
{
if ( m_Fire != null )
{
m_Fire.Delete();
m_Fire = null;
}
}
public void TurnOn()
{
if ( m_Fire == null )
m_Fire = new Item();
m_Fire.ItemID = 0x19AB;
m_Fire.Movable = false;
m_Fire.MoveToWorld( new Point3D( X, Y, Z + ItemData.Height + 2 ), Map );
}
public override void OnDoubleClick( Mobile from )
{
if ( !from.InRange( this.GetWorldLocation(), 2 ) )
{
from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that.
}
else if ( IsLockedDown )
{
BaseHouse house = BaseHouse.FindHouseAt( from );
if ( house != null && house.IsCoOwner( from ) )
{
if ( m_Fire != null )
TurnOff();
else
TurnOn();
}
else
from.SendLocalizedMessage( 502436 ); // That is not accessible.
}
else
from.SendLocalizedMessage( 502692 ); // This must be in a house and be locked down to work.
}
public override void OnLocationChange( Point3D old )
{
if ( m_Fire != null )
m_Fire.MoveToWorld( new Point3D( X, Y, Z + ItemData.Height ), Map );
}
public override void GetProperties( ObjectPropertyList list )
{
base.GetProperties( list );
if ( m_IsRewardItem )
list.Add( 1076222 ); // 6th Year Veteran Reward
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.WriteEncodedInt( 0 ); // version
writer.Write( (bool) m_IsRewardItem );
writer.Write( (Item) m_Fire );
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadEncodedInt();
m_IsRewardItem = reader.ReadBool();
m_Fire = reader.ReadItem();
}
}
public class RewardBrazierDeed : Item, IRewardItem
{
public override int LabelNumber{ get{ return 1080527; } } // Brazier Deed
private bool m_IsRewardItem;
[CommandProperty( AccessLevel.GameMaster )]
public bool IsRewardItem
{
get{ return m_IsRewardItem; }
set{ m_IsRewardItem = value; InvalidateProperties(); }
}
[Constructable]
public RewardBrazierDeed() : base( 0x14F0 )
{
LootType = LootType.Blessed;
Weight = 1.0;
}
public RewardBrazierDeed( Serial serial ) : base( serial )
{
}
public override void OnDoubleClick( Mobile from )
{
if ( m_IsRewardItem && !RewardSystem.CheckIsUsableBy( from, this, null ) )
return;
if ( IsChildOf( from.Backpack ) )
{
from.CloseGump( typeof( InternalGump ) );
from.SendGump( new InternalGump( this ) );
}
else
from.SendLocalizedMessage( 1042038 ); // You must have the object in your backpack to use it.
}
public override void GetProperties( ObjectPropertyList list )
{
base.GetProperties( list );
if ( m_IsRewardItem )
list.Add( 1076222 ); // 6th Year Veteran Reward
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.WriteEncodedInt( 0 ); // version
writer.Write( (bool) m_IsRewardItem );
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadEncodedInt();
m_IsRewardItem = reader.ReadBool();
}
private class InternalGump : Gump
{
private RewardBrazierDeed m_Brazier;
public InternalGump( RewardBrazierDeed brazier ) : base( 100, 200 )
{
m_Brazier = brazier;
Closable = true;
Disposable = true;
Dragable = true;
Resizable = false;
AddPage( 0 );
AddBackground( 0, 0, 200, 200, 2600 );
AddPage( 1 );
AddLabel( 45, 15, 0, "Choose a Brazier:" );
AddItem( 40, 75, 0x19AA );
AddButton( 55, 50, 0x845, 0x846, 0x19AA, GumpButtonType.Reply, 0 );
AddItem( 100, 75, 0x19BB );
AddButton( 115, 50, 0x845, 0x846, 0x19BB, GumpButtonType.Reply, 0 );
}
public override void OnResponse( NetState sender, RelayInfo info )
{
if ( m_Brazier == null | m_Brazier.Deleted )
return;
Mobile m = sender.Mobile;
if ( info.ButtonID == 0x19AA || info.ButtonID == 0x19BB )
{
RewardBrazier brazier = new RewardBrazier( info.ButtonID );
brazier.IsRewardItem = m_Brazier.IsRewardItem;
if ( !m.PlaceInBackpack( brazier ) )
{
brazier.Delete();
m.SendLocalizedMessage( 1078837 ); // Your backpack is full! Please make room and try again.
}
else
m_Brazier.Delete();
}
}
}
}
}

View file

@ -0,0 +1,469 @@
using System;
using Server;
using Server.Gumps;
using Server.Targeting;
using Server.Mobiles;
using Server.Network;
using Server.Engines.Quests.Haven;
using Server.Engines.VeteranRewards;
namespace Server.Items
{
public class CannonAddonComponent : AddonComponent
{
public override int LabelNumber{ get{ return 1076157; } } // Decorative Cannon
public CannonAddonComponent( int itemID ) : base( itemID )
{
LootType = LootType.Blessed;
}
public CannonAddonComponent( Serial serial ) : base( serial )
{
}
public override void GetProperties( ObjectPropertyList list )
{
base.GetProperties( list );
if ( Addon is CannonAddon )
{
if ( ((CannonAddon) Addon).IsRewardItem )
list.Add( 1076223 ); // 7th Year Veteran Reward
list.Add( 1076207, ((CannonAddon) Addon).Charges.ToString() ); // Remaining Charges: ~1_val~
}
}
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 class CannonAddon : BaseAddon
{
public override BaseAddonDeed Deed
{
get
{
CannonDeed deed = new CannonDeed();
deed.Charges = m_Charges;
deed.IsRewardItem = m_IsRewardItem;
return deed;
}
}
private CannonDirection m_CannonDirection;
private int m_Charges;
private bool m_IsRewardItem;
[CommandProperty( AccessLevel.GameMaster )]
public CannonDirection CannonDirection
{
get{ return m_CannonDirection; }
}
[CommandProperty( AccessLevel.GameMaster )]
public int Charges
{
get{ return m_Charges; }
set
{
m_Charges = value;
foreach ( AddonComponent c in Components )
c.InvalidateProperties();
}
}
[CommandProperty( AccessLevel.GameMaster )]
public bool IsRewardItem
{
get{ return m_IsRewardItem; }
set
{
m_IsRewardItem = value;
foreach ( AddonComponent c in Components )
c.InvalidateProperties();
}
}
[Constructable]
public CannonAddon( CannonDirection direction )
{
m_CannonDirection = direction;
switch ( direction )
{
case CannonDirection.North:
{
AddComponent( new CannonAddonComponent( 0xE8D ), 0, 0, 0 );
AddComponent( new CannonAddonComponent( 0xE8C ), 0, 1, 0 );
AddComponent( new CannonAddonComponent( 0xE8B ), 0, 2, 0 );
break;
}
case CannonDirection.East:
{
AddComponent( new CannonAddonComponent( 0xE96 ), 0, 0, 0 );
AddComponent( new CannonAddonComponent( 0xE95 ), -1, 0, 0 );
AddComponent( new CannonAddonComponent( 0xE94 ), -2, 0, 0 );
break;
}
case CannonDirection.South:
{
AddComponent( new CannonAddonComponent( 0xE91 ), 0, 0, 0 );
AddComponent( new CannonAddonComponent( 0xE92 ), 0, -1, 0 );
AddComponent( new CannonAddonComponent( 0xE93 ), 0, -2, 0 );
break;
}
default:
{
AddComponent( new CannonAddonComponent( 0xE8E ), 0, 0, 0 );
AddComponent( new CannonAddonComponent( 0xE8F ), 1, 0, 0 );
AddComponent( new CannonAddonComponent( 0xE90 ), 2, 0, 0 );
break;
}
}
}
public CannonAddon( Serial serial ) : base( serial )
{
}
public override void OnComponentUsed( AddonComponent c, Mobile from )
{
if ( from.InRange( Location, 2 ) )
{
if ( m_Charges > 0 )
{
from.Target = new InternalTarget( this );
}
else
{
if ( from.Backpack != null )
{
PotionKeg keg = from.Backpack.FindItemByType( typeof( PotionKeg ) ) as PotionKeg;
if ( Validate( keg ) > 0 )
from.SendGump( new InternalGump( this, keg ) );
else
from.SendLocalizedMessage( 1076198 ); // You do not have a full keg of explosion potions needed to recharge the cannon.
}
}
}
else
from.SendLocalizedMessage( 1076766 ); // That is too far away.
}
public int Validate( PotionKeg keg )
{
if ( keg != null && !keg.Deleted && keg.Held == 100 )
{
if ( keg.Type == PotionEffect.ExplosionLesser )
return 5;
else if ( keg.Type == PotionEffect.Explosion )
return 10;
else if ( keg.Type == PotionEffect.ExplosionGreater )
return 15;
}
return 0;
}
public void Fill( Mobile from, PotionKeg keg )
{
Charges = Validate( keg );
if ( Charges > 0 )
{
keg.Delete();
from.SendLocalizedMessage( 1076199 ); // Your cannon is recharged.
}
else
from.SendLocalizedMessage( 1076198 ); // You do not have a full keg of explosion potions needed to recharge the cannon.
}
private static int[] m_Effects = new int[]
{
0x36B0, 0x3728, 0x3709, 0x36FE
};
public void DoFireEffect( IPoint3D target )
{
Map map = Map;
if ( target == null || map == null )
return;
Effects.PlaySound( target, map, Utility.RandomList( 0x11B, 0x11C, 0x11D ) );
Effects.SendLocationEffect( target, map, Utility.RandomList( m_Effects ), 16, 1 );
for ( int count = Utility.Random( 3 ); count > 0; count-- )
{
IPoint3D location = new Point3D( target.X + Utility.RandomMinMax( -1, 1 ), target.Y + Utility.RandomMinMax( -1, 1 ), target.Z );
int effect = Utility.RandomList( m_Effects );
Effects.SendLocationEffect( location, map, effect, 16, 1 );
}
Charges -= 1;
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.WriteEncodedInt( 0 ); // version
writer.Write( (int) m_CannonDirection );
writer.Write( (int) m_Charges );
writer.Write( (bool) m_IsRewardItem );
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadEncodedInt();
m_CannonDirection = (CannonDirection) reader.ReadInt();
m_Charges = reader.ReadInt();
m_IsRewardItem = reader.ReadBool();
}
private class InternalTarget : Target
{
private CannonAddon m_Cannon;
public InternalTarget( CannonAddon cannon ) : base( 12, true, TargetFlags.None )
{
m_Cannon = cannon;
}
protected override void OnTarget( Mobile from, object targeted )
{
if ( m_Cannon == null || m_Cannon.Deleted )
return;
IPoint3D p = targeted as IPoint3D;
if ( p == null )
return;
if ( from.InLOS( new Point3D( p ) ) )
{
if ( !Utility.InRange( new Point3D( p ), m_Cannon.Location, 2 ) )
{
bool allow = false;
int x = p.X - m_Cannon.X;
int y = p.Y - m_Cannon.Y;
switch ( m_Cannon.CannonDirection )
{
case CannonDirection.North:
if ( y < 0 && Math.Abs( x ) <= -y / 3 )
allow = true;
break;
case CannonDirection.East:
if ( x > 0 && Math.Abs( y ) <= x / 3 )
allow = true;
break;
case CannonDirection.South:
if ( y > 0 && Math.Abs( x ) <= y / 3 )
allow = true;
break;
case CannonDirection.West:
if ( x < 0 && Math.Abs( y ) <= -x / 3 )
allow = true;
break;
}
if ( allow && Utility.InRange( new Point3D( p ), m_Cannon.Location, 14 ) )
m_Cannon.DoFireEffect( p );
else
from.SendLocalizedMessage( 1076203 ); // Target out of range.
}
else
from.SendLocalizedMessage( 1076215 ); // Cannon must be aimed farther away.
}
else
from.SendLocalizedMessage( 1049630 ); // You cannot see that target!
}
protected override void OnTargetOutOfRange( Mobile from, object targeted )
{
from.SendLocalizedMessage( 1076203 ); // Target out of range.
}
}
private class InternalGump : Gump
{
private CannonAddon m_Cannon;
private PotionKeg m_Keg;
private enum Buttons
{
Cancel,
Recharge
}
public InternalGump( CannonAddon cannon, PotionKeg keg ) : base( 50, 50 )
{
m_Cannon = cannon;
m_Keg = keg;
Closable = true;
Disposable = true;
Dragable = true;
Resizable = false;
AddPage( 0 );
AddBackground( 0, 0, 291, 133, 0x13BE );
AddImageTiled( 5, 5, 280, 100, 0xA40 );
AddHtmlLocalized( 9, 9, 272, 100, 1076196, cannon.Validate( keg ).ToString(), 0x7FFF, false, false ); // You will need a full keg of explosion potions to recharge the cannon. Your keg will provide ~1_CHARGES~ charges.
AddButton( 5, 107, 0xFB1, 0xFB2, (int) Buttons.Cancel, GumpButtonType.Reply, 0 );
AddHtmlLocalized( 40, 109, 100, 20, 1060051, 0x7FFF, false, false ); // CANCEL
AddButton( 160, 107, 0xFB7, 0xFB8, (int) Buttons.Recharge, GumpButtonType.Reply, 0 );
AddHtmlLocalized( 195, 109, 120, 20, 1076197, 0x7FFF, false, false ); // Recharge
}
public override void OnResponse( NetState state, RelayInfo info )
{
if ( m_Cannon == null || m_Cannon.Deleted )
return;
if ( info.ButtonID == (int) Buttons.Recharge )
m_Cannon.Fill( state.Mobile, m_Keg );
}
}
}
public class CannonDeed : BaseAddonDeed, IRewardItem, IRewardOption
{
public override int LabelNumber{ get{ return 1076195; } } // A deed for a cannon
public override BaseAddon Addon
{
get
{
CannonAddon addon = new CannonAddon( m_Direction );
addon.Charges = m_Charges;
addon.IsRewardItem = m_IsRewardItem;
return addon;
}
}
private CannonDirection m_Direction;
private int m_Charges;
private bool m_IsRewardItem;
[CommandProperty( AccessLevel.GameMaster )]
public int Charges
{
get{ return m_Charges; }
set{ m_Charges = value; InvalidateProperties(); }
}
[CommandProperty( AccessLevel.GameMaster )]
public bool IsRewardItem
{
get{ return m_IsRewardItem; }
set{ m_IsRewardItem = value; InvalidateProperties(); }
}
[Constructable]
public CannonDeed() : base()
{
LootType = LootType.Blessed;
}
public CannonDeed( Serial serial ) : base( serial )
{
}
public override void GetProperties( ObjectPropertyList list )
{
base.GetProperties( list );
if ( m_IsRewardItem )
list.Add( 1076223 ); // 7th Year Veteran Reward
list.Add( 1076207, m_Charges.ToString() ); // Remaining Charges: ~1_val~
}
public override void OnDoubleClick( Mobile from )
{
if ( m_IsRewardItem && !RewardSystem.CheckIsUsableBy( from, this, null ) )
return;
if ( IsChildOf( from.Backpack ) )
{
from.CloseGump( typeof( RewardOptionGump ) );
from.SendGump( new RewardOptionGump( this ) );
}
else
from.SendLocalizedMessage( 1042038 ); // You must have the object in your backpack to use it.
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.WriteEncodedInt( 0 ); // version
writer.Write( (int) m_Charges );
writer.Write( (bool) m_IsRewardItem );
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadEncodedInt();
m_Charges = reader.ReadInt();
m_IsRewardItem = reader.ReadBool();
}
public void GetOptions( RewardOptionList list )
{
list.Add( (int) CannonDirection.South, 1075386 ); // South
list.Add( (int) CannonDirection.East, 1075387 ); // East
list.Add( (int) CannonDirection.North, 1075389 ); // North
list.Add( (int) CannonDirection.West, 1075390 ); // West
}
public void OnOptionSelected( Mobile from, int option )
{
m_Direction = (CannonDirection) option;
if ( !Deleted )
base.OnDoubleClick( from );
}
}
}

View file

@ -0,0 +1,69 @@
using System;
using Server;
using Server.Engines.VeteranRewards;
namespace Server.Items
{
[Furniture]
public class CommodityDeedBox : BaseContainer, IRewardItem
{
public override int LabelNumber{ get { return 1080523; } } // Commodity Deed Box
public override int DefaultGumpID{ get{ return 0x43; } }
private bool m_IsRewardItem;
[CommandProperty( AccessLevel.GameMaster )]
public bool IsRewardItem
{
get{ return m_IsRewardItem; }
set{ m_IsRewardItem = value; InvalidateProperties(); }
}
[Constructable]
public CommodityDeedBox() : base( 0x9AA )
{
Hue = 0x47;
Weight = 4.0;
}
public CommodityDeedBox( Serial serial ) : base( serial )
{
}
public override void GetProperties( ObjectPropertyList list )
{
base.GetProperties( list );
if ( m_IsRewardItem )
list.Add( 1076217 ); // 1st Year Veteran Reward
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.WriteEncodedInt( 0 ); // version
writer.Write( (bool) m_IsRewardItem );
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadEncodedInt();
m_IsRewardItem = reader.ReadBool();
}
public static CommodityDeedBox Find( Item deed )
{
Item parent = deed;
while ( parent != null && !( parent is CommodityDeedBox ) )
parent = parent.Parent as Item;
return parent as CommodityDeedBox;
}
}
}

View file

@ -0,0 +1,132 @@
using System;
using Server;
using Server.Engines.VeteranRewards;
namespace Server.Items
{
public class ContestMiniHouse : MiniHouseAddon
{
public override BaseAddonDeed Deed
{
get
{
ContestMiniHouseDeed deed = new ContestMiniHouseDeed( Type );
deed.IsRewardItem = m_IsRewardItem;
return deed;
}
}
private bool m_IsRewardItem;
[CommandProperty( AccessLevel.GameMaster )]
public bool IsRewardItem
{
get{ return m_IsRewardItem; }
set{ m_IsRewardItem = value; InvalidateProperties(); }
}
[Constructable]
public ContestMiniHouse() : base( MiniHouseType.MalasMountainPass )
{
}
[Constructable]
public ContestMiniHouse( MiniHouseType type ) : base( type )
{
}
public ContestMiniHouse( Serial serial ) : base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.WriteEncodedInt( 0 ); // version
writer.Write( (bool) m_IsRewardItem );
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadEncodedInt();
m_IsRewardItem = reader.ReadBool();
}
}
public class ContestMiniHouseDeed : MiniHouseDeed, IRewardItem
{
public override BaseAddon Addon
{
get
{
ContestMiniHouse addon = new ContestMiniHouse( Type );
addon.IsRewardItem = m_IsRewardItem;
return addon;
}
}
private bool m_IsRewardItem;
[CommandProperty( AccessLevel.GameMaster )]
public bool IsRewardItem
{
get{ return m_IsRewardItem; }
set{ m_IsRewardItem = value; InvalidateProperties(); }
}
[Constructable]
public ContestMiniHouseDeed() : base( MiniHouseType.MalasMountainPass )
{
}
[Constructable]
public ContestMiniHouseDeed( MiniHouseType type ) : base( type )
{
}
public ContestMiniHouseDeed( Serial serial ) : base( serial )
{
}
public override void OnDoubleClick( Mobile from )
{
if ( m_IsRewardItem && !RewardSystem.CheckIsUsableBy( from, this, new object[] { Type } ) )
return;
base.OnDoubleClick( from );
}
public override void GetProperties( ObjectPropertyList list )
{
base.GetProperties( list );
if ( Core.ML && m_IsRewardItem )
list.Add( 1076217 ); // 1st Year Veteran Reward
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.WriteEncodedInt( 0 ); // version
writer.Write( (bool) m_IsRewardItem );
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadEncodedInt();
m_IsRewardItem = reader.ReadBool();
}
}
}

View file

@ -0,0 +1,400 @@
using System;
using Server;
using Server.Gumps;
using Server.Multis;
using Server.Network;
using Server.Targeting;
using Server.Engines.VeteranRewards;
namespace Server.Items
{
public class DecorativeShield : Item, IAddon, IRewardItem
{
public override bool ForceShowProperties{ get{ return ObjectPropertyList.Enabled; } }
public Item Deed
{
get
{
DecorativeShieldDeed deed = new DecorativeShieldDeed();
deed.IsRewardItem = m_IsRewardItem;
return deed;
}
}
private bool m_IsRewardItem;
[CommandProperty( AccessLevel.GameMaster )]
public bool IsRewardItem
{
get{ return m_IsRewardItem; }
set{ m_IsRewardItem = value; InvalidateProperties(); }
}
public bool FacingSouth
{
get
{
if ( ItemID < 0x1582 )
return ( ItemID & 0x1 ) == 0;
return ItemID <= 0x1585;
}
}
[Constructable]
public DecorativeShield() : this( 0x156C )
{
}
[Constructable]
public DecorativeShield( int itemID ) : base( itemID )
{
Movable = false;
}
public DecorativeShield( Serial serial ) : base( serial )
{
}
public override void GetProperties( ObjectPropertyList list )
{
base.GetProperties( list );
if ( Core.ML && m_IsRewardItem )
list.Add( 1076220 ); // 4th Year Veteran Reward
}
public override void OnDoubleClick( Mobile from )
{
if ( from.InRange( Location, 2 ) )
{
BaseHouse house = BaseHouse.FindHouseAt( this );
if ( house != null && house.IsOwner( from ) )
{
from.CloseGump( typeof( RewardDemolitionGump ) );
from.SendGump( new RewardDemolitionGump( this, 1049783 ) ); // Do you wish to re-deed this decoration?
}
else
from.SendLocalizedMessage( 1049784 ); // You can only re-deed this decoration if you are the house owner or originally placed the decoration.
}
else
from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that.
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.WriteEncodedInt( 0 ); // version
writer.Write( (bool) m_IsRewardItem );
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadEncodedInt();
m_IsRewardItem = reader.ReadBool();
}
public bool CouldFit( IPoint3D p, Map map )
{
if ( map == null || !map.CanFit( p.X, p.Y, p.Z, ItemData.Height ) )
return false;
if ( FacingSouth )
return BaseAddon.IsWall( p.X, p.Y - 1, p.Z, map ); // north wall
else
return BaseAddon.IsWall( p.X - 1, p.Y, p.Z, map ); // west wall
}
}
public class DecorativeShieldDeed : Item, IRewardItem
{
public override int LabelNumber{ get{ return 1049771; } } // deed for a decorative shield wall hanging
private bool m_IsRewardItem;
[CommandProperty( AccessLevel.GameMaster )]
public bool IsRewardItem
{
get{ return m_IsRewardItem; }
set{ m_IsRewardItem = value; InvalidateProperties(); }
}
[Constructable]
public DecorativeShieldDeed() : base( 0x14F0 )
{
LootType = LootType.Blessed;
Weight = 1.0;
}
public DecorativeShieldDeed( Serial serial ) : base( serial )
{
}
public override void GetProperties( ObjectPropertyList list )
{
base.GetProperties( list );
if ( m_IsRewardItem )
list.Add( 1076220 ); // 4th Year Veteran Reward
}
public override void OnDoubleClick( Mobile from )
{
if ( m_IsRewardItem && !RewardSystem.CheckIsUsableBy( from, this, null ) )
return;
if ( IsChildOf( from.Backpack ) )
{
from.CloseGump( typeof( InternalGump ) );
from.SendGump( new InternalGump( this ) );
}
else
from.SendLocalizedMessage( 1042038 ); // You must have the object in your backpack to use it.
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.WriteEncodedInt( 0 ); // version
writer.Write( (bool) m_IsRewardItem );
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadEncodedInt();
m_IsRewardItem = reader.ReadBool();
}
public static int GetWestItemID( int east )
{
switch ( east )
{
case 0x1582: return 0x1635;
case 0x1583: return 0x1634;
case 0x1584: return 0x1637;
case 0x1585: return 0x1636;
default: return east + 1;
}
}
private class InternalGump : Gump
{
public const int Start = 0x156C;
public const int End = 0x1585;
private DecorativeShieldDeed m_Shield;
private int m_Page;
public InternalGump( DecorativeShieldDeed shield ) : this( shield, 1 )
{
}
public InternalGump( DecorativeShieldDeed shield, int page ) : base( 150, 50 )
{
m_Shield = shield;
m_Page = page;
Closable = true;
Disposable = true;
Dragable = true;
Resizable = false;
AddPage( 0 );
AddBackground( 25, 0, 500, 230, 0xA28 );
int itemID = Start;
for ( int i = 1; i <= 2; i++ )
{
AddPage( i );
for ( int j = 0; j < 9 - i; j++ )
{
AddItem( 40 + j * 60, 70, itemID );
AddButton( 60 + j * 60, 50, 0x845, 0x846, itemID, GumpButtonType.Reply, 0 );
if ( itemID < 0x1582 )
itemID += 2;
else
itemID += 1;
}
switch ( i )
{
case 1: AddButton( 455, 198, 0x8B0, 0x8B0, 0, GumpButtonType.Page, 2 ); break;
case 2: AddButton( 70, 198, 0x8AF, 0x8AF, 0, GumpButtonType.Page, 1 ); break;
}
}
}
public override void OnResponse( NetState sender, RelayInfo info )
{
if ( m_Shield == null | m_Shield.Deleted )
return;
Mobile m = sender.Mobile;
if ( info.ButtonID >= Start && info.ButtonID <= End )
{
if ( ( info.ButtonID & 0x1 ) == 0 && info.ButtonID < 0x1582 || info.ButtonID >= 0x1582 && info.ButtonID <= 0x1585 )
{
m.SendLocalizedMessage( 1049780 ); // Where would you like to place this decoration?
m.Target = new InternalTarget( m_Shield, info.ButtonID );
}
}
}
}
private class InternalTarget : Target
{
private DecorativeShieldDeed m_Shield;
private int m_ItemID;
public InternalTarget( DecorativeShieldDeed shield, int itemID ) : base( -1, true, TargetFlags.None )
{
m_Shield = shield;
m_ItemID = itemID;
}
protected override void OnTarget( Mobile from, object targeted )
{
if ( m_Shield == null || m_Shield.Deleted )
return;
if ( m_Shield.IsChildOf( from.Backpack ) )
{
BaseHouse house = BaseHouse.FindHouseAt( from );
if ( house != null && house.IsOwner( from ) )
{
IPoint3D p = targeted as IPoint3D;
Map map = from.Map;
if ( p == null || map == null )
return;
Point3D p3d = new Point3D( p );
ItemData id = TileData.ItemTable[ m_ItemID & TileData.MaxItemValue ];
if ( map.CanFit( p3d, id.Height ) )
{
house = BaseHouse.FindHouseAt( p3d, map, id.Height );
if ( house != null && house.IsOwner( from ) )
{
bool north = BaseAddon.IsWall( p3d.X, p3d.Y - 1, p3d.Z, map );
bool west = BaseAddon.IsWall( p3d.X - 1, p3d.Y, p3d.Z, map );
if ( north && west )
{
from.CloseGump( typeof( FacingGump ) );
from.SendGump( new FacingGump( m_Shield, m_ItemID, p3d, house ) );
}
else if ( north || west )
{
DecorativeShield shield = null;
if ( north )
shield = new DecorativeShield( m_ItemID );
else if ( west )
shield = new DecorativeShield( GetWestItemID( m_ItemID ) );
house.Addons.Add( shield );
shield.IsRewardItem = m_Shield.IsRewardItem;
shield.MoveToWorld( p3d, map );
m_Shield.Delete();
}
else
from.SendLocalizedMessage( 1049781 ); // This decoration must be placed next to a wall.
}
else
from.SendLocalizedMessage( 1042036 ); // That location is not in your house.
}
else
from.SendLocalizedMessage( 500269 ); // You cannot build that there.
}
else
from.SendLocalizedMessage( 502092 ); // You must be in your house to do this.
}
else
from.SendLocalizedMessage( 1042038 ); // You must have the object in your backpack to use it.
}
private class FacingGump : Gump
{
private DecorativeShieldDeed m_Shield;
private int m_ItemID;
private Point3D m_Location;
private BaseHouse m_House;
private enum Buttons
{
Cancel,
South,
East
}
public FacingGump( DecorativeShieldDeed shield, int itemID, Point3D location, BaseHouse house ) : base( 150, 50 )
{
m_Shield = shield;
m_ItemID = itemID;
m_Location = location;
m_House = house;
Closable = true;
Disposable = true;
Dragable = true;
Resizable = false;
AddPage( 0 );
AddBackground( 0, 0, 300, 150, 0xA28 );
AddItem( 90, 30, GetWestItemID( itemID ) );
AddItem( 180, 30, itemID );
AddButton( 50, 35, 0x867, 0x869, (int) Buttons.East, GumpButtonType.Reply, 0 );
AddButton( 145, 35, 0x867, 0x869, (int) Buttons.South, GumpButtonType.Reply, 0 );
}
public override void OnResponse( NetState sender, RelayInfo info )
{
if ( m_Shield == null || m_Shield.Deleted || m_House == null )
return;
DecorativeShield shield = null;
if ( info.ButtonID == (int) Buttons.East )
shield = new DecorativeShield( GetWestItemID( m_ItemID ) );
if ( info.ButtonID == (int) Buttons.South )
shield = new DecorativeShield( m_ItemID );
if ( shield != null )
{
m_House.Addons.Add( shield );
shield.IsRewardItem = m_Shield.IsRewardItem;
shield.MoveToWorld( m_Location, sender.Mobile.Map );
m_Shield.Delete();
}
}
}
}
}
}

View file

@ -0,0 +1,257 @@
using System;
using Server;
using Server.Gumps;
using Server.Multis;
using Server.Network;
using Server.Targeting;
using Server.Engines.VeteranRewards;
namespace Server.Items
{
public class FlamingHead : StoneFaceTrapNoDamage, IAddon, IRewardItem
{
public override int LabelNumber{ get{ return 1041266; } } // Flaming Head
public override bool ForceShowProperties{ get{ return ObjectPropertyList.Enabled; } }
public Item Deed
{
get
{
FlamingHeadDeed deed = new FlamingHeadDeed();
deed.IsRewardItem = m_IsRewardItem;
return deed;
}
}
private bool m_IsRewardItem;
[CommandProperty( AccessLevel.GameMaster )]
public bool IsRewardItem
{
get{ return m_IsRewardItem; }
set{ m_IsRewardItem = value; InvalidateProperties(); }
}
[Constructable]
public FlamingHead() : this( StoneFaceTrapType.NorthWall )
{
}
[Constructable]
public FlamingHead( StoneFaceTrapType type ) : base()
{
LootType = LootType.Blessed;
Movable = false;
Type = type;
}
public FlamingHead( Serial serial ) : base( serial )
{
}
public override void GetProperties( ObjectPropertyList list )
{
base.GetProperties( list );
if ( Core.ML && m_IsRewardItem )
list.Add( 1076218 ); // 2nd Year Veteran Reward
}
public override void OnDoubleClick( Mobile from )
{
if ( from.InRange( Location, 2 ) )
{
BaseHouse house = BaseHouse.FindHouseAt( this );
if ( house != null && house.IsOwner( from ) )
{
from.CloseGump( typeof( RewardDemolitionGump ) );
from.SendGump( new RewardDemolitionGump( this, 1018329 ) ); // Do you wish to re-deed this skull?
}
else
from.SendLocalizedMessage( 1018328 ); // You can only re-deed a skull if you placed it or you are the owner of the house.
}
else
from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that.
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.WriteEncodedInt( 0 ); // version
writer.Write( (bool) m_IsRewardItem );
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadEncodedInt();
m_IsRewardItem = reader.ReadBool();
}
public bool CouldFit( IPoint3D p, Map map )
{
if ( map == null || !map.CanFit( p.X, p.Y, p.Z, ItemData.Height ) )
return false;
if ( Type == StoneFaceTrapType.NorthWestWall )
return BaseAddon.IsWall( p.X, p.Y - 1, p.Z, map ) && BaseAddon.IsWall( p.X - 1, p.Y, p.Z, map ); // north and west wall
else if ( Type == StoneFaceTrapType.NorthWall )
return BaseAddon.IsWall( p.X, p.Y - 1, p.Z, map ); // north wall
else if ( Type == StoneFaceTrapType.WestWall )
return BaseAddon.IsWall( p.X - 1, p.Y, p.Z, map ); // west wall
return false;
}
}
public class FlamingHeadDeed : Item, IRewardItem
{
public override int LabelNumber{ get{ return 1041050; } } // a flaming head deed
private bool m_IsRewardItem;
[CommandProperty( AccessLevel.GameMaster )]
public bool IsRewardItem
{
get{ return m_IsRewardItem; }
set{ m_IsRewardItem = value; InvalidateProperties(); }
}
[Constructable]
public FlamingHeadDeed() : base( 0x14F0 )
{
LootType = LootType.Blessed;
Weight = 1.0;
}
public FlamingHeadDeed( Serial serial ) : base( serial )
{
}
public override void GetProperties( ObjectPropertyList list )
{
base.GetProperties( list );
if ( m_IsRewardItem )
list.Add( 1076218 ); // 2nd Year Veteran Reward
}
public override void OnDoubleClick( Mobile from )
{
if ( m_IsRewardItem && !RewardSystem.CheckIsUsableBy( from, this, null ) )
return;
if ( IsChildOf( from.Backpack ) )
{
BaseHouse house = BaseHouse.FindHouseAt( from );
if ( house != null && house.IsOwner( from ) )
{
from.SendLocalizedMessage( 1042264 ); // Where would you like to place this head?
from.Target = new InternalTarget( this );
}
else
from.SendLocalizedMessage( 502115 ); // You must be in your house to do this.
}
else
from.SendLocalizedMessage( 1042038 ); // You must have the object in your backpack to use it.
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.WriteEncodedInt( 0 ); // version
writer.Write( (bool) m_IsRewardItem );
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadEncodedInt();
m_IsRewardItem = reader.ReadBool();
}
private class InternalTarget : Target
{
private FlamingHeadDeed m_Head;
public InternalTarget( FlamingHeadDeed head ) : base( -1, true, TargetFlags.None )
{
m_Head = head;
}
protected override void OnTarget( Mobile from, object targeted )
{
if ( m_Head == null || m_Head.Deleted )
return;
if ( m_Head.IsChildOf( from.Backpack ) )
{
BaseHouse house = BaseHouse.FindHouseAt( from );
if ( house != null && house.IsOwner( from ) )
{
IPoint3D p = targeted as IPoint3D;
Map map = from.Map;
if ( p == null || map == null )
return;
Point3D p3d = new Point3D( p );
ItemData id = TileData.ItemTable[ 0x10F5 ];
house = BaseHouse.FindHouseAt( p3d, map, id.Height );
if ( house != null && house.IsOwner( from ) )
{
if ( map.CanFit( p3d, id.Height ) )
{
bool north = BaseAddon.IsWall( p3d.X, p3d.Y - 1, p3d.Z, map );
bool west = BaseAddon.IsWall( p3d.X - 1, p3d.Y, p3d.Z, map );
FlamingHead head = null;
if ( north && west )
head = new FlamingHead( StoneFaceTrapType.NorthWestWall );
else if ( north )
head = new FlamingHead( StoneFaceTrapType.NorthWall );
else if ( west )
head = new FlamingHead( StoneFaceTrapType.WestWall );
if ( north || west )
{
house.Addons.Add( head );
head.IsRewardItem = m_Head.IsRewardItem;
head.MoveToWorld( p3d, map );
m_Head.Delete();
}
else
from.SendLocalizedMessage( 1042266 ); // The head must be placed next to a wall.
}
else
from.SendLocalizedMessage( 1042266 ); // The head must be placed next to a wall.
}
else
from.SendLocalizedMessage( 1042036 ); // That location is not in your house.
}
else
from.SendLocalizedMessage( 502115 ); // You must be in your house to do this.
}
else
from.SendLocalizedMessage( 1042038 ); // You must have the object in your backpack to use it.
}
}
}
}

View file

@ -0,0 +1,390 @@
using System;
using Server;
using Server.Gumps;
using Server.Multis;
using Server.Network;
using Server.Targeting;
using Server.Engines.VeteranRewards;
namespace Server.Items
{
public class HangingSkeleton : Item, IAddon, IRewardItem
{
public override bool ForceShowProperties{ get{ return ObjectPropertyList.Enabled; } }
public Item Deed
{
get
{
HangingSkeletonDeed deed = new HangingSkeletonDeed();
deed.IsRewardItem = m_IsRewardItem;
return deed;
}
}
private bool m_IsRewardItem;
[CommandProperty( AccessLevel.GameMaster )]
public bool IsRewardItem
{
get{ return m_IsRewardItem; }
set{ m_IsRewardItem = value; InvalidateProperties(); }
}
public bool FacingSouth
{
get
{
if ( ItemID == 0x1A03 || ItemID == 0x1A05 || ItemID == 0x1A09 ||
ItemID == 0x1B1E || ItemID == 0x1B7F )
return true;
return false;
}
}
[Constructable]
public HangingSkeleton() : this( 0x1596 )
{
}
[Constructable]
public HangingSkeleton( int itemID ) : base( itemID )
{
LootType = LootType.Blessed;
Movable = false;
}
public HangingSkeleton( Serial serial ) : base( serial )
{
}
public override void GetProperties( ObjectPropertyList list )
{
base.GetProperties( list );
if ( Core.ML && m_IsRewardItem )
list.Add( 1076220 ); // 4th Year Veteran Reward
}
public override void OnDoubleClick( Mobile from )
{
if ( from.InRange( Location, 3 ) )
{
BaseHouse house = BaseHouse.FindHouseAt( this );
if ( house != null && house.IsOwner( from ) )
{
from.CloseGump( typeof( RewardDemolitionGump ) );
from.SendGump( new RewardDemolitionGump( this, 1049783 ) ); // Do you wish to re-deed this decoration?
}
else
from.SendLocalizedMessage( 1049784 ); // You can only re-deed this decoration if you are the house owner or originally placed the decoration.
}
else
from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that.
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.WriteEncodedInt( 0 ); // version
writer.Write( (bool) m_IsRewardItem );
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadEncodedInt();
m_IsRewardItem = reader.ReadBool();
}
public bool CouldFit( IPoint3D p, Map map )
{
if ( map == null || !map.CanFit( p.X, p.Y, p.Z, ItemData.Height ) )
return false;
if ( FacingSouth )
return BaseAddon.IsWall( p.X, p.Y - 1, p.Z, map ); // north wall
else
return BaseAddon.IsWall( p.X - 1, p.Y, p.Z, map ); // west wall
}
}
public class HangingSkeletonDeed : Item, IRewardItem
{
public override int LabelNumber{ get{ return 1049772; } } // deed for a hanging skeleton decoration
private bool m_IsRewardItem;
[CommandProperty( AccessLevel.GameMaster )]
public bool IsRewardItem
{
get{ return m_IsRewardItem; }
set{ m_IsRewardItem = value; InvalidateProperties(); }
}
[Constructable]
public HangingSkeletonDeed() : base( 0x14F0 )
{
LootType = LootType.Blessed;
Weight = 1.0;
}
public HangingSkeletonDeed( Serial serial ) : base( serial )
{
}
public override void GetProperties( ObjectPropertyList list )
{
base.GetProperties( list );
if ( m_IsRewardItem )
list.Add( 1076220 ); // 4th Year Veteran Reward
}
public override void OnDoubleClick( Mobile from )
{
if ( m_IsRewardItem && !RewardSystem.CheckIsUsableBy( from, this, null ) )
return;
if ( IsChildOf( from.Backpack ) )
{
BaseHouse house = BaseHouse.FindHouseAt( from );
if ( house != null && house.IsOwner( from ) )
{
from.CloseGump( typeof( InternalGump ) );
from.SendGump( new InternalGump( this ) );
}
else
from.SendLocalizedMessage( 502092 ); // You must be in your house to do this.
}
else
from.SendLocalizedMessage( 1042038 ); // You must have the object in your backpack to use it.
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.WriteEncodedInt( 0 ); // version
writer.Write( (bool) m_IsRewardItem );
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadEncodedInt();
m_IsRewardItem = reader.ReadBool();
}
public static int GetWestItemID( int south )
{
switch ( south )
{
case 0x1B1E: return 0x1B1D;
case 0x1B7F: return 0x1B7C;
default: return south + 1;
}
}
private class InternalGump : Gump
{
private HangingSkeletonDeed m_Skeleton;
public InternalGump( HangingSkeletonDeed skeleton ) : base( 100, 200 )
{
m_Skeleton = skeleton;
Closable = true;
Disposable = true;
Dragable = true;
Resizable = false;
AddPage( 0 );
AddBackground( 25, 0, 500, 230, 0xA28 );
AddPage( 1 );
AddItem( 130, 70, 0x1A03 );
AddButton( 150, 50, 0x845, 0x846, 0x1A03, GumpButtonType.Reply, 0 );
AddItem( 190, 70, 0x1A05 );
AddButton( 210, 50, 0x845, 0x846, 0x1A05, GumpButtonType.Reply, 0 );
AddItem( 250, 70, 0x1A09 );
AddButton( 270, 50, 0x845, 0x846, 0x1A09, GumpButtonType.Reply, 0 );
AddItem( 310, 70, 0x1B1E );
AddButton( 330, 50, 0x845, 0x846, 0x1B1E, GumpButtonType.Reply, 0 );
AddItem( 370, 70, 0x1B7F );
AddButton( 390, 50, 0x845, 0x846, 0x1B7F, GumpButtonType.Reply, 0 );
}
public override void OnResponse( NetState sender, RelayInfo info )
{
if ( m_Skeleton == null | m_Skeleton.Deleted )
return;
Mobile m = sender.Mobile;
if ( info.ButtonID == 0x1A03 || info.ButtonID == 0x1A05 || info.ButtonID == 0x1A09 ||
info.ButtonID == 0x1B1E || info.ButtonID == 0x1B7F )
{
m.SendLocalizedMessage( 1049780 ); // Where would you like to place this decoration?
m.Target = new InternalTarget( m_Skeleton, info.ButtonID );
}
}
}
private class InternalTarget : Target
{
private HangingSkeletonDeed m_Skeleton;
private int m_ItemID;
public InternalTarget( HangingSkeletonDeed banner, int itemID ) : base( -1, true, TargetFlags.None )
{
m_Skeleton = banner;
m_ItemID = itemID;
}
protected override void OnTarget( Mobile from, object targeted )
{
if ( m_Skeleton == null || m_Skeleton.Deleted )
return;
if ( m_Skeleton.IsChildOf( from.Backpack ) )
{
BaseHouse house = BaseHouse.FindHouseAt( from );
if ( house != null && house.IsOwner( from ) )
{
IPoint3D p = targeted as IPoint3D;
Map map = from.Map;
if ( p == null || map == null )
return;
Point3D p3d = new Point3D( p );
ItemData id = TileData.ItemTable[ m_ItemID & TileData.MaxItemValue ];
if ( map.CanFit( p3d, id.Height ) )
{
house = BaseHouse.FindHouseAt( p3d, map, id.Height );
if ( house != null && house.IsOwner( from ) )
{
bool north = BaseAddon.IsWall( p3d.X, p3d.Y - 1, p3d.Z, map );
bool west = BaseAddon.IsWall( p3d.X - 1, p3d.Y, p3d.Z, map );
if ( north && west )
{
from.CloseGump( typeof( FacingGump ) );
from.SendGump( new FacingGump( m_Skeleton, m_ItemID, p3d, house ) );
}
else if ( north || west )
{
HangingSkeleton banner = null;
if ( north )
banner = new HangingSkeleton( m_ItemID );
else if ( west )
banner = new HangingSkeleton( GetWestItemID( m_ItemID ) );
house.Addons.Add( banner );
banner.IsRewardItem = m_Skeleton.IsRewardItem;
banner.MoveToWorld( p3d, map );
m_Skeleton.Delete();
}
else
from.SendLocalizedMessage( 1042039 ); // The banner must be placed next to a wall.
}
else
from.SendLocalizedMessage( 1042036 ); // That location is not in your house.
}
else
from.SendLocalizedMessage( 500269 ); // You cannot build that there.
}
else
from.SendLocalizedMessage( 502092 ); // You must be in your house to do this.
}
else
from.SendLocalizedMessage( 1042038 ); // You must have the object in your backpack to use it.
}
private class FacingGump : Gump
{
private HangingSkeletonDeed m_Skeleton;
private int m_ItemID;
private Point3D m_Location;
private BaseHouse m_House;
private enum Buttons
{
Cancel,
South,
East
}
public FacingGump( HangingSkeletonDeed banner, int itemID, Point3D location, BaseHouse house ) : base( 150, 50 )
{
m_Skeleton = banner;
m_ItemID = itemID;
m_Location = location;
m_House = house;
Closable = true;
Disposable = true;
Dragable = true;
Resizable = false;
AddPage( 0 );
AddBackground( 0, 0, 300, 150, 0xA28 );
AddItem( 90, 30, GetWestItemID( itemID ) );
AddItem( 180, 30, itemID );
AddButton( 50, 35, 0x868, 0x869, (int) Buttons.East, GumpButtonType.Reply, 0 );
AddButton( 145, 35, 0x868, 0x869, (int) Buttons.South, GumpButtonType.Reply, 0 );
}
public override void OnResponse( NetState sender, RelayInfo info )
{
if ( m_Skeleton == null || m_Skeleton.Deleted || m_House == null )
return;
HangingSkeleton banner = null;
if ( info.ButtonID == (int) Buttons.East )
banner = new HangingSkeleton( GetWestItemID( m_ItemID ) );
if ( info.ButtonID == (int) Buttons.South )
banner = new HangingSkeleton( m_ItemID );
if ( banner != null )
{
m_House.Addons.Add( banner );
banner.IsRewardItem = m_Skeleton.IsRewardItem;
banner.MoveToWorld( m_Location, sender.Mobile.Map );
m_Skeleton.Delete();
}
}
}
}
}
}

View file

@ -0,0 +1,422 @@
using System;
using Server.Engines.VeteranRewards;
using Server.Gumps;
using Server.Multis;
using Server.Network;
namespace Server.Items
{
public enum MiningCartType
{
OreSouth = 100,
OreEast = 101,
GemSouth = 102,
GemEast = 103
}
public class MiningCart : BaseAddon, IRewardItem
{
public override BaseAddonDeed Deed
{
get
{
MiningCartDeed deed = new MiningCartDeed();
deed.IsRewardItem = m_IsRewardItem;
deed.Gems = m_Gems;
deed.Ore = m_Ore;
return deed;
}
}
private bool m_IsRewardItem;
[CommandProperty( AccessLevel.GameMaster )]
public bool IsRewardItem
{
get{ return m_IsRewardItem; }
set{ m_IsRewardItem = value; }
}
private MiningCartType m_CartType;
[CommandProperty( AccessLevel.GameMaster )]
public MiningCartType CartType
{
get{ return m_CartType; }
}
private int m_Gems;
[CommandProperty( AccessLevel.GameMaster )]
public int Gems
{
get{ return m_Gems; }
set{ m_Gems = value; }
}
private int m_Ore;
[CommandProperty( AccessLevel.GameMaster )]
public int Ore
{
get{ return m_Ore; }
set{ m_Ore = value; }
}
private Timer m_Timer;
[Constructable]
public MiningCart( MiningCartType type ) : base()
{
m_CartType = type;
switch ( type )
{
case MiningCartType.OreSouth:
AddComponent( new AddonComponent( 0x1A83 ), 0, 0, 0 );
AddComponent( new AddonComponent( 0x1A82 ), 0, 1, 0 );
AddComponent( new AddonComponent( 0x1A86 ), 0, -1, 0 );
break;
case MiningCartType.OreEast:
AddComponent( new AddonComponent( 0x1A88 ), 0, 0, 0 );
AddComponent( new AddonComponent( 0x1A87 ), 1, 0, 0 );
AddComponent( new AddonComponent( 0x1A8B ), -1, 0, 0 );
break;
case MiningCartType.GemSouth:
AddComponent( new LocalizedAddonComponent( 0x1A83, 1080388 ), 0, 0, 0 );
AddComponent( new LocalizedAddonComponent( 0x1A82, 1080388 ), 0, 1, 0 );
AddComponent( new LocalizedAddonComponent( 0x1A86, 1080388 ), 0, -1, 0 );
AddComponent( new AddonComponent( 0xF2C ), 0, 0, 6 );
AddComponent( new AddonComponent( 0xF1D ), 0, 0, 5 );
AddComponent( new AddonComponent( 0xF2B ), 0, 0, 2 );
AddComponent( new AddonComponent( 0xF21 ), 0, 0, 1 );
AddComponent( new AddonComponent( 0xF22 ), 0, 0, 4 );
AddComponent( new AddonComponent( 0xF2F ), 0, 0, 5 );
AddComponent( new AddonComponent( 0xF26 ), 0, 0, 6 );
AddComponent( new AddonComponent( 0xF27 ), 0, 0, 3 );
AddComponent( new AddonComponent( 0xF29 ), 0, 0, 0 );
break;
case MiningCartType.GemEast:
AddComponent( new LocalizedAddonComponent( 0x1A88, 1080388 ), 0, 0, 0 );
AddComponent( new LocalizedAddonComponent( 0x1A87, 1080388 ), 1, 0, 0 );
AddComponent( new LocalizedAddonComponent( 0x1A8B, 1080388 ), -1, 0, 0 );
AddComponent( new AddonComponent( 0xF2E ), 0, 0, 6 );
AddComponent( new AddonComponent( 0xF12 ), 0, 0, 3 );
AddComponent( new AddonComponent( 0xF29 ), 0, 0, 1 );
AddComponent( new AddonComponent( 0xF24 ), 0, 0, 5 );
AddComponent( new AddonComponent( 0xF21 ), 0, 0, 1 );
AddComponent( new AddonComponent( 0xF2B ), 0, 0, 3 );
AddComponent( new AddonComponent( 0xF2F ), 0, 0, 4 );
AddComponent( new AddonComponent( 0xF23 ), 0, 0, 3 );
AddComponent( new AddonComponent( 0xF27 ), 0, 0, 3 );
break;
}
m_Timer = Timer.DelayCall( TimeSpan.FromDays( 1 ), TimeSpan.FromDays( 1 ), new TimerCallback( GiveResources ) );
}
public MiningCart( Serial serial ) : base( serial )
{
}
private void GiveResources()
{
switch ( m_CartType )
{
case MiningCartType.OreSouth:
case MiningCartType.OreEast:
m_Ore = Math.Min( 100, m_Ore + 10 );
break;
case MiningCartType.GemSouth:
case MiningCartType.GemEast:
m_Gems = Math.Min( 50, m_Gems + 5 );
break;
}
}
public override void OnComponentUsed( AddonComponent c, Mobile from )
{
BaseHouse house = BaseHouse.FindHouseAt( this );
/*
* Unique problems have unique solutions. OSI does not have a problem with 1000s of mining carts
* due to the fact that they have only a miniscule fraction of the number of 10 year vets that a
* typical RunUO shard will have (RunUO's scaled down account aging system makes this a unique problem),
* and the "freeness" of free accounts. We also dont have mitigating factors like inactive (unpaid)
* accounts not gaining veteran time.
*
* The lack of high end vets and vet rewards on OSI has made testing the *exact* ranging/stacking
* behavior of these things all but impossible, so either way its just an estimation.
*
* If youd like your shard's carts/stumps to work the way they did before, simply replace the check
* below with this line of code:
*
* if (!from.InRange(GetWorldLocation(), 2)
*
* However, I am sure these checks are more accurate to OSI than the former version was.
*
*/
if (!from.InRange(GetWorldLocation(), 2) || !from.InLOS(this) || !((from.Z - Z) > -3 && (from.Z - Z) < 3))
{
from.LocalOverheadMessage(Network.MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
}
else if ( house != null && house.HasSecureAccess( from, SecureLevel.Friends ) )
{
switch ( m_CartType )
{
case MiningCartType.OreSouth:
case MiningCartType.OreEast:
if ( m_Ore > 0 )
{
Item ingots = null;
switch ( Utility.Random( 9 ) )
{
case 0: ingots = new IronIngot(); break;
case 1: ingots = new DullCopperIngot(); break;
case 2: ingots = new ShadowIronIngot(); break;
case 3: ingots = new CopperIngot(); break;
case 4: ingots = new BronzeIngot(); break;
case 5: ingots = new GoldIngot(); break;
case 6: ingots = new AgapiteIngot(); break;
case 7: ingots = new VeriteIngot(); break;
case 8: ingots = new ValoriteIngot(); break;
}
int amount = Math.Min( 10, m_Ore );
ingots.Amount = amount;
if ( !from.PlaceInBackpack( ingots ) )
{
ingots.Delete();
from.SendLocalizedMessage( 1078837 ); // Your backpack is full! Please make room and try again.
}
else
{
PublicOverheadMessage(MessageType.Regular, 0, 1094724, amount.ToString() ); // Ore: ~1_COUNT~
m_Ore -= amount;
}
}
else
from.SendLocalizedMessage( 1094725 ); // There are no more resources available at this time.
break;
case MiningCartType.GemSouth:
case MiningCartType.GemEast:
if ( m_Gems > 0 )
{
Item gems = null;
switch ( Utility.Random( 15 ) )
{
case 0: gems = new Amber(); break;
case 1: gems = new Amethyst(); break;
case 2: gems = new Citrine(); break;
case 3: gems = new Diamond(); break;
case 4: gems = new Emerald(); break;
case 5: gems = new Ruby(); break;
case 6: gems = new Sapphire(); break;
case 7: gems = new StarSapphire(); break;
case 8: gems = new Tourmaline(); break;
// Mondain's Legacy gems
case 9: gems = new PerfectEmerald(); break;
case 10: gems = new DarkSapphire(); break;
case 11: gems = new Turquoise(); break;
case 12: gems = new EcruCitrine(); break;
case 13: gems = new FireRuby(); break;
case 14: gems = new BlueDiamond(); break;
}
int amount = Math.Min( 5, m_Gems );
gems.Amount = amount;
if ( !from.PlaceInBackpack( gems ) )
{
gems.Delete();
from.SendLocalizedMessage( 1078837 ); // Your backpack is full! Please make room and try again.
}
else
{
PublicOverheadMessage( MessageType.Regular, 0, 1094723, amount.ToString() ); // Gems: ~1_COUNT~
m_Gems -= amount;
}
}
else
from.SendLocalizedMessage( 1094725 ); // There are no more resources available at this time.
break;
}
}
else
from.SendLocalizedMessage( 1061637 ); // You are not allowed to access this.
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.WriteEncodedInt( 1 ); // version
#region version 1
writer.Write( (int) m_CartType );
#endregion
writer.Write( (bool) m_IsRewardItem );
writer.Write( (int) m_Gems );
writer.Write( (int) m_Ore );
if ( m_Timer != null )
writer.Write( (DateTime) m_Timer.Next );
else
writer.Write( (DateTime) DateTime.UtcNow + TimeSpan.FromDays( 1 ) );
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadEncodedInt();
switch ( version )
{
case 1:
m_CartType = (MiningCartType) reader.ReadInt();
goto case 0;
case 0:
m_IsRewardItem = reader.ReadBool();
m_Gems = reader.ReadInt();
m_Ore = reader.ReadInt();
DateTime next = reader.ReadDateTime();
if ( next < DateTime.UtcNow )
next = DateTime.UtcNow;
m_Timer = Timer.DelayCall( next - DateTime.UtcNow, TimeSpan.FromDays( 1 ), new TimerCallback( GiveResources ) );
break;
}
}
}
public class MiningCartDeed : BaseAddonDeed, IRewardItem, IRewardOption
{
public override int LabelNumber{ get{ return 1080385; } } // deed for a mining cart decoration
public override BaseAddon Addon
{
get
{
MiningCart addon = new MiningCart( m_CartType );
addon.IsRewardItem = m_IsRewardItem;
addon.Gems = m_Gems;
addon.Ore = m_Ore;
return addon;
}
}
private MiningCartType m_CartType;
private bool m_IsRewardItem;
[CommandProperty( AccessLevel.GameMaster )]
public bool IsRewardItem
{
get{ return m_IsRewardItem; }
set{ m_IsRewardItem = value; InvalidateProperties(); }
}
private int m_Gems;
[CommandProperty( AccessLevel.GameMaster )]
public int Gems
{
get{ return m_Gems; }
set{ m_Gems = value; }
}
private int m_Ore;
[CommandProperty( AccessLevel.GameMaster )]
public int Ore
{
get{ return m_Ore; }
set{ m_Ore = value; }
}
[Constructable]
public MiningCartDeed() : base()
{
LootType = LootType.Blessed;
}
public MiningCartDeed( Serial serial ) : base( serial )
{
}
public override void GetProperties( ObjectPropertyList list )
{
base.GetProperties( list );
if ( m_IsRewardItem )
list.Add( 1080457 ); // 10th Year Veteran Reward
}
public override void OnDoubleClick( Mobile from )
{
if ( m_IsRewardItem && !RewardSystem.CheckIsUsableBy( from, this, null ) )
return;
if ( IsChildOf( from.Backpack ) )
{
from.CloseGump( typeof( RewardOptionGump ) );
from.SendGump( new RewardOptionGump( this ) );
}
else
from.SendLocalizedMessage( 1062334 ); // This item must be in your backpack to be used.
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.WriteEncodedInt( 0 ); // version
writer.Write( (bool) m_IsRewardItem );
writer.Write( (int) m_Gems );
writer.Write( (int) m_Ore );
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadEncodedInt();
m_IsRewardItem = reader.ReadBool();
m_Gems = reader.ReadInt();
m_Ore = reader.ReadInt();
}
public void GetOptions( RewardOptionList list )
{
list.Add( (int) MiningCartType.OreSouth, 1080391 );
list.Add( (int) MiningCartType.OreEast, 1080390 );
list.Add( (int) MiningCartType.GemSouth, 1080500 );
list.Add( (int) MiningCartType.GemEast, 1080499 );
}
public void OnOptionSelected( Mobile from, int choice )
{
m_CartType = (MiningCartType) choice;
if ( !Deleted )
base.OnDoubleClick( from );
}
}
}

View file

@ -0,0 +1,180 @@
using System;
using Server;
using Server.Gumps;
using Server.Network;
using Server.Engines.VeteranRewards;
namespace Server.Items
{
public enum MinotaurStatueType
{
AttackSouth = 100,
AttackEast = 101,
DefendSouth = 102,
DefendEast = 103
}
public class MinotaurStatue : BaseAddon, IRewardItem
{
public override BaseAddonDeed Deed
{
get
{
MinotaurStatueDeed deed = new MinotaurStatueDeed();
deed.IsRewardItem = m_IsRewardItem;
return deed;
}
}
private bool m_IsRewardItem;
[CommandProperty( AccessLevel.GameMaster )]
public bool IsRewardItem
{
get{ return m_IsRewardItem; }
set{ m_IsRewardItem = value; InvalidateProperties(); }
}
[Constructable]
public MinotaurStatue( MinotaurStatueType type ) : base()
{
switch ( type )
{
case MinotaurStatueType.AttackSouth:
AddComponent( new AddonComponent( 0x306C ), 0, 0, 0 );
AddComponent( new AddonComponent( 0x306D ), -1, 0, 0 );
AddComponent( new AddonComponent( 0x306E ), 0, -1, 0 );
break;
case MinotaurStatueType.AttackEast:
AddComponent( new AddonComponent( 0x3074 ), 0, 0, 0 );
AddComponent( new AddonComponent( 0x3075 ), -1, 0, 0 );
AddComponent( new AddonComponent( 0x3076 ), 0, -1, 0 );
break;
case MinotaurStatueType.DefendSouth:
AddComponent( new AddonComponent( 0x3072 ), 0, 0, 0 );
AddComponent( new AddonComponent( 0x3073 ), 0, -1, 0 );
break;
case MinotaurStatueType.DefendEast:
AddComponent( new AddonComponent( 0x306F ), 0, 0, 0 );
AddComponent( new AddonComponent( 0x3070 ), -1, 0, 0 );
AddComponent( new AddonComponent( 0x3071 ), 0, -1, 0 );
break;
}
}
public MinotaurStatue( Serial serial ) : base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.WriteEncodedInt( 0 ); // version
writer.Write( (bool) m_IsRewardItem );
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadEncodedInt();
m_IsRewardItem = reader.ReadBool();
}
}
public class MinotaurStatueDeed : BaseAddonDeed, IRewardItem, IRewardOption
{
public override int LabelNumber{ get{ return 1080409; } } // Minotaur Statue Deed
public override BaseAddon Addon
{
get
{
MinotaurStatue addon = new MinotaurStatue( m_StatueType );
addon.IsRewardItem = m_IsRewardItem;
return addon;
}
}
private MinotaurStatueType m_StatueType;
private bool m_IsRewardItem;
[CommandProperty( AccessLevel.GameMaster )]
public bool IsRewardItem
{
get{ return m_IsRewardItem; }
set{ m_IsRewardItem = value; InvalidateProperties(); }
}
[Constructable]
public MinotaurStatueDeed() : base()
{
LootType = LootType.Blessed;
}
public MinotaurStatueDeed( Serial serial ) : base( serial )
{
}
public override void OnDoubleClick( Mobile from )
{
if ( m_IsRewardItem && !RewardSystem.CheckIsUsableBy( from, this, null ) )
return;
if ( IsChildOf( from.Backpack ) )
{
from.CloseGump( typeof( RewardOptionGump ) );
from.SendGump( new RewardOptionGump( this ) );
}
else
from.SendLocalizedMessage( 1062334 ); // This item must be in your backpack to be used.
}
public override void GetProperties( ObjectPropertyList list )
{
base.GetProperties( list );
if ( m_IsRewardItem )
list.Add( 1076218 ); // 2nd Year Veteran Reward
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.WriteEncodedInt( 0 ); // version
writer.Write( (bool) m_IsRewardItem );
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadEncodedInt();
m_IsRewardItem = reader.ReadBool();
}
public void GetOptions( RewardOptionList list )
{
list.Add( (int) MinotaurStatueType.AttackSouth, 1080410 ); // Minotaur Attack South
list.Add( (int) MinotaurStatueType.AttackEast, 1080411 ); // Minotaur Attack East
list.Add( (int) MinotaurStatueType.DefendSouth, 1080412 ); // Minotaur Defend South
list.Add( (int) MinotaurStatueType.DefendEast, 1080413 ); // Minotaur Defend East
}
public void OnOptionSelected( Mobile from, int option )
{
m_StatueType = (MinotaurStatueType) option;
if ( !Deleted )
base.OnDoubleClick( from );
}
}
}

View file

@ -0,0 +1,188 @@
using System;
using Server;
using Server.Gumps;
using Server.Network;
using Server.Engines.VeteranRewards;
namespace Server.Items
{
public class RewardPottedCactus : Item, IRewardItem
{
public override bool ForceShowProperties{ get { return ObjectPropertyList.Enabled; } }
private bool m_IsRewardItem;
[CommandProperty( AccessLevel.GameMaster )]
public bool IsRewardItem
{
get { return m_IsRewardItem; }
set { m_IsRewardItem = value; InvalidateProperties(); }
}
[Constructable]
public RewardPottedCactus() : this( Utility.RandomMinMax( 0x1E0F, 0x1E14 ) )
{
}
[Constructable]
public RewardPottedCactus( int itemID ) : base( itemID )
{
Weight = 5.0;
}
public RewardPottedCactus( Serial serial ) : base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.WriteEncodedInt( 1 ); // version
writer.Write( (bool) m_IsRewardItem );
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadEncodedInt();
switch ( version )
{
case 1:
m_IsRewardItem = reader.ReadBool();
break;
}
}
}
public class PottedCactusDeed : Item, IRewardItem
{
public override int LabelNumber{ get{ return 1080407; } } // Potted Cactus Deed
private bool m_IsRewardItem;
[CommandProperty( AccessLevel.GameMaster )]
public bool IsRewardItem
{
get{ return m_IsRewardItem; }
set{ m_IsRewardItem = value; InvalidateProperties(); }
}
[Constructable]
public PottedCactusDeed() : base( 0x14F0 )
{
LootType = LootType.Blessed;
Weight = 1.0;
}
public PottedCactusDeed( Serial serial ) : base( serial )
{
}
public override void OnDoubleClick( Mobile from )
{
if ( m_IsRewardItem && !RewardSystem.CheckIsUsableBy( from, this, null ) )
return;
if ( IsChildOf( from.Backpack ) )
{
from.CloseGump( typeof( InternalGump ) );
from.SendGump( new InternalGump( this ) );
}
else
from.SendLocalizedMessage( 1042038 ); // You must have the object in your backpack to use it.
}
public override void GetProperties( ObjectPropertyList list )
{
base.GetProperties( list );
if ( m_IsRewardItem )
list.Add( 1076219 ); // 3rd Year Veteran Reward
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.WriteEncodedInt( 0 ); // version
writer.Write( (bool) m_IsRewardItem );
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadEncodedInt();
m_IsRewardItem = reader.ReadBool();
}
private class InternalGump : Gump
{
private PottedCactusDeed m_Cactus;
public InternalGump( PottedCactusDeed cactus ) : base( 100, 200 )
{
m_Cactus = cactus;
Closable = true;
Disposable = true;
Dragable = true;
Resizable = false;
AddPage( 0 );
AddBackground( 0, 0, 425, 250, 0xA28 );
AddPage( 1 );
AddLabel( 45, 15, 0, "Choose a Potted Cactus:" );
AddItem( 45, 75, 0x1E0F );
AddButton( 55, 50, 0x845, 0x846, 0x1E0F, GumpButtonType.Reply, 0 );
AddItem( 105, 75, 0x1E10 );
AddButton( 115, 50, 0x845, 0x846, 0x1E10, GumpButtonType.Reply, 0 );
AddItem( 160, 75, 0x1E14 );
AddButton( 175, 50, 0x845, 0x846, 0x1E14, GumpButtonType.Reply, 0 );
AddItem( 220, 75, 0x1E11 );
AddButton( 235, 50, 0x845, 0x846, 0x1E11, GumpButtonType.Reply, 0 );
AddItem( 280, 75, 0x1E12 );
AddButton( 295, 50, 0x845, 0x846, 0x1E12, GumpButtonType.Reply, 0 );
AddItem( 340, 75, 0x1E13 );
AddButton( 355, 50, 0x845, 0x846, 0x1E13, GumpButtonType.Reply, 0 );
}
public override void OnResponse( NetState sender, RelayInfo info )
{
if ( m_Cactus == null | m_Cactus.Deleted )
return;
Mobile m = sender.Mobile;
if ( info.ButtonID >= 0x1E0F && info.ButtonID <= 0x1E14 )
{
RewardPottedCactus cactus = new RewardPottedCactus( info.ButtonID );
cactus.IsRewardItem = m_Cactus.IsRewardItem;
if ( !m.PlaceInBackpack( cactus ) )
{
cactus.Delete();
m.SendLocalizedMessage( 1078837 ); // Your backpack is full! Please make room and try again.
}
else
m_Cactus.Delete();
}
}
}
}
}

View file

@ -0,0 +1,269 @@
using System;
using Server;
using Server.Multis;
using Server.Gumps;
using Server.Network;
using Server.Engines.VeteranRewards;
namespace Server.Items
{
public class StoneAnkhComponent : AddonComponent
{
public override bool ForceShowProperties{ get{ return ObjectPropertyList.Enabled; } }
public StoneAnkhComponent( int itemID ) : base( itemID )
{
Weight = 1.0;
}
public StoneAnkhComponent( Serial serial ) : base( serial )
{
}
public override void GetProperties( ObjectPropertyList list )
{
base.GetProperties( list );
if ( Addon is StoneAnkh && ((StoneAnkh) Addon).IsRewardItem )
list.Add( 1076221 ); // 5th Year Veteran Reward
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.WriteEncodedInt( 0 ); // version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadEncodedInt();
}
}
public class StoneAnkh : BaseAddon, IRewardItem
{
public override BaseAddonDeed Deed
{
get
{
StoneAnkhDeed deed = new StoneAnkhDeed();
deed.IsRewardItem = m_IsRewardItem;
return deed;
}
}
private bool m_IsRewardItem;
[CommandProperty( AccessLevel.GameMaster )]
public bool IsRewardItem
{
get{ return m_IsRewardItem; }
set{ m_IsRewardItem = value; InvalidateProperties(); }
}
[Constructable]
public StoneAnkh() : this( true )
{
}
[Constructable]
public StoneAnkh( bool east ) : base()
{
if ( east )
{
AddComponent( new StoneAnkhComponent( 0x2 ), 0, 0, 0 );
AddComponent( new StoneAnkhComponent( 0x3 ), 0, -1, 0 );
}
else
{
AddComponent( new StoneAnkhComponent( 0x5 ), 0, 0, 0 );
AddComponent( new StoneAnkhComponent( 0x4 ), -1, 0, 0 );
}
}
public StoneAnkh( Serial serial ) : base( serial )
{
}
public override void OnChop( Mobile from )
{
from.SendLocalizedMessage( 500489 ); // You can't use an axe on that.
return;
}
public override void GetProperties( ObjectPropertyList list )
{
base.GetProperties( list );
if ( Core.ML && m_IsRewardItem )
list.Add( 1076221 ); // 5th Year Veteran Reward
}
public override void OnComponentUsed( AddonComponent c, Mobile from )
{
if ( from.InRange( Location, 2 ) )
{
BaseHouse house = BaseHouse.FindHouseAt( this );
if ( house != null && house.IsOwner( from ) )
{
from.CloseGump( typeof( RewardDemolitionGump ) );
from.SendGump( new RewardDemolitionGump( this, 1049783 ) ); // Do you wish to re-deed this decoration?
}
else
from.SendLocalizedMessage( 1049784 ); // You can only re-deed this decoration if you are the house owner or originally placed the decoration.
}
else
from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that.
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.WriteEncodedInt( 0 ); // version
writer.Write( (bool) m_IsRewardItem );
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadEncodedInt();
m_IsRewardItem = reader.ReadBool();
}
}
public class StoneAnkhDeed : BaseAddonDeed, IRewardItem
{
public override int LabelNumber{ get{ return 1049773; } } // deed for a stone ankh
private bool m_East;
private bool m_IsRewardItem;
[CommandProperty( AccessLevel.GameMaster )]
public bool IsRewardItem
{
get{ return m_IsRewardItem; }
set{ m_IsRewardItem = value; InvalidateProperties(); }
}
public override BaseAddon Addon
{
get
{
StoneAnkh addon = new StoneAnkh( m_East );
addon.IsRewardItem = m_IsRewardItem;
return addon;
}
}
[Constructable]
public StoneAnkhDeed() : base()
{
LootType = LootType.Blessed;
}
public StoneAnkhDeed( Serial serial ) : base( serial )
{
}
public override void OnDoubleClick( Mobile from )
{
if ( m_IsRewardItem && !RewardSystem.CheckIsUsableBy( from, this, null ) )
return;
if ( IsChildOf( from.Backpack ) )
{
from.CloseGump( typeof( InternalGump ) );
from.SendGump( new InternalGump( this ) );
}
else
from.SendLocalizedMessage( 1042038 ); // You must have the object in your backpack to use it.
}
private void SendTarget( Mobile m )
{
base.OnDoubleClick( m );
}
public override void GetProperties( ObjectPropertyList list )
{
base.GetProperties( list );
if ( m_IsRewardItem )
list.Add( 1076221 ); // 5th Year Veteran Reward
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.WriteEncodedInt( 0 ); // version
writer.Write( (bool) m_IsRewardItem );
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadEncodedInt();
m_IsRewardItem = reader.ReadBool();
}
private class InternalGump : Gump
{
private StoneAnkhDeed m_Deed;
private enum Buttons
{
Cancel,
South,
East
}
public InternalGump( StoneAnkhDeed deed ) : base( 150, 50 )
{
m_Deed = deed;
Closable = true;
Disposable = true;
Dragable = true;
Resizable = false;
AddPage( 0 );
AddBackground( 0, 0, 300, 150, 0xA28 );
AddItem( 90, 30, 0x4 );
AddItem( 112, 30, 0x5 );
AddButton( 50, 35, 0x867, 0x869, (int) Buttons.South, GumpButtonType.Reply, 0 ); // South
AddItem( 170, 30, 0x2 );
AddItem( 192, 30, 0x3 );
AddButton( 145, 35, 0x867, 0x869, (int) Buttons.East, GumpButtonType.Reply, 0 ); // East
}
public override void OnResponse( NetState sender, RelayInfo info )
{
if ( m_Deed == null || m_Deed.Deleted )
return;
if ( info.ButtonID != (int) Buttons.Cancel )
{
m_Deed.m_East = ( info.ButtonID == (int) Buttons.East );
m_Deed.SendTarget( sender.Mobile );
}
}
}
}
}

View file

@ -0,0 +1,267 @@
using System;
using Server.Engines.VeteranRewards;
using Server.Gumps;
using Server.Multis;
using Server.Network;
namespace Server.Items
{
public class TreeStump : BaseAddon, IRewardItem
{
public override BaseAddonDeed Deed
{
get
{
TreeStumpDeed deed = new TreeStumpDeed();
deed.IsRewardItem = m_IsRewardItem;
deed.Logs = m_Logs;
return deed;
}
}
private bool m_IsRewardItem;
[CommandProperty( AccessLevel.GameMaster )]
public bool IsRewardItem
{
get{ return m_IsRewardItem; }
set{ m_IsRewardItem = value; InvalidateProperties(); }
}
private int m_Logs;
[CommandProperty( AccessLevel.GameMaster )]
public int Logs
{
get{ return m_Logs; }
set{ m_Logs = value; InvalidateProperties(); }
}
private Timer m_Timer;
[Constructable]
public TreeStump( int itemID ) : base()
{
AddComponent( new AddonComponent( itemID ), 0, 0, 0 );
m_Timer = Timer.DelayCall( TimeSpan.FromDays( 1 ), TimeSpan.FromDays( 1 ), new TimerCallback( GiveLogs ) );
}
public TreeStump( Serial serial ) : base( serial )
{
}
private void GiveLogs()
{
m_Logs = Math.Min( 100, m_Logs + 10 );
}
public override void OnComponentUsed( AddonComponent c, Mobile from )
{
BaseHouse house = BaseHouse.FindHouseAt( this );
/*
* Unique problems have unique solutions. OSI does not have a problem with 1000s of mining carts
* due to the fact that they have only a miniscule fraction of the number of 10 year vets that a
* typical RunUO shard will have (RunUO's scaled down account aging system makes this a unique problem),
* and the "freeness" of free accounts. We also dont have mitigating factors like inactive (unpaid)
* accounts not gaining veteran time.
*
* The lack of high end vets and vet rewards on OSI has made testing the *exact* ranging/stacking
* behavior of these things all but impossible, so either way its just an estimation.
*
* If youd like your shard's carts/stumps to work the way they did before, simply replace the check
* below with this line of code:
*
* if (!from.InRange(GetWorldLocation(), 2)
*
* However, I am sure these checks are more accurate to OSI than the former version was.
*
*/
if (!from.InRange(GetWorldLocation(), 2) || !from.InLOS(this) || !((from.Z - Z) > -3 && (from.Z - Z) < 3))
{
from.LocalOverheadMessage(Network.MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
}
else if ( house != null && house.HasSecureAccess( from, SecureLevel.Friends ) )
{
if ( m_Logs > 0 )
{
Item logs = null;
switch ( Utility.Random( 7 ) )
{
case 0: logs = new Log(); break;
case 1: logs = new AshLog(); break;
case 2: logs = new OakLog(); break;
case 3: logs = new YewLog(); break;
case 4: logs = new HeartwoodLog(); break;
case 5: logs = new BloodwoodLog(); break;
case 6: logs = new FrostwoodLog(); break;
}
int amount = Math.Min( 10, m_Logs );
logs.Amount = amount;
if ( !from.PlaceInBackpack( logs ) )
{
logs.Delete();
from.SendLocalizedMessage( 1078837 ); // Your backpack is full! Please make room and try again.
}
else
{
m_Logs -= amount;
PublicOverheadMessage( MessageType.Regular, 0, 1094719, m_Logs.ToString() ); // Logs: ~1_COUNT~
}
}
else
from.SendLocalizedMessage( 1094720 ); // There are no more logs available.
}
else
from.SendLocalizedMessage( 1061637 ); // You are not allowed to access this.
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.WriteEncodedInt( 0 ); // version
writer.Write( (bool) m_IsRewardItem );
writer.Write( (int) m_Logs );
if ( m_Timer != null )
writer.Write( (DateTime) m_Timer.Next );
else
writer.Write( (DateTime) DateTime.UtcNow + TimeSpan.FromDays( 1 ) );
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadEncodedInt();
m_IsRewardItem = reader.ReadBool();
m_Logs = reader.ReadInt();
DateTime next = reader.ReadDateTime();
if ( next < DateTime.UtcNow )
next = DateTime.UtcNow;
m_Timer = Timer.DelayCall( next - DateTime.UtcNow, TimeSpan.FromDays( 1 ), new TimerCallback( GiveLogs ) );
}
}
public class TreeStumpDeed : BaseAddonDeed, IRewardItem, IRewardOption
{
public override int LabelNumber{ get{ return 1080406; } } // a deed for a tree stump decoration
public override BaseAddon Addon
{
get
{
TreeStump addon = new TreeStump( m_ItemID );
addon.IsRewardItem = m_IsRewardItem;
addon.Logs = m_Logs;
return addon;
}
}
private int m_ItemID;
private bool m_IsRewardItem;
[CommandProperty( AccessLevel.GameMaster )]
public bool IsRewardItem
{
get{ return m_IsRewardItem; }
set{ m_IsRewardItem = value; InvalidateProperties(); }
}
private int m_Logs;
[CommandProperty( AccessLevel.GameMaster )]
public int Logs
{
get{ return m_Logs; }
set{ m_Logs = value; InvalidateProperties(); }
}
[Constructable]
public TreeStumpDeed() : base()
{
LootType = LootType.Blessed;
}
public TreeStumpDeed( Serial serial ) : base( serial )
{
}
public override void GetProperties( ObjectPropertyList list )
{
base.GetProperties( list );
if ( m_IsRewardItem )
list.Add( 1076223 ); // 7th Year Veteran Reward
}
public override void OnDoubleClick( Mobile from )
{
if ( m_IsRewardItem && !RewardSystem.CheckIsUsableBy( from, this, null ) )
return;
if ( IsChildOf( from.Backpack ) )
{
from.CloseGump( typeof( RewardOptionGump ) );
from.SendGump( new RewardOptionGump( this ) );
}
else
from.SendLocalizedMessage( 1062334 ); // This item must be in your backpack to be used.
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.WriteEncodedInt( 0 ); // version
writer.Write( (bool) m_IsRewardItem );
writer.Write( (int) m_Logs );
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadEncodedInt();
m_IsRewardItem = reader.ReadBool();
m_Logs = reader.ReadInt();
}
public void GetOptions( RewardOptionList list )
{
list.Add( 1, 1080403 ); // Tree Stump with Axe West
list.Add( 2, 1080404 ); // Tree Stump with Axe North
list.Add( 3, 1080401 ); // Tree Stump East
list.Add( 4, 1080402 ); // Tree Stump South
}
public void OnOptionSelected( Mobile from, int option )
{
switch ( option )
{
case 1: m_ItemID = 0xE56; break;
case 2: m_ItemID = 0xE58; break;
case 3: m_ItemID = 0xE57; break;
case 4: m_ItemID = 0xE59; break;
}
if ( !Deleted )
base.OnDoubleClick( from );
}
}
}

View file

@ -0,0 +1,500 @@
using System;
using Server;
using Server.Gumps;
using Server.Multis;
using Server.Network;
using Server.Targeting;
using Server.Engines.VeteranRewards;
namespace Server.Items
{
public class WallBannerComponent : AddonComponent, IDyable
{
public override bool NeedsWall{ get{ return true; } }
public override Point3D WallPosition{ get{ return this.East ? new Point3D( -1, 0, 0 ) : new Point3D( 0, -1, 0 ); } }
public bool East{ get { return ((WallBanner)Addon).East; } }
public WallBannerComponent( int itemID ) : base( itemID )
{
}
public WallBannerComponent( Serial serial ) : base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.WriteEncodedInt( 0 ); // version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadEncodedInt();
}
public bool Dye( Mobile from, DyeTub sender )
{
if ( Deleted )
return false;
if ( Addon != null )
Addon.Hue = sender.DyedHue;
return true;
}
}
public class WallBanner : BaseAddon, IRewardItem
{
public override BaseAddonDeed Deed
{
get
{
WallBannerDeed deed = new WallBannerDeed();
deed.IsRewardItem = m_IsRewardItem;
return deed;
}
}
private bool m_IsRewardItem;
[CommandProperty( AccessLevel.GameMaster )]
public bool IsRewardItem
{
get{ return m_IsRewardItem; }
set{ m_IsRewardItem = value; InvalidateProperties(); }
}
private bool m_East;
[CommandProperty( AccessLevel.GameMaster )]
public bool East
{
get{ return m_East; }
set{ m_IsRewardItem = value; InvalidateProperties(); }
}
[Constructable]
public WallBanner( int bannerID ) : base()
{
m_East = ((bannerID % 2) == 1 );
switch ( bannerID )
{
case 1:
AddComponent( new WallBannerComponent( 0x161F ), 0, 0, 0 );
AddComponent( new WallBannerComponent( 0x161E ), 0, 1, 0 );
AddComponent( new WallBannerComponent( 0x161D ), 0, 2, 0 );
break;
case 2:
AddComponent( new WallBannerComponent( 0x1586 ), 0, 0, 0 );
AddComponent( new WallBannerComponent( 0x1587 ), 1, 0, 0 );
AddComponent( new WallBannerComponent( 0x1588 ), 2, 0, 0 );
break;
case 3:
AddComponent( new WallBannerComponent( 0x1622 ), 0, 0, 0 );
AddComponent( new WallBannerComponent( 0x1621 ), 0, 1, 0 );
AddComponent( new WallBannerComponent( 0x1620 ), 0, 2, 0 );
break;
case 4:
AddComponent( new WallBannerComponent( 0x1589 ), 0, 0, 0 );
AddComponent( new WallBannerComponent( 0x158A ), 1, 0, 0 );
AddComponent( new WallBannerComponent( 0x158B ), 2, 0, 0 );
break;
case 5:
AddComponent( new WallBannerComponent( 0x1625 ), 0, 0, 0 );
AddComponent( new WallBannerComponent( 0x1624 ), 0, 1, 0 );
AddComponent( new WallBannerComponent( 0x1623 ), 0, 2, 0 );
break;
case 6:
AddComponent( new WallBannerComponent( 0x158C ), 0, 0, 0 );
AddComponent( new WallBannerComponent( 0x158D ), 1, 0, 0 );
AddComponent( new WallBannerComponent( 0x158E ), 2, 0, 0 );
break;
case 7:
AddComponent( new WallBannerComponent( 0x1628 ), 0, 0, 0 );
AddComponent( new WallBannerComponent( 0x1627 ), 0, 1, 0 );
AddComponent( new WallBannerComponent( 0x1626 ), 0, 2, 0 );
break;
case 8:
AddComponent( new WallBannerComponent( 0x1590 ), 0, 0, 0 );
AddComponent( new WallBannerComponent( 0x1591 ), 1, 0, 0 );
AddComponent( new WallBannerComponent( 0x158F ), 2, 0, 0 );
break;
case 9:
AddComponent( new WallBannerComponent( 0x162A ), 0, 0, 0 );
AddComponent( new WallBannerComponent( 0x1629 ), 0, 1, 0 );
AddComponent( new WallBannerComponent( 0x1626 ), 0, 2, 0 );
break;
case 10:
AddComponent( new WallBannerComponent( 0x1592 ), 0, 0, 0 );
AddComponent( new WallBannerComponent( 0x1593 ), 1, 0, 0 );
AddComponent( new WallBannerComponent( 0x158F ), 2, 0, 0 );
break;
case 11:
AddComponent( new WallBannerComponent( 0x162D ), 0, 0, 0 );
AddComponent( new WallBannerComponent( 0x162C ), 0, 1, 0 );
AddComponent( new WallBannerComponent( 0x162B ), 0, 2, 0 );
break;
case 12:
AddComponent( new WallBannerComponent( 0x1594 ), 0, 0, 0 );
AddComponent( new WallBannerComponent( 0x1595 ), 1, 0, 0 );
AddComponent( new WallBannerComponent( 0x1596 ), 2, 0, 0 );
break;
case 13:
AddComponent( new WallBannerComponent( 0x1632 ), 0, 0, 0 );
AddComponent( new WallBannerComponent( 0x1631 ), 0, 1, 0 );
AddComponent( new WallBannerComponent( 0x162E ), 0, 2, 0 );
break;
case 14:
AddComponent( new WallBannerComponent( 0x1598 ), 0, 0, 0 );
AddComponent( new WallBannerComponent( 0x159B ), 1, 0, 0 );
AddComponent( new WallBannerComponent( 0x159C ), 2, 0, 0 );
break;
case 15:
AddComponent( new WallBannerComponent( 0x1633 ), 0, 0, 0 );
AddComponent( new WallBannerComponent( 0x1630 ), 0, 1, 0 );
AddComponent( new WallBannerComponent( 0x162F ), 0, 2, 0 );
break;
case 16:
AddComponent( new WallBannerComponent( 0x1599 ), 0, 0, 0 );
AddComponent( new WallBannerComponent( 0x159A ), 1, 0, 0 );
AddComponent( new WallBannerComponent( 0x159D ), 2, 0, 0 );
break;
case 17:
AddComponent( new WallBannerComponent( 0x1610 ), 0, 0, 0 );
AddComponent( new WallBannerComponent( 0x160F ), 0, 1, 0 );
break;
case 18:
AddComponent( new WallBannerComponent( 0x15A0 ), 0, 0, 0 );
AddComponent( new WallBannerComponent( 0x15A1 ), 1, 0, 0 );
break;
case 19:
AddComponent( new WallBannerComponent( 0x1612 ), 0, 0, 0 );
AddComponent( new WallBannerComponent( 0x1611 ), 0, 1, 0 );
break;
case 20:
AddComponent( new WallBannerComponent( 0x15A2 ), 0, 0, 0 );
AddComponent( new WallBannerComponent( 0x15A3 ), 1, 0, 0 );
break;
case 21:
AddComponent( new WallBannerComponent( 0x1614 ), 0, 0, 0 );
AddComponent( new WallBannerComponent( 0x1613 ), 0, 1, 0 );
break;
case 22:
AddComponent( new WallBannerComponent( 0x15A4 ), 0, 0, 0 );
AddComponent( new WallBannerComponent( 0x15A5 ), 1, 0, 0 );
break;
case 23:
AddComponent( new WallBannerComponent( 0x1616 ), 0, 0, 0 );
AddComponent( new WallBannerComponent( 0x1615 ), 0, 1, 0 );
break;
case 24:
AddComponent( new WallBannerComponent( 0x15A6 ), 0, 0, 0 );
AddComponent( new WallBannerComponent( 0x15A7 ), 1, 0, 0 );
break;
case 25:
AddComponent( new WallBannerComponent( 0x1618 ), 0, 0, 0 );
AddComponent( new WallBannerComponent( 0x1617 ), 0, 1, 0 );
break;
case 26:
AddComponent( new WallBannerComponent( 0x15A8 ), 0, 0, 0 );
AddComponent( new WallBannerComponent( 0x15A9 ), 1, 0, 0 );
break;
case 27:
AddComponent( new WallBannerComponent( 0x161A ), 0, 0, 0 );
AddComponent( new WallBannerComponent( 0x1619 ), 0, 1, 0 );
break;
case 28:
AddComponent( new WallBannerComponent( 0x15AA ), 0, 0, 0 );
AddComponent( new WallBannerComponent( 0x15AB ), 1, 0, 0 );
break;
case 29:
AddComponent( new WallBannerComponent( 0x161C ), 0, 0, 0 );
AddComponent( new WallBannerComponent( 0x161B ), 0, 1, 0 );
break;
case 30:
AddComponent( new WallBannerComponent( 0x15AC ), 0, 0, 0 );
AddComponent( new WallBannerComponent( 0x15AD ), 1, 0, 0 );
break;
}
}
public WallBanner( Serial serial ) : base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.WriteEncodedInt( 0 ); // version
writer.Write( (bool) m_East );
writer.Write( (bool) m_IsRewardItem );
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadEncodedInt();
m_East = reader.ReadBool();
m_IsRewardItem = reader.ReadBool();
}
}
public class WallBannerDeed : BaseAddonDeed, IRewardItem
{
public override int LabelNumber{ get{ return 1080549; } } // Wall Banner Deed
public override BaseAddon Addon
{
get
{
WallBanner addon = new WallBanner( m_BannerID );
addon.IsRewardItem = m_IsRewardItem;
return addon;
}
}
private int m_BannerID;
private bool m_IsRewardItem;
[CommandProperty( AccessLevel.GameMaster )]
public bool IsRewardItem
{
get{ return m_IsRewardItem; }
set{ m_IsRewardItem = value; InvalidateProperties(); }
}
[Constructable]
public WallBannerDeed() : base()
{
LootType = LootType.Blessed;
}
public WallBannerDeed( Serial serial ) : base( serial )
{
}
public override void GetProperties( ObjectPropertyList list )
{
base.GetProperties( list );
if ( m_IsRewardItem )
list.Add( 1076225 ); // 9th Year Veteran Reward
}
public override void OnDoubleClick( Mobile from )
{
if ( m_IsRewardItem && !RewardSystem.CheckIsUsableBy( from, this, null ) )
return;
if ( IsChildOf( from.Backpack ) )
{
from.CloseGump( typeof( InternalGump ) );
from.SendGump( new InternalGump( this ) );
}
else
from.SendLocalizedMessage( 1042038 ); // You must have the object in your backpack to use it.
}
public void Use( Mobile m, int bannerID )
{
m_BannerID = bannerID;
base.OnDoubleClick( m );
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.WriteEncodedInt( 0 ); // version
writer.Write( (bool) m_IsRewardItem );
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadEncodedInt();
m_IsRewardItem = reader.ReadBool();
}
private class InternalGump : Gump
{
private WallBannerDeed m_WallBanner;
public InternalGump( WallBannerDeed WallBanner ) : base( 150, 50 )
{
m_WallBanner = WallBanner;
Closable = true;
Disposable = true;
Dragable = true;
Resizable = false;
AddBackground( 25, 0, 500, 265, 0xA28 );
AddLabel( 70, 12, 0x3E3, "Choose a Wall Banner:" );
AddPage( 1 );
AddItem( 55, 110, 0x161D );
AddItem( 75, 90, 0x161E );
AddItem( 95, 70, 0x161F );
AddButton( 70, 50, 0x845, 0x846, 1, GumpButtonType.Reply, 0 );
AddItem( 105, 70, 0x1586 );
AddItem( 125, 90, 0x1587 );
AddItem( 145, 110, 0x1588 );
AddButton( 145, 50, 0x845, 0x846, 2, GumpButtonType.Reply, 0 );
AddItem( 200, 110, 0x1620 );
AddItem( 220, 90, 0x1621 );
AddItem( 240, 70, 0x1622 );
AddButton( 220, 50, 0x845, 0x846, 3, GumpButtonType.Reply, 0 );
AddItem( 250, 70, 0x1589 );
AddItem( 270, 90, 0x158A );
AddItem( 290, 110, 0x158B );
AddButton( 300, 50, 0x845, 0x846, 4, GumpButtonType.Reply, 0 );
AddItem( 350, 110, 0x1623 );
AddItem( 370, 90, 0x1624 );
AddItem( 390, 70, 0x1625 );
AddButton( 365, 50, 0x845, 0x846, 5, GumpButtonType.Reply, 0 );
AddItem( 400, 70, 0x158C );
AddItem( 420, 90, 0x158D );
AddItem( 440, 110, 0x158E );
AddButton( 445, 50, 0x845, 0x846, 6, GumpButtonType.Reply, 0 );
AddButton( 455, 205, 0x8B0, 0x8B0, 0, GumpButtonType.Page, 2 );
AddPage( 2 );
AddItem( 52, 110, 0x1626 );
AddItem( 72, 90, 0x1627 );
AddItem( 95, 70, 0x1628 );
AddButton( 70, 50, 0x845, 0x846, 7, GumpButtonType.Reply, 0 );
AddItem( 105, 70, 0x1590 );
AddItem( 125, 90, 0x1591 );
AddItem( 145, 110, 0x158F );
AddButton( 145, 50, 0x845, 0x846, 8, GumpButtonType.Reply, 0 );
AddItem( 197, 110, 0x1626 );
AddItem( 217, 90, 0x1629 );
AddItem( 240, 70, 0x162A );
AddButton( 220, 50, 0x845, 0x846, 9, GumpButtonType.Reply, 0 );
AddItem( 250, 70, 0x1592 );
AddItem( 270, 90, 0x1593 );
AddItem( 290, 110, 0x158F );
AddButton( 300, 50, 0x845, 0x846, 10, GumpButtonType.Reply, 0 );
AddItem( 340, 110, 0x162B );
AddItem( 363, 90, 0x162C );
AddItem( 385, 70, 0x162D );
AddButton( 365, 50, 0x845, 0x846, 11, GumpButtonType.Reply, 0 );
AddItem( 395, 70, 0x1594 );
AddItem( 417, 90, 0x1595 );
AddItem( 439, 111, 0x1596 );
AddButton( 445, 50, 0x845, 0x846, 12, GumpButtonType.Reply, 0 );
AddButton( 70, 205, 0x8AF, 0x8AF, 0, GumpButtonType.Page, 1 );
AddButton( 455, 205, 0x8B0, 0x8B0, 0, GumpButtonType.Page, 3 );
AddPage( 3 );
AddItem( 55, 110, 0x162E );
AddItem( 75, 93, 0x1631 );
AddItem( 95, 70, 0x1632 );
AddButton( 70, 50, 0x845, 0x846, 13, GumpButtonType.Reply, 0 );
AddItem( 118, 70, 0x1598 );
AddItem( 138, 94, 0x159B );
AddItem( 159, 113, 0x159C );
AddButton( 160, 50, 0x845, 0x846, 14, GumpButtonType.Reply, 0 );
AddItem( 219, 111, 0x162F );
AddItem( 238, 94, 0x1630 );
AddItem( 258, 70, 0x1633 );
AddButton( 240, 50, 0x845, 0x846, 15, GumpButtonType.Reply, 0 );
AddItem( 279, 70, 0x1599 );
AddItem( 298, 93, 0x159A );
AddItem( 319, 113, 0x159D );
AddButton( 320, 50, 0x845, 0x846, 16, GumpButtonType.Reply, 0 );
AddItem( 380, 90, 0x160F );
AddItem( 400, 70, 0x1610 );
AddButton( 390, 50, 0x845, 0x846, 17, GumpButtonType.Reply, 0 );
AddItem( 420, 70, 0x15A0 );
AddItem( 440, 90, 0x15A1 );
AddButton( 455, 50, 0x845, 0x846, 18, GumpButtonType.Reply, 0 );
AddButton( 70, 205, 0x8AF, 0x8AF, 0, GumpButtonType.Page, 2 );
AddButton( 455, 205, 0x8B0, 0x8B0, 0, GumpButtonType.Page, 4 );
AddPage( 4 );
AddItem( 55, 90, 0x1611 );
AddItem( 75, 70, 0x1612 );
AddButton( 70, 50, 0x845, 0x846, 19, GumpButtonType.Reply, 0 );
AddItem( 105, 70, 0x15A2 );
AddItem( 125, 90, 0x15A3 );
AddButton( 145, 50, 0x845, 0x846, 20, GumpButtonType.Reply, 0 );
AddItem( 200, 84, 0x1613 );
AddItem( 220, 70, 0x1614 );
AddButton( 215, 50, 0x845, 0x846, 21, GumpButtonType.Reply, 0 );
AddItem( 250, 70, 0x15A4 );
AddItem( 270, 84, 0x15A5 );
AddButton( 290, 50, 0x845, 0x846, 22, GumpButtonType.Reply, 0 );
AddItem( 350, 90, 0x1615 );
AddItem( 370, 70, 0x1616 );
AddButton( 365, 50, 0x845, 0x846, 23, GumpButtonType.Reply, 0 );
AddItem( 400, 70, 0x15A6 );
AddItem( 420, 90, 0x15A7 );
AddButton( 445, 50, 0x845, 0x846, 24, GumpButtonType.Reply, 0 );
AddButton( 70, 205, 0x8AF, 0x8AF, 0, GumpButtonType.Page, 3 );
AddButton( 455, 205, 0x8B0, 0x8B0, 0, GumpButtonType.Page, 5 );
AddPage( 5 );
AddItem( 55, 90, 0x1617 );
AddItem( 77, 70, 0x1618 );
AddButton( 70, 50, 0x845, 0x846, 25, GumpButtonType.Reply, 0 );
AddItem( 105, 70, 0x15A8 );
AddItem( 127, 90, 0x15A9 );
AddButton( 145, 50, 0x845, 0x846, 26, GumpButtonType.Reply, 0 );
AddItem( 200, 90, 0x1619 );
AddItem( 222, 70, 0x161A );
AddButton( 220, 50, 0x845, 0x846, 27, GumpButtonType.Reply, 0 );
AddItem( 250, 70, 0x15AA );
AddItem( 272, 90, 0x15AB );
AddButton( 300, 50, 0x845, 0x846, 28, GumpButtonType.Reply, 0 );
AddItem( 350, 90, 0x161B );
AddItem( 372, 70, 0x161C );
AddButton( 365, 50, 0x845, 0x846, 29, GumpButtonType.Reply, 0 );
AddItem( 400, 70, 0x15AC );
AddItem( 422, 90, 0x15AD );
AddButton( 445, 50, 0x845, 0x846, 30, GumpButtonType.Reply, 0 );
AddButton( 70, 205, 0x8AF, 0x8AF, 0, GumpButtonType.Page, 4 );
}
public override void OnResponse( NetState sender, RelayInfo info )
{
if ( m_WallBanner == null || m_WallBanner.Deleted )
return;
if ( info.ButtonID > 0 && info.ButtonID < 31 )
m_WallBanner.Use( sender.Mobile, info.ButtonID );
}
}
}
}

View file

@ -0,0 +1,330 @@
using System;
using Server;
using Server.Mobiles;
using Server.Targeting;
using Server.Gumps;
using Server.Engines.VeteranRewards;
namespace Server.Items
{
public class WeaponEngravingTool : Item, IUsesRemaining, IRewardItem
{
public override int LabelNumber{ get{ return 1076158; } } // Weapon Engraving Tool
private int m_UsesRemaining;
private bool m_IsRewardItem;
[CommandProperty( AccessLevel.GameMaster )]
public int UsesRemaining
{
get{ return m_UsesRemaining; }
set{ m_UsesRemaining = value; InvalidateProperties(); }
}
public virtual bool ShowUsesRemaining
{
get{ return true; }
set{}
}
[CommandProperty( AccessLevel.GameMaster )]
public bool IsRewardItem
{
get{ return m_IsRewardItem; }
set{ m_IsRewardItem = value; InvalidateProperties(); }
}
[Constructable]
public WeaponEngravingTool() : this( 10 )
{
}
[Constructable]
public WeaponEngravingTool( int uses ) : base( 0x32F8 )
{
LootType = LootType.Blessed;
Weight = 1.0;
m_UsesRemaining = uses;
}
public WeaponEngravingTool( Serial serial ) : base( serial )
{
}
public override void OnDoubleClick( Mobile from )
{
if ( m_IsRewardItem && !RewardSystem.CheckIsUsableBy( from, this, null ) )
return;
if ( m_UsesRemaining > 0 )
{
from.SendLocalizedMessage( 1072357 ); // Select an object to engrave.
from.Target = new TargetWeapon( this );
}
else
{
if ( from.Skills.Tinkering.Value == 0 )
{
from.SendLocalizedMessage( 1076179 ); // Since you have no tinkering skill, you will need to find an NPC tinkerer to repair this for you.
}
else if ( from.Skills.Tinkering.Value < 75.0 )
{
from.SendLocalizedMessage( 1076178 ); // Your tinkering skill is too low to fix this yourself. An NPC tinkerer can help you repair this for a fee.
}
else
{
Item diamond = from.Backpack.FindItemByType( typeof( BlueDiamond ) );
if ( diamond != null )
from.SendGump( new ConfirmGump( this, null ) );
else
from.SendLocalizedMessage( 1076166 ); // You do not have a blue diamond needed to recharge the engraving tool.
}
from.SendLocalizedMessage( 1076163 ); // There are no charges left on this engraving tool.
}
}
public override void GetProperties( ObjectPropertyList list )
{
base.GetProperties( list );
if ( m_IsRewardItem )
list.Add( 1076224 ); // 8th Year Veteran Reward
if ( ShowUsesRemaining )
list.Add( 1060584, m_UsesRemaining.ToString() ); // uses remaining: ~1_val~
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
writer.Write( (int) m_UsesRemaining );
writer.Write( (bool) m_IsRewardItem );
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
m_UsesRemaining = reader.ReadInt();
m_IsRewardItem = reader.ReadBool();
}
public virtual void Recharge( Mobile from, Mobile guildmaster )
{
if ( from.Backpack != null )
{
Item diamond = from.Backpack.FindItemByType( typeof( BlueDiamond ) );
if ( guildmaster != null )
{
if ( m_UsesRemaining <= 0 )
{
if ( diamond != null && Banker.Withdraw( from, 100000 ) )
{
diamond.Consume();
UsesRemaining = 10;
guildmaster.Say( 1076165 ); // Your weapon engraver should be good as new!
}
else
guildmaster.Say( 1076167 ); // You need a 100,000 gold and a blue diamond to recharge the weapon engraver.
}
else
guildmaster.Say( 1076164 ); // I can only help with this if you are carrying an engraving tool that needs repair.
}
else
{
if ( from.Skills.Tinkering.Value == 0 )
{
from.SendLocalizedMessage( 1076179 ); // Since you have no tinkering skill, you will need to find an NPC tinkerer to repair this for you.
}
else if ( from.Skills.Tinkering.Value < 75.0 )
{
from.SendLocalizedMessage( 1076178 ); // Your tinkering skill is too low to fix this yourself. An NPC tinkerer can help you repair this for a fee.
}
else if ( diamond != null )
{
diamond.Consume();
if ( Utility.RandomDouble() < from.Skills.Tinkering.Value / 100 )
{
UsesRemaining = 10;
from.SendLocalizedMessage( 1076165 ); // Your weapon engraver should be good as new! ?????
}
else
from.SendLocalizedMessage( 1076175 ); // You cracked the diamond attempting to fix the weapon engraver.
}
else
from.SendLocalizedMessage( 1076166 ); // You do not have a blue diamond needed to recharge the engraving tool.
}
}
}
public static WeaponEngravingTool Find( Mobile from )
{
if ( from.Backpack != null )
return from.Backpack.FindItemByType( typeof( WeaponEngravingTool ) ) as WeaponEngravingTool;
return null;
}
private class TargetWeapon : Target
{
private WeaponEngravingTool m_Tool;
public TargetWeapon( WeaponEngravingTool tool ) : base( -1, true, TargetFlags.None )
{
m_Tool = tool;
}
protected override void OnTarget( Mobile from, object targeted )
{
if ( m_Tool == null || m_Tool.Deleted )
return;
if ( targeted is BaseWeapon )
{
BaseWeapon item = (BaseWeapon) targeted;
from.CloseGump( typeof( InternalGump ) );
from.SendGump( new InternalGump( m_Tool, item ) );
}
else
from.SendLocalizedMessage( 1072309 ); // The selected item cannot be engraved by this engraving tool.
}
}
private class InternalGump : Gump
{
private WeaponEngravingTool m_Tool;
private BaseWeapon m_Target;
private enum Buttons
{
Cancel,
Okay,
Text
}
public InternalGump( WeaponEngravingTool tool, BaseWeapon target ) : base( 0, 0 )
{
m_Tool = tool;
m_Target = target;
Closable = true;
Disposable = true;
Dragable = true;
Resizable = false;
AddBackground( 50, 50, 400, 300, 0xA28 );
AddPage( 0 );
AddHtmlLocalized( 50, 70, 400, 20, 1072359, 0x0, false, false ); // <CENTER>Engraving Tool</CENTER>
AddHtmlLocalized( 75, 95, 350, 145, 1076229, 0x0, true, true ); // Please enter the text to add to the selected object. Leave the text area blank to remove any existing text. Removing text does not use a charge.
AddButton( 125, 300, 0x81A, 0x81B, (int) Buttons.Okay, GumpButtonType.Reply, 0 );
AddButton( 320, 300, 0x819, 0x818, (int) Buttons.Cancel, GumpButtonType.Reply, 0 );
AddImageTiled( 75, 245, 350, 40, 0xDB0 );
AddImageTiled( 76, 245, 350, 2, 0x23C5 );
AddImageTiled( 75, 245, 2, 40, 0x23C3 );
AddImageTiled( 75, 285, 350, 2, 0x23C5 );
AddImageTiled( 425, 245, 2, 42, 0x23C3 );
AddTextEntry( 75, 245, 350, 40, 0x0, (int) Buttons.Text, "" );
}
public override void OnResponse( Server.Network.NetState state, RelayInfo info )
{
if ( m_Tool == null || m_Tool.Deleted || m_Target == null || m_Target.Deleted )
return;
if ( info.ButtonID == (int) Buttons.Okay )
{
TextRelay relay = info.GetTextEntry( (int) Buttons.Text );
if ( relay != null )
{
if ( String.IsNullOrEmpty( relay.Text ) )
{
m_Target.EngravedText = null;
state.Mobile.SendLocalizedMessage( 1072362 ); // You remove the engraving from the object.
}
else
{
if( relay.Text.Length > 64 )
m_Target.EngravedText = Utility.FixHtml( relay.Text.Substring( 0, 64 ) );
else
m_Target.EngravedText = Utility.FixHtml( relay.Text );
state.Mobile.SendLocalizedMessage( 1072361 ); // You engraved the object.
m_Target.InvalidateProperties();
m_Tool.UsesRemaining -= 1;
m_Tool.InvalidateProperties();
}
}
}
else
state.Mobile.SendLocalizedMessage( 1072363 ); // The object was not engraved.
}
}
public class ConfirmGump : Gump
{
private WeaponEngravingTool m_Engraver;
private Mobile m_Guildmaster;
private enum Buttons
{
Cancel,
Confirm
}
public ConfirmGump( WeaponEngravingTool engraver, Mobile guildmaster ) : base( 200, 200 )
{
m_Engraver = engraver;
m_Guildmaster = guildmaster;
Closable = false;
Disposable = true;
Dragable = true;
Resizable = false;
AddPage( 0 );
AddBackground( 0, 0, 291, 133, 0x13BE );
AddImageTiled( 5, 5, 280, 100, 0xA40 );
if ( guildmaster != null )
{
AddHtmlLocalized( 9, 9, 272, 100, 1076169, 0x7FFF, false, false ); // It will cost you 100,000 gold and a blue diamond to recharge your weapon engraver with 10 charges.
AddHtmlLocalized( 195, 109, 120, 20, 1076172, 0x7FFF, false, false ); // Recharge it
}
else
{
AddHtmlLocalized( 9, 9, 272, 100, 1076176, 0x7FFF, false, false ); // You will need a blue diamond to repair the tip of the engraver. A successful repair will give the engraver 10 charges.
AddHtmlLocalized( 195, 109, 120, 20, 1076177, 0x7FFF, false, false ); // Replace the tip.
}
AddButton( 160, 107, 0xFB7, 0xFB8, (int) Buttons.Confirm, GumpButtonType.Reply, 0 );
AddButton( 5, 107, 0xFB1, 0xFB2, (int) Buttons.Cancel, GumpButtonType.Reply, 0 );
AddHtmlLocalized( 40, 109, 100, 20, 1060051, 0x7FFF, false, false ); // CANCEL
}
public override void OnResponse( Server.Network.NetState state, RelayInfo info )
{
if ( m_Engraver == null || m_Engraver.Deleted )
return;
if ( info.ButtonID == (int) Buttons.Confirm )
m_Engraver.Recharge( state.Mobile, m_Guildmaster );
}
}
}
}