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