Fixes code according to modern code style. Fixes a few expression bugs.
This commit is contained in:
parent
89eea25e5f
commit
970fd563b2
3324 changed files with 441118 additions and 433755 deletions
|
|
@ -1,39 +1,39 @@
|
|||
namespace Server.Items
|
||||
{
|
||||
public class BlankScroll : Item, ICommodity
|
||||
{
|
||||
[Constructible]
|
||||
public BlankScroll() : this( 1 )
|
||||
{
|
||||
}
|
||||
public class BlankScroll : Item, ICommodity
|
||||
{
|
||||
[Constructible]
|
||||
public BlankScroll() : this(1)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public BlankScroll( int amount ) : base( 0xEF3 )
|
||||
{
|
||||
Stackable = true;
|
||||
Weight = 1.0;
|
||||
Amount = amount;
|
||||
}
|
||||
[Constructible]
|
||||
public BlankScroll(int amount) : base(0xEF3)
|
||||
{
|
||||
Stackable = true;
|
||||
Weight = 1.0;
|
||||
Amount = amount;
|
||||
}
|
||||
|
||||
int ICommodity.DescriptionNumber => LabelNumber;
|
||||
bool ICommodity.IsDeedable => (Core.ML);
|
||||
public BlankScroll(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public BlankScroll( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
int ICommodity.DescriptionNumber => LabelNumber;
|
||||
bool ICommodity.IsDeedable => Core.ML;
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,41 +1,40 @@
|
|||
namespace Server.Items
|
||||
{
|
||||
public class Bottle : Item, ICommodity
|
||||
{
|
||||
int ICommodity.DescriptionNumber => LabelNumber;
|
||||
bool ICommodity.IsDeedable => (Core.ML);
|
||||
public class Bottle : Item, ICommodity
|
||||
{
|
||||
[Constructible]
|
||||
public Bottle() : this(1)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public Bottle() : this( 1 )
|
||||
{
|
||||
}
|
||||
[Constructible]
|
||||
public Bottle(int amount) : base(0xF0E)
|
||||
{
|
||||
Stackable = true;
|
||||
Weight = 1.0;
|
||||
Amount = amount;
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public Bottle( int amount ) : base( 0xF0E )
|
||||
{
|
||||
Stackable = true;
|
||||
Weight = 1.0;
|
||||
Amount = amount;
|
||||
}
|
||||
public Bottle(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public Bottle( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
int ICommodity.DescriptionNumber => LabelNumber;
|
||||
bool ICommodity.IsDeedable => Core.ML;
|
||||
|
||||
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,390 +1,403 @@
|
|||
using System;
|
||||
using Server.Factions;
|
||||
using Server.Gumps;
|
||||
using Server.Misc;
|
||||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
using Server.Gumps;
|
||||
using Server.Regions;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
[DispellableFieldAttribute]
|
||||
public class Moongate : Item
|
||||
{
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Point3D Target { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Map TargetMap { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public bool Dispellable { get; set; }
|
||||
|
||||
public virtual bool ShowFeluccaWarning => false;
|
||||
|
||||
[Constructible]
|
||||
public Moongate() : this( Point3D.Zero, null )
|
||||
{
|
||||
Dispellable = true;
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public Moongate(bool bDispellable) : this( Point3D.Zero, null )
|
||||
{
|
||||
Dispellable = bDispellable;
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public Moongate( Point3D target, Map targetMap ) : base( 0xF6C )
|
||||
{
|
||||
Movable = false;
|
||||
Light = LightType.Circle300;
|
||||
|
||||
Target = target;
|
||||
TargetMap = targetMap;
|
||||
}
|
||||
|
||||
public Moongate( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
if ( !from.Player )
|
||||
return;
|
||||
|
||||
if ( from.InRange( GetWorldLocation(), 1 ) )
|
||||
CheckGate( from, 1 );
|
||||
else
|
||||
from.SendLocalizedMessage( 500446 ); // That is too far away.
|
||||
}
|
||||
|
||||
public override bool OnMoveOver( Mobile m )
|
||||
{
|
||||
if ( m.Player )
|
||||
CheckGate( m, 0 );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public virtual void CheckGate( Mobile m, int range )
|
||||
{
|
||||
#region Mondain's Legacy
|
||||
if ( m.Hidden && m.AccessLevel == AccessLevel.Player && Core.ML )
|
||||
m.RevealingAction();
|
||||
#endregion
|
||||
|
||||
new DelayTimer( m, this, range ).Start();
|
||||
}
|
||||
|
||||
public virtual void OnGateUsed( Mobile m )
|
||||
{
|
||||
}
|
||||
|
||||
public virtual void UseGate( Mobile m )
|
||||
{
|
||||
ClientFlags flags = m.NetState?.Flags ?? ClientFlags.None;
|
||||
|
||||
if ( Factions.Sigil.ExistsOn( m ) )
|
||||
{
|
||||
m.SendLocalizedMessage( 1061632 ); // You can't do that while carrying the sigil.
|
||||
}
|
||||
else if ( TargetMap == Map.Felucca && m is PlayerMobile mobile && mobile.Young )
|
||||
{
|
||||
mobile.SendLocalizedMessage( 1049543 ); // You decide against traveling to Felucca while you are still young.
|
||||
}
|
||||
else if ( (m.Kills >= 5 && TargetMap != Map.Felucca) || ( TargetMap == Map.Tokuno && (flags & ClientFlags.Tokuno) == 0 ) || ( TargetMap == Map.Malas && (flags & ClientFlags.Malas) == 0 ) || ( TargetMap == Map.Ilshenar && (flags & ClientFlags.Ilshenar) == 0 ) )
|
||||
{
|
||||
m.SendLocalizedMessage( 1019004 ); // You are not allowed to travel there.
|
||||
}
|
||||
else if ( m.Spell != null )
|
||||
{
|
||||
m.SendLocalizedMessage( 1049616 ); // You are too busy to do that at the moment.
|
||||
}
|
||||
else if ( TargetMap != null && TargetMap != Map.Internal )
|
||||
{
|
||||
BaseCreature.TeleportPets( m, Target, TargetMap );
|
||||
|
||||
m.MoveToWorld( Target, TargetMap );
|
||||
|
||||
if ( m.AccessLevel == AccessLevel.Player || !m.Hidden )
|
||||
m.PlaySound( 0x1FE );
|
||||
|
||||
OnGateUsed( m );
|
||||
}
|
||||
else
|
||||
{
|
||||
m.SendMessage( "This moongate does not seem to go anywhere." );
|
||||
}
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 1 ); // version
|
||||
|
||||
writer.Write( Target );
|
||||
writer.Write( TargetMap );
|
||||
|
||||
// Version 1
|
||||
writer.Write( Dispellable );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
Target = reader.ReadPoint3D();
|
||||
TargetMap = reader.ReadMap();
|
||||
|
||||
if ( version >= 1 )
|
||||
Dispellable = reader.ReadBool();
|
||||
}
|
||||
|
||||
public virtual bool ValidateUse( Mobile from, bool message )
|
||||
{
|
||||
if ( from.Deleted || Deleted )
|
||||
return false;
|
||||
|
||||
if ( from.Map != Map || !from.InRange( this, 1 ) )
|
||||
{
|
||||
if ( message )
|
||||
from.SendLocalizedMessage( 500446 ); // That is too far away.
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public virtual void BeginConfirmation( Mobile from )
|
||||
{
|
||||
if ( IsInTown( from.Location, from.Map ) && !IsInTown( Target, TargetMap ) || (from.Map != Map.Felucca && TargetMap == Map.Felucca && ShowFeluccaWarning) )
|
||||
{
|
||||
if ( from.AccessLevel == AccessLevel.Player || !from.Hidden )
|
||||
from.Send( new PlaySound( 0x20E, from.Location ) );
|
||||
from.CloseGump( typeof( MoongateConfirmGump ) );
|
||||
from.SendGump( new MoongateConfirmGump( from, this ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
EndConfirmation( from );
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void EndConfirmation( Mobile from )
|
||||
{
|
||||
if ( !ValidateUse( from, true ) )
|
||||
return;
|
||||
|
||||
UseGate( from );
|
||||
}
|
||||
|
||||
public virtual void DelayCallback( Mobile from, int range )
|
||||
{
|
||||
if ( !ValidateUse( from, false ) || !from.InRange( this, range ) )
|
||||
return;
|
||||
|
||||
if ( TargetMap != null )
|
||||
BeginConfirmation( from );
|
||||
else
|
||||
from.SendMessage( "This moongate does not seem to go anywhere." );
|
||||
}
|
||||
|
||||
public static bool IsInTown( Point3D p, Map map )
|
||||
{
|
||||
if ( map == null )
|
||||
return false;
|
||||
|
||||
GuardedRegion reg = (GuardedRegion) Region.Find( p, map ).GetRegion( typeof( GuardedRegion ) );
|
||||
|
||||
return ( reg != null && !reg.IsDisabled() );
|
||||
}
|
||||
|
||||
private class DelayTimer : Timer
|
||||
{
|
||||
private Mobile m_From;
|
||||
private Moongate m_Gate;
|
||||
private int m_Range;
|
||||
|
||||
public DelayTimer( Mobile from, Moongate gate, int range ) : base( TimeSpan.FromSeconds( 1.0 ) )
|
||||
{
|
||||
m_From = from;
|
||||
m_Gate = gate;
|
||||
m_Range = range;
|
||||
}
|
||||
|
||||
protected override void OnTick()
|
||||
{
|
||||
m_Gate.DelayCallback( m_From, m_Range );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class ConfirmationMoongate : Moongate
|
||||
{
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int GumpWidth { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int GumpHeight { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int TitleColor { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int MessageColor { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int TitleNumber { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int MessageNumber { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public string MessageString { get; set; }
|
||||
|
||||
[Constructible]
|
||||
public ConfirmationMoongate() : this( Point3D.Zero, null )
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public ConfirmationMoongate( Point3D target, Map targetMap ) : base( target, targetMap )
|
||||
{
|
||||
}
|
||||
|
||||
public ConfirmationMoongate( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public virtual void Warning_Callback( Mobile from, bool okay, object state )
|
||||
{
|
||||
if ( okay )
|
||||
EndConfirmation( from );
|
||||
}
|
||||
|
||||
public override void BeginConfirmation( Mobile from )
|
||||
{
|
||||
if ( GumpWidth > 0 && GumpHeight > 0 && TitleNumber > 0 && (MessageNumber > 0 || MessageString != null) )
|
||||
{
|
||||
from.CloseGump( typeof( WarningGump ) );
|
||||
from.SendGump( new WarningGump( TitleNumber, TitleColor, MessageString == null ? (object)MessageNumber : (object)MessageString, MessageColor, GumpWidth, GumpHeight, Warning_Callback, from ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
base.BeginConfirmation( from );
|
||||
}
|
||||
}
|
||||
[DispellableField]
|
||||
public class Moongate : Item
|
||||
{
|
||||
[Constructible]
|
||||
public Moongate() : this(Point3D.Zero, null)
|
||||
{
|
||||
Dispellable = true;
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public Moongate(bool bDispellable) : this(Point3D.Zero, null)
|
||||
{
|
||||
Dispellable = bDispellable;
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public Moongate(Point3D target, Map targetMap) : base(0xF6C)
|
||||
{
|
||||
Movable = false;
|
||||
Light = LightType.Circle300;
|
||||
|
||||
Target = target;
|
||||
TargetMap = targetMap;
|
||||
}
|
||||
|
||||
public Moongate(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public Point3D Target{ get; set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public Map TargetMap{ get; set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public bool Dispellable{ get; set; }
|
||||
|
||||
public virtual bool ShowFeluccaWarning => false;
|
||||
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
if (!from.Player)
|
||||
return;
|
||||
|
||||
if (from.InRange(GetWorldLocation(), 1))
|
||||
CheckGate(from, 1);
|
||||
else
|
||||
from.SendLocalizedMessage(500446); // That is too far away.
|
||||
}
|
||||
|
||||
public override bool OnMoveOver(Mobile m)
|
||||
{
|
||||
if (m.Player)
|
||||
CheckGate(m, 0);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public virtual void CheckGate(Mobile m, int range)
|
||||
{
|
||||
#region Mondain's Legacy
|
||||
|
||||
if (m.Hidden && m.AccessLevel == AccessLevel.Player && Core.ML)
|
||||
m.RevealingAction();
|
||||
|
||||
#endregion
|
||||
|
||||
new DelayTimer(m, this, range).Start();
|
||||
}
|
||||
|
||||
public virtual void OnGateUsed(Mobile m)
|
||||
{
|
||||
}
|
||||
|
||||
public virtual void UseGate(Mobile m)
|
||||
{
|
||||
ClientFlags flags = m.NetState?.Flags ?? ClientFlags.None;
|
||||
|
||||
if (Sigil.ExistsOn(m))
|
||||
{
|
||||
m.SendLocalizedMessage(1061632); // You can't do that while carrying the sigil.
|
||||
}
|
||||
else if (TargetMap == Map.Felucca && m is PlayerMobile mobile && mobile.Young)
|
||||
{
|
||||
mobile.SendLocalizedMessage(1049543); // You decide against traveling to Felucca while you are still young.
|
||||
}
|
||||
else if (m.Kills >= 5 && TargetMap != Map.Felucca ||
|
||||
TargetMap == Map.Tokuno && (flags & ClientFlags.Tokuno) == 0 ||
|
||||
TargetMap == Map.Malas && (flags & ClientFlags.Malas) == 0 ||
|
||||
TargetMap == Map.Ilshenar && (flags & ClientFlags.Ilshenar) == 0)
|
||||
{
|
||||
m.SendLocalizedMessage(1019004); // You are not allowed to travel there.
|
||||
}
|
||||
else if (m.Spell != null)
|
||||
{
|
||||
m.SendLocalizedMessage(1049616); // You are too busy to do that at the moment.
|
||||
}
|
||||
else if (TargetMap != null && TargetMap != Map.Internal)
|
||||
{
|
||||
BaseCreature.TeleportPets(m, Target, TargetMap);
|
||||
|
||||
m.MoveToWorld(Target, TargetMap);
|
||||
|
||||
if (m.AccessLevel == AccessLevel.Player || !m.Hidden)
|
||||
m.PlaySound(0x1FE);
|
||||
|
||||
OnGateUsed(m);
|
||||
}
|
||||
else
|
||||
{
|
||||
m.SendMessage("This moongate does not seem to go anywhere.");
|
||||
}
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(1); // version
|
||||
|
||||
writer.Write(Target);
|
||||
writer.Write(TargetMap);
|
||||
|
||||
// Version 1
|
||||
writer.Write(Dispellable);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
Target = reader.ReadPoint3D();
|
||||
TargetMap = reader.ReadMap();
|
||||
|
||||
if (version >= 1)
|
||||
Dispellable = reader.ReadBool();
|
||||
}
|
||||
|
||||
public virtual bool ValidateUse(Mobile from, bool message)
|
||||
{
|
||||
if (from.Deleted || Deleted)
|
||||
return false;
|
||||
|
||||
if (from.Map != Map || !from.InRange(this, 1))
|
||||
{
|
||||
if (message)
|
||||
from.SendLocalizedMessage(500446); // That is too far away.
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public virtual void BeginConfirmation(Mobile from)
|
||||
{
|
||||
if (IsInTown(from.Location, from.Map) && !IsInTown(Target, TargetMap) ||
|
||||
from.Map != Map.Felucca && TargetMap == Map.Felucca && ShowFeluccaWarning)
|
||||
{
|
||||
if (from.AccessLevel == AccessLevel.Player || !from.Hidden)
|
||||
from.Send(new PlaySound(0x20E, from.Location));
|
||||
from.CloseGump(typeof(MoongateConfirmGump));
|
||||
from.SendGump(new MoongateConfirmGump(from, this));
|
||||
}
|
||||
else
|
||||
{
|
||||
EndConfirmation(from);
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void EndConfirmation(Mobile from)
|
||||
{
|
||||
if (!ValidateUse(from, true))
|
||||
return;
|
||||
|
||||
UseGate(from);
|
||||
}
|
||||
|
||||
public virtual void DelayCallback(Mobile from, int range)
|
||||
{
|
||||
if (!ValidateUse(from, false) || !from.InRange(this, range))
|
||||
return;
|
||||
|
||||
if (TargetMap != null)
|
||||
BeginConfirmation(from);
|
||||
else
|
||||
from.SendMessage("This moongate does not seem to go anywhere.");
|
||||
}
|
||||
|
||||
public static bool IsInTown(Point3D p, Map map)
|
||||
{
|
||||
if (map == null)
|
||||
return false;
|
||||
|
||||
GuardedRegion reg = (GuardedRegion)Region.Find(p, map).GetRegion(typeof(GuardedRegion));
|
||||
|
||||
return reg != null && !reg.IsDisabled();
|
||||
}
|
||||
|
||||
private class DelayTimer : Timer
|
||||
{
|
||||
private Mobile m_From;
|
||||
private Moongate m_Gate;
|
||||
private int m_Range;
|
||||
|
||||
public DelayTimer(Mobile from, Moongate gate, int range) : base(TimeSpan.FromSeconds(1.0))
|
||||
{
|
||||
m_From = from;
|
||||
m_Gate = gate;
|
||||
m_Range = range;
|
||||
}
|
||||
|
||||
protected override void OnTick()
|
||||
{
|
||||
m_Gate.DelayCallback(m_From, m_Range);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class ConfirmationMoongate : Moongate
|
||||
{
|
||||
[Constructible]
|
||||
public ConfirmationMoongate() : this(Point3D.Zero, null)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public ConfirmationMoongate(Point3D target, Map targetMap) : base(target, targetMap)
|
||||
{
|
||||
}
|
||||
|
||||
public ConfirmationMoongate(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int GumpWidth{ get; set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int GumpHeight{ get; set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int TitleColor{ get; set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int MessageColor{ get; set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int TitleNumber{ get; set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int MessageNumber{ get; set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public string MessageString{ get; set; }
|
||||
|
||||
public virtual void Warning_Callback(Mobile from, bool okay, object state)
|
||||
{
|
||||
if (okay)
|
||||
EndConfirmation(from);
|
||||
}
|
||||
|
||||
public override void BeginConfirmation(Mobile from)
|
||||
{
|
||||
if (GumpWidth > 0 && GumpHeight > 0 && TitleNumber > 0 && (MessageNumber > 0 || MessageString != null))
|
||||
{
|
||||
from.CloseGump(typeof(WarningGump));
|
||||
from.SendGump(new WarningGump(TitleNumber, TitleColor,
|
||||
MessageString == null ? MessageNumber : (object)MessageString, MessageColor, GumpWidth, GumpHeight,
|
||||
Warning_Callback, from));
|
||||
}
|
||||
else
|
||||
{
|
||||
base.BeginConfirmation(from);
|
||||
}
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0); // version
|
||||
|
||||
writer.WriteEncodedInt(GumpWidth);
|
||||
writer.WriteEncodedInt(GumpHeight);
|
||||
|
||||
writer.WriteEncodedInt(TitleColor);
|
||||
writer.WriteEncodedInt(MessageColor);
|
||||
|
||||
writer.WriteEncodedInt(TitleNumber);
|
||||
writer.WriteEncodedInt(MessageNumber);
|
||||
|
||||
writer.Write(MessageString);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch (version)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
GumpWidth = reader.ReadEncodedInt();
|
||||
GumpHeight = reader.ReadEncodedInt();
|
||||
|
||||
TitleColor = reader.ReadEncodedInt();
|
||||
MessageColor = reader.ReadEncodedInt();
|
||||
|
||||
TitleNumber = reader.ReadEncodedInt();
|
||||
MessageNumber = reader.ReadEncodedInt();
|
||||
|
||||
MessageString = reader.ReadString();
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class MoongateConfirmGump : Gump
|
||||
{
|
||||
private Mobile m_From;
|
||||
private Moongate m_Gate;
|
||||
|
||||
public MoongateConfirmGump(Mobile from, Moongate gate) : base(Core.AOS ? 110 : 20, Core.AOS ? 100 : 30)
|
||||
{
|
||||
m_From = from;
|
||||
m_Gate = gate;
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
|
||||
writer.WriteEncodedInt( GumpWidth );
|
||||
writer.WriteEncodedInt( GumpHeight );
|
||||
|
||||
writer.WriteEncodedInt( TitleColor );
|
||||
writer.WriteEncodedInt( MessageColor );
|
||||
|
||||
writer.WriteEncodedInt( TitleNumber );
|
||||
writer.WriteEncodedInt( MessageNumber );
|
||||
|
||||
writer.Write( MessageString );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
GumpWidth = reader.ReadEncodedInt();
|
||||
GumpHeight = reader.ReadEncodedInt();
|
||||
|
||||
TitleColor = reader.ReadEncodedInt();
|
||||
MessageColor = reader.ReadEncodedInt();
|
||||
|
||||
TitleNumber = reader.ReadEncodedInt();
|
||||
MessageNumber = reader.ReadEncodedInt();
|
||||
if (Core.AOS)
|
||||
{
|
||||
Closable = false;
|
||||
|
||||
MessageString = reader.ReadString();
|
||||
AddPage(0);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
AddBackground(0, 0, 420, 280, 5054);
|
||||
|
||||
public class MoongateConfirmGump : Gump
|
||||
{
|
||||
private Mobile m_From;
|
||||
private Moongate m_Gate;
|
||||
AddImageTiled(10, 10, 400, 20, 2624);
|
||||
AddAlphaRegion(10, 10, 400, 20);
|
||||
|
||||
AddHtmlLocalized(10, 10, 400, 20, 1062051, 30720, false, false); // Gate Warning
|
||||
|
||||
AddImageTiled(10, 40, 400, 200, 2624);
|
||||
AddAlphaRegion(10, 40, 400, 200);
|
||||
|
||||
if (from.Map != Map.Felucca && gate.TargetMap == Map.Felucca && gate.ShowFeluccaWarning)
|
||||
AddHtmlLocalized(10, 40, 400, 200, 1062050, 32512, false,
|
||||
true); // This Gate goes to Felucca... Continue to enter the gate, Cancel to stay here
|
||||
else
|
||||
AddHtmlLocalized(10, 40, 400, 200, 1062049, 32512, false,
|
||||
true); // Dost thou wish to step into the moongate? Continue to enter the gate, Cancel to stay here
|
||||
|
||||
AddImageTiled(10, 250, 400, 20, 2624);
|
||||
AddAlphaRegion(10, 250, 400, 20);
|
||||
|
||||
AddButton(10, 250, 4005, 4007, 1, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(40, 250, 170, 20, 1011036, 32767, false, false); // OKAY
|
||||
|
||||
AddButton(210, 250, 4005, 4007, 0, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(240, 250, 170, 20, 1011012, 32767, false, false); // CANCEL
|
||||
}
|
||||
else
|
||||
{
|
||||
AddPage(0);
|
||||
|
||||
public MoongateConfirmGump( Mobile from, Moongate gate ) : base( Core.AOS ? 110 : 20, Core.AOS ? 100 : 30 )
|
||||
{
|
||||
m_From = from;
|
||||
m_Gate = gate;
|
||||
AddBackground(0, 0, 420, 400, 5054);
|
||||
AddBackground(10, 10, 400, 380, 3000);
|
||||
|
||||
if ( Core.AOS )
|
||||
{
|
||||
Closable = false;
|
||||
AddHtml(20, 40, 380, 60,
|
||||
@"Dost thou wish to step into the moongate? Continue to enter the gate, Cancel to stay here", false,
|
||||
false);
|
||||
|
||||
AddPage( 0 );
|
||||
AddHtmlLocalized(55, 110, 290, 20, 1011012, false, false); // CANCEL
|
||||
AddButton(20, 110, 4005, 4007, 0, GumpButtonType.Reply, 0);
|
||||
|
||||
AddBackground( 0, 0, 420, 280, 5054 );
|
||||
AddHtmlLocalized(55, 140, 290, 40, 1011011, false, false); // CONTINUE
|
||||
AddButton(20, 140, 4005, 4007, 1, GumpButtonType.Reply, 0);
|
||||
}
|
||||
}
|
||||
|
||||
AddImageTiled( 10, 10, 400, 20, 2624 );
|
||||
AddAlphaRegion( 10, 10, 400, 20 );
|
||||
|
||||
AddHtmlLocalized( 10, 10, 400, 20, 1062051, 30720, false, false ); // Gate Warning
|
||||
|
||||
AddImageTiled( 10, 40, 400, 200, 2624 );
|
||||
AddAlphaRegion( 10, 40, 400, 200 );
|
||||
|
||||
if ( from.Map != Map.Felucca && gate.TargetMap == Map.Felucca && gate.ShowFeluccaWarning )
|
||||
AddHtmlLocalized( 10, 40, 400, 200, 1062050, 32512, false, true ); // This Gate goes to Felucca... Continue to enter the gate, Cancel to stay here
|
||||
else
|
||||
AddHtmlLocalized( 10, 40, 400, 200, 1062049, 32512, false, true ); // Dost thou wish to step into the moongate? Continue to enter the gate, Cancel to stay here
|
||||
|
||||
AddImageTiled( 10, 250, 400, 20, 2624 );
|
||||
AddAlphaRegion( 10, 250, 400, 20 );
|
||||
|
||||
AddButton( 10, 250, 4005, 4007, 1, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 40, 250, 170, 20, 1011036, 32767, false, false ); // OKAY
|
||||
|
||||
AddButton( 210, 250, 4005, 4007, 0, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 240, 250, 170, 20, 1011012, 32767, false, false ); // CANCEL
|
||||
}
|
||||
else
|
||||
{
|
||||
AddPage( 0 );
|
||||
|
||||
AddBackground( 0, 0, 420, 400, 5054 );
|
||||
AddBackground( 10, 10, 400, 380, 3000 );
|
||||
|
||||
AddHtml( 20, 40, 380, 60, @"Dost thou wish to step into the moongate? Continue to enter the gate, Cancel to stay here", false, false );
|
||||
|
||||
AddHtmlLocalized( 55, 110, 290, 20, 1011012, false, false ); // CANCEL
|
||||
AddButton( 20, 110, 4005, 4007, 0, GumpButtonType.Reply, 0 );
|
||||
|
||||
AddHtmlLocalized( 55, 140, 290, 40, 1011011, false, false ); // CONTINUE
|
||||
AddButton( 20, 140, 4005, 4007, 1, GumpButtonType.Reply, 0 );
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnResponse( NetState state, RelayInfo info )
|
||||
{
|
||||
if ( info.ButtonID == 1 )
|
||||
m_Gate.EndConfirmation( m_From );
|
||||
}
|
||||
}
|
||||
}
|
||||
public override void OnResponse(NetState state, RelayInfo info)
|
||||
{
|
||||
if (info.ButtonID == 1)
|
||||
m_Gate.EndConfirmation(m_From);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,340 +1,342 @@
|
|||
using System;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class PotionKeg : Item
|
||||
{
|
||||
private PotionEffect m_Type;
|
||||
private int m_Held;
|
||||
public class PotionKeg : Item
|
||||
{
|
||||
private int m_Held;
|
||||
private PotionEffect m_Type;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int Held
|
||||
{
|
||||
get => m_Held;
|
||||
set
|
||||
{
|
||||
if ( m_Held != value )
|
||||
{
|
||||
m_Held = value;
|
||||
UpdateWeight();
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
}
|
||||
[Constructible]
|
||||
public PotionKeg() : base(0x1940)
|
||||
{
|
||||
UpdateWeight();
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public PotionEffect Type
|
||||
{
|
||||
get => m_Type;
|
||||
set
|
||||
{
|
||||
m_Type = value;
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
public PotionKeg(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public PotionKeg() : base( 0x1940 )
|
||||
{
|
||||
UpdateWeight();
|
||||
}
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int Held
|
||||
{
|
||||
get => m_Held;
|
||||
set
|
||||
{
|
||||
if (m_Held != value)
|
||||
{
|
||||
m_Held = value;
|
||||
UpdateWeight();
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void UpdateWeight()
|
||||
{
|
||||
int held = Math.Max( 0, Math.Min( m_Held, 100 ) );
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public PotionEffect Type
|
||||
{
|
||||
get => m_Type;
|
||||
set
|
||||
{
|
||||
m_Type = value;
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
|
||||
Weight = 20 + ((held * 80) / 100);
|
||||
}
|
||||
public override int LabelNumber
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_Held > 0 && (int)m_Type >= (int)PotionEffect.Conflagration)
|
||||
return 1072658 + (int)m_Type - (int)PotionEffect.Conflagration;
|
||||
|
||||
public PotionKeg( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
return m_Held > 0 ? 1041620 + (int)m_Type : 1041641;
|
||||
}
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
public virtual void UpdateWeight()
|
||||
{
|
||||
int held = Math.Max(0, Math.Min(m_Held, 100));
|
||||
|
||||
writer.Write( (int) 1 ); // version
|
||||
Weight = 20 + held * 80 / 100;
|
||||
}
|
||||
|
||||
writer.Write( (int) m_Type );
|
||||
writer.Write( (int) m_Held );
|
||||
}
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
writer.Write(1); // version
|
||||
|
||||
int version = reader.ReadInt();
|
||||
writer.Write((int)m_Type);
|
||||
writer.Write(m_Held);
|
||||
}
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 1:
|
||||
case 0:
|
||||
{
|
||||
m_Type = (PotionEffect)reader.ReadInt();
|
||||
m_Held = reader.ReadInt();
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
int version = reader.ReadInt();
|
||||
|
||||
if ( version < 1 )
|
||||
Timer.DelayCall( TimeSpan.Zero, UpdateWeight );
|
||||
}
|
||||
switch (version)
|
||||
{
|
||||
case 1:
|
||||
case 0:
|
||||
{
|
||||
m_Type = (PotionEffect)reader.ReadInt();
|
||||
m_Held = reader.ReadInt();
|
||||
|
||||
public override int LabelNumber
|
||||
{
|
||||
get
|
||||
{
|
||||
if ( m_Held > 0 && ( int )m_Type >= ( int )PotionEffect.Conflagration )
|
||||
{
|
||||
return 1072658 + ( int )m_Type - ( int )PotionEffect.Conflagration;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return (m_Held > 0 ? 1041620 + (int)m_Type : 1041641);
|
||||
}
|
||||
}
|
||||
if (version < 1)
|
||||
Timer.DelayCall(TimeSpan.Zero, UpdateWeight);
|
||||
}
|
||||
|
||||
public override void GetProperties( ObjectPropertyList list )
|
||||
{
|
||||
base.GetProperties( list );
|
||||
public override void GetProperties(ObjectPropertyList list)
|
||||
{
|
||||
base.GetProperties(list);
|
||||
|
||||
int number;
|
||||
int number;
|
||||
|
||||
if ( m_Held <= 0 )
|
||||
number = 502246; // The keg is empty.
|
||||
else if ( m_Held < 5 )
|
||||
number = 502248; // The keg is nearly empty.
|
||||
else if ( m_Held < 20 )
|
||||
number = 502249; // The keg is not very full.
|
||||
else if ( m_Held < 30 )
|
||||
number = 502250; // The keg is about one quarter full.
|
||||
else if ( m_Held < 40 )
|
||||
number = 502251; // The keg is about one third full.
|
||||
else if ( m_Held < 47 )
|
||||
number = 502252; // The keg is almost half full.
|
||||
else if ( m_Held < 54 )
|
||||
number = 502254; // The keg is approximately half full.
|
||||
else if ( m_Held < 70 )
|
||||
number = 502253; // The keg is more than half full.
|
||||
else if ( m_Held < 80 )
|
||||
number = 502255; // The keg is about three quarters full.
|
||||
else if ( m_Held < 96 )
|
||||
number = 502256; // The keg is very full.
|
||||
else if ( m_Held < 100 )
|
||||
number = 502257; // The liquid is almost to the top of the keg.
|
||||
else
|
||||
number = 502258; // The keg is completely full.
|
||||
if (m_Held <= 0)
|
||||
number = 502246; // The keg is empty.
|
||||
else if (m_Held < 5)
|
||||
number = 502248; // The keg is nearly empty.
|
||||
else if (m_Held < 20)
|
||||
number = 502249; // The keg is not very full.
|
||||
else if (m_Held < 30)
|
||||
number = 502250; // The keg is about one quarter full.
|
||||
else if (m_Held < 40)
|
||||
number = 502251; // The keg is about one third full.
|
||||
else if (m_Held < 47)
|
||||
number = 502252; // The keg is almost half full.
|
||||
else if (m_Held < 54)
|
||||
number = 502254; // The keg is approximately half full.
|
||||
else if (m_Held < 70)
|
||||
number = 502253; // The keg is more than half full.
|
||||
else if (m_Held < 80)
|
||||
number = 502255; // The keg is about three quarters full.
|
||||
else if (m_Held < 96)
|
||||
number = 502256; // The keg is very full.
|
||||
else if (m_Held < 100)
|
||||
number = 502257; // The liquid is almost to the top of the keg.
|
||||
else
|
||||
number = 502258; // The keg is completely full.
|
||||
|
||||
list.Add( number );
|
||||
}
|
||||
list.Add(number);
|
||||
}
|
||||
|
||||
public override void OnSingleClick( Mobile from )
|
||||
{
|
||||
base.OnSingleClick( from );
|
||||
public override void OnSingleClick(Mobile from)
|
||||
{
|
||||
base.OnSingleClick(from);
|
||||
|
||||
int number;
|
||||
int number;
|
||||
|
||||
if ( m_Held <= 0 )
|
||||
number = 502246; // The keg is empty.
|
||||
else if ( m_Held < 5 )
|
||||
number = 502248; // The keg is nearly empty.
|
||||
else if ( m_Held < 20 )
|
||||
number = 502249; // The keg is not very full.
|
||||
else if ( m_Held < 30 )
|
||||
number = 502250; // The keg is about one quarter full.
|
||||
else if ( m_Held < 40 )
|
||||
number = 502251; // The keg is about one third full.
|
||||
else if ( m_Held < 47 )
|
||||
number = 502252; // The keg is almost half full.
|
||||
else if ( m_Held < 54 )
|
||||
number = 502254; // The keg is approximately half full.
|
||||
else if ( m_Held < 70 )
|
||||
number = 502253; // The keg is more than half full.
|
||||
else if ( m_Held < 80 )
|
||||
number = 502255; // The keg is about three quarters full.
|
||||
else if ( m_Held < 96 )
|
||||
number = 502256; // The keg is very full.
|
||||
else if ( m_Held < 100 )
|
||||
number = 502257; // The liquid is almost to the top of the keg.
|
||||
else
|
||||
number = 502258; // The keg is completely full.
|
||||
if (m_Held <= 0)
|
||||
number = 502246; // The keg is empty.
|
||||
else if (m_Held < 5)
|
||||
number = 502248; // The keg is nearly empty.
|
||||
else if (m_Held < 20)
|
||||
number = 502249; // The keg is not very full.
|
||||
else if (m_Held < 30)
|
||||
number = 502250; // The keg is about one quarter full.
|
||||
else if (m_Held < 40)
|
||||
number = 502251; // The keg is about one third full.
|
||||
else if (m_Held < 47)
|
||||
number = 502252; // The keg is almost half full.
|
||||
else if (m_Held < 54)
|
||||
number = 502254; // The keg is approximately half full.
|
||||
else if (m_Held < 70)
|
||||
number = 502253; // The keg is more than half full.
|
||||
else if (m_Held < 80)
|
||||
number = 502255; // The keg is about three quarters full.
|
||||
else if (m_Held < 96)
|
||||
number = 502256; // The keg is very full.
|
||||
else if (m_Held < 100)
|
||||
number = 502257; // The liquid is almost to the top of the keg.
|
||||
else
|
||||
number = 502258; // The keg is completely full.
|
||||
|
||||
LabelTo( from, number );
|
||||
}
|
||||
LabelTo(from, number);
|
||||
}
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
if ( from.InRange( GetWorldLocation(), 2 ) )
|
||||
{
|
||||
if ( m_Held > 0 )
|
||||
{
|
||||
Container pack = from.Backpack;
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
if (from.InRange(GetWorldLocation(), 2))
|
||||
{
|
||||
if (m_Held > 0)
|
||||
{
|
||||
Container pack = from.Backpack;
|
||||
|
||||
if ( pack != null && pack.ConsumeTotal( typeof( Bottle ), 1 ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 502242 ); // You pour some of the keg's contents into an empty bottle...
|
||||
if (pack != null && pack.ConsumeTotal(typeof(Bottle), 1))
|
||||
{
|
||||
from.SendLocalizedMessage(502242); // You pour some of the keg's contents into an empty bottle...
|
||||
|
||||
BasePotion pot = FillBottle();
|
||||
BasePotion pot = FillBottle();
|
||||
|
||||
if ( pack.TryDropItem( from, pot, false ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 502243 ); // ...and place it into your backpack.
|
||||
from.PlaySound( 0x240 );
|
||||
if (pack.TryDropItem(from, pot, false))
|
||||
{
|
||||
from.SendLocalizedMessage(502243); // ...and place it into your backpack.
|
||||
from.PlaySound(0x240);
|
||||
|
||||
if ( --Held == 0 )
|
||||
from.SendLocalizedMessage( 502245 ); // The keg is now empty.
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage( 502244 ); // ...but there is no room for the bottle in your backpack.
|
||||
pot.Delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage( 502246 ); // The keg is empty.
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
from.LocalOverheadMessage( Network.MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that.
|
||||
}
|
||||
}
|
||||
if (--Held == 0)
|
||||
from.SendLocalizedMessage(502245); // The keg is now empty.
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage(502244); // ...but there is no room for the bottle in your backpack.
|
||||
pot.Delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage(502246); // The keg is empty.
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
|
||||
}
|
||||
}
|
||||
|
||||
public override bool OnDragDrop( Mobile from, Item item )
|
||||
{
|
||||
if (!(item is BasePotion pot))
|
||||
{
|
||||
from.SendLocalizedMessage( 502232 ); // The keg is not designed to hold that type of object.
|
||||
return false;
|
||||
}
|
||||
public override bool OnDragDrop(Mobile from, Item item)
|
||||
{
|
||||
if (!(item is BasePotion pot))
|
||||
{
|
||||
from.SendLocalizedMessage(502232); // The keg is not designed to hold that type of object.
|
||||
return false;
|
||||
}
|
||||
|
||||
int toHold = Math.Min( 100 - m_Held, pot.Amount );
|
||||
int toHold = Math.Min(100 - m_Held, pot.Amount);
|
||||
|
||||
if ( toHold <= 0 )
|
||||
{
|
||||
from.SendLocalizedMessage( 502233 ); // The keg will not hold any more!
|
||||
return false;
|
||||
}
|
||||
if (toHold <= 0)
|
||||
{
|
||||
from.SendLocalizedMessage(502233); // The keg will not hold any more!
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( m_Held == 0 )
|
||||
{
|
||||
#region Mondain's Legacy
|
||||
if ( (int) pot.PotionEffect >= (int) PotionEffect.Invisibility )
|
||||
{
|
||||
from.SendLocalizedMessage( 502232 ); // The keg is not designed to hold that type of object.
|
||||
return false;
|
||||
}
|
||||
#endregion
|
||||
if (m_Held == 0)
|
||||
{
|
||||
#region Mondain's Legacy
|
||||
|
||||
if ( GiveBottle( from, toHold ) )
|
||||
{
|
||||
m_Type = pot.PotionEffect;
|
||||
Held = toHold;
|
||||
if ((int)pot.PotionEffect >= (int)PotionEffect.Invisibility)
|
||||
{
|
||||
from.SendLocalizedMessage(502232); // The keg is not designed to hold that type of object.
|
||||
return false;
|
||||
}
|
||||
|
||||
from.PlaySound( 0x240 );
|
||||
#endregion
|
||||
|
||||
from.SendLocalizedMessage( 502237 ); // You place the empty bottle in your backpack.
|
||||
if (GiveBottle(from, toHold))
|
||||
{
|
||||
m_Type = pot.PotionEffect;
|
||||
Held = toHold;
|
||||
|
||||
pot.Consume( toHold );
|
||||
from.PlaySound(0x240);
|
||||
|
||||
if ( !pot.Deleted )
|
||||
pot.Bounce( from );
|
||||
from.SendLocalizedMessage(502237); // You place the empty bottle in your backpack.
|
||||
|
||||
return true;
|
||||
}
|
||||
pot.Consume(toHold);
|
||||
|
||||
from.SendLocalizedMessage( 502238 ); // You don't have room for the empty bottle in your backpack.
|
||||
return false;
|
||||
}
|
||||
if (!pot.Deleted)
|
||||
pot.Bounce(from);
|
||||
|
||||
if ( pot.PotionEffect != m_Type )
|
||||
{
|
||||
from.SendLocalizedMessage( 502236 ); // You decide that it would be a bad idea to mix different types of potions.
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
if ( GiveBottle( from, toHold ) )
|
||||
{
|
||||
Held += toHold;
|
||||
from.SendLocalizedMessage(502238); // You don't have room for the empty bottle in your backpack.
|
||||
return false;
|
||||
}
|
||||
|
||||
from.PlaySound( 0x240 );
|
||||
if (pot.PotionEffect != m_Type)
|
||||
{
|
||||
from.SendLocalizedMessage(
|
||||
502236); // You decide that it would be a bad idea to mix different types of potions.
|
||||
return false;
|
||||
}
|
||||
|
||||
from.SendLocalizedMessage( 502237 ); // You place the empty bottle in your backpack.
|
||||
if (GiveBottle(from, toHold))
|
||||
{
|
||||
Held += toHold;
|
||||
|
||||
pot.Consume( toHold );
|
||||
from.PlaySound(0x240);
|
||||
|
||||
if ( !pot.Deleted )
|
||||
pot.Bounce( from );
|
||||
from.SendLocalizedMessage(502237); // You place the empty bottle in your backpack.
|
||||
|
||||
return true;
|
||||
}
|
||||
pot.Consume(toHold);
|
||||
|
||||
from.SendLocalizedMessage( 502238 ); // You don't have room for the empty bottle in your backpack.
|
||||
return false;
|
||||
}
|
||||
if (!pot.Deleted)
|
||||
pot.Bounce(from);
|
||||
|
||||
public bool GiveBottle( Mobile m, int amount )
|
||||
{
|
||||
Container pack = m.Backpack;
|
||||
return true;
|
||||
}
|
||||
|
||||
Bottle bottle = new Bottle( amount );
|
||||
from.SendLocalizedMessage(502238); // You don't have room for the empty bottle in your backpack.
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( pack == null || !pack.TryDropItem( m, bottle, false ) )
|
||||
{
|
||||
bottle.Delete();
|
||||
return false;
|
||||
}
|
||||
public bool GiveBottle(Mobile m, int amount)
|
||||
{
|
||||
Container pack = m.Backpack;
|
||||
|
||||
return true;
|
||||
}
|
||||
Bottle bottle = new Bottle(amount);
|
||||
|
||||
public BasePotion FillBottle()
|
||||
{
|
||||
switch ( m_Type )
|
||||
{
|
||||
default:
|
||||
case PotionEffect.Nightsight: return new NightSightPotion();
|
||||
if (pack == null || !pack.TryDropItem(m, bottle, false))
|
||||
{
|
||||
bottle.Delete();
|
||||
return false;
|
||||
}
|
||||
|
||||
case PotionEffect.CureLesser: return new LesserCurePotion();
|
||||
case PotionEffect.Cure: return new CurePotion();
|
||||
case PotionEffect.CureGreater: return new GreaterCurePotion();
|
||||
return true;
|
||||
}
|
||||
|
||||
case PotionEffect.Agility: return new AgilityPotion();
|
||||
case PotionEffect.AgilityGreater: return new GreaterAgilityPotion();
|
||||
public BasePotion FillBottle()
|
||||
{
|
||||
switch (m_Type)
|
||||
{
|
||||
default:
|
||||
case PotionEffect.Nightsight: return new NightSightPotion();
|
||||
|
||||
case PotionEffect.Strength: return new StrengthPotion();
|
||||
case PotionEffect.StrengthGreater: return new GreaterStrengthPotion();
|
||||
case PotionEffect.CureLesser: return new LesserCurePotion();
|
||||
case PotionEffect.Cure: return new CurePotion();
|
||||
case PotionEffect.CureGreater: return new GreaterCurePotion();
|
||||
|
||||
case PotionEffect.PoisonLesser: return new LesserPoisonPotion();
|
||||
case PotionEffect.Poison: return new PoisonPotion();
|
||||
case PotionEffect.PoisonGreater: return new GreaterPoisonPotion();
|
||||
case PotionEffect.PoisonDeadly: return new DeadlyPoisonPotion();
|
||||
case PotionEffect.Agility: return new AgilityPotion();
|
||||
case PotionEffect.AgilityGreater: return new GreaterAgilityPotion();
|
||||
|
||||
case PotionEffect.Refresh: return new RefreshPotion();
|
||||
case PotionEffect.RefreshTotal: return new TotalRefreshPotion();
|
||||
case PotionEffect.Strength: return new StrengthPotion();
|
||||
case PotionEffect.StrengthGreater: return new GreaterStrengthPotion();
|
||||
|
||||
case PotionEffect.HealLesser: return new LesserHealPotion();
|
||||
case PotionEffect.Heal: return new HealPotion();
|
||||
case PotionEffect.HealGreater: return new GreaterHealPotion();
|
||||
case PotionEffect.PoisonLesser: return new LesserPoisonPotion();
|
||||
case PotionEffect.Poison: return new PoisonPotion();
|
||||
case PotionEffect.PoisonGreater: return new GreaterPoisonPotion();
|
||||
case PotionEffect.PoisonDeadly: return new DeadlyPoisonPotion();
|
||||
|
||||
case PotionEffect.ExplosionLesser: return new LesserExplosionPotion();
|
||||
case PotionEffect.Explosion: return new ExplosionPotion();
|
||||
case PotionEffect.ExplosionGreater: return new GreaterExplosionPotion();
|
||||
case PotionEffect.Refresh: return new RefreshPotion();
|
||||
case PotionEffect.RefreshTotal: return new TotalRefreshPotion();
|
||||
|
||||
case PotionEffect.Conflagration: return new ConflagrationPotion();
|
||||
case PotionEffect.ConflagrationGreater: return new GreaterConflagrationPotion();
|
||||
case PotionEffect.HealLesser: return new LesserHealPotion();
|
||||
case PotionEffect.Heal: return new HealPotion();
|
||||
case PotionEffect.HealGreater: return new GreaterHealPotion();
|
||||
|
||||
case PotionEffect.ConfusionBlast: return new ConfusionBlastPotion();
|
||||
case PotionEffect.ConfusionBlastGreater: return new GreaterConfusionBlastPotion();
|
||||
}
|
||||
}
|
||||
case PotionEffect.ExplosionLesser: return new LesserExplosionPotion();
|
||||
case PotionEffect.Explosion: return new ExplosionPotion();
|
||||
case PotionEffect.ExplosionGreater: return new GreaterExplosionPotion();
|
||||
|
||||
public static void Initialize()
|
||||
{
|
||||
TileData.ItemTable[0x1940].Height = 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
case PotionEffect.Conflagration: return new ConflagrationPotion();
|
||||
case PotionEffect.ConflagrationGreater: return new GreaterConflagrationPotion();
|
||||
|
||||
case PotionEffect.ConfusionBlast: return new ConfusionBlastPotion();
|
||||
case PotionEffect.ConfusionBlastGreater: return new GreaterConfusionBlastPotion();
|
||||
}
|
||||
}
|
||||
|
||||
public static void Initialize()
|
||||
{
|
||||
TileData.ItemTable[0x1940].Height = 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,300 +1,308 @@
|
|||
using System;
|
||||
using Server.Prompts;
|
||||
using Server.Multis;
|
||||
using Server.Prompts;
|
||||
using Server.Regions;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
[FlippableAttribute( 0x1f14, 0x1f15, 0x1f16, 0x1f17 )]
|
||||
public class RecallRune : Item
|
||||
{
|
||||
private string m_Description;
|
||||
private bool m_Marked;
|
||||
private Map m_TargetMap;
|
||||
private BaseHouse m_House;
|
||||
[Flippable(0x1f14, 0x1f15, 0x1f16, 0x1f17)]
|
||||
public class RecallRune : Item
|
||||
{
|
||||
private const string RuneFormat = "a recall rune for {0}";
|
||||
private string m_Description;
|
||||
private BaseHouse m_House;
|
||||
private bool m_Marked;
|
||||
private Map m_TargetMap;
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
[Constructible]
|
||||
public RecallRune() : base(0x1F14)
|
||||
{
|
||||
Weight = 1.0;
|
||||
CalculateHue();
|
||||
}
|
||||
|
||||
if ( m_House != null && !m_House.Deleted )
|
||||
{
|
||||
writer.Write( (int) 1 ); // version
|
||||
public RecallRune(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
writer.Write( (Item) m_House );
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
[CommandProperty(AccessLevel.Counselor, AccessLevel.GameMaster)]
|
||||
public BaseHouse House
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_House != null && m_House.Deleted)
|
||||
House = null;
|
||||
|
||||
writer.Write( (string) m_Description );
|
||||
writer.Write( (bool) m_Marked );
|
||||
writer.Write( (Point3D) Target );
|
||||
writer.Write( (Map) m_TargetMap );
|
||||
}
|
||||
return m_House;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_House = value;
|
||||
CalculateHue();
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
[CommandProperty(AccessLevel.Counselor, AccessLevel.GameMaster)]
|
||||
public string Description
|
||||
{
|
||||
get => m_Description;
|
||||
set
|
||||
{
|
||||
m_Description = value;
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
|
||||
int version = reader.ReadInt();
|
||||
[CommandProperty(AccessLevel.Counselor, AccessLevel.GameMaster)]
|
||||
public bool Marked
|
||||
{
|
||||
get => m_Marked;
|
||||
set
|
||||
{
|
||||
if (m_Marked != value)
|
||||
{
|
||||
m_Marked = value;
|
||||
CalculateHue();
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
m_House = reader.ReadItem() as BaseHouse;
|
||||
goto case 0;
|
||||
}
|
||||
case 0:
|
||||
{
|
||||
m_Description = reader.ReadString();
|
||||
m_Marked = reader.ReadBool();
|
||||
Target = reader.ReadPoint3D();
|
||||
m_TargetMap = reader.ReadMap();
|
||||
[CommandProperty(AccessLevel.Counselor, AccessLevel.GameMaster)]
|
||||
public Point3D Target{ get; set; }
|
||||
|
||||
CalculateHue();
|
||||
[CommandProperty(AccessLevel.Counselor, AccessLevel.GameMaster)]
|
||||
public Map TargetMap
|
||||
{
|
||||
get => m_TargetMap;
|
||||
set
|
||||
{
|
||||
if (m_TargetMap != value)
|
||||
{
|
||||
m_TargetMap = value;
|
||||
CalculateHue();
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
[CommandProperty( AccessLevel.Counselor, AccessLevel.GameMaster )]
|
||||
public BaseHouse House
|
||||
{
|
||||
get
|
||||
{
|
||||
if ( m_House != null && m_House.Deleted )
|
||||
House = null;
|
||||
if (m_House != null && !m_House.Deleted)
|
||||
{
|
||||
writer.Write(1); // version
|
||||
|
||||
return m_House;
|
||||
}
|
||||
set{ m_House = value; CalculateHue(); InvalidateProperties(); }
|
||||
}
|
||||
writer.Write(m_House);
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.Counselor, AccessLevel.GameMaster )]
|
||||
public string Description
|
||||
{
|
||||
get => m_Description;
|
||||
set
|
||||
{
|
||||
m_Description = value;
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
writer.Write(m_Description);
|
||||
writer.Write(m_Marked);
|
||||
writer.Write(Target);
|
||||
writer.Write(m_TargetMap);
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.Counselor, AccessLevel.GameMaster )]
|
||||
public bool Marked
|
||||
{
|
||||
get => m_Marked;
|
||||
set
|
||||
{
|
||||
if ( m_Marked != value )
|
||||
{
|
||||
m_Marked = value;
|
||||
CalculateHue();
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
}
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
[CommandProperty( AccessLevel.Counselor, AccessLevel.GameMaster )]
|
||||
public Point3D Target { get; set; }
|
||||
int version = reader.ReadInt();
|
||||
|
||||
[CommandProperty( AccessLevel.Counselor, AccessLevel.GameMaster )]
|
||||
public Map TargetMap
|
||||
{
|
||||
get => m_TargetMap;
|
||||
set
|
||||
{
|
||||
if ( m_TargetMap != value )
|
||||
{
|
||||
m_TargetMap = value;
|
||||
CalculateHue();
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
}
|
||||
switch (version)
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
m_House = reader.ReadItem() as BaseHouse;
|
||||
goto case 0;
|
||||
}
|
||||
case 0:
|
||||
{
|
||||
m_Description = reader.ReadString();
|
||||
m_Marked = reader.ReadBool();
|
||||
Target = reader.ReadPoint3D();
|
||||
m_TargetMap = reader.ReadMap();
|
||||
|
||||
private void CalculateHue()
|
||||
{
|
||||
if ( !m_Marked )
|
||||
Hue = 0;
|
||||
else if ( m_TargetMap == Map.Trammel )
|
||||
Hue = (House != null ? 0x47F : 50);
|
||||
else if ( m_TargetMap == Map.Felucca )
|
||||
Hue = (House != null ? 0x66D : 0);
|
||||
else if ( m_TargetMap == Map.Ilshenar )
|
||||
Hue = (House != null ? 0x55F : 1102);
|
||||
else if ( m_TargetMap == Map.Malas )
|
||||
Hue = (House != null ? 0x55F : 1102);
|
||||
else if ( m_TargetMap == Map.Tokuno )
|
||||
Hue = (House != null ? 0x47F : 1154);
|
||||
}
|
||||
CalculateHue();
|
||||
|
||||
public void Mark( Mobile m )
|
||||
{
|
||||
m_Marked = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool setDesc = false;
|
||||
if ( Core.AOS )
|
||||
{
|
||||
m_House = BaseHouse.FindHouseAt( m );
|
||||
private void CalculateHue()
|
||||
{
|
||||
if (!m_Marked)
|
||||
Hue = 0;
|
||||
else if (m_TargetMap == Map.Trammel)
|
||||
Hue = House != null ? 0x47F : 50;
|
||||
else if (m_TargetMap == Map.Felucca)
|
||||
Hue = House != null ? 0x66D : 0;
|
||||
else if (m_TargetMap == Map.Ilshenar)
|
||||
Hue = House != null ? 0x55F : 1102;
|
||||
else if (m_TargetMap == Map.Malas)
|
||||
Hue = House != null ? 0x55F : 1102;
|
||||
else if (m_TargetMap == Map.Tokuno)
|
||||
Hue = House != null ? 0x47F : 1154;
|
||||
}
|
||||
|
||||
if ( m_House == null )
|
||||
{
|
||||
Target = m.Location;
|
||||
m_TargetMap = m.Map;
|
||||
}
|
||||
else
|
||||
{
|
||||
HouseSign sign = m_House.Sign;
|
||||
public void Mark(Mobile m)
|
||||
{
|
||||
m_Marked = true;
|
||||
|
||||
if ( sign != null )
|
||||
m_Description = sign.Name;
|
||||
else
|
||||
m_Description = null;
|
||||
bool setDesc = false;
|
||||
if (Core.AOS)
|
||||
{
|
||||
m_House = BaseHouse.FindHouseAt(m);
|
||||
|
||||
if ( m_Description == null || (m_Description = m_Description.Trim()).Length == 0 )
|
||||
m_Description = "an unnamed house";
|
||||
if (m_House == null)
|
||||
{
|
||||
Target = m.Location;
|
||||
m_TargetMap = m.Map;
|
||||
}
|
||||
else
|
||||
{
|
||||
HouseSign sign = m_House.Sign;
|
||||
|
||||
setDesc = true;
|
||||
if (sign != null)
|
||||
m_Description = sign.Name;
|
||||
else
|
||||
m_Description = null;
|
||||
|
||||
int x = m_House.BanLocation.X;
|
||||
int y = m_House.BanLocation.Y + 2;
|
||||
int z = m_House.BanLocation.Z;
|
||||
if (m_Description == null || (m_Description = m_Description.Trim()).Length == 0)
|
||||
m_Description = "an unnamed house";
|
||||
|
||||
Map map = m_House.Map;
|
||||
setDesc = true;
|
||||
|
||||
if ( map != null && !map.CanFit( x, y, z, 16, false, false ) )
|
||||
z = map.GetAverageZ( x, y );
|
||||
int x = m_House.BanLocation.X;
|
||||
int y = m_House.BanLocation.Y + 2;
|
||||
int z = m_House.BanLocation.Z;
|
||||
|
||||
Target = new Point3D( x, y, z );
|
||||
m_TargetMap = map;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_House = null;
|
||||
Target = m.Location;
|
||||
m_TargetMap = m.Map;
|
||||
}
|
||||
Map map = m_House.Map;
|
||||
|
||||
if ( !setDesc )
|
||||
m_Description = BaseRegion.GetRuneNameFor( Region.Find( Target, m_TargetMap ) );
|
||||
if (map != null && !map.CanFit(x, y, z, 16, false, false))
|
||||
z = map.GetAverageZ(x, y);
|
||||
|
||||
CalculateHue();
|
||||
InvalidateProperties();
|
||||
}
|
||||
Target = new Point3D(x, y, z);
|
||||
m_TargetMap = map;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_House = null;
|
||||
Target = m.Location;
|
||||
m_TargetMap = m.Map;
|
||||
}
|
||||
|
||||
private const string RuneFormat = "a recall rune for {0}";
|
||||
if (!setDesc)
|
||||
m_Description = BaseRegion.GetRuneNameFor(Region.Find(Target, m_TargetMap));
|
||||
|
||||
public override void GetProperties( ObjectPropertyList list )
|
||||
{
|
||||
base.GetProperties( list );
|
||||
CalculateHue();
|
||||
InvalidateProperties();
|
||||
}
|
||||
|
||||
if ( m_Marked )
|
||||
{
|
||||
string desc;
|
||||
public override void GetProperties(ObjectPropertyList list)
|
||||
{
|
||||
base.GetProperties(list);
|
||||
|
||||
if ( (desc = m_Description) == null || (desc = desc.Trim()).Length == 0 )
|
||||
desc = "an unknown location";
|
||||
if (m_Marked)
|
||||
{
|
||||
string desc;
|
||||
|
||||
if ( m_TargetMap == Map.Tokuno )
|
||||
list.Add( (House != null ? 1063260 : 1063259), RuneFormat, desc ); // ~1_val~ (Tokuno Islands)[(House)]
|
||||
else if ( m_TargetMap == Map.Malas )
|
||||
list.Add( (House != null ? 1062454 : 1060804), RuneFormat, desc ); // ~1_val~ (Malas)[(House)]
|
||||
else if ( m_TargetMap == Map.Felucca )
|
||||
list.Add( (House != null ? 1062452 : 1060805), RuneFormat, desc ); // ~1_val~ (Felucca)[(House)]
|
||||
else if ( m_TargetMap == Map.Trammel )
|
||||
list.Add( (House != null ? 1062453 : 1060806), RuneFormat, desc ); // ~1_val~ (Trammel)[(House)]
|
||||
else
|
||||
list.Add( (House != null ? "{0} ({1})(House)" : "{0} ({1})"), string.Format( RuneFormat, desc ), m_TargetMap );
|
||||
}
|
||||
}
|
||||
if ((desc = m_Description) == null || (desc = desc.Trim()).Length == 0)
|
||||
desc = "an unknown location";
|
||||
|
||||
public override void OnSingleClick( Mobile from )
|
||||
{
|
||||
if ( m_Marked )
|
||||
{
|
||||
string desc;
|
||||
if (m_TargetMap == Map.Tokuno)
|
||||
list.Add(House != null ? 1063260 : 1063259, RuneFormat, desc); // ~1_val~ (Tokuno Islands)[(House)]
|
||||
else if (m_TargetMap == Map.Malas)
|
||||
list.Add(House != null ? 1062454 : 1060804, RuneFormat, desc); // ~1_val~ (Malas)[(House)]
|
||||
else if (m_TargetMap == Map.Felucca)
|
||||
list.Add(House != null ? 1062452 : 1060805, RuneFormat, desc); // ~1_val~ (Felucca)[(House)]
|
||||
else if (m_TargetMap == Map.Trammel)
|
||||
list.Add(House != null ? 1062453 : 1060806, RuneFormat, desc); // ~1_val~ (Trammel)[(House)]
|
||||
else
|
||||
list.Add(House != null ? "{0} ({1})(House)" : "{0} ({1})", string.Format(RuneFormat, desc), m_TargetMap);
|
||||
}
|
||||
}
|
||||
|
||||
if ( (desc = m_Description) == null || (desc = desc.Trim()).Length == 0 )
|
||||
desc = "an unknown location";
|
||||
public override void OnSingleClick(Mobile from)
|
||||
{
|
||||
if (m_Marked)
|
||||
{
|
||||
string desc;
|
||||
|
||||
if ( m_TargetMap == Map.Tokuno )
|
||||
LabelTo( from, (House != null ? 1063260 : 1063259), string.Format( RuneFormat, desc ) ); // ~1_val~ (Tokuno Islands)[(House)]
|
||||
else if ( m_TargetMap == Map.Malas )
|
||||
LabelTo( from, (House != null ? 1062454 : 1060804), string.Format( RuneFormat, desc ) ); // ~1_val~ (Malas)[(House)]
|
||||
else if ( m_TargetMap == Map.Felucca )
|
||||
LabelTo( from, (House != null ? 1062452 : 1060805), string.Format( RuneFormat, desc ) ); // ~1_val~ (Felucca)[(House)]
|
||||
else if ( m_TargetMap == Map.Trammel )
|
||||
LabelTo( from, (House != null ? 1062453 : 1060806), string.Format( RuneFormat, desc ) ); // ~1_val~ (Trammel)[(House)]
|
||||
else
|
||||
LabelTo( from, (House != null ? "{0} ({1})(House)" : "{0} ({1})"), string.Format( RuneFormat, desc ), m_TargetMap );
|
||||
}
|
||||
else
|
||||
{
|
||||
LabelTo( from, "an unmarked recall rune" );
|
||||
}
|
||||
}
|
||||
if ((desc = m_Description) == null || (desc = desc.Trim()).Length == 0)
|
||||
desc = "an unknown location";
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
int number;
|
||||
if (m_TargetMap == Map.Tokuno)
|
||||
LabelTo(from, House != null ? 1063260 : 1063259,
|
||||
string.Format(RuneFormat, desc)); // ~1_val~ (Tokuno Islands)[(House)]
|
||||
else if (m_TargetMap == Map.Malas)
|
||||
LabelTo(from, House != null ? 1062454 : 1060804,
|
||||
string.Format(RuneFormat, desc)); // ~1_val~ (Malas)[(House)]
|
||||
else if (m_TargetMap == Map.Felucca)
|
||||
LabelTo(from, House != null ? 1062452 : 1060805,
|
||||
string.Format(RuneFormat, desc)); // ~1_val~ (Felucca)[(House)]
|
||||
else if (m_TargetMap == Map.Trammel)
|
||||
LabelTo(from, House != null ? 1062453 : 1060806,
|
||||
string.Format(RuneFormat, desc)); // ~1_val~ (Trammel)[(House)]
|
||||
else
|
||||
LabelTo(from, House != null ? "{0} ({1})(House)" : "{0} ({1})", string.Format(RuneFormat, desc),
|
||||
m_TargetMap);
|
||||
}
|
||||
else
|
||||
{
|
||||
LabelTo(from, "an unmarked recall rune");
|
||||
}
|
||||
}
|
||||
|
||||
if ( !IsChildOf( from.Backpack ) )
|
||||
{
|
||||
number = 1042001; // That must be in your pack for you to use it.
|
||||
}
|
||||
else if ( House != null )
|
||||
{
|
||||
number = 1062399; // You cannot edit the description for this rune.
|
||||
}
|
||||
else if ( m_Marked )
|
||||
{
|
||||
number = 501804; // Please enter a description for this marked object.
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
int number;
|
||||
|
||||
from.Prompt = new RenamePrompt( this );
|
||||
}
|
||||
else
|
||||
{
|
||||
number = 501805; // That rune is not yet marked.
|
||||
}
|
||||
if (!IsChildOf(from.Backpack))
|
||||
{
|
||||
number = 1042001; // That must be in your pack for you to use it.
|
||||
}
|
||||
else if (House != null)
|
||||
{
|
||||
number = 1062399; // You cannot edit the description for this rune.
|
||||
}
|
||||
else if (m_Marked)
|
||||
{
|
||||
number = 501804; // Please enter a description for this marked object.
|
||||
|
||||
from.SendLocalizedMessage( number );
|
||||
}
|
||||
from.Prompt = new RenamePrompt(this);
|
||||
}
|
||||
else
|
||||
{
|
||||
number = 501805; // That rune is not yet marked.
|
||||
}
|
||||
|
||||
private class RenamePrompt : Prompt
|
||||
{
|
||||
private RecallRune m_Rune;
|
||||
from.SendLocalizedMessage(number);
|
||||
}
|
||||
|
||||
public RenamePrompt( RecallRune rune )
|
||||
{
|
||||
m_Rune = rune;
|
||||
}
|
||||
private class RenamePrompt : Prompt
|
||||
{
|
||||
private RecallRune m_Rune;
|
||||
|
||||
public override void OnResponse( Mobile from, string text )
|
||||
{
|
||||
if ( m_Rune.House == null && m_Rune.Marked )
|
||||
{
|
||||
m_Rune.Description = text;
|
||||
from.SendLocalizedMessage( 1010474 ); // The etching on the rune has been changed.
|
||||
}
|
||||
}
|
||||
}
|
||||
public RenamePrompt(RecallRune rune)
|
||||
{
|
||||
m_Rune = rune;
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public RecallRune() : base( 0x1F14 )
|
||||
{
|
||||
Weight = 1.0;
|
||||
CalculateHue();
|
||||
}
|
||||
|
||||
public RecallRune( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
public override void OnResponse(Mobile from, string text)
|
||||
{
|
||||
if (m_Rune.House == null && m_Rune.Marked)
|
||||
{
|
||||
m_Rune.Description = text;
|
||||
from.SendLocalizedMessage(1010474); // The etching on the rune has been changed.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue