Full Version : Doesnt Show WeaponAttributes
xmlspawner >>Scripting Support >>Doesnt Show WeaponAttributes


<< Prev | Next >>

Erica- 04-28-2007
Hi was wondering how can i get theses glasses to show the weapon attributes it complies but when you point on the glasses doesnt show this -->WeaponAttributes.HitLowerDefend = 30;
when i highlight it.
Any idea how to get that to show heres the 2 scripts that are together.
CODE
using System;
using Server;

namespace Server.Items
{
public class Glasses : BaseArmor
{
 public override int AosStrReq{ get{ return 45; } }
 public override int OldStrReq{ get{ return 40; } }

 public override int ArmorBase{ get{ return 30; } }

 public override ArmorMaterialType MaterialType{ get{ return ArmorMaterialType.Leather; } }  
 
 private AosWeaponAttributes m_AosWeaponAttributes;
 
 [CommandProperty( AccessLevel.GameMaster )]
 public AosWeaponAttributes WeaponAttributes
 {
  get{ return m_AosWeaponAttributes; }
 }

 [Constructable]
 public Glasses() : base( 0x2FB8 )
 {
      m_AosWeaponAttributes = new AosWeaponAttributes( this );
                Weight = 2.0;
 }

 public Glasses( Serial serial ) : base( serial )
 {
 }
 
 public override bool CanEquip( Mobile m )
 {
  if ( !m.NetState.SupportsExpansion( Expansion.ML ) )
  {
   m.SendLocalizedMessage( 1072791 ); // You must upgrade to Mondain's Legacy in order to use that item.
   
   return false;
  }
 
  return true;
 }
 
 public override void AppendChildNameProperties( ObjectPropertyList list )
 {
  base.AppendChildNameProperties( list );
 
  list.Add( 1075085 ); // Requirement: Mondain's Legacy
 }
 
 public override void AddResistanceProperties( ObjectPropertyList list )
 {
  int prop;

  if ( (prop = m_AosWeaponAttributes.HitColdArea) != 0 )
   list.Add( 1060416, prop.ToString() ); // hit cold area ~1_val~%

  if ( (prop = m_AosWeaponAttributes.HitDispel) != 0 )
   list.Add( 1060417, prop.ToString() ); // hit dispel ~1_val~%

  if ( (prop = m_AosWeaponAttributes.HitEnergyArea) != 0 )
   list.Add( 1060418, prop.ToString() ); // hit energy area ~1_val~%

  if ( (prop = m_AosWeaponAttributes.HitFireArea) != 0 )
   list.Add( 1060419, prop.ToString() ); // hit fire area ~1_val~%

  if ( (prop = m_AosWeaponAttributes.HitFireball) != 0 )
   list.Add( 1060420, prop.ToString() ); // hit fireball ~1_val~%

  if ( (prop = m_AosWeaponAttributes.HitHarm) != 0 )
   list.Add( 1060421, prop.ToString() ); // hit harm ~1_val~%

  if ( (prop = m_AosWeaponAttributes.HitLeechHits) != 0 )
   list.Add( 1060422, prop.ToString() ); // hit life leech ~1_val~%

  if ( (prop = m_AosWeaponAttributes.HitLightning) != 0 )
   list.Add( 1060423, prop.ToString() ); // hit lightning ~1_val~%

  if ( (prop = m_AosWeaponAttributes.HitLowerAttack) != 0 )
   list.Add( 1060424, prop.ToString() ); // hit lower attack ~1_val~%

  if ( (prop = m_AosWeaponAttributes.HitLowerDefend) != 0 )
   list.Add( 1060425, prop.ToString() ); // hit lower defense ~1_val~%

  if ( (prop = m_AosWeaponAttributes.HitMagicArrow) != 0 )
   list.Add( 1060426, prop.ToString() ); // hit magic arrow ~1_val~%

  if ( (prop = m_AosWeaponAttributes.HitLeechMana) != 0 )
   list.Add( 1060427, prop.ToString() ); // hit mana leech ~1_val~%

  if ( (prop = m_AosWeaponAttributes.HitPhysicalArea) != 0 )
   list.Add( 1060428, prop.ToString() ); // hit physical area ~1_val~%

  if ( (prop = m_AosWeaponAttributes.HitPoisonArea) != 0 )
   list.Add( 1060429, prop.ToString() ); // hit poison area ~1_val~%

  if ( (prop = m_AosWeaponAttributes.HitLeechStam) != 0 )
   list.Add( 1060430, prop.ToString() ); // hit stamina leech ~1_val~%
   
  base.AddResistanceProperties( list );
 }  
 
 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 );
 }
 
 private enum SaveFlag
 {
  None     = 0x00000000,
  WeaponAttributes  = 0x00000001,
 }
 
 public override void Serialize( GenericWriter writer )
 {
  base.Serialize( writer );
 
  writer.Write( (int) 0 ); // version  
 
  SaveFlag flags = SaveFlag.None;
 
  SetSaveFlag( ref flags, SaveFlag.WeaponAttributes, !m_AosWeaponAttributes.IsEmpty );
 
  writer.Write( (int) flags );
 
  if ( GetSaveFlag( flags, SaveFlag.WeaponAttributes ) )
   m_AosWeaponAttributes.Serialize( writer );
 }
 
 public override void Deserialize(GenericReader reader)
 {
  base.Deserialize( reader );
 
  int version = reader.ReadInt();
 
  SaveFlag flags = (SaveFlag) reader.ReadInt();
 
  if ( GetSaveFlag( flags, SaveFlag.WeaponAttributes ) )
   m_AosWeaponAttributes = new AosWeaponAttributes( this, reader );
  else
   m_AosWeaponAttributes = new AosWeaponAttributes( this );
 }
}
}

and heres the other one
CODE
using System;
using Server;

namespace Server.Items
{
public class MaceAndShieldGlasses : Glasses
{
 public override int LabelNumber{ get{ return 1073381; } } // Mace and Shield Reading Glasses

 public override int BasePhysicalResistance{ get{ return 25; } }
 public override int BaseFireResistance{ get{ return 10; } }
 public override int BaseColdResistance{ get{ return 10; } }
 public override int BasePoisonResistance{ get{ return 10; } }
 public override int BaseEnergyResistance{ get{ return 10; } }

 public override int InitMinHits{ get{ return 255; } }
 public override int InitMaxHits{ get{ return 255; } }

 [Constructable]
 public MaceAndShieldGlasses() : base()
 {
  Hue = 0x1DD;
 
  Attributes.BonusStr = 10;
  Attributes.BonusDex = 5;
 
  WeaponAttributes.HitLowerDefend = 30;
 }

 public MaceAndShieldGlasses( Serial serial ) : base( serial )
 {
 }
 
 public override void Serialize( GenericWriter writer )
 {
  base.Serialize( writer );
 
  writer.Write( (int) 0 ); // version
 }
 
 public override void Deserialize(GenericReader reader)
 {
  base.Deserialize( reader );
 
  int version = reader.ReadInt();
 }
}

public class GlassesOfTheArts : Glasses
{
 public override int LabelNumber{ get{ return 1073363; } } // Reading Glasses of the Arts

 public override int BasePhysicalResistance{ get{ return 10; } }
 public override int BaseFireResistance{ get{ return 8; } }
 public override int BaseColdResistance{ get{ return 8; } }
 public override int BasePoisonResistance{ get{ return 4; } }
 public override int BaseEnergyResistance{ get{ return 10; } }

 public override int InitMinHits{ get{ return 255; } }
 public override int InitMaxHits{ get{ return 255; } }

 [Constructable]
 public GlassesOfTheArts() : base()
 {
  Hue = 0x73;
 
  Attributes.BonusInt = 5;
  Attributes.BonusStr = 5;
  Attributes.BonusHits = 15;
 }

 public GlassesOfTheArts( Serial serial ) : base( serial )
 {
 }
 
 public override void Serialize( GenericWriter writer )
 {
  base.Serialize( writer );
 
  writer.Write( (int) 0 ); // version
 }
 
 public override void Deserialize(GenericReader reader)
 {
  base.Deserialize( reader );
 
  int version = reader.ReadInt();
 }
}

public class FoldedSteelGlasses : Glasses
{
 public override int LabelNumber{ get{ return 1073380; } } // Folded Steel Reading Glasses

 public override int BasePhysicalResistance{ get{ return 20; } }
 public override int BaseFireResistance{ get{ return 10; } }
 public override int BaseColdResistance{ get{ return 10; } }
 public override int BasePoisonResistance{ get{ return 10; } }
 public override int BaseEnergyResistance{ get{ return 10; } }

 public override int InitMinHits{ get{ return 255; } }
 public override int InitMaxHits{ get{ return 255; } }

 [Constructable]
 public FoldedSteelGlasses() : base()
 {
  Hue = 0x47E;
 
  Attributes.BonusStr = 8;
  Attributes.NightSight = 1;
  Attributes.DefendChance = 15;
 }

 public FoldedSteelGlasses( Serial serial ) : base( serial )
 {
 }
 
 public override void Serialize( GenericWriter writer )
 {
  base.Serialize( writer );
 
  writer.Write( (int) 0 ); // version
 }
 
 public override void Deserialize(GenericReader reader)
 {
  base.Deserialize( reader );
 
  int version = reader.ReadInt();
 }
}

public class TradesGlasses : Glasses
{
 public override int LabelNumber{ get{ return 1073362; } } // Reading Glasses of the Trades

 public override int BasePhysicalResistance{ get{ return 10; } }
 public override int BaseFireResistance{ get{ return 10; } }
 public override int BaseColdResistance{ get{ return 10; } }
 public override int BasePoisonResistance{ get{ return 10; } }
 public override int BaseEnergyResistance{ get{ return 10; } }

 public override int InitMinHits{ get{ return 255; } }
 public override int InitMaxHits{ get{ return 255; } }

 [Constructable]
 public TradesGlasses() : base()
 {
  Attributes.BonusStr = 10;
  Attributes.BonusInt = 10;
 }

 public TradesGlasses( Serial serial ) : base( serial )
 {
 }
 
 public override void Serialize( GenericWriter writer )
 {
  base.Serialize( writer );
 
  writer.Write( (int) 0 ); // version
 }
 
 public override void Deserialize(GenericReader reader)
 {
  base.Deserialize( reader );
 
  int version = reader.ReadInt();
 }
}

public class LyricalGlasses : Glasses
{
 public override int LabelNumber{ get{ return 1073382; } } // Lyrical Reading Glasses

 public override int BasePhysicalResistance{ get{ return 10; } }
 public override int BaseFireResistance{ get{ return 10; } }
 public override int BaseColdResistance{ get{ return 10; } }
 public override int BasePoisonResistance{ get{ return 10; } }
 public override int BaseEnergyResistance{ get{ return 10; } }

 public override int InitMinHits{ get{ return 255; } }
 public override int InitMaxHits{ get{ return 255; } }

 [Constructable]
 public LyricalGlasses() : base()
 {
  Hue = 0x47F;
 
  Attributes.ReflectPhysical = 15;
  Attributes.NightSight = 1;
 
  WeaponAttributes.HitLowerDefend = 20;
 }

 public LyricalGlasses( Serial serial ) : base( serial )
 {
 }
 
 public override void Serialize( GenericWriter writer )
 {
  base.Serialize( writer );
 
  writer.Write( (int) 0 ); // version
 }
 
 public override void Deserialize(GenericReader reader)
 {
  base.Deserialize( reader );
 
  int version = reader.ReadInt();
 }
}

public class AnthropomorphistGlasses : Glasses
{
 public override int LabelNumber{ get{ return 1073379; } } // Anthropomorphist Reading Glasses

 public override int BasePhysicalResistance{ get{ return 5; } }
 public override int BaseFireResistance{ get{ return 5; } }
 public override int BaseColdResistance{ get{ return 10; } }
 public override int BasePoisonResistance{ get{ return 20; } }
 public override int BaseEnergyResistance{ get{ return 20; } }

 public override int InitMinHits{ get{ return 255; } }
 public override int InitMaxHits{ get{ return 255; } }

 [Constructable]
 public AnthropomorphistGlasses() : base()
 {
  Hue = 0x80;
 
  Attributes.BonusHits = 5;
  Attributes.RegenMana = 3;
 }

 public AnthropomorphistGlasses( Serial serial ) : base( serial )
 {
 }
 
 public override void Serialize( GenericWriter writer )
 {
  base.Serialize( writer );
 
  writer.Write( (int) 0 ); // version
 }
 
 public override void Deserialize(GenericReader reader)
 {
  base.Deserialize( reader );
 
  int version = reader.ReadInt();
 }
}

public class LightOfWayGlasses : Glasses
{
 public override int LabelNumber{ get{ return 1073378; } } // Light of Way Reading Glasses

 public override int BasePhysicalResistance{ get{ return 10; } }
 public override int BaseFireResistance{ get{ return 10; } }
 public override int BaseColdResistance{ get{ return 10; } }
 public override int BasePoisonResistance{ get{ return 10; } }
 public override int BaseEnergyResistance{ get{ return 10; } }

 public override int InitMinHits{ get{ return 255; } }
 public override int InitMaxHits{ get{ return 255; } }

 [Constructable]
 public LightOfWayGlasses() : base()
 {
  Hue = 0x256;
 
  Attributes.BonusStr = 7;
  Attributes.BonusInt = 5;
  Attributes.WeaponDamage = 30;
 }

 public LightOfWayGlasses( Serial serial ) : base( serial )
 {
 }
 
 public override void Serialize( GenericWriter writer )
 {
  base.Serialize( writer );
 
  writer.Write( (int) 0 ); // version
 }
 
 public override void Deserialize(GenericReader reader)
 {
  base.Deserialize( reader );
 
  int version = reader.ReadInt();
 }
}

public class NecromanticGlasses : Glasses
{
 public override int LabelNumber{ get{ return 1073377; } } // Necromantic Reading Glasses

 public override int BasePhysicalResistance{ get{ return 0; } }
 public override int BaseFireResistance{ get{ return 0; } }
 public override int BaseColdResistance{ get{ return 0; } }
 public override int BasePoisonResistance{ get{ return 0; } }
 public override int BaseEnergyResistance{ get{ return 0; } }

 public override int InitMinHits{ get{ return 255; } }
 public override int InitMaxHits{ get{ return 255; } }

 [Constructable]
 public NecromanticGlasses() : base()
 {
  Hue = 0x22D;
 
  Attributes.LowerRegCost = 30;
  Attributes.LowerManaCost = 12;
 }

 public NecromanticGlasses( Serial serial ) : base( serial )
 {
 }
 
 public override void Serialize( GenericWriter writer )
 {
  base.Serialize( writer );
 
  writer.Write( (int) 0 ); // version
 }
 
 public override void Deserialize(GenericReader reader)
 {
  base.Deserialize( reader );
 
  int version = reader.ReadInt();
 }
}

public class WizardsCrystalGlasses : Glasses
{
 public override int LabelNumber{ get{ return 1073374; } } // Wizard's Crystal Reading Glasses

 public override int BasePhysicalResistance{ get{ return 5; } }
 public override int BaseFireResistance{ get{ return 5; } }
 public override int BaseColdResistance{ get{ return 5; } }
 public override int BasePoisonResistance{ get{ return 5; } }
 public override int BaseEnergyResistance{ get{ return 5; } }

 public override int InitMinHits{ get{ return 255; } }
 public override int InitMaxHits{ get{ return 255; } }

 [Constructable]
 public WizardsCrystalGlasses() : base()
 {
  Hue = 0x2B0;
 
  Attributes.BonusMana = 10;
  Attributes.RegenMana = 3;
  Attributes.SpellDamage = 15;
 }

 public WizardsCrystalGlasses( Serial serial ) : base( serial )
 {
 }
 
 public override void Serialize( GenericWriter writer )
 {
  base.Serialize( writer );
 
  writer.Write( (int) 0 ); // version
 }
 
 public override void Deserialize(GenericReader reader)
 {
  base.Deserialize( reader );
 
  int version = reader.ReadInt();
 }
}

public class MaritimeGlasses : Glasses
{
 public override int LabelNumber{ get{ return 1073364; } } // Maritime Reading Glasses

 public override int BasePhysicalResistance{ get{ return 3; } }
 public override int BaseFireResistance{ get{ return 4; } }
 public override int BaseColdResistance{ get{ return 30; } }
 public override int BasePoisonResistance{ get{ return 5; } }
 public override int BaseEnergyResistance{ get{ return 3; } }

 public override int InitMinHits{ get{ return 255; } }
 public override int InitMaxHits{ get{ return 255; } }

 [Constructable]
 public MaritimeGlasses() : base()
 {
  Hue = 0x581;
 
  Attributes.NightSight = 1;
  Attributes.Luck = 100;
  Attributes.ReflectPhysical = 20;
 }

 public MaritimeGlasses( Serial serial ) : base( serial )
 {
 }
 
 public override void Serialize( GenericWriter writer )
 {
  base.Serialize( writer );
 
  writer.Write( (int) 0 ); // version
 }
 
 public override void Deserialize(GenericReader reader)
 {
  base.Deserialize( reader );
 
  int version = reader.ReadInt();
 }
}

public class TreasuresAndTrinketsGlasses : Glasses
{
 public override int LabelNumber{ get{ return 1073373; } } // Treasures and Trinkets Reading Glasses

 public override int BasePhysicalResistance{ get{ return 10; } }
 public override int BaseFireResistance{ get{ return 10; } }
 public override int BaseColdResistance{ get{ return 10; } }
 public override int BasePoisonResistance{ get{ return 10; } }
 public override int BaseEnergyResistance{ get{ return 10; } }

 public override int InitMinHits{ get{ return 255; } }
 public override int InitMaxHits{ get{ return 255; } }

 [Constructable]
 public TreasuresAndTrinketsGlasses() : base()
 {
  Hue = 0x5A6; // TODO check
 
  Attributes.BonusInt = 10;
  Attributes.BonusHits = 5;
  Attributes.SpellDamage = 10;
 }

 public TreasuresAndTrinketsGlasses( Serial serial ) : base( serial )
 {
 }
 
 public override void Serialize( GenericWriter writer )
 {
  base.Serialize( writer );
 
  writer.Write( (int) 0 ); // version
 }
 
 public override void Deserialize(GenericReader reader)
 {
  base.Deserialize( reader );
 
  int version = reader.ReadInt();
 }
}

public class PoisonedGlasses : Glasses
{
 public override int LabelNumber{ get{ return 1073376; } } // Poisoned Reading Glasses

 public override int BasePhysicalResistance{ get{ return 10; } }
 public override int BaseFireResistance{ get{ return 10; } }
 public override int BaseColdResistance{ get{ return 10; } }
 public override int BasePoisonResistance{ get{ return 30; } }
 public override int BaseEnergyResistance{ get{ return 10; } }

 public override int InitMinHits{ get{ return 255; } }
 public override int InitMaxHits{ get{ return 255; } }

 [Constructable]
 public PoisonedGlasses() : base()
 {
  Hue = 0x55C; // TODO check
 
  Attributes.BonusStam = 3;
  Attributes.RegenStam = 4;
 }

 public PoisonedGlasses( Serial serial ) : base( serial )
 {
 }
 
 public override void Serialize( GenericWriter writer )
 {
  base.Serialize( writer );
 
  writer.Write( (int) 0 ); // version
 }
 
 public override void Deserialize(GenericReader reader)
 {
  base.Deserialize( reader );
 
  int version = reader.ReadInt();
 }
}
}


zotos- 05-08-2007
I would have just made them from base helmet, as they use the helmet layer. Would of saved you alot of work.

CODE
public override void AddResistanceProperties( ObjectPropertyList list )
{
 int prop;

 if ( (prop = m_AosWeaponAttributes.HitColdArea) != 0 )
  list.Add( 1060416, prop.ToString() ); // hit cold area ~1_val~%

 if ( (prop = m_AosWeaponAttributes.HitDispel) != 0 )
  list.Add( 1060417, prop.ToString() ); // hit dispel ~1_val~%

 if ( (prop = m_AosWeaponAttributes.HitEnergyArea) != 0 )
  list.Add( 1060418, prop.ToString() ); // hit energy area ~1_val~%

 if ( (prop = m_AosWeaponAttributes.HitFireArea) != 0 )
  list.Add( 1060419, prop.ToString() ); // hit fire area ~1_val~%

 if ( (prop = m_AosWeaponAttributes.HitFireball) != 0 )
  list.Add( 1060420, prop.ToString() ); // hit fireball ~1_val~%

 if ( (prop = m_AosWeaponAttributes.HitHarm) != 0 )
  list.Add( 1060421, prop.ToString() ); // hit harm ~1_val~%

 if ( (prop = m_AosWeaponAttributes.HitLeechHits) != 0 )
  list.Add( 1060422, prop.ToString() ); // hit life leech ~1_val~%

 if ( (prop = m_AosWeaponAttributes.HitLightning) != 0 )
  list.Add( 1060423, prop.ToString() ); // hit lightning ~1_val~%

 if ( (prop = m_AosWeaponAttributes.HitLowerAttack) != 0 )
  list.Add( 1060424, prop.ToString() ); // hit lower attack ~1_val~%

 if ( (prop = m_AosWeaponAttributes.HitLowerDefend) != 0 )
  list.Add( 1060425, prop.ToString() ); // hit lower defense ~1_val~%

 if ( (prop = m_AosWeaponAttributes.HitMagicArrow) != 0 )
  list.Add( 1060426, prop.ToString() ); // hit magic arrow ~1_val~%

 if ( (prop = m_AosWeaponAttributes.HitLeechMana) != 0 )
  list.Add( 1060427, prop.ToString() ); // hit mana leech ~1_val~%

 if ( (prop = m_AosWeaponAttributes.HitPhysicalArea) != 0 )
  list.Add( 1060428, prop.ToString() ); // hit physical area ~1_val~%

 if ( (prop = m_AosWeaponAttributes.HitPoisonArea) != 0 )
  list.Add( 1060429, prop.ToString() ); // hit poison area ~1_val~%

 if ( (prop = m_AosWeaponAttributes.HitLeechStam) != 0 )
  list.Add( 1060430, prop.ToString() ); // hit stamina leech ~1_val~%
 
 base.AddResistanceProperties( list );
}  

This might be the issue because it is already set up in base armor code. Also we need to know why isnt working. try using [props on the item and see if the property is being set on the item if it is try commenting out the above part and see if that works.