Fixes code according to modern code style. Fixes a few expression bugs.

This commit is contained in:
Kamron Batman 2018-09-15 09:58:51 -07:00
parent 89eea25e5f
commit 970fd563b2
3324 changed files with 441118 additions and 433755 deletions

View file

@ -1,171 +1,183 @@
using Server.Mobiles;
using Server.Engines.VeteranRewards;
using Server.Mobiles;
namespace Server.Items
{
public class CharacterStatueMaker : Item, IRewardItem
{
public override int LabelNumber => 1076173; // Character Statue Maker
public class CharacterStatueMaker : Item, IRewardItem
{
private bool m_IsRewardItem;
private StatueType m_Type;
private bool m_IsRewardItem;
private StatueType m_Type;
public CharacterStatueMaker(StatueType type) : base(0x32F0)
{
m_Type = type;
[CommandProperty( AccessLevel.GameMaster )]
public bool IsRewardItem
{
get => m_IsRewardItem;
set{ m_IsRewardItem = value; InvalidateProperties(); }
}
InvalidateHue();
[CommandProperty( AccessLevel.GameMaster )]
public StatueType StatueType
{
get => m_Type;
set{ m_Type = value; InvalidateHue(); }
}
LootType = LootType.Blessed;
Weight = 5.0;
}
public CharacterStatueMaker( StatueType type ) : base( 0x32F0 )
{
m_Type = type;
public CharacterStatueMaker(Serial serial) : base(serial)
{
}
InvalidateHue();
public override int LabelNumber => 1076173; // Character Statue Maker
LootType = LootType.Blessed;
Weight = 5.0;
}
[CommandProperty(AccessLevel.GameMaster)]
public StatueType StatueType
{
get => m_Type;
set
{
m_Type = value;
InvalidateHue();
}
}
public CharacterStatueMaker( Serial serial ) : base( serial )
{
}
[CommandProperty(AccessLevel.GameMaster)]
public bool IsRewardItem
{
get => m_IsRewardItem;
set
{
m_IsRewardItem = value;
InvalidateProperties();
}
}
public override void OnDoubleClick( Mobile from )
{
if ( m_IsRewardItem && !RewardSystem.CheckIsUsableBy( from, this, new object[] { m_Type } ) )
return;
public override void OnDoubleClick(Mobile from)
{
if (m_IsRewardItem && !RewardSystem.CheckIsUsableBy(from, this, new object[] { m_Type }))
return;
if ( IsChildOf( from.Backpack ) )
{
if ( !from.IsBodyMod )
{
from.SendLocalizedMessage( 1076194 ); // Select a place where you would like to put your statue.
from.Target = new CharacterStatueTarget( this, m_Type );
}
else
from.SendLocalizedMessage( 1073648 ); // You may only proceed while in your original state...
}
else
from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
}
if (IsChildOf(from.Backpack))
{
if (!from.IsBodyMod)
{
from.SendLocalizedMessage(1076194); // Select a place where you would like to put your statue.
from.Target = new CharacterStatueTarget(this, m_Type);
}
else
{
from.SendLocalizedMessage(1073648); // You may only proceed while in your original state...
}
}
else
{
from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
}
}
public override void GetProperties( ObjectPropertyList list )
{
base.GetProperties( list );
public override void GetProperties(ObjectPropertyList list)
{
base.GetProperties(list);
if ( m_IsRewardItem )
list.Add( 1076222 ); // 6th Year Veteran Reward
}
if (m_IsRewardItem)
list.Add(1076222); // 6th Year Veteran Reward
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.WriteEncodedInt( (int) 0 ); // version
writer.WriteEncodedInt(0); // version
writer.Write( (bool) m_IsRewardItem );
writer.Write( (int) m_Type );
}
writer.Write(m_IsRewardItem);
writer.Write((int)m_Type);
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadEncodedInt();
int version = reader.ReadEncodedInt();
m_IsRewardItem = reader.ReadBool();
m_Type = (StatueType) reader.ReadInt();
}
m_IsRewardItem = reader.ReadBool();
m_Type = (StatueType)reader.ReadInt();
}
public void InvalidateHue()
{
Hue = 0xB8F + (int) m_Type * 4;
}
}
public void InvalidateHue()
{
Hue = 0xB8F + (int)m_Type * 4;
}
}
public class MarbleStatueMaker : CharacterStatueMaker
{
[Constructible]
public MarbleStatueMaker() : base( StatueType.Marble )
{
}
public class MarbleStatueMaker : CharacterStatueMaker
{
[Constructible]
public MarbleStatueMaker() : base(StatueType.Marble)
{
}
public MarbleStatueMaker( Serial serial ) : base( serial )
{
}
public MarbleStatueMaker(Serial serial) : base(serial)
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.WriteEncodedInt( (int) 0 ); // version
}
writer.WriteEncodedInt(0); // version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadEncodedInt();
}
}
int version = reader.ReadEncodedInt();
}
}
public class JadeStatueMaker : CharacterStatueMaker
{
[Constructible]
public JadeStatueMaker() : base( StatueType.Jade )
{
}
public class JadeStatueMaker : CharacterStatueMaker
{
[Constructible]
public JadeStatueMaker() : base(StatueType.Jade)
{
}
public JadeStatueMaker( Serial serial ) : base( serial )
{
}
public JadeStatueMaker(Serial serial) : base(serial)
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.WriteEncodedInt( (int) 0 ); // version
}
writer.WriteEncodedInt(0); // version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadEncodedInt();
}
}
int version = reader.ReadEncodedInt();
}
}
public class BronzeStatueMaker : CharacterStatueMaker
{
[Constructible]
public BronzeStatueMaker() : base( StatueType.Bronze )
{
}
public class BronzeStatueMaker : CharacterStatueMaker
{
[Constructible]
public BronzeStatueMaker() : base(StatueType.Bronze)
{
}
public BronzeStatueMaker( Serial serial ) : base( serial )
{
}
public BronzeStatueMaker(Serial serial) : base(serial)
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.WriteEncodedInt( (int) 0 ); // version
}
writer.WriteEncodedInt(0); // version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadEncodedInt();
}
}
}
int version = reader.ReadEncodedInt();
}
}
}

View file

@ -5,125 +5,122 @@ using Server.Multis;
namespace Server.Items
{
public class CharacterStatuePlinth : Static, IAddon
{
public Item Deed => new CharacterStatueDeed( m_Statue );
public override int LabelNumber => 1076201; // Character Statue
public class CharacterStatuePlinth : Static, IAddon
{
private CharacterStatue m_Statue;
private CharacterStatue m_Statue;
public CharacterStatuePlinth(CharacterStatue statue) : base(0x32F2)
{
m_Statue = statue;
public CharacterStatuePlinth( CharacterStatue statue ) : base( 0x32F2 )
{
m_Statue = statue;
InvalidateHue();
}
InvalidateHue();
}
public CharacterStatuePlinth(Serial serial) : base(serial)
{
}
public CharacterStatuePlinth( Serial serial ) : base( serial )
{
}
public override int LabelNumber => 1076201; // Character Statue
public Item Deed => new CharacterStatueDeed(m_Statue);
public override void OnAfterDelete()
{
base.OnAfterDelete();
public virtual bool CouldFit(IPoint3D p, Map map)
{
Point3D point = new Point3D(p.X, p.Y, p.Z);
if ( m_Statue != null && !m_Statue.Deleted )
m_Statue.Delete();
}
if (map == null || !map.CanFit(point, 20))
return false;
public override void OnMapChange()
{
if ( m_Statue != null )
m_Statue.Map = Map;
}
BaseHouse house = BaseHouse.FindHouseAt(point, map, 20);
public override void OnLocationChange( Point3D oldLocation )
{
if ( m_Statue != null )
m_Statue.Location = new Point3D( X, Y, Z + 5 );
}
if (house == null)
return false;
public override void OnDoubleClick( Mobile from )
{
if ( m_Statue != null )
from.SendGump( new CharacterPlinthGump( m_Statue ) );
}
AddonFitResult result = CharacterStatueTarget.CheckDoors(point, 20, house);
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
if (result == AddonFitResult.Valid)
return true;
writer.WriteEncodedInt( (int) 0 ); // version
return false;
}
writer.Write( (Mobile) m_Statue );
}
public override void OnAfterDelete()
{
base.OnAfterDelete();
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
if (m_Statue != null && !m_Statue.Deleted)
m_Statue.Delete();
}
int version = reader.ReadEncodedInt();
public override void OnMapChange()
{
if (m_Statue != null)
m_Statue.Map = Map;
}
m_Statue = reader.ReadMobile() as CharacterStatue;
public override void OnLocationChange(Point3D oldLocation)
{
if (m_Statue != null)
m_Statue.Location = new Point3D(X, Y, Z + 5);
}
if ( m_Statue?.SculptedBy == null || Map == Map.Internal )
{
Timer.DelayCall( TimeSpan.Zero, Delete );
}
}
public override void OnDoubleClick(Mobile from)
{
if (m_Statue != null)
from.SendGump(new CharacterPlinthGump(m_Statue));
}
public void InvalidateHue()
{
if ( m_Statue != null )
Hue = 0xB8F + (int) m_Statue.StatueType * 4 + (int) m_Statue.Material;
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
public virtual bool CouldFit( IPoint3D p, Map map )
{
Point3D point = new Point3D( p.X, p.Y, p.Z );
writer.WriteEncodedInt(0); // version
if ( map == null || !map.CanFit( point, 20 ) )
return false;
writer.Write(m_Statue);
}
BaseHouse house = BaseHouse.FindHouseAt( point, map, 20 );
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
if ( house == null )
return false;
int version = reader.ReadEncodedInt();
AddonFitResult result = CharacterStatueTarget.CheckDoors( point, 20, house );
m_Statue = reader.ReadMobile() as CharacterStatue;
if ( result == AddonFitResult.Valid )
return true;
if (m_Statue?.SculptedBy == null || Map == Map.Internal) Timer.DelayCall(TimeSpan.Zero, Delete);
}
return false;
}
public void InvalidateHue()
{
if (m_Statue != null)
Hue = 0xB8F + (int)m_Statue.StatueType * 4 + (int)m_Statue.Material;
}
private class CharacterPlinthGump : Gump
{
public CharacterPlinthGump( CharacterStatue statue ) : base( 60, 30 )
{
Closable = true;
Disposable = true;
Dragable = true;
Resizable = false;
private class CharacterPlinthGump : Gump
{
public CharacterPlinthGump(CharacterStatue statue) : base(60, 30)
{
Closable = true;
Disposable = true;
Dragable = true;
Resizable = false;
AddPage( 0 );
AddImage( 0, 0, 0x24F4 );
AddHtml( 55, 50, 150, 20, statue.Name, false, false );
AddHtml( 55, 75, 150, 20, statue.SculptedOn.ToString(), false, false );
AddHtmlLocalized( 55, 100, 150, 20, GetTypeNumber( statue.StatueType ), 0, false, false );
}
AddPage(0);
AddImage(0, 0, 0x24F4);
AddHtml(55, 50, 150, 20, statue.Name, false, false);
AddHtml(55, 75, 150, 20, statue.SculptedOn.ToString(), false, false);
AddHtmlLocalized(55, 100, 150, 20, GetTypeNumber(statue.StatueType), 0, false, false);
}
public int GetTypeNumber( StatueType type )
{
switch ( type )
{
case StatueType.Marble: return 1076181;
case StatueType.Jade: return 1076180;
case StatueType.Bronze: return 1076230;
default: return 1076181;
}
}
}
}
}
public int GetTypeNumber(StatueType type)
{
switch (type)
{
case StatueType.Marble: return 1076181;
case StatueType.Jade: return 1076180;
case StatueType.Bronze: return 1076230;
default: return 1076181;
}
}
}
}
}

View file

@ -3,195 +3,196 @@ using Server.Network;
namespace Server.Gumps
{
public class CharacterStatueGump : Gump
{
private Item m_Maker;
private CharacterStatue m_Statue;
private Mobile m_Owner;
public class CharacterStatueGump : Gump
{
private Item m_Maker;
private Mobile m_Owner;
private CharacterStatue m_Statue;
private enum Buttons
{
Close,
Sculpt,
PosePrev,
PoseNext,
DirPrev,
DirNext,
MatPrev,
MatNext,
Restore
}
public CharacterStatueGump(Item maker, CharacterStatue statue, Mobile owner) : base(60, 36)
{
m_Maker = maker;
m_Statue = statue;
m_Owner = owner;
public CharacterStatueGump( Item maker, CharacterStatue statue, Mobile owner ) : base( 60, 36 )
{
m_Maker = maker;
m_Statue = statue;
m_Owner = owner;
if (m_Statue == null)
return;
if ( m_Statue == null )
return;
Closable = true;
Disposable = true;
Dragable = true;
Resizable = false;
Closable = true;
Disposable = true;
Dragable = true;
Resizable = false;
AddPage(0);
AddPage( 0 );
AddBackground(0, 0, 327, 324, 0x13BE);
AddImageTiled(10, 10, 307, 20, 0xA40);
AddImageTiled(10, 40, 307, 244, 0xA40);
AddImageTiled(10, 294, 307, 20, 0xA40);
AddAlphaRegion(10, 10, 307, 304);
AddHtmlLocalized(14, 12, 327, 20, 1076156, 0x7FFF, false, false); // Character Statue Maker
AddBackground( 0, 0, 327, 324, 0x13BE );
AddImageTiled( 10, 10, 307, 20, 0xA40 );
AddImageTiled( 10, 40, 307, 244, 0xA40 );
AddImageTiled( 10, 294, 307, 20, 0xA40 );
AddAlphaRegion( 10, 10, 307, 304 );
AddHtmlLocalized( 14, 12, 327, 20, 1076156, 0x7FFF, false, false ); // Character Statue Maker
// pose
AddHtmlLocalized(133, 41, 120, 20, 1076168, 0x7FFF, false, false); // Choose Pose
AddHtmlLocalized(133, 61, 120, 20, 1076208 + (int)m_Statue.Pose, 0x77E, false, false);
AddButton(163, 81, 0xFA5, 0xFA7, (int)Buttons.PoseNext, GumpButtonType.Reply, 0);
AddButton(133, 81, 0xFAE, 0xFB0, (int)Buttons.PosePrev, GumpButtonType.Reply, 0);
// pose
AddHtmlLocalized( 133, 41, 120, 20, 1076168, 0x7FFF, false, false ); // Choose Pose
AddHtmlLocalized( 133, 61, 120, 20, 1076208 + (int) m_Statue.Pose, 0x77E, false, false );
AddButton( 163, 81, 0xFA5, 0xFA7, (int) Buttons.PoseNext, GumpButtonType.Reply, 0 );
AddButton( 133, 81, 0xFAE, 0xFB0, (int) Buttons.PosePrev, GumpButtonType.Reply, 0 );
// direction
AddHtmlLocalized(133, 126, 120, 20, 1076170, 0x7FFF, false, false); // Choose Direction
AddHtmlLocalized(133, 146, 120, 20, GetDirectionNumber(m_Statue.Direction), 0x77E, false, false);
AddButton(163, 167, 0xFA5, 0xFA7, (int)Buttons.DirNext, GumpButtonType.Reply, 0);
AddButton(133, 167, 0xFAE, 0xFB0, (int)Buttons.DirPrev, GumpButtonType.Reply, 0);
// direction
AddHtmlLocalized( 133, 126, 120, 20, 1076170, 0x7FFF, false, false ); // Choose Direction
AddHtmlLocalized( 133, 146, 120, 20, GetDirectionNumber( m_Statue.Direction ), 0x77E, false, false );
AddButton( 163, 167, 0xFA5, 0xFA7, (int) Buttons.DirNext, GumpButtonType.Reply, 0 );
AddButton( 133, 167, 0xFAE, 0xFB0, (int) Buttons.DirPrev, GumpButtonType.Reply, 0 );
// material
AddHtmlLocalized(133, 211, 120, 20, 1076171, 0x7FFF, false, false); // Choose Material
AddHtmlLocalized(133, 231, 120, 20, GetMaterialNumber(m_Statue.StatueType, m_Statue.Material), 0x77E, false,
false);
AddButton(163, 253, 0xFA5, 0xFA7, (int)Buttons.MatNext, GumpButtonType.Reply, 0);
AddButton(133, 253, 0xFAE, 0xFB0, (int)Buttons.MatPrev, GumpButtonType.Reply, 0);
// material
AddHtmlLocalized( 133, 211, 120, 20, 1076171, 0x7FFF, false, false ); // Choose Material
AddHtmlLocalized( 133, 231, 120, 20, GetMaterialNumber( m_Statue.StatueType, m_Statue.Material ), 0x77E, false, false );
AddButton( 163, 253, 0xFA5, 0xFA7, (int) Buttons.MatNext, GumpButtonType.Reply, 0 );
AddButton( 133, 253, 0xFAE, 0xFB0, (int) Buttons.MatPrev, GumpButtonType.Reply, 0 );
// cancel
AddButton(10, 294, 0xFB1, 0xFB2, (int)Buttons.Close, GumpButtonType.Reply, 0);
AddHtmlLocalized(45, 294, 80, 20, 1006045, 0x7FFF, false, false); // Cancel
// cancel
AddButton( 10, 294, 0xFB1, 0xFB2, (int) Buttons.Close, GumpButtonType.Reply, 0 );
AddHtmlLocalized( 45, 294, 80, 20, 1006045, 0x7FFF, false, false ); // Cancel
// sculpt
AddButton(234, 294, 0xFB7, 0xFB9, (int)Buttons.Sculpt, GumpButtonType.Reply, 0);
AddHtmlLocalized(269, 294, 80, 20, 1076174, 0x7FFF, false, false); // Sculpt
// sculpt
AddButton( 234, 294, 0xFB7, 0xFB9, (int) Buttons.Sculpt, GumpButtonType.Reply, 0 );
AddHtmlLocalized( 269, 294, 80, 20, 1076174, 0x7FFF, false, false ); // Sculpt
// restore
if (m_Maker is CharacterStatueDeed)
{
AddButton(107, 294, 0xFAB, 0xFAD, (int)Buttons.Restore, GumpButtonType.Reply, 0);
AddHtmlLocalized(142, 294, 80, 20, 1076193, 0x7FFF, false, false); // Restore
}
}
// restore
if ( m_Maker is CharacterStatueDeed )
{
AddButton( 107, 294, 0xFAB, 0xFAD, (int) Buttons.Restore, GumpButtonType.Reply, 0 );
AddHtmlLocalized( 142, 294, 80, 20, 1076193, 0x7FFF, false, false ); // Restore
}
}
private int GetMaterialNumber(StatueType type, StatueMaterial material)
{
switch (material)
{
case StatueMaterial.Antique:
private int GetMaterialNumber( StatueType type, StatueMaterial material )
{
switch ( material )
{
case StatueMaterial.Antique:
switch (type)
{
case StatueType.Bronze: return 1076187;
case StatueType.Jade: return 1076186;
case StatueType.Marble: return 1076182;
}
switch ( type )
{
case StatueType.Bronze: return 1076187;
case StatueType.Jade: return 1076186;
case StatueType.Marble: return 1076182;
}
return 1076187;
case StatueMaterial.Dark:
return 1076187;
case StatueMaterial.Dark:
if (type == StatueType.Marble)
return 1076183;
if ( type == StatueType.Marble )
return 1076183;
return 1076182;
case StatueMaterial.Medium: return 1076184;
case StatueMaterial.Light: return 1076185;
default: return 1076187;
}
}
return 1076182;
case StatueMaterial.Medium: return 1076184;
case StatueMaterial.Light: return 1076185;
default: return 1076187;
}
}
private int GetDirectionNumber(Direction direction)
{
switch (direction)
{
case Direction.North: return 1075389;
case Direction.Right: return 1075388;
case Direction.East: return 1075387;
case Direction.Down: return 1076204;
case Direction.South: return 1075386;
case Direction.Left: return 1075391;
case Direction.West: return 1075390;
case Direction.Up: return 1076205;
default: return 1075386;
}
}
private int GetDirectionNumber( Direction direction )
{
switch ( direction )
{
case Direction.North: return 1075389;
case Direction.Right: return 1075388;
case Direction.East: return 1075387;
case Direction.Down: return 1076204;
case Direction.South: return 1075386;
case Direction.Left: return 1075391;
case Direction.West: return 1075390;
case Direction.Up: return 1076205;
default: return 1075386;
}
}
public override void OnResponse(NetState state, RelayInfo info)
{
if (m_Statue == null || m_Statue.Deleted)
return;
public override void OnResponse( NetState state, RelayInfo info )
{
if ( m_Statue == null || m_Statue.Deleted )
return;
bool sendGump = false;
bool sendGump = false;
if (info.ButtonID == (int)Buttons.Sculpt)
{
if (m_Maker is CharacterStatueDeed deed)
{
CharacterStatue backup = deed.Statue;
if ( info.ButtonID == (int) Buttons.Sculpt )
{
if ( m_Maker is CharacterStatueDeed deed )
{
CharacterStatue backup = deed.Statue;
backup?.Delete();
}
backup?.Delete();
}
m_Maker?.Delete();
m_Maker?.Delete();
m_Statue.Sculpt(state.Mobile);
}
else if (info.ButtonID == (int)Buttons.PosePrev)
{
m_Statue.Pose = (StatuePose)(((int)m_Statue.Pose + 5) % 6);
sendGump = true;
}
else if (info.ButtonID == (int)Buttons.PoseNext)
{
m_Statue.Pose = (StatuePose)(((int)m_Statue.Pose + 1) % 6);
sendGump = true;
}
else if (info.ButtonID == (int)Buttons.DirPrev)
{
m_Statue.Direction = (Direction)(((int)m_Statue.Direction + 7) % 8);
m_Statue.InvalidatePose();
sendGump = true;
}
else if (info.ButtonID == (int)Buttons.DirNext)
{
m_Statue.Direction = (Direction)(((int)m_Statue.Direction + 1) % 8);
m_Statue.InvalidatePose();
sendGump = true;
}
else if (info.ButtonID == (int)Buttons.MatPrev)
{
m_Statue.Material = (StatueMaterial)(((int)m_Statue.Material + 3) % 4);
sendGump = true;
}
else if (info.ButtonID == (int)Buttons.MatNext)
{
m_Statue.Material = (StatueMaterial)(((int)m_Statue.Material + 1) % 4);
sendGump = true;
}
else if (info.ButtonID == (int)Buttons.Restore)
{
if (m_Maker is CharacterStatueDeed deed)
{
CharacterStatue backup = deed.Statue;
m_Statue.Sculpt( state.Mobile );
}
else if ( info.ButtonID == (int) Buttons.PosePrev )
{
m_Statue.Pose = (StatuePose) ( ( (int) m_Statue.Pose + 5 ) % 6 );
sendGump = true;
}
else if ( info.ButtonID == (int) Buttons.PoseNext )
{
m_Statue.Pose = (StatuePose) ( ( (int) m_Statue.Pose + 1 ) % 6 );
sendGump = true;
}
else if ( info.ButtonID == (int) Buttons.DirPrev )
{
m_Statue.Direction = (Direction) ( ( (int) m_Statue.Direction + 7 ) % 8 );
m_Statue.InvalidatePose();
sendGump = true;
}
else if ( info.ButtonID == (int) Buttons.DirNext )
{
m_Statue.Direction = (Direction) ( ( (int) m_Statue.Direction + 1 ) % 8 );
m_Statue.InvalidatePose();
sendGump = true;
}
else if ( info.ButtonID == (int) Buttons.MatPrev )
{
m_Statue.Material = (StatueMaterial) ( ( (int) m_Statue.Material + 3 ) % 4 );
sendGump = true;
}
else if ( info.ButtonID == (int) Buttons.MatNext )
{
m_Statue.Material = (StatueMaterial) ( ( (int) m_Statue.Material + 1 ) % 4 );
sendGump = true;
}
else if ( info.ButtonID == (int) Buttons.Restore )
{
if ( m_Maker is CharacterStatueDeed deed )
{
CharacterStatue backup = deed.Statue;
if (backup != null)
m_Statue.Restore(backup);
}
if ( backup != null )
m_Statue.Restore( backup );
}
sendGump = true;
}
else // Close
{
sendGump = !m_Statue.Demolish(state.Mobile);
}
sendGump = true;
}
else // Close
{
sendGump = !m_Statue.Demolish( state.Mobile );
}
if (sendGump)
state.Mobile.SendGump(new CharacterStatueGump(m_Maker, m_Statue, m_Owner));
}
if ( sendGump )
state.Mobile.SendGump( new CharacterStatueGump( m_Maker, m_Statue, m_Owner ) );
}
}
}
private enum Buttons
{
Close,
Sculpt,
PosePrev,
PoseNext,
DirPrev,
DirNext,
MatPrev,
MatNext,
Restore
}
}
}

View file

@ -1,20 +1,20 @@
namespace Server.Network
{
public class UpdateStatueAnimation : Packet
{
public UpdateStatueAnimation( Mobile m, int status, int animation, int frame ) : base( 0xBF, 17 )
{
m_Stream.Write( (short) 0x11 );
m_Stream.Write( (short) 0x19 );
m_Stream.Write( (byte) 0x5 );
m_Stream.Write( (int) m.Serial );
m_Stream.Write( (byte) 0 );
m_Stream.Write( (byte) 0xFF );
m_Stream.Write( (byte) status );
m_Stream.Write( (byte) 0 );
m_Stream.Write( (byte) animation );
m_Stream.Write( (byte) 0 );
m_Stream.Write( (byte) frame );
}
}
}
public class UpdateStatueAnimation : Packet
{
public UpdateStatueAnimation(Mobile m, int status, int animation, int frame) : base(0xBF, 17)
{
m_Stream.Write((short)0x11);
m_Stream.Write((short)0x19);
m_Stream.Write((byte)0x5);
m_Stream.Write(m.Serial);
m_Stream.Write((byte)0);
m_Stream.Write((byte)0xFF);
m_Stream.Write((byte)status);
m_Stream.Write((byte)0);
m_Stream.Write((byte)animation);
m_Stream.Write((byte)0);
m_Stream.Write((byte)frame);
}
}
}

View file

@ -2,24 +2,24 @@ using System.Collections.Generic;
namespace Server.Engines.VeteranRewards
{
public class RewardCategory
{
public int Name { get; }
public class RewardCategory
{
public RewardCategory(int name)
{
Name = name;
Entries = new List<RewardEntry>();
}
public string NameString { get; }
public RewardCategory(string name)
{
NameString = name;
Entries = new List<RewardEntry>();
}
public List<RewardEntry> Entries { get; }
public int Name{ get; }
public RewardCategory( int name )
{
Name = name;
Entries = new List<RewardEntry>();
}
public string NameString{ get; }
public RewardCategory( string name )
{
NameString = name;
Entries = new List<RewardEntry>();
}
}
}
public List<RewardEntry> Entries{ get; }
}
}

View file

@ -5,193 +5,192 @@ using Server.Network;
namespace Server.Engines.VeteranRewards
{
public class RewardChoiceGump : Gump
{
private Mobile m_From;
public class RewardChoiceGump : Gump
{
private Mobile m_From;
private void RenderBackground()
{
AddPage( 0 );
public RewardChoiceGump(Mobile from) : base(0, 0)
{
m_From = from;
AddBackground( 10, 10, 600, 450, 2600 );
from.CloseGump(typeof(RewardChoiceGump));
AddButton( 530, 415, 4017, 4019, 0, GumpButtonType.Reply, 0 );
RenderBackground();
RenderCategories();
}
AddButton( 60, 415, 4014, 4016, 0, GumpButtonType.Page, 1 );
AddHtmlLocalized( 95, 415, 200, 20, 1049755, false, false ); // Main Menu
}
private void RenderBackground()
{
AddPage(0);
private void RenderCategories()
{
TimeSpan rewardInterval = RewardSystem.RewardInterval;
AddBackground(10, 10, 600, 450, 2600);
string intervalAsString;
AddButton(530, 415, 4017, 4019, 0, GumpButtonType.Reply, 0);
if ( rewardInterval == TimeSpan.FromDays( 30.0 ) )
intervalAsString = "month";
else if ( rewardInterval == TimeSpan.FromDays( 60.0 ) )
intervalAsString = "two months";
else if ( rewardInterval == TimeSpan.FromDays( 90.0 ) )
intervalAsString = "three months";
else if ( rewardInterval == TimeSpan.FromDays( 365.0 ) )
intervalAsString = "year";
else
intervalAsString = $"{rewardInterval.TotalDays} day{(rewardInterval.TotalDays == 1 ? "" : "s")}";
AddButton(60, 415, 4014, 4016, 0, GumpButtonType.Page, 1);
AddHtmlLocalized(95, 415, 200, 20, 1049755, false, false); // Main Menu
}
AddPage( 1 );
private void RenderCategories()
{
TimeSpan rewardInterval = RewardSystem.RewardInterval;
AddHtml( 60, 35, 500, 70, "<B>Ultima Online Rewards Program</B><BR>" +
"Thank you for being a part of the Ultima Online community for a full " + intervalAsString + ". " +
"As a token of our appreciation, you may select from the following in-game reward items listed below. " +
"The gift items will be attributed to the character you have logged-in with on the shard you are on when you chose the item(s). " +
"The number of rewards you are entitled to are listed below and are for your entire account. " +
"To read more about these rewards before making a selection, feel free to visit the uo.com site at " +
"<A HREF=\"http://www.uo.com/rewards\">http://www.uo.com/rewards</A>.", true, true );
string intervalAsString;
int cur, max;
if (rewardInterval == TimeSpan.FromDays(30.0))
intervalAsString = "month";
else if (rewardInterval == TimeSpan.FromDays(60.0))
intervalAsString = "two months";
else if (rewardInterval == TimeSpan.FromDays(90.0))
intervalAsString = "three months";
else if (rewardInterval == TimeSpan.FromDays(365.0))
intervalAsString = "year";
else
intervalAsString = $"{rewardInterval.TotalDays} day{(rewardInterval.TotalDays == 1 ? "" : "s")}";
RewardSystem.ComputeRewardInfo( m_From, out cur, out max );
AddPage(1);
AddHtmlLocalized( 60, 105, 300, 35, 1006006, false, false ); // Your current total of rewards to choose:
AddLabel( 370, 107, 50, (max - cur).ToString() );
AddHtml(60, 35, 500, 70, "<B>Ultima Online Rewards Program</B><BR>" +
"Thank you for being a part of the Ultima Online community for a full " +
intervalAsString + ". " +
"As a token of our appreciation, you may select from the following in-game reward items listed below. " +
"The gift items will be attributed to the character you have logged-in with on the shard you are on when you chose the item(s). " +
"The number of rewards you are entitled to are listed below and are for your entire account. " +
"To read more about these rewards before making a selection, feel free to visit the uo.com site at " +
"<A HREF=\"http://www.uo.com/rewards\">http://www.uo.com/rewards</A>.", true, true);
AddHtmlLocalized( 60, 140, 300, 35, 1006007, false, false ); // You have already chosen:
AddLabel( 370, 142, 50, cur.ToString() );
int cur, max;
RewardCategory[] categories = RewardSystem.Categories;
RewardSystem.ComputeRewardInfo(m_From, out cur, out max);
int page = 2;
AddHtmlLocalized(60, 105, 300, 35, 1006006, false, false); // Your current total of rewards to choose:
AddLabel(370, 107, 50, (max - cur).ToString());
for ( int i = 0; i < categories.Length; ++i )
{
if ( !RewardSystem.HasAccess( m_From, categories[i] ) )
{
page += 1;
continue;
}
AddHtmlLocalized(60, 140, 300, 35, 1006007, false, false); // You have already chosen:
AddLabel(370, 142, 50, cur.ToString());
AddButton( 100, 180 + (i * 40), 4005, 4005, 0, GumpButtonType.Page, page );
RewardCategory[] categories = RewardSystem.Categories;
page += PagesPerCategory( categories[ i ] );
int page = 2;
if ( categories[i].NameString != null )
AddHtml( 135, 180 + (i * 40), 300, 20, categories[i].NameString, false, false );
else
AddHtmlLocalized( 135, 180 + (i * 40), 300, 20, categories[i].Name, false, false );
}
for (int i = 0; i < categories.Length; ++i)
{
if (!RewardSystem.HasAccess(m_From, categories[i]))
{
page += 1;
continue;
}
page = 2;
AddButton(100, 180 + i * 40, 4005, 4005, 0, GumpButtonType.Page, page);
for ( int i = 0; i < categories.Length; ++i )
RenderCategory( categories[ i ], i, ref page );
}
page += PagesPerCategory(categories[i]);
private int PagesPerCategory( RewardCategory category )
{
List<RewardEntry> entries = category.Entries;
int j = 0, i = 0;
if (categories[i].NameString != null)
AddHtml(135, 180 + i * 40, 300, 20, categories[i].NameString, false, false);
else
AddHtmlLocalized(135, 180 + i * 40, 300, 20, categories[i].Name, false, false);
}
for ( j = 0; j < entries.Count; j++ )
{
if ( RewardSystem.HasAccess( m_From, entries[ j ] ) )
i++;
}
return (int) Math.Ceiling( i / 24.0 );
}
page = 2;
private int GetButtonID( int type, int index )
{
return 2 + (index * 20) + type;
}
for (int i = 0; i < categories.Length; ++i)
RenderCategory(categories[i], i, ref page);
}
private void RenderCategory( RewardCategory category, int index, ref int page )
{
AddPage( page );
private int PagesPerCategory(RewardCategory category)
{
List<RewardEntry> entries = category.Entries;
int j = 0, i = 0;
List<RewardEntry> entries = category.Entries;
for (j = 0; j < entries.Count; j++)
if (RewardSystem.HasAccess(m_From, entries[j]))
i++;
int i = 0;
for ( int j = 0; j < entries.Count; ++j )
{
RewardEntry entry = entries[j];
return (int)Math.Ceiling(i / 24.0);
}
if ( !RewardSystem.HasAccess( m_From, entry ) )
continue;
private int GetButtonID(int type, int index)
{
return 2 + index * 20 + type;
}
if ( i == 24 )
{
AddButton( 305, 415, 0xFA5, 0xFA7, 0, GumpButtonType.Page, ++page );
AddHtmlLocalized( 340, 415, 200, 20, 1011066, false, false ); // Next page
private void RenderCategory(RewardCategory category, int index, ref int page)
{
AddPage(page);
AddPage( page );
List<RewardEntry> entries = category.Entries;
AddButton( 270, 415, 0xFAE, 0xFB0, 0, GumpButtonType.Page, page - 1 );
AddHtmlLocalized( 185, 415, 200, 20, 1011067, false, false ); // Previous page
int i = 0;
i = 0;
}
for (int j = 0; j < entries.Count; ++j)
{
RewardEntry entry = entries[j];
AddButton( 55 + ((i / 12) * 250), 80 + ((i % 12) * 25), 5540, 5541, GetButtonID( index, j ), GumpButtonType.Reply, 0 );
if (!RewardSystem.HasAccess(m_From, entry))
continue;
if ( entry.NameString != null )
AddHtml( 80 + ((i / 12) * 250), 80 + ((i % 12) * 25), 250, 20, entry.NameString, false, false );
else
AddHtmlLocalized( 80 + ((i / 12) * 250), 80 + ((i % 12) * 25), 250, 20, entry.Name, false, false );
++i;
}
if (i == 24)
{
AddButton(305, 415, 0xFA5, 0xFA7, 0, GumpButtonType.Page, ++page);
AddHtmlLocalized(340, 415, 200, 20, 1011066, false, false); // Next page
page += 1;
}
AddPage(page);
public RewardChoiceGump( Mobile from ) : base( 0, 0 )
{
m_From = from;
AddButton(270, 415, 0xFAE, 0xFB0, 0, GumpButtonType.Page, page - 1);
AddHtmlLocalized(185, 415, 200, 20, 1011067, false, false); // Previous page
from.CloseGump( typeof( RewardChoiceGump ) );
i = 0;
}
RenderBackground();
RenderCategories();
}
AddButton(55 + i / 12 * 250, 80 + i % 12 * 25, 5540, 5541, GetButtonID(index, j), GumpButtonType.Reply, 0);
public override void OnResponse( NetState sender, RelayInfo info )
{
int buttonID = info.ButtonID - 1;
if (entry.NameString != null)
AddHtml(80 + i / 12 * 250, 80 + i % 12 * 25, 250, 20, entry.NameString, false, false);
else
AddHtmlLocalized(80 + i / 12 * 250, 80 + i % 12 * 25, 250, 20, entry.Name, false, false);
++i;
}
if ( buttonID == 0 )
{
int cur, max;
page += 1;
}
RewardSystem.ComputeRewardInfo( m_From, out cur, out max );
public override void OnResponse(NetState sender, RelayInfo info)
{
int buttonID = info.ButtonID - 1;
if ( cur < max )
m_From.SendGump( new RewardNoticeGump( m_From ) );
}
else
{
--buttonID;
if (buttonID == 0)
{
int cur, max;
int type = (buttonID % 20);
int index = (buttonID / 20);
RewardSystem.ComputeRewardInfo(m_From, out cur, out max);
RewardCategory[] categories = RewardSystem.Categories;
if (cur < max)
m_From.SendGump(new RewardNoticeGump(m_From));
}
else
{
--buttonID;
if ( type >= 0 && type < categories.Length )
{
RewardCategory category = categories[type];
int type = buttonID % 20;
int index = buttonID / 20;
if ( index >= 0 && index < category.Entries.Count )
{
RewardEntry entry = category.Entries[index];
RewardCategory[] categories = RewardSystem.Categories;
if ( !RewardSystem.HasAccess( m_From, entry ) )
return;
if (type >= 0 && type < categories.Length)
{
RewardCategory category = categories[type];
m_From.SendGump( new RewardConfirmGump( m_From, entry ) );
}
}
}
}
}
if (index >= 0 && index < category.Entries.Count)
{
RewardEntry entry = category.Entries[index];
if (!RewardSystem.HasAccess(m_From, entry))
return;
m_From.SendGump(new RewardConfirmGump(m_From, entry));
}
}
}
}
}
}

View file

@ -4,68 +4,69 @@ using Server.Network;
namespace Server.Engines.VeteranRewards
{
public class RewardConfirmGump : Gump
{
private Mobile m_From;
private RewardEntry m_Entry;
public class RewardConfirmGump : Gump
{
private RewardEntry m_Entry;
private Mobile m_From;
public RewardConfirmGump( Mobile from, RewardEntry entry ) : base( 0, 0 )
{
m_From = from;
m_Entry = entry;
public RewardConfirmGump(Mobile from, RewardEntry entry) : base(0, 0)
{
m_From = from;
m_Entry = entry;
from.CloseGump( typeof( RewardConfirmGump ) );
from.CloseGump(typeof(RewardConfirmGump));
AddPage( 0 );
AddPage(0);
AddBackground( 10, 10, 500, 300, 2600 );
AddBackground(10, 10, 500, 300, 2600);
AddHtmlLocalized( 30, 55, 300, 35, 1006000, false, false ); // You have selected:
AddHtmlLocalized(30, 55, 300, 35, 1006000, false, false); // You have selected:
if ( entry.NameString != null )
AddHtml( 335, 55, 150, 35, entry.NameString, false, false );
else
AddHtmlLocalized( 335, 55, 150, 35, entry.Name, false, false );
if (entry.NameString != null)
AddHtml(335, 55, 150, 35, entry.NameString, false, false);
else
AddHtmlLocalized(335, 55, 150, 35, entry.Name, false, false);
AddHtmlLocalized( 30, 95, 300, 35, 1006001, false, false ); // This will be assigned to this character:
AddLabel( 335, 95, 0, from.Name );
AddHtmlLocalized(30, 95, 300, 35, 1006001, false, false); // This will be assigned to this character:
AddLabel(335, 95, 0, from.Name);
AddHtmlLocalized( 35, 160, 450, 90, 1006002, true, true ); // Are you sure you wish to select this reward for this character? You will not be able to transfer this reward to another character on another shard. Click 'ok' below to confirm your selection or 'cancel' to go back to the selection screen.
AddHtmlLocalized(35, 160, 450, 90, 1006002, true,
true); // Are you sure you wish to select this reward for this character? You will not be able to transfer this reward to another character on another shard. Click 'ok' below to confirm your selection or 'cancel' to go back to the selection screen.
AddButton( 60, 265, 4005, 4007, 1, GumpButtonType.Reply, 0 );
AddHtmlLocalized( 95, 266, 150, 35, 1006044, false, false ); // Ok
AddButton(60, 265, 4005, 4007, 1, GumpButtonType.Reply, 0);
AddHtmlLocalized(95, 266, 150, 35, 1006044, false, false); // Ok
AddButton( 295, 265, 4017, 4019, 0, GumpButtonType.Reply, 0 );
AddHtmlLocalized( 330, 266, 150, 35, 1006045, false, false ); // Cancel
}
AddButton(295, 265, 4017, 4019, 0, GumpButtonType.Reply, 0);
AddHtmlLocalized(330, 266, 150, 35, 1006045, false, false); // Cancel
}
public override void OnResponse( NetState sender, RelayInfo info )
{
if ( info.ButtonID == 1 )
{
if ( !RewardSystem.HasAccess( m_From, m_Entry ) )
return;
public override void OnResponse(NetState sender, RelayInfo info)
{
if (info.ButtonID == 1)
{
if (!RewardSystem.HasAccess(m_From, m_Entry))
return;
Item item = m_Entry.Construct();
Item item = m_Entry.Construct();
if ( item != null )
{
if ( item is RedSoulstone soulstone )
soulstone.Account = m_From.Account.Username;
if (item != null)
{
if (item is RedSoulstone soulstone)
soulstone.Account = m_From.Account.Username;
if ( RewardSystem.ConsumeRewardPoint( m_From ) )
m_From.AddToBackpack( item );
else
item.Delete();
}
}
if (RewardSystem.ConsumeRewardPoint(m_From))
m_From.AddToBackpack(item);
else
item.Delete();
}
}
int cur, max;
int cur, max;
RewardSystem.ComputeRewardInfo( m_From, out cur, out max );
RewardSystem.ComputeRewardInfo(m_From, out cur, out max);
if ( cur < max )
m_From.SendGump( new RewardNoticeGump( m_From ) );
}
}
}
if (cur < max)
m_From.SendGump(new RewardNoticeGump(m_From));
}
}
}

View file

@ -4,66 +4,71 @@ using Server.Network;
namespace Server.Gumps
{
public class RewardDemolitionGump : Gump
{
private IAddon m_Addon;
public class RewardDemolitionGump : Gump
{
private IAddon m_Addon;
private enum Buttons
{
Cancel,
Confirm,
}
public RewardDemolitionGump(IAddon addon, int question) : base(150, 50)
{
m_Addon = addon;
public RewardDemolitionGump( IAddon addon, int question ) : base( 150, 50 )
{
m_Addon = addon;
Closable = true;
Disposable = true;
Dragable = true;
Resizable = false;
Closable = true;
Disposable = true;
Dragable = true;
Resizable = false;
AddBackground(0, 0, 220, 170, 0x13BE);
AddBackground(10, 10, 200, 150, 0xBB8);
AddBackground( 0, 0, 220, 170, 0x13BE );
AddBackground( 10, 10, 200, 150, 0xBB8 );
AddHtmlLocalized(20, 30, 180, 60, question, false, false); // Do you wish to re-deed this decoration?
AddHtmlLocalized( 20, 30, 180, 60, question, false, false ); // Do you wish to re-deed this decoration?
AddHtmlLocalized(55, 100, 150, 25, 1011011, false, false); // CONTINUE
AddButton(20, 100, 0xFA5, 0xFA7, (int)Buttons.Confirm, GumpButtonType.Reply, 0);
AddHtmlLocalized( 55, 100, 150, 25, 1011011, false, false ); // CONTINUE
AddButton( 20, 100, 0xFA5, 0xFA7, (int) Buttons.Confirm, GumpButtonType.Reply, 0 );
AddHtmlLocalized(55, 125, 150, 25, 1011012, false, false); // CANCEL
AddButton(20, 125, 0xFA5, 0xFA7, (int)Buttons.Cancel, GumpButtonType.Reply, 0);
}
AddHtmlLocalized( 55, 125, 150, 25, 1011012, false, false ); // CANCEL
AddButton( 20, 125, 0xFA5, 0xFA7, (int) Buttons.Cancel, GumpButtonType.Reply, 0 );
}
public override void OnResponse(NetState sender, RelayInfo info)
{
if (!(m_Addon is Item item) || item.Deleted)
return;
public override void OnResponse( NetState sender, RelayInfo info )
{
if ( !(m_Addon is Item item) || item.Deleted )
return;
if (info.ButtonID == (int)Buttons.Confirm)
{
Mobile m = sender.Mobile;
BaseHouse house = BaseHouse.FindHouseAt(m);
if ( info.ButtonID == (int) Buttons.Confirm )
{
Mobile m = sender.Mobile;
BaseHouse house = BaseHouse.FindHouseAt( m );
if (house?.IsOwner(m) == true)
{
if (m.InRange(item.Location, 2))
{
Item deed = m_Addon.Deed;
if ( house?.IsOwner( m ) == true )
{
if ( m.InRange( item.Location, 2 ) )
{
Item deed = m_Addon.Deed;
if (deed != null)
{
m.AddToBackpack(deed);
house.Addons.Remove(item);
item.Delete();
}
}
else
{
m.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
}
}
else
{
m.SendLocalizedMessage(
1049784); // You can only re-deed this decoration if you are the house owner or originally placed the decoration.
}
}
}
if ( deed != null )
{
m.AddToBackpack( deed );
house.Addons.Remove( item );
item.Delete();
}
}
else
m.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that.
}
else
m.SendLocalizedMessage( 1049784 ); // You can only re-deed this decoration if you are the house owner or originally placed the decoration.
}
}
}
}
private enum Buttons
{
Cancel,
Confirm
}
}
}

View file

@ -2,78 +2,80 @@ using System;
namespace Server.Engines.VeteranRewards
{
public class RewardEntry
{
public RewardList List { get; set; }
public class RewardEntry
{
public RewardEntry(RewardCategory category, int name, Type itemType, params object[] args)
{
Category = category;
ItemType = itemType;
RequiredExpansion = Expansion.None;
Name = name;
Args = args;
category.Entries.Add(this);
}
public RewardCategory Category { get; }
public RewardEntry(RewardCategory category, string name, Type itemType, params object[] args)
{
Category = category;
ItemType = itemType;
RequiredExpansion = Expansion.None;
NameString = name;
Args = args;
category.Entries.Add(this);
}
public Type ItemType { get; }
public RewardEntry(RewardCategory category, int name, Type itemType, Expansion requiredExpansion,
params object[] args)
{
Category = category;
ItemType = itemType;
RequiredExpansion = requiredExpansion;
Name = name;
Args = args;
category.Entries.Add(this);
}
public Expansion RequiredExpansion { get; }
public RewardEntry(RewardCategory category, string name, Type itemType, Expansion requiredExpansion,
params object[] args)
{
Category = category;
ItemType = itemType;
RequiredExpansion = requiredExpansion;
NameString = name;
Args = args;
category.Entries.Add(this);
}
public int Name { get; }
public RewardList List{ get; set; }
public string NameString { get; }
public RewardCategory Category{ get; }
public object[] Args { get; }
public Type ItemType{ get; }
public Item Construct()
{
try
{
Item item = Activator.CreateInstance( ItemType, Args ) as Item;
public Expansion RequiredExpansion{ get; }
if ( item is IRewardItem rewardItem )
rewardItem.IsRewardItem = true;
public int Name{ get; }
return item;
}
catch
{
}
public string NameString{ get; }
return null;
}
public object[] Args{ get; }
public RewardEntry( RewardCategory category, int name, Type itemType, params object[] args )
{
Category = category;
ItemType = itemType;
RequiredExpansion = Expansion.None;
Name = name;
Args = args;
category.Entries.Add( this );
}
public Item Construct()
{
try
{
Item item = Activator.CreateInstance(ItemType, Args) as Item;
public RewardEntry( RewardCategory category, string name, Type itemType, params object[] args )
{
Category = category;
ItemType = itemType;
RequiredExpansion = Expansion.None;
NameString = name;
Args = args;
category.Entries.Add( this );
}
if (item is IRewardItem rewardItem)
rewardItem.IsRewardItem = true;
public RewardEntry( RewardCategory category, int name, Type itemType, Expansion requiredExpansion, params object[] args )
{
Category = category;
ItemType = itemType;
RequiredExpansion = requiredExpansion;
Name = name;
Args = args;
category.Entries.Add( this );
}
return item;
}
catch
{
}
public RewardEntry( RewardCategory category, string name, Type itemType, Expansion requiredExpansion, params object[] args )
{
Category = category;
ItemType = itemType;
RequiredExpansion = requiredExpansion;
NameString = name;
Args = args;
category.Entries.Add( this );
}
}
}
return null;
}
}
}

View file

@ -2,19 +2,19 @@ using System;
namespace Server.Engines.VeteranRewards
{
public class RewardList
{
public TimeSpan Age { get; }
public class RewardList
{
public RewardList(TimeSpan interval, int index, RewardEntry[] entries)
{
Age = TimeSpan.FromDays(interval.TotalDays * index);
Entries = entries;
public RewardEntry[] Entries { get; }
for (int i = 0; i < entries.Length; ++i)
entries[i].List = this;
}
public RewardList( TimeSpan interval, int index, RewardEntry[] entries )
{
Age = TimeSpan.FromDays( interval.TotalDays * index );
Entries = entries;
public TimeSpan Age{ get; }
for ( int i = 0; i < entries.Length; ++i )
entries[i].List = this;
}
}
public RewardEntry[] Entries{ get; }
}
}

View file

@ -3,36 +3,36 @@ using Server.Network;
namespace Server.Engines.VeteranRewards
{
public class RewardNoticeGump : Gump
{
private Mobile m_From;
public class RewardNoticeGump : Gump
{
private Mobile m_From;
public RewardNoticeGump( Mobile from ) : base( 0, 0 )
{
m_From = from;
public RewardNoticeGump(Mobile from) : base(0, 0)
{
m_From = from;
from.CloseGump( typeof( RewardNoticeGump ) );
from.CloseGump(typeof(RewardNoticeGump));
AddPage( 0 );
AddPage(0);
AddBackground( 10, 10, 500, 135, 2600 );
AddBackground(10, 10, 500, 135, 2600);
/* You have reward items available.
* Click 'ok' below to get the selection menu or 'cancel' to be prompted upon your next login.
*/
AddHtmlLocalized( 52, 35, 420, 55, 1006046, true, true );
/* You have reward items available.
* Click 'ok' below to get the selection menu or 'cancel' to be prompted upon your next login.
*/
AddHtmlLocalized(52, 35, 420, 55, 1006046, true, true);
AddButton( 60, 95, 4005, 4007, 1, GumpButtonType.Reply, 0 );
AddHtmlLocalized( 95, 96, 150, 35, 1006044, false, false ); // Ok
AddButton(60, 95, 4005, 4007, 1, GumpButtonType.Reply, 0);
AddHtmlLocalized(95, 96, 150, 35, 1006044, false, false); // Ok
AddButton( 285, 95, 4017, 4019, 0, GumpButtonType.Reply, 0 );
AddHtmlLocalized( 320, 96, 150, 35, 1006045, false, false ); // Cancel
}
AddButton(285, 95, 4017, 4019, 0, GumpButtonType.Reply, 0);
AddHtmlLocalized(320, 96, 150, 35, 1006045, false, false); // Cancel
}
public override void OnResponse( NetState sender, RelayInfo info )
{
if ( info.ButtonID == 1 )
m_From.SendGump( new RewardChoiceGump( m_From ) );
}
}
public override void OnResponse(NetState sender, RelayInfo info)
{
if (info.ButtonID == 1)
m_From.SendGump(new RewardChoiceGump(m_From));
}
}
}

View file

@ -3,95 +3,89 @@ using Server.Network;
namespace Server.Gumps
{
public interface IRewardOption
{
void GetOptions( RewardOptionList list );
void OnOptionSelected( Mobile from, int choice );
}
public interface IRewardOption
{
void GetOptions(RewardOptionList list);
void OnOptionSelected(Mobile from, int choice);
}
public class RewardOptionGump : Gump
{
private RewardOptionList m_Options = new RewardOptionList();
private IRewardOption m_Option;
public class RewardOptionGump : Gump
{
private IRewardOption m_Option;
private RewardOptionList m_Options = new RewardOptionList();
public RewardOptionGump( IRewardOption option ) : this( option, 0 )
{
}
public RewardOptionGump(IRewardOption option) : this(option, 0)
{
}
public RewardOptionGump( IRewardOption option, int title ) : base( 60, 36 )
{
m_Option = option;
public RewardOptionGump(IRewardOption option, int title) : base(60, 36)
{
m_Option = option;
m_Option?.GetOptions( m_Options );
m_Option?.GetOptions(m_Options);
AddPage( 0 );
AddPage(0);
AddBackground( 0, 0, 273, 324, 0x13BE );
AddImageTiled( 10, 10, 253, 20, 0xA40 );
AddImageTiled( 10, 40, 253, 244, 0xA40 );
AddImageTiled( 10, 294, 253, 20, 0xA40 );
AddAlphaRegion( 10, 10, 253, 304 );
AddBackground(0, 0, 273, 324, 0x13BE);
AddImageTiled(10, 10, 253, 20, 0xA40);
AddImageTiled(10, 40, 253, 244, 0xA40);
AddImageTiled(10, 294, 253, 20, 0xA40);
AddAlphaRegion(10, 10, 253, 304);
AddButton( 10, 294, 0xFB1, 0xFB2, 0, GumpButtonType.Reply, 0 );
AddHtmlLocalized( 45, 296, 450, 20, 1060051, 0x7FFF, false, false ); // CANCEL
AddButton(10, 294, 0xFB1, 0xFB2, 0, GumpButtonType.Reply, 0);
AddHtmlLocalized(45, 296, 450, 20, 1060051, 0x7FFF, false, false); // CANCEL
if ( title > 0 )
AddHtmlLocalized( 14, 12, 273, 20, title, 0x7FFF, false, false );
else
AddHtmlLocalized( 14, 12, 273, 20, 1080392, 0x7FFF, false, false ); // Select your choice from the menu below.
if (title > 0)
AddHtmlLocalized(14, 12, 273, 20, title, 0x7FFF, false, false);
else
AddHtmlLocalized(14, 12, 273, 20, 1080392, 0x7FFF, false, false); // Select your choice from the menu below.
AddPage( 1 );
AddPage(1);
for ( int i = 0; i < m_Options.Count; i++ )
{
AddButton( 19, 49 + i * 24, 0x845, 0x846, m_Options[ i ].ID, GumpButtonType.Reply, 0 );
AddHtmlLocalized( 44, 47 + i * 24, 213, 20, m_Options[ i ].Cliloc, 0x7FFF, false, false );
}
}
for (int i = 0; i < m_Options.Count; i++)
{
AddButton(19, 49 + i * 24, 0x845, 0x846, m_Options[i].ID, GumpButtonType.Reply, 0);
AddHtmlLocalized(44, 47 + i * 24, 213, 20, m_Options[i].Cliloc, 0x7FFF, false, false);
}
}
public override void OnResponse( NetState sender, RelayInfo info )
{
if ( m_Option != null && Contains( info.ButtonID ) )
m_Option.OnOptionSelected( sender.Mobile, info.ButtonID );
}
public override void OnResponse(NetState sender, RelayInfo info)
{
if (m_Option != null && Contains(info.ButtonID))
m_Option.OnOptionSelected(sender.Mobile, info.ButtonID);
}
private bool Contains( int chosen )
{
if ( m_Options == null )
return false;
private bool Contains(int chosen)
{
if (m_Options == null)
return false;
foreach ( RewardOption option in m_Options )
{
if ( option.ID == chosen )
return true;
}
foreach (RewardOption option in m_Options)
if (option.ID == chosen)
return true;
return false;
}
}
return false;
}
}
public class RewardOption
{
public int ID { get; }
public class RewardOption
{
public RewardOption(int id, int cliloc)
{
ID = id;
Cliloc = cliloc;
}
public int Cliloc { get; }
public int ID{ get; }
public RewardOption( int id, int cliloc )
{
ID = id;
Cliloc = cliloc;
}
}
public int Cliloc{ get; }
}
public class RewardOptionList : List<RewardOption>
{
public RewardOptionList()
{
}
public void Add( int id, int cliloc )
{
Add( new RewardOption( id, cliloc ) );
}
}
}
public class RewardOptionList : List<RewardOption>
{
public void Add(int id, int cliloc)
{
Add(new RewardOption(id, cliloc));
}
}
}

File diff suppressed because it is too large Load diff