Upgrades code style - First batch (#22)
This commit is contained in:
parent
8ee42c8ea2
commit
632e8b4757
1834 changed files with 10245 additions and 10437 deletions
|
|
@ -8,9 +8,9 @@ using Server.Engines.VeteranRewards;
|
|||
namespace Server.Items
|
||||
{
|
||||
public class WeaponEngravingTool : Item, IUsesRemaining, IRewardItem
|
||||
{
|
||||
public override int LabelNumber{ get{ return 1076158; } } // Weapon Engraving Tool
|
||||
|
||||
{
|
||||
public override int LabelNumber => 1076158; // Weapon Engraving Tool
|
||||
|
||||
private int m_UsesRemaining;
|
||||
private bool m_IsRewardItem;
|
||||
|
||||
|
|
@ -20,12 +20,12 @@ namespace Server.Items
|
|||
get{ return m_UsesRemaining; }
|
||||
set{ m_UsesRemaining = value; InvalidateProperties(); }
|
||||
}
|
||||
|
||||
|
||||
public virtual bool ShowUsesRemaining
|
||||
{
|
||||
get{ return true; }
|
||||
{
|
||||
get{ return true; }
|
||||
set{}
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public bool IsRewardItem
|
||||
|
|
@ -33,76 +33,76 @@ namespace Server.Items
|
|||
get{ return m_IsRewardItem; }
|
||||
set{ m_IsRewardItem = value; InvalidateProperties(); }
|
||||
}
|
||||
|
||||
|
||||
[Constructible]
|
||||
public WeaponEngravingTool() : this( 10 )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
[Constructible]
|
||||
public WeaponEngravingTool( int uses ) : base( 0x32F8 )
|
||||
{
|
||||
LootType = LootType.Blessed;
|
||||
Weight = 1.0;
|
||||
|
||||
|
||||
m_UsesRemaining = uses;
|
||||
}
|
||||
|
||||
public WeaponEngravingTool( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
if ( m_IsRewardItem && !RewardSystem.CheckIsUsableBy( from, this, null ) )
|
||||
return;
|
||||
|
||||
|
||||
if ( m_UsesRemaining > 0 )
|
||||
{
|
||||
from.SendLocalizedMessage( 1072357 ); // Select an object to engrave.
|
||||
from.Target = new TargetWeapon( this );
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
if ( from.Skills.Tinkering.Value == 0 )
|
||||
{
|
||||
from.SendLocalizedMessage( 1076179 ); // Since you have no tinkering skill, you will need to find an NPC tinkerer to repair this for you.
|
||||
from.SendLocalizedMessage( 1076179 ); // Since you have no tinkering skill, you will need to find an NPC tinkerer to repair this for you.
|
||||
}
|
||||
else if ( from.Skills.Tinkering.Value < 75.0 )
|
||||
{
|
||||
{
|
||||
from.SendLocalizedMessage( 1076178 ); // Your tinkering skill is too low to fix this yourself. An NPC tinkerer can help you repair this for a fee.
|
||||
}
|
||||
else
|
||||
{
|
||||
Item diamond = from.Backpack.FindItemByType( typeof( BlueDiamond ) );
|
||||
|
||||
{
|
||||
Item diamond = from.Backpack.FindItemByType( typeof( BlueDiamond ) );
|
||||
|
||||
if ( diamond != null )
|
||||
from.SendGump( new ConfirmGump( this, null ) );
|
||||
else
|
||||
from.SendLocalizedMessage( 1076166 ); // You do not have a blue diamond needed to recharge the engraving tool.
|
||||
from.SendGump( new ConfirmGump( this, null ) );
|
||||
else
|
||||
from.SendLocalizedMessage( 1076166 ); // You do not have a blue diamond needed to recharge the engraving tool.
|
||||
}
|
||||
|
||||
|
||||
from.SendLocalizedMessage( 1076163 ); // There are no charges left on this engraving tool.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public override void GetProperties( ObjectPropertyList list )
|
||||
{
|
||||
base.GetProperties( list );
|
||||
|
||||
|
||||
if ( m_IsRewardItem )
|
||||
list.Add( 1076224 ); // 8th Year Veteran Reward
|
||||
|
||||
|
||||
if ( ShowUsesRemaining )
|
||||
list.Add( 1060584, m_UsesRemaining.ToString() ); // uses remaining: ~1_val~
|
||||
list.Add( 1060584, m_UsesRemaining.ToString() ); // uses remaining: ~1_val~
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
|
||||
|
||||
writer.Write( (int) m_UsesRemaining );
|
||||
writer.Write( (bool) m_IsRewardItem );
|
||||
}
|
||||
|
|
@ -110,27 +110,27 @@ namespace Server.Items
|
|||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
|
||||
m_UsesRemaining = reader.ReadInt();
|
||||
m_IsRewardItem = reader.ReadBool();
|
||||
}
|
||||
|
||||
|
||||
public virtual void Recharge( Mobile from, Mobile guildmaster )
|
||||
{
|
||||
{
|
||||
if ( from.Backpack != null )
|
||||
{
|
||||
Item diamond = from.Backpack.FindItemByType( typeof( BlueDiamond ) );
|
||||
|
||||
Item diamond = from.Backpack.FindItemByType( typeof( BlueDiamond ) );
|
||||
|
||||
if ( guildmaster != null )
|
||||
{
|
||||
if ( m_UsesRemaining <= 0 )
|
||||
{
|
||||
{
|
||||
if ( diamond != null && Banker.Withdraw( from, 100000 ) )
|
||||
{
|
||||
{
|
||||
diamond.Consume();
|
||||
UsesRemaining = 10;
|
||||
UsesRemaining = 10;
|
||||
guildmaster.Say( 1076165 ); // Your weapon engraver should be good as new!
|
||||
}
|
||||
else
|
||||
|
|
@ -140,59 +140,59 @@ namespace Server.Items
|
|||
guildmaster.Say( 1076164 ); // I can only help with this if you are carrying an engraving tool that needs repair.
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
if ( from.Skills.Tinkering.Value == 0 )
|
||||
{
|
||||
from.SendLocalizedMessage( 1076179 ); // Since you have no tinkering skill, you will need to find an NPC tinkerer to repair this for you.
|
||||
from.SendLocalizedMessage( 1076179 ); // Since you have no tinkering skill, you will need to find an NPC tinkerer to repair this for you.
|
||||
}
|
||||
else if ( from.Skills.Tinkering.Value < 75.0 )
|
||||
{
|
||||
{
|
||||
from.SendLocalizedMessage( 1076178 ); // Your tinkering skill is too low to fix this yourself. An NPC tinkerer can help you repair this for a fee.
|
||||
}
|
||||
else if ( diamond != null )
|
||||
{
|
||||
diamond.Consume();
|
||||
|
||||
|
||||
if ( Utility.RandomDouble() < from.Skills.Tinkering.Value / 100 )
|
||||
{
|
||||
UsesRemaining = 10;
|
||||
{
|
||||
UsesRemaining = 10;
|
||||
from.SendLocalizedMessage( 1076165 ); // Your weapon engraver should be good as new! ?????
|
||||
}
|
||||
else
|
||||
from.SendLocalizedMessage( 1076175 ); // You cracked the diamond attempting to fix the weapon engraver.
|
||||
}
|
||||
else
|
||||
from.SendLocalizedMessage( 1076166 ); // You do not have a blue diamond needed to recharge the engraving tool.
|
||||
}
|
||||
}
|
||||
from.SendLocalizedMessage( 1076166 ); // You do not have a blue diamond needed to recharge the engraving tool.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static WeaponEngravingTool Find( Mobile from )
|
||||
{
|
||||
if ( from.Backpack != null )
|
||||
return from.Backpack.FindItemByType( typeof( WeaponEngravingTool ) ) as WeaponEngravingTool;
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
private class TargetWeapon : Target
|
||||
{
|
||||
private WeaponEngravingTool m_Tool;
|
||||
|
||||
|
||||
public TargetWeapon( WeaponEngravingTool tool ) : base( -1, true, TargetFlags.None )
|
||||
{
|
||||
m_Tool = tool;
|
||||
}
|
||||
|
||||
|
||||
protected override void OnTarget( Mobile from, object targeted )
|
||||
{
|
||||
if ( m_Tool == null || m_Tool.Deleted )
|
||||
return;
|
||||
|
||||
|
||||
if ( targeted is BaseWeapon )
|
||||
{
|
||||
BaseWeapon item = (BaseWeapon) targeted;
|
||||
|
||||
|
||||
from.CloseGump( typeof( InternalGump ) );
|
||||
from.SendGump( new InternalGump( m_Tool, item ) );
|
||||
}
|
||||
|
|
@ -200,29 +200,29 @@ namespace Server.Items
|
|||
from.SendLocalizedMessage( 1072309 ); // The selected item cannot be engraved by this engraving tool.
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private class InternalGump : Gump
|
||||
{
|
||||
private WeaponEngravingTool m_Tool;
|
||||
private BaseWeapon m_Target;
|
||||
|
||||
|
||||
private enum Buttons
|
||||
{
|
||||
Cancel,
|
||||
Okay,
|
||||
Text
|
||||
}
|
||||
|
||||
|
||||
public InternalGump( WeaponEngravingTool tool, BaseWeapon target ) : base( 0, 0 )
|
||||
{
|
||||
m_Tool = tool;
|
||||
m_Target = target;
|
||||
|
||||
|
||||
Closable = true;
|
||||
Disposable = true;
|
||||
Dragable = true;
|
||||
Resizable = false;
|
||||
|
||||
|
||||
AddBackground( 50, 50, 400, 300, 0xA28 );
|
||||
|
||||
AddPage( 0 );
|
||||
|
|
@ -236,19 +236,19 @@ namespace Server.Items
|
|||
AddImageTiled( 75, 245, 2, 40, 0x23C3 );
|
||||
AddImageTiled( 75, 285, 350, 2, 0x23C5 );
|
||||
AddImageTiled( 425, 245, 2, 42, 0x23C3 );
|
||||
|
||||
|
||||
AddTextEntry( 75, 245, 350, 40, 0x0, (int) Buttons.Text, "" );
|
||||
}
|
||||
|
||||
|
||||
public override void OnResponse( Server.Network.NetState state, RelayInfo info )
|
||||
{
|
||||
{
|
||||
if ( m_Tool == null || m_Tool.Deleted || m_Target == null || m_Target.Deleted )
|
||||
return;
|
||||
|
||||
|
||||
if ( info.ButtonID == (int) Buttons.Okay )
|
||||
{
|
||||
TextRelay relay = info.GetTextEntry( (int) Buttons.Text );
|
||||
|
||||
|
||||
if ( relay != null )
|
||||
{
|
||||
if ( String.IsNullOrEmpty( relay.Text ) )
|
||||
|
|
@ -262,9 +262,9 @@ namespace Server.Items
|
|||
m_Target.EngravedText = Utility.FixHtml( relay.Text.Substring( 0, 64 ) );
|
||||
else
|
||||
m_Target.EngravedText = Utility.FixHtml( relay.Text );
|
||||
|
||||
state.Mobile.SendLocalizedMessage( 1072361 ); // You engraved the object.
|
||||
m_Target.InvalidateProperties();
|
||||
|
||||
state.Mobile.SendLocalizedMessage( 1072361 ); // You engraved the object.
|
||||
m_Target.InvalidateProperties();
|
||||
m_Tool.UsesRemaining -= 1;
|
||||
m_Tool.InvalidateProperties();
|
||||
}
|
||||
|
|
@ -274,33 +274,33 @@ namespace Server.Items
|
|||
state.Mobile.SendLocalizedMessage( 1072363 ); // The object was not engraved.
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public class ConfirmGump : Gump
|
||||
{
|
||||
{
|
||||
private WeaponEngravingTool m_Engraver;
|
||||
private Mobile m_Guildmaster;
|
||||
|
||||
|
||||
private enum Buttons
|
||||
{
|
||||
Cancel,
|
||||
Confirm
|
||||
}
|
||||
|
||||
|
||||
public ConfirmGump( WeaponEngravingTool engraver, Mobile guildmaster ) : base( 200, 200 )
|
||||
{
|
||||
{
|
||||
m_Engraver = engraver;
|
||||
m_Guildmaster = guildmaster;
|
||||
|
||||
|
||||
Closable = false;
|
||||
Disposable = true;
|
||||
Dragable = true;
|
||||
Resizable = false;
|
||||
|
||||
|
||||
AddPage( 0 );
|
||||
|
||||
AddBackground( 0, 0, 291, 133, 0x13BE );
|
||||
AddImageTiled( 5, 5, 280, 100, 0xA40 );
|
||||
|
||||
|
||||
if ( guildmaster != null )
|
||||
{
|
||||
AddHtmlLocalized( 9, 9, 272, 100, 1076169, 0x7FFF, false, false ); // It will cost you 100,000 gold and a blue diamond to recharge your weapon engraver with 10 charges.
|
||||
|
|
@ -311,20 +311,20 @@ namespace Server.Items
|
|||
AddHtmlLocalized( 9, 9, 272, 100, 1076176, 0x7FFF, false, false ); // You will need a blue diamond to repair the tip of the engraver. A successful repair will give the engraver 10 charges.
|
||||
AddHtmlLocalized( 195, 109, 120, 20, 1076177, 0x7FFF, false, false ); // Replace the tip.
|
||||
}
|
||||
|
||||
AddButton( 160, 107, 0xFB7, 0xFB8, (int) Buttons.Confirm, GumpButtonType.Reply, 0 );
|
||||
|
||||
AddButton( 160, 107, 0xFB7, 0xFB8, (int) Buttons.Confirm, GumpButtonType.Reply, 0 );
|
||||
AddButton( 5, 107, 0xFB1, 0xFB2, (int) Buttons.Cancel, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 40, 109, 100, 20, 1060051, 0x7FFF, false, false ); // CANCEL
|
||||
}
|
||||
|
||||
|
||||
public override void OnResponse( Server.Network.NetState state, RelayInfo info )
|
||||
{
|
||||
{
|
||||
if ( m_Engraver == null || m_Engraver.Deleted )
|
||||
return;
|
||||
|
||||
|
||||
if ( info.ButtonID == (int) Buttons.Confirm )
|
||||
m_Engraver.Recharge( state.Mobile, m_Guildmaster );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue