#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,96 @@
using System;
using Server;
using Server.Mobiles;
using Server.Network;
using Server.Multis;
namespace Server.Items
{
public class BarkeepContract : Item
{
public override string DefaultName
{
get { return "a barkeep contract"; }
}
[Constructable]
public BarkeepContract() : base( 0x14F0 )
{
Weight = 1.0;
LootType = LootType.Blessed;
}
public BarkeepContract( Serial serial ) : base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int)0 ); //version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
public override void OnDoubleClick( Mobile from )
{
if ( !IsChildOf( from.Backpack ) )
{
from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
}
else if ( from.AccessLevel >= AccessLevel.GameMaster )
{
from.SendLocalizedMessage( 503248 ); // Your godly powers allow you to place this vendor whereever you wish.
Mobile v = new PlayerBarkeeper( from, BaseHouse.FindHouseAt( from ) );
v.Direction = from.Direction & Direction.Mask;
v.MoveToWorld( from.Location, from.Map );
this.Delete();
}
else
{
BaseHouse house = BaseHouse.FindHouseAt( from );
if ( house == null || !house.IsOwner( from ) )
{
from.LocalOverheadMessage( MessageType.Regular, 0x3B2, false, "You are not the full owner of this house." );
}
else if ( !house.CanPlaceNewBarkeep() )
{
from.SendLocalizedMessage( 1062490 ); // That action would exceed the maximum number of barkeeps for this house.
}
else
{
bool vendor, contract;
BaseHouse.IsThereVendor( from.Location, from.Map, out vendor, out contract );
if ( vendor )
{
from.SendLocalizedMessage( 1062677 ); // You cannot place a vendor or barkeep at this location.
}
else if ( contract )
{
from.SendLocalizedMessage( 1062678 ); // You cannot place a vendor or barkeep on top of a rental contract!
}
else
{
Mobile v = new PlayerBarkeeper( from, house );
v.Direction = from.Direction & Direction.Mask;
v.MoveToWorld( from.Location, from.Map );
this.Delete();
}
}
}
}
}
}

View file

@ -0,0 +1,112 @@
using System;
using Server.Network;
using Server.Prompts;
using Server.Items;
using Server.Targeting;
namespace Server.Items
{
public class ClothingBlessTarget : Target // Create our targeting class (which we derive from the base target class)
{
private ClothingBlessDeed m_Deed;
public ClothingBlessTarget( ClothingBlessDeed deed ) : base( 1, false, TargetFlags.None )
{
m_Deed = deed;
}
protected override void OnTarget( Mobile from, object target ) // Override the protected OnTarget() for our feature
{
if ( m_Deed.Deleted || m_Deed.RootParent != from )
return;
if ( target is BaseClothing )
{
BaseClothing item = (BaseClothing)target;
if ( item is IArcaneEquip )
{
IArcaneEquip eq = (IArcaneEquip)item;
if ( eq.IsArcane )
{
from.SendLocalizedMessage( 1005019 ); // This bless deed is for Clothes only.
return;
}
}
if ( item.LootType == LootType.Blessed || item.BlessedFor == from || (Mobile.InsuranceEnabled && item.Insured) ) // Check if its already newbied (blessed)
{
from.SendLocalizedMessage( 1045113 ); // That item is already blessed
}
else if ( item.LootType != LootType.Regular )
{
from.SendLocalizedMessage( 1045114 ); // You can not bless that item
}
else if ( !item.CanBeBlessed || item.RootParent != from )
{
from.SendLocalizedMessage( 500509 ); // You cannot bless that object
}
else
{
item.LootType = LootType.Blessed;
from.SendLocalizedMessage( 1010026 ); // You bless the item....
m_Deed.Delete(); // Delete the bless deed
}
}
else
{
from.SendLocalizedMessage( 500509 ); // You cannot bless that object
}
}
}
public class ClothingBlessDeed : Item // Create the item class which is derived from the base item class
{
public override string DefaultName
{
get { return "a clothing bless deed"; }
}
[Constructable]
public ClothingBlessDeed() : base( 0x14F0 )
{
Weight = 1.0;
LootType = LootType.Blessed;
}
public ClothingBlessDeed( Serial serial ) : base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
LootType = LootType.Blessed;
int version = reader.ReadInt();
}
public override bool DisplayLootType{ get{ return false; } }
public override void OnDoubleClick( Mobile from ) // Override double click of the deed to call our target
{
if ( !IsChildOf( from.Backpack ) ) // Make sure its in their pack
{
from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
}
else
{
from.SendLocalizedMessage( 1005018 ); // What would you like to bless? (Clothes Only)
from.Target = new ClothingBlessTarget( this ); // Call our target
}
}
}
}

View file

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

View file

@ -0,0 +1,149 @@
using System;
using Server;
using Server.Mobiles;
using Server.Targeting;
using Server.Engines.Craft;
namespace Server.Items
{
[TypeAlias( "Server.Items.DragonBarding" )]
public class DragonBardingDeed : Item, ICraftable
{
private bool m_Exceptional;
private Mobile m_Crafter;
private CraftResource m_Resource;
public override int LabelNumber{ get{ return m_Exceptional ? 1053181 : 1053012; } } // dragon barding deed
[CommandProperty( AccessLevel.GameMaster )]
public Mobile Crafter{ get{ return m_Crafter; } set{ m_Crafter = value; InvalidateProperties(); } }
[CommandProperty( AccessLevel.GameMaster )]
public bool Exceptional{ get{ return m_Exceptional; } set{ m_Exceptional = value; InvalidateProperties(); } }
[CommandProperty( AccessLevel.GameMaster )]
public CraftResource Resource{ get{ return m_Resource; } set{ m_Resource = value; Hue = CraftResources.GetHue( value ); InvalidateProperties(); } }
public DragonBardingDeed() : base( 0x14F0 )
{
Weight = 1.0;
}
public override void GetProperties( ObjectPropertyList list )
{
base.GetProperties( list );
if ( m_Exceptional && m_Crafter != null )
list.Add( 1050043, m_Crafter.Name ); // crafted by ~1_NAME~
}
public override void OnDoubleClick( Mobile from )
{
if ( IsChildOf( from.Backpack ) )
{
from.BeginTarget( 6, false, TargetFlags.None, new TargetCallback( OnTarget ) );
from.SendLocalizedMessage( 1053024 ); // Select the swamp dragon you wish to place the barding on.
}
else
{
from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
}
}
public virtual void OnTarget( Mobile from, object obj )
{
if ( Deleted )
return;
SwampDragon pet = obj as SwampDragon;
if ( pet == null || pet.HasBarding )
{
from.SendLocalizedMessage( 1053025 ); // That is not an unarmored swamp dragon.
}
else if ( !pet.Controlled || pet.ControlMaster != from )
{
from.SendLocalizedMessage( 1053026 ); // You can only put barding on a tamed swamp dragon that you own.
}
else if ( !IsChildOf( from.Backpack ) )
{
from.SendLocalizedMessage( 1060640 ); // The item must be in your backpack to use it.
}
else
{
pet.BardingExceptional = this.Exceptional;
pet.BardingCrafter = this.Crafter;
pet.BardingHP = pet.BardingMaxHP;
pet.BardingResource = this.Resource;
pet.HasBarding = true;
pet.Hue = this.Hue;
this.Delete();
from.SendLocalizedMessage( 1053027 ); // You place the barding on your swamp dragon. Use a bladed item on your dragon to remove the armor.
}
}
public DragonBardingDeed( Serial serial ) : base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 1 ); // version
writer.Write( (bool) m_Exceptional );
writer.Write( (Mobile) m_Crafter );
writer.Write( (int) m_Resource );
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
switch ( version )
{
case 1:
case 0:
{
m_Exceptional = reader.ReadBool();
m_Crafter = reader.ReadMobile();
if ( version < 1 )
reader.ReadInt();
m_Resource = (CraftResource) reader.ReadInt();
break;
}
}
}
#region ICraftable Members
public int OnCraft( int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool, CraftItem craftItem, int resHue )
{
Exceptional = ( quality >= 2 );
if ( makersMark )
Crafter = from;
Type resourceType = typeRes;
if ( resourceType == null )
resourceType = craftItem.Resources.GetAt( 0 ).ItemType;
Resource = CraftResources.GetFromType( resourceType );
CraftContext context = craftSystem.GetContext( from );
if ( context != null && context.DoNotColor )
Hue = 0;
return quality;
}
#endregion
}
}

View file

@ -0,0 +1,157 @@
using System;
using Server.Mobiles;
using Server.Network;
using Server.Prompts;
using Server.Items;
using Server.Targeting;
using Server.Gumps;
namespace Server.Items
{
public class HairRestylingDeed : Item
{
public override int LabelNumber{ get{ return 1041061; } } // a coupon for a free hair restyling
[Constructable]
public HairRestylingDeed() : base( 0x14F0 )
{
Weight = 1.0;
LootType = LootType.Blessed;
}
public HairRestylingDeed( Serial serial ) : base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
public override void OnDoubleClick( Mobile from )
{
if ( !IsChildOf( from.Backpack ) )
{
from.SendLocalizedMessage( 1042001 ); // That must be in your pack...
}
else
{
from.SendGump( new InternalGump( from, this ) );
}
}
private class InternalGump : Gump
{
private Mobile m_From;
private HairRestylingDeed m_Deed;
public InternalGump( Mobile from, HairRestylingDeed deed ) : base( 50, 50 )
{
m_From = from;
m_Deed = deed;
from.CloseGump( typeof( InternalGump ) );
AddBackground( 100, 10, 400, 385, 0xA28 );
AddHtmlLocalized( 100, 25, 400, 35, 1013008, false, false );
AddButton( 175, 340, 0xFA5, 0xFA7, 0x0, GumpButtonType.Reply, 0 ); // CANCEL
AddHtmlLocalized( 210, 342, 90, 35, 1011012, false, false );// <CENTER>HAIRSTYLE SELECTION MENU</center>
int[][] RacialData = (from.Race == Race.Human) ? HumanArray : ElvenArray;
for(int i=1; i<RacialData.Length; i++)
{
AddHtmlLocalized( LayoutArray[i][2], LayoutArray[i][3], (i==1) ? 125 : 80, (i==1) ? 70 : 35, (m_From.Female) ? RacialData[i][0] : RacialData[i][1], false, false );
if ( LayoutArray[i][4] != 0 )
{
AddBackground( LayoutArray[i][0], LayoutArray[i][1], 50, 50, 0xA3C );
AddImage( LayoutArray[i][4], LayoutArray[i][5], (m_From.Female) ? RacialData[i][4] : RacialData[i][5] );
}
AddButton( LayoutArray[i][6], LayoutArray[i][7], 0xFA5, 0xFA7, i, GumpButtonType.Reply, 0 );
}
}
public override void OnResponse( NetState sender, RelayInfo info )
{
if( m_From == null || !m_From.Alive )
return;
if ( m_Deed.Deleted )
return;
if ( info.ButtonID < 1 || info.ButtonID > 10 )
return;
int[][] RacialData = (m_From.Race == Race.Human) ? HumanArray : ElvenArray;
if ( m_From is PlayerMobile )
{
PlayerMobile pm = (PlayerMobile)m_From;
pm.SetHairMods( -1, -1 ); // clear any hairmods (disguise kit, incognito)
m_From.HairItemID = (m_From.Female) ? RacialData[info.ButtonID][2] : RacialData[info.ButtonID][3];
m_Deed.Delete();
}
}
/*
gump data: bgX, bgY, htmlX, htmlY, imgX, imgY, butX, butY
*/
int[][] LayoutArray =
{
new int[] { 0 }, /* padding: its more efficient than code to ++ the index/buttonid */
new int[] { 425, 280, 342, 295, 000, 000, 310, 292 },
new int[] { 235, 060, 150, 075, 168, 020, 118, 073 },
new int[] { 235, 115, 150, 130, 168, 070, 118, 128 },
new int[] { 235, 170, 150, 185, 168, 130, 118, 183 },
new int[] { 235, 225, 150, 240, 168, 185, 118, 238 },
new int[] { 425, 060, 342, 075, 358, 018, 310, 073 },
new int[] { 425, 115, 342, 130, 358, 075, 310, 128 },
new int[] { 425, 170, 342, 185, 358, 125, 310, 183 },
new int[] { 425, 225, 342, 240, 358, 185, 310, 238 },
new int[] { 235, 280, 150, 295, 168, 245, 118, 292 } // slot 10, Curly - N/A for elfs.
};
/*
racial arrays are: cliloc_F, cliloc_M, ItemID_F, ItemID_M, gump_img_F, gump_img_M
*/
int[][] HumanArray = /* why on earth cant these utilies be consistent with hex/dec */
{
new int[] { 0 },
new int[] { 1011064, 1011064, 0, 0, 0, 0 }, // bald
new int[] { 1011052, 1011052, 0x203B, 0x203B, 0xed1c, 0xC60C }, // Short
new int[] { 1011053, 1011053, 0x203C, 0x203C, 0xed1d, 0xc60d }, // Long
new int[] { 1011054, 1011054, 0x203D, 0x203D, 0xed1e, 0xc60e }, // Ponytail
new int[] { 1011055, 1011055, 0x2044, 0x2044, 0xed27, 0xC60F }, // Mohawk
new int[] { 1011047, 1011047, 0x2045, 0x2045, 0xED26, 0xED26 }, // Pageboy
new int[] { 1074393, 1011048, 0x2046, 0x2048, 0xed28, 0xEDE5 }, // Buns, Receding
new int[] { 1011049, 1011049, 0x2049, 0x2049, 0xede6, 0xede6 }, // 2-tails
new int[] { 1011050, 1011050, 0x204A, 0x204A, 0xED29, 0xED29 }, // Topknot
new int[] { 1011396, 1011396, 0x2047, 0x2047, 0xed25, 0xc618 } // Curly
};
int[][] ElvenArray =
{
new int[] { 0 },
new int[] { 1011064, 1011064, 0, 0, 0, 0, }, // bald
new int[] { 1074386, 1074386, 0x2fc0, 0x2fc0, 0xedf5, 0xc6e5 }, // long feather
new int[] { 1074387, 1074387, 0x2fc1, 0x2fc1, 0xedf6, 0xc6e6 }, // short
new int[] { 1074388, 1074388, 0x2fc2, 0x2fc2, 0xedf7, 0xc6e7 }, // mullet
new int[] { 1074391, 1074391, 0x2fce, 0x2fce, 0xeddc, 0xc6cc }, // knob
new int[] { 1074392, 1074392, 0x2fcf, 0x2fcf, 0xeddd, 0xc6cd }, // braided
new int[] { 1074394, 1074394, 0x2fd1, 0x2fd1, 0xeddf, 0xc6cf }, // spiked
new int[] { 1074389, 1074385, 0x2fcc, 0x2fbf, 0xedda, 0xc6e4 }, // flower, mid-long
new int[] { 1074393, 1074390, 0x2fd0, 0x2fcd, 0xedde, 0xc6cb } // buns, long
};
}
}
}

View file

@ -0,0 +1,164 @@
using System;
using Server;
using Server.Items;
using Server.Gumps;
using Server.Multis;
using Server.Network;
using Server.Targeting;
namespace Server.Items
{
public class HolidayTreeDeed : Item
{
public override int LabelNumber{ get{ return 1041116; } } // a deed for a holiday tree
[Constructable]
public HolidayTreeDeed() : base( 0x14F0 )
{
Hue = 0x488;
Weight = 1.0;
LootType = LootType.Blessed;
}
public HolidayTreeDeed( Serial serial ) : base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
LootType = LootType.Blessed;
}
public bool ValidatePlacement( Mobile from, Point3D loc )
{
if ( from.AccessLevel >= AccessLevel.GameMaster )
return true;
if ( !from.InRange( this.GetWorldLocation(), 1 ) )
{
from.SendLocalizedMessage( 500446 ); // That is too far away.
return false;
}
if ( DateTime.UtcNow.Month != 12 )
{
from.SendLocalizedMessage( 1005700 ); // You will have to wait till next December to put your tree back up for display.
return false;
}
Map map = from.Map;
if ( map == null )
return false;
BaseHouse house = BaseHouse.FindHouseAt( loc, map, 20 );
if ( house == null || !house.IsFriend( from ) )
{
from.SendLocalizedMessage( 1005701 ); // The holiday tree can only be placed in your house.
return false;
}
if ( !map.CanFit( loc, 20 ) )
{
from.SendLocalizedMessage( 500269 ); // You cannot build that there.
return false;
}
return true;
}
public void BeginPlace( Mobile from, HolidayTreeType type )
{
from.BeginTarget( -1, true, TargetFlags.None, new TargetStateCallback( Placement_OnTarget ), type );
}
public void Placement_OnTarget( Mobile from, object targeted, object state )
{
IPoint3D p = targeted as IPoint3D;
if ( p == null )
return;
Point3D loc = new Point3D( p );
if ( p is StaticTarget )
loc.Z -= TileData.ItemTable[((StaticTarget)p).ItemID].CalcHeight; /* NOTE: OSI does not properly normalize Z positioning here.
* A side affect is that you can only place on floors (due to the CanFit call).
* That functionality may be desired. And so, it's included in this script.
*/
if ( ValidatePlacement( from, loc ) )
EndPlace( from, (HolidayTreeType) state, loc );
}
public void EndPlace( Mobile from, HolidayTreeType type, Point3D loc )
{
this.Delete();
HolidayTree tree = new HolidayTree( from, type, loc );
BaseHouse house = BaseHouse.FindHouseAt( tree );
if ( house != null )
house.Addons.Add( tree );
}
public override void OnDoubleClick( Mobile from )
{
from.CloseGump( typeof( HolidayTreeChoiceGump ) );
from.SendGump( new HolidayTreeChoiceGump( from, this ) );
}
}
public class HolidayTreeChoiceGump : Gump
{
private Mobile m_From;
private HolidayTreeDeed m_Deed;
public HolidayTreeChoiceGump( Mobile from, HolidayTreeDeed deed ) : base( 200, 200 )
{
m_From = from;
m_Deed = deed;
AddPage( 0 );
AddBackground( 0, 0, 220, 120, 5054 );
AddBackground( 10, 10, 200, 100, 3000 );
AddButton( 20, 35, 4005, 4007, 1, GumpButtonType.Reply, 0 );
AddHtmlLocalized( 55, 35, 145, 25, 1018322, false, false ); // Classic
AddButton( 20, 65, 4005, 4007, 2, GumpButtonType.Reply, 0 );
AddHtmlLocalized( 55, 65, 145, 25, 1018321, false, false ); // Modern
}
public override void OnResponse( NetState sender, RelayInfo info )
{
if ( m_Deed.Deleted )
return;
switch ( info.ButtonID )
{
case 1:
{
m_Deed.BeginPlace( m_From, HolidayTreeType.Classic );
break;
}
case 2:
{
m_Deed.BeginPlace( m_From, HolidayTreeType.Modern );
break;
}
}
}
}
}

View file

@ -0,0 +1,129 @@
using System;
using Server.Gumps;
using Server.Misc;
using Server.Network;
using Server.Prompts;
namespace Server.Items
{
public class NameChangeDeed : Item
{
public override string DefaultName
{
get { return "a name change deed"; }
}
[Constructable]
public NameChangeDeed() : base( 0x14F0 )
{
LootType = LootType.Blessed;
}
public NameChangeDeed( Serial serial ) : base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
public override void OnDoubleClick( Mobile from )
{
if ( this.RootParent == from )
{
from.CloseGump( typeof( NameChangeDeedGump ) );
from.SendGump( new NameChangeDeedGump( this ) );
}
else
from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
}
}
public class NameChangeDeedGump : Gump
{
Item m_Sender;
public void AddBlackAlpha( int x, int y, int width, int height )
{
AddImageTiled( x, y, width, height, 2624 );
AddAlphaRegion( x, y, width, height );
}
public void AddTextField( int x, int y, int width, int height, int index )
{
AddBackground( x - 2, y - 2, width + 4, height + 4, 0x2486 );
AddTextEntry( x + 2, y + 2, width - 4, height - 4, 0, index, "" );
}
public string Center( string text )
{
return String.Format( "<CENTER>{0}</CENTER>", text );
}
public string Color( string text, int color )
{
return String.Format( "<BASEFONT COLOR=#{0:X6}>{1}</BASEFONT>", color, text );
}
public void AddButtonLabeled( int x, int y, int buttonID, string text )
{
AddButton( x, y - 1, 4005, 4007, buttonID, GumpButtonType.Reply, 0 );
AddHtml( x + 35, y, 240, 20, Color( text, 0xFFFFFF ), false, false );
}
public NameChangeDeedGump( Item sender ) : base( 50, 50 )
{
m_Sender = sender;
Closable=true;
Dragable=true;
Resizable=false;
AddPage(0);
AddBlackAlpha( 10, 120, 250, 85 );
AddHtml( 10, 125, 250, 20, Color( Center( "Name Change Deed" ), 0xFFFFFF ), false, false );
AddLabel( 73, 15, 1152, "" );
AddLabel( 20, 150, 0x480, "New Name:" );
AddTextField( 100, 150, 150, 20, 0 );
AddButtonLabeled( 75, 180, 1, "Submit" );
}
public override void OnResponse( NetState sender, RelayInfo info )
{
if ( m_Sender == null || m_Sender.Deleted || info.ButtonID != 1 || m_Sender.RootParent != sender.Mobile )
return;
Mobile m = sender.Mobile;
TextRelay nameEntry = info.GetTextEntry( 0 );
string newName = ( nameEntry == null ? null : nameEntry.Text.Trim() );
if ( !NameVerification.Validate( newName, 2, 16, true, false, true, 1, NameVerification.SpaceDashPeriodQuote ) )
{
m.SendMessage( "That name is unacceptable." );
return;
}
else
{
m.RawName = newName;
m.SendMessage( "Your name has been changed!" );
m.SendMessage( String.Format( "You are now known as {0}", newName ) );
m_Sender.Delete();
}
}
}
}

View file

