- Items can now be repaired while wearing them. - Items can now be fortified while wearing them. - Fixed repair deed messages not sending. - Sound effect added to powder of fortifying. - Map issue for fishing and SOSs fixed, where it would not allow fishing in empty resource banks when not on the target SOS map. - Added proximity spawner. - Improved spawner mouseover menu, now also shows types set on the spawner which are not yet spawned. - Fixed spawners only deleting half of their spawned objects when deleted. - Added the ability to set TextDefinition objects in the props gump. - WaitTeleporters now round delays to nearest in the remaining time messages. - Updated TextDefinition to be more usable; made it parsable from string and added safe serialization/deserialization methods. - Improved checking whether a mobile can flee. - Monsters that give ML minor artifacts will no longer flee when low on hits (like paragons). - Monsters that give ML minor artifacts will no longer spawn as paragon. - Fixed issue with pets not eating certain foods. - AI and targeting fixes for Red Death, Pyre and Swoop. - Fame and karma added to Rend. - Swoop corrected to have 0 karma. - Stat and skill tweaks for Putrefier. - Changelings will no longer show their fame title when morphed. - Added travel restrictions for ML dungeons. - Fixed issue of travel restriction message displaying twice. - Monster teleporting is no longer affected by region travel restrictions.
145 lines
3.1 KiB
C#
145 lines
3.1 KiB
C#
using System;
|
|
using Server;
|
|
|
|
namespace Server.Items
|
|
{
|
|
[PropertyObject]
|
|
public class TalismanAttribute
|
|
{
|
|
private Type m_Type;
|
|
private TextDefinition m_Name;
|
|
private int m_Amount;
|
|
|
|
[CommandProperty( AccessLevel.GameMaster )]
|
|
public Type Type
|
|
{
|
|
get{ return m_Type; }
|
|
set{ m_Type = value; }
|
|
}
|
|
|
|
[CommandProperty( AccessLevel.GameMaster )]
|
|
public TextDefinition Name
|
|
{
|
|
get{ return m_Name; }
|
|
set{ m_Name = value; }
|
|
}
|
|
|
|
[CommandProperty( AccessLevel.GameMaster )]
|
|
public int Amount
|
|
{
|
|
get { return m_Amount; }
|
|
set { m_Amount = value; }
|
|
}
|
|
|
|
[CommandProperty( AccessLevel.GameMaster )]
|
|
public bool IsEmpty
|
|
{
|
|
get { return m_Type == null; }
|
|
}
|
|
|
|
[CommandProperty( AccessLevel.GameMaster )]
|
|
public bool IsItem
|
|
{
|
|
get { return m_Type != null && m_Type.Namespace.Equals( "Server.Items" ); }
|
|
}
|
|
|
|
public TalismanAttribute() : this( null, 0, 0 )
|
|
{
|
|
}
|
|
|
|
public TalismanAttribute( TalismanAttribute copy )
|
|
{
|
|
if ( copy != null )
|
|
{
|
|
m_Type = copy.Type;
|
|
m_Name = copy.Name;
|
|
m_Amount = copy.Amount;
|
|
}
|
|
}
|
|
|
|
public TalismanAttribute( Type type, TextDefinition name ) : this( type, name, 0 )
|
|
{
|
|
}
|
|
|
|
public TalismanAttribute( Type type, TextDefinition name, int amount )
|
|
{
|
|
m_Type = type;
|
|
m_Name = name;
|
|
m_Amount = amount;
|
|
}
|
|
|
|
public TalismanAttribute( GenericReader reader )
|
|
{
|
|
int version = reader.ReadInt();
|
|
|
|
SaveFlag flags = (SaveFlag) reader.ReadEncodedInt();
|
|
|
|
if ( GetSaveFlag( flags, SaveFlag.Type ) )
|
|
m_Type = ScriptCompiler.FindTypeByFullName( reader.ReadString(), false );
|
|
|
|
if ( GetSaveFlag( flags, SaveFlag.Name ) )
|
|
m_Name = TextDefinition.Deserialize( reader );
|
|
|
|
if ( GetSaveFlag( flags, SaveFlag.Amount ) )
|
|
m_Amount = reader.ReadEncodedInt();
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
if ( m_Type != null )
|
|
return m_Type.Name;
|
|
|
|
return "None";
|
|
}
|
|
|
|
private static void SetSaveFlag( ref SaveFlag flags, SaveFlag toSet, bool setIf )
|
|
{
|
|
if ( setIf )
|
|
flags |= toSet;
|
|
}
|
|
|
|
private static bool GetSaveFlag( SaveFlag flags, SaveFlag toGet )
|
|
{
|
|
return ( (flags & toGet) != 0 );
|
|
}
|
|
|
|
[Flags]
|
|
private enum SaveFlag
|
|
{
|
|
None = 0x00000000,
|
|
Type = 0x00000001,
|
|
Name = 0x00000002,
|
|
Amount = 0x00000004,
|
|
}
|
|
|
|
public virtual void Serialize( GenericWriter writer )
|
|
{
|
|
writer.Write( (int) 0 ); // version
|
|
|
|
SaveFlag flags = SaveFlag.None;
|
|
|
|
SetSaveFlag( ref flags, SaveFlag.Type, m_Type != null );
|
|
SetSaveFlag( ref flags, SaveFlag.Name, m_Name != null );
|
|
SetSaveFlag( ref flags, SaveFlag.Amount, m_Amount != 0 );
|
|
|
|
writer.WriteEncodedInt( (int) flags );
|
|
|
|
if ( GetSaveFlag( flags, SaveFlag.Type ) )
|
|
writer.Write( m_Type.FullName );
|
|
|
|
if ( GetSaveFlag( flags, SaveFlag.Name ) )
|
|
TextDefinition.Serialize( writer, m_Name );
|
|
|
|
if ( GetSaveFlag( flags, SaveFlag.Amount ) )
|
|
writer.WriteEncodedInt( m_Amount );
|
|
}
|
|
|
|
public int DamageBonus( Mobile to )
|
|
{
|
|
if ( to != null && to.GetType() == m_Type )
|
|
return m_Amount;
|
|
|
|
return 0;
|
|
}
|
|
}
|
|
}
|