| CODE |
| using System; using System.Collections; using Server.Network; using Server; using Server.HuePickers; using Server.Mobiles; namespace Server.Scripts.Commands { public class ChatSystem { private static bool fermeture; public static void Initialize() { Server.Commands.Register( "Dire", AccessLevel.Player, new CommandEventHandler( ChatDireMessage_OnCommand ) ); Server.Commands.Register( "Staff", AccessLevel.Counselor, new CommandEventHandler( ChatStaffMessage_OnCommand ) ); Server.Commands.Register( "Chan", AccessLevel.Player, new CommandEventHandler( ChanStatut_OnCommand ) ); Server.Commands.Register( "ChanOff", AccessLevel.Counselor, new CommandEventHandler( ChanOffMessage_OnCommand )); Server.Commands.Register( "ChanOn", AccessLevel.Counselor, new CommandEventHandler( ChanOnMessage_OnCommand )); Server.Commands.Register( "Chancolor", AccessLevel.Player, new CommandEventHandler( ChanColorMessage_OnCommand )); fermeture = false; } [Usage( "Chan" )] [Description( "Ouvre / Ferme le canal" )] public static void ChanStatut_OnCommand( CommandEventArgs e ) { Mobile somemobile = e.Mobile; PlayerMobile from = somemobile as PlayerMobile; if ( from.Chan == ChanEtat.Open ) { from.Chan = ChanEtat.Close; from.SendMessage("Fermeture du Chan"); } else if (from.Chan != ChanEtat.Ban ) { from.Chan = ChanEtat.Open; from.SendMessage("Ouverture du Chan"); } } [Usage( "Dire" )] [Description( "Envoyer un message sur le canal joueurs" )] public static void ChatDireMessage_OnCommand( CommandEventArgs e ) { Mobile somemobile = e.Mobile; PlayerMobile from = somemobile as PlayerMobile; if (from.Chan == ChanEtat.Ban || from.Chan == ChanEtat.Close || fermeture == true) { from.SendMessage("Vous n'avez pas accés au chan"); } else BroadcastMessage( AccessLevel.Player, String.Format( "[Chan] {0}: {1}", e.Mobile.Name, e.ArgString ) ); } [Usage( "Staff" )] [Description( "Envoyer un message sur le canal staff" )] public static void ChatStaffMessage_OnCommand( CommandEventArgs e ) { BroadcastMessage( AccessLevel.Counselor, 0x25, String.Format( "[Staff] {0}: {1}", e.Mobile.Name, e.ArgString ) ); } [Usage( "ChanOff" )] [Description( "Coupe le canal joueurs" )] public static void ChanOffMessage_OnCommand( CommandEventArgs e ) { if ( fermeture == false ) fermeture = true; } [Usage( "ChanOn" )] [Description( "Rétablit le canal joueurs" )] public static void ChanOnMessage_OnCommand( CommandEventArgs e ) { if ( fermeture == true ) fermeture = false; } [Usage( "Chancolor" )] [Description( "Choix de la couleur du canal joueurs" )] public static void ChanColorMessage_OnCommand( CommandEventArgs e ) { Mobile somemobile = e.Mobile; PlayerMobile from = somemobile as PlayerMobile; from.SendHuePicker( new ChanHuePicker(7974,from)); } public static void BroadcastMessage ( AccessLevel ac, string message ) { foreach ( NetState state in NetState.Instances ) { Mobile m = state.Mobile; PlayerMobile from = m as PlayerMobile; if ( from != null && from.AccessLevel >= ac && from.Chan == ChanEtat.Open && !(from.Chan == ChanEtat.Ban)) { from.SendMessage(from.ChanColor , message ); } } } public static void BroadcastMessage ( AccessLevel ac, int hue, string message ) { foreach ( NetState state in NetState.Instances ) { Mobile m = state.Mobile; PlayerMobile from = m as PlayerMobile; if ( from != null && from.AccessLevel >= ac && !(from.Chan == ChanEtat.Ban)) { from.SendMessage(hue, message ); } } } } public class ChanHuePicker : HuePicker { private PlayerMobile from; public ChanHuePicker( int ItemID, PlayerMobile e ): base (ItemID) { from = e; } public override void OnResponse( int hue ) { from.ChanColor = hue; } } } |
| CODE |
| public enum ChanEtat { Open, Close, Ban } |
| CODE |
| [CommandProperty( AccessLevel.GameMaster)] public ChanEtat Chan { get {return m_Chan;} set {m_Chan = value;} } [CommandProperty( AccessLevel.GameMaster)] public int ChanColor { get {return m_Chancolor;} set {m_Chancolor = value;} } |
| CODE |
| writer.Write((int) m_Chan); writer.Write((int) m_Chancolor); |
| CODE |
| m_Chan = (ChanEtat)reader.ReadInt(); m_Chancolor = (int)reader.ReadInt(); |
| CODE |
| using System; using Server; using Server.Items; namespace Server.Engines.Harvest { public class Lumberjacking : HarvestSystem { private static Lumberjacking m_System; public static Lumberjacking System { get { if ( m_System == null ) m_System = new Lumberjacking(); return m_System; } } private HarvestDefinition m_Cedre, m_Chene, m_Noyer, m_Saule, m_Lumber; public HarvestDefinition Definition { get{ return m_Lumber; } } private Lumberjacking() { HarvestResource[] res; HarvestVein[] veins; #region Lumberjacking Bois Normal HarvestDefinition lumber = m_Lumber = new HarvestDefinition(); // Resource banks are every 4x3 tiles lumber.BankWidth = 4; lumber.BankHeight = 3; // Every bank holds from 30 to 50 logs lumber.MinTotal = 30; lumber.MaxTotal = 50; // A resource bank will respawn its content every 20 to 30 minutes lumber.MinRespawn = TimeSpan.FromMinutes( 20.0 ); lumber.MaxRespawn = TimeSpan.FromMinutes( 30.0 ); // Skill checking is done on the Lumberjacking skill lumber.Skill = SkillName.Lumberjacking; // Set the list of harvestable tiles lumber.Tiles = m_TreeTiles; // Players must be within 2 tiles to harvest lumber.MaxRange = 2; // Ten logs per harvest action lumber.ConsumedPerHarvest = 10; // The chopping effect lumber.EffectActions = new int[]{ 13 }; lumber.EffectSounds = new int[]{ 0x13E }; lumber.EffectCounts = new int[]{ 1, 2, 2, 2, 3 }; lumber.EffectDelay = TimeSpan.FromSeconds( 1.6 ); lumber.EffectSoundDelay = TimeSpan.FromSeconds( 0.9 ); lumber.NoResourcesMessage = 500493; // There's not enough wood here to harvest. lumber.FailMessage = 500495; // You hack at the tree for a while, but fail to produce any useable wood. lumber.OutOfRangeMessage = 500446; // That is too far away. lumber.PackFullMessage = 500497; // You can't place any wood into your backpack! lumber.ToolBrokeMessage = 500499; // You broke your axe. res = new HarvestResource[] { new HarvestResource( 00.0, 00.0, 60.0, 500498, typeof( Log ) ) }; veins = new HarvestVein[] { new HarvestVein( 100.0, 0.0, res[0], null ) }; lumber.Resources = res; lumber.Veins = veins; Definitions.Add( lumber ); #endregion #region Lumberjacking Noyer HarvestDefinition noyer = m_Noyer = new HarvestDefinition(); // Resource banks are every 4x3 tiles noyer.BankWidth = 4; noyer.BankHeight = 3; // Every bank holds from 30 to 50 logs noyer.MinTotal = 8; noyer.MaxTotal = 12; // A resource bank will respawn its content every 20 to 30 minutes noyer.MinRespawn = TimeSpan.FromMinutes( 20.0 ); noyer.MaxRespawn = TimeSpan.FromMinutes( 30.0 ); // Skill checking is done on the Lumberjacking skill noyer.Skill = SkillName.Lumberjacking; // Set the list of harvestable tiles noyer.Tiles = m_NoyerTiles; // Players must be within 2 tiles to harvest noyer.MaxRange = 2; // Ten logs per harvest action noyer.ConsumedPerHarvest = 8; // The chopping effect noyer.EffectActions = new int[]{ 13 }; noyer.EffectSounds = new int[]{ 0x13E }; noyer.EffectCounts = new int[]{ 1, 2, 2, 2, 3 }; noyer.EffectDelay = TimeSpan.FromSeconds( 1.6 ); noyer.EffectSoundDelay = TimeSpan.FromSeconds( 0.9 ); noyer.NoResourcesMessage = 500493; // There's not enough wood here to harvest. noyer.FailMessage = 500495; // You hack at the tree for a while, but fail to produce any useable wood. noyer.PackFullMessage = 500497; // You can't place any wood into your backpack! noyer.ToolBrokeMessage = 500499; // You broke your axe. res = new HarvestResource[] { new HarvestResource( 40.0, 60.0, 100.0, 500498, typeof( NoyerLog ) ) }; veins = new HarvestVein[] { new HarvestVein( 100.0, 0.0, res[0], null ) }; noyer.Resources = res; noyer.Veins = veins; Definitions.Add( noyer ); #endregion #region Lumberjacking Saule HarvestDefinition saule = m_Saule = new HarvestDefinition(); // Resource banks are every 4x3 tiles saule.BankWidth = 4; saule.BankHeight = 3; // Every bank holds from 30 to 50 logs saule.MinTotal = 8; saule.MaxTotal = 12; // A resource bank will respawn its content every 20 to 30 minutes saule.MinRespawn = TimeSpan.FromMinutes( 20.0 ); saule.MaxRespawn = TimeSpan.FromMinutes( 30.0 ); // Skill checking is done on the Lumberjacking skill saule.Skill = SkillName.Lumberjacking; // Set the list of harvestable tiles saule.Tiles = m_SauleTiles; // Players must be within 2 tiles to harvest saule.MaxRange = 2; // Ten logs per harvest action saule.ConsumedPerHarvest = 8; // The chopping effect saule.EffectActions = new int[]{ 13 }; saule.EffectSounds = new int[]{ 0x13E }; saule.EffectCounts = new int[]{ 1, 2, 2, 2, 3 }; saule.EffectDelay = TimeSpan.FromSeconds( 1.6 ); saule.EffectSoundDelay = TimeSpan.FromSeconds( 0.9 ); saule.NoResourcesMessage = 500493; // There's not enough wood here to harvest. saule.FailMessage = 500495; // You hack at the tree for a while, but fail to produce any useable wood. saule.PackFullMessage = 500497; // You can't place any wood into your backpack! saule.ToolBrokeMessage = 500499; // You broke your axe. res = new HarvestResource[] { new HarvestResource( 50.0, 70.0, 100.0, 500498, typeof( SauleLog ) ) }; veins = new HarvestVein[] { new HarvestVein( 100.0, 0.0, res[0], null ) }; saule.Resources = res; saule.Veins = veins; Definitions.Add( saule ); #endregion #region Lumberjacking Chêne HarvestDefinition chene = m_Chene = new HarvestDefinition(); // Resource banks are every 4x3 tiles chene.BankWidth = 4; chene.BankHeight = 3; // Every bank holds from 30 to 50 logs chene.MinTotal = 6; chene.MaxTotal = 10; // A resource bank will respawn its content every 20 to 30 minutes chene.MinRespawn = TimeSpan.FromMinutes( 20.0 ); chene.MaxRespawn = TimeSpan.FromMinutes( 30.0 ); // Skill checking is done on the Lumberjacking skill chene.Skill = SkillName.Lumberjacking; // Set the list of harvestable tiles chene.Tiles = m_CheneTiles; // Players must be within 2 tiles to harvest chene.MaxRange = 2; // Ten logs per harvest action chene.ConsumedPerHarvest = 6; // The chopping effect chene.EffectActions = new int[]{ 13 }; chene.EffectSounds = new int[]{ 0x13E }; chene.EffectCounts = new int[]{ 1, 2, 2, 2, 3 }; chene.EffectDelay = TimeSpan.FromSeconds( 1.6 ); chene.EffectSoundDelay = TimeSpan.FromSeconds( 0.9 ); chene.NoResourcesMessage = 500493; // There's not enough wood here to harvest. chene.FailMessage = 500495; // You hack at the tree for a while, but fail to produce any useable wood. chene.PackFullMessage = 500497; // You can't place any wood into your backpack! chene.ToolBrokeMessage = 500499; // You broke your axe. res = new HarvestResource[] { new HarvestResource( 60.0, 80.0, 100.0, 500498, typeof( CheneLog ) ) }; veins = new HarvestVein[] { new HarvestVein( 100.0, 0.0, res[0], null ) }; chene.Resources = res; chene.Veins = veins; Definitions.Add( chene ); #endregion #region Lumberjacking Cèdre HarvestDefinition cedre = m_Cedre = new HarvestDefinition(); // Resource banks are every 4x3 tiles cedre.BankWidth = 4; cedre.BankHeight = 3; // Every bank holds from 30 to 50 logs cedre.MinTotal = 5; cedre.MaxTotal = 8; // A resource bank will respawn its content every 20 to 30 minutes cedre.MinRespawn = TimeSpan.FromMinutes( 20.0 ); cedre.MaxRespawn = TimeSpan.FromMinutes( 30.0 ); // Skill checking is done on the Lumberjacking skill cedre.Skill = SkillName.Lumberjacking; // Set the list of harvestable tiles cedre.Tiles = m_CedreTiles; // Players must be within 2 tiles to harvest cedre.MaxRange = 2; // Ten logs per harvest action cedre.ConsumedPerHarvest = 4; // The chopping effect cedre.EffectActions = new int[]{ 13 }; cedre.EffectSounds = new int[]{ 0x13E }; cedre.EffectCounts = new int[]{ 1, 2, 2, 2, 3 }; cedre.EffectDelay = TimeSpan.FromSeconds( 1.6 ); cedre.EffectSoundDelay = TimeSpan.FromSeconds( 0.9 ); cedre.NoResourcesMessage = 500493; // There's not enough wood here to harvest. cedre.FailMessage = 500495; // You hack at the tree for a while, but fail to produce any useable wood. cedre.PackFullMessage = 500497; // You can't place any wood into your backpack! cedre.ToolBrokeMessage = 500499; // You broke your axe. res = new HarvestResource[] { new HarvestResource( 70.0, 90.0, 100.0, 500498, typeof( CedreLog ) ) }; veins = new HarvestVein[] { new HarvestVein( 100.0, 0.0, res[0], null ) }; cedre.Resources = res; cedre.Veins = veins; Definitions.Add( cedre ); #endregion } public override bool CheckHarvest( Mobile from, Item tool ) { if ( !base.CheckHarvest( from, tool ) ) return false; if ( tool.Parent != from ) { from.SendLocalizedMessage( 500487 ); // The axe must be equipped for any serious wood chopping. return false; } return true; } public override bool CheckHarvest( Mobile from, Item tool, HarvestDefinition def, object toHarvest ) { if ( !base.CheckHarvest( from, tool, def, toHarvest ) ) return false; if ( tool.Parent != from ) { from.SendLocalizedMessage( 500487 ); // The axe must be equipped for any serious wood chopping. return false; } return true; } public override void OnBadHarvestTarget( Mobile from, Item tool, object toHarvest ) { from.SendLocalizedMessage( 500489 ); // You can't use an axe on that. } public static void Initialize() { Array.Sort( m_TreeTiles ); Array.Sort( m_CedreTiles ); Array.Sort( m_NoyerTiles ); Array.Sort( m_CheneTiles ); Array.Sort( m_SauleTiles ); } #region Tile lists private static int[] m_TreeTiles = new int[] { 0x4CCA, 0x4CCB, 0x4CCC, 0x4CD0, 0x4CD3, 0x4CF8, 0x4CFB, 0x4CFE, 0x4CCD, 0x4D01, 0x4D41, 0x4D42, 0x4D43, 0x4D44, 0x4D57, 0x4D58, 0x4D59, 0x4D5A, 0x4D5B, 0x4D6E, 0x4D6F, 0x4D70, 0x4D71, 0x4D72, 0x4D84, 0x4D85, 0x4D86, 0x52B5, 0x52B6, 0x52B7, 0x52B8, 0x52B9, 0x52BA, 0x52BB, 0x52BC, 0x52BD, 0x4CCE, 0x4CCF, 0x4CD1, 0x4CD2, 0x4CD4, 0x4CD5, 0x4CD7, 0x4CD9, 0x4CDB, 0x4CDC, 0x4CDE, 0x4CDF, 0x4CE1, 0x4CE2, 0x4CE4, 0x4CE5, 0x4CE7, 0x4CE8, 0x4CF9, 0x4CFA, 0x4CFC, 0x4CFD, 0x4CFF, 0x4D00, 0x4D02, 0x4D03, 0x4D45, 0x4D46, 0x4D47, 0x4D48, 0x4D49, 0x4D4A, 0x4D4B, 0x4D4C, 0x4D4D, 0x4D4E, 0x4D4F, 0x4D50, 0x4D51, 0x4D52, 0x4D53, 0x4D5C, 0x4D5D, 0x4D5E, 0x4D5F, 0x4D60, 0x4D61, 0x4D62, 0x4D63, 0x4D64, 0x4D65, 0x4D66, 0x4D67, 0x4D68, 0x4D69, 0x4D73, 0x4D74, 0x4D75, 0x4D76, 0x4D77, 0x4D78, 0x4D79, 0x4D7A, 0x4D7B, 0x4D7C, 0x4D7D, 0x4D7E, 0x4D7F, 0x4D87, 0x4D88, 0x4D89, 0x4D8A, 0x4D8B, 0x4D8C, 0x4D8D, 0x4D8E, 0x4D8F, 0x4D90, 0x4D95, 0x4D96, 0x4D97, 0x4D99, 0x4D9A, 0x4D9B, 0x4D9D, 0x4D9E, 0x4D9F, 0x4DA1, 0x4DA2, 0x4DA3, 0x4DA5, 0x4DA6, 0x4DA7, 0x4DA9, 0x4DAA, 0x4DAB, 0x52BE, 0x52BF, 0x52C0, 0x52C1, 0x52C2, 0x52C3, 0x52C4, 0x52C5, 0x52C6, 0x52C7 }; private static int[] m_CedreTiles = new int[] { 0x4CD8, 0x4CD6 }; private static int[] m_NoyerTiles = new int[] { 0x4CE0, 0x4CE3 }; private static int[] m_CheneTiles = new int[] { 0x4CDA, 0x4CDD }; private static int[] m_SauleTiles = new int[] { 0x4CE6 }; #endregion } } |
| CODE |
| using System; using Server.Items; namespace Server.Items { [FlipableAttribute( 0x1bdd, 0x1be0 )] public class CedreLog : Item, ICommodity { string ICommodity.Description { get { return String.Format( Amount == 1 ? "{0} log" : "{0} Rondins de Cèdre", Amount ); } } [Constructable] public CedreLog() : this( 1 ) { } [Constructable] public CedreLog( int amount ) : base( 0x1BDD ) { Stackable = true; Weight = 2.0; Amount = amount; Hue = 1846; Name = "Rondin de Cèdre"; } public CedreLog( Serial serial ) : base( serial ) { } public override Item Dupe( int amount ) { return base.Dupe( new CedreLog( amount ), amount ); } 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(); } } } |