@ -0,0 +1,198 @@
using System;
using Server.Network;
using Server.Prompts;
using Server.Items;
using Server.Targeting;
using Server.Gumps;
namespace Server.Items
{
public class NewPlayerTicket : Item
{
private Mobile m_Owner;
[CommandProperty( AccessLevel.GameMaster )]
public Mobile Owner
{
get{ return m_Owner; }
set{ m_Owner = value; }
}
public override int LabelNumber{ get{ return 1062094; } } // a young player ticket
[Constructable]
public NewPlayerTicket() : base( 0x14EF )
{
Weight = 1.0;
LootType = LootType.Blessed;
}
public override void GetProperties( ObjectPropertyList list )
{
base.GetProperties( list );
list.Add( 1041492 ); // This is half a prize ticket! Double-click this ticket and target any other ticket marked NEW PLAYER and get a prize! This ticket will only work for YOU, so don't give it away!
}
public override bool DisplayLootType{ get{ return false; } }
public NewPlayerTicket( Serial serial ) : base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
writer.Write( (Mobile) m_Owner );
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
switch ( version )
{
case 0:
{
m_Owner = reader.ReadMobile();
break;
}
}
if ( Name == "a young player ticket" )
Name = null;
}
public override void OnDoubleClick( Mobile from )
{
if ( from != m_Owner )
{
from.SendLocalizedMessage( 501926 ); // This isn't your ticket! Shame on you! You have to use YOUR ticket.
}
else if ( !IsChildOf( from.Backpack ) )
{
from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
}
else
{
from.SendLocalizedMessage( 501927 ); // Target any other ticket marked NEW PLAYER to win a prize.
from.Target = new InternalTarget( this );
}
}
private class InternalTarget : Target
{
private NewPlayerTicket m_Ticket;
public InternalTarget( NewPlayerTicket ticket ) : base( 2, false, TargetFlags.None )
{
m_Ticket = ticket;
}
protected override void OnTarget( Mobile from, object targeted )
{
if ( targeted == m_Ticket )
{
from.SendLocalizedMessage( 501928 ); // You can't target the same ticket!
}
else if ( targeted is NewPlayerTicket )
{
NewPlayerTicket theirTicket = targeted as NewPlayerTicket;
Mobile them = theirTicket.m_Owner;
if ( them == null || them.Deleted )
{
from.SendLocalizedMessage( 501930 ); // That is not a valid ticket.
}
else
{
from.SendGump( new InternalGump( from, m_Ticket ) );
them.SendGump( new InternalGump( them, theirTicket ) );
}
}
else if ( targeted is Item && ((Item)targeted).ItemID == 0x14F0 )
{
from.SendLocalizedMessage( 501931 ); // You need to find another ticket marked NEW PLAYER.
}
else
{
from.SendLocalizedMessage( 501929 ); // You will need to select a ticket.
}
}
}
private class InternalGump : Gump
{
private Mobile m_From;
private NewPlayerTicket m_Ticket;
public InternalGump( Mobile from, NewPlayerTicket ticket ) : base( 50, 50 )
{
m_From = from;
m_Ticket = ticket;
AddBackground( 0, 0, 400, 385, 0xA28 );
AddHtmlLocalized( 30, 45, 340, 70, 1013011, true, true ); // Choose the gift you prefer. WARNING: if you cancel, and your partner does not, you will need to find another matching ticket!
AddButton( 46, 128, 0xFA5, 0xFA7, 1, GumpButtonType.Reply, 0 );
AddHtmlLocalized( 80, 130, 320, 35, 1013012, false, false ); // A sextant
AddButton( 46, 163, 0xFA5, 0xFA7, 2, GumpButtonType.Reply, 0 );
AddHtmlLocalized( 80, 165, 320, 35, 1013013, false, false ); // A coupon for a single hair restyling
AddButton( 46, 198, 0xFA5, 0xFA7, 3, GumpButtonType.Reply, 0 );
AddHtmlLocalized( 80, 200, 320, 35, 1013014, false, false ); // A spellbook with all 1st - 4th spells.
AddButton( 46, 233, 0xFA5, 0xFA7, 4, GumpButtonType.Reply, 0 );
AddHtmlLocalized( 80, 235, 320, 35, 1013015, false, false ); // A wand of fireworks
AddButton( 46, 268, 0xFA5, 0xFA7, 5, GumpButtonType.Reply, 0 );
AddHtmlLocalized( 80, 270, 320, 35, 1013016, false, false ); // A spyglass
AddButton( 46, 303, 0xFA5, 0xFA7, 6, GumpButtonType.Reply, 0 );
AddHtmlLocalized( 80, 305, 320, 35, 1013017, false, false ); // Dyes and a dye tub
AddButton( 120, 340, 0xFA5, 0xFA7, 0, GumpButtonType.Reply, 0 );
AddHtmlLocalized( 154, 342, 100, 35, 1011012, false, false ); // CANCEL
}
public override void OnResponse( NetState sender, RelayInfo info )
{
if ( m_Ticket.Deleted )
return;
int number = 0;
Item item = null;
Item item2 = null;
switch ( info.ButtonID )
{
case 1: item = new Sextant(); number = 1010494; break; // A sextant has been placed in your backpack.
case 2: item = new HairRestylingDeed(); number = 501933; break; // A coupon for a free hair restyling has been placed in your backpack.
case 3: item = new Spellbook( 0xFFFFFFFF ); number = 1010495; break; // A spellbook with all 1st to 4th circle spells has been placed in your backpack.
case 4: item = new FireworksWand(); number = 501935; break; // A wand of fireworks has been placed in your backpack.
case 5: item = new Spyglass(); number = 501936; break; // A spyglass has been placed in your backpack.
case 6: item = new DyeTub(); item2 = new Dyes(); number = 501937; break; // The dyes and dye tub have been placed in your backpack.
}
if ( item != null )
{
m_Ticket.Delete();
m_From.SendLocalizedMessage( number );
m_From.AddToBackpack( item );
if ( item2 != null )
m_From.AddToBackpack( item2 );
}
}
}
}
}

