View Single Post
Old 07-18-2004, 03:51 AM   #3 (permalink)
sidsid
Greatwizard
 
sidsid's Avatar
 
Join Date: Mar 2004
Location: orange county, CA
Age: 27
Posts: 1,111
Default

OK, Im going to post a rewrite of this, cause they are neato, but its terrible having them spread out like that. Here is the same things with an enum and better constructable, makes it a lot smaller, cleaner, and easier to add to.
Code:
using System;
using Server;
namespace Server.Items
{
 public enum CityGlobeType
 {
  Britain,
  Bucs,
  Cove,
  Delucia,
  Empath,
  Jhelom,
  Lycaeum,
  Magincia,
  Minoc,
  Moonglow,
  Nujelom,
  Ocllo,
  Papua,
  Serpents,
  Skara,
  Trinsic,
  Vesper,
  Wind,
  Yew,
  Ancient,
  Blackthorne,
  Exodus,
  Lakeshire,
  LakeFire,
  Ethereal,
  Mistas,
  Montor,
  TwinOaks,
  Karnaugh,
  Chaos,
  Valor,
  Spirit,
  Sacrifice,
  Justice,
  Humility,
  Honor,
  Honesty,
  Compassion
 }
 public class CityGlobeInfo
 {
  private int m_LabelNumber;
  public string m_name;
  public int LabelNumber{ get{ return m_LabelNumber; } }
  public CityGlobeInfo( int labelNumber, string name )
  {
   m_LabelNumber = labelNumber;
   m_name = name;
  }
  private static CityGlobeInfo[] m_Table = new CityGlobeInfo[]
   {
	/* Britain */  new CityGlobeInfo( 1041454, "" ),
	/* Bucs */   new CityGlobeInfo( 1041458, "" ),
	/* Cove */   new CityGlobeInfo( 1041466, "" ),
	/* Delucia */  new CityGlobeInfo( 1041465, "" ),
	/* Empath */  new CityGlobeInfo( 1041469, "" ),
	/* Jhelom */  new CityGlobeInfo( 1041462, "" ),
	/* Lycaeum */  new CityGlobeInfo( 1041470, "" ),
	/* Magincia */  new CityGlobeInfo( 1041457, "" ),
	/* Minoc */   new CityGlobeInfo( 1041456, "" ),
	/* Moonglow */  new CityGlobeInfo( 1041455, "" ),
	/* Nujelom */  new CityGlobeInfo( 1041463, "" ),
	/* Ocllo */   new CityGlobeInfo( 1041467, "" ),
	/* Papua */   new CityGlobeInfo( 1041464, "" ),
	/* Serpents */  new CityGlobeInfo( 1041468, "" ),
	/* Skara */   new CityGlobeInfo( 1041461, "" ),
	/* Trinsic */  new CityGlobeInfo( 1041459, "" ),
	/* Vesper */  new CityGlobeInfo( 1041471, "" ),
	/* Wind */   new CityGlobeInfo( 1049472, "" ),
	/* Yew */   new CityGlobeInfo( 1049460, "" ),
	/* Ancient */  new CityGlobeInfo( 0, "A snowy scene of the Ancient Citadel" ),
	/* Blackthorne */ new CityGlobeInfo( 0, "A snowy scene of Blackthorne's Castle" ),
	/* Exodus */  new CityGlobeInfo( 0, "A snowy scene of Exodus's Lair" ),
	/* Lakeshire */  new CityGlobeInfo( 0, "A snowy scene of Lakeshire" ),
	/* Fire lake */  new CityGlobeInfo( 0, "A snowy scene of the Lake of Fire" ),
	/* Ethereal */  new CityGlobeInfo( 0, "A snowy scene of the Ethereal Fortress" ),
	/* Mistas */  new CityGlobeInfo( 0, "A snowy scene of Mistas" ),
	/* Montor */  new CityGlobeInfo( 0, "A snowy scene of Montor" ),
	/* Twin Oaks */  new CityGlobeInfo( 0, "A snowy scene of Twin Oaks" ),
	/* Karnaugh */  new CityGlobeInfo( 0, "A snowy scene of the Pass of Karnaugh" ),
	/* Chaos */   new CityGlobeInfo( 0, "A snowy scene of the Shrine of Chaos" ),
	/* Valor */   new CityGlobeInfo( 0, "A snowy scene of the Shrine of Valor" ),
	/* Spirit */  new CityGlobeInfo( 0, "A snowy scene of the Shrine of Spirituality" ),
	/* Sacr */   new CityGlobeInfo( 0, "A snowy scene of the Shrine of Sacrifice" ),
	/* Justice */  new CityGlobeInfo( 0, "A snowy scene of the Shrine of Justice" ),
	/* Humility */  new CityGlobeInfo( 0, "A snowy scene of the Shrine of Humility" ),
	/* Honor */   new CityGlobeInfo( 0, "A snowy scene of the Shrine of Honor" ),
	/* Honesty */  new CityGlobeInfo( 0, "A snowy scene of the Shrine of Honesty" ),
	/* Compassion */ new CityGlobeInfo( 0, "A snowy scene of the Shrine of Compassion" ),
   };
  public static CityGlobeInfo GetInfo( CityGlobeType type )
  {
   int v = (int)type;
   if ( v < 0 || v >= m_Table.Length )
	v = 0;
   return m_Table[v];
  }
 }
 public class CityGlobe : Item
 {
  private CityGlobeType m_Type;
  [CommandProperty( AccessLevel.GameMaster )]
  public CityGlobeType Type
  {
   get{ return m_Type; }
   set{ m_Type = value; ReName(); InvalidateProperties(); }
  }
  public override int LabelNumber
  {
   get{ return CityGlobeInfo.GetInfo( m_Type ).LabelNumber; }
  }
  [Constructable]
  public CityGlobe() : this( CityGlobeType.Britain )
  {
  }
  [Constructable]
  public CityGlobe( CityGlobeType type ) : base( 0xE2E ) 
  {
   Weight = 1.0;
   m_Type = type;
   LootType = LootType.Blessed; 
   ReName();
  }
  public void ReName()
  {
   if( LabelNumber == 0 )
	Name = CityGlobeInfo.GetInfo( m_Type ).m_name;
  }
  public CityGlobe( Serial serial ) : base( serial )
  {
  }
  public override void Serialize( GenericWriter writer )
  {
   base.Serialize( writer );
   writer.Write( (int) 0 );
  }
  
  public override void Deserialize(GenericReader reader)
  {
   base.Deserialize( reader );
   int version = reader.ReadInt();
  }
 }
}

__________________
-deadened with the helium of converses!
sidsid is offline   Reply With Quote