View file

@ -0,0 +1,368 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Server;
using Server.Multis;
using Server.ContextMenus;
using Server.Gumps;
using Server.Mobiles;
using Server.Targeting;
namespace Server.Items
{
public class VendorRentalContract : Item
{
public override int LabelNumber{ get{ return 1062332; } } // a vendor rental contract
private VendorRentalDuration m_Duration;
private int m_Price;
private bool m_LandlordRenew;
private Mobile m_Offeree;
private Timer m_OfferExpireTimer;
public VendorRentalDuration Duration
{
get{ return m_Duration; }
set
{
if ( value != null )
m_Duration = value;
}
}
[CommandProperty( AccessLevel.GameMaster )]
public int Price
{
get{ return m_Price; }
set{ m_Price = value; }
}
[CommandProperty( AccessLevel.GameMaster )]
public bool LandlordRenew
{
get{ return m_LandlordRenew; }
set{ m_LandlordRenew = value; }
}
public Mobile Offeree
{
get{ return m_Offeree; }
set
{
if ( m_OfferExpireTimer != null )
{
m_OfferExpireTimer.Stop();
m_OfferExpireTimer = null;
}
m_Offeree = value;
if ( value != null )
{
m_OfferExpireTimer = new OfferExpireTimer( this );
m_OfferExpireTimer.Start();
}
InvalidateProperties();
}
}
[Constructable]
public VendorRentalContract() : base( 0x14F0 )
{
Weight = 1.0;
Hue = 0x672;
m_Duration = VendorRentalDuration.Instances[0];
m_Price = 1500;
}
public VendorRentalContract( Serial serial ) : base( serial )
{
}
public override void GetProperties( ObjectPropertyList list )
{
base.GetProperties( list );
if ( Offeree != null )
list.Add( 1062368, Offeree.Name ); // Being Offered To ~1_NAME~
}
public bool IsLandlord( Mobile m )
{
if ( IsLockedDown )
{
BaseHouse house = BaseHouse.FindHouseAt( this );
if ( house != null && house.DecayType != DecayType.Condemned )
return house.IsOwner( m );
}
return false;
}
public bool IsUsableBy( Mobile from, bool byLandlord, bool byBackpack, bool noOfferee, bool sendMessage )
{
if ( this.Deleted || !from.CheckAlive( sendMessage ) )
return false;
if ( noOfferee && Offeree != null )
{
if ( sendMessage )
from.SendLocalizedMessage( 1062343 ); // That item is currently in use.
return false;
}
if ( byBackpack && IsChildOf( from.Backpack ) )
return true;
if ( byLandlord && IsLandlord( from ) )
{
if ( from.Map != this.Map || !from.InRange( this, 5 ) )
{
if ( sendMessage )
from.SendLocalizedMessage( 501853 ); // Target is too far away.
return false;
}
return true;
}
return false;
}
public override void OnDelete()
{
if ( IsLockedDown )
{
BaseHouse house = BaseHouse.FindHouseAt( this );
if ( house != null )
{
house.VendorRentalContracts.Remove( this );
}
}
}
public override void OnDoubleClick( Mobile from )
{
if ( Offeree != null )
{
from.SendLocalizedMessage( 1062343 ); // That item is currently in use.
}
else if ( !IsLockedDown )
{
if ( !IsChildOf( from.Backpack ) )
{
from.SendLocalizedMessage( 1062334 ); // This item must be in your backpack to be used.
return;
}
BaseHouse house = BaseHouse.FindHouseAt( from );
if ( house == null || !house.IsOwner( from ) )
{
from.SendLocalizedMessage( 1062333 ); // You must be standing inside of a house that you own to make use of this contract.
}
else if ( !house.IsAosRules )
{
from.SendMessage( "Rental contracts can only be placed in AOS-enabled houses." );
}
else if ( !house.Public )
{
from.SendLocalizedMessage( 1062335 ); // Rental contracts can only be placed in public houses.
}
else if ( !house.CanPlaceNewVendor() )
{
from.SendLocalizedMessage( 1062352 ); // You do not have enought storage available to place this contract.
}
else
{
from.SendLocalizedMessage( 1062337 ); // Target the exact location you wish to rent out.
from.Target = new RentTarget( this );
}
}
else if ( IsLandlord( from ) )
{
if ( from.InRange( this, 5 ) )
{
from.CloseGump( typeof( VendorRentalContractGump ) );
from.SendGump( new VendorRentalContractGump( this, from ) );
}
else
{
from.SendLocalizedMessage( 501853 ); // Target is too far away.
}
}
}
public override void GetContextMenuEntries( Mobile from, List<ContextMenuEntry> list )
{
base.GetContextMenuEntries( from, list );
if ( IsUsableBy( from, true, true, true, false ) )
{
list.Add( new ContractOptionEntry( this ) );
}
}
private class ContractOptionEntry : ContextMenuEntry
{
private VendorRentalContract m_Contract;
public ContractOptionEntry( VendorRentalContract contract ) : base( 6209 )
{
m_Contract = contract;
}
public override void OnClick()
{
Mobile from = Owner.From;
if ( m_Contract.IsUsableBy( from, true, true, true, true ) )
{
from.CloseGump( typeof( VendorRentalContractGump ) );
from.SendGump( new VendorRentalContractGump( m_Contract, from ) );
}
}
}
private class RentTarget : Target
{
private VendorRentalContract m_Contract;
public RentTarget( VendorRentalContract contract ) : base( -1, false, TargetFlags.None )
{
m_Contract = contract;
}
protected override void OnTarget( Mobile from, object targeted )
{
if ( !m_Contract.IsUsableBy( from, false, true, true, true ) )
return;
IPoint3D location = targeted as IPoint3D;
if ( location == null )
return;
Point3D pLocation = new Point3D( location );
Map map = from.Map;
BaseHouse house = BaseHouse.FindHouseAt( pLocation, map, 0 );
if ( house == null || !house.IsOwner( from ) )
{
from.SendLocalizedMessage( 1062338 ); // The location being rented out must be inside of your house.
}
else if ( BaseHouse.FindHouseAt( from ) != house )
{
from.SendLocalizedMessage( 1062339 ); // You must be located inside of the house in which you are trying to place the contract.
}
else if ( !house.IsAosRules )
{
from.SendMessage( "Rental contracts can only be placed in AOS-enabled houses." );
}
else if ( !house.Public )
{
from.SendLocalizedMessage( 1062335 ); // Rental contracts can only be placed in public houses.
}
else if ( house.DecayType == DecayType.Condemned )
{
from.SendLocalizedMessage( 1062468 ); // You cannot place a contract in a condemned house.
}
else if ( !house.CanPlaceNewVendor() )
{
from.SendLocalizedMessage( 1062352 ); // You do not have enought storage available to place this contract.
}
else if ( !map.CanFit( pLocation, 16, false, false ) )
{
from.SendLocalizedMessage( 1062486 ); // A vendor cannot exist at that location. Please try again.
}
else
{
bool vendor, contract;
BaseHouse.IsThereVendor( pLocation, map, out vendor, out contract );
if ( vendor )
{
from.SendLocalizedMessage( 1062342 ); // You may not place a rental contract at this location while other beings occupy it.
}
else if ( contract )
{
from.SendLocalizedMessage( 1062341 ); // That location is cluttered. Please clear out any objects there and try again.
}
else
{
m_Contract.MoveToWorld( pLocation, map );
if ( !house.LockDown( from, m_Contract ) )
{
from.AddToBackpack( m_Contract );
}
}
}
}
protected override void OnTargetCancel( Mobile from, TargetCancelType cancelType )
{
from.SendLocalizedMessage( 1062336 ); // You decide not to place the contract at this time.
}
}
private class OfferExpireTimer : Timer
{
private VendorRentalContract m_Contract;
public OfferExpireTimer( VendorRentalContract contract ) : base( TimeSpan.FromSeconds( 30.0 ) )
{
m_Contract = contract;
Priority = TimerPriority.OneSecond;
}
protected override void OnTick()
{
Mobile offeree = m_Contract.Offeree;
if ( offeree != null )
{
offeree.CloseGump( typeof( VendorRentalOfferGump ) );
m_Contract.Offeree = null;
}
}
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.WriteEncodedInt( 0 ); // version
writer.WriteEncodedInt( m_Duration.ID );
writer.Write( (int) m_Price );
writer.Write( (bool) m_LandlordRenew );
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadEncodedInt();
int durationID = reader.ReadEncodedInt();
if ( durationID < VendorRentalDuration.Instances.Length )
m_Duration = VendorRentalDuration.Instances[durationID];
else
m_Duration = VendorRentalDuration.Instances[0];
m_Price = reader.ReadInt();
m_LandlordRenew = reader.ReadBool();
}
}
}